From 5d4e6d3812805e81a2f4ed9f2c06784204a98013 Mon Sep 17 00:00:00 2001 From: Stephen Halter Date: Tue, 22 Aug 2023 21:35:20 -0700 Subject: [PATCH 01/22] Remove reflection from KestrelServer constructor (#50272) --- src/Servers/Kestrel/Core/src/KestrelServer.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Servers/Kestrel/Core/src/KestrelServer.cs b/src/Servers/Kestrel/Core/src/KestrelServer.cs index 3e863d3a3c04..75cec0130767 100644 --- a/src/Servers/Kestrel/Core/src/KestrelServer.cs +++ b/src/Servers/Kestrel/Core/src/KestrelServer.cs @@ -34,7 +34,7 @@ public KestrelServer(IOptions options, IConnectionListener options, new[] { transportFactory ?? throw new ArgumentNullException(nameof(transportFactory)) }, Array.Empty(), - new SimpleHttpsConfigurationService(loggerFactory), + new SimpleHttpsConfigurationService(), loggerFactory, new KestrelMetrics(new DummyMeterFactory())); } @@ -77,13 +77,6 @@ public void Dispose() { } private sealed class SimpleHttpsConfigurationService : IHttpsConfigurationService { - private readonly ILogger _httpsLogger; - - public SimpleHttpsConfigurationService(ILoggerFactory loggerFactory) - { - _httpsLogger = loggerFactory.CreateLogger(); - } - public bool IsInitialized => true; public void Initialize(IHostEnvironment hostEnvironment, ILogger serverLogger, ILogger httpsLogger) @@ -93,7 +86,7 @@ public void Initialize(IHostEnvironment hostEnvironment, ILogger public void PopulateMultiplexedTransportFeatures(FeatureCollection features, ListenOptions listenOptions) { - HttpsConfigurationService.PopulateMultiplexedTransportFeaturesWorker(features, listenOptions, _httpsLogger); + throw new NotImplementedException(); // Not actually required by this impl, which never provides an IMultiplexedConnectionListenerFactory } public ListenOptions UseHttpsWithDefaults(ListenOptions listenOptions) From 3ea1fa3b7df34453deeafb06511b7adce23215e0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 23 Aug 2023 14:18:40 +0000 Subject: [PATCH 02/22] Update dependencies from https://github.com/dotnet/extensions build 20230822.1 (#50288) [release/8.0] Update dependencies from dotnet/extensions --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 416b5dfb21f0..fc670e5c8fa7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -393,9 +393,9 @@ https://github.com/dotnet/arcade 385129cbc980a515ddee2fa56f6b16f3183ed9bc - + https://github.com/dotnet/extensions - 30dc2c0878042e9b29c32daf74a55c8c06ddc598 + 2cf1664d35005762f8b310f7377ff3f605bad2c8 https://github.com/nuget/nuget.client diff --git a/eng/Versions.props b/eng/Versions.props index c1909d2d2f3a..6f3f82fd0703 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -137,7 +137,7 @@ 8.0.0-rc.2.23418.14 8.0.0-rc.2.23418.14 - 8.0.0-rc.2.23421.8 + 8.0.0-rc.2.23422.1 8.0.0-rc.2.23421.10 8.0.0-rc.2.23421.10 From 61852ce1153873cca6f235246b05ffdc47ae8543 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Wed, 23 Aug 2023 16:50:25 +0100 Subject: [PATCH 03/22] Ensure enhanced nav requests have the correct headers (#50263) --- .../Web.JS/dist/Release/blazor.web.js | 2 +- .../src/Services/NavigationEnhancement.ts | 5 ++++- .../EnhancedNavigationTest.cs | 18 ++++++++++++++++++ .../RazorComponentEndpointsStartup.cs | 13 +++++++++++++ .../Shared/EnhancedNavLayout.razor | 7 ++++--- 5 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/Components/Web.JS/dist/Release/blazor.web.js b/src/Components/Web.JS/dist/Release/blazor.web.js index ebdd9696ad1f..6ac85043977c 100644 --- a/src/Components/Web.JS/dist/Release/blazor.web.js +++ b/src/Components/Web.JS/dist/Release/blazor.web.js @@ -1 +1 @@ -(()=>{var e={778:()=>{},77:()=>{},203:()=>{},200:()=>{},628:()=>{},321:()=>{}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),(()=>{"use strict";var e,t,o;!function(e){const t=[],n="__jsObjectId",o="__dotNetObject",r="__byte[]",i="__dotNetStream",s="__jsStreamReferenceLength";let a,c;class l{constructor(e){this._jsObject=e,this._cachedFunctions=new Map}findFunction(e){const t=this._cachedFunctions.get(e);if(t)return t;let n,o=this._jsObject;if(e.split(".").forEach((t=>{if(!(t in o))throw new Error(`Could not find '${e}' ('${t}' was undefined).`);n=o,o=o[t]})),o instanceof Function)return o=o.bind(n),this._cachedFunctions.set(e,o),o;throw new Error(`The value '${e}' is not a function.`)}getWrappedObject(){return this._jsObject}}const h={0:new l(window)};h[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let d,u=1;function p(e){t.push(e)}function f(e){if(e&&"object"==typeof e){h[u]=new l(e);const t={[n]:u};return u++,t}throw new Error(`Cannot create a JSObjectReference from the value '${e}'.`)}function g(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 o={[s]:t};try{const t=f(e);o[n]=t[n]}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return o}function m(e,n){c=e;const o=n?JSON.parse(n,((e,n)=>t.reduce(((t,n)=>n(e,t)),n))):null;return c=void 0,o}function y(){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 v(e);return void 0===a?a=t:a&&(a=null),t},e.attachReviver=p,e.invokeMethod=function(e,t,...n){return y().invokeDotNetStaticMethod(e,t,...n)},e.invokeMethodAsync=function(e,t,...n){return y().invokeDotNetStaticMethodAsync(e,t,...n)},e.createJSObjectReference=f,e.createJSStreamReference=g,e.disposeJSObjectReference=function(e){const t=e&&e[n];"number"==typeof t&&_(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(d=e.JSCallResultType||(e.JSCallResultType={}));class v{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,o){const r=m(this,t),i=I(b(e,o)(...r||[]),n);return null==i?null:T(this,i)}beginInvokeJSFromDotNet(e,t,n,o,r){const i=new Promise((e=>{const o=m(this,n);e(b(t,r)(...o||[]))}));e&&i.then((t=>T(this,[e,!0,I(t,o)]))).then((t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!0,t)),(t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,w(t)]))))}endInvokeDotNetFromJS(e,t,n){const o=t?m(this,n):new Error(n);this.completePendingCall(parseInt(e,10),t,o)}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,o){if(this._dotNetCallDispatcher.invokeDotNetFromJS){const r=T(this,o),i=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,r);return i?m(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,o){if(e&&n)throw new Error(`For instance method calls, assemblyName should be null. Received '${e}'.`);const r=this._nextAsyncCallId++,i=new Promise(((e,t)=>{this._pendingAsyncCalls[r]={resolve:e,reject:t}}));try{const i=T(this,o);this._dotNetCallDispatcher.beginInvokeDotNetFromJS(r,e,t,n,i)}catch(e){this.completePendingCall(r,!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 C;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 C;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 o=this._pendingAsyncCalls[e];delete this._pendingAsyncCalls[e],t?o.resolve(n):o.reject(n)}}function w(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function b(e,t){const n=h[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function _(e){delete h[e]}e.findJSFunction=b,e.disposeJSObjectReferenceById=_;class E{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{[o]:this._id}}}e.DotNetObject=E,p((function(e,t){if(t&&"object"==typeof t){if(t.hasOwnProperty(o))return new E(t[o],c);if(t.hasOwnProperty(n)){const e=t[n],o=h[e];if(o)return o.getWrappedObject();throw new Error(`JS object instance with Id '${e}' does not exist. It may have been disposed.`)}if(t.hasOwnProperty(r)){const e=t[r],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 S(n)}}return t}));class S{constructor(e){this._streamPromise=e}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class C{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function I(e,t){switch(t){case d.Default:return e;case d.JSObjectReference:return f(e);case d.JSStreamReference:return g(e);case d.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let k=0;function T(e,t){k=0,c=e;const n=JSON.stringify(t,D);return c=void 0,n}function D(e,t){if(t instanceof E)return t.serializeAsArg();if(t instanceof Uint8Array){c.getDotNetCallDispatcher().sendByteArray(k,t);const e={[r]:k};return k++,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"}(o||(o={}));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 i=new Map,s=new Map,a=[];function c(e){return i.get(e)}function l(e){const t=i.get(e);return(null==t?void 0:t.browserEventName)||e}function h(e,t){e.forEach((e=>i.set(e,t)))}function d(e){const t=[];for(let n=0;ne.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}}}}),h(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),h(["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}}),h(["focus","blur","focusin","focusout"],{createEventArgs:e=>({type:e.type})}),h(["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};var t}}),h(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","mouseleave","mouseenter","dblclick"],{createEventArgs:e=>u(e)}),h(["error"],{createEventArgs:e=>{return{message:(t=e).message,filename:t.filename,lineno:t.lineno,colno:t.colno,type:t.type};var t}}),h(["loadstart","timeout","abort","load","loadend","progress"],{createEventArgs:e=>{return{lengthComputable:(t=e).lengthComputable,loaded:t.loaded,total:t.total,type:t.type};var t}}),h(["touchcancel","touchend","touchmove","touchenter","touchleave","touchstart"],{createEventArgs:e=>{return{detail:(t=e).detail,touches:d(t.touches),targetTouches:d(t.targetTouches),changedTouches:d(t.changedTouches),ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type};var t}}),h(["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}}),h(["wheel","mousewheel"],{createEventArgs:e=>{return{...u(t=e),deltaX:t.deltaX,deltaY:t.deltaY,deltaZ:t.deltaZ,deltaMode:t.deltaMode};var t}}),h(["toggle"],{createEventArgs:()=>({})});const p=["date","datetime-local","month","time","week"],f=new Map;let g,m,y=0;const v={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const o="__bl-dynamic-root:"+(++y).toString();f.set(o,e);const r=await E().invokeMethodAsync("AddRootComponent",t,o),i=new _(r,m[t]);return await i.setParameters(n),i}};function w(e){const t=f.get(e);if(t)return f.delete(e),t}class b{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 b)}setParameters(e){const t={},n=Object.entries(e||{}),o=n.length;for(const[e,o]of n){const n=this._jsEventCallbackWrappers.get(e.toLowerCase());n&&o?(n.setCallback(o),t[e]=n.getJSObjectReference()):t[e]=o}return E().invokeMethodAsync("SetRootComponentParameters",this._componentId,o,t)}async dispose(){if(null!==this._componentId){await E().invokeMethodAsync("RemoveRootComponent",this._componentId),this._componentId=null;for(const e of this._jsEventCallbackWrappers.values())e.dispose()}}}function E(){if(!g)throw new Error("Dynamic root components have not been enabled in this application.");return g}const S=new Map,C=new Map,I=new Map;let k;const T=new Promise((e=>{k=e}));function D(e){return S.has(e)}function x(e){if(D(e))return Promise.resolve();let t=I.get(e);return t||(t=new Promise((t=>{C.set(e,t)})),I.set(e,t)),t}function A(e,t,n){return R(e,t.eventHandlerId,(()=>N(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function N(e){const t=S.get(e);if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let R=(e,t,n)=>n();const P=B(["abort","blur","canplay","canplaythrough","change","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"]),U={submit:!0},M=B(["click","dblclick","mousedown","mousemove","mouseup"]);class L{constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++L.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new F(this.onGlobalEvent.bind(this))}setListener(e,t,n,o){const r=this.getEventHandlerInfosForElement(e,!0),i=r.getHandler(t);if(i)this.eventInfoStore.update(i.eventHandlerId,n);else{const i={element:e,eventName:t,eventHandlerId:n,renderingComponentId:o};this.eventInfoStore.add(i),r.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)}}notifyAfterClick(e){this.afterClickCallbacks.push(e),this.eventInfoStore.addGlobalListener("click")}setStopPropagation(e,t,n){this.getEventHandlerInfosForElement(e,!0).stopPropagation(t,n)}setPreventDefault(e,t,n){this.getEventHandlerInfosForElement(e,!0).preventDefault(t,n)}onGlobalEvent(e){if(!(e.target instanceof Element))return;this.dispatchGlobalEventToAllElements(e.type,e);const t=(n=e.type,s.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 a=Object.prototype.hasOwnProperty.call(P,e);let l=!1;for(;o;){const u=o,p=this.getEventHandlerInfosForElement(u,!1);if(p){const n=p.getHandler(e);if(n&&(h=u,d=t.type,!((h instanceof HTMLButtonElement||h instanceof HTMLInputElement||h instanceof HTMLTextAreaElement||h instanceof HTMLSelectElement)&&Object.prototype.hasOwnProperty.call(M,d)&&h.disabled))){if(!s){const n=c(e);i=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},s=!0}Object.prototype.hasOwnProperty.call(U,t.type)&&t.preventDefault(),A(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=a||l?void 0:n.shift()}var h,d}getEventHandlerInfosForElement(e,t){return Object.prototype.hasOwnProperty.call(e,this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new O:null}}L.nextEventDelegatorId=0;class F{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={},a.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=l(e),Object.prototype.hasOwnProperty.call(this.countByEventName,e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=Object.prototype.hasOwnProperty.call(P,e);document.addEventListener(e,this.globalListener,t)}}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=l(t.eventName);0==--this.countByEventName[n]&&(delete this.countByEventName[n],document.removeEventListener(n,this.globalListener))}return t}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 O{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}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 B(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const $=Symbol(),H=Symbol(),j=Symbol();function W(e){const{start:t,end:n}=e,o=t[j];if(o){if(o!==e)throw new Error("The start component comment was already associated with another component descriptor.");return t}const r=t.parentNode;if(!r)throw new Error(`Comment not connected to the DOM ${t.textContent}`);const i=z(r,!0),s=Z(i);t[H]=i,t[j]=e;const a=z(t);if(n){const e=Z(a),o=Array.prototype.indexOf.call(s,a)+1;let r=null;for(;r!==n;){const n=s.splice(o,1)[0];if(!n)throw new Error("Could not find the end component comment in the parent logical node list");n[H]=t,e.push(n),r=n}}return a}function z(e,t){if($ 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 o=z(t,!0);o[H]=e,n.push(o)}))}return e[$]=n,e}function J(e){const t=Z(e);for(;t.length;)V(e,0)}function q(e,t){const n=document.createComment("!");return K(n,e,t),n}function K(e,t,n){const o=e;let r=e;if(te(e)){const t=ie(o);if(t!==e){const n=new Range;n.setStartBefore(e),n.setEndAfter(t),r=n.extractContents()}}const i=X(o);if(i){const e=Z(i),t=Array.prototype.indexOf.call(e,o);e.splice(t,1),delete o[H]}const s=Z(t);if(n0;)V(n,0)}const o=n;o.parentNode.removeChild(o)}function X(e){return e[H]||null}function G(e,t){return Z(e)[t]}function Y(e){return e[j]||null}function Q(e){const t=oe(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function Z(e){return e[$]}function ee(e){const t=Z(X(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}function te(e){return $ in e}function ne(e,t){const n=Z(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=ie(e.moveRangeStart)})),t.forEach((t=>{const o=document.createComment("marker");t.moveToBeforeMarker=o;const r=n[t.toSiblingIndex+1];r?r.parentNode.insertBefore(o,r):re(o,e)})),t.forEach((e=>{const t=e.moveToBeforeMarker,n=t.parentNode,o=e.moveRangeStart,r=e.moveRangeEnd;let i=o;for(;i;){const e=i.nextSibling;if(n.insertBefore(i,t),i===r)break;i=e}n.removeChild(t)})),t.forEach((e=>{n[e.toSiblingIndex]=e.moveRangeStart}))}function oe(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 re(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=ee(t);n?n.parentNode.insertBefore(e,n):re(e,X(t))}}}function ie(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=ee(e);if(t)return t.previousSibling;{const t=X(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:ie(t)}}function se(e){return`_bl_${e}`}const ae="__internalId";e.attachReviver(((e,t)=>t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,ae)&&"string"==typeof t[ae]?function(e){const t=`[${se(e)}]`;return document.querySelector(t)}(t[ae]):t));const ce="_blazorDeferredValue";function le(e){e instanceof HTMLOptionElement?pe(e):ce in e&&ue(e,e[ce])}function he(e){return"select-multiple"===e.type}function de(e,t){e.value=t||""}function ue(e,t){e instanceof HTMLSelectElement?he(e)?function(e,t){t||(t=[]);for(let n=0;n{Le()&&Ae(e,(e=>{Ve(e,!0,!1)}))}))}attachRootComponentToLogicalElement(e,t,n){if(be(t))throw new Error(`Root component '${e}' could not be attached because its target element is already associated with a root component`);we(t,!0),this.attachComponentToElement(e,t),this.rootComponentIds.add(e),n||(me[e]=t)}updateComponent(e,t,n,o){var r;const i=this.childComponentLocations[t];if(!i)throw new Error(`No element is currently associated with component ${t}`);const s=me[t];s&&(delete me[t],J(s),s instanceof Comment&&(s.textContent="!"));const a=null===(r=oe(i))||void 0===r?void 0:r.getRootNode(),c=a&&a.activeElement;this.applyEdits(e,t,i,0,n,o),c instanceof HTMLElement&&a&&a.activeElement!==c&&c.focus()}disposeComponent(e){if(this.rootComponentIds.delete(e)){const t=this.childComponentLocations[e];we(t,!1),J(t)}delete this.childComponentLocations[e]}disposeEventHandler(e){this.eventDelegator.removeListener(e)}attachComponentToElement(e,t){this.childComponentLocations[e]=t}applyEdits(e,n,o,r,i,s){let a,c=0,l=r;const h=e.arrayBuilderSegmentReader,d=e.editReader,u=e.frameReader,p=h.values(i),f=h.offset(i),g=f+h.count(i);for(let i=f;idocument.baseURI,getLocationHref:()=>location.href,scrollToElement:qe};function qe(e){const t=document.getElementById(e);return!!t&&(t.scrollIntoView(),!0)}function Ke(e,t,n=!1){const o=Ue(e);!t.forceLoad&&Ne(o)?tt()?Ve(o,!1,t.replaceHistoryEntry,t.historyEntryState,n):Pe(o,t.replaceHistoryEntry):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 Ve(e,t,n,o=void 0,r=!1){if(Ye(),function(e){const t=e.indexOf("#");return t>-1&&location.href.replace(location.hash,"")===e.substring(0,t)}(e))!function(e,t,n){Xe(e,t,n);const o=e.indexOf("#");o!==e.length-1&&qe(e.substring(o+1))}(e,n,o);else{if(!r&&Oe&&!await Qe(e,o,t))return;Ce=!0,Xe(e,n,o),await Ze(t)}}function Xe(e,t,n=void 0){t?history.replaceState({userState:n,_index:Be},"",e):(Be++,history.pushState({userState:n,_index:Be},"",e))}function Ge(e){return new Promise((t=>{const n=We;We=()=>{We=n,t()},history.go(e)}))}function Ye(){ze&&(ze(!1),ze=null)}function Qe(e,t,n){return new Promise((o=>{Ye(),je?($e++,ze=o,je($e,e,t,n)):o(!1)}))}async function Ze(e){var t;He&&await He(location.href,null===(t=history.state)||void 0===t?void 0:t.userState,e)}async function et(e){var t,n;We&&tt()&&await We(e),Be=null!==(n=null===(t=history.state)||void 0===t?void 0:t._index)&&void 0!==n?n:0}function tt(){return Le()||!Re()}const nt={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,t){const n=document.querySelector(e);n&&(n.hasAttribute("tabindex")||(n.tabIndex=-1),n.focus({preventScroll:!0}))}},ot={init:function(e,t,n,o=50){const r=it(t);(r||document.documentElement).style.overflowAnchor="none";const i=document.createRange();h(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const s=new IntersectionObserver((function(o){o.forEach((o=>{var r;if(!o.isIntersecting)return;i.setStartAfter(t),i.setEndBefore(n);const s=i.getBoundingClientRect().height,a=null===(r=o.rootBounds)||void 0===r?void 0:r.height;o.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",o.intersectionRect.top-o.boundingClientRect.top,s,a):o.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",o.boundingClientRect.bottom-o.intersectionRect.bottom,s,a)}))}),{root:r,rootMargin:`${o}px`});s.observe(t),s.observe(n);const a=l(t),c=l(n);function l(e){const t={attributes:!0},n=new MutationObserver(((n,o)=>{h(e.parentElement)&&(o.disconnect(),e.style.display="table-row",o.observe(e,t)),s.unobserve(e),s.observe(e)}));return n.observe(e,t),n}function h(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)}rt[e._id]={intersectionObserver:s,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const t=rt[e._id];t&&(t.intersectionObserver.disconnect(),t.mutationObserverBefore.disconnect(),t.mutationObserverAfter.disconnect(),e.dispose(),delete rt[e._id])}},rt={};function it(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:it(e.parentElement):null}const st={getAndRemoveExistingTitle:function(){var e;const t=document.head?document.head.getElementsByTagName("title"):[];if(0===t.length)return null;let n=null;for(let o=t.length-1;o>=0;o--){const r=t[o],i=r.previousSibling;i instanceof Comment&&null!==X(i)||(null===n&&(n=r.textContent),null===(e=r.parentNode)||void 0===e||e.removeChild(r))}return n}},at={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,o,r){const i=ct(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){var t;const i=Math.min(1,o/s.width),a=Math.min(1,r/s.height),c=Math.min(i,a),l=document.createElement("canvas");l.width=Math.round(s.width*c),l.height=Math.round(s.height*c),null===(t=l.getContext("2d"))||void 0===t||t.drawImage(s,0,0,l.width,l.height),l.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:i.lastModified,name:i.name,size:(null==a?void 0:a.size)||0,contentType:n,blob:a||i.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return ct(e,t).blob}};function ct(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 lt=new Set,ht={enableNavigationPrompt:function(e){0===lt.size&&window.addEventListener("beforeunload",dt),lt.add(e)},disableNavigationPrompt:function(e){lt.delete(e),0===lt.size&&window.removeEventListener("beforeunload",dt)}};function dt(e){e.preventDefault(),e.returnValue=!0}async function ut(e,t,n){return e instanceof Blob?await async function(e,t,n){const o=e.slice(t,t+n),r=await o.arrayBuffer();return new Uint8Array(r)}(e,t,n):function(e,t,n){return new Uint8Array(e.buffer,e.byteOffset+t,n)}(e,t,n)}const pt=new Map,ft={navigateTo:function(e,t,n=!1){Ke(e,t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n})},registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(i.has(e))throw new Error(`The event '${e}' is already registered.`);if(t.browserEventName){const n=s.get(t.browserEventName);n?n.push(e):s.set(t.browserEventName,[e]),a.forEach((n=>n(e,t.browserEventName)))}i.set(e,t)},rootComponents:v,runtime:{},_internal:{navigationManager:Je,domWrapper:nt,Virtualize:ot,PageTitle:st,InputFile:at,NavigationLock:ht,getJSDataStreamChunk:ut,attachWebRendererInterop:function(t,n,o,r){if(S.has(t))throw new Error(`Interop methods are already registered for renderer ${t}`);S.set(t,n),Object.keys(o).length>0&&function(t,n,o){if(g)throw new Error("Dynamic root components have already been enabled.");g=t,m=n;for(const[t,r]of Object.entries(o)){const o=e.findJSFunction(t,0);for(const e of r)o(e,n[e])}}(N(t),o,r),k(),function(e){const t=C.get(e);t&&(C.delete(e),I.delete(e),t())}(t)}}};window.Blazor=ft;const gt=[0,2e3,1e4,3e4,null];class mt{constructor(e){this._retryDelays=void 0!==e?[...e,null]:gt}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class yt{}yt.Authorization="Authorization",yt.Cookie="Cookie";class vt{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class wt{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""}}class bt extends wt{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[yt.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[yt.Authorization]&&delete e.headers[yt.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}class _t extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class Et extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class St extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class Ct extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class It extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class kt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class Tt extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class Dt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}var xt;!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"}(xt||(xt={}));class At{constructor(){}log(e,t){}}At.instance=new At;const Nt="0.0.0-DEV_BUILD";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 Pt{static get isBrowser(){return!Pt.isNode&&"object"==typeof window&&"object"==typeof window.document}static get isWebWorker(){return!Pt.isNode&&"object"==typeof self&&"importScripts"in self}static get isReactNative(){return!Pt.isNode&&"object"==typeof window&&void 0===window.document}static get isNode(){return"undefined"!=typeof process&&process.release&&"node"===process.release.name}}function Ut(e,t){let n="";return Mt(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.substr(0,n.length-1)}(e)}'`)):"string"==typeof e&&(n=`String data of length ${e.length}`,t&&(n+=`. Content: '${e}'`)),n}function Mt(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function Lt(e,t,n,o,r,i){const s={},[a,c]=Bt();s[a]=c,e.log(xt.Trace,`(${t} transport) sending data. ${Ut(r,i.logMessageContent)}.`);const l=Mt(r)?"arraybuffer":"text",h=await n.post(o,{content:r,headers:{...s,...i.headers},responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});e.log(xt.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}class Ft{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 Ot{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${xt[e]}: ${t}`;switch(e){case xt.Critical:case xt.Error:this.out.error(n);break;case xt.Warning:this.out.warn(n);break;case xt.Information:this.out.info(n);break;default:this.out.log(n)}}}}function Bt(){let e="X-SignalR-User-Agent";return Pt.isNode&&(e="User-Agent"),[e,$t(Nt,Ht(),Pt.isNode?"NodeJS":"Browser",jt())]}function $t(e,t,n,o){let r="Microsoft SignalR/";const i=e.split(".");return r+=`${i[0]}.${i[1]}`,r+=` (${e}; `,r+=t&&""!==t?`${t}; `:"Unknown OS; ",r+=`${n}`,r+=o?`; ${o}`:"; Unknown Runtime Version",r+=")",r}function Ht(){if(!Pt.isNode)return"";switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}}function jt(){if(Pt.isNode)return process.versions.node}function Wt(e){return e.stack?e.stack:e.message?e.message:`${e}`}class zt extends wt{constructor(e){super(),this._logger=e;const t={_fetchType:void 0,_jar:void 0};var o;o=t,"undefined"==typeof fetch&&(o._jar=new(n(628).CookieJar),"undefined"==typeof fetch?o._fetchType=n(200):o._fetchType=fetch,o._fetchType=n(203)(o._fetchType,o._jar),1)?(this._fetchType=t._fetchType,this._jar=t._jar):this._fetchType=fetch.bind(function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw new Error("could not find global")}()),this._abortControllerType=AbortController;const r={_abortControllerType:this._abortControllerType};(function(e){return"undefined"==typeof AbortController&&(e._abortControllerType=n(778),!0)})(r)&&(this._abortControllerType=r._abortControllerType)}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new St;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 St});let o,r=null;if(e.timeout){const o=e.timeout;r=setTimeout((()=>{t.abort(),this._logger.log(xt.Warning,"Timeout from HTTP request."),n=new Et}),o)}""===e.content&&(e.content=void 0),e.content&&(e.headers=e.headers||{},Mt(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");try{o=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(xt.Warning,`Error from HTTP request. ${e}.`),e}finally{r&&clearTimeout(r),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const e=await Jt(o,"text");throw new _t(e||o.statusText,o.status)}const i=Jt(o,e.responseType),s=await i;return new vt(o.status,o.statusText,s)}getCookieString(e){return""}}function Jt(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 qt extends wt{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new St):e.method?e.url?new Promise(((t,n)=>{const o=new XMLHttpRequest;o.open(e.method,e.url,!0),o.withCredentials=void 0===e.withCredentials||e.withCredentials,o.setRequestHeader("X-Requested-With","XMLHttpRequest"),""===e.content&&(e.content=void 0),e.content&&(Mt(e.content)?o.setRequestHeader("Content-Type","application/octet-stream"):o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const r=e.headers;r&&Object.keys(r).forEach((e=>{o.setRequestHeader(e,r[e])})),e.responseType&&(o.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{o.abort(),n(new St)}),e.timeout&&(o.timeout=e.timeout),o.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),o.status>=200&&o.status<300?t(new vt(o.status,o.statusText,o.response||o.responseText)):n(new _t(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(xt.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new _t(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(xt.Warning,"Timeout from HTTP request."),n(new Et)},o.send(e.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Kt extends wt{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new zt(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new qt(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new St):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}var Vt,Xt,Gt,Yt;!function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(Vt||(Vt={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(Xt||(Xt={}));class Qt{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 Zt{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new Qt,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,Xt,"transferFormat"),this._url=e,this._logger.log(xt.Trace,"(LongPolling transport) Connecting."),t===Xt.Binary&&"undefined"!=typeof XMLHttpRequest&&"string"!=typeof(new XMLHttpRequest).responseType)throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[n,o]=Bt(),r={[n]:o,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:r,timeout:1e5,withCredentials:this._options.withCredentials};t===Xt.Binary&&(i.responseType="arraybuffer");const s=`${e}&_=${Date.now()}`;this._logger.log(xt.Trace,`(LongPolling transport) polling: ${s}.`);const a=await this._httpClient.get(s,i);200!==a.statusCode?(this._logger.log(xt.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new _t(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(xt.Trace,`(LongPolling transport) polling: ${n}.`);const o=await this._httpClient.get(n,t);204===o.statusCode?(this._logger.log(xt.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==o.statusCode?(this._logger.log(xt.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new _t(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(xt.Trace,`(LongPolling transport) data received. ${Ut(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(xt.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof Et?this._logger.log(xt.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(xt.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}finally{this._logger.log(xt.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?Lt(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(xt.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(xt.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=Bt();e[t]=n;const o={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let r;try{await this._httpClient.delete(this._url,o)}catch(e){r=e}r?r instanceof _t&&(404===r.statusCode?this._logger.log(xt.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(xt.Trace,`(LongPolling transport) Error sending a DELETE request: ${r}`)):this._logger.log(xt.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(xt.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(xt.Trace,e),this.onclose(this._closeError)}}}class en{constructor(e,t,n,o){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=o,this.onreceive=null,this.onclose=null}async connect(e,t){return Rt.isRequired(e,"url"),Rt.isRequired(t,"transferFormat"),Rt.isIn(t,Xt,"transferFormat"),this._logger.log(xt.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise(((n,o)=>{let r,i=!1;if(t===Xt.Text){if(Pt.isBrowser||Pt.isWebWorker)r=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const t=this._httpClient.getCookieString(e),n={};n.Cookie=t;const[o,i]=Bt();n[o]=i,r=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...n,...this._options.headers}})}try{r.onmessage=e=>{if(this.onreceive)try{this._logger.log(xt.Trace,`(SSE transport) data received. ${Ut(e.data,this._options.logMessageContent)}.`),this.onreceive(e.data)}catch(e){return void this._close(e)}},r.onerror=e=>{i?this._close():o(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},r.onopen=()=>{this._logger.log(xt.Information,`SSE connected to ${this._url}`),this._eventSource=r,i=!0,n()}}catch(e){return void o(e)}}else o(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"))}))}async send(e){return this._eventSource?Lt(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 tn{constructor(e,t,n,o,r,i){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=o,this._webSocketConstructor=r,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,Xt,"transferFormat"),this._logger.log(xt.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise(((o,r)=>{let i;e=e.replace(/^http/,"ws");const s=this._httpClient.getCookieString(e);let a=!1;if(Pt.isReactNative){const t={},[o,r]=Bt();t[o]=r,n&&(t[yt.Authorization]=`Bearer ${n}`),s&&(t[yt.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===Xt.Binary&&(i.binaryType="arraybuffer"),i.onopen=t=>{this._logger.log(xt.Information,`WebSocket connected to ${e}.`),this._webSocket=i,a=!0,o()},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(xt.Information,`(WebSockets transport) ${t}.`)},i.onmessage=e=>{if(this._logger.log(xt.Trace,`(WebSockets transport) data received. ${Ut(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.",r(new Error(t))}}}))}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(xt.Trace,`(WebSockets transport) sending data. ${Ut(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(xt.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 nn{constructor(e,t={}){var n;if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Rt.isRequired(e,"url"),this._logger=void 0===(n=t.logger)?new Ot(xt.Information):null===n?At.instance:void 0!==n.log?n:new Ot(n),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 bt(t.httpClient||new Kt(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||Xt.Binary,Rt.isIn(e,Xt,"transferFormat"),this._logger.log(xt.Debug,`Starting connection with transfer format '${Xt[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(xt.Error,e),await this._stopPromise,Promise.reject(new St(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(xt.Error,e),Promise.reject(new St(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 on(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(xt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(xt.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(xt.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(xt.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!==Vt.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(Vt.WebSockets),await this._startTransport(t,e)}else{let n=null,o=0;do{if(n=await this._getNegotiationResponse(t),"Disconnecting"===this._connectionState||"Disconnected"===this._connectionState)throw new St("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}o++}while(n.url&&o<100);if(100===o&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(t,this._options.transport,n,e)}this.transport instanceof Zt&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(xt.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(xt.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,o]=Bt();t[n]=o;const r=this._resolveNegotiateUrl(e);this._logger.log(xt.Debug,`Sending negotiation request: ${r}.`);try{const e=await this._httpClient.post(r,{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}catch(e){let t="Failed to complete negotiation with the server: "+e;return e instanceof _t&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(xt.Error,t),Promise.reject(new Tt(t))}}_createConnectUrl(e,t){return t?e+(-1===e.indexOf("?")?"?":"&")+`id=${t}`:e}async _createTransport(e,t,n,o){let r=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t))return this._logger.log(xt.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,await this._startTransport(r,o),void(this.connectionId=n.connectionId);const i=[],s=n.availableTransports||[];let a=n;for(const n of s){const s=this._resolveTransportOrError(n,t,o);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)}r=this._createConnectUrl(e,a.connectionToken)}try{return await this._startTransport(r,o),void(this.connectionId=a.connectionId)}catch(e){if(this._logger.log(xt.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,i.push(new kt(`${n.transport} failed: ${e}`,Vt[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(xt.Debug,e),Promise.reject(new St(e))}}}}return i.length>0?Promise.reject(new Dt(`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 Vt.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new tn(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Vt.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new en(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Vt.LongPolling:return new Zt(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.transport.onclose=e=>this._stopConnection(e),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n){const o=Vt[e.transport];if(null==o)return this._logger.log(xt.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||0!=(t&e)}(t,o))return this._logger.log(xt.Debug,`Skipping transport '${Vt[o]}' because it was disabled by the client.`),new It(`'${Vt[o]}' is disabled by the client.`,o);if(!(e.transferFormats.map((e=>Xt[e])).indexOf(n)>=0))return this._logger.log(xt.Debug,`Skipping transport '${Vt[o]}' because it does not support the requested transfer format '${Xt[n]}'.`),new Error(`'${Vt[o]}' does not support ${Xt[n]}.`);if(o===Vt.WebSockets&&!this._options.WebSocket||o===Vt.ServerSentEvents&&!this._options.EventSource)return this._logger.log(xt.Debug,`Skipping transport '${Vt[o]}' because it is not supported in your environment.'`),new Ct(`'${Vt[o]}' is not supported in your environment.`,o);this._logger.log(xt.Debug,`Selecting transport '${Vt[o]}'.`);try{return this._constructTransport(o)}catch(e){return e}}_isITransport(e){return e&&"object"==typeof e&&"connect"in e}_stopConnection(e){if(this._logger.log(xt.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(xt.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(xt.Error,`Connection disconnected with error '${e}'.`):this._logger.log(xt.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(xt.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(xt.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(xt.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(!Pt.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(xt.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=e.indexOf("?");let n=e.substring(0,-1===t?e.length:t);return"/"!==n[n.length-1]&&(n+="/"),n+="negotiate",n+=-1===t?"":e.substring(t),-1===n.indexOf("negotiateVersion")&&(n+=-1===t?"?":"&",n+="negotiateVersion="+this._negotiateVersion),n}}class on{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new rn,this._transportResult=new rn,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new rn),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 rn;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):on._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 o=0;for(const t of e)n.set(new Uint8Array(t),o),o+=t.byteLength;return n.buffer}}class rn{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class sn{static write(e){return`${e}${sn.RecordSeparator}`}static parse(e){if(e[e.length-1]!==sn.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(sn.RecordSeparator);return t.pop(),t}}sn.RecordSeparatorCode=30,sn.RecordSeparator=String.fromCharCode(sn.RecordSeparatorCode);class an{writeHandshakeRequest(e){return sn.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(Mt(e)){const o=new Uint8Array(e),r=o.indexOf(sn.RecordSeparatorCode);if(-1===r)throw new Error("Message is incomplete.");const i=r+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(o.slice(0,i))),n=o.byteLength>i?o.slice(i).buffer:null}else{const o=e,r=o.indexOf(sn.RecordSeparator);if(-1===r)throw new Error("Message is incomplete.");const i=r+1;t=o.substring(0,i),n=o.length>i?o.substring(i):null}const o=sn.parse(t),r=JSON.parse(o[0]);if(r.type)throw new Error("Expected a handshake response from the server.");return[n,r]}}!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"}(Gt||(Gt={}));class cn{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 Ft(this,e)}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}(Yt||(Yt={}));class ln{static create(e,t,n,o,r,i){return new ln(e,t,n,o,r,i)}constructor(e,t,n,o,r,i){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(xt.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!=r?r:3e4,this.keepAliveIntervalInMilliseconds=null!=i?i:15e3,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=o,this._handshakeProtocol=new an,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=Yt.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:Gt.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!==Yt.Disconnected&&this._connectionState!==Yt.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!==Yt.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=Yt.Connecting,this._logger.log(xt.Debug,"Starting HubConnection.");try{await this._startInternal(),Pt.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=Yt.Connected,this._connectionStarted=!0,this._logger.log(xt.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=Yt.Disconnected,this._logger.log(xt.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{const t={protocol:this._protocol.name,version:this._protocol.version};if(this._logger.log(xt.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(t)),this._logger.log(xt.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(e){throw this._logger.log(xt.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._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch(e){}}_stopInternal(e){if(this._connectionState===Yt.Disconnected)return this._logger.log(xt.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===Yt.Disconnecting)return this._logger.log(xt.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=Yt.Disconnecting,this._logger.log(xt.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(xt.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===Yt.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new St("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,o]=this._replaceStreamingParams(t),r=this._createStreamInvocation(e,t,o);let i;const s=new cn;return s.cancelCallback=()=>{const e=this._createCancelInvocation(r.invocationId);return delete this._callbacks[r.invocationId],i.then((()=>this._sendWithProtocol(e)))},this._callbacks[r.invocationId]=(e,t)=>{t?s.error(t):e&&(e.type===Gt.Completion?e.error?s.error(new Error(e.error)):s.complete():s.next(e.item))},i=this._sendWithProtocol(r).catch((e=>{s.error(e),delete this._callbacks[r.invocationId]})),this._launchStreams(n,i),s}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){const[n,o]=this._replaceStreamingParams(t),r=this._sendWithProtocol(this._createInvocation(e,t,!0,o));return this._launchStreams(n,r),r}invoke(e,...t){const[n,o]=this._replaceStreamingParams(t),r=this._createInvocation(e,t,!1,o);return new Promise(((e,t)=>{this._callbacks[r.invocationId]=(n,o)=>{o?t(o):n&&(n.type===Gt.Completion?n.error?t(new Error(n.error)):e(n.result):t(new Error(`Unexpected message type: ${n.type}`)))};const o=this._sendWithProtocol(r).catch((e=>{t(e),delete this._callbacks[r.invocationId]}));this._launchStreams(n,o)}))}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 o=n.indexOf(t);-1!==o&&(n.splice(o,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)switch(e.type){case Gt.Invocation:this._invokeClientMethod(e);break;case Gt.StreamItem:case Gt.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===Gt.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(xt.Error,`Stream callback threw error: ${Wt(e)}`)}}break}case Gt.Ping:break;case Gt.Close:{this._logger.log(xt.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}default:this._logger.log(xt.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(xt.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(xt.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(xt.Debug,"Server handshake complete."),this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=(new Date).getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if(!(this.connection.features&&this.connection.features.inherentKeepAlive||(this._timeoutHandle=setTimeout((()=>this.serverTimeout()),this.serverTimeoutInMilliseconds),void 0!==this._pingServerHandle))){let e=this._nextKeepAlive-(new Date).getTime();e<0&&(e=0),this._pingServerHandle=setTimeout((async()=>{if(this._connectionState===Yt.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),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(xt.Warning,`No client method with the name '${t}' found.`),void(e.invocationId&&(this._logger.log(xt.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 o=n.slice(),r=!!e.invocationId;let i,s,a;for(const n of o)try{const o=i;i=await n.apply(this,e.arguments),r&&i&&o&&(this._logger.log(xt.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(xt.Error,`A callback for the method '${t}' threw error '${e}'.`)}a?await this._sendWithProtocol(a):r?(s?a=this._createCompletionMessage(e.invocationId,`${s}`,null):void 0!==i?a=this._createCompletionMessage(e.invocationId,null,i):(this._logger.log(xt.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(xt.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(xt.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new St("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===Yt.Disconnecting?this._completeClose(e):this._connectionState===Yt.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===Yt.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=Yt.Disconnected,this._connectionStarted=!1,Pt.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(xt.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}async _reconnect(e){const t=Date.now();let n=0,o=void 0!==e?e:new Error("Attempting to reconnect due to a unknown error."),r=this._getNextRetryDelay(n++,0,o);if(null===r)return this._logger.log(xt.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=Yt.Reconnecting,e?this._logger.log(xt.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(xt.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(xt.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==Yt.Reconnecting)return void this._logger.log(xt.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==r;){if(this._logger.log(xt.Information,`Reconnect attempt number ${n} will start in ${r} ms.`),await new Promise((e=>{this._reconnectDelayHandle=setTimeout(e,r)})),this._reconnectDelayHandle=void 0,this._connectionState!==Yt.Reconnecting)return void this._logger.log(xt.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=Yt.Connected,this._logger.log(xt.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(xt.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(xt.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==Yt.Reconnecting)return this._logger.log(xt.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===Yt.Disconnecting&&this._completeClose());o=e instanceof Error?e:new Error(e.toString()),r=this._getNextRetryDelay(n++,Date.now()-t,o)}}this._logger.log(xt.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(xt.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${n}'.`),null}}_cancelCallbacksWithError(e){const t=this._callbacks;this._callbacks={},Object.keys(t).forEach((n=>{const o=t[n];try{o(null,e)}catch(t){this._logger.log(xt.Error,`Stream 'error' callback called with '${e}' threw error: ${Wt(t)}`)}}))}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,n,o){if(n)return 0!==o.length?{arguments:t,streamIds:o,target:e,type:Gt.Invocation}:{arguments:t,target:e,type:Gt.Invocation};{const n=this._invocationId;return this._invocationId++,0!==o.length?{arguments:t,invocationId:n.toString(),streamIds:o,target:e,type:Gt.Invocation}:{arguments:t,invocationId:n.toString(),target:e,type:Gt.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 o;o=e instanceof Error?e.message:e&&e.toString?e.toString():"Unknown error",t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n,o))))},next:e=>{t=t.then((()=>this._sendWithProtocol(this._createStreamItemMessage(n,e))))}})}}_replaceStreamingParams(e){const t=[],n=[];for(let o=0;o=55296&&r<=56319&&o65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h)}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 In,kn=wn?new TextDecoder:null,Tn=wn?"undefined"!=typeof process&&"force"!==(null===(gn=null===process||void 0===process?void 0:process.env)||void 0===gn?void 0:gn.TEXT_DECODER)?200:0:mn,Dn=function(e,t){this.type=e,this.data=t},xn=(In=function(e,t){return In=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])},In(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}In(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),An=function(e){function t(n){var o=e.call(this,n)||this,r=Object.create(t.prototype);return Object.setPrototypeOf(o,r),Object.defineProperty(o,"name",{configurable:!0,enumerable:!1,value:t.name}),o}return xn(t,e),t}(Error),Nn={type:-1,encode:function(e){var t,n,o,r;return e instanceof Date?function(e){var t,n=e.sec,o=e.nsec;if(n>=0&&o>=0&&n<=17179869183){if(0===o&&n<=4294967295){var r=new Uint8Array(4);return(t=new DataView(r.buffer)).setUint32(0,n),r}var i=n/4294967296,s=4294967295&n;return r=new Uint8Array(8),(t=new DataView(r.buffer)).setUint32(0,o<<2|3&i),t.setUint32(4,s),r}return r=new Uint8Array(12),(t=new DataView(r.buffer)).setUint32(0,o),yn(t,4,n),r}((o=1e6*((t=e.getTime())-1e3*(n=Math.floor(t/1e3))),{sec:n+(r=Math.floor(o/1e9)),nsec:o-1e9*r})):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:vn(t,4),nsec:t.getUint32(0)};default:throw new An("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},Rn=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Nn)}return e.prototype.register=function(e){var t=e.type,n=e.encode,o=e.decode;if(t>=0)this.encoders[t]=n,this.decoders[t]=o;else{var r=1+t;this.builtInEncoders[r]=n,this.builtInDecoders[r]=o}},e.prototype.tryToEncode=function(e,t){for(var n=0;nthis.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=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>En){var t=bn(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),Sn(e,this.bytes,this.pos),this.pos+=t}else t=bn(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var o=e.length,r=n,i=0;i>6&31|192;else{if(s>=55296&&s<=56319&&i>12&15|224,t[r++]=s>>6&63|128):(t[r++]=s>>18&7|240,t[r++]=s>>12&63|128,t[r++]=s>>6&63|128)}t[r++]=63&s|128}else t[r++]=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 o=0,r=e;o0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,n){e:for(var o=0,r=this.caches[n-1];o=this.maxLengthPerKey?n[Math.random()*n.length|0]=o:n.push(o)},e.prototype.decode=function(e,t,n){var o=this.find(e,t,n);if(null!=o)return this.hit++,o;this.miss++;var r=Cn(e,t,n),i=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(i,r),r},e}(),Fn=function(e,t){var n,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((r=(r=s.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]=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 Fn(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,o,r,i,s,a;return i=this,void 0,a=function(){var i,s,a,c,l,h,d,u;return Fn(this,(function(p){switch(p.label){case 0:i=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=On(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 jn))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(),o={error:c},[3,12];case 7:return p.trys.push([7,,10,11]),n&&!n.done&&(r=t.return)?[4,r.call(t)]:[3,9];case 8:p.sent(),p.label=9;case 9:return[3,11];case 10:if(o)throw o.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,d=l.pos,u=l.totalPos,new RangeError("Insufficient data in parsing ".concat(Mn(h)," at ").concat(u," (").concat(d," in the current buffer)"))}}))},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{r(a.next(e))}catch(e){t(e)}}function o(e){try{r(a.throw(e))}catch(e){t(e)}}function r(t){var r;t.done?e(t.value):(r=t.value,r instanceof s?r:new s((function(e){e(r)}))).then(n,o)}r((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,o,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,s=function(){var n,o,r,i,s,a,c,l,h;return Fn(this,(function(d){switch(d.label){case 0:n=t,o=-1,d.label=1;case 1:d.trys.push([1,13,14,19]),r=On(e),d.label=2;case 2:return[4,Bn(r.next())];case 3:if((i=d.sent()).done)return[3,12];if(s=i.value,t&&0===o)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(o=this.readArraySize(),n=!1,this.complete()),d.label=4;case 4:d.trys.push([4,9,,10]),d.label=5;case 5:return[4,Bn(this.doDecodeSync())];case 6:return[4,d.sent()];case 7:return d.sent(),0==--o?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=d.sent())instanceof jn))throw a;return[3,10];case 10:this.totalPos+=this.pos,d.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return c=d.sent(),l={error:c},[3,19];case 14:return d.trys.push([14,,17,18]),i&&!i.done&&(h=r.return)?[4,Bn(h.call(r))]:[3,16];case 15:d.sent(),d.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,o||[]),a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(e){s[e]&&(i[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||l(e,t)}))})}function l(e,t){try{(n=s[e](t)).value instanceof Bn?Promise.resolve(n.value.v).then(h,d):u(a[0][2],n)}catch(e){u(a[0][3],e)}var n}function h(e){l("next",e)}function d(e){l("throw",e)}function u(e,t){e(t),a.shift(),a.length&&l(a[0][0],a[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!=(o=e-128)){this.pushMapState(o),this.complete();continue e}t={}}else if(e<160){if(0!=(o=e-144)){this.pushArrayState(o),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!==(o=this.readU16())){this.pushArrayState(o),this.complete();continue e}t=[]}else if(221===e){if(0!==(o=this.readU32())){this.pushArrayState(o),this.complete();continue e}t=[]}else if(222===e){if(0!==(o=this.readU16())){this.pushMapState(o),this.complete();continue e}t={}}else if(223===e){if(0!==(o=this.readU32())){this.pushMapState(o),this.complete();continue e}t={}}else if(196===e){var o=this.lookU8();t=this.decodeBinary(o,1)}else if(197===e)o=this.lookU16(),t=this.decodeBinary(o,2);else if(198===e)o=this.lookU32(),t=this.decodeBinary(o,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)o=this.lookU8(),t=this.decodeExtension(o,1);else if(200===e)o=this.lookU16(),t=this.decodeExtension(o,2);else{if(201!==e)throw new An("Unrecognized type byte: ".concat(Mn(e)));o=this.lookU32(),t=this.decodeExtension(o,4)}this.complete();for(var r=this.stack;r.length>0;){var i=r[r.length-1];if(0===i.type){if(i.array[i.position]=t,i.position++,i.position!==i.size)continue e;r.pop(),t=i.array}else{if(1===i.type){if("string"!=(s=typeof t)&&"number"!==s)throw new An("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new An("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}r.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 An("Unrecognized array type byte: ".concat(Mn(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new An("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 An("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 An("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthTn?function(e,t,n){var o=e.subarray(t,t+n);return kn.decode(o)}(this.bytes,r,e):Cn(this.bytes,r,e),this.pos+=t+e,o},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 An("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw Wn;var n=this.pos+t,o=this.bytes.subarray(n,n+e);return this.pos+=t+e,o},e.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new An("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var n=this.view.getInt8(this.pos+t),o=this.decodeBinary(e,t+1);return this.extensionCodec.decode(o,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=vn(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 o=new Uint8Array(n.length+t);return o.set(n,0),o.set(e,n.length),o.buffer}static parse(e){const t=[],n=new Uint8Array(e),o=[0,7,14,21,28];for(let r=0;r7)throw new Error("Messages bigger than 2GB are not supported.");if(!(n.byteLength>=r+s+a))throw new Error("Incomplete message.");t.push(n.slice?n.slice(r+s,r+s+a):n.subarray(r+s,r+s+a)),r=r+s+a}return t}}const Kn=new Uint8Array([145,Gt.Ping]);class Vn{constructor(e){this.name="messagepack",this.version=1,this.transferFormat=Xt.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new Un(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new Jn(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=At.instance);const o=qn.parse(e),r=[];for(const e of o){const n=this._parseMessage(e,t);n&&r.push(n)}return r}writeMessage(e){switch(e.type){case Gt.Invocation:return this._writeInvocation(e);case Gt.StreamInvocation:return this._writeStreamInvocation(e);case Gt.StreamItem:return this._writeStreamItem(e);case Gt.Completion:return this._writeCompletion(e);case Gt.Ping:return qn.write(Kn);case Gt.CancelInvocation:return this._writeCancelInvocation(e);case Gt.Close:return this._writeClose();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 o=n[0];switch(o){case Gt.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case Gt.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case Gt.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case Gt.Ping:return this._createPingMessage(n);case Gt.Close:return this._createCloseMessage(n);default:return t.log(xt.Information,"Unknown message type '"+o+"' 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:Gt.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:Gt.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:Gt.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:Gt.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:Gt.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 o,r;switch(n){case this._errorResult:o=t[4];break;case this._nonVoidResult:r=t[4]}return{error:o,headers:e,invocationId:t[2],result:r,type:Gt.Completion}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([Gt.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([Gt.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([Gt.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([Gt.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),qn.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([Gt.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([Gt.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([Gt.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([Gt.Completion,e.headers||{},e.invocationId,t,e.result])}return qn.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([Gt.CancelInvocation,e.headers||{},e.invocationId]);return qn.write(t.slice())}_writeClose(){const e=this._encoder.encode([Gt.Close,null]);return qn.write(e.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}let Xn=!1;function Gn(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),Xn||(Xn=!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()}})))}const Yn="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,Qn=Yn?Yn.decode.bind(Yn):function(e){let t=0;const n=e.length,o=[],r=[];for(;t65535&&(r-=65536,o.push(r>>>10&1023|55296),r=56320|1023&r),o.push(r)}o.length>1024&&(r.push(String.fromCharCode.apply(null,o)),o.length=0)}return r.push(String.fromCharCode.apply(null,o)),r.join("")},Zn=Math.pow(2,32),eo=Math.pow(2,21)-1;function to(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function no(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function oo(e,t){const n=no(e,t+4);if(n>eo)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*Zn+no(e,t)}class ro{constructor(e){this.batchData=e;const t=new co(e);this.arrayRangeReader=new lo(e),this.arrayBuilderSegmentReader=new ho(e),this.diffReader=new io(e),this.editReader=new so(e,t),this.frameReader=new ao(e,t)}updatedComponents(){return to(this.batchData,this.batchData.length-20)}referenceFrames(){return to(this.batchData,this.batchData.length-16)}disposedComponentIds(){return to(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return to(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return to(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return to(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return oo(this.batchData,n)}}class io{constructor(e){this.batchDataUint8=e}componentId(e){return to(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class so{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return to(this.batchDataUint8,e)}siblingIndex(e){return to(this.batchDataUint8,e+4)}newTreeIndex(e){return to(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return to(this.batchDataUint8,e+8)}removedAttributeName(e){const t=to(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class ao{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return to(this.batchDataUint8,e)}subtreeLength(e){return to(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=to(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return to(this.batchDataUint8,e+8)}elementName(e){const t=to(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=to(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=to(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=to(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=to(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return oo(this.batchDataUint8,e+12)}}class co{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=to(e,e.length-4)}readString(e){if(-1===e)return null;{const n=to(this.batchDataUint8,this.stringTableStartIndex+4*e),o=function(e,t){let n=0,o=0;for(let r=0;r<4;r++){const i=e[t+r];if(n|=(127&i)<this.nextBatchId)return this.fatalError?(this.logger.log(uo.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(uo.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(uo.Debug,`Applying batch ${e}.`),ke(po.Server,new ro(t)),await this.completeBatch(n,e)}catch(t){throw this.fatalError=t.toString(),this.logger.log(uo.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(uo.Warning,`Failed to deliver completion notification for render '${t}'.`)}}}class go{log(e,t){}}go.instance=new go;class mo{constructor(e){this.minLevel=e}log(e,t){if(e>=this.minLevel){const n=`[${(new Date).toISOString()}] ${uo[e]}: ${t}`;switch(e){case uo.Critical:case uo.Error:console.error(n);break;case uo.Warning:console.warn(n);break;case uo.Information:console.info(n);break;default:console.log(n)}}}}function yo(e,t){switch(t){case"webassembly":return bo(e,"webassembly");case"server":return function(e){return bo(e,"server").sort(((e,t)=>e.sequence-t.sequence))}(e);case"auto":return bo(e,"auto")}}const vo=/^\s*Blazor-Component-State:(?[a-zA-Z0-9+/=]+)$/;function wo(e){var t;if(e.nodeType===Node.COMMENT_NODE){const n=e.textContent||"",o=vo.exec(n),r=o&&o.groups&&o.groups.state;return r&&(null===(t=e.parentNode)||void 0===t||t.removeChild(e)),r}if(!e.hasChildNodes())return;const n=e.childNodes;for(let e=0;e.*)$/);function Eo(e,t){const n=e.currentElement;var o,r,i;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const s=_o.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 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:o}=e;if(o){for(;n.next()&&n.currentElement;){const e=n.currentElement;if(e.nodeType!==Node.COMMENT_NODE)continue;if(!e.textContent)continue;const t=_o.exec(e.textContent),r=t&&t[1];if(r)return ko(r,o),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 r=n,i=c,Io(o=s),{...o,uniqueId:So++,start:r,end:i};case"server":return function(e,t,n){return Co(e),{...e,uniqueId:So++,start:t,end:n}}(s,n,c);case"auto":return function(e,t,n){return Co(e),Io(e),{...e,uniqueId:So++,start:t,end:n}}(s,n,c)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}let So=0;function Co(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 Io(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 ko(e,t){const n=JSON.parse(e);if(1!==Object.keys(n).length)throw new Error(`Invalid end of component comment: '${e}'`);const o=n.prerenderId;if(!o)throw new Error(`End of component comment must have a value for the prerendered property: '${e}'`);if(o!==t)throw new Error(`End of component comment prerendered property must match the start comment prerender id: '${t}', '${o}'`)}class To{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndexDo(e)))),n=await e.invoke("StartCircuit",Je.getBaseURI(),Je.getLocationHref(),t,this.applicationState||"");return!!n&&(this.initialize(n),!0)}resolveElement(e,t){const n=w(e);if(n)return z(n,!0);const o=Number.parseInt(e);if(!Number.isNaN(o))return W(this.componentManager.resolveRootComponent(o,t));throw new Error(`Invalid sequence number or identifier '${e}'.`)}}const No={configureSignalR:e=>{},logLevel:uo.Warning,reconnectionOptions:{maxRetries:8,retryIntervalMilliseconds:2e4,dialogId:"components-reconnect-modal"}};class Ro{constructor(e,t,n,o){this.maxRetries=t,this.document=n,this.logger=o,this.addedToDom=!1,this.modal=this.document.createElement("div"),this.modal.id=e,this.maxRetries=t,this.modal.style.cssText=["position: fixed","top: 0","right: 0","bottom: 0","left: 0","z-index: 1050","display: none","overflow: hidden","background-color: #fff","opacity: 0.8","text-align: center","font-weight: bold","transition: visibility 0s linear 500ms"].join(";"),this.message=this.document.createElement("h5"),this.message.style.cssText="margin-top: 20px",this.button=this.document.createElement("button"),this.button.style.cssText="margin:5px auto 5px",this.button.textContent="Retry";const r=this.document.createElement("a");r.addEventListener("click",(()=>location.reload())),r.textContent="reload",this.reloadParagraph=this.document.createElement("p"),this.reloadParagraph.textContent="Alternatively, ",this.reloadParagraph.appendChild(r),this.modal.appendChild(this.message),this.modal.appendChild(this.button),this.modal.appendChild(this.reloadParagraph),this.loader=this.getLoader(),this.message.after(this.loader),this.button.addEventListener("click",(async()=>{this.show();try{await ft.reconnect()||this.rejected()}catch(e){this.logger.log(uo.Error,e),this.failed()}}))}show(){this.addedToDom||(this.addedToDom=!0,this.document.body.appendChild(this.modal)),this.modal.style.display="block",this.loader.style.display="inline-block",this.button.style.display="none",this.reloadParagraph.style.display="none",this.message.textContent="Attempting to reconnect to the server...",this.modal.style.visibility="hidden",setTimeout((()=>{this.modal.style.visibility="visible"}),0)}update(e){this.message.textContent=`Attempting to reconnect to the server: ${e} of ${this.maxRetries}`}hide(){this.modal.style.display="none"}failed(){this.button.style.display="block",this.reloadParagraph.style.display="none",this.loader.style.display="none";const e=this.document.createTextNode("Reconnection failed. Try "),t=this.document.createElement("a");t.textContent="reloading",t.setAttribute("href",""),t.addEventListener("click",(()=>location.reload()));const n=this.document.createTextNode(" the page if you're unable to reconnect.");this.message.replaceChildren(e,t,n)}rejected(){this.button.style.display="none",this.reloadParagraph.style.display="none",this.loader.style.display="none";const e=this.document.createTextNode("Could not reconnect to the server. "),t=this.document.createElement("a");t.textContent="Reload",t.setAttribute("href",""),t.addEventListener("click",(()=>location.reload()));const n=this.document.createTextNode(" the page to restore functionality.");this.message.replaceChildren(e,t,n)}getLoader(){const e=this.document.createElement("div");return e.style.cssText=["border: 0.3em solid #f3f3f3","border-top: 0.3em solid #3498db","border-radius: 50%","width: 2em","height: 2em","display: inline-block"].join(";"),e.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:2e3,iterations:1/0}),e}}class Po{constructor(e,t,n){this.dialog=e,this.maxRetries=t,this.document=n,this.document=n;const o=this.document.getElementById(Po.MaxRetriesId);o&&(o.innerText=this.maxRetries.toString())}show(){this.removeClasses(),this.dialog.classList.add(Po.ShowClassName)}update(e){const t=this.document.getElementById(Po.CurrentAttemptId);t&&(t.innerText=e.toString())}hide(){this.removeClasses(),this.dialog.classList.add(Po.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(Po.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(Po.RejectedClassName)}removeClasses(){this.dialog.classList.remove(Po.ShowClassName,Po.HideClassName,Po.FailedClassName,Po.RejectedClassName)}}Po.ShowClassName="components-reconnect-show",Po.HideClassName="components-reconnect-hide",Po.FailedClassName="components-reconnect-failed",Po.RejectedClassName="components-reconnect-rejected",Po.MaxRetriesId="components-reconnect-max-retries",Po.CurrentAttemptId="components-reconnect-current-attempt";class Uo{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||ft.reconnect}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new Po(t,e.maxRetries,document):new Ro(e.dialogId,e.maxRetries,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new Mo(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class Mo{constructor(e,t,n,o){this.logger=t,this.reconnectCallback=n,this.isDisposed=!1,this.reconnectDisplay=o,this.reconnectDisplay.show(),this.attemptPeriodicReconnection(e)}dispose(){this.isDisposed=!0,this.reconnectDisplay.hide()}async attemptPeriodicReconnection(e){for(let t=0;tMo.MaximumFirstRetryInterval?Mo.MaximumFirstRetryInterval:e.retryIntervalMilliseconds;if(await this.delay(n),this.isDisposed)break;try{return await this.reconnectCallback()?void 0:void this.reconnectDisplay.rejected()}catch(e){this.logger.log(uo.Error,e)}}this.reconnectDisplay.failed()}delay(e){return new Promise((t=>setTimeout(t,e)))}}Mo.MaximumFirstRetryInterval=3e3;class Lo{constructor(){this.afterStartedCallbacks=[]}async importInitializersAsync(e,t){await Promise.all(e.map((e=>async function(e,n){const o=function(e){const t=document.baseURI;return t.endsWith("/")?`${t}${e}`:`${t}/${e}`}(n),r=await import(o);if(void 0===r)return;const{beforeStart:i,afterStarted:s}=r;return s&&e.afterStartedCallbacks.push(s),i?i(...t):void 0}(this,e))))}async invokeAfterStartedCallbacks(e){await T,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let Fo,Oo,Bo,$o,Ho,jo=!1,Wo=!1;async function zo(e,t,n){var o,r;const i=new Vn;i.name="blazorpack";const s=(new un).withUrl("_blazor").withHubProtocol(i);e.configureSignalR(s);const a=s.build();a.on("JS.AttachComponent",((e,t)=>Ie(po.Server,n.resolveElement(t,e),e,!1))),a.on("JS.BeginInvokeJS",Bo.beginInvokeJSFromDotNet.bind(Bo)),a.on("JS.EndInvokeDotNet",Bo.endInvokeDotNetFromJS.bind(Bo)),a.on("JS.ReceiveByteArray",Bo.receiveByteArray.bind(Bo)),a.on("JS.BeginTransmitStream",(e=>{const t=new ReadableStream({start(t){a.stream("SendDotNetStreamToJS",e).subscribe({next:e=>t.enqueue(e),complete:()=>t.close(),error:e=>t.error(e)})}});Bo.supplyDotNetStream(e,t)}));const c=fo.getOrCreate(t);a.on("JS.RenderBatch",((e,n)=>{t.log(uo.Debug,`Received render batch with id ${e} and ${n.byteLength} bytes.`),c.processBatch(e,n,a)})),a.on("JS.EndLocationChanging",ft._internal.navigationManager.endLocationChanging),a.onclose((t=>!jo&&e.reconnectionHandler.onConnectionDown(e.reconnectionOptions,t))),a.on("JS.Error",(e=>{jo=!0,Jo(a,e,t),Gn()}));try{await a.start(),Fo=a}catch(e){if(Jo(a,e,t),"FailedToNegotiateWithServerError"===e.errorType)throw e;Gn(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===Vt.WebSockets))?t.log(uo.Error,"Unable to connect, please ensure you are using an updated browser that supports WebSockets."):e.innerErrors.some((e=>"FailedToStartTransportError"===e.errorType&&e.transport===Vt.WebSockets))?t.log(uo.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===Vt.LongPolling))&&t.log(uo.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(null===(r=null===(o=a.connection)||void 0===o?void 0:o.features)||void 0===r?void 0:r.inherentKeepAlive)&&t.log(uo.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."),a}function Jo(e,t,n){n.log(uo.Error,t),e&&e.stop()}function qo(e){return Ho=e,Ho}var Ko,Vo;const Xo=navigator,Go=Xo.userAgentData&&Xo.userAgentData.brands,Yo=Go&&Go.length>0?Go.some((e=>"Google Chrome"===e.brand||"Microsoft Edge"===e.brand||"Chromium"===e.brand)):window.chrome,Qo=null!==(Vo=null===(Ko=Xo.userAgentData)||void 0===Ko?void 0:Ko.platform)&&void 0!==Vo?Vo:navigator.platform;function Zo(e){return 0!==e.debugLevel&&(Yo||navigator.userAgent.includes("Firefox"))}let er,tr,nr,or,rr,ir;const sr=Math.pow(2,32),ar=Math.pow(2,21)-1;let cr=null;function lr(e){return tr.getI32(e)}const hr={load:function(e,t){return async function(e,t){const{dotnet:n}=await async function(e){if("undefined"==typeof WebAssembly||!WebAssembly.validate)throw new Error("This browser does not support WebAssembly.");let t="_framework/dotnet.js";if(e.loadBootResource){const n="dotnetjs",o=e.loadBootResource(n,"dotnet.js",t,"","js-module-dotnet");if("string"==typeof o)t=o;else if(o)throw new Error(`For a ${n} resource, custom loaders must supply a URI string.`)}const n=new URL(t,document.baseURI).toString();return await import(n)}(e),o=function(e,t){const n={maxParallelDownloads:1e6,enableDownloadRetry:!1,applicationEnvironment:e.environment},o={...window.Module||{},onConfigLoaded:async(n,{invokeLibraryInitializers:o})=>{var r,i;n.environmentVariables||(n.environmentVariables={}),"sharded"===n.globalizationMode&&(n.environmentVariables.__BLAZOR_SHARDED_ICU="1"),ft._internal.getApplicationEnvironment=()=>n.applicationEnvironment,null==t||t(n);const s=[e,null!==(i=null===(r=n.resources)||void 0===r?void 0:r.extensions)&&void 0!==i?i:{}];await o("beforeStart",s)},onDownloadResourceProgress:dr,config:n,disableDotnet6Compatibility:!1,out:pr,err:fr};return o}(e,t);e.applicationCulture&&n.withApplicationCulture(e.applicationCulture),e.environment&&n.withApplicationEnvironment(e.environment),e.loadBootResource&&n.withResourceLoader(e.loadBootResource),n.withModuleConfig(o),e.configureRuntime&&e.configureRuntime(n),ir=await n.create()}(e,t)},start:function(){return async function(){if(!ir)throw new Error("The runtime must be loaded it gets configured.");const{MONO:t,BINDING:n,Module:o,setModuleImports:r,INTERNAL:i,getConfig:s,invokeLibraryInitializers:a}=ir;nr=o,er=n,tr=t,rr=i,function(e){const t=Qo.match(/^Mac/i)?"Cmd":"Alt";Zo(e)&&console.info(`Debugging hotkey: Shift+${t}+D (when application has focus)`),document.addEventListener("keydown",(t=>{t.shiftKey&&(t.metaKey||t.altKey)&&"KeyD"===t.code&&(Zo(e)?navigator.userAgent.includes("Firefox")?async function(){const e=await fetch(`_framework/debug?url=${encodeURIComponent(location.href)}&isFirefox=true`);200!==e.status&&console.warn(await e.text())}():Yo?function(){const e=document.createElement("a");e.href=`_framework/debug?url=${encodeURIComponent(location.href)}`,e.target="_blank",e.rel="noopener noreferrer",e.click()}():console.error("Currently, only Microsoft Edge (80+), Google Chrome, or Chromium, are supported for debugging."):console.error("Cannot start debugging, because the application was not compiled with debugging enabled."))}))}(s()),ft.runtime=ir,ft._internal.dotNetCriticalError=fr,r("blazor-internal",{Blazor:{_internal:ft._internal}});const c=await ir.getAssemblyExports("Microsoft.AspNetCore.Components.WebAssembly");return Object.assign(ft._internal,{dotNetExports:{...c.Microsoft.AspNetCore.Components.WebAssembly.Services.DefaultWebAssemblyJSRuntime}}),or=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,o,r)=>{if(mr(),!o&&!t)throw new Error("Either assemblyName or dotNetObjectId must have a non null value.");const i=o?o.toString():t;ft._internal.dotNetExports.BeginInvokeDotNet(e?e.toString():null,i,n,r)},endInvokeJSFromDotNet:(e,t,n)=>{ft._internal.dotNetExports.EndInvokeJS(n)},sendByteArray:(e,t)=>{ft._internal.dotNetExports.ReceiveByteArrayFromJS(e,t)},invokeDotNetFromJS:(e,t,n,o)=>(mr(),ft._internal.dotNetExports.InvokeDotNet(e||null,t,null!=n?n:0,o))}),{invokeLibraryInitializers:a}}()},callEntryPoint:async function(){try{await ir.runMain(ir.getConfig().mainAssemblyName,[])}catch(e){console.error(e),Gn()}},toUint8Array:function(e){const t=gr(e),n=lr(t),o=new Uint8Array(n);return o.set(nr.HEAPU8.subarray(t+4,t+4+n)),o},getArrayLength:function(e){return lr(gr(e))},getArrayEntryPtr:function(e,t,n){return gr(e)+4+t*n},getObjectFieldsBaseAddress:function(e){return e+8},readInt16Field:function(e,t){return n=e+(t||0),tr.getI16(n);var n},readInt32Field:function(e,t){return lr(e+(t||0))},readUint64Field:function(e,t){return function(e){const t=e>>2,n=nr.HEAPU32[t+1];if(n>ar)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*sr+nr.HEAPU32[t]}(e+(t||0))},readFloatField:function(e,t){return n=e+(t||0),tr.getF32(n);var n},readObjectField:function(e,t){return lr(e+(t||0))},readStringField:function(e,t,n){const o=lr(e+(t||0));if(0===o)return null;if(n){const e=er.unbox_mono_obj(o);return"boolean"==typeof e?e?"":null:e}return er.conv_string(o)},readStructField:function(e,t){return e+(t||0)},beginHeapLock:function(){return mr(),cr=yr.create(),cr},invokeWhenHeapUnlocked:function(e){cr?cr.enqueuePostReleaseAction(e):e()}};function dr(e,t){const n=e/t*100;document.documentElement.style.setProperty("--blazor-load-percentage",`${n}%`),document.documentElement.style.setProperty("--blazor-load-percentage-text",`"${Math.floor(n)}%"`)}const ur=["DEBUGGING ENABLED"],pr=e=>ur.indexOf(e)<0&&console.log(e),fr=e=>{console.error(e||"(null)"),Gn()};function gr(e){return e+12}function mr(){if(cr)throw new Error("Assertion failed - heap is currently locked")}class yr{enqueuePostReleaseAction(e){this.postReleaseActions||(this.postReleaseActions=[]),this.postReleaseActions.push(e)}release(){var e;if(cr!==this)throw new Error("Trying to release a lock which isn't current");for(rr.mono_wasm_gc_unlock(),cr=null;null===(e=this.postReleaseActions)||void 0===e?void 0:e.length;)this.postReleaseActions.shift()(),mr()}static create(){return rr.mono_wasm_gc_lock(),new yr}}class vr{constructor(e){this.batchAddress=e,this.arrayRangeReader=wr,this.arrayBuilderSegmentReader=br,this.diffReader=_r,this.editReader=Er,this.frameReader=Sr}updatedComponents(){return Ho.readStructField(this.batchAddress,0)}referenceFrames(){return Ho.readStructField(this.batchAddress,wr.structLength)}disposedComponentIds(){return Ho.readStructField(this.batchAddress,2*wr.structLength)}disposedEventHandlerIds(){return Ho.readStructField(this.batchAddress,3*wr.structLength)}updatedComponentsEntry(e,t){return Cr(e,t,_r.structLength)}referenceFramesEntry(e,t){return Cr(e,t,Sr.structLength)}disposedComponentIdsEntry(e,t){const n=Cr(e,t,4);return Ho.readInt32Field(n)}disposedEventHandlerIdsEntry(e,t){const n=Cr(e,t,8);return Ho.readUint64Field(n)}}const wr={structLength:8,values:e=>Ho.readObjectField(e,0),count:e=>Ho.readInt32Field(e,4)},br={structLength:12,values:e=>{const t=Ho.readObjectField(e,0),n=Ho.getObjectFieldsBaseAddress(t);return Ho.readObjectField(n,0)},offset:e=>Ho.readInt32Field(e,4),count:e=>Ho.readInt32Field(e,8)},_r={structLength:4+br.structLength,componentId:e=>Ho.readInt32Field(e,0),edits:e=>Ho.readStructField(e,4),editsEntry:(e,t)=>Cr(e,t,Er.structLength)},Er={structLength:20,editType:e=>Ho.readInt32Field(e,0),siblingIndex:e=>Ho.readInt32Field(e,4),newTreeIndex:e=>Ho.readInt32Field(e,8),moveToSiblingIndex:e=>Ho.readInt32Field(e,8),removedAttributeName:e=>Ho.readStringField(e,16)},Sr={structLength:36,frameType:e=>Ho.readInt16Field(e,4),subtreeLength:e=>Ho.readInt32Field(e,8),elementReferenceCaptureId:e=>Ho.readStringField(e,16),componentId:e=>Ho.readInt32Field(e,12),elementName:e=>Ho.readStringField(e,16),textContent:e=>Ho.readStringField(e,16),markupContent:e=>Ho.readStringField(e,16),attributeName:e=>Ho.readStringField(e,16),attributeValue:e=>Ho.readStringField(e,24,!0),attributeEventHandlerId:e=>Ho.readUint64Field(e,8)};function Cr(e,t,n){return Ho.getArrayEntryPtr(e,t,n)}class Ir{constructor(e){this.componentManager=e}resolveRegisteredElement(e,t){const n=Number.parseInt(e);if(!Number.isNaN(n))return W(this.componentManager.resolveRootComponent(n,t))}getParameterValues(e){return this.componentManager.initialComponents[e].parameterValues}getParameterDefinitions(e){return this.componentManager.initialComponents[e].parameterDefinitions}getTypeName(e){return this.componentManager.initialComponents[e].typeName}getAssembly(e){return this.componentManager.initialComponents[e].assembly}getCount(){return this.componentManager.initialComponents.length}}let kr,Tr,Dr,xr=!1;const Ar=new Promise((e=>{Dr=e}));function Nr(e){if(kr)throw new Error("WebAssembly options have already been configured.");kr=e}function Rr(){return null!=Tr||(Tr=hr.load(null!=kr?kr:{},Dr)),Tr}function Pr(t,n,o,r){const i=hr.readStringField(t,0),s=hr.readInt32Field(t,4),a=hr.readStringField(t,8),c=hr.readUint64Field(t,20);if(null!==a){const e=hr.readUint64Field(t,12);if(0!==e)return or.beginInvokeJSFromDotNet(e,i,a,s,c),0;{const e=or.invokeJSFromDotNet(i,a,s,c);return null===e?0:er.js_string_to_mono_string(e)}}{const t=e.findJSFunction(i,c).call(null,n,o,r);switch(s){case e.JSCallResultType.Default:return t;case e.JSCallResultType.JSObjectReference:return e.createJSObjectReference(t).__jsObjectId;case e.JSCallResultType.JSStreamReference:{const n=e.createJSStreamReference(t),o=JSON.stringify(n);return er.js_string_to_mono_string(o)}case e.JSCallResultType.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${s}'.`)}}}function Ur(e,t,n,o,r){return 0!==r?(or.beginInvokeJSFromDotNet(r,e,o,n,t),null):or.invokeJSFromDotNet(e,o,n,t)}function Mr(e,t,n){or.endInvokeDotNetFromJS(e,t,n)}function Lr(e,t,n,o){!function(e,t,n,o,r){let i=pt.get(t);if(!i){const n=new ReadableStream({start(e){pt.set(t,e),i=e}});e.supplyDotNetStream(t,n)}r?(i.error(r),pt.delete(t)):0===o?(i.close(),pt.delete(t)):i.enqueue(n.length===o?n:n.subarray(0,o))}(or,e,t,n,o)}function Fr(e,t){or.receiveByteArray(e,t)}function Or(e,t){t.namespaceURI?e.setAttributeNS(t.namespaceURI,t.name,t.value):e.setAttribute(t.name,t.value)}var Br,$r;!function(e){e[e.None=0]="None",e[e.Some=1]="Some",e[e.Infinite=2]="Infinite"}(Br||(Br={})),function(e){e.Keep="keep",e.Update="update",e.Insert="insert",e.Delete="delete"}($r||($r={}));class Hr{static create(e,t,n){return 0===t&&n===e.length?e:new Hr(e,t,n)}constructor(e,t,n){this.source=e,this.startIndex=t,this.length=n}item(e){return this.source.item(e+this.startIndex)}forEach(e,t){for(let t=0;t=n&&s>=o&&r(e.item(i),t.item(s))===Br.None;)i--,s--,a++;return a}(e,t,o,o,n),i=function(e){var t;const n=[];let o=e.length-1,r=(null===(t=e[o])||void 0===t?void 0:t.length)-1;for(;o>0||r>0;){const t=0===o?$r.Insert:0===r?$r.Delete:e[o][r];switch(n.unshift(t),t){case $r.Keep:case $r.Update:o--,r--;break;case $r.Insert:r--;break;case $r.Delete:o--}}return n}(function(e,t,n){const o=[],r=[],i=e.length,s=t.length;if(0===i&&0===s)return[];for(let e=0;e<=i;e++)(o[e]=Array(s+1))[0]=e,r[e]=Array(s+1);const a=o[0];for(let e=1;e<=s;e++)a[e]=e;for(let a=1;a<=i;a++)for(let i=1;i<=s;i++){const s=n(e.item(a-1),t.item(i-1)),c=o[a-1][i]+1,l=o[a][i-1]+1;let h;switch(s){case Br.None:h=o[a-1][i-1];break;case Br.Some:h=o[a-1][i-1]+1;break;case Br.Infinite:h=Number.MAX_VALUE}h{history.pushState(null,"",e),ai(e)}))}function ii(e){Le()||ai(location.href)}function si(e){if(Le()||e.defaultPrevented)return;const t=e.target;if(t instanceof HTMLFormElement){e.preventDefault();const n=new URL(t.action),o={method:t.method},r=new FormData(t),i=e.submitter;i&&i.name&&r.append(i.name,i.value),"get"===o.method?n.search=new URLSearchParams(r).toString():o.body=r,ai(n.toString(),o)}}async function ai(e,t){zr=!0,null==jr||jr.abort(),jr=new AbortController;const n=jr.signal,o=fetch(e,Object.assign({signal:n,headers:{"blazor-enhanced-nav":"on"}},t));if(await async function(e,t,n,o){let r;try{r=await e;const t=r.headers.get("blazor-enhanced-nav-redirect-location");if(t)return void location.replace(t);if(!r.body)return void n(r,"");const o=r.headers.get("ssr-framing");if(!o){const e=await r.text();return void n(r,e)}let i=!0;await r.body.pipeThrough(new TextDecoderStream).pipeThrough(function(e){let t="";return new TransformStream({transform(n,o){if(t+=n,t.indexOf(e,t.length-n.length-e.length)>=0){const n=t.split(e);n.slice(0,-1).forEach((e=>o.enqueue(e))),t=n[n.length-1]}},flush(e){e.enqueue(t)}})}(`\x3c!--${o}--\x3e`)).pipeTo(new WritableStream({write(e){i?(i=!1,n(r,e)):(e=>{const t=document.createRange().createContextualFragment(e);for(;t.firstChild;)document.body.appendChild(t.firstChild)})(e)}}))}catch(e){if("AbortError"===e.name&&t.aborted)return;throw e}}(o,n,((n,o)=>{n.redirected&&(history.replaceState(null,"",n.url),e=n.url);const r=n.headers.get("content-type");if((null==r?void 0:r.startsWith("text/html"))&&o){const e=(new DOMParser).parseFromString(o,"text/html");qr(document,e),Wr.documentUpdated()}else(null==r?void 0:r.startsWith("text/"))&&o?ci(o):(n.status<200||n.status>=300)&&!o?ci(`Error: ${n.status} ${n.statusText}`):(null==t?void 0:t.method)&&"get"!==t.method?ci(`Error: ${t.method} request to ${e} returned non-HTML content of type ${r||"unspecified"}.`):(history.replaceState(null,"",e+"?"),location.replace(e))})),!n.aborted){const t=e.indexOf("#");if(t>=0){const n=e.substring(t+1),o=document.getElementById(n);null==o||o.scrollIntoView()}zr=!1,Wr.documentUpdated()}}function ci(e){document.documentElement.textContent=e;const t=document.documentElement.style;t.fontFamily="consolas, monospace",t.whiteSpace="pre-wrap",t.padding="1rem"}let li,hi=!0;class di extends HTMLElement{connectedCallback(){var e;null===(e=this.parentNode)||void 0===e||e.removeChild(this);const t=this.attachShadow({mode:"open"}),n=document.createElement("slot");t.appendChild(n),n.addEventListener("slotchange",(e=>{this.childNodes.forEach((e=>{if(e instanceof HTMLTemplateElement){const t=e.getAttribute("blazor-component-id");if(t)!function(e,t){const n=function(e){const t=`bl:${e}`,n=document.createNodeIterator(document,NodeFilter.SHOW_COMMENT);let o=null;for(;(o=n.nextNode())&&o.textContent!==t;);if(!o)return null;const r=`/bl:${e}`;let i=null;for(;(i=n.nextNode())&&i.textContent!==r;);return i?{startMarker:o,endMarker:i}:null}(e);if(n){const{startMarker:e,endMarker:o}=n;if(hi)qr({startExclusive:e,endExclusive:o},t);else{const n=o.parentNode,r=new Range;for(r.setStart(e,e.textContent.length),r.setEnd(o,0),r.deleteContents();t.childNodes[0];)n.insertBefore(t.childNodes[0],o)}li.documentUpdated()}}(t,e.content);else switch(e.getAttribute("type")){case"redirection":const t=e.content.textContent;Ne(t)?(history.replaceState(null,"",t),ai(t)):location.replace(t);break;case"error":ci(e.content.textContent||"Error")}}}))}))}}function ui(e){var t;const n=null===(t=e.resources)||void 0===t?void 0:t.hash,o=e.mainAssemblyName;return n&&o?{key:`blazor-resource-hash:${o}`,value:n}:null}let pi=!1;const fi=new class{constructor(){this._activeDescriptors=new Set,this._descriptorsPendingInteractivityById={},this._rootComponentInfoByDescriptor=new Map,this._hasPendingRootComponentUpdate=!1,this._hasStartedCircuit=!1,this._hasStartedLoadingWebAssembly=!1,this._hasLoadedWebAssembly=!1,this._hasStartedWebAssembly=!1,this._didWebAssemblyFailToLoadQuickly=!1,this.initialComponents=[],this.refreshAllRootComponentsAfter(x(po.Server)),this.refreshAllRootComponentsAfter(x(po.WebAssembly))}documentUpdated(){this.refreshAllRootComponents()}registerComponentDescriptor(e){"auto"!==e.type&&"webassembly"!==e.type||this.startLoadingWebAssemblyIfNotStarted(),this._activeDescriptors.add(e)}unregisterComponentDescriptor(e){this._activeDescriptors.delete(e)}async startLoadingWebAssemblyIfNotStarted(){if(this._hasStartedLoadingWebAssembly)return;this._hasStartedLoadingWebAssembly=!0,setTimeout((()=>{this._hasLoadedWebAssembly||this.onWebAssemblyFailedToLoadQuickly()}),ft._internal.loadWebAssemblyQuicklyTimeout);const e=Rr(),t=await Ar;(function(e){if(!e.cacheBootResources)return!1;const t=ui(e);if(!t)return!1;const n=window.localStorage.getItem(t.key);return t.value===n})(t)||this.onWebAssemblyFailedToLoadQuickly(),await e,this._hasLoadedWebAssembly=!0,function(e){const t=ui(e);t&&window.localStorage.setItem(t.key,t.value)}(t),this.refreshAllRootComponents()}onWebAssemblyFailedToLoadQuickly(){this._didWebAssemblyFailToLoadQuickly||(this._didWebAssemblyFailToLoadQuickly=!0,this.refreshAllRootComponents())}async startCircutIfNotStarted(){this._hasStartedCircuit||(this._hasStartedCircuit=!0,await async function(t){if(Wo)throw new Error("Blazor Server has already started.");Wo=!0;const n=function(e){const t={...No,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...No.reconnectionOptions,...e.reconnectionOptions}),t}($o),o=await async function(e){const t=await fetch("_blazor/initializers",{method:"GET",credentials:"include",cache:"no-cache"}),n=await t.json(),o=new Lo;return await o.importInitializersAsync(n,[e]),o}(n),r=new mo(n.logLevel);ft.reconnect=async e=>{if(jo)return!1;const t=e||await zo(n,r,Oo);return await Oo.reconnect(t)?(n.reconnectionHandler.onConnectionUp(),!0):(r.log(uo.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)},ft.defaultReconnectionHandler=new Uo(r),n.reconnectionHandler=n.reconnectionHandler||ft.defaultReconnectionHandler,r.log(uo.Information,"Starting up Blazor server-side application.");const i=wo(document);Oo=new Ao(t,i||""),ft._internal.navigationManager.listenForNavigationEvents(((e,t,n)=>Fo.send("OnLocationChanged",e,t,n)),((e,t,n,o)=>Fo.send("OnLocationChanging",e,t,n,o))),ft._internal.forceCloseConnection=()=>Fo.stop(),ft._internal.sendJSDataStream=(e,t,n)=>function(e,t,n,o){setTimeout((async()=>{let r=5,i=(new Date).valueOf();try{const s=t instanceof Blob?t.size:t.byteLength;let a=0,c=0;for(;a1)await e.send("ReceiveJSDataChunk",n,c,h,null);else{if(!await e.invoke("ReceiveJSDataChunk",n,c,h,null))break;const t=(new Date).valueOf(),o=t-i;i=t,r=Math.max(1,Math.round(500/Math.max(1,o)))}a+=l,c++}}catch(t){await e.send("ReceiveJSDataChunk",n,-1,null,t.toString())}}),0)}(Fo,e,t,n),Bo=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,o,r)=>{Fo.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,o||0,r)},endInvokeJSFromDotNet:(e,t,n)=>{Fo.send("EndInvokeJSFromDotNet",e,t,n)},sendByteArray:(e,t)=>{Fo.send("ReceiveByteArray",e,t)}});const s=await zo(n,r,Oo);if(!await Oo.startCircuit(s))return void r.log(uo.Error,"Failed to start the circuit.");let a=!1;const c=()=>{if(!a){const e=new FormData,t=Oo.circuitId;e.append("circuitId",t),a=navigator.sendBeacon("_blazor/disconnect",e)}};ft.disconnect=c,window.addEventListener("unload",c,{capture:!1,once:!0}),r.log(uo.Information,"Blazor server-side application started."),o.invokeAfterStartedCallbacks(ft)}(this))}async startWebAssemblyIfNotStarted(){this.startLoadingWebAssemblyIfNotStarted(),this._hasStartedWebAssembly||(this._hasStartedWebAssembly=!0,await async function(e){if(xr)throw new Error("Blazor WebAssembly has already started.");xr=!0,function(){if(window.parent!==window&&!window.opener&&window.frameElement){const e=window.sessionStorage&&window.sessionStorage["Microsoft.AspNetCore.Components.WebAssembly.Authentication.CachedAuthSettings"],t=e&&JSON.parse(e);return t&&t.redirect_uri&&location.href.startsWith(t.redirect_uri)}return!1}()&&await new Promise((()=>{}));const t=Rr();!function(e){const t=R;R=(e,n,o)=>{((e,t,n)=>{const o=function(e){return Se[e]}(e);o.eventDelegator.getHandler(t)&&hr.invokeWhenHeapUnlocked(n)})(e,n,(()=>t(e,n,o)))}}(),ft._internal.applyHotReload=(e,t,n,o)=>{or.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","ApplyHotReloadDelta",e,t,n,o)},ft._internal.getApplyUpdateCapabilities=()=>or.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","GetApplyUpdateCapabilities"),ft._internal.invokeJSFromDotNet=Pr,ft._internal.invokeJSJson=Ur,ft._internal.endInvokeDotNetFromJS=Mr,ft._internal.receiveWebAssemblyDotNetDataStream=Lr,ft._internal.receiveByteArray=Fr;const n=qo(hr);ft.platform=n,ft._internal.renderBatch=(e,t)=>{const n=hr.beginHeapLock();try{ke(e,new vr(t))}finally{n.release()}},ft._internal.navigationManager.listenForNavigationEvents((async(e,t,n)=>{await or.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChanged",e,t,n)}),(async(e,t,n,o)=>{const r=await or.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChangingAsync",t,n,o);ft._internal.navigationManager.endLocationChanging(e,r)}));const o=new Ir(e);let r;ft._internal.registeredComponents={getRegisteredComponentsCount:()=>o.getCount(),getAssembly:e=>o.getAssembly(e),getTypeName:e=>o.getTypeName(e),getParameterDefinitions:e=>o.getParameterDefinitions(e)||"",getParameterValues:e=>o.getParameterValues(e)||""},ft._internal.getPersistedState=()=>wo(document)||"",ft._internal.attachRootComponentToElement=(e,t,n)=>{const r=o.resolveRegisteredElement(e,t);r?Ie(n,r,t,!1):function(e,t,n){const o="::before";let r=!1;if(e.endsWith("::after"))e=e.slice(0,-7),r=!0;else if(e.endsWith(o))throw new Error(`The '${o}' selector is not supported.`);const i=w(e)||document.querySelector(e);if(!i)throw new Error(`Could not find any element matching selector '${e}'.`);Ie(n||0,z(i,!0),t,r)}(e,t,n)};try{await t,r=await n.start()}catch(e){throw new Error(`Failed to start platform. Reason: ${e}`)}n.callEntryPoint(),r.invokeLibraryInitializers("afterStarted",[ft])}(this))}async refreshAllRootComponentsAfter(e){await e,this._hasPendingRootComponentUpdate||(this._hasPendingRootComponentUpdate=!0,setTimeout((()=>{this.refreshAllRootComponents()}),0))}refreshAllRootComponents(){this._hasPendingRootComponentUpdate=!1,this.refreshRootComponents(this._activeDescriptors)}refreshRootComponents(e){const t=new Map;for(const n of e){const e=this.getRootComponentInfo(n),o=this.determinePendingOperation(n,e);if(!o)continue;const r=e.assignedRendererId;if(!r)throw new Error("Descriptors must be assigned a renderer ID before getting used as root components");let i=t.get(r);i||(i=[],t.set(r,i)),i.push(o)}for(const[e,r]of t)n=e,o=JSON.stringify(r),N(n).invokeMethodAsync("UpdateRootComponents",o);var n,o}resolveRendererIdForDescriptor(e){switch("auto"===e.type?this.getAutoRenderMode():e.type){case"server":return this.startCircutIfNotStarted(),po.Server;case"webassembly":return this.startWebAssemblyIfNotStarted(),po.WebAssembly;case null:return null}}getAutoRenderMode(){return this._hasLoadedWebAssembly?"webassembly":this._didWebAssemblyFailToLoadQuickly?"server":null}determinePendingOperation(e,t){if(function(e){return document.contains(e.start)}(e)){if(void 0===t.assignedRendererId){if(zr)return null;const n=this.resolveRendererIdForDescriptor(e);return null===n?null:D(n)?(t.assignedRendererId=n,t.uniqueIdAtLastUpdate=e.uniqueId,this._descriptorsPendingInteractivityById[e.uniqueId]=e,{type:"add",selectorId:e.uniqueId,marker:Do(e)}):null}if(t.uniqueIdAtLastUpdate===e.uniqueId)return null;if(void 0!==t.interactiveComponentId)return t.uniqueIdAtLastUpdate=e.uniqueId,{type:"update",componentId:t.interactiveComponentId,marker:Do(e)}}else if(this.unregisterComponentDescriptor(e),void 0!==t.interactiveComponentId)return{type:"remove",componentId:t.interactiveComponentId};return null}resolveRootComponent(e,t){const n=this._descriptorsPendingInteractivityById[e];if(!n)throw new Error(`Could not resolve a root component for descriptor with ID '${e}'.`);const o=this.getRootComponentInfo(n);if(void 0!==o.interactiveComponentId)throw new Error("Cannot resolve a root component for the same descriptor multiple times.");return o.interactiveComponentId=t,this.refreshRootComponents([n]),n}getRootComponentInfo(e){let t=this._rootComponentInfoByDescriptor.get(e);return t||(t={},this._rootComponentInfoByDescriptor.set(e,t)),t}};function gi(e){var t;if(pi)throw new Error("Blazor has already started.");return pi=!0,ft._internal.loadWebAssemblyQuicklyTimeout=3e3,function(e){if($o)throw new Error("Circuit options have already been configured.");$o=e}(null==e?void 0:e.circuit),Nr(null==e?void 0:e.webAssembly),Jr=fi,function(e,t){li=t,(null==e?void 0:e.disableDomPreservation)&&(hi=!1),customElements.define("blazor-ssr",di)}(null==e?void 0:e.ssr,fi),(null===(t=null==e?void 0:e.ssr)||void 0===t?void 0:t.disableDomPreservation)||(Wr=fi,document.addEventListener("click",ri),document.addEventListener("submit",si),window.addEventListener("popstate",ii),Te=oi),function(e){const t=Qr(document);for(const e of t)null==Jr||Jr.registerComponentDescriptor(e)}(),fi.documentUpdated(),Promise.resolve()}ft.start=gi,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&gi()})()})(); \ No newline at end of file +(()=>{var e={778:()=>{},77:()=>{},203:()=>{},200:()=>{},628:()=>{},321:()=>{}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),(()=>{"use strict";var e,t,o;!function(e){const t=[],n="__jsObjectId",o="__dotNetObject",r="__byte[]",i="__dotNetStream",s="__jsStreamReferenceLength";let a,c;class l{constructor(e){this._jsObject=e,this._cachedFunctions=new Map}findFunction(e){const t=this._cachedFunctions.get(e);if(t)return t;let n,o=this._jsObject;if(e.split(".").forEach((t=>{if(!(t in o))throw new Error(`Could not find '${e}' ('${t}' was undefined).`);n=o,o=o[t]})),o instanceof Function)return o=o.bind(n),this._cachedFunctions.set(e,o),o;throw new Error(`The value '${e}' is not a function.`)}getWrappedObject(){return this._jsObject}}const h={0:new l(window)};h[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let d,u=1;function p(e){t.push(e)}function f(e){if(e&&"object"==typeof e){h[u]=new l(e);const t={[n]:u};return u++,t}throw new Error(`Cannot create a JSObjectReference from the value '${e}'.`)}function g(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 o={[s]:t};try{const t=f(e);o[n]=t[n]}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return o}function m(e,n){c=e;const o=n?JSON.parse(n,((e,n)=>t.reduce(((t,n)=>n(e,t)),n))):null;return c=void 0,o}function y(){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 v(e);return void 0===a?a=t:a&&(a=null),t},e.attachReviver=p,e.invokeMethod=function(e,t,...n){return y().invokeDotNetStaticMethod(e,t,...n)},e.invokeMethodAsync=function(e,t,...n){return y().invokeDotNetStaticMethodAsync(e,t,...n)},e.createJSObjectReference=f,e.createJSStreamReference=g,e.disposeJSObjectReference=function(e){const t=e&&e[n];"number"==typeof t&&_(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(d=e.JSCallResultType||(e.JSCallResultType={}));class v{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,o){const r=m(this,t),i=I(b(e,o)(...r||[]),n);return null==i?null:T(this,i)}beginInvokeJSFromDotNet(e,t,n,o,r){const i=new Promise((e=>{const o=m(this,n);e(b(t,r)(...o||[]))}));e&&i.then((t=>T(this,[e,!0,I(t,o)]))).then((t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!0,t)),(t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,w(t)]))))}endInvokeDotNetFromJS(e,t,n){const o=t?m(this,n):new Error(n);this.completePendingCall(parseInt(e,10),t,o)}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,o){if(this._dotNetCallDispatcher.invokeDotNetFromJS){const r=T(this,o),i=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,r);return i?m(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,o){if(e&&n)throw new Error(`For instance method calls, assemblyName should be null. Received '${e}'.`);const r=this._nextAsyncCallId++,i=new Promise(((e,t)=>{this._pendingAsyncCalls[r]={resolve:e,reject:t}}));try{const i=T(this,o);this._dotNetCallDispatcher.beginInvokeDotNetFromJS(r,e,t,n,i)}catch(e){this.completePendingCall(r,!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 C;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 C;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 o=this._pendingAsyncCalls[e];delete this._pendingAsyncCalls[e],t?o.resolve(n):o.reject(n)}}function w(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function b(e,t){const n=h[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function _(e){delete h[e]}e.findJSFunction=b,e.disposeJSObjectReferenceById=_;class E{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{[o]:this._id}}}e.DotNetObject=E,p((function(e,t){if(t&&"object"==typeof t){if(t.hasOwnProperty(o))return new E(t[o],c);if(t.hasOwnProperty(n)){const e=t[n],o=h[e];if(o)return o.getWrappedObject();throw new Error(`JS object instance with Id '${e}' does not exist. It may have been disposed.`)}if(t.hasOwnProperty(r)){const e=t[r],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 S(n)}}return t}));class S{constructor(e){this._streamPromise=e}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class C{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function I(e,t){switch(t){case d.Default:return e;case d.JSObjectReference:return f(e);case d.JSStreamReference:return g(e);case d.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let k=0;function T(e,t){k=0,c=e;const n=JSON.stringify(t,D);return c=void 0,n}function D(e,t){if(t instanceof E)return t.serializeAsArg();if(t instanceof Uint8Array){c.getDotNetCallDispatcher().sendByteArray(k,t);const e={[r]:k};return k++,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"}(o||(o={}));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 i=new Map,s=new Map,a=[];function c(e){return i.get(e)}function l(e){const t=i.get(e);return(null==t?void 0:t.browserEventName)||e}function h(e,t){e.forEach((e=>i.set(e,t)))}function d(e){const t=[];for(let n=0;ne.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}}}}),h(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),h(["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}}),h(["focus","blur","focusin","focusout"],{createEventArgs:e=>({type:e.type})}),h(["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};var t}}),h(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","mouseleave","mouseenter","dblclick"],{createEventArgs:e=>u(e)}),h(["error"],{createEventArgs:e=>{return{message:(t=e).message,filename:t.filename,lineno:t.lineno,colno:t.colno,type:t.type};var t}}),h(["loadstart","timeout","abort","load","loadend","progress"],{createEventArgs:e=>{return{lengthComputable:(t=e).lengthComputable,loaded:t.loaded,total:t.total,type:t.type};var t}}),h(["touchcancel","touchend","touchmove","touchenter","touchleave","touchstart"],{createEventArgs:e=>{return{detail:(t=e).detail,touches:d(t.touches),targetTouches:d(t.targetTouches),changedTouches:d(t.changedTouches),ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type};var t}}),h(["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}}),h(["wheel","mousewheel"],{createEventArgs:e=>{return{...u(t=e),deltaX:t.deltaX,deltaY:t.deltaY,deltaZ:t.deltaZ,deltaMode:t.deltaMode};var t}}),h(["toggle"],{createEventArgs:()=>({})});const p=["date","datetime-local","month","time","week"],f=new Map;let g,m,y=0;const v={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const o="__bl-dynamic-root:"+(++y).toString();f.set(o,e);const r=await E().invokeMethodAsync("AddRootComponent",t,o),i=new _(r,m[t]);return await i.setParameters(n),i}};function w(e){const t=f.get(e);if(t)return f.delete(e),t}class b{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 b)}setParameters(e){const t={},n=Object.entries(e||{}),o=n.length;for(const[e,o]of n){const n=this._jsEventCallbackWrappers.get(e.toLowerCase());n&&o?(n.setCallback(o),t[e]=n.getJSObjectReference()):t[e]=o}return E().invokeMethodAsync("SetRootComponentParameters",this._componentId,o,t)}async dispose(){if(null!==this._componentId){await E().invokeMethodAsync("RemoveRootComponent",this._componentId),this._componentId=null;for(const e of this._jsEventCallbackWrappers.values())e.dispose()}}}function E(){if(!g)throw new Error("Dynamic root components have not been enabled in this application.");return g}const S=new Map,C=new Map,I=new Map;let k;const T=new Promise((e=>{k=e}));function D(e){return S.has(e)}function x(e){if(D(e))return Promise.resolve();let t=I.get(e);return t||(t=new Promise((t=>{C.set(e,t)})),I.set(e,t)),t}function A(e,t,n){return R(e,t.eventHandlerId,(()=>N(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function N(e){const t=S.get(e);if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let R=(e,t,n)=>n();const P=B(["abort","blur","canplay","canplaythrough","change","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"]),U={submit:!0},M=B(["click","dblclick","mousedown","mousemove","mouseup"]);class L{constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++L.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new F(this.onGlobalEvent.bind(this))}setListener(e,t,n,o){const r=this.getEventHandlerInfosForElement(e,!0),i=r.getHandler(t);if(i)this.eventInfoStore.update(i.eventHandlerId,n);else{const i={element:e,eventName:t,eventHandlerId:n,renderingComponentId:o};this.eventInfoStore.add(i),r.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)}}notifyAfterClick(e){this.afterClickCallbacks.push(e),this.eventInfoStore.addGlobalListener("click")}setStopPropagation(e,t,n){this.getEventHandlerInfosForElement(e,!0).stopPropagation(t,n)}setPreventDefault(e,t,n){this.getEventHandlerInfosForElement(e,!0).preventDefault(t,n)}onGlobalEvent(e){if(!(e.target instanceof Element))return;this.dispatchGlobalEventToAllElements(e.type,e);const t=(n=e.type,s.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 a=Object.prototype.hasOwnProperty.call(P,e);let l=!1;for(;o;){const u=o,p=this.getEventHandlerInfosForElement(u,!1);if(p){const n=p.getHandler(e);if(n&&(h=u,d=t.type,!((h instanceof HTMLButtonElement||h instanceof HTMLInputElement||h instanceof HTMLTextAreaElement||h instanceof HTMLSelectElement)&&Object.prototype.hasOwnProperty.call(M,d)&&h.disabled))){if(!s){const n=c(e);i=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},s=!0}Object.prototype.hasOwnProperty.call(U,t.type)&&t.preventDefault(),A(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=a||l?void 0:n.shift()}var h,d}getEventHandlerInfosForElement(e,t){return Object.prototype.hasOwnProperty.call(e,this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new O:null}}L.nextEventDelegatorId=0;class F{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={},a.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=l(e),Object.prototype.hasOwnProperty.call(this.countByEventName,e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=Object.prototype.hasOwnProperty.call(P,e);document.addEventListener(e,this.globalListener,t)}}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=l(t.eventName);0==--this.countByEventName[n]&&(delete this.countByEventName[n],document.removeEventListener(n,this.globalListener))}return t}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 O{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}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 B(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const $=Symbol(),H=Symbol(),j=Symbol();function W(e){const{start:t,end:n}=e,o=t[j];if(o){if(o!==e)throw new Error("The start component comment was already associated with another component descriptor.");return t}const r=t.parentNode;if(!r)throw new Error(`Comment not connected to the DOM ${t.textContent}`);const i=z(r,!0),s=Z(i);t[H]=i,t[j]=e;const a=z(t);if(n){const e=Z(a),o=Array.prototype.indexOf.call(s,a)+1;let r=null;for(;r!==n;){const n=s.splice(o,1)[0];if(!n)throw new Error("Could not find the end component comment in the parent logical node list");n[H]=t,e.push(n),r=n}}return a}function z(e,t){if($ 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 o=z(t,!0);o[H]=e,n.push(o)}))}return e[$]=n,e}function J(e){const t=Z(e);for(;t.length;)V(e,0)}function q(e,t){const n=document.createComment("!");return K(n,e,t),n}function K(e,t,n){const o=e;let r=e;if(te(e)){const t=ie(o);if(t!==e){const n=new Range;n.setStartBefore(e),n.setEndAfter(t),r=n.extractContents()}}const i=X(o);if(i){const e=Z(i),t=Array.prototype.indexOf.call(e,o);e.splice(t,1),delete o[H]}const s=Z(t);if(n0;)V(n,0)}const o=n;o.parentNode.removeChild(o)}function X(e){return e[H]||null}function G(e,t){return Z(e)[t]}function Y(e){return e[j]||null}function Q(e){const t=oe(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function Z(e){return e[$]}function ee(e){const t=Z(X(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}function te(e){return $ in e}function ne(e,t){const n=Z(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=ie(e.moveRangeStart)})),t.forEach((t=>{const o=document.createComment("marker");t.moveToBeforeMarker=o;const r=n[t.toSiblingIndex+1];r?r.parentNode.insertBefore(o,r):re(o,e)})),t.forEach((e=>{const t=e.moveToBeforeMarker,n=t.parentNode,o=e.moveRangeStart,r=e.moveRangeEnd;let i=o;for(;i;){const e=i.nextSibling;if(n.insertBefore(i,t),i===r)break;i=e}n.removeChild(t)})),t.forEach((e=>{n[e.toSiblingIndex]=e.moveRangeStart}))}function oe(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 re(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=ee(t);n?n.parentNode.insertBefore(e,n):re(e,X(t))}}}function ie(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=ee(e);if(t)return t.previousSibling;{const t=X(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:ie(t)}}function se(e){return`_bl_${e}`}const ae="__internalId";e.attachReviver(((e,t)=>t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,ae)&&"string"==typeof t[ae]?function(e){const t=`[${se(e)}]`;return document.querySelector(t)}(t[ae]):t));const ce="_blazorDeferredValue";function le(e){e instanceof HTMLOptionElement?pe(e):ce in e&&ue(e,e[ce])}function he(e){return"select-multiple"===e.type}function de(e,t){e.value=t||""}function ue(e,t){e instanceof HTMLSelectElement?he(e)?function(e,t){t||(t=[]);for(let n=0;n{Le()&&Ae(e,(e=>{Ve(e,!0,!1)}))}))}attachRootComponentToLogicalElement(e,t,n){if(be(t))throw new Error(`Root component '${e}' could not be attached because its target element is already associated with a root component`);we(t,!0),this.attachComponentToElement(e,t),this.rootComponentIds.add(e),n||(me[e]=t)}updateComponent(e,t,n,o){var r;const i=this.childComponentLocations[t];if(!i)throw new Error(`No element is currently associated with component ${t}`);const s=me[t];s&&(delete me[t],J(s),s instanceof Comment&&(s.textContent="!"));const a=null===(r=oe(i))||void 0===r?void 0:r.getRootNode(),c=a&&a.activeElement;this.applyEdits(e,t,i,0,n,o),c instanceof HTMLElement&&a&&a.activeElement!==c&&c.focus()}disposeComponent(e){if(this.rootComponentIds.delete(e)){const t=this.childComponentLocations[e];we(t,!1),J(t)}delete this.childComponentLocations[e]}disposeEventHandler(e){this.eventDelegator.removeListener(e)}attachComponentToElement(e,t){this.childComponentLocations[e]=t}applyEdits(e,n,o,r,i,s){let a,c=0,l=r;const h=e.arrayBuilderSegmentReader,d=e.editReader,u=e.frameReader,p=h.values(i),f=h.offset(i),g=f+h.count(i);for(let i=f;idocument.baseURI,getLocationHref:()=>location.href,scrollToElement:qe};function qe(e){const t=document.getElementById(e);return!!t&&(t.scrollIntoView(),!0)}function Ke(e,t,n=!1){const o=Ue(e);!t.forceLoad&&Ne(o)?tt()?Ve(o,!1,t.replaceHistoryEntry,t.historyEntryState,n):Pe(o,t.replaceHistoryEntry):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 Ve(e,t,n,o=void 0,r=!1){if(Ye(),function(e){const t=e.indexOf("#");return t>-1&&location.href.replace(location.hash,"")===e.substring(0,t)}(e))!function(e,t,n){Xe(e,t,n);const o=e.indexOf("#");o!==e.length-1&&qe(e.substring(o+1))}(e,n,o);else{if(!r&&Oe&&!await Qe(e,o,t))return;Ce=!0,Xe(e,n,o),await Ze(t)}}function Xe(e,t,n=void 0){t?history.replaceState({userState:n,_index:Be},"",e):(Be++,history.pushState({userState:n,_index:Be},"",e))}function Ge(e){return new Promise((t=>{const n=We;We=()=>{We=n,t()},history.go(e)}))}function Ye(){ze&&(ze(!1),ze=null)}function Qe(e,t,n){return new Promise((o=>{Ye(),je?($e++,ze=o,je($e,e,t,n)):o(!1)}))}async function Ze(e){var t;He&&await He(location.href,null===(t=history.state)||void 0===t?void 0:t.userState,e)}async function et(e){var t,n;We&&tt()&&await We(e),Be=null!==(n=null===(t=history.state)||void 0===t?void 0:t._index)&&void 0!==n?n:0}function tt(){return Le()||!Re()}const nt={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,t){const n=document.querySelector(e);n&&(n.hasAttribute("tabindex")||(n.tabIndex=-1),n.focus({preventScroll:!0}))}},ot={init:function(e,t,n,o=50){const r=it(t);(r||document.documentElement).style.overflowAnchor="none";const i=document.createRange();h(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const s=new IntersectionObserver((function(o){o.forEach((o=>{var r;if(!o.isIntersecting)return;i.setStartAfter(t),i.setEndBefore(n);const s=i.getBoundingClientRect().height,a=null===(r=o.rootBounds)||void 0===r?void 0:r.height;o.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",o.intersectionRect.top-o.boundingClientRect.top,s,a):o.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",o.boundingClientRect.bottom-o.intersectionRect.bottom,s,a)}))}),{root:r,rootMargin:`${o}px`});s.observe(t),s.observe(n);const a=l(t),c=l(n);function l(e){const t={attributes:!0},n=new MutationObserver(((n,o)=>{h(e.parentElement)&&(o.disconnect(),e.style.display="table-row",o.observe(e,t)),s.unobserve(e),s.observe(e)}));return n.observe(e,t),n}function h(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)}rt[e._id]={intersectionObserver:s,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const t=rt[e._id];t&&(t.intersectionObserver.disconnect(),t.mutationObserverBefore.disconnect(),t.mutationObserverAfter.disconnect(),e.dispose(),delete rt[e._id])}},rt={};function it(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:it(e.parentElement):null}const st={getAndRemoveExistingTitle:function(){var e;const t=document.head?document.head.getElementsByTagName("title"):[];if(0===t.length)return null;let n=null;for(let o=t.length-1;o>=0;o--){const r=t[o],i=r.previousSibling;i instanceof Comment&&null!==X(i)||(null===n&&(n=r.textContent),null===(e=r.parentNode)||void 0===e||e.removeChild(r))}return n}},at={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,o,r){const i=ct(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){var t;const i=Math.min(1,o/s.width),a=Math.min(1,r/s.height),c=Math.min(i,a),l=document.createElement("canvas");l.width=Math.round(s.width*c),l.height=Math.round(s.height*c),null===(t=l.getContext("2d"))||void 0===t||t.drawImage(s,0,0,l.width,l.height),l.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:i.lastModified,name:i.name,size:(null==a?void 0:a.size)||0,contentType:n,blob:a||i.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return ct(e,t).blob}};function ct(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 lt=new Set,ht={enableNavigationPrompt:function(e){0===lt.size&&window.addEventListener("beforeunload",dt),lt.add(e)},disableNavigationPrompt:function(e){lt.delete(e),0===lt.size&&window.removeEventListener("beforeunload",dt)}};function dt(e){e.preventDefault(),e.returnValue=!0}async function ut(e,t,n){return e instanceof Blob?await async function(e,t,n){const o=e.slice(t,t+n),r=await o.arrayBuffer();return new Uint8Array(r)}(e,t,n):function(e,t,n){return new Uint8Array(e.buffer,e.byteOffset+t,n)}(e,t,n)}const pt=new Map,ft={navigateTo:function(e,t,n=!1){Ke(e,t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n})},registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(i.has(e))throw new Error(`The event '${e}' is already registered.`);if(t.browserEventName){const n=s.get(t.browserEventName);n?n.push(e):s.set(t.browserEventName,[e]),a.forEach((n=>n(e,t.browserEventName)))}i.set(e,t)},rootComponents:v,runtime:{},_internal:{navigationManager:Je,domWrapper:nt,Virtualize:ot,PageTitle:st,InputFile:at,NavigationLock:ht,getJSDataStreamChunk:ut,attachWebRendererInterop:function(t,n,o,r){if(S.has(t))throw new Error(`Interop methods are already registered for renderer ${t}`);S.set(t,n),Object.keys(o).length>0&&function(t,n,o){if(g)throw new Error("Dynamic root components have already been enabled.");g=t,m=n;for(const[t,r]of Object.entries(o)){const o=e.findJSFunction(t,0);for(const e of r)o(e,n[e])}}(N(t),o,r),k(),function(e){const t=C.get(e);t&&(C.delete(e),I.delete(e),t())}(t)}}};window.Blazor=ft;const gt=[0,2e3,1e4,3e4,null];class mt{constructor(e){this._retryDelays=void 0!==e?[...e,null]:gt}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class yt{}yt.Authorization="Authorization",yt.Cookie="Cookie";class vt{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class wt{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""}}class bt extends wt{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[yt.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[yt.Authorization]&&delete e.headers[yt.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}class _t extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class Et extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class St extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class Ct extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class It extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class kt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class Tt extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class Dt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}var xt;!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"}(xt||(xt={}));class At{constructor(){}log(e,t){}}At.instance=new At;const Nt="0.0.0-DEV_BUILD";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 Pt{static get isBrowser(){return!Pt.isNode&&"object"==typeof window&&"object"==typeof window.document}static get isWebWorker(){return!Pt.isNode&&"object"==typeof self&&"importScripts"in self}static get isReactNative(){return!Pt.isNode&&"object"==typeof window&&void 0===window.document}static get isNode(){return"undefined"!=typeof process&&process.release&&"node"===process.release.name}}function Ut(e,t){let n="";return Mt(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.substr(0,n.length-1)}(e)}'`)):"string"==typeof e&&(n=`String data of length ${e.length}`,t&&(n+=`. Content: '${e}'`)),n}function Mt(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function Lt(e,t,n,o,r,i){const s={},[a,c]=Bt();s[a]=c,e.log(xt.Trace,`(${t} transport) sending data. ${Ut(r,i.logMessageContent)}.`);const l=Mt(r)?"arraybuffer":"text",h=await n.post(o,{content:r,headers:{...s,...i.headers},responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});e.log(xt.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}class Ft{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 Ot{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${xt[e]}: ${t}`;switch(e){case xt.Critical:case xt.Error:this.out.error(n);break;case xt.Warning:this.out.warn(n);break;case xt.Information:this.out.info(n);break;default:this.out.log(n)}}}}function Bt(){let e="X-SignalR-User-Agent";return Pt.isNode&&(e="User-Agent"),[e,$t(Nt,Ht(),Pt.isNode?"NodeJS":"Browser",jt())]}function $t(e,t,n,o){let r="Microsoft SignalR/";const i=e.split(".");return r+=`${i[0]}.${i[1]}`,r+=` (${e}; `,r+=t&&""!==t?`${t}; `:"Unknown OS; ",r+=`${n}`,r+=o?`; ${o}`:"; Unknown Runtime Version",r+=")",r}function Ht(){if(!Pt.isNode)return"";switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}}function jt(){if(Pt.isNode)return process.versions.node}function Wt(e){return e.stack?e.stack:e.message?e.message:`${e}`}class zt extends wt{constructor(e){super(),this._logger=e;const t={_fetchType:void 0,_jar:void 0};var o;o=t,"undefined"==typeof fetch&&(o._jar=new(n(628).CookieJar),"undefined"==typeof fetch?o._fetchType=n(200):o._fetchType=fetch,o._fetchType=n(203)(o._fetchType,o._jar),1)?(this._fetchType=t._fetchType,this._jar=t._jar):this._fetchType=fetch.bind(function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw new Error("could not find global")}()),this._abortControllerType=AbortController;const r={_abortControllerType:this._abortControllerType};(function(e){return"undefined"==typeof AbortController&&(e._abortControllerType=n(778),!0)})(r)&&(this._abortControllerType=r._abortControllerType)}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new St;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 St});let o,r=null;if(e.timeout){const o=e.timeout;r=setTimeout((()=>{t.abort(),this._logger.log(xt.Warning,"Timeout from HTTP request."),n=new Et}),o)}""===e.content&&(e.content=void 0),e.content&&(e.headers=e.headers||{},Mt(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");try{o=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(xt.Warning,`Error from HTTP request. ${e}.`),e}finally{r&&clearTimeout(r),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const e=await Jt(o,"text");throw new _t(e||o.statusText,o.status)}const i=Jt(o,e.responseType),s=await i;return new vt(o.status,o.statusText,s)}getCookieString(e){return""}}function Jt(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 qt extends wt{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new St):e.method?e.url?new Promise(((t,n)=>{const o=new XMLHttpRequest;o.open(e.method,e.url,!0),o.withCredentials=void 0===e.withCredentials||e.withCredentials,o.setRequestHeader("X-Requested-With","XMLHttpRequest"),""===e.content&&(e.content=void 0),e.content&&(Mt(e.content)?o.setRequestHeader("Content-Type","application/octet-stream"):o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const r=e.headers;r&&Object.keys(r).forEach((e=>{o.setRequestHeader(e,r[e])})),e.responseType&&(o.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{o.abort(),n(new St)}),e.timeout&&(o.timeout=e.timeout),o.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),o.status>=200&&o.status<300?t(new vt(o.status,o.statusText,o.response||o.responseText)):n(new _t(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(xt.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new _t(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(xt.Warning,"Timeout from HTTP request."),n(new Et)},o.send(e.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Kt extends wt{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new zt(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new qt(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new St):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}var Vt,Xt,Gt,Yt;!function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(Vt||(Vt={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(Xt||(Xt={}));class Qt{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 Zt{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new Qt,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,Xt,"transferFormat"),this._url=e,this._logger.log(xt.Trace,"(LongPolling transport) Connecting."),t===Xt.Binary&&"undefined"!=typeof XMLHttpRequest&&"string"!=typeof(new XMLHttpRequest).responseType)throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[n,o]=Bt(),r={[n]:o,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:r,timeout:1e5,withCredentials:this._options.withCredentials};t===Xt.Binary&&(i.responseType="arraybuffer");const s=`${e}&_=${Date.now()}`;this._logger.log(xt.Trace,`(LongPolling transport) polling: ${s}.`);const a=await this._httpClient.get(s,i);200!==a.statusCode?(this._logger.log(xt.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new _t(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(xt.Trace,`(LongPolling transport) polling: ${n}.`);const o=await this._httpClient.get(n,t);204===o.statusCode?(this._logger.log(xt.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==o.statusCode?(this._logger.log(xt.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new _t(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(xt.Trace,`(LongPolling transport) data received. ${Ut(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(xt.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof Et?this._logger.log(xt.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(xt.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}finally{this._logger.log(xt.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?Lt(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(xt.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(xt.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=Bt();e[t]=n;const o={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let r;try{await this._httpClient.delete(this._url,o)}catch(e){r=e}r?r instanceof _t&&(404===r.statusCode?this._logger.log(xt.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(xt.Trace,`(LongPolling transport) Error sending a DELETE request: ${r}`)):this._logger.log(xt.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(xt.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(xt.Trace,e),this.onclose(this._closeError)}}}class en{constructor(e,t,n,o){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=o,this.onreceive=null,this.onclose=null}async connect(e,t){return Rt.isRequired(e,"url"),Rt.isRequired(t,"transferFormat"),Rt.isIn(t,Xt,"transferFormat"),this._logger.log(xt.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise(((n,o)=>{let r,i=!1;if(t===Xt.Text){if(Pt.isBrowser||Pt.isWebWorker)r=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const t=this._httpClient.getCookieString(e),n={};n.Cookie=t;const[o,i]=Bt();n[o]=i,r=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...n,...this._options.headers}})}try{r.onmessage=e=>{if(this.onreceive)try{this._logger.log(xt.Trace,`(SSE transport) data received. ${Ut(e.data,this._options.logMessageContent)}.`),this.onreceive(e.data)}catch(e){return void this._close(e)}},r.onerror=e=>{i?this._close():o(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},r.onopen=()=>{this._logger.log(xt.Information,`SSE connected to ${this._url}`),this._eventSource=r,i=!0,n()}}catch(e){return void o(e)}}else o(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"))}))}async send(e){return this._eventSource?Lt(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 tn{constructor(e,t,n,o,r,i){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=o,this._webSocketConstructor=r,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,Xt,"transferFormat"),this._logger.log(xt.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise(((o,r)=>{let i;e=e.replace(/^http/,"ws");const s=this._httpClient.getCookieString(e);let a=!1;if(Pt.isReactNative){const t={},[o,r]=Bt();t[o]=r,n&&(t[yt.Authorization]=`Bearer ${n}`),s&&(t[yt.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===Xt.Binary&&(i.binaryType="arraybuffer"),i.onopen=t=>{this._logger.log(xt.Information,`WebSocket connected to ${e}.`),this._webSocket=i,a=!0,o()},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(xt.Information,`(WebSockets transport) ${t}.`)},i.onmessage=e=>{if(this._logger.log(xt.Trace,`(WebSockets transport) data received. ${Ut(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.",r(new Error(t))}}}))}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(xt.Trace,`(WebSockets transport) sending data. ${Ut(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(xt.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 nn{constructor(e,t={}){var n;if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Rt.isRequired(e,"url"),this._logger=void 0===(n=t.logger)?new Ot(xt.Information):null===n?At.instance:void 0!==n.log?n:new Ot(n),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 bt(t.httpClient||new Kt(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||Xt.Binary,Rt.isIn(e,Xt,"transferFormat"),this._logger.log(xt.Debug,`Starting connection with transfer format '${Xt[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(xt.Error,e),await this._stopPromise,Promise.reject(new St(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(xt.Error,e),Promise.reject(new St(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 on(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(xt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(xt.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(xt.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(xt.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!==Vt.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(Vt.WebSockets),await this._startTransport(t,e)}else{let n=null,o=0;do{if(n=await this._getNegotiationResponse(t),"Disconnecting"===this._connectionState||"Disconnected"===this._connectionState)throw new St("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}o++}while(n.url&&o<100);if(100===o&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(t,this._options.transport,n,e)}this.transport instanceof Zt&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(xt.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(xt.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,o]=Bt();t[n]=o;const r=this._resolveNegotiateUrl(e);this._logger.log(xt.Debug,`Sending negotiation request: ${r}.`);try{const e=await this._httpClient.post(r,{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}catch(e){let t="Failed to complete negotiation with the server: "+e;return e instanceof _t&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(xt.Error,t),Promise.reject(new Tt(t))}}_createConnectUrl(e,t){return t?e+(-1===e.indexOf("?")?"?":"&")+`id=${t}`:e}async _createTransport(e,t,n,o){let r=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t))return this._logger.log(xt.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,await this._startTransport(r,o),void(this.connectionId=n.connectionId);const i=[],s=n.availableTransports||[];let a=n;for(const n of s){const s=this._resolveTransportOrError(n,t,o);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)}r=this._createConnectUrl(e,a.connectionToken)}try{return await this._startTransport(r,o),void(this.connectionId=a.connectionId)}catch(e){if(this._logger.log(xt.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,i.push(new kt(`${n.transport} failed: ${e}`,Vt[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(xt.Debug,e),Promise.reject(new St(e))}}}}return i.length>0?Promise.reject(new Dt(`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 Vt.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new tn(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Vt.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new en(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Vt.LongPolling:return new Zt(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.transport.onclose=e=>this._stopConnection(e),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n){const o=Vt[e.transport];if(null==o)return this._logger.log(xt.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||0!=(t&e)}(t,o))return this._logger.log(xt.Debug,`Skipping transport '${Vt[o]}' because it was disabled by the client.`),new It(`'${Vt[o]}' is disabled by the client.`,o);if(!(e.transferFormats.map((e=>Xt[e])).indexOf(n)>=0))return this._logger.log(xt.Debug,`Skipping transport '${Vt[o]}' because it does not support the requested transfer format '${Xt[n]}'.`),new Error(`'${Vt[o]}' does not support ${Xt[n]}.`);if(o===Vt.WebSockets&&!this._options.WebSocket||o===Vt.ServerSentEvents&&!this._options.EventSource)return this._logger.log(xt.Debug,`Skipping transport '${Vt[o]}' because it is not supported in your environment.'`),new Ct(`'${Vt[o]}' is not supported in your environment.`,o);this._logger.log(xt.Debug,`Selecting transport '${Vt[o]}'.`);try{return this._constructTransport(o)}catch(e){return e}}_isITransport(e){return e&&"object"==typeof e&&"connect"in e}_stopConnection(e){if(this._logger.log(xt.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(xt.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(xt.Error,`Connection disconnected with error '${e}'.`):this._logger.log(xt.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(xt.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(xt.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(xt.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(!Pt.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(xt.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=e.indexOf("?");let n=e.substring(0,-1===t?e.length:t);return"/"!==n[n.length-1]&&(n+="/"),n+="negotiate",n+=-1===t?"":e.substring(t),-1===n.indexOf("negotiateVersion")&&(n+=-1===t?"?":"&",n+="negotiateVersion="+this._negotiateVersion),n}}class on{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new rn,this._transportResult=new rn,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new rn),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 rn;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):on._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 o=0;for(const t of e)n.set(new Uint8Array(t),o),o+=t.byteLength;return n.buffer}}class rn{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class sn{static write(e){return`${e}${sn.RecordSeparator}`}static parse(e){if(e[e.length-1]!==sn.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(sn.RecordSeparator);return t.pop(),t}}sn.RecordSeparatorCode=30,sn.RecordSeparator=String.fromCharCode(sn.RecordSeparatorCode);class an{writeHandshakeRequest(e){return sn.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(Mt(e)){const o=new Uint8Array(e),r=o.indexOf(sn.RecordSeparatorCode);if(-1===r)throw new Error("Message is incomplete.");const i=r+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(o.slice(0,i))),n=o.byteLength>i?o.slice(i).buffer:null}else{const o=e,r=o.indexOf(sn.RecordSeparator);if(-1===r)throw new Error("Message is incomplete.");const i=r+1;t=o.substring(0,i),n=o.length>i?o.substring(i):null}const o=sn.parse(t),r=JSON.parse(o[0]);if(r.type)throw new Error("Expected a handshake response from the server.");return[n,r]}}!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"}(Gt||(Gt={}));class cn{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 Ft(this,e)}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}(Yt||(Yt={}));class ln{static create(e,t,n,o,r,i){return new ln(e,t,n,o,r,i)}constructor(e,t,n,o,r,i){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(xt.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!=r?r:3e4,this.keepAliveIntervalInMilliseconds=null!=i?i:15e3,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=o,this._handshakeProtocol=new an,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=Yt.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:Gt.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!==Yt.Disconnected&&this._connectionState!==Yt.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!==Yt.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=Yt.Connecting,this._logger.log(xt.Debug,"Starting HubConnection.");try{await this._startInternal(),Pt.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=Yt.Connected,this._connectionStarted=!0,this._logger.log(xt.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=Yt.Disconnected,this._logger.log(xt.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{const t={protocol:this._protocol.name,version:this._protocol.version};if(this._logger.log(xt.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(t)),this._logger.log(xt.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(e){throw this._logger.log(xt.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._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch(e){}}_stopInternal(e){if(this._connectionState===Yt.Disconnected)return this._logger.log(xt.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===Yt.Disconnecting)return this._logger.log(xt.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=Yt.Disconnecting,this._logger.log(xt.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(xt.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===Yt.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new St("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,o]=this._replaceStreamingParams(t),r=this._createStreamInvocation(e,t,o);let i;const s=new cn;return s.cancelCallback=()=>{const e=this._createCancelInvocation(r.invocationId);return delete this._callbacks[r.invocationId],i.then((()=>this._sendWithProtocol(e)))},this._callbacks[r.invocationId]=(e,t)=>{t?s.error(t):e&&(e.type===Gt.Completion?e.error?s.error(new Error(e.error)):s.complete():s.next(e.item))},i=this._sendWithProtocol(r).catch((e=>{s.error(e),delete this._callbacks[r.invocationId]})),this._launchStreams(n,i),s}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){const[n,o]=this._replaceStreamingParams(t),r=this._sendWithProtocol(this._createInvocation(e,t,!0,o));return this._launchStreams(n,r),r}invoke(e,...t){const[n,o]=this._replaceStreamingParams(t),r=this._createInvocation(e,t,!1,o);return new Promise(((e,t)=>{this._callbacks[r.invocationId]=(n,o)=>{o?t(o):n&&(n.type===Gt.Completion?n.error?t(new Error(n.error)):e(n.result):t(new Error(`Unexpected message type: ${n.type}`)))};const o=this._sendWithProtocol(r).catch((e=>{t(e),delete this._callbacks[r.invocationId]}));this._launchStreams(n,o)}))}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 o=n.indexOf(t);-1!==o&&(n.splice(o,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)switch(e.type){case Gt.Invocation:this._invokeClientMethod(e);break;case Gt.StreamItem:case Gt.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===Gt.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(xt.Error,`Stream callback threw error: ${Wt(e)}`)}}break}case Gt.Ping:break;case Gt.Close:{this._logger.log(xt.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}default:this._logger.log(xt.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(xt.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(xt.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(xt.Debug,"Server handshake complete."),this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=(new Date).getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if(!(this.connection.features&&this.connection.features.inherentKeepAlive||(this._timeoutHandle=setTimeout((()=>this.serverTimeout()),this.serverTimeoutInMilliseconds),void 0!==this._pingServerHandle))){let e=this._nextKeepAlive-(new Date).getTime();e<0&&(e=0),this._pingServerHandle=setTimeout((async()=>{if(this._connectionState===Yt.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),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(xt.Warning,`No client method with the name '${t}' found.`),void(e.invocationId&&(this._logger.log(xt.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 o=n.slice(),r=!!e.invocationId;let i,s,a;for(const n of o)try{const o=i;i=await n.apply(this,e.arguments),r&&i&&o&&(this._logger.log(xt.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(xt.Error,`A callback for the method '${t}' threw error '${e}'.`)}a?await this._sendWithProtocol(a):r?(s?a=this._createCompletionMessage(e.invocationId,`${s}`,null):void 0!==i?a=this._createCompletionMessage(e.invocationId,null,i):(this._logger.log(xt.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(xt.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(xt.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new St("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===Yt.Disconnecting?this._completeClose(e):this._connectionState===Yt.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===Yt.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=Yt.Disconnected,this._connectionStarted=!1,Pt.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(xt.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}async _reconnect(e){const t=Date.now();let n=0,o=void 0!==e?e:new Error("Attempting to reconnect due to a unknown error."),r=this._getNextRetryDelay(n++,0,o);if(null===r)return this._logger.log(xt.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=Yt.Reconnecting,e?this._logger.log(xt.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(xt.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(xt.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==Yt.Reconnecting)return void this._logger.log(xt.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==r;){if(this._logger.log(xt.Information,`Reconnect attempt number ${n} will start in ${r} ms.`),await new Promise((e=>{this._reconnectDelayHandle=setTimeout(e,r)})),this._reconnectDelayHandle=void 0,this._connectionState!==Yt.Reconnecting)return void this._logger.log(xt.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=Yt.Connected,this._logger.log(xt.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(xt.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(xt.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==Yt.Reconnecting)return this._logger.log(xt.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===Yt.Disconnecting&&this._completeClose());o=e instanceof Error?e:new Error(e.toString()),r=this._getNextRetryDelay(n++,Date.now()-t,o)}}this._logger.log(xt.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(xt.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${n}'.`),null}}_cancelCallbacksWithError(e){const t=this._callbacks;this._callbacks={},Object.keys(t).forEach((n=>{const o=t[n];try{o(null,e)}catch(t){this._logger.log(xt.Error,`Stream 'error' callback called with '${e}' threw error: ${Wt(t)}`)}}))}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,n,o){if(n)return 0!==o.length?{arguments:t,streamIds:o,target:e,type:Gt.Invocation}:{arguments:t,target:e,type:Gt.Invocation};{const n=this._invocationId;return this._invocationId++,0!==o.length?{arguments:t,invocationId:n.toString(),streamIds:o,target:e,type:Gt.Invocation}:{arguments:t,invocationId:n.toString(),target:e,type:Gt.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 o;o=e instanceof Error?e.message:e&&e.toString?e.toString():"Unknown error",t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n,o))))},next:e=>{t=t.then((()=>this._sendWithProtocol(this._createStreamItemMessage(n,e))))}})}}_replaceStreamingParams(e){const t=[],n=[];for(let o=0;o=55296&&r<=56319&&o65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h)}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 In,kn=wn?new TextDecoder:null,Tn=wn?"undefined"!=typeof process&&"force"!==(null===(gn=null===process||void 0===process?void 0:process.env)||void 0===gn?void 0:gn.TEXT_DECODER)?200:0:mn,Dn=function(e,t){this.type=e,this.data=t},xn=(In=function(e,t){return In=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])},In(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}In(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),An=function(e){function t(n){var o=e.call(this,n)||this,r=Object.create(t.prototype);return Object.setPrototypeOf(o,r),Object.defineProperty(o,"name",{configurable:!0,enumerable:!1,value:t.name}),o}return xn(t,e),t}(Error),Nn={type:-1,encode:function(e){var t,n,o,r;return e instanceof Date?function(e){var t,n=e.sec,o=e.nsec;if(n>=0&&o>=0&&n<=17179869183){if(0===o&&n<=4294967295){var r=new Uint8Array(4);return(t=new DataView(r.buffer)).setUint32(0,n),r}var i=n/4294967296,s=4294967295&n;return r=new Uint8Array(8),(t=new DataView(r.buffer)).setUint32(0,o<<2|3&i),t.setUint32(4,s),r}return r=new Uint8Array(12),(t=new DataView(r.buffer)).setUint32(0,o),yn(t,4,n),r}((o=1e6*((t=e.getTime())-1e3*(n=Math.floor(t/1e3))),{sec:n+(r=Math.floor(o/1e9)),nsec:o-1e9*r})):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:vn(t,4),nsec:t.getUint32(0)};default:throw new An("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},Rn=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Nn)}return e.prototype.register=function(e){var t=e.type,n=e.encode,o=e.decode;if(t>=0)this.encoders[t]=n,this.decoders[t]=o;else{var r=1+t;this.builtInEncoders[r]=n,this.builtInDecoders[r]=o}},e.prototype.tryToEncode=function(e,t){for(var n=0;nthis.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=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>En){var t=bn(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),Sn(e,this.bytes,this.pos),this.pos+=t}else t=bn(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var o=e.length,r=n,i=0;i>6&31|192;else{if(s>=55296&&s<=56319&&i>12&15|224,t[r++]=s>>6&63|128):(t[r++]=s>>18&7|240,t[r++]=s>>12&63|128,t[r++]=s>>6&63|128)}t[r++]=63&s|128}else t[r++]=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 o=0,r=e;o0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,n){e:for(var o=0,r=this.caches[n-1];o=this.maxLengthPerKey?n[Math.random()*n.length|0]=o:n.push(o)},e.prototype.decode=function(e,t,n){var o=this.find(e,t,n);if(null!=o)return this.hit++,o;this.miss++;var r=Cn(e,t,n),i=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(i,r),r},e}(),Fn=function(e,t){var n,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((r=(r=s.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]=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 Fn(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,o,r,i,s,a;return i=this,void 0,a=function(){var i,s,a,c,l,h,d,u;return Fn(this,(function(p){switch(p.label){case 0:i=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=On(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 jn))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(),o={error:c},[3,12];case 7:return p.trys.push([7,,10,11]),n&&!n.done&&(r=t.return)?[4,r.call(t)]:[3,9];case 8:p.sent(),p.label=9;case 9:return[3,11];case 10:if(o)throw o.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,d=l.pos,u=l.totalPos,new RangeError("Insufficient data in parsing ".concat(Mn(h)," at ").concat(u," (").concat(d," in the current buffer)"))}}))},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{r(a.next(e))}catch(e){t(e)}}function o(e){try{r(a.throw(e))}catch(e){t(e)}}function r(t){var r;t.done?e(t.value):(r=t.value,r instanceof s?r:new s((function(e){e(r)}))).then(n,o)}r((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,o,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,s=function(){var n,o,r,i,s,a,c,l,h;return Fn(this,(function(d){switch(d.label){case 0:n=t,o=-1,d.label=1;case 1:d.trys.push([1,13,14,19]),r=On(e),d.label=2;case 2:return[4,Bn(r.next())];case 3:if((i=d.sent()).done)return[3,12];if(s=i.value,t&&0===o)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(o=this.readArraySize(),n=!1,this.complete()),d.label=4;case 4:d.trys.push([4,9,,10]),d.label=5;case 5:return[4,Bn(this.doDecodeSync())];case 6:return[4,d.sent()];case 7:return d.sent(),0==--o?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=d.sent())instanceof jn))throw a;return[3,10];case 10:this.totalPos+=this.pos,d.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return c=d.sent(),l={error:c},[3,19];case 14:return d.trys.push([14,,17,18]),i&&!i.done&&(h=r.return)?[4,Bn(h.call(r))]:[3,16];case 15:d.sent(),d.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,o||[]),a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(e){s[e]&&(i[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||l(e,t)}))})}function l(e,t){try{(n=s[e](t)).value instanceof Bn?Promise.resolve(n.value.v).then(h,d):u(a[0][2],n)}catch(e){u(a[0][3],e)}var n}function h(e){l("next",e)}function d(e){l("throw",e)}function u(e,t){e(t),a.shift(),a.length&&l(a[0][0],a[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!=(o=e-128)){this.pushMapState(o),this.complete();continue e}t={}}else if(e<160){if(0!=(o=e-144)){this.pushArrayState(o),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!==(o=this.readU16())){this.pushArrayState(o),this.complete();continue e}t=[]}else if(221===e){if(0!==(o=this.readU32())){this.pushArrayState(o),this.complete();continue e}t=[]}else if(222===e){if(0!==(o=this.readU16())){this.pushMapState(o),this.complete();continue e}t={}}else if(223===e){if(0!==(o=this.readU32())){this.pushMapState(o),this.complete();continue e}t={}}else if(196===e){var o=this.lookU8();t=this.decodeBinary(o,1)}else if(197===e)o=this.lookU16(),t=this.decodeBinary(o,2);else if(198===e)o=this.lookU32(),t=this.decodeBinary(o,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)o=this.lookU8(),t=this.decodeExtension(o,1);else if(200===e)o=this.lookU16(),t=this.decodeExtension(o,2);else{if(201!==e)throw new An("Unrecognized type byte: ".concat(Mn(e)));o=this.lookU32(),t=this.decodeExtension(o,4)}this.complete();for(var r=this.stack;r.length>0;){var i=r[r.length-1];if(0===i.type){if(i.array[i.position]=t,i.position++,i.position!==i.size)continue e;r.pop(),t=i.array}else{if(1===i.type){if("string"!=(s=typeof t)&&"number"!==s)throw new An("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new An("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}r.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 An("Unrecognized array type byte: ".concat(Mn(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new An("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 An("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 An("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthTn?function(e,t,n){var o=e.subarray(t,t+n);return kn.decode(o)}(this.bytes,r,e):Cn(this.bytes,r,e),this.pos+=t+e,o},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 An("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw Wn;var n=this.pos+t,o=this.bytes.subarray(n,n+e);return this.pos+=t+e,o},e.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new An("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var n=this.view.getInt8(this.pos+t),o=this.decodeBinary(e,t+1);return this.extensionCodec.decode(o,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=vn(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 o=new Uint8Array(n.length+t);return o.set(n,0),o.set(e,n.length),o.buffer}static parse(e){const t=[],n=new Uint8Array(e),o=[0,7,14,21,28];for(let r=0;r7)throw new Error("Messages bigger than 2GB are not supported.");if(!(n.byteLength>=r+s+a))throw new Error("Incomplete message.");t.push(n.slice?n.slice(r+s,r+s+a):n.subarray(r+s,r+s+a)),r=r+s+a}return t}}const Kn=new Uint8Array([145,Gt.Ping]);class Vn{constructor(e){this.name="messagepack",this.version=1,this.transferFormat=Xt.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new Un(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new Jn(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=At.instance);const o=qn.parse(e),r=[];for(const e of o){const n=this._parseMessage(e,t);n&&r.push(n)}return r}writeMessage(e){switch(e.type){case Gt.Invocation:return this._writeInvocation(e);case Gt.StreamInvocation:return this._writeStreamInvocation(e);case Gt.StreamItem:return this._writeStreamItem(e);case Gt.Completion:return this._writeCompletion(e);case Gt.Ping:return qn.write(Kn);case Gt.CancelInvocation:return this._writeCancelInvocation(e);case Gt.Close:return this._writeClose();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 o=n[0];switch(o){case Gt.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case Gt.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case Gt.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case Gt.Ping:return this._createPingMessage(n);case Gt.Close:return this._createCloseMessage(n);default:return t.log(xt.Information,"Unknown message type '"+o+"' 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:Gt.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:Gt.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:Gt.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:Gt.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:Gt.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 o,r;switch(n){case this._errorResult:o=t[4];break;case this._nonVoidResult:r=t[4]}return{error:o,headers:e,invocationId:t[2],result:r,type:Gt.Completion}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([Gt.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([Gt.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([Gt.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([Gt.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),qn.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([Gt.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([Gt.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([Gt.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([Gt.Completion,e.headers||{},e.invocationId,t,e.result])}return qn.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([Gt.CancelInvocation,e.headers||{},e.invocationId]);return qn.write(t.slice())}_writeClose(){const e=this._encoder.encode([Gt.Close,null]);return qn.write(e.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}let Xn=!1;function Gn(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),Xn||(Xn=!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()}})))}const Yn="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,Qn=Yn?Yn.decode.bind(Yn):function(e){let t=0;const n=e.length,o=[],r=[];for(;t65535&&(r-=65536,o.push(r>>>10&1023|55296),r=56320|1023&r),o.push(r)}o.length>1024&&(r.push(String.fromCharCode.apply(null,o)),o.length=0)}return r.push(String.fromCharCode.apply(null,o)),r.join("")},Zn=Math.pow(2,32),eo=Math.pow(2,21)-1;function to(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function no(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function oo(e,t){const n=no(e,t+4);if(n>eo)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*Zn+no(e,t)}class ro{constructor(e){this.batchData=e;const t=new co(e);this.arrayRangeReader=new lo(e),this.arrayBuilderSegmentReader=new ho(e),this.diffReader=new io(e),this.editReader=new so(e,t),this.frameReader=new ao(e,t)}updatedComponents(){return to(this.batchData,this.batchData.length-20)}referenceFrames(){return to(this.batchData,this.batchData.length-16)}disposedComponentIds(){return to(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return to(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return to(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return to(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return oo(this.batchData,n)}}class io{constructor(e){this.batchDataUint8=e}componentId(e){return to(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class so{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return to(this.batchDataUint8,e)}siblingIndex(e){return to(this.batchDataUint8,e+4)}newTreeIndex(e){return to(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return to(this.batchDataUint8,e+8)}removedAttributeName(e){const t=to(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class ao{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return to(this.batchDataUint8,e)}subtreeLength(e){return to(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=to(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return to(this.batchDataUint8,e+8)}elementName(e){const t=to(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=to(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=to(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=to(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=to(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return oo(this.batchDataUint8,e+12)}}class co{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=to(e,e.length-4)}readString(e){if(-1===e)return null;{const n=to(this.batchDataUint8,this.stringTableStartIndex+4*e),o=function(e,t){let n=0,o=0;for(let r=0;r<4;r++){const i=e[t+r];if(n|=(127&i)<this.nextBatchId)return this.fatalError?(this.logger.log(uo.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(uo.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(uo.Debug,`Applying batch ${e}.`),ke(po.Server,new ro(t)),await this.completeBatch(n,e)}catch(t){throw this.fatalError=t.toString(),this.logger.log(uo.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(uo.Warning,`Failed to deliver completion notification for render '${t}'.`)}}}class go{log(e,t){}}go.instance=new go;class mo{constructor(e){this.minLevel=e}log(e,t){if(e>=this.minLevel){const n=`[${(new Date).toISOString()}] ${uo[e]}: ${t}`;switch(e){case uo.Critical:case uo.Error:console.error(n);break;case uo.Warning:console.warn(n);break;case uo.Information:console.info(n);break;default:console.log(n)}}}}function yo(e,t){switch(t){case"webassembly":return bo(e,"webassembly");case"server":return function(e){return bo(e,"server").sort(((e,t)=>e.sequence-t.sequence))}(e);case"auto":return bo(e,"auto")}}const vo=/^\s*Blazor-Component-State:(?[a-zA-Z0-9+/=]+)$/;function wo(e){var t;if(e.nodeType===Node.COMMENT_NODE){const n=e.textContent||"",o=vo.exec(n),r=o&&o.groups&&o.groups.state;return r&&(null===(t=e.parentNode)||void 0===t||t.removeChild(e)),r}if(!e.hasChildNodes())return;const n=e.childNodes;for(let e=0;e.*)$/);function Eo(e,t){const n=e.currentElement;var o,r,i;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const s=_o.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 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:o}=e;if(o){for(;n.next()&&n.currentElement;){const e=n.currentElement;if(e.nodeType!==Node.COMMENT_NODE)continue;if(!e.textContent)continue;const t=_o.exec(e.textContent),r=t&&t[1];if(r)return ko(r,o),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 r=n,i=c,Io(o=s),{...o,uniqueId:So++,start:r,end:i};case"server":return function(e,t,n){return Co(e),{...e,uniqueId:So++,start:t,end:n}}(s,n,c);case"auto":return function(e,t,n){return Co(e),Io(e),{...e,uniqueId:So++,start:t,end:n}}(s,n,c)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}let So=0;function Co(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 Io(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 ko(e,t){const n=JSON.parse(e);if(1!==Object.keys(n).length)throw new Error(`Invalid end of component comment: '${e}'`);const o=n.prerenderId;if(!o)throw new Error(`End of component comment must have a value for the prerendered property: '${e}'`);if(o!==t)throw new Error(`End of component comment prerendered property must match the start comment prerender id: '${t}', '${o}'`)}class To{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndexDo(e)))),n=await e.invoke("StartCircuit",Je.getBaseURI(),Je.getLocationHref(),t,this.applicationState||"");return!!n&&(this.initialize(n),!0)}resolveElement(e,t){const n=w(e);if(n)return z(n,!0);const o=Number.parseInt(e);if(!Number.isNaN(o))return W(this.componentManager.resolveRootComponent(o,t));throw new Error(`Invalid sequence number or identifier '${e}'.`)}}const No={configureSignalR:e=>{},logLevel:uo.Warning,reconnectionOptions:{maxRetries:8,retryIntervalMilliseconds:2e4,dialogId:"components-reconnect-modal"}};class Ro{constructor(e,t,n,o){this.maxRetries=t,this.document=n,this.logger=o,this.addedToDom=!1,this.modal=this.document.createElement("div"),this.modal.id=e,this.maxRetries=t,this.modal.style.cssText=["position: fixed","top: 0","right: 0","bottom: 0","left: 0","z-index: 1050","display: none","overflow: hidden","background-color: #fff","opacity: 0.8","text-align: center","font-weight: bold","transition: visibility 0s linear 500ms"].join(";"),this.message=this.document.createElement("h5"),this.message.style.cssText="margin-top: 20px",this.button=this.document.createElement("button"),this.button.style.cssText="margin:5px auto 5px",this.button.textContent="Retry";const r=this.document.createElement("a");r.addEventListener("click",(()=>location.reload())),r.textContent="reload",this.reloadParagraph=this.document.createElement("p"),this.reloadParagraph.textContent="Alternatively, ",this.reloadParagraph.appendChild(r),this.modal.appendChild(this.message),this.modal.appendChild(this.button),this.modal.appendChild(this.reloadParagraph),this.loader=this.getLoader(),this.message.after(this.loader),this.button.addEventListener("click",(async()=>{this.show();try{await ft.reconnect()||this.rejected()}catch(e){this.logger.log(uo.Error,e),this.failed()}}))}show(){this.addedToDom||(this.addedToDom=!0,this.document.body.appendChild(this.modal)),this.modal.style.display="block",this.loader.style.display="inline-block",this.button.style.display="none",this.reloadParagraph.style.display="none",this.message.textContent="Attempting to reconnect to the server...",this.modal.style.visibility="hidden",setTimeout((()=>{this.modal.style.visibility="visible"}),0)}update(e){this.message.textContent=`Attempting to reconnect to the server: ${e} of ${this.maxRetries}`}hide(){this.modal.style.display="none"}failed(){this.button.style.display="block",this.reloadParagraph.style.display="none",this.loader.style.display="none";const e=this.document.createTextNode("Reconnection failed. Try "),t=this.document.createElement("a");t.textContent="reloading",t.setAttribute("href",""),t.addEventListener("click",(()=>location.reload()));const n=this.document.createTextNode(" the page if you're unable to reconnect.");this.message.replaceChildren(e,t,n)}rejected(){this.button.style.display="none",this.reloadParagraph.style.display="none",this.loader.style.display="none";const e=this.document.createTextNode("Could not reconnect to the server. "),t=this.document.createElement("a");t.textContent="Reload",t.setAttribute("href",""),t.addEventListener("click",(()=>location.reload()));const n=this.document.createTextNode(" the page to restore functionality.");this.message.replaceChildren(e,t,n)}getLoader(){const e=this.document.createElement("div");return e.style.cssText=["border: 0.3em solid #f3f3f3","border-top: 0.3em solid #3498db","border-radius: 50%","width: 2em","height: 2em","display: inline-block"].join(";"),e.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:2e3,iterations:1/0}),e}}class Po{constructor(e,t,n){this.dialog=e,this.maxRetries=t,this.document=n,this.document=n;const o=this.document.getElementById(Po.MaxRetriesId);o&&(o.innerText=this.maxRetries.toString())}show(){this.removeClasses(),this.dialog.classList.add(Po.ShowClassName)}update(e){const t=this.document.getElementById(Po.CurrentAttemptId);t&&(t.innerText=e.toString())}hide(){this.removeClasses(),this.dialog.classList.add(Po.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(Po.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(Po.RejectedClassName)}removeClasses(){this.dialog.classList.remove(Po.ShowClassName,Po.HideClassName,Po.FailedClassName,Po.RejectedClassName)}}Po.ShowClassName="components-reconnect-show",Po.HideClassName="components-reconnect-hide",Po.FailedClassName="components-reconnect-failed",Po.RejectedClassName="components-reconnect-rejected",Po.MaxRetriesId="components-reconnect-max-retries",Po.CurrentAttemptId="components-reconnect-current-attempt";class Uo{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||ft.reconnect}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new Po(t,e.maxRetries,document):new Ro(e.dialogId,e.maxRetries,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new Mo(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class Mo{constructor(e,t,n,o){this.logger=t,this.reconnectCallback=n,this.isDisposed=!1,this.reconnectDisplay=o,this.reconnectDisplay.show(),this.attemptPeriodicReconnection(e)}dispose(){this.isDisposed=!0,this.reconnectDisplay.hide()}async attemptPeriodicReconnection(e){for(let t=0;tMo.MaximumFirstRetryInterval?Mo.MaximumFirstRetryInterval:e.retryIntervalMilliseconds;if(await this.delay(n),this.isDisposed)break;try{return await this.reconnectCallback()?void 0:void this.reconnectDisplay.rejected()}catch(e){this.logger.log(uo.Error,e)}}this.reconnectDisplay.failed()}delay(e){return new Promise((t=>setTimeout(t,e)))}}Mo.MaximumFirstRetryInterval=3e3;class Lo{constructor(){this.afterStartedCallbacks=[]}async importInitializersAsync(e,t){await Promise.all(e.map((e=>async function(e,n){const o=function(e){const t=document.baseURI;return t.endsWith("/")?`${t}${e}`:`${t}/${e}`}(n),r=await import(o);if(void 0===r)return;const{beforeStart:i,afterStarted:s}=r;return s&&e.afterStartedCallbacks.push(s),i?i(...t):void 0}(this,e))))}async invokeAfterStartedCallbacks(e){await T,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let Fo,Oo,Bo,$o,Ho,jo=!1,Wo=!1;async function zo(e,t,n){var o,r;const i=new Vn;i.name="blazorpack";const s=(new un).withUrl("_blazor").withHubProtocol(i);e.configureSignalR(s);const a=s.build();a.on("JS.AttachComponent",((e,t)=>Ie(po.Server,n.resolveElement(t,e),e,!1))),a.on("JS.BeginInvokeJS",Bo.beginInvokeJSFromDotNet.bind(Bo)),a.on("JS.EndInvokeDotNet",Bo.endInvokeDotNetFromJS.bind(Bo)),a.on("JS.ReceiveByteArray",Bo.receiveByteArray.bind(Bo)),a.on("JS.BeginTransmitStream",(e=>{const t=new ReadableStream({start(t){a.stream("SendDotNetStreamToJS",e).subscribe({next:e=>t.enqueue(e),complete:()=>t.close(),error:e=>t.error(e)})}});Bo.supplyDotNetStream(e,t)}));const c=fo.getOrCreate(t);a.on("JS.RenderBatch",((e,n)=>{t.log(uo.Debug,`Received render batch with id ${e} and ${n.byteLength} bytes.`),c.processBatch(e,n,a)})),a.on("JS.EndLocationChanging",ft._internal.navigationManager.endLocationChanging),a.onclose((t=>!jo&&e.reconnectionHandler.onConnectionDown(e.reconnectionOptions,t))),a.on("JS.Error",(e=>{jo=!0,Jo(a,e,t),Gn()}));try{await a.start(),Fo=a}catch(e){if(Jo(a,e,t),"FailedToNegotiateWithServerError"===e.errorType)throw e;Gn(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===Vt.WebSockets))?t.log(uo.Error,"Unable to connect, please ensure you are using an updated browser that supports WebSockets."):e.innerErrors.some((e=>"FailedToStartTransportError"===e.errorType&&e.transport===Vt.WebSockets))?t.log(uo.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===Vt.LongPolling))&&t.log(uo.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(null===(r=null===(o=a.connection)||void 0===o?void 0:o.features)||void 0===r?void 0:r.inherentKeepAlive)&&t.log(uo.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."),a}function Jo(e,t,n){n.log(uo.Error,t),e&&e.stop()}function qo(e){return Ho=e,Ho}var Ko,Vo;const Xo=navigator,Go=Xo.userAgentData&&Xo.userAgentData.brands,Yo=Go&&Go.length>0?Go.some((e=>"Google Chrome"===e.brand||"Microsoft Edge"===e.brand||"Chromium"===e.brand)):window.chrome,Qo=null!==(Vo=null===(Ko=Xo.userAgentData)||void 0===Ko?void 0:Ko.platform)&&void 0!==Vo?Vo:navigator.platform;function Zo(e){return 0!==e.debugLevel&&(Yo||navigator.userAgent.includes("Firefox"))}let er,tr,nr,or,rr,ir;const sr=Math.pow(2,32),ar=Math.pow(2,21)-1;let cr=null;function lr(e){return tr.getI32(e)}const hr={load:function(e,t){return async function(e,t){const{dotnet:n}=await async function(e){if("undefined"==typeof WebAssembly||!WebAssembly.validate)throw new Error("This browser does not support WebAssembly.");let t="_framework/dotnet.js";if(e.loadBootResource){const n="dotnetjs",o=e.loadBootResource(n,"dotnet.js",t,"","js-module-dotnet");if("string"==typeof o)t=o;else if(o)throw new Error(`For a ${n} resource, custom loaders must supply a URI string.`)}const n=new URL(t,document.baseURI).toString();return await import(n)}(e),o=function(e,t){const n={maxParallelDownloads:1e6,enableDownloadRetry:!1,applicationEnvironment:e.environment},o={...window.Module||{},onConfigLoaded:async(n,{invokeLibraryInitializers:o})=>{var r,i;n.environmentVariables||(n.environmentVariables={}),"sharded"===n.globalizationMode&&(n.environmentVariables.__BLAZOR_SHARDED_ICU="1"),ft._internal.getApplicationEnvironment=()=>n.applicationEnvironment,null==t||t(n);const s=[e,null!==(i=null===(r=n.resources)||void 0===r?void 0:r.extensions)&&void 0!==i?i:{}];await o("beforeStart",s)},onDownloadResourceProgress:dr,config:n,disableDotnet6Compatibility:!1,out:pr,err:fr};return o}(e,t);e.applicationCulture&&n.withApplicationCulture(e.applicationCulture),e.environment&&n.withApplicationEnvironment(e.environment),e.loadBootResource&&n.withResourceLoader(e.loadBootResource),n.withModuleConfig(o),e.configureRuntime&&e.configureRuntime(n),ir=await n.create()}(e,t)},start:function(){return async function(){if(!ir)throw new Error("The runtime must be loaded it gets configured.");const{MONO:t,BINDING:n,Module:o,setModuleImports:r,INTERNAL:i,getConfig:s,invokeLibraryInitializers:a}=ir;nr=o,er=n,tr=t,rr=i,function(e){const t=Qo.match(/^Mac/i)?"Cmd":"Alt";Zo(e)&&console.info(`Debugging hotkey: Shift+${t}+D (when application has focus)`),document.addEventListener("keydown",(t=>{t.shiftKey&&(t.metaKey||t.altKey)&&"KeyD"===t.code&&(Zo(e)?navigator.userAgent.includes("Firefox")?async function(){const e=await fetch(`_framework/debug?url=${encodeURIComponent(location.href)}&isFirefox=true`);200!==e.status&&console.warn(await e.text())}():Yo?function(){const e=document.createElement("a");e.href=`_framework/debug?url=${encodeURIComponent(location.href)}`,e.target="_blank",e.rel="noopener noreferrer",e.click()}():console.error("Currently, only Microsoft Edge (80+), Google Chrome, or Chromium, are supported for debugging."):console.error("Cannot start debugging, because the application was not compiled with debugging enabled."))}))}(s()),ft.runtime=ir,ft._internal.dotNetCriticalError=fr,r("blazor-internal",{Blazor:{_internal:ft._internal}});const c=await ir.getAssemblyExports("Microsoft.AspNetCore.Components.WebAssembly");return Object.assign(ft._internal,{dotNetExports:{...c.Microsoft.AspNetCore.Components.WebAssembly.Services.DefaultWebAssemblyJSRuntime}}),or=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,o,r)=>{if(mr(),!o&&!t)throw new Error("Either assemblyName or dotNetObjectId must have a non null value.");const i=o?o.toString():t;ft._internal.dotNetExports.BeginInvokeDotNet(e?e.toString():null,i,n,r)},endInvokeJSFromDotNet:(e,t,n)=>{ft._internal.dotNetExports.EndInvokeJS(n)},sendByteArray:(e,t)=>{ft._internal.dotNetExports.ReceiveByteArrayFromJS(e,t)},invokeDotNetFromJS:(e,t,n,o)=>(mr(),ft._internal.dotNetExports.InvokeDotNet(e||null,t,null!=n?n:0,o))}),{invokeLibraryInitializers:a}}()},callEntryPoint:async function(){try{await ir.runMain(ir.getConfig().mainAssemblyName,[])}catch(e){console.error(e),Gn()}},toUint8Array:function(e){const t=gr(e),n=lr(t),o=new Uint8Array(n);return o.set(nr.HEAPU8.subarray(t+4,t+4+n)),o},getArrayLength:function(e){return lr(gr(e))},getArrayEntryPtr:function(e,t,n){return gr(e)+4+t*n},getObjectFieldsBaseAddress:function(e){return e+8},readInt16Field:function(e,t){return n=e+(t||0),tr.getI16(n);var n},readInt32Field:function(e,t){return lr(e+(t||0))},readUint64Field:function(e,t){return function(e){const t=e>>2,n=nr.HEAPU32[t+1];if(n>ar)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*sr+nr.HEAPU32[t]}(e+(t||0))},readFloatField:function(e,t){return n=e+(t||0),tr.getF32(n);var n},readObjectField:function(e,t){return lr(e+(t||0))},readStringField:function(e,t,n){const o=lr(e+(t||0));if(0===o)return null;if(n){const e=er.unbox_mono_obj(o);return"boolean"==typeof e?e?"":null:e}return er.conv_string(o)},readStructField:function(e,t){return e+(t||0)},beginHeapLock:function(){return mr(),cr=yr.create(),cr},invokeWhenHeapUnlocked:function(e){cr?cr.enqueuePostReleaseAction(e):e()}};function dr(e,t){const n=e/t*100;document.documentElement.style.setProperty("--blazor-load-percentage",`${n}%`),document.documentElement.style.setProperty("--blazor-load-percentage-text",`"${Math.floor(n)}%"`)}const ur=["DEBUGGING ENABLED"],pr=e=>ur.indexOf(e)<0&&console.log(e),fr=e=>{console.error(e||"(null)"),Gn()};function gr(e){return e+12}function mr(){if(cr)throw new Error("Assertion failed - heap is currently locked")}class yr{enqueuePostReleaseAction(e){this.postReleaseActions||(this.postReleaseActions=[]),this.postReleaseActions.push(e)}release(){var e;if(cr!==this)throw new Error("Trying to release a lock which isn't current");for(rr.mono_wasm_gc_unlock(),cr=null;null===(e=this.postReleaseActions)||void 0===e?void 0:e.length;)this.postReleaseActions.shift()(),mr()}static create(){return rr.mono_wasm_gc_lock(),new yr}}class vr{constructor(e){this.batchAddress=e,this.arrayRangeReader=wr,this.arrayBuilderSegmentReader=br,this.diffReader=_r,this.editReader=Er,this.frameReader=Sr}updatedComponents(){return Ho.readStructField(this.batchAddress,0)}referenceFrames(){return Ho.readStructField(this.batchAddress,wr.structLength)}disposedComponentIds(){return Ho.readStructField(this.batchAddress,2*wr.structLength)}disposedEventHandlerIds(){return Ho.readStructField(this.batchAddress,3*wr.structLength)}updatedComponentsEntry(e,t){return Cr(e,t,_r.structLength)}referenceFramesEntry(e,t){return Cr(e,t,Sr.structLength)}disposedComponentIdsEntry(e,t){const n=Cr(e,t,4);return Ho.readInt32Field(n)}disposedEventHandlerIdsEntry(e,t){const n=Cr(e,t,8);return Ho.readUint64Field(n)}}const wr={structLength:8,values:e=>Ho.readObjectField(e,0),count:e=>Ho.readInt32Field(e,4)},br={structLength:12,values:e=>{const t=Ho.readObjectField(e,0),n=Ho.getObjectFieldsBaseAddress(t);return Ho.readObjectField(n,0)},offset:e=>Ho.readInt32Field(e,4),count:e=>Ho.readInt32Field(e,8)},_r={structLength:4+br.structLength,componentId:e=>Ho.readInt32Field(e,0),edits:e=>Ho.readStructField(e,4),editsEntry:(e,t)=>Cr(e,t,Er.structLength)},Er={structLength:20,editType:e=>Ho.readInt32Field(e,0),siblingIndex:e=>Ho.readInt32Field(e,4),newTreeIndex:e=>Ho.readInt32Field(e,8),moveToSiblingIndex:e=>Ho.readInt32Field(e,8),removedAttributeName:e=>Ho.readStringField(e,16)},Sr={structLength:36,frameType:e=>Ho.readInt16Field(e,4),subtreeLength:e=>Ho.readInt32Field(e,8),elementReferenceCaptureId:e=>Ho.readStringField(e,16),componentId:e=>Ho.readInt32Field(e,12),elementName:e=>Ho.readStringField(e,16),textContent:e=>Ho.readStringField(e,16),markupContent:e=>Ho.readStringField(e,16),attributeName:e=>Ho.readStringField(e,16),attributeValue:e=>Ho.readStringField(e,24,!0),attributeEventHandlerId:e=>Ho.readUint64Field(e,8)};function Cr(e,t,n){return Ho.getArrayEntryPtr(e,t,n)}class Ir{constructor(e){this.componentManager=e}resolveRegisteredElement(e,t){const n=Number.parseInt(e);if(!Number.isNaN(n))return W(this.componentManager.resolveRootComponent(n,t))}getParameterValues(e){return this.componentManager.initialComponents[e].parameterValues}getParameterDefinitions(e){return this.componentManager.initialComponents[e].parameterDefinitions}getTypeName(e){return this.componentManager.initialComponents[e].typeName}getAssembly(e){return this.componentManager.initialComponents[e].assembly}getCount(){return this.componentManager.initialComponents.length}}let kr,Tr,Dr,xr=!1;const Ar=new Promise((e=>{Dr=e}));function Nr(e){if(kr)throw new Error("WebAssembly options have already been configured.");kr=e}function Rr(){return null!=Tr||(Tr=hr.load(null!=kr?kr:{},Dr)),Tr}function Pr(t,n,o,r){const i=hr.readStringField(t,0),s=hr.readInt32Field(t,4),a=hr.readStringField(t,8),c=hr.readUint64Field(t,20);if(null!==a){const e=hr.readUint64Field(t,12);if(0!==e)return or.beginInvokeJSFromDotNet(e,i,a,s,c),0;{const e=or.invokeJSFromDotNet(i,a,s,c);return null===e?0:er.js_string_to_mono_string(e)}}{const t=e.findJSFunction(i,c).call(null,n,o,r);switch(s){case e.JSCallResultType.Default:return t;case e.JSCallResultType.JSObjectReference:return e.createJSObjectReference(t).__jsObjectId;case e.JSCallResultType.JSStreamReference:{const n=e.createJSStreamReference(t),o=JSON.stringify(n);return er.js_string_to_mono_string(o)}case e.JSCallResultType.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${s}'.`)}}}function Ur(e,t,n,o,r){return 0!==r?(or.beginInvokeJSFromDotNet(r,e,o,n,t),null):or.invokeJSFromDotNet(e,o,n,t)}function Mr(e,t,n){or.endInvokeDotNetFromJS(e,t,n)}function Lr(e,t,n,o){!function(e,t,n,o,r){let i=pt.get(t);if(!i){const n=new ReadableStream({start(e){pt.set(t,e),i=e}});e.supplyDotNetStream(t,n)}r?(i.error(r),pt.delete(t)):0===o?(i.close(),pt.delete(t)):i.enqueue(n.length===o?n:n.subarray(0,o))}(or,e,t,n,o)}function Fr(e,t){or.receiveByteArray(e,t)}function Or(e,t){t.namespaceURI?e.setAttributeNS(t.namespaceURI,t.name,t.value):e.setAttribute(t.name,t.value)}var Br,$r;!function(e){e[e.None=0]="None",e[e.Some=1]="Some",e[e.Infinite=2]="Infinite"}(Br||(Br={})),function(e){e.Keep="keep",e.Update="update",e.Insert="insert",e.Delete="delete"}($r||($r={}));class Hr{static create(e,t,n){return 0===t&&n===e.length?e:new Hr(e,t,n)}constructor(e,t,n){this.source=e,this.startIndex=t,this.length=n}item(e){return this.source.item(e+this.startIndex)}forEach(e,t){for(let t=0;t=n&&s>=o&&r(e.item(i),t.item(s))===Br.None;)i--,s--,a++;return a}(e,t,o,o,n),i=function(e){var t;const n=[];let o=e.length-1,r=(null===(t=e[o])||void 0===t?void 0:t.length)-1;for(;o>0||r>0;){const t=0===o?$r.Insert:0===r?$r.Delete:e[o][r];switch(n.unshift(t),t){case $r.Keep:case $r.Update:o--,r--;break;case $r.Insert:r--;break;case $r.Delete:o--}}return n}(function(e,t,n){const o=[],r=[],i=e.length,s=t.length;if(0===i&&0===s)return[];for(let e=0;e<=i;e++)(o[e]=Array(s+1))[0]=e,r[e]=Array(s+1);const a=o[0];for(let e=1;e<=s;e++)a[e]=e;for(let a=1;a<=i;a++)for(let i=1;i<=s;i++){const s=n(e.item(a-1),t.item(i-1)),c=o[a-1][i]+1,l=o[a][i-1]+1;let h;switch(s){case Br.None:h=o[a-1][i-1];break;case Br.Some:h=o[a-1][i-1]+1;break;case Br.Infinite:h=Number.MAX_VALUE}h{history.pushState(null,"",e),ai(e)}))}function ii(e){Le()||ai(location.href)}function si(e){if(Le()||e.defaultPrevented)return;const t=e.target;if(t instanceof HTMLFormElement){e.preventDefault();const n=new URL(t.action),o={method:t.method},r=new FormData(t),i=e.submitter;i&&i.name&&r.append(i.name,i.value),"get"===o.method?n.search=new URLSearchParams(r).toString():o.body=r,ai(n.toString(),o)}}async function ai(e,t){zr=!0,null==jr||jr.abort(),jr=new AbortController;const n=jr.signal,o=fetch(e,Object.assign({signal:n,headers:{"blazor-enhanced-nav":"on",accept:"text/html"}},t));if(await async function(e,t,n,o){let r;try{r=await e;const t=r.headers.get("blazor-enhanced-nav-redirect-location");if(t)return void location.replace(t);if(!r.body)return void n(r,"");const o=r.headers.get("ssr-framing");if(!o){const e=await r.text();return void n(r,e)}let i=!0;await r.body.pipeThrough(new TextDecoderStream).pipeThrough(function(e){let t="";return new TransformStream({transform(n,o){if(t+=n,t.indexOf(e,t.length-n.length-e.length)>=0){const n=t.split(e);n.slice(0,-1).forEach((e=>o.enqueue(e))),t=n[n.length-1]}},flush(e){e.enqueue(t)}})}(`\x3c!--${o}--\x3e`)).pipeTo(new WritableStream({write(e){i?(i=!1,n(r,e)):(e=>{const t=document.createRange().createContextualFragment(e);for(;t.firstChild;)document.body.appendChild(t.firstChild)})(e)}}))}catch(e){if("AbortError"===e.name&&t.aborted)return;throw e}}(o,n,((n,o)=>{n.redirected&&(history.replaceState(null,"",n.url),e=n.url);const r=n.headers.get("content-type");if((null==r?void 0:r.startsWith("text/html"))&&o){const e=(new DOMParser).parseFromString(o,"text/html");qr(document,e),Wr.documentUpdated()}else(null==r?void 0:r.startsWith("text/"))&&o?ci(o):(n.status<200||n.status>=300)&&!o?ci(`Error: ${n.status} ${n.statusText}`):(null==t?void 0:t.method)&&"get"!==t.method?ci(`Error: ${t.method} request to ${e} returned non-HTML content of type ${r||"unspecified"}.`):(history.replaceState(null,"",e+"?"),location.replace(e))})),!n.aborted){const t=e.indexOf("#");if(t>=0){const n=e.substring(t+1),o=document.getElementById(n);null==o||o.scrollIntoView()}zr=!1,Wr.documentUpdated()}}function ci(e){document.documentElement.textContent=e;const t=document.documentElement.style;t.fontFamily="consolas, monospace",t.whiteSpace="pre-wrap",t.padding="1rem"}let li,hi=!0;class di extends HTMLElement{connectedCallback(){var e;null===(e=this.parentNode)||void 0===e||e.removeChild(this);const t=this.attachShadow({mode:"open"}),n=document.createElement("slot");t.appendChild(n),n.addEventListener("slotchange",(e=>{this.childNodes.forEach((e=>{if(e instanceof HTMLTemplateElement){const t=e.getAttribute("blazor-component-id");if(t)!function(e,t){const n=function(e){const t=`bl:${e}`,n=document.createNodeIterator(document,NodeFilter.SHOW_COMMENT);let o=null;for(;(o=n.nextNode())&&o.textContent!==t;);if(!o)return null;const r=`/bl:${e}`;let i=null;for(;(i=n.nextNode())&&i.textContent!==r;);return i?{startMarker:o,endMarker:i}:null}(e);if(n){const{startMarker:e,endMarker:o}=n;if(hi)qr({startExclusive:e,endExclusive:o},t);else{const n=o.parentNode,r=new Range;for(r.setStart(e,e.textContent.length),r.setEnd(o,0),r.deleteContents();t.childNodes[0];)n.insertBefore(t.childNodes[0],o)}li.documentUpdated()}}(t,e.content);else switch(e.getAttribute("type")){case"redirection":const t=e.content.textContent;Ne(t)?(history.replaceState(null,"",t),ai(t)):location.replace(t);break;case"error":ci(e.content.textContent||"Error")}}}))}))}}function ui(e){var t;const n=null===(t=e.resources)||void 0===t?void 0:t.hash,o=e.mainAssemblyName;return n&&o?{key:`blazor-resource-hash:${o}`,value:n}:null}let pi=!1;const fi=new class{constructor(){this._activeDescriptors=new Set,this._descriptorsPendingInteractivityById={},this._rootComponentInfoByDescriptor=new Map,this._hasPendingRootComponentUpdate=!1,this._hasStartedCircuit=!1,this._hasStartedLoadingWebAssembly=!1,this._hasLoadedWebAssembly=!1,this._hasStartedWebAssembly=!1,this._didWebAssemblyFailToLoadQuickly=!1,this.initialComponents=[],this.refreshAllRootComponentsAfter(x(po.Server)),this.refreshAllRootComponentsAfter(x(po.WebAssembly))}documentUpdated(){this.refreshAllRootComponents()}registerComponentDescriptor(e){"auto"!==e.type&&"webassembly"!==e.type||this.startLoadingWebAssemblyIfNotStarted(),this._activeDescriptors.add(e)}unregisterComponentDescriptor(e){this._activeDescriptors.delete(e)}async startLoadingWebAssemblyIfNotStarted(){if(this._hasStartedLoadingWebAssembly)return;this._hasStartedLoadingWebAssembly=!0,setTimeout((()=>{this._hasLoadedWebAssembly||this.onWebAssemblyFailedToLoadQuickly()}),ft._internal.loadWebAssemblyQuicklyTimeout);const e=Rr(),t=await Ar;(function(e){if(!e.cacheBootResources)return!1;const t=ui(e);if(!t)return!1;const n=window.localStorage.getItem(t.key);return t.value===n})(t)||this.onWebAssemblyFailedToLoadQuickly(),await e,this._hasLoadedWebAssembly=!0,function(e){const t=ui(e);t&&window.localStorage.setItem(t.key,t.value)}(t),this.refreshAllRootComponents()}onWebAssemblyFailedToLoadQuickly(){this._didWebAssemblyFailToLoadQuickly||(this._didWebAssemblyFailToLoadQuickly=!0,this.refreshAllRootComponents())}async startCircutIfNotStarted(){this._hasStartedCircuit||(this._hasStartedCircuit=!0,await async function(t){if(Wo)throw new Error("Blazor Server has already started.");Wo=!0;const n=function(e){const t={...No,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...No.reconnectionOptions,...e.reconnectionOptions}),t}($o),o=await async function(e){const t=await fetch("_blazor/initializers",{method:"GET",credentials:"include",cache:"no-cache"}),n=await t.json(),o=new Lo;return await o.importInitializersAsync(n,[e]),o}(n),r=new mo(n.logLevel);ft.reconnect=async e=>{if(jo)return!1;const t=e||await zo(n,r,Oo);return await Oo.reconnect(t)?(n.reconnectionHandler.onConnectionUp(),!0):(r.log(uo.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)},ft.defaultReconnectionHandler=new Uo(r),n.reconnectionHandler=n.reconnectionHandler||ft.defaultReconnectionHandler,r.log(uo.Information,"Starting up Blazor server-side application.");const i=wo(document);Oo=new Ao(t,i||""),ft._internal.navigationManager.listenForNavigationEvents(((e,t,n)=>Fo.send("OnLocationChanged",e,t,n)),((e,t,n,o)=>Fo.send("OnLocationChanging",e,t,n,o))),ft._internal.forceCloseConnection=()=>Fo.stop(),ft._internal.sendJSDataStream=(e,t,n)=>function(e,t,n,o){setTimeout((async()=>{let r=5,i=(new Date).valueOf();try{const s=t instanceof Blob?t.size:t.byteLength;let a=0,c=0;for(;a1)await e.send("ReceiveJSDataChunk",n,c,h,null);else{if(!await e.invoke("ReceiveJSDataChunk",n,c,h,null))break;const t=(new Date).valueOf(),o=t-i;i=t,r=Math.max(1,Math.round(500/Math.max(1,o)))}a+=l,c++}}catch(t){await e.send("ReceiveJSDataChunk",n,-1,null,t.toString())}}),0)}(Fo,e,t,n),Bo=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,o,r)=>{Fo.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,o||0,r)},endInvokeJSFromDotNet:(e,t,n)=>{Fo.send("EndInvokeJSFromDotNet",e,t,n)},sendByteArray:(e,t)=>{Fo.send("ReceiveByteArray",e,t)}});const s=await zo(n,r,Oo);if(!await Oo.startCircuit(s))return void r.log(uo.Error,"Failed to start the circuit.");let a=!1;const c=()=>{if(!a){const e=new FormData,t=Oo.circuitId;e.append("circuitId",t),a=navigator.sendBeacon("_blazor/disconnect",e)}};ft.disconnect=c,window.addEventListener("unload",c,{capture:!1,once:!0}),r.log(uo.Information,"Blazor server-side application started."),o.invokeAfterStartedCallbacks(ft)}(this))}async startWebAssemblyIfNotStarted(){this.startLoadingWebAssemblyIfNotStarted(),this._hasStartedWebAssembly||(this._hasStartedWebAssembly=!0,await async function(e){if(xr)throw new Error("Blazor WebAssembly has already started.");xr=!0,function(){if(window.parent!==window&&!window.opener&&window.frameElement){const e=window.sessionStorage&&window.sessionStorage["Microsoft.AspNetCore.Components.WebAssembly.Authentication.CachedAuthSettings"],t=e&&JSON.parse(e);return t&&t.redirect_uri&&location.href.startsWith(t.redirect_uri)}return!1}()&&await new Promise((()=>{}));const t=Rr();!function(e){const t=R;R=(e,n,o)=>{((e,t,n)=>{const o=function(e){return Se[e]}(e);o.eventDelegator.getHandler(t)&&hr.invokeWhenHeapUnlocked(n)})(e,n,(()=>t(e,n,o)))}}(),ft._internal.applyHotReload=(e,t,n,o)=>{or.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","ApplyHotReloadDelta",e,t,n,o)},ft._internal.getApplyUpdateCapabilities=()=>or.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","GetApplyUpdateCapabilities"),ft._internal.invokeJSFromDotNet=Pr,ft._internal.invokeJSJson=Ur,ft._internal.endInvokeDotNetFromJS=Mr,ft._internal.receiveWebAssemblyDotNetDataStream=Lr,ft._internal.receiveByteArray=Fr;const n=qo(hr);ft.platform=n,ft._internal.renderBatch=(e,t)=>{const n=hr.beginHeapLock();try{ke(e,new vr(t))}finally{n.release()}},ft._internal.navigationManager.listenForNavigationEvents((async(e,t,n)=>{await or.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChanged",e,t,n)}),(async(e,t,n,o)=>{const r=await or.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChangingAsync",t,n,o);ft._internal.navigationManager.endLocationChanging(e,r)}));const o=new Ir(e);let r;ft._internal.registeredComponents={getRegisteredComponentsCount:()=>o.getCount(),getAssembly:e=>o.getAssembly(e),getTypeName:e=>o.getTypeName(e),getParameterDefinitions:e=>o.getParameterDefinitions(e)||"",getParameterValues:e=>o.getParameterValues(e)||""},ft._internal.getPersistedState=()=>wo(document)||"",ft._internal.attachRootComponentToElement=(e,t,n)=>{const r=o.resolveRegisteredElement(e,t);r?Ie(n,r,t,!1):function(e,t,n){const o="::before";let r=!1;if(e.endsWith("::after"))e=e.slice(0,-7),r=!0;else if(e.endsWith(o))throw new Error(`The '${o}' selector is not supported.`);const i=w(e)||document.querySelector(e);if(!i)throw new Error(`Could not find any element matching selector '${e}'.`);Ie(n||0,z(i,!0),t,r)}(e,t,n)};try{await t,r=await n.start()}catch(e){throw new Error(`Failed to start platform. Reason: ${e}`)}n.callEntryPoint(),r.invokeLibraryInitializers("afterStarted",[ft])}(this))}async refreshAllRootComponentsAfter(e){await e,this._hasPendingRootComponentUpdate||(this._hasPendingRootComponentUpdate=!0,setTimeout((()=>{this.refreshAllRootComponents()}),0))}refreshAllRootComponents(){this._hasPendingRootComponentUpdate=!1,this.refreshRootComponents(this._activeDescriptors)}refreshRootComponents(e){const t=new Map;for(const n of e){const e=this.getRootComponentInfo(n),o=this.determinePendingOperation(n,e);if(!o)continue;const r=e.assignedRendererId;if(!r)throw new Error("Descriptors must be assigned a renderer ID before getting used as root components");let i=t.get(r);i||(i=[],t.set(r,i)),i.push(o)}for(const[e,r]of t)n=e,o=JSON.stringify(r),N(n).invokeMethodAsync("UpdateRootComponents",o);var n,o}resolveRendererIdForDescriptor(e){switch("auto"===e.type?this.getAutoRenderMode():e.type){case"server":return this.startCircutIfNotStarted(),po.Server;case"webassembly":return this.startWebAssemblyIfNotStarted(),po.WebAssembly;case null:return null}}getAutoRenderMode(){return this._hasLoadedWebAssembly?"webassembly":this._didWebAssemblyFailToLoadQuickly?"server":null}determinePendingOperation(e,t){if(function(e){return document.contains(e.start)}(e)){if(void 0===t.assignedRendererId){if(zr)return null;const n=this.resolveRendererIdForDescriptor(e);return null===n?null:D(n)?(t.assignedRendererId=n,t.uniqueIdAtLastUpdate=e.uniqueId,this._descriptorsPendingInteractivityById[e.uniqueId]=e,{type:"add",selectorId:e.uniqueId,marker:Do(e)}):null}if(t.uniqueIdAtLastUpdate===e.uniqueId)return null;if(void 0!==t.interactiveComponentId)return t.uniqueIdAtLastUpdate=e.uniqueId,{type:"update",componentId:t.interactiveComponentId,marker:Do(e)}}else if(this.unregisterComponentDescriptor(e),void 0!==t.interactiveComponentId)return{type:"remove",componentId:t.interactiveComponentId};return null}resolveRootComponent(e,t){const n=this._descriptorsPendingInteractivityById[e];if(!n)throw new Error(`Could not resolve a root component for descriptor with ID '${e}'.`);const o=this.getRootComponentInfo(n);if(void 0!==o.interactiveComponentId)throw new Error("Cannot resolve a root component for the same descriptor multiple times.");return o.interactiveComponentId=t,this.refreshRootComponents([n]),n}getRootComponentInfo(e){let t=this._rootComponentInfoByDescriptor.get(e);return t||(t={},this._rootComponentInfoByDescriptor.set(e,t)),t}};function gi(e){var t;if(pi)throw new Error("Blazor has already started.");return pi=!0,ft._internal.loadWebAssemblyQuicklyTimeout=3e3,function(e){if($o)throw new Error("Circuit options have already been configured.");$o=e}(null==e?void 0:e.circuit),Nr(null==e?void 0:e.webAssembly),Jr=fi,function(e,t){li=t,(null==e?void 0:e.disableDomPreservation)&&(hi=!1),customElements.define("blazor-ssr",di)}(null==e?void 0:e.ssr,fi),(null===(t=null==e?void 0:e.ssr)||void 0===t?void 0:t.disableDomPreservation)||(Wr=fi,document.addEventListener("click",ri),document.addEventListener("submit",si),window.addEventListener("popstate",ii),Te=oi),function(e){const t=Qr(document);for(const e of t)null==Jr||Jr.registerComponentDescriptor(e)}(),fi.documentUpdated(),Promise.resolve()}ft.start=gi,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&gi()})()})(); \ No newline at end of file diff --git a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts index d9e13bdf6ea8..9cdd773d4d1a 100644 --- a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts +++ b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts @@ -133,7 +133,10 @@ export async function performEnhancedPageLoad(internalDestinationHref: string, f const abortSignal = currentEnhancedNavigationAbortController.signal; const responsePromise = fetch(internalDestinationHref, Object.assign({ signal: abortSignal, - headers: { 'blazor-enhanced-nav': 'on' }, + headers: { + 'blazor-enhanced-nav': 'on', + 'accept': 'text/html', + }, }, fetchOptions)); await getResponsePartsWithFraming(responsePromise, abortSignal, (response, initialContent) => { diff --git a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs index 9867fdbdd8c0..8771df388afe 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs @@ -70,6 +70,24 @@ public void CanNavigateToNonHtmlResponse() Browser.Equal("Hello, this is plain text", () => Browser.Exists(By.TagName("html")).Text); } + [Fact] + public void EnhancedNavRequestsIncludeExpectedHeaders() + { + Navigate($"{ServerPathBase}/nav"); + Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("List headers")).Click(); + + var ul = Browser.Exists(By.Id("all-headers")); + var allHeaders = ul.FindElements(By.TagName("li")).Select(x => x.Text.ToLowerInvariant()).ToList(); + + // The server can trigger arbitrary behavior based on this + Assert.Contains("blazor-enhanced-nav: on", allHeaders); + + // This is to make the enhanced nav outcomes more similar to non-enhanced nav. + // For example, the default error middleware will only serve the error page if + // this header is included. + Assert.Contains("accept: text/html", allHeaders); + } + [Fact] public void ScrollsToHashWithContentAddedAsynchronously() { diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs b/src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs index b87e05933895..8a81bf842e51 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs +++ b/src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs @@ -4,6 +4,7 @@ using System.Globalization; using System.Reflection; using System.Security.Claims; +using System.Web; using Components.TestServer.RazorComponents; using Components.TestServer.RazorComponents.Pages.Forms; using Components.TestServer.Services; @@ -123,5 +124,17 @@ private static void MapEnhancedNavigationEndpoints(IEndpointRouteBuilder endpoin response.ContentType = "text/html"; await response.WriteAsync("

404

Sorry, there's nothing here! This is a custom server-generated 404 message.

"); }); + + // Used when testing that enhanced nav includes "Accept: text/html" + endpoints.Map("/nav/list-headers", async (HttpRequest request, HttpResponse response) => + { + response.ContentType = "text/html"; + await response.WriteAsync("
    "); + foreach (var header in request.Headers) + { + await response.WriteAsync($"
  • {HttpUtility.HtmlEncode(header.Key)}: {HttpUtility.HtmlEncode(header.Value)}
  • "); + } + await response.WriteAsync("
"); + }); } } diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/EnhancedNavLayout.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/EnhancedNavLayout.razor index ae3686ec279a..5a095fae12a0 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/EnhancedNavLayout.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/EnhancedNavLayout.razor @@ -12,9 +12,10 @@ Redirect external | Redirect while streaming | Redirect external while streaming | - Error while streaming - Interactive component navigation (server) - Interactive component navigation (webassembly) + Error while streaming | + Interactive component navigation (server) | + Interactive component navigation (webassembly) | + List headers |
@Body From 5ad966e31103542883f297799a318b284ac10308 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Wed, 23 Aug 2023 16:50:59 +0100 Subject: [PATCH 04/22] In SSR, supply HttpContext as cascading value (#50253) Fixes https://github.com/dotnet/aspnetcore/issues/48769 ### Usage ```cs [CascadingParameter] public HttpContext? Context { get; set; } ``` In SSR, this will receive the `HttpContext`. In other rendering modes where there is no HTTP context, no value will be supplied so the property will remain `null`. ### Alternative design considered In #48769 I suggested using `[SupplyParameterFromHttpContext]` but that turns out not to be practical unless we either (a) make `ICascadingValueSupplier` public, or (b) add an IVT from `M.A.Components` to `.Endpoints`. I'm not keen on doing either of the above on a whim. Plus, use of `[CascadingValue]` has advantages: * It's consistent with the existing pattern for authentication state (we have `[CascadingParameter] Task AuthenticationStateTask { get; set; }`). * Longer term, if we add more things like this, it would be nice not to add a separate special attribute for each one when `[CascadingParameter]` is already descriptive enough. Special attributes are needed only when the type of thing being supplied might reasonably clash with something else the application is doing (for example, we do need it for form/query, as they supply arbitrary types). ## Review notes It's best to look at the two commits in this PR completely separately: 1. The first commit fixes an API design problem I discovered while considering how to do this. I realised that when we added `CascadingParameterAttributeBase`, we made a design mistake: * We put the `Name` property on the abstract base class just because `CascadingParameterAttribute`, `SupplyParameterFromQuery`, and `SupplyParameterFromForm` all have a `Name`. * However, in all three cases there, the `Name` has completely different meanings. For `CascadingParameterAttribute`, it's the name associated with ``, whereas for form it's the `Request.Form` entry or fall back on property name, and for query it's the `Request.Query` entry or fall back on property name. In general there's no reason why a `CascadingParameterAttributeBase` subclass should have a `Name` at all (`SupplyParameterFromHttpContext` wasn't going to), and if it does have one, its semantics are specific to it. So these should not be the same properties. * The change we made to make `CascadingParameterAttribute.Name` virtual might even be breaking (see https://learn.microsoft.com/en-us/dotnet/core/compatibility/library-change-rules stating *DISALLOWED: Adding the virtual keyword to a member*). So it's good we can revert that here. 2. The second commit is the completely trivial implementation of supplying `HttpContext` as a cascading value, with an E2E test. --- .../src/CascadingParameterAttribute.cs | 2 +- .../src/CascadingParameterAttributeBase.cs | 6 -- ...scadingValueServiceCollectionExtensions.cs | 56 +++++++++++++++++++ .../Components/src/PublicAPI.Unshipped.txt | 13 +---- .../src/Reflection/ComponentProperties.cs | 3 +- .../src/SupplyParameterFromQueryAttribute.cs | 2 +- ...ueryProviderServiceCollectionExtensions.cs | 3 +- .../test/CascadingParameterStateTest.cs | 18 ------ .../Components/test/CascadingParameterTest.cs | 56 +++++++++++++++++-- .../test/ParameterViewTest.Assignment.cs | 2 +- ...orComponentsServiceCollectionExtensions.cs | 1 + .../src/Rendering/EndpointHtmlRenderer.cs | 2 + ...mponentsServiceCollectionExtensionsTest.cs | 35 +++++++----- .../SupplyParameterFromFormValueProvider.cs | 5 +- .../Web/src/PublicAPI.Unshipped.txt | 4 +- .../src/SupplyParameterFromFormAttribute.cs | 6 +- .../ServerRenderingTests/RenderingTest.cs | 15 +++++ .../Pages/AccessHttpContext.razor | 20 +++++++ .../MvcServiceCollectionExtensionsTest.cs | 46 +++++++++++++-- 19 files changed, 220 insertions(+), 75 deletions(-) create mode 100644 src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/AccessHttpContext.razor diff --git a/src/Components/Components/src/CascadingParameterAttribute.cs b/src/Components/Components/src/CascadingParameterAttribute.cs index bb9be43a5b08..becc2ce1cb57 100644 --- a/src/Components/Components/src/CascadingParameterAttribute.cs +++ b/src/Components/Components/src/CascadingParameterAttribute.cs @@ -20,5 +20,5 @@ public sealed class CascadingParameterAttribute : CascadingParameterAttributeBas /// that supplies a value with a compatible /// type. /// - public override string? Name { get; set; } + public string? Name { get; set; } } diff --git a/src/Components/Components/src/CascadingParameterAttributeBase.cs b/src/Components/Components/src/CascadingParameterAttributeBase.cs index 307743c890cb..47a50edce641 100644 --- a/src/Components/Components/src/CascadingParameterAttributeBase.cs +++ b/src/Components/Components/src/CascadingParameterAttributeBase.cs @@ -8,12 +8,6 @@ namespace Microsoft.AspNetCore.Components; /// public abstract class CascadingParameterAttributeBase : Attribute { - /// - /// Gets or sets the name for the parameter, which correlates to the name - /// of a cascading value. - /// - public abstract string? Name { get; set; } - /// /// Gets a flag indicating whether the cascading parameter should /// be supplied only once per component. diff --git a/src/Components/Components/src/CascadingValueServiceCollectionExtensions.cs b/src/Components/Components/src/CascadingValueServiceCollectionExtensions.cs index 07e0ae985b58..bcdfbc4f35e9 100644 --- a/src/Components/Components/src/CascadingValueServiceCollectionExtensions.cs +++ b/src/Components/Components/src/CascadingValueServiceCollectionExtensions.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.DependencyInjection.Extensions; namespace Microsoft.Extensions.DependencyInjection; @@ -50,4 +51,59 @@ public static IServiceCollection AddCascadingValue( public static IServiceCollection AddCascadingValue( this IServiceCollection serviceCollection, Func> sourceFactory) => serviceCollection.AddScoped(sourceFactory); + + /// + /// Adds a cascading value to the , if none is already registered + /// with the value type. This is equivalent to having a fixed at + /// the root of the component hierarchy. + /// + /// The value type. + /// The . + /// A callback that supplies a fixed value within each service provider scope. + /// The . + public static void TryAddCascadingValue( + this IServiceCollection serviceCollection, Func valueFactory) + { + serviceCollection.TryAddEnumerable( + ServiceDescriptor.Scoped>( + sp => new CascadingValueSource(() => valueFactory(sp), isFixed: true))); + } + + /// + /// Adds a cascading value to the , if none is already registered + /// with the value type, regardless of the . This is equivalent to having a fixed + /// at the root of the component hierarchy. + /// + /// The value type. + /// The . + /// A name for the cascading value. If set, can be configured to match based on this name. + /// A callback that supplies a fixed value within each service provider scope. + /// The . + public static void TryAddCascadingValue( + this IServiceCollection serviceCollection, string name, Func valueFactory) + { + serviceCollection.TryAddEnumerable( + ServiceDescriptor.Scoped>( + sp => new CascadingValueSource(name, () => valueFactory(sp), isFixed: true))); + } + + /// + /// Adds a cascading value to the , if none is already registered + /// with the value type. This is equivalent to having a fixed at + /// the root of the component hierarchy. + /// + /// With this overload, you can supply a which allows you + /// to notify about updates to the value later, causing recipients to re-render. This overload should + /// only be used if you plan to update the value dynamically. + /// + /// The value type. + /// The . + /// A callback that supplies a within each service provider scope. + /// The . + public static void TryAddCascadingValue( + this IServiceCollection serviceCollection, Func> sourceFactory) + { + serviceCollection.TryAddEnumerable( + ServiceDescriptor.Scoped>(sourceFactory)); + } } diff --git a/src/Components/Components/src/PublicAPI.Unshipped.txt b/src/Components/Components/src/PublicAPI.Unshipped.txt index f892dc2cbd74..0e534c7e557e 100644 --- a/src/Components/Components/src/PublicAPI.Unshipped.txt +++ b/src/Components/Components/src/PublicAPI.Unshipped.txt @@ -1,6 +1,4 @@ #nullable enable -abstract Microsoft.AspNetCore.Components.CascadingParameterAttributeBase.Name.get -> string? -abstract Microsoft.AspNetCore.Components.CascadingParameterAttributeBase.Name.set -> void abstract Microsoft.AspNetCore.Components.RenderModeAttribute.Mode.get -> Microsoft.AspNetCore.Components.IComponentRenderMode! Microsoft.AspNetCore.Components.CascadingParameterAttributeBase Microsoft.AspNetCore.Components.CascadingParameterAttributeBase.CascadingParameterAttributeBase() -> void @@ -83,24 +81,19 @@ Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddComponentParamete Microsoft.AspNetCore.Components.StreamRenderingAttribute Microsoft.AspNetCore.Components.StreamRenderingAttribute.Enabled.get -> bool Microsoft.AspNetCore.Components.StreamRenderingAttribute.StreamRenderingAttribute(bool enabled) -> void -*REMOVED*Microsoft.AspNetCore.Components.CascadingParameterAttribute.Name.get -> string? -*REMOVED*Microsoft.AspNetCore.Components.CascadingParameterAttribute.Name.set -> void Microsoft.AspNetCore.Components.SupplyParameterFromQueryProviderServiceCollectionExtensions Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions -override Microsoft.AspNetCore.Components.CascadingParameterAttribute.Name.get -> string? -override Microsoft.AspNetCore.Components.CascadingParameterAttribute.Name.set -> void override Microsoft.AspNetCore.Components.EventCallback.GetHashCode() -> int override Microsoft.AspNetCore.Components.EventCallback.Equals(object? obj) -> bool override Microsoft.AspNetCore.Components.EventCallback.GetHashCode() -> int override Microsoft.AspNetCore.Components.EventCallback.Equals(object? obj) -> bool -*REMOVED*Microsoft.AspNetCore.Components.SupplyParameterFromQueryAttribute.Name.get -> string? -*REMOVED*Microsoft.AspNetCore.Components.SupplyParameterFromQueryAttribute.Name.set -> void -override Microsoft.AspNetCore.Components.SupplyParameterFromQueryAttribute.Name.get -> string? -override Microsoft.AspNetCore.Components.SupplyParameterFromQueryAttribute.Name.set -> void static Microsoft.AspNetCore.Components.SupplyParameterFromQueryProviderServiceCollectionExtensions.AddSupplyValueFromQueryProvider(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! static Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions.AddCascadingValue(this Microsoft.Extensions.DependencyInjection.IServiceCollection! serviceCollection, string! name, System.Func! valueFactory) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! static Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions.AddCascadingValue(this Microsoft.Extensions.DependencyInjection.IServiceCollection! serviceCollection, System.Func!>! sourceFactory) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! static Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions.AddCascadingValue(this Microsoft.Extensions.DependencyInjection.IServiceCollection! serviceCollection, System.Func! valueFactory) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! +static Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions.TryAddCascadingValue(this Microsoft.Extensions.DependencyInjection.IServiceCollection! serviceCollection, string! name, System.Func! valueFactory) -> void +static Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions.TryAddCascadingValue(this Microsoft.Extensions.DependencyInjection.IServiceCollection! serviceCollection, System.Func!>! sourceFactory) -> void +static Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions.TryAddCascadingValue(this Microsoft.Extensions.DependencyInjection.IServiceCollection! serviceCollection, System.Func! valueFactory) -> void virtual Microsoft.AspNetCore.Components.NavigationManager.Refresh(bool forceReload = false) -> void virtual Microsoft.AspNetCore.Components.Rendering.ComponentState.DisposeAsync() -> System.Threading.Tasks.ValueTask virtual Microsoft.AspNetCore.Components.RenderTree.Renderer.AddPendingTask(Microsoft.AspNetCore.Components.Rendering.ComponentState? componentState, System.Threading.Tasks.Task! task) -> void diff --git a/src/Components/Components/src/Reflection/ComponentProperties.cs b/src/Components/Components/src/Reflection/ComponentProperties.cs index d49cfad7978a..9a0b3cbdfdb4 100644 --- a/src/Components/Components/src/Reflection/ComponentProperties.cs +++ b/src/Components/Components/src/Reflection/ComponentProperties.cs @@ -184,8 +184,7 @@ private static void ThrowForUnknownIncomingParameterName([DynamicallyAccessedMem { throw new InvalidOperationException( $"Object of type '{targetType.FullName}' has a property matching the name '{parameterName}', " + - $"but it does not have [{nameof(ParameterAttribute)}], [{nameof(CascadingParameterAttribute)}] or " + - $"[SupplyParameterFromFormAttribute] applied."); + $"but it does not have [Parameter], [CascadingParameter], or any other parameter-supplying attribute."); } else { diff --git a/src/Components/Components/src/SupplyParameterFromQueryAttribute.cs b/src/Components/Components/src/SupplyParameterFromQueryAttribute.cs index ffae75576ff7..9177a8d652c2 100644 --- a/src/Components/Components/src/SupplyParameterFromQueryAttribute.cs +++ b/src/Components/Components/src/SupplyParameterFromQueryAttribute.cs @@ -14,5 +14,5 @@ public sealed class SupplyParameterFromQueryAttribute : CascadingParameterAttrib /// Gets or sets the name of the querystring parameter. If null, the querystring /// parameter is assumed to have the same name as the associated property. /// - public override string? Name { get; set; } + public string? Name { get; set; } } diff --git a/src/Components/Components/src/SupplyParameterFromQueryProviderServiceCollectionExtensions.cs b/src/Components/Components/src/SupplyParameterFromQueryProviderServiceCollectionExtensions.cs index 3de3ab99ee9a..21cb8c98db19 100644 --- a/src/Components/Components/src/SupplyParameterFromQueryProviderServiceCollectionExtensions.cs +++ b/src/Components/Components/src/SupplyParameterFromQueryProviderServiceCollectionExtensions.cs @@ -50,7 +50,8 @@ public bool CanSupplyValue(in CascadingParameterInfo parameterInfo) UpdateQueryParameters(); } - var queryParameterName = parameterInfo.Attribute.Name ?? parameterInfo.PropertyName; + var attribute = (SupplyParameterFromQueryAttribute)parameterInfo.Attribute; // Must be a valid cast because we check in CanSupplyValue + var queryParameterName = attribute.Name ?? parameterInfo.PropertyName; return _queryParameterValueSupplier.GetQueryParameterValue(parameterInfo.PropertyType, queryParameterName); } diff --git a/src/Components/Components/test/CascadingParameterStateTest.cs b/src/Components/Components/test/CascadingParameterStateTest.cs index ed6420fffb25..e055b9c70801 100644 --- a/src/Components/Components/test/CascadingParameterStateTest.cs +++ b/src/Components/Components/test/CascadingParameterStateTest.cs @@ -476,8 +476,6 @@ class ComponentWithNamedCascadingParam : TestComponentBase class SupplyParameterWithSingleDeliveryAttribute : CascadingParameterAttributeBase { - public override string Name { get; set; } - internal override bool SingleDelivery => true; } @@ -523,19 +521,3 @@ public TestNavigationManager() } } } - -[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] -public sealed class SupplyParameterFromFormAttribute : CascadingParameterAttributeBase -{ - /// - /// Gets or sets the name for the parameter. The name is used to match - /// the form data and decide whether or not the value needs to be bound. - /// - public override string Name { get; set; } - - /// - /// Gets or sets the name for the handler. The name is used to match - /// the form data and decide whether or not the value needs to be bound. - /// - public string Handler { get; set; } -} diff --git a/src/Components/Components/test/CascadingParameterTest.cs b/src/Components/Components/test/CascadingParameterTest.cs index 9ce74e19708b..a99baeb96833 100644 --- a/src/Components/Components/test/CascadingParameterTest.cs +++ b/src/Components/Components/test/CascadingParameterTest.cs @@ -727,6 +727,51 @@ public void OmitsSingleDeliveryCascadingParametersWhenUpdatingDirectParameters() }); } + [Fact] + public void CanUseTryAddPatternForCascadingValuesInServiceCollection_ValueFactory() + { + // Arrange + var services = new ServiceCollection(); + + // Act + services.TryAddCascadingValue(_ => new Type1()); + services.TryAddCascadingValue(_ => new Type1()); + services.TryAddCascadingValue(_ => new Type2()); + + // Assert + Assert.Equal(2, services.Count()); + } + + [Fact] + public void CanUseTryAddPatternForCascadingValuesInServiceCollection_NamedValueFactory() + { + // Arrange + var services = new ServiceCollection(); + + // Act + services.TryAddCascadingValue("Name1", _ => new Type1()); + services.TryAddCascadingValue("Name2", _ => new Type1()); + services.TryAddCascadingValue("Name3", _ => new Type2()); + + // Assert + Assert.Equal(2, services.Count()); + } + + [Fact] + public void CanUseTryAddPatternForCascadingValuesInServiceCollection_CascadingValueSource() + { + // Arrange + var services = new ServiceCollection(); + + // Act + services.TryAddCascadingValue(_ => new CascadingValueSource("Name1", new Type1(), false)); + services.TryAddCascadingValue(_ => new CascadingValueSource("Name2", new Type1(), false)); + services.TryAddCascadingValue(_ => new CascadingValueSource("Name3", new Type2(), false)); + + // Assert + Assert.Equal(2, services.Count()); + } + private class SingleDeliveryValue(string text) { public string Text => text; @@ -734,8 +779,6 @@ private class SingleDeliveryValue(string text) private class SingleDeliveryCascadingParameterAttribute : CascadingParameterAttributeBase { - public override string Name { get; set; } - internal override bool SingleDelivery => true; } @@ -852,13 +895,11 @@ class SecondCascadingParameterConsumerComponent : CascadingParameterCons [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] class CustomCascadingParameter1Attribute : CascadingParameterAttributeBase { - public override string Name { get; set; } } [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] class CustomCascadingParameter2Attribute : CascadingParameterAttributeBase { - public override string Name { get; set; } } class CustomCascadingValueProducer : AutoRenderComponent, ICascadingValueSupplier @@ -904,7 +945,7 @@ void ICascadingValueSupplier.Unsubscribe(ComponentState subscriber, in Cascading class CustomCascadingValueConsumer1 : AutoRenderComponent { - [CustomCascadingParameter1(Name = nameof(Value))] + [CustomCascadingParameter1] public object Value { get; set; } protected override void BuildRenderTree(RenderTreeBuilder builder) @@ -915,7 +956,7 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) class CustomCascadingValueConsumer2 : AutoRenderComponent { - [CustomCascadingParameter2(Name = nameof(Value))] + [CustomCascadingParameter2] public object Value { get; set; } protected override void BuildRenderTree(RenderTreeBuilder builder) @@ -944,4 +985,7 @@ public void ChangeValue(string newValue) StringValue = newValue; } } + + class Type1 { } + class Type2 { } } diff --git a/src/Components/Components/test/ParameterViewTest.Assignment.cs b/src/Components/Components/test/ParameterViewTest.Assignment.cs index 262f9584c4e4..f0308c0182a0 100644 --- a/src/Components/Components/test/ParameterViewTest.Assignment.cs +++ b/src/Components/Components/test/ParameterViewTest.Assignment.cs @@ -183,7 +183,7 @@ public void IncomingParameterMatchesPropertyNotDeclaredAsParameter_Throws() Assert.Equal(default, target.IntProp); Assert.Equal( $"Object of type '{typeof(HasPropertyWithoutParameterAttribute).FullName}' has a property matching the name '{nameof(HasPropertyWithoutParameterAttribute.IntProp)}', " + - $"but it does not have [{nameof(ParameterAttribute)}], [{nameof(CascadingParameterAttribute)}] or [{nameof(SupplyParameterFromFormAttribute)}] applied.", + "but it does not have [Parameter], [CascadingParameter], or any other parameter-supplying attribute.", ex.Message); } diff --git a/src/Components/Endpoints/src/DependencyInjection/RazorComponentsServiceCollectionExtensions.cs b/src/Components/Endpoints/src/DependencyInjection/RazorComponentsServiceCollectionExtensions.cs index 3b143bb6cff2..9fa6c8c27890 100644 --- a/src/Components/Endpoints/src/DependencyInjection/RazorComponentsServiceCollectionExtensions.cs +++ b/src/Components/Endpoints/src/DependencyInjection/RazorComponentsServiceCollectionExtensions.cs @@ -63,6 +63,7 @@ public static IRazorComponentsBuilder AddRazorComponents(this IServiceCollection services.TryAddScoped(); services.TryAddScoped(sp => sp.GetRequiredService()); services.AddSupplyValueFromQueryProvider(); + services.TryAddCascadingValue(sp => sp.GetRequiredService().HttpContext); // Form handling services.AddSupplyValueFromFormProvider(); diff --git a/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.cs b/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.cs index 1118dfeb5825..0c46325988a1 100644 --- a/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.cs +++ b/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.cs @@ -52,6 +52,8 @@ public EndpointHtmlRenderer(IServiceProvider serviceProvider, ILoggerFactory log _services = serviceProvider; } + internal HttpContext? HttpContext => _httpContext; + private void SetHttpContext(HttpContext httpContext) { if (_httpContext is null) diff --git a/src/Components/Endpoints/test/RazorComponentsServiceCollectionExtensionsTest.cs b/src/Components/Endpoints/test/RazorComponentsServiceCollectionExtensionsTest.cs index 819e6b8b4294..74aa7caad748 100644 --- a/src/Components/Endpoints/test/RazorComponentsServiceCollectionExtensionsTest.cs +++ b/src/Components/Endpoints/test/RazorComponentsServiceCollectionExtensionsTest.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms.Mapping; @@ -28,8 +29,8 @@ public void AddRazorComponents_RegistersServices() } else { - // 'multi-registration' services should only have one *instance* of each implementation registered. - AssertContainsSingle(services, service.ServiceType, service.ImplementationType); + // 'multi-registration' services should not have any duplicate implementation types + AssertAllImplementationTypesAreDistinct(services, service.ServiceType); } } } @@ -55,8 +56,8 @@ public void AddRazorComponentsTwice_DoesNotDuplicateServices() } else { - // 'multi-registration' services should only have one *instance* of each implementation registered. - AssertContainsSingle(services, service.ServiceType, service.ImplementationType); + // 'multi-registration' services should not have any duplicate implementation types + AssertAllImplementationTypesAreDistinct(services, service.ServiceType); } } } @@ -104,28 +105,32 @@ private void AssertServiceCountEquals( $" time(s) but was actually registered {actual} time(s)."); } - private void AssertContainsSingle( + private void AssertAllImplementationTypesAreDistinct( IServiceCollection services, - Type serviceType, - Type implementationType) + Type serviceType) { - var matches = services - .Where(sd => - sd.ServiceType == serviceType && - sd.ImplementationType == implementationType) + var serviceProvider = services.BuildServiceProvider(); + var implementationTypes = services + .Where(sd => sd.ServiceType == serviceType) + .Select(service => service switch + { + { ImplementationType: { } type } => type, + { ImplementationInstance: { } instance } => instance.GetType(), + { ImplementationFactory: { } factory } => factory(serviceProvider).GetType(), + }) .ToArray(); - if (matches.Length == 0) + if (implementationTypes.Length == 0) { Assert.True( false, - $"Could not find an instance of {implementationType} registered as {serviceType}"); + $"Could not find an implementation type for {serviceType}"); } - else if (matches.Length > 1) + else if (implementationTypes.Length != implementationTypes.Distinct().Count()) { Assert.True( false, - $"Found multiple instances of {implementationType} registered as {serviceType}"); + $"Found duplicate implementation types for {serviceType}. Implementation types: {string.Join(", ", implementationTypes.Select(x => x.ToString()))}"); } } } diff --git a/src/Components/Web/src/Forms/Mapping/SupplyParameterFromFormValueProvider.cs b/src/Components/Web/src/Forms/Mapping/SupplyParameterFromFormValueProvider.cs index 010f2a49f1b0..123b14622680 100644 --- a/src/Components/Web/src/Forms/Mapping/SupplyParameterFromFormValueProvider.cs +++ b/src/Components/Web/src/Forms/Mapping/SupplyParameterFromFormValueProvider.cs @@ -73,8 +73,9 @@ void ICascadingValueSupplier.Unsubscribe(ComponentState subscriber, in Cascading { Debug.Assert(mappingContext != null); - var parameterName = parameterInfo.Attribute.Name ?? parameterInfo.PropertyName; - var restrictToFormName = ((SupplyParameterFromFormAttribute)parameterInfo.Attribute).Handler; + var attribute = (SupplyParameterFromFormAttribute)parameterInfo.Attribute; // Must be a valid cast because we check in CanSupplyValue + var parameterName = attribute.Name ?? parameterInfo.PropertyName; + var restrictToFormName = attribute.Handler; Action errorHandler = string.IsNullOrEmpty(restrictToFormName) ? mappingContext.AddError : (name, message, value) => mappingContext.AddError(restrictToFormName, parameterName, message, value); diff --git a/src/Components/Web/src/PublicAPI.Unshipped.txt b/src/Components/Web/src/PublicAPI.Unshipped.txt index 341bc7e08f50..51a388b43767 100644 --- a/src/Components/Web/src/PublicAPI.Unshipped.txt +++ b/src/Components/Web/src/PublicAPI.Unshipped.txt @@ -65,6 +65,8 @@ Microsoft.AspNetCore.Components.HtmlRendering.Infrastructure.StaticHtmlRenderer. Microsoft.AspNetCore.Components.SupplyParameterFromFormAttribute Microsoft.AspNetCore.Components.SupplyParameterFromFormAttribute.Handler.get -> string? Microsoft.AspNetCore.Components.SupplyParameterFromFormAttribute.Handler.set -> void +Microsoft.AspNetCore.Components.SupplyParameterFromFormAttribute.Name.get -> string? +Microsoft.AspNetCore.Components.SupplyParameterFromFormAttribute.Name.set -> void Microsoft.AspNetCore.Components.SupplyParameterFromFormAttribute.SupplyParameterFromFormAttribute() -> void Microsoft.AspNetCore.Components.Web.AutoRenderMode Microsoft.AspNetCore.Components.Web.AutoRenderMode.AutoRenderMode() -> void @@ -111,8 +113,6 @@ override Microsoft.AspNetCore.Components.Forms.Editor.OnParametersSet() -> vo override Microsoft.AspNetCore.Components.HtmlRendering.Infrastructure.StaticHtmlRenderer.Dispatcher.get -> Microsoft.AspNetCore.Components.Dispatcher! override Microsoft.AspNetCore.Components.HtmlRendering.Infrastructure.StaticHtmlRenderer.HandleException(System.Exception! exception) -> void override Microsoft.AspNetCore.Components.HtmlRendering.Infrastructure.StaticHtmlRenderer.UpdateDisplayAsync(in Microsoft.AspNetCore.Components.RenderTree.RenderBatch renderBatch) -> System.Threading.Tasks.Task! -override Microsoft.AspNetCore.Components.SupplyParameterFromFormAttribute.Name.get -> string? -override Microsoft.AspNetCore.Components.SupplyParameterFromFormAttribute.Name.set -> void override Microsoft.AspNetCore.Components.Web.RenderModeAutoAttribute.Mode.get -> Microsoft.AspNetCore.Components.IComponentRenderMode! override Microsoft.AspNetCore.Components.Web.RenderModeServerAttribute.Mode.get -> Microsoft.AspNetCore.Components.IComponentRenderMode! override Microsoft.AspNetCore.Components.Web.RenderModeWebAssemblyAttribute.Mode.get -> Microsoft.AspNetCore.Components.IComponentRenderMode! diff --git a/src/Components/Web/src/SupplyParameterFromFormAttribute.cs b/src/Components/Web/src/SupplyParameterFromFormAttribute.cs index 94820b9d0957..8aba004415b5 100644 --- a/src/Components/Web/src/SupplyParameterFromFormAttribute.cs +++ b/src/Components/Web/src/SupplyParameterFromFormAttribute.cs @@ -11,11 +11,9 @@ namespace Microsoft.AspNetCore.Components; public sealed class SupplyParameterFromFormAttribute : CascadingParameterAttributeBase { /// - /// Gets or sets the name for the parameter. The name is used to determine - /// the prefix to use to match the form data and decide whether or not the - /// value needs to be bound. + /// Gets or sets the name for the form value. If not specified, the property name will be used. /// - public override string? Name { get; set; } + public string? Name { get; set; } /// /// Gets or sets the name for the handler. The name is used to match diff --git a/src/Components/test/E2ETest/ServerRenderingTests/RenderingTest.cs b/src/Components/test/E2ETest/ServerRenderingTests/RenderingTest.cs index ce616f81d0ee..21c3e01d4712 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/RenderingTest.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/RenderingTest.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Net; +using System.Net.Http; using Components.TestServer.RazorComponents; using Microsoft.AspNetCore.Components.E2ETest.Infrastructure; using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures; @@ -25,6 +27,7 @@ public RenderingTest( public override Task InitializeAsync() => InitializeAsync(BrowserFixture.StreamingContext); + [Fact] [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/49975")] public void CanRenderLargeComponentsWithServerRenderMode() { @@ -35,4 +38,16 @@ public void CanRenderLargeComponentsWithServerRenderMode() Assert.Equal(result, Browser.FindElement(By.Id("server-prerender")).Text); Assert.Equal(result, Browser.FindElement(By.Id("server-prerender")).Text); } + + [Fact] + public async Task CanUseHttpContextRequestAndResponse() + { + Navigate($"{ServerPathBase}/httpcontext"); + Browser.Equal("GET", () => Browser.FindElement(By.Id("request-method")).Text); + Browser.Equal("/httpcontext", () => Browser.FindElement(By.Id("request-path")).Text); + + // We can't see the response status code using Selenium, so make a direct request + var response = await new HttpClient().GetAsync(Browser.Url); + Assert.Equal(HttpStatusCode.Created, response.StatusCode); + } } diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/AccessHttpContext.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/AccessHttpContext.razor new file mode 100644 index 000000000000..96c89cfd0da4 --- /dev/null +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/AccessHttpContext.razor @@ -0,0 +1,20 @@ +@page "/httpcontext" + +

HttpContext

+ +

+ Request method: @Ctx.Request.Method +

+

+ Request path: @Ctx.Request.Path +

+ +@code { + [CascadingParameter] public HttpContext Ctx { get; set; } + + protected override void OnInitialized() + { + // Show we can change the response status code + Ctx.Response.StatusCode = 201; + } +} diff --git a/src/Mvc/Mvc/test/MvcServiceCollectionExtensionsTest.cs b/src/Mvc/Mvc/test/MvcServiceCollectionExtensionsTest.cs index 78e32dbaebff..3520e30a01ee 100644 --- a/src/Mvc/Mvc/test/MvcServiceCollectionExtensionsTest.cs +++ b/src/Mvc/Mvc/test/MvcServiceCollectionExtensionsTest.cs @@ -162,6 +162,7 @@ public void AddMvc_Twice_DoesNotAddDuplicates() { // Arrange var services = new ServiceCollection(); + services.AddLogging(); services.AddSingleton(GetHostingEnvironment()); // Act @@ -177,6 +178,7 @@ public void AddControllersAddRazorPages_Twice_DoesNotAddDuplicates() { // Arrange var services = new ServiceCollection(); + services.AddLogging(); services.AddSingleton(GetHostingEnvironment()); // Act @@ -194,6 +196,7 @@ public void AddControllersWithViews_Twice_DoesNotAddDuplicates() { // Arrange var services = new ServiceCollection(); + services.AddLogging(); services.AddSingleton(GetHostingEnvironment()); // Act @@ -209,6 +212,7 @@ public void AddRazorPages_Twice_DoesNotAddDuplicates() { // Arrange var services = new ServiceCollection(); + services.AddLogging(); services.AddSingleton(GetHostingEnvironment()); // Act @@ -251,6 +255,7 @@ public void AddControllersWithViews_AddsDocumentedServices() private void VerifyAllServices(IServiceCollection services) { var singleRegistrationServiceTypes = SingleRegistrationServiceTypes; + var serviceProvider = services.BuildServiceProvider(); foreach (var service in services) { if (singleRegistrationServiceTypes.Contains(service.ServiceType)) @@ -258,14 +263,24 @@ private void VerifyAllServices(IServiceCollection services) // 'single-registration' services should only have one implementation registered. AssertServiceCountEquals(services, service.ServiceType, 1); } - else if (service.ImplementationType != null && !service.ImplementationType.Assembly.FullName.Contains("Mvc")) - { - // Ignore types that don't come from MVC - } else { - // 'multi-registration' services should only have one *instance* of each implementation registered. - AssertContainsSingle(services, service.ServiceType, service.ImplementationType); + var implementationType = service switch + { + { ImplementationType: { } type } => type, + { ImplementationInstance: { } instance } => instance.GetType(), + { ImplementationFactory: { } factory } => factory(serviceProvider).GetType(), + }; + + if (implementationType != null && !implementationType.Assembly.FullName.Contains("Mvc")) + { + // Ignore types that don't come from MVC + } + else + { + // 'multi-registration' services should only have one *instance* of each implementation registered. + AssertContainsSingle(services, service.ServiceType, service.ImplementationType); + } } } } @@ -625,6 +640,25 @@ private void AssertContainsSingle( } else if (matches.Length > 1) { + var implementations = new List(); + var sp = services.BuildServiceProvider(); + foreach ( var service in matches ) + { + if (service.ImplementationType is not null) + { + implementations.Add(service.ImplementationType); + } + else if (service.ImplementationInstance is not null) + { + implementations.Add(service.ImplementationInstance.GetType()); + } + else if (service.ImplementationFactory is not null) + { + var instance = service.ImplementationFactory(sp); + implementations.Add(instance.GetType()); + } + } + Assert.True( false, $"Found multiple instances of {implementationType} registered as {serviceType}"); From 0e5ea7e54b4b27b9b467799d21af2586e1b4ee6d Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Wed, 23 Aug 2023 16:51:55 +0100 Subject: [PATCH 05/22] Fix SSR redirections. Fixes #49670 (#50261) Fixes #49670 trivially by making `HttpNavigationManager`'s redirection logic consistent with the other `NavigationManager` implementations. You'll be wondering why there are no E2E tests with this PR. The reason is that, surprisingly, we *already* have E2E tests for these kinds of non-root redirections. However, they were falsely passing, which is tracked by https://github.com/dotnet/aspnetcore/issues/50260 and is outside the scope of this PR. I think we should address that other issue in .NET 9 as there should be no developer/API impact from leaving it as-is for .NET 8. --- .../Endpoints/src/DependencyInjection/HttpNavigationManager.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Components/Endpoints/src/DependencyInjection/HttpNavigationManager.cs b/src/Components/Endpoints/src/DependencyInjection/HttpNavigationManager.cs index 0da30332d2c4..8098deb3b6ce 100644 --- a/src/Components/Endpoints/src/DependencyInjection/HttpNavigationManager.cs +++ b/src/Components/Endpoints/src/DependencyInjection/HttpNavigationManager.cs @@ -11,6 +11,7 @@ internal sealed class HttpNavigationManager : NavigationManager, IHostEnvironmen protected override void NavigateToCore(string uri, bool forceLoad) { - throw new NavigationException(uri); + var absoluteUriString = ToAbsoluteUri(uri).ToString(); + throw new NavigationException(absoluteUriString); } } From 1f7f7381ad80069b549d4365c9cc48964cba98ef Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Wed, 23 Aug 2023 21:43:42 +0100 Subject: [PATCH 06/22] API review followups (#50181) * RazorComponentResult: change namespace, make executor internal, merge test classes * RazorComponentResult: Nullability and trim annotations * RazorComponentResult: IStatusCodeHttpResult and IContentTypeHttpResult * Cleanup * Further clean up annotations * Remove HtmlRootComponent.ComponentId as per API review * Rename SupplyParameterFromFormAttribute.Handler to FormName * API review: seal * Clarify RenderModeAttribute inheritance. Fixes #49848 * Rename valueFactory -> initialValueFactory * Remove unnecessary sequence params * Make [StreamRendering] default to true --- ...scadingValueServiceCollectionExtensions.cs | 12 +- .../Components/src/CascadingValueSource.cs | 10 +- .../Components/src/PublicAPI.Unshipped.txt | 14 +- .../Components/src/RenderModeAttribute.cs | 2 +- .../RenderTree/RenderTreeFrameArrayBuilder.cs | 8 +- .../src/Rendering/RenderTreeBuilder.cs | 20 +- .../src/StreamRenderingAttribute.cs | 4 +- .../Components/test/ComponentFactoryTest.cs | 33 ++ .../test/RenderTreeDiffBuilderTest.cs | 24 +- .../Components/test/RendererTest.cs | 4 +- .../test/Rendering/RenderTreeBuilderTest.cs | 26 +- ...orComponentsServiceCollectionExtensions.cs | 3 - .../Endpoints/src/PublicAPI.Unshipped.txt | 38 +- .../src/Results/RazorComponentResult.cs | 38 +- .../Results/RazorComponentResultExecutor.cs | 18 +- .../src/Results/RazorComponentResultOfT.cs | 10 +- .../test/EndpointHtmlRendererTest.cs | 14 +- .../test/RazorComponentResultExecutorTest.cs | 454 ------------------ .../test/RazorComponentResultTest.cs | 425 +++++++++++++++- ...ubleRenderingStreamingAsyncComponent.razor | 2 +- .../test/TestComponents/EnableStreaming.razor | 2 +- .../StreamingAsyncLoadingComponent.razor | 2 +- ...ComponentThatRedirectsAsynchronously.razor | 2 +- ...ingComponentThatThrowsAsynchronously.razor | 2 +- .../StreamingComponentWithChild.razor | 2 +- src/Components/Shared/test/AssertFrame.cs | 8 +- src/Components/Web/src/Forms/EditForm.cs | 12 +- .../Web/src/Forms/Mapping/FormMappingError.cs | 2 +- .../Forms/Mapping/FormValueMappingContext.cs | 11 +- .../SupplyParameterFromFormValueProvider.cs | 4 +- .../src/HtmlRendering/HtmlRootComponent.cs | 10 +- .../Web/src/PublicAPI.Unshipped.txt | 6 +- .../src/SupplyParameterFromFormAttribute.cs | 10 +- .../Mapping/SupplyParameterFromFormTest.cs | 2 +- .../test/HtmlRendering/HtmlRendererTest.cs | 8 +- .../ComponentWithFormBoundParameter.razor | 2 +- .../Components/EnableStreaming.razor | 2 +- .../EnhancedNav/PageForScrollingToHash.razor | 2 +- .../PageThatRedirectsWhileStreaming.razor | 2 +- .../PageThatThrowsWhileStreaming.razor | 2 +- .../Forms/ErrorInErrorBoundaryStreaming.razor | 2 +- .../ErrorOutsideErrorBoundaryStreaming.razor | 2 +- .../FormAntiforgeryAfterResponseStarted.razor | 2 +- .../Pages/Forms/FormThatBindsGuid.razor | 2 +- .../Pages/Forms/FormThatBindsInteger.razor | 2 +- .../Pages/Forms/ModifyHttpContextForm.razor | 2 +- .../Pages/Forms/NamedFormBoundParameter.razor | 2 +- .../NamedFormBoundPrimitiveParameter.razor | 2 +- ...imitiveParameterValidatorIntegration.razor | 2 +- .../Pages/Forms/PlainForm.razor | 4 +- .../Forms/PostRedirectGetStreaming.razor | 2 +- .../Pages/Forms/StreamingRenderingForm.razor | 2 +- .../LargeStreamRendering.razor | 2 +- .../StreamingRendering.razor | 2 +- .../StreamingWithInteractivity.razor | 2 +- 55 files changed, 623 insertions(+), 661 deletions(-) delete mode 100644 src/Components/Endpoints/test/RazorComponentResultExecutorTest.cs diff --git a/src/Components/Components/src/CascadingValueServiceCollectionExtensions.cs b/src/Components/Components/src/CascadingValueServiceCollectionExtensions.cs index bcdfbc4f35e9..f4dc1ab0b892 100644 --- a/src/Components/Components/src/CascadingValueServiceCollectionExtensions.cs +++ b/src/Components/Components/src/CascadingValueServiceCollectionExtensions.cs @@ -17,11 +17,11 @@ public static class CascadingValueServiceCollectionExtensions ///
/// The value type. /// The . - /// A callback that supplies a fixed value within each service provider scope. + /// A callback that supplies a fixed value within each service provider scope. /// The . public static IServiceCollection AddCascadingValue( - this IServiceCollection serviceCollection, Func valueFactory) - => serviceCollection.AddScoped(sp => new CascadingValueSource(() => valueFactory(sp), isFixed: true)); + this IServiceCollection serviceCollection, Func initialValueFactory) + => serviceCollection.AddScoped(sp => new CascadingValueSource(() => initialValueFactory(sp), isFixed: true)); /// /// Adds a cascading value to the . This is equivalent to having @@ -30,11 +30,11 @@ public static IServiceCollection AddCascadingValue( /// The value type. /// The . /// A name for the cascading value. If set, can be configured to match based on this name. - /// A callback that supplies a fixed value within each service provider scope. + /// A callback that supplies a fixed value within each service provider scope. /// The . public static IServiceCollection AddCascadingValue( - this IServiceCollection serviceCollection, string name, Func valueFactory) - => serviceCollection.AddScoped(sp => new CascadingValueSource(name, () => valueFactory(sp), isFixed: true)); + this IServiceCollection serviceCollection, string name, Func initialValueFactory) + => serviceCollection.AddScoped(sp => new CascadingValueSource(name, () => initialValueFactory(sp), isFixed: true)); /// /// Adds a cascading value to the . This is equivalent to having diff --git a/src/Components/Components/src/CascadingValueSource.cs b/src/Components/Components/src/CascadingValueSource.cs index 680c022c71ee..dbf9a4662265 100644 --- a/src/Components/Components/src/CascadingValueSource.cs +++ b/src/Components/Components/src/CascadingValueSource.cs @@ -48,20 +48,20 @@ public CascadingValueSource(string name, TValue value, bool isFixed) : this(valu /// /// Constructs an instance of . /// - /// A callback that produces the initial value when first required. + /// A callback that produces the initial value when first required. /// A flag to indicate whether the value is fixed. If false, all receipients will subscribe for update notifications, which you can issue by calling . These subscriptions come at a performance cost, so if the value will not change, set to true. - public CascadingValueSource(Func valueFactory, bool isFixed) : this(isFixed) + public CascadingValueSource(Func initialValueFactory, bool isFixed) : this(isFixed) { - _initialValueFactory = valueFactory; + _initialValueFactory = initialValueFactory; } /// /// Constructs an instance of . /// /// A name for the cascading value. If set, can be configured to match based on this name. - /// A callback that produces the initial value when first required. + /// A callback that produces the initial value when first required. /// A flag to indicate whether the value is fixed. If false, all receipients will subscribe for update notifications, which you can issue by calling . These subscriptions come at a performance cost, so if the value will not change, set to true. - public CascadingValueSource(string name, Func valueFactory, bool isFixed) : this(valueFactory, isFixed) + public CascadingValueSource(string name, Func initialValueFactory, bool isFixed) : this(initialValueFactory, isFixed) { ArgumentNullException.ThrowIfNull(name); _name = name; diff --git a/src/Components/Components/src/PublicAPI.Unshipped.txt b/src/Components/Components/src/PublicAPI.Unshipped.txt index 0e534c7e557e..df77f9475253 100644 --- a/src/Components/Components/src/PublicAPI.Unshipped.txt +++ b/src/Components/Components/src/PublicAPI.Unshipped.txt @@ -8,9 +8,9 @@ Microsoft.AspNetCore.Components.CascadingParameterInfo.CascadingParameterInfo() Microsoft.AspNetCore.Components.CascadingParameterInfo.PropertyName.get -> string! Microsoft.AspNetCore.Components.CascadingParameterInfo.PropertyType.get -> System.Type! Microsoft.AspNetCore.Components.CascadingValueSource -Microsoft.AspNetCore.Components.CascadingValueSource.CascadingValueSource(string! name, System.Func! valueFactory, bool isFixed) -> void +Microsoft.AspNetCore.Components.CascadingValueSource.CascadingValueSource(string! name, System.Func! initialValueFactory, bool isFixed) -> void Microsoft.AspNetCore.Components.CascadingValueSource.CascadingValueSource(string! name, TValue value, bool isFixed) -> void -Microsoft.AspNetCore.Components.CascadingValueSource.CascadingValueSource(System.Func! valueFactory, bool isFixed) -> void +Microsoft.AspNetCore.Components.CascadingValueSource.CascadingValueSource(System.Func! initialValueFactory, bool isFixed) -> void Microsoft.AspNetCore.Components.CascadingValueSource.CascadingValueSource(TValue value, bool isFixed) -> void Microsoft.AspNetCore.Components.CascadingValueSource.NotifyChangedAsync() -> System.Threading.Tasks.Task! Microsoft.AspNetCore.Components.CascadingValueSource.NotifyChangedAsync(TValue newValue) -> System.Threading.Tasks.Task! @@ -24,10 +24,10 @@ Microsoft.AspNetCore.Components.RenderHandle.DispatchExceptionAsync(System.Excep Microsoft.AspNetCore.Components.NavigationManager.ToAbsoluteUri(string? relativeUri) -> System.Uri! Microsoft.AspNetCore.Components.Rendering.ComponentState.LogicalParentComponentState.get -> Microsoft.AspNetCore.Components.Rendering.ComponentState? Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddComponentParameter(int sequence, string! name, Microsoft.AspNetCore.Components.IComponentRenderMode! renderMode) -> void -Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddComponentRenderMode(int sequence, Microsoft.AspNetCore.Components.IComponentRenderMode! renderMode) -> void *REMOVED*Microsoft.AspNetCore.Components.RouteData.RouteData(System.Type! pageType, System.Collections.Generic.IReadOnlyDictionary! routeValues) -> void *REMOVED*Microsoft.AspNetCore.Components.RouteData.RouteValues.get -> System.Collections.Generic.IReadOnlyDictionary! -Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddNamedEvent(int sequence, string! eventType, string! assignedName) -> void +Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddComponentRenderMode(Microsoft.AspNetCore.Components.IComponentRenderMode! renderMode) -> void +Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddNamedEvent(string! eventType, string! assignedName) -> void Microsoft.AspNetCore.Components.RenderTree.ComponentFrameFlags Microsoft.AspNetCore.Components.RenderTree.ComponentFrameFlags.HasCallerSpecifiedRenderMode = 1 -> Microsoft.AspNetCore.Components.RenderTree.ComponentFrameFlags Microsoft.AspNetCore.Components.RenderTree.NamedEventChange @@ -80,7 +80,7 @@ Microsoft.AspNetCore.Components.Sections.SectionOutlet.SectionOutlet() -> void Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddComponentParameter(int sequence, string! name, object? value) -> void Microsoft.AspNetCore.Components.StreamRenderingAttribute Microsoft.AspNetCore.Components.StreamRenderingAttribute.Enabled.get -> bool -Microsoft.AspNetCore.Components.StreamRenderingAttribute.StreamRenderingAttribute(bool enabled) -> void +Microsoft.AspNetCore.Components.StreamRenderingAttribute.StreamRenderingAttribute(bool enabled = true) -> void Microsoft.AspNetCore.Components.SupplyParameterFromQueryProviderServiceCollectionExtensions Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions override Microsoft.AspNetCore.Components.EventCallback.GetHashCode() -> int @@ -88,9 +88,9 @@ override Microsoft.AspNetCore.Components.EventCallback.Equals(object? obj) -> bo override Microsoft.AspNetCore.Components.EventCallback.GetHashCode() -> int override Microsoft.AspNetCore.Components.EventCallback.Equals(object? obj) -> bool static Microsoft.AspNetCore.Components.SupplyParameterFromQueryProviderServiceCollectionExtensions.AddSupplyValueFromQueryProvider(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! -static Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions.AddCascadingValue(this Microsoft.Extensions.DependencyInjection.IServiceCollection! serviceCollection, string! name, System.Func! valueFactory) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! +static Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions.AddCascadingValue(this Microsoft.Extensions.DependencyInjection.IServiceCollection! serviceCollection, string! name, System.Func! initialValueFactory) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! static Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions.AddCascadingValue(this Microsoft.Extensions.DependencyInjection.IServiceCollection! serviceCollection, System.Func!>! sourceFactory) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! -static Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions.AddCascadingValue(this Microsoft.Extensions.DependencyInjection.IServiceCollection! serviceCollection, System.Func! valueFactory) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! +static Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions.AddCascadingValue(this Microsoft.Extensions.DependencyInjection.IServiceCollection! serviceCollection, System.Func! initialValueFactory) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! static Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions.TryAddCascadingValue(this Microsoft.Extensions.DependencyInjection.IServiceCollection! serviceCollection, string! name, System.Func! valueFactory) -> void static Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions.TryAddCascadingValue(this Microsoft.Extensions.DependencyInjection.IServiceCollection! serviceCollection, System.Func!>! sourceFactory) -> void static Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions.TryAddCascadingValue(this Microsoft.Extensions.DependencyInjection.IServiceCollection! serviceCollection, System.Func! valueFactory) -> void diff --git a/src/Components/Components/src/RenderModeAttribute.cs b/src/Components/Components/src/RenderModeAttribute.cs index d9d7ff286270..87fb58c0e9de 100644 --- a/src/Components/Components/src/RenderModeAttribute.cs +++ b/src/Components/Components/src/RenderModeAttribute.cs @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Components; /// be implemented to work across all render modes. Component authors should only specify /// a fixed rendering mode when the component is incapable of running in other modes. /// -[AttributeUsage(AttributeTargets.Class)] +[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public abstract class RenderModeAttribute : Attribute { /// diff --git a/src/Components/Components/src/RenderTree/RenderTreeFrameArrayBuilder.cs b/src/Components/Components/src/RenderTree/RenderTreeFrameArrayBuilder.cs index 3b946154a254..56cc77e9d966 100644 --- a/src/Components/Components/src/RenderTree/RenderTreeFrameArrayBuilder.cs +++ b/src/Components/Components/src/RenderTree/RenderTreeFrameArrayBuilder.cs @@ -135,7 +135,7 @@ public void AppendRegion(int sequence) }; } - public void AppendComponentRenderMode(int sequence, IComponentRenderMode renderMode) + public void AppendComponentRenderMode(IComponentRenderMode renderMode) { if (_itemsInUse == _items.Length) { @@ -144,13 +144,13 @@ public void AppendComponentRenderMode(int sequence, IComponentRenderMode renderM _items[_itemsInUse++] = new RenderTreeFrame { - SequenceField = sequence, + SequenceField = 0, // We're only interested in one of these, so it's not useful to optimize diffing over multiple FrameTypeField = RenderTreeFrameType.ComponentRenderMode, ComponentRenderModeField = renderMode, }; } - public void AppendNamedEvent(int sequence, string eventType, string assignedName) + public void AppendNamedEvent(string eventType, string assignedName) { if (_itemsInUse == _items.Length) { @@ -159,7 +159,7 @@ public void AppendNamedEvent(int sequence, string eventType, string assignedName _items[_itemsInUse++] = new RenderTreeFrame { - SequenceField = sequence, + SequenceField = 0, // We're only interested in one of these per eventType, so it's not useful to optimize diffing over multiple FrameTypeField = RenderTreeFrameType.NamedEvent, NamedEventTypeField = eventType, NamedEventAssignedNameField = assignedName, diff --git a/src/Components/Components/src/Rendering/RenderTreeBuilder.cs b/src/Components/Components/src/Rendering/RenderTreeBuilder.cs index 78f9cd39d57c..5d2cabc1ce4e 100644 --- a/src/Components/Components/src/Rendering/RenderTreeBuilder.cs +++ b/src/Components/Components/src/Rendering/RenderTreeBuilder.cs @@ -28,7 +28,7 @@ public sealed class RenderTreeBuilder : IDisposable private bool _hasSeenAddMultipleAttributes; private Dictionary? _seenAttributeNames; private IComponentRenderMode? _pendingComponentCallSiteRenderMode; // TODO: Remove when Razor compiler supports call-site @rendermode - private (int Sequence, string AssignedName)? _pendingNamedSubmitEvent; // TODO: Remove when Razor compiler supports @formname + private string? _pendingNamedSubmitEvent; // TODO: Remove when Razor compiler supports @formname /// /// The reserved parameter name used for supplying child content. @@ -83,9 +83,9 @@ public void CloseElement() // TODO: Remove this once Razor supports @formname private void CompletePendingNamedSubmitEvent() { - if (_pendingNamedSubmitEvent is { } pendingNamedSubmitEvent) + if (_pendingNamedSubmitEvent is not null) { - AddNamedEvent(pendingNamedSubmitEvent.Sequence, "onsubmit", pendingNamedSubmitEvent.AssignedName); + AddNamedEvent("onsubmit", _pendingNamedSubmitEvent); _pendingNamedSubmitEvent = default; } } @@ -241,7 +241,7 @@ public void AddAttribute(int sequence, string name, string? value) // That should compile directly as a call to AddNamedEvent. if (string.Equals(name, "@formname", StringComparison.Ordinal) && _lastNonAttributeFrameType == RenderTreeFrameType.Element) { - _pendingNamedSubmitEvent = (sequence, value!); + _pendingNamedSubmitEvent = value!; } else { @@ -623,7 +623,7 @@ public void CloseComponent() { if (_pendingComponentCallSiteRenderMode is not null) { - AddComponentRenderMode(0, _pendingComponentCallSiteRenderMode); + AddComponentRenderMode(_pendingComponentCallSiteRenderMode); _pendingComponentCallSiteRenderMode = null; } @@ -681,9 +681,8 @@ public void AddComponentReferenceCapture(int sequence, Action componentR /// /// Adds a frame indicating the render mode on the enclosing component frame. /// - /// An integer that represents the position of the instruction in the source code. /// The . - public void AddComponentRenderMode(int sequence, IComponentRenderMode renderMode) + public void AddComponentRenderMode(IComponentRenderMode renderMode) { ArgumentNullException.ThrowIfNull(renderMode); @@ -709,17 +708,16 @@ public void AddComponentRenderMode(int sequence, IComponentRenderMode renderMode parentFrame.ComponentFrameFlagsField |= ComponentFrameFlags.HasCallerSpecifiedRenderMode; - _entries.AppendComponentRenderMode(sequence, renderMode); + _entries.AppendComponentRenderMode(renderMode); _lastNonAttributeFrameType = RenderTreeFrameType.ComponentRenderMode; } /// /// Assigns a name to an event in the enclosing element. /// - /// An integer that represents the position of the instruction in the source code. /// The event type, e.g., 'onsubmit'. /// The application-assigned name. - public void AddNamedEvent(int sequence, string eventType, string assignedName) + public void AddNamedEvent(string eventType, string assignedName) { ArgumentNullException.ThrowIfNull(eventType); ArgumentException.ThrowIfNullOrEmpty(assignedName); @@ -733,7 +731,7 @@ public void AddNamedEvent(int sequence, string eventType, string assignedName) throw new InvalidOperationException($"Named events may only be added as children of frames of type {RenderTreeFrameType.Element}"); } - _entries.AppendNamedEvent(sequence, eventType, assignedName); + _entries.AppendNamedEvent(eventType, assignedName); _lastNonAttributeFrameType = RenderTreeFrameType.NamedEvent; } diff --git a/src/Components/Components/src/StreamRenderingAttribute.cs b/src/Components/Components/src/StreamRenderingAttribute.cs index 6abe38053954..3b96783de037 100644 --- a/src/Components/Components/src/StreamRenderingAttribute.cs +++ b/src/Components/Components/src/StreamRenderingAttribute.cs @@ -18,8 +18,8 @@ public class StreamRenderingAttribute : Attribute /// /// Constructs an instance of /// - /// A flag to indicate whether this component and its descendants should stream their rendering. - public StreamRenderingAttribute(bool enabled) + /// A flag to indicate whether this component and its descendants should stream their rendering. The default value is true. + public StreamRenderingAttribute(bool enabled = true) { Enabled = enabled; } diff --git a/src/Components/Components/test/ComponentFactoryTest.cs b/src/Components/Components/test/ComponentFactoryTest.cs index 7eca91d4471a..fd18139905bf 100644 --- a/src/Components/Components/test/ComponentFactoryTest.cs +++ b/src/Components/Components/test/ComponentFactoryTest.cs @@ -151,6 +151,29 @@ public void InstantiateComponent_WithRenderModeOnComponent_UsesRenderModeResolve Assert.IsType(renderer.SuppliedRenderMode); } + [Fact] + public void InstantiateComponent_WithDerivedRenderModeOnDerivedComponent_CausesAmbiguousMatchException() + { + // We could allow derived components to override the rendermode, but: + // [1] It's unclear how that would be legitimate. If the base specifies a rendermode, it's saying + // it only works in that mode. It wouldn't be safe for a derived type to change that. + // [2] If we did want to implement this, we'd need to implement our own inheritance chain walking + // to make sure we find the rendermode from the *closest* ancestor type. GetCustomAttributes + // on its own isn't documented to return the results in any specific order. + // Since issue [1] makes it unclear we'd want to support this, for now we don't. + + // Arrange + var resolvedComponent = new ComponentWithInjectProperties(); + var componentType = typeof(DerivedComponentWithRenderMode); + var renderer = new RendererWithResolveComponentForRenderMode(resolvedComponent); + var componentActivator = new DefaultComponentActivator(); + var factory = new ComponentFactory(componentActivator, renderer); + + // Act/Assert + Assert.Throws( + () => factory.InstantiateComponent(GetServiceProvider(), componentType, null, 1234)); + } + [Fact] public void InstantiateComponent_WithRenderModeOnCallSite_UsesRenderModeResolver() { @@ -290,6 +313,16 @@ public IComponent CreateInstance(Type componentType) } private class TestRenderMode : IComponentRenderMode { } + private class DerivedComponentRenderMode : IComponentRenderMode { } + + [DerivedComponentRenderMode] + private class DerivedComponentWithRenderMode : ComponentWithRenderMode + { + class DerivedComponentRenderModeAttribute : RenderModeAttribute + { + public override IComponentRenderMode Mode => new DerivedComponentRenderMode(); + } + } [OwnRenderMode] private class ComponentWithRenderMode : IComponent diff --git a/src/Components/Components/test/RenderTreeDiffBuilderTest.cs b/src/Components/Components/test/RenderTreeDiffBuilderTest.cs index 4cce00158c87..f1d0766f1841 100644 --- a/src/Components/Components/test/RenderTreeDiffBuilderTest.cs +++ b/src/Components/Components/test/RenderTreeDiffBuilderTest.cs @@ -2220,10 +2220,10 @@ public void RecognizesNamedEventBeingAdded() newTree.OpenElement(0, "existing"); newTree.AddAttribute(1, "attr1", "unrelated val1"); - newTree.AddNamedEvent(2, "someevent1", "added to existing element"); + newTree.AddNamedEvent("someevent1", "added to existing element"); newTree.CloseElement(); - newTree.OpenElement(3, "new element"); - newTree.AddNamedEvent(4, "someevent2", "added with new element"); + newTree.OpenElement(2, "new element"); + newTree.AddNamedEvent("someevent2", "added with new element"); newTree.CloseElement(); // Act @@ -2247,10 +2247,10 @@ public void RecognizesNamedEventBeingRemoved() { oldTree.OpenElement(0, "retaining"); oldTree.AddAttribute(1, "attr1", "unrelated val1"); - oldTree.AddNamedEvent(2, "someevent1", "removing from retained element"); + oldTree.AddNamedEvent("someevent1", "removing from retained element"); oldTree.CloseElement(); - oldTree.OpenElement(3, "removing"); - oldTree.AddNamedEvent(4, "someevent2", "removed because element was removed"); + oldTree.OpenElement(2, "removing"); + oldTree.AddNamedEvent("someevent2", "removed because element was removed"); oldTree.CloseElement(); newTree.OpenElement(0, "retaining"); @@ -2272,12 +2272,12 @@ public void RecognizesNamedEventBeingRemoved() public void RecognizesNamedEventBeingMoved() { oldTree.OpenElement(0, "elem"); - oldTree.AddNamedEvent(2, "eventname", "assigned name"); + oldTree.AddNamedEvent("eventname", "assigned name"); oldTree.CloseElement(); newTree.OpenElement(0, "elem"); newTree.AddAttribute(1, "attr1", "unrelated val1"); - newTree.AddNamedEvent(2, "eventname", "assigned name"); + newTree.AddNamedEvent("eventname", "assigned name"); newTree.CloseElement(); // Act @@ -2300,13 +2300,13 @@ public void RecognizesNamedEventBeingMoved() public void RecognizesNamedEventChangingAssignedName() { oldTree.OpenElement(0, "elem"); - oldTree.AddNamedEvent(1, "eventname1", "original name"); - oldTree.AddNamedEvent(2, "eventname2", "will be left unchanged"); + oldTree.AddNamedEvent("eventname1", "original name"); + oldTree.AddNamedEvent("eventname2", "will be left unchanged"); oldTree.CloseElement(); newTree.OpenElement(0, "elem"); - newTree.AddNamedEvent(1, "eventname1", "changed name"); - newTree.AddNamedEvent(2, "eventname2", "will be left unchanged"); + newTree.AddNamedEvent("eventname1", "changed name"); + newTree.AddNamedEvent("eventname2", "will be left unchanged"); newTree.CloseElement(); // Act diff --git a/src/Components/Components/test/RendererTest.cs b/src/Components/Components/test/RendererTest.cs index 1b7a91792bad..ea383da376ee 100644 --- a/src/Components/Components/test/RendererTest.cs +++ b/src/Components/Components/test/RendererTest.cs @@ -5002,7 +5002,7 @@ public void ThrowsForUnknownRenderMode_AtCallSite() var component = new TestComponent(builder => { builder.OpenComponent(0); - builder.AddComponentRenderMode(1, new ComponentWithUnknownRenderMode.UnknownRenderMode()); + builder.AddComponentRenderMode(new ComponentWithUnknownRenderMode.UnknownRenderMode()); builder.CloseComponent(); }); @@ -5046,7 +5046,7 @@ public void RenderModeResolverCanSupplyComponent_CallSiteRenderMode() { builder.OpenComponent(0); builder.AddComponentParameter(1, nameof(MessageComponent.Message), "Some message"); - builder.AddComponentRenderMode(2, new SubstituteComponentRenderMode()); + builder.AddComponentRenderMode(new SubstituteComponentRenderMode()); builder.CloseComponent(); }); diff --git a/src/Components/Components/test/Rendering/RenderTreeBuilderTest.cs b/src/Components/Components/test/Rendering/RenderTreeBuilderTest.cs index 07f6e5e4554b..8ef9bbea6dac 100644 --- a/src/Components/Components/test/Rendering/RenderTreeBuilderTest.cs +++ b/src/Components/Components/test/Rendering/RenderTreeBuilderTest.cs @@ -2110,7 +2110,7 @@ public void CanAddComponentRenderMode() // Act builder.OpenComponent(0); builder.AddComponentParameter(1, "param", 123); - builder.AddComponentRenderMode(2, renderMode); + builder.AddComponentRenderMode(renderMode); builder.CloseComponent(); // Assert @@ -2122,7 +2122,7 @@ public void CanAddComponentRenderMode() Assert.True(frame.ComponentFrameFlags.HasFlag(ComponentFrameFlags.HasCallerSpecifiedRenderMode)); }, frame => AssertFrame.Attribute(frame, "param", 123, 1), - frame => AssertFrame.ComponentRenderMode(frame, renderMode, 2)); + frame => AssertFrame.ComponentRenderMode(frame, renderMode)); } [Fact] @@ -2135,7 +2135,7 @@ public void CannotAddComponentRenderModeToElement() // Act/Assert var ex = Assert.Throws(() => { - builder.AddComponentRenderMode(1, new TestRenderMode()); + builder.AddComponentRenderMode(new TestRenderMode()); }); Assert.Equal($"The enclosing frame is not of the required type '{nameof(RenderTreeFrameType.Component)}'.", ex.Message); } @@ -2150,7 +2150,7 @@ public void CannotAddNullComponentRenderMode() // Act/Assert var ex = Assert.Throws(() => { - builder.AddComponentRenderMode(1, null); + builder.AddComponentRenderMode(null); }); Assert.Equal("renderMode", ex.ParamName); } @@ -2161,7 +2161,7 @@ public void CannotAddParametersAfterComponentRenderMode() // Arrange var builder = new RenderTreeBuilder(); builder.OpenComponent(0); - builder.AddComponentRenderMode(1, new TestRenderMode()); + builder.AddComponentRenderMode(new TestRenderMode()); // Act/Assert var ex = Assert.Throws(() => @@ -2201,7 +2201,7 @@ public void TemporaryApiForCallSiteComponentRenderModeWorksEvenIfOtherParameterA }, frame => AssertFrame.Attribute(frame, "param", 123, 1), frame => AssertFrame.Attribute(frame, "anotherparam", 456, 3), - frame => AssertFrame.ComponentRenderMode(frame, renderMode, 0)); + frame => AssertFrame.ComponentRenderMode(frame, renderMode)); } [Fact] @@ -2214,7 +2214,7 @@ public void CanAddNamedEvent() // Act builder.OpenElement(0, "elem"); builder.AddAttribute(1, "attr", 123); - builder.AddNamedEvent(2, "myeventtype", "my event name"); + builder.AddNamedEvent("myeventtype", "my event name"); builder.CloseElement(); // Assert @@ -2235,7 +2235,7 @@ public void CannotAddNamedEventToComponent() // Act/Assert var ex = Assert.Throws(() => { - builder.AddNamedEvent(1, "x", "y"); + builder.AddNamedEvent("x", "y"); }); Assert.Equal($"Named events may only be added as children of frames of type {RenderTreeFrameType.Element}", ex.Message); } @@ -2250,7 +2250,7 @@ public void CannotAddNamedEventWithNullEventType() // Act/Assert var ex = Assert.Throws(() => { - builder.AddNamedEvent(1, null, "assigned name"); + builder.AddNamedEvent(null, "assigned name"); }); Assert.Equal("eventType", ex.ParamName); } @@ -2265,7 +2265,7 @@ public void CannotAddNamedEventWithNullAssignedName() // Act/Assert var ex = Assert.Throws(() => { - builder.AddNamedEvent(1, "eventtype", null); + builder.AddNamedEvent("eventtype", null); }); Assert.Equal("assignedName", ex.ParamName); } @@ -2280,7 +2280,7 @@ public void CannotAddNamedEventWithEmptyAssignedName() // Act/Assert var ex = Assert.Throws(() => { - builder.AddNamedEvent(1, "eventtype", ""); + builder.AddNamedEvent("eventtype", ""); }); Assert.Equal("assignedName", ex.ParamName); } @@ -2291,7 +2291,7 @@ public void CannotAddAttributesAfterNamedEvent() // Arrange var builder = new RenderTreeBuilder(); builder.OpenElement(0, "elem"); - builder.AddNamedEvent(1, "someevent", "somename"); + builder.AddNamedEvent("someevent", "somename"); // Act/Assert var ex = Assert.Throws(() => @@ -2325,7 +2325,7 @@ public void TemporaryApiForFormNameEventsWorksEvenIfAttributesAddedAfter() frame => AssertFrame.Element(frame, "div", 5, 0), frame => AssertFrame.Attribute(frame, "attr1", "123", 1), frame => AssertFrame.Attribute(frame, "attr2", "456", 3), - frame => AssertFrame.NamedEvent(frame, "onsubmit", "some custom name", 2), + frame => AssertFrame.NamedEvent(frame, "onsubmit", "some custom name"), frame => AssertFrame.Element(frame, "other", 1)); } diff --git a/src/Components/Endpoints/src/DependencyInjection/RazorComponentsServiceCollectionExtensions.cs b/src/Components/Endpoints/src/DependencyInjection/RazorComponentsServiceCollectionExtensions.cs index 9fa6c8c27890..806c5f43f079 100644 --- a/src/Components/Endpoints/src/DependencyInjection/RazorComponentsServiceCollectionExtensions.cs +++ b/src/Components/Endpoints/src/DependencyInjection/RazorComponentsServiceCollectionExtensions.cs @@ -39,9 +39,6 @@ public static IRazorComponentsBuilder AddRazorComponents(this IServiceCollection services.TryAddSingleton(); - // Results - services.TryAddSingleton(); - // Endpoints services.TryAddSingleton(); services.TryAddSingleton(); diff --git a/src/Components/Endpoints/src/PublicAPI.Unshipped.txt b/src/Components/Endpoints/src/PublicAPI.Unshipped.txt index a4f923605d68..a3ca0d2f9115 100644 --- a/src/Components/Endpoints/src/PublicAPI.Unshipped.txt +++ b/src/Components/Endpoints/src/PublicAPI.Unshipped.txt @@ -18,25 +18,6 @@ Microsoft.AspNetCore.Components.Endpoints.Infrastructure.RenderModeEndpointProvi Microsoft.AspNetCore.Components.Endpoints.Infrastructure.RenderModeEndpointProvider.RenderModeEndpointProvider() -> void Microsoft.AspNetCore.Components.Endpoints.IRazorComponentEndpointInvoker Microsoft.AspNetCore.Components.Endpoints.IRazorComponentEndpointInvoker.Render(Microsoft.AspNetCore.Http.HttpContext! context) -> System.Threading.Tasks.Task! -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.ComponentType.get -> System.Type! -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.ContentType.get -> string? -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.ContentType.set -> void -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.ExecuteAsync(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> System.Threading.Tasks.Task! -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.Parameters.get -> System.Collections.Generic.IReadOnlyDictionary! -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.PreventStreamingRendering.get -> bool -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.PreventStreamingRendering.set -> void -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.RazorComponentResult(System.Type! componentType) -> void -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.RazorComponentResult(System.Type! componentType, object? parameters) -> void -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.RazorComponentResult(System.Type! componentType, System.Collections.Generic.IReadOnlyDictionary? parameters) -> void -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.StatusCode.get -> int? -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.StatusCode.set -> void -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.RazorComponentResult() -> void -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.RazorComponentResult(object! parameters) -> void -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult.RazorComponentResult(System.Collections.Generic.IReadOnlyDictionary! parameters) -> void -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResultExecutor -Microsoft.AspNetCore.Components.Endpoints.RazorComponentResultExecutor.RazorComponentResultExecutor() -> void Microsoft.AspNetCore.Components.Endpoints.RazorComponentsOptions Microsoft.AspNetCore.Components.Endpoints.RazorComponentsOptions.MaxFormMappingCollectionSize.get -> int Microsoft.AspNetCore.Components.Endpoints.RazorComponentsOptions.MaxFormMappingCollectionSize.set -> void @@ -54,11 +35,26 @@ Microsoft.AspNetCore.Components.PersistedStateSerializationMode Microsoft.AspNetCore.Components.PersistedStateSerializationMode.Infer = 1 -> Microsoft.AspNetCore.Components.PersistedStateSerializationMode Microsoft.AspNetCore.Components.PersistedStateSerializationMode.Server = 2 -> Microsoft.AspNetCore.Components.PersistedStateSerializationMode Microsoft.AspNetCore.Components.PersistedStateSerializationMode.WebAssembly = 3 -> Microsoft.AspNetCore.Components.PersistedStateSerializationMode +Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult +Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.ComponentType.get -> System.Type! +Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.ContentType.get -> string? +Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.ContentType.set -> void +Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.ExecuteAsync(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.Parameters.get -> System.Collections.Generic.IReadOnlyDictionary! +Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.PreventStreamingRendering.get -> bool +Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.PreventStreamingRendering.set -> void +Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.RazorComponentResult(System.Type! componentType) -> void +Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.RazorComponentResult(System.Type! componentType, object! parameters) -> void +Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.RazorComponentResult(System.Type! componentType, System.Collections.Generic.IReadOnlyDictionary! parameters) -> void +Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.StatusCode.get -> int? +Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.StatusCode.set -> void +Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult +Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.RazorComponentResult() -> void +Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.RazorComponentResult(object! parameters) -> void +Microsoft.AspNetCore.Http.HttpResults.RazorComponentResult.RazorComponentResult(System.Collections.Generic.IReadOnlyDictionary! parameters) -> void Microsoft.Extensions.DependencyInjection.IRazorComponentsBuilder Microsoft.Extensions.DependencyInjection.IRazorComponentsBuilder.Services.get -> Microsoft.Extensions.DependencyInjection.IServiceCollection! Microsoft.Extensions.DependencyInjection.RazorComponentsServiceCollectionExtensions static Microsoft.AspNetCore.Builder.RazorComponentsEndpointConventionBuilderExtensions.AddAdditionalAssemblies(this Microsoft.AspNetCore.Builder.RazorComponentsEndpointConventionBuilder! builder, params System.Reflection.Assembly![]! assemblies) -> Microsoft.AspNetCore.Builder.RazorComponentsEndpointConventionBuilder! static Microsoft.AspNetCore.Builder.RazorComponentsEndpointRouteBuilderExtensions.MapRazorComponents(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder! endpoints) -> Microsoft.AspNetCore.Builder.RazorComponentsEndpointConventionBuilder! static Microsoft.Extensions.DependencyInjection.RazorComponentsServiceCollectionExtensions.AddRazorComponents(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services, System.Action? configure = null) -> Microsoft.Extensions.DependencyInjection.IRazorComponentsBuilder! -static readonly Microsoft.AspNetCore.Components.Endpoints.RazorComponentResultExecutor.DefaultContentType -> string! -virtual Microsoft.AspNetCore.Components.Endpoints.RazorComponentResultExecutor.ExecuteAsync(Microsoft.AspNetCore.Http.HttpContext! httpContext, Microsoft.AspNetCore.Components.Endpoints.RazorComponentResult! result) -> System.Threading.Tasks.Task! diff --git a/src/Components/Endpoints/src/Results/RazorComponentResult.cs b/src/Components/Endpoints/src/Results/RazorComponentResult.cs index 3049313f9a21..0f4e385ac288 100644 --- a/src/Components/Endpoints/src/Results/RazorComponentResult.cs +++ b/src/Components/Endpoints/src/Results/RazorComponentResult.cs @@ -1,18 +1,19 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Collections.ObjectModel; using System.Diagnostics.CodeAnalysis; -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Endpoints; using Microsoft.Extensions.Internal; using static Microsoft.AspNetCore.Internal.LinkerFlags; -namespace Microsoft.AspNetCore.Components.Endpoints; +namespace Microsoft.AspNetCore.Http.HttpResults; /// /// An that renders a Razor Component. /// -public class RazorComponentResult : IResult +public class RazorComponentResult : IResult, IStatusCodeHttpResult, IContentTypeHttpResult { private static readonly IReadOnlyDictionary EmptyParameters = new Dictionary().AsReadOnly(); @@ -22,7 +23,7 @@ public class RazorComponentResult : IResult /// /// The type of the component to render. This must implement . public RazorComponentResult([DynamicallyAccessedMembers(Component)] Type componentType) - : this(componentType, null) + : this(componentType, ReadOnlyDictionary.Empty) { } @@ -31,7 +32,9 @@ public RazorComponentResult([DynamicallyAccessedMembers(Component)] Type compone /// /// The type of the component to render. This must implement . /// Parameters for the component. - public RazorComponentResult([DynamicallyAccessedMembers(Component)] Type componentType, object? parameters) + public RazorComponentResult( + [DynamicallyAccessedMembers(Component)] Type componentType, + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] object parameters) : this(componentType, CoerceParametersObjectToDictionary(parameters)) { } @@ -41,25 +44,27 @@ public RazorComponentResult([DynamicallyAccessedMembers(Component)] Type compone /// /// The type of the component to render. This must implement . /// Parameters for the component. - public RazorComponentResult([DynamicallyAccessedMembers(Component)] Type componentType, IReadOnlyDictionary? parameters) + public RazorComponentResult( + [DynamicallyAccessedMembers(Component)] Type componentType, + IReadOnlyDictionary parameters) { + ArgumentNullException.ThrowIfNull(componentType); + ArgumentNullException.ThrowIfNull(parameters); + // Note that the Blazor renderer will validate that componentType implements IComponent and throws a suitable // exception if not, so we don't need to duplicate that logic here. - - ArgumentNullException.ThrowIfNull(componentType); ComponentType = componentType; Parameters = parameters ?? EmptyParameters; } - private static IReadOnlyDictionary? CoerceParametersObjectToDictionary(object? parameters) + private static IReadOnlyDictionary CoerceParametersObjectToDictionary(object? parameters) => parameters is null - ? null + ? throw new ArgumentNullException(nameof(parameters)) : (IReadOnlyDictionary)PropertyHelper.ObjectToDictionary(parameters); /// /// Gets the component type. /// - [DynamicallyAccessedMembers(Component)] public Type ComponentType { get; } /// @@ -87,15 +92,10 @@ public RazorComponentResult([DynamicallyAccessedMembers(Component)] Type compone public bool PreventStreamingRendering { get; set; } /// - /// Requests the service of - /// - /// to process itself in the given . + /// Processes this result in the given . /// /// An associated with the current request. /// A which will complete when execution is completed. public Task ExecuteAsync(HttpContext httpContext) - { - var executor = httpContext.RequestServices.GetRequiredService(); - return executor.ExecuteAsync(httpContext, this); - } + => RazorComponentResultExecutor.ExecuteAsync(httpContext, this); } diff --git a/src/Components/Endpoints/src/Results/RazorComponentResultExecutor.cs b/src/Components/Endpoints/src/Results/RazorComponentResultExecutor.cs index af14fa146f70..5467336e932d 100644 --- a/src/Components/Endpoints/src/Results/RazorComponentResultExecutor.cs +++ b/src/Components/Endpoints/src/Results/RazorComponentResultExecutor.cs @@ -9,23 +9,15 @@ using Microsoft.AspNetCore.WebUtilities; using Microsoft.Extensions.DependencyInjection; using static Microsoft.AspNetCore.Internal.LinkerFlags; +using Microsoft.AspNetCore.Http.HttpResults; namespace Microsoft.AspNetCore.Components.Endpoints; -/// -/// Executes a . -/// -public class RazorComponentResultExecutor +internal static class RazorComponentResultExecutor { - /// - /// The default content-type header value for Razor Components, text/html; charset=utf-8. - /// - public static readonly string DefaultContentType = "text/html; charset=utf-8"; + public const string DefaultContentType = "text/html; charset=utf-8"; - /// - /// Executes a asynchronously. - /// - public virtual Task ExecuteAsync(HttpContext httpContext, RazorComponentResult result) + public static Task ExecuteAsync(HttpContext httpContext, RazorComponentResult result) { ArgumentNullException.ThrowIfNull(httpContext); @@ -44,7 +36,7 @@ public virtual Task ExecuteAsync(HttpContext httpContext, RazorComponentResult r result.PreventStreamingRendering); } - internal static Task RenderComponentToResponse( + private static Task RenderComponentToResponse( HttpContext httpContext, [DynamicallyAccessedMembers(Component)] Type componentType, IReadOnlyDictionary? componentParameters, diff --git a/src/Components/Endpoints/src/Results/RazorComponentResultOfT.cs b/src/Components/Endpoints/src/Results/RazorComponentResultOfT.cs index 3019550b9100..5ab0f23481f0 100644 --- a/src/Components/Endpoints/src/Results/RazorComponentResultOfT.cs +++ b/src/Components/Endpoints/src/Results/RazorComponentResultOfT.cs @@ -2,15 +2,16 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; -using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Components; using static Microsoft.AspNetCore.Internal.LinkerFlags; -namespace Microsoft.AspNetCore.Components.Endpoints; +namespace Microsoft.AspNetCore.Http.HttpResults; /// /// An that renders a Razor Component. /// -public class RazorComponentResult<[DynamicallyAccessedMembers(Component)] TComponent> : RazorComponentResult where TComponent: IComponent +public class RazorComponentResult<[DynamicallyAccessedMembers(Component)] TComponent> + : RazorComponentResult where TComponent: IComponent { /// /// Constructs an instance of . @@ -23,7 +24,8 @@ public RazorComponentResult() : base(typeof(TComponent)) /// Constructs an instance of . /// /// Parameters for the component. - public RazorComponentResult(object parameters) : base(typeof(TComponent), parameters) + public RazorComponentResult( + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] object parameters) : base(typeof(TComponent), parameters) { } diff --git a/src/Components/Endpoints/test/EndpointHtmlRendererTest.cs b/src/Components/Endpoints/test/EndpointHtmlRendererTest.cs index 7b3cda4f7ac4..a2c730f1f21c 100644 --- a/src/Components/Endpoints/test/EndpointHtmlRendererTest.cs +++ b/src/Components/Endpoints/test/EndpointHtmlRendererTest.cs @@ -980,7 +980,7 @@ public async Task Dispatching_WhenComponentReRendersNamedEventAtSameLocation() builder.SetKey(firstRender); builder.AddAttribute(1, "onsubmit", () => { eventReceivedCount++; component.TriggerRender(); }); - builder.AddNamedEvent(2, "onsubmit", "my-name"); + builder.AddNamedEvent("onsubmit", "my-name"); builder.CloseElement(); firstRender = false; @@ -1014,7 +1014,7 @@ public async Task Dispatching_WhenNamedEventChangesName() { builder.OpenElement(0, "form"); builder.AddAttribute(1, "onsubmit", () => { eventReceivedCount++; }); - builder.AddNamedEvent(2, "onsubmit", firstRender ? "my-name-1" : "my-name-2"); + builder.AddNamedEvent("onsubmit", firstRender ? "my-name-1" : "my-name-2"); builder.CloseElement(); firstRender = false; }); @@ -1186,7 +1186,7 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) { builder.OpenElement(0, "form"); builder.AddAttribute(1, "onsubmit", Handler ?? (() => { })); - builder.AddNamedEvent(2, "onsubmit", "default"); + builder.AddNamedEvent("onsubmit", "default"); builder.CloseElement(); } } @@ -1201,12 +1201,12 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) if (!hasRendered) { builder.AddAttribute(1, "onsubmit", () => { }); - builder.AddNamedEvent(2, "onsubmit", "default"); + builder.AddNamedEvent("onsubmit", "default"); } else { builder.AddAttribute(1, "onsubmit", () => { GC.KeepAlive(new object()); }); - builder.AddNamedEvent(2, "onsubmit", "default"); + builder.AddNamedEvent("onsubmit", "default"); } builder.CloseElement(); if (!hasRendered) @@ -1231,7 +1231,7 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) builder.AddAttribute(1, "onsubmit", !hasRendered ? () => { Message = "Received call to original handler"; } : () => { Message = "Received call to updated handler"; }); - builder.AddNamedEvent(2, "onsubmit", "default"); + builder.AddNamedEvent("onsubmit", "default"); builder.CloseElement(); } @@ -1248,7 +1248,7 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) { builder.OpenElement(0, "form"); builder.AddAttribute(1, "onsubmit", () => { }); - builder.AddNamedEvent(2, "onsubmit", "default"); + builder.AddNamedEvent("onsubmit", "default"); builder.CloseElement(); } } diff --git a/src/Components/Endpoints/test/RazorComponentResultExecutorTest.cs b/src/Components/Endpoints/test/RazorComponentResultExecutorTest.cs deleted file mode 100644 index 14c0646f9a28..000000000000 --- a/src/Components/Endpoints/test/RazorComponentResultExecutorTest.cs +++ /dev/null @@ -1,454 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Microsoft.AspNetCore.Components.Infrastructure; -using System.Diagnostics; -using Microsoft.AspNetCore.Components.Routing; -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.AspNetCore.DataProtection; -using Microsoft.Extensions.Internal; -using Microsoft.AspNetCore.Http.Features; -using Moq; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Hosting; -using Microsoft.AspNetCore.Components.Endpoints.Tests.TestComponents; -using System.Text.RegularExpressions; -using Microsoft.AspNetCore.Components.Forms; -using Microsoft.AspNetCore.Components.Endpoints.Forms; - -namespace Microsoft.AspNetCore.Components.Endpoints; - -public class RazorComponentResultExecutorTest -{ - [Fact] - public async Task CanRenderComponentStatically() - { - // Arrange - var httpContext = GetTestHttpContext(); - var responseBody = new MemoryStream(); - httpContext.Response.Body = responseBody; - - // Act - await RazorComponentResultExecutor.RenderComponentToResponse( - httpContext, - typeof(SimpleComponent), - componentParameters: null, - preventStreamingRendering: false); - - // Assert - Assert.Equal("

Hello from SimpleComponent

", GetStringContent(responseBody)); - } - - [Fact] - public async Task PerformsStreamingRendering() - { - // Arrange - var tcs = new TaskCompletionSource(); - var httpContext = GetTestHttpContext(); - var responseBody = new MemoryStream(); - httpContext.Response.Body = responseBody; - - // Act/Assert 1: Emits the initial pre-quiescent output to the response - var completionTask = RazorComponentResultExecutor.RenderComponentToResponse( - httpContext, - typeof(StreamingAsyncLoadingComponent), - PropertyHelper.ObjectToDictionary(new { LoadingTask = tcs.Task }).AsReadOnly(), - preventStreamingRendering: false); - Assert.Equal( - "Loading task status: WaitingForActivation", - MaskComponentIds(GetStringContent(responseBody))); - - // Assert 2: Result task remains incomplete for as long as the component's loading operation remains in flight - // This keeps the HTTP response open - await Task.Yield(); - Assert.False(completionTask.IsCompleted); - - // Act/Assert 3: When loading completes, it emits a streaming batch update and completes the response - tcs.SetResult(); - await completionTask; - Assert.Equal( - "Loading task status: WaitingForActivation", - MaskComponentIds(GetStringContent(responseBody))); - } - - [Fact] - public async Task EmitsEachComponentOnlyOncePerStreamingUpdate_WhenAComponentRendersTwice() - { - // Arrange - var tcs = new TaskCompletionSource(); - var httpContext = GetTestHttpContext(); - var responseBody = new MemoryStream(); - httpContext.Response.Body = responseBody; - - // Act/Assert 1: Emits the initial pre-quiescent output to the response - var completionTask = RazorComponentResultExecutor.RenderComponentToResponse( - httpContext, - typeof(DoubleRenderingStreamingAsyncComponent), - PropertyHelper.ObjectToDictionary(new { WaitFor = tcs.Task }).AsReadOnly(), - preventStreamingRendering: false); - Assert.Equal( - "Loading...", - MaskComponentIds(GetStringContent(responseBody))); - - // Act/Assert 2: When loading completes, it emits a streaming batch update with only one copy of the final output, - // despite the RenderBatch containing two diffs from the component - tcs.SetResult(); - await completionTask; - Assert.Equal( - "Loading...", - MaskComponentIds(GetStringContent(responseBody))); - } - - [Fact] - public async Task EmitsEachComponentOnlyOncePerStreamingUpdate_WhenAnAncestorAlsoUpdated() - { - // Since the HTML rendered for each component also includes all its descendants, we don't - // want to render output for any component that also has an ancestor in the set of updates - // (as it would then be output twice) - - // Arrange - var tcs = new TaskCompletionSource(); - var httpContext = GetTestHttpContext(); - var responseBody = new MemoryStream(); - httpContext.Response.Body = responseBody; - - // Act/Assert 1: Emits the initial pre-quiescent output to the response - var completionTask = RazorComponentResultExecutor.RenderComponentToResponse( - httpContext, - typeof(StreamingComponentWithChild), - PropertyHelper.ObjectToDictionary(new { LoadingTask = tcs.Task }).AsReadOnly(), - preventStreamingRendering: false); - var expectedInitialHtml = "[LoadingTask: WaitingForActivation]\n[Child render: 1]\n"; - Assert.Equal( - expectedInitialHtml, - MaskComponentIds(GetStringContent(responseBody))); - - // Act/Assert 2: When loading completes, it emits a streaming batch update in which the - // child is present only within the parent markup, not as a separate entry - tcs.SetResult(); - await completionTask; - Assert.Equal( - $"{expectedInitialHtml}", - MaskComponentIds(GetStringContent(responseBody))); - } - - [Fact] - public async Task WaitsForQuiescenceIfPreventStreamingRenderingIsTrue() - { - // Arrange - var tcs = new TaskCompletionSource(); - var httpContext = GetTestHttpContext(); - var responseBody = new MemoryStream(); - httpContext.Response.Body = responseBody; - - // Act/Assert: Doesn't complete until loading finishes - var completionTask = RazorComponentResultExecutor.RenderComponentToResponse( - httpContext, - typeof(StreamingAsyncLoadingComponent), - PropertyHelper.ObjectToDictionary(new { LoadingTask = tcs.Task }).AsReadOnly(), - preventStreamingRendering: true); - await Task.Yield(); - Assert.False(completionTask.IsCompleted); - - // Act/Assert: Does complete when loading finishes - tcs.SetResult(); - await completionTask; - Assert.Equal( - "Loading task status: RanToCompletion", - MaskComponentIds(GetStringContent(responseBody))); - } - - [Fact] - public async Task SupportsLayouts() - { - // Arrange - var httpContext = GetTestHttpContext(); - var responseBody = new MemoryStream(); - httpContext.Response.Body = responseBody; - - // Act - await RazorComponentResultExecutor.RenderComponentToResponse( - httpContext, typeof(ComponentWithLayout), - null, false); - - // Assert - Assert.Equal($"[TestParentLayout with content: [TestLayout with content: Page\n]\n]\n", GetStringContent(responseBody)); - } - - [Fact] - public async Task OnNavigationBeforeResponseStarted_Redirects() - { - // Arrange - var httpContext = GetTestHttpContext(); - - // Act - await RazorComponentResultExecutor.RenderComponentToResponse( - httpContext, typeof(ComponentThatRedirectsSynchronously), - null, false); - - // Assert - Assert.Equal("https://test/somewhere/else", httpContext.Response.Headers.Location); - } - - [Fact] - public async Task OnNavigationAfterResponseStarted_WithStreamingOff_Throws() - { - // Arrange - var httpContext = GetTestHttpContext(); - var responseMock = new Mock(); - responseMock.Setup(r => r.HasStarted).Returns(true); - httpContext.Features.Set(responseMock.Object); - - // Act - var ex = await Assert.ThrowsAsync( - () => RazorComponentResultExecutor.RenderComponentToResponse( - httpContext, typeof(StreamingComponentThatRedirectsAsynchronously), - null, preventStreamingRendering: true)); - - // Assert - Assert.Contains("A navigation command was attempted during prerendering after the server already started sending the response", ex.Message); - } - - [Fact] - public async Task OnNavigationAfterResponseStarted_WithStreamingOn_EmitsCommand() - { - // Arrange - var httpContext = GetTestHttpContext(); - var responseBody = new MemoryStream(); - httpContext.Response.Body = responseBody; - - // Act - await RazorComponentResultExecutor.RenderComponentToResponse( - httpContext, typeof(StreamingComponentThatRedirectsAsynchronously), - null, preventStreamingRendering: false); - - // Assert - Assert.Equal( - $"Some output\n", - MaskComponentIds(GetStringContent(responseBody))); - } - - [Fact] - public async Task OnUnhandledExceptionBeforeResponseStarted_Throws() - { - // Arrange - var httpContext = GetTestHttpContext(); - - // Act - var ex = await Assert.ThrowsAsync(() => RazorComponentResultExecutor.RenderComponentToResponse( - httpContext, typeof(ComponentThatThrowsSynchronously), - null, false)); - - // Assert - Assert.Contains("Test message", ex.Message); - } - - [Fact] - public async Task OnUnhandledExceptionAfterResponseStarted_WithStreamingOff_Throws() - { - // Arrange - var httpContext = GetTestHttpContext(); - - // Act - var ex = await Assert.ThrowsAsync(() => RazorComponentResultExecutor.RenderComponentToResponse( - httpContext, typeof(StreamingComponentThatThrowsAsynchronously), - null, preventStreamingRendering: true)); - - // Assert - Assert.Contains("Test message", ex.Message); - } - - [Theory] - [InlineData(false)] - [InlineData(true)] - public async Task OnUnhandledExceptionAfterResponseStarted_WithStreamingOn_EmitsCommand(bool isDevelopmentEnvironment) - { - // Arrange - var httpContext = GetTestHttpContext(isDevelopmentEnvironment ? Environments.Development : Environments.Production); - var responseBody = new MemoryStream(); - httpContext.Response.Body = responseBody; - - var expectedResponseExceptionInfo = isDevelopmentEnvironment - ? "System.InvalidTimeZoneException: Test message with <b>markup</b>" - : "There was an unhandled exception on the current request. For more details turn on detailed exceptions by setting 'DetailedErrors: true' in 'appSettings.Development.json'"; - - // Act - var ex = await Assert.ThrowsAsync(() => RazorComponentResultExecutor.RenderComponentToResponse( - httpContext, typeof(StreamingComponentThatThrowsAsynchronously), - null, preventStreamingRendering: false)); - - // Assert - Assert.Contains("Test message with markup", ex.Message); - Assert.Contains( - $"Some output\n