lavva.exalushome.extalife
Version:
Library implementing communication and abstraction layers for ExtaLife API in ExalusHome system
2 lines • 116 kB
JavaScript
"use strict";(self.webpackChunklavva_exalushome_extalife=self.webpackChunklavva_exalushome_extalife||[]).push([[510],{44:(t,e,n)=>{n.d(e,{EG:()=>l,KO:()=>h,W5:()=>r,_L:()=>s,jQ:()=>i,mm:()=>a,oJ:()=>c,oo:()=>o});class o extends Error{constructor(t,e){const n=new.target.prototype;super(`${t}: Status code '${e}'`),this.statusCode=e,this.__proto__=n}}class r extends Error{constructor(t="A timeout occurred."){const e=new.target.prototype;super(t),this.__proto__=e}}class s extends Error{constructor(t="An abort occurred."){const e=new.target.prototype;super(t),this.__proto__=e}}class i extends Error{constructor(t,e){const n=new.target.prototype;super(t),this.transport=e,this.errorType="UnsupportedTransportError",this.__proto__=n}}class a extends Error{constructor(t,e){const n=new.target.prototype;super(t),this.transport=e,this.errorType="DisabledTransportError",this.__proto__=n}}class c extends Error{constructor(t,e){const n=new.target.prototype;super(t),this.transport=e,this.errorType="FailedToStartTransportError",this.__proto__=n}}class l extends Error{constructor(t){const e=new.target.prototype;super(t),this.errorType="FailedToNegotiateWithServerError",this.__proto__=e}}class h extends Error{constructor(t,e){const n=new.target.prototype;super(t),this.innerErrors=e,this.__proto__=n}}},4483:(t,e,n)=>{n.d(e,{R:()=>u,A:()=>i});var o=n(2921),r=n(7180);class s{writeHandshakeRequest(t){return o.d.write(JSON.stringify(t))}parseHandshakeResponse(t){let e,n;if((0,r.eP)(t)){const r=new Uint8Array(t),s=r.indexOf(o.d.RecordSeparatorCode);if(-1===s)throw new Error("Message is incomplete.");const i=s+1;e=String.fromCharCode.apply(null,Array.prototype.slice.call(r.slice(0,i))),n=r.byteLength>i?r.slice(i).buffer:null}else{const r=t,s=r.indexOf(o.d.RecordSeparator);if(-1===s)throw new Error("Message is incomplete.");const i=s+1;e=r.substring(0,i),n=r.length>i?r.substring(i):null}const s=o.d.parse(e),i=JSON.parse(s[0]);if(i.type)throw new Error("Expected a handshake response from the server.");return[n,i]}}var i,a=n(44),c=n(4738),l=n(7);class h{constructor(){this.observers=[]}next(t){for(const e of this.observers)e.next(t)}error(t){for(const e of this.observers)e.error&&e.error(t)}complete(){for(const t of this.observers)t.complete&&t.complete()}subscribe(t){return this.observers.push(t),new r.WQ(this,t)}}!function(t){t.Disconnected="Disconnected",t.Connecting="Connecting",t.Connected="Connected",t.Disconnecting="Disconnecting",t.Reconnecting="Reconnecting"}(i||(i={}));class u{constructor(t,e,n,o){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(l.i.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://docs.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},r.j7.isRequired(t,"connection"),r.j7.isRequired(e,"logger"),r.j7.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=3e4,this.keepAliveIntervalInMilliseconds=15e3,this._logger=e,this._protocol=n,this.connection=t,this._reconnectPolicy=o,this._handshakeProtocol=new s,this.connection.onreceive=t=>this._processIncomingData(t),this.connection.onclose=t=>this._connectionClosed(t),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=i.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:c.C.Ping})}static create(t,e,n,o){return new u(t,e,n,o)}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(t){if(this._connectionState!==i.Disconnected&&this._connectionState!==i.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!t)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=t}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==i.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=i.Connecting,this._logger.log(l.i.Debug,"Starting HubConnection.");try{await this._startInternal(),r.t4.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=i.Connected,this._connectionStarted=!0,this._logger.log(l.i.Debug,"HubConnection connected successfully.")}catch(t){return this._connectionState=i.Disconnected,this._logger.log(l.i.Debug,`HubConnection failed to start successfully because of error '${t}'.`),Promise.reject(t)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const t=new Promise(((t,e)=>{this._handshakeResolver=t,this._handshakeRejecter=e}));await this.connection.start(this._protocol.transferFormat);try{const e={protocol:this._protocol.name,version:this._protocol.version};if(this._logger.log(l.i.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(e)),this._logger.log(l.i.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await t,this._stopDuringStartError)throw this._stopDuringStartError;this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(t){throw this._logger.log(l.i.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(t),t}}async stop(){const t=this._startPromise;this._stopPromise=this._stopInternal(),await this._stopPromise;try{await t}catch(t){}}_stopInternal(t){return this._connectionState===i.Disconnected?(this._logger.log(l.i.Debug,`Call to HubConnection.stop(${t}) ignored because it is already in the disconnected state.`),Promise.resolve()):this._connectionState===i.Disconnecting?(this._logger.log(l.i.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState=i.Disconnecting,this._logger.log(l.i.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(l.i.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=t||new a._L("The connection was stopped before the hub handshake could complete."),this.connection.stop(t)))}stream(t,...e){const[n,o]=this._replaceStreamingParams(e),r=this._createStreamInvocation(t,e,o);let s;const i=new h;return i.cancelCallback=()=>{const t=this._createCancelInvocation(r.invocationId);return delete this._callbacks[r.invocationId],s.then((()=>this._sendWithProtocol(t)))},this._callbacks[r.invocationId]=(t,e)=>{e?i.error(e):t&&(t.type===c.C.Completion?t.error?i.error(new Error(t.error)):i.complete():i.next(t.item))},s=this._sendWithProtocol(r).catch((t=>{i.error(t),delete this._callbacks[r.invocationId]})),this._launchStreams(n,s),i}_sendMessage(t){return this._resetKeepAliveInterval(),this.connection.send(t)}_sendWithProtocol(t){return this._sendMessage(this._protocol.writeMessage(t))}send(t,...e){const[n,o]=this._replaceStreamingParams(e),r=this._sendWithProtocol(this._createInvocation(t,e,!0,o));return this._launchStreams(n,r),r}invoke(t,...e){const[n,o]=this._replaceStreamingParams(e),r=this._createInvocation(t,e,!1,o);return new Promise(((t,e)=>{this._callbacks[r.invocationId]=(n,o)=>{o?e(o):n&&(n.type===c.C.Completion?n.error?e(new Error(n.error)):t(n.result):e(new Error(`Unexpected message type: ${n.type}`)))};const o=this._sendWithProtocol(r).catch((t=>{e(t),delete this._callbacks[r.invocationId]}));this._launchStreams(n,o)}))}on(t,e){t&&e&&(t=t.toLowerCase(),this._methods[t]||(this._methods[t]=[]),-1===this._methods[t].indexOf(e)&&this._methods[t].push(e))}off(t,e){if(!t)return;t=t.toLowerCase();const n=this._methods[t];if(n)if(e){const o=n.indexOf(e);-1!==o&&(n.splice(o,1),0===n.length&&delete this._methods[t])}else delete this._methods[t]}onclose(t){t&&this._closedCallbacks.push(t)}onreconnecting(t){t&&this._reconnectingCallbacks.push(t)}onreconnected(t){t&&this._reconnectedCallbacks.push(t)}_processIncomingData(t){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(t=this._processHandshakeResponse(t),this._receivedHandshakeResponse=!0),t){const e=this._protocol.parseMessages(t,this._logger);for(const t of e)switch(t.type){case c.C.Invocation:this._invokeClientMethod(t);break;case c.C.StreamItem:case c.C.Completion:{const e=this._callbacks[t.invocationId];if(e){t.type===c.C.Completion&&delete this._callbacks[t.invocationId];try{e(t)}catch(t){this._logger.log(l.i.Error,`Stream callback threw error: ${(0,r.HH)(t)}`)}}break}case c.C.Ping:break;case c.C.Close:{this._logger.log(l.i.Information,"Close message received from server.");const e=t.error?new Error("Server returned an error on close: "+t.error):void 0;!0===t.allowReconnect?this.connection.stop(e):this._stopPromise=this._stopInternal(e);break}default:this._logger.log(l.i.Warning,`Invalid message type: ${t.type}.`)}}this._resetTimeoutPeriod()}_processHandshakeResponse(t){let e,n;try{[n,e]=this._handshakeProtocol.parseHandshakeResponse(t)}catch(t){const e="Error parsing handshake response: "+t;this._logger.log(l.i.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}if(e.error){const t="Server returned handshake error: "+e.error;this._logger.log(l.i.Error,t);const n=new Error(t);throw this._handshakeRejecter(n),n}return this._logger.log(l.i.Debug,"Server handshake complete."),this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=(new Date).getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if(!(this.connection.features&&this.connection.features.inherentKeepAlive||(this._timeoutHandle=setTimeout((()=>this.serverTimeout()),this.serverTimeoutInMilliseconds),void 0!==this._pingServerHandle))){let t=this._nextKeepAlive-(new Date).getTime();t<0&&(t=0),this._pingServerHandle=setTimeout((async()=>{if(this._connectionState===i.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),t)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(t){const e=t.target.toLowerCase(),n=this._methods[e];if(!n)return this._logger.log(l.i.Warning,`No client method with the name '${e}' found.`),void(t.invocationId&&(this._logger.log(l.i.Warning,`No result given for '${e}' method and invocation ID '${t.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null))));const o=n.slice(),r=!!t.invocationId;let s,i,a;for(const n of o)try{const o=s;s=await n.apply(this,t.arguments),r&&s&&o&&(this._logger.log(l.i.Error,`Multiple results provided for '${e}'. Sending error to server.`),a=this._createCompletionMessage(t.invocationId,"Client provided multiple results.",null)),i=void 0}catch(t){i=t,this._logger.log(l.i.Error,`A callback for the method '${e}' threw error '${t}'.`)}a?await this._sendWithProtocol(a):r?(i?a=this._createCompletionMessage(t.invocationId,`${i}`,null):void 0!==s?a=this._createCompletionMessage(t.invocationId,null,s):(this._logger.log(l.i.Warning,`No result given for '${e}' method and invocation ID '${t.invocationId}'.`),a=this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(a)):s&&this._logger.log(l.i.Error,`Result given for '${e}' method but server is not expecting a result.`)}_connectionClosed(t){this._logger.log(l.i.Debug,`HubConnection.connectionClosed(${t}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||t||new a._L("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(t||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===i.Disconnecting?this._completeClose(t):this._connectionState===i.Connected&&this._reconnectPolicy?this._reconnect(t):this._connectionState===i.Connected&&this._completeClose(t)}_completeClose(t){if(this._connectionStarted){this._connectionState=i.Disconnected,this._connectionStarted=!1,r.t4.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((e=>e.apply(this,[t])))}catch(e){this._logger.log(l.i.Error,`An onclose callback called with error '${t}' threw error '${e}'.`)}}}async _reconnect(t){const e=Date.now();let n=0,o=void 0!==t?t:new Error("Attempting to reconnect due to a unknown error."),r=this._getNextRetryDelay(n++,0,o);if(null===r)return this._logger.log(l.i.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(t);if(this._connectionState=i.Reconnecting,t?this._logger.log(l.i.Information,`Connection reconnecting because of error '${t}'.`):this._logger.log(l.i.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((e=>e.apply(this,[t])))}catch(e){this._logger.log(l.i.Error,`An onreconnecting callback called with error '${t}' threw error '${e}'.`)}if(this._connectionState!==i.Reconnecting)return void this._logger.log(l.i.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==r;){if(this._logger.log(l.i.Information,`Reconnect attempt number ${n} will start in ${r} ms.`),await new Promise((t=>{this._reconnectDelayHandle=setTimeout(t,r)})),this._reconnectDelayHandle=void 0,this._connectionState!==i.Reconnecting)return void this._logger.log(l.i.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=i.Connected,this._logger.log(l.i.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((t=>t.apply(this,[this.connection.connectionId])))}catch(t){this._logger.log(l.i.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${t}'.`)}return}catch(t){if(this._logger.log(l.i.Information,`Reconnect attempt failed because of error '${t}'.`),this._connectionState!==i.Reconnecting)return this._logger.log(l.i.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===i.Disconnecting&&this._completeClose());o=t instanceof Error?t:new Error(t.toString()),r=this._getNextRetryDelay(n++,Date.now()-e,o)}}this._logger.log(l.i.Information,`Reconnect retries have been exhausted after ${Date.now()-e} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(t,e,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:e,previousRetryCount:t,retryReason:n})}catch(n){return this._logger.log(l.i.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${t}, ${e}) threw error '${n}'.`),null}}_cancelCallbacksWithError(t){const e=this._callbacks;this._callbacks={},Object.keys(e).forEach((n=>{const o=e[n];try{o(null,t)}catch(e){this._logger.log(l.i.Error,`Stream 'error' callback called with '${t}' threw error: ${(0,r.HH)(e)}`)}}))}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(t,e,n,o){if(n)return 0!==o.length?{arguments:e,streamIds:o,target:t,type:c.C.Invocation}:{arguments:e,target:t,type:c.C.Invocation};{const n=this._invocationId;return this._invocationId++,0!==o.length?{arguments:e,invocationId:n.toString(),streamIds:o,target:t,type:c.C.Invocation}:{arguments:e,invocationId:n.toString(),target:t,type:c.C.Invocation}}}_launchStreams(t,e){if(0!==t.length){e||(e=Promise.resolve());for(const n in t)t[n].subscribe({complete:()=>{e=e.then((()=>this._sendWithProtocol(this._createCompletionMessage(n))))},error:t=>{let o;o=t instanceof Error?t.message:t&&t.toString?t.toString():"Unknown error",e=e.then((()=>this._sendWithProtocol(this._createCompletionMessage(n,o))))},next:t=>{e=e.then((()=>this._sendWithProtocol(this._createStreamItemMessage(n,t))))}})}}_replaceStreamingParams(t){const e=[],n=[];for(let o=0;o<t.length;o++){const r=t[o];if(this._isObservable(r)){const s=this._invocationId;this._invocationId++,e[s]=r,n.push(s.toString()),t.splice(o,1)}}return[e,n]}_isObservable(t){return t&&t.subscribe&&"function"==typeof t.subscribe}_createStreamInvocation(t,e,n){const o=this._invocationId;return this._invocationId++,0!==n.length?{arguments:e,invocationId:o.toString(),streamIds:n,target:t,type:c.C.StreamInvocation}:{arguments:e,invocationId:o.toString(),target:t,type:c.C.StreamInvocation}}_createCancelInvocation(t){return{invocationId:t,type:c.C.CancelInvocation}}_createStreamItemMessage(t,e){return{invocationId:t,item:e,type:c.C.StreamItem}}_createCompletionMessage(t,e,n){return e?{error:e,invocationId:t,type:c.C.Completion}:{invocationId:t,result:n,type:c.C.Completion}}}},2876:(t,e,n)=>{n.d(e,{s:()=>M});const o=[0,2e3,1e4,3e4,null];class r{constructor(t){this._retryDelays=void 0!==t?[...t,null]:o}nextRetryDelayInMilliseconds(t){return this._retryDelays[t.previousRetryCount]}}class s{}s.Authorization="Authorization",s.Cookie="Cookie";class i{constructor(t,e,n){this.statusCode=t,this.statusText=e,this.content=n}}class a{get(t,e){return this.send({...e,method:"GET",url:t})}post(t,e){return this.send({...e,method:"POST",url:t})}delete(t,e){return this.send({...e,method:"DELETE",url:t})}getCookieString(t){return""}}class c extends a{constructor(t,e){super(),this._innerClient=t,this._accessTokenFactory=e}async send(t){let e=!0;this._accessTokenFactory&&(!this._accessToken||t.url&&t.url.indexOf("/negotiate?")>0)&&(e=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(t);const n=await this._innerClient.send(t);return e&&401===n.statusCode&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(t),await this._innerClient.send(t)):n}_setAuthorizationHeader(t){t.headers||(t.headers={}),this._accessToken?t.headers[s.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&t.headers[s.Authorization]&&delete t.headers[s.Authorization]}getCookieString(t){return this._innerClient.getCookieString(t)}}var l,h,u=n(44),f=n(7),g=n(7180);class w extends a{constructor(t){if(super(),this._logger=t,"undefined"==typeof fetch){const t=require;this._jar=new(t("tough-cookie").CookieJar),this._fetchType=t("node-fetch"),this._fetchType=t("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind((0,g.E9)());if("undefined"==typeof AbortController){const t=require;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}async send(t){if(t.abortSignal&&t.abortSignal.aborted)throw new u._L;if(!t.method)throw new Error("No method defined.");if(!t.url)throw new Error("No url defined.");const e=new this._abortControllerType;let n;t.abortSignal&&(t.abortSignal.onabort=()=>{e.abort(),n=new u._L});let o,r=null;if(t.timeout){const o=t.timeout;r=setTimeout((()=>{e.abort(),this._logger.log(f.i.Warning,"Timeout from HTTP request."),n=new u.W5}),o)}""===t.content&&(t.content=void 0),t.content&&(t.headers=t.headers||{},(0,g.eP)(t.content)?t.headers["Content-Type"]="application/octet-stream":t.headers["Content-Type"]="text/plain;charset=UTF-8");try{o=await this._fetchType(t.url,{body:t.content,cache:"no-cache",credentials:!0===t.withCredentials?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...t.headers},method:t.method,mode:"cors",redirect:"follow",signal:e.signal})}catch(t){if(n)throw n;throw this._logger.log(f.i.Warning,`Error from HTTP request. ${t}.`),t}finally{r&&clearTimeout(r),t.abortSignal&&(t.abortSignal.onabort=null)}if(!o.ok){const t=await y(o,"text");throw new u.oo(t||o.statusText,o.status)}const s=y(o,t.responseType),a=await s;return new i(o.status,o.statusText,a)}getCookieString(t){let e="";return g.t4.isNode&&this._jar&&this._jar.getCookies(t,((t,n)=>e=n.join("; "))),e}}function y(t,e){let n;switch(e){case"arraybuffer":n=t.arrayBuffer();break;case"text":default:n=t.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`)}return n}class d extends a{constructor(t){super(),this._logger=t}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new u._L):t.method?t.url?new Promise(((e,n)=>{const o=new XMLHttpRequest;o.open(t.method,t.url,!0),o.withCredentials=void 0===t.withCredentials||t.withCredentials,o.setRequestHeader("X-Requested-With","XMLHttpRequest"),""===t.content&&(t.content=void 0),t.content&&((0,g.eP)(t.content)?o.setRequestHeader("Content-Type","application/octet-stream"):o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const r=t.headers;r&&Object.keys(r).forEach((t=>{o.setRequestHeader(t,r[t])})),t.responseType&&(o.responseType=t.responseType),t.abortSignal&&(t.abortSignal.onabort=()=>{o.abort(),n(new u._L)}),t.timeout&&(o.timeout=t.timeout),o.onload=()=>{t.abortSignal&&(t.abortSignal.onabort=null),o.status>=200&&o.status<300?e(new i(o.status,o.statusText,o.response||o.responseText)):n(new u.oo(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(f.i.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new u.oo(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(f.i.Warning,"Timeout from HTTP request."),n(new u.W5)},o.send(t.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class p extends a{constructor(t){if(super(),"undefined"!=typeof fetch||g.t4.isNode)this._httpClient=new w(t);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new d(t)}}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new u._L):t.method?t.url?this._httpClient.send(t):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(t){return this._httpClient.getCookieString(t)}}!function(t){t[t.None=0]="None",t[t.WebSockets=1]="WebSockets",t[t.ServerSentEvents=2]="ServerSentEvents",t[t.LongPolling=4]="LongPolling"}(l||(l={})),function(t){t[t.Text=1]="Text",t[t.Binary=2]="Binary"}(h||(h={}));class _{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}}class m{constructor(t,e,n){this._httpClient=t,this._logger=e,this._pollAbort=new _,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}get pollAborted(){return this._pollAbort.aborted}async connect(t,e){if(g.j7.isRequired(t,"url"),g.j7.isRequired(e,"transferFormat"),g.j7.isIn(e,h,"transferFormat"),this._url=t,this._logger.log(f.i.Trace,"(LongPolling transport) Connecting."),e===h.Binary&&"undefined"!=typeof XMLHttpRequest&&"string"!=typeof(new XMLHttpRequest).responseType)throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[n,o]=(0,g.hS)(),r={[n]:o,...this._options.headers},s={abortSignal:this._pollAbort.signal,headers:r,timeout:1e5,withCredentials:this._options.withCredentials};e===h.Binary&&(s.responseType="arraybuffer");const i=`${t}&_=${Date.now()}`;this._logger.log(f.i.Trace,`(LongPolling transport) polling: ${i}.`);const a=await this._httpClient.get(i,s);200!==a.statusCode?(this._logger.log(f.i.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new u.oo(a.statusText||"",a.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,s)}async _poll(t,e){try{for(;this._running;)try{const n=`${t}&_=${Date.now()}`;this._logger.log(f.i.Trace,`(LongPolling transport) polling: ${n}.`);const o=await this._httpClient.get(n,e);204===o.statusCode?(this._logger.log(f.i.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==o.statusCode?(this._logger.log(f.i.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new u.oo(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(f.i.Trace,`(LongPolling transport) data received. ${(0,g.o4)(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(f.i.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(t){this._running?t instanceof u.W5?this._logger.log(f.i.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=t,this._running=!1):this._logger.log(f.i.Trace,`(LongPolling transport) Poll errored after shutdown: ${t.message}`)}}finally{this._logger.log(f.i.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(t){return this._running?(0,g.bG)(this._logger,"LongPolling",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(f.i.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(f.i.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const t={},[e,n]=(0,g.hS)();t[e]=n;const o={headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};await this._httpClient.delete(this._url,o),this._logger.log(f.i.Trace,"(LongPolling transport) DELETE request sent.")}finally{this._logger.log(f.i.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let t="(LongPolling transport) Firing onclose event.";this._closeError&&(t+=" Error: "+this._closeError),this._logger.log(f.i.Trace,t),this.onclose(this._closeError)}}}class b{constructor(t,e,n,o){this._httpClient=t,this._accessToken=e,this._logger=n,this._options=o,this.onreceive=null,this.onclose=null}async connect(t,e){return g.j7.isRequired(t,"url"),g.j7.isRequired(e,"transferFormat"),g.j7.isIn(e,h,"transferFormat"),this._logger.log(f.i.Trace,"(SSE transport) Connecting."),this._url=t,this._accessToken&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise(((n,o)=>{let r,s=!1;if(e===h.Text){if(g.t4.isBrowser||g.t4.isWebWorker)r=new this._options.EventSource(t,{withCredentials:this._options.withCredentials});else{const e=this._httpClient.getCookieString(t),n={};n.Cookie=e;const[o,s]=(0,g.hS)();n[o]=s,r=new this._options.EventSource(t,{withCredentials:this._options.withCredentials,headers:{...n,...this._options.headers}})}try{r.onmessage=t=>{if(this.onreceive)try{this._logger.log(f.i.Trace,`(SSE transport) data received. ${(0,g.o4)(t.data,this._options.logMessageContent)}.`),this.onreceive(t.data)}catch(t){return void this._close(t)}},r.onerror=t=>{s?this._close():o(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},r.onopen=()=>{this._logger.log(f.i.Information,`SSE connected to ${this._url}`),this._eventSource=r,s=!0,n()}}catch(t){return void o(t)}}else o(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"))}))}async send(t){return this._eventSource?(0,g.bG)(this._logger,"SSE",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(t){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(t))}}class v{constructor(t,e,n,o,r,s){this._logger=n,this._accessTokenFactory=e,this._logMessageContent=o,this._webSocketConstructor=r,this._httpClient=t,this.onreceive=null,this.onclose=null,this._headers=s}async connect(t,e){let n;return g.j7.isRequired(t,"url"),g.j7.isRequired(e,"transferFormat"),g.j7.isIn(e,h,"transferFormat"),this._logger.log(f.i.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise(((o,r)=>{let i;t=t.replace(/^http/,"ws");const a=this._httpClient.getCookieString(t);let c=!1;if(g.t4.isNode||g.t4.isReactNative){const e={},[o,r]=(0,g.hS)();e[o]=r,n&&(e[s.Authorization]=`Bearer ${n}`),a&&(e[s.Cookie]=a),i=new this._webSocketConstructor(t,void 0,{headers:{...e,...this._headers}})}else n&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(t)),e===h.Binary&&(i.binaryType="arraybuffer"),i.onopen=e=>{this._logger.log(f.i.Information,`WebSocket connected to ${t}.`),this._webSocket=i,c=!0,o()},i.onerror=t=>{let e=null;e="undefined"!=typeof ErrorEvent&&t instanceof ErrorEvent?t.error:"There was an error with the transport",this._logger.log(f.i.Information,`(WebSockets transport) ${e}.`)},i.onmessage=t=>{if(this._logger.log(f.i.Trace,`(WebSockets transport) data received. ${(0,g.o4)(t.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(t.data)}catch(t){return void this._close(t)}},i.onclose=t=>{if(c)this._close(t);else{let e=null;e="undefined"!=typeof ErrorEvent&&t instanceof ErrorEvent?t.error:"WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",r(new Error(e))}}}))}send(t){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(f.i.Trace,`(WebSockets transport) sending data. ${(0,g.o4)(t,this._logMessageContent)}.`),this._webSocket.send(t),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(t){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(f.i.Trace,"(WebSockets transport) socket closed."),this.onclose&&(!this._isCloseEvent(t)||!1!==t.wasClean&&1e3===t.code?t instanceof Error?this.onclose(t):this.onclose():this.onclose(new Error(`WebSocket closed with status code: ${t.code} (${t.reason||"no reason given"}).`)))}_isCloseEvent(t){return t&&"boolean"==typeof t.wasClean&&"number"==typeof t.code}}class k{constructor(t,e={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,g.j7.isRequired(t,"url"),this._logger=(0,g.hu)(e.logger),this.baseUrl=this._resolveUrl(t),(e=e||{}).logMessageContent=void 0!==e.logMessageContent&&e.logMessageContent,"boolean"!=typeof e.withCredentials&&void 0!==e.withCredentials)throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");e.withCredentials=void 0===e.withCredentials||e.withCredentials,e.timeout=void 0===e.timeout?1e5:e.timeout;let n=null,o=null;if(g.t4.isNode){const t=require;n=t("ws"),o=t("eventsource")}g.t4.isNode||"undefined"==typeof WebSocket||e.WebSocket?g.t4.isNode&&!e.WebSocket&&n&&(e.WebSocket=n):e.WebSocket=WebSocket,g.t4.isNode||"undefined"==typeof EventSource||e.EventSource?g.t4.isNode&&!e.EventSource&&void 0!==o&&(e.EventSource=o):e.EventSource=EventSource,this._httpClient=new c(e.httpClient||new p(this._logger),e.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=e,this.onreceive=null,this.onclose=null}async start(t){if(t=t||h.Binary,g.j7.isIn(t,h,"transferFormat"),this._logger.log(f.i.Debug,`Starting connection with transfer format '${h[t]}'.`),"Disconnected"!==this._connectionState)return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(t),await this._startInternalPromise,"Disconnecting"===this._connectionState){const t="Failed to start the HttpConnection before stop() was called.";return this._logger.log(f.i.Error,t),await this._stopPromise,Promise.reject(new u._L(t))}if("Connected"!==this._connectionState){const t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(f.i.Error,t),Promise.reject(new u._L(t))}this._connectionStarted=!0}send(t){return"Connected"!==this._connectionState?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new S(this.transport)),this._sendQueue.send(t))}async stop(t){return"Disconnected"===this._connectionState?(this._logger.log(f.i.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(f.i.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState="Disconnecting",this._stopPromise=new Promise((t=>{this._stopPromiseResolver=t})),await this._stopInternal(t),void await this._stopPromise)}async _stopInternal(t){this._stopError=t;try{await this._startInternalPromise}catch(t){}if(this.transport){try{await this.transport.stop()}catch(t){this._logger.log(f.i.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(f.i.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(t){let e=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation){if(this._options.transport!==l.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(l.WebSockets),await this._startTransport(e,t)}else{let n=null,o=0;do{if(n=await this._getNegotiationResponse(e),"Disconnecting"===this._connectionState||"Disconnected"===this._connectionState)throw new u._L("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(e=n.url),n.accessToken){const t=n.accessToken;this._accessTokenFactory=()=>t,this._httpClient._accessToken=t,this._httpClient._accessTokenFactory=void 0}o++}while(n.url&&o<100);if(100===o&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(e,this._options.transport,n,t)}this.transport instanceof m&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(f.i.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(t){return this._logger.log(f.i.Error,"Failed to start the connection: "+t),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(t)}}async _getNegotiationResponse(t){const e={},[n,o]=(0,g.hS)();e[n]=o;const r=this._resolveNegotiateUrl(t);this._logger.log(f.i.Debug,`Sending negotiation request: ${r}.`);try{const t=await this._httpClient.post(r,{content:"",headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(200!==t.statusCode)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${t.statusCode}'`));const n=JSON.parse(t.content);return(!n.negotiateVersion||n.negotiateVersion<1)&&(n.connectionToken=n.connectionId),n}catch(t){let e="Failed to complete negotiation with the server: "+t;return t instanceof u.oo&&404===t.statusCode&&(e+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(f.i.Error,e),Promise.reject(new u.EG(e))}}_createConnectUrl(t,e){return e?t+(-1===t.indexOf("?")?"?":"&")+`id=${e}`:t}async _createTransport(t,e,n,o){let r=this._createConnectUrl(t,n.connectionToken);if(this._isITransport(e))return this._logger.log(f.i.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=e,await this._startTransport(r,o),void(this.connectionId=n.connectionId);const s=[],i=n.availableTransports||[];let a=n;for(const n of i){const i=this._resolveTransportOrError(n,e,o);if(i instanceof Error)s.push(`${n.transport} failed:`),s.push(i);else if(this._isITransport(i)){if(this.transport=i,!a){try{a=await this._getNegotiationResponse(t)}catch(t){return Promise.reject(t)}r=this._createConnectUrl(t,a.connectionToken)}try{return await this._startTransport(r,o),void(this.connectionId=a.connectionId)}catch(t){if(this._logger.log(f.i.Error,`Failed to start the transport '${n.transport}': ${t}`),a=void 0,s.push(new u.oJ(`${n.transport} failed: ${t}`,l[n.transport])),"Connecting"!==this._connectionState){const t="Failed to select transport before stop() was called.";return this._logger.log(f.i.Debug,t),Promise.reject(new u._L(t))}}}}return s.length>0?Promise.reject(new u.KO(`Unable to connect to the server with any of the available transports. ${s.join(" ")}`,s)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(t){switch(t){case l.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new v(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case l.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new b(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case l.LongPolling:return new m(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${t}.`)}}_startTransport(t,e){return this.transport.onreceive=this.onreceive,this.transport.onclose=t=>this._stopConnection(t),this.transport.connect(t,e)}_resolveTransportOrError(t,e,n){const o=l[t.transport];if(null==o)return this._logger.log(f.i.Debug,`Skipping transport '${t.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${t.transport}' because it is not supported by this client.`);if(!function(t,e){return!t||0!=(e&t)}(e,o))return this._logger.log(f.i.Debug,`Skipping transport '${l[o]}' because it was disabled by the client.`),new u.mm(`'${l[o]}' is disabled by the client.`,o);if(!(t.transferFormats.map((t=>h[t])).indexOf(n)>=0))return this._logger.log(f.i.Debug,`Skipping transport '${l[o]}' because it does not support the requested transfer format '${h[n]}'.`),new Error(`'${l[o]}' does not support ${h[n]}.`);if(o===l.WebSockets&&!this._options.WebSocket||o===l.ServerSentEvents&&!this._options.EventSource)return this._logger.log(f.i.Debug,`Skipping transport '${l[o]}' because it is not supported in your environment.'`),new u.jQ(`'${l[o]}' is not supported in your environment.`,o);this._logger.log(f.i.Debug,`Selecting transport '${l[o]}'.`);try{return this._constructTransport(o)}catch(t){return t}}_isITransport(t){return t&&"object"==typeof t&&"connect"in t}_stopConnection(t){if(this._logger.log(f.i.Debug,`HttpConnection.stopConnection(${t}) called while in state ${this._connectionState}.`),this.transport=void 0,t=this._stopError||t,this._stopError=void 0,"Disconnected"!==this._connectionState){if("Connecting"===this._connectionState)throw this._logger.log(f.i.Warning,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${t}) was called while the connection is still in the connecting state.`);if("Disconnecting"===this._connectionState&&this._stopPromiseResolver(),t?this._logger.log(f.i.Error,`Connection disconnected with error '${t}'.`):this._logger.log(f.i.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((t=>{this._logger.log(f.i.Error,`TransportSendQueue.stop() threw error '${t}'.`)})),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(t)}catch(e){this._logger.log(f.i.Error,`HttpConnection.onclose(${t}) threw error '${e}'.`)}}}else this._logger.log(f.i.Debug,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is already in the disconnected state.`)}_resolveUrl(t){if(0===t.lastIndexOf("https://",0)||0===t.lastIndexOf("http://",0))return t;if(!g.t4.isBrowser)throw new Error(`Cannot resolve '${t}'.`);const e=window.document.createElement("a");return e.href=t,this._logger.log(f.i.Information,`Normalizing '${t}' to '${e.href}'.`),e.href}_resolveNegotiateUrl(t){const e=t.indexOf("?");let n=t.substring(0,-1===e?t.length:e);return"/"!==n[n.length-1]&&(n+="/"),n+="negotiate",n+=-1===e?"":t.substring(e),-1===n.indexOf("negotiateVersion")&&(n+=-1===e?"?":"&",n+="negotiateVersion="+this._negotiateVersion),n}}class S{constructor(t){this._transport=t,this._buffer=[],this._executing=!0,this._sendBufferedData=new E,this._transportResult=new E,this._sendLoopPromise=this._sendLoop()}send(t){return this._bufferData(t),this._transportResult||(this._transportResult=new E),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(t){if(this._buffer.length&&typeof this._buffer[0]!=typeof t)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof t}`);this._buffer.push(t),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new E;const t=this._transportResult;this._transportResult=void 0;const e="string"==typeof this._buffer[0]?this._buffer.join(""):S._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(e),t.resolve()}catch(e){t.reject(e)}}}static _concatBuffers(t){const e=t.map((t=>t.byteLength)).reduce(((t,e)=>t+e)),n=new Uint8Array(e);let o=0;for(const e of t)n.set(new Uint8Array(e),o),o+=e.byteLength;return n.buffer}}class E{constructor(){this.promise=new Promise(((t,e)=>[this._resolver,this._rejecter]=[t,e]))}resolve(){this._resolver()}reject(t){this._rejecter(t)}}var C=n(4483),A=n(4738),I=n(1499),T=n(2921);class P{constructor(){this.name="json",this.version=1,this.transferFormat=h.Text}parseMessages(t,e){if("string"!=typeof t)throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!t)return[];null===e&&(e=I.W.instance);const n=T.d.parse(t),o=[];for(const t of n){const n=JSON.parse(t);if("number"!=typeof n.type)throw new Error("Invalid payload.");switch(n.type){case A.C.Invocation:this._isInvocationMessage(n);break;case A.C.StreamItem:this._isStreamItemMessage(n);break;case A.C.Completion:this._isCompletionMessage(n);break;case A.C.Ping:case A.C.Close:break;default:e.log(f.i.Information,"Unknown message type '"+n.type+"' ignored.");continue}o.push(n)}return o}writeMessage(t){return T.d.write(JSON.stringify(t))}_isInvocationMessage(t){this._assertNotEmptyString(t.target,"Invalid payload for Invocation message."),void 0!==t.invocationId&&this._assertNotEmptyString(t.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(t){if(this._assertNotEmptyString(t.invocationId,"Invalid payload for StreamItem message."),void 0===t.item)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(t){if(t.result&&t.error)throw new Error("Invalid payload for Completion message.");!t.result&&t.error&&this._assertNotEmptyString(t.error,"Invalid payload for Completion message."),this._assertNotEmptyString(t.invocationId,"Invalid payload for Completion message.")}_assertNotEmptyString(t,e){if("string"!=typeof t||""===t)throw new Error(e)}}const N={trace:f.i.Trace,debug:f.i.Debug,info:f.i.Information,information:f.i.Information,warn:f.i.Warning,warning:f.i.Warning,error:f.i.Error,critical:f.i.Critical,none:f.i.None};class M{configureLogging(t){if(g.j7.isRequired(t,"logging"),void 0!==t.log)this.logger=t;else if("string"==typeof t){const e=function(t){const e=N[t.toLowerCase()];if(void 0!==e)return e;throw new Error(`Unknown log level: ${t}`)}(t);this.logger=new g.kw(e)}else this.logger=new g.kw(t);return this}withUrl(t,e){return g.j7.isRequired(t,"url"),g.j7.isNotEmpty(t,"url"),this.url=t,this.httpConnectionOptions="object"==typeof e?{...this.httpConnectionOptions,...e}:{...this.httpConnectionOptions,transport:e},this}withHubProtocol(t){return g.j7.isRequired(t,"protocol"),this.protocol=t,this}withAutomaticReconnect(t){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return t?Array.isArray(t)?this.reconnectPolicy=new r(t):this.reconnectPolicy=t:this.reconnectPolicy=new r,this}build(){const t=this.httpConnectionOptions||{};if(void 0===t.logger&&(t.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const e=new k(this.url,t);return C.R.create(e,this.logger||I.W.instance,this.protocol||new P,this.reconnectPolicy)}}},4738:(t,e,n)=>{var o;n.d(e,{C:()=>o}),function(t){t[t.Invocation=1]="Invocation",t[t.StreamItem=2]="StreamItem",t[t.Completion=3]="Completion",t[t.StreamInvocation=4]="StreamInvocation",t[t.CancelInvocation=5]="CancelInvocation",t[t.Ping=6]="Ping",t[t.Close=7]="Close"}(o||(o={}))},7:(t,e,n)=>{var o;n.d(e,{i:()=>o}),function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Information=2]="Information",t[t.Warning=3]="Warning",t[t.Error=4]="Error",t[t.Critical=5]="Critical",t[t.None=6]="None"}(o||(o={}))},1499:(t,e,n)=>{n.d(e,{W:()=>o});class o{constructor(){}log(t,e){}}o.instance=new o},2921:(t,e,n)=>{n.d(e,{d:()=>o});class o{static write(t){return`${t}${o.RecordSeparator}`}static parse(t){if(t[t.length-1]!==o.RecordSeparator)throw new Error("Message is incomplete.");const e=t.split(o.RecordSeparator);return e.pop(),e}}o.RecordSeparatorCode=30,o.RecordSeparator=String.fromCharCode(o.RecordSeparatorCode)},7180:(t,e,n)=>{n.d(e,{E9:()=>m,HH:()=>_,WQ:()=>f,bG:()=>h,eP:()=>l,hS:()=>w,hu:()=>u,j7:()=>i,kw:()=>g,o4:()=>c,t4:()=>a});var o=n(7),r=n(1499);const s="7.0.14";class i{static isRequired(t,e){if(null==t)throw new Error(`The '${e}' argument is required.`)}static isNotEmpty(t,e){if(!t||t.match(/^\s*$/))throw new Error(`The '${e}' argument should not be empty.`)}static isIn(t,e,n){if(!(t in e))throw new Error(`Unknown ${n} value: ${t}.`)}}class a{static get isBrowser(){return"object"==typeof window&&"object"==typeof window.document}static get isWebWorker(){return"object"==typeof self&&"importScripts"in self}static get isReactNative(){return"object"==typeof window&&void 0===window.document}static get isNode(){return!this.isBrowser&&!this.isWebWorker&&!this.isReactNative}}function c(t,e){let n="";return l(t)?(n=`Binary data of length ${t.byteLength}`,e&&(n+=`. Content: '${function(t){const e=new Uint8Array(t);let n="";return e.forEach((t=>{n+=`0x${t<16?"0":""}${t.toString(16)} `})),n.substr(0,n.length-1)}(t)}'`)):"string"==typeof t&&(n=`String data of length ${t.length}`,e&&(n+=`. Content: '${t}'`)),n}function l(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}async function h(t,e,n,r,s,i){const a={},[h,u]=w();a[h]=u,t.log(o.i.Trace,`(${e} transport) sending data. ${c(s,i.logMessageContent)}.`);const f=l(s)?"arraybuffer":"text",g=await n.post(r,{content:s,headers:{...a,...i.headers},responseType:f,timeout:i.timeout,withCredentials:i.withCredentials});t.log(o.i.Trace,`(${e} transport) request complete. Response status: ${g.statusCode}.`)}function u(t){return void 0===t?new g(o.i.Information):null===t?r.W.instance:void 0!==t.log?t:new g(t)}class f{constructor(t,e){this._subject=t,this._observer=e}dispose(){const t=this._subject.observers.indexOf(this._observer);t>-1&&this._subject.observers.splice(t,1),0===this._subject.observers.length&&this._subject.cancelCallback&&this._subject.cancelCallback().catch((t=>{}))}}class g{constructor(t){this._minLevel=t,this.out=console}log(t,e){if(t>=this._minLevel){const n=`[${(new Date).toISOString()}] ${o.i[t]}: ${e}`;switch(t){case o.i.Critical:case o.i.Error:this.out.error(n);break;case o.i.Warning:this.out.warn(n);break;case o.i.Information:this.out.info(n);break;default:this.out.log(n)}}}}function w(){let t="X-SignalR-User-Agent";return a.isNode&&(t="User-Agent"),[t,y(s,d(),a.isNode?"NodeJS":"Browser",p())]}function y(t,e,n,o){let r="Microsoft SignalR/";const s=t.split(".");return r+=`${s[0]}.${s[1]}`,r+=` (${t}; `,r+=e&&""!==e?`${e}; `:"Unknown OS; ",r+=`${n}`,r+=o?`; ${o}`:"; Unknown Runtime Version",r+=")",r}function d(){if(!a.isNode)return"";switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}}function p(){if(a.isNode)return process.versions.node}function _(t){return t.stack?t.stack:t.message?t.message:`${t}`}function m(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw new Error("could not find global")}},3551:(t,e,n)=>{n.d(e,{LN:()=>Qi});class o extends RangeError{constructor(t){super(`${t} was out of range. Must be non-negative and less than the size of the collection.`),this.paramName=t,this.name="ArgumentOutOfRangeException",this.stack=this.stack||(new Error).stack}}const r=Object.freeze({MoreThanOneElement:"Sequence contains more than one element",MoreThanOneMatchingElement:"Sequence contains more than one matching element",NoElements:"Sequence contains no elements",NoMatch:"Sequence contains no matching element"});class s extends Error{constructor(t){super(t),this.name="InvalidOperationException",this.stack=this.stack||(new Error).stack}}const i=(t,e)=>t===e;class a{constructor(t){this.iterator=t}[Symbol.asyncIterator](){return this.iterator()}}class c{constructor(t){this.dataFunc=t}[Symbol.asyncIterator](){const{dataFunc:t}=this;return async function*(){if(1===t.type)for(const e of t.generator())yield e;else for(const e of await t.generator())yield e}()}}class l{constructor(t){this.iterator=t}[Symbol.iterator](){return this.iterator()}}class h extends Array{}const u=(t,e,n,o)=>{if(o){if(!n)throw new ReferenceError("TAccumulate function is undefined");return w(t,e,n,o)}return n?g(t,e,n):f(t,e)},f=(t,e)=>{let n;for(const o of t)n=n?e(n,o):o;if(void 0===n)throw new s(r.NoElements);return n},g=(t,e,n)=>{let o=e;for(const e of t)o=n(o,e);return o},w=(t,e,n,o)=>{let r=e;for(const e of t)r=n(r,e);return o(r)},y=(t,e)=>{for(const n of t)if(!1===e(n))return!1;return!0},d=async(t,e)=>{for(const n of t)if(!1===await e(n))return!1;return!0},p=(t,e)=>e?m(t,e):_(t),_=t=>{for(const e of t)return!0;return!1},m=(t,e)=>{for(const n of t)if(!0===e(n))return!0;return!1},b=async(t,e)=>{for(const n of t)if(!0===await e(n))return!0;return!1},v=t=>{if(Array.isArray(t)){if(0===t.length)throw new s(r.NoElements);return new a((async function*(){for await(const e of t)yield e}))}return new a(t)},k=t=>v((async function*(){for(const e of t)yield e})),S=(t,e)=>new c({generator:e,type:t}),E=t=>S(0,(async()=>{const e=[];for(const n of t)e.push(n);return e})),C=(t,e)=>{let n=0,o=0;if(e)for(const r of t)n+=e(r),o+=1;else for(const e of t)n+=e,o+=1;if(0===o)throw new s(r.NoElements);return n/o},A=async(t,e)=>{let n=0,o=0;for(const r of t)n+=await e(r),o+=1;if(0===o)throw new s(r.NoElements);return n/o},I=(t,e)=>{if(e<1)throw new o("index");return new l((function*(){let n=[];for(const o of t)n.push(o),n.length===e&&(yield n,n=[]);n.length&&(yield n)}))},T=(t,e)=>new l((function*(){yield*t,yield*e})),P=(t,e,n=i)=>{for(const o of t)if(n(e,o))return!0;return!1},N=async(t,e,n)=>{for(const o of t)if(await n(e,o))return!0;return!1},M=(t,e)=>e?D(t,e):x(t),x=t=>{let e=0;for(const n of t)e++;return e},D=(t,e)=>{let n=0;for(const o of t)!0===e(o)&&n++;return n},$=async(t,e)=>{let n=0;for(const o of t)!0===await e(o)&&n++;return n},O=(t,e)=>new l((function*(){let n=!1;for(const e of t)n=!0,yield e;n||(yield e)})),R=(t,e=i)=>new l((function*(){const n=[];for(const o of t)n.find((t=>e(t,o)))||(n.push(o),yield o)})),W=(t,e)=>v((async function*(){const n=[];t:for(const o of t){for(const t of n)if(await e(t,o))continue t;n.push(o),yield o}})),j=(t,e)=>new l((function*(){for(const n of t)e(n),yield n})),F=(t,e)=>v((async function*(){for(const n of t)await e(n),yield n})),H=(t,e)=>{if(e<0)throw new o("index");let n=0;for(const o of t)if(e===n++)return o;throw new o("index")},B=(t,e)=>{let n=0;for(const o of t)if(e===n++)return o;return null},L=(t,e,n=i)=>new l((function*(){const o=[...e];for(const e of t){let t=!1;for(let r=0;r<o.length;r++)if(!0===n(e,o[r])){t=!0;break}!1===t&&(yield e)}})),q=(t,e,n)=>v((async function*(){const o=[...e];for(const e of t){let t=!1;for(let r=0;r<o.length;r++){const s=o[r];if(!0===await n(e,s)){t=!0;break}}!1===t&&(yield e)}})),U=(t,e)=>e?V(t,e):z(t),z=t=>{const e=t[Symbol.iterator]().next();if(!0===e.done)throw new s(r.NoElements);return e.value},V=(t,e)=>{for(const n of t)if(!0===e(n))return n;throw new s(r.NoMatch)},J=async(t,e)=>{for(const n of t)if(!0===await e(n))return n;throw new s(r.NoMatch)},K=(t,e)=>e?G(t,e):Y(t),Y=t=>t[Symbol.iterator]().next().value||null,G=(t,e)=>{for(const n of t)if(!0===e(n))return n;return null},Q=async(t,e)=>{for(const n of t)if(!0===await e(n))return n;return null};class X extends h{constructor(t,e){super(1),this.key=t,this[0]=e}}const Z=(t,e,n)=>{let o;return o=n?((t,e,n)=>function*(){const o=new Array;for(const r of t){const t=e(r);let s=!1;for(let e=0;e<o.length;e++){const i=o[e];if(n(i.key,t)){i.push(r),s=!0;break}}!1===s&&o.push(new X(t,r))}for(const t of o)yield t})(t,e,n):((t,e)=>function*(){const n={};for(const o of t){const t=e(o),r=n[t];r?r.push(o):n[t]=new X(t,o)}for(const t in n)yield n[t]})(t,e),new l(o)},tt=(t,e,n)=>n?nt(t,e,n):et(t,e),et=(t,e)=>v((async function*(){const n={};for(const o of t){const t=await e(o),r=n[t];r?r.push(o):n[t]=new X(t,o)}for(const t in n)yield n[t]})),nt=(t,e,n)=>v((async function*(){const o=new Array;for(const r of t){const t=await e(r);let s=!1;for(let e=0;e<o.length;e++){const i=o[e];if(!0===await n(i.key,t)){i.push(r),s=!0;break}}!1===s&&o.push(new X(t,r))}for(const t of o)yield t})),ot=(t,e,n,o)=>o?((t,e,n,o)=>new l((function*(){const r=new Array;for(const s of t){const t=e(s);let i=!1;for(let e=0;e<r.length;e++){const a=r[e];if(o(a.key,t)){a.push(n(s)),i=!0;break}}if(!1===i){const e=n(s);r.push(new X(t,e))}}for(const t of r)yield t})))(t,e,n,o):((t,e,n)=>new l((function*(){const o={};for(const r of t){const t=e(r),s=o[t],i=n(r);s?s.push(i):o[t]=new X(t,i)}for(const t in o)yield o[t]})))(t,e,n),rt=(t,e,n,o,r,s)=>{const i=s?st(t,e,n,o,r,s):it(t,e,n,o,r);return new l(i)},st=(t,e,n,o,r,s)=>function*(){var i;const a=[];for(const t of e){const e=o(t),n=a.find((t=>s(t.key,e)));n?n.values.push(t):a.push({key:e,values:[t]})}for(const e of t){const t=n(e),o=null!==(i=a.find((e=>s(e.key,t))))&&void 0!==i?i:{key:t,values:[]};yield r(e,o.values)}},it=(t,e,n,o,r)=>function*(){var s;const i=new Map;for(const t of e){const e=o(t),n=i.get(e);n?n.push(t):i.set(e,[t])}for(const e of t){const t=n(e),o=null!==(s=i.get(t))&&void 0!==s?s:[];yield r(e,o)}},at=(t,e,n,o,r,s)=>{const i=s?ct(t,e,n,o,r,s):lt(t,e,n,o,r);return v(i)},ct=(t,e,n,o,r,s)=>async function*(){var i;const a=[];for(const t of e){const e=await o(t),n=a.find((t=>s(t.key,e)));n?n.values.push(t):a.push({key:e,values:[t]})}for(const e of t){const t=await n(e),o=null!==(i=a.find((e=>s(e.key,t))))&&void 0!==i?i:{key:t,values:[]};yield r(e,o.values)}},lt=(t,e,n,o,r)=>async function*(){var s;const i=new Map;for(const t of e){const e=await o(t),n=i.get(e);n?n.push(t):i.set(e,[t])}for(const e of t){const t=await n(e),o=null!==(s=i.get(t))&&void 0!==s?s:[];yield r(e,o)}},ht=(t,e,n=i)=>new l((function*(){const o=[...t.distinct(n)];if(0===o.length)return;const r=[...e];for(let t=0;t<o.length;t++){const e=o[t];for(let t=0;t<r.length;t++)if(!0===n(e,r[t])){yield e;break}}})),ut=(t,e,n)=>v((async function*(){const o=[];for await(const e of t.distinctAsync(n))o.push(e);if(0===o.length)return;const r=[...e];for(let t=0;t<o.length;t++){const e=o[t];for(let t=0;t<r.length;t++){const o=r[t];if(!0===await n(e,o)){yield e;break}}}})),ft=(t,e,n,o,r,s=i)=>new l((function*(){const i=[...e];for(const e of t){const t=n(e);for(const n of i){const i=o(n);!0===s(t,i)&&(yield r(e,n))}}})),gt=(t,e)=>e?yt(t,e):wt(t),wt=t=>{let e;for(const n of t)e=n;if(!e)throw new s(r.NoElements);return e},yt=(t,e)=>{let n;for(const o of t)!0===e(o)&&(n=o);if(!n)throw new s(r.NoMatch);return n},dt=async(t,e)=>{let n;for(const o of t)!0===await e(o)&&(n=o);if(!n)throw new s(r.NoMatch);return n},pt=(t,e)=>e?mt(t,e):_t(t),_t=t=>{let e=null;for(const n of t)e=n;return e},mt=(t,e)=>{let n=null;for(const o of t)!0===e(o)&&(n=o);return n},bt=async(t,e)=>{let n=null;for(const o of t)!0===await e(o)&&(n=o);return n},vt=(t,e)=>e?St(t,e):kt(t),kt=t=>{let e=null;for(const n of t)e=Math.max(e||Number.NEGATIVE_INFINITY,n);if(null===e)throw new s(r.NoElements);return e},St=(t,e)=>{let n=null;for(const o of t)n=Math.max(n||Number.NEGATIVE_INFINITY,e(o));if(null===n)throw new s(r.NoElements);return n},Et=async(t,e)=>{let n=null;for(const o of t)n=Math.max(n||Number.NEGATIVE_INFINITY,await e(o));if(null===n)throw new s(r.NoElements);return n},Ct=(t,e)=>e?It(t,e):At(t),At=t=>{let e=null;for(const n of t)e=Math.min(e||Number.POSITIVE_INFINITY,n);if(null===e)throw new s(r.NoElements);return e},It=(t,e)=>{let n=null;for(const o of t)n=Math.min(n||Number.POSITIVE_INFINITY,e(o));if(null===n)throw new s(r.NoElements);return n},Tt=async(t,e)=>{let n=null;for(const o of t)n=Math.min(n||Number.POSITIVE_INFINITY,await e(o));if(null===n)throw new s(r.NoElements);return n},Pt=(t,e)=>{const n="string"==typeof e?t=>typeof t===e:t=>t instanceof e;return new l((function*(){for(const e of t)n(e)&&(yield e)}))};async function*Nt(t,e,n,o){const r=await(async(t,e)=>{const n=new Map;for(const o of t){const t=await e(o),r=n.get(t);r?r.push(o):n.set(t,[o])}return n})(t,e),s=[...r.keys()].sort(o||void 0);if(n)for(let t=0;t<s.length;t++)yield r.get(s[t]);else for(let t=s.length-1;t>=0;t--)yield r.get(s[t])}function*Mt(t,e,n,o){const r=((t,e)=>{const n=new Map;for(const o of t){const t=e(o),r=n.get(t);r?r.push(o):n.set(t,[o])}return n})(t,e),s=[...r.keys()].sort(o||void 0);if(n)for(let t=0;t<s.length;t++)yield r.get(s[t]);else for(let t=s.length-1;t>=0;t--)yield r.get(s[t])}class xt extends a{constructor(t){super((async function*(){for await(const e of t())yield*e})),this.orderedPairs=t}static generateAsync(t,e,n,o){let r;return r=t instanceof xt?async function*(){for await(const r of t.orderedPairs())yield*Nt(r,e,n,o)}:()=>async function*(t,e,n,o){const r=await(async(t,e)=>{const n=new Map;for await(const o of t){const t=await e(o),r=n.get(t);r?r.push(o):n.set(t,[o])}return n})(t,e),s=[...r.keys()].sort(o||void 0);if(n)for(let t=0;t<s.length;t++)yield r.get(s[t]);else for(let t=s.length-1;t>=0;t--)yield r.get(s[t])}(t,e,n,o),new xt(r)}static generate(t,e,n,o){let r;return r=t instanceof xt?async function*(){for await(const r of t.orderedPairs())yield*Mt(r,e,n,o)}:()=>async function*(t,e,n,o){const r=await(async(t,e)=>{const n=new Map;for await(const o of t){const t=e(o),r=n.get(t);r?r.push(o):n.set(t,[o])}return n})(t,e),s=[...r.keys()].sort(o||void 0);if(n)for(let t=0;t<s.length;t++)yield r.get(s[t]);else for(let t=s.length-1;t>=0;t--)yield r.get(s[t])}(t,e,n,o),new xt(r)}thenBy(t,e){return xt.generate(this,t,!0,e)}thenByAsync(t,e){return xt.generateAsync(this,t,!0,e)}thenByDescending(t,e){return xt.generate(this,t,!1,e)}thenByDescendingAsync(t,e){return xt.generateAsync(this,t,!1,e)}}function*Dt(t,e,n,o){const r=((t,e)=>{const n=new Map;for(const o of t){const t=e(o),r=n.get(t);r?r.push(o):n.set(t,[o])}return n})(t,e),s=[...r.keys()].sort(o||void 0);if(n)for(let t=0;t<s.length;t++)yield r.get(s[t]);else for(let t=s.length-1;t>=0;t--)yield r.get(s[t])}async function*$t(t,e,n,o){const r=await(async(t,e)=>{const n=new Map;for(const o of t){const t=await e(o),r=n.get(t);r?r.push(o):n.set(t,[o])}return n})(t,e),s=[...r.keys()].sort(o||void 0);if(n)for(let t=0;t<s.length;t++)yield r.get(s[t]);else for(let t=s.length-1;t>=0;t--)yield r.get(s[t])}class Ot extends l{constructor(t){super((function*(){for(const e of t())yield*e})),this.orderedPairs=t}static generate(t,e,n,o){let r;return r=t instanceof Ot?function*(){for(const r of t.orderedPairs())yield*Dt(r,e,n,o)}:()=>Dt(t,e,n,o),new Ot(r)}static generateAsync(t,e,n,o){let r;return r=t instanceof Ot?async function*(){for(const r of t.orderedPairs())yield*$t(r,e,n,o)}:()=>$t(t,e,n,o),new xt(r)}thenBy(t,e){return Ot.generate(this,t,!0,e)}thenByAsync(t,e){return Ot.generateAsync(this,t,!0,e)}thenByDescending(t,e){return Ot.generate(this,t,!1,e)}thenByDescendingAsync(t,e){return Ot.generateAsync(this,t,!1,e)}}const Rt=(t,e,n)=>Ot.generate(t,e,!0,n),Wt=(t,e,n)=>Ot.generateAsync(t,e,!0,n),jt=(t,e,n)=>Ot.generate(t,e,!1,n),Ft=(t,e,n)=>Ot.generateAsync(t,e,!1,n),Ht=(t,e)=>{const n=[],o=[];for(const r of t)!0===e(r)?o.push(r):n.push(r);return[o,n]},Bt=async(t,e)=>{const n=[],o=[];for(const r of t)!0===await e(r)?o.push(r):n.push(r);return[o,n]},Lt=t=>new l((function*(){const e=[...t];for(let t=e.length-1;t>=0;t--)yield e[t]})),qt=(t,e)=>{if("function"==typeof e){const{length:n}=e;return 1===n?Ut(t,e):zt(t,e)}return Vt(t,e)},Ut=(t,e)=>new l((function*(){for(const n of t)yield e(n)})),zt=(t,e)=>new l((function*(){let n=0;for(const o of t)yield e(o,n),n++})),Vt=(t,e)=>new l((function*(){for(const n of t)yield n[e]})),Jt=(t,e)=>"function"==typeof e?1===e.length?Kt(t,e):Yt(t,e):Gt(t,e),Kt=(t,e)=>v((async function*(){for(const n of t)yield e(n)})),Yt=(t,e)=>v((async function*(){let n=0;for(const o of t)yield e(o,n),n++})),Gt=(t,e)=>v((async function*(){for(const n of t)yield n[e]})),Qt=(t,e)=>"function"==typeof e?1===e.length?Xt(t,e):Zt(t,e):te(t,e),Xt=(t,e)=>new l((function*(){for(const n of t)for(const t of e(n))yield t})),Zt=(t,e)=>new l((function*(){let n=0;for(const o of t){for(const t of e(o,n))yield t;n++}})),te=(t,e)=>new l((function*(){for(const n of t)for(const t of n[e])yield t})),ee=(t,e)=>1===e.length?ne(t,e):oe(t,e),ne=(t,e)=>v((async function*(){for(const n of t){const t=await e(n);for(const e of t)yield e}})),oe=(t,e)=>v((async function*(){let n=0;for(const o of t){const t=await e(o,n);for(const e of t)yield e;n++}})),re=(t,e,n=i)=>{const o=t[Symbol.iterator](),r=e[Symbol.iterator]();let s=o.next(),a=r.next();for(;!s.done&&!a.done;){if(!n(s.value,a.value))return!1;s=o.next(),a=r.next()}return!0===s.done&&!0===a.done},se=async(t,e,n)=>{const o=t[Symbol.iterator](),r=e[Symbol.iterator]();let s=o.next(),i=r.next();for(;!s.done&&!i.done;){if(!1===await n(s.value,i.value))return!1;s=o.next(),i=r.next()}return!0===s.done&&!0===i.done},ie=(t,e)=>e?ce(t,e):ae(t),ae=t=>{let e=!1,n=null;for(const o of t){if(!0===e)throw new s(r.MoreThanOneElement);e=!0,n=o}if(!1===e)throw new s(r.NoElements);return n},ce=(t,e)=>{let n=!1,o=null;for(const i of t)if(e(i)){if(!0===n)throw new s(r.MoreThanOneMatchingElement);n=!0,o=i}if(!1===n)throw new s(r.NoMatch);return o},le=async(t,e)=>{let n=!1,o=null;for(const i of t)if(await e(i)){if(!0===n)throw new s(r.MoreThanOneMatchingElement);n=!0,o=i}if(!1===n)throw new s(r.NoMatch);return o},he=(t,e)=>e?fe(t,e):ue(t),ue=t=>{let e=!1,n=null;for(const o of t){if(!0===e)throw new s(r.MoreThanOneElement);e=!0,n=o}return n},fe=(t,e)=>{let n=!1,o=null;for(const i of t)if(e(i)){if(!0===n)throw new s(r.MoreThanOneMatchingElement);n=!0,o=i}return o},ge=async(t,e)=>{let n=!1,o=null;for(const i of t)if(await e(i)){if(!0===n)throw new s(r.MoreThanOneElement);n=!0,o=i}return o},we=(t,e)=>new l((function*(){let n=0;for(const o of t)n++>=e&&(yield o)})),ye=(t,e)=>1===e.length?de(t,e):pe(t,e),de=(t,e)=>new l((function*(){let n=!0;for(const o of t)!1===n?yield o:!1===e(o)&&(n=!1,yield o)})),pe=(t,e)=>new l((function*(){let n=0,o=!0;for(const r of t)!1===o?yield r:!1===e(r,n)&&(o=!1,yield r),n++})),_e=(t,e)=>1===e.length?me(t,e):be(t,e),me=(t,e)=>v((async function*(){let n=!0;for(const o of t)!1===n?yield o:!1===await e(o)&&(n=!1,yield o)})),be=(t,e)=>v((async function*(){let n=0,o=!0;for(const r of t)!1===o?yield r:!1===await e(r,n)&&(o=!1,yield r),n++})),ve=(t,e)=>e?Se(t,e):ke(t),ke=t=>{let e=0;for(const n of t)e+=n;return e},Se=(t,e)=>{let n=0;for(const o of t)n+=e(o);return n},Ee=async(t,e)=>{let n=0;for(const o of t)n+=await e(o);return n},Ce=(t,e)=>new l((function*(){let n=e>0?e:0;for(const e of t){if(0==n--)break;yield e}})),Ae=(t,e)=>1===e.length?Ie(t,e):Te(t,e),Ie=(t,e)=>new l((function*(){for(const n of t){if(!e(n))break;yield n}})),Te=(t,e)=>new l((function*(){let n=0;for(const o of t){if(!e(o,n++))break;yield o}})),Pe=(t,e)=>1===e.length?Ne(t,e):Me(t,e),Ne=(t,e)=>v((async function*(){for(const n of t){if(!await e(n))break;yield n}})),Me=(t,e)=>v((async function*(){let n=0;for(const o of t){if(!await e(o,n++))break;yield o}})),xe=t=>[...t],De=(t,e)=>{const n=new Map;for(const o of t){const t=e(o),r=n.get(t);void 0===r?n.set(t,[o]):r.push(o)}return n},$e=async(t,e)=>{const n=new Map;for(const o of t){const t=await e(o),r=n.get(t);void 0===r?n.set(t,[o]):r.push(o)}return n},Oe=(t,e)=>{const n={};for(const o of t)n[e(o)]=o;return n},Re=async(t,e)=>{const n={};for(const o of t)n[await e(o)]=o;return n},We=t=>new Set(t),je=(t,e,n)=>n?He(t,e,n):Fe(t,e),Fe=(t,e)=>new l((function*(){const n=new Set;for(const e of t)!1===n.has(e)&&(yield e,n.add(e));for(const t of e)!1===n.has(t)&&(yield t,n.add(t))})),He=(t,e,n)=>new l((function*(){const o=[];for(const r of[t,e])for(const t of r){let e=!1;for(const r of o)if(!0===n(t,r)){e=!0;break}!1===e&&(yield t,o.push(t))}})),Be=(t,e,n)=>v((async function*(){const o=[];for(const r of[t,e])for(const t of r){let e=!1;for(const r of o)if(!0===await n(t,r)){e=!0;break}!1===e&&(yield t,o.push(t))}})),Le=(t,e)=>1===e.length?qe(t,e):Ue(t,e),qe=(t,e)=>new l((function*(){for(const n of t)!0===e(n)&&(yield n)})),Ue=(t,e)=>new l((function*(){let n=0;for(const o of t)!0===e(o,n++)&&(yield o)})),ze=(t,e)=>1===e.length?Ve(t,e):Je(t,e),Ve=(t,e)=>v((async function*(){for(const n of t)!0===await e(n)&&(yield n)})),Je=(t,e)=>v((async function*(){let n=0;for(const o of t)!0===await e(o,n++)&&(yield o)})),Ke=(t,e,n)=>n?Ge(t,e,n):Ye(t,e),Ye=(t,e)=>new l((function*(){const n=t[Symbol.iterator](),o=e[Symbol.iterator]();for(;;){const t=n.next(),e=o.next();if(t.done||e.done)break;yield[t.value,e.value]}})),Ge=(t,e,n)=>new l((function*(){const o=t[Symbol.iterator](),r=e[Symbol.iterator]();for(;;){const t=o.next(),e=r.next();if(t.done||e.done)break;yield n(t.value,e.value)}})),Qe=(t,e,n)=>v((async function*(){const o=t[Symbol.iterator](),r=e[Symbol.iterator]();for(;;){const t=o.next(),e=r.next();if(t.done||e.done)break;yield n(t.value,e.value)}})),Xe=t=>{const e=t.prototype,n=(t,n)=>{const o=function(...e){return t(this,...e)};Object.defineProperty(o,"length",{value:t.length-1}),e[n]=o};n(u,"aggregate"),n(y,"all"),n(d,"allAsync"),n(p,"any"),n(b,"anyAsync"),n(k,"asAsync"),n(E,"asParallel"),n(C,"average"),n(A,"averageAsync"),n(I,"chunk"),n(T,"concatenate"),n(P,"contains"),n(N,"containsAsync"),n(M,"count"),n($,"countAsync"),n(O,"defaultIfEmpty"),n(R,"distinct"),n(W,"distinctAsync"),n(j,"each"),n(F,"eachAsync"),n(H,"elementAt"),n(B,"elementAtOrDefault"),n(L,"except"),n(q,"exceptAsync"),n(U,"first"),n(J,"firstAsync"),n(K,"firstOrDefault"),n(Q,"firstOrDefaultAsync"),n(Z,"groupBy"),n(tt,"groupByAsync"),n(ot,"groupByWithSel"),n(rt,"groupJoin"),n(at,"groupJoinAsync"),n(ht,"intersect"),n(ut,"intersectAsync"),n(ft,"joinByKey"),n(gt,"last"),n(dt,"lastAsync"),n(pt,"lastOrDefault"),n(bt,"lastOrDefaultAsync"),n(vt,"max"),n(Et,"maxAsync"),n(Ct,"min"),n(Tt,"minAsync"),n(Pt,"ofType"),n(Rt,"orderBy"),n(Wt,"orderByAsync"),n(jt,"orderByDescending"),n(Ft,"orderByDescendingAsync"),n(Lt,"reverse"),n(qt,"select"),n(Jt,"selectAsync"),n(Qt,"selectMany"),n(ee,"selectManyAsync"),n(re,"sequenceEquals"),n(se,"sequenceEqualsAsync"),n(ie,"single"),n(le,"singleAsync"),n(he,"singleOrDefault"),n(ge,"singleOrDefaultAsync"),n(we,"skip"),n(ye,"skipWhile"),n(_e,"skipWhileAsync"),n(ve,"sum"),n(Ee,"sumAsync"),n(Ce,"take"),n(Ae,"takeWhile"),n(Pe,"takeWhileAsync"),n(xe,"toArray"),n(De,"toMap"),n($e,"toMapAsync"),n(Oe,"toObject"),n(Re,"toObjectAsync"),n(Ht,"partition"),n(Bt,"partitionAsync"),n(We,"toSet"),n(je,"union"),n(Be,"unionAsync"),n(Le,"where"),n(ze,"whereAsync"),n(Ke,"zip"),n(Qe,"zipAsync")},Ze=(t,e,n,o)=>{if(o){if(!n)throw new ReferenceError("TAccumulate function is undefined");return nn(t,e,n,o)}return n?en(t,e,n):tn(t,e)},tn=async(t,e)=>{let n;for await(const o of t)n=n?e(n,o):o;if(void 0===n)throw new s(r.NoElements);return n},en=async(t,e,n)=>{let o=e;for await(const e of t)o=n(o,e);return o},nn=async(t,e,n,o)=>{let r=e;for await(const e of t)r=n(r,e);return o(r)},on=async(t,e)=>{for await(const n of t)if(!1===e(n))return!1;return!0},rn=async(t,e)=>{for await(const n of t)if(!1===await e(n))return!1;return!0},sn=(t,e)=>e?cn(t,e):an(t),an=async t=>{for await(const e of t)return!0;return!1},cn=async(t,e)=>{for await(const n of t)if(!0===e(n))return!0;return!1},ln=async(t,e)=>{for await(const n of t)if(!0===await e(n))return!0;return!1},hn=t=>S(0,(async()=>{const e=[];for await(const n of t)e.push(n);return e})),un=async(t,e)=>{let n=0,o=0;if(e)for await(const r of t)n+=e(r),o+=1;else for await(const e of t)n+=e,o+=1;if(0===o)throw new s(r.NoElements);return n/o},fn=async(t,e)=>{let n=0,o=0;for await(const r of t)n+=await e(r),o+=1;if(0===o)throw new s(r.NoElements);return n/o},gn=(t,e)=>{if(e<1)throw new o("index");return new a((async function*(){let n=[];for await(const o of t)n.push(o),n.length===e&&(yield n,n=[]);n.length&&(yield n)}))},wn=(t,e)=>new a((async function*(){yield*t,yield*e})),yn=async(t,e,n=i)=>{for await(const o of t)if(n(e,o))return!0;return!1},dn=async(t,e,n)=>{for await(const o of t)if(await n(e,o))return!0;return!1},pn=(t,e)=>e?mn(t,e):_n(t),_n=async t=>{let e=0;for await(const n of t)e++;return e},mn=async(t,e)=>{let n=0;for await(const o of t)!0===e(o)&&n++;return n},bn=async(t,e)=>{let n=0;for await(const o of t)!0===await e(o)&&n++;return n},vn=(t,e)=>new a((async function*(){let n=!1;for await(const e of t)n=!0,yield e;n||(yield e)})),kn=(t,e=i)=>new a((async function*(){const n=[];for await(const o of t)n.find((t=>e(t,o)))||(n.push(o),yield o)})),Sn=(t,e)=>new a((async function*(){const n=[];t:for await(const o of t){for(const t of n)if(await e(t,o))continue t;n.push(o),yield o}})),En=(t,e)=>new a((async function*(){for await(const n of t)e(n),yield n})),Cn=(t,e)=>new a((async function*(){for await(const n of t)await e(n),yield n})),An=async(t,e)=>{if(e<0)throw new o("index");let n=0;for await(const o of t)if(e===n++)return o;throw new o("index")},In=async(t,e)=>{let n=0;for await(const o of t)if(e===n++)return o;return null},Tn=(t,e,n=i)=>new a((async function*(){const o=[];for await(const t of e)o.push(t);for await(const e of t){let t=!1;for(let r=0;r<o.length;r++){const s=o[r];if(!0===n(e,s)){t=!0;break}}!1===t&&(yield e)}})),Pn=(t,e,n)=>new a((async function*(){const o=[];for await(const t of e)o.push(t);for await(const e of t){let t=!1;for(let r=0;r<o.length;r++){const s=o[r];if(!0===await n(e,s)){t=!0;break}}!1===t&&(yield e)}})),Nn=(t,e)=>e?xn(t,e):Mn(t),Mn=async t=>{const e=await t[Symbol.asyncIterator]().next();if(!0===e.done)throw new s(r.NoElements);return e.value},xn=async(t,e)=>{for await(const n of t)if(!0===e(n))return n;throw new s(r.NoMatch)},Dn=async(t,e)=>{for await(const n of t)if(!0===await e(n))return n;throw new s(r.NoMatch)},$n=(t,e)=>e?Rn(t,e):On(t),On=async t=>(await t[Symbol.asyncIterator]().next()).value||null,Rn=async(t,e)=>{for await(const n of t)if(!0===e(n))return n;return null},Wn=async(t,e)=>{for await(const n of t)if(!0===await e(n))return n;return null},jn=(t,e,n)=>n?Fn(t,e,n):Hn(t,e),Fn=(t,e,n)=>new a((async function*(){const o=new Array;for await(const r of t){const t=e(r);let s=!1;for(let e=0;e<o.length;e++){const i=o[e];if(n(i.key,t)){i.push(r),s=!0;break}}!1===s&&o.push(new X(t,r))}for(const t of o)yield t})),Hn=(t,e)=>new a((async function*(){const n={};for await(const o of t){const t=e(o),r=n[t];r?r.push(o):n[t]=new X(t,o)}for(const t in n)yield n[t]})),Bn=(t,e,n)=>n?qn(t,e,n):Ln(t,e),Ln=(t,e)=>new a((async function*(){const n={};for await(const o of t){const t=await e(o),r=n[t];r?r.push(o):n[t]=new X(t,o)}for(const t in n)yield n[t]})),qn=(t,e,n)=>new a((async function*(){const o=new Array;for await(const r of t){const t=await e(r);let s=!1;for(let e=0;e<o.length;e++){const i=o[e];if(!0===await n(i.key,t)){i.push(r),s=!0;break}}!1===s&&o.push(new X(t,r))}for(const t of o)yield t})),Un=(t,e,n,o)=>o?Vn(t,e,n,o):zn(t,e,n),zn=(t,e,n)=>new a((async function*(){const o={};for await(const r of t){const t=e(r),s=o[t],i=n(r);s?s.push(i):o[t]=new X(t,i)}for(const t in o)yield o[t]})),Vn=(t,e,n,o)=>new a((async function*(){const r=new Array;for await(const s of t){const t=e(s);let i=!1;for(let e=0;e<r.length;e++){const a=r[e];if(o(a.key,t)){a.push(n(s)),i=!0;break}}if(!1===i){const e=n(s);r.push(new X(t,e))}}for(const t of r)yield t})),Jn=(t,e,n,o,r,s)=>{const i=s?Kn(t,e,n,o,r,s):Yn(t,e,n,o,r);return new a(i)},Kn=(t,e,n,o,r,s)=>async function*(){var i;const a=[];for await(const t of e){const e=o(t),n=a.find((t=>s(t.key,e)));n?n.values.push(t):a.push({key:e,values:[t]})}for await(const e of t){const t=n(e),o=null!==(i=a.find((e=>s(e.key,t))))&&void 0!==i?i:{key:t,values:[]};yield r(e,o.values)}},Yn=(t,e,n,o,r)=>async function*(){var s;const i=new Map;for await(const t of e){const e=o(t),n=i.get(e);n?n.push(t):i.set(e,[t])}for await(const e of t){const t=n(e),o=null!==(s=i.get(t))&&void 0!==s?s:[];yield r(e,o)}},Gn=(t,e,n,o,r,s)=>{const i=s?Qn(t,e,n,o,r,s):Xn(t,e,n,o,r);return new a(i)},Qn=(t,e,n,o,r,s)=>async function*(){var i;const a=[];for await(const t of e){const e=await o(t),n=a.find((t=>s(t.key,e)));n?n.values.push(t):a.push({key:e,values:[t]})}for await(const e of t){const t=await n(e),o=null!==(i=a.find((e=>s(e.key,t))))&&void 0!==i?i:{key:t,values:[]};yield r(e,o.values)}},Xn=(t,e,n,o,r)=>async function*(){var s;const i=new Map;for await(const t of e){const e=await o(t),n=i.get(e);n?n.push(t):i.set(e,[t])}for await(const e of t){const t=await n(e),o=null!==(s=i.get(t))&&void 0!==s?s:[];yield r(e,o)}},Zn=(t,e,n=i)=>new a((async function*(){const o=await t.distinct(n).toArray();if(0===o.length)return;const r=await e.toArray();for(let t=0;t<o.length;t++){const e=o[t];for(let t=0;t<r.length;t++){const o=r[t];if(!0===n(e,o)){yield e;break}}}})),to=(t,e,n)=>new a((async function*(){const o=await t.distinctAsync(n).toArray();if(0===o.length)return;const r=await e.toArray();for(let t=0;t<o.length;t++){const e=o[t];for(let t=0;t<r.length;t++){const o=r[t];if(!0===await n(e,o)){yield e;break}}}})),eo=(t,e,n,o,r,s=i)=>new a((async function*(){const i=[];for await(const t of e)i.push(t);for await(const e of t){const t=n(e);for(const n of i){const i=o(n);!0===s(t,i)&&(yield r(e,n))}}})),no=(t,e)=>e?ro(t,e):oo(t),oo=async t=>{let e=null;for await(const n of t)e=n;if(!e)throw new s(r.NoElements);return e},ro=async(t,e)=>{let n=null;for await(const o of t)!0===e(o)&&(n=o);if(!n)throw new s(r.NoMatch);return n},so=async(t,e)=>{let n=null;for await(const o of t)!0===await e(o)&&(n=o);if(!n)throw new s(r.NoMatch);return n},io=(t,e)=>e?co(t,e):ao(t),ao=async t=>{let e=null;for await(const n of t)e=n;return e},co=async(t,e)=>{let n=null;for await(const o of t)!0===e(o)&&(n=o);return n},lo=async(t,e)=>{let n=null;for await(const o of t)!0===await e(o)&&(n=o);return n},ho=(t,e)=>e?fo(t,e):uo(t),uo=async t=>{let e=null;for await(const n of t)e=Math.max(e||Number.NEGATIVE_INFINITY,n);if(null===e)throw new s(r.NoElements);return e},fo=async(t,e)=>{let n=null;for await(const o of t)n=Math.max(n||Number.NEGATIVE_INFINITY,e(o));if(null===n)throw new s(r.NoElements);return n},go=async(t,e)=>{let n=null;for await(const o of t)n=Math.max(n||Number.NEGATIVE_INFINITY,await e(o));if(null===n)throw new s(r.NoElements);return n},wo=(t,e)=>e?po(t,e):yo(t),yo=async t=>{let e=null;for await(const n of t)e=Math.min(e||Number.POSITIVE_INFINITY,n);if(null===e)throw new s(r.NoElements);return e},po=async(t,e)=>{let n=null;for await(const o of t)n=Math.min(n||Number.POSITIVE_INFINITY,e(o));if(null===n)throw new s(r.NoElements);return n},_o=async(t,e)=>{let n=null;for await(const o of t)n=Math.min(n||Number.POSITIVE_INFINITY,await e(o));if(null===n)throw new s(r.NoElements);return n},mo=(t,e)=>{const n="string"==typeof e?t=>typeof t===e:t=>t instanceof e;return new a((async function*(){for await(const e of t)n(e)&&(yield e)}))},bo=(t,e,n)=>xt.generate(t,e,!0,n),vo=(t,e,n)=>xt.generateAsync(t,e,!0,n),ko=(t,e,n)=>xt.generate(t,e,!1,n),So=(t,e,n)=>xt.generateAsync(t,e,!1,n),Eo=async(t,e)=>{const n=[],o=[];for await(const r of t)!0===e(r)?o.push(r):n.push(r);return[o,n]},Co=async(t,e)=>{const n=[],o=[];for await(const r of t)!0===await e(r)?o.push(r):n.push(r);return[o,n]},Ao=t=>new a((async function*(){const e=[];for await(const n of t)e.push(n);for(let t=e.length-1;t>=0;t--)yield e[t]})),Io=(t,e)=>"function"==typeof e?1===e.length?To(t,e):Po(t,e):No(t,e),To=(t,e)=>new a((async function*(){for await(const n of t)yield e(n)})),Po=(t,e)=>new a((async function*(){let n=0;for await(const o of t)yield e(o,n),n++})),No=(t,e)=>new a((async function*(){for await(const n of t)yield n[e]})),Mo=(t,e)=>"string"==typeof e?Do(t,e):xo(t,e),xo=(t,e)=>new a((async function*(){for await(const n of t)yield e(n)})),Do=(t,e)=>new a((async function*(){for await(const n of t)yield n[e]})),$o=(t,e)=>"function"==typeof e?1===e.length?Oo(t,e):Ro(t,e):Wo(t,e),Oo=(t,e)=>new a((async function*(){for await(const n of t)for(const t of e(n))yield t})),Ro=(t,e)=>new a((async function*(){let n=0;for await(const o of t){for(const t of e(o,n))yield t;n++}})),Wo=(t,e)=>new a((async function*(){for await(const n of t)for(const t of n[e])yield t})),jo=(t,e)=>1===e.length?new a((async function*(){for await(const n of t){const t=await e(n);for(const e of t)yield e}})):new a((async function*(){let n=0;for await(const o of t){const t=await e(o,n);for(const e of t)yield e;n++}})),Fo=async(t,e,n=i)=>{const o=t[Symbol.asyncIterator](),r=e[Symbol.asyncIterator]();let s=await Promise.all([o.next(),r.next()]),a=s[0],c=s[1];for(;!a.done&&!c.done;){if(!n(a.value,c.value))return!1;s=await Promise.all([o.next(),r.next()]),a=s[0],c=s[1]}return!0===a.done&&!0===c.done},Ho=async(t,e,n)=>{const o=t[Symbol.asyncIterator](),r=e[Symbol.asyncIterator]();let s=await Promise.all([o.next(),r.next()]),i=s[0],a=s[1];for(;!i.done&&!a.done;){if(!1===await n(i.value,a.value))return!1;s=await Promise.all([o.next(),r.next()]),i=s[0],a=s[1]}return!0===i.done&&!0===a.done},Bo=(t,e)=>e?qo(t,e):Lo(t),Lo=async t=>{let e=!1,n=null;for await(const o of t){if(!0===e)throw new s(r.MoreThanOneElement);e=!0,n=o}if(!1===e)throw new s(r.NoElements);return n},qo=async(t,e)=>{let n=!1,o=null;for await(const i of t)if(e(i)){if(!0===n)throw new s(r.MoreThanOneMatchingElement);n=!0,o=i}if(!1===n)throw new s(r.NoMatch);return o},Uo=async(t,e)=>{let n=!1,o=null;for await(const i of t)if(await e(i)){if(!0===n)throw new s(r.MoreThanOneMatchingElement);n=!0,o=i}if(!1===n)throw new s(r.NoMatch);return o},zo=(t,e)=>e?Jo(t,e):Vo(t),Vo=async t=>{let e=!1,n=null;for await(const o of t){if(!0===e)throw new s(r.MoreThanOneElement);e=!0,n=o}return n},Jo=async(t,e)=>{let n=!1,o=null;for await(const i of t)if(e(i)){if(!0===n)throw new s(r.MoreThanOneMatchingElement);n=!0,o=i}return o},Ko=async(t,e)=>{let n=!1,o=null;for await(const i of t)if(await e(i)){if(!0===n)throw new s(r.MoreThanOneMatchingElement);n=!0,o=i}return o},Yo=(t,e)=>new a((async function*(){let n=0;for await(const o of t)n++>=e&&(yield o)})),Go=(t,e)=>1===e.length?Qo(t,e):Xo(t,e),Qo=(t,e)=>new a((async function*(){let n=!0;for await(const o of t)!1===n?yield o:!1===e(o)&&(n=!1,yield o)})),Xo=(t,e)=>new a((async function*(){let n=0,o=!0;for await(const r of t)!1===o?yield r:!1===e(r,n)&&(o=!1,yield r),n++})),Zo=(t,e)=>1===e.length?tr(t,e):er(t,e),tr=(t,e)=>new a((async function*(){let n=!0;for await(const o of t)!1===n?yield o:!1===await e(o)&&(n=!1,yield o)})),er=(t,e)=>new a((async function*(){let n=0,o=!0;for await(const r of t)!1===o?yield r:!1===await e(r,n)&&(o=!1,yield r),n++})),nr=(t,e)=>e?rr(t,e):or(t),or=async t=>{let e=0;for await(const n of t)e+=n;return e},rr=async(t,e)=>{let n=0;for await(const o of t)n+=e(o);return n},sr=async(t,e)=>{let n=0;for await(const o of t)n+=await e(o);return n},ir=(t,e)=>new a((async function*(){let n=e>0?e:0;for await(const e of t){if(0==n--)break;yield e}})),ar=(t,e)=>1===e.length?cr(t,e):lr(t,e),cr=(t,e)=>new a((async function*(){for await(const n of t){if(!e(n))break;yield n}})),lr=(t,e)=>new a((async function*(){let n=0;for await(const o of t){if(!e(o,n++))break;yield o}})),hr=(t,e)=>1===e.length?ur(t,e):fr(t,e),ur=(t,e)=>new a((async function*(){for await(const n of t){if(!await e(n))break;yield n}})),fr=(t,e)=>new a((async function*(){let n=0;for await(const o of t){if(!await e(o,n++))break;yield o}})),gr=async t=>{const e=[];for await(const n of t)e.push(n);return e},wr=async(t,e)=>{const n=new Map;for await(const o of t){const t=e(o),r=n.get(t);void 0===r?n.set(t,[o]):r.push(o)}return n},yr=async(t,e)=>{const n=new Map;for await(const o of t){const t=await e(o),r=n.get(t);void 0===r?n.set(t,[o]):r.push(o)}return n},dr=async(t,e)=>{const n={};for await(const o of t)n[e(o)]=o;return n},pr=async(t,e)=>{const n={};for await(const o of t)n[await e(o)]=o;return n},_r=async t=>{const e=new Set;for await(const n of t)e.add(n);return e},mr=(t,e,n)=>n?vr(t,e,n):br(t,e),br=(t,e)=>new a((async function*(){const n=new Set;for await(const e of t)!1===n.has(e)&&(yield e,n.add(e));for await(const t of e)!1===n.has(t)&&(yield t,n.add(t))})),vr=(t,e,n)=>new a((async function*(){const o=[];for(const r of[t,e])for await(const t of r){let e=!1;for(const r of o)if(!0===n(t,r)){e=!0;break}!1===e&&(yield t,o.push(t))}})),kr=(t,e,n)=>new a((async function*(){const o=[];for(const r of[t,e])for await(const t of r){let e=!1;for(const r of o)if(!0===await n(t,r)){e=!0;break}!1===e&&(yield t,o.push(t))}})),Sr=(t,e)=>1===e.length?Er(t,e):Cr(t,e),Er=(t,e)=>new a((async function*(){for await(const n of t)!0===e(n)&&(yield n)})),Cr=(t,e)=>new a((async function*(){let n=0;for await(const o of t)!0===e(o,n++)&&(yield o)})),Ar=(t,e)=>1===e.length?Ir(t,e):Tr(t,e),Ir=(t,e)=>new a((async function*(){for await(const n of t)!0===await e(n)&&(yield n)})),Tr=(t,e)=>new a((async function*(){let n=0;for await(const o of t)!0===await e(o,n++)&&(yield o)})),Pr=(t,e,n)=>n?Mr(t,e,n):Nr(t,e),Nr=(t,e)=>new a((async function*(){const n=t[Symbol.asyncIterator](),o=e[Symbol.asyncIterator]();for(;;){const[t,e]=await Promise.all([n.next(),o.next()]);if(t.done||e.done)break;yield[t.value,e.value]}})),Mr=(t,e,n)=>new a((async function*(){const o=t[Symbol.asyncIterator](),r=e[Symbol.asyncIterator]();for(;;){const[t,e]=await Promise.all([o.next(),r.next()]);if(t.done||e.done)break;yield n(t.value,e.value)}})),xr=(t,e,n)=>new a((async function*(){const o=t[Symbol.asyncIterator](),r=e[Symbol.asyncIterator]();for(;;){const t=await Promise.all([o.next(),r.next()]),e=t[0],s=t[1];if(e.done||s.done)break;yield n(e.value,s.value)}})),Dr=(t,e,n,o)=>{if(o){if(!n)throw new ReferenceError("TAccumulate function is undefined");return Rr(t,e,n,o)}return n?Or(t,e,n):$r(t,e)},$r=async(t,e)=>{let n;for await(const o of t)n=n?e(n,o):o;if(void 0===n)throw new s(r.NoElements);return n},Or=async(t,e,n)=>{let o=e;for await(const e of t)o=n(o,e);return o},Rr=async(t,e,n,o)=>{let r=e;for await(const e of t)r=n(r,e);return o(r)},Wr=(t,e)=>{const n=t.dataFunc;switch(n.type){case 0:return{generator:()=>n.generator().then((t=>{const n=new Array(t.length);for(let o=0;o<t.length;o++)n[o]=e(t[o]);return n})),type:0};case 1:return{generator:()=>{const t=n.generator(),o=new Array(t.length);for(let n=0;n<t.length;n++)o[n]=t[n].then(e);return o},type:1};case 2:return{generator:async()=>{const t=await n.generator(),o=new Array(t.length);for(let n=0;n<t.length;n++)o[n]=t[n].then(e);return o},type:2}}},jr=(t,e)=>{const n=Wr(t,(t=>{if(!e(t))throw new Error(String(!1));return!0}));switch(n.type){case 0:return n.generator().then((()=>!0),(()=>!1));case 1:return Promise.all(n.generator()).then((()=>!0),(()=>!1));case 2:return n.generator().then(Promise.all.bind(Promise)).then((()=>!0),(()=>!1))}},Fr=(t,e)=>{const n=t.dataFunc;switch(n.type){case 0:return{generator:async()=>{const t=await n.generator(),o=new Array(t.length);for(let n=0;n<t.length;n++)o[n]=e(t[n]);return o},type:2};case 1:return{generator:()=>n.generator().map((async t=>{const n=await t;return await e(n)})),type:1};case 2:return{generator:async()=>(await n.generator()).map((t=>t.then(e))),type:2}}},Hr=(t,e)=>{const n=Fr(t,(async t=>{if(!1===await e(t))throw new Error(String(!1));return!0}));switch(n.type){case 1:return Promise.all(n.generator()).then((()=>!0),(()=>!1));case 2:return n.generator().then(Promise.all.bind(Promise)).then((()=>!0),(()=>!1))}},Br=(t,e)=>e?qr(t,e):Lr(t),Lr=async t=>{const e=t.dataFunc;let n;switch(e.type){case 1:return n=e.generator(),0!==n.length;case 0:case 2:return n=await e.generator(),0!==n.length}},qr=async(t,e)=>{const n=Wr(t,e);let o;switch(n.type){case 0:return o=await n.generator(),o.includes(!0);case 1:return o=await Promise.all(n.generator()),o.includes(!0);case 2:return o=await Promise.all(await n.generator()),o.includes(!0)}},Ur=async(t,e)=>{const n=Fr(t,e);let o;switch(n.type){case 1:return o=n.generator(),0!==o.length&&new Promise(((t,e)=>{let n=0;for(const r of o)r.then((e=>{n++,e?t(!0):n===o.length&&t(!1)}),e)}));case 2:return o=await n.generator(),0===Promise.length?!1:(await Promise.all(o)).includes(!0)}},zr=t=>v((async function*(){for await(const e of t)yield e})),Vr=async t=>{switch(t.type){case 0:return await t.generator();case 1:return await Promise.all(t.generator());case 2:const e=await t.generator();return await Promise.all(e)}},Jr=async(t,e)=>{let n;n=e?Wr(t,e):t.dataFunc;const o=await Vr(n);if(0===o.length)throw new s(r.NoElements);let i=0;for(const t of o)i+=t;return i/o.length},Kr=async(t,e)=>{const n=Fr(t,e),o=await Vr(n);if(0===o.length)throw new s(r.NoElements);let i=0;for(const t of o)i+=t;return i/o.length},Yr=(t,e)=>{if(e<1)throw new o("index");let n;switch(t.dataFunc.type){case 1:const o=t.dataFunc.generator;n={type:1,generator:()=>{const t=[];let n=[];for(const r of o())n.push(r),n.length===e&&(t.push(Promise.all(n)),n=[]);return n.length&&t.push(Promise.all(n)),t}};break;case 2:const r=t.dataFunc.generator;n={type:2,generator:async()=>{const t=[];let n=[];for(const o of await r())n.push(o),n.length===e&&(t.push(Promise.all(n)),n=[]);return n.length&&t.push(Promise.all(n)),t}};break;case 0:const s=t.dataFunc.generator;n={type:0,generator:async()=>{const t=[];let n=[];for(const o of await s())n.push(o),n.length===e&&(t.push(n),n=[]);return n.length&&t.push(n),t}}}return new c(n)},Gr=(t,e)=>new c({generator:async()=>{const[n,o]=await Promise.all([t.toArray(),e.toArray()]);return[...n,...o]},type:0}),Qr=async(t,e,n=i)=>{let o;switch(o=Wr(t,n?t=>n(e,t):t=>t===e),o.type){case 0:return(await o.generator()).some((t=>t));case 1:return(await Promise.all(o.generator())).some((t=>t));case 2:return(await Promise.all(await o.generator())).some((t=>t))}},Xr=async(t,e,n)=>{const o=Fr(t,(t=>n(e,t)));switch(o.type){case 1:return(await Promise.all(o.generator())).some((t=>t));case 2:return(await Promise.all(await o.generator())).some((t=>t))}},Zr=(t,e)=>e?es(t,e):ts(t),ts=async t=>{const e=t.dataFunc;switch(e.type){case 0:case 2:return(await t.toArray()).length;case 1:return e.generator().length}},es=async(t,e)=>{const n=await t.toArray();let o=0;for(let t=0;t<n.length;t++)!0===e(n[t])&&o++;return o},ns=async(t,e)=>{const n=Fr(t,e);let o;switch(n.type){case 1:o=Promise.all(n.generator());break;case 2:o=Promise.all(await n.generator())}let r=0;for(const t of await o)t&&r++;return r},os=(t,e)=>{const n=t.dataFunc,o=e instanceof Promise;let r;switch(n.type){case 0:r={generator:()=>n.generator().then((t=>t.length?t:o?e.then((t=>[t])):[e])),type:n.type};break;case 1:r={generator:()=>{const t=n.generator();return t.length?t:o?[e]:[Promise.resolve(e)]},type:n.type};break;case 2:r={generator:async()=>{const t=await n.generator();return t.length?t:o?[e]:[Promise.resolve(e)]},type:n.type}}return new c(r)},rs=(t,e=i)=>new c({generator:async()=>{const n=[];for(const o of await t.toArray())n.find((t=>e(t,o)))||n.push(o);return n},type:0}),ss=(t,e)=>new c({generator:async()=>{const n=[];t:for(const o of await t.toArray()){for(const t of n)if(await e(t,o))continue t;n.push(o)}return n},type:0}),is=(t,e)=>new c(Wr(t,(t=>(e(t),t)))),as=(t,e)=>{const n=Fr(t,(async t=>(await e(t),t)));return new c(n)},cs=async(t,e)=>{if(e<0)throw new o("index");const n=t.dataFunc;switch(n.type){case 0:{const t=await n.generator();if(e>=t.length)throw new o("index");return t[e]}case 1:{const t=n.generator();if(e>=t.length)throw new o("index");return await t[e]}case 2:{const t=await n.generator();if(e>=t.length)throw new o("index");return await t[e]}}},ls=async(t,e)=>{const n=t.dataFunc;switch(n.type){case 0:{const t=await n.generator();return e>=t.length?null:t[e]}case 1:{const t=n.generator();return e>=t.length?null:await t[e]}case 2:{const t=await n.generator();return e>=t.length?null:await t[e]}}},hs=(t,e,n=i)=>new c({generator:async()=>{const[o,r]=await Promise.all([t.toArray(),e.toArray()]),s=[];for(const t of o){let e=!1;for(let o=0;o<r.length;o++){const s=r[o];if(!0===n(t,s)){e=!0;break}}!1===e&&s.push(t)}return s},type:0}),us=(t,e,n)=>new c({generator:async()=>{const[o,r]=await Promise.all([t.toArray(),e.toArray()]),s=[];for(const t of o){let e=!1;for(let o=0;o<r.length;o++){const s=r[o];if(!0===await n(t,s)){e=!0;break}}!1===e&&s.push(t)}return s},type:0}),fs=t=>Vr(t.dataFunc),gs=(t,e)=>e?ys(t,e):ws(t),ws=async t=>{const e=t.dataFunc;switch(e.type){case 0:{const t=await e.generator();if(0===t.length)throw new s(r.NoElements);return t[0]}case 1:{const t=e.generator();if(0===t.length)throw new s(r.NoElements);return await t[0]}case 2:{const t=await e.generator();if(0===t.length)throw new s(r.NoElements);return await t[0]}}},ys=async(t,e)=>{const n=await fs(t);for(const t of n)if(!0===e(t))return t;throw new s(r.NoMatch)},ds=async(t,e)=>{const n=await fs(t);for(const t of n)if(!0===await e(t))return t;throw new s(r.NoMatch)},ps=(t,e)=>e?ms(t,e):_s(t),_s=async t=>{const e=t.dataFunc;switch(e.type){case 0:{const t=await e.generator();return 0===t.length?null:t[0]}case 1:{const t=e.generator();return 0===t.length?null:await t[0]}case 2:{const t=await e.generator();return 0===t.length?null:await t[0]}}},ms=async(t,e)=>{const n=await fs(t);for(const t of n)if(!0===e(t))return t;return null},bs=async(t,e)=>{const n=await fs(t);for(const t of n)if(!0===await e(t))return t;return null},vs=(t,e,n)=>n?Ss(t,e,n):ks(t,e),ks=(t,e)=>new c({generator:async()=>{const n={};for(const o of await t.toArray()){const t=e(o),r=n[t];r?r.push(o):n[t]=new X(t,o)}const o=new Array;for(const t in n)o.push(n[t]);return o},type:0}),Ss=(t,e,n)=>new c({generator:async()=>{const o=new Array;for(const r of await t.toArray()){const t=e(r);let s=!1;for(let e=0;e<o.length;e++){const i=o[e];if(n(i.key,t)){i.push(r),s=!0;break}}!1===s&&o.push(new X(t,r))}const r=new Array;for(const t of o)r.push(t);return r},type:0}),Es=(t,e,n)=>n?Cs(t,e,n):As(t,e),Cs=(t,e,n)=>new c({generator:async()=>{const o=Fr(t,(async t=>[await e(t),t]));let r;switch(o.type){case 1:r=await Promise.all(o.generator());break;case 2:r=await Promise.all(await o.generator())}const s=new Array;for(const[t,e]of r){let o=!1;for(let r=0;r<s.length;r++){const i=s[r];if(!0===await n(i.key,t)){i.push(e),o=!0;break}}!1===o&&s.push(new X(t,e))}const i=new Array;for(const t of s)i.push(t);return i},type:0}),As=(t,e)=>new c({generator:async()=>{const n=Fr(t,(async t=>[await e(t),t]));let o;switch(n.type){case 1:o=await Promise.all(n.generator());break;case 2:o=await Promise.all(await n.generator())}const r={};for(const[t,e]of o){const n=r[t];n?n.push(e):r[t]=new X(t,e)}const s=new Array;for(const t in r)s.push(r[t]);return s},type:0}),Is=(t,e,n,o)=>o?Ts(t,e,n,o):Ps(t,e,n),Ts=(t,e,n,o)=>new c({generator:async()=>{const r=new Array;for await(const s of t){const t=e(s);let i=!1;for(let e=0;e<r.length;e++){const a=r[e];if(o(a.key,t)){a.push(n(s)),i=!0;break}}if(!1===i){const e=n(s);r.push(new X(t,e))}}const s=new Array;for(const t of r)s.push(t);return s},type:0}),Ps=(t,e,n)=>new c({generator:async()=>{const o={};for(const r of await t.toArray()){const t=e(r),s=o[t],i=n(r);s?s.push(i):o[t]=new X(t,i)}const r=new Array;for(const t in o)r.push(o[t]);return r},type:0}),Ns=(t,e,n,o,r,s)=>{const i=s?Ms(t,e,n,o,r,s):xs(t,e,n,o,r);return new c({generator:i,type:0})},Ms=(t,e,n,o,r,s)=>async()=>{const i=[];for await(const t of e){const e=o(t),n=i.find((t=>s(t.key,e)));n?n.values.push(t):i.push({key:e,values:[t]})}return(await t.toArray()).map((t=>{var e;const o=n(t),a=null!==(e=i.find((t=>s(t.key,o))))&&void 0!==e?e:{key:o,values:[]};return r(t,a.values)}))},xs=(t,e,n,o,r)=>async()=>{const s=new Map;for await(const t of e){const e=o(t),n=s.get(e);n?n.push(t):s.set(e,[t])}return(await t.toArray()).map((t=>{var e;const o=n(t),i=null!==(e=s.get(o))&&void 0!==e?e:[];return r(t,i)}))},Ds=(t,e,n,o,r,s)=>{const i=s?$s(t,e,n,o,r,s):Os(t,e,n,o,r);return new c({generator:i,type:0})},$s=(t,e,n,o,r,s)=>async()=>{const i=[];for await(const t of e){const e=await o(t),n=i.find((t=>s(t.key,e)));n?n.values.push(t):i.push({key:e,values:[t]})}const a=(await t.toArray()).map((async t=>{var e;const o=await n(t),a=null!==(e=i.find((t=>s(t.key,o))))&&void 0!==e?e:{key:o,values:[]};return r(t,a.values)}));return await Promise.all(a)},Os=(t,e,n,o,r)=>async()=>{const s=new Map;for await(const t of e){const e=await o(t),n=s.get(e);n?n.push(t):s.set(e,[t])}const i=(await t.toArray()).map((async t=>{var e;const o=await n(t),i=null!==(e=s.get(o))&&void 0!==e?e:[];return r(t,i)}));return await Promise.all(i)},Rs=(t,e,n=i)=>new c({generator:async()=>{const o=await t.distinct(n).toArray();if(0===o.length)return[];const r=await e.toArray(),s=new Array;for(let t=0;t<o.length;t++){const e=o[t];for(let t=0;t<r.length;t++){const o=r[t];if(!0===n(e,o)){s.push(e);break}}}return s},type:0}),Ws=(t,e,n)=>new c({generator:async()=>{const o=await t.distinctAsync(n).toArray();if(0===o.length)return[];const r=await e.toArray(),s=new Array;for(let t=0;t<o.length;t++){const e=o[t];for(let t=0;t<r.length;t++){const o=r[t];if(!0===await n(e,o)){s.push(e);break}}}return s},type:0}),js=(t,e,n,o,r,s=i)=>new c({generator:async()=>{const[i,a]=await Promise.all([e.toArray(),t.toArray()]),c=new Array;for(const t of a){const e=n(t);for(const n of i){const i=o(n);!0===s(e,i)&&c.push(r(t,n))}}return c},type:0}),Fs=(t,e)=>e?Bs(t,e):Hs(t),Hs=async t=>{const e=t.dataFunc;switch(e.type){case 0:{const t=await e.generator();if(0===t.length)throw new s(r.NoElements);return t[t.length-1]}case 1:{const t=e.generator();if(0===t.length)throw new s(r.NoElements);return await t[t.length-1]}case 2:{const t=await e.generator();if(0===t.length)throw new s(r.NoElements);return await t[t.length-1]}}},Bs=async(t,e)=>{const n=t.dataFunc;switch(n.type){case 0:{const t=await n.generator();for(let n=t.length-1;n>=0;n--){const o=t[n];if(e(o))return o}break}case 1:{const t=n.generator();for(let n=t.length-1;n>=0;n--){const o=await t[n];if(e(o))return o}break}case 2:{const t=await n.generator();for(let n=t.length-1;n>=0;n--){const o=await t[n];if(e(o))return o}break}}throw new s(r.NoMatch)},Ls=async(t,e)=>{const n=t.dataFunc;switch(n.type){case 0:{const t=await n.generator();for(let n=t.length-1;n>=0;n--){const o=t[n];if(!0===await e(o))return o}break}case 1:{const t=n.generator();for(let n=t.length-1;n>=0;n--){const o=await t[n];if(!0===await e(o))return o}break}case 2:{const t=await n.generator();for(let n=t.length-1;n>=0;n--){const o=await t[n];if(!0===await e(o))return o}break}}throw new s(r.NoMatch)},qs=(t,e)=>e?zs(t,e):Us(t),Us=async t=>{const e=t.dataFunc;switch(e.type){case 0:{const t=await e.generator();return 0===t.length?null:t[t.length-1]}case 1:{const t=e.generator();return 0===t.length?null:await t[t.length-1]}case 2:{const t=await e.generator();return 0===t.length?null:await t[t.length-1]}}},zs=async(t,e)=>{const n=t.dataFunc;switch(n.type){case 0:{const t=await n.generator();for(let n=t.length-1;n>=0;n--){const o=t[n];if(e(o))return o}break}case 1:{const t=n.generator();for(let n=t.length-1;n>=0;n--){const o=await t[n];if(e(o))return o}break}case 2:{const t=await n.generator();for(let n=t.length-1;n>=0;n--){const o=await t[n];if(e(o))return o}break}}return null},Vs=async(t,e)=>{const n=t.dataFunc;switch(n.type){case 0:{const t=await n.generator();for(let n=t.length-1;n>=0;n--){const o=t[n];if(!0===await e(o))return o}break}case 1:{const t=n.generator();for(let n=t.length-1;n>=0;n--){const o=await t[n];if(!0===await e(o))return o}break}case 2:{const t=await n.generator();for(let n=t.length-1;n>=0;n--){const o=await t[n];if(!0===await e(o))return o}break}}return null},Js=async(t,e)=>{let n;n=e?Wr(t,e):t.dataFunc;const o=await Vr(n);if(0===o.length)throw new s(r.NoElements);return Math.max.apply(null,o)},Ks=async(t,e)=>{const n=Fr(t,e),o=await Vr(n);if(0===o.length)throw new s(r.NoElements);return Math.max.apply(null,o)},Ys=async(t,e)=>{let n;n=e?Wr(t,e):t.dataFunc;const o=await Vr(n);if(0===o.length)throw new s(r.NoElements);return Math.min.apply(null,o)},Gs=async(t,e)=>{const n=Fr(t,e),o=await Vr(n);if(0===o.length)throw new s(r.NoElements);return Math.min.apply(null,o)},Qs=(t,e)=>{const n="string"==typeof e?t=>[typeof t===e,t]:t=>[t instanceof e,t];return new c({generator:async()=>{const e=Wr(t,n),o=await Vr(e),r=[];for(const[t,e]of o)t&&r.push(e);return r},type:0})};async function*Xs(t,e,n,o){const r=await(async(t,e)=>{const n=new Map;for(const o of t){const t=await e(o),r=n.get(t);r?r.push(o):n.set(t,[o])}return n})(t,e),s=[...r.keys()].sort(o||void 0);if(n)for(let t=0;t<s.length;t++)yield r.get(s[t]);else for(let t=s.length-1;t>=0;t--)yield r.get(s[t])}async function*Zs(t,e,n,o){const r=((t,e)=>{const n=new Map;for(const o of t){const t=e(o),r=n.get(t);r?r.push(o):n.set(t,[o])}return n})(t,e),s=[...r.keys()].sort(o||void 0);if(n)for(let t=0;t<s.length;t++)yield r.get(s[t]);else for(let t=s.length-1;t>=0;t--)yield r.get(s[t])}class ti extends c{constructor(t){super({generator:async()=>{const e=t(),n=[];for await(const t of e)n.push(...t);return n},type:0}),this.orderedPairs=t}static generateAsync(t,e,n,o){let r;return r=t instanceof ti?async function*(){for await(const r of t.orderedPairs())yield*Xs(r,e,n,o)}:()=>async function*(t,e,n,o){const r=await(async(t,e)=>{const n=new Map;for await(const o of t){const t=await e(o),r=n.get(t);r?r.push(o):n.set(t,[o])}return n})(t,e),s=[...r.keys()].sort(o||void 0);if(n)for(let t=0;t<s.length;t++)yield r.get(s[t]);else for(let t=s.length-1;t>=0;t--)yield r.get(s[t])}(t,e,n,o),new ti(r)}static generate(t,e,n,o){let r;return r=t instanceof ti?async function*(){for await(const r of t.orderedPairs())yield*Zs(r,e,n,o)}:()=>async function*(t,e,n,o){const r=await(async(t,e)=>{const n=new Map;for await(const o of t){const t=e(o),r=n.get(t);r?r.push(o):n.set(t,[o])}return n})(t,e),s=[...r.keys()].sort(o||void 0);if(n)for(let t=0;t<s.length;t++)yield r.get(s[t]);else for(let t=s.length-1;t>=0;t--)yield r.get(s[t])}(t,e,n,o),new ti(r)}thenBy(t,e){return ti.generate(this,t,!0,e)}thenByAsync(t,e){return ti.generateAsync(this,t,!0,e)}thenByDescending(t,e){return ti.generate(this,t,!1,e)}thenByDescendingAsync(t,e){return ti.generateAsync(this,t,!1,e)}}const ei=(t,e,n)=>ti.generate(t,e,!0,n),ni=(t,e,n)=>ti.generateAsync(t,e,!0,n),oi=(t,e,n)=>ti.generate(t,e,!1,n),ri=(t,e,n)=>ti.generateAsync(t,e,!1,n),si=async(t,e)=>{const n=Wr(t,(t=>[e(t),t])),o=await Vr(n),r=[],s=[];for(const[t,e]of o)t?s.push(e):r.push(e);return[s,r]},ii=async(t,e)=>{const n=Fr(t,(async t=>[await e(t),t])),o=await Vr(n),r=[],s=[];for(const[t,e]of o)t?s.push(e):r.push(e);return[s,r]},ai=t=>{const e=t.dataFunc;switch(e.type){case 1:return new c({generator:()=>e.generator().reverse(),type:e.type});case 2:case 0:return new c({generator:async()=>(await e.generator()).reverse(),type:e.type})}},ci=(t,e)=>{const n=t.dataFunc;switch(n.type){case 0:return{generator:()=>n.generator().then((t=>{const n=new Array(t.length);for(let o=0;o<t.length;o++)n[o]=e(t[o],o);return n})),type:0};case 1:return{generator:()=>{const t=n.generator(),o=new Array(t.length);for(let n=0;n<t.length;n++)o[n]=t[n].then((t=>e(t,n)));return o},type:1};case 2:return{generator:async()=>{const t=await n.generator(),o=new Array(t.length);for(let n=0;n<t.length;n++)o[n]=t[n].then((t=>e(t,n)));return o},type:2}}},li=(t,e)=>"function"==typeof e?1===e.length?new c(Wr(t,e)):new c(ci(t,e)):new c(Wr(t,(t=>t[e]))),hi=(t,e)=>{const n=t.dataFunc;switch(n.type){case 0:return{generator:async()=>{const t=await n.generator(),o=new Array(t.length);for(let n=0;n<t.length;n++)o[n]=e(t[n],n);return o},type:2};case 1:return{generator:()=>n.generator().map(((t,n)=>t.then((t=>e(t,n))))),type:1};case 2:return{generator:async()=>(await n.generator()).map(((t,n)=>t.then((t=>e(t,n))))),type:2}}},ui=(t,e)=>{let n;return n="function"==typeof e?1===e.length?Fr(t,e):hi(t,e):Fr(t,(t=>t[e])),new c(n)},fi=(t,e)=>new c({generator:async()=>{let n;n="function"==typeof e?1===e.length?Wr(t,e):ci(t,e):Wr(t,(t=>t[e]));const o=[];switch(n.type){case 0:for(const t of await n.generator())for(const e of t)o.push(e);break;case 1:for(const t of n.generator())for(const e of await t)o.push(e);break;case 2:for(const t of await n.generator())for(const e of await t)o.push(e)}return o},type:0}),gi=(t,e)=>new c({generator:async()=>{let n;n=1===e.length?Fr(t,e):hi(t,e);const o=[];switch(n.type){case 1:for(const t of n.generator())for(const e of await t)o.push(e);break;case 2:for(const t of await n.generator())for(const e of await t)o.push(e)}return o},type:0}),wi=async(t,e,n=i)=>{const o=await t.toArray(),r=await e.toArray();if(o.length!==r.length)return!1;for(let t=0;t<o.length;t++)if(!1===n(o[t],r[t]))return!1;return!0},yi=async(t,e,n)=>{const o=await t.toArray(),r=await e.toArray();if(o.length!==r.length)return!1;for(let t=0;t<o.length;t++){const e=o[t],s=r[t];if(!1===await n(e,s))return!1}return!0},di=(t,e)=>e?_i(t,e):pi(t),pi=async t=>{const e=t.dataFunc;switch(e.type){case 0:{const t=await e.generator();if(t.length>1)throw new s(r.MoreThanOneElement);if(0===t.length)throw new s(r.NoElements);return t[0]}case 1:{const t=e.generator();if(t.length>1)throw new s(r.MoreThanOneElement);if(0===t.length)throw new s(r.NoElements);return t[0]}case 2:{const t=await e.generator();if(t.length>1)throw new s(r.MoreThanOneElement);if(0===t.length)throw new s(r.NoElements);return await t[0]}}},_i=async(t,e)=>{const n=await fs(t);let o=!1,i=null;for(const t of n)if(e(t)){if(!0===o)throw new s(r.MoreThanOneMatchingElement);o=!0,i=t}if(!1===o)throw new s(r.NoMatch);return i},mi=async(t,e)=>{const n=await fs(t);let o=!1,i=null;for(const t of n)if(!0===await e(t)){if(!0===o)throw new s(r.MoreThanOneMatchingElement);o=!0,i=t}if(!1===o)throw new s(r.NoMatch);return i},bi=(t,e)=>e?ki(t,e):vi(t),vi=async t=>{const e=t.dataFunc;switch(e.type){case 0:{const t=await e.generator();if(t.length>1)throw new s(r.MoreThanOneElement);return 0===t.length?null:t[0]}case 1:{const t=e.generator();if(t.length>1)throw new s(r.MoreThanOneElement);return 0===t.length?null:t[0]}case 2:{const t=await e.generator();if(t.length>1)throw new s(r.MoreThanOneElement);return 0===t.length?null:await t[0]}}},ki=async(t,e)=>{const n=await fs(t);let o=!1,i=null;for(const t of n)if(e(t)){if(!0===o)throw new s(r.MoreThanOneElement);o=!0,i=t}return i},Si=async(t,e)=>{const n=await fs(t);let o=!1,i=null;for(const t of n)if(!0===await e(t)){if(!0===o)throw new s(r.MoreThanOneElement);o=!0,i=t}return i},Ei=(t,e)=>{const n=t.dataFunc;switch(n.type){case 0:return new c({generator:async()=>(await n.generator()).slice(e),type:0});case 1:return new c({generator:()=>n.generator().slice(e),type:1});case 2:return new c({generator:async()=>(await n.generator()).slice(e),type:2})}},Ci=(t,e)=>new c({generator:async()=>{const n=await t.toArray();let o=0;for(;o<n.length;o++){const t=n[o];if(!1===e(t,o))break}const r=[];for(;o<n.length;o++)r.push(n[o]);return r},type:0}),Ai=(t,e)=>new c({generator:async()=>{const n=await t.toArray();let o=0;for(;o<n.length;o++){const t=n[o];if(!1===await e(t,o))break}const r=[];for(;o<n.length;o++)r.push(n[o]);return r},type:0}),Ii=(t,e)=>e?Pi(t,e):Ti(t),Ti=async t=>{let e=0;for(const n of await t.toArray())e+=n;return e},Pi=async(t,e)=>{let n=0;for(const o of await t.toArray())n+=e(o);return n},Ni=async(t,e)=>{const n=Fr(t,e),o=await Vr(n);let r=0;for(const t of o)r+=t;return r},Mi=(t,e)=>{const n=e>0?e:0,o=t.dataFunc;switch(o.type){case 1:return new c({generator:()=>o.generator().splice(0,n),type:1});case 2:return new c({generator:()=>o.generator().then((t=>t.splice(0,n))),type:2});default:return new c({generator:()=>o.generator().then((t=>t.splice(0,n))),type:0})}},xi=(t,e)=>new c({generator:async()=>{const n=await t.toArray(),o=new Array;if(1===e.length)for(const t of n){if(!0!==e(t))break;o.push(t)}else for(let t=0;t<n.length;t++){const r=n[t];if(!0!==e(r,t))break;o.push(r)}return o},type:0}),Di=(t,e)=>new c({generator:async()=>{const n=await t.toArray(),o=new Array;if(1===e.length){const t=e;for(const e of n){if(!0!==await t(e))break;o.push(e)}}else for(let t=0;t<n.length;t++){const r=n[t];if(!0!==await e(r,t))break;o.push(r)}return o},type:0}),$i=async(t,e)=>{const n=new Map,o=Wr(t,(t=>[e(t),t])),r=await Vr(o);for(const[t,e]of r){const o=n.get(t);void 0===o?n.set(t,[e]):o.push(e)}return n},Oi=async(t,e)=>{const n=new Map,o=Fr(t,(async t=>[await e(t),t])),r=await Vr(o);for(const[t,e]of r){const o=n.get(t);void 0===o?n.set(t,[e]):o.push(e)}return n},Ri=async(t,e)=>{const n=t.dataFunc,o=await Vr(n),r={};for(const t of o)r[e(t)]=t;return r},Wi=async(t,e)=>{const n=Fr(t,(async t=>[await e(t),t])),o=await Vr(n),r={};for(const[t,e]of o)r[t]=e;return r},ji=async t=>{const e=t.dataFunc,n=await Vr(e);return new Set(n)},Fi=(t,e,n)=>n?Bi(t,e,n):Hi(t,e),Hi=(t,e)=>new c({generator:async()=>{const n=new Set,o=e.toArray();for await(const e of t)!1===n.has(e)&&n.add(e);const r=await o;for(const t of r)!1===n.has(t)&&n.add(t);return[...n.keys()]},type:0}),Bi=(t,e,n)=>new c({generator:async()=>{const o=[],r=await Promise.all([t.toArray(),e.toArray()]);for(const t of r)for(const e of t){let t=!1;for(const r of o)if(!0===n(e,r)){t=!0;break}!1===t&&o.push(e)}return o},type:0}),Li=(t,e,n)=>new c({generator:async()=>{const o=[],r=await Promise.all([t.toArray(),e.toArray()]);for(const t of r)for(const e of t){let t=!1;for(const r of o)if(!0===await n(e,r)){t=!0;break}!1===t&&o.push(e)}return o},type:0}),qi=(t,e)=>new c({generator:async()=>(await t.toArray()).filter(e),type:0}),Ui=(t,e)=>new c({generator:async()=>{const n=hi(t,(async(t,n)=>[await e(t,n),t])),o=await Vr(n),r=[];for(const[t,e]of o)t&&r.push(e);return r},type:0}),zi=(t,e,n)=>n?Ji(t,e,n):Vi(t,e),Vi=(t,e)=>new c({generator:async()=>{const[n,o]=await Promise.all([t.toArray(),e.toArray()]),r=n.length<o.length?n.length:o.length,s=new Array(r);for(let t=0;t<r;t++){const e=n[t],r=o[t];s[t]=[e,r]}return s},type:0}),Ji=(t,e,n)=>new c({generator:async()=>{const[o,r]=await Promise.all([t.toArray(),e.toArray()]),s=o.length<r.length?o.length:r.length,i=new Array(s);for(let t=0;t<s;t++){const e=o[t],s=r[t];i[t]=n(e,s)}return i},type:0}),Ki=(t,e,n)=>new c({generator:async()=>{const[o,r]=await Promise.all([t.toArray(),e.toArray()]),s=o.length<r.length?o.length:r.length,i=new Array(s);for(let t=0;t<s;t++){const e=o[t],s=r[t];i[t]=n(e,s)}return Promise.all(i)},type:0}),Yi=()=>{var t;const e=String.prototype,n=Object.getOwnPropertyNames(l.prototype);for(const o of n)e[o]=null!==(t=e[o])&&void 0!==t?t:l.prototype[o];e.first=function(t){if(t){for(let e=0;e<this.length;e++){const n=this[e];if(!0===t(n))return n}throw new s(r.NoMatch)}if(0===this.length)throw new s(r.NoElements);return this[0]},e.firstOrDefault=function(t){if(t){for(let e=0;e<this.length;e++){const n=this[e];if(!0===t(n))return n}return null}return 0===this.length?null:this[0]},e.count=function(t){if(t){let e=0;for(let n=0;n<this.length;n++)!0===t(this[n])&&e++;return e}return this.length},e.elementAt=function(t){if(t<0||t>=this.length)throw new o("index");return this[t]},e.elementAtOrDefault=function(t){return this[t]||null},e.last=function(t){if(t){for(let e=this.length-1;e>=0;e--){const n=this[e];if(!0===t(n))return n}throw new s(r.NoMatch)}if(0===this.length)throw new s(r.NoElements);return this[this.length-1]},e.lastOrDefault=function(t){if(t){for(let e=this.length-1;e>=0;e--){const n=this[e];if(!0===t(n))return n}return null}return 0===this.length?null:this[this.length-1]},e.reverse=function(){const t=this;return new l((function*(){for(let e=t.length-1;e>=0;e--)yield t[e]}))}},Gi=t=>{var e;const n=h.prototype,o=t.prototype,r=Object.getOwnPropertyNames(n);for(const t of r)o[t]=null!==(e=o[t])&&void 0!==e?e:n[t]},Qi=()=>{Xe(Map),Xe(Set),Yi(),Gi(Array),Gi(Int8Array),Gi(Int16Array),Gi(Int32Array),Gi(Uint8Array),Gi(Uint8ClampedArray),Gi(Uint16Array),Gi(Uint32Array),Gi(Float32Array),Gi(Float64Array)};Xe(l),(t=>{const e=t.prototype,n=(t,n)=>{const o=function(...e){return t(this,...e)};Object.defineProperty(o,"length",{value:t.length-1}),e[n]=o};n(Ze,"aggregate"),n(on,"all"),n(rn,"allAsync"),n(sn,"any"),n(ln,"anyAsync"),n(hn,"asParallel"),n(un,"average"),n(fn,"averageAsync"),n(gn,"chunk"),n(wn,"concatenate"),n(yn,"contains"),n(dn,"containsAsync"),n(pn,"count"),n(bn,"countAsync"),n(vn,"defaultIfEmpty"),n(kn,"distinct"),n(Sn,"distinctAsync"),n(En,"each"),n(Cn,"eachAsync"),n(An,"elementAt"),n(In,"elementAtOrDefault"),n(Tn,"except"),n(Pn,"exceptAsync"),n(Nn,"first"),n(Dn,"firstAsync"),n($n,"firstOrDefault"),n(Wn,"firstOrDefaultAsync"),n(jn,"groupBy"),n(Bn,"groupByAsync"),n(Un,"groupByWithSel"),n(Jn,"groupJoin"),n(Gn,"groupJoinAsync"),n(Zn,"intersect"),n(to,"intersectAsync"),n(eo,"joinByKey"),n(no,"last"),n(so,"lastAsync"),n(io,"lastOrDefault"),n(lo,"lastOrDefaultAsync"),n(ho,"max"),n(go,"maxAsync"),n(wo,"min"),n(_o,"minAsync"),n(mo,"ofType"),n(bo,"orderBy"),n(vo,"orderByAsync"),n(ko,"orderByDescending"),n(So,"orderByDescendingAsync"),n(Eo,"partition"),n(Co,"partitionAsync"),n(Ao,"reverse"),n(Io,"select"),n(Mo,"selectAsync"),n($o,"selectMany"),n(jo,"selectManyAsync"),n(Fo,"sequenceEquals"),n(Ho,"sequenceEqualsAsync"),n(Bo,"single"),n(Uo,"singleAsync"),n(zo,"singleOrDefault"),n(Ko,"singleOrDefaultAsync"),n(Yo,"skip"),n(Go,"skipWhile"),n(Zo,"skipWhileAsync"),n(nr,"sum"),n(sr,"sumAsync"),n(ir,"take"),n(ar,"takeWhile"),n(hr,"takeWhileAsync"),n(gr,"toArray"),n(wr,"toMap"),n(yr,"toMapAsync"),n(dr,"toObject"),n(pr,"toObjectAsync"),n(_r,"toSet"),n(mr,"union"),n(kr,"unionAsync"),n(Sr,"where"),n(Ar,"whereAsync"),n(Pr,"zip"),n(xr,"zipAsync")})(a),(t=>{const e=t.prototype,n=(t,n)=>{const o=function(...e){return t(this,...e)};Object.defineProperty(o,"length",{value:t.length-1}),e[n]=o};n(Dr,"aggregate"),n(jr,"all"),n(Hr,"allAsync"),n(Br,"any"),n(Ur,"anyAsync"),n(zr,"asAsync"),n(Jr,"average"),n(Kr,"averageAsync"),n(Yr,"chunk"),n(Gr,"concatenate"),n(Qr,"contains"),n(Xr,"containsAsync"),n(Zr,"count"),n(ns,"countAsync"),n(os,"defaultIfEmpty"),n(rs,"distinct"),n(ss,"distinctAsync"),n(is,"each"),n(as,"eachAsync"),n(cs,"elementAt"),n(ls,"elementAtOrDefault"),n(hs,"except"),n(us,"exceptAsync"),n(gs,"first"),n(ds,"firstAsync"),n(ps,"firstOrDefault"),n(bs,"firstOrDefaultAsync"),n(vs,"groupBy"),n(Es,"groupByAsync"),n(Is,"groupByWithSel"),n(Ns,"groupJoin"),n(Ds,"groupJoinAsync"),n(Ns,"groupJoin"),n(Ds,"groupJoinAsync"),n(Rs,"intersect"),n(Ws,"intersectAsync"),n(js,"joinByKey"),n(Fs,"last"),n(Ls,"lastAsync"),n(qs,"lastOrDefault"),n(Vs,"lastOrDefaultAsync"),n(Js,"max"),n(Ks,"maxAsync"),n(Ys,"min"),n(Gs,"minAsync"),n(Qs,"ofType"),n(ei,"orderBy"),n(ni,"orderByAsync"),n(oi,"orderByDescending"),n(ri,"orderByDescendingAsync"),n(si,"partition"),n(ii,"partitionAsync"),n(ai,"reverse"),n(li,"select"),n(ui,"selectAsync"),n(fi,"selectMany"),n(gi,"selectManyAsync"),n(wi,"sequenceEquals"),n(yi,"sequenceEqualsAsync"),n(di,"single"),n(mi,"singleAsync"),n(bi,"singleOrDefault"),n(Si,"singleOrDefaultAsync"),n(Ei,"skip"),n(Ci,"skipWhile"),n(Ai,"skipWhileAsync"),n(Ii,"sum"),n(Ni,"sumAsync"),n(Mi,"take"),n(xi,"takeWhile"),n(Di,"takeWhileAsync"),n(fs,"toArray"),n($i,"toMap"),n(Oi,"toMapAsync"),n(Ri,"toObject"),n(Wi,"toObjectAsync"),n(ji,"toSet"),n(Fi,"union"),n(Li,"unionAsync"),n(qi,"where"),n(Ui,"whereAsync"),n(zi,"zip"),n(Ki,"zipAsync")})(c),(()=>{var t;const{prototype:e}=h,n=Object.getOwnPropertyNames(l.prototype);for(const o of n)e[o]=null!==(t=e[o])&&void 0!==t?t:l.prototype[o];e.all=function(t){return this.every(t)},e.any=function(t){return t?this.some(t):0!==this.length},e.count=function(t){if(t){let e=0;for(let n=0;n<this.length;n++)!0===t(this[n])&&e++;return e}return this.length},e.elementAt=function(t){if(t<0||t>=this.length)throw new o("index");return this[t]},e.elementAtOrDefault=function(t){return this[t]||null},e.first=function(t){if(t){const e=this.find(t);if(void 0===e)throw new s(r.NoMatch);return e}if(0===this.length)throw new s(r.NoElements);return this[0]},e.firstOrDefault=function(t){if(t){const e=this.find(t);return void 0===e?null:e}return 0===this.length?null:this[0]},e.last=function(t){if(t){for(let e=this.length-1;e>=0;e--){const n=this[e];if(!0===t(n))return n}throw new s(r.NoMatch)}if(0===this.length)throw new s(r.NoElements);return this[this.length-1]},e.lastOrDefault=function(t){if(t){for(let e=this.length-1;e>=0;e--){const n=this[e];if(!0===t(n))return n}return null}return 0===this.length?null:this[this.length-1]},e.max=function(t){if(0===this.length)throw new s(r.NoElements);if(t){let e=Number.NEGATIVE_INFINITY;for(let n=0;n<this.length;n++)e=Math.max(t(this[n]),e);return e}return Math.max.apply(null,this)},e.min=function(t){if(0===this.length)throw new s(r.NoElements);if(t){let e=Number.POSITIVE_INFINITY;for(let n=0;n<this.length;n++)e=Math.min(t(this[n]),e);return e}return Math.min.apply(null,this)},e.reverse=function(){return Array.prototype.reverse.apply(this),this}})()}}]);
//# sourceMappingURL=510-exalushome-extalife.bundle.js.map