ed8ac34542
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m46s
V018 had PostgreSQL quote escaping issues with long content strings. V019 uses 1256 quoting to avoid escaping problems and cleanly inserts all 12 blog posts (5 updates + 7 new) with middle-school level language. Deletes V018, commits V019 as replacement.
3 lines
161 KiB
JavaScript
3 lines
161 KiB
JavaScript
!function(){"use strict";var e,t,n;!function(e){const t=[],n="__jsObjectId",r="__dotNetObject",o="__byte[]",i="__dotNetStream",s="__jsStreamReferenceLength";let a,c,l;class h{constructor(e){this._jsObject=e,this._cachedHandlers=new Map}resolveInvocationHandler(e,t){var n;const r=null===(n=this._cachedHandlers.get(e))||void 0===n?void 0:n[t];if(r)return r;const[o,i]=E(this._jsObject,e),s=function(e,t,n,r){switch(n){case l.FunctionCall:const n=e[t];if(n instanceof Function)return n.bind(e);throw new Error(`The value '${r}' is not a function.`);case l.ConstructorCall:const o=e[t];if(o instanceof Function){const t=o.bind(e);return(...e)=>new t(...e)}throw new Error(`The value '${r}' is not a function.`);case l.GetValue:if(!function(e,t){if(!(t in e))return!1;for(;void 0!==e;){const n=Object.getOwnPropertyDescriptor(e,t);if(n)return!!n.hasOwnProperty("value")||n.hasOwnProperty("get")&&"function"==typeof n.get;e=Object.getPrototypeOf(e)}return!1}(e,t))throw new Error(`The property '${r}' is not defined or is not readable.`);return()=>e[t];case l.SetValue:if(!function(e,t){if(!(t in e))return Object.isExtensible(e);for(;void 0!==e;){const n=Object.getOwnPropertyDescriptor(e,t);if(n)return!(!n.hasOwnProperty("value")||!n.writable)||n.hasOwnProperty("set")&&"function"==typeof n.set;e=Object.getPrototypeOf(e)}return!1}(e,t))throw new Error(`The property '${r}' is not writable.`);return(...n)=>e[t]=n[0]}}(o,i,t,e);return this.addHandlerToCache(e,s,t),s}getWrappedObject(){return this._jsObject}addHandlerToCache(e,t,n){const r=this._cachedHandlers.get(e);r?r[n]=t:this._cachedHandlers.set(e,{[n]:t})}}!function(e){e[e.FunctionCall=1]="FunctionCall",e[e.ConstructorCall=2]="ConstructorCall",e[e.GetValue=3]="GetValue",e[e.SetValue=4]="SetValue"}(l=e.JSCallType||(e.JSCallType={}));const u=0,d={[u]:new h(window)};d[0]._cachedHandlers.set("import",{[l.FunctionCall]:e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substring(2),document.baseURI).toString()),import(e))});let p,f=1;function g(e){t.push(e)}function m(e){if(null==e)return{[n]:-1};if(e&&("object"==typeof e||e instanceof Function)){d[f]=new h(e);const t={[n]:f};return f++,t}throw new Error(`Cannot create a JSObjectReference from the value '${e}'.`)}function y(e){let t=-1;if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Blob)t=e.size;else{if(!(e.buffer instanceof ArrayBuffer))throw new Error("Supplied value is not a typed array or blob.");if(void 0===e.byteLength)throw new Error(`Cannot create a JSStreamReference from the value '${e}' as it doesn't have a byteLength.`);t=e.byteLength}const r={[s]:t};try{const t=m(e);r[n]=t[n]}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return r}function v(e,n){c=e;const r=n?JSON.parse(n,((e,n)=>t.reduce(((t,n)=>n(e,t)),n))):null;return c=void 0,r}function _(){if(void 0===a)throw new Error("No call dispatcher has been set.");if(null===a)throw new Error("There are multiple .NET runtimes present, so a default dispatcher could not be resolved. Use DotNetObject to invoke .NET instance methods.");return a}e.attachDispatcher=function(e){const t=new w(e);return void 0===a?a=t:a&&(a=null),t},e.attachReviver=g,e.invokeMethod=function(e,t,...n){return _().invokeDotNetStaticMethod(e,t,...n)},e.invokeMethodAsync=function(e,t,...n){return _().invokeDotNetStaticMethodAsync(e,t,...n)},e.createJSObjectReference=m,e.createJSStreamReference=y,e.disposeJSObjectReference=function(e){const t=e&&e[n];"number"==typeof t&&-1!==t&&C(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(p=e.JSCallResultType||(e.JSCallResultType={}));class w{constructor(e){this._dotNetCallDispatcher=e,this._byteArraysToBeRevived=new Map,this._pendingDotNetToJSStreams=new Map,this._pendingAsyncCalls={},this._nextAsyncCallId=1}getDotNetCallDispatcher(){return this._dotNetCallDispatcher}invokeJSFromDotNet(e,t,n,r,o){const i=R(this.processJSCall(r,e,o,t),n);return null==i?null:x(this,i)}async beginInvokeJSFromDotNet(e,t,n,r,o,i){try{const s=this.processJSCall(o,t,i,n);if(e){const t=x(this,[e,!0,R(await s,r)]);this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!0,t)}}catch(t){if(e){const n=JSON.stringify([e,!1,b(t)]);this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!1,n)}}}processJSCall(e,t,n,r){var o;const i=null!==(o=v(this,r))&&void 0!==o?o:[];return S(t,e,n)(...i)}endInvokeDotNetFromJS(e,t,n){const r=t?v(this,n):new Error(n);this.completePendingCall(parseInt(e,10),t,r)}invokeDotNetStaticMethod(e,t,...n){return this.invokeDotNetMethod(e,t,null,n)}invokeDotNetStaticMethodAsync(e,t,...n){return this.invokeDotNetMethodAsync(e,t,null,n)}invokeDotNetMethod(e,t,n,r){if(this._dotNetCallDispatcher.invokeDotNetFromJS){const o=x(this,r),i=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,o);return i?v(this,i):null}throw new Error("The current dispatcher does not support synchronous calls from JS to .NET. Use invokeDotNetMethodAsync instead.")}invokeDotNetMethodAsync(e,t,n,r){if(e&&n)throw new Error(`For instance method calls, assemblyName should be null. Received '${e}'.`);const o=this._nextAsyncCallId++,i=new Promise(((e,t)=>{this._pendingAsyncCalls[o]={resolve:e,reject:t}}));try{const i=x(this,r);this._dotNetCallDispatcher.beginInvokeDotNetFromJS(o,e,t,n,i)}catch(e){this.completePendingCall(o,!1,e)}return i}receiveByteArray(e,t){this._byteArraysToBeRevived.set(e,t)}processByteArray(e){const t=this._byteArraysToBeRevived.get(e);return t?(this._byteArraysToBeRevived.delete(e),t):null}supplyDotNetStream(e,t){if(this._pendingDotNetToJSStreams.has(e)){const n=this._pendingDotNetToJSStreams.get(e);this._pendingDotNetToJSStreams.delete(e),n.resolve(t)}else{const n=new T;n.resolve(t),this._pendingDotNetToJSStreams.set(e,n)}}getDotNetStreamPromise(e){let t;if(this._pendingDotNetToJSStreams.has(e))t=this._pendingDotNetToJSStreams.get(e).streamPromise,this._pendingDotNetToJSStreams.delete(e);else{const n=new T;this._pendingDotNetToJSStreams.set(e,n),t=n.streamPromise}return t}completePendingCall(e,t,n){if(!this._pendingAsyncCalls.hasOwnProperty(e))throw new Error(`There is no pending async call with ID ${e}.`);const r=this._pendingAsyncCalls[e];delete this._pendingAsyncCalls[e],t?r.resolve(n):r.reject(n)}}function b(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function S(e,t,n){const r=d[t];if(r)return r.resolveInvocationHandler(e,null!=n?n:l.FunctionCall);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function C(e){delete d[e]}function E(e,t){const n=t.split(".");let r=e;for(let e=0;e<n.length-1;e++){const o=n[e];if(!r||"object"!=typeof r||!(o in r))throw new Error(`Could not find '${t}' ('${o}' was undefined).`);r=r[o]}return[r,n[n.length-1]]}e.findJSFunction=S,e.disposeJSObjectReferenceById=C,e.findObjectMember=E;class I{constructor(e,t){this._id=e,this._callDispatcher=t}invokeMethod(e,...t){return this._callDispatcher.invokeDotNetMethod(null,e,this._id,t)}invokeMethodAsync(e,...t){return this._callDispatcher.invokeDotNetMethodAsync(null,e,this._id,t)}dispose(){this._callDispatcher.invokeDotNetMethodAsync(null,"__Dispose",this._id,null).catch((e=>console.error(e)))}serializeAsArg(){return{[r]:this._id}}}e.DotNetObject=I,g((function(e,t){if(t&&"object"==typeof t){if(t.hasOwnProperty(r))return new I(t[r],c);if(t.hasOwnProperty(n)){const e=t[n],r=d[e];if(r)return r.getWrappedObject();throw new Error(`JS object instance with Id '${e}' does not exist. It may have been disposed.`)}if(t.hasOwnProperty(o)){const e=t[o],n=c.processByteArray(e);if(void 0===n)throw new Error(`Byte array index '${e}' does not exist.`);return n}if(t.hasOwnProperty(i)){const e=t[i],n=c.getDotNetStreamPromise(e);return new k(n)}}return t}));class k{constructor(e){this._streamPromise=e}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class T{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function R(e,t){switch(t){case p.Default:return e;case p.JSObjectReference:return m(e);case p.JSStreamReference:return y(e);case p.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let D=0;function x(e,t){D=0,c=e;const n=JSON.stringify(t,A);return c=void 0,n}function A(e,t){if(t instanceof I)return t.serializeAsArg();if(t instanceof Uint8Array){c.getDotNetCallDispatcher().sendByteArray(D,t);const e={[o]:D};return D++,e}return t}}(e||(e={})),function(e){e[e.prependFrame=1]="prependFrame",e[e.removeFrame=2]="removeFrame",e[e.setAttribute=3]="setAttribute",e[e.removeAttribute=4]="removeAttribute",e[e.updateText=5]="updateText",e[e.stepIn=6]="stepIn",e[e.stepOut=7]="stepOut",e[e.updateMarkup=8]="updateMarkup",e[e.permutationListEntry=9]="permutationListEntry",e[e.permutationListEnd=10]="permutationListEnd"}(t||(t={})),function(e){e[e.element=1]="element",e[e.text=2]="text",e[e.attribute=3]="attribute",e[e.component=4]="component",e[e.region=5]="region",e[e.elementReferenceCapture=6]="elementReferenceCapture",e[e.markup=8]="markup",e[e.namedEvent=10]="namedEvent"}(n||(n={}));class r{constructor(e,t){this.componentId=e,this.fieldValue=t}static fromEvent(e,t){const n=t.target;if(n instanceof Element){const t=function(e){return e instanceof HTMLInputElement?e.type&&"checkbox"===e.type.toLowerCase()?{value:e.checked}:{value:e.value}:e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement?{value:e.value}:null}(n);if(t)return new r(e,t.value)}return null}}const o=new Map,i=new Map,s=[];function a(e){return o.get(e)}function c(e){const t=o.get(e);return t?.browserEventName||e}function l(e,t){e.forEach((e=>o.set(e,t)))}function h(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];t.push({identifier:r.identifier,clientX:r.clientX,clientY:r.clientY,screenX:r.screenX,screenY:r.screenY,pageX:r.pageX,pageY:r.pageY})}return t}function u(e){return{detail:e.detail,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,offsetX:e.offsetX,offsetY:e.offsetY,pageX:e.pageX,pageY:e.pageY,movementX:e.movementX,movementY:e.movementY,button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,type:e.type}}l(["input","change"],{createEventArgs:function(e){const t=e.target;if(function(e){return-1!==d.indexOf(e.getAttribute("type"))}(t)){const e=function(e){const t=e.value,n=e.type;switch(n){case"date":case"month":case"week":return t;case"datetime-local":return 16===t.length?t+":00":t;case"time":return 5===t.length?t+":00":t}throw new Error(`Invalid element type '${n}'.`)}(t);return{value:e}}if(function(e){return e instanceof HTMLSelectElement&&"select-multiple"===e.type}(t)){const e=t;return{value:Array.from(e.options).filter((e=>e.selected)).map((e=>e.value))}}{const e=function(e){return!!e&&"INPUT"===e.tagName&&"checkbox"===e.getAttribute("type")}(t);return{value:e?!!t.checked:t.value}}}}),l(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),l(["drag","dragend","dragenter","dragleave","dragover","dragstart","drop"],{createEventArgs:e=>{return{...u(t=e),dataTransfer:t.dataTransfer?{dropEffect:t.dataTransfer.dropEffect,effectAllowed:t.dataTransfer.effectAllowed,files:Array.from(t.dataTransfer.files).map((e=>e.name)),items:Array.from(t.dataTransfer.items).map((e=>({kind:e.kind,type:e.type}))),types:t.dataTransfer.types}:null};var t}}),l(["focus","blur","focusin","focusout"],{createEventArgs:e=>({type:e.type})}),l(["keydown","keyup","keypress"],{createEventArgs:e=>{return{key:(t=e).key,code:t.code,location:t.location,repeat:t.repeat,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type,isComposing:t.isComposing};var t}}),l(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","mouseleave","mouseenter","dblclick"],{createEventArgs:e=>u(e)}),l(["error"],{createEventArgs:e=>{return{message:(t=e).message,filename:t.filename,lineno:t.lineno,colno:t.colno,type:t.type};var t}}),l(["loadstart","timeout","abort","load","loadend","progress"],{createEventArgs:e=>{return{lengthComputable:(t=e).lengthComputable,loaded:t.loaded,total:t.total,type:t.type};var t}}),l(["touchcancel","touchend","touchmove","touchenter","touchleave","touchstart"],{createEventArgs:e=>{return{detail:(t=e).detail,touches:h(t.touches),targetTouches:h(t.targetTouches),changedTouches:h(t.changedTouches),ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type};var t}}),l(["gotpointercapture","lostpointercapture","pointercancel","pointerdown","pointerenter","pointerleave","pointermove","pointerout","pointerover","pointerup"],{createEventArgs:e=>{return{...u(t=e),pointerId:t.pointerId,width:t.width,height:t.height,pressure:t.pressure,tiltX:t.tiltX,tiltY:t.tiltY,pointerType:t.pointerType,isPrimary:t.isPrimary};var t}}),l(["wheel","mousewheel"],{createEventArgs:e=>{return{...u(t=e),deltaX:t.deltaX,deltaY:t.deltaY,deltaZ:t.deltaZ,deltaMode:t.deltaMode};var t}}),l(["cancel","close","toggle"],{createEventArgs:()=>({})});const d=["date","datetime-local","month","time","week"],p=new Map;let f,g,m=0;const y={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const r="__bl-dynamic-root:"+(++m).toString();p.set(r,e);const o=await w().invokeMethodAsync("AddRootComponent",t,r),i=new _(o,g[t]);return await i.setParameters(n),i}};class v{invoke(e){return this._callback(e)}setCallback(t){this._selfJSObjectReference||(this._selfJSObjectReference=e.createJSObjectReference(this)),this._callback=t}getJSObjectReference(){return this._selfJSObjectReference}dispose(){this._selfJSObjectReference&&e.disposeJSObjectReference(this._selfJSObjectReference)}}class _{constructor(e,t){this._jsEventCallbackWrappers=new Map,this._componentId=e;for(const e of t)"eventcallback"===e.type&&this._jsEventCallbackWrappers.set(e.name.toLowerCase(),new v)}setParameters(e){const t={},n=Object.entries(e||{}),r=n.length;for(const[e,r]of n){const n=this._jsEventCallbackWrappers.get(e.toLowerCase());n&&r?(n.setCallback(r),t[e]=n.getJSObjectReference()):t[e]=r}return w().invokeMethodAsync("SetRootComponentParameters",this._componentId,r,t)}async dispose(){if(null!==this._componentId){await w().invokeMethodAsync("RemoveRootComponent",this._componentId),this._componentId=null;for(const e of this._jsEventCallbackWrappers.values())e.dispose()}}}function w(){if(!f)throw new Error("Dynamic root components have not been enabled in this application.");return f}const b=new Map,S=[],C=new Map;function E(t,n,r,o){if(b.has(t))throw new Error(`Interop methods are already registered for renderer ${t}`);b.set(t,n),r&&o&&Object.keys(r).length>0&&function(t,n,r){if(f)throw new Error("Dynamic root components have already been enabled.");f=t,g=n;for(const[t,o]of Object.entries(r)){const r=e.findJSFunction(t,0);for(const e of o)r(e,n[e])}}(T(t),r,o),C.get(t)?.[0]?.(),function(e){for(const t of S)t(e)}(t)}function I(e){return b.has(e)}function k(e,t,n){return R(e,t.eventHandlerId,(()=>T(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function T(e){const t=b.get(e);if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let R=(e,t,n)=>n();const D=U(["abort","blur","cancel","canplay","canplaythrough","change","close","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pointerenter","pointerleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),x={submit:!0},A=U(["click","dblclick","mousedown","mousemove","mouseup"]);class P{static{this.nextEventDelegatorId=0}constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++P.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new N(this.onGlobalEvent.bind(this))}setListener(e,t,n,r){const o=this.getEventHandlerInfosForElement(e,!0),i=o.getHandler(t);if(i)this.eventInfoStore.update(i.eventHandlerId,n);else{const i={element:e,eventName:t,eventHandlerId:n,renderingComponentId:r};this.eventInfoStore.add(i),o.setHandler(t,i)}}getHandler(e){return this.eventInfoStore.get(e)}removeListener(e){const t=this.eventInfoStore.remove(e);if(t){const e=t.element,n=this.getEventHandlerInfosForElement(e,!1);n&&n.removeHandler(t.eventName)}}removeListenersForElement(e){const t=this.getEventHandlerInfosForElement(e,!1);if(t){for(const e of t.enumerateHandlers())this.eventInfoStore.remove(e.eventHandlerId);delete e[this.eventsCollectionKey]}}notifyAfterClick(e){this.afterClickCallbacks.push(e),this.eventInfoStore.addGlobalListener("click")}setStopPropagation(e,t,n){const r=this.getEventHandlerInfosForElement(e,!0),o=r.stopPropagation(t);r.stopPropagation(t,n),!o&&n?this.eventInfoStore.addGlobalListener(t):o&&!n&&this.eventInfoStore.decrementCountByEventName(t)}setPreventDefault(e,t,n){const r=this.getEventHandlerInfosForElement(e,!0),o=r.preventDefault(t);r.preventDefault(t,n),!o&&n?this.eventInfoStore.addActiveGlobalListener(t):o&&!n&&this.eventInfoStore.decrementCountByEventName(t)}onGlobalEvent(e){if(!(e.target instanceof Element))return;if(!I(this.browserRendererId))return;this.dispatchGlobalEventToAllElements(e.type,e);const t=(n=e.type,i.get(n));var n;t&&t.forEach((t=>this.dispatchGlobalEventToAllElements(t,e))),"click"===e.type&&this.afterClickCallbacks.forEach((t=>t(e)))}dispatchGlobalEventToAllElements(e,t){const n=t.composedPath();let o=n.shift(),i=null,s=!1;const c=Object.prototype.hasOwnProperty.call(D,e);let l=!1;for(;o;){const d=o,p=this.getEventHandlerInfosForElement(d,!1);if(p){const n=p.getHandler(e);if(n&&(h=d,u=t.type,!((h instanceof HTMLButtonElement||h instanceof HTMLInputElement||h instanceof HTMLTextAreaElement||h instanceof HTMLSelectElement)&&Object.prototype.hasOwnProperty.call(A,u)&&h.disabled))){if(!s){const n=a(e);i=n?.createEventArgs?n.createEventArgs(t):{},s=!0}Object.prototype.hasOwnProperty.call(x,t.type)&&t.preventDefault(),k(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:r.fromEvent(n.renderingComponentId,t)},i)}p.stopPropagation(e)&&(l=!0),p.preventDefault(e)&&t.preventDefault()}o=c||l?void 0:n.shift()}var h,u}getEventHandlerInfosForElement(e,t){return Object.prototype.hasOwnProperty.call(e,this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new M:null}}class N{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={},s.push(this.handleEventNameAliasAdded.bind(this))}add(e){if(this.infosByEventHandlerId[e.eventHandlerId])throw new Error(`Event ${e.eventHandlerId} is already tracked`);this.infosByEventHandlerId[e.eventHandlerId]=e,this.addGlobalListener(e.eventName)}get(e){return this.infosByEventHandlerId[e]}addGlobalListener(e){if(e=c(e),Object.prototype.hasOwnProperty.call(this.countByEventName,e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=Object.prototype.hasOwnProperty.call(D,e);document.addEventListener(e,this.globalListener,t)}}addActiveGlobalListener(e){e=c(e),Object.prototype.hasOwnProperty.call(this.countByEventName,e)?(this.countByEventName[e]++,document.removeEventListener(e,this.globalListener)):this.countByEventName[e]=1;const t=Object.prototype.hasOwnProperty.call(D,e);document.addEventListener(e,this.globalListener,{capture:t,passive:!1})}update(e,t){if(Object.prototype.hasOwnProperty.call(this.infosByEventHandlerId,t))throw new Error(`Event ${t} is already tracked`);const n=this.infosByEventHandlerId[e];delete this.infosByEventHandlerId[e],n.eventHandlerId=t,this.infosByEventHandlerId[t]=n}remove(e){const t=this.infosByEventHandlerId[e];if(t){delete this.infosByEventHandlerId[e];const n=c(t.eventName);this.decrementCountByEventName(n)}return t}decrementCountByEventName(e){0==--this.countByEventName[e]&&(delete this.countByEventName[e],document.removeEventListener(e,this.globalListener))}handleEventNameAliasAdded(e,t){if(Object.prototype.hasOwnProperty.call(this.countByEventName,e)){const n=this.countByEventName[e];delete this.countByEventName[e],document.removeEventListener(e,this.globalListener),this.addGlobalListener(t),this.countByEventName[t]+=n-1}}}class M{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}*enumerateHandlers(){for(const e in this.handlers)Object.prototype.hasOwnProperty.call(this.handlers,e)&&(yield this.handlers[e])}getHandler(e){return Object.prototype.hasOwnProperty.call(this.handlers,e)?this.handlers[e]:null}setHandler(e,t){this.handlers[e]=t}removeHandler(e){delete this.handlers[e]}preventDefault(e,t){return void 0!==t&&(this.preventDefaultFlags=this.preventDefaultFlags||{},this.preventDefaultFlags[e]=t),!!this.preventDefaultFlags&&this.preventDefaultFlags[e]}stopPropagation(e,t){return void 0!==t&&(this.stopPropagationFlags=this.stopPropagationFlags||{},this.stopPropagationFlags[e]=t),!!this.stopPropagationFlags&&this.stopPropagationFlags[e]}}function U(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const B=Symbol(),L=Symbol(),$=Symbol();function O(e,t){if(B in e)return e;const n=[];if(e.childNodes.length>0){if(!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");e.childNodes.forEach((t=>{const r=O(t,!0);r[L]=e,n.push(r)}))}return e[B]=n,e}function H(e){const t=V(e);for(;t.length;)W(e,0)}function F(e,t){const n=document.createComment("!");return j(n,e,t),n}function j(e,t,n){const r=e;let o=e;if(e instanceof Comment){const t=V(r);if(t?.length>0){const t=Z(r),n=new Range;n.setStartBefore(e),n.setEndAfter(t),o=n.extractContents()}}const i=z(r);if(i){const e=V(i),t=Array.prototype.indexOf.call(e,r);e.splice(t,1),delete r[L]}const s=V(t);if(n<s.length){const e=s[n];e.parentNode.insertBefore(o,e),s.splice(n,0,r)}else Q(o,t),s.push(r);r[L]=t,B in r||(r[B]=[])}function W(e,t){const n=V(e).splice(t,1)[0];if(n instanceof Comment){const e=V(n);if(e)for(;e.length>0;)W(n,0)}const r=n;r.parentNode.removeChild(r)}function z(e){return e[L]||null}function q(e,t){return V(e)[t]}function J(e){const t=Y(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function V(e){return e[B]}function K(e){const t=V(z(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}function*X(e){const t=V(e);for(const e of t)yield*X(e);yield e}function G(e,t){const n=V(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=Z(e.moveRangeStart)})),t.forEach((t=>{const r=document.createComment("marker");t.moveToBeforeMarker=r;const o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):Q(r,e)})),t.forEach((e=>{const t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd;let i=r;for(;i;){const e=i.nextSibling;if(n.insertBefore(i,t),i===o)break;i=e}n.removeChild(t)})),t.forEach((e=>{n[e.toSiblingIndex]=e.moveRangeStart}))}function Y(e){if(e instanceof Element||e instanceof DocumentFragment)return e;if(e instanceof Comment)return e.parentNode;throw new Error("Not a valid logical element")}function Q(e,t){if(t instanceof Element||t instanceof DocumentFragment)t.appendChild(e);else{if(!(t instanceof Comment))throw new Error(`Cannot append node because the parent is not a valid logical element. Parent: ${t}`);{const n=K(t);n?n.parentNode.insertBefore(e,n):Q(e,z(t))}}}function Z(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=K(e);if(t)return t.previousSibling;{const t=z(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:Z(t)}}function ee(e){return`_bl_${e}`}const te="__internalId";e.attachReviver(((e,t)=>t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,te)&&"string"==typeof t[te]?function(e){const t=`[${ee(e)}]`;return document.querySelector(t)}(t[te]):t));const ne="_blazorDeferredValue";function re(e){return"select-multiple"===e.type}function oe(e,t){e.value=t||""}function ie(e,t){e instanceof HTMLSelectElement?re(e)?function(e,t){t||=[];for(let n=0;n<e.options.length;n++)e.options[n].selected=-1!==t.indexOf(e.options[n].value)}(e,t):oe(e,t):e.value=t}function se(e){const t=function(e){for(;e;){if(e instanceof HTMLSelectElement)return e;e=e.parentElement}return null}(e);if(!function(e){return!!e&&ne in e}(t))return!1;if(re(t))e.selected=-1!==t._blazorDeferredValue.indexOf(e.value);else{if(t._blazorDeferredValue!==e.value)return!1;oe(t,e.value),delete t._blazorDeferredValue}return!0}const ae=document.createElement("template"),ce=document.createElementNS("http://www.w3.org/2000/svg","g"),le=new Set,he=Symbol(),ue=Symbol();class de{constructor(e){this.rootComponentIds=new Set,this.childComponentLocations={},this.eventDelegator=new P(e),this.eventDelegator.notifyAfterClick((e=>{Ce()&&function(e){if(0!==e.button||function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e))return;if(e.defaultPrevented)return;const t=function(e){const t=e.composedPath&&e.composedPath();if(t)for(let e=0;e<t.length;e++){const n=t[e];if(n instanceof HTMLAnchorElement||n instanceof SVGAElement)return n}return null}(e);if(t&&function(e){const t=e.getAttribute("target");return(!t||"_self"===t)&&e.hasAttribute("href")&&!e.hasAttribute("download")}(t)){const n=Se(t.getAttribute("href"));we(n)&&(e.preventDefault(),Ne(n,!0,!1))}}(e)}))}getRootComponentCount(){return this.rootComponentIds.size}attachRootComponentToLogicalElement(e,t,n){if(function(e){return e[he]}(t))throw new Error(`Root component '${e}' could not be attached because its target element is already associated with a root component`);n&&(t=F(t,V(t).length)),pe(t,!0),this.attachComponentToElement(e,t),this.rootComponentIds.add(e),le.add(t)}updateComponent(e,t,n,r){const o=this.childComponentLocations[t];if(!o)throw new Error(`No element is currently associated with component ${t}`);le.delete(o)&&(this.detachEventHandlersFromElement(o),H(o),o instanceof Comment&&(o.textContent="!"));const i=Y(o)?.getRootNode(),s=i&&i.activeElement;this.applyEdits(e,t,o,0,n,r),s instanceof HTMLElement&&i&&i.activeElement!==s&&s.focus()}disposeComponent(e){if(this.rootComponentIds.delete(e)){const t=this.childComponentLocations[e];pe(t,!1),!0===t[ue]?le.add(t):H(t)}delete this.childComponentLocations[e]}disposeEventHandler(e){this.eventDelegator.removeListener(e)}attachComponentToElement(e,t){this.childComponentLocations[e]=t}detachEventHandlersFromElement(e){for(const t of X(e))t instanceof Element&&this.eventDelegator.removeListenersForElement(t)}applyEdits(e,n,r,o,i,s){let a,c=0,l=o;const h=e.arrayBuilderSegmentReader,u=e.editReader,d=e.frameReader,p=h.values(i),f=h.offset(i),g=f+h.count(i);for(let i=f;i<g;i++){const h=e.diffReader.editsEntry(p,i),f=u.editType(h);switch(f){case t.prependFrame:{const t=u.newTreeIndex(h),o=e.referenceFramesEntry(s,t),i=u.siblingIndex(h);this.insertFrame(e,n,r,l+i,s,o,t);break}case t.removeFrame:W(r,l+u.siblingIndex(h));break;case t.setAttribute:{const t=u.newTreeIndex(h),o=e.referenceFramesEntry(s,t),i=q(r,l+u.siblingIndex(h));if(!(i instanceof Element))throw new Error("Cannot set attribute on non-element child");this.applyAttribute(e,n,i,o);break}case t.removeAttribute:{const e=q(r,l+u.siblingIndex(h));if(!(e instanceof Element))throw new Error("Cannot remove attribute from non-element child");{const t=u.removedAttributeName(h);this.setOrRemoveAttributeOrProperty(e,t,null)}break}case t.updateText:{const t=u.newTreeIndex(h),n=e.referenceFramesEntry(s,t),o=q(r,l+u.siblingIndex(h));if(!(o instanceof Text))throw new Error("Cannot set text content on non-text child");o.textContent=d.textContent(n);break}case t.updateMarkup:{const t=u.newTreeIndex(h),n=e.referenceFramesEntry(s,t),o=u.siblingIndex(h);W(r,l+o),this.insertMarkup(e,r,l+o,n);break}case t.stepIn:r=q(r,l+u.siblingIndex(h)),c++,l=0;break;case t.stepOut:r=z(r),c--,l=0===c?o:0;break;case t.permutationListEntry:a=a||[],a.push({fromSiblingIndex:l+u.siblingIndex(h),toSiblingIndex:l+u.moveToSiblingIndex(h)});break;case t.permutationListEnd:G(r,a),a=void 0;break;default:throw new Error(`Unknown edit type: ${f}`)}}}insertFrame(e,t,r,o,i,s,a){const c=e.frameReader,l=c.frameType(s);switch(l){case n.element:return this.insertElement(e,t,r,o,i,s,a),1;case n.text:return this.insertText(e,r,o,s),1;case n.attribute:throw new Error("Attribute frames should only be present as leading children of element frames.");case n.component:return this.insertComponent(e,r,o,s),1;case n.region:return this.insertFrameRange(e,t,r,o,i,a+1,a+c.subtreeLength(s));case n.elementReferenceCapture:if(r instanceof Element)return h=r,u=c.elementReferenceCaptureId(s),h.setAttribute(ee(u),""),0;throw new Error("Reference capture frames can only be children of element frames.");case n.markup:return this.insertMarkup(e,r,o,s),1;case n.namedEvent:return 0;default:throw new Error(`Unknown frame type: ${l}`)}var h,u}insertElement(e,t,r,o,i,s,a){const c=e.frameReader,l=c.elementName(s),h="svg"===l||J(r)?document.createElementNS("http://www.w3.org/2000/svg",l):document.createElement(l),u=O(h);let d=!1;const p=a+c.subtreeLength(s);for(let s=a+1;s<p;s++){const a=e.referenceFramesEntry(i,s);if(c.frameType(a)!==n.attribute){j(h,r,o),d=!0,this.insertFrameRange(e,t,u,0,i,s,p);break}this.applyAttribute(e,t,h,a)}var f;d||j(h,r,o),(f=h)instanceof HTMLOptionElement?se(f):ne in f&&ie(f,f[ne])}insertComponent(e,t,n,r){const o=F(t,n),i=e.frameReader.componentId(r);this.attachComponentToElement(i,o)}insertText(e,t,n,r){const o=e.frameReader.textContent(r);j(document.createTextNode(o),t,n)}insertMarkup(e,t,n,r){const o=F(t,n),i=(s=e.frameReader.markupContent(r),J(t)?(ce.innerHTML=s||" ",ce):(ae.innerHTML=s||" ",ae.content.querySelectorAll("script").forEach((e=>{const t=document.createElement("script");t.textContent=e.textContent,e.getAttributeNames().forEach((n=>{t.setAttribute(n,e.getAttribute(n))})),e.parentNode.replaceChild(t,e)})),ae.content));var s;let a=0;for(;i.firstChild;)j(i.firstChild,o,a++)}applyAttribute(e,t,n,r){const o=e.frameReader,i=o.attributeName(r),s=o.attributeEventHandlerId(r);if(s){const e=ge(i);return void this.eventDelegator.setListener(n,e,s,t)}const a=o.attributeValue(r);this.setOrRemoveAttributeOrProperty(n,i,a)}insertFrameRange(e,t,n,r,o,i,s){const a=r;for(let a=i;a<s;a++){const i=e.referenceFramesEntry(o,a);r+=this.insertFrame(e,t,n,r,o,i,a),a+=fe(e,i)}return r-a}setOrRemoveAttributeOrProperty(e,t,n){(function(e,t,n){switch(t){case"value":return function(e,t){switch(t&&"INPUT"===e.tagName&&(t=function(e,t){switch(t.getAttribute("type")){case"time":return 8!==e.length||!e.endsWith("00")&&t.hasAttribute("step")?e:e.substring(0,5);case"datetime-local":return 19!==e.length||!e.endsWith("00")&&t.hasAttribute("step")?e:e.substring(0,16);default:return e}}(t,e)),e.tagName){case"INPUT":case"SELECT":case"TEXTAREA":return t&&e instanceof HTMLSelectElement&&re(e)&&(t=JSON.parse(t)),ie(e,t),e[ne]=t,!0;case"OPTION":return t||""===t?e.setAttribute("value",t):e.removeAttribute("value"),se(e),!0;default:return!1}}(e,n);case"checked":return function(e,t){return"INPUT"===e.tagName&&(e.checked=null!==t,!0)}(e,n);default:return!1}})(e,t,n)||(t.startsWith("__internal_")?this.applyInternalAttribute(e,t.substring(11),n):null!==n?e.setAttribute(t,n):e.removeAttribute(t))}applyInternalAttribute(e,t,n){if(t.startsWith("stopPropagation_")){const r=ge(t.substring(16));this.eventDelegator.setStopPropagation(e,r,null!==n)}else{if(!t.startsWith("preventDefault_"))throw new Error(`Unsupported internal attribute '${t}'`);{const r=ge(t.substring(15));this.eventDelegator.setPreventDefault(e,r,null!==n)}}}}function pe(e,t){e[he]=t}function fe(e,t){const r=e.frameReader;switch(r.frameType(t)){case n.component:case n.element:case n.region:return r.subtreeLength(t)-1;default:return 0}}function ge(e){if(e.startsWith("on"))return e.substring(2);throw new Error(`Attribute should be an event name, but doesn't start with 'on'. Value: '${e}'`)}const me={};let ye,ve,_e=!1;function we(e){const t=(n=document.baseURI).substring(0,n.lastIndexOf("/"));var n;const r=e.charAt(t.length);return e.startsWith(t)&&(""===r||"/"===r||"?"===r||"#"===r)}function be(e){document.getElementById(e)?.scrollIntoView()}function Se(e){return ve=ve||document.createElement("a"),ve.href=e,ve.href}function Ce(){return void 0!==ye}function Ee(){return ye}let Ie=!1,ke=0,Te=0;const Re=new Map;let De=async function(e){Be();const t=He();if(t?.hasLocationChangingEventListeners){const n=e.state?._index??0,r=e.state?.userState,o=n-ke,i=location.href;if(await Ue(-o),!await Le(i,r,!1,t))return;await Ue(o)}await $e(!0)},xe=null;const Ae={listenForNavigationEvents:function(e,t,n){Re.set(e,{rendererId:e,hasLocationChangingEventListeners:!1,locationChanged:t,locationChanging:n}),Ie||(Ie=!0,window.addEventListener("popstate",Oe),ke=history.state?._index??0)},enableNavigationInterception:function(e){if(void 0!==ye&&ye!==e)throw new Error("Only one interactive runtime may enable navigation interception at a time.");ye=e},setHasLocationChangingListeners:function(e,t){const n=Re.get(e);if(!n)throw new Error(`Renderer with ID '${e}' is not listening for navigation events`);n.hasLocationChangingEventListeners=t},endLocationChanging:function(e,t){xe&&e===Te&&(xe(t),xe=null)},navigateTo:function(e,t){Pe(e,t,!0)},refresh:function(e){location.reload()},getBaseURI:()=>document.baseURI,getLocationHref:()=>location.href,scrollToElement:be};function Pe(e,t,n=!1){const r=Se(e);!t.forceLoad&&we(r)?Ne(r,!1,t.replaceHistoryEntry,t.historyEntryState,n):function(e,t){if(location.href===e){const t=e+"?";history.replaceState(null,"",t),location.replace(e)}else t?location.replace(e):location.href=e}(e,t.replaceHistoryEntry)}async function Ne(e,t,n,r=void 0,o=!1){if(Be(),function(e,t){const n=new URL(e),r=new URL(t);return n.origin===r.origin&&n.pathname===r.pathname&&n.search===r.search&&""!==r.hash}(location.href,e))return Me(e,n,r),void function(e){const t=e.indexOf("#");t!==e.length-1&&be(e.substring(t+1))}(e);const i=He();(o||!i?.hasLocationChangingEventListeners||await Le(e,r,t,i))&&(function(e,t){const n=new URL(e),r=new URL(t);return n.protocol===r.protocol&&n.host===r.host&&n.port===r.port&&n.pathname===r.pathname}(e,location.href)||(_e=!0),Me(e,n,r),await $e(t))}function Me(e,t,n=void 0){t?history.replaceState({userState:n,_index:ke},"",e):(ke++,history.pushState({userState:n,_index:ke},"",e))}function Ue(e){return new Promise((t=>{const n=De;De=()=>{De=n,t()},history.go(e)}))}function Be(){xe&&(xe(!1),xe=null)}function Le(e,t,n,r){return new Promise((o=>{Be(),Te++,xe=o,r.locationChanging(Te,e,t,n)}))}async function $e(e,t){const n=location.href;await Promise.all(Array.from(Re,(async([t,r])=>{I(t)&&await r.locationChanged(n,history.state?.userState,e)})))}async function Oe(e){De&&(Ce(),1)&&await De(e),ke=history.state?._index??0}function He(){const e=Ee();if(void 0!==e)return Re.get(e)}const Fe={focus:function(e,t){if(e instanceof HTMLElement)e.focus({preventScroll:t});else{if(!(e instanceof SVGElement))throw new Error("Unable to focus an invalid element.");if(!e.hasAttribute("tabindex"))throw new Error("Unable to focus an SVG element that does not have a tabindex.");e.focus({preventScroll:t})}},focusBySelector:function(e){const t=document.querySelector(e);t&&(t.hasAttribute("tabindex")||(t.tabIndex=-1),t.focus({preventScroll:!0}))}},je={init:function(e,t,n,r=50){const o=ze(t);(o||document.documentElement).style.overflowAnchor="none";const i=document.createRange();d(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const s=new IntersectionObserver((function(r){r.forEach((r=>{if(!r.isIntersecting)return;i.setStartAfter(t),i.setEndBefore(n);const o=i.getBoundingClientRect().height,s=r.rootBounds?.height;r.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",r.intersectionRect.top-r.boundingClientRect.top,o,s):r.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,o,s)}))}),{root:o,rootMargin:`${r}px`});s.observe(t),s.observe(n);const a=u(t),c=u(n),{observersByDotNetObjectId:l,id:h}=qe(e);function u(e){const t={attributes:!0},n=new MutationObserver(((n,r)=>{d(e.parentElement)&&(r.disconnect(),e.style.display="table-row",r.observe(e,t)),s.unobserve(e),s.observe(e)}));return n.observe(e,t),n}function d(e){return null!==e&&(e instanceof HTMLTableElement&&""===e.style.display||"table"===e.style.display||e instanceof HTMLTableSectionElement&&""===e.style.display||"table-row-group"===e.style.display)}l[h]={intersectionObserver:s,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const{observersByDotNetObjectId:t,id:n}=qe(e),r=t[n];r&&(r.intersectionObserver.disconnect(),r.mutationObserverBefore.disconnect(),r.mutationObserverAfter.disconnect(),e.dispose(),delete t[n])}},We=Symbol();function ze(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:ze(e.parentElement):null}function qe(e){const t=e._callDispatcher,n=e._id;return t[We]??={},{observersByDotNetObjectId:t[We],id:n}}const Je={getAndRemoveExistingTitle:function(){const e=document.head?document.head.getElementsByTagName("title"):[];if(0===e.length)return null;let t=null;for(let n=e.length-1;n>=0;n--){const r=e[n],o=r.previousSibling;o instanceof Comment&&null!==z(o)||(null===t&&(t=r.textContent),r.parentNode?.removeChild(r))}return t}},Ve={init:function(e,t){t._blazorInputFileNextFileId=0,t.addEventListener("click",(function(){t.value=""})),t.addEventListener("change",(function(){t._blazorFilesById={};const n=Array.prototype.map.call(t.files,(function(e){const n={id:++t._blazorInputFileNextFileId,lastModified:new Date(e.lastModified).toISOString(),name:e.name,size:e.size,contentType:e.type,readPromise:void 0,arrayBuffer:void 0,blob:e};return t._blazorFilesById[n.id]=n,n}));e.invokeMethodAsync("NotifyChange",n)}))},toImageFile:async function(e,t,n,r,o){const i=Ke(e,t),s=await new Promise((function(e){const t=new Image;t.onload=function(){URL.revokeObjectURL(t.src),e(t)},t.onerror=function(){t.onerror=null,URL.revokeObjectURL(t.src)},t.src=URL.createObjectURL(i.blob)})),a=await new Promise((function(e){const t=Math.min(1,r/s.width),i=Math.min(1,o/s.height),a=Math.min(t,i),c=document.createElement("canvas");c.width=Math.round(s.width*a),c.height=Math.round(s.height*a),c.getContext("2d")?.drawImage(s,0,0,c.width,c.height),c.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:i.lastModified,name:i.name,size:a?.size||0,contentType:n,blob:a||i.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return Ke(e,t).blob}};function Ke(e,t){const n=e._blazorFilesById[t];if(!n)throw new Error(`There is no file with ID ${t}. The file list may have changed. See https://aka.ms/aspnet/blazor-input-file-multiple-selections.`);return n}const Xe=new Set;function Ge(e){e.preventDefault(),e.returnValue=!0}async function Ye(e,t,n){return e instanceof Blob?await async function(e,t,n){const r=e.slice(t,t+n),o=await r.arrayBuffer();return new Uint8Array(o)}(e,t,n):function(e,t,n){return new Uint8Array(e.buffer,e.byteOffset+t,n)}(e,t,n)}const Qe={navigateTo:function(e,t,n=!1){Pe(e,t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n})},registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(o.has(e))throw new Error(`The event '${e}' is already registered.`);if(t.browserEventName){const n=i.get(t.browserEventName);n?n.push(e):i.set(t.browserEventName,[e]),s.forEach((n=>n(e,t.browserEventName)))}o.set(e,t)},rootComponents:y,runtime:{},_internal:{navigationManager:Ae,domWrapper:Fe,Virtualize:je,PageTitle:Je,InputFile:Ve,NavigationLock:{enableNavigationPrompt:function(e){0===Xe.size&&window.addEventListener("beforeunload",Ge),Xe.add(e)},disableNavigationPrompt:function(e){Xe.delete(e),0===Xe.size&&window.removeEventListener("beforeunload",Ge)}},getJSDataStreamChunk:Ye,attachWebRendererInterop:E}};var Ze;function et(e){const t={...tt,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...tt.reconnectionOptions,...e.reconnectionOptions}),t}window.Blazor=Qe,function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"}(Ze||(Ze={}));const tt={configureSignalR:e=>{},logLevel:Ze.Warning,initializers:void 0,circuitHandlers:[],reconnectionOptions:{maxRetries:30,retryIntervalMilliseconds:function(e,t){return t&&e>=t?null:e<10?0:e<20?5e3:3e4},dialogId:"components-reconnect-modal"}};(class e{static{this.instance=new e}log(e,t){}});let nt=class{constructor(e){this.minLevel=e}log(e,t){if(e>=this.minLevel){const n=`[${(new Date).toISOString()}] ${Ze[e]}: ${t}`;switch(e){case Ze.Critical:case Ze.Error:console.error(n);break;case Ze.Warning:console.warn(n);break;case Ze.Information:console.info(n);break;default:console.log(n)}}}};const rt=/^\s*Blazor-Server-Component-State:(?<state>[a-zA-Z0-9+/=]+)$/;function ot(e){return it(e,rt)}function it(e,t,n="state"){if(e.nodeType===Node.COMMENT_NODE){const r=e.textContent||"",o=t.exec(r),i=o&&o.groups&&o.groups[n];return i&&e.parentNode?.removeChild(e),i}if(!e.hasChildNodes())return;const r=e.childNodes;for(let e=0;e<r.length;e++){const o=it(r[e],t,n);if(o)return o}}function st(e,t){const n=[],r=new pt(e.childNodes);for(;r.next()&&r.currentElement;){const e=ct(r,t);if(e)n.push(e);else if(r.currentElement.hasChildNodes()){const e=st(r.currentElement,t);for(let t=0;t<e.length;t++){const r=e[t];n.push(r)}}}return n}const at=new RegExp(/^\s*Blazor:[^{]*(?<descriptor>.*)$/);function ct(e,t){const n=e.currentElement;var r,o,i;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const s=at.exec(n.textContent),a=s&&s.groups&&s.groups.descriptor;if(!a)return;!function(e){if(e.parentNode instanceof Document)throw new Error("Root components cannot be marked as interactive. The <html> element must be rendered statically so that scripts are not evaluated multiple times.")}(n);try{const s=function(e){const t=JSON.parse(e),{type:n}=t;if("server"!==n&&"webassembly"!==n&&"auto"!==n)throw new Error(`Invalid component type '${n}'.`);return t}(a),c=function(e,t,n){const{prerenderId:r}=e;if(r){for(;n.next()&&n.currentElement;){const e=n.currentElement;if(e.nodeType!==Node.COMMENT_NODE)continue;if(!e.textContent)continue;const t=at.exec(e.textContent),o=t&&t[1];if(o)return dt(o,r),e}throw new Error(`Could not find an end component comment for '${t}'.`)}}(s,n,e);if(t!==s.type)return;switch(s.type){case"webassembly":return o=n,i=c,ut(r=s),{...r,uniqueId:lt++,start:o,end:i};case"server":return function(e,t,n){return ht(e),{...e,uniqueId:lt++,start:t,end:n}}(s,n,c);case"auto":return function(e,t,n){return ht(e),ut(e),{...e,uniqueId:lt++,start:t,end:n}}(s,n,c)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}let lt=0;function ht(e){const{descriptor:t,sequence:n}=e;if(!t)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===n)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(n))throw new Error(`Error parsing the sequence '${n}' for component '${JSON.stringify(e)}'`)}function ut(e){const{assembly:t,typeName:n}=e;if(!t)throw new Error("assembly must be defined when using a descriptor.");if(!n)throw new Error("typeName must be defined when using a descriptor.");e.parameterDefinitions=e.parameterDefinitions&&atob(e.parameterDefinitions),e.parameterValues=e.parameterValues&&atob(e.parameterValues)}function dt(e,t){const n=JSON.parse(e);if(1!==Object.keys(n).length)throw new Error(`Invalid end of component comment: '${e}'`);const r=n.prerenderId;if(!r)throw new Error(`End of component comment must have a value for the prerendered property: '${e}'`);if(r!==t)throw new Error(`End of component comment prerendered property must match the start comment prerender id: '${t}', '${r}'`)}class pt{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndex<this.length?(this.currentElement=this.childNodes[this.currentIndex],!0):(this.currentElement=void 0,!1)}}class ft extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class gt extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class mt extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class yt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class vt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class _t extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class wt extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class bt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}class St{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class Ct{get(e,t){return this.send({...t,method:"GET",url:e})}post(e,t){return this.send({...t,method:"POST",url:e})}delete(e,t){return this.send({...t,method:"DELETE",url:e})}getCookieString(e){return""}}var Et,It,kt;!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"}(Et||(Et={}));class Tt{constructor(){}log(e,t){}}Tt.instance=new Tt;class Rt{static isRequired(e,t){if(null==e)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}.`)}}class Dt{static get isBrowser(){return"object"==typeof window&&"object"==typeof window.document}static get isWebWorker(){return"object"==typeof self&&"importScripts"in self}static get isReactNative(){return"object"==typeof window&&void 0===window.document}static get isNode(){return"undefined"!=typeof process&&process.release&&"node"===process.release.name}}function xt(e,t){let n="";return At(e)?(n=`Binary data of length ${e.byteLength}`,t&&(n+=`. Content: '${function(e){const t=new Uint8Array(e);let n="";return t.forEach((e=>{n+=`0x${e<16?"0":""}${e.toString(16)} `})),n.substring(0,n.length-1)}(e)}'`)):"string"==typeof e&&(n=`String data of length ${e.length}`,t&&(n+=`. Content: '${e}'`)),n}function At(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function Pt(e,t,n,r,o,i){const s={},[a,c]=Ut();s[a]=c,e.log(Et.Trace,`(${t} transport) sending data. ${xt(o,i.logMessageContent)}.`);const l=At(o)?"arraybuffer":"text",h=await n.post(r,{content:o,headers:{...s,...i.headers},responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});e.log(Et.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}class Nt{constructor(e,t){this._subject=e,this._observer=t}dispose(){const e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),0===this._subject.observers.length&&this._subject.cancelCallback&&this._subject.cancelCallback().catch((e=>{}))}}class Mt{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${Et[e]}: ${t}`;switch(e){case Et.Critical:case Et.Error:this.out.error(n);break;case Et.Warning:this.out.warn(n);break;case Et.Information:this.out.info(n);break;default:this.out.log(n)}}}}function Ut(){return["X-SignalR-User-Agent",Bt("10.0.0","","Browser",void 0)]}function Bt(e,t,n,r){let o="Microsoft SignalR/";const i=e.split(".");return o+=`${i[0]}.${i[1]}`,o+=` (${e}; `,o+=t&&""!==t?`${t}; `:"Unknown OS; ",o+=`${n}`,o+=r?`; ${r}`:"; Unknown Runtime Version",o+=")",o}function Lt(e){return e.stack?e.stack:e.message?e.message:`${e}`}class $t extends Ct{constructor(e){if(super(),this._logger=e,"undefined"==typeof fetch){const e="function"==typeof __webpack_require__?__non_webpack_require__:require;this._jar=new(e("tough-cookie").CookieJar),"undefined"==typeof fetch?this._fetchType=e("node-fetch"):this._fetchType=fetch,this._fetchType=e("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("could not find global")}());if("undefined"==typeof AbortController){const e="function"==typeof __webpack_require__?__non_webpack_require__:require;this._abortControllerType=e("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new mt;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");const t=new this._abortControllerType;let n;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),n=new mt});let r,o=null;if(e.timeout){const r=e.timeout;o=setTimeout((()=>{t.abort(),this._logger.log(Et.Warning,"Timeout from HTTP request."),n=new gt}),r)}""===e.content&&(e.content=void 0),e.content&&(e.headers=e.headers||{},At(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");try{r=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:!0===e.withCredentials?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(e){if(n)throw n;throw this._logger.log(Et.Warning,`Error from HTTP request. ${e}.`),e}finally{o&&clearTimeout(o),e.abortSignal&&(e.abortSignal.onabort=null)}if(!r.ok){const e=await Ot(r,"text");throw new ft(e||r.statusText,r.status)}const i=Ot(r,e.responseType),s=await i;return new St(r.status,r.statusText,s)}getCookieString(e){return""}}function Ot(e,t){let n;switch(t){case"arraybuffer":n=e.arrayBuffer();break;case"text":default:n=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`)}return n}class Ht extends Ct{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new mt):e.method?e.url?new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),r.withCredentials=void 0===e.withCredentials||e.withCredentials,r.setRequestHeader("X-Requested-With","XMLHttpRequest"),""===e.content&&(e.content=void 0),e.content&&(At(e.content)?r.setRequestHeader("Content-Type","application/octet-stream"):r.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const o=e.headers;o&&Object.keys(o).forEach((e=>{r.setRequestHeader(e,o[e])})),e.responseType&&(r.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{r.abort(),n(new mt)}),e.timeout&&(r.timeout=e.timeout),r.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),r.status>=200&&r.status<300?t(new St(r.status,r.statusText,r.response||r.responseText)):n(new ft(r.response||r.responseText||r.statusText,r.status))},r.onerror=()=>{this._logger.log(Et.Warning,`Error from HTTP request. ${r.status}: ${r.statusText}.`),n(new ft(r.statusText,r.status))},r.ontimeout=()=>{this._logger.log(Et.Warning,"Timeout from HTTP request."),n(new gt)},r.send(e.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Ft extends Ct{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new $t(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new Ht(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new mt):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)}}class jt{static write(e){return`${e}${jt.RecordSeparator}`}static parse(e){if(e[e.length-1]!==jt.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(jt.RecordSeparator);return t.pop(),t}}jt.RecordSeparatorCode=30,jt.RecordSeparator=String.fromCharCode(jt.RecordSeparatorCode);class Wt{writeHandshakeRequest(e){return jt.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(At(e)){const r=new Uint8Array(e),o=r.indexOf(jt.RecordSeparatorCode);if(-1===o)throw new Error("Message is incomplete.");const i=o+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(r.slice(0,i))),n=r.byteLength>i?r.slice(i).buffer:null}else{const r=e,o=r.indexOf(jt.RecordSeparator);if(-1===o)throw new Error("Message is incomplete.");const i=o+1;t=r.substring(0,i),n=r.length>i?r.substring(i):null}const r=jt.parse(t),o=JSON.parse(r[0]);if(o.type)throw new Error("Expected a handshake response from the server.");return[n,o]}}!function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close",e[e.Ack=8]="Ack",e[e.Sequence=9]="Sequence"}(It||(It={}));class zt{constructor(){this.observers=[]}next(e){for(const t of this.observers)t.next(e)}error(e){for(const t of this.observers)t.error&&t.error(e)}complete(){for(const e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new Nt(this,e)}}class qt{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}async _send(e){const t=this._protocol.writeMessage(e);let n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let e=()=>{},r=()=>{};At(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise(((t,n)=>{e=t,r=n}))),this._messages.push(new Jt(t,this._totalMessageCount,e,r))}try{this._reconnectInProgress||await this._connection.send(t)}catch{this._disconnected()}await n}_ack(e){let t=-1;for(let n=0;n<this._messages.length;n++){const r=this._messages[n];if(r._id<=e.sequenceId)t=n,At(r._message)?this._bufferedByteCount-=r._message.byteLength:this._bufferedByteCount-=r._message.length,r._resolver();else{if(!(this._bufferedByteCount<this._bufferSize))break;r._resolver()}}-1!==t&&(this._messages=this._messages.slice(t+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type===It.Sequence&&(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;const t=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,t<=this._latestReceivedSequenceId?(t===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=t,this._ackTimer(),!0)}_resetSequence(e){e.sequenceId>this._nextReceivingSequenceId?this._connection.stop(new Error("Sequence ID greater than amount of messages we've received.")):this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const e=0!==this._messages.length?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:It.Sequence,sequenceId:e}));const t=this._messages;for(const e of t)await this._connection.send(e._message);this._reconnectInProgress=!1}_dispose(e){null!=e||(e=new Error("Unable to reconnect to server."));for(const t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case It.Invocation:case It.StreamItem:case It.Completion:case It.StreamInvocation:case It.CancelInvocation:return!0;case It.Close:case It.Sequence:case It.Ping:case It.Ack:return!1}}_ackTimer(){void 0===this._ackTimerHandle&&(this._ackTimerHandle=setTimeout((async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:It.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0}),1e3))}}class Jt{constructor(e,t,n,r){this._message=e,this._id=t,this._resolver=n,this._rejector=r}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}(kt||(kt={}));class Vt{static create(e,t,n,r,o,i,s){return new Vt(e,t,n,r,o,i,s)}constructor(e,t,n,r,o,i,s){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(Et.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")},Rt.isRequired(e,"connection"),Rt.isRequired(t,"logger"),Rt.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=null!=o?o:3e4,this.keepAliveIntervalInMilliseconds=null!=i?i:15e3,this._statefulReconnectBufferSize=null!=s?s:1e5,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=r,this._handshakeProtocol=new Wt,this.connection.onreceive=e=>this._processIncomingData(e),this.connection.onclose=e=>this._connectionClosed(e),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=kt.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:It.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!==kt.Disconnected&&this._connectionState!==kt.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}async _startWithStateTransitions(){if(this._connectionState!==kt.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=kt.Connecting,this._logger.log(Et.Debug,"Starting HubConnection.");try{await this._startInternal(),Dt.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=kt.Connected,this._connectionStarted=!0,this._logger.log(Et.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=kt.Disconnected,this._logger.log(Et.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const e=new Promise(((e,t)=>{this._handshakeResolver=e,this._handshakeRejecter=t}));await this.connection.start(this._protocol.transferFormat);try{let t=this._protocol.version;this.connection.features.reconnect||(t=1);const n={protocol:this._protocol.name,version:t};if(this._logger.log(Et.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(Et.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;!!this.connection.features.reconnect&&(this._messageBuffer=new qt(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(e){throw this._logger.log(Et.Debug,`Hub handshake failed with error '${e}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(e),e}}async stop(){const e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch(e){}}_stopInternal(e){if(this._connectionState===kt.Disconnected)return this._logger.log(Et.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===kt.Disconnecting)return this._logger.log(Et.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const t=this._connectionState;return this._connectionState=kt.Disconnecting,this._logger.log(Et.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(Et.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===kt.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new mt("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._createStreamInvocation(e,t,r);let i;const s=new zt;return s.cancelCallback=()=>{const e=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],i.then((()=>this._sendWithProtocol(e)))},this._callbacks[o.invocationId]=(e,t)=>{t?s.error(t):e&&(e.type===It.Completion?e.error?s.error(new Error(e.error)):s.complete():s.next(e.item))},i=this._sendWithProtocol(o).catch((e=>{s.error(e),delete this._callbacks[o.invocationId]})),this._launchStreams(n,i),s}_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){const[n,r]=this._replaceStreamingParams(t),o=this._sendWithProtocol(this._createInvocation(e,t,!0,r));return this._launchStreams(n,o),o}invoke(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._createInvocation(e,t,!1,r);return new Promise(((e,t)=>{this._callbacks[o.invocationId]=(n,r)=>{r?t(r):n&&(n.type===It.Completion?n.error?t(new Error(n.error)):e(n.result):t(new Error(`Unexpected message type: ${n.type}`)))};const r=this._sendWithProtocol(o).catch((e=>{t(e),delete this._callbacks[o.invocationId]}));this._launchStreams(n,r)}))}on(e,t){e&&t&&(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),-1===this._methods[e].indexOf(t)&&this._methods[e].push(t))}off(e,t){if(!e)return;e=e.toLowerCase();const n=this._methods[e];if(n)if(t){const r=n.indexOf(t);-1!==r&&(n.splice(r,1),0===n.length&&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){const t=this._protocol.parseMessages(e,this._logger);for(const e of t)if(!this._messageBuffer||this._messageBuffer._shouldProcessMessage(e))switch(e.type){case It.Invocation:this._invokeClientMethod(e).catch((e=>{this._logger.log(Et.Error,`Invoke client method threw error: ${Lt(e)}`)}));break;case It.StreamItem:case It.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===It.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(Et.Error,`Stream callback threw error: ${Lt(e)}`)}}break}case It.Ping:break;case It.Close:{this._logger.log(Et.Information,"Close message received from server.");const t=e.error?new Error("Server returned an error on close: "+e.error):void 0;!0===e.allowReconnect?this.connection.stop(t):this._stopPromise=this._stopInternal(t);break}case It.Ack:this._messageBuffer&&this._messageBuffer._ack(e);break;case It.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(e);break;default:this._logger.log(Et.Warning,`Invalid message type: ${e.type}.`)}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,n;try{[n,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(e){const t="Error parsing handshake response: "+e;this._logger.log(Et.Error,t);const n=new Error(t);throw this._handshakeRejecter(n),n}if(t.error){const e="Server returned handshake error: "+t.error;this._logger.log(Et.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(Et.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);let e=this._nextKeepAlive-(new Date).getTime();if(e<0)return void(this._connectionState===kt.Connected&&this._trySendPingMessage());void 0===this._pingServerHandle&&(e<0&&(e=0),this._pingServerHandle=setTimeout((async()=>{this._connectionState===kt.Connected&&await this._trySendPingMessage()}),e))}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(e){const t=e.target.toLowerCase(),n=this._methods[t];if(!n)return this._logger.log(Et.Warning,`No client method with the name '${t}' found.`),void(e.invocationId&&(this._logger.log(Et.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null))));const r=n.slice(),o=!!e.invocationId;let i,s,a;for(const n of r)try{const r=i;i=await n.apply(this,e.arguments),o&&i&&r&&(this._logger.log(Et.Error,`Multiple results provided for '${t}'. Sending error to server.`),a=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),s=void 0}catch(e){s=e,this._logger.log(Et.Error,`A callback for the method '${t}' threw error '${e}'.`)}a?await this._sendWithProtocol(a):o?(s?a=this._createCompletionMessage(e.invocationId,`${s}`,null):void 0!==i?a=this._createCompletionMessage(e.invocationId,null,i):(this._logger.log(Et.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),a=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(a)):i&&this._logger.log(Et.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(Et.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new mt("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===kt.Disconnecting?this._completeClose(e):this._connectionState===kt.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===kt.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=kt.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(null!=e?e:new Error("Connection closed.")),this._messageBuffer=void 0),Dt.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Et.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}async _reconnect(e){const t=Date.now();let n=0,r=void 0!==e?e:new Error("Attempting to reconnect due to a unknown error."),o=this._getNextRetryDelay(n,0,r);if(null===o)return this._logger.log(Et.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=kt.Reconnecting,e?this._logger.log(Et.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(Et.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Et.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==kt.Reconnecting)return void this._logger.log(Et.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==o;){if(this._logger.log(Et.Information,`Reconnect attempt number ${n+1} will start in ${o} ms.`),await new Promise((e=>{this._reconnectDelayHandle=setTimeout(e,o)})),this._reconnectDelayHandle=void 0,this._connectionState!==kt.Reconnecting)return void this._logger.log(Et.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=kt.Connected,this._logger.log(Et.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(Et.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(Et.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==kt.Reconnecting)return this._logger.log(Et.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===kt.Disconnecting&&this._completeClose());n++,r=e instanceof Error?e:new Error(e.toString()),o=this._getNextRetryDelay(n,Date.now()-t,r)}}this._logger.log(Et.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(n){return this._logger.log(Et.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${n}'.`),null}}_cancelCallbacksWithError(e){const t=this._callbacks;this._callbacks={},Object.keys(t).forEach((n=>{const r=t[n];try{r(null,e)}catch(t){this._logger.log(Et.Error,`Stream 'error' callback called with '${e}' threw error: ${Lt(t)}`)}}))}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,n,r){if(n)return 0!==r.length?{target:e,arguments:t,streamIds:r,type:It.Invocation}:{target:e,arguments:t,type:It.Invocation};{const n=this._invocationId;return this._invocationId++,0!==r.length?{target:e,arguments:t,invocationId:n.toString(),streamIds:r,type:It.Invocation}:{target:e,arguments:t,invocationId:n.toString(),type:It.Invocation}}}_launchStreams(e,t){if(0!==e.length){t||(t=Promise.resolve());for(const n in e)e[n].subscribe({complete:()=>{t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n))))},error:e=>{let r;r=e instanceof Error?e.message:e&&e.toString?e.toString():"Unknown error",t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n,r))))},next:e=>{t=t.then((()=>this._sendWithProtocol(this._createStreamItemMessage(n,e))))}})}}_replaceStreamingParams(e){const t=[],n=[];for(let r=0;r<e.length;r++){const o=e[r];if(this._isObservable(o)){const i=this._invocationId;this._invocationId++,t[i]=o,n.push(i.toString()),e.splice(r,1)}}return[t,n]}_isObservable(e){return e&&e.subscribe&&"function"==typeof e.subscribe}_createStreamInvocation(e,t,n){const r=this._invocationId;return this._invocationId++,0!==n.length?{target:e,arguments:t,invocationId:r.toString(),streamIds:n,type:It.StreamInvocation}:{target:e,arguments:t,invocationId:r.toString(),type:It.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:It.CancelInvocation}}_createStreamItemMessage(e,t){return{invocationId:e,item:t,type:It.StreamItem}}_createCompletionMessage(e,t,n){return t?{error:t,invocationId:e,type:It.Completion}:{invocationId:e,result:n,type:It.Completion}}_createCloseMessage(){return{type:It.Close}}async _trySendPingMessage(){try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}}const Kt=[0,2e3,1e4,3e4,null];class Xt{constructor(e){this._retryDelays=void 0!==e?[...e,null]:Kt}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class Gt{}Gt.Authorization="Authorization",Gt.Cookie="Cookie";class Yt extends Ct{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}async send(e){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const n=await this._innerClient.send(e);return t&&401===n.statusCode&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):n}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[Gt.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[Gt.Authorization]&&delete e.headers[Gt.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}var Qt,Zt;!function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(Qt||(Qt={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(Zt||(Zt={}));let en=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 tn{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new en,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(Rt.isRequired(e,"url"),Rt.isRequired(t,"transferFormat"),Rt.isIn(t,Zt,"transferFormat"),this._url=e,this._logger.log(Et.Trace,"(LongPolling transport) Connecting."),t===Zt.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,r]=Ut(),o={[n]:r,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};t===Zt.Binary&&(i.responseType="arraybuffer");const s=`${e}&_=${Date.now()}`;this._logger.log(Et.Trace,`(LongPolling transport) polling: ${s}.`);const a=await this._httpClient.get(s,i);200!==a.statusCode?(this._logger.log(Et.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new ft(a.statusText||"",a.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(e,t){try{for(;this._running;)try{const n=`${e}&_=${Date.now()}`;this._logger.log(Et.Trace,`(LongPolling transport) polling: ${n}.`);const r=await this._httpClient.get(n,t);204===r.statusCode?(this._logger.log(Et.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==r.statusCode?(this._logger.log(Et.Error,`(LongPolling transport) Unexpected response code: ${r.statusCode}.`),this._closeError=new ft(r.statusText||"",r.statusCode),this._running=!1):r.content?(this._logger.log(Et.Trace,`(LongPolling transport) data received. ${xt(r.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(r.content)):this._logger.log(Et.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof gt?this._logger.log(Et.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(Et.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}finally{this._logger.log(Et.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?Pt(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(Et.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(Et.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=Ut();e[t]=n;const r={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let o;try{await this._httpClient.delete(this._url,r)}catch(e){o=e}o?o instanceof ft&&(404===o.statusCode?this._logger.log(Et.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(Et.Trace,`(LongPolling transport) Error sending a DELETE request: ${o}`)):this._logger.log(Et.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(Et.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(Et.Trace,e),this.onclose(this._closeError)}}}class nn{constructor(e,t,n,r){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=r,this.onreceive=null,this.onclose=null}async connect(e,t){return Rt.isRequired(e,"url"),Rt.isRequired(t,"transferFormat"),Rt.isIn(t,Zt,"transferFormat"),this._logger.log(Et.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise(((n,r)=>{let o,i=!1;if(t===Zt.Text){if(Dt.isBrowser||Dt.isWebWorker)o=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const t=this._httpClient.getCookieString(e),n={};n.Cookie=t;const[r,i]=Ut();n[r]=i,o=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...n,...this._options.headers}})}try{o.onmessage=e=>{if(this.onreceive)try{this._logger.log(Et.Trace,`(SSE transport) data received. ${xt(e.data,this._options.logMessageContent)}.`),this.onreceive(e.data)}catch(e){return void this._close(e)}},o.onerror=e=>{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."))},o.onopen=()=>{this._logger.log(Et.Information,`SSE connected to ${this._url}`),this._eventSource=o,i=!0,n()}}catch(e){return void r(e)}}else r(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"))}))}async send(e){return this._eventSource?Pt(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))}}class rn{constructor(e,t,n,r,o,i){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=r,this._webSocketConstructor=o,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=i}async connect(e,t){let n;return Rt.isRequired(e,"url"),Rt.isRequired(t,"transferFormat"),Rt.isIn(t,Zt,"transferFormat"),this._logger.log(Et.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise(((r,o)=>{let i;e=e.replace(/^http/,"ws");const s=this._httpClient.getCookieString(e);let a=!1;if(Dt.isReactNative){const t={},[r,o]=Ut();t[r]=o,n&&(t[Gt.Authorization]=`Bearer ${n}`),s&&(t[Gt.Cookie]=s),i=new this._webSocketConstructor(e,void 0,{headers:{...t,...this._headers}})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(e)),t===Zt.Binary&&(i.binaryType="arraybuffer"),i.onopen=t=>{this._logger.log(Et.Information,`WebSocket connected to ${e}.`),this._webSocket=i,a=!0,r()},i.onerror=e=>{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"There was an error with the transport",this._logger.log(Et.Information,`(WebSockets transport) ${t}.`)},i.onmessage=e=>{if(this._logger.log(Et.Trace,`(WebSockets transport) data received. ${xt(e.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(e.data)}catch(e){return void this._close(e)}},i.onclose=e=>{if(a)this._close(e);else{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.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.",o(new Error(t))}}}))}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(Et.Trace,`(WebSockets transport) sending data. ${xt(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(Et.Trace,"(WebSockets transport) socket closed."),this.onclose&&(!this._isCloseEvent(e)||!1!==e.wasClean&&1e3===e.code?e instanceof Error?this.onclose(e):this.onclose():this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)))}_isCloseEvent(e){return e&&"boolean"==typeof e.wasClean&&"number"==typeof e.code}}class on{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Rt.isRequired(e,"url"),this._logger=function(e){return void 0===e?new Mt(Et.Information):null===e?Tt.instance:void 0!==e.log?e:new Mt(e)}(t.logger),this.baseUrl=this._resolveUrl(e),(t=t||{}).logMessageContent=void 0!==t.logMessageContent&&t.logMessageContent,"boolean"!=typeof t.withCredentials&&void 0!==t.withCredentials)throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.withCredentials=void 0===t.withCredentials||t.withCredentials,t.timeout=void 0===t.timeout?1e5:t.timeout,"undefined"==typeof WebSocket||t.WebSocket||(t.WebSocket=WebSocket),"undefined"==typeof EventSource||t.EventSource||(t.EventSource=EventSource),this._httpClient=new Yt(t.httpClient||new Ft(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}async start(e){if(e=e||Zt.Binary,Rt.isIn(e,Zt,"transferFormat"),this._logger.log(Et.Debug,`Starting connection with transfer format '${Zt[e]}'.`),"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(e),await this._startInternalPromise,"Disconnecting"===this._connectionState){const e="Failed to start the HttpConnection before stop() was called.";return this._logger.log(Et.Error,e),await this._stopPromise,Promise.reject(new mt(e))}if("Connected"!==this._connectionState){const e="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(Et.Error,e),Promise.reject(new mt(e))}this._connectionStarted=!0}send(e){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 sn(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(Et.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(Et.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((e=>{this._stopPromiseResolver=e})),await this._stopInternal(e),void await this._stopPromise)}async _stopInternal(e){this._stopError=e;try{await this._startInternalPromise}catch(e){}if(this.transport){try{await this.transport.stop()}catch(e){this._logger.log(Et.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(Et.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation){if(this._options.transport!==Qt.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(Qt.WebSockets),await this._startTransport(t,e)}else{let n=null,r=0;do{if(n=await this._getNegotiationResponse(t),"Disconnecting"===this._connectionState||"Disconnected"===this._connectionState)throw new mt("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){const e=n.accessToken;this._accessTokenFactory=()=>e,this._httpClient._accessToken=e,this._httpClient._accessTokenFactory=void 0}r++}while(n.url&&r<100);if(100===r&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(t,this._options.transport,n,e)}this.transport instanceof tn&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(Et.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(Et.Error,"Failed to start the connection: "+e),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(e)}}async _getNegotiationResponse(e){const t={},[n,r]=Ut();t[n]=r;const o=this._resolveNegotiateUrl(e);this._logger.log(Et.Debug,`Sending negotiation request: ${o}.`);try{const e=await this._httpClient.post(o,{content:"",headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(200!==e.statusCode)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${e.statusCode}'`));const n=JSON.parse(e.content);return(!n.negotiateVersion||n.negotiateVersion<1)&&(n.connectionToken=n.connectionId),n.useStatefulReconnect&&!0!==this._options._useStatefulReconnect?Promise.reject(new wt("Client didn't negotiate Stateful Reconnect but the server did.")):n}catch(e){let t="Failed to complete negotiation with the server: "+e;return e instanceof ft&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(Et.Error,t),Promise.reject(new wt(t))}}_createConnectUrl(e,t){return t?e+(-1===e.indexOf("?")?"?":"&")+`id=${t}`:e}async _createTransport(e,t,n,r){let o=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t))return this._logger.log(Et.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,await this._startTransport(o,r),void(this.connectionId=n.connectionId);const i=[],s=n.availableTransports||[];let a=n;for(const n of s){const s=this._resolveTransportOrError(n,t,r,!0===(null==a?void 0:a.useStatefulReconnect));if(s instanceof Error)i.push(`${n.transport} failed:`),i.push(s);else if(this._isITransport(s)){if(this.transport=s,!a){try{a=await this._getNegotiationResponse(e)}catch(e){return Promise.reject(e)}o=this._createConnectUrl(e,a.connectionToken)}try{return await this._startTransport(o,r),void(this.connectionId=a.connectionId)}catch(e){if(this._logger.log(Et.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,i.push(new _t(`${n.transport} failed: ${e}`,Qt[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(Et.Debug,e),Promise.reject(new mt(e))}}}}return i.length>0?Promise.reject(new bt(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case Qt.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new rn(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Qt.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new nn(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Qt.LongPolling:return new tn(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=async n=>{let r=!1;if(this.features.reconnect){try{this.features.disconnected(),await this.transport.connect(e,t),await this.features.resend()}catch{r=!0}r&&this._stopConnection(n)}else this._stopConnection(n)}:this.transport.onclose=e=>this._stopConnection(e),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n,r){const o=Qt[e.transport];if(null==o)return this._logger.log(Et.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(!function(e,t){return!e||!!(t&e)}(t,o))return this._logger.log(Et.Debug,`Skipping transport '${Qt[o]}' because it was disabled by the client.`),new vt(`'${Qt[o]}' is disabled by the client.`,o);if(!(e.transferFormats.map((e=>Zt[e])).indexOf(n)>=0))return this._logger.log(Et.Debug,`Skipping transport '${Qt[o]}' because it does not support the requested transfer format '${Zt[n]}'.`),new Error(`'${Qt[o]}' does not support ${Zt[n]}.`);if(o===Qt.WebSockets&&!this._options.WebSocket||o===Qt.ServerSentEvents&&!this._options.EventSource)return this._logger.log(Et.Debug,`Skipping transport '${Qt[o]}' because it is not supported in your environment.'`),new yt(`'${Qt[o]}' is not supported in your environment.`,o);this._logger.log(Et.Debug,`Selecting transport '${Qt[o]}'.`);try{return this.features.reconnect=o===Qt.WebSockets?r:void 0,this._constructTransport(o)}catch(e){return e}}_isITransport(e){return e&&"object"==typeof e&&"connect"in e}_stopConnection(e){if(this._logger.log(Et.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,"Disconnected"!==this._connectionState){if("Connecting"===this._connectionState)throw this._logger.log(Et.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("Disconnecting"===this._connectionState&&this._stopPromiseResolver(),e?this._logger.log(Et.Error,`Connection disconnected with error '${e}'.`):this._logger.log(Et.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(Et.Error,`TransportSendQueue.stop() threw error '${e}'.`)})),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(Et.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(Et.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`)}_resolveUrl(e){if(0===e.lastIndexOf("https://",0)||0===e.lastIndexOf("http://",0))return e;if(!Dt.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(Et.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";const n=new URLSearchParams(t.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"),t.search=n.toString(),t.toString()}}class sn{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new an,this._transportResult=new an,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new an),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()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new an;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):sn._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(t),e.resolve()}catch(t){e.reject(t)}}}static _concatBuffers(e){const t=e.map((e=>e.byteLength)).reduce(((e,t)=>e+t)),n=new Uint8Array(t);let r=0;for(const t of e)n.set(new Uint8Array(t),r),r+=t.byteLength;return n.buffer}}class an{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class cn{constructor(){this.name="json",this.version=2,this.transferFormat=Zt.Text}parseMessages(e,t){if("string"!=typeof e)throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];null===t&&(t=Tt.instance);const n=jt.parse(e),r=[];for(const e of n){const n=JSON.parse(e);if("number"!=typeof n.type)throw new Error("Invalid payload.");switch(n.type){case It.Invocation:this._isInvocationMessage(n);break;case It.StreamItem:this._isStreamItemMessage(n);break;case It.Completion:this._isCompletionMessage(n);break;case It.Ping:case It.Close:break;case It.Ack:this._isAckMessage(n);break;case It.Sequence:this._isSequenceMessage(n);break;default:t.log(Et.Information,"Unknown message type '"+n.type+"' ignored.");continue}r.push(n)}return r}writeMessage(e){return jt.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),void 0!==e.invocationId&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),void 0===e.item)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("number"!=typeof e.sequenceId)throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if("number"!=typeof e.sequenceId)throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if("string"!=typeof e||""===e)throw new Error(t)}}const ln={trace:Et.Trace,debug:Et.Debug,info:Et.Information,information:Et.Information,warn:Et.Warning,warning:Et.Warning,error:Et.Error,critical:Et.Critical,none:Et.None};class hn{configureLogging(e){if(Rt.isRequired(e,"logging"),function(e){return void 0!==e.log}(e))this.logger=e;else if("string"==typeof e){const t=function(e){const t=ln[e.toLowerCase()];if(void 0!==t)return t;throw new Error(`Unknown log level: ${e}`)}(e);this.logger=new Mt(t)}else this.logger=new Mt(e);return this}withUrl(e,t){return Rt.isRequired(e,"url"),Rt.isNotEmpty(e,"url"),this.url=e,this.httpConnectionOptions="object"==typeof t?{...this.httpConnectionOptions,...t}:{...this.httpConnectionOptions,transport:t},this}withHubProtocol(e){return Rt.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 Xt(e):this.reconnectPolicy=e:this.reconnectPolicy=new Xt,this}withServerTimeout(e){return Rt.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return Rt.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return void 0===this.httpConnectionOptions&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=null==e?void 0:e.bufferSize,this}build(){const e=this.httpConnectionOptions||{};if(void 0===e.logger&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const t=new on(this.url,e);return Vt.create(t,this.logger||Tt.instance,this.protocol||new cn,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}var un;!function(e){e[e.Default=0]="Default",e[e.Server=1]="Server",e[e.WebAssembly=2]="WebAssembly",e[e.WebView=3]="WebView"}(un||(un={}));var dn,pn,fn,gn=4294967295;function mn(e,t,n){var r=Math.floor(n/4294967296),o=n;e.setUint32(t,r),e.setUint32(t+4,o)}function yn(e,t){return 4294967296*e.getInt32(t)+e.getUint32(t+4)}var vn=("undefined"==typeof process||"never"!==(null===(dn=null===process||void 0===process?void 0:process.env)||void 0===dn?void 0:dn.TEXT_ENCODING))&&"undefined"!=typeof TextEncoder&&"undefined"!=typeof TextDecoder;function _n(e){for(var t=e.length,n=0,r=0;r<t;){var o=e.charCodeAt(r++);if(4294967168&o)if(4294965248&o){if(o>=55296&&o<=56319&&r<t){var i=e.charCodeAt(r);56320==(64512&i)&&(++r,o=((1023&o)<<10)+(1023&i)+65536)}n+=4294901760&o?4:3}else n+=2;else n++}return n}var wn=vn?new TextEncoder:void 0,bn=vn?"undefined"!=typeof process&&"force"!==(null===(pn=null===process||void 0===process?void 0:process.env)||void 0===pn?void 0:pn.TEXT_ENCODING)?200:0:gn,Sn=(null==wn?void 0:wn.encodeInto)?function(e,t,n){wn.encodeInto(e,t.subarray(n))}:function(e,t,n){t.set(wn.encode(e),n)};function Cn(e,t,n){for(var r=t,o=r+n,i=[],s="";r<o;){var a=e[r++];if(128&a)if(192==(224&a)){var c=63&e[r++];i.push((31&a)<<6|c)}else if(224==(240&a)){c=63&e[r++];var l=63&e[r++];i.push((31&a)<<12|c<<6|l)}else if(240==(248&a)){var h=(7&a)<<18|(c=63&e[r++])<<12|(l=63&e[r++])<<6|63&e[r++];h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h)}else i.push(a);else i.push(a);i.length>=4096&&(s+=String.fromCharCode.apply(String,i),i.length=0)}return i.length>0&&(s+=String.fromCharCode.apply(String,i)),s}var En,In=vn?new TextDecoder:null,kn=vn?"undefined"!=typeof process&&"force"!==(null===(fn=null===process||void 0===process?void 0:process.env)||void 0===fn?void 0:fn.TEXT_DECODER)?200:0:gn,Tn=function(e,t){this.type=e,this.data=t},Rn=(En=function(e,t){return En=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},En(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}En(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Dn=function(e){function t(n){var r=e.call(this,n)||this,o=Object.create(t.prototype);return Object.setPrototypeOf(r,o),Object.defineProperty(r,"name",{configurable:!0,enumerable:!1,value:t.name}),r}return Rn(t,e),t}(Error),xn={type:-1,encode:function(e){var t,n,r,o;return e instanceof Date?function(e){var t,n=e.sec,r=e.nsec;if(n>=0&&r>=0&&n<=17179869183){if(0===r&&n<=4294967295){var o=new Uint8Array(4);return(t=new DataView(o.buffer)).setUint32(0,n),o}var i=n/4294967296,s=4294967295&n;return o=new Uint8Array(8),(t=new DataView(o.buffer)).setUint32(0,r<<2|3&i),t.setUint32(4,s),o}return o=new Uint8Array(12),(t=new DataView(o.buffer)).setUint32(0,r),mn(t,4,n),o}((r=1e6*((t=e.getTime())-1e3*(n=Math.floor(t/1e3))),{sec:n+(o=Math.floor(r/1e9)),nsec:r-1e9*o})):null},decode:function(e){var t=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:var n=t.getUint32(0);return{sec:4294967296*(3&n)+t.getUint32(4),nsec:n>>>2};case 12:return{sec:yn(t,4),nsec:t.getUint32(0)};default:throw new Dn("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},An=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(xn)}return e.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 o=1+t;this.builtInEncoders[o]=n,this.builtInDecoders[o]=r}},e.prototype.tryToEncode=function(e,t){for(var n=0;n<this.builtInEncoders.length;n++)if(null!=(r=this.builtInEncoders[n])&&null!=(o=r(e,t)))return new Tn(-1-n,o);for(n=0;n<this.encoders.length;n++){var r,o;if(null!=(r=this.encoders[n])&&null!=(o=r(e,t)))return new Tn(n,o)}return e instanceof Tn?e:null},e.prototype.decode=function(e,t,n){var r=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return r?r(e,t,n):new Tn(t,e)},e.defaultCodec=new e,e}();function Pn(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer?new Uint8Array(e):Uint8Array.from(e)}var Nn=function(){function e(e,t,n,r,o,i,s,a){void 0===e&&(e=An.defaultCodec),void 0===t&&(t=void 0),void 0===n&&(n=100),void 0===r&&(r=2048),void 0===o&&(o=!1),void 0===i&&(i=!1),void 0===s&&(s=!1),void 0===a&&(a=!1),this.extensionCodec=e,this.context=t,this.maxDepth=n,this.initialBufferSize=r,this.sortKeys=o,this.forceFloat32=i,this.ignoreUndefined=s,this.forceIntegerToFloat=a,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}return e.prototype.reinitializeState=function(){this.pos=0},e.prototype.encodeSharedRef=function(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)},e.prototype.encode=function(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)},e.prototype.doEncode=function(e,t){if(t>this.maxDepth)throw new Error("Too deep objects in depth ".concat(t));null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength<t&&this.resizeBuffer(2*t)},e.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},e.prototype.encodeNil=function(){this.writeU8(192)},e.prototype.encodeBoolean=function(e){!1===e?this.writeU8(194):this.writeU8(195)},e.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))},e.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))throw new Error("Too long string: ".concat(e," bytes in UTF-8"));this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>bn){var t=_n(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),Sn(e,this.bytes,this.pos),this.pos+=t}else t=_n(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var r=e.length,o=n,i=0;i<r;){var s=e.charCodeAt(i++);if(4294967168&s){if(4294965248&s){if(s>=55296&&s<=56319&&i<r){var a=e.charCodeAt(i);56320==(64512&a)&&(++i,s=((1023&s)<<10)+(1023&a)+65536)}4294901760&s?(t[o++]=s>>18&7|240,t[o++]=s>>12&63|128,t[o++]=s>>6&63|128):(t[o++]=s>>12&15|224,t[o++]=s>>6&63|128)}else t[o++]=s>>6&31|192;t[o++]=63&s|128}else t[o++]=s}}(e,this.bytes,this.pos),this.pos+=t},e.prototype.encodeObject=function(e,t){var n=this.extensionCodec.tryToEncode(e,this.context);if(null!=n)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)));this.encodeMap(e,t)}},e.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))throw new Error("Too large binary: ".concat(t));this.writeU8(198),this.writeU32(t)}var n=Pn(e);this.writeU8a(n)},e.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))throw new Error("Too large array: ".concat(n));this.writeU8(221),this.writeU32(n)}for(var r=0,o=e;r<o.length;r++){var i=o[r];this.doEncode(i,t+1)}},e.prototype.countWithoutUndefined=function(e,t){for(var n=0,r=0,o=t;r<o.length;r++)void 0!==e[o[r]]&&n++;return n},e.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))throw new Error("Too large map object: ".concat(r));this.writeU8(223),this.writeU32(r)}for(var o=0,i=n;o<i.length;o++){var s=i[o],a=e[s];this.ignoreUndefined&&void 0===a||(this.encodeString(s),this.doEncode(a,t+1))}},e.prototype.encodeExtension=function(e){var t=e.data.length;if(1===t)this.writeU8(212);else if(2===t)this.writeU8(213);else if(4===t)this.writeU8(214);else if(8===t)this.writeU8(215);else if(16===t)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))throw new Error("Too large extension object: ".concat(t));this.writeU8(201),this.writeU32(t)}this.writeI8(e.type),this.writeU8a(e.data)},e.prototype.writeU8=function(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++},e.prototype.writeU8a=function(e){var t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t},e.prototype.writeI8=function(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++},e.prototype.writeU16=function(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2},e.prototype.writeI16=function(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2},e.prototype.writeU32=function(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4},e.prototype.writeI32=function(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4},e.prototype.writeF32=function(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4},e.prototype.writeF64=function(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8},e.prototype.writeU64=function(e){this.ensureBufferSizeToWrite(8),function(e,t,n){var r=n/4294967296,o=n;e.setUint32(t,r),e.setUint32(t+4,o)}(this.view,this.pos,e),this.pos+=8},e.prototype.writeI64=function(e){this.ensureBufferSizeToWrite(8),mn(this.view,this.pos,e),this.pos+=8},e}();function Mn(e){return"".concat(e<0?"-":"","0x").concat(Math.abs(e).toString(16).padStart(2,"0"))}var Un=function(){function e(e,t){void 0===e&&(e=16),void 0===t&&(t=16),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 e.prototype.canBeCached=function(e){return e>0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,n){e:for(var r=0,o=this.caches[n-1];r<o.length;r++){for(var i=o[r],s=i.bytes,a=0;a<n;a++)if(s[a]!==e[t+a])continue e;return i.str}return null},e.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)},e.prototype.decode=function(e,t,n){var r=this.find(e,t,n);if(null!=r)return this.hit++,r;this.miss++;var o=Cn(e,t,n),i=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(i,o),o},e}(),Bn=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},Ln=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){!function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)}(r,o,(t=e[n](t)).done,t.value)}))}}},$n=function(e){return this instanceof $n?(this.v=e,this):new $n(e)},On=new DataView(new ArrayBuffer(0)),Hn=new Uint8Array(On.buffer),Fn=function(){try{On.getInt8(0)}catch(e){return e.constructor}throw new Error("never reached")}(),jn=new Fn("Insufficient data"),Wn=new Un,zn=function(){function e(e,t,n,r,o,i,s,a){void 0===e&&(e=An.defaultCodec),void 0===t&&(t=void 0),void 0===n&&(n=gn),void 0===r&&(r=gn),void 0===o&&(o=gn),void 0===i&&(i=gn),void 0===s&&(s=gn),void 0===a&&(a=Wn),this.extensionCodec=e,this.context=t,this.maxStrLength=n,this.maxBinLength=r,this.maxArrayLength=o,this.maxMapLength=i,this.maxExtLength=s,this.keyDecoder=a,this.totalPos=0,this.pos=0,this.view=On,this.bytes=Hn,this.headByte=-1,this.stack=[]}return e.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=-1,this.stack.length=0},e.prototype.setBuffer=function(e){this.bytes=Pn(e),this.view=function(e){if(e instanceof ArrayBuffer)return new DataView(e);var t=Pn(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}(this.bytes),this.pos=0},e.prototype.appendBuffer=function(e){if(-1!==this.headByte||this.hasRemaining(1)){var t=this.bytes.subarray(this.pos),n=Pn(e),r=new Uint8Array(t.length+n.length);r.set(t),r.set(n,t.length),this.setBuffer(r)}else this.setBuffer(e)},e.prototype.hasRemaining=function(e){return this.view.byteLength-this.pos>=e},e.prototype.createExtraByteError=function(e){var t=this.view,n=this.pos;return new RangeError("Extra ".concat(t.byteLength-n," of ").concat(t.byteLength," byte(s) found at buffer[").concat(e,"]"))},e.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},e.prototype.decodeMulti=function(e){return Bn(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]}}))},e.prototype.decodeAsync=function(e){var t,n,r,o,i,s,a;return i=this,a=function(){var i,s,a,c,l,h,u,d;return Bn(this,(function(p){switch(p.label){case 0:i=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=Ln(e),p.label=2;case 2:return[4,t.next()];case 3:if((n=p.sent()).done)return[3,5];if(a=n.value,i)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{s=this.doDecodeSync(),i=!0}catch(e){if(!(e instanceof Fn))throw e}this.totalPos+=this.pos,p.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return c=p.sent(),r={error:c},[3,12];case 7:return p.trys.push([7,,10,11]),n&&!n.done&&(o=t.return)?[4,o.call(t)]:[3,9];case 8:p.sent(),p.label=9;case 9:return[3,11];case 10:if(r)throw r.error;return[7];case 11:return[7];case 12:if(i){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,s]}throw h=(l=this).headByte,u=l.pos,d=l.totalPos,new RangeError("Insufficient data in parsing ".concat(Mn(h)," at ").concat(d," (").concat(u," in the current buffer)"))}}))},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{o(a.next(e))}catch(e){t(e)}}function r(e){try{o(a.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof s?o:new s((function(e){e(o)}))).then(n,r)}o((a=a.apply(i,[])).next())}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return function(n,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,i=function(){var n,r,o,i,s,a,c,l,h;return Bn(this,(function(u){switch(u.label){case 0:n=t,r=-1,u.label=1;case 1:u.trys.push([1,13,14,19]),o=Ln(e),u.label=2;case 2:return[4,$n(o.next())];case 3:if((i=u.sent()).done)return[3,12];if(s=i.value,t&&0===r)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(r=this.readArraySize(),n=!1,this.complete()),u.label=4;case 4:u.trys.push([4,9,,10]),u.label=5;case 5:return[4,$n(this.doDecodeSync())];case 6:return[4,u.sent()];case 7:return u.sent(),0==--r?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=u.sent())instanceof Fn))throw a;return[3,10];case 10:this.totalPos+=this.pos,u.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return c=u.sent(),l={error:c},[3,19];case 14:return u.trys.push([14,,17,18]),i&&!i.done&&(h=o.return)?[4,$n(h.call(o))]:[3,16];case 15:u.sent(),u.label=16;case 16:return[3,18];case 17:if(l)throw l.error;return[7];case 18:return[7];case 19:return[2]}}))}.apply(n,r||[]),s=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(e){i[e]&&(o[e]=function(t){return new Promise((function(n,r){s.push([e,t,n,r])>1||c(e,t)}))})}function c(e,t){try{(n=i[e](t)).value instanceof $n?Promise.resolve(n.value.v).then(l,h):u(s[0][2],n)}catch(e){u(s[0][3],e)}var n}function l(e){c("next",e)}function h(e){c("throw",e)}function u(e,t){e(t),s.shift(),s.length&&c(s[0][0],s[0][1])}}(this,arguments)},e.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){if(0!=(r=e-128)){this.pushMapState(r),this.complete();continue e}t={}}else if(e<160){if(0!=(r=e-144)){this.pushArrayState(r),this.complete();continue e}t=[]}else{var n=e-160;t=this.decodeUtf8String(n,0)}else if(192===e)t=null;else if(194===e)t=!1;else if(195===e)t=!0;else if(202===e)t=this.readF32();else if(203===e)t=this.readF64();else if(204===e)t=this.readU8();else if(205===e)t=this.readU16();else if(206===e)t=this.readU32();else if(207===e)t=this.readU64();else if(208===e)t=this.readI8();else if(209===e)t=this.readI16();else if(210===e)t=this.readI32();else if(211===e)t=this.readI64();else if(217===e)n=this.lookU8(),t=this.decodeUtf8String(n,1);else if(218===e)n=this.lookU16(),t=this.decodeUtf8String(n,2);else if(219===e)n=this.lookU32(),t=this.decodeUtf8String(n,4);else if(220===e){if(0!==(r=this.readU16())){this.pushArrayState(r),this.complete();continue e}t=[]}else if(221===e){if(0!==(r=this.readU32())){this.pushArrayState(r),this.complete();continue e}t=[]}else if(222===e){if(0!==(r=this.readU16())){this.pushMapState(r),this.complete();continue e}t={}}else if(223===e){if(0!==(r=this.readU32())){this.pushMapState(r),this.complete();continue e}t={}}else if(196===e){var r=this.lookU8();t=this.decodeBinary(r,1)}else if(197===e)r=this.lookU16(),t=this.decodeBinary(r,2);else if(198===e)r=this.lookU32(),t=this.decodeBinary(r,4);else if(212===e)t=this.decodeExtension(1,0);else if(213===e)t=this.decodeExtension(2,0);else if(214===e)t=this.decodeExtension(4,0);else if(215===e)t=this.decodeExtension(8,0);else if(216===e)t=this.decodeExtension(16,0);else if(199===e)r=this.lookU8(),t=this.decodeExtension(r,1);else if(200===e)r=this.lookU16(),t=this.decodeExtension(r,2);else{if(201!==e)throw new Dn("Unrecognized type byte: ".concat(Mn(e)));r=this.lookU32(),t=this.decodeExtension(r,4)}this.complete();for(var o=this.stack;o.length>0;){var i=o[o.length-1];if(0===i.type){if(i.array[i.position]=t,i.position++,i.position!==i.size)continue e;o.pop(),t=i.array}else{if(1===i.type){if("string"!=(s=typeof t)&&"number"!==s)throw new Dn("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new Dn("The key __proto__ is not allowed");i.key=t,i.type=2;continue e}if(i.map[i.key]=t,i.readCount++,i.readCount!==i.size){i.key=null,i.type=1;continue e}o.pop(),t=i.map}}return t}var s},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.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 Dn("Unrecognized array type byte: ".concat(Mn(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new Dn("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new Dn("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:0,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var n;if(e>this.maxStrLength)throw new Dn("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLength<this.pos+t+e)throw jn;var r,o=this.pos+t;return r=this.stateIsMapKey()&&(null===(n=this.keyDecoder)||void 0===n?void 0:n.canBeCached(e))?this.keyDecoder.decode(this.bytes,o,e):e>kn?function(e,t,n){var r=e.subarray(t,t+n);return In.decode(r)}(this.bytes,o,e):Cn(this.bytes,o,e),this.pos+=t+e,r},e.prototype.stateIsMapKey=function(){return this.stack.length>0&&1===this.stack[this.stack.length-1].type},e.prototype.decodeBinary=function(e,t){if(e>this.maxBinLength)throw new Dn("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw jn;var n=this.pos+t,r=this.bytes.subarray(n,n+e);return this.pos+=t+e,r},e.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new Dn("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)},e.prototype.lookU8=function(){return this.view.getUint8(this.pos)},e.prototype.lookU16=function(){return this.view.getUint16(this.pos)},e.prototype.lookU32=function(){return this.view.getUint32(this.pos)},e.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},e.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},e.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},e.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},e.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},e.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},e.prototype.readU64=function(){var e,t,n=(e=this.view,t=this.pos,4294967296*e.getUint32(t)+e.getUint32(t+4));return this.pos+=8,n},e.prototype.readI64=function(){var e=yn(this.view,this.pos);return this.pos+=8,e},e.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},e.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},e}();class qn{static write(e){let t=e.byteLength||e.length;const n=[];do{let e=127&t;t>>=7,t>0&&(e|=128),n.push(e)}while(t>0);t=e.byteLength||e.length;const r=new Uint8Array(n.length+t);return r.set(n,0),r.set(e,n.length),r.buffer}static parse(e){const t=[],n=new Uint8Array(e),r=[0,7,14,21,28];for(let o=0;o<e.byteLength;){let i,s=0,a=0;do{i=n[o+s],a|=(127&i)<<r[s],s++}while(s<Math.min(5,e.byteLength-o)&&128&i);if(128&i&&s<5)throw new Error("Cannot read message size.");if(5===s&&i>7)throw new Error("Messages bigger than 2GB are not supported.");if(!(n.byteLength>=o+s+a))throw new Error("Incomplete message.");t.push(n.slice?n.slice(o+s,o+s+a):n.subarray(o+s,o+s+a)),o=o+s+a}return t}}const Jn=new Uint8Array([145,It.Ping]);class Vn{constructor(e){this.name="messagepack",this.version=2,this.transferFormat=Zt.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new Nn(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new zn(e.extensionCodec,e.context,e.maxStrLength,e.maxBinLength,e.maxArrayLength,e.maxMapLength,e.maxExtLength)}parseMessages(e,t){if(!(n=e)||"undefined"==typeof ArrayBuffer||!(n instanceof ArrayBuffer||n.constructor&&"ArrayBuffer"===n.constructor.name))throw new Error("Invalid input for MessagePack hub protocol. Expected an ArrayBuffer.");var n;null===t&&(t=Tt.instance);const r=qn.parse(e),o=[];for(const e of r){const n=this._parseMessage(e,t);n&&o.push(n)}return o}writeMessage(e){switch(e.type){case It.Invocation:return this._writeInvocation(e);case It.StreamInvocation:return this._writeStreamInvocation(e);case It.StreamItem:return this._writeStreamItem(e);case It.Completion:return this._writeCompletion(e);case It.Ping:return qn.write(Jn);case It.CancelInvocation:return this._writeCancelInvocation(e);case It.Close:return this._writeClose();case It.Ack:return this._writeAck(e);case It.Sequence:return this._writeSequence(e);default:throw new Error("Invalid message type.")}}_parseMessage(e,t){if(0===e.length)throw new Error("Invalid payload.");const n=this._decoder.decode(e);if(0===n.length||!(n instanceof Array))throw new Error("Invalid payload.");const r=n[0];switch(r){case It.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case It.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case It.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case It.Ping:return this._createPingMessage(n);case It.Close:return this._createCloseMessage(n);case It.Ack:return this._createAckMessage(n);case It.Sequence:return this._createSequenceMessage(n);default:return t.log(Et.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:It.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:It.Ping}}_createInvocationMessage(e,t){if(t.length<5)throw new Error("Invalid payload for Invocation message.");const n=t[2];return n?{arguments:t[4],headers:e,invocationId:n,streamIds:[],target:t[3],type:It.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:It.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:It.StreamItem}}_createCompletionMessage(e,t){if(t.length<4)throw new Error("Invalid payload for Completion message.");const n=t[3];if(n!==this._voidResult&&t.length<5)throw new Error("Invalid payload for Completion message.");let r,o;switch(n){case this._errorResult:r=t[4];break;case this._nonVoidResult:o=t[4]}return{error:r,headers:e,invocationId:t[2],result:o,type:It.Completion}}_createAckMessage(e){if(e.length<1)throw new Error("Invalid payload for Ack message.");return{sequenceId:e[1],type:It.Ack}}_createSequenceMessage(e){if(e.length<1)throw new Error("Invalid payload for Sequence message.");return{sequenceId:e[1],type:It.Sequence}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([It.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([It.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),qn.write(t.slice())}_writeStreamInvocation(e){let t;return t=e.streamIds?this._encoder.encode([It.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([It.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),qn.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([It.StreamItem,e.headers||{},e.invocationId,e.item]);return qn.write(t.slice())}_writeCompletion(e){const t=e.error?this._errorResult:void 0!==e.result?this._nonVoidResult:this._voidResult;let n;switch(t){case this._errorResult:n=this._encoder.encode([It.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([It.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([It.Completion,e.headers||{},e.invocationId,t,e.result])}return qn.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([It.CancelInvocation,e.headers||{},e.invocationId]);return qn.write(t.slice())}_writeClose(){const e=this._encoder.encode([It.Close,null]);return qn.write(e.slice())}_writeAck(e){const t=this._encoder.encode([It.Ack,e.sequenceId]);return qn.write(t.slice())}_writeSequence(e){const t=this._encoder.encode([It.Sequence,e.sequenceId]);return qn.write(t.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}const Kn="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,Xn=Kn?Kn.decode.bind(Kn):function(e){let t=0;const n=e.length,r=[],o=[];for(;t<n;){const n=e[t++];if(0===n)break;if(128&n){if(192==(224&n)){const o=63&e[t++];r.push((31&n)<<6|o)}else if(224==(240&n)){const o=63&e[t++],i=63&e[t++];r.push((31&n)<<12|o<<6|i)}else if(240==(248&n)){let o=(7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++];o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o)}}else r.push(n);r.length>1024&&(o.push(String.fromCharCode.apply(null,r)),r.length=0)}return o.push(String.fromCharCode.apply(null,r)),o.join("")},Gn=Math.pow(2,32),Yn=Math.pow(2,21)-1;function Qn(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function Zn(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function er(e,t){const n=Zn(e,t+4);if(n>Yn)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*Gn+Zn(e,t)}class tr{constructor(e){this.batchData=e;const t=new ir(e);this.arrayRangeReader=new sr(e),this.arrayBuilderSegmentReader=new ar(e),this.diffReader=new nr(e),this.editReader=new rr(e,t),this.frameReader=new or(e,t)}updatedComponents(){return Qn(this.batchData,this.batchData.length-20)}referenceFrames(){return Qn(this.batchData,this.batchData.length-16)}disposedComponentIds(){return Qn(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return Qn(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return Qn(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return Qn(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return er(this.batchData,n)}}class nr{constructor(e){this.batchDataUint8=e}componentId(e){return Qn(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class rr{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return Qn(this.batchDataUint8,e)}siblingIndex(e){return Qn(this.batchDataUint8,e+4)}newTreeIndex(e){return Qn(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return Qn(this.batchDataUint8,e+8)}removedAttributeName(e){const t=Qn(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class or{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return Qn(this.batchDataUint8,e)}subtreeLength(e){return Qn(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=Qn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return Qn(this.batchDataUint8,e+8)}elementName(e){const t=Qn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=Qn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=Qn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=Qn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=Qn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return er(this.batchDataUint8,e+12)}}class ir{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=Qn(e,e.length-4)}readString(e){if(-1===e)return null;{const n=Qn(this.batchDataUint8,this.stringTableStartIndex+4*e),r=function(e,t){let n=0,r=0;for(let o=0;o<4;o++){const i=e[t+o];if(n|=(127&i)<<r,i<128)break;r+=7}return n}(this.batchDataUint8,n),o=n+((t=r)<128?1:t<16384?2:t<2097152?3:4),i=new Uint8Array(this.batchDataUint8.buffer,this.batchDataUint8.byteOffset+o,r);return Xn(i)}var t}}class sr{constructor(e){this.batchDataUint8=e}count(e){return Qn(this.batchDataUint8,e)}values(e){return e+4}}class ar{constructor(e){this.batchDataUint8=e}offset(e){return 0}count(e){return Qn(this.batchDataUint8,e)}values(e){return e+4}}class cr{constructor(e){this.nextBatchId=2,this.logger=e}async processBatch(e,t,n){if(e<this.nextBatchId)return await this.completeBatch(n,e),void this.logger.log(Ze.Debug,`Batch ${e} already processed. Waiting for batch ${this.nextBatchId}.`);if(e>this.nextBatchId)return this.fatalError?(this.logger.log(Ze.Debug,`Received a new batch ${e} but errored out on a previous batch ${this.nextBatchId-1}`),void await n.send("OnRenderCompleted",this.nextBatchId-1,this.fatalError.toString())):void this.logger.log(Ze.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(Ze.Debug,`Applying batch ${e}.`),function(e,t){const n=me[e];if(!n)throw new Error(`There is no browser renderer with ID ${e}.`);const r=t.arrayRangeReader,o=t.updatedComponents(),i=r.values(o),s=r.count(o),a=t.referenceFrames(),c=r.values(a),l=t.diffReader;for(let e=0;e<s;e++){const r=t.updatedComponentsEntry(i,e),o=l.componentId(r),s=l.edits(r);n.updateComponent(t,o,s,c)}const h=t.disposedComponentIds(),u=r.values(h),d=r.count(h);for(let e=0;e<d;e++){const r=t.disposedComponentIdsEntry(u,e);n.disposeComponent(r)}const p=t.disposedEventHandlerIds(),f=r.values(p),g=r.count(p);for(let e=0;e<g;e++){const r=t.disposedEventHandlerIdsEntry(f,e);n.disposeEventHandler(r)}_e&&(_e=!1,window.scrollTo&&window.scrollTo(0,0))}(un.Server,new tr(t)),await this.completeBatch(n,e)}catch(t){throw this.fatalError=t.toString(),this.logger.log(Ze.Error,`There was an error applying batch ${e}.`),n.send("OnRenderCompleted",e,t.toString()),t}}getLastBatchid(){return this.nextBatchId-1}async completeBatch(e,t){try{await e.send("OnRenderCompleted",t,null)}catch{this.logger.log(Ze.Warning,`Failed to deliver completion notification for render '${t}'.`)}}}let lr,hr,ur,dr,pr,fr,gr=!1;function mr(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),gr||(gr=!0,document.querySelectorAll("#blazor-error-ui .reload").forEach((e=>{e.onclick=function(e){location.reload(),e.preventDefault()}})),document.querySelectorAll("#blazor-error-ui .dismiss").forEach((e=>{e.onclick=function(e){const t=document.querySelector("#blazor-error-ui");t&&(t.style.display="none"),e.preventDefault()}})))}class yr{constructor(t,n,r,o){this._renderingFailed=!1,this._disposed=!1,this._pausingState=new vr("pausing",!1,!1),this._resumingState=new vr("resuming",!1,!1),this._disconnectingState=new vr("disconnecting"),this._isFirstRender=!0,this._circuitId=void 0,this._applicationState=n,this._componentManager=t,this._options=r,this._logger=o,this._renderQueue=new cr(this._logger),this._dispatcher=e.attachDispatcher(this)}start(){if(this.isDisposedOrDisposing())throw new Error("Cannot start a disposed circuit.");return this._startPromise||(this._startPromise=this.startCore()),this._startPromise}updateRootComponents(e,t){return this._isFirstRender?(this._isFirstRender=!1,this._connection?.send("UpdateRootComponents",e,this._applicationState)):this._connection?.send("UpdateRootComponents",e,t)}async startCore(){if(this._connection=await this.startConnection(),this._connection.state!==kt.Connected)return!1;const e=JSON.stringify(this._componentManager.initialComponents.map((e=>{return t=e,{...t,start:void 0,end:void 0};var t})));if(this._circuitId=await this._connection.invoke("StartCircuit",Ae.getBaseURI(),Ae.getLocationHref(),e,this._applicationState||""),!this._circuitId)return!1;for(const e of this._options.circuitHandlers)e.onCircuitOpened&&e.onCircuitOpened();return!0}async startConnection(){const e=new Vn;e.name="blazorpack";const t=(new hn).withUrl("_blazor").withHubProtocol(e);this._options.configureSignalR(t);const n=t.build();n.on("JS.AttachComponent",((e,t)=>function(e,t,n){let r=me[e];r||(r=new de(e),me[e]=r),r.attachRootComponentToLogicalElement(n,t,!1)}(un.Server,this.resolveElement(t),e))),n.on("JS.BeginInvokeJS",this._dispatcher.beginInvokeJSFromDotNet.bind(this._dispatcher)),n.on("JS.EndInvokeDotNet",this._dispatcher.endInvokeDotNetFromJS.bind(this._dispatcher)),n.on("JS.ReceiveByteArray",this._dispatcher.receiveByteArray.bind(this._dispatcher)),n.on("JS.SavePersistedState",((e,t,n)=>{if(!this._circuitId)throw new Error("Circuit host not initialized.");if(e!==this._circuitId)throw new Error(`Received persisted state for circuit ID '${e}', but the current circuit ID is '${this._circuitId}'.`);return this._persistedCircuitState={components:t,applicationState:n},!0})),n.on("JS.BeginTransmitStream",(e=>{const t=new ReadableStream({start:t=>{n.stream("SendDotNetStreamToJS",e).subscribe({next:e=>t.enqueue(e),complete:()=>t.close(),error:e=>t.error(e)})}});this._dispatcher.supplyDotNetStream(e,t)})),n.on("JS.RenderBatch",(async(e,t)=>{this._logger.log(Et.Debug,`Received render batch with id ${e} and ${t.byteLength} bytes.`),await this._renderQueue.processBatch(e,t,this._connection),this._componentManager.onAfterRenderBatch?.(un.Server)})),n.on("JS.EndUpdateRootComponents",(e=>{this._componentManager.onAfterUpdateRootComponents?.(e)})),n.on("JS.EndLocationChanging",Qe._internal.navigationManager.endLocationChanging),n.onclose((e=>{this._interopMethodsForReconnection=function(e){const t=b.get(e);if(!t)throw new Error(`Interop methods are not registered for renderer ${e}`);return b.delete(e),t}(un.Server);const t=this._pausingState.isInprogress();t||this._pausingState.transitionTo(!0),this._disposed||this._renderingFailed||t||this._options.reconnectionHandler.onConnectionDown(this._options.reconnectionOptions,e)})),n.on("JS.Error",(e=>{this._renderingFailed=!0,this.unhandledError(e),mr()}));try{await n.start()}catch(e){if(this.unhandledError(e),"FailedToNegotiateWithServerError"===e.errorType)throw e;mr(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===Qt.WebSockets))?this._logger.log(Et.Error,"Unable to connect, please ensure you are using an updated browser that supports WebSockets."):e.innerErrors.some((e=>"FailedToStartTransportError"===e.errorType&&e.transport===Qt.WebSockets))?this._logger.log(Et.Error,"Unable to connect, please ensure WebSockets are available. A VPN or proxy may be blocking the connection."):e.innerErrors.some((e=>"DisabledTransportError"===e.errorType&&e.transport===Qt.LongPolling))&&this._logger.log(Et.Error,"Unable to initiate a SignalR connection to the server. This might be because the server is not configured to support WebSockets. For additional details, visit https://aka.ms/blazor-server-websockets-error."))}return n.connection?.features?.inherentKeepAlive&&this._logger.log(Et.Warning,"Failed to connect via WebSockets, using the Long Polling fallback transport. This may be due to a VPN or proxy blocking the connection. To troubleshoot this, visit https://aka.ms/blazor-server-using-fallback-long-polling."),n}async disconnect(){if(!this._circuitId)throw new Error("Circuit host not initialized.");if(this._disconnectingState.isInprogress())return this._logger.log(Et.Trace,"Waiting for the circuit to finish disconnecting..."),this._disconnectingState.currentProgress();try{this._disconnectingState.reset();const e=this._disconnectingState.currentProgress();return this._logger.log(Et.Trace,"Disconnecting the circuit..."),await this._connection.stop(),this._disconnectingState.complete(),e}catch(e){throw this._logger.log(Et.Error,`Failed to disconnect the circuit: ${e}`),this._disconnectingState.fail(e),e}}async reconnect(){if(!this._circuitId)throw new Error("Circuit host not initialized.");return this._connection.state===kt.Connected||(this._connection=await this.startConnection(),this._interopMethodsForReconnection&&(E(un.Server,this._interopMethodsForReconnection),this._interopMethodsForReconnection=void 0),!!await this._connection.invoke("ConnectCircuit",this._circuitId)&&(this._options.reconnectionHandler.onConnectionUp(),!0))}async pause(e){if(!this._circuitId)return this._logger.log(Et.Error,"Circuit host not initialized."),!1;if(this._connection.state!==kt.Connected)return this._logger.log(Et.Trace,"Pause can only be triggered on connected circuits."),!1;if(this._resumingState.isInprogress())return this._logger.log(Et.Trace,"Circuit is currently resuming..."),!1;if(this._pausingState.isInprogress())return this._logger.log(Et.Trace,"Waiting for the circuit to finish pausing..."),this._pausingState.currentProgress();if(!0===this._pausingState.lastValue())return this._logger.log(Et.Trace,"Circuit is already paused."),!0;this._pausingState.reset();const t=this._pausingState.currentProgress();try{this._logger.log(Et.Trace,"Pausing the circuit..."),this._options.reconnectionHandler?.onConnectionDown(this._options.reconnectionOptions,void 0,!0,e);const t=await this._connection.invoke("PauseCircuit");this._pausingState.complete(t)}catch(e){this._logger.log(Et.Error,`Failed to pause the circuit: ${e}`),this._pausingState.fail(e)}return await this.disconnect(),t}async resume(){if(!this._circuitId)throw this._logger.log(Et.Error,"Circuit host not initialized."),new Error("Circuit host not initialized.");if(this._disconnectingState.isInprogress()&&(this._logger.log(Et.Trace,"Circuit is disconnecting, cannot resume."),await this._disconnectingState.currentProgress()),this._pausingState.isInprogress())return this._logger.log(Et.Trace,"Waiting for the circuit to finish pausing..."),!1;if(!this._pausingState.lastValue())return this._logger.log(Et.Trace,"Circuit is not paused."),!1;if(this._connection.state!==kt.Connected&&(this._logger.log(Et.Trace,"Reestablishing SignalR connection..."),this._connection=await this.startConnection()),this._resumingState.isInprogress())return this._logger.log(Et.Trace,"Waiting for the circuit to finish resuming..."),this._resumingState.currentProgress();this._resumingState.reset();const e=this._resumingState.currentProgress();try{for(const e of this._options.circuitHandlers)e.onCircuitClosed&&e.onCircuitClosed();const t=this._persistedCircuitState;this._persistedCircuitState=void 0;const n=await this._connection.invoke("ResumeCircuit",this._circuitId,Ae.getBaseURI(),Ae.getLocationHref(),t?.components??"[]",t?.applicationState??"");if(!n)return this._resumingState.complete(!1),e;this._pausingState.transitionTo(!1),this._resumingState.complete(!0),this._circuitId=n,this._renderQueue=new cr(this._logger);for(const e of this._options.circuitHandlers)e.onCircuitOpened&&e.onCircuitOpened();return this._options.reconnectionHandler.onConnectionUp(),this._componentManager.onComponentReload?.(un.Server),e}catch(t){return this._logger.log(Et.Error,`Failed to resume the circuit: ${t}`),this._resumingState.fail(t),e}}beginInvokeDotNetFromJS(e,t,n,r,o){this.throwIfDispatchingWhenDisposed(),this._connection.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,r||0,o)}endInvokeJSFromDotNet(e,t,n){this.throwIfDispatchingWhenDisposed(),this._connection.send("EndInvokeJSFromDotNet",e,t,n)}sendByteArray(e,t){this.throwIfDispatchingWhenDisposed(),this._connection.send("ReceiveByteArray",e,t)}throwIfDispatchingWhenDisposed(){if(this._disposed)throw new Error("The circuit associated with this dispatcher is no longer available.")}sendLocationChanged(e,t,n){return this._connection.send("OnLocationChanged",e,t,n)}sendLocationChanging(e,t,n,r){return this._connection.send("OnLocationChanging",e,t,n,r)}sendJsDataStream(e,t,n){return function(e,t,n,r){setTimeout((async()=>{let o=5,i=(new Date).valueOf();try{const s=t instanceof Blob?t.size:t.byteLength;let a=0,c=0;for(;a<s;){const l=Math.min(r,s-a),h=await Ye(t,a,l);if(o--,o>1)await e.send("ReceiveJSDataChunk",n,c,h,null);else{if(!await e.invoke("ReceiveJSDataChunk",n,c,h,null))break;const t=(new Date).valueOf(),r=t-i;i=t,o=Math.max(1,Math.round(500/Math.max(1,r)))}a+=l,c++}}catch(t){await e.send("ReceiveJSDataChunk",n,-1,null,t.toString())}}),0)}(this._connection,e,t,n)}resolveElement(e){const t=function(e){const t=p.get(e);if(t)return p.delete(e),t}(e);if(t)return O(t,!0);const n=Number.parseInt(e);if(!Number.isNaN(n))return function(e){const{start:t,end:n}=e,r=t[$];if(r){if(r!==e)throw new Error("The start component comment was already associated with another component descriptor.");return t}const o=t.parentNode;if(!o)throw new Error(`Comment not connected to the DOM ${t.textContent}`);const i=O(o,!0),s=V(i);t[L]=i,t[$]=e;const a=O(t);if(n){const e=V(a),r=Array.prototype.indexOf.call(s,a)+1;let o=null;for(;o!==n;){const n=s.splice(r,1)[0];if(!n)throw new Error("Could not find the end component comment in the parent logical node list");n[L]=t,e.push(n),o=n}}return a}(this._componentManager.resolveRootComponent(n));throw new Error(`Invalid sequence number or identifier '${e}'.`)}getRootComponentManager(){return this._componentManager}unhandledError(e){this._logger.log(Et.Error,e),this.disconnect()}getDisconnectFormData(){const e=new FormData,t=this._circuitId;return e.append("circuitId",t),e}didRenderingFail(){return this._renderingFailed}isDisposedOrDisposing(){return void 0!==this._disposePromise}sendDisconnectBeacon(){if(this._disposed)return;const e=this.getDisconnectFormData();this._disposed=navigator.sendBeacon("_blazor/disconnect",e)}dispose(){return this._disposePromise||(this._disposePromise=this.disposeCore()),this._disposePromise}async disposeCore(){if(!this._startPromise)return void(this._disposed=!0);await this._startPromise,this._disposed=!0,this._connection?.stop();const e=this.getDisconnectFormData();fetch("_blazor/disconnect",{method:"POST",body:e});for(const e of this._options.circuitHandlers)e.onCircuitClosed&&e.onCircuitClosed()}}class vr{constructor(e,t,n){this._stateName=e,this._resetValue=n,this._lastValue=t}reset(){if(this._promise)throw new Error(`Circuit state ${this._stateName} is already in progress`);const{promise:e,resolve:t,reject:n}=Promise.withResolvers();this._promise=e,this._resolve=t,this._reject=n,this._lastValue=this._resetValue}complete(e){if(!this._resolve)throw new Error(`Circuit state ${this._stateName} not initialized`);const t=this._resolve;this._lastValue=e,this._promise=void 0,this._resolve=void 0,this._reject=void 0,t(e)}fail(e){if(!this._reject)throw new Error(`Circuit state ${this._stateName} not initialized`);const t=this._reject;this._promise=void 0,this._resolve=void 0,this._reject=void 0,t(e)}isInprogress(){return!!this._promise}currentProgress(){if(!this.isInprogress())throw new Error(`Circuit state ${this._stateName} is not in progress`);return this._promise}transitionTo(e){if(this._promise)throw new Error(`Circuit state ${this._stateName} is in progress`);this._lastValue=e}lastValue(){return this._lastValue}}class _r{static{this.ReconnectOverlayClassName="components-reconnect-overlay"}static{this.ReconnectDialogClassName="components-reconnect-dialog"}static{this.ReconnectVisibleClassName="components-reconnect-visible"}static{this.RejoiningAnimationClassName="components-rejoining-animation"}static{this.AnimationRippleCount=2}constructor(e,t,n){this.document=t,this.logger=n,this.reconnect=!0,this.remote=!1,this.style=this.document.createElement("style"),this.style.innerHTML=_r.Css,this.overlay=this.document.createElement("div"),this.overlay.className=_r.ReconnectOverlayClassName,this.host=this.document.createElement("div"),this.host.id=e;const r=this.host.attachShadow({mode:"open"});this.dialog=t.createElement("div"),this.dialog.className=_r.ReconnectDialogClassName,r.appendChild(this.style),r.appendChild(this.overlay),this.rejoiningAnimation=t.createElement("div"),this.rejoiningAnimation.className=_r.RejoiningAnimationClassName;for(let e=0;e<_r.AnimationRippleCount;e++){const e=t.createElement("div");this.rejoiningAnimation.appendChild(e)}this.status=t.createElement("p"),this.status.innerHTML="",this.reloadButton=t.createElement("button"),this.reloadButton.style.display="none",this.reloadButton.innerHTML="Retry",this.reloadButton.addEventListener("click",this.retry.bind(this)),this.resumeButton=t.createElement("button"),this.resumeButton.style.display="none",this.resumeButton.innerHTML="Resume",this.resumeButton.addEventListener("click",this.resume.bind(this)),this.dialog.appendChild(this.rejoiningAnimation),this.dialog.appendChild(this.status),this.dialog.appendChild(this.reloadButton),this.dialog.appendChild(this.resumeButton),this.overlay.appendChild(this.dialog),this.retryWhenDocumentBecomesVisible=()=>{"visible"===this.document.visibilityState&&this.retry()}}show(e){this.document.contains(this.host)||this.document.body.appendChild(this.host),this.reconnect="reconnect"===e?.type,this.reloadButton.style.display="none",this.rejoiningAnimation.style.display="block",this.status.innerHTML="Rejoining the server...",this.host.style.display="block",this.overlay.classList.add(_r.ReconnectVisibleClassName)}update(e){if(this.reconnect="reconnect"===e.type,this.reconnect){const{currentAttempt:t,secondsToNextAttempt:n}=e;if(1===t||0===n)this.status.innerHTML="Rejoining the server...";else{const e=1===n?"second":"seconds";this.status.innerHTML=`Rejoin failed... trying again in ${n} ${e}`}}else this.reloadButton.style.display="none",this.rejoiningAnimation.style.display="none",this.status.innerHTML="The session has been paused by the server.",this.resumeButton.style.display="block"}hide(){this.host.style.display="none",this.overlay.classList.remove(_r.ReconnectVisibleClassName)}failed(){this.rejoiningAnimation.style.display="none",this.reconnect?(this.reloadButton.style.display="block",this.status.innerHTML="Failed to rejoin.<br />Please retry or reload the page.",this.document.addEventListener("visibilitychange",this.retryWhenDocumentBecomesVisible)):(this.status.innerHTML="Failed to resume the session.<br />Please reload the page.",this.resumeButton.style.display="none",this.reloadButton.style.display="none")}rejected(){location.reload()}async retry(){this.document.removeEventListener("visibilitychange",this.retryWhenDocumentBecomesVisible),this.show();try{await Qe.reconnect()||(this.update({type:"pause",remote:this.remote}),await Qe.resumeCircuit()||this.rejected())}catch(e){this.logger.log(Ze.Error,e),this.failed()}}async resume(){try{await Qe.resumeCircuit()||this.failed()}catch(e){this.logger.log(Ze.Error,e),this.failed()}}static{this.Css=`\n .${this.ReconnectOverlayClassName} {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 10000;\n display: none;\n overflow: hidden;\n animation: components-reconnect-fade-in;\n }\n\n .${this.ReconnectOverlayClassName}.${this.ReconnectVisibleClassName} {\n display: block;\n }\n\n .${this.ReconnectOverlayClassName}::before {\n content: '';\n background-color: rgba(0, 0, 0, 0.4);\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n animation: components-reconnect-fadeInOpacity 0.5s ease-in-out;\n opacity: 1;\n }\n\n .${this.ReconnectOverlayClassName} p {\n margin: 0;\n text-align: center;\n }\n\n .${this.ReconnectOverlayClassName} button {\n border: 0;\n background-color: #6b9ed2;\n color: white;\n padding: 4px 24px;\n border-radius: 4px;\n }\n\n .${this.ReconnectOverlayClassName} button:hover {\n background-color: #3b6ea2;\n }\n\n .${this.ReconnectOverlayClassName} button:active {\n background-color: #6b9ed2;\n }\n\n .${this.ReconnectDialogClassName} {\n position: relative;\n background-color: white;\n width: 20rem;\n margin: 20vh auto;\n padding: 2rem;\n border-radius: 0.5rem;\n box-shadow: 0 3px 6px 2px rgba(0, 0, 0, 0.3);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 1rem;\n opacity: 0;\n animation: components-reconnect-slideUp 1.5s cubic-bezier(.05, .89, .25, 1.02) 0.3s, components-reconnect-fadeInOpacity 0.5s ease-out 0.3s;\n animation-fill-mode: forwards;\n z-index: 10001;\n }\n\n .${this.RejoiningAnimationClassName} {\n display: block;\n position: relative;\n width: 80px;\n height: 80px;\n }\n\n .${this.RejoiningAnimationClassName} div {\n position: absolute;\n border: 3px solid #0087ff;\n opacity: 1;\n border-radius: 50%;\n animation: ${this.RejoiningAnimationClassName} 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;\n }\n\n .${this.RejoiningAnimationClassName} div:nth-child(2) {\n animation-delay: -0.5s;\n }\n\n @keyframes ${this.RejoiningAnimationClassName} {\n 0% {\n top: 40px;\n left: 40px;\n width: 0;\n height: 0;\n opacity: 0;\n }\n\n 4.9% {\n top: 40px;\n left: 40px;\n width: 0;\n height: 0;\n opacity: 0;\n }\n\n 5% {\n top: 40px;\n left: 40px;\n width: 0;\n height: 0;\n opacity: 1;\n }\n\n 100% {\n top: 0px;\n left: 0px;\n width: 80px;\n height: 80px;\n opacity: 0;\n }\n }\n\n @keyframes components-reconnect-fadeInOpacity {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n }\n\n @keyframes components-reconnect-slideUp {\n 0% {\n transform: translateY(30px) scale(0.95);\n }\n\n 100% {\n transform: translateY(0);\n }\n }\n `}}class wr{static{this.ShowClassName="components-reconnect-show"}static{this.HideClassName="components-reconnect-hide"}static{this.RetryingClassName="components-reconnect-retrying"}static{this.FailedClassName="components-reconnect-failed"}static{this.PausedClassName="components-reconnect-paused"}static{this.ResumeFailedClassName="components-reconnect-resume-failed"}static{this.RejectedClassName="components-reconnect-rejected"}static{this.MaxRetriesId="components-reconnect-max-retries"}static{this.CurrentAttemptId="components-reconnect-current-attempt"}static{this.SecondsToNextAttemptId="components-seconds-to-next-attempt"}static{this.ReconnectStateChangedEventName="components-reconnect-state-changed"}constructor(e,t,n){if(this.dialog=e,this.document=t,this.reconnect=!1,this.document=t,void 0!==n){const e=this.document.getElementById(wr.MaxRetriesId);e&&(e.innerText=n.toString())}}show(){this.removeClasses(),this.dialog.classList.add(wr.ShowClassName),this.dispatchReconnectStateChangedEvent({state:"show"})}update(e){if(this.reconnect="reconnect"===e.type,"reconnect"===e.type){const{currentAttempt:t,secondsToNextAttempt:n}=e,r=this.document.getElementById(wr.CurrentAttemptId);r&&(r.innerText=t.toString());const o=this.document.getElementById(wr.SecondsToNextAttemptId);o&&(o.innerText=n.toString()),t>1&&n>0&&this.dialog.classList.add(wr.RetryingClassName),this.dispatchReconnectStateChangedEvent({state:"retrying",currentAttempt:t,secondsToNextAttempt:n})}if("pause"===e.type){const t=e.remote;this.dialog.classList.remove(wr.ShowClassName,wr.RetryingClassName),this.dialog.classList.add(wr.PausedClassName),this.dispatchReconnectStateChangedEvent({state:"paused",remote:t})}}hide(){this.removeClasses(),this.dialog.classList.add(wr.HideClassName),this.dispatchReconnectStateChangedEvent({state:"hide"})}failed(){this.removeClasses(),this.reconnect?(this.dialog.classList.add(wr.FailedClassName),this.dispatchReconnectStateChangedEvent({state:"failed"})):(this.dialog.classList.add(wr.ResumeFailedClassName),this.dispatchReconnectStateChangedEvent({state:"resume-failed"}))}rejected(){this.removeClasses(),this.dialog.classList.add(wr.RejectedClassName),this.dispatchReconnectStateChangedEvent({state:"rejected"})}removeClasses(){this.dialog.classList.remove(wr.ShowClassName,wr.HideClassName,wr.RetryingClassName,wr.FailedClassName,wr.RejectedClassName,wr.PausedClassName,wr.ResumeFailedClassName)}dispatchReconnectStateChangedEvent(e){const t=new CustomEvent(wr.ReconnectStateChangedEventName,{detail:e});this.dialog.dispatchEvent(t)}}class br{constructor(e,t,n,r){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||Qe.reconnect,this._resumeCallback=r||Qe.resumeCircuit}onConnectionDown(e,t,n,r){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new wr(t,document,e.maxRetries):new _r(e.dialogId,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new Sr(e,this._logger,this._reconnectCallback,this._resumeCallback,this._reconnectionDisplay,n,r))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class Sr{static{this.MaximumFirstRetryInterval=3e3}constructor(e,t,n,r,o,i,s=!1){this.logger=t,this.reconnectCallback=n,this.resumeCallback=r,this.isGracefulPause=i,this.isRemote=s,this.isDisposed=!1,this.reconnectDisplay=o;const a={type:i?"pause":"reconnect",remote:this.isRemote,currentAttempt:0,secondsToNextAttempt:0};this.reconnectDisplay.show(a),this.isGracefulPause?this.reconnectDisplay.update({type:"pause",remote:this.isRemote}):this.attemptPeriodicReconnection(e)}dispose(){this.isDisposed=!0,this.reconnectDisplay.hide()}async attemptPeriodicReconnection(e){for(let t=0;void 0===e.maxRetries||t<e.maxRetries;t++){let n;if("function"==typeof e.retryIntervalMilliseconds){const r=e.retryIntervalMilliseconds(t);if(null==r)break;n=r}else n=0===t&&e.retryIntervalMilliseconds>Sr.MaximumFirstRetryInterval?Sr.MaximumFirstRetryInterval:e.retryIntervalMilliseconds;if(await this.runTimer(n,1e3,(e=>{this.reconnectDisplay.update({type:"reconnect",currentAttempt:t+1,secondsToNextAttempt:Math.round(e/1e3)})})),this.isDisposed)break;try{if(!await this.reconnectCallback()){if(this.reconnectDisplay.update({type:"pause",remote:!0}),await this.resumeCallback())return;return void this.reconnectDisplay.failed()}return}catch(e){this.logger.log(Ze.Error,e)}}this.reconnectDisplay.failed()}async runTimer(e,t,n){if(e<=0)return void n(0);let r,o,i=Date.now();n(e);const s=()=>{if(this.isDisposed)return void o();const a=Date.now(),c=a-i;i=a;const l=Math.max(1,Math.floor(c/t)),h=t*l;if((e-=h)<Number.EPSILON)return n(0),void o();const u=Math.min(e,t-(c-h));n(e),r=setTimeout(s,u)},a=()=>{"visible"===document.visibilityState&&(clearTimeout(r),n(0),o())};r=setTimeout(s,t),document.addEventListener("visibilitychange",a),await new Promise((e=>o=e)),document.removeEventListener("visibilitychange",a)}}class Cr{constructor(e=!0,t,n,r=0){this.singleRuntime=e,this.logger=t,this.webRendererId=r,this.afterStartedCallbacks=[],n&&this.afterStartedCallbacks.push(...n)}async importInitializersAsync(e,t){await Promise.all(e.map((e=>async function(e,n){let r;var o;n.moduleExports||(o=n.name,r=new URL(o,document.baseURI).toString(),n.moduleExports=await import(r));const i=n.moduleExports;if(void 0!==i){if(e.singleRuntime){const{beforeStart:n,afterStarted:r,beforeWebAssemblyStart:o,afterWebAssemblyStarted:a,beforeServerStart:c,afterServerStarted:l}=i;let h=n;e.webRendererId===un.Server&&c&&(h=c),e.webRendererId===un.WebAssembly&&o&&(h=o);let u=r;return e.webRendererId===un.Server&&l&&(u=l),e.webRendererId===un.WebAssembly&&a&&(u=a),s(e,h,u,t)}return function(e,t,n){const o=n[0],{beforeStart:i,afterStarted:a,beforeWebStart:c,afterWebStarted:l,beforeWebAssemblyStart:h,afterWebAssemblyStarted:u,beforeServerStart:d,afterServerStarted:p}=t,f=!(c||l||h||u||d||p||!i&&!a),g=f&&o.enableClassicInitializers;if(f&&!o.enableClassicInitializers)e.logger?.log(Ze.Warning,`Initializer '${r}' will be ignored because multiple runtimes are available. Use 'before(Web|WebAssembly|Server)Start' and 'after(Web|WebAssembly|Server)Started' instead.`);else if(g)return s(e,i,a,n);if(function(e){e.webAssembly?e.webAssembly.initializers||(e.webAssembly.initializers={beforeStart:[],afterStarted:[]}):e.webAssembly={initializers:{beforeStart:[],afterStarted:[]}},e.circuit?e.circuit.initializers||(e.circuit.initializers={beforeStart:[],afterStarted:[]}):e.circuit={initializers:{beforeStart:[],afterStarted:[]}}}(o),h&&o.webAssembly.initializers.beforeStart.push(h),u&&o.webAssembly.initializers.afterStarted.push(u),d&&o.circuit.initializers.beforeStart.push(d),p&&o.circuit.initializers.afterStarted.push(p),l&&e.afterStartedCallbacks.push(l),c)return c(o)}(e,i,t)}function s(e,t,n,r){if(n&&e.afterStartedCallbacks.push(n),t)return t(...r)}}(this,e))))}async invokeAfterStartedCallbacks(e){const t=(n=this.webRendererId,C.get(n)?.[1]);var n;t&&await t,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}function Er(e){if(void 0!==fr)throw new Error("Blazor Server has already started.");return fr=new Promise(Ir.bind(null,e)),fr}async function Ir(e,t,n){await lr;const r=await async function(e){if(e.initializers)return await Promise.all(e.initializers.beforeStart.map((t=>t(e)))),new Cr(!1,void 0,e.initializers.afterStarted,un.Server);const t=await fetch("_blazor/initializers",{method:"GET",credentials:"include",cache:"no-cache"}),n=(await t.json()).map((e=>({name:e}))),r=new Cr(!0,void 0,void 0,un.Server);return await r.importInitializersAsync(n,[e]),r}(dr);if(hr=ot(document)||"",pr=new nt(dr.logLevel),ur=new yr(e,hr,dr,pr),pr.log(Ze.Information,"Starting up Blazor server-side application."),Qe.reconnect=async()=>!(ur.didRenderingFail()||!await ur.reconnect()&&(pr.log(Ze.Information,"Reconnection attempt to the circuit was rejected by the server. This may indicate that the associated state is no longer available on the server."),1)),Qe.pauseCircuit=async()=>!(ur.didRenderingFail()||!await ur.pause()&&(pr.log(Ze.Information,"Pause attempt to the circuit was rejected by the server. This may indicate that the associated state is no longer available on the server."),1)),Qe.resumeCircuit=async()=>!(ur.didRenderingFail()||!await ur.resume()&&(pr.log(Ze.Information,"Resume attempt to the circuit was rejected by the server. This may indicate that the associated state is no longer available on the server."),1)),Qe.defaultReconnectionHandler=new br(pr),dr.reconnectionHandler=dr.reconnectionHandler||Qe.defaultReconnectionHandler,Qe._internal.navigationManager.listenForNavigationEvents(un.Server,((e,t,n)=>ur.sendLocationChanged(e,t,n)),((e,t,n,r)=>ur.sendLocationChanging(e,t,n,r))),Qe._internal.forceCloseConnection=()=>ur.disconnect(),Qe._internal.sendJSDataStream=(e,t,n)=>ur.sendJsDataStream(e,t,n),!await ur.start())return pr.log(Ze.Error,"Failed to start the circuit."),void t();const o=()=>{ur.sendDisconnectBeacon()};Qe.disconnect=o,window.addEventListener("pagehide",o,{capture:!1,once:!0}),pr.log(Ze.Information,"Blazor server-side application started."),r.invokeAfterStartedCallbacks(Qe),t()}class kr{constructor(e){this.initialComponents=e}resolveRootComponent(e){return this.initialComponents[e]}}class Tr{constructor(){this._eventListeners=new Map}static create(e){const t=new Tr;return e.addEventListener=t.addEventListener.bind(t),e.removeEventListener=t.removeEventListener.bind(t),t}addEventListener(e,t){let n=this._eventListeners.get(e);n||(n=new Set,this._eventListeners.set(e,n)),n.add(t)}removeEventListener(e,t){this._eventListeners.get(e)?.delete(t)}dispatchEvent(e,t){const n=this._eventListeners.get(e);if(!n)return;const r={...t,type:e};for(const e of n)e(r)}}let Rr=!1;function Dr(e){if(Rr)throw new Error("Blazor has already started.");Rr=!0;const t=et(e);!function(e){if(dr)throw new Error("Circuit options have already been configured.");lr=async function(e){const t=await e;dr=et(t)}(e)}(Promise.resolve(t||{})),Tr.create(Qe);const n=function(e){return st(e,"server").sort(((e,t)=>e.sequence-t.sequence))}(document);return Er(new kr(n))}Qe.start=Dr,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&Dr()}();
|
|
//# sourceMappingURL=blazor.server.js.map
|