@yukino.js/yukino 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +320 -0
  3. package/dist/acp-IVY5HZR4.js +14 -0
  4. package/dist/agent-QANDY7FO.js +4 -0
  5. package/dist/anthropic-6YLT4JZR.js +4 -0
  6. package/dist/bwrap-MLSZLWHD.js +4 -0
  7. package/dist/chunk-2LHY3FND.js +67 -0
  8. package/dist/chunk-3KKA6537.js +4 -0
  9. package/dist/chunk-3QL446GD.js +4 -0
  10. package/dist/chunk-4GE22WHI.js +4 -0
  11. package/dist/chunk-5VOCXSSX.js +5 -0
  12. package/dist/chunk-77W2UPS2.js +4 -0
  13. package/dist/chunk-7MKA3SHV.js +4 -0
  14. package/dist/chunk-AGSYLE4E.js +16 -0
  15. package/dist/chunk-CU3IISCC.js +4 -0
  16. package/dist/chunk-GYBJR2RB.js +65 -0
  17. package/dist/chunk-HLE7243Q.js +4 -0
  18. package/dist/chunk-HMZQYFYG.js +4 -0
  19. package/dist/chunk-JFKC4VCA.js +4 -0
  20. package/dist/chunk-K4BYVVW7.js +5 -0
  21. package/dist/chunk-KCMBAHWU.js +4 -0
  22. package/dist/chunk-L2BWSPCF.js +10 -0
  23. package/dist/chunk-MDPSQ6L7.js +44 -0
  24. package/dist/chunk-OFC2GD5K.js +4 -0
  25. package/dist/chunk-RAS3ORX3.js +164 -0
  26. package/dist/chunk-RCXKUD3Y.js +4 -0
  27. package/dist/chunk-SAJCBGHL.js +4 -0
  28. package/dist/chunk-SOO5OXX2.js +237 -0
  29. package/dist/chunk-T4O4GQVL.js +607 -0
  30. package/dist/chunk-UPNNYP7M.js +60 -0
  31. package/dist/chunk-VCIRD267.js +4 -0
  32. package/dist/chunk-VU3JWAJR.js +4 -0
  33. package/dist/chunk-VWUGGYUP.js +6 -0
  34. package/dist/chunk-XO7ITAWR.js +4 -0
  35. package/dist/devtools-YWVUN4HX.js +7 -0
  36. package/dist/esm-57CJEGGK.js +4 -0
  37. package/dist/esm-6L5BJ5GT.js +4 -0
  38. package/dist/esm-DIYJ5HX6.js +4 -0
  39. package/dist/esm-HW2JMFYC.js +4 -0
  40. package/dist/esm-RPR2GBJ2.js +4 -0
  41. package/dist/esm-YKAO4ES6.js +4 -0
  42. package/dist/esm-ZTIYTMTS.js +229 -0
  43. package/dist/getMachineId-bsd-E27XJQLX.js +4 -0
  44. package/dist/getMachineId-darwin-35UPAIXP.js +5 -0
  45. package/dist/getMachineId-linux-MKXIYT6A.js +4 -0
  46. package/dist/getMachineId-unsupported-ZXVGGFX2.js +4 -0
  47. package/dist/getMachineId-win-RNVIYJG5.js +4 -0
  48. package/dist/lib/agent-6FZX4P2Y.js +16 -0
  49. package/dist/lib/anthropic-IP23YZ3P.js +21 -0
  50. package/dist/lib/bwrap-2OL7VPSO.js +7 -0
  51. package/dist/lib/chunk-2VF3XTGH.js +3382 -0
  52. package/dist/lib/chunk-5DVQ64YL.js +619 -0
  53. package/dist/lib/chunk-5TGXH7BX.js +624 -0
  54. package/dist/lib/chunk-6OMQD7MK.js +591 -0
  55. package/dist/lib/chunk-AZRC67RW.js +512 -0
  56. package/dist/lib/chunk-F2YJG72O.js +150 -0
  57. package/dist/lib/chunk-FFM2LB4C.js +132 -0
  58. package/dist/lib/chunk-FLKB4BK7.js +50 -0
  59. package/dist/lib/chunk-I34MAQRE.js +255 -0
  60. package/dist/lib/chunk-KA6POJKI.js +889 -0
  61. package/dist/lib/chunk-MLKGABMK.js +9 -0
  62. package/dist/lib/chunk-O7ELJUEK.js +262 -0
  63. package/dist/lib/chunk-QYBQT2DM.js +655 -0
  64. package/dist/lib/chunk-YIWNQ7OA.js +47 -0
  65. package/dist/lib/index.d.ts +8581 -0
  66. package/dist/lib/index.js +15905 -0
  67. package/dist/lib/openai-EMJ6U4FW.js +15 -0
  68. package/dist/lib/permissions-KZ5ACZAX.js +19 -0
  69. package/dist/lib/providers-2CGZPBFI.js +9 -0
  70. package/dist/lib/sandbox-runtime-CCQ3X3SM.js +9 -0
  71. package/dist/lib/seatbelt-WO7YWKLR.js +7 -0
  72. package/dist/lib/tool-filter-CKHZUUBQ.js +21 -0
  73. package/dist/main.js +332 -0
  74. package/dist/node-634LOHDX.js +15 -0
  75. package/dist/openai-YXYO5OW6.js +34 -0
  76. package/dist/permissions-VCDMNX3L.js +4 -0
  77. package/dist/providers-HNMBGGW6.js +4 -0
  78. package/dist/sandbox-runtime-ELKAYRIL.js +4 -0
  79. package/dist/seatbelt-JOCANLYS.js +4 -0
  80. package/dist/server-ZHQILOBP.js +4 -0
  81. package/dist/src-43CPCEK2.js +12 -0
  82. package/dist/src-JBRNH4FA.js +4 -0
  83. package/dist/src-R4BSSIJJ.js +4 -0
  84. package/dist/src-X6JWWHHT.js +4 -0
  85. package/dist/tool-filter-BQZDV3TF.js +4 -0
  86. package/dist/turndown.es-NQ3KDXM7.js +83 -0
  87. package/package.json +146 -0
