From a5ad244ca27ab6876a848fe11065e4a40dfee466 Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Thu, 21 Sep 2023 16:05:14 -0700 Subject: [PATCH 1/9] [release/8.0-rc2] [Blazor] Make auto components prefer the existing render mode (#50851) # Make auto components prefer the existing render mode Ensures that if interactive components exist on the page and they all use a single render mode, components with the "Auto" render mode will also use that render mode. ## Description It's a common requirement for state to be shared between interactive root components. For example, the `` component, which allows updating content in the HTML ``, renders content specified by a `` component, if it exists. However, this only works if the `` and `` components use the same interactive render mode. The Auto render mode lets Blazor select a "best" render mode (either Server or WebAssembly) at runtime, primarily depending on whether Blazor WebAssembly resources are cached in the browser. However, previously it did this without taking into consideration the render mode used by existing components on the page. For example, suppose a `` with an Auto render mode gets added to the page before WebAssembly resources have been loaded and cached, so it uses Blazor Server. Later, a `` component, also with an Auto render mode, gets added to the page. But at this point, WebAssembly resources have loaded completely, so the `` component uses Blazor WebAssembly. In this example, the content in the `` does not update, because the `` and `` use different render modes. This PR updates the auto render mode decision making logic to the following: * If WebAssembly components exist on the page, use WebAssembly * Otherwise, if Server components exist on the page, use Server * Otherwise, if WebAssembly resources are cached, use WebAssembly * Otherwise, use Server Fixes #50686 ## Customer Impact Medium/high. We've seen multiple reports of the existing behavior causing problems in customer apps, and there isn't a workaround. ## Regression? - [ ] Yes - [X] No This behavior has existed since the Auto render mode was introduced in an earlier .NET 8 preview release. ## Risk - [ ] High - [ ] Medium - [X] Low This PR is a small change to the Auto mode logic. It's unlikely that customers were already relying on the existing behavior. ## Verification - [X] Manual (required) - [X] Automated ## Packaging changes reviewed? - [ ] Yes - [ ] No - [X] N/A --- .../Web.JS/dist/Release/blazor.web.js | 2 +- .../src/Services/WebRootComponentManager.ts | 52 +++++++++---- .../ServerRenderingTests/InteractivityTest.cs | 78 +++++++++++++++++++ 3 files changed, 114 insertions(+), 18 deletions(-) diff --git a/src/Components/Web.JS/dist/Release/blazor.web.js b/src/Components/Web.JS/dist/Release/blazor.web.js index 6cde03e919aa..64330c8ab288 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 v(){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 y(e);return void 0===a?a=t:a&&(a=null),t},e.attachReviver=p,e.invokeMethod=function(e,t,...n){return v().invokeDotNetStaticMethod(e,t,...n)},e.invokeMethodAsync=function(e,t,...n){return v().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 y{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(["cancel","close","toggle"],{createEventArgs:()=>({})});const p=["date","datetime-local","month","time","week"],f=new Map;let g,m,v=0;const y={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const o="__bl-dynamic-root:"+(++v).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=[];let I;const k=new Promise((e=>{I=e}));function T(e,t,n){return R(e,t.eventHandlerId,(()=>D(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function D(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 A=L(["abort","blur","cancel","canplay","canplaythrough","change","close","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pointerenter","pointerleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),x={submit:!0},N=L(["click","dblclick","mousedown","mousemove","mouseup"]);class M{constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++M.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new P(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(A,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(N,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(x,t.type)&&t.preventDefault(),T(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 U:null}}M.nextEventDelegatorId=0;class P{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(A,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 U{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 L(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const B=Symbol(),F=Symbol(),O=Symbol();function $(e){const{start:t,end:n}=e,o=t[O];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=H(r,!0),s=G(i);t[F]=i,t[O]=e;const a=H(t);if(n){const e=G(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[F]=t,e.push(n),r=n}}return a}function H(e,t){if(B in e)return e;const n=[];if(e.childNodes.length>0){if(!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");e.childNodes.forEach((t=>{const o=H(t,!0);o[F]=e,n.push(o)}))}return e[B]=n,e}function j(e){const t=G(e);for(;t.length;)z(e,0)}function W(e,t){const n=document.createComment("!");return q(n,e,t),n}function q(e,t,n){const o=e;let r=e;if(Q(e)){const t=ne(o);if(t!==e){const n=new Range;n.setStartBefore(e),n.setEndAfter(t),r=n.extractContents()}}const i=J(o);if(i){const e=G(i),t=Array.prototype.indexOf.call(e,o);e.splice(t,1),delete o[F]}const s=G(t);if(n0;)z(n,0)}const o=n;o.parentNode.removeChild(o)}function J(e){return e[F]||null}function V(e,t){return G(e)[t]}function K(e){return e[O]||null}function X(e){const t=ee(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function G(e){return e[B]}function Y(e){const t=G(J(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}function Q(e){return B in e}function Z(e,t){const n=G(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=ne(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):te(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 ee(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 te(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=Y(t);n?n.parentNode.insertBefore(e,n):te(e,J(t))}}}function ne(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=Y(e);if(t)return t.previousSibling;{const t=J(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:ne(t)}}function oe(e){return`_bl_${e}`}const re="__internalId";e.attachReviver(((e,t)=>t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,re)&&"string"==typeof t[re]?function(e){const t=`[${oe(e)}]`;return document.querySelector(t)}(t[re]):t));const ie="_blazorDeferredValue";function se(e){e instanceof HTMLOptionElement?he(e):ie in e&&le(e,e[ie])}function ae(e){return"select-multiple"===e.type}function ce(e,t){e.value=t||""}function le(e,t){e instanceof HTMLSelectElement?ae(e)?function(e,t){t||(t=[]);for(let n=0;n{Pe()&&De(e,(e=>{Je(e,!0,!1)}))}))}getRootComponentCount(){return this.rootComponentIds.size}attachRootComponentToLogicalElement(e,t,n){if(ve(t))throw new Error(`Root component '${e}' could not be attached because its target element is already associated with a root component`);me(t,!0),this.attachComponentToElement(e,t),this.rootComponentIds.add(e),n||(pe[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=pe[t];s&&(delete pe[t],j(s),s instanceof Comment&&(s.textContent="!"));const a=null===(r=ee(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];me(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 ze(e,t,n=!1){const o=Ne(e);!t.forceLoad&&Re(o)?Ze()?Je(o,!1,t.replaceHistoryEntry,t.historyEntryState,n):xe(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 Je(e,t,n,o=void 0,r=!1){if(Xe(),function(e){const t=e.indexOf("#");return t>-1&&location.href.replace(location.hash,"")===e.substring(0,t)}(e))!function(e,t,n){Ve(e,t,n);const o=e.indexOf("#");o!==e.length-1&&qe(e.substring(o+1))}(e,n,o);else{if(!r&&Le&&!await Ge(e,o,t))return;_e=!0,Ve(e,n,o),await Ye(t)}}function Ve(e,t,n=void 0){t?history.replaceState({userState:n,_index:Be},"",e):(Be++,history.pushState({userState:n,_index:Be},"",e))}function Ke(e){return new Promise((t=>{const n=He;He=()=>{He=n,t()},history.go(e)}))}function Xe(){je&&(je(!1),je=null)}function Ge(e,t,n){return new Promise((o=>{Xe(),$e?(Fe++,je=o,$e(Fe,e,t,n)):o(!1)}))}async function Ye(e){var t;Oe&&await Oe(location.href,null===(t=history.state)||void 0===t?void 0:t.userState,e)}async function Qe(e){var t,n;He&&Ze()&&await He(e),Be=null!==(n=null===(t=history.state)||void 0===t?void 0:t._index)&&void 0!==n?n:0}function Ze(){return Pe()||!Ae()}const et={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}))}},tt={init:function(e,t,n,o=50){const r=ot(t);(r||document.documentElement).style.overflowAnchor="none";const i=document.createRange();u(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=d(t),c=d(n),{observersByDotNetObjectId:l,id:h}=rt(e);function d(e){const t={attributes:!0},n=new MutationObserver(((n,o)=>{u(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 u(e){return null!==e&&(e instanceof HTMLTableElement&&""===e.style.display||"table"===e.style.display||e instanceof HTMLTableSectionElement&&""===e.style.display||"table-row-group"===e.style.display)}l[h]={intersectionObserver:s,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const{observersByDotNetObjectId:t,id:n}=rt(e),o=t[n];o&&(o.intersectionObserver.disconnect(),o.mutationObserverBefore.disconnect(),o.mutationObserverAfter.disconnect(),e.dispose(),delete t[n])}},nt=Symbol();function ot(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:ot(e.parentElement):null}function rt(e){var t;const n=e._callDispatcher,o=e._id;return null!==(t=n[nt])&&void 0!==t||(n[nt]={}),{observersByDotNetObjectId:n[nt],id:o}}const it={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!==J(i)||(null===n&&(n=r.textContent),null===(e=r.parentNode)||void 0===e||e.removeChild(r))}return n}},st={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=at(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 at(e,t).blob}};function at(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 ct=new Set,lt={enableNavigationPrompt:function(e){0===ct.size&&window.addEventListener("beforeunload",ht),ct.add(e)},disableNavigationPrompt:function(e){ct.delete(e),0===ct.size&&window.removeEventListener("beforeunload",ht)}};function ht(e){e.preventDefault(),e.returnValue=!0}async function dt(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 ut=new Map,pt={navigateTo:function(e,t,n=!1){ze(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:y,runtime:{},_internal:{navigationManager:We,domWrapper:et,Virtualize:tt,PageTitle:it,InputFile:st,NavigationLock:lt,getJSDataStreamChunk:dt,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])}}(D(t),o,r),I(),function(e){for(const t of C)t(e)}(t)}}};var ft;window.Blazor=pt,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"}(ft||(ft={}));class gt{log(e,t){}}gt.instance=new gt;class mt{constructor(e){this.minLevel=e}log(e,t){if(e>=this.minLevel){const n=`[${(new Date).toISOString()}] ${ft[e]}: ${t}`;switch(e){case ft.Critical:case ft.Error:console.error(n);break;case ft.Warning:console.warn(n);break;case ft.Information:console.info(n);break;default:console.log(n)}}}}function vt(e,t){switch(t){case"webassembly":return Et(e,"webassembly");case"server":return function(e){return Et(e,"server").sort(((e,t)=>e.sequence-t.sequence))}(e);case"auto":return Et(e,"auto")}}const yt=/^\s*Blazor-Server-Component-State:(?[a-zA-Z0-9+/=]+)$/,wt=/^\s*Blazor-WebAssembly-Component-State:(?[a-zA-Z0-9+/=]+)$/;function bt(e){return _t(e,yt)}function _t(e,t){var n;if(e.nodeType===Node.COMMENT_NODE){const o=e.textContent||"",r=t.exec(o),i=r&&r.groups&&r.groups.state;return i&&(null===(n=e.parentNode)||void 0===n||n.removeChild(e)),i}if(!e.hasChildNodes())return;const o=e.childNodes;for(let e=0;e.*)$/);function Ct(e,t){const n=e.currentElement;var o,r,i;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const s=St.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=St.exec(e.textContent),r=t&&t[1];if(r)return Dt(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,Tt(o=s),{...o,uniqueId:It++,start:r,end:i};case"server":return function(e,t,n){return kt(e),{...e,uniqueId:It++,start:t,end:n}}(s,n,c);case"auto":return function(e,t,n){return kt(e),Tt(e),{...e,uniqueId:It++,start:t,end:n}}(s,n,c)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}let It=0;function kt(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 Tt(e){const{assembly:t,typeName:n}=e;if(!t)throw new Error("assembly must be defined when using a descriptor.");if(!n)throw new Error("typeName must be defined when using a descriptor.");e.parameterDefinitions=e.parameterDefinitions&&atob(e.parameterDefinitions),e.parameterValues=e.parameterValues&&atob(e.parameterValues)}function Dt(e,t){const n=JSON.parse(e);if(1!==Object.keys(n).length)throw new Error(`Invalid end of component comment: '${e}'`);const 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 Rt{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndex{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 Ot(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function $t(e,t,n,o,r,i){const s={},[a,c]=Wt();s[a]=c,e.log(Mt.Trace,`(${t} transport) sending data. ${Ft(r,i.logMessageContent)}.`);const l=Ot(r)?"arraybuffer":"text",h=await n.post(o,{content:r,headers:{...s,...i.headers},responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});e.log(Mt.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}class Ht{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 jt{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${Mt[e]}: ${t}`;switch(e){case Mt.Critical:case Mt.Error:this.out.error(n);break;case Mt.Warning:this.out.warn(n);break;case Mt.Information:this.out.info(n);break;default:this.out.log(n)}}}}function Wt(){let e="X-SignalR-User-Agent";return Bt.isNode&&(e="User-Agent"),[e,qt(Ut,zt(),Bt.isNode?"NodeJS":"Browser",Jt())]}function qt(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 zt(){if(!Bt.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(Bt.isNode)return process.versions.node}function Vt(e){return e.stack?e.stack:e.message?e.message:`${e}`}class Kt{writeHandshakeRequest(e){return Nt.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(Ot(e)){const o=new Uint8Array(e),r=o.indexOf(Nt.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(Nt.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=Nt.parse(t),r=JSON.parse(o[0]);if(r.type)throw new Error("Expected a handshake response from the server.");return[n,r]}}class Xt extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class Gt extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class Yt extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class Qt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class Zt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class en extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class tn extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class nn extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}var on,rn;!function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close",e[e.Ack=8]="Ack",e[e.Sequence=9]="Sequence"}(on||(on={}));class sn{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 Ht(this,e)}}class an{constructor(e,t,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=t,this._bufferSize=n}async _send(e){const t=this._protocol.writeMessage(e);let n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let e=()=>{},o=()=>{};Ot(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise(((t,n)=>{e=t,o=n}))),this._messages.push(new cn(t,this._totalMessageCount,e,o))}try{this._reconnectInProgress||await this._connection.send(t)}catch{this._disconnected()}await n}_ack(e){let t=-1;for(let n=0;nthis._nextReceivingSequenceId?this._connection.stop(new Error("Sequence ID greater than amount of messages we've received.")):this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const e=0!==this._messages.length?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:on.Sequence,sequenceId:e}));const t=this._messages;for(const e of t)await this._connection.send(e._message);this._reconnectInProgress=!1}_dispose(e){null!=e||(e=new Error("Unable to reconnect to server."));for(const t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case on.Invocation:case on.StreamItem:case on.Completion:case on.StreamInvocation:case on.CancelInvocation:return!0;case on.Close:case on.Sequence:case on.Ping:case on.Ack:return!1}}_ackTimer(){void 0===this._ackTimerHandle&&(this._ackTimerHandle=setTimeout((async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:on.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0}),1e3))}}class cn{constructor(e,t,n,o){this._message=e,this._id=t,this._resolver=n,this._rejector=o}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}(rn||(rn={}));class ln{static create(e,t,n,o,r,i,s){return new ln(e,t,n,o,r,i,s)}constructor(e,t,n,o,r,i,s){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(Mt.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")},Lt.isRequired(e,"connection"),Lt.isRequired(t,"logger"),Lt.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=null!=r?r:3e4,this.keepAliveIntervalInMilliseconds=null!=i?i:15e3,this._statefulReconnectBufferSize=null!=s?s:1e5,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=o,this._handshakeProtocol=new Kt,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=rn.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:on.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!==rn.Disconnected&&this._connectionState!==rn.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!==rn.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=rn.Connecting,this._logger.log(Mt.Debug,"Starting HubConnection.");try{await this._startInternal(),Bt.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=rn.Connected,this._connectionStarted=!0,this._logger.log(Mt.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=rn.Disconnected,this._logger.log(Mt.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const e=new Promise(((e,t)=>{this._handshakeResolver=e,this._handshakeRejecter=t}));await this.connection.start(this._protocol.transferFormat);try{let t=this._protocol.version;this.connection.features.reconnect||(t=1);const n={protocol:this._protocol.name,version:t};if(this._logger.log(Mt.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(Mt.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;!!this.connection.features.reconnect&&(this._messageBuffer=new an(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(e){throw this._logger.log(Mt.Debug,`Hub handshake failed with error '${e}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(e),e}}async stop(){const e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch(e){}}_stopInternal(e){if(this._connectionState===rn.Disconnected)return this._logger.log(Mt.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===rn.Disconnecting)return this._logger.log(Mt.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=rn.Disconnecting,this._logger.log(Mt.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(Mt.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===rn.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new Yt("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 sn;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===on.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._messageBuffer?this._messageBuffer._send(e):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===on.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)if(!this._messageBuffer||this._messageBuffer._shouldProcessMessage(e))switch(e.type){case on.Invocation:this._invokeClientMethod(e);break;case on.StreamItem:case on.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===on.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(Mt.Error,`Stream callback threw error: ${Vt(e)}`)}}break}case on.Ping:break;case on.Close:{this._logger.log(Mt.Information,"Close message received from server.");const t=e.error?new Error("Server returned an error on close: "+e.error):void 0;!0===e.allowReconnect?this.connection.stop(t):this._stopPromise=this._stopInternal(t);break}case on.Ack:this._messageBuffer&&this._messageBuffer._ack(e);break;case on.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(e);break;default:this._logger.log(Mt.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(Mt.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(Mt.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(Mt.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===rn.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(Mt.Warning,`No client method with the name '${t}' found.`),void(e.invocationId&&(this._logger.log(Mt.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(Mt.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(Mt.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(Mt.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(Mt.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(Mt.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new Yt("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===rn.Disconnecting?this._completeClose(e):this._connectionState===rn.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===rn.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=rn.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(null!=e?e:new Error("Connection closed.")),this._messageBuffer=void 0),Bt.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Mt.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(Mt.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=rn.Reconnecting,e?this._logger.log(Mt.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(Mt.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Mt.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==rn.Reconnecting)return void this._logger.log(Mt.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==r;){if(this._logger.log(Mt.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!==rn.Reconnecting)return void this._logger.log(Mt.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=rn.Connected,this._logger.log(Mt.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(Mt.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(Mt.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==rn.Reconnecting)return this._logger.log(Mt.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===rn.Disconnecting&&this._completeClose());o=e instanceof Error?e:new Error(e.toString()),r=this._getNextRetryDelay(n++,Date.now()-t,o)}}this._logger.log(Mt.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(Mt.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(Mt.Error,`Stream 'error' callback called with '${e}' threw error: ${Vt(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:on.Invocation}:{arguments:t,target:e,type:on.Invocation};{const n=this._invocationId;return this._invocationId++,0!==o.length?{arguments:t,invocationId:n.toString(),streamIds:o,target:e,type:on.Invocation}:{arguments:t,invocationId:n.toString(),target:e,type:on.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;o0)&&(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[un.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[un.Authorization]&&delete e.headers[un.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}class mn extends fn{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 Yt;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 Yt});let o,r=null;if(e.timeout){const o=e.timeout;r=setTimeout((()=>{t.abort(),this._logger.log(Mt.Warning,"Timeout from HTTP request."),n=new Gt}),o)}""===e.content&&(e.content=void 0),e.content&&(e.headers=e.headers||{},Ot(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(Mt.Warning,`Error from HTTP request. ${e}.`),e}finally{r&&clearTimeout(r),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const e=await vn(o,"text");throw new Xt(e||o.statusText,o.status)}const i=vn(o,e.responseType),s=await i;return new pn(o.status,o.statusText,s)}getCookieString(e){return""}}function vn(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 yn extends fn{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Yt):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&&(Ot(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 Yt)}),e.timeout&&(o.timeout=e.timeout),o.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),o.status>=200&&o.status<300?t(new pn(o.status,o.statusText,o.response||o.responseText)):n(new Xt(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(Mt.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new Xt(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(Mt.Warning,"Timeout from HTTP request."),n(new Gt)},o.send(e.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class wn extends fn{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new mn(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new yn(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Yt):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 bn,_n;!function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(bn||(bn={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(_n||(_n={}));class En{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 Sn{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new En,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(Lt.isRequired(e,"url"),Lt.isRequired(t,"transferFormat"),Lt.isIn(t,_n,"transferFormat"),this._url=e,this._logger.log(Mt.Trace,"(LongPolling transport) Connecting."),t===_n.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]=Wt(),r={[n]:o,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:r,timeout:1e5,withCredentials:this._options.withCredentials};t===_n.Binary&&(i.responseType="arraybuffer");const s=`${e}&_=${Date.now()}`;this._logger.log(Mt.Trace,`(LongPolling transport) polling: ${s}.`);const a=await this._httpClient.get(s,i);200!==a.statusCode?(this._logger.log(Mt.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new Xt(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(Mt.Trace,`(LongPolling transport) polling: ${n}.`);const o=await this._httpClient.get(n,t);204===o.statusCode?(this._logger.log(Mt.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==o.statusCode?(this._logger.log(Mt.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new Xt(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(Mt.Trace,`(LongPolling transport) data received. ${Ft(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(Mt.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof Gt?this._logger.log(Mt.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(Mt.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}finally{this._logger.log(Mt.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?$t(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(Mt.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(Mt.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=Wt();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 Xt&&(404===r.statusCode?this._logger.log(Mt.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(Mt.Trace,`(LongPolling transport) Error sending a DELETE request: ${r}`)):this._logger.log(Mt.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(Mt.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(Mt.Trace,e),this.onclose(this._closeError)}}}class Cn{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 Lt.isRequired(e,"url"),Lt.isRequired(t,"transferFormat"),Lt.isIn(t,_n,"transferFormat"),this._logger.log(Mt.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===_n.Text){if(Bt.isBrowser||Bt.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]=Wt();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(Mt.Trace,`(SSE transport) data received. ${Ft(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(Mt.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?$t(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 In{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 Lt.isRequired(e,"url"),Lt.isRequired(t,"transferFormat"),Lt.isIn(t,_n,"transferFormat"),this._logger.log(Mt.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(Bt.isReactNative){const t={},[o,r]=Wt();t[o]=r,n&&(t[un.Authorization]=`Bearer ${n}`),s&&(t[un.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===_n.Binary&&(i.binaryType="arraybuffer"),i.onopen=t=>{this._logger.log(Mt.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(Mt.Information,`(WebSockets transport) ${t}.`)},i.onmessage=e=>{if(this._logger.log(Mt.Trace,`(WebSockets transport) data received. ${Ft(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(Mt.Trace,`(WebSockets transport) sending data. ${Ft(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(Mt.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 kn{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Lt.isRequired(e,"url"),this._logger=function(e){return void 0===e?new jt(Mt.Information):null===e?Pt.instance:void 0!==e.log?e:new jt(e)}(t.logger),this.baseUrl=this._resolveUrl(e),(t=t||{}).logMessageContent=void 0!==t.logMessageContent&&t.logMessageContent,"boolean"!=typeof t.withCredentials&&void 0!==t.withCredentials)throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.withCredentials=void 0===t.withCredentials||t.withCredentials,t.timeout=void 0===t.timeout?1e5:t.timeout,"undefined"==typeof WebSocket||t.WebSocket||(t.WebSocket=WebSocket),"undefined"==typeof EventSource||t.EventSource||(t.EventSource=EventSource),this._httpClient=new gn(t.httpClient||new wn(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||_n.Binary,Lt.isIn(e,_n,"transferFormat"),this._logger.log(Mt.Debug,`Starting connection with transfer format '${_n[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(Mt.Error,e),await this._stopPromise,Promise.reject(new Yt(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(Mt.Error,e),Promise.reject(new Yt(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 Tn(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(Mt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(Mt.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(Mt.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(Mt.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!==bn.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(bn.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 Yt("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 Sn&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(Mt.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(Mt.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]=Wt();t[n]=o;const r=this._resolveNegotiateUrl(e);this._logger.log(Mt.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.useStatefulReconnect&&!0!==this._options._useStatefulReconnect?Promise.reject(new tn("Client didn't negotiate Stateful Reconnect but the server did.")):n}catch(e){let t="Failed to complete negotiation with the server: "+e;return e instanceof Xt&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(Mt.Error,t),Promise.reject(new tn(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(Mt.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,!0===(null==a?void 0:a.useStatefulReconnect));if(s instanceof Error)i.push(`${n.transport} failed:`),i.push(s);else if(this._isITransport(s)){if(this.transport=s,!a){try{a=await this._getNegotiationResponse(e)}catch(e){return Promise.reject(e)}r=this._createConnectUrl(e,a.connectionToken)}try{return await this._startTransport(r,o),void(this.connectionId=a.connectionId)}catch(e){if(this._logger.log(Mt.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,i.push(new en(`${n.transport} failed: ${e}`,bn[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(Mt.Debug,e),Promise.reject(new Yt(e))}}}}return i.length>0?Promise.reject(new nn(`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 bn.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new In(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case bn.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Cn(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case bn.LongPolling:return new Sn(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let o=!1;if(this.features.reconnect){try{this.features.disconnected(),await this.transport.connect(e,t),await this.features.resend()}catch{o=!0}o&&this._stopConnection(n)}else this._stopConnection(n)}:this.transport.onclose=e=>this._stopConnection(e),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n,o){const r=bn[e.transport];if(null==r)return this._logger.log(Mt.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,r))return this._logger.log(Mt.Debug,`Skipping transport '${bn[r]}' because it was disabled by the client.`),new Zt(`'${bn[r]}' is disabled by the client.`,r);if(!(e.transferFormats.map((e=>_n[e])).indexOf(n)>=0))return this._logger.log(Mt.Debug,`Skipping transport '${bn[r]}' because it does not support the requested transfer format '${_n[n]}'.`),new Error(`'${bn[r]}' does not support ${_n[n]}.`);if(r===bn.WebSockets&&!this._options.WebSocket||r===bn.ServerSentEvents&&!this._options.EventSource)return this._logger.log(Mt.Debug,`Skipping transport '${bn[r]}' because it is not supported in your environment.'`),new Qt(`'${bn[r]}' is not supported in your environment.`,r);this._logger.log(Mt.Debug,`Selecting transport '${bn[r]}'.`);try{return this.features.reconnect=r===bn.WebSockets?o:void 0,this._constructTransport(r)}catch(e){return e}}_isITransport(e){return e&&"object"==typeof e&&"connect"in e}_stopConnection(e){if(this._logger.log(Mt.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(Mt.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(Mt.Error,`Connection disconnected with error '${e}'.`):this._logger.log(Mt.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(Mt.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(Mt.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(Mt.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(!Bt.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(Mt.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";const n=new URLSearchParams(t.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?"true"===n.get("useStatefulReconnect")&&(this._options._useStatefulReconnect=!0):!0===this._options._useStatefulReconnect&&n.append("useStatefulReconnect","true"),t.search=n.toString(),t.toString()}}class Tn{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new Dn,this._transportResult=new Dn,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new Dn),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 Dn;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):Tn._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 Dn{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class Rn{constructor(){this.name="json",this.version=2,this.transferFormat=_n.Text}parseMessages(e,t){if("string"!=typeof e)throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];null===t&&(t=Pt.instance);const n=Nt.parse(e),o=[];for(const e of n){const n=JSON.parse(e);if("number"!=typeof n.type)throw new Error("Invalid payload.");switch(n.type){case on.Invocation:this._isInvocationMessage(n);break;case on.StreamItem:this._isStreamItemMessage(n);break;case on.Completion:this._isCompletionMessage(n);break;case on.Ping:case on.Close:break;case on.Ack:this._isAckMessage(n);break;case on.Sequence:this._isSequenceMessage(n);break;default:t.log(Mt.Information,"Unknown message type '"+n.type+"' ignored.");continue}o.push(n)}return o}writeMessage(e){return Nt.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),void 0!==e.invocationId&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),void 0===e.item)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if("number"!=typeof e.sequenceId)throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if("number"!=typeof e.sequenceId)throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if("string"!=typeof e||""===e)throw new Error(t)}}const An={trace:Mt.Trace,debug:Mt.Debug,info:Mt.Information,information:Mt.Information,warn:Mt.Warning,warning:Mt.Warning,error:Mt.Error,critical:Mt.Critical,none:Mt.None};class xn{configureLogging(e){if(Lt.isRequired(e,"logging"),function(e){return void 0!==e.log}(e))this.logger=e;else if("string"==typeof e){const t=function(e){const t=An[e.toLowerCase()];if(void 0!==t)return t;throw new Error(`Unknown log level: ${e}`)}(e);this.logger=new jt(t)}else this.logger=new jt(e);return this}withUrl(e,t){return Lt.isRequired(e,"url"),Lt.isNotEmpty(e,"url"),this.url=e,this.httpConnectionOptions="object"==typeof t?{...this.httpConnectionOptions,...t}:{...this.httpConnectionOptions,transport:t},this}withHubProtocol(e){return Lt.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new dn(e):this.reconnectPolicy=e:this.reconnectPolicy=new dn,this}withServerTimeout(e){return Lt.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return Lt.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return void 0===this.httpConnectionOptions&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=null==e?void 0:e.bufferSize,this}build(){const e=this.httpConnectionOptions||{};if(void 0===e.logger&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const t=new kn(this.url,e);return ln.create(t,this.logger||Pt.instance,this.protocol||new Rn,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}var Nn;!function(e){e[e.Default=0]="Default",e[e.Server=1]="Server",e[e.WebAssembly=2]="WebAssembly",e[e.WebView=3]="WebView"}(Nn||(Nn={}));var Mn,Pn,Un,Ln=4294967295;function Bn(e,t,n){var o=Math.floor(n/4294967296),r=n;e.setUint32(t,o),e.setUint32(t+4,r)}function Fn(e,t){return 4294967296*e.getInt32(t)+e.getUint32(t+4)}var On=("undefined"==typeof process||"never"!==(null===(Mn=null===process||void 0===process?void 0:process.env)||void 0===Mn?void 0:Mn.TEXT_ENCODING))&&"undefined"!=typeof TextEncoder&&"undefined"!=typeof TextDecoder;function $n(e){for(var t=e.length,n=0,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 zn,Jn=On?new TextDecoder:null,Vn=On?"undefined"!=typeof process&&"force"!==(null===(Un=null===process||void 0===process?void 0:process.env)||void 0===Un?void 0:Un.TEXT_DECODER)?200:0:Ln,Kn=function(e,t){this.type=e,this.data=t},Xn=(zn=function(e,t){return zn=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])},zn(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}zn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Gn=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),Yn={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),Bn(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:Fn(t,4),nsec:t.getUint32(0)};default:throw new Gn("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},Qn=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Yn)}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>jn){var t=$n(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),Wn(e,this.bytes,this.pos),this.pos+=t}else t=$n(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var 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=Zn(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=qn(e,t,n),i=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(i,r),r},e}(),oo=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 oo(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 oo(this,(function(p){switch(p.label){case 0:i=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=ro(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 co))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(to(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 oo(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=ro(e),d.label=2;case 2:return[4,io(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,io(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 co))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,io(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 io?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 Gn("Unrecognized type byte: ".concat(to(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 Gn("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new Gn("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 Gn("Unrecognized array type byte: ".concat(to(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new Gn("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 Gn("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 Gn("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthVn?function(e,t,n){var o=e.subarray(t,t+n);return Jn.decode(o)}(this.bytes,r,e):qn(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 Gn("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw lo;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 Gn("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=Fn(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 po{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 fo=new Uint8Array([145,on.Ping]);class go{constructor(e){this.name="messagepack",this.version=2,this.transferFormat=_n.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new eo(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new uo(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=Pt.instance);const o=po.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 on.Invocation:return this._writeInvocation(e);case on.StreamInvocation:return this._writeStreamInvocation(e);case on.StreamItem:return this._writeStreamItem(e);case on.Completion:return this._writeCompletion(e);case on.Ping:return po.write(fo);case on.CancelInvocation:return this._writeCancelInvocation(e);case on.Close:return this._writeClose();case on.Ack:return this._writeAck(e);case on.Sequence:return this._writeSequence(e);default:throw new Error("Invalid message type.")}}_parseMessage(e,t){if(0===e.length)throw new Error("Invalid payload.");const n=this._decoder.decode(e);if(0===n.length||!(n instanceof Array))throw new Error("Invalid payload.");const o=n[0];switch(o){case on.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case on.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case on.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case on.Ping:return this._createPingMessage(n);case on.Close:return this._createCloseMessage(n);case on.Ack:return this._createAckMessage(n);case on.Sequence:return this._createSequenceMessage(n);default:return t.log(Mt.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:on.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:on.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:on.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:on.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:on.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:on.Completion}}_createAckMessage(e){if(e.length<1)throw new Error("Invalid payload for Ack message.");return{sequenceId:e[1],type:on.Ack}}_createSequenceMessage(e){if(e.length<1)throw new Error("Invalid payload for Sequence message.");return{sequenceId:e[1],type:on.Sequence}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([on.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([on.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),po.write(t.slice())}_writeStreamInvocation(e){let t;return t=e.streamIds?this._encoder.encode([on.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([on.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),po.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([on.StreamItem,e.headers||{},e.invocationId,e.item]);return po.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([on.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([on.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([on.Completion,e.headers||{},e.invocationId,t,e.result])}return po.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([on.CancelInvocation,e.headers||{},e.invocationId]);return po.write(t.slice())}_writeClose(){const e=this._encoder.encode([on.Close,null]);return po.write(e.slice())}_writeAck(e){const t=this._encoder.encode([on.Ack,e.sequenceId]);return po.write(t.slice())}_writeSequence(e){const t=this._encoder.encode([on.Sequence,e.sequenceId]);return po.write(t.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}const mo="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,vo=mo?mo.decode.bind(mo):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("")},yo=Math.pow(2,32),wo=Math.pow(2,21)-1;function bo(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function _o(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function Eo(e,t){const n=_o(e,t+4);if(n>wo)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*yo+_o(e,t)}class So{constructor(e){this.batchData=e;const t=new To(e);this.arrayRangeReader=new Do(e),this.arrayBuilderSegmentReader=new Ro(e),this.diffReader=new Co(e),this.editReader=new Io(e,t),this.frameReader=new ko(e,t)}updatedComponents(){return bo(this.batchData,this.batchData.length-20)}referenceFrames(){return bo(this.batchData,this.batchData.length-16)}disposedComponentIds(){return bo(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return bo(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return bo(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return bo(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return Eo(this.batchData,n)}}class Co{constructor(e){this.batchDataUint8=e}componentId(e){return bo(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class Io{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return bo(this.batchDataUint8,e)}siblingIndex(e){return bo(this.batchDataUint8,e+4)}newTreeIndex(e){return bo(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return bo(this.batchDataUint8,e+8)}removedAttributeName(e){const t=bo(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class ko{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return bo(this.batchDataUint8,e)}subtreeLength(e){return bo(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=bo(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return bo(this.batchDataUint8,e+8)}elementName(e){const t=bo(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=bo(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=bo(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=bo(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=bo(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return Eo(this.batchDataUint8,e+12)}}class To{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=bo(e,e.length-4)}readString(e){if(-1===e)return null;{const n=bo(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(ft.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(ft.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(ft.Debug,`Applying batch ${e}.`),Ce(Nn.Server,new So(t)),await this.completeBatch(n,e)}catch(t){throw this.fatalError=t.toString(),this.logger.log(ft.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(ft.Warning,`Failed to deliver completion notification for render '${t}'.`)}}}let xo=!1;function No(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),xo||(xo=!0,document.querySelectorAll("#blazor-error-ui .reload").forEach((e=>{e.onclick=function(e){location.reload(),e.preventDefault()}})),document.querySelectorAll("#blazor-error-ui .dismiss").forEach((e=>{e.onclick=function(e){const t=document.querySelector("#blazor-error-ui");t&&(t.style.display="none"),e.preventDefault()}})))}class Mo{constructor(t,n,o,r){this._firstUpdate=!0,this._renderingFailed=!1,this._disposed=!1,this._circuitId=void 0,this._applicationState=n,this._componentManager=t,this._options=o,this._logger=r,this._renderQueue=new Ao(this._logger),this._dispatcher=e.attachDispatcher(this)}start(){if(this.isDisposedOrDisposing())throw new Error("Cannot start a disposed circuit.");return this._startPromise||(this._startPromise=this.startCore()),this._startPromise}updateRootComponents(e){var t,n;return this._firstUpdate?(this._firstUpdate=!1,null===(t=this._connection)||void 0===t?void 0:t.send("UpdateRootComponents",e,this._applicationState)):null===(n=this._connection)||void 0===n?void 0:n.send("UpdateRootComponents",e,"")}async startCore(){if(this._connection=await this.startConnection(),this._connection.state!==rn.Connected)return!1;const e=JSON.stringify(this._componentManager.initialComponents.map((e=>At(e))));return this._circuitId=await this._connection.invoke("StartCircuit",We.getBaseURI(),We.getLocationHref(),e,this._applicationState||""),!!this._circuitId}async startConnection(){var e,t;const n=new go;n.name="blazorpack";const o=(new xn).withUrl("_blazor").withHubProtocol(n);this._options.configureSignalR(o);const r=o.build();r.on("JS.AttachComponent",((e,t)=>Ee(Nn.Server,this.resolveElement(t,e),e,!1))),r.on("JS.BeginInvokeJS",this._dispatcher.beginInvokeJSFromDotNet.bind(this._dispatcher)),r.on("JS.EndInvokeDotNet",this._dispatcher.endInvokeDotNetFromJS.bind(this._dispatcher)),r.on("JS.ReceiveByteArray",this._dispatcher.receiveByteArray.bind(this._dispatcher)),r.on("JS.BeginTransmitStream",(e=>{const t=new ReadableStream({start:t=>{r.stream("SendDotNetStreamToJS",e).subscribe({next:e=>t.enqueue(e),complete:()=>t.close(),error:e=>t.error(e)})}});this._dispatcher.supplyDotNetStream(e,t)})),r.on("JS.RenderBatch",(async(e,t)=>{var n,o;this._logger.log(Mt.Debug,`Received render batch with id ${e} and ${t.byteLength} bytes.`),await this._renderQueue.processBatch(e,t,this._connection),null===(o=(n=this._componentManager).onAfterRenderBatch)||void 0===o||o.call(n,Nn.Server)})),r.on("JS.EndLocationChanging",pt._internal.navigationManager.endLocationChanging),r.onclose((e=>!this._disposed&&!this._renderingFailed&&this._options.reconnectionHandler.onConnectionDown(this._options.reconnectionOptions,e))),r.on("JS.Error",(e=>{this._renderingFailed=!0,this.unhandledError(e),No()}));try{await r.start()}catch(e){if(this.unhandledError(e),"FailedToNegotiateWithServerError"===e.errorType)throw e;No(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===bn.WebSockets))?this._logger.log(Mt.Error,"Unable to connect, please ensure you are using an updated browser that supports WebSockets."):e.innerErrors.some((e=>"FailedToStartTransportError"===e.errorType&&e.transport===bn.WebSockets))?this._logger.log(Mt.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===bn.LongPolling))&&this._logger.log(Mt.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===(t=null===(e=r.connection)||void 0===e?void 0:e.features)||void 0===t?void 0:t.inherentKeepAlive)&&this._logger.log(Mt.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."),r}async disconnect(){var e;await(null===(e=this._connection)||void 0===e?void 0:e.stop())}async reconnect(){if(!this._circuitId)throw new Error("Circuit host not initialized.");return this._connection.state===rn.Connected||(this._connection=await this.startConnection(),!!await this._connection.invoke("ConnectCircuit",this._circuitId)&&(this._options.reconnectionHandler.onConnectionUp(),!0))}beginInvokeDotNetFromJS(e,t,n,o,r){this.throwIfDispatchingWhenDisposed(),this._connection.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,o||0,r)}endInvokeJSFromDotNet(e,t,n){this.throwIfDispatchingWhenDisposed(),this._connection.send("EndInvokeJSFromDotNet",e,t,n)}sendByteArray(e,t){this.throwIfDispatchingWhenDisposed(),this._connection.send("ReceiveByteArray",e,t)}throwIfDispatchingWhenDisposed(){if(this._disposed)throw new Error("The circuit associated with this dispatcher is no longer available.")}sendLocationChanged(e,t,n){return this._connection.send("OnLocationChanged",e,t,n)}sendLocationChanging(e,t,n,o){return this._connection.send("OnLocationChanging",e,t,n,o)}sendJsDataStream(e,t,n){return 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)}(this._connection,e,t,n)}resolveElement(e,t){const n=w(e);if(n)return H(n,!0);const o=Number.parseInt(e);if(!Number.isNaN(o))return $(this._componentManager.resolveRootComponent(o,t));throw new Error(`Invalid sequence number or identifier '${e}'.`)}getRootComponentManager(){return this._componentManager}unhandledError(e){this._logger.log(Mt.Error,e),this.disconnect()}getDisconnectFormData(){const e=new FormData,t=this._circuitId;return e.append("circuitId",t),e}didRenderingFail(){return this._renderingFailed}isDisposedOrDisposing(){return void 0!==this._disposePromise}sendDisconnectBeacon(){if(this._disposed)return;const e=this.getDisconnectFormData();this._disposed=navigator.sendBeacon("_blazor/disconnect",e)}dispose(){return this._disposePromise||(this._disposePromise=this.disposeCore()),this._disposePromise}async disposeCore(){var e;if(!this._startPromise)return void(this._disposed=!0);await this._startPromise,this._disposed=!0,null===(e=this._connection)||void 0===e||e.stop();const t=this.getDisconnectFormData();fetch("_blazor/disconnect",{method:"POST",body:t}),function(e){if(!S.delete(e))throw new Error(`Interop methods are not registered for renderer ${e}`)}(Nn.Server)}}const Po={configureSignalR:e=>{},logLevel:ft.Warning,reconnectionOptions:{maxRetries:8,retryIntervalMilliseconds:2e4,dialogId:"components-reconnect-modal"}};class Uo{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 pt.reconnect()||this.rejected()}catch(e){this.logger.log(ft.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 Lo{constructor(e,t,n){this.dialog=e,this.maxRetries=t,this.document=n,this.document=n;const o=this.document.getElementById(Lo.MaxRetriesId);o&&(o.innerText=this.maxRetries.toString())}show(){this.removeClasses(),this.dialog.classList.add(Lo.ShowClassName)}update(e){const t=this.document.getElementById(Lo.CurrentAttemptId);t&&(t.innerText=e.toString())}hide(){this.removeClasses(),this.dialog.classList.add(Lo.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(Lo.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(Lo.RejectedClassName)}removeClasses(){this.dialog.classList.remove(Lo.ShowClassName,Lo.HideClassName,Lo.FailedClassName,Lo.RejectedClassName)}}Lo.ShowClassName="components-reconnect-show",Lo.HideClassName="components-reconnect-hide",Lo.FailedClassName="components-reconnect-failed",Lo.RejectedClassName="components-reconnect-rejected",Lo.MaxRetriesId="components-reconnect-max-retries",Lo.CurrentAttemptId="components-reconnect-current-attempt";class Bo{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||pt.reconnect}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new Lo(t,e.maxRetries,document):new Uo(e.dialogId,e.maxRetries,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new Fo(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class Fo{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;tFo.MaximumFirstRetryInterval?Fo.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(ft.Error,e)}}this.reconnectDisplay.failed()}delay(e){return new Promise((t=>setTimeout(t,e)))}}Fo.MaximumFirstRetryInterval=3e3;class Oo{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 k,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let $o,Ho,jo,Wo,qo,zo=!1;function Jo(e){if(jo)throw new Error("Circuit options have already been configured.");jo=function(e){const t={...Po,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...Po.reconnectionOptions,...e.reconnectionOptions}),t}(e)}function Vo(e){return Ho.updateRootComponents(e)}function Ko(e){return qo=e,qo}var Xo,Go;const Yo=navigator,Qo=Yo.userAgentData&&Yo.userAgentData.brands,Zo=Qo&&Qo.length>0?Qo.some((e=>"Google Chrome"===e.brand||"Microsoft Edge"===e.brand||"Chromium"===e.brand)):window.chrome,er=null!==(Go=null===(Xo=Yo.userAgentData)||void 0===Xo?void 0:Xo.platform)&&void 0!==Go?Go:navigator.platform;function tr(e){return 0!==e.debugLevel&&(Zo||navigator.userAgent.includes("Firefox"))}let nr,or,rr,ir,sr,ar;const cr=Math.pow(2,32),lr=Math.pow(2,21)-1;let hr=null;function dr(e){return or.getI32(e)}const ur={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"),pt._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:pr,config:n,disableDotnet6Compatibility:!1,out:gr,err:mr};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),ar=await n.create()}(e,t)},start:function(){return async function(){if(!ar)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}=ar;rr=o,nr=n,or=t,sr=i,function(e){const t=er.match(/^Mac/i)?"Cmd":"Alt";tr(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&&(tr(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())}():Zo?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()),pt.runtime=ar,pt._internal.dotNetCriticalError=mr,r("blazor-internal",{Blazor:{_internal:pt._internal}});const c=await ar.getAssemblyExports("Microsoft.AspNetCore.Components.WebAssembly");return Object.assign(pt._internal,{dotNetExports:{...c.Microsoft.AspNetCore.Components.WebAssembly.Services.DefaultWebAssemblyJSRuntime}}),ir=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,o,r)=>{if(yr(),!o&&!t)throw new Error("Either assemblyName or dotNetObjectId must have a non null value.");const i=o?o.toString():t;pt._internal.dotNetExports.BeginInvokeDotNet(e?e.toString():null,i,n,r)},endInvokeJSFromDotNet:(e,t,n)=>{pt._internal.dotNetExports.EndInvokeJS(n)},sendByteArray:(e,t)=>{pt._internal.dotNetExports.ReceiveByteArrayFromJS(e,t)},invokeDotNetFromJS:(e,t,n,o)=>(yr(),pt._internal.dotNetExports.InvokeDotNet(e||null,t,null!=n?n:0,o))}),{invokeLibraryInitializers:a}}()},callEntryPoint:async function(){try{await ar.runMain(ar.getConfig().mainAssemblyName,[])}catch(e){console.error(e),No()}},toUint8Array:function(e){const t=vr(e),n=dr(t),o=new Uint8Array(n);return o.set(rr.HEAPU8.subarray(t+4,t+4+n)),o},getArrayLength:function(e){return dr(vr(e))},getArrayEntryPtr:function(e,t,n){return vr(e)+4+t*n},getObjectFieldsBaseAddress:function(e){return e+8},readInt16Field:function(e,t){return n=e+(t||0),or.getI16(n);var n},readInt32Field:function(e,t){return dr(e+(t||0))},readUint64Field:function(e,t){return function(e){const t=e>>2,n=rr.HEAPU32[t+1];if(n>lr)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*cr+rr.HEAPU32[t]}(e+(t||0))},readFloatField:function(e,t){return n=e+(t||0),or.getF32(n);var n},readObjectField:function(e,t){return dr(e+(t||0))},readStringField:function(e,t,n){const o=dr(e+(t||0));if(0===o)return null;if(n){const e=nr.unbox_mono_obj(o);return"boolean"==typeof e?e?"":null:e}return nr.conv_string(o)},readStructField:function(e,t){return e+(t||0)},beginHeapLock:function(){return yr(),hr=wr.create(),hr},invokeWhenHeapUnlocked:function(e){hr?hr.enqueuePostReleaseAction(e):e()}};function pr(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 fr=["DEBUGGING ENABLED"],gr=e=>fr.indexOf(e)<0&&console.log(e),mr=e=>{console.error(e||"(null)"),No()};function vr(e){return e+12}function yr(){if(hr)throw new Error("Assertion failed - heap is currently locked")}class wr{enqueuePostReleaseAction(e){this.postReleaseActions||(this.postReleaseActions=[]),this.postReleaseActions.push(e)}release(){var e;if(hr!==this)throw new Error("Trying to release a lock which isn't current");for(sr.mono_wasm_gc_unlock(),hr=null;null===(e=this.postReleaseActions)||void 0===e?void 0:e.length;)this.postReleaseActions.shift()(),yr()}static create(){return sr.mono_wasm_gc_lock(),new wr}}class br{constructor(e){this.batchAddress=e,this.arrayRangeReader=_r,this.arrayBuilderSegmentReader=Er,this.diffReader=Sr,this.editReader=Cr,this.frameReader=Ir}updatedComponents(){return qo.readStructField(this.batchAddress,0)}referenceFrames(){return qo.readStructField(this.batchAddress,_r.structLength)}disposedComponentIds(){return qo.readStructField(this.batchAddress,2*_r.structLength)}disposedEventHandlerIds(){return qo.readStructField(this.batchAddress,3*_r.structLength)}updatedComponentsEntry(e,t){return kr(e,t,Sr.structLength)}referenceFramesEntry(e,t){return kr(e,t,Ir.structLength)}disposedComponentIdsEntry(e,t){const n=kr(e,t,4);return qo.readInt32Field(n)}disposedEventHandlerIdsEntry(e,t){const n=kr(e,t,8);return qo.readUint64Field(n)}}const _r={structLength:8,values:e=>qo.readObjectField(e,0),count:e=>qo.readInt32Field(e,4)},Er={structLength:12,values:e=>{const t=qo.readObjectField(e,0),n=qo.getObjectFieldsBaseAddress(t);return qo.readObjectField(n,0)},offset:e=>qo.readInt32Field(e,4),count:e=>qo.readInt32Field(e,8)},Sr={structLength:4+Er.structLength,componentId:e=>qo.readInt32Field(e,0),edits:e=>qo.readStructField(e,4),editsEntry:(e,t)=>kr(e,t,Cr.structLength)},Cr={structLength:20,editType:e=>qo.readInt32Field(e,0),siblingIndex:e=>qo.readInt32Field(e,4),newTreeIndex:e=>qo.readInt32Field(e,8),moveToSiblingIndex:e=>qo.readInt32Field(e,8),removedAttributeName:e=>qo.readStringField(e,16)},Ir={structLength:36,frameType:e=>qo.readInt16Field(e,4),subtreeLength:e=>qo.readInt32Field(e,8),elementReferenceCaptureId:e=>qo.readStringField(e,16),componentId:e=>qo.readInt32Field(e,12),elementName:e=>qo.readStringField(e,16),textContent:e=>qo.readStringField(e,16),markupContent:e=>qo.readStringField(e,16),attributeName:e=>qo.readStringField(e,16),attributeValue:e=>qo.readStringField(e,24,!0),attributeEventHandlerId:e=>qo.readUint64Field(e,8)};function kr(e,t,n){return qo.getArrayEntryPtr(e,t,n)}class Tr{constructor(e){this.componentManager=e}resolveRegisteredElement(e,t){const n=Number.parseInt(e);if(!Number.isNaN(n))return $(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 Dr,Rr,Ar,xr=!1,Nr=!1,Mr=!0,Pr=!1;const Ur=new Promise((e=>{Ar=e}));let Lr;const Br=new Promise((e=>{Lr=e}));function Fr(){return null!=Rr||(Rr=(async()=>{const e=null!=Dr?Dr:{},t=null==Dr?void 0:Dr.configureRuntime;e.configureRuntime=e=>{null==t||t(e),Pr&&e.withEnvironmentVariable("__BLAZOR_WEBASSEMBLY_WAIT_FOR_ROOT_COMPONENTS","true")},await ur.load(e,Ar),xr=!0})()),Rr}function Or(){return xr}function $r(t,n,o,r){const i=ur.readStringField(t,0),s=ur.readInt32Field(t,4),a=ur.readStringField(t,8),c=ur.readUint64Field(t,20);if(null!==a){const e=ur.readUint64Field(t,12);if(0!==e)return ir.beginInvokeJSFromDotNet(e,i,a,s,c),0;{const e=ir.invokeJSFromDotNet(i,a,s,c);return null===e?0:nr.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 nr.js_string_to_mono_string(o)}case e.JSCallResultType.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${s}'.`)}}}function Hr(e,t,n,o,r){return 0!==r?(ir.beginInvokeJSFromDotNet(r,e,o,n,t),null):ir.invokeJSFromDotNet(e,o,n,t)}function jr(e,t,n){ir.endInvokeDotNetFromJS(e,t,n)}function Wr(e,t,n,o){!function(e,t,n,o,r){let i=ut.get(t);if(!i){const n=new ReadableStream({start(e){ut.set(t,e),i=e}});e.supplyDotNetStream(t,n)}r?(i.error(r),ut.delete(t)):0===o?(i.close(),ut.delete(t)):i.enqueue(n.length===o?n:n.subarray(0,o))}(ir,e,t,n,o)}function qr(e,t){ir.receiveByteArray(e,t)}function zr(e,t){t.namespaceURI?e.setAttributeNS(t.namespaceURI,t.name,t.value):e.setAttribute(t.name,t.value)}const Jr="data-permanent";var Vr,Kr;!function(e){e[e.None=0]="None",e[e.Some=1]="Some",e[e.Infinite=2]="Infinite"}(Vr||(Vr={})),function(e){e.Keep="keep",e.Update="update",e.Insert="insert",e.Delete="delete"}(Kr||(Kr={}));class Xr{static create(e,t,n){return 0===t&&n===e.length?e:new Xr(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))===Vr.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?Kr.Insert:0===r?Kr.Delete:e[o][r];switch(n.unshift(t),t){case Kr.Keep:case Kr.Update:o--,r--;break;case Kr.Insert:r--;break;case Kr.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 Vr.None:h=o[a-1][i-1];break;case Vr.Some:h=o[a-1][i-1]+1;break;case Vr.Infinite:h=Number.MAX_VALUE}h{history.pushState(null,"",e),mi(e)}))}function fi(e){Pe()||mi(location.href)}function gi(e){if(Pe()||e.defaultPrevented)return;const t=e.target;if(t instanceof HTMLFormElement){if(!function(e){const t=e.getAttribute("data-enhance");return"string"==typeof t&&""===t||"true"===(null==t?void 0:t.toLowerCase())}(t))return;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,mi(n.toString(),o)}}async function mi(e,t){Qr=!0,null==Gr||Gr.abort(),Gr=new AbortController;const n=Gr.signal,o=fetch(e,Object.assign({signal:n,mode:"no-cors",headers:{accept:"text/html;blazor-enhanced-nav=on"}},t));if(await async function(e,t,n,o){let r;try{if(r=await e,!r.body)return void n(r,"");const t=r.headers.get("ssr-framing");if(!t){const e=await r.text();return void n(r,e)}let o=!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!--${t}--\x3e`)).pipeTo(new WritableStream({write(e){o?(o=!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)=>{const r=!(null==t?void 0:t.method)||"get"===t.method,i=n.status>=200&&n.status<300;if("opaque"===n.type){if(r)return void yi(e);throw new Error("Enhanced navigation does not support making a non-GET request to an endpoint that redirects to an external origin. Avoid enabling enhanced navigation for form posts that may perform external redirections.")}if(i&&"allow"!==n.headers.get("blazor-enhanced-nav")){if(r)return void yi(e);throw new Error("Enhanced navigation does not support making a non-GET request to a non-Blazor endpoint. Avoid enabling enhanced navigation for forms that post to a non-Blazor endpoint.")}n.redirected&&(r?history.replaceState(null,"",n.url):history.pushState(null,"",n.url),e=n.url);const s=n.headers.get("blazor-enhanced-nav-redirect-location");if(s)return void location.replace(s);const a=n.headers.get("content-type");if((null==a?void 0:a.startsWith("text/html"))&&o){const e=(new DOMParser).parseFromString(o,"text/html");ei(document,e),Yr.documentUpdated()}else(null==a?void 0:a.startsWith("text/"))&&o?vi(o):i||o?r?yi(e):vi(`Error: ${t.method} request to ${e} returned non-HTML content of type ${a||"unspecified"}.`):vi(`Error: ${n.status} ${n.statusText}`)})),!n.aborted){const t=e.indexOf("#");if(t>=0){const n=e.substring(t+1),o=document.getElementById(n);null==o||o.scrollIntoView()}Qr=!1,Yr.enhancedNavigationCompleted()}}function vi(e){document.documentElement.textContent=e;const t=document.documentElement.style;t.fontFamily="consolas, monospace",t.whiteSpace="pre-wrap",t.padding="1rem"}function yi(e){history.replaceState(null,"",e+"?"),location.replace(e)}let wi,bi=!0;class _i extends HTMLElement{connectedCallback(){var e;const t=this.parentNode;null===(e=t.parentNode)||void 0===e||e.removeChild(t),t.childNodes.forEach((e=>{if(e instanceof HTMLTemplateElement){const t=e.getAttribute("blazor-component-id");if(t)"true"!==e.getAttribute("enhanced-nav")&&Gr||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(bi)ei({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)}wi.documentUpdated()}}(t,e.content);else switch(e.getAttribute("type")){case"redirection":const t=Ne(e.content.textContent),n="form-post"===e.getAttribute("from");"true"===e.getAttribute("enhanced")&&Re(t)?(n?history.pushState(null,"",t):history.replaceState(null,"",t),mi(t)):n?location.assign(t):location.replace(t);break;case"error":vi(e.content.textContent||"Error")}}}))}}class Ei{constructor(e){var t;this._circuitInactivityTimeoutMs=e,this._rootComponents=new Set,this._descriptors=new Set,this._pendingComponentsToResolve=new Map,this._didWebAssemblyFailToLoadQuickly=!1,this._isComponentRefreshPending=!1,this.initialComponents=[],t=()=>{this.rootComponentsMayRequireRefresh()},C.push(t)}onAfterRenderBatch(e){e===Nn.Server&&this.circuitMayHaveNoRootComponents()}onDocumentUpdated(){this.rootComponentsMayRequireRefresh()}onEnhancedNavigationCompleted(){this.rootComponentsMayRequireRefresh()}registerComponent(e){this._descriptors.has(e)||("auto"!==e.type&&"webassembly"!==e.type||this.startLoadingWebAssemblyIfNotStarted(),this._descriptors.add(e),this._rootComponents.add({descriptor:e}))}unregisterComponent(e){this._descriptors.delete(e.descriptor),this._rootComponents.delete(e)}async startLoadingWebAssemblyIfNotStarted(){if(void 0!==Rr)return;Pr=!0;const e=Fr();setTimeout((()=>{Or()||this.onWebAssemblyFailedToLoadQuickly()}),pt._internal.loadWebAssemblyQuicklyTimeout);const t=await Ur;(function(e){if(!e.cacheBootResources)return!1;const t=Si(e);if(!t)return!1;const n=window.localStorage.getItem(t.key);return t.value===n})(t)||this.onWebAssemblyFailedToLoadQuickly(),await e,function(e){const t=Si(e);t&&window.localStorage.setItem(t.key,t.value)}(t),this.rootComponentsMayRequireRefresh()}onWebAssemblyFailedToLoadQuickly(){this._didWebAssemblyFailToLoadQuickly||(this._didWebAssemblyFailToLoadQuickly=!0,this.rootComponentsMayRequireRefresh())}startCircutIfNotStarted(){return zo?Ho.isDisposedOrDisposing()?function(){if(!zo)throw new Error("Cannot start the circuit until Blazor Server has started.");return Ho.didRenderingFail()?Promise.resolve(!1):(Ho.isDisposedOrDisposing()&&($o=bt(document)||"",Ho=new Mo(Ho.getRootComponentManager(),$o,jo,Wo)),Ho.start())}():void 0:async function(e){if(zo)throw new Error("Blazor Server has already started.");zo=!0,$o=bt(document)||"",Wo=new mt(jo.logLevel),Ho=new Mo(e,$o,jo,Wo),Wo.log(ft.Information,"Starting up Blazor server-side application."),pt.reconnect=async()=>!(Ho.didRenderingFail()||!await Ho.reconnect()&&(Wo.log(ft.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)),pt.defaultReconnectionHandler=new Bo(Wo),jo.reconnectionHandler=jo.reconnectionHandler||pt.defaultReconnectionHandler,pt._internal.navigationManager.listenForNavigationEvents(((e,t,n)=>Ho.sendLocationChanged(e,t,n)),((e,t,n,o)=>Ho.sendLocationChanging(e,t,n,o))),pt._internal.forceCloseConnection=()=>Ho.disconnect(),pt._internal.sendJSDataStream=(e,t,n)=>Ho.sendJsDataStream(e,t,n);const t=await async function(e){const t=await fetch("_blazor/initializers",{method:"GET",credentials:"include",cache:"no-cache"}),n=await t.json(),o=new Oo;return await o.importInitializersAsync(n,[e]),o}(jo);if(!await Ho.start())return void Wo.log(ft.Error,"Failed to start the circuit.");const n=()=>{Ho.sendDisconnectBeacon()};pt.disconnect=n,window.addEventListener("unload",n,{capture:!1,once:!0}),Wo.log(ft.Information,"Blazor server-side application started."),t.invokeAfterStartedCallbacks(pt)}(this)}async startWebAssemblyIfNotStarted(){this.startLoadingWebAssemblyIfNotStarted(),Nr||await async function(e){if(Nr)throw new Error("Blazor WebAssembly has already started.");Nr=!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=Fr();!function(e){const t=R;R=(e,n,o)=>{((e,t,n)=>{const o=Se(e);(null==o?void 0:o.eventDelegator.getHandler(t))&&ur.invokeWhenHeapUnlocked(n)})(e,n,(()=>t(e,n,o)))}}(),pt._internal.applyHotReload=(e,t,n,o)=>{ir.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","ApplyHotReloadDelta",e,t,n,o)},pt._internal.getApplyUpdateCapabilities=()=>ir.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","GetApplyUpdateCapabilities"),pt._internal.invokeJSFromDotNet=$r,pt._internal.invokeJSJson=Hr,pt._internal.endInvokeDotNetFromJS=jr,pt._internal.receiveWebAssemblyDotNetDataStream=Wr,pt._internal.receiveByteArray=qr;const n=Ko(ur);pt.platform=n,pt._internal.renderBatch=(e,t)=>{const n=ur.beginHeapLock();try{Ce(e,new br(t))}finally{n.release()}},pt._internal.navigationManager.listenForNavigationEvents((async(e,t,n)=>{await ir.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChanged",e,t,n)}),(async(e,t,n,o)=>{const r=await ir.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChangingAsync",t,n,o);pt._internal.navigationManager.endLocationChanging(e,r)}));const o=new Tr(e);let r;pt._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)||""},pt._internal.getPersistedState=()=>_t(document,wt)||"",pt._internal.getInitialComponentsUpdate=()=>Br,pt._internal.updateRootComponents=e=>{var t;return null===(t=pt._internal.dotNetExports)||void 0===t?void 0:t.UpdateRootComponentsCore(e)},pt._internal.attachRootComponentToElement=(e,t,n)=>{const r=o.resolveRegisteredElement(e,t);r?Ee(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}'.`);Ee(n||0,H(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",[pt])}(this)}rootComponentsMayRequireRefresh(){this._isComponentRefreshPending||(this._isComponentRefreshPending=!0,setTimeout((()=>{this._isComponentRefreshPending=!1,this.refreshRootComponents(this._rootComponents)}),0))}circuitMayHaveNoRootComponents(){if(this.hasAnyExistingOrPendingServerComponents())return clearTimeout(this._circuitInactivityTimeoutId),void(this._circuitInactivityTimeoutId=void 0);void 0===this._circuitInactivityTimeoutId&&(this._circuitInactivityTimeoutId=setTimeout((()=>{this.hasAnyExistingOrPendingServerComponents()||(async function(){await(null==Ho?void 0:Ho.dispose())}(),this._circuitInactivityTimeoutId=void 0)}),this._circuitInactivityTimeoutMs))}hasAnyExistingOrPendingServerComponents(){const e=Se(Nn.Server);if(e&&e.getRootComponentCount()>0)return!0;for(const{descriptor:{type:e},assignedRendererId:t}of this._rootComponents){if(t===Nn.Server)return!0;if(void 0===t&&("auto"===e||"server"===e))return!0}return!1}refreshRootComponents(e){const t=new Map;for(const n of e){const e=this.determinePendingOperation(n);if(!e)continue;const o=n.assignedRendererId;if(!o)throw new Error("Descriptors must be assigned a renderer ID before getting used as root components");let r=t.get(o);r||(r=[],t.set(o,r)),r.push(e)}for(const[e,n]of t){const t=JSON.stringify(n);e===Nn.Server?Vo(t):this.updateWebAssemblyRootComponents(t)}this.circuitMayHaveNoRootComponents()}updateWebAssemblyRootComponents(e){Mr?(Lr(e),Mr=!1):function(e){if(!Nr)throw new Error("Blazor WebAssembly has not started.");if(!pt._internal.updateRootComponents)throw new Error("Blazor WebAssembly has not initialized.");pt._internal.updateRootComponents(e)}(e)}resolveRendererIdForDescriptor(e){switch("auto"===e.type?this.getAutoRenderMode():e.type){case"server":return this.startCircutIfNotStarted(),Nn.Server;case"webassembly":return this.startWebAssemblyIfNotStarted(),Nn.WebAssembly;case null:return null}}getAutoRenderMode(){return Or()?"webassembly":this._didWebAssemblyFailToLoadQuickly?"server":null}determinePendingOperation(e){if(n=e.descriptor,document.contains(n.start)){if(void 0===e.assignedRendererId){if(Qr||"loading"===document.readyState)return null;const n=this.resolveRendererIdForDescriptor(e.descriptor);return null===n?null:(t=n,S.has(t)?(e.assignedRendererId=n,e.uniqueIdAtLastUpdate=e.descriptor.uniqueId,this._pendingComponentsToResolve.set(e.descriptor.uniqueId,e),{type:"add",selectorId:e.descriptor.uniqueId,marker:At(e.descriptor)}):null)}if(e.uniqueIdAtLastUpdate===e.descriptor.uniqueId)return null;if(void 0!==e.interactiveComponentId)return e.uniqueIdAtLastUpdate=e.descriptor.uniqueId,{type:"update",componentId:e.interactiveComponentId,marker:At(e.descriptor)}}else{if(this.unregisterComponent(e),void 0!==e.assignedRendererId&&void 0!==e.interactiveComponentId){const t=Se(e.assignedRendererId);null==t||t.disposeComponent(e.interactiveComponentId)}if(void 0!==e.interactiveComponentId)return{type:"remove",componentId:e.interactiveComponentId}}var t,n;return null}resolveRootComponent(e,t){const n=this._pendingComponentsToResolve.get(e);if(!n)throw new Error(`Could not resolve a root component for descriptor with ID '${e}'.`);if(this._pendingComponentsToResolve.delete(e),void 0!==n.interactiveComponentId)throw new Error("Cannot resolve a root component for the same descriptor multiple times.");return n.interactiveComponentId=t,this.refreshRootComponents([n]),n.descriptor}}function Si(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}class Ci{constructor(){this._eventListeners=new Map}static create(e){const t=new Ci;return e.addEventListener=t.addEventListener.bind(t),e.removeEventListener=t.removeEventListener.bind(t),t}addEventListener(e,t){let n=this._eventListeners.get(e);n||(n=new Set,this._eventListeners.set(e,n)),n.add(t)}removeEventListener(e,t){var n;null===(n=this._eventListeners.get(e))||void 0===n||n.delete(t)}dispatchEvent(e,t){const n=this._eventListeners.get(e);if(!n)return;const o={...t,type:e};for(const e of n)e(o)}}let Ii,ki=!1;function Ti(e){var t,n,o;if(ki)throw new Error("Blazor has already started.");ki=!0,pt._internal.loadWebAssemblyQuicklyTimeout=3e3,pt._internal.hotReloadApplied=()=>{Ae()&&xe(location.href,!0)},Jo(null==e?void 0:e.circuit),function(e){if(Dr)throw new Error("WebAssembly options have already been configured.");Dr=e}(null==e?void 0:e.webAssembly),Ii=new Ei(null!==(n=null===(t=null==e?void 0:e.ssr)||void 0===t?void 0:t.circuitInactivityTimeoutMs)&&void 0!==n?n:2e3);const r=Ci.create(pt),i={documentUpdated:()=>{Ii.onDocumentUpdated(),r.dispatchEvent("enhancedload",{})},enhancedNavigationCompleted(){Ii.onEnhancedNavigationCompleted()}};return Zr=Ii,function(e,t){wi=t,(null==e?void 0:e.disableDomPreservation)&&(bi=!1),customElements.define("blazor-ssr-end",_i)}(null==e?void 0:e.ssr,i),(null===(o=null==e?void 0:e.ssr)||void 0===o?void 0:o.disableDomPreservation)||di(i),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",Di):Di(),Promise.resolve()}function Di(){!function(e){const t=si(document);for(const e of t)null==Zr||Zr.registerComponent(e)}(),Ii.onDocumentUpdated()}pt.start=Ti,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&Ti()})()})(); \ 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 s=t[o]={exports:{}};return e[o](s,s.exports,n),s.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[]",s="__dotNetStream",i="__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={[i]: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 v(){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 y(e);return void 0===a?a=t:a&&(a=null),t},e.attachReviver=p,e.invokeMethod=function(e,t,...n){return v().invokeDotNetStaticMethod(e,t,...n)},e.invokeMethodAsync=function(e,t,...n){return v().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 y{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),s=I(b(e,o)(...r||[]),n);return null==s?null:T(this,s)}beginInvokeJSFromDotNet(e,t,n,o,r){const s=new Promise((e=>{const o=m(this,n);e(b(t,r)(...o||[]))}));e&&s.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),s=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,r);return s?m(this,s):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++,s=new Promise(((e,t)=>{this._pendingAsyncCalls[r]={resolve:e,reject:t}}));try{const s=T(this,o);this._dotNetCallDispatcher.beginInvokeDotNetFromJS(r,e,t,n,s)}catch(e){this.completePendingCall(r,!1,e)}return s}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(s)){const e=t[s],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 s=new Map,i=new Map,a=[];function c(e){return s.get(e)}function l(e){const t=s.get(e);return(null==t?void 0:t.browserEventName)||e}function h(e,t){e.forEach((e=>s.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(["cancel","close","toggle"],{createEventArgs:()=>({})});const p=["date","datetime-local","month","time","week"],f=new Map;let g,m,v=0;const y={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const o="__bl-dynamic-root:"+(++v).toString();f.set(o,e);const r=await E().invokeMethodAsync("AddRootComponent",t,o),s=new _(r,m[t]);return await s.setParameters(n),s}};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=[];let I;const k=new Promise((e=>{I=e}));function T(e,t,n){return R(e,t.eventHandlerId,(()=>D(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function D(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 x=L(["abort","blur","cancel","canplay","canplaythrough","change","close","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pointerenter","pointerleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),A={submit:!0},N=L(["click","dblclick","mousedown","mousemove","mouseup"]);class P{constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++P.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new M(this.onGlobalEvent.bind(this))}setListener(e,t,n,o){const r=this.getEventHandlerInfosForElement(e,!0),s=r.getHandler(t);if(s)this.eventInfoStore.update(s.eventHandlerId,n);else{const s={element:e,eventName:t,eventHandlerId:n,renderingComponentId:o};this.eventInfoStore.add(s),r.setHandler(t,s)}}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,i.get(n));var n;t&&t.forEach((t=>this.dispatchGlobalEventToAllElements(t,e))),"click"===e.type&&this.afterClickCallbacks.forEach((t=>t(e)))}dispatchGlobalEventToAllElements(e,t){const n=t.composedPath();let o=n.shift(),s=null,i=!1;const a=Object.prototype.hasOwnProperty.call(x,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(N,d)&&h.disabled))){if(!i){const n=c(e);s=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},i=!0}Object.prototype.hasOwnProperty.call(A,t.type)&&t.preventDefault(),T(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:r.fromEvent(n.renderingComponentId,t)},s)}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 U:null}}P.nextEventDelegatorId=0;class M{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(x,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 U{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 L(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const B=Symbol(),F=Symbol(),O=Symbol();function $(e){const{start:t,end:n}=e,o=t[O];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 s=H(r,!0),i=G(s);t[F]=s,t[O]=e;const a=H(t);if(n){const e=G(a),o=Array.prototype.indexOf.call(i,a)+1;let r=null;for(;r!==n;){const n=i.splice(o,1)[0];if(!n)throw new Error("Could not find the end component comment in the parent logical node list");n[F]=t,e.push(n),r=n}}return a}function H(e,t){if(B in e)return e;const n=[];if(e.childNodes.length>0){if(!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");e.childNodes.forEach((t=>{const o=H(t,!0);o[F]=e,n.push(o)}))}return e[B]=n,e}function j(e){const t=G(e);for(;t.length;)z(e,0)}function W(e,t){const n=document.createComment("!");return q(n,e,t),n}function q(e,t,n){const o=e;let r=e;if(Q(e)){const t=ne(o);if(t!==e){const n=new Range;n.setStartBefore(e),n.setEndAfter(t),r=n.extractContents()}}const s=J(o);if(s){const e=G(s),t=Array.prototype.indexOf.call(e,o);e.splice(t,1),delete o[F]}const i=G(t);if(n0;)z(n,0)}const o=n;o.parentNode.removeChild(o)}function J(e){return e[F]||null}function V(e,t){return G(e)[t]}function K(e){return e[O]||null}function X(e){const t=ee(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function G(e){return e[B]}function Y(e){const t=G(J(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}function Q(e){return B in e}function Z(e,t){const n=G(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=ne(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):te(o,e)})),t.forEach((e=>{const t=e.moveToBeforeMarker,n=t.parentNode,o=e.moveRangeStart,r=e.moveRangeEnd;let s=o;for(;s;){const e=s.nextSibling;if(n.insertBefore(s,t),s===r)break;s=e}n.removeChild(t)})),t.forEach((e=>{n[e.toSiblingIndex]=e.moveRangeStart}))}function ee(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 te(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=Y(t);n?n.parentNode.insertBefore(e,n):te(e,J(t))}}}function ne(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=Y(e);if(t)return t.previousSibling;{const t=J(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:ne(t)}}function oe(e){return`_bl_${e}`}const re="__internalId";e.attachReviver(((e,t)=>t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,re)&&"string"==typeof t[re]?function(e){const t=`[${oe(e)}]`;return document.querySelector(t)}(t[re]):t));const se="_blazorDeferredValue";function ie(e){e instanceof HTMLOptionElement?he(e):se in e&&le(e,e[se])}function ae(e){return"select-multiple"===e.type}function ce(e,t){e.value=t||""}function le(e,t){e instanceof HTMLSelectElement?ae(e)?function(e,t){t||(t=[]);for(let n=0;n{Me()&&De(e,(e=>{Je(e,!0,!1)}))}))}getRootComponentCount(){return this.rootComponentIds.size}attachRootComponentToLogicalElement(e,t,n){if(ve(t))throw new Error(`Root component '${e}' could not be attached because its target element is already associated with a root component`);me(t,!0),this.attachComponentToElement(e,t),this.rootComponentIds.add(e),n||(pe[e]=t)}updateComponent(e,t,n,o){var r;const s=this.childComponentLocations[t];if(!s)throw new Error(`No element is currently associated with component ${t}`);const i=pe[t];i&&(delete pe[t],j(i),i instanceof Comment&&(i.textContent="!"));const a=null===(r=ee(s))||void 0===r?void 0:r.getRootNode(),c=a&&a.activeElement;this.applyEdits(e,t,s,0,n,o),c instanceof HTMLElement&&a&&a.activeElement!==c&&c.focus()}disposeComponent(e){if(this.rootComponentIds.delete(e)){const t=this.childComponentLocations[e];me(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,s,i){let a,c=0,l=r;const h=e.arrayBuilderSegmentReader,d=e.editReader,u=e.frameReader,p=h.values(s),f=h.offset(s),g=f+h.count(s);for(let s=f;sdocument.baseURI,getLocationHref:()=>location.href,scrollToElement:qe};function qe(e){const t=document.getElementById(e);return!!t&&(t.scrollIntoView(),!0)}function ze(e,t,n=!1){const o=Ne(e);!t.forceLoad&&Re(o)?Ze()?Je(o,!1,t.replaceHistoryEntry,t.historyEntryState,n):Ae(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 Je(e,t,n,o=void 0,r=!1){if(Xe(),function(e){const t=e.indexOf("#");return t>-1&&location.href.replace(location.hash,"")===e.substring(0,t)}(e))!function(e,t,n){Ve(e,t,n);const o=e.indexOf("#");o!==e.length-1&&qe(e.substring(o+1))}(e,n,o);else{if(!r&&Le&&!await Ge(e,o,t))return;_e=!0,Ve(e,n,o),await Ye(t)}}function Ve(e,t,n=void 0){t?history.replaceState({userState:n,_index:Be},"",e):(Be++,history.pushState({userState:n,_index:Be},"",e))}function Ke(e){return new Promise((t=>{const n=He;He=()=>{He=n,t()},history.go(e)}))}function Xe(){je&&(je(!1),je=null)}function Ge(e,t,n){return new Promise((o=>{Xe(),$e?(Fe++,je=o,$e(Fe,e,t,n)):o(!1)}))}async function Ye(e){var t;Oe&&await Oe(location.href,null===(t=history.state)||void 0===t?void 0:t.userState,e)}async function Qe(e){var t,n;He&&Ze()&&await He(e),Be=null!==(n=null===(t=history.state)||void 0===t?void 0:t._index)&&void 0!==n?n:0}function Ze(){return Me()||!xe()}const et={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}))}},tt={init:function(e,t,n,o=50){const r=ot(t);(r||document.documentElement).style.overflowAnchor="none";const s=document.createRange();u(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const i=new IntersectionObserver((function(o){o.forEach((o=>{var r;if(!o.isIntersecting)return;s.setStartAfter(t),s.setEndBefore(n);const i=s.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,i,a):o.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",o.boundingClientRect.bottom-o.intersectionRect.bottom,i,a)}))}),{root:r,rootMargin:`${o}px`});i.observe(t),i.observe(n);const a=d(t),c=d(n),{observersByDotNetObjectId:l,id:h}=rt(e);function d(e){const t={attributes:!0},n=new MutationObserver(((n,o)=>{u(e.parentElement)&&(o.disconnect(),e.style.display="table-row",o.observe(e,t)),i.unobserve(e),i.observe(e)}));return n.observe(e,t),n}function u(e){return null!==e&&(e instanceof HTMLTableElement&&""===e.style.display||"table"===e.style.display||e instanceof HTMLTableSectionElement&&""===e.style.display||"table-row-group"===e.style.display)}l[h]={intersectionObserver:i,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const{observersByDotNetObjectId:t,id:n}=rt(e),o=t[n];o&&(o.intersectionObserver.disconnect(),o.mutationObserverBefore.disconnect(),o.mutationObserverAfter.disconnect(),e.dispose(),delete t[n])}},nt=Symbol();function ot(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:ot(e.parentElement):null}function rt(e){var t;const n=e._callDispatcher,o=e._id;return null!==(t=n[nt])&&void 0!==t||(n[nt]={}),{observersByDotNetObjectId:n[nt],id:o}}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],s=r.previousSibling;s instanceof Comment&&null!==J(s)||(null===n&&(n=r.textContent),null===(e=r.parentNode)||void 0===e||e.removeChild(r))}return n}},it={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 s=at(e,t),i=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(s.blob)})),a=await new Promise((function(e){var t;const s=Math.min(1,o/i.width),a=Math.min(1,r/i.height),c=Math.min(s,a),l=document.createElement("canvas");l.width=Math.round(i.width*c),l.height=Math.round(i.height*c),null===(t=l.getContext("2d"))||void 0===t||t.drawImage(i,0,0,l.width,l.height),l.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:s.lastModified,name:s.name,size:(null==a?void 0:a.size)||0,contentType:n,blob:a||s.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return at(e,t).blob}};function at(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 ct=new Set,lt={enableNavigationPrompt:function(e){0===ct.size&&window.addEventListener("beforeunload",ht),ct.add(e)},disableNavigationPrompt:function(e){ct.delete(e),0===ct.size&&window.removeEventListener("beforeunload",ht)}};function ht(e){e.preventDefault(),e.returnValue=!0}async function dt(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 ut=new Map,pt={navigateTo:function(e,t,n=!1){ze(e,t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n})},registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(s.has(e))throw new Error(`The event '${e}' is already registered.`);if(t.browserEventName){const n=i.get(t.browserEventName);n?n.push(e):i.set(t.browserEventName,[e]),a.forEach((n=>n(e,t.browserEventName)))}s.set(e,t)},rootComponents:y,runtime:{},_internal:{navigationManager:We,domWrapper:et,Virtualize:tt,PageTitle:st,InputFile:it,NavigationLock:lt,getJSDataStreamChunk:dt,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])}}(D(t),o,r),I(),function(e){for(const t of C)t(e)}(t)}}};var ft;window.Blazor=pt,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"}(ft||(ft={}));class gt{log(e,t){}}gt.instance=new gt;class mt{constructor(e){this.minLevel=e}log(e,t){if(e>=this.minLevel){const n=`[${(new Date).toISOString()}] ${ft[e]}: ${t}`;switch(e){case ft.Critical:case ft.Error:console.error(n);break;case ft.Warning:console.warn(n);break;case ft.Information:console.info(n);break;default:console.log(n)}}}}function vt(e,t){switch(t){case"webassembly":return Et(e,"webassembly");case"server":return function(e){return Et(e,"server").sort(((e,t)=>e.sequence-t.sequence))}(e);case"auto":return Et(e,"auto")}}const yt=/^\s*Blazor-Server-Component-State:(?[a-zA-Z0-9+/=]+)$/,wt=/^\s*Blazor-WebAssembly-Component-State:(?[a-zA-Z0-9+/=]+)$/;function bt(e){return _t(e,yt)}function _t(e,t){var n;if(e.nodeType===Node.COMMENT_NODE){const o=e.textContent||"",r=t.exec(o),s=r&&r.groups&&r.groups.state;return s&&(null===(n=e.parentNode)||void 0===n||n.removeChild(e)),s}if(!e.hasChildNodes())return;const o=e.childNodes;for(let e=0;e.*)$/);function Ct(e,t){const n=e.currentElement;var o,r,s;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const i=St.exec(n.textContent),a=i&&i.groups&&i.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 i=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=St.exec(e.textContent),r=t&&t[1];if(r)return Dt(r,o),e}throw new Error(`Could not find an end component comment for '${t}'.`)}}(i,n,e);if(t!==i.type)return;switch(i.type){case"webassembly":return r=n,s=c,Tt(o=i),{...o,uniqueId:It++,start:r,end:s};case"server":return function(e,t,n){return kt(e),{...e,uniqueId:It++,start:t,end:n}}(i,n,c);case"auto":return function(e,t,n){return kt(e),Tt(e),{...e,uniqueId:It++,start:t,end:n}}(i,n,c)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}let It=0;function kt(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 Tt(e){const{assembly:t,typeName:n}=e;if(!t)throw new Error("assembly must be defined when using a descriptor.");if(!n)throw new Error("typeName must be defined when using a descriptor.");e.parameterDefinitions=e.parameterDefinitions&&atob(e.parameterDefinitions),e.parameterValues=e.parameterValues&&atob(e.parameterValues)}function Dt(e,t){const n=JSON.parse(e);if(1!==Object.keys(n).length)throw new Error(`Invalid end of component comment: '${e}'`);const 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 Rt{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndex{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 Ot(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function $t(e,t,n,o,r,s){const i={},[a,c]=Wt();i[a]=c,e.log(Pt.Trace,`(${t} transport) sending data. ${Ft(r,s.logMessageContent)}.`);const l=Ot(r)?"arraybuffer":"text",h=await n.post(o,{content:r,headers:{...i,...s.headers},responseType:l,timeout:s.timeout,withCredentials:s.withCredentials});e.log(Pt.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}class Ht{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 jt{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${Pt[e]}: ${t}`;switch(e){case Pt.Critical:case Pt.Error:this.out.error(n);break;case Pt.Warning:this.out.warn(n);break;case Pt.Information:this.out.info(n);break;default:this.out.log(n)}}}}function Wt(){let e="X-SignalR-User-Agent";return Bt.isNode&&(e="User-Agent"),[e,qt(Ut,zt(),Bt.isNode?"NodeJS":"Browser",Jt())]}function qt(e,t,n,o){let r="Microsoft SignalR/";const s=e.split(".");return r+=`${s[0]}.${s[1]}`,r+=` (${e}; `,r+=t&&""!==t?`${t}; `:"Unknown OS; ",r+=`${n}`,r+=o?`; ${o}`:"; Unknown Runtime Version",r+=")",r}function zt(){if(!Bt.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(Bt.isNode)return process.versions.node}function Vt(e){return e.stack?e.stack:e.message?e.message:`${e}`}class Kt{writeHandshakeRequest(e){return Nt.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(Ot(e)){const o=new Uint8Array(e),r=o.indexOf(Nt.RecordSeparatorCode);if(-1===r)throw new Error("Message is incomplete.");const s=r+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(o.slice(0,s))),n=o.byteLength>s?o.slice(s).buffer:null}else{const o=e,r=o.indexOf(Nt.RecordSeparator);if(-1===r)throw new Error("Message is incomplete.");const s=r+1;t=o.substring(0,s),n=o.length>s?o.substring(s):null}const o=Nt.parse(t),r=JSON.parse(o[0]);if(r.type)throw new Error("Expected a handshake response from the server.");return[n,r]}}class Xt extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class Gt extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class Yt extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class Qt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class Zt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class en extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class tn extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class nn extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}var on,rn;!function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close",e[e.Ack=8]="Ack",e[e.Sequence=9]="Sequence"}(on||(on={}));class sn{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 Ht(this,e)}}class an{constructor(e,t,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=t,this._bufferSize=n}async _send(e){const t=this._protocol.writeMessage(e);let n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let e=()=>{},o=()=>{};Ot(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise(((t,n)=>{e=t,o=n}))),this._messages.push(new cn(t,this._totalMessageCount,e,o))}try{this._reconnectInProgress||await this._connection.send(t)}catch{this._disconnected()}await n}_ack(e){let t=-1;for(let n=0;nthis._nextReceivingSequenceId?this._connection.stop(new Error("Sequence ID greater than amount of messages we've received.")):this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const e=0!==this._messages.length?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:on.Sequence,sequenceId:e}));const t=this._messages;for(const e of t)await this._connection.send(e._message);this._reconnectInProgress=!1}_dispose(e){null!=e||(e=new Error("Unable to reconnect to server."));for(const t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case on.Invocation:case on.StreamItem:case on.Completion:case on.StreamInvocation:case on.CancelInvocation:return!0;case on.Close:case on.Sequence:case on.Ping:case on.Ack:return!1}}_ackTimer(){void 0===this._ackTimerHandle&&(this._ackTimerHandle=setTimeout((async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:on.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0}),1e3))}}class cn{constructor(e,t,n,o){this._message=e,this._id=t,this._resolver=n,this._rejector=o}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}(rn||(rn={}));class ln{static create(e,t,n,o,r,s,i){return new ln(e,t,n,o,r,s,i)}constructor(e,t,n,o,r,s,i){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(Pt.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")},Lt.isRequired(e,"connection"),Lt.isRequired(t,"logger"),Lt.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=null!=r?r:3e4,this.keepAliveIntervalInMilliseconds=null!=s?s:15e3,this._statefulReconnectBufferSize=null!=i?i:1e5,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=o,this._handshakeProtocol=new Kt,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=rn.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:on.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!==rn.Disconnected&&this._connectionState!==rn.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!==rn.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=rn.Connecting,this._logger.log(Pt.Debug,"Starting HubConnection.");try{await this._startInternal(),Bt.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=rn.Connected,this._connectionStarted=!0,this._logger.log(Pt.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=rn.Disconnected,this._logger.log(Pt.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const e=new Promise(((e,t)=>{this._handshakeResolver=e,this._handshakeRejecter=t}));await this.connection.start(this._protocol.transferFormat);try{let t=this._protocol.version;this.connection.features.reconnect||(t=1);const n={protocol:this._protocol.name,version:t};if(this._logger.log(Pt.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(Pt.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;!!this.connection.features.reconnect&&(this._messageBuffer=new an(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(e){throw this._logger.log(Pt.Debug,`Hub handshake failed with error '${e}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(e),e}}async stop(){const e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch(e){}}_stopInternal(e){if(this._connectionState===rn.Disconnected)return this._logger.log(Pt.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===rn.Disconnecting)return this._logger.log(Pt.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=rn.Disconnecting,this._logger.log(Pt.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(Pt.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===rn.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new Yt("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 s;const i=new sn;return i.cancelCallback=()=>{const e=this._createCancelInvocation(r.invocationId);return delete this._callbacks[r.invocationId],s.then((()=>this._sendWithProtocol(e)))},this._callbacks[r.invocationId]=(e,t)=>{t?i.error(t):e&&(e.type===on.Completion?e.error?i.error(new Error(e.error)):i.complete():i.next(e.item))},s=this._sendWithProtocol(r).catch((e=>{i.error(e),delete this._callbacks[r.invocationId]})),this._launchStreams(n,s),i}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._messageBuffer?this._messageBuffer._send(e):this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){const[n,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===on.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)if(!this._messageBuffer||this._messageBuffer._shouldProcessMessage(e))switch(e.type){case on.Invocation:this._invokeClientMethod(e);break;case on.StreamItem:case on.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===on.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(Pt.Error,`Stream callback threw error: ${Vt(e)}`)}}break}case on.Ping:break;case on.Close:{this._logger.log(Pt.Information,"Close message received from server.");const t=e.error?new Error("Server returned an error on close: "+e.error):void 0;!0===e.allowReconnect?this.connection.stop(t):this._stopPromise=this._stopInternal(t);break}case on.Ack:this._messageBuffer&&this._messageBuffer._ack(e);break;case on.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(e);break;default:this._logger.log(Pt.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(Pt.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(Pt.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(Pt.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===rn.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(Pt.Warning,`No client method with the name '${t}' found.`),void(e.invocationId&&(this._logger.log(Pt.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 s,i,a;for(const n of o)try{const o=s;s=await n.apply(this,e.arguments),r&&s&&o&&(this._logger.log(Pt.Error,`Multiple results provided for '${t}'. Sending error to server.`),a=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),i=void 0}catch(e){i=e,this._logger.log(Pt.Error,`A callback for the method '${t}' threw error '${e}'.`)}a?await this._sendWithProtocol(a):r?(i?a=this._createCompletionMessage(e.invocationId,`${i}`,null):void 0!==s?a=this._createCompletionMessage(e.invocationId,null,s):(this._logger.log(Pt.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)):s&&this._logger.log(Pt.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(Pt.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new Yt("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===rn.Disconnecting?this._completeClose(e):this._connectionState===rn.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===rn.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=rn.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(null!=e?e:new Error("Connection closed.")),this._messageBuffer=void 0),Bt.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Pt.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(Pt.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=rn.Reconnecting,e?this._logger.log(Pt.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(Pt.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Pt.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==rn.Reconnecting)return void this._logger.log(Pt.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==r;){if(this._logger.log(Pt.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!==rn.Reconnecting)return void this._logger.log(Pt.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=rn.Connected,this._logger.log(Pt.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(Pt.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(Pt.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==rn.Reconnecting)return this._logger.log(Pt.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===rn.Disconnecting&&this._completeClose());o=e instanceof Error?e:new Error(e.toString()),r=this._getNextRetryDelay(n++,Date.now()-t,o)}}this._logger.log(Pt.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(Pt.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(Pt.Error,`Stream 'error' callback called with '${e}' threw error: ${Vt(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:on.Invocation}:{arguments:t,target:e,type:on.Invocation};{const n=this._invocationId;return this._invocationId++,0!==o.length?{arguments:t,invocationId:n.toString(),streamIds:o,target:e,type:on.Invocation}:{arguments:t,invocationId:n.toString(),target:e,type:on.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;o0)&&(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[un.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[un.Authorization]&&delete e.headers[un.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}class mn extends fn{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 Yt;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 Yt});let o,r=null;if(e.timeout){const o=e.timeout;r=setTimeout((()=>{t.abort(),this._logger.log(Pt.Warning,"Timeout from HTTP request."),n=new Gt}),o)}""===e.content&&(e.content=void 0),e.content&&(e.headers=e.headers||{},Ot(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(Pt.Warning,`Error from HTTP request. ${e}.`),e}finally{r&&clearTimeout(r),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const e=await vn(o,"text");throw new Xt(e||o.statusText,o.status)}const s=vn(o,e.responseType),i=await s;return new pn(o.status,o.statusText,i)}getCookieString(e){return""}}function vn(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 yn extends fn{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Yt):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&&(Ot(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 Yt)}),e.timeout&&(o.timeout=e.timeout),o.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),o.status>=200&&o.status<300?t(new pn(o.status,o.statusText,o.response||o.responseText)):n(new Xt(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(Pt.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new Xt(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(Pt.Warning,"Timeout from HTTP request."),n(new Gt)},o.send(e.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class wn extends fn{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new mn(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new yn(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Yt):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 bn,_n;!function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(bn||(bn={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(_n||(_n={}));class En{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 Sn{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new En,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(Lt.isRequired(e,"url"),Lt.isRequired(t,"transferFormat"),Lt.isIn(t,_n,"transferFormat"),this._url=e,this._logger.log(Pt.Trace,"(LongPolling transport) Connecting."),t===_n.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]=Wt(),r={[n]:o,...this._options.headers},s={abortSignal:this._pollAbort.signal,headers:r,timeout:1e5,withCredentials:this._options.withCredentials};t===_n.Binary&&(s.responseType="arraybuffer");const i=`${e}&_=${Date.now()}`;this._logger.log(Pt.Trace,`(LongPolling transport) polling: ${i}.`);const a=await this._httpClient.get(i,s);200!==a.statusCode?(this._logger.log(Pt.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new Xt(a.statusText||"",a.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,s)}async _poll(e,t){try{for(;this._running;)try{const n=`${e}&_=${Date.now()}`;this._logger.log(Pt.Trace,`(LongPolling transport) polling: ${n}.`);const o=await this._httpClient.get(n,t);204===o.statusCode?(this._logger.log(Pt.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==o.statusCode?(this._logger.log(Pt.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new Xt(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(Pt.Trace,`(LongPolling transport) data received. ${Ft(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(Pt.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof Gt?this._logger.log(Pt.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(Pt.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}finally{this._logger.log(Pt.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?$t(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(Pt.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(Pt.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=Wt();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 Xt&&(404===r.statusCode?this._logger.log(Pt.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(Pt.Trace,`(LongPolling transport) Error sending a DELETE request: ${r}`)):this._logger.log(Pt.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(Pt.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(Pt.Trace,e),this.onclose(this._closeError)}}}class Cn{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 Lt.isRequired(e,"url"),Lt.isRequired(t,"transferFormat"),Lt.isIn(t,_n,"transferFormat"),this._logger.log(Pt.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise(((n,o)=>{let r,s=!1;if(t===_n.Text){if(Bt.isBrowser||Bt.isWebWorker)r=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const t=this._httpClient.getCookieString(e),n={};n.Cookie=t;const[o,s]=Wt();n[o]=s,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(Pt.Trace,`(SSE transport) data received. ${Ft(e.data,this._options.logMessageContent)}.`),this.onreceive(e.data)}catch(e){return void this._close(e)}},r.onerror=e=>{s?this._close():o(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},r.onopen=()=>{this._logger.log(Pt.Information,`SSE connected to ${this._url}`),this._eventSource=r,s=!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?$t(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 In{constructor(e,t,n,o,r,s){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=o,this._webSocketConstructor=r,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=s}async connect(e,t){let n;return Lt.isRequired(e,"url"),Lt.isRequired(t,"transferFormat"),Lt.isIn(t,_n,"transferFormat"),this._logger.log(Pt.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise(((o,r)=>{let s;e=e.replace(/^http/,"ws");const i=this._httpClient.getCookieString(e);let a=!1;if(Bt.isReactNative){const t={},[o,r]=Wt();t[o]=r,n&&(t[un.Authorization]=`Bearer ${n}`),i&&(t[un.Cookie]=i),s=new this._webSocketConstructor(e,void 0,{headers:{...t,...this._headers}})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);s||(s=new this._webSocketConstructor(e)),t===_n.Binary&&(s.binaryType="arraybuffer"),s.onopen=t=>{this._logger.log(Pt.Information,`WebSocket connected to ${e}.`),this._webSocket=s,a=!0,o()},s.onerror=e=>{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"There was an error with the transport",this._logger.log(Pt.Information,`(WebSockets transport) ${t}.`)},s.onmessage=e=>{if(this._logger.log(Pt.Trace,`(WebSockets transport) data received. ${Ft(e.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(e.data)}catch(e){return void this._close(e)}},s.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(Pt.Trace,`(WebSockets transport) sending data. ${Ft(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(Pt.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 kn{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Lt.isRequired(e,"url"),this._logger=function(e){return void 0===e?new jt(Pt.Information):null===e?Mt.instance:void 0!==e.log?e:new jt(e)}(t.logger),this.baseUrl=this._resolveUrl(e),(t=t||{}).logMessageContent=void 0!==t.logMessageContent&&t.logMessageContent,"boolean"!=typeof t.withCredentials&&void 0!==t.withCredentials)throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.withCredentials=void 0===t.withCredentials||t.withCredentials,t.timeout=void 0===t.timeout?1e5:t.timeout,"undefined"==typeof WebSocket||t.WebSocket||(t.WebSocket=WebSocket),"undefined"==typeof EventSource||t.EventSource||(t.EventSource=EventSource),this._httpClient=new gn(t.httpClient||new wn(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||_n.Binary,Lt.isIn(e,_n,"transferFormat"),this._logger.log(Pt.Debug,`Starting connection with transfer format '${_n[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(Pt.Error,e),await this._stopPromise,Promise.reject(new Yt(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(Pt.Error,e),Promise.reject(new Yt(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 Tn(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(Pt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(Pt.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(Pt.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(Pt.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!==bn.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(bn.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 Yt("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 Sn&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(Pt.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(Pt.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]=Wt();t[n]=o;const r=this._resolveNegotiateUrl(e);this._logger.log(Pt.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.useStatefulReconnect&&!0!==this._options._useStatefulReconnect?Promise.reject(new tn("Client didn't negotiate Stateful Reconnect but the server did.")):n}catch(e){let t="Failed to complete negotiation with the server: "+e;return e instanceof Xt&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(Pt.Error,t),Promise.reject(new tn(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(Pt.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 s=[],i=n.availableTransports||[];let a=n;for(const n of i){const i=this._resolveTransportOrError(n,t,o,!0===(null==a?void 0:a.useStatefulReconnect));if(i instanceof Error)s.push(`${n.transport} failed:`),s.push(i);else if(this._isITransport(i)){if(this.transport=i,!a){try{a=await this._getNegotiationResponse(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(Pt.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,s.push(new en(`${n.transport} failed: ${e}`,bn[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(Pt.Debug,e),Promise.reject(new Yt(e))}}}}return s.length>0?Promise.reject(new nn(`Unable to connect to the server with any of the available transports. ${s.join(" ")}`,s)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case bn.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new In(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case bn.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Cn(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case bn.LongPolling:return new Sn(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let o=!1;if(this.features.reconnect){try{this.features.disconnected(),await this.transport.connect(e,t),await this.features.resend()}catch{o=!0}o&&this._stopConnection(n)}else this._stopConnection(n)}:this.transport.onclose=e=>this._stopConnection(e),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n,o){const r=bn[e.transport];if(null==r)return this._logger.log(Pt.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,r))return this._logger.log(Pt.Debug,`Skipping transport '${bn[r]}' because it was disabled by the client.`),new Zt(`'${bn[r]}' is disabled by the client.`,r);if(!(e.transferFormats.map((e=>_n[e])).indexOf(n)>=0))return this._logger.log(Pt.Debug,`Skipping transport '${bn[r]}' because it does not support the requested transfer format '${_n[n]}'.`),new Error(`'${bn[r]}' does not support ${_n[n]}.`);if(r===bn.WebSockets&&!this._options.WebSocket||r===bn.ServerSentEvents&&!this._options.EventSource)return this._logger.log(Pt.Debug,`Skipping transport '${bn[r]}' because it is not supported in your environment.'`),new Qt(`'${bn[r]}' is not supported in your environment.`,r);this._logger.log(Pt.Debug,`Selecting transport '${bn[r]}'.`);try{return this.features.reconnect=r===bn.WebSockets?o:void 0,this._constructTransport(r)}catch(e){return e}}_isITransport(e){return e&&"object"==typeof e&&"connect"in e}_stopConnection(e){if(this._logger.log(Pt.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(Pt.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(Pt.Error,`Connection disconnected with error '${e}'.`):this._logger.log(Pt.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(Pt.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(Pt.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(Pt.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(!Bt.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(Pt.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";const n=new URLSearchParams(t.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?"true"===n.get("useStatefulReconnect")&&(this._options._useStatefulReconnect=!0):!0===this._options._useStatefulReconnect&&n.append("useStatefulReconnect","true"),t.search=n.toString(),t.toString()}}class Tn{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new Dn,this._transportResult=new Dn,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new Dn),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 Dn;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):Tn._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 Dn{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class Rn{constructor(){this.name="json",this.version=2,this.transferFormat=_n.Text}parseMessages(e,t){if("string"!=typeof e)throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];null===t&&(t=Mt.instance);const n=Nt.parse(e),o=[];for(const e of n){const n=JSON.parse(e);if("number"!=typeof n.type)throw new Error("Invalid payload.");switch(n.type){case on.Invocation:this._isInvocationMessage(n);break;case on.StreamItem:this._isStreamItemMessage(n);break;case on.Completion:this._isCompletionMessage(n);break;case on.Ping:case on.Close:break;case on.Ack:this._isAckMessage(n);break;case on.Sequence:this._isSequenceMessage(n);break;default:t.log(Pt.Information,"Unknown message type '"+n.type+"' ignored.");continue}o.push(n)}return o}writeMessage(e){return Nt.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),void 0!==e.invocationId&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),void 0===e.item)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if("number"!=typeof e.sequenceId)throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if("number"!=typeof e.sequenceId)throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if("string"!=typeof e||""===e)throw new Error(t)}}const xn={trace:Pt.Trace,debug:Pt.Debug,info:Pt.Information,information:Pt.Information,warn:Pt.Warning,warning:Pt.Warning,error:Pt.Error,critical:Pt.Critical,none:Pt.None};class An{configureLogging(e){if(Lt.isRequired(e,"logging"),function(e){return void 0!==e.log}(e))this.logger=e;else if("string"==typeof e){const t=function(e){const t=xn[e.toLowerCase()];if(void 0!==t)return t;throw new Error(`Unknown log level: ${e}`)}(e);this.logger=new jt(t)}else this.logger=new jt(e);return this}withUrl(e,t){return Lt.isRequired(e,"url"),Lt.isNotEmpty(e,"url"),this.url=e,this.httpConnectionOptions="object"==typeof t?{...this.httpConnectionOptions,...t}:{...this.httpConnectionOptions,transport:t},this}withHubProtocol(e){return Lt.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new dn(e):this.reconnectPolicy=e:this.reconnectPolicy=new dn,this}withServerTimeout(e){return Lt.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return Lt.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return void 0===this.httpConnectionOptions&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=null==e?void 0:e.bufferSize,this}build(){const e=this.httpConnectionOptions||{};if(void 0===e.logger&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const t=new kn(this.url,e);return ln.create(t,this.logger||Mt.instance,this.protocol||new Rn,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}var Nn;!function(e){e[e.Default=0]="Default",e[e.Server=1]="Server",e[e.WebAssembly=2]="WebAssembly",e[e.WebView=3]="WebView"}(Nn||(Nn={}));var Pn,Mn,Un,Ln=4294967295;function Bn(e,t,n){var o=Math.floor(n/4294967296),r=n;e.setUint32(t,o),e.setUint32(t+4,r)}function Fn(e,t){return 4294967296*e.getInt32(t)+e.getUint32(t+4)}var On=("undefined"==typeof process||"never"!==(null===(Pn=null===process||void 0===process?void 0:process.env)||void 0===Pn?void 0:Pn.TEXT_ENCODING))&&"undefined"!=typeof TextEncoder&&"undefined"!=typeof TextDecoder;function $n(e){for(var t=e.length,n=0,o=0;o=55296&&r<=56319&&o65535&&(h-=65536,s.push(h>>>10&1023|55296),h=56320|1023&h),s.push(h)}else s.push(a);s.length>=4096&&(i+=String.fromCharCode.apply(String,s),s.length=0)}return s.length>0&&(i+=String.fromCharCode.apply(String,s)),i}var zn,Jn=On?new TextDecoder:null,Vn=On?"undefined"!=typeof process&&"force"!==(null===(Un=null===process||void 0===process?void 0:process.env)||void 0===Un?void 0:Un.TEXT_DECODER)?200:0:Ln,Kn=function(e,t){this.type=e,this.data=t},Xn=(zn=function(e,t){return zn=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])},zn(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}zn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Gn=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),Yn={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 s=n/4294967296,i=4294967295&n;return r=new Uint8Array(8),(t=new DataView(r.buffer)).setUint32(0,o<<2|3&s),t.setUint32(4,i),r}return r=new Uint8Array(12),(t=new DataView(r.buffer)).setUint32(0,o),Bn(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:Fn(t,4),nsec:t.getUint32(0)};default:throw new Gn("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},Qn=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Yn)}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>jn){var t=$n(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),Wn(e,this.bytes,this.pos),this.pos+=t}else t=$n(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var o=e.length,r=n,s=0;s>6&31|192;else{if(i>=55296&&i<=56319&&s>12&15|224,t[r++]=i>>6&63|128):(t[r++]=i>>18&7|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128)}t[r++]=63&i|128}else t[r++]=i}}(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=Zn(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=qn(e,t,n),s=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(s,r),r},e}(),oo=function(e,t){var n,o,r,s,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,o=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[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 oo(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,s,i,a;return s=this,void 0,a=function(){var s,i,a,c,l,h,d,u;return oo(this,(function(p){switch(p.label){case 0:s=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=ro(e),p.label=2;case 2:return[4,t.next()];case 3:if((n=p.sent()).done)return[3,5];if(a=n.value,s)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{i=this.doDecodeSync(),s=!0}catch(e){if(!(e instanceof co))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(s){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,i]}throw h=(l=this).headByte,d=l.pos,u=l.totalPos,new RangeError("Insufficient data in parsing ".concat(to(h)," at ").concat(u," (").concat(d," in the current buffer)"))}}))},new((i=void 0)||(i=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 i?r:new i((function(e){e(r)}))).then(n,o)}r((a=a.apply(s,[])).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 s,i=function(){var n,o,r,s,i,a,c,l,h;return oo(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=ro(e),d.label=2;case 2:return[4,so(r.next())];case 3:if((s=d.sent()).done)return[3,12];if(i=s.value,t&&0===o)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i),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,so(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 co))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]),s&&!s.done&&(h=r.return)?[4,so(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 s={},c("next"),c("throw"),c("return"),s[Symbol.asyncIterator]=function(){return this},s;function c(e){i[e]&&(s[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=i[e](t)).value instanceof so?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 Gn("Unrecognized type byte: ".concat(to(e)));o=this.lookU32(),t=this.decodeExtension(o,4)}this.complete();for(var r=this.stack;r.length>0;){var s=r[r.length-1];if(0===s.type){if(s.array[s.position]=t,s.position++,s.position!==s.size)continue e;r.pop(),t=s.array}else{if(1===s.type){if("string"!=(i=typeof t)&&"number"!==i)throw new Gn("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new Gn("The key __proto__ is not allowed");s.key=t,s.type=2;continue e}if(s.map[s.key]=t,s.readCount++,s.readCount!==s.size){s.key=null,s.type=1;continue e}r.pop(),t=s.map}}return t}var i},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 Gn("Unrecognized array type byte: ".concat(to(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new Gn("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 Gn("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 Gn("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthVn?function(e,t,n){var o=e.subarray(t,t+n);return Jn.decode(o)}(this.bytes,r,e):qn(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 Gn("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw lo;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 Gn("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=Fn(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 po{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+i+a))throw new Error("Incomplete message.");t.push(n.slice?n.slice(r+i,r+i+a):n.subarray(r+i,r+i+a)),r=r+i+a}return t}}const fo=new Uint8Array([145,on.Ping]);class go{constructor(e){this.name="messagepack",this.version=2,this.transferFormat=_n.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new eo(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new uo(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=Mt.instance);const o=po.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 on.Invocation:return this._writeInvocation(e);case on.StreamInvocation:return this._writeStreamInvocation(e);case on.StreamItem:return this._writeStreamItem(e);case on.Completion:return this._writeCompletion(e);case on.Ping:return po.write(fo);case on.CancelInvocation:return this._writeCancelInvocation(e);case on.Close:return this._writeClose();case on.Ack:return this._writeAck(e);case on.Sequence:return this._writeSequence(e);default:throw new Error("Invalid message type.")}}_parseMessage(e,t){if(0===e.length)throw new Error("Invalid payload.");const n=this._decoder.decode(e);if(0===n.length||!(n instanceof Array))throw new Error("Invalid payload.");const o=n[0];switch(o){case on.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case on.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case on.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case on.Ping:return this._createPingMessage(n);case on.Close:return this._createCloseMessage(n);case on.Ack:return this._createAckMessage(n);case on.Sequence:return this._createSequenceMessage(n);default:return t.log(Pt.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:on.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:on.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:on.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:on.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:on.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:on.Completion}}_createAckMessage(e){if(e.length<1)throw new Error("Invalid payload for Ack message.");return{sequenceId:e[1],type:on.Ack}}_createSequenceMessage(e){if(e.length<1)throw new Error("Invalid payload for Sequence message.");return{sequenceId:e[1],type:on.Sequence}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([on.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([on.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),po.write(t.slice())}_writeStreamInvocation(e){let t;return t=e.streamIds?this._encoder.encode([on.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([on.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),po.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([on.StreamItem,e.headers||{},e.invocationId,e.item]);return po.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([on.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([on.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([on.Completion,e.headers||{},e.invocationId,t,e.result])}return po.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([on.CancelInvocation,e.headers||{},e.invocationId]);return po.write(t.slice())}_writeClose(){const e=this._encoder.encode([on.Close,null]);return po.write(e.slice())}_writeAck(e){const t=this._encoder.encode([on.Ack,e.sequenceId]);return po.write(t.slice())}_writeSequence(e){const t=this._encoder.encode([on.Sequence,e.sequenceId]);return po.write(t.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}const mo="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,vo=mo?mo.decode.bind(mo):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("")},yo=Math.pow(2,32),wo=Math.pow(2,21)-1;function bo(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function _o(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function Eo(e,t){const n=_o(e,t+4);if(n>wo)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*yo+_o(e,t)}class So{constructor(e){this.batchData=e;const t=new To(e);this.arrayRangeReader=new Do(e),this.arrayBuilderSegmentReader=new Ro(e),this.diffReader=new Co(e),this.editReader=new Io(e,t),this.frameReader=new ko(e,t)}updatedComponents(){return bo(this.batchData,this.batchData.length-20)}referenceFrames(){return bo(this.batchData,this.batchData.length-16)}disposedComponentIds(){return bo(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return bo(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return bo(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return bo(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return Eo(this.batchData,n)}}class Co{constructor(e){this.batchDataUint8=e}componentId(e){return bo(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class Io{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return bo(this.batchDataUint8,e)}siblingIndex(e){return bo(this.batchDataUint8,e+4)}newTreeIndex(e){return bo(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return bo(this.batchDataUint8,e+8)}removedAttributeName(e){const t=bo(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class ko{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return bo(this.batchDataUint8,e)}subtreeLength(e){return bo(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=bo(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return bo(this.batchDataUint8,e+8)}elementName(e){const t=bo(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=bo(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=bo(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=bo(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=bo(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return Eo(this.batchDataUint8,e+12)}}class To{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=bo(e,e.length-4)}readString(e){if(-1===e)return null;{const n=bo(this.batchDataUint8,this.stringTableStartIndex+4*e),o=function(e,t){let n=0,o=0;for(let r=0;r<4;r++){const s=e[t+r];if(n|=(127&s)<this.nextBatchId)return this.fatalError?(this.logger.log(ft.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(ft.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(ft.Debug,`Applying batch ${e}.`),Ce(Nn.Server,new So(t)),await this.completeBatch(n,e)}catch(t){throw this.fatalError=t.toString(),this.logger.log(ft.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(ft.Warning,`Failed to deliver completion notification for render '${t}'.`)}}}let Ao=!1;function No(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),Ao||(Ao=!0,document.querySelectorAll("#blazor-error-ui .reload").forEach((e=>{e.onclick=function(e){location.reload(),e.preventDefault()}})),document.querySelectorAll("#blazor-error-ui .dismiss").forEach((e=>{e.onclick=function(e){const t=document.querySelector("#blazor-error-ui");t&&(t.style.display="none"),e.preventDefault()}})))}class Po{constructor(t,n,o,r){this._firstUpdate=!0,this._renderingFailed=!1,this._disposed=!1,this._circuitId=void 0,this._applicationState=n,this._componentManager=t,this._options=o,this._logger=r,this._renderQueue=new xo(this._logger),this._dispatcher=e.attachDispatcher(this)}start(){if(this.isDisposedOrDisposing())throw new Error("Cannot start a disposed circuit.");return this._startPromise||(this._startPromise=this.startCore()),this._startPromise}updateRootComponents(e){var t,n;return this._firstUpdate?(this._firstUpdate=!1,null===(t=this._connection)||void 0===t?void 0:t.send("UpdateRootComponents",e,this._applicationState)):null===(n=this._connection)||void 0===n?void 0:n.send("UpdateRootComponents",e,"")}async startCore(){if(this._connection=await this.startConnection(),this._connection.state!==rn.Connected)return!1;const e=JSON.stringify(this._componentManager.initialComponents.map((e=>xt(e))));return this._circuitId=await this._connection.invoke("StartCircuit",We.getBaseURI(),We.getLocationHref(),e,this._applicationState||""),!!this._circuitId}async startConnection(){var e,t;const n=new go;n.name="blazorpack";const o=(new An).withUrl("_blazor").withHubProtocol(n);this._options.configureSignalR(o);const r=o.build();r.on("JS.AttachComponent",((e,t)=>Ee(Nn.Server,this.resolveElement(t,e),e,!1))),r.on("JS.BeginInvokeJS",this._dispatcher.beginInvokeJSFromDotNet.bind(this._dispatcher)),r.on("JS.EndInvokeDotNet",this._dispatcher.endInvokeDotNetFromJS.bind(this._dispatcher)),r.on("JS.ReceiveByteArray",this._dispatcher.receiveByteArray.bind(this._dispatcher)),r.on("JS.BeginTransmitStream",(e=>{const t=new ReadableStream({start:t=>{r.stream("SendDotNetStreamToJS",e).subscribe({next:e=>t.enqueue(e),complete:()=>t.close(),error:e=>t.error(e)})}});this._dispatcher.supplyDotNetStream(e,t)})),r.on("JS.RenderBatch",(async(e,t)=>{var n,o;this._logger.log(Pt.Debug,`Received render batch with id ${e} and ${t.byteLength} bytes.`),await this._renderQueue.processBatch(e,t,this._connection),null===(o=(n=this._componentManager).onAfterRenderBatch)||void 0===o||o.call(n,Nn.Server)})),r.on("JS.EndLocationChanging",pt._internal.navigationManager.endLocationChanging),r.onclose((e=>!this._disposed&&!this._renderingFailed&&this._options.reconnectionHandler.onConnectionDown(this._options.reconnectionOptions,e))),r.on("JS.Error",(e=>{this._renderingFailed=!0,this.unhandledError(e),No()}));try{await r.start()}catch(e){if(this.unhandledError(e),"FailedToNegotiateWithServerError"===e.errorType)throw e;No(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===bn.WebSockets))?this._logger.log(Pt.Error,"Unable to connect, please ensure you are using an updated browser that supports WebSockets."):e.innerErrors.some((e=>"FailedToStartTransportError"===e.errorType&&e.transport===bn.WebSockets))?this._logger.log(Pt.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===bn.LongPolling))&&this._logger.log(Pt.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===(t=null===(e=r.connection)||void 0===e?void 0:e.features)||void 0===t?void 0:t.inherentKeepAlive)&&this._logger.log(Pt.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."),r}async disconnect(){var e;await(null===(e=this._connection)||void 0===e?void 0:e.stop())}async reconnect(){if(!this._circuitId)throw new Error("Circuit host not initialized.");return this._connection.state===rn.Connected||(this._connection=await this.startConnection(),!!await this._connection.invoke("ConnectCircuit",this._circuitId)&&(this._options.reconnectionHandler.onConnectionUp(),!0))}beginInvokeDotNetFromJS(e,t,n,o,r){this.throwIfDispatchingWhenDisposed(),this._connection.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,o||0,r)}endInvokeJSFromDotNet(e,t,n){this.throwIfDispatchingWhenDisposed(),this._connection.send("EndInvokeJSFromDotNet",e,t,n)}sendByteArray(e,t){this.throwIfDispatchingWhenDisposed(),this._connection.send("ReceiveByteArray",e,t)}throwIfDispatchingWhenDisposed(){if(this._disposed)throw new Error("The circuit associated with this dispatcher is no longer available.")}sendLocationChanged(e,t,n){return this._connection.send("OnLocationChanged",e,t,n)}sendLocationChanging(e,t,n,o){return this._connection.send("OnLocationChanging",e,t,n,o)}sendJsDataStream(e,t,n){return function(e,t,n,o){setTimeout((async()=>{let r=5,s=(new Date).valueOf();try{const i=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-s;s=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)}(this._connection,e,t,n)}resolveElement(e,t){const n=w(e);if(n)return H(n,!0);const o=Number.parseInt(e);if(!Number.isNaN(o))return $(this._componentManager.resolveRootComponent(o,t));throw new Error(`Invalid sequence number or identifier '${e}'.`)}getRootComponentManager(){return this._componentManager}unhandledError(e){this._logger.log(Pt.Error,e),this.disconnect()}getDisconnectFormData(){const e=new FormData,t=this._circuitId;return e.append("circuitId",t),e}didRenderingFail(){return this._renderingFailed}isDisposedOrDisposing(){return void 0!==this._disposePromise}sendDisconnectBeacon(){if(this._disposed)return;const e=this.getDisconnectFormData();this._disposed=navigator.sendBeacon("_blazor/disconnect",e)}dispose(){return this._disposePromise||(this._disposePromise=this.disposeCore()),this._disposePromise}async disposeCore(){var e;if(!this._startPromise)return void(this._disposed=!0);await this._startPromise,this._disposed=!0,null===(e=this._connection)||void 0===e||e.stop();const t=this.getDisconnectFormData();fetch("_blazor/disconnect",{method:"POST",body:t}),function(e){if(!S.delete(e))throw new Error(`Interop methods are not registered for renderer ${e}`)}(Nn.Server)}}const Mo={configureSignalR:e=>{},logLevel:ft.Warning,reconnectionOptions:{maxRetries:8,retryIntervalMilliseconds:2e4,dialogId:"components-reconnect-modal"}};class Uo{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 pt.reconnect()||this.rejected()}catch(e){this.logger.log(ft.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 Lo{constructor(e,t,n){this.dialog=e,this.maxRetries=t,this.document=n,this.document=n;const o=this.document.getElementById(Lo.MaxRetriesId);o&&(o.innerText=this.maxRetries.toString())}show(){this.removeClasses(),this.dialog.classList.add(Lo.ShowClassName)}update(e){const t=this.document.getElementById(Lo.CurrentAttemptId);t&&(t.innerText=e.toString())}hide(){this.removeClasses(),this.dialog.classList.add(Lo.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(Lo.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(Lo.RejectedClassName)}removeClasses(){this.dialog.classList.remove(Lo.ShowClassName,Lo.HideClassName,Lo.FailedClassName,Lo.RejectedClassName)}}Lo.ShowClassName="components-reconnect-show",Lo.HideClassName="components-reconnect-hide",Lo.FailedClassName="components-reconnect-failed",Lo.RejectedClassName="components-reconnect-rejected",Lo.MaxRetriesId="components-reconnect-max-retries",Lo.CurrentAttemptId="components-reconnect-current-attempt";class Bo{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||pt.reconnect}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new Lo(t,e.maxRetries,document):new Uo(e.dialogId,e.maxRetries,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new Fo(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class Fo{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;tFo.MaximumFirstRetryInterval?Fo.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(ft.Error,e)}}this.reconnectDisplay.failed()}delay(e){return new Promise((t=>setTimeout(t,e)))}}Fo.MaximumFirstRetryInterval=3e3;class Oo{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:s,afterStarted:i}=r;return i&&e.afterStartedCallbacks.push(i),s?s(...t):void 0}(this,e))))}async invokeAfterStartedCallbacks(e){await k,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let $o,Ho,jo,Wo,qo,zo=!1;function Jo(e){if(jo)throw new Error("Circuit options have already been configured.");jo=function(e){const t={...Mo,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...Mo.reconnectionOptions,...e.reconnectionOptions}),t}(e)}function Vo(e){return Ho.updateRootComponents(e)}function Ko(e){return qo=e,qo}var Xo,Go;const Yo=navigator,Qo=Yo.userAgentData&&Yo.userAgentData.brands,Zo=Qo&&Qo.length>0?Qo.some((e=>"Google Chrome"===e.brand||"Microsoft Edge"===e.brand||"Chromium"===e.brand)):window.chrome,er=null!==(Go=null===(Xo=Yo.userAgentData)||void 0===Xo?void 0:Xo.platform)&&void 0!==Go?Go:navigator.platform;function tr(e){return 0!==e.debugLevel&&(Zo||navigator.userAgent.includes("Firefox"))}let nr,or,rr,sr,ir,ar;const cr=Math.pow(2,32),lr=Math.pow(2,21)-1;let hr=null;function dr(e){return or.getI32(e)}const ur={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,s;n.environmentVariables||(n.environmentVariables={}),"sharded"===n.globalizationMode&&(n.environmentVariables.__BLAZOR_SHARDED_ICU="1"),pt._internal.getApplicationEnvironment=()=>n.applicationEnvironment,null==t||t(n);const i=[e,null!==(s=null===(r=n.resources)||void 0===r?void 0:r.extensions)&&void 0!==s?s:{}];await o("beforeStart",i)},onDownloadResourceProgress:pr,config:n,disableDotnet6Compatibility:!1,out:gr,err:mr};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),ar=await n.create()}(e,t)},start:function(){return async function(){if(!ar)throw new Error("The runtime must be loaded it gets configured.");const{MONO:t,BINDING:n,Module:o,setModuleImports:r,INTERNAL:s,getConfig:i,invokeLibraryInitializers:a}=ar;rr=o,nr=n,or=t,ir=s,function(e){const t=er.match(/^Mac/i)?"Cmd":"Alt";tr(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&&(tr(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())}():Zo?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."))}))}(i()),pt.runtime=ar,pt._internal.dotNetCriticalError=mr,r("blazor-internal",{Blazor:{_internal:pt._internal}});const c=await ar.getAssemblyExports("Microsoft.AspNetCore.Components.WebAssembly");return Object.assign(pt._internal,{dotNetExports:{...c.Microsoft.AspNetCore.Components.WebAssembly.Services.DefaultWebAssemblyJSRuntime}}),sr=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,o,r)=>{if(yr(),!o&&!t)throw new Error("Either assemblyName or dotNetObjectId must have a non null value.");const s=o?o.toString():t;pt._internal.dotNetExports.BeginInvokeDotNet(e?e.toString():null,s,n,r)},endInvokeJSFromDotNet:(e,t,n)=>{pt._internal.dotNetExports.EndInvokeJS(n)},sendByteArray:(e,t)=>{pt._internal.dotNetExports.ReceiveByteArrayFromJS(e,t)},invokeDotNetFromJS:(e,t,n,o)=>(yr(),pt._internal.dotNetExports.InvokeDotNet(e||null,t,null!=n?n:0,o))}),{invokeLibraryInitializers:a}}()},callEntryPoint:async function(){try{await ar.runMain(ar.getConfig().mainAssemblyName,[])}catch(e){console.error(e),No()}},toUint8Array:function(e){const t=vr(e),n=dr(t),o=new Uint8Array(n);return o.set(rr.HEAPU8.subarray(t+4,t+4+n)),o},getArrayLength:function(e){return dr(vr(e))},getArrayEntryPtr:function(e,t,n){return vr(e)+4+t*n},getObjectFieldsBaseAddress:function(e){return e+8},readInt16Field:function(e,t){return n=e+(t||0),or.getI16(n);var n},readInt32Field:function(e,t){return dr(e+(t||0))},readUint64Field:function(e,t){return function(e){const t=e>>2,n=rr.HEAPU32[t+1];if(n>lr)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*cr+rr.HEAPU32[t]}(e+(t||0))},readFloatField:function(e,t){return n=e+(t||0),or.getF32(n);var n},readObjectField:function(e,t){return dr(e+(t||0))},readStringField:function(e,t,n){const o=dr(e+(t||0));if(0===o)return null;if(n){const e=nr.unbox_mono_obj(o);return"boolean"==typeof e?e?"":null:e}return nr.conv_string(o)},readStructField:function(e,t){return e+(t||0)},beginHeapLock:function(){return yr(),hr=wr.create(),hr},invokeWhenHeapUnlocked:function(e){hr?hr.enqueuePostReleaseAction(e):e()}};function pr(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 fr=["DEBUGGING ENABLED"],gr=e=>fr.indexOf(e)<0&&console.log(e),mr=e=>{console.error(e||"(null)"),No()};function vr(e){return e+12}function yr(){if(hr)throw new Error("Assertion failed - heap is currently locked")}class wr{enqueuePostReleaseAction(e){this.postReleaseActions||(this.postReleaseActions=[]),this.postReleaseActions.push(e)}release(){var e;if(hr!==this)throw new Error("Trying to release a lock which isn't current");for(ir.mono_wasm_gc_unlock(),hr=null;null===(e=this.postReleaseActions)||void 0===e?void 0:e.length;)this.postReleaseActions.shift()(),yr()}static create(){return ir.mono_wasm_gc_lock(),new wr}}class br{constructor(e){this.batchAddress=e,this.arrayRangeReader=_r,this.arrayBuilderSegmentReader=Er,this.diffReader=Sr,this.editReader=Cr,this.frameReader=Ir}updatedComponents(){return qo.readStructField(this.batchAddress,0)}referenceFrames(){return qo.readStructField(this.batchAddress,_r.structLength)}disposedComponentIds(){return qo.readStructField(this.batchAddress,2*_r.structLength)}disposedEventHandlerIds(){return qo.readStructField(this.batchAddress,3*_r.structLength)}updatedComponentsEntry(e,t){return kr(e,t,Sr.structLength)}referenceFramesEntry(e,t){return kr(e,t,Ir.structLength)}disposedComponentIdsEntry(e,t){const n=kr(e,t,4);return qo.readInt32Field(n)}disposedEventHandlerIdsEntry(e,t){const n=kr(e,t,8);return qo.readUint64Field(n)}}const _r={structLength:8,values:e=>qo.readObjectField(e,0),count:e=>qo.readInt32Field(e,4)},Er={structLength:12,values:e=>{const t=qo.readObjectField(e,0),n=qo.getObjectFieldsBaseAddress(t);return qo.readObjectField(n,0)},offset:e=>qo.readInt32Field(e,4),count:e=>qo.readInt32Field(e,8)},Sr={structLength:4+Er.structLength,componentId:e=>qo.readInt32Field(e,0),edits:e=>qo.readStructField(e,4),editsEntry:(e,t)=>kr(e,t,Cr.structLength)},Cr={structLength:20,editType:e=>qo.readInt32Field(e,0),siblingIndex:e=>qo.readInt32Field(e,4),newTreeIndex:e=>qo.readInt32Field(e,8),moveToSiblingIndex:e=>qo.readInt32Field(e,8),removedAttributeName:e=>qo.readStringField(e,16)},Ir={structLength:36,frameType:e=>qo.readInt16Field(e,4),subtreeLength:e=>qo.readInt32Field(e,8),elementReferenceCaptureId:e=>qo.readStringField(e,16),componentId:e=>qo.readInt32Field(e,12),elementName:e=>qo.readStringField(e,16),textContent:e=>qo.readStringField(e,16),markupContent:e=>qo.readStringField(e,16),attributeName:e=>qo.readStringField(e,16),attributeValue:e=>qo.readStringField(e,24,!0),attributeEventHandlerId:e=>qo.readUint64Field(e,8)};function kr(e,t,n){return qo.getArrayEntryPtr(e,t,n)}class Tr{constructor(e){this.componentManager=e}resolveRegisteredElement(e,t){const n=Number.parseInt(e);if(!Number.isNaN(n))return $(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 Dr,Rr,xr,Ar=!1,Nr=!1,Pr=!0,Mr=!1;const Ur=new Promise((e=>{xr=e}));let Lr;const Br=new Promise((e=>{Lr=e}));function Fr(){return null!=Rr||(Rr=(async()=>{const e=null!=Dr?Dr:{},t=null==Dr?void 0:Dr.configureRuntime;e.configureRuntime=e=>{null==t||t(e),Mr&&e.withEnvironmentVariable("__BLAZOR_WEBASSEMBLY_WAIT_FOR_ROOT_COMPONENTS","true")},await ur.load(e,xr),Ar=!0})()),Rr}function Or(){return Ar}function $r(t,n,o,r){const s=ur.readStringField(t,0),i=ur.readInt32Field(t,4),a=ur.readStringField(t,8),c=ur.readUint64Field(t,20);if(null!==a){const e=ur.readUint64Field(t,12);if(0!==e)return sr.beginInvokeJSFromDotNet(e,s,a,i,c),0;{const e=sr.invokeJSFromDotNet(s,a,i,c);return null===e?0:nr.js_string_to_mono_string(e)}}{const t=e.findJSFunction(s,c).call(null,n,o,r);switch(i){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 nr.js_string_to_mono_string(o)}case e.JSCallResultType.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${i}'.`)}}}function Hr(e,t,n,o,r){return 0!==r?(sr.beginInvokeJSFromDotNet(r,e,o,n,t),null):sr.invokeJSFromDotNet(e,o,n,t)}function jr(e,t,n){sr.endInvokeDotNetFromJS(e,t,n)}function Wr(e,t,n,o){!function(e,t,n,o,r){let s=ut.get(t);if(!s){const n=new ReadableStream({start(e){ut.set(t,e),s=e}});e.supplyDotNetStream(t,n)}r?(s.error(r),ut.delete(t)):0===o?(s.close(),ut.delete(t)):s.enqueue(n.length===o?n:n.subarray(0,o))}(sr,e,t,n,o)}function qr(e,t){sr.receiveByteArray(e,t)}function zr(e,t){t.namespaceURI?e.setAttributeNS(t.namespaceURI,t.name,t.value):e.setAttribute(t.name,t.value)}const Jr="data-permanent";var Vr,Kr;!function(e){e[e.None=0]="None",e[e.Some=1]="Some",e[e.Infinite=2]="Infinite"}(Vr||(Vr={})),function(e){e.Keep="keep",e.Update="update",e.Insert="insert",e.Delete="delete"}(Kr||(Kr={}));class Xr{static create(e,t,n){return 0===t&&n===e.length?e:new Xr(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&&i>=o&&r(e.item(s),t.item(i))===Vr.None;)s--,i--,a++;return a}(e,t,o,o,n),s=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?Kr.Insert:0===r?Kr.Delete:e[o][r];switch(n.unshift(t),t){case Kr.Keep:case Kr.Update:o--,r--;break;case Kr.Insert:r--;break;case Kr.Delete:o--}}return n}(function(e,t,n){const o=[],r=[],s=e.length,i=t.length;if(0===s&&0===i)return[];for(let e=0;e<=s;e++)(o[e]=Array(i+1))[0]=e,r[e]=Array(i+1);const a=o[0];for(let e=1;e<=i;e++)a[e]=e;for(let a=1;a<=s;a++)for(let s=1;s<=i;s++){const i=n(e.item(a-1),t.item(s-1)),c=o[a-1][s]+1,l=o[a][s-1]+1;let h;switch(i){case Vr.None:h=o[a-1][s-1];break;case Vr.Some:h=o[a-1][s-1]+1;break;case Vr.Infinite:h=Number.MAX_VALUE}h{history.pushState(null,"",e),ms(e)}))}function fs(e){Me()||ms(location.href)}function gs(e){if(Me()||e.defaultPrevented)return;const t=e.target;if(t instanceof HTMLFormElement){if(!function(e){const t=e.getAttribute("data-enhance");return"string"==typeof t&&""===t||"true"===(null==t?void 0:t.toLowerCase())}(t))return;e.preventDefault();const n=new URL(t.action),o={method:t.method},r=new FormData(t),s=e.submitter;s&&s.name&&r.append(s.name,s.value),"get"===o.method?n.search=new URLSearchParams(r).toString():o.body=r,ms(n.toString(),o)}}async function ms(e,t){Qr=!0,null==Gr||Gr.abort(),Gr=new AbortController;const n=Gr.signal,o=fetch(e,Object.assign({signal:n,mode:"no-cors",headers:{accept:"text/html;blazor-enhanced-nav=on"}},t));if(await async function(e,t,n,o){let r;try{if(r=await e,!r.body)return void n(r,"");const t=r.headers.get("ssr-framing");if(!t){const e=await r.text();return void n(r,e)}let o=!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!--${t}--\x3e`)).pipeTo(new WritableStream({write(e){o?(o=!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)=>{const r=!(null==t?void 0:t.method)||"get"===t.method,s=n.status>=200&&n.status<300;if("opaque"===n.type){if(r)return void ys(e);throw new Error("Enhanced navigation does not support making a non-GET request to an endpoint that redirects to an external origin. Avoid enabling enhanced navigation for form posts that may perform external redirections.")}if(s&&"allow"!==n.headers.get("blazor-enhanced-nav")){if(r)return void ys(e);throw new Error("Enhanced navigation does not support making a non-GET request to a non-Blazor endpoint. Avoid enabling enhanced navigation for forms that post to a non-Blazor endpoint.")}n.redirected&&(r?history.replaceState(null,"",n.url):history.pushState(null,"",n.url),e=n.url);const i=n.headers.get("blazor-enhanced-nav-redirect-location");if(i)return void location.replace(i);const a=n.headers.get("content-type");if((null==a?void 0:a.startsWith("text/html"))&&o){const e=(new DOMParser).parseFromString(o,"text/html");es(document,e),Yr.documentUpdated()}else(null==a?void 0:a.startsWith("text/"))&&o?vs(o):s||o?r?ys(e):vs(`Error: ${t.method} request to ${e} returned non-HTML content of type ${a||"unspecified"}.`):vs(`Error: ${n.status} ${n.statusText}`)})),!n.aborted){const t=e.indexOf("#");if(t>=0){const n=e.substring(t+1),o=document.getElementById(n);null==o||o.scrollIntoView()}Qr=!1,Yr.enhancedNavigationCompleted()}}function vs(e){document.documentElement.textContent=e;const t=document.documentElement.style;t.fontFamily="consolas, monospace",t.whiteSpace="pre-wrap",t.padding="1rem"}function ys(e){history.replaceState(null,"",e+"?"),location.replace(e)}let ws,bs=!0;class _s extends HTMLElement{connectedCallback(){var e;const t=this.parentNode;null===(e=t.parentNode)||void 0===e||e.removeChild(t),t.childNodes.forEach((e=>{if(e instanceof HTMLTemplateElement){const t=e.getAttribute("blazor-component-id");if(t)"true"!==e.getAttribute("enhanced-nav")&&Gr||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 s=null;for(;(s=n.nextNode())&&s.textContent!==r;);return s?{startMarker:o,endMarker:s}:null}(e);if(n){const{startMarker:e,endMarker:o}=n;if(bs)es({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)}ws.documentUpdated()}}(t,e.content);else switch(e.getAttribute("type")){case"redirection":const t=Ne(e.content.textContent),n="form-post"===e.getAttribute("from");"true"===e.getAttribute("enhanced")&&Re(t)?(n?history.pushState(null,"",t):history.replaceState(null,"",t),ms(t)):n?location.assign(t):location.replace(t);break;case"error":vs(e.content.textContent||"Error")}}}))}}class Es{constructor(e){var t;this._circuitInactivityTimeoutMs=e,this._rootComponents=new Set,this._descriptors=new Set,this._pendingComponentsToResolve=new Map,this._didWebAssemblyFailToLoadQuickly=!1,this._isComponentRefreshPending=!1,this.initialComponents=[],t=()=>{this.rootComponentsMayRequireRefresh()},C.push(t)}onAfterRenderBatch(e){e===Nn.Server&&this.circuitMayHaveNoRootComponents()}onDocumentUpdated(){this.rootComponentsMayRequireRefresh()}onEnhancedNavigationCompleted(){this.rootComponentsMayRequireRefresh()}registerComponent(e){this._descriptors.has(e)||("auto"!==e.type&&"webassembly"!==e.type||this.startLoadingWebAssemblyIfNotStarted(),this._descriptors.add(e),this._rootComponents.add({descriptor:e}))}unregisterComponent(e){this._descriptors.delete(e.descriptor),this._rootComponents.delete(e)}async startLoadingWebAssemblyIfNotStarted(){if(void 0!==Rr)return;Mr=!0;const e=Fr();setTimeout((()=>{Or()||this.onWebAssemblyFailedToLoadQuickly()}),pt._internal.loadWebAssemblyQuicklyTimeout);const t=await Ur;(function(e){if(!e.cacheBootResources)return!1;const t=Ss(e);if(!t)return!1;const n=window.localStorage.getItem(t.key);return t.value===n})(t)||this.onWebAssemblyFailedToLoadQuickly(),await e,function(e){const t=Ss(e);t&&window.localStorage.setItem(t.key,t.value)}(t),this.rootComponentsMayRequireRefresh()}onWebAssemblyFailedToLoadQuickly(){this._didWebAssemblyFailToLoadQuickly||(this._didWebAssemblyFailToLoadQuickly=!0,this.rootComponentsMayRequireRefresh())}startCircutIfNotStarted(){return zo?Ho.isDisposedOrDisposing()?function(){if(!zo)throw new Error("Cannot start the circuit until Blazor Server has started.");return Ho.didRenderingFail()?Promise.resolve(!1):(Ho.isDisposedOrDisposing()&&($o=bt(document)||"",Ho=new Po(Ho.getRootComponentManager(),$o,jo,Wo)),Ho.start())}():void 0:async function(e){if(zo)throw new Error("Blazor Server has already started.");zo=!0,$o=bt(document)||"",Wo=new mt(jo.logLevel),Ho=new Po(e,$o,jo,Wo),Wo.log(ft.Information,"Starting up Blazor server-side application."),pt.reconnect=async()=>!(Ho.didRenderingFail()||!await Ho.reconnect()&&(Wo.log(ft.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)),pt.defaultReconnectionHandler=new Bo(Wo),jo.reconnectionHandler=jo.reconnectionHandler||pt.defaultReconnectionHandler,pt._internal.navigationManager.listenForNavigationEvents(((e,t,n)=>Ho.sendLocationChanged(e,t,n)),((e,t,n,o)=>Ho.sendLocationChanging(e,t,n,o))),pt._internal.forceCloseConnection=()=>Ho.disconnect(),pt._internal.sendJSDataStream=(e,t,n)=>Ho.sendJsDataStream(e,t,n);const t=await async function(e){const t=await fetch("_blazor/initializers",{method:"GET",credentials:"include",cache:"no-cache"}),n=await t.json(),o=new Oo;return await o.importInitializersAsync(n,[e]),o}(jo);if(!await Ho.start())return void Wo.log(ft.Error,"Failed to start the circuit.");const n=()=>{Ho.sendDisconnectBeacon()};pt.disconnect=n,window.addEventListener("unload",n,{capture:!1,once:!0}),Wo.log(ft.Information,"Blazor server-side application started."),t.invokeAfterStartedCallbacks(pt)}(this)}async startWebAssemblyIfNotStarted(){this.startLoadingWebAssemblyIfNotStarted(),Nr||await async function(e){if(Nr)throw new Error("Blazor WebAssembly has already started.");Nr=!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=Fr();!function(e){const t=R;R=(e,n,o)=>{((e,t,n)=>{const o=Se(e);(null==o?void 0:o.eventDelegator.getHandler(t))&&ur.invokeWhenHeapUnlocked(n)})(e,n,(()=>t(e,n,o)))}}(),pt._internal.applyHotReload=(e,t,n,o)=>{sr.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","ApplyHotReloadDelta",e,t,n,o)},pt._internal.getApplyUpdateCapabilities=()=>sr.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","GetApplyUpdateCapabilities"),pt._internal.invokeJSFromDotNet=$r,pt._internal.invokeJSJson=Hr,pt._internal.endInvokeDotNetFromJS=jr,pt._internal.receiveWebAssemblyDotNetDataStream=Wr,pt._internal.receiveByteArray=qr;const n=Ko(ur);pt.platform=n,pt._internal.renderBatch=(e,t)=>{const n=ur.beginHeapLock();try{Ce(e,new br(t))}finally{n.release()}},pt._internal.navigationManager.listenForNavigationEvents((async(e,t,n)=>{await sr.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChanged",e,t,n)}),(async(e,t,n,o)=>{const r=await sr.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChangingAsync",t,n,o);pt._internal.navigationManager.endLocationChanging(e,r)}));const o=new Tr(e);let r;pt._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)||""},pt._internal.getPersistedState=()=>_t(document,wt)||"",pt._internal.getInitialComponentsUpdate=()=>Br,pt._internal.updateRootComponents=e=>{var t;return null===(t=pt._internal.dotNetExports)||void 0===t?void 0:t.UpdateRootComponentsCore(e)},pt._internal.attachRootComponentToElement=(e,t,n)=>{const r=o.resolveRegisteredElement(e,t);r?Ee(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 s=w(e)||document.querySelector(e);if(!s)throw new Error(`Could not find any element matching selector '${e}'.`);Ee(n||0,H(s,!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",[pt])}(this)}rootComponentsMayRequireRefresh(){this._isComponentRefreshPending||(this._isComponentRefreshPending=!0,setTimeout((()=>{this._isComponentRefreshPending=!1,this.refreshRootComponents(this._rootComponents)}),0))}circuitMayHaveNoRootComponents(){if(this.rendererHasExistingOrPendingComponents(Nn.Server,"server","auto"))return clearTimeout(this._circuitInactivityTimeoutId),void(this._circuitInactivityTimeoutId=void 0);void 0===this._circuitInactivityTimeoutId&&(this._circuitInactivityTimeoutId=setTimeout((()=>{this.rendererHasExistingOrPendingComponents(Nn.Server,"server","auto")||(async function(){await(null==Ho?void 0:Ho.dispose())}(),this._circuitInactivityTimeoutId=void 0)}),this._circuitInactivityTimeoutMs))}rendererHasComponents(e){const t=Se(e);return void 0!==t&&t.getRootComponentCount()>0}rendererHasExistingOrPendingComponents(e,...t){if(this.rendererHasComponents(e))return!0;for(const{descriptor:{type:n},assignedRendererId:o}of this._rootComponents){if(o===e)return!0;if(void 0===o&&-1!==t.indexOf(n))return!0}return!1}refreshRootComponents(e){const t=new Map;for(const n of e){const e=this.determinePendingOperation(n);if(!e)continue;const o=n.assignedRendererId;if(!o)throw new Error("Descriptors must be assigned a renderer ID before getting used as root components");let r=t.get(o);r||(r=[],t.set(o,r)),r.push(e)}for(const[e,n]of t){const t=JSON.stringify(n);e===Nn.Server?Vo(t):this.updateWebAssemblyRootComponents(t)}this.circuitMayHaveNoRootComponents()}updateWebAssemblyRootComponents(e){Pr?(Lr(e),Pr=!1):function(e){if(!Nr)throw new Error("Blazor WebAssembly has not started.");if(!pt._internal.updateRootComponents)throw new Error("Blazor WebAssembly has not initialized.");pt._internal.updateRootComponents(e)}(e)}resolveRendererIdForDescriptor(e){switch("auto"===e.type?this.getAutoRenderMode():e.type){case"server":return this.startCircutIfNotStarted(),Nn.Server;case"webassembly":return this.startWebAssemblyIfNotStarted(),Nn.WebAssembly;case null:return null}}getAutoRenderMode(){return this.rendererHasExistingOrPendingComponents(Nn.WebAssembly,"webassembly")?"webassembly":this.rendererHasExistingOrPendingComponents(Nn.Server,"server")?"server":Or()?"webassembly":this._didWebAssemblyFailToLoadQuickly?"server":null}determinePendingOperation(e){if(n=e.descriptor,document.contains(n.start)){if(void 0===e.assignedRendererId){if(Qr||"loading"===document.readyState)return null;const n=this.resolveRendererIdForDescriptor(e.descriptor);return null===n?null:(t=n,S.has(t)?(e.assignedRendererId=n,e.uniqueIdAtLastUpdate=e.descriptor.uniqueId,this._pendingComponentsToResolve.set(e.descriptor.uniqueId,e),{type:"add",selectorId:e.descriptor.uniqueId,marker:xt(e.descriptor)}):null)}if(e.uniqueIdAtLastUpdate===e.descriptor.uniqueId)return null;if(void 0!==e.interactiveComponentId)return e.uniqueIdAtLastUpdate=e.descriptor.uniqueId,{type:"update",componentId:e.interactiveComponentId,marker:xt(e.descriptor)}}else{if(this.unregisterComponent(e),void 0!==e.assignedRendererId&&void 0!==e.interactiveComponentId){const t=Se(e.assignedRendererId);null==t||t.disposeComponent(e.interactiveComponentId)}if(void 0!==e.interactiveComponentId)return{type:"remove",componentId:e.interactiveComponentId}}var t,n;return null}resolveRootComponent(e,t){const n=this._pendingComponentsToResolve.get(e);if(!n)throw new Error(`Could not resolve a root component for descriptor with ID '${e}'.`);if(this._pendingComponentsToResolve.delete(e),void 0!==n.interactiveComponentId)throw new Error("Cannot resolve a root component for the same descriptor multiple times.");return n.interactiveComponentId=t,this.refreshRootComponents([n]),n.descriptor}}function Ss(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}class Cs{constructor(){this._eventListeners=new Map}static create(e){const t=new Cs;return e.addEventListener=t.addEventListener.bind(t),e.removeEventListener=t.removeEventListener.bind(t),t}addEventListener(e,t){let n=this._eventListeners.get(e);n||(n=new Set,this._eventListeners.set(e,n)),n.add(t)}removeEventListener(e,t){var n;null===(n=this._eventListeners.get(e))||void 0===n||n.delete(t)}dispatchEvent(e,t){const n=this._eventListeners.get(e);if(!n)return;const o={...t,type:e};for(const e of n)e(o)}}let Is,ks=!1;function Ts(e){var t,n,o;if(ks)throw new Error("Blazor has already started.");ks=!0,pt._internal.loadWebAssemblyQuicklyTimeout=3e3,pt._internal.hotReloadApplied=()=>{xe()&&Ae(location.href,!0)},Jo(null==e?void 0:e.circuit),function(e){if(Dr)throw new Error("WebAssembly options have already been configured.");Dr=e}(null==e?void 0:e.webAssembly),Is=new Es(null!==(n=null===(t=null==e?void 0:e.ssr)||void 0===t?void 0:t.circuitInactivityTimeoutMs)&&void 0!==n?n:2e3);const r=Cs.create(pt),s={documentUpdated:()=>{Is.onDocumentUpdated(),r.dispatchEvent("enhancedload",{})},enhancedNavigationCompleted(){Is.onEnhancedNavigationCompleted()}};return Zr=Is,function(e,t){ws=t,(null==e?void 0:e.disableDomPreservation)&&(bs=!1),customElements.define("blazor-ssr-end",_s)}(null==e?void 0:e.ssr,s),(null===(o=null==e?void 0:e.ssr)||void 0===o?void 0:o.disableDomPreservation)||ds(s),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",Ds):Ds(),Promise.resolve()}function Ds(){!function(e){const t=is(document);for(const e of t)null==Zr||Zr.registerComponent(e)}(),Is.onDocumentUpdated()}pt.start=Ts,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&Ts()})()})(); \ No newline at end of file diff --git a/src/Components/Web.JS/src/Services/WebRootComponentManager.ts b/src/Components/Web.JS/src/Services/WebRootComponentManager.ts index f88171fb9696..3fcb091fed72 100644 --- a/src/Components/Web.JS/src/Services/WebRootComponentManager.ts +++ b/src/Components/Web.JS/src/Services/WebRootComponentManager.ts @@ -37,7 +37,7 @@ type RootComponentInfo = { assignedRendererId?: WebRendererId; uniqueIdAtLastUpdate?: number; interactiveComponentId?: number; -} +}; export class WebRootComponentManager implements DescriptorHandler, RootComponentManager { private readonly _rootComponents = new Set(); @@ -193,7 +193,7 @@ export class WebRootComponentManager implements DescriptorHandler, RootComponent } private circuitMayHaveNoRootComponents() { - const isCircuitInUse = this.hasAnyExistingOrPendingServerComponents(); + const isCircuitInUse = this.rendererHasExistingOrPendingComponents(WebRendererId.Server, 'server', 'auto'); if (isCircuitInUse) { // Clear the timeout because we know the circuit is in use. clearTimeout(this._circuitInactivityTimeoutId); @@ -208,31 +208,38 @@ export class WebRootComponentManager implements DescriptorHandler, RootComponent // Start a new timeout to dispose the circuit unless it starts getting used. this._circuitInactivityTimeoutId = setTimeout(() => { - if (!this.hasAnyExistingOrPendingServerComponents()) { + if (!this.rendererHasExistingOrPendingComponents(WebRendererId.Server, 'server', 'auto')) { disposeCircuit(); this._circuitInactivityTimeoutId = undefined; } }, this._circuitInactivityTimeoutMs) as unknown as number; } - private hasAnyExistingOrPendingServerComponents(): boolean { - // If there are active Blazor Server components on the page, we shouldn't dispose the circuit. - const renderer = getRendererer(WebRendererId.Server); - if (renderer && renderer.getRootComponentCount() > 0) { + private rendererHasComponents(rendererId: WebRendererId): boolean { + const renderer = getRendererer(rendererId); + return renderer !== undefined && renderer.getRootComponentCount() > 0; + } + + private rendererHasExistingOrPendingComponents(rendererId: WebRendererId, ...descriptorTypesToConsider: ComponentMarker['type'][]): boolean { + if (this.rendererHasComponents(rendererId)) { return true; } - // If we have SSR components that may become Blazor Server components in the future, - // we shouldn't dispose the circuit. + // We consider SSR'd components on the page that may get activated using the specified renderer. for (const { descriptor: { type }, assignedRendererId } of this._rootComponents) { - if (assignedRendererId === WebRendererId.Server) { - // The component has been assigned to use Blazor Server. + if (assignedRendererId === rendererId) { + // The component has been assigned to use the specified renderer. return true; } - if (assignedRendererId === undefined && (type === 'auto' || type === 'server')) { - // The component has not been assigned a renderer yet, so it's possible it might - // use Blazor Server. + if (assignedRendererId !== undefined) { + // The component has been assigned to use another renderer. + continue; + } + + if (descriptorTypesToConsider.indexOf(type) !== -1) { + // The component has not been assigned a renderer yet, but it might get activated with the specified renderer + // if it doesn't get removed from the page. return true; } } @@ -298,9 +305,20 @@ export class WebRootComponentManager implements DescriptorHandler, RootComponent } private getAutoRenderMode(): 'webassembly' | 'server' | null { - // If the WebAssembly runtime has loaded, we will always use WebAssembly - // for auto components. Otherwise, we'll wait to activate root components - // until we determine whether the WebAssembly runtime can be loaded quickly. + // If WebAssembly components exist or may exist soon, use WebAssembly. + if (this.rendererHasExistingOrPendingComponents(WebRendererId.WebAssembly, 'webassembly')) { + return 'webassembly'; + } + + // If Server components exist or may exist soon, use WebAssembly. + if (this.rendererHasExistingOrPendingComponents(WebRendererId.Server, 'server')) { + return 'server'; + } + + // If no interactive components are on the page, we use WebAssembly + // if the WebAssembly runtime has loaded. Otherwise, we'll wait to activate + // root components until we determine whether the WebAssembly runtime can be + // loaded quickly. if (hasLoadedWebAssemblyPlatform()) { return 'webassembly'; } diff --git a/src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs b/src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs index 9feacd3989a4..2938a261be87 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs @@ -720,6 +720,84 @@ public void AutoRenderMode_CanUseBlazorWebAssembly_WhenMultipleAutoComponentsAre Browser.Equal("WebAssembly", () => Browser.FindElement(By.Id("render-mode-2")).Text); } + [Fact] + public void AutoRenderMode_UsesBlazorWebAssembly_WhenBothServerAndWebAssemblyComponentsExist() + { + Navigate($"{ServerPathBase}/streaming-interactivity"); + Browser.Equal("Not streaming", () => Browser.FindElement(By.Id("status")).Text); + + Browser.Click(By.Id(AddWebAssemblyPrerenderedId)); + Browser.Equal("True", () => Browser.FindElement(By.Id("is-interactive-0")).Text); + Browser.Equal("WebAssembly", () => Browser.FindElement(By.Id("render-mode-0")).Text); + + Browser.Click(By.Id(AddServerPrerenderedId)); + Browser.Equal("True", () => Browser.FindElement(By.Id("is-interactive-1")).Text); + Browser.Equal("Server", () => Browser.FindElement(By.Id("render-mode-1")).Text); + + Browser.Click(By.Id(AddAutoPrerenderedId)); + Browser.Equal("True", () => Browser.FindElement(By.Id("is-interactive-2")).Text); + Browser.Equal("WebAssembly", () => Browser.FindElement(By.Id("render-mode-2")).Text); + } + + [Fact] + public void AutoRenderMode_UsesBlazorServer_WhenOnlyServerComponentsExist_EvenAfterWebAssemblyResourcesLoad() + { + Navigate(ServerPathBase); + Browser.Equal("Hello", () => Browser.Exists(By.TagName("h1")).Text); + ForceWebAssemblyResourceCacheMiss(); + + Navigate($"{ServerPathBase}/streaming-interactivity"); + Browser.Equal("Not streaming", () => Browser.FindElement(By.Id("status")).Text); + + // We start by adding a WebAssembly component to ensure the WebAssembly runtime + // will be cached after we refresh the page. + Browser.Click(By.Id(AddWebAssemblyPrerenderedId)); + Browser.Equal("True", () => Browser.FindElement(By.Id("is-interactive-0")).Text); + Browser.Equal("WebAssembly", () => Browser.FindElement(By.Id("render-mode-0")).Text); + + Browser.Click(By.Id($"remove-counter-link-0")); + Browser.DoesNotExist(By.Id("is-interactive-0")); + + Browser.Navigate().Refresh(); + + Browser.Click(By.Id(AddServerPrerenderedId)); + Browser.Equal("True", () => Browser.FindElement(By.Id("is-interactive-1")).Text); + Browser.Equal("Server", () => Browser.FindElement(By.Id("render-mode-1")).Text); + + // Verify that Auto mode will use Blazor Server, even though the WebAssembly runtime is cached + Browser.Click(By.Id(AddAutoPrerenderedId)); + Browser.Equal("True", () => Browser.FindElement(By.Id("is-interactive-2")).Text); + Browser.Equal("Server", () => Browser.FindElement(By.Id("render-mode-2")).Text); + } + + [Fact] + public void AutoRenderMode_UsesBlazorServer_AfterWebAssemblyComponentsNoLongerExist_ButServerComponentsDo() + { + Navigate($"{ServerPathBase}/streaming-interactivity"); + Browser.Equal("Not streaming", () => Browser.FindElement(By.Id("status")).Text); + + Browser.Click(By.Id(AddWebAssemblyPrerenderedId)); + Browser.Equal("True", () => Browser.FindElement(By.Id("is-interactive-0")).Text); + Browser.Equal("WebAssembly", () => Browser.FindElement(By.Id("render-mode-0")).Text); + + Browser.Click(By.Id(AddServerPrerenderedId)); + Browser.Equal("True", () => Browser.FindElement(By.Id("is-interactive-1")).Text); + Browser.Equal("Server", () => Browser.FindElement(By.Id("render-mode-1")).Text); + + Browser.Click(By.Id(AddAutoPrerenderedId)); + Browser.Equal("True", () => Browser.FindElement(By.Id("is-interactive-2")).Text); + Browser.Equal("WebAssembly", () => Browser.FindElement(By.Id("render-mode-2")).Text); + + // Remove all WebAssembly components + Browser.Click(By.Id("remove-counter-link-0")); + Browser.Click(By.Id("remove-counter-link-2")); + + // Verify that Blazor Server gets used + Browser.Click(By.Id(AddAutoPrerenderedId)); + Browser.Equal("True", () => Browser.FindElement(By.Id("is-interactive-3")).Text); + Browser.Equal("Server", () => Browser.FindElement(By.Id("render-mode-3")).Text); + } + [Fact] public void Circuit_ShutsDown_WhenAllBlazorServerComponentsGetRemoved() { From 2fce01df64d8550c5cc7fbc773fca0b4b9a51a52 Mon Sep 17 00:00:00 2001 From: Stephen Halter Date: Fri, 22 Sep 2023 11:50:01 -0700 Subject: [PATCH 2/9] Add Identity Components to Blazor template (#50722) # Add Identity Components to Blazor template ## Description This adds the option to add Identity Razor Components (`*.razor` files) when using the Blazor project template. This supports the same feature set as the Identity Razor Pages (`*.cshtml` files). We've already done an accessibility pass over these newly added components and this PR includes all the fixes for Accessibility too. As with the Identity Razor Pages, this supports local authentication (with the option to configure external login providers) and Identity management using EF Core. Fixes #48786 ## Customer Impact These Identity Razor Components have been a common request for years as noted above, because it allows Blazor developers to use Identity without needing to add Razor Pages infrastructure which would otherwise be unnecessary and doesn't integrate well with the rest of the app. For example, the Identity Razor Pages to a Blazor app would use a different layout that doesn't match the look and feel of the Razor Components that make up the rest of the app. ## Regression? - [ ] Yes - [x] No ## Risk - [ ] High - [ ] Medium - [x] Low These are template only changes that only affect the brand new Blazor project template. It should have no impact on the project template output unless you opt-in to the individual auth option (other than a [small fix](https://github.com/dotnet/aspnetcore/pull/50722/commits/5462e42a630c26086a7a1276cc230e668f379ee5) to make the `--empty` option produce compileable output with all `InteractivityPlatform` options.) ## Verification - [x] Manual (required) - [x] Automated We're also adding new validation scenarios for vendors to validate periodically. ## Packaging changes reviewed? - [ ] Yes - [ ] No - [x] N/A ---- - [x] Finish user management components for 2fa, external login, personal data, etc... - [x] Add signout link - [x] Verify RegisterOnPersisting gets invoked as expected with the changes from #50625 - [x] Render ShowRecoveryCodes.razor inline rather than via a redirect. - [x] Add baseline tests - [x] Fix BOMs - [x] Validate the template in VS --- src/ProjectTemplates/ProjectTemplates.slnf | 4 +- .../BlazorWeb-CSharp.Client.csproj.in | 1 + .../BlazorWeb-CSharp.csproj.in | 18 +- .../RazorPagesWeb-CSharp.csproj.in | 2 +- .../.template.config/dotnetcli.host.json | 8 +- .../localize/templatestrings.cs.json | 5 + .../localize/templatestrings.de.json | 5 + .../localize/templatestrings.en.json | 11 +- .../localize/templatestrings.es.json | 5 + .../localize/templatestrings.fr.json | 5 + .../localize/templatestrings.it.json | 5 + .../localize/templatestrings.ja.json | 5 + .../localize/templatestrings.ko.json | 5 + .../localize/templatestrings.pl.json | 5 + .../localize/templatestrings.pt-BR.json | 5 + .../localize/templatestrings.ru.json | 5 + .../localize/templatestrings.tr.json | 5 + .../localize/templatestrings.zh-Hans.json | 5 + .../localize/templatestrings.zh-Hant.json | 5 + .../.template.config/template.json | 128 ++++- .../BlazorWeb-CSharp.Client/Pages/Auth.razor | 18 + .../PersistentAuthenticationStateProvider.cs | 29 ++ .../BlazorWeb-CSharp.Client/Program.cs | 10 + .../BlazorWeb-CSharp.Client/UserInfo.cs | 7 + .../BlazorWeb-CSharp.Client/_Imports.razor | 3 + .../Identity/ExternalLoginPicker.razor | 47 ++ .../Components/Identity/LogoutForm.razor | 34 ++ .../Identity/ShowRecoveryCodes.razor | 32 ++ .../Components/Identity/StatusMessage.razor | 29 ++ .../Components/Layout/ManageLayout.razor | 17 + .../Components/Layout/ManageNavMenu.razor | 37 ++ .../Components/Layout/NavMenu.razor | 42 +- .../Components/Layout/NavMenu.razor.css | 22 + .../Pages/Account/ConfirmEmail.razor | 49 ++ .../Pages/Account/ConfirmEmailChange.razor | 64 +++ .../Pages/Account/ExternalLogin.razor | 213 ++++++++ .../Pages/Account/ForgotPassword.razor | 74 +++ .../Account/ForgotPasswordConfirmation.razor | 8 + .../Pages/Account/InvalidPasswordReset.razor | 8 + .../Pages/Account/InvalidUser.razor | 7 + .../Components/Pages/Account/Lockout.razor | 8 + .../Components/Pages/Account/Login.razor | 133 +++++ .../Pages/Account/LoginWith2fa.razor | 109 +++++ .../Pages/Account/LoginWithRecoveryCode.razor | 94 ++++ .../Pages/Account/Manage/ChangePassword.razor | 97 ++++ .../Account/Manage/DeletePersonalData.razor | 85 ++++ .../Pages/Account/Manage/Disable2fa.razor | 68 +++ .../Pages/Account/Manage/Email.razor | 123 +++++ .../Account/Manage/EnableAuthenticator.razor | 174 +++++++ .../Pages/Account/Manage/ExternalLogins.razor | 152 ++++++ .../Manage/GenerateRecoveryCodes.razor | 67 +++ .../Pages/Account/Manage/Index.razor | 80 +++ .../Pages/Account/Manage/PersonalData.razor | 35 ++ .../Account/Manage/ResetAuthenticator.razor | 55 +++ .../Pages/Account/Manage/SetPassword.razor | 88 ++++ .../Manage/TwoFactorAuthentication.razor | 101 ++++ .../Pages/Account/Manage/_Imports.razor | 2 + .../Components/Pages/Account/Register.razor | 176 +++++++ .../Pages/Account/RegisterConfirmation.razor | 67 +++ .../Account/ResendEmailConfirmation.razor | 78 +++ .../Pages/Account/ResetPassword.razor | 108 +++++ .../Account/ResetPasswordConfirmation.razor | 7 + .../Components/Pages/Account/_Imports.razor | 1 + .../Components/Pages/Auth.razor | 13 + .../BlazorWeb-CSharp/Components/Routes.razor | 4 + .../Components/_Imports.razor | 3 + .../Data/ApplicationDbContext.cs | 8 + .../BlazorWeb-CSharp/Data/ApplicationUser.cs | 9 + ...000000000_CreateIdentitySchema.Designer.cs | 268 +++++++++++ .../00000000000000_CreateIdentitySchema.cs | 222 +++++++++ .../ApplicationDbContextModelSnapshot.cs | 265 ++++++++++ ...000000000_CreateIdentitySchema.Designer.cs | 279 +++++++++++ .../00000000000000_CreateIdentitySchema.cs | 224 +++++++++ .../ApplicationDbContextModelSnapshot.cs | 276 +++++++++++ .../BlazorWeb-CSharp/Data/UserAccessor.cs | 26 + ...omponentsEndpointRouteBuilderExtensions.cs | 102 ++++ .../Identity/IdentityRedirectManager.cs | 63 +++ ...RevalidatingAuthenticationStateProvider.cs | 54 +++ ...RevalidatingAuthenticationStateProvider.cs | 106 ++++ ...istingServerAuthenticationStateProvider.cs | 66 +++ .../BlazorWeb-CSharp/Program.Main.cs | 74 ++- .../BlazorWeb-CSharp/Program.cs | 70 ++- .../BlazorWeb-CSharp/BlazorWeb-CSharp/app.db | Bin 0 -> 102400 bytes .../BlazorWeb-CSharp/appsettings.json | 9 + .../BlazorWeb-CSharp/wwwroot/app.css | 6 +- .../.template.config/template.json | 1 - .../.template.config/template.json | 3 +- .../.template.config/template.json | 1 - .../.template.config/template.json | 1 - .../test/Templates.Tests/BaselineTest.cs | 2 +- .../Templates.Tests/template-baselines.json | 455 ++++++++++++++++++ 91 files changed, 5466 insertions(+), 39 deletions(-) create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/Pages/Auth.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/PersistentAuthenticationStateProvider.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/UserInfo.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Identity/ExternalLoginPicker.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Identity/LogoutForm.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Identity/ShowRecoveryCodes.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Identity/StatusMessage.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/ManageLayout.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/ManageNavMenu.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ConfirmEmail.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ConfirmEmailChange.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ExternalLogin.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ForgotPassword.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ForgotPasswordConfirmation.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/InvalidPasswordReset.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/InvalidUser.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Lockout.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Login.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/LoginWith2fa.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/LoginWithRecoveryCode.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/ChangePassword.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/DeletePersonalData.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/Disable2fa.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/Email.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/EnableAuthenticator.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/ExternalLogins.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/GenerateRecoveryCodes.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/Index.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/PersonalData.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/ResetAuthenticator.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/SetPassword.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/TwoFactorAuthentication.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/_Imports.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Register.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/RegisterConfirmation.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ResendEmailConfirmation.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ResetPassword.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ResetPasswordConfirmation.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/_Imports.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Auth.razor create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Data/ApplicationDbContext.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Data/ApplicationUser.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Data/SqlLite/00000000000000_CreateIdentitySchema.Designer.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Data/SqlLite/00000000000000_CreateIdentitySchema.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Data/SqlLite/ApplicationDbContextModelSnapshot.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Data/SqlServer/00000000000000_CreateIdentitySchema.Designer.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Data/SqlServer/00000000000000_CreateIdentitySchema.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Data/SqlServer/ApplicationDbContextModelSnapshot.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Data/UserAccessor.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Identity/Extensions/IdentityComponentsEndpointRouteBuilderExtensions.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Identity/IdentityRedirectManager.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Identity/IdentityRevalidatingAuthenticationStateProvider.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Identity/PersistingRevalidatingAuthenticationStateProvider.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Identity/PersistingServerAuthenticationStateProvider.cs create mode 100644 src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/app.db diff --git a/src/ProjectTemplates/ProjectTemplates.slnf b/src/ProjectTemplates/ProjectTemplates.slnf index 56945fef18d9..a3e1d4b51627 100644 --- a/src/ProjectTemplates/ProjectTemplates.slnf +++ b/src/ProjectTemplates/ProjectTemplates.slnf @@ -65,8 +65,8 @@ "src\\ProjectTemplates\\Web.ItemTemplates\\Microsoft.DotNet.Web.ItemTemplates.csproj", "src\\ProjectTemplates\\Web.ProjectTemplates\\Microsoft.DotNet.Web.ProjectTemplates.csproj", "src\\ProjectTemplates\\test\\Templates.Blazor.Tests\\Templates.Blazor.Tests.csproj", - "src\\ProjectTemplates\\test\\Templates.Blazor.WebAssembly.Tests\\Templates.Blazor.WebAssembly.Tests.csproj", "src\\ProjectTemplates\\test\\Templates.Blazor.WebAssembly.Auth.Tests\\Templates.Blazor.WebAssembly.Auth.Tests.csproj", + "src\\ProjectTemplates\\test\\Templates.Blazor.WebAssembly.Tests\\Templates.Blazor.WebAssembly.Tests.csproj", "src\\ProjectTemplates\\test\\Templates.Mvc.Tests\\Templates.Mvc.Tests.csproj", "src\\ProjectTemplates\\test\\Templates.Tests\\Templates.Tests.csproj", "src\\Razor\\Razor.Runtime\\src\\Microsoft.AspNetCore.Razor.Runtime.csproj", @@ -95,4 +95,4 @@ "src\\SignalR\\server\\SignalR\\src\\Microsoft.AspNetCore.SignalR.csproj" ] } -} +} \ No newline at end of file diff --git a/src/ProjectTemplates/Web.ProjectTemplates/BlazorWeb-CSharp.Client.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/BlazorWeb-CSharp.Client.csproj.in index 027eeefed22b..829c12db913c 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/BlazorWeb-CSharp.Client.csproj.in +++ b/src/ProjectTemplates/Web.ProjectTemplates/BlazorWeb-CSharp.Client.csproj.in @@ -12,6 +12,7 @@ + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/BlazorWeb-CSharp.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/BlazorWeb-CSharp.csproj.in index 31be9a845da9..d676d90df723 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/BlazorWeb-CSharp.csproj.in +++ b/src/ProjectTemplates/Web.ProjectTemplates/BlazorWeb-CSharp.csproj.in @@ -4,16 +4,28 @@ ${DefaultNetCoreTargetFramework} enable enable + aspnet-BlazorWeb-CSharp-53bc9b9d-9d6a-45d4-8429-2a2761773502 True BlazorWeb-CSharp `$(AssemblyName.Replace(' ', '_')) - + - - + + + + + + + + + + + + + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in index ee04cb442ea1..2ed95f454912 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in +++ b/src/ProjectTemplates/Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in @@ -4,7 +4,7 @@ ${DefaultNetCoreTargetFramework} enable enable - aspnet-Company.WebApplication1-0ce56475-d1db-490f-8af1-a881ea4fcd2d + aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502 True Company.WebApplication1 diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/dotnetcli.host.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/dotnetcli.host.json index a8c678b039b3..897cc41741ca 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/dotnetcli.host.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/dotnetcli.host.json @@ -21,6 +21,9 @@ "IncludeSampleContent": { "isHidden": true }, + "UseLocalDB": { + "longName": "use-local-db" + }, "Framework": { "longName": "framework" }, @@ -51,5 +54,8 @@ "longName": "use-program-main", "shortName": "" } - } + }, + "usageExamples": [ + "-int auto --auth individual --use-local-db" + ] } diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.cs.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.cs.json index 069f5694009b..65699b857548 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.cs.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.cs.json @@ -4,6 +4,7 @@ "description": "Å ablona projektu pro vytvoÅ™ení webové aplikace Blazor, která podporuje vykreslování na stranÄ› serveru i interaktivitu klienta. Tato Å¡ablona se dá použít pro webové aplikace s bohatými dynamickými uživatelskými rozhraními (UI).", "symbols/Framework/description": "Cílová architektura pro projekt", "symbols/Framework/choices/net8.0/description": "Cílový net8.0", + "symbols/UserSecretsId/description": "The ID to use for secrets (use with Individual auth).", "symbols/skipRestore/description": "Pokud se tato možnost zadá, pÅ™eskoÄí automatické obnovení projektu pÅ™i vytvoÅ™ení.", "symbols/ExcludeLaunchSettings/description": "UrÄuje, jestli se má z vygenerované Å¡ablony vylouÄit soubor launchSettings.json.", "symbols/kestrelHttpPort/description": "Číslo portu, který se má použít pro koncový bod HTTP v souboru launchSettings.json.", @@ -29,6 +30,10 @@ "symbols/IncludeSampleContent/displayName": "_Zahrnout ukázkové stránky", "symbols/IncludeSampleContent/description": "Nastavuje, jestli se mají pÅ™idávat ukázkové stránky a styly pro demonstraci základních vzorů použití.", "symbols/Empty/description": "Nastavuje, jestli se mají vynechat ukázkové stránky a styly, které demonstrují základní vzory použití.", + "symbols/auth/choices/None/description": "No authentication", + "symbols/auth/choices/Individual/description": "Individual authentication", + "symbols/auth/description": "The type of authentication to use", + "symbols/UseLocalDB/description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual is specified.", "symbols/AllInteractive/displayName": "_Enable interactive rendering globally throughout the site", "symbols/AllInteractive/description": "Configures whether to make every page interactive by applying an interactive render mode at the top level. If false, pages will use static server rendering by default, and can be marked interactive on a per-page or per-component basis.", "symbols/NoHttps/description": "UrÄuje, jestli se má protokol HTTPS vypnout. Tato možnost platí jenom v případÄ›, že se pro --auth nepoužívají Individual, IndividualB2C, SingleOrg ani MultiOrg.", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.de.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.de.json index 96805c77240a..e443e2846c5a 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.de.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.de.json @@ -4,6 +4,7 @@ "description": "Eine Projektvorlage zum Erstellen einer Blazor-Web-App, die sowohl serverseitiges Rendering als auch Clientinteraktivität unterstützt. Diese Vorlage kann für Web-Apps mit umfangreichen dynamischen Benutzeroberflächen (UIs) verwendet werden.", "symbols/Framework/description": "Das Zielframework für das Projekt.", "symbols/Framework/choices/net8.0/description": "Ziel net8.0", + "symbols/UserSecretsId/description": "The ID to use for secrets (use with Individual auth).", "symbols/skipRestore/description": "Wenn angegeben, wird die automatische Wiederherstellung des Projekts beim Erstellen übersprungen.", "symbols/ExcludeLaunchSettings/description": "Ob launchSettings.json aus der generierten Vorlage ausgeschlossen werden soll.", "symbols/kestrelHttpPort/description": "Portnummer, die für den HTTP Endpunkt in launchSettings.json verwendet werden soll.", @@ -29,6 +30,10 @@ "symbols/IncludeSampleContent/displayName": "_Include Beispielseiten", "symbols/IncludeSampleContent/description": "Konfiguriert, ob Beispielseiten und Stile hinzugefügt werden, um grundlegende Verwendungsmuster zu veranschaulichen.", "symbols/Empty/description": "Konfiguriert, ob Beispielseiten und Formatierungen weggelassen werden sollen, die grundlegende Verwendungsmuster veranschaulichen.", + "symbols/auth/choices/None/description": "No authentication", + "symbols/auth/choices/Individual/description": "Individual authentication", + "symbols/auth/description": "The type of authentication to use", + "symbols/UseLocalDB/description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual is specified.", "symbols/AllInteractive/displayName": "_Enable interactive rendering globally throughout the site", "symbols/AllInteractive/description": "Configures whether to make every page interactive by applying an interactive render mode at the top level. If false, pages will use static server rendering by default, and can be marked interactive on a per-page or per-component basis.", "symbols/NoHttps/description": "Ob HTTPS deaktiviert werden soll. Diese Option gilt nur, wenn Individual, IndividualB2C, SingleOrg oder MultiOrg nicht für --auth verwendet werden.", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.en.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.en.json index 60d16e15ffd9..6db424a9f348 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.en.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.en.json @@ -4,12 +4,13 @@ "description": "A project template for creating a Blazor web app that supports both server-side rendering and client interactivity. This template can be used for web apps with rich dynamic user interfaces (UIs).", "symbols/Framework/description": "The target framework for the project.", "symbols/Framework/choices/net8.0/description": "Target net8.0", + "symbols/UserSecretsId/description": "The ID to use for secrets (use with Individual auth).", "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", "symbols/ExcludeLaunchSettings/description": "Whether to exclude launchSettings.json from the generated template.", "symbols/kestrelHttpPort/description": "Port number to use for the HTTP endpoint in launchSettings.json.", - "symbols/kestrelHttpsPort/description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if either IndividualAuth or OrganizationalAuth is used).", + "symbols/kestrelHttpsPort/description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if Individual auth is used).", "symbols/iisHttpPort/description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json.", - "symbols/iisHttpsPort/description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if either IndividualAuth or OrganizationalAuth is used).", + "symbols/iisHttpsPort/description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if Individual auth is used).", "symbols/InteractivityPlatform/displayName": "_Interactivity type", "symbols/InteractivityPlatform/description": "Chooses which hosting platform to use for interactive components", "symbols/InteractivityPlatform/choices/None/displayName": "None", @@ -29,9 +30,13 @@ "symbols/IncludeSampleContent/displayName": "_Include sample pages", "symbols/IncludeSampleContent/description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns.", "symbols/Empty/description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns.", + "symbols/auth/choices/None/description": "No authentication", + "symbols/auth/choices/Individual/description": "Individual authentication", + "symbols/auth/description": "The type of authentication to use", + "symbols/UseLocalDB/description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual is specified.", "symbols/AllInteractive/displayName": "_Enable interactive rendering globally throughout the site", "symbols/AllInteractive/description": "Configures whether to make every page interactive by applying an interactive render mode at the top level. If false, pages will use static server rendering by default, and can be marked interactive on a per-page or per-component basis.", - "symbols/NoHttps/description": "Whether to turn off HTTPS. This option only applies if Individual, IndividualB2C, SingleOrg, or MultiOrg aren't used for --auth.", + "symbols/NoHttps/description": "Whether to turn off HTTPS. This option only applies if Individual isn't used for --auth.", "symbols/UseProgramMain/displayName": "Do not use _top-level statements", "symbols/UseProgramMain/description": "Whether to generate an explicit Program class and Main method instead of top-level statements.", "postActions/restore/description": "Restore NuGet packages required by this project.", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.es.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.es.json index 91d5403e0fbf..ddb3601195d3 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.es.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.es.json @@ -4,6 +4,7 @@ "description": "Plantilla de proyecto para crear una aplicación web de Blazor que admita tanto la representación del lado del servidor como la interactividad del cliente. Esta plantilla se puede usar para las aplicaciones web con interfaces de usuario dinámicas enriquecidas.", "symbols/Framework/description": "Marco de destino del proyecto.", "symbols/Framework/choices/net8.0/description": "net8.0 de destino", + "symbols/UserSecretsId/description": "The ID to use for secrets (use with Individual auth).", "symbols/skipRestore/description": "Si se especifica, se omite la restauración automática del proyecto durante la creación.", "symbols/ExcludeLaunchSettings/description": "Indica si se va a excluir launchSettings.json de la plantilla generada.", "symbols/kestrelHttpPort/description": "Número de puerto que se va a usar para el punto de conexión HTTP en launchSettings.json.", @@ -29,6 +30,10 @@ "symbols/IncludeSampleContent/displayName": "_Incluir páginas de ejemplo", "symbols/IncludeSampleContent/description": "Configura si se van a agregar páginas de ejemplo y estilos para mostrar patrones de uso básicos.", "symbols/Empty/description": "Configura si se omiten las páginas de ejemplo y los estilos que muestran patrones de uso básicos.", + "symbols/auth/choices/None/description": "No authentication", + "symbols/auth/choices/Individual/description": "Individual authentication", + "symbols/auth/description": "The type of authentication to use", + "symbols/UseLocalDB/description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual is specified.", "symbols/AllInteractive/displayName": "_Enable interactive rendering globally throughout the site", "symbols/AllInteractive/description": "Configures whether to make every page interactive by applying an interactive render mode at the top level. If false, pages will use static server rendering by default, and can be marked interactive on a per-page or per-component basis.", "symbols/NoHttps/description": "Si se va a desactivar HTTPS. Esta opción solo se aplica si Individual, IndividualB2C, SingleOrg o MultiOrg no se usan para --auth.", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.fr.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.fr.json index 044f40bacc91..b902e5a58b87 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.fr.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.fr.json @@ -4,6 +4,7 @@ "description": "Modèle de projet pour la création d’une application web Blazor qui prend en charge le rendu côté serveur et l’interactivité du client. Ce modèle peut être utilisé pour les applications web avec des interfaces utilisateur dynamiques enrichies.", "symbols/Framework/description": "Framework cible du projet.", "symbols/Framework/choices/net8.0/description": "Cible net8.0", + "symbols/UserSecretsId/description": "The ID to use for secrets (use with Individual auth).", "symbols/skipRestore/description": "S’il est spécifié, ignore la restauration automatique du projet lors de la création.", "symbols/ExcludeLaunchSettings/description": "Indique s’il faut exclure launchSettings.json du modèle généré.", "symbols/kestrelHttpPort/description": "Numéro de port à utiliser pour le point de terminaison HTTP dans launchSettings.json.", @@ -29,6 +30,10 @@ "symbols/IncludeSampleContent/displayName": "_Inclure des exemples de pages", "symbols/IncludeSampleContent/description": "Configure s'il faut ajouter des exemples de pages et de style pour illustrer les modèles d'utilisation de base.", "symbols/Empty/description": "Configure s'il faut omettre les exemples de pages et le style qui illustrent les modèles d'utilisation de base.", + "symbols/auth/choices/None/description": "No authentication", + "symbols/auth/choices/Individual/description": "Individual authentication", + "symbols/auth/description": "The type of authentication to use", + "symbols/UseLocalDB/description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual is specified.", "symbols/AllInteractive/displayName": "_Enable interactive rendering globally throughout the site", "symbols/AllInteractive/description": "Configures whether to make every page interactive by applying an interactive render mode at the top level. If false, pages will use static server rendering by default, and can be marked interactive on a per-page or per-component basis.", "symbols/NoHttps/description": "Indique s’il faut désactiver HTTPS. Cette option s’applique uniquement si Individual, IndividualB2C, SingleOrg ou MultiOrg ne sont pas utilisés pour --auth.", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.it.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.it.json index 09c3ebfff2c2..14edbef4335b 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.it.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.it.json @@ -4,6 +4,7 @@ "description": "Modello di progetto per la creazione di un'app Web Blazor che supporta sia il rendering lato server sia l'interattività client. Questo modello può essere usato per app Web con interfacce utente dinamiche avanzate.", "symbols/Framework/description": "Il framework di destinazione per il progetto.", "symbols/Framework/choices/net8.0/description": "Destinazione net8.0", + "symbols/UserSecretsId/description": "The ID to use for secrets (use with Individual auth).", "symbols/skipRestore/description": "Se specificato, ignora il ripristino automatico del progetto durante la creazione.", "symbols/ExcludeLaunchSettings/description": "Indica se escludere launchSettings.json dal modello generato.", "symbols/kestrelHttpPort/description": "Numero di porta da usare per l'endpoint HTTP in launchSettings.json.", @@ -29,6 +30,10 @@ "symbols/IncludeSampleContent/displayName": "_Include pagine di esempio", "symbols/IncludeSampleContent/description": "Consente di configurare se aggiungere pagine di esempio e stile per mostrare modelli di utilizzo di base.", "symbols/Empty/description": "Consente di configurare se omettere pagine di esempio e stile che mostrano modelli di utilizzo di base.", + "symbols/auth/choices/None/description": "No authentication", + "symbols/auth/choices/Individual/description": "Individual authentication", + "symbols/auth/description": "The type of authentication to use", + "symbols/UseLocalDB/description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual is specified.", "symbols/AllInteractive/displayName": "_Enable interactive rendering globally throughout the site", "symbols/AllInteractive/description": "Configures whether to make every page interactive by applying an interactive render mode at the top level. If false, pages will use static server rendering by default, and can be marked interactive on a per-page or per-component basis.", "symbols/NoHttps/description": "Indica se disattivare HTTPS. Questa opzione si applica solo se Individual, IndividualB2C, SingleOrg o MultiOrg non vengono usati per --auth.", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.ja.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.ja.json index f48aecfb9534..2b7fabb722e0 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.ja.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.ja.json @@ -4,6 +4,7 @@ "description": "サーãƒãƒ¼å´ã®ãƒ¬ãƒ³ãƒ€ãƒªãƒ³ã‚°ã¨ã‚¯ãƒ©ã‚¤ã‚¢ãƒ³ãƒˆã®å¯¾è©±æ©Ÿèƒ½ã®ä¸¡æ–¹ã‚’サãƒãƒ¼ãƒˆã™ã‚‹ Blazor Web アプリを作æˆã™ã‚‹ãŸã‚ã®ãƒ—ロジェクト テンプレートã§ã™ã€‚ã“ã®ãƒ†ãƒ³ãƒ—レートã¯ã€ãƒªãƒƒãƒãªå‹•çš„ユーザー インターフェイス (UI) ã‚’æŒã¤ Web アプリã«ä½¿ç”¨ã§ãã¾ã™ã€‚", "symbols/Framework/description": "プロジェクトã®ã‚¿ãƒ¼ã‚²ãƒƒãƒˆ フレームワークã§ã™ã€‚", "symbols/Framework/choices/net8.0/description": "ターゲット net8.0", + "symbols/UserSecretsId/description": "The ID to use for secrets (use with Individual auth).", "symbols/skipRestore/description": "指定ã—ãŸå ´åˆã€ä½œæˆæ™‚ã«ãƒ—ロジェクトã®è‡ªå‹•å¾©å…ƒãŒã‚¹ã‚­ãƒƒãƒ—ã•ã‚Œã¾ã™ã€‚", "symbols/ExcludeLaunchSettings/description": "生æˆã•ã‚ŒãŸãƒ†ãƒ³ãƒ—レートã‹ã‚‰ launchSettings.json を除外ã™ã‚‹ã‹ã©ã†ã‹ã€‚", "symbols/kestrelHttpPort/description": "launchSettings.json ã® HTTP エンドãƒã‚¤ãƒ³ãƒˆã«ä½¿ç”¨ã™ã‚‹ãƒãƒ¼ãƒˆç•ªå·ã€‚", @@ -29,6 +30,10 @@ "symbols/IncludeSampleContent/displayName": "サンプル ページをå«ã‚ã‚‹(_I)", "symbols/IncludeSampleContent/description": "基本的ãªä½¿ç”¨ãƒ‘ターンを示ã™ã‚µãƒ³ãƒ—ル ページã¨ã‚¹ã‚¿ã‚¤ãƒ«ã‚’追加ã™ã‚‹ã‹ã©ã†ã‹ã‚’構æˆã—ã¾ã™ã€‚", "symbols/Empty/description": "基本的ãªä½¿ç”¨ãƒ‘ターンを示ã™ã‚µãƒ³ãƒ—ル ページã¨ã‚¹ã‚¿ã‚¤ãƒ«ã‚’çœç•¥ã™ã‚‹ã‹ã©ã†ã‹ã‚’構æˆã—ã¾ã™ã€‚", + "symbols/auth/choices/None/description": "No authentication", + "symbols/auth/choices/Individual/description": "Individual authentication", + "symbols/auth/description": "The type of authentication to use", + "symbols/UseLocalDB/description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual is specified.", "symbols/AllInteractive/displayName": "_Enable interactive rendering globally throughout the site", "symbols/AllInteractive/description": "Configures whether to make every page interactive by applying an interactive render mode at the top level. If false, pages will use static server rendering by default, and can be marked interactive on a per-page or per-component basis.", "symbols/NoHttps/description": "HTTPS をオフã«ã™ã‚‹ã‹ã©ã†ã‹ã€‚ã“ã®ã‚ªãƒ—ションã¯ã€Individualã€IndividualB2Cã€SingleOrgã€ã¾ãŸã¯ MultiOrg ㌠--auth ã«ä½¿ç”¨ã•ã‚Œã¦ã„ãªã„å ´åˆã«ã®ã¿é©ç”¨ã•ã‚Œã¾ã™ã€‚", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.ko.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.ko.json index 020ab522da02..f0319af43653 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.ko.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.ko.json @@ -4,6 +4,7 @@ "description": "서버 측 ë Œë”ë§ ë° í´ë¼ì´ì–¸íŠ¸ 대화형 ìž‘ì—…ì„ ëª¨ë‘ ì§€ì›í•˜ëŠ” Blazor ì›¹ì•±ì„ ë§Œë“¤ê¸° 위한 프로ì íŠ¸ 템플릿입니다. ì´ í…œí”Œë¦¿ì€ í’부한 ë™ì  UI(ì‚¬ìš©ìž ì¸í„°íŽ˜ì´ìŠ¤)ê°€ 있는 ì›¹ì•±ì— ì‚¬ìš©í•  수 있습니다.", "symbols/Framework/description": "프로ì íŠ¸ì— 대한 ëŒ€ìƒ í”„ë ˆìž„ì›Œí¬ìž…니다.", "symbols/Framework/choices/net8.0/description": "ëŒ€ìƒ net8.0", + "symbols/UserSecretsId/description": "The ID to use for secrets (use with Individual auth).", "symbols/skipRestore/description": "ì§€ì •ëœ ê²½ìš°, 프로ì íŠ¸ ìƒì„± ì‹œ ìžë™ ë³µì›ì„ 건너ëœë‹ˆë‹¤.", "symbols/ExcludeLaunchSettings/description": "ìƒì„±ëœ 템플릿ì—ì„œ launchSettings.jsonì„ ì œì™¸í• ì§€ 여부입니다.", "symbols/kestrelHttpPort/description": "launchSettings.jsonì˜ HTTP 엔드í¬ì¸íŠ¸ì— 사용할 í¬íŠ¸ 번호입니다.", @@ -29,6 +30,10 @@ "symbols/IncludeSampleContent/displayName": "샘플 페ì´ì§€ í¬í•¨(_I)", "symbols/IncludeSampleContent/description": "기본 사용 íŒ¨í„´ì„ ë³´ì—¬ì£¼ê¸° 위해 샘플 페ì´ì§€ ë° ìŠ¤íƒ€ì¼ì„ 추가할지 여부를 구성합니다.", "symbols/Empty/description": "기본 사용 íŒ¨í„´ì„ ë³´ì—¬ì£¼ëŠ” 샘플 페ì´ì§€ ë° ìŠ¤íƒ€ì¼ì„ ìƒëžµí• ì§€ 여부를 구성합니다.", + "symbols/auth/choices/None/description": "No authentication", + "symbols/auth/choices/Individual/description": "Individual authentication", + "symbols/auth/description": "The type of authentication to use", + "symbols/UseLocalDB/description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual is specified.", "symbols/AllInteractive/displayName": "_Enable interactive rendering globally throughout the site", "symbols/AllInteractive/description": "Configures whether to make every page interactive by applying an interactive render mode at the top level. If false, pages will use static server rendering by default, and can be marked interactive on a per-page or per-component basis.", "symbols/NoHttps/description": "HTTPS를 ëŒì§€ 여부입니다. ì´ ì˜µì…˜ì€ Individual, IndividualB2C, SingleOrg ë˜ëŠ” MultiOrgê°€ --authì— ì‚¬ìš©ë˜ì§€ 않는 경우ì—만 ì ìš©ë©ë‹ˆë‹¤.", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.pl.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.pl.json index 43e2693e0f62..aaa04bb545d6 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.pl.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.pl.json @@ -4,6 +4,7 @@ "description": "Szablon projektu sÅ‚użący do tworzenia aplikacji internetowej platformy Blazor, która obsÅ‚uguje renderowanie po stronie serwera i interakcyjność klienta. Ten szablon może być używany dla aplikacji internetowych z zaawansowanymi dynamicznymi interfejsami użytkownika.", "symbols/Framework/description": "Platforma docelowa dla tego projektu.", "symbols/Framework/choices/net8.0/description": "Docelowa platforma net8.0", + "symbols/UserSecretsId/description": "The ID to use for secrets (use with Individual auth).", "symbols/skipRestore/description": "JeÅ›li ta opcja jest okreÅ›lona, pomija automatyczne przywracanie projektu podczas tworzenia.", "symbols/ExcludeLaunchSettings/description": "OkreÅ›la, czy wykluczyć plik launchSettings.json z wygenerowanego szablonu.", "symbols/kestrelHttpPort/description": "Numer portu do użycia dla punktu koÅ„cowego HTTP w pliku launchSettings.json.", @@ -29,6 +30,10 @@ "symbols/IncludeSampleContent/displayName": "_DoÅ‚Ä…cz przykÅ‚adowe strony", "symbols/IncludeSampleContent/description": "Konfiguruje, czy dodać przykÅ‚adowe strony i style w celu zademonstrowania podstawowych wzorców użycia.", "symbols/Empty/description": "Konfiguruje, czy pomijać przykÅ‚adowe strony i style demonstrujÄ…ce podstawowe wzorce użycia.", + "symbols/auth/choices/None/description": "No authentication", + "symbols/auth/choices/Individual/description": "Individual authentication", + "symbols/auth/description": "The type of authentication to use", + "symbols/UseLocalDB/description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual is specified.", "symbols/AllInteractive/displayName": "_Enable interactive rendering globally throughout the site", "symbols/AllInteractive/description": "Configures whether to make every page interactive by applying an interactive render mode at the top level. If false, pages will use static server rendering by default, and can be marked interactive on a per-page or per-component basis.", "symbols/NoHttps/description": "OkreÅ›la, czy wyÅ‚Ä…czyć protokół HTTPS. Ta opcja ma zastosowanie tylko wtedy, gdy dla uwierzytelniania --auth nie sÄ… używane elementy Individual, IndividualB2C, SingleOrg lub MultiOrg.", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.pt-BR.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.pt-BR.json index dc3922339c3b..b0969274dcc2 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.pt-BR.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.pt-BR.json @@ -4,6 +4,7 @@ "description": "Um modelo de projeto para criar um aplicativo Web Blazor que dá suporte à renderização do lado do servidor e à interatividade do cliente. Este modelo pode ser usado para aplicativos da Web com interfaces de usuário (UIs) dinâmicas avançadas.", "symbols/Framework/description": "A estrutura de destino do projeto.", "symbols/Framework/choices/net8.0/description": "net8.0 de destino", + "symbols/UserSecretsId/description": "The ID to use for secrets (use with Individual auth).", "symbols/skipRestore/description": "Se especificado, ignora a restauração automática do projeto sendo criado.", "symbols/ExcludeLaunchSettings/description": "Se deve excluir launchSettings.json do modelo gerado.", "symbols/kestrelHttpPort/description": "Número da porta a ser usada para o ponto de extremidade HTTP em launchSettings.json.", @@ -29,6 +30,10 @@ "symbols/IncludeSampleContent/displayName": "_Incluir páginas de amostra", "symbols/IncludeSampleContent/description": "Configura se deseja adicionar páginas de amostra e estilo para demonstrar padrões de uso básicos.", "symbols/Empty/description": "Configura a omissão de páginas de amostra e estilo que demonstram padrões básicos de uso.", + "symbols/auth/choices/None/description": "No authentication", + "symbols/auth/choices/Individual/description": "Individual authentication", + "symbols/auth/description": "The type of authentication to use", + "symbols/UseLocalDB/description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual is specified.", "symbols/AllInteractive/displayName": "_Enable interactive rendering globally throughout the site", "symbols/AllInteractive/description": "Configures whether to make every page interactive by applying an interactive render mode at the top level. If false, pages will use static server rendering by default, and can be marked interactive on a per-page or per-component basis.", "symbols/NoHttps/description": "Se o HTTPS deve ser desativado. Essa opção se aplica somente se Individual, IndividualB2C, SingleOrg ou MultiOrg não forem usados para --auth.", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.ru.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.ru.json index f9d64e65d85a..eea4080639dc 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.ru.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.ru.json @@ -4,6 +4,7 @@ "description": "Шаблон проекта Ð´Ð»Ñ ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ Ð¿Ñ€Ð¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Blazor, поддерживающего как отриÑовку на Ñтороне Ñервера, так и интерактивные возможноÑти клиента. Этот шаблон можно иÑпользовать Ð´Ð»Ñ Ð²ÐµÐ±-приложений Ñ Ð¼Ð½Ð¾Ð³Ð¾Ñ„ÑƒÐ½ÐºÑ†Ð¸Ð¾Ð½Ð°Ð»ÑŒÐ½Ñ‹Ð¼Ð¸ динамичеÑкими пользовательÑкими интерфейÑами (UI).", "symbols/Framework/description": "Ð¦ÐµÐ»ÐµÐ²Ð°Ñ Ð¿Ð»Ð°Ñ‚Ñ„Ð¾Ñ€Ð¼Ð° Ð´Ð»Ñ Ð¿Ñ€Ð¾ÐµÐºÑ‚Ð°.", "symbols/Framework/choices/net8.0/description": "Ð¦ÐµÐ»ÐµÐ²Ð°Ñ net8.0", + "symbols/UserSecretsId/description": "The ID to use for secrets (use with Individual auth).", "symbols/skipRestore/description": "ЕÑли уÑтановлено, автоматичеÑкое воÑÑтановление проекта при Ñоздании пропуÑкаетÑÑ.", "symbols/ExcludeLaunchSettings/description": "Следует ли иÑключить launchSettings.json из Ñозданного шаблона.", "symbols/kestrelHttpPort/description": "Ðомер порта, иÑпользуемый Ð´Ð»Ñ ÐºÐ¾Ð½ÐµÑ‡Ð½Ð¾Ð¹ точки HTTP в launchSettings.json.", @@ -29,6 +30,10 @@ "symbols/IncludeSampleContent/displayName": "_Включить примеры Ñтраниц", "symbols/IncludeSampleContent/description": "ÐаÑтраивает, Ñледует ли добавлÑÑ‚ÑŒ примеры Ñтраниц и Ñтили Ð´Ð»Ñ Ð´ÐµÐ¼Ð¾Ð½Ñтрации базовых шаблонов иÑпользованиÑ.", "symbols/Empty/description": "ÐаÑтраивает, Ñледует ли пропуÑкать примеры Ñтраниц и Ñтили, демонÑтрирующие базовые шаблоны иÑпользованиÑ.", + "symbols/auth/choices/None/description": "No authentication", + "symbols/auth/choices/Individual/description": "Individual authentication", + "symbols/auth/description": "The type of authentication to use", + "symbols/UseLocalDB/description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual is specified.", "symbols/AllInteractive/displayName": "_Enable interactive rendering globally throughout the site", "symbols/AllInteractive/description": "Configures whether to make every page interactive by applying an interactive render mode at the top level. If false, pages will use static server rendering by default, and can be marked interactive on a per-page or per-component basis.", "symbols/NoHttps/description": "Следует ли отключить HTTPS. Этот параметр применÑетÑÑ, только еÑли Ð´Ð»Ñ --auth не иÑпользуютÑÑ Individual, IndividualB2C, SingleOrg или MultiOrg.", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.tr.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.tr.json index 5299f026392a..ae3be7fb7b06 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.tr.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.tr.json @@ -4,6 +4,7 @@ "description": "Hem sunucu tarafı iÅŸlemeyi hem de istemci etkileÅŸimini destekleyen bir Blazor web uygulaması oluÅŸturmaya yönelik proje ÅŸablonu. Bu ÅŸablon, zengin dinamik kullanıcı arabirimlerine (UI) sahip web uygulamaları için kullanılabilir.", "symbols/Framework/description": "Projenin hedef çerçevesi.", "symbols/Framework/choices/net8.0/description": "Hedef net8.0", + "symbols/UserSecretsId/description": "The ID to use for secrets (use with Individual auth).", "symbols/skipRestore/description": "Belirtilirse, oluÅŸturma sırasında projenin otomatik geri yüklenmesini atlar.", "symbols/ExcludeLaunchSettings/description": "launchSettings.json öğesinin oluÅŸturulan ÅŸablondan dışlanıp dışlanmayacağı.", "symbols/kestrelHttpPort/description": "launchSettings.json içinde HTTP uç noktası için kullanılacak baÄŸlantı noktası numarası.", @@ -29,6 +30,10 @@ "symbols/IncludeSampleContent/displayName": "Örnek _sayfalar ekle", "symbols/IncludeSampleContent/description": "Temel kullanım düzenlerini göstermek için örnek sayfaların ve stil oluÅŸturma özelliklerinin eklenip eklenmeyeceÄŸini yapılandırır.", "symbols/Empty/description": "Temel kullanım düzenlerini gösteren örnek sayfaların ve stil oluÅŸturma özelliklerinin atlanıp atlanmayacağını yapılandırır.", + "symbols/auth/choices/None/description": "No authentication", + "symbols/auth/choices/Individual/description": "Individual authentication", + "symbols/auth/description": "The type of authentication to use", + "symbols/UseLocalDB/description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual is specified.", "symbols/AllInteractive/displayName": "_Enable interactive rendering globally throughout the site", "symbols/AllInteractive/description": "Configures whether to make every page interactive by applying an interactive render mode at the top level. If false, pages will use static server rendering by default, and can be marked interactive on a per-page or per-component basis.", "symbols/NoHttps/description": "HTTPS'nin kapatılıp kapatılmayacağı. Bu seçenek yalnızca Bireysel, IndividualB2C, SingleOrg veya MultiOrg -- auth için kullanılmazsa geçerlidir.", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.zh-Hans.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.zh-Hans.json index 27bbe0d23ea5..b17c3da9b57a 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.zh-Hans.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.zh-Hans.json @@ -4,6 +4,7 @@ "description": "用于创建支æŒæœåŠ¡å™¨ç«¯å‘ˆçŽ°å’Œå®¢æˆ·ç«¯äº¤äº’çš„ Blazor Web 应用的项目模æ¿ã€‚此模æ¿å¯ç”¨äºŽå…·æœ‰ä¸°å¯ŒåŠ¨æ€ç”¨æˆ·ç•Œé¢ (UI) çš„ Web 应用。", "symbols/Framework/description": "项目的目标框架。", "symbols/Framework/choices/net8.0/description": "目标 net8.0", + "symbols/UserSecretsId/description": "The ID to use for secrets (use with Individual auth).", "symbols/skipRestore/description": "如果指定,则在创建时跳过项目的自动还原。", "symbols/ExcludeLaunchSettings/description": "是å¦ä»Žç”Ÿæˆçš„模æ¿ä¸­æŽ’除 launchSettings.json。", "symbols/kestrelHttpPort/description": "è¦ç”¨äºŽ launchSettings.json 中 HTTP 终结点的端å£å·ã€‚", @@ -29,6 +30,10 @@ "symbols/IncludeSampleContent/displayName": "包å«ç¤ºä¾‹é¡µ(_I)", "symbols/IncludeSampleContent/description": "é…置是å¦æ·»åŠ ç¤ºä¾‹é¡µå’Œæ ·å¼ä»¥æ¼”示基本使用模å¼ã€‚", "symbols/Empty/description": "é…置是å¦å¿½ç•¥æ¼”示基本使用模å¼çš„示例页和样å¼ã€‚", + "symbols/auth/choices/None/description": "No authentication", + "symbols/auth/choices/Individual/description": "Individual authentication", + "symbols/auth/description": "The type of authentication to use", + "symbols/UseLocalDB/description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual is specified.", "symbols/AllInteractive/displayName": "_Enable interactive rendering globally throughout the site", "symbols/AllInteractive/description": "Configures whether to make every page interactive by applying an interactive render mode at the top level. If false, pages will use static server rendering by default, and can be marked interactive on a per-page or per-component basis.", "symbols/NoHttps/description": "是å¦ç¦ç”¨ HTTPS。仅当 Individualã€IndividualB2Cã€SingleOrg 或 MultiOrg ä¸ç”¨äºŽ --auth 时,此选项æ‰é€‚用。", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.zh-Hant.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.zh-Hant.json index f1c7a0d88ba7..5155a158b99b 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.zh-Hant.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.zh-Hant.json @@ -4,6 +4,7 @@ "description": "用於建立åŒæ™‚支æ´ä¼ºæœå™¨ç«¯è½‰è­¯å’Œç”¨æˆ¶ç«¯äº’å‹•çš„ Blazor Web 應用程å¼çš„專案範本。此範本å¯ç”¨æ–¼å…·æœ‰è±å¯Œå‹•æ…‹ä½¿ç”¨è€…ä»‹é¢ (UI) çš„ Web 應用程å¼ã€‚", "symbols/Framework/description": "專案的目標 Framework。", "symbols/Framework/choices/net8.0/description": "目標 net8.0", + "symbols/UserSecretsId/description": "The ID to use for secrets (use with Individual auth).", "symbols/skipRestore/description": "若指定,會在建立時跳éŽå°ˆæ¡ˆçš„自動還原。", "symbols/ExcludeLaunchSettings/description": "是å¦è¦å¾žç”¢ç”Ÿçš„範本排除 launchSettings.json。", "symbols/kestrelHttpPort/description": "launchSettings.json 中 HTTP 端點è¦ä½¿ç”¨çš„連接埠號碼。", @@ -29,6 +30,10 @@ "symbols/IncludeSampleContent/displayName": "包å«ç¯„例é é¢(_I)", "symbols/IncludeSampleContent/description": "設定是å¦è¦æ–°å¢žç¯„例é é¢å’Œæ¨£å¼ï¼Œä»¥ç¤ºç¯„基本使用模å¼ã€‚", "symbols/Empty/description": "設定是å¦è¦çœç•¥ç¯„例é é¢å’Œæ¨£å¼ï¼Œå…¶ç¤ºç¯„基本使用模å¼ã€‚", + "symbols/auth/choices/None/description": "No authentication", + "symbols/auth/choices/Individual/description": "Individual authentication", + "symbols/auth/description": "The type of authentication to use", + "symbols/UseLocalDB/description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual is specified.", "symbols/AllInteractive/displayName": "_Enable interactive rendering globally throughout the site", "symbols/AllInteractive/description": "Configures whether to make every page interactive by applying an interactive render mode at the top level. If false, pages will use static server rendering by default, and can be marked interactive on a per-page or per-component basis.", "symbols/NoHttps/description": "是å¦è¦é—œé–‰ HTTPS。åªæœ‰ç•¶ Individualã€IndividualB2Cã€SingleOrg 或 MultiOrg 未用於 --auth 時,æ‰é©ç”¨æ­¤é¸é …。", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/template.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/template.json index 971eb62028ba..9356b1e5a7a1 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/template.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/template.json @@ -14,7 +14,8 @@ "guids": [ "4C26868E-5E7C-458D-82E3-040509D0C71F", "5990939C-7E7B-4CFA-86FF-44CA5756498A", - "650B3CE7-2E93-4CC4-9F46-466686815EAA" + "650B3CE7-2E93-4CC4-9F46-466686815EAA", + "53bc9b9d-9d6a-45d4-8429-2a2761773502" ], "identity": "Microsoft.Web.Blazor.CSharp.8.0", "thirdPartyNotices": "https://aka.ms/aspnetcore/8.0-third-party-notices", @@ -108,6 +109,86 @@ "BlazorWeb-CSharp.Client/Pages/**", "BlazorWeb-CSharp.Client/wwwroot/**" ] + }, + { + "condition": "(!IndividualLocalAuth)", + "exclude": [ + "BlazorWeb-CSharp/Components/Identity/**", + "BlazorWeb-CSharp/Components/Layout/ManageLayout.razor", + "BlazorWeb-CSharp/Components/Layout/ManageNavMenu.razor", + "BlazorWeb-CSharp/Components/Pages/Account/**", + "BlazorWeb-CSharp/Data/**", + "BlazorWeb-CSharp/Identity/**", + "BlazorWeb-CSharp.Client/PersistentAuthenticationStateProvider.cs", + "BlazorWeb-CSharp.Client/UserInfo.cs", + "BlazorWeb-CSharp.Client/Pages/Auth.razor" + ] + }, + { + "condition": "(!(IndividualLocalAuth && !UseLocalDB))", + "exclude": [ + "BlazorWeb-CSharp/app.db" + ] + }, + { + "condition": "(!(IndividualLocalAuth && !UseWebAssembly))", + "exclude": [ + "BlazorWeb-CSharp/Components/Pages/Auth.razor" + ] + }, + { + "condition": "(!(IndividualLocalAuth && UseServer && UseWebAssembly))", + "exclude": [ + "BlazorWeb-CSharp/Identity/PersistingRevalidatingAuthenticationStateProvider.cs" + ] + }, + { + "condition": "(!(IndividualLocalAuth && UseServer && !UseWebAssembly))", + "exclude": [ + "BlazorWeb-CSharp/Identity/IdentityRevalidatingAuthenticationStateProvider.cs" + ] + }, + { + "condition": "(!(IndividualLocalAuth && !UseServer && UseWebAssembly))", + "exclude": [ + "BlazorWeb-CSharp/Identity/PersistingServerAuthenticationStateProvider.cs" + ] + }, + { + "condition": "(IndividualLocalAuth && UseLocalDB && UseWebAssembly)", + "rename": { + "BlazorWeb-CSharp/Data/SqlServer/": "BlazorWeb-CSharp/Data/Migrations/" + }, + "exclude": [ + "BlazorWeb-CSharp/Data/SqlLite/**" + ] + }, + { + "condition": "(IndividualLocalAuth && UseLocalDB && !UseWebAssembly)", + "rename": { + "BlazorWeb-CSharp/Data/SqlServer/": "Data/Migrations/" + }, + "exclude": [ + "BlazorWeb-CSharp/Data/SqlLite/**" + ] + }, + { + "condition": "(IndividualLocalAuth && !UseLocalDB && UseWebAssembly)", + "rename": { + "BlazorWeb-CSharp/Data/SqlLite/": "BlazorWeb-CSharp/Data/Migrations/" + }, + "exclude": [ + "BlazorWeb-CSharp/Data/SqlServer/**" + ] + }, + { + "condition": "(IndividualLocalAuth && !UseLocalDB && !UseWebAssembly)", + "rename": { + "BlazorWeb-CSharp/Data/SqlLite/": "Data/Migrations/" + }, + "exclude": [ + "BlazorWeb-CSharp/Data/SqlServer/**" + ] } ] } @@ -130,6 +211,13 @@ "type": "bind", "binding": "HostIdentifier" }, + "UserSecretsId": { + "type": "parameter", + "datatype": "string", + "replaces": "aspnet-BlazorWeb-CSharp-53bc9b9d-9d6a-45d4-8429-2a2761773502", + "defaultValue": "aspnet-BlazorWeb-CSharp-53bc9b9d-9d6a-45d4-8429-2a2761773502", + "description": "The ID to use for secrets (use with Individual auth)." + }, "skipRestore": { "type": "parameter", "datatype": "bool", @@ -167,7 +255,7 @@ "kestrelHttpsPort": { "type": "parameter", "datatype": "integer", - "description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if either IndividualAuth or OrganizationalAuth is used)." + "description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if Individual auth is used)." }, "kestrelHttpsPortGenerated": { "type": "generated", @@ -207,7 +295,7 @@ "iisHttpsPort": { "type": "parameter", "datatype": "integer", - "description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if either IndividualAuth or OrganizationalAuth is used)." + "description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if Individual auth is used)." }, "iisHttpsPortGenerated": { "type": "generated", @@ -261,7 +349,7 @@ "defaultValue": "InteractivePerPage", "displayName": "_Interactivity location", "description": "Chooses which components will have interactive rendering enabled", - "isEnabled": "(InteractivityPlatform != \"None\")", + "isEnabled": "(InteractivityPlatform != \"None\" && auth == \"None\")", "choices": [ { "choice": "InteractivePerPage", @@ -296,6 +384,28 @@ "defaultValue": "false", "description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns." }, + "auth": { + "type": "parameter", + "datatype": "choice", + "choices": [ + { + "choice": "None", + "description": "No authentication" + }, + { + "choice": "Individual", + "description": "Individual authentication" + } + ], + "defaultValue": "None", + "description": "The type of authentication to use" + }, + "UseLocalDB": { + "type": "parameter", + "datatype": "bool", + "defaultValue": "false", + "description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual is specified." + }, "SampleContent": { "type": "computed", "value": "(((IncludeSampleContent && (HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\"))) || ((!Empty && (HostIdentifier == \"dotnetcli\" || HostIdentifier == \"dotnetcli-preview\"))))" @@ -303,7 +413,7 @@ "AllInteractive": { "type": "parameter", "datatype": "bool", - "isEnabled": "(InteractivityPlatform != \"None\")", + "isEnabled": "(InteractivityPlatform != \"None\" && auth == \"None\")", "defaultValue": "false", "displayName": "_Enable interactive rendering globally throughout the site", "description": "Configures whether to make every page interactive by applying an interactive render mode at the top level. If false, pages will use static server rendering by default, and can be marked interactive on a per-page or per-component basis." @@ -312,9 +422,13 @@ "type": "computed", "value": "(InteractivityLocation == \"InteractiveGlobal\" || AllInteractive)" }, + "IndividualLocalAuth": { + "type": "computed", + "value": "(auth == \"Individual\")" + }, "RequiresHttps": { "type": "computed", - "value": "(OrganizationalAuth || IndividualAuth)" + "value": "(OrganizationalAuth || IndividualLocalAuth)" }, "HasHttpProfile": { "type": "computed", @@ -328,7 +442,7 @@ "type": "parameter", "datatype": "bool", "defaultValue": "false", - "description": "Whether to turn off HTTPS. This option only applies if Individual, IndividualB2C, SingleOrg, or MultiOrg aren't used for --auth." + "description": "Whether to turn off HTTPS. This option only applies if Individual isn't used for --auth." }, "copyrightYear": { "type": "generated", diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/Pages/Auth.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/Pages/Auth.razor new file mode 100644 index 000000000000..ebeeeccea168 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/Pages/Auth.razor @@ -0,0 +1,18 @@ +@page "/auth" + +@using Microsoft.AspNetCore.Authorization + +@attribute [Authorize] +@*#if (UseServer && !InteractiveAtRoot) +@attribute [RenderModeInteractiveAuto] +##elseif (!InteractiveAtRoot) +@attribute [RenderModeInteractiveWebAssembly] +##endif*@ + +Auth + +

You are authenticated

+ + + Hello @context.User.Identity?.Name! + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/PersistentAuthenticationStateProvider.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/PersistentAuthenticationStateProvider.cs new file mode 100644 index 000000000000..4f8e698ea75d --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/PersistentAuthenticationStateProvider.cs @@ -0,0 +1,29 @@ +using System.Security.Claims; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Authorization; + +namespace BlazorWeb_CSharp.Client; + +public class PersistentAuthenticationStateProvider(PersistentComponentState persistentState) : AuthenticationStateProvider +{ + private static readonly Task _unauthenticatedTask = + Task.FromResult(new AuthenticationState(new ClaimsPrincipal(new ClaimsIdentity()))); + + public override Task GetAuthenticationStateAsync() + { + if (!persistentState.TryTakeFromJson(nameof(UserInfo), out var userInfo) || userInfo is null) + { + return _unauthenticatedTask; + } + + Claim[] claims = [ + new Claim(ClaimTypes.NameIdentifier, userInfo.UserId), + new Claim(ClaimTypes.Name, userInfo.Email), + new Claim(ClaimTypes.Email, userInfo.Email) ]; + + return Task.FromResult( + new AuthenticationState(new ClaimsPrincipal(new ClaimsIdentity(claims, + authenticationType: nameof(PersistentAuthenticationStateProvider))))); + } +} + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/Program.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/Program.cs index 519269f21bb8..600e37d36537 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/Program.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/Program.cs @@ -1,5 +1,15 @@ +#if (IndividualLocalAuth) +using BlazorWeb_CSharp.Client; +using Microsoft.AspNetCore.Components.Authorization; +#endif using Microsoft.AspNetCore.Components.WebAssembly.Hosting; var builder = WebAssemblyHostBuilder.CreateDefault(args); +#if (IndividualLocalAuth) +builder.Services.AddAuthorizationCore(); +builder.Services.AddCascadingAuthenticationState(); +builder.Services.AddSingleton(); + +#endif await builder.Build().RunAsync(); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/UserInfo.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/UserInfo.cs new file mode 100644 index 000000000000..236bbaa720da --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/UserInfo.cs @@ -0,0 +1,7 @@ +namespace BlazorWeb_CSharp.Client; + +public class UserInfo +{ + public required string UserId { get; set; } + public required string Email { get; set; } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/_Imports.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/_Imports.razor index 5268e26fd6aa..cd618a113368 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/_Imports.razor +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/_Imports.razor @@ -1,5 +1,8 @@ @using System.Net.Http @using System.Net.Http.Json +@*#if (IndividualLocalAuth) +@using Microsoft.AspNetCore.Components.Authorization +##endif*@ @using Microsoft.AspNetCore.Components.Forms @using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Web diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Identity/ExternalLoginPicker.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Identity/ExternalLoginPicker.razor new file mode 100644 index 000000000000..5c33681f7021 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Identity/ExternalLoginPicker.razor @@ -0,0 +1,47 @@ +@using Microsoft.AspNetCore.Authentication +@using Microsoft.AspNetCore.Identity +@using BlazorWeb_CSharp.Components.Pages.Account +@using BlazorWeb_CSharp.Data +@using BlazorWeb_CSharp.Identity + +@inject SignInManager SignInManager +@inject IdentityRedirectManager RedirectManager + +@if ((_externalLogins?.Count ?? 0) == 0) +{ +
+

+ There are no external authentication services configured. See this article + about setting up this ASP.NET application to support logging in via external services. +

+
+} +else +{ +
+
+ + +

+ @foreach (var provider in _externalLogins!) + { + + } +

+
+
+} + +@code { + private IList? _externalLogins; + + [SupplyParameterFromQuery] + private string ReturnUrl { get; set; } = default!; + + protected override async Task OnInitializedAsync() + { + ReturnUrl ??= "/"; + + _externalLogins = (await SignInManager.GetExternalAuthenticationSchemesAsync()).ToList(); + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Identity/LogoutForm.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Identity/LogoutForm.razor new file mode 100644 index 000000000000..a08c78fc4cdc --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Identity/LogoutForm.razor @@ -0,0 +1,34 @@ +@using Microsoft.AspNetCore.Identity +@using BlazorWeb_CSharp.Data +@using BlazorWeb_CSharp.Identity + +@inject SignInManager SignInManager +@inject NavigationManager NavigationManager +@inject IdentityRedirectManager RedirectManager + +
+ + + + +@code { + [Parameter(CaptureUnmatchedValues = true)] + public IDictionary? AdditionalAttributes { get; set; } + + [SupplyParameterFromForm] + private string? ReturnUrl { get; set; } + + [CascadingParameter] + private HttpContext HttpContext { get; set; } = default!; + + private async Task OnSubmitAsync() + { + var user = HttpContext.User; + + if (SignInManager.IsSignedIn(user)) + { + await SignInManager.SignOutAsync(); + RedirectManager.RedirectTo(ReturnUrl ?? "/"); + } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Identity/ShowRecoveryCodes.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Identity/ShowRecoveryCodes.razor new file mode 100644 index 000000000000..cebec61aef19 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Identity/ShowRecoveryCodes.razor @@ -0,0 +1,32 @@ + +

Recovery codes

+ +
+
+ @for (var row = 0; row < RecoveryCodes.Length; row += 2) + { + @RecoveryCodes[row] + +   + + @RecoveryCodes[row + 1] + +
+ } +
+
+ +@code { + [Parameter] + public string[] RecoveryCodes { get; set; } = default!; + + [Parameter] + public string StatusMessage { get; set; } = default!; +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Identity/StatusMessage.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Identity/StatusMessage.razor new file mode 100644 index 000000000000..43bcdc0478b6 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Identity/StatusMessage.razor @@ -0,0 +1,29 @@ +@using BlazorWeb_CSharp.Identity + +@{ + var message = Message ?? MessageFromCookie; + + if (MessageFromCookie is not null) + { + HttpContext.Response.Cookies.Delete(IdentityRedirectManager.StatusCookieName); + } +} + +@if (!string.IsNullOrEmpty(message)) +{ + var statusMessageClass = message.StartsWith("Error") ? "danger" : "success"; + +} + +@code { + [Parameter] + public string? Message { get; set; } + + [CascadingParameter] + private HttpContext HttpContext { get; set; } = default!; + + private string? MessageFromCookie => HttpContext.Request.Cookies[IdentityRedirectManager.StatusCookieName]; +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/ManageLayout.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/ManageLayout.razor new file mode 100644 index 000000000000..e4a7871bbc75 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/ManageLayout.razor @@ -0,0 +1,17 @@ +@inherits LayoutComponentBase +@layout MainLayout + +

Manage your account

+ +
+

Change your account settings

+
+
+
+ +
+
+ @Body +
+
+
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/ManageNavMenu.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/ManageNavMenu.razor new file mode 100644 index 000000000000..8ffd7cd0a41e --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/ManageNavMenu.razor @@ -0,0 +1,37 @@ +@using Microsoft.AspNetCore.Identity; +@using BlazorWeb_CSharp.Data; + +@inject SignInManager SignInManager; + + + +@code { + private bool _hasExternalLogins; + + protected override async Task OnInitializedAsync() + { + _hasExternalLogins = (await SignInManager.GetExternalAuthenticationSchemesAsync()).Any(); + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/NavMenu.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/NavMenu.razor index 5b141a54826b..5b38b21d63a7 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/NavMenu.razor +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/NavMenu.razor @@ -1,4 +1,8 @@ - diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/NavMenu.razor.css b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/NavMenu.razor.css index 95fcc36e0baa..14bddcebe4cf 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/NavMenu.razor.css +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/NavMenu.razor.css @@ -46,6 +46,28 @@ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E"); } +/*#if (IndividualLocalAuth)*/ +.bi-lock { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2zM5 8h6a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1z'/%3E%3C/svg%3E"); +} + +.bi-person { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-person' viewBox='0 0 16 16'%3E%3Cpath d='M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4Zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10Z'/%3E%3C/svg%3E"); +} + +.bi-person-badge { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-person-badge' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1h-3zM11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0z'/%3E%3Cpath d='M4.5 0A2.5 2.5 0 0 0 2 2.5V14a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V2.5A2.5 2.5 0 0 0 11.5 0h-7zM3 2.5A1.5 1.5 0 0 1 4.5 1h7A1.5 1.5 0 0 1 13 2.5v10.795a4.2 4.2 0 0 0-.776-.492C11.392 12.387 10.063 12 8 12s-3.392.387-4.224.803a4.2 4.2 0 0 0-.776.492V2.5z'/%3E%3C/svg%3E"); +} + +.bi-person-fill { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-person-fill' viewBox='0 0 16 16'%3E%3Cpath d='M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3Zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z'/%3E%3C/svg%3E"); +} + +.bi-arrow-bar-left { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-arrow-bar-left' viewBox='0 0 16 16'%3E%3Cpath d='M12.5 15a.5.5 0 0 1-.5-.5v-13a.5.5 0 0 1 1 0v13a.5.5 0 0 1-.5.5ZM10 8a.5.5 0 0 1-.5.5H3.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L3.707 7.5H9.5a.5.5 0 0 1 .5.5Z'/%3E%3C/svg%3E"); +} + +/*#endif*/ .nav-item { font-size: 0.9rem; padding-bottom: 0.5rem; diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ConfirmEmail.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ConfirmEmail.razor new file mode 100644 index 000000000000..992c6c59694f --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ConfirmEmail.razor @@ -0,0 +1,49 @@ +@page "/Account/ConfirmEmail" + +@using System.Text +@using Microsoft.AspNetCore.Identity +@using Microsoft.AspNetCore.WebUtilities +@using BlazorWeb_CSharp.Data +@using BlazorWeb_CSharp.Identity + +@inject UserManager UserManager +@inject IdentityRedirectManager RedirectManager + +Confirm email + +

Confirm email

+ + +@code { + string? statusMessage; + + [SupplyParameterFromQuery] + public string? UserId { get; set; } + + [SupplyParameterFromQuery] + public string? Code { get; set; } + + protected override async Task OnInitializedAsync() + { + if (UserId == null || Code == null) + { + RedirectManager.RedirectTo("/"); + } + else + { + var user = await UserManager.FindByIdAsync(UserId); + if (user == null) + { + // Need a way to trigger a 404 from Blazor: https://github.com/dotnet/aspnetcore/issues/45654 + statusMessage = $"Error loading user with ID {UserId}"; + } + else + { + + var code = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(Code)); + var result = await UserManager.ConfirmEmailAsync(user, code); + statusMessage = result.Succeeded ? "Thank you for confirming your email." : "Error confirming your email."; + } + } + } +} \ No newline at end of file diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ConfirmEmailChange.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ConfirmEmailChange.razor new file mode 100644 index 000000000000..510fb2d0e93f --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ConfirmEmailChange.razor @@ -0,0 +1,64 @@ +@page "/Account/ConfirmEmailChange" + +@using System.Text +@using Microsoft.AspNetCore.Identity +@using Microsoft.AspNetCore.WebUtilities +@using BlazorWeb_CSharp.Data +@using BlazorWeb_CSharp.Identity + +@inject UserManager UserManager +@inject SignInManager SignInManager +@inject UserAccessor UserAccessor +@inject IdentityRedirectManager RedirectManager + +Confirm email change + +

Confirm email change

+ + + +@code { + private string? _message; + private ApplicationUser _user = default!; + + [SupplyParameterFromQuery] + private string? UserId { get; set; } + + [SupplyParameterFromQuery] + private string? Email { get; set; } + + [SupplyParameterFromQuery] + private string? Code { get; set; } + + protected override async Task OnInitializedAsync() + { + if (UserId is null || Email is null || Code is null) + { + RedirectManager.RedirectToWithStatus( + "/Account/Login", "Error: Invalid email change confirmation link."); + return; + } + + _user = await UserAccessor.GetRequiredUserAsync(); + + var code = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(Code)); + var result = await UserManager.ChangeEmailAsync(_user, Email, code); + if (!result.Succeeded) + { + _message = "Error changing email."; + return; + } + + // In our UI email and user name are one and the same, so when we update the email + // we need to update the user name. + var setUserNameResult = await UserManager.SetUserNameAsync(_user, Email); + if (!setUserNameResult.Succeeded) + { + _message = "Error changing user name."; + return; + } + + await SignInManager.RefreshSignInAsync(_user); + _message = "Thank you for confirming your email change."; + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ExternalLogin.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ExternalLogin.razor new file mode 100644 index 000000000000..51bfa81fc116 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ExternalLogin.razor @@ -0,0 +1,213 @@ +@page "/Account/ExternalLogin" + +@using System.ComponentModel.DataAnnotations +@using System.Security.Claims +@using System.Text +@using System.Text.Encodings.Web +@using Microsoft.AspNetCore.Identity +@using Microsoft.AspNetCore.Identity.UI.Services +@using Microsoft.AspNetCore.WebUtilities +@using BlazorWeb_CSharp.Data +@using BlazorWeb_CSharp.Identity + +@inject SignInManager SignInManager +@inject UserManager UserManager +@inject IUserStore UserStore +@inject IEmailSender EmailSender +@inject NavigationManager NavigationManager +@inject IdentityRedirectManager RedirectManager +@inject ILogger Logger + +@{ + var providerDisplayName = _externalLoginInfo.ProviderDisplayName; +} + +Register + + +

Register

+

Associate your @providerDisplayName account.

+
+ +
+ You've successfully authenticated with @providerDisplayName. + Please enter an email address for this site below and click the Register button to finish + logging in. +
+ +
+
+ + + +
+ + + +
+ +
+
+
+ +@code { + public const string LoginCallbackAction = "LoginCallback"; + + private string? _message; + private ExternalLoginInfo _externalLoginInfo = default!; + private IUserEmailStore _emailStore = default!; + + [SupplyParameterFromQuery] + private string? RemoteError { get; set; } + + [CascadingParameter] + public HttpContext HttpContext { get; set; } = default!; + + [SupplyParameterFromForm] + private InputModel Input { get; set; } = default!; + + [SupplyParameterFromQuery] + private string ReturnUrl { get; set; } = default!; + + [SupplyParameterFromQuery] + private string? Action { get; set; } = default!; + + protected override async Task OnInitializedAsync() + { + Input ??= new(); + ReturnUrl ??= "/"; + + if (RemoteError is not null) + { + RedirectManager.RedirectToWithStatus("/Account/Login", "Error from external provider: " + RemoteError); + return; + } + + var externalLoginInfo = await SignInManager.GetExternalLoginInfoAsync(); + if (externalLoginInfo is null) + { + RedirectManager.RedirectToWithStatus("/Account/Login", "Error loading external login information."); + return; + } + + _externalLoginInfo = externalLoginInfo; + _emailStore = GetEmailStore(); + + if (HttpMethods.IsGet(HttpContext.Request.Method)) + { + if (Action == LoginCallbackAction) + { + await OnLoginCallbackAsync(); + return; + } + + // We should only reach this page via the login callback, so redirect back to + // the login page if we get here some other way. + RedirectManager.RedirectTo("/Account/Login"); + return; + } + } + + private async Task OnLoginCallbackAsync() + { + // Sign in the user with this external login provider if the user already has a login. + var result = await SignInManager.ExternalLoginSignInAsync( + _externalLoginInfo.LoginProvider, + _externalLoginInfo.ProviderKey, + isPersistent: false, + bypassTwoFactor: true); + if (result.Succeeded) + { + Logger.LogInformation( + "{Name} logged in with {LoginProvider} provider.", + _externalLoginInfo.Principal.Identity?.Name, + _externalLoginInfo.LoginProvider); + RedirectManager.RedirectTo(ReturnUrl); + return; + } + + if (result.IsLockedOut) + { + RedirectManager.RedirectTo("/Account/Lockout"); + return; + } + + // If the user does not have an account, then ask the user to create an account. + if (_externalLoginInfo.Principal.HasClaim(c => c.Type == ClaimTypes.Email)) + { + Input.Email = _externalLoginInfo.Principal.FindFirstValue(ClaimTypes.Email); + } + } + + private async Task OnValidSubmitAsync() + { + var user = CreateUser(); + + await UserStore.SetUserNameAsync(user, Input.Email, CancellationToken.None); + await _emailStore.SetEmailAsync(user, Input.Email, CancellationToken.None); + + var result = await UserManager.CreateAsync(user); + if (result.Succeeded) + { + result = await UserManager.AddLoginAsync(user, _externalLoginInfo); + if (result.Succeeded) + { + Logger.LogInformation("User created an account using {Name} provider.", _externalLoginInfo.LoginProvider); + + var userId = await UserManager.GetUserIdAsync(user); + var code = await UserManager.GenerateEmailConfirmationTokenAsync(user); + code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); + + var callbackUrl = NavigationManager.GetUriWithQueryParameters( + $"{NavigationManager.BaseUri}Account/ConfirmEmail", + new Dictionary { { "userId", userId }, { "code", code } }); + await EmailSender.SendEmailAsync(Input.Email!, "Confirm your email", + $"Please confirm your account by clicking here."); + + // If account confirmation is required, we need to show the link if we don't have a real email sender + if (UserManager.Options.SignIn.RequireConfirmedAccount) + { + RedirectManager.RedirectTo("/Account/RegisterConfirmation", new() { ["Email"] = Input.Email }); + return; + } + + await SignInManager.SignInAsync(user, isPersistent: false, _externalLoginInfo.LoginProvider); + RedirectManager.RedirectTo(ReturnUrl); + return; + } + } + else + { + _message = $"Error: {string.Join(",", result.Errors.Select(error => error.Description))}"; + } + } + + private ApplicationUser CreateUser() + { + try + { + return Activator.CreateInstance(); + } + catch + { + throw new InvalidOperationException($"Can't create an instance of '{nameof(ApplicationUser)}'. " + + $"Ensure that '{nameof(ApplicationUser)}' is not an abstract class and has a parameterless constructor"); + } + } + + private IUserEmailStore GetEmailStore() + { + if (!UserManager.SupportsUserEmail) + { + throw new NotSupportedException("The default UI requires a user store with email support."); + } + return (IUserEmailStore)UserStore; + } + + private sealed class InputModel + { + [Required] + [EmailAddress] + public string? Email { get; set; } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ForgotPassword.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ForgotPassword.razor new file mode 100644 index 000000000000..605a676daad5 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ForgotPassword.razor @@ -0,0 +1,74 @@ +@page "/Account/ForgotPassword" + +@using System.ComponentModel.DataAnnotations +@using System.Text +@using System.Text.Encodings.Web +@using Microsoft.AspNetCore.Identity +@using Microsoft.AspNetCore.Identity.UI.Services +@using Microsoft.AspNetCore.WebUtilities +@using BlazorWeb_CSharp.Data +@using BlazorWeb_CSharp.Identity + +@inject NavigationManager NavigationManager +@inject IdentityRedirectManager RedirectManager +@inject UserManager UserManager +@inject IEmailSender EmailSender + +Forgot your password? + +

Forgot your password?

+

Enter your email.

+
+
+
+ + + + +
+ + + +
+ +
+
+
+ +@code { + [SupplyParameterFromForm] + private InputModel Input { get; set; } = new(); + + private async Task OnValidSubmitAsync() + { + var user = await UserManager.FindByEmailAsync(Input.Email); + if (user is null || !(await UserManager.IsEmailConfirmedAsync(user))) + { + // Don't reveal that the user does not exist or is not confirmed + RedirectManager.RedirectTo("/Account/ForgotPasswordConfirmation"); + return; + } + + // For more information on how to enable account confirmation and password reset please + // visit https://go.microsoft.com/fwlink/?LinkID=532713 + var code = await UserManager.GeneratePasswordResetTokenAsync(user); + code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); + var callbackUrl = NavigationManager.GetUriWithQueryParameters( + $"{NavigationManager.BaseUri}Account/ResetPassword", + new Dictionary { { "code", code } }); + + await EmailSender.SendEmailAsync( + Input.Email, + "Reset Password", + $"Please reset your password by clicking here."); + + RedirectManager.RedirectTo("/Account/ForgotPasswordConfirmation"); + } + + private sealed class InputModel + { + [Required] + [EmailAddress] + public string Email { get; set; } = default!; + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ForgotPasswordConfirmation.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ForgotPasswordConfirmation.razor new file mode 100644 index 000000000000..38de01d1ec0c --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/ForgotPasswordConfirmation.razor @@ -0,0 +1,8 @@ +@page "/Account/ForgotPasswordConfirmation" + +Forgot password confirmation + +

Forgot password confirmation

+

+ Please check your email to reset your password. +

diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/InvalidPasswordReset.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/InvalidPasswordReset.razor new file mode 100644 index 000000000000..509578bbf82c --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/InvalidPasswordReset.razor @@ -0,0 +1,8 @@ +@page "/Account/InvalidPasswordReset" + +Invalid password reset + +

Invalid password reset

+

+ The password reset link is invalid. +

diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/InvalidUser.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/InvalidUser.razor new file mode 100644 index 000000000000..e61fe5def569 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/InvalidUser.razor @@ -0,0 +1,7 @@ +@page "/Account/InvalidUser" + +Invalid user + +

Invalid user

+ + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Lockout.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Lockout.razor new file mode 100644 index 000000000000..a8d1e0afc7ca --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Lockout.razor @@ -0,0 +1,8 @@ +@page "/Account/Lockout" + +Locked out + +
+

Locked out

+

This account has been locked out, please try again later.

+
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Login.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Login.razor new file mode 100644 index 000000000000..f49edad1beb7 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Login.razor @@ -0,0 +1,133 @@ +@page "/Account/Login" + +@using System.ComponentModel.DataAnnotations +@using System.Text +@using Microsoft.AspNetCore.Authentication +@using Microsoft.AspNetCore.Identity +@using Microsoft.AspNetCore.WebUtilities +@using BlazorWeb_CSharp.Data +@using BlazorWeb_CSharp.Identity + +@inject SignInManager SignInManager +@inject ILogger Logger +@inject NavigationManager NavigationManager +@inject IdentityRedirectManager RedirectManager + +Log in + +

Log in

+
+
+
+ + +

Use a local account to log in.

+
+ +
+ + + +
+
+ + + +
+
+ +
+
+ +
+ +
+
+
+
+
+

Use another service to log in.

+
+ +
+
+
+ +@code { + string? errorMessage; + + [CascadingParameter] + public HttpContext HttpContext { get; set; } = default!; + + [SupplyParameterFromForm] + public InputModel Input { get; set; } = default!; + + [SupplyParameterFromQuery] + public string ReturnUrl { get; set; } = ""; + + public class InputModel + { + [Required] + [EmailAddress] + public string Email { get; set; } = null!; + + [Required] + [DataType(DataType.Password)] + public string Password { get; set; } = null!; + + [Display(Name = "Remember me?")] + public bool RememberMe { get; set; } = false; + } + + protected override async Task OnInitializedAsync() + { + Input ??= new(); + ReturnUrl ??= "/"; + + if (HttpMethods.IsGet(HttpContext.Request.Method)) + { + // Clear the existing external cookie to ensure a clean login process + await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme); + } + } + + public async Task LoginUser() + { + // This doesn't count login failures towards account lockout + // To enable password failures to trigger account lockout, set lockoutOnFailure: true + var result = await SignInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: false); + if (result.Succeeded) + { + Logger.LogInformation("User logged in."); + RedirectManager.RedirectTo(ReturnUrl); + } + if (result.RequiresTwoFactor) + { + RedirectManager.RedirectTo( + "/Account/LoginWith2fa", + new() { ["ReturnUrl"] = ReturnUrl, ["RememberMe"] = Input.RememberMe }); + } + if (result.IsLockedOut) + { + Logger.LogWarning("User account locked out."); + RedirectManager.RedirectTo("/Account/Lockout"); + } + else + { + errorMessage = "Error: Invalid login attempt."; + } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/LoginWith2fa.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/LoginWith2fa.razor new file mode 100644 index 000000000000..b1a650544608 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/LoginWith2fa.razor @@ -0,0 +1,109 @@ +@page "/Account/LoginWith2fa" + +@using System.ComponentModel.DataAnnotations +@using Microsoft.AspNetCore.Identity +@using BlazorWeb_CSharp.Data +@using BlazorWeb_CSharp.Identity + +@inject SignInManager SignInManager +@inject UserManager UserManager +@inject IdentityRedirectManager RedirectManager +@inject ILogger Logger + +Two-factor authentication + +

Two-factor authentication

+
+ +

Your login is protected with an authenticator app. Enter your authenticator code below.

+
+
+ + + + + +
+ + + +
+
+ +
+
+ +
+
+
+
+

+ Don't have access to your authenticator device? You can + log in with a recovery code. +

+ +@code { + private string? _message; + private ApplicationUser _user = default!; + + [SupplyParameterFromForm] + private InputModel Input { get; set; } = default!; + + [SupplyParameterFromQuery] + private string? ReturnUrl { get; set; } + + [SupplyParameterFromQuery] + private bool RememberMe { get; set; } + + protected override async Task OnInitializedAsync() + { + Input ??= new(); + ReturnUrl ??= "/"; + + var user = await SignInManager.GetTwoFactorAuthenticationUserAsync(); + if (user is null) + { + throw new InvalidOperationException($"Unable to load two-factor authentication user."); + } + + _user = user; + } + + private async Task OnValidSubmitAsync() + { + var authenticatorCode = Input.TwoFactorCode!.Replace(" ", string.Empty).Replace("-", string.Empty); + var result = await SignInManager.TwoFactorAuthenticatorSignInAsync(authenticatorCode, RememberMe, Input.RememberMachine); + var userId = await UserManager.GetUserIdAsync(_user); + + if (result.Succeeded) + { + Logger.LogInformation("User with ID '{UserId}' logged in with 2fa.", _user.Id); + RedirectManager.RedirectTo(ReturnUrl ?? "/"); + } + else if (result.IsLockedOut) + { + Logger.LogWarning("User with ID '{UserId}' account locked out.", _user.Id); + RedirectManager.RedirectTo("/Account/Lockout"); + } + else + { + Logger.LogWarning("Invalid authenticator code entered for user with ID '{UserId}'.", _user.Id); + _message = "Error: Invalid authenticator code."; + } + } + + private sealed class InputModel + { + [Required] + [StringLength(7, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] + [DataType(DataType.Text)] + [Display(Name = "Authenticator code")] + public string? TwoFactorCode { get; set; } + + [Display(Name = "Remember this machine")] + public bool RememberMachine { get; set; } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/LoginWithRecoveryCode.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/LoginWithRecoveryCode.razor new file mode 100644 index 000000000000..41d5d3660810 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/LoginWithRecoveryCode.razor @@ -0,0 +1,94 @@ +@page "/Account/LoginWithRecoveryCode" + +@using System.ComponentModel.DataAnnotations +@using Microsoft.AspNetCore.Identity +@using Microsoft.AspNetCore.Mvc +@using BlazorWeb_CSharp.Data +@using BlazorWeb_CSharp.Identity + +@inject SignInManager SignInManager +@inject UserManager UserManager +@inject IdentityRedirectManager RedirectManager +@inject ILogger Logger + +Recovery code verification + +

Recovery code verification

+
+ +

+ You have requested to log in with a recovery code. This login will not be remembered until you provide + an authenticator app code at log in or disable 2FA and log in again. +

+
+
+ + + +
+ + + +
+ +
+
+
+ +@code { + private string? _message; + private ApplicationUser _user = default!; + + [SupplyParameterFromForm] + private InputModel Input { get; set; } = default!; + + [SupplyParameterFromQuery] + private string? ReturnUrl { get; set; } + + protected override async Task OnInitializedAsync() + { + Input ??= new(); + + // Ensure the user has gone through the username & password screen first + var user = await SignInManager.GetTwoFactorAuthenticationUserAsync(); + if (user is null) + { + throw new InvalidOperationException($"Unable to load two-factor authentication user."); + } + + _user = user; + } + + private async Task OnValidSubmitAsync() + { + var recoveryCode = Input.RecoveryCode!.Replace(" ", string.Empty); + + var result = await SignInManager.TwoFactorRecoveryCodeSignInAsync(recoveryCode); + + var userId = await UserManager.GetUserIdAsync(_user); + + if (result.Succeeded) + { + Logger.LogInformation("User with ID '{UserId}' logged in with a recovery code.", _user.Id); + RedirectManager.RedirectTo(ReturnUrl ?? "/"); + } + if (result.IsLockedOut) + { + Logger.LogWarning("User account locked out."); + RedirectManager.RedirectTo("/Account/Lockout"); + } + else + { + Logger.LogWarning("Invalid recovery code entered for user with ID '{UserId}' ", _user.Id); + _message = "Error: Invalid recovery code entered."; + } + } + + private sealed class InputModel + { + [Required] + [DataType(DataType.Text)] + [Display(Name = "Recovery Code")] + public string? RecoveryCode { get; set; } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/ChangePassword.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/ChangePassword.razor new file mode 100644 index 000000000000..aabf71983a62 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/ChangePassword.razor @@ -0,0 +1,97 @@ +@page "/Account/Manage/ChangePassword" + +@using System.ComponentModel.DataAnnotations +@using Microsoft.AspNetCore.Identity +@using BlazorWeb_CSharp.Data +@using BlazorWeb_CSharp.Identity + +@inject UserManager UserManager +@inject SignInManager SignInManager +@inject UserAccessor UserAccessor +@inject IdentityRedirectManager RedirectManager +@inject ILogger Logger + +Change password + +

Change password

+ +
+
+ + + +
+ + + +
+
+ + + +
+
+ + + +
+ +
+
+
+ +@code { + private string? _message; + private ApplicationUser _user = default!; + private bool _hasPassword; + + [SupplyParameterFromForm] + private InputModel Input { get; set; } = default!; + + protected override async Task OnInitializedAsync() + { + Input ??= new(); + + _user = await UserAccessor.GetRequiredUserAsync(); + _hasPassword = await UserManager.HasPasswordAsync(_user); + if (!_hasPassword) + { + RedirectManager.RedirectTo("/Account/Manage/SetPassword"); + return; + } + } + + private async Task OnValidSubmitAsync() + { + var changePasswordResult = await UserManager.ChangePasswordAsync(_user, Input.OldPassword!, Input.NewPassword!); + if (!changePasswordResult.Succeeded) + { + _message = $"Error: {string.Join(",", changePasswordResult.Errors.Select(error => error.Description))}"; + return; + } + + await SignInManager.RefreshSignInAsync(_user); + Logger.LogInformation("User changed their password successfully."); + + RedirectManager.RedirectToCurrentPageWithStatus("Your password has been changed"); + } + + private sealed class InputModel + { + [Required] + [DataType(DataType.Password)] + [Display(Name = "Current password")] + public string? OldPassword { get; set; } + + [Required] + [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] + [DataType(DataType.Password)] + [Display(Name = "New password")] + public string? NewPassword { get; set; } + + [DataType(DataType.Password)] + [Display(Name = "Confirm new password")] + [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] + public string? ConfirmPassword { get; set; } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/DeletePersonalData.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/DeletePersonalData.razor new file mode 100644 index 000000000000..c3ed9c38635a --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/DeletePersonalData.razor @@ -0,0 +1,85 @@ +@page "/Account/Manage/DeletePersonalData" + +@using System.ComponentModel.DataAnnotations +@using Microsoft.AspNetCore.Identity +@using BlazorWeb_CSharp.Data +@using BlazorWeb_CSharp.Identity + +@inject UserManager UserManager +@inject SignInManager SignInManager +@inject UserAccessor UserAccessor +@inject IdentityRedirectManager RedirectManager +@inject ILogger Logger + +Delete Personal Data + + + +

Delete Personal Data

+ + + +
+ + + + @if (_requirePassword) + { +
+ + + +
+ } + +
+
+ +@code { + private string? _message; + private ApplicationUser _user = default!; + private bool _requirePassword; + + [SupplyParameterFromForm] + private InputModel Input { get; set; } = default!; + + protected override async Task OnInitializedAsync() + { + Input ??= new(); + + _user = await UserAccessor.GetRequiredUserAsync(); + _requirePassword = await UserManager.HasPasswordAsync(_user); + } + + private async Task OnValidSubmitAsync() + { + if (_requirePassword && !await UserManager.CheckPasswordAsync(_user, Input.Password!)) + { + _message = "Error: Incorrect password."; + return; + } + + var result = await UserManager.DeleteAsync(_user); + var userId = await UserManager.GetUserIdAsync(_user); + if (!result.Succeeded) + { + throw new InvalidOperationException($"Unexpected error occurred deleting user."); + } + + await SignInManager.SignOutAsync(); + + Logger.LogInformation("User with ID '{UserId}' deleted themselves.", userId); + + RedirectManager.RedirectToCurrentPage(); + } + + private sealed class InputModel + { + [DataType(DataType.Password)] + public string? Password { get; set; } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/Disable2fa.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/Disable2fa.razor new file mode 100644 index 000000000000..562b5ca26577 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/Disable2fa.razor @@ -0,0 +1,68 @@ +@page "/Account/Manage/Disable2fa" + +@using Microsoft.AspNetCore.Identity +@using BlazorWeb_CSharp.Data +@using BlazorWeb_CSharp.Identity + +@inject UserManager UserManager +@inject UserAccessor UserAccessor +@inject IdentityRedirectManager RedirectManager +@inject ILogger Logger + +Disable two-factor authentication (2FA) + + +

Disable two-factor authentication (2FA)

+ + + +
+
+ + + +
+ +@code { + private ApplicationUser _user = default!; + + [CascadingParameter] + private HttpContext HttpContext { get; set; } = default!; + + protected override async Task OnInitializedAsync() + { + _user = await UserAccessor.GetRequiredUserAsync(); + + if (HttpMethods.IsGet(HttpContext.Request.Method)) + { + if (!await UserManager.GetTwoFactorEnabledAsync(_user)) + { + throw new InvalidOperationException($"Cannot disable 2FA for user as it's not currently enabled."); + } + return; + } + } + + private async Task OnSubmitAsync() + { + var disable2faResult = await UserManager.SetTwoFactorEnabledAsync(_user, false); + if (!disable2faResult.Succeeded) + { + throw new InvalidOperationException($"Unexpected error occurred disabling 2FA."); + } + + var userId = await UserManager.GetUserIdAsync(_user); + Logger.LogInformation("User with ID '{UserId}' has disabled 2fa.", userId); + RedirectManager.RedirectToWithStatus( + "/Account/Manage/TwoFactorAuthentication", + "2fa has been disabled. You can reenable 2fa when you setup an authenticator app"); + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/Email.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/Email.razor new file mode 100644 index 000000000000..c629d0a8ee8e --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/Email.razor @@ -0,0 +1,123 @@ +@page "/Account/Manage/Email" + +@using System.ComponentModel.DataAnnotations +@using System.Text +@using System.Text.Encodings.Web +@using Microsoft.AspNetCore.Identity +@using Microsoft.AspNetCore.Identity.UI.Services +@using Microsoft.AspNetCore.WebUtilities +@using BlazorWeb_CSharp.Data +@using BlazorWeb_CSharp.Identity + +@inject UserManager UserManager +@inject UserAccessor UserAccessor +@inject IEmailSender EmailSender +@inject NavigationManager NavigationManager +@inject IdentityRedirectManager RedirectManager + +Manage email + +

Manage email

+ + +
+
+
+ + + + + + @if (_isEmailConfirmed) + { +
+ +
+ ✓ +
+ +
+ } + else + { +
+ + + +
+ } +
+ + + +
+ +
+
+
+ +@code { + private ApplicationUser _user = default!; + private string? _email; + private bool _isEmailConfirmed; + + [SupplyParameterFromForm] + private InputModel Input { get; set; } = default!; + + protected override async Task OnInitializedAsync() + { + Input ??= new(); + + _user = await UserAccessor.GetRequiredUserAsync(); + _email = await UserManager.GetEmailAsync(_user); + _isEmailConfirmed = await UserManager.IsEmailConfirmedAsync(_user); + + Input.NewEmail ??= _email; + } + + private async Task OnValidSubmitAsync() + { + if (Input.NewEmail != _email) + { + var userId = await UserManager.GetUserIdAsync(_user); + var code = await UserManager.GenerateChangeEmailTokenAsync(_user, Input.NewEmail!); + code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); + var callbackUrl = NavigationManager.GetUriWithQueryParameters( + $"{NavigationManager.BaseUri}Account/ConfirmEmailChange", + new Dictionary { { "userId", userId }, { "email", Input.NewEmail }, { "code", code } }); + await EmailSender.SendEmailAsync( + Input.NewEmail!, + "Confirm your email", + $"Please confirm your account by clicking here."); + + RedirectManager.RedirectToCurrentPageWithStatus("Confirmation link to change email sent. Please check your email."); + return; + } + + RedirectManager.RedirectToCurrentPageWithStatus("Your email is unchanged."); + } + + private async Task OnSendEmailVerificationAsync() + { + var userId = await UserManager.GetUserIdAsync(_user); + var code = await UserManager.GenerateEmailConfirmationTokenAsync(_user); + code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); + var callbackUrl = NavigationManager.GetUriWithQueryParameters( + $"{NavigationManager.BaseUri}Account/ConfirmEmail", + new Dictionary { { "userId", userId }, { "code", code } }); + await EmailSender.SendEmailAsync( + _email!, + "Confirm your email", + $"Please confirm your account by clicking here."); + + RedirectManager.RedirectToCurrentPageWithStatus("Verification email sent. Please check your email."); + } + + private sealed class InputModel + { + [Required] + [EmailAddress] + [Display(Name = "New email")] + public string? NewEmail { get; set; } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/EnableAuthenticator.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/EnableAuthenticator.razor new file mode 100644 index 000000000000..52b3f0d68c5a --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/EnableAuthenticator.razor @@ -0,0 +1,174 @@ +@page "/Account/Manage/EnableAuthenticator" + +@using System.ComponentModel.DataAnnotations +@using System.Globalization +@using System.Text +@using System.Text.Encodings.Web +@using Microsoft.AspNetCore.Identity +@using BlazorWeb_CSharp.Data +@using BlazorWeb_CSharp.Identity + +@inject UserManager UserManager +@inject UserAccessor UserAccessor +@inject UrlEncoder UrlEncoder +@inject IdentityRedirectManager RedirectManager +@inject ILogger Logger + +Configure authenticator app + +@if (_recoveryCodes is not null) +{ + +} +else +{ + +

Configure authenticator app

+
+

To use an authenticator app go through the following steps:

+
    +
  1. +

    + Download a two-factor authenticator app like Microsoft Authenticator for + Android and + iOS or + Google Authenticator for + Android and + iOS. +

    +
  2. +
  3. +

    Scan the QR Code or enter this key @_sharedKey into your two factor authenticator app. Spaces and casing do not matter.

    + +
    +
    +
  4. +
  5. +

    + Once you have scanned the QR code or input the key above, your two factor authentication app will provide you + with a unique code. Enter the code in the confirmation box below. +

    +
    +
    + + +
    + + + +
    + + +
    +
    +
    +
  6. +
+
+} + +@code { + private const string AuthenticatorUriFormat = "otpauth://totp/{0}:{1}?secret={2}&issuer={0}&digits=6"; + + private ApplicationUser _user = default!; + private string? _sharedKey; + private string? _authenticatorUri; + + private IEnumerable? _recoveryCodes; + private string? _message; + + [SupplyParameterFromForm] + private InputModel Input { get; set; } = default!; + + protected override async Task OnInitializedAsync() + { + Input ??= new(); + + _user = await UserAccessor.GetRequiredUserAsync(); + + await LoadSharedKeyAndQrCodeUriAsync(_user); + } + + private async Task OnValidSubmitAsync() + { + // Strip spaces and hyphens + var verificationCode = Input.Code!.Replace(" ", string.Empty).Replace("-", string.Empty); + + var is2faTokenValid = await UserManager.VerifyTwoFactorTokenAsync( + _user, UserManager.Options.Tokens.AuthenticatorTokenProvider, verificationCode); + + if (!is2faTokenValid) + { + await LoadSharedKeyAndQrCodeUriAsync(_user); + RedirectManager.RedirectToCurrentPageWithStatus("Error: Verification code is invalid."); + return; + } + + await UserManager.SetTwoFactorEnabledAsync(_user, true); + var userId = await UserManager.GetUserIdAsync(_user); + Logger.LogInformation("User with ID '{UserId}' has enabled 2FA with an authenticator app.", userId); + + _message = "Your authenticator app has been verified."; + + if (await UserManager.CountRecoveryCodesAsync(_user) == 0) + { + _recoveryCodes = await UserManager.GenerateNewTwoFactorRecoveryCodesAsync(_user, 10); + } + else + { + RedirectManager.RedirectToWithStatus("/Account/Manage/TwoFactorAuthentication", _message); + } + } + + private async ValueTask LoadSharedKeyAndQrCodeUriAsync(ApplicationUser user) + { + // Load the authenticator key & QR code URI to display on the form + var unformattedKey = await UserManager.GetAuthenticatorKeyAsync(user); + if (string.IsNullOrEmpty(unformattedKey)) + { + await UserManager.ResetAuthenticatorKeyAsync(user); + unformattedKey = await UserManager.GetAuthenticatorKeyAsync(user); + } + + _sharedKey = FormatKey(unformattedKey!); + + var email = await UserManager.GetEmailAsync(user); + _authenticatorUri = GenerateQrCodeUri(email!, unformattedKey!); + } + + private string FormatKey(string unformattedKey) + { + var result = new StringBuilder(); + int currentPosition = 0; + while (currentPosition + 4 < unformattedKey.Length) + { + result.Append(unformattedKey.AsSpan(currentPosition, 4)).Append(' '); + currentPosition += 4; + } + if (currentPosition < unformattedKey.Length) + { + result.Append(unformattedKey.AsSpan(currentPosition)); + } + + return result.ToString().ToLowerInvariant(); + } + + private string GenerateQrCodeUri(string email, string unformattedKey) + { + return string.Format( + CultureInfo.InvariantCulture, + AuthenticatorUriFormat, + UrlEncoder.Encode("Microsoft.AspNetCore.Identity.UI"), + UrlEncoder.Encode(email), + unformattedKey); + } + + private sealed class InputModel + { + [Required] + [StringLength(7, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] + [DataType(DataType.Text)] + [Display(Name = "Verification Code")] + public string? Code { get; set; } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/ExternalLogins.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/ExternalLogins.razor new file mode 100644 index 000000000000..4ff1ec38044a --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Pages/Account/Manage/ExternalLogins.razor @@ -0,0 +1,152 @@ +@page "/Account/Manage/ExternalLogins" + +@using Microsoft.AspNetCore.Authentication +@using Microsoft.AspNetCore.Identity +@using Microsoft.AspNetCore.Mvc.ViewFeatures +@using BlazorWeb_CSharp.Data +@using BlazorWeb_CSharp.Identity + +@inject UserManager UserManager +@inject SignInManager SignInManager +@inject UserAccessor UserAccessor +@inject IUserStore UserStore +@inject IdentityRedirectManager RedirectManager + +Manage your external logins + + +@if (_currentLogins?.Count > 0) +{ +

Registered Logins

+ + + @foreach (var login in _currentLogins) + { + + + + + } + +
@login.ProviderDisplayName + @if (_showRemoveButton) + { +
+ +
+ + + +
+ + } + else + { + @:   + } +
+} +@if (_otherLogins?.Count > 0) +{ +

Add another service to log in.

+
+