1import{a as Ve}from"./chunk-ZNDGZGEM.js";import{Lb as Fe,Mb as qe,Ta as De,d as ze,g as re}from"./chunk-RCBA66QG.js";import{Qa as Oe,a as p,b as U,c as B,la as ne,o as d,oa as O,w as W}from"./chunk-MECLTUZI.js";var Xe=(()=>{let e=class e{constructor(){this.etatSubject$=new W(null),this.runCourant=null}getEtatObs(){return this.etatSubject$.asObservable()}getEtatCourant(){return this.etatSubject$.value}reset(){this.etatSubject$.next(null)}annulerLocal(){let n=this.etatSubject$.value;n&&n.enCours&&this.etatSubject$.next(this.appliquerAnnulation(n))}handleNotification(n){if(!n)return;let r;try{r=JSON.parse(n)}catch{return}if(r.type==="init")this.runCourant=r.run??null;else if(r.run&&r.run!==this.runCourant)return;let i=this.etatSubject$.value;switch(r.type){case"init":this.etatSubject$.next({fichiers:(r.fichiers??[]).map(s=>({nom:s.nom,tailleOctets:s.tailleOctets,statut:"enAttente"})),total:r.total,traites:0,pourcentage:0,enCours:!0,termine:!1,annule:!1});break;case"fichier":{if(!i)return;let s=i.fichiers.map(h=>h.nom===r.nomFichier?U(p({},h),{statut:r.statut,acceptee:r.acceptee??!1}):h),a=s.find(h=>h.statut==="enAttente");a&&(a.statut="enCours"),this.etatSubject$.next(U(p({},i),{fichiers:s,traites:r.traites,pourcentage:r.pourcentage}));break}case"termine":i&&this.etatSubject$.next(U(p({},i),{enCours:!1,termine:!0,pourcentage:100}));break;case"annule":i&&this.etatSubject$.next(this.appliquerAnnulation(i));break}}appliquerAnnulation(n){let r=n.fichiers.map(i=>i.statut==="enAttente"||i.statut==="enCours"?U(p({},i),{statut:"annule"}):i);return U(p({},n),{fichiers:r,enCours:!1,annule:!0})}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=ne({token:e,factory:e.\u0275fac,providedIn:"root"});let o=e;return o})();var E=class extends Error{constructor(e,t){let n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}},M=class extends Error{constructor(e="A timeout occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},x=class extends Error{constructor(e="An abort occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},oe=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}},ie=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}},se=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}},X=class extends Error{constructor(e){let t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}},ae=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}};var z=class{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}},P=class{get(e,t){return this.send(U(p({},t),{method:"GET",url:e}))}post(e,t){return this.send(U(p({},t),{method:"POST",url:e}))}delete(e,t){return this.send(U(p({},t),{method:"DELETE",url:e}))}getCookieString(e){return""}};var c=(function(o){return o[o.Trace=0]="Trace",o[o.Debug=1]="Debug",o[o.Information=2]="Information",o[o.Warning=3]="Warning",o[o.Error=4]="Error",o[o.Critical=5]="Critical",o[o.None=6]="None",o})(c||{});var I=class{constructor(){}log(e,t){}};I.instance=new I;var ft="8.0.17",_=class{static isRequired(e,t){if(e==null)throw new Error(`The '${t}' argument is required.`)}static isNotEmpty(e,t){if(!e||e.match(/^\s*$/))throw new Error(`The '${t}' argument should not be empty.`)}static isIn(e,t,n){if(!(e in t))throw new Error(`Unknown ${n} value: ${e}.`)}},m=class o{static get isBrowser(){return!o.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!o.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!o.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}};function H(o,e){let t="";return A(o)?(t=`Binary data of length ${o.byteLength}`,e&&(t+=`. Content: '${dt(o)}
1'`)):typeof o=="string"&&(t=`String data of length ${o.length}`,e&&(t+=`. Content: '${o}'`)),t}function dt(o){let e=new Uint8Array(o),t="";return e.forEach(n=>{let r=n<16?"0":"";t+=`0x${r}${n.toString(16)} `}),t.substr(0,t.length-1)}function A(o){return o&&typeof ArrayBuffer<"u"&&(o instanceof ArrayBuffer||o.constructor&&o.constructor.name==="ArrayBuffer")}function he(o,e,t,n,r,i){return d(this,null,function*(){let s={},[a,h]=R();s[a]=h,o.log(c.Trace,`(${e} transport) sending data. ${H(r,i.logMessageContent)}.`);let l=A(r)?"arraybuffer":"text",f=yield t.post(n,{content:r,headers:p(p({},s),i.headers),responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});o.log(c.Trace,`(${e} transport) request complete. Response status: ${f.statusCode}.`)})}function Ke(o){return o===void 0?new L(c.Information):o===null?I.instance:o.log!==void 0?o:new L(o)}var ce=class{constructor(e,t){this._subject=e,this._observer=t}dispose(){let e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(t=>{})}},L=class{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){let n=`[${new Date().toISOString()}] ${c[e]}: ${t}`;switch(e){case c.Critical:case c.Error:this.out.error(n);break;case c.Warning:this.out.warn(n);break;case c.Information:this.out.info(n);break;default:this.out.log(n);break}}}};function R(){let o="X-SignalR-User-Agent";return m.isNode&&(o="User-Agent"),[o,pt(ft,gt(),mt(),_t())]}function pt(o,e,t,n){let r="Microsoft SignalR/",i=o.split(".");return r+=`${i[0]}.${i[1]}`,r+=` (${o}; `,e&&e!==""?r+=`${e}; `:r+="Unknown OS; ",r+=`${t}`,n?r+=`; ${n}`:r+="; Unknown Runtime Version",r+=")",r}function gt(){if(m.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function _t(){if(m.isNode)return process.versions.node}function mt(){return m.isNode?"NodeJS":"Browser"}function le(o){return o.stack?o.stack:o.message?o.message:`${o}`}function Je(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}var ue=class extends P{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||m.isNode){let t=typeof __webpack_require__=="function"?__non_webpack_require__:B;this._jar=new(t("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=t("node-fetch"):this._fetchType=fetch,this._fetchType=t("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(Je());if(typeof AbortController>"u"){let t=typeof __webpack_require__=="function"?__non_webpack_require__:B;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}send(e){return d(this,null,function*(){if(e.abortSignal&&e.abortSignal.aborted)throw new x;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");let t=new this._abortControllerType,n;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),n=new x});let r=null;if(e.timeout){let h=e.timeout;r=setTimeout(()=>{t.abort(),this._logger.log(c.Warning,"Timeout from HTTP request."),n=new M},h)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},A(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let i;try{i=yield this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:p({"X-Requested-With":"XMLHttpRequest"},e.headers),method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(h){throw n||(this._logger.log(c.Warning,`Error from HTTP request. ${h}.`),h)}finally{r&&clearTimeout(r),e.abortSignal&&(e.abortSignal.onabort=null)}if(!i.ok){let h=yield je(i,"text");throw new E(h||i.statusText,i.status)}let a=yield je(i,e.responseType);return new z(i.status,i.statusText,a)})}getCookieString(e){let t="";return m.isNode&&this._jar&&this._jar.getCookies(e,(n,r)=>t=r.join("; ")),t}};function je(o,e){let t;switch(e){case"arraybuffer":t=o.arrayBuffer();break;case"text":t=o.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:t=o.text();break}return t}var fe=class extends P{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new x):e.method?e.url?new Promise((t,n)=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),r.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,r.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(A(e.content)?r.setRequestHeader("Content-Type","application/octet-stream"):r.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));let i=e.headers;
1i&&Object.keys(i).forEach(s=>{r.setRequestHeader(s,i[s])}),e.responseType&&(r.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{r.abort(),n(new x)}),e.timeout&&(r.timeout=e.timeout),r.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),r.status>=200&&r.status<300?t(new z(r.status,r.statusText,r.response||r.responseText)):n(new E(r.response||r.responseText||r.statusText,r.status))},r.onerror=()=>{this._logger.log(c.Warning,`Error from HTTP request. ${r.status}: ${r.statusText}.`),n(new E(r.statusText,r.status))},r.ontimeout=()=>{this._logger.log(c.Warning,"Timeout from HTTP request."),n(new M)},r.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}};var de=class extends P{constructor(e){if(super(),typeof fetch<"u"||m.isNode)this._httpClient=new ue(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new fe(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new x):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}};var T=class o{static write(e){return`${e}${o.RecordSeparator}`}static parse(e){if(e[e.length-1]!==o.RecordSeparator)throw new Error("Message is incomplete.");let t=e.split(o.RecordSeparator);return t.pop(),t}};T.RecordSeparatorCode=30;T.RecordSeparator=String.fromCharCode(T.RecordSeparatorCode);var pe=class{writeHandshakeRequest(e){return T.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(A(e)){let a=new Uint8Array(e),h=a.indexOf(T.RecordSeparatorCode);
1if(h===-1)throw new Error("Message is incomplete.");let l=h+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,l))),n=a.byteLength>l?a.slice(l).buffer:null}else{let a=e,h=a.indexOf(T.RecordSeparator);if(h===-1)throw new Error("Message is incomplete.");let l=h+1;t=a.substring(0,l),n=a.length>l?a.substring(l):null}let r=T.parse(t),i=JSON.parse(r[0]);if(i.type)throw new Error("Expected a handshake response from the server.");return[n,i]}};var u=(function(o){return o[o.Invocation=1]="Invocation",o[o.StreamItem=2]="StreamItem",o[o.Completion=3]="Completion",o[o.StreamInvocation=4]="StreamInvocation",o[o.CancelInvocation=5]="CancelInvocation",o[o.Ping=6]="Ping",o[o.Close=7]="Close",o[o.Ack=8]="Ack",o[o.Sequence=9]="Sequence",o})(u||{});var ge=class{constructor(){this.observers=[]}next(e){for(let t of this.observers)t.next(e)}error(e){for(let t of this.observers)t.error&&t.error(e)}complete(){for(let e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new ce(this,e)}};var _e=class{constructor(e,t,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=e,this._connection=t,this._bufferSize=n}_send(e){return d(this,null,function*(){let t=this._protocol.writeMessage(e),n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let r=()=>{},i=()=>{};A(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((s,a)=>{r=s,i=a})),this._messages.push(new Ae(t,this._totalMessageCount,r,i))}try{this._reconnectInProgress||(yield this._connection.send(t))}catch{this._disconnected()}yield n})}_ack(e){let t=-1;for(let n=0;n<this._messages.length;n++){let r=this._messages[n];if(r._id<=e.sequenceId)t=n,A(r._message)?this._bufferedByteCount-=r._message.byteLength:this._bufferedByteCount-=r._message.length,r._resolver();else if(this._bufferedByteCount<this._bufferSize)r._resolver();else break}t!==-1&&(this._messages=this._messages.slice(t+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type!==u.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;let t=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,t<=this._latestReceivedSequenceId?(t===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=t,this._ackTimer(),!0)}_resetSequence(e){if(e.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}_resend(){return d(this,null,function*(){let e=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;yield this._connection.send(this._protocol.writeMessage({type:u.Sequence,sequenceId:e}));let t=this._messages;for(let n of t)yield this._connection.send(n._message);this._reconnectInProgress=!1})}_dispose(e){e??(e=new Error("Unable to reconnect to server."));for(let t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case u.Invocation:case u.StreamItem:case u.Completion:case u.StreamInvocation:case u.CancelInvocation:return!0;case u.Close:case u.Sequence:case u.Ping:case u.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(()=>d(this,null,function*(){try{this._reconnectInProgress||(yield this._connection.send(this._protocol.writeMessage({type:u.Ack,sequenceId:this._latestReceivedSequenceId})))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0}),1e3))}},Ae=class{constructor(e,t,n,r){this._message=e,this._id=t,this._resolver=n,this._rejector=r}};var wt=30*1e3,vt=15*1e3,yt=1e5,v=(function(o){return o.Disconnected="Disconnected",o.Connecting="Connecting",o.Connected="Connected",o.Disconnecting="Disconnecting",o.Reconnecting="Reconnecting",o})(v||{}),K=class o{static create(e,t,n,r,i,s,a){return new o(e,t,n,r,i,s,a)}constructor(e,t,n,r,i,s,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(c.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")},_.isRequired(e,"connection"),_.isRequired(t,"logger"),_.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=i??wt,this.keepAliveIntervalInMilliseconds=s??vt,this._statefulReconnectBufferSize=a??yt,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=r,this._handshakeProtocol=new pe,this.connection.onreceive=h=>
1this._processIncomingData(h),this.connection.onclose=h=>this._connectionClosed(h),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=v.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:u.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==v.Disconnected&&this._connectionState!==v.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}_startWithStateTransitions(){return d(this,null,function*(){if(this._connectionState!==v.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=v.Connecting,this._logger.log(c.Debug,"Starting HubConnection.");try{yield this._startInternal(),m.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=v.Connected,this._connectionStarted=!0,this._logger.log(c.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=v.Disconnected,this._logger.log(c.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}})}_startInternal(){return d(this,null,function*(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;let e=new Promise((t,n)=>{this._handshakeResolver=t,this._handshakeRejecter=n});yield this.connection.start(this._protocol.transferFormat);try{let t=this._protocol.version;this.connection.features.reconnect||(t=1);let n={protocol:this._protocol.name,version:t};if(this._logger.log(c.Debug,"Sending handshake request."),yield this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(c.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),yield e,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new _e(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||(yield this._sendMessage(this._cachedPingMessage))}catch(t){throw this._logger.log(c.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),yield this.connection.stop(t),t}})}stop(){return d(this,null,function*(){let e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),yield this._stopPromise;try{yield e}catch{}})}_stopInternal(e){if(this._connectionState===v.Disconnected)return this._logger.log(c.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===v.Disconnecting)return this._logger.log(c.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;let t=this._connectionState;return this._connectionState=v.Disconnecting,this._logger.log(c.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(c.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===v.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new x("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}_sendCloseMessage(){return d(this,null,function*(){try{yield this._sendWithProtocol(this._createCloseMessage())}catch{}})}stream(e,...t){let[n,r]=this._replaceStreamingParams(t),i=this._createStreamInvocation(e,t,r),s,a=new ge;return a.cancelCallback=()=>{let h=this._createCancelInvocation(i.invocationId);return delete this._callbacks[i.invocationId],s.then(()=>this._sendWithProtocol(h))},this._callbacks[i.invocationId]=(h,l)=>{if(l){a.error(l);return}else h&&(h.type===u.Completion?h.error?a.error(new Error(h.error)):a.complete():a.next(h.item))},s=this._sendWithProtocol(i).catch(h=>{a.error(h),delete this._callbacks[i.invocationId]}),this._launchStreams(n,s),a}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._messageBuffer?this._messageBuffer._send(e):this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){let[n,r]=this._replaceStreamingParams(t),i=this._sendWithProtocol(this._createInvocation(e,t,!0,r));return this._launchStreams(n,i),i}invoke(e,...t){let[n,r]=this._replaceStreamingParams(t),i=this._createInvocation(e,t,!1,r);return new Promise((a,h)=>{this._callbacks[i.invocationId]=(f,g)=>{if(g){h(g);return}else f&&(f.type===u.Completion?f.error?h(new Error(f.error)):a(f.result):h(new Error(`Unexpected message type: ${f.type}`)))};let l=this._sendWithProtocol(i).catch(f=>{h(f),delete this._callbacks[i.invocationId]});this._launchStreams(n,l)})}on(e,t){!e||!t||(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),this._methods[e].indexOf(t)===-1&&this._methods[e].push(t))}off(e,t){if(!e)return;e=e.toLowerCase();let n=this._methods[e];if(n)if(t){let r=n.indexOf(t);r!==-1&&(n.splice(r,1),n.length===0&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){let t=this._protocol.parseMessages(e,this._logger);for(let n of t)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(n)))switch(n.type){case u.Invocation:this._invokeClientMethod(n).catch(r=>{this._logger.log(c.Error,`Invoke client method threw error: ${le(r)}`)});break;case u.StreamItem:case u.Completion:{let r=this._callbacks[n.invocationId];if(r){n.type===u.Completion&&delete this._callbacks[n.invocationId];try{r(n)}catch(i){this._logger.log(c.Error,`Stream callback threw error: ${le(i)}`)}}break}case u.Ping:break;case u.Close:{this._logger.log(c.Information,"Close message received from server.");let r=n.error?new Error("Server returned an error on close: "+n.error):void 0;n.allowReconnect===!0?this.connection.stop(r):this._stopPromise=this._stopInternal(r);break}case u.Ack:this._messageBuffer&&this._messageBuffer._ack(n);break;case u.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(n);break;default:this._logger.log(c.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,n;try{[n,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(r){let i="Error parsing handshake response: "+r;this._logger.log(c.Error,i);let s=new Error(i);throw this._handshakeRejecter(s),s}if(t.error){let r="Server returned handshake error: "+t.error;this._logger.log(c.Error,r);let i=new Error(r);throw this._handshakeRejecter(i),i}else this._logger.log(c.Debug,"Server handshake complete.");return this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}
1_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let e=this._nextKeepAlive-new Date().getTime();e<0&&(e=0),this._pingServerHandle=setTimeout(()=>d(this,null,function*(){if(this._connectionState===v.Connected)try{yield this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}_invokeClientMethod(e){return d(this,null,function*(){let t=e.target.toLowerCase(),n=this._methods[t];if(!n){this._logger.log(c.Warning,`No client method with the name '${t}' found.`),e.invocationId&&(this._logger.log(c.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),yield this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}let r=n.slice(),i=!!e.invocationId,s,a,h;for(let l of r)try{let f=s;s=yield l.apply(this,e.arguments),i&&s&&f&&(this._logger.log(c.Error,`Multiple results provided for '${t}'. Sending error to server.`),h=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),a=void 0}catch(f){a=f,this._logger.log(c.Error,`A callback for the method '${t}' threw error '${f}'.`)}h?yield this._sendWithProtocol(h):i?(a?h=this._createCompletionMessage(e.invocationId,`${a}`,null):s!==void 0?h=this._createCompletionMessage(e.invocationId,null,s):(this._logger.log(c.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),h=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),yield this._sendWithProtocol(h)):s&&this._logger.log(c.Error,`Result given for '${t}' method but server is not expecting a result.`)})}_connectionClosed(e){this._logger.log(c.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new x("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===v.Disconnecting?this._completeClose(e):this._connectionState===v.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===v.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=v.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(e??new Error("Connection closed.")),this._messageBuffer=void 0),m.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(t=>t.apply(this,[e]))}catch(t){this._logger.log(c.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}_reconnect(e){return d(this,null,function*(){let t=Date.now(),n=0,r=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),i=this._getNextRetryDelay(n++,0,r);if(i===null){this._logger.log(c.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=v.Reconnecting,e?this._logger.log(c.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(c.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(s=>s.apply(this,[e]))}catch(s){this._logger.log(c.Error,`An onreconnecting callback called with error '${e}' threw error '${s}'.`)}if(this._connectionState!==v.Reconnecting){this._logger.log(c.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;i!==null;){if(this._logger.log(c.Information,`Reconnect attempt number ${n} will start in ${i} ms.`),yield new Promise(s=>{this._reconnectDelayHandle=setTimeout(s,i)}),this._reconnectDelayHandle=void 0,this._connectionState!==v.Reconnecting){this._logger.log(c.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(yield this._startInternal(),this._connectionState=v.Connected,this._logger.log(c.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(s=>s.apply(this,[this.connection.connectionId]))}catch(s){this._logger.log(c.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${s}'.`)}return}catch(s){if(this._logger.log(c.Information,`Reconnect attempt failed because of error '${s}'.`),this._connectionState!==v.Reconnecting){this._logger.log(c.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===v.Disconnecting&&this._completeClose();return}r=s instanceof Error?s:new Error(s.toString()),i=this._getNextRetryDelay(n++,Date.now()-t,r)}}this._logger.log(c.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()})}_getNextRetryDelay(e,t,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:n})}catch(r){return this._logger.log(c.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${r}'.`),null}}_cancelCallbacksWithError(e){let t=this._callbacks;this._callbacks={},Object.keys(t).forEach(n=>{let r=t[n];try{r(null,e)}catch(i){this._logger.log(c.Error,`Stream 'error' callback called with '${e}' threw error: ${le(i)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,n,r){if(n)return r.length!==0?{arguments:t,streamIds:r,target:e,type:u.Invocation}:{arguments:t,target:e,type:u.Invocation};{let i=this._invocationId;return this._invocationId++,r.length!==0?{arguments:t,invocationId:i.toString(),streamIds:r,target:e,type:u.Invocation}:{arguments:t,invocationId:i.toString(),target:e,type:u.Invocation}}}_launchStreams(e,t){if(e.length!==0){t||(t=Promise.resolve());for(let n in e)e[n].subscribe({complete:()=>{t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n)))},error:r=>{let i;r instanceof Error?i=r.message:r&&r.toString?i=r.toString():i="Unknown error",t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,i)))},next:r=>{t=t.then(()=>this._sendWithProtocol(this._createStreamItemMessage(n,r)))}})}}_replaceStreamingParams(e){let t=[],n=[];for(let r=0;r<e.length;r++){let i=e[r];if(this._isObservable(i)){let s=this._invocationId;this._invocationId++,t[s]=i,n.push(s.toString()),e.splice(r,1)}}return[t,n]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,t,n){let r=this._invocationId;return this._invocationId++,n.length!==0?{arguments:t,invocationId:r.toString(),streamIds:n,target:e,type:u.StreamInvocation}:{arguments:t,invocationId:r.toString(),target:e,type:u.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:u.CancelInvocation}}_createStreamItemMessage(e,t){return{invocationId:e,item:t,type:u.StreamItem}}_createCompletionMessage(e,t,n){return t?{error:t,invocationId:e,type:u.Completion}:{invocationId:e,result:n,type:u.Completion}}_createCloseMessage(){return{type:u.Close}}};var St=[0,2e3,1e4,3e4,null],J=class{constructor(e){this._retryDelays=e!==void 0?[...e,null]:St}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}};var N=(()=>{class o{}return o.Authorization="Authorization",o.Cookie="Cookie",o})();var me=class extends P{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}
1send(e){return d(this,null,function*(){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=yield this._accessTokenFactory()),this._setAuthorizationHeader(e);let n=yield this._innerClient.send(e);return t&&n.statusCode===401&&this._accessTokenFactory?(this._accessToken=yield this._accessTokenFactory(),this._setAuthorizationHeader(e),yield this._innerClient.send(e)):n})}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[N.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[N.Authorization]&&delete e.headers[N.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}};var b=(function(o){return o[o.None=0]="None",o[o.WebSockets=1]="WebSockets",o[o.ServerSentEvents=2]="ServerSentEvents",o[o.LongPolling=4]="LongPolling",o})(b||{}),S=(function(o){return o[o.Text=1]="Text",o[o.Binary=2]="Binary",o})(S||{});var we=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}};var j=class{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new we,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}connect(e,t){return d(this,null,function*(){if(_.isRequired(e,"url"),_.isRequired(t,"transferFormat"),_.isIn(t,S,"transferFormat"),this._url=e,this._logger.log(c.Trace,"(LongPolling transport) Connecting."),t===S.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");let[n,r]=R(),i=p({[n]:r},this._options.headers),s={abortSignal:this._pollAbort.signal,headers:i,timeout:1e5,withCredentials:this._options.withCredentials};t===S.Binary&&(s.responseType="arraybuffer");let a=`${e}&_=${Date.now()}`;this._logger.log(c.Trace,`(LongPolling transport) polling: ${a}.`);let h=yield this._httpClient.get(a,s);h.statusCode!==200?(this._logger.log(c.Error,`(LongPolling transport) Unexpected response code: ${h.statusCode}.`),this._closeError=new E(h.statusText||"",h.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,s)})}_poll(e,t){return d(this,null,function*(){try{for(;this._running;)try{let n=`${e}&_=${Date.now()}`;this._logger.log(c.Trace,`(LongPolling transport) polling: ${n}.`);let r=yield this._httpClient.get(n,t);r.statusCode===204?(this._logger.log(c.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):r.statusCode!==200?(this._logger.log(c.Error,`(LongPolling transport) Unexpected response code: ${r.statusCode}.`),this._closeError=new E(r.statusText||"",r.statusCode),this._running=!1):r.content?(this._logger.log(c.Trace,`(LongPolling transport) data received. ${H(r.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(r.content)):this._logger.log(c.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof M?this._logger.log(c.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(c.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(c.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}})}send(e){return d(this,null,function*(){return this._running?he(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return d(this,null,function*(){this._logger.log(c.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{yield this._receiving,this._logger.log(c.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);let e={},[t,n]=R();e[t]=n;let r={headers:p(p({},e),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials},i;try{yield this._httpClient.delete(this._url,r)}catch(s){i=s}i?i instanceof E&&(i.statusCode===404?this._logger.log(c.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(c.Trace,`(LongPolling transport) Error sending a DELETE request: ${i}`)):this._logger.log(c.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(c.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}})}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(c.Trace,e),this.onclose(this._closeError)}}};var ve=class{constructor(e,t,n,r){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=r,this.onreceive=null,this.onclose
1=null}connect(e,t){return d(this,null,function*(){return _.isRequired(e,"url"),_.isRequired(t,"transferFormat"),_.isIn(t,S,"transferFormat"),this._logger.log(c.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,r)=>{let i=!1;if(t!==S.Text){r(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let s;if(m.isBrowser||m.isWebWorker)s=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{let a=this._httpClient.getCookieString(e),h={};h.Cookie=a;let[l,f]=R();h[l]=f,s=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:p(p({},h),this._options.headers)})}try{s.onmessage=a=>{if(this.onreceive)try{this._logger.log(c.Trace,`(SSE transport) data received. ${H(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(h){this._close(h);return}},s.onerror=a=>{i?this._close():r(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."))},s.onopen=()=>{this._logger.log(c.Information,`SSE connected to ${this._url}`),this._eventSource=s,i=!0,n()}}catch(a){r(a);return}})})}send(e){return d(this,null,function*(){return this._eventSource?he(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}};var ye=class{constructor(e,t,n,r,i,s){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=r,this._webSocketConstructor=i,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=s}connect(e,t){return d(this,null,function*(){_.isRequired(e,"url"),_.isRequired(t,"transferFormat"),_.isIn(t,S,"transferFormat"),this._logger.log(c.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=yield this._accessTokenFactory()),new Promise((r,i)=>{e=e.replace(/^http/,"ws");let s,a=this._httpClient.getCookieString(e),h=!1;if(m.isNode||m.isReactNative){let l={},[f,g]=R();l[f]=g,n&&(l[N.Authorization]=`Bearer ${n}`),a&&(l[N.Cookie]=a),s=new this._webSocketConstructor(e,void 0,{headers:p(p({},l),this._headers)})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);s||(s=new this._webSocketConstructor(e)),t===S.Binary&&(s.binaryType="arraybuffer"),s.onopen=l=>{this._logger.log(c.Information,`WebSocket connected to ${e}.`),this._webSocket=s,h=!0,r()},s.onerror=l=>{let f=null;typeof ErrorEvent<"u"&&l instanceof ErrorEvent?f=l.error:f="There was an error with the transport",this._logger.log(c.Information,`(WebSockets transport) ${f}.`)},s.onmessage=l=>{if(this._logger.log(c.Trace,`(WebSockets transport) data received. ${H(l.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(l.data)}catch(f){this._close(f);return}},s.onclose=l=>{if(h)this._close(l);else{let f=null;typeof ErrorEvent<"u"&&l instanceof ErrorEvent?f=l.error:f="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.",i(new Error(f))}}})})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(c.Trace,`(WebSockets transport) sending data. ${H(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(c.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}};var Ge=100,Se=class{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,_.isRequired(e,"url"),this._logger=Ke(t.logger),this.baseUrl=this._resolveUrl(e),t=t||{},t.logMessageContent=t.logMessageContent===void 0?!1:t.logMessageContent,typeof t.withCredentials=="boolean"||t.withCredentials===void 0)t.withCredentials=t.withCredentials===void 0?!0:t.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.timeout=t.timeout===void 0?100*1e3:t.timeout;let n=null,r=null;if(m.isNode&&typeof B<"u"){let i=typeof __webpack_require__=="function"?__non_webpack_require__:B;n=i("ws"),r=i("eventsource")}!m.isNode&&typeof WebSocket<"u"&&!t.WebSocket?t.WebSocket=WebSocket:m.isNode&&!t.WebSocket&&n&&(t.WebSocket=n),!m.isNode&&typeof EventSource<"u"&&!t.EventSource?t.EventSource=EventSource:m.isNode&&!t.EventSource&&typeof r<"u"&&(t.EventSource=r),this._httpClient=new me(t.httpClient||new de(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose
1=null}start(e){return d(this,null,function*(){if(e=e||S.Binary,_.isIn(e,S,"transferFormat"),this._logger.log(c.Debug,`Starting connection with transfer format '${S[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),yield this._startInternalPromise,this._connectionState==="Disconnecting"){let t="Failed to start the HttpConnection before stop() was called.";return this._logger.log(c.Error,t),yield this._stopPromise,Promise.reject(new x(t))}else if(this._connectionState!=="Connected"){let t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(c.Error,t),Promise.reject(new x(t))}this._connectionStarted=!0})}send(e){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Pe(this.transport)),this._sendQueue.send(e))}stop(e){return d(this,null,function*(){if(this._connectionState==="Disconnected")return this._logger.log(c.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(c.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(t=>{this._stopPromiseResolver=t}),yield this._stopInternal(e),yield this._stopPromise})}_stopInternal(e){return d(this,null,function*(){this._stopError=e;try{yield this._startInternalPromise}catch{}if(this.transport){try{yield this.transport.stop()}catch(t){this._logger.log(c.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(c.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")})}_startInternal(e){return d(this,null,function*(){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===b.WebSockets)this.transport=this._constructTransport(b.WebSockets),yield this._startTransport(t,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let n=null,r=0;do{if(n=yield this._getNegotiationResponse(t),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new x("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&&(t=n.url),n.accessToken){let i=n.accessToken;this._accessTokenFactory=()=>i,this._httpClient._accessToken=i,this._httpClient._accessTokenFactory=void 0}r++}while(n.url&&r<Ge);if(r===Ge&&n.url)throw new Error("Negotiate redirection limit exceeded.");yield this._createTransport(t,this._options.transport,n,e)}this.transport instanceof j&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(c.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(c.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}})}_getNegotiationResponse(e){return d(this,null,function*(){let t={},[n,r]=R();t[n]=r;let i=this._resolveNegotiateUrl(e);this._logger.log(c.Debug,`Sending negotiation request: ${i}.`);try{let s=yield this._httpClient.post(i,{content:"",headers:p(p({},t),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(s.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${s.statusCode}'`));let a=JSON.parse(s.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new X("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(s){let a="Failed to complete negotiation with the server: "+s;return s instanceof E&&s.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(c.Error,a),Promise.reject(new X(a))}})}_createConnectUrl(e,t){return t?e+(e.indexOf("?")===-1?"?":"&")+`id=${t}`:e}_createTransport(e,t,n,r){return d(this,null,function*(){let i=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t)){this._logger.log(c.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,yield this._startTransport(i,r),this.connectionId=n.connectionId;return}let s=[],a=n.availableTransports||[],h=n;for(let l of a){let f=this._resolveTransportOrError(l,t,r,h?.useStatefulReconnect===!0);if(f instanceof Error)s.push(`${l.transport} failed:`),s.push(f);else if(this._isITransport(f)){if(this.transport=f,!h){try{h=yield this._getNegotiationResponse(e)}catch(g){return Promise.reject(g)}i=this._createConnectUrl(e,h.connectionToken)}try{yield this._startTransport(i,r),this.connectionId=h.connectionId;return}catch(g){if(this._logger.log(c.Error,`Failed to start the transport '${l.transport}': ${g}`),h=void 0,s.push(new se(`${l.transport} failed: ${g}`,b[l.transport])),this._connectionState!=="Connecting"){let y="Failed to select transport before stop() was called.";return this._logger.log(c.Debug,y),Promise.reject(new x(y))}}}}return s.length>0?Promise.reject(new ae(`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."))})}
1_constructTransport(e){switch(e){case b.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new ye(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case b.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new ve(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case b.LongPolling:return new j(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=n=>d(this,null,function*(){let r=!1;if(this.features.reconnect)try{this.features.disconnected(),yield this.transport.connect(e,t),yield this.features.resend()}catch{r=!0}else{this._stopConnection(n);return}r&&this._stopConnection(n)}):this.transport.onclose=n=>this._stopConnection(n),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n,r){let i=b[e.transport];if(i==null)return this._logger.log(c.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(bt(t,i))if(e.transferFormats.map(a=>S[a]).indexOf(n)>=0){if(i===b.WebSockets&&!this._options.WebSocket||i===b.ServerSentEvents&&!this._options.EventSource)return this._logger.log(c.Debug,`Skipping transport '${b[i]}' because it is not supported in your environment.'`),new oe(`'${b[i]}' is not supported in your environment.`,i);this._logger.log(c.Debug,`Selecting transport '${b[i]}'.`);try{return this.features.reconnect=i===b.WebSockets?r:void 0,this._constructTransport(i)}catch(a){return a}}else return this._logger.log(c.Debug,`Skipping transport '${b[i]}' because it does not support the requested transfer format '${S[n]}'.`),new Error(`'${b[i]}' does not support ${S[n]}.`);else return this._logger.log(c.Debug,`Skipping transport '${b[i]}' because it was disabled by the client.`),new ie(`'${b[i]}' is disabled by the client.`,i)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(c.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(c.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(c.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(c.Error,`Connection disconnected with error '${e}'.`):this._logger.log(c.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(c.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(e)}catch(t){this._logger.log(c.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!m.isBrowser)throw new Error(`Cannot resolve '${e}'.`);let t=window.document.createElement("a");return t.href=e,this._logger.log(c.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){let t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";let n=new URLSearchParams(t.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?n.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&n.append("useStatefulReconnect","true"),t.search=n.toString(),t.toString()}};function bt(o,e){return!o||(e&o)!==0}var Pe=class o{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new F,this._transportResult=new F,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new F),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}_sendLoop(){return d(this,null,function*(){for(;;){if(yield this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new F;let e=this._transportResult;this._transportResult=void 0;let t=typeof this._buffer[0]=="string"?this._buffer.join(""):o._concatBuffers(this._buffer);this._buffer.length=0;try{yield this._transport.send(t),e.resolve()}catch(n){e.reject(n)}}})}static _concatBuffers(e){let t=e.map(i=>i.byteLength).reduce((i,s)=>i+s),n=new Uint8Array(t),r=0;for(let i of e)n.set(new Uint8Array(i),r),r+=i.byteLength;return n.buffer}},F=class{constructor(){this.promise=new Promise((e,t)=>
1[this._resolver,this._rejecter]=[e,t])}resolve(){this._resolver()}reject(e){this._rejecter(e)}};var xt="json",be=class{constructor(){this.name=xt,this.version=2,this.transferFormat=S.Text}parseMessages(e,t){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];t===null&&(t=I.instance);let n=T.parse(e),r=[];for(let i of n){let s=JSON.parse(i);if(typeof s.type!="number")throw new Error("Invalid payload.");switch(s.type){case u.Invocation:this._isInvocationMessage(s);break;case u.StreamItem:this._isStreamItemMessage(s);break;case u.Completion:this._isCompletionMessage(s);break;case u.Ping:break;case u.Close:break;case u.Ack:this._isAckMessage(s);break;case u.Sequence:this._isSequenceMessage(s);break;default:t.log(c.Information,"Unknown message type '"+s.type+"' ignored.");continue}r.push(s)}return r}writeMessage(e){return T.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),e.invocationId!==void 0&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),e.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if(typeof e!="string"||e==="")throw new Error(t)}};var Ct={trace:c.Trace,debug:c.Debug,info:c.Information,information:c.Information,warn:c.Warning,warning:c.Warning,error:c.Error,critical:c.Critical,none:c.None};function Et(o){let e=Ct[o.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${o}`)}var G=class{configureLogging(e){if(_.isRequired(e,"logging"),It(e))this.logger=e;else if(typeof e=="string"){let t=Et(e);this.logger=new L(t)}else this.logger=new L(e);return this}withUrl(e,t){return _.isRequired(e,"url"),_.isNotEmpty(e,"url"),this.url=e,typeof t=="object"?this.httpConnectionOptions=p(p({},this.httpConnectionOptions),t):this.httpConnectionOptions=U(p({},this.httpConnectionOptions),{transport:t}),this}withHubProtocol(e){return _.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new J(e):this.reconnectPolicy=e:this.reconnectPolicy=new J,this}withServerTimeout(e){return _.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return _.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=e?.bufferSize,this}build(){let e=this.httpConnectionOptions||{};if(e.logger===void 0&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");let t=new Se(this.url,e);return K.create(t,this.logger||I.instance,this.protocol||new be,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}};function It(o){return o.log!==void 0}var $=4294967295;function Ye(o,e,t){var n=t/4294967296,r=t;o.setUint32(e,n),o.setUint32(e+4,r)}function xe(o,e,t){var n=Math.floor(t/4294967296),r=t;o.setUint32(e,n),o.setUint32(e+4,r)}function Ce(o,e){var t=o.getInt32(e),n=o.getUint32(e+4);return t*4294967296+n}function Qe(o,e){var t=o.getUint32(e),n=o.getUint32(e+4);return t*4294967296+n}var Re,$e,Me,Ee=(typeof process>"u"||((Re=process==null?void 0:process.env)===null||Re===void 0?void 0:Re.TEXT_ENCODING)!=="never")&&typeof TextEncoder<"u"&&typeof TextDecoder<"u";function He(o){for(var e=o.length,t=0,n=0;n<e;
vendor: 20,629 bytes, line 1
1){var r=o.charCodeAt(n++);if((r&4294967168)===0){t++;continue}else if((r&4294965248)===0)t+=2;else{if(r>=55296&&r<=56319&&n<e){var i=o.charCodeAt(n);(i&64512)===56320&&(++n,r=((r&1023)<<10)+(i&1023)+65536)}(r&4294901760)===0?t+=3:t+=4}}return t}function Ze(o,e,t){for(var n=o.length,r=t,i=0;i<n;){var s=o.charCodeAt(i++);if((s&4294967168)===0){e[r++]=s;continue}else if((s&4294965248)===0)e[r++]=s>>6&31|192;else{if(s>=55296&&s<=56319&&i<n){var a=o.charCodeAt(i);(a&64512)===56320&&(++i,s=((s&1023)<<10)+(a&1023)+65536)}(s&4294901760)===0?(e[r++]=s>>12&15|224,e[r++]=s>>6&63|128):(e[r++]=s>>18&7|240,e[r++]=s>>12&63|128,e[r++]=s>>6&63|128)}e[r++]=s&63|128}}var Y=Ee?new TextEncoder:void 0,et=Ee?typeof process<"u"&&(($e=process==null?void 0:process.env)===null||$e===void 0?void 0:$e.TEXT_ENCODING)!=="force"?200:0:$;function Tt(o,e,t){e.set(Y.encode(o),t)}function kt(o,e,t){Y.encodeInto(o,e.subarray(t))}var tt=Y?.encodeInto?kt:Tt,Ut=4096;function Ie(o,e,t){for(var n=e,r=n+t,i=[],s="";n<r;){var a=o[n++];if((a&128)===0)i.push(a);else if((a&224)===192){var h=o[n++]&63;i.push((a&31)<<6|h)}else if((a&240)===224){var h=o[n++]&63,l=o[n++]&63;i.push((a&31)<<12|h<<6|l)}else if((a&248)===240){var h=o[n++]&63,l=o[n++]&63,f=o[n++]&63,g=(a&7)<<18|h<<12|l<<6|f;g>65535&&(g-=65536,i.push(g>>>10&1023|55296),g=56320|g&1023),i.push(g)}else i.push(a);i.length>=Ut&&(s+=String.fromCharCode.apply(String,i),i.length=0)}return i.length>0&&(s+=String.fromCharCode.apply(String,i)),s}var Dt=Ee?new TextDecoder:null,nt=Ee?typeof process<"u"&&((Me=process==null?void 0:process.env)===null||Me===void 0?void 0:Me.TEXT_DECODER)!=="force"?200:0:$;function rt(o,e,t){var n=o.subarray(e,e+t);return Dt.decode(n)}var Q=(function(){function o(e,t){this.type=e,this.data=t}return o})();var At=(function(){var o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},o(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");o(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),D=(function(o){At(e,o);function e(t){var n=o.call(this,t)||this,r=Object.create(e.prototype);return Object.setPrototypeOf(n,r),Object.defineProperty(n,"name",{configurable:!0,enumerable:!1,value:e.name}),n}return e})(Error);var Pt=-1,Rt=4294967296-1,$t=17179869184-1;function Mt(o){var e=o.sec,t=o.nsec;if(e>=0&&t>=0&&e<=$t)if(t===0&&e<=Rt){var n=new Uint8Array(4),r=new DataView(n.buffer);return r.setUint32(0,e),n}else{var i=e/4294967296,s=e&4294967295,n=new Uint8Array(8),r=new DataView(n.buffer);return r.setUint32(0,t<<2|i&3),r.setUint32(4,s),n}else{var n=new Uint8Array(12),r=new DataView(n.buffer);return r.setUint32(0,t),xe(r,4,e),n}}function Ht(o){var e=o.getTime(),t=Math.floor(e/1e3),n=(e-t*1e3)*1e6,r=Math.floor(n/1e9);return{sec:t+r,nsec:n-r*1e9}}function Lt(o){if(o instanceof Date){var e=Ht(o);return Mt(e)}else return null}function Nt(o){var e=new DataView(o.buffer,o.byteOffset,o.byteLength);switch(o.byteLength){case 4:{var t=e.getUint32(0),n=0;return{sec:t,nsec:n}}case 8:{var r=e.getUint32(0),i=e.getUint32(4),t=(r&3)*4294967296+i,n=r>>>2;return{sec:t,nsec:n}}case 12:{var t=Ce(e,4),n=e.getUint32(0);return{sec:t,nsec:n}}default:throw new D("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(o.length))}}function Bt(o){var e=Nt(o);return new Date(e.sec*1e3+e.nsec/1e6)}var ot={type:Pt,encode:Lt,decode:Bt};var Te=(function(){function o(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(ot)}return o.prototype.register=function(e){var t=e.type,n=e.encode,r=e.decode;if(t>=0)this.encoders[t]=n,this.decoders[t]=r;else{var i=1+t;this.builtInEncoders[i]=n,this.builtInDecoders[i]=r}},o.prototype.tryToEncode=function(e,t){for(var n=0;n<this.builtInEncoders.length;n++){var r=this.builtInEncoders[n];if(r!=null){var i=r(e,t);if(i!=null){var s=-1-n;return new Q(s,i)}}}for(var n=0;n<this.encoders.length;n++){var r=this.encoders[n];if(r!=null){var i=r(e,t);if(i!=null){var s=n;return new Q(s,i)}}}return e instanceof Q?e:null},o.prototype.decode=function(e,t,n){var r=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return r?r(e,t,n):new Q(t,e)},o.defaultCodec=new o,o})();function q(o){return o instanceof Uint8Array?o:ArrayBuffer.isView(o)?new Uint8Array(o.buffer,o.byteOffset,o.byteLength):o instanceof ArrayBuffer?new Uint8Array(o):Uint8Array.from(o)}function it(o){if(o instanceof ArrayBuffer)return new DataView(o);var e=q(o);return new DataView(e.buffer,e.byteOffset,e.byteLength)}var Wt=100,Ot=2048,Le=(function(){function o(e,t,n,r,i,s,a,h){e===void 0&&(e=Te.defaultCodec),t===void 0&&(t=void 0),n===void 0&&(n=Wt),r===void 0&&(r=Ot),i===void 0&&(i=!1),s===void 0&&(s=!1),a===void 0&&(a=!1),h===void 0&&(h=!1),this.extensionCodec=e,this.context=t,this.maxDepth=n,this.initialBufferSize=r,this.sortKeys=i,this.forceFloat32=s,this.ignoreUndefined=a,this.forceIntegerToFloat=h,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}return o.prototype.reinitializeState=function(){this.pos=0},o.prototype.encodeSharedRef=function(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)},o.prototype.encode=function(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)},o.prototype.doEncode=function(e,t){if(t>this.maxDepth)throw new Error("Too deep objects in depth ".concat(t));e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.encodeObject(e,t)},o.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength<t&&this.resizeBuffer(t*2)},o.prototype.resizeBuffer=function(e){var t=new ArrayBuffer(e),n=new Uint8Array(t),r=new DataView(t);n.set(this.bytes),this.view=r,this.bytes=n},o.prototype.encodeNil=function(){this.writeU8(192)},o.prototype.encodeBoolean=function(e){e===!1?this.writeU8(194):this.writeU8(195)},o.prototype.encodeNumber=function(e){Number.isSafeInteger(e)&&!this.forceIntegerToFloat?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},o.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error("Too long string: ".concat(e," bytes in UTF-8"))},o.prototype.encodeString=function(e){var t=5,n=e.length;if(n>et){var r=He(e);this.ensureBufferSizeToWrite(t+r),this.writeStringHeader(r),tt(e,this.bytes,this.pos),this.pos+=r}else{var r=He(e);this.ensureBufferSizeToWrite(t+r),this.writeStringHeader(r),Ze(e,this.bytes,this.pos),this.pos+=r}},o.prototype.encodeObject=function(e,t){var n=this.extensionCodec.tryToEncode(e,this.context);if(n!=null)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,t);else throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)))},o.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else if(t<4294967296)this.writeU8(198),this.writeU32(t);else throw new Error("Too large binary: ".concat(t));var n=q(e);this.writeU8a(n)},o.prototype.encodeArray=function(e,t){var n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else if(n<4294967296)this.writeU8(221),this.writeU32(n);else throw new Error("Too large array: ".concat(n));for(var r=0,i=e;r<i.length;r++){var s=i[r];this.doEncode(s,t+1)}},o.prototype.countWithoutUndefined=function(e,t){for(var n=0,r=0,i=t;r<i.length;r++){var s=i[r];e[s]!==void 0&&n++}return n},o.prototype.encodeMap=function(e,t){var n=Object.keys(e);this.sortKeys&&n.sort();var r=this.ignoreUndefined?this.countWithoutUndefined(e,n):n.length;if(r<16)this.writeU8(128+r);else if(r<65536)this.writeU8(222),this.writeU16(r);else if(r<4294967296)this.writeU8(223),this.writeU32(r);else throw new Error("Too large map object: ".concat(r));for(var i=0,s=n;i<s.length;i++){var a=s[i],h=e[a];this.ignoreUndefined&&h===void 0||(this.encodeString(a),this.doEncode(h,t+1))}},o.prototype.encodeExtension=function(e){var t=e.data.length;if(t===1)this.writeU8(212);else if(t===2)this.writeU8(213);else if(t===4)this.writeU8(214);else if(t===8)this.writeU8(215);else if(t===16)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else if(t<4294967296)this.writeU8(201),this.writeU32(t);else throw new Error("Too large extension object: ".concat(t));this.writeI8(e.type),this.writeU8a(e.data)},o.prototype.writeU8=function(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++},o.prototype.writeU8a=function(e){var t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t},o.prototype.writeI8=function(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++},o.prototype.writeU16=function(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2},o.prototype.writeI16=function(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2},o.prototype.writeU32=function(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4},o.prototype.writeI32=function(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4},o.prototype.writeF32=function(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4},o.prototype.writeF64=function(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8},o.prototype.writeU64=function(e){this.ensureBufferSizeToWrite(8),Ye(this.view,this.pos,e),this.pos+=8},o.prototype.writeI64=function(e){this.ensureBufferSizeToWrite(8),xe(this.view,this.pos,e),this.pos+=8},o})();function ke(o){return"".concat(o<0?"-":"","0x").concat(Math.abs(o).toString(16).padStart(2,"0"))}var zt=16,Ft=16,st=(function(){function o(e,t){e===void 0&&(e=zt),t===void 0&&(t=Ft),this.maxKeyLength=e,this.maxLengthPerKey=t,this.hit=0,this.miss=0,this.caches=[];for(var n=0;n<this.maxKeyLength;n++)this.caches.push([])}return o.prototype.canBeCached=function(e){return e>0&&e<=this.maxKeyLength},o.prototype.find=function(e,t,n){var r=this.caches[n-1];e:for(var i=0,s=r;i<s.length;i++){for(var a=s[i],h=a.bytes,l=0;l<n;l++)if(h[l]!==e[t+l])continue e;return a.str}return null},o.prototype.store=function(e,t){var n=this.caches[e.length-1],r={bytes:e,str:t};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=r:n.push(r)},o.prototype.decode=function(e,t,n){var r=this.find(e,t,n);if(r!=null)return this.hit++,r;this.miss++;var i=Ie(e,t,n),s=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(s,i),i},o})();var qt=function(o,e,t,n){function r(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function a(f){try{l(n.next(f))}catch(g){s(g)}}function h(f){try{l(n.throw(f))}catch(g){s(g)}}function l(f){f.done?i(f.value):r(f.value).then(a,h)}l((n=n.apply(o,e||[])).next())})},Ne=function(o,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,r,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(f){return h([l,f])}}function h(l){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,r&&(i=l[0]&2?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,r=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){t.label=l[1];break}if(l[0]===6&&t.label<i[1]){t.label=i[1],i=l;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(l);break}i[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(o,t)}catch(f){l=[6,f],r=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},at=function(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=o[Symbol.asyncIterator],t;return e?e.call(o):(o=typeof __values=="function"?__values(o):o[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=o[i]&&function(s){return new Promise(function(a,h){s=o[i](s),r(a,h,s.done,s.value)})}}function r(i,s,a,h){Promise.resolve(h).then(function(l){i({value:l,done:a})},s)}},V=function(o){return this instanceof V?(this.v=o,this):new V(o)},Vt=function(o,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(o,e||[]),r,i=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(y){n[y]&&(r[y]=function(w){return new Promise(function(C,te){i.push([y,w,C,te])>1||a(y,w)})})}function a(y,w){try{h(n[y](w))}catch(C){g(i[0][3],C)}}function h(y){y.value instanceof V?Promise.resolve(y.value.v).then(l,f):g(i[0][2],y)}function l(y){a("next",y)}function f(y){a("throw",y)}function g(y,w){y(w),i.shift(),i.length&&a(i[0][0],i[0][1])}},Xt=function(o){var e=typeof o;return e==="string"||e==="number"},Z=-1,Be=new DataView(new ArrayBuffer(0)),Kt=new Uint8Array(Be.buffer),Ue=(function(){try{Be.getInt8(0)}catch(o){return o.constructor}throw new Error("never reached")})(),ct=new Ue("Insufficient data"),Jt=new st,We=(function(){function o(e,t,n,r,i,s,a,h){e===void 0&&(e=Te.defaultCodec),t===void 0&&(t=void 0),n===void 0&&(n=$),r===void 0&&(r=$),i===void 0&&(i=$),s===void 0&&(s=$),a===void 0&&(a=$),h===void 0&&(h=Jt),this.extensionCodec=e,this.context=t,this.maxStrLength=n,this.maxBinLength=r,this.maxArrayLength=i,this.maxMapLength=s,this.maxExtLength=a,this.keyDecoder=h,this.totalPos=0,this.pos=0,this.view=Be,this.bytes=Kt,this.headByte=Z,this.stack=[]}return o.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=Z,this.stack.length=0},o.prototype.setBuffer=function(e){this.bytes=q(e),this.view=it(this.bytes),this.pos=0},o.prototype.appendBuffer=function(e){if(this.headByte===Z&&!this.hasRemaining(1))this.setBuffer(e);else{var t=this.bytes.subarray(this.pos),n=q(e),r=new Uint8Array(t.length+n.length);r.set(t),r.set(n,t.length),this.setBuffer(r)}},o.prototype.hasRemaining=function(e){return this.view.byteLength-this.pos>=e},o.prototype.createExtraByteError=function(e){var t=this,n=t.view,r=t.pos;return new RangeError("Extra ".concat(n.byteLength-r," of ").concat(n.byteLength," byte(s) found at buffer[").concat(e,"]"))},o.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},o.prototype.decodeMulti=function(e){return Ne(this,function(t){switch(t.label){case 0:this.reinitializeState(),this.setBuffer(e),t.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}})},o.prototype.decodeAsync=function(e){var t,n,r,i;return qt(this,void 0,void 0,function(){var s,a,h,l,f,g,y,w;return Ne(this,function(C){switch(C.label){case 0:s=!1,C.label=1;case 1:C.trys.push([1,6,7,12]),t=at(e),C.label=2;case 2:return[4,t.next()];case 3:if(n=C.sent(),!!n.done)return[3,5];if(h=n.value,s)throw this.createExtraByteError(this.totalPos);this.appendBuffer(h);try{a=this.doDecodeSync(),s=!0}catch(te){if(!(te instanceof Ue))throw te}this.totalPos+=this.pos,C.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return l=C.sent(),r={error:l},[3,12];case 7:return C.trys.push([7,,10,11]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,9];case 8:C.sent(),C.label=9;case 9:return[3,11];case 10:if(r)throw r.error;return[7];case 11:return[7];case 12:if(s){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,a]}throw f=this,g=f.headByte,y=f.pos,w=f.totalPos,new RangeError("Insufficient data in parsing ".concat(ke(g)," at ").concat(w," (").concat(y," in the current buffer)"))}})})},o.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},o.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},o.prototype.decodeMultiAsync=function(e,t){return Vt(this,arguments,function(){var r,i,s,a,h,l,f,g,y;return Ne(this,function(w){switch(w.label){case 0:r=t,i=-1,w.label=1;case 1:w.trys.push([1,13,14,19]),s=at(e),w.label=2;case 2:return[4,V(s.next())];case 3:if(a=w.sent(),!!a.done)return[3,12];if(h=a.value,t&&i===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(h),r&&(i=this.readArraySize(),r=!1,this.complete()),w.label=4;case 4:w.trys.push([4,9,,10]),w.label=5;case 5:return[4,V(this.doDecodeSync())];case 6:return[4,w.sent()];case 7:return w.sent(),--i===0?[3,8]:[3,5];case 8:return[3,10];case 9:if(l=w.sent(),!(l instanceof Ue))throw l;return[3,10];case 10:this.totalPos+=this.pos,w.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return f=w.sent(),g={error:f},[3,19];case 14:return w.trys.push([14,,17,18]),a&&!a.done&&(y=s.return)?[4,V(y.call(s))]:[3,16];case 15:w.sent(),w.label=16;case 16:return[3,18];case 17:if(g)throw g.error;return[7];case 18:return[7];case 19:return[2]}})})},o.prototype.doDecodeSync=function(){e:for(;;){var e=this.readHeadByte(),t=void 0;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){var n=e-128;if(n!==0){this.pushMapState(n),this.complete();continue e}else t={}}else if(e<160){var n=e-144;if(n!==0){this.pushArrayState(n),this.complete();continue e}else t=[]}else{var r=e-160;t=this.decodeUtf8String(r,0)}else if(e===192)t=null;else if(e===194)t=!1;else if(e===195)t=!0;else if(e===202)t=this.readF32();else if(e===203)t=this.readF64();else if(e===204)t=this.readU8();else if(e===205)t=this.readU16();else if(e===206)t=this.readU32();else if(e===207)t=this.readU64();else if(e===208)t=this.readI8();else if(e===209)t=this.readI16();else if(e===210)t=this.readI32();else if(e===211)t=this.readI64();else if(e===217){var r=this.lookU8();t=this.decodeUtf8String(r,1)}else if(e===218){var r=this.lookU16();t=this.decodeUtf8String(r,2)}else if(e===219){var r=this.lookU32();t=this.decodeUtf8String(r,4)}else if(e===220){var n=this.readU16();if(n!==0){this.pushArrayState(n),this.complete();continue e}else t=[]}else if(e===221){var n=this.readU32();if(n!==0){this.pushArrayState(n),this.complete();continue e}else t=[]}else if(e===222){var n=this.readU16();if(n!==0){this.pushMapState(n),this.complete();continue e}else t={}}else if(e===223){var n=this.readU32();if(n!==0){this.pushMapState(n),this.complete();continue e}else t={}}else if(e===196){var n=this.lookU8();t=this.decodeBinary(n,1)}else if(e===197){var n=this.lookU16();t=this.decodeBinary(n,2)}else if(e===198){var n=this.lookU32();t=this.decodeBinary(n,4)}else if(e===212)t=this.decodeExtension(1,0);else if(e===213)t=this.decodeExtension(2,0);else if(e===214)t=this.decodeExtension(4,0);else if(e===215)t=this.decodeExtension(8,0);else if(e===216)t=this.decodeExtension(16,0);else if(e===199){var n=this.lookU8();t=this.decodeExtension(n,1)}else if(e===200){var n=this.lookU16();t=this.decodeExtension(n,2)}else if(e===201){var n=this.lookU32();t=this.decodeExtension(n,4)}else throw new D("Unrecognized type byte: ".concat(ke(e)));this.complete();for(var i=this.stack;i.length>0;){var s=i[i.length-1];if(s.type===0)if(s.array[s.position]=t,s.position++,s.position===s.size)i.pop(),t=s.array;else continue e;else if(s.type===1){if(!Xt(t))throw new D("The type of key must be string or number but "+typeof t);if(t==="__proto__")throw new D("The key __proto__ is not allowed");s.key=t,s.type=2;continue e}else if(s.map[s.key]=t,s.readCount++,s.readCount===s.size)i.pop(),t=s.map;else{s.key=null,s.type=1;continue e}}return t}}
1,o.prototype.readHeadByte=function(){return this.headByte===Z&&(this.headByte=this.readU8()),this.headByte},o.prototype.complete=function(){this.headByte=Z},o.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new D("Unrecognized array type byte: ".concat(ke(e)))}}},o.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new D("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},o.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new D("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:0,size:e,array:new Array(e),position:0})},o.prototype.decodeUtf8String=function(e,t){var n;if(e>this.maxStrLength)throw new D("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLength<this.pos+t+e)throw ct;var r=this.pos+t,i;return this.stateIsMapKey()&&(!((n=this.keyDecoder)===null||n===void 0)&&n.canBeCached(e))?i=this.keyDecoder.decode(this.bytes,r,e):e>nt?i=rt(this.bytes,r,e):i=Ie(this.bytes,r,e),this.pos+=t+e,i},o.prototype.stateIsMapKey=function(){if(this.stack.length>0){var e=this.stack[this.stack.length-1];return e.type===1}return!1},o.prototype.decodeBinary=function(e,t){if(e>this.maxBinLength)throw new D("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw ct;var n=this.pos+t,r=this.bytes.subarray(n,n+e);return this.pos+=t+e,r},o.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new D("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var n=this.view.getInt8(this.pos+t),r=this.decodeBinary(e,t+1);return this.extensionCodec.decode(r,n,this.context)},o.prototype.lookU8=function(){return this.view.getUint8(this.pos)},o.prototype.lookU16=function(){return this.view.getUint16(this.pos)},o.prototype.lookU32=function(){return this.view.getUint32(this.pos)},o.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},o.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},o.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},o.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},o.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},o.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},o.prototype.readU64=function(){var e=Qe(this.view,this.pos);return this.pos+=8,e},o.prototype.readI64=function(){var e=Ce(this.view,this.pos);return this.pos+=8,e},o.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},o.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},o})();var k=class{static write(e){let t=e.byteLength||e.length,n=[];do{let i=t&127;t=t>>7,t>0&&(i|=128),n.push(i)}while(t>0);t=e.byteLength||e.length;let r=new Uint8Array(n.length+t);return r.set(n,0),r.set(e,n.length),r.buffer}static parse(e){let t=[],n=new Uint8Array(e),r=5,i=[0,7,14,21,28];for(let s=0;s<e.byteLength;){let a=0,h=0,l;do l=n[s+a],h=h|(l&127)<<i[a],a++;while(a<Math.min(r,e.byteLength-s)&&(l&128)!==0);if((l&128)!==0&&a<r)throw new Error("Cannot read message size.");if(a===r&&l>7)throw new Error("Messages bigger than 2GB are not supported.");if(n.byteLength>=s+a+h)t.push(n.slice?n.slice(s+a,s+a+h):n.subarray(s+a,s+a+h));else throw new Error("Incomplete message.");s=s+a+h}return t}};function ht(o){return o&&typeof ArrayBuffer<"u"&&(o instanceof ArrayBuffer||o.constructor&&o.constructor.name==="ArrayBuffer")}var jt=new Uint8Array([145,u.Ping]),ee=class{constructor(e){this.name="messagepack",this.version=2,this.transferFormat=S.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new Le(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new We(e.extensionCodec,e.context,e.maxStrLength,e.maxBinLength,e.maxArrayLength,e.maxMapLength,e.maxExtLength)}parseMessages(e,t){if(!ht(e))throw new Error("Invalid input for MessagePack hub protocol. Expected an ArrayBuffer.");t===null&&(t=I.instance);let n=k.parse(e),r=[];for(let i of n){let s=this._parseMessage(i,t);s&&r.push(s)}return r}writeMessage(e){switch(e.type){case u.Invocation:return this._writeInvocation(e);case u.StreamInvocation:return this._writeStreamInvocation(e);case u.StreamItem:return this._writeStreamItem(e);case u.Completion:return this._writeCompletion(e);case u.Ping:return k.write(jt);case u.CancelInvocation:return this._writeCancelInvocation(e);case u.Close:return this._writeClose();case u.Ack:return this._writeAck(e);case u.Sequence:return this._writeSequence(e);default:throw new Error("Invalid message type.")}}_parseMessage(e,t){if(e.length===0)throw new Error("Invalid payload.");let n=this._decoder.decode(e);if(n.length===0||!(n instanceof Array))throw new Error("Invalid payload.");let r=n[0];switch(r){case u.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case u.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case u.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case u.Ping:return this._createPingMessage(n);case u.Close:return this._createCloseMessage(n);case u.Ack:return this._createAckMessage(n);case u.Sequence:return this._createSequenceMessage(n);default:return t.log(c.Information,"Unknown message type '"+r+"' ignored."),null}}_createCloseMessage(e){if(e.length<2)throw new Error("Invalid payload for Close message.");return{allowReconnect:e.length>=3?e[2]:void 0,error:e[1],type:u.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:u.Ping}}_createInvocationMessage(e,t){if(t.length<5)throw new Error("Invalid payload for Invocation message.");let n=t[2];return n?{arguments:t[4],headers:e,invocationId:n,streamIds:[],target:t[3],type:u.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:u.Invocation}}_createStreamItemMessage(e,t){if(t.length<4)throw new Error("Invalid payload for StreamItem message.");return{headers:e,invocationId:t[2],item:t[3],type:u.StreamItem}}_createCompletionMessage(e,t){if(t.length<4)throw new Error("Invalid payload for Completion message.");let n=t[3];if(n!==this._voidResult&&t.length<5)throw new Error("Invalid payload for Completion message.");let r,i;switch(n){case this._errorResult:r=t[4];break;case this._nonVoidResult:i=t[4];break}return{error:r,headers:e,invocationId:t[2],result:i,type:u.Completion}}_createAckMessage(e){if(e.length<1)throw new Error("Invalid payload for Ack message.");return{sequenceId:e[1],type:u.Ack}}_createSequenceMessage(e){if(e.length<1)throw new Error("Invalid payload for Sequence message.");return{sequenceId:e[1],type:u.Sequence}}_writeInvocation(e){let t;return e.streamIds?t=this._encoder.encode([u.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):t=this._encoder.encode([u.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),k.write(t.slice())}_writeStreamInvocation(e){let t;return e.streamIds?t=this._encoder.encode([u.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):t=this._encoder.encode([u.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),k.write(t.slice())}_writeStreamItem(e){let t=this._encoder.encode([u.StreamItem,e.headers||{},e.invocationId,e.item]);return k.write(t.slice())}_writeCompletion(e){let t=e.error?this._errorResult:e.result!==void 0?this._nonVoidResult:this._voidResult,n;switch(t){case this._errorResult:n=this._encoder.encode([u.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([u.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([u.Completion,e.headers||{},e.invocationId,t,e.result]);break}return k.write(n.slice())}_writeCancelInvocation(e){let t=this._encoder.encode([u.CancelInvocation,e.headers||{},e.invocationId]);return k.write(t.slice())}_writeClose(){let e=this._encoder.encode([u.Close,null]);return k.write(e.slice())}_writeAck(e){let t=this._encoder.encode([u.Ack,e.sequenceId]);return k.write(t.slice())}_writeSequence(e){let t=this._encoder.encode([u.Sequence,e.sequenceId]);return k.write(t.slice())}_readHeaders(e){let t=e[1];if(typeof t!="object")throw new Error("Invalid headers.");return t}};var Jo=(()=>{let e=class e{constructor(n,r,i,s,a){this.authService=n,this.translateService=r,this.notif=i,this.progressImportSalariesService=s,this.salariePhotoCacheService=a,this.notificationSubject=ne
1w W(null),this.imagesUploadeesSuccessSubject=new W(null),this.connectionEstablished=new Oe,this.startConnectionTimeoutDelay=3e3,this.protocol=new ee,this.autoReconnect=!0,this._connectionIsEstablished=!1,this.token=null,this.notificationQrCodePhotoUnitaireSubject=new W(null),this.initSignalR()}reinitImagesUploadeesSuccess(){this.imagesUploadeesSuccessSubject.next(!1)}initSignalR(){this.tokenSubscription&&this.tokenSubscription.unsubscribe(),this._hubConnection=null,this.tokenSubscription=this.authService.getTokenSubjectObs().subscribe(n=>{this.token=n,this.createConnection()})}ngOnDestroy(){this.tokenSubscription&&this.tokenSubscription.unsubscribe()}createConnection(){if(!this.token&&this._hubConnection){this._hubConnection.stop();return}if(this.token&&!this._hubConnection){let n=new G;re.settings.signalRSkipNegotiation==="1"?n.withUrl(re.settings.signalRUrl,{skipNegotiation:!0,transport:b.WebSockets,accessTokenFactory:()=>this.token}):n.withUrl(re.settings.signalRUrl,{accessTokenFactory:()=>this.token}),n.withHubProtocol(this.protocol),n.configureLogging(c.Information),this.autoReconnect&&n.withAutomaticReconnect([0,1e3,1e3,1e3,1e3,1e3,2e3,5e3,1e4,2e4,3e4,null]),this._hubConnection=n.build(),this.hubConnection.onclose(()=>{this.startConnection()}),this.hubConnection.onreconnected(()=>{this.hubConnection.invoke("association")}),this.hubConnection.on("notifications",r=>{r&&(r.timeout=0,r.showCloseButton=!0,this.notificationSubject.next(r))}),this.hubConnection.on("progressImportSalaries",r=>{r&&this.progressImportSalariesService.handleNotification(r)}),this.hubConnection.on("imageUploadee",r=>{if(r){let i=JSON.parse(r);this.notificationQrCodePhotoUnitaireSubject.next(i)}}),this.hubConnection.on("imagesUploadees",r=>{if(r){let i=JSON.parse(r);if(i.nbPhotos!=i.nbAdded+i.nbUpdated){let s=i.nbPhotos-i.nbAdded-i.nbUpdated;this.notif.setNotification({type:De.Error,title:this.translateService.instant("salaries.importer_photos_depuis_app_resultat_echec",{nb:s})});return}if(this.imagesUploadeesSuccessSubject.next(!0),i.nbPhotos>0){let s="";i.nbAdded>0&&(s+=this.translateService.instant("salaries.importer_photos_depuis_app_resultat_creation",{nb:i.nbAdded})),i.nbUpdated>0&&(this.salariePhotoCacheService.clearCache(),i.nbAdded>0&&(s+="<br/>"),s+=this.translateService.instant("salaries.importer_photos_depuis_app_resultat_modif",{nb:i.nbUpdated}),i.nbUpdatedOtherContext>0&&(s+=this.translateService.instant("salaries.importer_photos_depuis_app_resultat_modif_autre_contexte",{nb:i.nbUpdatedOtherContext}))),this.notif.setNotification({type:De.Success,title:this.translateService.instant("salaries.importer_photos_depuis_app_succes"),message:s})}}}),this.startConnection()}}startConnection(){this._hubConnection.state===v.Disconnected&&this._hubConnection.start().then(()=>{this._connectionIsEstablished=!0,this.connectionEstablished.emit(!0),this.hubConnection.invoke("association")}).catch(()=>{this._connectionIsEstablished=!1,setTimeout(()=>{this.startConnection()},this.startConnectionTimeoutDelay)})}getNotificationsSubjectObs(){return this.notificationSubject.asObservable()}getimagesUploadeesSuccessSubjectObs(){return this.imagesUploadeesSuccessSubject.asObservable()}get connectionIsEstablished(){return this._connectionIsEstablished}get hubConnection(){return this._hubConnection}getQrCodePhotoUnitaireSubjectObs(){return this.notificationQrCodePhotoUnitaireSubject.asObservable()}};e.\u0275fac=function(r){return new(r||e)(O(qe),O(ze),O(Fe),O(Xe),O(Ve))},e.\u0275prov=ne({token:e,factory:e.\u0275fac,providedIn:"root"});let o=e;return o})();export{Xe as a,Jo as b};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.