diff --git a/.github/workflows/bazel-my-cache.yaml b/.github/workflows/bazel-my-cache.yaml index 4113f4f..7b9de29 100644 --- a/.github/workflows/bazel-my-cache.yaml +++ b/.github/workflows/bazel-my-cache.yaml @@ -19,4 +19,4 @@ jobs: uses: ./ - name: bazel build - run: bazelisk build --remote_cache=http://localhost:3055 //... + run: bazelisk build --remote_cache=grpcs://localhost:4000 //... diff --git a/BUILD.bazel b/BUILD.bazel index 22568ee..9fb8a74 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -2,6 +2,7 @@ load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files") load("@aspect_rules_esbuild//esbuild:defs.bzl", "esbuild") load("@aspect_rules_ts//ts:defs.bzl", "ts_project") load("@npm//:defs.bzl", "npm_link_all_packages") +load("//:node_modules/protoc-gen-ts/index.bzl", "ts_proto_library") npm_link_all_packages(name = "node_modules") @@ -9,12 +10,16 @@ ts_project( name = "main", srcs = [ "src/ActionsCache.ts", + "src/GrpcServer_patched.ts", "src/HttpServer.ts", - "src/main.ts", + "src/main_patched.ts", ], + declaration = True, deps = [ + ":remote_execution_ts", "//:node_modules/@actions/core", "//:node_modules/@actions/http-client", + "//:node_modules/@grpc/grpc-js", "//:node_modules/@types/node", ], ) @@ -22,7 +27,7 @@ ts_project( esbuild( name = "main_bundle", srcs = [":main"], - entry_point = "src/main.js", + entry_point = "src/main_patched.js", minify = True, platform = "node", sourcemap = "external", @@ -32,3 +37,67 @@ write_source_files( name = "dist", files = {"dist/main.js": ":main_bundle.js"}, ) + +genrule( + name = "patch_bazel-bin", + srcs = ["src/GrpcServer.ts"], + outs = ["src/GrpcServer_patched.ts"], + cmd = "cat $< | sed -e 's!bazel-bin/!!' > $@", +) + +genrule( + name = "patch2", + srcs = ["src/main.ts"], + outs = ["src/main_patched.ts"], + cmd = "cat $< | sed -e 's/GrpcServer/GrpcServer_patched/' > $@", +) + +ts_proto_library( + name = "remote_execution_ts_proto", + outs = [ + "build/bazel/remote/execution/v2/remote_execution.ts", + "build/bazel/semver/semver.ts", + "google/api/annotations.ts", + "google/api/http.ts", + "google/longrunning/operations.ts", + "google/protobuf/any.ts", + "google/protobuf/descriptor.ts", + "google/protobuf/duration.ts", + "google/protobuf/empty.ts", + "google/protobuf/timestamp.ts", + "google/protobuf/wrappers.ts", + "google/rpc/status.ts", + ], + deps = [ + "@remote_apis//build/bazel/remote/execution/v2:remote_execution_proto", + ], +) + +ts_project( + name = "remote_execution_ts", + srcs = [ + "build/bazel/remote/execution/v2/remote_execution.ts", + "build/bazel/semver/semver.ts", + "google/api/annotations.ts", + "google/api/http.ts", + "google/longrunning/operations.ts", + "google/protobuf/any.ts", + "google/protobuf/descriptor.ts", + "google/protobuf/duration.ts", + "google/protobuf/empty.ts", + "google/protobuf/timestamp.ts", + "google/protobuf/wrappers.ts", + "google/rpc/status.ts", + ], + declaration = True, + extends = "tsconfig.json", + tsconfig = { + "compilerOptions": { + "strict": False, + }, + }, + deps = [ + "//:node_modules/@grpc/grpc-js", + "//:node_modules/@types/google-protobuf", + ], +) diff --git a/WORKSPACE b/WORKSPACE index 4dc5628..6bf52fa 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -95,3 +95,30 @@ esbuild_register_toolchains( name = "esbuild", esbuild_version = LATEST_VERSION, ) + +http_archive( + name = "com_github_grpc_grpc", + sha256 = "b391a327429279f6f29b9ae7e5317cd80d5e9d49cc100e6d682221af73d984a6", + strip_prefix = "grpc-93e8830070e9afcbaa992c75817009ee3f4b63a0", # v1.24.3 with fixes + urls = ["https://github.com/grpc/grpc/archive/93e8830070e9afcbaa992c75817009ee3f4b63a0.zip"], +) + +# Pull in all gRPC dependencies. +load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") + +grpc_deps() + +http_archive( + name = "remote_apis", + sha256 = "d242ff05ab0fe97a8d4c75cef0a518701abf6c01093050108553a0b60c931f68", + strip_prefix = "remote-apis-3a21deee813d0b98aaeef9737c720e509e10dc8b", + url = "https://github.com/bazelbuild/remote-apis/archive/3a21deee813d0b98aaeef9737c720e509e10dc8b.zip", +) + +http_archive( + name = "googleapis", + build_file = "@remote_apis//:external/BUILD.googleapis", + sha256 = "7b6ea252f0b8fb5cd722f45feb83e115b689909bbb6a393a873b6cbad4ceae1d", + strip_prefix = "googleapis-143084a2624b6591ee1f9d23e7f5241856642f4d", + urls = ["https://github.com/googleapis/googleapis/archive/143084a2624b6591ee1f9d23e7f5241856642f4d.zip"], +) diff --git a/dist/main.js b/dist/main.js index 6803073..89c2827 100755 --- a/dist/main.js +++ b/dist/main.js @@ -1,8 +1,59 @@ -"use strict";var Xt=Object.create;var F=Object.defineProperty,Zt=Object.defineProperties,er=Object.getOwnPropertyDescriptor,tr=Object.getOwnPropertyDescriptors,rr=Object.getOwnPropertyNames,Ge=Object.getOwnPropertySymbols,nr=Object.getPrototypeOf,He=Object.prototype.hasOwnProperty,ir=Object.prototype.propertyIsEnumerable;var Je=(e,t,r)=>t in e?F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ke=(e,t)=>{for(var r in t||(t={}))He.call(t,r)&&Je(e,r,t[r]);if(Ge)for(var r of Ge(t))ir.call(t,r)&&Je(e,r,t[r]);return e},ze=(e,t)=>Zt(e,tr(t));var We=(e,t)=>()=>(e&&(t=e(e=0)),t);var _=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ye=(e,t)=>{for(var r in t)F(e,r,{get:t[r],enumerable:!0})},Qe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rr(t))!He.call(e,i)&&i!==r&&F(e,i,{get:()=>t[i],enumerable:!(n=er(t,i))||n.enumerable});return e};var de=(e,t,r)=>(r=e!=null?Xt(nr(e)):{},Qe(t||!e||!e.__esModule?F(r,"default",{value:e,enumerable:!0}):r,e)),Xe=e=>Qe(F({},"__esModule",{value:!0}),e);var I=(e,t,r)=>new Promise((n,i)=>{var s=u=>{try{c(r.next(u))}catch(a){i(a)}},o=u=>{try{c(r.throw(u))}catch(a){i(a)}},c=u=>u.done?n(u.value):Promise.resolve(u.value).then(s,o);c((r=r.apply(e,t)).next())});var H=_(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.toCommandProperties=B.toCommandValue=void 0;function sr(e){return e==null?"":typeof e=="string"||e instanceof String?e:JSON.stringify(e)}B.toCommandValue=sr;function or(e){return Object.keys(e).length?{title:e.title,file:e.file,line:e.startLine,endLine:e.endLine,col:e.startColumn,endColumn:e.endColumn}:{}}B.toCommandProperties=or});var rt=_(b=>{"use strict";var ar=b&&b.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ur=b&&b.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),cr=b&&b.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&ar(t,e,r);return ur(t,e),t};Object.defineProperty(b,"__esModule",{value:!0});b.issue=b.issueCommand=void 0;var lr=cr(require("os")),et=H();function tt(e,t,r){let n=new he(e,t,r);process.stdout.write(n.toString()+lr.EOL)}b.issueCommand=tt;function fr(e,t=""){tt(e,{},t)}b.issue=fr;var Ze="::",he=class{constructor(t,r,n){t||(t="missing.command"),this.command=t,this.properties=r,this.message=n}toString(){let t=Ze+this.command;if(this.properties&&Object.keys(this.properties).length>0){t+=" ";let r=!0;for(let n in this.properties)if(this.properties.hasOwnProperty(n)){let i=this.properties[n];i&&(r?r=!1:t+=",",t+=`${n}=${hr(i)}`)}}return t+=`${Ze}${dr(this.message)}`,t}};function dr(e){return et.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function hr(e){return et.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}});var _e=_(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.default=vr;var pr=_r(require("crypto"));function _r(e){return e&&e.__esModule?e:{default:e}}var z=new Uint8Array(256),K=z.length;function vr(){return K>z.length-16&&(pr.default.randomFillSync(z),K=0),z.slice(K,K+=16)}});var nt=_(W=>{"use strict";Object.defineProperty(W,"__esModule",{value:!0});W.default=void 0;var mr=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;W.default=mr});var G=_(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.default=void 0;var gr=yr(nt());function yr(e){return e&&e.__esModule?e:{default:e}}function wr(e){return typeof e=="string"&&gr.default.test(e)}var Or=wr;Y.default=Or});var J=_(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.default=void 0;var br=Rr(G());function Rr(e){return e&&e.__esModule?e:{default:e}}var m=[];for(let e=0;e<256;++e)m.push((e+256).toString(16).substr(1));function Sr(e,t=0){let r=(m[e[t+0]]+m[e[t+1]]+m[e[t+2]]+m[e[t+3]]+"-"+m[e[t+4]]+m[e[t+5]]+"-"+m[e[t+6]]+m[e[t+7]]+"-"+m[e[t+8]]+m[e[t+9]]+"-"+m[e[t+10]]+m[e[t+11]]+m[e[t+12]]+m[e[t+13]]+m[e[t+14]]+m[e[t+15]]).toLowerCase();if(!(0,br.default)(r))throw TypeError("Stringified UUID is invalid");return r}var Pr=Sr;Q.default=Pr});var ot=_(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.default=void 0;var Er=st(_e()),qr=st(J());function st(e){return e&&e.__esModule?e:{default:e}}var it,ve,me=0,ge=0;function Tr(e,t,r){let n=t&&r||0,i=t||new Array(16);e=e||{};let s=e.node||it,o=e.clockseq!==void 0?e.clockseq:ve;if(s==null||o==null){let h=e.random||(e.rng||Er.default)();s==null&&(s=it=[h[0]|1,h[1],h[2],h[3],h[4],h[5]]),o==null&&(o=ve=(h[6]<<8|h[7])&16383)}let c=e.msecs!==void 0?e.msecs:Date.now(),u=e.nsecs!==void 0?e.nsecs:ge+1,a=c-me+(u-ge)/1e4;if(a<0&&e.clockseq===void 0&&(o=o+1&16383),(a<0||c>me)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");me=c,ge=u,ve=o,c+=122192928e5;let l=((c&268435455)*1e4+u)%4294967296;i[n++]=l>>>24&255,i[n++]=l>>>16&255,i[n++]=l>>>8&255,i[n++]=l&255;let d=c/4294967296*1e4&268435455;i[n++]=d>>>8&255,i[n++]=d&255,i[n++]=d>>>24&15|16,i[n++]=d>>>16&255,i[n++]=o>>>8|128,i[n++]=o&255;for(let h=0;h<6;++h)i[n+h]=s[h];return t||(0,qr.default)(i)}var Ar=Tr;X.default=Ar});var ye=_(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.default=void 0;var Cr=Mr(G());function Mr(e){return e&&e.__esModule?e:{default:e}}function Ur(e){if(!(0,Cr.default)(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}var xr=Ur;Z.default=xr});var we=_(D=>{"use strict";Object.defineProperty(D,"__esModule",{value:!0});D.default=Br;D.URL=D.DNS=void 0;var Dr=at(J()),Nr=at(ye());function at(e){return e&&e.__esModule?e:{default:e}}function Ir(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.default=void 0;var $r=Lr(require("crypto"));function Lr(e){return e&&e.__esModule?e:{default:e}}function kr(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),$r.default.createHash("md5").update(e).digest()}var jr=kr;ee.default=jr});var dt=_(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.default=void 0;var Vr=ft(we()),Fr=ft(lt());function ft(e){return e&&e.__esModule?e:{default:e}}var Gr=(0,Vr.default)("v3",48,Fr.default),Jr=Gr;te.default=Jr});var pt=_(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.default=void 0;var Hr=ht(_e()),Kr=ht(J());function ht(e){return e&&e.__esModule?e:{default:e}}function zr(e,t,r){e=e||{};let n=e.random||(e.rng||Hr.default)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return(0,Kr.default)(n)}var Wr=zr;re.default=Wr});var _t=_(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.default=void 0;var Yr=Qr(require("crypto"));function Qr(e){return e&&e.__esModule?e:{default:e}}function Xr(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),Yr.default.createHash("sha1").update(e).digest()}var Zr=Xr;ne.default=Zr});var mt=_(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.default=void 0;var en=vt(we()),tn=vt(_t());function vt(e){return e&&e.__esModule?e:{default:e}}var rn=(0,en.default)("v5",80,tn.default),nn=rn;ie.default=nn});var gt=_(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.default=void 0;var sn="00000000-0000-0000-0000-000000000000";se.default=sn});var yt=_(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.default=void 0;var on=an(G());function an(e){return e&&e.__esModule?e:{default:e}}function un(e){if(!(0,on.default)(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}var cn=un;oe.default=cn});var wt=_(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});Object.defineProperty(P,"v1",{enumerable:!0,get:function(){return ln.default}});Object.defineProperty(P,"v3",{enumerable:!0,get:function(){return fn.default}});Object.defineProperty(P,"v4",{enumerable:!0,get:function(){return dn.default}});Object.defineProperty(P,"v5",{enumerable:!0,get:function(){return hn.default}});Object.defineProperty(P,"NIL",{enumerable:!0,get:function(){return pn.default}});Object.defineProperty(P,"version",{enumerable:!0,get:function(){return _n.default}});Object.defineProperty(P,"validate",{enumerable:!0,get:function(){return vn.default}});Object.defineProperty(P,"stringify",{enumerable:!0,get:function(){return mn.default}});Object.defineProperty(P,"parse",{enumerable:!0,get:function(){return gn.default}});var ln=A(ot()),fn=A(dt()),dn=A(pt()),hn=A(mt()),pn=A(gt()),_n=A(yt()),vn=A(G()),mn=A(J()),gn=A(ye());function A(e){return e&&e.__esModule?e:{default:e}}});var St=_(R=>{"use strict";var yn=R&&R.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),wn=R&&R.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),bt=R&&R.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&yn(t,e,r);return wn(t,e),t};Object.defineProperty(R,"__esModule",{value:!0});R.prepareKeyValueMessage=R.issueFileCommand=void 0;var Ot=bt(require("fs")),Oe=bt(require("os")),On=wt(),Rt=H();function bn(e,t){let r=process.env[`GITHUB_${e}`];if(!r)throw new Error(`Unable to find environment variable for file command ${e}`);if(!Ot.existsSync(r))throw new Error(`Missing file at path: ${r}`);Ot.appendFileSync(r,`${Rt.toCommandValue(t)}${Oe.EOL}`,{encoding:"utf8"})}R.issueFileCommand=bn;function Rn(e,t){let r=`ghadelimiter_${On.v4()}`,n=Rt.toCommandValue(t);if(e.includes(r))throw new Error(`Unexpected input: name should not contain the delimiter "${r}"`);if(n.includes(r))throw new Error(`Unexpected input: value should not contain the delimiter "${r}"`);return`${e}<<${r}${Oe.EOL}${n}${Oe.EOL}${r}`}R.prepareKeyValueMessage=Rn});var Et=_($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.checkBypass=$.getProxyUrl=void 0;function Sn(e){let t=e.protocol==="https:";if(Pt(e))return;let r=(()=>t?process.env.https_proxy||process.env.HTTPS_PROXY:process.env.http_proxy||process.env.HTTP_PROXY)();if(r)return new URL(r)}$.getProxyUrl=Sn;function Pt(e){if(!e.hostname)return!1;let t=process.env.no_proxy||process.env.NO_PROXY||"";if(!t)return!1;let r;e.port?r=Number(e.port):e.protocol==="http:"?r=80:e.protocol==="https:"&&(r=443);let n=[e.hostname.toUpperCase()];typeof r=="number"&&n.push(`${n[0]}:${r}`);for(let i of t.split(",").map(s=>s.trim().toUpperCase()).filter(s=>s))if(n.some(s=>s===i))return!0;return!1}$.checkBypass=Pt});var Ct=_(L=>{"use strict";var es=require("net"),Pn=require("tls"),be=require("http"),qt=require("https"),En=require("events"),ts=require("assert"),qn=require("util");L.httpOverHttp=Tn;L.httpsOverHttp=An;L.httpOverHttps=Cn;L.httpsOverHttps=Mn;function Tn(e){var t=new C(e);return t.request=be.request,t}function An(e){var t=new C(e);return t.request=be.request,t.createSocket=Tt,t.defaultPort=443,t}function Cn(e){var t=new C(e);return t.request=qt.request,t}function Mn(e){var t=new C(e);return t.request=qt.request,t.createSocket=Tt,t.defaultPort=443,t}function C(e){var t=this;t.options=e||{},t.proxyOptions=t.options.proxy||{},t.maxSockets=t.options.maxSockets||be.Agent.defaultMaxSockets,t.requests=[],t.sockets=[],t.on("free",function(n,i,s,o){for(var c=At(i,s,o),u=0,a=t.requests.length;u=this.maxSockets){s.requests.push(o);return}s.createSocket(o,function(c){c.on("free",u),c.on("close",a),c.on("agentRemove",a),t.onSocket(c);function u(){s.emit("free",c,o)}function a(l){s.removeSocket(c),c.removeListener("free",u),c.removeListener("close",a),c.removeListener("agentRemove",a)}})};C.prototype.createSocket=function(t,r){var n=this,i={};n.sockets.push(i);var s=Re({},n.proxyOptions,{method:"CONNECT",path:t.host+":"+t.port,agent:!1,headers:{host:t.host+":"+t.port}});t.localAddress&&(s.localAddress=t.localAddress),s.proxyAuth&&(s.headers=s.headers||{},s.headers["Proxy-Authorization"]="Basic "+new Buffer(s.proxyAuth).toString("base64")),M("making CONNECT request");var o=n.request(s);o.useChunkedEncodingByDefault=!1,o.once("response",c),o.once("upgrade",u),o.once("connect",a),o.once("error",l),o.end();function c(d){d.upgrade=!0}function u(d,h,g){process.nextTick(function(){a(d,h,g)})}function a(d,h,g){if(o.removeAllListeners(),h.removeAllListeners(),d.statusCode!==200){M("tunneling socket could not be established, statusCode=%d",d.statusCode),h.destroy();var T=new Error("tunneling socket could not be established, statusCode="+d.statusCode);T.code="ECONNRESET",t.request.emit("error",T),n.removeSocket(i);return}if(g.length>0){M("got illegal response body from proxy"),h.destroy();var T=new Error("got illegal response body from proxy");T.code="ECONNRESET",t.request.emit("error",T),n.removeSocket(i);return}return M("tunneling connection has established"),n.sockets[n.sockets.indexOf(i)]=h,r(h)}function l(d){o.removeAllListeners(),M(`tunneling socket could not be established, cause=%s -`,d.message,d.stack);var h=new Error("tunneling socket could not be established, cause="+d.message);h.code="ECONNRESET",t.request.emit("error",h),n.removeSocket(i)}};C.prototype.removeSocket=function(t){var r=this.sockets.indexOf(t);if(r!==-1){this.sockets.splice(r,1);var n=this.requests.shift();n&&this.createSocket(n,function(i){n.request.onSocket(i)})}};function Tt(e,t){var r=this;C.prototype.createSocket.call(r,e,function(n){var i=e.request.getHeader("host"),s=Re({},r.options,{socket:n,servername:i?i.replace(/:.*$/,""):e.host}),o=Pn.connect(0,s);r.sockets[r.sockets.indexOf(n)]=o,t(o)})}function At(e,t,r){return typeof e=="string"?{host:e,port:t,localAddress:r}:e}function Re(e){for(var t=1,r=arguments.length;t{Mt.exports=Ct()});var Ee=_(p=>{"use strict";var Un=p&&p.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),xn=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),fe=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&Un(t,e,r);return xn(t,e),t},v=p&&p.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(l){try{a(n.next(l))}catch(d){o(d)}}function u(l){try{a(n.throw(l))}catch(d){o(d)}}function a(l){l.done?s(l.value):i(l.value).then(c,u)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});p.HttpClient=p.isHttps=p.HttpClientResponse=p.HttpClientError=p.getProxyUrl=p.MediaTypes=p.Headers=p.HttpCodes=void 0;var ae=fe(require("http")),Se=fe(require("https")),xt=fe(Et()),ue=fe(Ut()),E;(function(e){e[e.OK=200]="OK",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.ResourceMoved=302]="ResourceMoved",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.SwitchProxy=306]="SwitchProxy",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.TooManyRequests=429]="TooManyRequests",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout"})(E=p.HttpCodes||(p.HttpCodes={}));var y;(function(e){e.Accept="accept",e.ContentType="content-type"})(y=p.Headers||(p.Headers={}));var U;(function(e){e.ApplicationJson="application/json"})(U=p.MediaTypes||(p.MediaTypes={}));function Dn(e){let t=xt.getProxyUrl(new URL(e));return t?t.href:""}p.getProxyUrl=Dn;var Nn=[E.MovedPermanently,E.ResourceMoved,E.SeeOther,E.TemporaryRedirect,E.PermanentRedirect],In=[E.BadGateway,E.ServiceUnavailable,E.GatewayTimeout],Bn=["OPTIONS","GET","DELETE","HEAD"],$n=10,Ln=5,k=class extends Error{constructor(t,r){super(t),this.name="HttpClientError",this.statusCode=r,Object.setPrototypeOf(this,k.prototype)}};p.HttpClientError=k;var le=class{constructor(t){this.message=t}readBody(){return v(this,void 0,void 0,function*(){return new Promise(t=>v(this,void 0,void 0,function*(){let r=Buffer.alloc(0);this.message.on("data",n=>{r=Buffer.concat([r,n])}),this.message.on("end",()=>{t(r.toString())})}))})}};p.HttpClientResponse=le;function kn(e){return new URL(e).protocol==="https:"}p.isHttps=kn;var Pe=class{constructor(t,r,n){this._ignoreSslError=!1,this._allowRedirects=!0,this._allowRedirectDowngrade=!1,this._maxRedirects=50,this._allowRetries=!1,this._maxRetries=1,this._keepAlive=!1,this._disposed=!1,this.userAgent=t,this.handlers=r||[],this.requestOptions=n,n&&(n.ignoreSslError!=null&&(this._ignoreSslError=n.ignoreSslError),this._socketTimeout=n.socketTimeout,n.allowRedirects!=null&&(this._allowRedirects=n.allowRedirects),n.allowRedirectDowngrade!=null&&(this._allowRedirectDowngrade=n.allowRedirectDowngrade),n.maxRedirects!=null&&(this._maxRedirects=Math.max(n.maxRedirects,0)),n.keepAlive!=null&&(this._keepAlive=n.keepAlive),n.allowRetries!=null&&(this._allowRetries=n.allowRetries),n.maxRetries!=null&&(this._maxRetries=n.maxRetries))}options(t,r){return v(this,void 0,void 0,function*(){return this.request("OPTIONS",t,null,r||{})})}get(t,r){return v(this,void 0,void 0,function*(){return this.request("GET",t,null,r||{})})}del(t,r){return v(this,void 0,void 0,function*(){return this.request("DELETE",t,null,r||{})})}post(t,r,n){return v(this,void 0,void 0,function*(){return this.request("POST",t,r,n||{})})}patch(t,r,n){return v(this,void 0,void 0,function*(){return this.request("PATCH",t,r,n||{})})}put(t,r,n){return v(this,void 0,void 0,function*(){return this.request("PUT",t,r,n||{})})}head(t,r){return v(this,void 0,void 0,function*(){return this.request("HEAD",t,null,r||{})})}sendStream(t,r,n,i){return v(this,void 0,void 0,function*(){return this.request(t,r,n,i)})}getJson(t,r={}){return v(this,void 0,void 0,function*(){r[y.Accept]=this._getExistingOrDefaultHeader(r,y.Accept,U.ApplicationJson);let n=yield this.get(t,r);return this._processResponse(n,this.requestOptions)})}postJson(t,r,n={}){return v(this,void 0,void 0,function*(){let i=JSON.stringify(r,null,2);n[y.Accept]=this._getExistingOrDefaultHeader(n,y.Accept,U.ApplicationJson),n[y.ContentType]=this._getExistingOrDefaultHeader(n,y.ContentType,U.ApplicationJson);let s=yield this.post(t,i,n);return this._processResponse(s,this.requestOptions)})}putJson(t,r,n={}){return v(this,void 0,void 0,function*(){let i=JSON.stringify(r,null,2);n[y.Accept]=this._getExistingOrDefaultHeader(n,y.Accept,U.ApplicationJson),n[y.ContentType]=this._getExistingOrDefaultHeader(n,y.ContentType,U.ApplicationJson);let s=yield this.put(t,i,n);return this._processResponse(s,this.requestOptions)})}patchJson(t,r,n={}){return v(this,void 0,void 0,function*(){let i=JSON.stringify(r,null,2);n[y.Accept]=this._getExistingOrDefaultHeader(n,y.Accept,U.ApplicationJson),n[y.ContentType]=this._getExistingOrDefaultHeader(n,y.ContentType,U.ApplicationJson);let s=yield this.patch(t,i,n);return this._processResponse(s,this.requestOptions)})}request(t,r,n,i){return v(this,void 0,void 0,function*(){if(this._disposed)throw new Error("Client has already been disposed.");let s=new URL(r),o=this._prepareRequest(t,s,i),c=this._allowRetries&&Bn.includes(t)?this._maxRetries+1:1,u=0,a;do{if(a=yield this.requestRaw(o,n),a&&a.message&&a.message.statusCode===E.Unauthorized){let d;for(let h of this.handlers)if(h.canHandleAuthentication(a)){d=h;break}return d?d.handleAuthentication(this,o,n):a}let l=this._maxRedirects;for(;a.message.statusCode&&Nn.includes(a.message.statusCode)&&this._allowRedirects&&l>0;){let d=a.message.headers.location;if(!d)break;let h=new URL(d);if(s.protocol==="https:"&&s.protocol!==h.protocol&&!this._allowRedirectDowngrade)throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.");if(yield a.readBody(),h.hostname!==s.hostname)for(let g in i)g.toLowerCase()==="authorization"&&delete i[g];o=this._prepareRequest(t,h,i),a=yield this.requestRaw(o,n),l--}if(!a.message.statusCode||!In.includes(a.message.statusCode))return a;u+=1,u{function s(o,c){o?i(o):c?n(c):i(new Error("Unknown error"))}this.requestRawWithCallback(t,r,s)})})}requestRawWithCallback(t,r,n){typeof r=="string"&&(t.options.headers||(t.options.headers={}),t.options.headers["Content-Length"]=Buffer.byteLength(r,"utf8"));let i=!1;function s(u,a){i||(i=!0,n(u,a))}let o=t.httpModule.request(t.options,u=>{let a=new le(u);s(void 0,a)}),c;o.on("socket",u=>{c=u}),o.setTimeout(this._socketTimeout||3*6e4,()=>{c&&c.end(),s(new Error(`Request timeout: ${t.options.path}`))}),o.on("error",function(u){s(u)}),r&&typeof r=="string"&&o.write(r,"utf8"),r&&typeof r!="string"?(r.on("close",function(){o.end()}),r.pipe(o)):o.end()}getAgent(t){let r=new URL(t);return this._getAgent(r)}_prepareRequest(t,r,n){let i={};i.parsedUrl=r;let s=i.parsedUrl.protocol==="https:";i.httpModule=s?Se:ae;let o=s?443:80;if(i.options={},i.options.host=i.parsedUrl.hostname,i.options.port=i.parsedUrl.port?parseInt(i.parsedUrl.port):o,i.options.path=(i.parsedUrl.pathname||"")+(i.parsedUrl.search||""),i.options.method=t,i.options.headers=this._mergeHeaders(n),this.userAgent!=null&&(i.options.headers["user-agent"]=this.userAgent),i.options.agent=this._getAgent(i.parsedUrl),this.handlers)for(let c of this.handlers)c.prepareRequest(i.options);return i}_mergeHeaders(t){return this.requestOptions&&this.requestOptions.headers?Object.assign({},ce(this.requestOptions.headers),ce(t||{})):ce(t||{})}_getExistingOrDefaultHeader(t,r,n){let i;return this.requestOptions&&this.requestOptions.headers&&(i=ce(this.requestOptions.headers)[r]),t[r]||i||n}_getAgent(t){let r,n=xt.getProxyUrl(t),i=n&&n.hostname;if(this._keepAlive&&i&&(r=this._proxyAgent),this._keepAlive&&!i&&(r=this._agent),r)return r;let s=t.protocol==="https:",o=100;if(this.requestOptions&&(o=this.requestOptions.maxSockets||ae.globalAgent.maxSockets),n&&n.hostname){let c={maxSockets:o,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(n.username||n.password)&&{proxyAuth:`${n.username}:${n.password}`}),{host:n.hostname,port:n.port})},u,a=n.protocol==="https:";s?u=a?ue.httpsOverHttps:ue.httpsOverHttp:u=a?ue.httpOverHttps:ue.httpOverHttp,r=u(c),this._proxyAgent=r}if(this._keepAlive&&!r){let c={keepAlive:this._keepAlive,maxSockets:o};r=s?new Se.Agent(c):new ae.Agent(c),this._agent=r}return r||(r=s?Se.globalAgent:ae.globalAgent),s&&this._ignoreSslError&&(r.options=Object.assign(r.options||{},{rejectUnauthorized:!1})),r}_performExponentialBackoff(t){return v(this,void 0,void 0,function*(){t=Math.min($n,t);let r=Ln*Math.pow(2,t);return new Promise(n=>setTimeout(()=>n(),r))})}_processResponse(t,r){return v(this,void 0,void 0,function*(){return new Promise((n,i)=>v(this,void 0,void 0,function*(){let s=t.message.statusCode||0,o={statusCode:s,result:null,headers:{}};s===E.NotFound&&n(o);function c(l,d){if(typeof d=="string"){let h=new Date(d);if(!isNaN(h.valueOf()))return h}return d}let u,a;try{a=yield t.readBody(),a&&a.length>0&&(r&&r.deserializeDates?u=JSON.parse(a,c):u=JSON.parse(a),o.result=u),o.headers=t.message.headers}catch(l){}if(s>299){let l;u&&u.message?l=u.message:a&&a.length>0?l=a:l=`Failed request: (${s})`;let d=new k(l,s);d.result=o.result,i(d)}else n(o)}))})}};p.HttpClient=Pe;var ce=e=>Object.keys(e).reduce((t,r)=>(t[r.toLowerCase()]=e[r],t),{})});var Me=_(q=>{"use strict";var Ce=q&&q.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(l){try{a(n.next(l))}catch(d){o(d)}}function u(l){try{a(n.throw(l))}catch(d){o(d)}}function a(l){l.done?s(l.value):i(l.value).then(c,u)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(q,"__esModule",{value:!0});q.PersonalAccessTokenCredentialHandler=q.BearerCredentialHandler=q.BasicCredentialHandler=void 0;var qe=class{constructor(t,r){this.username=t,this.password=r}prepareRequest(t){if(!t.headers)throw Error("The request has no headers");t.headers.Authorization=`Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return Ce(this,void 0,void 0,function*(){throw new Error("not implemented")})}};q.BasicCredentialHandler=qe;var Te=class{constructor(t){this.token=t}prepareRequest(t){if(!t.headers)throw Error("The request has no headers");t.headers.Authorization=`Bearer ${this.token}`}canHandleAuthentication(){return!1}handleAuthentication(){return Ce(this,void 0,void 0,function*(){throw new Error("not implemented")})}};q.BearerCredentialHandler=Te;var Ae=class{constructor(t){this.token=t}prepareRequest(t){if(!t.headers)throw Error("The request has no headers");t.headers.Authorization=`Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return Ce(this,void 0,void 0,function*(){throw new Error("not implemented")})}};q.PersonalAccessTokenCredentialHandler=Ae});var It=_(j=>{"use strict";var Dt=j&&j.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(l){try{a(n.next(l))}catch(d){o(d)}}function u(l){try{a(n.throw(l))}catch(d){o(d)}}function a(l){l.done?s(l.value):i(l.value).then(c,u)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(j,"__esModule",{value:!0});j.OidcClient=void 0;var jn=Ee(),Vn=Me(),Nt=Ue(),x=class{static createHttpClient(t=!0,r=10){let n={allowRetries:t,maxRetries:r};return new jn.HttpClient("actions/oidc-client",[new Vn.BearerCredentialHandler(x.getRequestToken())],n)}static getRequestToken(){let t=process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;if(!t)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable");return t}static getIDTokenUrl(){let t=process.env.ACTIONS_ID_TOKEN_REQUEST_URL;if(!t)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable");return t}static getCall(t){var r;return Dt(this,void 0,void 0,function*(){let s=(r=(yield x.createHttpClient().getJson(t).catch(o=>{throw new Error(`Failed to get ID Token. +"use strict";var Ty=Object.create;var yn=Object.defineProperty,Ay=Object.defineProperties,Ry=Object.getOwnPropertyDescriptor,wy=Object.getOwnPropertyDescriptors,Oy=Object.getOwnPropertyNames,Pp=Object.getOwnPropertySymbols,Cy=Object.getPrototypeOf,Lp=Object.prototype.hasOwnProperty,My=Object.prototype.propertyIsEnumerable;var kp=(r,t,i)=>t in r?yn(r,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[t]=i,zp=(r,t)=>{for(var i in t||(t={}))Lp.call(t,i)&&kp(r,i,t[i]);if(Pp)for(var i of Pp(t))My.call(t,i)&&kp(r,i,t[i]);return r},Wp=(r,t)=>Ay(r,wy(t));var ft=(r,t)=>()=>(r&&(t=r(r=0)),t);var j=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),tu=(r,t)=>{for(var i in t)yn(r,i,{get:t[i],enumerable:!0})},qp=(r,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Oy(t))!Lp.call(r,o)&&o!==i&&yn(r,o,{get:()=>t[o],enumerable:!(s=Ry(t,o))||s.enumerable});return r};var it=(r,t,i)=>(i=r!=null?Ty(Cy(r)):{},qp(t||!r||!r.__esModule?yn(i,"default",{value:r,enumerable:!0}):i,r)),ru=r=>qp(yn({},"__esModule",{value:!0}),r);var jy=(r,t,i)=>{if(!t.has(r))throw TypeError("Cannot "+i)};var L=(r,t,i)=>(jy(r,t,"read from private field"),i?i.call(r):t.get(r)),z=(r,t,i)=>{if(t.has(r))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(r):t.set(r,i)};var de=(r,t,i)=>new Promise((s,o)=>{var l=p=>{try{_(i.next(p))}catch(m){o(m)}},g=p=>{try{_(i.throw(p))}catch(m){o(m)}},_=p=>p.done?s(p.value):Promise.resolve(p.value).then(l,g);_((i=i.apply(r,t)).next())});var ea=j(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.toCommandProperties=Oi.toCommandValue=void 0;function By(r){return r==null?"":typeof r=="string"||r instanceof String?r:JSON.stringify(r)}Oi.toCommandValue=By;function Ny(r){return Object.keys(r).length?{title:r.title,file:r.file,line:r.startLine,endLine:r.endLine,col:r.startColumn,endColumn:r.endColumn}:{}}Oi.toCommandProperties=Ny});var Yp=j(_t=>{"use strict";var xy=_t&&_t.__createBinding||(Object.create?function(r,t,i,s){s===void 0&&(s=i),Object.defineProperty(r,s,{enumerable:!0,get:function(){return t[i]}})}:function(r,t,i,s){s===void 0&&(s=i),r[s]=t[i]}),Iy=_t&&_t.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),Fy=_t&&_t.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var i in r)i!=="default"&&Object.hasOwnProperty.call(r,i)&&xy(t,r,i);return Iy(t,r),t};Object.defineProperty(_t,"__esModule",{value:!0});_t.issue=_t.issueCommand=void 0;var Uy=Fy(require("os")),Vp=ea();function Gp(r,t,i){let s=new iu(r,t,i);process.stdout.write(s.toString()+Uy.EOL)}_t.issueCommand=Gp;function Dy(r,t=""){Gp(r,{},t)}_t.issue=Dy;var Hp="::",iu=class{constructor(t,i,s){t||(t="missing.command"),this.command=t,this.properties=i,this.message=s}toString(){let t=Hp+this.command;if(this.properties&&Object.keys(this.properties).length>0){t+=" ";let i=!0;for(let s in this.properties)if(this.properties.hasOwnProperty(s)){let o=this.properties[s];o&&(i?i=!1:t+=",",t+=`${s}=${ky(o)}`)}}return t+=`${Hp}${Py(this.message)}`,t}};function Py(r){return Vp.toCommandValue(r).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function ky(r){return Vp.toCommandValue(r).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}});var nu=j(su=>{"use strict";Object.defineProperty(su,"__esModule",{value:!0});su.default=Wy;var Ly=zy(require("crypto"));function zy(r){return r&&r.__esModule?r:{default:r}}var ra=new Uint8Array(256),ta=ra.length;function Wy(){return ta>ra.length-16&&(Ly.default.randomFillSync(ra),ta=0),ra.slice(ta,ta+=16)}});var $p=j(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.default=void 0;var qy=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;ia.default=qy});var bn=j(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.default=void 0;var Hy=Vy($p());function Vy(r){return r&&r.__esModule?r:{default:r}}function Gy(r){return typeof r=="string"&&Hy.default.test(r)}var Yy=Gy;sa.default=Yy});var Sn=j(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});na.default=void 0;var $y=Ky(bn());function Ky(r){return r&&r.__esModule?r:{default:r}}var ke=[];for(let r=0;r<256;++r)ke.push((r+256).toString(16).substr(1));function Xy(r,t=0){let i=(ke[r[t+0]]+ke[r[t+1]]+ke[r[t+2]]+ke[r[t+3]]+"-"+ke[r[t+4]]+ke[r[t+5]]+"-"+ke[r[t+6]]+ke[r[t+7]]+"-"+ke[r[t+8]]+ke[r[t+9]]+"-"+ke[r[t+10]]+ke[r[t+11]]+ke[r[t+12]]+ke[r[t+13]]+ke[r[t+14]]+ke[r[t+15]]).toLowerCase();if(!(0,$y.default)(i))throw TypeError("Stringified UUID is invalid");return i}var Jy=Xy;na.default=Jy});var Jp=j(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.default=void 0;var Zy=Xp(nu()),Qy=Xp(Sn());function Xp(r){return r&&r.__esModule?r:{default:r}}var Kp,ou,au=0,lu=0;function eb(r,t,i){let s=t&&i||0,o=t||new Array(16);r=r||{};let l=r.node||Kp,g=r.clockseq!==void 0?r.clockseq:ou;if(l==null||g==null){let R=r.random||(r.rng||Zy.default)();l==null&&(l=Kp=[R[0]|1,R[1],R[2],R[3],R[4],R[5]]),g==null&&(g=ou=(R[6]<<8|R[7])&16383)}let _=r.msecs!==void 0?r.msecs:Date.now(),p=r.nsecs!==void 0?r.nsecs:lu+1,m=_-au+(p-lu)/1e4;if(m<0&&r.clockseq===void 0&&(g=g+1&16383),(m<0||_>au)&&r.nsecs===void 0&&(p=0),p>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");au=_,lu=p,ou=g,_+=122192928e5;let S=((_&268435455)*1e4+p)%4294967296;o[s++]=S>>>24&255,o[s++]=S>>>16&255,o[s++]=S>>>8&255,o[s++]=S&255;let v=_/4294967296*1e4&268435455;o[s++]=v>>>8&255,o[s++]=v&255,o[s++]=v>>>24&15|16,o[s++]=v>>>16&255,o[s++]=g>>>8|128,o[s++]=g&255;for(let R=0;R<6;++R)o[s+R]=l[R];return t||(0,Qy.default)(o)}var tb=eb;oa.default=tb});var uu=j(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});aa.default=void 0;var rb=ib(bn());function ib(r){return r&&r.__esModule?r:{default:r}}function sb(r){if(!(0,rb.default)(r))throw TypeError("Invalid UUID");let t,i=new Uint8Array(16);return i[0]=(t=parseInt(r.slice(0,8),16))>>>24,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=t&255,i[4]=(t=parseInt(r.slice(9,13),16))>>>8,i[5]=t&255,i[6]=(t=parseInt(r.slice(14,18),16))>>>8,i[7]=t&255,i[8]=(t=parseInt(r.slice(19,23),16))>>>8,i[9]=t&255,i[10]=(t=parseInt(r.slice(24,36),16))/1099511627776&255,i[11]=t/4294967296&255,i[12]=t>>>24&255,i[13]=t>>>16&255,i[14]=t>>>8&255,i[15]=t&255,i}var nb=sb;aa.default=nb});var cu=j(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.default=ub;ci.URL=ci.DNS=void 0;var ob=Zp(Sn()),ab=Zp(uu());function Zp(r){return r&&r.__esModule?r:{default:r}}function lb(r){r=unescape(encodeURIComponent(r));let t=[];for(let i=0;i{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.default=void 0;var cb=gb(require("crypto"));function gb(r){return r&&r.__esModule?r:{default:r}}function pb(r){return Array.isArray(r)?r=Buffer.from(r):typeof r=="string"&&(r=Buffer.from(r,"utf8")),cb.default.createHash("md5").update(r).digest()}var db=pb;la.default=db});var id=j(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.default=void 0;var hb=rd(cu()),fb=rd(td());function rd(r){return r&&r.__esModule?r:{default:r}}var _b=(0,hb.default)("v3",48,fb.default),mb=_b;ua.default=mb});var nd=j(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.default=void 0;var yb=sd(nu()),bb=sd(Sn());function sd(r){return r&&r.__esModule?r:{default:r}}function Sb(r,t,i){r=r||{};let s=r.random||(r.rng||yb.default)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,t){i=i||0;for(let o=0;o<16;++o)t[i+o]=s[o];return t}return(0,bb.default)(s)}var vb=Sb;ca.default=vb});var od=j(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.default=void 0;var Eb=Tb(require("crypto"));function Tb(r){return r&&r.__esModule?r:{default:r}}function Ab(r){return Array.isArray(r)?r=Buffer.from(r):typeof r=="string"&&(r=Buffer.from(r,"utf8")),Eb.default.createHash("sha1").update(r).digest()}var Rb=Ab;ga.default=Rb});var ld=j(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.default=void 0;var wb=ad(cu()),Ob=ad(od());function ad(r){return r&&r.__esModule?r:{default:r}}var Cb=(0,wb.default)("v5",80,Ob.default),Mb=Cb;pa.default=Mb});var ud=j(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.default=void 0;var jb="00000000-0000-0000-0000-000000000000";da.default=jb});var cd=j(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.default=void 0;var Bb=Nb(bn());function Nb(r){return r&&r.__esModule?r:{default:r}}function xb(r){if(!(0,Bb.default)(r))throw TypeError("Invalid UUID");return parseInt(r.substr(14,1),16)}var Ib=xb;ha.default=Ib});var gd=j(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Object.defineProperty(Ut,"v1",{enumerable:!0,get:function(){return Fb.default}});Object.defineProperty(Ut,"v3",{enumerable:!0,get:function(){return Ub.default}});Object.defineProperty(Ut,"v4",{enumerable:!0,get:function(){return Db.default}});Object.defineProperty(Ut,"v5",{enumerable:!0,get:function(){return Pb.default}});Object.defineProperty(Ut,"NIL",{enumerable:!0,get:function(){return kb.default}});Object.defineProperty(Ut,"version",{enumerable:!0,get:function(){return Lb.default}});Object.defineProperty(Ut,"validate",{enumerable:!0,get:function(){return zb.default}});Object.defineProperty(Ut,"stringify",{enumerable:!0,get:function(){return Wb.default}});Object.defineProperty(Ut,"parse",{enumerable:!0,get:function(){return qb.default}});var Fb=br(Jp()),Ub=br(id()),Db=br(nd()),Pb=br(ld()),kb=br(ud()),Lb=br(cd()),zb=br(bn()),Wb=br(Sn()),qb=br(uu());function br(r){return r&&r.__esModule?r:{default:r}}});var fd=j(mt=>{"use strict";var Hb=mt&&mt.__createBinding||(Object.create?function(r,t,i,s){s===void 0&&(s=i),Object.defineProperty(r,s,{enumerable:!0,get:function(){return t[i]}})}:function(r,t,i,s){s===void 0&&(s=i),r[s]=t[i]}),Vb=mt&&mt.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),dd=mt&&mt.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var i in r)i!=="default"&&Object.hasOwnProperty.call(r,i)&&Hb(t,r,i);return Vb(t,r),t};Object.defineProperty(mt,"__esModule",{value:!0});mt.prepareKeyValueMessage=mt.issueFileCommand=void 0;var pd=dd(require("fs")),gu=dd(require("os")),Gb=gd(),hd=ea();function Yb(r,t){let i=process.env[`GITHUB_${r}`];if(!i)throw new Error(`Unable to find environment variable for file command ${r}`);if(!pd.existsSync(i))throw new Error(`Missing file at path: ${i}`);pd.appendFileSync(i,`${hd.toCommandValue(t)}${gu.EOL}`,{encoding:"utf8"})}mt.issueFileCommand=Yb;function $b(r,t){let i=`ghadelimiter_${Gb.v4()}`,s=hd.toCommandValue(t);if(r.includes(i))throw new Error(`Unexpected input: name should not contain the delimiter "${i}"`);if(s.includes(i))throw new Error(`Unexpected input: value should not contain the delimiter "${i}"`);return`${r}<<${i}${gu.EOL}${s}${gu.EOL}${i}`}mt.prepareKeyValueMessage=$b});var md=j(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.checkBypass=Ci.getProxyUrl=void 0;function Kb(r){let t=r.protocol==="https:";if(_d(r))return;let i=(()=>t?process.env.https_proxy||process.env.HTTPS_PROXY:process.env.http_proxy||process.env.HTTP_PROXY)();if(i)return new URL(i)}Ci.getProxyUrl=Kb;function _d(r){if(!r.hostname)return!1;let t=process.env.no_proxy||process.env.NO_PROXY||"";if(!t)return!1;let i;r.port?i=Number(r.port):r.protocol==="http:"?i=80:r.protocol==="https:"&&(i=443);let s=[r.hostname.toUpperCase()];typeof i=="number"&&s.push(`${s[0]}:${i}`);for(let o of t.split(",").map(l=>l.trim().toUpperCase()).filter(l=>l))if(s.some(l=>l===o))return!0;return!1}Ci.checkBypass=_d});var vd=j(Mi=>{"use strict";var pO=require("net"),Xb=require("tls"),pu=require("http"),yd=require("https"),Jb=require("events"),dO=require("assert"),Zb=require("util");Mi.httpOverHttp=Qb;Mi.httpsOverHttp=eS;Mi.httpOverHttps=tS;Mi.httpsOverHttps=rS;function Qb(r){var t=new Sr(r);return t.request=pu.request,t}function eS(r){var t=new Sr(r);return t.request=pu.request,t.createSocket=bd,t.defaultPort=443,t}function tS(r){var t=new Sr(r);return t.request=yd.request,t}function rS(r){var t=new Sr(r);return t.request=yd.request,t.createSocket=bd,t.defaultPort=443,t}function Sr(r){var t=this;t.options=r||{},t.proxyOptions=t.options.proxy||{},t.maxSockets=t.options.maxSockets||pu.Agent.defaultMaxSockets,t.requests=[],t.sockets=[],t.on("free",function(s,o,l,g){for(var _=Sd(o,l,g),p=0,m=t.requests.length;p=this.maxSockets){l.requests.push(g);return}l.createSocket(g,function(_){_.on("free",p),_.on("close",m),_.on("agentRemove",m),t.onSocket(_);function p(){l.emit("free",_,g)}function m(S){l.removeSocket(_),_.removeListener("free",p),_.removeListener("close",m),_.removeListener("agentRemove",m)}})};Sr.prototype.createSocket=function(t,i){var s=this,o={};s.sockets.push(o);var l=du({},s.proxyOptions,{method:"CONNECT",path:t.host+":"+t.port,agent:!1,headers:{host:t.host+":"+t.port}});t.localAddress&&(l.localAddress=t.localAddress),l.proxyAuth&&(l.headers=l.headers||{},l.headers["Proxy-Authorization"]="Basic "+new Buffer(l.proxyAuth).toString("base64")),Nr("making CONNECT request");var g=s.request(l);g.useChunkedEncodingByDefault=!1,g.once("response",_),g.once("upgrade",p),g.once("connect",m),g.once("error",S),g.end();function _(v){v.upgrade=!0}function p(v,R,w){process.nextTick(function(){m(v,R,w)})}function m(v,R,w){if(g.removeAllListeners(),R.removeAllListeners(),v.statusCode!==200){Nr("tunneling socket could not be established, statusCode=%d",v.statusCode),R.destroy();var B=new Error("tunneling socket could not be established, statusCode="+v.statusCode);B.code="ECONNRESET",t.request.emit("error",B),s.removeSocket(o);return}if(w.length>0){Nr("got illegal response body from proxy"),R.destroy();var B=new Error("got illegal response body from proxy");B.code="ECONNRESET",t.request.emit("error",B),s.removeSocket(o);return}return Nr("tunneling connection has established"),s.sockets[s.sockets.indexOf(o)]=R,i(R)}function S(v){g.removeAllListeners(),Nr(`tunneling socket could not be established, cause=%s +`,v.message,v.stack);var R=new Error("tunneling socket could not be established, cause="+v.message);R.code="ECONNRESET",t.request.emit("error",R),s.removeSocket(o)}};Sr.prototype.removeSocket=function(t){var i=this.sockets.indexOf(t);if(i!==-1){this.sockets.splice(i,1);var s=this.requests.shift();s&&this.createSocket(s,function(o){s.request.onSocket(o)})}};function bd(r,t){var i=this;Sr.prototype.createSocket.call(i,r,function(s){var o=r.request.getHeader("host"),l=du({},i.options,{socket:s,servername:o?o.replace(/:.*$/,""):r.host}),g=Xb.connect(0,l);i.sockets[i.sockets.indexOf(s)]=g,t(g)})}function Sd(r,t,i){return typeof r=="string"?{host:r,port:t,localAddress:i}:r}function du(r){for(var t=1,i=arguments.length;t{Ed.exports=vd()});var _u=j(ye=>{"use strict";var iS=ye&&ye.__createBinding||(Object.create?function(r,t,i,s){s===void 0&&(s=i),Object.defineProperty(r,s,{enumerable:!0,get:function(){return t[i]}})}:function(r,t,i,s){s===void 0&&(s=i),r[s]=t[i]}),sS=ye&&ye.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),ba=ye&&ye.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var i in r)i!=="default"&&Object.hasOwnProperty.call(r,i)&&iS(t,r,i);return sS(t,r),t},Ie=ye&&ye.__awaiter||function(r,t,i,s){function o(l){return l instanceof i?l:new i(function(g){g(l)})}return new(i||(i=Promise))(function(l,g){function _(S){try{m(s.next(S))}catch(v){g(v)}}function p(S){try{m(s.throw(S))}catch(v){g(v)}}function m(S){S.done?l(S.value):o(S.value).then(_,p)}m((s=s.apply(r,t||[])).next())})};Object.defineProperty(ye,"__esModule",{value:!0});ye.HttpClient=ye.isHttps=ye.HttpClientResponse=ye.HttpClientError=ye.getProxyUrl=ye.MediaTypes=ye.Headers=ye.HttpCodes=void 0;var fa=ba(require("http")),hu=ba(require("https")),Ad=ba(md()),_a=ba(Td()),Dt;(function(r){r[r.OK=200]="OK",r[r.MultipleChoices=300]="MultipleChoices",r[r.MovedPermanently=301]="MovedPermanently",r[r.ResourceMoved=302]="ResourceMoved",r[r.SeeOther=303]="SeeOther",r[r.NotModified=304]="NotModified",r[r.UseProxy=305]="UseProxy",r[r.SwitchProxy=306]="SwitchProxy",r[r.TemporaryRedirect=307]="TemporaryRedirect",r[r.PermanentRedirect=308]="PermanentRedirect",r[r.BadRequest=400]="BadRequest",r[r.Unauthorized=401]="Unauthorized",r[r.PaymentRequired=402]="PaymentRequired",r[r.Forbidden=403]="Forbidden",r[r.NotFound=404]="NotFound",r[r.MethodNotAllowed=405]="MethodNotAllowed",r[r.NotAcceptable=406]="NotAcceptable",r[r.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",r[r.RequestTimeout=408]="RequestTimeout",r[r.Conflict=409]="Conflict",r[r.Gone=410]="Gone",r[r.TooManyRequests=429]="TooManyRequests",r[r.InternalServerError=500]="InternalServerError",r[r.NotImplemented=501]="NotImplemented",r[r.BadGateway=502]="BadGateway",r[r.ServiceUnavailable=503]="ServiceUnavailable",r[r.GatewayTimeout=504]="GatewayTimeout"})(Dt=ye.HttpCodes||(ye.HttpCodes={}));var Je;(function(r){r.Accept="accept",r.ContentType="content-type"})(Je=ye.Headers||(ye.Headers={}));var xr;(function(r){r.ApplicationJson="application/json"})(xr=ye.MediaTypes||(ye.MediaTypes={}));function nS(r){let t=Ad.getProxyUrl(new URL(r));return t?t.href:""}ye.getProxyUrl=nS;var oS=[Dt.MovedPermanently,Dt.ResourceMoved,Dt.SeeOther,Dt.TemporaryRedirect,Dt.PermanentRedirect],aS=[Dt.BadGateway,Dt.ServiceUnavailable,Dt.GatewayTimeout],lS=["OPTIONS","GET","DELETE","HEAD"],uS=10,cS=5,ji=class extends Error{constructor(t,i){super(t),this.name="HttpClientError",this.statusCode=i,Object.setPrototypeOf(this,ji.prototype)}};ye.HttpClientError=ji;var ya=class{constructor(t){this.message=t}readBody(){return Ie(this,void 0,void 0,function*(){return new Promise(t=>Ie(this,void 0,void 0,function*(){let i=Buffer.alloc(0);this.message.on("data",s=>{i=Buffer.concat([i,s])}),this.message.on("end",()=>{t(i.toString())})}))})}};ye.HttpClientResponse=ya;function gS(r){return new URL(r).protocol==="https:"}ye.isHttps=gS;var fu=class{constructor(t,i,s){this._ignoreSslError=!1,this._allowRedirects=!0,this._allowRedirectDowngrade=!1,this._maxRedirects=50,this._allowRetries=!1,this._maxRetries=1,this._keepAlive=!1,this._disposed=!1,this.userAgent=t,this.handlers=i||[],this.requestOptions=s,s&&(s.ignoreSslError!=null&&(this._ignoreSslError=s.ignoreSslError),this._socketTimeout=s.socketTimeout,s.allowRedirects!=null&&(this._allowRedirects=s.allowRedirects),s.allowRedirectDowngrade!=null&&(this._allowRedirectDowngrade=s.allowRedirectDowngrade),s.maxRedirects!=null&&(this._maxRedirects=Math.max(s.maxRedirects,0)),s.keepAlive!=null&&(this._keepAlive=s.keepAlive),s.allowRetries!=null&&(this._allowRetries=s.allowRetries),s.maxRetries!=null&&(this._maxRetries=s.maxRetries))}options(t,i){return Ie(this,void 0,void 0,function*(){return this.request("OPTIONS",t,null,i||{})})}get(t,i){return Ie(this,void 0,void 0,function*(){return this.request("GET",t,null,i||{})})}del(t,i){return Ie(this,void 0,void 0,function*(){return this.request("DELETE",t,null,i||{})})}post(t,i,s){return Ie(this,void 0,void 0,function*(){return this.request("POST",t,i,s||{})})}patch(t,i,s){return Ie(this,void 0,void 0,function*(){return this.request("PATCH",t,i,s||{})})}put(t,i,s){return Ie(this,void 0,void 0,function*(){return this.request("PUT",t,i,s||{})})}head(t,i){return Ie(this,void 0,void 0,function*(){return this.request("HEAD",t,null,i||{})})}sendStream(t,i,s,o){return Ie(this,void 0,void 0,function*(){return this.request(t,i,s,o)})}getJson(t,i={}){return Ie(this,void 0,void 0,function*(){i[Je.Accept]=this._getExistingOrDefaultHeader(i,Je.Accept,xr.ApplicationJson);let s=yield this.get(t,i);return this._processResponse(s,this.requestOptions)})}postJson(t,i,s={}){return Ie(this,void 0,void 0,function*(){let o=JSON.stringify(i,null,2);s[Je.Accept]=this._getExistingOrDefaultHeader(s,Je.Accept,xr.ApplicationJson),s[Je.ContentType]=this._getExistingOrDefaultHeader(s,Je.ContentType,xr.ApplicationJson);let l=yield this.post(t,o,s);return this._processResponse(l,this.requestOptions)})}putJson(t,i,s={}){return Ie(this,void 0,void 0,function*(){let o=JSON.stringify(i,null,2);s[Je.Accept]=this._getExistingOrDefaultHeader(s,Je.Accept,xr.ApplicationJson),s[Je.ContentType]=this._getExistingOrDefaultHeader(s,Je.ContentType,xr.ApplicationJson);let l=yield this.put(t,o,s);return this._processResponse(l,this.requestOptions)})}patchJson(t,i,s={}){return Ie(this,void 0,void 0,function*(){let o=JSON.stringify(i,null,2);s[Je.Accept]=this._getExistingOrDefaultHeader(s,Je.Accept,xr.ApplicationJson),s[Je.ContentType]=this._getExistingOrDefaultHeader(s,Je.ContentType,xr.ApplicationJson);let l=yield this.patch(t,o,s);return this._processResponse(l,this.requestOptions)})}request(t,i,s,o){return Ie(this,void 0,void 0,function*(){if(this._disposed)throw new Error("Client has already been disposed.");let l=new URL(i),g=this._prepareRequest(t,l,o),_=this._allowRetries&&lS.includes(t)?this._maxRetries+1:1,p=0,m;do{if(m=yield this.requestRaw(g,s),m&&m.message&&m.message.statusCode===Dt.Unauthorized){let v;for(let R of this.handlers)if(R.canHandleAuthentication(m)){v=R;break}return v?v.handleAuthentication(this,g,s):m}let S=this._maxRedirects;for(;m.message.statusCode&&oS.includes(m.message.statusCode)&&this._allowRedirects&&S>0;){let v=m.message.headers.location;if(!v)break;let R=new URL(v);if(l.protocol==="https:"&&l.protocol!==R.protocol&&!this._allowRedirectDowngrade)throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.");if(yield m.readBody(),R.hostname!==l.hostname)for(let w in o)w.toLowerCase()==="authorization"&&delete o[w];g=this._prepareRequest(t,R,o),m=yield this.requestRaw(g,s),S--}if(!m.message.statusCode||!aS.includes(m.message.statusCode))return m;p+=1,p<_&&(yield m.readBody(),yield this._performExponentialBackoff(p))}while(p<_);return m})}dispose(){this._agent&&this._agent.destroy(),this._disposed=!0}requestRaw(t,i){return Ie(this,void 0,void 0,function*(){return new Promise((s,o)=>{function l(g,_){g?o(g):_?s(_):o(new Error("Unknown error"))}this.requestRawWithCallback(t,i,l)})})}requestRawWithCallback(t,i,s){typeof i=="string"&&(t.options.headers||(t.options.headers={}),t.options.headers["Content-Length"]=Buffer.byteLength(i,"utf8"));let o=!1;function l(p,m){o||(o=!0,s(p,m))}let g=t.httpModule.request(t.options,p=>{let m=new ya(p);l(void 0,m)}),_;g.on("socket",p=>{_=p}),g.setTimeout(this._socketTimeout||3*6e4,()=>{_&&_.end(),l(new Error(`Request timeout: ${t.options.path}`))}),g.on("error",function(p){l(p)}),i&&typeof i=="string"&&g.write(i,"utf8"),i&&typeof i!="string"?(i.on("close",function(){g.end()}),i.pipe(g)):g.end()}getAgent(t){let i=new URL(t);return this._getAgent(i)}_prepareRequest(t,i,s){let o={};o.parsedUrl=i;let l=o.parsedUrl.protocol==="https:";o.httpModule=l?hu:fa;let g=l?443:80;if(o.options={},o.options.host=o.parsedUrl.hostname,o.options.port=o.parsedUrl.port?parseInt(o.parsedUrl.port):g,o.options.path=(o.parsedUrl.pathname||"")+(o.parsedUrl.search||""),o.options.method=t,o.options.headers=this._mergeHeaders(s),this.userAgent!=null&&(o.options.headers["user-agent"]=this.userAgent),o.options.agent=this._getAgent(o.parsedUrl),this.handlers)for(let _ of this.handlers)_.prepareRequest(o.options);return o}_mergeHeaders(t){return this.requestOptions&&this.requestOptions.headers?Object.assign({},ma(this.requestOptions.headers),ma(t||{})):ma(t||{})}_getExistingOrDefaultHeader(t,i,s){let o;return this.requestOptions&&this.requestOptions.headers&&(o=ma(this.requestOptions.headers)[i]),t[i]||o||s}_getAgent(t){let i,s=Ad.getProxyUrl(t),o=s&&s.hostname;if(this._keepAlive&&o&&(i=this._proxyAgent),this._keepAlive&&!o&&(i=this._agent),i)return i;let l=t.protocol==="https:",g=100;if(this.requestOptions&&(g=this.requestOptions.maxSockets||fa.globalAgent.maxSockets),s&&s.hostname){let _={maxSockets:g,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(s.username||s.password)&&{proxyAuth:`${s.username}:${s.password}`}),{host:s.hostname,port:s.port})},p,m=s.protocol==="https:";l?p=m?_a.httpsOverHttps:_a.httpsOverHttp:p=m?_a.httpOverHttps:_a.httpOverHttp,i=p(_),this._proxyAgent=i}if(this._keepAlive&&!i){let _={keepAlive:this._keepAlive,maxSockets:g};i=l?new hu.Agent(_):new fa.Agent(_),this._agent=i}return i||(i=l?hu.globalAgent:fa.globalAgent),l&&this._ignoreSslError&&(i.options=Object.assign(i.options||{},{rejectUnauthorized:!1})),i}_performExponentialBackoff(t){return Ie(this,void 0,void 0,function*(){t=Math.min(uS,t);let i=cS*Math.pow(2,t);return new Promise(s=>setTimeout(()=>s(),i))})}_processResponse(t,i){return Ie(this,void 0,void 0,function*(){return new Promise((s,o)=>Ie(this,void 0,void 0,function*(){let l=t.message.statusCode||0,g={statusCode:l,result:null,headers:{}};l===Dt.NotFound&&s(g);function _(S,v){if(typeof v=="string"){let R=new Date(v);if(!isNaN(R.valueOf()))return R}return v}let p,m;try{m=yield t.readBody(),m&&m.length>0&&(i&&i.deserializeDates?p=JSON.parse(m,_):p=JSON.parse(m),g.result=p),g.headers=t.message.headers}catch(S){}if(l>299){let S;p&&p.message?S=p.message:m&&m.length>0?S=m:S=`Failed request: (${l})`;let v=new ji(S,l);v.result=g.result,o(v)}else s(g)}))})}};ye.HttpClient=fu;var ma=r=>Object.keys(r).reduce((t,i)=>(t[i.toLowerCase()]=r[i],t),{})});var vu=j(Kt=>{"use strict";var Su=Kt&&Kt.__awaiter||function(r,t,i,s){function o(l){return l instanceof i?l:new i(function(g){g(l)})}return new(i||(i=Promise))(function(l,g){function _(S){try{m(s.next(S))}catch(v){g(v)}}function p(S){try{m(s.throw(S))}catch(v){g(v)}}function m(S){S.done?l(S.value):o(S.value).then(_,p)}m((s=s.apply(r,t||[])).next())})};Object.defineProperty(Kt,"__esModule",{value:!0});Kt.PersonalAccessTokenCredentialHandler=Kt.BearerCredentialHandler=Kt.BasicCredentialHandler=void 0;var mu=class{constructor(t,i){this.username=t,this.password=i}prepareRequest(t){if(!t.headers)throw Error("The request has no headers");t.headers.Authorization=`Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return Su(this,void 0,void 0,function*(){throw new Error("not implemented")})}};Kt.BasicCredentialHandler=mu;var yu=class{constructor(t){this.token=t}prepareRequest(t){if(!t.headers)throw Error("The request has no headers");t.headers.Authorization=`Bearer ${this.token}`}canHandleAuthentication(){return!1}handleAuthentication(){return Su(this,void 0,void 0,function*(){throw new Error("not implemented")})}};Kt.BearerCredentialHandler=yu;var bu=class{constructor(t){this.token=t}prepareRequest(t){if(!t.headers)throw Error("The request has no headers");t.headers.Authorization=`Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return Su(this,void 0,void 0,function*(){throw new Error("not implemented")})}};Kt.PersonalAccessTokenCredentialHandler=bu});var Od=j(Bi=>{"use strict";var Rd=Bi&&Bi.__awaiter||function(r,t,i,s){function o(l){return l instanceof i?l:new i(function(g){g(l)})}return new(i||(i=Promise))(function(l,g){function _(S){try{m(s.next(S))}catch(v){g(v)}}function p(S){try{m(s.throw(S))}catch(v){g(v)}}function m(S){S.done?l(S.value):o(S.value).then(_,p)}m((s=s.apply(r,t||[])).next())})};Object.defineProperty(Bi,"__esModule",{value:!0});Bi.OidcClient=void 0;var pS=_u(),dS=vu(),wd=Eu(),Ir=class{static createHttpClient(t=!0,i=10){let s={allowRetries:t,maxRetries:i};return new pS.HttpClient("actions/oidc-client",[new dS.BearerCredentialHandler(Ir.getRequestToken())],s)}static getRequestToken(){let t=process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;if(!t)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable");return t}static getIDTokenUrl(){let t=process.env.ACTIONS_ID_TOKEN_REQUEST_URL;if(!t)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable");return t}static getCall(t){var i;return Rd(this,void 0,void 0,function*(){let l=(i=(yield Ir.createHttpClient().getJson(t).catch(g=>{throw new Error(`Failed to get ID Token. - Error Code : ${o.statusCode} + Error Code : ${g.statusCode} - Error Message: ${o.result.message}`)})).result)===null||r===void 0?void 0:r.value;if(!s)throw new Error("Response json body do not have ID Token field");return s})}static getIDToken(t){return Dt(this,void 0,void 0,function*(){try{let r=x.getIDTokenUrl();if(t){let i=encodeURIComponent(t);r=`${r}&audience=${i}`}Nt.debug(`ID token url is ${r}`);let n=yield x.getCall(r);return Nt.setSecret(n),n}catch(r){throw new Error(`Error message: ${r.message}`)}})}};j.OidcClient=x});var Ie=_(w=>{"use strict";var xe=w&&w.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(l){try{a(n.next(l))}catch(d){o(d)}}function u(l){try{a(n.throw(l))}catch(d){o(d)}}function a(l){l.done?s(l.value):i(l.value).then(c,u)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(w,"__esModule",{value:!0});w.summary=w.markdownSummary=w.SUMMARY_DOCS_URL=w.SUMMARY_ENV_VAR=void 0;var Fn=require("os"),De=require("fs"),{access:Gn,appendFile:Jn,writeFile:Hn}=De.promises;w.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";w.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";var Ne=class{constructor(){this._buffer=""}filePath(){return xe(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;let t=process.env[w.SUMMARY_ENV_VAR];if(!t)throw new Error(`Unable to find environment variable for $${w.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield Gn(t,De.constants.R_OK|De.constants.W_OK)}catch(r){throw new Error(`Unable to access summary file: '${t}'. Check if the file has correct read/write permissions.`)}return this._filePath=t,this._filePath})}wrap(t,r,n={}){let i=Object.entries(n).map(([s,o])=>` ${s}="${o}"`).join("");return r?`<${t}${i}>${r}`:`<${t}${i}>`}write(t){return xe(this,void 0,void 0,function*(){let r=!!(t!=null&&t.overwrite),n=yield this.filePath();return yield(r?Hn:Jn)(n,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return xe(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw(t,r=!1){return this._buffer+=t,r?this.addEOL():this}addEOL(){return this.addRaw(Fn.EOL)}addCodeBlock(t,r){let n=Object.assign({},r&&{lang:r}),i=this.wrap("pre",this.wrap("code",t),n);return this.addRaw(i).addEOL()}addList(t,r=!1){let n=r?"ol":"ul",i=t.map(o=>this.wrap("li",o)).join(""),s=this.wrap(n,i);return this.addRaw(s).addEOL()}addTable(t){let r=t.map(i=>{let s=i.map(o=>{if(typeof o=="string")return this.wrap("td",o);let{header:c,data:u,colspan:a,rowspan:l}=o,d=c?"th":"td",h=Object.assign(Object.assign({},a&&{colspan:a}),l&&{rowspan:l});return this.wrap(d,u,h)}).join("");return this.wrap("tr",s)}).join(""),n=this.wrap("table",r);return this.addRaw(n).addEOL()}addDetails(t,r){let n=this.wrap("details",this.wrap("summary",t)+r);return this.addRaw(n).addEOL()}addImage(t,r,n){let{width:i,height:s}=n||{},o=Object.assign(Object.assign({},i&&{width:i}),s&&{height:s}),c=this.wrap("img",null,Object.assign({src:t,alt:r},o));return this.addRaw(c).addEOL()}addHeading(t,r){let n=`h${r}`,i=["h1","h2","h3","h4","h5","h6"].includes(n)?n:"h1",s=this.wrap(i,t);return this.addRaw(s).addEOL()}addSeparator(){let t=this.wrap("hr",null);return this.addRaw(t).addEOL()}addBreak(){let t=this.wrap("br",null);return this.addRaw(t).addEOL()}addQuote(t,r){let n=Object.assign({},r&&{cite:r}),i=this.wrap("blockquote",t,n);return this.addRaw(i).addEOL()}addLink(t,r){let n=this.wrap("a",t,{href:r});return this.addRaw(n).addEOL()}},Bt=new Ne;w.markdownSummary=Bt;w.summary=Bt});var $t=_(O=>{"use strict";var Kn=O&&O.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),zn=O&&O.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Wn=O&&O.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&Kn(t,e,r);return zn(t,e),t};Object.defineProperty(O,"__esModule",{value:!0});O.toPlatformPath=O.toWin32Path=O.toPosixPath=void 0;var Yn=Wn(require("path"));function Qn(e){return e.replace(/[\\]/g,"/")}O.toPosixPath=Qn;function Xn(e){return e.replace(/[/]/g,"\\")}O.toWin32Path=Xn;function Zn(e){return e.replace(/[/\\]/g,Yn.sep)}O.toPlatformPath=Zn});var Ue=_(f=>{"use strict";var ei=f&&f.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ti=f&&f.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Lt=f&&f.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&ei(t,e,r);return ti(t,e),t},kt=f&&f.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(l){try{a(n.next(l))}catch(d){o(d)}}function u(l){try{a(n.throw(l))}catch(d){o(d)}}function a(l){l.done?s(l.value):i(l.value).then(c,u)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(f,"__esModule",{value:!0});f.getIDToken=f.getState=f.saveState=f.group=f.endGroup=f.startGroup=f.info=f.notice=f.warning=f.error=f.debug=f.isDebug=f.setFailed=f.setCommandEcho=f.setOutput=f.getBooleanInput=f.getMultilineInput=f.getInput=f.addPath=f.setSecret=f.exportVariable=f.ExitCode=void 0;var S=rt(),N=St(),V=H(),jt=Lt(require("os")),ri=Lt(require("path")),ni=It(),Vt;(function(e){e[e.Success=0]="Success",e[e.Failure=1]="Failure"})(Vt=f.ExitCode||(f.ExitCode={}));function ii(e,t){let r=V.toCommandValue(t);if(process.env[e]=r,process.env.GITHUB_ENV||"")return N.issueFileCommand("ENV",N.prepareKeyValueMessage(e,t));S.issueCommand("set-env",{name:e},r)}f.exportVariable=ii;function si(e){S.issueCommand("add-mask",{},e)}f.setSecret=si;function oi(e){process.env.GITHUB_PATH||""?N.issueFileCommand("PATH",e):S.issueCommand("add-path",{},e),process.env.PATH=`${e}${ri.delimiter}${process.env.PATH}`}f.addPath=oi;function Be(e,t){let r=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!r)throw new Error(`Input required and not supplied: ${e}`);return t&&t.trimWhitespace===!1?r:r.trim()}f.getInput=Be;function ai(e,t){let r=Be(e,t).split(` -`).filter(n=>n!=="");return t&&t.trimWhitespace===!1?r:r.map(n=>n.trim())}f.getMultilineInput=ai;function ui(e,t){let r=["true","True","TRUE"],n=["false","False","FALSE"],i=Be(e,t);if(r.includes(i))return!0;if(n.includes(i))return!1;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${e} -Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}f.getBooleanInput=ui;function ci(e,t){if(process.env.GITHUB_OUTPUT||"")return N.issueFileCommand("OUTPUT",N.prepareKeyValueMessage(e,t));process.stdout.write(jt.EOL),S.issueCommand("set-output",{name:e},V.toCommandValue(t))}f.setOutput=ci;function li(e){S.issue("echo",e?"on":"off")}f.setCommandEcho=li;function fi(e){process.exitCode=Vt.Failure,Ft(e)}f.setFailed=fi;function di(){return process.env.RUNNER_DEBUG==="1"}f.isDebug=di;function hi(e){S.issueCommand("debug",{},e)}f.debug=hi;function Ft(e,t={}){S.issueCommand("error",V.toCommandProperties(t),e instanceof Error?e.toString():e)}f.error=Ft;function pi(e,t={}){S.issueCommand("warning",V.toCommandProperties(t),e instanceof Error?e.toString():e)}f.warning=pi;function _i(e,t={}){S.issueCommand("notice",V.toCommandProperties(t),e instanceof Error?e.toString():e)}f.notice=_i;function vi(e){process.stdout.write(e+jt.EOL)}f.info=vi;function Gt(e){S.issue("group",e)}f.startGroup=Gt;function Jt(){S.issue("endgroup")}f.endGroup=Jt;function mi(e,t){return kt(this,void 0,void 0,function*(){Gt(e);let r;try{r=yield t()}finally{Jt()}return r})}f.group=mi;function gi(e,t){if(process.env.GITHUB_STATE||"")return N.issueFileCommand("STATE",N.prepareKeyValueMessage(e,t));S.issueCommand("save-state",{name:e},V.toCommandValue(t))}f.saveState=gi;function yi(e){return process.env[`STATE_${e}`]||""}f.getState=yi;function wi(e){return kt(this,void 0,void 0,function*(){return yield ni.OidcClient.getIDToken(e)})}f.getIDToken=wi;var Oi=Ie();Object.defineProperty(f,"summary",{enumerable:!0,get:function(){return Oi.summary}});var bi=Ie();Object.defineProperty(f,"markdownSummary",{enumerable:!0,get:function(){return bi.markdownSummary}});var $e=$t();Object.defineProperty(f,"toPosixPath",{enumerable:!0,get:function(){return $e.toPosixPath}});Object.defineProperty(f,"toWin32Path",{enumerable:!0,get:function(){return $e.toWin32Path}});Object.defineProperty(f,"toPlatformPath",{enumerable:!0,get:function(){return $e.toPlatformPath}})});var Kt={};Ye(Kt,{ActionsCache:()=>je});function Le(e){return e?200<=e&&e<300:!1}var ke,Ht,je,zt=We(()=>{"use strict";ke=de(Ee()),Ht=de(Me());je=class{constructor(t,r){this.baseUrl=t,this.token=r,this.httpClient=new ke.HttpClient("bazel-github-actions-cache",[new Ht.BearerCredentialHandler(r)],{headers:{Accept:"application/json;api-version=6.0-preview.1"}})}putCache(t,r,n,i){return I(this,null,function*(){var g;let c={key:`${t}-${r}`,version:"b",cacheSize:n},u=yield this.httpClient.postJson(`${this.baseUrl}caches`,c),a=(g=u==null?void 0:u.result)==null?void 0:g.cacheId;if(!a)return i.resume(),!1;let l=yield this.httpClient.sendStream("PATCH",`${this.baseUrl}caches/${a}`,i,{"Content-Type":"application/octet-stream","Content-Range":`bytes 0-${n-1}/*`});if(!Le(l.message.statusCode))return i.resume(),!1;let d={size:n},h=yield this.httpClient.postJson(`${this.baseUrl}caches/${a}`,d);return!!Le(h.statusCode)})}getCache(t,r){return I(this,null,function*(){var a;let n=`${t}-${r}`,i="b",s=yield this.httpClient.getJson(`${this.baseUrl}cache?keys=${n}&version=${i}`),o=(a=s==null?void 0:s.result)==null?void 0:a.archiveLocation;if(!o)return null;let u=yield new ke.HttpClient("bazel-github-actions-cache").get(o);return Le(u.message.statusCode)?u.message:(u.message.resume(),null)})}}});var Yt={};Ye(Yt,{HttpServer:()=>Fe});var Wt,Ve,Fe,Qt=We(()=>{"use strict";Wt=de(require("http")),Ve=require("url"),Fe=class extends Wt.Server{constructor(r){super();this.n_get=0;this.n_get_hit=0;this.n_put=0;this.n_put_succ=0;this.n_put_bytes=0;this.actionsCache=r,this.on("request",this.onRequest)}getStats(){return{n_get:this.n_get,n_get_hit:this.n_get_hit,n_put:this.n_put,n_put_succ:this.n_put_succ,n_put_bytes:this.n_put_bytes}}get_close(r,n){this.close(),n.writeHead(200,{"Content-type":"application/json"}),n.end(JSON.stringify(this.getStats()))}get_cas(r,n){return I(this,null,function*(){var u,a,l,d,h;let i=(0,Ve.parse)((u=r.url)!=null?u:""),s=(l=(a=i.pathname)==null?void 0:a.startsWith("/cas/"))!=null?l:!1,o=(h=(d=i.pathname)==null?void 0:d.substring(s?5:4))!=null?h:"",c=s?"cas":"ac";if(r.method=="PUT"){this.n_put+=1;let g=Number(r.headers["content-length"]),T=!1;try{T=yield this.actionsCache.putCache(c,o,g,r)}catch(xi){}T?(this.n_put_succ+=1,this.n_put_bytes+=g,n.writeHead(200)):n.writeHead(500),n.end()}else if(r.method=="GET"){this.n_get+=1;let g=null;try{g=yield this.actionsCache.getCache(c,o)}catch(T){}g?(this.n_get_hit+=1,n.writeHead(200,{"Content-Type":"application/octet-stream"}),g.pipe(n)):(n.writeHead(404),n.end())}})}onRequest(r,n){return I(this,null,function*(){var s,o,c,u;let i=(0,Ve.parse)((s=r.url)!=null?s:"");i.pathname=="/close"?this.get_close(r,n):(o=i.pathname)!=null&&o.startsWith("/_apis/artifactcache/")?(n.writeHead(404),n.end()):((c=i.pathname)==null?void 0:c.startsWith("/cas/"))||((u=i.pathname)==null?void 0:u.startsWith("/ac/"))?this.get_cas(r,n):(n.writeHead(404),n.end())})}}});var Ri=exports&&exports.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Si=exports&&exports.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Pi=exports&&exports.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Ri(t,e,r);return Si(t,e),t};Object.defineProperty(exports,"__esModule",{value:!0});var Ei=require("child_process"),qi=Pi(Ue()),Ti=(zt(),Xe(Kt)),Ai=(Qt(),Xe(Yt)),Ci=[];function Mi(e){qi.debug(e),Ci.push(e)}process.env.IS_BACKGROUND?Ui():(console.log("spawning"),Mi("foreground"),(0,Ei.spawn)(process.execPath,process.argv.slice(1),{detached:!0,stdio:"inherit",env:ze(Ke({},process.env),{IS_BACKGROUND:"1"})}).unref());function Ui(){var s;let t=`${process.env.ACTIONS_CACHE_URL||"http://localhost:3056/"}_apis/artifactcache/`,r=(s=process.env.ACTIONS_RUNTIME_TOKEN)!=null?s:"",n=new Ti.ActionsCache(t,r),i=new Ai.HttpServer(n);i.on("close",()=>{console.log("Goodbye: "+JSON.stringify(i.getStats()))}),i.listen(3055)} + Error Message: ${g.result.message}`)})).result)===null||i===void 0?void 0:i.value;if(!l)throw new Error("Response json body do not have ID Token field");return l})}static getIDToken(t){return Rd(this,void 0,void 0,function*(){try{let i=Ir.getIDTokenUrl();if(t){let o=encodeURIComponent(t);i=`${i}&audience=${o}`}wd.debug(`ID token url is ${i}`);let s=yield Ir.getCall(i);return wd.setSecret(s),s}catch(i){throw new Error(`Error message: ${i.message}`)}})}};Bi.OidcClient=Ir});var wu=j(st=>{"use strict";var Tu=st&&st.__awaiter||function(r,t,i,s){function o(l){return l instanceof i?l:new i(function(g){g(l)})}return new(i||(i=Promise))(function(l,g){function _(S){try{m(s.next(S))}catch(v){g(v)}}function p(S){try{m(s.throw(S))}catch(v){g(v)}}function m(S){S.done?l(S.value):o(S.value).then(_,p)}m((s=s.apply(r,t||[])).next())})};Object.defineProperty(st,"__esModule",{value:!0});st.summary=st.markdownSummary=st.SUMMARY_DOCS_URL=st.SUMMARY_ENV_VAR=void 0;var hS=require("os"),Au=require("fs"),{access:fS,appendFile:_S,writeFile:mS}=Au.promises;st.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";st.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";var Ru=class{constructor(){this._buffer=""}filePath(){return Tu(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;let t=process.env[st.SUMMARY_ENV_VAR];if(!t)throw new Error(`Unable to find environment variable for $${st.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield fS(t,Au.constants.R_OK|Au.constants.W_OK)}catch(i){throw new Error(`Unable to access summary file: '${t}'. Check if the file has correct read/write permissions.`)}return this._filePath=t,this._filePath})}wrap(t,i,s={}){let o=Object.entries(s).map(([l,g])=>` ${l}="${g}"`).join("");return i?`<${t}${o}>${i}`:`<${t}${o}>`}write(t){return Tu(this,void 0,void 0,function*(){let i=!!(t!=null&&t.overwrite),s=yield this.filePath();return yield(i?mS:_S)(s,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return Tu(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw(t,i=!1){return this._buffer+=t,i?this.addEOL():this}addEOL(){return this.addRaw(hS.EOL)}addCodeBlock(t,i){let s=Object.assign({},i&&{lang:i}),o=this.wrap("pre",this.wrap("code",t),s);return this.addRaw(o).addEOL()}addList(t,i=!1){let s=i?"ol":"ul",o=t.map(g=>this.wrap("li",g)).join(""),l=this.wrap(s,o);return this.addRaw(l).addEOL()}addTable(t){let i=t.map(o=>{let l=o.map(g=>{if(typeof g=="string")return this.wrap("td",g);let{header:_,data:p,colspan:m,rowspan:S}=g,v=_?"th":"td",R=Object.assign(Object.assign({},m&&{colspan:m}),S&&{rowspan:S});return this.wrap(v,p,R)}).join("");return this.wrap("tr",l)}).join(""),s=this.wrap("table",i);return this.addRaw(s).addEOL()}addDetails(t,i){let s=this.wrap("details",this.wrap("summary",t)+i);return this.addRaw(s).addEOL()}addImage(t,i,s){let{width:o,height:l}=s||{},g=Object.assign(Object.assign({},o&&{width:o}),l&&{height:l}),_=this.wrap("img",null,Object.assign({src:t,alt:i},g));return this.addRaw(_).addEOL()}addHeading(t,i){let s=`h${i}`,o=["h1","h2","h3","h4","h5","h6"].includes(s)?s:"h1",l=this.wrap(o,t);return this.addRaw(l).addEOL()}addSeparator(){let t=this.wrap("hr",null);return this.addRaw(t).addEOL()}addBreak(){let t=this.wrap("br",null);return this.addRaw(t).addEOL()}addQuote(t,i){let s=Object.assign({},i&&{cite:i}),o=this.wrap("blockquote",t,s);return this.addRaw(o).addEOL()}addLink(t,i){let s=this.wrap("a",t,{href:i});return this.addRaw(s).addEOL()}},Cd=new Ru;st.markdownSummary=Cd;st.summary=Cd});var Md=j(nt=>{"use strict";var yS=nt&&nt.__createBinding||(Object.create?function(r,t,i,s){s===void 0&&(s=i),Object.defineProperty(r,s,{enumerable:!0,get:function(){return t[i]}})}:function(r,t,i,s){s===void 0&&(s=i),r[s]=t[i]}),bS=nt&&nt.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),SS=nt&&nt.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var i in r)i!=="default"&&Object.hasOwnProperty.call(r,i)&&yS(t,r,i);return bS(t,r),t};Object.defineProperty(nt,"__esModule",{value:!0});nt.toPlatformPath=nt.toWin32Path=nt.toPosixPath=void 0;var vS=SS(require("path"));function ES(r){return r.replace(/[\\]/g,"/")}nt.toPosixPath=ES;function TS(r){return r.replace(/[/]/g,"\\")}nt.toWin32Path=TS;function AS(r){return r.replace(/[/\\]/g,vS.sep)}nt.toPlatformPath=AS});var Eu=j(X=>{"use strict";var RS=X&&X.__createBinding||(Object.create?function(r,t,i,s){s===void 0&&(s=i),Object.defineProperty(r,s,{enumerable:!0,get:function(){return t[i]}})}:function(r,t,i,s){s===void 0&&(s=i),r[s]=t[i]}),wS=X&&X.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),jd=X&&X.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var i in r)i!=="default"&&Object.hasOwnProperty.call(r,i)&&RS(t,r,i);return wS(t,r),t},Bd=X&&X.__awaiter||function(r,t,i,s){function o(l){return l instanceof i?l:new i(function(g){g(l)})}return new(i||(i=Promise))(function(l,g){function _(S){try{m(s.next(S))}catch(v){g(v)}}function p(S){try{m(s.throw(S))}catch(v){g(v)}}function m(S){S.done?l(S.value):o(S.value).then(_,p)}m((s=s.apply(r,t||[])).next())})};Object.defineProperty(X,"__esModule",{value:!0});X.getIDToken=X.getState=X.saveState=X.group=X.endGroup=X.startGroup=X.info=X.notice=X.warning=X.error=X.debug=X.isDebug=X.setFailed=X.setCommandEcho=X.setOutput=X.getBooleanInput=X.getMultilineInput=X.getInput=X.addPath=X.setSecret=X.exportVariable=X.ExitCode=void 0;var yt=Yp(),gi=fd(),Ni=ea(),Nd=jd(require("os")),OS=jd(require("path")),CS=Od(),xd;(function(r){r[r.Success=0]="Success",r[r.Failure=1]="Failure"})(xd=X.ExitCode||(X.ExitCode={}));function MS(r,t){let i=Ni.toCommandValue(t);if(process.env[r]=i,process.env.GITHUB_ENV||"")return gi.issueFileCommand("ENV",gi.prepareKeyValueMessage(r,t));yt.issueCommand("set-env",{name:r},i)}X.exportVariable=MS;function jS(r){yt.issueCommand("add-mask",{},r)}X.setSecret=jS;function BS(r){process.env.GITHUB_PATH||""?gi.issueFileCommand("PATH",r):yt.issueCommand("add-path",{},r),process.env.PATH=`${r}${OS.delimiter}${process.env.PATH}`}X.addPath=BS;function Ou(r,t){let i=process.env[`INPUT_${r.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!i)throw new Error(`Input required and not supplied: ${r}`);return t&&t.trimWhitespace===!1?i:i.trim()}X.getInput=Ou;function NS(r,t){let i=Ou(r,t).split(` +`).filter(s=>s!=="");return t&&t.trimWhitespace===!1?i:i.map(s=>s.trim())}X.getMultilineInput=NS;function xS(r,t){let i=["true","True","TRUE"],s=["false","False","FALSE"],o=Ou(r,t);if(i.includes(o))return!0;if(s.includes(o))return!1;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${r} +Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}X.getBooleanInput=xS;function IS(r,t){if(process.env.GITHUB_OUTPUT||"")return gi.issueFileCommand("OUTPUT",gi.prepareKeyValueMessage(r,t));process.stdout.write(Nd.EOL),yt.issueCommand("set-output",{name:r},Ni.toCommandValue(t))}X.setOutput=IS;function FS(r){yt.issue("echo",r?"on":"off")}X.setCommandEcho=FS;function US(r){process.exitCode=xd.Failure,Id(r)}X.setFailed=US;function DS(){return process.env.RUNNER_DEBUG==="1"}X.isDebug=DS;function PS(r){yt.issueCommand("debug",{},r)}X.debug=PS;function Id(r,t={}){yt.issueCommand("error",Ni.toCommandProperties(t),r instanceof Error?r.toString():r)}X.error=Id;function kS(r,t={}){yt.issueCommand("warning",Ni.toCommandProperties(t),r instanceof Error?r.toString():r)}X.warning=kS;function LS(r,t={}){yt.issueCommand("notice",Ni.toCommandProperties(t),r instanceof Error?r.toString():r)}X.notice=LS;function zS(r){process.stdout.write(r+Nd.EOL)}X.info=zS;function Fd(r){yt.issue("group",r)}X.startGroup=Fd;function Ud(){yt.issue("endgroup")}X.endGroup=Ud;function WS(r,t){return Bd(this,void 0,void 0,function*(){Fd(r);let i;try{i=yield t()}finally{Ud()}return i})}X.group=WS;function qS(r,t){if(process.env.GITHUB_STATE||"")return gi.issueFileCommand("STATE",gi.prepareKeyValueMessage(r,t));yt.issueCommand("save-state",{name:r},Ni.toCommandValue(t))}X.saveState=qS;function HS(r){return process.env[`STATE_${r}`]||""}X.getState=HS;function VS(r){return Bd(this,void 0,void 0,function*(){return yield CS.OidcClient.getIDToken(r)})}X.getIDToken=VS;var GS=wu();Object.defineProperty(X,"summary",{enumerable:!0,get:function(){return GS.summary}});var YS=wu();Object.defineProperty(X,"markdownSummary",{enumerable:!0,get:function(){return YS.markdownSummary}});var Cu=Md();Object.defineProperty(X,"toPosixPath",{enumerable:!0,get:function(){return Cu.toPosixPath}});Object.defineProperty(X,"toWin32Path",{enumerable:!0,get:function(){return Cu.toWin32Path}});Object.defineProperty(X,"toPlatformPath",{enumerable:!0,get:function(){return Cu.toPlatformPath}})});var Pd={};tu(Pd,{ActionsCache:()=>Bu});function Mu(r){return r?200<=r&&r<300:!1}var ju,Dd,Bu,kd=ft(()=>{"use strict";ju=it(_u()),Dd=it(vu());Bu=class{constructor(t,i){this.baseUrl=t,this.token=i,this.httpClient=new ju.HttpClient("bazel-github-actions-cache",[new Dd.BearerCredentialHandler(i)],{headers:{Accept:"application/json;api-version=6.0-preview.1"}})}putCache(t,i,s,o){return de(this,null,function*(){var w;let _={key:`${t}-${i}`,version:"b",cacheSize:s},p=yield this.httpClient.postJson(`${this.baseUrl}caches`,_),m=(w=p==null?void 0:p.result)==null?void 0:w.cacheId;if(!m)return o.resume(),!1;let S=yield this.httpClient.sendStream("PATCH",`${this.baseUrl}caches/${m}`,o,{"Content-Type":"application/octet-stream","Content-Range":`bytes 0-${s-1}/*`});if(!Mu(S.message.statusCode))return o.resume(),!1;let v={size:s},R=yield this.httpClient.postJson(`${this.baseUrl}caches/${m}`,v);return!!Mu(R.statusCode)})}getCache(t,i){return de(this,null,function*(){var m;let s=`${t}-${i}`,o="b",l=yield this.httpClient.getJson(`${this.baseUrl}cache?keys=${s}&version=${o}`),g=(m=l==null?void 0:l.result)==null?void 0:m.archiveLocation;if(!g)return null;let p=yield new ju.HttpClient("bazel-github-actions-cache").get(g);return Mu(p.message.statusCode)?p.message:(p.message.resume(),null)})}}});var zd={};tu(zd,{HttpServer:()=>xu});var Ld,Nu,xu,Wd=ft(()=>{"use strict";Ld=it(require("http")),Nu=require("url"),xu=class extends Ld.Server{constructor(i){super();this.n_get=0;this.n_get_hit=0;this.n_put=0;this.n_put_succ=0;this.n_put_bytes=0;this.actionsCache=i,this.on("request",this.onRequest)}getStats(){return{n_get:this.n_get,n_get_hit:this.n_get_hit,n_put:this.n_put,n_put_succ:this.n_put_succ,n_put_bytes:this.n_put_bytes}}get_close(i,s){this.close(),s.writeHead(200,{"Content-type":"application/json"}),s.end(JSON.stringify(this.getStats()))}get_cas(i,s){return de(this,null,function*(){var p,m,S,v,R;let o=(0,Nu.parse)((p=i.url)!=null?p:""),l=(S=(m=o.pathname)==null?void 0:m.startsWith("/cas/"))!=null?S:!1,g=(R=(v=o.pathname)==null?void 0:v.substring(l?5:4))!=null?R:"",_=l?"cas":"ac";if(i.method=="PUT"){this.n_put+=1;let w=Number(i.headers["content-length"]),B=!1;try{B=yield this.actionsCache.putCache(_,g,w,i)}catch(I){}B?(this.n_put_succ+=1,this.n_put_bytes+=w,s.writeHead(200)):s.writeHead(500),s.end()}else if(i.method=="GET"){this.n_get+=1;let w=null;try{w=yield this.actionsCache.getCache(_,g)}catch(B){}w?(this.n_get_hit+=1,s.writeHead(200,{"Content-Type":"application/octet-stream"}),w.pipe(s)):(s.writeHead(404),s.end())}})}onRequest(i,s){return de(this,null,function*(){var l,g,_,p;let o=(0,Nu.parse)((l=i.url)!=null?l:"");o.pathname=="/close"?this.get_close(i,s):(g=o.pathname)!=null&&g.startsWith("/_apis/artifactcache/")?(s.writeHead(404),s.end()):((_=o.pathname)==null?void 0:_.startsWith("/cas/"))||((p=o.pathname)==null?void 0:p.startsWith("/ac/"))?this.get_cas(i,s):(s.writeHead(404),s.end())})}}});var be=j(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=Ze.DEFAULT_MAX_SEND_MESSAGE_LENGTH=Ze.Propagate=Ze.LogVerbosity=Ze.Status=void 0;var $S;(function(r){r[r.OK=0]="OK",r[r.CANCELLED=1]="CANCELLED",r[r.UNKNOWN=2]="UNKNOWN",r[r.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",r[r.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",r[r.NOT_FOUND=5]="NOT_FOUND",r[r.ALREADY_EXISTS=6]="ALREADY_EXISTS",r[r.PERMISSION_DENIED=7]="PERMISSION_DENIED",r[r.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",r[r.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",r[r.ABORTED=10]="ABORTED",r[r.OUT_OF_RANGE=11]="OUT_OF_RANGE",r[r.UNIMPLEMENTED=12]="UNIMPLEMENTED",r[r.INTERNAL=13]="INTERNAL",r[r.UNAVAILABLE=14]="UNAVAILABLE",r[r.DATA_LOSS=15]="DATA_LOSS",r[r.UNAUTHENTICATED=16]="UNAUTHENTICATED"})($S=Ze.Status||(Ze.Status={}));var KS;(function(r){r[r.DEBUG=0]="DEBUG",r[r.INFO=1]="INFO",r[r.ERROR=2]="ERROR",r[r.NONE=3]="NONE"})(KS=Ze.LogVerbosity||(Ze.LogVerbosity={}));var XS;(function(r){r[r.DEADLINE=1]="DEADLINE",r[r.CENSUS_STATS_CONTEXT=2]="CENSUS_STATS_CONTEXT",r[r.CENSUS_TRACING_CONTEXT=4]="CENSUS_TRACING_CONTEXT",r[r.CANCELLATION=8]="CANCELLATION",r[r.DEFAULTS=65535]="DEFAULTS"})(XS=Ze.Propagate||(Ze.Propagate={}));Ze.DEFAULT_MAX_SEND_MESSAGE_LENGTH=-1;Ze.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=4*1024*1024});var Ue=j(Qe=>{"use strict";var Iu,Fu,Uu,Du;Object.defineProperty(Qe,"__esModule",{value:!0});Qe.isTracerEnabled=Qe.trace=Qe.log=Qe.setLoggerVerbosity=Qe.setLogger=Qe.getLogger=void 0;var Fr=be(),JS={error:(r,...t)=>{console.error("E "+r,...t)},info:(r,...t)=>{console.error("I "+r,...t)},debug:(r,...t)=>{console.error("D "+r,...t)}},pi=JS,xi=Fr.LogVerbosity.ERROR,ZS=(Fu=(Iu=process.env.GRPC_NODE_VERBOSITY)!==null&&Iu!==void 0?Iu:process.env.GRPC_VERBOSITY)!==null&&Fu!==void 0?Fu:"";switch(ZS.toUpperCase()){case"DEBUG":xi=Fr.LogVerbosity.DEBUG;break;case"INFO":xi=Fr.LogVerbosity.INFO;break;case"ERROR":xi=Fr.LogVerbosity.ERROR;break;case"NONE":xi=Fr.LogVerbosity.NONE;break;default:}Qe.getLogger=()=>pi;Qe.setLogger=r=>{pi=r};Qe.setLoggerVerbosity=r=>{xi=r};Qe.log=(r,...t)=>{let i;if(r>=xi){switch(r){case Fr.LogVerbosity.DEBUG:i=pi.debug;break;case Fr.LogVerbosity.INFO:i=pi.info;break;case Fr.LogVerbosity.ERROR:i=pi.error;break}i||(i=pi.error),i&&i.bind(pi)(...t)}};var QS=(Du=(Uu=process.env.GRPC_NODE_TRACE)!==null&&Uu!==void 0?Uu:process.env.GRPC_TRACE)!==null&&Du!==void 0?Du:"",Pu=new Set,qd=new Set;for(let r of QS.split(","))r.startsWith("-")?qd.add(r.substring(1)):Pu.add(r);var ev=Pu.has("all");function tv(r,t,i){Hd(t)&&Qe.log(r,new Date().toISOString()+" | "+t+" | "+i)}Qe.trace=tv;function Hd(r){return!qd.has(r)&&(ev||Pu.has(r))}Qe.isTracerEnabled=Hd});var Pt=j(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.Metadata=void 0;var rv=Ue(),iv=be(),sv=/^[0-9a-z_.-]+$/,nv=/^[ -~]*$/;function ov(r){return sv.test(r)}function av(r){return nv.test(r)}function Gd(r){return r.endsWith("-bin")}function lv(r){return!r.startsWith("grpc-")}function Sa(r){return r.toLowerCase()}function Vd(r,t){if(!ov(r))throw new Error('Metadata key "'+r+'" contains illegal characters');if(t!=null)if(Gd(r)){if(!Buffer.isBuffer(t))throw new Error("keys that end with '-bin' must have Buffer values")}else{if(Buffer.isBuffer(t))throw new Error("keys that don't end with '-bin' must have String values");if(!av(t))throw new Error('Metadata string value "'+t+'" contains illegal characters')}}var Ii=class{constructor(t={}){this.internalRepr=new Map,this.options=t}set(t,i){t=Sa(t),Vd(t,i),this.internalRepr.set(t,[i])}add(t,i){t=Sa(t),Vd(t,i);let s=this.internalRepr.get(t);s===void 0?this.internalRepr.set(t,[i]):s.push(i)}remove(t){t=Sa(t),this.internalRepr.delete(t)}get(t){return t=Sa(t),this.internalRepr.get(t)||[]}getMap(){let t={};for(let[i,s]of this.internalRepr)if(s.length>0){let o=s[0];t[i]=Buffer.isBuffer(o)?Buffer.from(o):o}return t}clone(){let t=new Ii(this.options),i=t.internalRepr;for(let[s,o]of this.internalRepr){let l=o.map(g=>Buffer.isBuffer(g)?Buffer.from(g):g);i.set(s,l)}return t}merge(t){for(let[i,s]of t.internalRepr){let o=(this.internalRepr.get(i)||[]).concat(s);this.internalRepr.set(i,o)}}setOptions(t){this.options=t}getOptions(){return this.options}toHttp2Headers(){let t={};for(let[i,s]of this.internalRepr)t[i]=s.map(uv);return t}_getCoreRepresentation(){return this.internalRepr}toJSON(){let t={};for(let[i,s]of this.internalRepr)t[i]=s;return t}static fromHttp2Headers(t){let i=new Ii;for(let s of Object.keys(t)){if(s.charAt(0)===":")continue;let o=t[s];try{Gd(s)?Array.isArray(o)?o.forEach(l=>{i.add(s,Buffer.from(l,"base64"))}):o!==void 0&&(lv(s)?o.split(",").forEach(l=>{i.add(s,Buffer.from(l.trim(),"base64"))}):i.add(s,Buffer.from(o,"base64"))):Array.isArray(o)?o.forEach(l=>{i.add(s,l)}):o!==void 0&&i.add(s,o)}catch(l){let g=`Failed to add metadata entry ${s}: ${o}. ${l.message}. For more information see https://github.com/grpc/grpc-node/issues/1173`;rv.log(iv.LogVerbosity.ERROR,g)}}return i}};va.Metadata=Ii;var uv=r=>Buffer.isBuffer(r)?r.toString("base64"):r});var Lu=j(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});Ea.CallCredentials=void 0;var ku=Pt();function cv(r){return"getRequestHeaders"in r&&typeof r.getRequestHeaders=="function"}var Ur=class{static createFromMetadataGenerator(t){return new vn(t)}static createFromGoogleCredential(t){return Ur.createFromMetadataGenerator((i,s)=>{let o;cv(t)?o=t.getRequestHeaders(i.service_url):o=new Promise((l,g)=>{t.getRequestMetadata(i.service_url,(_,p)=>{if(_){g(_);return}l(p)})}),o.then(l=>{let g=new ku.Metadata;for(let _ of Object.keys(l))g.add(_,l[_]);s(null,g)},l=>{s(l)})})}static createEmpty(){return new En}};Ea.CallCredentials=Ur;var Fi=class extends Ur{constructor(t){super(),this.creds=t}generateMetadata(t){return de(this,null,function*(){let i=new ku.Metadata,s=yield Promise.all(this.creds.map(o=>o.generateMetadata(t)));for(let o of s)i.merge(o);return i})}compose(t){return new Fi(this.creds.concat([t]))}_equals(t){return this===t?!0:t instanceof Fi?this.creds.every((i,s)=>i._equals(t.creds[s])):!1}},vn=class extends Ur{constructor(t){super(),this.metadataGenerator=t}generateMetadata(t){return new Promise((i,s)=>{this.metadataGenerator(t,(o,l)=>{l!==void 0?i(l):s(o)})})}compose(t){return new Fi([this,t])}_equals(t){return this===t?!0:t instanceof vn?this.metadataGenerator===t.metadataGenerator:!1}},En=class extends Ur{generateMetadata(t){return Promise.resolve(new ku.Metadata)}compose(t){return t}_equals(t){return t instanceof En}}});var Wu=j(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.StreamDecoder=void 0;var Xt;(function(r){r[r.NO_DATA=0]="NO_DATA",r[r.READING_SIZE=1]="READING_SIZE",r[r.READING_MESSAGE=2]="READING_MESSAGE"})(Xt||(Xt={}));var zu=class{constructor(){this.readState=Xt.NO_DATA,this.readCompressFlag=Buffer.alloc(1),this.readPartialSize=Buffer.alloc(4),this.readSizeRemaining=4,this.readMessageSize=0,this.readPartialMessage=[],this.readMessageRemaining=0}write(t){let i=0,s,o=[];for(;i0)this.readState=Xt.READING_MESSAGE;else{let l=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=Xt.NO_DATA,o.push(l)}break;case Xt.READING_MESSAGE:if(s=Math.min(t.length-i,this.readMessageRemaining),this.readPartialMessage.push(t.slice(i,i+s)),this.readMessageRemaining-=s,i+=s,this.readMessageRemaining===0){let l=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),g=Buffer.concat(l,this.readMessageSize+5);this.readState=Xt.NO_DATA,o.push(g)}break;default:throw new Error("Unexpected read state")}return o}};Ta.StreamDecoder=zu});var Vu=j(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.Http2CallStream=Dr.InterceptingListenerImpl=Dr.isInterceptingListener=void 0;var Zt=require("http2"),gv=require("os"),ue=be(),Jt=Pt(),pv=Wu(),dv=Ue(),hv=be(),fv="call_stream",{HTTP2_HEADER_STATUS:OO,HTTP2_HEADER_CONTENT_TYPE:CO,NGHTTP2_CANCEL:_v}=Zt.constants;function mv(r){for(let[t,i]of Object.entries(gv.constants.errno))if(i===r)return t;return"Unknown system error "+r}function yv(r){let t=1/0;for(let i of r){let s=i instanceof Date?i.getTime():i;s{this.processingMetadata=!1,this.nextListener.onReceiveMetadata(i),this.processPendingMessage(),this.processPendingStatus()})}onReceiveMessage(t){this.processingMessage=!0,this.listener.onReceiveMessage(t,i=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=i,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(i),this.processPendingStatus())})}onReceiveStatus(t){this.listener.onReceiveStatus(t,i=>{this.processingMetadata||this.processingMessage?this.pendingStatus=i:this.nextListener.onReceiveStatus(i)})}};Dr.InterceptingListenerImpl=qu;var Hu=class{constructor(t,i,s,o,l,g){this.methodName=t,this.channel=i,this.options=s,this.channelCallCredentials=l,this.callNumber=g,this.http2Stream=null,this.pendingRead=!1,this.isWriteFilterPending=!1,this.pendingWrite=null,this.pendingWriteCallback=null,this.writesClosed=!1,this.decoder=new pv.StreamDecoder,this.isReadFilterPending=!1,this.canPush=!1,this.readsClosed=!1,this.statusOutput=!1,this.unpushedReadMessages=[],this.unfilteredReadMessages=[],this.mappedStatusCode=ue.Status.UNKNOWN,this.finalStatus=null,this.subchannel=null,this.listener=null,this.internalError=null,this.configDeadline=1/0,this.statusWatchers=[],this.streamEndWatchers=[],this.callStatsTracker=null,this.filterStack=o.createFilter(this),this.credentials=l,this.disconnectListener=()=>{this.endCall({code:ue.Status.UNAVAILABLE,details:"Connection dropped",metadata:new Jt.Metadata})},this.options.parentCall&&this.options.flags&ue.Propagate.CANCELLATION&&this.options.parentCall.on("cancelled",()=>{this.cancelWithStatus(ue.Status.CANCELLED,"Cancelled by parent call")})}outputStatus(){var t;if(this.listener&&!this.statusOutput){this.statusOutput=!0;let i=this.filterStack.receiveTrailers(this.finalStatus);this.trace("ended with status: code="+i.code+' details="'+i.details+'"'),this.statusWatchers.forEach(s=>s(i)),process.nextTick(()=>{var s;(s=this.listener)===null||s===void 0||s.onReceiveStatus(i)}),(t=this.http2Stream)===null||t===void 0||t.resume(),this.subchannel&&(this.subchannel.callUnref(),this.subchannel.removeDisconnectListener(this.disconnectListener))}}trace(t){dv.trace(hv.LogVerbosity.DEBUG,fv,"["+this.callNumber+"] "+t)}endCall(t){(this.finalStatus===null||this.finalStatus.code===ue.Status.OK)&&(this.finalStatus=t,this.maybeOutputStatus()),this.destroyHttp2Stream()}maybeOutputStatus(){this.finalStatus!==null&&(this.finalStatus.code!==ue.Status.OK||this.readsClosed&&this.unpushedReadMessages.length===0&&this.unfilteredReadMessages.length===0&&!this.isReadFilterPending)&&this.outputStatus()}push(t){this.trace("pushing to reader message of length "+(t instanceof Buffer?t.length:null)),this.canPush=!1,process.nextTick(()=>{var i;this.statusOutput||((i=this.listener)===null||i===void 0||i.onReceiveMessage(t),this.maybeOutputStatus())})}handleFilterError(t){this.cancelWithStatus(ue.Status.INTERNAL,t.message)}handleFilteredRead(t){if(this.finalStatus!==null&&this.finalStatus.code!==ue.Status.OK){this.maybeOutputStatus();return}if(this.isReadFilterPending=!1,this.canPush?(this.http2Stream.pause(),this.push(t)):(this.trace("unpushedReadMessages.push message of length "+t.length),this.unpushedReadMessages.push(t)),this.unfilteredReadMessages.length>0){let i=this.unfilteredReadMessages.shift();this.filterReceivedMessage(i)}}filterReceivedMessage(t){if(this.finalStatus!==null&&this.finalStatus.code!==ue.Status.OK){this.maybeOutputStatus();return}this.trace("filterReceivedMessage of length "+t.length),this.isReadFilterPending=!0,this.filterStack.receiveMessage(Promise.resolve(t)).then(this.handleFilteredRead.bind(this),this.handleFilterError.bind(this))}tryPush(t){this.isReadFilterPending?(this.trace("unfilteredReadMessages.push message of length "+(t&&t.length)),this.unfilteredReadMessages.push(t)):this.filterReceivedMessage(t)}handleTrailers(t){this.streamEndWatchers.forEach(p=>p(!0));let i="";for(let p of Object.keys(t))i+=" "+p+": "+t[p]+` +`;this.trace(`Received server trailers: +`+i);let s;try{s=Jt.Metadata.fromHttp2Headers(t)}catch(p){s=new Jt.Metadata}let o=s.getMap(),l=this.mappedStatusCode;if(l===ue.Status.UNKNOWN&&typeof o["grpc-status"]=="string"){let p=Number(o["grpc-status"]);p in ue.Status&&(l=p,this.trace("received status code "+p+" from server")),s.remove("grpc-status")}let g="";if(typeof o["grpc-message"]=="string"){try{g=decodeURI(o["grpc-message"])}catch(p){g=o["grpc-message"]}s.remove("grpc-message"),this.trace('received status details string "'+g+'" from server')}let _={code:l,details:g,metadata:s};this.endCall(_)}writeMessageToStream(t,i){var s;(s=this.callStatsTracker)===null||s===void 0||s.addMessageSent(),this.http2Stream.write(t,i)}attachHttp2Stream(t,i,s,o){if(this.filterStack.push(s),this.finalStatus!==null)t.close(_v);else{if(this.trace("attachHttp2Stream from subchannel "+i.getAddress()),this.http2Stream=t,this.subchannel=i,this.callStatsTracker=o,i.addDisconnectListener(this.disconnectListener),i.callRef(),t.on("response",(l,g)=>{var _;let p="";for(let m of Object.keys(l))p+=" "+m+": "+l[m]+` +`;switch(this.trace(`Received server headers: +`+p),l[":status"]){case 400:this.mappedStatusCode=ue.Status.INTERNAL;break;case 401:this.mappedStatusCode=ue.Status.UNAUTHENTICATED;break;case 403:this.mappedStatusCode=ue.Status.PERMISSION_DENIED;break;case 404:this.mappedStatusCode=ue.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:this.mappedStatusCode=ue.Status.UNAVAILABLE;break;default:this.mappedStatusCode=ue.Status.UNKNOWN}if(g&Zt.constants.NGHTTP2_FLAG_END_STREAM)this.handleTrailers(l);else{let m;try{m=Jt.Metadata.fromHttp2Headers(l)}catch(S){this.endCall({code:ue.Status.UNKNOWN,details:S.message,metadata:new Jt.Metadata});return}try{let S=this.filterStack.receiveMetadata(m);(_=this.listener)===null||_===void 0||_.onReceiveMetadata(S)}catch(S){this.endCall({code:ue.Status.UNKNOWN,details:S.message,metadata:new Jt.Metadata})}}}),t.on("trailers",l=>{this.handleTrailers(l)}),t.on("data",l=>{if(this.statusOutput)return;this.trace("receive HTTP/2 data frame of length "+l.length);let g=this.decoder.write(l);for(let _ of g)this.trace("parsed message of length "+_.length),this.callStatsTracker.addMessageReceived(),this.tryPush(_)}),t.on("end",()=>{this.readsClosed=!0,this.maybeOutputStatus()}),t.on("close",()=>{process.nextTick(()=>{var l;if(this.trace("HTTP/2 stream closed with code "+t.rstCode),((l=this.finalStatus)===null||l===void 0?void 0:l.code)===ue.Status.OK)return;let g,_="";switch(t.rstCode){case Zt.constants.NGHTTP2_NO_ERROR:if(this.finalStatus!==null)return;g=ue.Status.INTERNAL,_=`Received RST_STREAM with code ${t.rstCode}`;break;case Zt.constants.NGHTTP2_REFUSED_STREAM:g=ue.Status.UNAVAILABLE,_="Stream refused by server";break;case Zt.constants.NGHTTP2_CANCEL:g=ue.Status.CANCELLED,_="Call cancelled";break;case Zt.constants.NGHTTP2_ENHANCE_YOUR_CALM:g=ue.Status.RESOURCE_EXHAUSTED,_="Bandwidth exhausted or memory limit exceeded";break;case Zt.constants.NGHTTP2_INADEQUATE_SECURITY:g=ue.Status.PERMISSION_DENIED,_="Protocol not secure enough";break;case Zt.constants.NGHTTP2_INTERNAL_ERROR:g=ue.Status.INTERNAL,this.internalError===null?_=`Received RST_STREAM with code ${t.rstCode} (Internal server error)`:this.internalError.code==="ECONNRESET"||this.internalError.code==="ETIMEDOUT"?(g=ue.Status.UNAVAILABLE,_=this.internalError.message):_=`Received RST_STREAM with code ${t.rstCode} triggered by internal client error: ${this.internalError.message}`;break;default:g=ue.Status.INTERNAL,_=`Received RST_STREAM with code ${t.rstCode}`}this.endCall({code:g,details:_,metadata:new Jt.Metadata})})}),t.on("error",l=>{l.code!=="ERR_HTTP2_STREAM_ERROR"&&(this.trace("Node error event: message="+l.message+" code="+l.code+" errno="+mv(l.errno)+" syscall="+l.syscall),this.internalError=l),this.streamEndWatchers.forEach(g=>g(!1))}),this.pendingWrite){if(!this.pendingWriteCallback)throw new Error("Invalid state in write handling code");this.trace("sending data chunk of length "+this.pendingWrite.length+" (deferred)");try{this.writeMessageToStream(this.pendingWrite,this.pendingWriteCallback)}catch(l){this.endCall({code:ue.Status.UNAVAILABLE,details:`Write failed with error ${l.message}`,metadata:new Jt.Metadata})}}this.maybeCloseWrites()}}start(t,i){this.trace("Sending metadata"),this.listener=i,this.channel._startCallStream(this,t),this.maybeOutputStatus()}destroyHttp2Stream(){var t;if(this.http2Stream!==null&&!this.http2Stream.destroyed){let i;((t=this.finalStatus)===null||t===void 0?void 0:t.code)===ue.Status.OK?i=Zt.constants.NGHTTP2_NO_ERROR:i=Zt.constants.NGHTTP2_CANCEL,this.trace("close http2 stream with code "+i),this.http2Stream.close(i)}}cancelWithStatus(t,i){this.trace("cancelWithStatus code: "+t+' details: "'+i+'"'),this.endCall({code:t,details:i,metadata:new Jt.Metadata})}getDeadline(){let t=[this.options.deadline];return this.options.parentCall&&this.options.flags&ue.Propagate.DEADLINE&&t.push(this.options.parentCall.getDeadline()),this.configDeadline&&t.push(this.configDeadline),yv(t)}getCredentials(){return this.credentials}setCredentials(t){this.credentials=this.channelCallCredentials.compose(t)}getStatus(){return this.finalStatus}getPeer(){var t,i;return(i=(t=this.subchannel)===null||t===void 0?void 0:t.getAddress())!==null&&i!==void 0?i:this.channel.getTarget()}getMethod(){return this.methodName}getHost(){return this.options.host}setConfigDeadline(t){this.configDeadline=t}addStatusWatcher(t){this.statusWatchers.push(t)}addStreamEndWatcher(t){this.streamEndWatchers.push(t)}addFilters(t){this.filterStack.push(t)}getCallNumber(){return this.callNumber}startRead(){if(this.finalStatus!==null&&this.finalStatus.code!==ue.Status.OK){this.readsClosed=!0,this.maybeOutputStatus();return}if(this.canPush=!0,this.http2Stream===null)this.pendingRead=!0;else{if(this.unpushedReadMessages.length>0){let t=this.unpushedReadMessages.shift();this.push(t);return}this.http2Stream.resume()}}maybeCloseWrites(){this.writesClosed&&!this.isWriteFilterPending&&this.http2Stream!==null&&(this.trace("calling end() on HTTP/2 stream"),this.http2Stream.end())}sendMessageWithContext(t,i){this.trace("write() called with message of length "+i.length);let s={message:i,flags:t.flags},o=l=>{var g,_;let p=ue.Status.UNAVAILABLE;((g=l)===null||g===void 0?void 0:g.code)==="ERR_STREAM_WRITE_AFTER_END"&&(p=ue.Status.INTERNAL),l&&this.cancelWithStatus(p,`Write error: ${l.message}`),(_=t.callback)===null||_===void 0||_.call(t)};this.isWriteFilterPending=!0,this.filterStack.sendMessage(Promise.resolve(s)).then(l=>{if(this.isWriteFilterPending=!1,this.http2Stream===null)this.trace("deferring writing data chunk of length "+l.message.length),this.pendingWrite=l.message,this.pendingWriteCallback=o;else{this.trace("sending data chunk of length "+l.message.length);try{this.writeMessageToStream(l.message,o)}catch(g){this.endCall({code:ue.Status.UNAVAILABLE,details:`Write failed with error ${g.message}`,metadata:new Jt.Metadata})}this.maybeCloseWrites()}},this.handleFilterError.bind(this))}halfClose(){this.trace("end() called"),this.writesClosed=!0,this.maybeCloseWrites()}};Dr.Http2CallStream=Hu});var Yu=j(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.getDefaultRootsData=Ui.CIPHER_SUITES=void 0;var Sv=require("fs");Ui.CIPHER_SUITES=process.env.GRPC_SSL_CIPHER_SUITES;var Yd=process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH,Gu=null;function vv(){return Yd?(Gu===null&&(Gu=Sv.readFileSync(Yd)),Gu):null}Ui.getDefaultRootsData=vv});var Ku=j(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.ChannelCredentials=void 0;var Ev=require("tls"),Tv=Lu(),$d=Yu();function $u(r,t){if(r&&!(r instanceof Buffer))throw new TypeError(`${t}, if provided, must be a Buffer.`)}var Di=class{constructor(t){this.callCredentials=t||Tv.CallCredentials.createEmpty()}_getCallCredentials(){return this.callCredentials}static createSsl(t,i,s,o){var l;if($u(t,"Root certificate"),$u(i,"Private key"),$u(s,"Certificate chain"),i&&!s)throw new Error("Private key must be given with accompanying certificate chain");if(!i&&s)throw new Error("Certificate chain must be given with accompanying private key");let g=Ev.createSecureContext({ca:(l=t!=null?t:$d.getDefaultRootsData())!==null&&l!==void 0?l:void 0,key:i!=null?i:void 0,cert:s!=null?s:void 0,ciphers:$d.CIPHER_SUITES});return new Pi(g,o!=null?o:{})}static createFromSecureContext(t,i){return new Pi(t,i!=null?i:{})}static createInsecure(){return new Tn}};Aa.ChannelCredentials=Di;var Tn=class extends Di{constructor(t){super(t)}compose(t){throw new Error("Cannot compose insecure credentials")}_getConnectionOptions(){return null}_isSecure(){return!1}_equals(t){return t instanceof Tn}},Pi=class extends Di{constructor(t,i){super(),this.secureContext=t,this.verifyOptions=i,this.connectionOptions={secureContext:t},i!=null&&i.checkServerIdentity&&(this.connectionOptions.checkServerIdentity=i.checkServerIdentity)}compose(t){let i=this.callCredentials.compose(t);return new ki(this,i)}_getConnectionOptions(){return Object.assign({},this.connectionOptions)}_isSecure(){return!0}_equals(t){return this===t?!0:t instanceof Pi?this.secureContext===t.secureContext&&this.verifyOptions.checkServerIdentity===t.verifyOptions.checkServerIdentity:!1}},ki=class extends Di{constructor(t,i){super(i),this.channelCredentials=t}compose(t){let i=this.callCredentials.compose(t);return new ki(this.channelCredentials,i)}_getConnectionOptions(){return this.channelCredentials._getConnectionOptions()}_isSecure(){return!0}_equals(t){return this===t?!0:t instanceof ki?this.channelCredentials._equals(t.channelCredentials)&&this.callCredentials._equals(t.callCredentials):!1}}});var kr=j(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.validateLoadBalancingConfig=He.getFirstUsableConfig=He.isLoadBalancerNameRegistered=He.createLoadBalancer=He.registerDefaultLoadBalancerType=He.registerLoadBalancerType=He.createChildChannelControlHelper=void 0;function Av(r,t){var i,s,o,l,g,_,p,m,S,v;return{createSubchannel:(s=(i=t.createSubchannel)===null||i===void 0?void 0:i.bind(t))!==null&&s!==void 0?s:r.createSubchannel.bind(r),updateState:(l=(o=t.updateState)===null||o===void 0?void 0:o.bind(t))!==null&&l!==void 0?l:r.updateState.bind(r),requestReresolution:(_=(g=t.requestReresolution)===null||g===void 0?void 0:g.bind(t))!==null&&_!==void 0?_:r.requestReresolution.bind(r),addChannelzChild:(m=(p=t.addChannelzChild)===null||p===void 0?void 0:p.bind(t))!==null&&m!==void 0?m:r.addChannelzChild.bind(r),removeChannelzChild:(v=(S=t.removeChannelzChild)===null||S===void 0?void 0:S.bind(t))!==null&&v!==void 0?v:r.removeChannelzChild.bind(r)}}He.createChildChannelControlHelper=Av;var Pr={},Xu=null;function Rv(r,t,i){Pr[r]={LoadBalancer:t,LoadBalancingConfig:i}}He.registerLoadBalancerType=Rv;function wv(r){Xu=r}He.registerDefaultLoadBalancerType=wv;function Ov(r,t){let i=r.getLoadBalancerName();return i in Pr?new Pr[i].LoadBalancer(t):null}He.createLoadBalancer=Ov;function Cv(r){return r in Pr}He.isLoadBalancerNameRegistered=Cv;function Mv(r,t=!1){for(let i of r)if(i.getLoadBalancerName()in Pr)return i;return t&&Xu?new Pr[Xu].LoadBalancingConfig:null}He.getFirstUsableConfig=Mv;function jv(r){if(!(r!==null&&typeof r=="object"))throw new Error("Load balancing config must be an object");let t=Object.keys(r);if(t.length!==1)throw new Error("Provided load balancing config has multiple conflicting entries");let i=t[0];if(i in Pr)return Pr[i].LoadBalancingConfig.createFromJson(r[i]);throw new Error(`Unrecognized load balancing config name ${i}`)}He.validateLoadBalancingConfig=jv});var Ju=j(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.extractAndSelectServiceConfig=Li.validateServiceConfig=void 0;var Bv=require("os"),Nv=kr(),xv=/^\d+(\.\d{1,9})?s$/,Iv="node";function Fv(r){if(!("service"in r)||typeof r.service!="string")throw new Error("Invalid method config name: invalid service");let t={service:r.service};if("method"in r)if(typeof r.method=="string")t.method=r.method;else throw new Error("Invalid method config name: invalid method");return t}function Uv(r){var t;let i={name:[]};if(!("name"in r)||!Array.isArray(r.name))throw new Error("Invalid method config: invalid name array");for(let s of r.name)i.name.push(Fv(s));if("waitForReady"in r){if(typeof r.waitForReady!="boolean")throw new Error("Invalid method config: invalid waitForReady");i.waitForReady=r.waitForReady}if("timeout"in r)if(typeof r.timeout=="object"){if(!("seconds"in r.timeout)||typeof r.timeout.seconds!="number")throw new Error("Invalid method config: invalid timeout.seconds");if(!("nanos"in r.timeout)||typeof r.timeout.nanos!="number")throw new Error("Invalid method config: invalid timeout.nanos");i.timeout=r.timeout}else if(typeof r.timeout=="string"&&xv.test(r.timeout)){let s=r.timeout.substring(0,r.timeout.length-1).split(".");i.timeout={seconds:s[0]|0,nanos:((t=s[1])!==null&&t!==void 0?t:0)|0}}else throw new Error("Invalid method config: invalid timeout");if("maxRequestBytes"in r){if(typeof r.maxRequestBytes!="number")throw new Error("Invalid method config: invalid maxRequestBytes");i.maxRequestBytes=r.maxRequestBytes}if("maxResponseBytes"in r){if(typeof r.maxResponseBytes!="number")throw new Error("Invalid method config: invalid maxRequestBytes");i.maxResponseBytes=r.maxResponseBytes}return i}function Kd(r){let t={loadBalancingConfig:[],methodConfig:[]};if("loadBalancingPolicy"in r)if(typeof r.loadBalancingPolicy=="string")t.loadBalancingPolicy=r.loadBalancingPolicy;else throw new Error("Invalid service config: invalid loadBalancingPolicy");if("loadBalancingConfig"in r)if(Array.isArray(r.loadBalancingConfig))for(let s of r.loadBalancingConfig)t.loadBalancingConfig.push(Nv.validateLoadBalancingConfig(s));else throw new Error("Invalid service config: invalid loadBalancingConfig");if("methodConfig"in r&&Array.isArray(r.methodConfig))for(let s of r.methodConfig)t.methodConfig.push(Uv(s));let i=[];for(let s of t.methodConfig)for(let o of s.name){for(let l of i)if(o.service===l.service&&o.method===l.method)throw new Error(`Invalid service config: duplicate name ${o.service}/${o.method}`);i.push(o)}return t}Li.validateServiceConfig=Kd;function Dv(r){if(!("serviceConfig"in r))throw new Error("Invalid service config choice: missing service config");let t={serviceConfig:Kd(r.serviceConfig)};if("clientLanguage"in r)if(Array.isArray(r.clientLanguage)){t.clientLanguage=[];for(let s of r.clientLanguage)if(typeof s=="string")t.clientLanguage.push(s);else throw new Error("Invalid service config choice: invalid clientLanguage")}else throw new Error("Invalid service config choice: invalid clientLanguage");if("clientHostname"in r)if(Array.isArray(r.clientHostname)){t.clientHostname=[];for(let s of r.clientHostname)if(typeof s=="string")t.clientHostname.push(s);else throw new Error("Invalid service config choice: invalid clientHostname")}else throw new Error("Invalid service config choice: invalid clientHostname");if("percentage"in r)if(typeof r.percentage=="number"&&0<=r.percentage&&r.percentage<=100)t.percentage=r.percentage;else throw new Error("Invalid service config choice: invalid percentage");let i=["clientLanguage","percentage","clientHostname","serviceConfig"];for(let s in r)if(!i.includes(s))throw new Error(`Invalid service config choice: unexpected field ${s}`);return t}function Pv(r,t){if(!Array.isArray(r))throw new Error("Invalid service config list");for(let i of r){let s=Dv(i);if(!(typeof s.percentage=="number"&&t>s.percentage)){if(Array.isArray(s.clientHostname)){let o=!1;for(let l of s.clientHostname)l===Bv.hostname()&&(o=!0);if(!o)continue}if(Array.isArray(s.clientLanguage)){let o=!1;for(let l of s.clientLanguage)l===Iv&&(o=!0);if(!o)continue}return s.serviceConfig}}throw new Error("No matching service config found")}function kv(r,t){for(let i of r)if(i.length>0&&i[0].startsWith("grpc_config=")){let s=i.join("").substring(12),o=JSON.parse(s);return Pv(o,t)}return null}Li.extractAndSelectServiceConfig=kv});var kt=j(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.ConnectivityState=void 0;var Lv;(function(r){r[r.IDLE=0]="IDLE",r[r.CONNECTING=1]="CONNECTING",r[r.READY=2]="READY",r[r.TRANSIENT_FAILURE=3]="TRANSIENT_FAILURE",r[r.SHUTDOWN=4]="SHUTDOWN"})(Lv=An.ConnectivityState||(An.ConnectivityState={}))});var bt=j(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.uriToString=Lr.splitHostPort=Lr.parseUri=void 0;var zv=/^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/;function Wv(r){let t=zv.exec(r);return t===null?null:{scheme:t[1],authority:t[2],path:t[3]}}Lr.parseUri=Wv;var Xd=/^\d+$/;function qv(r){if(r.startsWith("[")){let t=r.indexOf("]");if(t===-1)return null;let i=r.substring(1,t);if(i.indexOf(":")===-1)return null;if(r.length>t+1)if(r[t+1]===":"){let s=r.substring(t+2);return Xd.test(s)?{host:i,port:+s}:null}else return null;else return{host:i}}else{let t=r.split(":");return t.length===2?Xd.test(t[1])?{host:t[0],port:+t[1]}:null:{host:r}}}Lr.splitHostPort=qv;function Hv(r){let t="";return r.scheme!==void 0&&(t+=r.scheme+":"),r.authority!==void 0&&(t+="//"+r.authority+"/"),t+=r.path,t}Lr.uriToString=Hv});var Qt=j(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.mapUriDefaultScheme=St.getDefaultAuthority=St.createResolver=St.registerDefaultScheme=St.registerResolver=void 0;var Qu=bt(),zi={},Zu=null;function Vv(r,t){zi[r]=t}St.registerResolver=Vv;function Gv(r){Zu=r}St.registerDefaultScheme=Gv;function Yv(r,t,i){if(r.scheme!==void 0&&r.scheme in zi)return new zi[r.scheme](r,t,i);throw new Error(`No resolver could be created for target ${Qu.uriToString(r)}`)}St.createResolver=Yv;function $v(r){if(r.scheme!==void 0&&r.scheme in zi)return zi[r.scheme].getDefaultAuthority(r);throw new Error(`Invalid target ${Qu.uriToString(r)}`)}St.getDefaultAuthority=$v;function Kv(r){return r.scheme===void 0||!(r.scheme in zi)?Zu!==null?{scheme:Zu,authority:void 0,path:Qu.uriToString(r)}:null:r}St.mapUriDefaultScheme=Kv});var di=j(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.QueuePicker=vr.UnavailablePicker=vr.PickResultType=void 0;var Xv=Pt(),Jv=be(),rc;(function(r){r[r.COMPLETE=0]="COMPLETE",r[r.QUEUE=1]="QUEUE",r[r.TRANSIENT_FAILURE=2]="TRANSIENT_FAILURE",r[r.DROP=3]="DROP"})(rc=vr.PickResultType||(vr.PickResultType={}));var ec=class{constructor(t){t!==void 0?this.status=t:this.status={code:Jv.Status.UNAVAILABLE,details:"No connection established",metadata:new Xv.Metadata}}pick(t){return{pickResultType:rc.TRANSIENT_FAILURE,subchannel:null,status:this.status,extraFilterFactories:[],onCallStarted:null}}};vr.UnavailablePicker=ec;var tc=class{constructor(t){this.loadBalancer=t,this.calledExitIdle=!1}pick(t){return this.calledExitIdle||(process.nextTick(()=>{this.loadBalancer.exitIdle()}),this.calledExitIdle=!0),{pickResultType:rc.QUEUE,subchannel:null,status:null,extraFilterFactories:[],onCallStarted:null}}};vr.QueuePicker=tc});var Rn=j(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});Ra.BackoffTimeout=void 0;var Zv=1e3,Qv=1.6,eE=12e4,tE=.2;function rE(r,t){return Math.random()*(t-r)+r}var ic=class{constructor(t,i){this.callback=t,this.initialDelay=Zv,this.multiplier=Qv,this.maxDelay=eE,this.jitter=tE,this.running=!1,this.hasRef=!0,this.startTime=new Date,i&&(i.initialDelay&&(this.initialDelay=i.initialDelay),i.multiplier&&(this.multiplier=i.multiplier),i.jitter&&(this.jitter=i.jitter),i.maxDelay&&(this.maxDelay=i.maxDelay)),this.nextDelay=this.initialDelay,this.timerId=setTimeout(()=>{},0),clearTimeout(this.timerId)}runTimer(t){var i,s;clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.callback(),this.running=!1},t),this.hasRef||(s=(i=this.timerId).unref)===null||s===void 0||s.call(i)}runOnce(){this.running=!0,this.startTime=new Date,this.runTimer(this.nextDelay);let t=Math.min(this.nextDelay*this.multiplier,this.maxDelay),i=t*this.jitter;this.nextDelay=t+rE(-i,i)}stop(){clearTimeout(this.timerId),this.running=!1}reset(){if(this.nextDelay=this.initialDelay,this.running){let t=new Date,i=this.startTime;i.setMilliseconds(i.getMilliseconds()+this.nextDelay),clearTimeout(this.timerId),t{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});wa.ChildLoadBalancerHandler=void 0;var iE=kr(),sE=kt(),nE="child_load_balancer_helper",sc=class{constructor(t){this.channelControlHelper=t,this.currentChild=null,this.pendingChild=null,this.ChildPolicyHelper=class{constructor(i){this.parent=i,this.child=null}createSubchannel(i,s){return this.parent.channelControlHelper.createSubchannel(i,s)}updateState(i,s){var o;if(this.calledByPendingChild()){if(i===sE.ConnectivityState.CONNECTING)return;(o=this.parent.currentChild)===null||o===void 0||o.destroy(),this.parent.currentChild=this.parent.pendingChild,this.parent.pendingChild=null}else if(!this.calledByCurrentChild())return;this.parent.channelControlHelper.updateState(i,s)}requestReresolution(){var i;let s=(i=this.parent.pendingChild)!==null&&i!==void 0?i:this.parent.currentChild;this.child===s&&this.parent.channelControlHelper.requestReresolution()}setChild(i){this.child=i}addChannelzChild(i){this.parent.channelControlHelper.addChannelzChild(i)}removeChannelzChild(i){this.parent.channelControlHelper.removeChannelzChild(i)}calledByPendingChild(){return this.child===this.parent.pendingChild}calledByCurrentChild(){return this.child===this.parent.currentChild}}}updateAddressList(t,i,s){let o;if(this.currentChild===null||this.currentChild.getTypeName()!==i.getLoadBalancerName()){let l=new this.ChildPolicyHelper(this),g=iE.createLoadBalancer(i,l);l.setChild(g),this.currentChild===null?(this.currentChild=g,o=this.currentChild):(this.pendingChild&&this.pendingChild.destroy(),this.pendingChild=g,o=this.pendingChild)}else this.pendingChild===null?o=this.currentChild:o=this.pendingChild;o.updateAddressList(t,i,s)}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 nE}};wa.ChildLoadBalancerHandler=sc});var Jd=j(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.ResolvingLoadBalancer=void 0;var oE=kr(),aE=Ju(),gt=kt(),lE=Qt(),Wi=di(),uE=Rn(),nc=be(),cE=Pt(),gE=Ue(),pE=be(),dE=bt(),hE=Oa(),fE="resolving_load_balancer";function _E(r){gE.trace(pE.LogVerbosity.DEBUG,fE,r)}function mE(r){return function(i,s){var o,l;let g=i.split("/").filter(m=>m.length>0),_=(o=g[0])!==null&&o!==void 0?o:"",p=(l=g[1])!==null&&l!==void 0?l:"";if(r&&r.methodConfig){for(let m of r.methodConfig)for(let S of m.name)if(S.service===_&&(S.method===void 0||S.method===p))return{methodConfig:m,pickInformation:{},status:nc.Status.OK,dynamicFilterFactories:[]}}return{methodConfig:{name:[]},pickInformation:{},status:nc.Status.OK,dynamicFilterFactories:[]}}}var oc=class{constructor(t,i,s,o,l){this.target=t,this.channelControlHelper=i,this.channelOptions=s,this.onSuccessfulResolution=o,this.onFailedResolution=l,this.latestChildState=gt.ConnectivityState.IDLE,this.latestChildPicker=new Wi.QueuePicker(this),this.currentState=gt.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1,s["grpc.service_config"]?this.defaultServiceConfig=aE.validateServiceConfig(JSON.parse(s["grpc.service_config"])):this.defaultServiceConfig={loadBalancingConfig:[],methodConfig:[]},this.updateState(gt.ConnectivityState.IDLE,new Wi.QueuePicker(this)),this.childLoadBalancer=new hE.ChildLoadBalancerHandler({createSubchannel:i.createSubchannel.bind(i),requestReresolution:()=>{this.backoffTimeout.isRunning()?this.continueResolving=!0:this.updateResolution()},updateState:(_,p)=>{this.latestChildState=_,this.latestChildPicker=p,this.updateState(_,p)},addChannelzChild:i.addChannelzChild.bind(i),removeChannelzChild:i.removeChannelzChild.bind(i)}),this.innerResolver=lE.createResolver(t,{onSuccessfulResolution:(_,p,m,S,v)=>{var R;let w=null;p===null?m===null?(this.previousServiceConfig=null,w=this.defaultServiceConfig):this.previousServiceConfig===null?this.handleResolutionFailure(m):w=this.previousServiceConfig:(w=p,this.previousServiceConfig=p);let B=(R=w==null?void 0:w.loadBalancingConfig)!==null&&R!==void 0?R:[],I=oE.getFirstUsableConfig(B,!0);if(I===null){this.handleResolutionFailure({code:nc.Status.UNAVAILABLE,details:"All load balancer options in service config are not compatible",metadata:new cE.Metadata});return}this.childLoadBalancer.updateAddressList(_,I,v);let D=w!=null?w:this.defaultServiceConfig;this.onSuccessfulResolution(S!=null?S:mE(D))},onError:_=>{this.handleResolutionFailure(_)}},s);let g={initialDelay:s["grpc.initial_reconnect_backoff_ms"],maxDelay:s["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new uE.BackoffTimeout(()=>{this.continueResolving?(this.updateResolution(),this.continueResolving=!1):this.updateState(this.latestChildState,this.latestChildPicker)},g),this.backoffTimeout.unref()}updateResolution(){this.innerResolver.updateResolution(),this.currentState===gt.ConnectivityState.IDLE&&this.updateState(gt.ConnectivityState.CONNECTING,new Wi.QueuePicker(this)),this.backoffTimeout.runOnce()}updateState(t,i){_E(dE.uriToString(this.target)+" "+gt.ConnectivityState[this.currentState]+" -> "+gt.ConnectivityState[t]),t===gt.ConnectivityState.IDLE&&(i=new Wi.QueuePicker(this)),this.currentState=t,this.channelControlHelper.updateState(t,i)}handleResolutionFailure(t){this.latestChildState===gt.ConnectivityState.IDLE&&(this.updateState(gt.ConnectivityState.TRANSIENT_FAILURE,new Wi.UnavailablePicker(t)),this.onFailedResolution(t))}exitIdle(){(this.currentState===gt.ConnectivityState.IDLE||this.currentState===gt.ConnectivityState.TRANSIENT_FAILURE)&&(this.backoffTimeout.isRunning()?this.continueResolving=!0:this.updateResolution()),this.childLoadBalancer.exitIdle()}updateAddressList(t,i){throw new Error("updateAddressList not supported on ResolvingLoadBalancer")}resetBackoff(){this.backoffTimeout.reset(),this.childLoadBalancer.resetBackoff()}destroy(){this.childLoadBalancer.destroy(),this.innerResolver.destroy(),this.updateState(gt.ConnectivityState.SHUTDOWN,new Wi.UnavailablePicker)}getTypeName(){return"resolving_load_balancer"}};Ca.ResolvingLoadBalancer=oc});var Zd=j(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});qi.channelOptionsEqual=qi.recognizedOptions=void 0;qi.recognizedOptions={"grpc.ssl_target_name_override":!0,"grpc.primary_user_agent":!0,"grpc.secondary_user_agent":!0,"grpc.default_authority":!0,"grpc.keepalive_time_ms":!0,"grpc.keepalive_timeout_ms":!0,"grpc.keepalive_permit_without_calls":!0,"grpc.service_config":!0,"grpc.max_concurrent_streams":!0,"grpc.initial_reconnect_backoff_ms":!0,"grpc.max_reconnect_backoff_ms":!0,"grpc.use_local_subchannel_pool":!0,"grpc.max_send_message_length":!0,"grpc.max_receive_message_length":!0,"grpc.enable_http_proxy":!0,"grpc.enable_channelz":!0,"grpc.dns_min_time_between_resolutions_ms":!0,"grpc-node.max_session_memory":!0};function yE(r,t){let i=Object.keys(r).sort(),s=Object.keys(t).sort();if(i.length!==s.length)return!1;for(let o=0;o{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.stringToSubchannelAddress=er.subchannelAddressToString=er.subchannelAddressEqual=er.isTcpSubchannelAddress=void 0;var bE=require("net");function wn(r){return"port"in r}er.isTcpSubchannelAddress=wn;function SE(r,t){return wn(r)?wn(t)&&r.host===t.host&&r.port===t.port:!wn(t)&&r.path===t.path}er.subchannelAddressEqual=SE;function vE(r){return wn(r)?r.host+":"+r.port:r.path}er.subchannelAddressToString=vE;var EE=443;function TE(r,t){return bE.isIP(r)?{host:r,port:t!=null?t:EE}:{path:r}}er.stringToSubchannelAddress=TE});var ac=j(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.getProxiedConnection=Vi.mapProxyName=void 0;var On=Ue(),Hi=be(),AE=Qt(),RE=require("http"),wE=require("tls"),OE=Ue(),Qd=tr(),Cn=bt(),CE=require("url"),ME="proxy";function zr(r){OE.trace(Hi.LogVerbosity.DEBUG,ME,r)}function jE(){let r="",t="";if(process.env.grpc_proxy)t="grpc_proxy",r=process.env.grpc_proxy;else if(process.env.https_proxy)t="https_proxy",r=process.env.https_proxy;else if(process.env.http_proxy)t="http_proxy",r=process.env.http_proxy;else return{};let i;try{i=new CE.URL(r)}catch(_){return On.log(Hi.LogVerbosity.ERROR,`cannot parse value of "${t}" env var`),{}}if(i.protocol!=="http:")return On.log(Hi.LogVerbosity.ERROR,`"${i.protocol}" scheme not supported in proxy URI`),{};let s=null;i.username&&(i.password?(On.log(Hi.LogVerbosity.INFO,"userinfo found in proxy URI"),s=`${i.username}:${i.password}`):s=i.username);let o=i.hostname,l=i.port;l===""&&(l="80");let g={address:`${o}:${l}`};return s&&(g.creds=s),zr("Proxy server "+g.address+" set by environment variable "+t),g}function BE(){let r=process.env.no_grpc_proxy,t="no_grpc_proxy";return r||(r=process.env.no_proxy,t="no_proxy"),r?(zr("No proxy server list set by environment variable "+t),r.split(",")):[]}function NE(r,t){var i;let s={target:r,extraOptions:{}};if(((i=t["grpc.enable_http_proxy"])!==null&&i!==void 0?i:1)===0||r.scheme==="unix")return s;let o=jE();if(!o.address)return s;let l=Cn.splitHostPort(r.path);if(!l)return s;let g=l.host;for(let p of BE())if(p===g)return zr("Not using proxy for target in no_proxy list: "+Cn.uriToString(r)),s;let _={"grpc.http_connect_target":Cn.uriToString(r)};return o.creds&&(_["grpc.http_connect_creds"]=o.creds),{target:{scheme:"dns",path:o.address},extraOptions:_}}Vi.mapProxyName=NE;function xE(r,t,i){if(!("grpc.http_connect_target"in t))return Promise.resolve({});let s=t["grpc.http_connect_target"],o=Cn.parseUri(s);if(o===null)return Promise.resolve({});let l={method:"CONNECT",path:o.path},g={Host:o.path};Qd.isTcpSubchannelAddress(r)?(l.host=r.host,l.port=r.port):l.socketPath=r.path,"grpc.http_connect_creds"in t&&(g["Proxy-Authorization"]="Basic "+Buffer.from(t["grpc.http_connect_creds"]).toString("base64")),l.headers=g;let _=Qd.subchannelAddressToString(r);return zr("Using proxy "+_+" to connect to "+l.path),new Promise((p,m)=>{let S=RE.request(l);S.once("connect",(v,R,w)=>{var B;if(S.removeAllListeners(),R.removeAllListeners(),v.statusCode===200)if(zr("Successfully connected to "+l.path+" through proxy "+_),"secureContext"in i){let I=AE.getDefaultAuthority(o),D=Cn.splitHostPort(I),C=(B=D==null?void 0:D.host)!==null&&B!==void 0?B:I,P=wE.connect(Object.assign({host:C,servername:C,socket:R},i),()=>{zr("Successfully established a TLS connection to "+l.path+" through proxy "+_),p({socket:P,realTarget:o})});P.on("error",ee=>{zr("Failed to establish a TLS connection to "+l.path+" through proxy "+_+" with error "+ee.message),m()})}else zr("Successfully established a plaintext connection to "+l.path+" through proxy "+_),p({socket:R,realTarget:o});else On.log(Hi.LogVerbosity.ERROR,"Failed to connect to "+l.path+" through proxy "+_+" with status "+v.statusCode),m()}),S.once("error",v=>{S.removeAllListeners(),On.log(Hi.LogVerbosity.ERROR,"Failed to connect to proxy "+_+" with error "+v.message),m()}),S.end()})}Vi.getProxiedConnection=xE});var Ma=j(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.addAdminServicesToServer=Gi.registerAdminService=void 0;var eh=[];function IE(r,t){eh.push({getServiceDefinition:r,getHandlers:t})}Gi.registerAdminService=IE;function FE(r){for(let{getServiceDefinition:t,getHandlers:i}of eh)r.addService(t(),i())}Gi.addAdminServicesToServer=FE});var th=j(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.ClientDuplexStreamImpl=vt.ClientWritableStreamImpl=vt.ClientReadableStreamImpl=vt.ClientUnaryCallImpl=vt.callErrorFromStatus=void 0;var UE=require("events"),pc=require("stream"),Mn=be();function DE(r,t){let i=`${r.code} ${Mn.Status[r.code]}: ${r.details}`,o=`${new Error(i).stack} +for call at +${t}`;return Object.assign(new Error(i),r,{stack:o})}vt.callErrorFromStatus=DE;var lc=class extends UE.EventEmitter{constructor(){super()}cancel(){var t;(t=this.call)===null||t===void 0||t.cancelWithStatus(Mn.Status.CANCELLED,"Cancelled on client")}getPeer(){var t,i;return(i=(t=this.call)===null||t===void 0?void 0:t.getPeer())!==null&&i!==void 0?i:"unknown"}};vt.ClientUnaryCallImpl=lc;var uc=class extends pc.Readable{constructor(t){super({objectMode:!0}),this.deserialize=t}cancel(){var t;(t=this.call)===null||t===void 0||t.cancelWithStatus(Mn.Status.CANCELLED,"Cancelled on client")}getPeer(){var t,i;return(i=(t=this.call)===null||t===void 0?void 0:t.getPeer())!==null&&i!==void 0?i:"unknown"}_read(t){var i;(i=this.call)===null||i===void 0||i.startRead()}};vt.ClientReadableStreamImpl=uc;var cc=class extends pc.Writable{constructor(t){super({objectMode:!0}),this.serialize=t}cancel(){var t;(t=this.call)===null||t===void 0||t.cancelWithStatus(Mn.Status.CANCELLED,"Cancelled on client")}getPeer(){var t,i;return(i=(t=this.call)===null||t===void 0?void 0:t.getPeer())!==null&&i!==void 0?i:"unknown"}_write(t,i,s){var o;let l={callback:s},g=Number(i);Number.isNaN(g)||(l.flags=g),(o=this.call)===null||o===void 0||o.sendMessageWithContext(l,t)}_final(t){var i;(i=this.call)===null||i===void 0||i.halfClose(),t()}};vt.ClientWritableStreamImpl=cc;var gc=class extends pc.Duplex{constructor(t,i){super({objectMode:!0}),this.serialize=t,this.deserialize=i}cancel(){var t;(t=this.call)===null||t===void 0||t.cancelWithStatus(Mn.Status.CANCELLED,"Cancelled on client")}getPeer(){var t,i;return(i=(t=this.call)===null||t===void 0?void 0:t.getPeer())!==null&&i!==void 0?i:"unknown"}_read(t){var i;(i=this.call)===null||i===void 0||i.startRead()}_write(t,i,s){var o;let l={callback:s},g=Number(i);Number.isNaN(g)||(l.flags=g),(o=this.call)===null||o===void 0||o.sendMessageWithContext(l,t)}_final(t){var i;(i=this.call)===null||i===void 0||i.halfClose(),t()}};vt.ClientDuplexStreamImpl=gc});var bc=j(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.getInterceptingCall=Et.InterceptingCall=Et.RequesterBuilder=Et.ListenerBuilder=Et.InterceptorConfigurationError=void 0;var PE=Pt(),rh=Vu(),ih=be(),hi=class extends Error{constructor(t){super(t),this.name="InterceptorConfigurationError",Error.captureStackTrace(this,hi)}};Et.InterceptorConfigurationError=hi;var hc=class{constructor(){this.metadata=void 0,this.message=void 0,this.status=void 0}withOnReceiveMetadata(t){return this.metadata=t,this}withOnReceiveMessage(t){return this.message=t,this}withOnReceiveStatus(t){return this.status=t,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveStatus:this.status}}};Et.ListenerBuilder=hc;var fc=class{constructor(){this.start=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withStart(t){return this.start=t,this}withSendMessage(t){return this.message=t,this}withHalfClose(t){return this.halfClose=t,this}withCancel(t){return this.cancel=t,this}build(){return{start:this.start,sendMessage:this.message,halfClose:this.halfClose,cancel:this.cancel}}};Et.RequesterBuilder=fc;var dc={onReceiveMetadata:(r,t)=>{t(r)},onReceiveMessage:(r,t)=>{t(r)},onReceiveStatus:(r,t)=>{t(r)}},jn={start:(r,t,i)=>{i(r,t)},sendMessage:(r,t)=>{t(r)},halfClose:r=>{r()},cancel:r=>{r()}},_c=class{constructor(t,i){var s,o,l,g;this.nextCall=t,this.processingMetadata=!1,this.pendingMessageContext=null,this.processingMessage=!1,this.pendingHalfClose=!1,i?this.requester={start:(s=i.start)!==null&&s!==void 0?s:jn.start,sendMessage:(o=i.sendMessage)!==null&&o!==void 0?o:jn.sendMessage,halfClose:(l=i.halfClose)!==null&&l!==void 0?l:jn.halfClose,cancel:(g=i.cancel)!==null&&g!==void 0?g:jn.cancel}:this.requester=jn}cancelWithStatus(t,i){this.requester.cancel(()=>{this.nextCall.cancelWithStatus(t,i)})}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(t,i){var s,o,l,g,_,p;let m={onReceiveMetadata:(o=(s=i==null?void 0:i.onReceiveMetadata)===null||s===void 0?void 0:s.bind(i))!==null&&o!==void 0?o:S=>{},onReceiveMessage:(g=(l=i==null?void 0:i.onReceiveMessage)===null||l===void 0?void 0:l.bind(i))!==null&&g!==void 0?g:S=>{},onReceiveStatus:(p=(_=i==null?void 0:i.onReceiveStatus)===null||_===void 0?void 0:_.bind(i))!==null&&p!==void 0?p:S=>{}};this.processingMetadata=!0,this.requester.start(t,m,(S,v)=>{var R,w,B;this.processingMetadata=!1;let I;if(rh.isInterceptingListener(v))I=v;else{let D={onReceiveMetadata:(R=v.onReceiveMetadata)!==null&&R!==void 0?R:dc.onReceiveMetadata,onReceiveMessage:(w=v.onReceiveMessage)!==null&&w!==void 0?w:dc.onReceiveMessage,onReceiveStatus:(B=v.onReceiveStatus)!==null&&B!==void 0?B:dc.onReceiveStatus};I=new rh.InterceptingListenerImpl(D,m)}this.nextCall.start(S,I),this.processPendingMessage(),this.processPendingHalfClose()})}sendMessageWithContext(t,i){this.processingMessage=!0,this.requester.sendMessage(i,s=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessageContext=t,this.pendingMessage=i):(this.nextCall.sendMessageWithContext(t,s),this.processPendingHalfClose())})}sendMessage(t){this.sendMessageWithContext({},t)}startRead(){this.nextCall.startRead()}halfClose(){this.requester.halfClose(()=>{this.processingMetadata||this.processingMessage?this.pendingHalfClose=!0:this.nextCall.halfClose()})}setCredentials(t){this.nextCall.setCredentials(t)}};Et.InterceptingCall=_c;function kE(r,t,i){var s,o;let l=(s=i.deadline)!==null&&s!==void 0?s:1/0,g=i.host,_=(o=i.parent)!==null&&o!==void 0?o:null,p=i.propagate_flags,m=i.credentials,S=r.createCall(t,l,g,_,p);return m&&S.setCredentials(m),S}var ja=class{constructor(t,i){this.call=t,this.methodDefinition=i}cancelWithStatus(t,i){this.call.cancelWithStatus(t,i)}getPeer(){return this.call.getPeer()}setCredentials(t){this.call.setCredentials(t)}sendMessageWithContext(t,i){let s;try{s=this.methodDefinition.requestSerialize(i)}catch(o){this.call.cancelWithStatus(ih.Status.INTERNAL,`Request message serialization failure: ${o.message}`);return}this.call.sendMessageWithContext(t,s)}sendMessage(t){this.sendMessageWithContext({},t)}start(t,i){let s=null;this.call.start(t,{onReceiveMetadata:o=>{var l;(l=i==null?void 0:i.onReceiveMetadata)===null||l===void 0||l.call(i,o)},onReceiveMessage:o=>{var l;let g;try{g=this.methodDefinition.responseDeserialize(o)}catch(_){s={code:ih.Status.INTERNAL,details:`Response message parsing error: ${_.message}`,metadata:new PE.Metadata},this.call.cancelWithStatus(s.code,s.details);return}(l=i==null?void 0:i.onReceiveMessage)===null||l===void 0||l.call(i,g)},onReceiveStatus:o=>{var l,g;s?(l=i==null?void 0:i.onReceiveStatus)===null||l===void 0||l.call(i,s):(g=i==null?void 0:i.onReceiveStatus)===null||g===void 0||g.call(i,o)}})}startRead(){this.call.startRead()}halfClose(){this.call.halfClose()}},mc=class extends ja{constructor(t,i){super(t,i)}start(t,i){var s,o;let l=!1,g={onReceiveMetadata:(o=(s=i==null?void 0:i.onReceiveMetadata)===null||s===void 0?void 0:s.bind(i))!==null&&o!==void 0?o:_=>{},onReceiveMessage:_=>{var p;l=!0,(p=i==null?void 0:i.onReceiveMessage)===null||p===void 0||p.call(i,_)},onReceiveStatus:_=>{var p,m;l||(p=i==null?void 0:i.onReceiveMessage)===null||p===void 0||p.call(i,null),(m=i==null?void 0:i.onReceiveStatus)===null||m===void 0||m.call(i,_)}};super.start(t,g),this.call.startRead()}},yc=class extends ja{};function LE(r,t,i){let s=kE(r,i.path,t);return i.responseStream?new yc(s,i):new mc(s,i)}function zE(r,t,i,s){if(r.clientInterceptors.length>0&&r.clientInterceptorProviders.length>0)throw new hi("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(r.callInterceptors.length>0&&r.callInterceptorProviders.length>0)throw new hi("Both interceptors and interceptor_providers were passed as call options. Only one of these is allowed.");let o=[];r.callInterceptors.length>0||r.callInterceptorProviders.length>0?o=[].concat(r.callInterceptors,r.callInterceptorProviders.map(_=>_(t))).filter(_=>_):o=[].concat(r.clientInterceptors,r.clientInterceptorProviders.map(_=>_(t))).filter(_=>_);let l=Object.assign({},i,{method_definition:t});return o.reduceRight((_,p)=>m=>p(m,_),_=>LE(s,_,t))(l)}Et.getInterceptingCall=zE});var Ec=j(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.Client=void 0;var rr=th(),WE=Tc(),qE=kt(),Wr=be(),Yi=Pt(),Ba=bc(),Lt=Symbol(),$i=Symbol(),Ki=Symbol(),Er=Symbol();function Sc(r){return typeof r=="function"}function Xi(r){return r.stack.split(` +`).slice(1).join(` +`)}var vc=class{constructor(t,i,s={}){var o,l;if(s=Object.assign({},s),this[$i]=(o=s.interceptors)!==null&&o!==void 0?o:[],delete s.interceptors,this[Ki]=(l=s.interceptor_providers)!==null&&l!==void 0?l:[],delete s.interceptor_providers,this[$i].length>0&&this[Ki].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[Er]=s.callInvocationTransformer,delete s.callInvocationTransformer,s.channelOverride)this[Lt]=s.channelOverride;else if(s.channelFactoryOverride){let g=s.channelFactoryOverride;delete s.channelFactoryOverride,this[Lt]=g(t,i,s)}else this[Lt]=new WE.ChannelImplementation(t,i,s)}close(){this[Lt].close()}getChannel(){return this[Lt]}waitForReady(t,i){let s=o=>{if(o){i(new Error("Failed to connect before the deadline"));return}let l;try{l=this[Lt].getConnectivityState(!0)}catch(g){i(new Error("The channel has been closed"));return}if(l===qE.ConnectivityState.READY)i();else try{this[Lt].watchConnectivityState(l,t,s)}catch(g){i(new Error("The channel has been closed"))}};setImmediate(s)}checkOptionalUnaryResponseArguments(t,i,s){if(Sc(t))return{metadata:new Yi.Metadata,options:{},callback:t};if(Sc(i))return t instanceof Yi.Metadata?{metadata:t,options:{},callback:i}:{metadata:new Yi.Metadata,options:t,callback:i};if(!(t instanceof Yi.Metadata&&i instanceof Object&&Sc(s)))throw new Error("Incorrect arguments passed");return{metadata:t,options:i,callback:s}}makeUnaryRequest(t,i,s,o,l,g,_){var p,m;let S=this.checkOptionalUnaryResponseArguments(l,g,_),v={path:t,requestStream:!1,responseStream:!1,requestSerialize:i,responseDeserialize:s},R={argument:o,metadata:S.metadata,call:new rr.ClientUnaryCallImpl,channel:this[Lt],methodDefinition:v,callOptions:S.options,callback:S.callback};this[Er]&&(R=this[Er](R));let w=R.call,B={clientInterceptors:this[$i],clientInterceptorProviders:this[Ki],callInterceptors:(p=R.callOptions.interceptors)!==null&&p!==void 0?p:[],callInterceptorProviders:(m=R.callOptions.interceptor_providers)!==null&&m!==void 0?m:[]},I=Ba.getInterceptingCall(B,R.methodDefinition,R.callOptions,R.channel);w.call=I,R.callOptions.credentials&&I.setCredentials(R.callOptions.credentials);let D=null,C=!1,P=new Error;return I.start(R.metadata,{onReceiveMetadata:ee=>{w.emit("metadata",ee)},onReceiveMessage(ee){D!==null&&I.cancelWithStatus(Wr.Status.INTERNAL,"Too many responses received"),D=ee},onReceiveStatus(ee){if(!C){if(C=!0,ee.code===Wr.Status.OK)if(D===null){let H=Xi(P);R.callback(rr.callErrorFromStatus({code:Wr.Status.INTERNAL,details:"No message received",metadata:ee.metadata},H))}else R.callback(null,D);else{let H=Xi(P);R.callback(rr.callErrorFromStatus(ee,H))}w.emit("status",ee)}}}),I.sendMessage(o),I.halfClose(),w}makeClientStreamRequest(t,i,s,o,l,g){var _,p;let m=this.checkOptionalUnaryResponseArguments(o,l,g),S={path:t,requestStream:!0,responseStream:!1,requestSerialize:i,responseDeserialize:s},v={metadata:m.metadata,call:new rr.ClientWritableStreamImpl(i),channel:this[Lt],methodDefinition:S,callOptions:m.options,callback:m.callback};this[Er]&&(v=this[Er](v));let R=v.call,w={clientInterceptors:this[$i],clientInterceptorProviders:this[Ki],callInterceptors:(_=v.callOptions.interceptors)!==null&&_!==void 0?_:[],callInterceptorProviders:(p=v.callOptions.interceptor_providers)!==null&&p!==void 0?p:[]},B=Ba.getInterceptingCall(w,v.methodDefinition,v.callOptions,v.channel);R.call=B,v.callOptions.credentials&&B.setCredentials(v.callOptions.credentials);let I=null,D=!1,C=new Error;return B.start(v.metadata,{onReceiveMetadata:P=>{R.emit("metadata",P)},onReceiveMessage(P){I!==null&&B.cancelWithStatus(Wr.Status.INTERNAL,"Too many responses received"),I=P},onReceiveStatus(P){if(!D){if(D=!0,P.code===Wr.Status.OK)if(I===null){let ee=Xi(C);v.callback(rr.callErrorFromStatus({code:Wr.Status.INTERNAL,details:"No message received",metadata:P.metadata},ee))}else v.callback(null,I);else{let ee=Xi(C);v.callback(rr.callErrorFromStatus(P,ee))}R.emit("status",P)}}}),R}checkMetadataAndOptions(t,i){let s,o;return t instanceof Yi.Metadata?(s=t,i?o=i:o={}):(t?o=t:o={},s=new Yi.Metadata),{metadata:s,options:o}}makeServerStreamRequest(t,i,s,o,l,g){var _,p;let m=this.checkMetadataAndOptions(l,g),S={path:t,requestStream:!1,responseStream:!0,requestSerialize:i,responseDeserialize:s},v={argument:o,metadata:m.metadata,call:new rr.ClientReadableStreamImpl(s),channel:this[Lt],methodDefinition:S,callOptions:m.options};this[Er]&&(v=this[Er](v));let R=v.call,w={clientInterceptors:this[$i],clientInterceptorProviders:this[Ki],callInterceptors:(_=v.callOptions.interceptors)!==null&&_!==void 0?_:[],callInterceptorProviders:(p=v.callOptions.interceptor_providers)!==null&&p!==void 0?p:[]},B=Ba.getInterceptingCall(w,v.methodDefinition,v.callOptions,v.channel);R.call=B,v.callOptions.credentials&&B.setCredentials(v.callOptions.credentials);let I=!1,D=new Error;return B.start(v.metadata,{onReceiveMetadata(C){R.emit("metadata",C)},onReceiveMessage(C){R.push(C)},onReceiveStatus(C){if(!I){if(I=!0,R.push(null),C.code!==Wr.Status.OK){let P=Xi(D);R.emit("error",rr.callErrorFromStatus(C,P))}R.emit("status",C)}}}),B.sendMessage(o),B.halfClose(),R}makeBidiStreamRequest(t,i,s,o,l){var g,_;let p=this.checkMetadataAndOptions(o,l),m={path:t,requestStream:!0,responseStream:!0,requestSerialize:i,responseDeserialize:s},S={metadata:p.metadata,call:new rr.ClientDuplexStreamImpl(i,s),channel:this[Lt],methodDefinition:m,callOptions:p.options};this[Er]&&(S=this[Er](S));let v=S.call,R={clientInterceptors:this[$i],clientInterceptorProviders:this[Ki],callInterceptors:(g=S.callOptions.interceptors)!==null&&g!==void 0?g:[],callInterceptorProviders:(_=S.callOptions.interceptor_providers)!==null&&_!==void 0?_:[]},w=Ba.getInterceptingCall(R,S.methodDefinition,S.callOptions,S.channel);v.call=w,S.callOptions.credentials&&w.setCredentials(S.callOptions.credentials);let B=!1,I=new Error;return w.start(S.metadata,{onReceiveMetadata(D){v.emit("metadata",D)},onReceiveMessage(D){v.push(D)},onReceiveStatus(D){if(!B){if(B=!0,v.push(null),D.code!==Wr.Status.OK){let C=Xi(I);v.emit("error",rr.callErrorFromStatus(D,C))}v.emit("status",D)}}}),v}};Na.Client=vc});var Rc=j(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.loadPackageDefinition=Ji.makeClientConstructor=void 0;var Bn=Ec(),HE={unary:Bn.Client.prototype.makeUnaryRequest,server_stream:Bn.Client.prototype.makeServerStreamRequest,client_stream:Bn.Client.prototype.makeClientStreamRequest,bidi:Bn.Client.prototype.makeBidiStreamRequest};function Ac(r){return["__proto__","prototype","constructor"].includes(r)}function sh(r,t,i){i||(i={});class s extends Bn.Client{}return Object.keys(r).forEach(o=>{if(Ac(o))return;let l=r[o],g;if(typeof o=="string"&&o.charAt(0)==="$")throw new Error("Method names cannot start with $");l.requestStream?l.responseStream?g="bidi":g="client_stream":l.responseStream?g="server_stream":g="unary";let _=l.requestSerialize,p=l.responseDeserialize,m=VE(HE[g],l.path,_,p);s.prototype[o]=m,Object.assign(s.prototype[o],l),l.originalName&&!Ac(l.originalName)&&(s.prototype[l.originalName]=s.prototype[o])}),s.service=r,s.serviceName=t,s}Ji.makeClientConstructor=sh;function VE(r,t,i,s){return function(...o){return r.call(this,t,i,s,...o)}}function GE(r){return"format"in r}function YE(r){let t={};for(let i in r)if(Object.prototype.hasOwnProperty.call(r,i)){let s=r[i],o=i.split(".");if(o.some(_=>Ac(_)))continue;let l=o[o.length-1],g=t;for(let _ of o.slice(0,-1))g[_]||(g[_]={}),g=g[_];GE(s)?g[l]=s:g[l]=sh(s,l,{})}return t}Ji.loadPackageDefinition=YE});var Mh=j((XO,Ch)=>{var $E=1/0,KE="[object Symbol]",XE=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,JE=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ia="\\ud800-\\udfff",ph="\\u0300-\\u036f\\ufe20-\\ufe23",dh="\\u20d0-\\u20f0",hh="\\u2700-\\u27bf",fh="a-z\\xdf-\\xf6\\xf8-\\xff",ZE="\\xac\\xb1\\xd7\\xf7",QE="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",eT="\\u2000-\\u206f",tT=" \\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",_h="A-Z\\xc0-\\xd6\\xd8-\\xde",mh="\\ufe0e\\ufe0f",yh=ZE+QE+eT+tT,Oc="['\u2019]",rT="["+Ia+"]",nh="["+yh+"]",xa="["+ph+dh+"]",bh="\\d+",iT="["+hh+"]",Sh="["+fh+"]",vh="[^"+Ia+yh+bh+hh+fh+_h+"]",wc="\\ud83c[\\udffb-\\udfff]",sT="(?:"+xa+"|"+wc+")",Eh="[^"+Ia+"]",Cc="(?:\\ud83c[\\udde6-\\uddff]){2}",Mc="[\\ud800-\\udbff][\\udc00-\\udfff]",Zi="["+_h+"]",Th="\\u200d",oh="(?:"+Sh+"|"+vh+")",nT="(?:"+Zi+"|"+vh+")",ah="(?:"+Oc+"(?:d|ll|m|re|s|t|ve))?",lh="(?:"+Oc+"(?:D|LL|M|RE|S|T|VE))?",Ah=sT+"?",Rh="["+mh+"]?",oT="(?:"+Th+"(?:"+[Eh,Cc,Mc].join("|")+")"+Rh+Ah+")*",wh=Rh+Ah+oT,aT="(?:"+[iT,Cc,Mc].join("|")+")"+wh,lT="(?:"+[Eh+xa+"?",xa,Cc,Mc,rT].join("|")+")",uT=RegExp(Oc,"g"),cT=RegExp(xa,"g"),gT=RegExp(wc+"(?="+wc+")|"+lT+wh,"g"),pT=RegExp([Zi+"?"+Sh+"+"+ah+"(?="+[nh,Zi,"$"].join("|")+")",nT+"+"+lh+"(?="+[nh,Zi+oh,"$"].join("|")+")",Zi+"?"+oh+"+"+ah,Zi+"+"+lh,bh,aT].join("|"),"g"),dT=RegExp("["+Th+Ia+ph+dh+mh+"]"),hT=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fT={\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"},_T=typeof global=="object"&&global&&global.Object===Object&&global,mT=typeof self=="object"&&self&&self.Object===Object&&self,yT=_T||mT||Function("return this")();function bT(r,t,i,s){var o=-1,l=r?r.length:0;for(s&&l&&(i=r[++o]);++oo?0:o+t),i=i>o?o:i,i<0&&(i+=o),o=t>i?0:i-t>>>0,t>>>=0;for(var l=Array(o);++s=s?r:jT(r,t,i)}function xT(r){return function(t){t=Fa(t);var i=Oh(t)?RT(t):void 0,s=i?i[0]:t.charAt(0),o=i?NT(i,1).join(""):t.slice(1);return s[r]()+o}}function IT(r){return function(t){return bT(zT(kT(t).replace(uT,"")),r,"")}}function FT(r){return!!r&&typeof r=="object"}function UT(r){return typeof r=="symbol"||FT(r)&&MT.call(r)==KE}function Fa(r){return r==null?"":BT(r)}var DT=IT(function(r,t,i){return t=t.toLowerCase(),r+(i?PT(t):t)});function PT(r){return LT(Fa(r).toLowerCase())}function kT(r){return r=Fa(r),r&&r.replace(JE,TT).replace(cT,"")}var LT=xT("toUpperCase");function zT(r,t,i){return r=Fa(r),t=i?void 0:t,t===void 0?AT(r)?OT(r):vT(r):r.match(t)||[]}Ch.exports=DT});var jc=j((JO,jh)=>{"use strict";jh.exports=WT;function WT(r,t){for(var i=new Array(arguments.length-1),s=0,o=2,l=!0;o{"use strict";var Ua=xh;Ua.length=function(t){var i=t.length;if(!i)return 0;for(var s=0;--i%4>1&&t.charAt(i)==="=";)++s;return Math.ceil(t.length*3)/4-s};var Qi=new Array(64),Nh=new Array(123);for(zt=0;zt<64;)Nh[Qi[zt]=zt<26?zt+65:zt<52?zt+71:zt<62?zt-4:zt-59|43]=zt++;var zt;Ua.encode=function(t,i,s){for(var o=null,l=[],g=0,_=0,p;i>2],p=(m&3)<<4,_=1;break;case 1:l[g++]=Qi[p|m>>4],p=(m&15)<<2,_=2;break;case 2:l[g++]=Qi[p|m>>6],l[g++]=Qi[m&63],_=0;break}g>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,l)),g=0)}return _&&(l[g++]=Qi[p],l[g++]=61,_===1&&(l[g++]=61)),o?(g&&o.push(String.fromCharCode.apply(String,l.slice(0,g))),o.join("")):String.fromCharCode.apply(String,l.slice(0,g))};var Bh="invalid encoding";Ua.decode=function(t,i,s){for(var o=s,l=0,g,_=0;_1)break;if((p=Nh[p])===void 0)throw Error(Bh);switch(l){case 0:g=p,l=1;break;case 1:i[s++]=g<<2|(p&48)>>4,g=p,l=2;break;case 2:i[s++]=(g&15)<<4|(p&60)>>2,g=p,l=3;break;case 3:i[s++]=(g&3)<<6|p,l=0;break}}if(l===1)throw Error(Bh);return s-o};Ua.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var Uh=j((QO,Fh)=>{"use strict";Fh.exports=Da;function Da(){this._listeners={}}Da.prototype.on=function(t,i,s){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:i,ctx:s||this}),this};Da.prototype.off=function(t,i){if(t===void 0)this._listeners={};else if(i===void 0)this._listeners[t]=[];else for(var s=this._listeners[t],o=0;o{"use strict";Wh.exports=Dh(Dh);function Dh(r){return typeof Float32Array!="undefined"?function(){var t=new Float32Array([-0]),i=new Uint8Array(t.buffer),s=i[3]===128;function o(p,m,S){t[0]=p,m[S]=i[0],m[S+1]=i[1],m[S+2]=i[2],m[S+3]=i[3]}function l(p,m,S){t[0]=p,m[S]=i[3],m[S+1]=i[2],m[S+2]=i[1],m[S+3]=i[0]}r.writeFloatLE=s?o:l,r.writeFloatBE=s?l:o;function g(p,m){return i[0]=p[m],i[1]=p[m+1],i[2]=p[m+2],i[3]=p[m+3],t[0]}function _(p,m){return i[3]=p[m],i[2]=p[m+1],i[1]=p[m+2],i[0]=p[m+3],t[0]}r.readFloatLE=s?g:_,r.readFloatBE=s?_:g}():function(){function t(s,o,l,g){var _=o<0?1:0;if(_&&(o=-o),o===0)s(1/o>0?0:2147483648,l,g);else if(isNaN(o))s(2143289344,l,g);else if(o>34028234663852886e22)s((_<<31|2139095040)>>>0,l,g);else if(o<11754943508222875e-54)s((_<<31|Math.round(o/1401298464324817e-60))>>>0,l,g);else{var p=Math.floor(Math.log(o)/Math.LN2),m=Math.round(o*Math.pow(2,-p)*8388608)&8388607;s((_<<31|p+127<<23|m)>>>0,l,g)}}r.writeFloatLE=t.bind(null,Ph),r.writeFloatBE=t.bind(null,kh);function i(s,o,l){var g=s(o,l),_=(g>>31)*2+1,p=g>>>23&255,m=g&8388607;return p===255?m?NaN:_*(1/0):p===0?_*1401298464324817e-60*m:_*Math.pow(2,p-150)*(m+8388608)}r.readFloatLE=i.bind(null,Lh),r.readFloatBE=i.bind(null,zh)}(),typeof Float64Array!="undefined"?function(){var t=new Float64Array([-0]),i=new Uint8Array(t.buffer),s=i[7]===128;function o(p,m,S){t[0]=p,m[S]=i[0],m[S+1]=i[1],m[S+2]=i[2],m[S+3]=i[3],m[S+4]=i[4],m[S+5]=i[5],m[S+6]=i[6],m[S+7]=i[7]}function l(p,m,S){t[0]=p,m[S]=i[7],m[S+1]=i[6],m[S+2]=i[5],m[S+3]=i[4],m[S+4]=i[3],m[S+5]=i[2],m[S+6]=i[1],m[S+7]=i[0]}r.writeDoubleLE=s?o:l,r.writeDoubleBE=s?l:o;function g(p,m){return i[0]=p[m],i[1]=p[m+1],i[2]=p[m+2],i[3]=p[m+3],i[4]=p[m+4],i[5]=p[m+5],i[6]=p[m+6],i[7]=p[m+7],t[0]}function _(p,m){return i[7]=p[m],i[6]=p[m+1],i[5]=p[m+2],i[4]=p[m+3],i[3]=p[m+4],i[2]=p[m+5],i[1]=p[m+6],i[0]=p[m+7],t[0]}r.readDoubleLE=s?g:_,r.readDoubleBE=s?_:g}():function(){function t(s,o,l,g,_,p){var m=g<0?1:0;if(m&&(g=-g),g===0)s(0,_,p+o),s(1/g>0?0:2147483648,_,p+l);else if(isNaN(g))s(0,_,p+o),s(2146959360,_,p+l);else if(g>17976931348623157e292)s(0,_,p+o),s((m<<31|2146435072)>>>0,_,p+l);else{var S;if(g<22250738585072014e-324)S=g/5e-324,s(S>>>0,_,p+o),s((m<<31|S/4294967296)>>>0,_,p+l);else{var v=Math.floor(Math.log(g)/Math.LN2);v===1024&&(v=1023),S=g*Math.pow(2,-v),s(S*4503599627370496>>>0,_,p+o),s((m<<31|v+1023<<20|S*1048576&1048575)>>>0,_,p+l)}}}r.writeDoubleLE=t.bind(null,Ph,0,4),r.writeDoubleBE=t.bind(null,kh,4,0);function i(s,o,l,g,_){var p=s(g,_+o),m=s(g,_+l),S=(m>>31)*2+1,v=m>>>20&2047,R=4294967296*(m&1048575)+p;return v===2047?R?NaN:S*(1/0):v===0?S*5e-324*R:S*Math.pow(2,v-1075)*(R+4503599627370496)}r.readDoubleLE=i.bind(null,Lh,0,4),r.readDoubleBE=i.bind(null,zh,4,0)}(),r}function Ph(r,t,i){t[i]=r&255,t[i+1]=r>>>8&255,t[i+2]=r>>>16&255,t[i+3]=r>>>24}function kh(r,t,i){t[i]=r>>>24,t[i+1]=r>>>16&255,t[i+2]=r>>>8&255,t[i+3]=r&255}function Lh(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24)>>>0}function zh(r,t){return(r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3])>>>0}});var Bc=j((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}});var Vh=j(Hh=>{"use strict";var Nc=Hh;Nc.length=function(t){for(var i=0,s=0,o=0;o191&&p<224?g[_++]=(p&31)<<6|t[i++]&63:p>239&&p<365?(p=((p&7)<<18|(t[i++]&63)<<12|(t[i++]&63)<<6|t[i++]&63)-65536,g[_++]=55296+(p>>10),g[_++]=56320+(p&1023)):g[_++]=(p&15)<<12|(t[i++]&63)<<6|t[i++]&63,_>8191&&((l||(l=[])).push(String.fromCharCode.apply(String,g)),_=0);return l?(_&&l.push(String.fromCharCode.apply(String,g.slice(0,_))),l.join("")):String.fromCharCode.apply(String,g.slice(0,_))};Nc.write=function(t,i,s){for(var o=s,l,g,_=0;_>6|192,i[s++]=l&63|128):(l&64512)===55296&&((g=t.charCodeAt(_+1))&64512)===56320?(l=65536+((l&1023)<<10)+(g&1023),++_,i[s++]=l>>18|240,i[s++]=l>>12&63|128,i[s++]=l>>6&63|128,i[s++]=l&63|128):(i[s++]=l>>12|224,i[s++]=l>>6&63|128,i[s++]=l&63|128);return s-o}});var Yh=j((rC,Gh)=>{"use strict";Gh.exports=qT;function qT(r,t,i){var s=i||8192,o=s>>>1,l=null,g=s;return function(p){if(p<1||p>o)return r(p);g+p>s&&(l=r(s),g=0);var m=t.call(l,g,g+=p);return g&7&&(g=(g|7)+1),m}}});var Kh=j((iC,$h)=>{"use strict";$h.exports=De;var Nn=ir();function De(r,t){this.lo=r>>>0,this.hi=t>>>0}var fi=De.zero=new De(0,0);fi.toNumber=function(){return 0};fi.zzEncode=fi.zzDecode=function(){return this};fi.length=function(){return 1};var HT=De.zeroHash="\0\0\0\0\0\0\0\0";De.fromNumber=function(t){if(t===0)return fi;var i=t<0;i&&(t=-t);var s=t>>>0,o=(t-s)/4294967296>>>0;return i&&(o=~o>>>0,s=~s>>>0,++s>4294967295&&(s=0,++o>4294967295&&(o=0))),new De(s,o)};De.from=function(t){if(typeof t=="number")return De.fromNumber(t);if(Nn.isString(t))if(Nn.Long)t=Nn.Long.fromString(t);else return De.fromNumber(parseInt(t,10));return t.low||t.high?new De(t.low>>>0,t.high>>>0):fi};De.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var i=~this.lo+1>>>0,s=~this.hi>>>0;return i||(s=s+1>>>0),-(i+s*4294967296)}return this.lo+this.hi*4294967296};De.prototype.toLong=function(t){return Nn.Long?new Nn.Long(this.lo|0,this.hi|0,Boolean(t)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(t)}};var qr=String.prototype.charCodeAt;De.fromHash=function(t){return t===HT?fi:new De((qr.call(t,0)|qr.call(t,1)<<8|qr.call(t,2)<<16|qr.call(t,3)<<24)>>>0,(qr.call(t,4)|qr.call(t,5)<<8|qr.call(t,6)<<16|qr.call(t,7)<<24)>>>0)};De.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)};De.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};De.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};De.prototype.length=function(){var t=this.lo,i=(this.lo>>>28|this.hi<<4)>>>0,s=this.hi>>>24;return s===0?i===0?t<16384?t<128?1:2:t<2097152?3:4:i<16384?i<128?5:6:i<2097152?7:8:s<128?9:10}});var ir=j(xc=>{"use strict";var Z=xc;Z.asPromise=jc();Z.base64=Ih();Z.EventEmitter=Uh();Z.float=qh();Z.inquire=Bc();Z.utf8=Vh();Z.pool=Yh();Z.LongBits=Kh();Z.isNode=Boolean(typeof global!="undefined"&&global&&global.process&&global.process.versions&&global.process.versions.node);Z.global=Z.isNode&&global||typeof window!="undefined"&&window||typeof self!="undefined"&&self||xc;Z.emptyArray=Object.freeze?Object.freeze([]):[];Z.emptyObject=Object.freeze?Object.freeze({}):{};Z.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};Z.isString=function(t){return typeof t=="string"||t instanceof String};Z.isObject=function(t){return t&&typeof t=="object"};Z.isset=Z.isSet=function(t,i){var s=t[i];return s!=null&&t.hasOwnProperty(i)?typeof s!="object"||(Array.isArray(s)?s.length:Object.keys(s).length)>0:!1};Z.Buffer=function(){try{var r=Z.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch(t){return null}}();Z._Buffer_from=null;Z._Buffer_allocUnsafe=null;Z.newBuffer=function(t){return typeof t=="number"?Z.Buffer?Z._Buffer_allocUnsafe(t):new Z.Array(t):Z.Buffer?Z._Buffer_from(t):typeof Uint8Array=="undefined"?t:new Uint8Array(t)};Z.Array=typeof Uint8Array!="undefined"?Uint8Array:Array;Z.Long=Z.global.dcodeIO&&Z.global.dcodeIO.Long||Z.global.Long||Z.inquire("long");Z.key2Re=/^true|false|0|1$/;Z.key32Re=/^-?(?:0|[1-9][0-9]*)$/;Z.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;Z.longToHash=function(t){return t?Z.LongBits.from(t).toHash():Z.LongBits.zeroHash};Z.longFromHash=function(t,i){var s=Z.LongBits.fromHash(t);return Z.Long?Z.Long.fromBits(s.lo,s.hi,i):s.toNumber(Boolean(i))};function Xh(r,t,i){for(var s=Object.keys(t),o=0;o-1;--l)if(i[o[l]]===1&&this[o[l]]!==void 0&&this[o[l]]!==null)return o[l]}};Z.oneOfSetter=function(t){return function(i){for(var s=0;s{"use strict";tf.exports=he;var Tt=ir(),Ic,Pa=Tt.LongBits,Zh=Tt.base64,Qh=Tt.utf8;function xn(r,t,i){this.fn=r,this.len=t,this.next=void 0,this.val=i}function Uc(){}function VT(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function he(){this.len=0,this.head=new xn(Uc,0,0),this.tail=this.head,this.states=null}var ef=function(){return Tt.Buffer?function(){return(he.create=function(){return new Ic})()}:function(){return new he}};he.create=ef();he.alloc=function(t){return new Tt.Array(t)};Tt.Array!==Array&&(he.alloc=Tt.pool(he.alloc,Tt.Array.prototype.subarray));he.prototype._push=function(t,i,s){return this.tail=this.tail.next=new xn(t,i,s),this.len+=i,this};function Dc(r,t,i){t[i]=r&255}function GT(r,t,i){for(;r>127;)t[i++]=r&127|128,r>>>=7;t[i]=r}function Pc(r,t){this.len=r,this.next=void 0,this.val=t}Pc.prototype=Object.create(xn.prototype);Pc.prototype.fn=GT;he.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Pc((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};he.prototype.int32=function(t){return t<0?this._push(kc,10,Pa.fromNumber(t)):this.uint32(t)};he.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function kc(r,t,i){for(;r.hi;)t[i++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[i++]=r.lo&127|128,r.lo=r.lo>>>7;t[i++]=r.lo}he.prototype.uint64=function(t){var i=Pa.from(t);return this._push(kc,i.length(),i)};he.prototype.int64=he.prototype.uint64;he.prototype.sint64=function(t){var i=Pa.from(t).zzEncode();return this._push(kc,i.length(),i)};he.prototype.bool=function(t){return this._push(Dc,1,t?1:0)};function Fc(r,t,i){t[i]=r&255,t[i+1]=r>>>8&255,t[i+2]=r>>>16&255,t[i+3]=r>>>24}he.prototype.fixed32=function(t){return this._push(Fc,4,t>>>0)};he.prototype.sfixed32=he.prototype.fixed32;he.prototype.fixed64=function(t){var i=Pa.from(t);return this._push(Fc,4,i.lo)._push(Fc,4,i.hi)};he.prototype.sfixed64=he.prototype.fixed64;he.prototype.float=function(t){return this._push(Tt.float.writeFloatLE,4,t)};he.prototype.double=function(t){return this._push(Tt.float.writeDoubleLE,8,t)};var YT=Tt.Array.prototype.set?function(t,i,s){i.set(t,s)}:function(t,i,s){for(var o=0;o>>0;if(!i)return this._push(Dc,1,0);if(Tt.isString(t)){var s=he.alloc(i=Zh.length(t));Zh.decode(t,s,0),t=s}return this.uint32(i)._push(YT,i,t)};he.prototype.string=function(t){var i=Qh.length(t);return i?this.uint32(i)._push(Qh.write,i,t):this._push(Dc,1,0)};he.prototype.fork=function(){return this.states=new VT(this),this.head=this.tail=new xn(Uc,0,0),this.len=0,this};he.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 xn(Uc,0,0),this.len=0),this};he.prototype.ldelim=function(){var t=this.head,i=this.tail,s=this.len;return this.reset().uint32(s),s&&(this.tail.next=t.next,this.tail=i,this.len+=s),this};he.prototype.finish=function(){for(var t=this.head.next,i=this.constructor.alloc(this.len),s=0;t;)t.fn(t.val,i,s),s+=t.len,t=t.next;return i};he._configure=function(r){Ic=r,he.create=ef(),Ic._configure()}});var nf=j((oC,sf)=>{"use strict";sf.exports=sr;var rf=ka();(sr.prototype=Object.create(rf.prototype)).constructor=sr;var Hr=ir();function sr(){rf.call(this)}sr._configure=function(){sr.alloc=Hr._Buffer_allocUnsafe,sr.writeBytesBuffer=Hr.Buffer&&Hr.Buffer.prototype instanceof Uint8Array&&Hr.Buffer.prototype.set.name==="set"?function(t,i,s){i.set(t,s)}:function(t,i,s){if(t.copy)t.copy(i,s,0,t.length);else for(var o=0;o>>0;return this.uint32(i),i&&this._push(sr.writeBytesBuffer,i,t),this};function $T(r,t,i){r.length<40?Hr.utf8.write(r,t,i):t.utf8Write?t.utf8Write(r,i):t.write(r,i)}sr.prototype.string=function(t){var i=Hr.Buffer.byteLength(t);return this.uint32(i),i&&this._push($T,i,t),this};sr._configure()});var za=j((aC,cf)=>{"use strict";cf.exports=je;var nr=ir(),zc,lf=nr.LongBits,KT=nr.utf8;function Wt(r,t){return RangeError("index out of range: "+r.pos+" + "+(t||1)+" > "+r.len)}function je(r){this.buf=r,this.pos=0,this.len=r.length}var of=typeof Uint8Array!="undefined"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new je(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new je(t);throw Error("illegal buffer")},uf=function(){return nr.Buffer?function(i){return(je.create=function(o){return nr.Buffer.isBuffer(o)?new zc(o):of(o)})(i)}:of};je.create=uf();je.prototype._slice=nr.Array.prototype.subarray||nr.Array.prototype.slice;je.prototype.uint32=function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,Wt(this,10);return t}}();je.prototype.int32=function(){return this.uint32()|0};je.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function Lc(){var r=new lf(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(r.lo=(r.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Wt(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<>>0,r}if(this.len-this.pos>4){for(;t<5;++t)if(r.hi=(r.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}else for(;t<5;++t){if(this.pos>=this.len)throw Wt(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}je.prototype.bool=function(){return this.uint32()!==0};function La(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}je.prototype.fixed32=function(){if(this.pos+4>this.len)throw Wt(this,4);return La(this.buf,this.pos+=4)};je.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Wt(this,4);return La(this.buf,this.pos+=4)|0};function af(){if(this.pos+8>this.len)throw Wt(this,8);return new lf(La(this.buf,this.pos+=4),La(this.buf,this.pos+=4))}je.prototype.float=function(){if(this.pos+4>this.len)throw Wt(this,4);var t=nr.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};je.prototype.double=function(){if(this.pos+8>this.len)throw Wt(this,4);var t=nr.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};je.prototype.bytes=function(){var t=this.uint32(),i=this.pos,s=this.pos+t;if(s>this.len)throw Wt(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(i,s):i===s?new this.buf.constructor(0):this._slice.call(this.buf,i,s)};je.prototype.string=function(){var t=this.bytes();return KT.read(t,0,t.length)};je.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw Wt(this,t);this.pos+=t}else do if(this.pos>=this.len)throw Wt(this);while(this.buf[this.pos++]&128);return this};je.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};je._configure=function(r){zc=r,je.create=uf(),zc._configure();var t=nr.Long?"toLong":"toNumber";nr.merge(je.prototype,{int64:function(){return Lc.call(this)[t](!1)},uint64:function(){return Lc.call(this)[t](!0)},sint64:function(){return Lc.call(this).zzDecode()[t](!1)},fixed64:function(){return af.call(this)[t](!0)},sfixed64:function(){return af.call(this)[t](!1)}})}});var hf=j((lC,df)=>{"use strict";df.exports=_i;var pf=za();(_i.prototype=Object.create(pf.prototype)).constructor=_i;var gf=ir();function _i(r){pf.call(this,r)}_i._configure=function(){gf.Buffer&&(_i.prototype._slice=gf.Buffer.prototype.slice)};_i.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};_i._configure()});var _f=j((uC,ff)=>{"use strict";ff.exports=In;var Wc=ir();(In.prototype=Object.create(Wc.EventEmitter.prototype)).constructor=In;function In(r,t,i){if(typeof r!="function")throw TypeError("rpcImpl must be a function");Wc.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(i)}In.prototype.rpcCall=function r(t,i,s,o,l){if(!o)throw TypeError("request must be specified");var g=this;if(!l)return Wc.asPromise(r,g,t,i,s,o);if(!g.rpcImpl){setTimeout(function(){l(Error("already ended"))},0);return}try{return g.rpcImpl(t,i[g.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(p,m){if(p)return g.emit("error",p,t),l(p);if(m===null){g.end(!0);return}if(!(m instanceof s))try{m=s[g.responseDelimited?"decodeDelimited":"decode"](m)}catch(S){return g.emit("error",S,t),l(S)}return g.emit("data",m,t),l(null,m)})}catch(_){g.emit("error",_,t),setTimeout(function(){l(_)},0);return}};In.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var qc=j(mf=>{"use strict";var XT=mf;XT.Service=_f()});var Hc=j((gC,yf)=>{"use strict";yf.exports={}});var vf=j(Sf=>{"use strict";var ot=Sf;ot.build="minimal";ot.Writer=ka();ot.BufferWriter=nf();ot.Reader=za();ot.BufferReader=hf();ot.util=ir();ot.rpc=qc();ot.roots=Hc();ot.configure=bf;function bf(){ot.util._configure(),ot.Writer._configure(ot.BufferWriter),ot.Reader._configure(ot.BufferReader)}bf()});var Tf=j((dC,Ef)=>{"use strict";Ef.exports=Vc;function Vc(r,t){typeof r=="string"&&(t=r,r=void 0);var i=[];function s(l){if(typeof l!="string"){var g=o();if(Vc.verbose&&console.log("codegen: "+g),g="return "+g,l){for(var _=Object.keys(l),p=new Array(_.length+1),m=new Array(_.length),S=0;S<_.length;)p[S]=_[S],m[S]=l[_[S++]];return p[S]=g,Function.apply(null,p).apply(null,m)}return Function(g)()}for(var v=new Array(arguments.length-1),R=0;R{"use strict";Af.exports=Fn;var JT=jc(),ZT=Bc(),Gc=ZT("fs");function Fn(r,t,i){return typeof t=="function"?(i=t,t={}):t||(t={}),i?!t.xhr&&Gc&&Gc.readFile?Gc.readFile(r,function(o,l){return o&&typeof XMLHttpRequest!="undefined"?Fn.xhr(r,t,i):o?i(o):i(null,t.binary?l:l.toString("utf8"))}):Fn.xhr(r,t,i):JT(Fn,this,r,t)}Fn.xhr=function(t,i,s){var o=new XMLHttpRequest;o.onreadystatechange=function(){if(o.readyState===4){if(o.status!==0&&o.status!==200)return s(Error("status "+o.status));if(i.binary){var g=o.response;if(!g){g=[];for(var _=0;_{"use strict";var $c=Of,wf=$c.isAbsolute=function(t){return/^(?:\/|\w+:)/.test(t)},Yc=$c.normalize=function(t){t=t.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var i=t.split("/"),s=wf(t),o="";s&&(o=i.shift()+"/");for(var l=0;l0&&i[l-1]!==".."?i.splice(--l,2):s?i.splice(l,1):++l:i[l]==="."?i.splice(l,1):++l;return o+i.join("/")};$c.resolve=function(t,i,s){return s||(i=Yc(i)),wf(i)?i:(s||(t=Yc(t)),(t=t.replace(/(?:\/|^)[^/]+$/,"")).length?Yc(t+"/"+i):i)}});var mi=j(Mf=>{"use strict";var Un=Mf,QT=Pe(),e1=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function Dn(r,t){var i=0,s={};for(t|=0;i{"use strict";Nf.exports=At;var Wa=yi();((At.prototype=Object.create(Wa.prototype)).constructor=At).className="Field";var jf=qt(),Bf=mi(),xe=Pe(),Kc,t1=/^required|optional|repeated$/;At.fromJSON=function(t,i){return new At(t,i.id,i.type,i.rule,i.extend,i.options,i.comment)};function At(r,t,i,s,o,l,g){if(xe.isObject(s)?(g=o,l=s,s=o=void 0):xe.isObject(o)&&(g=l,l=o,o=void 0),Wa.call(this,r,l),!xe.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!xe.isString(i))throw TypeError("type must be a string");if(s!==void 0&&!t1.test(s=s.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(o!==void 0&&!xe.isString(o))throw TypeError("extend must be a string");s==="proto3_optional"&&(s="optional"),this.rule=s&&s!=="optional"?s:void 0,this.type=i,this.id=t,this.extend=o||void 0,this.required=s==="required",this.optional=!this.required,this.repeated=s==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=xe.Long?Bf.long[i]!==void 0:!1,this.bytes=i==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=g}Object.defineProperty(At.prototype,"packed",{get:function(){return this._packed===null&&(this._packed=this.getOption("packed")!==!1),this._packed}});At.prototype.setOption=function(t,i,s){return t==="packed"&&(this._packed=null),Wa.prototype.setOption.call(this,t,i,s)};At.prototype.toJSON=function(t){var i=t?Boolean(t.keepComments):!1;return xe.toObject(["rule",this.rule!=="optional"&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",i?this.comment:void 0])};At.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=Bf.defaults[this.type])===void 0?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof Kc?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 jf&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&((this.options.packed===!0||this.options.packed!==void 0&&this.resolvedType&&!(this.resolvedType instanceof jf))&&delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=xe.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var t;xe.base64.test(this.typeDefault)?xe.base64.decode(this.typeDefault,t=xe.newBuffer(xe.base64.length(this.typeDefault)),0):xe.utf8.write(this.typeDefault,t=xe.newBuffer(xe.utf8.length(this.typeDefault)),0),this.typeDefault=t}return this.map?this.defaultValue=xe.emptyObject:this.repeated?this.defaultValue=xe.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof Kc&&(this.parent.ctor.prototype[this.name]=this.defaultValue),Wa.prototype.resolve.call(this)};At.d=function(t,i,s,o){return typeof i=="function"?i=xe.decorateType(i).name:i&&typeof i=="object"&&(i=xe.decorateEnum(i).name),function(g,_){xe.decorateType(g.constructor).add(new At(_,t,i,s,{default:o}))}};At._configure=function(t){Kc=t}});var es=j((yC,Ff)=>{"use strict";Ff.exports=Rt;var Ha=yi();((Rt.prototype=Object.create(Ha.prototype)).constructor=Rt).className="OneOf";var xf=Vr(),qa=Pe();function Rt(r,t,i,s){if(Array.isArray(t)||(i=t,t=void 0),Ha.call(this,r,i),!(t===void 0||Array.isArray(t)))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=s}Rt.fromJSON=function(t,i){return new Rt(t,i.oneof,i.options,i.comment)};Rt.prototype.toJSON=function(t){var i=t?Boolean(t.keepComments):!1;return qa.toObject(["options",this.options,"oneof",this.oneof,"comment",i?this.comment:void 0])};function If(r){if(r.parent)for(var t=0;t-1&&this.oneof.splice(i,1),t.partOf=null,this};Rt.prototype.onAdd=function(t){Ha.prototype.onAdd.call(this,t);for(var i=this,s=0;s{"use strict";kf.exports=_e;var Xc=yi();((_e.prototype=Object.create(Xc.prototype)).constructor=_e).className="Namespace";var Uf=Vr(),Va=Pe(),r1=es(),ts,Pn,rs;_e.fromJSON=function(t,i){return new _e(t,i.options).addJSON(i.nested)};function Df(r,t){if(!!(r&&r.length)){for(var i={},s=0;si)return!0}return!1};_e.isReservedName=function(t,i){if(t){for(var s=0;s0;){var o=t.shift();if(s.nested&&s.nested[o]){if(s=s.nested[o],!(s instanceof _e))throw Error("path conflicts with non-namespace objects")}else s.add(s=new _e(o))}return i&&s.addJSON(i),s};_e.prototype.resolveAll=function(){for(var t=this.nestedArray,i=0;i-1)return o}else if(o instanceof _e&&(o=o.lookup(t.slice(1),i,!0)))return o}else for(var l=0;l{"use strict";Lf.exports=Tr;var Jc=Vr();((Tr.prototype=Object.create(Jc.prototype)).constructor=Tr).className="MapField";var i1=mi(),kn=Pe();function Tr(r,t,i,s,o,l){if(Jc.call(this,r,t,s,void 0,void 0,o,l),!kn.isString(i))throw TypeError("keyType must be a string");this.keyType=i,this.resolvedKeyType=null,this.map=!0}Tr.fromJSON=function(t,i){return new Tr(t,i.id,i.keyType,i.type,i.options,i.comment)};Tr.prototype.toJSON=function(t){var i=t?Boolean(t.keepComments):!1;return kn.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",i?this.comment:void 0])};Tr.prototype.resolve=function(){if(this.resolved)return this;if(i1.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return Jc.prototype.resolve.call(this)};Tr.d=function(t,i,s){return typeof s=="function"?s=kn.decorateType(s).name:s&&typeof s=="object"&&(s=kn.decorateEnum(s).name),function(l,g){kn.decorateType(l.constructor).add(new Tr(g,t,i,s))}}});var Ya=j((vC,zf)=>{"use strict";zf.exports=bi;var Zc=yi();((bi.prototype=Object.create(Zc.prototype)).constructor=bi).className="Method";var ss=Pe();function bi(r,t,i,s,o,l,g,_,p){if(ss.isObject(o)?(g=o,o=l=void 0):ss.isObject(l)&&(g=l,l=void 0),!(t===void 0||ss.isString(t)))throw TypeError("type must be a string");if(!ss.isString(i))throw TypeError("requestType must be a string");if(!ss.isString(s))throw TypeError("responseType must be a string");Zc.call(this,r,g),this.type=t||"rpc",this.requestType=i,this.requestStream=o?!0:void 0,this.responseType=s,this.responseStream=l?!0:void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=_,this.parsedOptions=p}bi.fromJSON=function(t,i){return new bi(t,i.type,i.requestType,i.responseType,i.requestStream,i.responseStream,i.options,i.comment,i.parsedOptions)};bi.prototype.toJSON=function(t){var i=t?Boolean(t.keepComments):!1;return ss.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",i?this.comment:void 0,"parsedOptions",this.parsedOptions])};bi.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),Zc.prototype.resolve.call(this))}});var $a=j((EC,qf)=>{"use strict";qf.exports=wt;var Gr=is();((wt.prototype=Object.create(Gr.prototype)).constructor=wt).className="Service";var Qc=Ya(),Ln=Pe(),s1=qc();function wt(r,t){Gr.call(this,r,t),this.methods={},this._methodsArray=null}wt.fromJSON=function(t,i){var s=new wt(t,i.options);if(i.methods)for(var o=Object.keys(i.methods),l=0;l{"use strict";Hf.exports=or;var n1=ir();function or(r){if(r)for(var t=Object.keys(r),i=0;i{"use strict";Gf.exports=l1;var o1=qt(),Ar=mi(),Vf=Pe();function a1(r){return"missing required '"+r.name+"'"}function l1(r){var t=Vf.codegen(["r","l"],r.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(r.fieldsArray.filter(function(_){return _.map}).length?",k,value":""))("while(r.pos>>3){");for(var i=0;i>>3){")("case 1: k=r.%s(); break",s.keyType)("case 2:"),Ar.basic[o]===void 0?t("value=types[%i].decode(r,r.uint32())",i):t("value=r.%s()",o),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),Ar.long[s.keyType]!==void 0?t('%s[typeof k==="object"?util.longToHash(k):k]=value',l):t("%s[k]=value",l)):s.repeated?(t("if(!(%s&&%s.length))",l,l)("%s=[]",l),Ar.packed[o]!==void 0&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos{"use strict";Yf.exports=g1;var u1=qt(),tg=Pe();function Ot(r,t){return r.name+": "+t+(r.repeated&&t!=="array"?"[]":r.map&&t!=="object"?"{k:"+r.keyType+"}":"")+" expected"}function rg(r,t,i,s){if(t.resolvedType)if(t.resolvedType instanceof u1){r("switch(%s){",s)("default:")("return%j",Ot(t,"enum value"));for(var o=Object.keys(t.resolvedType.values),l=0;l{"use strict";var $f=Kf,zn=qt(),ar=Pe();function sg(r,t,i,s){var o=!1;if(t.resolvedType)if(t.resolvedType instanceof zn){r("switch(d%s){",s);for(var l=t.resolvedType.values,g=Object.keys(l),_=0;_>>0",s,s);break;case"int32":case"sint32":case"sfixed32":r("m%s=d%s|0",s,s);break;case"uint64":p=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":r("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",s,s,p)('else if(typeof d%s==="string")',s)("m%s=parseInt(d%s,10)",s,s)('else if(typeof d%s==="number")',s)("m%s=d%s",s,s)('else if(typeof d%s==="object")',s)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",s,s,s,p?"true":"");break;case"bytes":r('if(typeof d%s==="string")',s)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",s,s,s)("else if(d%s.length >= 0)",s)("m%s=d%s",s,s);break;case"string":r("m%s=String(d%s)",s,s);break;case"bool":r("m%s=Boolean(d%s)",s,s);break}}return r}$f.fromObject=function(t){var i=t.fieldsArray,s=ar.codegen(["d"],t.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!i.length)return s("return new this.ctor");s("var m=new this.ctor");for(var o=0;o>>0,m%s.high>>>0).toNumber(%s):m%s",s,s,s,s,o?"true":"",s);break;case"bytes":r("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",s,s,s,s,s);break;default:r("d%s=m%s",s,s);break}}return r}$f.toObject=function(t){var i=t.fieldsArray.slice().sort(ar.compareFieldsById);if(!i.length)return ar.codegen()("return {}");for(var s=ar.codegen(["m","o"],t.name+"$toObject")("if(!o)")("o={}")("var d={}"),o=[],l=[],g=[],_=0;_{"use strict";var p1=Xf,d1=Ka();p1[".google.protobuf.Any"]={fromObject:function(r){if(r&&r["@type"]){var t=r["@type"].substring(r["@type"].lastIndexOf("/")+1),i=this.lookup(t);if(i){var s=r["@type"].charAt(0)==="."?r["@type"].slice(1):r["@type"];return s.indexOf("/")===-1&&(s="/"+s),this.create({type_url:s,value:i.encode(i.fromObject(r)).finish()})}}return this.fromObject(r)},toObject:function(r,t){var i="type.googleapis.com/",s="",o="";if(t&&t.json&&r.type_url&&r.value){o=r.type_url.substring(r.type_url.lastIndexOf("/")+1),s=r.type_url.substring(0,r.type_url.lastIndexOf("/")+1);var l=this.lookup(o);l&&(r=l.decode(r.value))}if(!(r instanceof this.ctor)&&r instanceof d1){var g=r.$type.toObject(r,t),_=r.$type.fullName[0]==="."?r.$type.fullName.slice(1):r.$type.fullName;return s===""&&(s=i),o=s+_,g["@type"]=o,g}return this.toObject(r,t)}}});var Za=j((CC,Zf)=>{"use strict";Zf.exports=Se;var Ht=is();((Se.prototype=Object.create(Ht.prototype)).constructor=Se).className="Type";var h1=qt(),cg=es(),Xa=Vr(),f1=Ga(),_1=$a(),lg=Ka(),ug=za(),m1=ka(),Ve=Pe(),y1=gg(),b1=eg(),S1=ig(),Jf=og(),v1=ag();function Se(r,t){Ht.call(this,r,t),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(Se.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var r=Object.keys(this.fields),t=0;t{"use strict";i_.exports=pt;var el=is();((pt.prototype=Object.create(el.prototype)).constructor=pt).className="Root";var dg=Vr(),e_=qt(),E1=es(),Yr=Pe(),t_,pg,Wn;function pt(r){el.call(this,"",r),this.deferred=[],this.files=[]}pt.fromJSON=function(t,i){return i||(i=new pt),t.options&&i.setOptions(t.options),i.addJSON(t.nested)};pt.prototype.resolvePath=Yr.path.resolve;pt.prototype.fetch=Yr.fetch;function r_(){}pt.prototype.load=function r(t,i,s){typeof i=="function"&&(s=i,i=void 0);var o=this;if(!s)return Yr.asPromise(r,o,t,i);var l=s===r_;function g(w,B){if(!!s){var I=s;if(s=null,l)throw w;I(w,B)}}function _(w){var B=w.lastIndexOf("google/protobuf/");if(B>-1){var I=w.substring(B);if(I in Wn)return I}return null}function p(w,B){try{if(Yr.isString(B)&&B.charAt(0)==="{"&&(B=JSON.parse(B)),!Yr.isString(B))o.setOptions(B.options).addJSON(B.nested);else{pg.filename=w;var I=pg(B,o,i),D,C=0;if(I.imports)for(;C-1)){if(o.files.push(w),w in Wn){l?p(w,Wn[w]):(++S,setTimeout(function(){--S,p(w,Wn[w])}));return}if(l){var I;try{I=Yr.fs.readFileSync(w).toString("utf8")}catch(D){B||g(D);return}p(w,I)}else++S,o.fetch(w,function(D,C){if(--S,!!s){if(D){B?S||g(null,o):g(D);return}p(w,C)}})}}var S=0;Yr.isString(t)&&(t=[t]);for(var v=0,R;v-1&&this.deferred.splice(i,1)}}else if(t instanceof e_)Qa.test(t.name)&&delete t.parent[t.name];else if(t instanceof el){for(var s=0;s{"use strict";var Be=n_.exports=ir(),s_=Hc(),hg,fg;Be.codegen=Tf();Be.fetch=Rf();Be.path=Cf();Be.fs=Be.inquire("fs");Be.toArray=function(t){if(t){for(var i=Object.keys(t),s=new Array(i.length),o=0;o0)l[p]=o(l[p]||{},g,_);else{var m=l[p];m&&(_=[].concat(m).concat(_)),l[p]=_}return l}if(typeof t!="object")throw TypeError("dst must be an object");if(!i)throw TypeError("path must be specified");return i=i.split("."),o(t,i,s)};Object.defineProperty(Be,"decorateRoot",{get:function(){return s_.decorated||(s_.decorated=new(tl()))}})});var yi=j((BC,o_)=>{"use strict";o_.exports=dt;dt.className="ReflectionObject";var rl=Pe(),il;function dt(r,t){if(!rl.isString(r))throw TypeError("name must be a string");if(t&&!rl.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=r,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(dt.prototype,{root:{get:function(){for(var r=this;r.parent!==null;)r=r.parent;return r}},fullName:{get:function(){for(var r=[this.name],t=this.parent;t;)r.unshift(t.name),t=t.parent;return r.join(".")}}});dt.prototype.toJSON=function(){throw Error()};dt.prototype.onAdd=function(t){this.parent&&this.parent!==t&&this.parent.remove(this),this.parent=t,this.resolved=!1;var i=t.root;i instanceof il&&i._handleAdd(this)};dt.prototype.onRemove=function(t){var i=t.root;i instanceof il&&i._handleRemove(this),this.parent=null,this.resolved=!1};dt.prototype.resolve=function(){return this.resolved?this:(this.root instanceof il&&(this.resolved=!0),this)};dt.prototype.getOption=function(t){if(this.options)return this.options[t]};dt.prototype.setOption=function(t,i,s){return(!s||!this.options||this.options[t]===void 0)&&((this.options||(this.options={}))[t]=i),this};dt.prototype.setParsedOption=function(t,i,s){this.parsedOptions||(this.parsedOptions=[]);var o=this.parsedOptions;if(s){var l=o.find(function(p){return Object.prototype.hasOwnProperty.call(p,t)});if(l){var g=l[t];rl.setProperty(g,s,i)}else l={},l[t]=rl.setProperty({},s,i),o.push(l)}else{var _={};_[t]=i,o.push(_)}return this};dt.prototype.setOptions=function(t,i){if(t)for(var s=Object.keys(t),o=0;o{"use strict";u_.exports=lr;var a_=yi();((lr.prototype=Object.create(a_.prototype)).constructor=lr).className="Enum";var l_=is(),sl=Pe();function lr(r,t,i,s,o,l){if(a_.call(this,r,i),t&&typeof t!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=s,this.comments=o||{},this.valuesOptions=l,this.reserved=void 0,t)for(var g=Object.keys(t),_=0;_{"use strict";g_.exports=C1;var O1=qt(),_g=mi(),mg=Pe();function c_(r,t,i,s){return t.resolvedType.group?r("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",i,s,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):r("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",i,s,(t.id<<3|2)>>>0)}function C1(r){for(var t=mg.codegen(["m","w"],r.name+"$encode")("if(!w)")("w=Writer.create()"),i,s,o=r.fieldsArray.slice().sort(mg.compareFieldsById),i=0;i>>0,8|_g.mapKey[l.keyType],l.keyType),p===void 0?t("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",g,s):t(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|p,_,s),t("}")("}")):l.repeated?(t("if(%s!=null&&%s.length){",s,s),l.packed&&_g.packed[_]!==void 0?t("w.uint32(%i).fork()",(l.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",s)("w.%s(%s[i])",_,s)("w.ldelim()"):(t("for(var i=0;i<%s.length;++i)",s),p===void 0?c_(t,l,g,s+"[i]"):t("w.uint32(%i).%s(%s[i])",(l.id<<3|p)>>>0,_,s)),t("}")):(l.optional&&t("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",s,l.name),p===void 0?c_(t,l,g,s):t("w.uint32(%i).%s(%s)",(l.id<<3|p)>>>0,_,s))}return t("return w")}});var d_=j((IC,p_)=>{"use strict";var ce=p_.exports=vf();ce.build="light";function M1(r,t,i){return typeof t=="function"?(i=t,t=new ce.Root):t||(t=new ce.Root),t.load(r,i)}ce.load=M1;function j1(r,t){return t||(t=new ce.Root),t.loadSync(r)}ce.loadSync=j1;ce.encoder=gg();ce.decoder=eg();ce.verifier=ig();ce.converter=og();ce.ReflectionObject=yi();ce.Namespace=is();ce.Root=tl();ce.Enum=qt();ce.Type=Za();ce.Field=Vr();ce.OneOf=es();ce.MapField=Ga();ce.Service=$a();ce.Method=Ya();ce.Message=Ka();ce.wrappers=ag();ce.types=mi();ce.util=Pe();ce.ReflectionObject._configure(ce.Root);ce.Namespace._configure(ce.Type,ce.Service,ce.Enum);ce.Root._configure(ce.Type);ce.Field._configure(ce.Type)});var bg=j((FC,__)=>{"use strict";__.exports=f_;var yg=/[\s{}=;:[\],'"()<>]/g,B1=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,N1=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,x1=/^ *[*/]+ */,I1=/^\s*\*?\/*/,F1=/\n/g,U1=/\s/,D1=/\\(.?)/g,P1={0:"\0",r:"\r",n:` +`,t:" "};function h_(r){return r.replace(D1,function(t,i){switch(i){case"\\":case"":return i;default:return P1[i]||""}})}f_.unescape=h_;function f_(r,t){r=r.toString();var i=0,s=r.length,o=1,l=0,g={},_=[],p=null;function m(H){return Error("illegal "+H+" (line "+o+")")}function S(){var H=p==="'"?N1:B1;H.lastIndex=i-1;var re=H.exec(r);if(!re)throw m("string");return i=H.lastIndex,D(p),p=null,h_(re[1])}function v(H){return r.charAt(H)}function R(H,re,Q){var te={type:r.charAt(H++),lineEmpty:!1,leading:Q},q;t?q=2:q=3;var E=H-q,M;do if(--E<0||(M=r.charAt(E))===` +`){te.lineEmpty=!0;break}while(M===" "||M===" ");for(var Y=r.substring(H,re).split(F1),le=0;le0)return _.shift();if(p)return S();var H,re,Q,te,q,E=i===0;do{if(i===s)return null;for(H=!1;U1.test(Q=v(i));)if(Q===` +`&&(E=!0,++o),++i===s)return null;if(v(i)==="/"){if(++i===s)throw m("comment");if(v(i)==="/")if(t){if(te=i,q=!1,w(i)){q=!0;do if(i=B(i),i===s||(i++,!E))break;while(w(i))}else i=Math.min(s,B(i)+1);q&&(R(te,i,E),E=!0),o++,H=!0}else{for(q=v(te=i+1)==="/";v(++i)!==` +`;)if(i===s)return null;++i,q&&(R(te,i-1,E),E=!0),++o,H=!0}else if((Q=v(i))==="*"){te=i+1,q=t||v(te)==="*";do{if(Q===` +`&&++o,++i===s)throw m("comment");re=Q,Q=v(i)}while(re!=="*"||Q!=="/");++i,q&&(R(te,i-2,E),E=!0),H=!0}else return"/"}}while(H);var M=i;yg.lastIndex=0;var Y=yg.test(v(M++));if(!Y)for(;M{"use strict";v_.exports=Rr;Rr.filename=null;Rr.defaults={keepCase:!1};var k1=bg(),m_=tl(),y_=Za(),b_=Vr(),L1=Ga(),S_=es(),z1=qt(),W1=$a(),q1=Ya(),Sg=mi(),vg=Pe(),H1=/^[1-9][0-9]*$/,V1=/^-?[1-9][0-9]*$/,G1=/^0[x][0-9a-fA-F]+$/,Y1=/^-?0[x][0-9a-fA-F]+$/,$1=/^0[0-7]+$/,K1=/^-?0[0-7]+$/,X1=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,ur=/^[a-zA-Z_][a-zA-Z_0-9]*$/,cr=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,J1=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function Rr(r,t,i){t instanceof m_||(i=t,t=new m_),i||(i=Rr.defaults);var s=i.preferTrailingComment||!1,o=k1(r,i.alternateCommentMode||!1),l=o.next,g=o.push,_=o.peek,p=o.skip,m=o.cmnt,S=!0,v,R,w,B,I=!1,D=t,C=i.keepCase?function(U){return U}:vg.camelCase;function P(U,F,k){var $=Rr.filename;return k||(Rr.filename=null),Error("illegal "+(F||"token")+" '"+U+"' ("+($?$+", ":"")+"line "+o.line+")")}function ee(){var U=[],F;do{if((F=l())!=='"'&&F!=="'")throw P(F);U.push(l()),p(F),F=_()}while(F==='"'||F==="'");return U.join("")}function H(U){var F=l();switch(F){case"'":case'"':return g(F),ee();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return Q(F,!0)}catch(k){if(U&&cr.test(F))return F;throw P(F,"value")}}function re(U,F){var k,$;do F&&((k=_())==='"'||k==="'")?U.push(ee()):U.push([$=te(l()),p("to",!0)?te(l()):$]);while(p(",",!0));p(";")}function Q(U,F){var k=1;switch(U.charAt(0)==="-"&&(k=-1,U=U.substring(1)),U){case"inf":case"INF":case"Inf":return k*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(H1.test(U))return k*parseInt(U,10);if(G1.test(U))return k*parseInt(U,16);if($1.test(U))return k*parseInt(U,8);if(X1.test(U))return k*parseFloat(U);throw P(U,"number",F)}function te(U,F){switch(U){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!F&&U.charAt(0)==="-")throw P(U,"id");if(V1.test(U))return parseInt(U,10);if(Y1.test(U))return parseInt(U,16);if(K1.test(U))return parseInt(U,8);throw P(U,"id")}function q(){if(v!==void 0)throw P("package");if(v=l(),!cr.test(v))throw P(v,"name");D=D.define(v),p(";")}function E(){var U=_(),F;switch(U){case"weak":F=w||(w=[]),l();break;case"public":l();default:F=R||(R=[]);break}U=ee(),p(";"),F.push(U)}function M(){if(p("="),B=ee(),I=B==="proto3",!I&&B!=="proto2")throw P(B,"syntax");p(";")}function Y(U,F){switch(F){case"option":return ze(U,F),p(";"),!0;case"message":return Ke(U,F),!0;case"enum":return ge(U,F),!0;case"service":return Cs(U,F),!0;case"extend":return js(U,F),!0}return!1}function le(U,F,k){var $=o.line;if(U&&(typeof U.comment!="string"&&(U.comment=m()),U.filename=Rr.filename),p("{",!0)){for(var K;(K=l())!=="}";)F(K);p(";",!0)}else k&&k(),p(";"),U&&(typeof U.comment!="string"||s)&&(U.comment=m($)||U.comment)}function Ke(U,F){if(!ur.test(F=l()))throw P(F,"type name");var k=new y_(F);le(k,function(K){if(!Y(k,K))switch(K){case"map":T(k,K);break;case"required":case"repeated":Xe(k,K);break;case"optional":I?Xe(k,"proto3_optional"):Xe(k,"optional");break;case"oneof":x(k,K);break;case"extensions":re(k.extensions||(k.extensions=[]));break;case"reserved":re(k.reserved||(k.reserved=[]),!0);break;default:if(!I||!cr.test(K))throw P(K);g(K),Xe(k,"optional");break}}),U.add(k)}function Xe(U,F,k){var $=l();if($==="group"){rt(U,F);return}if(!cr.test($))throw P($,"type");var K=l();if(!ur.test(K))throw P(K,"name");K=C(K),p("=");var se=new b_(K,te(l()),$,F,k);if(le(se,function(We){if(We==="option")ze(se,We),p(";");else throw P(We)},function(){ui(se)}),F==="proto3_optional"){var we=new S_("_"+K);se.setOption("proto3_optional",!0),we.add(se),U.add(we)}else U.add(se);!I&&se.repeated&&(Sg.packed[$]!==void 0||Sg.basic[$]===void 0)&&se.setOption("packed",!1,!0)}function rt(U,F){var k=l();if(!ur.test(k))throw P(k,"name");var $=vg.lcFirst(k);k===$&&(k=vg.ucFirst(k)),p("=");var K=te(l()),se=new y_(k);se.group=!0;var we=new b_($,K,k,F);we.filename=Rr.filename,le(se,function(We){switch(We){case"option":ze(se,We),p(";");break;case"required":case"repeated":Xe(se,We);break;case"optional":I?Xe(se,"proto3_optional"):Xe(se,"optional");break;case"message":Ke(se,We);break;case"enum":ge(se,We);break;default:throw P(We)}}),U.add(se).add(we)}function T(U){p("<");var F=l();if(Sg.mapKey[F]===void 0)throw P(F,"type");p(",");var k=l();if(!cr.test(k))throw P(k,"type");p(">");var $=l();if(!ur.test($))throw P($,"name");p("=");var K=new L1(C($),te(l()),F,k);le(K,function(we){if(we==="option")ze(K,we),p(";");else throw P(we)},function(){ui(K)}),U.add(K)}function x(U,F){if(!ur.test(F=l()))throw P(F,"name");var k=new S_(C(F));le(k,function(K){K==="option"?(ze(k,K),p(";")):(g(K),Xe(k,"optional"))}),U.add(k)}function ge(U,F){if(!ur.test(F=l()))throw P(F,"name");var k=new z1(F);le(k,function(K){switch(K){case"option":ze(k,K),p(";");break;case"reserved":re(k.reserved||(k.reserved=[]),!0);break;default:Os(k,K)}}),U.add(k)}function Os(U,F){if(!ur.test(F))throw P(F,"name");p("=");var k=te(l(),!0),$={options:void 0};$.setOption=function(K,se){this.options===void 0&&(this.options={}),this.options[K]=se},le($,function(se){if(se==="option")ze($,se),p(";");else throw P(se)},function(){ui($)}),U.add(F,k,$.comment,$.options)}function ze(U,F){var k=p("(",!0);if(!cr.test(F=l()))throw P(F,"name");var $=F,K=$,se;k&&(p(")"),$="("+$+")",K=$,F=_(),J1.test(F)&&(se=F.slice(1),$+=F,l())),p("=");var we=Br(U,$);li(U,K,we,se)}function Br(U,F){if(p("{",!0)){for(var k={};!p("}",!0);){if(!ur.test(Me=l()))throw P(Me,"name");var $,K=Me;if(p(":",!0),_()==="{")$=Br(U,F+"."+Me);else if(_()==="["){$=[];var se;if(p("[",!0)){do se=H(!0),$.push(se);while(p(",",!0));p("]"),typeof se!="undefined"&&ai(U,F+"."+Me,se)}}else $=H(!0),ai(U,F+"."+Me,$);var we=k[K];we&&($=[].concat(we).concat($)),k[K]=$,p(",",!0),p(";",!0)}return k}var Ft=H(!0);return ai(U,F,Ft),Ft}function ai(U,F,k){U.setOption&&U.setOption(F,k)}function li(U,F,k,$){U.setParsedOption&&U.setParsedOption(F,k,$)}function ui(U){if(p("[",!0)){do ze(U,"option");while(p(",",!0));p("]")}return U}function Cs(U,F){if(!ur.test(F=l()))throw P(F,"service name");var k=new W1(F);le(k,function(K){if(!Y(k,K))if(K==="rpc")Ms(k,K);else throw P(K)}),U.add(k)}function Ms(U,F){var k=m(),$=F;if(!ur.test(F=l()))throw P(F,"name");var K=F,se,we,Ft,We;if(p("("),p("stream",!0)&&(we=!0),!cr.test(F=l())||(se=F,p(")"),p("returns"),p("("),p("stream",!0)&&(We=!0),!cr.test(F=l())))throw P(F);Ft=F,p(")");var Bs=new q1(K,$,se,Ft,we,We);Bs.comment=k,le(Bs,function(ao){if(ao==="option")ze(Bs,ao),p(";");else throw P(ao)}),U.add(Bs)}function js(U,F){if(!cr.test(F=l()))throw P(F,"reference");var k=F;le(null,function(K){switch(K){case"required":case"repeated":Xe(U,K,k);break;case"optional":I?Xe(U,"proto3_optional",k):Xe(U,"optional",k);break;default:if(!I||!cr.test(K))throw P(K);g(K),Xe(U,"optional",k);break}})}for(var Me;(Me=l())!==null;)switch(Me){case"package":if(!S)throw P(Me);q();break;case"import":if(!S)throw P(Me);E();break;case"syntax":if(!S)throw P(Me);M();break;case"option":ze(D,Me),p(";");break;default:if(Y(D,Me)){S=!1;continue}throw P(Me)}return Rr.filename=null,{package:v,imports:R,weakImports:w,syntax:B,root:t}}});var R_=j((DC,A_)=>{"use strict";A_.exports=Vt;var Z1=/\/|\./;function Vt(r,t){Z1.test(r)||(r="google/protobuf/"+r+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),Vt[r]=t}Vt("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var T_;Vt("duration",{Duration:T_={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});Vt("timestamp",{Timestamp:T_});Vt("empty",{Empty:{fields:{}}});Vt("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}}}});Vt("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}}}});Vt("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});Vt.get=function(t){return Vt[t]||null}});var O_=j((PC,w_)=>{"use strict";var $r=w_.exports=d_();$r.build="full";$r.tokenize=bg();$r.parse=E_();$r.common=R_();$r.Root._configure($r.Type,$r.parse,$r.common)});var nl=j((kC,C_)=>{"use strict";C_.exports=O_()});var Eg=j((LC,Q1)=>{Q1.exports={nested:{google:{nested:{protobuf:{nested:{FileDescriptorSet:{fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}}},FileDescriptorProto:{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,options:{packed:!1}},weakDependency:{rule:"repeated",type:"int32",id:11,options:{packed:!1}},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}}},DescriptorProto:{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}},nested:{ExtensionRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}},ReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},FieldDescriptorProto:{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}},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_REQUIRED:2,LABEL_REPEATED:3}}}},OneofDescriptorProto:{fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{fields:{name:{type:"string",id:1},value:{rule:"repeated",type:"EnumValueDescriptorProto",id:2},options:{type:"EnumOptions",id:3}}},EnumValueDescriptorProto:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{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:{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},objcClassPrefix:{type:"string",id:36},csharpNamespace:{type:"string",id:37},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[38,38]],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{fields:{messageSetWireFormat:{type:"bool",id:1},noStandardDescriptorAccessor:{type:"bool",id:2},deprecated:{type:"bool",id:3},mapEntry:{type:"bool",id:7},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[8,8]]},FieldOptions:{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},deprecated:{type:"bool",id:3},weak:{type:"bool",id:10},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}}}},OneofOptions:{fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumOptions:{fields:{allowAlias:{type:"bool",id:2},deprecated:{type:"bool",id:3},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumValueOptions:{fields:{deprecated:{type:"bool",id:1},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},ServiceOptions:{fields:{deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},MethodOptions:{fields:{deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},UninterpretedOption:{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}}}}},SourceCodeInfo:{fields:{location:{rule:"repeated",type:"Location",id:1}},nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1},span:{rule:"repeated",type:"int32",id:2},leadingComments:{type:"string",id:3},trailingComments:{type:"string",id:4},leadingDetachedComments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1},sourceFile:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4}}}}}}}}}}}});var x_=j((oe,N_)=>{"use strict";var et=nl();N_.exports=oe=et.descriptor=et.Root.fromJSON(Eg()).lookup(".google.protobuf");var M_=et.Namespace,qn=et.Root,wr=et.Enum,Kr=et.Type,Xr=et.Field,eA=et.MapField,ol=et.OneOf,Hn=et.Service,al=et.Method;qn.fromDescriptor=function(t){typeof t.length=="number"&&(t=oe.FileDescriptorSet.decode(t));var i=new qn;if(t.file)for(var s,o,l=0,g;l{cA.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 F_=j((WC,gA)=>{gA.exports={nested:{google:{nested:{protobuf:{nested:{SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var U_=j((qC,pA)=>{pA.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 L_=j(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});Jr.addCommonProtos=Jr.loadProtosWithOptionsSync=Jr.loadProtosWithOptions=void 0;var D_=require("fs"),P_=require("path"),as=nl();function k_(r,t){let i=r.resolvePath;r.resolvePath=(s,o)=>{if(P_.isAbsolute(o))return o;for(let l of t){let g=P_.join(l,o);try{return D_.accessSync(g,D_.constants.R_OK),g}catch(_){continue}}return process.emitWarning(`${o} not found in any of the include paths ${t}`),i(s,o)}}function dA(r,t){return de(this,null,function*(){let i=new as.Root;if(t=t||{},t.includeDirs){if(!Array.isArray(t.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));k_(i,t.includeDirs)}let s=yield i.load(r,t);return s.resolveAll(),s})}Jr.loadProtosWithOptions=dA;function hA(r,t){let i=new as.Root;if(t=t||{},t.includeDirs){if(!Array.isArray(t.includeDirs))throw new Error("The includeDirs option must be an array");k_(i,t.includeDirs)}let s=i.loadSync(r,t);return s.resolveAll(),s}Jr.loadProtosWithOptionsSync=hA;function fA(){let r=I_(),t=Eg(),i=F_(),s=U_();as.common("api",r.nested.google.nested.protobuf.nested),as.common("descriptor",t.nested.google.nested.protobuf.nested),as.common("source_context",i.nested.google.nested.protobuf.nested),as.common("type",s.nested.google.nested.protobuf.nested)}Jr.addCommonProtos=fA});var J_=j((VC,X_)=>{X_.exports=ve;var Ct=null;try{Ct=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(r){}function ve(r,t,i){this.low=r|0,this.high=t|0,this.unsigned=!!i}ve.prototype.__isLong__;Object.defineProperty(ve.prototype,"__isLong__",{value:!0});function lt(r){return(r&&r.__isLong__)===!0}ve.isLong=lt;var z_={},W_={};function vi(r,t){var i,s,o;return t?(r>>>=0,(o=0<=r&&r<256)&&(s=W_[r],s)?s:(i=Ee(r,(r|0)<0?-1:0,!0),o&&(W_[r]=i),i)):(r|=0,(o=-128<=r&&r<128)&&(s=z_[r],s)?s:(i=Ee(r,r<0?-1:0,!1),o&&(z_[r]=i),i))}ve.fromInt=vi;function Mt(r,t){if(isNaN(r))return t?Si:jt;if(t){if(r<0)return Si;if(r>=G_)return K_}else{if(r<=-H_)return at;if(r+1>=H_)return $_}return r<0?Mt(-r,t).neg():Ee(r%us|0,r/us|0,t)}ve.fromNumber=Mt;function Ee(r,t,i){return new ve(r,t,i)}ve.fromBits=Ee;var ll=Math.pow;function Rg(r,t,i){if(r.length===0)throw Error("empty string");if(r==="NaN"||r==="Infinity"||r==="+Infinity"||r==="-Infinity")return jt;if(typeof t=="number"?(i=t,t=!1):t=!!t,i=i||10,i<2||360)throw Error("interior hyphen");if(s===0)return Rg(r.substring(1),t,i).neg();for(var o=Mt(ll(i,8)),l=jt,g=0;g>>0:this.low};W.toNumber=function(){return this.unsigned?(this.high>>>0)*us+(this.low>>>0):this.high*us+(this.low>>>0)};W.toString=function(t){if(t=t||10,t<2||36>>0,S=m.toString(t);if(g=p,g.isZero())return S+_;for(;S.length<6;)S="0"+S;_=""+S+_}};W.getHighBits=function(){return this.high};W.getHighBitsUnsigned=function(){return this.high>>>0};W.getLowBits=function(){return this.low};W.getLowBitsUnsigned=function(){return this.low>>>0};W.getNumBitsAbs=function(){if(this.isNegative())return this.eq(at)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,i=31;i>0&&(t&1<=0};W.isOdd=function(){return(this.low&1)===1};W.isEven=function(){return(this.low&1)===0};W.equals=function(t){return lt(t)||(t=Gt(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};W.eq=W.equals;W.notEquals=function(t){return!this.eq(t)};W.neq=W.notEquals;W.ne=W.notEquals;W.lessThan=function(t){return this.comp(t)<0};W.lt=W.lessThan;W.lessThanOrEqual=function(t){return this.comp(t)<=0};W.lte=W.lessThanOrEqual;W.le=W.lessThanOrEqual;W.greaterThan=function(t){return this.comp(t)>0};W.gt=W.greaterThan;W.greaterThanOrEqual=function(t){return this.comp(t)>=0};W.gte=W.greaterThanOrEqual;W.ge=W.greaterThanOrEqual;W.compare=function(t){if(lt(t)||(t=Gt(t)),this.eq(t))return 0;var i=this.isNegative(),s=t.isNegative();return i&&!s?-1:!i&&s?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};W.comp=W.compare;W.negate=function(){return!this.unsigned&&this.eq(at)?at:this.not().add(ls)};W.neg=W.negate;W.add=function(t){lt(t)||(t=Gt(t));var i=this.high>>>16,s=this.high&65535,o=this.low>>>16,l=this.low&65535,g=t.high>>>16,_=t.high&65535,p=t.low>>>16,m=t.low&65535,S=0,v=0,R=0,w=0;return w+=l+m,R+=w>>>16,w&=65535,R+=o+p,v+=R>>>16,R&=65535,v+=s+_,S+=v>>>16,v&=65535,S+=i+g,S&=65535,Ee(R<<16|w,S<<16|v,this.unsigned)};W.subtract=function(t){return lt(t)||(t=Gt(t)),this.add(t.neg())};W.sub=W.subtract;W.multiply=function(t){if(this.isZero())return jt;if(lt(t)||(t=Gt(t)),Ct){var i=Ct.mul(this.low,this.high,t.low,t.high);return Ee(i,Ct.get_high(),this.unsigned)}if(t.isZero())return jt;if(this.eq(at))return t.isOdd()?at:jt;if(t.eq(at))return this.isOdd()?at:jt;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(V_)&&t.lt(V_))return Mt(this.toNumber()*t.toNumber(),this.unsigned);var s=this.high>>>16,o=this.high&65535,l=this.low>>>16,g=this.low&65535,_=t.high>>>16,p=t.high&65535,m=t.low>>>16,S=t.low&65535,v=0,R=0,w=0,B=0;return B+=g*S,w+=B>>>16,B&=65535,w+=l*S,R+=w>>>16,w&=65535,w+=g*m,R+=w>>>16,w&=65535,R+=o*S,v+=R>>>16,R&=65535,R+=l*m,v+=R>>>16,R&=65535,R+=g*p,v+=R>>>16,R&=65535,v+=s*S+o*m+l*p+g*_,v&=65535,Ee(w<<16|B,v<<16|R,this.unsigned)};W.mul=W.multiply;W.divide=function(t){if(lt(t)||(t=Gt(t)),t.isZero())throw Error("division by zero");if(Ct){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var i=(this.unsigned?Ct.div_u:Ct.div_s)(this.low,this.high,t.low,t.high);return Ee(i,Ct.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Si:jt;var s,o,l;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return Si;if(t.gt(this.shru(1)))return Y_;l=Si}else{if(this.eq(at)){if(t.eq(ls)||t.eq(Ag))return at;if(t.eq(at))return ls;var g=this.shr(1);return s=g.div(t).shl(1),s.eq(jt)?t.isNegative()?ls:Ag:(o=this.sub(t.mul(s)),l=s.add(o.div(t)),l)}else if(t.eq(at))return this.unsigned?Si:jt;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();l=jt}for(o=this;o.gte(t);){s=Math.max(1,Math.floor(o.toNumber()/t.toNumber()));for(var _=Math.ceil(Math.log(s)/Math.LN2),p=_<=48?1:ll(2,_-48),m=Mt(s),S=m.mul(t);S.isNegative()||S.gt(o);)s-=p,m=Mt(s,this.unsigned),S=m.mul(t);m.isZero()&&(m=ls),l=l.add(m),o=o.sub(S)}return l};W.div=W.divide;W.modulo=function(t){if(lt(t)||(t=Gt(t)),Ct){var i=(this.unsigned?Ct.rem_u:Ct.rem_s)(this.low,this.high,t.low,t.high);return Ee(i,Ct.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};W.mod=W.modulo;W.rem=W.modulo;W.not=function(){return Ee(~this.low,~this.high,this.unsigned)};W.and=function(t){return lt(t)||(t=Gt(t)),Ee(this.low&t.low,this.high&t.high,this.unsigned)};W.or=function(t){return lt(t)||(t=Gt(t)),Ee(this.low|t.low,this.high|t.high,this.unsigned)};W.xor=function(t){return lt(t)||(t=Gt(t)),Ee(this.low^t.low,this.high^t.high,this.unsigned)};W.shiftLeft=function(t){return lt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?Ee(this.low<>>32-t,this.unsigned):Ee(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):Ee(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};W.shr=W.shiftRight;W.shiftRightUnsigned=function(t){if(lt(t)&&(t=t.toInt()),t&=63,t===0)return this;var i=this.high;if(t<32){var s=this.low;return Ee(s>>>t|i<<32-t,i>>>t,this.unsigned)}else return t===32?Ee(i,0,this.unsigned):Ee(i>>>t-32,0,this.unsigned)};W.shru=W.shiftRightUnsigned;W.shr_u=W.shiftRightUnsigned;W.toSigned=function(){return this.unsigned?Ee(this.low,this.high,!1):this};W.toUnsigned=function(){return this.unsigned?this:Ee(this.low,this.high,!0)};W.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};W.toBytesLE=function(){var t=this.high,i=this.low;return[i&255,i>>>8&255,i>>>16&255,i>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};W.toBytesBE=function(){var t=this.high,i=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,i>>>24,i>>>16&255,i>>>8&255,i&255]};ve.fromBytes=function(t,i,s){return s?ve.fromBytesLE(t,i):ve.fromBytesBE(t,i)};ve.fromBytesLE=function(t,i){return new ve(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,i)};ve.fromBytesBE=function(t,i){return new ve(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],i)}});var im=j(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.loadFileDescriptorSetFromObject=Ge.loadFileDescriptorSetFromBuffer=Ge.fromJSON=Ge.loadSync=Ge.load=Ge.isAnyExtension=Ge.Long=void 0;var mA=Mh(),gr=nl(),Og=x_(),Cg=L_(),yA=J_();Ge.Long=yA;function bA(r){return"@type"in r&&typeof r["@type"]=="string"}Ge.isAnyExtension=bA;var em={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function SA(r,t){return r===""?t:r+"."+t}function vA(r){return r instanceof gr.Service||r instanceof gr.Type||r instanceof gr.Enum}function EA(r){return r instanceof gr.Namespace||r instanceof gr.Root}function tm(r,t){let i=SA(t,r.name);return vA(r)?[[i,r]]:EA(r)&&typeof r.nested!="undefined"?Object.keys(r.nested).map(s=>tm(r.nested[s],i)).reduce((s,o)=>s.concat(o),[]):[]}function Z_(r,t){return function(s){return r.toObject(r.decode(s),t)}}function Q_(r){return function(i){if(Array.isArray(i))throw new Error(`Failed to serialize message: expected object with ${r.name} structure, got array instead`);let s=r.fromObject(i);return r.encode(s).finish()}}function TA(r,t,i,s){let o=r.resolvedRequestType,l=r.resolvedResponseType;return{path:"/"+t+"/"+r.name,requestStream:!!r.requestStream,responseStream:!!r.responseStream,requestSerialize:Q_(o),requestDeserialize:Z_(o,i),responseSerialize:Q_(l),responseDeserialize:Z_(l,i),originalName:mA(r.name),requestType:wg(o,s),responseType:wg(l,s)}}function AA(r,t,i,s){let o={};for(let l of r.methodsArray)o[l.name]=TA(l,t,i,s);return o}function wg(r,t){let i=r.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:i.$type.toObject(i,em),fileDescriptorProtos:t}}function RA(r,t){let i=r.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:i.$type.toObject(i,em),fileDescriptorProtos:t}}function wA(r,t,i,s){if(r instanceof gr.Service)return AA(r,t,i,s);if(r instanceof gr.Type)return wg(r,s);if(r instanceof gr.Enum)return RA(r,s);throw new Error("Type mismatch in reflection object handling")}function ul(r,t){let i={};r.resolveAll();let o=r.toDescriptor("proto3").file.map(l=>Buffer.from(Og.FileDescriptorProto.encode(l).finish()));for(let[l,g]of tm(r,""))i[l]=wA(g,l,t,o);return i}function rm(r,t){t=t||{};let i=gr.Root.fromDescriptor(r);return i.resolveAll(),ul(i,t)}function OA(r,t){return(0,Cg.loadProtosWithOptions)(r,t).then(i=>ul(i,t))}Ge.load=OA;function CA(r,t){let i=(0,Cg.loadProtosWithOptionsSync)(r,t);return ul(i,t)}Ge.loadSync=CA;function MA(r,t){t=t||{};let i=gr.Root.fromJSON(r);return i.resolveAll(),ul(i,t)}Ge.fromJSON=MA;function jA(r,t){let i=Og.FileDescriptorSet.decode(r);return rm(i,t)}Ge.loadFileDescriptorSetFromBuffer=jA;function BA(r,t){let i=Og.FileDescriptorSet.fromObject(r);return rm(i,t)}Ge.loadFileDescriptorSetFromObject=BA;(0,Cg.addCommonProtos)()});var cs=j(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.setup=Ae.getChannelzServiceDefinition=Ae.getChannelzHandlers=Ae.unregisterChannelzRef=Ae.registerChannelzSocket=Ae.registerChannelzServer=Ae.registerChannelzSubchannel=Ae.registerChannelzChannel=Ae.ChannelzCallTracker=Ae.ChannelzChildrenTracker=Ae.ChannelzTrace=void 0;var sm=require("net"),Vn=kt(),Yn=be(),NA=tr(),xA=Ma(),IA=Rc();function Mg(r){return{channel_id:r.id,name:r.name}}function xg(r){return{subchannel_id:r.id,name:r.name}}function FA(r){return{server_id:r.id}}function gl(r){return{socket_id:r.id,name:r.name}}var nm=32,jg=class{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(t,i,s){let o=new Date;this.events.push({description:i,severity:t,timestamp:o,childChannel:(s==null?void 0:s.kind)==="channel"?s:void 0,childSubchannel:(s==null?void 0:s.kind)==="subchannel"?s:void 0}),this.events.length>=nm*2&&(this.events=this.events.slice(nm)),this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:Or(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map(t=>({description:t.description,severity:t.severity,timestamp:Or(t.timestamp),channel_ref:t.childChannel?Mg(t.childChannel):null,subchannel_ref:t.childSubchannel?xg(t.childSubchannel):null}))}}};Ae.ChannelzTrace=jg;var Bg=class{constructor(){this.channelChildren=new Map,this.subchannelChildren=new Map,this.socketChildren=new Map}refChild(t){var i,s,o;switch(t.kind){case"channel":{let l=(i=this.channelChildren.get(t.id))!==null&&i!==void 0?i:{ref:t,count:0};l.count+=1,this.channelChildren.set(t.id,l);break}case"subchannel":{let l=(s=this.subchannelChildren.get(t.id))!==null&&s!==void 0?s:{ref:t,count:0};l.count+=1,this.subchannelChildren.set(t.id,l);break}case"socket":{let l=(o=this.socketChildren.get(t.id))!==null&&o!==void 0?o:{ref:t,count:0};l.count+=1,this.socketChildren.set(t.id,l);break}}}unrefChild(t){switch(t.kind){case"channel":{let i=this.channelChildren.get(t.id);i!==void 0&&(i.count-=1,i.count===0?this.channelChildren.delete(t.id):this.channelChildren.set(t.id,i));break}case"subchannel":{let i=this.subchannelChildren.get(t.id);i!==void 0&&(i.count-=1,i.count===0?this.subchannelChildren.delete(t.id):this.subchannelChildren.set(t.id,i));break}case"socket":{let i=this.socketChildren.get(t.id);i!==void 0&&(i.count-=1,i.count===0?this.socketChildren.delete(t.id):this.socketChildren.set(t.id,i));break}}}getChildLists(){let t=[];for(let{ref:o}of this.channelChildren.values())t.push(o);let i=[];for(let{ref:o}of this.subchannelChildren.values())i.push(o);let s=[];for(let{ref:o}of this.socketChildren.values())s.push(o);return{channels:t,subchannels:i,sockets:s}}};Ae.ChannelzChildrenTracker=Bg;var Ng=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}};Ae.ChannelzCallTracker=Ng;var UA=1;function pl(){return UA++}var Gn=[],Ig=[],Zr=[],Fg=[];function DA(r,t,i){let s=pl(),o={id:s,name:r,kind:"channel"};return i&&(Gn[s]={ref:o,getInfo:t}),o}Ae.registerChannelzChannel=DA;function PA(r,t,i){let s=pl(),o={id:s,name:r,kind:"subchannel"};return i&&(Ig[s]={ref:o,getInfo:t}),o}Ae.registerChannelzSubchannel=PA;function kA(r,t){let i=pl(),s={id:i,kind:"server"};return t&&(Zr[i]={ref:s,getInfo:r}),s}Ae.registerChannelzServer=kA;function LA(r,t,i){let s=pl(),o={id:s,name:r,kind:"socket"};return i&&(Fg[s]={ref:o,getInfo:t}),o}Ae.registerChannelzSocket=LA;function zA(r){switch(r.kind){case"channel":delete Gn[r.id];return;case"subchannel":delete Ig[r.id];return;case"server":delete Zr[r.id];return;case"socket":delete Fg[r.id];return}}Ae.unregisterChannelzRef=zA;function WA(r){let t=Number.parseInt(r,16);return[t/256|0,t%256]}function om(r){if(r==="")return[];let t=r.split(":").map(s=>WA(s));return[].concat(...t)}function qA(r){if(sm.isIPv4(r))return Buffer.from(Uint8Array.from(r.split(".").map(t=>Number.parseInt(t))));if(sm.isIPv6(r)){let t,i,s=r.indexOf("::");s===-1?(t=r,i=""):(t=r.substring(0,s),i=r.substring(s+2));let o=Buffer.from(om(t)),l=Buffer.from(om(i)),g=Buffer.alloc(16-o.length-l.length,0);return Buffer.concat([o,g,l])}else return null}function lm(r){switch(r){case Vn.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case Vn.ConnectivityState.IDLE:return{state:"IDLE"};case Vn.ConnectivityState.READY:return{state:"READY"};case Vn.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case Vn.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function Or(r){if(!r)return null;let t=r.getTime();return{seconds:t/1e3|0,nanos:t%1e3*1e6}}function um(r){let t=r.getInfo();return{ref:Mg(r.ref),data:{target:t.target,state:lm(t.state),calls_started:t.callTracker.callsStarted,calls_succeeded:t.callTracker.callsSucceeded,calls_failed:t.callTracker.callsFailed,last_call_started_timestamp:Or(t.callTracker.lastCallStartedTimestamp),trace:t.trace.getTraceMessage()},channel_ref:t.children.channels.map(i=>Mg(i)),subchannel_ref:t.children.subchannels.map(i=>xg(i))}}function HA(r,t){let i=Number.parseInt(r.request.channel_id),s=Gn[i];if(s===void 0){t({code:Yn.Status.NOT_FOUND,details:"No channel data found for id "+i});return}t(null,{channel:um(s)})}function VA(r,t){let i=Number.parseInt(r.request.max_results),s=[],o=Number.parseInt(r.request.start_channel_id);for(;o=i))break}t(null,{channel:s,end:o>=Zr.length})}function cm(r){let t=r.getInfo();return{ref:FA(r.ref),data:{calls_started:t.callTracker.callsStarted,calls_succeeded:t.callTracker.callsSucceeded,calls_failed:t.callTracker.callsFailed,last_call_started_timestamp:Or(t.callTracker.lastCallStartedTimestamp),trace:t.trace.getTraceMessage()},listen_socket:t.listenerChildren.sockets.map(i=>gl(i))}}function GA(r,t){let i=Number.parseInt(r.request.server_id),s=Zr[i];if(s===void 0){t({code:Yn.Status.NOT_FOUND,details:"No server data found for id "+i});return}t(null,{server:cm(s)})}function YA(r,t){let i=Number.parseInt(r.request.max_results),s=[],o=Number.parseInt(r.request.start_server_id);for(;o=i))break}t(null,{server:s,end:o>=Zr.length})}function $A(r,t){let i=Number.parseInt(r.request.subchannel_id),s=Ig[i];if(s===void 0){t({code:Yn.Status.NOT_FOUND,details:"No subchannel data found for id "+i});return}let o=s.getInfo(),l={ref:xg(s.ref),data:{target:o.target,state:lm(o.state),calls_started:o.callTracker.callsStarted,calls_succeeded:o.callTracker.callsSucceeded,calls_failed:o.callTracker.callsFailed,last_call_started_timestamp:Or(o.callTracker.lastCallStartedTimestamp),trace:o.trace.getTraceMessage()},socket_ref:o.children.sockets.map(g=>gl(g))};t(null,{subchannel:l})}function am(r){var t;return NA.isTcpSubchannelAddress(r)?{address:"tcpip_address",tcpip_address:{ip_address:(t=qA(r.host))!==null&&t!==void 0?t:void 0,port:r.port}}:{address:"uds_address",uds_address:{filename:r.path}}}function KA(r,t){var i,s,o,l,g;let _=Number.parseInt(r.request.socket_id),p=Fg[_];if(p===void 0){t({code:Yn.Status.NOT_FOUND,details:"No socket data found for id "+_});return}let m=p.getInfo(),S=m.security?{model:"tls",tls:{cipher_suite:m.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:(i=m.security.cipherSuiteStandardName)!==null&&i!==void 0?i:void 0,other_name:(s=m.security.cipherSuiteOtherName)!==null&&s!==void 0?s:void 0,local_certificate:(o=m.security.localCertificate)!==null&&o!==void 0?o:void 0,remote_certificate:(l=m.security.remoteCertificate)!==null&&l!==void 0?l:void 0}}:null,v={ref:gl(p.ref),local:m.localAddress?am(m.localAddress):null,remote:m.remoteAddress?am(m.remoteAddress):null,remote_name:(g=m.remoteName)!==null&&g!==void 0?g:void 0,security:S,data:{keep_alives_sent:m.keepAlivesSent,streams_started:m.streamsStarted,streams_succeeded:m.streamsSucceeded,streams_failed:m.streamsFailed,last_local_stream_created_timestamp:Or(m.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:Or(m.lastRemoteStreamCreatedTimestamp),messages_received:m.messagesReceived,messages_sent:m.messagesSent,last_message_received_timestamp:Or(m.lastMessageReceivedTimestamp),last_message_sent_timestamp:Or(m.lastMessageSentTimestamp),local_flow_control_window:m.localFlowControlWindow?{value:m.localFlowControlWindow}:null,remote_flow_control_window:m.remoteFlowControlWindow?{value:m.remoteFlowControlWindow}:null}};t(null,{socket:v})}function XA(r,t){let i=Number.parseInt(r.request.server_id),s=Zr[i];if(s===void 0){t({code:Yn.Status.NOT_FOUND,details:"No server data found for id "+i});return}let o=Number.parseInt(r.request.start_socket_id),l=Number.parseInt(r.request.max_results),_=s.getInfo().sessionChildren.sockets.sort((S,v)=>S.id-v.id),p=[],m=0;for(;m<_.length&&!(_[m].id>=o&&(p.push(gl(_[m])),p.length>=l));m++);t(null,{socket_ref:p,end:m>=_.length})}function gm(){return{GetChannel:HA,GetTopChannels:VA,GetServer:GA,GetServers:YA,GetSubchannel:$A,GetSocket:KA,GetServerSockets:XA}}Ae.getChannelzHandlers=gm;var cl=null;function pm(){if(cl)return cl;let r=im().loadSync,t=r("channelz.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto`]});return cl=IA.loadPackageDefinition(t).grpc.channelz.v1.Channelz.service,cl}Ae.getChannelzServiceDefinition=pm;function JA(){xA.registerAdminService(pm,gm)}Ae.setup=JA});var Ug=j(($C,ZA)=>{ZA.exports={name:"@grpc/grpc-js",version:"1.7.3",description:"gRPC Library for Node - pure JS implementation",homepage:"https://grpc.io/",repository:"https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",main:"build/src/index.js",engines:{node:"^8.13.0 || >=10.10.0"},keywords:[],author:{name:"Google Inc."},types:"build/src/index.d.ts",license:"Apache-2.0",devDependencies:{"@types/gulp":"^4.0.6","@types/gulp-mocha":"0.0.32","@types/lodash":"^4.14.108","@types/mocha":"^5.2.6","@types/ncp":"^2.0.1","@types/pify":"^3.0.2","@types/semver":"^7.3.9","clang-format":"^1.0.55",execa:"^2.0.3",gts:"^2.0.0",gulp:"^4.0.2","gulp-mocha":"^6.0.0",lodash:"^4.17.4",madge:"^5.0.1","mocha-jenkins-reporter":"^0.4.1",ncp:"^2.0.0",pify:"^4.0.1",rimraf:"^3.0.2",semver:"^7.3.5","ts-node":"^8.3.0",typescript:"^3.7.2"},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:"npm run check",prepare:"npm run generate-types && npm run compile",test:"gulp test",check:"gts check src/**/*.ts",fix:"gts fix src/*.ts",pretest:"npm run generate-types && npm run generate-test-types && npm run compile",posttest:"npm run check && madge -c ./build/src","generate-types":"proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --includeDirs proto/ --include-dirs test/fixtures/ -O src/generated/ --grpcLib ../index channelz.proto","generate-test-types":"proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --include-dirs test/fixtures/ -O test/generated/ --grpcLib ../../src/index test_service.proto"},dependencies:{"@grpc/proto-loader":"^0.7.0","@types/node":">=12.12.47"},files:["src/**/*.ts","build/src/**/*.{js,d.ts,js.map}","proto/*.proto","LICENSE","deps/envoy-api/envoy/api/v2/**/*.proto","deps/envoy-api/envoy/config/**/*.proto","deps/envoy-api/envoy/service/**/*.proto","deps/envoy-api/envoy/type/**/*.proto","deps/udpa/udpa/**/*.proto","deps/googleapis/google/api/*.proto","deps/googleapis/google/rpc/*.proto","deps/protoc-gen-validate/validate/**/*.proto"]}});var mm=j(dl=>{"use strict";Object.defineProperty(dl,"__esModule",{value:!0});dl.Subchannel=void 0;var Pg=require("http2"),dm=require("tls"),ae=kt(),QA=Rn(),hm=Qt(),Qr=Ue(),ei=be(),eR=ac(),tR=require("net"),$n=bt(),Dg=tr(),Cr=cs(),rR=Ug().version,fm="subchannel",iR="subchannel_flowctrl",_m=~(1<<31),sR=2e4,{HTTP2_HEADER_AUTHORITY:nR,HTTP2_HEADER_CONTENT_TYPE:oR,HTTP2_HEADER_METHOD:aR,HTTP2_HEADER_PATH:lR,HTTP2_HEADER_TE:uR,HTTP2_HEADER_USER_AGENT:cR}=Pg.constants,gR=Buffer.from("too_many_pings","ascii"),kg=class{constructor(t,i,s,o){this.channelTarget=t,this.subchannelAddress=i,this.options=s,this.credentials=o,this.connectivityState=ae.ConnectivityState.IDLE,this.session=null,this.continueConnecting=!1,this.stateListeners=[],this.disconnectListeners=new Set,this.keepaliveTimeMs=_m,this.keepaliveTimeoutMs=sR,this.keepaliveWithoutCalls=!1,this.callRefcount=0,this.refcount=0,this.channelzEnabled=!0,this.callTracker=new Cr.ChannelzCallTracker,this.childrenTracker=new Cr.ChannelzChildrenTracker,this.channelzSocketRef=null,this.remoteName=null,this.streamTracker=new Cr.ChannelzCallTracker,this.keepalivesSent=0,this.messagesSent=0,this.messagesReceived=0,this.lastMessageSentTimestamp=null,this.lastMessageReceivedTimestamp=null,this.userAgent=[s["grpc.primary_user_agent"],`grpc-node-js/${rR}`,s["grpc.secondary_user_agent"]].filter(g=>g).join(" "),"grpc.keepalive_time_ms"in s&&(this.keepaliveTimeMs=s["grpc.keepalive_time_ms"]),"grpc.keepalive_timeout_ms"in s&&(this.keepaliveTimeoutMs=s["grpc.keepalive_timeout_ms"]),"grpc.keepalive_permit_without_calls"in s?this.keepaliveWithoutCalls=s["grpc.keepalive_permit_without_calls"]===1:this.keepaliveWithoutCalls=!1,this.keepaliveIntervalId=setTimeout(()=>{},0),clearTimeout(this.keepaliveIntervalId),this.keepaliveTimeoutId=setTimeout(()=>{},0),clearTimeout(this.keepaliveTimeoutId);let l={initialDelay:s["grpc.initial_reconnect_backoff_ms"],maxDelay:s["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new QA.BackoffTimeout(()=>{this.handleBackoffTimer()},l),this.subchannelAddressString=Dg.subchannelAddressToString(i),s["grpc.enable_channelz"]===0&&(this.channelzEnabled=!1),this.channelzTrace=new Cr.ChannelzTrace,this.channelzRef=Cr.registerChannelzSubchannel(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.trace("Subchannel constructed with options "+JSON.stringify(s,void 0,2))}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}getChannelzSocketInfo(){var t,i,s;if(this.session===null)return null;let o=this.session.socket,l=o.remoteAddress?Dg.stringToSubchannelAddress(o.remoteAddress,o.remotePort):null,g=o.localAddress?Dg.stringToSubchannelAddress(o.localAddress,o.localPort):null,_;if(this.session.encrypted){let m=o,S=m.getCipher(),v=m.getCertificate(),R=m.getPeerCertificate();_={cipherSuiteStandardName:(t=S.standardName)!==null&&t!==void 0?t:null,cipherSuiteOtherName:S.standardName?null:S.name,localCertificate:v&&"raw"in v?v.raw:null,remoteCertificate:R&&"raw"in R?R.raw:null}}else _=null;return{remoteAddress:l,localAddress:g,security:_,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:(i=this.session.state.localWindowSize)!==null&&i!==void 0?i:null,remoteFlowControlWindow:(s=this.session.state.remoteWindowSize)!==null&&s!==void 0?s:null}}resetChannelzSocketInfo(){!this.channelzEnabled||(this.channelzSocketRef&&(Cr.unregisterChannelzRef(this.channelzSocketRef),this.childrenTracker.unrefChild(this.channelzSocketRef),this.channelzSocketRef=null),this.remoteName=null,this.streamTracker=new Cr.ChannelzCallTracker,this.keepalivesSent=0,this.messagesSent=0,this.messagesReceived=0,this.lastMessageSentTimestamp=null,this.lastMessageReceivedTimestamp=null)}trace(t){Qr.trace(ei.LogVerbosity.DEBUG,fm,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+t)}refTrace(t){Qr.trace(ei.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+t)}flowControlTrace(t){Qr.trace(ei.LogVerbosity.DEBUG,iR,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+t)}internalsTrace(t){Qr.trace(ei.LogVerbosity.DEBUG,"subchannel_internals","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+t)}keepaliveTrace(t){Qr.trace(ei.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+t)}handleBackoffTimer(){this.continueConnecting?this.transitionToState([ae.ConnectivityState.TRANSIENT_FAILURE],ae.ConnectivityState.CONNECTING):this.transitionToState([ae.ConnectivityState.TRANSIENT_FAILURE],ae.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}sendPing(){var t,i;this.channelzEnabled&&(this.keepalivesSent+=1),this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms"),this.keepaliveTimeoutId=setTimeout(()=>{this.keepaliveTrace("Ping timeout passed without response"),this.handleDisconnect()},this.keepaliveTimeoutMs),(i=(t=this.keepaliveTimeoutId).unref)===null||i===void 0||i.call(t);try{this.session.ping((s,o,l)=>{this.keepaliveTrace("Received ping response"),clearTimeout(this.keepaliveTimeoutId)})}catch(s){this.transitionToState([ae.ConnectivityState.READY],ae.ConnectivityState.TRANSIENT_FAILURE)}}startKeepalivePings(){var t,i;this.keepaliveIntervalId=setInterval(()=>{this.sendPing()},this.keepaliveTimeMs),(i=(t=this.keepaliveIntervalId).unref)===null||i===void 0||i.call(t)}stopKeepalivePings(){clearInterval(this.keepaliveIntervalId),clearTimeout(this.keepaliveTimeoutId)}createSession(t){var i,s,o;t.realTarget?(this.remoteName=$n.uriToString(t.realTarget),this.trace("creating HTTP/2 session through proxy to "+t.realTarget)):(this.remoteName=null,this.trace("creating HTTP/2 session"));let l=hm.getDefaultAuthority((i=t.realTarget)!==null&&i!==void 0?i:this.channelTarget),g=this.credentials._getConnectionOptions()||{};g.maxSendHeaderBlockLength=Number.MAX_SAFE_INTEGER,"grpc-node.max_session_memory"in this.options?g.maxSessionMemory=this.options["grpc-node.max_session_memory"]:g.maxSessionMemory=Number.MAX_SAFE_INTEGER;let _="http://";if("secureContext"in g){if(_="https://",this.options["grpc.ssl_target_name_override"]){let m=this.options["grpc.ssl_target_name_override"];g.checkServerIdentity=(S,v)=>dm.checkServerIdentity(m,v),g.servername=m}else{let m=(o=(s=$n.splitHostPort(l))===null||s===void 0?void 0:s.host)!==null&&o!==void 0?o:"localhost";g.servername=m}t.socket&&(g.createConnection=(m,S)=>t.socket)}else g.createConnection=(m,S)=>t.socket?t.socket:tR.connect(this.subchannelAddress);g=Object.assign(Object.assign({},g),this.subchannelAddress);let p=Pg.connect(_+l,g);this.session=p,this.channelzSocketRef=Cr.registerChannelzSocket(this.subchannelAddressString,()=>this.getChannelzSocketInfo(),this.channelzEnabled),this.channelzEnabled&&this.childrenTracker.refChild(this.channelzSocketRef),p.unref(),p.once("connect",()=>{this.session===p&&this.transitionToState([ae.ConnectivityState.CONNECTING],ae.ConnectivityState.READY)}),p.once("close",()=>{this.session===p&&(this.trace("connection closed"),this.transitionToState([ae.ConnectivityState.CONNECTING],ae.ConnectivityState.TRANSIENT_FAILURE),this.transitionToState([ae.ConnectivityState.READY],ae.ConnectivityState.IDLE))}),p.once("goaway",(m,S,v)=>{this.session===p&&(m===Pg.constants.NGHTTP2_ENHANCE_YOUR_CALM&&v.equals(gR)&&(this.keepaliveTimeMs=Math.min(2*this.keepaliveTimeMs,_m),Qr.log(ei.LogVerbosity.ERROR,`Connection to ${$n.uriToString(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTimeMs} ms`)),this.trace("connection closed by GOAWAY with code "+m),this.transitionToState([ae.ConnectivityState.CONNECTING,ae.ConnectivityState.READY],ae.ConnectivityState.IDLE))}),p.once("error",m=>{this.trace("connection closed with error "+m.message)}),Qr.isTracerEnabled(fm)&&(p.on("remoteSettings",m=>{this.trace("new settings received"+(this.session!==p?" on the old connection":"")+": "+JSON.stringify(m))}),p.on("localSettings",m=>{this.trace("local settings acknowledged by remote"+(this.session!==p?" on the old connection":"")+": "+JSON.stringify(m))}))}startConnectingInternal(){var t,i;let s=this.credentials._getConnectionOptions()||{};if("secureContext"in s){if(s.ALPNProtocols=["h2"],this.options["grpc.ssl_target_name_override"]){let o=this.options["grpc.ssl_target_name_override"];s.checkServerIdentity=(l,g)=>dm.checkServerIdentity(o,g),s.servername=o}else if("grpc.http_connect_target"in this.options){let o=hm.getDefaultAuthority((t=$n.parseUri(this.options["grpc.http_connect_target"]))!==null&&t!==void 0?t:{path:"localhost"}),l=$n.splitHostPort(o);s.servername=(i=l==null?void 0:l.host)!==null&&i!==void 0?i:o}}eR.getProxiedConnection(this.subchannelAddress,this.options,s).then(o=>{this.createSession(o)},o=>{this.transitionToState([ae.ConnectivityState.CONNECTING],ae.ConnectivityState.TRANSIENT_FAILURE)})}handleDisconnect(){this.transitionToState([ae.ConnectivityState.READY],ae.ConnectivityState.TRANSIENT_FAILURE);for(let t of this.disconnectListeners.values())t()}transitionToState(t,i){if(t.indexOf(this.connectivityState)===-1)return!1;this.trace(ae.ConnectivityState[this.connectivityState]+" -> "+ae.ConnectivityState[i]),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO",ae.ConnectivityState[this.connectivityState]+" -> "+ae.ConnectivityState[i]);let s=this.connectivityState;switch(this.connectivityState=i,i){case ae.ConnectivityState.READY:this.stopBackoff();let o=this.session;o.socket.once("close",()=>{this.session===o&&this.handleDisconnect()}),this.keepaliveWithoutCalls&&this.startKeepalivePings();break;case ae.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case ae.ConnectivityState.TRANSIENT_FAILURE:this.session&&this.session.close(),this.session=null,this.resetChannelzSocketInfo(),this.stopKeepalivePings(),this.backoffTimeout.isRunning()||process.nextTick(()=>{this.handleBackoffTimer()});break;case ae.ConnectivityState.IDLE:this.session&&this.session.close(),this.session=null,this.resetChannelzSocketInfo(),this.stopKeepalivePings();break;default:throw new Error(`Invalid state: unknown ConnectivityState ${i}`)}for(let o of[...this.stateListeners])o(this,s,i);return!0}checkBothRefcounts(){this.callRefcount===0&&this.refcount===0&&(this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Shutting down"),this.transitionToState([ae.ConnectivityState.CONNECTING,ae.ConnectivityState.READY],ae.ConnectivityState.IDLE),this.channelzEnabled&&Cr.unregisterChannelzRef(this.channelzRef))}callRef(){this.refTrace("callRefcount "+this.callRefcount+" -> "+(this.callRefcount+1)),this.callRefcount===0&&(this.session&&this.session.ref(),this.backoffTimeout.ref(),this.keepaliveWithoutCalls||this.startKeepalivePings()),this.callRefcount+=1}callUnref(){this.refTrace("callRefcount "+this.callRefcount+" -> "+(this.callRefcount-1)),this.callRefcount-=1,this.callRefcount===0&&(this.session&&this.session.unref(),this.backoffTimeout.unref(),this.keepaliveWithoutCalls||clearInterval(this.keepaliveIntervalId),this.checkBothRefcounts())}ref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,this.checkBothRefcounts()}unrefIfOneRef(){return this.refcount===1?(this.unref(),!0):!1}startCallStream(t,i,s){let o=t.toHttp2Headers();o[nR]=i.getHost(),o[cR]=this.userAgent,o[oR]="application/grpc",o[aR]="POST",o[lR]=i.getMethod(),o[uR]="trailers";let l;try{l=this.session.request(o)}catch(m){throw this.transitionToState([ae.ConnectivityState.READY],ae.ConnectivityState.TRANSIENT_FAILURE),m}let g="";for(let m of Object.keys(o))g+=" "+m+": "+o[m]+` +`;Qr.trace(ei.LogVerbosity.DEBUG,"call_stream","Starting stream ["+i.getCallNumber()+"] on subchannel ("+this.channelzRef.id+") "+this.subchannelAddressString+` with headers +`+g),this.flowControlTrace("local window size: "+this.session.state.localWindowSize+" remote window size: "+this.session.state.remoteWindowSize);let _=this.session;this.internalsTrace("session.closed="+_.closed+" session.destroyed="+_.destroyed+" session.socket.destroyed="+_.socket.destroyed);let p;this.channelzEnabled?(this.callTracker.addCallStarted(),i.addStatusWatcher(m=>{m.code===ei.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()}),this.streamTracker.addCallStarted(),i.addStreamEndWatcher(m=>{_===this.session&&(m?this.streamTracker.addCallSucceeded():this.streamTracker.addCallFailed())}),p={addMessageSent:()=>{this.messagesSent+=1,this.lastMessageSentTimestamp=new Date},addMessageReceived:()=>{this.messagesReceived+=1}}):p={addMessageSent:()=>{},addMessageReceived:()=>{}},i.attachHttp2Stream(l,this,s,p)}startConnecting(){this.transitionToState([ae.ConnectivityState.IDLE],ae.ConnectivityState.CONNECTING)||this.connectivityState===ae.ConnectivityState.TRANSIENT_FAILURE&&(this.continueConnecting=!0)}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(t){this.stateListeners.push(t)}removeConnectivityStateListener(t){let i=this.stateListeners.indexOf(t);i>-1&&this.stateListeners.splice(i,1)}addDisconnectListener(t){this.disconnectListeners.add(t)}removeDisconnectListener(t){this.disconnectListeners.delete(t)}resetBackoff(){this.backoffTimeout.reset(),this.transitionToState([ae.ConnectivityState.TRANSIENT_FAILURE],ae.ConnectivityState.CONNECTING)}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}getRealSubchannel(){return this}};dl.Subchannel=kg});var ym=j(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.getSubchannelPool=gs.SubchannelPool=void 0;var pR=Zd(),dR=mm(),hR=tr(),fR=bt(),_R=1e4,Kn=class{constructor(){this.pool=Object.create(null),this.cleanupTimer=null}unrefUnusedSubchannels(){let t=!0;for(let i in this.pool){let o=this.pool[i].filter(l=>!l.subchannel.unrefIfOneRef());o.length>0&&(t=!1),this.pool[i]=o}t&&this.cleanupTimer!==null&&(clearInterval(this.cleanupTimer),this.cleanupTimer=null)}ensureCleanupTask(){var t,i;this.cleanupTimer===null&&(this.cleanupTimer=setInterval(()=>{this.unrefUnusedSubchannels()},_R),(i=(t=this.cleanupTimer).unref)===null||i===void 0||i.call(t))}getOrCreateSubchannel(t,i,s,o){this.ensureCleanupTask();let l=fR.uriToString(t);if(l in this.pool){let _=this.pool[l];for(let p of _)if(hR.subchannelAddressEqual(i,p.subchannelAddress)&&pR.channelOptionsEqual(s,p.channelArguments)&&o._equals(p.channelCredentials))return p.subchannel}let g=new dR.Subchannel(t,i,s,o);return l in this.pool||(this.pool[l]=[]),this.pool[l].push({subchannelAddress:i,channelArguments:s,channelCredentials:o,subchannel:g}),g.ref(),g}};gs.SubchannelPool=Kn;var mR=new Kn;function yR(r){return r?mR:new Kn}gs.getSubchannelPool=yR});var zg=j(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.FilterStackFactory=ps.FilterStack=void 0;var hl=class{constructor(t){this.filters=t}sendMetadata(t){let i=t;for(let s=0;s=0;s--)i=this.filters[s].receiveMetadata(i);return i}sendMessage(t){let i=t;for(let s=0;s=0;s--)i=this.filters[s].receiveMessage(i);return i}receiveTrailers(t){let i=t;for(let s=this.filters.length-1;s>=0;s--)i=this.filters[s].receiveTrailers(i);return i}refresh(){for(let t of this.filters)t.refresh()}push(t){this.filters.unshift(...t)}getFilters(){return this.filters}};ps.FilterStack=hl;var Lg=class{constructor(t){this.factories=t}push(t){this.factories.unshift(...t)}createFilter(t){return new hl(this.factories.map(i=>i.createFilter(t)))}};ps.FilterStackFactory=Lg});var Ei=j(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.BaseFilter=void 0;var Wg=class{sendMetadata(t){return de(this,null,function*(){return t})}receiveMetadata(t){return t}sendMessage(t){return de(this,null,function*(){return t})}receiveMessage(t){return de(this,null,function*(){return t})}receiveTrailers(t){return t}refresh(){}};fl.BaseFilter=Wg});var Sm=j(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.CallCredentialsFilterFactory=ds.CallCredentialsFilter=void 0;var bR=Ei(),bm=be(),SR=bt(),_l=class extends bR.BaseFilter{constructor(t,i){var s,o;super(),this.channel=t,this.stream=i,this.channel=t,this.stream=i;let l=i.getMethod().split("/"),g="";l.length>=2&&(g=l[1]);let _=(o=(s=SR.splitHostPort(i.getHost()))===null||s===void 0?void 0:s.host)!==null&&o!==void 0?o:"localhost";this.serviceUrl=`https://${_}/${g}`}sendMetadata(t){return de(this,null,function*(){let s=this.stream.getCredentials().generateMetadata({service_url:this.serviceUrl}),o=yield t;try{o.merge(yield s)}catch(l){return this.stream.cancelWithStatus(bm.Status.UNAUTHENTICATED,`Failed to retrieve auth metadata with error: ${l.message}`),Promise.reject("Failed to retrieve auth metadata")}return o.get("authorization").length>1?(this.stream.cancelWithStatus(bm.Status.INTERNAL,'"authorization" metadata cannot have multiple values'),Promise.reject('"authorization" metadata cannot have multiple values')):o})}};ds.CallCredentialsFilter=_l;var qg=class{constructor(t){this.channel=t,this.channel=t}createFilter(t){return new _l(this.channel,t)}};ds.CallCredentialsFilterFactory=qg});var Em=j(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.DeadlineFilterFactory=hs.DeadlineFilter=void 0;var vm=be(),vR=Ei(),ER=[["m",1],["S",1e3],["M",60*1e3],["H",60*60*1e3]];function TR(r){let t=new Date().getTime(),i=Math.max(r-t,0);for(let[s,o]of ER){let l=i/o;if(l<1e8)return String(Math.ceil(l))+s}throw new Error("Deadline is too far in the future")}var ml=class extends vR.BaseFilter{constructor(t,i){super(),this.channel=t,this.callStream=i,this.timer=null,this.deadline=1/0,this.retreiveDeadline(),this.runTimer()}retreiveDeadline(){let t=this.callStream.getDeadline();t instanceof Date?this.deadline=t.getTime():this.deadline=t}runTimer(){var t,i;this.timer&&clearTimeout(this.timer);let s=new Date().getTime(),o=this.deadline-s;o<=0?process.nextTick(()=>{this.callStream.cancelWithStatus(vm.Status.DEADLINE_EXCEEDED,"Deadline exceeded")}):this.deadline!==1/0&&(this.timer=setTimeout(()=>{this.callStream.cancelWithStatus(vm.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},o),(i=(t=this.timer).unref)===null||i===void 0||i.call(t))}refresh(){this.retreiveDeadline(),this.runTimer()}sendMetadata(t){return de(this,null,function*(){if(this.deadline===1/0)return t;let i=yield t,s=TR(this.deadline);return i.set("grpc-timeout",s),i})}receiveTrailers(t){return this.timer&&clearTimeout(this.timer),t}};hs.DeadlineFilter=ml;var Hg=class{constructor(t){this.channel=t}createFilter(t){return new ml(this.channel,t)}};hs.DeadlineFilterFactory=Hg});var Vg=j(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.CompressionAlgorithms=void 0;var AR;(function(r){r[r.identity=0]="identity",r[r.deflate=1]="deflate",r[r.gzip=2]="gzip"})(AR=Xn.CompressionAlgorithms||(Xn.CompressionAlgorithms={}))});var Rm=j(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.CompressionFilterFactory=_s.CompressionFilter=void 0;var yl=require("zlib"),Am=Vg(),RR=be(),wR=Ei(),OR=Ue(),CR=r=>typeof r=="number"&&typeof Am.CompressionAlgorithms[r]=="string",fs=class{writeMessage(t,i){return de(this,null,function*(){let s=t;i&&(s=yield this.compressMessage(s));let o=Buffer.allocUnsafe(s.length+5);return o.writeUInt8(i?1:0,0),o.writeUInt32BE(s.length,1),s.copy(o,5),o})}readMessage(t){return de(this,null,function*(){let i=t.readUInt8(0)===1,s=t.slice(5);return i&&(s=yield this.decompressMessage(s)),s})}},Ti=class extends fs{compressMessage(t){return de(this,null,function*(){return t})}writeMessage(t,i){return de(this,null,function*(){let s=Buffer.allocUnsafe(t.length+5);return s.writeUInt8(0,0),s.writeUInt32BE(t.length,1),t.copy(s,5),s})}decompressMessage(t){return Promise.reject(new Error('Received compressed message but "grpc-encoding" header was identity'))}},Gg=class extends fs{compressMessage(t){return new Promise((i,s)=>{yl.deflate(t,(o,l)=>{o?s(o):i(l)})})}decompressMessage(t){return new Promise((i,s)=>{yl.inflate(t,(o,l)=>{o?s(o):i(l)})})}},Yg=class extends fs{compressMessage(t){return new Promise((i,s)=>{yl.gzip(t,(o,l)=>{o?s(o):i(l)})})}decompressMessage(t){return new Promise((i,s)=>{yl.unzip(t,(o,l)=>{o?s(o):i(l)})})}},$g=class extends fs{constructor(t){super(),this.compressionName=t}compressMessage(t){return Promise.reject(new Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(t){return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`))}};function Tm(r){switch(r){case"identity":return new Ti;case"deflate":return new Gg;case"gzip":return new Yg;default:return new $g(r)}}var bl=class extends wR.BaseFilter{constructor(t,i){var s;super(),this.sharedFilterConfig=i,this.sendCompression=new Ti,this.receiveCompression=new Ti,this.currentCompressionAlgorithm="identity";let o=t["grpc.default_compression_algorithm"];if(o!==void 0)if(CR(o)){let l=Am.CompressionAlgorithms[o],g=(s=i.serverSupportedEncodingHeader)===null||s===void 0?void 0:s.split(",");(!g||g.includes(l))&&(this.currentCompressionAlgorithm=l,this.sendCompression=Tm(this.currentCompressionAlgorithm))}else OR.log(RR.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${o}`)}sendMetadata(t){return de(this,null,function*(){let i=yield t;return i.set("grpc-accept-encoding","identity,deflate,gzip"),i.set("accept-encoding","identity"),this.currentCompressionAlgorithm==="identity"?i.remove("grpc-encoding"):i.set("grpc-encoding",this.currentCompressionAlgorithm),i})}receiveMetadata(t){let i=t.get("grpc-encoding");if(i.length>0){let o=i[0];typeof o=="string"&&(this.receiveCompression=Tm(o))}t.remove("grpc-encoding");let s=t.get("grpc-accept-encoding")[0];return s&&(this.sharedFilterConfig.serverSupportedEncodingHeader=s,s.split(",").includes(this.currentCompressionAlgorithm)||(this.sendCompression=new Ti,this.currentCompressionAlgorithm="identity")),t.remove("grpc-accept-encoding"),t}sendMessage(t){return de(this,null,function*(){var i;let s=yield t,o;return this.sendCompression instanceof Ti?o=!1:o=(((i=s.flags)!==null&&i!==void 0?i:0)&2)===0,{message:yield this.sendCompression.writeMessage(s.message,o),flags:s.flags}})}receiveMessage(t){return de(this,null,function*(){return this.receiveCompression.readMessage(yield t)})}};_s.CompressionFilter=bl;var Kg=class{constructor(t,i){this.channel=t,this.options=i,this.sharedFilterConfig={}}createFilter(t){return new bl(this.options,this.sharedFilterConfig)}};_s.CompressionFilterFactory=Kg});var wm=j(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.MaxMessageSizeFilterFactory=ms.MaxMessageSizeFilter=void 0;var MR=Ei(),Sl=be(),vl=class extends MR.BaseFilter{constructor(t,i){super(),this.options=t,this.callStream=i,this.maxSendMessageSize=Sl.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=Sl.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,"grpc.max_send_message_length"in t&&(this.maxSendMessageSize=t["grpc.max_send_message_length"]),"grpc.max_receive_message_length"in t&&(this.maxReceiveMessageSize=t["grpc.max_receive_message_length"])}sendMessage(t){return de(this,null,function*(){if(this.maxSendMessageSize===-1)return t;{let i=yield t;return i.message.length>this.maxSendMessageSize?(this.callStream.cancelWithStatus(Sl.Status.RESOURCE_EXHAUSTED,`Sent message larger than max (${i.message.length} vs. ${this.maxSendMessageSize})`),Promise.reject("Message too large")):i}})}receiveMessage(t){return de(this,null,function*(){if(this.maxReceiveMessageSize===-1)return t;{let i=yield t;return i.length>this.maxReceiveMessageSize?(this.callStream.cancelWithStatus(Sl.Status.RESOURCE_EXHAUSTED,`Received message larger than max (${i.length} vs. ${this.maxReceiveMessageSize})`),Promise.reject("Message too large")):i}})}};ms.MaxMessageSizeFilter=vl;var Xg=class{constructor(t){this.options=t}createFilter(t){return new vl(this.options,t)}};ms.MaxMessageSizeFilterFactory=Xg});var Tc=j(Rl=>{"use strict";Object.defineProperty(Rl,"__esModule",{value:!0});Rl.ChannelImplementation=void 0;var jR=Vu(),BR=Ku(),NR=Jd(),xR=ym(),ys=di(),Oe=be(),Om=zg(),IR=Sm(),FR=Em(),UR=Rm(),Cm=Qt(),El=Ue(),DR=wm(),PR=ac(),Tl=bt(),ht=kt(),Jn=cs(),kR=2147483647,Al=0;function LR(){let r=Al;return Al+=1,Al>=Number.MAX_SAFE_INTEGER&&(Al=0),r}var zR=[Oe.Status.OK,Oe.Status.INVALID_ARGUMENT,Oe.Status.NOT_FOUND,Oe.Status.ALREADY_EXISTS,Oe.Status.FAILED_PRECONDITION,Oe.Status.ABORTED,Oe.Status.OUT_OF_RANGE,Oe.Status.DATA_LOSS];function Zn(r,t){return zR.includes(r)?{code:Oe.Status.INTERNAL,details:`Invalid status from control plane: ${r} ${Oe.Status[r]} ${t}`}:{code:r,details:t}}var Jg=class{constructor(t,i,s){var o,l,g,_;if(this.credentials=i,this.options=s,this.connectivityState=ht.ConnectivityState.IDLE,this.currentPicker=new ys.UnavailablePicker,this.configSelectionQueue=[],this.pickQueue=[],this.connectivityStateWatchers=[],this.configSelector=null,this.currentResolutionError=null,this.channelzEnabled=!0,this.callTracker=new Jn.ChannelzCallTracker,this.childrenTracker=new Jn.ChannelzChildrenTracker,typeof t!="string")throw new TypeError("Channel target must be a string");if(!(i instanceof BR.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(s&&typeof s!="object")throw new TypeError("Channel options must be an object");this.originalTarget=t;let p=Tl.parseUri(t);if(p===null)throw new Error(`Could not parse target name "${t}"`);let m=Cm.mapUriDefaultScheme(p);if(m===null)throw new Error(`Could not find a default scheme for target name "${t}"`);this.callRefTimer=setInterval(()=>{},kR),(l=(o=this.callRefTimer).unref)===null||l===void 0||l.call(o),this.options["grpc.enable_channelz"]===0&&(this.channelzEnabled=!1),this.channelzTrace=new Jn.ChannelzTrace,this.channelzRef=Jn.registerChannelzChannel(t,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Channel created"),this.options["grpc.default_authority"]?this.defaultAuthority=this.options["grpc.default_authority"]:this.defaultAuthority=Cm.getDefaultAuthority(m);let S=PR.mapProxyName(m,s);this.target=S.target,this.options=Object.assign({},this.options,S.extraOptions),this.subchannelPool=xR.getSubchannelPool(((g=s["grpc.use_local_subchannel_pool"])!==null&&g!==void 0?g:0)===0);let v={createSubchannel:(w,B)=>{let I=this.subchannelPool.getOrCreateSubchannel(this.target,w,Object.assign({},this.options,B),this.credentials);return this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Created subchannel or used existing subchannel",I.getChannelzRef()),I},updateState:(w,B)=>{this.currentPicker=B;let I=this.pickQueue.slice();this.pickQueue=[],this.callRefTimerUnref();for(let{callStream:D,callMetadata:C,callConfig:P,dynamicFilters:ee}of I)this.tryPick(D,C,P,ee);this.updateState(w)},requestReresolution:()=>{throw new Error("Resolving load balancer should never call requestReresolution")},addChannelzChild:w=>{this.channelzEnabled&&this.childrenTracker.refChild(w)},removeChannelzChild:w=>{this.channelzEnabled&&this.childrenTracker.unrefChild(w)}};this.resolvingLoadBalancer=new NR.ResolvingLoadBalancer(this.target,v,s,w=>{this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Address resolution succeeded"),this.configSelector=w,this.currentResolutionError=null,process.nextTick(()=>{let B=this.configSelectionQueue;this.configSelectionQueue=[],this.callRefTimerUnref();for(let{callStream:I,callMetadata:D}of B)this.tryGetConfig(I,D);this.configSelectionQueue=[]})},w=>{this.channelzEnabled&&this.channelzTrace.addTrace("CT_WARNING","Address resolution failed with code "+w.code+' and details "'+w.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({},Zn(w.code,w.details)),{metadata:w.metadata}));let B=this.configSelectionQueue;this.configSelectionQueue=[],this.callRefTimerUnref();for(let{callStream:I,callMetadata:D}of B)D.getOptions().waitForReady?(this.callRefTimerRef(),this.configSelectionQueue.push({callStream:I,callMetadata:D})):I.cancelWithStatus(w.code,w.details)}),this.filterStackFactory=new Om.FilterStackFactory([new IR.CallCredentialsFilterFactory(this),new FR.DeadlineFilterFactory(this),new DR.MaxMessageSizeFilterFactory(this.options),new UR.CompressionFilterFactory(this,this.options)]),this.trace("Channel constructed with options "+JSON.stringify(s,void 0,2));let R=new Error;El.trace(Oe.LogVerbosity.DEBUG,"channel_stacktrace","("+this.channelzRef.id+`) Channel constructed +`+((_=R.stack)===null||_===void 0?void 0:_.substring(R.stack.indexOf(` +`)+1)))}getChannelzInfo(){return{target:this.originalTarget,state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}}trace(t,i){El.trace(i!=null?i:Oe.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+Tl.uriToString(this.target)+" "+t)}callRefTimerRef(){var t,i,s,o;!((i=(t=this.callRefTimer).hasRef)===null||i===void 0)&&i.call(t)||(this.trace("callRefTimer.ref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(o=(s=this.callRefTimer).ref)===null||o===void 0||o.call(s))}callRefTimerUnref(){var t,i;(!this.callRefTimer.hasRef||this.callRefTimer.hasRef())&&(this.trace("callRefTimer.unref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(i=(t=this.callRefTimer).unref)===null||i===void 0||i.call(t))}pushPick(t,i,s,o){this.pickQueue.push({callStream:t,callMetadata:i,callConfig:s,dynamicFilters:o}),this.callRefTimerRef()}tryPick(t,i,s,o){var l,g;let _=this.currentPicker.pick({metadata:i,extraPickInfo:s.pickInformation}),p=_.subchannel?"("+_.subchannel.getChannelzRef().id+") "+_.subchannel.getAddress():""+_.subchannel;switch(this.trace("Pick result for call ["+t.getCallNumber()+"]: "+ys.PickResultType[_.pickResultType]+" subchannel: "+p+" status: "+((l=_.status)===null||l===void 0?void 0:l.code)+" "+((g=_.status)===null||g===void 0?void 0:g.details)),_.pickResultType){case ys.PickResultType.COMPLETE:if(_.subchannel===null)t.cancelWithStatus(Oe.Status.UNAVAILABLE,"Request dropped by load balancing policy");else{if(_.subchannel.getConnectivityState()!==ht.ConnectivityState.READY){El.log(Oe.LogVerbosity.ERROR,"Error: COMPLETE pick result subchannel "+p+" has state "+ht.ConnectivityState[_.subchannel.getConnectivityState()]),this.pushPick(t,i,s,o);break}t.filterStack.sendMetadata(Promise.resolve(i.clone())).then(v=>{var R,w,B;let I=_.subchannel.getConnectivityState();if(I===ht.ConnectivityState.READY)try{let D=_.extraFilterFactories.map(C=>C.createFilter(t));(R=_.subchannel)===null||R===void 0||R.getRealSubchannel().startCallStream(v,t,[...o,...D]),(w=s.onCommitted)===null||w===void 0||w.call(s),(B=_.onCallStarted)===null||B===void 0||B.call(_)}catch(D){let C=D.code;C==="ERR_HTTP2_GOAWAY_SESSION"||C==="ERR_HTTP2_INVALID_SESSION"?(this.trace("Failed to start call on picked subchannel "+p+" with error "+D.message+". Retrying pick",Oe.LogVerbosity.INFO),this.tryPick(t,i,s,o)):(this.trace("Failed to start call on picked subchanel "+p+" with error "+D.message+". Ending call",Oe.LogVerbosity.INFO),t.cancelWithStatus(Oe.Status.INTERNAL,`Failed to start HTTP/2 stream with error: ${D.message}`))}else this.trace("Picked subchannel "+p+" has state "+ht.ConnectivityState[I]+" after metadata filters. Retrying pick",Oe.LogVerbosity.INFO),this.tryPick(t,i,s,o)},v=>{let{code:R,details:w}=Zn(typeof v.code=="number"?v.code:Oe.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${v.message}`);t.cancelWithStatus(R,w)})}break;case ys.PickResultType.QUEUE:this.pushPick(t,i,s,o);break;case ys.PickResultType.TRANSIENT_FAILURE:if(i.getOptions().waitForReady)this.pushPick(t,i,s,o);else{let{code:v,details:R}=Zn(_.status.code,_.status.details);t.cancelWithStatus(v,R)}break;case ys.PickResultType.DROP:let{code:m,details:S}=Zn(_.status.code,_.status.details);t.cancelWithStatus(m,S);break;default:throw new Error(`Invalid state: unknown pickResultType ${_.pickResultType}`)}}removeConnectivityStateWatcher(t){let i=this.connectivityStateWatchers.findIndex(s=>s===t);i>=0&&this.connectivityStateWatchers.splice(i,1)}updateState(t){El.trace(Oe.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+Tl.uriToString(this.target)+" "+ht.ConnectivityState[this.connectivityState]+" -> "+ht.ConnectivityState[t]),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO",ht.ConnectivityState[this.connectivityState]+" -> "+ht.ConnectivityState[t]),this.connectivityState=t;let i=this.connectivityStateWatchers.slice();for(let s of i)t!==s.currentState&&(s.timer&&clearTimeout(s.timer),this.removeConnectivityStateWatcher(s),s.callback());t!==ht.ConnectivityState.TRANSIENT_FAILURE&&(this.currentResolutionError=null)}tryGetConfig(t,i){if(t.getStatus()===null)if(this.configSelector===null)this.resolvingLoadBalancer.exitIdle(),this.currentResolutionError&&!i.getOptions().waitForReady?t.cancelWithStatus(this.currentResolutionError.code,this.currentResolutionError.details):(this.configSelectionQueue.push({callStream:t,callMetadata:i}),this.callRefTimerRef());else{let s=this.configSelector(t.getMethod(),i);if(s.status===Oe.Status.OK){if(s.methodConfig.timeout){let o=new Date;o.setSeconds(o.getSeconds()+s.methodConfig.timeout.seconds),o.setMilliseconds(o.getMilliseconds()+s.methodConfig.timeout.nanos/1e6),t.setConfigDeadline(o),t.filterStack.refresh()}if(s.dynamicFilterFactories.length>0){let l=new Om.FilterStackFactory(s.dynamicFilterFactories).createFilter(t);l.sendMetadata(Promise.resolve(i)).then(g=>{this.tryPick(t,g,s,l.getFilters())})}else this.tryPick(t,i,s,[])}else{let{code:o,details:l}=Zn(s.status,"Failed to route call to method "+t.getMethod());t.cancelWithStatus(o,l)}}}_startCallStream(t,i){this.tryGetConfig(t,i.clone())}close(){this.resolvingLoadBalancer.destroy(),this.updateState(ht.ConnectivityState.SHUTDOWN),clearInterval(this.callRefTimer),this.channelzEnabled&&Jn.unregisterChannelzRef(this.channelzRef),this.subchannelPool.unrefUnusedSubchannels()}getTarget(){return Tl.uriToString(this.target)}getConnectivityState(t){let i=this.connectivityState;return t&&this.resolvingLoadBalancer.exitIdle(),i}watchConnectivityState(t,i,s){if(this.connectivityState===ht.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");let o=null;if(i!==1/0){let g=i instanceof Date?i:new Date(i),_=new Date;if(i===-1/0||g<=_){process.nextTick(s,new Error("Deadline passed without connectivity state change"));return}o=setTimeout(()=>{this.removeConnectivityStateWatcher(l),s(new Error("Deadline passed without connectivity state change"))},g.getTime()-_.getTime())}let l={currentState:t,callback:s,timer:o};this.connectivityStateWatchers.push(l)}getChannelzRef(){return this.channelzRef}createCall(t,i,s,o,l){if(typeof t!="string")throw new TypeError("Channel#createCall: method must be a string");if(!(typeof i=="number"||i instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");if(this.connectivityState===ht.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");let g=LR();this.trace("createCall ["+g+'] method="'+t+'", deadline='+i);let _={deadline:i,flags:l!=null?l:Oe.Propagate.DEFAULTS,host:s!=null?s:this.defaultAuthority,parentCall:o},p=new jR.Http2CallStream(t,this,_,this.filterStackFactory,this.credentials._getCallCredentials(),g);return this.channelzEnabled&&(this.callTracker.addCallStarted(),p.addStatusWatcher(m=>{m.code===Oe.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()})),p}};Rl.ChannelImplementation=Jg});var Fm=j(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.Http2ServerCallStream=Bt.ServerDuplexStreamImpl=Bt.ServerWritableStreamImpl=Bt.ServerReadableStreamImpl=Bt.ServerUnaryCallImpl=void 0;var jm=require("events"),bs=require("http2"),ep=require("stream"),Bm=require("zlib"),Nm=require("util"),Re=be(),tp=Pt(),WR=Wu(),xm=Ue(),Im="server_call",qR=Nm.promisify(Bm.unzip),HR=Nm.promisify(Bm.inflate);function Qn(r){xm.trace(Re.LogVerbosity.DEBUG,Im,r)}var VR="grpc-accept-encoding",GR="grpc-encoding",YR="grpc-message",$R="grpc-status",Mm="grpc-timeout",KR=/(\d{1,8})\s*([HMSmun])/,XR={H:36e5,M:6e4,S:1e3,m:1,u:.001,n:1e-6},JR={[VR]:"identity,deflate,gzip",[GR]:"identity",[bs.constants.HTTP2_HEADER_STATUS]:bs.constants.HTTP_STATUS_OK,[bs.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},ZR={waitForTrailers:!0},Zg=class extends jm.EventEmitter{constructor(t,i,s){super(),this.call=t,this.metadata=i,this.request=s,this.cancelled=!1,this.call.setupSurfaceCall(this)}getPeer(){return this.call.getPeer()}sendMetadata(t){this.call.sendMetadata(t)}getDeadline(){return this.call.getDeadline()}getPath(){return this.call.getPath()}};Bt.ServerUnaryCallImpl=Zg;var wl=class extends ep.Readable{constructor(t,i,s,o){super({objectMode:!0}),this.call=t,this.metadata=i,this.deserialize=s,this.cancelled=!1,this.call.setupSurfaceCall(this),this.call.setupReadable(this,o)}_read(t){!this.call.consumeUnpushedMessages(this)||this.call.resume()}getPeer(){return this.call.getPeer()}sendMetadata(t){this.call.sendMetadata(t)}getDeadline(){return this.call.getDeadline()}getPath(){return this.call.getPath()}};Bt.ServerReadableStreamImpl=wl;var eo=class extends ep.Writable{constructor(t,i,s,o){super({objectMode:!0}),this.call=t,this.metadata=i,this.serialize=s,this.request=o,this.cancelled=!1,this.trailingMetadata=new tp.Metadata,this.call.setupSurfaceCall(this),this.on("error",l=>{this.call.sendError(l),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(t){this.call.sendMetadata(t)}getDeadline(){return this.call.getDeadline()}getPath(){return this.call.getPath()}_write(t,i,s){try{let o=this.call.serializeMessage(t);if(!this.call.write(o)){this.call.once("drain",s);return}}catch(o){o.code=Re.Status.INTERNAL,this.emit("error",o)}s()}_final(t){this.call.sendStatus({code:Re.Status.OK,details:"OK",metadata:this.trailingMetadata}),t(null)}end(t){return t&&(this.trailingMetadata=t),super.end()}};Bt.ServerWritableStreamImpl=eo;var Ss=class extends ep.Duplex{constructor(t,i,s,o,l){super({objectMode:!0}),this.call=t,this.metadata=i,this.serialize=s,this.deserialize=o,this.cancelled=!1,this.trailingMetadata=new tp.Metadata,this.call.setupSurfaceCall(this),this.call.setupReadable(this,l),this.on("error",g=>{this.call.sendError(g),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(t){this.call.sendMetadata(t)}getDeadline(){return this.call.getDeadline()}getPath(){return this.call.getPath()}end(t){return t&&(this.trailingMetadata=t),super.end()}};Bt.ServerDuplexStreamImpl=Ss;Ss.prototype._read=wl.prototype._read;Ss.prototype._write=eo.prototype._write;Ss.prototype._final=eo.prototype._final;var Qg=class extends jm.EventEmitter{constructor(t,i,s){super(),this.stream=t,this.handler=i,this.options=s,this.cancelled=!1,this.deadlineTimer=null,this.statusSent=!1,this.deadline=1/0,this.wantTrailers=!1,this.metadataSent=!1,this.canPush=!1,this.isPushPending=!1,this.bufferedMessages=[],this.messagesToPush=[],this.maxSendMessageSize=Re.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=Re.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.stream.once("error",o=>{}),this.stream.once("close",()=>{var o;Qn("Request to method "+((o=this.handler)===null||o===void 0?void 0:o.path)+" stream closed with rstCode "+this.stream.rstCode),this.statusSent||(this.cancelled=!0,this.emit("cancelled","cancelled"),this.emit("streamEnd",!1),this.sendStatus({code:Re.Status.CANCELLED,details:"Cancelled by client",metadata:null}))}),this.stream.on("drain",()=>{this.emit("drain")}),"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"])}checkCancelled(){return(this.stream.destroyed||this.stream.closed)&&(this.cancelled=!0),this.cancelled}getDecompressedMessage(t,i){return i==="deflate"?HR(t.subarray(5)):i==="gzip"?qR(t.subarray(5)):i==="identity"?t.subarray(5):Promise.reject({code:Re.Status.UNIMPLEMENTED,details:`Received message compressed with unsupported encoding "${i}"`})}sendMetadata(t){if(this.checkCancelled()||this.metadataSent)return;this.metadataSent=!0;let i=t?t.toHttp2Headers():null,s=Object.assign(Object.assign({},JR),i);this.stream.respond(s,ZR)}receiveMetadata(t){let i=tp.Metadata.fromHttp2Headers(t);xm.isTracerEnabled(Im)&&Qn("Request to "+this.handler.path+" received headers "+JSON.stringify(i.toJSON()));let s=i.get(Mm);if(s.length>0){let o=s[0].toString().match(KR);if(o===null){let _=new Error("Invalid deadline");return _.code=Re.Status.OUT_OF_RANGE,this.sendError(_),i}let l=+o[1]*XR[o[2]]|0,g=new Date;this.deadline=g.setMilliseconds(g.getMilliseconds()+l),this.deadlineTimer=setTimeout(QR,l,this),i.remove(Mm)}return i.remove(bs.constants.HTTP2_HEADER_ACCEPT_ENCODING),i.remove(bs.constants.HTTP2_HEADER_TE),i.remove(bs.constants.HTTP2_HEADER_CONTENT_TYPE),i.remove("grpc-accept-encoding"),i}receiveUnaryMessage(t,i){let{stream:s}=this,o=0,l=this,g=[],_=this.maxReceiveMessageSize;s.on("data",p),s.on("end",m),s.on("error",m);function p(S){if(o+=S.byteLength,_!==-1&&o>_){s.removeListener("data",p),s.removeListener("end",m),s.removeListener("error",m),i({code:Re.Status.RESOURCE_EXHAUSTED,details:`Received message larger than max (${o} vs. ${_})`});return}g.push(S)}function m(S){if(s.removeListener("data",p),s.removeListener("end",m),s.removeListener("error",m),S!==void 0){i({code:Re.Status.INTERNAL,details:S.message});return}if(o===0){i({code:Re.Status.INTERNAL,details:"received empty unary message"});return}l.emit("receiveMessage");let v=Buffer.concat(g,o),w=v.readUInt8(0)===1?t:"identity",B=l.getDecompressedMessage(v,w);if(Buffer.isBuffer(B)){l.safeDeserializeMessage(B,i);return}B.then(I=>l.safeDeserializeMessage(I,i),I=>i(I.code?I:{code:Re.Status.INTERNAL,details:`Received "grpc-encoding" header "${t}" but ${t} decompression failed`}))}}safeDeserializeMessage(t,i){try{i(null,this.deserializeMessage(t))}catch(s){s.code=Re.Status.INTERNAL,i(s)}}serializeMessage(t){let i=this.handler.serialize(t),s=i.byteLength,o=Buffer.allocUnsafe(s+5);return o.writeUInt8(0,0),o.writeUInt32BE(s,1),i.copy(o,5),o}deserializeMessage(t){return this.handler.deserialize(t)}sendUnaryMessage(t,i,s,o){return de(this,null,function*(){if(!this.checkCancelled()){if(s===void 0&&(s=null),t){!Object.prototype.hasOwnProperty.call(t,"metadata")&&s&&(t.metadata=s),this.sendError(t);return}try{let l=this.serializeMessage(i);this.write(l),this.sendStatus({code:Re.Status.OK,details:"OK",metadata:s})}catch(l){l.code=Re.Status.INTERNAL,this.sendError(l)}}})}sendStatus(t){var i;this.emit("callEnd",t.code),this.emit("streamEnd",t.code===Re.Status.OK),!this.checkCancelled()&&(Qn("Request to method "+((i=this.handler)===null||i===void 0?void 0:i.path)+" ended with status code: "+Re.Status[t.code]+" details: "+t.details),this.deadlineTimer&&clearTimeout(this.deadlineTimer),this.wantTrailers||(this.wantTrailers=!0,this.stream.once("wantTrailers",()=>{var s;let o=Object.assign({[$R]:t.code,[YR]:encodeURI(t.details)},(s=t.metadata)===null||s===void 0?void 0:s.toHttp2Headers());this.stream.sendTrailers(o),this.statusSent=!0}),this.sendMetadata(),this.stream.end()))}sendError(t){let i={code:Re.Status.UNKNOWN,details:"message"in t?t.message:"Unknown Error",metadata:"metadata"in t&&t.metadata!==void 0?t.metadata:null};"code"in t&&typeof t.code=="number"&&Number.isInteger(t.code)&&(i.code=t.code,"details"in t&&typeof t.details=="string"&&(i.details=t.details)),this.sendStatus(i)}write(t){if(!this.checkCancelled()){if(this.maxSendMessageSize!==-1&&t.length>this.maxSendMessageSize){this.sendError({code:Re.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${t.length} vs. ${this.maxSendMessageSize})`});return}return this.sendMetadata(),this.emit("sendMessage"),this.stream.write(t)}}resume(){this.stream.resume()}setupSurfaceCall(t){this.once("cancelled",i=>{t.cancelled=!0,t.emit("cancelled",i)}),this.once("callEnd",i=>t.emit("callEnd",i))}setupReadable(t,i){let s=new WR.StreamDecoder,o=!1,l=!1,g=!1,_=()=>{!g&&o&&!l&&(g=!0,this.pushOrBufferMessage(t,null))};this.stream.on("data",p=>de(this,null,function*(){let m=s.write(p);l=!0,this.stream.pause();for(let S of m){if(this.maxReceiveMessageSize!==-1&&S.length>this.maxReceiveMessageSize){this.sendError({code:Re.Status.RESOURCE_EXHAUSTED,details:`Received message larger than max (${S.length} vs. ${this.maxReceiveMessageSize})`});return}this.emit("receiveMessage");let R=S.readUInt8(0)===1?i:"identity",w=yield this.getDecompressedMessage(S,R);if(!w)return;this.pushOrBufferMessage(t,w)}l=!1,this.stream.resume(),_()})),this.stream.once("end",()=>{o=!0,_()})}consumeUnpushedMessages(t){for(this.canPush=!0;this.messagesToPush.length>0;){let i=this.messagesToPush.shift(),s=t.push(i);if(i===null||s===!1){this.canPush=!1;break}}return this.canPush}pushOrBufferMessage(t,i){this.isPushPending?this.bufferedMessages.push(i):this.pushMessage(t,i)}pushMessage(t,i){return de(this,null,function*(){if(i===null){Qn("Received end of stream"),this.canPush?t.push(null):this.messagesToPush.push(null);return}Qn("Received message of length "+i.length),this.isPushPending=!0;try{let s=yield this.deserializeMessage(i);this.canPush?t.push(s)||(this.canPush=!1,this.stream.pause()):this.messagesToPush.push(s)}catch(s){this.bufferedMessages.length=0,"code"in s&&typeof s.code=="number"&&Number.isInteger(s.code)&&s.code>=Re.Status.OK&&s.code<=Re.Status.UNAUTHENTICATED||(s.code=Re.Status.INTERNAL),t.emit("error",s)}this.isPushPending=!1,this.bufferedMessages.length>0&&this.pushMessage(t,this.bufferedMessages.shift())})}getPeer(){let t=this.stream.session.socket;return t.remoteAddress?t.remotePort?`${t.remoteAddress}:${t.remotePort}`:t.remoteAddress:"unknown"}getDeadline(){return this.deadline}getPath(){return this.handler.path}};Bt.Http2ServerCallStream=Qg;function QR(r){let t=new Error("Deadline exceeded");t.code=Re.Status.DEADLINE_EXCEEDED,r.sendError(t),r.cancelled=!0,r.emit("cancelled","deadline")}});var sp=j(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});Ol.ServerCredentials=void 0;var Um=Yu(),to=class{static createInsecure(){return new rp}static createSsl(t,i,s=!1){if(t!==null&&!Buffer.isBuffer(t))throw new TypeError("rootCerts must be null or a Buffer");if(!Array.isArray(i))throw new TypeError("keyCertPairs must be an array");if(typeof s!="boolean")throw new TypeError("checkClientCertificate must be a boolean");let o=[],l=[];for(let g=0;g{"use strict";Object.defineProperty(Ml,"__esModule",{value:!0});Ml.Server=void 0;var Ai=require("http2"),Mr=be(),Ri=Fm(),ew=sp(),Dm=Qt(),Cl=Ue(),Yt=tr(),tw=bt(),ut=cs(),{HTTP2_HEADER_PATH:rw}=Ai.constants,iw="server";function sw(){}function Pm(r){return{code:Mr.Status.UNIMPLEMENTED,details:`The server does not implement the method ${r}`}}function nw(r,t){let i=Pm(t);switch(r){case"unary":return(s,o)=>{o(i,null)};case"clientStream":return(s,o)=>{o(i,null)};case"serverStream":return s=>{s.emit("error",i)};case"bidi":return s=>{s.emit("error",i)};default:throw new Error(`Invalid handlerType ${r}`)}}var np=class{constructor(t){this.http2ServerList=[],this.handlers=new Map,this.sessions=new Map,this.started=!1,this.serverAddressString="null",this.channelzEnabled=!0,this.channelzTrace=new ut.ChannelzTrace,this.callTracker=new ut.ChannelzCallTracker,this.listenerChildrenTracker=new ut.ChannelzChildrenTracker,this.sessionChildrenTracker=new ut.ChannelzChildrenTracker,this.options=t!=null?t:{},this.options["grpc.enable_channelz"]===0&&(this.channelzEnabled=!1),this.channelzRef=ut.registerChannelzServer(()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Server created"),this.trace("Server constructed")}getChannelzInfo(){return{trace:this.channelzTrace,callTracker:this.callTracker,listenerChildren:this.listenerChildrenTracker.getChildLists(),sessionChildren:this.sessionChildrenTracker.getChildLists()}}getChannelzSessionInfoGetter(t){return()=>{var i,s,o;let l=this.sessions.get(t),g=t.socket,_=g.remoteAddress?Yt.stringToSubchannelAddress(g.remoteAddress,g.remotePort):null,p=g.localAddress?Yt.stringToSubchannelAddress(g.localAddress,g.localPort):null,m;if(t.encrypted){let v=g,R=v.getCipher(),w=v.getCertificate(),B=v.getPeerCertificate();m={cipherSuiteStandardName:(i=R.standardName)!==null&&i!==void 0?i:null,cipherSuiteOtherName:R.standardName?null:R.name,localCertificate:w&&"raw"in w?w.raw:null,remoteCertificate:B&&"raw"in B?B.raw:null}}else m=null;return{remoteAddress:_,localAddress:p,security:m,remoteName:null,streamsStarted:l.streamTracker.callsStarted,streamsSucceeded:l.streamTracker.callsSucceeded,streamsFailed:l.streamTracker.callsFailed,messagesSent:l.messagesSent,messagesReceived:l.messagesReceived,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:l.streamTracker.lastCallStartedTimestamp,lastMessageSentTimestamp:l.lastMessageSentTimestamp,lastMessageReceivedTimestamp:l.lastMessageReceivedTimestamp,localFlowControlWindow:(s=t.state.localWindowSize)!==null&&s!==void 0?s:null,remoteFlowControlWindow:(o=t.state.remoteWindowSize)!==null&&o!==void 0?o:null}}}trace(t){Cl.trace(Mr.LogVerbosity.DEBUG,iw,"("+this.channelzRef.id+") "+t)}addProtoService(){throw new Error("Not implemented. Use addService() instead")}addService(t,i){if(t===null||typeof t!="object"||i===null||typeof i!="object")throw new Error("addService() requires two objects as arguments");let s=Object.keys(t);if(s.length===0)throw new Error("Cannot add an empty service to a server");s.forEach(o=>{let l=t[o],g;l.requestStream?l.responseStream?g="bidi":g="clientStream":l.responseStream?g="serverStream":g="unary";let _=i[o],p;if(_===void 0&&typeof l.originalName=="string"&&(_=i[l.originalName]),_!==void 0?p=_.bind(i):p=nw(g,o),this.register(l.path,p,l.responseSerialize,l.requestDeserialize,g)===!1)throw new Error(`Method handler for ${l.path} already provided.`)})}removeService(t){if(t===null||typeof t!="object")throw new Error("removeService() requires object as argument");Object.keys(t).forEach(s=>{let o=t[s];this.unregister(o.path)})}bind(t,i){throw new Error("Not implemented. Use bindAsync() instead")}bindAsync(t,i,s){if(this.started===!0)throw new Error("server is already started");if(typeof t!="string")throw new TypeError("port must be a string");if(i===null||!(i instanceof ew.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");if(typeof s!="function")throw new TypeError("callback must be a function");let o=tw.parseUri(t);if(o===null)throw new Error(`Could not parse port "${t}"`);let l=Dm.mapUriDefaultScheme(o);if(l===null)throw new Error(`Could not get a default scheme for port "${t}"`);let g={maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER};"grpc-node.max_session_memory"in this.options?g.maxSessionMemory=this.options["grpc-node.max_session_memory"]:g.maxSessionMemory=Number.MAX_SAFE_INTEGER,"grpc.max_concurrent_streams"in this.options&&(g.settings={maxConcurrentStreams:this.options["grpc.max_concurrent_streams"]});let _=(w,B)=>{process.nextTick(()=>s(w,B))},p=()=>{let w;if(i._isSecure()){let B=Object.assign(g,i._getSettings());w=Ai.createSecureServer(B),w.on("secureConnection",I=>{I.on("error",D=>{this.trace("An incoming TLS connection closed with error: "+D.message)})})}else w=Ai.createServer(g);return w.setTimeout(0,sw),this._setupHandlers(w),w},m=(w,B,I)=>w.length===0?Promise.resolve({port:B,count:I}):Promise.all(w.map(D=>{this.trace("Attempting to bind "+Yt.subchannelAddressToString(D));let C;Yt.isTcpSubchannelAddress(D)?C={host:D.host,port:B}:C=D;let P=p();return new Promise((ee,H)=>{let re=Q=>{this.trace("Failed to bind "+Yt.subchannelAddressToString(D)+" with error "+Q.message),ee(Q)};P.once("error",re),P.listen(C,()=>{let Q=P.address(),te;typeof Q=="string"?te={path:Q}:te={host:Q.address,port:Q.port};let q;q=ut.registerChannelzSocket(Yt.subchannelAddressToString(te),()=>({localAddress:te,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),this.channelzEnabled&&this.listenerChildrenTracker.refChild(q),this.http2ServerList.push({server:P,channelzRef:q}),this.trace("Successfully bound "+Yt.subchannelAddressToString(te)),ee("port"in te?te.port:B),P.removeListener("error",re)})})})).then(D=>{let C=0;for(let P of D)if(typeof P=="number"&&(C+=1,P!==B))throw new Error("Invalid state: multiple port numbers added from single address");return{port:B,count:C+I}}),S=w=>{if(w.length===0)return Promise.resolve({port:0,count:0});let B=w[0],I=p();return new Promise((D,C)=>{let P=ee=>{this.trace("Failed to bind "+Yt.subchannelAddressToString(B)+" with error "+ee.message),D(S(w.slice(1)))};I.once("error",P),I.listen(B,()=>{let ee=I.address(),H={host:ee.address,port:ee.port},re;re=ut.registerChannelzSocket(Yt.subchannelAddressToString(H),()=>({localAddress:H,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),this.channelzEnabled&&this.listenerChildrenTracker.refChild(re),this.http2ServerList.push({server:I,channelzRef:re}),this.trace("Successfully bound "+Yt.subchannelAddressToString(H)),D(m(w.slice(1),ee.port,1)),I.removeListener("error",P)})})},v={onSuccessfulResolution:(w,B,I)=>{if(v.onSuccessfulResolution=()=>{},w.length===0){_(new Error(`No addresses resolved for port ${t}`),0);return}let D;Yt.isTcpSubchannelAddress(w[0])?w[0].port===0?D=S(w):D=m(w,w[0].port,0):D=m(w,1,0),D.then(C=>{if(C.count===0){let P=`No address added out of total ${w.length} resolved`;Cl.log(Mr.LogVerbosity.ERROR,P),_(new Error(P),0)}else C.count{let P=`No address added out of total ${w.length} resolved`;Cl.log(Mr.LogVerbosity.ERROR,P),_(new Error(P),0)})},onError:w=>{_(new Error(w.details),0)}};Dm.createResolver(l,v,this.options).updateResolution()}forceShutdown(){for(let{server:t,channelzRef:i}of this.http2ServerList)t.listening&&t.close(()=>{this.channelzEnabled&&(this.listenerChildrenTracker.unrefChild(i),ut.unregisterChannelzRef(i))});this.started=!1,this.sessions.forEach((t,i)=>{i.destroy(Ai.constants.NGHTTP2_CANCEL)}),this.sessions.clear(),this.channelzEnabled&&ut.unregisterChannelzRef(this.channelzRef)}register(t,i,s,o,l){return this.handlers.has(t)?!1:(this.handlers.set(t,{func:i,serialize:s,deserialize:o,type:l,path:t}),!0)}unregister(t){return this.handlers.delete(t)}start(){if(this.http2ServerList.length===0||this.http2ServerList.every(({server:t})=>t.listening!==!0))throw new Error("server must be bound in order to start");if(this.started===!0)throw new Error("server is already started");this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Starting"),this.started=!0}tryShutdown(t){let i=l=>{this.channelzEnabled&&ut.unregisterChannelzRef(this.channelzRef),t(l)},s=0;function o(){s--,s===0&&i()}this.started=!1;for(let{server:l,channelzRef:g}of this.http2ServerList)l.listening&&(s++,l.close(()=>{this.channelzEnabled&&(this.listenerChildrenTracker.unrefChild(g),ut.unregisterChannelzRef(g)),o()}));this.sessions.forEach((l,g)=>{g.closed||(s+=1,g.close(o))}),s===0&&i()}addHttp2Port(){throw new Error("Not yet implemented")}getChannelzRef(){return this.channelzRef}_verifyContentType(t,i){let s=i[Ai.constants.HTTP2_HEADER_CONTENT_TYPE];return typeof s!="string"||!s.startsWith("application/grpc")?(t.respond({[Ai.constants.HTTP2_HEADER_STATUS]:Ai.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE},{endStream:!0}),!1):!0}_retrieveHandler(t){let i=t[rw];this.trace("Received call to method "+i+" at address "+this.serverAddressString);let s=this.handlers.get(i);if(s===void 0)throw this.trace("No handler registered for method "+i+". Sending UNIMPLEMENTED status."),Pm(i);return s}_respondWithError(t,i,s=null){let o=new Ri.Http2ServerCallStream(i,null,this.options);t.code===void 0&&(t.code=Mr.Status.INTERNAL),this.channelzEnabled&&(this.callTracker.addCallFailed(),s==null||s.streamTracker.addCallFailed()),o.sendError(t)}_channelzHandler(t,i){let s=this.sessions.get(t.session);if(this.callTracker.addCallStarted(),s==null||s.streamTracker.addCallStarted(),!this._verifyContentType(t,i)){this.callTracker.addCallFailed(),s==null||s.streamTracker.addCallFailed();return}let o;try{o=this._retrieveHandler(i)}catch(g){this._respondWithError(g,t,s);return}let l=new Ri.Http2ServerCallStream(t,o,this.options);l.once("callEnd",g=>{g===Mr.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()}),s&&(l.once("streamEnd",g=>{g?s.streamTracker.addCallSucceeded():s.streamTracker.addCallFailed()}),l.on("sendMessage",()=>{s.messagesSent+=1,s.lastMessageSentTimestamp=new Date}),l.on("receiveMessage",()=>{s.messagesReceived+=1,s.lastMessageReceivedTimestamp=new Date})),this._runHandlerForCall(l,o,i)||(this.callTracker.addCallFailed(),s==null||s.streamTracker.addCallFailed(),l.sendError({code:Mr.Status.INTERNAL,details:`Unknown handler type: ${o.type}`}))}_streamHandler(t,i){if(this._verifyContentType(t,i)!==!0)return;let s;try{s=this._retrieveHandler(i)}catch(l){this._respondWithError(l,t,null);return}let o=new Ri.Http2ServerCallStream(t,s,this.options);this._runHandlerForCall(o,s,i)||o.sendError({code:Mr.Status.INTERNAL,details:`Unknown handler type: ${s.type}`})}_runHandlerForCall(t,i,s){var o;let l=t.receiveMetadata(s),g=(o=l.get("grpc-encoding")[0])!==null&&o!==void 0?o:"identity";l.remove("grpc-encoding");let{type:_}=i;if(_==="unary")ow(t,i,l,g);else if(_==="clientStream")aw(t,i,l,g);else if(_==="serverStream")lw(t,i,l,g);else if(_==="bidi")uw(t,i,l,g);else return!1;return!0}_setupHandlers(t){if(t===null)return;let i=t.address(),s="null";i&&(typeof i=="string"?s=i:s=i.address+":"+i.port),this.serverAddressString=s;let o=this.channelzEnabled?this._channelzHandler:this._streamHandler;t.on("stream",o.bind(this)),t.on("session",l=>{var g;if(!this.started){l.destroy();return}let _;_=ut.registerChannelzSocket((g=l.socket.remoteAddress)!==null&&g!==void 0?g:"unknown",this.getChannelzSessionInfoGetter(l),this.channelzEnabled);let p={ref:_,streamTracker:new ut.ChannelzCallTracker,messagesSent:0,messagesReceived:0,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null};this.sessions.set(l,p);let m=l.socket.remoteAddress;this.channelzEnabled&&(this.channelzTrace.addTrace("CT_INFO","Connection established by client "+m),this.sessionChildrenTracker.refChild(_)),l.on("close",()=>{this.channelzEnabled&&(this.channelzTrace.addTrace("CT_INFO","Connection dropped by client "+m),this.sessionChildrenTracker.unrefChild(_),ut.unregisterChannelzRef(_)),this.sessions.delete(l)})})}};Ml.Server=np;function ow(r,t,i,s){r.receiveUnaryMessage(s,(o,l)=>{if(o){r.sendError(o);return}if(l===void 0||r.cancelled)return;let g=new Ri.ServerUnaryCallImpl(r,i,l);t.func(g,(_,p,m,S)=>{r.sendUnaryMessage(_,p,m,S)})})}function aw(r,t,i,s){let o=new Ri.ServerReadableStreamImpl(r,i,t.deserialize,s);function l(g,_,p,m){o.destroy(),r.sendUnaryMessage(g,_,p,m)}r.cancelled||(o.on("error",l),t.func(o,l))}function lw(r,t,i,s){r.receiveUnaryMessage(s,(o,l)=>{if(o){r.sendError(o);return}if(l===void 0||r.cancelled)return;let g=new Ri.ServerWritableStreamImpl(r,i,t.serialize,l);t.func(g)})}function uw(r,t,i,s){let o=new Ri.ServerDuplexStreamImpl(r,i,t.serialize,t.deserialize,s);r.cancelled||t.func(o)}});var Lm=j(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});jl.StatusBuilder=void 0;var op=class{constructor(){this.code=null,this.details=null,this.metadata=null}withCode(t){return this.code=t,this}withDetails(t){return this.details=t,this}withMetadata(t){return this.metadata=t,this}build(){let t={};return this.code!==null&&(t.code=this.code),this.details!==null&&(t.details=this.details),this.metadata!==null&&(t.metadata=this.metadata),t}};jl.StatusBuilder=op});var ap=j(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.isDuration=ti.durationToMs=ti.msToDuration=void 0;function cw(r){return{seconds:r/1e3|0,nanos:r%1e3*1e6|0}}ti.msToDuration=cw;function gw(r){return r.seconds*1e3+r.nanos/1e6|0}ti.durationToMs=gw;function pw(r){return typeof r.seconds=="number"&&typeof r.nanos=="number"}ti.isDuration=pw});var up=j(Bl=>{"use strict";Object.defineProperty(Bl,"__esModule",{value:!0});Bl.BaseSubchannelWrapper=void 0;var lp=class{constructor(t){this.child=t}getConnectivityState(){return this.child.getConnectivityState()}addConnectivityStateListener(t){this.child.addConnectivityStateListener(t)}removeConnectivityStateListener(t){this.child.removeConnectivityStateListener(t)}startConnecting(){this.child.startConnecting()}getAddress(){return this.child.getAddress()}ref(){this.child.ref()}unref(){this.child.unref()}getChannelzRef(){return this.child.getChannelzRef()}getRealSubchannel(){return this.child.getRealSubchannel()}};Bl.BaseSubchannelWrapper=lp});var bp=j(ri=>{"use strict";var cp;Object.defineProperty(ri,"__esModule",{value:!0});ri.setup=ri.OutlierDetectionLoadBalancer=ri.OutlierDetectionLoadBalancingConfig=void 0;var xl=kt(),Wm=be(),wi=ap(),qm=Sp(),dw=Ei(),Hm=kr(),hw=Oa(),fw=di(),zm=tr(),_w=up(),mw=Ue(),yw="outlier_detection";function Le(r){mw.trace(Wm.LogVerbosity.DEBUG,yw,r)}var yp="outlier_detection",bw=((cp=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)!==null&&cp!==void 0?cp:"true")==="true",Sw={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},vw={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function vs(r,t,i,s){if(t in r&&typeof r[t]!==i){let o=s?`${s}.${t}`:t;throw new Error(`outlier detection config ${o} parse error: expected ${i}, got ${typeof r[t]}`)}}function gp(r,t,i){let s=i?`${i}.${t}`:t;if(t in r){if(!wi.isDuration(r[t]))throw new Error(`outlier detection config ${s} parse error: expected Duration, got ${typeof r[t]}`);if(!(r[t].seconds>=0&&r[t].seconds<=315576e6&&r[t].nanos>=0&&r[t].nanos<=999999999))throw new Error(`outlier detection config ${s} parse error: values out of range for non-negative Duaration`)}}function Nl(r,t,i){let s=i?`${i}.${t}`:t;if(vs(r,t,"number",i),t in r&&!(r[t]>=0&&r[t]<=100))throw new Error(`outlier detection config ${s} parse error: value out of range for percentage (0-100)`)}var ii=class{constructor(t,i,s,o,l,g,_){this.childPolicy=_,this.intervalMs=t!=null?t:1e4,this.baseEjectionTimeMs=i!=null?i:3e4,this.maxEjectionTimeMs=s!=null?s:3e5,this.maxEjectionPercent=o!=null?o:10,this.successRateEjection=l?Object.assign(Object.assign({},Sw),l):null,this.failurePercentageEjection=g?Object.assign(Object.assign({},vw),g):null}getLoadBalancerName(){return yp}toJsonObject(){return{interval:wi.msToDuration(this.intervalMs),base_ejection_time:wi.msToDuration(this.baseEjectionTimeMs),max_ejection_time:wi.msToDuration(this.maxEjectionTimeMs),max_ejection_percent:this.maxEjectionPercent,success_rate_ejection:this.successRateEjection,failure_percentage_ejection:this.failurePercentageEjection,child_policy:this.childPolicy.map(t=>t.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}copyWithChildPolicy(t){return new ii(this.intervalMs,this.baseEjectionTimeMs,this.maxEjectionTimeMs,this.maxEjectionPercent,this.successRateEjection,this.failurePercentageEjection,t)}static createFromJson(t){var i;if(gp(t,"interval"),gp(t,"base_ejection_time"),gp(t,"max_ejection_time"),Nl(t,"max_ejection_percent"),"success_rate_ejection"in t){if(typeof t.success_rate_ejection!="object")throw new Error("outlier detection config success_rate_ejection must be an object");vs(t.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),Nl(t.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),vs(t.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),vs(t.success_rate_ejection,"request_volume","number","success_rate_ejection")}if("failure_percentage_ejection"in t){if(typeof t.failure_percentage_ejection!="object")throw new Error("outlier detection config failure_percentage_ejection must be an object");Nl(t.failure_percentage_ejection,"threshold","failure_percentage_ejection"),Nl(t.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),vs(t.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),vs(t.failure_percentage_ejection,"request_volume","number","failure_percentage_ejection")}return new ii(t.interval?wi.durationToMs(t.interval):null,t.base_ejection_time?wi.durationToMs(t.base_ejection_time):null,t.max_ejection_time?wi.durationToMs(t.max_ejection_time):null,(i=t.max_ejection_percent)!==null&&i!==void 0?i:null,t.success_rate_ejection,t.failure_percentage_ejection,t.child_policy.map(Hm.validateLoadBalancingConfig))}};ri.OutlierDetectionLoadBalancingConfig=ii;var dp=class extends _w.BaseSubchannelWrapper{constructor(t,i){super(t),this.mapEntry=i,this.stateListeners=[],this.ejected=!1,this.refCount=0,this.childSubchannelState=t.getConnectivityState(),t.addConnectivityStateListener((s,o,l)=>{if(this.childSubchannelState=l,!this.ejected)for(let g of this.stateListeners)g(this,o,l)})}getConnectivityState(){return this.ejected?xl.ConnectivityState.TRANSIENT_FAILURE:this.childSubchannelState}addConnectivityStateListener(t){this.stateListeners.push(t)}removeConnectivityStateListener(t){let i=this.stateListeners.indexOf(t);i>-1&&this.stateListeners.splice(i,1)}ref(){this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0&&this.mapEntry){let t=this.mapEntry.subchannelWrappers.indexOf(this);t>=0&&this.mapEntry.subchannelWrappers.splice(t,1)}}eject(){this.ejected=!0;for(let t of this.stateListeners)t(this,this.childSubchannelState,xl.ConnectivityState.TRANSIENT_FAILURE)}uneject(){this.ejected=!1;for(let t of this.stateListeners)t(this,xl.ConnectivityState.TRANSIENT_FAILURE,this.childSubchannelState)}getMapEntry(){return this.mapEntry}getWrappedSubchannel(){return this.child}};function pp(){return{success:0,failure:0}}var hp=class{constructor(){this.activeBucket=pp(),this.inactiveBucket=pp()}addSuccess(){this.activeBucket.success+=1}addFailure(){this.activeBucket.failure+=1}switchBuckets(){this.inactiveBucket=this.activeBucket,this.activeBucket=pp()}getLastSuccesses(){return this.inactiveBucket.success}getLastFailures(){return this.inactiveBucket.failure}},fp=class extends dw.BaseFilter{constructor(t){super(),this.callCounter=t}receiveTrailers(t){return t.code===Wm.Status.OK?this.callCounter.addSuccess():this.callCounter.addFailure(),t}},_p=class{constructor(t){this.callCounter=t}createFilter(t){return new fp(this.callCounter)}},mp=class{constructor(t,i){this.wrappedPicker=t,this.countCalls=i}pick(t){let i=this.wrappedPicker.pick(t);if(i.pickResultType===fw.PickResultType.COMPLETE){let s=i.subchannel,o=s.getMapEntry();if(o){let l=[...i.extraFilterFactories];return this.countCalls&&l.push(new _p(o.counter)),Object.assign(Object.assign({},i),{subchannel:s.getWrappedSubchannel(),extraFilterFactories:l})}else return Object.assign(Object.assign({},i),{subchannel:s.getWrappedSubchannel()})}else return i}},Il=class{constructor(t){this.addressMap=new Map,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new hw.ChildLoadBalancerHandler(qm.createChildChannelControlHelper(t,{createSubchannel:(i,s)=>{let o=t.createSubchannel(i,s),l=this.addressMap.get(zm.subchannelAddressToString(i)),g=new dp(o,l);return(l==null?void 0:l.currentEjectionTimestamp)!==null&&g.eject(),l==null||l.subchannelWrappers.push(g),g},updateState:(i,s)=>{i===xl.ConnectivityState.READY?t.updateState(i,new mp(s,this.isCountingEnabled())):t.updateState(i,s)}})),this.ejectionTimer=setInterval(()=>{},0),clearInterval(this.ejectionTimer)}isCountingEnabled(){return this.latestConfig!==null&&(this.latestConfig.getSuccessRateEjectionConfig()!==null||this.latestConfig.getFailurePercentageEjectionConfig()!==null)}getCurrentEjectionPercent(){let t=0;for(let i of this.addressMap.values())i.currentEjectionTimestamp!==null&&(t+=1);return t*100/this.addressMap.size}runSuccessRateCheck(t){if(!this.latestConfig)return;let i=this.latestConfig.getSuccessRateEjectionConfig();if(!i)return;Le("Running success rate check");let s=i.request_volume,o=0,l=[];for(let v of this.addressMap.values()){let R=v.counter.getLastSuccesses(),w=v.counter.getLastFailures();R+w>=s&&(o+=1,l.push(R/(R+w)))}if(Le("Found "+o+" success rate candidates; currentEjectionPercent="+this.getCurrentEjectionPercent()+" successRates=["+l+"]"),ov+R)/l.length,_=0;for(let v of l){let R=v-g;_+=R*R}let p=_/l.length,m=Math.sqrt(p),S=g-m*(i.stdev_factor/1e3);Le("stdev="+m+" ejectionThreshold="+S);for(let[v,R]of this.addressMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let w=R.counter.getLastSuccesses(),B=R.counter.getLastFailures();if(w+Bthis.runChecks(),t)}runChecks(){let t=new Date;if(Le("Ejection timer running"),this.switchAllBuckets(),!!this.latestConfig){this.timerStartTime=t,this.startTimer(this.latestConfig.getIntervalMs()),this.runSuccessRateCheck(t),this.runFailurePercentageCheck(t);for(let[i,s]of this.addressMap.entries())if(s.currentEjectionTimestamp===null)s.ejectionTimeMultiplier>0&&(s.ejectionTimeMultiplier-=1);else{let o=this.latestConfig.getBaseEjectionTimeMs(),l=this.latestConfig.getMaxEjectionTimeMs(),g=new Date(s.currentEjectionTimestamp.getTime());g.setMilliseconds(g.getMilliseconds()+Math.min(o*s.ejectionTimeMultiplier,Math.max(o,l))),g{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});var Vm=Ue();Object.defineProperty(Ce,"trace",{enumerable:!0,get:function(){return Vm.trace}});Object.defineProperty(Ce,"log",{enumerable:!0,get:function(){return Vm.log}});var Tw=Qt();Object.defineProperty(Ce,"registerResolver",{enumerable:!0,get:function(){return Tw.registerResolver}});var Aw=bt();Object.defineProperty(Ce,"uriToString",{enumerable:!0,get:function(){return Aw.uriToString}});var Rw=ap();Object.defineProperty(Ce,"durationToMs",{enumerable:!0,get:function(){return Rw.durationToMs}});var ww=Rn();Object.defineProperty(Ce,"BackoffTimeout",{enumerable:!0,get:function(){return ww.BackoffTimeout}});var Fl=kr();Object.defineProperty(Ce,"createChildChannelControlHelper",{enumerable:!0,get:function(){return Fl.createChildChannelControlHelper}});Object.defineProperty(Ce,"registerLoadBalancerType",{enumerable:!0,get:function(){return Fl.registerLoadBalancerType}});Object.defineProperty(Ce,"getFirstUsableConfig",{enumerable:!0,get:function(){return Fl.getFirstUsableConfig}});Object.defineProperty(Ce,"validateLoadBalancingConfig",{enumerable:!0,get:function(){return Fl.validateLoadBalancingConfig}});var Ow=tr();Object.defineProperty(Ce,"subchannelAddressToString",{enumerable:!0,get:function(){return Ow.subchannelAddressToString}});var Cw=Oa();Object.defineProperty(Ce,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return Cw.ChildLoadBalancerHandler}});var vp=di();Object.defineProperty(Ce,"UnavailablePicker",{enumerable:!0,get:function(){return vp.UnavailablePicker}});Object.defineProperty(Ce,"QueuePicker",{enumerable:!0,get:function(){return vp.QueuePicker}});Object.defineProperty(Ce,"PickResultType",{enumerable:!0,get:function(){return vp.PickResultType}});var Mw=Ei();Object.defineProperty(Ce,"BaseFilter",{enumerable:!0,get:function(){return Mw.BaseFilter}});var jw=zg();Object.defineProperty(Ce,"FilterStackFactory",{enumerable:!0,get:function(){return jw.FilterStackFactory}});var Bw=Ma();Object.defineProperty(Ce,"registerAdminService",{enumerable:!0,get:function(){return Bw.registerAdminService}});var Nw=up();Object.defineProperty(Ce,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return Nw.BaseSubchannelWrapper}});var xw=bp();Object.defineProperty(Ce,"OutlierDetectionLoadBalancingConfig",{enumerable:!0,get:function(){return xw.OutlierDetectionLoadBalancingConfig}})});var Jm=j(Ul=>{"use strict";Object.defineProperty(Ul,"__esModule",{value:!0});Ul.setup=void 0;var Gm=Qt(),Km=require("dns"),Xm=require("util"),Iw=Ju(),Ep=be(),Tp=Pt(),Fw=Ue(),Uw=be(),si=bt(),Ym=require("net"),Dw=Rn(),Pw="dns_resolver";function Es(r){Fw.trace(Uw.LogVerbosity.DEBUG,Pw,r)}var $m=443,kw=3e4,Lw=Xm.promisify(Km.resolveTxt),zw=Xm.promisify(Km.lookup);function Ww(...r){let t=[];for(let i=0;is.length));i++)for(let s of r)i{this.continueResolving&&this.startResolutionWithBackoff()},p),this.backoff.unref(),this.minTimeBetweenResolutionsMs=(g=s["grpc.dns_min_time_between_resolutions_ms"])!==null&&g!==void 0?g:kw,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(this.ipResult!==null){Es("Returning IP address for target "+si.uriToString(this.target)),setImmediate(()=>{this.listener.onSuccessfulResolution(this.ipResult,null,null,null,{})}),this.backoff.stop(),this.backoff.reset();return}if(this.dnsHostname===null)Es("Failed to parse DNS address "+si.uriToString(this.target)),setImmediate(()=>{this.listener.onError({code:Ep.Status.UNAVAILABLE,details:`Failed to parse DNS address ${si.uriToString(this.target)}`,metadata:new Tp.Metadata})}),this.stopNextResolutionTimer();else{if(this.pendingLookupPromise!==null)return;Es("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;let t=this.dnsHostname;this.pendingLookupPromise=zw(t,{all:!0}),this.pendingLookupPromise.then(i=>{this.pendingLookupPromise=null,this.backoff.reset(),this.backoff.stop();let s=i.filter(g=>g.family===4),o=i.filter(g=>g.family===6);this.latestLookupResult=Ww(o,s).map(g=>({host:g.address,port:+this.port}));let l="["+this.latestLookupResult.map(g=>g.host+":"+g.port).join(",")+"]";if(Es("Resolved addresses for target "+si.uriToString(this.target)+": "+l),this.latestLookupResult.length===0){this.listener.onError(this.defaultResolutionError);return}this.listener.onSuccessfulResolution(this.latestLookupResult,this.latestServiceConfig,this.latestServiceConfigError,null,{})},i=>{Es("Resolution error for target "+si.uriToString(this.target)+": "+i.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener.onError(this.defaultResolutionError)}),this.pendingTxtPromise===null&&(this.pendingTxtPromise=Lw(t),this.pendingTxtPromise.then(i=>{this.pendingTxtPromise=null;try{this.latestServiceConfig=Iw.extractAndSelectServiceConfig(i,this.percentage)}catch(s){this.latestServiceConfigError={code:Ep.Status.UNAVAILABLE,details:"Parsing service config failed",metadata:new Tp.Metadata}}this.latestLookupResult!==null&&this.listener.onSuccessfulResolution(this.latestLookupResult,this.latestServiceConfig,this.latestServiceConfigError,null,{})},i=>{}))}}startNextResolutionTimer(){var t,i;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=(i=(t=setTimeout(()=>{this.stopNextResolutionTimer(),this.continueResolving&&this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs)).unref)===null||i===void 0?void 0:i.call(t),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){this.pendingLookupPromise===null&&(this.continueResolving=!1,this.startResolution(),this.backoff.runOnce(),this.startNextResolutionTimer())}updateResolution(){this.pendingLookupPromise===null&&(this.isNextResolutionTimerRunning||this.backoff.isRunning()?this.continueResolving=!0:this.startResolutionWithBackoff())}destroy(){this.continueResolving=!1,this.backoff.stop(),this.stopNextResolutionTimer()}static getDefaultAuthority(t){return t.path}};function qw(){Gm.registerResolver("dns",Ap),Gm.registerDefaultScheme("dns")}Ul.setup=qw});var Zm=j(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.setup=void 0;var Hw=Qt(),Rp=class{constructor(t,i,s){this.listener=i,this.addresses=[];let o;t.authority===""?o="/"+t.path:o=t.path,this.addresses=[{path:o}]}updateResolution(){process.nextTick(this.listener.onSuccessfulResolution,this.addresses,null,null,null,{})}destroy(){}static getDefaultAuthority(t){return"localhost"}};function Vw(){Hw.registerResolver("unix",Rp)}Dl.setup=Vw});var iy=j(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});Ll.setup=void 0;var Qm=require("net"),Pl=be(),wp=Pt(),ey=Qt(),ty=bt(),Gw=Ue(),Yw="ip_resolver";function ry(r){Gw.trace(Pl.LogVerbosity.DEBUG,Yw,r)}var Op="ipv4",Cp="ipv6",$w=443,kl=class{constructor(t,i,s){var o;this.target=t,this.listener=i,this.addresses=[],this.error=null,ry("Resolver constructed for target "+ty.uriToString(t));let l=[];if(!(t.scheme===Op||t.scheme===Cp)){this.error={code:Pl.Status.UNAVAILABLE,details:`Unrecognized scheme ${t.scheme} in IP resolver`,metadata:new wp.Metadata};return}let g=t.path.split(",");for(let _ of g){let p=ty.splitHostPort(_);if(p===null){this.error={code:Pl.Status.UNAVAILABLE,details:`Failed to parse ${t.scheme} address ${_}`,metadata:new wp.Metadata};return}if(t.scheme===Op&&!Qm.isIPv4(p.host)||t.scheme===Cp&&!Qm.isIPv6(p.host)){this.error={code:Pl.Status.UNAVAILABLE,details:`Failed to parse ${t.scheme} address ${_}`,metadata:new wp.Metadata};return}l.push({host:p.host,port:(o=p.port)!==null&&o!==void 0?o:$w})}this.addresses=l,ry("Parsed "+t.scheme+" address list "+this.addresses)}updateResolution(){process.nextTick(()=>{this.error?this.listener.onError(this.error):this.listener.onSuccessfulResolution(this.addresses,null,null,null,{})})}destroy(){}static getDefaultAuthority(t){return t.path.split(",")[0]}};function Kw(){ey.registerResolver(Op,kl),ey.registerResolver(Cp,kl)}Ll.setup=Kw});var ny=j(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.setup=ni.PickFirstLoadBalancer=ni.PickFirstLoadBalancingConfig=void 0;var sy=kr(),ie=kt(),$t=di(),Xw=tr(),Jw=Ue(),Zw=be(),Qw="pick_first";function zl(r){Jw.trace(Zw.LogVerbosity.DEBUG,Qw,r)}var ro="pick_first",e0=250,Ts=class{getLoadBalancerName(){return ro}constructor(){}toJsonObject(){return{[ro]:{}}}static createFromJson(t){return new Ts}};ni.PickFirstLoadBalancingConfig=Ts;var Mp=class{constructor(t){this.subchannel=t}pick(t){return{pickResultType:$t.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,extraFilterFactories:[],onCallStarted:null}}},Wl=class{constructor(t){this.channelControlHelper=t,this.latestAddressList=[],this.subchannels=[],this.currentState=ie.ConnectivityState.IDLE,this.currentSubchannelIndex=0,this.currentPick=null,this.triedAllSubchannels=!1,this.subchannelStateCounts={[ie.ConnectivityState.CONNECTING]:0,[ie.ConnectivityState.IDLE]:0,[ie.ConnectivityState.READY]:0,[ie.ConnectivityState.SHUTDOWN]:0,[ie.ConnectivityState.TRANSIENT_FAILURE]:0},this.subchannelStateListener=(i,s,o)=>{if(this.subchannelStateCounts[s]-=1,this.subchannelStateCounts[o]+=1,i===this.subchannels[this.currentSubchannelIndex]&&o===ie.ConnectivityState.TRANSIENT_FAILURE&&this.startNextSubchannelConnecting(),o===ie.ConnectivityState.READY){this.pickSubchannel(i);return}else{if(this.triedAllSubchannels&&this.subchannelStateCounts[ie.ConnectivityState.IDLE]===this.subchannels.length){this.resetSubchannelList(!1),this.updateState(ie.ConnectivityState.IDLE,new $t.QueuePicker(this));return}if(this.currentPick===null)if(this.triedAllSubchannels){let l;this.subchannelStateCounts[ie.ConnectivityState.CONNECTING]>0?l=ie.ConnectivityState.CONNECTING:this.subchannelStateCounts[ie.ConnectivityState.TRANSIENT_FAILURE]>0?l=ie.ConnectivityState.TRANSIENT_FAILURE:l=ie.ConnectivityState.IDLE,l!==this.currentState&&(l===ie.ConnectivityState.TRANSIENT_FAILURE?this.updateState(l,new $t.UnavailablePicker):this.updateState(l,new $t.QueuePicker(this)))}else this.updateState(ie.ConnectivityState.CONNECTING,new $t.QueuePicker(this))}},this.pickedSubchannelStateListener=(i,s,o)=>{if(o!==ie.ConnectivityState.READY)if(this.currentPick=null,i.unref(),i.removeConnectivityStateListener(this.pickedSubchannelStateListener),this.channelControlHelper.removeChannelzChild(i.getChannelzRef()),this.subchannels.length>0)if(this.triedAllSubchannels){let l;this.subchannelStateCounts[ie.ConnectivityState.CONNECTING]>0?l=ie.ConnectivityState.CONNECTING:this.subchannelStateCounts[ie.ConnectivityState.TRANSIENT_FAILURE]>0?l=ie.ConnectivityState.TRANSIENT_FAILURE:l=ie.ConnectivityState.IDLE,l===ie.ConnectivityState.TRANSIENT_FAILURE?this.updateState(l,new $t.UnavailablePicker):this.updateState(l,new $t.QueuePicker(this))}else this.updateState(ie.ConnectivityState.CONNECTING,new $t.QueuePicker(this));else this.updateState(ie.ConnectivityState.IDLE,new $t.QueuePicker(this))},this.connectionDelayTimeout=setTimeout(()=>{},0),clearTimeout(this.connectionDelayTimeout)}startNextSubchannelConnecting(){if(!this.triedAllSubchannels){for(let[t,i]of this.subchannels.entries())if(t>this.currentSubchannelIndex){let s=i.getConnectivityState();if(s===ie.ConnectivityState.IDLE||s===ie.ConnectivityState.CONNECTING){this.startConnecting(t);return}}this.triedAllSubchannels=!0}}startConnecting(t){clearTimeout(this.connectionDelayTimeout),this.currentSubchannelIndex=t,this.subchannels[t].getConnectivityState()===ie.ConnectivityState.IDLE&&(zl("Start connecting to subchannel with address "+this.subchannels[t].getAddress()),process.nextTick(()=>{this.subchannels[t].startConnecting()})),this.connectionDelayTimeout=setTimeout(()=>{this.startNextSubchannelConnecting()},e0)}pickSubchannel(t){zl("Pick subchannel with address "+t.getAddress()),this.currentPick!==null&&(this.currentPick.unref(),this.currentPick.removeConnectivityStateListener(this.pickedSubchannelStateListener)),this.currentPick=t,this.updateState(ie.ConnectivityState.READY,new Mp(t)),t.addConnectivityStateListener(this.pickedSubchannelStateListener),t.ref(),this.channelControlHelper.addChannelzChild(t.getChannelzRef()),this.resetSubchannelList(),clearTimeout(this.connectionDelayTimeout)}updateState(t,i){zl(ie.ConnectivityState[this.currentState]+" -> "+ie.ConnectivityState[t]),this.currentState=t,this.channelControlHelper.updateState(t,i)}resetSubchannelList(t=!0){for(let i of this.subchannels)i.removeConnectivityStateListener(this.subchannelStateListener),i.unref(),this.channelControlHelper.removeChannelzChild(i.getChannelzRef());this.currentSubchannelIndex=0,this.subchannelStateCounts={[ie.ConnectivityState.CONNECTING]:0,[ie.ConnectivityState.IDLE]:0,[ie.ConnectivityState.READY]:0,[ie.ConnectivityState.SHUTDOWN]:0,[ie.ConnectivityState.TRANSIENT_FAILURE]:0},this.subchannels=[],t&&(this.triedAllSubchannels=!1)}connectToAddressList(){this.resetSubchannelList(),zl("Connect to address list "+this.latestAddressList.map(t=>Xw.subchannelAddressToString(t))),this.subchannels=this.latestAddressList.map(t=>this.channelControlHelper.createSubchannel(t,{}));for(let t of this.subchannels)t.ref(),this.channelControlHelper.addChannelzChild(t.getChannelzRef());for(let t of this.subchannels)if(t.addConnectivityStateListener(this.subchannelStateListener),this.subchannelStateCounts[t.getConnectivityState()]+=1,t.getConnectivityState()===ie.ConnectivityState.READY){this.pickSubchannel(t),this.resetSubchannelList();return}for(let[t,i]of this.subchannels.entries()){let s=i.getConnectivityState();if(s===ie.ConnectivityState.IDLE||s===ie.ConnectivityState.CONNECTING){this.startConnecting(t),this.currentPick===null&&this.updateState(ie.ConnectivityState.CONNECTING,new $t.QueuePicker(this));return}}this.currentPick===null&&this.updateState(ie.ConnectivityState.TRANSIENT_FAILURE,new $t.UnavailablePicker)}updateAddressList(t,i){(this.subchannels.length===0||!this.latestAddressList.every((s,o)=>t[o]===s))&&(this.latestAddressList=t,this.connectToAddressList())}exitIdle(){(this.currentState===ie.ConnectivityState.IDLE||this.triedAllSubchannels)&&this.channelControlHelper.requestReresolution();for(let t of this.subchannels)t.startConnecting();this.currentState===ie.ConnectivityState.IDLE&&this.latestAddressList.length>0&&this.connectToAddressList()}resetBackoff(){}destroy(){if(this.resetSubchannelList(),this.currentPick!==null){let t=this.currentPick;t.unref(),t.removeConnectivityStateListener(this.pickedSubchannelStateListener),this.channelControlHelper.removeChannelzChild(t.getChannelzRef())}}getTypeName(){return ro}};ni.PickFirstLoadBalancer=Wl;function t0(){sy.registerLoadBalancerType(ro,Wl,Ts),sy.registerDefaultLoadBalancerType(ro)}ni.setup=t0});var ay=j(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.setup=As.RoundRobinLoadBalancer=void 0;var r0=kr(),Te=kt(),ql=di(),i0=tr(),s0=Ue(),n0=be(),o0="round_robin";function oy(r){s0.trace(n0.LogVerbosity.DEBUG,o0,r)}var Hl="round_robin",io=class{getLoadBalancerName(){return Hl}constructor(){}toJsonObject(){return{[Hl]:{}}}static createFromJson(t){return new io}},jp=class{constructor(t,i=0){this.subchannelList=t,this.nextIndex=i}pick(t){let i=this.subchannelList[this.nextIndex];return this.nextIndex=(this.nextIndex+1)%this.subchannelList.length,{pickResultType:ql.PickResultType.COMPLETE,subchannel:i,status:null,extraFilterFactories:[],onCallStarted:null}}peekNextSubchannel(){return this.subchannelList[this.nextIndex]}},Vl=class{constructor(t){this.channelControlHelper=t,this.subchannels=[],this.currentState=Te.ConnectivityState.IDLE,this.currentReadyPicker=null,this.subchannelStateCounts={[Te.ConnectivityState.CONNECTING]:0,[Te.ConnectivityState.IDLE]:0,[Te.ConnectivityState.READY]:0,[Te.ConnectivityState.SHUTDOWN]:0,[Te.ConnectivityState.TRANSIENT_FAILURE]:0},this.subchannelStateListener=(i,s,o)=>{this.subchannelStateCounts[s]-=1,this.subchannelStateCounts[o]+=1,this.calculateAndUpdateState(),(o===Te.ConnectivityState.TRANSIENT_FAILURE||o===Te.ConnectivityState.IDLE)&&(this.channelControlHelper.requestReresolution(),i.startConnecting())}}calculateAndUpdateState(){if(this.subchannelStateCounts[Te.ConnectivityState.READY]>0){let t=this.subchannels.filter(s=>s.getConnectivityState()===Te.ConnectivityState.READY),i=0;this.currentReadyPicker!==null&&(i=t.indexOf(this.currentReadyPicker.peekNextSubchannel()),i<0&&(i=0)),this.updateState(Te.ConnectivityState.READY,new jp(t,i))}else this.subchannelStateCounts[Te.ConnectivityState.CONNECTING]>0?this.updateState(Te.ConnectivityState.CONNECTING,new ql.QueuePicker(this)):this.subchannelStateCounts[Te.ConnectivityState.TRANSIENT_FAILURE]>0?this.updateState(Te.ConnectivityState.TRANSIENT_FAILURE,new ql.UnavailablePicker):this.updateState(Te.ConnectivityState.IDLE,new ql.QueuePicker(this))}updateState(t,i){oy(Te.ConnectivityState[this.currentState]+" -> "+Te.ConnectivityState[t]),t===Te.ConnectivityState.READY?this.currentReadyPicker=i:this.currentReadyPicker=null,this.currentState=t,this.channelControlHelper.updateState(t,i)}resetSubchannelList(){for(let t of this.subchannels)t.removeConnectivityStateListener(this.subchannelStateListener),t.unref(),this.channelControlHelper.removeChannelzChild(t.getChannelzRef());this.subchannelStateCounts={[Te.ConnectivityState.CONNECTING]:0,[Te.ConnectivityState.IDLE]:0,[Te.ConnectivityState.READY]:0,[Te.ConnectivityState.SHUTDOWN]:0,[Te.ConnectivityState.TRANSIENT_FAILURE]:0},this.subchannels=[]}updateAddressList(t,i){this.resetSubchannelList(),oy("Connect to address list "+t.map(s=>i0.subchannelAddressToString(s))),this.subchannels=t.map(s=>this.channelControlHelper.createSubchannel(s,{}));for(let s of this.subchannels){s.ref(),s.addConnectivityStateListener(this.subchannelStateListener),this.channelControlHelper.addChannelzChild(s.getChannelzRef());let o=s.getConnectivityState();this.subchannelStateCounts[o]+=1,(o===Te.ConnectivityState.IDLE||o===Te.ConnectivityState.TRANSIENT_FAILURE)&&s.startConnecting()}this.calculateAndUpdateState()}exitIdle(){for(let t of this.subchannels)t.startConnecting()}resetBackoff(){}destroy(){this.resetSubchannelList()}getTypeName(){return Hl}};As.RoundRobinLoadBalancer=Vl;function a0(){r0.registerLoadBalancerType(Hl,Vl,io)}As.setup=a0});var Xl=j(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.experimental=J.StatusBuilder=J.getClientChannel=J.ServerCredentials=J.Server=J.setLogVerbosity=J.setLogger=J.load=J.loadObject=J.CallCredentials=J.ChannelCredentials=J.waitForClientReady=J.closeClient=J.Channel=J.makeGenericClientConstructor=J.makeClientConstructor=J.loadPackageDefinition=J.Client=J.compressionAlgorithms=J.propagate=J.connectivityState=J.status=J.logVerbosity=J.Metadata=J.credentials=void 0;var Gl=Lu();Object.defineProperty(J,"CallCredentials",{enumerable:!0,get:function(){return Gl.CallCredentials}});var l0=Tc();Object.defineProperty(J,"Channel",{enumerable:!0,get:function(){return l0.ChannelImplementation}});var u0=Vg();Object.defineProperty(J,"compressionAlgorithms",{enumerable:!0,get:function(){return u0.CompressionAlgorithms}});var c0=kt();Object.defineProperty(J,"connectivityState",{enumerable:!0,get:function(){return c0.ConnectivityState}});var Yl=Ku();Object.defineProperty(J,"ChannelCredentials",{enumerable:!0,get:function(){return Yl.ChannelCredentials}});var ly=Ec();Object.defineProperty(J,"Client",{enumerable:!0,get:function(){return ly.Client}});var $l=be();Object.defineProperty(J,"logVerbosity",{enumerable:!0,get:function(){return $l.LogVerbosity}});Object.defineProperty(J,"status",{enumerable:!0,get:function(){return $l.Status}});Object.defineProperty(J,"propagate",{enumerable:!0,get:function(){return $l.Propagate}});var Bp=Ue(),Np=Rc();Object.defineProperty(J,"loadPackageDefinition",{enumerable:!0,get:function(){return Np.loadPackageDefinition}});Object.defineProperty(J,"makeClientConstructor",{enumerable:!0,get:function(){return Np.makeClientConstructor}});Object.defineProperty(J,"makeGenericClientConstructor",{enumerable:!0,get:function(){return Np.makeClientConstructor}});var g0=Pt();Object.defineProperty(J,"Metadata",{enumerable:!0,get:function(){return g0.Metadata}});var p0=km();Object.defineProperty(J,"Server",{enumerable:!0,get:function(){return p0.Server}});var d0=sp();Object.defineProperty(J,"ServerCredentials",{enumerable:!0,get:function(){return d0.ServerCredentials}});var h0=Lm();Object.defineProperty(J,"StatusBuilder",{enumerable:!0,get:function(){return h0.StatusBuilder}});J.credentials={combineChannelCredentials:(r,...t)=>t.reduce((i,s)=>i.compose(s),r),combineCallCredentials:(r,...t)=>t.reduce((i,s)=>i.compose(s),r),createInsecure:Yl.ChannelCredentials.createInsecure,createSsl:Yl.ChannelCredentials.createSsl,createFromSecureContext:Yl.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:Gl.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:Gl.CallCredentials.createFromGoogleCredential,createEmpty:Gl.CallCredentials.createEmpty};J.closeClient=r=>r.close();J.waitForClientReady=(r,t,i)=>r.waitForReady(t,i);J.loadObject=(r,t)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};J.load=(r,t,i)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};J.setLogger=r=>{Bp.setLogger(r)};J.setLogVerbosity=r=>{Bp.setLoggerVerbosity(r)};J.getClientChannel=r=>ly.Client.prototype.getChannel.call(r);var Kl=bc();Object.defineProperty(J,"ListenerBuilder",{enumerable:!0,get:function(){return Kl.ListenerBuilder}});Object.defineProperty(J,"RequesterBuilder",{enumerable:!0,get:function(){return Kl.RequesterBuilder}});Object.defineProperty(J,"InterceptingCall",{enumerable:!0,get:function(){return Kl.InterceptingCall}});Object.defineProperty(J,"InterceptorConfigurationError",{enumerable:!0,get:function(){return Kl.InterceptorConfigurationError}});var uy=cs();Object.defineProperty(J,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return uy.getChannelzServiceDefinition}});Object.defineProperty(J,"getChannelzHandlers",{enumerable:!0,get:function(){return uy.getChannelzHandlers}});var f0=Ma();Object.defineProperty(J,"addAdminServicesToServer",{enumerable:!0,get:function(){return f0.addAdminServicesToServer}});var _0=Sp();J.experimental=_0;var m0=Jm(),y0=Zm(),b0=iy(),S0=ny(),v0=ay(),E0=bp(),T0=cs(),A0=Ug().version;Bp.trace($l.LogVerbosity.DEBUG,"index","Loading @grpc/grpc-js version "+A0),m0.setup(),y0.setup(),b0.setup(),S0.setup(),v0.setup(),E0.setup(),T0.setup()});var pr=j((exports,module)=>{var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(r,t,i){r instanceof String&&(r=String(r));for(var s=r.length,o=0;o=o}},"es6","es3");$jscomp.polyfill("Array.prototype.find",function(r){return r||function(t,i){return $jscomp.findInternal(this,t,i).v}},"es6","es3");$jscomp.polyfill("String.prototype.startsWith",function(r){return r||function(t,i){var s=$jscomp.checkStringArgs(this,t,"startsWith");t+="";var o=s.length,l=t.length;i=Math.max(0,Math.min(i|0,s.length));for(var g=0;g=l}},"es6","es3");$jscomp.polyfill("String.prototype.repeat",function(r){return r||function(t){var i=$jscomp.checkStringArgs(this,null,"repeat");if(0>t||1342177279>>=1)&&(i+=i);return s}},"es6","es3");var COMPILED=!0,goog=goog||{};goog.global=exports||self;goog.exportPath_=function(r,t,i){r=r.split("."),i=i||goog.global,r[0]in i||typeof i.execScript=="undefined"||i.execScript("var "+r[0]);for(var s;r.length&&(s=r.shift());)r.length||t===void 0?i=i[s]&&i[s]!==Object.prototype[s]?i[s]:i[s]={}:i[s]=t};goog.define=function(r,t){if(!COMPILED){var i=goog.global.CLOSURE_UNCOMPILED_DEFINES,s=goog.global.CLOSURE_DEFINES;i&&i.nodeType===void 0&&Object.prototype.hasOwnProperty.call(i,r)?t=i[r]:s&&s.nodeType===void 0&&Object.prototype.hasOwnProperty.call(s,r)&&(t=s[r])}return t};goog.FEATURESET_YEAR=2012;goog.DEBUG=!0;goog.LOCALE="en";goog.TRUSTED_SITE=!0;goog.STRICT_MODE_COMPATIBLE=!1;goog.DISALLOW_TEST_ONLY_CODE=COMPILED&&!goog.DEBUG;goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING=!1;goog.provide=function(r){if(goog.isInModuleLoader_())throw Error("goog.provide cannot be used within a module.");if(!COMPILED&&goog.isProvided_(r))throw Error('Namespace "'+r+'" already declared.');goog.constructNamespace_(r)};goog.constructNamespace_=function(r,t){if(!COMPILED){delete goog.implicitNamespaces_[r];for(var i=r;(i=i.substring(0,i.lastIndexOf(".")))&&!goog.getObjectByName(i);)goog.implicitNamespaces_[i]=!0}goog.exportPath_(r,t)};goog.getScriptNonce=function(r){return r&&r!=goog.global?goog.getScriptNonce_(r.document):(goog.cspNonce_===null&&(goog.cspNonce_=goog.getScriptNonce_(goog.global.document)),goog.cspNonce_)};goog.NONCE_PATTERN_=/^[\w+/_-]+[=]{0,2}$/;goog.cspNonce_=null;goog.getScriptNonce_=function(r){return(r=r.querySelector&&r.querySelector("script[nonce]"))&&(r=r.nonce||r.getAttribute("nonce"))&&goog.NONCE_PATTERN_.test(r)?r:""};goog.VALID_MODULE_RE_=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/;goog.module=function(r){if(typeof r!="string"||!r||r.search(goog.VALID_MODULE_RE_)==-1)throw Error("Invalid module identifier");if(!goog.isInGoogModuleLoader_())throw Error("Module "+r+" has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.");if(goog.moduleLoaderState_.moduleName)throw Error("goog.module may only be called once per module.");if(goog.moduleLoaderState_.moduleName=r,!COMPILED){if(goog.isProvided_(r))throw Error('Namespace "'+r+'" already declared.');delete goog.implicitNamespaces_[r]}};goog.module.get=function(r){return goog.module.getInternal_(r)};goog.module.getInternal_=function(r){if(!COMPILED){if(r in goog.loadedModules_)return goog.loadedModules_[r].exports;if(!goog.implicitNamespaces_[r])return r=goog.getObjectByName(r),r!=null?r:null}return null};goog.ModuleType={ES6:"es6",GOOG:"goog"};goog.moduleLoaderState_=null;goog.isInModuleLoader_=function(){return goog.isInGoogModuleLoader_()||goog.isInEs6ModuleLoader_()};goog.isInGoogModuleLoader_=function(){return!!goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.GOOG};goog.isInEs6ModuleLoader_=function(){if(goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.ES6)return!0;var r=goog.global.$jscomp;return r?typeof r.getCurrentModulePath!="function"?!1:!!r.getCurrentModulePath():!1};goog.module.declareLegacyNamespace=function(){if(!COMPILED&&!goog.isInGoogModuleLoader_())throw Error("goog.module.declareLegacyNamespace must be called from within a goog.module");if(!COMPILED&&!goog.moduleLoaderState_.moduleName)throw Error("goog.module must be called prior to goog.module.declareLegacyNamespace.");goog.moduleLoaderState_.declareLegacyNamespace=!0};goog.declareModuleId=function(r){if(!COMPILED){if(!goog.isInEs6ModuleLoader_())throw Error("goog.declareModuleId may only be called from within an ES6 module");if(goog.moduleLoaderState_&&goog.moduleLoaderState_.moduleName)throw Error("goog.declareModuleId may only be called once per module.");if(r in goog.loadedModules_)throw Error('Module with namespace "'+r+'" already exists.')}if(goog.moduleLoaderState_)goog.moduleLoaderState_.moduleName=r;else{var t=goog.global.$jscomp;if(!t||typeof t.getCurrentModulePath!="function")throw Error('Module with namespace "'+r+'" has been loaded incorrectly.');t=t.require(t.getCurrentModulePath()),goog.loadedModules_[r]={exports:t,type:goog.ModuleType.ES6,moduleId:r}}};goog.setTestOnly=function(r){if(goog.DISALLOW_TEST_ONLY_CODE)throw r=r||"",Error("Importing test-only code into non-debug environment"+(r?": "+r:"."))};goog.forwardDeclare=function(r){};COMPILED||(goog.isProvided_=function(r){return r in goog.loadedModules_||!goog.implicitNamespaces_[r]&&goog.getObjectByName(r)!=null},goog.implicitNamespaces_={"goog.module":!0});goog.getObjectByName=function(r,t){r=r.split("."),t=t||goog.global;for(var i=0;i>>0);goog.uidCounter_=0;goog.getHashCode=goog.getUid;goog.removeHashCode=goog.removeUid;goog.cloneObject=function(r){var t=goog.typeOf(r);if(t=="object"||t=="array"){if(typeof r.clone=="function")return r.clone();t=t=="array"?[]:{};for(var i in r)t[i]=goog.cloneObject(r[i]);return t}return r};goog.bindNative_=function(r,t,i){return r.call.apply(r.bind,arguments)};goog.bindJs_=function(r,t,i){if(!r)throw Error();if(2{"use strict";class X{constructor(){if(new.target!=String)throw 1;this.x=42}}let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof String))throw 1;for(const a of[2,3]){if(a==2)continue;function f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()==3}})()')}),a("es7",function(){return b("2 ** 2 == 4")}),a("es8",function(){return b("async () => 1, true")}),a("es9",function(){return b("({...rest} = {}), true")}),a("es_next",function(){return!1}),{target:c,map:d}},goog.Transpiler.prototype.needsTranspile=function(r,t){if(goog.TRANSPILE=="always")return!0;if(goog.TRANSPILE=="never")return!1;if(!this.requiresTranspilation_){var i=this.createRequiresTranspilation_();this.requiresTranspilation_=i.map,this.transpilationTarget_=this.transpilationTarget_||i.target}if(r in this.requiresTranspilation_)return this.requiresTranspilation_[r]?!0:!(!goog.inHtmlDocument_()||t!="es6"||"noModule"in goog.global.document.createElement("script"));throw Error("Unknown language mode: "+r)},goog.Transpiler.prototype.transpile=function(r,t){return goog.transpile_(r,t,this.transpilationTarget_)},goog.transpiler_=new goog.Transpiler,goog.protectScriptTag_=function(r){return r.replace(/<\/(SCRIPT)/ig,"\\x3c/$1")},goog.DebugLoader_=function(){this.dependencies_={},this.idToPath_={},this.written_={},this.loadingDeps_=[],this.depsToLoad_=[],this.paused_=!1,this.factory_=new goog.DependencyFactory(goog.transpiler_),this.deferredCallbacks_={},this.deferredQueue_=[]},goog.DebugLoader_.prototype.bootstrap=function(r,t){function i(){s&&(goog.global.setTimeout(s,0),s=null)}var s=t;if(r.length){t=[];for(var o=0;o<\/script>",t.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(s):s)}else{var o=t.createElement("script");o.defer=goog.Dependency.defer_,o.async=!1,o.type="text/javascript",(s=goog.getScriptNonce())&&o.setAttribute("nonce",s),goog.DebugLoader_.IS_OLD_IE_?(r.pause(),o.onreadystatechange=function(){(o.readyState=="loaded"||o.readyState=="complete")&&(r.loaded(),r.resume())}):o.onload=function(){o.onload=null,r.loaded()},o.src=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScriptURL(this.path):this.path,t.head.appendChild(o)}}else goog.logToConsole_("Cannot use default debug loader outside of HTML documents."),this.relativePath=="deps.js"?(goog.logToConsole_("Consider setting CLOSURE_IMPORT_SCRIPT before loading base.js, or setting CLOSURE_NO_DEPS to true."),r.loaded()):r.pause()},goog.Es6ModuleDependency=function(r,t,i,s,o){goog.Dependency.call(this,r,t,i,s,o)},goog.inherits(goog.Es6ModuleDependency,goog.Dependency),goog.Es6ModuleDependency.prototype.load=function(r){function t(m,S){m=S?'