@hzhangxyz/ddss 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +1 -1
  2. package/package.json +2 -2
package/dist/main.js CHANGED
@@ -55,4 +55,4 @@ var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array(
55
55
  * limitations under the License.
56
56
  *
57
57
  */
58
- Object.defineProperty(e,"__esModule",{value:!0}),e.loadFileDescriptorSetFromObject=e.loadFileDescriptorSetFromBuffer=e.fromJSON=e.loadSync=e.load=e.IdempotencyLevel=e.isAnyExtension=e.Long=void 0;const t=requireLodash_camelcase(),r=requireProtobufjs(),n=requireDescriptor(),i=requireUtil(),s=requireUmd();var a;e.Long=s,e.isAnyExtension=function(e){return"@type"in e&&"string"==typeof e["@type"]},function(e){e.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",e.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",e.IDEMPOTENT="IDEMPOTENT"}(a=e.IdempotencyLevel||(e.IdempotencyLevel={}));const o={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function l(e,t){const n=(i=t,s=e.name,""===i?s:i+"."+s);var i,s;return function(e){return e instanceof r.Service||e instanceof r.Type||e instanceof r.Enum}(e)?[[n,e]]:function(e){return e instanceof r.Namespace||e instanceof r.Root}(e)&&void 0!==e.nested?Object.keys(e.nested).map(t=>l(e.nested[t],n)).reduce((e,t)=>e.concat(t),[]):[]}function c(e,t){return function(r){return e.toObject(e.decode(r),t)}}function u(e){return function(t){if(Array.isArray(t))throw new Error(`Failed to serialize message: expected object with ${e.name} structure, got array instead`);const r=e.fromObject(t);return e.encode(r).finish()}}function h(e){return(e||[]).reduce((e,t)=>{for(const[r,n]of Object.entries(t))if("uninterpreted_option"===r)e.uninterpreted_option.push(t.uninterpreted_option);else e[r]=n;return e},{deprecated:!1,idempotency_level:a.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function d(e,r,n,i){const s=e.resolvedRequestType,a=e.resolvedResponseType;return{path:"/"+r+"/"+e.name,requestStream:!!e.requestStream,responseStream:!!e.responseStream,requestSerialize:u(s),requestDeserialize:c(s,n),responseSerialize:u(a),responseDeserialize:c(a,n),originalName:t(e.name),requestType:p(s,n,i),responseType:p(a,n,i),options:h(e.parsedOptions)}}function p(e,t,r){const n=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:n.$type.toObject(n,o),fileDescriptorProtos:r,serialize:u(e),deserialize:c(e,t)}}function f(e,t,n,i){if(e instanceof r.Service)return function(e,t,r,n){const i={};for(const s of e.methodsArray)i[s.name]=d(s,t,r,n);return i}(e,t,n,i);if(e instanceof r.Type)return p(e,n,i);if(e instanceof r.Enum)return function(e,t){const r=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:r.$type.toObject(r,o),fileDescriptorProtos:t}}(e,i);throw new Error("Type mismatch in reflection object handling")}function g(e,t){const r={};e.resolveAll();const i=e.toDescriptor("proto3").file.map(e=>Buffer.from(n.FileDescriptorProto.encode(e).finish()));for(const[n,s]of l(e,""))r[n]=f(s,n,t,i);return r}function v(e,t){t=t||{};const n=r.Root.fromDescriptor(e);return n.resolveAll(),g(n,t)}e.load=function(e,t){return(0,i.loadProtosWithOptions)(e,t).then(e=>g(e,t))},e.loadSync=function(e,t){return g((0,i.loadProtosWithOptionsSync)(e,t),t)},e.fromJSON=function(e,t){t=t||{};const n=r.Root.fromJSON(e);return n.resolveAll(),g(n,t)},e.loadFileDescriptorSetFromBuffer=function(e,t){return v(n.FileDescriptorSet.decode(e),t)},e.loadFileDescriptorSetFromObject=function(e,t){return v(n.FileDescriptorSet.fromObject(e),t)},(0,i.addCommonProtos)()}(src$1)),src$1}function requireChannelz(){if(hasRequiredChannelz)return channelz;hasRequiredChannelz=1,Object.defineProperty(channelz,"__esModule",{value:!0}),channelz.registerChannelzSocket=channelz.registerChannelzServer=channelz.registerChannelzSubchannel=channelz.registerChannelzChannel=channelz.ChannelzCallTrackerStub=channelz.ChannelzCallTracker=channelz.ChannelzChildrenTrackerStub=channelz.ChannelzChildrenTracker=channelz.ChannelzTrace=channelz.ChannelzTraceStub=void 0,channelz.unregisterChannelzRef=function(e){p[e.kind].eraseElementByKey(e.id)},channelz.getChannelzHandlers=N,channelz.getChannelzServiceDefinition=O,channelz.setup=function(){(0,s.registerAdminService)(O,N)};const e=require$$0$3,t=require$$1,r=requireConnectivityState(),n=requireConstants(),i=requireSubchannelAddress(),s=requireAdmin(),a=requireMakeClient();function o(e){return{channel_id:e.id,name:e.name}}function l(e){return{subchannel_id:e.id,name:e.name}}function c(e){return{socket_id:e.id,name:e.name}}const u=100;channelz.ChannelzTraceStub=class{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:y(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}};channelz.ChannelzTrace=class{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(e,t,r){const n=new Date;this.events.push({description:t,severity:e,timestamp:n,childChannel:"channel"===(null==r?void 0:r.kind)?r:void 0,childSubchannel:"subchannel"===(null==r?void 0:r.kind)?r:void 0}),this.events.length>=64&&(this.events=this.events.slice(32)),this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:y(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map(e=>({description:e.description,severity:e.severity,timestamp:y(e.timestamp),channel_ref:e.childChannel?o(e.childChannel):null,subchannel_ref:e.childSubchannel?l(e.childSubchannel):null}))}}};class h{constructor(){this.channelChildren=new t.OrderedMap,this.subchannelChildren=new t.OrderedMap,this.socketChildren=new t.OrderedMap,this.trackerMap={channel:this.channelChildren,subchannel:this.subchannelChildren,socket:this.socketChildren}}refChild(e){const t=this.trackerMap[e.kind],r=t.find(e.id);r.equals(t.end())?t.setElement(e.id,{ref:e,count:1},r):r.pointer[1].count+=1}unrefChild(e){const t=this.trackerMap[e.kind],r=t.getElementByKey(e.id);void 0!==r&&(r.count-=1,0===r.count&&t.eraseElementByKey(e.id))}getChildLists(){return{channels:this.channelChildren,subchannels:this.subchannelChildren,sockets:this.socketChildren}}}channelz.ChannelzChildrenTracker=h;channelz.ChannelzChildrenTrackerStub=class extends h{refChild(){}unrefChild(){}};class d{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}}channelz.ChannelzCallTracker=d;channelz.ChannelzCallTrackerStub=class extends d{addCallStarted(){}addCallSucceeded(){}addCallFailed(){}};const p={channel:new t.OrderedMap,subchannel:new t.OrderedMap,server:new t.OrderedMap,socket:new t.OrderedMap},f=e=>{let t=1;const r=p[e];return(n,i,s)=>{const a=t++,o={id:a,name:n,kind:e};return s&&r.setElement(a,{ref:o,getInfo:i}),o}};function g(e){if(""===e)return[];const t=e.split(":").map(e=>function(e){const t=Number.parseInt(e,16);return[t/256|0,t%256]}(e));return[].concat(...t)}function v(e){return Buffer.from(Uint8Array.from(e.split(".").map(e=>Number.parseInt(e))))}function m(t){if((0,e.isIPv4)(t))return v(t);if(function(t){return(0,e.isIPv6)(t)&&t.toLowerCase().startsWith("::ffff:")&&(0,e.isIPv4)(t.substring(7))}(t))return v(t.substring(7));if((0,e.isIPv6)(t)){let e,r;const n=t.indexOf("::");-1===n?(e=t,r=""):(e=t.substring(0,n),r=t.substring(n+2));const i=Buffer.from(g(e)),s=Buffer.from(g(r)),a=Buffer.alloc(16-i.length-s.length,0);return Buffer.concat([i,a,s])}return null}function A(e){switch(e){case r.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case r.ConnectivityState.IDLE:return{state:"IDLE"};case r.ConnectivityState.READY:return{state:"READY"};case r.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case r.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function y(e){if(!e)return null;const t=e.getTime();return{seconds:t/1e3|0,nanos:t%1e3*1e6}}function C(e){const t=e.getInfo(),r=[],n=[];return t.children.channels.forEach(e=>{r.push(o(e[1].ref))}),t.children.subchannels.forEach(e=>{n.push(l(e[1].ref))}),{ref:o(e.ref),data:{target:t.target,state:A(t.state),calls_started:t.callTracker.callsStarted,calls_succeeded:t.callTracker.callsSucceeded,calls_failed:t.callTracker.callsFailed,last_call_started_timestamp:y(t.callTracker.lastCallStartedTimestamp),trace:t.trace.getTraceMessage()},channel_ref:r,subchannel_ref:n}}function S(e,t){const r=parseInt(e.request.channel_id,10),i=p.channel.getElementByKey(r);void 0!==i?t(null,{channel:C(i)}):t({code:n.Status.NOT_FOUND,details:"No channel data found for id "+r})}function E(e,t){const r=parseInt(e.request.max_results,10)||u,n=[],i=parseInt(e.request.start_channel_id,10),s=p.channel;let a;for(a=s.lowerBound(i);!a.equals(s.end())&&n.length<r;a=a.next())n.push(C(a.pointer[1]));t(null,{channel:n,end:a.equals(s.end())})}function _(e){const t=e.getInfo(),r=[];return t.listenerChildren.sockets.forEach(e=>{r.push(c(e[1].ref))}),{ref:(n=e.ref,{server_id:n.id}),data:{calls_started:t.callTracker.callsStarted,calls_succeeded:t.callTracker.callsSucceeded,calls_failed:t.callTracker.callsFailed,last_call_started_timestamp:y(t.callTracker.lastCallStartedTimestamp),trace:t.trace.getTraceMessage()},listen_socket:r};var n}function b(e,t){const r=parseInt(e.request.server_id,10),i=p.server.getElementByKey(r);void 0!==i?t(null,{server:_(i)}):t({code:n.Status.NOT_FOUND,details:"No server data found for id "+r})}function T(e,t){const r=parseInt(e.request.max_results,10)||u,n=parseInt(e.request.start_server_id,10),i=p.server,s=[];let a;for(a=i.lowerBound(n);!a.equals(i.end())&&s.length<r;a=a.next())s.push(_(a.pointer[1]));t(null,{server:s,end:a.equals(i.end())})}function R(e,t){const r=parseInt(e.request.subchannel_id,10),i=p.subchannel.getElementByKey(r);if(void 0===i)return void t({code:n.Status.NOT_FOUND,details:"No subchannel data found for id "+r});const s=i.getInfo(),a=[];s.children.sockets.forEach(e=>{a.push(c(e[1].ref))});t(null,{subchannel:{ref:l(i.ref),data:{target:s.target,state:A(s.state),calls_started:s.callTracker.callsStarted,calls_succeeded:s.callTracker.callsSucceeded,calls_failed:s.callTracker.callsFailed,last_call_started_timestamp:y(s.callTracker.lastCallStartedTimestamp),trace:s.trace.getTraceMessage()},socket_ref:a}})}function x(e){var t;return(0,i.isTcpSubchannelAddress)(e)?{address:"tcpip_address",tcpip_address:{ip_address:null!==(t=m(e.host))&&void 0!==t?t:void 0,port:e.port}}:{address:"uds_address",uds_address:{filename:e.path}}}function w(e,t){var r,i,s,a,o;const l=parseInt(e.request.socket_id,10),u=p.socket.getElementByKey(l);if(void 0===u)return void t({code:n.Status.NOT_FOUND,details:"No socket data found for id "+l});const h=u.getInfo(),d=h.security?{model:"tls",tls:{cipher_suite:h.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:null!==(r=h.security.cipherSuiteStandardName)&&void 0!==r?r:void 0,other_name:null!==(i=h.security.cipherSuiteOtherName)&&void 0!==i?i:void 0,local_certificate:null!==(s=h.security.localCertificate)&&void 0!==s?s:void 0,remote_certificate:null!==(a=h.security.remoteCertificate)&&void 0!==a?a:void 0}}:null;t(null,{socket:{ref:c(u.ref),local:h.localAddress?x(h.localAddress):null,remote:h.remoteAddress?x(h.remoteAddress):null,remote_name:null!==(o=h.remoteName)&&void 0!==o?o:void 0,security:d,data:{keep_alives_sent:h.keepAlivesSent,streams_started:h.streamsStarted,streams_succeeded:h.streamsSucceeded,streams_failed:h.streamsFailed,last_local_stream_created_timestamp:y(h.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:y(h.lastRemoteStreamCreatedTimestamp),messages_received:h.messagesReceived,messages_sent:h.messagesSent,last_message_received_timestamp:y(h.lastMessageReceivedTimestamp),last_message_sent_timestamp:y(h.lastMessageSentTimestamp),local_flow_control_window:h.localFlowControlWindow?{value:h.localFlowControlWindow}:null,remote_flow_control_window:h.remoteFlowControlWindow?{value:h.remoteFlowControlWindow}:null}}})}function k(e,t){const r=parseInt(e.request.server_id,10),i=p.server.getElementByKey(r);if(void 0===i)return void t({code:n.Status.NOT_FOUND,details:"No server data found for id "+r});const s=parseInt(e.request.start_socket_id,10),a=parseInt(e.request.max_results,10)||u,o=i.getInfo().sessionChildren.sockets,l=[];let h;for(h=o.lowerBound(s);!h.equals(o.end())&&l.length<a;h=h.next())l.push(c(h.pointer[1].ref));t(null,{socket_ref:l,end:h.equals(o.end())})}function N(){return{GetChannel:S,GetTopChannels:E,GetServer:b,GetServers:T,GetSubchannel:R,GetSocket:w,GetServerSockets:k}}channelz.registerChannelzChannel=f("channel"),channelz.registerChannelzSubchannel=f("subchannel"),channelz.registerChannelzServer=f("server"),channelz.registerChannelzSocket=f("socket");let I=null;function O(){if(I)return I;const e=(0,requireSrc$1().loadSync)("channelz.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto`]}),t=(0,a.loadPackageDefinition)(e);return I=t.grpc.channelz.v1.Channelz.service,I}return channelz}var singleSubchannelChannel={},callNumber={},hasRequiredCallNumber;function requireCallNumber(){if(hasRequiredCallNumber)return callNumber;hasRequiredCallNumber=1,Object.defineProperty(callNumber,"__esModule",{value:!0}),callNumber.getNextCallNumber=function(){return e++};let e=0;return callNumber}var compressionFilter={},compressionAlgorithms={},hasRequiredCompressionAlgorithms;function requireCompressionAlgorithms(){return hasRequiredCompressionAlgorithms||(hasRequiredCompressionAlgorithms=1,Object.defineProperty(compressionAlgorithms,"__esModule",{value:!0}),compressionAlgorithms.CompressionAlgorithms=void 0,function(e){e[e.identity=0]="identity",e[e.deflate=1]="deflate",e[e.gzip=2]="gzip"}(e||(compressionAlgorithms.CompressionAlgorithms=e={}))),compressionAlgorithms;var e}var filter={},hasRequiredFilter,hasRequiredCompressionFilter;function requireFilter(){if(hasRequiredFilter)return filter;hasRequiredFilter=1,Object.defineProperty(filter,"__esModule",{value:!0}),filter.BaseFilter=void 0;return filter.BaseFilter=class{async sendMetadata(e){return e}receiveMetadata(e){return e}async sendMessage(e){return e}async receiveMessage(e){return e}receiveTrailers(e){return e}},filter}function requireCompressionFilter(){if(hasRequiredCompressionFilter)return compressionFilter;hasRequiredCompressionFilter=1,Object.defineProperty(compressionFilter,"__esModule",{value:!0}),compressionFilter.CompressionFilterFactory=compressionFilter.CompressionFilter=void 0;const e=require$$0$5,t=requireCompressionAlgorithms(),r=requireConstants(),n=requireFilter(),i=requireLogging();class s{async writeMessage(e,t){let r=e;t&&(r=await this.compressMessage(r));const n=Buffer.allocUnsafe(r.length+5);return n.writeUInt8(t?1:0,0),n.writeUInt32BE(r.length,1),r.copy(n,5),n}async readMessage(e){const t=1===e.readUInt8(0);let r=e.slice(5);return t&&(r=await this.decompressMessage(r)),r}}class a extends s{async compressMessage(e){return e}async writeMessage(e,t){const r=Buffer.allocUnsafe(e.length+5);return r.writeUInt8(0,0),r.writeUInt32BE(e.length,1),e.copy(r,5),r}decompressMessage(e){return Promise.reject(new Error('Received compressed message but "grpc-encoding" header was identity'))}}class o extends s{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(t){return new Promise((r,n)=>{e.deflate(t,(e,t)=>{e?n(e):r(t)})})}decompressMessage(t){return new Promise((n,i)=>{let s=0;const a=[],o=e.createInflate();o.on("data",e=>{a.push(e),s+=e.byteLength,-1!==this.maxRecvMessageLength&&s>this.maxRecvMessageLength&&(o.destroy(),i({code:r.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),o.on("end",()=>{n(Buffer.concat(a))}),o.write(t),o.end()})}}class l extends s{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(t){return new Promise((r,n)=>{e.gzip(t,(e,t)=>{e?n(e):r(t)})})}decompressMessage(t){return new Promise((n,i)=>{let s=0;const a=[],o=e.createGunzip();o.on("data",e=>{a.push(e),s+=e.byteLength,-1!==this.maxRecvMessageLength&&s>this.maxRecvMessageLength&&(o.destroy(),i({code:r.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),o.on("end",()=>{n(Buffer.concat(a))}),o.write(t),o.end()})}}class c extends s{constructor(e){super(),this.compressionName=e}compressMessage(e){return Promise.reject(new Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(e){return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`))}}function u(e,t){switch(e){case"identity":return new a;case"deflate":return new o(t);case"gzip":return new l(t);default:return new c(e)}}class h extends n.BaseFilter{constructor(e,n){var s,o,l;super(),this.sharedFilterConfig=n,this.sendCompression=new a,this.receiveCompression=new a,this.currentCompressionAlgorithm="identity";const c=e["grpc.default_compression_algorithm"];if(this.maxReceiveMessageLength=null!==(s=e["grpc.max_receive_message_length"])&&void 0!==s?s:r.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.maxSendMessageLength=null!==(o=e["grpc.max_send_message_length"])&&void 0!==o?o:r.DEFAULT_MAX_SEND_MESSAGE_LENGTH,void 0!==c)if("number"==typeof(h=c)&&"string"==typeof t.CompressionAlgorithms[h]){const e=t.CompressionAlgorithms[c],r=null===(l=n.serverSupportedEncodingHeader)||void 0===l?void 0:l.split(",");r&&!r.includes(e)||(this.currentCompressionAlgorithm=e,this.sendCompression=u(this.currentCompressionAlgorithm,-1))}else i.log(r.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${c}`);var h}async sendMetadata(e){const t=await e;return t.set("grpc-accept-encoding","identity,deflate,gzip"),t.set("accept-encoding","identity"),"identity"===this.currentCompressionAlgorithm?t.remove("grpc-encoding"):t.set("grpc-encoding",this.currentCompressionAlgorithm),t}receiveMetadata(e){const t=e.get("grpc-encoding");if(t.length>0){const e=t[0];"string"==typeof e&&(this.receiveCompression=u(e,this.maxReceiveMessageLength))}e.remove("grpc-encoding");const r=e.get("grpc-accept-encoding")[0];if(r){this.sharedFilterConfig.serverSupportedEncodingHeader=r;r.split(",").includes(this.currentCompressionAlgorithm)||(this.sendCompression=new a,this.currentCompressionAlgorithm="identity")}return e.remove("grpc-accept-encoding"),e}async sendMessage(e){var t;const n=await e;if(-1!==this.maxSendMessageLength&&n.message.length>this.maxSendMessageLength)throw{code:r.Status.RESOURCE_EXHAUSTED,details:`Attempted to send message with a size larger than ${this.maxSendMessageLength}`};let i;return i=!(this.sendCompression instanceof a)&&!(2&(null!==(t=n.flags)&&void 0!==t?t:0)),{message:await this.sendCompression.writeMessage(n.message,i),flags:n.flags}}async receiveMessage(e){return this.receiveCompression.readMessage(await e)}}compressionFilter.CompressionFilter=h;return compressionFilter.CompressionFilterFactory=class{constructor(e,t){this.options=t,this.sharedFilterConfig={}}createFilter(){return new h(this.options,this.sharedFilterConfig)}},compressionFilter}var controlPlaneStatus={},hasRequiredControlPlaneStatus;function requireControlPlaneStatus(){if(hasRequiredControlPlaneStatus)return controlPlaneStatus;hasRequiredControlPlaneStatus=1,Object.defineProperty(controlPlaneStatus,"__esModule",{value:!0}),controlPlaneStatus.restrictControlPlaneStatusCode=function(r,n){return t.includes(r)?{code:e.Status.INTERNAL,details:`Invalid status from control plane: ${r} ${e.Status[r]} ${n}`}:{code:r,details:n}};const e=requireConstants(),t=[e.Status.OK,e.Status.INVALID_ARGUMENT,e.Status.NOT_FOUND,e.Status.ALREADY_EXISTS,e.Status.FAILED_PRECONDITION,e.Status.ABORTED,e.Status.OUT_OF_RANGE,e.Status.DATA_LOSS];return controlPlaneStatus}var deadline={},hasRequiredDeadline;function requireDeadline(){if(hasRequiredDeadline)return deadline;hasRequiredDeadline=1,Object.defineProperty(deadline,"__esModule",{value:!0}),deadline.minDeadline=function(...e){let t=1/0;for(const r of e){const e=r instanceof Date?r.getTime():r;e<t&&(t=e)}return t},deadline.getDeadlineTimeoutString=function(t){const r=(new Date).getTime();t instanceof Date&&(t=t.getTime());const n=Math.max(t-r,0);for(const[t,r]of e){const e=n/r;if(e<1e8)return String(Math.ceil(e))+t}throw new Error("Deadline is too far in the future")},deadline.getRelativeTimeout=function(e){const r=e instanceof Date?e.getTime():e,n=(new Date).getTime(),i=r-n;return i<0?0:i>t?1/0:i},deadline.deadlineToString=function(e){if(e instanceof Date)return e.toISOString();{const t=new Date(e);return Number.isNaN(t.getTime())?""+e:t.toISOString()}},deadline.formatDateDifference=function(e,t){return((t.getTime()-e.getTime())/1e3).toFixed(3)+"s"};const e=[["m",1],["S",1e3],["M",6e4],["H",36e5]];const t=2147483647;return deadline}var filterStack={},hasRequiredFilterStack,hasRequiredSingleSubchannelChannel,hasRequiredSubchannel;function requireFilterStack(){if(hasRequiredFilterStack)return filterStack;hasRequiredFilterStack=1,Object.defineProperty(filterStack,"__esModule",{value:!0}),filterStack.FilterStackFactory=filterStack.FilterStack=void 0;class e{constructor(e){this.filters=e}sendMetadata(e){let t=e;for(let e=0;e<this.filters.length;e++)t=this.filters[e].sendMetadata(t);return t}receiveMetadata(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveMetadata(t);return t}sendMessage(e){let t=e;for(let e=0;e<this.filters.length;e++)t=this.filters[e].sendMessage(t);return t}receiveMessage(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveMessage(t);return t}receiveTrailers(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveTrailers(t);return t}push(e){this.filters.unshift(...e)}getFilters(){return this.filters}}filterStack.FilterStack=e;class t{constructor(e){this.factories=e}push(e){this.factories.unshift(...e)}clone(){return new t([...this.factories])}createFilter(){return new e(this.factories.map(e=>e.createFilter()))}}return filterStack.FilterStackFactory=t,filterStack}function requireSingleSubchannelChannel(){if(hasRequiredSingleSubchannelChannel)return singleSubchannelChannel;hasRequiredSingleSubchannelChannel=1,Object.defineProperty(singleSubchannelChannel,"__esModule",{value:!0}),singleSubchannelChannel.SingleSubchannelChannel=void 0;const e=requireCallNumber(),t=requireChannelz(),r=requireCompressionFilter(),n=requireConnectivityState(),i=requireConstants(),s=requireControlPlaneStatus(),a=requireDeadline(),o=requireFilterStack(),l=requireMetadata(),c=requireResolver(),u=requireUriParser();class h{constructor(e,t,r,n,s){var o,l;this.subchannel=e,this.method=t,this.options=n,this.callNumber=s,this.childCall=null,this.pendingMessage=null,this.readPending=!1,this.halfClosePending=!1,this.pendingStatus=null,this.readFilterPending=!1,this.writeFilterPending=!1;const c=this.method.split("/");let h="";c.length>=2&&(h=c[1]);const d=null!==(l=null===(o=(0,u.splitHostPort)(this.options.host))||void 0===o?void 0:o.host)&&void 0!==l?l:"localhost";this.serviceUrl=`https://${d}/${h}`;const p=(0,a.getRelativeTimeout)(n.deadline);p!==1/0&&(p<=0?this.cancelWithStatus(i.Status.DEADLINE_EXCEEDED,"Deadline exceeded"):setTimeout(()=>{this.cancelWithStatus(i.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},p)),this.filterStack=r.createFilter()}cancelWithStatus(e,t){this.childCall?this.childCall.cancelWithStatus(e,t):this.pendingStatus={code:e,details:t,metadata:new l.Metadata}}getPeer(){var e,t;return null!==(t=null===(e=this.childCall)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.subchannel.getAddress()}async start(e,t){if(this.pendingStatus)return void t.onReceiveStatus(this.pendingStatus);if(this.subchannel.getConnectivityState()!==n.ConnectivityState.READY)return void t.onReceiveStatus({code:i.Status.UNAVAILABLE,details:"Subchannel not ready",metadata:new l.Metadata});const r=await this.filterStack.sendMetadata(Promise.resolve(e));let a;try{a=await this.subchannel.getCallCredentials().generateMetadata({method_name:this.method,service_url:this.serviceUrl})}catch(e){const r=e,{code:n,details:a}=(0,s.restrictControlPlaneStatusCode)("number"==typeof r.code?r.code:i.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${r.message}`);return void t.onReceiveStatus({code:n,details:a,metadata:new l.Metadata})}a.merge(r);const o={onReceiveMetadata:async e=>{t.onReceiveMetadata(await this.filterStack.receiveMetadata(e))},onReceiveMessage:async e=>{this.readFilterPending=!0;const r=await this.filterStack.receiveMessage(e);this.readFilterPending=!1,t.onReceiveMessage(r),this.pendingStatus&&t.onReceiveStatus(this.pendingStatus)},onReceiveStatus:async e=>{const r=await this.filterStack.receiveTrailers(e);this.readFilterPending?this.pendingStatus=r:t.onReceiveStatus(r)}};this.childCall=this.subchannel.createCall(a,this.options.host,this.method,o),this.readPending&&this.childCall.startRead(),this.pendingMessage&&this.childCall.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.halfClosePending&&!this.writeFilterPending&&this.childCall.halfClose()}async sendMessageWithContext(e,t){this.writeFilterPending=!0;const r=await this.filterStack.sendMessage(Promise.resolve({message:t,flags:e.flags}));this.writeFilterPending=!1,this.childCall?(this.childCall.sendMessageWithContext(e,r.message),this.halfClosePending&&this.childCall.halfClose()):this.pendingMessage={context:e,message:r.message}}startRead(){this.childCall?this.childCall.startRead():this.readPending=!0}halfClose(){this.childCall&&!this.writeFilterPending?this.childCall.halfClose():this.halfClosePending=!0}getCallNumber(){return this.callNumber}setCredentials(e){throw new Error("Method not implemented.")}getAuthContext(){return this.childCall?this.childCall.getAuthContext():null}}return singleSubchannelChannel.SingleSubchannelChannel=class{constructor(e,n,i){this.subchannel=e,this.target=n,this.channelzEnabled=!1,this.channelzTrace=new t.ChannelzTrace,this.callTracker=new t.ChannelzCallTracker,this.childrenTracker=new t.ChannelzChildrenTracker,this.channelzEnabled=0!==i["grpc.enable_channelz"],this.channelzRef=(0,t.registerChannelzChannel)((0,u.uriToString)(n),()=>({target:`${(0,u.uriToString)(n)} (${e.getAddress()})`,state:this.subchannel.getConnectivityState(),trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}),this.channelzEnabled),this.channelzEnabled&&this.childrenTracker.refChild(e.getChannelzRef()),this.filterStackFactory=new o.FilterStackFactory([new r.CompressionFilterFactory(this,i)])}close(){this.channelzEnabled&&this.childrenTracker.unrefChild(this.subchannel.getChannelzRef()),(0,t.unregisterChannelzRef)(this.channelzRef)}getTarget(){return(0,u.uriToString)(this.target)}getConnectivityState(e){throw new Error("Method not implemented.")}watchConnectivityState(e,t,r){throw new Error("Method not implemented.")}getChannelzRef(){return this.channelzRef}createCall(t,r){const n={deadline:r,host:(0,c.getDefaultAuthority)(this.target),flags:i.Propagate.DEFAULTS,parentCall:null};return new h(this.subchannel,t,this.filterStackFactory,n,(0,e.getNextCallNumber)())}},singleSubchannelChannel}function requireSubchannel(){if(hasRequiredSubchannel)return subchannel;hasRequiredSubchannel=1,Object.defineProperty(subchannel,"__esModule",{value:!0}),subchannel.Subchannel=void 0;const e=requireConnectivityState(),t=requireBackoffTimeout(),r=requireLogging(),n=requireConstants(),i=requireUriParser(),s=requireSubchannelAddress(),a=requireChannelz(),o=requireSingleSubchannelChannel();return subchannel.Subchannel=class{constructor(r,n,i,o,l){var c;this.channelTarget=r,this.subchannelAddress=n,this.options=i,this.connector=l,this.connectivityState=e.ConnectivityState.IDLE,this.transport=null,this.continueConnecting=!1,this.stateListeners=new Set,this.refcount=0,this.channelzEnabled=!0,this.dataProducers=new Map,this.subchannelChannel=null;const u={initialDelay:i["grpc.initial_reconnect_backoff_ms"],maxDelay:i["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new t.BackoffTimeout(()=>{this.handleBackoffTimer()},u),this.backoffTimeout.unref(),this.subchannelAddressString=(0,s.subchannelAddressToString)(n),this.keepaliveTime=null!==(c=i["grpc.keepalive_time_ms"])&&void 0!==c?c:-1,0===i["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.channelzTrace=new a.ChannelzTraceStub,this.callTracker=new a.ChannelzCallTrackerStub,this.childrenTracker=new a.ChannelzChildrenTrackerStub,this.streamTracker=new a.ChannelzCallTrackerStub):(this.channelzTrace=new a.ChannelzTrace,this.callTracker=new a.ChannelzCallTracker,this.childrenTracker=new a.ChannelzChildrenTracker,this.streamTracker=new a.ChannelzCallTracker),this.channelzRef=(0,a.registerChannelzSubchannel)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.trace("Subchannel constructed with options "+JSON.stringify(i,void 0,2)),this.secureConnector=o._createSecureConnector(r,i)}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}trace(e){r.trace(n.LogVerbosity.DEBUG,"subchannel","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}refTrace(e){r.trace(n.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}handleBackoffTimer(){this.continueConnecting?this.transitionToState([e.ConnectivityState.TRANSIENT_FAILURE],e.ConnectivityState.CONNECTING):this.transitionToState([e.ConnectivityState.TRANSIENT_FAILURE],e.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}startConnectingInternal(){let t=this.options;if(t["grpc.keepalive_time_ms"]){const e=Math.min(this.keepaliveTime,2147483647);t=Object.assign(Object.assign({},t),{"grpc.keepalive_time_ms":e})}this.connector.connect(this.subchannelAddress,this.secureConnector,t).then(t=>{this.transitionToState([e.ConnectivityState.CONNECTING],e.ConnectivityState.READY)?(this.transport=t,this.channelzEnabled&&this.childrenTracker.refChild(t.getChannelzRef()),t.addDisconnectListener(t=>{this.transitionToState([e.ConnectivityState.READY],e.ConnectivityState.IDLE),t&&this.keepaliveTime>0&&(this.keepaliveTime*=2,r.log(n.LogVerbosity.ERROR,`Connection to ${(0,i.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`))})):t.shutdown()},t=>{this.transitionToState([e.ConnectivityState.CONNECTING],e.ConnectivityState.TRANSIENT_FAILURE,`${t}`)})}transitionToState(t,r,n){var i,s;if(-1===t.indexOf(this.connectivityState))return!1;n?this.trace(e.ConnectivityState[this.connectivityState]+" -> "+e.ConnectivityState[r]+' with error "'+n+'"'):this.trace(e.ConnectivityState[this.connectivityState]+" -> "+e.ConnectivityState[r]),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+e.ConnectivityState[r]);const a=this.connectivityState;switch(this.connectivityState=r,r){case e.ConnectivityState.READY:this.stopBackoff();break;case e.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case e.ConnectivityState.TRANSIENT_FAILURE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),null===(i=this.transport)||void 0===i||i.shutdown(),this.transport=null,this.backoffTimeout.isRunning()||process.nextTick(()=>{this.handleBackoffTimer()});break;case e.ConnectivityState.IDLE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),null===(s=this.transport)||void 0===s||s.shutdown(),this.transport=null;break;default:throw new Error(`Invalid state: unknown ConnectivityState ${r}`)}for(const e of this.stateListeners)e(this,a,r,this.keepaliveTime,n);return!0}ref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,0===this.refcount&&(this.channelzTrace.addTrace("CT_INFO","Shutting down"),(0,a.unregisterChannelzRef)(this.channelzRef),this.secureConnector.destroy(),process.nextTick(()=>{this.transitionToState([e.ConnectivityState.CONNECTING,e.ConnectivityState.READY],e.ConnectivityState.IDLE)}))}unrefIfOneRef(){return 1===this.refcount&&(this.unref(),!0)}createCall(e,t,r,i){if(!this.transport)throw new Error("Cannot create call, subchannel not READY");let s;return this.channelzEnabled?(this.callTracker.addCallStarted(),this.streamTracker.addCallStarted(),s={onCallEnd:e=>{e.code===n.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()}}):s={},this.transport.createCall(e,t,r,i,s)}startConnecting(){process.nextTick(()=>{this.transitionToState([e.ConnectivityState.IDLE],e.ConnectivityState.CONNECTING)||this.connectivityState===e.ConnectivityState.TRANSIENT_FAILURE&&(this.continueConnecting=!0)})}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(e){this.stateListeners.add(e)}removeConnectivityStateListener(e){this.stateListeners.delete(e)}resetBackoff(){process.nextTick(()=>{this.backoffTimeout.reset(),this.transitionToState([e.ConnectivityState.TRANSIENT_FAILURE],e.ConnectivityState.CONNECTING)})}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}isHealthy(){return!0}addHealthStateWatcher(e){}removeHealthStateWatcher(e){}getRealSubchannel(){return this}realSubchannelEquals(e){return e.getRealSubchannel()===this}throttleKeepalive(e){e>this.keepaliveTime&&(this.keepaliveTime=e)}getCallCredentials(){return this.secureConnector.getCallCredentials()}getChannel(){return this.subchannelChannel||(this.subchannelChannel=new o.SingleSubchannelChannel(this,this.channelTarget,this.options)),this.subchannelChannel}addDataWatcher(e){throw new Error("Not implemented")}getOrCreateDataProducer(e,t){const r=this.dataProducers.get(e);if(r)return r;const n=t(this);return this.dataProducers.set(e,n),n}removeDataProducer(e){this.dataProducers.delete(e)}},subchannel}var transport={},http_proxy={},resolverDns={},environment={},hasRequiredEnvironment,hasRequiredResolverDns,hasRequiredHttp_proxy;function requireEnvironment(){return hasRequiredEnvironment||(hasRequiredEnvironment=1,Object.defineProperty(environment,"__esModule",{value:!0}),environment.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=void 0,environment.GRPC_NODE_USE_ALTERNATIVE_RESOLVER="true"===(null!==(e=process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)&&void 0!==e?e:"false")),environment;var e}function requireResolverDns(){return hasRequiredResolverDns||(hasRequiredResolverDns=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_PORT=void 0,e.setup=function(){(0,t.registerResolver)("dns",f),(0,t.registerDefaultScheme)("dns")};const t=requireResolver(),r=require$$1$4,n=requireServiceConfig(),i=requireConstants(),s=requireCallInterface(),a=requireMetadata(),o=requireLogging(),l=requireConstants(),c=requireUriParser(),u=require$$0$3,h=requireBackoffTimeout(),d=requireEnvironment();function p(e){o.trace(l.LogVerbosity.DEBUG,"dns_resolver",e)}e.DEFAULT_PORT=443;class f{constructor(t,n,s){var o,l,d;this.target=t,this.listener=n,this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.continueResolving=!1,this.isNextResolutionTimerRunning=!1,this.isServiceConfigEnabled=!0,this.returnedIpResult=!1,this.alternativeResolver=new r.promises.Resolver,p("Resolver constructed for target "+(0,c.uriToString)(t)),t.authority&&this.alternativeResolver.setServers([t.authority]);const f=(0,c.splitHostPort)(t.path);null===f?(this.ipResult=null,this.dnsHostname=null,this.port=null):(0,u.isIPv4)(f.host)||(0,u.isIPv6)(f.host)?(this.ipResult=[{addresses:[{host:f.host,port:null!==(o=f.port)&&void 0!==o?o:e.DEFAULT_PORT}]}],this.dnsHostname=null,this.port=null):(this.ipResult=null,this.dnsHostname=f.host,this.port=null!==(l=f.port)&&void 0!==l?l:e.DEFAULT_PORT),this.percentage=100*Math.random(),1===s["grpc.service_config_disable_resolution"]&&(this.isServiceConfigEnabled=!1),this.defaultResolutionError={code:i.Status.UNAVAILABLE,details:`Name resolution failed for target ${(0,c.uriToString)(this.target)}`,metadata:new a.Metadata};const g={initialDelay:s["grpc.initial_reconnect_backoff_ms"],maxDelay:s["grpc.max_reconnect_backoff_ms"]};this.backoff=new h.BackoffTimeout(()=>{this.continueResolving&&this.startResolutionWithBackoff()},g),this.backoff.unref(),this.minTimeBetweenResolutionsMs=null!==(d=s["grpc.dns_min_time_between_resolutions_ms"])&&void 0!==d?d:3e4,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(null!==this.ipResult)return this.returnedIpResult||(p("Returning IP address for target "+(0,c.uriToString)(this.target)),setImmediate(()=>{this.listener((0,s.statusOrFromValue)(this.ipResult),{},null,"")}),this.returnedIpResult=!0),this.backoff.stop(),this.backoff.reset(),void this.stopNextResolutionTimer();if(null===this.dnsHostname)p("Failed to parse DNS address "+(0,c.uriToString)(this.target)),setImmediate(()=>{this.listener((0,s.statusOrFromError)({code:i.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,c.uriToString)(this.target)}`}),{},null,"")}),this.stopNextResolutionTimer();else{if(null!==this.pendingLookupPromise)return;p("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;const e=this.dnsHostname;this.pendingLookupPromise=this.lookup(e),this.pendingLookupPromise.then(e=>{if(null===this.pendingLookupPromise)return;this.pendingLookupPromise=null,this.latestLookupResult=(0,s.statusOrFromValue)(e.map(e=>({addresses:[e]})));const t="["+e.map(e=>e.host+":"+e.port).join(",")+"]";p("Resolved addresses for target "+(0,c.uriToString)(this.target)+": "+t);const r=this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"");this.handleHealthStatus(r)},e=>{null!==this.pendingLookupPromise&&(p("Resolution error for target "+(0,c.uriToString)(this.target)+": "+e.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener((0,s.statusOrFromError)(this.defaultResolutionError),{},this.latestServiceConfigResult,""))}),this.isServiceConfigEnabled&&null===this.pendingTxtPromise&&(this.pendingTxtPromise=this.resolveTxt(e),this.pendingTxtPromise.then(e=>{if(null===this.pendingTxtPromise)return;let t;this.pendingTxtPromise=null;try{t=(0,n.extractAndSelectServiceConfig)(e,this.percentage),this.latestServiceConfigResult=t?(0,s.statusOrFromValue)(t):null}catch(e){this.latestServiceConfigResult=(0,s.statusOrFromError)({code:i.Status.UNAVAILABLE,details:`Parsing service config failed with error ${e.message}`})}null!==this.latestLookupResult&&this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"")},e=>{}))}}handleHealthStatus(e){e?(this.backoff.stop(),this.backoff.reset()):this.continueResolving=!0}async lookup(e){if(d.GRPC_NODE_USE_ALTERNATIVE_RESOLVER){p("Using alternative DNS resolver.");const t=await Promise.allSettled([this.alternativeResolver.resolve4(e),this.alternativeResolver.resolve6(e)]);if(t.every(e=>"rejected"===e.status))throw new Error(t[0].reason);return t.reduce((e,t)=>"fulfilled"===t.status?[...e,...t.value]:e,[]).map(e=>({host:e,port:+this.port}))}return(await r.promises.lookup(e,{all:!0})).map(e=>({host:e.address,port:+this.port}))}async resolveTxt(e){return d.GRPC_NODE_USE_ALTERNATIVE_RESOLVER?(p("Using alternative DNS resolver."),this.alternativeResolver.resolveTxt(e)):r.promises.resolveTxt(e)}startNextResolutionTimer(){var e,t;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=setTimeout(()=>{this.stopNextResolutionTimer(),this.continueResolving&&this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs),null===(t=(e=this.nextResolutionTimer).unref)||void 0===t||t.call(e),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){null===this.pendingLookupPromise&&(this.continueResolving=!1,this.backoff.runOnce(),this.startNextResolutionTimer(),this.startResolution())}updateResolution(){null===this.pendingLookupPromise&&(this.isNextResolutionTimerRunning||this.backoff.isRunning()?(this.isNextResolutionTimerRunning?p('resolution update delayed by "min time between resolutions" rate limit'):p("resolution update delayed by backoff timer until "+this.backoff.getEndTime().toISOString()),this.continueResolving=!0):this.startResolutionWithBackoff())}destroy(){this.continueResolving=!1,this.backoff.reset(),this.backoff.stop(),this.stopNextResolutionTimer(),this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.returnedIpResult=!1}static getDefaultAuthority(e){return e.path}}}(resolverDns)),resolverDns}function requireHttp_proxy(){if(hasRequiredHttp_proxy)return http_proxy;hasRequiredHttp_proxy=1,Object.defineProperty(http_proxy,"__esModule",{value:!0}),http_proxy.parseCIDR=h,http_proxy.mapProxyName=function(n,i){var s;const l={target:n,extraOptions:{}};if(0===(null!==(s=i["grpc.enable_http_proxy"])&&void 0!==s?s:1))return l;if("unix"===n.scheme)return l;const c=function(){let r,n="",i="";if(process.env.grpc_proxy)i="grpc_proxy",n=process.env.grpc_proxy;else if(process.env.https_proxy)i="https_proxy",n=process.env.https_proxy;else{if(!process.env.http_proxy)return{};i="http_proxy",n=process.env.http_proxy}try{r=new o.URL(n)}catch(r){return(0,e.log)(t.LogVerbosity.ERROR,`cannot parse value of "${i}" env var`),{}}if("http:"!==r.protocol)return(0,e.log)(t.LogVerbosity.ERROR,`"${r.protocol}" scheme not supported in proxy URI`),{};let s=null;r.username&&(r.password?((0,e.log)(t.LogVerbosity.INFO,"userinfo found in proxy URI"),s=decodeURIComponent(`${r.username}:${r.password}`)):s=r.username);const a=r.hostname;let l=r.port;""===l&&(l="80");const c={address:`${a}:${l}`};s&&(c.creds=s);return u("Proxy server "+c.address+" set by environment variable "+i),c}();if(!c.address)return l;const d=(0,a.splitHostPort)(n.path);if(!d)return l;if(function(e){for(const t of function(){let e=process.env.no_grpc_proxy,t="no_grpc_proxy";e||(e=process.env.no_proxy,t="no_proxy");return e?(u("No proxy server list set by environment variable "+t),e.split(",")):[]}()){const n=h(t);if((0,r.isIPv4)(e)&&n&&p(n,e))return!0;if(e.endsWith(t))return!0}return!1}(d.host))return u("Not using proxy for target in no_proxy list: "+(0,a.uriToString)(n)),l;const f={"grpc.http_connect_target":(0,a.uriToString)(n)};c.creds&&(f["grpc.http_connect_creds"]=c.creds);return{target:{scheme:"dns",path:c.address},extraOptions:f}},http_proxy.getProxiedConnection=function(r,i){var o;if(!("grpc.http_connect_target"in i))return Promise.resolve(null);const c=i["grpc.http_connect_target"],h=(0,a.parseUri)(c);if(null===h)return Promise.resolve(null);const d=(0,a.splitHostPort)(h.path);if(null===d)return Promise.resolve(null);const p=`${d.host}:${null!==(o=d.port)&&void 0!==o?o:l.DEFAULT_PORT}`,f={method:"CONNECT",path:p},g={Host:p};(0,s.isTcpSubchannelAddress)(r)?(f.host=r.host,f.port=r.port):f.socketPath=r.path;"grpc.http_connect_creds"in i&&(g["Proxy-Authorization"]="Basic "+Buffer.from(i["grpc.http_connect_creds"]).toString("base64"));f.headers=g;const v=(0,s.subchannelAddressToString)(r);return u("Using proxy "+v+" to connect to "+f.path),new Promise((r,i)=>{const s=n.request(f);s.once("connect",(n,a,o)=>{s.removeAllListeners(),a.removeAllListeners(),200===n.statusCode?(u("Successfully connected to "+f.path+" through proxy "+v),o.length>0&&a.unshift(o),u("Successfully established a plaintext connection to "+f.path+" through proxy "+v),r(a)):((0,e.log)(t.LogVerbosity.ERROR,"Failed to connect to "+f.path+" through proxy "+v+" with status "+n.statusCode),i())}),s.once("error",r=>{s.removeAllListeners(),(0,e.log)(t.LogVerbosity.ERROR,"Failed to connect to proxy "+v+" with error "+r.message),i()}),s.end()})};const e=requireLogging(),t=requireConstants(),r=require$$0$3,n=require$$3$1,i=requireLogging(),s=requireSubchannelAddress(),a=requireUriParser(),o=require$$6$1,l=requireResolverDns(),c="proxy";function u(e){i.trace(t.LogVerbosity.DEBUG,c,e)}function h(e){const t=e.split("/");if(2!==t.length)return null;const n=parseInt(t[1],10);return!(0,r.isIPv4)(t[0])||Number.isNaN(n)||n<0||n>32?null:{ip:d(t[0]),prefixLength:n}}function d(e){return e.split(".").reduce((e,t)=>(e<<8)+parseInt(t,10),0)}function p(e,t){const r=e.ip,n=-1<<32-e.prefixLength;return(d(t)&n)===(r&n)}return http_proxy}var subchannelCall={},streamDecoder={},hasRequiredStreamDecoder,hasRequiredSubchannelCall,hasRequiredTransport,hasRequiredSubchannelPool;function requireStreamDecoder(){if(hasRequiredStreamDecoder)return streamDecoder;var e;hasRequiredStreamDecoder=1,Object.defineProperty(streamDecoder,"__esModule",{value:!0}),streamDecoder.StreamDecoder=void 0,function(e){e[e.NO_DATA=0]="NO_DATA",e[e.READING_SIZE=1]="READING_SIZE",e[e.READING_MESSAGE=2]="READING_MESSAGE"}(e||(e={}));return streamDecoder.StreamDecoder=class{constructor(t){this.maxReadMessageLength=t,this.readState=e.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 r,n=0;const i=[];for(;n<t.length;)switch(this.readState){case e.NO_DATA:this.readCompressFlag=t.slice(n,n+1),n+=1,this.readState=e.READING_SIZE,this.readPartialSize.fill(0),this.readSizeRemaining=4,this.readMessageSize=0,this.readMessageRemaining=0,this.readPartialMessage=[];break;case e.READING_SIZE:if(r=Math.min(t.length-n,this.readSizeRemaining),t.copy(this.readPartialSize,4-this.readSizeRemaining,n,n+r),this.readSizeRemaining-=r,n+=r,0===this.readSizeRemaining){if(this.readMessageSize=this.readPartialSize.readUInt32BE(0),-1!==this.maxReadMessageLength&&this.readMessageSize>this.maxReadMessageLength)throw new Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);if(this.readMessageRemaining=this.readMessageSize,this.readMessageRemaining>0)this.readState=e.READING_MESSAGE;else{const t=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=e.NO_DATA,i.push(t)}}break;case e.READING_MESSAGE:if(r=Math.min(t.length-n,this.readMessageRemaining),this.readPartialMessage.push(t.slice(n,n+r)),this.readMessageRemaining-=r,n+=r,0===this.readMessageRemaining){const t=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),r=Buffer.concat(t,this.readMessageSize+5);this.readState=e.NO_DATA,i.push(r)}break;default:throw new Error("Unexpected read state")}return i}},streamDecoder}function requireSubchannelCall(){if(hasRequiredSubchannelCall)return subchannelCall;hasRequiredSubchannelCall=1,Object.defineProperty(subchannelCall,"__esModule",{value:!0}),subchannelCall.Http2SubchannelCall=void 0;const e=require$$0$6,t=require$$0$2,r=requireConstants(),n=requireMetadata(),i=requireStreamDecoder(),s=requireLogging(),a=requireConstants();function o(e){const t=`Received HTTP status code ${e}`;let i;switch(e){case 400:i=r.Status.INTERNAL;break;case 401:i=r.Status.UNAUTHENTICATED;break;case 403:i=r.Status.PERMISSION_DENIED;break;case 404:i=r.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:i=r.Status.UNAVAILABLE;break;default:i=r.Status.UNKNOWN}return{code:i,details:t,metadata:new n.Metadata}}return subchannelCall.Http2SubchannelCall=class{constructor(s,a,l,c,u){var h;this.http2Stream=s,this.callEventTracker=a,this.listener=l,this.transport=c,this.callId=u,this.isReadFilterPending=!1,this.isPushPending=!1,this.canPush=!1,this.readsClosed=!1,this.statusOutput=!1,this.unpushedReadMessages=[],this.finalStatus=null,this.internalError=null,this.serverEndedCall=!1,this.connectionDropped=!1;const d=null!==(h=c.getOptions()["grpc.max_receive_message_length"])&&void 0!==h?h:r.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;this.decoder=new i.StreamDecoder(d),s.on("response",(t,i)=>{let s="";for(const e of Object.keys(t))s+="\t\t"+e+": "+t[e]+"\n";if(this.trace("Received server headers:\n"+s),this.httpStatusCode=t[":status"],i&e.constants.NGHTTP2_FLAG_END_STREAM)this.handleTrailers(t);else{let e;try{e=n.Metadata.fromHttp2Headers(t)}catch(e){return void this.endCall({code:r.Status.UNKNOWN,details:e.message,metadata:new n.Metadata})}this.listener.onReceiveMetadata(e)}}),s.on("trailers",e=>{this.handleTrailers(e)}),s.on("data",e=>{if(this.statusOutput)return;let t;this.trace("receive HTTP/2 data frame of length "+e.length);try{t=this.decoder.write(e)}catch(e){if(void 0!==this.httpStatusCode&&200!==this.httpStatusCode){const e=o(this.httpStatusCode);this.cancelWithStatus(e.code,e.details)}else this.cancelWithStatus(r.Status.RESOURCE_EXHAUSTED,e.message);return}for(const e of t)this.trace("parsed message of length "+e.length),this.callEventTracker.addMessageReceived(),this.tryPush(e)}),s.on("end",()=>{this.readsClosed=!0,this.maybeOutputStatus()}),s.on("close",()=>{this.serverEndedCall=!0,process.nextTick(()=>{var t;if(this.trace("HTTP/2 stream closed with code "+s.rstCode),(null===(t=this.finalStatus)||void 0===t?void 0:t.code)===r.Status.OK)return;let i,a="";switch(s.rstCode){case e.constants.NGHTTP2_NO_ERROR:if(null!==this.finalStatus)return;if(this.httpStatusCode&&200!==this.httpStatusCode){const e=o(this.httpStatusCode);i=e.code,a=e.details}else i=r.Status.INTERNAL,a=`Received RST_STREAM with code ${s.rstCode} (Call ended without gRPC status)`;break;case e.constants.NGHTTP2_REFUSED_STREAM:i=r.Status.UNAVAILABLE,a="Stream refused by server";break;case e.constants.NGHTTP2_CANCEL:this.connectionDropped?(i=r.Status.UNAVAILABLE,a="Connection dropped"):(i=r.Status.CANCELLED,a="Call cancelled");break;case e.constants.NGHTTP2_ENHANCE_YOUR_CALM:i=r.Status.RESOURCE_EXHAUSTED,a="Bandwidth exhausted or memory limit exceeded";break;case e.constants.NGHTTP2_INADEQUATE_SECURITY:i=r.Status.PERMISSION_DENIED,a="Protocol not secure enough";break;case e.constants.NGHTTP2_INTERNAL_ERROR:i=r.Status.INTERNAL,null===this.internalError?a=`Received RST_STREAM with code ${s.rstCode} (Internal server error)`:"ECONNRESET"===this.internalError.code||"ETIMEDOUT"===this.internalError.code?(i=r.Status.UNAVAILABLE,a=this.internalError.message):a=`Received RST_STREAM with code ${s.rstCode} triggered by internal client error: ${this.internalError.message}`;break;default:i=r.Status.INTERNAL,a=`Received RST_STREAM with code ${s.rstCode}`}this.endCall({code:i,details:a,metadata:new n.Metadata,rstCode:s.rstCode})})}),s.on("error",e=>{"ERR_HTTP2_STREAM_ERROR"!==e.code&&(this.trace("Node error event: message="+e.message+" code="+e.code+" errno="+function(e){for(const[r,n]of Object.entries(t.constants.errno))if(n===e)return r;return"Unknown system error "+e}(e.errno)+" syscall="+e.syscall),this.internalError=e),this.callEventTracker.onStreamEnd(!1)})}getDeadlineInfo(){return[`remote_addr=${this.getPeer()}`]}onDisconnect(){this.connectionDropped=!0,setImmediate(()=>{this.endCall({code:r.Status.UNAVAILABLE,details:"Connection dropped",metadata:new n.Metadata})})}outputStatus(){this.statusOutput||(this.statusOutput=!0,this.trace("ended with status: code="+this.finalStatus.code+' details="'+this.finalStatus.details+'"'),this.callEventTracker.onCallEnd(this.finalStatus),process.nextTick(()=>{this.listener.onReceiveStatus(this.finalStatus)}),this.http2Stream.resume())}trace(e){s.trace(a.LogVerbosity.DEBUG,"subchannel_call","["+this.callId+"] "+e)}endCall(e){null!==this.finalStatus&&this.finalStatus.code!==r.Status.OK||(this.finalStatus=e,this.maybeOutputStatus()),this.destroyHttp2Stream()}maybeOutputStatus(){null!==this.finalStatus&&(this.finalStatus.code!==r.Status.OK||this.readsClosed&&0===this.unpushedReadMessages.length&&!this.isReadFilterPending&&!this.isPushPending)&&this.outputStatus()}push(e){this.trace("pushing to reader message of length "+(e instanceof Buffer?e.length:null)),this.canPush=!1,this.isPushPending=!0,process.nextTick(()=>{this.isPushPending=!1,this.statusOutput||(this.listener.onReceiveMessage(e),this.maybeOutputStatus())})}tryPush(e){this.canPush?(this.http2Stream.pause(),this.push(e)):(this.trace("unpushedReadMessages.push message of length "+e.length),this.unpushedReadMessages.push(e))}handleTrailers(e){this.serverEndedCall=!0,this.callEventTracker.onStreamEnd(!0);let t,i="";for(const t of Object.keys(e))i+="\t\t"+t+": "+e[t]+"\n";this.trace("Received server trailers:\n"+i);try{t=n.Metadata.fromHttp2Headers(e)}catch(e){t=new n.Metadata}const s=t.getMap();let a;if("string"==typeof s["grpc-status"]){const e=Number(s["grpc-status"]);this.trace("received status code "+e+" from server"),t.remove("grpc-status");let r="";if("string"==typeof s["grpc-message"]){try{r=decodeURI(s["grpc-message"])}catch(e){r=s["grpc-message"]}t.remove("grpc-message"),this.trace('received status details string "'+r+'" from server')}a={code:e,details:r,metadata:t}}else this.httpStatusCode?(a=o(this.httpStatusCode),a.metadata=t):a={code:r.Status.UNKNOWN,details:"No status information received",metadata:t};this.endCall(a)}destroyHttp2Stream(){var t;if(!this.http2Stream.destroyed)if(this.serverEndedCall)this.http2Stream.end();else{let n;n=(null===(t=this.finalStatus)||void 0===t?void 0:t.code)===r.Status.OK?e.constants.NGHTTP2_NO_ERROR:e.constants.NGHTTP2_CANCEL,this.trace("close http2 stream with code "+n),this.http2Stream.close(n)}}cancelWithStatus(e,t){this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),this.endCall({code:e,details:t,metadata:new n.Metadata})}getStatus(){return this.finalStatus}getPeer(){return this.transport.getPeerName()}getCallNumber(){return this.callId}getAuthContext(){return this.transport.getAuthContext()}startRead(){if(null!==this.finalStatus&&this.finalStatus.code!==r.Status.OK)return this.readsClosed=!0,void this.maybeOutputStatus();if(this.canPush=!0,this.unpushedReadMessages.length>0){const e=this.unpushedReadMessages.shift();return void this.push(e)}this.http2Stream.resume()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length);const i=t=>{process.nextTick(()=>{var n;let i=r.Status.UNAVAILABLE;"ERR_STREAM_WRITE_AFTER_END"===(null==t?void 0:t.code)&&(i=r.Status.INTERNAL),t&&this.cancelWithStatus(i,`Write error: ${t.message}`),null===(n=e.callback)||void 0===n||n.call(e)})};this.trace("sending data chunk of length "+t.length),this.callEventTracker.addMessageSent();try{this.http2Stream.write(t,i)}catch(e){this.endCall({code:r.Status.UNAVAILABLE,details:`Write failed with error ${e.message}`,metadata:new n.Metadata})}}halfClose(){this.trace("end() called"),this.trace("calling end() on HTTP/2 stream"),this.http2Stream.end()}},subchannelCall}function requireTransport(){if(hasRequiredTransport)return transport;hasRequiredTransport=1,Object.defineProperty(transport,"__esModule",{value:!0}),transport.Http2SubchannelConnector=void 0;const e=require$$0$6,t=require$$0$1,r=requireChannelz(),n=requireConstants(),i=requireHttp_proxy(),s=requireLogging(),a=requireResolver(),o=requireSubchannelAddress(),l=requireUriParser(),c=require$$0$3,u=requireSubchannelCall(),h=requireCallNumber(),d="transport",p=require$$12.version,{HTTP2_HEADER_AUTHORITY:f,HTTP2_HEADER_CONTENT_TYPE:g,HTTP2_HEADER_METHOD:v,HTTP2_HEADER_PATH:m,HTTP2_HEADER_TE:A,HTTP2_HEADER_USER_AGENT:y}=e.constants,C=Buffer.from("too_many_pings","ascii");class S{constructor(n,i,a,l){this.session=n,this.options=a,this.remoteName=l,this.keepaliveTimer=null,this.pendingSendKeepalivePing=!1,this.activeCalls=new Set,this.disconnectListeners=[],this.disconnectHandled=!1,this.channelzEnabled=!0,this.keepalivesSent=0,this.messagesSent=0,this.messagesReceived=0,this.lastMessageSentTimestamp=null,this.lastMessageReceivedTimestamp=null,this.subchannelAddressString=(0,o.subchannelAddressToString)(i),0===a["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.streamTracker=new r.ChannelzCallTrackerStub):this.streamTracker=new r.ChannelzCallTracker,this.channelzRef=(0,r.registerChannelzSocket)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.userAgent=[a["grpc.primary_user_agent"],`grpc-node-js/${p}`,a["grpc.secondary_user_agent"]].filter(e=>e).join(" "),this.keepaliveTimeMs="grpc.keepalive_time_ms"in a?a["grpc.keepalive_time_ms"]:-1,this.keepaliveTimeoutMs="grpc.keepalive_timeout_ms"in a?a["grpc.keepalive_timeout_ms"]:2e4,this.keepaliveWithoutCalls="grpc.keepalive_permit_without_calls"in a&&1===a["grpc.keepalive_permit_without_calls"],n.once("close",()=>{this.trace("session closed"),this.handleDisconnect()}),n.once("goaway",(t,r,n)=>{let i=!1;t===e.constants.NGHTTP2_ENHANCE_YOUR_CALM&&n&&n.equals(C)&&(i=!0),this.trace("connection closed by GOAWAY with code "+t+" and data "+(null==n?void 0:n.toString())),this.reportDisconnectToOwner(i)}),n.once("error",e=>{this.trace("connection closed with error "+e.message),this.handleDisconnect()}),n.socket.once("close",e=>{this.trace("connection closed. hadError="+e),this.handleDisconnect()}),s.isTracerEnabled(d)&&(n.on("remoteSettings",e=>{this.trace("new settings received"+(this.session!==n?" on the old connection":"")+": "+JSON.stringify(e))}),n.on("localSettings",e=>{this.trace("local settings acknowledged by remote"+(this.session!==n?" on the old connection":"")+": "+JSON.stringify(e))})),this.keepaliveWithoutCalls&&this.maybeStartKeepalivePingTimer(),n.socket instanceof t.TLSSocket?this.authContext={transportSecurityType:"ssl",sslPeerCertificate:n.socket.getPeerCertificate()}:this.authContext={}}getChannelzInfo(){var e,t,r;const n=this.session.socket,i=n.remoteAddress?(0,o.stringToSubchannelAddress)(n.remoteAddress,n.remotePort):null,s=n.localAddress?(0,o.stringToSubchannelAddress)(n.localAddress,n.localPort):null;let a;if(this.session.encrypted){const t=n,r=t.getCipher(),i=t.getCertificate(),s=t.getPeerCertificate();a={cipherSuiteStandardName:null!==(e=r.standardName)&&void 0!==e?e:null,cipherSuiteOtherName:r.standardName?null:r.name,localCertificate:i&&"raw"in i?i.raw:null,remoteCertificate:s&&"raw"in s?s.raw:null}}else a=null;return{remoteAddress:i,localAddress:s,security:a,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:null!==(t=this.session.state.localWindowSize)&&void 0!==t?t:null,remoteFlowControlWindow:null!==(r=this.session.state.remoteWindowSize)&&void 0!==r?r:null}}trace(e){s.trace(n.LogVerbosity.DEBUG,d,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}keepaliveTrace(e){s.trace(n.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}flowControlTrace(e){s.trace(n.LogVerbosity.DEBUG,"transport_flowctrl","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}internalsTrace(e){s.trace(n.LogVerbosity.DEBUG,"transport_internals","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}reportDisconnectToOwner(e){this.disconnectHandled||(this.disconnectHandled=!0,this.disconnectListeners.forEach(t=>t(e)))}handleDisconnect(){this.clearKeepaliveTimeout(),this.reportDisconnectToOwner(!1);for(const e of this.activeCalls)e.onDisconnect();setImmediate(()=>{this.session.destroy()})}addDisconnectListener(e){this.disconnectListeners.push(e)}canSendPing(){return!this.session.destroyed&&this.keepaliveTimeMs>0&&(this.keepaliveWithoutCalls||this.activeCalls.size>0)}maybeSendPing(){var e,t;if(!this.canSendPing())return void(this.pendingSendKeepalivePing=!0);if(this.keepaliveTimer)return void console.error("keepaliveTimeout is not null");this.channelzEnabled&&(this.keepalivesSent+=1),this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.keepaliveTrace("Ping timeout passed without response"),this.handleDisconnect()},this.keepaliveTimeoutMs),null===(t=(e=this.keepaliveTimer).unref)||void 0===t||t.call(e);let r="";try{this.session.ping((e,t,r)=>{this.clearKeepaliveTimeout(),e?(this.keepaliveTrace("Ping failed with error "+e.message),this.handleDisconnect()):(this.keepaliveTrace("Received ping response"),this.maybeStartKeepalivePingTimer())})||(r="Ping returned false")}catch(e){r=(e instanceof Error?e.message:"")||"Unknown error"}r&&(this.keepaliveTrace("Ping send failed: "+r),this.handleDisconnect())}maybeStartKeepalivePingTimer(){var e,t;this.canSendPing()&&(this.pendingSendKeepalivePing?(this.pendingSendKeepalivePing=!1,this.maybeSendPing()):this.keepaliveTimer||(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.maybeSendPing()},this.keepaliveTimeMs),null===(t=(e=this.keepaliveTimer).unref)||void 0===t||t.call(e)))}clearKeepaliveTimeout(){this.keepaliveTimer&&(clearTimeout(this.keepaliveTimer),this.keepaliveTimer=null)}removeActiveCall(e){this.activeCalls.delete(e),0===this.activeCalls.size&&this.session.unref()}addActiveCall(e){this.activeCalls.add(e),1===this.activeCalls.size&&(this.session.ref(),this.keepaliveWithoutCalls||this.maybeStartKeepalivePingTimer())}createCall(e,t,r,n,i){const s=e.toHttp2Headers();let a,o,l;s[f]=t,s[y]=this.userAgent,s[g]="application/grpc",s[v]="POST",s[m]=r,s[A]="trailers";try{a=this.session.request(s)}catch(e){throw this.handleDisconnect(),e}return this.flowControlTrace("local window size: "+this.session.state.localWindowSize+" remote window size: "+this.session.state.remoteWindowSize),this.internalsTrace("session.closed="+this.session.closed+" session.destroyed="+this.session.destroyed+" session.socket.destroyed="+this.session.socket.destroyed),this.channelzEnabled?(this.streamTracker.addCallStarted(),o={addMessageSent:()=>{var e;this.messagesSent+=1,this.lastMessageSentTimestamp=new Date,null===(e=i.addMessageSent)||void 0===e||e.call(i)},addMessageReceived:()=>{var e;this.messagesReceived+=1,this.lastMessageReceivedTimestamp=new Date,null===(e=i.addMessageReceived)||void 0===e||e.call(i)},onCallEnd:e=>{var t;null===(t=i.onCallEnd)||void 0===t||t.call(i,e),this.removeActiveCall(l)},onStreamEnd:e=>{var t;e?this.streamTracker.addCallSucceeded():this.streamTracker.addCallFailed(),null===(t=i.onStreamEnd)||void 0===t||t.call(i,e)}}):o={addMessageSent:()=>{var e;null===(e=i.addMessageSent)||void 0===e||e.call(i)},addMessageReceived:()=>{var e;null===(e=i.addMessageReceived)||void 0===e||e.call(i)},onCallEnd:e=>{var t;null===(t=i.onCallEnd)||void 0===t||t.call(i,e),this.removeActiveCall(l)},onStreamEnd:e=>{var t;null===(t=i.onStreamEnd)||void 0===t||t.call(i,e)}},l=new u.Http2SubchannelCall(a,o,n,this,(0,h.getNextCallNumber)()),this.addActiveCall(l),l}getChannelzRef(){return this.channelzRef}getPeerName(){return this.subchannelAddressString}getOptions(){return this.options}getAuthContext(){return this.authContext}shutdown(){this.session.close(),(0,r.unregisterChannelzRef)(this.channelzRef)}}return transport.Http2SubchannelConnector=class{constructor(e){this.channelTarget=e,this.session=null,this.isShutdown=!1}trace(e){s.trace(n.LogVerbosity.DEBUG,d,(0,l.uriToString)(this.channelTarget)+" "+e)}createSession(t,r,n){return this.isShutdown?Promise.reject():t.socket.closed?Promise.reject("Connection closed before starting HTTP/2 handshake"):new Promise((i,s)=>{var o,c,u,h,d,p,f,g;let v=null,m=this.channelTarget;if("grpc.http_connect_target"in n){const e=(0,l.parseUri)(n["grpc.http_connect_target"]);e&&(m=e,v=(0,l.uriToString)(e))}const A=t.secure?"https":"http",y=(0,a.getDefaultAuthority)(m),C=()=>{var e;null===(e=this.session)||void 0===e||e.destroy(),this.session=null,setImmediate(()=>{w||(w=!0,s(`${x.trim()} (${(new Date).toISOString()})`))})},E=e=>{var t;null===(t=this.session)||void 0===t||t.destroy(),x=e.message,this.trace("connection failed with error "+x),w||(w=!0,s(`${x} (${(new Date).toISOString()})`))},_={createConnection:(e,r)=>t.socket,settings:{initialWindowSize:null!==(h=null!==(o=n["grpc-node.flow_control_window"])&&void 0!==o?o:null===(u=null===(c=e.getDefaultSettings)||void 0===c?void 0:c.call(e))||void 0===u?void 0:u.initialWindowSize)&&void 0!==h?h:65535},maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER,maxSessionMemory:null!==(d=n["grpc-node.max_session_memory"])&&void 0!==d?d:Number.MAX_SAFE_INTEGER},b=e.connect(`${A}://${y}`,_),T=null!==(g=null===(f=null===(p=e.getDefaultSettings)||void 0===p?void 0:p.call(e))||void 0===f?void 0:f.initialWindowSize)&&void 0!==g?g:65535,R=n["grpc-node.flow_control_window"];this.session=b;let x="Failed to connect",w=!1;b.unref(),b.once("remoteSettings",()=>{var e;if(R&&R>T)try{b.setLocalWindowSize(R)}catch(t){const r=R-(null!==(e=b.state.localWindowSize)&&void 0!==e?e:T);r>0&&b.incrementWindowSize(r)}b.removeAllListeners(),t.socket.removeListener("close",C),t.socket.removeListener("error",E),i(new S(b,r,n,v)),this.session=null}),b.once("close",C),b.once("error",E),t.socket.once("close",C),t.socket.once("error",E)})}tcpConnect(e,t){return(0,i.getProxiedConnection)(e,t).then(t=>t||new Promise((t,r)=>{const n=()=>{r(new Error("Socket closed"))},i=e=>{r(e)},s=c.connect(e,()=>{s.removeListener("close",n),s.removeListener("error",i),t(s)});s.once("close",n),s.once("error",i)}))}async connect(e,t,r){if(this.isShutdown)return Promise.reject();let n=null,i=null;const s=(0,o.subchannelAddressToString)(e);try{return this.trace(s+" Waiting for secureConnector to be ready"),await t.waitForReady(),this.trace(s+" secureConnector is ready"),n=await this.tcpConnect(e,r),n.setNoDelay(),this.trace(s+" Established TCP connection"),i=await t.connect(n),this.trace(s+" Established secure connection"),this.createSession(i,e,r)}catch(e){throw null==n||n.destroy(),null==i||i.socket.destroy(),e}}shutdown(){var e;this.isShutdown=!0,null===(e=this.session)||void 0===e||e.close(),this.session=null}},transport}function requireSubchannelPool(){if(hasRequiredSubchannelPool)return subchannelPool;hasRequiredSubchannelPool=1,Object.defineProperty(subchannelPool,"__esModule",{value:!0}),subchannelPool.SubchannelPool=void 0,subchannelPool.getSubchannelPool=function(e){return e?a:new s};const e=requireChannelOptions(),t=requireSubchannel(),r=requireSubchannelAddress(),n=requireUriParser(),i=requireTransport();class s{constructor(){this.pool=Object.create(null),this.cleanupTimer=null}unrefUnusedSubchannels(){let e=!0;for(const t in this.pool){const r=this.pool[t].filter(e=>!e.subchannel.unrefIfOneRef());r.length>0&&(e=!1),this.pool[t]=r}e&&null!==this.cleanupTimer&&(clearInterval(this.cleanupTimer),this.cleanupTimer=null)}ensureCleanupTask(){var e,t;null===this.cleanupTimer&&(this.cleanupTimer=setInterval(()=>{this.unrefUnusedSubchannels()},1e4),null===(t=(e=this.cleanupTimer).unref)||void 0===t||t.call(e))}getOrCreateSubchannel(s,a,o,l){this.ensureCleanupTask();const c=(0,n.uriToString)(s);if(c in this.pool){const t=this.pool[c];for(const n of t)if((0,r.subchannelAddressEqual)(a,n.subchannelAddress)&&(0,e.channelOptionsEqual)(o,n.channelArguments)&&l._equals(n.channelCredentials))return n.subchannel}const u=new t.Subchannel(s,a,o,l,new i.Http2SubchannelConnector(s));return c in this.pool||(this.pool[c]=[]),this.pool[c].push({subchannelAddress:a,channelArguments:o,channelCredentials:l,subchannel:u}),u.ref(),u}}subchannelPool.SubchannelPool=s;const a=new s;return subchannelPool}var loadBalancingCall={},hasRequiredLoadBalancingCall;function requireLoadBalancingCall(){if(hasRequiredLoadBalancingCall)return loadBalancingCall;hasRequiredLoadBalancingCall=1,Object.defineProperty(loadBalancingCall,"__esModule",{value:!0}),loadBalancingCall.LoadBalancingCall=void 0;const e=requireConnectivityState(),t=requireConstants(),r=requireDeadline(),n=requireMetadata(),i=requirePicker(),s=requireUriParser(),a=requireLogging(),o=requireControlPlaneStatus(),l=require$$0$6;return loadBalancingCall.LoadBalancingCall=class{constructor(e,t,r,n,i,a,o){var l,c;this.channel=e,this.callConfig=t,this.methodName=r,this.host=n,this.credentials=i,this.deadline=a,this.callNumber=o,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.metadata=null,this.listener=null,this.onCallEnded=null,this.childStartTime=null;const u=this.methodName.split("/");let h="";u.length>=2&&(h=u[1]);const d=null!==(c=null===(l=(0,s.splitHostPort)(this.host))||void 0===l?void 0:l.host)&&void 0!==c?c:"localhost";this.serviceUrl=`https://${d}/${h}`,this.startTime=new Date}getDeadlineInfo(){var e,t;const n=[];return this.childStartTime?(this.childStartTime>this.startTime&&((null===(e=this.metadata)||void 0===e?void 0:e.getOptions().waitForReady)&&n.push("wait_for_ready"),n.push(`LB pick: ${(0,r.formatDateDifference)(this.startTime,this.childStartTime)}`)),n.push(...this.child.getDeadlineInfo()),n):((null===(t=this.metadata)||void 0===t?void 0:t.getOptions().waitForReady)&&n.push("wait_for_ready"),n.push("Waiting for LB pick"),n)}trace(e){a.trace(t.LogVerbosity.DEBUG,"load_balancing_call","["+this.callNumber+"] "+e)}outputStatus(e,t){var r,n;if(!this.ended){this.ended=!0,this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString());const i=Object.assign(Object.assign({},e),{progress:t});null===(r=this.listener)||void 0===r||r.onReceiveStatus(i),null===(n=this.onCallEnded)||void 0===n||n.call(this,i.code,i.details,i.metadata)}}doPick(){var s,a;if(this.ended)return;if(!this.metadata)throw new Error("doPick called before start");this.trace("Pick called");const c=this.metadata.clone(),u=this.channel.doPick(c,this.callConfig.pickInformation),h=u.subchannel?"("+u.subchannel.getChannelzRef().id+") "+u.subchannel.getAddress():""+u.subchannel;switch(this.trace("Pick result: "+i.PickResultType[u.pickResultType]+" subchannel: "+h+" status: "+(null===(s=u.status)||void 0===s?void 0:s.code)+" "+(null===(a=u.status)||void 0===a?void 0:a.details)),u.pickResultType){case i.PickResultType.COMPLETE:this.credentials.compose(u.subchannel.getCallCredentials()).generateMetadata({method_name:this.methodName,service_url:this.serviceUrl}).then(i=>{var s;if(this.ended)this.trace("Credentials metadata generation finished after call ended");else{if(c.merge(i),c.get("authorization").length>1&&this.outputStatus({code:t.Status.INTERNAL,details:'"authorization" metadata cannot have multiple values',metadata:new n.Metadata},"PROCESSED"),u.subchannel.getConnectivityState()!==e.ConnectivityState.READY)return this.trace("Picked subchannel "+h+" has state "+e.ConnectivityState[u.subchannel.getConnectivityState()]+" after getting credentials metadata. Retrying pick"),void this.doPick();this.deadline!==1/0&&c.set("grpc-timeout",(0,r.getDeadlineTimeoutString)(this.deadline));try{this.child=u.subchannel.getRealSubchannel().createCall(c,this.host,this.methodName,{onReceiveMetadata:e=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(e)},onReceiveMessage:e=>{this.trace("Received message"),this.listener.onReceiveMessage(e)},onReceiveStatus:e=>{this.trace("Received status"),e.rstCode===l.constants.NGHTTP2_REFUSED_STREAM?this.outputStatus(e,"REFUSED"):this.outputStatus(e,"PROCESSED")}}),this.childStartTime=new Date}catch(e){return this.trace("Failed to start call on picked subchannel "+h+" with error "+e.message),void this.outputStatus({code:t.Status.INTERNAL,details:"Failed to start HTTP/2 stream with error "+e.message,metadata:new n.Metadata},"NOT_STARTED")}null===(s=u.onCallStarted)||void 0===s||s.call(u),this.onCallEnded=u.onCallEnded,this.trace("Created child call ["+this.child.getCallNumber()+"]"),this.readPending&&this.child.startRead(),this.pendingMessage&&this.child.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.pendingHalfClose&&this.child.halfClose()}},e=>{const{code:r,details:i}=(0,o.restrictControlPlaneStatusCode)("number"==typeof e.code?e.code:t.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${e.message}`);this.outputStatus({code:r,details:i,metadata:new n.Metadata},"PROCESSED")});break;case i.PickResultType.DROP:const{code:s,details:a}=(0,o.restrictControlPlaneStatusCode)(u.status.code,u.status.details);setImmediate(()=>{this.outputStatus({code:s,details:a,metadata:u.status.metadata},"DROP")});break;case i.PickResultType.TRANSIENT_FAILURE:if(this.metadata.getOptions().waitForReady)this.channel.queueCallForPick(this);else{const{code:e,details:t}=(0,o.restrictControlPlaneStatusCode)(u.status.code,u.status.details);setImmediate(()=>{this.outputStatus({code:e,details:t,metadata:u.status.metadata},"PROCESSED")})}break;case i.PickResultType.QUEUE:this.channel.queueCallForPick(this)}}cancelWithStatus(e,t){var r;this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),null===(r=this.child)||void 0===r||r.cancelWithStatus(e,t),this.outputStatus({code:e,details:t,metadata:new n.Metadata},"PROCESSED")}getPeer(){var e,t;return null!==(t=null===(e=this.child)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.channel.getTarget()}start(e,t){this.trace("start called"),this.listener=t,this.metadata=e,this.doPick()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length),this.child?this.child.sendMessageWithContext(e,t):this.pendingMessage={context:e,message:t}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){throw new Error("Method not implemented.")}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}},loadBalancingCall}var resolvingCall={},hasRequiredResolvingCall;function requireResolvingCall(){if(hasRequiredResolvingCall)return resolvingCall;hasRequiredResolvingCall=1,Object.defineProperty(resolvingCall,"__esModule",{value:!0}),resolvingCall.ResolvingCall=void 0;const e=requireCallCredentials(),t=requireConstants(),r=requireDeadline(),n=requireMetadata(),i=requireLogging(),s=requireControlPlaneStatus();return resolvingCall.ResolvingCall=class{constructor(n,i,s,a,o){this.channel=n,this.method=i,this.filterStackFactory=a,this.callNumber=o,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.readFilterPending=!1,this.writeFilterPending=!1,this.pendingChildStatus=null,this.metadata=null,this.listener=null,this.statusWatchers=[],this.deadlineTimer=setTimeout(()=>{},0),this.filterStack=null,this.deadlineStartTime=null,this.configReceivedTime=null,this.childStartTime=null,this.credentials=e.CallCredentials.createEmpty(),this.deadline=s.deadline,this.host=s.host,s.parentCall&&(s.flags&t.Propagate.CANCELLATION&&s.parentCall.on("cancelled",()=>{this.cancelWithStatus(t.Status.CANCELLED,"Cancelled by parent call")}),s.flags&t.Propagate.DEADLINE&&(this.trace("Propagating deadline from parent: "+s.parentCall.getDeadline()),this.deadline=(0,r.minDeadline)(this.deadline,s.parentCall.getDeadline()))),this.trace("Created"),this.runDeadlineTimer()}trace(e){i.trace(t.LogVerbosity.DEBUG,"resolving_call","["+this.callNumber+"] "+e)}runDeadlineTimer(){clearTimeout(this.deadlineTimer),this.deadlineStartTime=new Date,this.trace("Deadline: "+(0,r.deadlineToString)(this.deadline));const e=(0,r.getRelativeTimeout)(this.deadline);if(e!==1/0){this.trace("Deadline will be reached in "+e+"ms");const n=()=>{if(!this.deadlineStartTime)return void this.cancelWithStatus(t.Status.DEADLINE_EXCEEDED,"Deadline exceeded");const e=[],n=new Date;e.push(`Deadline exceeded after ${(0,r.formatDateDifference)(this.deadlineStartTime,n)}`),this.configReceivedTime?(this.configReceivedTime>this.deadlineStartTime&&e.push(`name resolution: ${(0,r.formatDateDifference)(this.deadlineStartTime,this.configReceivedTime)}`),this.childStartTime?this.childStartTime>this.configReceivedTime&&e.push(`metadata filters: ${(0,r.formatDateDifference)(this.configReceivedTime,this.childStartTime)}`):e.push("waiting for metadata filters")):e.push("waiting for name resolution"),this.child&&e.push(...this.child.getDeadlineInfo()),this.cancelWithStatus(t.Status.DEADLINE_EXCEEDED,e.join(","))};e<=0?process.nextTick(n):this.deadlineTimer=setTimeout(n,e)}}outputStatus(e){if(!this.ended){this.ended=!0,this.filterStack||(this.filterStack=this.filterStackFactory.createFilter()),clearTimeout(this.deadlineTimer);const t=this.filterStack.receiveTrailers(e);this.trace("ended with status: code="+t.code+' details="'+t.details+'"'),this.statusWatchers.forEach(e=>e(t)),process.nextTick(()=>{var e;null===(e=this.listener)||void 0===e||e.onReceiveStatus(t)})}}sendMessageOnChild(e,t){if(!this.child)throw new Error("sendMessageonChild called with child not populated");const r=this.child;this.writeFilterPending=!0,this.filterStack.sendMessage(Promise.resolve({message:t,flags:e.flags})).then(t=>{this.writeFilterPending=!1,r.sendMessageWithContext(e,t.message),this.pendingHalfClose&&r.halfClose()},e=>{this.cancelWithStatus(e.code,e.details)})}getConfig(){if(this.ended)return;if(!this.metadata||!this.listener)throw new Error("getConfig called before start");const e=this.channel.getConfig(this.method,this.metadata);if("NONE"===e.type)return void this.channel.queueCallForConfig(this);if("ERROR"===e.type)return void(this.metadata.getOptions().waitForReady?this.channel.queueCallForConfig(this):this.outputStatus(e.error));this.configReceivedTime=new Date;const i=e.config;if(i.status!==t.Status.OK){const{code:e,details:t}=(0,s.restrictControlPlaneStatusCode)(i.status,"Failed to route call to method "+this.method);return void this.outputStatus({code:e,details:t,metadata:new n.Metadata})}if(i.methodConfig.timeout){const e=new Date;e.setSeconds(e.getSeconds()+i.methodConfig.timeout.seconds),e.setMilliseconds(e.getMilliseconds()+i.methodConfig.timeout.nanos/1e6),this.deadline=(0,r.minDeadline)(this.deadline,e),this.runDeadlineTimer()}this.filterStackFactory.push(i.dynamicFilterFactories),this.filterStack=this.filterStackFactory.createFilter(),this.filterStack.sendMetadata(Promise.resolve(this.metadata)).then(e=>{this.child=this.channel.createRetryingCall(i,this.method,this.host,this.credentials,this.deadline),this.trace("Created child ["+this.child.getCallNumber()+"]"),this.childStartTime=new Date,this.child.start(e,{onReceiveMetadata:e=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(this.filterStack.receiveMetadata(e))},onReceiveMessage:e=>{this.trace("Received message"),this.readFilterPending=!0,this.filterStack.receiveMessage(e).then(e=>{this.trace("Finished filtering received message"),this.readFilterPending=!1,this.listener.onReceiveMessage(e),this.pendingChildStatus&&this.outputStatus(this.pendingChildStatus)},e=>{this.cancelWithStatus(e.code,e.details)})},onReceiveStatus:e=>{this.trace("Received status"),this.readFilterPending?this.pendingChildStatus=e:this.outputStatus(e)}}),this.readPending&&this.child.startRead(),this.pendingMessage?this.sendMessageOnChild(this.pendingMessage.context,this.pendingMessage.message):this.pendingHalfClose&&this.child.halfClose()},e=>{this.outputStatus(e)})}reportResolverError(e){var t;(null===(t=this.metadata)||void 0===t?void 0:t.getOptions().waitForReady)?this.channel.queueCallForConfig(this):this.outputStatus(e)}cancelWithStatus(e,t){var r;this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),null===(r=this.child)||void 0===r||r.cancelWithStatus(e,t),this.outputStatus({code:e,details:t,metadata:new n.Metadata})}getPeer(){var e,t;return null!==(t=null===(e=this.child)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.channel.getTarget()}start(e,t){this.trace("start called"),this.metadata=e.clone(),this.listener=t,this.getConfig()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length),this.child?this.sendMessageOnChild(e,t):this.pendingMessage={context:e,message:t}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child&&!this.writeFilterPending?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){this.credentials=e}addStatusWatcher(e){this.statusWatchers.push(e)}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}},resolvingCall}var retryingCall={},hasRequiredRetryingCall;function requireRetryingCall(){if(hasRequiredRetryingCall)return retryingCall;hasRequiredRetryingCall=1,Object.defineProperty(retryingCall,"__esModule",{value:!0}),retryingCall.RetryingCall=retryingCall.MessageBufferTracker=retryingCall.RetryThrottler=void 0;const e=requireConstants(),t=requireDeadline(),r=requireMetadata(),n=requireLogging();retryingCall.RetryThrottler=class{constructor(e,t,r){this.maxTokens=e,this.tokenRatio=t,this.tokens=r?r.tokens*(e/r.maxTokens):e}addCallSucceeded(){this.tokens=Math.min(this.tokens+this.tokenRatio,this.maxTokens)}addCallFailed(){this.tokens=Math.max(this.tokens-1,0)}canRetryCall(){return this.tokens>this.maxTokens/2}};retryingCall.MessageBufferTracker=class{constructor(e,t){this.totalLimit=e,this.limitPerCall=t,this.totalAllocated=0,this.allocatedPerCall=new Map}allocate(e,t){var r;const n=null!==(r=this.allocatedPerCall.get(t))&&void 0!==r?r:0;return!(this.limitPerCall-n<e||this.totalLimit-this.totalAllocated<e)&&(this.allocatedPerCall.set(t,n+e),this.totalAllocated+=e,!0)}free(e,t){var r;if(this.totalAllocated<e)throw new Error(`Invalid buffer allocation state: call ${t} freed ${e} > total allocated ${this.totalAllocated}`);this.totalAllocated-=e;const n=null!==(r=this.allocatedPerCall.get(t))&&void 0!==r?r:0;if(n<e)throw new Error(`Invalid buffer allocation state: call ${t} freed ${e} > allocated for call ${n}`);this.allocatedPerCall.set(t,n-e)}freeAll(e){var t;const r=null!==(t=this.allocatedPerCall.get(e))&&void 0!==t?t:0;if(this.totalAllocated<r)throw new Error(`Invalid buffer allocation state: call ${e} allocated ${r} > total allocated ${this.totalAllocated}`);this.totalAllocated-=r,this.allocatedPerCall.delete(e)}};const i="grpc-previous-rpc-attempts";return retryingCall.RetryingCall=class{constructor(e,t,r,n,i,s,a,o,l){var c;this.channel=e,this.callConfig=t,this.methodName=r,this.host=n,this.credentials=i,this.deadline=s,this.callNumber=a,this.bufferTracker=o,this.retryThrottler=l,this.listener=null,this.initialMetadata=null,this.underlyingCalls=[],this.writeBuffer=[],this.writeBufferOffset=0,this.readStarted=!1,this.transparentRetryUsed=!1,this.attempts=0,this.hedgingTimer=null,this.committedCallIndex=null,this.initialRetryBackoffSec=0,this.nextRetryBackoffSec=0;const u=null!==(c=e.getOptions()["grpc-node.retry_max_attempts_limit"])&&void 0!==c?c:5;if(0===e.getOptions()["grpc.enable_retries"])this.state="NO_RETRY",this.maxAttempts=1;else if(t.methodConfig.retryPolicy){this.state="RETRY";const e=t.methodConfig.retryPolicy;this.nextRetryBackoffSec=this.initialRetryBackoffSec=Number(e.initialBackoff.substring(0,e.initialBackoff.length-1)),this.maxAttempts=Math.min(e.maxAttempts,u)}else t.methodConfig.hedgingPolicy?(this.state="HEDGING",this.maxAttempts=Math.min(t.methodConfig.hedgingPolicy.maxAttempts,u)):(this.state="TRANSPARENT_ONLY",this.maxAttempts=1);this.startTime=new Date}getDeadlineInfo(){if(0===this.underlyingCalls.length)return[];const e=[],r=this.underlyingCalls[this.underlyingCalls.length-1];return this.underlyingCalls.length>1&&e.push("previous attempts: "+(this.underlyingCalls.length-1)),r.startTime>this.startTime&&e.push(`time to current attempt start: ${(0,t.formatDateDifference)(this.startTime,r.startTime)}`),e.push(...r.call.getDeadlineInfo()),e}getCallNumber(){return this.callNumber}trace(t){n.trace(e.LogVerbosity.DEBUG,"retrying_call","["+this.callNumber+"] "+t)}reportStatus(e){this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString()),this.bufferTracker.freeAll(this.callNumber),this.writeBufferOffset=this.writeBufferOffset+this.writeBuffer.length,this.writeBuffer=[],process.nextTick(()=>{var t;null===(t=this.listener)||void 0===t||t.onReceiveStatus({code:e.code,details:e.details,metadata:e.metadata})})}cancelWithStatus(e,t){this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),this.reportStatus({code:e,details:t,metadata:new r.Metadata});for(const{call:r}of this.underlyingCalls)r.cancelWithStatus(e,t)}getPeer(){return null!==this.committedCallIndex?this.underlyingCalls[this.committedCallIndex].call.getPeer():"unknown"}getBufferEntry(e){var t;return null!==(t=this.writeBuffer[e-this.writeBufferOffset])&&void 0!==t?t:{entryType:"FREED",allocated:!1}}getNextBufferIndex(){return this.writeBufferOffset+this.writeBuffer.length}clearSentMessages(){if("COMMITTED"!==this.state)return;let e;e="COMPLETED"===this.underlyingCalls[this.committedCallIndex].state?this.getNextBufferIndex():this.underlyingCalls[this.committedCallIndex].nextMessageToSend;for(let t=this.writeBufferOffset;t<e;t++){const e=this.getBufferEntry(t);e.allocated&&this.bufferTracker.free(e.message.message.length,this.callNumber)}this.writeBuffer=this.writeBuffer.slice(e-this.writeBufferOffset),this.writeBufferOffset=e}commitCall(t){var r,n;if("COMMITTED"!==this.state){this.trace("Committing call ["+this.underlyingCalls[t].call.getCallNumber()+"] at index "+t),this.state="COMMITTED",null===(n=(r=this.callConfig).onCommitted)||void 0===n||n.call(r),this.committedCallIndex=t;for(let r=0;r<this.underlyingCalls.length;r++)r!==t&&"COMPLETED"!==this.underlyingCalls[r].state&&(this.underlyingCalls[r].state="COMPLETED",this.underlyingCalls[r].call.cancelWithStatus(e.Status.CANCELLED,"Discarded in favor of other hedged attempt"));this.clearSentMessages()}}commitCallWithMostMessages(){if("COMMITTED"===this.state)return;let e=-1,t=-1;for(const[r,n]of this.underlyingCalls.entries())"ACTIVE"===n.state&&n.nextMessageToSend>e&&(e=n.nextMessageToSend,t=r);-1===t?this.state="TRANSPARENT_ONLY":this.commitCall(t)}isStatusCodeInList(t,r){return t.some(t=>{var n;return t===r||t.toString().toLowerCase()===(null===(n=e.Status[r])||void 0===n?void 0:n.toLowerCase())})}getNextRetryJitter(){return Math.random()*(1.2-.8)+.8}getNextRetryBackoffMs(){var e;const t=null===(e=this.callConfig)||void 0===e?void 0:e.methodConfig.retryPolicy;if(!t)return 0;const r=this.getNextRetryJitter()*this.nextRetryBackoffSec*1e3,n=Number(t.maxBackoff.substring(0,t.maxBackoff.length-1));return this.nextRetryBackoffSec=Math.min(this.nextRetryBackoffSec*t.backoffMultiplier,n),r}maybeRetryCall(e,t){if("RETRY"!==this.state)return void t(!1);if(this.attempts>=this.maxAttempts)return void t(!1);let r;if(null===e)r=this.getNextRetryBackoffMs();else{if(e<0)return this.state="TRANSPARENT_ONLY",void t(!1);r=e,this.nextRetryBackoffSec=this.initialRetryBackoffSec}setTimeout(()=>{var e,r;"RETRY"===this.state?null===(r=null===(e=this.retryThrottler)||void 0===e?void 0:e.canRetryCall())||void 0===r||r?(t(!0),this.attempts+=1,this.startNewAttempt()):(this.trace("Retry attempt denied by throttling policy"),t(!1)):t(!1)},r)}countActiveCalls(){let e=0;for(const t of this.underlyingCalls)"ACTIVE"===(null==t?void 0:t.state)&&(e+=1);return e}handleProcessedStatus(e,t,r){var n,i,s;switch(this.state){case"COMMITTED":case"NO_RETRY":case"TRANSPARENT_ONLY":this.commitCall(t),this.reportStatus(e);break;case"HEDGING":if(this.isStatusCodeInList(null!==(n=this.callConfig.methodConfig.hedgingPolicy.nonFatalStatusCodes)&&void 0!==n?n:[],e.code)){let n;if(null===(i=this.retryThrottler)||void 0===i||i.addCallFailed(),null===r)n=0;else{if(r<0)return this.state="TRANSPARENT_ONLY",this.commitCall(t),void this.reportStatus(e);n=r}setTimeout(()=>{this.maybeStartHedgingAttempt(),0===this.countActiveCalls()&&(this.commitCall(t),this.reportStatus(e))},n)}else this.commitCall(t),this.reportStatus(e);break;case"RETRY":this.isStatusCodeInList(this.callConfig.methodConfig.retryPolicy.retryableStatusCodes,e.code)?(null===(s=this.retryThrottler)||void 0===s||s.addCallFailed(),this.maybeRetryCall(r,r=>{r||(this.commitCall(t),this.reportStatus(e))})):(this.commitCall(t),this.reportStatus(e))}}getPushback(e){const t=e.get("grpc-retry-pushback-ms");if(0===t.length)return null;try{return parseInt(t[0])}catch(e){return-1}}handleChildStatus(t,r){var n;if("COMPLETED"===this.underlyingCalls[r].state)return;if(this.trace("state="+this.state+" handling status with progress "+t.progress+" from child ["+this.underlyingCalls[r].call.getCallNumber()+"] in state "+this.underlyingCalls[r].state),this.underlyingCalls[r].state="COMPLETED",t.code===e.Status.OK)return null===(n=this.retryThrottler)||void 0===n||n.addCallSucceeded(),this.commitCall(r),void this.reportStatus(t);if("NO_RETRY"===this.state)return this.commitCall(r),void this.reportStatus(t);if("COMMITTED"===this.state)return void this.reportStatus(t);const i=this.getPushback(t.metadata);switch(t.progress){case"NOT_STARTED":this.startNewAttempt();break;case"REFUSED":this.transparentRetryUsed?this.handleProcessedStatus(t,r,i):(this.transparentRetryUsed=!0,this.startNewAttempt());break;case"DROP":this.commitCall(r),this.reportStatus(t);break;case"PROCESSED":this.handleProcessedStatus(t,r,i)}}maybeStartHedgingAttempt(){"HEDGING"===this.state&&this.callConfig.methodConfig.hedgingPolicy&&(this.attempts>=this.maxAttempts||(this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()))}maybeStartHedgingTimer(){var e,t,r;if(this.hedgingTimer&&clearTimeout(this.hedgingTimer),"HEDGING"!==this.state)return;if(!this.callConfig.methodConfig.hedgingPolicy)return;const n=this.callConfig.methodConfig.hedgingPolicy;if(this.attempts>=this.maxAttempts)return;const i=null!==(e=n.hedgingDelay)&&void 0!==e?e:"0s",s=Number(i.substring(0,i.length-1));this.hedgingTimer=setTimeout(()=>{this.maybeStartHedgingAttempt()},1e3*s),null===(r=(t=this.hedgingTimer).unref)||void 0===r||r.call(t)}startNewAttempt(){const e=this.channel.createLoadBalancingCall(this.callConfig,this.methodName,this.host,this.credentials,this.deadline);this.trace("Created child call ["+e.getCallNumber()+"] for attempt "+this.attempts);const t=this.underlyingCalls.length;this.underlyingCalls.push({state:"ACTIVE",call:e,nextMessageToSend:0,startTime:new Date});const r=this.attempts-1,n=this.initialMetadata.clone();r>0&&n.set(i,`${r}`);let s=!1;e.start(n,{onReceiveMetadata:n=>{this.trace("Received metadata from child ["+e.getCallNumber()+"]"),this.commitCall(t),s=!0,r>0&&n.set(i,`${r}`),"ACTIVE"===this.underlyingCalls[t].state&&this.listener.onReceiveMetadata(n)},onReceiveMessage:r=>{this.trace("Received message from child ["+e.getCallNumber()+"]"),this.commitCall(t),"ACTIVE"===this.underlyingCalls[t].state&&this.listener.onReceiveMessage(r)},onReceiveStatus:n=>{this.trace("Received status from child ["+e.getCallNumber()+"]"),!s&&r>0&&n.metadata.set(i,`${r}`),this.handleChildStatus(n,t)}}),this.sendNextChildMessage(t),this.readStarted&&e.startRead()}start(e,t){this.trace("start called"),this.listener=t,this.initialMetadata=e,this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()}handleChildWriteCompleted(e,t){var r,n;null===(n=(r=this.getBufferEntry(t)).callback)||void 0===n||n.call(r),this.clearSentMessages();this.underlyingCalls[e].nextMessageToSend+=1,this.sendNextChildMessage(e)}sendNextChildMessage(e){const t=this.underlyingCalls[e];if("COMPLETED"===t.state)return;const r=t.nextMessageToSend;if(this.getBufferEntry(r)){const n=this.getBufferEntry(r);switch(n.entryType){case"MESSAGE":t.call.sendMessageWithContext({callback:t=>{this.handleChildWriteCompleted(e,r)}},n.message.message);"HALF_CLOSE"===this.getBufferEntry(r+1).entryType&&(this.trace("Sending halfClose immediately after message to child ["+t.call.getCallNumber()+"] - optimizing for unary/final message"),t.nextMessageToSend+=1,t.call.halfClose());break;case"HALF_CLOSE":t.nextMessageToSend+=1,t.call.halfClose()}}}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length);const r={message:t,flags:e.flags},n=this.getNextBufferIndex(),i={entryType:"MESSAGE",message:r,allocated:this.bufferTracker.allocate(t.length,this.callNumber)};if(this.writeBuffer.push(i),i.allocated){process.nextTick(()=>{var t;null===(t=e.callback)||void 0===t||t.call(e)});for(const[e,r]of this.underlyingCalls.entries())"ACTIVE"===r.state&&r.nextMessageToSend===n&&r.call.sendMessageWithContext({callback:t=>{this.handleChildWriteCompleted(e,n)}},t)}else{if(this.commitCallWithMostMessages(),null===this.committedCallIndex)return;const r=this.underlyingCalls[this.committedCallIndex];i.callback=e.callback,"ACTIVE"===r.state&&r.nextMessageToSend===n&&r.call.sendMessageWithContext({callback:e=>{this.handleChildWriteCompleted(this.committedCallIndex,n)}},t)}}startRead(){this.trace("startRead called"),this.readStarted=!0;for(const e of this.underlyingCalls)"ACTIVE"===(null==e?void 0:e.state)&&e.call.startRead()}halfClose(){this.trace("halfClose called");const e=this.getNextBufferIndex();this.writeBuffer.push({entryType:"HALF_CLOSE",allocated:!1});for(const t of this.underlyingCalls)"ACTIVE"===(null==t?void 0:t.state)&&(t.nextMessageToSend!==e&&t.nextMessageToSend!==e-1||(this.trace("Sending halfClose immediately to child ["+t.call.getCallNumber()+"] - all messages already sent"),t.nextMessageToSend+=1,t.call.halfClose()))}setCredentials(e){throw new Error("Method not implemented.")}getMethod(){return this.methodName}getHost(){return this.host}getAuthContext(){return null!==this.committedCallIndex?this.underlyingCalls[this.committedCallIndex].call.getAuthContext():null}},retryingCall}var subchannelInterface={},hasRequiredSubchannelInterface,hasRequiredInternalChannel,hasRequiredChannel;function requireSubchannelInterface(){if(hasRequiredSubchannelInterface)return subchannelInterface;hasRequiredSubchannelInterface=1,Object.defineProperty(subchannelInterface,"__esModule",{value:!0}),subchannelInterface.BaseSubchannelWrapper=void 0;return subchannelInterface.BaseSubchannelWrapper=class{constructor(e){this.child=e,this.healthy=!0,this.healthListeners=new Set,this.refcount=0,this.dataWatchers=new Set,e.addHealthStateWatcher(e=>{this.healthy&&this.updateHealthListeners()})}updateHealthListeners(){for(const e of this.healthListeners)e(this.isHealthy())}getConnectivityState(){return this.child.getConnectivityState()}addConnectivityStateListener(e){this.child.addConnectivityStateListener(e)}removeConnectivityStateListener(e){this.child.removeConnectivityStateListener(e)}startConnecting(){this.child.startConnecting()}getAddress(){return this.child.getAddress()}throttleKeepalive(e){this.child.throttleKeepalive(e)}ref(){this.child.ref(),this.refcount+=1}unref(){this.child.unref(),this.refcount-=1,0===this.refcount&&this.destroy()}destroy(){for(const e of this.dataWatchers)e.destroy()}getChannelzRef(){return this.child.getChannelzRef()}isHealthy(){return this.healthy&&this.child.isHealthy()}addHealthStateWatcher(e){this.healthListeners.add(e)}removeHealthStateWatcher(e){this.healthListeners.delete(e)}addDataWatcher(e){e.setSubchannel(this.getRealSubchannel()),this.dataWatchers.add(e)}setHealthy(e){e!==this.healthy&&(this.healthy=e,this.child.isHealthy()&&this.updateHealthListeners())}getRealSubchannel(){return this.child.getRealSubchannel()}realSubchannelEquals(e){return this.getRealSubchannel()===e.getRealSubchannel()}getCallCredentials(){return this.child.getCallCredentials()}getChannel(){return this.child.getChannel()}},subchannelInterface}function requireInternalChannel(){return hasRequiredInternalChannel||(hasRequiredInternalChannel=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.InternalChannel=e.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=void 0;const t=requireChannelCredentials(),r=requireResolvingLoadBalancer(),n=requireSubchannelPool(),i=requirePicker(),s=requireMetadata(),a=requireConstants(),o=requireFilterStack(),l=requireCompressionFilter(),c=requireResolver(),u=requireLogging(),h=requireHttp_proxy(),d=requireUriParser(),p=requireConnectivityState(),f=requireChannelz(),g=requireLoadBalancingCall(),v=requireDeadline(),m=requireResolvingCall(),A=requireCallNumber(),y=requireControlPlaneStatus(),C=requireRetryingCall(),S=requireSubchannelInterface(),E=new Map;class _ extends S.BaseSubchannelWrapper{constructor(e,t){super(e),this.channel=t,this.refCount=0,this.subchannelStateListener=(e,r,n,i)=>{t.throttleKeepalive(i)}}ref(){0===this.refCount&&(this.child.addConnectivityStateListener(this.subchannelStateListener),this.channel.addWrappedSubchannel(this)),this.child.ref(),this.refCount+=1}unref(){this.child.unref(),this.refCount-=1,this.refCount<=0&&(this.child.removeConnectivityStateListener(this.subchannelStateListener),this.channel.removeWrappedSubchannel(this))}}class b{pick(e){return{pickResultType:i.PickResultType.DROP,status:{code:a.Status.UNAVAILABLE,details:"Channel closed before call started",metadata:new s.Metadata},subchannel:null,onCallStarted:null,onCallEnded:null}}}e.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX="grpc.internal.no_subchannel";class T{constructor(e){this.target=e,this.trace=new f.ChannelzTrace,this.callTracker=new f.ChannelzCallTracker,this.childrenTracker=new f.ChannelzChildrenTracker,this.state=p.ConnectivityState.IDLE}getChannelzInfoCallback(){return()=>({target:this.target,state:this.state,trace:this.trace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()})}}e.InternalChannel=class{constructor(s,g,v){var m,A,S,b,R,x;if(this.credentials=g,this.options=v,this.connectivityState=p.ConnectivityState.IDLE,this.currentPicker=new i.UnavailablePicker,this.configSelectionQueue=[],this.pickQueue=[],this.connectivityStateWatchers=[],this.callRefTimer=null,this.configSelector=null,this.currentResolutionError=null,this.wrappedSubchannels=new Set,this.callCount=0,this.idleTimer=null,this.channelzEnabled=!0,this.randomChannelId=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER),"string"!=typeof s)throw new TypeError("Channel target must be a string");if(!(g instanceof t.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(v&&"object"!=typeof v)throw new TypeError("Channel options must be an object");this.channelzInfoTracker=new T(s);const w=(0,d.parseUri)(s);if(null===w)throw new Error(`Could not parse target name "${s}"`);const k=(0,c.mapUriDefaultScheme)(w);if(null===k)throw new Error(`Could not find a default scheme for target name "${s}"`);0===this.options["grpc.enable_channelz"]&&(this.channelzEnabled=!1),this.channelzRef=(0,f.registerChannelzChannel)(s,this.channelzInfoTracker.getChannelzInfoCallback(),this.channelzEnabled),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Channel created"),this.options["grpc.default_authority"]?this.defaultAuthority=this.options["grpc.default_authority"]:this.defaultAuthority=(0,c.getDefaultAuthority)(k);const N=(0,h.mapProxyName)(k,v);this.target=N.target,this.options=Object.assign({},this.options,N.extraOptions),this.subchannelPool=(0,n.getSubchannelPool)(0===(null!==(m=this.options["grpc.use_local_subchannel_pool"])&&void 0!==m?m:0)),this.retryBufferTracker=new C.MessageBufferTracker(null!==(A=this.options["grpc.retry_buffer_size"])&&void 0!==A?A:16777216,null!==(S=this.options["grpc.per_rpc_retry_buffer_size"])&&void 0!==S?S:1048576),this.keepaliveTime=null!==(b=this.options["grpc.keepalive_time_ms"])&&void 0!==b?b:-1,this.idleTimeoutMs=Math.max(null!==(R=this.options["grpc.client_idle_timeout_ms"])&&void 0!==R?R:18e5,1e3);const I={createSubchannel:(t,r)=>{const n={};for(const[t,i]of Object.entries(r))t.startsWith(e.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX)||(n[t]=i);const i=this.subchannelPool.getOrCreateSubchannel(this.target,t,n,this.credentials);i.throttleKeepalive(this.keepaliveTime),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Created subchannel or used existing subchannel",i.getChannelzRef());return new _(i,this)},updateState:(e,t)=>{this.currentPicker=t;const r=this.pickQueue.slice();this.pickQueue=[],r.length>0&&this.callRefTimerUnref();for(const e of r)e.doPick();this.updateState(e)},requestReresolution:()=>{throw new Error("Resolving load balancer should never call requestReresolution")},addChannelzChild:e=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.refChild(e)},removeChannelzChild:e=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.unrefChild(e)}};this.resolvingLoadBalancer=new r.ResolvingLoadBalancer(this.target,I,this.options,(e,t)=>{var r;e.retryThrottling?E.set(this.getTarget(),new C.RetryThrottler(e.retryThrottling.maxTokens,e.retryThrottling.tokenRatio,E.get(this.getTarget()))):E.delete(this.getTarget()),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Address resolution succeeded"),null===(r=this.configSelector)||void 0===r||r.unref(),this.configSelector=t,this.currentResolutionError=null,process.nextTick(()=>{const e=this.configSelectionQueue;this.configSelectionQueue=[],e.length>0&&this.callRefTimerUnref();for(const t of e)t.getConfig()})},e=>{this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_WARNING","Address resolution failed with code "+e.code+' and details "'+e.details+'"'),this.configSelectionQueue.length>0&&this.trace("Name resolution failed with calls queued for config selection"),null===this.configSelector&&(this.currentResolutionError=Object.assign(Object.assign({},(0,y.restrictControlPlaneStatusCode)(e.code,e.details)),{metadata:e.metadata}));const t=this.configSelectionQueue;this.configSelectionQueue=[],t.length>0&&this.callRefTimerUnref();for(const r of t)r.reportResolverError(e)}),this.filterStackFactory=new o.FilterStackFactory([new l.CompressionFilterFactory(this,this.options)]),this.trace("Channel constructed with options "+JSON.stringify(v,void 0,2));const O=new Error;(0,u.isTracerEnabled)("channel_stacktrace")&&(0,u.trace)(a.LogVerbosity.DEBUG,"channel_stacktrace","("+this.channelzRef.id+") Channel constructed \n"+(null===(x=O.stack)||void 0===x?void 0:x.substring(O.stack.indexOf("\n")+1))),this.lastActivityTimestamp=new Date}trace(e,t){(0,u.trace)(null!=t?t:a.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+(0,d.uriToString)(this.target)+" "+e)}callRefTimerRef(){var e,t,r,n;this.callRefTimer||(this.callRefTimer=setInterval(()=>{},2147483647)),(null===(t=(e=this.callRefTimer).hasRef)||void 0===t?void 0:t.call(e))||(this.trace("callRefTimer.ref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),null===(n=(r=this.callRefTimer).ref)||void 0===n||n.call(r))}callRefTimerUnref(){var e,t,r;(null===(e=this.callRefTimer)||void 0===e?void 0:e.hasRef)&&!this.callRefTimer.hasRef()||(this.trace("callRefTimer.unref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),null===(r=null===(t=this.callRefTimer)||void 0===t?void 0:t.unref)||void 0===r||r.call(t))}removeConnectivityStateWatcher(e){const t=this.connectivityStateWatchers.findIndex(t=>t===e);t>=0&&this.connectivityStateWatchers.splice(t,1)}updateState(e){(0,u.trace)(a.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+(0,d.uriToString)(this.target)+" "+p.ConnectivityState[this.connectivityState]+" -> "+p.ConnectivityState[e]),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Connectivity state change to "+p.ConnectivityState[e]),this.connectivityState=e,this.channelzInfoTracker.state=e;const t=this.connectivityStateWatchers.slice();for(const r of t)e!==r.currentState&&(r.timer&&clearTimeout(r.timer),this.removeConnectivityStateWatcher(r),r.callback());e!==p.ConnectivityState.TRANSIENT_FAILURE&&(this.currentResolutionError=null)}throttleKeepalive(e){if(e>this.keepaliveTime){this.keepaliveTime=e;for(const t of this.wrappedSubchannels)t.throttleKeepalive(e)}}addWrappedSubchannel(e){this.wrappedSubchannels.add(e)}removeWrappedSubchannel(e){this.wrappedSubchannels.delete(e)}doPick(e,t){return this.currentPicker.pick({metadata:e,extraPickInfo:t})}queueCallForPick(e){this.pickQueue.push(e),this.callRefTimerRef()}getConfig(e,t){return this.connectivityState!==p.ConnectivityState.SHUTDOWN&&this.resolvingLoadBalancer.exitIdle(),this.configSelector?{type:"SUCCESS",config:this.configSelector.invoke(e,t,this.randomChannelId)}:this.currentResolutionError?{type:"ERROR",error:this.currentResolutionError}:{type:"NONE"}}queueCallForConfig(e){this.configSelectionQueue.push(e),this.callRefTimerRef()}enterIdle(){this.resolvingLoadBalancer.destroy(),this.updateState(p.ConnectivityState.IDLE),this.currentPicker=new i.QueuePicker(this.resolvingLoadBalancer),this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null),this.callRefTimer&&(clearInterval(this.callRefTimer),this.callRefTimer=null)}startIdleTimeout(e){var t,r;this.idleTimer=setTimeout(()=>{if(this.callCount>0)return void this.startIdleTimeout(this.idleTimeoutMs);const e=(new Date).valueOf()-this.lastActivityTimestamp.valueOf();e>=this.idleTimeoutMs?(this.trace("Idle timer triggered after "+this.idleTimeoutMs+"ms of inactivity"),this.enterIdle()):this.startIdleTimeout(this.idleTimeoutMs-e)},e),null===(r=(t=this.idleTimer).unref)||void 0===r||r.call(t)}maybeStartIdleTimer(){this.connectivityState===p.ConnectivityState.SHUTDOWN||this.idleTimer||this.startIdleTimeout(this.idleTimeoutMs)}onCallStart(){this.channelzEnabled&&this.channelzInfoTracker.callTracker.addCallStarted(),this.callCount+=1}onCallEnd(e){this.channelzEnabled&&(e.code===a.Status.OK?this.channelzInfoTracker.callTracker.addCallSucceeded():this.channelzInfoTracker.callTracker.addCallFailed()),this.callCount-=1,this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()}createLoadBalancingCall(e,t,r,n,i){const s=(0,A.getNextCallNumber)();return this.trace("createLoadBalancingCall ["+s+'] method="'+t+'"'),new g.LoadBalancingCall(this,e,t,r,n,i,s)}createRetryingCall(e,t,r,n,i){const s=(0,A.getNextCallNumber)();return this.trace("createRetryingCall ["+s+'] method="'+t+'"'),new C.RetryingCall(this,e,t,r,n,i,s,this.retryBufferTracker,E.get(this.getTarget()))}createResolvingCall(e,t,r,n,i){const s=(0,A.getNextCallNumber)();this.trace("createResolvingCall ["+s+'] method="'+e+'", deadline='+(0,v.deadlineToString)(t));const o={deadline:t,flags:null!=i?i:a.Propagate.DEFAULTS,host:null!=r?r:this.defaultAuthority,parentCall:n},l=new m.ResolvingCall(this,e,o,this.filterStackFactory.clone(),s);return this.onCallStart(),l.addStatusWatcher(e=>{this.onCallEnd(e)}),l}close(){var e;this.resolvingLoadBalancer.destroy(),this.updateState(p.ConnectivityState.SHUTDOWN),this.currentPicker=new b;for(const e of this.configSelectionQueue)e.cancelWithStatus(a.Status.UNAVAILABLE,"Channel closed before call started");this.configSelectionQueue=[];for(const e of this.pickQueue)e.cancelWithStatus(a.Status.UNAVAILABLE,"Channel closed before call started");this.pickQueue=[],this.callRefTimer&&clearInterval(this.callRefTimer),this.idleTimer&&clearTimeout(this.idleTimer),this.channelzEnabled&&(0,f.unregisterChannelzRef)(this.channelzRef),this.subchannelPool.unrefUnusedSubchannels(),null===(e=this.configSelector)||void 0===e||e.unref(),this.configSelector=null}getTarget(){return(0,d.uriToString)(this.target)}getConnectivityState(e){const t=this.connectivityState;return e&&(this.resolvingLoadBalancer.exitIdle(),this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()),t}watchConnectivityState(e,t,r){if(this.connectivityState===p.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");let n=null;if(t!==1/0){const e=t instanceof Date?t:new Date(t),s=new Date;if(t===-1/0||e<=s)return void process.nextTick(r,new Error("Deadline passed without connectivity state change"));n=setTimeout(()=>{this.removeConnectivityStateWatcher(i),r(new Error("Deadline passed without connectivity state change"))},e.getTime()-s.getTime())}const i={currentState:e,callback:r,timer:n};this.connectivityStateWatchers.push(i)}getChannelzRef(){return this.channelzRef}createCall(e,t,r,n,i){if("string"!=typeof e)throw new TypeError("Channel#createCall: method must be a string");if(!("number"==typeof t||t instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");if(this.connectivityState===p.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");return this.createResolvingCall(e,t,r,n,i)}getOptions(){return this.options}}}(internalChannel)),internalChannel}function requireChannel(){if(hasRequiredChannel)return channel;hasRequiredChannel=1,Object.defineProperty(channel,"__esModule",{value:!0}),channel.ChannelImplementation=void 0;const e=requireChannelCredentials(),t=requireInternalChannel();return channel.ChannelImplementation=class{constructor(r,n,i){if("string"!=typeof r)throw new TypeError("Channel target must be a string");if(!(n instanceof e.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(i&&"object"!=typeof i)throw new TypeError("Channel options must be an object");this.internalChannel=new t.InternalChannel(r,n,i)}close(){this.internalChannel.close()}getTarget(){return this.internalChannel.getTarget()}getConnectivityState(e){return this.internalChannel.getConnectivityState(e)}watchConnectivityState(e,t,r){this.internalChannel.watchConnectivityState(e,t,r)}getChannelzRef(){return this.internalChannel.getChannelzRef()}createCall(e,t,r,n,i){if("string"!=typeof e)throw new TypeError("Channel#createCall: method must be a string");if(!("number"==typeof t||t instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");return this.internalChannel.createCall(e,t,r,n,i)}},channel}var server={},serverCall={},hasRequiredServerCall;function requireServerCall(){if(hasRequiredServerCall)return serverCall;hasRequiredServerCall=1,Object.defineProperty(serverCall,"__esModule",{value:!0}),serverCall.ServerDuplexStreamImpl=serverCall.ServerWritableStreamImpl=serverCall.ServerReadableStreamImpl=serverCall.ServerUnaryCallImpl=void 0,serverCall.serverErrorToStatus=i;const e=require$$0$4,t=require$$1$2,r=requireConstants(),n=requireMetadata();function i(e,t){var n;const i={code:r.Status.UNKNOWN,details:"message"in e?e.message:"Unknown Error",metadata:null!==(n=null!=t?t:e.metadata)&&void 0!==n?n:null};return"code"in e&&"number"==typeof e.code&&Number.isInteger(e.code)&&(i.code=e.code,"details"in e&&"string"==typeof e.details&&(i.details=e.details)),i}class s extends e.EventEmitter{constructor(e,t,r,n){super(),this.path=e,this.call=t,this.metadata=r,this.request=n,this.cancelled=!1}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}serverCall.ServerUnaryCallImpl=s;class a extends t.Readable{constructor(e,t,r){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=r,this.cancelled=!1}_read(e){this.call.startRead()}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}serverCall.ServerReadableStreamImpl=a;class o extends t.Writable{constructor(e,t,s,a){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=s,this.request=a,this.pendingStatus={code:r.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new n.Metadata,this.on("error",e=>{this.pendingStatus=i(e),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_write(e,t,r){this.call.sendMessage(e,r)}_final(e){var t;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:null!==(t=this.pendingStatus.metadata)&&void 0!==t?t:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}}serverCall.ServerWritableStreamImpl=o;class l extends t.Duplex{constructor(e,t,s){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=s,this.pendingStatus={code:r.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new n.Metadata,this.on("error",e=>{this.pendingStatus=i(e),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_read(e){this.call.startRead()}_write(e,t,r){this.call.sendMessage(e,r)}_final(e){var t;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:null!==(t=this.pendingStatus.metadata)&&void 0!==t?t:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}}return serverCall.ServerDuplexStreamImpl=l,serverCall}var serverCredentials={},hasRequiredServerCredentials;function requireServerCredentials(){if(hasRequiredServerCredentials)return serverCredentials;hasRequiredServerCredentials=1,Object.defineProperty(serverCredentials,"__esModule",{value:!0}),serverCredentials.ServerCredentials=void 0,serverCredentials.createCertificateProviderServerCredentials=function(e,t,r){return new i(e,t,r)},serverCredentials.createServerCredentialsWithInterceptors=function(e,t){return new s(e,t)};const e=requireTlsHelpers();class t{constructor(e,t){this.serverConstructorOptions=e,this.watchers=new Set,this.latestContextOptions=null,this.latestContextOptions=null!=t?t:null}_addWatcher(e){this.watchers.add(e)}_removeWatcher(e){this.watchers.delete(e)}getWatcherCount(){return this.watchers.size}updateSecureContextOptions(e){this.latestContextOptions=e;for(const e of this.watchers)e(this.latestContextOptions)}_isSecure(){return null!==this.serverConstructorOptions}_getSecureContextOptions(){return this.latestContextOptions}_getConstructorOptions(){return this.serverConstructorOptions}_getInterceptors(){return[]}static createInsecure(){return new r}static createSsl(t,r,i=!1){var s;if(null!==t&&!Buffer.isBuffer(t))throw new TypeError("rootCerts must be null or a Buffer");if(!Array.isArray(r))throw new TypeError("keyCertPairs must be an array");if("boolean"!=typeof i)throw new TypeError("checkClientCertificate must be a boolean");const a=[],o=[];for(let e=0;e<r.length;e++){const t=r[e];if(null===t||"object"!=typeof t)throw new TypeError(`keyCertPair[${e}] must be an object`);if(!Buffer.isBuffer(t.private_key))throw new TypeError(`keyCertPair[${e}].private_key must be a Buffer`);if(!Buffer.isBuffer(t.cert_chain))throw new TypeError(`keyCertPair[${e}].cert_chain must be a Buffer`);a.push(t.cert_chain),o.push(t.private_key)}return new n({requestCert:i,ciphers:e.CIPHER_SUITES},{ca:null!==(s=null!=t?t:(0,e.getDefaultRootsData)())&&void 0!==s?s:void 0,cert:a,key:o})}}serverCredentials.ServerCredentials=t;class r extends t{constructor(){super(null)}_getSettings(){return null}_equals(e){return e instanceof r}}class n extends t{constructor(e,t){super(e,t),this.options=Object.assign(Object.assign({},e),t)}_equals(e){if(this===e)return!0;if(!(e instanceof n))return!1;if(Buffer.isBuffer(this.options.ca)&&Buffer.isBuffer(e.options.ca)){if(!this.options.ca.equals(e.options.ca))return!1}else if(this.options.ca!==e.options.ca)return!1;if(Array.isArray(this.options.cert)&&Array.isArray(e.options.cert)){if(this.options.cert.length!==e.options.cert.length)return!1;for(let t=0;t<this.options.cert.length;t++){const r=this.options.cert[t],n=e.options.cert[t];if(Buffer.isBuffer(r)&&Buffer.isBuffer(n)){if(!r.equals(n))return!1}else if(r!==n)return!1}}else if(this.options.cert!==e.options.cert)return!1;if(Array.isArray(this.options.key)&&Array.isArray(e.options.key)){if(this.options.key.length!==e.options.key.length)return!1;for(let t=0;t<this.options.key.length;t++){const r=this.options.key[t],n=e.options.key[t];if(Buffer.isBuffer(r)&&Buffer.isBuffer(n)){if(!r.equals(n))return!1}else if(r!==n)return!1}}else if(this.options.key!==e.options.key)return!1;return this.options.requestCert===e.options.requestCert}}class i extends t{constructor(t,r,n){super({requestCert:null!==r,rejectUnauthorized:n,ciphers:e.CIPHER_SUITES}),this.identityCertificateProvider=t,this.caCertificateProvider=r,this.requireClientCertificate=n,this.latestCaUpdate=null,this.latestIdentityUpdate=null,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this)}_addWatcher(e){var t;0===this.getWatcherCount()&&(null===(t=this.caCertificateProvider)||void 0===t||t.addCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.addIdentityCertificateListener(this.identityCertificateUpdateListener)),super._addWatcher(e)}_removeWatcher(e){var t;super._removeWatcher(e),0===this.getWatcherCount()&&(null===(t=this.caCertificateProvider)||void 0===t||t.removeCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_equals(e){return this===e||e instanceof i&&(this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&this.requireClientCertificate===e.requireClientCertificate)}calculateSecureContextOptions(){var e;return null===this.latestIdentityUpdate||null!==this.caCertificateProvider&&null===this.latestCaUpdate?null:{ca:null===(e=this.latestCaUpdate)||void 0===e?void 0:e.caCertificate,cert:[this.latestIdentityUpdate.certificate],key:[this.latestIdentityUpdate.privateKey]}}finalizeUpdate(){const e=this.calculateSecureContextOptions();this.updateSecureContextOptions(e)}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.finalizeUpdate()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.finalizeUpdate()}}class s extends t{constructor(e,t){super({}),this.childCredentials=e,this.interceptors=t}_isSecure(){return this.childCredentials._isSecure()}_equals(e){if(!(e instanceof s))return!1;if(!this.childCredentials._equals(e.childCredentials))return!1;if(this.interceptors.length!==e.interceptors.length)return!1;for(let t=0;t<this.interceptors.length;t++)if(this.interceptors[t]!==e.interceptors[t])return!1;return!0}_getInterceptors(){return this.interceptors}_addWatcher(e){this.childCredentials._addWatcher(e)}_removeWatcher(e){this.childCredentials._removeWatcher(e)}_getConstructorOptions(){return this.childCredentials._getConstructorOptions()}_getSecureContextOptions(){return this.childCredentials._getSecureContextOptions()}}return serverCredentials}var serverInterceptors={},orca={},duration={},hasRequiredDuration,hasRequiredOrca,hasRequiredServerInterceptors,hasRequiredServer;function requireDuration(){if(hasRequiredDuration)return duration;hasRequiredDuration=1,Object.defineProperty(duration,"__esModule",{value:!0}),duration.durationMessageToDuration=function(e){return{seconds:Number.parseInt(e.seconds),nanos:e.nanos}},duration.msToDuration=function(e){return{seconds:e/1e3|0,nanos:e%1e3*1e6|0}},duration.durationToMs=function(e){return 1e3*e.seconds+e.nanos/1e6|0},duration.isDuration=function(e){return"number"==typeof e.seconds&&"number"==typeof e.nanos},duration.isDurationMessage=function(e){return"string"==typeof e.seconds&&"number"==typeof e.nanos},duration.parseDuration=function(t){const r=t.match(e);if(!r)return null;return{seconds:Number.parseInt(r[1],10),nanos:r[2]?Number.parseInt(r[2].padEnd(9,"0"),10):0}},duration.durationToString=function(e){if(0===e.nanos)return`${e.seconds}s`;let t;t=e.nanos%1e6==0?1e6:e.nanos%1e3==0?1e3:1;return`${e.seconds}.${e.nanos/t}s`};const e=/^(\d+)(?:\.(\d+))?s$/;return duration}function requireOrca(){return hasRequiredOrca||(hasRequiredOrca=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.OrcaOobMetricsSubchannelWrapper=e.GRPC_METRICS_HEADER=e.ServerMetricRecorder=e.PerRequestMetricRecorder=void 0,e.createOrcaClient=c,e.createMetricsReader=function(t,r){return(n,i,s)=>{let a=s.getOpaque(u);if(a)t(a);else{const r=s.get(e.GRPC_METRICS_HEADER);if(r.length>0){a=l().xds.data.orca.v3.OrcaLoadReport.deserialize(r[0]),t(a),s.setOpaque(u,a)}}r&&r(n,i,s)}};const t=requireMakeClient(),r=requireDuration(),n=requireChannelCredentials(),i=requireSubchannelInterface(),s=requireConstants(),a=requireBackoffTimeout(),o=requireConnectivityState();function l(){const e=(0,requireSrc$1().loadSync)("xds/service/orca/v3/orca.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto/xds`,`${__dirname}/../../proto/protoc-gen-validate`]});return(0,t.loadPackageDefinition)(e)}e.PerRequestMetricRecorder=class{constructor(){this.message={}}recordRequestCostMetric(e,t){this.message.request_cost||(this.message.request_cost={}),this.message.request_cost[e]=t}recordUtilizationMetric(e,t){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=t}recordNamedMetric(e,t){this.message.named_metrics||(this.message.named_metrics={}),this.message.named_metrics[e]=t}recordCPUUtilizationMetric(e){this.message.cpu_utilization=e}recordMemoryUtilizationMetric(e){this.message.mem_utilization=e}recordApplicationUtilizationMetric(e){this.message.application_utilization=e}recordQpsMetric(e){this.message.rps_fractional=e}recordEpsMetric(e){this.message.eps=e}serialize(){return l().xds.data.orca.v3.OrcaLoadReport.serialize(this.message)}};function c(e){return new(0,l().xds.service.orca.v3.OpenRcaService)("unused",n.ChannelCredentials.createInsecure(),{channelOverride:e})}e.ServerMetricRecorder=class{constructor(){this.message={},this.serviceImplementation={StreamCoreMetrics:e=>{const t=e.request.report_interval?(0,r.durationToMs)((0,r.durationMessageToDuration)(e.request.report_interval)):3e4,n=setInterval(()=>{e.write(this.message)},t);e.on("cancelled",()=>{clearInterval(n)})}}}putUtilizationMetric(e,t){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=t}setAllUtilizationMetrics(e){this.message.utilization=Object.assign({},e)}deleteUtilizationMetric(e){var t;null===(t=this.message.utilization)||void 0===t||delete t[e]}setCpuUtilizationMetric(e){this.message.cpu_utilization=e}deleteCpuUtilizationMetric(){delete this.message.cpu_utilization}setApplicationUtilizationMetric(e){this.message.application_utilization=e}deleteApplicationUtilizationMetric(){delete this.message.application_utilization}setQpsMetric(e){this.message.rps_fractional=e}deleteQpsMetric(){delete this.message.rps_fractional}setEpsMetric(e){this.message.eps=e}deleteEpsMetric(){delete this.message.eps}addToServer(e){const t=l().xds.service.orca.v3.OpenRcaService.service;e.addService(t,this.serviceImplementation)}},e.GRPC_METRICS_HEADER="endpoint-load-metrics-bin";const u="grpc_orca_load_report";const h="orca_oob_metrics";class d{constructor(e,t){this.metricsListener=e,this.intervalMs=t,this.dataProducer=null}setSubchannel(e){const t=e.getOrCreateDataProducer(h,g);this.dataProducer=t,t.addDataWatcher(this)}destroy(){var e;null===(e=this.dataProducer)||void 0===e||e.removeDataWatcher(this)}getInterval(){return this.intervalMs}onMetricsUpdate(e){this.metricsListener(e)}}class p{constructor(e){this.subchannel=e,this.dataWatchers=new Set,this.orcaSupported=!0,this.metricsCall=null,this.currentInterval=1/0,this.backoffTimer=new a.BackoffTimeout(()=>this.updateMetricsSubscription()),this.subchannelStateListener=()=>this.updateMetricsSubscription();const t=e.getChannel();this.client=c(t),e.addConnectivityStateListener(this.subchannelStateListener)}addDataWatcher(e){this.dataWatchers.add(e),this.updateMetricsSubscription()}removeDataWatcher(e){var t;this.dataWatchers.delete(e),0===this.dataWatchers.size?(this.subchannel.removeDataProducer(h),null===(t=this.metricsCall)||void 0===t||t.cancel(),this.metricsCall=null,this.client.close(),this.subchannel.removeConnectivityStateListener(this.subchannelStateListener)):this.updateMetricsSubscription()}updateMetricsSubscription(){var e;if(0===this.dataWatchers.size||!this.orcaSupported||this.subchannel.getConnectivityState()!==o.ConnectivityState.READY)return;const t=Math.min(...Array.from(this.dataWatchers).map(e=>e.getInterval()));if(!this.metricsCall||t!==this.currentInterval){null===(e=this.metricsCall)||void 0===e||e.cancel(),this.currentInterval=t;const n=this.client.streamCoreMetrics({report_interval:(0,r.msToDuration)(t)});this.metricsCall=n,n.on("data",e=>{this.dataWatchers.forEach(t=>{t.onMetricsUpdate(e)})}),n.on("error",e=>{this.metricsCall=null,e.code!==s.Status.UNIMPLEMENTED?e.code!==s.Status.CANCELLED&&this.backoffTimer.runOnce():this.orcaSupported=!1})}}}class f extends i.BaseSubchannelWrapper{constructor(e,t,r){super(e),this.addDataWatcher(new d(t,r))}getWrappedSubchannel(){return this.child}}function g(e){return new p(e)}e.OrcaOobMetricsSubchannelWrapper=f}(orca)),orca}function requireServerInterceptors(){if(hasRequiredServerInterceptors)return serverInterceptors;hasRequiredServerInterceptors=1,Object.defineProperty(serverInterceptors,"__esModule",{value:!0}),serverInterceptors.BaseServerInterceptingCall=serverInterceptors.ServerInterceptingCall=serverInterceptors.ResponderBuilder=serverInterceptors.ServerListenerBuilder=void 0,serverInterceptors.isInterceptingServerListener=function(e){return void 0!==e.onReceiveMetadata&&1===e.onReceiveMetadata.length},serverInterceptors.getServerInterceptingCall=function(e,t,r,n,i,s){const a={path:i.path,requestStream:"clientStream"===i.type||"bidi"===i.type,responseStream:"serverStream"===i.type||"bidi"===i.type,requestDeserialize:i.deserialize,responseSerialize:i.serialize},o=new b(t,r,n,i,s);return e.reduce((e,t)=>t(a,e),o)};const e=requireMetadata(),t=requireConstants(),r=require$$0$6,n=requireError(),i=require$$0$5,s=requireStreamDecoder(),a=requireLogging(),o=require$$0$1,l=requireOrca(),c="server_call";function u(e){a.trace(t.LogVerbosity.DEBUG,c,e)}serverInterceptors.ServerListenerBuilder=class{constructor(){this.metadata=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveHalfClose(e){return this.halfClose=e,this}withOnCancel(e){return this.cancel=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveHalfClose:this.halfClose,onCancel:this.cancel}}};class h{constructor(e,t){this.listener=e,this.nextListener=t,this.cancelled=!1,this.processingMetadata=!1,this.hasPendingMessage=!1,this.pendingMessage=null,this.processingMessage=!1,this.hasPendingHalfClose=!1}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingHalfClose(){this.hasPendingHalfClose&&(this.nextListener.onReceiveHalfClose(),this.hasPendingHalfClose=!1)}onReceiveMetadata(e){this.cancelled||(this.processingMetadata=!0,this.listener.onReceiveMetadata(e,e=>{this.processingMetadata=!1,this.cancelled||(this.nextListener.onReceiveMetadata(e),this.processPendingMessage(),this.processPendingHalfClose())}))}onReceiveMessage(e){this.cancelled||(this.processingMessage=!0,this.listener.onReceiveMessage(e,e=>{this.processingMessage=!1,this.cancelled||(this.processingMetadata?(this.pendingMessage=e,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(e),this.processPendingHalfClose()))}))}onReceiveHalfClose(){this.cancelled||this.listener.onReceiveHalfClose(()=>{this.cancelled||(this.processingMetadata||this.processingMessage?this.hasPendingHalfClose=!0:this.nextListener.onReceiveHalfClose())})}onCancel(){this.cancelled=!0,this.listener.onCancel(),this.nextListener.onCancel()}}serverInterceptors.ResponderBuilder=class{constructor(){this.start=void 0,this.metadata=void 0,this.message=void 0,this.status=void 0}withStart(e){return this.start=e,this}withSendMetadata(e){return this.metadata=e,this}withSendMessage(e){return this.message=e,this}withSendStatus(e){return this.status=e,this}build(){return{start:this.start,sendMetadata:this.metadata,sendMessage:this.message,sendStatus:this.status}}};const d={onReceiveMetadata:(e,t)=>{t(e)},onReceiveMessage:(e,t)=>{t(e)},onReceiveHalfClose:e=>{e()},onCancel:()=>{}},p={start:e=>{e()},sendMetadata:(e,t)=>{t(e)},sendMessage:(e,t)=>{t(e)},sendStatus:(e,t)=>{t(e)}};serverInterceptors.ServerInterceptingCall=class{constructor(e,t){var r,n,i,s;this.nextCall=e,this.processingMetadata=!1,this.sentMetadata=!1,this.processingMessage=!1,this.pendingMessage=null,this.pendingMessageCallback=null,this.pendingStatus=null,this.responder={start:null!==(r=null==t?void 0:t.start)&&void 0!==r?r:p.start,sendMetadata:null!==(n=null==t?void 0:t.sendMetadata)&&void 0!==n?n:p.sendMetadata,sendMessage:null!==(i=null==t?void 0:t.sendMessage)&&void 0!==i?i:p.sendMessage,sendStatus:null!==(s=null==t?void 0:t.sendStatus)&&void 0!==s?s:p.sendStatus}}processPendingMessage(){this.pendingMessageCallback&&(this.nextCall.sendMessage(this.pendingMessage,this.pendingMessageCallback),this.pendingMessage=null,this.pendingMessageCallback=null)}processPendingStatus(){this.pendingStatus&&(this.nextCall.sendStatus(this.pendingStatus),this.pendingStatus=null)}start(e){this.responder.start(t=>{var r,n,i,s;const a={onReceiveMetadata:null!==(r=null==t?void 0:t.onReceiveMetadata)&&void 0!==r?r:d.onReceiveMetadata,onReceiveMessage:null!==(n=null==t?void 0:t.onReceiveMessage)&&void 0!==n?n:d.onReceiveMessage,onReceiveHalfClose:null!==(i=null==t?void 0:t.onReceiveHalfClose)&&void 0!==i?i:d.onReceiveHalfClose,onCancel:null!==(s=null==t?void 0:t.onCancel)&&void 0!==s?s:d.onCancel},o=new h(a,e);this.nextCall.start(o)})}sendMetadata(e){this.processingMetadata=!0,this.sentMetadata=!0,this.responder.sendMetadata(e,e=>{this.processingMetadata=!1,this.nextCall.sendMetadata(e),this.processPendingMessage(),this.processPendingStatus()})}sendMessage(t,r){this.processingMessage=!0,this.sentMetadata||this.sendMetadata(new e.Metadata),this.responder.sendMessage(t,e=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=e,this.pendingMessageCallback=r):this.nextCall.sendMessage(e,r)})}sendStatus(e){this.responder.sendStatus(e,e=>{this.processingMetadata||this.processingMessage?this.pendingStatus=e:this.nextCall.sendStatus(e)})}startRead(){this.nextCall.startRead()}getPeer(){return this.nextCall.getPeer()}getDeadline(){return this.nextCall.getDeadline()}getHost(){return this.nextCall.getHost()}getAuthContext(){return this.nextCall.getAuthContext()}getConnectionInfo(){return this.nextCall.getConnectionInfo()}getMetricsRecorder(){return this.nextCall.getMetricsRecorder()}};const f="grpc-accept-encoding",g="grpc-encoding",v="grpc-message",m="grpc-status",A="grpc-timeout",y=/(\d{1,8})\s*([HMSmun])/,C={H:36e5,M:6e4,S:1e3,m:1,u:.001,n:1e-6},S={[f]:"identity,deflate,gzip",[g]:"identity"},E={[r.constants.HTTP2_HEADER_STATUS]:r.constants.HTTP_STATUS_OK,[r.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},_={waitForTrailers:!0};class b{constructor(n,i,o,h,d){var p,v;this.stream=n,this.callEventTracker=o,this.handler=h,this.listener=null,this.deadlineTimer=null,this.deadline=1/0,this.maxSendMessageSize=t.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=t.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.cancelled=!1,this.metadataSent=!1,this.wantTrailers=!1,this.cancelNotified=!1,this.incomingEncoding="identity",this.readQueue=[],this.isReadPending=!1,this.receivedHalfClose=!1,this.streamEnded=!1,this.metricsRecorder=new l.PerRequestMetricRecorder,this.stream.once("error",e=>{}),this.stream.once("close",()=>{var e;u("Request to method "+(null===(e=this.handler)||void 0===e?void 0:e.path)+" stream closed with rstCode "+this.stream.rstCode),this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!1),this.callEventTracker.onCallEnd({code:t.Status.CANCELLED,details:"Stream closed before sending status",metadata:null})),this.notifyOnCancel()}),this.stream.on("data",e=>{this.handleDataFrame(e)}),this.stream.pause(),this.stream.on("end",()=>{this.handleEndEvent()}),"grpc.max_send_message_length"in d&&(this.maxSendMessageSize=d["grpc.max_send_message_length"]),"grpc.max_receive_message_length"in d&&(this.maxReceiveMessageSize=d["grpc.max_receive_message_length"]),this.host=null!==(p=i[":authority"])&&void 0!==p?p:i.host,this.decoder=new s.StreamDecoder(this.maxReceiveMessageSize);const m=e.Metadata.fromHttp2Headers(i);a.isTracerEnabled(c)&&u("Request to "+this.handler.path+" received headers "+JSON.stringify(m.toJSON()));const y=m.get(A);y.length>0&&this.handleTimeoutHeader(y[0]);const C=m.get(g);C.length>0&&(this.incomingEncoding=C[0]),m.remove(A),m.remove(g),m.remove(f),m.remove(r.constants.HTTP2_HEADER_ACCEPT_ENCODING),m.remove(r.constants.HTTP2_HEADER_TE),m.remove(r.constants.HTTP2_HEADER_CONTENT_TYPE),this.metadata=m;const S=null===(v=n.session)||void 0===v?void 0:v.socket;this.connectionInfo={localAddress:null==S?void 0:S.localAddress,localPort:null==S?void 0:S.localPort,remoteAddress:null==S?void 0:S.remoteAddress,remotePort:null==S?void 0:S.remotePort},this.shouldSendMetrics=!!d["grpc.server_call_metric_recording"]}handleTimeoutHeader(e){const r=e.toString().match(y);if(null===r){const r={code:t.Status.INTERNAL,details:`Invalid ${A} value "${e}"`,metadata:null};return void process.nextTick(()=>{this.sendStatus(r)})}const n=+r[1]*C[r[2]]|0,i=new Date;this.deadline=i.setMilliseconds(i.getMilliseconds()+n),this.deadlineTimer=setTimeout(()=>{const e={code:t.Status.DEADLINE_EXCEEDED,details:"Deadline exceeded",metadata:null};this.sendStatus(e)},n)}checkCancelled(){return this.cancelled||!this.stream.destroyed&&!this.stream.closed||(this.notifyOnCancel(),this.cancelled=!0),this.cancelled}notifyOnCancel(){this.cancelNotified||(this.cancelNotified=!0,this.cancelled=!0,process.nextTick(()=>{var e;null===(e=this.listener)||void 0===e||e.onCancel()}),this.deadlineTimer&&clearTimeout(this.deadlineTimer),this.stream.resume())}maybeSendMetadata(){this.metadataSent||this.sendMetadata(new e.Metadata)}serializeMessage(e){const t=this.handler.serialize(e),r=t.byteLength,n=Buffer.allocUnsafe(r+5);return n.writeUInt8(0,0),n.writeUInt32BE(r,1),t.copy(n,5),n}decompressMessage(e,r){const n=e.subarray(5);if("identity"===r)return n;if("deflate"===r||"gzip"===r){let e;return e="deflate"===r?i.createInflate():i.createGunzip(),new Promise((r,i)=>{let s=0;const a=[];e.on("data",r=>{a.push(r),s+=r.byteLength,-1!==this.maxReceiveMessageSize&&s>this.maxReceiveMessageSize&&(e.destroy(),i({code:t.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxReceiveMessageSize}`}))}),e.on("end",()=>{r(Buffer.concat(a))}),e.write(n),e.end()})}return Promise.reject({code:t.Status.UNIMPLEMENTED,details:`Received message compressed with unsupported encoding "${r}"`})}async decompressAndMaybePush(e){if("COMPRESSED"!==e.type)throw new Error(`Invalid queue entry type: ${e.type}`);const r=1===e.compressedMessage.readUInt8(0)?this.incomingEncoding:"identity";let n;try{n=await this.decompressMessage(e.compressedMessage,r)}catch(e){return void this.sendStatus(e)}try{e.parsedMessage=this.handler.deserialize(n)}catch(e){return void this.sendStatus({code:t.Status.INTERNAL,details:`Error deserializing request: ${e.message}`})}e.type="READABLE",this.maybePushNextMessage()}maybePushNextMessage(){if(this.listener&&this.isReadPending&&this.readQueue.length>0&&"COMPRESSED"!==this.readQueue[0].type){this.isReadPending=!1;const e=this.readQueue.shift();"READABLE"===e.type?this.listener.onReceiveMessage(e.parsedMessage):this.listener.onReceiveHalfClose()}}handleDataFrame(e){var r;if(this.checkCancelled())return;let n;u("Request to "+this.handler.path+" received data frame of size "+e.length);try{n=this.decoder.write(e)}catch(e){return void this.sendStatus({code:t.Status.RESOURCE_EXHAUSTED,details:e.message})}for(const e of n){this.stream.pause();const t={type:"COMPRESSED",compressedMessage:e,parsedMessage:null};this.readQueue.push(t),this.decompressAndMaybePush(t),null===(r=this.callEventTracker)||void 0===r||r.addMessageReceived()}}handleEndEvent(){this.readQueue.push({type:"HALF_CLOSE",compressedMessage:null,parsedMessage:null}),this.receivedHalfClose=!0,this.maybePushNextMessage()}start(e){u("Request to "+this.handler.path+" start called"),this.checkCancelled()||(this.listener=e,e.onReceiveMetadata(this.metadata))}sendMetadata(e){if(this.checkCancelled())return;if(this.metadataSent)return;this.metadataSent=!0;const t=e?e.toHttp2Headers():null,r=Object.assign(Object.assign(Object.assign({},E),S),t);this.stream.respond(r,_)}sendMessage(e,r){if(this.checkCancelled())return;let i;try{i=this.serializeMessage(e)}catch(e){return void this.sendStatus({code:t.Status.INTERNAL,details:`Error serializing response: ${(0,n.getErrorMessage)(e)}`,metadata:null})}-1!==this.maxSendMessageSize&&i.length-5>this.maxSendMessageSize?this.sendStatus({code:t.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${i.length} vs. ${this.maxSendMessageSize})`,metadata:null}):(this.maybeSendMetadata(),u("Request to "+this.handler.path+" sent data frame of size "+i.length),this.stream.write(i,e=>{var i;e?this.sendStatus({code:t.Status.INTERNAL,details:`Error writing message: ${(0,n.getErrorMessage)(e)}`,metadata:null}):(null===(i=this.callEventTracker)||void 0===i||i.addMessageSent(),r())}))}sendStatus(r){var n,i,s;if(this.checkCancelled())return;u("Request to method "+(null===(n=this.handler)||void 0===n?void 0:n.path)+" ended with status code: "+t.Status[r.code]+" details: "+r.details);const a=null!==(s=null===(i=r.metadata)||void 0===i?void 0:i.clone())&&void 0!==s?s:new e.Metadata;if(this.shouldSendMetrics&&a.set(l.GRPC_METRICS_HEADER,this.metricsRecorder.serialize()),this.metadataSent)this.wantTrailers?this.notifyOnCancel():(this.wantTrailers=!0,this.stream.once("wantTrailers",()=>{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(r));const e=Object.assign({[m]:r.code,[v]:encodeURI(r.details)},a.toHttp2Headers());this.stream.sendTrailers(e),this.notifyOnCancel()}),this.stream.end());else{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(r));const e=Object.assign(Object.assign({[m]:r.code,[v]:encodeURI(r.details)},E),a.toHttp2Headers());this.stream.respond(e,{endStream:!0}),this.notifyOnCancel()}}startRead(){u("Request to "+this.handler.path+" startRead called"),this.checkCancelled()||(this.isReadPending=!0,0===this.readQueue.length?this.receivedHalfClose||this.stream.resume():this.maybePushNextMessage())}getPeer(){var e;const t=null===(e=this.stream.session)||void 0===e?void 0:e.socket;return(null==t?void 0:t.remoteAddress)?t.remotePort?`${t.remoteAddress}:${t.remotePort}`:t.remoteAddress:"unknown"}getDeadline(){return this.deadline}getHost(){return this.host}getAuthContext(){var e;if((null===(e=this.stream.session)||void 0===e?void 0:e.socket)instanceof o.TLSSocket){const e=this.stream.session.socket.getPeerCertificate();return{transportSecurityType:"ssl",sslPeerCertificate:e.raw?e:void 0}}return{}}getConnectionInfo(){return this.connectionInfo}getMetricsRecorder(){return this.metricsRecorder}}return serverInterceptors.BaseServerInterceptingCall=b,serverInterceptors}function requireServer(){if(hasRequiredServer)return server;hasRequiredServer=1;var e=server&&server.__runInitializers||function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},t=server&&server.__esDecorate||function(e,t,r,n,i,s){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?n.static?e:e.prototype:null,h=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),d=!1,p=r.length-1;p>=0;p--){var f={};for(var g in n)f[g]="access"===g?{}:n[g];for(var g in n.access)f.access[g]=n.access[g];f.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(e||null))};var v=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(o=a(v.get))&&(h.get=o),(o=a(v.set))&&(h.set=o),(o=a(v.init))&&i.unshift(o)}else(o=a(v))&&("field"===l?i.unshift(o):h[c]=o)}u&&Object.defineProperty(u,n.name,h),d=!0};Object.defineProperty(server,"__esModule",{value:!0}),server.Server=void 0;const r=require$$0$6,n=require$$1$5,i=requireConstants(),s=requireServerCall(),a=requireServerCredentials(),o=requireResolver(),l=requireLogging(),c=requireSubchannelAddress(),u=requireUriParser(),h=requireChannelz(),d=requireServerInterceptors(),p=2147483647,f=2147483647,g=2147483647,{HTTP2_HEADER_PATH:v}=r.constants,m=Buffer.from("max_age");function A(e){l.trace(i.LogVerbosity.DEBUG,"server_call",e)}function y(){}function C(e){return function(t,r){return n.deprecate(t,e)}}function S(e){return{code:i.Status.UNIMPLEMENTED,details:`The server does not implement the method ${e}`}}let E=(()=>{var n;let E,_=[];return n=class{constructor(t){var r,n,i,s,a,o;this.boundPorts=(e(this,_),new Map),this.http2Servers=new Map,this.sessionIdleTimeouts=new Map,this.handlers=new Map,this.sessions=new Map,this.started=!1,this.shutdown=!1,this.serverAddressString="null",this.channelzEnabled=!0,this.options=null!=t?t:{},0===this.options["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.channelzTrace=new h.ChannelzTraceStub,this.callTracker=new h.ChannelzCallTrackerStub,this.listenerChildrenTracker=new h.ChannelzChildrenTrackerStub,this.sessionChildrenTracker=new h.ChannelzChildrenTrackerStub):(this.channelzTrace=new h.ChannelzTrace,this.callTracker=new h.ChannelzCallTracker,this.listenerChildrenTracker=new h.ChannelzChildrenTracker,this.sessionChildrenTracker=new h.ChannelzChildrenTracker),this.channelzRef=(0,h.registerChannelzServer)("server",()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Server created"),this.maxConnectionAgeMs=null!==(r=this.options["grpc.max_connection_age_ms"])&&void 0!==r?r:p,this.maxConnectionAgeGraceMs=null!==(n=this.options["grpc.max_connection_age_grace_ms"])&&void 0!==n?n:p,this.keepaliveTimeMs=null!==(i=this.options["grpc.keepalive_time_ms"])&&void 0!==i?i:f,this.keepaliveTimeoutMs=null!==(s=this.options["grpc.keepalive_timeout_ms"])&&void 0!==s?s:2e4,this.sessionIdleTimeout=null!==(a=this.options["grpc.max_connection_idle_ms"])&&void 0!==a?a:g,this.commonServerOptions={maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER},"grpc-node.max_session_memory"in this.options?this.commonServerOptions.maxSessionMemory=this.options["grpc-node.max_session_memory"]:this.commonServerOptions.maxSessionMemory=Number.MAX_SAFE_INTEGER,"grpc.max_concurrent_streams"in this.options&&(this.commonServerOptions.settings={maxConcurrentStreams:this.options["grpc.max_concurrent_streams"]}),this.interceptors=null!==(o=this.options.interceptors)&&void 0!==o?o:[],this.trace("Server constructed")}getChannelzInfo(){return{trace:this.channelzTrace,callTracker:this.callTracker,listenerChildren:this.listenerChildrenTracker.getChildLists(),sessionChildren:this.sessionChildrenTracker.getChildLists()}}getChannelzSessionInfo(e){var t,r,n;const i=this.sessions.get(e),s=e.socket,a=s.remoteAddress?(0,c.stringToSubchannelAddress)(s.remoteAddress,s.remotePort):null,o=s.localAddress?(0,c.stringToSubchannelAddress)(s.localAddress,s.localPort):null;let l;if(e.encrypted){const e=s,r=e.getCipher(),n=e.getCertificate(),i=e.getPeerCertificate();l={cipherSuiteStandardName:null!==(t=r.standardName)&&void 0!==t?t:null,cipherSuiteOtherName:r.standardName?null:r.name,localCertificate:n&&"raw"in n?n.raw:null,remoteCertificate:i&&"raw"in i?i.raw:null}}else l=null;return{remoteAddress:a,localAddress:o,security:l,remoteName:null,streamsStarted:i.streamTracker.callsStarted,streamsSucceeded:i.streamTracker.callsSucceeded,streamsFailed:i.streamTracker.callsFailed,messagesSent:i.messagesSent,messagesReceived:i.messagesReceived,keepAlivesSent:i.keepAlivesSent,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:i.streamTracker.lastCallStartedTimestamp,lastMessageSentTimestamp:i.lastMessageSentTimestamp,lastMessageReceivedTimestamp:i.lastMessageReceivedTimestamp,localFlowControlWindow:null!==(r=e.state.localWindowSize)&&void 0!==r?r:null,remoteFlowControlWindow:null!==(n=e.state.remoteWindowSize)&&void 0!==n?n:null}}trace(e){l.trace(i.LogVerbosity.DEBUG,"server","("+this.channelzRef.id+") "+e)}keepaliveTrace(e){l.trace(i.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+e)}addProtoService(){throw new Error("Not implemented. Use addService() instead")}addService(e,t){if(null===e||"object"!=typeof e||null===t||"object"!=typeof t)throw new Error("addService() requires two objects as arguments");const r=Object.keys(e);if(0===r.length)throw new Error("Cannot add an empty service to a server");r.forEach(r=>{const n=e[r];let i;i=n.requestStream?n.responseStream?"bidi":"clientStream":n.responseStream?"serverStream":"unary";let s,a=t[r];void 0===a&&"string"==typeof n.originalName&&(a=t[n.originalName]),s=void 0!==a?a.bind(t):function(e,t){const r=S(t);switch(e){case"unary":case"clientStream":return(e,t)=>{t(r,null)};case"serverStream":case"bidi":return e=>{e.emit("error",r)};default:throw new Error(`Invalid handlerType ${e}`)}}(i,r);if(!1===this.register(n.path,s,n.responseSerialize,n.requestDeserialize,i))throw new Error(`Method handler for ${n.path} already provided.`)})}removeService(e){if(null===e||"object"!=typeof e)throw new Error("removeService() requires object as argument");Object.keys(e).forEach(t=>{const r=e[t];this.unregister(r.path)})}bind(e,t){throw new Error("Not implemented. Use bindAsync() instead")}experimentalRegisterListenerToChannelz(e){return(0,h.registerChannelzSocket)((0,c.subchannelAddressToString)(e),()=>({localAddress:e,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalUnregisterListenerFromChannelz(e){(0,h.unregisterChannelzRef)(e)}createHttp2Server(e){let t;if(e._isSecure()){const n=e._getConstructorOptions(),s=e._getSecureContextOptions(),a=Object.assign(Object.assign(Object.assign(Object.assign({},this.commonServerOptions),n),s),{enableTrace:1===this.options["grpc-node.tls_enable_trace"]});let o=null!==s;this.trace("Initial credentials valid: "+o),t=r.createSecureServer(a),t.prependListener("connection",e=>{o||(this.trace("Dropped connection from "+JSON.stringify(e.address())+" due to unloaded credentials"),e.destroy())}),t.on("secureConnection",e=>{e.on("error",e=>{this.trace("An incoming TLS connection closed with error: "+e.message)})});const c=e=>{if(e){const r=t;try{r.setSecureContext(e)}catch(t){l.log(i.LogVerbosity.ERROR,"Failed to set secure context with error "+t.message),e=null}}o=null!==e,this.trace("Post-update credentials valid: "+o)};e._addWatcher(c),t.on("close",()=>{e._removeWatcher(c)})}else t=r.createServer(this.commonServerOptions);return t.setTimeout(0,y),this._setupHandlers(t,e._getInterceptors()),t}bindOneAddress(e,t){this.trace("Attempting to bind "+(0,c.subchannelAddressToString)(e));const r=this.createHttp2Server(t.credentials);return new Promise((n,i)=>{const s=t=>{this.trace("Failed to bind "+(0,c.subchannelAddressToString)(e)+" with error "+t.message),n({port:"port"in e?e.port:1,error:t.message})};r.once("error",s),r.listen(e,()=>{const e=r.address();let i;i="string"==typeof e?{path:e}:{host:e.address,port:e.port};const a=this.experimentalRegisterListenerToChannelz(i);this.listenerChildrenTracker.refChild(a),this.http2Servers.set(r,{channelzRef:a,sessions:new Set,ownsChannelzRef:!0}),t.listeningServers.add(r),this.trace("Successfully bound "+(0,c.subchannelAddressToString)(i)),n({port:"port"in i?i.port:1}),r.removeListener("error",s)})})}async bindManyPorts(e,t){if(0===e.length)return{count:0,port:0,errors:[]};if((0,c.isTcpSubchannelAddress)(e[0])&&0===e[0].port){const r=await this.bindOneAddress(e[0],t);if(r.error){const n=await this.bindManyPorts(e.slice(1),t);return Object.assign(Object.assign({},n),{errors:[r.error,...n.errors]})}{const n=e.slice(1).map(e=>(0,c.isTcpSubchannelAddress)(e)?{host:e.host,port:r.port}:e),i=await Promise.all(n.map(e=>this.bindOneAddress(e,t))),s=[r,...i];return{count:s.filter(e=>void 0===e.error).length,port:r.port,errors:s.filter(e=>e.error).map(e=>e.error)}}}{const r=await Promise.all(e.map(e=>this.bindOneAddress(e,t)));return{count:r.filter(e=>void 0===e.error).length,port:r[0].port,errors:r.filter(e=>e.error).map(e=>e.error)}}}async bindAddressList(e,t){const r=await this.bindManyPorts(e,t);if(r.count>0)return r.count<e.length&&l.log(i.LogVerbosity.INFO,`WARNING Only ${r.count} addresses added out of total ${e.length} resolved`),r.port;{const t=`No address added out of total ${e.length} resolved`;throw l.log(i.LogVerbosity.ERROR,t),new Error(`${t} errors: [${r.errors.join(",")}]`)}}resolvePort(e){return new Promise((t,r)=>{let n=!1;(0,o.createResolver)(e,(i,s,a,o)=>{if(n)return!0;if(n=!0,!i.ok)return r(new Error(i.error.details)),!0;const l=[].concat(...i.value.map(e=>e.addresses));return 0===l.length?(r(new Error(`No addresses resolved for port ${e}`)),!0):(t(l),!0)},this.options).updateResolution()})}async bindPort(e,t){const r=await this.resolvePort(e);if(t.cancelled)throw this.completeUnbind(t),new Error("bindAsync operation cancelled by unbind call");const n=await this.bindAddressList(r,t);if(t.cancelled)throw this.completeUnbind(t),new Error("bindAsync operation cancelled by unbind call");return n}normalizePort(e){const t=(0,u.parseUri)(e);if(null===t)throw new Error(`Could not parse port "${e}"`);const r=(0,o.mapUriDefaultScheme)(t);if(null===r)throw new Error(`Could not get a default scheme for port "${e}"`);return r}bindAsync(e,t,r){if(this.shutdown)throw new Error("bindAsync called after shutdown");if("string"!=typeof e)throw new TypeError("port must be a string");if(null===t||!(t instanceof a.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");if("function"!=typeof r)throw new TypeError("callback must be a function");this.trace("bindAsync port="+e);const n=this.normalizePort(e),i=(e,t)=>{process.nextTick(()=>r(e,t))};let s=this.boundPorts.get((0,u.uriToString)(n));if(s)return t._equals(s.credentials)?(s.cancelled=!1,void(s.completionPromise?s.completionPromise.then(e=>r(null,e),e=>r(e,0)):i(null,s.portNumber))):void i(new Error(`${e} already bound with incompatible credentials`),0);s={mapKey:(0,u.uriToString)(n),originalUri:n,completionPromise:null,cancelled:!1,portNumber:0,credentials:t,listeningServers:new Set};const o=(0,u.splitHostPort)(n.path),l=this.bindPort(n,s);s.completionPromise=l,0===(null==o?void 0:o.port)?l.then(e=>{const t={scheme:n.scheme,authority:n.authority,path:(0,u.combineHostPort)({host:o.host,port:e})};s.mapKey=(0,u.uriToString)(t),s.completionPromise=null,s.portNumber=e,this.boundPorts.set(s.mapKey,s),r(null,e)},e=>{r(e,0)}):(this.boundPorts.set(s.mapKey,s),l.then(e=>{s.completionPromise=null,s.portNumber=e,r(null,e)},e=>{r(e,0)}))}registerInjectorToChannelz(){return(0,h.registerChannelzSocket)("injector",()=>({localAddress:null,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalCreateConnectionInjectorWithChannelzRef(e,t,n=!1){if(null===e||!(e instanceof a.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");this.channelzEnabled&&this.listenerChildrenTracker.refChild(t);const i=this.createHttp2Server(e),s=new Set;return this.http2Servers.set(i,{channelzRef:t,sessions:s,ownsChannelzRef:n}),{injectConnection:e=>{i.emit("connection",e)},drain:e=>{var t,n;for(const e of s)this.closeSession(e);null===(n=(t=setTimeout(()=>{for(const e of s)e.destroy(r.constants.NGHTTP2_CANCEL)},e)).unref)||void 0===n||n.call(t)},destroy:()=>{this.closeServer(i);for(const e of s)this.closeSession(e)}}}createConnectionInjector(e){if(null===e||!(e instanceof a.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");const t=this.registerInjectorToChannelz();return this.experimentalCreateConnectionInjectorWithChannelzRef(e,t,!0)}closeServer(e,t){this.trace("Closing server with address "+JSON.stringify(e.address()));const r=this.http2Servers.get(e);e.close(()=>{r&&r.ownsChannelzRef&&(this.listenerChildrenTracker.unrefChild(r.channelzRef),(0,h.unregisterChannelzRef)(r.channelzRef)),this.http2Servers.delete(e),null==t||t()})}closeSession(e,t){var r;this.trace("Closing session initiated by "+(null===(r=e.socket)||void 0===r?void 0:r.remoteAddress));const n=this.sessions.get(e),i=()=>{n&&(this.sessionChildrenTracker.unrefChild(n.ref),(0,h.unregisterChannelzRef)(n.ref)),null==t||t()};e.closed?queueMicrotask(i):e.close(i)}completeUnbind(e){for(const t of e.listeningServers){const r=this.http2Servers.get(t);if(this.closeServer(t,()=>{e.listeningServers.delete(t)}),r)for(const e of r.sessions)this.closeSession(e)}this.boundPorts.delete(e.mapKey)}unbind(e){this.trace("unbind port="+e);const t=this.normalizePort(e),r=(0,u.splitHostPort)(t.path);if(0===(null==r?void 0:r.port))throw new Error("Cannot unbind port 0");const n=this.boundPorts.get((0,u.uriToString)(t));n&&(this.trace("unbinding "+n.mapKey+" originally bound as "+(0,u.uriToString)(n.originalUri)),n.completionPromise?n.cancelled=!0:this.completeUnbind(n))}drain(e,t){var n,i;this.trace("drain port="+e+" graceTimeMs="+t);const s=this.normalizePort(e),a=(0,u.splitHostPort)(s.path);if(0===(null==a?void 0:a.port))throw new Error("Cannot drain port 0");const o=this.boundPorts.get((0,u.uriToString)(s));if(!o)return;const l=new Set;for(const e of o.listeningServers){const t=this.http2Servers.get(e);if(t)for(const e of t.sessions)l.add(e),this.closeSession(e,()=>{l.delete(e)})}null===(i=(n=setTimeout(()=>{for(const e of l)e.destroy(r.constants.NGHTTP2_CANCEL)},t)).unref)||void 0===i||i.call(n)}forceShutdown(){for(const e of this.boundPorts.values())e.cancelled=!0;this.boundPorts.clear();for(const e of this.http2Servers.keys())this.closeServer(e);this.sessions.forEach((e,t)=>{this.closeSession(t),t.destroy(r.constants.NGHTTP2_CANCEL)}),this.sessions.clear(),(0,h.unregisterChannelzRef)(this.channelzRef),this.shutdown=!0}register(e,t,r,n,i){return!this.handlers.has(e)&&(this.handlers.set(e,{func:t,serialize:r,deserialize:n,type:i,path:e}),!0)}unregister(e){return this.handlers.delete(e)}start(){if(0===this.http2Servers.size||[...this.http2Servers.keys()].every(e=>!e.listening))throw new Error("server must be bound in order to start");if(!0===this.started)throw new Error("server is already started");this.started=!0}tryShutdown(e){var t;const r=t=>{(0,h.unregisterChannelzRef)(this.channelzRef),e(t)};let n=0;function i(){n--,0===n&&r()}this.shutdown=!0;for(const[e,r]of this.http2Servers.entries()){n++;const s=r.channelzRef.name;this.trace("Waiting for server "+s+" to close"),this.closeServer(e,()=>{this.trace("Server "+s+" finished closing"),i()});for(const e of r.sessions.keys()){n++;const r=null===(t=e.socket)||void 0===t?void 0:t.remoteAddress;this.trace("Waiting for session "+r+" to close"),this.closeSession(e,()=>{this.trace("Session "+r+" finished closing"),i()})}}0===n&&r()}addHttp2Port(){throw new Error("Not yet implemented")}getChannelzRef(){return this.channelzRef}_verifyContentType(e,t){const n=t[r.constants.HTTP2_HEADER_CONTENT_TYPE];return!("string"!=typeof n||!n.startsWith("application/grpc"))||(e.respond({[r.constants.HTTP2_HEADER_STATUS]:r.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE},{endStream:!0}),!1)}_retrieveHandler(e){A("Received call to method "+e+" at address "+this.serverAddressString);const t=this.handlers.get(e);return void 0===t?(A("No handler registered for method "+e+". Sending UNIMPLEMENTED status."),null):t}_respondWithError(e,t,n=null){var s,a;const o=Object.assign({"grpc-status":null!==(s=e.code)&&void 0!==s?s:i.Status.INTERNAL,"grpc-message":e.details,[r.constants.HTTP2_HEADER_STATUS]:r.constants.HTTP_STATUS_OK,[r.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},null===(a=e.metadata)||void 0===a?void 0:a.toHttp2Headers());t.respond(o,{endStream:!0}),this.callTracker.addCallFailed(),null==n||n.streamTracker.addCallFailed()}_channelzHandler(e,t,r){this.onStreamOpened(t);const n=this.sessions.get(t.session);if(this.callTracker.addCallStarted(),null==n||n.streamTracker.addCallStarted(),!this._verifyContentType(t,r))return this.callTracker.addCallFailed(),void(null==n||n.streamTracker.addCallFailed());const s=r[v],a=this._retrieveHandler(s);if(!a)return void this._respondWithError(S(s),t,n);const o={addMessageSent:()=>{n&&(n.messagesSent+=1,n.lastMessageSentTimestamp=new Date)},addMessageReceived:()=>{n&&(n.messagesReceived+=1,n.lastMessageReceivedTimestamp=new Date)},onCallEnd:e=>{e.code===i.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()},onStreamEnd:e=>{n&&(e?n.streamTracker.addCallSucceeded():n.streamTracker.addCallFailed())}},l=(0,d.getServerInterceptingCall)([...e,...this.interceptors],t,r,o,a,this.options);this._runHandlerForCall(l,a)||(this.callTracker.addCallFailed(),null==n||n.streamTracker.addCallFailed(),l.sendStatus({code:i.Status.INTERNAL,details:`Unknown handler type: ${a.type}`}))}_streamHandler(e,t,r){if(this.onStreamOpened(t),!0!==this._verifyContentType(t,r))return;const n=r[v],s=this._retrieveHandler(n);if(!s)return void this._respondWithError(S(n),t,null);const a=(0,d.getServerInterceptingCall)([...e,...this.interceptors],t,r,null,s,this.options);this._runHandlerForCall(a,s)||a.sendStatus({code:i.Status.INTERNAL,details:`Unknown handler type: ${s.type}`})}_runHandlerForCall(e,t){const{type:r}=t;if("unary"===r)!async function(e,t){let r,n;function a(t,r,n,a){t?e.sendStatus((0,s.serverErrorToStatus)(t,n)):e.sendMessage(r,()=>{e.sendStatus({code:i.Status.OK,details:"OK",metadata:null!=n?n:null})})}let o=null;e.start({onReceiveMetadata(t){n=t,e.startRead()},onReceiveMessage(r){o?e.sendStatus({code:i.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${t.path}`,metadata:null}):(o=r,e.startRead())},onReceiveHalfClose(){if(o){r=new s.ServerWritableStreamImpl(t.path,e,n,o);try{t.func(r,a)}catch(t){e.sendStatus({code:i.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}}else e.sendStatus({code:i.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${t.path}`,metadata:null})},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"))}})}(e,t);else if("clientStream"===r)!function(e,t){let r;function n(t,r,n,a){t?e.sendStatus((0,s.serverErrorToStatus)(t,n)):e.sendMessage(r,()=>{e.sendStatus({code:i.Status.OK,details:"OK",metadata:null!=n?n:null})})}e.start({onReceiveMetadata(a){r=new s.ServerDuplexStreamImpl(t.path,e,a);try{t.func(r,n)}catch(t){e.sendStatus({code:i.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}},onReceiveMessage(e){r.push(e)},onReceiveHalfClose(){r.push(null)},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}(e,t);else if("serverStream"===r)!function(e,t){let r,n,a=null;e.start({onReceiveMetadata(t){n=t,e.startRead()},onReceiveMessage(r){a?e.sendStatus({code:i.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${t.path}`,metadata:null}):(a=r,e.startRead())},onReceiveHalfClose(){if(a){r=new s.ServerWritableStreamImpl(t.path,e,n,a);try{t.func(r)}catch(t){e.sendStatus({code:i.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}}else e.sendStatus({code:i.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${t.path}`,metadata:null})},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}(e,t);else{if("bidi"!==r)return!1;!function(e,t){let r;e.start({onReceiveMetadata(n){r=new s.ServerDuplexStreamImpl(t.path,e,n);try{t.func(r)}catch(t){e.sendStatus({code:i.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}},onReceiveMessage(e){r.push(e)},onReceiveHalfClose(){r.push(null)},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}(e,t)}return!0}_setupHandlers(e,t){if(null===e)return;const r=e.address();let n="null";r&&(n="string"==typeof r?r:r.address+":"+r.port),this.serverAddressString=n;const i=this.channelzEnabled?this._channelzHandler:this._streamHandler,s=this.channelzEnabled?this._channelzSessionHandler(e):this._sessionHandler(e);e.on("stream",i.bind(this,t)),e.on("session",s)}_sessionHandler(e){return t=>{var n,i;null===(n=this.http2Servers.get(e))||void 0===n||n.sessions.add(t);let s=null,a=null,o=null,l=!1;const c=this.enableIdleTimeout(t);if(this.maxConnectionAgeMs!==p){const e=this.maxConnectionAgeMs/10,n=Math.random()*e*2-e;s=setTimeout(()=>{var e,n;l=!0,this.trace("Connection dropped by max connection age: "+(null===(e=t.socket)||void 0===e?void 0:e.remoteAddress));try{t.goaway(r.constants.NGHTTP2_NO_ERROR,~(1<<31),m)}catch(e){return void t.destroy()}t.close(),this.maxConnectionAgeGraceMs!==p&&(a=setTimeout(()=>{t.destroy()},this.maxConnectionAgeGraceMs),null===(n=a.unref)||void 0===n||n.call(a))},this.maxConnectionAgeMs+n),null===(i=s.unref)||void 0===i||i.call(s)}const u=()=>{o&&(clearTimeout(o),o=null)},h=()=>!t.destroyed&&this.keepaliveTimeMs<f&&this.keepaliveTimeMs>0;let d;const g=()=>{var e;h()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),o=setTimeout(()=>{u(),d()},this.keepaliveTimeMs),null===(e=o.unref)||void 0===e||e.call(o))};d=()=>{var e;if(!h())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let r="";try{t.ping((e,r,n)=>{u(),e?(this.keepaliveTrace("Ping failed with error: "+e.message),l=!0,t.destroy()):(this.keepaliveTrace("Received ping response"),g())})||(r="Ping returned false")}catch(e){r=(e instanceof Error?e.message:"")||"Unknown error"}if(r)return this.keepaliveTrace("Ping send failed: "+r),this.trace("Connection dropped due to ping send error: "+r),l=!0,void t.destroy();o=setTimeout(()=>{u(),this.keepaliveTrace("Ping timeout passed without response"),this.trace("Connection dropped by keepalive timeout"),l=!0,t.destroy()},this.keepaliveTimeoutMs),null===(e=o.unref)||void 0===e||e.call(o)},g(),t.on("close",()=>{var r,n;l||this.trace(`Connection dropped by client ${null===(r=t.socket)||void 0===r?void 0:r.remoteAddress}`),s&&clearTimeout(s),a&&clearTimeout(a),u(),null!==c&&(clearTimeout(c.timeout),this.sessionIdleTimeouts.delete(t)),null===(n=this.http2Servers.get(e))||void 0===n||n.sessions.delete(t)})}}_channelzSessionHandler(e){return t=>{var n,i,s,a;const o=(0,h.registerChannelzSocket)(null!==(i=null===(n=t.socket)||void 0===n?void 0:n.remoteAddress)&&void 0!==i?i:"unknown",this.getChannelzSessionInfo.bind(this,t),this.channelzEnabled),l={ref:o,streamTracker:new h.ChannelzCallTracker,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null};null===(s=this.http2Servers.get(e))||void 0===s||s.sessions.add(t),this.sessions.set(t,l);const c=`${t.socket.remoteAddress}:${t.socket.remotePort}`;this.channelzTrace.addTrace("CT_INFO","Connection established by client "+c),this.trace("Connection established by client "+c),this.sessionChildrenTracker.refChild(o);let u=null,d=null,g=null,v=!1;const A=this.enableIdleTimeout(t);if(this.maxConnectionAgeMs!==p){const e=this.maxConnectionAgeMs/10,n=Math.random()*e*2-e;u=setTimeout(()=>{var e;v=!0,this.channelzTrace.addTrace("CT_INFO","Connection dropped by max connection age from "+c);try{t.goaway(r.constants.NGHTTP2_NO_ERROR,~(1<<31),m)}catch(e){return void t.destroy()}t.close(),this.maxConnectionAgeGraceMs!==p&&(d=setTimeout(()=>{t.destroy()},this.maxConnectionAgeGraceMs),null===(e=d.unref)||void 0===e||e.call(d))},this.maxConnectionAgeMs+n),null===(a=u.unref)||void 0===a||a.call(u)}const y=()=>{g&&(clearTimeout(g),g=null)},C=()=>!t.destroyed&&this.keepaliveTimeMs<f&&this.keepaliveTimeMs>0;let S;const E=()=>{var e;C()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),g=setTimeout(()=>{y(),S()},this.keepaliveTimeMs),null===(e=g.unref)||void 0===e||e.call(g))};S=()=>{var e;if(!C())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let r="";try{const e=t.ping((e,r,n)=>{y(),e?(this.keepaliveTrace("Ping failed with error: "+e.message),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to error of a ping frame "+e.message+" return in "+r),v=!0,t.destroy()):(this.keepaliveTrace("Received ping response"),E())});e||(r="Ping returned false")}catch(e){r=(e instanceof Error?e.message:"")||"Unknown error"}if(r)return this.keepaliveTrace("Ping send failed: "+r),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to ping send error: "+r),v=!0,void t.destroy();l.keepAlivesSent+=1,g=setTimeout(()=>{y(),this.keepaliveTrace("Ping timeout passed without response"),this.channelzTrace.addTrace("CT_INFO","Connection dropped by keepalive timeout from "+c),v=!0,t.destroy()},this.keepaliveTimeoutMs),null===(e=g.unref)||void 0===e||e.call(g)},E(),t.on("close",()=>{var r;v||this.channelzTrace.addTrace("CT_INFO","Connection dropped by client "+c),this.sessionChildrenTracker.unrefChild(o),(0,h.unregisterChannelzRef)(o),u&&clearTimeout(u),d&&clearTimeout(d),y(),null!==A&&(clearTimeout(A.timeout),this.sessionIdleTimeouts.delete(t)),null===(r=this.http2Servers.get(e))||void 0===r||r.sessions.delete(t),this.sessions.delete(t)})}}enableIdleTimeout(e){var t,r;if(this.sessionIdleTimeout>=g)return null;const n={activeStreams:0,lastIdle:Date.now(),onClose:this.onStreamClose.bind(this,e),timeout:setTimeout(this.onIdleTimeout,this.sessionIdleTimeout,this,e)};null===(r=(t=n.timeout).unref)||void 0===r||r.call(t),this.sessionIdleTimeouts.set(e,n);const{socket:i}=e;return this.trace("Enable idle timeout for "+i.remoteAddress+":"+i.remotePort),n}onIdleTimeout(e,t){const{socket:r}=t,n=e.sessionIdleTimeouts.get(t);void 0!==n&&0===n.activeStreams&&(Date.now()-n.lastIdle>=e.sessionIdleTimeout?(e.trace("Session idle timeout triggered for "+(null==r?void 0:r.remoteAddress)+":"+(null==r?void 0:r.remotePort)+" last idle at "+n.lastIdle),e.closeSession(t)):n.timeout.refresh())}onStreamOpened(e){const t=e.session,r=this.sessionIdleTimeouts.get(t);r&&(r.activeStreams+=1,e.once("close",r.onClose))}onStreamClose(e){var t,r;const n=this.sessionIdleTimeouts.get(e);n&&(n.activeStreams-=1,0===n.activeStreams&&(n.lastIdle=Date.now(),n.timeout.refresh(),this.trace("Session onStreamClose"+(null===(t=e.socket)||void 0===t?void 0:t.remoteAddress)+":"+(null===(r=e.socket)||void 0===r?void 0:r.remotePort)+" at "+n.lastIdle)))}},(()=>{const e="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;E=[C("Calling start() is no longer necessary. It can be safely omitted.")],t(n,null,E,{kind:"method",name:"start",static:!1,private:!1,access:{has:e=>"start"in e,get:e=>e.start},metadata:e},null,_),e&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})})(),n})();return server.Server=E,server}var statusBuilder={},hasRequiredStatusBuilder;function requireStatusBuilder(){if(hasRequiredStatusBuilder)return statusBuilder;hasRequiredStatusBuilder=1,Object.defineProperty(statusBuilder,"__esModule",{value:!0}),statusBuilder.StatusBuilder=void 0;return statusBuilder.StatusBuilder=class{constructor(){this.code=null,this.details=null,this.metadata=null}withCode(e){return this.code=e,this}withDetails(e){return this.details=e,this}withMetadata(e){return this.metadata=e,this}build(){const e={};return null!==this.code&&(e.code=this.code),null!==this.details&&(e.details=this.details),null!==this.metadata&&(e.metadata=this.metadata),e}},statusBuilder}var experimental={},loadBalancerPickFirst={},hasRequiredLoadBalancerPickFirst;function requireLoadBalancerPickFirst(){if(hasRequiredLoadBalancerPickFirst)return loadBalancerPickFirst;hasRequiredLoadBalancerPickFirst=1,Object.defineProperty(loadBalancerPickFirst,"__esModule",{value:!0}),loadBalancerPickFirst.LeafLoadBalancer=loadBalancerPickFirst.PickFirstLoadBalancer=loadBalancerPickFirst.PickFirstLoadBalancingConfig=void 0,loadBalancerPickFirst.shuffled=p,loadBalancerPickFirst.setup=function(){(0,e.registerLoadBalancerType)(u,g,h),(0,e.registerDefaultLoadBalancerType)(u)};const e=requireLoadBalancer(),t=requireConnectivityState(),r=requirePicker(),n=requireSubchannelAddress(),i=requireLogging(),s=requireConstants(),a=requireSubchannelAddress(),o=require$$0$3,l=requireCallInterface();function c(e){i.trace(s.LogVerbosity.DEBUG,"pick_first",e)}const u="pick_first";class h{constructor(e){this.shuffleAddressList=e}getLoadBalancerName(){return u}toJsonObject(){return{[u]:{shuffleAddressList:this.shuffleAddressList}}}getShuffleAddressList(){return this.shuffleAddressList}static createFromJson(e){if("shuffleAddressList"in e&&"boolean"!=typeof e.shuffleAddressList)throw new Error("pick_first config field shuffleAddressList must be a boolean if provided");return new h(!0===e.shuffleAddressList)}}loadBalancerPickFirst.PickFirstLoadBalancingConfig=h;class d{constructor(e){this.subchannel=e}pick(e){return{pickResultType:r.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,onCallStarted:null,onCallEnded:null}}}function p(e){const t=e.slice();for(let e=t.length-1;e>1;e--){const r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}const f="grpc-node.internal.pick-first.report_health_status";class g{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=t.ConnectivityState.IDLE,this.currentSubchannelIndex=0,this.currentPick=null,this.subchannelStateListener=(e,t,r,n,i)=>{this.onSubchannelStateUpdate(e,t,r,i)},this.pickedSubchannelHealthListener=()=>this.calculateAndReportNewState(),this.stickyTransientFailureMode=!1,this.reportHealthStatus=!1,this.lastError=null,this.latestAddressList=null,this.latestOptions={},this.latestResolutionNote="",this.connectionDelayTimeout=setTimeout(()=>{},0),clearTimeout(this.connectionDelayTimeout)}allChildrenHaveReportedTF(){return this.children.every(e=>e.hasReportedTransientFailure)}resetChildrenReportedTF(){this.children.every(e=>e.hasReportedTransientFailure=!1)}calculateAndReportNewState(){var e;if(this.currentPick)if(this.reportHealthStatus&&!this.currentPick.isHealthy()){const e=`Picked subchannel ${this.currentPick.getAddress()} is unhealthy`;this.updateState(t.ConnectivityState.TRANSIENT_FAILURE,new r.UnavailablePicker({details:e}),e)}else this.updateState(t.ConnectivityState.READY,new d(this.currentPick),null);else if(0===(null===(e=this.latestAddressList)||void 0===e?void 0:e.length)){const e=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(t.ConnectivityState.TRANSIENT_FAILURE,new r.UnavailablePicker({details:e}),e)}else if(0===this.children.length)this.updateState(t.ConnectivityState.IDLE,new r.QueuePicker(this),null);else if(this.stickyTransientFailureMode){const e=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(t.ConnectivityState.TRANSIENT_FAILURE,new r.UnavailablePicker({details:e}),e)}else this.updateState(t.ConnectivityState.CONNECTING,new r.QueuePicker(this),null)}requestReresolution(){this.channelControlHelper.requestReresolution()}maybeEnterStickyTransientFailureMode(){if(this.allChildrenHaveReportedTF())if(this.requestReresolution(),this.resetChildrenReportedTF(),this.stickyTransientFailureMode)this.calculateAndReportNewState();else{this.stickyTransientFailureMode=!0;for(const{subchannel:e}of this.children)e.startConnecting();this.calculateAndReportNewState()}}removeCurrentPick(){null!==this.currentPick&&(this.currentPick.removeConnectivityStateListener(this.subchannelStateListener),this.channelControlHelper.removeChannelzChild(this.currentPick.getChannelzRef()),this.currentPick.removeHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick.unref(),this.currentPick=null)}onSubchannelStateUpdate(e,r,n,i){var s;if(null===(s=this.currentPick)||void 0===s?void 0:s.realSubchannelEquals(e))n!==t.ConnectivityState.READY&&(this.removeCurrentPick(),this.calculateAndReportNewState());else for(const[r,s]of this.children.entries())if(e.realSubchannelEquals(s.subchannel))return n===t.ConnectivityState.READY&&this.pickSubchannel(s.subchannel),n===t.ConnectivityState.TRANSIENT_FAILURE&&(s.hasReportedTransientFailure=!0,i&&(this.lastError=i),this.maybeEnterStickyTransientFailureMode(),r===this.currentSubchannelIndex&&this.startNextSubchannelConnecting(r+1)),void s.subchannel.startConnecting()}startNextSubchannelConnecting(e){clearTimeout(this.connectionDelayTimeout);for(const[r,n]of this.children.entries())if(r>=e){const e=n.subchannel.getConnectivityState();if(e===t.ConnectivityState.IDLE||e===t.ConnectivityState.CONNECTING)return void this.startConnecting(r)}this.maybeEnterStickyTransientFailureMode()}startConnecting(e){var r,n;clearTimeout(this.connectionDelayTimeout),this.currentSubchannelIndex=e,this.children[e].subchannel.getConnectivityState()===t.ConnectivityState.IDLE&&(c("Start connecting to subchannel with address "+this.children[e].subchannel.getAddress()),process.nextTick(()=>{var t;null===(t=this.children[e])||void 0===t||t.subchannel.startConnecting()})),this.connectionDelayTimeout=setTimeout(()=>{this.startNextSubchannelConnecting(e+1)},250),null===(n=(r=this.connectionDelayTimeout).unref)||void 0===n||n.call(r)}pickSubchannel(e){c("Pick subchannel with address "+e.getAddress()),this.stickyTransientFailureMode=!1,e.ref(),this.channelControlHelper.addChannelzChild(e.getChannelzRef()),this.removeCurrentPick(),this.resetSubchannelList(),e.addConnectivityStateListener(this.subchannelStateListener),e.addHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick=e,clearTimeout(this.connectionDelayTimeout),this.calculateAndReportNewState()}updateState(e,r,n){c(t.ConnectivityState[this.currentState]+" -> "+t.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,r,n)}resetSubchannelList(){for(const e of this.children)e.subchannel.removeConnectivityStateListener(this.subchannelStateListener),e.subchannel.unref(),this.channelControlHelper.removeChannelzChild(e.subchannel.getChannelzRef());this.currentSubchannelIndex=0,this.children=[]}connectToAddressList(e,r){c("connectToAddressList(["+e.map(e=>(0,n.subchannelAddressToString)(e))+"])");const i=e.map(e=>({subchannel:this.channelControlHelper.createSubchannel(e,r),hasReportedTransientFailure:!1}));for(const{subchannel:e}of i)if(e.getConnectivityState()===t.ConnectivityState.READY)return void this.pickSubchannel(e);for(const{subchannel:e}of i)e.ref(),this.channelControlHelper.addChannelzChild(e.getChannelzRef());this.resetSubchannelList(),this.children=i;for(const{subchannel:e}of this.children)e.addConnectivityStateListener(this.subchannelStateListener);for(const e of this.children)e.subchannel.getConnectivityState()===t.ConnectivityState.TRANSIENT_FAILURE&&(e.hasReportedTransientFailure=!0);this.startNextSubchannelConnecting(0),this.calculateAndReportNewState()}updateAddressList(e,i,s,l){if(!(i instanceof h))return!1;if(!e.ok)return 0===this.children.length&&null===this.currentPick&&this.channelControlHelper.updateState(t.ConnectivityState.TRANSIENT_FAILURE,new r.UnavailablePicker(e.error),e.error.details),!0;let u=e.value;this.reportHealthStatus=s[f],i.getShuffleAddressList()&&(u=p(u));const d=[].concat(...u.map(e=>e.addresses));c("updateAddressList(["+d.map(e=>(0,n.subchannelAddressToString)(e))+"])");const g=function(e){if(0===e.length)return[];const t=[],r=[],n=[],i=(0,a.isTcpSubchannelAddress)(e[0])&&(0,o.isIPv6)(e[0].host);for(const t of e)(0,a.isTcpSubchannelAddress)(t)&&(0,o.isIPv6)(t.host)?r.push(t):n.push(t);const s=i?r:n,l=i?n:r;for(let e=0;e<Math.max(s.length,l.length);e++)e<s.length&&t.push(s[e]),e<l.length&&t.push(l[e]);return t}(d);return this.latestAddressList=g,this.latestOptions=s,this.connectToAddressList(g,s),this.latestResolutionNote=l,d.length>0||(this.lastError="No addresses resolved",!1)}exitIdle(){this.currentState===t.ConnectivityState.IDLE&&this.latestAddressList&&this.connectToAddressList(this.latestAddressList,this.latestOptions)}resetBackoff(){}destroy(){this.resetSubchannelList(),this.removeCurrentPick()}getTypeName(){return u}}loadBalancerPickFirst.PickFirstLoadBalancer=g;const v=new h(!1);return loadBalancerPickFirst.LeafLoadBalancer=class{constructor(n,i,s,a){this.endpoint=n,this.options=s,this.resolutionNote=a,this.latestState=t.ConnectivityState.IDLE;const o=(0,e.createChildChannelControlHelper)(i,{updateState:(e,t,r)=>{this.latestState=e,this.latestPicker=t,i.updateState(e,t,r)}});this.pickFirstBalancer=new g(o),this.latestPicker=new r.QueuePicker(this.pickFirstBalancer)}startConnecting(){this.pickFirstBalancer.updateAddressList((0,l.statusOrFromValue)([this.endpoint]),v,Object.assign(Object.assign({},this.options),{[f]:!0}),this.resolutionNote)}updateEndpoint(e,r){this.options=r,this.endpoint=e,this.latestState!==t.ConnectivityState.IDLE&&this.startConnecting()}getConnectivityState(){return this.latestState}getPicker(){return this.latestPicker}getEndpoint(){return this.endpoint}exitIdle(){this.pickFirstBalancer.exitIdle()}destroy(){this.pickFirstBalancer.destroy()}},loadBalancerPickFirst}var certificateProvider={},hasRequiredCertificateProvider,hasRequiredExperimental;function requireCertificateProvider(){if(hasRequiredCertificateProvider)return certificateProvider;hasRequiredCertificateProvider=1,Object.defineProperty(certificateProvider,"__esModule",{value:!0}),certificateProvider.FileWatcherCertificateProvider=void 0;const e=require$$0,t=requireLogging(),r=requireConstants();function n(e){t.trace(r.LogVerbosity.DEBUG,"certificate_provider",e)}const i=(0,require$$1$5.promisify)(e.readFile);return certificateProvider.FileWatcherCertificateProvider=class{constructor(e){if(this.config=e,this.refreshTimer=null,this.fileResultPromise=null,this.latestCaUpdate=void 0,this.caListeners=new Set,this.latestIdentityUpdate=void 0,this.identityListeners=new Set,this.lastUpdateTime=null,void 0===e.certificateFile!=(void 0===e.privateKeyFile))throw new Error("certificateFile and privateKeyFile must be set or unset together");if(void 0===e.certificateFile&&void 0===e.caCertificateFile)throw new Error("At least one of certificateFile and caCertificateFile must be set");n("File watcher constructed with config "+JSON.stringify(e))}updateCertificates(){this.fileResultPromise||(this.fileResultPromise=Promise.allSettled([this.config.certificateFile?i(this.config.certificateFile):Promise.reject(),this.config.privateKeyFile?i(this.config.privateKeyFile):Promise.reject(),this.config.caCertificateFile?i(this.config.caCertificateFile):Promise.reject()]),this.fileResultPromise.then(([e,t,r])=>{if(this.refreshTimer){n("File watcher read certificates certificate "+e.status+", privateKey "+t.status+", CA certificate "+r.status),this.lastUpdateTime=new Date,this.fileResultPromise=null,"fulfilled"===e.status&&"fulfilled"===t.status?this.latestIdentityUpdate={certificate:e.value,privateKey:t.value}:this.latestIdentityUpdate=null,"fulfilled"===r.status?this.latestCaUpdate={caCertificate:r.value}:this.latestCaUpdate=null;for(const e of this.identityListeners)e(this.latestIdentityUpdate);for(const e of this.caListeners)e(this.latestCaUpdate)}}),n("File watcher initiated certificate update"))}maybeStartWatchingFiles(){if(!this.refreshTimer){const e=this.lastUpdateTime?(new Date).getTime()-this.lastUpdateTime.getTime():1/0;e>this.config.refreshIntervalMs&&this.updateCertificates(),e>2*this.config.refreshIntervalMs&&(this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0),this.refreshTimer=setInterval(()=>this.updateCertificates(),this.config.refreshIntervalMs),n("File watcher started watching")}}maybeStopWatchingFiles(){0===this.caListeners.size&&0===this.identityListeners.size&&(this.fileResultPromise=null,this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null))}addCaCertificateListener(e){this.caListeners.add(e),this.maybeStartWatchingFiles(),void 0!==this.latestCaUpdate&&process.nextTick(e,this.latestCaUpdate)}removeCaCertificateListener(e){this.caListeners.delete(e),this.maybeStopWatchingFiles()}addIdentityCertificateListener(e){this.identityListeners.add(e),this.maybeStartWatchingFiles(),void 0!==this.latestIdentityUpdate&&process.nextTick(e,this.latestIdentityUpdate)}removeIdentityCertificateListener(e){this.identityListeners.delete(e),this.maybeStopWatchingFiles()}},certificateProvider}function requireExperimental(){return hasRequiredExperimental||(hasRequiredExperimental=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=e.createCertificateProviderChannelCredentials=e.FileWatcherCertificateProvider=e.createCertificateProviderServerCredentials=e.createServerCredentialsWithInterceptors=e.BaseSubchannelWrapper=e.registerAdminService=e.FilterStackFactory=e.BaseFilter=e.statusOrFromError=e.statusOrFromValue=e.PickResultType=e.QueuePicker=e.UnavailablePicker=e.ChildLoadBalancerHandler=e.EndpointMap=e.endpointHasAddress=e.endpointToString=e.subchannelAddressToString=e.LeafLoadBalancer=e.isLoadBalancerNameRegistered=e.parseLoadBalancingConfig=e.selectLbConfigFromList=e.registerLoadBalancerType=e.createChildChannelControlHelper=e.BackoffTimeout=e.parseDuration=e.durationToMs=e.splitHostPort=e.uriToString=e.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=e.createResolver=e.registerResolver=e.log=e.trace=void 0;var t=requireLogging();Object.defineProperty(e,"trace",{enumerable:!0,get:function(){return t.trace}}),Object.defineProperty(e,"log",{enumerable:!0,get:function(){return t.log}});var r=requireResolver();Object.defineProperty(e,"registerResolver",{enumerable:!0,get:function(){return r.registerResolver}}),Object.defineProperty(e,"createResolver",{enumerable:!0,get:function(){return r.createResolver}}),Object.defineProperty(e,"CHANNEL_ARGS_CONFIG_SELECTOR_KEY",{enumerable:!0,get:function(){return r.CHANNEL_ARGS_CONFIG_SELECTOR_KEY}});var n=requireUriParser();Object.defineProperty(e,"uriToString",{enumerable:!0,get:function(){return n.uriToString}}),Object.defineProperty(e,"splitHostPort",{enumerable:!0,get:function(){return n.splitHostPort}});var i=requireDuration();Object.defineProperty(e,"durationToMs",{enumerable:!0,get:function(){return i.durationToMs}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return i.parseDuration}});var s=requireBackoffTimeout();Object.defineProperty(e,"BackoffTimeout",{enumerable:!0,get:function(){return s.BackoffTimeout}});var a=requireLoadBalancer();Object.defineProperty(e,"createChildChannelControlHelper",{enumerable:!0,get:function(){return a.createChildChannelControlHelper}}),Object.defineProperty(e,"registerLoadBalancerType",{enumerable:!0,get:function(){return a.registerLoadBalancerType}}),Object.defineProperty(e,"selectLbConfigFromList",{enumerable:!0,get:function(){return a.selectLbConfigFromList}}),Object.defineProperty(e,"parseLoadBalancingConfig",{enumerable:!0,get:function(){return a.parseLoadBalancingConfig}}),Object.defineProperty(e,"isLoadBalancerNameRegistered",{enumerable:!0,get:function(){return a.isLoadBalancerNameRegistered}});var o=requireLoadBalancerPickFirst();Object.defineProperty(e,"LeafLoadBalancer",{enumerable:!0,get:function(){return o.LeafLoadBalancer}});var l=requireSubchannelAddress();Object.defineProperty(e,"subchannelAddressToString",{enumerable:!0,get:function(){return l.subchannelAddressToString}}),Object.defineProperty(e,"endpointToString",{enumerable:!0,get:function(){return l.endpointToString}}),Object.defineProperty(e,"endpointHasAddress",{enumerable:!0,get:function(){return l.endpointHasAddress}}),Object.defineProperty(e,"EndpointMap",{enumerable:!0,get:function(){return l.EndpointMap}});var c=requireLoadBalancerChildHandler();Object.defineProperty(e,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return c.ChildLoadBalancerHandler}});var u=requirePicker();Object.defineProperty(e,"UnavailablePicker",{enumerable:!0,get:function(){return u.UnavailablePicker}}),Object.defineProperty(e,"QueuePicker",{enumerable:!0,get:function(){return u.QueuePicker}}),Object.defineProperty(e,"PickResultType",{enumerable:!0,get:function(){return u.PickResultType}});var h=requireCallInterface();Object.defineProperty(e,"statusOrFromValue",{enumerable:!0,get:function(){return h.statusOrFromValue}}),Object.defineProperty(e,"statusOrFromError",{enumerable:!0,get:function(){return h.statusOrFromError}});var d=requireFilter();Object.defineProperty(e,"BaseFilter",{enumerable:!0,get:function(){return d.BaseFilter}});var p=requireFilterStack();Object.defineProperty(e,"FilterStackFactory",{enumerable:!0,get:function(){return p.FilterStackFactory}});var f=requireAdmin();Object.defineProperty(e,"registerAdminService",{enumerable:!0,get:function(){return f.registerAdminService}});var g=requireSubchannelInterface();Object.defineProperty(e,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return g.BaseSubchannelWrapper}});var v=requireServerCredentials();Object.defineProperty(e,"createServerCredentialsWithInterceptors",{enumerable:!0,get:function(){return v.createServerCredentialsWithInterceptors}}),Object.defineProperty(e,"createCertificateProviderServerCredentials",{enumerable:!0,get:function(){return v.createCertificateProviderServerCredentials}});var m=requireCertificateProvider();Object.defineProperty(e,"FileWatcherCertificateProvider",{enumerable:!0,get:function(){return m.FileWatcherCertificateProvider}});var A=requireChannelCredentials();Object.defineProperty(e,"createCertificateProviderChannelCredentials",{enumerable:!0,get:function(){return A.createCertificateProviderChannelCredentials}});var y=requireInternalChannel();Object.defineProperty(e,"SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX",{enumerable:!0,get:function(){return y.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX}})}(experimental)),experimental}var resolverUds={},hasRequiredResolverUds;function requireResolverUds(){if(hasRequiredResolverUds)return resolverUds;hasRequiredResolverUds=1,Object.defineProperty(resolverUds,"__esModule",{value:!0}),resolverUds.setup=function(){(0,e.registerResolver)("unix",r)};const e=requireResolver(),t=requireCallInterface();class r{constructor(e,t,r){let n;this.listener=t,this.hasReturnedResult=!1,this.endpoints=[],n=""===e.authority?"/"+e.path:e.path,this.endpoints=[{addresses:[{path:n}]}]}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(this.listener,(0,t.statusOrFromValue)(this.endpoints),{},null,""))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return"localhost"}}return resolverUds}var resolverIp={},hasRequiredResolverIp;function requireResolverIp(){if(hasRequiredResolverIp)return resolverIp;hasRequiredResolverIp=1,Object.defineProperty(resolverIp,"__esModule",{value:!0}),resolverIp.setup=function(){(0,i.registerResolver)(c,h),(0,i.registerResolver)(u,h)};const e=require$$0$3,t=requireCallInterface(),r=requireConstants(),n=requireMetadata(),i=requireResolver(),s=requireSubchannelAddress(),a=requireUriParser(),o=requireLogging();function l(e){o.trace(r.LogVerbosity.DEBUG,"ip_resolver",e)}const c="ipv4",u="ipv6";class h{constructor(t,i,o){var h;this.listener=i,this.endpoints=[],this.error=null,this.hasReturnedResult=!1,l("Resolver constructed for target "+(0,a.uriToString)(t));const d=[];if(t.scheme!==c&&t.scheme!==u)return void(this.error={code:r.Status.UNAVAILABLE,details:`Unrecognized scheme ${t.scheme} in IP resolver`,metadata:new n.Metadata});const p=t.path.split(",");for(const i of p){const s=(0,a.splitHostPort)(i);if(null===s)return void(this.error={code:r.Status.UNAVAILABLE,details:`Failed to parse ${t.scheme} address ${i}`,metadata:new n.Metadata});if(t.scheme===c&&!(0,e.isIPv4)(s.host)||t.scheme===u&&!(0,e.isIPv6)(s.host))return void(this.error={code:r.Status.UNAVAILABLE,details:`Failed to parse ${t.scheme} address ${i}`,metadata:new n.Metadata});d.push({host:s.host,port:null!==(h=s.port)&&void 0!==h?h:443})}this.endpoints=d.map(e=>({addresses:[e]})),l("Parsed "+t.scheme+" address list "+d.map(s.subchannelAddressToString))}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(()=>{this.error?this.listener((0,t.statusOrFromError)(this.error),{},null,""):this.listener((0,t.statusOrFromValue)(this.endpoints),{},null,"")}))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return e.path.split(",")[0]}}return resolverIp}var loadBalancerRoundRobin={},hasRequiredLoadBalancerRoundRobin;function requireLoadBalancerRoundRobin(){if(hasRequiredLoadBalancerRoundRobin)return loadBalancerRoundRobin;hasRequiredLoadBalancerRoundRobin=1,Object.defineProperty(loadBalancerRoundRobin,"__esModule",{value:!0}),loadBalancerRoundRobin.RoundRobinLoadBalancer=void 0,loadBalancerRoundRobin.setup=function(){(0,e.registerLoadBalancerType)(l,h,c)};const e=requireLoadBalancer(),t=requireConnectivityState(),r=requirePicker(),n=requireLogging(),i=requireConstants(),s=requireSubchannelAddress(),a=requireLoadBalancerPickFirst();function o(e){n.trace(i.LogVerbosity.DEBUG,"round_robin",e)}const l="round_robin";class c{getLoadBalancerName(){return l}constructor(){}toJsonObject(){return{[l]:{}}}static createFromJson(e){return new c}}class u{constructor(e,t=0){this.children=e,this.nextIndex=t}pick(e){const t=this.children[this.nextIndex].picker;return this.nextIndex=(this.nextIndex+1)%this.children.length,t.pick(e)}peekNextEndpoint(){return this.children[this.nextIndex].endpoint}}class h{constructor(r){this.channelControlHelper=r,this.children=[],this.currentState=t.ConnectivityState.IDLE,this.currentReadyPicker=null,this.updatesPaused=!1,this.lastError=null,this.childChannelControlHelper=(0,e.createChildChannelControlHelper)(r,{updateState:(e,r,n)=>{this.currentState===t.ConnectivityState.READY&&e!==t.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),n&&(this.lastError=n),this.calculateAndUpdateState()}})}countChildrenWithState(e){return this.children.filter(t=>t.getConnectivityState()===e).length}calculateAndUpdateState(){if(!this.updatesPaused){if(this.countChildrenWithState(t.ConnectivityState.READY)>0){const e=this.children.filter(e=>e.getConnectivityState()===t.ConnectivityState.READY);let r=0;if(null!==this.currentReadyPicker){const t=this.currentReadyPicker.peekNextEndpoint();r=e.findIndex(e=>(0,s.endpointEqual)(e.getEndpoint(),t)),r<0&&(r=0)}this.updateState(t.ConnectivityState.READY,new u(e.map(e=>({endpoint:e.getEndpoint(),picker:e.getPicker()})),r),null)}else if(this.countChildrenWithState(t.ConnectivityState.CONNECTING)>0)this.updateState(t.ConnectivityState.CONNECTING,new r.QueuePicker(this),null);else if(this.countChildrenWithState(t.ConnectivityState.TRANSIENT_FAILURE)>0){const e=`round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(t.ConnectivityState.TRANSIENT_FAILURE,new r.UnavailablePicker({details:e}),e)}else this.updateState(t.ConnectivityState.IDLE,new r.QueuePicker(this),null);for(const e of this.children)e.getConnectivityState()===t.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,r,n){o(t.ConnectivityState[this.currentState]+" -> "+t.ConnectivityState[e]),e===t.ConnectivityState.READY?this.currentReadyPicker=r:this.currentReadyPicker=null,this.currentState=e,this.channelControlHelper.updateState(e,r,n)}resetSubchannelList(){for(const e of this.children)e.destroy();this.children=[]}updateAddressList(e,n,i,l){if(!(n instanceof c))return!1;if(!e.ok)return 0===this.children.length&&this.updateState(t.ConnectivityState.TRANSIENT_FAILURE,new r.UnavailablePicker(e.error),e.error.details),!0;const u=Math.random()*e.value.length|0,h=function(e,t){return[...e.slice(t),...e.slice(0,t)]}(e.value,u);if(this.resetSubchannelList(),0===h.length){const e=`No addresses resolved. Resolution note: ${l}`;this.updateState(t.ConnectivityState.TRANSIENT_FAILURE,new r.UnavailablePicker({details:e}),e)}o("Connect to endpoint list "+h.map(s.endpointToString)),this.updatesPaused=!0,this.children=h.map(e=>new a.LeafLoadBalancer(e,this.childChannelControlHelper,i,l));for(const e of this.children)e.startConnecting();return this.updatesPaused=!1,this.calculateAndUpdateState(),!0}exitIdle(){}resetBackoff(){}destroy(){this.resetSubchannelList()}getTypeName(){return l}}return loadBalancerRoundRobin.RoundRobinLoadBalancer=h,loadBalancerRoundRobin}var loadBalancerOutlierDetection={},hasRequiredLoadBalancerOutlierDetection;function requireLoadBalancerOutlierDetection(){if(hasRequiredLoadBalancerOutlierDetection)return loadBalancerOutlierDetection;var e;hasRequiredLoadBalancerOutlierDetection=1,Object.defineProperty(loadBalancerOutlierDetection,"__esModule",{value:!0}),loadBalancerOutlierDetection.OutlierDetectionLoadBalancer=loadBalancerOutlierDetection.OutlierDetectionLoadBalancingConfig=void 0,loadBalancerOutlierDetection.setup=function(){p&&(0,i.registerLoadBalancerType)(d,_,y)};const t=requireConnectivityState(),r=requireConstants(),n=requireDuration(),i=requireExperimental(),s=requireLoadBalancer(),a=requireLoadBalancerChildHandler(),o=requirePicker(),l=requireSubchannelAddress(),c=requireSubchannelInterface(),u=requireLogging();function h(e){u.trace(r.LogVerbosity.DEBUG,"outlier_detection",e)}const d="outlier_detection",p="true"===(null!==(e=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)&&void 0!==e?e:"true"),f={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},g={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function v(e,t,r,n){if(t in e&&void 0!==e[t]&&typeof e[t]!==r){throw new Error(`outlier detection config ${n?`${n}.${t}`:t} parse error: expected ${r}, got ${typeof e[t]}`)}}function m(e,t,r){const i=t;if(t in e&&void 0!==e[t]){if(!(0,n.isDuration)(e[t]))throw new Error(`outlier detection config ${i} parse error: expected Duration, got ${typeof e[t]}`);if(!(e[t].seconds>=0&&e[t].seconds<=315576e6&&e[t].nanos>=0&&e[t].nanos<=999999999))throw new Error(`outlier detection config ${i} parse error: values out of range for non-negative Duaration`)}}function A(e,t,r){const n=r?`${r}.${t}`:t;if(v(e,t,"number",r),t in e&&void 0!==e[t]&&!(e[t]>=0&&e[t]<=100))throw new Error(`outlier detection config ${n} parse error: value out of range for percentage (0-100)`)}class y{constructor(e,t,r,n,i,s,a){if(this.childPolicy=a,"pick_first"===a.getLoadBalancerName())throw new Error("outlier_detection LB policy cannot have a pick_first child policy");this.intervalMs=null!=e?e:1e4,this.baseEjectionTimeMs=null!=t?t:3e4,this.maxEjectionTimeMs=null!=r?r:3e5,this.maxEjectionPercent=null!=n?n:10,this.successRateEjection=i?Object.assign(Object.assign({},f),i):null,this.failurePercentageEjection=s?Object.assign(Object.assign({},g),s):null}getLoadBalancerName(){return d}toJsonObject(){var e,t;return{outlier_detection:{interval:(0,n.msToDuration)(this.intervalMs),base_ejection_time:(0,n.msToDuration)(this.baseEjectionTimeMs),max_ejection_time:(0,n.msToDuration)(this.maxEjectionTimeMs),max_ejection_percent:this.maxEjectionPercent,success_rate_ejection:null!==(e=this.successRateEjection)&&void 0!==e?e:void 0,failure_percentage_ejection:null!==(t=this.failurePercentageEjection)&&void 0!==t?t:void 0,child_policy:[this.childPolicy.toJsonObject()]}}}getIntervalMs(){return this.intervalMs}getBaseEjectionTimeMs(){return this.baseEjectionTimeMs}getMaxEjectionTimeMs(){return this.maxEjectionTimeMs}getMaxEjectionPercent(){return this.maxEjectionPercent}getSuccessRateEjectionConfig(){return this.successRateEjection}getFailurePercentageEjectionConfig(){return this.failurePercentageEjection}getChildPolicy(){return this.childPolicy}static createFromJson(e){var t;if(m(e,"interval"),m(e,"base_ejection_time"),m(e,"max_ejection_time"),A(e,"max_ejection_percent"),"success_rate_ejection"in e&&void 0!==e.success_rate_ejection){if("object"!=typeof e.success_rate_ejection)throw new Error("outlier detection config success_rate_ejection must be an object");v(e.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),A(e.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),v(e.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),v(e.success_rate_ejection,"request_volume","number","success_rate_ejection")}if("failure_percentage_ejection"in e&&void 0!==e.failure_percentage_ejection){if("object"!=typeof e.failure_percentage_ejection)throw new Error("outlier detection config failure_percentage_ejection must be an object");A(e.failure_percentage_ejection,"threshold","failure_percentage_ejection"),A(e.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),v(e.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),v(e.failure_percentage_ejection,"request_volume","number","failure_percentage_ejection")}if(!("child_policy"in e)||!Array.isArray(e.child_policy))throw new Error("outlier detection config child_policy must be an array");const r=(0,s.selectLbConfigFromList)(e.child_policy);if(!r)throw new Error("outlier detection config child_policy: no valid recognized policy found");return new y(e.interval?(0,n.durationToMs)(e.interval):null,e.base_ejection_time?(0,n.durationToMs)(e.base_ejection_time):null,e.max_ejection_time?(0,n.durationToMs)(e.max_ejection_time):null,null!==(t=e.max_ejection_percent)&&void 0!==t?t:null,e.success_rate_ejection,e.failure_percentage_ejection,r)}}loadBalancerOutlierDetection.OutlierDetectionLoadBalancingConfig=y;class C extends c.BaseSubchannelWrapper{constructor(e,t){super(e),this.mapEntry=t,this.refCount=0}ref(){this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0&&this.mapEntry){const e=this.mapEntry.subchannelWrappers.indexOf(this);e>=0&&this.mapEntry.subchannelWrappers.splice(e,1)}}eject(){this.setHealthy(!1)}uneject(){this.setHealthy(!0)}getMapEntry(){return this.mapEntry}getWrappedSubchannel(){return this.child}}class S{constructor(){this.activeBucket={success:0,failure:0},this.inactiveBucket={success:0,failure:0}}addSuccess(){this.activeBucket.success+=1}addFailure(){this.activeBucket.failure+=1}switchBuckets(){this.inactiveBucket=this.activeBucket,this.activeBucket={success:0,failure:0}}getLastSuccesses(){return this.inactiveBucket.success}getLastFailures(){return this.inactiveBucket.failure}}class E{constructor(e,t){this.wrappedPicker=e,this.countCalls=t}pick(e){const t=this.wrappedPicker.pick(e);if(t.pickResultType===o.PickResultType.COMPLETE){const e=t.subchannel,n=e.getMapEntry();if(n){let i=t.onCallEnded;return this.countCalls&&(i=(e,i,s)=>{var a;e===r.Status.OK?n.counter.addSuccess():n.counter.addFailure(),null===(a=t.onCallEnded)||void 0===a||a.call(t,e,i,s)}),Object.assign(Object.assign({},t),{subchannel:e.getWrappedSubchannel(),onCallEnded:i})}return Object.assign(Object.assign({},t),{subchannel:e.getWrappedSubchannel()})}return t}}class _{constructor(e){this.entryMap=new l.EndpointMap,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new a.ChildLoadBalancerHandler((0,i.createChildChannelControlHelper)(e,{createSubchannel:(t,r)=>{const n=e.createSubchannel(t,r),i=this.entryMap.getForSubchannelAddress(t),s=new C(n,i);return null!==(null==i?void 0:i.currentEjectionTimestamp)&&s.eject(),null==i||i.subchannelWrappers.push(s),s},updateState:(r,n,i)=>{r===t.ConnectivityState.READY?e.updateState(r,new E(n,this.isCountingEnabled()),i):e.updateState(r,n,i)}})),this.ejectionTimer=setInterval(()=>{},0),clearInterval(this.ejectionTimer)}isCountingEnabled(){return null!==this.latestConfig&&(null!==this.latestConfig.getSuccessRateEjectionConfig()||null!==this.latestConfig.getFailurePercentageEjectionConfig())}getCurrentEjectionPercent(){let e=0;for(const t of this.entryMap.values())null!==t.currentEjectionTimestamp&&(e+=1);return 100*e/this.entryMap.size}runSuccessRateCheck(e){if(!this.latestConfig)return;const t=this.latestConfig.getSuccessRateEjectionConfig();if(!t)return;h("Running success rate check");const r=t.request_volume;let n=0;const i=[];for(const[e,t]of this.entryMap.entries()){const s=t.counter.getLastSuccesses(),a=t.counter.getLastFailures();h("Stats for "+(0,l.endpointToString)(e)+": successes="+s+" failures="+a+" targetRequestVolume="+r),s+a>=r&&(n+=1,i.push(s/(s+a)))}if(h("Found "+n+" success rate candidates; currentEjectionPercent="+this.getCurrentEjectionPercent()+" successRates=["+i+"]"),n<t.minimum_hosts)return;const s=i.reduce((e,t)=>e+t)/i.length;let a=0;for(const e of i){const t=e-s;a+=t*t}const o=a/i.length,c=Math.sqrt(o),u=s-c*(t.stdev_factor/1e3);h("stdev="+c+" ejectionThreshold="+u);for(const[n,i]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;const s=i.counter.getLastSuccesses(),a=i.counter.getLastFailures();if(s+a<r)continue;const o=s/(s+a);if(h("Checking candidate "+n+" successRate="+o),o<u){const r=100*Math.random();h("Candidate "+n+" randomNumber="+r+" enforcement_percentage="+t.enforcement_percentage),r<t.enforcement_percentage&&(h("Ejecting candidate "+n),this.eject(i,e))}}}runFailurePercentageCheck(e){if(!this.latestConfig)return;const t=this.latestConfig.getFailurePercentageEjectionConfig();if(!t)return;h("Running failure percentage check. threshold="+t.threshold+" request volume threshold="+t.request_volume);let r=0;for(const e of this.entryMap.values()){e.counter.getLastSuccesses()+e.counter.getLastFailures()>=t.request_volume&&(r+=1)}if(!(r<t.minimum_hosts))for(const[r,n]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;const i=n.counter.getLastSuccesses(),s=n.counter.getLastFailures();if(h("Candidate successes="+i+" failures="+s),i+s<t.request_volume)continue;if(100*s/(s+i)>t.threshold){const i=100*Math.random();h("Candidate "+r+" randomNumber="+i+" enforcement_percentage="+t.enforcement_percentage),i<t.enforcement_percentage&&(h("Ejecting candidate "+r),this.eject(n,e))}}}eject(e,t){e.currentEjectionTimestamp=new Date,e.ejectionTimeMultiplier+=1;for(const t of e.subchannelWrappers)t.eject()}uneject(e){e.currentEjectionTimestamp=null;for(const t of e.subchannelWrappers)t.uneject()}switchAllBuckets(){for(const e of this.entryMap.values())e.counter.switchBuckets()}startTimer(e){var t,r;this.ejectionTimer=setTimeout(()=>this.runChecks(),e),null===(r=(t=this.ejectionTimer).unref)||void 0===r||r.call(t)}runChecks(){const e=new Date;if(h("Ejection timer running"),this.switchAllBuckets(),this.latestConfig){this.timerStartTime=e,this.startTimer(this.latestConfig.getIntervalMs()),this.runSuccessRateCheck(e),this.runFailurePercentageCheck(e);for(const[e,t]of this.entryMap.entries())if(null===t.currentEjectionTimestamp)t.ejectionTimeMultiplier>0&&(t.ejectionTimeMultiplier-=1);else{const r=this.latestConfig.getBaseEjectionTimeMs(),n=this.latestConfig.getMaxEjectionTimeMs(),i=new Date(t.currentEjectionTimestamp.getTime());i.setMilliseconds(i.getMilliseconds()+Math.min(r*t.ejectionTimeMultiplier,Math.max(r,n))),i<new Date&&(h("Unejecting "+e),this.uneject(t))}}}updateAddressList(e,t,r,n){if(!(t instanceof y))return!1;if(h("Received update with config: "+JSON.stringify(t.toJsonObject(),void 0,2)),e.ok){for(const t of e.value)this.entryMap.has(t)||(h("Adding map entry for "+(0,l.endpointToString)(t)),this.entryMap.set(t,{counter:new S,currentEjectionTimestamp:null,ejectionTimeMultiplier:0,subchannelWrappers:[]}));this.entryMap.deleteMissing(e.value)}const i=t.getChildPolicy();if(this.childBalancer.updateAddressList(e,i,r,n),t.getSuccessRateEjectionConfig()||t.getFailurePercentageEjectionConfig())if(this.timerStartTime){h("Previous timer existed. Replacing timer"),clearTimeout(this.ejectionTimer);const e=t.getIntervalMs()-((new Date).getTime()-this.timerStartTime.getTime());this.startTimer(e)}else h("Starting new timer"),this.timerStartTime=new Date,this.startTimer(t.getIntervalMs()),this.switchAllBuckets();else{h("Counting disabled. Cancelling timer."),this.timerStartTime=null,clearTimeout(this.ejectionTimer);for(const e of this.entryMap.values())this.uneject(e),e.ejectionTimeMultiplier=0}return this.latestConfig=t,!0}exitIdle(){this.childBalancer.exitIdle()}resetBackoff(){this.childBalancer.resetBackoff()}destroy(){clearTimeout(this.ejectionTimer),this.childBalancer.destroy()}getTypeName(){return d}}return loadBalancerOutlierDetection.OutlierDetectionLoadBalancer=_,loadBalancerOutlierDetection}var loadBalancerWeightedRoundRobin={},priorityQueue={},hasRequiredPriorityQueue,hasRequiredLoadBalancerWeightedRoundRobin,hasRequiredSrc;function requirePriorityQueue(){if(hasRequiredPriorityQueue)return priorityQueue;hasRequiredPriorityQueue=1,Object.defineProperty(priorityQueue,"__esModule",{value:!0}),priorityQueue.PriorityQueue=void 0;const e=e=>Math.floor(e/2),t=e=>2*e+1,r=e=>2*e+2;return priorityQueue.PriorityQueue=class{constructor(e=(e,t)=>e>t){this.comparator=e,this.heap=[]}size(){return this.heap.length}isEmpty(){return 0==this.size()}peek(){return this.heap[0]}push(...e){return e.forEach(e=>{this.heap.push(e),this.siftUp()}),this.size()}pop(){const e=this.peek(),t=this.size()-1;return t>0&&this.swap(0,t),this.heap.pop(),this.siftDown(),e}replace(e){const t=this.peek();return this.heap[0]=e,this.siftDown(),t}greater(e,t){return this.comparator(this.heap[e],this.heap[t])}swap(e,t){[this.heap[e],this.heap[t]]=[this.heap[t],this.heap[e]]}siftUp(){let t=this.size()-1;for(;t>0&&this.greater(t,e(t));)this.swap(t,e(t)),t=e(t)}siftDown(){let e=0;for(;t(e)<this.size()&&this.greater(t(e),e)||r(e)<this.size()&&this.greater(r(e),e);){let n=r(e)<this.size()&&this.greater(r(e),t(e))?r(e):t(e);this.swap(e,n),e=n}}},priorityQueue}function requireLoadBalancerWeightedRoundRobin(){if(hasRequiredLoadBalancerWeightedRoundRobin)return loadBalancerWeightedRoundRobin;hasRequiredLoadBalancerWeightedRoundRobin=1,Object.defineProperty(loadBalancerWeightedRoundRobin,"__esModule",{value:!0}),loadBalancerWeightedRoundRobin.WeightedRoundRobinLoadBalancingConfig=void 0,loadBalancerWeightedRoundRobin.setup=function(){(0,n.registerLoadBalancerType)(h,v,f)};const e=requireConnectivityState(),t=requireConstants(),r=requireDuration(),n=requireLoadBalancer(),i=requireLoadBalancerPickFirst(),s=requireLogging(),a=requireOrca(),o=requirePicker(),l=requirePriorityQueue(),c=requireSubchannelAddress();function u(e){s.trace(t.LogVerbosity.DEBUG,"weighted_round_robin",e)}const h="weighted_round_robin";function d(e,t,r){if(t in e&&void 0!==e[t]&&typeof e[t]!==r)throw new Error(`weighted round robin config ${t} parse error: expected ${r}, got ${typeof e[t]}`)}function p(e,t){if(t in e&&void 0!==e[t]&&null!==e[t]){let n;if((0,r.isDuration)(e[t]))n=e[t];else if((0,r.isDurationMessage)(e[t]))n=(0,r.durationMessageToDuration)(e[t]);else{if("string"!=typeof e[t])throw new Error(`weighted round robin config ${t}: expected duration, got ${typeof e[t]}`);{const i=(0,r.parseDuration)(e[t]);if(!i)throw new Error(`weighted round robin config ${t}: failed to parse duration string ${e[t]}`);n=i}}return(0,r.durationToMs)(n)}return null}class f{constructor(e,t,r,n,i,s){this.enableOobLoadReport=null!=e&&e,this.oobLoadReportingPeriodMs=null!=t?t:1e4,this.blackoutPeriodMs=null!=r?r:1e4,this.weightExpirationPeriodMs=null!=n?n:18e4,this.weightUpdatePeriodMs=Math.max(null!=i?i:1e3,100),this.errorUtilizationPenalty=null!=s?s:1}getLoadBalancerName(){return h}toJsonObject(){return{enable_oob_load_report:this.enableOobLoadReport,oob_load_reporting_period:(0,r.durationToString)((0,r.msToDuration)(this.oobLoadReportingPeriodMs)),blackout_period:(0,r.durationToString)((0,r.msToDuration)(this.blackoutPeriodMs)),weight_expiration_period:(0,r.durationToString)((0,r.msToDuration)(this.weightExpirationPeriodMs)),weight_update_period:(0,r.durationToString)((0,r.msToDuration)(this.weightUpdatePeriodMs)),error_utilization_penalty:this.errorUtilizationPenalty}}static createFromJson(e){if(d(e,"enable_oob_load_report","boolean"),d(e,"error_utilization_penalty","number"),e.error_utilization_penalty<0)throw new Error("weighted round robin config error_utilization_penalty < 0");return new f(e.enable_oob_load_report,p(e,"oob_load_reporting_period"),p(e,"blackout_period"),p(e,"weight_expiration_period"),p(e,"weight_update_period"),e.error_utilization_penalty)}getEnableOobLoadReport(){return this.enableOobLoadReport}getOobLoadReportingPeriodMs(){return this.oobLoadReportingPeriodMs}getBlackoutPeriodMs(){return this.blackoutPeriodMs}getWeightExpirationPeriodMs(){return this.weightExpirationPeriodMs}getWeightUpdatePeriodMs(){return this.weightUpdatePeriodMs}getErrorUtilizationPenalty(){return this.errorUtilizationPenalty}}loadBalancerWeightedRoundRobin.WeightedRoundRobinLoadBalancingConfig=f;class g{constructor(e,t){this.metricsHandler=t,this.queue=new l.PriorityQueue((e,t)=>e.deadline<t.deadline);const r=e.filter(e=>e.weight>0);let n;if(r.length<2)n=1;else{let e=0;for(const{weight:t}of r)e+=t;n=e/r.length}for(const t of e){const e=t.weight>0?1/t.weight:n;this.queue.push({endpointName:t.endpointName,picker:t.picker,period:e,deadline:Math.random()*e})}}pick(e){const t=this.queue.pop();this.queue.push(Object.assign(Object.assign({},t),{deadline:t.deadline+t.period}));const r=t.picker.pick(e);if(r.pickResultType===o.PickResultType.COMPLETE){if(this.metricsHandler)return Object.assign(Object.assign({},r),{onCallEnded:(0,a.createMetricsReader)(e=>this.metricsHandler(e,t.endpointName),r.onCallEnded)});{const e=r.subchannel;return Object.assign(Object.assign({},r),{subchannel:e.getWrappedSubchannel()})}}return r}}class v{constructor(t){this.channelControlHelper=t,this.latestConfig=null,this.children=new Map,this.currentState=e.ConnectivityState.IDLE,this.updatesPaused=!1,this.lastError=null,this.weightUpdateTimer=null}countChildrenWithState(e){let t=0;for(const r of this.children.values())r.child.getConnectivityState()===e&&(t+=1);return t}updateWeight(e,t){var r,n;const i=t.rps_fractional;let s=t.application_utilization;s>0&&i>0&&(s+=t.eps/i*(null!==(n=null===(r=this.latestConfig)||void 0===r?void 0:r.getErrorUtilizationPenalty())&&void 0!==n?n:0));const a=0===s?0:i/s;if(0===a)return;const o=new Date;null===e.nonEmptySince&&(e.nonEmptySince=o),e.lastUpdated=o,e.weight=a}getWeight(e){if(!this.latestConfig)return 0;const t=(new Date).getTime();if(t-e.lastUpdated.getTime()>=this.latestConfig.getWeightExpirationPeriodMs())return e.nonEmptySince=null,0;const r=this.latestConfig.getBlackoutPeriodMs();return r>0&&(null===e.nonEmptySince||t-e.nonEmptySince.getTime()<r)?0:e.weight}calculateAndUpdateState(){if(!this.updatesPaused&&this.latestConfig){if(this.countChildrenWithState(e.ConnectivityState.READY)>0){const t=[];for(const[r,n]of this.children)n.child.getConnectivityState()===e.ConnectivityState.READY&&t.push({endpointName:r,picker:n.child.getPicker(),weight:this.getWeight(n)});let r;u("Created picker with weights: "+t.map(e=>e.endpointName+":"+e.weight).join(",")),r=this.latestConfig.getEnableOobLoadReport()?null:(e,t)=>{const r=this.children.get(t);r&&this.updateWeight(r,e)},this.updateState(e.ConnectivityState.READY,new g(t,r),null)}else if(this.countChildrenWithState(e.ConnectivityState.CONNECTING)>0)this.updateState(e.ConnectivityState.CONNECTING,new o.QueuePicker(this),null);else if(this.countChildrenWithState(e.ConnectivityState.TRANSIENT_FAILURE)>0){const t=`weighted_round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(e.ConnectivityState.TRANSIENT_FAILURE,new o.UnavailablePicker({details:t}),t)}else this.updateState(e.ConnectivityState.IDLE,new o.QueuePicker(this),null);for(const{child:t}of this.children.values())t.getConnectivityState()===e.ConnectivityState.IDLE&&t.exitIdle()}}updateState(t,r,n){u(e.ConnectivityState[this.currentState]+" -> "+e.ConnectivityState[t]),this.currentState=t,this.channelControlHelper.updateState(t,r,n)}updateAddressList(t,r,s,l){var h,d;if(!(r instanceof f))return!1;if(!t.ok)return 0===this.children.size&&this.updateState(e.ConnectivityState.TRANSIENT_FAILURE,new o.UnavailablePicker(t.error),t.error.details),!0;if(0===t.value.length){const t=`No addresses resolved. Resolution note: ${l}`;return this.updateState(e.ConnectivityState.TRANSIENT_FAILURE,new o.UnavailablePicker({details:t}),t),!1}u("Connect to endpoint list "+t.value.map(c.endpointToString));const p=new Date,g=new Set;this.updatesPaused=!0,this.latestConfig=r;for(const o of t.value){const t=(0,c.endpointToString)(o);g.add(t);let u=this.children.get(t);u||(u={child:new i.LeafLoadBalancer(o,(0,n.createChildChannelControlHelper)(this.channelControlHelper,{updateState:(t,r,n)=>{this.currentState===e.ConnectivityState.READY&&t!==e.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),t===e.ConnectivityState.READY&&(u.nonEmptySince=null),n&&(this.lastError=n),this.calculateAndUpdateState()},createSubchannel:(e,t)=>{const r=this.channelControlHelper.createSubchannel(e,t);return(null==u?void 0:u.oobMetricsListener)?new a.OrcaOobMetricsSubchannelWrapper(r,u.oobMetricsListener,this.latestConfig.getOobLoadReportingPeriodMs()):r}}),s,l),lastUpdated:p,nonEmptySince:null,weight:0,oobMetricsListener:null},this.children.set(t,u)),r.getEnableOobLoadReport()?u.oobMetricsListener=e=>{this.updateWeight(u,e)}:u.oobMetricsListener=null}for(const[e,t]of this.children)g.has(e)?t.child.startConnecting():(t.child.destroy(),this.children.delete(e));return this.updatesPaused=!1,this.calculateAndUpdateState(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer),this.weightUpdateTimer=null===(d=(h=setInterval(()=>{this.currentState===e.ConnectivityState.READY&&this.calculateAndUpdateState()},r.getWeightUpdatePeriodMs())).unref)||void 0===d?void 0:d.call(h),!0}exitIdle(){}resetBackoff(){}destroy(){for(const e of this.children.values())e.child.destroy();this.children.clear(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer)}getTypeName(){return h}}return loadBalancerWeightedRoundRobin}function requireSrc(){return hasRequiredSrc||(hasRequiredSrc=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.experimental=e.ServerMetricRecorder=e.ServerInterceptingCall=e.ResponderBuilder=e.ServerListenerBuilder=e.addAdminServicesToServer=e.getChannelzHandlers=e.getChannelzServiceDefinition=e.InterceptorConfigurationError=e.InterceptingCall=e.RequesterBuilder=e.ListenerBuilder=e.StatusBuilder=e.getClientChannel=e.ServerCredentials=e.Server=e.setLogVerbosity=e.setLogger=e.load=e.loadObject=e.CallCredentials=e.ChannelCredentials=e.waitForClientReady=e.closeClient=e.Channel=e.makeGenericClientConstructor=e.makeClientConstructor=e.loadPackageDefinition=e.Client=e.compressionAlgorithms=e.propagate=e.connectivityState=e.status=e.logVerbosity=e.Metadata=e.credentials=void 0;const t=requireCallCredentials();Object.defineProperty(e,"CallCredentials",{enumerable:!0,get:function(){return t.CallCredentials}});const r=requireChannel();Object.defineProperty(e,"Channel",{enumerable:!0,get:function(){return r.ChannelImplementation}});const n=requireCompressionAlgorithms();Object.defineProperty(e,"compressionAlgorithms",{enumerable:!0,get:function(){return n.CompressionAlgorithms}});const i=requireConnectivityState();Object.defineProperty(e,"connectivityState",{enumerable:!0,get:function(){return i.ConnectivityState}});const s=requireChannelCredentials();Object.defineProperty(e,"ChannelCredentials",{enumerable:!0,get:function(){return s.ChannelCredentials}});const a=requireClient();Object.defineProperty(e,"Client",{enumerable:!0,get:function(){return a.Client}});const o=requireConstants();Object.defineProperty(e,"logVerbosity",{enumerable:!0,get:function(){return o.LogVerbosity}}),Object.defineProperty(e,"status",{enumerable:!0,get:function(){return o.Status}}),Object.defineProperty(e,"propagate",{enumerable:!0,get:function(){return o.Propagate}});const l=requireLogging(),c=requireMakeClient();Object.defineProperty(e,"loadPackageDefinition",{enumerable:!0,get:function(){return c.loadPackageDefinition}}),Object.defineProperty(e,"makeClientConstructor",{enumerable:!0,get:function(){return c.makeClientConstructor}}),Object.defineProperty(e,"makeGenericClientConstructor",{enumerable:!0,get:function(){return c.makeClientConstructor}});const u=requireMetadata();Object.defineProperty(e,"Metadata",{enumerable:!0,get:function(){return u.Metadata}});const h=requireServer();Object.defineProperty(e,"Server",{enumerable:!0,get:function(){return h.Server}});const d=requireServerCredentials();Object.defineProperty(e,"ServerCredentials",{enumerable:!0,get:function(){return d.ServerCredentials}});const p=requireStatusBuilder();Object.defineProperty(e,"StatusBuilder",{enumerable:!0,get:function(){return p.StatusBuilder}}),e.credentials={combineChannelCredentials:(e,...t)=>t.reduce((e,t)=>e.compose(t),e),combineCallCredentials:(e,...t)=>t.reduce((e,t)=>e.compose(t),e),createInsecure:s.ChannelCredentials.createInsecure,createSsl:s.ChannelCredentials.createSsl,createFromSecureContext:s.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:t.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:t.CallCredentials.createFromGoogleCredential,createEmpty:t.CallCredentials.createEmpty};e.closeClient=e=>e.close();e.waitForClientReady=(e,t,r)=>e.waitForReady(t,r);e.loadObject=(e,t)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};e.load=(e,t,r)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};e.setLogger=e=>{l.setLogger(e)};e.setLogVerbosity=e=>{l.setLoggerVerbosity(e)};e.getClientChannel=e=>a.Client.prototype.getChannel.call(e);var f=requireClientInterceptors();Object.defineProperty(e,"ListenerBuilder",{enumerable:!0,get:function(){return f.ListenerBuilder}}),Object.defineProperty(e,"RequesterBuilder",{enumerable:!0,get:function(){return f.RequesterBuilder}}),Object.defineProperty(e,"InterceptingCall",{enumerable:!0,get:function(){return f.InterceptingCall}}),Object.defineProperty(e,"InterceptorConfigurationError",{enumerable:!0,get:function(){return f.InterceptorConfigurationError}});var g=requireChannelz();Object.defineProperty(e,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return g.getChannelzServiceDefinition}}),Object.defineProperty(e,"getChannelzHandlers",{enumerable:!0,get:function(){return g.getChannelzHandlers}});var v=requireAdmin();Object.defineProperty(e,"addAdminServicesToServer",{enumerable:!0,get:function(){return v.addAdminServicesToServer}});var m=requireServerInterceptors();Object.defineProperty(e,"ServerListenerBuilder",{enumerable:!0,get:function(){return m.ServerListenerBuilder}}),Object.defineProperty(e,"ResponderBuilder",{enumerable:!0,get:function(){return m.ResponderBuilder}}),Object.defineProperty(e,"ServerInterceptingCall",{enumerable:!0,get:function(){return m.ServerInterceptingCall}});var A=requireOrca();Object.defineProperty(e,"ServerMetricRecorder",{enumerable:!0,get:function(){return A.ServerMetricRecorder}});const y=requireExperimental();e.experimental=y;const C=requireResolverDns(),S=requireResolverUds(),E=requireResolverIp(),_=requireLoadBalancerPickFirst(),b=requireLoadBalancerRoundRobin(),T=requireLoadBalancerOutlierDetection(),R=requireLoadBalancerWeightedRoundRobin(),x=requireChannelz();C.setup(),S.setup(),E.setup(),_.setup(),b.setup(),T.setup(),R.setup(),x.setup()}(src$2)),src$2}var srcExports=requireSrc();const A$1=await async function(e={}){var t=e,r=!!globalThis.window,n=!!globalThis.WorkerGlobalScope,i=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type;if(i){const{createRequire:e}=await import("module");var s=e(import.meta.url)}var a=(e,t)=>{throw t},o=import.meta.url;if(i)s("fs"),o.startsWith("file:")&&s("path").dirname(s("url").fileURLToPath(o)),process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),a=(e,t)=>{throw process.exitCode=e,t};else if(r||n)try{new URL(".",o).href}catch{}console.log.bind(console);var l,c,u,h,d,p,f,g,v,m,A,y,C,S,E=console.error.bind(console),_=!1,b=!1;function T(){var e=Te.buffer;h=new Int8Array(e),p=new Int16Array(e),d=new Uint8Array(e),f=new Uint16Array(e),g=new Int32Array(e),v=new Uint32Array(e),m=new Float32Array(e),A=new Float64Array(e),y=new BigInt64Array(e),C=new BigUint64Array(e)}function R(e){t.onAbort?.(e),E(e="Aborted("+e+")"),_=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw u?.(r),r}class x{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var w=e=>{for(;e.length>0;)e.shift()(t)},k=[],N=e=>k.push(e),I=[],O=e=>I.push(e),P=!0;class j{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){v[this.ptr+4>>2]=e}get_type(){return v[this.ptr+4>>2]}set_destructor(e){v[this.ptr+8>>2]=e}get_destructor(){return v[this.ptr+8>>2]}set_caught(e){e=e?1:0,h[this.ptr+12]=e}get_caught(){return 0!=h[this.ptr+12]}set_rethrown(e){e=e?1:0,h[this.ptr+13]=e}get_rethrown(){return 0!=h[this.ptr+13]}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){v[this.ptr+16>>2]=e}get_adjusted_ptr(){return v[this.ptr+16>>2]}}var L=e=>{for(var t="";;){var r=d[e++];if(!r)return t;t+=String.fromCharCode(r)}},q={},M={},D={},F=class extends Error{constructor(e){super(e),this.name="BindingError"}},B=e=>{throw new F(e)};function U(e,t,r={}){return function(e,t,r={}){var n=t.name;if(e||B(`type "${n}" must have a positive integer typeid pointer`),M.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;B(`Cannot register type '${n}' twice`)}if(M[e]=t,delete D[e],q.hasOwnProperty(e)){var i=q[e];delete q[e],i.forEach(e=>e())}}(e,t,r)}var $=(e,t,r)=>{switch(t){case 1:return r?e=>h[e]:e=>d[e];case 2:return r?e=>p[e>>1]:e=>f[e>>1];case 4:return r?e=>g[e>>2]:e=>v[e>>2];case 8:return r?e=>y[e>>3]:e=>C[e>>3];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},z=e=>{B(e.$$.ptrType.registeredClass.name+" instance already deleted")},H=!1,W=e=>{},G=e=>{e.count.value-=1,0===e.count.value&&(e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)})(e)},V=e=>globalThis.FinalizationRegistry?(H=new FinalizationRegistry(e=>{G(e.$$)}),V=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};H.register(e,r,e)}return e},W=e=>H.unregister(e),V(e)):(V=e=>e,e);function Y(){}var K=(e,t)=>Object.defineProperty(t,"name",{value:e}),J={},X=(e,t,r)=>{if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(...n){return e[t].overloadTable.hasOwnProperty(n.length)||B(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[n.length].apply(this,n)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}},Q=(e,r,n)=>{t.hasOwnProperty(e)?(B(`Cannot register public name '${e}' twice`),X(t,e,e),t[e].overloadTable.hasOwnProperty(n)&&B(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`),t[e].overloadTable[n]=r):(t[e]=r,t[e].argCount=n)};function Z(e,t,r,n,i,s,a,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=i,this.getActualType=s,this.upcast=a,this.downcast=o,this.pureVirtualFunctions=[]}var ee=(e,t,r)=>{for(;t!==r;)t.upcast||B(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e},te=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e};function re(e,t){if(null===t)return this.isReference&&B(`null is not a valid ${this.name}`),0;t.$$||B(`Cannot pass "${te(t)}" as a ${this.name}`),t.$$.ptr||B(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return ee(t.$$.ptr,r,this.registeredClass)}function ne(e,t){var r;if(null===t)return this.isReference&&B(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t&&t.$$||B(`Cannot pass "${te(t)}" as a ${this.name}`),t.$$.ptr||B(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&B(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;if(r=ee(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&B("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:B(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var i=t.clone();r=this.rawShare(r,Oe.toHandle(()=>i.delete())),null!==e&&e.push(this.rawDestructor,r)}break;default:B("Unsupporting sharing policy")}return r}function ie(e,t){if(null===t)return this.isReference&&B(`null is not a valid ${this.name}`),0;t.$$||B(`Cannot pass "${te(t)}" as a ${this.name}`),t.$$.ptr||B(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&B(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return ee(t.$$.ptr,r,this.registeredClass)}function se(e){return this.fromWireType(v[e>>2])}var ae=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var n=ae(e,t,r.baseClass);return null===n?null:r.downcast(n)},oe={},le=class extends Error{constructor(e){super(e),this.name="InternalError"}},ce=e=>{throw new le(e)},ue=(e,t)=>(t.ptrType&&t.ptr||ce("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&ce("Both smartPtrType and smartPtr must be specified"),t.count={value:1},V(Object.create(e,{$$:{value:t,writable:!0}})));function he(e,t,r,n,i,s,a,o,l,c,u){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=i,this.pointeeType=s,this.sharingPolicy=a,this.rawGetPointee=o,this.rawConstructor=l,this.rawShare=c,this.rawDestructor=u,i||void 0!==t.baseClass?this.toWireType=ne:n?(this.toWireType=re,this.destructorFunction=null):(this.toWireType=ie,this.destructorFunction=null)}var de=[],pe=(e,t,r=!1)=>{e=L(e);var n,i,s=((i=de[n=t])||(de[n]=i=Re.get(n)),i);return"function"!=typeof s&&B(`unknown function pointer with signature ${e}: ${t}`),s};class fe extends Error{}var ge=e=>{var t=Ee(e),r=L(t);return be(t),r},ve=(e,t)=>{var r=[],n={};throw t.forEach(function e(t){n[t]||M[t]||(D[t]?D[t].forEach(e):(r.push(t),n[t]=!0))}),new fe(`${e}: `+r.map(ge).join([", "]))},me=(e,t,r)=>{function n(t){var n=r(t);n.length!==e.length&&ce("Mismatched type converter count");for(var i=0;i<e.length;++i)U(e[i],n[i])}e.forEach(e=>D[e]=t);var i=new Array(t.length),s=[],a=0;for(let[e,r]of t.entries())M.hasOwnProperty(r)?i[e]=M[r]:(s.push(r),q.hasOwnProperty(r)||(q[r]=[]),q[r].push(()=>{i[e]=M[r],++a===s.length&&n(i)}));0===s.length&&n(i)},Ae=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function ye(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].destructorFunction)return!0;return!1}function Ce(e,t,r,n,i,s){var a=t.length;a<2&&B("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,l=ye(t),c=!t[0].isVoid,u=t[0],h=t[1],d=[e,B,n,i,Ae,u.fromWireType.bind(u),h?.toWireType.bind(h)],p=2;p<a;++p){var f=t[p];d.push(f.toWireType.bind(f))}if(!l)for(p=o?1:2;p<t.length;++p)null!==t[p].destructorFunction&&d.push(t[p].destructorFunction);let g=function(e,t,r,n){var i=ye(e),s=e.length-2,a=[],o=["fn"];t&&o.push("thisWired");for(var l=0;l<s;++l)a.push(`arg${l}`),o.push(`arg${l}Wired`);a=a.join(","),o=o.join(",");var c=`return function (${a}) {\n`;i&&(c+="var destructors = [];\n");var u=i?"destructors":"null",h=["humanName","throwBindingError","invoker","fn","runDestructors","fromRetWire","toClassParamWire"];for(t&&(c+=`var thisWired = toClassParamWire(${u}, this);\n`),l=0;l<s;++l){var d=`toArg${l}Wire`;c+=`var arg${l}Wired = ${d}(${u}, arg${l});\n`,h.push(d)}if(c+=(r||n?"var rv = ":"")+`invoker(${o});\n`,i)c+="runDestructors(destructors);\n";else for(l=t?1:2;l<e.length;++l){var p=1===l?"thisWired":"arg"+(l-2)+"Wired";null!==e[l].destructorFunction&&(c+=`${p}_dtor(${p});\n`,h.push(`${p}_dtor`))}return r&&(c+="var ret = fromRetWire(rv);\nreturn ret;\n"),c+="}\n",new Function(h,c)}(t,o,c,s);var v=g(...d);return K(e,v)}for(var Se,Ee,_e,be,Te,Re,xe=(e,t)=>{for(var r=[],n=0;n<e;n++)r.push(v[t+4*n>>2]);return r},we=e=>{const t=(e=e.trim()).indexOf("(");return-1===t?e:e.slice(0,t)},ke=[],Ne=[0,1,,1,null,1,!0,1,!1,1],Ie=e=>{e>9&&0===--Ne[e+1]&&(Ne[e]=void 0,ke.push(e))},Oe={toValue:e=>(e||B(`Cannot use deleted val. handle = ${e}`),Ne[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const t=ke.pop()||Ne.length;return Ne[t]=e,Ne[t+1]=1,t}}}},Pe={name:"emscripten::val",fromWireType:e=>{var t=Oe.toValue(e);return Ie(e),t},toWireType:(e,t)=>Oe.toHandle(t),readValueFromPointer:se,destructorFunction:null},je=(e,t,r)=>{switch(t){case 1:return r?function(e){return this.fromWireType(h[e])}:function(e){return this.fromWireType(d[e])};case 2:return r?function(e){return this.fromWireType(p[e>>1])}:function(e){return this.fromWireType(f[e>>1])};case 4:return r?function(e){return this.fromWireType(g[e>>2])}:function(e){return this.fromWireType(v[e>>2])};default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Le=(e,t)=>{var r=M[e];return void 0===r&&B(`${t} has unknown type ${ge(e)}`),r},qe=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(m[e>>2])};case 8:return function(e){return this.fromWireType(A[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Me=Object.assign({optional:!0},Pe),De=globalThis.TextDecoder&&new TextDecoder,Fe=(e,t,r,n)=>{var i=t+r;if(n)return i;for(;e[t]&&!(t>=i);)++t;return t},Be=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Ue=(e,t,r)=>{var n=e>>1,i=Fe(f,n,t/2,r);if(i-n>16&&Be)return Be.decode(f.subarray(n,i));for(var s="",a=n;a<i;++a){var o=f[a];s+=String.fromCharCode(o)}return s},$e=(e,t,r)=>{if(r??=2147483647,r<2)return 0;for(var n=t,i=(r-=2)<2*e.length?r/2:e.length,s=0;s<i;++s){var a=e.charCodeAt(s);p[t>>1]=a,t+=2}return p[t>>1]=0,t-n},ze=e=>2*e.length,He=(e,t,r)=>{for(var n="",i=e>>2,s=0;!(s>=t/4);s++){var a=v[i+s];if(!a&&!r)break;n+=String.fromCodePoint(a)}return n},We=(e,t,r)=>{if(r??=2147483647,r<4)return 0;for(var n=t,i=n+r-4,s=0;s<e.length;++s){var a=e.codePointAt(s);if(a>65535&&s++,g[t>>2]=a,(t+=4)+4>i)break}return g[t>>2]=0,t-n},Ge=e=>{for(var t=0,r=0;r<e.length;++r)e.codePointAt(r)>65535&&r++,t+=4;return t},Ve=0,Ye=[],Ke=(e,t,r)=>{var n=[],i=e(n,r);return n.length&&(v[t>>2]=Oe.toHandle(n)),i},Je={},Xe=e=>{var t=Je[e];return void 0===t?L(e):t},Qe={},Ze=e=>{if(e instanceof x||"unwind"==e)return l;a(1,e)},et=()=>P||Ve>0,tt=e=>{l=e,et()||(t.onExit?.(e),_=!0),a(e,new x(e))},rt=e=>{if(!_)try{e(),(()=>{if(!et())try{(e=>{l=e,tt(e)})(l)}catch(e){Ze(e)}})()}catch(e){Ze(e)}},nt=(e,t)=>Math.ceil(e/t)*t,it=e=>{var t=(e-Te.buffer.byteLength+65535)/65536|0;try{return Te.grow(t),T(),1}catch(e){}},st=new Uint8Array(123),at=25;at>=0;--at)st[48+at]=52+at,st[65+at]=at,st[97+at]=26+at;if(st[43]=62,st[47]=63,(()=>{let e=Y.prototype;Object.assign(e,{isAliasOf(e){if(!(this instanceof Y))return!1;if(!(e instanceof Y))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,i=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)i=n.upcast(i),n=n.baseClass;return t===n&&r===i},clone(){if(this.$$.ptr||z(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=V(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||z(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&B("Object already scheduled for deletion"),W(this),G(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||z(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&B("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});const t=Symbol.dispose;t&&(e[t]=e.delete)})(),Object.assign(he.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},readValueFromPointer:se,fromWireType:function(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=((e,t)=>(t=((e,t)=>{for(void 0===t&&B("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t})(e,t),oe[t]))(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function i(){return this.isSmartPointer?ue(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):ue(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,a=this.registeredClass.getActualType(t),o=J[a];if(!o)return i.call(this);s=this.isConst?o.constPointerType:o.pointerType;var l=ae(t,this.registeredClass,s.registeredClass);return null===l?i.call(this):this.isSmartPointer?ue(s.registeredClass.instancePrototype,{ptrType:s,ptr:l,smartPtrType:this,smartPtr:e}):ue(s.registeredClass.instancePrototype,{ptrType:s,ptr:l})}}),t.noExitRuntime&&(P=t.noExitRuntime),t.print&&t.print,t.printErr&&(E=t.printErr),t.wasmBinary&&t.wasmBinary,t.arguments&&t.arguments,t.thisProgram&&t.thisProgram,t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.shift()();var ot,lt={l:(e,t,r)=>{throw new j(e).init(t,r),e},s:()=>R(""),o:(e,t,r,n,i)=>{t=L(t);const s=0n===n;let a=e=>e;if(s){const e=8*r;a=t=>BigInt.asUintN(e,t),i=a(i)}U(e,{name:t,fromWireType:a,toWireType:(e,t)=>("number"==typeof t&&(t=BigInt(t)),t),readValueFromPointer:$(t,r,!s),destructorFunction:null})},w:(e,t,r,n)=>{U(e,{name:t=L(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:n},readValueFromPointer:function(e){return this.fromWireType(d[e])},destructorFunction:null})},e:(e,r,n,i,s,a,o,l,c,u,h,d,p)=>{h=L(h),a=pe(s,a),l&&=pe(o,l),u&&=pe(c,u),p=pe(d,p);var f=(e=>{var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?`_${e}`:e})(h);Q(f,function(){ve(`Cannot construct ${h} due to unbound types`,[i])}),me([e,r,n],i?[i]:[],r=>{var n,s;r=r[0],s=i?(n=r.registeredClass).instancePrototype:Y.prototype;var o=K(h,function(...e){if(Object.getPrototypeOf(this)!==c)throw new F(`Use 'new' to construct ${h}`);if(void 0===d.constructor_body)throw new F(`${h} has no accessible constructor`);var t=d.constructor_body[e.length];if(void 0===t)throw new F(`Tried to invoke ctor of ${h} with invalid number of parameters (${e.length}) - expected (${Object.keys(d.constructor_body).toString()}) parameters instead!`);return t.apply(this,e)}),c=Object.create(s,{constructor:{value:o}});o.prototype=c;var d=new Z(h,o,c,p,n,a,l,u);d.baseClass&&(d.baseClass.__derivedClasses??=[],d.baseClass.__derivedClasses.push(d));var g=new he(h,d,!0,!1,!1),v=new he(h+"*",d,!1,!1,!1),m=new he(h+" const*",d,!1,!0,!1);return J[e]={pointerType:v,constPointerType:m},((e,r,n)=>{t.hasOwnProperty(e)||ce("Replacing nonexistent public symbol"),t[e].overloadTable,t[e]=r,t[e].argCount=n})(f,o),[g,v,m]})},b:(e,t,r,n,i,s,a,o,l)=>{var c=xe(r,n);t=L(t),t=we(t),s=pe(i,s,o),me([],[e],e=>{var n=`${(e=e[0]).name}.${t}`;function i(){ve(`Cannot call ${n} due to unbound types`,c)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]);var l=e.registeredClass.constructor;return void 0===l[t]?(i.argCount=r-1,l[t]=i):(X(l,t,n),l[t].overloadTable[r-1]=i),me([],c,i=>{var c=[i[0],null].concat(i.slice(1)),u=Ce(n,c,null,s,a,o);if(void 0===l[t].overloadTable?(u.argCount=r-1,l[t]=u):l[t].overloadTable[r-1]=u,e.registeredClass.__derivedClasses)for(const r of e.registeredClass.__derivedClasses)r.constructor.hasOwnProperty(t)||(r.constructor[t]=u);return[]}),[]})},n:(e,t,r,n,i,s)=>{var a=xe(t,r);i=pe(n,i),me([],[e],e=>{var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new F(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{ve(`Cannot construct ${e.name} due to unbound types`,a)},me([],a,n=>(n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Ce(r,n,null,i,s),[])),[]})},a:(e,t,r,n,i,s,a,o,l,c)=>{var u=xe(r,n);t=L(t),t=we(t),s=pe(i,s,l),me([],[e],e=>{var n=`${(e=e[0]).name}.${t}`;function i(){ve(`Cannot call ${n} due to unbound types`,u)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,h=c[t];return void 0===h||void 0===h.overloadTable&&h.className!==e.name&&h.argCount===r-2?(i.argCount=r-2,i.className=e.name,c[t]=i):(X(c,t,n),c[t].overloadTable[r-2]=i),me([],u,i=>{var o=Ce(n,i,e,s,a,l);return void 0===c[t].overloadTable?(o.argCount=r-2,c[t]=o):c[t].overloadTable[r-2]=o,[]}),[]})},u:e=>U(e,Pe),z:(e,t,r,n)=>{function i(){}t=L(t),i.values={},U(e,{name:t,constructor:i,fromWireType:function(e){return this.constructor.values[e]},toWireType:(e,t)=>t.value,readValueFromPointer:je(t,r,n),destructorFunction:null}),Q(t,i)},f:(e,t,r)=>{var n=Le(e,"enum");t=L(t);var i=n.constructor,s=Object.create(n.constructor.prototype,{value:{value:r},constructor:{value:K(`${n.name}_${t}`,function(){})}});i.values[r]=s,i[t]=s},m:(e,t,r)=>{U(e,{name:t=L(t),fromWireType:e=>e,toWireType:(e,t)=>t,readValueFromPointer:qe(t,r),destructorFunction:null})},d:(e,t,r,n,i)=>{t=L(t);let s=e=>e;if(0===n){var a=32-8*r;s=e=>e<<a>>>a,i=s(i)}U(e,{name:t,fromWireType:s,toWireType:(e,t)=>t,readValueFromPointer:$(t,r,0!==n),destructorFunction:null})},c:(e,t,r)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][t];function i(e){var t=v[e>>2],r=v[e+4>>2];return new n(h.buffer,r,t)}U(e,{name:r=L(r),fromWireType:i,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})},A:(e,t)=>{U(e,Me)},v:(e,t)=>{U(e,{name:t=L(t),fromWireType(e){var t;return t=((e,t,r)=>e?((e,t=0,r,n)=>{var i=Fe(e,t,r,n);if(i-t>16&&e.buffer&&De)return De.decode(e.subarray(t,i));for(var s="";t<i;){var a=e[t++];if(128&a){var o=63&e[t++];if(192!=(224&a)){var l=63&e[t++];if((a=224==(240&a)?(15&a)<<12|o<<6|l:(7&a)<<18|o<<12|l<<6|63&e[t++])<65536)s+=String.fromCharCode(a);else{var c=a-65536;s+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else s+=String.fromCharCode((31&a)<<6|o)}else s+=String.fromCharCode(a)}return s})(d,e,t,r):"")(e+4,v[e>>2],!0),be(e),t},toWireType(e,t){var r;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var n="string"==typeof t;n||ArrayBuffer.isView(t)&&1==t.BYTES_PER_ELEMENT||B("Cannot pass non-string to std::string"),r=n?(e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t})(t):t.length;var i=Se(4+r+1),s=i+4;return v[i>>2]=r,n?((e,t,r,n)=>{if(!(n>0))return 0;for(var i=r+n-1,s=0;s<e.length;++s){var a=e.codePointAt(s);if(a<=127){if(r>=i)break;t[r++]=a}else if(a<=2047){if(r+1>=i)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(a<=65535){if(r+2>=i)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=i)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a,s++}}t[r]=0})(t,d,s,r+1):d.set(t,s),null!==e&&e.push(be,i),i},readValueFromPointer:se,destructorFunction(e){be(e)}})},j:(e,t,r)=>{var n,i,s;r=L(r),2===t?(n=Ue,i=$e,s=ze):(n=He,i=We,s=Ge),U(e,{name:r,fromWireType:e=>{var r=v[e>>2],i=n(e+4,r*t,!0);return be(e),i},toWireType:(e,n)=>{"string"!=typeof n&&B(`Cannot pass non-string to C++ string type ${r}`);var a=s(n),o=Se(4+a+t);return v[o>>2]=a/t,i(n,o+4,a+t),null!==e&&e.push(be,o),o},readValueFromPointer:se,destructorFunction(e){be(e)}})},x:(e,t)=>{U(e,{isVoid:!0,name:t=L(t),fromWireType:()=>{},toWireType:(e,t)=>{}})},q:()=>{P=!1,Ve=0},i:(e,t,r)=>{var[n,...i]=((e,t)=>{for(var r=new Array(e),n=0;n<e;++n)r[n]=Le(v[t+4*n>>2],`parameter ${n}`);return r})(e,t),s=n.toWireType.bind(n),a=i.map(e=>e.readValueFromPointer.bind(e));e--;var o,l={toValue:Oe.toValue},c=a.map((e,t)=>{var r=`argFromPtr${t}`;return l[r]=e,`${r}(args${t?"+"+8*t:""})`});switch(r){case 0:o="toValue(handle)";break;case 2:o="new (toValue(handle))";break;case 3:o="";break;case 1:l.getStringOrSymbol=Xe,o="toValue(handle)[getStringOrSymbol(methodName)]"}o+=`(${c})`,n.isVoid||(l.toReturnWire=s,l.emval_returnValue=Ke,o=`return emval_returnValue(toReturnWire, destructorsRef, ${o})`),o=`return function (handle, methodName, destructorsRef, args) {\n ${o}\n }`;var u,h,d=new Function(Object.keys(l),o)(...Object.values(l)),p=`methodCaller<(${i.map(e=>e.name)}) => ${n.name}>`;return u=K(p,d),h=Ye.length,Ye.push(u),h},k:Ie,y:e=>{e>9&&(Ne[e+1]+=1)},h:(e,t,r,n,i)=>Ye[e](t,r,n,i),g:e=>{var t=Oe.toValue(e);Ae(t),Ie(e)},r:(e,t)=>{if(Qe[e]&&(clearTimeout(Qe[e].id),delete Qe[e]),!t)return 0;var r=setTimeout(()=>{delete Qe[e],rt(()=>_e(e,performance.now()))},t);return Qe[e]={id:r,timeout_ms:t},0},t:e=>{var t=d.length,r=2147483648;if((e>>>=0)>r)return!1;for(var n=1;n<=4;n*=2){var i=t*(1+.2/n);i=Math.min(i,e+100663296);var s=Math.min(r,nt(Math.max(e,i),65536));if(it(s))return!0}return!1},p:tt};return ot=await async function(){function e(e,t){return function(e){Se=e.D,Ee=e.E,_e=e.F,be=e.H,Te=e.B,Re=e.G}(ot=e.exports),T(),ot}var r={a:lt};return t.instantiateWasm?new Promise((n,i)=>{t.instantiateWasm(r,(t,r)=>{n(e(t))})}):(S??=function(e){for(var t,r=0,n=new Uint8Array(43076);r<43076;++r)t=e.charCodeAt(r),n[r]=~t>>8&t;return n}('\0asm\0\0\0«````\0`\0`\0`\0\0`\0`\0`\0````\0`\n\0`\t\0`\r\0`|`~~\0`|`\0`|\0£aa\0ab\0ac\0ad\0\tae\0af\0ag\0ah\0ai\0aj\0ak\0al\0am\0an\0\bao\0ap\0aq\0ar\0as\0at\0\0au\0av\0aw\0ax\0ay\0az\0aA\0žœ\0\0\v\0\0\0\0\n\0\b\v\0\0\n\n\f\n\v\0\0\t\0\0\0\0\v\f\n\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\n\0\0\0\b\b\t\t\t\b\0\0\r\0\0\0p¿¿‚€€\bAð¾\v B\0C\0¶D\x007E\0­F\0œG\0H\0\tù\0A\v¾Kcµ²®©¢™˜—–•”“’0‘000Ž00/S.R-,+@?>/S.R-,+@?>/Œ.‹-,+@?>/Š.‰-,+QPO/ˆ.‡-,+†…„/ƒ.‚-,+QPO)N)&N€~&}&|&{&z&y&xwMvMutsLrLqponmlkjihgfedb)][)"´³G"±°¯"¬Z)"GGW"W"« £¥"¤TT"Ÿ¡¦"ª¨§)"žš›\f\nÀ›œFA \0 \0AM!\0@@ \07" AÜ=(\0"\rA\0\v\f\v \0\f\0\v\0\v"\0E@Z\0\v \0\vß\v\b@ \0E\r\0 \0A\bk" \0Ak(\0"Axq"\0j!@ Aq\r\0 AqE\r  (\0"k"A8(\0I\r \0 j!\0@@@A”8(\0 G@ (\f! AÿM@  (\b"G\rA€8A€8(\0A~ Avwq6\0\f\v (!  G@ (\b" 6\f  6\b\f\v (" Aj ("E\r Aj\v!@ ! "Aj! ("\r\0 Aj! ("\r\0\v A\x006\0\f\v ("AqAG\rAˆ8 \x006\0  A~q6  \0Ar6  \x006\0\v  6\f  6\b\f\vA\0!\v E\r\0@ ("At"(°: F@ A°:j 6\0 \rA„8A„8(\0A~ wq6\0\f\v@  (F@  6\f\v  6\v E\r\v  6 ("@  6  6\v ("E\r\0  6  6\v  O\r\0 ("AqE\r\0@@@@ AqE@A˜8(\0 F@A˜8 6\0AŒ8AŒ8(\0 \0j"\x006\0  \0Ar6 A”8(\0G\rAˆ8A\x006\0A”8A\x006\0\vA”8(\0" F@A”8 6\0Aˆ8Aˆ8(\0 \0j"\x006\0  \0Ar6 \0 j \x006\0\v Axq \0j!\0 (\f! AÿM@ (\b" F@A€8A€8(\0A~ Avwq6\0\f\v  6\f  6\b\f\v (!\b  G@ (\b" 6\f  6\b\f\v (" Aj ("E\r Aj\v!@ ! "Aj! ("\r\0 Aj! ("\r\0\v A\x006\0\f\v  A~q6  \0Ar6 \0 j \x006\0\f\vA\0!\v \bE\r\0@ ("At"(°: F@ A°:j 6\0 \rA„8A„8(\0A~ wq6\0\f\v@  \b(F@ \b 6\f\v \b 6\v E\r\v  \b6 ("@  6  6\v ("E\r\0  6  6\v  \0Ar6 \0 j \x006\0  G\r\0Aˆ8 \x006\0\v \0AÿM@ \0AøqA¨8j!A€8(\0"A \0Avt"\0qE@A€8 \0 r6\0 \f\v (\b\v!\0  6\b \0 6\f  6\f  \x006\b\vA! \0AÿÿÿM@ \0A& \0A\bvg"kvAq AtkA>j!\v  6 B\x007 AtA°:j!@A„8(\0"A t"qE@A„8  r6\0  6\0A!A\b\f\v \0A AvkA\0 AGt! (\0!@ "(Axq \0F\r Av! At!  Aqj"("\r\0\v  6A! !A\b\v!\0 "\f\v (\b" 6\f  6\bA!\0A\b!A\0\v!  j 6\0  6\f \0 j 6\0A 8A 8(\0Ak"\0A \06\0\v\v,\0 E@ \0( (F\v \0 F@A\v \0( (\'E\v}@@ \0"AqE\r\0 -\0\0E@A\0\v@ Aj"AqE\r -\0\0\r\0\v\f\v@ "Aj!A€‚„\b (\0"k rA€‚„xqA€‚„xF\r\0\v@ "Aj! -\0\0\r\0\v\v  \0k\v\f\0  \0(\0\0\0\v®#\0Ak"$\0  \0(\0"A\bk(\0"6\f  \0 j6  Ak(\x006\b (!@ (\b" A\0@A\0  (\f!\f\v#\0A@j"$\0 \0 N@  6\f  6  \x006\b AjA\0A$ü\v\0 A\x006< B€€€€€€€74  Aj  AA\0 (\0(\b\0 \0A\0 (!\v A@k$\0 "\r\0#\0A@j"$\0 A¼-6\f  \x006\b  6A\0!\0 AjA\0A+ü\v\0 A\x006< A:\0;  Aj AA\0 (\0(\t\0@@@ ((\0\v (A\0 ($AFA\0 ( AFA\0 (,AF!\0\f\v (AG@ (,\r ( AG\r ($AG\r\v (!\0\v A@k$\0 \0!\v Aj$\0 \v A! \0Aj" \0/\0AtAþÿqj!\0@ @@@@@ \0  AtAkAþÿqj.\0"j"\0-\0\0Ak\0\v  \0/Ajj!\f\v  \0/Ajj!\f\v \0/"E@ Aj!\f\v At" \0 AkAþÿqj/jAj!\v  j!\f\v@@@ \0-\0\0Ak\0\v \0/Aj!\f\v \0/Aj!\f\v \0/"E@A!\f\v At" \0 AkAþÿqj/jAj!\v  AtAþÿqj ;\0\v\0 \0\v\b\0A—\n_\0\v2 \0@ \0(\0$ \0($ \0(! \0A\x006 @ \v \0\v\v@@ AO@ \0 rAq\r@ \0(\0 (\0G\r Aj! \0Aj!\0 Ak"AK\r\0\v\v E\r\v@ \0-\0\0" -\0\0"F@ Aj! \0Aj!\0 Ak"\r\f\v\v  k\vA\0\v5  \0("Auj! \0(\0!\0  Aq (\0 \0j(\0 \0\v\0\0\vM -\0\0!@ \0-\0\0"E\r\0  G\r\0@ -\0! \0-\0"E\r Aj! \0Aj!\0  F\r\0\v\v  k\v¢\r@@@@@ -\0\0Ak\0\v AjA\0 -\0\0AFAj"\r ."AtAþÿqj! A\0 A\0J! Aj!@ \b G@A\0! \b \r \bAtAkAþÿqj.\0A\0\v j"AjA\0 -\0\0AF!\t /"Á!\v@@@@ Ak\0\v\vA!\fA! \tA\tjA\0 -\0\tAFAj"\f\vA! \tA\vjA\0 \t-\0\nAFAj!A!\f . \tA\njj"AjA\0 -\0\0AFAj\v!  \vH\rA\0\f\v \tAj!\nA!\f "!A\0\f\v \tAj" \vAtAþÿqj!\n  AtjAk.\0\v \nj\v!\n \v \fLA\0 \tAj" \vAtAþÿqj  \fAtjAk.\0j\v!@ @  \'\r\v  \nAj\'\r\0 \0A\0 \0    (\v \bAj!\b\f\v\v E\r  \0 /AjÁjO\rA\0\v E\r  \0 /AjÁjO\r\f\v A\0 \0Aj" K\r\0 \0A:\0\0 .! @   AtAjÁjI\r\v \0 ; A\0L@ \0\v AtAþÿq"@ \0AjA\0 ü\v\0\v  \0Aj"j Aj" /AtAþÿqj   (E\r\0 A\0!A!\b@ .\0"\t \bL@ \0\v  \bAtAkAþÿq"\nj.\0  \tAtAþÿqjj  \nj.\0  /AtAþÿqjj   (@  \b! \bAj!\b\fA\0\v\0\v\0\vA\0\v /AjÁ"E@ \0\v \0  ü\n\0\0 \0\v\0 \0\vT~@Aô7(\0"­ \0­B|Bøÿÿÿƒ|"BÿÿÿÿX@ §"\0?\0AtM\r \0\r\vAü7A06\0A\vAô7 \x006\0 \v–#\0Ak"$\0 Aj  \0\0A\f"\0A\x006\b \0B\x007\0@ (\b" ("G@  k"A\0H\r \0 "6\0 \0  j"6\b @   ü\n\0\0\v \0 6\v @  6\b \v Aj$\0 \0\v2\0\v1 \0( \0(\0k! \0( \0(\0"\0k"@  \0 ü\n\0\0\v \v\t\0  \0\0\0\vr#\0Ak"$\0 Aj"   \0\0 (\b ,\0" A\0H""\0Aj7" \x006\0 (! \0@ Aj    \0ü\n\0\0\v A\0H@ \v Aj$\0 \v°#\0Ak"$\0 (\0"AøÿÿÿI@@@ A\vO@ Ar"Aj!  Aÿÿÿÿk6\f  6  6\b\f\v  :\0 Aj! E\r\v E\r\0  Aj ü\n\0\0\v  jA\0:\0\0 Aj  \0\0 ,\0A\0H@ (\v Aj$\0\v#\0\v\v\0 \0@ \0\v\v¥ \0Aÿq!@@@ \0Aà\0F@A\b!AÜ!\f\v A‚„\bl!A\b!AÜ!@A€‚„\b (\0 s"k rA€‚„xqA€‚„xG\r Aj! Ak"AK\r\0\v E\r\v \0Aÿq!\0@ -\0\0 \0F\r Aj! Ak"\r\0\v\vA\0!\v \v\b\0AÌ\b_\0\v§@  O\r\0 A(:\0\0 Aj!@ \0.\0"A\0L\r\0@@@@ \0Aj"\b AtAþÿqj"-\0\0Ak\0\v  M\r Aà\0:\0 Aj! -\0"E\r Aj!@  M\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v -\0"E\r Aj!@  M\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v Aj  3"E\r\vA! \0.\0AL\r\0@  M\r A :\0\0 Aj!@@@@ At \bjAk.\0 \b \0/\0AtAþÿqjj"-\0\0Ak\0\v Aj  3"E\r\f\v  M\r Aà\0:\0 Aj! -\0"E\r Aj!@  M\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v -\0"E@ !\f\v Aj! !@  M\r  :\0\0 Aj! -\0! Aj! \r\0\v\v Aj" \0.\0H\r\0\v\v  M\r\0 A):\0\0 Aj!\v \vÒ  \0 F":\0\f@ \r\0@ (\b"-\0\f\r@@ (\b"(\0" F@@ ("E\r\0 -\0\f\r\0 A:\0\f  \0 F:\0\f A:\0\f\f\v@ (\0 F@ !\f\v  ("(\0"\x006@ \0E@  6\b  6\0\f\v \0 6\b (\b"(\0  6\b F@  6\0\f\v  6\v  6\0  6\b (\b"(\0!\v A:\0\f A\0:\0\f  ("\x006\0 \0@ \0 6\b\v  (\b"\x006\b@ \0(\0 F@ \0 6\0\f\v \0 6\v  6  6\b\v E\r -\0\f\r A:\0\f  \0 F:\0\f A:\0\f\v " \0G\r\f\v\v@ (\0" G@ !\f\v  ("\x006\0 \0@ \0 6\b (\b!\v  6\b@ (\0 F@  6\0\f\v  6\v  6  6\b (\b!\v A:\0\f A\0:\0\f  ("(\0"\x006 \0@ \0 6\b\v  (\b"\x006\b@ \0(\0 F@ \0 6\0\f\v \0 6\v  6\0  6\b\v\v¯\n \0Aj! \0("E@  6\0 \v /\0"\bAt"\0Aj!\t  \0AkAþÿqj!\n@ !\0A\0!A\0!A\0!@@ \b \n/A\0\v \tjÁ" \0("/\0"\v  \vAt"AkAþÿqj/A\0\v Aj"\fjÁ"N@  J\r   %A\0N\r\v \0! \0(\0"\r\f\vA\0!A\0! \v  AkAÿÿqj/A\0\v \fjÁ" \b \n/A\0\v \tjÁ"N@  J\r   %A\0N\r\v \0Aj! \0("\r\v\v  \x006\0 \vø@@@@@ -\0\0Ak\0\v  \0AjI\r /! /! /\f! \0A:\0\0  \0Aj"   jj"Áj"I\r \0 ; ."A\0J@ @  (\0 ü\n\0\0\v /!\v AkÁ"@  Áj Aj ü\n\0\0\v@ .\f"A\0L\r\0 E\r\0  .j j (\b ü\n\0\0\v AkA\0:\0\0 \0\v  \0 /AjÁ"jI\r E\r \0  ü\n\0\0\f\v  \0Aj"I\r\0 \0A:\0\0   ."At"AjÁjI\r\0 \0 ; A\0L\r Aÿÿq"@ \0AjA\0 ü\v\0\v \0Aj" AtAþÿqj Aj" /AtAþÿqj  6E\r\0 A\0!A!@  .\0"\bN\r  AtAkAþÿq"\tj.\0  \bAtAþÿqjj  \tj.\0  /AtAþÿqjj  6@  ! Aj!\f\v\v\vA\0\v \0\vÁ\'\v#\0Ak"\n$\0@@@@@@@@@@ \0AôM@A€8(\0"A \0A\vjAøq \0A\vI"Av"\0v"Aq@@ AsAq \0j"At"A¨8j"\0 (°8"(\b"F@A€8 A~ wq6\0\f\v  \x006\f \0 6\b\v A\bj!\0  Ar6  j" (Ar6\f\v\v Aˆ8(\0"\bM\r @@A \0t"A\0 kr  \0tqh"At"A¨8j" (°8"\0(\b"F@A€8 A~ wq"6\0\f\v  6\f  6\b\v \0 Ar6 \0 j"  k"Ar6 \0 j 6\0 \b@ \bAxqA¨8j!A”8(\0! A \bAvt"qE@A€8  r6\0 \f\v (\b\v!  6\b  6\f  6\f  6\b\v \0A\bj!\0A”8 6\0Aˆ8 6\0\f\v\vA„8(\0"\vE\r \vhAt(°:"(Axq k! !@@ ("\0E@ ("\0E\r\v \0(Axq k"   I"! \0  ! \0!\f\v\v (!\t  (\f"\0G@ (\b" \x006\f \0 6\b\f\n\v (" Aj ("E\r Aj\v!@ ! "\0Aj! \0("\r\0 \0Aj! \0("\r\0\v A\x006\0\f\t\vA! \0A¿K\r\0 \0A\vj"Axq!A„8(\0"E\r\0A!\bA\0 k! \0AôÿÿM@ A& A\bvg"\0kvAq \0AtkA>j!\b\v@@@ \bAt(°:"E@A\0!\0\f\vA\0!\0 A \bAvkA\0 \bAGt!@@ (Axq k" O\r\0 ! "\r\0A\0! !\0\f\v \0 ("   AvAqj("F \0 !\0 At! \r\0\v\v \0 rE@A\0!A \bt"\0A\0 \0kr q"\0E\r \0hAt(°:!\0\v \0E\r\v@ \0(Axq k" I!   ! \0  ! \0("  \0(\v"\0\r\0\v\v E\r\0 Aˆ8(\0 kO\r\0 (!\b  (\f"\0G@ (\b" \x006\f \0 6\b\f\b\v (" Aj ("E\r Aj\v!@ ! "\0Aj! \0("\r\0 \0Aj! \0("\r\0\v A\x006\0\f\v Aˆ8(\0"M@A”8(\0!\0@  k"AO@ \0 j" Ar6 \0 j 6\0 \0 Ar6\f\v \0 Ar6 \0 j" (Ar6A\0!A\0!\vAˆ8 6\0A”8 6\0 \0A\bj!\0\f\t\v AŒ8(\0"I@AŒ8  k"6\0A˜8A˜8(\0"\0 j"6\0  Ar6 \0 Ar6 \0A\bj!\0\f\t\vA\0!\0 A/j"AØ;(\0@Aà;(\0\f\vAä;B7\0AÜ;B€ €€€€7\0AØ; \nA\fjApqAتժs6\0Aì;A\x006\0A¼;A\x006\0A€ \v"j"A\0 k"q" M\r\bA¸;(\0"@A°;(\0"\b j"\t \bM\r\t  \tI\r\t\v@A¼;-\0\0AqE@@@@@A˜8(\0"@AÀ;!\0@ \0(\0"\b M@  \b \0(jI\r\v \0(\b"\0\r\0\v\vA\0*"AF\r !AÜ;(\0"\0Ak" q@  k  jA\0 \0kqj!\v  M\rA¸;(\0"\0@A°;(\0" j" M\r \0 I\r\v *"\0 G\r\f\v  k q"*" \0(\0 \0(jF\r !\0\v \0AF\r A0j M@ \0!\f\vAà;(\0"  kjA\0 kq"*AF\r  j! \0!\f\v AG\r\vA¼;A¼;(\0Ar6\0\v *!A\0*!\0 AF\r \0AF\r \0 M\r \0 k" A(jM\r\vA°;A°;(\0 j"\x006\0A´;(\0 \0I@A´; \x006\0\v@A˜8(\0"@AÀ;!\0@  \0(\0" \0("jF\r \0(\b"\0\r\0\v\f\vA8(\0"\0A\0 \0 ME@A8 6\0\vA\0!\0AÄ; 6\0AÀ; 6\0A 8A6\0A¤8AØ;(\x006\0AÌ;A\x006\0@ \0At" A¨8j"6°8  6´8 \0Aj"\0A G\r\0\vAŒ8 A(k"\0Ax kAq"k"6\0A˜8  j"6\0  Ar6 \0 jA(6Aœ8Aè;(\x006\0\f\v  M\r  K\r \0(\fA\bq\r \0  j6A˜8 Ax kAq"\0j"6\0AŒ8AŒ8(\0 j" \0k"\x006\0  \0Ar6  jA(6Aœ8Aè;(\x006\0\f\vA\0!\0\f\vA\0!\0\f\vA8(\0 K@A8 6\0\v  j!AÀ;!\0@@  \0(\0"G@ \0(\b"\0\r\f\v\v \0-\0\fA\bqE\r\vAÀ;!\0@@ \0(\0" M@   \0(j"I\r\v \0(\b!\0\f\v\vAŒ8 A(k"\0Ax kAq"k"6\0A˜8  j"6\0  Ar6 \0 jA(6Aœ8Aè;(\x006\0  A\' kAqjA/k"\0 \0 AjI"A6 AÈ;)\x007 AÀ;)\x007\bAÈ; A\bj6\0AÄ; 6\0AÀ; 6\0AÌ;A\x006\0 Aj!\0@ \0A6 \0A\bj \0Aj!\0 I\r\0\v  F\r\0  (A~q6   k"Ar6  6\0 AÿM@ AøqA¨8j!\0A€8(\0"A Avt"qE@A€8  r6\0 \0\f\v \0(\b\v! \0 6\b  6\fA\f!A\b\f\vA!\0 AÿÿÿM@ A& A\bvg"\0kvAq \0AtkA>j!\0\v  \x006 B\x007 \0AtA°:j!@@A„8(\0"A \0t"qE@A„8  r6\0  6\0\f\v A \0AvkA\0 \0AGt!\0 (\0!@ "(Axq F\r \0Av! \0At!\0  Aqj"("\r\0\v  6\v  6A\b! "!\0A\f\f\v (\b"\0 6\f  6\b  \x006\bA\0!\0A!A\f\v j 6\0  j \x006\0\vAŒ8(\0"\0 M\r\0AŒ8 \0 k"6\0A˜8A˜8(\0"\0 j"6\0  Ar6 \0 Ar6 \0A\bj!\0\f\vAü7A06\0A\0!\0\f\v \0 6\0 \0 \0( j6 Ax kAqj"\b Ar6 Ax kAqj"  \bj"k!@A˜8(\0 F@A˜8 6\0AŒ8AŒ8(\0 j"\x006\0  \0Ar6\f\vA”8(\0 F@A”8 6\0Aˆ8Aˆ8(\0 j"\x006\0  \0Ar6 \0 j \x006\0\f\v ("\0AqAF@ \0Axq!\t (\f!@ \0AÿM@ (\b" F@A€8A€8(\0A~ \0Avwq6\0\f\v  6\f  6\b\f\v (!@  G@ (\b"\0 6\f  \x006\b\f\v@ ("\0 Aj ("\0E\r Aj\v!@ ! \0"Aj! \0("\0\r\0 Aj! ("\0\r\0\v A\x006\0\f\vA\0!\v E\r\0@ ("\0At"(°: F@ A°:j 6\0 \rA„8A„8(\0A~ \0wq6\0\f\v@  (F@  6\f\v  6\v E\r\v  6 ("\0@  \x006 \0 6\v ("\0E\r\0  \x006 \0 6\v  \tj!  \tj"(!\0\v  \0A~q6  Ar6  j 6\0 AÿM@ AøqA¨8j!\0A€8(\0"A Avt"qE@A€8  r6\0 \0\f\v \0(\b\v! \0 6\b  6\f  \x006\f  6\b\f\vA! AÿÿÿM@ A& A\bvg"\0kvAq \0AtkA>j!\v  6 B\x007 AtA°:j!\0@@A„8(\0"A t"qE@A„8  r6\0 \0 6\0\f\v A AvkA\0 AGt! \0(\0!@ "\0(Axq F\r Av! At! \0 Aqj"("\r\0\v  6\v  \x006  6\f  6\b\f\v \0(\b" 6\f \0 6\b A\x006  \x006\f  6\b\v \bA\bj!\0\f\v@ \bE\r\0@ ("At"(°: F@ A°:j \x006\0 \0\rA„8 A~ wq"6\0\f\v@  \b(F@ \b \x006\f\v \b \x006\v \0E\r\v \0 \b6 ("@ \0 6  \x006\v ("E\r\0 \0 6  \x006\v@ AM@   j"\0Ar6 \0 j"\0 \0(Ar6\f\v  Ar6  j" Ar6  j 6\0 AÿM@ AøqA¨8j!\0A€8(\0"A Avt"qE@A€8  r6\0 \0\f\v \0(\b\v! \0 6\b  6\f  \x006\f  6\b\f\vA!\0 AÿÿÿM@ A& A\bvg"\0kvAq \0AtkA>j!\0\v  \x006 B\x007 \0AtA°:j!@@ A \0t"qE@A„8  r6\0  6\0  6\f\v A \0AvkA\0 \0AGt!\0 (\0!@ "(Axq F\r \0Av! \0At!\0  Aqj"("\r\0\v  6  6\v  6\f  6\b\f\v (\b"\0 6\f  6\b A\x006  6\f  \x006\b\v A\bj!\0\f\v@ \tE\r\0@ ("At"(°: F@ A°:j \x006\0 \0\rA„8 \vA~ wq6\0\f\v@  \t(F@ \t \x006\f\v \t \x006\v \0E\r\v \0 \t6 ("@ \0 6  \x006\v ("E\r\0 \0 6  \x006\v@ AM@   j"\0Ar6 \0 j"\0 \0(Ar6\f\v  Ar6  j" Ar6  j 6\0 \b@ \bAxqA¨8j!\0A”8(\0!A \bAvt" qE@A€8  r6\0 \0\f\v \0(\b\v! \0 6\b  6\f  \x006\f  6\b\vA”8 6\0Aˆ8 6\0\v A\bj!\0\v \nAj$\0 \0\v? A\bu! \0  Aq  (\0j(\0 \v j A Aq  \0(\0(\t\0\vÕ\b#\0Ak"$\0@@@ \0("-\0\0Ak\0\v@ \0(\b" \0(\f"\b\'\r\0A!@@@@ \0(\0"-\0\0"\tAk\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v Aÿÿq /AjAÿÿqG\r\0A!A!@@@@ \tAk\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v   Á%E\r\vA\0! Aj \b (\0 (D"E\r  \0(\x006\0 Aj! @ ."AN@ .!\0 -\0\0!  6\b  \0 AtAþÿq A\0 AFjjAj6\f\v  6\b A\x006A\0 AH\r\v A\0 -\0\0AF"\0Aj AtAþÿqj \0.j\v"\0AjA\0 \0-\0\0AFAj6\f  9!\f\vA! ."A\0L@A\0!\f\v  \0(\x006\0  Aj" AtAþÿq"\bj6  \0(\b6\b  \0(\f6\f  9\r\0 A\0 A\0J!A!  \bj!@  F@A\0!\f\v  \0(\x006\0    AtAkAþÿqj.\0j6  \0(\b6\b  \0(\f6\f Aj!  9E\r\0\v\v Aj$\0 \v­\b#\0Ak"$\0 \0("-\0\0!@ \0(\0"-\0\0"AF@@ AG\r\0 \0(\b \0(\f\'\r\0 /" /G\r\0   AjÁ%E\r\v  6\0  \0(6  \0(\b6\b  \0(\f6\f  E\f\v AF@  6  6\0  \0(\f6\b  \0(\b6\f  E\f\v@ AG\r\0 AG\r\0 /"\0 /F@   \0AjÁ%E\r\v A\x006\f\v@@ AG\r\0 AG\r\0 / /G\rA! ."\bA\0L\r  Aj" \bAtAþÿqj6\0  Aj"\b ."AtAþÿqjA\0 A\0J6  \0(\b6\b  \0(\f6\f  : (E\r@  ."N\r   AtAkAþÿq"\tj.\0  AtAþÿqjj6\0  ." LA\0 \b \tj.\0 \b AtAþÿqjj\v6  \0(\b6\b  \0(\f6\f Aj!  : (\r\0\v\f\v A\x006\f\v A\x006\v Aj$\0\v2 \0@ \0(\0; \0(; \0(! \0A\x006 @ \v \0\v\vº\b \0Aj!@@ \0("\0E\r\0 /\0"At"Aj!  AkAþÿqj!\b !@A!@ \0("\t/\0" At" \t AkAþÿqj/jAjA\vÁ"  \b/A\0\v jÁ"H@ \0Aj!\0\f\v  H@ \0!\f\v  \0 \t  %"A\0H! \0 AvAqj!\0\v \0(\0"\0\r\0\v  F\r\0  \b/A\0\v jÁ!  ("/\0"\0 \0At"\0  \0AkAþÿqj/jAjA\vÁ"\0H\r\0 \0 H\r   %A\0N\r\v !\v \vñ .\0!@ @  \0 AtAjÁjI\r\v \0 ;\0 A\0L@ \0\v AtAþÿq"@ \0AjA\0 ü\v\0\v \0Aj" j Aj" /\0AtAþÿqj   (E\r\0 \0A\0!A!@ \0.\0"\b L@ \0\v  AtAkAþÿq"\tj.\0  \bAtAþÿqjj  \tj.\0  /\0AtAþÿqjj   (E\r \0 ! Aj!\f\0\v\0\vA\0\v\v\0 \0/\0AjÁ\v+ \0/\0AjÁ! \0/\0AjÁ"@  \0 ü\n\0\0\v \vt \0A\x006\b \0B\x007\0 /\0Aj"Á!@ Aÿÿq@ A\0H\r ! @ A\0 ü\v\0\v \0  j"6\b \0 6 \0 6\0\v @   ü\n\0\0\v\v2\0\vA A\bu! \0   Aq  (\0j(\0 \v j A Aq  \0(\0(\b\0\vv \0($"E@ \0 6 \0 6 \0A6$ \0 \0(86\v@@ \0( \0(8G\r\0 \0( G\r\0 \0(AG\r \0 6\v \0A:\x006 \0A6 \0 Aj6$\v\vš\0 \0A:\x005@  \0(G\r\0 \0A:\x004@ \0("E@ \0A6$ \0 6 \0 6 AG\r \0(0AF\r\f\v  F@ \0("AF@ \0 6 !\v \0(0AG\r AF\r\f\v \0 \0($Aj6$\v \0A:\x006\v\vž  G@ \0Aj!@ -\0\0!@ Aj /"At"Aþÿqj"\0Aj \'\r\0 \0 .jAj \'\r\0 \vA!\0@@@ Ak\0\0\v Aj!\0\f\v   AkAþÿqj/jAj!\0\v  \0Áj" G\r\0\v\vA\0\vž\f#\0Ak"\b$\0@ \0(\0"Aj \0(\b"\n (\0" ("D"@ Aj! \b@ ."AN@ \b . AtAþÿq A\0 -\0\0AFjjAj6\0 \b \0(6\f\v \bA\x006\0 \b \0(6A\0 AH\r\v A\0 -\0\0AF"Aj AtAþÿqj .j\v"AjA\0 -\0\0AFAj6\b \b \0(\f6\f \b :\f\v@ \0("-\0\0AG\r\0 Aj \0(\f  D"E\r\0 \b 6\0 Aj! \b@ ."AN@ .! -\0\0!\0 \b \n6\b \b  AtAþÿq A\0 \0AFjjAj6\f\v \b \n6\b \bA\x006A\0 AH\r\v A\0 -\0\0AF"\0Aj AtAþÿqj \0.j\v"\0AjA\0 \0-\0\0AFAj6\f \b E\f\v \0 9@ A\x006\f\v Aj!\v@ (\f"E\r\0  \vO\r\0 A\x006\f\v A:\0\0@ A\0  A\vjIE@ B\x007 A;@ (\f"E\r\0  A\fjO\r\0 A\x006\f\v A:\0\v A\0  \0(\b"AjÁ"\t Aj"\njI\r  \t;\f \tAN@A\0!@ A\0!\tA!E@  j-\0\0"\tE!\v  \nj \t:\0\0 Aj" .\f"\tAkH\r\0\v\v \t \njAkA\0:\0\0A!@@@@ Aj"\f /"AtAþÿqj"-\0\0Ak\0\v /Aj!\f\v /Aj!\f\vA! /"E\r\0 At"  AkAþÿqj/jAj!\v  ;  Áj!@ (\f"E\r\0  A\0 AKAjO\r\0 A\x006\f\v A:\0\0A\0! A\0 AK"AjA\0 -\0\0"\nAFAj!\r@ A\0  \r \0(\f"AjÁ"\tjIE@  \t; \tAN@A\0!@ A\0!\tA!E@  j-\0\0"\tE!\v  \rj \t:\0\0 Aj" ."\tAkH\r\0\v\v \t \rjAkA\0:\0\0 \nAF\r\v A\x006\f\vA!@@@@ \f \v/\0"AtAþÿqj"\n \f.\0"j"-\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v   j";@ (\f"E\r\0A!@@@@ \0(\0"\v-\0\0Ak\0\v \v/Aj!\f\v \v/Aj!\f\v \v/"E@A!\f\v At" \v AkAþÿqj/jAj!\v  Á \n ÁjA\0 AKjO\r\0 A\x006\f\vA!@@@@ \0(\0"-\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v Á"@ \n ÁjA\0 AK  ü\n\0\0\vA!@@@@ \f /"AtAþÿqj"\n ."j"-\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v   j";@ (\f"E\r\0A!@@@@ \0("\v-\0\0Ak\0\v \v/Aj!\f\v \v/Aj!\f\v \v/"E@A!\f\v At" \v AkAþÿqj/jAj!\v  Á \n ÁjA\0 AKjO\r\0 A\x006\f\vA!@@@@ \0("-\0\0Ak\0\v /Aj!\f\v /Aj!\f\vA! /"\0E\r\0 \0At"\0  \0AkAþÿqj/jAj!\v Á"\0@ \n ÁjA\0 AK  \0ü\n\0\0\vA!\0A!@@@@ ." \f /AtAþÿqjj"-\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v   j;\t@@@@ ("-\0\0Ak\0\v /Aj!\0\f\v /Aj!\0\f\v /"\0E@A!\0\f\v \0At"\0  \0AkAþÿqj/jAj!\0\v   \0Áj6  /\bAj;\b\f\v A\x006\f\v A\x006\v \bAj$\0\v¾ Aj!@@ -\0"A)F@ \0!\f\v \0!@@ Aÿq"A?K\r\0B ­†BÌ€€ƒP\r\0 -\0! Aj! A)G\r\f\v  Aj"I\r@@@ A(G@ Aà\0F@ A:\0\0 ! Aj"\t!@ Aj! ,\0"1\r  O\r\b  :\0\0 Aj! !\f\0\v\0\v A:\0\0 Aj"\t!@ ,\0\0"1E@  O\r\b  :\0\0 Aj! Aj!\f\v\v  I\r\f\v A:\0\0   F"\r\f\v  O\r\v A\0:\0\0  \tAj;\0\vA!@@@@ -\0\0Ak\0\v /\0Aj!\f\v /\0Aj!\f\v /\0"E@A!\f\v At"  AkAþÿqj/jAj!\v Aj!  Áj! -\0\0"A)G\r\0\v\v   At"AjÁ"jI\r\0  \0k"@ \0 j \0 ü\n\0\0\v Aj!\b \0 ;\0 ÁA\0L\r\0 \0Aj!\0 Aÿÿq"@ \0A\0 ü\v\0\vA!@@@@ \0 j"-\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v \0 ;\0 Aÿÿq"AF\r\0A!@A!@@@@  \0 At"AkAþÿqj.\0"j"-\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v \0 j  j;\0 Aj" G\r\0\v\v \b\v\0\vï@ \0-\0\0"AG\r\0 \0Aj"/\0AG\r\0 A\0 AF"-\0AG"@A\0\v \0. Ajj"-\0\0AG"@A\0\v A\0; A\x006\0@@ Aj"/\0\0\v \0-\0\fAG\r A\0  Aj6\0  \0/\rAk;\v A\0;\f A\x006\b@@ Aj"\0/\0\0\v -\0AG\r A\0 \0 Aj6\b  /Ak;\f\vA!\v \vñ\b\b \0Aj!\t@ E\r\0  \tO\r\0A\0\v@ .\0"AF\r\0 /\0AG\r\0A! \0  AtAþÿqjAjA\0 AJ AjAæ\bA²& JE\r\0@@@@ \0-\0\0Ak\0\v \0/Aj!\f\v \0/Aj!\f\v \0/"E@A!\f\v At" \0 AkAþÿqj/jAj!\v \0 Áj"  \0Aæ\b =E\r\0 /\0" At"  AkAþÿqj/jAjÁA\v j"  \0A²& =E\r\0A!  .\0"AtAþÿqjAj! .\0"A\0LA\0 Aj"\b At"\nAþÿqj!\vA\0! AG \b \nAkAþÿqj.\0A\0\v \vj\v!@@@@ -\0\0"\bAk\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\vA!@@@@ -\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v Aÿÿq AÿÿqG\r\0A!@@@@ \bAk\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v   Á%\r\0  AtAþÿqj"Aj!A!@@@@ -\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v /\0 E@ Aj!A\0\f\v  At" Aj" AkAþÿqj/\0jAjÁj!A\0 AH\r\0  Aÿÿqj\v!Ak!A!@@@@ -\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v At!   Ájk"@ \0 AjÁj  Áj ü\n\0\0\v \0 Á";\0 A\0L@ \0\vA\0! Aÿÿq"@ \tA\0 ü\v\0\v@ \0 Á! AjÁ" H\r\0\v \0\v \0A\0;\0A\0\vš#\0A k"$\0 \0Aj!@@ E\r\0  O\r\0A\0!\f\v  6  6  6  6  6\fA\0! A\0;\b  \x006  \x006\0 Aj : ("E@ \0A\0:\0\0\f\v A\0  /\bAtAjÁ" jI\r\0  (\0"k"@  j  ü\n\0\0\v \0A:\0\0 \0 .\b"; A\0J@A\0! AtAþÿq"@ \0AjA\0 ü\v\0\v@  Á! AjÁ" H\r\0\v\v \0!\v A j$\0 \vßAø;-\0\0E@Aø;A:\0\0AäAì0\vAÔA€A¸A\0AîAAñA\0AñA\0AÓ\bAóAAÔAAøAüAA\rA"\0A6\0AÔAµ\tAA€AŒA \0A\0A\0A\0\0A"\0A\b6\0AÔAÕ\nAA A°A\t \0A\0A\0A\0\0A"\0A\n6\0AÔA€\vAA¸AÀA\v \0A\0A\0A\0\0A"\0A\f6\0AÔAÂ\bAAÌAØA\r \0A\0A\0A\0\0A"\0A6\0AÔA¾\bAAàAðA \0A\0A\0A\0\0AøAA°A\0AÑAAñA\0AñA\0AÎ\nAÔAAØAðAA\0A¯AAñA\0AñA\0A\tA²AA¸AÔAøA\0AœAAñA\0AñA\0AÁ\vAŸAA¤A¼AÜA\0AûAAñA\0AñA\0A›\bAþAA„AœA¼A\0AÛAAñA\0AñA\0A‚\tAÞAAäAŒA¬A\0AËAAñA\0AñA\0A¬\vAÎAAøA‹\nAAÔAàAAA\0A\0AøA\nAAèAôAAA\0A\0AøAŠ\bAAüA„A A!A\0A\0AøA€\bAAˆAA"A#A\0A\0A"\0A$6\0AøAŸ\vAA”AœA% \0A\0A\0A\0\0A"\0A&6\0AøAû\nAA A¨A\' \0A\0A\0A\0\0AØA‹\nAA¬A¸A(A)A\0A\0AØA\nAAÀAÌA*A+A\0A\0AØAŠ\bAAÔAÜA,A-A\0A\0AØA€\bAAàAèA.A/A\0A\0A"\0A06\0AØAŸ\vAAìAôA1 \0A\0A\0A\0\0A"\0A26\0AØAû\nAAøA€A3 \0A\0A\0A\0\0A¸A‹\nAA„AA4A5A\0A\0A¸A\nAA˜A¤A6A7A\0A\0A¸AŠ\bAA¬A´A8A9A\0A\0A¸A€\bAA¸AÀA:A;A\0A\0A"\0A<6\0A¸AŸ\vAAÄAÌA= \0A\0A\0A\0\0A"\0A>6\0A¸Aû\nAAÐAØA? \0A\0A\0A\0\0A¤A‹\nAAÜAèAÀ\0AÁ\0A\0A\0A¤A\nAAðAüAÂ\0AÃ\0A\0A\0A¤AŠ\bAA„AŒAÄ\0AÅ\0A\0A\0A¤A€\bAAA˜AÆ\0AÇ\0A\0A\0A"\0AÈ\x006\0A¤AŸ\vAAœA¤AÉ\0 \0A\0A\0A\0\0A"\0AÊ\x006\0A¤Aû\nAA¨A°AË\0 \0A\0A\0A\0\0A„A‹\nAA´AÀAÌ\0AÍ\0A\0A\0A„A\nAAÈAÔAÎ\0AÏ\0A\0A\0A„AŠ\bAAÜAäAÐ\0AÑ\0A\0A\0A„A€\bAAèAðAÒ\0AÓ\0A\0A\0A"\0AÔ\x006\0A„AŸ\vAAôAüAÕ\0 \0A\0A\0A\0\0A"\0AÖ\x006\0A„Aû\nAA€AˆA×\0 \0A\0A\0A\0\0AäA‹\nAAŒA˜AØ\0AÙ\0A\0A\0AäA\nAA A¬AÚ\0AÛ\0A\0A\0AäAŠ\bAA´A¼AÜ\0AÝ\0A\0A\0AäA€\bAAÀAÈAÞ\0Aß\0A\0A\0A"\0Aà\x006\0AäAŸ\vAAÌAÔAá\0 \0A\0A\0A\0\0A"\0Aâ\x006\0AäAû\nAAØAàAã\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aä\x006\0AØA§\vAAäAìAå\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aæ\x006\0A¸A§\vAAðAøAç\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aè\x006\0A¤A¿\tAAüA„ Aé\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aê\x006\0A¤A‡\tAAˆ A” Aë\0 \0A\0A\0A\0\0Aœ A–\vAA\0Aœ AÁ\vAAœ A\tAAœ A›\bAAœ A™\tA\0A\b"\0A\x006 \0Aì\x006\0A„A\vAA¸ AÀ Aí\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aî\x006\0A„A¸\vAAÄ AÌ Aï\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Að\x006\0A„AŠ\tAAÐ AØ Añ\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aò\x006\0A„A–\bAAÜ Aä Aó\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aô\x006\0AäA¿\tAAè Að Aõ\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aö\x006\0AäA÷\bAAô Aü A÷\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aø\x006\0AäA‡\tAA€!AŒ!Aù\0 \0A\0A\0A\0\0A„AÊ\vAA !A´!Aú\0Aû\0A\0A\0AäAÊ\vAAÀ!AÔ!Aü\0Aý\0A\0A\0A„AÆ\tAAà!Aø!Aþ\0Aÿ\0A\0A\0AäAÆ\tAA€"A"A€AA\0A\0A„A¥\vAA "A°"A‚AƒA\0A\0AäA¥\vAA€"A"A€A„A\0A\0A¸"AÐ"Að"A\0A‘#A…AñA\0AñA\0AÌ\tA”#A†A¸"AA˜#A¤#A‡Aˆ\rA\b"\0A\x006 \0A‰6\0A¸"AÜ\nAA¬#A¸#AŠ \0A\0A\0A\0\0A\b"\0A\x006 \0A‹6\0A¸"Aë\nAA¬#A¸#AŠ \0A\0A\0A\0\0A\b"\0A\x006 \0AŒ6\0A¸"A¼\bAAÀ#AÈ#A \0A\0A\0A\0\0A"\0AŽ6\0A¸"AÖ\vAAÌ#AØ#A \0A\0A\0A\0\0A"\0A6\0A¸"A…\vAAà#Aì#A‘ \0A\0A\0A\0\0\v\r\0    \0\0\v´#\0Ak"$\0 (\0"AøÿÿÿI@@@ A\vO@ Ar"\bAj!  \bAÿÿÿÿk6\f  6  6\b\f\v  :\0 Aj! E\r\v E\r\0  Aj ü\n\0\0\v  jA\0:\0\0   Aj  \0\n\0 ,\0A\0H@ (\v Aj$\0\v#\0\v5  \0("Auj! \0(\0!\0  Aq (\0\0 \0j(\0 \0\v\0\0\v. \0/\0"E@A\v At" \0 AkAþÿqj/jAjÁ\vrA!A! \0/\0" At" \0 AkAþÿqj/jAjÁA\v! \0/\0"@ At" \0 AkAþÿqj/jAjÁ!\v @  \0 ü\n\0\0\v \v° \0A\x006\b \0B\x007\0@ /\0"  At"AkAþÿqj/A\0\v Aj"j"Aÿÿq@ Á"A\0H\r ! @ A\0 ü\v\0\v \0  j"6\b \0 6 \0 6\0\v   AkAÿÿqj/A\0\v jÁ"\0@   \0ü\n\0\0\v\v2\0\vó "!@@ -\0"@ Aj!  j!@  O\r  :\0\0 Aj! -\0! Aj! \r\0\v\v  k G\r\v  \0A\x006\b \0B\x007\0\v A\0:\0\0 "AøÿÿÿI@@@ A\vO@ Ar"Aj! \0 Aÿÿÿÿk6\b \0 6\0 \0 6 !\0\f\v \0 :\0\v E\r\v E\r\0 \0  ü\n\0\0\v \0 jA\0:\0\0 \v#\0\v€ ! \0(\0 \0 \0,\0\vA\0H!  j! Aj"!\0@@ ,\0\0"1E@ \0 O\r \0 :\0\0 \0Aj!\0 Aj!\f\v\v \0 O\r\0 \0A\0:\0\0  Aj;\0 \v A\0\v\b\0 \0]\vK@ E\r\0 A°/ "E\r\0 (\b \0(\bAsq\r\0 \0(\f (\fA\0E\r\0 \0( (A\0!\v \vn Aq! -\x007AF@ A\bu" E\r  (\0j(\0\f\v A\bu E\r\0  \0(68A\0!A\0\v! \0   j A Aq \0(\0(\0\v\n\0 \0 A\0\v\0\0\v\0X\0\v\0Y\0\vÚ\0A¼0AÑ\vAÔ0A”\tAA\0Aà0Aã\bAA€Aÿ\0Aø0AÜ\bAA€Aÿ\0Aì0AÚ\bAA\0AÿA„1A©\bAA€€~AÿÿA1A \bAA\0AÿÿAœ1A¸\bAA€€€€xAÿÿÿÿA¨1A¯\bAA\0AA´1Aï\tAA€€€€xAÿÿÿÿAÀ1Aæ\tAA\0AAÌ1AÜ\tA\bB€€€€€€€€€Bÿÿÿÿÿÿÿÿÿ\0AØ1AÓ\tA\bB\0BAä1AÆ\bA\fAì1A±\vA\b\fAÐ&A¤\nA˜\'AAô\t\tAà\'AA°\n\tA¬(AA¿\n\tA´&Aø(A\0AA )A\0AÒAÈ)AA«Að)AAÚ\vA˜*AAù\vAÀ*AA¡\fAè*AA¾\fA+AA÷A¸+AA•A )A\0A¤\rAÈ)AAƒ\rAð)AAæ\rA˜*AAÄ\rAÀ*AAìAè*AAÊAà+A\bA©Aˆ,A\tA‡A°,AAä\fAØ,AA¼\vù@  \0Aj"I\r\0@ -\0\0"A(G@ Aà\0G\r \0A:\0\0 \0Aj"!\0@@ Aj! ,\0"1\r\0 \0 O\r \0 :\0\0 \0Aj!\0 !\f\v\v \0 O\r \0A\0:\0\0  Aj;\0 \v \0A:\0\0   F\v \0A:\0\0 \0Aj"!\0@ ,\0\0"1E@ \0 O\r \0 :\0\0 \0Aj!\0 Aj!\f\v\v \0 O\r\0 \0A\0:\0\0  Aj;\0 !\v \v1 \0Aˆ46\0 \0(A\fk" (\bAk"6\b A\0H@ \v \0\v\0 \0AÐ\0r7AÐ\0j\vmA\b^"AÜ56\0 Aˆ46\0 \0"A\rj"A\x006\b  6  6\0 A\fj! Aj"@  \0 ü\n\0\0\v  6 A¸46\0 AÄ4A“\v\0\vø\t@ "(\0"@ ("E\r@ "(\0"\r\0\v\v ("\r\0 (\b!A\0!A\f\v  (\b"6\bA\0\v!@ (\0" F@  6\0 \0 F@A\0! !\0\f\v (!\f\v  6\v -\0\f!  G@  (\b"6\b@ (\0 F@  6\0\f\v  6\v  (\0"6\0  6\b  ("6 @  6\b\v  -\0\f:\0\f  \0 \0 F!\0\v@ \0E\r\0 AqE\r\0 @@ -\0\f!@ (\b"(\0" G@ AqE@ A:\0\f A\0:\0\f  ("(\0"6 @  6\b\v  (\b"6\b@ (\0 F@  6\0\f\v  6\v  6\0  6\b  \0 \0 (\0"F!\0 (!\v@@ (\0"@ -\0\fAG\r\v@ ("E\r\0 -\0\fAF\r\0 !\f\v A\0:\0\f \0 (\b"G@ -\0\f\r\v A:\0\f\v@ ("E\r\0 -\0\fAF\r\0 !\f\v A:\0\f A\0:\0\f  ("\x006\0 \0@ \0 6\b\v  (\b"\x006\b@ \0(\0 F@ \0 6\0\f\v \0 6\v  6  6\b !\v  (\b"\0-\0\f:\0\f \0A:\0\f A:\0\f \0 \0("(\0"6 @  \x006\b\v  \0(\b"6\b@ (\0 \0F@  6\0\f\v  6\v  \x006\0 \0 6\b\v AqE@ A:\0\f A\0:\0\f  ("6\0 @  6\b\v  (\b"6\b@ (\0 F@  6\0\f\v  6\v  6  6\b  \0 \0 ("F!\0 (\0!\v@@ (\0"E\r\0 -\0\fAF\r\0 !\f\v@ ("@ -\0\fAG\r\v A\0:\0\f (\b"-\0\fAF \0 Gq\r A:\0\f\v@ E\r\0 -\0\fAF\r\0 !\f\v A:\0\f A\0:\0\f  (\0"\x006 \0@ \0 6\b\v  (\b"\x006\b@ \0(\0 F@ \0 6\0\f\v \0 6\v  6\0  6\b !\v  (\b"\0-\0\f:\0\f \0A:\0\f A:\0\f \0 \0(\0"("6\0 @  \x006\b\v  \0(\b"6\b@ (\0 \0F@  6\0\f\v  6\v  \x006 \0 6\b\v (\b"AA\0  (\0Fj(\0!\f\0\v\0\v A:\0\f\v\v \0!@@A\0! -\0\0"E\r\0@@ Aÿq"A?K\r\0B ­†BÌ€€ƒP\r\0 -\0! Aj! \r\f\v@ A-G\r\0 -\0A-G\r\0 !@ -\0\0 Aj"!A-F\r\0\vA! -\0\0"\r\f\v\v   \\"E@A\0\vA!@@@@ -\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v Aj!  Áj! E\r\v\v   At"AjÁ"jI@A\0\v  \0k"@ \0 j \0 ü\n\0\0\v \0 ;\0 Á"A\0J@A\0! Aÿÿq"@ \0AjA\0 ü\v\0\v@ \0 Á! AjÁ" H\r\0\v\v \vG#\0Ak"$\0 \0(\0!\0  6\f A <6\b  A\bj \0\0 (\f"A\tO@ \n\v Aj$\0\v\0AÔ\võ\f\r#\0A@j"$\0  6\f Aü#6\b  A\bj6  A4j"\b60 B\x0074  A(j"\v6$ B\x007( \0A\bj!\f@@@@@ \0(\b" \0A\fj"\tF\r\0 \0Aj" \0(F\r\0 \0Aj!\n@  \n(\0"G@@@ \0." .N@ . L\r\v \0( " ( (  \0.jI \0( "/\0"E\r\0 \0.\0 At"Aj"\r  Ak"Aþÿqj/jÁH\r\0@ AG@ \f < \tG\r A0j < \bG\r \r  Aÿÿqj/jÁ! \0( "/\0" At"  AkAþÿqj/jAjÁA\v"@   ü\n\0\0\v A0j A<j 5"(\0E@A" 6  (<6\b B\x007\0  6\0 (0(\0"@  60\v (4 4  (8Aj68\f\v \f\v \n < G\r A$j < \vG\r \r  Aÿÿqj/\0jÁ! \0( "/\0" At"  AkAþÿqj/jAjÁA\v"@   ü\n\0\0\v A$j A<j 5"(\0E@A" 6  (<6\b B\x007\0  6\0 ($(\0"@  6$\v (( 4  (,Aj6,\f\v \v  \0( 6< ("E\r  A<j (\0(\0\r\v@ ("@@ "(\0"\r\0\f\v\0\v@  (\b"(\0G !\r\0\v\v  "G\r\0\v\v@ ("@@ "(\0"\r\0\f\v\0\v@  (\b"(\0G !\r\0\v\v \t "G\r\0\v\v \0 \0/";\f\v \0/!\v \0 Aj; (,!\t (8!\n (0" \bF\r@ ("! !@ @@ "(\0"\r\0\v@ "(\0"\r\0\v\f\v@  (\b"(\0G !\r\0\v !@  (\b"(\0G !\r\0\v\v  (0F@  60\v  (8Ak68 (4 ` \f A<j (5"(\0E@A! (! A\x006  6  \0/;  (<6\b B\x007\0  6\0 \0(\b(\0"@ \f 6\0\v \0(\f 4 \0 \0(Aj6\v (! A\x006 @ \v  \b "G\r\0\v\f\vA^"\0Aˆ-6\0 \0A”-A’\v\0\v \v ($"G@ \0Aj!\b@ ("! !@ @@ "(\0"\r\0\v@ "(\0"\r\0\v\f\v@  (\b"(\0G !\r\0\v !@  (\b"(\0G !\r\0\v\v  ($F@  6$\v  (,Ak6, (( ` \b A<j (5"(\0E@A! (! A\x006  6  \0/;  (<6\b B\x007\0  6\0 \0((\0"@ \b 6\0\v \0( 4 \0 \0(Aj6\v (! A\x006 @ \v  \v "G\r\0\v\v ((; (4;@ ("\0 A\bjFA \0E\rA\v! \0 \0(\0 j(\0\0\v A@k$\0 \t \njÁ\v·#\0Ak"$\0 (\0"AøÿÿÿI@ \0(\0!@@ A\vO@ Ar"Aj!\0  Aÿÿÿÿk6\f  \x006  6\b\f\v  :\0 Aj!\0 E\r\v E\r\0 \0 Aj ü\n\0\0\v \0 jA\0:\0\0  Aj \0 ,\0A\0H@ (\v Aj$\0\v#\0\vä#\0Ak"$\0 ,\0\v! (\0!@ \0.\0""   A\0H  ja"E@ \f\v \0/" \0/F@ \0 Aj;\v@@ /\0AG@ \0A\bj A\bj 5"(\0\rA" 6  \0/;  (\b6\b B\x007\0  6\0 \0(\b(\0"@ \0 6\b\v \0(\f 4 \0 \0(Aj6\f\v \0Aj A\fj 5"(\0\rA" 6  \0/;  (\f6\b B\x007\0  6\0 \0((\0"@ \0 6\v \0( 4 \0 \0(Aj6\vA\0!\v E\r\0 \v Aj$\0 A\0G\v5  \0("Auj! \0(\0!\0  Aq (\0 \0j(\0 \0\v\0\v9\0 \0A\x006 \0(\f$ \0 \0A\fj6\b \0B\x007\f \0($ \0 \0Aj6 \0B\x007\v/ \0 ; ! \0( ! \0 6 @ \v \0A\0;\v7  \0("Auj! \0(\0!\0   Aq (\0 \0j(\0 \0\v\0\v\0 \0A\0; \0 ;\0\vªA$! .\0! \0/\0!\0 B\x007  A\fj"6\b B\x007\f A\x006  Aj"6 A\0;  \0;\0  ; ! ( !\0  6 \0@ \0\v A\x006 (\f$  6\b B\x007\f ($  6 B\x007 \v1#\0Ak"$\0  ;  ;\f Aj A\fj \0\0 Aj$\0\v2 \0@ \0( ! \0A\x006 @ \v \0($ \0(\f$ \0\v\v\0A¸"\vž#\0Ak"$\0 !@@ /\0AG\r\0 Aj HE\r\0  \0.\0"At"AjÁH\r\0  ;\0 A\0L\r Aÿÿq"@ AjA\0 ü\v\0\v Aj" AtAþÿqj \0Aj" \0/\0AtAþÿqj   j"6E\r\0 A\0!A!@  .\0"N\r  AtAkAþÿq"\bj.\0  AtAþÿqjj  \bj.\0  \0/\0AtAþÿqjj  6E\r  ! Aj!\f\0\v\0\v A\0!\v Aj$\0 \v?#\0Ak"$\0 !@  H@  \0   j6\r\v A\0!\v Aj$\0 \v! " \0   jI  A\0\v\vA " \0  (\0  ,\0\vA\0H (\0  ,\0\vA\0H  jJ@ \v A\0\vÆ#\0A k"$\0@ (\0"AøÿÿÿO\r\0@@ A\vO@ Ar"\tAj!\b  \tAÿÿÿÿk6  \b6  6\f\v  :\0 Aj!\b E\r\v E\r\0 \b Aj ü\n\0\0\v  \bjA\0:\0\0 (\0"AøÿÿÿO\r\0@@ A\vO@ Ar"Aj!\b  Aÿÿÿÿk6  \b6\b  6\f\f\v  :\0 A\bj!\b E\r\v E\r\0 \b Aj ü\n\0\0\v  \bjA\0:\0\0   Aj A\bj  \0\v\0 ,\0A\0H@ (\b\v ,\0A\0H@ (\v A j$\0\v#\0\vZ ,\0\v! (! (\0! " \0 AjA\0 /\0AF   A\0H"\0A\0   \0  j=@ \v A\0\vL ,\0\v! (! (\0! " \0    A\0H"\0A\0   \0  j(@ \v A\0\v7  \0("Auj! \0(\0!\0   Aq (\0 \0j(\0 \0\v\0\vZ@ A\0H\r\0 \0.\0"Ak L\r\0  N\r\0 \0Aj"\0 AtAþÿqj!  \0 AtAkAþÿqj.\0A\0\v j!\v \vL \0.\0"A\0L@A\0\v \0Aj" At"Aþÿqj!A\0!\0 AG  AkAþÿqj.\0A\0\v j\v\v\0 \0/\0AkÁ\v\0 \0AjA\0 \0-\0\0AF\v\0 \0AjA\0 \0-\0\0AF\v\0 \0AjA\0 \0-\0\0AF\v\0 \0-\0\0\v7  \0("Auj! \0(\0!\0   Aq (\0\0 \0j(\0 \0\v\0\vP@ A\0H\r\0  \0.\0"N\r\0 \0Aj"\0 AtAþÿqj!  \0 AtAkAþÿqj.\0A\0\v j!\v \v\0 \0.\0\vÕ\t !\b@@ /\0"E\r\0  \bj! Aj!\vA!\t \b!@ AkÁ \nJ@@@@@ Á \nÁLA\0 \v AtAþÿqj! \n \v \nAtAkAþÿqj.\0A\0\v j\v"-\0\0Ak\0\v  O\r Aà\0:\0\0 Aj! -\0"E\r Aj!@  O\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v ! -\0"E\r Aj!@  O\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v Aj  3!\v E\r  O\r A\n:\0\0  k" \t Á \tÁJ!\t \nAj!\n Aj! /\0!\f\v\v   \tÁ"jM\r\0 A\0J@ \tAÿÿq"@ A- ü\v\0\v  j!\v A\n:\0\0 \v /\0"AtAþÿqj!A\0! Aj!@@@@ AG \v AtAkAþÿqj.\0A\0\v j"-\0\0Ak\0\v  O\r Aà\0:\0 Aj! -\0"E\r Aj!@  O\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v -\0"E\r Aj!@  O\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v Aj  3!\v E\r\0  O\r\0 A\n:\0\0 Aj \bk G\r\v \b \0A\x006\b \0B\x007\0\v A\0:\0 \b"AøÿÿÿI@@@ A\vO@ Ar"Aj! \0 Aÿÿÿÿk6\b \0 6\0 \0 6 !\0\f\v \0 :\0\v E\r\v E\r\0 \0 \b ü\n\0\0\v \0 jA\0:\0\0 \b\v#\0\v- " \0(\0 \0 \0,\0\vA\0H  ja@ \v A\0\vWA!@@@ \0-\0\0Ak\0\v \0/"E@A\v At" \0 AkAþÿqj/jAj!\v Á\v \0/AjÁ\vçA!A!@@@@ \0-\0\0Ak\0\v \0/Aj!\f\v \0/Aj!\f\v \0/"E@A!\f\v At" \0 AkAþÿqj/jAj!\v Á!@@@@ \0-\0\0Ak\0\v \0/Aj!\f\v \0/Aj!\f\v \0/"E@A!\f\v At" \0 AkAþÿqj/jAj!\v Á"@  \0 ü\n\0\0\v \v· \0A\x006\b \0B\x007\0A!@@@@@@ -\0\0"Ak\0\v /Aj\f\v /Aj\f\v /"E@A!\f\v At"  AkAþÿqj/jAj\v"AÿÿqE@\f\v Á"A\0H\r\v ! @ A\0 ü\v\0\v \0  j"6\b \0 6 \0 6\0\vA!\0@@@@ Ak\0\v /Aj!\0\f\v /Aj!\0\f\v /"\0E@A!\0\f\v \0At"\0  \0AkAþÿqj/jAj!\0\v \0Á"\0@   \0ü\n\0\0\v\v2\0\vô " j!@@@@@@ -\0\0Ak\0\v A\0L\r Aà\0:\0\0 Aj! -\0"E\r Aj!@  O\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v ! -\0"E\r Aj!@  O\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v Aj  3!\v E\r\0  k G\r\v  \0A\x006\b \0B\x007\0\v A\0:\0\0 "AøÿÿÿI@@@ A\vO@ Ar"Aj! \0 Aÿÿÿÿk6\b \0 6\0 \0 6 !\0\f\v \0 :\0\v E\r\v E\r\0 \0  ü\n\0\0\v \0 jA\0:\0\0 \v#\0\v- " \0(\0 \0 \0,\0\vA\0H  j\\@ \v A\0\v¹  "  j3"A\0  k GE@  \0A\x006\b \0B\x007\0\v A\0:\0\0 "AøÿÿÿI@@@ A\vO@ Ar"Aj! \0 Aÿÿÿÿk6\b \0 6\0 \0 6 !\0\f\v \0 :\0\v E\r\v E\r\0 \0  ü\n\0\0\v \0 jA\0:\0\0 \v#\0\v- " \0(\0 \0 \0,\0\vA\0H  jF@ \v A\0\v‡ !@@ A\0L\r\0 Aà\0:\0\0 Aj! -\0"@  j! Aj!@  O\r  :\0\0 Aj! -\0! Aj! \r\0\v\v  k G\r\v  \0A\x006\b \0B\x007\0\v A\0:\0\0 "AøÿÿÿI@@@ A\vO@ Ar"Aj! \0 Aÿÿÿÿk6\b \0 6\0 \0 6 !\0\f\v \0 :\0\v E\r\v E\r\0 \0  ü\n\0\0\v \0 jA\0:\0\0 \v#\0\v€ ! \0(\0 \0 \0,\0\vA\0H!  j! Aj"!\0@@ ,\0"1E@ \0 O\r Aj! \0 :\0\0 \0Aj!\0\f\v\v \0 O\r\0 \0A\0:\0\0  Aj;\0 \v A\0\v\0Aä\v\0A„\v\0A¤\v\0A¸\v\0AØ\v\0Aø\v0#\0Ak"$\0 \0(\0!\0  :\0   Aj \0\0 Aj$\0\v\0 \0(\0 j -\0\0:\0\0A\v¦#\0Ak"$\0 Aj   \0(\0\0A!\0@ -\0AqE\r\0 -\0!@A€<-\0\0Aq@Aü;(\0!\0\f\vAAÄA\b!\0A€<A:\0\0Aü; \x006\0\v  6\b A\x006 \0A\0A\0 Aj A\bjü!\0 ("E\r\0 \v Aj$\0 \0\v3 ( (\0"k K@A!  j-\0\0!\v \0 :\0 \0 :\0\0\v\r\0 \0( \0(\0k\v0#\0Ak"$\0 \0(\0!\0  :\0   Aj \0\0 Aj$\0\và@@ \0(" \0(\0"k" I@  k" \0(\b" kM@ @  -\0\0 ü\v\0\v \0  j6\v A\0H\rAÿÿÿÿ  k"At"   I AÿÿÿÿO"! @  j -\0\0 ü\v\0\v @   ü\n\0\0\v \0  j6\b \0  j6 \0 6\0 E\r \v  O\r\0 \0  j6\v\v2\0\v\r\0 \0A€j\0\v\0X\0\ve \0D\0\0\0\0\0\0\0\0@Aà=(\0AAA \0AF \0AF"\0AkvAq@Aà>Aà>(\0A \0Aktr6\0\f\v \0At(ð5"@ \0 \0\v\v\v\0 \0(\v\0Aè\b\v\0 \0 (\b @    C\v\v \0 (\b @    C\v -\x005 \0(\f! A\0:\x005 -\x004 A\0:\x004 \0( \0(     A -\x004"\tr!\b -\x005"\nr!@ AI\r\0 \0Aj Atj!\v \0Aj!@ -\x006\r@ \tAq@ (AF\r \0-\0\bAq\r\f\v \nAqE\r\0 \0-\0\bAqE\r\v A\0;4 (\0 (     A -\x005"\n rAq! -\x004"\t \brAq!\b A\bj" \vI\r\0\v\v  Aq:\x005  \bAq:\x004\v§\0 \0 (\b @@  (G\r\0 (AF\r\0  6\v\v@ \0 (\0 E\r\0@ ( G@  (G\r\v AG\r A6 \v  6  6  ((Aj6(@ ($AG\r\0 (AG\r\0 A:\x006\v A6,\v\v.#\0Ak"$\0 \0(\0!\0  :\0  Aj \0\0 Aj$\0\væ \0 (\b @@  (G\r\0 (AF\r\0  6\v\v@ \0 (\0 @@ ( G@  (G\r\v AG\r A6 \v  6 @ (,AF\r\0 \0Aj" \0(\fAtj!A\0!@@@  O\r\0 A\0;4 (\0 (   A A -\x006\r\0@ -\x005AG\r\0 -\x004AF@ (AG@A!A! \0-\0\bAq\r\v A6,\vA! \0-\0\bAqE\r\v A\bj!\f\v\v AA 6, E\r\f\v A6, \r\v  6  ((Aj6( ($AG\r (AG\r A:\x006\v \0(\f! \0( \0(    8 AI\r\0 \0Aj Atj! \0Aj!@ \0(\b"\0AqE@ ($AG\r\v@ -\x006\r (\0 (    8 A\bj" I\r\0\v\f\v \0AqE@@ -\x006\r ($AF\r (\0 (    8 A\bj" I\r\0\f\v\0\v@ -\x006\r ($AF@ (AF\r\v (\0 (    8 A\bj" I\r\0\v\v\v¿#\0A@j"$\0@ AÈ0A\0@ A\x006\0A!\f\v@ \0  \0-\0\bAqA E\r Aœ. "E\r -\0\bAqA\0G\v!\v @A! (\0"\0E\r  \0(\x006\0\f\v E\r\0 AÌ. "E\r\0 (\0"@  (\0"6\0\v (\b" \0(\b"AsqAq\r\0 As qAà\0q\r\0A! \0(\f" (\f"\0A\0\r\0 A¼0A\0@ \0E\r \0Aü. E!\f\vA\0! E\r\0 AÌ. "@ AqE\r@@ \0E\r \0AÌ. "\0E\r \0(\b (\b"Asq\rA (\f" \0(\f"\0A\0\r AqE\r E\r AÌ. "\r\0\v A°/ "E\r\0  \0U!\v \v!\f\v A°/ "@ AqE\r  \0U!\f\v Aì- "E\r\0 \0E\r\0 \0Aì- "\0E\r\0 A\bjA\0A8ü\v\0  A\0G:\0; A6  6\f  \x006 A64 \0 Aj A \0(\0(\0 ("\0AF@  (A\0 6\0\v \0AF!\v A@k$\0 \vz \0 (\bA\0@   B\v \0(\f! \0( \0(   V@ AI\r\0 \0Aj Atj! \0Aj!\0@ \0(\0 \0(   V -\x006\r \0A\bj"\0 I\r\0\v\v\v\0 \0 (\bA\0@   B\v\v1\0 \0 (\bA\0@   B\v \0(\b"\0    \0(\0(\0\v‹\0 \0 (\b @@  (G\r\0 (AF\r\0  6\v\v@ \0 (\0 @@ ( G@  (G\r\v AG\r A6 \v  6 @ (,AF\r\0 A\0;4 \0(\b"\0   A  \0(\0(\b\0 -\x005AF@ A6, -\x004E\r\f\v A6,\v  6  ((Aj6( ($AG\r (AG\r A:\x006\v \0(\b"\0     \0(\0(\t\0\v\vÁ \0(" \0(\b"I@  -\0\0:\0\0 \0 Aj6\v  \0(\0"k"Aj"A\0N@ Aÿÿÿÿ  k"At"   I AÿÿÿÿO" A\0\v"j" -\0\0:\0\0 @   ü\n\0\0\v \0  j6\b \0 Aj"6 \0 6\0 @ \v \0 6\v2\0\v7\0 \0 (\b @    C\v \0(\b"\0      \0(\0(\b\0\v­#\0A@j"$\0@A \0 A\0\r\0A\0 E\r\0A\0 Aì- "E\r\0 (\0"E\r A\bjA\0A8ü\v\0 A:\0; A6  \x006\f  6 A64  Aj A (\0(\0 ("\0AF@  (6\0\v \0AF\v A@k$\0\vY\0\v\0Až\t\v§ \0("Aj"7"\0 A€O@ @ \0  ü\n\0\0\v \0\f\v \0 j!@ \0 sAqE@@ \0AqE@ \0!\f\v E@ \0!\f\v \0!@  -\0\0:\0\0 Aj! Aj"AqE\r  I\r\0\v\v A|q!@ AÀ\0I\r\0  A@j"K\r\0@  (\x006\0  (6  (\b6\b  (\f6\f  (6  (6  (6  (6  ( 6  ($6$  ((6(  (,6,  (060  (464  (868  (<6< A@k! A@k" M\r\0\v\v  O\r@  (\x006\0 Aj! Aj" I\r\0\v\f\v AI@ \0!\f\v AI@ \0!\f\v Ak! \0!@  -\0\0:\0\0  -\0:\0  -\0:\0  -\0:\0 Aj! Aj" M\r\0\v\v  I@@  -\0\0:\0\0 Aj! Aj" G\r\0\v\v \0\vA\0\v\vA\f"\0A\x006\b \0B\x007\0 \0\v\0Að%\v\0 \0AjA\0 (Aø%F\v‡|#\0Ak"$\0 \0((! (\0!@Aˆ<-\0\0Aq@A„<(\0!\0\f\vAAà%A\0\b!\0Aˆ<A:\0\0A„< \x006\0\v  6\b A\x006 \0 A\0 Aj A\bj ("\0@ \0\vA<-\0\0AqE@AAè%A\b!\0A<A:\0\0AŒ< \x006\0\vü"\0A\tO@ \0\v  \x006\b A\x006AŒ<(\0 \0A\0 Aj A\bj ("@ \v \0A\tO@ \0\n\v Aj$\0D\0\0\0\0\0\0\0\0b\v\0 \0\r\0\v\0  \0(6 Aü#6\0\vA\b" \0(6 Aü#6\0 \v" \0@ \0(\0"@ \0 6 \v \0\v\v€\0Að;A6\0Aô;A\x006\0KAô;A”<(\x006\0A”<Að;6\0A˜<A”6\0Aœ<A\x006\0[Aœ<A”<(\x006\0A”<A˜<6\0AÜ<A€À\x006\0AÔ<Að¾6\0A¸<A*6\0A€=AÄ=6\0AØ<A€€6\0\v\vÃ.\0A€\b\vto_binary\0from_binary\0list\0List\0unsigned short\0unsigned int\0reset\0get\0float\0vector\0Buffer\0unsigned char\0std::exception\0conclusion\0Term\0getitem\0Item\0bool\0Null\0std::bad_function_call\0push_back\0length\0match\0Search\0unsigned long long\0unsigned long\0std::wstring\0to_string\0from_string\0basic_string\0std::string\0std::u16string\0std::u32string\0String\0resize\0set_limit_size\0set_buffer_size\0data_size\0execute\0get_type\0TermType\0clone\0rename\0Rule\0double\0variable\0Variable\0ground\0void\0add\0emscripten::memory_view<short>\0emscripten::memory_view<unsigned short>\0emscripten::memory_view<int>\0emscripten::memory_view<unsigned int>\0emscripten::memory_view<float>\0emscripten::memory_view<uint8_t>\0emscripten::memory_view<int8_t>\0emscripten::memory_view<uint16_t>\0emscripten::memory_view<int16_t>\0emscripten::memory_view<uint64_t>\0emscripten::memory_view<int64_t>\0emscripten::memory_view<uint32_t>\0emscripten::memory_view<int32_t>\0emscripten::memory_view<char>\0emscripten::memory_view<unsigned char>\0emscripten::memory_view<signed char>\0emscripten::memory_view<long>\0emscripten::memory_view<unsigned long>\0emscripten::memory_view<double>\0`() \t\r\n\0€\0\0Œ\b\0\0\0\0\0\0\0\0\0¤\b\0\0\0\0\0\0ð\t\0\0\0\0\0\0 \n\0\0\0\0\0\0NSt3__28optionalIhEE\0\0\0\0¬\0\0°\b\0\0à\b\0\0NSt3__227__optional_move_assign_baseIhLb1EEE\0\0\0\0¬\0\0ì\b\0\0\t\0\0NSt3__227__optional_copy_assign_baseIhLb1EEE\0\0\0\0¬\0\0(\t\0\0P\t\0\0NSt3__220__optional_move_baseIhLb1EEE\0\0\0¬\0\0\\\t\0\0„\t\0\0NSt3__220__optional_copy_baseIhLb1EEE\0\0\0¬\0\0\t\0\0¼\t\0\0NSt3__223__optional_storage_baseIhLb0EEE\0\0\0\0t\0\0Ä\t\0\0NSt3__224__optional_destruct_baseIhLb1EEE\0\0\0t\0\0ø\t\0\0NSt3__218__sfinae_ctor_baseILb1ELb1EEE\0\0t\0\0(\n\0\0NSt3__220__sfinae_assign_baseILb1ELb1EEE\0\0\0\0t\0\0\\\n\0\0NSt3__26vectorIhNS_9allocatorIhEEEE\0Ü\0\0\n\0\0\0\0\0\0T\n\0\0PNSt3__26vectorIhNS_9allocatorIhEEEE\0\0\0\0Ü\0\0È\n\0\0\0\0\0T\n\0\0PKNSt3__26vectorIhNS_9allocatorIhEEEE\0pp\0v\0vp\0\0\0€\n\0\0pp\0\0<\0\0T\n\0\0l\0\0vppi\0A \vð\n<\0\0T\n\0\0¨\0\0l\0\0vppii\0\0\0¨\0\0T\n\0\0ipp\x004\0\0l\0\0d\b\0\0T\n\0\0¨\0\0pppi\0\0\0\0T\0\0T\n\0\0¨\0\0l\0\0ippii\0\0\0t\0\0€\v\0\0N2ds8string_tE\0\0Ü\0\0 \v\0\0\0\0\0\0x\v\0\0PN2ds8string_tE\0Ü\0\0À\v\0\0\0\0\0x\v\0\0PKN2ds8string_tE\0pp\0vp\0\0t\0\0à\v\0\0N2ds6item_tE\0\0\0\0Ü\0\0\0\f\0\0\0\0\0\0Ø\v\0\0PN2ds6item_tE\0\0\0Ü\0\0 \f\0\0\0\0\0Ø\v\0\0PKN2ds6item_tE\0pp\0vp\0\0\0\0t\0\0@\f\0\0N2ds10variable_tE\0\0\0Ü\0\0d\f\0\0\0\0\0\x008\f\0\0PN2ds10variable_tE\0\0Ü\0\0ˆ\f\0\0\0\0\x008\f\0\0PKN2ds10variable_tE\0pp\0vp\0\0\0t\0\0¬\f\0\0N2ds6list_tE\0\0\0\0Ü\0\0Ì\f\0\0\0\0\0\0¤\f\0\0PN2ds6list_tE\0\0\0Ü\0\0ì\f\0\0\0\0\0¤\f\0\0PKN2ds6list_tE\0pp\0vp\0\0\0\0t\0\0\f\r\0\0N2ds6term_tE\0\0\0\0Ü\0\0,\r\0\0\0\0\0\0\r\0\0PN2ds6term_tE\0\0\0Ü\0\0L\r\0\0\0\0\0\r\0\0PKN2ds6term_tE\0pp\0vp\0\0\0\0€\0\0|\r\0\0\0\0\0\0\0\0\0¤\f\0\0\0\0\0\0N2ds6rule_tE\0\0\0\0Ü\0\0œ\r\0\0\0\0\0\0d\r\0\0PN2ds6rule_tE\0\0\0Ü\0\0¼\r\0\0\0\0\0d\r\0\0PKN2ds6rule_tE\0pp\0vp\0\0\0\0x\v\0\0P\0\0œ\0\0pppi\0\0\0\0P\0\0\v\0\0œ\0\0pppi\0\0\0\0x\v\0\0T\n\0\0ppp\0T\n\0\0\v\0\0ppp\0x\v\0\0\v\0\0ppp\0œ\0\0\v\0\0ipp\0Ø\v\0\0P\0\0œ\0\0pppi\0\0\0\0P\0\0ð\v\0\0œ\0\0pppi\0\0\0\0Ø\v\0\0T\n\0\0ppp\0T\n\0\0ð\v\0\0ppp\0Ø\v\0\0ð\v\0\0ppp\0œ\0\0ð\v\0\0ipp\x008\f\0\0P\0\0œ\0\0pppi\0\0\0\0P\0\0T\f\0\0œ\0\0pppi\0\0\0\x008\f\0\0T\n\0\0ppp\0T\n\0\0T\f\0\0ppp\x008\f\0\0T\f\0\0ppp\0œ\0\0T\f\0\0ipp\0¤\f\0\0P\0\0œ\0\0pppi\0\0\0\0P\0\0¼\f\0\0œ\0\0pppi\0\0\0\0¤\f\0\0T\n\0\0ppp\0T\n\0\0¼\f\0\0ppp\0¤\f\0\0¼\f\0\0ppp\0œ\0\0¼\f\0\0ipp\0\r\0\0P\0\0œ\0\0pppi\0\0\0\0P\0\0\r\0\0œ\0\0pppi\0\0\0\0\r\0\0T\n\0\0ppp\0T\n\0\0\r\0\0ppp\0\r\0\0\r\0\0ppp\0œ\0\0\r\0\0ipp\0d\r\0\0P\0\0œ\0\0pppi\0\0\0\0P\0\0Œ\r\0\0œ\0\0pppi\0\0\0\0d\r\0\0T\n\0\0ppp\0T\n\0\0Œ\r\0\0ppp\0d\r\0\0Œ\r\0\0ppp\0œ\0\0Œ\r\0\0ipp\0\v\0\0ð\v\0\0ppp\0\v\0\0T\f\0\0ppp\0„\0\0¼\f\0\0ipp\0\r\0\0¼\f\0\0„\0\0pppi\0\0\0\0\0\0\0$\0\0N2ds11term_type_tE\0\0\0\0\r\0\0ipp\0T\f\0\0\r\0\0ppp\0ð\v\0\0\r\0\0ppp\0¼\f\0\0\r\0\0ppp\0„\0\0Œ\r\0\0ipp\0\r\0\0Œ\r\0\0ppp\0\r\0\0Œ\r\0\0„\0\0pppi\0A !\vu\r\0\0\r\0\0\r\0\0P\0\0œ\0\0pppppi\0\0\0\0\0\0d\r\0\0Œ\r\0\0Œ\r\0\0P\0\0œ\0\0pppppi\0\0\0\0\0\0\r\0\0\r\0\0\r\0\0P\0\0P\0\0œ\0\0ppppppi\0d\r\0\0Œ\r\0\0Œ\r\0\0œ\0\0ppppi\0A "\vÅ\r\0\0\r\0\0\r\0\0œ\0\0ppppi\0\0\0t\0\0@\0\0N2ds8search_tE\0\0Ü\0\0`\0\0\0\0\0\x008\0\0PN2ds8search_tE\0Ü\0\0€\0\0\0\0\x008\0\0PKN2ds8search_tE\0pp\0vp\0\0P\0\0„\0\0„\0\0ppii\0\0\0\0<\0\0P\0\0„\0\0vppi\0\0\0\0<\0\0P\0\0vpp\0T\0\0P\0\0P\0\0ippp\0\0\0\0„\0\0P\0\x004\0\0ippp\0\0\0\0\0\0\0\0 \0\0•\0\0\0–\0\0\0—\0\0\0˜\0\0\0™\0\0\0š\0\0\0›\0\0\0œ\0\0\0\0\0\0¬\0\0,\0\0¨\0\0NSt3__210__function6__funcIZ14search_executePN2ds8search_tERKN10emscripten3valEE3$_0NS_9allocatorIS9_EEFbPNS2_6rule_tEEEE\0\0\0t\0\0°\0\0NSt3__210__function6__baseIFbPN2ds6rule_tEEEE\0\0\x004\0\0Œ\r\0\0T\0\x004\0\0t\0\0ø\0\0Z14search_executePN2ds8search_tERKN10emscripten3valEE3$_0\0f\0t\0\0<\0\0N10emscripten3valE\0\0t\0\0X\0\0NSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE\0\0t\0\0 \0\0NSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEE\0\0t\0\0è\0\0NSt3__212basic_stringIDsNS_11char_traitsIDsEENS_9allocatorIDsEEEE\0\0\0t\0\x004\0\0NSt3__212basic_stringIDiNS_11char_traitsIDiEENS_9allocatorIDiEEEE\0\0\0t\0\0€\0\0N10emscripten11memory_viewIcEE\0\0t\0\0¨\0\0N10emscripten11memory_viewIaEE\0\0t\0\0Ð\0\0N10emscripten11memory_viewIhEE\0\0t\0\0ø\0\0N10emscripten11memory_viewIsEE\0\0t\0\0 \0\0N10emscripten11memory_viewItEE\0\0t\0\0H\0\0N10emscripten11memory_viewIiEE\0\0t\0\0p\0\0N10emscripten11memory_viewIjEE\0\0t\0\0˜\0\0N10emscripten11memory_viewIlEE\0\0t\0\0À\0\0N10emscripten11memory_viewImEE\0\0t\0\0è\0\0N10emscripten11memory_viewIxEE\0\0t\0\0\0\0N10emscripten11memory_viewIyEE\0\0t\0\x008\0\0N10emscripten11memory_viewIfEE\0\0t\0\0`\0\0N10emscripten11memory_viewIdEE\0\0\0\0\0\0”\0\0’\0\0\0ž\0\0\0Ÿ\0\0\0¬\0\0 \0\0Ì\0\0NSt3__217bad_function_callE\0¬\0\0È\0\0d\0\0N10__cxxabiv116__shim_type_infoE\0\0\0\0¬\0\0ø\0\0¼\0\0N10__cxxabiv117__class_type_infoE\0\0\0¬\0\0(\0\0¼\0\0N10__cxxabiv117__pbase_type_infoE\0\0\0¬\0\0X\0\0\0\0N10__cxxabiv119__pointer_type_infoE\0¬\0\0ˆ\0\0¼\0\0N10__cxxabiv120__function_type_infoE\0\0\0\0¬\0\0¼\0\0\0\0N10__cxxabiv129__pointer_to_member_type_infoE\0\0\0\0\0\0\0\b\0\0¡\0\0\0¢\0\0\0£\0\0\0¤\0\0\0¥\0\0\0¬\0\0\0\0¼\0\0N10__cxxabiv123__fundamental_type_infoE\0ô\0\0D\0\0v\0\0\0ô\0\0P\0\0Dn\0\0ô\0\0\\\0\0b\0\0\0ô\0\0h\0\0c\0\0\0ô\0\0t\0\0h\0\0\0ô\0\0€\0\0a\0\0\0ô\0\0Œ\0\0s\0\0\0ô\0\0˜\0\0t\0\0\0ô\0\0¤\0\0i\0\0\0ô\0\0°\0\0j\0\0\0ô\0\0¼\0\0l\0\0\0ô\0\0È\0\0m\0\0\0ô\0\0Ô\0\0x\0\0\0ô\0\0à\0\0y\0\0\0ô\0\x002\0\0ô\0\0ô\0\0d\0\0\0\0\0\0\0\0\0¡\0\0\0¦\0\0\0£\0\0\0¤\0\0\0§\0\0\0¬\0\0 \0\0¼\0\0N10__cxxabiv116__enum_type_infoE\0\0\0\0¬\0\0P\0\0ì\0\0N10__cxxabiv120__si_class_type_infoE\0\0\0\0\0\0\0\0 \0\0¡\0\0\0¨\0\0\0£\0\0\0¤\0\0\0©\0\0\0ª\0\0\0«\0\0\0¬\0\0\0¬\0\0¬\0\0ì\0\0N10__cxxabiv121__vmi_class_type_infoE\0\0\0\0\0\0\0L\0\0¡\0\0\0­\0\0\0£\0\0\0¤\0\0\0®\0\0\0St9exception\0\0\0\0\0\0\0\0\0\0“\0\0\0¯\0\0\0°\0\0\0¬\0\0 \0\0Ì\0\0St11logic_error\0\0\0\0\0D\0\0“\0\0\0±\0\0\0°\0\0\0¬\0\0P\0\0\0\0St12length_error\0\0\0\0t\0\0”\0\0\0\0\0\0ì\0\0¡\0\0\0²\0\0\0£\0\0\0¤\0\0\0©\0\0\0³\0\0\0´\0\0\0µ\0\0\0St9type_info\0\0\0\0\0\0\0\0D\0\0¡\0\0\0¶\0\0\0£\0\0\0¤\0\0\0©\0\0\0·\0\0\0¸\0\0\0¹\0\0\0t\0\0ð\0\0\0\0\0\0Ì\0\0º\0\0\0»\0\0\0¼\0Aô5\v9½\0\0\0½\0\0\0¾\0\0\0¾\0\0\0¾\0\0\0¾\0\0\0¾\0\0\0¾\0\0\0½\0\0\0½\0\0\0¾\0\0\0½\0\0\0½\0\0\0½\0\0\0½\0AÐ6\v¾\0\0\0¾\0\0\0½\0\0\0½\0\0\0\0\0\0\0½\0\0\0\0\0\0\0¾\0Aô7\vp\0 '),function(t){return e(t.instance)}(await async function(e,t,r){return async function(e,t){try{var r=await async function(e){return e}(e);return await WebAssembly.instantiate(r,t)}catch(e){E(`failed to asynchronously prepare wasm: ${e}`),R(e)}}(t,r)}(0,S,r)))}(),function(){function e(){t.calledRun=!0,_||(b=!0,ot.C(),c?.(t),t.onRuntimeInitialized?.(),function(){if(t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;)N(t.postRun.shift());w(k)}())}!function(){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)O(t.preRun.shift());w(I)}(),t.setStatus?(t.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>t.setStatus(""),1),e()},1)):e()}(),b?t:new Promise((e,t)=>{c=e,u=t})}();let r$1=1024;function t$1(e=0){const t=r$1;return 0!==e&&(r$1=e),t}let e$1=class e{type;value;capacity;constructor(t,r,n=0){if(this.type=t,r instanceof e){if(this.value=r.value,this.capacity=r.capacity,0!==n)throw new Error("Cannot set capacity when copying from another instance.")}else if(r instanceof this.type)this.value=r,this.capacity=n;else if("string"==typeof r){if(this.capacity=0!==n?n:t$1(),this.value=this.type.from_string(r,this.capacity),null===this.value)throw new Error("Initialization from a string failed.")}else{if(!(r instanceof A$1.Buffer))throw new Error("Unsupported type for initialization.");if(this.value=this.type.from_binary(r),this.capacity=this.size(),0!==n)throw new Error("Cannot set capacity when initializing from bytes.")}}toString(){const e=this.type.to_string(this.value,t$1());if(""===e)throw new Error("Conversion to string failed.");return e}data(){return this.type.to_binary(this.value)}size(){return this.value.data_size()}copy(){return new this.constructor(this.value.clone(),this.size())}key(){return this.toString()}},v$1=class extends e$1{constructor(e,t=0){super(A$1.String,e,t)}},n$1=class extends e$1{constructor(e,t=0){super(A$1.Variable,e,t)}name(){return new v$1(this.value.name())}},i$1=class extends e$1{constructor(e,t=0){super(A$1.Item,e,t)}name(){return new v$1(this.value.name())}},s$1=class extends e$1{constructor(e,t=0){super(A$1.List,e,t)}length(){return this.value.length()}getitem(e){return new a$1(this.value.getitem(e))}},a$1=class e extends e$1{constructor(e,t=0){super(A$1.Term,e,t)}term(){const e=this.value.get_type();if(e===A$1.TermType.Variable)return new n$1(this.value.variable());if(e===A$1.TermType.Item)return new i$1(this.value.item());if(e===A$1.TermType.List)return new s$1(this.value.list());throw new Error("Unexpected term type.")}ground(t,r=""){const n=t$1(),i=A$1.Term.ground(this.value,t.value,r,n);return null===i?null:new e(i,n)}match(t){const r=t$1(),n=A$1.Term.match(this.value,t.value,"1","2",r);return null===n?null:new e(n,r)}rename(t){const r=t$1(),n=A$1.Term.rename(this.value,t.value,r);return null===n?null:new e(n,r)}},j$1=class e extends e$1{constructor(e,t=0){super(A$1.Rule,e,t)}length(){return this.value.length()}getitem(e){return new a$1(this.value.getitem(e))}conclusion(){return new a$1(this.value.conclusion())}ground(t,r=""){const n=t$1(),i=A$1.Rule.ground(this.value,t.value,r,n);return null===i?null:new e(i,n)}match(t){const r=t$1(),n=A$1.Rule.match(this.value,t.value,r);return null===n?null:new e(n,r)}rename(t){const r=t$1(),n=A$1.Rule.rename(this.value,t.value,r);return null===n?null:new e(n,r)}},o$1=class{_search;constructor(e=1e3,t=1e4){this._search=new A$1.Search(e,t)}set_limit_size(e){this._search.set_limit_size(e)}set_buffer_size(e){this._search.set_buffer_size(e)}reset(){this._search.reset()}add(e){return this._search.add(e)}execute(e){return this._search.execute(t=>e(new j$1(t).copy()))}};var t={763:()=>{}},e={};function s(r){var n=e[r];if(void 0!==n)return n.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,s),i.exports}s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n={};s.d(n,{MG:()=>j,fr:()=>kt,sR:()=>Ae,Zo:()=>ye,iH:()=>we,rt:()=>Pt,jB:()=>be,M8:()=>le,$t:()=>Ce,aq:()=>me,pG:()=>vt,eP:()=>_e,KU:()=>xe,zW:()=>Le,IX:()=>E,mY:()=>S,a7:()=>$,JG:()=>Ut,ay:()=>Xt,X2:()=>ee,WU:()=>de,Uw:()=>pe,gw:()=>ge,iX:()=>De,re:()=>ne,Pg:()=>He,tD:()=>ie,R$:()=>te,Dj:()=>Dt,m7:()=>U,NZ:()=>P,xo:()=>b,ou:()=>i,qC:()=>Be,mD:()=>d,Ay:()=>Ke});class i{constructor(){this.source=null,this.type=null,this.channel=null,this.start=null,this.stop=null,this.tokenIndex=null,this.line=null,this.column=null,this._text=null}getTokenSource(){return this.source[0]}getInputStream(){return this.source[1]}get text(){return this._text}set text(e){this._text=e}}function r(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!(e[r]===t[r]||e[r].equals&&e[r].equals(t[r])))return!1;return!0}i.INVALID_TYPE=0,i.EPSILON=-2,i.MIN_USER_TOKEN_TYPE=1,i.EOF=-1,i.DEFAULT_CHANNEL=0,i.HIDDEN_CHANNEL=1;const o=Math.round(Math.random()*Math.pow(2,32));function a(e){if(!e)return 0;const t=typeof e,r="string"===t?e:!("object"!==t||!e.toString)&&e.toString();if(!r)return 0;let n,i;const s=3&r.length,a=r.length-s;let l=o;const c=3432918353,u=461845907;let h=0;for(;h<a;)i=255&r.charCodeAt(h)|(255&r.charCodeAt(++h))<<8|(255&r.charCodeAt(++h))<<16|(255&r.charCodeAt(++h))<<24,++h,i=(65535&i)*c+(((i>>>16)*c&65535)<<16)&4294967295,i=i<<15|i>>>17,i=(65535&i)*u+(((i>>>16)*u&65535)<<16)&4294967295,l^=i,l=l<<13|l>>>19,n=5*(65535&l)+((5*(l>>>16)&65535)<<16)&4294967295,l=27492+(65535&n)+((58964+(n>>>16)&65535)<<16);switch(i=0,s){case 3:i^=(255&r.charCodeAt(h+2))<<16;case 2:i^=(255&r.charCodeAt(h+1))<<8;case 1:i^=255&r.charCodeAt(h),i=(65535&i)*c+(((i>>>16)*c&65535)<<16)&4294967295,i=i<<15|i>>>17,i=(65535&i)*u+(((i>>>16)*u&65535)<<16)&4294967295,l^=i}return l^=r.length,l^=l>>>16,l=2246822507*(65535&l)+((2246822507*(l>>>16)&65535)<<16)&4294967295,l^=l>>>13,l=3266489909*(65535&l)+((3266489909*(l>>>16)&65535)<<16)&4294967295,l^=l>>>16,l>>>0}class l{constructor(){this.count=0,this.hash=0}update(){for(let e=0;e<arguments.length;e++){const t=arguments[e];if(null!=t)if(Array.isArray(t))this.update.apply(this,t);else{let e=0;switch(typeof t){case"undefined":case"function":continue;case"number":case"boolean":e=t;break;case"string":e=a(t);break;default:t.updateHashCode?t.updateHashCode(this):console.log("No updateHashCode for "+t.toString());continue}e*=3432918353,e=e<<15|e>>>17,e*=461845907,this.count=this.count+1;let r=this.hash^e;r=r<<13|r>>>19,r=5*r+3864292196,this.hash=r}}}finish(){let e=this.hash^4*this.count;return e^=e>>>16,e*=2246822507,e^=e>>>13,e*=3266489909,e^=e>>>16,e}static hashStuff(){const e=new l;return e.update.apply(e,arguments),e.finish()}}function h(e){return e?"string"==typeof e?a(e):e.hashCode():-1}function c(e,t){return e&&e.equals?e.equals(t):e===t}function u(e){return null===e?"null":e}function d(e){return Array.isArray(e)?"["+e.map(u).join(", ")+"]":"null"}class p{constructor(e,t){this.buckets=new Array(16),this.threshold=Math.floor(12),this.itemCount=0,this.hashFunction=e||h,this.equalsFunction=t||c}get(e){if(null==e)return e;const t=this._getBucket(e);if(!t)return null;for(const r of t)if(this.equalsFunction(r,e))return r;return null}add(e){return this.getOrAdd(e)===e}getOrAdd(e){this._expand();const t=this._getSlot(e);let r=this.buckets[t];if(!r)return r=[e],this.buckets[t]=r,this.itemCount++,e;for(const t of r)if(this.equalsFunction(t,e))return t;return r.push(e),this.itemCount++,e}has(e){return null!=this.get(e)}values(){return this.buckets.filter(e=>null!=e).flat(1)}toString(){return d(this.values())}get length(){return this.itemCount}_getSlot(e){return this.hashFunction(e)&this.buckets.length-1}_getBucket(e){return this.buckets[this._getSlot(e)]}_expand(){if(this.itemCount<=this.threshold)return;const e=this.buckets,t=2*this.buckets.length;this.buckets=new Array(t),this.threshold=Math.floor(.75*t);for(const t of e)if(t)for(const e of t){const t=this._getSlot(e);let r=this.buckets[t];r||(r=[],this.buckets[t]=r),r.push(e)}}}class g{hashCode(){const e=new l;return this.updateHashCode(e),e.finish()}evaluate(e,t){}evalPrecedence(e,t){return this}static andContext(e,t){if(null===e||e===g.NONE)return t;if(null===t||t===g.NONE)return e;const r=new f(e,t);return 1===r.opnds.length?r.opnds[0]:r}static orContext(e,t){if(null===e)return t;if(null===t)return e;if(e===g.NONE||t===g.NONE)return g.NONE;const r=new x(e,t);return 1===r.opnds.length?r.opnds[0]:r}}class f extends g{constructor(e,t){super();const r=new p;e instanceof f?e.opnds.map(function(e){r.add(e)}):r.add(e),t instanceof f?t.opnds.map(function(e){r.add(e)}):r.add(t);const n=_(r);if(n.length>0){let e=null;n.map(function(t){(null===e||t.precedence<e.precedence)&&(e=t)}),r.add(e)}this.opnds=Array.from(r.values())}equals(e){return this===e||e instanceof f&&r(this.opnds,e.opnds)}updateHashCode(e){e.update(this.opnds,"AND")}evaluate(e,t){for(let r=0;r<this.opnds.length;r++)if(!this.opnds[r].evaluate(e,t))return!1;return!0}evalPrecedence(e,t){let r=!1;const n=[];for(let i=0;i<this.opnds.length;i++){const s=this.opnds[i],a=s.evalPrecedence(e,t);if(r|=a!==s,null===a)return null;a!==g.NONE&&n.push(a)}if(!r)return this;if(0===n.length)return g.NONE;let i=null;return n.map(function(e){i=null===i?e:g.andContext(i,e)}),i}toString(){const e=this.opnds.map(e=>e.toString());return(e.length>3?e.slice(3):e).join("&&")}}class x extends g{constructor(e,t){super();const r=new p;e instanceof x?e.opnds.map(function(e){r.add(e)}):r.add(e),t instanceof x?t.opnds.map(function(e){r.add(e)}):r.add(t);const n=_(r);if(n.length>0){const e=n.sort(function(e,t){return e.compareTo(t)}),t=e[e.length-1];r.add(t)}this.opnds=Array.from(r.values())}equals(e){return this===e||e instanceof x&&r(this.opnds,e.opnds)}updateHashCode(e){e.update(this.opnds,"OR")}evaluate(e,t){for(let r=0;r<this.opnds.length;r++)if(this.opnds[r].evaluate(e,t))return!0;return!1}evalPrecedence(e,t){let r=!1;for(let n=0;n<this.opnds.length;n++){const i=this.opnds[n],s=i.evalPrecedence(e,t);if(r|=s!==i,s===g.NONE)return g.NONE}return r?null:this}toString(){const e=this.opnds.map(e=>e.toString());return(e.length>3?e.slice(3):e).join("||")}}function _(e){const t=[];return e.values().map(function(e){e instanceof g.PrecedencePredicate&&t.push(e)}),t}function T(e,t){if(null===e){const e={state:null,alt:null,context:null,semanticContext:null};return t&&(e.reachesIntoOuterContext=0),e}{const r={};return r.state=e.state||null,r.alt=void 0===e.alt?null:e.alt,r.context=e.context||null,r.semanticContext=e.semanticContext||null,t&&(r.reachesIntoOuterContext=e.reachesIntoOuterContext||0,r.precedenceFilterSuppressed=e.precedenceFilterSuppressed||!1),r}}class m{constructor(e,t){this.checkContext(e,t),e=T(e),t=T(t,!0),this.state=null!==e.state?e.state:t.state,this.alt=null!==e.alt?e.alt:t.alt,this.context=null!==e.context?e.context:t.context,this.semanticContext=null!==e.semanticContext?e.semanticContext:null!==t.semanticContext?t.semanticContext:g.NONE,this.reachesIntoOuterContext=t.reachesIntoOuterContext,this.precedenceFilterSuppressed=t.precedenceFilterSuppressed}checkContext(e,t){null!==e.context&&void 0!==e.context||null!==t&&null!==t.context&&void 0!==t.context||(this.context=null)}hashCode(){const e=new l;return this.updateHashCode(e),e.finish()}updateHashCode(e){e.update(this.state.stateNumber,this.alt,this.context,this.semanticContext)}equals(e){return this===e||e instanceof m&&this.state.stateNumber===e.state.stateNumber&&this.alt===e.alt&&(null===this.context?null===e.context:this.context.equals(e.context))&&this.semanticContext.equals(e.semanticContext)&&this.precedenceFilterSuppressed===e.precedenceFilterSuppressed}hashCodeForConfigSet(){const e=new l;return e.update(this.state.stateNumber,this.alt,this.semanticContext),e.finish()}equalsForConfigSet(e){return this===e||e instanceof m&&this.state.stateNumber===e.state.stateNumber&&this.alt===e.alt&&this.semanticContext.equals(e.semanticContext)}toString(){return"("+this.state+","+this.alt+(null!==this.context?",["+this.context.toString()+"]":"")+(this.semanticContext!==g.NONE?","+this.semanticContext.toString():"")+(this.reachesIntoOuterContext>0?",up="+this.reachesIntoOuterContext:"")+")"}}class E{constructor(e,t){this.start=e,this.stop=t}clone(){return new E(this.start,this.stop)}contains(e){return e>=this.start&&e<this.stop}toString(){return this.start===this.stop-1?this.start.toString():this.start.toString()+".."+(this.stop-1).toString()}get length(){return this.stop-this.start}}E.INVALID_INTERVAL=new E(-1,-2);class S{constructor(){this.intervals=null,this.readOnly=!1}first(e){return null===this.intervals||0===this.intervals.length?i.INVALID_TYPE:this.intervals[0].start}addOne(e){this.addInterval(new E(e,e+1))}addRange(e,t){this.addInterval(new E(e,t+1))}addInterval(e){if(null===this.intervals)this.intervals=[],this.intervals.push(e.clone());else{for(let t=0;t<this.intervals.length;t++){const r=this.intervals[t];if(e.stop<r.start)return void this.intervals.splice(t,0,e);if(e.stop===r.start)return void(this.intervals[t]=new E(e.start,r.stop));if(e.start<=r.stop)return this.intervals[t]=new E(Math.min(r.start,e.start),Math.max(r.stop,e.stop)),void this.reduce(t)}this.intervals.push(e.clone())}}addSet(e){return null!==e.intervals&&e.intervals.forEach(e=>this.addInterval(e),this),this}reduce(e){if(e<this.intervals.length-1){const t=this.intervals[e],r=this.intervals[e+1];t.stop>=r.stop?(this.intervals.splice(e+1,1),this.reduce(e)):t.stop>=r.start&&(this.intervals[e]=new E(t.start,r.stop),this.intervals.splice(e+1,1))}}complement(e,t){const r=new S;return r.addInterval(new E(e,t+1)),null!==this.intervals&&this.intervals.forEach(e=>r.removeRange(e)),r}contains(e){if(null===this.intervals)return!1;for(let t=0;t<this.intervals.length;t++)if(this.intervals[t].contains(e))return!0;return!1}removeRange(e){if(e.start===e.stop-1)this.removeOne(e.start);else if(null!==this.intervals){let t=0;for(let r=0;r<this.intervals.length;r++){const r=this.intervals[t];if(e.stop<=r.start)return;if(e.start>r.start&&e.stop<r.stop){this.intervals[t]=new E(r.start,e.start);const n=new E(e.stop,r.stop);return void this.intervals.splice(t,0,n)}e.start<=r.start&&e.stop>=r.stop?(this.intervals.splice(t,1),t-=1):e.start<r.stop?this.intervals[t]=new E(r.start,e.start):e.stop<r.stop&&(this.intervals[t]=new E(e.stop,r.stop)),t+=1}}}removeOne(e){if(null!==this.intervals)for(let t=0;t<this.intervals.length;t++){const r=this.intervals[t];if(e<r.start)return;if(e===r.start&&e===r.stop-1)return void this.intervals.splice(t,1);if(e===r.start)return void(this.intervals[t]=new E(r.start+1,r.stop));if(e===r.stop-1)return void(this.intervals[t]=new E(r.start,r.stop-1));if(e<r.stop-1){const n=new E(r.start,e);return r.start=e+1,void this.intervals.splice(t,0,n)}}}toString(e,t,r){return e=e||null,t=t||null,r=r||!1,null===this.intervals?"{}":null!==e||null!==t?this.toTokenString(e,t):r?this.toCharString():this.toIndexString()}toCharString(){const e=[];for(let t=0;t<this.intervals.length;t++){const r=this.intervals[t];r.stop===r.start+1?r.start===i.EOF?e.push("<EOF>"):e.push("'"+String.fromCharCode(r.start)+"'"):e.push("'"+String.fromCharCode(r.start)+"'..'"+String.fromCharCode(r.stop-1)+"'")}return e.length>1?"{"+e.join(", ")+"}":e[0]}toIndexString(){const e=[];for(let t=0;t<this.intervals.length;t++){const r=this.intervals[t];r.stop===r.start+1?r.start===i.EOF?e.push("<EOF>"):e.push(r.start.toString()):e.push(r.start.toString()+".."+(r.stop-1).toString())}return e.length>1?"{"+e.join(", ")+"}":e[0]}toTokenString(e,t){const r=[];for(let n=0;n<this.intervals.length;n++){const i=this.intervals[n];for(let n=i.start;n<i.stop;n++)r.push(this.elementName(e,t,n))}return r.length>1?"{"+r.join(", ")+"}":r[0]}elementName(e,t,r){return r===i.EOF?"<EOF>":r===i.EPSILON?"<EPSILON>":e[r]||t[r]}get length(){return this.intervals.map(e=>e.length).reduce((e,t)=>e+t)}}class C{constructor(){this.atn=null,this.stateNumber=C.INVALID_STATE_NUMBER,this.stateType=null,this.ruleIndex=0,this.epsilonOnlyTransitions=!1,this.transitions=[],this.nextTokenWithinRule=null}toString(){return this.stateNumber}equals(e){return e instanceof C&&this.stateNumber===e.stateNumber}isNonGreedyExitState(){return!1}addTransition(e,t){void 0===t&&(t=-1),0===this.transitions.length?this.epsilonOnlyTransitions=e.isEpsilon:this.epsilonOnlyTransitions!==e.isEpsilon&&(this.epsilonOnlyTransitions=!1),-1===t?this.transitions.push(e):this.transitions.splice(t,1,e)}}C.INVALID_TYPE=0,C.BASIC=1,C.RULE_START=2,C.BLOCK_START=3,C.PLUS_BLOCK_START=4,C.STAR_BLOCK_START=5,C.TOKEN_START=6,C.RULE_STOP=7,C.BLOCK_END=8,C.STAR_LOOP_BACK=9,C.STAR_LOOP_ENTRY=10,C.PLUS_LOOP_BACK=11,C.LOOP_END=12,C.serializationNames=["INVALID","BASIC","RULE_START","BLOCK_START","PLUS_BLOCK_START","STAR_BLOCK_START","TOKEN_START","RULE_STOP","BLOCK_END","STAR_LOOP_BACK","STAR_LOOP_ENTRY","PLUS_LOOP_BACK","LOOP_END"],C.INVALID_STATE_NUMBER=-1;class A extends C{constructor(){return super(),this.stateType=C.RULE_STOP,this}}class N{constructor(e){if(null==e)throw"target cannot be null.";this.target=e,this.isEpsilon=!1,this.label=null}}N.EPSILON=1,N.RANGE=2,N.RULE=3,N.PREDICATE=4,N.ATOM=5,N.ACTION=6,N.SET=7,N.NOT_SET=8,N.WILDCARD=9,N.PRECEDENCE=10,N.serializationNames=["INVALID","EPSILON","RANGE","RULE","PREDICATE","ATOM","ACTION","SET","NOT_SET","WILDCARD","PRECEDENCE"],N.serializationTypes={EpsilonTransition:N.EPSILON,RangeTransition:N.RANGE,RuleTransition:N.RULE,PredicateTransition:N.PREDICATE,AtomTransition:N.ATOM,ActionTransition:N.ACTION,SetTransition:N.SET,NotSetTransition:N.NOT_SET,WildcardTransition:N.WILDCARD,PrecedencePredicateTransition:N.PRECEDENCE};class y extends N{constructor(e,t,r,n){super(e),this.ruleIndex=t,this.precedence=r,this.followState=n,this.serializationType=N.RULE,this.isEpsilon=!0}matches(e,t,r){return!1}}class L extends N{constructor(e,t){super(e),this.serializationType=N.SET,null!=t?this.label=t:(this.label=new S,this.label.addOne(i.INVALID_TYPE))}matches(e,t,r){return this.label.contains(e)}toString(){return this.label.toString()}}class I extends L{constructor(e,t){super(e,t),this.serializationType=N.NOT_SET}matches(e,t,r){return e>=t&&e<=r&&!super.matches(e,t,r)}toString(){return"~"+super.toString()}}class k extends N{constructor(e){super(e),this.serializationType=N.WILDCARD}matches(e,t,r){return e>=t&&e<=r}toString(){return"."}}class v extends N{constructor(e){super(e)}}class w{}class R extends w{}class O extends R{}class P extends O{get ruleContext(){throw new Error("missing interface implementation")}}class b extends O{}class F extends b{}const D={toStringTree:function(e,t,r){t=t||null,null!==(r=r||null)&&(t=r.ruleNames);let n=D.getNodeText(e,t);n=function(e){return e.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r")}(n);const i=e.getChildCount();if(0===i)return n;let s="("+n+" ";i>0&&(n=D.toStringTree(e.getChild(0),t),s=s.concat(n));for(let r=1;r<i;r++)n=D.toStringTree(e.getChild(r),t),s=s.concat(" "+n);return s=s.concat(")"),s},getNodeText:function(e,t,r){if(t=t||null,null!==(r=r||null)&&(t=r.ruleNames),null!==t){if(e instanceof P){const r=e.ruleContext.getAltNumber();return 0!=r?t[e.ruleIndex]+":"+r:t[e.ruleIndex]}if(e instanceof F)return e.toString();if(e instanceof b&&null!==e.symbol)return e.symbol.text}const n=e.getPayload();return n instanceof i?n.text:e.getPayload().toString()},getChildren:function(e){const t=[];for(let r=0;r<e.getChildCount();r++)t.push(e.getChild(r));return t},getAncestors:function(e){let t=[];for(e=e.getParent();null!==e;)t=[e].concat(t),e=e.getParent();return t},findAllTokenNodes:function(e,t){return D.findAllNodes(e,t,!0)},findAllRuleNodes:function(e,t){return D.findAllNodes(e,t,!1)},findAllNodes:function(e,t,r){const n=[];return D._findAllNodes(e,t,r,n),n},_findAllNodes:function(e,t,r,n){r&&e instanceof b?e.symbol.type===t&&n.push(e):!r&&e instanceof P&&e.ruleIndex===t&&n.push(e);for(let i=0;i<e.getChildCount();i++)D._findAllNodes(e.getChild(i),t,r,n)},descendants:function(e){let t=[e];for(let r=0;r<e.getChildCount();r++)t=t.concat(D.descendants(e.getChild(r)));return t}},M=D;class U extends P{constructor(e,t){super(),this.parentCtx=e||null,this.invokingState=t||-1}depth(){let e=0,t=this;for(;null!==t;)t=t.parentCtx,e+=1;return e}isEmpty(){return-1===this.invokingState}getSourceInterval(){return E.INVALID_INTERVAL}get ruleContext(){return this}getPayload(){return this}getText(){return 0===this.getChildCount()?"":this.children.map(function(e){return e.getText()}).join("")}getAltNumber(){return 0}setAltNumber(e){}getChild(e){return null}getChildCount(){return 0}accept(e){return e.visitChildren(this)}toStringTree(e,t){return M.toStringTree(this,e,t)}toString(e,t){e=e||null,t=t||null;let r=this,n="[";for(;null!==r&&r!==t;){if(null===e)r.isEmpty()||(n+=r.invokingState);else{const t=r.ruleIndex;n+=t>=0&&t<e.length?e[t]:""+t}null===r.parentCtx||null===e&&r.parentCtx.isEmpty()||(n+=" "),r=r.parentCtx}return n+="]",n}}class H{constructor(e){this.cachedHashCode=e}isEmpty(){return this===H.EMPTY}hasEmptyPath(){return this.getReturnState(this.length-1)===H.EMPTY_RETURN_STATE}hashCode(){return this.cachedHashCode}updateHashCode(e){e.update(this.cachedHashCode)}}H.EMPTY=null,H.EMPTY_RETURN_STATE=2147483647,H.globalNodeCount=1,H.id=H.globalNodeCount,H.trace_atn_sim=!1;class B extends H{constructor(e,t){const r=new l;return r.update(e,t),super(r.finish()),this.parents=e,this.returnStates=t,this}isEmpty(){return this.returnStates[0]===H.EMPTY_RETURN_STATE}getParent(e){return this.parents[e]}getReturnState(e){return this.returnStates[e]}equals(e){return this===e||e instanceof B&&this.hashCode()===e.hashCode()&&r(this.returnStates,e.returnStates)&&r(this.parents,e.parents)}toString(){if(this.isEmpty())return"[]";{let e="[";for(let t=0;t<this.returnStates.length;t++)t>0&&(e+=", "),this.returnStates[t]!==H.EMPTY_RETURN_STATE?(e+=this.returnStates[t],null!==this.parents[t]?e=e+" "+this.parents[t]:e+="null"):e+="$";return e+"]"}}get length(){return this.returnStates.length}}class V extends H{constructor(e,t){let r=0;const n=new l;null!==e?n.update(e,t):n.update(1),r=n.finish(),super(r),this.parentCtx=e,this.returnState=t}getParent(e){return this.parentCtx}getReturnState(e){return this.returnState}equals(e){return this===e||e instanceof V&&this.hashCode()===e.hashCode()&&this.returnState===e.returnState&&(null==this.parentCtx?null==e.parentCtx:this.parentCtx.equals(e.parentCtx))}toString(){const e=null===this.parentCtx?"":this.parentCtx.toString();return 0===e.length?this.returnState===H.EMPTY_RETURN_STATE?"$":""+this.returnState:this.returnState+" "+e}get length(){return 1}static create(e,t){return t===H.EMPTY_RETURN_STATE&&null===e?H.EMPTY:new V(e,t)}}class z extends V{constructor(){super(null,H.EMPTY_RETURN_STATE)}isEmpty(){return!0}getParent(e){return null}getReturnState(e){return this.returnState}equals(e){return this===e}toString(){return"$"}}H.EMPTY=new z;class Y{constructor(e,t){this.buckets=new Array(16),this.threshold=Math.floor(12),this.itemCount=0,this.hashFunction=e||h,this.equalsFunction=t||c}set(e,t){this._expand();const r=this._getSlot(e);let n=this.buckets[r];if(!n)return n=[[e,t]],this.buckets[r]=n,this.itemCount++,t;const i=n.find(t=>this.equalsFunction(t[0],e),this);if(i){const e=i[1];return i[1]=t,e}return n.push([e,t]),this.itemCount++,t}containsKey(e){const t=this._getBucket(e);return!!t&&!!t.find(t=>this.equalsFunction(t[0],e),this)}get(e){const t=this._getBucket(e);if(!t)return null;const r=t.find(t=>this.equalsFunction(t[0],e),this);return r?r[1]:null}entries(){return this.buckets.filter(e=>null!=e).flat(1)}getKeys(){return this.entries().map(e=>e[0])}getValues(){return this.entries().map(e=>e[1])}toString(){return"["+this.entries().map(e=>"{"+e[0]+":"+e[1]+"}").join(", ")+"]"}get length(){return this.itemCount}_getSlot(e){return this.hashFunction(e)&this.buckets.length-1}_getBucket(e){return this.buckets[this._getSlot(e)]}_expand(){if(this.itemCount<=this.threshold)return;const e=this.buckets,t=2*this.buckets.length;this.buckets=new Array(t),this.threshold=Math.floor(.75*t);for(const t of e)if(t)for(const e of t){const t=this._getSlot(e[0]);let r=this.buckets[t];r||(r=[],this.buckets[t]=r),r.push(e)}}}function q(e,t){if(null==t&&(t=U.EMPTY),null===t.parentCtx||t===U.EMPTY)return H.EMPTY;const r=q(e,t.parentCtx),n=e.states[t.invokingState].transitions[0];return V.create(r,n.followState.stateNumber)}function K(e,t,r){if(e.isEmpty())return e;let n=r.get(e)||null;if(null!==n)return n;if(n=t.get(e),null!==n)return r.set(e,n),n;let i=!1,s=[];for(let n=0;n<s.length;n++){const a=K(e.getParent(n),t,r);if(i||a!==e.getParent(n)){if(!i){s=[];for(let t=0;t<e.length;t++)s[t]=e.getParent(t);i=!0}s[n]=a}}if(!i)return t.add(e),r.set(e,e),e;let a=null;return a=0===s.length?H.EMPTY:1===s.length?V.create(s[0],e.getReturnState(0)):new B(s,e.returnStates),t.add(a),r.set(a,a),r.set(e,a),a}function W(e,t,r,n){if(e===t)return e;if(e instanceof V&&t instanceof V)return function(e,t,r,n){if(null!==n){let r=n.get(e,t);if(null!==r)return r;if(r=n.get(t,e),null!==r)return r}const i=function(e,t,r){if(r){if(e===H.EMPTY)return H.EMPTY;if(t===H.EMPTY)return H.EMPTY}else{if(e===H.EMPTY&&t===H.EMPTY)return H.EMPTY;if(e===H.EMPTY){const e=[t.returnState,H.EMPTY_RETURN_STATE],r=[t.parentCtx,null];return new B(r,e)}if(t===H.EMPTY){const t=[e.returnState,H.EMPTY_RETURN_STATE],r=[e.parentCtx,null];return new B(r,t)}}return null}(e,t,r);if(null!==i)return null!==n&&n.set(e,t,i),i;if(e.returnState===t.returnState){const i=W(e.parentCtx,t.parentCtx,r,n);if(i===e.parentCtx)return e;if(i===t.parentCtx)return t;const s=V.create(i,e.returnState);return null!==n&&n.set(e,t,s),s}{let r=null;if((e===t||null!==e.parentCtx&&e.parentCtx===t.parentCtx)&&(r=e.parentCtx),null!==r){const i=[e.returnState,t.returnState];e.returnState>t.returnState&&(i[0]=t.returnState,i[1]=e.returnState);const s=new B([r,r],i);return null!==n&&n.set(e,t,s),s}const i=[e.returnState,t.returnState];let s=[e.parentCtx,t.parentCtx];e.returnState>t.returnState&&(i[0]=t.returnState,i[1]=e.returnState,s=[t.parentCtx,e.parentCtx]);const a=new B(s,i);return null!==n&&n.set(e,t,a),a}}(e,t,r,n);if(r){if(e instanceof z)return e;if(t instanceof z)return t}return e instanceof V&&(e=new B([e.getParent()],[e.returnState])),t instanceof V&&(t=new B([t.getParent()],[t.returnState])),function(e,t,r,n){if(null!==n){let r=n.get(e,t);if(null!==r)return H.trace_atn_sim&&console.log("mergeArrays a="+e+",b="+t+" -> previous"),r;if(r=n.get(t,e),null!==r)return H.trace_atn_sim&&console.log("mergeArrays a="+e+",b="+t+" -> previous"),r}let i=0,s=0,a=0,o=new Array(e.returnStates.length+t.returnStates.length).fill(0),l=new Array(e.returnStates.length+t.returnStates.length).fill(null);for(;i<e.returnStates.length&&s<t.returnStates.length;){const c=e.parents[i],u=t.parents[s];if(e.returnStates[i]===t.returnStates[s]){const t=e.returnStates[i];t===H.EMPTY_RETURN_STATE&&null===c&&null===u||null!==c&&null!==u&&c===u?(l[a]=c,o[a]=t):(l[a]=W(c,u,r,n),o[a]=t),i+=1,s+=1}else e.returnStates[i]<t.returnStates[s]?(l[a]=c,o[a]=e.returnStates[i],i+=1):(l[a]=u,o[a]=t.returnStates[s],s+=1);a+=1}if(i<e.returnStates.length)for(let t=i;t<e.returnStates.length;t++)l[a]=e.parents[t],o[a]=e.returnStates[t],a+=1;else for(let e=s;e<t.returnStates.length;e++)l[a]=t.parents[e],o[a]=t.returnStates[e],a+=1;if(a<l.length){if(1===a){const r=V.create(l[0],o[0]);return null!==n&&n.set(e,t,r),r}l=l.slice(0,a),o=o.slice(0,a)}const c=new B(l,o);return c.equals(e)?(null!==n&&n.set(e,t,e),H.trace_atn_sim&&console.log("mergeArrays a="+e+",b="+t+" -> a"),e):c.equals(t)?(null!==n&&n.set(e,t,t),H.trace_atn_sim&&console.log("mergeArrays a="+e+",b="+t+" -> b"),t):(function(e){const t=new Y;for(let r=0;r<e.length;r++){const n=e[r];t.containsKey(n)||t.set(n,n)}for(let r=0;r<e.length;r++)e[r]=t.get(e[r])}(l),null!==n&&n.set(e,t,c),H.trace_atn_sim&&console.log("mergeArrays a="+e+",b="+t+" -> "+c),c)}(e,t,r,n)}class G{constructor(){this.data=new Uint32Array(1)}set(e){G._checkIndex(e),this._resize(e),this.data[e>>>5]|=1<<e%32}get(e){G._checkIndex(e);const t=e>>>5;return!(t>=this.data.length||!(this.data[t]&1<<e%32))}clear(e){G._checkIndex(e);const t=e>>>5;t<this.data.length&&(this.data[t]&=~(1<<e))}or(e){const t=Math.min(this.data.length,e.data.length);for(let r=0;r<t;++r)this.data[r]|=e.data[r];if(this.data.length<e.data.length){this._resize((e.data.length<<5)-1);const r=e.data.length;for(let n=t;n<r;++n)this.data[n]=e.data[n]}}values(){const e=new Array(this.length);let t=0;const r=this.data.length;for(let n=0;n<r;++n){let r=this.data[n];for(;0!==r;){const i=r&-r;e[t++]=(n<<5)+G._bitCount(i-1),r^=i}}return e}minValue(){for(let e=0;e<this.data.length;++e){let t=this.data[e];if(0!==t){let r=0;for(;!(1&t);)r++,t>>=1;return r+32*e}}return 0}hashCode(){return l.hashStuff(this.values())}equals(e){return e instanceof G&&r(this.data,e.data)}toString(){return"{"+this.values().join(", ")+"}"}get length(){return this.data.map(e=>G._bitCount(e)).reduce((e,t)=>e+t,0)}_resize(e){const t=e+32>>>5;if(t<=this.data.length)return;const r=new Uint32Array(t);r.set(this.data),r.fill(0,this.data.length),this.data=r}static _checkIndex(e){if(e<0)throw new RangeError("index cannot be negative")}static _bitCount(e){return e=(e=(858993459&(e-=e>>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,e+=e>>8,0+(e+=e>>16)&63}}class ${constructor(e){this.atn=e}getDecisionLookahead(e){if(null===e)return null;const t=e.transitions.length,r=[];for(let n=0;n<t;n++){r[n]=new S;const t=new p,i=!1;this._LOOK(e.transition(n).target,null,H.EMPTY,r[n],t,new G,i,!1),(0===r[n].length||r[n].contains($.HIT_PRED))&&(r[n]=null)}return r}LOOK(e,t,r){const n=new S,i=null!==(r=r||null)?q(e.atn,r):null;return this._LOOK(e,t,i,n,new p,new G,!0,!0),n}_LOOK(e,t,r,n,s,a,o,l){const c=new m({state:e,alt:0,context:r},null);if(!s.has(c)){if(s.add(c),e===t){if(null===r)return void n.addOne(i.EPSILON);if(r.isEmpty()&&l)return void n.addOne(i.EOF)}if(e instanceof A){if(null===r)return void n.addOne(i.EPSILON);if(r.isEmpty()&&l)return void n.addOne(i.EOF);if(r!==H.EMPTY){const i=a.get(e.ruleIndex);try{a.clear(e.ruleIndex);for(let e=0;e<r.length;e++){const i=this.atn.states[r.getReturnState(e)];this._LOOK(i,t,r.getParent(e),n,s,a,o,l)}}finally{i&&a.set(e.ruleIndex)}return}}for(let c=0;c<e.transitions.length;c++){const u=e.transitions[c];if(u.constructor===y){if(a.get(u.target.ruleIndex))continue;const e=V.create(r,u.followState.stateNumber);try{a.set(u.target.ruleIndex),this._LOOK(u.target,t,e,n,s,a,o,l)}finally{a.clear(u.target.ruleIndex)}}else if(u instanceof v)o?this._LOOK(u.target,t,r,n,s,a,o,l):n.addOne($.HIT_PRED);else if(u.isEpsilon)this._LOOK(u.target,t,r,n,s,a,o,l);else if(u.constructor===k)n.addRange(i.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType);else{let e=u.label;null!==e&&(u instanceof I&&(e=e.complement(i.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType)),n.addSet(e))}}}}}$.HIT_PRED=i.INVALID_TYPE;class j{constructor(e,t){this.grammarType=e,this.maxTokenType=t,this.states=[],this.decisionToState=[],this.ruleToStartState=[],this.ruleToStopState=null,this.modeNameToStartState={},this.ruleToTokenType=null,this.lexerActions=null,this.modeToStartState=[]}nextTokensInContext(e,t){return new $(this).LOOK(e,null,t)}nextTokensNoContext(e){return null!==e.nextTokenWithinRule||(e.nextTokenWithinRule=this.nextTokensInContext(e,null),e.nextTokenWithinRule.readOnly=!0),e.nextTokenWithinRule}nextTokens(e,t){return void 0===t?this.nextTokensNoContext(e):this.nextTokensInContext(e,t)}addState(e){null!==e&&(e.atn=this,e.stateNumber=this.states.length),this.states.push(e)}removeState(e){this.states[e.stateNumber]=null}defineDecisionState(e){return this.decisionToState.push(e),e.decision=this.decisionToState.length-1,e.decision}getDecisionState(e){return 0===this.decisionToState.length?null:this.decisionToState[e]}getExpectedTokens(e,t){if(e<0||e>=this.states.length)throw"Invalid state number.";const r=this.states[e];let n=this.nextTokens(r);if(!n.contains(i.EPSILON))return n;const s=new S;for(s.addSet(n),s.removeOne(i.EPSILON);null!==t&&t.invokingState>=0&&n.contains(i.EPSILON);){const e=this.states[t.invokingState].transitions[0];n=this.nextTokens(e.followState),s.addSet(n),s.removeOne(i.EPSILON),t=t.parentCtx}return n.contains(i.EPSILON)&&s.addOne(i.EOF),s}}j.INVALID_ALT_NUMBER=0;class X extends C{constructor(){super(),this.stateType=C.BASIC}}class J extends C{constructor(){return super(),this.decision=-1,this.nonGreedy=!1,this}}class Q extends J{constructor(){return super(),this.endState=null,this}}class Z extends C{constructor(){return super(),this.stateType=C.BLOCK_END,this.startState=null,this}}class tt extends C{constructor(){return super(),this.stateType=C.LOOP_END,this.loopBackState=null,this}}class et extends C{constructor(){return super(),this.stateType=C.RULE_START,this.stopState=null,this.isPrecedenceRule=!1,this}}class st extends J{constructor(){return super(),this.stateType=C.TOKEN_START,this}}class nt extends J{constructor(){return super(),this.stateType=C.PLUS_LOOP_BACK,this}}class it extends C{constructor(){return super(),this.stateType=C.STAR_LOOP_BACK,this}}class rt extends J{constructor(){return super(),this.stateType=C.STAR_LOOP_ENTRY,this.loopBackState=null,this.isPrecedenceDecision=null,this}}class ot extends Q{constructor(){return super(),this.stateType=C.PLUS_BLOCK_START,this.loopBackState=null,this}}class at extends Q{constructor(){return super(),this.stateType=C.STAR_BLOCK_START,this}}class lt extends Q{constructor(){return super(),this.stateType=C.BLOCK_START,this}}class ht extends N{constructor(e,t){super(e),this.label_=t,this.label=this.makeLabel(),this.serializationType=N.ATOM}makeLabel(){const e=new S;return e.addOne(this.label_),e}matches(e,t,r){return this.label_===e}toString(){return this.label_}}class ct extends N{constructor(e,t,r){super(e),this.serializationType=N.RANGE,this.start=t,this.stop=r,this.label=this.makeLabel()}makeLabel(){const e=new S;return e.addRange(this.start,this.stop),e}matches(e,t,r){return e>=this.start&&e<=this.stop}toString(){return"'"+String.fromCharCode(this.start)+"'..'"+String.fromCharCode(this.stop)+"'"}}class ut extends N{constructor(e,t,r,n){super(e),this.serializationType=N.ACTION,this.ruleIndex=t,this.actionIndex=void 0===r?-1:r,this.isCtxDependent=void 0!==n&&n,this.isEpsilon=!0}matches(e,t,r){return!1}toString(){return"action_"+this.ruleIndex+":"+this.actionIndex}}class dt extends N{constructor(e,t){super(e),this.serializationType=N.EPSILON,this.isEpsilon=!0,this.outermostPrecedenceReturn=t}matches(e,t,r){return!1}toString(){return"epsilon"}}class pt extends g{constructor(e,t,r){super(),this.ruleIndex=void 0===e?-1:e,this.predIndex=void 0===t?-1:t,this.isCtxDependent=void 0!==r&&r}evaluate(e,t){const r=this.isCtxDependent?t:null;return e.sempred(r,this.ruleIndex,this.predIndex)}updateHashCode(e){e.update(this.ruleIndex,this.predIndex,this.isCtxDependent)}equals(e){return this===e||e instanceof pt&&this.ruleIndex===e.ruleIndex&&this.predIndex===e.predIndex&&this.isCtxDependent===e.isCtxDependent}toString(){return"{"+this.ruleIndex+":"+this.predIndex+"}?"}}g.NONE=new pt;class gt extends v{constructor(e,t,r,n){super(e),this.serializationType=N.PREDICATE,this.ruleIndex=t,this.predIndex=r,this.isCtxDependent=n,this.isEpsilon=!0}matches(e,t,r){return!1}getPredicate(){return new pt(this.ruleIndex,this.predIndex,this.isCtxDependent)}toString(){return"pred_"+this.ruleIndex+":"+this.predIndex}}class ft extends g{constructor(e){super(),this.precedence=void 0===e?0:e}evaluate(e,t){return e.precpred(t,this.precedence)}evalPrecedence(e,t){return e.precpred(t,this.precedence)?g.NONE:null}compareTo(e){return this.precedence-e.precedence}updateHashCode(e){e.update(this.precedence)}equals(e){return this===e||e instanceof ft&&this.precedence===e.precedence}toString(){return"{"+this.precedence+">=prec}?"}}g.PrecedencePredicate=ft;class xt extends v{constructor(e,t){super(e),this.serializationType=N.PRECEDENCE,this.precedence=t,this.isEpsilon=!0}matches(e,t,r){return!1}getPredicate(){return new ft(this.precedence)}toString(){return this.precedence+" >= _p"}}class _t{constructor(e){void 0===e&&(e=null),this.readOnly=!1,this.verifyATN=null===e||e.verifyATN,this.generateRuleBypassTransitions=null!==e&&e.generateRuleBypassTransitions}}_t.defaultOptions=new _t,_t.defaultOptions.readOnly=!0;class Tt{constructor(e){this.actionType=e,this.isPositionDependent=!1}hashCode(){const e=new l;return this.updateHashCode(e),e.finish()}updateHashCode(e){e.update(this.actionType)}equals(e){return this===e}}class mt extends Tt{constructor(){super(6)}execute(e){e.skip()}toString(){return"skip"}}mt.INSTANCE=new mt;class Et extends Tt{constructor(e){super(0),this.channel=e}execute(e){e._channel=this.channel}updateHashCode(e){e.update(this.actionType,this.channel)}equals(e){return this===e||e instanceof Et&&this.channel===e.channel}toString(){return"channel("+this.channel+")"}}class St extends Tt{constructor(e,t){super(1),this.ruleIndex=e,this.actionIndex=t,this.isPositionDependent=!0}execute(e){e.action(null,this.ruleIndex,this.actionIndex)}updateHashCode(e){e.update(this.actionType,this.ruleIndex,this.actionIndex)}equals(e){return this===e||e instanceof St&&this.ruleIndex===e.ruleIndex&&this.actionIndex===e.actionIndex}}class Ct extends Tt{constructor(){super(3)}execute(e){e.more()}toString(){return"more"}}Ct.INSTANCE=new Ct;class At extends Tt{constructor(e){super(7),this.type=e}execute(e){e.type=this.type}updateHashCode(e){e.update(this.actionType,this.type)}equals(e){return this===e||e instanceof At&&this.type===e.type}toString(){return"type("+this.type+")"}}class Nt extends Tt{constructor(e){super(5),this.mode=e}execute(e){e.pushMode(this.mode)}updateHashCode(e){e.update(this.actionType,this.mode)}equals(e){return this===e||e instanceof Nt&&this.mode===e.mode}toString(){return"pushMode("+this.mode+")"}}class yt extends Tt{constructor(){super(4)}execute(e){e.popMode()}toString(){return"popMode"}}yt.INSTANCE=new yt;class Lt extends Tt{constructor(e){super(2),this.mode=e}execute(e){e.setMode(this.mode)}updateHashCode(e){e.update(this.actionType,this.mode)}equals(e){return this===e||e instanceof Lt&&this.mode===e.mode}toString(){return"mode("+this.mode+")"}}function It(e,t){const r=[];return r[e-1]=t,r.map(function(e){return t})}class kt{constructor(e){null==e&&(e=_t.defaultOptions),this.deserializationOptions=e,this.stateFactories=null,this.actionFactories=null}deserialize(e){const t=this.reset(e);this.checkVersion(t),t&&this.skipUUID();const r=this.readATN();this.readStates(r,t),this.readRules(r,t),this.readModes(r);const n=[];return this.readSets(r,n,this.readInt.bind(this)),t&&this.readSets(r,n,this.readInt32.bind(this)),this.readEdges(r,n),this.readDecisions(r),this.readLexerActions(r,t),this.markPrecedenceDecisions(r),this.verifyATN(r),this.deserializationOptions.generateRuleBypassTransitions&&1===r.grammarType&&(this.generateRuleBypassTransitions(r),this.verifyATN(r)),r}reset(e){if(3===(e.charCodeAt?e.charCodeAt(0):e[0])){const t=function(e){const t=e.charCodeAt(0);return t>1?t-2:t+65534},r=e.split("").map(t);return r[0]=e.charCodeAt(0),this.data=r,this.pos=0,!0}return this.data=e,this.pos=0,!1}skipUUID(){let e=0;for(;e++<8;)this.readInt()}checkVersion(e){const t=this.readInt();if(!e&&4!==t)throw"Could not deserialize ATN with version "+t+" (expected 4)."}readATN(){const e=this.readInt(),t=this.readInt();return new j(e,t)}readStates(e,t){let r,n,i;const s=[],a=[],o=this.readInt();for(let r=0;r<o;r++){const r=this.readInt();if(r===C.INVALID_TYPE){e.addState(null);continue}let n=this.readInt();t&&65535===n&&(n=-1);const i=this.stateFactory(r,n);if(r===C.LOOP_END){const e=this.readInt();s.push([i,e])}else if(i instanceof Q){const e=this.readInt();a.push([i,e])}e.addState(i)}for(r=0;r<s.length;r++)n=s[r],n[0].loopBackState=e.states[n[1]];for(r=0;r<a.length;r++)n=a[r],n[0].endState=e.states[n[1]];let l=this.readInt();for(r=0;r<l;r++)i=this.readInt(),e.states[i].nonGreedy=!0;let c=this.readInt();for(r=0;r<c;r++)i=this.readInt(),e.states[i].isPrecedenceRule=!0}readRules(e,t){let r;const n=this.readInt();for(0===e.grammarType&&(e.ruleToTokenType=It(n,0)),e.ruleToStartState=It(n,0),r=0;r<n;r++){const n=this.readInt();if(e.ruleToStartState[r]=e.states[n],0===e.grammarType){let n=this.readInt();t&&65535===n&&(n=i.EOF),e.ruleToTokenType[r]=n}}for(e.ruleToStopState=It(n,0),r=0;r<e.states.length;r++){const t=e.states[r];t instanceof A&&(e.ruleToStopState[t.ruleIndex]=t,e.ruleToStartState[t.ruleIndex].stopState=t)}}readModes(e){const t=this.readInt();for(let r=0;r<t;r++){let t=this.readInt();e.modeToStartState.push(e.states[t])}}readSets(e,t,r){const n=this.readInt();for(let e=0;e<n;e++){const e=new S;t.push(e);const n=this.readInt();0!==this.readInt()&&e.addOne(-1);for(let t=0;t<n;t++){const t=r(),n=r();e.addRange(t,n)}}}readEdges(e,t){let r,n,i,s,a;const o=this.readInt();for(r=0;r<o;r++){const r=this.readInt(),n=this.readInt(),i=this.readInt(),a=this.readInt(),o=this.readInt(),l=this.readInt();s=this.edgeFactory(e,i,r,n,a,o,l,t),e.states[r].addTransition(s)}for(r=0;r<e.states.length;r++)for(i=e.states[r],n=0;n<i.transitions.length;n++){const t=i.transitions[n];if(!(t instanceof y))continue;let r=-1;e.ruleToStartState[t.target.ruleIndex].isPrecedenceRule&&0===t.precedence&&(r=t.target.ruleIndex),s=new dt(t.followState,r),e.ruleToStopState[t.target.ruleIndex].addTransition(s)}for(r=0;r<e.states.length;r++){if(i=e.states[r],i instanceof Q){if(null===i.endState)throw"IllegalState";if(null!==i.endState.startState)throw"IllegalState";i.endState.startState=i}if(i instanceof nt)for(n=0;n<i.transitions.length;n++)a=i.transitions[n].target,a instanceof ot&&(a.loopBackState=i);else if(i instanceof it)for(n=0;n<i.transitions.length;n++)a=i.transitions[n].target,a instanceof rt&&(a.loopBackState=i)}}readDecisions(e){const t=this.readInt();for(let r=0;r<t;r++){const t=this.readInt(),n=e.states[t];e.decisionToState.push(n),n.decision=r}}readLexerActions(e,t){if(0===e.grammarType){const r=this.readInt();e.lexerActions=It(r,null);for(let n=0;n<r;n++){const r=this.readInt();let i=this.readInt();t&&65535===i&&(i=-1);let s=this.readInt();t&&65535===s&&(s=-1),e.lexerActions[n]=this.lexerActionFactory(r,i,s)}}}generateRuleBypassTransitions(e){let t;const r=e.ruleToStartState.length;for(t=0;t<r;t++)e.ruleToTokenType[t]=e.maxTokenType+t+1;for(t=0;t<r;t++)this.generateRuleBypassTransition(e,t)}generateRuleBypassTransition(e,t){let r,n;const i=new lt;i.ruleIndex=t,e.addState(i);const s=new Z;s.ruleIndex=t,e.addState(s),i.endState=s,e.defineDecisionState(i),s.startState=i;let a=null,o=null;if(e.ruleToStartState[t].isPrecedenceRule){for(o=null,r=0;r<e.states.length;r++)if(n=e.states[r],this.stateIsEndStateFor(n,t)){o=n,a=n.loopBackState.transitions[0];break}if(null===a)throw"Couldn't identify final state of the precedence rule prefix section."}else o=e.ruleToStopState[t];for(r=0;r<e.states.length;r++){n=e.states[r];for(let e=0;e<n.transitions.length;e++){const t=n.transitions[e];t!==a&&t.target===o&&(t.target=s)}}const l=e.ruleToStartState[t],c=l.transitions.length;for(;c>0;)i.addTransition(l.transitions[c-1]),l.transitions=l.transitions.slice(-1);e.ruleToStartState[t].addTransition(new dt(i)),s.addTransition(new dt(o));const u=new X;e.addState(u),u.addTransition(new ht(s,e.ruleToTokenType[t])),i.addTransition(new dt(u))}stateIsEndStateFor(e,t){if(e.ruleIndex!==t)return null;if(!(e instanceof rt))return null;const r=e.transitions[e.transitions.length-1].target;return r instanceof tt&&r.epsilonOnlyTransitions&&r.transitions[0].target instanceof A?e:null}markPrecedenceDecisions(e){for(let t=0;t<e.states.length;t++){const r=e.states[t];if(r instanceof rt&&e.ruleToStartState[r.ruleIndex].isPrecedenceRule){const e=r.transitions[r.transitions.length-1].target;e instanceof tt&&e.epsilonOnlyTransitions&&e.transitions[0].target instanceof A&&(r.isPrecedenceDecision=!0)}}}verifyATN(e){if(this.deserializationOptions.verifyATN)for(let t=0;t<e.states.length;t++){const r=e.states[t];if(null!==r)if(this.checkCondition(r.epsilonOnlyTransitions||r.transitions.length<=1),r instanceof ot)this.checkCondition(null!==r.loopBackState);else if(r instanceof rt)if(this.checkCondition(null!==r.loopBackState),this.checkCondition(2===r.transitions.length),r.transitions[0].target instanceof at)this.checkCondition(r.transitions[1].target instanceof tt),this.checkCondition(!r.nonGreedy);else{if(!(r.transitions[0].target instanceof tt))throw"IllegalState";this.checkCondition(r.transitions[1].target instanceof at),this.checkCondition(r.nonGreedy)}else r instanceof it?(this.checkCondition(1===r.transitions.length),this.checkCondition(r.transitions[0].target instanceof rt)):r instanceof tt?this.checkCondition(null!==r.loopBackState):r instanceof et?this.checkCondition(null!==r.stopState):r instanceof Q?this.checkCondition(null!==r.endState):r instanceof Z?this.checkCondition(null!==r.startState):r instanceof J?this.checkCondition(r.transitions.length<=1||r.decision>=0):this.checkCondition(r.transitions.length<=1||r instanceof A)}}checkCondition(e,t){if(!e)throw null==t&&(t="IllegalState"),t}readInt(){return this.data[this.pos++]}readInt32(){return this.readInt()|this.readInt()<<16}edgeFactory(e,t,r,n,s,a,o,l){const c=e.states[n];switch(t){case N.EPSILON:return new dt(c);case N.RANGE:return new ct(c,0!==o?i.EOF:s,a);case N.RULE:return new y(e.states[s],a,o,c);case N.PREDICATE:return new gt(c,s,a,0!==o);case N.PRECEDENCE:return new xt(c,s);case N.ATOM:return new ht(c,0!==o?i.EOF:s);case N.ACTION:return new ut(c,s,a,0!==o);case N.SET:return new L(c,l[s]);case N.NOT_SET:return new I(c,l[s]);case N.WILDCARD:return new k(c);default:throw"The specified transition type: "+t+" is not valid."}}stateFactory(e,t){if(null===this.stateFactories){const e=[];e[C.INVALID_TYPE]=null,e[C.BASIC]=()=>new X,e[C.RULE_START]=()=>new et,e[C.BLOCK_START]=()=>new lt,e[C.PLUS_BLOCK_START]=()=>new ot,e[C.STAR_BLOCK_START]=()=>new at,e[C.TOKEN_START]=()=>new st,e[C.RULE_STOP]=()=>new A,e[C.BLOCK_END]=()=>new Z,e[C.STAR_LOOP_BACK]=()=>new it,e[C.STAR_LOOP_ENTRY]=()=>new rt,e[C.PLUS_LOOP_BACK]=()=>new nt,e[C.LOOP_END]=()=>new tt,this.stateFactories=e}if(e>this.stateFactories.length||null===this.stateFactories[e])throw"The specified state type "+e+" is not valid.";{const r=this.stateFactories[e]();if(null!==r)return r.ruleIndex=t,r}}lexerActionFactory(e,t,r){if(null===this.actionFactories){const e=[];e[0]=(e,t)=>new Et(e),e[1]=(e,t)=>new St(e,t),e[2]=(e,t)=>new Lt(e),e[3]=(e,t)=>Ct.INSTANCE,e[4]=(e,t)=>yt.INSTANCE,e[5]=(e,t)=>new Nt(e),e[6]=(e,t)=>mt.INSTANCE,e[7]=(e,t)=>new At(e),this.actionFactories=e}if(e>this.actionFactories.length||null===this.actionFactories[e])throw"The specified lexer action type "+e+" is not valid.";return this.actionFactories[e](t,r)}}class vt{syntaxError(e,t,r,n,i,s){}reportAmbiguity(e,t,r,n,i,s,a){}reportAttemptingFullContext(e,t,r,n,i,s){}reportContextSensitivity(e,t,r,n,i,s){}}class wt extends vt{constructor(){super()}syntaxError(e,t,r,n,i,s){console.error("line "+r+":"+n+" "+i)}}wt.INSTANCE=new wt;class Rt extends vt{constructor(e){if(super(),null===e)throw"delegates";return this.delegates=e,this}syntaxError(e,t,r,n,i,s){this.delegates.map(a=>a.syntaxError(e,t,r,n,i,s))}reportAmbiguity(e,t,r,n,i,s,a){this.delegates.map(o=>o.reportAmbiguity(e,t,r,n,i,s,a))}reportAttemptingFullContext(e,t,r,n,i,s){this.delegates.map(a=>a.reportAttemptingFullContext(e,t,r,n,i,s))}reportContextSensitivity(e,t,r,n,i,s){this.delegates.map(a=>a.reportContextSensitivity(e,t,r,n,i,s))}}class Ot{constructor(){this._listeners=[wt.INSTANCE],this._interp=null,this._stateNumber=-1}checkVersion(e){const t="4.13.2";t!==e&&console.log("ANTLR runtime and generated code versions disagree: "+t+"!="+e)}addErrorListener(e){this._listeners.push(e)}removeErrorListeners(){this._listeners=[]}getLiteralNames(){return Object.getPrototypeOf(this).constructor.literalNames||[]}getSymbolicNames(){return Object.getPrototypeOf(this).constructor.symbolicNames||[]}getTokenNames(){if(!this.tokenNames){const e=this.getLiteralNames(),t=this.getSymbolicNames(),r=e.length>t.length?e.length:t.length;this.tokenNames=[];for(let n=0;n<r;n++)this.tokenNames[n]=e[n]||t[n]||"<INVALID"}return this.tokenNames}getTokenTypeMap(){const e=this.getTokenNames();if(null===e)throw"The current recognizer does not provide a list of token names.";let t=this.tokenTypeMapCache[e];return void 0===t&&(t=e.reduce(function(e,t,r){e[t]=r}),t.EOF=i.EOF,this.tokenTypeMapCache[e]=t),t}getRuleIndexMap(){const e=this.ruleNames;if(null===e)throw"The current recognizer does not provide a list of rule names.";let t=this.ruleIndexMapCache[e];return void 0===t&&(t=e.reduce(function(e,t,r){e[t]=r}),this.ruleIndexMapCache[e]=t),t}getTokenType(e){const t=this.getTokenTypeMap()[e];return void 0!==t?t:i.INVALID_TYPE}getErrorHeader(e){return"line "+e.getOffendingToken().line+":"+e.getOffendingToken().column}getTokenErrorDisplay(e){if(null===e)return"<no token>";let t=e.text;return null===t&&(t=e.type===i.EOF?"<EOF>":"<"+e.type+">"),t=t.replace("\n","\\n").replace("\r","\\r").replace("\t","\\t"),"'"+t+"'"}getErrorListenerDispatch(){return console.warn("Calling deprecated method in Recognizer class: getErrorListenerDispatch()"),this.getErrorListener()}getErrorListener(){return new Rt(this._listeners)}sempred(e,t,r){return!0}precpred(e,t){return!0}get atn(){return this._interp.atn}get state(){return this._stateNumber}set state(e){this._stateNumber=e}}Ot.tokenTypeMapCache={},Ot.ruleIndexMapCache={};class Pt extends i{constructor(e,t,r,n,s){super(),this.source=void 0!==e?e:Pt.EMPTY_SOURCE,this.type=void 0!==t?t:null,this.channel=void 0!==r?r:i.DEFAULT_CHANNEL,this.start=void 0!==n?n:-1,this.stop=void 0!==s?s:-1,this.tokenIndex=-1,null!==this.source[0]?(this.line=e[0].line,this.column=e[0].column):this.column=-1}clone(){const e=new Pt(this.source,this.type,this.channel,this.start,this.stop);return e.tokenIndex=this.tokenIndex,e.line=this.line,e.column=this.column,e.text=this.text,e}cloneWithType(e){const t=new Pt(this.source,e,this.channel,this.start,this.stop);return t.tokenIndex=this.tokenIndex,t.line=this.line,t.column=this.column,e===i.EOF&&(t.text=""),t}toString(){let e=this.text;return e=null!==e?e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"):"<no text>","[@"+this.tokenIndex+","+this.start+":"+this.stop+"='"+e+"',<"+this.type+">"+(this.channel>0?",channel="+this.channel:"")+","+this.line+":"+this.column+"]"}get text(){if(null!==this._text)return this._text;const e=this.getInputStream();if(null===e)return null;const t=e.size;return this.start<t&&this.stop<t?e.getText(this.start,this.stop):"<EOF>"}set text(e){this._text=e}}Pt.EMPTY_SOURCE=[null,null];class bt{}class Ft extends bt{constructor(e){super(),this.copyText=void 0!==e&&e}create(e,t,r,n,i,s,a,o){const l=new Pt(e,t,n,i,s);return l.line=a,l.column=o,null!==r?l.text=r:this.copyText&&null!==e[1]&&(l.text=e[1].getText(i,s)),l}createThin(e,t){const r=new Pt(null,e);return r.text=t,r}}Ft.DEFAULT=new Ft;class Dt extends Error{constructor(e){super(e.message),Error.captureStackTrace&&Error.captureStackTrace(this,Dt),this.message=e.message,this.recognizer=e.recognizer,this.input=e.input,this.ctx=e.ctx,this.offendingToken=null,this.offendingState=-1,null!==this.recognizer&&(this.offendingState=this.recognizer.state)}getExpectedTokens(){return null!==this.recognizer?this.recognizer.atn.getExpectedTokens(this.offendingState,this.ctx):null}toString(){return this.message}}class Mt extends Dt{constructor(e,t,r,n){super({message:"",recognizer:e,input:t,ctx:null}),this.startIndex=r,this.deadEndConfigs=n}toString(){let e="";return this.startIndex>=0&&this.startIndex<this.input.size&&(e=this.input.getText(new E(this.startIndex,this.startIndex))),"LexerNoViableAltException"+e}}class Ut extends Ot{constructor(e){super(),this._input=e,this._factory=Ft.DEFAULT,this._tokenFactorySourcePair=[this,e],this._interp=null,this._token=null,this._tokenStartCharIndex=-1,this._tokenStartLine=-1,this._tokenStartColumn=-1,this._hitEOF=!1,this._channel=i.DEFAULT_CHANNEL,this._type=i.INVALID_TYPE,this._modeStack=[],this._mode=Ut.DEFAULT_MODE,this._text=null}reset(){null!==this._input&&this._input.seek(0),this._token=null,this._type=i.INVALID_TYPE,this._channel=i.DEFAULT_CHANNEL,this._tokenStartCharIndex=-1,this._tokenStartColumn=-1,this._tokenStartLine=-1,this._text=null,this._hitEOF=!1,this._mode=Ut.DEFAULT_MODE,this._modeStack=[],this._interp.reset()}nextToken(){if(null===this._input)throw"nextToken requires a non-null input stream.";const e=this._input.mark();try{for(;;){if(this._hitEOF)return this.emitEOF(),this._token;this._token=null,this._channel=i.DEFAULT_CHANNEL,this._tokenStartCharIndex=this._input.index,this._tokenStartColumn=this._interp.column,this._tokenStartLine=this._interp.line,this._text=null;let t=!1;for(;;){this._type=i.INVALID_TYPE;let r=Ut.SKIP;try{r=this._interp.match(this._input,this._mode)}catch(e){if(!(e instanceof Dt))throw console.log(e.stack),e;this.notifyListeners(e),this.recover(e)}if(this._input.LA(1)===i.EOF&&(this._hitEOF=!0),this._type===i.INVALID_TYPE&&(this._type=r),this._type===Ut.SKIP){t=!0;break}if(this._type!==Ut.MORE)break}if(!t)return null===this._token&&this.emit(),this._token}}finally{this._input.release(e)}}skip(){this._type=Ut.SKIP}more(){this._type=Ut.MORE}mode(e){console.warn("Calling deprecated method in Lexer class: mode(...)"),this.setMode(e)}setMode(e){this._mode=e}getMode(){return this._mode}getModeStack(){return this._modeStack}pushMode(e){this._interp.debug&&console.log("pushMode "+e),this._modeStack.push(this._mode),this.setMode(e)}popMode(){if(0===this._modeStack.length)throw"Empty Stack";return this._interp.debug&&console.log("popMode back to "+this._modeStack.slice(0,-1)),this.setMode(this._modeStack.pop()),this._mode}emitToken(e){this._token=e}emit(){const e=this._factory.create(this._tokenFactorySourcePair,this._type,this._text,this._channel,this._tokenStartCharIndex,this.getCharIndex()-1,this._tokenStartLine,this._tokenStartColumn);return this.emitToken(e),e}emitEOF(){const e=this.column,t=this.line,r=this._factory.create(this._tokenFactorySourcePair,i.EOF,null,i.DEFAULT_CHANNEL,this._input.index,this._input.index-1,t,e);return this.emitToken(r),r}getCharIndex(){return this._input.index}getAllTokens(){const e=[];let t=this.nextToken();for(;t.type!==i.EOF;)e.push(t),t=this.nextToken();return e}notifyListeners(e){const t=this._tokenStartCharIndex,r=this._input.index,n=this._input.getText(t,r),i="token recognition error at: '"+this.getErrorDisplay(n)+"'";this.getErrorListener().syntaxError(this,null,this._tokenStartLine,this._tokenStartColumn,i,e)}getErrorDisplay(e){const t=[];for(let r=0;r<e.length;r++)t.push(e[r]);return t.join("")}getErrorDisplayForChar(e){return e.charCodeAt(0)===i.EOF?"<EOF>":"\n"===e?"\\n":"\t"===e?"\\t":"\r"===e?"\\r":e}getCharErrorDisplay(e){return"'"+this.getErrorDisplayForChar(e)+"'"}recover(e){this._input.LA(1)!==i.EOF&&(e instanceof Mt?this._interp.consume(this._input):this._input.consume())}get inputStream(){return this._input}set inputStream(e){this._input=null,this._tokenFactorySourcePair=[this,this._input],this.reset(),this._input=e,this._tokenFactorySourcePair=[this,this._input]}get sourceName(){return this._input.sourceName}get type(){return this._type}set type(e){this._type=e}get line(){return this._interp.line}set line(e){this._interp.line=e}get column(){return this._interp.column}set column(e){this._interp.column=e}get text(){return null!==this._text?this._text:this._interp.getText(this._input)}set text(e){this._text=e}}function Ht(e){return e.hashCodeForConfigSet()}function Bt(e,t){return e===t||null!==e&&null!==t&&e.equalsForConfigSet(t)}Ut.DEFAULT_MODE=0,Ut.MORE=-2,Ut.SKIP=-3,Ut.DEFAULT_TOKEN_CHANNEL=i.DEFAULT_CHANNEL,Ut.HIDDEN=i.HIDDEN_CHANNEL,Ut.MIN_CHAR_VALUE=0,Ut.MAX_CHAR_VALUE=1114111;class Vt{constructor(e){this.configLookup=new p(Ht,Bt),this.fullCtx=void 0===e||e,this.readOnly=!1,this.configs=[],this.uniqueAlt=0,this.conflictingAlts=null,this.hasSemanticContext=!1,this.dipsIntoOuterContext=!1,this.cachedHashCode=-1}add(e,t){if(void 0===t&&(t=null),this.readOnly)throw"This set is readonly";e.semanticContext!==g.NONE&&(this.hasSemanticContext=!0),e.reachesIntoOuterContext>0&&(this.dipsIntoOuterContext=!0);const r=this.configLookup.getOrAdd(e);if(r===e)return this.cachedHashCode=-1,this.configs.push(e),!0;const n=!this.fullCtx,i=W(r.context,e.context,n,t);return r.reachesIntoOuterContext=Math.max(r.reachesIntoOuterContext,e.reachesIntoOuterContext),e.precedenceFilterSuppressed&&(r.precedenceFilterSuppressed=!0),r.context=i,!0}getStates(){const e=new p;for(let t=0;t<this.configs.length;t++)e.add(this.configs[t].state);return e}getPredicates(){const e=[];for(let t=0;t<this.configs.length;t++){const r=this.configs[t].semanticContext;r!==g.NONE&&e.push(r.semanticContext)}return e}optimizeConfigs(e){if(this.readOnly)throw"This set is readonly";if(0!==this.configLookup.length)for(let t=0;t<this.configs.length;t++){const r=this.configs[t];r.context=e.getCachedContext(r.context)}}addAll(e){for(let t=0;t<e.length;t++)this.add(e[t]);return!1}equals(e){return this===e||e instanceof Vt&&r(this.configs,e.configs)&&this.fullCtx===e.fullCtx&&this.uniqueAlt===e.uniqueAlt&&this.conflictingAlts===e.conflictingAlts&&this.hasSemanticContext===e.hasSemanticContext&&this.dipsIntoOuterContext===e.dipsIntoOuterContext}hashCode(){const e=new l;return e.update(this.configs),e.finish()}updateHashCode(e){this.readOnly?(-1===this.cachedHashCode&&(this.cachedHashCode=this.hashCode()),e.update(this.cachedHashCode)):e.update(this.hashCode())}isEmpty(){return 0===this.configs.length}contains(e){if(null===this.configLookup)throw"This method is not implemented for readonly sets.";return this.configLookup.contains(e)}containsFast(e){if(null===this.configLookup)throw"This method is not implemented for readonly sets.";return this.configLookup.containsFast(e)}clear(){if(this.readOnly)throw"This set is readonly";this.configs=[],this.cachedHashCode=-1,this.configLookup=new p}setReadonly(e){this.readOnly=e,e&&(this.configLookup=null)}toString(){return d(this.configs)+(this.hasSemanticContext?",hasSemanticContext="+this.hasSemanticContext:"")+(this.uniqueAlt!==j.INVALID_ALT_NUMBER?",uniqueAlt="+this.uniqueAlt:"")+(null!==this.conflictingAlts?",conflictingAlts="+this.conflictingAlts:"")+(this.dipsIntoOuterContext?",dipsIntoOuterContext":"")}get items(){return this.configs}get length(){return this.configs.length}}class zt{constructor(e,t){return null===e&&(e=-1),null===t&&(t=new Vt),this.stateNumber=e,this.configs=t,this.edges=null,this.isAcceptState=!1,this.prediction=0,this.lexerActionExecutor=null,this.requiresFullContext=!1,this.predicates=null,this}getAltSet(){const e=new p;if(null!==this.configs)for(let t=0;t<this.configs.length;t++){const r=this.configs[t];e.add(r.alt)}return 0===e.length?null:e}equals(e){return this===e||e instanceof zt&&this.configs.equals(e.configs)}toString(){let e=this.stateNumber+":"+this.configs;return this.isAcceptState&&(e+="=>",null!==this.predicates?e+=this.predicates:e+=this.prediction),e}hashCode(){const e=new l;return e.update(this.configs),e.finish()}}class Yt{constructor(e,t){return this.atn=e,this.sharedContextCache=t,this}getCachedContext(e){if(null===this.sharedContextCache)return e;const t=new Y;return K(e,this.sharedContextCache,t)}}Yt.ERROR=new zt(2147483647,new Vt);class qt extends Vt{constructor(){super(),this.configLookup=new p}}class Kt extends m{constructor(e,t){super(e,t);const r=e.lexerActionExecutor||null;return this.lexerActionExecutor=r||(null!==t?t.lexerActionExecutor:null),this.passedThroughNonGreedyDecision=null!==t&&this.checkNonGreedyDecision(t,this.state),this.hashCodeForConfigSet=Kt.prototype.hashCode,this.equalsForConfigSet=Kt.prototype.equals,this}updateHashCode(e){e.update(this.state.stateNumber,this.alt,this.context,this.semanticContext,this.passedThroughNonGreedyDecision,this.lexerActionExecutor)}equals(e){return this===e||e instanceof Kt&&this.passedThroughNonGreedyDecision===e.passedThroughNonGreedyDecision&&(this.lexerActionExecutor?this.lexerActionExecutor.equals(e.lexerActionExecutor):!e.lexerActionExecutor)&&super.equals(e)}checkNonGreedyDecision(e,t){return e.passedThroughNonGreedyDecision||t instanceof J&&t.nonGreedy}}class Wt extends Tt{constructor(e,t){super(t.actionType),this.offset=e,this.action=t,this.isPositionDependent=!0}execute(e){this.action.execute(e)}updateHashCode(e){e.update(this.actionType,this.offset,this.action)}equals(e){return this===e||e instanceof Wt&&this.offset===e.offset&&this.action===e.action}}class Gt{constructor(e){return this.lexerActions=null===e?[]:e,this.cachedHashCode=l.hashStuff(e),this}fixOffsetBeforeMatch(e){let t=null;for(let r=0;r<this.lexerActions.length;r++)!this.lexerActions[r].isPositionDependent||this.lexerActions[r]instanceof Wt||(null===t&&(t=this.lexerActions.concat([])),t[r]=new Wt(e,this.lexerActions[r]));return null===t?this:new Gt(t)}execute(e,t,r){let n=!1;const i=t.index;try{for(let s=0;s<this.lexerActions.length;s++){let a=this.lexerActions[s];if(a instanceof Wt){const e=a.offset;t.seek(r+e),a=a.action,n=r+e!==i}else a.isPositionDependent&&(t.seek(i),n=!1);a.execute(e)}}finally{n&&t.seek(i)}}hashCode(){return this.cachedHashCode}updateHashCode(e){e.update(this.cachedHashCode)}equals(e){if(this===e)return!0;if(e instanceof Gt){if(this.cachedHashCode!=e.cachedHashCode)return!1;if(this.lexerActions.length!=e.lexerActions.length)return!1;{const t=this.lexerActions.length;for(let r=0;r<t;++r)if(!this.lexerActions[r].equals(e.lexerActions[r]))return!1;return!0}}return!1}static append(e,t){if(null===e)return new Gt([t]);const r=e.lexerActions.concat([t]);return new Gt(r)}}function $t(e){e.index=-1,e.line=0,e.column=-1,e.dfaState=null}class jt{constructor(){$t(this)}reset(){$t(this)}}class Xt extends Yt{constructor(e,t,r,n){super(t,n),this.decisionToDFA=r,this.recog=e,this.startIndex=-1,this.line=1,this.column=0,this.mode=Ut.DEFAULT_MODE,this.prevAccept=new jt}copyState(e){this.column=e.column,this.line=e.line,this.mode=e.mode,this.startIndex=e.startIndex}match(e,t){this.mode=t;const r=e.mark();try{this.startIndex=e.index,this.prevAccept.reset();const r=this.decisionToDFA[t];return null===r.s0?this.matchATN(e):this.execATN(e,r.s0)}finally{e.release(r)}}reset(){this.prevAccept.reset(),this.startIndex=-1,this.line=1,this.column=0,this.mode=Ut.DEFAULT_MODE}matchATN(e){const t=this.atn.modeToStartState[this.mode];Xt.debug&&console.log("matchATN mode "+this.mode+" start: "+t);const r=this.mode,n=this.computeStartState(e,t),i=n.hasSemanticContext;n.hasSemanticContext=!1;const s=this.addDFAState(n);i||(this.decisionToDFA[this.mode].s0=s);const a=this.execATN(e,s);return Xt.debug&&console.log("DFA after matchATN: "+this.decisionToDFA[r].toLexerString()),a}execATN(e,t){Xt.debug&&console.log("start state closure="+t.configs),t.isAcceptState&&this.captureSimState(this.prevAccept,e,t);let r=e.LA(1),n=t;for(;;){Xt.debug&&console.log("execATN loop starting closure: "+n.configs);let t=this.getExistingTargetState(n,r);if(null===t&&(t=this.computeTargetState(e,n,r)),t===Yt.ERROR)break;if(r!==i.EOF&&this.consume(e),t.isAcceptState&&(this.captureSimState(this.prevAccept,e,t),r===i.EOF))break;r=e.LA(1),n=t}return this.failOrAccept(this.prevAccept,e,n.configs,r)}getExistingTargetState(e,t){if(null===e.edges||t<Xt.MIN_DFA_EDGE||t>Xt.MAX_DFA_EDGE)return null;let r=e.edges[t-Xt.MIN_DFA_EDGE];return void 0===r&&(r=null),Xt.debug&&null!==r&&console.log("reuse state "+e.stateNumber+" edge to "+r.stateNumber),r}computeTargetState(e,t,r){const n=new qt;return this.getReachableConfigSet(e,t.configs,n,r),0===n.items.length?(n.hasSemanticContext||this.addDFAEdge(t,r,Yt.ERROR),Yt.ERROR):this.addDFAEdge(t,r,null,n)}failOrAccept(e,t,r,n){if(null!==this.prevAccept.dfaState){const r=e.dfaState.lexerActionExecutor;return this.accept(t,r,this.startIndex,e.index,e.line,e.column),e.dfaState.prediction}if(n===i.EOF&&t.index===this.startIndex)return i.EOF;throw new Mt(this.recog,t,this.startIndex,r)}getReachableConfigSet(e,t,r,n){let s=j.INVALID_ALT_NUMBER;for(let a=0;a<t.items.length;a++){const o=t.items[a],l=o.alt===s;if(!l||!o.passedThroughNonGreedyDecision){Xt.debug&&console.log("testing %s at %s\n",this.getTokenName(n),o.toString(this.recog,!0));for(let t=0;t<o.state.transitions.length;t++){const a=o.state.transitions[t],c=this.getReachableTarget(a,n);if(null!==c){let t=o.lexerActionExecutor;null!==t&&(t=t.fixOffsetBeforeMatch(e.index-this.startIndex));const a=n===i.EOF,u=new Kt({state:c,lexerActionExecutor:t},o);this.closure(e,u,r,l,!0,a)&&(s=o.alt)}}}}}accept(e,t,r,n,i,s){Xt.debug&&console.log("ACTION %s\n",t),e.seek(n),this.line=i,this.column=s,null!==t&&null!==this.recog&&t.execute(this.recog,e,r)}getReachableTarget(e,t){return e.matches(t,0,Ut.MAX_CHAR_VALUE)?e.target:null}computeStartState(e,t){const r=H.EMPTY,n=new qt;for(let i=0;i<t.transitions.length;i++){const s=t.transitions[i].target,a=new Kt({state:s,alt:i+1,context:r},null);this.closure(e,a,n,!1,!1,!1)}return n}closure(e,t,r,n,i,s){let a=null;if(Xt.debug&&console.log("closure("+t.toString(this.recog,!0)+")"),t.state instanceof A){if(Xt.debug&&(null!==this.recog?console.log("closure at %s rule stop %s\n",this.recog.ruleNames[t.state.ruleIndex],t):console.log("closure at rule stop %s\n",t)),null===t.context||t.context.hasEmptyPath()){if(null===t.context||t.context.isEmpty())return r.add(t),!0;r.add(new Kt({state:t.state,context:H.EMPTY},t)),n=!0}if(null!==t.context&&!t.context.isEmpty())for(let o=0;o<t.context.length;o++)if(t.context.getReturnState(o)!==H.EMPTY_RETURN_STATE){const l=t.context.getParent(o),c=this.atn.states[t.context.getReturnState(o)];a=new Kt({state:c,context:l},t),n=this.closure(e,a,r,n,i,s)}return n}t.state.epsilonOnlyTransitions||n&&t.passedThroughNonGreedyDecision||r.add(t);for(let o=0;o<t.state.transitions.length;o++){const l=t.state.transitions[o];a=this.getEpsilonTarget(e,t,l,r,i,s),null!==a&&(n=this.closure(e,a,r,n,i,s))}return n}getEpsilonTarget(e,t,r,n,s,a){let o=null;if(r.serializationType===N.RULE){const e=V.create(t.context,r.followState.stateNumber);o=new Kt({state:r.target,context:e},t)}else{if(r.serializationType===N.PRECEDENCE)throw"Precedence predicates are not supported in lexers.";if(r.serializationType===N.PREDICATE)Xt.debug&&console.log("EVAL rule "+r.ruleIndex+":"+r.predIndex),n.hasSemanticContext=!0,this.evaluatePredicate(e,r.ruleIndex,r.predIndex,s)&&(o=new Kt({state:r.target},t));else if(r.serializationType===N.ACTION)if(null===t.context||t.context.hasEmptyPath()){const e=Gt.append(t.lexerActionExecutor,this.atn.lexerActions[r.actionIndex]);o=new Kt({state:r.target,lexerActionExecutor:e},t)}else o=new Kt({state:r.target},t);else r.serializationType===N.EPSILON?o=new Kt({state:r.target},t):r.serializationType!==N.ATOM&&r.serializationType!==N.RANGE&&r.serializationType!==N.SET||a&&r.matches(i.EOF,0,Ut.MAX_CHAR_VALUE)&&(o=new Kt({state:r.target},t))}return o}evaluatePredicate(e,t,r,n){if(null===this.recog)return!0;if(!n)return this.recog.sempred(null,t,r);const i=this.column,s=this.line,a=e.index,o=e.mark();try{return this.consume(e),this.recog.sempred(null,t,r)}finally{this.column=i,this.line=s,e.seek(a),e.release(o)}}captureSimState(e,t,r){e.index=t.index,e.line=this.line,e.column=this.column,e.dfaState=r}addDFAEdge(e,t,r,n){if(void 0===r&&(r=null),void 0===n&&(n=null),null===r&&null!==n){const e=n.hasSemanticContext;if(n.hasSemanticContext=!1,r=this.addDFAState(n),e)return r}return t<Xt.MIN_DFA_EDGE||t>Xt.MAX_DFA_EDGE||(Xt.debug&&console.log("EDGE "+e+" -> "+r+" upon "+t),null===e.edges&&(e.edges=[]),e.edges[t-Xt.MIN_DFA_EDGE]=r),r}addDFAState(e){const t=new zt(null,e);let r=null;for(let t=0;t<e.items.length;t++){const n=e.items[t];if(n.state instanceof A){r=n;break}}null!==r&&(t.isAcceptState=!0,t.lexerActionExecutor=r.lexerActionExecutor,t.prediction=this.atn.ruleToTokenType[r.state.ruleIndex]);const n=this.decisionToDFA[this.mode],i=n.states.get(t);if(null!==i)return i;const s=t;return s.stateNumber=n.states.length,e.setReadonly(!0),s.configs=e,n.states.add(s),s}getDFA(e){return this.decisionToDFA[e]}getText(e){return e.getText(this.startIndex,e.index-1)}consume(e){e.LA(1)==="\n".charCodeAt(0)?(this.line+=1,this.column=0):this.column+=1,e.consume()}getTokenName(e){return-1===e?"EOF":"'"+String.fromCharCode(e)+"'"}}Xt.debug=!1,Xt.dfa_debug=!1,Xt.MIN_DFA_EDGE=0,Xt.MAX_DFA_EDGE=127;class Jt{constructor(e,t){this.alt=t,this.pred=e}toString(){return"("+this.pred+", "+this.alt+")"}}class Qt{constructor(){this.data={}}get(e){return this.data["k-"+e]||null}set(e,t){this.data["k-"+e]=t}values(){return Object.keys(this.data).filter(e=>e.startsWith("k-")).map(e=>this.data[e],this)}}const Zt={SLL:0,LL:1,LL_EXACT_AMBIG_DETECTION:2,hasSLLConflictTerminatingPrediction:function(e,t){if(Zt.allConfigsInRuleStopStates(t))return!0;if(e===Zt.SLL&&t.hasSemanticContext){const e=new Vt;for(let r=0;r<t.items.length;r++){let n=t.items[r];n=new m({semanticContext:g.NONE},n),e.add(n)}t=e}const r=Zt.getConflictingAltSubsets(t);return Zt.hasConflictingAltSet(r)&&!Zt.hasStateAssociatedWithOneAlt(t)},hasConfigInRuleStopState:function(e){for(let t=0;t<e.items.length;t++)if(e.items[t].state instanceof A)return!0;return!1},allConfigsInRuleStopStates:function(e){for(let t=0;t<e.items.length;t++)if(!(e.items[t].state instanceof A))return!1;return!0},resolvesToJustOneViableAlt:function(e){return Zt.getSingleViableAlt(e)},allSubsetsConflict:function(e){return!Zt.hasNonConflictingAltSet(e)},hasNonConflictingAltSet:function(e){for(let t=0;t<e.length;t++)if(1===e[t].length)return!0;return!1},hasConflictingAltSet:function(e){for(let t=0;t<e.length;t++)if(e[t].length>1)return!0;return!1},allSubsetsEqual:function(e){let t=null;for(let r=0;r<e.length;r++){const n=e[r];if(null===t)t=n;else if(n!==t)return!1}return!0},getUniqueAlt:function(e){const t=Zt.getAlts(e);return 1===t.length?t.minValue():j.INVALID_ALT_NUMBER},getAlts:function(e){const t=new G;return e.map(function(e){t.or(e)}),t},getConflictingAltSubsets:function(e){const t=new Y;return t.hashFunction=function(e){l.hashStuff(e.state.stateNumber,e.context)},t.equalsFunction=function(e,t){return e.state.stateNumber===t.state.stateNumber&&e.context.equals(t.context)},e.items.map(function(e){let r=t.get(e);null===r&&(r=new G,t.set(e,r)),r.set(e.alt)}),t.getValues()},getStateToAltMap:function(e){const t=new Qt;return e.items.map(function(e){let r=t.get(e.state);null===r&&(r=new G,t.set(e.state,r)),r.set(e.alt)}),t},hasStateAssociatedWithOneAlt:function(e){const t=Zt.getStateToAltMap(e).values();for(let e=0;e<t.length;e++)if(1===t[e].length)return!0;return!1},getSingleViableAlt:function(e){let t=null;for(let r=0;r<e.length;r++){const n=e[r].minValue();if(null===t)t=n;else if(t!==n)return j.INVALID_ALT_NUMBER}return t}},te=Zt;class ee extends Dt{constructor(e,t,r,n,i,s){s=s||e._ctx,n=n||e.getCurrentToken(),r=r||e.getCurrentToken(),t=t||e.getInputStream(),super({message:"",recognizer:e,input:t,ctx:s}),this.deadEndConfigs=i,this.startToken=r,this.offendingToken=n}}class se{constructor(e){this.defaultMapCtor=e||Y,this.cacheMap=new this.defaultMapCtor}get(e,t){const r=this.cacheMap.get(e)||null;return null===r?null:r.get(t)||null}set(e,t,r){let n=this.cacheMap.get(e)||null;null===n&&(n=new this.defaultMapCtor,this.cacheMap.set(e,n)),n.set(t,r)}}class ne extends Yt{constructor(e,t,r,n){super(t,n),this.parser=e,this.decisionToDFA=r,this.predictionMode=te.LL,this._input=null,this._startIndex=0,this._outerContext=null,this._dfa=null,this.mergeCache=null,this.debug=!1,this.debug_closure=!1,this.debug_add=!1,this.trace_atn_sim=!1,this.dfa_debug=!1,this.retry_debug=!1}reset(){}adaptivePredict(e,t,r){(this.debug||this.trace_atn_sim)&&console.log("adaptivePredict decision "+t+" exec LA(1)=="+this.getLookaheadName(e)+" line "+e.LT(1).line+":"+e.LT(1).column),this._input=e,this._startIndex=e.index,this._outerContext=r;const n=this.decisionToDFA[t];this._dfa=n;const i=e.mark(),s=e.index;try{let t;if(t=n.precedenceDfa?n.getPrecedenceStartState(this.parser.getPrecedence()):n.s0,null===t){null===r&&(r=U.EMPTY),this.debug&&console.log("predictATN decision "+n.decision+" exec LA(1)=="+this.getLookaheadName(e)+", outerContext="+r.toString(this.parser.ruleNames));const i=!1;let s=this.computeStartState(n.atnStartState,U.EMPTY,i);n.precedenceDfa?(n.s0.configs=s,s=this.applyPrecedenceFilter(s),t=this.addDFAState(n,new zt(null,s)),n.setPrecedenceStartState(this.parser.getPrecedence(),t)):(t=this.addDFAState(n,new zt(null,s)),n.s0=t)}const i=this.execATN(n,t,e,s,r);return this.debug&&console.log("DFA after predictATN: "+n.toString(this.parser.literalNames,this.parser.symbolicNames)),i}finally{this._dfa=null,this.mergeCache=null,e.seek(s),e.release(i)}}execATN(e,t,r,n,s){let a;(this.debug||this.trace_atn_sim)&&console.log("execATN decision "+e.decision+", DFA state "+t+", LA(1)=="+this.getLookaheadName(r)+" line "+r.LT(1).line+":"+r.LT(1).column);let o=t;this.debug&&console.log("s0 = "+t);let l=r.LA(1);for(;;){let t=this.getExistingTargetState(o,l);if(null===t&&(t=this.computeTargetState(e,o,l)),t===Yt.ERROR){const e=this.noViableAlt(r,s,o.configs,n);if(r.seek(n),a=this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(o.configs,s),a!==j.INVALID_ALT_NUMBER)return a;throw e}if(t.requiresFullContext&&this.predictionMode!==te.SLL){let i=null;if(null!==t.predicates){this.debug&&console.log("DFA state has preds in DFA sim LL failover");const e=r.index;if(e!==n&&r.seek(n),i=this.evalSemanticContext(t.predicates,s,!0),1===i.length)return this.debug&&console.log("Full LL avoided"),i.minValue();e!==n&&r.seek(e)}this.dfa_debug&&console.log("ctx sensitive state "+s+" in "+t);const o=!0,l=this.computeStartState(e.atnStartState,s,o);return this.reportAttemptingFullContext(e,i,t.configs,n,r.index),a=this.execATNWithFullContext(e,t,l,r,n,s),a}if(t.isAcceptState){if(null===t.predicates)return t.prediction;const i=r.index;r.seek(n);const a=this.evalSemanticContext(t.predicates,s,!0);if(0===a.length)throw this.noViableAlt(r,s,t.configs,n);return 1===a.length||this.reportAmbiguity(e,t,n,i,!1,a,t.configs),a.minValue()}o=t,l!==i.EOF&&(r.consume(),l=r.LA(1))}}getExistingTargetState(e,t){const r=e.edges;return null===r?null:r[t+1]||null}computeTargetState(e,t,r){const n=this.computeReachSet(t.configs,r,!1);if(null===n)return this.addDFAEdge(e,t,r,Yt.ERROR),Yt.ERROR;let i=new zt(null,n);const s=this.getUniqueAlt(n);if(this.debug){const e=te.getConflictingAltSubsets(n);console.log("SLL altSubSets="+d(e)+", configs="+n+", predict="+s+", allSubsetsConflict="+te.allSubsetsConflict(e)+", conflictingAlts="+this.getConflictingAlts(n))}return s!==j.INVALID_ALT_NUMBER?(i.isAcceptState=!0,i.configs.uniqueAlt=s,i.prediction=s):te.hasSLLConflictTerminatingPrediction(this.predictionMode,n)&&(i.configs.conflictingAlts=this.getConflictingAlts(n),i.requiresFullContext=!0,i.isAcceptState=!0,i.prediction=i.configs.conflictingAlts.minValue()),i.isAcceptState&&i.configs.hasSemanticContext&&(this.predicateDFAState(i,this.atn.getDecisionState(e.decision)),null!==i.predicates&&(i.prediction=j.INVALID_ALT_NUMBER)),i=this.addDFAEdge(e,t,r,i),i}predicateDFAState(e,t){const r=t.transitions.length,n=this.getConflictingAltsOrUniqueAlt(e.configs),i=this.getPredsForAmbigAlts(n,e.configs,r);null!==i?(e.predicates=this.getPredicatePredictions(n,i),e.prediction=j.INVALID_ALT_NUMBER):e.prediction=n.minValue()}execATNWithFullContext(e,t,r,n,s,a){(this.debug||this.trace_atn_sim)&&console.log("execATNWithFullContext "+r);let o,l=!1,c=r;n.seek(s);let u=n.LA(1),h=-1;for(;;){if(o=this.computeReachSet(c,u,!0),null===o){const e=this.noViableAlt(n,a,c,s);n.seek(s);const t=this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(c,a);if(t!==j.INVALID_ALT_NUMBER)return t;throw e}const e=te.getConflictingAltSubsets(o);if(this.debug&&console.log("LL altSubSets="+e+", predict="+te.getUniqueAlt(e)+", resolvesToJustOneViableAlt="+te.resolvesToJustOneViableAlt(e)),o.uniqueAlt=this.getUniqueAlt(o),o.uniqueAlt!==j.INVALID_ALT_NUMBER){h=o.uniqueAlt;break}if(this.predictionMode!==te.LL_EXACT_AMBIG_DETECTION){if(h=te.resolvesToJustOneViableAlt(e),h!==j.INVALID_ALT_NUMBER)break}else if(te.allSubsetsConflict(e)&&te.allSubsetsEqual(e)){l=!0,h=te.getSingleViableAlt(e);break}c=o,u!==i.EOF&&(n.consume(),u=n.LA(1))}return o.uniqueAlt!==j.INVALID_ALT_NUMBER?(this.reportContextSensitivity(e,h,o,s,n.index),h):(this.reportAmbiguity(e,t,s,n.index,l,null,o),h)}computeReachSet(e,t,r){this.debug&&console.log("in computeReachSet, starting closure: "+e),null===this.mergeCache&&(this.mergeCache=new se);const n=new Vt(r);let s=null;for(let a=0;a<e.items.length;a++){const o=e.items[a];if(this.debug&&console.log("testing "+this.getTokenName(t)+" at "+o),o.state instanceof A)(r||t===i.EOF)&&(null===s&&(s=[]),s.push(o),this.debug_add&&console.log("added "+o+" to skippedStopStates"));else for(let e=0;e<o.state.transitions.length;e++){const r=o.state.transitions[e],i=this.getReachableTarget(r,t);if(null!==i){const e=new m({state:i},o);n.add(e,this.mergeCache),this.debug_add&&console.log("added "+e+" to intermediate")}}}let a=null;if(null===s&&t!==i.EOF&&(1===n.items.length||this.getUniqueAlt(n)!==j.INVALID_ALT_NUMBER)&&(a=n),null===a){a=new Vt(r);const e=new p,s=t===i.EOF;for(let t=0;t<n.items.length;t++)this.closure(n.items[t],a,e,!1,r,s)}if(t===i.EOF&&(a=this.removeAllConfigsNotInRuleStopState(a,a===n)),!(null===s||r&&te.hasConfigInRuleStopState(a)))for(let e=0;e<s.length;e++)a.add(s[e],this.mergeCache);return this.trace_atn_sim&&console.log("computeReachSet "+e+" -> "+a),0===a.items.length?null:a}removeAllConfigsNotInRuleStopState(e,t){if(te.allConfigsInRuleStopStates(e))return e;const r=new Vt(e.fullCtx);for(let n=0;n<e.items.length;n++){const s=e.items[n];if(s.state instanceof A)r.add(s,this.mergeCache);else if(t&&s.state.epsilonOnlyTransitions&&this.atn.nextTokens(s.state).contains(i.EPSILON)){const e=this.atn.ruleToStopState[s.state.ruleIndex];r.add(new m({state:e},s),this.mergeCache)}}return r}computeStartState(e,t,r){const n=q(this.atn,t),i=new Vt(r);this.trace_atn_sim&&console.log("computeStartState from ATN state "+e+" initialContext="+n.toString(this.parser));for(let t=0;t<e.transitions.length;t++){const s=e.transitions[t].target,a=new m({state:s,alt:t+1,context:n},null),o=new p;this.closure(a,i,o,!0,r,!1)}return i}applyPrecedenceFilter(e){let t;const r=[],n=new Vt(e.fullCtx);for(let i=0;i<e.items.length;i++){if(t=e.items[i],1!==t.alt)continue;const s=t.semanticContext.evalPrecedence(this.parser,this._outerContext);null!==s&&(r[t.state.stateNumber]=t.context,s!==t.semanticContext?n.add(new m({semanticContext:s},t),this.mergeCache):n.add(t,this.mergeCache))}for(let i=0;i<e.items.length;i++)if(t=e.items[i],1!==t.alt){if(!t.precedenceFilterSuppressed){const e=r[t.state.stateNumber]||null;if(null!==e&&e.equals(t.context))continue}n.add(t,this.mergeCache)}return n}getReachableTarget(e,t){return e.matches(t,0,this.atn.maxTokenType)?e.target:null}getPredsForAmbigAlts(e,t,r){let n=[];for(let r=0;r<t.items.length;r++){const i=t.items[r];e.get(i.alt)&&(n[i.alt]=g.orContext(n[i.alt]||null,i.semanticContext))}let i=0;for(let e=1;e<r+1;e++){const t=n[e]||null;null===t?n[e]=g.NONE:t!==g.NONE&&(i+=1)}return 0===i&&(n=null),this.debug&&console.log("getPredsForAmbigAlts result "+d(n)),n}getPredicatePredictions(e,t){const r=[];let n=!1;for(let i=1;i<t.length;i++){const s=t[i];null!==e&&e.get(i)&&r.push(new Jt(s,i)),s!==g.NONE&&(n=!0)}return n?r:null}getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(e,t){const r=this.splitAccordingToSemanticValidity(e,t),n=r[0],i=r[1];let s=this.getAltThatFinishedDecisionEntryRule(n);return s!==j.INVALID_ALT_NUMBER||i.items.length>0&&(s=this.getAltThatFinishedDecisionEntryRule(i),s!==j.INVALID_ALT_NUMBER)?s:j.INVALID_ALT_NUMBER}getAltThatFinishedDecisionEntryRule(e){const t=[];for(let r=0;r<e.items.length;r++){const n=e.items[r];(n.reachesIntoOuterContext>0||n.state instanceof A&&n.context.hasEmptyPath())&&t.indexOf(n.alt)<0&&t.push(n.alt)}return 0===t.length?j.INVALID_ALT_NUMBER:Math.min.apply(null,t)}splitAccordingToSemanticValidity(e,t){const r=new Vt(e.fullCtx),n=new Vt(e.fullCtx);for(let i=0;i<e.items.length;i++){const s=e.items[i];s.semanticContext!==g.NONE?s.semanticContext.evaluate(this.parser,t)?r.add(s):n.add(s):r.add(s)}return[r,n]}evalSemanticContext(e,t,r){const n=new G;for(let i=0;i<e.length;i++){const s=e[i];if(s.pred===g.NONE){if(n.set(s.alt),!r)break;continue}const a=s.pred.evaluate(this.parser,t);if((this.debug||this.dfa_debug)&&console.log("eval pred "+s+"="+a),a&&((this.debug||this.dfa_debug)&&console.log("PREDICT "+s.alt),n.set(s.alt),!r))break}return n}closure(e,t,r,n,i,s){this.closureCheckingStopState(e,t,r,n,i,0,s)}closureCheckingStopState(e,t,r,n,i,s,a){if((this.trace_atn_sim||this.debug_closure)&&console.log("closure("+e.toString(this.parser,!0)+")"),e.state instanceof A){if(!e.context.isEmpty()){for(let o=0;o<e.context.length;o++){if(e.context.getReturnState(o)===H.EMPTY_RETURN_STATE){if(i){t.add(new m({state:e.state,context:H.EMPTY},e),this.mergeCache);continue}this.debug&&console.log("FALLING off rule "+this.getRuleName(e.state.ruleIndex)),this.closure_(e,t,r,n,i,s,a);continue}const l=this.atn.states[e.context.getReturnState(o)],c=e.context.getParent(o),u={state:l,alt:e.alt,context:c,semanticContext:e.semanticContext},h=new m(u,null);h.reachesIntoOuterContext=e.reachesIntoOuterContext,this.closureCheckingStopState(h,t,r,n,i,s-1,a)}return}if(i)return void t.add(e,this.mergeCache);this.debug&&console.log("FALLING off rule "+this.getRuleName(e.state.ruleIndex))}this.closure_(e,t,r,n,i,s,a)}closure_(e,t,r,n,i,s,a){const o=e.state;o.epsilonOnlyTransitions||t.add(e,this.mergeCache);for(let l=0;l<o.transitions.length;l++){if(0===l&&this.canDropLoopEntryEdgeInLeftRecursiveRule(e))continue;const c=o.transitions[l],u=n&&!(c instanceof ut),h=this.getEpsilonTarget(e,c,u,0===s,i,a);if(null!==h){let n=s;if(e.state instanceof A){if(null!==this._dfa&&this._dfa.precedenceDfa&&c.outermostPrecedenceReturn===this._dfa.atnStartState.ruleIndex&&(h.precedenceFilterSuppressed=!0),h.reachesIntoOuterContext+=1,r.getOrAdd(h)!==h)continue;t.dipsIntoOuterContext=!0,n-=1,this.debug&&console.log("dips into outer ctx: "+h)}else{if(!c.isEpsilon&&r.getOrAdd(h)!==h)continue;c instanceof y&&n>=0&&(n+=1)}this.closureCheckingStopState(h,t,r,u,i,n,a)}}}canDropLoopEntryEdgeInLeftRecursiveRule(e){const t=e.state;if(t.stateType!==C.STAR_LOOP_ENTRY)return!1;if(t.stateType!==C.STAR_LOOP_ENTRY||!t.isPrecedenceDecision||e.context.isEmpty()||e.context.hasEmptyPath())return!1;const r=e.context.length;for(let n=0;n<r;n++)if(this.atn.states[e.context.getReturnState(n)].ruleIndex!==t.ruleIndex)return!1;const n=t.transitions[0].target.endState.stateNumber,i=this.atn.states[n];for(let n=0;n<r;n++){const r=e.context.getReturnState(n),s=this.atn.states[r];if(1!==s.transitions.length||!s.transitions[0].isEpsilon)return!1;const a=s.transitions[0].target;if(!(s.stateType===C.BLOCK_END&&a===t||s===i||a===i||a.stateType===C.BLOCK_END&&1===a.transitions.length&&a.transitions[0].isEpsilon&&a.transitions[0].target===t))return!1}return!0}getRuleName(e){return null!==this.parser&&e>=0?this.parser.ruleNames[e]:"<rule "+e+">"}getEpsilonTarget(e,t,r,n,s,a){switch(t.serializationType){case N.RULE:return this.ruleTransition(e,t);case N.PRECEDENCE:return this.precedenceTransition(e,t,r,n,s);case N.PREDICATE:return this.predTransition(e,t,r,n,s);case N.ACTION:return this.actionTransition(e,t);case N.EPSILON:return new m({state:t.target},e);case N.ATOM:case N.RANGE:case N.SET:return a&&t.matches(i.EOF,0,1)?new m({state:t.target},e):null;default:return null}}actionTransition(e,t){if(this.debug){const e=-1===t.actionIndex?65535:t.actionIndex;console.log("ACTION edge "+t.ruleIndex+":"+e)}return new m({state:t.target},e)}precedenceTransition(e,t,r,n,i){this.debug&&(console.log("PRED (collectPredicates="+r+") "+t.precedence+">=_p, ctx dependent=true"),null!==this.parser&&console.log("context surrounding pred is "+d(this.parser.getRuleInvocationStack())));let s=null;if(r&&n)if(i){const r=this._input.index;this._input.seek(this._startIndex);const n=t.getPredicate().evaluate(this.parser,this._outerContext);this._input.seek(r),n&&(s=new m({state:t.target},e))}else{const r=g.andContext(e.semanticContext,t.getPredicate());s=new m({state:t.target,semanticContext:r},e)}else s=new m({state:t.target},e);return this.debug&&console.log("config from pred transition="+s),s}predTransition(e,t,r,n,i){this.debug&&(console.log("PRED (collectPredicates="+r+") "+t.ruleIndex+":"+t.predIndex+", ctx dependent="+t.isCtxDependent),null!==this.parser&&console.log("context surrounding pred is "+d(this.parser.getRuleInvocationStack())));let s=null;if(r&&(t.isCtxDependent&&n||!t.isCtxDependent))if(i){const r=this._input.index;this._input.seek(this._startIndex);const n=t.getPredicate().evaluate(this.parser,this._outerContext);this._input.seek(r),n&&(s=new m({state:t.target},e))}else{const r=g.andContext(e.semanticContext,t.getPredicate());s=new m({state:t.target,semanticContext:r},e)}else s=new m({state:t.target},e);return this.debug&&console.log("config from pred transition="+s),s}ruleTransition(e,t){this.debug&&console.log("CALL rule "+this.getRuleName(t.target.ruleIndex)+", ctx="+e.context);const r=t.followState,n=V.create(e.context,r.stateNumber);return new m({state:t.target,context:n},e)}getConflictingAlts(e){const t=te.getConflictingAltSubsets(e);return te.getAlts(t)}getConflictingAltsOrUniqueAlt(e){let t=null;return e.uniqueAlt!==j.INVALID_ALT_NUMBER?(t=new G,t.set(e.uniqueAlt)):t=e.conflictingAlts,t}getTokenName(e){if(e===i.EOF)return"EOF";if(null!==this.parser&&null!==this.parser.literalNames){if(!(e>=this.parser.literalNames.length&&e>=this.parser.symbolicNames.length))return(this.parser.literalNames[e]||this.parser.symbolicNames[e])+"<"+e+">";console.log(e+" ttype out of range: "+this.parser.literalNames),console.log(""+this.parser.getInputStream().getTokens())}return""+e}getLookaheadName(e){return this.getTokenName(e.LA(1))}dumpDeadEndConfigs(e){console.log("dead end configs: ");const t=e.getDeadEndConfigs();for(let e=0;e<t.length;e++){const r=t[e];let n="no edges";if(r.state.transitions.length>0){const e=r.state.transitions[0];e instanceof ht?n="Atom "+this.getTokenName(e.label):e instanceof L&&(n=(e instanceof I?"~":"")+"Set "+e.set)}console.error(r.toString(this.parser,!0)+":"+n)}}noViableAlt(e,t,r,n){return new ee(this.parser,e,e.get(n),e.LT(1),r,t)}getUniqueAlt(e){let t=j.INVALID_ALT_NUMBER;for(let r=0;r<e.items.length;r++){const n=e.items[r];if(t===j.INVALID_ALT_NUMBER)t=n.alt;else if(n.alt!==t)return j.INVALID_ALT_NUMBER}return t}addDFAEdge(e,t,r,n){if(this.debug&&console.log("EDGE "+t+" -> "+n+" upon "+this.getTokenName(r)),null===n)return null;if(n=this.addDFAState(e,n),null===t||r<-1||r>this.atn.maxTokenType)return n;if(null===t.edges&&(t.edges=[]),t.edges[r+1]=n,this.debug){const t=null===this.parser?null:this.parser.literalNames,r=null===this.parser?null:this.parser.symbolicNames;console.log("DFA=\n"+e.toString(t,r))}return n}addDFAState(e,t){if(t===Yt.ERROR)return t;const r=e.states.get(t);return null!==r?(this.trace_atn_sim&&console.log("addDFAState "+t+" exists"),r):(t.stateNumber=e.states.length,t.configs.readOnly||(t.configs.optimizeConfigs(this),t.configs.setReadonly(!0)),this.trace_atn_sim&&console.log("addDFAState new "+t),e.states.add(t),this.debug&&console.log("adding new DFA state: "+t),t)}reportAttemptingFullContext(e,t,r,n,i){if(this.debug||this.retry_debug){const t=new E(n,i+1);console.log("reportAttemptingFullContext decision="+e.decision+":"+r+", input="+this.parser.getTokenStream().getText(t))}null!==this.parser&&this.parser.getErrorListener().reportAttemptingFullContext(this.parser,e,n,i,t,r)}reportContextSensitivity(e,t,r,n,i){if(this.debug||this.retry_debug){const t=new E(n,i+1);console.log("reportContextSensitivity decision="+e.decision+":"+r+", input="+this.parser.getTokenStream().getText(t))}null!==this.parser&&this.parser.getErrorListener().reportContextSensitivity(this.parser,e,n,i,t,r)}reportAmbiguity(e,t,r,n,i,s,a){if(this.debug||this.retry_debug){const e=new E(r,n+1);console.log("reportAmbiguity "+s+":"+a+", input="+this.parser.getTokenStream().getText(e))}null!==this.parser&&this.parser.getErrorListener().reportAmbiguity(this.parser,e,r,n,i,s,a)}}class ie{constructor(){this.cache=new Y}add(e){if(e===H.EMPTY)return H.EMPTY;const t=this.cache.get(e)||null;return null!==t?t:(this.cache.set(e,e),e)}get(e){return this.cache.get(e)||null}get length(){return this.cache.length}}const re={ATN:j,ATNDeserializer:kt,LexerATNSimulator:Xt,ParserATNSimulator:ne,PredictionMode:te,PredictionContextCache:ie};class oe{constructor(e,t,r){this.dfa=e,this.literalNames=t||[],this.symbolicNames=r||[]}toString(){if(null===this.dfa.s0)return null;let e="";const t=this.dfa.sortedStates();for(let r=0;r<t.length;r++){const n=t[r];if(null!==n.edges){const t=n.edges.length;for(let r=0;r<t;r++){const t=n.edges[r]||null;null!==t&&2147483647!==t.stateNumber&&(e=e.concat(this.getStateString(n)),e=e.concat("-"),e=e.concat(this.getEdgeLabel(r)),e=e.concat("->"),e=e.concat(this.getStateString(t)),e=e.concat("\n"))}}}return 0===e.length?null:e}getEdgeLabel(e){return 0===e?"EOF":null!==this.literalNames||null!==this.symbolicNames?this.literalNames[e-1]||this.symbolicNames[e-1]:String.fromCharCode(e-1)}getStateString(e){const t=(e.isAcceptState?":":"")+"s"+e.stateNumber+(e.requiresFullContext?"^":"");return e.isAcceptState?null!==e.predicates?t+"=>"+d(e.predicates):t+"=>"+e.prediction.toString():t}}class ae extends oe{constructor(e){super(e,null)}getEdgeLabel(e){return"'"+String.fromCharCode(e)+"'"}}class le{constructor(e,t){if(void 0===t&&(t=0),this.atnStartState=e,this.decision=t,this._states=new p,this.s0=null,this.precedenceDfa=!1,e instanceof rt&&e.isPrecedenceDecision){this.precedenceDfa=!0;const e=new zt(null,new Vt);e.edges=[],e.isAcceptState=!1,e.requiresFullContext=!1,this.s0=e}}getPrecedenceStartState(e){if(!this.precedenceDfa)throw"Only precedence DFAs may contain a precedence start state.";return e<0||e>=this.s0.edges.length?null:this.s0.edges[e]||null}setPrecedenceStartState(e,t){if(!this.precedenceDfa)throw"Only precedence DFAs may contain a precedence start state.";e<0||(this.s0.edges[e]=t)}setPrecedenceDfa(e){if(this.precedenceDfa!==e){if(this._states=new p,e){const e=new zt(null,new Vt);e.edges=[],e.isAcceptState=!1,e.requiresFullContext=!1,this.s0=e}else this.s0=null;this.precedenceDfa=e}}sortedStates(){return this._states.values().sort(function(e,t){return e.stateNumber-t.stateNumber})}toString(e,t){return e=e||null,t=t||null,null===this.s0?"":new oe(this,e,t).toString()}toLexerString(){return null===this.s0?"":new ae(this).toString()}get states(){return this._states}}const he={DFA:le,DFASerializer:oe,LexerDFASerializer:ae,PredPrediction:Jt},ce={PredictionContext:H},ue={Interval:E,IntervalSet:S};class de{visitTerminal(e){}visitErrorNode(e){}enterEveryRule(e){}exitEveryRule(e){}}class pe{visit(e){return Array.isArray(e)?e.map(function(e){return e.accept(this)},this):e.accept(this)}visitChildren(e){return e.children?this.visit(e.children):null}visitTerminal(e){}visitErrorNode(e){}}class ge{walk(e,t){if(t instanceof F||void 0!==t.isErrorNode&&t.isErrorNode())e.visitErrorNode(t);else if(t instanceof b)e.visitTerminal(t);else{this.enterRule(e,t);for(let r=0;r<t.getChildCount();r++){const n=t.getChild(r);this.walk(e,n)}this.exitRule(e,t)}}enterRule(e,t){const r=t.ruleContext;e.enterEveryRule(r),r.enterRule(e)}exitRule(e,t){const r=t.ruleContext;r.exitRule(e),e.exitEveryRule(r)}}ge.DEFAULT=new ge;const fe={Trees:M,RuleNode:P,ErrorNode:F,TerminalNode:b,ParseTreeListener:de,ParseTreeVisitor:pe,ParseTreeWalker:ge};class xe extends Dt{constructor(e){super({message:"",recognizer:e,input:e.getInputStream(),ctx:e._ctx}),this.offendingToken=e.getCurrentToken()}}class _e extends Dt{constructor(e,t,r){super({message:Te(t,r||null),recognizer:e,input:e.getInputStream(),ctx:e._ctx});const n=e._interp.atn.states[e.state].transitions[0];n instanceof gt?(this.ruleIndex=n.ruleIndex,this.predicateIndex=n.predIndex):(this.ruleIndex=0,this.predicateIndex=0),this.predicate=t,this.offendingToken=e.getCurrentToken()}}function Te(e,t){return null!==t?t:"failed predicate: {"+e+"}?"}class me extends vt{constructor(e){super(),e=e||!0,this.exactOnly=e}reportAmbiguity(e,t,r,n,i,s,a){if(this.exactOnly&&!i)return;const o="reportAmbiguity d="+this.getDecisionDescription(e,t)+": ambigAlts="+this.getConflictingAlts(s,a)+", input='"+e.getTokenStream().getText(new E(r,n))+"'";e.notifyErrorListeners(o)}reportAttemptingFullContext(e,t,r,n,i,s){const a="reportAttemptingFullContext d="+this.getDecisionDescription(e,t)+", input='"+e.getTokenStream().getText(new E(r,n))+"'";e.notifyErrorListeners(a)}reportContextSensitivity(e,t,r,n,i,s){const a="reportContextSensitivity d="+this.getDecisionDescription(e,t)+", input='"+e.getTokenStream().getText(new E(r,n))+"'";e.notifyErrorListeners(a)}getDecisionDescription(e,t){const r=t.decision,n=t.atnStartState.ruleIndex,i=e.ruleNames;if(n<0||n>=i.length)return""+r;const s=i[n]||null;return null===s||0===s.length?""+r:`${r} (${s})`}getConflictingAlts(e,t){if(null!==e)return e;const r=new G;for(let e=0;e<t.items.length;e++)r.set(t.items[e].alt);return`{${r.values().join(", ")}}`}}class Ee extends Error{constructor(){super(),Error.captureStackTrace(this,Ee)}}class Se{reset(e){}recoverInline(e){}recover(e,t){}sync(e){}inErrorRecoveryMode(e){}reportError(e){}}class Ce extends Se{constructor(){super(),this.errorRecoveryMode=!1,this.lastErrorIndex=-1,this.lastErrorStates=null,this.nextTokensContext=null,this.nextTokenState=0}reset(e){this.endErrorCondition(e)}beginErrorCondition(e){this.errorRecoveryMode=!0}inErrorRecoveryMode(e){return this.errorRecoveryMode}endErrorCondition(e){this.errorRecoveryMode=!1,this.lastErrorStates=null,this.lastErrorIndex=-1}reportMatch(e){this.endErrorCondition(e)}reportError(e,t){this.inErrorRecoveryMode(e)||(this.beginErrorCondition(e),t instanceof ee?this.reportNoViableAlternative(e,t):t instanceof xe?this.reportInputMismatch(e,t):t instanceof _e?this.reportFailedPredicate(e,t):(console.log("unknown recognition error type: "+t.constructor.name),console.log(t.stack),e.notifyErrorListeners(t.getOffendingToken(),t.getMessage(),t)))}recover(e,t){this.lastErrorIndex===e.getInputStream().index&&null!==this.lastErrorStates&&this.lastErrorStates.indexOf(e.state)>=0&&e.consume(),this.lastErrorIndex=e._input.index,null===this.lastErrorStates&&(this.lastErrorStates=[]),this.lastErrorStates.push(e.state);const r=this.getErrorRecoverySet(e);this.consumeUntil(e,r)}sync(e){if(this.inErrorRecoveryMode(e))return;const t=e._interp.atn.states[e.state],r=e.getTokenStream().LA(1),n=e.atn.nextTokens(t);if(n.contains(r))return this.nextTokensContext=null,void(this.nextTokenState=C.INVALID_STATE_NUMBER);if(n.contains(i.EPSILON))null===this.nextTokensContext&&(this.nextTokensContext=e._ctx,this.nextTokensState=e._stateNumber);else switch(t.stateType){case C.BLOCK_START:case C.STAR_BLOCK_START:case C.PLUS_BLOCK_START:case C.STAR_LOOP_ENTRY:if(null!==this.singleTokenDeletion(e))return;throw new xe(e);case C.PLUS_LOOP_BACK:case C.STAR_LOOP_BACK:{this.reportUnwantedToken(e);const t=new S;t.addSet(e.getExpectedTokens());const r=t.addSet(this.getErrorRecoverySet(e));this.consumeUntil(e,r)}}}reportNoViableAlternative(e,t){const r=e.getTokenStream();let n;n=null!==r?t.startToken.type===i.EOF?"<EOF>":r.getText(new E(t.startToken.tokenIndex,t.offendingToken.tokenIndex)):"<unknown input>";const s="no viable alternative at input "+this.escapeWSAndQuote(n);e.notifyErrorListeners(s,t.offendingToken,t)}reportInputMismatch(e,t){const r="mismatched input "+this.getTokenErrorDisplay(t.offendingToken)+" expecting "+t.getExpectedTokens().toString(e.literalNames,e.symbolicNames);e.notifyErrorListeners(r,t.offendingToken,t)}reportFailedPredicate(e,t){const r="rule "+e.ruleNames[e._ctx.ruleIndex]+" "+t.message;e.notifyErrorListeners(r,t.offendingToken,t)}reportUnwantedToken(e){if(this.inErrorRecoveryMode(e))return;this.beginErrorCondition(e);const t=e.getCurrentToken(),r="extraneous input "+this.getTokenErrorDisplay(t)+" expecting "+this.getExpectedTokens(e).toString(e.literalNames,e.symbolicNames);e.notifyErrorListeners(r,t,null)}reportMissingToken(e){if(this.inErrorRecoveryMode(e))return;this.beginErrorCondition(e);const t=e.getCurrentToken(),r="missing "+this.getExpectedTokens(e).toString(e.literalNames,e.symbolicNames)+" at "+this.getTokenErrorDisplay(t);e.notifyErrorListeners(r,t,null)}recoverInline(e){const t=this.singleTokenDeletion(e);if(null!==t)return e.consume(),t;if(this.singleTokenInsertion(e))return this.getMissingSymbol(e);throw new xe(e)}singleTokenInsertion(e){const t=e.getTokenStream().LA(1),r=e._interp.atn,n=r.states[e.state].transitions[0].target;return!!r.nextTokens(n,e._ctx).contains(t)&&(this.reportMissingToken(e),!0)}singleTokenDeletion(e){const t=e.getTokenStream().LA(2);if(this.getExpectedTokens(e).contains(t)){this.reportUnwantedToken(e),e.consume();const t=e.getCurrentToken();return this.reportMatch(e),t}return null}getMissingSymbol(e){const t=e.getCurrentToken(),r=this.getExpectedTokens(e).first();let n;n=r===i.EOF?"<missing EOF>":"<missing "+e.literalNames[r]+">";let s=t;const a=e.getTokenStream().LT(-1);return s.type===i.EOF&&null!==a&&(s=a),e.getTokenFactory().create(s.source,r,n,i.DEFAULT_CHANNEL,-1,-1,s.line,s.column)}getExpectedTokens(e){return e.getExpectedTokens()}getTokenErrorDisplay(e){if(null===e)return"<no token>";let t=e.text;return null===t&&(t=e.type===i.EOF?"<EOF>":"<"+e.type+">"),this.escapeWSAndQuote(t)}escapeWSAndQuote(e){return"'"+(e=(e=(e=e.replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/\t/g,"\\t"))+"'"}getErrorRecoverySet(e){const t=e._interp.atn;let r=e._ctx;const n=new S;for(;null!==r&&r.invokingState>=0;){const e=t.states[r.invokingState].transitions[0],i=t.nextTokens(e.followState);n.addSet(i),r=r.parentCtx}return n.removeOne(i.EPSILON),n}consumeUntil(e,t){let r=e.getTokenStream().LA(1);for(;r!==i.EOF&&!t.contains(r);)e.consume(),r=e.getTokenStream().LA(1)}}class Ae extends Ce{constructor(){super()}recover(e,t){let r=e._ctx;for(;null!==r;)r.exception=t,r=r.parentCtx;throw new Ee(t)}recoverInline(e){this.recover(e,new xe(e))}sync(e){}}const Ne={RecognitionException:Dt,NoViableAltException:ee,LexerNoViableAltException:Mt,InputMismatchException:xe,FailedPredicateException:_e,DiagnosticErrorListener:me,BailErrorStrategy:Ae,DefaultErrorStrategy:Ce,ErrorListener:vt};class ye{constructor(e,t){if(this.name="<empty>",this.strdata=e,this.decodeToUnicodeCodePoints=t||!1,this._index=0,this.data=[],this.decodeToUnicodeCodePoints)for(let e=0;e<this.strdata.length;){const t=this.strdata.codePointAt(e);this.data.push(t),e+=t<=65535?1:2}else{this.data=new Array(this.strdata.length);for(let e=0;e<this.strdata.length;e++)this.data[e]=this.strdata.charCodeAt(e)}this._size=this.data.length}reset(){this._index=0}consume(){if(this._index>=this._size)throw"cannot consume EOF";this._index+=1}LA(e){if(0===e)return 0;e<0&&(e+=1);const t=this._index+e-1;return t<0||t>=this._size?i.EOF:this.data[t]}LT(e){return this.LA(e)}mark(){return-1}release(e){}seek(e){e<=this._index?this._index=e:this._index=Math.min(e,this._size)}getText(e,t){if(t>=this._size&&(t=this._size-1),e>=this._size)return"";if(this.decodeToUnicodeCodePoints){let r="";for(let n=e;n<=t;n++)r+=String.fromCodePoint(this.data[n]);return r}return this.strdata.slice(e,t+1)}toString(){return this.strdata}get index(){return this._index}get size(){return this._size}}class Le extends ye{constructor(e,t){super(e,t)}}var Ie=s(763);const ke="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node;class ve extends Le{static fromPath(e,t,r){if(!ke)throw new Error("FileStream is only available when running in Node!");Ie.readFile(e,t,function(e,t){let n=null;null!==t&&(n=new ye(t,!0)),r(e,n)})}constructor(e,t,r){if(!ke)throw new Error("FileStream is only available when running in Node!");super(Ie.readFileSync(e,t||"utf-8"),r),this.fileName=e}}const we={fromString:function(e){return new ye(e,!0)},fromBlob:function(e,t,r,n){const i=new window.FileReader;i.onload=function(e){const t=new ye(e.target.result,!0);r(t)},i.onerror=n,i.readAsText(e,t)},fromBuffer:function(e,t){return new ye(e.toString(t),!0)},fromPath:function(e,t,r){ve.fromPath(e,t,r)},fromPathSync:function(e,t){return new ve(e,t)}},Re={arrayToString:d,stringToCharArray:function(e){let t=new Uint16Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}};class Oe{}class Pe extends Oe{constructor(e){super(),this.tokenSource=e,this.tokens=[],this.index=-1,this.fetchedEOF=!1}mark(){return 0}release(e){}reset(){this.seek(0)}seek(e){this.lazyInit(),this.index=this.adjustSeekIndex(e)}get size(){return this.tokens.length}get(e){return this.lazyInit(),this.tokens[e]}consume(){let e=!1;if(e=this.index>=0&&(this.fetchedEOF?this.index<this.tokens.length-1:this.index<this.tokens.length),!e&&this.LA(1)===i.EOF)throw"cannot consume EOF";this.sync(this.index+1)&&(this.index=this.adjustSeekIndex(this.index+1))}sync(e){const t=e-this.tokens.length+1;return!(t>0)||this.fetch(t)>=t}fetch(e){if(this.fetchedEOF)return 0;for(let t=0;t<e;t++){const e=this.tokenSource.nextToken();if(e.tokenIndex=this.tokens.length,this.tokens.push(e),e.type===i.EOF)return this.fetchedEOF=!0,t+1}return e}getTokens(e,t,r){if(void 0===r&&(r=null),e<0||t<0)return null;this.lazyInit();const n=[];t>=this.tokens.length&&(t=this.tokens.length-1);for(let s=e;s<t;s++){const e=this.tokens[s];if(e.type===i.EOF)break;(null===r||r.contains(e.type))&&n.push(e)}return n}LA(e){return this.LT(e).type}LB(e){return this.index-e<0?null:this.tokens[this.index-e]}LT(e){if(this.lazyInit(),0===e)return null;if(e<0)return this.LB(-e);const t=this.index+e-1;return this.sync(t),t>=this.tokens.length?this.tokens[this.tokens.length-1]:this.tokens[t]}adjustSeekIndex(e){return e}lazyInit(){-1===this.index&&this.setup()}setup(){this.sync(0),this.index=this.adjustSeekIndex(0)}setTokenSource(e){this.tokenSource=e,this.tokens=[],this.index=-1,this.fetchedEOF=!1}nextTokenOnChannel(e,t){if(this.sync(e),e>=this.tokens.length)return-1;let r=this.tokens[e];for(;r.channel!==t;){if(r.type===i.EOF)return-1;e+=1,this.sync(e),r=this.tokens[e]}return e}previousTokenOnChannel(e,t){for(;e>=0&&this.tokens[e].channel!==t;)e-=1;return e}getHiddenTokensToRight(e,t){if(void 0===t&&(t=-1),this.lazyInit(),e<0||e>=this.tokens.length)throw e+" not in 0.."+this.tokens.length-1;const r=this.nextTokenOnChannel(e+1,Ut.DEFAULT_TOKEN_CHANNEL),n=e+1,i=-1===r?this.tokens.length-1:r;return this.filterForChannel(n,i,t)}getHiddenTokensToLeft(e,t){if(void 0===t&&(t=-1),this.lazyInit(),e<0||e>=this.tokens.length)throw e+" not in 0.."+this.tokens.length-1;const r=this.previousTokenOnChannel(e-1,Ut.DEFAULT_TOKEN_CHANNEL);if(r===e-1)return null;const n=r+1,i=e-1;return this.filterForChannel(n,i,t)}filterForChannel(e,t,r){const n=[];for(let i=e;i<t+1;i++){const e=this.tokens[i];-1===r?e.channel!==Ut.DEFAULT_TOKEN_CHANNEL&&n.push(e):e.channel===r&&n.push(e)}return 0===n.length?null:n}getSourceName(){return this.tokenSource.getSourceName()}getText(e){this.lazyInit(),this.fill(),e||(e=new E(0,this.tokens.length-1));let t=e.start;t instanceof i&&(t=t.tokenIndex);let r=e.stop;if(r instanceof i&&(r=r.tokenIndex),null===t||null===r||t<0||r<0)return"";r>=this.tokens.length&&(r=this.tokens.length-1);let n="";for(let e=t;e<r+1;e++){const t=this.tokens[e];if(t.type===i.EOF)break;n+=t.text}return n}fill(){for(this.lazyInit();1e3===this.fetch(1e3););}}Object.defineProperty(Pe,"size",{get:function(){return this.tokens.length}});class be extends Pe{constructor(e,t){super(e),this.channel=void 0===t?i.DEFAULT_CHANNEL:t}adjustSeekIndex(e){return this.nextTokenOnChannel(e,this.channel)}LB(e){if(0===e||this.index-e<0)return null;let t=this.index,r=1;for(;r<=e;)t=this.previousTokenOnChannel(t-1,this.channel),r+=1;return t<0?null:this.tokens[t]}LT(e){if(this.lazyInit(),0===e)return null;if(e<0)return this.LB(-e);let t=this.index,r=1;for(;r<e;)this.sync(t+1)&&(t=this.nextTokenOnChannel(t+1,this.channel)),r+=1;return this.tokens[t]}getNumberOfOnChannelTokens(){let e=0;this.fill();for(let t=0;t<this.tokens.length;t++){const r=this.tokens[t];if(r.channel===this.channel&&(e+=1),r.type===i.EOF)break}return e}}class Fe extends de{constructor(e){super(),this.parser=e}enterEveryRule(e){console.log("enter "+this.parser.ruleNames[e.ruleIndex]+", LT(1)="+this.parser._input.LT(1).text)}visitTerminal(e){console.log("consume "+e.symbol+" rule "+this.parser.ruleNames[this.parser._ctx.ruleIndex])}exitEveryRule(e){console.log("exit "+this.parser.ruleNames[e.ruleIndex]+", LT(1)="+this.parser._input.LT(1).text)}}class De extends Ot{constructor(e){super(),this._input=null,this._errHandler=new Ce,this._precedenceStack=[],this._precedenceStack.push(0),this._ctx=null,this.buildParseTrees=!0,this._tracer=null,this._parseListeners=null,this._syntaxErrors=0,this.setInputStream(e)}reset(){null!==this._input&&this._input.seek(0),this._errHandler.reset(this),this._ctx=null,this._syntaxErrors=0,this.setTrace(!1),this._precedenceStack=[],this._precedenceStack.push(0),null!==this._interp&&this._interp.reset()}match(e){let t=this.getCurrentToken();return t.type===e?(this._errHandler.reportMatch(this),this.consume()):(t=this._errHandler.recoverInline(this),this.buildParseTrees&&-1===t.tokenIndex&&this._ctx.addErrorNode(t)),t}matchWildcard(){let e=this.getCurrentToken();return e.type>0?(this._errHandler.reportMatch(this),this.consume()):(e=this._errHandler.recoverInline(this),this.buildParseTrees&&-1===e.tokenIndex&&this._ctx.addErrorNode(e)),e}getParseListeners(){return this._parseListeners||[]}addParseListener(e){if(null===e)throw"listener";null===this._parseListeners&&(this._parseListeners=[]),this._parseListeners.push(e)}removeParseListener(e){if(null!==this._parseListeners){const t=this._parseListeners.indexOf(e);t>=0&&this._parseListeners.splice(t,1),0===this._parseListeners.length&&(this._parseListeners=null)}}removeParseListeners(){this._parseListeners=null}triggerEnterRuleEvent(){if(null!==this._parseListeners){const e=this._ctx;this._parseListeners.forEach(function(t){t.enterEveryRule(e),e.enterRule(t)})}}triggerExitRuleEvent(){if(null!==this._parseListeners){const e=this._ctx;this._parseListeners.slice(0).reverse().forEach(function(t){e.exitRule(t),t.exitEveryRule(e)})}}getTokenFactory(){return this._input.tokenSource._factory}setTokenFactory(e){this._input.tokenSource._factory=e}getATNWithBypassAlts(){const e=this.getSerializedATN();if(null===e)throw"The current parser does not support an ATN with bypass alternatives.";let t=this.bypassAltsAtnCache[e];if(null===t){const r=new _t;r.generateRuleBypassTransitions=!0,t=new kt(r).deserialize(e),this.bypassAltsAtnCache[e]=t}return t}getInputStream(){return this.getTokenStream()}setInputStream(e){this.setTokenStream(e)}getTokenStream(){return this._input}setTokenStream(e){this._input=null,this.reset(),this._input=e}get syntaxErrorsCount(){return this._syntaxErrors}getCurrentToken(){return this._input.LT(1)}notifyErrorListeners(e,t,r){r=r||null,null===(t=t||null)&&(t=this.getCurrentToken()),this._syntaxErrors+=1;const n=t.line,i=t.column;this.getErrorListener().syntaxError(this,t,n,i,e,r)}consume(){const e=this.getCurrentToken();e.type!==i.EOF&&this.getInputStream().consume();const t=null!==this._parseListeners&&this._parseListeners.length>0;if(this.buildParseTrees||t){let r;r=this._errHandler.inErrorRecoveryMode(this)?this._ctx.addErrorNode(e):this._ctx.addTokenNode(e),r.invokingState=this.state,t&&this._parseListeners.forEach(function(e){r instanceof F||void 0!==r.isErrorNode&&r.isErrorNode()?e.visitErrorNode(r):r instanceof b&&e.visitTerminal(r)})}return e}addContextToParseTree(){null!==this._ctx.parentCtx&&this._ctx.parentCtx.addChild(this._ctx)}enterRule(e,t,r){this.state=t,this._ctx=e,this._ctx.start=this._input.LT(1),this.buildParseTrees&&this.addContextToParseTree(),this.triggerEnterRuleEvent()}exitRule(){this._ctx.stop=this._input.LT(-1),this.triggerExitRuleEvent(),this.state=this._ctx.invokingState,this._ctx=this._ctx.parentCtx}enterOuterAlt(e,t){e.setAltNumber(t),this.buildParseTrees&&this._ctx!==e&&null!==this._ctx.parentCtx&&(this._ctx.parentCtx.removeLastChild(),this._ctx.parentCtx.addChild(e)),this._ctx=e}getPrecedence(){return 0===this._precedenceStack.length?-1:this._precedenceStack[this._precedenceStack.length-1]}enterRecursionRule(e,t,r,n){this.state=t,this._precedenceStack.push(n),this._ctx=e,this._ctx.start=this._input.LT(1),this.triggerEnterRuleEvent()}pushNewRecursionContext(e,t,r){const n=this._ctx;n.parentCtx=e,n.invokingState=t,n.stop=this._input.LT(-1),this._ctx=e,this._ctx.start=n.start,this.buildParseTrees&&this._ctx.addChild(n),this.triggerEnterRuleEvent()}unrollRecursionContexts(e){this._precedenceStack.pop(),this._ctx.stop=this._input.LT(-1);const t=this._ctx,r=this.getParseListeners();if(null!==r&&r.length>0)for(;this._ctx!==e;)this.triggerExitRuleEvent(),this._ctx=this._ctx.parentCtx;else this._ctx=e;t.parentCtx=e,this.buildParseTrees&&null!==e&&e.addChild(t)}getInvokingContext(e){let t=this._ctx;for(;null!==t;){if(t.ruleIndex===e)return t;t=t.parentCtx}return null}precpred(e,t){return t>=this._precedenceStack[this._precedenceStack.length-1]}inContext(e){return!1}isExpectedToken(e){const t=this._interp.atn;let r=this._ctx;const n=t.states[this.state];let s=t.nextTokens(n);if(s.contains(e))return!0;if(!s.contains(i.EPSILON))return!1;for(;null!==r&&r.invokingState>=0&&s.contains(i.EPSILON);){const n=t.states[r.invokingState].transitions[0];if(s=t.nextTokens(n.followState),s.contains(e))return!0;r=r.parentCtx}return!(!s.contains(i.EPSILON)||e!==i.EOF)}getExpectedTokens(){return this._interp.atn.getExpectedTokens(this.state,this._ctx)}getExpectedTokensWithinCurrentRule(){const e=this._interp.atn,t=e.states[this.state];return e.nextTokens(t)}getRuleIndex(e){const t=this.getRuleIndexMap()[e];return null!==t?t:-1}getRuleInvocationStack(e){null===(e=e||null)&&(e=this._ctx);const t=[];for(;null!==e;){const r=e.ruleIndex;r<0?t.push("n/a"):t.push(this.ruleNames[r]),e=e.parentCtx}return t}getDFAStrings(){return this._interp.decisionToDFA.toString()}dumpDFA(){let e=!1;for(let t=0;t<this._interp.decisionToDFA.length;t++){const r=this._interp.decisionToDFA[t];r.states.length>0&&(e&&console.log(),this.printer.println("Decision "+r.decision+":"),this.printer.print(r.toString(this.literalNames,this.symbolicNames)),e=!0)}}getSourceName(){return this._input.getSourceName()}setTrace(e){e?(null!==this._tracer&&this.removeParseListener(this._tracer),this._tracer=new Fe(this),this.addParseListener(this._tracer)):(this.removeParseListener(this._tracer),this._tracer=null)}}De.bypassAltsAtnCache={};class Me extends b{constructor(e){super(),this.parentCtx=null,this.symbol=e}getChild(e){return null}getSymbol(){return this.symbol}getParent(){return this.parentCtx}getPayload(){return this.symbol}getSourceInterval(){if(null===this.symbol)return E.INVALID_INTERVAL;const e=this.symbol.tokenIndex;return new E(e,e)}getChildCount(){return 0}accept(e){return e.visitTerminal(this)}getText(){return this.symbol.text}toString(){return this.symbol.type===i.EOF?"<EOF>":this.symbol.text}}class Ue extends Me{constructor(e){super(e)}isErrorNode(){return!0}accept(e){return e.visitErrorNode(this)}}class He extends U{constructor(e,t){super(e,t),this.children=null,this.start=null,this.stop=null,this.exception=null}copyFrom(e){this.parentCtx=e.parentCtx,this.invokingState=e.invokingState,this.children=null,this.start=e.start,this.stop=e.stop,e.children&&(this.children=[],e.children.map(function(e){e instanceof Ue&&(this.children.push(e),e.parentCtx=this)},this))}enterRule(e){}exitRule(e){}addChild(e){return null===this.children&&(this.children=[]),this.children.push(e),e}removeLastChild(){null!==this.children&&this.children.pop()}addTokenNode(e){const t=new Me(e);return this.addChild(t),t.parentCtx=this,t}addErrorNode(e){const t=new Ue(e);return this.addChild(t),t.parentCtx=this,t}getChild(e,t){if(t=t||null,null===this.children||e<0||e>=this.children.length)return null;if(null===t)return this.children[e];for(let r=0;r<this.children.length;r++){const n=this.children[r];if(n instanceof t){if(0===e)return n;e-=1}}return null}getToken(e,t){if(null===this.children||t<0||t>=this.children.length)return null;for(let r=0;r<this.children.length;r++){const n=this.children[r];if(n instanceof b&&n.symbol.type===e){if(0===t)return n;t-=1}}return null}getTokens(e){if(null===this.children)return[];{const t=[];for(let r=0;r<this.children.length;r++){const n=this.children[r];n instanceof b&&n.symbol.type===e&&t.push(n)}return t}}getTypedRuleContext(e,t){return this.getChild(t,e)}getTypedRuleContexts(e){if(null===this.children)return[];{const t=[];for(let r=0;r<this.children.length;r++){const n=this.children[r];n instanceof e&&t.push(n)}return t}}getChildCount(){return null===this.children?0:this.children.length}getSourceInterval(){return null===this.start||null===this.stop?E.INVALID_INTERVAL:new E(this.start.tokenIndex,this.stop.tokenIndex)}}U.EMPTY=new He;class Be{static DEFAULT_PROGRAM_NAME="default";constructor(e){this.tokens=e,this.programs=new Map}getTokenStream(){return this.tokens}insertAfter(e,t){let r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Be.DEFAULT_PROGRAM_NAME;r="number"==typeof e?e:e.tokenIndex;let i=this.getProgram(n),s=new Ye(this.tokens,r,i.length,t);i.push(s)}insertBefore(e,t){let r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Be.DEFAULT_PROGRAM_NAME;r="number"==typeof e?e:e.tokenIndex;const i=this.getProgram(n),s=new ze(this.tokens,r,i.length,t);i.push(s)}replaceSingle(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Be.DEFAULT_PROGRAM_NAME;this.replace(e,e,t,r)}replace(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Be.DEFAULT_PROGRAM_NAME;if("number"!=typeof e&&(e=e.tokenIndex),"number"!=typeof t&&(t=t.tokenIndex),e>t||e<0||t<0||t>=this.tokens.size)throw new RangeError(`replace: range invalid: ${e}..${t}(size=${this.tokens.size})`);let i=this.getProgram(n),s=new qe(this.tokens,e,t,i.length,r);i.push(s)}delete(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Be.DEFAULT_PROGRAM_NAME;void 0===t&&(t=e),this.replace(e,t,null,r)}getProgram(e){let t=this.programs.get(e);return null==t&&(t=this.initializeProgram(e)),t}initializeProgram(e){const t=[];return this.programs.set(e,t),t}getText(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Be.DEFAULT_PROGRAM_NAME;t=e instanceof E?e:new E(0,this.tokens.size-1),"string"==typeof e&&(r=e);const n=this.programs.get(r);let s=t.start,a=t.stop;if(a>this.tokens.size-1&&(a=this.tokens.size-1),s<0&&(s=0),null==n||0===n.length)return this.tokens.getText(new E(s,a));let o=[],l=this.reduceToSingleOperationPerIndex(n),c=s;for(;c<=a&&c<this.tokens.size;){let e=l.get(c);l.delete(c);let t=this.tokens.get(c);null==e?(t.type!==i.EOF&&o.push(String(t.text)),c++):c=e.execute(o)}if(a===this.tokens.size-1)for(const e of l.values())e.index>=this.tokens.size-1&&o.push(e.text.toString());return o.join("")}reduceToSingleOperationPerIndex(e){for(let t=0;t<e.length;t++){let r=e[t];if(null==r)continue;if(!(r instanceof qe))continue;let n=r,i=this.getKindOfOps(e,ze,t);for(let t of i)t.index===n.index?(e[t.instructionIndex]=void 0,n.text=t.text.toString()+(null!=n.text?n.text.toString():"")):t.index>n.index&&t.index<=n.lastIndex&&(e[t.instructionIndex]=void 0);let s=this.getKindOfOps(e,qe,t);for(let t of s){if(t.index>=n.index&&t.lastIndex<=n.lastIndex){e[t.instructionIndex]=void 0;continue}let r=t.lastIndex<n.index||t.index>n.lastIndex;if(null!=t.text||null!=n.text||r){if(!r)throw new Error(`replace op boundaries of ${n} overlap with previous ${t}`)}else e[t.instructionIndex]=void 0,n.index=Math.min(t.index,n.index),n.lastIndex=Math.max(t.lastIndex,n.lastIndex)}}for(let t=0;t<e.length;t++){let r=e[t];if(null==r)continue;if(!(r instanceof ze))continue;let n=r,i=this.getKindOfOps(e,ze,t);for(let t of i)t.index===n.index&&(t instanceof Ye?(n.text=this.catOpText(t.text,n.text),e[t.instructionIndex]=void 0):t instanceof ze&&(n.text=this.catOpText(n.text,t.text),e[t.instructionIndex]=void 0));let s=this.getKindOfOps(e,qe,t);for(let r of s)if(n.index!==r.index){if(n.index>=r.index&&n.index<=r.lastIndex)throw new Error(`insert op ${n} within boundaries of previous ${r}`)}else r.text=this.catOpText(n.text,r.text),e[t]=void 0}let t=new Map;for(let r of e)if(null!=r){if(null!=t.get(r.index))throw new Error("should only be one op per index");t.set(r.index,r)}return t}catOpText(e,t){let r="",n="";return null!=e&&(r=e.toString()),null!=t&&(n=t.toString()),r+n}getKindOfOps(e,t,r){return e.slice(0,r).filter(e=>e&&e instanceof t)}}class Ve{constructor(e,t,r,n){this.tokens=e,this.instructionIndex=r,this.index=t,this.text=void 0===n?"":n}toString(){let e=this.constructor.name;const t=e.indexOf("$");return e=e.substring(t+1,e.length),"<"+e+"@"+this.tokens.get(this.index)+':"'+this.text+'">'}}class ze extends Ve{constructor(e,t,r,n){super(e,t,r,n)}execute(e){return this.text&&e.push(this.text.toString()),this.tokens.get(this.index).type!==i.EOF&&e.push(String(this.tokens.get(this.index).text)),this.index+1}}class Ye extends ze{constructor(e,t,r,n){super(e,t+1,r,n)}}class qe extends Ve{constructor(e,t,r,n,i){super(e,t,n,i),this.lastIndex=r}execute(e){return this.text&&e.push(this.text.toString()),this.lastIndex+1}toString(){return null==this.text?"<DeleteOp@"+this.tokens.get(this.index)+".."+this.tokens.get(this.lastIndex)+">":"<ReplaceOp@"+this.tokens.get(this.index)+".."+this.tokens.get(this.lastIndex)+':"'+this.text+'">'}}const Ke={atn:re,dfa:he,context:ce,misc:ue,tree:fe,error:Ne,Token:i,CommonToken:Pt,CharStreams:we,CharStream:ye,InputStream:Le,CommonTokenStream:be,Lexer:Ut,Parser:De,ParserRuleContext:He,Interval:E,IntervalSet:S,LL1Analyzer:$,Utils:Re,TokenStreamRewriter:Be};var We=n.jB,Ge=n.pG,$e=n.zW,je=n.Ay;const Xe=(new je.atn.ATNDeserializer).deserialize([4,0,34,165,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,1,0,1,0,1,1,1,1,1,1,1,2,1,2,1,3,1,3,1,4,1,4,1,4,1,5,1,5,1,6,1,6,1,7,1,7,1,8,1,8,1,9,1,9,1,10,1,10,1,11,1,11,1,12,1,12,1,13,1,13,1,14,1,14,1,14,1,15,1,15,1,16,1,16,1,17,1,17,1,17,1,18,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,21,1,22,1,22,1,22,1,23,1,23,1,23,1,24,1,24,1,24,1,25,1,25,1,26,1,26,1,27,1,27,1,27,1,28,1,28,1,28,1,29,1,29,1,30,4,30,142,8,30,11,30,12,30,143,1,30,1,30,1,31,1,31,1,31,1,31,5,31,152,8,31,10,31,12,31,155,9,31,1,31,1,31,1,32,1,32,1,33,4,33,162,8,33,11,33,12,33,163,0,0,34,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,55,28,57,29,59,30,61,31,63,32,65,33,67,34,1,0,3,2,0,9,9,32,32,2,0,10,10,13,13,7,0,9,10,13,13,32,32,40,41,44,44,91,91,93,93,167,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0,0,1,69,1,0,0,0,3,71,1,0,0,0,5,74,1,0,0,0,7,76,1,0,0,0,9,78,1,0,0,0,11,81,1,0,0,0,13,83,1,0,0,0,15,85,1,0,0,0,17,87,1,0,0,0,19,89,1,0,0,0,21,91,1,0,0,0,23,93,1,0,0,0,25,95,1,0,0,0,27,97,1,0,0,0,29,99,1,0,0,0,31,102,1,0,0,0,33,104,1,0,0,0,35,106,1,0,0,0,37,109,1,0,0,0,39,112,1,0,0,0,41,114,1,0,0,0,43,116,1,0,0,0,45,119,1,0,0,0,47,122,1,0,0,0,49,125,1,0,0,0,51,128,1,0,0,0,53,130,1,0,0,0,55,132,1,0,0,0,57,135,1,0,0,0,59,138,1,0,0,0,61,141,1,0,0,0,63,147,1,0,0,0,65,158,1,0,0,0,67,161,1,0,0,0,69,70,5,44,0,0,70,2,1,0,0,0,71,72,5,45,0,0,72,73,5,62,0,0,73,4,1,0,0,0,74,75,5,40,0,0,75,6,1,0,0,0,76,77,5,41,0,0,77,8,1,0,0,0,78,79,5,58,0,0,79,80,5,58,0,0,80,10,1,0,0,0,81,82,5,46,0,0,82,12,1,0,0,0,83,84,5,91,0,0,84,14,1,0,0,0,85,86,5,93,0,0,86,16,1,0,0,0,87,88,5,126,0,0,88,18,1,0,0,0,89,90,5,33,0,0,90,20,1,0,0,0,91,92,5,45,0,0,92,22,1,0,0,0,93,94,5,43,0,0,94,24,1,0,0,0,95,96,5,38,0,0,96,26,1,0,0,0,97,98,5,42,0,0,98,28,1,0,0,0,99,100,5,46,0,0,100,101,5,42,0,0,101,30,1,0,0,0,102,103,5,47,0,0,103,32,1,0,0,0,104,105,5,37,0,0,105,34,1,0,0,0,106,107,5,60,0,0,107,108,5,60,0,0,108,36,1,0,0,0,109,110,5,62,0,0,110,111,5,62,0,0,111,38,1,0,0,0,112,113,5,60,0,0,113,40,1,0,0,0,114,115,5,62,0,0,115,42,1,0,0,0,116,117,5,60,0,0,117,118,5,61,0,0,118,44,1,0,0,0,119,120,5,62,0,0,120,121,5,61,0,0,121,46,1,0,0,0,122,123,5,61,0,0,123,124,5,61,0,0,124,48,1,0,0,0,125,126,5,33,0,0,126,127,5,61,0,0,127,50,1,0,0,0,128,129,5,94,0,0,129,52,1,0,0,0,130,131,5,124,0,0,131,54,1,0,0,0,132,133,5,38,0,0,133,134,5,38,0,0,134,56,1,0,0,0,135,136,5,124,0,0,136,137,5,124,0,0,137,58,1,0,0,0,138,139,5,61,0,0,139,60,1,0,0,0,140,142,7,0,0,0,141,140,1,0,0,0,142,143,1,0,0,0,143,141,1,0,0,0,143,144,1,0,0,0,144,145,1,0,0,0,145,146,6,30,0,0,146,62,1,0,0,0,147,148,5,47,0,0,148,149,5,47,0,0,149,153,1,0,0,0,150,152,8,1,0,0,151,150,1,0,0,0,152,155,1,0,0,0,153,151,1,0,0,0,153,154,1,0,0,0,154,156,1,0,0,0,155,153,1,0,0,0,156,157,6,31,0,0,157,64,1,0,0,0,158,159,7,1,0,0,159,66,1,0,0,0,160,162,8,2,0,0,161,160,1,0,0,0,162,163,1,0,0,0,163,161,1,0,0,0,163,164,1,0,0,0,164,68,1,0,0,0,4,0,143,153,163,1,6,0,0]),Je=Xe.decisionToState.map((e,t)=>new je.dfa.DFA(e,t));class Qe extends je.Lexer{static grammarFileName="Dsp.g4";static channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"];static modeNames=["DEFAULT_MODE"];static literalNames=[null,"','","'->'","'('","')'","'::'","'.'","'['","']'","'~'","'!'","'-'","'+'","'&'","'*'","'.*'","'/'","'%'","'<<'","'>>'","'<'","'>'","'<='","'>='","'=='","'!='","'^'","'|'","'&&'","'||'","'='"];static symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"WHITESPACE","COMMENT","NEWLINE","SYMBOL"];static ruleNames=["T__0","T__1","T__2","T__3","T__4","T__5","T__6","T__7","T__8","T__9","T__10","T__11","T__12","T__13","T__14","T__15","T__16","T__17","T__18","T__19","T__20","T__21","T__22","T__23","T__24","T__25","T__26","T__27","T__28","T__29","WHITESPACE","COMMENT","NEWLINE","SYMBOL"];constructor(e){super(e),this._interp=new je.atn.LexerATNSimulator(this,Xe,Je,new je.atn.PredictionContextCache)}}Qe.EOF=je.Token.EOF,Qe.T__0=1,Qe.T__1=2,Qe.T__2=3,Qe.T__3=4,Qe.T__4=5,Qe.T__5=6,Qe.T__6=7,Qe.T__7=8,Qe.T__8=9,Qe.T__9=10,Qe.T__10=11,Qe.T__11=12,Qe.T__12=13,Qe.T__13=14,Qe.T__14=15,Qe.T__15=16,Qe.T__16=17,Qe.T__17=18,Qe.T__18=19,Qe.T__19=20,Qe.T__20=21,Qe.T__21=22,Qe.T__22=23,Qe.T__23=24,Qe.T__24=25,Qe.T__25=26,Qe.T__26=27,Qe.T__27=28,Qe.T__28=29,Qe.T__29=30,Qe.WHITESPACE=31,Qe.COMMENT=32,Qe.NEWLINE=33,Qe.SYMBOL=34;class Ze extends je.tree.ParseTreeVisitor{visitRule_pool(e){return this.visitChildren(e)}visitRule(e){return this.visitChildren(e)}visitSymbol(e){return this.visitChildren(e)}visitParentheses(e){return this.visitChildren(e)}visitSubscript(e){return this.visitChildren(e)}visitBinary(e){return this.visitChildren(e)}visitFunction(e){return this.visitChildren(e)}visitUnary(e){return this.visitChildren(e)}}const ts=(new je.atn.ATNDeserializer).deserialize([4,1,34,132,2,0,7,0,2,1,7,1,2,2,7,2,1,0,5,0,8,8,0,10,0,12,0,11,9,0,1,0,1,0,4,0,15,8,0,11,0,12,0,16,1,0,5,0,20,8,0,10,0,12,0,23,9,0,3,0,25,8,0,1,0,5,0,28,8,0,10,0,12,0,31,9,0,1,0,1,0,1,1,1,1,1,1,1,1,5,1,39,8,1,10,1,12,1,42,9,1,3,1,44,8,1,1,1,1,1,3,1,48,8,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,3,2,58,8,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,5,2,107,8,2,10,2,12,2,110,9,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,5,2,119,8,2,10,2,12,2,122,9,2,3,2,124,8,2,1,2,5,2,127,8,2,10,2,12,2,130,9,2,1,2,0,1,4,3,0,2,4,0,6,1,0,9,14,2,0,14,14,16,17,1,0,11,12,1,0,18,19,1,0,20,23,1,0,24,25,157,0,9,1,0,0,0,2,47,1,0,0,0,4,57,1,0,0,0,6,8,5,33,0,0,7,6,1,0,0,0,8,11,1,0,0,0,9,7,1,0,0,0,9,10,1,0,0,0,10,24,1,0,0,0,11,9,1,0,0,0,12,21,3,2,1,0,13,15,5,33,0,0,14,13,1,0,0,0,15,16,1,0,0,0,16,14,1,0,0,0,16,17,1,0,0,0,17,18,1,0,0,0,18,20,3,2,1,0,19,14,1,0,0,0,20,23,1,0,0,0,21,19,1,0,0,0,21,22,1,0,0,0,22,25,1,0,0,0,23,21,1,0,0,0,24,12,1,0,0,0,24,25,1,0,0,0,25,29,1,0,0,0,26,28,5,33,0,0,27,26,1,0,0,0,28,31,1,0,0,0,29,27,1,0,0,0,29,30,1,0,0,0,30,32,1,0,0,0,31,29,1,0,0,0,32,33,5,0,0,1,33,1,1,0,0,0,34,48,3,4,2,0,35,40,3,4,2,0,36,37,5,1,0,0,37,39,3,4,2,0,38,36,1,0,0,0,39,42,1,0,0,0,40,38,1,0,0,0,40,41,1,0,0,0,41,44,1,0,0,0,42,40,1,0,0,0,43,35,1,0,0,0,43,44,1,0,0,0,44,45,1,0,0,0,45,46,5,2,0,0,46,48,3,4,2,0,47,34,1,0,0,0,47,43,1,0,0,0,48,3,1,0,0,0,49,50,6,2,-1,0,50,58,5,34,0,0,51,52,5,3,0,0,52,53,3,4,2,0,53,54,5,4,0,0,54,58,1,0,0,0,55,56,7,0,0,0,56,58,3,4,2,13,57,49,1,0,0,0,57,51,1,0,0,0,57,55,1,0,0,0,58,128,1,0,0,0,59,60,10,17,0,0,60,61,5,5,0,0,61,127,3,4,2,18,62,63,10,16,0,0,63,64,5,6,0,0,64,127,3,4,2,17,65,66,10,12,0,0,66,67,5,15,0,0,67,127,3,4,2,13,68,69,10,11,0,0,69,70,7,1,0,0,70,127,3,4,2,12,71,72,10,10,0,0,72,73,7,2,0,0,73,127,3,4,2,11,74,75,10,9,0,0,75,76,7,3,0,0,76,127,3,4,2,10,77,78,10,8,0,0,78,79,7,4,0,0,79,127,3,4,2,9,80,81,10,7,0,0,81,82,7,5,0,0,82,127,3,4,2,8,83,84,10,6,0,0,84,85,5,13,0,0,85,127,3,4,2,7,86,87,10,5,0,0,87,88,5,26,0,0,88,127,3,4,2,6,89,90,10,4,0,0,90,91,5,27,0,0,91,127,3,4,2,5,92,93,10,3,0,0,93,94,5,28,0,0,94,127,3,4,2,4,95,96,10,2,0,0,96,97,5,29,0,0,97,127,3,4,2,3,98,99,10,1,0,0,99,100,5,30,0,0,100,127,3,4,2,2,101,102,10,15,0,0,102,103,5,7,0,0,103,108,3,4,2,0,104,105,5,1,0,0,105,107,3,4,2,0,106,104,1,0,0,0,107,110,1,0,0,0,108,106,1,0,0,0,108,109,1,0,0,0,109,111,1,0,0,0,110,108,1,0,0,0,111,112,5,8,0,0,112,127,1,0,0,0,113,114,10,14,0,0,114,123,5,3,0,0,115,120,3,4,2,0,116,117,5,1,0,0,117,119,3,4,2,0,118,116,1,0,0,0,119,122,1,0,0,0,120,118,1,0,0,0,120,121,1,0,0,0,121,124,1,0,0,0,122,120,1,0,0,0,123,115,1,0,0,0,123,124,1,0,0,0,124,125,1,0,0,0,125,127,5,4,0,0,126,59,1,0,0,0,126,62,1,0,0,0,126,65,1,0,0,0,126,68,1,0,0,0,126,71,1,0,0,0,126,74,1,0,0,0,126,77,1,0,0,0,126,80,1,0,0,0,126,83,1,0,0,0,126,86,1,0,0,0,126,89,1,0,0,0,126,92,1,0,0,0,126,95,1,0,0,0,126,98,1,0,0,0,126,101,1,0,0,0,126,113,1,0,0,0,127,130,1,0,0,0,128,126,1,0,0,0,128,129,1,0,0,0,129,5,1,0,0,0,130,128,1,0,0,0,14,9,16,21,24,29,40,43,47,57,108,120,123,126,128]),es=ts.decisionToState.map((e,t)=>new je.dfa.DFA(e,t)),ss=new je.atn.PredictionContextCache;class ns extends je.Parser{static grammarFileName="Dsp.g4";static literalNames=[null,"','","'->'","'('","')'","'::'","'.'","'['","']'","'~'","'!'","'-'","'+'","'&'","'*'","'.*'","'/'","'%'","'<<'","'>>'","'<'","'>'","'<='","'>='","'=='","'!='","'^'","'|'","'&&'","'||'","'='"];static symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"WHITESPACE","COMMENT","NEWLINE","SYMBOL"];static ruleNames=["rule_pool","rule","term"];constructor(e){super(e),this._interp=new je.atn.ParserATNSimulator(this,ts,es,ss),this.ruleNames=ns.ruleNames,this.literalNames=ns.literalNames,this.symbolicNames=ns.symbolicNames}sempred(e,t,r){if(2===t)return this.term_sempred(e,r);throw"No predicate with index:"+t}term_sempred(e,t){switch(t){case 0:return this.precpred(this._ctx,17);case 1:return this.precpred(this._ctx,16);case 2:return this.precpred(this._ctx,12);case 3:return this.precpred(this._ctx,11);case 4:return this.precpred(this._ctx,10);case 5:return this.precpred(this._ctx,9);case 6:return this.precpred(this._ctx,8);case 7:return this.precpred(this._ctx,7);case 8:return this.precpred(this._ctx,6);case 9:return this.precpred(this._ctx,5);case 10:return this.precpred(this._ctx,4);case 11:return this.precpred(this._ctx,3);case 12:return this.precpred(this._ctx,2);case 13:return this.precpred(this._ctx,1);case 14:return this.precpred(this._ctx,15);case 15:return this.precpred(this._ctx,14);default:throw"No predicate with index:"+t}}rule_pool(){let e=new is(this,this._ctx,this.state);this.enterRule(e,0,ns.RULE_rule_pool);var t=0;try{this.enterOuterAlt(e,1),this.state=9,this._errHandler.sync(this);for(var r=this._interp.adaptivePredict(this._input,0,this._ctx);2!=r&&r!=je.atn.ATN.INVALID_ALT_NUMBER;)1===r&&(this.state=6,this.match(ns.NEWLINE)),this.state=11,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,0,this._ctx);if(this.state=24,this._errHandler.sync(this),!(-32&(t=this._input.LA(1)))&&1<<t&32268||34===t)for(this.state=12,this.rule_(),this.state=21,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,2,this._ctx);2!=r&&r!=je.atn.ATN.INVALID_ALT_NUMBER;){if(1===r){this.state=14,this._errHandler.sync(this),t=this._input.LA(1);do{this.state=13,this.match(ns.NEWLINE),this.state=16,this._errHandler.sync(this),t=this._input.LA(1)}while(33===t);this.state=18,this.rule_()}this.state=23,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,2,this._ctx)}for(this.state=29,this._errHandler.sync(this),t=this._input.LA(1);33===t;)this.state=26,this.match(ns.NEWLINE),this.state=31,this._errHandler.sync(this),t=this._input.LA(1);this.state=32,this.match(ns.EOF)}catch(t){if(!(t instanceof je.error.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}rule_(){let e=new rs(this,this._ctx,this.state);this.enterRule(e,2,ns.RULE_rule);var t=0;try{switch(this.state=47,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,7,this._ctx)){case 1:this.enterOuterAlt(e,1),this.state=34,this.term(0);break;case 2:if(this.enterOuterAlt(e,2),this.state=43,this._errHandler.sync(this),!((t=this._input.LA(1))-3&-32)&&1<<t-3&2147487681)for(this.state=35,this.term(0),this.state=40,this._errHandler.sync(this),t=this._input.LA(1);1===t;)this.state=36,this.match(ns.T__0),this.state=37,this.term(0),this.state=42,this._errHandler.sync(this),t=this._input.LA(1);this.state=45,this.match(ns.T__1),this.state=46,this.term(0)}}catch(t){if(!(t instanceof je.error.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}term(e){void 0===e&&(e=0);const t=this._ctx,r=this.state;let n=new os(this,this._ctx,r),i=n;this.enterRecursionRule(n,4,ns.RULE_term,e);var s=0;try{switch(this.enterOuterAlt(n,1),this.state=57,this._errHandler.sync(this),this._input.LA(1)){case 34:n=new as(this,n),this._ctx=n,i=n,this.state=50,this.match(ns.SYMBOL);break;case 3:n=new ls(this,n),this._ctx=n,i=n,this.state=51,this.match(ns.T__2),this.state=52,this.term(0),this.state=53,this.match(ns.T__3);break;case 9:case 10:case 11:case 12:case 13:case 14:n=new ds(this,n),this._ctx=n,i=n,this.state=55,-32&(s=this._input.LA(1))||!(1<<s&32256)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=56,this.term(13);break;default:throw new je.error.NoViableAltException(this)}this._ctx.stop=this._input.LT(-1),this.state=128,this._errHandler.sync(this);for(var a=this._interp.adaptivePredict(this._input,13,this._ctx);2!=a&&a!=je.atn.ATN.INVALID_ALT_NUMBER;){if(1===a)switch(null!==this._parseListeners&&this.triggerExitRuleEvent(),i=n,this.state=126,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,12,this._ctx)){case 1:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=59,!this.precpred(this._ctx,17))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 17)");this.state=60,this.match(ns.T__4),this.state=61,this.term(18);break;case 2:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=62,!this.precpred(this._ctx,16))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 16)");this.state=63,this.match(ns.T__5),this.state=64,this.term(17);break;case 3:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=65,!this.precpred(this._ctx,12))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 12)");this.state=66,this.match(ns.T__14),this.state=67,this.term(13);break;case 4:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=68,!this.precpred(this._ctx,11))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 11)");this.state=69,-32&(s=this._input.LA(1))||!(1<<s&212992)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=70,this.term(12);break;case 5:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=71,!this.precpred(this._ctx,10))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 10)");this.state=72,11!==(s=this._input.LA(1))&&12!==s?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=73,this.term(11);break;case 6:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=74,!this.precpred(this._ctx,9))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 9)");this.state=75,18!==(s=this._input.LA(1))&&19!==s?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=76,this.term(10);break;case 7:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=77,!this.precpred(this._ctx,8))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 8)");this.state=78,-32&(s=this._input.LA(1))||!(1<<s&15728640)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=79,this.term(9);break;case 8:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=80,!this.precpred(this._ctx,7))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 7)");this.state=81,24!==(s=this._input.LA(1))&&25!==s?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=82,this.term(8);break;case 9:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=83,!this.precpred(this._ctx,6))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 6)");this.state=84,this.match(ns.T__12),this.state=85,this.term(7);break;case 10:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=86,!this.precpred(this._ctx,5))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 5)");this.state=87,this.match(ns.T__25),this.state=88,this.term(6);break;case 11:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=89,!this.precpred(this._ctx,4))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 4)");this.state=90,this.match(ns.T__26),this.state=91,this.term(5);break;case 12:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=92,!this.precpred(this._ctx,3))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 3)");this.state=93,this.match(ns.T__27),this.state=94,this.term(4);break;case 13:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=95,!this.precpred(this._ctx,2))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 2)");this.state=96,this.match(ns.T__28),this.state=97,this.term(3);break;case 14:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=98,!this.precpred(this._ctx,1))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 1)");this.state=99,this.match(ns.T__29),this.state=100,this.term(2);break;case 15:if(n=new hs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=101,!this.precpred(this._ctx,15))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 15)");for(this.state=102,this.match(ns.T__6),this.state=103,this.term(0),this.state=108,this._errHandler.sync(this),s=this._input.LA(1);1===s;)this.state=104,this.match(ns.T__0),this.state=105,this.term(0),this.state=110,this._errHandler.sync(this),s=this._input.LA(1);this.state=111,this.match(ns.T__7);break;case 16:if(n=new us(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=113,!this.precpred(this._ctx,14))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 14)");if(this.state=114,this.match(ns.T__2),this.state=123,this._errHandler.sync(this),!((s=this._input.LA(1))-3&-32)&&1<<s-3&2147487681)for(this.state=115,this.term(0),this.state=120,this._errHandler.sync(this),s=this._input.LA(1);1===s;)this.state=116,this.match(ns.T__0),this.state=117,this.term(0),this.state=122,this._errHandler.sync(this),s=this._input.LA(1);this.state=125,this.match(ns.T__3)}this.state=130,this._errHandler.sync(this),a=this._interp.adaptivePredict(this._input,13,this._ctx)}}catch(e){if(!(e instanceof je.error.RecognitionException))throw e;n.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.unrollRecursionContexts(t)}return n}}ns.EOF=je.Token.EOF,ns.T__0=1,ns.T__1=2,ns.T__2=3,ns.T__3=4,ns.T__4=5,ns.T__5=6,ns.T__6=7,ns.T__7=8,ns.T__8=9,ns.T__9=10,ns.T__10=11,ns.T__11=12,ns.T__12=13,ns.T__13=14,ns.T__14=15,ns.T__15=16,ns.T__16=17,ns.T__17=18,ns.T__18=19,ns.T__19=20,ns.T__20=21,ns.T__21=22,ns.T__22=23,ns.T__23=24,ns.T__24=25,ns.T__25=26,ns.T__26=27,ns.T__27=28,ns.T__28=29,ns.T__29=30,ns.WHITESPACE=31,ns.COMMENT=32,ns.NEWLINE=33,ns.SYMBOL=34,ns.RULE_rule_pool=0,ns.RULE_rule=1,ns.RULE_term=2;let is=class extends je.ParserRuleContext{constructor(e,t,r){void 0===t&&(t=null),null==r&&(r=-1),super(t,r),this.parser=e,this.ruleIndex=ns.RULE_rule_pool}EOF(){return this.getToken(ns.EOF,0)}NEWLINE=function(e){return void 0===e&&(e=null),null===e?this.getTokens(ns.NEWLINE):this.getToken(ns.NEWLINE,e)};rule_=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(rs):this.getTypedRuleContext(rs,e)};accept(e){return e instanceof Ze?e.visitRule_pool(this):e.visitChildren(this)}},rs=class extends je.ParserRuleContext{constructor(e,t,r){void 0===t&&(t=null),null==r&&(r=-1),super(t,r),this.parser=e,this.ruleIndex=ns.RULE_rule}term=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(os):this.getTypedRuleContext(os,e)};accept(e){return e instanceof Ze?e.visitRule(this):e.visitChildren(this)}},os=class extends je.ParserRuleContext{constructor(e,t,r){void 0===t&&(t=null),null==r&&(r=-1),super(t,r),this.parser=e,this.ruleIndex=ns.RULE_term}copyFrom(e){super.copyFrom(e)}},as=class extends os{constructor(e,t){super(e),super.copyFrom(t)}SYMBOL(){return this.getToken(ns.SYMBOL,0)}accept(e){return e instanceof Ze?e.visitSymbol(this):e.visitChildren(this)}};ns.SymbolContext=as;class ls extends os{constructor(e,t){super(e),super.copyFrom(t)}term(){return this.getTypedRuleContext(os,0)}accept(e){return e instanceof Ze?e.visitParentheses(this):e.visitChildren(this)}}ns.ParenthesesContext=ls;let hs=class extends os{constructor(e,t){super(e),super.copyFrom(t)}term=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(os):this.getTypedRuleContext(os,e)};accept(e){return e instanceof Ze?e.visitSubscript(this):e.visitChildren(this)}};ns.SubscriptContext=hs;let cs=class extends os{constructor(e,t){super(e),super.copyFrom(t)}term=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(os):this.getTypedRuleContext(os,e)};accept(e){return e instanceof Ze?e.visitBinary(this):e.visitChildren(this)}};ns.BinaryContext=cs;let us=class extends os{constructor(e,t){super(e),super.copyFrom(t)}term=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(os):this.getTypedRuleContext(os,e)};accept(e){return e instanceof Ze?e.visitFunction(this):e.visitChildren(this)}};ns.FunctionContext=us;let ds=class extends os{constructor(e,t){super(e),super.copyFrom(t)}term(){return this.getTypedRuleContext(os,0)}accept(e){return e instanceof Ze?e.visitUnary(this):e.visitChildren(this)}};ns.UnaryContext=ds,ns.Rule_poolContext=is,ns.RuleContext=rs,ns.TermContext=os;const ps=(new je.atn.ATNDeserializer).deserialize([4,0,10,93,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,5,5,5,64,8,5,10,5,12,5,67,9,5,1,6,4,6,70,8,6,11,6,12,6,71,1,6,1,6,1,7,1,7,1,7,1,7,5,7,80,8,7,10,7,12,7,83,9,7,1,7,1,7,1,8,1,8,1,9,4,9,90,8,9,11,9,12,9,91,0,0,10,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,1,0,3,2,0,9,9,32,32,2,0,10,10,13,13,7,0,9,10,13,13,32,32,40,41,44,44,91,91,93,93,96,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,1,21,1,0,0,0,3,32,1,0,0,0,5,34,1,0,0,0,7,44,1,0,0,0,9,51,1,0,0,0,11,59,1,0,0,0,13,69,1,0,0,0,15,75,1,0,0,0,17,86,1,0,0,0,19,89,1,0,0,0,21,22,5,40,0,0,22,23,5,115,0,0,23,24,5,117,0,0,24,25,5,98,0,0,25,26,5,115,0,0,26,27,5,99,0,0,27,28,5,114,0,0,28,29,5,105,0,0,29,30,5,112,0,0,30,31,5,116,0,0,31,2,1,0,0,0,32,33,5,41,0,0,33,4,1,0,0,0,34,35,5,40,0,0,35,36,5,102,0,0,36,37,5,117,0,0,37,38,5,110,0,0,38,39,5,99,0,0,39,40,5,116,0,0,40,41,5,105,0,0,41,42,5,111,0,0,42,43,5,110,0,0,43,6,1,0,0,0,44,45,5,40,0,0,45,46,5,117,0,0,46,47,5,110,0,0,47,48,5,97,0,0,48,49,5,114,0,0,49,50,5,121,0,0,50,8,1,0,0,0,51,52,5,40,0,0,52,53,5,98,0,0,53,54,5,105,0,0,54,55,5,110,0,0,55,56,5,97,0,0,56,57,5,114,0,0,57,58,5,121,0,0,58,10,1,0,0,0,59,60,5,45,0,0,60,61,5,45,0,0,61,65,1,0,0,0,62,64,5,45,0,0,63,62,1,0,0,0,64,67,1,0,0,0,65,63,1,0,0,0,65,66,1,0,0,0,66,12,1,0,0,0,67,65,1,0,0,0,68,70,7,0,0,0,69,68,1,0,0,0,70,71,1,0,0,0,71,69,1,0,0,0,71,72,1,0,0,0,72,73,1,0,0,0,73,74,6,6,0,0,74,14,1,0,0,0,75,76,5,47,0,0,76,77,5,47,0,0,77,81,1,0,0,0,78,80,8,1,0,0,79,78,1,0,0,0,80,83,1,0,0,0,81,79,1,0,0,0,81,82,1,0,0,0,82,84,1,0,0,0,83,81,1,0,0,0,84,85,6,7,0,0,85,16,1,0,0,0,86,87,7,1,0,0,87,18,1,0,0,0,88,90,8,2,0,0,89,88,1,0,0,0,90,91,1,0,0,0,91,89,1,0,0,0,91,92,1,0,0,0,92,20,1,0,0,0,5,0,65,71,81,91,1,6,0,0]),gs=ps.decisionToState.map((e,t)=>new je.dfa.DFA(e,t));class fs extends je.Lexer{static grammarFileName="Ds.g4";static channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"];static modeNames=["DEFAULT_MODE"];static literalNames=[null,"'(subscript'","')'","'(function'","'(unary'","'(binary'"];static symbolicNames=[null,null,null,null,null,null,"RULE","WHITESPACE","COMMENT","NEWLINE","SYMBOL"];static ruleNames=["T__0","T__1","T__2","T__3","T__4","RULE","WHITESPACE","COMMENT","NEWLINE","SYMBOL"];constructor(e){super(e),this._interp=new je.atn.LexerATNSimulator(this,ps,gs,new je.atn.PredictionContextCache)}}fs.EOF=je.Token.EOF,fs.T__0=1,fs.T__1=2,fs.T__2=3,fs.T__3=4,fs.T__4=5,fs.RULE=6,fs.WHITESPACE=7,fs.COMMENT=8,fs.NEWLINE=9,fs.SYMBOL=10;class xs extends je.tree.ParseTreeVisitor{visitRule_pool(e){return this.visitChildren(e)}visitRule(e){return this.visitChildren(e)}visitSymbol(e){return this.visitChildren(e)}visitSubscript(e){return this.visitChildren(e)}visitFunction(e){return this.visitChildren(e)}visitUnary(e){return this.visitChildren(e)}visitBinary(e){return this.visitChildren(e)}}const _s=(new je.atn.ATNDeserializer).deserialize([4,1,10,80,2,0,7,0,2,1,7,1,2,2,7,2,1,0,5,0,8,8,0,10,0,12,0,11,9,0,1,0,1,0,4,0,15,8,0,11,0,12,0,16,1,0,5,0,20,8,0,10,0,12,0,23,9,0,3,0,25,8,0,1,0,5,0,28,8,0,10,0,12,0,31,9,0,1,0,1,0,1,1,1,1,4,1,37,8,1,11,1,12,1,38,5,1,41,8,1,10,1,12,1,44,9,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,5,2,53,8,2,10,2,12,2,56,9,2,1,2,1,2,1,2,5,2,61,8,2,10,2,12,2,64,9,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,3,2,78,8,2,1,2,0,0,3,0,2,4,0,0,89,0,9,1,0,0,0,2,42,1,0,0,0,4,77,1,0,0,0,6,8,5,9,0,0,7,6,1,0,0,0,8,11,1,0,0,0,9,7,1,0,0,0,9,10,1,0,0,0,10,24,1,0,0,0,11,9,1,0,0,0,12,21,3,2,1,0,13,15,5,9,0,0,14,13,1,0,0,0,15,16,1,0,0,0,16,14,1,0,0,0,16,17,1,0,0,0,17,18,1,0,0,0,18,20,3,2,1,0,19,14,1,0,0,0,20,23,1,0,0,0,21,19,1,0,0,0,21,22,1,0,0,0,22,25,1,0,0,0,23,21,1,0,0,0,24,12,1,0,0,0,24,25,1,0,0,0,25,29,1,0,0,0,26,28,5,9,0,0,27,26,1,0,0,0,28,31,1,0,0,0,29,27,1,0,0,0,29,30,1,0,0,0,30,32,1,0,0,0,31,29,1,0,0,0,32,33,5,0,0,1,33,1,1,0,0,0,34,36,3,4,2,0,35,37,5,9,0,0,36,35,1,0,0,0,37,38,1,0,0,0,38,36,1,0,0,0,38,39,1,0,0,0,39,41,1,0,0,0,40,34,1,0,0,0,41,44,1,0,0,0,42,40,1,0,0,0,42,43,1,0,0,0,43,45,1,0,0,0,44,42,1,0,0,0,45,46,5,6,0,0,46,47,5,9,0,0,47,48,3,4,2,0,48,3,1,0,0,0,49,78,5,10,0,0,50,54,5,1,0,0,51,53,3,4,2,0,52,51,1,0,0,0,53,56,1,0,0,0,54,52,1,0,0,0,54,55,1,0,0,0,55,57,1,0,0,0,56,54,1,0,0,0,57,78,5,2,0,0,58,62,5,3,0,0,59,61,3,4,2,0,60,59,1,0,0,0,61,64,1,0,0,0,62,60,1,0,0,0,62,63,1,0,0,0,63,65,1,0,0,0,64,62,1,0,0,0,65,78,5,2,0,0,66,67,5,4,0,0,67,68,5,10,0,0,68,69,3,4,2,0,69,70,5,2,0,0,70,78,1,0,0,0,71,72,5,5,0,0,72,73,5,10,0,0,73,74,3,4,2,0,74,75,3,4,2,0,75,76,5,2,0,0,76,78,1,0,0,0,77,49,1,0,0,0,77,50,1,0,0,0,77,58,1,0,0,0,77,66,1,0,0,0,77,71,1,0,0,0,78,5,1,0,0,0,10,9,16,21,24,29,38,42,54,62,77]),Ts=_s.decisionToState.map((e,t)=>new je.dfa.DFA(e,t)),ms=new je.atn.PredictionContextCache;class Es extends je.Parser{static grammarFileName="Ds.g4";static literalNames=[null,"'(subscript'","')'","'(function'","'(unary'","'(binary'"];static symbolicNames=[null,null,null,null,null,null,"RULE","WHITESPACE","COMMENT","NEWLINE","SYMBOL"];static ruleNames=["rule_pool","rule","term"];constructor(e){super(e),this._interp=new je.atn.ParserATNSimulator(this,_s,Ts,ms),this.ruleNames=Es.ruleNames,this.literalNames=Es.literalNames,this.symbolicNames=Es.symbolicNames}rule_pool(){let e=new Ss(this,this._ctx,this.state);this.enterRule(e,0,Es.RULE_rule_pool);var t=0;try{this.enterOuterAlt(e,1),this.state=9,this._errHandler.sync(this);for(var r=this._interp.adaptivePredict(this._input,0,this._ctx);2!=r&&r!=je.atn.ATN.INVALID_ALT_NUMBER;)1===r&&(this.state=6,this.match(Es.NEWLINE)),this.state=11,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,0,this._ctx);if(this.state=24,this._errHandler.sync(this),!(-32&(t=this._input.LA(1)))&&1<<t&1146)for(this.state=12,this.rule_(),this.state=21,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,2,this._ctx);2!=r&&r!=je.atn.ATN.INVALID_ALT_NUMBER;){if(1===r){this.state=14,this._errHandler.sync(this),t=this._input.LA(1);do{this.state=13,this.match(Es.NEWLINE),this.state=16,this._errHandler.sync(this),t=this._input.LA(1)}while(9===t);this.state=18,this.rule_()}this.state=23,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,2,this._ctx)}for(this.state=29,this._errHandler.sync(this),t=this._input.LA(1);9===t;)this.state=26,this.match(Es.NEWLINE),this.state=31,this._errHandler.sync(this),t=this._input.LA(1);this.state=32,this.match(Es.EOF)}catch(t){if(!(t instanceof je.error.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}rule_(){let e=new Cs(this,this._ctx,this.state);this.enterRule(e,2,Es.RULE_rule);var t=0;try{for(this.enterOuterAlt(e,1),this.state=42,this._errHandler.sync(this),t=this._input.LA(1);!(-32&t)&&1<<t&1082;){this.state=34,this.term(),this.state=36,this._errHandler.sync(this),t=this._input.LA(1);do{this.state=35,this.match(Es.NEWLINE),this.state=38,this._errHandler.sync(this),t=this._input.LA(1)}while(9===t);this.state=44,this._errHandler.sync(this),t=this._input.LA(1)}this.state=45,this.match(Es.RULE),this.state=46,this.match(Es.NEWLINE),this.state=47,this.term()}catch(t){if(!(t instanceof je.error.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}term(){let e=new As(this,this._ctx,this.state);this.enterRule(e,4,Es.RULE_term);var t=0;try{switch(this.state=77,this._errHandler.sync(this),this._input.LA(1)){case 10:e=new Ns(this,e),this.enterOuterAlt(e,1),this.state=49,this.match(Es.SYMBOL);break;case 1:for(e=new ys(this,e),this.enterOuterAlt(e,2),this.state=50,this.match(Es.T__0),this.state=54,this._errHandler.sync(this),t=this._input.LA(1);!(-32&t)&&1<<t&1082;)this.state=51,this.term(),this.state=56,this._errHandler.sync(this),t=this._input.LA(1);this.state=57,this.match(Es.T__1);break;case 3:for(e=new Ls(this,e),this.enterOuterAlt(e,3),this.state=58,this.match(Es.T__2),this.state=62,this._errHandler.sync(this),t=this._input.LA(1);!(-32&t)&&1<<t&1082;)this.state=59,this.term(),this.state=64,this._errHandler.sync(this),t=this._input.LA(1);this.state=65,this.match(Es.T__1);break;case 4:e=new ks(this,e),this.enterOuterAlt(e,4),this.state=66,this.match(Es.T__3),this.state=67,this.match(Es.SYMBOL),this.state=68,this.term(),this.state=69,this.match(Es.T__1);break;case 5:e=new Is(this,e),this.enterOuterAlt(e,5),this.state=71,this.match(Es.T__4),this.state=72,this.match(Es.SYMBOL),this.state=73,this.term(),this.state=74,this.term(),this.state=75,this.match(Es.T__1);break;default:throw new je.error.NoViableAltException(this)}}catch(t){if(!(t instanceof je.error.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}}Es.EOF=je.Token.EOF,Es.T__0=1,Es.T__1=2,Es.T__2=3,Es.T__3=4,Es.T__4=5,Es.RULE=6,Es.WHITESPACE=7,Es.COMMENT=8,Es.NEWLINE=9,Es.SYMBOL=10,Es.RULE_rule_pool=0,Es.RULE_rule=1,Es.RULE_term=2;class Ss extends je.ParserRuleContext{constructor(e,t,r){void 0===t&&(t=null),null==r&&(r=-1),super(t,r),this.parser=e,this.ruleIndex=Es.RULE_rule_pool}EOF(){return this.getToken(Es.EOF,0)}NEWLINE=function(e){return void 0===e&&(e=null),null===e?this.getTokens(Es.NEWLINE):this.getToken(Es.NEWLINE,e)};rule_=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(Cs):this.getTypedRuleContext(Cs,e)};accept(e){return e instanceof xs?e.visitRule_pool(this):e.visitChildren(this)}}class Cs extends je.ParserRuleContext{constructor(e,t,r){void 0===t&&(t=null),null==r&&(r=-1),super(t,r),this.parser=e,this.ruleIndex=Es.RULE_rule}RULE(){return this.getToken(Es.RULE,0)}NEWLINE=function(e){return void 0===e&&(e=null),null===e?this.getTokens(Es.NEWLINE):this.getToken(Es.NEWLINE,e)};term=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(As):this.getTypedRuleContext(As,e)};accept(e){return e instanceof xs?e.visitRule(this):e.visitChildren(this)}}class As extends je.ParserRuleContext{constructor(e,t,r){void 0===t&&(t=null),null==r&&(r=-1),super(t,r),this.parser=e,this.ruleIndex=Es.RULE_term}copyFrom(e){super.copyFrom(e)}}class Ns extends As{constructor(e,t){super(e),super.copyFrom(t)}SYMBOL(){return this.getToken(Es.SYMBOL,0)}accept(e){return e instanceof xs?e.visitSymbol(this):e.visitChildren(this)}}Es.SymbolContext=Ns;class ys extends As{constructor(e,t){super(e),super.copyFrom(t)}term=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(As):this.getTypedRuleContext(As,e)};accept(e){return e instanceof xs?e.visitSubscript(this):e.visitChildren(this)}}Es.SubscriptContext=ys;class Ls extends As{constructor(e,t){super(e),super.copyFrom(t)}term=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(As):this.getTypedRuleContext(As,e)};accept(e){return e instanceof xs?e.visitFunction(this):e.visitChildren(this)}}Es.FunctionContext=Ls;class Is extends As{constructor(e,t){super(e),super.copyFrom(t)}SYMBOL(){return this.getToken(Es.SYMBOL,0)}term=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(As):this.getTypedRuleContext(As,e)};accept(e){return e instanceof xs?e.visitBinary(this):e.visitChildren(this)}}Es.BinaryContext=Is;class ks extends As{constructor(e,t){super(e),super.copyFrom(t)}SYMBOL(){return this.getToken(Es.SYMBOL,0)}term(){return this.getTypedRuleContext(As,0)}accept(e){return e instanceof xs?e.visitUnary(this):e.visitChildren(this)}}Es.UnaryContext=ks,Es.Rule_poolContext=Ss,Es.RuleContext=Cs,Es.TermContext=As;class vs extends Ge{syntaxError(e,t,r,n,i,s){throw new Error(`line ${r}:${n} ${i}`)}}class ws extends Ze{visitRule_pool(e){return e.rule_().map(e=>this.visit(e)).join("\n\n")}visitRule(e){const t=e.term().map(e=>this.visit(e));if(1===t.length)return`----\n${t[0]}`;{const e=t.pop(),r=Math.max(...t.map(e=>e.length));return t.push("-".repeat(Math.max(r,4))),t.push(e),t.join("\n")}}visitSymbol(e){return e.SYMBOL().getText()}visitParentheses(e){return this.visit(e.term())}visitSubscript(e){return`(subscript ${e.term().map(e=>this.visit(e)).join(" ")})`}visitFunction(e){return`(function ${e.term().map(e=>this.visit(e)).join(" ")})`}visitUnary(e){return`(unary ${e.getChild(0).getText()} ${this.visit(e.term())})`}visitBinary(e){return`(binary ${e.getChild(1).getText()} ${this.visit(e.term(0))} ${this.visit(e.term(1))})`}}class Rs extends xs{visitRule_pool(e){return e.rule_().map(e=>this.visit(e)).join("\n")}visitRule(e){const t=e.term().map(e=>this.visit(e)),r=t.pop();return t.join(", ")+" -> "+r}visitSymbol(e){return e.SYMBOL().getText()}visitSubscript(e){return`${this.visit(e.term(0))}[${e.term().slice(1).map(e=>this.visit(e)).join(", ")}]`}visitFunction(e){return`${this.visit(e.term(0))}(${e.term().slice(1).map(e=>this.visit(e)).join(", ")})`}visitUnary(e){return`(${e.getChild(1).getText()} ${this.visit(e.term())})`}visitBinary(e){return`(${this.visit(e.term(0))} ${e.getChild(1).getText()} ${this.visit(e.term(1))})`}}function Os(e){const t=new $e(e),r=new Qe(t);r.removeErrorListeners(),r.addErrorListener(new vs);const n=new We(r),i=new ns(n);i.removeErrorListeners(),i.addErrorListener(new vs);const s=i.rule_pool();return(new ws).visit(s)}function Ps(e){const t=new $e(e),r=new fs(t);r.removeErrorListeners(),r.addErrorListener(new vs);const n=new We(r),i=new Es(n);i.removeErrorListeners(),i.addErrorListener(new vs);const s=i.rule_pool();return(new Rs).visit(s)}function varint64read(){let e=0,t=0;for(let r=0;r<28;r+=7){let n=this.buf[this.pos++];if(e|=(127&n)<<r,!(128&n))return this.assertBounds(),[e,t]}let r=this.buf[this.pos++];if(e|=(15&r)<<28,t=(112&r)>>4,!(128&r))return this.assertBounds(),[e,t];for(let r=3;r<=31;r+=7){let n=this.buf[this.pos++];if(t|=(127&n)<<r,!(128&n))return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function varint64write(e,t,r){for(let n=0;n<28;n+=7){const i=e>>>n,s=!(i>>>7==0&&0==t),a=255&(s?128|i:i);if(r.push(a),!s)return}const n=e>>>28&15|(7&t)<<4,i=!!(t>>3);if(r.push(255&(i?128|n:n)),i){for(let e=3;e<31;e+=7){const n=t>>>e,i=!(n>>>7==0),s=255&(i?128|n:n);if(r.push(s),!i)return}r.push(t>>>31&1)}}const TWO_PWR_32_DBL=4294967296;function int64FromString(e){const t="-"===e[0];t&&(e=e.slice(1));const r=1e6;let n=0,i=0;function s(t,s){const a=Number(e.slice(t,s));i*=r,n=n*r+a,n>=TWO_PWR_32_DBL&&(i+=n/TWO_PWR_32_DBL|0,n%=TWO_PWR_32_DBL)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),t?negate(n,i):newBits(n,i)}function int64ToString(e,t){let r=newBits(e,t);const n=2147483648&r.hi;n&&(r=negate(r.lo,r.hi));const i=uInt64ToString(r.lo,r.hi);return n?"-"+i:i}function uInt64ToString(e,t){if(({lo:e,hi:t}=toUnsigned(e,t)),t<=2097151)return String(TWO_PWR_32_DBL*t+e);const r=16777215&(e>>>24|t<<8),n=t>>16&65535;let i=(16777215&e)+6777216*r+6710656*n,s=r+8147497*n,a=2*n;const o=1e7;return i>=o&&(s+=Math.floor(i/o),i%=o),s>=o&&(a+=Math.floor(s/o),s%=o),a.toString()+decimalFrom1e7WithLeadingZeros(s)+decimalFrom1e7WithLeadingZeros(i)}function toUnsigned(e,t){return{lo:e>>>0,hi:t>>>0}}function newBits(e,t){return{lo:0|e,hi:0|t}}function negate(e,t){return t=~t,e?e=1+~e:t+=1,newBits(e,t)}const decimalFrom1e7WithLeadingZeros=e=>{const t=String(e);return"0000000".slice(t.length)+t};function varint32write(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e)}else{for(let r=0;r<9;r++)t.push(127&e|128),e>>=7;t.push(1)}}function varint32read(){let e=this.buf[this.pos++],t=127&e;if(!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<7,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<14,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<21,!(128&e))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(15&e)<<28;for(let t=5;128&e&&t<10;t++)e=this.buf[this.pos++];if(128&e)throw new Error("invalid varint");return this.assertBounds(),t>>>0}const protoInt64=makeInt64Support();function makeInt64Support(){const e=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof e.getBigInt64&&"function"==typeof e.getBigUint64&&"function"==typeof e.setBigInt64&&"function"==typeof e.setBigUint64&&(!!globalThis.Deno||"object"!=typeof process||"object"!=typeof process.env||"1"!==process.env.BUF_BIGINT_DISABLE)){const t=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),n=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(e){const n="bigint"==typeof e?e:BigInt(e);if(n>r||n<t)throw new Error(`invalid int64: ${e}`);return n},uParse(e){const t="bigint"==typeof e?e:BigInt(e);if(t>i||t<n)throw new Error(`invalid uint64: ${e}`);return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec:(t,r)=>(e.setInt32(0,t,!0),e.setInt32(4,r,!0),e.getBigInt64(0,!0)),uDec:(t,r)=>(e.setInt32(0,t,!0),e.setInt32(4,r,!0),e.getBigUint64(0,!0))}}return{zero:"0",supported:!1,parse:e=>("string"!=typeof e&&(e=e.toString()),assertInt64String(e),e),uParse:e=>("string"!=typeof e&&(e=e.toString()),assertUInt64String(e),e),enc:e=>("string"!=typeof e&&(e=e.toString()),assertInt64String(e),int64FromString(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),assertUInt64String(e),int64FromString(e)),dec:(e,t)=>int64ToString(e,t),uDec:(e,t)=>uInt64ToString(e,t)}}function assertInt64String(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function assertUInt64String(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}const symbol=Symbol.for("@bufbuild/protobuf/text-encoding");function getTextEncoding(){if(null==globalThis[symbol]){const e=new globalThis.TextEncoder,t=new globalThis.TextDecoder;globalThis[symbol]={encodeUtf8:t=>e.encode(t),decodeUtf8:e=>t.decode(e),checkUtf8(e){try{return encodeURIComponent(e),!0}catch(e){return!1}}}}return globalThis[symbol]}var WireType;!function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"}(WireType||(WireType={}));const FLOAT32_MAX=34028234663852886e22,FLOAT32_MIN=-34028234663852886e22,UINT32_MAX=4294967295,INT32_MAX=2147483647,INT32_MIN=-2147483648;class BinaryWriter{constructor(e=getTextEncoding().encodeUtf8){this.encodeUtf8=e,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let e=0;for(let t=0;t<this.chunks.length;t++)e+=this.chunks[t].length;let t=new Uint8Array(e),r=0;for(let e=0;e<this.chunks.length;e++)t.set(this.chunks[e],r),r+=this.chunks[e].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(assertUInt32(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return assertInt32(e),varint32write(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.encodeUtf8(e);return this.uint32(t.byteLength),this.raw(t)}float(e){assertFloat32(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){assertUInt32(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){assertInt32(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return assertInt32(e),varint32write(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),n=protoInt64.enc(e);return r.setInt32(0,n.lo,!0),r.setInt32(4,n.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),n=protoInt64.uEnc(e);return r.setInt32(0,n.lo,!0),r.setInt32(4,n.hi,!0),this.raw(t)}int64(e){let t=protoInt64.enc(e);return varint64write(t.lo,t.hi,this.buf),this}sint64(e){const t=protoInt64.enc(e),r=t.hi>>31;return varint64write(t.lo<<1^r,(t.hi<<1|t.lo>>>31)^r,this.buf),this}uint64(e){const t=protoInt64.uEnc(e);return varint64write(t.lo,t.hi,this.buf),this}}class BinaryReader{constructor(e,t=getTextEncoding().decodeUtf8){this.decodeUtf8=t,this.varint64=varint64read,this.uint32=varint32read,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.uint32(),t=e>>>3,r=7&e;if(t<=0||r<0||r>5)throw new Error("illegal tag: field no "+t+" wire type "+r);return[t,r]}skip(e,t){let r=this.pos;switch(e){case WireType.Varint:for(;128&this.buf[this.pos++];);break;case WireType.Bit64:this.pos+=4;case WireType.Bit32:this.pos+=4;break;case WireType.LengthDelimited:let r=this.uint32();this.pos+=r;break;case WireType.StartGroup:for(;;){const[e,r]=this.tag();if(r===WireType.EndGroup){if(void 0!==t&&e!==t)throw new Error("invalid end group tag");break}this.skip(r,e)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(r,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return protoInt64.dec(...this.varint64())}uint64(){return protoInt64.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),r=-(1&e);return e=(e>>>1|(1&t)<<31)^r,t=t>>>1^r,protoInt64.dec(e,t)}bool(){let[e,t]=this.varint64();return 0!==e||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return protoInt64.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return protoInt64.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.decodeUtf8(this.bytes())}}function assertInt32(e){if("string"==typeof e)e=Number(e);else if("number"!=typeof e)throw new Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>INT32_MAX||e<INT32_MIN)throw new Error("invalid int32: "+e)}function assertUInt32(e){if("string"==typeof e)e=Number(e);else if("number"!=typeof e)throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>UINT32_MAX||e<0)throw new Error("invalid uint32: "+e)}function assertFloat32(e){if("string"==typeof e){const t=e;if(e=Number(e),Number.isNaN(e)&&"NaN"!==t)throw new Error("invalid float32: "+t)}else if("number"!=typeof e)throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>FLOAT32_MAX||e<FLOAT32_MIN))throw new Error("invalid float32: "+e)}var EngineKind;function engineKindFromJSON(e){switch(e){case 0:case"EAGER":return EngineKind.EAGER;case 1:case"LAZY":return EngineKind.LAZY;default:return EngineKind.UNRECOGNIZED}}function engineKindToJSON(e){switch(e){case EngineKind.EAGER:return"EAGER";case EngineKind.LAZY:return"LAZY";case EngineKind.UNRECOGNIZED:default:return"UNRECOGNIZED"}}function createBaseNode(){return{id:"",addr:""}}!function(e){e[e.EAGER=0]="EAGER",e[e.LAZY=1]="LAZY",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(EngineKind||(EngineKind={}));const Node={encode:(e,t=new BinaryWriter)=>(""!==e.id&&t.uint32(10).string(e.id),""!==e.addr&&t.uint32(18).string(e.addr),t),decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseNode();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:if(10!==e)break;i.id=r.string();continue;case 2:if(18!==e)break;i.addr=r.string();continue}if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({id:isSet(e.id)?globalThis.String(e.id):"",addr:isSet(e.addr)?globalThis.String(e.addr):""}),toJSON(e){const t={};return""!==e.id&&(t.id=e.id),""!==e.addr&&(t.addr=e.addr),t},create:e=>Node.fromPartial(e??{}),fromPartial(e){const t=createBaseNode();return t.id=e.id??"",t.addr=e.addr??"",t}};function createBaseJoinRequest(){return{node:void 0}}const JoinRequest={encode:(e,t=new BinaryWriter)=>(void 0!==e.node&&Node.encode(e.node,t.uint32(10).fork()).join(),t),decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseJoinRequest();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:if(10!==e)break;i.node=Node.decode(r,r.uint32());continue}if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({node:isSet(e.node)?Node.fromJSON(e.node):void 0}),toJSON(e){const t={};return void 0!==e.node&&(t.node=Node.toJSON(e.node)),t},create:e=>JoinRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseJoinRequest();return t.node=void 0!==e.node&&null!==e.node?Node.fromPartial(e.node):void 0,t}};function createBaseJoinResponse(){return{}}const JoinResponse={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseJoinResponse();for(;r.pos<n;){const e=r.uint32();if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({}),toJSON:e=>({}),create:e=>JoinResponse.fromPartial(e??{}),fromPartial:e=>createBaseJoinResponse()};function createBaseLeaveRequest(){return{node:void 0}}const LeaveRequest={encode:(e,t=new BinaryWriter)=>(void 0!==e.node&&Node.encode(e.node,t.uint32(10).fork()).join(),t),decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseLeaveRequest();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:if(10!==e)break;i.node=Node.decode(r,r.uint32());continue}if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({node:isSet(e.node)?Node.fromJSON(e.node):void 0}),toJSON(e){const t={};return void 0!==e.node&&(t.node=Node.toJSON(e.node)),t},create:e=>LeaveRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseLeaveRequest();return t.node=void 0!==e.node&&null!==e.node?Node.fromPartial(e.node):void 0,t}};function createBaseLeaveResponse(){return{}}const LeaveResponse={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseLeaveResponse();for(;r.pos<n;){const e=r.uint32();if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({}),toJSON:e=>({}),create:e=>LeaveResponse.fromPartial(e??{}),fromPartial:e=>createBaseLeaveResponse()};function createBaseListRequest(){return{}}const ListRequest={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseListRequest();for(;r.pos<n;){const e=r.uint32();if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({}),toJSON:e=>({}),create:e=>ListRequest.fromPartial(e??{}),fromPartial:e=>createBaseListRequest()};function createBaseListResponse(){return{nodes:[]}}const ListResponse={encode(e,t=new BinaryWriter){for(const r of e.nodes)Node.encode(r,t.uint32(10).fork()).join();return t},decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseListResponse();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:if(10!==e)break;i.nodes.push(Node.decode(r,r.uint32()));continue}if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({nodes:globalThis.Array.isArray(e?.nodes)?e.nodes.map(e=>Node.fromJSON(e)):[]}),toJSON(e){const t={};return e.nodes?.length&&(t.nodes=e.nodes.map(e=>Node.toJSON(e))),t},create:e=>ListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseListResponse();return t.nodes=e.nodes?.map(e=>Node.fromPartial(e))||[],t}};function createBaseEngineMetaData(){return{id:"",kind:0,input:[],output:[]}}const EngineMetaData={encode(e,t=new BinaryWriter){""!==e.id&&t.uint32(10).string(e.id),0!==e.kind&&t.uint32(16).int32(e.kind);for(const r of e.input)t.uint32(26).string(r);for(const r of e.output)t.uint32(34).string(r);return t},decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseEngineMetaData();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:if(10!==e)break;i.id=r.string();continue;case 2:if(16!==e)break;i.kind=r.int32();continue;case 3:if(26!==e)break;i.input.push(r.string());continue;case 4:if(34!==e)break;i.output.push(r.string());continue}if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({id:isSet(e.id)?globalThis.String(e.id):"",kind:isSet(e.kind)?engineKindFromJSON(e.kind):0,input:globalThis.Array.isArray(e?.input)?e.input.map(e=>globalThis.String(e)):[],output:globalThis.Array.isArray(e?.output)?e.output.map(e=>globalThis.String(e)):[]}),toJSON(e){const t={};return""!==e.id&&(t.id=e.id),0!==e.kind&&(t.kind=engineKindToJSON(e.kind)),e.input?.length&&(t.input=e.input),e.output?.length&&(t.output=e.output),t},create:e=>EngineMetaData.fromPartial(e??{}),fromPartial(e){const t=createBaseEngineMetaData();return t.id=e.id??"",t.kind=e.kind??0,t.input=e.input?.map(e=>e)||[],t.output=e.output?.map(e=>e)||[],t}};function createBaseMetaDataRequest(){return{}}const MetaDataRequest={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseMetaDataRequest();for(;r.pos<n;){const e=r.uint32();if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({}),toJSON:e=>({}),create:e=>MetaDataRequest.fromPartial(e??{}),fromPartial:e=>createBaseMetaDataRequest()};function createBaseMetaDataResponse(){return{metadata:void 0}}const MetaDataResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.metadata&&EngineMetaData.encode(e.metadata,t.uint32(10).fork()).join(),t),decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseMetaDataResponse();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:if(10!==e)break;i.metadata=EngineMetaData.decode(r,r.uint32());continue}if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({metadata:isSet(e.metadata)?EngineMetaData.fromJSON(e.metadata):void 0}),toJSON(e){const t={};return void 0!==e.metadata&&(t.metadata=EngineMetaData.toJSON(e.metadata)),t},create:e=>MetaDataResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseMetaDataResponse();return t.metadata=void 0!==e.metadata&&null!==e.metadata?EngineMetaData.fromPartial(e.metadata):void 0,t}};function createBasePushDataRequest(){return{data:[]}}const PushDataRequest={encode(e,t=new BinaryWriter){for(const r of e.data)t.uint32(10).string(r);return t},decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBasePushDataRequest();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:if(10!==e)break;i.data.push(r.string());continue}if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({data:globalThis.Array.isArray(e?.data)?e.data.map(e=>globalThis.String(e)):[]}),toJSON(e){const t={};return e.data?.length&&(t.data=e.data),t},create:e=>PushDataRequest.fromPartial(e??{}),fromPartial(e){const t=createBasePushDataRequest();return t.data=e.data?.map(e=>e)||[],t}};function createBasePushDataResponse(){return{}}const PushDataResponse={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBasePushDataResponse();for(;r.pos<n;){const e=r.uint32();if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({}),toJSON:e=>({}),create:e=>PushDataResponse.fromPartial(e??{}),fromPartial:e=>createBasePushDataResponse()};function createBasePullDataRequest(){return{}}const PullDataRequest={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBasePullDataRequest();for(;r.pos<n;){const e=r.uint32();if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({}),toJSON:e=>({}),create:e=>PullDataRequest.fromPartial(e??{}),fromPartial:e=>createBasePullDataRequest()};function createBasePullDataResponse(){return{data:[]}}const PullDataResponse={encode(e,t=new BinaryWriter){for(const r of e.data)t.uint32(10).string(r);return t},decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBasePullDataResponse();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:if(10!==e)break;i.data.push(r.string());continue}if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({data:globalThis.Array.isArray(e?.data)?e.data.map(e=>globalThis.String(e)):[]}),toJSON(e){const t={};return e.data?.length&&(t.data=e.data),t},create:e=>PullDataResponse.fromPartial(e??{}),fromPartial(e){const t=createBasePullDataResponse();return t.data=e.data?.map(e=>e)||[],t}},ClusterService={join:{path:"/cn.edu.ustc.kclab.ddss.Cluster/Join",requestStream:!1,responseStream:!1,requestSerialize:e=>Buffer.from(JoinRequest.encode(e).finish()),requestDeserialize:e=>JoinRequest.decode(e),responseSerialize:e=>Buffer.from(JoinResponse.encode(e).finish()),responseDeserialize:e=>JoinResponse.decode(e)},leave:{path:"/cn.edu.ustc.kclab.ddss.Cluster/Leave",requestStream:!1,responseStream:!1,requestSerialize:e=>Buffer.from(LeaveRequest.encode(e).finish()),requestDeserialize:e=>LeaveRequest.decode(e),responseSerialize:e=>Buffer.from(LeaveResponse.encode(e).finish()),responseDeserialize:e=>LeaveResponse.decode(e)},list:{path:"/cn.edu.ustc.kclab.ddss.Cluster/List",requestStream:!1,responseStream:!1,requestSerialize:e=>Buffer.from(ListRequest.encode(e).finish()),requestDeserialize:e=>ListRequest.decode(e),responseSerialize:e=>Buffer.from(ListResponse.encode(e).finish()),responseDeserialize:e=>ListResponse.decode(e)}},ClusterClient=srcExports.makeGenericClientConstructor(ClusterService,"cn.edu.ustc.kclab.ddss.Cluster"),EngineService={metaData:{path:"/cn.edu.ustc.kclab.ddss.Engine/MetaData",requestStream:!1,responseStream:!1,requestSerialize:e=>Buffer.from(MetaDataRequest.encode(e).finish()),requestDeserialize:e=>MetaDataRequest.decode(e),responseSerialize:e=>Buffer.from(MetaDataResponse.encode(e).finish()),responseDeserialize:e=>MetaDataResponse.decode(e)},pushData:{path:"/cn.edu.ustc.kclab.ddss.Engine/PushData",requestStream:!1,responseStream:!1,requestSerialize:e=>Buffer.from(PushDataRequest.encode(e).finish()),requestDeserialize:e=>PushDataRequest.decode(e),responseSerialize:e=>Buffer.from(PushDataResponse.encode(e).finish()),responseDeserialize:e=>PushDataResponse.decode(e)},pullData:{path:"/cn.edu.ustc.kclab.ddss.Engine/PullData",requestStream:!1,responseStream:!1,requestSerialize:e=>Buffer.from(PullDataRequest.encode(e).finish()),requestDeserialize:e=>PullDataRequest.decode(e),responseSerialize:e=>Buffer.from(PullDataResponse.encode(e).finish()),responseDeserialize:e=>PullDataResponse.decode(e)}},EngineClient=srcExports.makeGenericClientConstructor(EngineService,"cn.edu.ustc.kclab.ddss.Engine");function isSet(e){return null!=e}class AtsdsSearchEngine extends o$1{constructor(e=1e3,t=1e4){super(e,t)}input(e){const t=Os(e);return super.add(t)?Ps(t):null}output(e){return super.execute(t=>(e(Ps(t.toString())),!1))}meta(){return{input:["`x"],output:["`x"]}}}class DataManager{data;constructor(){this.data=new Set}addData(e){return!this.data.has(e)&&(this.data.add(e),!0)}getData(){return Array.from(this.data)}}class EagerEngineManager{eagerEngine;onSearchResults;searchInterval;dataManager;isRunning;lastSearchTime;constructor(e,t,r=1e3){this.eagerEngine=e,this.onSearchResults=t,this.searchInterval=r,this.dataManager=new DataManager,this.isRunning=!1,this.lastSearchTime=Date.now()}start(){this.isRunning||(this.isRunning=!0,this.scheduleNextSearch())}stop(){this.isRunning=!1}addData(e){const t=this.eagerEngine.input(e);return t&&this.dataManager.addData(t)?t:null}addDataBatch(e){const t=[];for(const r of e){const e=this.addData(r);e&&t.push(e)}return t}getMetaData(){return this.eagerEngine.meta()}getData(){return this.dataManager.getData()}scheduleNextSearch(){const e=Date.now()-this.lastSearchTime,t=Math.max(this.searchInterval-e,0);setTimeout(async()=>{this.isRunning&&(this.lastSearchTime=Date.now(),await this.performSearch(),this.scheduleNextSearch())},t)}async performSearch(){const e=[];return this.eagerEngine.output(t=>{this.dataManager.addData(t)&&e.push(t)}),e.length>0&&await this.onSearchResults(e),e}}class ClusterManager{nodes;id;constructor(e){this.nodes=new Map,this.id=e}getAllNodes(){return Array.from(this.nodes.values())}getAllOtherNodes(){return this.getAllNodes().filter(e=>e.id!==this.id)}getAllNodeInfo(){return this.getAllNodes().map(e=>({id:e.id,addr:e.addr}))}addNode(e,t){if(this.hasNode(e))return this.nodes.get(e);const r={id:e,addr:t,client:this.createNodeClient(t)};return this.nodes.set(e,r),r}removeNode(e){if(!this.hasNode(e))return!1;const t=this.nodes.get(e);return t.client.cluster.close(),t.client.engine.close(),this.nodes.delete(e)}hasNode(e){return this.nodes.has(e)}createNodeClient(e){return{cluster:new ClusterClient(e,srcExports.credentials.createInsecure()),engine:new EngineClient(e,srcExports.credentials.createInsecure())}}}class NetworkHandler{server;addr;callbacks;constructor(e,t){this.server=new srcExports.Server,this.addr=e,this.callbacks=t}async start(){this.setupServices();const e=promisify(this.server.bindAsync).bind(this.server),t=await e(this.addr,srcExports.ServerCredentials.createInsecure());return this.addr=`${this.addr.split(":")[0]}:${t}`,this.addr}async stop(){return new Promise(e=>{this.server.tryShutdown(()=>e())})}async callJoin(e,t){const r=promisify(t.cluster.join).bind(t.cluster);await r({node:e})}async callLeave(e,t){const r=promisify(t.cluster.leave).bind(t.cluster);await r({node:e})}async callList(e){const t=promisify(e.cluster.list).bind(e.cluster);return(await t({})).nodes}async callPushData(e,t){const r=promisify(t.engine.pushData).bind(t.engine);await r({data:e})}async callPullData(e){const t=promisify(e.engine.pullData).bind(e.engine);return(await t({})).data||[]}setupServices(){this.server.addService(ClusterService,{join:async(e,t)=>{const r=e.request.node;r&&await this.callbacks.onJoin(r),t(null,{})},leave:async(e,t)=>{const r=e.request.node;r&&await this.callbacks.onLeave(r),t(null,{})},list:async(e,t)=>{t(null,{nodes:await this.callbacks.onList()})}}),this.server.addService(EngineService,{metaData:async(e,t)=>{t(null,{metadata:await this.callbacks.onMetaData()})},pushData:async(e,t)=>{const r=e.request.data;r&&await this.callbacks.onPushData(r),t(null,{})},pullData:async(e,t)=>{t(null,{data:await this.callbacks.onPullData()})}})}}class EagerNode{id;addr;clusterManager;engineManager;networkHandler;stdinInterface=null;constructor(e,t,r=randomUUID()){this.id=r,this.addr=t,this.clusterManager=new ClusterManager(r),this.engineManager=new EagerEngineManager(e,this.handleSearchResults.bind(this)),this.networkHandler=new NetworkHandler(t,{onJoin:this.handleJoinRequest.bind(this),onLeave:this.handleLeaveRequest.bind(this),onList:this.handleListRequest.bind(this),onPushData:this.handlePushDataRequest.bind(this),onMetaData:this.handleMetaDataRequest.bind(this),onPullData:this.handlePullDataRequest.bind(this)})}async start(){const e=await this.networkHandler.start();this.addr=e,this.clusterManager.addNode(this.id,this.addr),this.engineManager.start(),this.setupIoHandling(),console.log(`Node started: ${this.id} at ${this.addr}`)}async stop(){await this.leaveCluster(),this.stdinInterface&&this.stdinInterface.close(),this.engineManager.stop(),await this.networkHandler.stop(),console.log(`Node stopped: ${this.id}`)}async joinCluster(e){const t=this.clusterManager.createNodeClient(e),r=await this.networkHandler.callList(t),n={id:this.id,addr:this.addr};for(const e of r)if(e.id!==this.id){const{client:t}=this.clusterManager.addNode(e.id,e.addr);await this.networkHandler.callJoin(n,t),await this.syncDataWithNode(t),console.log(`Joining node: ${e.id} at ${e.addr}`)}t.cluster.close(),t.engine.close()}async leaveCluster(){const e={id:this.id,addr:this.addr},t=this.clusterManager.getAllOtherNodes();for(const r of t)await this.networkHandler.callLeave(e,r.client),this.clusterManager.removeNode(r.id),console.log(`Leaving node: ${r.id}`)}async handleJoinRequest(e){this.clusterManager.hasNode(e.id)||(this.clusterManager.addNode(e.id,e.addr),console.log(`Node joined: ${e.id} at ${e.addr}`))}async handleLeaveRequest(e){this.clusterManager.removeNode(e.id)&&console.log(`Node left: ${e.id} at ${e.addr}`)}async handleListRequest(){return this.clusterManager.getAllNodeInfo()}async handlePushDataRequest(e){const t=this.engineManager.addDataBatch(e);for(const e of t)console.log(`Data received: ${e}`);return t}async handleMetaDataRequest(){const e=this.engineManager.getMetaData();return{id:this.id,kind:EngineKind.EAGER,input:e.input,output:e.output}}async handlePullDataRequest(){return this.engineManager.getData()}async handleSearchResults(e){if(0===e.length)return;for(const t of e)console.log(`Data found: ${t}`);const t=this.clusterManager.getAllOtherNodes();for(const r of t)await this.networkHandler.callPushData(e,r.client)}async syncDataWithNode(e){const t=this.engineManager.getData();t.length>0&&await this.networkHandler.callPushData(t,e);const r=await this.networkHandler.callPullData(e);if(r.length>0){const e=this.engineManager.addDataBatch(r);for(const t of e)console.log(`Pulling data: ${t}`)}}setupIoHandling(){this.stdinInterface=createInterface({input:process.stdin,output:process.stdout,terminal:!1}),this.stdinInterface.on("line",async e=>{const t=e.trim();if(0===t.length)return;const r=this.engineManager.addData(t);if(r){console.log(`Data read: ${r}`);const e=this.clusterManager.getAllOtherNodes();for(const t of e)await this.networkHandler.callPushData([r],t.client)}}),process.on("SIGINT",async()=>{console.log("\nShutting down..."),await this.stop(),process.exit(0)}),process.on("SIGUSR1",()=>{console.log("=== Cluster Information ==="),console.log(`Current Node: ${this.id} at ${this.addr}`),console.log("\nConnected Nodes:");const e=this.clusterManager.getAllOtherNodes();e.forEach((e,t)=>{console.log(` ${t+1}. ${e.id} at ${e.addr}`)}),console.log(`Total nodes: ${e.length+1}`),console.log("===========================")}),process.on("SIGUSR2",()=>{console.log("=== Data Information ===");const e=this.engineManager.getData();e.forEach((e,t)=>{console.log(` ${t+1}. ${e}`)}),console.log(`Total data items: ${e.length}`),console.log("========================")})}}function isIntegerString(e){return"string"==typeof e&&/^\d+$/.test(e)}function addAddressPrefixForPort(e,t){return isIntegerString(e)?`${t}:${e}`:e}async function main(){(process.argv.length<3||process.argv.length>4)&&(console.error("Usage: main <bind_addr> [<join_addr>]"),process.exit(1));const e=addAddressPrefixForPort(process.argv[2],"0.0.0.0"),t=new AtsdsSearchEngine,r=new EagerNode(t,e);if(await r.start(),4===process.argv.length){const e=addAddressPrefixForPort(process.argv[3],"127.0.0.1");console.log(`Joining cluster at ${e}...`),await r.joinCluster(e)}else console.log("Starting as first node in new cluster...");process.stdin.resume()}import.meta.main&&main();
58
+ Object.defineProperty(e,"__esModule",{value:!0}),e.loadFileDescriptorSetFromObject=e.loadFileDescriptorSetFromBuffer=e.fromJSON=e.loadSync=e.load=e.IdempotencyLevel=e.isAnyExtension=e.Long=void 0;const t=requireLodash_camelcase(),r=requireProtobufjs(),n=requireDescriptor(),i=requireUtil(),s=requireUmd();var a;e.Long=s,e.isAnyExtension=function(e){return"@type"in e&&"string"==typeof e["@type"]},function(e){e.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",e.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",e.IDEMPOTENT="IDEMPOTENT"}(a=e.IdempotencyLevel||(e.IdempotencyLevel={}));const o={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function l(e,t){const n=(i=t,s=e.name,""===i?s:i+"."+s);var i,s;return function(e){return e instanceof r.Service||e instanceof r.Type||e instanceof r.Enum}(e)?[[n,e]]:function(e){return e instanceof r.Namespace||e instanceof r.Root}(e)&&void 0!==e.nested?Object.keys(e.nested).map(t=>l(e.nested[t],n)).reduce((e,t)=>e.concat(t),[]):[]}function c(e,t){return function(r){return e.toObject(e.decode(r),t)}}function u(e){return function(t){if(Array.isArray(t))throw new Error(`Failed to serialize message: expected object with ${e.name} structure, got array instead`);const r=e.fromObject(t);return e.encode(r).finish()}}function h(e){return(e||[]).reduce((e,t)=>{for(const[r,n]of Object.entries(t))if("uninterpreted_option"===r)e.uninterpreted_option.push(t.uninterpreted_option);else e[r]=n;return e},{deprecated:!1,idempotency_level:a.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function d(e,r,n,i){const s=e.resolvedRequestType,a=e.resolvedResponseType;return{path:"/"+r+"/"+e.name,requestStream:!!e.requestStream,responseStream:!!e.responseStream,requestSerialize:u(s),requestDeserialize:c(s,n),responseSerialize:u(a),responseDeserialize:c(a,n),originalName:t(e.name),requestType:p(s,n,i),responseType:p(a,n,i),options:h(e.parsedOptions)}}function p(e,t,r){const n=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:n.$type.toObject(n,o),fileDescriptorProtos:r,serialize:u(e),deserialize:c(e,t)}}function f(e,t,n,i){if(e instanceof r.Service)return function(e,t,r,n){const i={};for(const s of e.methodsArray)i[s.name]=d(s,t,r,n);return i}(e,t,n,i);if(e instanceof r.Type)return p(e,n,i);if(e instanceof r.Enum)return function(e,t){const r=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:r.$type.toObject(r,o),fileDescriptorProtos:t}}(e,i);throw new Error("Type mismatch in reflection object handling")}function g(e,t){const r={};e.resolveAll();const i=e.toDescriptor("proto3").file.map(e=>Buffer.from(n.FileDescriptorProto.encode(e).finish()));for(const[n,s]of l(e,""))r[n]=f(s,n,t,i);return r}function v(e,t){t=t||{};const n=r.Root.fromDescriptor(e);return n.resolveAll(),g(n,t)}e.load=function(e,t){return(0,i.loadProtosWithOptions)(e,t).then(e=>g(e,t))},e.loadSync=function(e,t){return g((0,i.loadProtosWithOptionsSync)(e,t),t)},e.fromJSON=function(e,t){t=t||{};const n=r.Root.fromJSON(e);return n.resolveAll(),g(n,t)},e.loadFileDescriptorSetFromBuffer=function(e,t){return v(n.FileDescriptorSet.decode(e),t)},e.loadFileDescriptorSetFromObject=function(e,t){return v(n.FileDescriptorSet.fromObject(e),t)},(0,i.addCommonProtos)()}(src$1)),src$1}function requireChannelz(){if(hasRequiredChannelz)return channelz;hasRequiredChannelz=1,Object.defineProperty(channelz,"__esModule",{value:!0}),channelz.registerChannelzSocket=channelz.registerChannelzServer=channelz.registerChannelzSubchannel=channelz.registerChannelzChannel=channelz.ChannelzCallTrackerStub=channelz.ChannelzCallTracker=channelz.ChannelzChildrenTrackerStub=channelz.ChannelzChildrenTracker=channelz.ChannelzTrace=channelz.ChannelzTraceStub=void 0,channelz.unregisterChannelzRef=function(e){p[e.kind].eraseElementByKey(e.id)},channelz.getChannelzHandlers=N,channelz.getChannelzServiceDefinition=O,channelz.setup=function(){(0,s.registerAdminService)(O,N)};const e=require$$0$3,t=require$$1,r=requireConnectivityState(),n=requireConstants(),i=requireSubchannelAddress(),s=requireAdmin(),a=requireMakeClient();function o(e){return{channel_id:e.id,name:e.name}}function l(e){return{subchannel_id:e.id,name:e.name}}function c(e){return{socket_id:e.id,name:e.name}}const u=100;channelz.ChannelzTraceStub=class{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:y(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}};channelz.ChannelzTrace=class{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(e,t,r){const n=new Date;this.events.push({description:t,severity:e,timestamp:n,childChannel:"channel"===(null==r?void 0:r.kind)?r:void 0,childSubchannel:"subchannel"===(null==r?void 0:r.kind)?r:void 0}),this.events.length>=64&&(this.events=this.events.slice(32)),this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:y(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map(e=>({description:e.description,severity:e.severity,timestamp:y(e.timestamp),channel_ref:e.childChannel?o(e.childChannel):null,subchannel_ref:e.childSubchannel?l(e.childSubchannel):null}))}}};class h{constructor(){this.channelChildren=new t.OrderedMap,this.subchannelChildren=new t.OrderedMap,this.socketChildren=new t.OrderedMap,this.trackerMap={channel:this.channelChildren,subchannel:this.subchannelChildren,socket:this.socketChildren}}refChild(e){const t=this.trackerMap[e.kind],r=t.find(e.id);r.equals(t.end())?t.setElement(e.id,{ref:e,count:1},r):r.pointer[1].count+=1}unrefChild(e){const t=this.trackerMap[e.kind],r=t.getElementByKey(e.id);void 0!==r&&(r.count-=1,0===r.count&&t.eraseElementByKey(e.id))}getChildLists(){return{channels:this.channelChildren,subchannels:this.subchannelChildren,sockets:this.socketChildren}}}channelz.ChannelzChildrenTracker=h;channelz.ChannelzChildrenTrackerStub=class extends h{refChild(){}unrefChild(){}};class d{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}}channelz.ChannelzCallTracker=d;channelz.ChannelzCallTrackerStub=class extends d{addCallStarted(){}addCallSucceeded(){}addCallFailed(){}};const p={channel:new t.OrderedMap,subchannel:new t.OrderedMap,server:new t.OrderedMap,socket:new t.OrderedMap},f=e=>{let t=1;const r=p[e];return(n,i,s)=>{const a=t++,o={id:a,name:n,kind:e};return s&&r.setElement(a,{ref:o,getInfo:i}),o}};function g(e){if(""===e)return[];const t=e.split(":").map(e=>function(e){const t=Number.parseInt(e,16);return[t/256|0,t%256]}(e));return[].concat(...t)}function v(e){return Buffer.from(Uint8Array.from(e.split(".").map(e=>Number.parseInt(e))))}function m(t){if((0,e.isIPv4)(t))return v(t);if(function(t){return(0,e.isIPv6)(t)&&t.toLowerCase().startsWith("::ffff:")&&(0,e.isIPv4)(t.substring(7))}(t))return v(t.substring(7));if((0,e.isIPv6)(t)){let e,r;const n=t.indexOf("::");-1===n?(e=t,r=""):(e=t.substring(0,n),r=t.substring(n+2));const i=Buffer.from(g(e)),s=Buffer.from(g(r)),a=Buffer.alloc(16-i.length-s.length,0);return Buffer.concat([i,a,s])}return null}function A(e){switch(e){case r.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case r.ConnectivityState.IDLE:return{state:"IDLE"};case r.ConnectivityState.READY:return{state:"READY"};case r.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case r.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function y(e){if(!e)return null;const t=e.getTime();return{seconds:t/1e3|0,nanos:t%1e3*1e6}}function C(e){const t=e.getInfo(),r=[],n=[];return t.children.channels.forEach(e=>{r.push(o(e[1].ref))}),t.children.subchannels.forEach(e=>{n.push(l(e[1].ref))}),{ref:o(e.ref),data:{target:t.target,state:A(t.state),calls_started:t.callTracker.callsStarted,calls_succeeded:t.callTracker.callsSucceeded,calls_failed:t.callTracker.callsFailed,last_call_started_timestamp:y(t.callTracker.lastCallStartedTimestamp),trace:t.trace.getTraceMessage()},channel_ref:r,subchannel_ref:n}}function S(e,t){const r=parseInt(e.request.channel_id,10),i=p.channel.getElementByKey(r);void 0!==i?t(null,{channel:C(i)}):t({code:n.Status.NOT_FOUND,details:"No channel data found for id "+r})}function E(e,t){const r=parseInt(e.request.max_results,10)||u,n=[],i=parseInt(e.request.start_channel_id,10),s=p.channel;let a;for(a=s.lowerBound(i);!a.equals(s.end())&&n.length<r;a=a.next())n.push(C(a.pointer[1]));t(null,{channel:n,end:a.equals(s.end())})}function _(e){const t=e.getInfo(),r=[];return t.listenerChildren.sockets.forEach(e=>{r.push(c(e[1].ref))}),{ref:(n=e.ref,{server_id:n.id}),data:{calls_started:t.callTracker.callsStarted,calls_succeeded:t.callTracker.callsSucceeded,calls_failed:t.callTracker.callsFailed,last_call_started_timestamp:y(t.callTracker.lastCallStartedTimestamp),trace:t.trace.getTraceMessage()},listen_socket:r};var n}function b(e,t){const r=parseInt(e.request.server_id,10),i=p.server.getElementByKey(r);void 0!==i?t(null,{server:_(i)}):t({code:n.Status.NOT_FOUND,details:"No server data found for id "+r})}function T(e,t){const r=parseInt(e.request.max_results,10)||u,n=parseInt(e.request.start_server_id,10),i=p.server,s=[];let a;for(a=i.lowerBound(n);!a.equals(i.end())&&s.length<r;a=a.next())s.push(_(a.pointer[1]));t(null,{server:s,end:a.equals(i.end())})}function R(e,t){const r=parseInt(e.request.subchannel_id,10),i=p.subchannel.getElementByKey(r);if(void 0===i)return void t({code:n.Status.NOT_FOUND,details:"No subchannel data found for id "+r});const s=i.getInfo(),a=[];s.children.sockets.forEach(e=>{a.push(c(e[1].ref))});t(null,{subchannel:{ref:l(i.ref),data:{target:s.target,state:A(s.state),calls_started:s.callTracker.callsStarted,calls_succeeded:s.callTracker.callsSucceeded,calls_failed:s.callTracker.callsFailed,last_call_started_timestamp:y(s.callTracker.lastCallStartedTimestamp),trace:s.trace.getTraceMessage()},socket_ref:a}})}function x(e){var t;return(0,i.isTcpSubchannelAddress)(e)?{address:"tcpip_address",tcpip_address:{ip_address:null!==(t=m(e.host))&&void 0!==t?t:void 0,port:e.port}}:{address:"uds_address",uds_address:{filename:e.path}}}function w(e,t){var r,i,s,a,o;const l=parseInt(e.request.socket_id,10),u=p.socket.getElementByKey(l);if(void 0===u)return void t({code:n.Status.NOT_FOUND,details:"No socket data found for id "+l});const h=u.getInfo(),d=h.security?{model:"tls",tls:{cipher_suite:h.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:null!==(r=h.security.cipherSuiteStandardName)&&void 0!==r?r:void 0,other_name:null!==(i=h.security.cipherSuiteOtherName)&&void 0!==i?i:void 0,local_certificate:null!==(s=h.security.localCertificate)&&void 0!==s?s:void 0,remote_certificate:null!==(a=h.security.remoteCertificate)&&void 0!==a?a:void 0}}:null;t(null,{socket:{ref:c(u.ref),local:h.localAddress?x(h.localAddress):null,remote:h.remoteAddress?x(h.remoteAddress):null,remote_name:null!==(o=h.remoteName)&&void 0!==o?o:void 0,security:d,data:{keep_alives_sent:h.keepAlivesSent,streams_started:h.streamsStarted,streams_succeeded:h.streamsSucceeded,streams_failed:h.streamsFailed,last_local_stream_created_timestamp:y(h.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:y(h.lastRemoteStreamCreatedTimestamp),messages_received:h.messagesReceived,messages_sent:h.messagesSent,last_message_received_timestamp:y(h.lastMessageReceivedTimestamp),last_message_sent_timestamp:y(h.lastMessageSentTimestamp),local_flow_control_window:h.localFlowControlWindow?{value:h.localFlowControlWindow}:null,remote_flow_control_window:h.remoteFlowControlWindow?{value:h.remoteFlowControlWindow}:null}}})}function k(e,t){const r=parseInt(e.request.server_id,10),i=p.server.getElementByKey(r);if(void 0===i)return void t({code:n.Status.NOT_FOUND,details:"No server data found for id "+r});const s=parseInt(e.request.start_socket_id,10),a=parseInt(e.request.max_results,10)||u,o=i.getInfo().sessionChildren.sockets,l=[];let h;for(h=o.lowerBound(s);!h.equals(o.end())&&l.length<a;h=h.next())l.push(c(h.pointer[1].ref));t(null,{socket_ref:l,end:h.equals(o.end())})}function N(){return{GetChannel:S,GetTopChannels:E,GetServer:b,GetServers:T,GetSubchannel:R,GetSocket:w,GetServerSockets:k}}channelz.registerChannelzChannel=f("channel"),channelz.registerChannelzSubchannel=f("subchannel"),channelz.registerChannelzServer=f("server"),channelz.registerChannelzSocket=f("socket");let I=null;function O(){if(I)return I;const e=(0,requireSrc$1().loadSync)("channelz.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto`]}),t=(0,a.loadPackageDefinition)(e);return I=t.grpc.channelz.v1.Channelz.service,I}return channelz}var singleSubchannelChannel={},callNumber={},hasRequiredCallNumber;function requireCallNumber(){if(hasRequiredCallNumber)return callNumber;hasRequiredCallNumber=1,Object.defineProperty(callNumber,"__esModule",{value:!0}),callNumber.getNextCallNumber=function(){return e++};let e=0;return callNumber}var compressionFilter={},compressionAlgorithms={},hasRequiredCompressionAlgorithms;function requireCompressionAlgorithms(){return hasRequiredCompressionAlgorithms||(hasRequiredCompressionAlgorithms=1,Object.defineProperty(compressionAlgorithms,"__esModule",{value:!0}),compressionAlgorithms.CompressionAlgorithms=void 0,function(e){e[e.identity=0]="identity",e[e.deflate=1]="deflate",e[e.gzip=2]="gzip"}(e||(compressionAlgorithms.CompressionAlgorithms=e={}))),compressionAlgorithms;var e}var filter={},hasRequiredFilter,hasRequiredCompressionFilter;function requireFilter(){if(hasRequiredFilter)return filter;hasRequiredFilter=1,Object.defineProperty(filter,"__esModule",{value:!0}),filter.BaseFilter=void 0;return filter.BaseFilter=class{async sendMetadata(e){return e}receiveMetadata(e){return e}async sendMessage(e){return e}async receiveMessage(e){return e}receiveTrailers(e){return e}},filter}function requireCompressionFilter(){if(hasRequiredCompressionFilter)return compressionFilter;hasRequiredCompressionFilter=1,Object.defineProperty(compressionFilter,"__esModule",{value:!0}),compressionFilter.CompressionFilterFactory=compressionFilter.CompressionFilter=void 0;const e=require$$0$5,t=requireCompressionAlgorithms(),r=requireConstants(),n=requireFilter(),i=requireLogging();class s{async writeMessage(e,t){let r=e;t&&(r=await this.compressMessage(r));const n=Buffer.allocUnsafe(r.length+5);return n.writeUInt8(t?1:0,0),n.writeUInt32BE(r.length,1),r.copy(n,5),n}async readMessage(e){const t=1===e.readUInt8(0);let r=e.slice(5);return t&&(r=await this.decompressMessage(r)),r}}class a extends s{async compressMessage(e){return e}async writeMessage(e,t){const r=Buffer.allocUnsafe(e.length+5);return r.writeUInt8(0,0),r.writeUInt32BE(e.length,1),e.copy(r,5),r}decompressMessage(e){return Promise.reject(new Error('Received compressed message but "grpc-encoding" header was identity'))}}class o extends s{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(t){return new Promise((r,n)=>{e.deflate(t,(e,t)=>{e?n(e):r(t)})})}decompressMessage(t){return new Promise((n,i)=>{let s=0;const a=[],o=e.createInflate();o.on("data",e=>{a.push(e),s+=e.byteLength,-1!==this.maxRecvMessageLength&&s>this.maxRecvMessageLength&&(o.destroy(),i({code:r.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),o.on("end",()=>{n(Buffer.concat(a))}),o.write(t),o.end()})}}class l extends s{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(t){return new Promise((r,n)=>{e.gzip(t,(e,t)=>{e?n(e):r(t)})})}decompressMessage(t){return new Promise((n,i)=>{let s=0;const a=[],o=e.createGunzip();o.on("data",e=>{a.push(e),s+=e.byteLength,-1!==this.maxRecvMessageLength&&s>this.maxRecvMessageLength&&(o.destroy(),i({code:r.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),o.on("end",()=>{n(Buffer.concat(a))}),o.write(t),o.end()})}}class c extends s{constructor(e){super(),this.compressionName=e}compressMessage(e){return Promise.reject(new Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(e){return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`))}}function u(e,t){switch(e){case"identity":return new a;case"deflate":return new o(t);case"gzip":return new l(t);default:return new c(e)}}class h extends n.BaseFilter{constructor(e,n){var s,o,l;super(),this.sharedFilterConfig=n,this.sendCompression=new a,this.receiveCompression=new a,this.currentCompressionAlgorithm="identity";const c=e["grpc.default_compression_algorithm"];if(this.maxReceiveMessageLength=null!==(s=e["grpc.max_receive_message_length"])&&void 0!==s?s:r.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.maxSendMessageLength=null!==(o=e["grpc.max_send_message_length"])&&void 0!==o?o:r.DEFAULT_MAX_SEND_MESSAGE_LENGTH,void 0!==c)if("number"==typeof(h=c)&&"string"==typeof t.CompressionAlgorithms[h]){const e=t.CompressionAlgorithms[c],r=null===(l=n.serverSupportedEncodingHeader)||void 0===l?void 0:l.split(",");r&&!r.includes(e)||(this.currentCompressionAlgorithm=e,this.sendCompression=u(this.currentCompressionAlgorithm,-1))}else i.log(r.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${c}`);var h}async sendMetadata(e){const t=await e;return t.set("grpc-accept-encoding","identity,deflate,gzip"),t.set("accept-encoding","identity"),"identity"===this.currentCompressionAlgorithm?t.remove("grpc-encoding"):t.set("grpc-encoding",this.currentCompressionAlgorithm),t}receiveMetadata(e){const t=e.get("grpc-encoding");if(t.length>0){const e=t[0];"string"==typeof e&&(this.receiveCompression=u(e,this.maxReceiveMessageLength))}e.remove("grpc-encoding");const r=e.get("grpc-accept-encoding")[0];if(r){this.sharedFilterConfig.serverSupportedEncodingHeader=r;r.split(",").includes(this.currentCompressionAlgorithm)||(this.sendCompression=new a,this.currentCompressionAlgorithm="identity")}return e.remove("grpc-accept-encoding"),e}async sendMessage(e){var t;const n=await e;if(-1!==this.maxSendMessageLength&&n.message.length>this.maxSendMessageLength)throw{code:r.Status.RESOURCE_EXHAUSTED,details:`Attempted to send message with a size larger than ${this.maxSendMessageLength}`};let i;return i=!(this.sendCompression instanceof a)&&!(2&(null!==(t=n.flags)&&void 0!==t?t:0)),{message:await this.sendCompression.writeMessage(n.message,i),flags:n.flags}}async receiveMessage(e){return this.receiveCompression.readMessage(await e)}}compressionFilter.CompressionFilter=h;return compressionFilter.CompressionFilterFactory=class{constructor(e,t){this.options=t,this.sharedFilterConfig={}}createFilter(){return new h(this.options,this.sharedFilterConfig)}},compressionFilter}var controlPlaneStatus={},hasRequiredControlPlaneStatus;function requireControlPlaneStatus(){if(hasRequiredControlPlaneStatus)return controlPlaneStatus;hasRequiredControlPlaneStatus=1,Object.defineProperty(controlPlaneStatus,"__esModule",{value:!0}),controlPlaneStatus.restrictControlPlaneStatusCode=function(r,n){return t.includes(r)?{code:e.Status.INTERNAL,details:`Invalid status from control plane: ${r} ${e.Status[r]} ${n}`}:{code:r,details:n}};const e=requireConstants(),t=[e.Status.OK,e.Status.INVALID_ARGUMENT,e.Status.NOT_FOUND,e.Status.ALREADY_EXISTS,e.Status.FAILED_PRECONDITION,e.Status.ABORTED,e.Status.OUT_OF_RANGE,e.Status.DATA_LOSS];return controlPlaneStatus}var deadline={},hasRequiredDeadline;function requireDeadline(){if(hasRequiredDeadline)return deadline;hasRequiredDeadline=1,Object.defineProperty(deadline,"__esModule",{value:!0}),deadline.minDeadline=function(...e){let t=1/0;for(const r of e){const e=r instanceof Date?r.getTime():r;e<t&&(t=e)}return t},deadline.getDeadlineTimeoutString=function(t){const r=(new Date).getTime();t instanceof Date&&(t=t.getTime());const n=Math.max(t-r,0);for(const[t,r]of e){const e=n/r;if(e<1e8)return String(Math.ceil(e))+t}throw new Error("Deadline is too far in the future")},deadline.getRelativeTimeout=function(e){const r=e instanceof Date?e.getTime():e,n=(new Date).getTime(),i=r-n;return i<0?0:i>t?1/0:i},deadline.deadlineToString=function(e){if(e instanceof Date)return e.toISOString();{const t=new Date(e);return Number.isNaN(t.getTime())?""+e:t.toISOString()}},deadline.formatDateDifference=function(e,t){return((t.getTime()-e.getTime())/1e3).toFixed(3)+"s"};const e=[["m",1],["S",1e3],["M",6e4],["H",36e5]];const t=2147483647;return deadline}var filterStack={},hasRequiredFilterStack,hasRequiredSingleSubchannelChannel,hasRequiredSubchannel;function requireFilterStack(){if(hasRequiredFilterStack)return filterStack;hasRequiredFilterStack=1,Object.defineProperty(filterStack,"__esModule",{value:!0}),filterStack.FilterStackFactory=filterStack.FilterStack=void 0;class e{constructor(e){this.filters=e}sendMetadata(e){let t=e;for(let e=0;e<this.filters.length;e++)t=this.filters[e].sendMetadata(t);return t}receiveMetadata(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveMetadata(t);return t}sendMessage(e){let t=e;for(let e=0;e<this.filters.length;e++)t=this.filters[e].sendMessage(t);return t}receiveMessage(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveMessage(t);return t}receiveTrailers(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveTrailers(t);return t}push(e){this.filters.unshift(...e)}getFilters(){return this.filters}}filterStack.FilterStack=e;class t{constructor(e){this.factories=e}push(e){this.factories.unshift(...e)}clone(){return new t([...this.factories])}createFilter(){return new e(this.factories.map(e=>e.createFilter()))}}return filterStack.FilterStackFactory=t,filterStack}function requireSingleSubchannelChannel(){if(hasRequiredSingleSubchannelChannel)return singleSubchannelChannel;hasRequiredSingleSubchannelChannel=1,Object.defineProperty(singleSubchannelChannel,"__esModule",{value:!0}),singleSubchannelChannel.SingleSubchannelChannel=void 0;const e=requireCallNumber(),t=requireChannelz(),r=requireCompressionFilter(),n=requireConnectivityState(),i=requireConstants(),s=requireControlPlaneStatus(),a=requireDeadline(),o=requireFilterStack(),l=requireMetadata(),c=requireResolver(),u=requireUriParser();class h{constructor(e,t,r,n,s){var o,l;this.subchannel=e,this.method=t,this.options=n,this.callNumber=s,this.childCall=null,this.pendingMessage=null,this.readPending=!1,this.halfClosePending=!1,this.pendingStatus=null,this.readFilterPending=!1,this.writeFilterPending=!1;const c=this.method.split("/");let h="";c.length>=2&&(h=c[1]);const d=null!==(l=null===(o=(0,u.splitHostPort)(this.options.host))||void 0===o?void 0:o.host)&&void 0!==l?l:"localhost";this.serviceUrl=`https://${d}/${h}`;const p=(0,a.getRelativeTimeout)(n.deadline);p!==1/0&&(p<=0?this.cancelWithStatus(i.Status.DEADLINE_EXCEEDED,"Deadline exceeded"):setTimeout(()=>{this.cancelWithStatus(i.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},p)),this.filterStack=r.createFilter()}cancelWithStatus(e,t){this.childCall?this.childCall.cancelWithStatus(e,t):this.pendingStatus={code:e,details:t,metadata:new l.Metadata}}getPeer(){var e,t;return null!==(t=null===(e=this.childCall)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.subchannel.getAddress()}async start(e,t){if(this.pendingStatus)return void t.onReceiveStatus(this.pendingStatus);if(this.subchannel.getConnectivityState()!==n.ConnectivityState.READY)return void t.onReceiveStatus({code:i.Status.UNAVAILABLE,details:"Subchannel not ready",metadata:new l.Metadata});const r=await this.filterStack.sendMetadata(Promise.resolve(e));let a;try{a=await this.subchannel.getCallCredentials().generateMetadata({method_name:this.method,service_url:this.serviceUrl})}catch(e){const r=e,{code:n,details:a}=(0,s.restrictControlPlaneStatusCode)("number"==typeof r.code?r.code:i.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${r.message}`);return void t.onReceiveStatus({code:n,details:a,metadata:new l.Metadata})}a.merge(r);const o={onReceiveMetadata:async e=>{t.onReceiveMetadata(await this.filterStack.receiveMetadata(e))},onReceiveMessage:async e=>{this.readFilterPending=!0;const r=await this.filterStack.receiveMessage(e);this.readFilterPending=!1,t.onReceiveMessage(r),this.pendingStatus&&t.onReceiveStatus(this.pendingStatus)},onReceiveStatus:async e=>{const r=await this.filterStack.receiveTrailers(e);this.readFilterPending?this.pendingStatus=r:t.onReceiveStatus(r)}};this.childCall=this.subchannel.createCall(a,this.options.host,this.method,o),this.readPending&&this.childCall.startRead(),this.pendingMessage&&this.childCall.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.halfClosePending&&!this.writeFilterPending&&this.childCall.halfClose()}async sendMessageWithContext(e,t){this.writeFilterPending=!0;const r=await this.filterStack.sendMessage(Promise.resolve({message:t,flags:e.flags}));this.writeFilterPending=!1,this.childCall?(this.childCall.sendMessageWithContext(e,r.message),this.halfClosePending&&this.childCall.halfClose()):this.pendingMessage={context:e,message:r.message}}startRead(){this.childCall?this.childCall.startRead():this.readPending=!0}halfClose(){this.childCall&&!this.writeFilterPending?this.childCall.halfClose():this.halfClosePending=!0}getCallNumber(){return this.callNumber}setCredentials(e){throw new Error("Method not implemented.")}getAuthContext(){return this.childCall?this.childCall.getAuthContext():null}}return singleSubchannelChannel.SingleSubchannelChannel=class{constructor(e,n,i){this.subchannel=e,this.target=n,this.channelzEnabled=!1,this.channelzTrace=new t.ChannelzTrace,this.callTracker=new t.ChannelzCallTracker,this.childrenTracker=new t.ChannelzChildrenTracker,this.channelzEnabled=0!==i["grpc.enable_channelz"],this.channelzRef=(0,t.registerChannelzChannel)((0,u.uriToString)(n),()=>({target:`${(0,u.uriToString)(n)} (${e.getAddress()})`,state:this.subchannel.getConnectivityState(),trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}),this.channelzEnabled),this.channelzEnabled&&this.childrenTracker.refChild(e.getChannelzRef()),this.filterStackFactory=new o.FilterStackFactory([new r.CompressionFilterFactory(this,i)])}close(){this.channelzEnabled&&this.childrenTracker.unrefChild(this.subchannel.getChannelzRef()),(0,t.unregisterChannelzRef)(this.channelzRef)}getTarget(){return(0,u.uriToString)(this.target)}getConnectivityState(e){throw new Error("Method not implemented.")}watchConnectivityState(e,t,r){throw new Error("Method not implemented.")}getChannelzRef(){return this.channelzRef}createCall(t,r){const n={deadline:r,host:(0,c.getDefaultAuthority)(this.target),flags:i.Propagate.DEFAULTS,parentCall:null};return new h(this.subchannel,t,this.filterStackFactory,n,(0,e.getNextCallNumber)())}},singleSubchannelChannel}function requireSubchannel(){if(hasRequiredSubchannel)return subchannel;hasRequiredSubchannel=1,Object.defineProperty(subchannel,"__esModule",{value:!0}),subchannel.Subchannel=void 0;const e=requireConnectivityState(),t=requireBackoffTimeout(),r=requireLogging(),n=requireConstants(),i=requireUriParser(),s=requireSubchannelAddress(),a=requireChannelz(),o=requireSingleSubchannelChannel();return subchannel.Subchannel=class{constructor(r,n,i,o,l){var c;this.channelTarget=r,this.subchannelAddress=n,this.options=i,this.connector=l,this.connectivityState=e.ConnectivityState.IDLE,this.transport=null,this.continueConnecting=!1,this.stateListeners=new Set,this.refcount=0,this.channelzEnabled=!0,this.dataProducers=new Map,this.subchannelChannel=null;const u={initialDelay:i["grpc.initial_reconnect_backoff_ms"],maxDelay:i["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new t.BackoffTimeout(()=>{this.handleBackoffTimer()},u),this.backoffTimeout.unref(),this.subchannelAddressString=(0,s.subchannelAddressToString)(n),this.keepaliveTime=null!==(c=i["grpc.keepalive_time_ms"])&&void 0!==c?c:-1,0===i["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.channelzTrace=new a.ChannelzTraceStub,this.callTracker=new a.ChannelzCallTrackerStub,this.childrenTracker=new a.ChannelzChildrenTrackerStub,this.streamTracker=new a.ChannelzCallTrackerStub):(this.channelzTrace=new a.ChannelzTrace,this.callTracker=new a.ChannelzCallTracker,this.childrenTracker=new a.ChannelzChildrenTracker,this.streamTracker=new a.ChannelzCallTracker),this.channelzRef=(0,a.registerChannelzSubchannel)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.trace("Subchannel constructed with options "+JSON.stringify(i,void 0,2)),this.secureConnector=o._createSecureConnector(r,i)}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}trace(e){r.trace(n.LogVerbosity.DEBUG,"subchannel","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}refTrace(e){r.trace(n.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}handleBackoffTimer(){this.continueConnecting?this.transitionToState([e.ConnectivityState.TRANSIENT_FAILURE],e.ConnectivityState.CONNECTING):this.transitionToState([e.ConnectivityState.TRANSIENT_FAILURE],e.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}startConnectingInternal(){let t=this.options;if(t["grpc.keepalive_time_ms"]){const e=Math.min(this.keepaliveTime,2147483647);t=Object.assign(Object.assign({},t),{"grpc.keepalive_time_ms":e})}this.connector.connect(this.subchannelAddress,this.secureConnector,t).then(t=>{this.transitionToState([e.ConnectivityState.CONNECTING],e.ConnectivityState.READY)?(this.transport=t,this.channelzEnabled&&this.childrenTracker.refChild(t.getChannelzRef()),t.addDisconnectListener(t=>{this.transitionToState([e.ConnectivityState.READY],e.ConnectivityState.IDLE),t&&this.keepaliveTime>0&&(this.keepaliveTime*=2,r.log(n.LogVerbosity.ERROR,`Connection to ${(0,i.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`))})):t.shutdown()},t=>{this.transitionToState([e.ConnectivityState.CONNECTING],e.ConnectivityState.TRANSIENT_FAILURE,`${t}`)})}transitionToState(t,r,n){var i,s;if(-1===t.indexOf(this.connectivityState))return!1;n?this.trace(e.ConnectivityState[this.connectivityState]+" -> "+e.ConnectivityState[r]+' with error "'+n+'"'):this.trace(e.ConnectivityState[this.connectivityState]+" -> "+e.ConnectivityState[r]),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+e.ConnectivityState[r]);const a=this.connectivityState;switch(this.connectivityState=r,r){case e.ConnectivityState.READY:this.stopBackoff();break;case e.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case e.ConnectivityState.TRANSIENT_FAILURE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),null===(i=this.transport)||void 0===i||i.shutdown(),this.transport=null,this.backoffTimeout.isRunning()||process.nextTick(()=>{this.handleBackoffTimer()});break;case e.ConnectivityState.IDLE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),null===(s=this.transport)||void 0===s||s.shutdown(),this.transport=null;break;default:throw new Error(`Invalid state: unknown ConnectivityState ${r}`)}for(const e of this.stateListeners)e(this,a,r,this.keepaliveTime,n);return!0}ref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,0===this.refcount&&(this.channelzTrace.addTrace("CT_INFO","Shutting down"),(0,a.unregisterChannelzRef)(this.channelzRef),this.secureConnector.destroy(),process.nextTick(()=>{this.transitionToState([e.ConnectivityState.CONNECTING,e.ConnectivityState.READY],e.ConnectivityState.IDLE)}))}unrefIfOneRef(){return 1===this.refcount&&(this.unref(),!0)}createCall(e,t,r,i){if(!this.transport)throw new Error("Cannot create call, subchannel not READY");let s;return this.channelzEnabled?(this.callTracker.addCallStarted(),this.streamTracker.addCallStarted(),s={onCallEnd:e=>{e.code===n.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()}}):s={},this.transport.createCall(e,t,r,i,s)}startConnecting(){process.nextTick(()=>{this.transitionToState([e.ConnectivityState.IDLE],e.ConnectivityState.CONNECTING)||this.connectivityState===e.ConnectivityState.TRANSIENT_FAILURE&&(this.continueConnecting=!0)})}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(e){this.stateListeners.add(e)}removeConnectivityStateListener(e){this.stateListeners.delete(e)}resetBackoff(){process.nextTick(()=>{this.backoffTimeout.reset(),this.transitionToState([e.ConnectivityState.TRANSIENT_FAILURE],e.ConnectivityState.CONNECTING)})}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}isHealthy(){return!0}addHealthStateWatcher(e){}removeHealthStateWatcher(e){}getRealSubchannel(){return this}realSubchannelEquals(e){return e.getRealSubchannel()===this}throttleKeepalive(e){e>this.keepaliveTime&&(this.keepaliveTime=e)}getCallCredentials(){return this.secureConnector.getCallCredentials()}getChannel(){return this.subchannelChannel||(this.subchannelChannel=new o.SingleSubchannelChannel(this,this.channelTarget,this.options)),this.subchannelChannel}addDataWatcher(e){throw new Error("Not implemented")}getOrCreateDataProducer(e,t){const r=this.dataProducers.get(e);if(r)return r;const n=t(this);return this.dataProducers.set(e,n),n}removeDataProducer(e){this.dataProducers.delete(e)}},subchannel}var transport={},http_proxy={},resolverDns={},environment={},hasRequiredEnvironment,hasRequiredResolverDns,hasRequiredHttp_proxy;function requireEnvironment(){return hasRequiredEnvironment||(hasRequiredEnvironment=1,Object.defineProperty(environment,"__esModule",{value:!0}),environment.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=void 0,environment.GRPC_NODE_USE_ALTERNATIVE_RESOLVER="true"===(null!==(e=process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)&&void 0!==e?e:"false")),environment;var e}function requireResolverDns(){return hasRequiredResolverDns||(hasRequiredResolverDns=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_PORT=void 0,e.setup=function(){(0,t.registerResolver)("dns",f),(0,t.registerDefaultScheme)("dns")};const t=requireResolver(),r=require$$1$4,n=requireServiceConfig(),i=requireConstants(),s=requireCallInterface(),a=requireMetadata(),o=requireLogging(),l=requireConstants(),c=requireUriParser(),u=require$$0$3,h=requireBackoffTimeout(),d=requireEnvironment();function p(e){o.trace(l.LogVerbosity.DEBUG,"dns_resolver",e)}e.DEFAULT_PORT=443;class f{constructor(t,n,s){var o,l,d;this.target=t,this.listener=n,this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.continueResolving=!1,this.isNextResolutionTimerRunning=!1,this.isServiceConfigEnabled=!0,this.returnedIpResult=!1,this.alternativeResolver=new r.promises.Resolver,p("Resolver constructed for target "+(0,c.uriToString)(t)),t.authority&&this.alternativeResolver.setServers([t.authority]);const f=(0,c.splitHostPort)(t.path);null===f?(this.ipResult=null,this.dnsHostname=null,this.port=null):(0,u.isIPv4)(f.host)||(0,u.isIPv6)(f.host)?(this.ipResult=[{addresses:[{host:f.host,port:null!==(o=f.port)&&void 0!==o?o:e.DEFAULT_PORT}]}],this.dnsHostname=null,this.port=null):(this.ipResult=null,this.dnsHostname=f.host,this.port=null!==(l=f.port)&&void 0!==l?l:e.DEFAULT_PORT),this.percentage=100*Math.random(),1===s["grpc.service_config_disable_resolution"]&&(this.isServiceConfigEnabled=!1),this.defaultResolutionError={code:i.Status.UNAVAILABLE,details:`Name resolution failed for target ${(0,c.uriToString)(this.target)}`,metadata:new a.Metadata};const g={initialDelay:s["grpc.initial_reconnect_backoff_ms"],maxDelay:s["grpc.max_reconnect_backoff_ms"]};this.backoff=new h.BackoffTimeout(()=>{this.continueResolving&&this.startResolutionWithBackoff()},g),this.backoff.unref(),this.minTimeBetweenResolutionsMs=null!==(d=s["grpc.dns_min_time_between_resolutions_ms"])&&void 0!==d?d:3e4,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(null!==this.ipResult)return this.returnedIpResult||(p("Returning IP address for target "+(0,c.uriToString)(this.target)),setImmediate(()=>{this.listener((0,s.statusOrFromValue)(this.ipResult),{},null,"")}),this.returnedIpResult=!0),this.backoff.stop(),this.backoff.reset(),void this.stopNextResolutionTimer();if(null===this.dnsHostname)p("Failed to parse DNS address "+(0,c.uriToString)(this.target)),setImmediate(()=>{this.listener((0,s.statusOrFromError)({code:i.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,c.uriToString)(this.target)}`}),{},null,"")}),this.stopNextResolutionTimer();else{if(null!==this.pendingLookupPromise)return;p("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;const e=this.dnsHostname;this.pendingLookupPromise=this.lookup(e),this.pendingLookupPromise.then(e=>{if(null===this.pendingLookupPromise)return;this.pendingLookupPromise=null,this.latestLookupResult=(0,s.statusOrFromValue)(e.map(e=>({addresses:[e]})));const t="["+e.map(e=>e.host+":"+e.port).join(",")+"]";p("Resolved addresses for target "+(0,c.uriToString)(this.target)+": "+t);const r=this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"");this.handleHealthStatus(r)},e=>{null!==this.pendingLookupPromise&&(p("Resolution error for target "+(0,c.uriToString)(this.target)+": "+e.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener((0,s.statusOrFromError)(this.defaultResolutionError),{},this.latestServiceConfigResult,""))}),this.isServiceConfigEnabled&&null===this.pendingTxtPromise&&(this.pendingTxtPromise=this.resolveTxt(e),this.pendingTxtPromise.then(e=>{if(null===this.pendingTxtPromise)return;let t;this.pendingTxtPromise=null;try{t=(0,n.extractAndSelectServiceConfig)(e,this.percentage),this.latestServiceConfigResult=t?(0,s.statusOrFromValue)(t):null}catch(e){this.latestServiceConfigResult=(0,s.statusOrFromError)({code:i.Status.UNAVAILABLE,details:`Parsing service config failed with error ${e.message}`})}null!==this.latestLookupResult&&this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"")},e=>{}))}}handleHealthStatus(e){e?(this.backoff.stop(),this.backoff.reset()):this.continueResolving=!0}async lookup(e){if(d.GRPC_NODE_USE_ALTERNATIVE_RESOLVER){p("Using alternative DNS resolver.");const t=await Promise.allSettled([this.alternativeResolver.resolve4(e),this.alternativeResolver.resolve6(e)]);if(t.every(e=>"rejected"===e.status))throw new Error(t[0].reason);return t.reduce((e,t)=>"fulfilled"===t.status?[...e,...t.value]:e,[]).map(e=>({host:e,port:+this.port}))}return(await r.promises.lookup(e,{all:!0})).map(e=>({host:e.address,port:+this.port}))}async resolveTxt(e){return d.GRPC_NODE_USE_ALTERNATIVE_RESOLVER?(p("Using alternative DNS resolver."),this.alternativeResolver.resolveTxt(e)):r.promises.resolveTxt(e)}startNextResolutionTimer(){var e,t;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=setTimeout(()=>{this.stopNextResolutionTimer(),this.continueResolving&&this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs),null===(t=(e=this.nextResolutionTimer).unref)||void 0===t||t.call(e),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){null===this.pendingLookupPromise&&(this.continueResolving=!1,this.backoff.runOnce(),this.startNextResolutionTimer(),this.startResolution())}updateResolution(){null===this.pendingLookupPromise&&(this.isNextResolutionTimerRunning||this.backoff.isRunning()?(this.isNextResolutionTimerRunning?p('resolution update delayed by "min time between resolutions" rate limit'):p("resolution update delayed by backoff timer until "+this.backoff.getEndTime().toISOString()),this.continueResolving=!0):this.startResolutionWithBackoff())}destroy(){this.continueResolving=!1,this.backoff.reset(),this.backoff.stop(),this.stopNextResolutionTimer(),this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.returnedIpResult=!1}static getDefaultAuthority(e){return e.path}}}(resolverDns)),resolverDns}function requireHttp_proxy(){if(hasRequiredHttp_proxy)return http_proxy;hasRequiredHttp_proxy=1,Object.defineProperty(http_proxy,"__esModule",{value:!0}),http_proxy.parseCIDR=h,http_proxy.mapProxyName=function(n,i){var s;const l={target:n,extraOptions:{}};if(0===(null!==(s=i["grpc.enable_http_proxy"])&&void 0!==s?s:1))return l;if("unix"===n.scheme)return l;const c=function(){let r,n="",i="";if(process.env.grpc_proxy)i="grpc_proxy",n=process.env.grpc_proxy;else if(process.env.https_proxy)i="https_proxy",n=process.env.https_proxy;else{if(!process.env.http_proxy)return{};i="http_proxy",n=process.env.http_proxy}try{r=new o.URL(n)}catch(r){return(0,e.log)(t.LogVerbosity.ERROR,`cannot parse value of "${i}" env var`),{}}if("http:"!==r.protocol)return(0,e.log)(t.LogVerbosity.ERROR,`"${r.protocol}" scheme not supported in proxy URI`),{};let s=null;r.username&&(r.password?((0,e.log)(t.LogVerbosity.INFO,"userinfo found in proxy URI"),s=decodeURIComponent(`${r.username}:${r.password}`)):s=r.username);const a=r.hostname;let l=r.port;""===l&&(l="80");const c={address:`${a}:${l}`};s&&(c.creds=s);return u("Proxy server "+c.address+" set by environment variable "+i),c}();if(!c.address)return l;const d=(0,a.splitHostPort)(n.path);if(!d)return l;if(function(e){for(const t of function(){let e=process.env.no_grpc_proxy,t="no_grpc_proxy";e||(e=process.env.no_proxy,t="no_proxy");return e?(u("No proxy server list set by environment variable "+t),e.split(",")):[]}()){const n=h(t);if((0,r.isIPv4)(e)&&n&&p(n,e))return!0;if(e.endsWith(t))return!0}return!1}(d.host))return u("Not using proxy for target in no_proxy list: "+(0,a.uriToString)(n)),l;const f={"grpc.http_connect_target":(0,a.uriToString)(n)};c.creds&&(f["grpc.http_connect_creds"]=c.creds);return{target:{scheme:"dns",path:c.address},extraOptions:f}},http_proxy.getProxiedConnection=function(r,i){var o;if(!("grpc.http_connect_target"in i))return Promise.resolve(null);const c=i["grpc.http_connect_target"],h=(0,a.parseUri)(c);if(null===h)return Promise.resolve(null);const d=(0,a.splitHostPort)(h.path);if(null===d)return Promise.resolve(null);const p=`${d.host}:${null!==(o=d.port)&&void 0!==o?o:l.DEFAULT_PORT}`,f={method:"CONNECT",path:p},g={Host:p};(0,s.isTcpSubchannelAddress)(r)?(f.host=r.host,f.port=r.port):f.socketPath=r.path;"grpc.http_connect_creds"in i&&(g["Proxy-Authorization"]="Basic "+Buffer.from(i["grpc.http_connect_creds"]).toString("base64"));f.headers=g;const v=(0,s.subchannelAddressToString)(r);return u("Using proxy "+v+" to connect to "+f.path),new Promise((r,i)=>{const s=n.request(f);s.once("connect",(n,a,o)=>{s.removeAllListeners(),a.removeAllListeners(),200===n.statusCode?(u("Successfully connected to "+f.path+" through proxy "+v),o.length>0&&a.unshift(o),u("Successfully established a plaintext connection to "+f.path+" through proxy "+v),r(a)):((0,e.log)(t.LogVerbosity.ERROR,"Failed to connect to "+f.path+" through proxy "+v+" with status "+n.statusCode),i())}),s.once("error",r=>{s.removeAllListeners(),(0,e.log)(t.LogVerbosity.ERROR,"Failed to connect to proxy "+v+" with error "+r.message),i()}),s.end()})};const e=requireLogging(),t=requireConstants(),r=require$$0$3,n=require$$3$1,i=requireLogging(),s=requireSubchannelAddress(),a=requireUriParser(),o=require$$6$1,l=requireResolverDns(),c="proxy";function u(e){i.trace(t.LogVerbosity.DEBUG,c,e)}function h(e){const t=e.split("/");if(2!==t.length)return null;const n=parseInt(t[1],10);return!(0,r.isIPv4)(t[0])||Number.isNaN(n)||n<0||n>32?null:{ip:d(t[0]),prefixLength:n}}function d(e){return e.split(".").reduce((e,t)=>(e<<8)+parseInt(t,10),0)}function p(e,t){const r=e.ip,n=-1<<32-e.prefixLength;return(d(t)&n)===(r&n)}return http_proxy}var subchannelCall={},streamDecoder={},hasRequiredStreamDecoder,hasRequiredSubchannelCall,hasRequiredTransport,hasRequiredSubchannelPool;function requireStreamDecoder(){if(hasRequiredStreamDecoder)return streamDecoder;var e;hasRequiredStreamDecoder=1,Object.defineProperty(streamDecoder,"__esModule",{value:!0}),streamDecoder.StreamDecoder=void 0,function(e){e[e.NO_DATA=0]="NO_DATA",e[e.READING_SIZE=1]="READING_SIZE",e[e.READING_MESSAGE=2]="READING_MESSAGE"}(e||(e={}));return streamDecoder.StreamDecoder=class{constructor(t){this.maxReadMessageLength=t,this.readState=e.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 r,n=0;const i=[];for(;n<t.length;)switch(this.readState){case e.NO_DATA:this.readCompressFlag=t.slice(n,n+1),n+=1,this.readState=e.READING_SIZE,this.readPartialSize.fill(0),this.readSizeRemaining=4,this.readMessageSize=0,this.readMessageRemaining=0,this.readPartialMessage=[];break;case e.READING_SIZE:if(r=Math.min(t.length-n,this.readSizeRemaining),t.copy(this.readPartialSize,4-this.readSizeRemaining,n,n+r),this.readSizeRemaining-=r,n+=r,0===this.readSizeRemaining){if(this.readMessageSize=this.readPartialSize.readUInt32BE(0),-1!==this.maxReadMessageLength&&this.readMessageSize>this.maxReadMessageLength)throw new Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);if(this.readMessageRemaining=this.readMessageSize,this.readMessageRemaining>0)this.readState=e.READING_MESSAGE;else{const t=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=e.NO_DATA,i.push(t)}}break;case e.READING_MESSAGE:if(r=Math.min(t.length-n,this.readMessageRemaining),this.readPartialMessage.push(t.slice(n,n+r)),this.readMessageRemaining-=r,n+=r,0===this.readMessageRemaining){const t=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),r=Buffer.concat(t,this.readMessageSize+5);this.readState=e.NO_DATA,i.push(r)}break;default:throw new Error("Unexpected read state")}return i}},streamDecoder}function requireSubchannelCall(){if(hasRequiredSubchannelCall)return subchannelCall;hasRequiredSubchannelCall=1,Object.defineProperty(subchannelCall,"__esModule",{value:!0}),subchannelCall.Http2SubchannelCall=void 0;const e=require$$0$6,t=require$$0$2,r=requireConstants(),n=requireMetadata(),i=requireStreamDecoder(),s=requireLogging(),a=requireConstants();function o(e){const t=`Received HTTP status code ${e}`;let i;switch(e){case 400:i=r.Status.INTERNAL;break;case 401:i=r.Status.UNAUTHENTICATED;break;case 403:i=r.Status.PERMISSION_DENIED;break;case 404:i=r.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:i=r.Status.UNAVAILABLE;break;default:i=r.Status.UNKNOWN}return{code:i,details:t,metadata:new n.Metadata}}return subchannelCall.Http2SubchannelCall=class{constructor(s,a,l,c,u){var h;this.http2Stream=s,this.callEventTracker=a,this.listener=l,this.transport=c,this.callId=u,this.isReadFilterPending=!1,this.isPushPending=!1,this.canPush=!1,this.readsClosed=!1,this.statusOutput=!1,this.unpushedReadMessages=[],this.finalStatus=null,this.internalError=null,this.serverEndedCall=!1,this.connectionDropped=!1;const d=null!==(h=c.getOptions()["grpc.max_receive_message_length"])&&void 0!==h?h:r.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;this.decoder=new i.StreamDecoder(d),s.on("response",(t,i)=>{let s="";for(const e of Object.keys(t))s+="\t\t"+e+": "+t[e]+"\n";if(this.trace("Received server headers:\n"+s),this.httpStatusCode=t[":status"],i&e.constants.NGHTTP2_FLAG_END_STREAM)this.handleTrailers(t);else{let e;try{e=n.Metadata.fromHttp2Headers(t)}catch(e){return void this.endCall({code:r.Status.UNKNOWN,details:e.message,metadata:new n.Metadata})}this.listener.onReceiveMetadata(e)}}),s.on("trailers",e=>{this.handleTrailers(e)}),s.on("data",e=>{if(this.statusOutput)return;let t;this.trace("receive HTTP/2 data frame of length "+e.length);try{t=this.decoder.write(e)}catch(e){if(void 0!==this.httpStatusCode&&200!==this.httpStatusCode){const e=o(this.httpStatusCode);this.cancelWithStatus(e.code,e.details)}else this.cancelWithStatus(r.Status.RESOURCE_EXHAUSTED,e.message);return}for(const e of t)this.trace("parsed message of length "+e.length),this.callEventTracker.addMessageReceived(),this.tryPush(e)}),s.on("end",()=>{this.readsClosed=!0,this.maybeOutputStatus()}),s.on("close",()=>{this.serverEndedCall=!0,process.nextTick(()=>{var t;if(this.trace("HTTP/2 stream closed with code "+s.rstCode),(null===(t=this.finalStatus)||void 0===t?void 0:t.code)===r.Status.OK)return;let i,a="";switch(s.rstCode){case e.constants.NGHTTP2_NO_ERROR:if(null!==this.finalStatus)return;if(this.httpStatusCode&&200!==this.httpStatusCode){const e=o(this.httpStatusCode);i=e.code,a=e.details}else i=r.Status.INTERNAL,a=`Received RST_STREAM with code ${s.rstCode} (Call ended without gRPC status)`;break;case e.constants.NGHTTP2_REFUSED_STREAM:i=r.Status.UNAVAILABLE,a="Stream refused by server";break;case e.constants.NGHTTP2_CANCEL:this.connectionDropped?(i=r.Status.UNAVAILABLE,a="Connection dropped"):(i=r.Status.CANCELLED,a="Call cancelled");break;case e.constants.NGHTTP2_ENHANCE_YOUR_CALM:i=r.Status.RESOURCE_EXHAUSTED,a="Bandwidth exhausted or memory limit exceeded";break;case e.constants.NGHTTP2_INADEQUATE_SECURITY:i=r.Status.PERMISSION_DENIED,a="Protocol not secure enough";break;case e.constants.NGHTTP2_INTERNAL_ERROR:i=r.Status.INTERNAL,null===this.internalError?a=`Received RST_STREAM with code ${s.rstCode} (Internal server error)`:"ECONNRESET"===this.internalError.code||"ETIMEDOUT"===this.internalError.code?(i=r.Status.UNAVAILABLE,a=this.internalError.message):a=`Received RST_STREAM with code ${s.rstCode} triggered by internal client error: ${this.internalError.message}`;break;default:i=r.Status.INTERNAL,a=`Received RST_STREAM with code ${s.rstCode}`}this.endCall({code:i,details:a,metadata:new n.Metadata,rstCode:s.rstCode})})}),s.on("error",e=>{"ERR_HTTP2_STREAM_ERROR"!==e.code&&(this.trace("Node error event: message="+e.message+" code="+e.code+" errno="+function(e){for(const[r,n]of Object.entries(t.constants.errno))if(n===e)return r;return"Unknown system error "+e}(e.errno)+" syscall="+e.syscall),this.internalError=e),this.callEventTracker.onStreamEnd(!1)})}getDeadlineInfo(){return[`remote_addr=${this.getPeer()}`]}onDisconnect(){this.connectionDropped=!0,setImmediate(()=>{this.endCall({code:r.Status.UNAVAILABLE,details:"Connection dropped",metadata:new n.Metadata})})}outputStatus(){this.statusOutput||(this.statusOutput=!0,this.trace("ended with status: code="+this.finalStatus.code+' details="'+this.finalStatus.details+'"'),this.callEventTracker.onCallEnd(this.finalStatus),process.nextTick(()=>{this.listener.onReceiveStatus(this.finalStatus)}),this.http2Stream.resume())}trace(e){s.trace(a.LogVerbosity.DEBUG,"subchannel_call","["+this.callId+"] "+e)}endCall(e){null!==this.finalStatus&&this.finalStatus.code!==r.Status.OK||(this.finalStatus=e,this.maybeOutputStatus()),this.destroyHttp2Stream()}maybeOutputStatus(){null!==this.finalStatus&&(this.finalStatus.code!==r.Status.OK||this.readsClosed&&0===this.unpushedReadMessages.length&&!this.isReadFilterPending&&!this.isPushPending)&&this.outputStatus()}push(e){this.trace("pushing to reader message of length "+(e instanceof Buffer?e.length:null)),this.canPush=!1,this.isPushPending=!0,process.nextTick(()=>{this.isPushPending=!1,this.statusOutput||(this.listener.onReceiveMessage(e),this.maybeOutputStatus())})}tryPush(e){this.canPush?(this.http2Stream.pause(),this.push(e)):(this.trace("unpushedReadMessages.push message of length "+e.length),this.unpushedReadMessages.push(e))}handleTrailers(e){this.serverEndedCall=!0,this.callEventTracker.onStreamEnd(!0);let t,i="";for(const t of Object.keys(e))i+="\t\t"+t+": "+e[t]+"\n";this.trace("Received server trailers:\n"+i);try{t=n.Metadata.fromHttp2Headers(e)}catch(e){t=new n.Metadata}const s=t.getMap();let a;if("string"==typeof s["grpc-status"]){const e=Number(s["grpc-status"]);this.trace("received status code "+e+" from server"),t.remove("grpc-status");let r="";if("string"==typeof s["grpc-message"]){try{r=decodeURI(s["grpc-message"])}catch(e){r=s["grpc-message"]}t.remove("grpc-message"),this.trace('received status details string "'+r+'" from server')}a={code:e,details:r,metadata:t}}else this.httpStatusCode?(a=o(this.httpStatusCode),a.metadata=t):a={code:r.Status.UNKNOWN,details:"No status information received",metadata:t};this.endCall(a)}destroyHttp2Stream(){var t;if(!this.http2Stream.destroyed)if(this.serverEndedCall)this.http2Stream.end();else{let n;n=(null===(t=this.finalStatus)||void 0===t?void 0:t.code)===r.Status.OK?e.constants.NGHTTP2_NO_ERROR:e.constants.NGHTTP2_CANCEL,this.trace("close http2 stream with code "+n),this.http2Stream.close(n)}}cancelWithStatus(e,t){this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),this.endCall({code:e,details:t,metadata:new n.Metadata})}getStatus(){return this.finalStatus}getPeer(){return this.transport.getPeerName()}getCallNumber(){return this.callId}getAuthContext(){return this.transport.getAuthContext()}startRead(){if(null!==this.finalStatus&&this.finalStatus.code!==r.Status.OK)return this.readsClosed=!0,void this.maybeOutputStatus();if(this.canPush=!0,this.unpushedReadMessages.length>0){const e=this.unpushedReadMessages.shift();return void this.push(e)}this.http2Stream.resume()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length);const i=t=>{process.nextTick(()=>{var n;let i=r.Status.UNAVAILABLE;"ERR_STREAM_WRITE_AFTER_END"===(null==t?void 0:t.code)&&(i=r.Status.INTERNAL),t&&this.cancelWithStatus(i,`Write error: ${t.message}`),null===(n=e.callback)||void 0===n||n.call(e)})};this.trace("sending data chunk of length "+t.length),this.callEventTracker.addMessageSent();try{this.http2Stream.write(t,i)}catch(e){this.endCall({code:r.Status.UNAVAILABLE,details:`Write failed with error ${e.message}`,metadata:new n.Metadata})}}halfClose(){this.trace("end() called"),this.trace("calling end() on HTTP/2 stream"),this.http2Stream.end()}},subchannelCall}function requireTransport(){if(hasRequiredTransport)return transport;hasRequiredTransport=1,Object.defineProperty(transport,"__esModule",{value:!0}),transport.Http2SubchannelConnector=void 0;const e=require$$0$6,t=require$$0$1,r=requireChannelz(),n=requireConstants(),i=requireHttp_proxy(),s=requireLogging(),a=requireResolver(),o=requireSubchannelAddress(),l=requireUriParser(),c=require$$0$3,u=requireSubchannelCall(),h=requireCallNumber(),d="transport",p=require$$12.version,{HTTP2_HEADER_AUTHORITY:f,HTTP2_HEADER_CONTENT_TYPE:g,HTTP2_HEADER_METHOD:v,HTTP2_HEADER_PATH:m,HTTP2_HEADER_TE:A,HTTP2_HEADER_USER_AGENT:y}=e.constants,C=Buffer.from("too_many_pings","ascii");class S{constructor(n,i,a,l){this.session=n,this.options=a,this.remoteName=l,this.keepaliveTimer=null,this.pendingSendKeepalivePing=!1,this.activeCalls=new Set,this.disconnectListeners=[],this.disconnectHandled=!1,this.channelzEnabled=!0,this.keepalivesSent=0,this.messagesSent=0,this.messagesReceived=0,this.lastMessageSentTimestamp=null,this.lastMessageReceivedTimestamp=null,this.subchannelAddressString=(0,o.subchannelAddressToString)(i),0===a["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.streamTracker=new r.ChannelzCallTrackerStub):this.streamTracker=new r.ChannelzCallTracker,this.channelzRef=(0,r.registerChannelzSocket)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.userAgent=[a["grpc.primary_user_agent"],`grpc-node-js/${p}`,a["grpc.secondary_user_agent"]].filter(e=>e).join(" "),this.keepaliveTimeMs="grpc.keepalive_time_ms"in a?a["grpc.keepalive_time_ms"]:-1,this.keepaliveTimeoutMs="grpc.keepalive_timeout_ms"in a?a["grpc.keepalive_timeout_ms"]:2e4,this.keepaliveWithoutCalls="grpc.keepalive_permit_without_calls"in a&&1===a["grpc.keepalive_permit_without_calls"],n.once("close",()=>{this.trace("session closed"),this.handleDisconnect()}),n.once("goaway",(t,r,n)=>{let i=!1;t===e.constants.NGHTTP2_ENHANCE_YOUR_CALM&&n&&n.equals(C)&&(i=!0),this.trace("connection closed by GOAWAY with code "+t+" and data "+(null==n?void 0:n.toString())),this.reportDisconnectToOwner(i)}),n.once("error",e=>{this.trace("connection closed with error "+e.message),this.handleDisconnect()}),n.socket.once("close",e=>{this.trace("connection closed. hadError="+e),this.handleDisconnect()}),s.isTracerEnabled(d)&&(n.on("remoteSettings",e=>{this.trace("new settings received"+(this.session!==n?" on the old connection":"")+": "+JSON.stringify(e))}),n.on("localSettings",e=>{this.trace("local settings acknowledged by remote"+(this.session!==n?" on the old connection":"")+": "+JSON.stringify(e))})),this.keepaliveWithoutCalls&&this.maybeStartKeepalivePingTimer(),n.socket instanceof t.TLSSocket?this.authContext={transportSecurityType:"ssl",sslPeerCertificate:n.socket.getPeerCertificate()}:this.authContext={}}getChannelzInfo(){var e,t,r;const n=this.session.socket,i=n.remoteAddress?(0,o.stringToSubchannelAddress)(n.remoteAddress,n.remotePort):null,s=n.localAddress?(0,o.stringToSubchannelAddress)(n.localAddress,n.localPort):null;let a;if(this.session.encrypted){const t=n,r=t.getCipher(),i=t.getCertificate(),s=t.getPeerCertificate();a={cipherSuiteStandardName:null!==(e=r.standardName)&&void 0!==e?e:null,cipherSuiteOtherName:r.standardName?null:r.name,localCertificate:i&&"raw"in i?i.raw:null,remoteCertificate:s&&"raw"in s?s.raw:null}}else a=null;return{remoteAddress:i,localAddress:s,security:a,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:null!==(t=this.session.state.localWindowSize)&&void 0!==t?t:null,remoteFlowControlWindow:null!==(r=this.session.state.remoteWindowSize)&&void 0!==r?r:null}}trace(e){s.trace(n.LogVerbosity.DEBUG,d,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}keepaliveTrace(e){s.trace(n.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}flowControlTrace(e){s.trace(n.LogVerbosity.DEBUG,"transport_flowctrl","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}internalsTrace(e){s.trace(n.LogVerbosity.DEBUG,"transport_internals","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}reportDisconnectToOwner(e){this.disconnectHandled||(this.disconnectHandled=!0,this.disconnectListeners.forEach(t=>t(e)))}handleDisconnect(){this.clearKeepaliveTimeout(),this.reportDisconnectToOwner(!1);for(const e of this.activeCalls)e.onDisconnect();setImmediate(()=>{this.session.destroy()})}addDisconnectListener(e){this.disconnectListeners.push(e)}canSendPing(){return!this.session.destroyed&&this.keepaliveTimeMs>0&&(this.keepaliveWithoutCalls||this.activeCalls.size>0)}maybeSendPing(){var e,t;if(!this.canSendPing())return void(this.pendingSendKeepalivePing=!0);if(this.keepaliveTimer)return void console.error("keepaliveTimeout is not null");this.channelzEnabled&&(this.keepalivesSent+=1),this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.keepaliveTrace("Ping timeout passed without response"),this.handleDisconnect()},this.keepaliveTimeoutMs),null===(t=(e=this.keepaliveTimer).unref)||void 0===t||t.call(e);let r="";try{this.session.ping((e,t,r)=>{this.clearKeepaliveTimeout(),e?(this.keepaliveTrace("Ping failed with error "+e.message),this.handleDisconnect()):(this.keepaliveTrace("Received ping response"),this.maybeStartKeepalivePingTimer())})||(r="Ping returned false")}catch(e){r=(e instanceof Error?e.message:"")||"Unknown error"}r&&(this.keepaliveTrace("Ping send failed: "+r),this.handleDisconnect())}maybeStartKeepalivePingTimer(){var e,t;this.canSendPing()&&(this.pendingSendKeepalivePing?(this.pendingSendKeepalivePing=!1,this.maybeSendPing()):this.keepaliveTimer||(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.maybeSendPing()},this.keepaliveTimeMs),null===(t=(e=this.keepaliveTimer).unref)||void 0===t||t.call(e)))}clearKeepaliveTimeout(){this.keepaliveTimer&&(clearTimeout(this.keepaliveTimer),this.keepaliveTimer=null)}removeActiveCall(e){this.activeCalls.delete(e),0===this.activeCalls.size&&this.session.unref()}addActiveCall(e){this.activeCalls.add(e),1===this.activeCalls.size&&(this.session.ref(),this.keepaliveWithoutCalls||this.maybeStartKeepalivePingTimer())}createCall(e,t,r,n,i){const s=e.toHttp2Headers();let a,o,l;s[f]=t,s[y]=this.userAgent,s[g]="application/grpc",s[v]="POST",s[m]=r,s[A]="trailers";try{a=this.session.request(s)}catch(e){throw this.handleDisconnect(),e}return this.flowControlTrace("local window size: "+this.session.state.localWindowSize+" remote window size: "+this.session.state.remoteWindowSize),this.internalsTrace("session.closed="+this.session.closed+" session.destroyed="+this.session.destroyed+" session.socket.destroyed="+this.session.socket.destroyed),this.channelzEnabled?(this.streamTracker.addCallStarted(),o={addMessageSent:()=>{var e;this.messagesSent+=1,this.lastMessageSentTimestamp=new Date,null===(e=i.addMessageSent)||void 0===e||e.call(i)},addMessageReceived:()=>{var e;this.messagesReceived+=1,this.lastMessageReceivedTimestamp=new Date,null===(e=i.addMessageReceived)||void 0===e||e.call(i)},onCallEnd:e=>{var t;null===(t=i.onCallEnd)||void 0===t||t.call(i,e),this.removeActiveCall(l)},onStreamEnd:e=>{var t;e?this.streamTracker.addCallSucceeded():this.streamTracker.addCallFailed(),null===(t=i.onStreamEnd)||void 0===t||t.call(i,e)}}):o={addMessageSent:()=>{var e;null===(e=i.addMessageSent)||void 0===e||e.call(i)},addMessageReceived:()=>{var e;null===(e=i.addMessageReceived)||void 0===e||e.call(i)},onCallEnd:e=>{var t;null===(t=i.onCallEnd)||void 0===t||t.call(i,e),this.removeActiveCall(l)},onStreamEnd:e=>{var t;null===(t=i.onStreamEnd)||void 0===t||t.call(i,e)}},l=new u.Http2SubchannelCall(a,o,n,this,(0,h.getNextCallNumber)()),this.addActiveCall(l),l}getChannelzRef(){return this.channelzRef}getPeerName(){return this.subchannelAddressString}getOptions(){return this.options}getAuthContext(){return this.authContext}shutdown(){this.session.close(),(0,r.unregisterChannelzRef)(this.channelzRef)}}return transport.Http2SubchannelConnector=class{constructor(e){this.channelTarget=e,this.session=null,this.isShutdown=!1}trace(e){s.trace(n.LogVerbosity.DEBUG,d,(0,l.uriToString)(this.channelTarget)+" "+e)}createSession(t,r,n){return this.isShutdown?Promise.reject():t.socket.closed?Promise.reject("Connection closed before starting HTTP/2 handshake"):new Promise((i,s)=>{var o,c,u,h,d,p,f,g;let v=null,m=this.channelTarget;if("grpc.http_connect_target"in n){const e=(0,l.parseUri)(n["grpc.http_connect_target"]);e&&(m=e,v=(0,l.uriToString)(e))}const A=t.secure?"https":"http",y=(0,a.getDefaultAuthority)(m),C=()=>{var e;null===(e=this.session)||void 0===e||e.destroy(),this.session=null,setImmediate(()=>{w||(w=!0,s(`${x.trim()} (${(new Date).toISOString()})`))})},E=e=>{var t;null===(t=this.session)||void 0===t||t.destroy(),x=e.message,this.trace("connection failed with error "+x),w||(w=!0,s(`${x} (${(new Date).toISOString()})`))},_={createConnection:(e,r)=>t.socket,settings:{initialWindowSize:null!==(h=null!==(o=n["grpc-node.flow_control_window"])&&void 0!==o?o:null===(u=null===(c=e.getDefaultSettings)||void 0===c?void 0:c.call(e))||void 0===u?void 0:u.initialWindowSize)&&void 0!==h?h:65535},maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER,maxSessionMemory:null!==(d=n["grpc-node.max_session_memory"])&&void 0!==d?d:Number.MAX_SAFE_INTEGER},b=e.connect(`${A}://${y}`,_),T=null!==(g=null===(f=null===(p=e.getDefaultSettings)||void 0===p?void 0:p.call(e))||void 0===f?void 0:f.initialWindowSize)&&void 0!==g?g:65535,R=n["grpc-node.flow_control_window"];this.session=b;let x="Failed to connect",w=!1;b.unref(),b.once("remoteSettings",()=>{var e;if(R&&R>T)try{b.setLocalWindowSize(R)}catch(t){const r=R-(null!==(e=b.state.localWindowSize)&&void 0!==e?e:T);r>0&&b.incrementWindowSize(r)}b.removeAllListeners(),t.socket.removeListener("close",C),t.socket.removeListener("error",E),i(new S(b,r,n,v)),this.session=null}),b.once("close",C),b.once("error",E),t.socket.once("close",C),t.socket.once("error",E)})}tcpConnect(e,t){return(0,i.getProxiedConnection)(e,t).then(t=>t||new Promise((t,r)=>{const n=()=>{r(new Error("Socket closed"))},i=e=>{r(e)},s=c.connect(e,()=>{s.removeListener("close",n),s.removeListener("error",i),t(s)});s.once("close",n),s.once("error",i)}))}async connect(e,t,r){if(this.isShutdown)return Promise.reject();let n=null,i=null;const s=(0,o.subchannelAddressToString)(e);try{return this.trace(s+" Waiting for secureConnector to be ready"),await t.waitForReady(),this.trace(s+" secureConnector is ready"),n=await this.tcpConnect(e,r),n.setNoDelay(),this.trace(s+" Established TCP connection"),i=await t.connect(n),this.trace(s+" Established secure connection"),this.createSession(i,e,r)}catch(e){throw null==n||n.destroy(),null==i||i.socket.destroy(),e}}shutdown(){var e;this.isShutdown=!0,null===(e=this.session)||void 0===e||e.close(),this.session=null}},transport}function requireSubchannelPool(){if(hasRequiredSubchannelPool)return subchannelPool;hasRequiredSubchannelPool=1,Object.defineProperty(subchannelPool,"__esModule",{value:!0}),subchannelPool.SubchannelPool=void 0,subchannelPool.getSubchannelPool=function(e){return e?a:new s};const e=requireChannelOptions(),t=requireSubchannel(),r=requireSubchannelAddress(),n=requireUriParser(),i=requireTransport();class s{constructor(){this.pool=Object.create(null),this.cleanupTimer=null}unrefUnusedSubchannels(){let e=!0;for(const t in this.pool){const r=this.pool[t].filter(e=>!e.subchannel.unrefIfOneRef());r.length>0&&(e=!1),this.pool[t]=r}e&&null!==this.cleanupTimer&&(clearInterval(this.cleanupTimer),this.cleanupTimer=null)}ensureCleanupTask(){var e,t;null===this.cleanupTimer&&(this.cleanupTimer=setInterval(()=>{this.unrefUnusedSubchannels()},1e4),null===(t=(e=this.cleanupTimer).unref)||void 0===t||t.call(e))}getOrCreateSubchannel(s,a,o,l){this.ensureCleanupTask();const c=(0,n.uriToString)(s);if(c in this.pool){const t=this.pool[c];for(const n of t)if((0,r.subchannelAddressEqual)(a,n.subchannelAddress)&&(0,e.channelOptionsEqual)(o,n.channelArguments)&&l._equals(n.channelCredentials))return n.subchannel}const u=new t.Subchannel(s,a,o,l,new i.Http2SubchannelConnector(s));return c in this.pool||(this.pool[c]=[]),this.pool[c].push({subchannelAddress:a,channelArguments:o,channelCredentials:l,subchannel:u}),u.ref(),u}}subchannelPool.SubchannelPool=s;const a=new s;return subchannelPool}var loadBalancingCall={},hasRequiredLoadBalancingCall;function requireLoadBalancingCall(){if(hasRequiredLoadBalancingCall)return loadBalancingCall;hasRequiredLoadBalancingCall=1,Object.defineProperty(loadBalancingCall,"__esModule",{value:!0}),loadBalancingCall.LoadBalancingCall=void 0;const e=requireConnectivityState(),t=requireConstants(),r=requireDeadline(),n=requireMetadata(),i=requirePicker(),s=requireUriParser(),a=requireLogging(),o=requireControlPlaneStatus(),l=require$$0$6;return loadBalancingCall.LoadBalancingCall=class{constructor(e,t,r,n,i,a,o){var l,c;this.channel=e,this.callConfig=t,this.methodName=r,this.host=n,this.credentials=i,this.deadline=a,this.callNumber=o,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.metadata=null,this.listener=null,this.onCallEnded=null,this.childStartTime=null;const u=this.methodName.split("/");let h="";u.length>=2&&(h=u[1]);const d=null!==(c=null===(l=(0,s.splitHostPort)(this.host))||void 0===l?void 0:l.host)&&void 0!==c?c:"localhost";this.serviceUrl=`https://${d}/${h}`,this.startTime=new Date}getDeadlineInfo(){var e,t;const n=[];return this.childStartTime?(this.childStartTime>this.startTime&&((null===(e=this.metadata)||void 0===e?void 0:e.getOptions().waitForReady)&&n.push("wait_for_ready"),n.push(`LB pick: ${(0,r.formatDateDifference)(this.startTime,this.childStartTime)}`)),n.push(...this.child.getDeadlineInfo()),n):((null===(t=this.metadata)||void 0===t?void 0:t.getOptions().waitForReady)&&n.push("wait_for_ready"),n.push("Waiting for LB pick"),n)}trace(e){a.trace(t.LogVerbosity.DEBUG,"load_balancing_call","["+this.callNumber+"] "+e)}outputStatus(e,t){var r,n;if(!this.ended){this.ended=!0,this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString());const i=Object.assign(Object.assign({},e),{progress:t});null===(r=this.listener)||void 0===r||r.onReceiveStatus(i),null===(n=this.onCallEnded)||void 0===n||n.call(this,i.code,i.details,i.metadata)}}doPick(){var s,a;if(this.ended)return;if(!this.metadata)throw new Error("doPick called before start");this.trace("Pick called");const c=this.metadata.clone(),u=this.channel.doPick(c,this.callConfig.pickInformation),h=u.subchannel?"("+u.subchannel.getChannelzRef().id+") "+u.subchannel.getAddress():""+u.subchannel;switch(this.trace("Pick result: "+i.PickResultType[u.pickResultType]+" subchannel: "+h+" status: "+(null===(s=u.status)||void 0===s?void 0:s.code)+" "+(null===(a=u.status)||void 0===a?void 0:a.details)),u.pickResultType){case i.PickResultType.COMPLETE:this.credentials.compose(u.subchannel.getCallCredentials()).generateMetadata({method_name:this.methodName,service_url:this.serviceUrl}).then(i=>{var s;if(this.ended)this.trace("Credentials metadata generation finished after call ended");else{if(c.merge(i),c.get("authorization").length>1&&this.outputStatus({code:t.Status.INTERNAL,details:'"authorization" metadata cannot have multiple values',metadata:new n.Metadata},"PROCESSED"),u.subchannel.getConnectivityState()!==e.ConnectivityState.READY)return this.trace("Picked subchannel "+h+" has state "+e.ConnectivityState[u.subchannel.getConnectivityState()]+" after getting credentials metadata. Retrying pick"),void this.doPick();this.deadline!==1/0&&c.set("grpc-timeout",(0,r.getDeadlineTimeoutString)(this.deadline));try{this.child=u.subchannel.getRealSubchannel().createCall(c,this.host,this.methodName,{onReceiveMetadata:e=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(e)},onReceiveMessage:e=>{this.trace("Received message"),this.listener.onReceiveMessage(e)},onReceiveStatus:e=>{this.trace("Received status"),e.rstCode===l.constants.NGHTTP2_REFUSED_STREAM?this.outputStatus(e,"REFUSED"):this.outputStatus(e,"PROCESSED")}}),this.childStartTime=new Date}catch(e){return this.trace("Failed to start call on picked subchannel "+h+" with error "+e.message),void this.outputStatus({code:t.Status.INTERNAL,details:"Failed to start HTTP/2 stream with error "+e.message,metadata:new n.Metadata},"NOT_STARTED")}null===(s=u.onCallStarted)||void 0===s||s.call(u),this.onCallEnded=u.onCallEnded,this.trace("Created child call ["+this.child.getCallNumber()+"]"),this.readPending&&this.child.startRead(),this.pendingMessage&&this.child.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.pendingHalfClose&&this.child.halfClose()}},e=>{const{code:r,details:i}=(0,o.restrictControlPlaneStatusCode)("number"==typeof e.code?e.code:t.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${e.message}`);this.outputStatus({code:r,details:i,metadata:new n.Metadata},"PROCESSED")});break;case i.PickResultType.DROP:const{code:s,details:a}=(0,o.restrictControlPlaneStatusCode)(u.status.code,u.status.details);setImmediate(()=>{this.outputStatus({code:s,details:a,metadata:u.status.metadata},"DROP")});break;case i.PickResultType.TRANSIENT_FAILURE:if(this.metadata.getOptions().waitForReady)this.channel.queueCallForPick(this);else{const{code:e,details:t}=(0,o.restrictControlPlaneStatusCode)(u.status.code,u.status.details);setImmediate(()=>{this.outputStatus({code:e,details:t,metadata:u.status.metadata},"PROCESSED")})}break;case i.PickResultType.QUEUE:this.channel.queueCallForPick(this)}}cancelWithStatus(e,t){var r;this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),null===(r=this.child)||void 0===r||r.cancelWithStatus(e,t),this.outputStatus({code:e,details:t,metadata:new n.Metadata},"PROCESSED")}getPeer(){var e,t;return null!==(t=null===(e=this.child)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.channel.getTarget()}start(e,t){this.trace("start called"),this.listener=t,this.metadata=e,this.doPick()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length),this.child?this.child.sendMessageWithContext(e,t):this.pendingMessage={context:e,message:t}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){throw new Error("Method not implemented.")}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}},loadBalancingCall}var resolvingCall={},hasRequiredResolvingCall;function requireResolvingCall(){if(hasRequiredResolvingCall)return resolvingCall;hasRequiredResolvingCall=1,Object.defineProperty(resolvingCall,"__esModule",{value:!0}),resolvingCall.ResolvingCall=void 0;const e=requireCallCredentials(),t=requireConstants(),r=requireDeadline(),n=requireMetadata(),i=requireLogging(),s=requireControlPlaneStatus();return resolvingCall.ResolvingCall=class{constructor(n,i,s,a,o){this.channel=n,this.method=i,this.filterStackFactory=a,this.callNumber=o,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.readFilterPending=!1,this.writeFilterPending=!1,this.pendingChildStatus=null,this.metadata=null,this.listener=null,this.statusWatchers=[],this.deadlineTimer=setTimeout(()=>{},0),this.filterStack=null,this.deadlineStartTime=null,this.configReceivedTime=null,this.childStartTime=null,this.credentials=e.CallCredentials.createEmpty(),this.deadline=s.deadline,this.host=s.host,s.parentCall&&(s.flags&t.Propagate.CANCELLATION&&s.parentCall.on("cancelled",()=>{this.cancelWithStatus(t.Status.CANCELLED,"Cancelled by parent call")}),s.flags&t.Propagate.DEADLINE&&(this.trace("Propagating deadline from parent: "+s.parentCall.getDeadline()),this.deadline=(0,r.minDeadline)(this.deadline,s.parentCall.getDeadline()))),this.trace("Created"),this.runDeadlineTimer()}trace(e){i.trace(t.LogVerbosity.DEBUG,"resolving_call","["+this.callNumber+"] "+e)}runDeadlineTimer(){clearTimeout(this.deadlineTimer),this.deadlineStartTime=new Date,this.trace("Deadline: "+(0,r.deadlineToString)(this.deadline));const e=(0,r.getRelativeTimeout)(this.deadline);if(e!==1/0){this.trace("Deadline will be reached in "+e+"ms");const n=()=>{if(!this.deadlineStartTime)return void this.cancelWithStatus(t.Status.DEADLINE_EXCEEDED,"Deadline exceeded");const e=[],n=new Date;e.push(`Deadline exceeded after ${(0,r.formatDateDifference)(this.deadlineStartTime,n)}`),this.configReceivedTime?(this.configReceivedTime>this.deadlineStartTime&&e.push(`name resolution: ${(0,r.formatDateDifference)(this.deadlineStartTime,this.configReceivedTime)}`),this.childStartTime?this.childStartTime>this.configReceivedTime&&e.push(`metadata filters: ${(0,r.formatDateDifference)(this.configReceivedTime,this.childStartTime)}`):e.push("waiting for metadata filters")):e.push("waiting for name resolution"),this.child&&e.push(...this.child.getDeadlineInfo()),this.cancelWithStatus(t.Status.DEADLINE_EXCEEDED,e.join(","))};e<=0?process.nextTick(n):this.deadlineTimer=setTimeout(n,e)}}outputStatus(e){if(!this.ended){this.ended=!0,this.filterStack||(this.filterStack=this.filterStackFactory.createFilter()),clearTimeout(this.deadlineTimer);const t=this.filterStack.receiveTrailers(e);this.trace("ended with status: code="+t.code+' details="'+t.details+'"'),this.statusWatchers.forEach(e=>e(t)),process.nextTick(()=>{var e;null===(e=this.listener)||void 0===e||e.onReceiveStatus(t)})}}sendMessageOnChild(e,t){if(!this.child)throw new Error("sendMessageonChild called with child not populated");const r=this.child;this.writeFilterPending=!0,this.filterStack.sendMessage(Promise.resolve({message:t,flags:e.flags})).then(t=>{this.writeFilterPending=!1,r.sendMessageWithContext(e,t.message),this.pendingHalfClose&&r.halfClose()},e=>{this.cancelWithStatus(e.code,e.details)})}getConfig(){if(this.ended)return;if(!this.metadata||!this.listener)throw new Error("getConfig called before start");const e=this.channel.getConfig(this.method,this.metadata);if("NONE"===e.type)return void this.channel.queueCallForConfig(this);if("ERROR"===e.type)return void(this.metadata.getOptions().waitForReady?this.channel.queueCallForConfig(this):this.outputStatus(e.error));this.configReceivedTime=new Date;const i=e.config;if(i.status!==t.Status.OK){const{code:e,details:t}=(0,s.restrictControlPlaneStatusCode)(i.status,"Failed to route call to method "+this.method);return void this.outputStatus({code:e,details:t,metadata:new n.Metadata})}if(i.methodConfig.timeout){const e=new Date;e.setSeconds(e.getSeconds()+i.methodConfig.timeout.seconds),e.setMilliseconds(e.getMilliseconds()+i.methodConfig.timeout.nanos/1e6),this.deadline=(0,r.minDeadline)(this.deadline,e),this.runDeadlineTimer()}this.filterStackFactory.push(i.dynamicFilterFactories),this.filterStack=this.filterStackFactory.createFilter(),this.filterStack.sendMetadata(Promise.resolve(this.metadata)).then(e=>{this.child=this.channel.createRetryingCall(i,this.method,this.host,this.credentials,this.deadline),this.trace("Created child ["+this.child.getCallNumber()+"]"),this.childStartTime=new Date,this.child.start(e,{onReceiveMetadata:e=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(this.filterStack.receiveMetadata(e))},onReceiveMessage:e=>{this.trace("Received message"),this.readFilterPending=!0,this.filterStack.receiveMessage(e).then(e=>{this.trace("Finished filtering received message"),this.readFilterPending=!1,this.listener.onReceiveMessage(e),this.pendingChildStatus&&this.outputStatus(this.pendingChildStatus)},e=>{this.cancelWithStatus(e.code,e.details)})},onReceiveStatus:e=>{this.trace("Received status"),this.readFilterPending?this.pendingChildStatus=e:this.outputStatus(e)}}),this.readPending&&this.child.startRead(),this.pendingMessage?this.sendMessageOnChild(this.pendingMessage.context,this.pendingMessage.message):this.pendingHalfClose&&this.child.halfClose()},e=>{this.outputStatus(e)})}reportResolverError(e){var t;(null===(t=this.metadata)||void 0===t?void 0:t.getOptions().waitForReady)?this.channel.queueCallForConfig(this):this.outputStatus(e)}cancelWithStatus(e,t){var r;this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),null===(r=this.child)||void 0===r||r.cancelWithStatus(e,t),this.outputStatus({code:e,details:t,metadata:new n.Metadata})}getPeer(){var e,t;return null!==(t=null===(e=this.child)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.channel.getTarget()}start(e,t){this.trace("start called"),this.metadata=e.clone(),this.listener=t,this.getConfig()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length),this.child?this.sendMessageOnChild(e,t):this.pendingMessage={context:e,message:t}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child&&!this.writeFilterPending?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){this.credentials=e}addStatusWatcher(e){this.statusWatchers.push(e)}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}},resolvingCall}var retryingCall={},hasRequiredRetryingCall;function requireRetryingCall(){if(hasRequiredRetryingCall)return retryingCall;hasRequiredRetryingCall=1,Object.defineProperty(retryingCall,"__esModule",{value:!0}),retryingCall.RetryingCall=retryingCall.MessageBufferTracker=retryingCall.RetryThrottler=void 0;const e=requireConstants(),t=requireDeadline(),r=requireMetadata(),n=requireLogging();retryingCall.RetryThrottler=class{constructor(e,t,r){this.maxTokens=e,this.tokenRatio=t,this.tokens=r?r.tokens*(e/r.maxTokens):e}addCallSucceeded(){this.tokens=Math.min(this.tokens+this.tokenRatio,this.maxTokens)}addCallFailed(){this.tokens=Math.max(this.tokens-1,0)}canRetryCall(){return this.tokens>this.maxTokens/2}};retryingCall.MessageBufferTracker=class{constructor(e,t){this.totalLimit=e,this.limitPerCall=t,this.totalAllocated=0,this.allocatedPerCall=new Map}allocate(e,t){var r;const n=null!==(r=this.allocatedPerCall.get(t))&&void 0!==r?r:0;return!(this.limitPerCall-n<e||this.totalLimit-this.totalAllocated<e)&&(this.allocatedPerCall.set(t,n+e),this.totalAllocated+=e,!0)}free(e,t){var r;if(this.totalAllocated<e)throw new Error(`Invalid buffer allocation state: call ${t} freed ${e} > total allocated ${this.totalAllocated}`);this.totalAllocated-=e;const n=null!==(r=this.allocatedPerCall.get(t))&&void 0!==r?r:0;if(n<e)throw new Error(`Invalid buffer allocation state: call ${t} freed ${e} > allocated for call ${n}`);this.allocatedPerCall.set(t,n-e)}freeAll(e){var t;const r=null!==(t=this.allocatedPerCall.get(e))&&void 0!==t?t:0;if(this.totalAllocated<r)throw new Error(`Invalid buffer allocation state: call ${e} allocated ${r} > total allocated ${this.totalAllocated}`);this.totalAllocated-=r,this.allocatedPerCall.delete(e)}};const i="grpc-previous-rpc-attempts";return retryingCall.RetryingCall=class{constructor(e,t,r,n,i,s,a,o,l){var c;this.channel=e,this.callConfig=t,this.methodName=r,this.host=n,this.credentials=i,this.deadline=s,this.callNumber=a,this.bufferTracker=o,this.retryThrottler=l,this.listener=null,this.initialMetadata=null,this.underlyingCalls=[],this.writeBuffer=[],this.writeBufferOffset=0,this.readStarted=!1,this.transparentRetryUsed=!1,this.attempts=0,this.hedgingTimer=null,this.committedCallIndex=null,this.initialRetryBackoffSec=0,this.nextRetryBackoffSec=0;const u=null!==(c=e.getOptions()["grpc-node.retry_max_attempts_limit"])&&void 0!==c?c:5;if(0===e.getOptions()["grpc.enable_retries"])this.state="NO_RETRY",this.maxAttempts=1;else if(t.methodConfig.retryPolicy){this.state="RETRY";const e=t.methodConfig.retryPolicy;this.nextRetryBackoffSec=this.initialRetryBackoffSec=Number(e.initialBackoff.substring(0,e.initialBackoff.length-1)),this.maxAttempts=Math.min(e.maxAttempts,u)}else t.methodConfig.hedgingPolicy?(this.state="HEDGING",this.maxAttempts=Math.min(t.methodConfig.hedgingPolicy.maxAttempts,u)):(this.state="TRANSPARENT_ONLY",this.maxAttempts=1);this.startTime=new Date}getDeadlineInfo(){if(0===this.underlyingCalls.length)return[];const e=[],r=this.underlyingCalls[this.underlyingCalls.length-1];return this.underlyingCalls.length>1&&e.push("previous attempts: "+(this.underlyingCalls.length-1)),r.startTime>this.startTime&&e.push(`time to current attempt start: ${(0,t.formatDateDifference)(this.startTime,r.startTime)}`),e.push(...r.call.getDeadlineInfo()),e}getCallNumber(){return this.callNumber}trace(t){n.trace(e.LogVerbosity.DEBUG,"retrying_call","["+this.callNumber+"] "+t)}reportStatus(e){this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString()),this.bufferTracker.freeAll(this.callNumber),this.writeBufferOffset=this.writeBufferOffset+this.writeBuffer.length,this.writeBuffer=[],process.nextTick(()=>{var t;null===(t=this.listener)||void 0===t||t.onReceiveStatus({code:e.code,details:e.details,metadata:e.metadata})})}cancelWithStatus(e,t){this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),this.reportStatus({code:e,details:t,metadata:new r.Metadata});for(const{call:r}of this.underlyingCalls)r.cancelWithStatus(e,t)}getPeer(){return null!==this.committedCallIndex?this.underlyingCalls[this.committedCallIndex].call.getPeer():"unknown"}getBufferEntry(e){var t;return null!==(t=this.writeBuffer[e-this.writeBufferOffset])&&void 0!==t?t:{entryType:"FREED",allocated:!1}}getNextBufferIndex(){return this.writeBufferOffset+this.writeBuffer.length}clearSentMessages(){if("COMMITTED"!==this.state)return;let e;e="COMPLETED"===this.underlyingCalls[this.committedCallIndex].state?this.getNextBufferIndex():this.underlyingCalls[this.committedCallIndex].nextMessageToSend;for(let t=this.writeBufferOffset;t<e;t++){const e=this.getBufferEntry(t);e.allocated&&this.bufferTracker.free(e.message.message.length,this.callNumber)}this.writeBuffer=this.writeBuffer.slice(e-this.writeBufferOffset),this.writeBufferOffset=e}commitCall(t){var r,n;if("COMMITTED"!==this.state){this.trace("Committing call ["+this.underlyingCalls[t].call.getCallNumber()+"] at index "+t),this.state="COMMITTED",null===(n=(r=this.callConfig).onCommitted)||void 0===n||n.call(r),this.committedCallIndex=t;for(let r=0;r<this.underlyingCalls.length;r++)r!==t&&"COMPLETED"!==this.underlyingCalls[r].state&&(this.underlyingCalls[r].state="COMPLETED",this.underlyingCalls[r].call.cancelWithStatus(e.Status.CANCELLED,"Discarded in favor of other hedged attempt"));this.clearSentMessages()}}commitCallWithMostMessages(){if("COMMITTED"===this.state)return;let e=-1,t=-1;for(const[r,n]of this.underlyingCalls.entries())"ACTIVE"===n.state&&n.nextMessageToSend>e&&(e=n.nextMessageToSend,t=r);-1===t?this.state="TRANSPARENT_ONLY":this.commitCall(t)}isStatusCodeInList(t,r){return t.some(t=>{var n;return t===r||t.toString().toLowerCase()===(null===(n=e.Status[r])||void 0===n?void 0:n.toLowerCase())})}getNextRetryJitter(){return Math.random()*(1.2-.8)+.8}getNextRetryBackoffMs(){var e;const t=null===(e=this.callConfig)||void 0===e?void 0:e.methodConfig.retryPolicy;if(!t)return 0;const r=this.getNextRetryJitter()*this.nextRetryBackoffSec*1e3,n=Number(t.maxBackoff.substring(0,t.maxBackoff.length-1));return this.nextRetryBackoffSec=Math.min(this.nextRetryBackoffSec*t.backoffMultiplier,n),r}maybeRetryCall(e,t){if("RETRY"!==this.state)return void t(!1);if(this.attempts>=this.maxAttempts)return void t(!1);let r;if(null===e)r=this.getNextRetryBackoffMs();else{if(e<0)return this.state="TRANSPARENT_ONLY",void t(!1);r=e,this.nextRetryBackoffSec=this.initialRetryBackoffSec}setTimeout(()=>{var e,r;"RETRY"===this.state?null===(r=null===(e=this.retryThrottler)||void 0===e?void 0:e.canRetryCall())||void 0===r||r?(t(!0),this.attempts+=1,this.startNewAttempt()):(this.trace("Retry attempt denied by throttling policy"),t(!1)):t(!1)},r)}countActiveCalls(){let e=0;for(const t of this.underlyingCalls)"ACTIVE"===(null==t?void 0:t.state)&&(e+=1);return e}handleProcessedStatus(e,t,r){var n,i,s;switch(this.state){case"COMMITTED":case"NO_RETRY":case"TRANSPARENT_ONLY":this.commitCall(t),this.reportStatus(e);break;case"HEDGING":if(this.isStatusCodeInList(null!==(n=this.callConfig.methodConfig.hedgingPolicy.nonFatalStatusCodes)&&void 0!==n?n:[],e.code)){let n;if(null===(i=this.retryThrottler)||void 0===i||i.addCallFailed(),null===r)n=0;else{if(r<0)return this.state="TRANSPARENT_ONLY",this.commitCall(t),void this.reportStatus(e);n=r}setTimeout(()=>{this.maybeStartHedgingAttempt(),0===this.countActiveCalls()&&(this.commitCall(t),this.reportStatus(e))},n)}else this.commitCall(t),this.reportStatus(e);break;case"RETRY":this.isStatusCodeInList(this.callConfig.methodConfig.retryPolicy.retryableStatusCodes,e.code)?(null===(s=this.retryThrottler)||void 0===s||s.addCallFailed(),this.maybeRetryCall(r,r=>{r||(this.commitCall(t),this.reportStatus(e))})):(this.commitCall(t),this.reportStatus(e))}}getPushback(e){const t=e.get("grpc-retry-pushback-ms");if(0===t.length)return null;try{return parseInt(t[0])}catch(e){return-1}}handleChildStatus(t,r){var n;if("COMPLETED"===this.underlyingCalls[r].state)return;if(this.trace("state="+this.state+" handling status with progress "+t.progress+" from child ["+this.underlyingCalls[r].call.getCallNumber()+"] in state "+this.underlyingCalls[r].state),this.underlyingCalls[r].state="COMPLETED",t.code===e.Status.OK)return null===(n=this.retryThrottler)||void 0===n||n.addCallSucceeded(),this.commitCall(r),void this.reportStatus(t);if("NO_RETRY"===this.state)return this.commitCall(r),void this.reportStatus(t);if("COMMITTED"===this.state)return void this.reportStatus(t);const i=this.getPushback(t.metadata);switch(t.progress){case"NOT_STARTED":this.startNewAttempt();break;case"REFUSED":this.transparentRetryUsed?this.handleProcessedStatus(t,r,i):(this.transparentRetryUsed=!0,this.startNewAttempt());break;case"DROP":this.commitCall(r),this.reportStatus(t);break;case"PROCESSED":this.handleProcessedStatus(t,r,i)}}maybeStartHedgingAttempt(){"HEDGING"===this.state&&this.callConfig.methodConfig.hedgingPolicy&&(this.attempts>=this.maxAttempts||(this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()))}maybeStartHedgingTimer(){var e,t,r;if(this.hedgingTimer&&clearTimeout(this.hedgingTimer),"HEDGING"!==this.state)return;if(!this.callConfig.methodConfig.hedgingPolicy)return;const n=this.callConfig.methodConfig.hedgingPolicy;if(this.attempts>=this.maxAttempts)return;const i=null!==(e=n.hedgingDelay)&&void 0!==e?e:"0s",s=Number(i.substring(0,i.length-1));this.hedgingTimer=setTimeout(()=>{this.maybeStartHedgingAttempt()},1e3*s),null===(r=(t=this.hedgingTimer).unref)||void 0===r||r.call(t)}startNewAttempt(){const e=this.channel.createLoadBalancingCall(this.callConfig,this.methodName,this.host,this.credentials,this.deadline);this.trace("Created child call ["+e.getCallNumber()+"] for attempt "+this.attempts);const t=this.underlyingCalls.length;this.underlyingCalls.push({state:"ACTIVE",call:e,nextMessageToSend:0,startTime:new Date});const r=this.attempts-1,n=this.initialMetadata.clone();r>0&&n.set(i,`${r}`);let s=!1;e.start(n,{onReceiveMetadata:n=>{this.trace("Received metadata from child ["+e.getCallNumber()+"]"),this.commitCall(t),s=!0,r>0&&n.set(i,`${r}`),"ACTIVE"===this.underlyingCalls[t].state&&this.listener.onReceiveMetadata(n)},onReceiveMessage:r=>{this.trace("Received message from child ["+e.getCallNumber()+"]"),this.commitCall(t),"ACTIVE"===this.underlyingCalls[t].state&&this.listener.onReceiveMessage(r)},onReceiveStatus:n=>{this.trace("Received status from child ["+e.getCallNumber()+"]"),!s&&r>0&&n.metadata.set(i,`${r}`),this.handleChildStatus(n,t)}}),this.sendNextChildMessage(t),this.readStarted&&e.startRead()}start(e,t){this.trace("start called"),this.listener=t,this.initialMetadata=e,this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()}handleChildWriteCompleted(e,t){var r,n;null===(n=(r=this.getBufferEntry(t)).callback)||void 0===n||n.call(r),this.clearSentMessages();this.underlyingCalls[e].nextMessageToSend+=1,this.sendNextChildMessage(e)}sendNextChildMessage(e){const t=this.underlyingCalls[e];if("COMPLETED"===t.state)return;const r=t.nextMessageToSend;if(this.getBufferEntry(r)){const n=this.getBufferEntry(r);switch(n.entryType){case"MESSAGE":t.call.sendMessageWithContext({callback:t=>{this.handleChildWriteCompleted(e,r)}},n.message.message);"HALF_CLOSE"===this.getBufferEntry(r+1).entryType&&(this.trace("Sending halfClose immediately after message to child ["+t.call.getCallNumber()+"] - optimizing for unary/final message"),t.nextMessageToSend+=1,t.call.halfClose());break;case"HALF_CLOSE":t.nextMessageToSend+=1,t.call.halfClose()}}}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length);const r={message:t,flags:e.flags},n=this.getNextBufferIndex(),i={entryType:"MESSAGE",message:r,allocated:this.bufferTracker.allocate(t.length,this.callNumber)};if(this.writeBuffer.push(i),i.allocated){process.nextTick(()=>{var t;null===(t=e.callback)||void 0===t||t.call(e)});for(const[e,r]of this.underlyingCalls.entries())"ACTIVE"===r.state&&r.nextMessageToSend===n&&r.call.sendMessageWithContext({callback:t=>{this.handleChildWriteCompleted(e,n)}},t)}else{if(this.commitCallWithMostMessages(),null===this.committedCallIndex)return;const r=this.underlyingCalls[this.committedCallIndex];i.callback=e.callback,"ACTIVE"===r.state&&r.nextMessageToSend===n&&r.call.sendMessageWithContext({callback:e=>{this.handleChildWriteCompleted(this.committedCallIndex,n)}},t)}}startRead(){this.trace("startRead called"),this.readStarted=!0;for(const e of this.underlyingCalls)"ACTIVE"===(null==e?void 0:e.state)&&e.call.startRead()}halfClose(){this.trace("halfClose called");const e=this.getNextBufferIndex();this.writeBuffer.push({entryType:"HALF_CLOSE",allocated:!1});for(const t of this.underlyingCalls)"ACTIVE"===(null==t?void 0:t.state)&&(t.nextMessageToSend!==e&&t.nextMessageToSend!==e-1||(this.trace("Sending halfClose immediately to child ["+t.call.getCallNumber()+"] - all messages already sent"),t.nextMessageToSend+=1,t.call.halfClose()))}setCredentials(e){throw new Error("Method not implemented.")}getMethod(){return this.methodName}getHost(){return this.host}getAuthContext(){return null!==this.committedCallIndex?this.underlyingCalls[this.committedCallIndex].call.getAuthContext():null}},retryingCall}var subchannelInterface={},hasRequiredSubchannelInterface,hasRequiredInternalChannel,hasRequiredChannel;function requireSubchannelInterface(){if(hasRequiredSubchannelInterface)return subchannelInterface;hasRequiredSubchannelInterface=1,Object.defineProperty(subchannelInterface,"__esModule",{value:!0}),subchannelInterface.BaseSubchannelWrapper=void 0;return subchannelInterface.BaseSubchannelWrapper=class{constructor(e){this.child=e,this.healthy=!0,this.healthListeners=new Set,this.refcount=0,this.dataWatchers=new Set,e.addHealthStateWatcher(e=>{this.healthy&&this.updateHealthListeners()})}updateHealthListeners(){for(const e of this.healthListeners)e(this.isHealthy())}getConnectivityState(){return this.child.getConnectivityState()}addConnectivityStateListener(e){this.child.addConnectivityStateListener(e)}removeConnectivityStateListener(e){this.child.removeConnectivityStateListener(e)}startConnecting(){this.child.startConnecting()}getAddress(){return this.child.getAddress()}throttleKeepalive(e){this.child.throttleKeepalive(e)}ref(){this.child.ref(),this.refcount+=1}unref(){this.child.unref(),this.refcount-=1,0===this.refcount&&this.destroy()}destroy(){for(const e of this.dataWatchers)e.destroy()}getChannelzRef(){return this.child.getChannelzRef()}isHealthy(){return this.healthy&&this.child.isHealthy()}addHealthStateWatcher(e){this.healthListeners.add(e)}removeHealthStateWatcher(e){this.healthListeners.delete(e)}addDataWatcher(e){e.setSubchannel(this.getRealSubchannel()),this.dataWatchers.add(e)}setHealthy(e){e!==this.healthy&&(this.healthy=e,this.child.isHealthy()&&this.updateHealthListeners())}getRealSubchannel(){return this.child.getRealSubchannel()}realSubchannelEquals(e){return this.getRealSubchannel()===e.getRealSubchannel()}getCallCredentials(){return this.child.getCallCredentials()}getChannel(){return this.child.getChannel()}},subchannelInterface}function requireInternalChannel(){return hasRequiredInternalChannel||(hasRequiredInternalChannel=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.InternalChannel=e.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=void 0;const t=requireChannelCredentials(),r=requireResolvingLoadBalancer(),n=requireSubchannelPool(),i=requirePicker(),s=requireMetadata(),a=requireConstants(),o=requireFilterStack(),l=requireCompressionFilter(),c=requireResolver(),u=requireLogging(),h=requireHttp_proxy(),d=requireUriParser(),p=requireConnectivityState(),f=requireChannelz(),g=requireLoadBalancingCall(),v=requireDeadline(),m=requireResolvingCall(),A=requireCallNumber(),y=requireControlPlaneStatus(),C=requireRetryingCall(),S=requireSubchannelInterface(),E=new Map;class _ extends S.BaseSubchannelWrapper{constructor(e,t){super(e),this.channel=t,this.refCount=0,this.subchannelStateListener=(e,r,n,i)=>{t.throttleKeepalive(i)}}ref(){0===this.refCount&&(this.child.addConnectivityStateListener(this.subchannelStateListener),this.channel.addWrappedSubchannel(this)),this.child.ref(),this.refCount+=1}unref(){this.child.unref(),this.refCount-=1,this.refCount<=0&&(this.child.removeConnectivityStateListener(this.subchannelStateListener),this.channel.removeWrappedSubchannel(this))}}class b{pick(e){return{pickResultType:i.PickResultType.DROP,status:{code:a.Status.UNAVAILABLE,details:"Channel closed before call started",metadata:new s.Metadata},subchannel:null,onCallStarted:null,onCallEnded:null}}}e.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX="grpc.internal.no_subchannel";class T{constructor(e){this.target=e,this.trace=new f.ChannelzTrace,this.callTracker=new f.ChannelzCallTracker,this.childrenTracker=new f.ChannelzChildrenTracker,this.state=p.ConnectivityState.IDLE}getChannelzInfoCallback(){return()=>({target:this.target,state:this.state,trace:this.trace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()})}}e.InternalChannel=class{constructor(s,g,v){var m,A,S,b,R,x;if(this.credentials=g,this.options=v,this.connectivityState=p.ConnectivityState.IDLE,this.currentPicker=new i.UnavailablePicker,this.configSelectionQueue=[],this.pickQueue=[],this.connectivityStateWatchers=[],this.callRefTimer=null,this.configSelector=null,this.currentResolutionError=null,this.wrappedSubchannels=new Set,this.callCount=0,this.idleTimer=null,this.channelzEnabled=!0,this.randomChannelId=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER),"string"!=typeof s)throw new TypeError("Channel target must be a string");if(!(g instanceof t.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(v&&"object"!=typeof v)throw new TypeError("Channel options must be an object");this.channelzInfoTracker=new T(s);const w=(0,d.parseUri)(s);if(null===w)throw new Error(`Could not parse target name "${s}"`);const k=(0,c.mapUriDefaultScheme)(w);if(null===k)throw new Error(`Could not find a default scheme for target name "${s}"`);0===this.options["grpc.enable_channelz"]&&(this.channelzEnabled=!1),this.channelzRef=(0,f.registerChannelzChannel)(s,this.channelzInfoTracker.getChannelzInfoCallback(),this.channelzEnabled),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Channel created"),this.options["grpc.default_authority"]?this.defaultAuthority=this.options["grpc.default_authority"]:this.defaultAuthority=(0,c.getDefaultAuthority)(k);const N=(0,h.mapProxyName)(k,v);this.target=N.target,this.options=Object.assign({},this.options,N.extraOptions),this.subchannelPool=(0,n.getSubchannelPool)(0===(null!==(m=this.options["grpc.use_local_subchannel_pool"])&&void 0!==m?m:0)),this.retryBufferTracker=new C.MessageBufferTracker(null!==(A=this.options["grpc.retry_buffer_size"])&&void 0!==A?A:16777216,null!==(S=this.options["grpc.per_rpc_retry_buffer_size"])&&void 0!==S?S:1048576),this.keepaliveTime=null!==(b=this.options["grpc.keepalive_time_ms"])&&void 0!==b?b:-1,this.idleTimeoutMs=Math.max(null!==(R=this.options["grpc.client_idle_timeout_ms"])&&void 0!==R?R:18e5,1e3);const I={createSubchannel:(t,r)=>{const n={};for(const[t,i]of Object.entries(r))t.startsWith(e.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX)||(n[t]=i);const i=this.subchannelPool.getOrCreateSubchannel(this.target,t,n,this.credentials);i.throttleKeepalive(this.keepaliveTime),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Created subchannel or used existing subchannel",i.getChannelzRef());return new _(i,this)},updateState:(e,t)=>{this.currentPicker=t;const r=this.pickQueue.slice();this.pickQueue=[],r.length>0&&this.callRefTimerUnref();for(const e of r)e.doPick();this.updateState(e)},requestReresolution:()=>{throw new Error("Resolving load balancer should never call requestReresolution")},addChannelzChild:e=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.refChild(e)},removeChannelzChild:e=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.unrefChild(e)}};this.resolvingLoadBalancer=new r.ResolvingLoadBalancer(this.target,I,this.options,(e,t)=>{var r;e.retryThrottling?E.set(this.getTarget(),new C.RetryThrottler(e.retryThrottling.maxTokens,e.retryThrottling.tokenRatio,E.get(this.getTarget()))):E.delete(this.getTarget()),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Address resolution succeeded"),null===(r=this.configSelector)||void 0===r||r.unref(),this.configSelector=t,this.currentResolutionError=null,process.nextTick(()=>{const e=this.configSelectionQueue;this.configSelectionQueue=[],e.length>0&&this.callRefTimerUnref();for(const t of e)t.getConfig()})},e=>{this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_WARNING","Address resolution failed with code "+e.code+' and details "'+e.details+'"'),this.configSelectionQueue.length>0&&this.trace("Name resolution failed with calls queued for config selection"),null===this.configSelector&&(this.currentResolutionError=Object.assign(Object.assign({},(0,y.restrictControlPlaneStatusCode)(e.code,e.details)),{metadata:e.metadata}));const t=this.configSelectionQueue;this.configSelectionQueue=[],t.length>0&&this.callRefTimerUnref();for(const r of t)r.reportResolverError(e)}),this.filterStackFactory=new o.FilterStackFactory([new l.CompressionFilterFactory(this,this.options)]),this.trace("Channel constructed with options "+JSON.stringify(v,void 0,2));const O=new Error;(0,u.isTracerEnabled)("channel_stacktrace")&&(0,u.trace)(a.LogVerbosity.DEBUG,"channel_stacktrace","("+this.channelzRef.id+") Channel constructed \n"+(null===(x=O.stack)||void 0===x?void 0:x.substring(O.stack.indexOf("\n")+1))),this.lastActivityTimestamp=new Date}trace(e,t){(0,u.trace)(null!=t?t:a.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+(0,d.uriToString)(this.target)+" "+e)}callRefTimerRef(){var e,t,r,n;this.callRefTimer||(this.callRefTimer=setInterval(()=>{},2147483647)),(null===(t=(e=this.callRefTimer).hasRef)||void 0===t?void 0:t.call(e))||(this.trace("callRefTimer.ref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),null===(n=(r=this.callRefTimer).ref)||void 0===n||n.call(r))}callRefTimerUnref(){var e,t,r;(null===(e=this.callRefTimer)||void 0===e?void 0:e.hasRef)&&!this.callRefTimer.hasRef()||(this.trace("callRefTimer.unref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),null===(r=null===(t=this.callRefTimer)||void 0===t?void 0:t.unref)||void 0===r||r.call(t))}removeConnectivityStateWatcher(e){const t=this.connectivityStateWatchers.findIndex(t=>t===e);t>=0&&this.connectivityStateWatchers.splice(t,1)}updateState(e){(0,u.trace)(a.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+(0,d.uriToString)(this.target)+" "+p.ConnectivityState[this.connectivityState]+" -> "+p.ConnectivityState[e]),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Connectivity state change to "+p.ConnectivityState[e]),this.connectivityState=e,this.channelzInfoTracker.state=e;const t=this.connectivityStateWatchers.slice();for(const r of t)e!==r.currentState&&(r.timer&&clearTimeout(r.timer),this.removeConnectivityStateWatcher(r),r.callback());e!==p.ConnectivityState.TRANSIENT_FAILURE&&(this.currentResolutionError=null)}throttleKeepalive(e){if(e>this.keepaliveTime){this.keepaliveTime=e;for(const t of this.wrappedSubchannels)t.throttleKeepalive(e)}}addWrappedSubchannel(e){this.wrappedSubchannels.add(e)}removeWrappedSubchannel(e){this.wrappedSubchannels.delete(e)}doPick(e,t){return this.currentPicker.pick({metadata:e,extraPickInfo:t})}queueCallForPick(e){this.pickQueue.push(e),this.callRefTimerRef()}getConfig(e,t){return this.connectivityState!==p.ConnectivityState.SHUTDOWN&&this.resolvingLoadBalancer.exitIdle(),this.configSelector?{type:"SUCCESS",config:this.configSelector.invoke(e,t,this.randomChannelId)}:this.currentResolutionError?{type:"ERROR",error:this.currentResolutionError}:{type:"NONE"}}queueCallForConfig(e){this.configSelectionQueue.push(e),this.callRefTimerRef()}enterIdle(){this.resolvingLoadBalancer.destroy(),this.updateState(p.ConnectivityState.IDLE),this.currentPicker=new i.QueuePicker(this.resolvingLoadBalancer),this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null),this.callRefTimer&&(clearInterval(this.callRefTimer),this.callRefTimer=null)}startIdleTimeout(e){var t,r;this.idleTimer=setTimeout(()=>{if(this.callCount>0)return void this.startIdleTimeout(this.idleTimeoutMs);const e=(new Date).valueOf()-this.lastActivityTimestamp.valueOf();e>=this.idleTimeoutMs?(this.trace("Idle timer triggered after "+this.idleTimeoutMs+"ms of inactivity"),this.enterIdle()):this.startIdleTimeout(this.idleTimeoutMs-e)},e),null===(r=(t=this.idleTimer).unref)||void 0===r||r.call(t)}maybeStartIdleTimer(){this.connectivityState===p.ConnectivityState.SHUTDOWN||this.idleTimer||this.startIdleTimeout(this.idleTimeoutMs)}onCallStart(){this.channelzEnabled&&this.channelzInfoTracker.callTracker.addCallStarted(),this.callCount+=1}onCallEnd(e){this.channelzEnabled&&(e.code===a.Status.OK?this.channelzInfoTracker.callTracker.addCallSucceeded():this.channelzInfoTracker.callTracker.addCallFailed()),this.callCount-=1,this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()}createLoadBalancingCall(e,t,r,n,i){const s=(0,A.getNextCallNumber)();return this.trace("createLoadBalancingCall ["+s+'] method="'+t+'"'),new g.LoadBalancingCall(this,e,t,r,n,i,s)}createRetryingCall(e,t,r,n,i){const s=(0,A.getNextCallNumber)();return this.trace("createRetryingCall ["+s+'] method="'+t+'"'),new C.RetryingCall(this,e,t,r,n,i,s,this.retryBufferTracker,E.get(this.getTarget()))}createResolvingCall(e,t,r,n,i){const s=(0,A.getNextCallNumber)();this.trace("createResolvingCall ["+s+'] method="'+e+'", deadline='+(0,v.deadlineToString)(t));const o={deadline:t,flags:null!=i?i:a.Propagate.DEFAULTS,host:null!=r?r:this.defaultAuthority,parentCall:n},l=new m.ResolvingCall(this,e,o,this.filterStackFactory.clone(),s);return this.onCallStart(),l.addStatusWatcher(e=>{this.onCallEnd(e)}),l}close(){var e;this.resolvingLoadBalancer.destroy(),this.updateState(p.ConnectivityState.SHUTDOWN),this.currentPicker=new b;for(const e of this.configSelectionQueue)e.cancelWithStatus(a.Status.UNAVAILABLE,"Channel closed before call started");this.configSelectionQueue=[];for(const e of this.pickQueue)e.cancelWithStatus(a.Status.UNAVAILABLE,"Channel closed before call started");this.pickQueue=[],this.callRefTimer&&clearInterval(this.callRefTimer),this.idleTimer&&clearTimeout(this.idleTimer),this.channelzEnabled&&(0,f.unregisterChannelzRef)(this.channelzRef),this.subchannelPool.unrefUnusedSubchannels(),null===(e=this.configSelector)||void 0===e||e.unref(),this.configSelector=null}getTarget(){return(0,d.uriToString)(this.target)}getConnectivityState(e){const t=this.connectivityState;return e&&(this.resolvingLoadBalancer.exitIdle(),this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()),t}watchConnectivityState(e,t,r){if(this.connectivityState===p.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");let n=null;if(t!==1/0){const e=t instanceof Date?t:new Date(t),s=new Date;if(t===-1/0||e<=s)return void process.nextTick(r,new Error("Deadline passed without connectivity state change"));n=setTimeout(()=>{this.removeConnectivityStateWatcher(i),r(new Error("Deadline passed without connectivity state change"))},e.getTime()-s.getTime())}const i={currentState:e,callback:r,timer:n};this.connectivityStateWatchers.push(i)}getChannelzRef(){return this.channelzRef}createCall(e,t,r,n,i){if("string"!=typeof e)throw new TypeError("Channel#createCall: method must be a string");if(!("number"==typeof t||t instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");if(this.connectivityState===p.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");return this.createResolvingCall(e,t,r,n,i)}getOptions(){return this.options}}}(internalChannel)),internalChannel}function requireChannel(){if(hasRequiredChannel)return channel;hasRequiredChannel=1,Object.defineProperty(channel,"__esModule",{value:!0}),channel.ChannelImplementation=void 0;const e=requireChannelCredentials(),t=requireInternalChannel();return channel.ChannelImplementation=class{constructor(r,n,i){if("string"!=typeof r)throw new TypeError("Channel target must be a string");if(!(n instanceof e.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(i&&"object"!=typeof i)throw new TypeError("Channel options must be an object");this.internalChannel=new t.InternalChannel(r,n,i)}close(){this.internalChannel.close()}getTarget(){return this.internalChannel.getTarget()}getConnectivityState(e){return this.internalChannel.getConnectivityState(e)}watchConnectivityState(e,t,r){this.internalChannel.watchConnectivityState(e,t,r)}getChannelzRef(){return this.internalChannel.getChannelzRef()}createCall(e,t,r,n,i){if("string"!=typeof e)throw new TypeError("Channel#createCall: method must be a string");if(!("number"==typeof t||t instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");return this.internalChannel.createCall(e,t,r,n,i)}},channel}var server={},serverCall={},hasRequiredServerCall;function requireServerCall(){if(hasRequiredServerCall)return serverCall;hasRequiredServerCall=1,Object.defineProperty(serverCall,"__esModule",{value:!0}),serverCall.ServerDuplexStreamImpl=serverCall.ServerWritableStreamImpl=serverCall.ServerReadableStreamImpl=serverCall.ServerUnaryCallImpl=void 0,serverCall.serverErrorToStatus=i;const e=require$$0$4,t=require$$1$2,r=requireConstants(),n=requireMetadata();function i(e,t){var n;const i={code:r.Status.UNKNOWN,details:"message"in e?e.message:"Unknown Error",metadata:null!==(n=null!=t?t:e.metadata)&&void 0!==n?n:null};return"code"in e&&"number"==typeof e.code&&Number.isInteger(e.code)&&(i.code=e.code,"details"in e&&"string"==typeof e.details&&(i.details=e.details)),i}class s extends e.EventEmitter{constructor(e,t,r,n){super(),this.path=e,this.call=t,this.metadata=r,this.request=n,this.cancelled=!1}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}serverCall.ServerUnaryCallImpl=s;class a extends t.Readable{constructor(e,t,r){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=r,this.cancelled=!1}_read(e){this.call.startRead()}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}serverCall.ServerReadableStreamImpl=a;class o extends t.Writable{constructor(e,t,s,a){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=s,this.request=a,this.pendingStatus={code:r.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new n.Metadata,this.on("error",e=>{this.pendingStatus=i(e),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_write(e,t,r){this.call.sendMessage(e,r)}_final(e){var t;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:null!==(t=this.pendingStatus.metadata)&&void 0!==t?t:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}}serverCall.ServerWritableStreamImpl=o;class l extends t.Duplex{constructor(e,t,s){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=s,this.pendingStatus={code:r.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new n.Metadata,this.on("error",e=>{this.pendingStatus=i(e),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_read(e){this.call.startRead()}_write(e,t,r){this.call.sendMessage(e,r)}_final(e){var t;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:null!==(t=this.pendingStatus.metadata)&&void 0!==t?t:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}}return serverCall.ServerDuplexStreamImpl=l,serverCall}var serverCredentials={},hasRequiredServerCredentials;function requireServerCredentials(){if(hasRequiredServerCredentials)return serverCredentials;hasRequiredServerCredentials=1,Object.defineProperty(serverCredentials,"__esModule",{value:!0}),serverCredentials.ServerCredentials=void 0,serverCredentials.createCertificateProviderServerCredentials=function(e,t,r){return new i(e,t,r)},serverCredentials.createServerCredentialsWithInterceptors=function(e,t){return new s(e,t)};const e=requireTlsHelpers();class t{constructor(e,t){this.serverConstructorOptions=e,this.watchers=new Set,this.latestContextOptions=null,this.latestContextOptions=null!=t?t:null}_addWatcher(e){this.watchers.add(e)}_removeWatcher(e){this.watchers.delete(e)}getWatcherCount(){return this.watchers.size}updateSecureContextOptions(e){this.latestContextOptions=e;for(const e of this.watchers)e(this.latestContextOptions)}_isSecure(){return null!==this.serverConstructorOptions}_getSecureContextOptions(){return this.latestContextOptions}_getConstructorOptions(){return this.serverConstructorOptions}_getInterceptors(){return[]}static createInsecure(){return new r}static createSsl(t,r,i=!1){var s;if(null!==t&&!Buffer.isBuffer(t))throw new TypeError("rootCerts must be null or a Buffer");if(!Array.isArray(r))throw new TypeError("keyCertPairs must be an array");if("boolean"!=typeof i)throw new TypeError("checkClientCertificate must be a boolean");const a=[],o=[];for(let e=0;e<r.length;e++){const t=r[e];if(null===t||"object"!=typeof t)throw new TypeError(`keyCertPair[${e}] must be an object`);if(!Buffer.isBuffer(t.private_key))throw new TypeError(`keyCertPair[${e}].private_key must be a Buffer`);if(!Buffer.isBuffer(t.cert_chain))throw new TypeError(`keyCertPair[${e}].cert_chain must be a Buffer`);a.push(t.cert_chain),o.push(t.private_key)}return new n({requestCert:i,ciphers:e.CIPHER_SUITES},{ca:null!==(s=null!=t?t:(0,e.getDefaultRootsData)())&&void 0!==s?s:void 0,cert:a,key:o})}}serverCredentials.ServerCredentials=t;class r extends t{constructor(){super(null)}_getSettings(){return null}_equals(e){return e instanceof r}}class n extends t{constructor(e,t){super(e,t),this.options=Object.assign(Object.assign({},e),t)}_equals(e){if(this===e)return!0;if(!(e instanceof n))return!1;if(Buffer.isBuffer(this.options.ca)&&Buffer.isBuffer(e.options.ca)){if(!this.options.ca.equals(e.options.ca))return!1}else if(this.options.ca!==e.options.ca)return!1;if(Array.isArray(this.options.cert)&&Array.isArray(e.options.cert)){if(this.options.cert.length!==e.options.cert.length)return!1;for(let t=0;t<this.options.cert.length;t++){const r=this.options.cert[t],n=e.options.cert[t];if(Buffer.isBuffer(r)&&Buffer.isBuffer(n)){if(!r.equals(n))return!1}else if(r!==n)return!1}}else if(this.options.cert!==e.options.cert)return!1;if(Array.isArray(this.options.key)&&Array.isArray(e.options.key)){if(this.options.key.length!==e.options.key.length)return!1;for(let t=0;t<this.options.key.length;t++){const r=this.options.key[t],n=e.options.key[t];if(Buffer.isBuffer(r)&&Buffer.isBuffer(n)){if(!r.equals(n))return!1}else if(r!==n)return!1}}else if(this.options.key!==e.options.key)return!1;return this.options.requestCert===e.options.requestCert}}class i extends t{constructor(t,r,n){super({requestCert:null!==r,rejectUnauthorized:n,ciphers:e.CIPHER_SUITES}),this.identityCertificateProvider=t,this.caCertificateProvider=r,this.requireClientCertificate=n,this.latestCaUpdate=null,this.latestIdentityUpdate=null,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this)}_addWatcher(e){var t;0===this.getWatcherCount()&&(null===(t=this.caCertificateProvider)||void 0===t||t.addCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.addIdentityCertificateListener(this.identityCertificateUpdateListener)),super._addWatcher(e)}_removeWatcher(e){var t;super._removeWatcher(e),0===this.getWatcherCount()&&(null===(t=this.caCertificateProvider)||void 0===t||t.removeCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_equals(e){return this===e||e instanceof i&&(this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&this.requireClientCertificate===e.requireClientCertificate)}calculateSecureContextOptions(){var e;return null===this.latestIdentityUpdate||null!==this.caCertificateProvider&&null===this.latestCaUpdate?null:{ca:null===(e=this.latestCaUpdate)||void 0===e?void 0:e.caCertificate,cert:[this.latestIdentityUpdate.certificate],key:[this.latestIdentityUpdate.privateKey]}}finalizeUpdate(){const e=this.calculateSecureContextOptions();this.updateSecureContextOptions(e)}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.finalizeUpdate()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.finalizeUpdate()}}class s extends t{constructor(e,t){super({}),this.childCredentials=e,this.interceptors=t}_isSecure(){return this.childCredentials._isSecure()}_equals(e){if(!(e instanceof s))return!1;if(!this.childCredentials._equals(e.childCredentials))return!1;if(this.interceptors.length!==e.interceptors.length)return!1;for(let t=0;t<this.interceptors.length;t++)if(this.interceptors[t]!==e.interceptors[t])return!1;return!0}_getInterceptors(){return this.interceptors}_addWatcher(e){this.childCredentials._addWatcher(e)}_removeWatcher(e){this.childCredentials._removeWatcher(e)}_getConstructorOptions(){return this.childCredentials._getConstructorOptions()}_getSecureContextOptions(){return this.childCredentials._getSecureContextOptions()}}return serverCredentials}var serverInterceptors={},orca={},duration={},hasRequiredDuration,hasRequiredOrca,hasRequiredServerInterceptors,hasRequiredServer;function requireDuration(){if(hasRequiredDuration)return duration;hasRequiredDuration=1,Object.defineProperty(duration,"__esModule",{value:!0}),duration.durationMessageToDuration=function(e){return{seconds:Number.parseInt(e.seconds),nanos:e.nanos}},duration.msToDuration=function(e){return{seconds:e/1e3|0,nanos:e%1e3*1e6|0}},duration.durationToMs=function(e){return 1e3*e.seconds+e.nanos/1e6|0},duration.isDuration=function(e){return"number"==typeof e.seconds&&"number"==typeof e.nanos},duration.isDurationMessage=function(e){return"string"==typeof e.seconds&&"number"==typeof e.nanos},duration.parseDuration=function(t){const r=t.match(e);if(!r)return null;return{seconds:Number.parseInt(r[1],10),nanos:r[2]?Number.parseInt(r[2].padEnd(9,"0"),10):0}},duration.durationToString=function(e){if(0===e.nanos)return`${e.seconds}s`;let t;t=e.nanos%1e6==0?1e6:e.nanos%1e3==0?1e3:1;return`${e.seconds}.${e.nanos/t}s`};const e=/^(\d+)(?:\.(\d+))?s$/;return duration}function requireOrca(){return hasRequiredOrca||(hasRequiredOrca=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.OrcaOobMetricsSubchannelWrapper=e.GRPC_METRICS_HEADER=e.ServerMetricRecorder=e.PerRequestMetricRecorder=void 0,e.createOrcaClient=c,e.createMetricsReader=function(t,r){return(n,i,s)=>{let a=s.getOpaque(u);if(a)t(a);else{const r=s.get(e.GRPC_METRICS_HEADER);if(r.length>0){a=l().xds.data.orca.v3.OrcaLoadReport.deserialize(r[0]),t(a),s.setOpaque(u,a)}}r&&r(n,i,s)}};const t=requireMakeClient(),r=requireDuration(),n=requireChannelCredentials(),i=requireSubchannelInterface(),s=requireConstants(),a=requireBackoffTimeout(),o=requireConnectivityState();function l(){const e=(0,requireSrc$1().loadSync)("xds/service/orca/v3/orca.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto/xds`,`${__dirname}/../../proto/protoc-gen-validate`]});return(0,t.loadPackageDefinition)(e)}e.PerRequestMetricRecorder=class{constructor(){this.message={}}recordRequestCostMetric(e,t){this.message.request_cost||(this.message.request_cost={}),this.message.request_cost[e]=t}recordUtilizationMetric(e,t){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=t}recordNamedMetric(e,t){this.message.named_metrics||(this.message.named_metrics={}),this.message.named_metrics[e]=t}recordCPUUtilizationMetric(e){this.message.cpu_utilization=e}recordMemoryUtilizationMetric(e){this.message.mem_utilization=e}recordApplicationUtilizationMetric(e){this.message.application_utilization=e}recordQpsMetric(e){this.message.rps_fractional=e}recordEpsMetric(e){this.message.eps=e}serialize(){return l().xds.data.orca.v3.OrcaLoadReport.serialize(this.message)}};function c(e){return new(0,l().xds.service.orca.v3.OpenRcaService)("unused",n.ChannelCredentials.createInsecure(),{channelOverride:e})}e.ServerMetricRecorder=class{constructor(){this.message={},this.serviceImplementation={StreamCoreMetrics:e=>{const t=e.request.report_interval?(0,r.durationToMs)((0,r.durationMessageToDuration)(e.request.report_interval)):3e4,n=setInterval(()=>{e.write(this.message)},t);e.on("cancelled",()=>{clearInterval(n)})}}}putUtilizationMetric(e,t){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=t}setAllUtilizationMetrics(e){this.message.utilization=Object.assign({},e)}deleteUtilizationMetric(e){var t;null===(t=this.message.utilization)||void 0===t||delete t[e]}setCpuUtilizationMetric(e){this.message.cpu_utilization=e}deleteCpuUtilizationMetric(){delete this.message.cpu_utilization}setApplicationUtilizationMetric(e){this.message.application_utilization=e}deleteApplicationUtilizationMetric(){delete this.message.application_utilization}setQpsMetric(e){this.message.rps_fractional=e}deleteQpsMetric(){delete this.message.rps_fractional}setEpsMetric(e){this.message.eps=e}deleteEpsMetric(){delete this.message.eps}addToServer(e){const t=l().xds.service.orca.v3.OpenRcaService.service;e.addService(t,this.serviceImplementation)}},e.GRPC_METRICS_HEADER="endpoint-load-metrics-bin";const u="grpc_orca_load_report";const h="orca_oob_metrics";class d{constructor(e,t){this.metricsListener=e,this.intervalMs=t,this.dataProducer=null}setSubchannel(e){const t=e.getOrCreateDataProducer(h,g);this.dataProducer=t,t.addDataWatcher(this)}destroy(){var e;null===(e=this.dataProducer)||void 0===e||e.removeDataWatcher(this)}getInterval(){return this.intervalMs}onMetricsUpdate(e){this.metricsListener(e)}}class p{constructor(e){this.subchannel=e,this.dataWatchers=new Set,this.orcaSupported=!0,this.metricsCall=null,this.currentInterval=1/0,this.backoffTimer=new a.BackoffTimeout(()=>this.updateMetricsSubscription()),this.subchannelStateListener=()=>this.updateMetricsSubscription();const t=e.getChannel();this.client=c(t),e.addConnectivityStateListener(this.subchannelStateListener)}addDataWatcher(e){this.dataWatchers.add(e),this.updateMetricsSubscription()}removeDataWatcher(e){var t;this.dataWatchers.delete(e),0===this.dataWatchers.size?(this.subchannel.removeDataProducer(h),null===(t=this.metricsCall)||void 0===t||t.cancel(),this.metricsCall=null,this.client.close(),this.subchannel.removeConnectivityStateListener(this.subchannelStateListener)):this.updateMetricsSubscription()}updateMetricsSubscription(){var e;if(0===this.dataWatchers.size||!this.orcaSupported||this.subchannel.getConnectivityState()!==o.ConnectivityState.READY)return;const t=Math.min(...Array.from(this.dataWatchers).map(e=>e.getInterval()));if(!this.metricsCall||t!==this.currentInterval){null===(e=this.metricsCall)||void 0===e||e.cancel(),this.currentInterval=t;const n=this.client.streamCoreMetrics({report_interval:(0,r.msToDuration)(t)});this.metricsCall=n,n.on("data",e=>{this.dataWatchers.forEach(t=>{t.onMetricsUpdate(e)})}),n.on("error",e=>{this.metricsCall=null,e.code!==s.Status.UNIMPLEMENTED?e.code!==s.Status.CANCELLED&&this.backoffTimer.runOnce():this.orcaSupported=!1})}}}class f extends i.BaseSubchannelWrapper{constructor(e,t,r){super(e),this.addDataWatcher(new d(t,r))}getWrappedSubchannel(){return this.child}}function g(e){return new p(e)}e.OrcaOobMetricsSubchannelWrapper=f}(orca)),orca}function requireServerInterceptors(){if(hasRequiredServerInterceptors)return serverInterceptors;hasRequiredServerInterceptors=1,Object.defineProperty(serverInterceptors,"__esModule",{value:!0}),serverInterceptors.BaseServerInterceptingCall=serverInterceptors.ServerInterceptingCall=serverInterceptors.ResponderBuilder=serverInterceptors.ServerListenerBuilder=void 0,serverInterceptors.isInterceptingServerListener=function(e){return void 0!==e.onReceiveMetadata&&1===e.onReceiveMetadata.length},serverInterceptors.getServerInterceptingCall=function(e,t,r,n,i,s){const a={path:i.path,requestStream:"clientStream"===i.type||"bidi"===i.type,responseStream:"serverStream"===i.type||"bidi"===i.type,requestDeserialize:i.deserialize,responseSerialize:i.serialize},o=new b(t,r,n,i,s);return e.reduce((e,t)=>t(a,e),o)};const e=requireMetadata(),t=requireConstants(),r=require$$0$6,n=requireError(),i=require$$0$5,s=requireStreamDecoder(),a=requireLogging(),o=require$$0$1,l=requireOrca(),c="server_call";function u(e){a.trace(t.LogVerbosity.DEBUG,c,e)}serverInterceptors.ServerListenerBuilder=class{constructor(){this.metadata=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveHalfClose(e){return this.halfClose=e,this}withOnCancel(e){return this.cancel=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveHalfClose:this.halfClose,onCancel:this.cancel}}};class h{constructor(e,t){this.listener=e,this.nextListener=t,this.cancelled=!1,this.processingMetadata=!1,this.hasPendingMessage=!1,this.pendingMessage=null,this.processingMessage=!1,this.hasPendingHalfClose=!1}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingHalfClose(){this.hasPendingHalfClose&&(this.nextListener.onReceiveHalfClose(),this.hasPendingHalfClose=!1)}onReceiveMetadata(e){this.cancelled||(this.processingMetadata=!0,this.listener.onReceiveMetadata(e,e=>{this.processingMetadata=!1,this.cancelled||(this.nextListener.onReceiveMetadata(e),this.processPendingMessage(),this.processPendingHalfClose())}))}onReceiveMessage(e){this.cancelled||(this.processingMessage=!0,this.listener.onReceiveMessage(e,e=>{this.processingMessage=!1,this.cancelled||(this.processingMetadata?(this.pendingMessage=e,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(e),this.processPendingHalfClose()))}))}onReceiveHalfClose(){this.cancelled||this.listener.onReceiveHalfClose(()=>{this.cancelled||(this.processingMetadata||this.processingMessage?this.hasPendingHalfClose=!0:this.nextListener.onReceiveHalfClose())})}onCancel(){this.cancelled=!0,this.listener.onCancel(),this.nextListener.onCancel()}}serverInterceptors.ResponderBuilder=class{constructor(){this.start=void 0,this.metadata=void 0,this.message=void 0,this.status=void 0}withStart(e){return this.start=e,this}withSendMetadata(e){return this.metadata=e,this}withSendMessage(e){return this.message=e,this}withSendStatus(e){return this.status=e,this}build(){return{start:this.start,sendMetadata:this.metadata,sendMessage:this.message,sendStatus:this.status}}};const d={onReceiveMetadata:(e,t)=>{t(e)},onReceiveMessage:(e,t)=>{t(e)},onReceiveHalfClose:e=>{e()},onCancel:()=>{}},p={start:e=>{e()},sendMetadata:(e,t)=>{t(e)},sendMessage:(e,t)=>{t(e)},sendStatus:(e,t)=>{t(e)}};serverInterceptors.ServerInterceptingCall=class{constructor(e,t){var r,n,i,s;this.nextCall=e,this.processingMetadata=!1,this.sentMetadata=!1,this.processingMessage=!1,this.pendingMessage=null,this.pendingMessageCallback=null,this.pendingStatus=null,this.responder={start:null!==(r=null==t?void 0:t.start)&&void 0!==r?r:p.start,sendMetadata:null!==(n=null==t?void 0:t.sendMetadata)&&void 0!==n?n:p.sendMetadata,sendMessage:null!==(i=null==t?void 0:t.sendMessage)&&void 0!==i?i:p.sendMessage,sendStatus:null!==(s=null==t?void 0:t.sendStatus)&&void 0!==s?s:p.sendStatus}}processPendingMessage(){this.pendingMessageCallback&&(this.nextCall.sendMessage(this.pendingMessage,this.pendingMessageCallback),this.pendingMessage=null,this.pendingMessageCallback=null)}processPendingStatus(){this.pendingStatus&&(this.nextCall.sendStatus(this.pendingStatus),this.pendingStatus=null)}start(e){this.responder.start(t=>{var r,n,i,s;const a={onReceiveMetadata:null!==(r=null==t?void 0:t.onReceiveMetadata)&&void 0!==r?r:d.onReceiveMetadata,onReceiveMessage:null!==(n=null==t?void 0:t.onReceiveMessage)&&void 0!==n?n:d.onReceiveMessage,onReceiveHalfClose:null!==(i=null==t?void 0:t.onReceiveHalfClose)&&void 0!==i?i:d.onReceiveHalfClose,onCancel:null!==(s=null==t?void 0:t.onCancel)&&void 0!==s?s:d.onCancel},o=new h(a,e);this.nextCall.start(o)})}sendMetadata(e){this.processingMetadata=!0,this.sentMetadata=!0,this.responder.sendMetadata(e,e=>{this.processingMetadata=!1,this.nextCall.sendMetadata(e),this.processPendingMessage(),this.processPendingStatus()})}sendMessage(t,r){this.processingMessage=!0,this.sentMetadata||this.sendMetadata(new e.Metadata),this.responder.sendMessage(t,e=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=e,this.pendingMessageCallback=r):this.nextCall.sendMessage(e,r)})}sendStatus(e){this.responder.sendStatus(e,e=>{this.processingMetadata||this.processingMessage?this.pendingStatus=e:this.nextCall.sendStatus(e)})}startRead(){this.nextCall.startRead()}getPeer(){return this.nextCall.getPeer()}getDeadline(){return this.nextCall.getDeadline()}getHost(){return this.nextCall.getHost()}getAuthContext(){return this.nextCall.getAuthContext()}getConnectionInfo(){return this.nextCall.getConnectionInfo()}getMetricsRecorder(){return this.nextCall.getMetricsRecorder()}};const f="grpc-accept-encoding",g="grpc-encoding",v="grpc-message",m="grpc-status",A="grpc-timeout",y=/(\d{1,8})\s*([HMSmun])/,C={H:36e5,M:6e4,S:1e3,m:1,u:.001,n:1e-6},S={[f]:"identity,deflate,gzip",[g]:"identity"},E={[r.constants.HTTP2_HEADER_STATUS]:r.constants.HTTP_STATUS_OK,[r.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},_={waitForTrailers:!0};class b{constructor(n,i,o,h,d){var p,v;this.stream=n,this.callEventTracker=o,this.handler=h,this.listener=null,this.deadlineTimer=null,this.deadline=1/0,this.maxSendMessageSize=t.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=t.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.cancelled=!1,this.metadataSent=!1,this.wantTrailers=!1,this.cancelNotified=!1,this.incomingEncoding="identity",this.readQueue=[],this.isReadPending=!1,this.receivedHalfClose=!1,this.streamEnded=!1,this.metricsRecorder=new l.PerRequestMetricRecorder,this.stream.once("error",e=>{}),this.stream.once("close",()=>{var e;u("Request to method "+(null===(e=this.handler)||void 0===e?void 0:e.path)+" stream closed with rstCode "+this.stream.rstCode),this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!1),this.callEventTracker.onCallEnd({code:t.Status.CANCELLED,details:"Stream closed before sending status",metadata:null})),this.notifyOnCancel()}),this.stream.on("data",e=>{this.handleDataFrame(e)}),this.stream.pause(),this.stream.on("end",()=>{this.handleEndEvent()}),"grpc.max_send_message_length"in d&&(this.maxSendMessageSize=d["grpc.max_send_message_length"]),"grpc.max_receive_message_length"in d&&(this.maxReceiveMessageSize=d["grpc.max_receive_message_length"]),this.host=null!==(p=i[":authority"])&&void 0!==p?p:i.host,this.decoder=new s.StreamDecoder(this.maxReceiveMessageSize);const m=e.Metadata.fromHttp2Headers(i);a.isTracerEnabled(c)&&u("Request to "+this.handler.path+" received headers "+JSON.stringify(m.toJSON()));const y=m.get(A);y.length>0&&this.handleTimeoutHeader(y[0]);const C=m.get(g);C.length>0&&(this.incomingEncoding=C[0]),m.remove(A),m.remove(g),m.remove(f),m.remove(r.constants.HTTP2_HEADER_ACCEPT_ENCODING),m.remove(r.constants.HTTP2_HEADER_TE),m.remove(r.constants.HTTP2_HEADER_CONTENT_TYPE),this.metadata=m;const S=null===(v=n.session)||void 0===v?void 0:v.socket;this.connectionInfo={localAddress:null==S?void 0:S.localAddress,localPort:null==S?void 0:S.localPort,remoteAddress:null==S?void 0:S.remoteAddress,remotePort:null==S?void 0:S.remotePort},this.shouldSendMetrics=!!d["grpc.server_call_metric_recording"]}handleTimeoutHeader(e){const r=e.toString().match(y);if(null===r){const r={code:t.Status.INTERNAL,details:`Invalid ${A} value "${e}"`,metadata:null};return void process.nextTick(()=>{this.sendStatus(r)})}const n=+r[1]*C[r[2]]|0,i=new Date;this.deadline=i.setMilliseconds(i.getMilliseconds()+n),this.deadlineTimer=setTimeout(()=>{const e={code:t.Status.DEADLINE_EXCEEDED,details:"Deadline exceeded",metadata:null};this.sendStatus(e)},n)}checkCancelled(){return this.cancelled||!this.stream.destroyed&&!this.stream.closed||(this.notifyOnCancel(),this.cancelled=!0),this.cancelled}notifyOnCancel(){this.cancelNotified||(this.cancelNotified=!0,this.cancelled=!0,process.nextTick(()=>{var e;null===(e=this.listener)||void 0===e||e.onCancel()}),this.deadlineTimer&&clearTimeout(this.deadlineTimer),this.stream.resume())}maybeSendMetadata(){this.metadataSent||this.sendMetadata(new e.Metadata)}serializeMessage(e){const t=this.handler.serialize(e),r=t.byteLength,n=Buffer.allocUnsafe(r+5);return n.writeUInt8(0,0),n.writeUInt32BE(r,1),t.copy(n,5),n}decompressMessage(e,r){const n=e.subarray(5);if("identity"===r)return n;if("deflate"===r||"gzip"===r){let e;return e="deflate"===r?i.createInflate():i.createGunzip(),new Promise((r,i)=>{let s=0;const a=[];e.on("data",r=>{a.push(r),s+=r.byteLength,-1!==this.maxReceiveMessageSize&&s>this.maxReceiveMessageSize&&(e.destroy(),i({code:t.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxReceiveMessageSize}`}))}),e.on("end",()=>{r(Buffer.concat(a))}),e.write(n),e.end()})}return Promise.reject({code:t.Status.UNIMPLEMENTED,details:`Received message compressed with unsupported encoding "${r}"`})}async decompressAndMaybePush(e){if("COMPRESSED"!==e.type)throw new Error(`Invalid queue entry type: ${e.type}`);const r=1===e.compressedMessage.readUInt8(0)?this.incomingEncoding:"identity";let n;try{n=await this.decompressMessage(e.compressedMessage,r)}catch(e){return void this.sendStatus(e)}try{e.parsedMessage=this.handler.deserialize(n)}catch(e){return void this.sendStatus({code:t.Status.INTERNAL,details:`Error deserializing request: ${e.message}`})}e.type="READABLE",this.maybePushNextMessage()}maybePushNextMessage(){if(this.listener&&this.isReadPending&&this.readQueue.length>0&&"COMPRESSED"!==this.readQueue[0].type){this.isReadPending=!1;const e=this.readQueue.shift();"READABLE"===e.type?this.listener.onReceiveMessage(e.parsedMessage):this.listener.onReceiveHalfClose()}}handleDataFrame(e){var r;if(this.checkCancelled())return;let n;u("Request to "+this.handler.path+" received data frame of size "+e.length);try{n=this.decoder.write(e)}catch(e){return void this.sendStatus({code:t.Status.RESOURCE_EXHAUSTED,details:e.message})}for(const e of n){this.stream.pause();const t={type:"COMPRESSED",compressedMessage:e,parsedMessage:null};this.readQueue.push(t),this.decompressAndMaybePush(t),null===(r=this.callEventTracker)||void 0===r||r.addMessageReceived()}}handleEndEvent(){this.readQueue.push({type:"HALF_CLOSE",compressedMessage:null,parsedMessage:null}),this.receivedHalfClose=!0,this.maybePushNextMessage()}start(e){u("Request to "+this.handler.path+" start called"),this.checkCancelled()||(this.listener=e,e.onReceiveMetadata(this.metadata))}sendMetadata(e){if(this.checkCancelled())return;if(this.metadataSent)return;this.metadataSent=!0;const t=e?e.toHttp2Headers():null,r=Object.assign(Object.assign(Object.assign({},E),S),t);this.stream.respond(r,_)}sendMessage(e,r){if(this.checkCancelled())return;let i;try{i=this.serializeMessage(e)}catch(e){return void this.sendStatus({code:t.Status.INTERNAL,details:`Error serializing response: ${(0,n.getErrorMessage)(e)}`,metadata:null})}-1!==this.maxSendMessageSize&&i.length-5>this.maxSendMessageSize?this.sendStatus({code:t.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${i.length} vs. ${this.maxSendMessageSize})`,metadata:null}):(this.maybeSendMetadata(),u("Request to "+this.handler.path+" sent data frame of size "+i.length),this.stream.write(i,e=>{var i;e?this.sendStatus({code:t.Status.INTERNAL,details:`Error writing message: ${(0,n.getErrorMessage)(e)}`,metadata:null}):(null===(i=this.callEventTracker)||void 0===i||i.addMessageSent(),r())}))}sendStatus(r){var n,i,s;if(this.checkCancelled())return;u("Request to method "+(null===(n=this.handler)||void 0===n?void 0:n.path)+" ended with status code: "+t.Status[r.code]+" details: "+r.details);const a=null!==(s=null===(i=r.metadata)||void 0===i?void 0:i.clone())&&void 0!==s?s:new e.Metadata;if(this.shouldSendMetrics&&a.set(l.GRPC_METRICS_HEADER,this.metricsRecorder.serialize()),this.metadataSent)this.wantTrailers?this.notifyOnCancel():(this.wantTrailers=!0,this.stream.once("wantTrailers",()=>{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(r));const e=Object.assign({[m]:r.code,[v]:encodeURI(r.details)},a.toHttp2Headers());this.stream.sendTrailers(e),this.notifyOnCancel()}),this.stream.end());else{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(r));const e=Object.assign(Object.assign({[m]:r.code,[v]:encodeURI(r.details)},E),a.toHttp2Headers());this.stream.respond(e,{endStream:!0}),this.notifyOnCancel()}}startRead(){u("Request to "+this.handler.path+" startRead called"),this.checkCancelled()||(this.isReadPending=!0,0===this.readQueue.length?this.receivedHalfClose||this.stream.resume():this.maybePushNextMessage())}getPeer(){var e;const t=null===(e=this.stream.session)||void 0===e?void 0:e.socket;return(null==t?void 0:t.remoteAddress)?t.remotePort?`${t.remoteAddress}:${t.remotePort}`:t.remoteAddress:"unknown"}getDeadline(){return this.deadline}getHost(){return this.host}getAuthContext(){var e;if((null===(e=this.stream.session)||void 0===e?void 0:e.socket)instanceof o.TLSSocket){const e=this.stream.session.socket.getPeerCertificate();return{transportSecurityType:"ssl",sslPeerCertificate:e.raw?e:void 0}}return{}}getConnectionInfo(){return this.connectionInfo}getMetricsRecorder(){return this.metricsRecorder}}return serverInterceptors.BaseServerInterceptingCall=b,serverInterceptors}function requireServer(){if(hasRequiredServer)return server;hasRequiredServer=1;var e=server&&server.__runInitializers||function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},t=server&&server.__esDecorate||function(e,t,r,n,i,s){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?n.static?e:e.prototype:null,h=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),d=!1,p=r.length-1;p>=0;p--){var f={};for(var g in n)f[g]="access"===g?{}:n[g];for(var g in n.access)f.access[g]=n.access[g];f.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(e||null))};var v=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(o=a(v.get))&&(h.get=o),(o=a(v.set))&&(h.set=o),(o=a(v.init))&&i.unshift(o)}else(o=a(v))&&("field"===l?i.unshift(o):h[c]=o)}u&&Object.defineProperty(u,n.name,h),d=!0};Object.defineProperty(server,"__esModule",{value:!0}),server.Server=void 0;const r=require$$0$6,n=require$$1$5,i=requireConstants(),s=requireServerCall(),a=requireServerCredentials(),o=requireResolver(),l=requireLogging(),c=requireSubchannelAddress(),u=requireUriParser(),h=requireChannelz(),d=requireServerInterceptors(),p=2147483647,f=2147483647,g=2147483647,{HTTP2_HEADER_PATH:v}=r.constants,m=Buffer.from("max_age");function A(e){l.trace(i.LogVerbosity.DEBUG,"server_call",e)}function y(){}function C(e){return function(t,r){return n.deprecate(t,e)}}function S(e){return{code:i.Status.UNIMPLEMENTED,details:`The server does not implement the method ${e}`}}let E=(()=>{var n;let E,_=[];return n=class{constructor(t){var r,n,i,s,a,o;this.boundPorts=(e(this,_),new Map),this.http2Servers=new Map,this.sessionIdleTimeouts=new Map,this.handlers=new Map,this.sessions=new Map,this.started=!1,this.shutdown=!1,this.serverAddressString="null",this.channelzEnabled=!0,this.options=null!=t?t:{},0===this.options["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.channelzTrace=new h.ChannelzTraceStub,this.callTracker=new h.ChannelzCallTrackerStub,this.listenerChildrenTracker=new h.ChannelzChildrenTrackerStub,this.sessionChildrenTracker=new h.ChannelzChildrenTrackerStub):(this.channelzTrace=new h.ChannelzTrace,this.callTracker=new h.ChannelzCallTracker,this.listenerChildrenTracker=new h.ChannelzChildrenTracker,this.sessionChildrenTracker=new h.ChannelzChildrenTracker),this.channelzRef=(0,h.registerChannelzServer)("server",()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Server created"),this.maxConnectionAgeMs=null!==(r=this.options["grpc.max_connection_age_ms"])&&void 0!==r?r:p,this.maxConnectionAgeGraceMs=null!==(n=this.options["grpc.max_connection_age_grace_ms"])&&void 0!==n?n:p,this.keepaliveTimeMs=null!==(i=this.options["grpc.keepalive_time_ms"])&&void 0!==i?i:f,this.keepaliveTimeoutMs=null!==(s=this.options["grpc.keepalive_timeout_ms"])&&void 0!==s?s:2e4,this.sessionIdleTimeout=null!==(a=this.options["grpc.max_connection_idle_ms"])&&void 0!==a?a:g,this.commonServerOptions={maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER},"grpc-node.max_session_memory"in this.options?this.commonServerOptions.maxSessionMemory=this.options["grpc-node.max_session_memory"]:this.commonServerOptions.maxSessionMemory=Number.MAX_SAFE_INTEGER,"grpc.max_concurrent_streams"in this.options&&(this.commonServerOptions.settings={maxConcurrentStreams:this.options["grpc.max_concurrent_streams"]}),this.interceptors=null!==(o=this.options.interceptors)&&void 0!==o?o:[],this.trace("Server constructed")}getChannelzInfo(){return{trace:this.channelzTrace,callTracker:this.callTracker,listenerChildren:this.listenerChildrenTracker.getChildLists(),sessionChildren:this.sessionChildrenTracker.getChildLists()}}getChannelzSessionInfo(e){var t,r,n;const i=this.sessions.get(e),s=e.socket,a=s.remoteAddress?(0,c.stringToSubchannelAddress)(s.remoteAddress,s.remotePort):null,o=s.localAddress?(0,c.stringToSubchannelAddress)(s.localAddress,s.localPort):null;let l;if(e.encrypted){const e=s,r=e.getCipher(),n=e.getCertificate(),i=e.getPeerCertificate();l={cipherSuiteStandardName:null!==(t=r.standardName)&&void 0!==t?t:null,cipherSuiteOtherName:r.standardName?null:r.name,localCertificate:n&&"raw"in n?n.raw:null,remoteCertificate:i&&"raw"in i?i.raw:null}}else l=null;return{remoteAddress:a,localAddress:o,security:l,remoteName:null,streamsStarted:i.streamTracker.callsStarted,streamsSucceeded:i.streamTracker.callsSucceeded,streamsFailed:i.streamTracker.callsFailed,messagesSent:i.messagesSent,messagesReceived:i.messagesReceived,keepAlivesSent:i.keepAlivesSent,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:i.streamTracker.lastCallStartedTimestamp,lastMessageSentTimestamp:i.lastMessageSentTimestamp,lastMessageReceivedTimestamp:i.lastMessageReceivedTimestamp,localFlowControlWindow:null!==(r=e.state.localWindowSize)&&void 0!==r?r:null,remoteFlowControlWindow:null!==(n=e.state.remoteWindowSize)&&void 0!==n?n:null}}trace(e){l.trace(i.LogVerbosity.DEBUG,"server","("+this.channelzRef.id+") "+e)}keepaliveTrace(e){l.trace(i.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+e)}addProtoService(){throw new Error("Not implemented. Use addService() instead")}addService(e,t){if(null===e||"object"!=typeof e||null===t||"object"!=typeof t)throw new Error("addService() requires two objects as arguments");const r=Object.keys(e);if(0===r.length)throw new Error("Cannot add an empty service to a server");r.forEach(r=>{const n=e[r];let i;i=n.requestStream?n.responseStream?"bidi":"clientStream":n.responseStream?"serverStream":"unary";let s,a=t[r];void 0===a&&"string"==typeof n.originalName&&(a=t[n.originalName]),s=void 0!==a?a.bind(t):function(e,t){const r=S(t);switch(e){case"unary":case"clientStream":return(e,t)=>{t(r,null)};case"serverStream":case"bidi":return e=>{e.emit("error",r)};default:throw new Error(`Invalid handlerType ${e}`)}}(i,r);if(!1===this.register(n.path,s,n.responseSerialize,n.requestDeserialize,i))throw new Error(`Method handler for ${n.path} already provided.`)})}removeService(e){if(null===e||"object"!=typeof e)throw new Error("removeService() requires object as argument");Object.keys(e).forEach(t=>{const r=e[t];this.unregister(r.path)})}bind(e,t){throw new Error("Not implemented. Use bindAsync() instead")}experimentalRegisterListenerToChannelz(e){return(0,h.registerChannelzSocket)((0,c.subchannelAddressToString)(e),()=>({localAddress:e,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalUnregisterListenerFromChannelz(e){(0,h.unregisterChannelzRef)(e)}createHttp2Server(e){let t;if(e._isSecure()){const n=e._getConstructorOptions(),s=e._getSecureContextOptions(),a=Object.assign(Object.assign(Object.assign(Object.assign({},this.commonServerOptions),n),s),{enableTrace:1===this.options["grpc-node.tls_enable_trace"]});let o=null!==s;this.trace("Initial credentials valid: "+o),t=r.createSecureServer(a),t.prependListener("connection",e=>{o||(this.trace("Dropped connection from "+JSON.stringify(e.address())+" due to unloaded credentials"),e.destroy())}),t.on("secureConnection",e=>{e.on("error",e=>{this.trace("An incoming TLS connection closed with error: "+e.message)})});const c=e=>{if(e){const r=t;try{r.setSecureContext(e)}catch(t){l.log(i.LogVerbosity.ERROR,"Failed to set secure context with error "+t.message),e=null}}o=null!==e,this.trace("Post-update credentials valid: "+o)};e._addWatcher(c),t.on("close",()=>{e._removeWatcher(c)})}else t=r.createServer(this.commonServerOptions);return t.setTimeout(0,y),this._setupHandlers(t,e._getInterceptors()),t}bindOneAddress(e,t){this.trace("Attempting to bind "+(0,c.subchannelAddressToString)(e));const r=this.createHttp2Server(t.credentials);return new Promise((n,i)=>{const s=t=>{this.trace("Failed to bind "+(0,c.subchannelAddressToString)(e)+" with error "+t.message),n({port:"port"in e?e.port:1,error:t.message})};r.once("error",s),r.listen(e,()=>{const e=r.address();let i;i="string"==typeof e?{path:e}:{host:e.address,port:e.port};const a=this.experimentalRegisterListenerToChannelz(i);this.listenerChildrenTracker.refChild(a),this.http2Servers.set(r,{channelzRef:a,sessions:new Set,ownsChannelzRef:!0}),t.listeningServers.add(r),this.trace("Successfully bound "+(0,c.subchannelAddressToString)(i)),n({port:"port"in i?i.port:1}),r.removeListener("error",s)})})}async bindManyPorts(e,t){if(0===e.length)return{count:0,port:0,errors:[]};if((0,c.isTcpSubchannelAddress)(e[0])&&0===e[0].port){const r=await this.bindOneAddress(e[0],t);if(r.error){const n=await this.bindManyPorts(e.slice(1),t);return Object.assign(Object.assign({},n),{errors:[r.error,...n.errors]})}{const n=e.slice(1).map(e=>(0,c.isTcpSubchannelAddress)(e)?{host:e.host,port:r.port}:e),i=await Promise.all(n.map(e=>this.bindOneAddress(e,t))),s=[r,...i];return{count:s.filter(e=>void 0===e.error).length,port:r.port,errors:s.filter(e=>e.error).map(e=>e.error)}}}{const r=await Promise.all(e.map(e=>this.bindOneAddress(e,t)));return{count:r.filter(e=>void 0===e.error).length,port:r[0].port,errors:r.filter(e=>e.error).map(e=>e.error)}}}async bindAddressList(e,t){const r=await this.bindManyPorts(e,t);if(r.count>0)return r.count<e.length&&l.log(i.LogVerbosity.INFO,`WARNING Only ${r.count} addresses added out of total ${e.length} resolved`),r.port;{const t=`No address added out of total ${e.length} resolved`;throw l.log(i.LogVerbosity.ERROR,t),new Error(`${t} errors: [${r.errors.join(",")}]`)}}resolvePort(e){return new Promise((t,r)=>{let n=!1;(0,o.createResolver)(e,(i,s,a,o)=>{if(n)return!0;if(n=!0,!i.ok)return r(new Error(i.error.details)),!0;const l=[].concat(...i.value.map(e=>e.addresses));return 0===l.length?(r(new Error(`No addresses resolved for port ${e}`)),!0):(t(l),!0)},this.options).updateResolution()})}async bindPort(e,t){const r=await this.resolvePort(e);if(t.cancelled)throw this.completeUnbind(t),new Error("bindAsync operation cancelled by unbind call");const n=await this.bindAddressList(r,t);if(t.cancelled)throw this.completeUnbind(t),new Error("bindAsync operation cancelled by unbind call");return n}normalizePort(e){const t=(0,u.parseUri)(e);if(null===t)throw new Error(`Could not parse port "${e}"`);const r=(0,o.mapUriDefaultScheme)(t);if(null===r)throw new Error(`Could not get a default scheme for port "${e}"`);return r}bindAsync(e,t,r){if(this.shutdown)throw new Error("bindAsync called after shutdown");if("string"!=typeof e)throw new TypeError("port must be a string");if(null===t||!(t instanceof a.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");if("function"!=typeof r)throw new TypeError("callback must be a function");this.trace("bindAsync port="+e);const n=this.normalizePort(e),i=(e,t)=>{process.nextTick(()=>r(e,t))};let s=this.boundPorts.get((0,u.uriToString)(n));if(s)return t._equals(s.credentials)?(s.cancelled=!1,void(s.completionPromise?s.completionPromise.then(e=>r(null,e),e=>r(e,0)):i(null,s.portNumber))):void i(new Error(`${e} already bound with incompatible credentials`),0);s={mapKey:(0,u.uriToString)(n),originalUri:n,completionPromise:null,cancelled:!1,portNumber:0,credentials:t,listeningServers:new Set};const o=(0,u.splitHostPort)(n.path),l=this.bindPort(n,s);s.completionPromise=l,0===(null==o?void 0:o.port)?l.then(e=>{const t={scheme:n.scheme,authority:n.authority,path:(0,u.combineHostPort)({host:o.host,port:e})};s.mapKey=(0,u.uriToString)(t),s.completionPromise=null,s.portNumber=e,this.boundPorts.set(s.mapKey,s),r(null,e)},e=>{r(e,0)}):(this.boundPorts.set(s.mapKey,s),l.then(e=>{s.completionPromise=null,s.portNumber=e,r(null,e)},e=>{r(e,0)}))}registerInjectorToChannelz(){return(0,h.registerChannelzSocket)("injector",()=>({localAddress:null,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalCreateConnectionInjectorWithChannelzRef(e,t,n=!1){if(null===e||!(e instanceof a.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");this.channelzEnabled&&this.listenerChildrenTracker.refChild(t);const i=this.createHttp2Server(e),s=new Set;return this.http2Servers.set(i,{channelzRef:t,sessions:s,ownsChannelzRef:n}),{injectConnection:e=>{i.emit("connection",e)},drain:e=>{var t,n;for(const e of s)this.closeSession(e);null===(n=(t=setTimeout(()=>{for(const e of s)e.destroy(r.constants.NGHTTP2_CANCEL)},e)).unref)||void 0===n||n.call(t)},destroy:()=>{this.closeServer(i);for(const e of s)this.closeSession(e)}}}createConnectionInjector(e){if(null===e||!(e instanceof a.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");const t=this.registerInjectorToChannelz();return this.experimentalCreateConnectionInjectorWithChannelzRef(e,t,!0)}closeServer(e,t){this.trace("Closing server with address "+JSON.stringify(e.address()));const r=this.http2Servers.get(e);e.close(()=>{r&&r.ownsChannelzRef&&(this.listenerChildrenTracker.unrefChild(r.channelzRef),(0,h.unregisterChannelzRef)(r.channelzRef)),this.http2Servers.delete(e),null==t||t()})}closeSession(e,t){var r;this.trace("Closing session initiated by "+(null===(r=e.socket)||void 0===r?void 0:r.remoteAddress));const n=this.sessions.get(e),i=()=>{n&&(this.sessionChildrenTracker.unrefChild(n.ref),(0,h.unregisterChannelzRef)(n.ref)),null==t||t()};e.closed?queueMicrotask(i):e.close(i)}completeUnbind(e){for(const t of e.listeningServers){const r=this.http2Servers.get(t);if(this.closeServer(t,()=>{e.listeningServers.delete(t)}),r)for(const e of r.sessions)this.closeSession(e)}this.boundPorts.delete(e.mapKey)}unbind(e){this.trace("unbind port="+e);const t=this.normalizePort(e),r=(0,u.splitHostPort)(t.path);if(0===(null==r?void 0:r.port))throw new Error("Cannot unbind port 0");const n=this.boundPorts.get((0,u.uriToString)(t));n&&(this.trace("unbinding "+n.mapKey+" originally bound as "+(0,u.uriToString)(n.originalUri)),n.completionPromise?n.cancelled=!0:this.completeUnbind(n))}drain(e,t){var n,i;this.trace("drain port="+e+" graceTimeMs="+t);const s=this.normalizePort(e),a=(0,u.splitHostPort)(s.path);if(0===(null==a?void 0:a.port))throw new Error("Cannot drain port 0");const o=this.boundPorts.get((0,u.uriToString)(s));if(!o)return;const l=new Set;for(const e of o.listeningServers){const t=this.http2Servers.get(e);if(t)for(const e of t.sessions)l.add(e),this.closeSession(e,()=>{l.delete(e)})}null===(i=(n=setTimeout(()=>{for(const e of l)e.destroy(r.constants.NGHTTP2_CANCEL)},t)).unref)||void 0===i||i.call(n)}forceShutdown(){for(const e of this.boundPorts.values())e.cancelled=!0;this.boundPorts.clear();for(const e of this.http2Servers.keys())this.closeServer(e);this.sessions.forEach((e,t)=>{this.closeSession(t),t.destroy(r.constants.NGHTTP2_CANCEL)}),this.sessions.clear(),(0,h.unregisterChannelzRef)(this.channelzRef),this.shutdown=!0}register(e,t,r,n,i){return!this.handlers.has(e)&&(this.handlers.set(e,{func:t,serialize:r,deserialize:n,type:i,path:e}),!0)}unregister(e){return this.handlers.delete(e)}start(){if(0===this.http2Servers.size||[...this.http2Servers.keys()].every(e=>!e.listening))throw new Error("server must be bound in order to start");if(!0===this.started)throw new Error("server is already started");this.started=!0}tryShutdown(e){var t;const r=t=>{(0,h.unregisterChannelzRef)(this.channelzRef),e(t)};let n=0;function i(){n--,0===n&&r()}this.shutdown=!0;for(const[e,r]of this.http2Servers.entries()){n++;const s=r.channelzRef.name;this.trace("Waiting for server "+s+" to close"),this.closeServer(e,()=>{this.trace("Server "+s+" finished closing"),i()});for(const e of r.sessions.keys()){n++;const r=null===(t=e.socket)||void 0===t?void 0:t.remoteAddress;this.trace("Waiting for session "+r+" to close"),this.closeSession(e,()=>{this.trace("Session "+r+" finished closing"),i()})}}0===n&&r()}addHttp2Port(){throw new Error("Not yet implemented")}getChannelzRef(){return this.channelzRef}_verifyContentType(e,t){const n=t[r.constants.HTTP2_HEADER_CONTENT_TYPE];return!("string"!=typeof n||!n.startsWith("application/grpc"))||(e.respond({[r.constants.HTTP2_HEADER_STATUS]:r.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE},{endStream:!0}),!1)}_retrieveHandler(e){A("Received call to method "+e+" at address "+this.serverAddressString);const t=this.handlers.get(e);return void 0===t?(A("No handler registered for method "+e+". Sending UNIMPLEMENTED status."),null):t}_respondWithError(e,t,n=null){var s,a;const o=Object.assign({"grpc-status":null!==(s=e.code)&&void 0!==s?s:i.Status.INTERNAL,"grpc-message":e.details,[r.constants.HTTP2_HEADER_STATUS]:r.constants.HTTP_STATUS_OK,[r.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},null===(a=e.metadata)||void 0===a?void 0:a.toHttp2Headers());t.respond(o,{endStream:!0}),this.callTracker.addCallFailed(),null==n||n.streamTracker.addCallFailed()}_channelzHandler(e,t,r){this.onStreamOpened(t);const n=this.sessions.get(t.session);if(this.callTracker.addCallStarted(),null==n||n.streamTracker.addCallStarted(),!this._verifyContentType(t,r))return this.callTracker.addCallFailed(),void(null==n||n.streamTracker.addCallFailed());const s=r[v],a=this._retrieveHandler(s);if(!a)return void this._respondWithError(S(s),t,n);const o={addMessageSent:()=>{n&&(n.messagesSent+=1,n.lastMessageSentTimestamp=new Date)},addMessageReceived:()=>{n&&(n.messagesReceived+=1,n.lastMessageReceivedTimestamp=new Date)},onCallEnd:e=>{e.code===i.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()},onStreamEnd:e=>{n&&(e?n.streamTracker.addCallSucceeded():n.streamTracker.addCallFailed())}},l=(0,d.getServerInterceptingCall)([...e,...this.interceptors],t,r,o,a,this.options);this._runHandlerForCall(l,a)||(this.callTracker.addCallFailed(),null==n||n.streamTracker.addCallFailed(),l.sendStatus({code:i.Status.INTERNAL,details:`Unknown handler type: ${a.type}`}))}_streamHandler(e,t,r){if(this.onStreamOpened(t),!0!==this._verifyContentType(t,r))return;const n=r[v],s=this._retrieveHandler(n);if(!s)return void this._respondWithError(S(n),t,null);const a=(0,d.getServerInterceptingCall)([...e,...this.interceptors],t,r,null,s,this.options);this._runHandlerForCall(a,s)||a.sendStatus({code:i.Status.INTERNAL,details:`Unknown handler type: ${s.type}`})}_runHandlerForCall(e,t){const{type:r}=t;if("unary"===r)!async function(e,t){let r,n;function a(t,r,n,a){t?e.sendStatus((0,s.serverErrorToStatus)(t,n)):e.sendMessage(r,()=>{e.sendStatus({code:i.Status.OK,details:"OK",metadata:null!=n?n:null})})}let o=null;e.start({onReceiveMetadata(t){n=t,e.startRead()},onReceiveMessage(r){o?e.sendStatus({code:i.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${t.path}`,metadata:null}):(o=r,e.startRead())},onReceiveHalfClose(){if(o){r=new s.ServerWritableStreamImpl(t.path,e,n,o);try{t.func(r,a)}catch(t){e.sendStatus({code:i.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}}else e.sendStatus({code:i.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${t.path}`,metadata:null})},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"))}})}(e,t);else if("clientStream"===r)!function(e,t){let r;function n(t,r,n,a){t?e.sendStatus((0,s.serverErrorToStatus)(t,n)):e.sendMessage(r,()=>{e.sendStatus({code:i.Status.OK,details:"OK",metadata:null!=n?n:null})})}e.start({onReceiveMetadata(a){r=new s.ServerDuplexStreamImpl(t.path,e,a);try{t.func(r,n)}catch(t){e.sendStatus({code:i.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}},onReceiveMessage(e){r.push(e)},onReceiveHalfClose(){r.push(null)},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}(e,t);else if("serverStream"===r)!function(e,t){let r,n,a=null;e.start({onReceiveMetadata(t){n=t,e.startRead()},onReceiveMessage(r){a?e.sendStatus({code:i.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${t.path}`,metadata:null}):(a=r,e.startRead())},onReceiveHalfClose(){if(a){r=new s.ServerWritableStreamImpl(t.path,e,n,a);try{t.func(r)}catch(t){e.sendStatus({code:i.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}}else e.sendStatus({code:i.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${t.path}`,metadata:null})},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}(e,t);else{if("bidi"!==r)return!1;!function(e,t){let r;e.start({onReceiveMetadata(n){r=new s.ServerDuplexStreamImpl(t.path,e,n);try{t.func(r)}catch(t){e.sendStatus({code:i.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}},onReceiveMessage(e){r.push(e)},onReceiveHalfClose(){r.push(null)},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}(e,t)}return!0}_setupHandlers(e,t){if(null===e)return;const r=e.address();let n="null";r&&(n="string"==typeof r?r:r.address+":"+r.port),this.serverAddressString=n;const i=this.channelzEnabled?this._channelzHandler:this._streamHandler,s=this.channelzEnabled?this._channelzSessionHandler(e):this._sessionHandler(e);e.on("stream",i.bind(this,t)),e.on("session",s)}_sessionHandler(e){return t=>{var n,i;null===(n=this.http2Servers.get(e))||void 0===n||n.sessions.add(t);let s=null,a=null,o=null,l=!1;const c=this.enableIdleTimeout(t);if(this.maxConnectionAgeMs!==p){const e=this.maxConnectionAgeMs/10,n=Math.random()*e*2-e;s=setTimeout(()=>{var e,n;l=!0,this.trace("Connection dropped by max connection age: "+(null===(e=t.socket)||void 0===e?void 0:e.remoteAddress));try{t.goaway(r.constants.NGHTTP2_NO_ERROR,~(1<<31),m)}catch(e){return void t.destroy()}t.close(),this.maxConnectionAgeGraceMs!==p&&(a=setTimeout(()=>{t.destroy()},this.maxConnectionAgeGraceMs),null===(n=a.unref)||void 0===n||n.call(a))},this.maxConnectionAgeMs+n),null===(i=s.unref)||void 0===i||i.call(s)}const u=()=>{o&&(clearTimeout(o),o=null)},h=()=>!t.destroyed&&this.keepaliveTimeMs<f&&this.keepaliveTimeMs>0;let d;const g=()=>{var e;h()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),o=setTimeout(()=>{u(),d()},this.keepaliveTimeMs),null===(e=o.unref)||void 0===e||e.call(o))};d=()=>{var e;if(!h())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let r="";try{t.ping((e,r,n)=>{u(),e?(this.keepaliveTrace("Ping failed with error: "+e.message),l=!0,t.destroy()):(this.keepaliveTrace("Received ping response"),g())})||(r="Ping returned false")}catch(e){r=(e instanceof Error?e.message:"")||"Unknown error"}if(r)return this.keepaliveTrace("Ping send failed: "+r),this.trace("Connection dropped due to ping send error: "+r),l=!0,void t.destroy();o=setTimeout(()=>{u(),this.keepaliveTrace("Ping timeout passed without response"),this.trace("Connection dropped by keepalive timeout"),l=!0,t.destroy()},this.keepaliveTimeoutMs),null===(e=o.unref)||void 0===e||e.call(o)},g(),t.on("close",()=>{var r,n;l||this.trace(`Connection dropped by client ${null===(r=t.socket)||void 0===r?void 0:r.remoteAddress}`),s&&clearTimeout(s),a&&clearTimeout(a),u(),null!==c&&(clearTimeout(c.timeout),this.sessionIdleTimeouts.delete(t)),null===(n=this.http2Servers.get(e))||void 0===n||n.sessions.delete(t)})}}_channelzSessionHandler(e){return t=>{var n,i,s,a;const o=(0,h.registerChannelzSocket)(null!==(i=null===(n=t.socket)||void 0===n?void 0:n.remoteAddress)&&void 0!==i?i:"unknown",this.getChannelzSessionInfo.bind(this,t),this.channelzEnabled),l={ref:o,streamTracker:new h.ChannelzCallTracker,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null};null===(s=this.http2Servers.get(e))||void 0===s||s.sessions.add(t),this.sessions.set(t,l);const c=`${t.socket.remoteAddress}:${t.socket.remotePort}`;this.channelzTrace.addTrace("CT_INFO","Connection established by client "+c),this.trace("Connection established by client "+c),this.sessionChildrenTracker.refChild(o);let u=null,d=null,g=null,v=!1;const A=this.enableIdleTimeout(t);if(this.maxConnectionAgeMs!==p){const e=this.maxConnectionAgeMs/10,n=Math.random()*e*2-e;u=setTimeout(()=>{var e;v=!0,this.channelzTrace.addTrace("CT_INFO","Connection dropped by max connection age from "+c);try{t.goaway(r.constants.NGHTTP2_NO_ERROR,~(1<<31),m)}catch(e){return void t.destroy()}t.close(),this.maxConnectionAgeGraceMs!==p&&(d=setTimeout(()=>{t.destroy()},this.maxConnectionAgeGraceMs),null===(e=d.unref)||void 0===e||e.call(d))},this.maxConnectionAgeMs+n),null===(a=u.unref)||void 0===a||a.call(u)}const y=()=>{g&&(clearTimeout(g),g=null)},C=()=>!t.destroyed&&this.keepaliveTimeMs<f&&this.keepaliveTimeMs>0;let S;const E=()=>{var e;C()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),g=setTimeout(()=>{y(),S()},this.keepaliveTimeMs),null===(e=g.unref)||void 0===e||e.call(g))};S=()=>{var e;if(!C())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let r="";try{const e=t.ping((e,r,n)=>{y(),e?(this.keepaliveTrace("Ping failed with error: "+e.message),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to error of a ping frame "+e.message+" return in "+r),v=!0,t.destroy()):(this.keepaliveTrace("Received ping response"),E())});e||(r="Ping returned false")}catch(e){r=(e instanceof Error?e.message:"")||"Unknown error"}if(r)return this.keepaliveTrace("Ping send failed: "+r),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to ping send error: "+r),v=!0,void t.destroy();l.keepAlivesSent+=1,g=setTimeout(()=>{y(),this.keepaliveTrace("Ping timeout passed without response"),this.channelzTrace.addTrace("CT_INFO","Connection dropped by keepalive timeout from "+c),v=!0,t.destroy()},this.keepaliveTimeoutMs),null===(e=g.unref)||void 0===e||e.call(g)},E(),t.on("close",()=>{var r;v||this.channelzTrace.addTrace("CT_INFO","Connection dropped by client "+c),this.sessionChildrenTracker.unrefChild(o),(0,h.unregisterChannelzRef)(o),u&&clearTimeout(u),d&&clearTimeout(d),y(),null!==A&&(clearTimeout(A.timeout),this.sessionIdleTimeouts.delete(t)),null===(r=this.http2Servers.get(e))||void 0===r||r.sessions.delete(t),this.sessions.delete(t)})}}enableIdleTimeout(e){var t,r;if(this.sessionIdleTimeout>=g)return null;const n={activeStreams:0,lastIdle:Date.now(),onClose:this.onStreamClose.bind(this,e),timeout:setTimeout(this.onIdleTimeout,this.sessionIdleTimeout,this,e)};null===(r=(t=n.timeout).unref)||void 0===r||r.call(t),this.sessionIdleTimeouts.set(e,n);const{socket:i}=e;return this.trace("Enable idle timeout for "+i.remoteAddress+":"+i.remotePort),n}onIdleTimeout(e,t){const{socket:r}=t,n=e.sessionIdleTimeouts.get(t);void 0!==n&&0===n.activeStreams&&(Date.now()-n.lastIdle>=e.sessionIdleTimeout?(e.trace("Session idle timeout triggered for "+(null==r?void 0:r.remoteAddress)+":"+(null==r?void 0:r.remotePort)+" last idle at "+n.lastIdle),e.closeSession(t)):n.timeout.refresh())}onStreamOpened(e){const t=e.session,r=this.sessionIdleTimeouts.get(t);r&&(r.activeStreams+=1,e.once("close",r.onClose))}onStreamClose(e){var t,r;const n=this.sessionIdleTimeouts.get(e);n&&(n.activeStreams-=1,0===n.activeStreams&&(n.lastIdle=Date.now(),n.timeout.refresh(),this.trace("Session onStreamClose"+(null===(t=e.socket)||void 0===t?void 0:t.remoteAddress)+":"+(null===(r=e.socket)||void 0===r?void 0:r.remotePort)+" at "+n.lastIdle)))}},(()=>{const e="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;E=[C("Calling start() is no longer necessary. It can be safely omitted.")],t(n,null,E,{kind:"method",name:"start",static:!1,private:!1,access:{has:e=>"start"in e,get:e=>e.start},metadata:e},null,_),e&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})})(),n})();return server.Server=E,server}var statusBuilder={},hasRequiredStatusBuilder;function requireStatusBuilder(){if(hasRequiredStatusBuilder)return statusBuilder;hasRequiredStatusBuilder=1,Object.defineProperty(statusBuilder,"__esModule",{value:!0}),statusBuilder.StatusBuilder=void 0;return statusBuilder.StatusBuilder=class{constructor(){this.code=null,this.details=null,this.metadata=null}withCode(e){return this.code=e,this}withDetails(e){return this.details=e,this}withMetadata(e){return this.metadata=e,this}build(){const e={};return null!==this.code&&(e.code=this.code),null!==this.details&&(e.details=this.details),null!==this.metadata&&(e.metadata=this.metadata),e}},statusBuilder}var experimental={},loadBalancerPickFirst={},hasRequiredLoadBalancerPickFirst;function requireLoadBalancerPickFirst(){if(hasRequiredLoadBalancerPickFirst)return loadBalancerPickFirst;hasRequiredLoadBalancerPickFirst=1,Object.defineProperty(loadBalancerPickFirst,"__esModule",{value:!0}),loadBalancerPickFirst.LeafLoadBalancer=loadBalancerPickFirst.PickFirstLoadBalancer=loadBalancerPickFirst.PickFirstLoadBalancingConfig=void 0,loadBalancerPickFirst.shuffled=p,loadBalancerPickFirst.setup=function(){(0,e.registerLoadBalancerType)(u,g,h),(0,e.registerDefaultLoadBalancerType)(u)};const e=requireLoadBalancer(),t=requireConnectivityState(),r=requirePicker(),n=requireSubchannelAddress(),i=requireLogging(),s=requireConstants(),a=requireSubchannelAddress(),o=require$$0$3,l=requireCallInterface();function c(e){i.trace(s.LogVerbosity.DEBUG,"pick_first",e)}const u="pick_first";class h{constructor(e){this.shuffleAddressList=e}getLoadBalancerName(){return u}toJsonObject(){return{[u]:{shuffleAddressList:this.shuffleAddressList}}}getShuffleAddressList(){return this.shuffleAddressList}static createFromJson(e){if("shuffleAddressList"in e&&"boolean"!=typeof e.shuffleAddressList)throw new Error("pick_first config field shuffleAddressList must be a boolean if provided");return new h(!0===e.shuffleAddressList)}}loadBalancerPickFirst.PickFirstLoadBalancingConfig=h;class d{constructor(e){this.subchannel=e}pick(e){return{pickResultType:r.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,onCallStarted:null,onCallEnded:null}}}function p(e){const t=e.slice();for(let e=t.length-1;e>1;e--){const r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}const f="grpc-node.internal.pick-first.report_health_status";class g{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=t.ConnectivityState.IDLE,this.currentSubchannelIndex=0,this.currentPick=null,this.subchannelStateListener=(e,t,r,n,i)=>{this.onSubchannelStateUpdate(e,t,r,i)},this.pickedSubchannelHealthListener=()=>this.calculateAndReportNewState(),this.stickyTransientFailureMode=!1,this.reportHealthStatus=!1,this.lastError=null,this.latestAddressList=null,this.latestOptions={},this.latestResolutionNote="",this.connectionDelayTimeout=setTimeout(()=>{},0),clearTimeout(this.connectionDelayTimeout)}allChildrenHaveReportedTF(){return this.children.every(e=>e.hasReportedTransientFailure)}resetChildrenReportedTF(){this.children.every(e=>e.hasReportedTransientFailure=!1)}calculateAndReportNewState(){var e;if(this.currentPick)if(this.reportHealthStatus&&!this.currentPick.isHealthy()){const e=`Picked subchannel ${this.currentPick.getAddress()} is unhealthy`;this.updateState(t.ConnectivityState.TRANSIENT_FAILURE,new r.UnavailablePicker({details:e}),e)}else this.updateState(t.ConnectivityState.READY,new d(this.currentPick),null);else if(0===(null===(e=this.latestAddressList)||void 0===e?void 0:e.length)){const e=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(t.ConnectivityState.TRANSIENT_FAILURE,new r.UnavailablePicker({details:e}),e)}else if(0===this.children.length)this.updateState(t.ConnectivityState.IDLE,new r.QueuePicker(this),null);else if(this.stickyTransientFailureMode){const e=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(t.ConnectivityState.TRANSIENT_FAILURE,new r.UnavailablePicker({details:e}),e)}else this.updateState(t.ConnectivityState.CONNECTING,new r.QueuePicker(this),null)}requestReresolution(){this.channelControlHelper.requestReresolution()}maybeEnterStickyTransientFailureMode(){if(this.allChildrenHaveReportedTF())if(this.requestReresolution(),this.resetChildrenReportedTF(),this.stickyTransientFailureMode)this.calculateAndReportNewState();else{this.stickyTransientFailureMode=!0;for(const{subchannel:e}of this.children)e.startConnecting();this.calculateAndReportNewState()}}removeCurrentPick(){null!==this.currentPick&&(this.currentPick.removeConnectivityStateListener(this.subchannelStateListener),this.channelControlHelper.removeChannelzChild(this.currentPick.getChannelzRef()),this.currentPick.removeHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick.unref(),this.currentPick=null)}onSubchannelStateUpdate(e,r,n,i){var s;if(null===(s=this.currentPick)||void 0===s?void 0:s.realSubchannelEquals(e))n!==t.ConnectivityState.READY&&(this.removeCurrentPick(),this.calculateAndReportNewState());else for(const[r,s]of this.children.entries())if(e.realSubchannelEquals(s.subchannel))return n===t.ConnectivityState.READY&&this.pickSubchannel(s.subchannel),n===t.ConnectivityState.TRANSIENT_FAILURE&&(s.hasReportedTransientFailure=!0,i&&(this.lastError=i),this.maybeEnterStickyTransientFailureMode(),r===this.currentSubchannelIndex&&this.startNextSubchannelConnecting(r+1)),void s.subchannel.startConnecting()}startNextSubchannelConnecting(e){clearTimeout(this.connectionDelayTimeout);for(const[r,n]of this.children.entries())if(r>=e){const e=n.subchannel.getConnectivityState();if(e===t.ConnectivityState.IDLE||e===t.ConnectivityState.CONNECTING)return void this.startConnecting(r)}this.maybeEnterStickyTransientFailureMode()}startConnecting(e){var r,n;clearTimeout(this.connectionDelayTimeout),this.currentSubchannelIndex=e,this.children[e].subchannel.getConnectivityState()===t.ConnectivityState.IDLE&&(c("Start connecting to subchannel with address "+this.children[e].subchannel.getAddress()),process.nextTick(()=>{var t;null===(t=this.children[e])||void 0===t||t.subchannel.startConnecting()})),this.connectionDelayTimeout=setTimeout(()=>{this.startNextSubchannelConnecting(e+1)},250),null===(n=(r=this.connectionDelayTimeout).unref)||void 0===n||n.call(r)}pickSubchannel(e){c("Pick subchannel with address "+e.getAddress()),this.stickyTransientFailureMode=!1,e.ref(),this.channelControlHelper.addChannelzChild(e.getChannelzRef()),this.removeCurrentPick(),this.resetSubchannelList(),e.addConnectivityStateListener(this.subchannelStateListener),e.addHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick=e,clearTimeout(this.connectionDelayTimeout),this.calculateAndReportNewState()}updateState(e,r,n){c(t.ConnectivityState[this.currentState]+" -> "+t.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,r,n)}resetSubchannelList(){for(const e of this.children)e.subchannel.removeConnectivityStateListener(this.subchannelStateListener),e.subchannel.unref(),this.channelControlHelper.removeChannelzChild(e.subchannel.getChannelzRef());this.currentSubchannelIndex=0,this.children=[]}connectToAddressList(e,r){c("connectToAddressList(["+e.map(e=>(0,n.subchannelAddressToString)(e))+"])");const i=e.map(e=>({subchannel:this.channelControlHelper.createSubchannel(e,r),hasReportedTransientFailure:!1}));for(const{subchannel:e}of i)if(e.getConnectivityState()===t.ConnectivityState.READY)return void this.pickSubchannel(e);for(const{subchannel:e}of i)e.ref(),this.channelControlHelper.addChannelzChild(e.getChannelzRef());this.resetSubchannelList(),this.children=i;for(const{subchannel:e}of this.children)e.addConnectivityStateListener(this.subchannelStateListener);for(const e of this.children)e.subchannel.getConnectivityState()===t.ConnectivityState.TRANSIENT_FAILURE&&(e.hasReportedTransientFailure=!0);this.startNextSubchannelConnecting(0),this.calculateAndReportNewState()}updateAddressList(e,i,s,l){if(!(i instanceof h))return!1;if(!e.ok)return 0===this.children.length&&null===this.currentPick&&this.channelControlHelper.updateState(t.ConnectivityState.TRANSIENT_FAILURE,new r.UnavailablePicker(e.error),e.error.details),!0;let u=e.value;this.reportHealthStatus=s[f],i.getShuffleAddressList()&&(u=p(u));const d=[].concat(...u.map(e=>e.addresses));c("updateAddressList(["+d.map(e=>(0,n.subchannelAddressToString)(e))+"])");const g=function(e){if(0===e.length)return[];const t=[],r=[],n=[],i=(0,a.isTcpSubchannelAddress)(e[0])&&(0,o.isIPv6)(e[0].host);for(const t of e)(0,a.isTcpSubchannelAddress)(t)&&(0,o.isIPv6)(t.host)?r.push(t):n.push(t);const s=i?r:n,l=i?n:r;for(let e=0;e<Math.max(s.length,l.length);e++)e<s.length&&t.push(s[e]),e<l.length&&t.push(l[e]);return t}(d);return this.latestAddressList=g,this.latestOptions=s,this.connectToAddressList(g,s),this.latestResolutionNote=l,d.length>0||(this.lastError="No addresses resolved",!1)}exitIdle(){this.currentState===t.ConnectivityState.IDLE&&this.latestAddressList&&this.connectToAddressList(this.latestAddressList,this.latestOptions)}resetBackoff(){}destroy(){this.resetSubchannelList(),this.removeCurrentPick()}getTypeName(){return u}}loadBalancerPickFirst.PickFirstLoadBalancer=g;const v=new h(!1);return loadBalancerPickFirst.LeafLoadBalancer=class{constructor(n,i,s,a){this.endpoint=n,this.options=s,this.resolutionNote=a,this.latestState=t.ConnectivityState.IDLE;const o=(0,e.createChildChannelControlHelper)(i,{updateState:(e,t,r)=>{this.latestState=e,this.latestPicker=t,i.updateState(e,t,r)}});this.pickFirstBalancer=new g(o),this.latestPicker=new r.QueuePicker(this.pickFirstBalancer)}startConnecting(){this.pickFirstBalancer.updateAddressList((0,l.statusOrFromValue)([this.endpoint]),v,Object.assign(Object.assign({},this.options),{[f]:!0}),this.resolutionNote)}updateEndpoint(e,r){this.options=r,this.endpoint=e,this.latestState!==t.ConnectivityState.IDLE&&this.startConnecting()}getConnectivityState(){return this.latestState}getPicker(){return this.latestPicker}getEndpoint(){return this.endpoint}exitIdle(){this.pickFirstBalancer.exitIdle()}destroy(){this.pickFirstBalancer.destroy()}},loadBalancerPickFirst}var certificateProvider={},hasRequiredCertificateProvider,hasRequiredExperimental;function requireCertificateProvider(){if(hasRequiredCertificateProvider)return certificateProvider;hasRequiredCertificateProvider=1,Object.defineProperty(certificateProvider,"__esModule",{value:!0}),certificateProvider.FileWatcherCertificateProvider=void 0;const e=require$$0,t=requireLogging(),r=requireConstants();function n(e){t.trace(r.LogVerbosity.DEBUG,"certificate_provider",e)}const i=(0,require$$1$5.promisify)(e.readFile);return certificateProvider.FileWatcherCertificateProvider=class{constructor(e){if(this.config=e,this.refreshTimer=null,this.fileResultPromise=null,this.latestCaUpdate=void 0,this.caListeners=new Set,this.latestIdentityUpdate=void 0,this.identityListeners=new Set,this.lastUpdateTime=null,void 0===e.certificateFile!=(void 0===e.privateKeyFile))throw new Error("certificateFile and privateKeyFile must be set or unset together");if(void 0===e.certificateFile&&void 0===e.caCertificateFile)throw new Error("At least one of certificateFile and caCertificateFile must be set");n("File watcher constructed with config "+JSON.stringify(e))}updateCertificates(){this.fileResultPromise||(this.fileResultPromise=Promise.allSettled([this.config.certificateFile?i(this.config.certificateFile):Promise.reject(),this.config.privateKeyFile?i(this.config.privateKeyFile):Promise.reject(),this.config.caCertificateFile?i(this.config.caCertificateFile):Promise.reject()]),this.fileResultPromise.then(([e,t,r])=>{if(this.refreshTimer){n("File watcher read certificates certificate "+e.status+", privateKey "+t.status+", CA certificate "+r.status),this.lastUpdateTime=new Date,this.fileResultPromise=null,"fulfilled"===e.status&&"fulfilled"===t.status?this.latestIdentityUpdate={certificate:e.value,privateKey:t.value}:this.latestIdentityUpdate=null,"fulfilled"===r.status?this.latestCaUpdate={caCertificate:r.value}:this.latestCaUpdate=null;for(const e of this.identityListeners)e(this.latestIdentityUpdate);for(const e of this.caListeners)e(this.latestCaUpdate)}}),n("File watcher initiated certificate update"))}maybeStartWatchingFiles(){if(!this.refreshTimer){const e=this.lastUpdateTime?(new Date).getTime()-this.lastUpdateTime.getTime():1/0;e>this.config.refreshIntervalMs&&this.updateCertificates(),e>2*this.config.refreshIntervalMs&&(this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0),this.refreshTimer=setInterval(()=>this.updateCertificates(),this.config.refreshIntervalMs),n("File watcher started watching")}}maybeStopWatchingFiles(){0===this.caListeners.size&&0===this.identityListeners.size&&(this.fileResultPromise=null,this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null))}addCaCertificateListener(e){this.caListeners.add(e),this.maybeStartWatchingFiles(),void 0!==this.latestCaUpdate&&process.nextTick(e,this.latestCaUpdate)}removeCaCertificateListener(e){this.caListeners.delete(e),this.maybeStopWatchingFiles()}addIdentityCertificateListener(e){this.identityListeners.add(e),this.maybeStartWatchingFiles(),void 0!==this.latestIdentityUpdate&&process.nextTick(e,this.latestIdentityUpdate)}removeIdentityCertificateListener(e){this.identityListeners.delete(e),this.maybeStopWatchingFiles()}},certificateProvider}function requireExperimental(){return hasRequiredExperimental||(hasRequiredExperimental=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=e.createCertificateProviderChannelCredentials=e.FileWatcherCertificateProvider=e.createCertificateProviderServerCredentials=e.createServerCredentialsWithInterceptors=e.BaseSubchannelWrapper=e.registerAdminService=e.FilterStackFactory=e.BaseFilter=e.statusOrFromError=e.statusOrFromValue=e.PickResultType=e.QueuePicker=e.UnavailablePicker=e.ChildLoadBalancerHandler=e.EndpointMap=e.endpointHasAddress=e.endpointToString=e.subchannelAddressToString=e.LeafLoadBalancer=e.isLoadBalancerNameRegistered=e.parseLoadBalancingConfig=e.selectLbConfigFromList=e.registerLoadBalancerType=e.createChildChannelControlHelper=e.BackoffTimeout=e.parseDuration=e.durationToMs=e.splitHostPort=e.uriToString=e.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=e.createResolver=e.registerResolver=e.log=e.trace=void 0;var t=requireLogging();Object.defineProperty(e,"trace",{enumerable:!0,get:function(){return t.trace}}),Object.defineProperty(e,"log",{enumerable:!0,get:function(){return t.log}});var r=requireResolver();Object.defineProperty(e,"registerResolver",{enumerable:!0,get:function(){return r.registerResolver}}),Object.defineProperty(e,"createResolver",{enumerable:!0,get:function(){return r.createResolver}}),Object.defineProperty(e,"CHANNEL_ARGS_CONFIG_SELECTOR_KEY",{enumerable:!0,get:function(){return r.CHANNEL_ARGS_CONFIG_SELECTOR_KEY}});var n=requireUriParser();Object.defineProperty(e,"uriToString",{enumerable:!0,get:function(){return n.uriToString}}),Object.defineProperty(e,"splitHostPort",{enumerable:!0,get:function(){return n.splitHostPort}});var i=requireDuration();Object.defineProperty(e,"durationToMs",{enumerable:!0,get:function(){return i.durationToMs}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return i.parseDuration}});var s=requireBackoffTimeout();Object.defineProperty(e,"BackoffTimeout",{enumerable:!0,get:function(){return s.BackoffTimeout}});var a=requireLoadBalancer();Object.defineProperty(e,"createChildChannelControlHelper",{enumerable:!0,get:function(){return a.createChildChannelControlHelper}}),Object.defineProperty(e,"registerLoadBalancerType",{enumerable:!0,get:function(){return a.registerLoadBalancerType}}),Object.defineProperty(e,"selectLbConfigFromList",{enumerable:!0,get:function(){return a.selectLbConfigFromList}}),Object.defineProperty(e,"parseLoadBalancingConfig",{enumerable:!0,get:function(){return a.parseLoadBalancingConfig}}),Object.defineProperty(e,"isLoadBalancerNameRegistered",{enumerable:!0,get:function(){return a.isLoadBalancerNameRegistered}});var o=requireLoadBalancerPickFirst();Object.defineProperty(e,"LeafLoadBalancer",{enumerable:!0,get:function(){return o.LeafLoadBalancer}});var l=requireSubchannelAddress();Object.defineProperty(e,"subchannelAddressToString",{enumerable:!0,get:function(){return l.subchannelAddressToString}}),Object.defineProperty(e,"endpointToString",{enumerable:!0,get:function(){return l.endpointToString}}),Object.defineProperty(e,"endpointHasAddress",{enumerable:!0,get:function(){return l.endpointHasAddress}}),Object.defineProperty(e,"EndpointMap",{enumerable:!0,get:function(){return l.EndpointMap}});var c=requireLoadBalancerChildHandler();Object.defineProperty(e,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return c.ChildLoadBalancerHandler}});var u=requirePicker();Object.defineProperty(e,"UnavailablePicker",{enumerable:!0,get:function(){return u.UnavailablePicker}}),Object.defineProperty(e,"QueuePicker",{enumerable:!0,get:function(){return u.QueuePicker}}),Object.defineProperty(e,"PickResultType",{enumerable:!0,get:function(){return u.PickResultType}});var h=requireCallInterface();Object.defineProperty(e,"statusOrFromValue",{enumerable:!0,get:function(){return h.statusOrFromValue}}),Object.defineProperty(e,"statusOrFromError",{enumerable:!0,get:function(){return h.statusOrFromError}});var d=requireFilter();Object.defineProperty(e,"BaseFilter",{enumerable:!0,get:function(){return d.BaseFilter}});var p=requireFilterStack();Object.defineProperty(e,"FilterStackFactory",{enumerable:!0,get:function(){return p.FilterStackFactory}});var f=requireAdmin();Object.defineProperty(e,"registerAdminService",{enumerable:!0,get:function(){return f.registerAdminService}});var g=requireSubchannelInterface();Object.defineProperty(e,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return g.BaseSubchannelWrapper}});var v=requireServerCredentials();Object.defineProperty(e,"createServerCredentialsWithInterceptors",{enumerable:!0,get:function(){return v.createServerCredentialsWithInterceptors}}),Object.defineProperty(e,"createCertificateProviderServerCredentials",{enumerable:!0,get:function(){return v.createCertificateProviderServerCredentials}});var m=requireCertificateProvider();Object.defineProperty(e,"FileWatcherCertificateProvider",{enumerable:!0,get:function(){return m.FileWatcherCertificateProvider}});var A=requireChannelCredentials();Object.defineProperty(e,"createCertificateProviderChannelCredentials",{enumerable:!0,get:function(){return A.createCertificateProviderChannelCredentials}});var y=requireInternalChannel();Object.defineProperty(e,"SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX",{enumerable:!0,get:function(){return y.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX}})}(experimental)),experimental}var resolverUds={},hasRequiredResolverUds;function requireResolverUds(){if(hasRequiredResolverUds)return resolverUds;hasRequiredResolverUds=1,Object.defineProperty(resolverUds,"__esModule",{value:!0}),resolverUds.setup=function(){(0,e.registerResolver)("unix",r)};const e=requireResolver(),t=requireCallInterface();class r{constructor(e,t,r){let n;this.listener=t,this.hasReturnedResult=!1,this.endpoints=[],n=""===e.authority?"/"+e.path:e.path,this.endpoints=[{addresses:[{path:n}]}]}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(this.listener,(0,t.statusOrFromValue)(this.endpoints),{},null,""))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return"localhost"}}return resolverUds}var resolverIp={},hasRequiredResolverIp;function requireResolverIp(){if(hasRequiredResolverIp)return resolverIp;hasRequiredResolverIp=1,Object.defineProperty(resolverIp,"__esModule",{value:!0}),resolverIp.setup=function(){(0,i.registerResolver)(c,h),(0,i.registerResolver)(u,h)};const e=require$$0$3,t=requireCallInterface(),r=requireConstants(),n=requireMetadata(),i=requireResolver(),s=requireSubchannelAddress(),a=requireUriParser(),o=requireLogging();function l(e){o.trace(r.LogVerbosity.DEBUG,"ip_resolver",e)}const c="ipv4",u="ipv6";class h{constructor(t,i,o){var h;this.listener=i,this.endpoints=[],this.error=null,this.hasReturnedResult=!1,l("Resolver constructed for target "+(0,a.uriToString)(t));const d=[];if(t.scheme!==c&&t.scheme!==u)return void(this.error={code:r.Status.UNAVAILABLE,details:`Unrecognized scheme ${t.scheme} in IP resolver`,metadata:new n.Metadata});const p=t.path.split(",");for(const i of p){const s=(0,a.splitHostPort)(i);if(null===s)return void(this.error={code:r.Status.UNAVAILABLE,details:`Failed to parse ${t.scheme} address ${i}`,metadata:new n.Metadata});if(t.scheme===c&&!(0,e.isIPv4)(s.host)||t.scheme===u&&!(0,e.isIPv6)(s.host))return void(this.error={code:r.Status.UNAVAILABLE,details:`Failed to parse ${t.scheme} address ${i}`,metadata:new n.Metadata});d.push({host:s.host,port:null!==(h=s.port)&&void 0!==h?h:443})}this.endpoints=d.map(e=>({addresses:[e]})),l("Parsed "+t.scheme+" address list "+d.map(s.subchannelAddressToString))}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(()=>{this.error?this.listener((0,t.statusOrFromError)(this.error),{},null,""):this.listener((0,t.statusOrFromValue)(this.endpoints),{},null,"")}))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return e.path.split(",")[0]}}return resolverIp}var loadBalancerRoundRobin={},hasRequiredLoadBalancerRoundRobin;function requireLoadBalancerRoundRobin(){if(hasRequiredLoadBalancerRoundRobin)return loadBalancerRoundRobin;hasRequiredLoadBalancerRoundRobin=1,Object.defineProperty(loadBalancerRoundRobin,"__esModule",{value:!0}),loadBalancerRoundRobin.RoundRobinLoadBalancer=void 0,loadBalancerRoundRobin.setup=function(){(0,e.registerLoadBalancerType)(l,h,c)};const e=requireLoadBalancer(),t=requireConnectivityState(),r=requirePicker(),n=requireLogging(),i=requireConstants(),s=requireSubchannelAddress(),a=requireLoadBalancerPickFirst();function o(e){n.trace(i.LogVerbosity.DEBUG,"round_robin",e)}const l="round_robin";class c{getLoadBalancerName(){return l}constructor(){}toJsonObject(){return{[l]:{}}}static createFromJson(e){return new c}}class u{constructor(e,t=0){this.children=e,this.nextIndex=t}pick(e){const t=this.children[this.nextIndex].picker;return this.nextIndex=(this.nextIndex+1)%this.children.length,t.pick(e)}peekNextEndpoint(){return this.children[this.nextIndex].endpoint}}class h{constructor(r){this.channelControlHelper=r,this.children=[],this.currentState=t.ConnectivityState.IDLE,this.currentReadyPicker=null,this.updatesPaused=!1,this.lastError=null,this.childChannelControlHelper=(0,e.createChildChannelControlHelper)(r,{updateState:(e,r,n)=>{this.currentState===t.ConnectivityState.READY&&e!==t.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),n&&(this.lastError=n),this.calculateAndUpdateState()}})}countChildrenWithState(e){return this.children.filter(t=>t.getConnectivityState()===e).length}calculateAndUpdateState(){if(!this.updatesPaused){if(this.countChildrenWithState(t.ConnectivityState.READY)>0){const e=this.children.filter(e=>e.getConnectivityState()===t.ConnectivityState.READY);let r=0;if(null!==this.currentReadyPicker){const t=this.currentReadyPicker.peekNextEndpoint();r=e.findIndex(e=>(0,s.endpointEqual)(e.getEndpoint(),t)),r<0&&(r=0)}this.updateState(t.ConnectivityState.READY,new u(e.map(e=>({endpoint:e.getEndpoint(),picker:e.getPicker()})),r),null)}else if(this.countChildrenWithState(t.ConnectivityState.CONNECTING)>0)this.updateState(t.ConnectivityState.CONNECTING,new r.QueuePicker(this),null);else if(this.countChildrenWithState(t.ConnectivityState.TRANSIENT_FAILURE)>0){const e=`round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(t.ConnectivityState.TRANSIENT_FAILURE,new r.UnavailablePicker({details:e}),e)}else this.updateState(t.ConnectivityState.IDLE,new r.QueuePicker(this),null);for(const e of this.children)e.getConnectivityState()===t.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,r,n){o(t.ConnectivityState[this.currentState]+" -> "+t.ConnectivityState[e]),e===t.ConnectivityState.READY?this.currentReadyPicker=r:this.currentReadyPicker=null,this.currentState=e,this.channelControlHelper.updateState(e,r,n)}resetSubchannelList(){for(const e of this.children)e.destroy();this.children=[]}updateAddressList(e,n,i,l){if(!(n instanceof c))return!1;if(!e.ok)return 0===this.children.length&&this.updateState(t.ConnectivityState.TRANSIENT_FAILURE,new r.UnavailablePicker(e.error),e.error.details),!0;const u=Math.random()*e.value.length|0,h=function(e,t){return[...e.slice(t),...e.slice(0,t)]}(e.value,u);if(this.resetSubchannelList(),0===h.length){const e=`No addresses resolved. Resolution note: ${l}`;this.updateState(t.ConnectivityState.TRANSIENT_FAILURE,new r.UnavailablePicker({details:e}),e)}o("Connect to endpoint list "+h.map(s.endpointToString)),this.updatesPaused=!0,this.children=h.map(e=>new a.LeafLoadBalancer(e,this.childChannelControlHelper,i,l));for(const e of this.children)e.startConnecting();return this.updatesPaused=!1,this.calculateAndUpdateState(),!0}exitIdle(){}resetBackoff(){}destroy(){this.resetSubchannelList()}getTypeName(){return l}}return loadBalancerRoundRobin.RoundRobinLoadBalancer=h,loadBalancerRoundRobin}var loadBalancerOutlierDetection={},hasRequiredLoadBalancerOutlierDetection;function requireLoadBalancerOutlierDetection(){if(hasRequiredLoadBalancerOutlierDetection)return loadBalancerOutlierDetection;var e;hasRequiredLoadBalancerOutlierDetection=1,Object.defineProperty(loadBalancerOutlierDetection,"__esModule",{value:!0}),loadBalancerOutlierDetection.OutlierDetectionLoadBalancer=loadBalancerOutlierDetection.OutlierDetectionLoadBalancingConfig=void 0,loadBalancerOutlierDetection.setup=function(){p&&(0,i.registerLoadBalancerType)(d,_,y)};const t=requireConnectivityState(),r=requireConstants(),n=requireDuration(),i=requireExperimental(),s=requireLoadBalancer(),a=requireLoadBalancerChildHandler(),o=requirePicker(),l=requireSubchannelAddress(),c=requireSubchannelInterface(),u=requireLogging();function h(e){u.trace(r.LogVerbosity.DEBUG,"outlier_detection",e)}const d="outlier_detection",p="true"===(null!==(e=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)&&void 0!==e?e:"true"),f={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},g={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function v(e,t,r,n){if(t in e&&void 0!==e[t]&&typeof e[t]!==r){throw new Error(`outlier detection config ${n?`${n}.${t}`:t} parse error: expected ${r}, got ${typeof e[t]}`)}}function m(e,t,r){const i=t;if(t in e&&void 0!==e[t]){if(!(0,n.isDuration)(e[t]))throw new Error(`outlier detection config ${i} parse error: expected Duration, got ${typeof e[t]}`);if(!(e[t].seconds>=0&&e[t].seconds<=315576e6&&e[t].nanos>=0&&e[t].nanos<=999999999))throw new Error(`outlier detection config ${i} parse error: values out of range for non-negative Duaration`)}}function A(e,t,r){const n=r?`${r}.${t}`:t;if(v(e,t,"number",r),t in e&&void 0!==e[t]&&!(e[t]>=0&&e[t]<=100))throw new Error(`outlier detection config ${n} parse error: value out of range for percentage (0-100)`)}class y{constructor(e,t,r,n,i,s,a){if(this.childPolicy=a,"pick_first"===a.getLoadBalancerName())throw new Error("outlier_detection LB policy cannot have a pick_first child policy");this.intervalMs=null!=e?e:1e4,this.baseEjectionTimeMs=null!=t?t:3e4,this.maxEjectionTimeMs=null!=r?r:3e5,this.maxEjectionPercent=null!=n?n:10,this.successRateEjection=i?Object.assign(Object.assign({},f),i):null,this.failurePercentageEjection=s?Object.assign(Object.assign({},g),s):null}getLoadBalancerName(){return d}toJsonObject(){var e,t;return{outlier_detection:{interval:(0,n.msToDuration)(this.intervalMs),base_ejection_time:(0,n.msToDuration)(this.baseEjectionTimeMs),max_ejection_time:(0,n.msToDuration)(this.maxEjectionTimeMs),max_ejection_percent:this.maxEjectionPercent,success_rate_ejection:null!==(e=this.successRateEjection)&&void 0!==e?e:void 0,failure_percentage_ejection:null!==(t=this.failurePercentageEjection)&&void 0!==t?t:void 0,child_policy:[this.childPolicy.toJsonObject()]}}}getIntervalMs(){return this.intervalMs}getBaseEjectionTimeMs(){return this.baseEjectionTimeMs}getMaxEjectionTimeMs(){return this.maxEjectionTimeMs}getMaxEjectionPercent(){return this.maxEjectionPercent}getSuccessRateEjectionConfig(){return this.successRateEjection}getFailurePercentageEjectionConfig(){return this.failurePercentageEjection}getChildPolicy(){return this.childPolicy}static createFromJson(e){var t;if(m(e,"interval"),m(e,"base_ejection_time"),m(e,"max_ejection_time"),A(e,"max_ejection_percent"),"success_rate_ejection"in e&&void 0!==e.success_rate_ejection){if("object"!=typeof e.success_rate_ejection)throw new Error("outlier detection config success_rate_ejection must be an object");v(e.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),A(e.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),v(e.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),v(e.success_rate_ejection,"request_volume","number","success_rate_ejection")}if("failure_percentage_ejection"in e&&void 0!==e.failure_percentage_ejection){if("object"!=typeof e.failure_percentage_ejection)throw new Error("outlier detection config failure_percentage_ejection must be an object");A(e.failure_percentage_ejection,"threshold","failure_percentage_ejection"),A(e.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),v(e.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),v(e.failure_percentage_ejection,"request_volume","number","failure_percentage_ejection")}if(!("child_policy"in e)||!Array.isArray(e.child_policy))throw new Error("outlier detection config child_policy must be an array");const r=(0,s.selectLbConfigFromList)(e.child_policy);if(!r)throw new Error("outlier detection config child_policy: no valid recognized policy found");return new y(e.interval?(0,n.durationToMs)(e.interval):null,e.base_ejection_time?(0,n.durationToMs)(e.base_ejection_time):null,e.max_ejection_time?(0,n.durationToMs)(e.max_ejection_time):null,null!==(t=e.max_ejection_percent)&&void 0!==t?t:null,e.success_rate_ejection,e.failure_percentage_ejection,r)}}loadBalancerOutlierDetection.OutlierDetectionLoadBalancingConfig=y;class C extends c.BaseSubchannelWrapper{constructor(e,t){super(e),this.mapEntry=t,this.refCount=0}ref(){this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0&&this.mapEntry){const e=this.mapEntry.subchannelWrappers.indexOf(this);e>=0&&this.mapEntry.subchannelWrappers.splice(e,1)}}eject(){this.setHealthy(!1)}uneject(){this.setHealthy(!0)}getMapEntry(){return this.mapEntry}getWrappedSubchannel(){return this.child}}class S{constructor(){this.activeBucket={success:0,failure:0},this.inactiveBucket={success:0,failure:0}}addSuccess(){this.activeBucket.success+=1}addFailure(){this.activeBucket.failure+=1}switchBuckets(){this.inactiveBucket=this.activeBucket,this.activeBucket={success:0,failure:0}}getLastSuccesses(){return this.inactiveBucket.success}getLastFailures(){return this.inactiveBucket.failure}}class E{constructor(e,t){this.wrappedPicker=e,this.countCalls=t}pick(e){const t=this.wrappedPicker.pick(e);if(t.pickResultType===o.PickResultType.COMPLETE){const e=t.subchannel,n=e.getMapEntry();if(n){let i=t.onCallEnded;return this.countCalls&&(i=(e,i,s)=>{var a;e===r.Status.OK?n.counter.addSuccess():n.counter.addFailure(),null===(a=t.onCallEnded)||void 0===a||a.call(t,e,i,s)}),Object.assign(Object.assign({},t),{subchannel:e.getWrappedSubchannel(),onCallEnded:i})}return Object.assign(Object.assign({},t),{subchannel:e.getWrappedSubchannel()})}return t}}class _{constructor(e){this.entryMap=new l.EndpointMap,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new a.ChildLoadBalancerHandler((0,i.createChildChannelControlHelper)(e,{createSubchannel:(t,r)=>{const n=e.createSubchannel(t,r),i=this.entryMap.getForSubchannelAddress(t),s=new C(n,i);return null!==(null==i?void 0:i.currentEjectionTimestamp)&&s.eject(),null==i||i.subchannelWrappers.push(s),s},updateState:(r,n,i)=>{r===t.ConnectivityState.READY?e.updateState(r,new E(n,this.isCountingEnabled()),i):e.updateState(r,n,i)}})),this.ejectionTimer=setInterval(()=>{},0),clearInterval(this.ejectionTimer)}isCountingEnabled(){return null!==this.latestConfig&&(null!==this.latestConfig.getSuccessRateEjectionConfig()||null!==this.latestConfig.getFailurePercentageEjectionConfig())}getCurrentEjectionPercent(){let e=0;for(const t of this.entryMap.values())null!==t.currentEjectionTimestamp&&(e+=1);return 100*e/this.entryMap.size}runSuccessRateCheck(e){if(!this.latestConfig)return;const t=this.latestConfig.getSuccessRateEjectionConfig();if(!t)return;h("Running success rate check");const r=t.request_volume;let n=0;const i=[];for(const[e,t]of this.entryMap.entries()){const s=t.counter.getLastSuccesses(),a=t.counter.getLastFailures();h("Stats for "+(0,l.endpointToString)(e)+": successes="+s+" failures="+a+" targetRequestVolume="+r),s+a>=r&&(n+=1,i.push(s/(s+a)))}if(h("Found "+n+" success rate candidates; currentEjectionPercent="+this.getCurrentEjectionPercent()+" successRates=["+i+"]"),n<t.minimum_hosts)return;const s=i.reduce((e,t)=>e+t)/i.length;let a=0;for(const e of i){const t=e-s;a+=t*t}const o=a/i.length,c=Math.sqrt(o),u=s-c*(t.stdev_factor/1e3);h("stdev="+c+" ejectionThreshold="+u);for(const[n,i]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;const s=i.counter.getLastSuccesses(),a=i.counter.getLastFailures();if(s+a<r)continue;const o=s/(s+a);if(h("Checking candidate "+n+" successRate="+o),o<u){const r=100*Math.random();h("Candidate "+n+" randomNumber="+r+" enforcement_percentage="+t.enforcement_percentage),r<t.enforcement_percentage&&(h("Ejecting candidate "+n),this.eject(i,e))}}}runFailurePercentageCheck(e){if(!this.latestConfig)return;const t=this.latestConfig.getFailurePercentageEjectionConfig();if(!t)return;h("Running failure percentage check. threshold="+t.threshold+" request volume threshold="+t.request_volume);let r=0;for(const e of this.entryMap.values()){e.counter.getLastSuccesses()+e.counter.getLastFailures()>=t.request_volume&&(r+=1)}if(!(r<t.minimum_hosts))for(const[r,n]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;const i=n.counter.getLastSuccesses(),s=n.counter.getLastFailures();if(h("Candidate successes="+i+" failures="+s),i+s<t.request_volume)continue;if(100*s/(s+i)>t.threshold){const i=100*Math.random();h("Candidate "+r+" randomNumber="+i+" enforcement_percentage="+t.enforcement_percentage),i<t.enforcement_percentage&&(h("Ejecting candidate "+r),this.eject(n,e))}}}eject(e,t){e.currentEjectionTimestamp=new Date,e.ejectionTimeMultiplier+=1;for(const t of e.subchannelWrappers)t.eject()}uneject(e){e.currentEjectionTimestamp=null;for(const t of e.subchannelWrappers)t.uneject()}switchAllBuckets(){for(const e of this.entryMap.values())e.counter.switchBuckets()}startTimer(e){var t,r;this.ejectionTimer=setTimeout(()=>this.runChecks(),e),null===(r=(t=this.ejectionTimer).unref)||void 0===r||r.call(t)}runChecks(){const e=new Date;if(h("Ejection timer running"),this.switchAllBuckets(),this.latestConfig){this.timerStartTime=e,this.startTimer(this.latestConfig.getIntervalMs()),this.runSuccessRateCheck(e),this.runFailurePercentageCheck(e);for(const[e,t]of this.entryMap.entries())if(null===t.currentEjectionTimestamp)t.ejectionTimeMultiplier>0&&(t.ejectionTimeMultiplier-=1);else{const r=this.latestConfig.getBaseEjectionTimeMs(),n=this.latestConfig.getMaxEjectionTimeMs(),i=new Date(t.currentEjectionTimestamp.getTime());i.setMilliseconds(i.getMilliseconds()+Math.min(r*t.ejectionTimeMultiplier,Math.max(r,n))),i<new Date&&(h("Unejecting "+e),this.uneject(t))}}}updateAddressList(e,t,r,n){if(!(t instanceof y))return!1;if(h("Received update with config: "+JSON.stringify(t.toJsonObject(),void 0,2)),e.ok){for(const t of e.value)this.entryMap.has(t)||(h("Adding map entry for "+(0,l.endpointToString)(t)),this.entryMap.set(t,{counter:new S,currentEjectionTimestamp:null,ejectionTimeMultiplier:0,subchannelWrappers:[]}));this.entryMap.deleteMissing(e.value)}const i=t.getChildPolicy();if(this.childBalancer.updateAddressList(e,i,r,n),t.getSuccessRateEjectionConfig()||t.getFailurePercentageEjectionConfig())if(this.timerStartTime){h("Previous timer existed. Replacing timer"),clearTimeout(this.ejectionTimer);const e=t.getIntervalMs()-((new Date).getTime()-this.timerStartTime.getTime());this.startTimer(e)}else h("Starting new timer"),this.timerStartTime=new Date,this.startTimer(t.getIntervalMs()),this.switchAllBuckets();else{h("Counting disabled. Cancelling timer."),this.timerStartTime=null,clearTimeout(this.ejectionTimer);for(const e of this.entryMap.values())this.uneject(e),e.ejectionTimeMultiplier=0}return this.latestConfig=t,!0}exitIdle(){this.childBalancer.exitIdle()}resetBackoff(){this.childBalancer.resetBackoff()}destroy(){clearTimeout(this.ejectionTimer),this.childBalancer.destroy()}getTypeName(){return d}}return loadBalancerOutlierDetection.OutlierDetectionLoadBalancer=_,loadBalancerOutlierDetection}var loadBalancerWeightedRoundRobin={},priorityQueue={},hasRequiredPriorityQueue,hasRequiredLoadBalancerWeightedRoundRobin,hasRequiredSrc;function requirePriorityQueue(){if(hasRequiredPriorityQueue)return priorityQueue;hasRequiredPriorityQueue=1,Object.defineProperty(priorityQueue,"__esModule",{value:!0}),priorityQueue.PriorityQueue=void 0;const e=e=>Math.floor(e/2),t=e=>2*e+1,r=e=>2*e+2;return priorityQueue.PriorityQueue=class{constructor(e=(e,t)=>e>t){this.comparator=e,this.heap=[]}size(){return this.heap.length}isEmpty(){return 0==this.size()}peek(){return this.heap[0]}push(...e){return e.forEach(e=>{this.heap.push(e),this.siftUp()}),this.size()}pop(){const e=this.peek(),t=this.size()-1;return t>0&&this.swap(0,t),this.heap.pop(),this.siftDown(),e}replace(e){const t=this.peek();return this.heap[0]=e,this.siftDown(),t}greater(e,t){return this.comparator(this.heap[e],this.heap[t])}swap(e,t){[this.heap[e],this.heap[t]]=[this.heap[t],this.heap[e]]}siftUp(){let t=this.size()-1;for(;t>0&&this.greater(t,e(t));)this.swap(t,e(t)),t=e(t)}siftDown(){let e=0;for(;t(e)<this.size()&&this.greater(t(e),e)||r(e)<this.size()&&this.greater(r(e),e);){let n=r(e)<this.size()&&this.greater(r(e),t(e))?r(e):t(e);this.swap(e,n),e=n}}},priorityQueue}function requireLoadBalancerWeightedRoundRobin(){if(hasRequiredLoadBalancerWeightedRoundRobin)return loadBalancerWeightedRoundRobin;hasRequiredLoadBalancerWeightedRoundRobin=1,Object.defineProperty(loadBalancerWeightedRoundRobin,"__esModule",{value:!0}),loadBalancerWeightedRoundRobin.WeightedRoundRobinLoadBalancingConfig=void 0,loadBalancerWeightedRoundRobin.setup=function(){(0,n.registerLoadBalancerType)(h,v,f)};const e=requireConnectivityState(),t=requireConstants(),r=requireDuration(),n=requireLoadBalancer(),i=requireLoadBalancerPickFirst(),s=requireLogging(),a=requireOrca(),o=requirePicker(),l=requirePriorityQueue(),c=requireSubchannelAddress();function u(e){s.trace(t.LogVerbosity.DEBUG,"weighted_round_robin",e)}const h="weighted_round_robin";function d(e,t,r){if(t in e&&void 0!==e[t]&&typeof e[t]!==r)throw new Error(`weighted round robin config ${t} parse error: expected ${r}, got ${typeof e[t]}`)}function p(e,t){if(t in e&&void 0!==e[t]&&null!==e[t]){let n;if((0,r.isDuration)(e[t]))n=e[t];else if((0,r.isDurationMessage)(e[t]))n=(0,r.durationMessageToDuration)(e[t]);else{if("string"!=typeof e[t])throw new Error(`weighted round robin config ${t}: expected duration, got ${typeof e[t]}`);{const i=(0,r.parseDuration)(e[t]);if(!i)throw new Error(`weighted round robin config ${t}: failed to parse duration string ${e[t]}`);n=i}}return(0,r.durationToMs)(n)}return null}class f{constructor(e,t,r,n,i,s){this.enableOobLoadReport=null!=e&&e,this.oobLoadReportingPeriodMs=null!=t?t:1e4,this.blackoutPeriodMs=null!=r?r:1e4,this.weightExpirationPeriodMs=null!=n?n:18e4,this.weightUpdatePeriodMs=Math.max(null!=i?i:1e3,100),this.errorUtilizationPenalty=null!=s?s:1}getLoadBalancerName(){return h}toJsonObject(){return{enable_oob_load_report:this.enableOobLoadReport,oob_load_reporting_period:(0,r.durationToString)((0,r.msToDuration)(this.oobLoadReportingPeriodMs)),blackout_period:(0,r.durationToString)((0,r.msToDuration)(this.blackoutPeriodMs)),weight_expiration_period:(0,r.durationToString)((0,r.msToDuration)(this.weightExpirationPeriodMs)),weight_update_period:(0,r.durationToString)((0,r.msToDuration)(this.weightUpdatePeriodMs)),error_utilization_penalty:this.errorUtilizationPenalty}}static createFromJson(e){if(d(e,"enable_oob_load_report","boolean"),d(e,"error_utilization_penalty","number"),e.error_utilization_penalty<0)throw new Error("weighted round robin config error_utilization_penalty < 0");return new f(e.enable_oob_load_report,p(e,"oob_load_reporting_period"),p(e,"blackout_period"),p(e,"weight_expiration_period"),p(e,"weight_update_period"),e.error_utilization_penalty)}getEnableOobLoadReport(){return this.enableOobLoadReport}getOobLoadReportingPeriodMs(){return this.oobLoadReportingPeriodMs}getBlackoutPeriodMs(){return this.blackoutPeriodMs}getWeightExpirationPeriodMs(){return this.weightExpirationPeriodMs}getWeightUpdatePeriodMs(){return this.weightUpdatePeriodMs}getErrorUtilizationPenalty(){return this.errorUtilizationPenalty}}loadBalancerWeightedRoundRobin.WeightedRoundRobinLoadBalancingConfig=f;class g{constructor(e,t){this.metricsHandler=t,this.queue=new l.PriorityQueue((e,t)=>e.deadline<t.deadline);const r=e.filter(e=>e.weight>0);let n;if(r.length<2)n=1;else{let e=0;for(const{weight:t}of r)e+=t;n=e/r.length}for(const t of e){const e=t.weight>0?1/t.weight:n;this.queue.push({endpointName:t.endpointName,picker:t.picker,period:e,deadline:Math.random()*e})}}pick(e){const t=this.queue.pop();this.queue.push(Object.assign(Object.assign({},t),{deadline:t.deadline+t.period}));const r=t.picker.pick(e);if(r.pickResultType===o.PickResultType.COMPLETE){if(this.metricsHandler)return Object.assign(Object.assign({},r),{onCallEnded:(0,a.createMetricsReader)(e=>this.metricsHandler(e,t.endpointName),r.onCallEnded)});{const e=r.subchannel;return Object.assign(Object.assign({},r),{subchannel:e.getWrappedSubchannel()})}}return r}}class v{constructor(t){this.channelControlHelper=t,this.latestConfig=null,this.children=new Map,this.currentState=e.ConnectivityState.IDLE,this.updatesPaused=!1,this.lastError=null,this.weightUpdateTimer=null}countChildrenWithState(e){let t=0;for(const r of this.children.values())r.child.getConnectivityState()===e&&(t+=1);return t}updateWeight(e,t){var r,n;const i=t.rps_fractional;let s=t.application_utilization;s>0&&i>0&&(s+=t.eps/i*(null!==(n=null===(r=this.latestConfig)||void 0===r?void 0:r.getErrorUtilizationPenalty())&&void 0!==n?n:0));const a=0===s?0:i/s;if(0===a)return;const o=new Date;null===e.nonEmptySince&&(e.nonEmptySince=o),e.lastUpdated=o,e.weight=a}getWeight(e){if(!this.latestConfig)return 0;const t=(new Date).getTime();if(t-e.lastUpdated.getTime()>=this.latestConfig.getWeightExpirationPeriodMs())return e.nonEmptySince=null,0;const r=this.latestConfig.getBlackoutPeriodMs();return r>0&&(null===e.nonEmptySince||t-e.nonEmptySince.getTime()<r)?0:e.weight}calculateAndUpdateState(){if(!this.updatesPaused&&this.latestConfig){if(this.countChildrenWithState(e.ConnectivityState.READY)>0){const t=[];for(const[r,n]of this.children)n.child.getConnectivityState()===e.ConnectivityState.READY&&t.push({endpointName:r,picker:n.child.getPicker(),weight:this.getWeight(n)});let r;u("Created picker with weights: "+t.map(e=>e.endpointName+":"+e.weight).join(",")),r=this.latestConfig.getEnableOobLoadReport()?null:(e,t)=>{const r=this.children.get(t);r&&this.updateWeight(r,e)},this.updateState(e.ConnectivityState.READY,new g(t,r),null)}else if(this.countChildrenWithState(e.ConnectivityState.CONNECTING)>0)this.updateState(e.ConnectivityState.CONNECTING,new o.QueuePicker(this),null);else if(this.countChildrenWithState(e.ConnectivityState.TRANSIENT_FAILURE)>0){const t=`weighted_round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(e.ConnectivityState.TRANSIENT_FAILURE,new o.UnavailablePicker({details:t}),t)}else this.updateState(e.ConnectivityState.IDLE,new o.QueuePicker(this),null);for(const{child:t}of this.children.values())t.getConnectivityState()===e.ConnectivityState.IDLE&&t.exitIdle()}}updateState(t,r,n){u(e.ConnectivityState[this.currentState]+" -> "+e.ConnectivityState[t]),this.currentState=t,this.channelControlHelper.updateState(t,r,n)}updateAddressList(t,r,s,l){var h,d;if(!(r instanceof f))return!1;if(!t.ok)return 0===this.children.size&&this.updateState(e.ConnectivityState.TRANSIENT_FAILURE,new o.UnavailablePicker(t.error),t.error.details),!0;if(0===t.value.length){const t=`No addresses resolved. Resolution note: ${l}`;return this.updateState(e.ConnectivityState.TRANSIENT_FAILURE,new o.UnavailablePicker({details:t}),t),!1}u("Connect to endpoint list "+t.value.map(c.endpointToString));const p=new Date,g=new Set;this.updatesPaused=!0,this.latestConfig=r;for(const o of t.value){const t=(0,c.endpointToString)(o);g.add(t);let u=this.children.get(t);u||(u={child:new i.LeafLoadBalancer(o,(0,n.createChildChannelControlHelper)(this.channelControlHelper,{updateState:(t,r,n)=>{this.currentState===e.ConnectivityState.READY&&t!==e.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),t===e.ConnectivityState.READY&&(u.nonEmptySince=null),n&&(this.lastError=n),this.calculateAndUpdateState()},createSubchannel:(e,t)=>{const r=this.channelControlHelper.createSubchannel(e,t);return(null==u?void 0:u.oobMetricsListener)?new a.OrcaOobMetricsSubchannelWrapper(r,u.oobMetricsListener,this.latestConfig.getOobLoadReportingPeriodMs()):r}}),s,l),lastUpdated:p,nonEmptySince:null,weight:0,oobMetricsListener:null},this.children.set(t,u)),r.getEnableOobLoadReport()?u.oobMetricsListener=e=>{this.updateWeight(u,e)}:u.oobMetricsListener=null}for(const[e,t]of this.children)g.has(e)?t.child.startConnecting():(t.child.destroy(),this.children.delete(e));return this.updatesPaused=!1,this.calculateAndUpdateState(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer),this.weightUpdateTimer=null===(d=(h=setInterval(()=>{this.currentState===e.ConnectivityState.READY&&this.calculateAndUpdateState()},r.getWeightUpdatePeriodMs())).unref)||void 0===d?void 0:d.call(h),!0}exitIdle(){}resetBackoff(){}destroy(){for(const e of this.children.values())e.child.destroy();this.children.clear(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer)}getTypeName(){return h}}return loadBalancerWeightedRoundRobin}function requireSrc(){return hasRequiredSrc||(hasRequiredSrc=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.experimental=e.ServerMetricRecorder=e.ServerInterceptingCall=e.ResponderBuilder=e.ServerListenerBuilder=e.addAdminServicesToServer=e.getChannelzHandlers=e.getChannelzServiceDefinition=e.InterceptorConfigurationError=e.InterceptingCall=e.RequesterBuilder=e.ListenerBuilder=e.StatusBuilder=e.getClientChannel=e.ServerCredentials=e.Server=e.setLogVerbosity=e.setLogger=e.load=e.loadObject=e.CallCredentials=e.ChannelCredentials=e.waitForClientReady=e.closeClient=e.Channel=e.makeGenericClientConstructor=e.makeClientConstructor=e.loadPackageDefinition=e.Client=e.compressionAlgorithms=e.propagate=e.connectivityState=e.status=e.logVerbosity=e.Metadata=e.credentials=void 0;const t=requireCallCredentials();Object.defineProperty(e,"CallCredentials",{enumerable:!0,get:function(){return t.CallCredentials}});const r=requireChannel();Object.defineProperty(e,"Channel",{enumerable:!0,get:function(){return r.ChannelImplementation}});const n=requireCompressionAlgorithms();Object.defineProperty(e,"compressionAlgorithms",{enumerable:!0,get:function(){return n.CompressionAlgorithms}});const i=requireConnectivityState();Object.defineProperty(e,"connectivityState",{enumerable:!0,get:function(){return i.ConnectivityState}});const s=requireChannelCredentials();Object.defineProperty(e,"ChannelCredentials",{enumerable:!0,get:function(){return s.ChannelCredentials}});const a=requireClient();Object.defineProperty(e,"Client",{enumerable:!0,get:function(){return a.Client}});const o=requireConstants();Object.defineProperty(e,"logVerbosity",{enumerable:!0,get:function(){return o.LogVerbosity}}),Object.defineProperty(e,"status",{enumerable:!0,get:function(){return o.Status}}),Object.defineProperty(e,"propagate",{enumerable:!0,get:function(){return o.Propagate}});const l=requireLogging(),c=requireMakeClient();Object.defineProperty(e,"loadPackageDefinition",{enumerable:!0,get:function(){return c.loadPackageDefinition}}),Object.defineProperty(e,"makeClientConstructor",{enumerable:!0,get:function(){return c.makeClientConstructor}}),Object.defineProperty(e,"makeGenericClientConstructor",{enumerable:!0,get:function(){return c.makeClientConstructor}});const u=requireMetadata();Object.defineProperty(e,"Metadata",{enumerable:!0,get:function(){return u.Metadata}});const h=requireServer();Object.defineProperty(e,"Server",{enumerable:!0,get:function(){return h.Server}});const d=requireServerCredentials();Object.defineProperty(e,"ServerCredentials",{enumerable:!0,get:function(){return d.ServerCredentials}});const p=requireStatusBuilder();Object.defineProperty(e,"StatusBuilder",{enumerable:!0,get:function(){return p.StatusBuilder}}),e.credentials={combineChannelCredentials:(e,...t)=>t.reduce((e,t)=>e.compose(t),e),combineCallCredentials:(e,...t)=>t.reduce((e,t)=>e.compose(t),e),createInsecure:s.ChannelCredentials.createInsecure,createSsl:s.ChannelCredentials.createSsl,createFromSecureContext:s.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:t.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:t.CallCredentials.createFromGoogleCredential,createEmpty:t.CallCredentials.createEmpty};e.closeClient=e=>e.close();e.waitForClientReady=(e,t,r)=>e.waitForReady(t,r);e.loadObject=(e,t)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};e.load=(e,t,r)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};e.setLogger=e=>{l.setLogger(e)};e.setLogVerbosity=e=>{l.setLoggerVerbosity(e)};e.getClientChannel=e=>a.Client.prototype.getChannel.call(e);var f=requireClientInterceptors();Object.defineProperty(e,"ListenerBuilder",{enumerable:!0,get:function(){return f.ListenerBuilder}}),Object.defineProperty(e,"RequesterBuilder",{enumerable:!0,get:function(){return f.RequesterBuilder}}),Object.defineProperty(e,"InterceptingCall",{enumerable:!0,get:function(){return f.InterceptingCall}}),Object.defineProperty(e,"InterceptorConfigurationError",{enumerable:!0,get:function(){return f.InterceptorConfigurationError}});var g=requireChannelz();Object.defineProperty(e,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return g.getChannelzServiceDefinition}}),Object.defineProperty(e,"getChannelzHandlers",{enumerable:!0,get:function(){return g.getChannelzHandlers}});var v=requireAdmin();Object.defineProperty(e,"addAdminServicesToServer",{enumerable:!0,get:function(){return v.addAdminServicesToServer}});var m=requireServerInterceptors();Object.defineProperty(e,"ServerListenerBuilder",{enumerable:!0,get:function(){return m.ServerListenerBuilder}}),Object.defineProperty(e,"ResponderBuilder",{enumerable:!0,get:function(){return m.ResponderBuilder}}),Object.defineProperty(e,"ServerInterceptingCall",{enumerable:!0,get:function(){return m.ServerInterceptingCall}});var A=requireOrca();Object.defineProperty(e,"ServerMetricRecorder",{enumerable:!0,get:function(){return A.ServerMetricRecorder}});const y=requireExperimental();e.experimental=y;const C=requireResolverDns(),S=requireResolverUds(),E=requireResolverIp(),_=requireLoadBalancerPickFirst(),b=requireLoadBalancerRoundRobin(),T=requireLoadBalancerOutlierDetection(),R=requireLoadBalancerWeightedRoundRobin(),x=requireChannelz();C.setup(),S.setup(),E.setup(),_.setup(),b.setup(),T.setup(),R.setup(),x.setup()}(src$2)),src$2}var srcExports=requireSrc();const A$1=await async function(e={}){var t=e,r=!!globalThis.window,n=!!globalThis.WorkerGlobalScope,i=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type;if(i){const{createRequire:e}=await import("module");var s=e(import.meta.url)}var a=(e,t)=>{throw t},o=import.meta.url;if(i)s("fs"),o.startsWith("file:")&&s("path").dirname(s("url").fileURLToPath(o)),process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),a=(e,t)=>{throw process.exitCode=e,t};else if(r||n)try{new URL(".",o).href}catch{}console.log.bind(console);var l,c,u,h,d,p,f,g,v,m,A,y,C,S,E=console.error.bind(console),_=!1,b=!1;function T(){var e=Te.buffer;h=new Int8Array(e),p=new Int16Array(e),d=new Uint8Array(e),f=new Uint16Array(e),g=new Int32Array(e),v=new Uint32Array(e),m=new Float32Array(e),A=new Float64Array(e),y=new BigInt64Array(e),C=new BigUint64Array(e)}function R(e){t.onAbort?.(e),E(e="Aborted("+e+")"),_=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw u?.(r),r}class x{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var w=e=>{for(;e.length>0;)e.shift()(t)},k=[],N=e=>k.push(e),I=[],O=e=>I.push(e),P=!0;class j{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){v[this.ptr+4>>2]=e}get_type(){return v[this.ptr+4>>2]}set_destructor(e){v[this.ptr+8>>2]=e}get_destructor(){return v[this.ptr+8>>2]}set_caught(e){e=e?1:0,h[this.ptr+12]=e}get_caught(){return 0!=h[this.ptr+12]}set_rethrown(e){e=e?1:0,h[this.ptr+13]=e}get_rethrown(){return 0!=h[this.ptr+13]}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){v[this.ptr+16>>2]=e}get_adjusted_ptr(){return v[this.ptr+16>>2]}}var L=e=>{for(var t="";;){var r=d[e++];if(!r)return t;t+=String.fromCharCode(r)}},q={},M={},D={},F=class extends Error{constructor(e){super(e),this.name="BindingError"}},B=e=>{throw new F(e)};function U(e,t,r={}){return function(e,t,r={}){var n=t.name;if(e||B(`type "${n}" must have a positive integer typeid pointer`),M.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;B(`Cannot register type '${n}' twice`)}if(M[e]=t,delete D[e],q.hasOwnProperty(e)){var i=q[e];delete q[e],i.forEach(e=>e())}}(e,t,r)}var $=(e,t,r)=>{switch(t){case 1:return r?e=>h[e]:e=>d[e];case 2:return r?e=>p[e>>1]:e=>f[e>>1];case 4:return r?e=>g[e>>2]:e=>v[e>>2];case 8:return r?e=>y[e>>3]:e=>C[e>>3];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},z=e=>{B(e.$$.ptrType.registeredClass.name+" instance already deleted")},H=!1,W=e=>{},G=e=>{e.count.value-=1,0===e.count.value&&(e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)})(e)},V=e=>globalThis.FinalizationRegistry?(H=new FinalizationRegistry(e=>{G(e.$$)}),V=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};H.register(e,r,e)}return e},W=e=>H.unregister(e),V(e)):(V=e=>e,e);function Y(){}var K=(e,t)=>Object.defineProperty(t,"name",{value:e}),J={},X=(e,t,r)=>{if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(...n){return e[t].overloadTable.hasOwnProperty(n.length)||B(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[n.length].apply(this,n)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}},Q=(e,r,n)=>{t.hasOwnProperty(e)?(B(`Cannot register public name '${e}' twice`),X(t,e,e),t[e].overloadTable.hasOwnProperty(n)&&B(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`),t[e].overloadTable[n]=r):(t[e]=r,t[e].argCount=n)};function Z(e,t,r,n,i,s,a,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=i,this.getActualType=s,this.upcast=a,this.downcast=o,this.pureVirtualFunctions=[]}var ee=(e,t,r)=>{for(;t!==r;)t.upcast||B(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e},te=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e};function re(e,t){if(null===t)return this.isReference&&B(`null is not a valid ${this.name}`),0;t.$$||B(`Cannot pass "${te(t)}" as a ${this.name}`),t.$$.ptr||B(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return ee(t.$$.ptr,r,this.registeredClass)}function ne(e,t){var r;if(null===t)return this.isReference&&B(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t&&t.$$||B(`Cannot pass "${te(t)}" as a ${this.name}`),t.$$.ptr||B(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&B(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;if(r=ee(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&B("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:B(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var i=t.clone();r=this.rawShare(r,Oe.toHandle(()=>i.delete())),null!==e&&e.push(this.rawDestructor,r)}break;default:B("Unsupporting sharing policy")}return r}function ie(e,t){if(null===t)return this.isReference&&B(`null is not a valid ${this.name}`),0;t.$$||B(`Cannot pass "${te(t)}" as a ${this.name}`),t.$$.ptr||B(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&B(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return ee(t.$$.ptr,r,this.registeredClass)}function se(e){return this.fromWireType(v[e>>2])}var ae=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var n=ae(e,t,r.baseClass);return null===n?null:r.downcast(n)},oe={},le=class extends Error{constructor(e){super(e),this.name="InternalError"}},ce=e=>{throw new le(e)},ue=(e,t)=>(t.ptrType&&t.ptr||ce("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&ce("Both smartPtrType and smartPtr must be specified"),t.count={value:1},V(Object.create(e,{$$:{value:t,writable:!0}})));function he(e,t,r,n,i,s,a,o,l,c,u){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=i,this.pointeeType=s,this.sharingPolicy=a,this.rawGetPointee=o,this.rawConstructor=l,this.rawShare=c,this.rawDestructor=u,i||void 0!==t.baseClass?this.toWireType=ne:n?(this.toWireType=re,this.destructorFunction=null):(this.toWireType=ie,this.destructorFunction=null)}var de=[],pe=(e,t,r=!1)=>{e=L(e);var n,i,s=((i=de[n=t])||(de[n]=i=Re.get(n)),i);return"function"!=typeof s&&B(`unknown function pointer with signature ${e}: ${t}`),s};class fe extends Error{}var ge=e=>{var t=Ee(e),r=L(t);return be(t),r},ve=(e,t)=>{var r=[],n={};throw t.forEach(function e(t){n[t]||M[t]||(D[t]?D[t].forEach(e):(r.push(t),n[t]=!0))}),new fe(`${e}: `+r.map(ge).join([", "]))},me=(e,t,r)=>{function n(t){var n=r(t);n.length!==e.length&&ce("Mismatched type converter count");for(var i=0;i<e.length;++i)U(e[i],n[i])}e.forEach(e=>D[e]=t);var i=new Array(t.length),s=[],a=0;for(let[e,r]of t.entries())M.hasOwnProperty(r)?i[e]=M[r]:(s.push(r),q.hasOwnProperty(r)||(q[r]=[]),q[r].push(()=>{i[e]=M[r],++a===s.length&&n(i)}));0===s.length&&n(i)},Ae=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function ye(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].destructorFunction)return!0;return!1}function Ce(e,t,r,n,i,s){var a=t.length;a<2&&B("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,l=ye(t),c=!t[0].isVoid,u=t[0],h=t[1],d=[e,B,n,i,Ae,u.fromWireType.bind(u),h?.toWireType.bind(h)],p=2;p<a;++p){var f=t[p];d.push(f.toWireType.bind(f))}if(!l)for(p=o?1:2;p<t.length;++p)null!==t[p].destructorFunction&&d.push(t[p].destructorFunction);let g=function(e,t,r,n){var i=ye(e),s=e.length-2,a=[],o=["fn"];t&&o.push("thisWired");for(var l=0;l<s;++l)a.push(`arg${l}`),o.push(`arg${l}Wired`);a=a.join(","),o=o.join(",");var c=`return function (${a}) {\n`;i&&(c+="var destructors = [];\n");var u=i?"destructors":"null",h=["humanName","throwBindingError","invoker","fn","runDestructors","fromRetWire","toClassParamWire"];for(t&&(c+=`var thisWired = toClassParamWire(${u}, this);\n`),l=0;l<s;++l){var d=`toArg${l}Wire`;c+=`var arg${l}Wired = ${d}(${u}, arg${l});\n`,h.push(d)}if(c+=(r||n?"var rv = ":"")+`invoker(${o});\n`,i)c+="runDestructors(destructors);\n";else for(l=t?1:2;l<e.length;++l){var p=1===l?"thisWired":"arg"+(l-2)+"Wired";null!==e[l].destructorFunction&&(c+=`${p}_dtor(${p});\n`,h.push(`${p}_dtor`))}return r&&(c+="var ret = fromRetWire(rv);\nreturn ret;\n"),c+="}\n",new Function(h,c)}(t,o,c,s);var v=g(...d);return K(e,v)}for(var Se,Ee,_e,be,Te,Re,xe=(e,t)=>{for(var r=[],n=0;n<e;n++)r.push(v[t+4*n>>2]);return r},we=e=>{const t=(e=e.trim()).indexOf("(");return-1===t?e:e.slice(0,t)},ke=[],Ne=[0,1,,1,null,1,!0,1,!1,1],Ie=e=>{e>9&&0===--Ne[e+1]&&(Ne[e]=void 0,ke.push(e))},Oe={toValue:e=>(e||B(`Cannot use deleted val. handle = ${e}`),Ne[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const t=ke.pop()||Ne.length;return Ne[t]=e,Ne[t+1]=1,t}}}},Pe={name:"emscripten::val",fromWireType:e=>{var t=Oe.toValue(e);return Ie(e),t},toWireType:(e,t)=>Oe.toHandle(t),readValueFromPointer:se,destructorFunction:null},je=(e,t,r)=>{switch(t){case 1:return r?function(e){return this.fromWireType(h[e])}:function(e){return this.fromWireType(d[e])};case 2:return r?function(e){return this.fromWireType(p[e>>1])}:function(e){return this.fromWireType(f[e>>1])};case 4:return r?function(e){return this.fromWireType(g[e>>2])}:function(e){return this.fromWireType(v[e>>2])};default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Le=(e,t)=>{var r=M[e];return void 0===r&&B(`${t} has unknown type ${ge(e)}`),r},qe=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(m[e>>2])};case 8:return function(e){return this.fromWireType(A[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Me=Object.assign({optional:!0},Pe),De=globalThis.TextDecoder&&new TextDecoder,Fe=(e,t,r,n)=>{var i=t+r;if(n)return i;for(;e[t]&&!(t>=i);)++t;return t},Be=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Ue=(e,t,r)=>{var n=e>>1,i=Fe(f,n,t/2,r);if(i-n>16&&Be)return Be.decode(f.subarray(n,i));for(var s="",a=n;a<i;++a){var o=f[a];s+=String.fromCharCode(o)}return s},$e=(e,t,r)=>{if(r??=2147483647,r<2)return 0;for(var n=t,i=(r-=2)<2*e.length?r/2:e.length,s=0;s<i;++s){var a=e.charCodeAt(s);p[t>>1]=a,t+=2}return p[t>>1]=0,t-n},ze=e=>2*e.length,He=(e,t,r)=>{for(var n="",i=e>>2,s=0;!(s>=t/4);s++){var a=v[i+s];if(!a&&!r)break;n+=String.fromCodePoint(a)}return n},We=(e,t,r)=>{if(r??=2147483647,r<4)return 0;for(var n=t,i=n+r-4,s=0;s<e.length;++s){var a=e.codePointAt(s);if(a>65535&&s++,g[t>>2]=a,(t+=4)+4>i)break}return g[t>>2]=0,t-n},Ge=e=>{for(var t=0,r=0;r<e.length;++r)e.codePointAt(r)>65535&&r++,t+=4;return t},Ve=0,Ye=[],Ke=(e,t,r)=>{var n=[],i=e(n,r);return n.length&&(v[t>>2]=Oe.toHandle(n)),i},Je={},Xe=e=>{var t=Je[e];return void 0===t?L(e):t},Qe={},Ze=e=>{if(e instanceof x||"unwind"==e)return l;a(1,e)},et=()=>P||Ve>0,tt=e=>{l=e,et()||(t.onExit?.(e),_=!0),a(e,new x(e))},rt=e=>{if(!_)try{e(),(()=>{if(!et())try{(e=>{l=e,tt(e)})(l)}catch(e){Ze(e)}})()}catch(e){Ze(e)}},nt=(e,t)=>Math.ceil(e/t)*t,it=e=>{var t=(e-Te.buffer.byteLength+65535)/65536|0;try{return Te.grow(t),T(),1}catch(e){}},st=new Uint8Array(123),at=25;at>=0;--at)st[48+at]=52+at,st[65+at]=at,st[97+at]=26+at;if(st[43]=62,st[47]=63,(()=>{let e=Y.prototype;Object.assign(e,{isAliasOf(e){if(!(this instanceof Y))return!1;if(!(e instanceof Y))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,i=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)i=n.upcast(i),n=n.baseClass;return t===n&&r===i},clone(){if(this.$$.ptr||z(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=V(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||z(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&B("Object already scheduled for deletion"),W(this),G(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||z(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&B("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});const t=Symbol.dispose;t&&(e[t]=e.delete)})(),Object.assign(he.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},readValueFromPointer:se,fromWireType:function(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=((e,t)=>(t=((e,t)=>{for(void 0===t&&B("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t})(e,t),oe[t]))(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function i(){return this.isSmartPointer?ue(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):ue(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,a=this.registeredClass.getActualType(t),o=J[a];if(!o)return i.call(this);s=this.isConst?o.constPointerType:o.pointerType;var l=ae(t,this.registeredClass,s.registeredClass);return null===l?i.call(this):this.isSmartPointer?ue(s.registeredClass.instancePrototype,{ptrType:s,ptr:l,smartPtrType:this,smartPtr:e}):ue(s.registeredClass.instancePrototype,{ptrType:s,ptr:l})}}),t.noExitRuntime&&(P=t.noExitRuntime),t.print&&t.print,t.printErr&&(E=t.printErr),t.wasmBinary&&t.wasmBinary,t.arguments&&t.arguments,t.thisProgram&&t.thisProgram,t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.shift()();var ot,lt={l:(e,t,r)=>{throw new j(e).init(t,r),e},s:()=>R(""),o:(e,t,r,n,i)=>{t=L(t);const s=0n===n;let a=e=>e;if(s){const e=8*r;a=t=>BigInt.asUintN(e,t),i=a(i)}U(e,{name:t,fromWireType:a,toWireType:(e,t)=>("number"==typeof t&&(t=BigInt(t)),t),readValueFromPointer:$(t,r,!s),destructorFunction:null})},w:(e,t,r,n)=>{U(e,{name:t=L(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:n},readValueFromPointer:function(e){return this.fromWireType(d[e])},destructorFunction:null})},e:(e,r,n,i,s,a,o,l,c,u,h,d,p)=>{h=L(h),a=pe(s,a),l&&=pe(o,l),u&&=pe(c,u),p=pe(d,p);var f=(e=>{var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?`_${e}`:e})(h);Q(f,function(){ve(`Cannot construct ${h} due to unbound types`,[i])}),me([e,r,n],i?[i]:[],r=>{var n,s;r=r[0],s=i?(n=r.registeredClass).instancePrototype:Y.prototype;var o=K(h,function(...e){if(Object.getPrototypeOf(this)!==c)throw new F(`Use 'new' to construct ${h}`);if(void 0===d.constructor_body)throw new F(`${h} has no accessible constructor`);var t=d.constructor_body[e.length];if(void 0===t)throw new F(`Tried to invoke ctor of ${h} with invalid number of parameters (${e.length}) - expected (${Object.keys(d.constructor_body).toString()}) parameters instead!`);return t.apply(this,e)}),c=Object.create(s,{constructor:{value:o}});o.prototype=c;var d=new Z(h,o,c,p,n,a,l,u);d.baseClass&&(d.baseClass.__derivedClasses??=[],d.baseClass.__derivedClasses.push(d));var g=new he(h,d,!0,!1,!1),v=new he(h+"*",d,!1,!1,!1),m=new he(h+" const*",d,!1,!0,!1);return J[e]={pointerType:v,constPointerType:m},((e,r,n)=>{t.hasOwnProperty(e)||ce("Replacing nonexistent public symbol"),t[e].overloadTable,t[e]=r,t[e].argCount=n})(f,o),[g,v,m]})},b:(e,t,r,n,i,s,a,o,l)=>{var c=xe(r,n);t=L(t),t=we(t),s=pe(i,s,o),me([],[e],e=>{var n=`${(e=e[0]).name}.${t}`;function i(){ve(`Cannot call ${n} due to unbound types`,c)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]);var l=e.registeredClass.constructor;return void 0===l[t]?(i.argCount=r-1,l[t]=i):(X(l,t,n),l[t].overloadTable[r-1]=i),me([],c,i=>{var c=[i[0],null].concat(i.slice(1)),u=Ce(n,c,null,s,a,o);if(void 0===l[t].overloadTable?(u.argCount=r-1,l[t]=u):l[t].overloadTable[r-1]=u,e.registeredClass.__derivedClasses)for(const r of e.registeredClass.__derivedClasses)r.constructor.hasOwnProperty(t)||(r.constructor[t]=u);return[]}),[]})},n:(e,t,r,n,i,s)=>{var a=xe(t,r);i=pe(n,i),me([],[e],e=>{var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new F(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{ve(`Cannot construct ${e.name} due to unbound types`,a)},me([],a,n=>(n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Ce(r,n,null,i,s),[])),[]})},a:(e,t,r,n,i,s,a,o,l,c)=>{var u=xe(r,n);t=L(t),t=we(t),s=pe(i,s,l),me([],[e],e=>{var n=`${(e=e[0]).name}.${t}`;function i(){ve(`Cannot call ${n} due to unbound types`,u)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,h=c[t];return void 0===h||void 0===h.overloadTable&&h.className!==e.name&&h.argCount===r-2?(i.argCount=r-2,i.className=e.name,c[t]=i):(X(c,t,n),c[t].overloadTable[r-2]=i),me([],u,i=>{var o=Ce(n,i,e,s,a,l);return void 0===c[t].overloadTable?(o.argCount=r-2,c[t]=o):c[t].overloadTable[r-2]=o,[]}),[]})},u:e=>U(e,Pe),z:(e,t,r,n)=>{function i(){}t=L(t),i.values={},U(e,{name:t,constructor:i,fromWireType:function(e){return this.constructor.values[e]},toWireType:(e,t)=>t.value,readValueFromPointer:je(t,r,n),destructorFunction:null}),Q(t,i)},f:(e,t,r)=>{var n=Le(e,"enum");t=L(t);var i=n.constructor,s=Object.create(n.constructor.prototype,{value:{value:r},constructor:{value:K(`${n.name}_${t}`,function(){})}});i.values[r]=s,i[t]=s},m:(e,t,r)=>{U(e,{name:t=L(t),fromWireType:e=>e,toWireType:(e,t)=>t,readValueFromPointer:qe(t,r),destructorFunction:null})},d:(e,t,r,n,i)=>{t=L(t);let s=e=>e;if(0===n){var a=32-8*r;s=e=>e<<a>>>a,i=s(i)}U(e,{name:t,fromWireType:s,toWireType:(e,t)=>t,readValueFromPointer:$(t,r,0!==n),destructorFunction:null})},c:(e,t,r)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][t];function i(e){var t=v[e>>2],r=v[e+4>>2];return new n(h.buffer,r,t)}U(e,{name:r=L(r),fromWireType:i,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})},A:(e,t)=>{U(e,Me)},v:(e,t)=>{U(e,{name:t=L(t),fromWireType(e){var t;return t=((e,t,r)=>e?((e,t=0,r,n)=>{var i=Fe(e,t,r,n);if(i-t>16&&e.buffer&&De)return De.decode(e.subarray(t,i));for(var s="";t<i;){var a=e[t++];if(128&a){var o=63&e[t++];if(192!=(224&a)){var l=63&e[t++];if((a=224==(240&a)?(15&a)<<12|o<<6|l:(7&a)<<18|o<<12|l<<6|63&e[t++])<65536)s+=String.fromCharCode(a);else{var c=a-65536;s+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else s+=String.fromCharCode((31&a)<<6|o)}else s+=String.fromCharCode(a)}return s})(d,e,t,r):"")(e+4,v[e>>2],!0),be(e),t},toWireType(e,t){var r;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var n="string"==typeof t;n||ArrayBuffer.isView(t)&&1==t.BYTES_PER_ELEMENT||B("Cannot pass non-string to std::string"),r=n?(e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t})(t):t.length;var i=Se(4+r+1),s=i+4;return v[i>>2]=r,n?((e,t,r,n)=>{if(!(n>0))return 0;for(var i=r+n-1,s=0;s<e.length;++s){var a=e.codePointAt(s);if(a<=127){if(r>=i)break;t[r++]=a}else if(a<=2047){if(r+1>=i)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(a<=65535){if(r+2>=i)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=i)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a,s++}}t[r]=0})(t,d,s,r+1):d.set(t,s),null!==e&&e.push(be,i),i},readValueFromPointer:se,destructorFunction(e){be(e)}})},j:(e,t,r)=>{var n,i,s;r=L(r),2===t?(n=Ue,i=$e,s=ze):(n=He,i=We,s=Ge),U(e,{name:r,fromWireType:e=>{var r=v[e>>2],i=n(e+4,r*t,!0);return be(e),i},toWireType:(e,n)=>{"string"!=typeof n&&B(`Cannot pass non-string to C++ string type ${r}`);var a=s(n),o=Se(4+a+t);return v[o>>2]=a/t,i(n,o+4,a+t),null!==e&&e.push(be,o),o},readValueFromPointer:se,destructorFunction(e){be(e)}})},x:(e,t)=>{U(e,{isVoid:!0,name:t=L(t),fromWireType:()=>{},toWireType:(e,t)=>{}})},q:()=>{P=!1,Ve=0},i:(e,t,r)=>{var[n,...i]=((e,t)=>{for(var r=new Array(e),n=0;n<e;++n)r[n]=Le(v[t+4*n>>2],`parameter ${n}`);return r})(e,t),s=n.toWireType.bind(n),a=i.map(e=>e.readValueFromPointer.bind(e));e--;var o,l={toValue:Oe.toValue},c=a.map((e,t)=>{var r=`argFromPtr${t}`;return l[r]=e,`${r}(args${t?"+"+8*t:""})`});switch(r){case 0:o="toValue(handle)";break;case 2:o="new (toValue(handle))";break;case 3:o="";break;case 1:l.getStringOrSymbol=Xe,o="toValue(handle)[getStringOrSymbol(methodName)]"}o+=`(${c})`,n.isVoid||(l.toReturnWire=s,l.emval_returnValue=Ke,o=`return emval_returnValue(toReturnWire, destructorsRef, ${o})`),o=`return function (handle, methodName, destructorsRef, args) {\n ${o}\n }`;var u,h,d=new Function(Object.keys(l),o)(...Object.values(l)),p=`methodCaller<(${i.map(e=>e.name)}) => ${n.name}>`;return u=K(p,d),h=Ye.length,Ye.push(u),h},k:Ie,y:e=>{e>9&&(Ne[e+1]+=1)},h:(e,t,r,n,i)=>Ye[e](t,r,n,i),g:e=>{var t=Oe.toValue(e);Ae(t),Ie(e)},r:(e,t)=>{if(Qe[e]&&(clearTimeout(Qe[e].id),delete Qe[e]),!t)return 0;var r=setTimeout(()=>{delete Qe[e],rt(()=>_e(e,performance.now()))},t);return Qe[e]={id:r,timeout_ms:t},0},t:e=>{var t=d.length,r=2147483648;if((e>>>=0)>r)return!1;for(var n=1;n<=4;n*=2){var i=t*(1+.2/n);i=Math.min(i,e+100663296);var s=Math.min(r,nt(Math.max(e,i),65536));if(it(s))return!0}return!1},p:tt};return ot=await async function(){function e(e,t){return function(e){Se=e.D,Ee=e.E,_e=e.F,be=e.H,Te=e.B,Re=e.G}(ot=e.exports),T(),ot}var r={a:lt};return t.instantiateWasm?new Promise((n,i)=>{t.instantiateWasm(r,(t,r)=>{n(e(t))})}):(S??=function(e){for(var t,r=0,n=new Uint8Array(43076);r<43076;++r)t=e.charCodeAt(r),n[r]=~t>>8&t;return n}('\0asm\0\0\0«````\0`\0`\0`\0\0`\0`\0`\0````\0`\n\0`\t\0`\r\0`|`~~\0`|`\0`|\0£aa\0ab\0ac\0ad\0\tae\0af\0ag\0ah\0ai\0aj\0ak\0al\0am\0an\0\bao\0ap\0aq\0ar\0as\0at\0\0au\0av\0aw\0ax\0ay\0az\0aA\0žœ\0\0\v\0\0\0\0\n\0\b\v\0\0\n\n\f\n\v\0\0\t\0\0\0\0\v\f\n\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\n\0\0\0\b\b\t\t\t\b\0\0\r\0\0\0p¿¿‚€€\bAð¾\v B\0C\0¶D\x007E\0­F\0œG\0H\0\tù\0A\v¾Kcµ²®©¢™˜—–•”“’0‘000Ž00/S.R-,+@?>/S.R-,+@?>/Œ.‹-,+@?>/Š.‰-,+QPO/ˆ.‡-,+†…„/ƒ.‚-,+QPO)N)&N€~&}&|&{&z&y&xwMvMutsLrLqponmlkjihgfedb)][)"´³G"±°¯"¬Z)"GGW"W"« £¥"¤TT"Ÿ¡¦"ª¨§)"žš›\f\nÀ›œFA \0 \0AM!\0@@ \07" AÜ=(\0"\rA\0\v\f\v \0\f\0\v\0\v"\0E@Z\0\v \0\vß\v\b@ \0E\r\0 \0A\bk" \0Ak(\0"Axq"\0j!@ Aq\r\0 AqE\r  (\0"k"A8(\0I\r \0 j!\0@@@A”8(\0 G@ (\f! AÿM@  (\b"G\rA€8A€8(\0A~ Avwq6\0\f\v (!  G@ (\b" 6\f  6\b\f\v (" Aj ("E\r Aj\v!@ ! "Aj! ("\r\0 Aj! ("\r\0\v A\x006\0\f\v ("AqAG\rAˆ8 \x006\0  A~q6  \0Ar6  \x006\0\v  6\f  6\b\f\vA\0!\v E\r\0@ ("At"(°: F@ A°:j 6\0 \rA„8A„8(\0A~ wq6\0\f\v@  (F@  6\f\v  6\v E\r\v  6 ("@  6  6\v ("E\r\0  6  6\v  O\r\0 ("AqE\r\0@@@@ AqE@A˜8(\0 F@A˜8 6\0AŒ8AŒ8(\0 \0j"\x006\0  \0Ar6 A”8(\0G\rAˆ8A\x006\0A”8A\x006\0\vA”8(\0" F@A”8 6\0Aˆ8Aˆ8(\0 \0j"\x006\0  \0Ar6 \0 j \x006\0\v Axq \0j!\0 (\f! AÿM@ (\b" F@A€8A€8(\0A~ Avwq6\0\f\v  6\f  6\b\f\v (!\b  G@ (\b" 6\f  6\b\f\v (" Aj ("E\r Aj\v!@ ! "Aj! ("\r\0 Aj! ("\r\0\v A\x006\0\f\v  A~q6  \0Ar6 \0 j \x006\0\f\vA\0!\v \bE\r\0@ ("At"(°: F@ A°:j 6\0 \rA„8A„8(\0A~ wq6\0\f\v@  \b(F@ \b 6\f\v \b 6\v E\r\v  \b6 ("@  6  6\v ("E\r\0  6  6\v  \0Ar6 \0 j \x006\0  G\r\0Aˆ8 \x006\0\v \0AÿM@ \0AøqA¨8j!A€8(\0"A \0Avt"\0qE@A€8 \0 r6\0 \f\v (\b\v!\0  6\b \0 6\f  6\f  \x006\b\vA! \0AÿÿÿM@ \0A& \0A\bvg"kvAq AtkA>j!\v  6 B\x007 AtA°:j!@A„8(\0"A t"qE@A„8  r6\0  6\0A!A\b\f\v \0A AvkA\0 AGt! (\0!@ "(Axq \0F\r Av! At!  Aqj"("\r\0\v  6A! !A\b\v!\0 "\f\v (\b" 6\f  6\bA!\0A\b!A\0\v!  j 6\0  6\f \0 j 6\0A 8A 8(\0Ak"\0A \06\0\v\v,\0 E@ \0( (F\v \0 F@A\v \0( (\'E\v}@@ \0"AqE\r\0 -\0\0E@A\0\v@ Aj"AqE\r -\0\0\r\0\v\f\v@ "Aj!A€‚„\b (\0"k rA€‚„xqA€‚„xF\r\0\v@ "Aj! -\0\0\r\0\v\v  \0k\v\f\0  \0(\0\0\0\v®#\0Ak"$\0  \0(\0"A\bk(\0"6\f  \0 j6  Ak(\x006\b (!@ (\b" A\0@A\0  (\f!\f\v#\0A@j"$\0 \0 N@  6\f  6  \x006\b AjA\0A$ü\v\0 A\x006< B€€€€€€€74  Aj  AA\0 (\0(\b\0 \0A\0 (!\v A@k$\0 "\r\0#\0A@j"$\0 A¼-6\f  \x006\b  6A\0!\0 AjA\0A+ü\v\0 A\x006< A:\0;  Aj AA\0 (\0(\t\0@@@ ((\0\v (A\0 ($AFA\0 ( AFA\0 (,AF!\0\f\v (AG@ (,\r ( AG\r ($AG\r\v (!\0\v A@k$\0 \0!\v Aj$\0 \v A! \0Aj" \0/\0AtAþÿqj!\0@ @@@@@ \0  AtAkAþÿqj.\0"j"\0-\0\0Ak\0\v  \0/Ajj!\f\v  \0/Ajj!\f\v \0/"E@ Aj!\f\v At" \0 AkAþÿqj/jAj!\v  j!\f\v@@@ \0-\0\0Ak\0\v \0/Aj!\f\v \0/Aj!\f\v \0/"E@A!\f\v At" \0 AkAþÿqj/jAj!\v  AtAþÿqj ;\0\v\0 \0\v\b\0A—\n_\0\v2 \0@ \0(\0$ \0($ \0(! \0A\x006 @ \v \0\v\v@@ AO@ \0 rAq\r@ \0(\0 (\0G\r Aj! \0Aj!\0 Ak"AK\r\0\v\v E\r\v@ \0-\0\0" -\0\0"F@ Aj! \0Aj!\0 Ak"\r\f\v\v  k\vA\0\v5  \0("Auj! \0(\0!\0  Aq (\0 \0j(\0 \0\v\0\0\vM -\0\0!@ \0-\0\0"E\r\0  G\r\0@ -\0! \0-\0"E\r Aj! \0Aj!\0  F\r\0\v\v  k\v¢\r@@@@@ -\0\0Ak\0\v AjA\0 -\0\0AFAj"\r ."AtAþÿqj! A\0 A\0J! Aj!@ \b G@A\0! \b \r \bAtAkAþÿqj.\0A\0\v j"AjA\0 -\0\0AF!\t /"Á!\v@@@@ Ak\0\v\vA!\fA! \tA\tjA\0 -\0\tAFAj"\f\vA! \tA\vjA\0 \t-\0\nAFAj!A!\f . \tA\njj"AjA\0 -\0\0AFAj\v!  \vH\rA\0\f\v \tAj!\nA!\f "!A\0\f\v \tAj" \vAtAþÿqj!\n  AtjAk.\0\v \nj\v!\n \v \fLA\0 \tAj" \vAtAþÿqj  \fAtjAk.\0j\v!@ @  \'\r\v  \nAj\'\r\0 \0A\0 \0    (\v \bAj!\b\f\v\v E\r  \0 /AjÁjO\rA\0\v E\r  \0 /AjÁjO\r\f\v A\0 \0Aj" K\r\0 \0A:\0\0 .! @   AtAjÁjI\r\v \0 ; A\0L@ \0\v AtAþÿq"@ \0AjA\0 ü\v\0\v  \0Aj"j Aj" /AtAþÿqj   (E\r\0 A\0!A!\b@ .\0"\t \bL@ \0\v  \bAtAkAþÿq"\nj.\0  \tAtAþÿqjj  \nj.\0  /AtAþÿqjj   (@  \b! \bAj!\b\fA\0\v\0\v\0\vA\0\v /AjÁ"E@ \0\v \0  ü\n\0\0 \0\v\0 \0\vT~@Aô7(\0"­ \0­B|Bøÿÿÿƒ|"BÿÿÿÿX@ §"\0?\0AtM\r \0\r\vAü7A06\0A\vAô7 \x006\0 \v–#\0Ak"$\0 Aj  \0\0A\f"\0A\x006\b \0B\x007\0@ (\b" ("G@  k"A\0H\r \0 "6\0 \0  j"6\b @   ü\n\0\0\v \0 6\v @  6\b \v Aj$\0 \0\v2\0\v1 \0( \0(\0k! \0( \0(\0"\0k"@  \0 ü\n\0\0\v \v\t\0  \0\0\0\vr#\0Ak"$\0 Aj"   \0\0 (\b ,\0" A\0H""\0Aj7" \x006\0 (! \0@ Aj    \0ü\n\0\0\v A\0H@ \v Aj$\0 \v°#\0Ak"$\0 (\0"AøÿÿÿI@@@ A\vO@ Ar"Aj!  Aÿÿÿÿk6\f  6  6\b\f\v  :\0 Aj! E\r\v E\r\0  Aj ü\n\0\0\v  jA\0:\0\0 Aj  \0\0 ,\0A\0H@ (\v Aj$\0\v#\0\v\v\0 \0@ \0\v\v¥ \0Aÿq!@@@ \0Aà\0F@A\b!AÜ!\f\v A‚„\bl!A\b!AÜ!@A€‚„\b (\0 s"k rA€‚„xqA€‚„xG\r Aj! Ak"AK\r\0\v E\r\v \0Aÿq!\0@ -\0\0 \0F\r Aj! Ak"\r\0\v\vA\0!\v \v\b\0AÌ\b_\0\v§@  O\r\0 A(:\0\0 Aj!@ \0.\0"A\0L\r\0@@@@ \0Aj"\b AtAþÿqj"-\0\0Ak\0\v  M\r Aà\0:\0 Aj! -\0"E\r Aj!@  M\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v -\0"E\r Aj!@  M\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v Aj  3"E\r\vA! \0.\0AL\r\0@  M\r A :\0\0 Aj!@@@@ At \bjAk.\0 \b \0/\0AtAþÿqjj"-\0\0Ak\0\v Aj  3"E\r\f\v  M\r Aà\0:\0 Aj! -\0"E\r Aj!@  M\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v -\0"E@ !\f\v Aj! !@  M\r  :\0\0 Aj! -\0! Aj! \r\0\v\v Aj" \0.\0H\r\0\v\v  M\r\0 A):\0\0 Aj!\v \vÒ  \0 F":\0\f@ \r\0@ (\b"-\0\f\r@@ (\b"(\0" F@@ ("E\r\0 -\0\f\r\0 A:\0\f  \0 F:\0\f A:\0\f\f\v@ (\0 F@ !\f\v  ("(\0"\x006@ \0E@  6\b  6\0\f\v \0 6\b (\b"(\0  6\b F@  6\0\f\v  6\v  6\0  6\b (\b"(\0!\v A:\0\f A\0:\0\f  ("\x006\0 \0@ \0 6\b\v  (\b"\x006\b@ \0(\0 F@ \0 6\0\f\v \0 6\v  6  6\b\v E\r -\0\f\r A:\0\f  \0 F:\0\f A:\0\f\v " \0G\r\f\v\v@ (\0" G@ !\f\v  ("\x006\0 \0@ \0 6\b (\b!\v  6\b@ (\0 F@  6\0\f\v  6\v  6  6\b (\b!\v A:\0\f A\0:\0\f  ("(\0"\x006 \0@ \0 6\b\v  (\b"\x006\b@ \0(\0 F@ \0 6\0\f\v \0 6\v  6\0  6\b\v\v¯\n \0Aj! \0("E@  6\0 \v /\0"\bAt"\0Aj!\t  \0AkAþÿqj!\n@ !\0A\0!A\0!A\0!@@ \b \n/A\0\v \tjÁ" \0("/\0"\v  \vAt"AkAþÿqj/A\0\v Aj"\fjÁ"N@  J\r   %A\0N\r\v \0! \0(\0"\r\f\vA\0!A\0! \v  AkAÿÿqj/A\0\v \fjÁ" \b \n/A\0\v \tjÁ"N@  J\r   %A\0N\r\v \0Aj! \0("\r\v\v  \x006\0 \vø@@@@@ -\0\0Ak\0\v  \0AjI\r /! /! /\f! \0A:\0\0  \0Aj"   jj"Áj"I\r \0 ; ."A\0J@ @  (\0 ü\n\0\0\v /!\v AkÁ"@  Áj Aj ü\n\0\0\v@ .\f"A\0L\r\0 E\r\0  .j j (\b ü\n\0\0\v AkA\0:\0\0 \0\v  \0 /AjÁ"jI\r E\r \0  ü\n\0\0\f\v  \0Aj"I\r\0 \0A:\0\0   ."At"AjÁjI\r\0 \0 ; A\0L\r Aÿÿq"@ \0AjA\0 ü\v\0\v \0Aj" AtAþÿqj Aj" /AtAþÿqj  6E\r\0 A\0!A!@  .\0"\bN\r  AtAkAþÿq"\tj.\0  \bAtAþÿqjj  \tj.\0  /AtAþÿqjj  6@  ! Aj!\f\v\v\vA\0\v \0\vÁ\'\v#\0Ak"\n$\0@@@@@@@@@@ \0AôM@A€8(\0"A \0A\vjAøq \0A\vI"Av"\0v"Aq@@ AsAq \0j"At"A¨8j"\0 (°8"(\b"F@A€8 A~ wq6\0\f\v  \x006\f \0 6\b\v A\bj!\0  Ar6  j" (Ar6\f\v\v Aˆ8(\0"\bM\r @@A \0t"A\0 kr  \0tqh"At"A¨8j" (°8"\0(\b"F@A€8 A~ wq"6\0\f\v  6\f  6\b\v \0 Ar6 \0 j"  k"Ar6 \0 j 6\0 \b@ \bAxqA¨8j!A”8(\0! A \bAvt"qE@A€8  r6\0 \f\v (\b\v!  6\b  6\f  6\f  6\b\v \0A\bj!\0A”8 6\0Aˆ8 6\0\f\v\vA„8(\0"\vE\r \vhAt(°:"(Axq k! !@@ ("\0E@ ("\0E\r\v \0(Axq k"   I"! \0  ! \0!\f\v\v (!\t  (\f"\0G@ (\b" \x006\f \0 6\b\f\n\v (" Aj ("E\r Aj\v!@ ! "\0Aj! \0("\r\0 \0Aj! \0("\r\0\v A\x006\0\f\t\vA! \0A¿K\r\0 \0A\vj"Axq!A„8(\0"E\r\0A!\bA\0 k! \0AôÿÿM@ A& A\bvg"\0kvAq \0AtkA>j!\b\v@@@ \bAt(°:"E@A\0!\0\f\vA\0!\0 A \bAvkA\0 \bAGt!@@ (Axq k" O\r\0 ! "\r\0A\0! !\0\f\v \0 ("   AvAqj("F \0 !\0 At! \r\0\v\v \0 rE@A\0!A \bt"\0A\0 \0kr q"\0E\r \0hAt(°:!\0\v \0E\r\v@ \0(Axq k" I!   ! \0  ! \0("  \0(\v"\0\r\0\v\v E\r\0 Aˆ8(\0 kO\r\0 (!\b  (\f"\0G@ (\b" \x006\f \0 6\b\f\b\v (" Aj ("E\r Aj\v!@ ! "\0Aj! \0("\r\0 \0Aj! \0("\r\0\v A\x006\0\f\v Aˆ8(\0"M@A”8(\0!\0@  k"AO@ \0 j" Ar6 \0 j 6\0 \0 Ar6\f\v \0 Ar6 \0 j" (Ar6A\0!A\0!\vAˆ8 6\0A”8 6\0 \0A\bj!\0\f\t\v AŒ8(\0"I@AŒ8  k"6\0A˜8A˜8(\0"\0 j"6\0  Ar6 \0 Ar6 \0A\bj!\0\f\t\vA\0!\0 A/j"AØ;(\0@Aà;(\0\f\vAä;B7\0AÜ;B€ €€€€7\0AØ; \nA\fjApqAتժs6\0Aì;A\x006\0A¼;A\x006\0A€ \v"j"A\0 k"q" M\r\bA¸;(\0"@A°;(\0"\b j"\t \bM\r\t  \tI\r\t\v@A¼;-\0\0AqE@@@@@A˜8(\0"@AÀ;!\0@ \0(\0"\b M@  \b \0(jI\r\v \0(\b"\0\r\0\v\vA\0*"AF\r !AÜ;(\0"\0Ak" q@  k  jA\0 \0kqj!\v  M\rA¸;(\0"\0@A°;(\0" j" M\r \0 I\r\v *"\0 G\r\f\v  k q"*" \0(\0 \0(jF\r !\0\v \0AF\r A0j M@ \0!\f\vAà;(\0"  kjA\0 kq"*AF\r  j! \0!\f\v AG\r\vA¼;A¼;(\0Ar6\0\v *!A\0*!\0 AF\r \0AF\r \0 M\r \0 k" A(jM\r\vA°;A°;(\0 j"\x006\0A´;(\0 \0I@A´; \x006\0\v@A˜8(\0"@AÀ;!\0@  \0(\0" \0("jF\r \0(\b"\0\r\0\v\f\vA8(\0"\0A\0 \0 ME@A8 6\0\vA\0!\0AÄ; 6\0AÀ; 6\0A 8A6\0A¤8AØ;(\x006\0AÌ;A\x006\0@ \0At" A¨8j"6°8  6´8 \0Aj"\0A G\r\0\vAŒ8 A(k"\0Ax kAq"k"6\0A˜8  j"6\0  Ar6 \0 jA(6Aœ8Aè;(\x006\0\f\v  M\r  K\r \0(\fA\bq\r \0  j6A˜8 Ax kAq"\0j"6\0AŒ8AŒ8(\0 j" \0k"\x006\0  \0Ar6  jA(6Aœ8Aè;(\x006\0\f\vA\0!\0\f\vA\0!\0\f\vA8(\0 K@A8 6\0\v  j!AÀ;!\0@@  \0(\0"G@ \0(\b"\0\r\f\v\v \0-\0\fA\bqE\r\vAÀ;!\0@@ \0(\0" M@   \0(j"I\r\v \0(\b!\0\f\v\vAŒ8 A(k"\0Ax kAq"k"6\0A˜8  j"6\0  Ar6 \0 jA(6Aœ8Aè;(\x006\0  A\' kAqjA/k"\0 \0 AjI"A6 AÈ;)\x007 AÀ;)\x007\bAÈ; A\bj6\0AÄ; 6\0AÀ; 6\0AÌ;A\x006\0 Aj!\0@ \0A6 \0A\bj \0Aj!\0 I\r\0\v  F\r\0  (A~q6   k"Ar6  6\0 AÿM@ AøqA¨8j!\0A€8(\0"A Avt"qE@A€8  r6\0 \0\f\v \0(\b\v! \0 6\b  6\fA\f!A\b\f\vA!\0 AÿÿÿM@ A& A\bvg"\0kvAq \0AtkA>j!\0\v  \x006 B\x007 \0AtA°:j!@@A„8(\0"A \0t"qE@A„8  r6\0  6\0\f\v A \0AvkA\0 \0AGt!\0 (\0!@ "(Axq F\r \0Av! \0At!\0  Aqj"("\r\0\v  6\v  6A\b! "!\0A\f\f\v (\b"\0 6\f  6\b  \x006\bA\0!\0A!A\f\v j 6\0  j \x006\0\vAŒ8(\0"\0 M\r\0AŒ8 \0 k"6\0A˜8A˜8(\0"\0 j"6\0  Ar6 \0 Ar6 \0A\bj!\0\f\vAü7A06\0A\0!\0\f\v \0 6\0 \0 \0( j6 Ax kAqj"\b Ar6 Ax kAqj"  \bj"k!@A˜8(\0 F@A˜8 6\0AŒ8AŒ8(\0 j"\x006\0  \0Ar6\f\vA”8(\0 F@A”8 6\0Aˆ8Aˆ8(\0 j"\x006\0  \0Ar6 \0 j \x006\0\f\v ("\0AqAF@ \0Axq!\t (\f!@ \0AÿM@ (\b" F@A€8A€8(\0A~ \0Avwq6\0\f\v  6\f  6\b\f\v (!@  G@ (\b"\0 6\f  \x006\b\f\v@ ("\0 Aj ("\0E\r Aj\v!@ ! \0"Aj! \0("\0\r\0 Aj! ("\0\r\0\v A\x006\0\f\vA\0!\v E\r\0@ ("\0At"(°: F@ A°:j 6\0 \rA„8A„8(\0A~ \0wq6\0\f\v@  (F@  6\f\v  6\v E\r\v  6 ("\0@  \x006 \0 6\v ("\0E\r\0  \x006 \0 6\v  \tj!  \tj"(!\0\v  \0A~q6  Ar6  j 6\0 AÿM@ AøqA¨8j!\0A€8(\0"A Avt"qE@A€8  r6\0 \0\f\v \0(\b\v! \0 6\b  6\f  \x006\f  6\b\f\vA! AÿÿÿM@ A& A\bvg"\0kvAq \0AtkA>j!\v  6 B\x007 AtA°:j!\0@@A„8(\0"A t"qE@A„8  r6\0 \0 6\0\f\v A AvkA\0 AGt! \0(\0!@ "\0(Axq F\r Av! At! \0 Aqj"("\r\0\v  6\v  \x006  6\f  6\b\f\v \0(\b" 6\f \0 6\b A\x006  \x006\f  6\b\v \bA\bj!\0\f\v@ \bE\r\0@ ("At"(°: F@ A°:j \x006\0 \0\rA„8 A~ wq"6\0\f\v@  \b(F@ \b \x006\f\v \b \x006\v \0E\r\v \0 \b6 ("@ \0 6  \x006\v ("E\r\0 \0 6  \x006\v@ AM@   j"\0Ar6 \0 j"\0 \0(Ar6\f\v  Ar6  j" Ar6  j 6\0 AÿM@ AøqA¨8j!\0A€8(\0"A Avt"qE@A€8  r6\0 \0\f\v \0(\b\v! \0 6\b  6\f  \x006\f  6\b\f\vA!\0 AÿÿÿM@ A& A\bvg"\0kvAq \0AtkA>j!\0\v  \x006 B\x007 \0AtA°:j!@@ A \0t"qE@A„8  r6\0  6\0  6\f\v A \0AvkA\0 \0AGt!\0 (\0!@ "(Axq F\r \0Av! \0At!\0  Aqj"("\r\0\v  6  6\v  6\f  6\b\f\v (\b"\0 6\f  6\b A\x006  6\f  \x006\b\v A\bj!\0\f\v@ \tE\r\0@ ("At"(°: F@ A°:j \x006\0 \0\rA„8 \vA~ wq6\0\f\v@  \t(F@ \t \x006\f\v \t \x006\v \0E\r\v \0 \t6 ("@ \0 6  \x006\v ("E\r\0 \0 6  \x006\v@ AM@   j"\0Ar6 \0 j"\0 \0(Ar6\f\v  Ar6  j" Ar6  j 6\0 \b@ \bAxqA¨8j!\0A”8(\0!A \bAvt" qE@A€8  r6\0 \0\f\v \0(\b\v! \0 6\b  6\f  \x006\f  6\b\vA”8 6\0Aˆ8 6\0\v A\bj!\0\v \nAj$\0 \0\v? A\bu! \0  Aq  (\0j(\0 \v j A Aq  \0(\0(\t\0\vÕ\b#\0Ak"$\0@@@ \0("-\0\0Ak\0\v@ \0(\b" \0(\f"\b\'\r\0A!@@@@ \0(\0"-\0\0"\tAk\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v Aÿÿq /AjAÿÿqG\r\0A!A!@@@@ \tAk\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v   Á%E\r\vA\0! Aj \b (\0 (D"E\r  \0(\x006\0 Aj! @ ."AN@ .!\0 -\0\0!  6\b  \0 AtAþÿq A\0 AFjjAj6\f\v  6\b A\x006A\0 AH\r\v A\0 -\0\0AF"\0Aj AtAþÿqj \0.j\v"\0AjA\0 \0-\0\0AFAj6\f  9!\f\vA! ."A\0L@A\0!\f\v  \0(\x006\0  Aj" AtAþÿq"\bj6  \0(\b6\b  \0(\f6\f  9\r\0 A\0 A\0J!A!  \bj!@  F@A\0!\f\v  \0(\x006\0    AtAkAþÿqj.\0j6  \0(\b6\b  \0(\f6\f Aj!  9E\r\0\v\v Aj$\0 \v­\b#\0Ak"$\0 \0("-\0\0!@ \0(\0"-\0\0"AF@@ AG\r\0 \0(\b \0(\f\'\r\0 /" /G\r\0   AjÁ%E\r\v  6\0  \0(6  \0(\b6\b  \0(\f6\f  E\f\v AF@  6  6\0  \0(\f6\b  \0(\b6\f  E\f\v@ AG\r\0 AG\r\0 /"\0 /F@   \0AjÁ%E\r\v A\x006\f\v@@ AG\r\0 AG\r\0 / /G\rA! ."\bA\0L\r  Aj" \bAtAþÿqj6\0  Aj"\b ."AtAþÿqjA\0 A\0J6  \0(\b6\b  \0(\f6\f  : (E\r@  ."N\r   AtAkAþÿq"\tj.\0  AtAþÿqjj6\0  ." LA\0 \b \tj.\0 \b AtAþÿqjj\v6  \0(\b6\b  \0(\f6\f Aj!  : (\r\0\v\f\v A\x006\f\v A\x006\v Aj$\0\v2 \0@ \0(\0; \0(; \0(! \0A\x006 @ \v \0\v\vº\b \0Aj!@@ \0("\0E\r\0 /\0"At"Aj!  AkAþÿqj!\b !@A!@ \0("\t/\0" At" \t AkAþÿqj/jAjA\vÁ"  \b/A\0\v jÁ"H@ \0Aj!\0\f\v  H@ \0!\f\v  \0 \t  %"A\0H! \0 AvAqj!\0\v \0(\0"\0\r\0\v  F\r\0  \b/A\0\v jÁ!  ("/\0"\0 \0At"\0  \0AkAþÿqj/jAjA\vÁ"\0H\r\0 \0 H\r   %A\0N\r\v !\v \vñ .\0!@ @  \0 AtAjÁjI\r\v \0 ;\0 A\0L@ \0\v AtAþÿq"@ \0AjA\0 ü\v\0\v \0Aj" j Aj" /\0AtAþÿqj   (E\r\0 \0A\0!A!@ \0.\0"\b L@ \0\v  AtAkAþÿq"\tj.\0  \bAtAþÿqjj  \tj.\0  /\0AtAþÿqjj   (E\r \0 ! Aj!\f\0\v\0\vA\0\v\v\0 \0/\0AjÁ\v+ \0/\0AjÁ! \0/\0AjÁ"@  \0 ü\n\0\0\v \vt \0A\x006\b \0B\x007\0 /\0Aj"Á!@ Aÿÿq@ A\0H\r ! @ A\0 ü\v\0\v \0  j"6\b \0 6 \0 6\0\v @   ü\n\0\0\v\v2\0\vA A\bu! \0   Aq  (\0j(\0 \v j A Aq  \0(\0(\b\0\vv \0($"E@ \0 6 \0 6 \0A6$ \0 \0(86\v@@ \0( \0(8G\r\0 \0( G\r\0 \0(AG\r \0 6\v \0A:\x006 \0A6 \0 Aj6$\v\vš\0 \0A:\x005@  \0(G\r\0 \0A:\x004@ \0("E@ \0A6$ \0 6 \0 6 AG\r \0(0AF\r\f\v  F@ \0("AF@ \0 6 !\v \0(0AG\r AF\r\f\v \0 \0($Aj6$\v \0A:\x006\v\vž  G@ \0Aj!@ -\0\0!@ Aj /"At"Aþÿqj"\0Aj \'\r\0 \0 .jAj \'\r\0 \vA!\0@@@ Ak\0\0\v Aj!\0\f\v   AkAþÿqj/jAj!\0\v  \0Áj" G\r\0\v\vA\0\vž\f#\0Ak"\b$\0@ \0(\0"Aj \0(\b"\n (\0" ("D"@ Aj! \b@ ."AN@ \b . AtAþÿq A\0 -\0\0AFjjAj6\0 \b \0(6\f\v \bA\x006\0 \b \0(6A\0 AH\r\v A\0 -\0\0AF"Aj AtAþÿqj .j\v"AjA\0 -\0\0AFAj6\b \b \0(\f6\f \b :\f\v@ \0("-\0\0AG\r\0 Aj \0(\f  D"E\r\0 \b 6\0 Aj! \b@ ."AN@ .! -\0\0!\0 \b \n6\b \b  AtAþÿq A\0 \0AFjjAj6\f\v \b \n6\b \bA\x006A\0 AH\r\v A\0 -\0\0AF"\0Aj AtAþÿqj \0.j\v"\0AjA\0 \0-\0\0AFAj6\f \b E\f\v \0 9@ A\x006\f\v Aj!\v@ (\f"E\r\0  \vO\r\0 A\x006\f\v A:\0\0@ A\0  A\vjIE@ B\x007 A;@ (\f"E\r\0  A\fjO\r\0 A\x006\f\v A:\0\v A\0  \0(\b"AjÁ"\t Aj"\njI\r  \t;\f \tAN@A\0!@ A\0!\tA!E@  j-\0\0"\tE!\v  \nj \t:\0\0 Aj" .\f"\tAkH\r\0\v\v \t \njAkA\0:\0\0A!@@@@ Aj"\f /"AtAþÿqj"-\0\0Ak\0\v /Aj!\f\v /Aj!\f\vA! /"E\r\0 At"  AkAþÿqj/jAj!\v  ;  Áj!@ (\f"E\r\0  A\0 AKAjO\r\0 A\x006\f\v A:\0\0A\0! A\0 AK"AjA\0 -\0\0"\nAFAj!\r@ A\0  \r \0(\f"AjÁ"\tjIE@  \t; \tAN@A\0!@ A\0!\tA!E@  j-\0\0"\tE!\v  \rj \t:\0\0 Aj" ."\tAkH\r\0\v\v \t \rjAkA\0:\0\0 \nAF\r\v A\x006\f\vA!@@@@ \f \v/\0"AtAþÿqj"\n \f.\0"j"-\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v   j";@ (\f"E\r\0A!@@@@ \0(\0"\v-\0\0Ak\0\v \v/Aj!\f\v \v/Aj!\f\v \v/"E@A!\f\v At" \v AkAþÿqj/jAj!\v  Á \n ÁjA\0 AKjO\r\0 A\x006\f\vA!@@@@ \0(\0"-\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v Á"@ \n ÁjA\0 AK  ü\n\0\0\vA!@@@@ \f /"AtAþÿqj"\n ."j"-\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v   j";@ (\f"E\r\0A!@@@@ \0("\v-\0\0Ak\0\v \v/Aj!\f\v \v/Aj!\f\v \v/"E@A!\f\v At" \v AkAþÿqj/jAj!\v  Á \n ÁjA\0 AKjO\r\0 A\x006\f\vA!@@@@ \0("-\0\0Ak\0\v /Aj!\f\v /Aj!\f\vA! /"\0E\r\0 \0At"\0  \0AkAþÿqj/jAj!\v Á"\0@ \n ÁjA\0 AK  \0ü\n\0\0\vA!\0A!@@@@ ." \f /AtAþÿqjj"-\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v   j;\t@@@@ ("-\0\0Ak\0\v /Aj!\0\f\v /Aj!\0\f\v /"\0E@A!\0\f\v \0At"\0  \0AkAþÿqj/jAj!\0\v   \0Áj6  /\bAj;\b\f\v A\x006\f\v A\x006\v \bAj$\0\v¾ Aj!@@ -\0"A)F@ \0!\f\v \0!@@ Aÿq"A?K\r\0B ­†BÌ€€ƒP\r\0 -\0! Aj! A)G\r\f\v  Aj"I\r@@@ A(G@ Aà\0F@ A:\0\0 ! Aj"\t!@ Aj! ,\0"1\r  O\r\b  :\0\0 Aj! !\f\0\v\0\v A:\0\0 Aj"\t!@ ,\0\0"1E@  O\r\b  :\0\0 Aj! Aj!\f\v\v  I\r\f\v A:\0\0   F"\r\f\v  O\r\v A\0:\0\0  \tAj;\0\vA!@@@@ -\0\0Ak\0\v /\0Aj!\f\v /\0Aj!\f\v /\0"E@A!\f\v At"  AkAþÿqj/jAj!\v Aj!  Áj! -\0\0"A)G\r\0\v\v   At"AjÁ"jI\r\0  \0k"@ \0 j \0 ü\n\0\0\v Aj!\b \0 ;\0 ÁA\0L\r\0 \0Aj!\0 Aÿÿq"@ \0A\0 ü\v\0\vA!@@@@ \0 j"-\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v \0 ;\0 Aÿÿq"AF\r\0A!@A!@@@@  \0 At"AkAþÿqj.\0"j"-\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v \0 j  j;\0 Aj" G\r\0\v\v \b\v\0\vï@ \0-\0\0"AG\r\0 \0Aj"/\0AG\r\0 A\0 AF"-\0AG"@A\0\v \0. Ajj"-\0\0AG"@A\0\v A\0; A\x006\0@@ Aj"/\0\0\v \0-\0\fAG\r A\0  Aj6\0  \0/\rAk;\v A\0;\f A\x006\b@@ Aj"\0/\0\0\v -\0AG\r A\0 \0 Aj6\b  /Ak;\f\vA!\v \vñ\b\b \0Aj!\t@ E\r\0  \tO\r\0A\0\v@ .\0"AF\r\0 /\0AG\r\0A! \0  AtAþÿqjAjA\0 AJ AjAæ\bA²& JE\r\0@@@@ \0-\0\0Ak\0\v \0/Aj!\f\v \0/Aj!\f\v \0/"E@A!\f\v At" \0 AkAþÿqj/jAj!\v \0 Áj"  \0Aæ\b =E\r\0 /\0" At"  AkAþÿqj/jAjÁA\v j"  \0A²& =E\r\0A!  .\0"AtAþÿqjAj! .\0"A\0LA\0 Aj"\b At"\nAþÿqj!\vA\0! AG \b \nAkAþÿqj.\0A\0\v \vj\v!@@@@ -\0\0"\bAk\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\vA!@@@@ -\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v Aÿÿq AÿÿqG\r\0A!@@@@ \bAk\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v   Á%\r\0  AtAþÿqj"Aj!A!@@@@ -\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v /\0 E@ Aj!A\0\f\v  At" Aj" AkAþÿqj/\0jAjÁj!A\0 AH\r\0  Aÿÿqj\v!Ak!A!@@@@ -\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v At!   Ájk"@ \0 AjÁj  Áj ü\n\0\0\v \0 Á";\0 A\0L@ \0\vA\0! Aÿÿq"@ \tA\0 ü\v\0\v@ \0 Á! AjÁ" H\r\0\v \0\v \0A\0;\0A\0\vš#\0A k"$\0 \0Aj!@@ E\r\0  O\r\0A\0!\f\v  6  6  6  6  6\fA\0! A\0;\b  \x006  \x006\0 Aj : ("E@ \0A\0:\0\0\f\v A\0  /\bAtAjÁ" jI\r\0  (\0"k"@  j  ü\n\0\0\v \0A:\0\0 \0 .\b"; A\0J@A\0! AtAþÿq"@ \0AjA\0 ü\v\0\v@  Á! AjÁ" H\r\0\v\v \0!\v A j$\0 \vßAø;-\0\0E@Aø;A:\0\0AäAì0\vAÔA€A¸A\0AîAAñA\0AñA\0AÓ\bAóAAÔAAøAüAA\rA"\0A6\0AÔAµ\tAA€AŒA \0A\0A\0A\0\0A"\0A\b6\0AÔAÕ\nAA A°A\t \0A\0A\0A\0\0A"\0A\n6\0AÔA€\vAA¸AÀA\v \0A\0A\0A\0\0A"\0A\f6\0AÔAÂ\bAAÌAØA\r \0A\0A\0A\0\0A"\0A6\0AÔA¾\bAAàAðA \0A\0A\0A\0\0AøAA°A\0AÑAAñA\0AñA\0AÎ\nAÔAAØAðAA\0A¯AAñA\0AñA\0A\tA²AA¸AÔAøA\0AœAAñA\0AñA\0AÁ\vAŸAA¤A¼AÜA\0AûAAñA\0AñA\0A›\bAþAA„AœA¼A\0AÛAAñA\0AñA\0A‚\tAÞAAäAŒA¬A\0AËAAñA\0AñA\0A¬\vAÎAAøA‹\nAAÔAàAAA\0A\0AøA\nAAèAôAAA\0A\0AøAŠ\bAAüA„A A!A\0A\0AøA€\bAAˆAA"A#A\0A\0A"\0A$6\0AøAŸ\vAA”AœA% \0A\0A\0A\0\0A"\0A&6\0AøAû\nAA A¨A\' \0A\0A\0A\0\0AØA‹\nAA¬A¸A(A)A\0A\0AØA\nAAÀAÌA*A+A\0A\0AØAŠ\bAAÔAÜA,A-A\0A\0AØA€\bAAàAèA.A/A\0A\0A"\0A06\0AØAŸ\vAAìAôA1 \0A\0A\0A\0\0A"\0A26\0AØAû\nAAøA€A3 \0A\0A\0A\0\0A¸A‹\nAA„AA4A5A\0A\0A¸A\nAA˜A¤A6A7A\0A\0A¸AŠ\bAA¬A´A8A9A\0A\0A¸A€\bAA¸AÀA:A;A\0A\0A"\0A<6\0A¸AŸ\vAAÄAÌA= \0A\0A\0A\0\0A"\0A>6\0A¸Aû\nAAÐAØA? \0A\0A\0A\0\0A¤A‹\nAAÜAèAÀ\0AÁ\0A\0A\0A¤A\nAAðAüAÂ\0AÃ\0A\0A\0A¤AŠ\bAA„AŒAÄ\0AÅ\0A\0A\0A¤A€\bAAA˜AÆ\0AÇ\0A\0A\0A"\0AÈ\x006\0A¤AŸ\vAAœA¤AÉ\0 \0A\0A\0A\0\0A"\0AÊ\x006\0A¤Aû\nAA¨A°AË\0 \0A\0A\0A\0\0A„A‹\nAA´AÀAÌ\0AÍ\0A\0A\0A„A\nAAÈAÔAÎ\0AÏ\0A\0A\0A„AŠ\bAAÜAäAÐ\0AÑ\0A\0A\0A„A€\bAAèAðAÒ\0AÓ\0A\0A\0A"\0AÔ\x006\0A„AŸ\vAAôAüAÕ\0 \0A\0A\0A\0\0A"\0AÖ\x006\0A„Aû\nAA€AˆA×\0 \0A\0A\0A\0\0AäA‹\nAAŒA˜AØ\0AÙ\0A\0A\0AäA\nAA A¬AÚ\0AÛ\0A\0A\0AäAŠ\bAA´A¼AÜ\0AÝ\0A\0A\0AäA€\bAAÀAÈAÞ\0Aß\0A\0A\0A"\0Aà\x006\0AäAŸ\vAAÌAÔAá\0 \0A\0A\0A\0\0A"\0Aâ\x006\0AäAû\nAAØAàAã\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aä\x006\0AØA§\vAAäAìAå\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aæ\x006\0A¸A§\vAAðAøAç\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aè\x006\0A¤A¿\tAAüA„ Aé\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aê\x006\0A¤A‡\tAAˆ A” Aë\0 \0A\0A\0A\0\0Aœ A–\vAA\0Aœ AÁ\vAAœ A\tAAœ A›\bAAœ A™\tA\0A\b"\0A\x006 \0Aì\x006\0A„A\vAA¸ AÀ Aí\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aî\x006\0A„A¸\vAAÄ AÌ Aï\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Að\x006\0A„AŠ\tAAÐ AØ Añ\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aò\x006\0A„A–\bAAÜ Aä Aó\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aô\x006\0AäA¿\tAAè Að Aõ\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aö\x006\0AäA÷\bAAô Aü A÷\0 \0A\0A\0A\0\0A\b"\0A\x006 \0Aø\x006\0AäA‡\tAA€!AŒ!Aù\0 \0A\0A\0A\0\0A„AÊ\vAA !A´!Aú\0Aû\0A\0A\0AäAÊ\vAAÀ!AÔ!Aü\0Aý\0A\0A\0A„AÆ\tAAà!Aø!Aþ\0Aÿ\0A\0A\0AäAÆ\tAA€"A"A€AA\0A\0A„A¥\vAA "A°"A‚AƒA\0A\0AäA¥\vAA€"A"A€A„A\0A\0A¸"AÐ"Að"A\0A‘#A…AñA\0AñA\0AÌ\tA”#A†A¸"AA˜#A¤#A‡Aˆ\rA\b"\0A\x006 \0A‰6\0A¸"AÜ\nAA¬#A¸#AŠ \0A\0A\0A\0\0A\b"\0A\x006 \0A‹6\0A¸"Aë\nAA¬#A¸#AŠ \0A\0A\0A\0\0A\b"\0A\x006 \0AŒ6\0A¸"A¼\bAAÀ#AÈ#A \0A\0A\0A\0\0A"\0AŽ6\0A¸"AÖ\vAAÌ#AØ#A \0A\0A\0A\0\0A"\0A6\0A¸"A…\vAAà#Aì#A‘ \0A\0A\0A\0\0\v\r\0    \0\0\v´#\0Ak"$\0 (\0"AøÿÿÿI@@@ A\vO@ Ar"\bAj!  \bAÿÿÿÿk6\f  6  6\b\f\v  :\0 Aj! E\r\v E\r\0  Aj ü\n\0\0\v  jA\0:\0\0   Aj  \0\n\0 ,\0A\0H@ (\v Aj$\0\v#\0\v5  \0("Auj! \0(\0!\0  Aq (\0\0 \0j(\0 \0\v\0\0\v. \0/\0"E@A\v At" \0 AkAþÿqj/jAjÁ\vrA!A! \0/\0" At" \0 AkAþÿqj/jAjÁA\v! \0/\0"@ At" \0 AkAþÿqj/jAjÁ!\v @  \0 ü\n\0\0\v \v° \0A\x006\b \0B\x007\0@ /\0"  At"AkAþÿqj/A\0\v Aj"j"Aÿÿq@ Á"A\0H\r ! @ A\0 ü\v\0\v \0  j"6\b \0 6 \0 6\0\v   AkAÿÿqj/A\0\v jÁ"\0@   \0ü\n\0\0\v\v2\0\vó "!@@ -\0"@ Aj!  j!@  O\r  :\0\0 Aj! -\0! Aj! \r\0\v\v  k G\r\v  \0A\x006\b \0B\x007\0\v A\0:\0\0 "AøÿÿÿI@@@ A\vO@ Ar"Aj! \0 Aÿÿÿÿk6\b \0 6\0 \0 6 !\0\f\v \0 :\0\v E\r\v E\r\0 \0  ü\n\0\0\v \0 jA\0:\0\0 \v#\0\v€ ! \0(\0 \0 \0,\0\vA\0H!  j! Aj"!\0@@ ,\0\0"1E@ \0 O\r \0 :\0\0 \0Aj!\0 Aj!\f\v\v \0 O\r\0 \0A\0:\0\0  Aj;\0 \v A\0\v\b\0 \0]\vK@ E\r\0 A°/ "E\r\0 (\b \0(\bAsq\r\0 \0(\f (\fA\0E\r\0 \0( (A\0!\v \vn Aq! -\x007AF@ A\bu" E\r  (\0j(\0\f\v A\bu E\r\0  \0(68A\0!A\0\v! \0   j A Aq \0(\0(\0\v\n\0 \0 A\0\v\0\0\v\0X\0\v\0Y\0\vÚ\0A¼0AÑ\vAÔ0A”\tAA\0Aà0Aã\bAA€Aÿ\0Aø0AÜ\bAA€Aÿ\0Aì0AÚ\bAA\0AÿA„1A©\bAA€€~AÿÿA1A \bAA\0AÿÿAœ1A¸\bAA€€€€xAÿÿÿÿA¨1A¯\bAA\0AA´1Aï\tAA€€€€xAÿÿÿÿAÀ1Aæ\tAA\0AAÌ1AÜ\tA\bB€€€€€€€€€Bÿÿÿÿÿÿÿÿÿ\0AØ1AÓ\tA\bB\0BAä1AÆ\bA\fAì1A±\vA\b\fAÐ&A¤\nA˜\'AAô\t\tAà\'AA°\n\tA¬(AA¿\n\tA´&Aø(A\0AA )A\0AÒAÈ)AA«Að)AAÚ\vA˜*AAù\vAÀ*AA¡\fAè*AA¾\fA+AA÷A¸+AA•A )A\0A¤\rAÈ)AAƒ\rAð)AAæ\rA˜*AAÄ\rAÀ*AAìAè*AAÊAà+A\bA©Aˆ,A\tA‡A°,AAä\fAØ,AA¼\vù@  \0Aj"I\r\0@ -\0\0"A(G@ Aà\0G\r \0A:\0\0 \0Aj"!\0@@ Aj! ,\0"1\r\0 \0 O\r \0 :\0\0 \0Aj!\0 !\f\v\v \0 O\r \0A\0:\0\0  Aj;\0 \v \0A:\0\0   F\v \0A:\0\0 \0Aj"!\0@ ,\0\0"1E@ \0 O\r \0 :\0\0 \0Aj!\0 Aj!\f\v\v \0 O\r\0 \0A\0:\0\0  Aj;\0 !\v \v1 \0Aˆ46\0 \0(A\fk" (\bAk"6\b A\0H@ \v \0\v\0 \0AÐ\0r7AÐ\0j\vmA\b^"AÜ56\0 Aˆ46\0 \0"A\rj"A\x006\b  6  6\0 A\fj! Aj"@  \0 ü\n\0\0\v  6 A¸46\0 AÄ4A“\v\0\vø\t@ "(\0"@ ("E\r@ "(\0"\r\0\v\v ("\r\0 (\b!A\0!A\f\v  (\b"6\bA\0\v!@ (\0" F@  6\0 \0 F@A\0! !\0\f\v (!\f\v  6\v -\0\f!  G@  (\b"6\b@ (\0 F@  6\0\f\v  6\v  (\0"6\0  6\b  ("6 @  6\b\v  -\0\f:\0\f  \0 \0 F!\0\v@ \0E\r\0 AqE\r\0 @@ -\0\f!@ (\b"(\0" G@ AqE@ A:\0\f A\0:\0\f  ("(\0"6 @  6\b\v  (\b"6\b@ (\0 F@  6\0\f\v  6\v  6\0  6\b  \0 \0 (\0"F!\0 (!\v@@ (\0"@ -\0\fAG\r\v@ ("E\r\0 -\0\fAF\r\0 !\f\v A\0:\0\f \0 (\b"G@ -\0\f\r\v A:\0\f\v@ ("E\r\0 -\0\fAF\r\0 !\f\v A:\0\f A\0:\0\f  ("\x006\0 \0@ \0 6\b\v  (\b"\x006\b@ \0(\0 F@ \0 6\0\f\v \0 6\v  6  6\b !\v  (\b"\0-\0\f:\0\f \0A:\0\f A:\0\f \0 \0("(\0"6 @  \x006\b\v  \0(\b"6\b@ (\0 \0F@  6\0\f\v  6\v  \x006\0 \0 6\b\v AqE@ A:\0\f A\0:\0\f  ("6\0 @  6\b\v  (\b"6\b@ (\0 F@  6\0\f\v  6\v  6  6\b  \0 \0 ("F!\0 (\0!\v@@ (\0"E\r\0 -\0\fAF\r\0 !\f\v@ ("@ -\0\fAG\r\v A\0:\0\f (\b"-\0\fAF \0 Gq\r A:\0\f\v@ E\r\0 -\0\fAF\r\0 !\f\v A:\0\f A\0:\0\f  (\0"\x006 \0@ \0 6\b\v  (\b"\x006\b@ \0(\0 F@ \0 6\0\f\v \0 6\v  6\0  6\b !\v  (\b"\0-\0\f:\0\f \0A:\0\f A:\0\f \0 \0(\0"("6\0 @  \x006\b\v  \0(\b"6\b@ (\0 \0F@  6\0\f\v  6\v  \x006 \0 6\b\v (\b"AA\0  (\0Fj(\0!\f\0\v\0\v A:\0\f\v\v \0!@@A\0! -\0\0"E\r\0@@ Aÿq"A?K\r\0B ­†BÌ€€ƒP\r\0 -\0! Aj! \r\f\v@ A-G\r\0 -\0A-G\r\0 !@ -\0\0 Aj"!A-F\r\0\vA! -\0\0"\r\f\v\v   \\"E@A\0\vA!@@@@ -\0\0Ak\0\v /Aj!\f\v /Aj!\f\v /"E@A!\f\v At"  AkAþÿqj/jAj!\v Aj!  Áj! E\r\v\v   At"AjÁ"jI@A\0\v  \0k"@ \0 j \0 ü\n\0\0\v \0 ;\0 Á"A\0J@A\0! Aÿÿq"@ \0AjA\0 ü\v\0\v@ \0 Á! AjÁ" H\r\0\v\v \vG#\0Ak"$\0 \0(\0!\0  6\f A <6\b  A\bj \0\0 (\f"A\tO@ \n\v Aj$\0\v\0AÔ\võ\f\r#\0A@j"$\0  6\f Aü#6\b  A\bj6  A4j"\b60 B\x0074  A(j"\v6$ B\x007( \0A\bj!\f@@@@@ \0(\b" \0A\fj"\tF\r\0 \0Aj" \0(F\r\0 \0Aj!\n@  \n(\0"G@@@ \0." .N@ . L\r\v \0( " ( (  \0.jI \0( "/\0"E\r\0 \0.\0 At"Aj"\r  Ak"Aþÿqj/jÁH\r\0@ AG@ \f < \tG\r A0j < \bG\r \r  Aÿÿqj/jÁ! \0( "/\0" At"  AkAþÿqj/jAjÁA\v"@   ü\n\0\0\v A0j A<j 5"(\0E@A" 6  (<6\b B\x007\0  6\0 (0(\0"@  60\v (4 4  (8Aj68\f\v \f\v \n < G\r A$j < \vG\r \r  Aÿÿqj/\0jÁ! \0( "/\0" At"  AkAþÿqj/jAjÁA\v"@   ü\n\0\0\v A$j A<j 5"(\0E@A" 6  (<6\b B\x007\0  6\0 ($(\0"@  6$\v (( 4  (,Aj6,\f\v \v  \0( 6< ("E\r  A<j (\0(\0\r\v@ ("@@ "(\0"\r\0\f\v\0\v@  (\b"(\0G !\r\0\v\v  "G\r\0\v\v@ ("@@ "(\0"\r\0\f\v\0\v@  (\b"(\0G !\r\0\v\v \t "G\r\0\v\v \0 \0/";\f\v \0/!\v \0 Aj; (,!\t (8!\n (0" \bF\r@ ("! !@ @@ "(\0"\r\0\v@ "(\0"\r\0\v\f\v@  (\b"(\0G !\r\0\v !@  (\b"(\0G !\r\0\v\v  (0F@  60\v  (8Ak68 (4 ` \f A<j (5"(\0E@A! (! A\x006  6  \0/;  (<6\b B\x007\0  6\0 \0(\b(\0"@ \f 6\0\v \0(\f 4 \0 \0(Aj6\v (! A\x006 @ \v  \b "G\r\0\v\f\vA^"\0Aˆ-6\0 \0A”-A’\v\0\v \v ($"G@ \0Aj!\b@ ("! !@ @@ "(\0"\r\0\v@ "(\0"\r\0\v\f\v@  (\b"(\0G !\r\0\v !@  (\b"(\0G !\r\0\v\v  ($F@  6$\v  (,Ak6, (( ` \b A<j (5"(\0E@A! (! A\x006  6  \0/;  (<6\b B\x007\0  6\0 \0((\0"@ \b 6\0\v \0( 4 \0 \0(Aj6\v (! A\x006 @ \v  \v "G\r\0\v\v ((; (4;@ ("\0 A\bjFA \0E\rA\v! \0 \0(\0 j(\0\0\v A@k$\0 \t \njÁ\v·#\0Ak"$\0 (\0"AøÿÿÿI@ \0(\0!@@ A\vO@ Ar"Aj!\0  Aÿÿÿÿk6\f  \x006  6\b\f\v  :\0 Aj!\0 E\r\v E\r\0 \0 Aj ü\n\0\0\v \0 jA\0:\0\0  Aj \0 ,\0A\0H@ (\v Aj$\0\v#\0\vä#\0Ak"$\0 ,\0\v! (\0!@ \0.\0""   A\0H  ja"E@ \f\v \0/" \0/F@ \0 Aj;\v@@ /\0AG@ \0A\bj A\bj 5"(\0\rA" 6  \0/;  (\b6\b B\x007\0  6\0 \0(\b(\0"@ \0 6\b\v \0(\f 4 \0 \0(Aj6\f\v \0Aj A\fj 5"(\0\rA" 6  \0/;  (\f6\b B\x007\0  6\0 \0((\0"@ \0 6\v \0( 4 \0 \0(Aj6\vA\0!\v E\r\0 \v Aj$\0 A\0G\v5  \0("Auj! \0(\0!\0  Aq (\0 \0j(\0 \0\v\0\v9\0 \0A\x006 \0(\f$ \0 \0A\fj6\b \0B\x007\f \0($ \0 \0Aj6 \0B\x007\v/ \0 ; ! \0( ! \0 6 @ \v \0A\0;\v7  \0("Auj! \0(\0!\0   Aq (\0 \0j(\0 \0\v\0\v\0 \0A\0; \0 ;\0\vªA$! .\0! \0/\0!\0 B\x007  A\fj"6\b B\x007\f A\x006  Aj"6 A\0;  \0;\0  ; ! ( !\0  6 \0@ \0\v A\x006 (\f$  6\b B\x007\f ($  6 B\x007 \v1#\0Ak"$\0  ;  ;\f Aj A\fj \0\0 Aj$\0\v2 \0@ \0( ! \0A\x006 @ \v \0($ \0(\f$ \0\v\v\0A¸"\vž#\0Ak"$\0 !@@ /\0AG\r\0 Aj HE\r\0  \0.\0"At"AjÁH\r\0  ;\0 A\0L\r Aÿÿq"@ AjA\0 ü\v\0\v Aj" AtAþÿqj \0Aj" \0/\0AtAþÿqj   j"6E\r\0 A\0!A!@  .\0"N\r  AtAkAþÿq"\bj.\0  AtAþÿqjj  \bj.\0  \0/\0AtAþÿqjj  6E\r  ! Aj!\f\0\v\0\v A\0!\v Aj$\0 \v?#\0Ak"$\0 !@  H@  \0   j6\r\v A\0!\v Aj$\0 \v! " \0   jI  A\0\v\vA " \0  (\0  ,\0\vA\0H (\0  ,\0\vA\0H  jJ@ \v A\0\vÆ#\0A k"$\0@ (\0"AøÿÿÿO\r\0@@ A\vO@ Ar"\tAj!\b  \tAÿÿÿÿk6  \b6  6\f\v  :\0 Aj!\b E\r\v E\r\0 \b Aj ü\n\0\0\v  \bjA\0:\0\0 (\0"AøÿÿÿO\r\0@@ A\vO@ Ar"Aj!\b  Aÿÿÿÿk6  \b6\b  6\f\f\v  :\0 A\bj!\b E\r\v E\r\0 \b Aj ü\n\0\0\v  \bjA\0:\0\0   Aj A\bj  \0\v\0 ,\0A\0H@ (\b\v ,\0A\0H@ (\v A j$\0\v#\0\vZ ,\0\v! (! (\0! " \0 AjA\0 /\0AF   A\0H"\0A\0   \0  j=@ \v A\0\vL ,\0\v! (! (\0! " \0    A\0H"\0A\0   \0  j(@ \v A\0\v7  \0("Auj! \0(\0!\0   Aq (\0 \0j(\0 \0\v\0\vZ@ A\0H\r\0 \0.\0"Ak L\r\0  N\r\0 \0Aj"\0 AtAþÿqj!  \0 AtAkAþÿqj.\0A\0\v j!\v \vL \0.\0"A\0L@A\0\v \0Aj" At"Aþÿqj!A\0!\0 AG  AkAþÿqj.\0A\0\v j\v\v\0 \0/\0AkÁ\v\0 \0AjA\0 \0-\0\0AF\v\0 \0AjA\0 \0-\0\0AF\v\0 \0AjA\0 \0-\0\0AF\v\0 \0-\0\0\v7  \0("Auj! \0(\0!\0   Aq (\0\0 \0j(\0 \0\v\0\vP@ A\0H\r\0  \0.\0"N\r\0 \0Aj"\0 AtAþÿqj!  \0 AtAkAþÿqj.\0A\0\v j!\v \v\0 \0.\0\vÕ\t !\b@@ /\0"E\r\0  \bj! Aj!\vA!\t \b!@ AkÁ \nJ@@@@@ Á \nÁLA\0 \v AtAþÿqj! \n \v \nAtAkAþÿqj.\0A\0\v j\v"-\0\0Ak\0\v  O\r Aà\0:\0\0 Aj! -\0"E\r Aj!@  O\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v ! -\0"E\r Aj!@  O\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v Aj  3!\v E\r  O\r A\n:\0\0  k" \t Á \tÁJ!\t \nAj!\n Aj! /\0!\f\v\v   \tÁ"jM\r\0 A\0J@ \tAÿÿq"@ A- ü\v\0\v  j!\v A\n:\0\0 \v /\0"AtAþÿqj!A\0! Aj!@@@@ AG \v AtAkAþÿqj.\0A\0\v j"-\0\0Ak\0\v  O\r Aà\0:\0 Aj! -\0"E\r Aj!@  O\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v -\0"E\r Aj!@  O\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v Aj  3!\v E\r\0  O\r\0 A\n:\0\0 Aj \bk G\r\v \b \0A\x006\b \0B\x007\0\v A\0:\0 \b"AøÿÿÿI@@@ A\vO@ Ar"Aj! \0 Aÿÿÿÿk6\b \0 6\0 \0 6 !\0\f\v \0 :\0\v E\r\v E\r\0 \0 \b ü\n\0\0\v \0 jA\0:\0\0 \b\v#\0\v- " \0(\0 \0 \0,\0\vA\0H  ja@ \v A\0\vWA!@@@ \0-\0\0Ak\0\v \0/"E@A\v At" \0 AkAþÿqj/jAj!\v Á\v \0/AjÁ\vçA!A!@@@@ \0-\0\0Ak\0\v \0/Aj!\f\v \0/Aj!\f\v \0/"E@A!\f\v At" \0 AkAþÿqj/jAj!\v Á!@@@@ \0-\0\0Ak\0\v \0/Aj!\f\v \0/Aj!\f\v \0/"E@A!\f\v At" \0 AkAþÿqj/jAj!\v Á"@  \0 ü\n\0\0\v \v· \0A\x006\b \0B\x007\0A!@@@@@@ -\0\0"Ak\0\v /Aj\f\v /Aj\f\v /"E@A!\f\v At"  AkAþÿqj/jAj\v"AÿÿqE@\f\v Á"A\0H\r\v ! @ A\0 ü\v\0\v \0  j"6\b \0 6 \0 6\0\vA!\0@@@@ Ak\0\v /Aj!\0\f\v /Aj!\0\f\v /"\0E@A!\0\f\v \0At"\0  \0AkAþÿqj/jAj!\0\v \0Á"\0@   \0ü\n\0\0\v\v2\0\vô " j!@@@@@@ -\0\0Ak\0\v A\0L\r Aà\0:\0\0 Aj! -\0"E\r Aj!@  O\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v ! -\0"E\r Aj!@  O\r  :\0\0 Aj! -\0! Aj! \r\0\v\f\v Aj  3!\v E\r\0  k G\r\v  \0A\x006\b \0B\x007\0\v A\0:\0\0 "AøÿÿÿI@@@ A\vO@ Ar"Aj! \0 Aÿÿÿÿk6\b \0 6\0 \0 6 !\0\f\v \0 :\0\v E\r\v E\r\0 \0  ü\n\0\0\v \0 jA\0:\0\0 \v#\0\v- " \0(\0 \0 \0,\0\vA\0H  j\\@ \v A\0\v¹  "  j3"A\0  k GE@  \0A\x006\b \0B\x007\0\v A\0:\0\0 "AøÿÿÿI@@@ A\vO@ Ar"Aj! \0 Aÿÿÿÿk6\b \0 6\0 \0 6 !\0\f\v \0 :\0\v E\r\v E\r\0 \0  ü\n\0\0\v \0 jA\0:\0\0 \v#\0\v- " \0(\0 \0 \0,\0\vA\0H  jF@ \v A\0\v‡ !@@ A\0L\r\0 Aà\0:\0\0 Aj! -\0"@  j! Aj!@  O\r  :\0\0 Aj! -\0! Aj! \r\0\v\v  k G\r\v  \0A\x006\b \0B\x007\0\v A\0:\0\0 "AøÿÿÿI@@@ A\vO@ Ar"Aj! \0 Aÿÿÿÿk6\b \0 6\0 \0 6 !\0\f\v \0 :\0\v E\r\v E\r\0 \0  ü\n\0\0\v \0 jA\0:\0\0 \v#\0\v€ ! \0(\0 \0 \0,\0\vA\0H!  j! Aj"!\0@@ ,\0"1E@ \0 O\r Aj! \0 :\0\0 \0Aj!\0\f\v\v \0 O\r\0 \0A\0:\0\0  Aj;\0 \v A\0\v\0Aä\v\0A„\v\0A¤\v\0A¸\v\0AØ\v\0Aø\v0#\0Ak"$\0 \0(\0!\0  :\0   Aj \0\0 Aj$\0\v\0 \0(\0 j -\0\0:\0\0A\v¦#\0Ak"$\0 Aj   \0(\0\0A!\0@ -\0AqE\r\0 -\0!@A€<-\0\0Aq@Aü;(\0!\0\f\vAAÄA\b!\0A€<A:\0\0Aü; \x006\0\v  6\b A\x006 \0A\0A\0 Aj A\bjü!\0 ("E\r\0 \v Aj$\0 \0\v3 ( (\0"k K@A!  j-\0\0!\v \0 :\0 \0 :\0\0\v\r\0 \0( \0(\0k\v0#\0Ak"$\0 \0(\0!\0  :\0   Aj \0\0 Aj$\0\và@@ \0(" \0(\0"k" I@  k" \0(\b" kM@ @  -\0\0 ü\v\0\v \0  j6\v A\0H\rAÿÿÿÿ  k"At"   I AÿÿÿÿO"! @  j -\0\0 ü\v\0\v @   ü\n\0\0\v \0  j6\b \0  j6 \0 6\0 E\r \v  O\r\0 \0  j6\v\v2\0\v\r\0 \0A€j\0\v\0X\0\ve \0D\0\0\0\0\0\0\0\0@Aà=(\0AAA \0AF \0AF"\0AkvAq@Aà>Aà>(\0A \0Aktr6\0\f\v \0At(ð5"@ \0 \0\v\v\v\0 \0(\v\0Aè\b\v\0 \0 (\b @    C\v\v \0 (\b @    C\v -\x005 \0(\f! A\0:\x005 -\x004 A\0:\x004 \0( \0(     A -\x004"\tr!\b -\x005"\nr!@ AI\r\0 \0Aj Atj!\v \0Aj!@ -\x006\r@ \tAq@ (AF\r \0-\0\bAq\r\f\v \nAqE\r\0 \0-\0\bAqE\r\v A\0;4 (\0 (     A -\x005"\n rAq! -\x004"\t \brAq!\b A\bj" \vI\r\0\v\v  Aq:\x005  \bAq:\x004\v§\0 \0 (\b @@  (G\r\0 (AF\r\0  6\v\v@ \0 (\0 E\r\0@ ( G@  (G\r\v AG\r A6 \v  6  6  ((Aj6(@ ($AG\r\0 (AG\r\0 A:\x006\v A6,\v\v.#\0Ak"$\0 \0(\0!\0  :\0  Aj \0\0 Aj$\0\væ \0 (\b @@  (G\r\0 (AF\r\0  6\v\v@ \0 (\0 @@ ( G@  (G\r\v AG\r A6 \v  6 @ (,AF\r\0 \0Aj" \0(\fAtj!A\0!@@@  O\r\0 A\0;4 (\0 (   A A -\x006\r\0@ -\x005AG\r\0 -\x004AF@ (AG@A!A! \0-\0\bAq\r\v A6,\vA! \0-\0\bAqE\r\v A\bj!\f\v\v AA 6, E\r\f\v A6, \r\v  6  ((Aj6( ($AG\r (AG\r A:\x006\v \0(\f! \0( \0(    8 AI\r\0 \0Aj Atj! \0Aj!@ \0(\b"\0AqE@ ($AG\r\v@ -\x006\r (\0 (    8 A\bj" I\r\0\v\f\v \0AqE@@ -\x006\r ($AF\r (\0 (    8 A\bj" I\r\0\f\v\0\v@ -\x006\r ($AF@ (AF\r\v (\0 (    8 A\bj" I\r\0\v\v\v¿#\0A@j"$\0@ AÈ0A\0@ A\x006\0A!\f\v@ \0  \0-\0\bAqA E\r Aœ. "E\r -\0\bAqA\0G\v!\v @A! (\0"\0E\r  \0(\x006\0\f\v E\r\0 AÌ. "E\r\0 (\0"@  (\0"6\0\v (\b" \0(\b"AsqAq\r\0 As qAà\0q\r\0A! \0(\f" (\f"\0A\0\r\0 A¼0A\0@ \0E\r \0Aü. E!\f\vA\0! E\r\0 AÌ. "@ AqE\r@@ \0E\r \0AÌ. "\0E\r \0(\b (\b"Asq\rA (\f" \0(\f"\0A\0\r AqE\r E\r AÌ. "\r\0\v A°/ "E\r\0  \0U!\v \v!\f\v A°/ "@ AqE\r  \0U!\f\v Aì- "E\r\0 \0E\r\0 \0Aì- "\0E\r\0 A\bjA\0A8ü\v\0  A\0G:\0; A6  6\f  \x006 A64 \0 Aj A \0(\0(\0 ("\0AF@  (A\0 6\0\v \0AF!\v A@k$\0 \vz \0 (\bA\0@   B\v \0(\f! \0( \0(   V@ AI\r\0 \0Aj Atj! \0Aj!\0@ \0(\0 \0(   V -\x006\r \0A\bj"\0 I\r\0\v\v\v\0 \0 (\bA\0@   B\v\v1\0 \0 (\bA\0@   B\v \0(\b"\0    \0(\0(\0\v‹\0 \0 (\b @@  (G\r\0 (AF\r\0  6\v\v@ \0 (\0 @@ ( G@  (G\r\v AG\r A6 \v  6 @ (,AF\r\0 A\0;4 \0(\b"\0   A  \0(\0(\b\0 -\x005AF@ A6, -\x004E\r\f\v A6,\v  6  ((Aj6( ($AG\r (AG\r A:\x006\v \0(\b"\0     \0(\0(\t\0\v\vÁ \0(" \0(\b"I@  -\0\0:\0\0 \0 Aj6\v  \0(\0"k"Aj"A\0N@ Aÿÿÿÿ  k"At"   I AÿÿÿÿO" A\0\v"j" -\0\0:\0\0 @   ü\n\0\0\v \0  j6\b \0 Aj"6 \0 6\0 @ \v \0 6\v2\0\v7\0 \0 (\b @    C\v \0(\b"\0      \0(\0(\b\0\v­#\0A@j"$\0@A \0 A\0\r\0A\0 E\r\0A\0 Aì- "E\r\0 (\0"E\r A\bjA\0A8ü\v\0 A:\0; A6  \x006\f  6 A64  Aj A (\0(\0 ("\0AF@  (6\0\v \0AF\v A@k$\0\vY\0\v\0Až\t\v§ \0("Aj"7"\0 A€O@ @ \0  ü\n\0\0\v \0\f\v \0 j!@ \0 sAqE@@ \0AqE@ \0!\f\v E@ \0!\f\v \0!@  -\0\0:\0\0 Aj! Aj"AqE\r  I\r\0\v\v A|q!@ AÀ\0I\r\0  A@j"K\r\0@  (\x006\0  (6  (\b6\b  (\f6\f  (6  (6  (6  (6  ( 6  ($6$  ((6(  (,6,  (060  (464  (868  (<6< A@k! A@k" M\r\0\v\v  O\r@  (\x006\0 Aj! Aj" I\r\0\v\f\v AI@ \0!\f\v AI@ \0!\f\v Ak! \0!@  -\0\0:\0\0  -\0:\0  -\0:\0  -\0:\0 Aj! Aj" M\r\0\v\v  I@@  -\0\0:\0\0 Aj! Aj" G\r\0\v\v \0\vA\0\v\vA\f"\0A\x006\b \0B\x007\0 \0\v\0Að%\v\0 \0AjA\0 (Aø%F\v‡|#\0Ak"$\0 \0((! (\0!@Aˆ<-\0\0Aq@A„<(\0!\0\f\vAAà%A\0\b!\0Aˆ<A:\0\0A„< \x006\0\v  6\b A\x006 \0 A\0 Aj A\bj ("\0@ \0\vA<-\0\0AqE@AAè%A\b!\0A<A:\0\0AŒ< \x006\0\vü"\0A\tO@ \0\v  \x006\b A\x006AŒ<(\0 \0A\0 Aj A\bj ("@ \v \0A\tO@ \0\n\v Aj$\0D\0\0\0\0\0\0\0\0b\v\0 \0\r\0\v\0  \0(6 Aü#6\0\vA\b" \0(6 Aü#6\0 \v" \0@ \0(\0"@ \0 6 \v \0\v\v€\0Að;A6\0Aô;A\x006\0KAô;A”<(\x006\0A”<Að;6\0A˜<A”6\0Aœ<A\x006\0[Aœ<A”<(\x006\0A”<A˜<6\0AÜ<A€À\x006\0AÔ<Að¾6\0A¸<A*6\0A€=AÄ=6\0AØ<A€€6\0\v\vÃ.\0A€\b\vto_binary\0from_binary\0list\0List\0unsigned short\0unsigned int\0reset\0get\0float\0vector\0Buffer\0unsigned char\0std::exception\0conclusion\0Term\0getitem\0Item\0bool\0Null\0std::bad_function_call\0push_back\0length\0match\0Search\0unsigned long long\0unsigned long\0std::wstring\0to_string\0from_string\0basic_string\0std::string\0std::u16string\0std::u32string\0String\0resize\0set_limit_size\0set_buffer_size\0data_size\0execute\0get_type\0TermType\0clone\0rename\0Rule\0double\0variable\0Variable\0ground\0void\0add\0emscripten::memory_view<short>\0emscripten::memory_view<unsigned short>\0emscripten::memory_view<int>\0emscripten::memory_view<unsigned int>\0emscripten::memory_view<float>\0emscripten::memory_view<uint8_t>\0emscripten::memory_view<int8_t>\0emscripten::memory_view<uint16_t>\0emscripten::memory_view<int16_t>\0emscripten::memory_view<uint64_t>\0emscripten::memory_view<int64_t>\0emscripten::memory_view<uint32_t>\0emscripten::memory_view<int32_t>\0emscripten::memory_view<char>\0emscripten::memory_view<unsigned char>\0emscripten::memory_view<signed char>\0emscripten::memory_view<long>\0emscripten::memory_view<unsigned long>\0emscripten::memory_view<double>\0`() \t\r\n\0€\0\0Œ\b\0\0\0\0\0\0\0\0\0¤\b\0\0\0\0\0\0ð\t\0\0\0\0\0\0 \n\0\0\0\0\0\0NSt3__28optionalIhEE\0\0\0\0¬\0\0°\b\0\0à\b\0\0NSt3__227__optional_move_assign_baseIhLb1EEE\0\0\0\0¬\0\0ì\b\0\0\t\0\0NSt3__227__optional_copy_assign_baseIhLb1EEE\0\0\0\0¬\0\0(\t\0\0P\t\0\0NSt3__220__optional_move_baseIhLb1EEE\0\0\0¬\0\0\\\t\0\0„\t\0\0NSt3__220__optional_copy_baseIhLb1EEE\0\0\0¬\0\0\t\0\0¼\t\0\0NSt3__223__optional_storage_baseIhLb0EEE\0\0\0\0t\0\0Ä\t\0\0NSt3__224__optional_destruct_baseIhLb1EEE\0\0\0t\0\0ø\t\0\0NSt3__218__sfinae_ctor_baseILb1ELb1EEE\0\0t\0\0(\n\0\0NSt3__220__sfinae_assign_baseILb1ELb1EEE\0\0\0\0t\0\0\\\n\0\0NSt3__26vectorIhNS_9allocatorIhEEEE\0Ü\0\0\n\0\0\0\0\0\0T\n\0\0PNSt3__26vectorIhNS_9allocatorIhEEEE\0\0\0\0Ü\0\0È\n\0\0\0\0\0T\n\0\0PKNSt3__26vectorIhNS_9allocatorIhEEEE\0pp\0v\0vp\0\0\0€\n\0\0pp\0\0<\0\0T\n\0\0l\0\0vppi\0A \vð\n<\0\0T\n\0\0¨\0\0l\0\0vppii\0\0\0¨\0\0T\n\0\0ipp\x004\0\0l\0\0d\b\0\0T\n\0\0¨\0\0pppi\0\0\0\0T\0\0T\n\0\0¨\0\0l\0\0ippii\0\0\0t\0\0€\v\0\0N2ds8string_tE\0\0Ü\0\0 \v\0\0\0\0\0\0x\v\0\0PN2ds8string_tE\0Ü\0\0À\v\0\0\0\0\0x\v\0\0PKN2ds8string_tE\0pp\0vp\0\0t\0\0à\v\0\0N2ds6item_tE\0\0\0\0Ü\0\0\0\f\0\0\0\0\0\0Ø\v\0\0PN2ds6item_tE\0\0\0Ü\0\0 \f\0\0\0\0\0Ø\v\0\0PKN2ds6item_tE\0pp\0vp\0\0\0\0t\0\0@\f\0\0N2ds10variable_tE\0\0\0Ü\0\0d\f\0\0\0\0\0\x008\f\0\0PN2ds10variable_tE\0\0Ü\0\0ˆ\f\0\0\0\0\x008\f\0\0PKN2ds10variable_tE\0pp\0vp\0\0\0t\0\0¬\f\0\0N2ds6list_tE\0\0\0\0Ü\0\0Ì\f\0\0\0\0\0\0¤\f\0\0PN2ds6list_tE\0\0\0Ü\0\0ì\f\0\0\0\0\0¤\f\0\0PKN2ds6list_tE\0pp\0vp\0\0\0\0t\0\0\f\r\0\0N2ds6term_tE\0\0\0\0Ü\0\0,\r\0\0\0\0\0\0\r\0\0PN2ds6term_tE\0\0\0Ü\0\0L\r\0\0\0\0\0\r\0\0PKN2ds6term_tE\0pp\0vp\0\0\0\0€\0\0|\r\0\0\0\0\0\0\0\0\0¤\f\0\0\0\0\0\0N2ds6rule_tE\0\0\0\0Ü\0\0œ\r\0\0\0\0\0\0d\r\0\0PN2ds6rule_tE\0\0\0Ü\0\0¼\r\0\0\0\0\0d\r\0\0PKN2ds6rule_tE\0pp\0vp\0\0\0\0x\v\0\0P\0\0œ\0\0pppi\0\0\0\0P\0\0\v\0\0œ\0\0pppi\0\0\0\0x\v\0\0T\n\0\0ppp\0T\n\0\0\v\0\0ppp\0x\v\0\0\v\0\0ppp\0œ\0\0\v\0\0ipp\0Ø\v\0\0P\0\0œ\0\0pppi\0\0\0\0P\0\0ð\v\0\0œ\0\0pppi\0\0\0\0Ø\v\0\0T\n\0\0ppp\0T\n\0\0ð\v\0\0ppp\0Ø\v\0\0ð\v\0\0ppp\0œ\0\0ð\v\0\0ipp\x008\f\0\0P\0\0œ\0\0pppi\0\0\0\0P\0\0T\f\0\0œ\0\0pppi\0\0\0\x008\f\0\0T\n\0\0ppp\0T\n\0\0T\f\0\0ppp\x008\f\0\0T\f\0\0ppp\0œ\0\0T\f\0\0ipp\0¤\f\0\0P\0\0œ\0\0pppi\0\0\0\0P\0\0¼\f\0\0œ\0\0pppi\0\0\0\0¤\f\0\0T\n\0\0ppp\0T\n\0\0¼\f\0\0ppp\0¤\f\0\0¼\f\0\0ppp\0œ\0\0¼\f\0\0ipp\0\r\0\0P\0\0œ\0\0pppi\0\0\0\0P\0\0\r\0\0œ\0\0pppi\0\0\0\0\r\0\0T\n\0\0ppp\0T\n\0\0\r\0\0ppp\0\r\0\0\r\0\0ppp\0œ\0\0\r\0\0ipp\0d\r\0\0P\0\0œ\0\0pppi\0\0\0\0P\0\0Œ\r\0\0œ\0\0pppi\0\0\0\0d\r\0\0T\n\0\0ppp\0T\n\0\0Œ\r\0\0ppp\0d\r\0\0Œ\r\0\0ppp\0œ\0\0Œ\r\0\0ipp\0\v\0\0ð\v\0\0ppp\0\v\0\0T\f\0\0ppp\0„\0\0¼\f\0\0ipp\0\r\0\0¼\f\0\0„\0\0pppi\0\0\0\0\0\0\0$\0\0N2ds11term_type_tE\0\0\0\0\r\0\0ipp\0T\f\0\0\r\0\0ppp\0ð\v\0\0\r\0\0ppp\0¼\f\0\0\r\0\0ppp\0„\0\0Œ\r\0\0ipp\0\r\0\0Œ\r\0\0ppp\0\r\0\0Œ\r\0\0„\0\0pppi\0A !\vu\r\0\0\r\0\0\r\0\0P\0\0œ\0\0pppppi\0\0\0\0\0\0d\r\0\0Œ\r\0\0Œ\r\0\0P\0\0œ\0\0pppppi\0\0\0\0\0\0\r\0\0\r\0\0\r\0\0P\0\0P\0\0œ\0\0ppppppi\0d\r\0\0Œ\r\0\0Œ\r\0\0œ\0\0ppppi\0A "\vÅ\r\0\0\r\0\0\r\0\0œ\0\0ppppi\0\0\0t\0\0@\0\0N2ds8search_tE\0\0Ü\0\0`\0\0\0\0\0\x008\0\0PN2ds8search_tE\0Ü\0\0€\0\0\0\0\x008\0\0PKN2ds8search_tE\0pp\0vp\0\0P\0\0„\0\0„\0\0ppii\0\0\0\0<\0\0P\0\0„\0\0vppi\0\0\0\0<\0\0P\0\0vpp\0T\0\0P\0\0P\0\0ippp\0\0\0\0„\0\0P\0\x004\0\0ippp\0\0\0\0\0\0\0\0 \0\0•\0\0\0–\0\0\0—\0\0\0˜\0\0\0™\0\0\0š\0\0\0›\0\0\0œ\0\0\0\0\0\0¬\0\0,\0\0¨\0\0NSt3__210__function6__funcIZ14search_executePN2ds8search_tERKN10emscripten3valEE3$_0NS_9allocatorIS9_EEFbPNS2_6rule_tEEEE\0\0\0t\0\0°\0\0NSt3__210__function6__baseIFbPN2ds6rule_tEEEE\0\0\x004\0\0Œ\r\0\0T\0\x004\0\0t\0\0ø\0\0Z14search_executePN2ds8search_tERKN10emscripten3valEE3$_0\0f\0t\0\0<\0\0N10emscripten3valE\0\0t\0\0X\0\0NSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE\0\0t\0\0 \0\0NSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEE\0\0t\0\0è\0\0NSt3__212basic_stringIDsNS_11char_traitsIDsEENS_9allocatorIDsEEEE\0\0\0t\0\x004\0\0NSt3__212basic_stringIDiNS_11char_traitsIDiEENS_9allocatorIDiEEEE\0\0\0t\0\0€\0\0N10emscripten11memory_viewIcEE\0\0t\0\0¨\0\0N10emscripten11memory_viewIaEE\0\0t\0\0Ð\0\0N10emscripten11memory_viewIhEE\0\0t\0\0ø\0\0N10emscripten11memory_viewIsEE\0\0t\0\0 \0\0N10emscripten11memory_viewItEE\0\0t\0\0H\0\0N10emscripten11memory_viewIiEE\0\0t\0\0p\0\0N10emscripten11memory_viewIjEE\0\0t\0\0˜\0\0N10emscripten11memory_viewIlEE\0\0t\0\0À\0\0N10emscripten11memory_viewImEE\0\0t\0\0è\0\0N10emscripten11memory_viewIxEE\0\0t\0\0\0\0N10emscripten11memory_viewIyEE\0\0t\0\x008\0\0N10emscripten11memory_viewIfEE\0\0t\0\0`\0\0N10emscripten11memory_viewIdEE\0\0\0\0\0\0”\0\0’\0\0\0ž\0\0\0Ÿ\0\0\0¬\0\0 \0\0Ì\0\0NSt3__217bad_function_callE\0¬\0\0È\0\0d\0\0N10__cxxabiv116__shim_type_infoE\0\0\0\0¬\0\0ø\0\0¼\0\0N10__cxxabiv117__class_type_infoE\0\0\0¬\0\0(\0\0¼\0\0N10__cxxabiv117__pbase_type_infoE\0\0\0¬\0\0X\0\0\0\0N10__cxxabiv119__pointer_type_infoE\0¬\0\0ˆ\0\0¼\0\0N10__cxxabiv120__function_type_infoE\0\0\0\0¬\0\0¼\0\0\0\0N10__cxxabiv129__pointer_to_member_type_infoE\0\0\0\0\0\0\0\b\0\0¡\0\0\0¢\0\0\0£\0\0\0¤\0\0\0¥\0\0\0¬\0\0\0\0¼\0\0N10__cxxabiv123__fundamental_type_infoE\0ô\0\0D\0\0v\0\0\0ô\0\0P\0\0Dn\0\0ô\0\0\\\0\0b\0\0\0ô\0\0h\0\0c\0\0\0ô\0\0t\0\0h\0\0\0ô\0\0€\0\0a\0\0\0ô\0\0Œ\0\0s\0\0\0ô\0\0˜\0\0t\0\0\0ô\0\0¤\0\0i\0\0\0ô\0\0°\0\0j\0\0\0ô\0\0¼\0\0l\0\0\0ô\0\0È\0\0m\0\0\0ô\0\0Ô\0\0x\0\0\0ô\0\0à\0\0y\0\0\0ô\0\x002\0\0ô\0\0ô\0\0d\0\0\0\0\0\0\0\0\0¡\0\0\0¦\0\0\0£\0\0\0¤\0\0\0§\0\0\0¬\0\0 \0\0¼\0\0N10__cxxabiv116__enum_type_infoE\0\0\0\0¬\0\0P\0\0ì\0\0N10__cxxabiv120__si_class_type_infoE\0\0\0\0\0\0\0\0 \0\0¡\0\0\0¨\0\0\0£\0\0\0¤\0\0\0©\0\0\0ª\0\0\0«\0\0\0¬\0\0\0¬\0\0¬\0\0ì\0\0N10__cxxabiv121__vmi_class_type_infoE\0\0\0\0\0\0\0L\0\0¡\0\0\0­\0\0\0£\0\0\0¤\0\0\0®\0\0\0St9exception\0\0\0\0\0\0\0\0\0\0“\0\0\0¯\0\0\0°\0\0\0¬\0\0 \0\0Ì\0\0St11logic_error\0\0\0\0\0D\0\0“\0\0\0±\0\0\0°\0\0\0¬\0\0P\0\0\0\0St12length_error\0\0\0\0t\0\0”\0\0\0\0\0\0ì\0\0¡\0\0\0²\0\0\0£\0\0\0¤\0\0\0©\0\0\0³\0\0\0´\0\0\0µ\0\0\0St9type_info\0\0\0\0\0\0\0\0D\0\0¡\0\0\0¶\0\0\0£\0\0\0¤\0\0\0©\0\0\0·\0\0\0¸\0\0\0¹\0\0\0t\0\0ð\0\0\0\0\0\0Ì\0\0º\0\0\0»\0\0\0¼\0Aô5\v9½\0\0\0½\0\0\0¾\0\0\0¾\0\0\0¾\0\0\0¾\0\0\0¾\0\0\0¾\0\0\0½\0\0\0½\0\0\0¾\0\0\0½\0\0\0½\0\0\0½\0\0\0½\0AÐ6\v¾\0\0\0¾\0\0\0½\0\0\0½\0\0\0\0\0\0\0½\0\0\0\0\0\0\0¾\0Aô7\vp\0 '),function(t){return e(t.instance)}(await async function(e,t,r){return async function(e,t){try{var r=await async function(e){return e}(e);return await WebAssembly.instantiate(r,t)}catch(e){E(`failed to asynchronously prepare wasm: ${e}`),R(e)}}(t,r)}(0,S,r)))}(),function(){function e(){t.calledRun=!0,_||(b=!0,ot.C(),c?.(t),t.onRuntimeInitialized?.(),function(){if(t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;)N(t.postRun.shift());w(k)}())}!function(){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)O(t.preRun.shift());w(I)}(),t.setStatus?(t.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>t.setStatus(""),1),e()},1)):e()}(),b?t:new Promise((e,t)=>{c=e,u=t})}();let r$1=1024;function t$1(e=0){const t=r$1;return 0!==e&&(r$1=e),t}let e$1=class e{type;value;capacity;constructor(t,r,n=0){if(this.type=t,r instanceof e){if(this.value=r.value,this.capacity=r.capacity,0!==n)throw new Error("Cannot set capacity when copying from another instance.")}else if(r instanceof this.type)this.value=r,this.capacity=n;else if("string"==typeof r){if(this.capacity=0!==n?n:t$1(),this.value=this.type.from_string(r,this.capacity),null===this.value)throw new Error("Initialization from a string failed.")}else{if(!(r instanceof A$1.Buffer))throw new Error("Unsupported type for initialization.");if(this.value=this.type.from_binary(r),this.capacity=this.size(),0!==n)throw new Error("Cannot set capacity when initializing from bytes.")}}toString(){const e=this.type.to_string(this.value,t$1());if(""===e)throw new Error("Conversion to string failed.");return e}data(){return this.type.to_binary(this.value)}size(){return this.value.data_size()}copy(){return new this.constructor(this.value.clone(),this.size())}key(){return this.toString()}},v$1=class extends e$1{constructor(e,t=0){super(A$1.String,e,t)}},n$1=class extends e$1{constructor(e,t=0){super(A$1.Variable,e,t)}name(){return new v$1(this.value.name())}},i$1=class extends e$1{constructor(e,t=0){super(A$1.Item,e,t)}name(){return new v$1(this.value.name())}},s$1=class extends e$1{constructor(e,t=0){super(A$1.List,e,t)}length(){return this.value.length()}getitem(e){return new a$1(this.value.getitem(e))}},a$1=class e extends e$1{constructor(e,t=0){super(A$1.Term,e,t)}term(){const e=this.value.get_type();if(e===A$1.TermType.Variable)return new n$1(this.value.variable());if(e===A$1.TermType.Item)return new i$1(this.value.item());if(e===A$1.TermType.List)return new s$1(this.value.list());throw new Error("Unexpected term type.")}ground(t,r=""){const n=t$1(),i=A$1.Term.ground(this.value,t.value,r,n);return null===i?null:new e(i,n)}match(t){const r=t$1(),n=A$1.Term.match(this.value,t.value,"1","2",r);return null===n?null:new e(n,r)}rename(t){const r=t$1(),n=A$1.Term.rename(this.value,t.value,r);return null===n?null:new e(n,r)}},j$1=class e extends e$1{constructor(e,t=0){super(A$1.Rule,e,t)}length(){return this.value.length()}getitem(e){return new a$1(this.value.getitem(e))}conclusion(){return new a$1(this.value.conclusion())}ground(t,r=""){const n=t$1(),i=A$1.Rule.ground(this.value,t.value,r,n);return null===i?null:new e(i,n)}match(t){const r=t$1(),n=A$1.Rule.match(this.value,t.value,r);return null===n?null:new e(n,r)}rename(t){const r=t$1(),n=A$1.Rule.rename(this.value,t.value,r);return null===n?null:new e(n,r)}},o$1=class{_search;constructor(e=1e3,t=1e4){this._search=new A$1.Search(e,t)}set_limit_size(e){this._search.set_limit_size(e)}set_buffer_size(e){this._search.set_buffer_size(e)}reset(){this._search.reset()}add(e){return this._search.add(e)}execute(e){return this._search.execute(t=>e(new j$1(t).copy()))}};var t={763:()=>{}},e={};function s(r){var n=e[r];if(void 0!==n)return n.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,s),i.exports}s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n={};s.d(n,{MG:()=>j,fr:()=>kt,sR:()=>Ae,Zo:()=>ye,iH:()=>we,rt:()=>Pt,jB:()=>be,M8:()=>le,$t:()=>Ce,aq:()=>me,pG:()=>vt,eP:()=>_e,KU:()=>xe,zW:()=>Le,IX:()=>E,mY:()=>S,a7:()=>$,JG:()=>Ut,ay:()=>Xt,X2:()=>ee,WU:()=>de,Uw:()=>pe,gw:()=>ge,iX:()=>De,re:()=>ne,Pg:()=>He,tD:()=>ie,R$:()=>te,Dj:()=>Dt,m7:()=>U,NZ:()=>P,xo:()=>b,ou:()=>i,qC:()=>Be,mD:()=>d,Ay:()=>Ke});class i{constructor(){this.source=null,this.type=null,this.channel=null,this.start=null,this.stop=null,this.tokenIndex=null,this.line=null,this.column=null,this._text=null}getTokenSource(){return this.source[0]}getInputStream(){return this.source[1]}get text(){return this._text}set text(e){this._text=e}}function r(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!(e[r]===t[r]||e[r].equals&&e[r].equals(t[r])))return!1;return!0}i.INVALID_TYPE=0,i.EPSILON=-2,i.MIN_USER_TOKEN_TYPE=1,i.EOF=-1,i.DEFAULT_CHANNEL=0,i.HIDDEN_CHANNEL=1;const o=Math.round(Math.random()*Math.pow(2,32));function a(e){if(!e)return 0;const t=typeof e,r="string"===t?e:!("object"!==t||!e.toString)&&e.toString();if(!r)return 0;let n,i;const s=3&r.length,a=r.length-s;let l=o;const c=3432918353,u=461845907;let h=0;for(;h<a;)i=255&r.charCodeAt(h)|(255&r.charCodeAt(++h))<<8|(255&r.charCodeAt(++h))<<16|(255&r.charCodeAt(++h))<<24,++h,i=(65535&i)*c+(((i>>>16)*c&65535)<<16)&4294967295,i=i<<15|i>>>17,i=(65535&i)*u+(((i>>>16)*u&65535)<<16)&4294967295,l^=i,l=l<<13|l>>>19,n=5*(65535&l)+((5*(l>>>16)&65535)<<16)&4294967295,l=27492+(65535&n)+((58964+(n>>>16)&65535)<<16);switch(i=0,s){case 3:i^=(255&r.charCodeAt(h+2))<<16;case 2:i^=(255&r.charCodeAt(h+1))<<8;case 1:i^=255&r.charCodeAt(h),i=(65535&i)*c+(((i>>>16)*c&65535)<<16)&4294967295,i=i<<15|i>>>17,i=(65535&i)*u+(((i>>>16)*u&65535)<<16)&4294967295,l^=i}return l^=r.length,l^=l>>>16,l=2246822507*(65535&l)+((2246822507*(l>>>16)&65535)<<16)&4294967295,l^=l>>>13,l=3266489909*(65535&l)+((3266489909*(l>>>16)&65535)<<16)&4294967295,l^=l>>>16,l>>>0}class l{constructor(){this.count=0,this.hash=0}update(){for(let e=0;e<arguments.length;e++){const t=arguments[e];if(null!=t)if(Array.isArray(t))this.update.apply(this,t);else{let e=0;switch(typeof t){case"undefined":case"function":continue;case"number":case"boolean":e=t;break;case"string":e=a(t);break;default:t.updateHashCode?t.updateHashCode(this):console.log("No updateHashCode for "+t.toString());continue}e*=3432918353,e=e<<15|e>>>17,e*=461845907,this.count=this.count+1;let r=this.hash^e;r=r<<13|r>>>19,r=5*r+3864292196,this.hash=r}}}finish(){let e=this.hash^4*this.count;return e^=e>>>16,e*=2246822507,e^=e>>>13,e*=3266489909,e^=e>>>16,e}static hashStuff(){const e=new l;return e.update.apply(e,arguments),e.finish()}}function h(e){return e?"string"==typeof e?a(e):e.hashCode():-1}function c(e,t){return e&&e.equals?e.equals(t):e===t}function u(e){return null===e?"null":e}function d(e){return Array.isArray(e)?"["+e.map(u).join(", ")+"]":"null"}class p{constructor(e,t){this.buckets=new Array(16),this.threshold=Math.floor(12),this.itemCount=0,this.hashFunction=e||h,this.equalsFunction=t||c}get(e){if(null==e)return e;const t=this._getBucket(e);if(!t)return null;for(const r of t)if(this.equalsFunction(r,e))return r;return null}add(e){return this.getOrAdd(e)===e}getOrAdd(e){this._expand();const t=this._getSlot(e);let r=this.buckets[t];if(!r)return r=[e],this.buckets[t]=r,this.itemCount++,e;for(const t of r)if(this.equalsFunction(t,e))return t;return r.push(e),this.itemCount++,e}has(e){return null!=this.get(e)}values(){return this.buckets.filter(e=>null!=e).flat(1)}toString(){return d(this.values())}get length(){return this.itemCount}_getSlot(e){return this.hashFunction(e)&this.buckets.length-1}_getBucket(e){return this.buckets[this._getSlot(e)]}_expand(){if(this.itemCount<=this.threshold)return;const e=this.buckets,t=2*this.buckets.length;this.buckets=new Array(t),this.threshold=Math.floor(.75*t);for(const t of e)if(t)for(const e of t){const t=this._getSlot(e);let r=this.buckets[t];r||(r=[],this.buckets[t]=r),r.push(e)}}}class g{hashCode(){const e=new l;return this.updateHashCode(e),e.finish()}evaluate(e,t){}evalPrecedence(e,t){return this}static andContext(e,t){if(null===e||e===g.NONE)return t;if(null===t||t===g.NONE)return e;const r=new f(e,t);return 1===r.opnds.length?r.opnds[0]:r}static orContext(e,t){if(null===e)return t;if(null===t)return e;if(e===g.NONE||t===g.NONE)return g.NONE;const r=new x(e,t);return 1===r.opnds.length?r.opnds[0]:r}}class f extends g{constructor(e,t){super();const r=new p;e instanceof f?e.opnds.map(function(e){r.add(e)}):r.add(e),t instanceof f?t.opnds.map(function(e){r.add(e)}):r.add(t);const n=_(r);if(n.length>0){let e=null;n.map(function(t){(null===e||t.precedence<e.precedence)&&(e=t)}),r.add(e)}this.opnds=Array.from(r.values())}equals(e){return this===e||e instanceof f&&r(this.opnds,e.opnds)}updateHashCode(e){e.update(this.opnds,"AND")}evaluate(e,t){for(let r=0;r<this.opnds.length;r++)if(!this.opnds[r].evaluate(e,t))return!1;return!0}evalPrecedence(e,t){let r=!1;const n=[];for(let i=0;i<this.opnds.length;i++){const s=this.opnds[i],a=s.evalPrecedence(e,t);if(r|=a!==s,null===a)return null;a!==g.NONE&&n.push(a)}if(!r)return this;if(0===n.length)return g.NONE;let i=null;return n.map(function(e){i=null===i?e:g.andContext(i,e)}),i}toString(){const e=this.opnds.map(e=>e.toString());return(e.length>3?e.slice(3):e).join("&&")}}class x extends g{constructor(e,t){super();const r=new p;e instanceof x?e.opnds.map(function(e){r.add(e)}):r.add(e),t instanceof x?t.opnds.map(function(e){r.add(e)}):r.add(t);const n=_(r);if(n.length>0){const e=n.sort(function(e,t){return e.compareTo(t)}),t=e[e.length-1];r.add(t)}this.opnds=Array.from(r.values())}equals(e){return this===e||e instanceof x&&r(this.opnds,e.opnds)}updateHashCode(e){e.update(this.opnds,"OR")}evaluate(e,t){for(let r=0;r<this.opnds.length;r++)if(this.opnds[r].evaluate(e,t))return!0;return!1}evalPrecedence(e,t){let r=!1;for(let n=0;n<this.opnds.length;n++){const i=this.opnds[n],s=i.evalPrecedence(e,t);if(r|=s!==i,s===g.NONE)return g.NONE}return r?null:this}toString(){const e=this.opnds.map(e=>e.toString());return(e.length>3?e.slice(3):e).join("||")}}function _(e){const t=[];return e.values().map(function(e){e instanceof g.PrecedencePredicate&&t.push(e)}),t}function T(e,t){if(null===e){const e={state:null,alt:null,context:null,semanticContext:null};return t&&(e.reachesIntoOuterContext=0),e}{const r={};return r.state=e.state||null,r.alt=void 0===e.alt?null:e.alt,r.context=e.context||null,r.semanticContext=e.semanticContext||null,t&&(r.reachesIntoOuterContext=e.reachesIntoOuterContext||0,r.precedenceFilterSuppressed=e.precedenceFilterSuppressed||!1),r}}class m{constructor(e,t){this.checkContext(e,t),e=T(e),t=T(t,!0),this.state=null!==e.state?e.state:t.state,this.alt=null!==e.alt?e.alt:t.alt,this.context=null!==e.context?e.context:t.context,this.semanticContext=null!==e.semanticContext?e.semanticContext:null!==t.semanticContext?t.semanticContext:g.NONE,this.reachesIntoOuterContext=t.reachesIntoOuterContext,this.precedenceFilterSuppressed=t.precedenceFilterSuppressed}checkContext(e,t){null!==e.context&&void 0!==e.context||null!==t&&null!==t.context&&void 0!==t.context||(this.context=null)}hashCode(){const e=new l;return this.updateHashCode(e),e.finish()}updateHashCode(e){e.update(this.state.stateNumber,this.alt,this.context,this.semanticContext)}equals(e){return this===e||e instanceof m&&this.state.stateNumber===e.state.stateNumber&&this.alt===e.alt&&(null===this.context?null===e.context:this.context.equals(e.context))&&this.semanticContext.equals(e.semanticContext)&&this.precedenceFilterSuppressed===e.precedenceFilterSuppressed}hashCodeForConfigSet(){const e=new l;return e.update(this.state.stateNumber,this.alt,this.semanticContext),e.finish()}equalsForConfigSet(e){return this===e||e instanceof m&&this.state.stateNumber===e.state.stateNumber&&this.alt===e.alt&&this.semanticContext.equals(e.semanticContext)}toString(){return"("+this.state+","+this.alt+(null!==this.context?",["+this.context.toString()+"]":"")+(this.semanticContext!==g.NONE?","+this.semanticContext.toString():"")+(this.reachesIntoOuterContext>0?",up="+this.reachesIntoOuterContext:"")+")"}}class E{constructor(e,t){this.start=e,this.stop=t}clone(){return new E(this.start,this.stop)}contains(e){return e>=this.start&&e<this.stop}toString(){return this.start===this.stop-1?this.start.toString():this.start.toString()+".."+(this.stop-1).toString()}get length(){return this.stop-this.start}}E.INVALID_INTERVAL=new E(-1,-2);class S{constructor(){this.intervals=null,this.readOnly=!1}first(e){return null===this.intervals||0===this.intervals.length?i.INVALID_TYPE:this.intervals[0].start}addOne(e){this.addInterval(new E(e,e+1))}addRange(e,t){this.addInterval(new E(e,t+1))}addInterval(e){if(null===this.intervals)this.intervals=[],this.intervals.push(e.clone());else{for(let t=0;t<this.intervals.length;t++){const r=this.intervals[t];if(e.stop<r.start)return void this.intervals.splice(t,0,e);if(e.stop===r.start)return void(this.intervals[t]=new E(e.start,r.stop));if(e.start<=r.stop)return this.intervals[t]=new E(Math.min(r.start,e.start),Math.max(r.stop,e.stop)),void this.reduce(t)}this.intervals.push(e.clone())}}addSet(e){return null!==e.intervals&&e.intervals.forEach(e=>this.addInterval(e),this),this}reduce(e){if(e<this.intervals.length-1){const t=this.intervals[e],r=this.intervals[e+1];t.stop>=r.stop?(this.intervals.splice(e+1,1),this.reduce(e)):t.stop>=r.start&&(this.intervals[e]=new E(t.start,r.stop),this.intervals.splice(e+1,1))}}complement(e,t){const r=new S;return r.addInterval(new E(e,t+1)),null!==this.intervals&&this.intervals.forEach(e=>r.removeRange(e)),r}contains(e){if(null===this.intervals)return!1;for(let t=0;t<this.intervals.length;t++)if(this.intervals[t].contains(e))return!0;return!1}removeRange(e){if(e.start===e.stop-1)this.removeOne(e.start);else if(null!==this.intervals){let t=0;for(let r=0;r<this.intervals.length;r++){const r=this.intervals[t];if(e.stop<=r.start)return;if(e.start>r.start&&e.stop<r.stop){this.intervals[t]=new E(r.start,e.start);const n=new E(e.stop,r.stop);return void this.intervals.splice(t,0,n)}e.start<=r.start&&e.stop>=r.stop?(this.intervals.splice(t,1),t-=1):e.start<r.stop?this.intervals[t]=new E(r.start,e.start):e.stop<r.stop&&(this.intervals[t]=new E(e.stop,r.stop)),t+=1}}}removeOne(e){if(null!==this.intervals)for(let t=0;t<this.intervals.length;t++){const r=this.intervals[t];if(e<r.start)return;if(e===r.start&&e===r.stop-1)return void this.intervals.splice(t,1);if(e===r.start)return void(this.intervals[t]=new E(r.start+1,r.stop));if(e===r.stop-1)return void(this.intervals[t]=new E(r.start,r.stop-1));if(e<r.stop-1){const n=new E(r.start,e);return r.start=e+1,void this.intervals.splice(t,0,n)}}}toString(e,t,r){return e=e||null,t=t||null,r=r||!1,null===this.intervals?"{}":null!==e||null!==t?this.toTokenString(e,t):r?this.toCharString():this.toIndexString()}toCharString(){const e=[];for(let t=0;t<this.intervals.length;t++){const r=this.intervals[t];r.stop===r.start+1?r.start===i.EOF?e.push("<EOF>"):e.push("'"+String.fromCharCode(r.start)+"'"):e.push("'"+String.fromCharCode(r.start)+"'..'"+String.fromCharCode(r.stop-1)+"'")}return e.length>1?"{"+e.join(", ")+"}":e[0]}toIndexString(){const e=[];for(let t=0;t<this.intervals.length;t++){const r=this.intervals[t];r.stop===r.start+1?r.start===i.EOF?e.push("<EOF>"):e.push(r.start.toString()):e.push(r.start.toString()+".."+(r.stop-1).toString())}return e.length>1?"{"+e.join(", ")+"}":e[0]}toTokenString(e,t){const r=[];for(let n=0;n<this.intervals.length;n++){const i=this.intervals[n];for(let n=i.start;n<i.stop;n++)r.push(this.elementName(e,t,n))}return r.length>1?"{"+r.join(", ")+"}":r[0]}elementName(e,t,r){return r===i.EOF?"<EOF>":r===i.EPSILON?"<EPSILON>":e[r]||t[r]}get length(){return this.intervals.map(e=>e.length).reduce((e,t)=>e+t)}}class C{constructor(){this.atn=null,this.stateNumber=C.INVALID_STATE_NUMBER,this.stateType=null,this.ruleIndex=0,this.epsilonOnlyTransitions=!1,this.transitions=[],this.nextTokenWithinRule=null}toString(){return this.stateNumber}equals(e){return e instanceof C&&this.stateNumber===e.stateNumber}isNonGreedyExitState(){return!1}addTransition(e,t){void 0===t&&(t=-1),0===this.transitions.length?this.epsilonOnlyTransitions=e.isEpsilon:this.epsilonOnlyTransitions!==e.isEpsilon&&(this.epsilonOnlyTransitions=!1),-1===t?this.transitions.push(e):this.transitions.splice(t,1,e)}}C.INVALID_TYPE=0,C.BASIC=1,C.RULE_START=2,C.BLOCK_START=3,C.PLUS_BLOCK_START=4,C.STAR_BLOCK_START=5,C.TOKEN_START=6,C.RULE_STOP=7,C.BLOCK_END=8,C.STAR_LOOP_BACK=9,C.STAR_LOOP_ENTRY=10,C.PLUS_LOOP_BACK=11,C.LOOP_END=12,C.serializationNames=["INVALID","BASIC","RULE_START","BLOCK_START","PLUS_BLOCK_START","STAR_BLOCK_START","TOKEN_START","RULE_STOP","BLOCK_END","STAR_LOOP_BACK","STAR_LOOP_ENTRY","PLUS_LOOP_BACK","LOOP_END"],C.INVALID_STATE_NUMBER=-1;class A extends C{constructor(){return super(),this.stateType=C.RULE_STOP,this}}class N{constructor(e){if(null==e)throw"target cannot be null.";this.target=e,this.isEpsilon=!1,this.label=null}}N.EPSILON=1,N.RANGE=2,N.RULE=3,N.PREDICATE=4,N.ATOM=5,N.ACTION=6,N.SET=7,N.NOT_SET=8,N.WILDCARD=9,N.PRECEDENCE=10,N.serializationNames=["INVALID","EPSILON","RANGE","RULE","PREDICATE","ATOM","ACTION","SET","NOT_SET","WILDCARD","PRECEDENCE"],N.serializationTypes={EpsilonTransition:N.EPSILON,RangeTransition:N.RANGE,RuleTransition:N.RULE,PredicateTransition:N.PREDICATE,AtomTransition:N.ATOM,ActionTransition:N.ACTION,SetTransition:N.SET,NotSetTransition:N.NOT_SET,WildcardTransition:N.WILDCARD,PrecedencePredicateTransition:N.PRECEDENCE};class y extends N{constructor(e,t,r,n){super(e),this.ruleIndex=t,this.precedence=r,this.followState=n,this.serializationType=N.RULE,this.isEpsilon=!0}matches(e,t,r){return!1}}class L extends N{constructor(e,t){super(e),this.serializationType=N.SET,null!=t?this.label=t:(this.label=new S,this.label.addOne(i.INVALID_TYPE))}matches(e,t,r){return this.label.contains(e)}toString(){return this.label.toString()}}class I extends L{constructor(e,t){super(e,t),this.serializationType=N.NOT_SET}matches(e,t,r){return e>=t&&e<=r&&!super.matches(e,t,r)}toString(){return"~"+super.toString()}}class k extends N{constructor(e){super(e),this.serializationType=N.WILDCARD}matches(e,t,r){return e>=t&&e<=r}toString(){return"."}}class v extends N{constructor(e){super(e)}}class w{}class R extends w{}class O extends R{}class P extends O{get ruleContext(){throw new Error("missing interface implementation")}}class b extends O{}class F extends b{}const D={toStringTree:function(e,t,r){t=t||null,null!==(r=r||null)&&(t=r.ruleNames);let n=D.getNodeText(e,t);n=function(e){return e.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r")}(n);const i=e.getChildCount();if(0===i)return n;let s="("+n+" ";i>0&&(n=D.toStringTree(e.getChild(0),t),s=s.concat(n));for(let r=1;r<i;r++)n=D.toStringTree(e.getChild(r),t),s=s.concat(" "+n);return s=s.concat(")"),s},getNodeText:function(e,t,r){if(t=t||null,null!==(r=r||null)&&(t=r.ruleNames),null!==t){if(e instanceof P){const r=e.ruleContext.getAltNumber();return 0!=r?t[e.ruleIndex]+":"+r:t[e.ruleIndex]}if(e instanceof F)return e.toString();if(e instanceof b&&null!==e.symbol)return e.symbol.text}const n=e.getPayload();return n instanceof i?n.text:e.getPayload().toString()},getChildren:function(e){const t=[];for(let r=0;r<e.getChildCount();r++)t.push(e.getChild(r));return t},getAncestors:function(e){let t=[];for(e=e.getParent();null!==e;)t=[e].concat(t),e=e.getParent();return t},findAllTokenNodes:function(e,t){return D.findAllNodes(e,t,!0)},findAllRuleNodes:function(e,t){return D.findAllNodes(e,t,!1)},findAllNodes:function(e,t,r){const n=[];return D._findAllNodes(e,t,r,n),n},_findAllNodes:function(e,t,r,n){r&&e instanceof b?e.symbol.type===t&&n.push(e):!r&&e instanceof P&&e.ruleIndex===t&&n.push(e);for(let i=0;i<e.getChildCount();i++)D._findAllNodes(e.getChild(i),t,r,n)},descendants:function(e){let t=[e];for(let r=0;r<e.getChildCount();r++)t=t.concat(D.descendants(e.getChild(r)));return t}},M=D;class U extends P{constructor(e,t){super(),this.parentCtx=e||null,this.invokingState=t||-1}depth(){let e=0,t=this;for(;null!==t;)t=t.parentCtx,e+=1;return e}isEmpty(){return-1===this.invokingState}getSourceInterval(){return E.INVALID_INTERVAL}get ruleContext(){return this}getPayload(){return this}getText(){return 0===this.getChildCount()?"":this.children.map(function(e){return e.getText()}).join("")}getAltNumber(){return 0}setAltNumber(e){}getChild(e){return null}getChildCount(){return 0}accept(e){return e.visitChildren(this)}toStringTree(e,t){return M.toStringTree(this,e,t)}toString(e,t){e=e||null,t=t||null;let r=this,n="[";for(;null!==r&&r!==t;){if(null===e)r.isEmpty()||(n+=r.invokingState);else{const t=r.ruleIndex;n+=t>=0&&t<e.length?e[t]:""+t}null===r.parentCtx||null===e&&r.parentCtx.isEmpty()||(n+=" "),r=r.parentCtx}return n+="]",n}}class H{constructor(e){this.cachedHashCode=e}isEmpty(){return this===H.EMPTY}hasEmptyPath(){return this.getReturnState(this.length-1)===H.EMPTY_RETURN_STATE}hashCode(){return this.cachedHashCode}updateHashCode(e){e.update(this.cachedHashCode)}}H.EMPTY=null,H.EMPTY_RETURN_STATE=2147483647,H.globalNodeCount=1,H.id=H.globalNodeCount,H.trace_atn_sim=!1;class B extends H{constructor(e,t){const r=new l;return r.update(e,t),super(r.finish()),this.parents=e,this.returnStates=t,this}isEmpty(){return this.returnStates[0]===H.EMPTY_RETURN_STATE}getParent(e){return this.parents[e]}getReturnState(e){return this.returnStates[e]}equals(e){return this===e||e instanceof B&&this.hashCode()===e.hashCode()&&r(this.returnStates,e.returnStates)&&r(this.parents,e.parents)}toString(){if(this.isEmpty())return"[]";{let e="[";for(let t=0;t<this.returnStates.length;t++)t>0&&(e+=", "),this.returnStates[t]!==H.EMPTY_RETURN_STATE?(e+=this.returnStates[t],null!==this.parents[t]?e=e+" "+this.parents[t]:e+="null"):e+="$";return e+"]"}}get length(){return this.returnStates.length}}class V extends H{constructor(e,t){let r=0;const n=new l;null!==e?n.update(e,t):n.update(1),r=n.finish(),super(r),this.parentCtx=e,this.returnState=t}getParent(e){return this.parentCtx}getReturnState(e){return this.returnState}equals(e){return this===e||e instanceof V&&this.hashCode()===e.hashCode()&&this.returnState===e.returnState&&(null==this.parentCtx?null==e.parentCtx:this.parentCtx.equals(e.parentCtx))}toString(){const e=null===this.parentCtx?"":this.parentCtx.toString();return 0===e.length?this.returnState===H.EMPTY_RETURN_STATE?"$":""+this.returnState:this.returnState+" "+e}get length(){return 1}static create(e,t){return t===H.EMPTY_RETURN_STATE&&null===e?H.EMPTY:new V(e,t)}}class z extends V{constructor(){super(null,H.EMPTY_RETURN_STATE)}isEmpty(){return!0}getParent(e){return null}getReturnState(e){return this.returnState}equals(e){return this===e}toString(){return"$"}}H.EMPTY=new z;class Y{constructor(e,t){this.buckets=new Array(16),this.threshold=Math.floor(12),this.itemCount=0,this.hashFunction=e||h,this.equalsFunction=t||c}set(e,t){this._expand();const r=this._getSlot(e);let n=this.buckets[r];if(!n)return n=[[e,t]],this.buckets[r]=n,this.itemCount++,t;const i=n.find(t=>this.equalsFunction(t[0],e),this);if(i){const e=i[1];return i[1]=t,e}return n.push([e,t]),this.itemCount++,t}containsKey(e){const t=this._getBucket(e);return!!t&&!!t.find(t=>this.equalsFunction(t[0],e),this)}get(e){const t=this._getBucket(e);if(!t)return null;const r=t.find(t=>this.equalsFunction(t[0],e),this);return r?r[1]:null}entries(){return this.buckets.filter(e=>null!=e).flat(1)}getKeys(){return this.entries().map(e=>e[0])}getValues(){return this.entries().map(e=>e[1])}toString(){return"["+this.entries().map(e=>"{"+e[0]+":"+e[1]+"}").join(", ")+"]"}get length(){return this.itemCount}_getSlot(e){return this.hashFunction(e)&this.buckets.length-1}_getBucket(e){return this.buckets[this._getSlot(e)]}_expand(){if(this.itemCount<=this.threshold)return;const e=this.buckets,t=2*this.buckets.length;this.buckets=new Array(t),this.threshold=Math.floor(.75*t);for(const t of e)if(t)for(const e of t){const t=this._getSlot(e[0]);let r=this.buckets[t];r||(r=[],this.buckets[t]=r),r.push(e)}}}function q(e,t){if(null==t&&(t=U.EMPTY),null===t.parentCtx||t===U.EMPTY)return H.EMPTY;const r=q(e,t.parentCtx),n=e.states[t.invokingState].transitions[0];return V.create(r,n.followState.stateNumber)}function K(e,t,r){if(e.isEmpty())return e;let n=r.get(e)||null;if(null!==n)return n;if(n=t.get(e),null!==n)return r.set(e,n),n;let i=!1,s=[];for(let n=0;n<s.length;n++){const a=K(e.getParent(n),t,r);if(i||a!==e.getParent(n)){if(!i){s=[];for(let t=0;t<e.length;t++)s[t]=e.getParent(t);i=!0}s[n]=a}}if(!i)return t.add(e),r.set(e,e),e;let a=null;return a=0===s.length?H.EMPTY:1===s.length?V.create(s[0],e.getReturnState(0)):new B(s,e.returnStates),t.add(a),r.set(a,a),r.set(e,a),a}function W(e,t,r,n){if(e===t)return e;if(e instanceof V&&t instanceof V)return function(e,t,r,n){if(null!==n){let r=n.get(e,t);if(null!==r)return r;if(r=n.get(t,e),null!==r)return r}const i=function(e,t,r){if(r){if(e===H.EMPTY)return H.EMPTY;if(t===H.EMPTY)return H.EMPTY}else{if(e===H.EMPTY&&t===H.EMPTY)return H.EMPTY;if(e===H.EMPTY){const e=[t.returnState,H.EMPTY_RETURN_STATE],r=[t.parentCtx,null];return new B(r,e)}if(t===H.EMPTY){const t=[e.returnState,H.EMPTY_RETURN_STATE],r=[e.parentCtx,null];return new B(r,t)}}return null}(e,t,r);if(null!==i)return null!==n&&n.set(e,t,i),i;if(e.returnState===t.returnState){const i=W(e.parentCtx,t.parentCtx,r,n);if(i===e.parentCtx)return e;if(i===t.parentCtx)return t;const s=V.create(i,e.returnState);return null!==n&&n.set(e,t,s),s}{let r=null;if((e===t||null!==e.parentCtx&&e.parentCtx===t.parentCtx)&&(r=e.parentCtx),null!==r){const i=[e.returnState,t.returnState];e.returnState>t.returnState&&(i[0]=t.returnState,i[1]=e.returnState);const s=new B([r,r],i);return null!==n&&n.set(e,t,s),s}const i=[e.returnState,t.returnState];let s=[e.parentCtx,t.parentCtx];e.returnState>t.returnState&&(i[0]=t.returnState,i[1]=e.returnState,s=[t.parentCtx,e.parentCtx]);const a=new B(s,i);return null!==n&&n.set(e,t,a),a}}(e,t,r,n);if(r){if(e instanceof z)return e;if(t instanceof z)return t}return e instanceof V&&(e=new B([e.getParent()],[e.returnState])),t instanceof V&&(t=new B([t.getParent()],[t.returnState])),function(e,t,r,n){if(null!==n){let r=n.get(e,t);if(null!==r)return H.trace_atn_sim&&console.log("mergeArrays a="+e+",b="+t+" -> previous"),r;if(r=n.get(t,e),null!==r)return H.trace_atn_sim&&console.log("mergeArrays a="+e+",b="+t+" -> previous"),r}let i=0,s=0,a=0,o=new Array(e.returnStates.length+t.returnStates.length).fill(0),l=new Array(e.returnStates.length+t.returnStates.length).fill(null);for(;i<e.returnStates.length&&s<t.returnStates.length;){const c=e.parents[i],u=t.parents[s];if(e.returnStates[i]===t.returnStates[s]){const t=e.returnStates[i];t===H.EMPTY_RETURN_STATE&&null===c&&null===u||null!==c&&null!==u&&c===u?(l[a]=c,o[a]=t):(l[a]=W(c,u,r,n),o[a]=t),i+=1,s+=1}else e.returnStates[i]<t.returnStates[s]?(l[a]=c,o[a]=e.returnStates[i],i+=1):(l[a]=u,o[a]=t.returnStates[s],s+=1);a+=1}if(i<e.returnStates.length)for(let t=i;t<e.returnStates.length;t++)l[a]=e.parents[t],o[a]=e.returnStates[t],a+=1;else for(let e=s;e<t.returnStates.length;e++)l[a]=t.parents[e],o[a]=t.returnStates[e],a+=1;if(a<l.length){if(1===a){const r=V.create(l[0],o[0]);return null!==n&&n.set(e,t,r),r}l=l.slice(0,a),o=o.slice(0,a)}const c=new B(l,o);return c.equals(e)?(null!==n&&n.set(e,t,e),H.trace_atn_sim&&console.log("mergeArrays a="+e+",b="+t+" -> a"),e):c.equals(t)?(null!==n&&n.set(e,t,t),H.trace_atn_sim&&console.log("mergeArrays a="+e+",b="+t+" -> b"),t):(function(e){const t=new Y;for(let r=0;r<e.length;r++){const n=e[r];t.containsKey(n)||t.set(n,n)}for(let r=0;r<e.length;r++)e[r]=t.get(e[r])}(l),null!==n&&n.set(e,t,c),H.trace_atn_sim&&console.log("mergeArrays a="+e+",b="+t+" -> "+c),c)}(e,t,r,n)}class G{constructor(){this.data=new Uint32Array(1)}set(e){G._checkIndex(e),this._resize(e),this.data[e>>>5]|=1<<e%32}get(e){G._checkIndex(e);const t=e>>>5;return!(t>=this.data.length||!(this.data[t]&1<<e%32))}clear(e){G._checkIndex(e);const t=e>>>5;t<this.data.length&&(this.data[t]&=~(1<<e))}or(e){const t=Math.min(this.data.length,e.data.length);for(let r=0;r<t;++r)this.data[r]|=e.data[r];if(this.data.length<e.data.length){this._resize((e.data.length<<5)-1);const r=e.data.length;for(let n=t;n<r;++n)this.data[n]=e.data[n]}}values(){const e=new Array(this.length);let t=0;const r=this.data.length;for(let n=0;n<r;++n){let r=this.data[n];for(;0!==r;){const i=r&-r;e[t++]=(n<<5)+G._bitCount(i-1),r^=i}}return e}minValue(){for(let e=0;e<this.data.length;++e){let t=this.data[e];if(0!==t){let r=0;for(;!(1&t);)r++,t>>=1;return r+32*e}}return 0}hashCode(){return l.hashStuff(this.values())}equals(e){return e instanceof G&&r(this.data,e.data)}toString(){return"{"+this.values().join(", ")+"}"}get length(){return this.data.map(e=>G._bitCount(e)).reduce((e,t)=>e+t,0)}_resize(e){const t=e+32>>>5;if(t<=this.data.length)return;const r=new Uint32Array(t);r.set(this.data),r.fill(0,this.data.length),this.data=r}static _checkIndex(e){if(e<0)throw new RangeError("index cannot be negative")}static _bitCount(e){return e=(e=(858993459&(e-=e>>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,e+=e>>8,0+(e+=e>>16)&63}}class ${constructor(e){this.atn=e}getDecisionLookahead(e){if(null===e)return null;const t=e.transitions.length,r=[];for(let n=0;n<t;n++){r[n]=new S;const t=new p,i=!1;this._LOOK(e.transition(n).target,null,H.EMPTY,r[n],t,new G,i,!1),(0===r[n].length||r[n].contains($.HIT_PRED))&&(r[n]=null)}return r}LOOK(e,t,r){const n=new S,i=null!==(r=r||null)?q(e.atn,r):null;return this._LOOK(e,t,i,n,new p,new G,!0,!0),n}_LOOK(e,t,r,n,s,a,o,l){const c=new m({state:e,alt:0,context:r},null);if(!s.has(c)){if(s.add(c),e===t){if(null===r)return void n.addOne(i.EPSILON);if(r.isEmpty()&&l)return void n.addOne(i.EOF)}if(e instanceof A){if(null===r)return void n.addOne(i.EPSILON);if(r.isEmpty()&&l)return void n.addOne(i.EOF);if(r!==H.EMPTY){const i=a.get(e.ruleIndex);try{a.clear(e.ruleIndex);for(let e=0;e<r.length;e++){const i=this.atn.states[r.getReturnState(e)];this._LOOK(i,t,r.getParent(e),n,s,a,o,l)}}finally{i&&a.set(e.ruleIndex)}return}}for(let c=0;c<e.transitions.length;c++){const u=e.transitions[c];if(u.constructor===y){if(a.get(u.target.ruleIndex))continue;const e=V.create(r,u.followState.stateNumber);try{a.set(u.target.ruleIndex),this._LOOK(u.target,t,e,n,s,a,o,l)}finally{a.clear(u.target.ruleIndex)}}else if(u instanceof v)o?this._LOOK(u.target,t,r,n,s,a,o,l):n.addOne($.HIT_PRED);else if(u.isEpsilon)this._LOOK(u.target,t,r,n,s,a,o,l);else if(u.constructor===k)n.addRange(i.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType);else{let e=u.label;null!==e&&(u instanceof I&&(e=e.complement(i.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType)),n.addSet(e))}}}}}$.HIT_PRED=i.INVALID_TYPE;class j{constructor(e,t){this.grammarType=e,this.maxTokenType=t,this.states=[],this.decisionToState=[],this.ruleToStartState=[],this.ruleToStopState=null,this.modeNameToStartState={},this.ruleToTokenType=null,this.lexerActions=null,this.modeToStartState=[]}nextTokensInContext(e,t){return new $(this).LOOK(e,null,t)}nextTokensNoContext(e){return null!==e.nextTokenWithinRule||(e.nextTokenWithinRule=this.nextTokensInContext(e,null),e.nextTokenWithinRule.readOnly=!0),e.nextTokenWithinRule}nextTokens(e,t){return void 0===t?this.nextTokensNoContext(e):this.nextTokensInContext(e,t)}addState(e){null!==e&&(e.atn=this,e.stateNumber=this.states.length),this.states.push(e)}removeState(e){this.states[e.stateNumber]=null}defineDecisionState(e){return this.decisionToState.push(e),e.decision=this.decisionToState.length-1,e.decision}getDecisionState(e){return 0===this.decisionToState.length?null:this.decisionToState[e]}getExpectedTokens(e,t){if(e<0||e>=this.states.length)throw"Invalid state number.";const r=this.states[e];let n=this.nextTokens(r);if(!n.contains(i.EPSILON))return n;const s=new S;for(s.addSet(n),s.removeOne(i.EPSILON);null!==t&&t.invokingState>=0&&n.contains(i.EPSILON);){const e=this.states[t.invokingState].transitions[0];n=this.nextTokens(e.followState),s.addSet(n),s.removeOne(i.EPSILON),t=t.parentCtx}return n.contains(i.EPSILON)&&s.addOne(i.EOF),s}}j.INVALID_ALT_NUMBER=0;class X extends C{constructor(){super(),this.stateType=C.BASIC}}class J extends C{constructor(){return super(),this.decision=-1,this.nonGreedy=!1,this}}class Q extends J{constructor(){return super(),this.endState=null,this}}class Z extends C{constructor(){return super(),this.stateType=C.BLOCK_END,this.startState=null,this}}class tt extends C{constructor(){return super(),this.stateType=C.LOOP_END,this.loopBackState=null,this}}class et extends C{constructor(){return super(),this.stateType=C.RULE_START,this.stopState=null,this.isPrecedenceRule=!1,this}}class st extends J{constructor(){return super(),this.stateType=C.TOKEN_START,this}}class nt extends J{constructor(){return super(),this.stateType=C.PLUS_LOOP_BACK,this}}class it extends C{constructor(){return super(),this.stateType=C.STAR_LOOP_BACK,this}}class rt extends J{constructor(){return super(),this.stateType=C.STAR_LOOP_ENTRY,this.loopBackState=null,this.isPrecedenceDecision=null,this}}class ot extends Q{constructor(){return super(),this.stateType=C.PLUS_BLOCK_START,this.loopBackState=null,this}}class at extends Q{constructor(){return super(),this.stateType=C.STAR_BLOCK_START,this}}class lt extends Q{constructor(){return super(),this.stateType=C.BLOCK_START,this}}class ht extends N{constructor(e,t){super(e),this.label_=t,this.label=this.makeLabel(),this.serializationType=N.ATOM}makeLabel(){const e=new S;return e.addOne(this.label_),e}matches(e,t,r){return this.label_===e}toString(){return this.label_}}class ct extends N{constructor(e,t,r){super(e),this.serializationType=N.RANGE,this.start=t,this.stop=r,this.label=this.makeLabel()}makeLabel(){const e=new S;return e.addRange(this.start,this.stop),e}matches(e,t,r){return e>=this.start&&e<=this.stop}toString(){return"'"+String.fromCharCode(this.start)+"'..'"+String.fromCharCode(this.stop)+"'"}}class ut extends N{constructor(e,t,r,n){super(e),this.serializationType=N.ACTION,this.ruleIndex=t,this.actionIndex=void 0===r?-1:r,this.isCtxDependent=void 0!==n&&n,this.isEpsilon=!0}matches(e,t,r){return!1}toString(){return"action_"+this.ruleIndex+":"+this.actionIndex}}class dt extends N{constructor(e,t){super(e),this.serializationType=N.EPSILON,this.isEpsilon=!0,this.outermostPrecedenceReturn=t}matches(e,t,r){return!1}toString(){return"epsilon"}}class pt extends g{constructor(e,t,r){super(),this.ruleIndex=void 0===e?-1:e,this.predIndex=void 0===t?-1:t,this.isCtxDependent=void 0!==r&&r}evaluate(e,t){const r=this.isCtxDependent?t:null;return e.sempred(r,this.ruleIndex,this.predIndex)}updateHashCode(e){e.update(this.ruleIndex,this.predIndex,this.isCtxDependent)}equals(e){return this===e||e instanceof pt&&this.ruleIndex===e.ruleIndex&&this.predIndex===e.predIndex&&this.isCtxDependent===e.isCtxDependent}toString(){return"{"+this.ruleIndex+":"+this.predIndex+"}?"}}g.NONE=new pt;class gt extends v{constructor(e,t,r,n){super(e),this.serializationType=N.PREDICATE,this.ruleIndex=t,this.predIndex=r,this.isCtxDependent=n,this.isEpsilon=!0}matches(e,t,r){return!1}getPredicate(){return new pt(this.ruleIndex,this.predIndex,this.isCtxDependent)}toString(){return"pred_"+this.ruleIndex+":"+this.predIndex}}class ft extends g{constructor(e){super(),this.precedence=void 0===e?0:e}evaluate(e,t){return e.precpred(t,this.precedence)}evalPrecedence(e,t){return e.precpred(t,this.precedence)?g.NONE:null}compareTo(e){return this.precedence-e.precedence}updateHashCode(e){e.update(this.precedence)}equals(e){return this===e||e instanceof ft&&this.precedence===e.precedence}toString(){return"{"+this.precedence+">=prec}?"}}g.PrecedencePredicate=ft;class xt extends v{constructor(e,t){super(e),this.serializationType=N.PRECEDENCE,this.precedence=t,this.isEpsilon=!0}matches(e,t,r){return!1}getPredicate(){return new ft(this.precedence)}toString(){return this.precedence+" >= _p"}}class _t{constructor(e){void 0===e&&(e=null),this.readOnly=!1,this.verifyATN=null===e||e.verifyATN,this.generateRuleBypassTransitions=null!==e&&e.generateRuleBypassTransitions}}_t.defaultOptions=new _t,_t.defaultOptions.readOnly=!0;class Tt{constructor(e){this.actionType=e,this.isPositionDependent=!1}hashCode(){const e=new l;return this.updateHashCode(e),e.finish()}updateHashCode(e){e.update(this.actionType)}equals(e){return this===e}}class mt extends Tt{constructor(){super(6)}execute(e){e.skip()}toString(){return"skip"}}mt.INSTANCE=new mt;class Et extends Tt{constructor(e){super(0),this.channel=e}execute(e){e._channel=this.channel}updateHashCode(e){e.update(this.actionType,this.channel)}equals(e){return this===e||e instanceof Et&&this.channel===e.channel}toString(){return"channel("+this.channel+")"}}class St extends Tt{constructor(e,t){super(1),this.ruleIndex=e,this.actionIndex=t,this.isPositionDependent=!0}execute(e){e.action(null,this.ruleIndex,this.actionIndex)}updateHashCode(e){e.update(this.actionType,this.ruleIndex,this.actionIndex)}equals(e){return this===e||e instanceof St&&this.ruleIndex===e.ruleIndex&&this.actionIndex===e.actionIndex}}class Ct extends Tt{constructor(){super(3)}execute(e){e.more()}toString(){return"more"}}Ct.INSTANCE=new Ct;class At extends Tt{constructor(e){super(7),this.type=e}execute(e){e.type=this.type}updateHashCode(e){e.update(this.actionType,this.type)}equals(e){return this===e||e instanceof At&&this.type===e.type}toString(){return"type("+this.type+")"}}class Nt extends Tt{constructor(e){super(5),this.mode=e}execute(e){e.pushMode(this.mode)}updateHashCode(e){e.update(this.actionType,this.mode)}equals(e){return this===e||e instanceof Nt&&this.mode===e.mode}toString(){return"pushMode("+this.mode+")"}}class yt extends Tt{constructor(){super(4)}execute(e){e.popMode()}toString(){return"popMode"}}yt.INSTANCE=new yt;class Lt extends Tt{constructor(e){super(2),this.mode=e}execute(e){e.setMode(this.mode)}updateHashCode(e){e.update(this.actionType,this.mode)}equals(e){return this===e||e instanceof Lt&&this.mode===e.mode}toString(){return"mode("+this.mode+")"}}function It(e,t){const r=[];return r[e-1]=t,r.map(function(e){return t})}class kt{constructor(e){null==e&&(e=_t.defaultOptions),this.deserializationOptions=e,this.stateFactories=null,this.actionFactories=null}deserialize(e){const t=this.reset(e);this.checkVersion(t),t&&this.skipUUID();const r=this.readATN();this.readStates(r,t),this.readRules(r,t),this.readModes(r);const n=[];return this.readSets(r,n,this.readInt.bind(this)),t&&this.readSets(r,n,this.readInt32.bind(this)),this.readEdges(r,n),this.readDecisions(r),this.readLexerActions(r,t),this.markPrecedenceDecisions(r),this.verifyATN(r),this.deserializationOptions.generateRuleBypassTransitions&&1===r.grammarType&&(this.generateRuleBypassTransitions(r),this.verifyATN(r)),r}reset(e){if(3===(e.charCodeAt?e.charCodeAt(0):e[0])){const t=function(e){const t=e.charCodeAt(0);return t>1?t-2:t+65534},r=e.split("").map(t);return r[0]=e.charCodeAt(0),this.data=r,this.pos=0,!0}return this.data=e,this.pos=0,!1}skipUUID(){let e=0;for(;e++<8;)this.readInt()}checkVersion(e){const t=this.readInt();if(!e&&4!==t)throw"Could not deserialize ATN with version "+t+" (expected 4)."}readATN(){const e=this.readInt(),t=this.readInt();return new j(e,t)}readStates(e,t){let r,n,i;const s=[],a=[],o=this.readInt();for(let r=0;r<o;r++){const r=this.readInt();if(r===C.INVALID_TYPE){e.addState(null);continue}let n=this.readInt();t&&65535===n&&(n=-1);const i=this.stateFactory(r,n);if(r===C.LOOP_END){const e=this.readInt();s.push([i,e])}else if(i instanceof Q){const e=this.readInt();a.push([i,e])}e.addState(i)}for(r=0;r<s.length;r++)n=s[r],n[0].loopBackState=e.states[n[1]];for(r=0;r<a.length;r++)n=a[r],n[0].endState=e.states[n[1]];let l=this.readInt();for(r=0;r<l;r++)i=this.readInt(),e.states[i].nonGreedy=!0;let c=this.readInt();for(r=0;r<c;r++)i=this.readInt(),e.states[i].isPrecedenceRule=!0}readRules(e,t){let r;const n=this.readInt();for(0===e.grammarType&&(e.ruleToTokenType=It(n,0)),e.ruleToStartState=It(n,0),r=0;r<n;r++){const n=this.readInt();if(e.ruleToStartState[r]=e.states[n],0===e.grammarType){let n=this.readInt();t&&65535===n&&(n=i.EOF),e.ruleToTokenType[r]=n}}for(e.ruleToStopState=It(n,0),r=0;r<e.states.length;r++){const t=e.states[r];t instanceof A&&(e.ruleToStopState[t.ruleIndex]=t,e.ruleToStartState[t.ruleIndex].stopState=t)}}readModes(e){const t=this.readInt();for(let r=0;r<t;r++){let t=this.readInt();e.modeToStartState.push(e.states[t])}}readSets(e,t,r){const n=this.readInt();for(let e=0;e<n;e++){const e=new S;t.push(e);const n=this.readInt();0!==this.readInt()&&e.addOne(-1);for(let t=0;t<n;t++){const t=r(),n=r();e.addRange(t,n)}}}readEdges(e,t){let r,n,i,s,a;const o=this.readInt();for(r=0;r<o;r++){const r=this.readInt(),n=this.readInt(),i=this.readInt(),a=this.readInt(),o=this.readInt(),l=this.readInt();s=this.edgeFactory(e,i,r,n,a,o,l,t),e.states[r].addTransition(s)}for(r=0;r<e.states.length;r++)for(i=e.states[r],n=0;n<i.transitions.length;n++){const t=i.transitions[n];if(!(t instanceof y))continue;let r=-1;e.ruleToStartState[t.target.ruleIndex].isPrecedenceRule&&0===t.precedence&&(r=t.target.ruleIndex),s=new dt(t.followState,r),e.ruleToStopState[t.target.ruleIndex].addTransition(s)}for(r=0;r<e.states.length;r++){if(i=e.states[r],i instanceof Q){if(null===i.endState)throw"IllegalState";if(null!==i.endState.startState)throw"IllegalState";i.endState.startState=i}if(i instanceof nt)for(n=0;n<i.transitions.length;n++)a=i.transitions[n].target,a instanceof ot&&(a.loopBackState=i);else if(i instanceof it)for(n=0;n<i.transitions.length;n++)a=i.transitions[n].target,a instanceof rt&&(a.loopBackState=i)}}readDecisions(e){const t=this.readInt();for(let r=0;r<t;r++){const t=this.readInt(),n=e.states[t];e.decisionToState.push(n),n.decision=r}}readLexerActions(e,t){if(0===e.grammarType){const r=this.readInt();e.lexerActions=It(r,null);for(let n=0;n<r;n++){const r=this.readInt();let i=this.readInt();t&&65535===i&&(i=-1);let s=this.readInt();t&&65535===s&&(s=-1),e.lexerActions[n]=this.lexerActionFactory(r,i,s)}}}generateRuleBypassTransitions(e){let t;const r=e.ruleToStartState.length;for(t=0;t<r;t++)e.ruleToTokenType[t]=e.maxTokenType+t+1;for(t=0;t<r;t++)this.generateRuleBypassTransition(e,t)}generateRuleBypassTransition(e,t){let r,n;const i=new lt;i.ruleIndex=t,e.addState(i);const s=new Z;s.ruleIndex=t,e.addState(s),i.endState=s,e.defineDecisionState(i),s.startState=i;let a=null,o=null;if(e.ruleToStartState[t].isPrecedenceRule){for(o=null,r=0;r<e.states.length;r++)if(n=e.states[r],this.stateIsEndStateFor(n,t)){o=n,a=n.loopBackState.transitions[0];break}if(null===a)throw"Couldn't identify final state of the precedence rule prefix section."}else o=e.ruleToStopState[t];for(r=0;r<e.states.length;r++){n=e.states[r];for(let e=0;e<n.transitions.length;e++){const t=n.transitions[e];t!==a&&t.target===o&&(t.target=s)}}const l=e.ruleToStartState[t],c=l.transitions.length;for(;c>0;)i.addTransition(l.transitions[c-1]),l.transitions=l.transitions.slice(-1);e.ruleToStartState[t].addTransition(new dt(i)),s.addTransition(new dt(o));const u=new X;e.addState(u),u.addTransition(new ht(s,e.ruleToTokenType[t])),i.addTransition(new dt(u))}stateIsEndStateFor(e,t){if(e.ruleIndex!==t)return null;if(!(e instanceof rt))return null;const r=e.transitions[e.transitions.length-1].target;return r instanceof tt&&r.epsilonOnlyTransitions&&r.transitions[0].target instanceof A?e:null}markPrecedenceDecisions(e){for(let t=0;t<e.states.length;t++){const r=e.states[t];if(r instanceof rt&&e.ruleToStartState[r.ruleIndex].isPrecedenceRule){const e=r.transitions[r.transitions.length-1].target;e instanceof tt&&e.epsilonOnlyTransitions&&e.transitions[0].target instanceof A&&(r.isPrecedenceDecision=!0)}}}verifyATN(e){if(this.deserializationOptions.verifyATN)for(let t=0;t<e.states.length;t++){const r=e.states[t];if(null!==r)if(this.checkCondition(r.epsilonOnlyTransitions||r.transitions.length<=1),r instanceof ot)this.checkCondition(null!==r.loopBackState);else if(r instanceof rt)if(this.checkCondition(null!==r.loopBackState),this.checkCondition(2===r.transitions.length),r.transitions[0].target instanceof at)this.checkCondition(r.transitions[1].target instanceof tt),this.checkCondition(!r.nonGreedy);else{if(!(r.transitions[0].target instanceof tt))throw"IllegalState";this.checkCondition(r.transitions[1].target instanceof at),this.checkCondition(r.nonGreedy)}else r instanceof it?(this.checkCondition(1===r.transitions.length),this.checkCondition(r.transitions[0].target instanceof rt)):r instanceof tt?this.checkCondition(null!==r.loopBackState):r instanceof et?this.checkCondition(null!==r.stopState):r instanceof Q?this.checkCondition(null!==r.endState):r instanceof Z?this.checkCondition(null!==r.startState):r instanceof J?this.checkCondition(r.transitions.length<=1||r.decision>=0):this.checkCondition(r.transitions.length<=1||r instanceof A)}}checkCondition(e,t){if(!e)throw null==t&&(t="IllegalState"),t}readInt(){return this.data[this.pos++]}readInt32(){return this.readInt()|this.readInt()<<16}edgeFactory(e,t,r,n,s,a,o,l){const c=e.states[n];switch(t){case N.EPSILON:return new dt(c);case N.RANGE:return new ct(c,0!==o?i.EOF:s,a);case N.RULE:return new y(e.states[s],a,o,c);case N.PREDICATE:return new gt(c,s,a,0!==o);case N.PRECEDENCE:return new xt(c,s);case N.ATOM:return new ht(c,0!==o?i.EOF:s);case N.ACTION:return new ut(c,s,a,0!==o);case N.SET:return new L(c,l[s]);case N.NOT_SET:return new I(c,l[s]);case N.WILDCARD:return new k(c);default:throw"The specified transition type: "+t+" is not valid."}}stateFactory(e,t){if(null===this.stateFactories){const e=[];e[C.INVALID_TYPE]=null,e[C.BASIC]=()=>new X,e[C.RULE_START]=()=>new et,e[C.BLOCK_START]=()=>new lt,e[C.PLUS_BLOCK_START]=()=>new ot,e[C.STAR_BLOCK_START]=()=>new at,e[C.TOKEN_START]=()=>new st,e[C.RULE_STOP]=()=>new A,e[C.BLOCK_END]=()=>new Z,e[C.STAR_LOOP_BACK]=()=>new it,e[C.STAR_LOOP_ENTRY]=()=>new rt,e[C.PLUS_LOOP_BACK]=()=>new nt,e[C.LOOP_END]=()=>new tt,this.stateFactories=e}if(e>this.stateFactories.length||null===this.stateFactories[e])throw"The specified state type "+e+" is not valid.";{const r=this.stateFactories[e]();if(null!==r)return r.ruleIndex=t,r}}lexerActionFactory(e,t,r){if(null===this.actionFactories){const e=[];e[0]=(e,t)=>new Et(e),e[1]=(e,t)=>new St(e,t),e[2]=(e,t)=>new Lt(e),e[3]=(e,t)=>Ct.INSTANCE,e[4]=(e,t)=>yt.INSTANCE,e[5]=(e,t)=>new Nt(e),e[6]=(e,t)=>mt.INSTANCE,e[7]=(e,t)=>new At(e),this.actionFactories=e}if(e>this.actionFactories.length||null===this.actionFactories[e])throw"The specified lexer action type "+e+" is not valid.";return this.actionFactories[e](t,r)}}class vt{syntaxError(e,t,r,n,i,s){}reportAmbiguity(e,t,r,n,i,s,a){}reportAttemptingFullContext(e,t,r,n,i,s){}reportContextSensitivity(e,t,r,n,i,s){}}class wt extends vt{constructor(){super()}syntaxError(e,t,r,n,i,s){console.error("line "+r+":"+n+" "+i)}}wt.INSTANCE=new wt;class Rt extends vt{constructor(e){if(super(),null===e)throw"delegates";return this.delegates=e,this}syntaxError(e,t,r,n,i,s){this.delegates.map(a=>a.syntaxError(e,t,r,n,i,s))}reportAmbiguity(e,t,r,n,i,s,a){this.delegates.map(o=>o.reportAmbiguity(e,t,r,n,i,s,a))}reportAttemptingFullContext(e,t,r,n,i,s){this.delegates.map(a=>a.reportAttemptingFullContext(e,t,r,n,i,s))}reportContextSensitivity(e,t,r,n,i,s){this.delegates.map(a=>a.reportContextSensitivity(e,t,r,n,i,s))}}class Ot{constructor(){this._listeners=[wt.INSTANCE],this._interp=null,this._stateNumber=-1}checkVersion(e){const t="4.13.2";t!==e&&console.log("ANTLR runtime and generated code versions disagree: "+t+"!="+e)}addErrorListener(e){this._listeners.push(e)}removeErrorListeners(){this._listeners=[]}getLiteralNames(){return Object.getPrototypeOf(this).constructor.literalNames||[]}getSymbolicNames(){return Object.getPrototypeOf(this).constructor.symbolicNames||[]}getTokenNames(){if(!this.tokenNames){const e=this.getLiteralNames(),t=this.getSymbolicNames(),r=e.length>t.length?e.length:t.length;this.tokenNames=[];for(let n=0;n<r;n++)this.tokenNames[n]=e[n]||t[n]||"<INVALID"}return this.tokenNames}getTokenTypeMap(){const e=this.getTokenNames();if(null===e)throw"The current recognizer does not provide a list of token names.";let t=this.tokenTypeMapCache[e];return void 0===t&&(t=e.reduce(function(e,t,r){e[t]=r}),t.EOF=i.EOF,this.tokenTypeMapCache[e]=t),t}getRuleIndexMap(){const e=this.ruleNames;if(null===e)throw"The current recognizer does not provide a list of rule names.";let t=this.ruleIndexMapCache[e];return void 0===t&&(t=e.reduce(function(e,t,r){e[t]=r}),this.ruleIndexMapCache[e]=t),t}getTokenType(e){const t=this.getTokenTypeMap()[e];return void 0!==t?t:i.INVALID_TYPE}getErrorHeader(e){return"line "+e.getOffendingToken().line+":"+e.getOffendingToken().column}getTokenErrorDisplay(e){if(null===e)return"<no token>";let t=e.text;return null===t&&(t=e.type===i.EOF?"<EOF>":"<"+e.type+">"),t=t.replace("\n","\\n").replace("\r","\\r").replace("\t","\\t"),"'"+t+"'"}getErrorListenerDispatch(){return console.warn("Calling deprecated method in Recognizer class: getErrorListenerDispatch()"),this.getErrorListener()}getErrorListener(){return new Rt(this._listeners)}sempred(e,t,r){return!0}precpred(e,t){return!0}get atn(){return this._interp.atn}get state(){return this._stateNumber}set state(e){this._stateNumber=e}}Ot.tokenTypeMapCache={},Ot.ruleIndexMapCache={};class Pt extends i{constructor(e,t,r,n,s){super(),this.source=void 0!==e?e:Pt.EMPTY_SOURCE,this.type=void 0!==t?t:null,this.channel=void 0!==r?r:i.DEFAULT_CHANNEL,this.start=void 0!==n?n:-1,this.stop=void 0!==s?s:-1,this.tokenIndex=-1,null!==this.source[0]?(this.line=e[0].line,this.column=e[0].column):this.column=-1}clone(){const e=new Pt(this.source,this.type,this.channel,this.start,this.stop);return e.tokenIndex=this.tokenIndex,e.line=this.line,e.column=this.column,e.text=this.text,e}cloneWithType(e){const t=new Pt(this.source,e,this.channel,this.start,this.stop);return t.tokenIndex=this.tokenIndex,t.line=this.line,t.column=this.column,e===i.EOF&&(t.text=""),t}toString(){let e=this.text;return e=null!==e?e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"):"<no text>","[@"+this.tokenIndex+","+this.start+":"+this.stop+"='"+e+"',<"+this.type+">"+(this.channel>0?",channel="+this.channel:"")+","+this.line+":"+this.column+"]"}get text(){if(null!==this._text)return this._text;const e=this.getInputStream();if(null===e)return null;const t=e.size;return this.start<t&&this.stop<t?e.getText(this.start,this.stop):"<EOF>"}set text(e){this._text=e}}Pt.EMPTY_SOURCE=[null,null];class bt{}class Ft extends bt{constructor(e){super(),this.copyText=void 0!==e&&e}create(e,t,r,n,i,s,a,o){const l=new Pt(e,t,n,i,s);return l.line=a,l.column=o,null!==r?l.text=r:this.copyText&&null!==e[1]&&(l.text=e[1].getText(i,s)),l}createThin(e,t){const r=new Pt(null,e);return r.text=t,r}}Ft.DEFAULT=new Ft;class Dt extends Error{constructor(e){super(e.message),Error.captureStackTrace&&Error.captureStackTrace(this,Dt),this.message=e.message,this.recognizer=e.recognizer,this.input=e.input,this.ctx=e.ctx,this.offendingToken=null,this.offendingState=-1,null!==this.recognizer&&(this.offendingState=this.recognizer.state)}getExpectedTokens(){return null!==this.recognizer?this.recognizer.atn.getExpectedTokens(this.offendingState,this.ctx):null}toString(){return this.message}}class Mt extends Dt{constructor(e,t,r,n){super({message:"",recognizer:e,input:t,ctx:null}),this.startIndex=r,this.deadEndConfigs=n}toString(){let e="";return this.startIndex>=0&&this.startIndex<this.input.size&&(e=this.input.getText(new E(this.startIndex,this.startIndex))),"LexerNoViableAltException"+e}}class Ut extends Ot{constructor(e){super(),this._input=e,this._factory=Ft.DEFAULT,this._tokenFactorySourcePair=[this,e],this._interp=null,this._token=null,this._tokenStartCharIndex=-1,this._tokenStartLine=-1,this._tokenStartColumn=-1,this._hitEOF=!1,this._channel=i.DEFAULT_CHANNEL,this._type=i.INVALID_TYPE,this._modeStack=[],this._mode=Ut.DEFAULT_MODE,this._text=null}reset(){null!==this._input&&this._input.seek(0),this._token=null,this._type=i.INVALID_TYPE,this._channel=i.DEFAULT_CHANNEL,this._tokenStartCharIndex=-1,this._tokenStartColumn=-1,this._tokenStartLine=-1,this._text=null,this._hitEOF=!1,this._mode=Ut.DEFAULT_MODE,this._modeStack=[],this._interp.reset()}nextToken(){if(null===this._input)throw"nextToken requires a non-null input stream.";const e=this._input.mark();try{for(;;){if(this._hitEOF)return this.emitEOF(),this._token;this._token=null,this._channel=i.DEFAULT_CHANNEL,this._tokenStartCharIndex=this._input.index,this._tokenStartColumn=this._interp.column,this._tokenStartLine=this._interp.line,this._text=null;let t=!1;for(;;){this._type=i.INVALID_TYPE;let r=Ut.SKIP;try{r=this._interp.match(this._input,this._mode)}catch(e){if(!(e instanceof Dt))throw console.log(e.stack),e;this.notifyListeners(e),this.recover(e)}if(this._input.LA(1)===i.EOF&&(this._hitEOF=!0),this._type===i.INVALID_TYPE&&(this._type=r),this._type===Ut.SKIP){t=!0;break}if(this._type!==Ut.MORE)break}if(!t)return null===this._token&&this.emit(),this._token}}finally{this._input.release(e)}}skip(){this._type=Ut.SKIP}more(){this._type=Ut.MORE}mode(e){console.warn("Calling deprecated method in Lexer class: mode(...)"),this.setMode(e)}setMode(e){this._mode=e}getMode(){return this._mode}getModeStack(){return this._modeStack}pushMode(e){this._interp.debug&&console.log("pushMode "+e),this._modeStack.push(this._mode),this.setMode(e)}popMode(){if(0===this._modeStack.length)throw"Empty Stack";return this._interp.debug&&console.log("popMode back to "+this._modeStack.slice(0,-1)),this.setMode(this._modeStack.pop()),this._mode}emitToken(e){this._token=e}emit(){const e=this._factory.create(this._tokenFactorySourcePair,this._type,this._text,this._channel,this._tokenStartCharIndex,this.getCharIndex()-1,this._tokenStartLine,this._tokenStartColumn);return this.emitToken(e),e}emitEOF(){const e=this.column,t=this.line,r=this._factory.create(this._tokenFactorySourcePair,i.EOF,null,i.DEFAULT_CHANNEL,this._input.index,this._input.index-1,t,e);return this.emitToken(r),r}getCharIndex(){return this._input.index}getAllTokens(){const e=[];let t=this.nextToken();for(;t.type!==i.EOF;)e.push(t),t=this.nextToken();return e}notifyListeners(e){const t=this._tokenStartCharIndex,r=this._input.index,n=this._input.getText(t,r),i="token recognition error at: '"+this.getErrorDisplay(n)+"'";this.getErrorListener().syntaxError(this,null,this._tokenStartLine,this._tokenStartColumn,i,e)}getErrorDisplay(e){const t=[];for(let r=0;r<e.length;r++)t.push(e[r]);return t.join("")}getErrorDisplayForChar(e){return e.charCodeAt(0)===i.EOF?"<EOF>":"\n"===e?"\\n":"\t"===e?"\\t":"\r"===e?"\\r":e}getCharErrorDisplay(e){return"'"+this.getErrorDisplayForChar(e)+"'"}recover(e){this._input.LA(1)!==i.EOF&&(e instanceof Mt?this._interp.consume(this._input):this._input.consume())}get inputStream(){return this._input}set inputStream(e){this._input=null,this._tokenFactorySourcePair=[this,this._input],this.reset(),this._input=e,this._tokenFactorySourcePair=[this,this._input]}get sourceName(){return this._input.sourceName}get type(){return this._type}set type(e){this._type=e}get line(){return this._interp.line}set line(e){this._interp.line=e}get column(){return this._interp.column}set column(e){this._interp.column=e}get text(){return null!==this._text?this._text:this._interp.getText(this._input)}set text(e){this._text=e}}function Ht(e){return e.hashCodeForConfigSet()}function Bt(e,t){return e===t||null!==e&&null!==t&&e.equalsForConfigSet(t)}Ut.DEFAULT_MODE=0,Ut.MORE=-2,Ut.SKIP=-3,Ut.DEFAULT_TOKEN_CHANNEL=i.DEFAULT_CHANNEL,Ut.HIDDEN=i.HIDDEN_CHANNEL,Ut.MIN_CHAR_VALUE=0,Ut.MAX_CHAR_VALUE=1114111;class Vt{constructor(e){this.configLookup=new p(Ht,Bt),this.fullCtx=void 0===e||e,this.readOnly=!1,this.configs=[],this.uniqueAlt=0,this.conflictingAlts=null,this.hasSemanticContext=!1,this.dipsIntoOuterContext=!1,this.cachedHashCode=-1}add(e,t){if(void 0===t&&(t=null),this.readOnly)throw"This set is readonly";e.semanticContext!==g.NONE&&(this.hasSemanticContext=!0),e.reachesIntoOuterContext>0&&(this.dipsIntoOuterContext=!0);const r=this.configLookup.getOrAdd(e);if(r===e)return this.cachedHashCode=-1,this.configs.push(e),!0;const n=!this.fullCtx,i=W(r.context,e.context,n,t);return r.reachesIntoOuterContext=Math.max(r.reachesIntoOuterContext,e.reachesIntoOuterContext),e.precedenceFilterSuppressed&&(r.precedenceFilterSuppressed=!0),r.context=i,!0}getStates(){const e=new p;for(let t=0;t<this.configs.length;t++)e.add(this.configs[t].state);return e}getPredicates(){const e=[];for(let t=0;t<this.configs.length;t++){const r=this.configs[t].semanticContext;r!==g.NONE&&e.push(r.semanticContext)}return e}optimizeConfigs(e){if(this.readOnly)throw"This set is readonly";if(0!==this.configLookup.length)for(let t=0;t<this.configs.length;t++){const r=this.configs[t];r.context=e.getCachedContext(r.context)}}addAll(e){for(let t=0;t<e.length;t++)this.add(e[t]);return!1}equals(e){return this===e||e instanceof Vt&&r(this.configs,e.configs)&&this.fullCtx===e.fullCtx&&this.uniqueAlt===e.uniqueAlt&&this.conflictingAlts===e.conflictingAlts&&this.hasSemanticContext===e.hasSemanticContext&&this.dipsIntoOuterContext===e.dipsIntoOuterContext}hashCode(){const e=new l;return e.update(this.configs),e.finish()}updateHashCode(e){this.readOnly?(-1===this.cachedHashCode&&(this.cachedHashCode=this.hashCode()),e.update(this.cachedHashCode)):e.update(this.hashCode())}isEmpty(){return 0===this.configs.length}contains(e){if(null===this.configLookup)throw"This method is not implemented for readonly sets.";return this.configLookup.contains(e)}containsFast(e){if(null===this.configLookup)throw"This method is not implemented for readonly sets.";return this.configLookup.containsFast(e)}clear(){if(this.readOnly)throw"This set is readonly";this.configs=[],this.cachedHashCode=-1,this.configLookup=new p}setReadonly(e){this.readOnly=e,e&&(this.configLookup=null)}toString(){return d(this.configs)+(this.hasSemanticContext?",hasSemanticContext="+this.hasSemanticContext:"")+(this.uniqueAlt!==j.INVALID_ALT_NUMBER?",uniqueAlt="+this.uniqueAlt:"")+(null!==this.conflictingAlts?",conflictingAlts="+this.conflictingAlts:"")+(this.dipsIntoOuterContext?",dipsIntoOuterContext":"")}get items(){return this.configs}get length(){return this.configs.length}}class zt{constructor(e,t){return null===e&&(e=-1),null===t&&(t=new Vt),this.stateNumber=e,this.configs=t,this.edges=null,this.isAcceptState=!1,this.prediction=0,this.lexerActionExecutor=null,this.requiresFullContext=!1,this.predicates=null,this}getAltSet(){const e=new p;if(null!==this.configs)for(let t=0;t<this.configs.length;t++){const r=this.configs[t];e.add(r.alt)}return 0===e.length?null:e}equals(e){return this===e||e instanceof zt&&this.configs.equals(e.configs)}toString(){let e=this.stateNumber+":"+this.configs;return this.isAcceptState&&(e+="=>",null!==this.predicates?e+=this.predicates:e+=this.prediction),e}hashCode(){const e=new l;return e.update(this.configs),e.finish()}}class Yt{constructor(e,t){return this.atn=e,this.sharedContextCache=t,this}getCachedContext(e){if(null===this.sharedContextCache)return e;const t=new Y;return K(e,this.sharedContextCache,t)}}Yt.ERROR=new zt(2147483647,new Vt);class qt extends Vt{constructor(){super(),this.configLookup=new p}}class Kt extends m{constructor(e,t){super(e,t);const r=e.lexerActionExecutor||null;return this.lexerActionExecutor=r||(null!==t?t.lexerActionExecutor:null),this.passedThroughNonGreedyDecision=null!==t&&this.checkNonGreedyDecision(t,this.state),this.hashCodeForConfigSet=Kt.prototype.hashCode,this.equalsForConfigSet=Kt.prototype.equals,this}updateHashCode(e){e.update(this.state.stateNumber,this.alt,this.context,this.semanticContext,this.passedThroughNonGreedyDecision,this.lexerActionExecutor)}equals(e){return this===e||e instanceof Kt&&this.passedThroughNonGreedyDecision===e.passedThroughNonGreedyDecision&&(this.lexerActionExecutor?this.lexerActionExecutor.equals(e.lexerActionExecutor):!e.lexerActionExecutor)&&super.equals(e)}checkNonGreedyDecision(e,t){return e.passedThroughNonGreedyDecision||t instanceof J&&t.nonGreedy}}class Wt extends Tt{constructor(e,t){super(t.actionType),this.offset=e,this.action=t,this.isPositionDependent=!0}execute(e){this.action.execute(e)}updateHashCode(e){e.update(this.actionType,this.offset,this.action)}equals(e){return this===e||e instanceof Wt&&this.offset===e.offset&&this.action===e.action}}class Gt{constructor(e){return this.lexerActions=null===e?[]:e,this.cachedHashCode=l.hashStuff(e),this}fixOffsetBeforeMatch(e){let t=null;for(let r=0;r<this.lexerActions.length;r++)!this.lexerActions[r].isPositionDependent||this.lexerActions[r]instanceof Wt||(null===t&&(t=this.lexerActions.concat([])),t[r]=new Wt(e,this.lexerActions[r]));return null===t?this:new Gt(t)}execute(e,t,r){let n=!1;const i=t.index;try{for(let s=0;s<this.lexerActions.length;s++){let a=this.lexerActions[s];if(a instanceof Wt){const e=a.offset;t.seek(r+e),a=a.action,n=r+e!==i}else a.isPositionDependent&&(t.seek(i),n=!1);a.execute(e)}}finally{n&&t.seek(i)}}hashCode(){return this.cachedHashCode}updateHashCode(e){e.update(this.cachedHashCode)}equals(e){if(this===e)return!0;if(e instanceof Gt){if(this.cachedHashCode!=e.cachedHashCode)return!1;if(this.lexerActions.length!=e.lexerActions.length)return!1;{const t=this.lexerActions.length;for(let r=0;r<t;++r)if(!this.lexerActions[r].equals(e.lexerActions[r]))return!1;return!0}}return!1}static append(e,t){if(null===e)return new Gt([t]);const r=e.lexerActions.concat([t]);return new Gt(r)}}function $t(e){e.index=-1,e.line=0,e.column=-1,e.dfaState=null}class jt{constructor(){$t(this)}reset(){$t(this)}}class Xt extends Yt{constructor(e,t,r,n){super(t,n),this.decisionToDFA=r,this.recog=e,this.startIndex=-1,this.line=1,this.column=0,this.mode=Ut.DEFAULT_MODE,this.prevAccept=new jt}copyState(e){this.column=e.column,this.line=e.line,this.mode=e.mode,this.startIndex=e.startIndex}match(e,t){this.mode=t;const r=e.mark();try{this.startIndex=e.index,this.prevAccept.reset();const r=this.decisionToDFA[t];return null===r.s0?this.matchATN(e):this.execATN(e,r.s0)}finally{e.release(r)}}reset(){this.prevAccept.reset(),this.startIndex=-1,this.line=1,this.column=0,this.mode=Ut.DEFAULT_MODE}matchATN(e){const t=this.atn.modeToStartState[this.mode];Xt.debug&&console.log("matchATN mode "+this.mode+" start: "+t);const r=this.mode,n=this.computeStartState(e,t),i=n.hasSemanticContext;n.hasSemanticContext=!1;const s=this.addDFAState(n);i||(this.decisionToDFA[this.mode].s0=s);const a=this.execATN(e,s);return Xt.debug&&console.log("DFA after matchATN: "+this.decisionToDFA[r].toLexerString()),a}execATN(e,t){Xt.debug&&console.log("start state closure="+t.configs),t.isAcceptState&&this.captureSimState(this.prevAccept,e,t);let r=e.LA(1),n=t;for(;;){Xt.debug&&console.log("execATN loop starting closure: "+n.configs);let t=this.getExistingTargetState(n,r);if(null===t&&(t=this.computeTargetState(e,n,r)),t===Yt.ERROR)break;if(r!==i.EOF&&this.consume(e),t.isAcceptState&&(this.captureSimState(this.prevAccept,e,t),r===i.EOF))break;r=e.LA(1),n=t}return this.failOrAccept(this.prevAccept,e,n.configs,r)}getExistingTargetState(e,t){if(null===e.edges||t<Xt.MIN_DFA_EDGE||t>Xt.MAX_DFA_EDGE)return null;let r=e.edges[t-Xt.MIN_DFA_EDGE];return void 0===r&&(r=null),Xt.debug&&null!==r&&console.log("reuse state "+e.stateNumber+" edge to "+r.stateNumber),r}computeTargetState(e,t,r){const n=new qt;return this.getReachableConfigSet(e,t.configs,n,r),0===n.items.length?(n.hasSemanticContext||this.addDFAEdge(t,r,Yt.ERROR),Yt.ERROR):this.addDFAEdge(t,r,null,n)}failOrAccept(e,t,r,n){if(null!==this.prevAccept.dfaState){const r=e.dfaState.lexerActionExecutor;return this.accept(t,r,this.startIndex,e.index,e.line,e.column),e.dfaState.prediction}if(n===i.EOF&&t.index===this.startIndex)return i.EOF;throw new Mt(this.recog,t,this.startIndex,r)}getReachableConfigSet(e,t,r,n){let s=j.INVALID_ALT_NUMBER;for(let a=0;a<t.items.length;a++){const o=t.items[a],l=o.alt===s;if(!l||!o.passedThroughNonGreedyDecision){Xt.debug&&console.log("testing %s at %s\n",this.getTokenName(n),o.toString(this.recog,!0));for(let t=0;t<o.state.transitions.length;t++){const a=o.state.transitions[t],c=this.getReachableTarget(a,n);if(null!==c){let t=o.lexerActionExecutor;null!==t&&(t=t.fixOffsetBeforeMatch(e.index-this.startIndex));const a=n===i.EOF,u=new Kt({state:c,lexerActionExecutor:t},o);this.closure(e,u,r,l,!0,a)&&(s=o.alt)}}}}}accept(e,t,r,n,i,s){Xt.debug&&console.log("ACTION %s\n",t),e.seek(n),this.line=i,this.column=s,null!==t&&null!==this.recog&&t.execute(this.recog,e,r)}getReachableTarget(e,t){return e.matches(t,0,Ut.MAX_CHAR_VALUE)?e.target:null}computeStartState(e,t){const r=H.EMPTY,n=new qt;for(let i=0;i<t.transitions.length;i++){const s=t.transitions[i].target,a=new Kt({state:s,alt:i+1,context:r},null);this.closure(e,a,n,!1,!1,!1)}return n}closure(e,t,r,n,i,s){let a=null;if(Xt.debug&&console.log("closure("+t.toString(this.recog,!0)+")"),t.state instanceof A){if(Xt.debug&&(null!==this.recog?console.log("closure at %s rule stop %s\n",this.recog.ruleNames[t.state.ruleIndex],t):console.log("closure at rule stop %s\n",t)),null===t.context||t.context.hasEmptyPath()){if(null===t.context||t.context.isEmpty())return r.add(t),!0;r.add(new Kt({state:t.state,context:H.EMPTY},t)),n=!0}if(null!==t.context&&!t.context.isEmpty())for(let o=0;o<t.context.length;o++)if(t.context.getReturnState(o)!==H.EMPTY_RETURN_STATE){const l=t.context.getParent(o),c=this.atn.states[t.context.getReturnState(o)];a=new Kt({state:c,context:l},t),n=this.closure(e,a,r,n,i,s)}return n}t.state.epsilonOnlyTransitions||n&&t.passedThroughNonGreedyDecision||r.add(t);for(let o=0;o<t.state.transitions.length;o++){const l=t.state.transitions[o];a=this.getEpsilonTarget(e,t,l,r,i,s),null!==a&&(n=this.closure(e,a,r,n,i,s))}return n}getEpsilonTarget(e,t,r,n,s,a){let o=null;if(r.serializationType===N.RULE){const e=V.create(t.context,r.followState.stateNumber);o=new Kt({state:r.target,context:e},t)}else{if(r.serializationType===N.PRECEDENCE)throw"Precedence predicates are not supported in lexers.";if(r.serializationType===N.PREDICATE)Xt.debug&&console.log("EVAL rule "+r.ruleIndex+":"+r.predIndex),n.hasSemanticContext=!0,this.evaluatePredicate(e,r.ruleIndex,r.predIndex,s)&&(o=new Kt({state:r.target},t));else if(r.serializationType===N.ACTION)if(null===t.context||t.context.hasEmptyPath()){const e=Gt.append(t.lexerActionExecutor,this.atn.lexerActions[r.actionIndex]);o=new Kt({state:r.target,lexerActionExecutor:e},t)}else o=new Kt({state:r.target},t);else r.serializationType===N.EPSILON?o=new Kt({state:r.target},t):r.serializationType!==N.ATOM&&r.serializationType!==N.RANGE&&r.serializationType!==N.SET||a&&r.matches(i.EOF,0,Ut.MAX_CHAR_VALUE)&&(o=new Kt({state:r.target},t))}return o}evaluatePredicate(e,t,r,n){if(null===this.recog)return!0;if(!n)return this.recog.sempred(null,t,r);const i=this.column,s=this.line,a=e.index,o=e.mark();try{return this.consume(e),this.recog.sempred(null,t,r)}finally{this.column=i,this.line=s,e.seek(a),e.release(o)}}captureSimState(e,t,r){e.index=t.index,e.line=this.line,e.column=this.column,e.dfaState=r}addDFAEdge(e,t,r,n){if(void 0===r&&(r=null),void 0===n&&(n=null),null===r&&null!==n){const e=n.hasSemanticContext;if(n.hasSemanticContext=!1,r=this.addDFAState(n),e)return r}return t<Xt.MIN_DFA_EDGE||t>Xt.MAX_DFA_EDGE||(Xt.debug&&console.log("EDGE "+e+" -> "+r+" upon "+t),null===e.edges&&(e.edges=[]),e.edges[t-Xt.MIN_DFA_EDGE]=r),r}addDFAState(e){const t=new zt(null,e);let r=null;for(let t=0;t<e.items.length;t++){const n=e.items[t];if(n.state instanceof A){r=n;break}}null!==r&&(t.isAcceptState=!0,t.lexerActionExecutor=r.lexerActionExecutor,t.prediction=this.atn.ruleToTokenType[r.state.ruleIndex]);const n=this.decisionToDFA[this.mode],i=n.states.get(t);if(null!==i)return i;const s=t;return s.stateNumber=n.states.length,e.setReadonly(!0),s.configs=e,n.states.add(s),s}getDFA(e){return this.decisionToDFA[e]}getText(e){return e.getText(this.startIndex,e.index-1)}consume(e){e.LA(1)==="\n".charCodeAt(0)?(this.line+=1,this.column=0):this.column+=1,e.consume()}getTokenName(e){return-1===e?"EOF":"'"+String.fromCharCode(e)+"'"}}Xt.debug=!1,Xt.dfa_debug=!1,Xt.MIN_DFA_EDGE=0,Xt.MAX_DFA_EDGE=127;class Jt{constructor(e,t){this.alt=t,this.pred=e}toString(){return"("+this.pred+", "+this.alt+")"}}class Qt{constructor(){this.data={}}get(e){return this.data["k-"+e]||null}set(e,t){this.data["k-"+e]=t}values(){return Object.keys(this.data).filter(e=>e.startsWith("k-")).map(e=>this.data[e],this)}}const Zt={SLL:0,LL:1,LL_EXACT_AMBIG_DETECTION:2,hasSLLConflictTerminatingPrediction:function(e,t){if(Zt.allConfigsInRuleStopStates(t))return!0;if(e===Zt.SLL&&t.hasSemanticContext){const e=new Vt;for(let r=0;r<t.items.length;r++){let n=t.items[r];n=new m({semanticContext:g.NONE},n),e.add(n)}t=e}const r=Zt.getConflictingAltSubsets(t);return Zt.hasConflictingAltSet(r)&&!Zt.hasStateAssociatedWithOneAlt(t)},hasConfigInRuleStopState:function(e){for(let t=0;t<e.items.length;t++)if(e.items[t].state instanceof A)return!0;return!1},allConfigsInRuleStopStates:function(e){for(let t=0;t<e.items.length;t++)if(!(e.items[t].state instanceof A))return!1;return!0},resolvesToJustOneViableAlt:function(e){return Zt.getSingleViableAlt(e)},allSubsetsConflict:function(e){return!Zt.hasNonConflictingAltSet(e)},hasNonConflictingAltSet:function(e){for(let t=0;t<e.length;t++)if(1===e[t].length)return!0;return!1},hasConflictingAltSet:function(e){for(let t=0;t<e.length;t++)if(e[t].length>1)return!0;return!1},allSubsetsEqual:function(e){let t=null;for(let r=0;r<e.length;r++){const n=e[r];if(null===t)t=n;else if(n!==t)return!1}return!0},getUniqueAlt:function(e){const t=Zt.getAlts(e);return 1===t.length?t.minValue():j.INVALID_ALT_NUMBER},getAlts:function(e){const t=new G;return e.map(function(e){t.or(e)}),t},getConflictingAltSubsets:function(e){const t=new Y;return t.hashFunction=function(e){l.hashStuff(e.state.stateNumber,e.context)},t.equalsFunction=function(e,t){return e.state.stateNumber===t.state.stateNumber&&e.context.equals(t.context)},e.items.map(function(e){let r=t.get(e);null===r&&(r=new G,t.set(e,r)),r.set(e.alt)}),t.getValues()},getStateToAltMap:function(e){const t=new Qt;return e.items.map(function(e){let r=t.get(e.state);null===r&&(r=new G,t.set(e.state,r)),r.set(e.alt)}),t},hasStateAssociatedWithOneAlt:function(e){const t=Zt.getStateToAltMap(e).values();for(let e=0;e<t.length;e++)if(1===t[e].length)return!0;return!1},getSingleViableAlt:function(e){let t=null;for(let r=0;r<e.length;r++){const n=e[r].minValue();if(null===t)t=n;else if(t!==n)return j.INVALID_ALT_NUMBER}return t}},te=Zt;class ee extends Dt{constructor(e,t,r,n,i,s){s=s||e._ctx,n=n||e.getCurrentToken(),r=r||e.getCurrentToken(),t=t||e.getInputStream(),super({message:"",recognizer:e,input:t,ctx:s}),this.deadEndConfigs=i,this.startToken=r,this.offendingToken=n}}class se{constructor(e){this.defaultMapCtor=e||Y,this.cacheMap=new this.defaultMapCtor}get(e,t){const r=this.cacheMap.get(e)||null;return null===r?null:r.get(t)||null}set(e,t,r){let n=this.cacheMap.get(e)||null;null===n&&(n=new this.defaultMapCtor,this.cacheMap.set(e,n)),n.set(t,r)}}class ne extends Yt{constructor(e,t,r,n){super(t,n),this.parser=e,this.decisionToDFA=r,this.predictionMode=te.LL,this._input=null,this._startIndex=0,this._outerContext=null,this._dfa=null,this.mergeCache=null,this.debug=!1,this.debug_closure=!1,this.debug_add=!1,this.trace_atn_sim=!1,this.dfa_debug=!1,this.retry_debug=!1}reset(){}adaptivePredict(e,t,r){(this.debug||this.trace_atn_sim)&&console.log("adaptivePredict decision "+t+" exec LA(1)=="+this.getLookaheadName(e)+" line "+e.LT(1).line+":"+e.LT(1).column),this._input=e,this._startIndex=e.index,this._outerContext=r;const n=this.decisionToDFA[t];this._dfa=n;const i=e.mark(),s=e.index;try{let t;if(t=n.precedenceDfa?n.getPrecedenceStartState(this.parser.getPrecedence()):n.s0,null===t){null===r&&(r=U.EMPTY),this.debug&&console.log("predictATN decision "+n.decision+" exec LA(1)=="+this.getLookaheadName(e)+", outerContext="+r.toString(this.parser.ruleNames));const i=!1;let s=this.computeStartState(n.atnStartState,U.EMPTY,i);n.precedenceDfa?(n.s0.configs=s,s=this.applyPrecedenceFilter(s),t=this.addDFAState(n,new zt(null,s)),n.setPrecedenceStartState(this.parser.getPrecedence(),t)):(t=this.addDFAState(n,new zt(null,s)),n.s0=t)}const i=this.execATN(n,t,e,s,r);return this.debug&&console.log("DFA after predictATN: "+n.toString(this.parser.literalNames,this.parser.symbolicNames)),i}finally{this._dfa=null,this.mergeCache=null,e.seek(s),e.release(i)}}execATN(e,t,r,n,s){let a;(this.debug||this.trace_atn_sim)&&console.log("execATN decision "+e.decision+", DFA state "+t+", LA(1)=="+this.getLookaheadName(r)+" line "+r.LT(1).line+":"+r.LT(1).column);let o=t;this.debug&&console.log("s0 = "+t);let l=r.LA(1);for(;;){let t=this.getExistingTargetState(o,l);if(null===t&&(t=this.computeTargetState(e,o,l)),t===Yt.ERROR){const e=this.noViableAlt(r,s,o.configs,n);if(r.seek(n),a=this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(o.configs,s),a!==j.INVALID_ALT_NUMBER)return a;throw e}if(t.requiresFullContext&&this.predictionMode!==te.SLL){let i=null;if(null!==t.predicates){this.debug&&console.log("DFA state has preds in DFA sim LL failover");const e=r.index;if(e!==n&&r.seek(n),i=this.evalSemanticContext(t.predicates,s,!0),1===i.length)return this.debug&&console.log("Full LL avoided"),i.minValue();e!==n&&r.seek(e)}this.dfa_debug&&console.log("ctx sensitive state "+s+" in "+t);const o=!0,l=this.computeStartState(e.atnStartState,s,o);return this.reportAttemptingFullContext(e,i,t.configs,n,r.index),a=this.execATNWithFullContext(e,t,l,r,n,s),a}if(t.isAcceptState){if(null===t.predicates)return t.prediction;const i=r.index;r.seek(n);const a=this.evalSemanticContext(t.predicates,s,!0);if(0===a.length)throw this.noViableAlt(r,s,t.configs,n);return 1===a.length||this.reportAmbiguity(e,t,n,i,!1,a,t.configs),a.minValue()}o=t,l!==i.EOF&&(r.consume(),l=r.LA(1))}}getExistingTargetState(e,t){const r=e.edges;return null===r?null:r[t+1]||null}computeTargetState(e,t,r){const n=this.computeReachSet(t.configs,r,!1);if(null===n)return this.addDFAEdge(e,t,r,Yt.ERROR),Yt.ERROR;let i=new zt(null,n);const s=this.getUniqueAlt(n);if(this.debug){const e=te.getConflictingAltSubsets(n);console.log("SLL altSubSets="+d(e)+", configs="+n+", predict="+s+", allSubsetsConflict="+te.allSubsetsConflict(e)+", conflictingAlts="+this.getConflictingAlts(n))}return s!==j.INVALID_ALT_NUMBER?(i.isAcceptState=!0,i.configs.uniqueAlt=s,i.prediction=s):te.hasSLLConflictTerminatingPrediction(this.predictionMode,n)&&(i.configs.conflictingAlts=this.getConflictingAlts(n),i.requiresFullContext=!0,i.isAcceptState=!0,i.prediction=i.configs.conflictingAlts.minValue()),i.isAcceptState&&i.configs.hasSemanticContext&&(this.predicateDFAState(i,this.atn.getDecisionState(e.decision)),null!==i.predicates&&(i.prediction=j.INVALID_ALT_NUMBER)),i=this.addDFAEdge(e,t,r,i),i}predicateDFAState(e,t){const r=t.transitions.length,n=this.getConflictingAltsOrUniqueAlt(e.configs),i=this.getPredsForAmbigAlts(n,e.configs,r);null!==i?(e.predicates=this.getPredicatePredictions(n,i),e.prediction=j.INVALID_ALT_NUMBER):e.prediction=n.minValue()}execATNWithFullContext(e,t,r,n,s,a){(this.debug||this.trace_atn_sim)&&console.log("execATNWithFullContext "+r);let o,l=!1,c=r;n.seek(s);let u=n.LA(1),h=-1;for(;;){if(o=this.computeReachSet(c,u,!0),null===o){const e=this.noViableAlt(n,a,c,s);n.seek(s);const t=this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(c,a);if(t!==j.INVALID_ALT_NUMBER)return t;throw e}const e=te.getConflictingAltSubsets(o);if(this.debug&&console.log("LL altSubSets="+e+", predict="+te.getUniqueAlt(e)+", resolvesToJustOneViableAlt="+te.resolvesToJustOneViableAlt(e)),o.uniqueAlt=this.getUniqueAlt(o),o.uniqueAlt!==j.INVALID_ALT_NUMBER){h=o.uniqueAlt;break}if(this.predictionMode!==te.LL_EXACT_AMBIG_DETECTION){if(h=te.resolvesToJustOneViableAlt(e),h!==j.INVALID_ALT_NUMBER)break}else if(te.allSubsetsConflict(e)&&te.allSubsetsEqual(e)){l=!0,h=te.getSingleViableAlt(e);break}c=o,u!==i.EOF&&(n.consume(),u=n.LA(1))}return o.uniqueAlt!==j.INVALID_ALT_NUMBER?(this.reportContextSensitivity(e,h,o,s,n.index),h):(this.reportAmbiguity(e,t,s,n.index,l,null,o),h)}computeReachSet(e,t,r){this.debug&&console.log("in computeReachSet, starting closure: "+e),null===this.mergeCache&&(this.mergeCache=new se);const n=new Vt(r);let s=null;for(let a=0;a<e.items.length;a++){const o=e.items[a];if(this.debug&&console.log("testing "+this.getTokenName(t)+" at "+o),o.state instanceof A)(r||t===i.EOF)&&(null===s&&(s=[]),s.push(o),this.debug_add&&console.log("added "+o+" to skippedStopStates"));else for(let e=0;e<o.state.transitions.length;e++){const r=o.state.transitions[e],i=this.getReachableTarget(r,t);if(null!==i){const e=new m({state:i},o);n.add(e,this.mergeCache),this.debug_add&&console.log("added "+e+" to intermediate")}}}let a=null;if(null===s&&t!==i.EOF&&(1===n.items.length||this.getUniqueAlt(n)!==j.INVALID_ALT_NUMBER)&&(a=n),null===a){a=new Vt(r);const e=new p,s=t===i.EOF;for(let t=0;t<n.items.length;t++)this.closure(n.items[t],a,e,!1,r,s)}if(t===i.EOF&&(a=this.removeAllConfigsNotInRuleStopState(a,a===n)),!(null===s||r&&te.hasConfigInRuleStopState(a)))for(let e=0;e<s.length;e++)a.add(s[e],this.mergeCache);return this.trace_atn_sim&&console.log("computeReachSet "+e+" -> "+a),0===a.items.length?null:a}removeAllConfigsNotInRuleStopState(e,t){if(te.allConfigsInRuleStopStates(e))return e;const r=new Vt(e.fullCtx);for(let n=0;n<e.items.length;n++){const s=e.items[n];if(s.state instanceof A)r.add(s,this.mergeCache);else if(t&&s.state.epsilonOnlyTransitions&&this.atn.nextTokens(s.state).contains(i.EPSILON)){const e=this.atn.ruleToStopState[s.state.ruleIndex];r.add(new m({state:e},s),this.mergeCache)}}return r}computeStartState(e,t,r){const n=q(this.atn,t),i=new Vt(r);this.trace_atn_sim&&console.log("computeStartState from ATN state "+e+" initialContext="+n.toString(this.parser));for(let t=0;t<e.transitions.length;t++){const s=e.transitions[t].target,a=new m({state:s,alt:t+1,context:n},null),o=new p;this.closure(a,i,o,!0,r,!1)}return i}applyPrecedenceFilter(e){let t;const r=[],n=new Vt(e.fullCtx);for(let i=0;i<e.items.length;i++){if(t=e.items[i],1!==t.alt)continue;const s=t.semanticContext.evalPrecedence(this.parser,this._outerContext);null!==s&&(r[t.state.stateNumber]=t.context,s!==t.semanticContext?n.add(new m({semanticContext:s},t),this.mergeCache):n.add(t,this.mergeCache))}for(let i=0;i<e.items.length;i++)if(t=e.items[i],1!==t.alt){if(!t.precedenceFilterSuppressed){const e=r[t.state.stateNumber]||null;if(null!==e&&e.equals(t.context))continue}n.add(t,this.mergeCache)}return n}getReachableTarget(e,t){return e.matches(t,0,this.atn.maxTokenType)?e.target:null}getPredsForAmbigAlts(e,t,r){let n=[];for(let r=0;r<t.items.length;r++){const i=t.items[r];e.get(i.alt)&&(n[i.alt]=g.orContext(n[i.alt]||null,i.semanticContext))}let i=0;for(let e=1;e<r+1;e++){const t=n[e]||null;null===t?n[e]=g.NONE:t!==g.NONE&&(i+=1)}return 0===i&&(n=null),this.debug&&console.log("getPredsForAmbigAlts result "+d(n)),n}getPredicatePredictions(e,t){const r=[];let n=!1;for(let i=1;i<t.length;i++){const s=t[i];null!==e&&e.get(i)&&r.push(new Jt(s,i)),s!==g.NONE&&(n=!0)}return n?r:null}getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(e,t){const r=this.splitAccordingToSemanticValidity(e,t),n=r[0],i=r[1];let s=this.getAltThatFinishedDecisionEntryRule(n);return s!==j.INVALID_ALT_NUMBER||i.items.length>0&&(s=this.getAltThatFinishedDecisionEntryRule(i),s!==j.INVALID_ALT_NUMBER)?s:j.INVALID_ALT_NUMBER}getAltThatFinishedDecisionEntryRule(e){const t=[];for(let r=0;r<e.items.length;r++){const n=e.items[r];(n.reachesIntoOuterContext>0||n.state instanceof A&&n.context.hasEmptyPath())&&t.indexOf(n.alt)<0&&t.push(n.alt)}return 0===t.length?j.INVALID_ALT_NUMBER:Math.min.apply(null,t)}splitAccordingToSemanticValidity(e,t){const r=new Vt(e.fullCtx),n=new Vt(e.fullCtx);for(let i=0;i<e.items.length;i++){const s=e.items[i];s.semanticContext!==g.NONE?s.semanticContext.evaluate(this.parser,t)?r.add(s):n.add(s):r.add(s)}return[r,n]}evalSemanticContext(e,t,r){const n=new G;for(let i=0;i<e.length;i++){const s=e[i];if(s.pred===g.NONE){if(n.set(s.alt),!r)break;continue}const a=s.pred.evaluate(this.parser,t);if((this.debug||this.dfa_debug)&&console.log("eval pred "+s+"="+a),a&&((this.debug||this.dfa_debug)&&console.log("PREDICT "+s.alt),n.set(s.alt),!r))break}return n}closure(e,t,r,n,i,s){this.closureCheckingStopState(e,t,r,n,i,0,s)}closureCheckingStopState(e,t,r,n,i,s,a){if((this.trace_atn_sim||this.debug_closure)&&console.log("closure("+e.toString(this.parser,!0)+")"),e.state instanceof A){if(!e.context.isEmpty()){for(let o=0;o<e.context.length;o++){if(e.context.getReturnState(o)===H.EMPTY_RETURN_STATE){if(i){t.add(new m({state:e.state,context:H.EMPTY},e),this.mergeCache);continue}this.debug&&console.log("FALLING off rule "+this.getRuleName(e.state.ruleIndex)),this.closure_(e,t,r,n,i,s,a);continue}const l=this.atn.states[e.context.getReturnState(o)],c=e.context.getParent(o),u={state:l,alt:e.alt,context:c,semanticContext:e.semanticContext},h=new m(u,null);h.reachesIntoOuterContext=e.reachesIntoOuterContext,this.closureCheckingStopState(h,t,r,n,i,s-1,a)}return}if(i)return void t.add(e,this.mergeCache);this.debug&&console.log("FALLING off rule "+this.getRuleName(e.state.ruleIndex))}this.closure_(e,t,r,n,i,s,a)}closure_(e,t,r,n,i,s,a){const o=e.state;o.epsilonOnlyTransitions||t.add(e,this.mergeCache);for(let l=0;l<o.transitions.length;l++){if(0===l&&this.canDropLoopEntryEdgeInLeftRecursiveRule(e))continue;const c=o.transitions[l],u=n&&!(c instanceof ut),h=this.getEpsilonTarget(e,c,u,0===s,i,a);if(null!==h){let n=s;if(e.state instanceof A){if(null!==this._dfa&&this._dfa.precedenceDfa&&c.outermostPrecedenceReturn===this._dfa.atnStartState.ruleIndex&&(h.precedenceFilterSuppressed=!0),h.reachesIntoOuterContext+=1,r.getOrAdd(h)!==h)continue;t.dipsIntoOuterContext=!0,n-=1,this.debug&&console.log("dips into outer ctx: "+h)}else{if(!c.isEpsilon&&r.getOrAdd(h)!==h)continue;c instanceof y&&n>=0&&(n+=1)}this.closureCheckingStopState(h,t,r,u,i,n,a)}}}canDropLoopEntryEdgeInLeftRecursiveRule(e){const t=e.state;if(t.stateType!==C.STAR_LOOP_ENTRY)return!1;if(t.stateType!==C.STAR_LOOP_ENTRY||!t.isPrecedenceDecision||e.context.isEmpty()||e.context.hasEmptyPath())return!1;const r=e.context.length;for(let n=0;n<r;n++)if(this.atn.states[e.context.getReturnState(n)].ruleIndex!==t.ruleIndex)return!1;const n=t.transitions[0].target.endState.stateNumber,i=this.atn.states[n];for(let n=0;n<r;n++){const r=e.context.getReturnState(n),s=this.atn.states[r];if(1!==s.transitions.length||!s.transitions[0].isEpsilon)return!1;const a=s.transitions[0].target;if(!(s.stateType===C.BLOCK_END&&a===t||s===i||a===i||a.stateType===C.BLOCK_END&&1===a.transitions.length&&a.transitions[0].isEpsilon&&a.transitions[0].target===t))return!1}return!0}getRuleName(e){return null!==this.parser&&e>=0?this.parser.ruleNames[e]:"<rule "+e+">"}getEpsilonTarget(e,t,r,n,s,a){switch(t.serializationType){case N.RULE:return this.ruleTransition(e,t);case N.PRECEDENCE:return this.precedenceTransition(e,t,r,n,s);case N.PREDICATE:return this.predTransition(e,t,r,n,s);case N.ACTION:return this.actionTransition(e,t);case N.EPSILON:return new m({state:t.target},e);case N.ATOM:case N.RANGE:case N.SET:return a&&t.matches(i.EOF,0,1)?new m({state:t.target},e):null;default:return null}}actionTransition(e,t){if(this.debug){const e=-1===t.actionIndex?65535:t.actionIndex;console.log("ACTION edge "+t.ruleIndex+":"+e)}return new m({state:t.target},e)}precedenceTransition(e,t,r,n,i){this.debug&&(console.log("PRED (collectPredicates="+r+") "+t.precedence+">=_p, ctx dependent=true"),null!==this.parser&&console.log("context surrounding pred is "+d(this.parser.getRuleInvocationStack())));let s=null;if(r&&n)if(i){const r=this._input.index;this._input.seek(this._startIndex);const n=t.getPredicate().evaluate(this.parser,this._outerContext);this._input.seek(r),n&&(s=new m({state:t.target},e))}else{const r=g.andContext(e.semanticContext,t.getPredicate());s=new m({state:t.target,semanticContext:r},e)}else s=new m({state:t.target},e);return this.debug&&console.log("config from pred transition="+s),s}predTransition(e,t,r,n,i){this.debug&&(console.log("PRED (collectPredicates="+r+") "+t.ruleIndex+":"+t.predIndex+", ctx dependent="+t.isCtxDependent),null!==this.parser&&console.log("context surrounding pred is "+d(this.parser.getRuleInvocationStack())));let s=null;if(r&&(t.isCtxDependent&&n||!t.isCtxDependent))if(i){const r=this._input.index;this._input.seek(this._startIndex);const n=t.getPredicate().evaluate(this.parser,this._outerContext);this._input.seek(r),n&&(s=new m({state:t.target},e))}else{const r=g.andContext(e.semanticContext,t.getPredicate());s=new m({state:t.target,semanticContext:r},e)}else s=new m({state:t.target},e);return this.debug&&console.log("config from pred transition="+s),s}ruleTransition(e,t){this.debug&&console.log("CALL rule "+this.getRuleName(t.target.ruleIndex)+", ctx="+e.context);const r=t.followState,n=V.create(e.context,r.stateNumber);return new m({state:t.target,context:n},e)}getConflictingAlts(e){const t=te.getConflictingAltSubsets(e);return te.getAlts(t)}getConflictingAltsOrUniqueAlt(e){let t=null;return e.uniqueAlt!==j.INVALID_ALT_NUMBER?(t=new G,t.set(e.uniqueAlt)):t=e.conflictingAlts,t}getTokenName(e){if(e===i.EOF)return"EOF";if(null!==this.parser&&null!==this.parser.literalNames){if(!(e>=this.parser.literalNames.length&&e>=this.parser.symbolicNames.length))return(this.parser.literalNames[e]||this.parser.symbolicNames[e])+"<"+e+">";console.log(e+" ttype out of range: "+this.parser.literalNames),console.log(""+this.parser.getInputStream().getTokens())}return""+e}getLookaheadName(e){return this.getTokenName(e.LA(1))}dumpDeadEndConfigs(e){console.log("dead end configs: ");const t=e.getDeadEndConfigs();for(let e=0;e<t.length;e++){const r=t[e];let n="no edges";if(r.state.transitions.length>0){const e=r.state.transitions[0];e instanceof ht?n="Atom "+this.getTokenName(e.label):e instanceof L&&(n=(e instanceof I?"~":"")+"Set "+e.set)}console.error(r.toString(this.parser,!0)+":"+n)}}noViableAlt(e,t,r,n){return new ee(this.parser,e,e.get(n),e.LT(1),r,t)}getUniqueAlt(e){let t=j.INVALID_ALT_NUMBER;for(let r=0;r<e.items.length;r++){const n=e.items[r];if(t===j.INVALID_ALT_NUMBER)t=n.alt;else if(n.alt!==t)return j.INVALID_ALT_NUMBER}return t}addDFAEdge(e,t,r,n){if(this.debug&&console.log("EDGE "+t+" -> "+n+" upon "+this.getTokenName(r)),null===n)return null;if(n=this.addDFAState(e,n),null===t||r<-1||r>this.atn.maxTokenType)return n;if(null===t.edges&&(t.edges=[]),t.edges[r+1]=n,this.debug){const t=null===this.parser?null:this.parser.literalNames,r=null===this.parser?null:this.parser.symbolicNames;console.log("DFA=\n"+e.toString(t,r))}return n}addDFAState(e,t){if(t===Yt.ERROR)return t;const r=e.states.get(t);return null!==r?(this.trace_atn_sim&&console.log("addDFAState "+t+" exists"),r):(t.stateNumber=e.states.length,t.configs.readOnly||(t.configs.optimizeConfigs(this),t.configs.setReadonly(!0)),this.trace_atn_sim&&console.log("addDFAState new "+t),e.states.add(t),this.debug&&console.log("adding new DFA state: "+t),t)}reportAttemptingFullContext(e,t,r,n,i){if(this.debug||this.retry_debug){const t=new E(n,i+1);console.log("reportAttemptingFullContext decision="+e.decision+":"+r+", input="+this.parser.getTokenStream().getText(t))}null!==this.parser&&this.parser.getErrorListener().reportAttemptingFullContext(this.parser,e,n,i,t,r)}reportContextSensitivity(e,t,r,n,i){if(this.debug||this.retry_debug){const t=new E(n,i+1);console.log("reportContextSensitivity decision="+e.decision+":"+r+", input="+this.parser.getTokenStream().getText(t))}null!==this.parser&&this.parser.getErrorListener().reportContextSensitivity(this.parser,e,n,i,t,r)}reportAmbiguity(e,t,r,n,i,s,a){if(this.debug||this.retry_debug){const e=new E(r,n+1);console.log("reportAmbiguity "+s+":"+a+", input="+this.parser.getTokenStream().getText(e))}null!==this.parser&&this.parser.getErrorListener().reportAmbiguity(this.parser,e,r,n,i,s,a)}}class ie{constructor(){this.cache=new Y}add(e){if(e===H.EMPTY)return H.EMPTY;const t=this.cache.get(e)||null;return null!==t?t:(this.cache.set(e,e),e)}get(e){return this.cache.get(e)||null}get length(){return this.cache.length}}const re={ATN:j,ATNDeserializer:kt,LexerATNSimulator:Xt,ParserATNSimulator:ne,PredictionMode:te,PredictionContextCache:ie};class oe{constructor(e,t,r){this.dfa=e,this.literalNames=t||[],this.symbolicNames=r||[]}toString(){if(null===this.dfa.s0)return null;let e="";const t=this.dfa.sortedStates();for(let r=0;r<t.length;r++){const n=t[r];if(null!==n.edges){const t=n.edges.length;for(let r=0;r<t;r++){const t=n.edges[r]||null;null!==t&&2147483647!==t.stateNumber&&(e=e.concat(this.getStateString(n)),e=e.concat("-"),e=e.concat(this.getEdgeLabel(r)),e=e.concat("->"),e=e.concat(this.getStateString(t)),e=e.concat("\n"))}}}return 0===e.length?null:e}getEdgeLabel(e){return 0===e?"EOF":null!==this.literalNames||null!==this.symbolicNames?this.literalNames[e-1]||this.symbolicNames[e-1]:String.fromCharCode(e-1)}getStateString(e){const t=(e.isAcceptState?":":"")+"s"+e.stateNumber+(e.requiresFullContext?"^":"");return e.isAcceptState?null!==e.predicates?t+"=>"+d(e.predicates):t+"=>"+e.prediction.toString():t}}class ae extends oe{constructor(e){super(e,null)}getEdgeLabel(e){return"'"+String.fromCharCode(e)+"'"}}class le{constructor(e,t){if(void 0===t&&(t=0),this.atnStartState=e,this.decision=t,this._states=new p,this.s0=null,this.precedenceDfa=!1,e instanceof rt&&e.isPrecedenceDecision){this.precedenceDfa=!0;const e=new zt(null,new Vt);e.edges=[],e.isAcceptState=!1,e.requiresFullContext=!1,this.s0=e}}getPrecedenceStartState(e){if(!this.precedenceDfa)throw"Only precedence DFAs may contain a precedence start state.";return e<0||e>=this.s0.edges.length?null:this.s0.edges[e]||null}setPrecedenceStartState(e,t){if(!this.precedenceDfa)throw"Only precedence DFAs may contain a precedence start state.";e<0||(this.s0.edges[e]=t)}setPrecedenceDfa(e){if(this.precedenceDfa!==e){if(this._states=new p,e){const e=new zt(null,new Vt);e.edges=[],e.isAcceptState=!1,e.requiresFullContext=!1,this.s0=e}else this.s0=null;this.precedenceDfa=e}}sortedStates(){return this._states.values().sort(function(e,t){return e.stateNumber-t.stateNumber})}toString(e,t){return e=e||null,t=t||null,null===this.s0?"":new oe(this,e,t).toString()}toLexerString(){return null===this.s0?"":new ae(this).toString()}get states(){return this._states}}const he={DFA:le,DFASerializer:oe,LexerDFASerializer:ae,PredPrediction:Jt},ce={PredictionContext:H},ue={Interval:E,IntervalSet:S};class de{visitTerminal(e){}visitErrorNode(e){}enterEveryRule(e){}exitEveryRule(e){}}class pe{visit(e){return Array.isArray(e)?e.map(function(e){return e.accept(this)},this):e.accept(this)}visitChildren(e){return e.children?this.visit(e.children):null}visitTerminal(e){}visitErrorNode(e){}}class ge{walk(e,t){if(t instanceof F||void 0!==t.isErrorNode&&t.isErrorNode())e.visitErrorNode(t);else if(t instanceof b)e.visitTerminal(t);else{this.enterRule(e,t);for(let r=0;r<t.getChildCount();r++){const n=t.getChild(r);this.walk(e,n)}this.exitRule(e,t)}}enterRule(e,t){const r=t.ruleContext;e.enterEveryRule(r),r.enterRule(e)}exitRule(e,t){const r=t.ruleContext;r.exitRule(e),e.exitEveryRule(r)}}ge.DEFAULT=new ge;const fe={Trees:M,RuleNode:P,ErrorNode:F,TerminalNode:b,ParseTreeListener:de,ParseTreeVisitor:pe,ParseTreeWalker:ge};class xe extends Dt{constructor(e){super({message:"",recognizer:e,input:e.getInputStream(),ctx:e._ctx}),this.offendingToken=e.getCurrentToken()}}class _e extends Dt{constructor(e,t,r){super({message:Te(t,r||null),recognizer:e,input:e.getInputStream(),ctx:e._ctx});const n=e._interp.atn.states[e.state].transitions[0];n instanceof gt?(this.ruleIndex=n.ruleIndex,this.predicateIndex=n.predIndex):(this.ruleIndex=0,this.predicateIndex=0),this.predicate=t,this.offendingToken=e.getCurrentToken()}}function Te(e,t){return null!==t?t:"failed predicate: {"+e+"}?"}class me extends vt{constructor(e){super(),e=e||!0,this.exactOnly=e}reportAmbiguity(e,t,r,n,i,s,a){if(this.exactOnly&&!i)return;const o="reportAmbiguity d="+this.getDecisionDescription(e,t)+": ambigAlts="+this.getConflictingAlts(s,a)+", input='"+e.getTokenStream().getText(new E(r,n))+"'";e.notifyErrorListeners(o)}reportAttemptingFullContext(e,t,r,n,i,s){const a="reportAttemptingFullContext d="+this.getDecisionDescription(e,t)+", input='"+e.getTokenStream().getText(new E(r,n))+"'";e.notifyErrorListeners(a)}reportContextSensitivity(e,t,r,n,i,s){const a="reportContextSensitivity d="+this.getDecisionDescription(e,t)+", input='"+e.getTokenStream().getText(new E(r,n))+"'";e.notifyErrorListeners(a)}getDecisionDescription(e,t){const r=t.decision,n=t.atnStartState.ruleIndex,i=e.ruleNames;if(n<0||n>=i.length)return""+r;const s=i[n]||null;return null===s||0===s.length?""+r:`${r} (${s})`}getConflictingAlts(e,t){if(null!==e)return e;const r=new G;for(let e=0;e<t.items.length;e++)r.set(t.items[e].alt);return`{${r.values().join(", ")}}`}}class Ee extends Error{constructor(){super(),Error.captureStackTrace(this,Ee)}}class Se{reset(e){}recoverInline(e){}recover(e,t){}sync(e){}inErrorRecoveryMode(e){}reportError(e){}}class Ce extends Se{constructor(){super(),this.errorRecoveryMode=!1,this.lastErrorIndex=-1,this.lastErrorStates=null,this.nextTokensContext=null,this.nextTokenState=0}reset(e){this.endErrorCondition(e)}beginErrorCondition(e){this.errorRecoveryMode=!0}inErrorRecoveryMode(e){return this.errorRecoveryMode}endErrorCondition(e){this.errorRecoveryMode=!1,this.lastErrorStates=null,this.lastErrorIndex=-1}reportMatch(e){this.endErrorCondition(e)}reportError(e,t){this.inErrorRecoveryMode(e)||(this.beginErrorCondition(e),t instanceof ee?this.reportNoViableAlternative(e,t):t instanceof xe?this.reportInputMismatch(e,t):t instanceof _e?this.reportFailedPredicate(e,t):(console.log("unknown recognition error type: "+t.constructor.name),console.log(t.stack),e.notifyErrorListeners(t.getOffendingToken(),t.getMessage(),t)))}recover(e,t){this.lastErrorIndex===e.getInputStream().index&&null!==this.lastErrorStates&&this.lastErrorStates.indexOf(e.state)>=0&&e.consume(),this.lastErrorIndex=e._input.index,null===this.lastErrorStates&&(this.lastErrorStates=[]),this.lastErrorStates.push(e.state);const r=this.getErrorRecoverySet(e);this.consumeUntil(e,r)}sync(e){if(this.inErrorRecoveryMode(e))return;const t=e._interp.atn.states[e.state],r=e.getTokenStream().LA(1),n=e.atn.nextTokens(t);if(n.contains(r))return this.nextTokensContext=null,void(this.nextTokenState=C.INVALID_STATE_NUMBER);if(n.contains(i.EPSILON))null===this.nextTokensContext&&(this.nextTokensContext=e._ctx,this.nextTokensState=e._stateNumber);else switch(t.stateType){case C.BLOCK_START:case C.STAR_BLOCK_START:case C.PLUS_BLOCK_START:case C.STAR_LOOP_ENTRY:if(null!==this.singleTokenDeletion(e))return;throw new xe(e);case C.PLUS_LOOP_BACK:case C.STAR_LOOP_BACK:{this.reportUnwantedToken(e);const t=new S;t.addSet(e.getExpectedTokens());const r=t.addSet(this.getErrorRecoverySet(e));this.consumeUntil(e,r)}}}reportNoViableAlternative(e,t){const r=e.getTokenStream();let n;n=null!==r?t.startToken.type===i.EOF?"<EOF>":r.getText(new E(t.startToken.tokenIndex,t.offendingToken.tokenIndex)):"<unknown input>";const s="no viable alternative at input "+this.escapeWSAndQuote(n);e.notifyErrorListeners(s,t.offendingToken,t)}reportInputMismatch(e,t){const r="mismatched input "+this.getTokenErrorDisplay(t.offendingToken)+" expecting "+t.getExpectedTokens().toString(e.literalNames,e.symbolicNames);e.notifyErrorListeners(r,t.offendingToken,t)}reportFailedPredicate(e,t){const r="rule "+e.ruleNames[e._ctx.ruleIndex]+" "+t.message;e.notifyErrorListeners(r,t.offendingToken,t)}reportUnwantedToken(e){if(this.inErrorRecoveryMode(e))return;this.beginErrorCondition(e);const t=e.getCurrentToken(),r="extraneous input "+this.getTokenErrorDisplay(t)+" expecting "+this.getExpectedTokens(e).toString(e.literalNames,e.symbolicNames);e.notifyErrorListeners(r,t,null)}reportMissingToken(e){if(this.inErrorRecoveryMode(e))return;this.beginErrorCondition(e);const t=e.getCurrentToken(),r="missing "+this.getExpectedTokens(e).toString(e.literalNames,e.symbolicNames)+" at "+this.getTokenErrorDisplay(t);e.notifyErrorListeners(r,t,null)}recoverInline(e){const t=this.singleTokenDeletion(e);if(null!==t)return e.consume(),t;if(this.singleTokenInsertion(e))return this.getMissingSymbol(e);throw new xe(e)}singleTokenInsertion(e){const t=e.getTokenStream().LA(1),r=e._interp.atn,n=r.states[e.state].transitions[0].target;return!!r.nextTokens(n,e._ctx).contains(t)&&(this.reportMissingToken(e),!0)}singleTokenDeletion(e){const t=e.getTokenStream().LA(2);if(this.getExpectedTokens(e).contains(t)){this.reportUnwantedToken(e),e.consume();const t=e.getCurrentToken();return this.reportMatch(e),t}return null}getMissingSymbol(e){const t=e.getCurrentToken(),r=this.getExpectedTokens(e).first();let n;n=r===i.EOF?"<missing EOF>":"<missing "+e.literalNames[r]+">";let s=t;const a=e.getTokenStream().LT(-1);return s.type===i.EOF&&null!==a&&(s=a),e.getTokenFactory().create(s.source,r,n,i.DEFAULT_CHANNEL,-1,-1,s.line,s.column)}getExpectedTokens(e){return e.getExpectedTokens()}getTokenErrorDisplay(e){if(null===e)return"<no token>";let t=e.text;return null===t&&(t=e.type===i.EOF?"<EOF>":"<"+e.type+">"),this.escapeWSAndQuote(t)}escapeWSAndQuote(e){return"'"+(e=(e=(e=e.replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/\t/g,"\\t"))+"'"}getErrorRecoverySet(e){const t=e._interp.atn;let r=e._ctx;const n=new S;for(;null!==r&&r.invokingState>=0;){const e=t.states[r.invokingState].transitions[0],i=t.nextTokens(e.followState);n.addSet(i),r=r.parentCtx}return n.removeOne(i.EPSILON),n}consumeUntil(e,t){let r=e.getTokenStream().LA(1);for(;r!==i.EOF&&!t.contains(r);)e.consume(),r=e.getTokenStream().LA(1)}}class Ae extends Ce{constructor(){super()}recover(e,t){let r=e._ctx;for(;null!==r;)r.exception=t,r=r.parentCtx;throw new Ee(t)}recoverInline(e){this.recover(e,new xe(e))}sync(e){}}const Ne={RecognitionException:Dt,NoViableAltException:ee,LexerNoViableAltException:Mt,InputMismatchException:xe,FailedPredicateException:_e,DiagnosticErrorListener:me,BailErrorStrategy:Ae,DefaultErrorStrategy:Ce,ErrorListener:vt};class ye{constructor(e,t){if(this.name="<empty>",this.strdata=e,this.decodeToUnicodeCodePoints=t||!1,this._index=0,this.data=[],this.decodeToUnicodeCodePoints)for(let e=0;e<this.strdata.length;){const t=this.strdata.codePointAt(e);this.data.push(t),e+=t<=65535?1:2}else{this.data=new Array(this.strdata.length);for(let e=0;e<this.strdata.length;e++)this.data[e]=this.strdata.charCodeAt(e)}this._size=this.data.length}reset(){this._index=0}consume(){if(this._index>=this._size)throw"cannot consume EOF";this._index+=1}LA(e){if(0===e)return 0;e<0&&(e+=1);const t=this._index+e-1;return t<0||t>=this._size?i.EOF:this.data[t]}LT(e){return this.LA(e)}mark(){return-1}release(e){}seek(e){e<=this._index?this._index=e:this._index=Math.min(e,this._size)}getText(e,t){if(t>=this._size&&(t=this._size-1),e>=this._size)return"";if(this.decodeToUnicodeCodePoints){let r="";for(let n=e;n<=t;n++)r+=String.fromCodePoint(this.data[n]);return r}return this.strdata.slice(e,t+1)}toString(){return this.strdata}get index(){return this._index}get size(){return this._size}}class Le extends ye{constructor(e,t){super(e,t)}}var Ie=s(763);const ke="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node;class ve extends Le{static fromPath(e,t,r){if(!ke)throw new Error("FileStream is only available when running in Node!");Ie.readFile(e,t,function(e,t){let n=null;null!==t&&(n=new ye(t,!0)),r(e,n)})}constructor(e,t,r){if(!ke)throw new Error("FileStream is only available when running in Node!");super(Ie.readFileSync(e,t||"utf-8"),r),this.fileName=e}}const we={fromString:function(e){return new ye(e,!0)},fromBlob:function(e,t,r,n){const i=new window.FileReader;i.onload=function(e){const t=new ye(e.target.result,!0);r(t)},i.onerror=n,i.readAsText(e,t)},fromBuffer:function(e,t){return new ye(e.toString(t),!0)},fromPath:function(e,t,r){ve.fromPath(e,t,r)},fromPathSync:function(e,t){return new ve(e,t)}},Re={arrayToString:d,stringToCharArray:function(e){let t=new Uint16Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}};class Oe{}class Pe extends Oe{constructor(e){super(),this.tokenSource=e,this.tokens=[],this.index=-1,this.fetchedEOF=!1}mark(){return 0}release(e){}reset(){this.seek(0)}seek(e){this.lazyInit(),this.index=this.adjustSeekIndex(e)}get size(){return this.tokens.length}get(e){return this.lazyInit(),this.tokens[e]}consume(){let e=!1;if(e=this.index>=0&&(this.fetchedEOF?this.index<this.tokens.length-1:this.index<this.tokens.length),!e&&this.LA(1)===i.EOF)throw"cannot consume EOF";this.sync(this.index+1)&&(this.index=this.adjustSeekIndex(this.index+1))}sync(e){const t=e-this.tokens.length+1;return!(t>0)||this.fetch(t)>=t}fetch(e){if(this.fetchedEOF)return 0;for(let t=0;t<e;t++){const e=this.tokenSource.nextToken();if(e.tokenIndex=this.tokens.length,this.tokens.push(e),e.type===i.EOF)return this.fetchedEOF=!0,t+1}return e}getTokens(e,t,r){if(void 0===r&&(r=null),e<0||t<0)return null;this.lazyInit();const n=[];t>=this.tokens.length&&(t=this.tokens.length-1);for(let s=e;s<t;s++){const e=this.tokens[s];if(e.type===i.EOF)break;(null===r||r.contains(e.type))&&n.push(e)}return n}LA(e){return this.LT(e).type}LB(e){return this.index-e<0?null:this.tokens[this.index-e]}LT(e){if(this.lazyInit(),0===e)return null;if(e<0)return this.LB(-e);const t=this.index+e-1;return this.sync(t),t>=this.tokens.length?this.tokens[this.tokens.length-1]:this.tokens[t]}adjustSeekIndex(e){return e}lazyInit(){-1===this.index&&this.setup()}setup(){this.sync(0),this.index=this.adjustSeekIndex(0)}setTokenSource(e){this.tokenSource=e,this.tokens=[],this.index=-1,this.fetchedEOF=!1}nextTokenOnChannel(e,t){if(this.sync(e),e>=this.tokens.length)return-1;let r=this.tokens[e];for(;r.channel!==t;){if(r.type===i.EOF)return-1;e+=1,this.sync(e),r=this.tokens[e]}return e}previousTokenOnChannel(e,t){for(;e>=0&&this.tokens[e].channel!==t;)e-=1;return e}getHiddenTokensToRight(e,t){if(void 0===t&&(t=-1),this.lazyInit(),e<0||e>=this.tokens.length)throw e+" not in 0.."+this.tokens.length-1;const r=this.nextTokenOnChannel(e+1,Ut.DEFAULT_TOKEN_CHANNEL),n=e+1,i=-1===r?this.tokens.length-1:r;return this.filterForChannel(n,i,t)}getHiddenTokensToLeft(e,t){if(void 0===t&&(t=-1),this.lazyInit(),e<0||e>=this.tokens.length)throw e+" not in 0.."+this.tokens.length-1;const r=this.previousTokenOnChannel(e-1,Ut.DEFAULT_TOKEN_CHANNEL);if(r===e-1)return null;const n=r+1,i=e-1;return this.filterForChannel(n,i,t)}filterForChannel(e,t,r){const n=[];for(let i=e;i<t+1;i++){const e=this.tokens[i];-1===r?e.channel!==Ut.DEFAULT_TOKEN_CHANNEL&&n.push(e):e.channel===r&&n.push(e)}return 0===n.length?null:n}getSourceName(){return this.tokenSource.getSourceName()}getText(e){this.lazyInit(),this.fill(),e||(e=new E(0,this.tokens.length-1));let t=e.start;t instanceof i&&(t=t.tokenIndex);let r=e.stop;if(r instanceof i&&(r=r.tokenIndex),null===t||null===r||t<0||r<0)return"";r>=this.tokens.length&&(r=this.tokens.length-1);let n="";for(let e=t;e<r+1;e++){const t=this.tokens[e];if(t.type===i.EOF)break;n+=t.text}return n}fill(){for(this.lazyInit();1e3===this.fetch(1e3););}}Object.defineProperty(Pe,"size",{get:function(){return this.tokens.length}});class be extends Pe{constructor(e,t){super(e),this.channel=void 0===t?i.DEFAULT_CHANNEL:t}adjustSeekIndex(e){return this.nextTokenOnChannel(e,this.channel)}LB(e){if(0===e||this.index-e<0)return null;let t=this.index,r=1;for(;r<=e;)t=this.previousTokenOnChannel(t-1,this.channel),r+=1;return t<0?null:this.tokens[t]}LT(e){if(this.lazyInit(),0===e)return null;if(e<0)return this.LB(-e);let t=this.index,r=1;for(;r<e;)this.sync(t+1)&&(t=this.nextTokenOnChannel(t+1,this.channel)),r+=1;return this.tokens[t]}getNumberOfOnChannelTokens(){let e=0;this.fill();for(let t=0;t<this.tokens.length;t++){const r=this.tokens[t];if(r.channel===this.channel&&(e+=1),r.type===i.EOF)break}return e}}class Fe extends de{constructor(e){super(),this.parser=e}enterEveryRule(e){console.log("enter "+this.parser.ruleNames[e.ruleIndex]+", LT(1)="+this.parser._input.LT(1).text)}visitTerminal(e){console.log("consume "+e.symbol+" rule "+this.parser.ruleNames[this.parser._ctx.ruleIndex])}exitEveryRule(e){console.log("exit "+this.parser.ruleNames[e.ruleIndex]+", LT(1)="+this.parser._input.LT(1).text)}}class De extends Ot{constructor(e){super(),this._input=null,this._errHandler=new Ce,this._precedenceStack=[],this._precedenceStack.push(0),this._ctx=null,this.buildParseTrees=!0,this._tracer=null,this._parseListeners=null,this._syntaxErrors=0,this.setInputStream(e)}reset(){null!==this._input&&this._input.seek(0),this._errHandler.reset(this),this._ctx=null,this._syntaxErrors=0,this.setTrace(!1),this._precedenceStack=[],this._precedenceStack.push(0),null!==this._interp&&this._interp.reset()}match(e){let t=this.getCurrentToken();return t.type===e?(this._errHandler.reportMatch(this),this.consume()):(t=this._errHandler.recoverInline(this),this.buildParseTrees&&-1===t.tokenIndex&&this._ctx.addErrorNode(t)),t}matchWildcard(){let e=this.getCurrentToken();return e.type>0?(this._errHandler.reportMatch(this),this.consume()):(e=this._errHandler.recoverInline(this),this.buildParseTrees&&-1===e.tokenIndex&&this._ctx.addErrorNode(e)),e}getParseListeners(){return this._parseListeners||[]}addParseListener(e){if(null===e)throw"listener";null===this._parseListeners&&(this._parseListeners=[]),this._parseListeners.push(e)}removeParseListener(e){if(null!==this._parseListeners){const t=this._parseListeners.indexOf(e);t>=0&&this._parseListeners.splice(t,1),0===this._parseListeners.length&&(this._parseListeners=null)}}removeParseListeners(){this._parseListeners=null}triggerEnterRuleEvent(){if(null!==this._parseListeners){const e=this._ctx;this._parseListeners.forEach(function(t){t.enterEveryRule(e),e.enterRule(t)})}}triggerExitRuleEvent(){if(null!==this._parseListeners){const e=this._ctx;this._parseListeners.slice(0).reverse().forEach(function(t){e.exitRule(t),t.exitEveryRule(e)})}}getTokenFactory(){return this._input.tokenSource._factory}setTokenFactory(e){this._input.tokenSource._factory=e}getATNWithBypassAlts(){const e=this.getSerializedATN();if(null===e)throw"The current parser does not support an ATN with bypass alternatives.";let t=this.bypassAltsAtnCache[e];if(null===t){const r=new _t;r.generateRuleBypassTransitions=!0,t=new kt(r).deserialize(e),this.bypassAltsAtnCache[e]=t}return t}getInputStream(){return this.getTokenStream()}setInputStream(e){this.setTokenStream(e)}getTokenStream(){return this._input}setTokenStream(e){this._input=null,this.reset(),this._input=e}get syntaxErrorsCount(){return this._syntaxErrors}getCurrentToken(){return this._input.LT(1)}notifyErrorListeners(e,t,r){r=r||null,null===(t=t||null)&&(t=this.getCurrentToken()),this._syntaxErrors+=1;const n=t.line,i=t.column;this.getErrorListener().syntaxError(this,t,n,i,e,r)}consume(){const e=this.getCurrentToken();e.type!==i.EOF&&this.getInputStream().consume();const t=null!==this._parseListeners&&this._parseListeners.length>0;if(this.buildParseTrees||t){let r;r=this._errHandler.inErrorRecoveryMode(this)?this._ctx.addErrorNode(e):this._ctx.addTokenNode(e),r.invokingState=this.state,t&&this._parseListeners.forEach(function(e){r instanceof F||void 0!==r.isErrorNode&&r.isErrorNode()?e.visitErrorNode(r):r instanceof b&&e.visitTerminal(r)})}return e}addContextToParseTree(){null!==this._ctx.parentCtx&&this._ctx.parentCtx.addChild(this._ctx)}enterRule(e,t,r){this.state=t,this._ctx=e,this._ctx.start=this._input.LT(1),this.buildParseTrees&&this.addContextToParseTree(),this.triggerEnterRuleEvent()}exitRule(){this._ctx.stop=this._input.LT(-1),this.triggerExitRuleEvent(),this.state=this._ctx.invokingState,this._ctx=this._ctx.parentCtx}enterOuterAlt(e,t){e.setAltNumber(t),this.buildParseTrees&&this._ctx!==e&&null!==this._ctx.parentCtx&&(this._ctx.parentCtx.removeLastChild(),this._ctx.parentCtx.addChild(e)),this._ctx=e}getPrecedence(){return 0===this._precedenceStack.length?-1:this._precedenceStack[this._precedenceStack.length-1]}enterRecursionRule(e,t,r,n){this.state=t,this._precedenceStack.push(n),this._ctx=e,this._ctx.start=this._input.LT(1),this.triggerEnterRuleEvent()}pushNewRecursionContext(e,t,r){const n=this._ctx;n.parentCtx=e,n.invokingState=t,n.stop=this._input.LT(-1),this._ctx=e,this._ctx.start=n.start,this.buildParseTrees&&this._ctx.addChild(n),this.triggerEnterRuleEvent()}unrollRecursionContexts(e){this._precedenceStack.pop(),this._ctx.stop=this._input.LT(-1);const t=this._ctx,r=this.getParseListeners();if(null!==r&&r.length>0)for(;this._ctx!==e;)this.triggerExitRuleEvent(),this._ctx=this._ctx.parentCtx;else this._ctx=e;t.parentCtx=e,this.buildParseTrees&&null!==e&&e.addChild(t)}getInvokingContext(e){let t=this._ctx;for(;null!==t;){if(t.ruleIndex===e)return t;t=t.parentCtx}return null}precpred(e,t){return t>=this._precedenceStack[this._precedenceStack.length-1]}inContext(e){return!1}isExpectedToken(e){const t=this._interp.atn;let r=this._ctx;const n=t.states[this.state];let s=t.nextTokens(n);if(s.contains(e))return!0;if(!s.contains(i.EPSILON))return!1;for(;null!==r&&r.invokingState>=0&&s.contains(i.EPSILON);){const n=t.states[r.invokingState].transitions[0];if(s=t.nextTokens(n.followState),s.contains(e))return!0;r=r.parentCtx}return!(!s.contains(i.EPSILON)||e!==i.EOF)}getExpectedTokens(){return this._interp.atn.getExpectedTokens(this.state,this._ctx)}getExpectedTokensWithinCurrentRule(){const e=this._interp.atn,t=e.states[this.state];return e.nextTokens(t)}getRuleIndex(e){const t=this.getRuleIndexMap()[e];return null!==t?t:-1}getRuleInvocationStack(e){null===(e=e||null)&&(e=this._ctx);const t=[];for(;null!==e;){const r=e.ruleIndex;r<0?t.push("n/a"):t.push(this.ruleNames[r]),e=e.parentCtx}return t}getDFAStrings(){return this._interp.decisionToDFA.toString()}dumpDFA(){let e=!1;for(let t=0;t<this._interp.decisionToDFA.length;t++){const r=this._interp.decisionToDFA[t];r.states.length>0&&(e&&console.log(),this.printer.println("Decision "+r.decision+":"),this.printer.print(r.toString(this.literalNames,this.symbolicNames)),e=!0)}}getSourceName(){return this._input.getSourceName()}setTrace(e){e?(null!==this._tracer&&this.removeParseListener(this._tracer),this._tracer=new Fe(this),this.addParseListener(this._tracer)):(this.removeParseListener(this._tracer),this._tracer=null)}}De.bypassAltsAtnCache={};class Me extends b{constructor(e){super(),this.parentCtx=null,this.symbol=e}getChild(e){return null}getSymbol(){return this.symbol}getParent(){return this.parentCtx}getPayload(){return this.symbol}getSourceInterval(){if(null===this.symbol)return E.INVALID_INTERVAL;const e=this.symbol.tokenIndex;return new E(e,e)}getChildCount(){return 0}accept(e){return e.visitTerminal(this)}getText(){return this.symbol.text}toString(){return this.symbol.type===i.EOF?"<EOF>":this.symbol.text}}class Ue extends Me{constructor(e){super(e)}isErrorNode(){return!0}accept(e){return e.visitErrorNode(this)}}class He extends U{constructor(e,t){super(e,t),this.children=null,this.start=null,this.stop=null,this.exception=null}copyFrom(e){this.parentCtx=e.parentCtx,this.invokingState=e.invokingState,this.children=null,this.start=e.start,this.stop=e.stop,e.children&&(this.children=[],e.children.map(function(e){e instanceof Ue&&(this.children.push(e),e.parentCtx=this)},this))}enterRule(e){}exitRule(e){}addChild(e){return null===this.children&&(this.children=[]),this.children.push(e),e}removeLastChild(){null!==this.children&&this.children.pop()}addTokenNode(e){const t=new Me(e);return this.addChild(t),t.parentCtx=this,t}addErrorNode(e){const t=new Ue(e);return this.addChild(t),t.parentCtx=this,t}getChild(e,t){if(t=t||null,null===this.children||e<0||e>=this.children.length)return null;if(null===t)return this.children[e];for(let r=0;r<this.children.length;r++){const n=this.children[r];if(n instanceof t){if(0===e)return n;e-=1}}return null}getToken(e,t){if(null===this.children||t<0||t>=this.children.length)return null;for(let r=0;r<this.children.length;r++){const n=this.children[r];if(n instanceof b&&n.symbol.type===e){if(0===t)return n;t-=1}}return null}getTokens(e){if(null===this.children)return[];{const t=[];for(let r=0;r<this.children.length;r++){const n=this.children[r];n instanceof b&&n.symbol.type===e&&t.push(n)}return t}}getTypedRuleContext(e,t){return this.getChild(t,e)}getTypedRuleContexts(e){if(null===this.children)return[];{const t=[];for(let r=0;r<this.children.length;r++){const n=this.children[r];n instanceof e&&t.push(n)}return t}}getChildCount(){return null===this.children?0:this.children.length}getSourceInterval(){return null===this.start||null===this.stop?E.INVALID_INTERVAL:new E(this.start.tokenIndex,this.stop.tokenIndex)}}U.EMPTY=new He;class Be{static DEFAULT_PROGRAM_NAME="default";constructor(e){this.tokens=e,this.programs=new Map}getTokenStream(){return this.tokens}insertAfter(e,t){let r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Be.DEFAULT_PROGRAM_NAME;r="number"==typeof e?e:e.tokenIndex;let i=this.getProgram(n),s=new Ye(this.tokens,r,i.length,t);i.push(s)}insertBefore(e,t){let r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Be.DEFAULT_PROGRAM_NAME;r="number"==typeof e?e:e.tokenIndex;const i=this.getProgram(n),s=new ze(this.tokens,r,i.length,t);i.push(s)}replaceSingle(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Be.DEFAULT_PROGRAM_NAME;this.replace(e,e,t,r)}replace(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Be.DEFAULT_PROGRAM_NAME;if("number"!=typeof e&&(e=e.tokenIndex),"number"!=typeof t&&(t=t.tokenIndex),e>t||e<0||t<0||t>=this.tokens.size)throw new RangeError(`replace: range invalid: ${e}..${t}(size=${this.tokens.size})`);let i=this.getProgram(n),s=new qe(this.tokens,e,t,i.length,r);i.push(s)}delete(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Be.DEFAULT_PROGRAM_NAME;void 0===t&&(t=e),this.replace(e,t,null,r)}getProgram(e){let t=this.programs.get(e);return null==t&&(t=this.initializeProgram(e)),t}initializeProgram(e){const t=[];return this.programs.set(e,t),t}getText(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Be.DEFAULT_PROGRAM_NAME;t=e instanceof E?e:new E(0,this.tokens.size-1),"string"==typeof e&&(r=e);const n=this.programs.get(r);let s=t.start,a=t.stop;if(a>this.tokens.size-1&&(a=this.tokens.size-1),s<0&&(s=0),null==n||0===n.length)return this.tokens.getText(new E(s,a));let o=[],l=this.reduceToSingleOperationPerIndex(n),c=s;for(;c<=a&&c<this.tokens.size;){let e=l.get(c);l.delete(c);let t=this.tokens.get(c);null==e?(t.type!==i.EOF&&o.push(String(t.text)),c++):c=e.execute(o)}if(a===this.tokens.size-1)for(const e of l.values())e.index>=this.tokens.size-1&&o.push(e.text.toString());return o.join("")}reduceToSingleOperationPerIndex(e){for(let t=0;t<e.length;t++){let r=e[t];if(null==r)continue;if(!(r instanceof qe))continue;let n=r,i=this.getKindOfOps(e,ze,t);for(let t of i)t.index===n.index?(e[t.instructionIndex]=void 0,n.text=t.text.toString()+(null!=n.text?n.text.toString():"")):t.index>n.index&&t.index<=n.lastIndex&&(e[t.instructionIndex]=void 0);let s=this.getKindOfOps(e,qe,t);for(let t of s){if(t.index>=n.index&&t.lastIndex<=n.lastIndex){e[t.instructionIndex]=void 0;continue}let r=t.lastIndex<n.index||t.index>n.lastIndex;if(null!=t.text||null!=n.text||r){if(!r)throw new Error(`replace op boundaries of ${n} overlap with previous ${t}`)}else e[t.instructionIndex]=void 0,n.index=Math.min(t.index,n.index),n.lastIndex=Math.max(t.lastIndex,n.lastIndex)}}for(let t=0;t<e.length;t++){let r=e[t];if(null==r)continue;if(!(r instanceof ze))continue;let n=r,i=this.getKindOfOps(e,ze,t);for(let t of i)t.index===n.index&&(t instanceof Ye?(n.text=this.catOpText(t.text,n.text),e[t.instructionIndex]=void 0):t instanceof ze&&(n.text=this.catOpText(n.text,t.text),e[t.instructionIndex]=void 0));let s=this.getKindOfOps(e,qe,t);for(let r of s)if(n.index!==r.index){if(n.index>=r.index&&n.index<=r.lastIndex)throw new Error(`insert op ${n} within boundaries of previous ${r}`)}else r.text=this.catOpText(n.text,r.text),e[t]=void 0}let t=new Map;for(let r of e)if(null!=r){if(null!=t.get(r.index))throw new Error("should only be one op per index");t.set(r.index,r)}return t}catOpText(e,t){let r="",n="";return null!=e&&(r=e.toString()),null!=t&&(n=t.toString()),r+n}getKindOfOps(e,t,r){return e.slice(0,r).filter(e=>e&&e instanceof t)}}class Ve{constructor(e,t,r,n){this.tokens=e,this.instructionIndex=r,this.index=t,this.text=void 0===n?"":n}toString(){let e=this.constructor.name;const t=e.indexOf("$");return e=e.substring(t+1,e.length),"<"+e+"@"+this.tokens.get(this.index)+':"'+this.text+'">'}}class ze extends Ve{constructor(e,t,r,n){super(e,t,r,n)}execute(e){return this.text&&e.push(this.text.toString()),this.tokens.get(this.index).type!==i.EOF&&e.push(String(this.tokens.get(this.index).text)),this.index+1}}class Ye extends ze{constructor(e,t,r,n){super(e,t+1,r,n)}}class qe extends Ve{constructor(e,t,r,n,i){super(e,t,n,i),this.lastIndex=r}execute(e){return this.text&&e.push(this.text.toString()),this.lastIndex+1}toString(){return null==this.text?"<DeleteOp@"+this.tokens.get(this.index)+".."+this.tokens.get(this.lastIndex)+">":"<ReplaceOp@"+this.tokens.get(this.index)+".."+this.tokens.get(this.lastIndex)+':"'+this.text+'">'}}const Ke={atn:re,dfa:he,context:ce,misc:ue,tree:fe,error:Ne,Token:i,CommonToken:Pt,CharStreams:we,CharStream:ye,InputStream:Le,CommonTokenStream:be,Lexer:Ut,Parser:De,ParserRuleContext:He,Interval:E,IntervalSet:S,LL1Analyzer:$,Utils:Re,TokenStreamRewriter:Be};var We=n.jB,Ge=n.pG,$e=n.zW,je=n.Ay;const Xe=(new je.atn.ATNDeserializer).deserialize([4,0,34,165,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,1,0,1,0,1,1,1,1,1,1,1,2,1,2,1,3,1,3,1,4,1,4,1,4,1,5,1,5,1,6,1,6,1,7,1,7,1,8,1,8,1,9,1,9,1,10,1,10,1,11,1,11,1,12,1,12,1,13,1,13,1,14,1,14,1,14,1,15,1,15,1,16,1,16,1,17,1,17,1,17,1,18,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,21,1,22,1,22,1,22,1,23,1,23,1,23,1,24,1,24,1,24,1,25,1,25,1,26,1,26,1,27,1,27,1,27,1,28,1,28,1,28,1,29,1,29,1,30,4,30,142,8,30,11,30,12,30,143,1,30,1,30,1,31,1,31,1,31,1,31,5,31,152,8,31,10,31,12,31,155,9,31,1,31,1,31,1,32,1,32,1,33,4,33,162,8,33,11,33,12,33,163,0,0,34,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,55,28,57,29,59,30,61,31,63,32,65,33,67,34,1,0,3,2,0,9,9,32,32,2,0,10,10,13,13,7,0,9,10,13,13,32,32,40,41,44,44,91,91,93,93,167,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0,0,1,69,1,0,0,0,3,71,1,0,0,0,5,74,1,0,0,0,7,76,1,0,0,0,9,78,1,0,0,0,11,81,1,0,0,0,13,83,1,0,0,0,15,85,1,0,0,0,17,87,1,0,0,0,19,89,1,0,0,0,21,91,1,0,0,0,23,93,1,0,0,0,25,95,1,0,0,0,27,97,1,0,0,0,29,99,1,0,0,0,31,102,1,0,0,0,33,104,1,0,0,0,35,106,1,0,0,0,37,109,1,0,0,0,39,112,1,0,0,0,41,114,1,0,0,0,43,116,1,0,0,0,45,119,1,0,0,0,47,122,1,0,0,0,49,125,1,0,0,0,51,128,1,0,0,0,53,130,1,0,0,0,55,132,1,0,0,0,57,135,1,0,0,0,59,138,1,0,0,0,61,141,1,0,0,0,63,147,1,0,0,0,65,158,1,0,0,0,67,161,1,0,0,0,69,70,5,44,0,0,70,2,1,0,0,0,71,72,5,45,0,0,72,73,5,62,0,0,73,4,1,0,0,0,74,75,5,40,0,0,75,6,1,0,0,0,76,77,5,41,0,0,77,8,1,0,0,0,78,79,5,58,0,0,79,80,5,58,0,0,80,10,1,0,0,0,81,82,5,46,0,0,82,12,1,0,0,0,83,84,5,91,0,0,84,14,1,0,0,0,85,86,5,93,0,0,86,16,1,0,0,0,87,88,5,126,0,0,88,18,1,0,0,0,89,90,5,33,0,0,90,20,1,0,0,0,91,92,5,45,0,0,92,22,1,0,0,0,93,94,5,43,0,0,94,24,1,0,0,0,95,96,5,38,0,0,96,26,1,0,0,0,97,98,5,42,0,0,98,28,1,0,0,0,99,100,5,46,0,0,100,101,5,42,0,0,101,30,1,0,0,0,102,103,5,47,0,0,103,32,1,0,0,0,104,105,5,37,0,0,105,34,1,0,0,0,106,107,5,60,0,0,107,108,5,60,0,0,108,36,1,0,0,0,109,110,5,62,0,0,110,111,5,62,0,0,111,38,1,0,0,0,112,113,5,60,0,0,113,40,1,0,0,0,114,115,5,62,0,0,115,42,1,0,0,0,116,117,5,60,0,0,117,118,5,61,0,0,118,44,1,0,0,0,119,120,5,62,0,0,120,121,5,61,0,0,121,46,1,0,0,0,122,123,5,61,0,0,123,124,5,61,0,0,124,48,1,0,0,0,125,126,5,33,0,0,126,127,5,61,0,0,127,50,1,0,0,0,128,129,5,94,0,0,129,52,1,0,0,0,130,131,5,124,0,0,131,54,1,0,0,0,132,133,5,38,0,0,133,134,5,38,0,0,134,56,1,0,0,0,135,136,5,124,0,0,136,137,5,124,0,0,137,58,1,0,0,0,138,139,5,61,0,0,139,60,1,0,0,0,140,142,7,0,0,0,141,140,1,0,0,0,142,143,1,0,0,0,143,141,1,0,0,0,143,144,1,0,0,0,144,145,1,0,0,0,145,146,6,30,0,0,146,62,1,0,0,0,147,148,5,47,0,0,148,149,5,47,0,0,149,153,1,0,0,0,150,152,8,1,0,0,151,150,1,0,0,0,152,155,1,0,0,0,153,151,1,0,0,0,153,154,1,0,0,0,154,156,1,0,0,0,155,153,1,0,0,0,156,157,6,31,0,0,157,64,1,0,0,0,158,159,7,1,0,0,159,66,1,0,0,0,160,162,8,2,0,0,161,160,1,0,0,0,162,163,1,0,0,0,163,161,1,0,0,0,163,164,1,0,0,0,164,68,1,0,0,0,4,0,143,153,163,1,6,0,0]),Je=Xe.decisionToState.map((e,t)=>new je.dfa.DFA(e,t));class Qe extends je.Lexer{static grammarFileName="Dsp.g4";static channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"];static modeNames=["DEFAULT_MODE"];static literalNames=[null,"','","'->'","'('","')'","'::'","'.'","'['","']'","'~'","'!'","'-'","'+'","'&'","'*'","'.*'","'/'","'%'","'<<'","'>>'","'<'","'>'","'<='","'>='","'=='","'!='","'^'","'|'","'&&'","'||'","'='"];static symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"WHITESPACE","COMMENT","NEWLINE","SYMBOL"];static ruleNames=["T__0","T__1","T__2","T__3","T__4","T__5","T__6","T__7","T__8","T__9","T__10","T__11","T__12","T__13","T__14","T__15","T__16","T__17","T__18","T__19","T__20","T__21","T__22","T__23","T__24","T__25","T__26","T__27","T__28","T__29","WHITESPACE","COMMENT","NEWLINE","SYMBOL"];constructor(e){super(e),this._interp=new je.atn.LexerATNSimulator(this,Xe,Je,new je.atn.PredictionContextCache)}}Qe.EOF=je.Token.EOF,Qe.T__0=1,Qe.T__1=2,Qe.T__2=3,Qe.T__3=4,Qe.T__4=5,Qe.T__5=6,Qe.T__6=7,Qe.T__7=8,Qe.T__8=9,Qe.T__9=10,Qe.T__10=11,Qe.T__11=12,Qe.T__12=13,Qe.T__13=14,Qe.T__14=15,Qe.T__15=16,Qe.T__16=17,Qe.T__17=18,Qe.T__18=19,Qe.T__19=20,Qe.T__20=21,Qe.T__21=22,Qe.T__22=23,Qe.T__23=24,Qe.T__24=25,Qe.T__25=26,Qe.T__26=27,Qe.T__27=28,Qe.T__28=29,Qe.T__29=30,Qe.WHITESPACE=31,Qe.COMMENT=32,Qe.NEWLINE=33,Qe.SYMBOL=34;class Ze extends je.tree.ParseTreeVisitor{visitRule_pool(e){return this.visitChildren(e)}visitRule(e){return this.visitChildren(e)}visitSymbol(e){return this.visitChildren(e)}visitParentheses(e){return this.visitChildren(e)}visitSubscript(e){return this.visitChildren(e)}visitBinary(e){return this.visitChildren(e)}visitFunction(e){return this.visitChildren(e)}visitUnary(e){return this.visitChildren(e)}}const ts=(new je.atn.ATNDeserializer).deserialize([4,1,34,132,2,0,7,0,2,1,7,1,2,2,7,2,1,0,5,0,8,8,0,10,0,12,0,11,9,0,1,0,1,0,4,0,15,8,0,11,0,12,0,16,1,0,5,0,20,8,0,10,0,12,0,23,9,0,3,0,25,8,0,1,0,5,0,28,8,0,10,0,12,0,31,9,0,1,0,1,0,1,1,1,1,1,1,1,1,5,1,39,8,1,10,1,12,1,42,9,1,3,1,44,8,1,1,1,1,1,3,1,48,8,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,3,2,58,8,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,5,2,107,8,2,10,2,12,2,110,9,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,5,2,119,8,2,10,2,12,2,122,9,2,3,2,124,8,2,1,2,5,2,127,8,2,10,2,12,2,130,9,2,1,2,0,1,4,3,0,2,4,0,6,1,0,9,14,2,0,14,14,16,17,1,0,11,12,1,0,18,19,1,0,20,23,1,0,24,25,157,0,9,1,0,0,0,2,47,1,0,0,0,4,57,1,0,0,0,6,8,5,33,0,0,7,6,1,0,0,0,8,11,1,0,0,0,9,7,1,0,0,0,9,10,1,0,0,0,10,24,1,0,0,0,11,9,1,0,0,0,12,21,3,2,1,0,13,15,5,33,0,0,14,13,1,0,0,0,15,16,1,0,0,0,16,14,1,0,0,0,16,17,1,0,0,0,17,18,1,0,0,0,18,20,3,2,1,0,19,14,1,0,0,0,20,23,1,0,0,0,21,19,1,0,0,0,21,22,1,0,0,0,22,25,1,0,0,0,23,21,1,0,0,0,24,12,1,0,0,0,24,25,1,0,0,0,25,29,1,0,0,0,26,28,5,33,0,0,27,26,1,0,0,0,28,31,1,0,0,0,29,27,1,0,0,0,29,30,1,0,0,0,30,32,1,0,0,0,31,29,1,0,0,0,32,33,5,0,0,1,33,1,1,0,0,0,34,48,3,4,2,0,35,40,3,4,2,0,36,37,5,1,0,0,37,39,3,4,2,0,38,36,1,0,0,0,39,42,1,0,0,0,40,38,1,0,0,0,40,41,1,0,0,0,41,44,1,0,0,0,42,40,1,0,0,0,43,35,1,0,0,0,43,44,1,0,0,0,44,45,1,0,0,0,45,46,5,2,0,0,46,48,3,4,2,0,47,34,1,0,0,0,47,43,1,0,0,0,48,3,1,0,0,0,49,50,6,2,-1,0,50,58,5,34,0,0,51,52,5,3,0,0,52,53,3,4,2,0,53,54,5,4,0,0,54,58,1,0,0,0,55,56,7,0,0,0,56,58,3,4,2,13,57,49,1,0,0,0,57,51,1,0,0,0,57,55,1,0,0,0,58,128,1,0,0,0,59,60,10,17,0,0,60,61,5,5,0,0,61,127,3,4,2,18,62,63,10,16,0,0,63,64,5,6,0,0,64,127,3,4,2,17,65,66,10,12,0,0,66,67,5,15,0,0,67,127,3,4,2,13,68,69,10,11,0,0,69,70,7,1,0,0,70,127,3,4,2,12,71,72,10,10,0,0,72,73,7,2,0,0,73,127,3,4,2,11,74,75,10,9,0,0,75,76,7,3,0,0,76,127,3,4,2,10,77,78,10,8,0,0,78,79,7,4,0,0,79,127,3,4,2,9,80,81,10,7,0,0,81,82,7,5,0,0,82,127,3,4,2,8,83,84,10,6,0,0,84,85,5,13,0,0,85,127,3,4,2,7,86,87,10,5,0,0,87,88,5,26,0,0,88,127,3,4,2,6,89,90,10,4,0,0,90,91,5,27,0,0,91,127,3,4,2,5,92,93,10,3,0,0,93,94,5,28,0,0,94,127,3,4,2,4,95,96,10,2,0,0,96,97,5,29,0,0,97,127,3,4,2,3,98,99,10,1,0,0,99,100,5,30,0,0,100,127,3,4,2,2,101,102,10,15,0,0,102,103,5,7,0,0,103,108,3,4,2,0,104,105,5,1,0,0,105,107,3,4,2,0,106,104,1,0,0,0,107,110,1,0,0,0,108,106,1,0,0,0,108,109,1,0,0,0,109,111,1,0,0,0,110,108,1,0,0,0,111,112,5,8,0,0,112,127,1,0,0,0,113,114,10,14,0,0,114,123,5,3,0,0,115,120,3,4,2,0,116,117,5,1,0,0,117,119,3,4,2,0,118,116,1,0,0,0,119,122,1,0,0,0,120,118,1,0,0,0,120,121,1,0,0,0,121,124,1,0,0,0,122,120,1,0,0,0,123,115,1,0,0,0,123,124,1,0,0,0,124,125,1,0,0,0,125,127,5,4,0,0,126,59,1,0,0,0,126,62,1,0,0,0,126,65,1,0,0,0,126,68,1,0,0,0,126,71,1,0,0,0,126,74,1,0,0,0,126,77,1,0,0,0,126,80,1,0,0,0,126,83,1,0,0,0,126,86,1,0,0,0,126,89,1,0,0,0,126,92,1,0,0,0,126,95,1,0,0,0,126,98,1,0,0,0,126,101,1,0,0,0,126,113,1,0,0,0,127,130,1,0,0,0,128,126,1,0,0,0,128,129,1,0,0,0,129,5,1,0,0,0,130,128,1,0,0,0,14,9,16,21,24,29,40,43,47,57,108,120,123,126,128]),es=ts.decisionToState.map((e,t)=>new je.dfa.DFA(e,t)),ss=new je.atn.PredictionContextCache;class ns extends je.Parser{static grammarFileName="Dsp.g4";static literalNames=[null,"','","'->'","'('","')'","'::'","'.'","'['","']'","'~'","'!'","'-'","'+'","'&'","'*'","'.*'","'/'","'%'","'<<'","'>>'","'<'","'>'","'<='","'>='","'=='","'!='","'^'","'|'","'&&'","'||'","'='"];static symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"WHITESPACE","COMMENT","NEWLINE","SYMBOL"];static ruleNames=["rule_pool","rule","term"];constructor(e){super(e),this._interp=new je.atn.ParserATNSimulator(this,ts,es,ss),this.ruleNames=ns.ruleNames,this.literalNames=ns.literalNames,this.symbolicNames=ns.symbolicNames}sempred(e,t,r){if(2===t)return this.term_sempred(e,r);throw"No predicate with index:"+t}term_sempred(e,t){switch(t){case 0:return this.precpred(this._ctx,17);case 1:return this.precpred(this._ctx,16);case 2:return this.precpred(this._ctx,12);case 3:return this.precpred(this._ctx,11);case 4:return this.precpred(this._ctx,10);case 5:return this.precpred(this._ctx,9);case 6:return this.precpred(this._ctx,8);case 7:return this.precpred(this._ctx,7);case 8:return this.precpred(this._ctx,6);case 9:return this.precpred(this._ctx,5);case 10:return this.precpred(this._ctx,4);case 11:return this.precpred(this._ctx,3);case 12:return this.precpred(this._ctx,2);case 13:return this.precpred(this._ctx,1);case 14:return this.precpred(this._ctx,15);case 15:return this.precpred(this._ctx,14);default:throw"No predicate with index:"+t}}rule_pool(){let e=new is(this,this._ctx,this.state);this.enterRule(e,0,ns.RULE_rule_pool);var t=0;try{this.enterOuterAlt(e,1),this.state=9,this._errHandler.sync(this);for(var r=this._interp.adaptivePredict(this._input,0,this._ctx);2!=r&&r!=je.atn.ATN.INVALID_ALT_NUMBER;)1===r&&(this.state=6,this.match(ns.NEWLINE)),this.state=11,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,0,this._ctx);if(this.state=24,this._errHandler.sync(this),!(-32&(t=this._input.LA(1)))&&1<<t&32268||34===t)for(this.state=12,this.rule_(),this.state=21,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,2,this._ctx);2!=r&&r!=je.atn.ATN.INVALID_ALT_NUMBER;){if(1===r){this.state=14,this._errHandler.sync(this),t=this._input.LA(1);do{this.state=13,this.match(ns.NEWLINE),this.state=16,this._errHandler.sync(this),t=this._input.LA(1)}while(33===t);this.state=18,this.rule_()}this.state=23,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,2,this._ctx)}for(this.state=29,this._errHandler.sync(this),t=this._input.LA(1);33===t;)this.state=26,this.match(ns.NEWLINE),this.state=31,this._errHandler.sync(this),t=this._input.LA(1);this.state=32,this.match(ns.EOF)}catch(t){if(!(t instanceof je.error.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}rule_(){let e=new rs(this,this._ctx,this.state);this.enterRule(e,2,ns.RULE_rule);var t=0;try{switch(this.state=47,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,7,this._ctx)){case 1:this.enterOuterAlt(e,1),this.state=34,this.term(0);break;case 2:if(this.enterOuterAlt(e,2),this.state=43,this._errHandler.sync(this),!((t=this._input.LA(1))-3&-32)&&1<<t-3&2147487681)for(this.state=35,this.term(0),this.state=40,this._errHandler.sync(this),t=this._input.LA(1);1===t;)this.state=36,this.match(ns.T__0),this.state=37,this.term(0),this.state=42,this._errHandler.sync(this),t=this._input.LA(1);this.state=45,this.match(ns.T__1),this.state=46,this.term(0)}}catch(t){if(!(t instanceof je.error.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}term(e){void 0===e&&(e=0);const t=this._ctx,r=this.state;let n=new os(this,this._ctx,r),i=n;this.enterRecursionRule(n,4,ns.RULE_term,e);var s=0;try{switch(this.enterOuterAlt(n,1),this.state=57,this._errHandler.sync(this),this._input.LA(1)){case 34:n=new as(this,n),this._ctx=n,i=n,this.state=50,this.match(ns.SYMBOL);break;case 3:n=new ls(this,n),this._ctx=n,i=n,this.state=51,this.match(ns.T__2),this.state=52,this.term(0),this.state=53,this.match(ns.T__3);break;case 9:case 10:case 11:case 12:case 13:case 14:n=new ds(this,n),this._ctx=n,i=n,this.state=55,-32&(s=this._input.LA(1))||!(1<<s&32256)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=56,this.term(13);break;default:throw new je.error.NoViableAltException(this)}this._ctx.stop=this._input.LT(-1),this.state=128,this._errHandler.sync(this);for(var a=this._interp.adaptivePredict(this._input,13,this._ctx);2!=a&&a!=je.atn.ATN.INVALID_ALT_NUMBER;){if(1===a)switch(null!==this._parseListeners&&this.triggerExitRuleEvent(),i=n,this.state=126,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,12,this._ctx)){case 1:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=59,!this.precpred(this._ctx,17))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 17)");this.state=60,this.match(ns.T__4),this.state=61,this.term(18);break;case 2:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=62,!this.precpred(this._ctx,16))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 16)");this.state=63,this.match(ns.T__5),this.state=64,this.term(17);break;case 3:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=65,!this.precpred(this._ctx,12))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 12)");this.state=66,this.match(ns.T__14),this.state=67,this.term(13);break;case 4:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=68,!this.precpred(this._ctx,11))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 11)");this.state=69,-32&(s=this._input.LA(1))||!(1<<s&212992)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=70,this.term(12);break;case 5:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=71,!this.precpred(this._ctx,10))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 10)");this.state=72,11!==(s=this._input.LA(1))&&12!==s?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=73,this.term(11);break;case 6:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=74,!this.precpred(this._ctx,9))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 9)");this.state=75,18!==(s=this._input.LA(1))&&19!==s?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=76,this.term(10);break;case 7:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=77,!this.precpred(this._ctx,8))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 8)");this.state=78,-32&(s=this._input.LA(1))||!(1<<s&15728640)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=79,this.term(9);break;case 8:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=80,!this.precpred(this._ctx,7))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 7)");this.state=81,24!==(s=this._input.LA(1))&&25!==s?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=82,this.term(8);break;case 9:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=83,!this.precpred(this._ctx,6))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 6)");this.state=84,this.match(ns.T__12),this.state=85,this.term(7);break;case 10:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=86,!this.precpred(this._ctx,5))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 5)");this.state=87,this.match(ns.T__25),this.state=88,this.term(6);break;case 11:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=89,!this.precpred(this._ctx,4))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 4)");this.state=90,this.match(ns.T__26),this.state=91,this.term(5);break;case 12:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=92,!this.precpred(this._ctx,3))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 3)");this.state=93,this.match(ns.T__27),this.state=94,this.term(4);break;case 13:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=95,!this.precpred(this._ctx,2))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 2)");this.state=96,this.match(ns.T__28),this.state=97,this.term(3);break;case 14:if(n=new cs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=98,!this.precpred(this._ctx,1))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 1)");this.state=99,this.match(ns.T__29),this.state=100,this.term(2);break;case 15:if(n=new hs(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=101,!this.precpred(this._ctx,15))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 15)");for(this.state=102,this.match(ns.T__6),this.state=103,this.term(0),this.state=108,this._errHandler.sync(this),s=this._input.LA(1);1===s;)this.state=104,this.match(ns.T__0),this.state=105,this.term(0),this.state=110,this._errHandler.sync(this),s=this._input.LA(1);this.state=111,this.match(ns.T__7);break;case 16:if(n=new us(this,new os(this,t,r)),this.pushNewRecursionContext(n,4,ns.RULE_term),this.state=113,!this.precpred(this._ctx,14))throw new je.error.FailedPredicateException(this,"this.precpred(this._ctx, 14)");if(this.state=114,this.match(ns.T__2),this.state=123,this._errHandler.sync(this),!((s=this._input.LA(1))-3&-32)&&1<<s-3&2147487681)for(this.state=115,this.term(0),this.state=120,this._errHandler.sync(this),s=this._input.LA(1);1===s;)this.state=116,this.match(ns.T__0),this.state=117,this.term(0),this.state=122,this._errHandler.sync(this),s=this._input.LA(1);this.state=125,this.match(ns.T__3)}this.state=130,this._errHandler.sync(this),a=this._interp.adaptivePredict(this._input,13,this._ctx)}}catch(e){if(!(e instanceof je.error.RecognitionException))throw e;n.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.unrollRecursionContexts(t)}return n}}ns.EOF=je.Token.EOF,ns.T__0=1,ns.T__1=2,ns.T__2=3,ns.T__3=4,ns.T__4=5,ns.T__5=6,ns.T__6=7,ns.T__7=8,ns.T__8=9,ns.T__9=10,ns.T__10=11,ns.T__11=12,ns.T__12=13,ns.T__13=14,ns.T__14=15,ns.T__15=16,ns.T__16=17,ns.T__17=18,ns.T__18=19,ns.T__19=20,ns.T__20=21,ns.T__21=22,ns.T__22=23,ns.T__23=24,ns.T__24=25,ns.T__25=26,ns.T__26=27,ns.T__27=28,ns.T__28=29,ns.T__29=30,ns.WHITESPACE=31,ns.COMMENT=32,ns.NEWLINE=33,ns.SYMBOL=34,ns.RULE_rule_pool=0,ns.RULE_rule=1,ns.RULE_term=2;let is=class extends je.ParserRuleContext{constructor(e,t,r){void 0===t&&(t=null),null==r&&(r=-1),super(t,r),this.parser=e,this.ruleIndex=ns.RULE_rule_pool}EOF(){return this.getToken(ns.EOF,0)}NEWLINE=function(e){return void 0===e&&(e=null),null===e?this.getTokens(ns.NEWLINE):this.getToken(ns.NEWLINE,e)};rule_=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(rs):this.getTypedRuleContext(rs,e)};accept(e){return e instanceof Ze?e.visitRule_pool(this):e.visitChildren(this)}},rs=class extends je.ParserRuleContext{constructor(e,t,r){void 0===t&&(t=null),null==r&&(r=-1),super(t,r),this.parser=e,this.ruleIndex=ns.RULE_rule}term=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(os):this.getTypedRuleContext(os,e)};accept(e){return e instanceof Ze?e.visitRule(this):e.visitChildren(this)}},os=class extends je.ParserRuleContext{constructor(e,t,r){void 0===t&&(t=null),null==r&&(r=-1),super(t,r),this.parser=e,this.ruleIndex=ns.RULE_term}copyFrom(e){super.copyFrom(e)}},as=class extends os{constructor(e,t){super(e),super.copyFrom(t)}SYMBOL(){return this.getToken(ns.SYMBOL,0)}accept(e){return e instanceof Ze?e.visitSymbol(this):e.visitChildren(this)}};ns.SymbolContext=as;class ls extends os{constructor(e,t){super(e),super.copyFrom(t)}term(){return this.getTypedRuleContext(os,0)}accept(e){return e instanceof Ze?e.visitParentheses(this):e.visitChildren(this)}}ns.ParenthesesContext=ls;let hs=class extends os{constructor(e,t){super(e),super.copyFrom(t)}term=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(os):this.getTypedRuleContext(os,e)};accept(e){return e instanceof Ze?e.visitSubscript(this):e.visitChildren(this)}};ns.SubscriptContext=hs;let cs=class extends os{constructor(e,t){super(e),super.copyFrom(t)}term=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(os):this.getTypedRuleContext(os,e)};accept(e){return e instanceof Ze?e.visitBinary(this):e.visitChildren(this)}};ns.BinaryContext=cs;let us=class extends os{constructor(e,t){super(e),super.copyFrom(t)}term=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(os):this.getTypedRuleContext(os,e)};accept(e){return e instanceof Ze?e.visitFunction(this):e.visitChildren(this)}};ns.FunctionContext=us;let ds=class extends os{constructor(e,t){super(e),super.copyFrom(t)}term(){return this.getTypedRuleContext(os,0)}accept(e){return e instanceof Ze?e.visitUnary(this):e.visitChildren(this)}};ns.UnaryContext=ds,ns.Rule_poolContext=is,ns.RuleContext=rs,ns.TermContext=os;const ps=(new je.atn.ATNDeserializer).deserialize([4,0,10,93,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,5,5,5,64,8,5,10,5,12,5,67,9,5,1,6,4,6,70,8,6,11,6,12,6,71,1,6,1,6,1,7,1,7,1,7,1,7,5,7,80,8,7,10,7,12,7,83,9,7,1,7,1,7,1,8,1,8,1,9,4,9,90,8,9,11,9,12,9,91,0,0,10,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,1,0,3,2,0,9,9,32,32,2,0,10,10,13,13,7,0,9,10,13,13,32,32,40,41,44,44,91,91,93,93,96,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,1,21,1,0,0,0,3,32,1,0,0,0,5,34,1,0,0,0,7,44,1,0,0,0,9,51,1,0,0,0,11,59,1,0,0,0,13,69,1,0,0,0,15,75,1,0,0,0,17,86,1,0,0,0,19,89,1,0,0,0,21,22,5,40,0,0,22,23,5,115,0,0,23,24,5,117,0,0,24,25,5,98,0,0,25,26,5,115,0,0,26,27,5,99,0,0,27,28,5,114,0,0,28,29,5,105,0,0,29,30,5,112,0,0,30,31,5,116,0,0,31,2,1,0,0,0,32,33,5,41,0,0,33,4,1,0,0,0,34,35,5,40,0,0,35,36,5,102,0,0,36,37,5,117,0,0,37,38,5,110,0,0,38,39,5,99,0,0,39,40,5,116,0,0,40,41,5,105,0,0,41,42,5,111,0,0,42,43,5,110,0,0,43,6,1,0,0,0,44,45,5,40,0,0,45,46,5,117,0,0,46,47,5,110,0,0,47,48,5,97,0,0,48,49,5,114,0,0,49,50,5,121,0,0,50,8,1,0,0,0,51,52,5,40,0,0,52,53,5,98,0,0,53,54,5,105,0,0,54,55,5,110,0,0,55,56,5,97,0,0,56,57,5,114,0,0,57,58,5,121,0,0,58,10,1,0,0,0,59,60,5,45,0,0,60,61,5,45,0,0,61,65,1,0,0,0,62,64,5,45,0,0,63,62,1,0,0,0,64,67,1,0,0,0,65,63,1,0,0,0,65,66,1,0,0,0,66,12,1,0,0,0,67,65,1,0,0,0,68,70,7,0,0,0,69,68,1,0,0,0,70,71,1,0,0,0,71,69,1,0,0,0,71,72,1,0,0,0,72,73,1,0,0,0,73,74,6,6,0,0,74,14,1,0,0,0,75,76,5,47,0,0,76,77,5,47,0,0,77,81,1,0,0,0,78,80,8,1,0,0,79,78,1,0,0,0,80,83,1,0,0,0,81,79,1,0,0,0,81,82,1,0,0,0,82,84,1,0,0,0,83,81,1,0,0,0,84,85,6,7,0,0,85,16,1,0,0,0,86,87,7,1,0,0,87,18,1,0,0,0,88,90,8,2,0,0,89,88,1,0,0,0,90,91,1,0,0,0,91,89,1,0,0,0,91,92,1,0,0,0,92,20,1,0,0,0,5,0,65,71,81,91,1,6,0,0]),gs=ps.decisionToState.map((e,t)=>new je.dfa.DFA(e,t));class fs extends je.Lexer{static grammarFileName="Ds.g4";static channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"];static modeNames=["DEFAULT_MODE"];static literalNames=[null,"'(subscript'","')'","'(function'","'(unary'","'(binary'"];static symbolicNames=[null,null,null,null,null,null,"RULE","WHITESPACE","COMMENT","NEWLINE","SYMBOL"];static ruleNames=["T__0","T__1","T__2","T__3","T__4","RULE","WHITESPACE","COMMENT","NEWLINE","SYMBOL"];constructor(e){super(e),this._interp=new je.atn.LexerATNSimulator(this,ps,gs,new je.atn.PredictionContextCache)}}fs.EOF=je.Token.EOF,fs.T__0=1,fs.T__1=2,fs.T__2=3,fs.T__3=4,fs.T__4=5,fs.RULE=6,fs.WHITESPACE=7,fs.COMMENT=8,fs.NEWLINE=9,fs.SYMBOL=10;class xs extends je.tree.ParseTreeVisitor{visitRule_pool(e){return this.visitChildren(e)}visitRule(e){return this.visitChildren(e)}visitSymbol(e){return this.visitChildren(e)}visitSubscript(e){return this.visitChildren(e)}visitFunction(e){return this.visitChildren(e)}visitUnary(e){return this.visitChildren(e)}visitBinary(e){return this.visitChildren(e)}}const _s=(new je.atn.ATNDeserializer).deserialize([4,1,10,80,2,0,7,0,2,1,7,1,2,2,7,2,1,0,5,0,8,8,0,10,0,12,0,11,9,0,1,0,1,0,4,0,15,8,0,11,0,12,0,16,1,0,5,0,20,8,0,10,0,12,0,23,9,0,3,0,25,8,0,1,0,5,0,28,8,0,10,0,12,0,31,9,0,1,0,1,0,1,1,1,1,4,1,37,8,1,11,1,12,1,38,5,1,41,8,1,10,1,12,1,44,9,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,5,2,53,8,2,10,2,12,2,56,9,2,1,2,1,2,1,2,5,2,61,8,2,10,2,12,2,64,9,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,3,2,78,8,2,1,2,0,0,3,0,2,4,0,0,89,0,9,1,0,0,0,2,42,1,0,0,0,4,77,1,0,0,0,6,8,5,9,0,0,7,6,1,0,0,0,8,11,1,0,0,0,9,7,1,0,0,0,9,10,1,0,0,0,10,24,1,0,0,0,11,9,1,0,0,0,12,21,3,2,1,0,13,15,5,9,0,0,14,13,1,0,0,0,15,16,1,0,0,0,16,14,1,0,0,0,16,17,1,0,0,0,17,18,1,0,0,0,18,20,3,2,1,0,19,14,1,0,0,0,20,23,1,0,0,0,21,19,1,0,0,0,21,22,1,0,0,0,22,25,1,0,0,0,23,21,1,0,0,0,24,12,1,0,0,0,24,25,1,0,0,0,25,29,1,0,0,0,26,28,5,9,0,0,27,26,1,0,0,0,28,31,1,0,0,0,29,27,1,0,0,0,29,30,1,0,0,0,30,32,1,0,0,0,31,29,1,0,0,0,32,33,5,0,0,1,33,1,1,0,0,0,34,36,3,4,2,0,35,37,5,9,0,0,36,35,1,0,0,0,37,38,1,0,0,0,38,36,1,0,0,0,38,39,1,0,0,0,39,41,1,0,0,0,40,34,1,0,0,0,41,44,1,0,0,0,42,40,1,0,0,0,42,43,1,0,0,0,43,45,1,0,0,0,44,42,1,0,0,0,45,46,5,6,0,0,46,47,5,9,0,0,47,48,3,4,2,0,48,3,1,0,0,0,49,78,5,10,0,0,50,54,5,1,0,0,51,53,3,4,2,0,52,51,1,0,0,0,53,56,1,0,0,0,54,52,1,0,0,0,54,55,1,0,0,0,55,57,1,0,0,0,56,54,1,0,0,0,57,78,5,2,0,0,58,62,5,3,0,0,59,61,3,4,2,0,60,59,1,0,0,0,61,64,1,0,0,0,62,60,1,0,0,0,62,63,1,0,0,0,63,65,1,0,0,0,64,62,1,0,0,0,65,78,5,2,0,0,66,67,5,4,0,0,67,68,5,10,0,0,68,69,3,4,2,0,69,70,5,2,0,0,70,78,1,0,0,0,71,72,5,5,0,0,72,73,5,10,0,0,73,74,3,4,2,0,74,75,3,4,2,0,75,76,5,2,0,0,76,78,1,0,0,0,77,49,1,0,0,0,77,50,1,0,0,0,77,58,1,0,0,0,77,66,1,0,0,0,77,71,1,0,0,0,78,5,1,0,0,0,10,9,16,21,24,29,38,42,54,62,77]),Ts=_s.decisionToState.map((e,t)=>new je.dfa.DFA(e,t)),ms=new je.atn.PredictionContextCache;class Es extends je.Parser{static grammarFileName="Ds.g4";static literalNames=[null,"'(subscript'","')'","'(function'","'(unary'","'(binary'"];static symbolicNames=[null,null,null,null,null,null,"RULE","WHITESPACE","COMMENT","NEWLINE","SYMBOL"];static ruleNames=["rule_pool","rule","term"];constructor(e){super(e),this._interp=new je.atn.ParserATNSimulator(this,_s,Ts,ms),this.ruleNames=Es.ruleNames,this.literalNames=Es.literalNames,this.symbolicNames=Es.symbolicNames}rule_pool(){let e=new Ss(this,this._ctx,this.state);this.enterRule(e,0,Es.RULE_rule_pool);var t=0;try{this.enterOuterAlt(e,1),this.state=9,this._errHandler.sync(this);for(var r=this._interp.adaptivePredict(this._input,0,this._ctx);2!=r&&r!=je.atn.ATN.INVALID_ALT_NUMBER;)1===r&&(this.state=6,this.match(Es.NEWLINE)),this.state=11,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,0,this._ctx);if(this.state=24,this._errHandler.sync(this),!(-32&(t=this._input.LA(1)))&&1<<t&1146)for(this.state=12,this.rule_(),this.state=21,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,2,this._ctx);2!=r&&r!=je.atn.ATN.INVALID_ALT_NUMBER;){if(1===r){this.state=14,this._errHandler.sync(this),t=this._input.LA(1);do{this.state=13,this.match(Es.NEWLINE),this.state=16,this._errHandler.sync(this),t=this._input.LA(1)}while(9===t);this.state=18,this.rule_()}this.state=23,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,2,this._ctx)}for(this.state=29,this._errHandler.sync(this),t=this._input.LA(1);9===t;)this.state=26,this.match(Es.NEWLINE),this.state=31,this._errHandler.sync(this),t=this._input.LA(1);this.state=32,this.match(Es.EOF)}catch(t){if(!(t instanceof je.error.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}rule_(){let e=new Cs(this,this._ctx,this.state);this.enterRule(e,2,Es.RULE_rule);var t=0;try{for(this.enterOuterAlt(e,1),this.state=42,this._errHandler.sync(this),t=this._input.LA(1);!(-32&t)&&1<<t&1082;){this.state=34,this.term(),this.state=36,this._errHandler.sync(this),t=this._input.LA(1);do{this.state=35,this.match(Es.NEWLINE),this.state=38,this._errHandler.sync(this),t=this._input.LA(1)}while(9===t);this.state=44,this._errHandler.sync(this),t=this._input.LA(1)}this.state=45,this.match(Es.RULE),this.state=46,this.match(Es.NEWLINE),this.state=47,this.term()}catch(t){if(!(t instanceof je.error.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}term(){let e=new As(this,this._ctx,this.state);this.enterRule(e,4,Es.RULE_term);var t=0;try{switch(this.state=77,this._errHandler.sync(this),this._input.LA(1)){case 10:e=new Ns(this,e),this.enterOuterAlt(e,1),this.state=49,this.match(Es.SYMBOL);break;case 1:for(e=new ys(this,e),this.enterOuterAlt(e,2),this.state=50,this.match(Es.T__0),this.state=54,this._errHandler.sync(this),t=this._input.LA(1);!(-32&t)&&1<<t&1082;)this.state=51,this.term(),this.state=56,this._errHandler.sync(this),t=this._input.LA(1);this.state=57,this.match(Es.T__1);break;case 3:for(e=new Ls(this,e),this.enterOuterAlt(e,3),this.state=58,this.match(Es.T__2),this.state=62,this._errHandler.sync(this),t=this._input.LA(1);!(-32&t)&&1<<t&1082;)this.state=59,this.term(),this.state=64,this._errHandler.sync(this),t=this._input.LA(1);this.state=65,this.match(Es.T__1);break;case 4:e=new ks(this,e),this.enterOuterAlt(e,4),this.state=66,this.match(Es.T__3),this.state=67,this.match(Es.SYMBOL),this.state=68,this.term(),this.state=69,this.match(Es.T__1);break;case 5:e=new Is(this,e),this.enterOuterAlt(e,5),this.state=71,this.match(Es.T__4),this.state=72,this.match(Es.SYMBOL),this.state=73,this.term(),this.state=74,this.term(),this.state=75,this.match(Es.T__1);break;default:throw new je.error.NoViableAltException(this)}}catch(t){if(!(t instanceof je.error.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}}Es.EOF=je.Token.EOF,Es.T__0=1,Es.T__1=2,Es.T__2=3,Es.T__3=4,Es.T__4=5,Es.RULE=6,Es.WHITESPACE=7,Es.COMMENT=8,Es.NEWLINE=9,Es.SYMBOL=10,Es.RULE_rule_pool=0,Es.RULE_rule=1,Es.RULE_term=2;class Ss extends je.ParserRuleContext{constructor(e,t,r){void 0===t&&(t=null),null==r&&(r=-1),super(t,r),this.parser=e,this.ruleIndex=Es.RULE_rule_pool}EOF(){return this.getToken(Es.EOF,0)}NEWLINE=function(e){return void 0===e&&(e=null),null===e?this.getTokens(Es.NEWLINE):this.getToken(Es.NEWLINE,e)};rule_=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(Cs):this.getTypedRuleContext(Cs,e)};accept(e){return e instanceof xs?e.visitRule_pool(this):e.visitChildren(this)}}class Cs extends je.ParserRuleContext{constructor(e,t,r){void 0===t&&(t=null),null==r&&(r=-1),super(t,r),this.parser=e,this.ruleIndex=Es.RULE_rule}RULE(){return this.getToken(Es.RULE,0)}NEWLINE=function(e){return void 0===e&&(e=null),null===e?this.getTokens(Es.NEWLINE):this.getToken(Es.NEWLINE,e)};term=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(As):this.getTypedRuleContext(As,e)};accept(e){return e instanceof xs?e.visitRule(this):e.visitChildren(this)}}class As extends je.ParserRuleContext{constructor(e,t,r){void 0===t&&(t=null),null==r&&(r=-1),super(t,r),this.parser=e,this.ruleIndex=Es.RULE_term}copyFrom(e){super.copyFrom(e)}}class Ns extends As{constructor(e,t){super(e),super.copyFrom(t)}SYMBOL(){return this.getToken(Es.SYMBOL,0)}accept(e){return e instanceof xs?e.visitSymbol(this):e.visitChildren(this)}}Es.SymbolContext=Ns;class ys extends As{constructor(e,t){super(e),super.copyFrom(t)}term=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(As):this.getTypedRuleContext(As,e)};accept(e){return e instanceof xs?e.visitSubscript(this):e.visitChildren(this)}}Es.SubscriptContext=ys;class Ls extends As{constructor(e,t){super(e),super.copyFrom(t)}term=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(As):this.getTypedRuleContext(As,e)};accept(e){return e instanceof xs?e.visitFunction(this):e.visitChildren(this)}}Es.FunctionContext=Ls;class Is extends As{constructor(e,t){super(e),super.copyFrom(t)}SYMBOL(){return this.getToken(Es.SYMBOL,0)}term=function(e){return void 0===e&&(e=null),null===e?this.getTypedRuleContexts(As):this.getTypedRuleContext(As,e)};accept(e){return e instanceof xs?e.visitBinary(this):e.visitChildren(this)}}Es.BinaryContext=Is;class ks extends As{constructor(e,t){super(e),super.copyFrom(t)}SYMBOL(){return this.getToken(Es.SYMBOL,0)}term(){return this.getTypedRuleContext(As,0)}accept(e){return e instanceof xs?e.visitUnary(this):e.visitChildren(this)}}Es.UnaryContext=ks,Es.Rule_poolContext=Ss,Es.RuleContext=Cs,Es.TermContext=As;class vs extends Ge{syntaxError(e,t,r,n,i,s){throw new Error(`line ${r}:${n} ${i}`)}}class ws extends Ze{visitRule_pool(e){return e.rule_().map(e=>this.visit(e)).join("\n\n")}visitRule(e){const t=e.term().map(e=>this.visit(e));if(1===t.length)return`----\n${t[0]}`;{const e=t.pop(),r=Math.max(...t.map(e=>e.length));return t.push("-".repeat(Math.max(r,4))),t.push(e),t.join("\n")}}visitSymbol(e){return e.SYMBOL().getText()}visitParentheses(e){return this.visit(e.term())}visitSubscript(e){return`(subscript ${e.term().map(e=>this.visit(e)).join(" ")})`}visitFunction(e){return`(function ${e.term().map(e=>this.visit(e)).join(" ")})`}visitUnary(e){return`(unary ${e.getChild(0).getText()} ${this.visit(e.term())})`}visitBinary(e){return`(binary ${e.getChild(1).getText()} ${this.visit(e.term(0))} ${this.visit(e.term(1))})`}}class Rs extends xs{visitRule_pool(e){return e.rule_().map(e=>this.visit(e)).join("\n")}visitRule(e){const t=e.term().map(e=>this.visit(e)),r=t.pop();return t.join(", ")+" -> "+r}visitSymbol(e){return e.SYMBOL().getText()}visitSubscript(e){return`${this.visit(e.term(0))}[${e.term().slice(1).map(e=>this.visit(e)).join(", ")}]`}visitFunction(e){return`${this.visit(e.term(0))}(${e.term().slice(1).map(e=>this.visit(e)).join(", ")})`}visitUnary(e){return`(${e.getChild(1).getText()} ${this.visit(e.term())})`}visitBinary(e){return`(${this.visit(e.term(0))} ${e.getChild(1).getText()} ${this.visit(e.term(1))})`}}function Os(e){const t=new $e(e),r=new Qe(t);r.removeErrorListeners(),r.addErrorListener(new vs);const n=new We(r),i=new ns(n);i.removeErrorListeners(),i.addErrorListener(new vs);const s=i.rule_pool();return(new ws).visit(s)}function Ps(e){const t=new $e(e),r=new fs(t);r.removeErrorListeners(),r.addErrorListener(new vs);const n=new We(r),i=new Es(n);i.removeErrorListeners(),i.addErrorListener(new vs);const s=i.rule_pool();return(new Rs).visit(s)}function varint64read(){let e=0,t=0;for(let r=0;r<28;r+=7){let n=this.buf[this.pos++];if(e|=(127&n)<<r,!(128&n))return this.assertBounds(),[e,t]}let r=this.buf[this.pos++];if(e|=(15&r)<<28,t=(112&r)>>4,!(128&r))return this.assertBounds(),[e,t];for(let r=3;r<=31;r+=7){let n=this.buf[this.pos++];if(t|=(127&n)<<r,!(128&n))return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function varint64write(e,t,r){for(let n=0;n<28;n+=7){const i=e>>>n,s=!(i>>>7==0&&0==t),a=255&(s?128|i:i);if(r.push(a),!s)return}const n=e>>>28&15|(7&t)<<4,i=!!(t>>3);if(r.push(255&(i?128|n:n)),i){for(let e=3;e<31;e+=7){const n=t>>>e,i=!(n>>>7==0),s=255&(i?128|n:n);if(r.push(s),!i)return}r.push(t>>>31&1)}}const TWO_PWR_32_DBL=4294967296;function int64FromString(e){const t="-"===e[0];t&&(e=e.slice(1));const r=1e6;let n=0,i=0;function s(t,s){const a=Number(e.slice(t,s));i*=r,n=n*r+a,n>=TWO_PWR_32_DBL&&(i+=n/TWO_PWR_32_DBL|0,n%=TWO_PWR_32_DBL)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),t?negate(n,i):newBits(n,i)}function int64ToString(e,t){let r=newBits(e,t);const n=2147483648&r.hi;n&&(r=negate(r.lo,r.hi));const i=uInt64ToString(r.lo,r.hi);return n?"-"+i:i}function uInt64ToString(e,t){if(({lo:e,hi:t}=toUnsigned(e,t)),t<=2097151)return String(TWO_PWR_32_DBL*t+e);const r=16777215&(e>>>24|t<<8),n=t>>16&65535;let i=(16777215&e)+6777216*r+6710656*n,s=r+8147497*n,a=2*n;const o=1e7;return i>=o&&(s+=Math.floor(i/o),i%=o),s>=o&&(a+=Math.floor(s/o),s%=o),a.toString()+decimalFrom1e7WithLeadingZeros(s)+decimalFrom1e7WithLeadingZeros(i)}function toUnsigned(e,t){return{lo:e>>>0,hi:t>>>0}}function newBits(e,t){return{lo:0|e,hi:0|t}}function negate(e,t){return t=~t,e?e=1+~e:t+=1,newBits(e,t)}const decimalFrom1e7WithLeadingZeros=e=>{const t=String(e);return"0000000".slice(t.length)+t};function varint32write(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e)}else{for(let r=0;r<9;r++)t.push(127&e|128),e>>=7;t.push(1)}}function varint32read(){let e=this.buf[this.pos++],t=127&e;if(!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<7,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<14,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<21,!(128&e))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(15&e)<<28;for(let t=5;128&e&&t<10;t++)e=this.buf[this.pos++];if(128&e)throw new Error("invalid varint");return this.assertBounds(),t>>>0}const protoInt64=makeInt64Support();function makeInt64Support(){const e=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof e.getBigInt64&&"function"==typeof e.getBigUint64&&"function"==typeof e.setBigInt64&&"function"==typeof e.setBigUint64&&(!!globalThis.Deno||"object"!=typeof process||"object"!=typeof process.env||"1"!==process.env.BUF_BIGINT_DISABLE)){const t=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),n=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(e){const n="bigint"==typeof e?e:BigInt(e);if(n>r||n<t)throw new Error(`invalid int64: ${e}`);return n},uParse(e){const t="bigint"==typeof e?e:BigInt(e);if(t>i||t<n)throw new Error(`invalid uint64: ${e}`);return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec:(t,r)=>(e.setInt32(0,t,!0),e.setInt32(4,r,!0),e.getBigInt64(0,!0)),uDec:(t,r)=>(e.setInt32(0,t,!0),e.setInt32(4,r,!0),e.getBigUint64(0,!0))}}return{zero:"0",supported:!1,parse:e=>("string"!=typeof e&&(e=e.toString()),assertInt64String(e),e),uParse:e=>("string"!=typeof e&&(e=e.toString()),assertUInt64String(e),e),enc:e=>("string"!=typeof e&&(e=e.toString()),assertInt64String(e),int64FromString(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),assertUInt64String(e),int64FromString(e)),dec:(e,t)=>int64ToString(e,t),uDec:(e,t)=>uInt64ToString(e,t)}}function assertInt64String(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function assertUInt64String(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}const symbol=Symbol.for("@bufbuild/protobuf/text-encoding");function getTextEncoding(){if(null==globalThis[symbol]){const e=new globalThis.TextEncoder,t=new globalThis.TextDecoder;globalThis[symbol]={encodeUtf8:t=>e.encode(t),decodeUtf8:e=>t.decode(e),checkUtf8(e){try{return encodeURIComponent(e),!0}catch(e){return!1}}}}return globalThis[symbol]}var WireType;!function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"}(WireType||(WireType={}));const FLOAT32_MAX=34028234663852886e22,FLOAT32_MIN=-34028234663852886e22,UINT32_MAX=4294967295,INT32_MAX=2147483647,INT32_MIN=-2147483648;class BinaryWriter{constructor(e=getTextEncoding().encodeUtf8){this.encodeUtf8=e,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let e=0;for(let t=0;t<this.chunks.length;t++)e+=this.chunks[t].length;let t=new Uint8Array(e),r=0;for(let e=0;e<this.chunks.length;e++)t.set(this.chunks[e],r),r+=this.chunks[e].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(assertUInt32(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return assertInt32(e),varint32write(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.encodeUtf8(e);return this.uint32(t.byteLength),this.raw(t)}float(e){assertFloat32(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){assertUInt32(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){assertInt32(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return assertInt32(e),varint32write(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),n=protoInt64.enc(e);return r.setInt32(0,n.lo,!0),r.setInt32(4,n.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),n=protoInt64.uEnc(e);return r.setInt32(0,n.lo,!0),r.setInt32(4,n.hi,!0),this.raw(t)}int64(e){let t=protoInt64.enc(e);return varint64write(t.lo,t.hi,this.buf),this}sint64(e){const t=protoInt64.enc(e),r=t.hi>>31;return varint64write(t.lo<<1^r,(t.hi<<1|t.lo>>>31)^r,this.buf),this}uint64(e){const t=protoInt64.uEnc(e);return varint64write(t.lo,t.hi,this.buf),this}}class BinaryReader{constructor(e,t=getTextEncoding().decodeUtf8){this.decodeUtf8=t,this.varint64=varint64read,this.uint32=varint32read,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.uint32(),t=e>>>3,r=7&e;if(t<=0||r<0||r>5)throw new Error("illegal tag: field no "+t+" wire type "+r);return[t,r]}skip(e,t){let r=this.pos;switch(e){case WireType.Varint:for(;128&this.buf[this.pos++];);break;case WireType.Bit64:this.pos+=4;case WireType.Bit32:this.pos+=4;break;case WireType.LengthDelimited:let r=this.uint32();this.pos+=r;break;case WireType.StartGroup:for(;;){const[e,r]=this.tag();if(r===WireType.EndGroup){if(void 0!==t&&e!==t)throw new Error("invalid end group tag");break}this.skip(r,e)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(r,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return protoInt64.dec(...this.varint64())}uint64(){return protoInt64.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),r=-(1&e);return e=(e>>>1|(1&t)<<31)^r,t=t>>>1^r,protoInt64.dec(e,t)}bool(){let[e,t]=this.varint64();return 0!==e||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return protoInt64.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return protoInt64.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.decodeUtf8(this.bytes())}}function assertInt32(e){if("string"==typeof e)e=Number(e);else if("number"!=typeof e)throw new Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>INT32_MAX||e<INT32_MIN)throw new Error("invalid int32: "+e)}function assertUInt32(e){if("string"==typeof e)e=Number(e);else if("number"!=typeof e)throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>UINT32_MAX||e<0)throw new Error("invalid uint32: "+e)}function assertFloat32(e){if("string"==typeof e){const t=e;if(e=Number(e),Number.isNaN(e)&&"NaN"!==t)throw new Error("invalid float32: "+t)}else if("number"!=typeof e)throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>FLOAT32_MAX||e<FLOAT32_MIN))throw new Error("invalid float32: "+e)}var EngineKind;function engineKindFromJSON(e){switch(e){case 0:case"EAGER":return EngineKind.EAGER;case 1:case"LAZY":return EngineKind.LAZY;default:return EngineKind.UNRECOGNIZED}}function engineKindToJSON(e){switch(e){case EngineKind.EAGER:return"EAGER";case EngineKind.LAZY:return"LAZY";case EngineKind.UNRECOGNIZED:default:return"UNRECOGNIZED"}}function createBaseNode(){return{id:"",addr:""}}!function(e){e[e.EAGER=0]="EAGER",e[e.LAZY=1]="LAZY",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(EngineKind||(EngineKind={}));const Node={encode:(e,t=new BinaryWriter)=>(""!==e.id&&t.uint32(10).string(e.id),""!==e.addr&&t.uint32(18).string(e.addr),t),decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseNode();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:if(10!==e)break;i.id=r.string();continue;case 2:if(18!==e)break;i.addr=r.string();continue}if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({id:isSet(e.id)?globalThis.String(e.id):"",addr:isSet(e.addr)?globalThis.String(e.addr):""}),toJSON(e){const t={};return""!==e.id&&(t.id=e.id),""!==e.addr&&(t.addr=e.addr),t},create:e=>Node.fromPartial(e??{}),fromPartial(e){const t=createBaseNode();return t.id=e.id??"",t.addr=e.addr??"",t}};function createBaseJoinRequest(){return{node:void 0}}const JoinRequest={encode:(e,t=new BinaryWriter)=>(void 0!==e.node&&Node.encode(e.node,t.uint32(10).fork()).join(),t),decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseJoinRequest();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:if(10!==e)break;i.node=Node.decode(r,r.uint32());continue}if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({node:isSet(e.node)?Node.fromJSON(e.node):void 0}),toJSON(e){const t={};return void 0!==e.node&&(t.node=Node.toJSON(e.node)),t},create:e=>JoinRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseJoinRequest();return t.node=void 0!==e.node&&null!==e.node?Node.fromPartial(e.node):void 0,t}};function createBaseJoinResponse(){return{}}const JoinResponse={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseJoinResponse();for(;r.pos<n;){const e=r.uint32();if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({}),toJSON:e=>({}),create:e=>JoinResponse.fromPartial(e??{}),fromPartial:e=>createBaseJoinResponse()};function createBaseLeaveRequest(){return{node:void 0}}const LeaveRequest={encode:(e,t=new BinaryWriter)=>(void 0!==e.node&&Node.encode(e.node,t.uint32(10).fork()).join(),t),decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseLeaveRequest();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:if(10!==e)break;i.node=Node.decode(r,r.uint32());continue}if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({node:isSet(e.node)?Node.fromJSON(e.node):void 0}),toJSON(e){const t={};return void 0!==e.node&&(t.node=Node.toJSON(e.node)),t},create:e=>LeaveRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseLeaveRequest();return t.node=void 0!==e.node&&null!==e.node?Node.fromPartial(e.node):void 0,t}};function createBaseLeaveResponse(){return{}}const LeaveResponse={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseLeaveResponse();for(;r.pos<n;){const e=r.uint32();if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({}),toJSON:e=>({}),create:e=>LeaveResponse.fromPartial(e??{}),fromPartial:e=>createBaseLeaveResponse()};function createBaseListRequest(){return{}}const ListRequest={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseListRequest();for(;r.pos<n;){const e=r.uint32();if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({}),toJSON:e=>({}),create:e=>ListRequest.fromPartial(e??{}),fromPartial:e=>createBaseListRequest()};function createBaseListResponse(){return{nodes:[]}}const ListResponse={encode(e,t=new BinaryWriter){for(const r of e.nodes)Node.encode(r,t.uint32(10).fork()).join();return t},decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseListResponse();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:if(10!==e)break;i.nodes.push(Node.decode(r,r.uint32()));continue}if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({nodes:globalThis.Array.isArray(e?.nodes)?e.nodes.map(e=>Node.fromJSON(e)):[]}),toJSON(e){const t={};return e.nodes?.length&&(t.nodes=e.nodes.map(e=>Node.toJSON(e))),t},create:e=>ListResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseListResponse();return t.nodes=e.nodes?.map(e=>Node.fromPartial(e))||[],t}};function createBaseEngineMetaData(){return{id:"",kind:0,input:[],output:[]}}const EngineMetaData={encode(e,t=new BinaryWriter){""!==e.id&&t.uint32(10).string(e.id),0!==e.kind&&t.uint32(16).int32(e.kind);for(const r of e.input)t.uint32(26).string(r);for(const r of e.output)t.uint32(34).string(r);return t},decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseEngineMetaData();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:if(10!==e)break;i.id=r.string();continue;case 2:if(16!==e)break;i.kind=r.int32();continue;case 3:if(26!==e)break;i.input.push(r.string());continue;case 4:if(34!==e)break;i.output.push(r.string());continue}if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({id:isSet(e.id)?globalThis.String(e.id):"",kind:isSet(e.kind)?engineKindFromJSON(e.kind):0,input:globalThis.Array.isArray(e?.input)?e.input.map(e=>globalThis.String(e)):[],output:globalThis.Array.isArray(e?.output)?e.output.map(e=>globalThis.String(e)):[]}),toJSON(e){const t={};return""!==e.id&&(t.id=e.id),0!==e.kind&&(t.kind=engineKindToJSON(e.kind)),e.input?.length&&(t.input=e.input),e.output?.length&&(t.output=e.output),t},create:e=>EngineMetaData.fromPartial(e??{}),fromPartial(e){const t=createBaseEngineMetaData();return t.id=e.id??"",t.kind=e.kind??0,t.input=e.input?.map(e=>e)||[],t.output=e.output?.map(e=>e)||[],t}};function createBaseMetaDataRequest(){return{}}const MetaDataRequest={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseMetaDataRequest();for(;r.pos<n;){const e=r.uint32();if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({}),toJSON:e=>({}),create:e=>MetaDataRequest.fromPartial(e??{}),fromPartial:e=>createBaseMetaDataRequest()};function createBaseMetaDataResponse(){return{metadata:void 0}}const MetaDataResponse={encode:(e,t=new BinaryWriter)=>(void 0!==e.metadata&&EngineMetaData.encode(e.metadata,t.uint32(10).fork()).join(),t),decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBaseMetaDataResponse();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:if(10!==e)break;i.metadata=EngineMetaData.decode(r,r.uint32());continue}if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({metadata:isSet(e.metadata)?EngineMetaData.fromJSON(e.metadata):void 0}),toJSON(e){const t={};return void 0!==e.metadata&&(t.metadata=EngineMetaData.toJSON(e.metadata)),t},create:e=>MetaDataResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseMetaDataResponse();return t.metadata=void 0!==e.metadata&&null!==e.metadata?EngineMetaData.fromPartial(e.metadata):void 0,t}};function createBasePushDataRequest(){return{data:[]}}const PushDataRequest={encode(e,t=new BinaryWriter){for(const r of e.data)t.uint32(10).string(r);return t},decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBasePushDataRequest();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:if(10!==e)break;i.data.push(r.string());continue}if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({data:globalThis.Array.isArray(e?.data)?e.data.map(e=>globalThis.String(e)):[]}),toJSON(e){const t={};return e.data?.length&&(t.data=e.data),t},create:e=>PushDataRequest.fromPartial(e??{}),fromPartial(e){const t=createBasePushDataRequest();return t.data=e.data?.map(e=>e)||[],t}};function createBasePushDataResponse(){return{}}const PushDataResponse={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBasePushDataResponse();for(;r.pos<n;){const e=r.uint32();if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({}),toJSON:e=>({}),create:e=>PushDataResponse.fromPartial(e??{}),fromPartial:e=>createBasePushDataResponse()};function createBasePullDataRequest(){return{}}const PullDataRequest={encode:(e,t=new BinaryWriter)=>t,decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBasePullDataRequest();for(;r.pos<n;){const e=r.uint32();if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({}),toJSON:e=>({}),create:e=>PullDataRequest.fromPartial(e??{}),fromPartial:e=>createBasePullDataRequest()};function createBasePullDataResponse(){return{data:[]}}const PullDataResponse={encode(e,t=new BinaryWriter){for(const r of e.data)t.uint32(10).string(r);return t},decode(e,t){const r=e instanceof BinaryReader?e:new BinaryReader(e),n=void 0===t?r.len:r.pos+t,i=createBasePullDataResponse();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:if(10!==e)break;i.data.push(r.string());continue}if(4==(7&e)||0===e)break;r.skip(7&e)}return i},fromJSON:e=>({data:globalThis.Array.isArray(e?.data)?e.data.map(e=>globalThis.String(e)):[]}),toJSON(e){const t={};return e.data?.length&&(t.data=e.data),t},create:e=>PullDataResponse.fromPartial(e??{}),fromPartial(e){const t=createBasePullDataResponse();return t.data=e.data?.map(e=>e)||[],t}},ClusterService={join:{path:"/cn.edu.ustc.kclab.ddss.Cluster/Join",requestStream:!1,responseStream:!1,requestSerialize:e=>Buffer.from(JoinRequest.encode(e).finish()),requestDeserialize:e=>JoinRequest.decode(e),responseSerialize:e=>Buffer.from(JoinResponse.encode(e).finish()),responseDeserialize:e=>JoinResponse.decode(e)},leave:{path:"/cn.edu.ustc.kclab.ddss.Cluster/Leave",requestStream:!1,responseStream:!1,requestSerialize:e=>Buffer.from(LeaveRequest.encode(e).finish()),requestDeserialize:e=>LeaveRequest.decode(e),responseSerialize:e=>Buffer.from(LeaveResponse.encode(e).finish()),responseDeserialize:e=>LeaveResponse.decode(e)},list:{path:"/cn.edu.ustc.kclab.ddss.Cluster/List",requestStream:!1,responseStream:!1,requestSerialize:e=>Buffer.from(ListRequest.encode(e).finish()),requestDeserialize:e=>ListRequest.decode(e),responseSerialize:e=>Buffer.from(ListResponse.encode(e).finish()),responseDeserialize:e=>ListResponse.decode(e)}},ClusterClient=srcExports.makeGenericClientConstructor(ClusterService,"cn.edu.ustc.kclab.ddss.Cluster"),EngineService={metaData:{path:"/cn.edu.ustc.kclab.ddss.Engine/MetaData",requestStream:!1,responseStream:!1,requestSerialize:e=>Buffer.from(MetaDataRequest.encode(e).finish()),requestDeserialize:e=>MetaDataRequest.decode(e),responseSerialize:e=>Buffer.from(MetaDataResponse.encode(e).finish()),responseDeserialize:e=>MetaDataResponse.decode(e)},pushData:{path:"/cn.edu.ustc.kclab.ddss.Engine/PushData",requestStream:!1,responseStream:!1,requestSerialize:e=>Buffer.from(PushDataRequest.encode(e).finish()),requestDeserialize:e=>PushDataRequest.decode(e),responseSerialize:e=>Buffer.from(PushDataResponse.encode(e).finish()),responseDeserialize:e=>PushDataResponse.decode(e)},pullData:{path:"/cn.edu.ustc.kclab.ddss.Engine/PullData",requestStream:!1,responseStream:!1,requestSerialize:e=>Buffer.from(PullDataRequest.encode(e).finish()),requestDeserialize:e=>PullDataRequest.decode(e),responseSerialize:e=>Buffer.from(PullDataResponse.encode(e).finish()),responseDeserialize:e=>PullDataResponse.decode(e)}},EngineClient=srcExports.makeGenericClientConstructor(EngineService,"cn.edu.ustc.kclab.ddss.Engine");function isSet(e){return null!=e}class AtsdsSearchEngine extends o$1{constructor(e=1e3,t=1e4){super(e,t)}input(e){const t=Os(e);return super.add(t)?Ps(t):null}output(e){return super.execute(t=>(e(Ps(t.toString())),!1))}meta(){return{input:["`x"],output:["`x"]}}}class DataManager{data;constructor(){this.data=new Set}addData(e){return!this.data.has(e)&&(this.data.add(e),!0)}getData(){return Array.from(this.data)}}class EagerEngineManager{eagerEngine;onSearchResults;searchInterval;dataManager;isRunning;resolve;constructor(e,t,r=1e3){this.eagerEngine=e,this.onSearchResults=t,this.searchInterval=r,this.dataManager=new DataManager,this.isRunning=!1,this.resolve=()=>{}}start(){this.isRunning||(this.isRunning=!0,this.searchLoop())}stop(){this.isRunning=!1}addData(e,t=!0){const r=this.eagerEngine.input(e);return r&&this.dataManager.addData(r)?(t&&(this.resolve(),this.resolve=()=>{}),r):null}addDataBatch(e){const t=[];for(const r of e){const e=this.addData(r,!1);e&&t.push(e)}return this.resolve(),this.resolve=()=>{},t}getMetaData(){return this.eagerEngine.meta()}getData(){return this.dataManager.getData()}async searchLoop(){for(;this.isRunning;){const e=Date.now(),t=[];this.eagerEngine.output(e=>{this.dataManager.addData(e)&&t.push(e)}),t.length>0&&await this.onSearchResults(t);const r=Date.now()-e,n=Math.max(this.searchInterval-r,0);0===t.length&&await new Promise(e=>{this.resolve=e,setTimeout(e,n)})}}}class ClusterManager{nodes;id;addr;constructor(e,t){this.nodes=new Map,this.id=e,this.addr=t}getAllNodes(){return Array.from(this.nodes.values())}getAllNodeInfo(){return this.getAllNodes().map(e=>({id:e.id,addr:e.addr})).concat([{id:this.id,addr:this.addr}])}addNode(e,t){if(this.hasNode(e))return null;const r={id:e,addr:t,client:this.createNodeClient(t)};return this.nodes.set(e,r),r}removeNode(e){if(!this.hasNode(e))return!1;const t=this.nodes.get(e);return t.client.cluster.close(),t.client.engine.close(),this.nodes.delete(e)}hasNode(e){return this.nodes.has(e)}createNodeClient(e){return{cluster:new ClusterClient(e,srcExports.credentials.createInsecure()),engine:new EngineClient(e,srcExports.credentials.createInsecure())}}updateAddr(e){this.addr=e}}class NetworkHandler{server;addr;callbacks;constructor(e,t){this.server=new srcExports.Server,this.addr=e,this.callbacks=t}async start(){this.setupServices();const e=promisify(this.server.bindAsync).bind(this.server),t=await e(this.addr,srcExports.ServerCredentials.createInsecure());return this.addr=`${this.addr.split(":")[0]}:${t}`,this.addr}async stop(){return new Promise(e=>{this.server.tryShutdown(()=>e())})}async callJoin(e,t){const r=promisify(t.cluster.join).bind(t.cluster);await r({node:e})}async callLeave(e,t){const r=promisify(t.cluster.leave).bind(t.cluster);await r({node:e})}async callList(e){const t=promisify(e.cluster.list).bind(e.cluster);return(await t({})).nodes}async callPushData(e,t){const r=promisify(t.engine.pushData).bind(t.engine);await r({data:e})}async callMetaData(e){const t=promisify(e.engine.metaData).bind(e.engine);return(await t({})).metadata}async callPullData(e){const t=promisify(e.engine.pullData).bind(e.engine);return(await t({})).data}setupServices(){this.server.addService(ClusterService,{join:async(e,t)=>{const r=e.request.node;await this.callbacks.onJoin(r),t(null,{})},leave:async(e,t)=>{const r=e.request.node;await this.callbacks.onLeave(r),t(null,{})},list:async(e,t)=>{t(null,{nodes:await this.callbacks.onList()})}}),this.server.addService(EngineService,{pushData:async(e,t)=>{const r=e.request.data;await this.callbacks.onPushData(r),t(null,{})},metaData:async(e,t)=>{t(null,{metadata:await this.callbacks.onMetaData()})},pullData:async(e,t)=>{t(null,{data:await this.callbacks.onPullData()})}})}}class EagerNode{id;addr;clusterManager;engineManager;networkHandler;stdinInterface=null;constructor(e,t,r=randomUUID()){this.id=r,this.addr=t,this.clusterManager=new ClusterManager(r,t),this.engineManager=new EagerEngineManager(e,this.handleSearchResults.bind(this)),this.networkHandler=new NetworkHandler(t,{onJoin:this.handleJoinRequest.bind(this),onLeave:this.handleLeaveRequest.bind(this),onList:this.handleListRequest.bind(this),onPushData:this.handlePushDataRequest.bind(this),onMetaData:this.handleMetaDataRequest.bind(this),onPullData:this.handlePullDataRequest.bind(this)})}async start(){const e=await this.networkHandler.start();this.addr=e,this.clusterManager.updateAddr(e),this.engineManager.start(),this.setupIoHandling(),console.log(`Node started: ${this.id} at ${this.addr}`)}async stop(){await this.leaveCluster(),this.stdinInterface&&this.stdinInterface.close(),this.engineManager.stop(),await this.networkHandler.stop(),console.log(`Node stopped: ${this.id}`)}async joinCluster(e){const t=this.clusterManager.createNodeClient(e),r=await this.networkHandler.callList(t),n={id:this.id,addr:this.addr},i=this.engineManager.getData();for(const e of r)if(e.id!==this.id){const t=this.clusterManager.addNode(e.id,e.addr);if(!t)continue;await this.networkHandler.callJoin(n,t.client),await this.syncDataWithNode(i,t.client),console.log(`Joining node: ${e.id} at ${e.addr}`)}t.cluster.close(),t.engine.close()}async leaveCluster(){const e={id:this.id,addr:this.addr},t=this.clusterManager.getAllNodes();for(const r of t)await this.networkHandler.callLeave(e,r.client),this.clusterManager.removeNode(r.id),console.log(`Leaving node: ${r.id}`)}async handleJoinRequest(e){this.clusterManager.hasNode(e.id)||(this.clusterManager.addNode(e.id,e.addr),console.log(`Node joined: ${e.id} at ${e.addr}`))}async handleLeaveRequest(e){this.clusterManager.hasNode(e.id)&&(this.clusterManager.removeNode(e.id),console.log(`Node left: ${e.id} at ${e.addr}`))}async handleListRequest(){return this.clusterManager.getAllNodeInfo()}async handlePushDataRequest(e){const t=this.engineManager.addDataBatch(e);for(const e of t)console.log(`Data received: ${e}`);return t}async handleMetaDataRequest(){const e=this.engineManager.getMetaData();return{id:this.id,kind:EngineKind.EAGER,input:e.input,output:e.output}}async handlePullDataRequest(){return this.engineManager.getData()}async handleSearchResults(e){if(0===e.length)return;for(const t of e)console.log(`Data found: ${t}`);const t=this.clusterManager.getAllNodes();for(const r of t)await this.networkHandler.callPushData(e,r.client)}async syncDataWithNode(e,t){e.length>0&&await this.networkHandler.callPushData(e,t);const r=await this.networkHandler.callPullData(t);if(r.length>0){const e=this.engineManager.addDataBatch(r);for(const t of e)console.log(`Pulling data: ${t}`)}}setupIoHandling(){this.stdinInterface=createInterface({input:process.stdin,output:process.stdout,terminal:!1}),this.stdinInterface.on("line",async e=>{const t=e.trim();if(0===t.length)return;const r=this.engineManager.addData(t);if(r){console.log(`Data read: ${r}`);const e=this.clusterManager.getAllNodes();for(const t of e)await this.networkHandler.callPushData([r],t.client)}}),process.on("SIGINT",async()=>{console.log("Shutting down..."),await this.stop(),process.exit(0)}),process.on("SIGUSR1",()=>{console.log("=== Cluster Information ==="),console.log(`Current Node: ${this.id} at ${this.addr}`),console.log("Connected Nodes:");const e=this.clusterManager.getAllNodes();e.forEach((e,t)=>{console.log(` ${t+1}. ${e.id} at ${e.addr}`)}),console.log(`Total nodes: ${e.length+1}`),console.log("===========================")}),process.on("SIGUSR2",()=>{console.log("=== Data Information ===");const e=this.engineManager.getData();e.forEach((e,t)=>{console.log(` ${t+1}. ${e}`)}),console.log(`Total data items: ${e.length}`),console.log("========================")})}}function addAddressPrefixForPort(e,t){return/^\d+$/.test(e)?`${t}:${e}`:e}async function main(){(process.argv.length<3||process.argv.length>4)&&(console.error("Usage: main <bind_addr> [<join_addr>]"),process.exit(1));const e=addAddressPrefixForPort(process.argv[2],"0.0.0.0"),t=new AtsdsSearchEngine,r=new EagerNode(t,e);if(await r.start(),4===process.argv.length){const e=addAddressPrefixForPort(process.argv[3],"127.0.0.1");console.log(`Joining cluster at ${e}...`),await r.joinCluster(e)}else console.log("Starting as first node in new cluster...");process.stdin.resume()}import.meta.main&&main();