randmarcomps 1.258.0 → 1.259.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47120,10 +47120,21 @@ async function fetchApiFunctions() {
47120
47120
  }, Q.required && R.push(Q.name);
47121
47121
  });
47122
47122
  const A = ((e = S.parameters) == null ? void 0 : e.filter((Q) => Q.in === "path").map((Q) => Q.name)) || [];
47123
- (b === "post" || b === "put") && S.requestBody && (E[bodyKey] = {
47124
- type: Type.STRING,
47125
- description: S.requestBody.description || "Request body content"
47126
- }, R.push(bodyKey));
47123
+ if ((b === "post" || b === "put") && S.requestBody) {
47124
+ const Q = S.requestBody.content["application/json"].schema;
47125
+ if ("$ref" in Q && Q.$ref.startsWith("#/components/schemas/")) {
47126
+ const F = Q.$ref.substring(21);
47127
+ E[bodyKey] = {
47128
+ type: Type.STRING,
47129
+ description: S.requestBody.description + " - Must be a JSON string with these properties: " + JSON.stringify(o.components.schemas[F].properties)
47130
+ };
47131
+ } else
47132
+ E[bodyKey] = {
47133
+ type: Type.STRING,
47134
+ description: S.requestBody.description || "Request body content"
47135
+ };
47136
+ R.push(bodyKey);
47137
+ }
47127
47138
  const I = {
47128
47139
  name: C,
47129
47140
  description: S.description ? `${S.summary}
@@ -943,7 +943,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
943
943
  * @license
944
944
  * Copyright 2025 Google LLC
945
945
  * SPDX-License-Identifier: Apache-2.0
946
- */const LANGUAGE_LABEL_PREFIX="gl-node/";class GoogleGenAI{constructor(e){var n;if(e.apiKey==null)throw new Error("An API Key must be set when running in a browser");if(e.project||e.location)throw new Error("Vertex AI project based authentication is not supported on browser runtimes. Please do not provide a project or location.");this.vertexai=(n=e.vertexai)!==null&&n!==void 0?n:!1,this.apiKey=e.apiKey,this.apiVersion=e.apiVersion;const o=new WebAuth(this.apiKey);this.apiClient=new ApiClient({auth:o,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:e.httpOptions,userAgentExtra:LANGUAGE_LABEL_PREFIX+"web",uploader:new BrowserUploader}),this.models=new Models(this.apiClient),this.live=new Live(this.apiClient,o,new BrowserWebSocketFactory),this.chats=new Chats(this.models,this.apiClient),this.caches=new Caches(this.apiClient),this.files=new Files(this.apiClient),this.operations=new Operations(this.apiClient)}}const bodyKey="TheRequestBody";async function fetchApiFunctions(){var t,e;try{const n=await fetch("https://api.randmar.io/swagger/V4/swagger.json");if(!n.ok)throw new Error("Failed to fetch Swagger spec");const o=await n.json(),l=[];for(const[d,f]of Object.entries(o.paths)){const g=["get","post","put","delete"];for(const b of g){const _=f[b];if(!_||_["x-allowed-for-chatbots"]!==!0)continue;const S=d.split("/").filter(Boolean);let R=`${b}_${S.slice(1).join("_")}`;R=R.replace(/[^a-zA-Z0-9_.-]/g,"_"),R.length>60&&(R=R.substring(0,60));const C={},E=[];(t=_.parameters)==null||t.forEach(Q=>{C[Q.name]={type:Q.schema.type,description:Q.description||`The ${Q.name} parameter`},Q.required&&E.push(Q.name)});const A=((e=_.parameters)==null?void 0:e.filter(Q=>Q.in==="path").map(Q=>Q.name))||[];(b==="post"||b==="put")&&_.requestBody&&(C[bodyKey]={type:Type.STRING,description:_.requestBody.description||"Request body content"},E.push(bodyKey));const I={name:R,description:_.description?`${_.summary}
946
+ */const LANGUAGE_LABEL_PREFIX="gl-node/";class GoogleGenAI{constructor(e){var n;if(e.apiKey==null)throw new Error("An API Key must be set when running in a browser");if(e.project||e.location)throw new Error("Vertex AI project based authentication is not supported on browser runtimes. Please do not provide a project or location.");this.vertexai=(n=e.vertexai)!==null&&n!==void 0?n:!1,this.apiKey=e.apiKey,this.apiVersion=e.apiVersion;const o=new WebAuth(this.apiKey);this.apiClient=new ApiClient({auth:o,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:e.httpOptions,userAgentExtra:LANGUAGE_LABEL_PREFIX+"web",uploader:new BrowserUploader}),this.models=new Models(this.apiClient),this.live=new Live(this.apiClient,o,new BrowserWebSocketFactory),this.chats=new Chats(this.models,this.apiClient),this.caches=new Caches(this.apiClient),this.files=new Files(this.apiClient),this.operations=new Operations(this.apiClient)}}const bodyKey="TheRequestBody";async function fetchApiFunctions(){var t,e;try{const n=await fetch("https://api.randmar.io/swagger/V4/swagger.json");if(!n.ok)throw new Error("Failed to fetch Swagger spec");const o=await n.json(),l=[];for(const[d,f]of Object.entries(o.paths)){const g=["get","post","put","delete"];for(const b of g){const _=f[b];if(!_||_["x-allowed-for-chatbots"]!==!0)continue;const S=d.split("/").filter(Boolean);let R=`${b}_${S.slice(1).join("_")}`;R=R.replace(/[^a-zA-Z0-9_.-]/g,"_"),R.length>60&&(R=R.substring(0,60));const C={},E=[];(t=_.parameters)==null||t.forEach(Q=>{C[Q.name]={type:Q.schema.type,description:Q.description||`The ${Q.name} parameter`},Q.required&&E.push(Q.name)});const A=((e=_.parameters)==null?void 0:e.filter(Q=>Q.in==="path").map(Q=>Q.name))||[];if((b==="post"||b==="put")&&_.requestBody){const Q=_.requestBody.content["application/json"].schema;if("$ref"in Q&&Q.$ref.startsWith("#/components/schemas/")){const F=Q.$ref.substring(21);C[bodyKey]={type:Type.STRING,description:_.requestBody.description+" - Must be a JSON string with these properties: "+JSON.stringify(o.components.schemas[F].properties)}}else C[bodyKey]={type:Type.STRING,description:_.requestBody.description||"Request body content"};E.push(bodyKey)}const I={name:R,description:_.description?`${_.summary}
947
947
 
948
948
  ${_.description}`:_.summary||`${b.toUpperCase()} ${S[S.length-1]}`,parameters:{type:Type.OBJECT,properties:C,required:E}},M=async Q=>{var V;let F=`https://api.randmar.io${d}`;try{A.forEach(Ne=>{const je=`{${Ne}}`,$e=Ne;F=F.replace(je,Q[$e])});const te=localStorage.getItem("access_token"),ne={method:b.toUpperCase(),headers:{Authorization:te?`Bearer ${te}`:"","Content-Type":"application/json"}},se=[];if((((V=_.parameters)==null?void 0:V.filter(Ne=>Ne.in==="query"))||[]).forEach(Ne=>{const je=Ne.name,$e=Q[je];$e&&se.push(`${Ne.name}=${encodeURIComponent($e)}`)}),se.length>0&&(F+=`?${se.join("&")}`),b==="post"||b==="put"){const je=Q[bodyKey];je&&(ne.body=je)}const oe=await fetch(F,ne);if(!oe.ok){const Ne=await oe.text();throw console.error(`[API Function] Error response: ${Ne}`),new Error(`Error ${oe.status}: ${Ne}`)}const Ae=await oe.json();return JSON.stringify(Ae,null,2)}catch(te){return console.error(`Error in ${R}:`,te),`I'm sorry, I couldn't retrieve the requested information. Error: ${te instanceof Error?te.message:"Unknown error"}`}},j=_.tags.at(0),q=(b=="get"?"Fetching data":"Updating data")+` using the Randmar ${j} API.`,z=`${b} ${d}`;l.push({declaration:I,handler:M,prettyName:q,details:z})}}return l}catch(n){return console.error("Error fetching API functions:",n),[]}}function useAIAssistant({userId:t,apiKey:e,smartAndSlow:n=!1}){const[o,l]=React.useState(""),[d,f]=React.useState(null),[g,b]=React.useState([]),[_,S]=React.useState([]),[R,C]=React.useState([]),[E,A]=React.useState(""),I=new GoogleGenAI({apiKey:e}),[M]=useLazyGetV4PartnerByApplicationIdAccountQuery(),[j,q]=React.useState([]);React.useEffect(()=>{E&&S(oe=>[...oe,"System instructions updated."])},[E]),React.useEffect(()=>{d&&(S(oe=>[...oe,"Gemini ready."]),F(d))},[d]),React.useEffect(()=>{(async()=>{try{const Ne=await(await fetch("https://docs.google.com/document/d/e/2PACX-1vT-f5SWSJ2BcRUcyiumzT1aPUeC8kyyV7ryJTTymWJWOcRbDRgV5nX6Wyh7HaSPf8rxTY9w63Q2C8rG/pub")).text(),Ue=new DOMParser().parseFromString(Ne,"text/html").querySelector(".doc-content").innerHTML.replace(/__user_id__/g,t).replace(/__today__/g,""+new Date);A(Ue)}catch(Ae){console.error("Error fetching system instructions:",Ae),A("You are a helpful assistant, but cannot help the user right now. They should come back another time.")}})()},[]),React.useEffect(()=>{const oe=()=>{try{const Ae=I.chats.create({model:n?"gemini-2.5-pro-preview-03-25":"gemini-2.5-flash-preview-04-17",config:{systemInstruction:E,maxOutputTokens:8096,tools:R.length>0?[{functionDeclarations:R.map(({declaration:Ne})=>Ne)}]:[]}});f(Ae)}catch(Ae){console.error("Error initializing chat:",Ae)}};d||R.length!==0&&E!==""&&oe()},[R,d,E,n]),React.useEffect(()=>ge(),[n]),React.useEffect(()=>{(async()=>{try{const Ae=await fetchApiFunctions(),Ne={declaration:{name:"set_on_behalf_id",description:"Call this function when the user wants to act on behalf of another one. It will return to you important flags such as: is user specified by the user ID a reseller, manufacturer or an agency?",parameters:{type:Type.OBJECT,properties:{user_id:{type:Type.STRING,description:"The user ID to use going forward."}},required:["user_id"]}},prettyName:"Fetching the account details of the specified user.",details:"GET Partner Account",handler:async function(je){const Fe=je["user_id"],Ue=await M({applicationId:Fe});return JSON.stringify(Ue.data)}};C([...Ae,Ne])}catch(Ae){console.error("Error loading API functions:",Ae)}})()},[]);const z=async oe=>{const Ae=oe.name??"",Ne=R.find($e=>$e.declaration.name===Ae);if(Ne===void 0)return console.error(`Function ${Ae} not found`),"";const je=oe.args||{};try{S(Ue=>[...Ue,[`${Ne.prettyName}`,`${Ne.details} where ${JSON.stringify(je,null,2)}`]]);const $e=await Ne.handler(je),Fe={content:jsxRuntime.jsx(AiGeneratedContent,{data:JSON.parse($e),prompt:"You are a UX master. Display the data in a compact way. Viewport is phone sized. Don't use vertical scroll areas."}),timestamp:new Date,isComponent:!0};return ne(Fe),$e}catch{return S($e=>[...$e,`${Ae} failed.`]),""}},Q=async(oe,Ae=5)=>{if(oe.text){const Fe={content:oe.text,timestamp:new Date};ne(Fe)}const Ne=oe.functionCalls;if(!(Ne!=null&&Ne.length))return;if(Ae==0){ne({content:"I hit my limit of five actions per response. Let me know if you'd like me to continue.",timestamp:new Date});return}l("Using Randmar API...");const je=[];for(const Fe of Ne){const Ue=await z(Fe),Ve={functionResponse:{name:Fe.name,response:{content:Ue}}};je.push(Ve)}l("Composing response...");const $e=await d.sendMessage({message:je});await Q($e,Ae-1)},F=async oe=>{const Ae=[`Fetch the initial (called onload in your instructions) information for me (app ID ${t}) and provide a short summary. Tell me to hold on until done, then greet me and tell me you're ready.`];try{l("Getting ready...");const Ne=await oe.sendMessage({message:Ae});await Q(Ne)}finally{l("")}};React.useEffect(()=>{if(!d||o||j.length==0)return;l("Handing message...");const oe=j.at(0);q(Ae=>Ae.slice(1)),te(oe[0],oe[1])},[d,o,j]);const V=(oe,Ae)=>q(Ne=>[...Ne,[oe,Ae]]),te=async(oe,Ae)=>{try{const Ne=[oe.trim()];if(Ae){l("Receiving attached file...");const $e=new Blob([await Ae.arrayBuffer()],{type:Ae.type}),Fe=await I.files.upload({file:$e,config:{displayName:Ae.name}});let Ue=await I.files.get({name:Fe.name});for(;Ue.state==="PROCESSING";)Ue=await I.files.get({name:Fe.name}),await new Promise(Ve=>{setTimeout(Ve,1e3)});if(Fe.state==="FAILED")throw new Error("File processing failed.");Ne.push({fileData:{fileUri:Fe.uri,mimeType:Fe.mimeType}})}l("Thinking...");const je=await d.sendMessage({message:Ne});await Q(je)}catch(Ne){console.error("[debug] error sending message:",Ne),ne({content:"I'm sorry, I encountered an error processing your request. Please try again later.",timestamp:new Date})}finally{l("")}},ne=oe=>b(Ae=>[...Ae,oe]),se=()=>b([]),ge=()=>f(null);return{handleSubmitToBot:V,botMessages:g,clearBotMessages:se,botReady:!!d,botStatus:o,debugMessages:_,reset:ge}}class HttpError extends Error{constructor(e,n){const o=new.target.prototype;super(`${e}: Status code '${n}'`),this.statusCode=n,this.__proto__=o}}class TimeoutError extends Error{constructor(e="A timeout occurred."){const n=new.target.prototype;super(e),this.__proto__=n}}class AbortError extends Error{constructor(e="An abort occurred."){const n=new.target.prototype;super(e),this.__proto__=n}}class UnsupportedTransportError extends Error{constructor(e,n){const o=new.target.prototype;super(e),this.transport=n,this.errorType="UnsupportedTransportError",this.__proto__=o}}class DisabledTransportError extends Error{constructor(e,n){const o=new.target.prototype;super(e),this.transport=n,this.errorType="DisabledTransportError",this.__proto__=o}}class FailedToStartTransportError extends Error{constructor(e,n){const o=new.target.prototype;super(e),this.transport=n,this.errorType="FailedToStartTransportError",this.__proto__=o}}class FailedToNegotiateWithServerError extends Error{constructor(e){const n=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=n}}class AggregateErrors extends Error{constructor(e,n){const o=new.target.prototype;super(e),this.innerErrors=n,this.__proto__=o}}class HttpResponse{constructor(e,n,o){this.statusCode=e,this.statusText=n,this.content=o}}class HttpClient{get(e,n){return this.send({...n,method:"GET",url:e})}post(e,n){return this.send({...n,method:"POST",url:e})}delete(e,n){return this.send({...n,method:"DELETE",url:e})}getCookieString(e){return""}}var LogLevel;(function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Information=2]="Information",t[t.Warning=3]="Warning",t[t.Error=4]="Error",t[t.Critical=5]="Critical",t[t.None=6]="None"})(LogLevel||(LogLevel={}));class NullLogger{constructor(){}log(e,n){}}NullLogger.instance=new NullLogger;const VERSION="8.0.7";class Arg{static isRequired(e,n){if(e==null)throw new Error(`The '${n}' argument is required.`)}static isNotEmpty(e,n){if(!e||e.match(/^\s*$/))throw new Error(`The '${n}' argument should not be empty.`)}static isIn(e,n,o){if(!(e in n))throw new Error(`Unknown ${o} value: ${e}.`)}}class Platform{static get isBrowser(){return!Platform.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!Platform.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!Platform.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function getDataDetail(t,e){let n="";return isArrayBuffer(t)?(n=`Binary data of length ${t.byteLength}`,e&&(n+=`. Content: '${formatArrayBuffer(t)}'`)):typeof t=="string"&&(n=`String data of length ${t.length}`,e&&(n+=`. Content: '${t}'`)),n}function formatArrayBuffer(t){const e=new Uint8Array(t);let n="";return e.forEach(o=>{const l=o<16?"0":"";n+=`0x${l}${o.toString(16)} `}),n.substr(0,n.length-1)}function isArrayBuffer(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}async function sendMessage(t,e,n,o,l,d){const f={},[g,b]=getUserAgentHeader();f[g]=b,t.log(LogLevel.Trace,`(${e} transport) sending data. ${getDataDetail(l,d.logMessageContent)}.`);const _=isArrayBuffer(l)?"arraybuffer":"text",S=await n.post(o,{content:l,headers:{...f,...d.headers},responseType:_,timeout:d.timeout,withCredentials:d.withCredentials});t.log(LogLevel.Trace,`(${e} transport) request complete. Response status: ${S.statusCode}.`)}function createLogger(t){return t===void 0?new ConsoleLogger(LogLevel.Information):t===null?NullLogger.instance:t.log!==void 0?t:new ConsoleLogger(t)}class SubjectSubscription{constructor(e,n){this._subject=e,this._observer=n}dispose(){const e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(n=>{})}}class ConsoleLogger{constructor(e){this._minLevel=e,this.out=console}log(e,n){if(e>=this._minLevel){const o=`[${new Date().toISOString()}] ${LogLevel[e]}: ${n}`;switch(e){case LogLevel.Critical:case LogLevel.Error:this.out.error(o);break;case LogLevel.Warning:this.out.warn(o);break;case LogLevel.Information:this.out.info(o);break;default:this.out.log(o);break}}}}function getUserAgentHeader(){let t="X-SignalR-User-Agent";return Platform.isNode&&(t="User-Agent"),[t,constructUserAgent(VERSION,getOsName(),getRuntime(),getRuntimeVersion())]}function constructUserAgent(t,e,n,o){let l="Microsoft SignalR/";const d=t.split(".");return l+=`${d[0]}.${d[1]}`,l+=` (${t}; `,e&&e!==""?l+=`${e}; `:l+="Unknown OS; ",l+=`${n}`,o?l+=`; ${o}`:l+="; Unknown Runtime Version",l+=")",l}function getOsName(){if(Platform.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function getRuntimeVersion(){if(Platform.isNode)return process.versions.node}function getRuntime(){return Platform.isNode?"NodeJS":"Browser"}function getErrorString(t){return t.stack?t.stack:t.message?t.message:`${t}`}function getGlobalThis(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class FetchHttpClient extends HttpClient{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||Platform.isNode){const n=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(n("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=n("node-fetch"):this._fetchType=fetch,this._fetchType=n("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(getGlobalThis());if(typeof AbortController>"u"){const n=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=n("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new AbortError;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");const n=new this._abortControllerType;let o;e.abortSignal&&(e.abortSignal.onabort=()=>{n.abort(),o=new AbortError});let l=null;if(e.timeout){const b=e.timeout;l=setTimeout(()=>{n.abort(),this._logger.log(LogLevel.Warning,"Timeout from HTTP request."),o=new TimeoutError},b)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},isArrayBuffer(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let d;try{d=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:n.signal})}catch(b){throw o||(this._logger.log(LogLevel.Warning,`Error from HTTP request. ${b}.`),b)}finally{l&&clearTimeout(l),e.abortSignal&&(e.abortSignal.onabort=null)}if(!d.ok){const b=await deserializeContent(d,"text");throw new HttpError(b||d.statusText,d.status)}const g=await deserializeContent(d,e.responseType);return new HttpResponse(d.status,d.statusText,g)}getCookieString(e){let n="";return Platform.isNode&&this._jar&&this._jar.getCookies(e,(o,l)=>n=l.join("; ")),n}}function deserializeContent(t,e){let n;switch(e){case"arraybuffer":n=t.arrayBuffer();break;case"text":n=t.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:n=t.text();break}return n}class XhrHttpClient extends HttpClient{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new AbortError):e.method?e.url?new Promise((n,o)=>{const l=new XMLHttpRequest;l.open(e.method,e.url,!0),l.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,l.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(isArrayBuffer(e.content)?l.setRequestHeader("Content-Type","application/octet-stream"):l.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const d=e.headers;d&&Object.keys(d).forEach(f=>{l.setRequestHeader(f,d[f])}),e.responseType&&(l.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{l.abort(),o(new AbortError)}),e.timeout&&(l.timeout=e.timeout),l.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),l.status>=200&&l.status<300?n(new HttpResponse(l.status,l.statusText,l.response||l.responseText)):o(new HttpError(l.response||l.responseText||l.statusText,l.status))},l.onerror=()=>{this._logger.log(LogLevel.Warning,`Error from HTTP request. ${l.status}: ${l.statusText}.`),o(new HttpError(l.statusText,l.status))},l.ontimeout=()=>{this._logger.log(LogLevel.Warning,"Timeout from HTTP request."),o(new TimeoutError)},l.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class DefaultHttpClient extends HttpClient{constructor(e){if(super(),typeof fetch<"u"||Platform.isNode)this._httpClient=new FetchHttpClient(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new XhrHttpClient(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new AbortError):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}class TextMessageFormat{static write(e){return`${e}${TextMessageFormat.RecordSeparator}`}static parse(e){if(e[e.length-1]!==TextMessageFormat.RecordSeparator)throw new Error("Message is incomplete.");const n=e.split(TextMessageFormat.RecordSeparator);return n.pop(),n}}TextMessageFormat.RecordSeparatorCode=30,TextMessageFormat.RecordSeparator=String.fromCharCode(TextMessageFormat.RecordSeparatorCode);class HandshakeProtocol{writeHandshakeRequest(e){return TextMessageFormat.write(JSON.stringify(e))}parseHandshakeResponse(e){let n,o;if(isArrayBuffer(e)){const g=new Uint8Array(e),b=g.indexOf(TextMessageFormat.RecordSeparatorCode);if(b===-1)throw new Error("Message is incomplete.");const _=b+1;n=String.fromCharCode.apply(null,Array.prototype.slice.call(g.slice(0,_))),o=g.byteLength>_?g.slice(_).buffer:null}else{const g=e,b=g.indexOf(TextMessageFormat.RecordSeparator);if(b===-1)throw new Error("Message is incomplete.");const _=b+1;n=g.substring(0,_),o=g.length>_?g.substring(_):null}const l=TextMessageFormat.parse(n),d=JSON.parse(l[0]);if(d.type)throw new Error("Expected a handshake response from the server.");return[o,d]}}var MessageType;(function(t){t[t.Invocation=1]="Invocation",t[t.StreamItem=2]="StreamItem",t[t.Completion=3]="Completion",t[t.StreamInvocation=4]="StreamInvocation",t[t.CancelInvocation=5]="CancelInvocation",t[t.Ping=6]="Ping",t[t.Close=7]="Close",t[t.Ack=8]="Ack",t[t.Sequence=9]="Sequence"})(MessageType||(MessageType={}));class Subject{constructor(){this.observers=[]}next(e){for(const n of this.observers)n.next(e)}error(e){for(const n of this.observers)n.error&&n.error(e)}complete(){for(const e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new SubjectSubscription(this,e)}}class MessageBuffer{constructor(e,n,o){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=n,this._bufferSize=o}async _send(e){const n=this._protocol.writeMessage(e);let o=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let l=()=>{},d=()=>{};isArrayBuffer(n)?this._bufferedByteCount+=n.byteLength:this._bufferedByteCount+=n.length,this._bufferedByteCount>=this._bufferSize&&(o=new Promise((f,g)=>{l=f,d=g})),this._messages.push(new BufferedItem(n,this._totalMessageCount,l,d))}try{this._reconnectInProgress||await this._connection.send(n)}catch{this._disconnected()}await o}_ack(e){let n=-1;for(let o=0;o<this._messages.length;o++){const l=this._messages[o];if(l._id<=e.sequenceId)n=o,isArrayBuffer(l._message)?this._bufferedByteCount-=l._message.byteLength:this._bufferedByteCount-=l._message.length,l._resolver();else if(this._bufferedByteCount<this._bufferSize)l._resolver();else break}n!==-1&&(this._messages=this._messages.slice(n+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type!==MessageType.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;const n=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,n<=this._latestReceivedSequenceId?(n===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=n,this._ackTimer(),!0)}_resetSequence(e){if(e.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const e=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:MessageType.Sequence,sequenceId:e}));const n=this._messages;for(const o of n)await this._connection.send(o._message);this._reconnectInProgress=!1}_dispose(e){e??(e=new Error("Unable to reconnect to server."));for(const n of this._messages)n._rejector(e)}_isInvocationMessage(e){switch(e.type){case MessageType.Invocation:case MessageType.StreamItem:case MessageType.Completion:case MessageType.StreamInvocation:case MessageType.CancelInvocation:return!0;case MessageType.Close:case MessageType.Sequence:case MessageType.Ping:case MessageType.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:MessageType.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class BufferedItem{constructor(e,n,o,l){this._message=e,this._id=n,this._resolver=o,this._rejector=l}}const DEFAULT_TIMEOUT_IN_MS=30*1e3,DEFAULT_PING_INTERVAL_IN_MS=15*1e3,DEFAULT_STATEFUL_RECONNECT_BUFFER_SIZE=1e5;var HubConnectionState;(function(t){t.Disconnected="Disconnected",t.Connecting="Connecting",t.Connected="Connected",t.Disconnecting="Disconnecting",t.Reconnecting="Reconnecting"})(HubConnectionState||(HubConnectionState={}));class HubConnection{static create(e,n,o,l,d,f,g){return new HubConnection(e,n,o,l,d,f,g)}constructor(e,n,o,l,d,f,g){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(LogLevel.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")},Arg.isRequired(e,"connection"),Arg.isRequired(n,"logger"),Arg.isRequired(o,"protocol"),this.serverTimeoutInMilliseconds=d??DEFAULT_TIMEOUT_IN_MS,this.keepAliveIntervalInMilliseconds=f??DEFAULT_PING_INTERVAL_IN_MS,this._statefulReconnectBufferSize=g??DEFAULT_STATEFUL_RECONNECT_BUFFER_SIZE,this._logger=n,this._protocol=o,this.connection=e,this._reconnectPolicy=l,this._handshakeProtocol=new HandshakeProtocol,this.connection.onreceive=b=>this._processIncomingData(b),this.connection.onclose=b=>this._connectionClosed(b),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=HubConnectionState.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:MessageType.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!==HubConnectionState.Disconnected&&this._connectionState!==HubConnectionState.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!==HubConnectionState.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=HubConnectionState.Connecting,this._logger.log(LogLevel.Debug,"Starting HubConnection.");try{await this._startInternal(),Platform.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=HubConnectionState.Connected,this._connectionStarted=!0,this._logger.log(LogLevel.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=HubConnectionState.Disconnected,this._logger.log(LogLevel.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((n,o)=>{this._handshakeResolver=n,this._handshakeRejecter=o});await this.connection.start(this._protocol.transferFormat);try{let n=this._protocol.version;this.connection.features.reconnect||(n=1);const o={protocol:this._protocol.name,version:n};if(this._logger.log(LogLevel.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(o)),this._logger.log(LogLevel.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new MessageBuffer(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(n){throw this._logger.log(LogLevel.Debug,`Hub handshake failed with error '${n}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(n),n}}async stop(){const e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch{}}_stopInternal(e){if(this._connectionState===HubConnectionState.Disconnected)return this._logger.log(LogLevel.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===HubConnectionState.Disconnecting)return this._logger.log(LogLevel.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const n=this._connectionState;return this._connectionState=HubConnectionState.Disconnecting,this._logger.log(LogLevel.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(LogLevel.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(n===HubConnectionState.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new AbortError("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,...n){const[o,l]=this._replaceStreamingParams(n),d=this._createStreamInvocation(e,n,l);let f;const g=new Subject;return g.cancelCallback=()=>{const b=this._createCancelInvocation(d.invocationId);return delete this._callbacks[d.invocationId],f.then(()=>this._sendWithProtocol(b))},this._callbacks[d.invocationId]=(b,_)=>{if(_){g.error(_);return}else b&&(b.type===MessageType.Completion?b.error?g.error(new Error(b.error)):g.complete():g.next(b.item))},f=this._sendWithProtocol(d).catch(b=>{g.error(b),delete this._callbacks[d.invocationId]}),this._launchStreams(o,f),g}_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,...n){const[o,l]=this._replaceStreamingParams(n),d=this._sendWithProtocol(this._createInvocation(e,n,!0,l));return this._launchStreams(o,d),d}invoke(e,...n){const[o,l]=this._replaceStreamingParams(n),d=this._createInvocation(e,n,!1,l);return new Promise((g,b)=>{this._callbacks[d.invocationId]=(S,R)=>{if(R){b(R);return}else S&&(S.type===MessageType.Completion?S.error?b(new Error(S.error)):g(S.result):b(new Error(`Unexpected message type: ${S.type}`)))};const _=this._sendWithProtocol(d).catch(S=>{b(S),delete this._callbacks[d.invocationId]});this._launchStreams(o,_)})}on(e,n){!e||!n||(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),this._methods[e].indexOf(n)===-1&&this._methods[e].push(n))}off(e,n){if(!e)return;e=e.toLowerCase();const o=this._methods[e];if(o)if(n){const l=o.indexOf(n);l!==-1&&(o.splice(l,1),o.length===0&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){const n=this._protocol.parseMessages(e,this._logger);for(const o of n)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(o)))switch(o.type){case MessageType.Invocation:this._invokeClientMethod(o).catch(l=>{this._logger.log(LogLevel.Error,`Invoke client method threw error: ${getErrorString(l)}`)});break;case MessageType.StreamItem:case MessageType.Completion:{const l=this._callbacks[o.invocationId];if(l){o.type===MessageType.Completion&&delete this._callbacks[o.invocationId];try{l(o)}catch(d){this._logger.log(LogLevel.Error,`Stream callback threw error: ${getErrorString(d)}`)}}break}case MessageType.Ping:break;case MessageType.Close:{this._logger.log(LogLevel.Information,"Close message received from server.");const l=o.error?new Error("Server returned an error on close: "+o.error):void 0;o.allowReconnect===!0?this.connection.stop(l):this._stopPromise=this._stopInternal(l);break}case MessageType.Ack:this._messageBuffer&&this._messageBuffer._ack(o);break;case MessageType.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(o);break;default:this._logger.log(LogLevel.Warning,`Invalid message type: ${o.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let n,o;try{[o,n]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(l){const d="Error parsing handshake response: "+l;this._logger.log(LogLevel.Error,d);const f=new Error(d);throw this._handshakeRejecter(f),f}if(n.error){const l="Server returned handshake error: "+n.error;this._logger.log(LogLevel.Error,l);const d=new Error(l);throw this._handshakeRejecter(d),d}else this._logger.log(LogLevel.Debug,"Server handshake complete.");return this._handshakeResolver(),o}_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),this._pingServerHandle===void 0)){let e=this._nextKeepAlive-new Date().getTime();e<0&&(e=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===HubConnectionState.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 n=e.target.toLowerCase(),o=this._methods[n];if(!o){this._logger.log(LogLevel.Warning,`No client method with the name '${n}' found.`),e.invocationId&&(this._logger.log(LogLevel.Warning,`No result given for '${n}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}const l=o.slice(),d=!!e.invocationId;let f,g,b;for(const _ of l)try{const S=f;f=await _.apply(this,e.arguments),d&&f&&S&&(this._logger.log(LogLevel.Error,`Multiple results provided for '${n}'. Sending error to server.`),b=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),g=void 0}catch(S){g=S,this._logger.log(LogLevel.Error,`A callback for the method '${n}' threw error '${S}'.`)}b?await this._sendWithProtocol(b):d?(g?b=this._createCompletionMessage(e.invocationId,`${g}`,null):f!==void 0?b=this._createCompletionMessage(e.invocationId,null,f):(this._logger.log(LogLevel.Warning,`No result given for '${n}' method and invocation ID '${e.invocationId}'.`),b=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(b)):f&&this._logger.log(LogLevel.Error,`Result given for '${n}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(LogLevel.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new AbortError("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===HubConnectionState.Disconnecting?this._completeClose(e):this._connectionState===HubConnectionState.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===HubConnectionState.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=HubConnectionState.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(e??new Error("Connection closed.")),this._messageBuffer=void 0),Platform.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(n=>n.apply(this,[e]))}catch(n){this._logger.log(LogLevel.Error,`An onclose callback called with error '${e}' threw error '${n}'.`)}}}async _reconnect(e){const n=Date.now();let o=0,l=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),d=this._getNextRetryDelay(o++,0,l);if(d===null){this._logger.log(LogLevel.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=HubConnectionState.Reconnecting,e?this._logger.log(LogLevel.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(LogLevel.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(f=>f.apply(this,[e]))}catch(f){this._logger.log(LogLevel.Error,`An onreconnecting callback called with error '${e}' threw error '${f}'.`)}if(this._connectionState!==HubConnectionState.Reconnecting){this._logger.log(LogLevel.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;d!==null;){if(this._logger.log(LogLevel.Information,`Reconnect attempt number ${o} will start in ${d} ms.`),await new Promise(f=>{this._reconnectDelayHandle=setTimeout(f,d)}),this._reconnectDelayHandle=void 0,this._connectionState!==HubConnectionState.Reconnecting){this._logger.log(LogLevel.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=HubConnectionState.Connected,this._logger.log(LogLevel.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(f=>f.apply(this,[this.connection.connectionId]))}catch(f){this._logger.log(LogLevel.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${f}'.`)}return}catch(f){if(this._logger.log(LogLevel.Information,`Reconnect attempt failed because of error '${f}'.`),this._connectionState!==HubConnectionState.Reconnecting){this._logger.log(LogLevel.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===HubConnectionState.Disconnecting&&this._completeClose();return}l=f instanceof Error?f:new Error(f.toString()),d=this._getNextRetryDelay(o++,Date.now()-n,l)}}this._logger.log(LogLevel.Information,`Reconnect retries have been exhausted after ${Date.now()-n} ms and ${o} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(e,n,o){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:n,previousRetryCount:e,retryReason:o})}catch(l){return this._logger.log(LogLevel.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${n}) threw error '${l}'.`),null}}_cancelCallbacksWithError(e){const n=this._callbacks;this._callbacks={},Object.keys(n).forEach(o=>{const l=n[o];try{l(null,e)}catch(d){this._logger.log(LogLevel.Error,`Stream 'error' callback called with '${e}' threw error: ${getErrorString(d)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,n,o,l){if(o)return l.length!==0?{arguments:n,streamIds:l,target:e,type:MessageType.Invocation}:{arguments:n,target:e,type:MessageType.Invocation};{const d=this._invocationId;return this._invocationId++,l.length!==0?{arguments:n,invocationId:d.toString(),streamIds:l,target:e,type:MessageType.Invocation}:{arguments:n,invocationId:d.toString(),target:e,type:MessageType.Invocation}}}_launchStreams(e,n){if(e.length!==0){n||(n=Promise.resolve());for(const o in e)e[o].subscribe({complete:()=>{n=n.then(()=>this._sendWithProtocol(this._createCompletionMessage(o)))},error:l=>{let d;l instanceof Error?d=l.message:l&&l.toString?d=l.toString():d="Unknown error",n=n.then(()=>this._sendWithProtocol(this._createCompletionMessage(o,d)))},next:l=>{n=n.then(()=>this._sendWithProtocol(this._createStreamItemMessage(o,l)))}})}}_replaceStreamingParams(e){const n=[],o=[];for(let l=0;l<e.length;l++){const d=e[l];if(this._isObservable(d)){const f=this._invocationId;this._invocationId++,n[f]=d,o.push(f.toString()),e.splice(l,1)}}return[n,o]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,n,o){const l=this._invocationId;return this._invocationId++,o.length!==0?{arguments:n,invocationId:l.toString(),streamIds:o,target:e,type:MessageType.StreamInvocation}:{arguments:n,invocationId:l.toString(),target:e,type:MessageType.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:MessageType.CancelInvocation}}_createStreamItemMessage(e,n){return{invocationId:e,item:n,type:MessageType.StreamItem}}_createCompletionMessage(e,n,o){return n?{error:n,invocationId:e,type:MessageType.Completion}:{invocationId:e,result:o,type:MessageType.Completion}}_createCloseMessage(){return{type:MessageType.Close}}}const DEFAULT_RETRY_DELAYS_IN_MILLISECONDS=[0,2e3,1e4,3e4,null];class DefaultReconnectPolicy{constructor(e){this._retryDelays=e!==void 0?[...e,null]:DEFAULT_RETRY_DELAYS_IN_MILLISECONDS}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class HeaderNames{}HeaderNames.Authorization="Authorization",HeaderNames.Cookie="Cookie";class AccessTokenHttpClient extends HttpClient{constructor(e,n){super(),this._innerClient=e,this._accessTokenFactory=n}async send(e){let n=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(n=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const o=await this._innerClient.send(e);return n&&o.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):o}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[HeaderNames.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[HeaderNames.Authorization]&&delete e.headers[HeaderNames.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}var HttpTransportType;(function(t){t[t.None=0]="None",t[t.WebSockets=1]="WebSockets",t[t.ServerSentEvents=2]="ServerSentEvents",t[t.LongPolling=4]="LongPolling"})(HttpTransportType||(HttpTransportType={}));var TransferFormat;(function(t){t[t.Text=1]="Text",t[t.Binary=2]="Binary"})(TransferFormat||(TransferFormat={}));let AbortController$1=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class LongPollingTransport{get pollAborted(){return this._pollAbort.aborted}constructor(e,n,o){this._httpClient=e,this._logger=n,this._pollAbort=new AbortController$1,this._options=o,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,n){if(Arg.isRequired(e,"url"),Arg.isRequired(n,"transferFormat"),Arg.isIn(n,TransferFormat,"transferFormat"),this._url=e,this._logger.log(LogLevel.Trace,"(LongPolling transport) Connecting."),n===TransferFormat.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[o,l]=getUserAgentHeader(),d={[o]:l,...this._options.headers},f={abortSignal:this._pollAbort.signal,headers:d,timeout:1e5,withCredentials:this._options.withCredentials};n===TransferFormat.Binary&&(f.responseType="arraybuffer");const g=`${e}&_=${Date.now()}`;this._logger.log(LogLevel.Trace,`(LongPolling transport) polling: ${g}.`);const b=await this._httpClient.get(g,f);b.statusCode!==200?(this._logger.log(LogLevel.Error,`(LongPolling transport) Unexpected response code: ${b.statusCode}.`),this._closeError=new HttpError(b.statusText||"",b.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,f)}async _poll(e,n){try{for(;this._running;)try{const o=`${e}&_=${Date.now()}`;this._logger.log(LogLevel.Trace,`(LongPolling transport) polling: ${o}.`);const l=await this._httpClient.get(o,n);l.statusCode===204?(this._logger.log(LogLevel.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):l.statusCode!==200?(this._logger.log(LogLevel.Error,`(LongPolling transport) Unexpected response code: ${l.statusCode}.`),this._closeError=new HttpError(l.statusText||"",l.statusCode),this._running=!1):l.content?(this._logger.log(LogLevel.Trace,`(LongPolling transport) data received. ${getDataDetail(l.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(l.content)):this._logger.log(LogLevel.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(o){this._running?o instanceof TimeoutError?this._logger.log(LogLevel.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=o,this._running=!1):this._logger.log(LogLevel.Trace,`(LongPolling transport) Poll errored after shutdown: ${o.message}`)}}finally{this._logger.log(LogLevel.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?sendMessage(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(LogLevel.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(LogLevel.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[n,o]=getUserAgentHeader();e[n]=o;const l={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let d;try{await this._httpClient.delete(this._url,l)}catch(f){d=f}d?d instanceof HttpError&&(d.statusCode===404?this._logger.log(LogLevel.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(LogLevel.Trace,`(LongPolling transport) Error sending a DELETE request: ${d}`)):this._logger.log(LogLevel.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(LogLevel.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(LogLevel.Trace,e),this.onclose(this._closeError)}}}class ServerSentEventsTransport{constructor(e,n,o,l){this._httpClient=e,this._accessToken=n,this._logger=o,this._options=l,this.onreceive=null,this.onclose=null}async connect(e,n){return Arg.isRequired(e,"url"),Arg.isRequired(n,"transferFormat"),Arg.isIn(n,TransferFormat,"transferFormat"),this._logger.log(LogLevel.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((o,l)=>{let d=!1;if(n!==TransferFormat.Text){l(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let f;if(Platform.isBrowser||Platform.isWebWorker)f=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const g=this._httpClient.getCookieString(e),b={};b.Cookie=g;const[_,S]=getUserAgentHeader();b[_]=S,f=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...b,...this._options.headers}})}try{f.onmessage=g=>{if(this.onreceive)try{this._logger.log(LogLevel.Trace,`(SSE transport) data received. ${getDataDetail(g.data,this._options.logMessageContent)}.`),this.onreceive(g.data)}catch(b){this._close(b);return}},f.onerror=g=>{d?this._close():l(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."))},f.onopen=()=>{this._logger.log(LogLevel.Information,`SSE connected to ${this._url}`),this._eventSource=f,d=!0,o()}}catch(g){l(g);return}})}async send(e){return this._eventSource?sendMessage(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 WebSocketTransport{constructor(e,n,o,l,d,f){this._logger=o,this._accessTokenFactory=n,this._logMessageContent=l,this._webSocketConstructor=d,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=f}async connect(e,n){Arg.isRequired(e,"url"),Arg.isRequired(n,"transferFormat"),Arg.isIn(n,TransferFormat,"transferFormat"),this._logger.log(LogLevel.Trace,"(WebSockets transport) Connecting.");let o;return this._accessTokenFactory&&(o=await this._accessTokenFactory()),new Promise((l,d)=>{e=e.replace(/^http/,"ws");let f;const g=this._httpClient.getCookieString(e);let b=!1;if(Platform.isNode||Platform.isReactNative){const _={},[S,R]=getUserAgentHeader();_[S]=R,o&&(_[HeaderNames.Authorization]=`Bearer ${o}`),g&&(_[HeaderNames.Cookie]=g),f=new this._webSocketConstructor(e,void 0,{headers:{..._,...this._headers}})}else o&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(o)}`);f||(f=new this._webSocketConstructor(e)),n===TransferFormat.Binary&&(f.binaryType="arraybuffer"),f.onopen=_=>{this._logger.log(LogLevel.Information,`WebSocket connected to ${e}.`),this._webSocket=f,b=!0,l()},f.onerror=_=>{let S=null;typeof ErrorEvent<"u"&&_ instanceof ErrorEvent?S=_.error:S="There was an error with the transport",this._logger.log(LogLevel.Information,`(WebSockets transport) ${S}.`)},f.onmessage=_=>{if(this._logger.log(LogLevel.Trace,`(WebSockets transport) data received. ${getDataDetail(_.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(_.data)}catch(S){this._close(S);return}},f.onclose=_=>{if(b)this._close(_);else{let S=null;typeof ErrorEvent<"u"&&_ instanceof ErrorEvent?S=_.error:S="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.",d(new Error(S))}}})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(LogLevel.Trace,`(WebSockets transport) sending data. ${getDataDetail(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(LogLevel.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}}const MAX_REDIRECTS=100;class HttpConnection{constructor(e,n={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Arg.isRequired(e,"url"),this._logger=createLogger(n.logger),this.baseUrl=this._resolveUrl(e),n=n||{},n.logMessageContent=n.logMessageContent===void 0?!1:n.logMessageContent,typeof n.withCredentials=="boolean"||n.withCredentials===void 0)n.withCredentials=n.withCredentials===void 0?!0:n.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");n.timeout=n.timeout===void 0?100*1e3:n.timeout;let o=null,l=null;if(Platform.isNode&&typeof require<"u"){const d=typeof __webpack_require__=="function"?__non_webpack_require__:require;o=d("ws"),l=d("eventsource")}!Platform.isNode&&typeof WebSocket<"u"&&!n.WebSocket?n.WebSocket=WebSocket:Platform.isNode&&!n.WebSocket&&o&&(n.WebSocket=o),!Platform.isNode&&typeof EventSource<"u"&&!n.EventSource?n.EventSource=EventSource:Platform.isNode&&!n.EventSource&&typeof l<"u"&&(n.EventSource=l),this._httpClient=new AccessTokenHttpClient(n.httpClient||new DefaultHttpClient(this._logger),n.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=n,this.onreceive=null,this.onclose=null}async start(e){if(e=e||TransferFormat.Binary,Arg.isIn(e,TransferFormat,"transferFormat"),this._logger.log(LogLevel.Debug,`Starting connection with transfer format '${TransferFormat[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),await this._startInternalPromise,this._connectionState==="Disconnecting"){const n="Failed to start the HttpConnection before stop() was called.";return this._logger.log(LogLevel.Error,n),await this._stopPromise,Promise.reject(new AbortError(n))}else if(this._connectionState!=="Connected"){const n="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(LogLevel.Error,n),Promise.reject(new AbortError(n))}this._connectionStarted=!0}send(e){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new TransportSendQueue(this.transport)),this._sendQueue.send(e))}async stop(e){if(this._connectionState==="Disconnected")return this._logger.log(LogLevel.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(LogLevel.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(n=>{this._stopPromiseResolver=n}),await this._stopInternal(e),await this._stopPromise}async _stopInternal(e){this._stopError=e;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(n){this._logger.log(LogLevel.Error,`HttpConnection.transport.stop() threw error '${n}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(LogLevel.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let n=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===HttpTransportType.WebSockets)this.transport=this._constructTransport(HttpTransportType.WebSockets),await this._startTransport(n,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let o=null,l=0;do{if(o=await this._getNegotiationResponse(n),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new AbortError("The connection was stopped during negotiation.");if(o.error)throw new Error(o.error);if(o.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(o.url&&(n=o.url),o.accessToken){const d=o.accessToken;this._accessTokenFactory=()=>d,this._httpClient._accessToken=d,this._httpClient._accessTokenFactory=void 0}l++}while(o.url&&l<MAX_REDIRECTS);if(l===MAX_REDIRECTS&&o.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(n,this._options.transport,o,e)}this.transport instanceof LongPollingTransport&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(LogLevel.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(o){return this._logger.log(LogLevel.Error,"Failed to start the connection: "+o),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(o)}}async _getNegotiationResponse(e){const n={},[o,l]=getUserAgentHeader();n[o]=l;const d=this._resolveNegotiateUrl(e);this._logger.log(LogLevel.Debug,`Sending negotiation request: ${d}.`);try{const f=await this._httpClient.post(d,{content:"",headers:{...n,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(f.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${f.statusCode}'`));const g=JSON.parse(f.content);return(!g.negotiateVersion||g.negotiateVersion<1)&&(g.connectionToken=g.connectionId),g.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new FailedToNegotiateWithServerError("Client didn't negotiate Stateful Reconnect but the server did.")):g}catch(f){let g="Failed to complete negotiation with the server: "+f;return f instanceof HttpError&&f.statusCode===404&&(g=g+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(LogLevel.Error,g),Promise.reject(new FailedToNegotiateWithServerError(g))}}_createConnectUrl(e,n){return n?e+(e.indexOf("?")===-1?"?":"&")+`id=${n}`:e}async _createTransport(e,n,o,l){let d=this._createConnectUrl(e,o.connectionToken);if(this._isITransport(n)){this._logger.log(LogLevel.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=n,await this._startTransport(d,l),this.connectionId=o.connectionId;return}const f=[],g=o.availableTransports||[];let b=o;for(const _ of g){const S=this._resolveTransportOrError(_,n,l,(b==null?void 0:b.useStatefulReconnect)===!0);if(S instanceof Error)f.push(`${_.transport} failed:`),f.push(S);else if(this._isITransport(S)){if(this.transport=S,!b){try{b=await this._getNegotiationResponse(e)}catch(R){return Promise.reject(R)}d=this._createConnectUrl(e,b.connectionToken)}try{await this._startTransport(d,l),this.connectionId=b.connectionId;return}catch(R){if(this._logger.log(LogLevel.Error,`Failed to start the transport '${_.transport}': ${R}`),b=void 0,f.push(new FailedToStartTransportError(`${_.transport} failed: ${R}`,HttpTransportType[_.transport])),this._connectionState!=="Connecting"){const C="Failed to select transport before stop() was called.";return this._logger.log(LogLevel.Debug,C),Promise.reject(new AbortError(C))}}}}return f.length>0?Promise.reject(new AggregateErrors(`Unable to connect to the server with any of the available transports. ${f.join(" ")}`,f)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case HttpTransportType.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new WebSocketTransport(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case HttpTransportType.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new ServerSentEventsTransport(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case HttpTransportType.LongPolling:return new LongPollingTransport(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,n){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async o=>{let l=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(e,n),await this.features.resend()}catch{l=!0}else{this._stopConnection(o);return}l&&this._stopConnection(o)}:this.transport.onclose=o=>this._stopConnection(o),this.transport.connect(e,n)}_resolveTransportOrError(e,n,o,l){const d=HttpTransportType[e.transport];if(d==null)return this._logger.log(LogLevel.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(transportMatches(n,d))if(e.transferFormats.map(g=>TransferFormat[g]).indexOf(o)>=0){if(d===HttpTransportType.WebSockets&&!this._options.WebSocket||d===HttpTransportType.ServerSentEvents&&!this._options.EventSource)return this._logger.log(LogLevel.Debug,`Skipping transport '${HttpTransportType[d]}' because it is not supported in your environment.'`),new UnsupportedTransportError(`'${HttpTransportType[d]}' is not supported in your environment.`,d);this._logger.log(LogLevel.Debug,`Selecting transport '${HttpTransportType[d]}'.`);try{return this.features.reconnect=d===HttpTransportType.WebSockets?l:void 0,this._constructTransport(d)}catch(g){return g}}else return this._logger.log(LogLevel.Debug,`Skipping transport '${HttpTransportType[d]}' because it does not support the requested transfer format '${TransferFormat[o]}'.`),new Error(`'${HttpTransportType[d]}' does not support ${TransferFormat[o]}.`);else return this._logger.log(LogLevel.Debug,`Skipping transport '${HttpTransportType[d]}' because it was disabled by the client.`),new DisabledTransportError(`'${HttpTransportType[d]}' is disabled by the client.`,d)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(LogLevel.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(LogLevel.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(LogLevel.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(LogLevel.Error,`Connection disconnected with error '${e}'.`):this._logger.log(LogLevel.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(n=>{this._logger.log(LogLevel.Error,`TransportSendQueue.stop() threw error '${n}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(n){this._logger.log(LogLevel.Error,`HttpConnection.onclose(${e}) threw error '${n}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!Platform.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const n=window.document.createElement("a");return n.href=e,this._logger.log(LogLevel.Information,`Normalizing '${e}' to '${n.href}'.`),n.href}_resolveNegotiateUrl(e){const n=new URL(e);n.pathname.endsWith("/")?n.pathname+="negotiate":n.pathname+="/negotiate";const o=new URLSearchParams(n.searchParams);return o.has("negotiateVersion")||o.append("negotiateVersion",this._negotiateVersion.toString()),o.has("useStatefulReconnect")?o.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&o.append("useStatefulReconnect","true"),n.search=o.toString(),n.toString()}}function transportMatches(t,e){return!t||(e&t)!==0}class TransportSendQueue{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new PromiseSource,this._transportResult=new PromiseSource,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new PromiseSource),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 PromiseSource;const e=this._transportResult;this._transportResult=void 0;const n=typeof this._buffer[0]=="string"?this._buffer.join(""):TransportSendQueue._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(n),e.resolve()}catch(o){e.reject(o)}}}static _concatBuffers(e){const n=e.map(d=>d.byteLength).reduce((d,f)=>d+f),o=new Uint8Array(n);let l=0;for(const d of e)o.set(new Uint8Array(d),l),l+=d.byteLength;return o.buffer}}class PromiseSource{constructor(){this.promise=new Promise((e,n)=>[this._resolver,this._rejecter]=[e,n])}resolve(){this._resolver()}reject(e){this._rejecter(e)}}const JSON_HUB_PROTOCOL_NAME="json";class JsonHubProtocol{constructor(){this.name=JSON_HUB_PROTOCOL_NAME,this.version=2,this.transferFormat=TransferFormat.Text}parseMessages(e,n){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];n===null&&(n=NullLogger.instance);const o=TextMessageFormat.parse(e),l=[];for(const d of o){const f=JSON.parse(d);if(typeof f.type!="number")throw new Error("Invalid payload.");switch(f.type){case MessageType.Invocation:this._isInvocationMessage(f);break;case MessageType.StreamItem:this._isStreamItemMessage(f);break;case MessageType.Completion:this._isCompletionMessage(f);break;case MessageType.Ping:break;case MessageType.Close:break;case MessageType.Ack:this._isAckMessage(f);break;case MessageType.Sequence:this._isSequenceMessage(f);break;default:n.log(LogLevel.Information,"Unknown message type '"+f.type+"' ignored.");continue}l.push(f)}return l}writeMessage(e){return TextMessageFormat.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),e.invocationId!==void 0&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),e.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,n){if(typeof e!="string"||e==="")throw new Error(n)}}const LogLevelNameMapping={trace:LogLevel.Trace,debug:LogLevel.Debug,info:LogLevel.Information,information:LogLevel.Information,warn:LogLevel.Warning,warning:LogLevel.Warning,error:LogLevel.Error,critical:LogLevel.Critical,none:LogLevel.None};function parseLogLevel(t){const e=LogLevelNameMapping[t.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${t}`)}class HubConnectionBuilder{configureLogging(e){if(Arg.isRequired(e,"logging"),isLogger(e))this.logger=e;else if(typeof e=="string"){const n=parseLogLevel(e);this.logger=new ConsoleLogger(n)}else this.logger=new ConsoleLogger(e);return this}withUrl(e,n){return Arg.isRequired(e,"url"),Arg.isNotEmpty(e,"url"),this.url=e,typeof n=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...n}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:n},this}withHubProtocol(e){return Arg.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 DefaultReconnectPolicy(e):this.reconnectPolicy=e:this.reconnectPolicy=new DefaultReconnectPolicy,this}withServerTimeout(e){return Arg.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return Arg.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=e==null?void 0:e.bufferSize,this}build(){const e=this.httpConnectionOptions||{};if(e.logger===void 0&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const n=new HttpConnection(this.url,e);return HubConnection.create(n,this.logger||NullLogger.instance,this.protocol||new JsonHubProtocol,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function isLogger(t){return t.log!==void 0}function _getDefaults(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var _defaults=_getDefaults();function changeDefaults(t){_defaults=t}var noopTest={exec:()=>null};function edit(t,e=""){let n=typeof t=="string"?t:t.source;const o={replace:(l,d)=>{let f=typeof d=="string"?d:d.source;return f=f.replace(other.caret,"$1"),n=n.replace(l,f),o},getRegex:()=>new RegExp(n,e)};return o}var other={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},newline=/^(?:[ \t]*(?:\n|$))+/,blockCode=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,fences=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bullet=/(?:[*+-]|\d{1,9}[.)])/,lheadingCore=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,lheading=edit(lheadingCore).replace(/bull/g,bullet).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),lheadingGfm=edit(lheadingCore).replace(/bull/g,bullet).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),_paragraph=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,blockText=/^[^\n]+/,_blockLabel=/(?!\s*\])(?:\\.|[^\[\]\\])+/,def=edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_blockLabel).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),list$1=edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,bullet).getRegex(),_tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",_comment=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,html=edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",_comment).replace("tag",_tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),paragraph=edit(_paragraph).replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex(),blockquote=edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",paragraph).getRegex(),blockNormal={blockquote,code:blockCode,def,fences,heading,hr,html,lheading,list:list$1,newline,paragraph,table:noopTest,text:blockText},gfmTable=edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex(),blockGfm={...blockNormal,lheading:lheadingGfm,table:gfmTable,paragraph:edit(_paragraph).replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",gfmTable).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex()},blockPedantic={...blockNormal,html:edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",_comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:noopTest,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:edit(_paragraph).replace("hr",hr).replace("heading",` *#{1,6} *[^
949
949
  ]`).replace("lheading",lheading).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},escape$1=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,inlineCode=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br=/^( {2,}|\\)\n(?!\s*$)/,inlineText=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_punctuation=/[\p{P}\p{S}]/u,_punctuationOrSpace=/[\s\p{P}\p{S}]/u,_notPunctuationOrSpace=/[^\s\p{P}\p{S}]/u,punctuation=edit(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,_punctuationOrSpace).getRegex(),_punctuationGfmStrongEm=/(?!~)[\p{P}\p{S}]/u,_punctuationOrSpaceGfmStrongEm=/(?!~)[\s\p{P}\p{S}]/u,_notPunctuationOrSpaceGfmStrongEm=/(?:[^\s\p{P}\p{S}]|~)/u,blockSkip=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,emStrongLDelimCore=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,emStrongLDelim=edit(emStrongLDelimCore,"u").replace(/punct/g,_punctuation).getRegex(),emStrongLDelimGfm=edit(emStrongLDelimCore,"u").replace(/punct/g,_punctuationGfmStrongEm).getRegex(),emStrongRDelimAstCore="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",emStrongRDelimAst=edit(emStrongRDelimAstCore,"gu").replace(/notPunctSpace/g,_notPunctuationOrSpace).replace(/punctSpace/g,_punctuationOrSpace).replace(/punct/g,_punctuation).getRegex(),emStrongRDelimAstGfm=edit(emStrongRDelimAstCore,"gu").replace(/notPunctSpace/g,_notPunctuationOrSpaceGfmStrongEm).replace(/punctSpace/g,_punctuationOrSpaceGfmStrongEm).replace(/punct/g,_punctuationGfmStrongEm).getRegex(),emStrongRDelimUnd=edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,_notPunctuationOrSpace).replace(/punctSpace/g,_punctuationOrSpace).replace(/punct/g,_punctuation).getRegex(),anyPunctuation=edit(/\\(punct)/,"gu").replace(/punct/g,_punctuation).getRegex(),autolink=edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),_inlineComment=edit(_comment).replace("(?:-->|$)","-->").getRegex(),tag=edit("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",_inlineComment).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),_inlineLabel=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,link=edit(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",_inlineLabel).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),reflink=edit(/^!?\[(label)\]\[(ref)\]/).replace("label",_inlineLabel).replace("ref",_blockLabel).getRegex(),nolink=edit(/^!?\[(ref)\](?:\[\])?/).replace("ref",_blockLabel).getRegex(),reflinkSearch=edit("reflink|nolink(?!\\()","g").replace("reflink",reflink).replace("nolink",nolink).getRegex(),inlineNormal={_backpedal:noopTest,anyPunctuation,autolink,blockSkip,br,code:inlineCode,del:noopTest,emStrongLDelim,emStrongRDelimAst,emStrongRDelimUnd,escape:escape$1,link,nolink,punctuation,reflink,reflinkSearch,tag,text:inlineText,url:noopTest},inlinePedantic={...inlineNormal,link:edit(/^!?\[(label)\]\((.*?)\)/).replace("label",_inlineLabel).getRegex(),reflink:edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",_inlineLabel).getRegex()},inlineGfm={...inlineNormal,emStrongRDelimAst:emStrongRDelimAstGfm,emStrongLDelim:emStrongLDelimGfm,url:edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},inlineBreaks={...inlineGfm,br:edit(br).replace("{2,}","*").getRegex(),text:edit(inlineGfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},block={normal:blockNormal,gfm:blockGfm,pedantic:blockPedantic},inline={normal:inlineNormal,gfm:inlineGfm,breaks:inlineBreaks,pedantic:inlinePedantic},escapeReplacements={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},getEscapeReplacement=t=>escapeReplacements[t];function escape2(t,e){if(e){if(other.escapeTest.test(t))return t.replace(other.escapeReplace,getEscapeReplacement)}else if(other.escapeTestNoEncode.test(t))return t.replace(other.escapeReplaceNoEncode,getEscapeReplacement);return t}function cleanUrl(t){try{t=encodeURI(t).replace(other.percentDecode,"%")}catch{return null}return t}function splitCells(t,e){var d;const n=t.replace(other.findPipe,(f,g,b)=>{let _=!1,S=g;for(;--S>=0&&b[S]==="\\";)_=!_;return _?"|":" |"}),o=n.split(other.splitPipe);let l=0;if(o[0].trim()||o.shift(),o.length>0&&!((d=o.at(-1))!=null&&d.trim())&&o.pop(),e)if(o.length>e)o.splice(e);else for(;o.length<e;)o.push("");for(;l<o.length;l++)o[l]=o[l].trim().replace(other.slashPipe,"|");return o}function rtrim(t,e,n){const o=t.length;if(o===0)return"";let l=0;for(;l<o&&t.charAt(o-l-1)===e;)l++;return t.slice(0,o-l)}function findClosingBracket(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let o=0;o<t.length;o++)if(t[o]==="\\")o++;else if(t[o]===e[0])n++;else if(t[o]===e[1]&&(n--,n<0))return o;return n>0?-2:-1}function outputLink(t,e,n,o,l){const d=e.href,f=e.title||null,g=t[1].replace(l.other.outputLinkReplace,"$1");o.state.inLink=!0;const b={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:d,title:f,text:g,tokens:o.inlineTokens(g)};return o.state.inLink=!1,b}function indentCodeCompensation(t,e,n){const o=t.match(n.other.indentCodeCompensation);if(o===null)return e;const l=o[1];return e.split(`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "randmarcomps",
3
3
  "private": false,
4
- "version": "1.258.0",
4
+ "version": "1.259.0",
5
5
  "description": "The UI library enabling speed and consistency in Randmar frontends.",
6
6
  "type": "module",
7
7
  "files": [