lavva.exalushome.extalife
Version:
Library implementing communication and abstraction layers for ExtaLife API in ExalusHome system
2 lines • 123 kB
JavaScript
"use strict";(self.webpackChunklavva_exalushome_extalife=self.webpackChunklavva_exalushome_extalife||[]).push([[787],{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}}},5531:(t,e,n)=>{n.d(e,{R:()=>g,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)}}class u{constructor(t,e,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=t,this._connection=e,this._bufferSize=n}async _send(t){const e=this._protocol.writeMessage(t);let n=Promise.resolve();if(this._isInvocationMessage(t)){this._totalMessageCount++;let t=()=>{},o=()=>{};(0,r.eP)(e)?this._bufferedByteCount+=e.byteLength:this._bufferedByteCount+=e.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise(((e,n)=>{t=e,o=n}))),this._messages.push(new f(e,this._totalMessageCount,t,o))}try{this._reconnectInProgress||await this._connection.send(e)}catch{this._disconnected()}await n}_ack(t){let e=-1;for(let n=0;n<this._messages.length;n++){const o=this._messages[n];if(o._id<=t.sequenceId)e=n,(0,r.eP)(o._message)?this._bufferedByteCount-=o._message.byteLength:this._bufferedByteCount-=o._message.length,o._resolver();else{if(!(this._bufferedByteCount<this._bufferSize))break;o._resolver()}}-1!==e&&(this._messages=this._messages.slice(e+1))}_shouldProcessMessage(t){if(this._waitForSequenceMessage)return t.type===c.C.Sequence&&(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(t))return!0;const e=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,e<=this._latestReceivedSequenceId?(e===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=e,this._ackTimer(),!0)}_resetSequence(t){t.sequenceId>this._nextReceivingSequenceId?this._connection.stop(new Error("Sequence ID greater than amount of messages we've received.")):this._nextReceivingSequenceId=t.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const t=0!==this._messages.length?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:c.C.Sequence,sequenceId:t}));const e=this._messages;for(const t of e)await this._connection.send(t._message);this._reconnectInProgress=!1}_dispose(t){null!=t||(t=new Error("Unable to reconnect to server."));for(const e of this._messages)e._rejector(t)}_isInvocationMessage(t){switch(t.type){case c.C.Invocation:case c.C.StreamItem:case c.C.Completion:case c.C.StreamInvocation:case c.C.CancelInvocation:return!0;case c.C.Close:case c.C.Sequence:case c.C.Ping:case c.C.Ack:return!1}}_ackTimer(){void 0===this._ackTimerHandle&&(this._ackTimerHandle=setTimeout((async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:c.C.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0}),1e3))}}class f{constructor(t,e,n,o){this._message=t,this._id=e,this._resolver=n,this._rejector=o}}!function(t){t.Disconnected="Disconnected",t.Connecting="Connecting",t.Connected="Connected",t.Disconnecting="Disconnecting",t.Reconnecting="Reconnecting"}(i||(i={}));class g{static create(t,e,n,o,r,s,i){return new g(t,e,n,o,r,s,i)}constructor(t,e,n,o,a,h,u){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://learn.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=null!=a?a:3e4,this.keepAliveIntervalInMilliseconds=null!=h?h:15e3,this._statefulReconnectBufferSize=null!=u?u:1e5,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})}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{let e=this._protocol.version;this.connection.features.reconnect||(e=1);const n={protocol:this._protocol.name,version:e};if(this._logger.log(l.i.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),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.reconnect&&(this._messageBuffer=new u(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),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.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await t}catch(t){}}_stopInternal(t){if(this._connectionState===i.Disconnected)return this._logger.log(l.i.Debug,`Call to HubConnection.stop(${t}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===i.Disconnecting)return this._logger.log(l.i.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const e=this._connectionState;return 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()):(e===i.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=t||new a._L("The connection was stopped before the hub handshake could complete."),this.connection.stop(t))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}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._messageBuffer?this._messageBuffer._send(t):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)if(!this._messageBuffer||this._messageBuffer._shouldProcessMessage(t))switch(t.type){case c.C.Invocation:this._invokeClientMethod(t).catch((t=>{this._logger.log(l.i.Error,`Invoke client method threw error: ${(0,r.HH)(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}case c.C.Ack:this._messageBuffer&&this._messageBuffer._ack(t);break;case c.C.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(t);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,this._messageBuffer&&(this._messageBuffer._dispose(null!=t?t:new Error("Connection closed.")),this._messageBuffer=void 0),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}}_createCloseMessage(){return{type:c.C.Close}}}},2876:(t,e,n)=>{n.d(e,{s:()=>N});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||g.t4.isNode){const t=require;this._jar=new(t("tough-cookie").CookieJar),"undefined"==typeof fetch?this._fetchType=t("node-fetch"):this._fetchType=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{get pollAborted(){return this._pollAbort.aborted}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}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};let r;try{await this._httpClient.delete(this._url,o)}catch(t){r=t}r?r instanceof u.oo&&(404===r.statusCode?this._logger.log(f.i.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(f.i.Trace,`(LongPolling transport) Error sending a DELETE request: ${r}`)):this._logger.log(f.i.Trace,"(LongPolling transport) DELETE request accepted.")}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 S{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 k(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.useStatefulReconnect&&!0!==this._options._useStatefulReconnect?Promise.reject(new u.EG("Client didn't negotiate Stateful Reconnect but the server did.")):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,!0===(null==a?void 0:a.useStatefulReconnect));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.features.reconnect?this.transport.onclose=async n=>{let o=!1;if(this.features.reconnect){try{this.features.disconnected(),await this.transport.connect(t,e),await this.features.resend()}catch{o=!0}o&&this._stopConnection(n)}else this._stopConnection(n)}:this.transport.onclose=t=>this._stopConnection(t),this.transport.connect(t,e)}_resolveTransportOrError(t,e,n,o){const r=l[t.transport];if(null==r)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,r))return this._logger.log(f.i.Debug,`Skipping transport '${l[r]}' because it was disabled by the client.`),new u.mm(`'${l[r]}' is disabled by the client.`,r);if(!(t.transferFormats.map((t=>h[t])).indexOf(n)>=0))return this._logger.log(f.i.Debug,`Skipping transport '${l[r]}' because it does not support the requested transfer format '${h[n]}'.`),new Error(`'${l[r]}' does not support ${h[n]}.`);if(r===l.WebSockets&&!this._options.WebSocket||r===l.ServerSentEvents&&!this._options.EventSource)return this._logger.log(f.i.Debug,`Skipping transport '${l[r]}' because it is not supported in your environment.'`),new u.jQ(`'${l[r]}' is not supported in your environment.`,r);this._logger.log(f.i.Debug,`Selecting transport '${l[r]}'.`);try{return this.features.reconnect=r===l.WebSockets?o:void 0,this._constructTransport(r)}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=new URL(t);e.pathname.endsWith("/")?e.pathname+="negotiate":e.pathname+="/negotiate";const n=new URLSearchParams(e.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?"true"===n.get("useStatefulReconnect")&&(this._options._useStatefulReconnect=!0):!0===this._options._useStatefulReconnect&&n.append("useStatefulReconnect","true"),e.search=n.toString(),e.toString()}}class k{constructor(t){this._transport=t,this._buffer=[],this._executing=!0,this._sendBufferedData=new C,this._transportResult=new C,this._sendLoopPromise=this._sendLoop()}send(t){return this._bufferData(t),this._transportResult||(this._transportResult=new C),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 C;const t=this._transportResult;this._transportResult=void 0;const e="string"==typeof this._buffer[0]?this._buffer.join(""):k._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 C{constructor(){this.promise=new Promise(((t,e)=>[this._resolver,this._rejecter]=[t,e]))}resolve(){this._resolver()}reject(t){this._rejecter(t)}}var E=n(5531),A=n(4738),I=n(1499),T=n(2921);class P{constructor(){this.name="json",this.version=2,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;case A.C.Ack:this._isAckMessage(n);break;case A.C.Sequence:this._isSequenceMessage(n);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.")}_isAckMessage(t){if("number"!=typeof t.sequenceId)throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(t){if("number"!=typeof t.sequenceId)throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(t,e){if("string"!=typeof t||""===t)throw new Error(e)}}const M={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 N{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=M[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}withServerTimeout(t){return g.j7.isRequired(t,"milliseconds"),this._serverTimeoutInMilliseconds=t,this}withKeepAliveInterval(t){return g.j7.isRequired(t,"milliseconds"),this._keepAliveIntervalInMilliseconds=t,this}withStatefulReconnect(t){return void 0===this.httpConnectionOptions&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=null==t?void 0:t.bufferSize,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 S(this.url,t);return E.R.create(e,this.logger||I.W.instance,this.protocol||new P,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}},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",t[t.Ack=8]="Ack",t[t.Sequence=9]="Sequence"}(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="8.0.7";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!a.isNode&&"object"==typeof window&&"object"==typeof window.document}static get isWebWorker(){return!a.isNode&&"object"==typeof self&&"importScripts"in self}static get isReactNative(){return!a.isNode&&"object"==typeof window&&void 0===window.document}static get isNode(){return"undefined"!=typeof process&&process.release&&"node"===process.release.name}}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")}},4722:(t,e,n)=>{n.d(e,{LN:()=>la});class o extends RangeError{paramName;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{iterator;constructor(t){this.iterator=t}[Symbol.asyncIterator](){return this.iterator()}}class c{dataFunc;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{iterator;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,e)=>new l((function*(){yield*t,yield e})),S=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=>S((async function*(){for(const e of t)yield e})),C=(t,e)=>new c({generator:e,type:t}),E=t=>C(0,(async()=>{const e=[];for(const n of t)e.push(n);return e})),A=(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},I=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},T=(t,e)=>{if(e<1)throw new o("size");return new l((function*(){let n=[];for(const o of t)n.push(o),n.length===e&&(yield n,n=[]);n.length&&(yield n)}))},P=(t,e)=>new l((function*(){yield*t,yield*e})),M=(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},x=(t,e)=>e?R(t,e):D(t),D=t=>{let e=0;for(const n of t)e++;return e},R=(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)})),q=(t,e=i)=>new l((function*(){const n=[];for(const o of t)n.find((t=>e(t,o)))||(n.push(o),yield o)})),j=(t,e)=>S((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}})),F=(t,e)=>new l((function*(){for(const n of t)e(n),yield n})),W=(t,e)=>S((async function*(){for(const n of t)await e(n),yield n})),B=(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")},H=(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)}})),U=(t,e,n)=>S((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)}})),z=(t,e)=>e?J(t,e):V(t),V=t=>{const e=t[Symbol.iterator]().next();if(!0===e.done)throw new s(r.NoElements);return e.value},J=(t,e)=>{for(const n of t)if(!0===e(n))return n;throw new s(r.NoMatch)},K=async(t,e)=>{for(const n of t)if(!0===await e(n))return n;throw new s(r.NoMatch)},G=(t,e)=>e?Q(t,e):Y(t),Y=t=>t[Symbol.iterator]().next().value??null,Q=(t,e)=>{for(const n of t)if(!0===e(n))return n;return null},X=async(t,e)=>{for(const n of t)if(!0===await e(n))return n;return null};class Z extends h{key;constructor(t,e){super(1),this.key=t,this[0]=e}}const tt=(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 Z(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 Z(t,o)}for(const t in n)yield n[t]})(t,e),new l(o)},et=(t,e,n)=>n?ot(t,e,n):nt(t,e),nt=(t,e)=>S((async function*(){const n={};for(const o of t){const t=await e(o),r=n[t];r?r.push(o):n[t]=new Z(t,o)}for(const t in n)yield n[t]})),ot=(t,e,n)=>S((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 Z(t,r))}for(const t of o)yield t})),rt=(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 Z(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 Z(t,i)}for(const t in o)yield o[t]})))(t,e,n),st=(t,e,n,o,r,s)=>{const i=s?it(t,e,n,o,r,s):at(t,e,n,o,r);return new l(i)},it=(t,e,n,o,r,s)=>function*(){const i=[];for(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]})}for(const e of t){const t=n(e),o=i.find((e=>s(e.key,t)))??{key:t,values:[]};yield r(e,o.values)}},at=(t,e,n,o,r)=>function*(){const s=new Map;for(const t of e){const e=o(t),n=s.get(e);n?n.push(t):s.set(e,[t])}for(const e of t){const t=n(e),o=s.get(t)??[];yield r(e,o)}},ct=(t,e,n,o,r,s)=>{const i=s?lt(t,e,n,o,r,s):ht(t,e,n,o,r);return S(i)},lt=(t,e,n,o,r,s)=>async function*(){const i=[];for(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]})}for(const e of t){const t=await n(e),o=i.find((e=>s(e.key,t)))??{key:t,values:[]};yield r(e,o.values)}},ht=(t,e,n,o,r)=>async function*(){const s=new Map;for(const t of e){const e=await o(t),n=s.get(e);n?n.push(t):s.set(e,[t])}for(const e of t){const t=await n(e),o=s.get(t)??[];yield r(e,o)}},ut=(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}}})),ft=(t,e,n)=>S((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}}}})),gt=(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))}}})),wt=(t,e)=>e?dt(t,e):yt(t),yt=t=>{let e;for(const n of t)e=n;if(!e)throw new s(r.NoElements);return e},dt=(t,e)=>{let n;for(const o of t)!0===e(o)&&(n=o);if(!n)throw new s(r.NoMatch);return n},pt=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},_t=(t,e)=>e?bt(t,e):mt(t),mt=t=>{let e=null;for(const n of t)e=n;return e},bt=(t,e)=>{let n=null;for(const o of t)!0===e(o)&&(n=o);return n},vt=async(t,e)=>{let n=null;for(const o of t)!0===await e(o)&&(n=o);return n},St=(t,e)=>e?Ct(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},Ct=(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},At=(t,e)=>e?Tt(t,e):It(t),It=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},Tt=(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},Pt=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},Mt=(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*xt(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 Dt extends a{orderedPairs;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 Dt?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 Dt(r)}static generate(t,e,n,o){let r;return r=t instanceof Dt?async function*(){for await(const r of t.orderedPairs())yield*xt(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 Dt(r)}thenBy(t,e){return Dt.generate(this,t,!0,e)}thenByAsync(t,e){return Dt.generateAsync(this,t,!0,e)}thenByDescending(t,e){return Dt.generate(this,t,!1,e)}thenByDescendingAsync(t,e){return Dt.generateAsync(this,t,!1,e)}}function*Rt(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{orderedPairs;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*Rt(r,e,n,o)}:()=>Rt(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 Dt(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 qt=(t,e)=>Ot.generate(t,(t=>t),!0,e),jt=(t,e,n)=>Ot.generate(t,e,!0,n),Ft=(t,e,n)=>Ot.generateAsync(t,e,!0,n),Wt=(t,e,n)=>Ot.generate(t,e,!1,n),Bt=(t,e,n)=>Ot.generateAsync(t,e,!1,n),Ht=(t,e)=>Ot.generate(t,(t=>t),!1,e),Lt=(t,e)=>{const n=[],o=[];for(const r of t)!0===e(r)?o.push(r):n.push(r);return[o,n]},Ut=async(t,e)=>{const n=[],o=[];for(const r of t)!0===await e(r)?o.push(r):n.push(r);return[o,n]},zt=(t,e)=>new l((function*(){yield e,yield*t})),Vt=t=>new l((function*(){const e=[...t];for(let t=e.length-1;t>=0;t--)yield e[t]})),Jt=(t,e)=>{if("function"==typeof e){const{length:n}=e;return 1===n?Kt(t,e):Gt(t,e)}return Yt(t,e)},Kt=(t,e)=>new l((function*(){for(const n of t)yield e(n)})),Gt=(t,e)=>new l((function*(){let n=0;for(const o of t)yield e(o,n),n++})),Yt=(t,e)=>new l((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)=>S((async function*(){for(const n of t)yield e(n)})),Zt=(t,e)=>S((async function*(){let n=0;for(const o of t)yield e(o,n),n++})),te=(t,e)=>S((async function*(){for(const n of t)yield n[e]})),ee=(t,e)=>"function"==typeof e?1===e.length?ne(t,e):oe(t,e):re(t,e),ne=(t,e)=>new l((function*(){for(const n of t)for(const t of e(n))yield t})),oe=(t,e)=>new l((function*(){let n=0;for(const o of t){for(const t of e(o,n))yield t;n++}})),re=(t,e)=>new l((function*(){for(const n of t)for(const t of n[e])yield t})),se=(t,e)=>1===e.length?ie(t,e):ae(t,e),ie=(t,e)=>S((async function*(){for(const n of t){const t=await e(n);for(const e of t)yield e}})),ae=(t,e)=>S((async function*(){let n=0;for(const o of t){const t=await e(o,n);for(const e of t)yield e;n++}})),ce=(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},le=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},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}if(!1===e)throw new s(r.NoElements);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}if(!1===n)throw new s(r.NoMatch);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.MoreThanOneMatchingElement);n=!0,o=i}if(!1===n)throw new s(r.NoMatch);return o},we=(t,e)=>e?de(t,e):ye(t),ye=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},de=(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},pe=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},_e=(t,e)=>new l((function*(){let n=0;for(const o of t)n++>=e&&(yield o)})),me=(t,e)=>1===e.length?be(t,e):ve(t,e),be=(t,e)=>new l((function*(){let n=!0;for(const o of t)!1===n?yield o:!1===e(o)&&(n=!1,yield o)})),ve=(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++})),Se=(t,e)=>1===e.length?ke(t,e):Ce(t,e),ke=(t,e)=>S((async function*(){let n=!0;for(const o of t)!1===n?yield o:!1===await e(o)&&(n=!1,yield o)})),Ce=(t,e)=>S((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++})),Ee=(t,e)=>e?Ie(t,e):Ae(t),Ae=t=>{let e=0;for(const n of t)e+=n;return e},Ie=(t,e)=>{let n=0;for(const o of t)n+=e(o);return n},Te=async(t,e)=>{let n=0;for(const o of t)n+=await e(o);return n},Pe=(t,e)=>new l((function*(){let n=e>0?e:0;for(const e of t){if(0==n--)break;yield e}})),Me=(t,e)=>1===e.length?Ne(t,e):xe(t,e),Ne=(t,e)=>new l((function*(){for(const n of t){if(!e(n))break;yield n}})),xe=(t,e)=>new l((function*(){let n=0;for(const o of t){if(!e(o,n++))break;yield o}})),De=(t,e)=>1===e.length?Re(t,e):$e(t,e),Re=(t,e)=>S((async function*(){for(const n of t){if(!await e(n))break;yield n}})),$e=(t,e)=>S((async function*(){let n=0;for(const o of t){if(!await e(o,n++))break;yield o}})),Oe=t=>[...t],qe=(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},je=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},Fe=(t,e)=>{const n={};for(const o of t)n[e(o)]=o;return n},We=async(t,e)=>{const n={};for(const o of t)n[await e(o)]=o;return n},Be=t=>new Set(t),He=(t,e,n)=>n?Ue(t,e,n):Le(t,e),Le=(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))})),Ue=(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))}})),ze=(t,e,n)=>S((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))}})),Ve=(t,e)=>1===e.length?Je(t,e):Ke(t,e),Je=(t,e)=>new l((function*(){for(const n of t)!0===e(n)&&(yield n)})),Ke=(t,e)=>new l((function*(){let n=0;for(const o of t)!0===e(o,n++)&&(yield o)})),Ge=(t,e)=>1===e.length?Ye(t,e):Qe(t,e),Ye=(t,e)=>S((async function*(){for(const n of t)!0===await e(n)&&(yield n)})),Qe=(t,e)=>S((async function*(){let n=0;for(const o of t)!0===await e(o,n++)&&(yield o)})),Xe=(t,e,n)=>n?tn(t,e,n):Ze(t,e),Ze=(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]}})),tn=(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)}})),en=(t,e,n)=>S((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)}})),nn=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(v,"append"),n(k,"asAsync"),n(E,"asParallel"),n(A,"average"),n(I,"averageAsync"),n(T,"chunk"),n(P,"concatenate"),n(M,"contains"),n(N,"containsAsync"),n(x,"count"),n($,"countAsync"),n(O,"defaultIfEmpty"),n(q,"distinct"),n(j,"distinctAsync"),n(F,"each"),n(W,"eachAsync"),n(B,"elementAt"),n(H,"elementAtOrDefault"),n(L,"except"),n(U,"exceptAsync"),n(z,"first"),n(K,"firstAsync"),n(G,"firstOrDefault"),n(X,"firstOrDefaultAsync"),n(tt,"groupBy"),n(et,"groupByAsync"),n(rt,"groupByWithSel"),n(st,"groupJoin"),n(ct,"groupJoinAsync"),n(ut,"intersect"),n(ft,"intersectAsync"),n(gt,"joinByKey"),n(wt,"last"),n(pt,"lastAsync"),n(_t,"lastOrDefault"),n(vt,"lastOrDefaultAsync"),n(St,"max"),n(Et,"maxAsync"),n(At,"min"),n(Pt,"minAsync"),n(Mt,"ofType"),n(qt,"order"),n(jt,"orderBy"),n(Ft,"orderByAsync"),n(Wt,"orderByDescending"),n(Bt,"orderByDescendingAsync"),n(Ht,"orderDescending"),n(zt,"prepend"),n(Vt,"reverse"),n(Jt,"select"),n(Qt,"selectAsync"),n(ee,"selectMany"),n(se,"selectManyAsync"),n(ce,"sequenceEquals"),n(le,"sequenceEqualsAsync"),n(he,"single"),n(ge,"singleAsync"),n(we,"singleOrDefault"),n(pe,"singleOrDefaultAsync"),n(_e,"skip"),n(me,"skipWhile"),n(Se,"skipWhileAsync"),n(Ee,"sum"),n(Te,"sumAsync"),n(Pe,"take"),n(Me,"takeWhile"),n(De,"takeWhileAsync"),n(Oe,"toArray"),n(qe,"toMap"),n(je,"toMapAsync"),n(Fe,"toObject"),n(We,"toObjectAsync"),n(Lt,"partition"),n(Ut,"partitionAsync"),n(Be,"toSet"),n(He,"union"),n(ze,"unionAsync"),n(Ve,"where"),n(Ge,"whereAsync"),n(Xe,"zip"),n(en,"zipAsync")},on=(t,e,n,o)=>{if(o){if(!n)throw new ReferenceError("TAccumulate function is undefined");return an(t,e,n,o)}return n?sn(t,e,n):rn(t,e)},rn=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},sn=async(t,e,n)=>{let o=e;for await(const e of t)o=n(o,e);return o},an=async(t,e,n,o)=>{let r=e;for await(const e of t)r=n(r,e);return o(r)},cn=async(t,e)=>{for await(const n of t)if(!1===e(n))return!1;return!0},ln=async(t,e)=>{for await(const n of t)if(!1===await e(n))return!1;return!0},hn=(t,e)=>new a((async function*(){yield*t,yield e})),un=(t,e)=>e?gn(t,e):fn(t),fn=async t=>{for await(const e of t)return!0;return!1},gn=async(t,e)=>{for await(const n of t)if(!0===e(n))return!0;return!1},wn=async(t,e)=>{for await(const n of t)if(!0===await e(n))return!0;return!1},yn=t=>C(0,(async()=>{const e=[];for await(const n of t)e.push(n);return e})),dn=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},pn=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},_n=(t,e)=>{if(e<1)throw new o("size");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)}))},mn=(t,e)=>new a((async function*(){yield*t,yield*e})),bn=async(t,e,n=i)=>{for await(const o of t)if(n(e,o))return!0;return!1},vn=async(t,e,n)=>{for await(const o of t)if(await n(e,o))return!0;return!1},Sn=(t,e)=>e?Cn(t,e):kn(t),kn=async t=>{let e=0;for await(const n of t)e++;return e},Cn=async(t,e)=>{let n=0;for await(const o of t)!0===e(o)&&n++;return n},En=async(t,e)=>{let n=0;for await(const o of t)!0===await e(o)&&n++;return n},An=(t,e)=>new a((async function*(){let n=!1;for await(const e of t)n=!0,yield e;n||(yield e)})),In=(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)})),Tn=(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}})),Pn=(t,e)=>new a((async function*(){for await(const n of t)e(n),yield n})),Mn=(t,e)=>new a((async function*(){for await(const n of t)await e(n),yield n})),Nn=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")},xn=async(t,e)=>{let n=0;for await(const o of t)if(e===n++)return o;return null},Dn=(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)}})),Rn=(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)}})),$n=(t,e)=>e?qn(t,e):On(t),On=async t=>{const e=await t[Symbol.asyncIterator]().next();if(!0===e.done)throw new s(r.NoElements);return e.value},qn=async(t,e)=>{for await(const n of t)if(!0===e(n))return n;throw new s(r.NoMatch)},jn=async(t,e)=>{for await(const n of t)if(!0===await e(n))return n;throw new s(r.NoMatch)},Fn=(t,e)=>e?Bn(t,e):Wn(t),Wn=async t=>(await t[Symbol.asyncIterator]().next()).value??null,Bn=async(t,e)=>{for await(const n of t)if(!0===e(n))return n;return null},Hn=async(t,e)=>{for await(const n of t)if(!0===await e(n))return n;return null},Ln=(t,e,n)=>n?Un(t,e,n):zn(t,e),Un=(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 Z(t,r))}for(const t of o)yield t})),zn=(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 Z(t,o)}for(const t in n)yield n[t]})),Vn=(t,e,n)=>n?Kn(t,e,n):Jn(t,e),Jn=(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 Z(t,o)}for(const t in n)yield n[t]})),Kn=(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 Z(t,r))}for(const t of o)yield t})),Gn=(t,e,n,o)=>o?Qn(t,e,n,o):Yn(t,e,n),Yn=(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 Z(t,i)}for(const t in o)yield o[t]})),Qn=(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 Z(t,e))}}for(const t of r)yield t})),Xn=(t,e,n,o,r,s)=>{const i=s?Zn(t,e,n,o,r,s):to(t,e,n,o,r);return new a(i)},Zn=(t,e,n,o,r,s)=>async function*(){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]})}for await(const e of t){const t=n(e),o=i.find((e=>s(e.key,t)))??{key:t,values:[]};yield r(e,o.values)}},to=(t,e,n,o,r)=>async function*(){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])}for await(const e of t){const t=n(e),o=s.get(t)??[];yield r(e,o)}},eo=(t,e,n,o,r,s)=>{const i=s?no(t,e,n,o,r,s):oo(t,e,n,o,r);return new a(i)},no=(t,e,n,o,r,s)=>async function*(){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]})}for await(const e of t){const t=await n(e),o=i.find((e=>s(e.key,t)))??{key:t,values:[]};yield r(e,o.values)}},oo=(t,e,n,o,r)=>async function*(){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])}for await(const e of t){const t=await n(e),o=s.get(t)??[];yield r(e,o)}},ro=(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}}}})),so=(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}}}})),io=(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))}}})),ao=(t,e)=>e?lo(t,e):co(t),co=async t=>{let e=null;for await(const n of t)e=n;if(!e)throw new s(r.NoElements);return e},lo=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},ho=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},uo=(t,e)=>e?go(t,e):fo(t),fo=async t=>{let e=null;for await(const n of t)e=n;return e},go=async(t,e)=>{let n=null;for await(const o of t)!0===e(o)&&(n=o);return n},wo=async(t,e)=>{let n=null;for await(const o of t)!0===await e(o)&&(n=o);return n},yo=(t,e)=>e?_o(t,e):po(t),po=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},_o=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},mo=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},bo=(t,e)=>e?So(t,e):vo(t),vo=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},So=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},ko=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},Co=(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)}))},Eo=(t,e)=>Dt.generate(t,(t=>t),!0,e),Ao=(t,e,n)=>Dt.generate(t,e,!0,n),Io=(t,e,n)=>Dt.generateAsync(t,e,!0,n),To=(t,e,n)=>Dt.generate(t,e,!1,n),Po=(t,e,n)=>Dt.generateAsync(t,e,!1,n),Mo=(t,e)=>Dt.generate(t,(t=>t),!1,e),No=async(t,e)=>{const n=[],o=[];for await(const r of t)!0===e(r)?o.push(r):n.push(r);return[o,n]},xo=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]},Do=(t,e)=>new a((async function*(){yield e,yield*t})),Ro=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]})),$o=(t,e)=>"function"==typeof e?1===e.length?Oo(t,e):qo(t,e):jo(t,e),Oo=(t,e)=>new a((async function*(){for await(const n of t)yield e(n)})),qo=(t,e)=>new a((async function*(){let n=0;for await(const o of t)yield e(o,n),n++})),jo=(t,e)=>new a((async function*(){for await(const n of t)yield n[e]})),Fo=(t,e)=>"string"==typeof e?Bo(t,e):Wo(t,e),Wo=(t,e)=>new a((async function*(){for await(const n of t)yield e(n)})),Bo=(t,e)=>new a((async function*(){for await(const n of t)yield n[e]})),Ho=(t,e)=>"function"==typeof e?1===e.length?Lo(t,e):Uo(t,e):zo(t,e),Lo=(t,e)=>new a((async function*(){for await(const n of t)for(const t of e(n))yield t})),Uo=(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++}})),zo=(t,e)=>new a((async function*(){for await(const n of t)for(const t of n[e])yield t})),Vo=(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++}})),Jo=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},Ko=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},Go=(t,e)=>e?Qo(t,e):Yo(t),Yo=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},Xo=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?er(t,e):tr(t),tr=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},er=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},nr=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},or=(t,e)=>new a((async function*(){let n=0;for await(const o of t)n++>=e&&(yield o)})),rr=(t,e)=>1===e.length?sr(t,e):ir(t,e),sr=(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)})),ir=(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++})),ar=(t,e)=>1===e.length?cr(t,e):lr(t,e),cr=(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)})),lr=(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++})),hr=(t,e)=>e?fr(t,e):ur(t),ur=async t=>{let e=0;for await(const n of t)e+=n;return e},fr=async(t,e)=>{let n=0;for await(const o of t)n+=e(o);return n},gr=async(t,e)=>{let n=0;for await(const o of t)n+=await e(o);return n},wr=(t,e)=>new a((async function*(){let n=e>0?e:0;for await(const e of t){if(0==n--)break;yield e}})),yr=(t,e)=>1===e.length?dr(t,e):pr(t,e),dr=(t,e)=>new a((async function*(){for await(const n of t){if(!e(n))break;yield n}})),pr=(t,e)=>new a((async function*(){let n=0;for await(const o of t){if(!e(o,n++))break;yield o}})),_r=(t,e)=>1===e.length?mr(t,e):br(t,e),mr=(t,e)=>new a((async function*(){for await(const n of t){if(!await e(n))break;yield n}})),br=(t,e)=>new a((async function*(){let n=0;for await(const o of t){if(!await e(o,n++))break;yield o}})),vr=async t=>{const e=[];for await(const n of t)e.push(n);return e},Sr=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},kr=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},Cr=async(t,e)=>{const n={};for await(const o of t)n[e(o)]=o;return n},Er=async(t,e)=>{const n={};for await(const o of t)n[await e(o)]=o;return n},Ar=async t=>{const e=new Set;for await(const n of t)e.add(n);return e},Ir=(t,e,n)=>n?Pr(t,e,n):Tr(t,e),Tr=(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))})),Pr=(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))}})),Mr=(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))}})),Nr=(t,e)=>1===e.length?xr(t,e):Dr(t,e),xr=(t,e)=>new a((async function*(){for await(const n of t)!0===e(n)&&(yield n)})),Dr=(t,e)=>new a((async function*(){let n=0;for await(const o of t)!0===e(o,n++)&&(yield o)})),Rr=(t,e)=>1===e.length?$r(t,e):Or(t,e),$r=(t,e)=>new a((async function*(){for await(const n of t)!0===await e(n)&&(yield n)})),Or=(t,e)=>new a((async function*(){let n=0;for await(const o of t)!0===await e(o,n++)&&(yield o)})),qr=(t,e,n)=>n?Fr(t,e,n):jr(t,e),jr=(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]}})),Fr=(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)}})),Wr=(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)}})),Br=(t,e,n,o)=>{if(o){if(!n)throw new ReferenceError("TAccumulate function is undefined");return Ur(t,e,n,o)}return n?Lr(t,e,n):Hr(t,e)},Hr=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},Lr=async(t,e,n)=>{let o=e;for await(const e of t)o=n(o,e);return o},Ur=async(t,e,n,o)=>{let r=e;for await(const e of t)r=n(r,e);return o(r)},zr=(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}}},Vr=(t,e)=>{const n=zr(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))}},Jr=(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}}},Kr=(t,e)=>{const n=Jr(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))}},Gr=(t,e)=>{const n=t.dataFunc;switch(n.type){case 1:return new c({generator:()=>{const t=n.generator();return t.push(Promise.resolve(e)),t},type:n.type});case 2:return new c({generator:async()=>{const t=await n.generator();return t.push(Promise.resolve(e)),t},type:n.type});case 0:return new c({generator:async()=>{const t=await n.generator();return t.push(e),t},type:n.type})}},Yr=(t,e)=>e?Xr(t,e):Qr(t),Qr=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}},Xr=async(t,e)=>{const n=zr(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)}},Zr=async(t,e)=>{const n=Jr(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)}},ts=t=>S((async function*(){for await(const e of t)yield e})),es=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)}},ns=async(t,e)=>{let n;n=e?zr(t,e):t.dataFunc;const o=await es(n);if(0===o.length)throw new s(r.NoElements);let i=0;for(const t of o)i+=t;return i/o.length},os=async(t,e)=>{const n=Jr(t,e),o=await es(n);if(0===o.length)throw new s(r.NoElements);let i=0;for(const t of o)i+=t;return i/o.length},rs=(t,e)=>{if(e<1)throw new o("size");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)},ss=(t,e)=>new c({generator:async()=>{const[n,o]=await Promise.all([t.toArray(),e.toArray()]);return[...n,...o]},type:0}),is=async(t,e,n=i)=>{let o;switch(o=zr(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))}},as=async(t,e,n)=>{const o=Jr(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))}},cs=(t,e)=>e?hs(t,e):ls(t),ls=async t=>{const e=t.dataFunc;switch(e.type){case 0:case 2:return(await t.toArray()).length;case 1:return e.generator().length}},hs=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},us=async(t,e)=>{const n=Jr(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},fs=(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)},gs=(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}),ws=(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}),ys=(t,e)=>new c(zr(t,(t=>(e(t),t)))),ds=(t,e)=>{const n=Jr(t,(async t=>(await e(t),t)));return new c(n)},ps=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]}}},_s=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]}}},ms=(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}),bs=(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}),vs=t=>es(t.dataFunc),Ss=(t,e)=>e?Cs(t,e):ks(t),ks=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]}}},Cs=async(t,e)=>{const n=await vs(t);for(const t of n)if(!0===e(t))return t;throw new s(r.NoMatch)},Es=async(t,e)=>{const n=await vs(t);for(const t of n)if(!0===await e(t))return t;throw new s(r.NoMatch)},As=(t,e)=>e?Ts(t,e):Is(t),Is=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]}}},Ts=async(t,e)=>{const n=await vs(t);for(const t of n)if(!0===e(t))return t;return null},Ps=async(t,e)=>{const n=await vs(t);for(const t of n)if(!0===await e(t))return t;return null},Ms=(t,e,n)=>n?xs(t,e,n):Ns(t,e),Ns=(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 Z(t,o)}const o=new Array;for(const t in n)o.push(n[t]);return o},type:0}),xs=(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 Z(t,r))}const r=new Array;for(const t of o)r.push(t);return r},type:0}),Ds=(t,e,n)=>n?Rs(t,e,n):$s(t,e),Rs=(t,e,n)=>new c({generator:async()=>{const o=Jr(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 Z(t,e))}const i=new Array;for(const t of s)i.push(t);return i},type:0}),$s=(t,e)=>new c({generator:async()=>{const n=Jr(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 Z(t,e)}const s=new Array;for(const t in r)s.push(r[t]);return s},type:0}),Os=(t,e,n,o)=>o?qs(t,e,n,o):js(t,e,n),qs=(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 Z(t,e))}}const s=new Array;for(const t of r)s.push(t);return s},type:0}),js=(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 Z(t,i)}const r=new Array;for(const t in o)r.push(o[t]);return r},type:0}),Fs=(t,e,n,o,r,s)=>{const i=s?Ws(t,e,n,o,r,s):Bs(t,e,n,o,r);return new c({generator:i,type:0})},Ws=(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=>{const e=n(t),o=i.find((t=>s(t.key,e)))??{key:e,values:[]};return r(t,o.values)}))},Bs=(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=>{const e=n(t),o=s.get(e)??[];return r(t,o)}))},Hs=(t,e,n,o,r,s)=>{const i=s?Ls(t,e,n,o,r,s):Us(t,e,n,o,r);return new c({generator:i,type:0})},Ls=(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=>{const e=await n(t),o=i.find((t=>s(t.key,e)))??{key:e,values:[]};return r(t,o.values)}));return await Promise.all(a)},Us=(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=>{const e=await n(t),o=s.get(e)??[];return r(t,o)}));return await Promise.all(i)},zs=(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}),Vs=(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}),Ks=(t,e)=>e?Ys(t,e):Gs(t),Gs=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]}}},Ys=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)},Qs=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)},Xs=(t,e)=>e?ti(t,e):Zs(t),Zs=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]}}},ti=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},ei=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},ni=async(t,e)=>{let n;n=e?zr(t,e):t.dataFunc;const o=await es(n);if(0===o.length)throw new s(r.NoElements);return Math.max.apply(null,o)},oi=async(t,e)=>{const n=Jr(t,e),o=await es(n);if(0===o.length)throw new s(r.NoElements);return Math.max.apply(null,o)},ri=async(t,e)=>{let n;n=e?zr(t,e):t.dataFunc;const o=await es(n);if(0===o.length)throw new s(r.NoElements);return Math.min.apply(null,o)},si=async(t,e)=>{const n=Jr(t,e),o=await es(n);if(0===o.length)throw new s(r.NoElements);return Math.min.apply(null,o)},ii=(t,e)=>{const n="string"==typeof e?t=>[typeof t===e,t]:t=>[t instanceof e,t];return new c({generator:async()=>{const e=zr(t,n),o=await es(e),r=[];for(const[t,e]of o)t&&r.push(e);return r},type:0})};async function*ai(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*ci(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 li extends c{orderedPairs;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 li?async function*(){for await(const r of t.orderedPairs())yield*ai(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 li(r)}static generate(t,e,n,o){let r;return r=t instanceof li?async function*(){for await(const r of t.orderedPairs())yield*ci(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 li(r)}thenBy(t,e){return li.generate(this,t,!0,e)}thenByAsync(t,e){return li.generateAsync(this,t,!0,e)}thenByDescending(t,e){return li.generate(this,t,!1,e)}thenByDescendingAsync(t,e){return li.generateAsync(this,t,!1,e)}}const hi=(t,e)=>li.generate(t,(t=>t),!0,e),ui=(t,e,n)=>li.generate(t,e,!0,n),fi=(t,e,n)=>li.generateAsync(t,e,!0,n),gi=(t,e,n)=>li.generate(t,e,!1,n),wi=(t,e,n)=>li.generateAsync(t,e,!1,n),yi=(t,e)=>li.generate(t,(t=>t),!1,e),di=async(t,e)=>{const n=zr(t,(t=>[e(t),t])),o=await es(n),r=[],s=[];for(const[t,e]of o)t?s.push(e):r.push(e);return[s,r]},pi=async(t,e)=>{const n=Jr(t,(async t=>[await e(t),t])),o=await es(n),r=[],s=[];for(const[t,e]of o)t?s.push(e):r.push(e);return[s,r]},_i=(t,e)=>{const n=t.dataFunc;switch(n.type){case 1:return new c({generator:()=>{const t=n.generator();return t.unshift(Promise.resolve(e)),t},type:n.type});case 2:return new c({generator:async()=>{const t=await n.generator();return t.unshift(Promise.resolve(e)),t},type:n.type});case 0:return new c({generator:async()=>{const t=await n.generator();return t.unshift(e),t},type:n.type})}},mi=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})}},bi=(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}}},vi=(t,e)=>"function"==typeof e?1===e.length?new c(zr(t,e)):new c(bi(t,e)):new c(zr(t,(t=>t[e]))),Si=(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}}},ki=(t,e)=>{let n;return n="function"==typeof e?1===e.length?Jr(t,e):Si(t,e):Jr(t,(t=>t[e])),new c(n)},Ci=(t,e)=>new c({generator:async()=>{let n;n="function"==typeof e?1===e.length?zr(t,e):bi(t,e):zr(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}),Ei=(t,e)=>new c({generator:async()=>{let n;n=1===e.length?Jr(t,e):Si(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}),Ai=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},Ii=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},Ti=(t,e)=>e?Mi(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]}}},Mi=async(t,e)=>{const n=await vs(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},Ni=async(t,e)=>{const n=await vs(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},xi=(t,e)=>e?Ri(t,e):Di(t),Di=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]}}},Ri=async(t,e)=>{const n=await vs(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},$i=async(t,e)=>{const n=await vs(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},Oi=(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})}},qi=(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}),ji=(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}),Fi=(t,e)=>e?Bi(t,e):Wi(t),Wi=async t=>{let e=0;for(const n of await t.toArray())e+=n;return e},Bi=async(t,e)=>{let n=0;for(const o of await t.toArray())n+=e(o);return n},Hi=async(t,e)=>{const n=Jr(t,e),o=await es(n);let r=0;for(const t of o)r+=t;return r},Li=(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})}},Ui=(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}),zi=(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}),Vi=async(t,e)=>{const n=new Map,o=zr(t,(t=>[e(t),t])),r=await es(o);for(const[t,e]of r){const o=n.get(t);void 0===o?n.set(t,[e]):o.push(e)}return n},Ji=async(t,e)=>{const n=new Map,o=Jr(t,(async t=>[await e(t),t])),r=await es(o);for(const[t,e]of r){const o=n.get(t);void 0===o?n.set(t,[e]):o.push(e)}return n},Ki=async(t,e)=>{const n=t.dataFunc,o=await es(n),r={};for(const t of o)r[e(t)]=t;return r},Gi=async(t,e)=>{const n=Jr(t,(async t=>[await e(t),t])),o=await es(n),r={};for(const[t,e]of o)r[t]=e;return r},Yi=async t=>{const e=t.dataFunc,n=await es(e);return new Set(n)},Qi=(t,e,n)=>n?Zi(t,e,n):Xi(t,e),Xi=(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}),Zi=(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}),ta=(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}),ea=(t,e)=>new c({generator:async()=>(await t.toArray()).filter(e),type:0}),na=(t,e)=>new c({generator:async()=>{const n=Si(t,(async(t,n)=>[await e(t,n),t])),o=await es(n),r=[];for(const[t,e]of o)t&&r.push(e);return r},type:0}),oa=(t,e,n)=>n?sa(t,e,n):ra(t,e),ra=(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}),sa=(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}),ia=(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}),aa=()=>{const t=String.prototype,e=Object.getOwnPropertyNames(l.prototype);for(const n of e)t[n]=t[n]??l.prototype[n];t.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]},t.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]},t.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},t.elementAt=function(t){if(t<0||t>=this.length)throw new o("index");return this[t]},t.elementAtOrDefault=function(t){return this[t]||null},t.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]},t.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]},t.reverse=function(){const t=this;return new l((function*(){for(let e=t.length-1;e>=0;e--)yield t[e]}))}},ca=t=>{const e=h.prototype,n=t.prototype,o=Object.getOwnPropertyNames(e);for(const t of o)n[t]=n[t]??e[t]},la=()=>{nn(Map),nn(Set),aa(),ca(Array),ca(Int8Array),ca(Int16Array),ca(Int32Array),ca(Uint8Array),ca(Uint8ClampedArray),ca(Uint16Array),ca(Uint32Array),ca(Float32Array),ca(Float64Array)};nn(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(on,"aggregate"),n(cn,"all"),n(ln,"allAsync"),n(hn,"append"),n(un,"any"),n(wn,"anyAsync"),n(yn,"asParallel"),n(dn,"average"),n(pn,"averageAsync"),n(_n,"chunk"),n(mn,"concatenate"),n(bn,"contains"),n(vn,"containsAsync"),n(Sn,"count"),n(En,"countAsync"),n(An,"defaultIfEmpty"),n(In,"distinct"),n(Tn,"distinctAsync"),n(Pn,"each"),n(Mn,"eachAsync"),n(Nn,"elementAt"),n(xn,"elementAtOrDefault"),n(Dn,"except"),n(Rn,"exceptAsync"),n($n,"first"),n(jn,"firstAsync"),n(Fn,"firstOrDefault"),n(Hn,"firstOrDefaultAsync"),n(Ln,"groupBy"),n(Vn,"groupByAsync"),n(Gn,"groupByWithSel"),n(Xn,"groupJoin"),n(eo,"groupJoinAsync"),n(ro,"intersect"),n(so,"intersectAsync"),n(io,"joinByKey"),n(ao,"last"),n(ho,"lastAsync"),n(uo,"lastOrDefault"),n(wo,"lastOrDefaultAsync"),n(yo,"max"),n(mo,"maxAsync"),n(bo,"min"),n(ko,"minAsync"),n(Co,"ofType"),n(Eo,"order"),n(Ao,"orderBy"),n(Io,"orderByAsync"),n(To,"orderByDescending"),n(Po,"orderByDescendingAsync"),n(Mo,"orderDescending"),n(No,"partition"),n(xo,"partitionAsync"),n(Do,"prepend"),n(Ro,"reverse"),n($o,"select"),n(Fo,"selectAsync"),n(Ho,"selectMany"),n(Vo,"selectManyAsync"),n(Jo,"sequenceEquals"),n(Ko,"sequenceEqualsAsync"),n(Go,"single"),n(Xo,"singleAsync"),n(Zo,"singleOrDefault"),n(nr,"singleOrDefaultAsync"),n(or,"skip"),n(rr,"skipWhile"),n(ar,"skipWhileAsync"),n(hr,"sum"),n(gr,"sumAsync"),n(wr,"take"),n(yr,"takeWhile"),n(_r,"takeWhileAsync"),n(vr,"toArray"),n(Sr,"toMap"),n(kr,"toMapAsync"),n(Cr,"toObject"),n(Er,"toObjectAsync"),n(Ar,"toSet"),n(Ir,"union"),n(Mr,"unionAsync"),n(Nr,"where"),n(Rr,"whereAsync"),n(qr,"zip"),n(Wr,"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(Br,"aggregate"),n(Vr,"all"),n(Kr,"allAsync"),n(Gr,"append"),n(Yr,"any"),n(Zr,"anyAsync"),n(ts,"asAsync"),n(ns,"average"),n(os,"averageAsync"),n(rs,"chunk"),n(ss,"concatenate"),n(is,"contains"),n(as,"containsAsync"),n(cs,"count"),n(us,"countAsync"),n(fs,"defaultIfEmpty"),n(gs,"distinct"),n(ws,"distinctAsync"),n(ys,"each"),n(ds,"eachAsync"),n(ps,"elementAt"),n(_s,"elementAtOrDefault"),n(ms,"except"),n(bs,"exceptAsync"),n(Ss,"first"),n(Es,"firstAsync"),n(As,"firstOrDefault"),n(Ps,"firstOrDefaultAsync"),n(Ms,"groupBy"),n(Ds,"groupByAsync"),n(Os,"groupByWithSel"),n(Fs,"groupJoin"),n(Hs,"groupJoinAsync"),n(Fs,"groupJoin"),n(Hs,"groupJoinAsync"),n(zs,"intersect"),n(Vs,"intersectAsync"),n(Js,"joinByKey"),n(Ks,"last"),n(Qs,"lastAsync"),n(Xs,"lastOrDefault"),n(ei,"lastOrDefaultAsync"),n(ni,"max"),n(oi,"maxAsync"),n(ri,"min"),n(si,"minAsync"),n(ii,"ofType"),n(hi,"order"),n(ui,"orderBy"),n(fi,"orderByAsync"),n(gi,"orderByDescending"),n(wi,"orderByDescendingAsync"),n(yi,"orderDescending"),n(di,"partition"),n(pi,"partitionAsync"),n(_i,"prepend"),n(mi,"reverse"),n(vi,"select"),n(ki,"selectAsync"),n(Ci,"selectMany"),n(Ei,"selectManyAsync"),n(Ai,"sequenceEquals"),n(Ii,"sequenceEqualsAsync"),n(Ti,"single"),n(Ni,"singleAsync"),n(xi,"singleOrDefault"),n($i,"singleOrDefaultAsync"),n(Oi,"skip"),n(qi,"skipWhile"),n(ji,"skipWhileAsync"),n(Fi,"sum"),n(Hi,"sumAsync"),n(Li,"take"),n(Ui,"takeWhile"),n(zi,"takeWhileAsync"),n(vs,"toArray"),n(Vi,"toMap"),n(Ji,"toMapAsync"),n(Ki,"toObject"),n(Gi,"toObjectAsync"),n(Yi,"toSet"),n(Qi,"union"),n(ta,"unionAsync"),n(ea,"where"),n(na,"whereAsync"),n(oa,"zip"),n(ia,"zipAsync")})(c),(()=>{const{prototype:t}=h,e=Object.getOwnPropertyNames(l.prototype);for(const n of e)t[n]=t[n]??l.prototype[n];t.all=function(t){return this.every(t)},t.any=function(t){return t?this.some(t):0!==this.length},t.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},t.elementAt=function(t){if(t<0||t>=this.length)throw new o("index");return this[t]},t.elementAtOrDefault=function(t){return this[t]??null},t.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]},t.firstOrDefault=function(t){if(t){const e=this.find(t);return void 0===e?null:e}return 0===this.length?null:this[0]},t.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]},t.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]},t.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)},t.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)},t.reverse=function(){return Array.prototype.reverse.apply(this),this}})()}}]);
//# sourceMappingURL=787-exalushome-extalife.bundle.js.map