@@ -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{b as td,c as rd,u as Xm,v as Jm}from"./chunk-3QL446GD.js";import{L as Ym,M as Km}from"./chunk-CU3IISCC.js";import{t as Zu,u as ed}from"./chunk-VCIRD267.js";import{a as z,b as $m,c as g,d as Vm,f as pr}from"./chunk-7MKA3SHV.js";var id=g(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.VERSION=void 0;Mn.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 Wa=g((tw,Qm)=>{Qm.exports={name:"@grpc/grpc-js",version:"1.14.5",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 Ga,$a,Va,Ya;Object.defineProperty(Be,"__esModule",{value:!0});Be.log=Be.setLoggerVerbosity=Be.setLogger=Be.getLogger=void 0;Be.trace=cv;Be.isTracerEnabled=cd;var $t=B(),Zm=z("process"),ev=Wa().version,tv={error:(i,...e)=>{console.error("E "+i,...e)},info:(i,...e)=>{console.error("I "+i,...e)},debug:(i,...e)=>{console.error("D "+i,...e)}},gr=tv,Ur=$t.LogVerbosity.ERROR,rv=($a=(Ga=process.env.GRPC_NODE_VERBOSITY)!==null&&Ga!==void 0?Ga:process.env.GRPC_VERBOSITY)!==null&&$a!==void 0?$a:"";switch(rv.toUpperCase()){case"DEBUG":Ur=$t.LogVerbosity.DEBUG;break;case"INFO":Ur=$t.LogVerbosity.INFO;break;case"ERROR":Ur=$t.LogVerbosity.ERROR;break;case"NONE":Ur=$t.LogVerbosity.NONE;break;default:}var iv=()=>gr;Be.getLogger=iv;var nv=i=>{gr=i};Be.setLogger=nv;var sv=i=>{Ur=i};Be.setLoggerVerbosity=sv;var av=(i,...e)=>{let t;if(i>=Ur){switch(i){case $t.LogVerbosity.DEBUG:t=gr.debug;break;case $t.LogVerbosity.INFO:t=gr.info;break;case $t.LogVerbosity.ERROR:t=gr.error;break}t||(t=gr.error),t&&t.bind(gr)(...e)}};Be.log=av;var ov=(Ya=(Va=process.env.GRPC_NODE_TRACE)!==null&&Va!==void 0?Va:process.env.GRPC_TRACE)!==null&&Ya!==void 0?Ya:"",kn=new Set,od=new Set;for(let i of ov.split(","))i.length!==0&&(i.startsWith("-")?od.add(i.substring(1)):kn.add(i));var ld=kn.has("all"),lv=ld||kn.size>0;function cv(i,e,t){cd(e)&&(0,Be.log)(i,new Date().toISOString()+" | v"+ev+" "+Zm.pid+" | "+e+" | "+t)}function cd(i){return lv?!od.has(i)&&(ld||kn.has(i)):!1}});var Dn=g(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.getErrorMessage=uv;xn.getErrorCode=dv;function uv(i){return i instanceof Error?i.message:String(i)}function dv(i){return typeof i=="object"&&i!==null&&"code"in i&&typeof i.code=="number"?i.code:null}});var pe=g(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.Metadata=void 0;var hv=ee(),fv=B(),pv=Dn(),gv=/^[:0-9a-z_.-]+$/,mv=/^[ -~]*$/;function vv(i){return gv.test(i)}function yv(i){return mv.test(i)}function dd(i){return i.endsWith("-bin")}function _v(i){return!i.startsWith("grpc-")}function Ln(i){return i.toLowerCase()}function ud(i,e){if(!vv(i))throw new Error('Metadata key "'+i+'" contains illegal characters');if(e!=null)if(dd(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(!yv(e))throw new Error('Metadata string value "'+e+'" contains illegal characters')}}var Ka=class i{constructor(e={}){this.internalRepr=new Map,this.opaqueData=new Map,this.options=e}set(e,t){e=Ln(e),ud(e,t),this.internalRepr.set(e,[t])}add(e,t){e=Ln(e),ud(e,t);let r=this.internalRepr.get(e);r===void 0?this.internalRepr.set(e,[t]):r.push(t)}remove(e){e=Ln(e),this.internalRepr.delete(e)}get(e){return e=Ln(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(":")||(e[t]=r.map(Ev));return e}toJSON(){let e={};for(let[t,r]of this.internalRepr)e[t]=r;return e}setOpaque(e,t){this.opaqueData.set(e,t)}getOpaque(e){return this.opaqueData.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{dd(r)?Array.isArray(n)?n.forEach(s=>{t.add(r,Buffer.from(s,"base64"))}):n!==void 0&&(_v(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,pv.getErrorMessage)(s)}. For more information see https://github.com/grpc/grpc-node/issues/1173`;(0,hv.log)(fv.LogVerbosity.ERROR,a)}}return t}};Fn.Metadata=Ka;var Ev=i=>Buffer.isBuffer(i)?i.toString("base64"):i});var Un=g(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.CallCredentials=void 0;var Za=pe();function Sv(i){return"getRequestHeaders"in i&&typeof i.getRequestHeaders=="function"}var Br=class i{static createFromMetadataGenerator(e){return new Ja(e)}static createFromGoogleCredential(e){return i.createFromMetadataGenerator((t,r)=>{let n;Sv(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 Za.Metadata;for(let o of Object.keys(s))a.add(o,s[o]);r(null,a)},s=>{r(s)})})}static createEmpty(){return new Qa}};qn.CallCredentials=Br;var Xa=class i extends Br{constructor(e){super(),this.creds=e}async generateMetadata(e){let t=new Za.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 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}},Ja=class i extends Br{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 new Xa([this,e])}_equals(e){return this===e?!0:e instanceof i?this.metadataGenerator===e.metadataGenerator:!1}},Qa=class i extends Br{generateMetadata(e){return Promise.resolve(new Za.Metadata)}compose(e){return e}_equals(e){return e instanceof i}}});var to=g(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.CIPHER_SUITES=void 0;Oi.getDefaultRootsData=Tv;var Cv=z("fs");Oi.CIPHER_SUITES=process.env.GRPC_SSL_CIPHER_SUITES;var hd=process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH,eo=null;function Tv(){return hd?(eo===null&&(eo=Cv.readFileSync(hd)),eo):null}});var Pe=g(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.parseUri=Rv;zr.splitHostPort=wv;zr.combineHostPort=Ov;zr.uriToString=Av;var bv=/^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/;function Rv(i){let e=bv.exec(i);return e===null?null:{scheme:e[1],authority:e[2],path:e[3]}}var fd=/^\d+$/;function wv(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 fd.test(r)?{host:t,port:+r}:null}else return null;else return{host:t}}else{let e=i.split(":");return e.length===2?fd.test(e[1])?{host:e[0],port:+e[1]}:null:{host:i}}}function Ov(i){return i.port===void 0?i.host:i.host.includes(":")?`[${i.host}]:${i.port}`:`${i.host}:${i.port}`}function Av(i){let e="";return i.scheme!==void 0&&(e+=i.scheme+":"),i.authority!==void 0&&(e+="//"+i.authority+"/"),e+=i.path,e}});var et=g(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=void 0;Mt.registerResolver=Nv;Mt.registerDefaultScheme=Pv;Mt.createResolver=Iv;Mt.getDefaultAuthority=Mv;Mt.mapUriDefaultScheme=kv;var io=Pe();Mt.CHANNEL_ARGS_CONFIG_SELECTOR_KEY="grpc.internal.config_selector";var Hr={},ro=null;function Nv(i,e){Hr[i]=e}function Pv(i){ro=i}function Iv(i,e,t){if(i.scheme!==void 0&&i.scheme in Hr)return new Hr[i.scheme](i,e,t);throw new Error(`No resolver could be created for target ${(0,io.uriToString)(i)}`)}function Mv(i){if(i.scheme!==void 0&&i.scheme in Hr)return Hr[i.scheme].getDefaultAuthority(i);throw new Error(`Invalid target ${(0,io.uriToString)(i)}`)}function kv(i){return i.scheme===void 0||!(i.scheme in Hr)?ro!==null?{scheme:ro,authority:void 0,path:(0,io.uriToString)(i)}:null:i}});var jr=g(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.ChannelCredentials=void 0;Ni.createCertificateProviderChannelCredentials=Fv;var Ai=z("tls"),Hn=Un(),so=to(),pd=Pe(),xv=et(),Dv=ee(),Lv=B();function no(i,e){if(i&&!(i instanceof Buffer))throw new TypeError(`${e}, if provided, must be a Buffer.`)}var mr=class{compose(e){return new lo(this,e)}static createSsl(e,t,r,n){var s;if(no(e,"Root certificate"),no(t,"Private key"),no(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,Ai.createSecureContext)({ca:(s=e??(0,so.getDefaultRootsData)())!==null&&s!==void 0?s:void 0,key:t??void 0,cert:r??void 0,ciphers:so.CIPHER_SUITES});return new Bn(a,n??{})}static createFromSecureContext(e,t){return new Bn(e,t??{})}static createInsecure(){return new ao}};Ni.ChannelCredentials=mr;var ao=class i extends mr{constructor(){super()}compose(e){throw new Error("Cannot compose insecure credentials")}_isSecure(){return!1}_equals(e){return e instanceof i}_createSecureConnector(e,t,r){return{connect(n){return Promise.resolve({socket:n,secure:!1})},waitForReady:()=>Promise.resolve(),getCallCredentials:()=>r??Hn.CallCredentials.createEmpty(),destroy(){}}}};function gd(i,e,t,r){var n,s;let a={secureContext:i},o=t;if("grpc.http_connect_target"in r){let h=(0,pd.parseUri)(r["grpc.http_connect_target"]);h&&(o=h)}let l=(0,xv.getDefaultAuthority)(o),c=(0,pd.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:Ai.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 oo=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,Ai.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(){}},Bn=class i extends mr{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=gd(this.secureContext,this.verifyOptions,e,t);return new oo(n,r??Hn.CallCredentials.createEmpty())}},zn=class i extends mr{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??Hn.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,Ai.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:so.CIPHER_SUITES})}catch(r){return(0,Dv.log)(Lv.LogVerbosity.ERROR,"Failed to createSecureContext with error "+r.message),null}}};zn.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=gd(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,Ai.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 Fv(i,e,t){return new zn(i,e,t??{})}var lo=class i extends mr{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??Hn.CallCredentials.createEmpty());return this.channelCredentials._createSecureConnector(e,t,n)}}});var Yt=g(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.createChildChannelControlHelper=Bv;gt.registerLoadBalancerType=zv;gt.registerDefaultLoadBalancerType=Hv;gt.createLoadBalancer=jv;gt.isLoadBalancerNameRegistered=Wv;gt.parseLoadBalancingConfig=md;gt.getDefaultConfig=Gv;gt.selectLbConfigFromList=$v;var qv=ee(),Uv=B();function Bv(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 Vt={},Pi=null;function zv(i,e,t){Vt[i]={LoadBalancer:e,LoadBalancingConfig:t}}function Hv(i){Pi=i}function jv(i,e){let t=i.getLoadBalancerName();return t in Vt?new Vt[t].LoadBalancer(e):null}function Wv(i){return i in Vt}function md(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 Vt)try{return Vt[t].LoadBalancingConfig.createFromJson(i[t])}catch(r){throw new Error(`${t}: ${r.message}`)}else throw new Error(`Unrecognized load balancing config name ${t}`)}function Gv(){if(!Pi)throw new Error("No default load balancer type registered");return new Vt[Pi].LoadBalancingConfig}function $v(i,e=!1){for(let t of i)try{return md(t)}catch(r){(0,qv.log)(Uv.LogVerbosity.DEBUG,"Config parsing failed with error",r.message);continue}return e&&Pi?new Vt[Pi].LoadBalancingConfig:null}});var co=g(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.validateRetryThrottling=vd;Ii.validateServiceConfig=yd;Ii.extractAndSelectServiceConfig=ry;var Vv=z("os"),jn=B(),Wn=/^\d+(\.\d{1,9})?s$/,Yv="node";function Kv(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 Xv(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"||!Wn.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"||!Wn.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(jn.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(jn.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 Jv(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"||!Wn.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(jn.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(jn.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 Qv(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(Kv(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"&&Wn.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=Xv(i.retryPolicy)}else"hedgingPolicy"in i&&(t.hedgingPolicy=Jv(i.hedgingPolicy));return t}function vd(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 Zv(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 yd(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(Zv(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(Qv(r));"retryThrottling"in i&&(e.retryThrottling=vd(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 ey(i){if(!("serviceConfig"in i))throw new Error("Invalid service config choice: missing service config");let e={serviceConfig:yd(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 ty(i,e){if(!Array.isArray(i))throw new Error("Invalid service config list");for(let t of i){let r=ey(t);if(!(typeof r.percentage=="number"&&e>r.percentage)){if(Array.isArray(r.clientHostname)){let n=!1;for(let s of r.clientHostname)s===Vv.hostname()&&(n=!0);if(!n)continue}if(Array.isArray(r.clientLanguage)){let n=!1;for(let s of r.clientLanguage)s===Yv&&(n=!0);if(!n)continue}return r.serviceConfig}}throw new Error("No matching service config found")}function ry(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 ty(n,e)}return null}});var Ie=g(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.ConnectivityState=void 0;var _d;(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"})(_d||(Gn.ConnectivityState=_d={}))});var kt=g(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.QueuePicker=Kt.UnavailablePicker=Kt.PickResultType=void 0;var iy=pe(),ny=B(),$n;(function(i){i[i.COMPLETE=0]="COMPLETE",i[i.QUEUE=1]="QUEUE",i[i.TRANSIENT_FAILURE=2]="TRANSIENT_FAILURE",i[i.DROP=3]="DROP"})($n||(Kt.PickResultType=$n={}));var uo=class{constructor(e){this.status=Object.assign({code:ny.Status.UNAVAILABLE,details:"No connection established",metadata:new iy.Metadata},e)}pick(e){return{pickResultType:$n.TRANSIENT_FAILURE,subchannel:null,status:this.status,onCallStarted:null,onCallEnded:null}}};Kt.UnavailablePicker=uo;var ho=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:$n.QUEUE,subchannel:null,status:null,onCallStarted:null,onCallEnded:null}}};Kt.QueuePicker=ho});var Wr=g(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.BackoffTimeout=void 0;var sy=B(),Ed=ee(),Sd="backoff",ay=1e3,oy=1.6,ly=12e4,cy=.2;function uy(i,e){return Math.random()*(e-i)+i}var Vn=class i{constructor(e,t){this.callback=e,this.initialDelay=ay,this.multiplier=oy,this.maxDelay=ly,this.jitter=cy,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 Ed.isTracerEnabled(Sd)}trace(e){this.traceEnabled&&Ed.trace(sy.LogVerbosity.DEBUG,Sd,"{"+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+uy(-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}};Yn.BackoffTimeout=Vn;Vn.nextId=0});var Xn=g(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.ChildLoadBalancerHandler=void 0;var dy=Yt(),hy=Ie(),fy="child_load_balancer_helper",fo=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===hy.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,dy.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 fy}};Kn.ChildLoadBalancerHandler=fo});var bd=g(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.ResolvingLoadBalancer=void 0;var py=Yt(),gy=co(),xe=Ie(),Cd=et(),Mi=kt(),my=Wr(),po=B(),vy=pe(),yy=ee(),_y=B(),Ey=Pe(),Sy=Xn(),Cy="resolving_load_balancer";function Td(i){yy.trace(_y.LogVerbosity.DEBUG,Cy,i)}var Ty=["SERVICE_AND_METHOD","SERVICE","EMPTY"];function by(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 Ry(i,e,t,r){for(let n of t)if(by(i,e,n,r))return n;return null}function wy(i){return{invoke(e,t){var r,n;let s=e.split("/").filter(l=>l.length>0),a=(r=s[0])!==null&&r!==void 0?r:"",o=(n=s[1])!==null&&n!==void 0?n:"";if(i&&i.methodConfig)for(let l of Ty){let c=Ry(a,o,i.methodConfig,l);if(c)return{methodConfig:c,pickInformation:{},status:po.Status.OK,dynamicFilterFactories:[]}}return{methodConfig:{name:[]},pickInformation:{},status:po.Status.OK,dynamicFilterFactories:[]}},unref(){}}}var go=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 Mi.QueuePicker(this),this.latestChildErrorMessage=null,this.currentState=xe.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1,r["grpc.service_config"]?this.defaultServiceConfig=(0,gy.validateServiceConfig)(JSON.parse(r["grpc.service_config"])):this.defaultServiceConfig={loadBalancingConfig:[],methodConfig:[]},this.updateState(xe.ConnectivityState.IDLE,new Mi.QueuePicker(this),null),this.childLoadBalancer=new Sy.ChildLoadBalancerHandler({createSubchannel:t.createSubchannel.bind(t),requestReresolution:()=>{this.backoffTimeout.isRunning()?(Td("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,Cd.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 my.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,py.selectLbConfigFromList)(c,!0);u===null?(o=!1,this.handleResolutionFailure({code:po.Status.UNAVAILABLE,details:"All load balancer options in service config are not compatible",metadata:new vy.Metadata})):o=this.childLoadBalancer.updateAddressList(e,u,Object.assign(Object.assign({},this.channelOptions),t),n)}return o&&this.onSuccessfulResolution(l,(a=t[Cd.CHANNEL_ARGS_CONFIG_SELECTOR_KEY])!==null&&a!==void 0?a:wy(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){Td((0,Ey.uriToString)(this.target)+" "+xe.ConnectivityState[this.currentState]+" -> "+xe.ConnectivityState[e]),e===xe.ConnectivityState.IDLE&&(t=new Mi.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 Mi.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 Mi.QueuePicker(this),this.currentState=xe.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1}getTypeName(){return"resolving_load_balancer"}};Jn.ResolvingLoadBalancer=go});var Rd=g(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.recognizedOptions=void 0;ki.channelOptionsEqual=Oy;ki.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 Oy(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=Di;tt.subchannelAddressEqual=Qn;tt.subchannelAddressToString=Od;tt.stringToSubchannelAddress=Ny;tt.endpointEqual=Py;tt.endpointToString=Iy;tt.endpointHasAddress=Ad;var wd=z("net");function Di(i){return"port"in i}function Qn(i,e){return!i&&!e?!0:!i||!e?!1:Di(i)?Di(e)&&i.host===e.host&&i.port===e.port:!Di(e)&&i.path===e.path}function Od(i){return Di(i)?(0,wd.isIPv6)(i.host)?"["+i.host+"]:"+i.port:i.host+":"+i.port:i.path}var Ay=443;function Ny(i,e){return(0,wd.isIP)(i)?{host:i,port:e??Ay}:{path:i}}function Py(i,e){if(i.addresses.length!==e.addresses.length)return!1;for(let t=0;t<i.addresses.length;t++)if(!Qn(i.addresses[t],e.addresses[t]))return!1;return!0}function Iy(i){return"["+i.addresses.map(Od).join(", ")+"]"}function Ad(i,e){for(let t of i.addresses)if(Qn(t,e))return!0;return!1}function xi(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(Qn(t,n)){r=!0;break}if(!r)return!1}return!0}var mo=class{constructor(){this.map=new Set}get size(){return this.map.size}getForSubchannelAddress(e){for(let t of this.map)if(Ad(t.key,e))return t.value}deleteMissing(e){let t=[];for(let r of this.map){let n=!1;for(let s of e)xi(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(xi(e,t.key))return t.value}set(e,t){for(let r of this.map)if(xi(e,r.key)){r.value=t;return}this.map.add({key:e,value:t})}delete(e){for(let t of this.map)if(xi(e,t.key)){this.map.delete(t);return}}has(e){for(let t of this.map)if(xi(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=mo});var Pd={};Vm(Pd,{OrderedMap:()=>Uy});function Gr(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");vo(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function My(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 vr(){throw new RangeError("Iterator access denied!")}var vo,Nd,ky,xy,Dy,Ly,Fy,qy,xt,Uy,Id=$m(()=>{"use strict";vo=function(i,e){return vo=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])},vo(i,e)};Nd=(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})(),ky=(function(i){Gr(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})(Nd),xy=(function(){function i(e){e===void 0&&(e=0),this.iteratorType=e}return i.prototype.equals=function(e){return this.C===e.C},i})(),Dy=(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})(),Ly=(function(i){Gr(e,i);function e(){return i!==null&&i.apply(this,arguments)||this}return e})(Dy);Fy=(function(i){Gr(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?ky:Nd,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&&vr(),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&&vr();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})(Ly),qy=(function(i){Gr(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&&vr(),this.C=this.C.v(),this},s.next=function(){return this.C===this.A&&vr(),this.C=this.C.p(),this}):(s.pre=function(){return this.C===this.A.i&&vr(),this.C=this.C.p(),this},s.next=function(){return this.C===this.A&&vr(),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})(xy),xt=(function(i){Gr(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&&vr();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})(qy),Uy=(function(i){Gr(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 My(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})(Fy)});var es=g(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.registerAdminService=By;Zn.addAdminServicesToServer=zy;var Md=[];function By(i,e){Md.push({getServiceDefinition:i,getHandlers:e})}function zy(i){for(let{getServiceDefinition:e,getHandlers:t}of Md)i.addService(e(),t())}});var kd=g(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.ClientDuplexStreamImpl=rt.ClientWritableStreamImpl=rt.ClientReadableStreamImpl=rt.ClientUnaryCallImpl=void 0;rt.callErrorFromStatus=jy;var Hy=z("events"),Co=z("stream"),Li=B();function jy(i,e){let t=`${i.code} ${Li.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 yo=class extends Hy.EventEmitter{constructor(){super()}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(Li.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=yo;var _o=class extends Co.Readable{constructor(e){super({objectMode:!0}),this.deserialize=e}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(Li.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=_o;var Eo=class extends Co.Writable{constructor(e){super({objectMode:!0}),this.serialize=e}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(Li.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=Eo;var So=class extends Co.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(Li.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=So});var _r=g(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.InterceptingListenerImpl=void 0;yr.statusOrFromValue=Gy;yr.statusOrFromError=$y;yr.isInterceptingListener=Vy;var Wy=pe();function Gy(i){return{ok:!0,value:i}}function $y(i){var e;return{ok:!1,error:Object.assign(Object.assign({},i),{metadata:(e=i.metadata)!==null&&e!==void 0?e:new Wy.Metadata})}}function Vy(i){return i.onReceiveMetadata!==void 0&&i.onReceiveMetadata.length===1}var To=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)})}};yr.InterceptingListenerImpl=To});var Po=g(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.InterceptingCall=it.RequesterBuilder=it.ListenerBuilder=it.InterceptorConfigurationError=void 0;it.getInterceptingCall=Jy;var Yy=pe(),xd=_r(),Dd=B(),Ld=Dn(),qi=class i extends Error{constructor(e){super(e),this.name="InterceptorConfigurationError",Error.captureStackTrace(this,i)}};it.InterceptorConfigurationError=qi;var Ro=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=Ro;var wo=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=wo;var bo={onReceiveMetadata:(i,e)=>{e(i)},onReceiveMessage:(i,e)=>{e(i)},onReceiveStatus:(i,e)=>{e(i)}},Fi={start:(i,e,t)=>{t(i,e)},sendMessage:(i,e)=>{e(i)},halfClose:i=>{i()},cancel:i=>{i()}},Oo=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:Fi.start,sendMessage:(n=t.sendMessage)!==null&&n!==void 0?n:Fi.sendMessage,halfClose:(s=t.halfClose)!==null&&s!==void 0?s:Fi.halfClose,cancel:(a=t.cancel)!==null&&a!==void 0?a:Fi.cancel}:this.requester=Fi}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,xd.isInterceptingListener)(h))v=h;else{let R={onReceiveMetadata:(f=h.onReceiveMetadata)!==null&&f!==void 0?f:bo.onReceiveMetadata,onReceiveMessage:(_=h.onReceiveMessage)!==null&&_!==void 0?_:bo.onReceiveMessage,onReceiveStatus:(p=h.onReceiveStatus)!==null&&p!==void 0?p:bo.onReceiveStatus};v=new xd.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=Oo;function Ky(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 ts=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(Dd.Status.INTERNAL,`Request message serialization failure: ${(0,Ld.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:Dd.Status.INTERNAL,details:`Response message parsing error: ${(0,Ld.getErrorMessage)(o)}`,metadata:new Yy.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()}},Ao=class extends ts{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()}},No=class extends ts{};function Xy(i,e,t){let r=Ky(i,t.path,e);return t.responseStream?new No(r,t):new Ao(r,t)}function Jy(i,e,t,r){if(i.clientInterceptors.length>0&&i.clientInterceptorProviders.length>0)throw new qi("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 qi("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=>Xy(r,o,e))(s)}});var ko=g(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.Client=void 0;var mt=kd(),Qy=xo(),Zy=Ie(),Xt=B(),$r=pe(),rs=Po(),nt=Symbol(),Vr=Symbol(),Yr=Symbol(),Dt=Symbol();function Io(i){return typeof i=="function"}function Kr(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 Mo=class{constructor(e,t,r={}){var n,s;if(r=Object.assign({},r),this[Vr]=(n=r.interceptors)!==null&&n!==void 0?n:[],delete r.interceptors,this[Yr]=(s=r.interceptor_providers)!==null&&s!==void 0?s:[],delete r.interceptor_providers,this[Vr].length>0&&this[Yr].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 Qy.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===Zy.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(Io(e))return{metadata:new $r.Metadata,options:{},callback:e};if(Io(t))return e instanceof $r.Metadata?{metadata:e,options:{},callback:t}:{metadata:new $r.Metadata,options:e,callback:t};if(!(e instanceof $r.Metadata&&t instanceof Object&&Io(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 mt.ClientUnaryCallImpl,channel:this[nt],methodDefinition:h,callOptions:u.options,callback:u.callback};this[Dt]&&(f=this[Dt](f));let _=f.call,p={clientInterceptors:this[Vr],clientInterceptorProviders:this[Yr],callInterceptors:(l=f.callOptions.interceptors)!==null&&l!==void 0?l:[],callInterceptorProviders:(c=f.callOptions.interceptor_providers)!==null&&c!==void 0?c:[]},v=(0,rs.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(Xt.Status.UNIMPLEMENTED,"Too many responses received"),R=D},onReceiveStatus(D){if(!O){if(O=!0,D.code===Xt.Status.OK)if(R===null){let E=Kr(P);f.callback((0,mt.callErrorFromStatus)({code:Xt.Status.UNIMPLEMENTED,details:"No message received",metadata:D.metadata},E))}else f.callback(null,R);else{let E=Kr(P);f.callback((0,mt.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 mt.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[Vr],clientInterceptorProviders:this[Yr],callInterceptors:(o=h.callOptions.interceptors)!==null&&o!==void 0?o:[],callInterceptorProviders:(l=h.callOptions.interceptor_providers)!==null&&l!==void 0?l:[]},p=(0,rs.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(Xt.Status.UNIMPLEMENTED,"Too many responses received"),v=P,p.startRead()},onReceiveStatus(P){if(!R){if(R=!0,P.code===Xt.Status.OK)if(v===null){let D=Kr(O);h.callback((0,mt.callErrorFromStatus)({code:Xt.Status.UNIMPLEMENTED,details:"No message received",metadata:P.metadata},D))}else h.callback(null,v);else{let D=Kr(O);h.callback((0,mt.callErrorFromStatus)(P,D))}O=null,f.emit("status",P)}}}),f}checkMetadataAndOptions(e,t){let r,n;return e instanceof $r.Metadata?(r=e,t?n=t:n={}):(e?n=e:n={},r=new $r.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 mt.ClientReadableStreamImpl(r),channel:this[nt],methodDefinition:u,callOptions:c.options};this[Dt]&&(h=this[Dt](h));let f=h.call,_={clientInterceptors:this[Vr],clientInterceptorProviders:this[Yr],callInterceptors:(o=h.callOptions.interceptors)!==null&&o!==void 0?o:[],callInterceptorProviders:(l=h.callOptions.interceptor_providers)!==null&&l!==void 0?l:[]},p=(0,rs.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!==Xt.Status.OK){let P=Kr(R);f.emit("error",(0,mt.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 mt.ClientDuplexStreamImpl(t,r),channel:this[nt],methodDefinition:c,callOptions:l.options};this[Dt]&&(u=this[Dt](u));let h=u.call,f={clientInterceptors:this[Vr],clientInterceptorProviders:this[Yr],callInterceptors:(a=u.callOptions.interceptors)!==null&&a!==void 0?a:[],callInterceptorProviders:(o=u.callOptions.interceptor_providers)!==null&&o!==void 0?o:[]},_=(0,rs.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!==Xt.Status.OK){let O=Kr(v);h.emit("error",(0,mt.callErrorFromStatus)(R,O))}v=null,h.emit("status",R)}}}),h}};is.Client=Mo});var ss=g(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.makeClientConstructor=Fd;ns.loadPackageDefinition=i_;var Ui=ko(),e_={unary:Ui.Client.prototype.makeUnaryRequest,server_stream:Ui.Client.prototype.makeServerStreamRequest,client_stream:Ui.Client.prototype.makeClientStreamRequest,bidi:Ui.Client.prototype.makeBidiStreamRequest};function Do(i){return["__proto__","prototype","constructor"].includes(i)}function Fd(i,e,t){t||(t={});class r extends Ui.Client{}return Object.keys(i).forEach(n=>{if(Do(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=t_(e_[a],s.path,o,l);r.prototype[n]=c,Object.assign(r.prototype[n],s),s.originalName&&!Do(s.originalName)&&(r.prototype[s.originalName]=r.prototype[n])}),r.service=i,r.serviceName=e,r}function t_(i,e,t,r){return function(...n){return i.call(this,e,t,r,...n)}}function r_(i){return"format"in i}function i_(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=>Do(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];r_(r)?a[s]=r:a[s]=Fd(r,s,{})}return e}});var lh=g((Ow,oh)=>{"use strict";var n_=1/0,s_="[object Symbol]",a_=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,o_=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,os="\\ud800-\\udfff",Gd="\\u0300-\\u036f\\ufe20-\\ufe23",$d="\\u20d0-\\u20f0",Vd="\\u2700-\\u27bf",Yd="a-z\\xdf-\\xf6\\xf8-\\xff",l_="\\xac\\xb1\\xd7\\xf7",c_="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",u_="\\u2000-\\u206f",d_=" \\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",Kd="A-Z\\xc0-\\xd6\\xd8-\\xde",Xd="\\ufe0e\\ufe0f",Jd=l_+c_+u_+d_,Fo="['\u2019]",h_="["+os+"]",qd="["+Jd+"]",as="["+Gd+$d+"]",Qd="\\d+",f_="["+Vd+"]",Zd="["+Yd+"]",eh="[^"+os+Jd+Qd+Vd+Yd+Kd+"]",Lo="\\ud83c[\\udffb-\\udfff]",p_="(?:"+as+"|"+Lo+")",th="[^"+os+"]",qo="(?:\\ud83c[\\udde6-\\uddff]){2}",Uo="[\\ud800-\\udbff][\\udc00-\\udfff]",Xr="["+Kd+"]",rh="\\u200d",Ud="(?:"+Zd+"|"+eh+")",g_="(?:"+Xr+"|"+eh+")",Bd="(?:"+Fo+"(?:d|ll|m|re|s|t|ve))?",zd="(?:"+Fo+"(?:D|LL|M|RE|S|T|VE))?",ih=p_+"?",nh="["+Xd+"]?",m_="(?:"+rh+"(?:"+[th,qo,Uo].join("|")+")"+nh+ih+")*",sh=nh+ih+m_,v_="(?:"+[f_,qo,Uo].join("|")+")"+sh,y_="(?:"+[th+as+"?",as,qo,Uo,h_].join("|")+")",__=RegExp(Fo,"g"),E_=RegExp(as,"g"),S_=RegExp(Lo+"(?="+Lo+")|"+y_+sh,"g"),C_=RegExp([Xr+"?"+Zd+"+"+Bd+"(?="+[qd,Xr,"$"].join("|")+")",g_+"+"+zd+"(?="+[qd,Xr+Ud,"$"].join("|")+")",Xr+"?"+Ud+"+"+Bd,Xr+"+"+zd,Qd,v_].join("|"),"g"),T_=RegExp("["+rh+os+Gd+$d+Xd+"]"),b_=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,R_={\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"},w_=typeof global=="object"&&global&&global.Object===Object&&global,O_=typeof self=="object"&&self&&self.Object===Object&&self,A_=w_||O_||Function("return this")();function N_(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 P_(i){return i.split("")}function I_(i){return i.match(a_)||[]}function M_(i){return function(e){return i?.[e]}}var k_=M_(R_);function ah(i){return T_.test(i)}function x_(i){return b_.test(i)}function D_(i){return ah(i)?L_(i):P_(i)}function L_(i){return i.match(S_)||[]}function F_(i){return i.match(C_)||[]}var q_=Object.prototype,U_=q_.toString,Hd=A_.Symbol,jd=Hd?Hd.prototype:void 0,Wd=jd?jd.toString:void 0;function B_(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 z_(i){if(typeof i=="string")return i;if($_(i))return Wd?Wd.call(i):"";var e=i+"";return e=="0"&&1/i==-n_?"-0":e}function H_(i,e,t){var r=i.length;return t=t===void 0?r:t,!e&&t>=r?i:B_(i,e,t)}function j_(i){return function(e){e=ls(e);var t=ah(e)?D_(e):void 0,r=t?t[0]:e.charAt(0),n=t?H_(t,1).join(""):e.slice(1);return r[i]()+n}}function W_(i){return function(e){return N_(J_(K_(e).replace(__,"")),i,"")}}function G_(i){return!!i&&typeof i=="object"}function $_(i){return typeof i=="symbol"||G_(i)&&U_.call(i)==s_}function ls(i){return i==null?"":z_(i)}var V_=W_(function(i,e,t){return e=e.toLowerCase(),i+(t?Y_(e):e)});function Y_(i){return X_(ls(i).toLowerCase())}function K_(i){return i=ls(i),i&&i.replace(o_,k_).replace(E_,"")}var X_=j_("toUpperCase");function J_(i,e,t){return i=ls(i),e=t?void 0:e,e===void 0?x_(i)?F_(i):I_(i):i.match(e)||[]}oh.exports=V_});var Bo=g((Aw,ch)=>{"use strict";ch.exports=Q_;function Q_(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 fh=g(hh=>{"use strict";var cs=hh;cs.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 Jr=new Array(64),dh=new Array(123);for(st=0;st<64;)dh[Jr[st]=st<26?st+65:st<52?st+71:st<62?st-4:st-59|43]=st++;var st;cs.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++]=Jr[c>>2],l=(c&3)<<4,o=1;break;case 1:s[a++]=Jr[l|c>>4],l=(c&15)<<2,o=2;break;case 2:s[a++]=Jr[l|c>>6],s[a++]=Jr[c&63],o=0;break}a>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,s)),a=0)}return o&&(s[a++]=Jr[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 uh="invalid encoding";cs.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=dh[l])===void 0)throw Error(uh);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(uh);return r-n};cs.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var gh=g((Pw,ph)=>{"use strict";ph.exports=us;function us(){this._listeners=Object.create(null)}us.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this};us.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};us.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 Ch=g((Iw,Sh)=>{"use strict";Sh.exports=mh(mh);function mh(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,vh),i.writeFloatBE=e.bind(null,yh);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,_h),i.readFloatBE=t.bind(null,Eh)})(),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,vh,0,4),i.writeDoubleBE=e.bind(null,yh,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,_h,0,4),i.readDoubleBE=t.bind(null,Eh,4,0)})(),i}function vh(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 yh(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 _h(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16|i[e+3]<<24)>>>0}function Eh(i,e){return(i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3])>>>0}});var bh=g(Th=>{"use strict";var Ho=Th,zo=65533;Ho.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};Ho.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:zo):o>=224&&o<240?(u=(o&15)<<12|(e[t++]&63)<<6|e[t++]&63,s[a++]=u>=2048?u:zo):o>=240&&(l=(o&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63,l<65536||l>1114111?s[a++]=zo:(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))};Ho.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 wh=g((kw,Rh)=>{"use strict";Rh.exports=Z_;function Z_(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 Ah=g((xw,Oh)=>{"use strict";Oh.exports=ge;var Bi=at();function ge(i,e){this.lo=i>>>0,this.hi=e>>>0}var Er=ge.zero=new ge(0,0);Er.toNumber=function(){return 0};Er.zzEncode=Er.zzDecode=function(){return this};Er.length=function(){return 1};var e0=ge.zeroHash="\0\0\0\0\0\0\0\0";ge.fromNumber=function(e){if(e===0)return Er;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(Bi.isString(e))if(Bi.Long)e=Bi.Long.fromString(e);else return ge.fromNumber(parseInt(e,10));return e.low||e.high?new ge(e.low>>>0,e.high>>>0):Er};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 Bi.Long?new Bi.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Jt=String.prototype.charCodeAt;ge.fromHash=function(e){return e===e0?Er:new ge((Jt.call(e,0)|Jt.call(e,1)<<8|Jt.call(e,2)<<16|Jt.call(e,3)<<24)>>>0,(Jt.call(e,4)|Jt.call(e,5)<<8|Jt.call(e,6)<<16|Jt.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 Wo=g((zi,jo)=>{"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 zi=="object"?(e(zi),typeof jo=="object"&&(jo.exports=t(zi))):(function(){var r={};e(r),i.Long=t(r)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:zi,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(Go=>{"use strict";var I=Go;I.asPromise=Bo();I.base64=fh();I.EventEmitter=gh();I.float=Ch();I.utf8=bh();I.pool=wh();I.LongBits=Ah();function Nh(i){return i==="__proto__"||i==="prototype"||i==="constructor"}I.isUnsafeProperty=Nh;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||Go;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=Wo();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 Ph(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)!Nh(s[a])&&(i[s[a]]===void 0||!e)&&(i[s[a]]=n[s[a]])}return i}I.merge=Ph;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 Ih(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&&Ph(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=Ih;I.ProtocolError=Ih("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 hs=g((Lw,Dh)=>{"use strict";Dh.exports=V;var Ve=at(),$o,ds=Ve.LongBits,Mh=Ve.base64,kh=Ve.utf8;function Hi(i,e,t){this.fn=i,this.len=e,this.next=void 0,this.val=t}function Yo(){}function t0(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 Hi(Yo,0,0),this.tail=this.head,this.states=null}var xh=function(){return Ve.Buffer?function(){return(V.create=function(){return new $o})()}:function(){return new V}};V.create=xh();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 Hi(e,t,r),this.len+=t,this};function Ko(i,e,t){e[t]=i&255}function r0(i,e,t){for(;i>127;)e[t++]=i&127|128,i>>>=7;e[t]=i}function Xo(i,e){this.len=i,this.next=void 0,this.val=e}Xo.prototype=Object.create(Hi.prototype);Xo.prototype.fn=r0;V.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Xo((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(Jo,10,ds.fromNumber(e)):this.uint32(e)};V.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Jo(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=ds.from(e);return this._push(Jo,t.length(),t)};V.prototype.int64=V.prototype.uint64;V.prototype.sint64=function(e){var t=ds.from(e).zzEncode();return this._push(Jo,t.length(),t)};V.prototype.bool=function(e){return this._push(Ko,1,e?1:0)};function Vo(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(Vo,4,e>>>0)};V.prototype.sfixed32=V.prototype.fixed32;V.prototype.fixed64=function(e){var t=ds.from(e);return this._push(Vo,4,t.lo)._push(Vo,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 i0=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(Ko,1,0);if(Ve.isString(e)){var r=V.alloc(t=Mh.length(e));Mh.decode(e,r,0),e=r}return this.uint32(t)._push(i0,t,e)};V.prototype.string=function(e){var t=kh.length(e);return t?this.uint32(t)._push(kh.write,t,e):this._push(Ko,1,0)};V.prototype.fork=function(){return this.states=new t0(this),this.head=this.tail=new Hi(Yo,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 Hi(Yo,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){$o=i,V.create=xh(),$o._configure()}});var qh=g((Fw,Fh)=>{"use strict";Fh.exports=vt;var Lh=hs();(vt.prototype=Object.create(Lh.prototype)).constructor=vt;var Qt=at();function vt(){Lh.call(this)}vt._configure=function(){vt.alloc=Qt._Buffer_allocUnsafe,vt.writeBytesBuffer=Qt.Buffer&&Qt.Buffer.prototype instanceof Uint8Array&&Qt.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++]}};vt.prototype.bytes=function(e){Qt.isString(e)&&(e=Qt._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(vt.writeBytesBuffer,t,e),this};function n0(i,e,t){i.length<40?Qt.utf8.write(i,e,t):e.utf8Write?e.utf8Write(i,t):e.write(i,t)}vt.prototype.string=function(e){var t=Qt.Buffer.byteLength(e);return this.uint32(t),t&&this._push(n0,t,e),this};vt._configure()});var ps=g((qw,jh)=>{"use strict";jh.exports=ne;var Ye=at(),Zo,zh=Ye.LongBits,s0=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 Uh=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")},Hh=function(){return Ye.Buffer?function(t){return(ne.create=function(n){return Ye.Buffer.isBuffer(n)?new Zo(n):Uh(n)})(t)}:Uh};ne.create=Hh();ne.prototype._slice=Ye.Array.prototype.subarray||Ye.Array.prototype.slice;function a0(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 a0(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 Qo(){var i=new zh(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 fs(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 fs(this.buf,this.pos+=4)};ne.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Le(this,4);return fs(this.buf,this.pos+=4)|0};function Bh(){if(this.pos+8>this.len)throw Le(this,8);return new zh(fs(this.buf,this.pos+=4),fs(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 s0.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){Zo=i,ne.create=Hh(),Zo._configure();var e=Ye.Long?"toLong":"toNumber";Ye.merge(ne.prototype,{int64:function(){return Qo.call(this)[e](!1)},uint64:function(){return Qo.call(this)[e](!0)},sint64:function(){return Qo.call(this).zzDecode()[e](!1)},fixed64:function(){return Bh.call(this)[e](!0)},sfixed64:function(){return Bh.call(this)[e](!1)}})}});var Vh=g((Uw,$h)=>{"use strict";$h.exports=Sr;var Gh=ps();(Sr.prototype=Object.create(Gh.prototype)).constructor=Sr;var Wh=at();function Sr(i){Gh.call(this,i)}Sr._configure=function(){Wh.Buffer&&(Sr.prototype._slice=Wh.Buffer.prototype.slice)};Sr.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))};Sr._configure()});var Kh=g((Bw,Yh)=>{"use strict";Yh.exports=ji;var el=at();(ji.prototype=Object.create(el.EventEmitter.prototype)).constructor=ji;function ji(i,e,t){if(typeof i!="function")throw TypeError("rpcImpl must be a function");el.EventEmitter.call(this),this.rpcImpl=i,this.requestDelimited=!!e,this.responseDelimited=!!t}ji.prototype.rpcCall=function i(e,t,r,n,s){if(!n)throw TypeError("request must be specified");var a=this;if(!s)return el.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}};ji.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var tl=g(Xh=>{"use strict";var o0=Xh;o0.Service=Kh()});var rl=g((Hw,Jh)=>{"use strict";Jh.exports=Object.create(null)});var ef=g(Zh=>{"use strict";var Fe=Zh;Fe.build="minimal";Fe.Writer=hs();Fe.BufferWriter=qh();Fe.Reader=ps();Fe.BufferReader=Vh();Fe.util=at();Fe.rpc=tl();Fe.roots=rl();Fe.configure=Qh;function Qh(){Fe.util._configure(),Fe.Writer._configure(Fe.BufferWriter),Fe.Reader._configure(Fe.BufferReader)}Qh()});var rf=g((Ww,tf)=>{"use strict";tf.exports=il;var l0=/^(?: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 il(i,e){typeof i=="string"&&(e=i,i=void 0);var t=[];function r(s){if(typeof s!="string"){var a=n();if(il.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 "+c0(s||e)+"("+(i&&i.join(",")||"")+`){
9
+ `+t.join(`
10
+ `)+`
11
+ }`}return r.toString=n,r}il.verbose=!1;function c0(i){return!i||(i=String(i).replace(/[^\w$]/g,""),!i)?"":(/^\d/.test(i)&&(i="_"+i),l0.test(i)?i+"_":i)}});var sf=g((Gw,nf)=>{"use strict";var Qr=null;try{Qr=z("fs"),(!Qr||!Qr.readFile||!Qr.readFileSync)&&(Qr=null)}catch{}nf.exports=Qr});var of=g(($w,af)=>{"use strict";af.exports=Wi;var u0=Bo(),nl=sf();function Wi(i,e,t){return typeof e=="function"?(t=e,e={}):e||(e={}),t?!e.xhr&&nl&&nl.readFile?nl.readFile(i,function(n,s){return n&&typeof XMLHttpRequest<"u"?Wi.xhr(i,e,t):n?t(n):t(null,e.binary?s:s.toString("utf8"))}):Wi.xhr(i,e,t):u0(Wi,this,i,e)}Wi.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 uf=g(cf=>{"use strict";var al=cf,lf=al.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},sl=al.normalize=function(e){e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var t=e.split("/"),r=lf(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("/")};al.resolve=function(e,t,r){return r||(t=sl(t)),lf(t)?t:(r||(e=sl(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?sl(e+"/"+t):t)}});var hf=g(df=>{"use strict";var ol=df;ol.numberRe=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;ol.typeRefRe=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;ol.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 pf=g((Kw,ff)=>{"use strict";var Zr=null;try{Zr=z("fs"),(!Zr||!Zr.readFile||!Zr.readFileSync)&&(Zr=null)}catch{}ff.exports=Zr});var ti=g((Xw,vf)=>{"use strict";vf.exports=G;var gs=er();((G.prototype=Object.create(gs.prototype)).constructor=G).className="Namespace";var ll=Zt(),Tr=me(),d0=Rr(),Cr,ei,br;G.fromJSON=function(e,t,r){return r=Tr.checkDepth(r),new G(e,t.options).addJSON(t.nested,r)};function gf(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=gf;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){gs.call(this,i,e),this.nested=void 0,this._nestedArray=null,this._lookupCache=Object.create(null),this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0}function mf(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=Tr.toArray(this.nested))}});G.prototype.toJSON=function(e){return Tr.toObject(["options",this.options,"nested",gf(this.nestedArray,e)])};G.prototype.addJSON=function(e,t){t=Tr.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?Cr.fromJSON:a.values!==void 0?br.fromJSON:a.methods!==void 0?ei.fromJSON:a.id!==void 0?ll.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 br)return this.nested[e].values;throw Error("no such enum: "+e)};G.prototype.add=function(e){if(!(e instanceof ll&&e.extend!==void 0||e instanceof Cr||e instanceof d0||e instanceof br||e instanceof ei||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 Cr||t instanceof ei)){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 Cr||this instanceof ei||this instanceof br||this instanceof ll||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),mf(this)};G.prototype.remove=function(e){if(!(e instanceof gs))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),mf(this)};G.prototype.define=function(e,t){if(Tr.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>Tr.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,gs.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]),Tr.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,[Cr]);if(!t)throw Error("no such type: "+e);return t};G.prototype.lookupEnum=function(e){var t=this.lookup(e,[br]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t};G.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[Cr,br]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t};G.prototype.lookupService=function(e){var t=this.lookup(e,[ei]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t};G._configure=function(i,e,t){Cr=i,ei=e,br=t}});var ms=g((Jw,yf)=>{"use strict";yf.exports=Lt;var cl=Zt();((Lt.prototype=Object.create(cl.prototype)).constructor=Lt).className="MapField";var h0=wr(),Gi=me();function Lt(i,e,t,r,n,s){if(cl.call(this,i,e,r,void 0,void 0,n,s),!Gi.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 Gi.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(h0.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return cl.prototype.resolve.call(this)};Lt.d=function(e,t,r){return typeof r=="function"?r=Gi.decorateType(r).name:r&&typeof r=="object"&&(r=Gi.decorateEnum(r).name),function(s,a){Gi.decorateType(s.constructor).add(new Lt(a,e,t,r))}}});var vs=g((Qw,_f)=>{"use strict";_f.exports=Or;var ul=er();((Or.prototype=Object.create(ul.prototype)).constructor=Or).className="Method";var ri=me();function Or(i,e,t,r,n,s,a,o,l){if(ri.isObject(n)?(a=n,n=s=void 0):ri.isObject(s)&&(a=s,s=void 0),!(e===void 0||ri.isString(e)))throw TypeError("type must be a string");if(!ri.isString(t))throw TypeError("requestType must be a string");if(!ri.isString(r))throw TypeError("responseType must be a string");ul.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}Or.fromJSON=function(e,t){return new Or(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)};Or.prototype.toJSON=function(e){var t=e?!!e.keepComments:!1;return ri.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])};Or.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),ul.prototype.resolve.call(this))}});var _s=g((Zw,Cf)=>{"use strict";Cf.exports=ze;var Ft=ti();((ze.prototype=Object.create(Ft.prototype)).constructor=ze).className="Service";var dl=vs(),ys=me(),Ef=tl();function ze(i,e){Ft.call(this,i,e),this.methods={},this._methodsArray=null}ze.fromJSON=function(e,t,r){r=ys.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(dl.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 ys.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=ys.toArray(this.methods))}});function Sf(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 dl?e.name==="__proto__"?this:(this.methods[e.name]=e,e.parent=this,Sf(this)):Ft.prototype.add.call(this,e)};ze.prototype.remove=function(e){if(e instanceof dl){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,Sf(this)}return Ft.prototype.remove.call(this,e)};ze.prototype.create=function(e,t,r){for(var n=new Ef.Service(e,t,r),s=0,a;s<this.methodsArray.length;++s){var o=ys.lcFirst((a=this._methodsArray[s]).resolve().name).replace(/[^$\w_]/g,"");n[o]=(function(l,c,u){return function(f,_){return Ef.Service.prototype.rpcCall.call(this,l,c,u,f,_)}})(a,a.resolvedRequestType.ctor,a.resolvedResponseType.ctor)}return n}});var Es=g((eO,Tf)=>{"use strict";Tf.exports=yt;var f0=at();function yt(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])}}yt.create=function(e){return this.$type.create(e)};yt.encode=function(e,t){return this.$type.encode(e,t)};yt.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)};yt.decode=function(e){return this.$type.decode(e)};yt.decodeDelimited=function(e){return this.$type.decodeDelimited(e)};yt.verify=function(e){return this.$type.verify(e)};yt.fromObject=function(e){return this.$type.fromObject(e)};yt.toObject=function(e,t){return this.$type.toObject(e,t)};yt.prototype.toJSON=function(){return this.$type.toObject(this,f0.toJSONOptions)}});var hl=g((tO,Rf)=>{"use strict";Rf.exports=m0;var p0=ot(),qt=wr(),bf=me();function g0(i){return"missing required '"+i.name+"'"}function m0(i){for(var e=bf.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 p0?"int32":r.type,s="m"+bf.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})",g0(a))}return e("return m")}});var gl=g((rO,wf)=>{"use strict";wf.exports=_0;var v0=ot(),fl=me();function Ke(i,e){return i.name+": "+e+(i.repeated&&e!=="array"?"[]":i.map&&e!=="object"?"{k:"+i.keyType+"}":"")+" expected"}function pl(i,e,t,r){if(e.resolvedType)if(e.resolvedType instanceof v0){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 y0(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 _0(i){var e=fl.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"+fl.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){"),y0(e,s,"k[i]"),pl(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),pl(e,s,n,a+"[i]")("}");else{if(s.partOf){var o=fl.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)}pl(e,s,n,a)}s.optional&&e("}")}return e("return null")}});var yl=g(Af=>{"use strict";var Of=Af,$i=ot(),_t=me();function ml(i,e,t,r){var n=!1;if(e.resolvedType)if(e.resolvedType instanceof $i){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}Of.fromObject=function(e){var t=e.fieldsArray,r=_t.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=_t.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),ml(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),ml(r,s,n,a+"[i]")("}")("}")):(s.resolvedType instanceof $i||r("if(d%s!=null){",a),ml(r,s,n,a),s.resolvedType instanceof $i||r("}"))}return r("return m")};function vl(i,e,t,r){if(e.resolvedType)e.resolvedType instanceof $i?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}Of.toObject=function(e){var t=e.fieldsArray.slice().sort(_t.compareFieldsById);if(!t.length)return _t.codegen()("return {}");for(var r=_t.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=[]",_t.safeProp(n[o].name));r("}")}if(s.length){for(r("if(o.objects||o.defaults){"),o=0;o<s.length;++o)r("d%s={}",_t.safeProp(s[o].name));r("}")}if(a.length){for(r("if(o.defaults){"),o=0;o<a.length;++o){var l=a[o],c=_t.safeProp(l.name);if(l.resolvedType instanceof $i)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=_t.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),vl(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),vl(r,l,f,c+"[j]")("}")):(r("if(m%s!=null&&Object.hasOwnProperty.call(m,%j)){",c,l.name),vl(r,l,f,c),l.partOf&&r("if(o.oneofs)")("d%s=%j",_t.safeProp(l.partOf.name),l.name)),r("}")}return r("return d")}});var _l=g(Pf=>{"use strict";var E0=Pf,S0=Es(),Nf=at();E0[".google.protobuf.Any"]={fromObject:function(i,e){if(e===void 0&&(e=0),e>Nf.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>Nf.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 S0){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 Ts=g((sO,Mf)=>{"use strict";Mf.exports=te;var Xe=ti();((te.prototype=Object.create(Xe.prototype)).constructor=te).className="Type";var C0=ot(),Cl=Rr(),Ss=Zt(),T0=ms(),b0=_s(),El=Es(),Sl=ps(),R0=hs(),Se=me(),w0=Tl(),O0=hl(),A0=gl(),If=yl(),N0=_l();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 El||((i.prototype=new El).constructor=i,Se.merge(i.prototype,e)),i.$type=i.prototype.$type=this,Se.merge(i,El,!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 Cs(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"?T0.fromJSON:Ss.fromJSON)(s[a],t.fields[s[a]]));if(t.oneofs)for(s=Object.keys(t.oneofs),a=0;a<s.length;++a)n.add(Cl.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?Ss.fromJSON:o.fields!==void 0?te.fromJSON:o.values!==void 0?C0.fromJSON:o.methods!==void 0?b0.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 Ss&&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),Cs(this))}if(e instanceof Cl){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),Cs(this))}return Xe.prototype.add.call(this,e)};te.prototype.remove=function(e){if(e instanceof Ss&&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),Cs(this)}if(e instanceof Cl){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),Cs(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=w0(this)({Writer:R0,types:t,util:Se}),this.decode=O0(this)({Reader:Sl,types:t,util:Se}),this.verify=A0(this)({types:t,util:Se}),this.fromObject=If.fromObject(this)({types:t,util:Se}),this.toObject=If.toObject(this)({types:t,util:Se});var n=N0[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 Sl||(e=Sl.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 Os=g((aO,Df)=>{"use strict";Df.exports=He;var ws=ti();((He.prototype=Object.create(ws.prototype)).constructor=He).className="Root";var bs=Zt(),bl=ot(),P0=Rr(),Et=me(),Rl,wl,Vi;function He(i){ws.call(this,"",i),this.deferred=[],this.files=[],this._edition="proto2",this._fullyQualifiedObjects={}}He.fromJSON=function(e,t,r){return r=Et.checkDepth(r),t||(t=new He),e.options&&t.setOptions(e.options),t.addJSON(e.nested,r).resolveAll()};He.prototype.resolvePath=Et.path.resolve;He.prototype.fetch=Et.fetch;function xf(){}He.prototype.load=function i(e,t,r){typeof t=="function"&&(r=t,t=void 0);var n=this;if(!r)return Et.asPromise(i,n,e,t);var s=r===xf;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 Vi)return v}return null}function l(_,p,v){v===void 0&&(v=0);try{if(v>Et.recursionLimit)throw Error("max depth exceeded");if(Et.isString(p)&&p.charAt(0)==="{"&&(p=JSON.parse(p)),!Et.isString(p))n.setOptions(p.options).addJSON(p.nested);else{wl.filename=_;var R=wl(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 Vi){s?l(_,Vi[_],v):(++u,setTimeout(function(){--u,l(_,Vi[_],v)}));return}if(s){var R;try{R=Et.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;Et.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(!Et.isNode)throw Error("not supported");return this.load(e,t,xf)};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 ws.prototype.resolveAll.call(this)};var Rs=/^[A-Z]/;function kf(i,e){var t=e.parent.lookup(e.extend);if(t){var r=new bs(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 bs)e.extend!==void 0&&!e.extensionField&&(kf(this,e)||this.deferred.push(e));else if(e instanceof bl)Rs.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof P0)){if(e instanceof Rl)for(var t=0;t<this.deferred.length;)kf(this,this.deferred[t])?this.deferred.splice(t,1):++t;for(var r=0;r<e.nestedArray.length;++r)this._handleAdd(e._nestedArray[r]);Rs.test(e.name)&&(e.parent[e.name]=e)}(e instanceof Rl||e instanceof bl||e instanceof bs)&&(this._fullyQualifiedObjects[e.fullName]=e)};He.prototype._handleRemove=function(e){if(e instanceof bs){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 bl)Rs.test(e.name)&&delete e.parent[e.name];else if(e instanceof ws){for(var r=0;r<e.nestedArray.length;++r)this._handleRemove(e._nestedArray[r]);Rs.test(e.name)&&delete e.parent[e.name]}delete this._fullyQualifiedObjects[e.fullName]};He._configure=function(i,e,t){Rl=i,wl=e,Vi=t}});var me=g((oO,qf)=>{"use strict";var ie=qf.exports=at(),Lf=rl(),Ol,Al;ie.codegen=rf();ie.fetch=of();ie.path=uf();ie.patterns=hf();var Ff=ie.patterns.reservedRe;ie.fs=pf();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 Ff.test(e)};ie.safeProp=function(e){return!/^[$\w_]+$/.test(e)||Ff.test(e)?"["+JSON.stringify(e)+"]":"."+e};ie.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var I0=/_([a-z])/g;ie.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(I0,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;Ol||(Ol=Ts());var r=new Ol(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 M0=0;ie.decorateEnum=function(e){if(e.$type)return e.$type;Al||(Al=ot());var t=new Al("Enum"+M0++,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 Lf.decorated||(Lf.decorated=new(Os()))}})});var wr=g(Uf=>{"use strict";var Yi=Uf,k0=me(),x0=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function Ki(i,e){var t=0,r=Object.create(null);for(e|=0;t<i.length;)r[x0[t+e]]=i[t++];return r}Yi.basic=Ki([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]);Yi.defaults=Ki([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",k0.emptyArray,null]);Yi.long=Ki([0,0,0,1,1],7);Yi.mapKey=Ki([0,0,0,5,5,0,0,0,1,1,0,2],2);Yi.packed=Ki([1,5,0,0,0,5,5,0,0,0,1,1,0])});var Zt=g((cO,zf)=>{"use strict";zf.exports=ve;var Ji=er();((ve.prototype=Object.create(Ji.prototype)).constructor=ve).className="Field";var Bf=ot(),Nl=wr(),ce=me(),Xi,D0=/^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),Ji.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&&!D0.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?Nl.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 Xi&&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 Ji.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=Nl.defaults[this.type])===void 0?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof Xi?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 Bf&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(this.options.packed!==void 0&&this.resolvedType&&!(this.resolvedType instanceof Bf)&&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 Xi&&(this.parent.ctor.prototype[this.name]=this.defaultValue),Ji.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&&Nl.defaults[this.type]===void 0){var r=this.parent.get(this.type.split(".").pop());r&&r instanceof Xi&&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 Ji.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){Xi=e}});var Rr=g((uO,Wf)=>{"use strict";Wf.exports=je;var Ns=er();((je.prototype=Object.create(Ns.prototype)).constructor=je).className="OneOf";var Hf=Zt(),As=me();function je(i,e,t,r){if(Array.isArray(e)||(t=e,e=void 0),Ns.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 As.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])};function jf(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 Hf))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,jf(this),this};je.prototype.remove=function(e){if(!(e instanceof Hf))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){Ns.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))}jf(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);Ns.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){As.decorateType(n.constructor).add(new je(s,e)),Object.defineProperty(n,s,{get:As.oneOfGetter(e),set:As.oneOfSetter(e)})}}});var er=g((dO,Gf)=>{"use strict";Gf.exports=Ce;Ce.className="ReflectionObject";var L0=Rr(),lt=me(),Ps,F0={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"},q0={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE"},U0={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 Ps&&t._handleAdd(this)};Ce.prototype.onRemove=function(e){var t=e.root;t instanceof Ps&&t._handleRemove(this),this.parent=null,this.resolved=!1};Ce.prototype.resolve=function(){return this.resolved?this:(this.root instanceof Ps&&(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({},q0);else if(e==="proto3")t=Object.assign({},U0);else if(e==="2023")t=Object.assign({},F0);else throw new Error("Unknown edition: "+e);this._features=lt.merge(t,r),this._featuresResolved=!0;return}if(this.partOf instanceof L0){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){Ps=i}});var ot=g((hO,Vf)=>{"use strict";Vf.exports=ct;var Pl=er();((ct.prototype=Object.create(Pl.prototype)).constructor=ct).className="Enum";var $f=ti(),ii=me();function ct(i,e,t,r,n,s){if(Pl.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,Pl.prototype._resolveFeatures.call(this,e),Object.keys(this.values).forEach(t=>{var r=ii.merge({},this._features);this._valuesFeatures[t]=ii.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 ii.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(!ii.isString(e))throw TypeError("name must be a string");if(!ii.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(!ii.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 $f.isReservedId(this.reserved,e)};ct.prototype.isReservedName=function(e){return $f.isReservedName(this.reserved,e)}});var Tl=g((fO,Kf)=>{"use strict";Kf.exports=z0;var B0=ot(),Il=wr(),Ml=me();function Yf(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 z0(i){for(var e=Ml.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(Ml.compareFieldsById),t=0;t<n.length;++t){var s=n[t].resolve(),a=i._fieldsArray.indexOf(s),o=s.resolvedType instanceof B0?"int32":s.type,l=Il.basic[o];r="m"+Ml.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|Il.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&&Il.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?Yf(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?Yf(e,s,a,r):e("w.uint32(%i).%s(%s)",(s.id<<3|l)>>>0,o,r))}return e("return w")}});var Jf=g((pO,Xf)=>{"use strict";var $=Xf.exports=ef();$.build="light";function H0(i,e,t){return typeof e=="function"?(t=e,e=new $.Root):e||(e=new $.Root),e.load(i,t)}$.load=H0;function j0(i,e){return e||(e=new $.Root),e.loadSync(i)}$.loadSync=j0;$.encoder=Tl();$.decoder=hl();$.verifier=gl();$.converter=yl();$.ReflectionObject=er();$.Namespace=ti();$.Root=Os();$.Enum=ot();$.Type=Ts();$.Field=Zt();$.OneOf=Rr();$.MapField=ms();$.Service=_s();$.Method=vs();$.Message=Es();$.wrappers=_l();$.types=wr();$.util=me();$.ReflectionObject._configure($.Root);$.Namespace._configure($.Type,$.Service,$.Enum);$.Root._configure($.Type);$.Field._configure($.Type)});var xl=g((gO,ep)=>{"use strict";ep.exports=Zf;var kl=/[\s{}=;:[\],'"()<>]/g,W0=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,G0=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,$0=/^ *[*/]+ */,V0=/^\s*\*?\/*/,Y0=/\n/g,K0=/\s/,X0=/\\(.?)/g,J0={0:"\0",r:"\r",n:`
12
+ `,t:" "};function Qf(i){return i.replace(X0,function(e,t){switch(t){case"\\":case"":return t;default:return J0[t]||""}})}Zf.unescape=Qf;function Zf(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==="'"?G0:W0;E.lastIndex=t-1;var x=E.exec(i);if(!x)throw c("string");return t=E.lastIndex,R(l),l=null,Qf(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(Y0),Re=0;Re<y.length;++Re)y[Re]=y[Re].replace(e?V0:$0,"").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;K0.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;kl.lastIndex=0;var y=kl.test(h(F++));if(!y)for(;F<r&&!kl.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 ap=g((mO,sp)=>{"use strict";sp.exports=Bt;Bt.filename=null;Bt.defaults={keepCase:!1};var Q0=xl(),tp=Os(),rp=Ts(),ip=Zt(),Z0=ms(),np=Rr(),eE=ot(),tE=_s(),rE=vs(),iE=er(),nE=wr(),Ut=me(),sE=/^[1-9][0-9]*$/,aE=/^-?[1-9][0-9]*$/,oE=/^0[x][0-9a-fA-F]+$/,lE=/^-?0[x][0-9a-fA-F]+$/,cE=/^0[0-7]+$/,uE=/^-?0[0-7]+$/,dE=Ut.patterns.numberRe,St=/^[a-zA-Z_][a-zA-Z_0-9]*$/,Ct=Ut.patterns.typeRefRe;function Bt(i,e,t){e instanceof tp||(t=e,e=new tp),t||(t=Bt.defaults);var r=t.preferTrailingComment||!1,n=Q0(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&&Ct.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&&Ct.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(sE.test(S))return T*parseInt(S,10);if(oE.test(S))return T*parseInt(S,16);if(cE.test(S))return T*parseInt(S,8);if(dE.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(aE.test(S))return parseInt(S,10);if(lE.test(S))return parseInt(S,16);if(uE.test(S))return parseInt(S,8);throw E(S,"id")}function F(){if(h!==void 0)throw E("package");if(h=s(),!Ct.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 jm(S,m,T+1),!0;case"extend":return Gm(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(!St.test(m=s()))throw E(m,"type name");var w=new rp(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"||!Ct.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(!Ct.test(L))throw E(L,"type");var M=s();if(!St.test(M))throw E(M,"name");M=P(M),l("=");var q=new ip(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 np("_"+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(!St.test(w))throw E(w,"name");var L=Ut.lcFirst(w);w===L&&(w=Ut.ucFirst(w)),l("=");var M=K(s()),q=new rp(w);q.group=!0;var ue=new ip(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(nE.mapKey[m]===void 0)throw E(m,"type");l(",");var T=s();if(!Ct.test(T))throw E(T,"type");l(">");var w=s();if(!St.test(w))throw E(w,"name");l("=");var L=new Z0(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(!St.test(m=s()))throw E(m,"name");var w=new np(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(!St.test(m=s()))throw E(m,"name");var T=new eE(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(!St.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){iE.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,pt=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,pt,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(!St.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 pt=k(!0);return se(S,m,pt),pt}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 jm(S,m,T){if(T===void 0&&(T=0),T>Ut.recursionLimit)throw Error("max depth exceeded");if(!St.test(m=s()))throw E(m,"service name");var w=new tE(m);b(w,function(M){if(!d(w,M,T))if(M==="rpc")Wm(w,M);else throw E(M)}),S.add(w),S===v&&R.push(w)}function Wm(S,m){var T=c(),w=m;if(!St.test(m=s()))throw E(m,"name");var L=m,M,q,ue,pt;if(l("("),l("stream",!0)&&(q=!0),!Ct.test(m=s())||(M=m,l(")"),l("returns"),l("("),l("stream",!0)&&(pt=!0),!Ct.test(m=s())))throw E(m);ue=m,l(")");var Ne=new rE(L,w,M,ue,q,pt);Ne.comment=T,b(Ne,function(ja){if(ja==="option")Y(Ne,ja),l(";");else throw E(ja)}),S.add(Ne)}function Gm(S,m,T){if(!Ct.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"||!Ct.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 cp=g((vO,lp)=>{"use strict";lp.exports=ut;var hE=/\/|\./;function ut(i,e){hE.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 op;ut("duration",{Duration:op={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});ut("timestamp",{Timestamp:op});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 dp=g((yO,up)=>{"use strict";var tr=up.exports=Jf();tr.build="full";tr.tokenize=xl();tr.parse=ap();tr.common=cp();tr.Root._configure(tr.Type,tr.parse,tr.common)});var Is=g((_O,hp)=>{"use strict";hp.exports=dp()});var Dl=g((EO,fE)=>{fE.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 Ep=g((U,_p)=>{"use strict";var Me=Is();_p.exports=U=Me.descriptor=Me.Root.fromJSON(Dl()).lookup(".google.protobuf");var fp=Me.Namespace,Qi=Me.Root,zt=Me.Enum,dt=Me.Type,rr=Me.Field,pE=Me.MapField,Ms=Me.OneOf,Zi=Me.Service,ks=Me.Method,pp=Me.util.patterns,gE=pp.numberRe,xs=pp.typeRefRe;Qi.fromDescriptor=function(e){typeof e.length=="number"&&(e=U.FileDescriptorSet.decode(e));var t=new Qi;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=bE(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(rr.fromDescriptor(r.extension[a],o));if(r.service)for(a=0;a<r.service.length;++a)n.add(Zi.fromDescriptor(r.service[a],o));var l=ni(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()};Qi.prototype.toDescriptor=function(e){var t=U.FileDescriptorSet.create();return gp(this,t.file,e),t};function gp(i,e,t){var r=U.FileDescriptorProto.create({name:i.filename||(i.fullName.substring(1).replace(/\./g,"_")||"root")+".proto"});RE(t,r),i instanceof Qi||(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 rr?r.extension.push(s.toDescriptor(t)):s instanceof Zi?r.service.push(s.toDescriptor()):s instanceof fp&&gp(s,e,t);r.options=si(i.options,U.FileOptions),r.messageType.length+r.enumType.length+r.extension.length+r.service.length&&e.push(r)}var mE=0;dt.fromDescriptor=function(e,t,r,n){if(n===void 0&&(n=0),n>Me.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"+mE++,ni(e.options,U.MessageOptions)),a;if(r||(s._edition=t),e.oneofDecl)for(a=0;a<e.oneofDecl.length;++a)s.add(Ms.fromDescriptor(e.oneofDecl[a]));if(e.field)for(a=0;a<e.field.length;++a){var o=rr.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(rr.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 pE){var s=Ll(this._fieldsArray[r].keyType,this._fieldsArray[r].resolvedKeyType,!1),a=Ll(this._fieldsArray[r].type,this._fieldsArray[r].resolvedType,!1),o=a===11||a===14?this._fieldsArray[r].resolvedType&&yp(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 rr?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=si(this.options,U.MessageOptions),t};rr.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"||!xs.test(n))throw Error("illegal type name: "+n);s=n}else s=SE(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"||!xs.test(o))throw Error("illegal type name: "+o)}else o=void 0;var l=new rr(e.name.length?e.name:"field"+e.number,e.number,s,a,o);if(r||(l._edition=t),l.options=ni(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=gE.exec(c);u&&(c=parseInt(c));break}l.setOption("default",c)}return CE(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};rr.prototype.toDescriptor=function(e){var t=U.FieldDescriptorProto.create({name:this.name,number:this.id});if(this.map)t.type=11,t.typeName=Me.util.ucFirst(this.name),t.label=3;else{switch(t.type=Ll(this.type,this.resolve().resolvedType,this.delimited)){case 10:case 11:case 14:t.typeName=this.resolvedType?yp(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=si(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 vE=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"+vE++,n,ni(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:si(this.options,U.EnumOptions)})};var yE=0;Ms.fromDescriptor=function(e){return typeof e.length=="number"&&(e=U.OneofDescriptorProto.decode(e)),new Ms(e.name&&e.name.length?e.name:"oneof"+yE++)};Ms.prototype.toDescriptor=function(){return U.OneofDescriptorProto.create({name:this.name})};var _E=0;Zi.fromDescriptor=function(e,t,r){typeof e.length=="number"&&(e=U.ServiceDescriptorProto.decode(e));var n=new Zi(e.name&&e.name.length?e.name:"Service"+_E++,ni(e.options,U.ServiceOptions));if(r||(n._edition=t),e.method)for(var s=0;s<e.method.length;++s)n.add(ks.fromDescriptor(e.method[s]));return n};Zi.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:si(this.options,U.ServiceOptions)})};var EE=0;ks.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"||!xs.test(t)))throw Error("illegal type name: "+t);if(r!=null&&r!==""&&(typeof r!="string"||!xs.test(r)))throw Error("illegal type name: "+r);return new ks(e.name&&e.name.length?e.name:"Method"+EE++,"rpc",t,r,!!e.clientStreaming,!!e.serverStreaming,ni(e.options,U.MethodOptions))};ks.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:si(this.options,U.MethodOptions)})};function SE(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 CE(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 Ll(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 mp(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=TE(s);n.resolvedType instanceof dt?t[a]=mp(i[s],n.resolvedType):n.resolvedType instanceof zt?t[a]=n.resolvedType.valuesById[i[s]]:t[a]=i[s]}return t}function ni(i,e){if(i)return mp(e.toObject(i),e)}function vp(i,e){for(var t={},r=Object.keys(i),n=0;n<r.length;++n){var s=r[n],a=Me.util.camelCase(s);if(Object.prototype.hasOwnProperty.call(e.fields,a)){var o=e.fields[a];o.resolvedType instanceof dt?t[a]=vp(i[s],o.resolvedType):t[a]=i[s],o.repeated&&!Array.isArray(t[a])&&(t[a]=[t[a]])}}return t}function si(i,e){if(i)return e.fromObject(vp(i,e))}function yp(i,e){var t=i.fullName.split("."),r=e.fullName.split("."),n=0,s=0,a=r.length-1;if(!(i instanceof Qi)&&e instanceof fp)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 TE(i){return i.substring(0,1)+i.substring(1).replace(/([A-Z])(?=[a-z]|$)/g,function(e,t){return"_"+t.toLowerCase()})}function bE(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 RE(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 Sp=g((SO,wE)=>{wE.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 Cp=g((CO,OE)=>{OE.exports={nested:{google:{nested:{protobuf:{nested:{SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var Tp=g((TO,AE)=>{AE.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 Op=g(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.addCommonProtos=ir.loadProtosWithOptionsSync=ir.loadProtosWithOptions=void 0;var bp=z("fs"),Rp=z("path"),ai=Is();function wp(i,e){let t=i.resolvePath;i.resolvePath=(r,n)=>{if(Rp.isAbsolute(n))return n;for(let s of e){let a=Rp.join(s,n);try{return bp.accessSync(a,bp.constants.R_OK),a}catch{continue}}return process.emitWarning(`${n} not found in any of the include paths ${e}`),t(r,n)}}async function NE(i,e){let t=new ai.Root;if(e=e||{},e.includeDirs){if(!Array.isArray(e.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));wp(t,e.includeDirs)}let r=await t.load(i,e);return r.resolveAll(),r}ir.loadProtosWithOptions=NE;function PE(i,e){let t=new ai.Root;if(e=e||{},e.includeDirs){if(!Array.isArray(e.includeDirs))throw new Error("The includeDirs option must be an array");wp(t,e.includeDirs)}let r=t.loadSync(i,e);return r.resolveAll(),r}ir.loadProtosWithOptionsSync=PE;function IE(){let i=Sp(),e=Dl(),t=Cp(),r=Tp();ai.common("api",i.nested.google.nested.protobuf.nested),ai.common("descriptor",e.nested.google.nested.protobuf.nested),ai.common("source_context",t.nested.google.nested.protobuf.nested),ai.common("type",r.nested.google.nested.protobuf.nested)}ir.addCommonProtos=IE});var Hl=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 ME=lh(),Tt=Is(),Bl=Ep(),zl=Op(),kE=Wo();de.Long=kE;function xE(i){return"@type"in i&&typeof i["@type"]=="string"}de.isAnyExtension=xE;var Ap;(function(i){i.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",i.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",i.IDEMPOTENT="IDEMPOTENT"})(Ap=de.IdempotencyLevel||(de.IdempotencyLevel={}));var Np={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function DE(i,e){return i===""?e:i+"."+e}function LE(i){return i instanceof Tt.Service||i instanceof Tt.Type||i instanceof Tt.Enum}function FE(i){return i instanceof Tt.Namespace||i instanceof Tt.Root}function Pp(i,e){let t=DE(e,i.name);return LE(i)?[[t,i]]:FE(i)&&typeof i.nested<"u"?Object.keys(i.nested).map(r=>Pp(i.nested[r],t)).reduce((r,n)=>r.concat(n),[]):[]}function Fl(i,e){return function(r){return i.toObject(i.decode(r),e)}}function ql(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 qE(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:Ap.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function UE(i,e,t,r){let n=i.resolvedRequestType,s=i.resolvedResponseType;return{path:"/"+e+"/"+i.name,requestStream:!!i.requestStream,responseStream:!!i.responseStream,requestSerialize:ql(n),requestDeserialize:Fl(n,t),responseSerialize:ql(s),responseDeserialize:Fl(s,t),originalName:ME(i.name),requestType:Ul(n,t,r),responseType:Ul(s,t,r),options:qE(i.parsedOptions)}}function BE(i,e,t,r){let n={};for(let s of i.methodsArray)n[s.name]=UE(s,e,t,r);return n}function Ul(i,e,t){let r=i.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:r.$type.toObject(r,Np),fileDescriptorProtos:t,serialize:ql(i),deserialize:Fl(i,e)}}function zE(i,e){let t=i.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:t.$type.toObject(t,Np),fileDescriptorProtos:e}}function HE(i,e,t,r){if(i instanceof Tt.Service)return BE(i,e,t,r);if(i instanceof Tt.Type)return Ul(i,t,r);if(i instanceof Tt.Enum)return zE(i,r);throw new Error("Type mismatch in reflection object handling")}function Ds(i,e){let t={};i.resolveAll();let n=i.toDescriptor("proto3").file.map(s=>Buffer.from(Bl.FileDescriptorProto.encode(s).finish()));for(let[s,a]of Pp(i,""))t[s]=HE(a,s,e,n);return t}function Ip(i,e){e=e||{};let t=Tt.Root.fromDescriptor(i);return t.resolveAll(),Ds(t,e)}function jE(i,e){return(0,zl.loadProtosWithOptions)(i,e).then(t=>Ds(t,e))}de.load=jE;function WE(i,e){let t=(0,zl.loadProtosWithOptionsSync)(i,e);return Ds(t,e)}de.loadSync=WE;function GE(i,e){e=e||{};let t=Tt.Root.fromJSON(i);return t.resolveAll(),Ds(t,e)}de.fromJSON=GE;function $E(i,e){let t=Bl.FileDescriptorSet.decode(i);return Ip(t,e)}de.loadFileDescriptorSetFromBuffer=$E;function VE(i,e){let t=Bl.FileDescriptorSet.fromObject(i);return Ip(t,e)}de.loadFileDescriptorSetFromObject=VE;(0,zl.addCommonProtos)()});var nr=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=QE;re.getChannelzHandlers=Up;re.getChannelzServiceDefinition=Bp;re.setup=cS;var Fs=z("net"),Ar=(Id(),pr(Pd)),en=Ie(),tn=B(),YE=De(),KE=es(),XE=ss();function jl(i){return{channel_id:i.id,name:i.name}}function Yl(i){return{subchannel_id:i.id,name:i.name}}function JE(i){return{server_id:i.id}}function Bs(i){return{socket_id:i.id,name:i.name}}var Mp=32,Kl=100,Wl=class{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:bt(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}};re.ChannelzTraceStub=Wl;var Gl=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>=Mp*2&&(this.events=this.events.slice(Mp)),this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:bt(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map(e=>({description:e.description,severity:e.severity,timestamp:bt(e.timestamp),channel_ref:e.childChannel?jl(e.childChannel):null,subchannel_ref:e.childSubchannel?Yl(e.childSubchannel):null}))}}};re.ChannelzTrace=Gl;var qs=class{constructor(){this.channelChildren=new Ar.OrderedMap,this.subchannelChildren=new Ar.OrderedMap,this.socketChildren=new Ar.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=qs;var $l=class extends qs{refChild(){}unrefChild(){}};re.ChannelzChildrenTrackerStub=$l;var Us=class{constructor(){this.callsStarted=0,this.callsSucceeded=0,this.callsFailed=0,this.lastCallStartedTimestamp=null}addCallStarted(){this.callsStarted+=1,this.lastCallStartedTimestamp=new Date}addCallSucceeded(){this.callsSucceeded+=1}addCallFailed(){this.callsFailed+=1}};re.ChannelzCallTracker=Us;var Vl=class extends Us{addCallStarted(){}addCallSucceeded(){}addCallFailed(){}};re.ChannelzCallTrackerStub=Vl;var Ht={channel:new Ar.OrderedMap,subchannel:new Ar.OrderedMap,server:new Ar.OrderedMap,socket:new Ar.OrderedMap},zs=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=zs("channel");re.registerChannelzSubchannel=zs("subchannel");re.registerChannelzServer=zs("server");re.registerChannelzSocket=zs("socket");function QE(i){Ht[i.kind].eraseElementByKey(i.id)}function ZE(i){let e=Number.parseInt(i,16);return[e/256|0,e%256]}function kp(i){if(i==="")return[];let e=i.split(":").map(r=>ZE(r));return[].concat(...e)}function eS(i){return(0,Fs.isIPv6)(i)&&i.toLowerCase().startsWith("::ffff:")&&(0,Fs.isIPv4)(i.substring(7))}function xp(i){return Buffer.from(Uint8Array.from(i.split(".").map(e=>Number.parseInt(e))))}function tS(i){if((0,Fs.isIPv4)(i))return xp(i);if(eS(i))return xp(i.substring(7));if((0,Fs.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(kp(e)),s=Buffer.from(kp(t)),a=Buffer.alloc(16-n.length-s.length,0);return Buffer.concat([n,a,s])}else return null}function Lp(i){switch(i){case en.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case en.ConnectivityState.IDLE:return{state:"IDLE"};case en.ConnectivityState.READY:return{state:"READY"};case en.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case en.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function bt(i){if(!i)return null;let e=i.getTime();return{seconds:e/1e3|0,nanos:e%1e3*1e6}}function Fp(i){let e=i.getInfo(),t=[],r=[];return e.children.channels.forEach(n=>{t.push(jl(n[1].ref))}),e.children.subchannels.forEach(n=>{r.push(Yl(n[1].ref))}),{ref:jl(i.ref),data:{target:e.target,state:Lp(e.state),calls_started:e.callTracker.callsStarted,calls_succeeded:e.callTracker.callsSucceeded,calls_failed:e.callTracker.callsFailed,last_call_started_timestamp:bt(e.callTracker.lastCallStartedTimestamp),trace:e.trace.getTraceMessage()},channel_ref:t,subchannel_ref:r}}function rS(i,e){let t=parseInt(i.request.channel_id,10),r=Ht.channel.getElementByKey(t);if(r===void 0){e({code:tn.Status.NOT_FOUND,details:"No channel data found for id "+t});return}e(null,{channel:Fp(r)})}function iS(i,e){let t=parseInt(i.request.max_results,10)||Kl,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(Fp(a.pointer[1]));e(null,{channel:r,end:a.equals(s.end())})}function qp(i){let e=i.getInfo(),t=[];return e.listenerChildren.sockets.forEach(r=>{t.push(Bs(r[1].ref))}),{ref:JE(i.ref),data:{calls_started:e.callTracker.callsStarted,calls_succeeded:e.callTracker.callsSucceeded,calls_failed:e.callTracker.callsFailed,last_call_started_timestamp:bt(e.callTracker.lastCallStartedTimestamp),trace:e.trace.getTraceMessage()},listen_socket:t}}function nS(i,e){let t=parseInt(i.request.server_id,10),n=Ht.server.getElementByKey(t);if(n===void 0){e({code:tn.Status.NOT_FOUND,details:"No server data found for id "+t});return}e(null,{server:qp(n)})}function sS(i,e){let t=parseInt(i.request.max_results,10)||Kl,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(qp(a.pointer[1]));e(null,{server:s,end:a.equals(n.end())})}function aS(i,e){let t=parseInt(i.request.subchannel_id,10),r=Ht.subchannel.getElementByKey(t);if(r===void 0){e({code:tn.Status.NOT_FOUND,details:"No subchannel data found for id "+t});return}let n=r.getInfo(),s=[];n.children.sockets.forEach(o=>{s.push(Bs(o[1].ref))});let a={ref:Yl(r.ref),data:{target:n.target,state:Lp(n.state),calls_started:n.callTracker.callsStarted,calls_succeeded:n.callTracker.callsSucceeded,calls_failed:n.callTracker.callsFailed,last_call_started_timestamp:bt(n.callTracker.lastCallStartedTimestamp),trace:n.trace.getTraceMessage()},socket_ref:s};e(null,{subchannel:a})}function Dp(i){var e;return(0,YE.isTcpSubchannelAddress)(i)?{address:"tcpip_address",tcpip_address:{ip_address:(e=tS(i.host))!==null&&e!==void 0?e:void 0,port:i.port}}:{address:"uds_address",uds_address:{filename:i.path}}}function oS(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:tn.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:Bs(l.ref),local:c.localAddress?Dp(c.localAddress):null,remote:c.remoteAddress?Dp(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:bt(c.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:bt(c.lastRemoteStreamCreatedTimestamp),messages_received:c.messagesReceived,messages_sent:c.messagesSent,last_message_received_timestamp:bt(c.lastMessageReceivedTimestamp),last_message_sent_timestamp:bt(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 lS(i,e){let t=parseInt(i.request.server_id,10),r=Ht.server.getElementByKey(t);if(r===void 0){e({code:tn.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)||Kl,o=r.getInfo().sessionChildren.sockets,l=[],c;for(c=o.lowerBound(n);!c.equals(o.end())&&l.length<s;c=c.next())l.push(Bs(c.pointer[1].ref));e(null,{socket_ref:l,end:c.equals(o.end())})}function Up(){return{GetChannel:rS,GetTopChannels:iS,GetServer:nS,GetServers:sS,GetSubchannel:aS,GetSocket:oS,GetServerSockets:lS}}var Ls=null;function Bp(){if(Ls)return Ls;let i=Hl().loadSync,e=i("channelz.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto`]});return Ls=(0,XE.loadPackageDefinition)(e).grpc.channelz.v1.Channelz.service,Ls}function cS(){(0,KE.registerAdminService)(Bp,Up)}});var rn=g(Xl=>{"use strict";Object.defineProperty(Xl,"__esModule",{value:!0});Xl.getNextCallNumber=dS;var uS=0;function dS(){return uS++}});var Jl=g(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.CompressionAlgorithms=void 0;var zp;(function(i){i[i.identity=0]="identity",i[i.deflate=1]="deflate",i[i.gzip=2]="gzip"})(zp||(Hs.CompressionAlgorithms=zp={}))});var Zl=g(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.BaseFilter=void 0;var Ql=class{async sendMetadata(e){return e}receiveMetadata(e){return e}async sendMessage(e){return e}async receiveMessage(e){return e}receiveTrailers(e){return e}};js.BaseFilter=Ql});var nc=g(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.CompressionFilterFactory=li.CompressionFilter=void 0;var Ws=z("zlib"),jp=Jl(),sr=B(),hS=Zl(),fS=ee(),pS=i=>typeof i=="number"&&typeof jp.CompressionAlgorithms[i]=="string",oi=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}},Nr=class extends oi{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'))}},ec=class extends oi{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((t,r)=>{Ws.deflate(e,(n,s)=>{n?r(n):t(s)})})}decompressMessage(e){return new Promise((t,r)=>{let n=0,s=[],a=Ws.createInflate();a.on("error",o=>{r({code:sr.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:sr.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()})}},tc=class extends oi{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((t,r)=>{Ws.gzip(e,(n,s)=>{n?r(n):t(s)})})}decompressMessage(e){return new Promise((t,r)=>{let n=0,s=[],a=Ws.createGunzip();a.on("error",o=>{r({code:sr.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:sr.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 oi{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 Hp(i,e){switch(i){case"identity":return new Nr;case"deflate":return new ec(e);case"gzip":return new tc(e);default:return new rc(i)}}var Gs=class extends hS.BaseFilter{constructor(e,t){var r,n,s;super(),this.sharedFilterConfig=t,this.sendCompression=new Nr,this.receiveCompression=new Nr,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:sr.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.maxSendMessageLength=(n=e["grpc.max_send_message_length"])!==null&&n!==void 0?n:sr.DEFAULT_MAX_SEND_MESSAGE_LENGTH,a!==void 0)if(pS(a)){let o=jp.CompressionAlgorithms[a],l=(s=t.serverSupportedEncodingHeader)===null||s===void 0?void 0:s.split(",");(!l||l.includes(o))&&(this.currentCompressionAlgorithm=o,this.sendCompression=Hp(this.currentCompressionAlgorithm,-1))}else fS.log(sr.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=Hp(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 Nr,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:sr.Status.RESOURCE_EXHAUSTED,details:`Attempted to send message with a size larger than ${this.maxSendMessageLength}`};let n;return this.sendCompression instanceof Nr?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)}};li.CompressionFilter=Gs;var ic=class{constructor(e,t){this.options=t,this.sharedFilterConfig={}}createFilter(){return new Gs(this.options,this.sharedFilterConfig)}};li.CompressionFilterFactory=ic});var nn=g(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.restrictControlPlaneStatusCode=mS;var Rt=B(),gS=[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 mS(i,e){return gS.includes(i)?{code:Rt.Status.INTERNAL,details:`Invalid status from control plane: ${i} ${Rt.Status[i]} ${e}`}:{code:i,details:e}}});var ci=g(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.minDeadline=vS;Pr.getDeadlineTimeoutString=_S;Pr.getRelativeTimeout=SS;Pr.deadlineToString=CS;Pr.formatDateDifference=TS;function vS(...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 yS=[["m",1],["S",1e3],["M",60*1e3],["H",3600*1e3]];function _S(i){let e=new Date().getTime();i instanceof Date&&(i=i.getTime());let t=Math.max(i-e,0);for(let[r,n]of yS){let s=t/n;if(s<1e8)return String(Math.ceil(s))+r}throw new Error("Deadline is too far in the future")}var ES=2147483647;function SS(i){let e=i instanceof Date?i.getTime():i,t=new Date().getTime(),r=e-t;return r<0?0:r>ES?1/0:r}function CS(i){if(i instanceof Date)return i.toISOString();{let e=new Date(i);return Number.isNaN(e.getTime())?""+i:e.toISOString()}}function TS(i,e){return((e.getTime()-i.getTime())/1e3).toFixed(3)+"s"}});var Vs=g(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.FilterStackFactory=ui.FilterStack=void 0;var $s=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}};ui.FilterStack=$s;var ac=class i{constructor(e){this.factories=e}push(e){this.factories.unshift(...e)}clone(){return new i([...this.factories])}createFilter(){return new $s(this.factories.map(e=>e.createFilter()))}};ui.FilterStackFactory=ac});var Wp=g(Ks=>{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});Ks.SingleSubchannelChannel=void 0;var bS=rn(),sn=nr(),RS=nc(),wS=Ie(),an=B(),OS=nn(),AS=ci(),NS=Vs(),oc=pe(),PS=et(),Ys=Pe(),lc=class{constructor(e,t,r,n,s){var a,o;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;let l=this.method.split("/"),c="";l.length>=2&&(c=l[1]);let u=(o=(a=(0,Ys.splitHostPort)(this.options.host))===null||a===void 0?void 0:a.host)!==null&&o!==void 0?o:"localhost";this.serviceUrl=`https://${u}/${c}`;let h=(0,AS.getRelativeTimeout)(n.deadline);h!==1/0&&(h<=0?this.cancelWithStatus(an.Status.DEADLINE_EXCEEDED,"Deadline exceeded"):setTimeout(()=>{this.cancelWithStatus(an.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},h)),this.filterStack=r.createFilter()}cancelWithStatus(e,t){this.childCall?this.childCall.cancelWithStatus(e,t):this.pendingStatus={code:e,details:t,metadata:new oc.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()!==wS.ConnectivityState.READY){t.onReceiveStatus({code:an.Status.UNAVAILABLE,details:"Subchannel not ready",metadata:new oc.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,OS.restrictControlPlaneStatusCode)(typeof o.code=="number"?o.code:an.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${o.message}`);t.onReceiveStatus({code:l,details:c,metadata:new oc.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}},cc=class{constructor(e,t,r){this.subchannel=e,this.target=t,this.channelzEnabled=!1,this.channelzTrace=new sn.ChannelzTrace,this.callTracker=new sn.ChannelzCallTracker,this.childrenTracker=new sn.ChannelzChildrenTracker,this.channelzEnabled=r["grpc.enable_channelz"]!==0,this.channelzRef=(0,sn.registerChannelzChannel)((0,Ys.uriToString)(t),()=>({target:`${(0,Ys.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 NS.FilterStackFactory([new RS.CompressionFilterFactory(this,r)])}close(){this.channelzEnabled&&this.childrenTracker.unrefChild(this.subchannel.getChannelzRef()),(0,sn.unregisterChannelzRef)(this.channelzRef)}getTarget(){return(0,Ys.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,PS.getDefaultAuthority)(this.target),flags:an.Propagate.DEFAULTS,parentCall:null};return new lc(this.subchannel,e,this.filterStackFactory,r,(0,bS.getNextCallNumber)())}};Ks.SingleSubchannelChannel=cc});var $p=g(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.Subchannel=void 0;var J=Ie(),IS=Wr(),on=ee(),Xs=B(),MS=Pe(),kS=De(),wt=nr(),xS=Wp(),Gp="subchannel",DS=~(1<<31),uc=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 IS.BackoffTimeout(()=>{this.handleBackoffTimer()},o),this.backoffTimeout.unref(),this.subchannelAddressString=(0,kS.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 on.isTracerEnabled(Gp)}get refTraceEnabled(){return on.isTracerEnabled("subchannel_refcount")}trace(e){this.traceEnabled&&on.trace(Xs.LogVerbosity.DEBUG,Gp,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}refTrace(e){this.refTraceEnabled&&on.trace(Xs.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,DS);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,on.log(Xs.LogVerbosity.ERROR,`Connection to ${(0,MS.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===Xs.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 xS.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)}};Js.Subchannel=uc});var fc=g(di=>{"use strict";var dc,hc;Object.defineProperty(di,"__esModule",{value:!0});di.GRPC_NODE_DEBUG_SEND_ERROR_DETAILS=di.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=void 0;di.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=((dc=process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)!==null&&dc!==void 0?dc:"false")==="true";di.GRPC_NODE_DEBUG_SEND_ERROR_DETAILS=((hc=process.env.GRPC_NODE_DEBUG_SEND_ERROR_DETAILS)!==null&&hc!==void 0?hc:"false")==="true"});var vc=g(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.DEFAULT_PORT=void 0;Ir.setup=jS;var Vp=et(),pc=z("dns"),LS=co(),gc=B(),hi=_r(),FS=pe(),qS=ee(),US=B(),ar=Pe(),Yp=z("net"),BS=Wr(),Kp=fc(),zS="dns_resolver";function Ot(i){qS.trace(US.LogVerbosity.DEBUG,zS,i)}Ir.DEFAULT_PORT=443;var HS=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,ar.uriToString)(e)),e.authority&&this.alternativeResolver.setServers([e.authority]);let o=(0,ar.splitHostPort)(e.path);o===null?(this.ipResult=null,this.dnsHostname=null,this.port=null):(0,Yp.isIPv4)(o.host)||(0,Yp.isIPv6)(o.host)?(this.ipResult=[{addresses:[{host:o.host,port:(n=o.port)!==null&&n!==void 0?n:Ir.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:Ir.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,ar.uriToString)(this.target)}`,metadata:new FS.Metadata};let l={initialDelay:r["grpc.initial_reconnect_backoff_ms"],maxDelay:r["grpc.max_reconnect_backoff_ms"]};this.backoff=new BS.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:HS,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(this.ipResult!==null){this.returnedIpResult||(Ot("Returning IP address for target "+(0,ar.uriToString)(this.target)),setImmediate(()=>{this.listener((0,hi.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,ar.uriToString)(this.target)),setImmediate(()=>{this.listener((0,hi.statusOrFromError)({code:gc.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,ar.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,hi.statusOrFromValue)(t.map(s=>({addresses:[s]})));let r="["+t.map(s=>s.host+":"+s.port).join(",")+"]";Ot("Resolved addresses for target "+(0,ar.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,ar.uriToString)(this.target)+": "+t.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener((0,hi.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,LS.extractAndSelectServiceConfig)(t,this.percentage),r?this.latestServiceConfigResult=(0,hi.statusOrFromValue)(r):this.latestServiceConfigResult=null}catch(n){this.latestServiceConfigResult=(0,hi.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(Kp.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 Kp.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 jS(){(0,Vp.registerResolver)("dns",mc),(0,Vp.registerDefaultScheme)("dns")}});var yc=g(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.parseCIDR=Qp;un.mapProxyName=ZS;un.getProxiedConnection=eC;var ln=ee(),fi=B(),Jp=z("net"),WS=z("http"),GS=ee(),Xp=De(),cn=Pe(),$S=z("url"),VS=vc(),YS="proxy";function pi(i){GS.trace(fi.LogVerbosity.DEBUG,YS,i)}function KS(){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 $S.URL(i)}catch{return(0,ln.log)(fi.LogVerbosity.ERROR,`cannot parse value of "${e}" env var`),{}}if(t.protocol!=="http:")return(0,ln.log)(fi.LogVerbosity.ERROR,`"${t.protocol}" scheme not supported in proxy URI`),{};let r=null;t.username&&(t.password?((0,ln.log)(fi.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),pi("Proxy server "+a.address+" set by environment variable "+e),a}function XS(){let i=process.env.no_grpc_proxy,e="no_grpc_proxy";return i||(i=process.env.no_proxy,e="no_proxy"),i?(pi("No proxy server list set by environment variable "+e),i.split(",")):[]}function Qp(i){let e=i.split("/");if(e.length!==2)return null;let t=parseInt(e[1],10);return!(0,Jp.isIPv4)(e[0])||Number.isNaN(t)||t<0||t>32?null:{ip:Zp(e[0]),prefixLength:t}}function Zp(i){return i.split(".").reduce((e,t)=>(e<<8)+parseInt(t,10),0)}function JS(i,e){let t=i.ip,r=-1<<32-i.prefixLength;return(Zp(e)&r)===(t&r)}function QS(i){for(let e of XS()){let t=Qp(e);if((0,Jp.isIPv4)(i)&&t&&JS(t,i))return!0;if(i.endsWith(e))return!0}return!1}function ZS(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=KS();if(!n.address)return r;let s=(0,cn.splitHostPort)(i.path);if(!s)return r;let a=s.host;if(QS(a))return pi("Not using proxy for target in no_proxy list: "+(0,cn.uriToString)(i)),r;let o={"grpc.http_connect_target":(0,cn.uriToString)(i)};return n.creds&&(o["grpc.http_connect_creds"]=n.creds),{target:{scheme:"dns",path:n.address},extraOptions:o}}function eC(i,e){var t;if(!("grpc.http_connect_target"in e))return Promise.resolve(null);let r=e["grpc.http_connect_target"],n=(0,cn.parseUri)(r);if(n===null)return Promise.resolve(null);let s=(0,cn.splitHostPort)(n.path);if(s===null)return Promise.resolve(null);let a=`${s.host}:${(t=s.port)!==null&&t!==void 0?t:VS.DEFAULT_PORT}`,o={method:"CONNECT",path:a},l={Host:a};(0,Xp.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,Xp.subchannelAddressToString)(i);return pi("Using proxy "+c+" to connect to "+o.path),new Promise((u,h)=>{let f=WS.request(o);f.once("connect",(_,p,v)=>{f.removeAllListeners(),p.removeAllListeners(),_.statusCode===200?(pi("Successfully connected to "+o.path+" through proxy "+c),v.length>0&&p.unshift(v),pi("Successfully established a plaintext connection to "+o.path+" through proxy "+c),u(p)):((0,ln.log)(fi.LogVerbosity.ERROR,"Failed to connect to "+o.path+" through proxy "+c+" with status "+_.statusCode),h())}),f.once("error",_=>{f.removeAllListeners(),(0,ln.log)(fi.LogVerbosity.ERROR,"Failed to connect to proxy "+c+" with error "+_.message),h()}),f.end()})}});var Ec=g(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});Qs.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}};Qs.StreamDecoder=_c});var rg=g(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});Zs.Http2SubchannelCall=void 0;var jt=z("http2"),tC=z("os"),Q=B(),Wt=pe(),rC=Ec(),eg=ee(),iC=B(),tg="subchannel_call";function nC(i){for(let[e,t]of Object.entries(tC.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 rC.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="+nC(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 eg.isTracerEnabled(tg)}trace(e){this.traceEnabled&&eg.trace(iC.LogVerbosity.DEBUG,tg,"["+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.getMap(),n;if(typeof r["grpc-status"]=="string"){let s=Number(r["grpc-status"]);this.traceEnabled&&this.trace("received status code "+s+" from server"),t.remove("grpc-status");let a="";if(typeof r["grpc-message"]=="string"){try{a=decodeURI(r["grpc-message"])}catch{a=r["grpc-message"]}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())}};Zs.Http2SubchannelCall=Cc});var ng=g(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.Http2SubchannelConnector=void 0;var Mr=z("http2"),sC=z("tls"),ea=nr(),dn=B(),aC=yc(),Nt=ee(),oC=et(),ta=De(),Tc=Pe(),lC=z("net"),cC=rg(),uC=rn(),ra="transport",ig="transport_flowctrl",dC=Wa().version,{HTTP2_HEADER_AUTHORITY:hC,HTTP2_HEADER_CONTENT_TYPE:fC,HTTP2_HEADER_METHOD:pC,HTTP2_HEADER_PATH:gC,HTTP2_HEADER_TE:mC,HTTP2_HEADER_USER_AGENT:vC}=Mr.constants,yC=2e4,_C=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,ta.subchannelAddressToString)(t),r["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.streamTracker=new ea.ChannelzCallTrackerStub):this.streamTracker=new ea.ChannelzCallTracker,this.channelzRef=(0,ea.registerChannelzSocket)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.userAgent=[r["grpc.primary_user_agent"],`grpc-node-js/${dC}`,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=yC,"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===Mr.constants.NGHTTP2_ENHANCE_YOUR_CALM&&o&&o.equals(_C)&&(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 sC.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,ta.stringToSubchannelAddress)(n.remoteAddress,n.remotePort):null,a=n.localAddress?(0,ta.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(ra)}get keepaliveTraceEnabled(){return Nt.isTracerEnabled("keepalive")}get flowControlTraceEnabled(){return Nt.isTracerEnabled(ig)}get internalsTraceEnabled(){return Nt.isTracerEnabled("transport_internals")}trace(e){this.traceEnabled&&Nt.trace(dn.LogVerbosity.DEBUG,ra,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}keepaliveTrace(e){this.keepaliveTraceEnabled&&Nt.trace(dn.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}flowControlTrace(e){this.flowControlTraceEnabled&&Nt.trace(dn.LogVerbosity.DEBUG,ig,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}internalsTrace(e){this.internalsTraceEnabled&&Nt.trace(dn.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[hC]=t,o[vC]=this.userAgent,o[fC]="application/grpc",o[pC]="POST",o[gC]=r,o[mC]="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=new Date,(h=s.addMessageSent)===null||h===void 0||h.call(s)},addMessageReceived:()=>{var h;this.messagesReceived+=1,this.lastMessageReceivedTimestamp=new Date,(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 cC.Http2SubchannelCall(l,c,n,this,a??(0,uC.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,ea.unregisterChannelzRef)(this.channelzRef)}},Rc=class{constructor(e){this.channelTarget=e,this.session=null,this.isShutdown=!1}get traceEnabled(){return Nt.isTracerEnabled(ra)}trace(e){this.traceEnabled&&Nt.trace(dn.LogVerbosity.DEBUG,ra,(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,oC.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=Mr.getDefaultSettings)===null||o===void 0?void 0:o.call(Mr))===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=Mr.connect(`${R}://${O}`,E),k=(_=(f=(h=Mr.getDefaultSettings)===null||h===void 0?void 0:h.call(Mr))===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,aC.getProxiedConnection)(e,t).then(r=>r||new Promise((n,s)=>{let a=()=>{s(new Error("Socket closed"))},o=c=>{s(c)},l=lC.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,ta.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}};ia.Http2SubchannelConnector=Rc});var sg=g(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.SubchannelPool=void 0;fn.getSubchannelPool=OC;var EC=Rd(),SC=$p(),CC=De(),TC=Pe(),bC=ng(),RC=1e4,hn=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()},RC),(t=(e=this.cleanupTimer).unref)===null||t===void 0||t.call(e))}getOrCreateSubchannel(e,t,r,n){this.ensureCleanupTask();let s=(0,TC.uriToString)(e);if(s in this.pool){let o=this.pool[s];for(let l of o)if((0,CC.subchannelAddressEqual)(t,l.subchannelAddress)&&(0,EC.channelOptionsEqual)(r,l.channelArguments)&&n._equals(l.channelCredentials))return l.subchannel}let a=new SC.Subchannel(e,t,r,n,new bC.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}};fn.SubchannelPool=hn;var wC=new hn;function OC(i){return i?wC:new hn}});var ug=g(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});aa.LoadBalancingCall=void 0;var ag=Ie(),na=B(),og=ci(),sa=pe(),pn=kt(),AC=Pe(),lg=ee(),wc=nn(),NC=z("http2"),cg="load_balancing_call",Oc=class{constructor(e,t,r,n,s,a,o){var l,c;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;let u=this.methodName.split("/"),h="";u.length>=2&&(h=u[1]);let f=(c=(l=(0,AC.splitHostPort)(this.host))===null||l===void 0?void 0:l.host)!==null&&c!==void 0?c:"localhost";this.serviceUrl=`https://${f}/${h}`,this.startTime=new Date}getDeadlineInfo(){var e,t;let r=[];return this.childStartTime?(this.childStartTime>this.startTime&&(!((e=this.metadata)===null||e===void 0)&&e.getOptions().waitForReady&&r.push("wait_for_ready"),r.push(`LB pick: ${(0,og.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 lg.isTracerEnabled(cg)}trace(e){this.traceEnabled&&lg.trace(na.LogVerbosity.DEBUG,cg,"["+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='+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)}}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: "+pn.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 pn.PickResultType.COMPLETE:this.credentials.compose(n.subchannel.getCallCredentials()).generateMetadata({method_name:this.methodName,service_url:this.serviceUrl}).then(l=>{var c;if(this.ended){this.trace("Credentials metadata generation finished after call ended");return}if(r.merge(l),r.get("authorization").length>1&&this.outputStatus({code:na.Status.INTERNAL,details:'"authorization" metadata cannot have multiple values',metadata:new sa.Metadata},"PROCESSED"),n.subchannel.getConnectivityState()!==ag.ConnectivityState.READY){this.traceEnabled&&this.trace("Picked subchannel "+this.getSubchannelString(n.subchannel)+" has state "+ag.ConnectivityState[n.subchannel.getConnectivityState()]+" after getting credentials metadata. Retrying pick"),this.doPick();return}this.deadline!==1/0&&r.set("grpc-timeout",(0,og.getDeadlineTimeoutString)(this.deadline));try{this.child=n.subchannel.getRealSubchannel().createCall(r,this.host,this.methodName,{onReceiveMetadata:u=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(u)},onReceiveMessage:u=>{this.trace("Received message"),this.listener.onReceiveMessage(u)},onReceiveStatus:u=>{this.trace("Received status"),u.rstCode===NC.constants.NGHTTP2_REFUSED_STREAM?this.outputStatus(u,"REFUSED"):this.outputStatus(u,"PROCESSED")}},this.callNumber),this.childStartTime=new Date}catch(u){this.traceEnabled&&this.trace("Failed to start call on picked subchannel "+this.getSubchannelString(n.subchannel)+" with error "+u.message),this.outputStatus({code:na.Status.INTERNAL,details:"Failed to start HTTP/2 stream with error "+u.message,metadata:new sa.Metadata},"NOT_STARTED");return}(c=n.onCallStarted)===null||c===void 0||c.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()},l=>{let{code:c,details:u}=(0,wc.restrictControlPlaneStatusCode)(typeof l.code=="number"?l.code:na.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${l.message}`);this.outputStatus({code:c,details:u,metadata:new sa.Metadata},"PROCESSED")});break;case pn.PickResultType.DROP:let{code:a,details:o}=(0,wc.restrictControlPlaneStatusCode)(n.status.code,n.status.details);setImmediate(()=>{this.outputStatus({code:a,details:o,metadata:n.status.metadata},"DROP")});break;case pn.PickResultType.TRANSIENT_FAILURE:if(this.metadata.getOptions().waitForReady)this.channel.queueCallForPick(this);else{let{code:l,details:c}=(0,wc.restrictControlPlaneStatusCode)(n.status.code,n.status.details);setImmediate(()=>{this.outputStatus({code:l,details:c,metadata:n.status.metadata},"PROCESSED")})}break;case pn.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 sa.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}};aa.LoadBalancingCall=Oc});var pg=g(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.ResolvingCall=void 0;var PC=Un(),or=B(),kr=ci(),dg=pe(),hg=ee(),IC=nn(),fg="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=setTimeout(()=>{},0),this.filterStack=null,this.deadlineStartTime=null,this.configReceivedTime=null,this.childStartTime=null,this.credentials=PC.CallCredentials.createEmpty(),this.deadline=r.deadline,this.host=r.host,r.parentCall&&(r.flags&or.Propagate.CANCELLATION&&r.parentCall.on("cancelled",()=>{this.cancelWithStatus(or.Status.CANCELLED,"Cancelled by parent call")}),r.flags&or.Propagate.DEADLINE&&(this.traceEnabled&&this.trace("Propagating deadline from parent: "+r.parentCall.getDeadline()),this.deadline=(0,kr.minDeadline)(this.deadline,r.parentCall.getDeadline()))),this.trace("Created"),this.runDeadlineTimer()}get traceEnabled(){return hg.isTracerEnabled(fg)}trace(e){this.traceEnabled&&hg.trace(or.LogVerbosity.DEBUG,fg,"["+this.callNumber+"] "+e)}runDeadlineTimer(){clearTimeout(this.deadlineTimer),this.deadlineStartTime=new Date,this.traceEnabled&&this.trace("Deadline: "+(0,kr.deadlineToString)(this.deadline));let e=(0,kr.getRelativeTimeout)(this.deadline);if(e!==1/0){this.traceEnabled&&this.trace("Deadline will be reached in "+e+"ms");let t=()=>{if(!this.deadlineStartTime){this.cancelWithStatus(or.Status.DEADLINE_EXCEEDED,"Deadline exceeded");return}let r=[],n=new Date;r.push(`Deadline exceeded after ${(0,kr.formatDateDifference)(this.deadlineStartTime,n)}`),this.configReceivedTime?(this.configReceivedTime>this.deadlineStartTime&&r.push(`name resolution: ${(0,kr.formatDateDifference)(this.deadlineStartTime,this.configReceivedTime)}`),this.childStartTime?this.childStartTime>this.configReceivedTime&&r.push(`metadata filters: ${(0,kr.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(or.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()),clearTimeout(this.deadlineTimer);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:or.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=new Date;let t=e.config;if(t.status!==or.Status.OK){let{code:r,details:n}=(0,IC.restrictControlPlaneStatusCode)(t.status,"Failed to route call to method "+this.method);this.outputStatus({code:r,details:n,metadata:new dg.Metadata});return}if(t.methodConfig.timeout){let r=new Date;r.setSeconds(r.getSeconds()+t.methodConfig.timeout.seconds),r.setMilliseconds(r.getMilliseconds()+t.methodConfig.timeout.nanos/1e6),this.deadline=(0,kr.minDeadline)(this.deadline,r),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=new Date,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 dg.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}};oa.ResolvingCall=Ac});var vg=g(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.RetryingCall=lr.MessageBufferTracker=lr.RetryThrottler=void 0;var la=B(),MC=ci(),kC=pe(),gg=ee(),xC=rn(),mg="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}};lr.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)}};lr.MessageBufferTracker=Ic;var Nc="grpc-previous-rpc-attempts",DC=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:DC;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=new Date}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,MC.formatDateDifference)(this.startTime,t.startTime)}`),e.push(...t.call.getDeadlineInfo()),e}getCallNumber(){return this.callNumber}get traceEnabled(){return gg.isTracerEnabled(mg)}trace(e){this.traceEnabled&&gg.trace(la.LogVerbosity.DEBUG,mg,"["+this.callNumber+"] "+e)}reportStatus(e){this.traceEnabled&&this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+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 kC.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(la.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=la.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===la.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,xC.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:new Date});let n=this.attempts-1,s=this.initialMetadata.clone();n>0&&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}};lr.RetryingCall=Mc});var gn=g(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.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()}};ca.BaseSubchannelWrapper=kc});var zc=g(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.InternalChannel=xr.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=void 0;var LC=jr(),FC=bd(),qC=sg(),Lc=kt(),UC=pe(),cr=B(),BC=Vs(),zC=nc(),yg=et(),mn=ee(),HC=yc(),ua=Pe(),Je=Ie(),vn=nr(),jC=ug(),WC=ci(),GC=pg(),xc=rn(),$C=nn(),Dc=vg(),VC=gn(),YC=2147483647,KC=1e3,XC=1800*1e3,da=new Map,JC=1<<24,QC=1<<20,Fc=class extends VC.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:cr.Status.UNAVAILABLE,details:"Channel closed before call started",metadata:new UC.Metadata},subchannel:null,onCallStarted:null,onCallEnded:null}}};xr.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX="grpc.internal.no_subchannel";var Uc=class{constructor(e){this.target=e,this.trace=new vn.ChannelzTrace,this.callTracker=new vn.ChannelzCallTracker,this.childrenTracker=new vn.ChannelzChildrenTracker,this.state=Je.ConnectivityState.IDLE}getChannelzInfoCallback(){return()=>({target:this.target,state:this.state,trace:this.trace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()})}},Bc=class{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),typeof e!="string")throw new TypeError("Channel target must be a string");if(!(t instanceof LC.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,ua.parseUri)(e);if(u===null)throw new Error(`Could not parse target name "${e}"`);let h=(0,yg.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,vn.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,yg.getDefaultAuthority)(h);let f=(0,HC.mapProxyName)(h,r);this.target=f.target,this.options=Object.assign({},this.options,f.extraOptions),this.subchannelPool=(0,qC.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:JC,(a=this.options["grpc.per_rpc_retry_buffer_size"])!==null&&a!==void 0?a:QC),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:XC,KC);let _={createSubchannel:(p,v)=>{let R={};for(let[D,E]of Object.entries(v))D.startsWith(xr.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 FC.ResolvingLoadBalancer(this.target,_,this.options,(p,v)=>{var R;p.retryThrottling?da.set(this.getTarget(),new Dc.RetryThrottler(p.retryThrottling.maxTokens,p.retryThrottling.tokenRatio,da.get(this.getTarget()))):da.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,$C.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 BC.FilterStackFactory([new zC.CompressionFilterFactory(this,this.options)]),this.traceEnabled&&this.trace("Channel constructed with options "+JSON.stringify(r,void 0,2)),(0,mn.isTracerEnabled)("channel_stacktrace")){let p=new Error;(0,mn.trace)(cr.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=new Date}get traceEnabled(){return(0,mn.isTracerEnabled)("channel")}trace(e,t){this.traceEnabled&&(0,mn.trace)(t??cr.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+(0,ua.uriToString)(this.target)+" "+e)}callRefTimerRef(){var e,t,r,n;this.callRefTimer||(this.callRefTimer=setInterval(()=>{},YC)),!((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,mn.trace)(cr.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+(0,ua.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=new Date().valueOf()-this.lastActivityTimestamp.valueOf();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===cr.Status.OK?this.channelzInfoTracker.callTracker.addCallSucceeded():this.channelzInfoTracker.callTracker.addCallFailed()),this.callCount-=1,this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()}createLoadBalancingCall(e,t,r,n,s,a){let o=a??(0,xc.getNextCallNumber)();return this.traceEnabled&&this.trace("createLoadBalancingCall ["+o+'] method="'+t+'"'),new jC.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,da.get(this.getTarget()))}createResolvingCall(e,t,r,n,s){let a=(0,xc.getNextCallNumber)();this.traceEnabled&&this.trace("createResolvingCall ["+a+'] method="'+e+'", deadline='+(0,WC.deadlineToString)(t));let o={deadline:t,flags:s??cr.Propagate.DEFAULTS,host:r??this.defaultAuthority,parentCall:n},l=new GC.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(cr.Status.UNAVAILABLE,"Channel closed before call started");this.configSelectionQueue=[];for(let t of this.pickQueue)t.cancelWithStatus(cr.Status.UNAVAILABLE,"Channel closed before call started");this.pickQueue.clear(),this.callRefTimer&&clearInterval(this.callRefTimer),this.idleTimer&&clearTimeout(this.idleTimer),this.channelzEnabled&&(0,vn.unregisterChannelzRef)(this.channelzRef),this.subchannelPool.unrefUnusedSubchannels(),(e=this.configSelector)===null||e===void 0||e.unref(),this.configSelector=null}getTarget(){return(0,ua.uriToString)(this.target)}getConnectivityState(e){let t=this.connectivityState;return e&&(this.resolvingLoadBalancer.exitIdle(),this.lastActivityTimestamp=new Date,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}};xr.InternalChannel=Bc});var xo=g(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.ChannelImplementation=void 0;var ZC=jr(),eT=zc(),Hc=class{constructor(e,t,r){if(typeof e!="string")throw new TypeError("Channel target must be a string");if(!(t instanceof ZC.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 eT.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)}};ha.ChannelImplementation=Hc});var Eg=g(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.ServerDuplexStreamImpl=ht.ServerWritableStreamImpl=ht.ServerReadableStreamImpl=ht.ServerUnaryCallImpl=void 0;ht.serverErrorToStatus=Kc;var tT=z("events"),Vc=z("stream"),Yc=B(),_g=pe();function Kc(i,e){var t;let r={code:Yc.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 jc=class extends tT.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()}};ht.ServerUnaryCallImpl=jc;var Wc=class extends Vc.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()}};ht.ServerReadableStreamImpl=Wc;var Gc=class extends Vc.Writable{constructor(e,t,r,n){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=r,this.request=n,this.pendingStatus={code:Yc.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new _g.Metadata,this.on("error",s=>{this.pendingStatus=Kc(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()}};ht.ServerWritableStreamImpl=Gc;var $c=class extends Vc.Duplex{constructor(e,t,r){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=r,this.pendingStatus={code:Yc.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new _g.Metadata,this.on("error",n=>{this.pendingStatus=Kc(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()}};ht.ServerDuplexStreamImpl=$c});var fa=g(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});gi.ServerCredentials=void 0;gi.createCertificateProviderServerCredentials=rT;gi.createServerCredentialsWithInterceptors=iT;var Xc=to(),Dr=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 Jc}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 Qc({requestCert:r,ciphers:Xc.CIPHER_SUITES},{ca:(n=e??(0,Xc.getDefaultRootsData)())!==null&&n!==void 0?n:void 0,cert:s,key:a})}};gi.ServerCredentials=Dr;var Jc=class i extends Dr{constructor(){super(null)}_getSettings(){return null}_equals(e){return e instanceof i}},Qc=class i extends Dr{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}},Zc=class i extends Dr{constructor(e,t,r){super({requestCert:t!==null,rejectUnauthorized:r,ciphers:Xc.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 rT(i,e,t){return new Zc(i,e,t)}var eu=class i extends Dr{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 iT(i,e){return new eu(i,e)}});var yn=g(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.durationMessageToDuration=nT;Gt.msToDuration=sT;Gt.durationToMs=aT;Gt.isDuration=oT;Gt.isDurationMessage=lT;Gt.parseDuration=uT;Gt.durationToString=dT;function nT(i){return{seconds:Number.parseInt(i.seconds),nanos:i.nanos}}function sT(i){return{seconds:i/1e3|0,nanos:i%1e3*1e6|0}}function aT(i){return i.seconds*1e3+i.nanos/1e6|0}function oT(i){return typeof i.seconds=="number"&&typeof i.nanos=="number"}function lT(i){return typeof i.seconds=="string"&&typeof i.nanos=="number"}var cT=/^(\d+)(?:\.(\d+))?s$/;function uT(i){let e=i.match(cT);return e?{seconds:Number.parseInt(e[1],10),nanos:e[2]?Number.parseInt(e[2].padEnd(9,"0"),10):0}:null}function dT(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 ga=g(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.OrcaOobMetricsSubchannelWrapper=We.GRPC_METRICS_HEADER=We.ServerMetricRecorder=We.PerRequestMetricRecorder=void 0;We.createOrcaClient=bg;We.createMetricsReader=yT;var hT=ss(),tu=yn(),fT=jr(),pT=gn(),Sg=B(),gT=Wr(),mT=Ie(),Cg=null;function pa(){if(Cg)return Cg;let i=Hl().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,hT.loadPackageDefinition)(e)}var ru=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 pa().xds.data.orca.v3.OrcaLoadReport.serialize(this.message)}};We.PerRequestMetricRecorder=ru;var vT=3e4,iu=class{constructor(){this.message={},this.serviceImplementation={StreamCoreMetrics:e=>{let t=e.request.report_interval?(0,tu.durationToMs)((0,tu.durationMessageToDuration)(e.request.report_interval)):vT,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=pa().xds.service.orca.v3.OpenRcaService.service;e.addService(t,this.serviceImplementation)}};We.ServerMetricRecorder=iu;function bg(i){let e=pa().xds.service.orca.v3.OpenRcaService;return new e("unused",fT.ChannelCredentials.createInsecure(),{channelOverride:i})}We.GRPC_METRICS_HEADER="endpoint-load-metrics-bin";var Tg="grpc_orca_load_report";function yT(i,e){return(t,r,n)=>{let s=n.getOpaque(Tg);if(s)i(s);else{let a=n.get(We.GRPC_METRICS_HEADER);a.length>0&&(s=pa().xds.data.orca.v3.OrcaLoadReport.deserialize(a[0]),i(s),n.setOpaque(Tg,s))}e&&e(t,r,n)}}var Rg="orca_oob_metrics",nu=class{constructor(e,t){this.metricsListener=e,this.intervalMs=t,this.dataProducer=null}setSubchannel(e){let t=e.getOrCreateDataProducer(Rg,_T);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)}},su=class{constructor(e){this.subchannel=e,this.dataWatchers=new Set,this.orcaSupported=!0,this.metricsCall=null,this.currentInterval=1/0,this.backoffTimer=new gT.BackoffTimeout(()=>this.updateMetricsSubscription()),this.subchannelStateListener=()=>this.updateMetricsSubscription();let t=e.getChannel();this.client=bg(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(Rg),(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()!==mT.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,tu.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===Sg.Status.UNIMPLEMENTED){this.orcaSupported=!1;return}n.code!==Sg.Status.CANCELLED&&this.backoffTimer.runOnce()})}}},au=class extends pT.BaseSubchannelWrapper{constructor(e,t,r){super(e),this.addDataWatcher(new nu(t,r))}getWrappedSubchannel(){return this.child}};We.OrcaOobMetricsSubchannelWrapper=au;function _T(i){return new su(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=CT;Qe.getServerInterceptingCall=OT;var ya=pe(),ke=B(),mi=z("http2"),wg=Dn(),Og=z("zlib"),ET=Ec(),Mg=ee(),ST=z("tls"),Ag=ga(),kg="server_call";function Lr(i){Mg.trace(ke.LogVerbosity.DEBUG,kg,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 CT(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 ma={onReceiveMetadata:(i,e)=>{e(i)},onReceiveMessage:(i,e)=>{e(i)},onReceiveHalfClose:i=>{i()},onCancel:()=>{}},va={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:va.start,sendMetadata:(n=t?.sendMetadata)!==null&&n!==void 0?n:va.sendMetadata,sendMessage:(s=t?.sendMessage)!==null&&s!==void 0?s:va.sendMessage,sendStatus:(a=t?.sendStatus)!==null&&a!==void 0?a:va.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:ma.onReceiveMetadata,onReceiveMessage:(n=t?.onReceiveMessage)!==null&&n!==void 0?n:ma.onReceiveMessage,onReceiveHalfClose:(s=t?.onReceiveHalfClose)!==null&&s!==void 0?s:ma.onReceiveHalfClose,onCancel:(a=t?.onCancel)!==null&&a!==void 0?a:ma.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 ya.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 xg="grpc-accept-encoding",hu="grpc-encoding",Ng="grpc-message",Pg="grpc-status",ou="grpc-timeout",TT=/(\d{1,8})\s*([HMSmun])/,bT={H:36e5,M:6e4,S:1e3,m:1,u:.001,n:1e-6},RT={[xg]:"identity,deflate,gzip",[hu]:"identity"},Ig={[mi.constants.HTTP2_HEADER_STATUS]:mi.constants.HTTP_STATUS_OK,[mi.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},wT={waitForTrailers:!0},_a=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=ke.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=ke.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 Ag.PerRequestMetricRecorder,this.stream.once("close",()=>{var f;Lr("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:ke.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 ET.StreamDecoder(this.maxReceiveMessageSize);let l=ya.Metadata.fromHttp2Headers(t);Mg.isTracerEnabled(kg)&&Lr("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(xg),l.remove(mi.constants.HTTP2_HEADER_ACCEPT_ENCODING),l.remove(mi.constants.HTTP2_HEADER_TE),l.remove(mi.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(TT);if(t===null){let s={code:ke.Status.INTERNAL,details:`Invalid ${ou} value "${e}"`,metadata:null};process.nextTick(()=>{this.sendStatus(s)});return}let r=+t[1]*bT[t[2]]|0,n=new Date;this.deadline=n.setMilliseconds(n.getMilliseconds()+r),this.deadlineTimer=setTimeout(()=>{let s={code:ke.Status.DEADLINE_EXCEEDED,details:"Deadline exceeded",metadata:null};this.sendStatus(s)},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 ya.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=Og.createInflate():n=Og.createGunzip(),new Promise((s,a)=>{let o=0,l=[];n.on("error",c=>{a({code:ke.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:ke.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:ke.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){this.sendStatus({code:ke.Status.INTERNAL,details:`Error deserializing request: ${s.message}`});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;Lr("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:ke.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){Lr("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({},Ig),RT),t);this.stream.respond(r,wT)}sendMessage(e,t){if(this.checkCancelled())return;let r;try{r=this.serializeMessage(e)}catch(n){this.sendStatus({code:ke.Status.INTERNAL,details:`Error serializing response: ${(0,wg.getErrorMessage)(n)}`,metadata:null});return}if(this.maxSendMessageSize!==-1&&r.length-5>this.maxSendMessageSize){this.sendStatus({code:ke.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${r.length} vs. ${this.maxSendMessageSize})`,metadata:null});return}this.maybeSendMetadata(),Lr("Request to "+this.handler.path+" sent data frame of size "+r.length),this.stream.write(r,n=>{var s;if(n){this.sendStatus({code:ke.Status.INTERNAL,details:`Error writing message: ${(0,wg.getErrorMessage)(n)}`,metadata:null});return}(s=this.callEventTracker)===null||s===void 0||s.addMessageSent(),t()})}sendStatus(e){var t,r,n;if(this.checkCancelled())return;Lr("Request to method "+((t=this.handler)===null||t===void 0?void 0:t.path)+" ended with status code: "+ke.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 ya.Metadata;if(this.shouldSendMetrics&&s.set(Ag.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({[Pg]:e.code,[Ng]: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({[Pg]:e.code,[Ng]:encodeURI(e.details)},Ig),s.toHttp2Headers());this.stream.respond(a,{endStream:!0}),this.notifyOnCancel()}}startRead(){Lr("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 ST.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=_a;function OT(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 _a(e,t,r,n,s);return i.reduce((l,c)=>c(a,l),o)}});var zg=g(dr=>{"use strict";var AT=dr&&dr.__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},NT=dr&&dr.__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(dr,"__esModule",{value:!0});dr.Server=void 0;var qe=z("http2"),PT=z("util"),oe=B(),_i=Eg(),pu=fa(),Dg=et(),yi=ee(),ur=De(),ft=Pe(),he=nr(),Lg=fu(),Ea=fc(),vi=~(1<<31),gu=~(1<<31),IT=2e4,Fg=~(1<<31),{HTTP2_HEADER_PATH:qg}=qe.constants,MT="server",Ug=Buffer.from("max_age");function Bg(i){yi.trace(oe.LogVerbosity.DEBUG,"server_call",i)}function kT(){}function xT(i){return function(e,t){return PT.deprecate(e,i)}}function mu(i){return{code:oe.Status.UNIMPLEMENTED,details:`The server does not implement the method ${i}`}}function DT(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 LT=(()=>{var i;let e=[],t;return i=class{constructor(n){var s,a,o,l,c,u;this.boundPorts=(AT(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:vi,this.maxConnectionAgeGraceMs=(a=this.options["grpc.max_connection_age_grace_ms"])!==null&&a!==void 0?a:vi,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:IT,this.sessionIdleTimeout=(c=this.options["grpc.max_connection_idle_ms"])!==null&&c!==void 0?c:Fg,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,ur.stringToSubchannelAddress)(c.remoteAddress,c.remotePort):null,h=c.localAddress?(0,ur.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){yi.trace(oe.LogVerbosity.DEBUG,MT,"("+this.channelzRef.id+") "+n)}keepaliveTrace(n){yi.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=DT(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,ur.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(_){yi.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,kT),this._setupHandlers(s,n._getInterceptors()),s}bindOneAddress(n,s){this.trace("Attempting to bind "+(0,ur.subchannelAddressToString)(n));let a=this.createHttp2Server(s.credentials);return new Promise((o,l)=>{let c=u=>{this.trace("Failed to bind "+(0,ur.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,ur.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,ur.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,ur.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&&yi.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 yi.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,Dg.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,ft.parseUri)(n);if(s===null)throw new Error(`Could not parse port "${n}"`);let a=(0,Dg.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,ft.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,ft.uriToString)(o),originalUri:o,completionPromise:null,cancelled:!1,portNumber:0,credentials:s,listeningServers:new Set};let u=(0,ft.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,ft.combineHostPort)({host:u.host,port:f})};c.mapKey=(0,ft.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,ft.splitHostPort)(s.path);if(a?.port===0)throw new Error("Cannot unbind port 0");let o=this.boundPorts.get((0,ft.uriToString)(s));o&&(this.trace("unbinding "+o.mapKey+" originally bound as "+(0,ft.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,ft.splitHostPort)(l.path);if(c?.port===0)throw new Error("Cannot drain port 0");let u=this.boundPorts.get((0,ft.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){Bg("Received call to method "+n+" at address "+this.serverAddressString);let s=this.handlers.get(n);return s===void 0?(Bg("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[qg],c=this._retrieveHandler(l);if(!c){this._respondWithError(mu(l),s,o);return}let u={addMessageSent:()=>{o&&(o.messagesSent+=1,o.lastMessageSentTimestamp=new Date)},addMessageReceived:()=>{o&&(o.messagesReceived+=1,o.lastMessageReceivedTimestamp=new Date)},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,Lg.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[qg],l=this._retrieveHandler(o);if(!l){this._respondWithError(mu(o),s,null);return}let c=(0,Lg.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")FT(n,s);else if(a==="clientStream")qT(n,s);else if(a==="serverStream")UT(n,s);else if(a==="bidi")BT(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!==vi){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),Ug)}catch{s.destroy();return}s.close(),this.maxConnectionAgeGraceMs!==vi&&(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!==vi){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),Ug)}catch{s.destroy();return}s.close(),this.maxConnectionAgeGraceMs!==vi&&(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>=Fg)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=[xT("Calling start() is no longer necessary. It can be safely omitted.")],NT(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})();dr.Server=LT;async function FT(i,e){let t;function r(a,o,l,c){if(a){i.sendStatus((0,_i.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 _i.ServerWritableStreamImpl(e.path,i,n,s);try{e.func(t,r)}catch(a){let o;Ea.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 qT(i,e){let t;function r(n,s,a,o){if(n){i.sendStatus((0,_i.serverErrorToStatus)(n,a));return}i.sendMessage(s,()=>{i.sendStatus({code:oe.Status.OK,details:"OK",metadata:a??null})})}i.start({onReceiveMetadata(n){t=new _i.ServerDuplexStreamImpl(e.path,i,n);try{e.func(t,r)}catch(s){let a;Ea.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 UT(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 _i.ServerWritableStreamImpl(e.path,i,r,n);try{e.func(t)}catch(s){let a;Ea.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 BT(i,e){let t;i.start({onReceiveMetadata(r){t=new _i.ServerDuplexStreamImpl(e.path,i,r);try{e.func(t)}catch(n){let s;Ea.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 Hg=g(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.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}};Sa.StatusBuilder=vu});var Cn=g(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.LeafLoadBalancer=Pt.PickFirstLoadBalancer=Pt.PickFirstLoadBalancingConfig=void 0;Pt.shuffled=$g;Pt.setup=YT;var yu=Yt(),le=Ie(),hr=kt(),jg=De(),zT=ee(),HT=B(),Wg=De(),Gg=z("net"),jT=_r(),WT="pick_first";function _n(i){zT.trace(HT.LogVerbosity.DEBUG,WT,i)}var En="pick_first",GT=250,Ei=class i{constructor(e){this.shuffleAddressList=e}getLoadBalancerName(){return En}toJsonObject(){return{[En]:{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=Ei;var _u=class{constructor(e){this.subchannel=e}pick(e){return{pickResultType:hr.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,onCallStarted:null,onCallEnded:null}}};function $g(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 $T(i){if(i.length===0)return[];let e=[],t=[],r=[],n=(0,Wg.isTcpSubchannelAddress)(i[0])&&(0,Gg.isIPv6)(i[0].host);for(let o of i)(0,Wg.isTcpSubchannelAddress)(o)&&(0,Gg.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 Vg="grpc-node.internal.pick-first.report_health_status",Sn=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 hr.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 hr.UnavailablePicker({details:t}),t)}else if(this.children.length===0)this.updateState(le.ConnectivityState.IDLE,new hr.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 hr.UnavailablePicker({details:t}),t)}else this.updateState(le.ConnectivityState.CONNECTING,new hr.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&&(_n("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)},GT),(r=(t=this.connectionDelayTimeout).unref)===null||r===void 0||r.call(t)}pickSubchannel(e){_n("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){_n(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){_n("connectToAddressList(["+e.map(n=>(0,jg.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 Ei))return!1;if(!e.ok)return this.children.length===0&&this.currentPick===null&&this.channelControlHelper.updateState(le.ConnectivityState.TRANSIENT_FAILURE,new hr.UnavailablePicker(e.error),e.error.details),!0;let s=e.value;this.reportHealthStatus=r[Vg],t.getShuffleAddressList()&&(s=$g(s));let a=[].concat(...s.map(l=>l.addresses));_n("updateAddressList(["+a.map(l=>(0,jg.subchannelAddressToString)(l))+"])");let o=$T(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 En}};Pt.PickFirstLoadBalancer=Sn;var VT=new Ei(!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 Sn(s),this.latestPicker=new hr.QueuePicker(this.pickFirstBalancer)}startConnecting(){this.pickFirstBalancer.updateAddressList((0,jT.statusOrFromValue)([this.endpoint]),VT,Object.assign(Object.assign({},this.options),{[Vg]:!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 YT(){(0,yu.registerLoadBalancerType)(En,Sn,Ei),(0,yu.registerDefaultLoadBalancerType)(En)}});var Yg=g(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.FileWatcherCertificateProvider=void 0;var KT=z("fs"),XT=ee(),JT=B(),QT=z("util"),ZT="certificate_provider";function Ca(i){XT.trace(JT.LogVerbosity.DEBUG,ZT,i)}var Su=(0,QT.promisify)(KT.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");Ca("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){Ca("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)}}),Ca("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),Ca("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()}};Ta.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 Kg=ee();Object.defineProperty(N,"trace",{enumerable:!0,get:function(){return Kg.trace}});Object.defineProperty(N,"log",{enumerable:!0,get:function(){return Kg.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 Xg=Pe();Object.defineProperty(N,"uriToString",{enumerable:!0,get:function(){return Xg.uriToString}});Object.defineProperty(N,"splitHostPort",{enumerable:!0,get:function(){return Xg.splitHostPort}});var Jg=yn();Object.defineProperty(N,"durationToMs",{enumerable:!0,get:function(){return Jg.durationToMs}});Object.defineProperty(N,"parseDuration",{enumerable:!0,get:function(){return Jg.parseDuration}});var eb=Wr();Object.defineProperty(N,"BackoffTimeout",{enumerable:!0,get:function(){return eb.BackoffTimeout}});var Tn=Yt();Object.defineProperty(N,"createChildChannelControlHelper",{enumerable:!0,get:function(){return Tn.createChildChannelControlHelper}});Object.defineProperty(N,"registerLoadBalancerType",{enumerable:!0,get:function(){return Tn.registerLoadBalancerType}});Object.defineProperty(N,"selectLbConfigFromList",{enumerable:!0,get:function(){return Tn.selectLbConfigFromList}});Object.defineProperty(N,"parseLoadBalancingConfig",{enumerable:!0,get:function(){return Tn.parseLoadBalancingConfig}});Object.defineProperty(N,"isLoadBalancerNameRegistered",{enumerable:!0,get:function(){return Tn.isLoadBalancerNameRegistered}});var tb=Cn();Object.defineProperty(N,"LeafLoadBalancer",{enumerable:!0,get:function(){return tb.LeafLoadBalancer}});var ba=De();Object.defineProperty(N,"subchannelAddressToString",{enumerable:!0,get:function(){return ba.subchannelAddressToString}});Object.defineProperty(N,"endpointToString",{enumerable:!0,get:function(){return ba.endpointToString}});Object.defineProperty(N,"endpointHasAddress",{enumerable:!0,get:function(){return ba.endpointHasAddress}});Object.defineProperty(N,"EndpointMap",{enumerable:!0,get:function(){return ba.EndpointMap}});var rb=Xn();Object.defineProperty(N,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return rb.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 Qg=_r();Object.defineProperty(N,"statusOrFromValue",{enumerable:!0,get:function(){return Qg.statusOrFromValue}});Object.defineProperty(N,"statusOrFromError",{enumerable:!0,get:function(){return Qg.statusOrFromError}});var ib=Zl();Object.defineProperty(N,"BaseFilter",{enumerable:!0,get:function(){return ib.BaseFilter}});var nb=Vs();Object.defineProperty(N,"FilterStackFactory",{enumerable:!0,get:function(){return nb.FilterStackFactory}});var sb=es();Object.defineProperty(N,"registerAdminService",{enumerable:!0,get:function(){return sb.registerAdminService}});var ab=gn();Object.defineProperty(N,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return ab.BaseSubchannelWrapper}});var Zg=fa();Object.defineProperty(N,"createServerCredentialsWithInterceptors",{enumerable:!0,get:function(){return Zg.createServerCredentialsWithInterceptors}});Object.defineProperty(N,"createCertificateProviderServerCredentials",{enumerable:!0,get:function(){return Zg.createCertificateProviderServerCredentials}});var ob=Yg();Object.defineProperty(N,"FileWatcherCertificateProvider",{enumerable:!0,get:function(){return ob.FileWatcherCertificateProvider}});var lb=jr();Object.defineProperty(N,"createCertificateProviderChannelCredentials",{enumerable:!0,get:function(){return lb.createCertificateProviderChannelCredentials}});var cb=zc();Object.defineProperty(N,"SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX",{enumerable:!0,get:function(){return cb.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX}})});var em=g(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.setup=hb;var ub=et(),db=_r(),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,db.statusOrFromValue)(this.endpoints),{},null,""))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return"localhost"}};function hb(){(0,ub.registerResolver)("unix",wu)}});var am=g(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.setup=vb;var tm=z("net"),rm=_r(),Ra=B(),Au=pe(),im=et(),fb=De(),nm=Pe(),pb=ee(),gb="ip_resolver";function sm(i){pb.trace(Ra.LogVerbosity.DEBUG,gb,i)}var Nu="ipv4",Pu="ipv6",mb=443,wa=class{constructor(e,t,r){var n;this.listener=t,this.endpoints=[],this.error=null,this.hasReturnedResult=!1,sm("Resolver constructed for target "+(0,nm.uriToString)(e));let s=[];if(!(e.scheme===Nu||e.scheme===Pu)){this.error={code:Ra.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,nm.splitHostPort)(o);if(l===null){this.error={code:Ra.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${o}`,metadata:new Au.Metadata};return}if(e.scheme===Nu&&!(0,tm.isIPv4)(l.host)||e.scheme===Pu&&!(0,tm.isIPv6)(l.host)){this.error={code:Ra.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:mb})}this.endpoints=s.map(o=>({addresses:[o]})),sm("Parsed "+e.scheme+" address list "+s.map(fb.subchannelAddressToString))}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(()=>{this.error?this.listener((0,rm.statusOrFromError)(this.error),{},null,""):this.listener((0,rm.statusOrFromValue)(this.endpoints),{},null,"")}))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return e.path.split(",")[0]}};function vb(){(0,im.registerResolver)(Nu,wa),(0,im.registerResolver)(Pu,wa)}});var um=g(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.RoundRobinLoadBalancer=void 0;Rn.setup=Tb;var cm=Yt(),Te=Ie(),bn=kt(),yb=ee(),_b=B(),om=De(),Eb=Cn(),Sb="round_robin";function lm(i){yb.trace(_b.LogVerbosity.DEBUG,Sb,i)}var Oa="round_robin",Aa=class i{getLoadBalancerName(){return Oa}constructor(){}toJsonObject(){return{[Oa]:{}}}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 Cb(i,e){return[...i.slice(e),...i.slice(0,e)]}var Na=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,cm.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,om.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 bn.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 bn.UnavailablePicker({details:e}),e)}else this.updateState(Te.ConnectivityState.IDLE,new bn.QueuePicker(this),null);for(let e of this.children)e.getConnectivityState()===Te.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,t,r){lm(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 Aa))return!1;if(!e.ok)return this.children.length===0&&this.updateState(Te.ConnectivityState.TRANSIENT_FAILURE,new bn.UnavailablePicker(e.error),e.error.details),!0;let s=Math.random()*e.value.length|0,a=Cb(e.value,s);if(this.resetSubchannelList(),a.length===0){let o=`No addresses resolved. Resolution note: ${n}`;this.updateState(Te.ConnectivityState.TRANSIENT_FAILURE,new bn.UnavailablePicker({details:o}),o)}lm("Connect to endpoint list "+a.map(om.endpointToString)),this.updatesPaused=!0,this.children=a.map(o=>new Eb.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 Oa}};Rn.RoundRobinLoadBalancer=Na;function Tb(){(0,cm.registerLoadBalancerType)(Oa,Na,Aa)}});var fm=g(qr=>{"use strict";var ku;Object.defineProperty(qr,"__esModule",{value:!0});qr.OutlierDetectionLoadBalancer=qr.OutlierDetectionLoadBalancingConfig=void 0;qr.setup=xb;var bb=Ie(),dm=B(),Fr=yn(),hm=Ru(),Rb=Yt(),wb=Xn(),Ob=kt(),xu=De(),Ab=gn(),Nb=ee(),Pb="outlier_detection";function ye(i){Nb.trace(dm.LogVerbosity.DEBUG,Pb,i)}var Bu="outlier_detection",Ib=((ku=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)!==null&&ku!==void 0?ku:"true")==="true",Mb={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},kb={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function Si(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,Fr.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 Pa(i,e,t){let r=t?`${t}.${e}`:e;if(Si(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 wn=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({},Mb),s):null,this.failurePercentageEjection=a?Object.assign(Object.assign({},kb),a):null}getLoadBalancerName(){return Bu}toJsonObject(){var e,t;return{outlier_detection:{interval:(0,Fr.msToDuration)(this.intervalMs),base_ejection_time:(0,Fr.msToDuration)(this.baseEjectionTimeMs),max_ejection_time:(0,Fr.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"),Pa(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");Si(e.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),Pa(e.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),Si(e.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),Si(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");Pa(e.failure_percentage_ejection,"threshold","failure_percentage_ejection"),Pa(e.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),Si(e.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),Si(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,Rb.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,Fr.durationToMs)(e.interval):null,e.base_ejection_time?(0,Fr.durationToMs)(e.base_ejection_time):null,e.max_ejection_time?(0,Fr.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)}};qr.OutlierDetectionLoadBalancingConfig=wn;var Fu=class extends Ab.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===Ob.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===dm.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}},Ia=class{constructor(e){this.entryMap=new xu.EndpointMap,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new wb.ChildLoadBalancerHandler((0,hm.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===bb.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 wn))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}};qr.OutlierDetectionLoadBalancer=Ia;function xb(){Ib&&(0,hm.registerLoadBalancerType)(Bu,Ia,wn)}});var pm=g(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});ka.PriorityQueue=void 0;var Ci=0,zu=i=>Math.floor(i/2),Ma=i=>i*2+1,On=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[Ci]}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>Ci&&this.swap(Ci,t),this.heap.pop(),this.siftDown(),e}replace(e){let t=this.peek();return this.heap[Ci]=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>Ci&&this.greater(e,zu(e));)this.swap(e,zu(e)),e=zu(e)}siftDown(){let e=Ci;for(;Ma(e)<this.size()&&this.greater(Ma(e),e)||On(e)<this.size()&&this.greater(On(e),e);){let t=On(e)<this.size()&&this.greater(On(e),Ma(e))?On(e):Ma(e);this.swap(e,t),e=t}}};ka.PriorityQueue=Hu});var _m=g(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.WeightedRoundRobinLoadBalancingConfig=void 0;Nn.setup=Gb;var _e=Ie(),Db=B(),Ge=yn(),vm=Yt(),Lb=Cn(),Fb=ee(),ym=ga(),Ti=kt(),qb=pm(),gm=De(),Ub="weighted_round_robin";function ju(i){Fb.trace(Db.LogVerbosity.DEBUG,Ub,i)}var $u="weighted_round_robin",Bb=1e4,zb=1e4,Hb=3*6e4,jb=1e3,Wb=1;function mm(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 xa(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 An=class i{constructor(e,t,r,n,s,a){this.enableOobLoadReport=e??!1,this.oobLoadReportingPeriodMs=t??Bb,this.blackoutPeriodMs=r??zb,this.weightExpirationPeriodMs=n??Hb,this.weightUpdatePeriodMs=Math.max(s??jb,100),this.errorUtilizationPenalty=a??Wb}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(mm(e,"enable_oob_load_report","boolean"),mm(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,xa(e,"oob_load_reporting_period"),xa(e,"blackout_period"),xa(e,"weight_expiration_period"),xa(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}};Nn.WeightedRoundRobinLoadBalancingConfig=An;var Wu=class{constructor(e,t){this.metricsHandler=t,this.queue=new qb.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===Ti.PickResultType.COMPLETE){if(this.metricsHandler)return Object.assign(Object.assign({},r),{onCallEnded:(0,ym.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 Ti.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 Ti.UnavailablePicker({details:e}),e)}else this.updateState(_e.ConnectivityState.IDLE,new Ti.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 An))return!1;if(!e.ok)return this.children.size===0&&this.updateState(_e.ConnectivityState.TRANSIENT_FAILURE,new Ti.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 Ti.UnavailablePicker({details:c}),c),!1}ju("Connect to endpoint list "+e.value.map(gm.endpointToString));let o=new Date,l=new Set;this.updatesPaused=!0,this.latestConfig=t;for(let c of e.value){let u=(0,gm.endpointToString)(c);l.add(u);let h=this.children.get(u);h||(h={child:new Lb.LeafLoadBalancer(c,(0,vm.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 ym.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 Gb(){(0,vm.registerLoadBalancerType)($u,Gu,An)}});var bi=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 Da=Un();Object.defineProperty(A,"CallCredentials",{enumerable:!0,get:function(){return Da.CallCredentials}});var $b=xo();Object.defineProperty(A,"Channel",{enumerable:!0,get:function(){return $b.ChannelImplementation}});var Vb=Jl();Object.defineProperty(A,"compressionAlgorithms",{enumerable:!0,get:function(){return Vb.CompressionAlgorithms}});var Yb=Ie();Object.defineProperty(A,"connectivityState",{enumerable:!0,get:function(){return Yb.ConnectivityState}});var La=jr();Object.defineProperty(A,"ChannelCredentials",{enumerable:!0,get:function(){return La.ChannelCredentials}});var Em=ko();Object.defineProperty(A,"Client",{enumerable:!0,get:function(){return Em.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 Sm=ee(),Yu=ss();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 Kb=pe();Object.defineProperty(A,"Metadata",{enumerable:!0,get:function(){return Kb.Metadata}});var Xb=zg();Object.defineProperty(A,"Server",{enumerable:!0,get:function(){return Xb.Server}});var Jb=fa();Object.defineProperty(A,"ServerCredentials",{enumerable:!0,get:function(){return Jb.ServerCredentials}});var Qb=Hg();Object.defineProperty(A,"StatusBuilder",{enumerable:!0,get:function(){return Qb.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:La.ChannelCredentials.createInsecure,createSsl:La.ChannelCredentials.createSsl,createFromSecureContext:La.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:Da.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:Da.CallCredentials.createFromGoogleCredential,createEmpty:Da.CallCredentials.createEmpty};var Zb=i=>i.close();A.closeClient=Zb;var eR=(i,e,t)=>i.waitForReady(e,t);A.waitForClientReady=eR;var tR=(i,e)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};A.loadObject=tR;var rR=(i,e,t)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};A.load=rR;var iR=i=>{Sm.setLogger(i)};A.setLogger=iR;var nR=i=>{Sm.setLoggerVerbosity(i)};A.setLogVerbosity=nR;var sR=i=>Em.Client.prototype.getChannel.call(i);A.getClientChannel=sR;var Fa=Po();Object.defineProperty(A,"ListenerBuilder",{enumerable:!0,get:function(){return Fa.ListenerBuilder}});Object.defineProperty(A,"RequesterBuilder",{enumerable:!0,get:function(){return Fa.RequesterBuilder}});Object.defineProperty(A,"InterceptingCall",{enumerable:!0,get:function(){return Fa.InterceptingCall}});Object.defineProperty(A,"InterceptorConfigurationError",{enumerable:!0,get:function(){return Fa.InterceptorConfigurationError}});var Cm=nr();Object.defineProperty(A,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return Cm.getChannelzServiceDefinition}});Object.defineProperty(A,"getChannelzHandlers",{enumerable:!0,get:function(){return Cm.getChannelzHandlers}});var aR=es();Object.defineProperty(A,"addAdminServicesToServer",{enumerable:!0,get:function(){return aR.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 oR=ga();Object.defineProperty(A,"ServerMetricRecorder",{enumerable:!0,get:function(){return oR.ServerMetricRecorder}});var lR=Ru();A.experimental=lR;var cR=vc(),uR=em(),dR=am(),hR=Cn(),fR=um(),pR=fm(),gR=_m(),mR=nr();cR.setup(),uR.setup(),dR.setup(),hR.setup(),fR.setup(),pR.setup(),gR.setup(),mR.setup()});var Tm=g(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});qa.createServiceClientConstructor=void 0;var vR=bi();function yR(i,e){let t={export:{path:i,requestStream:!1,responseStream:!1,requestSerialize:r=>r,requestDeserialize:r=>r,responseSerialize:r=>r,responseDeserialize:r=>r}};return vR.makeGenericClientConstructor(t,e)}qa.createServiceClientConstructor=yR});var Ri=g(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.createOtlpGrpcExporterTransport=Ze.GrpcExporterTransport=Ze.createEmptyMetadata=Ze.createSslCredentials=Ze.createInsecureCredentials=void 0;var _R=id(),bm=`OTel-OTLP-Exporter-JavaScript/${_R.VERSION}`;function ER(i){return i?`${i} ${bm}`:bm}var SR=0,CR=2,TR=4,bR=5;function RR(i){return i==="gzip"?CR:SR}function wR(){let{credentials:i}=bi();return i.createInsecure()}Ze.createInsecureCredentials=wR;function OR(i,e,t){let{credentials:r}=bi();return r.createSsl(i,e,t)}Ze.createSslCredentials=OR;function AR(){let{Metadata:i}=bi();return new i}Ze.createEmptyMetadata=AR;var Ua=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}=Tm();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":RR(this._parameters.compression),"grpc.primary_user_agent":ER(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===TR&&(this._deadlineExceededCount++,this._deadlineExceededCount>bR&&(this._client?.close(),this._client=void 0))):(n({data:o,status:"success"}),this._deadlineExceededCount=0)})})}};Ze.GrpcExporterTransport=Ua;function NR(i){return new Ua(i)}Ze.createOtlpGrpcExporterTransport=NR});var Nm=g(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.getOtlpGrpcDefaultConfiguration=fr.mergeOtlpGrpcConfigurationWithDefaults=fr.validateAndNormalizeUrl=void 0;var Om=(rd(),pr(td)),Pn=Ri(),PR=z("url"),Rm=(ed(),pr(Zu));function Am(i){i=i.trim(),i.match(/^([\w]{1,8}):\/\//)||(i=`https://${i}`);let t=new PR.URL(i);return t.protocol==="unix:"?i:(t.pathname&&t.pathname!=="/"&&Rm.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?:$/)&&Rm.diag.warn("URL protocol should be http(s)://. Using http://."),t.host)}fr.validateAndNormalizeUrl=Am;function wm(i,e){for(let[t,r]of Object.entries(e.getMap()))i.get(t).length<1&&i.set(t,r)}function IR(i,e,t){let r=i.url??e.url??t.url;return{...(0,Om.mergeOtlpSharedConfigurationWithDefaults)(i,e,t),metadata:()=>{let n=t.metadata();return wm(n,i.metadata?.().clone()??(0,Pn.createEmptyMetadata)()),wm(n,e.metadata?.()??(0,Pn.createEmptyMetadata)()),n},url:Am(r),credentials:i.credentials??e.credentials?.(r)??t.credentials(r),userAgent:i.userAgent}}fr.mergeOtlpGrpcConfigurationWithDefaults=IR;function MR(){return{...(0,Om.getSharedConfigurationDefaults)(),metadata:()=>(0,Pn.createEmptyMetadata)(),url:"http://localhost:4317",credentials:i=>i.startsWith("http://")?()=>(0,Pn.createInsecureCredentials)():()=>(0,Pn.createSslCredentials)()}}fr.getOtlpGrpcDefaultConfiguration=MR});var xm=g(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.getOtlpGrpcConfigurationFromEnv=void 0;var Pm=(Km(),pr(Ym)),In=Ri(),kR=(Jm(),pr(Xm)),xR=z("fs"),DR=z("path"),Mm=(ed(),pr(Zu));function Xu(i,e){if(i!=null&&i!=="")return i;if(e!=null&&e!=="")return e}function LR(i){let e=process.env[`OTEL_EXPORTER_OTLP_${i}_HEADERS`]?.trim(),t=process.env.OTEL_EXPORTER_OTLP_HEADERS?.trim(),r=(0,Pm.parseKeyPairsIntoRecord)(e),n=(0,Pm.parseKeyPairsIntoRecord)(t);if(Object.keys(r).length===0&&Object.keys(n).length===0)return;let s=Object.assign({},n,r),a=(0,In.createEmptyMetadata)();for(let[o,l]of Object.entries(s))a.set(o,l);return a}function FR(i){let e=LR(i);if(e!=null)return()=>e}function qR(i){let e=process.env[`OTEL_EXPORTER_OTLP_${i}_ENDPOINT`]?.trim(),t=process.env.OTEL_EXPORTER_OTLP_ENDPOINT?.trim();return Xu(e,t)}function UR(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 xR.readFileSync(DR.resolve(process.cwd(),s))}catch{Mm.diag.warn(t);return}else return}function BR(i){return Ju(`OTEL_EXPORTER_OTLP_${i}_CLIENT_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE","Failed to read client certificate chain file")}function zR(i){return Ju(`OTEL_EXPORTER_OTLP_${i}_CLIENT_KEY`,"OTEL_EXPORTER_OTLP_CLIENT_KEY","Failed to read client certificate private key file")}function Im(i){return Ju(`OTEL_EXPORTER_OTLP_${i}_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CERTIFICATE","Failed to read root certificate file")}function km(i){let e=zR(i),t=BR(i),r=Im(i),n=e!=null&&t!=null;return r!=null&&!n?(Mm.diag.warn("Client key and certificate must both be provided, but one was missing - attempting to create credentials from just the root certificate"),(0,In.createSslCredentials)(Im(i))):(0,In.createSslCredentials)(r,e,t)}function HR(i){return UR(i)?(0,In.createInsecureCredentials)():km(i)}function jR(i){return{...(0,kR.getSharedConfigurationFromEnvironment)(i),metadata:FR(i),url:qR(i),credentials:e=>e.startsWith("http://")?()=>(0,In.createInsecureCredentials)():e.startsWith("https://")?()=>km(i):()=>HR(i)}}Ba.getOtlpGrpcConfigurationFromEnv=jR});var Lm=g(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});za.convertLegacyOtlpGrpcOptions=void 0;var Dm=Nm(),WR=Ri(),GR=xm();function $R(i,e){let t=i.credentials;return(0,Dm.mergeOtlpGrpcConfigurationWithDefaults)({url:i.url,metadata:()=>i.metadata??(0,WR.createEmptyMetadata)(),compression:i.compression,timeoutMillis:i.timeoutMillis,concurrencyLimit:i.concurrencyLimit,credentials:t!=null?()=>t:void 0,userAgent:i.userAgent},(0,GR.getOtlpGrpcConfigurationFromEnv)(e),(0,Dm.getOtlpGrpcDefaultConfiguration)())}za.convertLegacyOtlpGrpcOptions=$R});var Fm=g(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.ATTR_RPC_RESPONSE_STATUS_CODE=void 0;Ha.ATTR_RPC_RESPONSE_STATUS_CODE="rpc.response.status_code"});var zm=g(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.createOtlpGrpcExportDelegate=wi.createOtlpGrpcExporterMetrics=void 0;var Um=(rd(),pr(td)),VR=Ri(),qm=Fm();function Bm(i,e,t,r){return new Um.ExporterMetrics({componentType:i,metricsHelper:e,url:t,meterProvider:r,responseAttributesFromError:n=>{if(!n)return{[qm.ATTR_RPC_RESPONSE_STATUS_CODE]:"OK"};if(!KR(n))return{};let{status:s}=bi(),a=s[n.code]??"UNKNOWN";return{[qm.ATTR_RPC_RESPONSE_STATUS_CODE]:a}}})}wi.createOtlpGrpcExporterMetrics=Bm;function YR(i,e,t,r,n,s,a){return(0,Um.createOtlpNetworkExportDelegate)(i,e,Bm(t,r,i.url,n),(0,VR.createOtlpGrpcExporterTransport)({address:i.url,compression:i.compression,credentials:i.credentials,metadata:i.metadata,userAgent:i.userAgent,grpcName:s,grpcPath:a}))}wi.createOtlpGrpcExportDelegate=YR;function KR(i){return typeof i=="object"&&i!==null&&"code"in i&&typeof i.code=="number"}});var JR=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 XR=Lm();Object.defineProperty(Ue,"convertLegacyOtlpGrpcOptions",{enumerable:!0,get:function(){return XR.convertLegacyOtlpGrpcOptions}});var Hm=zm();Object.defineProperty(Ue,"createOtlpGrpcExportDelegate",{enumerable:!0,get:function(){return Hm.createOtlpGrpcExportDelegate}});Object.defineProperty(Ue,"createOtlpGrpcExporterMetrics",{enumerable:!0,get:function(){return Hm.createOtlpGrpcExporterMetrics}});var Qu=Ri();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{JR 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
+ */