react-luminus-components 2.1.7 → 2.1.8
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.
- package/dist/contexts.cjs.js +1 -1
- package/dist/contexts.es.js +55 -55
- package/package.json +1 -1
package/dist/contexts.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./nivo-bar-SBWBmyeI.cjs"),b=require("react/jsx-runtime"),m=require("react");require("react-router");const O=require("@azure/msal-browser"),se=require("@azure/msal-react");require("react-dom");require("react-hook-form");require("react-flexmonster");const K=require("./FormDisabledProvider-Dt39yr7W.cjs"),ie=require("./useLocalStorageState-Ca7olZgH.cjs"),ae=require("./useIsBrowserOnline-CREGrf2l.cjs");function le(t){const e=o.toDate(t);return e.setHours(23,59,59,999),e}function ce(){return le(Date.now())}function ue(t,e){const n=+o.toDate(t),[r,s]=[+o.toDate(e.start),+o.toDate(e.end)].sort((a,i)=>a-i);return n>=r&&n<=s}function he(){return o.startOfDay(Date.now())}const ge=t=>{const e=o.compilerRuntimeExports.c(10),{children:n}=t,[r,s]=m.useState(!1),[a,i]=m.useState(""),[l,c]=m.useState(void 0);let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=(v,p)=>{s(!0),i(v),c(p)},e[0]=u):u=e[0];const h=u;let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{s(!1)},e[1]=w):w=e[1];const d=w;let f;e[2]!==r||e[3]!==a||e[4]!==l?(f={show:r,text:a,showConfirm:h,hideConfirm:d,textSm:l},e[2]=r,e[3]=a,e[4]=l,e[5]=f):f=e[5];const S=f;let C;e[6]===Symbol.for("react.memo_cache_sentinel")?(C=b.jsx(Ve,{}),e[6]=C):C=e[6];let g;return e[7]!==n||e[8]!==S?(g=b.jsxs(o.ConfirmContext.Provider,{value:S,children:[C,n]}),e[7]=n,e[8]=S,e[9]=g):g=e[9],g},de=()=>{const t=o.compilerRuntimeExports.c(49),{texts:e}=m.useContext(o.LuminusComponentsContext),{confirm:n}=e,{isShown:r,text:s,onFinish:a}=o.usePrompt(),{options:i}=m.useContext(o.PromptContext),[l,c]=m.useState(i.defaultValue??"");let u;t[0]!==a?(u=()=>{a(null)},t[0]=a,t[1]=u):u=t[1];const h=u;let w;t[2]!==a||t[3]!==i.required||t[4]!==l?(w=N=>{N.preventDefault(),!(i.required&&!l)&&(a(l),c(""))},t[2]=a,t[3]=i.required,t[4]=l,t[5]=w):w=t[5];const d=w;let f;t[6]===Symbol.for("react.memo_cache_sentinel")?(f=N=>c(N.currentTarget.value),t[6]=f):f=t[6];let S;t[7]!==l?(S={value:l,onChange:f,className:"w-100",autoFocus:!0,tabIndex:0},t[7]=l,t[8]=S):S=t[8];const C=S;let g,v;t[9]!==r||t[10]!==i.defaultValue?(g=()=>{r===!0&&c(i.defaultValue??"")},v=[r,i.defaultValue],t[9]=r,t[10]=i.defaultValue,t[11]=g,t[12]=v):(g=t[11],v=t[12]),m.useEffect(g,v);let p;t[13]!==s?(p=b.jsx(o.Modal.Header,{className:"justify-content-center",children:b.jsx(o.Modal.Title,{children:s})}),t[13]=s,t[14]=p):p=t[14];let y;t[15]!==C||t[16]!==i.input||t[17]!==i.maxLength?(y=i.input==="textarea"?b.jsx("textarea",{...C,rows:5,maxLength:i.maxLength}):void 0,t[15]=C,t[16]=i.input,t[17]=i.maxLength,t[18]=y):y=t[18];let _;t[19]!==C||t[20]!==i.input||t[21]!==i.maxLength||t[22]!==i.type?(_=i.input==="input"?b.jsx(o.FormControl,{...C,type:i.type,maxLength:i.maxLength}):void 0,t[19]=C,t[20]=i.input,t[21]=i.maxLength,t[22]=i.type,t[23]=_):_=t[23];let L;t[24]!==i.maxLength||t[25]!==l?(L=i.maxLength!=null&&b.jsx("div",{className:"d-flex justify-content-end",children:b.jsxs(o.Typography,{variant:"caption",children:[l.length,"/",i.maxLength]})}),t[24]=i.maxLength,t[25]=l,t[26]=L):L=t[26];let E;t[27]!==L||t[28]!==y||t[29]!==_?(E=b.jsxs(o.Modal.Body,{children:[y,_,L]}),t[27]=L,t[28]=y,t[29]=_,t[30]=E):E=t[30];let D;t[31]!==n.cancel||t[32]!==h?(D=b.jsx(o.PrimaryButton,{variant:"outlined",color:"secondary",onClick:h,className:"flex-grow-1",children:n.cancel}),t[31]=n.cancel,t[32]=h,t[33]=D):D=t[33];const A=i.required&&!l;let R;t[34]!==n.confirm||t[35]!==A?(R=b.jsx(o.PrimaryButton,{color:"primary",disabled:A,type:"submit",className:"flex-grow-1",children:n.confirm}),t[34]=n.confirm,t[35]=A,t[36]=R):R=t[36];let T;t[37]!==D||t[38]!==R?(T=b.jsxs(o.Modal.Footer,{className:"w-100 d-flex gap-5",children:[D,R]}),t[37]=D,t[38]=R,t[39]=T):T=t[39];let M;t[40]!==d||t[41]!==E||t[42]!==T?(M=b.jsxs("form",{onSubmit:d,onKeyDown:fe,children:[E,T]}),t[40]=d,t[41]=E,t[42]=T,t[43]=M):M=t[43];let $;return t[44]!==r||t[45]!==h||t[46]!==M||t[47]!==p?($=b.jsxs(o.Modal,{show:r,size:"sm",centered:!0,onHide:h,children:[p,M]}),t[44]=r,t[45]=h,t[46]=M,t[47]=p,t[48]=$):$=t[48],$};function fe(t){return t.stopPropagation()}const pe=t=>{const e=o.compilerRuntimeExports.c(11),{children:n}=t,[r,s]=m.useState(!1),[a,i]=m.useState("");let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={input:"textarea",type:"text"},e[0]=l):l=e[0];const[c,u]=m.useState(l),h=m.useRef(_e);let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w=y=>{i(y),s(!0)},e[1]=w):w=e[1];const d=w;let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{s(!1)},e[2]=f):f=e[2];const S=f;let C;e[3]!==r||e[4]!==c||e[5]!==a?(C={isShown:r,text:a,showPrompt:d,hidePrompt:S,resolveRef:h,options:c,setOptions:u},e[3]=r,e[4]=c,e[5]=a,e[6]=C):C=e[6];const g=C;let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=b.jsx(de,{}),e[7]=v):v=e[7];let p;return e[8]!==n||e[9]!==g?(p=b.jsxs(o.PromptContext.Provider,{value:g,children:[n,v]}),e[8]=n,e[9]=g,e[10]=p):p=e[10],p};function _e(){}const me=t=>{const e=o.compilerRuntimeExports.c(14),{cookieDomain:n,axiosOptions:r,language:s,texts:a,ProjectIconComponent:i,localizationContext:l,chartColorPalette:c,children:u}=t;let h;e[0]!==i||e[1]!==r||e[2]!==c||e[3]!==n||e[4]!==s||e[5]!==l||e[6]!==a?(h={axiosOptions:r,cookieDomain:n,language:s,texts:a,ProjectIconComponent:i,localizationContext:l,chartColorPalette:c},e[0]=i,e[1]=r,e[2]=c,e[3]=n,e[4]=s,e[5]=l,e[6]=a,e[7]=h):h=e[7];const w=h;let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=b.jsx(o.Fe,{}),e[8]=d):d=e[8];let f;e[9]!==u?(f=b.jsx(ge,{children:b.jsxs(pe,{children:[d,u]})}),e[9]=u,e[10]=f):f=e[10];let S;return e[11]!==w||e[12]!==f?(S=b.jsx(o.LuminusComponentsContext.Provider,{value:w,children:f}),e[11]=w,e[12]=f,e[13]=S):S=e[13],S},we=t=>{const e=o.compilerRuntimeExports.c(15),{children:n}=t,[r,s]=m.useState(!1);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=new Set,e[0]=a):a=e[0];const[i]=m.useState(a);let l;e[1]!==i?(l=C=>{i.add(C),s(!0)},e[1]=i,e[2]=l):l=e[2];const c=l;let u;e[3]!==i?(u=C=>{i.delete(C),i.size===0&&s(!1)},e[3]=i,e[4]=u):u=e[4];const h=u;let w;e[5]!==r||e[6]!==c||e[7]!==h?(w={isLoading:r,startLoading:c,stopLoading:h},e[5]=r,e[6]=c,e[7]=h,e[8]=w):w=e[8];const d=w;let f;e[9]!==r?(f=r&&b.jsx(K.Loading,{}),e[9]=r,e[10]=f):f=e[10];let S;return e[11]!==n||e[12]!==d||e[13]!==f?(S=b.jsxs(o.LoadingContext.Provider,{value:d,children:[f,n]}),e[11]=n,e[12]=d,e[13]=f,e[14]=S):S=e[14],S},Se=t=>{const e=o.compilerRuntimeExports.c(39),{children:n}=t,r=o.useAxios(),{msalInstance:s,getToken:a}=m.useContext(o.AuthContext),{delegation:i,setDelegation:l,setAvailableDelegations:c,refreshAvailableDelegations:u}=m.useContext(o.DelegationContext),[h,w]=m.useState(null);let d;e[0]!==a?(d=async()=>{const k=await a();k&&w(k.token)},e[0]=a,e[1]=d):d=e[1];const f=d;let S,C;e[2]!==f?(S=()=>{f()},C=[f],e[2]=f,e[3]=S,e[4]=C):(S=e[3],C=e[4]),m.useEffect(S,C);let g;if(e[5]===Symbol.for("react.memo_cache_sentinel")){e:{const k=localStorage.getItem("user")??null;if(!k){g=null;break e}g=JSON.parse(k??"")}e[5]=g}else g=e[5];const v=g;let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p={state:v?o.LoginState.LOGGED_IN:o.LoginState.LOGGED_OUT,user:v},e[6]=p):p=e[6];const[y,_]=m.useState(p);let L;e[7]!==r?(L=async k=>{let I=null;return await r.get("/user/detail",k?{headers:{Authorization:`Bearer ${k}`}}:void 0).then(X=>{I=X.data}).catch(()=>{I=null}),I},e[7]=r,e[8]=L):L=e[8];const E=L;let D;e[9]!==c||e[10]!==l?(D=()=>{localStorage.removeItem("user"),_({state:o.LoginState.LOGGED_OUT,user:null}),l(null),c(null)},e[9]=c,e[10]=l,e[11]=D):D=e[11];const A=D;let R;e[12]!==E||e[13]!==u?(R=async k=>{_({state:o.LoginState.LOGGING_IN,user:null});const I=await E(k);return I?(_({state:o.LoginState.LOGGED_IN,user:I}),localStorage.setItem("user",JSON.stringify(I)),await u(),!0):(_({state:o.LoginState.LOGIN_FAILED,user:null}),!1)},e[12]=E,e[13]=u,e[14]=R):R=e[14];const T=R;let M;e[15]!==s?(M=()=>{if(s){const k=s.addEventCallback(I=>{if(I.eventType===O.EventType.LOGIN_SUCCESS&&I.payload){const X=I.payload;w(X.accessToken)}});return()=>{k&&s.removeEventCallback(k)}}return ve},e[15]=s,e[16]=M):M=e[16];let $;e[17]!==T||e[18]!==A||e[19]!==s?($=[s,T,A],e[17]=T,e[18]=A,e[19]=s,e[20]=$):$=e[20],m.useEffect(M,$);let N;e[21]!==T||e[22]!==A||e[23]!==l?(N=async k=>{k&&await T(k).catch(()=>{A(),l(null)})},e[21]=T,e[22]=A,e[23]=l,e[24]=N):N=e[24];const H=N;let U;e[25]!==h||e[26]!==H?(U=()=>{H(h)},e[25]=h,e[26]=H,e[27]=U):U=e[27];const q=i==null?void 0:i.id;let W;e[28]!==h||e[29]!==H||e[30]!==q?(W=[h,q,H],e[28]=h,e[29]=H,e[30]=q,e[31]=W):W=e[31],m.useEffect(U,W);let B;e[32]!==T||e[33]!==A||e[34]!==y?(B={user:y.user,userLoginState:y,loginUser:T,logoutUser:A},e[32]=T,e[33]=A,e[34]=y,e[35]=B):B=e[35];const V=B;let F;return e[36]!==n||e[37]!==V?(F=b.jsx(o.UserContext.Provider,{value:V,children:n}),e[36]=n,e[37]=V,e[38]=F):F=e[38],F};function ve(){}const Ce=()=>{const t=o.compilerRuntimeExports.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=b.jsx("p",{children:"Redirecting..."}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=b.jsxs("div",{children:[e,b.jsxs("p",{children:["If you are not redirected within 10 seconds, please click"," ",b.jsx("a",{href:window.location.href.replace("/blank","/"),children:"here"})]})]}),t[1]=n):n=t[1],n},be=t=>{const e=t==null?void 0:t.getActiveAccount();console.log("getTokenMsal activeAccount",e);const n=t==null?void 0:t.getAllAccounts();console.log("getTokenMsal allAccounts",n);const r=(n==null?void 0:n.at(0))??void 0;return console.log("getTokenMsal account",r),r?(e||t==null||t.setActiveAccount(r),r):null},Q=({...t})=>{const{inProgress:e}=se.useMsal(),{cookieDomain:n}=m.useContext(o.LuminusComponentsContext),[,r]=o.useCookies(["Authorization"]),s=m.useMemo(()=>t.useMsal?t.msalInstance:null,[t.useMsal,t.useMsal?t.msalInstance:null]),a=m.useMemo(()=>t.useMsal?t.msalScopes:[],[t.useMsal,t.useMsal?t.msalScopes:null]),i=m.useMemo(()=>t.useMsal?t.msalExtraScopes:[],[t.useMsal,t.useMsal?t.msalExtraScopes:null]),l=m.useRef(null),c=m.useRef(!1),u=m.useCallback(()=>{const g=localStorage.getItem("token");return g?{token:g,expiresOn:K.addYears(new Date(Date.now()),1)}:null},[]),h=m.useCallback(async()=>{if(console.log("getTokenMsal"),s==null)throw console.log("getTokenMsal throwing error because msalInstance is null"),new Error("getTokenMsal: msalInstance is null");if(l.current)return console.log("getTokenMsal returning tokenRequestPromise.current",l.current),l.current;const g=new Promise((v,p)=>{const y=_=>{const L=be(s);if(!L){console.log("getTokenMsal no account found. Redirecting to login"),s==null||s.loginRedirect({scopes:a,extraScopesToConsent:i});return}s==null||s.acquireTokenSilent({scopes:a,account:L,redirectUri:t.useMsal?t.msalSilentRedirectUri:void 0}).then(E=>{_(),v({token:E.accessToken,expiresOn:E.expiresOn??new Date(Date.now())})}).catch(E=>{console.error("Error acquiring token",E),E instanceof O.InteractionRequiredAuthError&&(console.log("Silent token acquisition failed. Acquiring token using redirect"),s==null||s.acquireTokenRedirect({scopes:a,extraScopesToConsent:i}),_(),v(null)),_(),p(E)}).finally(()=>{_(),p(new Error("No access token returned from handleRedirectPromise"))})};c.current?y(()=>{l.current=null}):s.handleRedirectPromise().then(_=>{if(console.log("getTokenMsal tokenResponse",_),!(_!=null&&_.accessToken)){y(()=>{l.current=null,c.current=!0});return}l.current=null,c.current=!0,v({token:_.accessToken,expiresOn:_.expiresOn??new Date(Date.now())})})});return l.current=g,g},[i,s,a,t.msalSilentRedirectUri,t.useMsal]),w=m.useCallback(async()=>t.useMsal?h():u(),[u,h,t.useMsal]),d=m.useCallback(g=>t.useMsal?()=>{}:(window.addEventListener("storage",g),window.addEventListener("dev-auth-change",g),()=>{window.removeEventListener("storage",g),window.removeEventListener("dev-auth-change",g)}),[t.useMsal]),f=m.useSyncExternalStore(d,()=>localStorage.getItem("token")!==null?"AUTH_OK":"NO_AUTH"),S=m.useMemo(()=>{var g;return t.useMsal?e!==O.InteractionStatus.None?"AUTH_IN_PROGRESS":(s==null?void 0:s.getActiveAccount())??((g=s==null?void 0:s.getAllAccounts())==null?void 0:g[0])??null?"AUTH_OK":"NO_AUTH":f},[f,e,s,t.useMsal]),C=m.useMemo(()=>({useMsal:t.useMsal??!1,msalInstance:s,msalScopes:a,msalExtraScopes:i,getToken:w,authState:S}),[t.useMsal,s,a,i,w,S]);return m.useEffect(()=>{if(t.useMsal&&s){const g=s.addEventCallback(v=>{if(v.eventType===O.EventType.LOGIN_SUCCESS||v.eventType===O.EventType.ACQUIRE_TOKEN_SUCCESS&&v.payload){const p=v.payload,y=p.account;s.setActiveAccount(y);const _=p.accessToken,L=p.expiresOn;r("Authorization",_,{path:"/",secure:!0,sameSite:"none",domain:n,expires:L??void 0})}v.error&&console.error("AuthProvider MSAL Error",v)});return()=>{g&&s.removeEventCallback(g)}}return()=>{}},[t.useMsal,s,r,n]),b.jsx(o.AuthContext.Provider,{value:C,children:window.location.pathname==="/blank"?b.jsx(Ce,{}):t.children})},ye=t=>{const e=o.compilerRuntimeExports.c(9);let n;if(e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1],n.useMsal){let s;e[2]!==n?(s=b.jsx(Q,{...n}),e[2]=n,e[3]=s):s=e[3];let a;return e[4]!==n.msalInstance||e[5]!==s?(a=b.jsx(se.MsalProvider,{instance:n.msalInstance,children:s}),e[4]=n.msalInstance,e[5]=s,e[6]=a):a=e[6],a}let r;return e[7]!==n?(r=b.jsx(Q,{...n}),e[7]=n,e[8]=r):r=e[8],r},Le=t=>{const e=o.compilerRuntimeExports.c(18),{children:n,relativeEndpoint:r}=t,[s,a,i]=ie.useLocalStorageState("user-delegation",null);let l;e:{if(!s){l=null;break e}const L=s.from?o.parseISO(s.from):he(),E=s.to?o.parseISO(s.to):ce();if(!ue(new Date(Date.now()),{start:L,end:E})){a(null),l=null;break e}l=s}const c=l;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={nullStateBeforeLoad:!1,nullStateOnFail:!0},e[0]=u):u=e[0];const{data:h,setData:w,reloadData:d}=o.useGetApiData(r,u),f=m.useRef(null);let S,C;e[1]!==d?(S=()=>{const L=()=>{d(),f.current=window.setTimeout(L,o.msToStartOfNextDay()+5e3)};return L(),()=>{f.current!==null&&window.clearTimeout(f.current)}},C=[d],e[1]=d,e[2]=S,e[3]=C):(S=e[2],C=e[3]),m.useEffect(S,C);let g;e[4]!==i?(g=()=>{const L=()=>{i()};return window.addEventListener("focus",L),()=>{window.removeEventListener("focus",L)}},e[4]=i,e[5]=g):g=e[5];let v;e[6]!==i||e[7]!==d?(v=[i,d],e[6]=i,e[7]=d,e[8]=v):v=e[8],m.useEffect(g,v);let p;e[9]!==h||e[10]!==d||e[11]!==w||e[12]!==a||e[13]!==c?(p={delegation:c,setDelegation:a,availableDelegations:h,setAvailableDelegations:w,refreshAvailableDelegations:d},e[9]=h,e[10]=d,e[11]=w,e[12]=a,e[13]=c,e[14]=p):p=e[14];const y=p;let _;return e[15]!==n||e[16]!==y?(_=b.jsx(o.DelegationContext.Provider,{value:y,children:n}),e[15]=n,e[16]=y,e[17]=_):_=e[17],_},Y=(t,e)=>t?`${t} | ${e}`:e,Ee=t=>{const e=o.compilerRuntimeExports.c(18),{defaultHelmet:n,children:r,helmetPrefix:s}=t,a=s??"";let i;e[0]!==n||e[1]!==a?(i=Y(a,n),e[0]=n,e[1]=a,e[2]=i):i=e[2];let l;e[3]!==i?(l=[i],e[3]=i,e[4]=l):l=e[4];const[c,u]=m.useState(l);let h;e[5]!==s?(h=_=>{u(L=>[...L,Y(s??"",_)])},e[5]=s,e[6]=h):h=e[6];const w=h;let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{u(xe)},e[7]=d):d=e[7];const f=d;let S;e[8]!==c?(S=c.at(-1)??"",e[8]=c,e[9]=S):S=e[9];const C=S;let g;e[10]!==w?(g={addHelmet:w,removeHelmet:f},e[10]=w,e[11]=g):g=e[11];const v=g;let p;e[12]!==C?(p=b.jsx("title",{children:C}),e[12]=C,e[13]=p):p=e[13];let y;return e[14]!==r||e[15]!==v||e[16]!==p?(y=b.jsxs(o.HelmetContext.Provider,{value:v,children:[p,r]}),e[14]=r,e[15]=v,e[16]=p,e[17]=y):y=e[17],y};function xe(t){return t.length>1?t.slice(0,-1):t}class re{constructor(e,n,r){this.statusCode=e,this.statusText=n,this.content=r}}class G{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""}}class Te extends G{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||o.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(o.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 o.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 r;e.abortSignal&&(e.abortSignal.onabort=()=>{n.abort(),r=new o.AbortError});let s=null;if(e.timeout){const c=e.timeout;s=setTimeout(()=>{n.abort(),this._logger.log(o.LogLevel.Warning,"Timeout from HTTP request."),r=new o.TimeoutError},c)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},o.isArrayBuffer(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let a;try{a=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(c){throw r||(this._logger.log(o.LogLevel.Warning,`Error from HTTP request. ${c}.`),c)}finally{s&&clearTimeout(s),e.abortSignal&&(e.abortSignal.onabort=null)}if(!a.ok){const c=await Z(a,"text");throw new o.HttpError(c||a.statusText,a.status)}const l=await Z(a,e.responseType);return new re(a.status,a.statusText,l)}getCookieString(e){let n="";return o.Platform.isNode&&this._jar&&this._jar.getCookies(e,(r,s)=>n=s.join("; ")),n}}function Z(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 ke extends G{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new o.AbortError):e.method?e.url?new Promise((n,r)=>{const s=new XMLHttpRequest;s.open(e.method,e.url,!0),s.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,s.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(o.isArrayBuffer(e.content)?s.setRequestHeader("Content-Type","application/octet-stream"):s.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const a=e.headers;a&&Object.keys(a).forEach(i=>{s.setRequestHeader(i,a[i])}),e.responseType&&(s.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{s.abort(),r(new o.AbortError)}),e.timeout&&(s.timeout=e.timeout),s.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),s.status>=200&&s.status<300?n(new re(s.status,s.statusText,s.response||s.responseText)):r(new o.HttpError(s.response||s.responseText||s.statusText,s.status))},s.onerror=()=>{this._logger.log(o.LogLevel.Warning,`Error from HTTP request. ${s.status}: ${s.statusText}.`),r(new o.HttpError(s.statusText,s.status))},s.ontimeout=()=>{this._logger.log(o.LogLevel.Warning,"Timeout from HTTP request."),r(new o.TimeoutError)},s.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Pe extends G{constructor(e){if(super(),typeof fetch<"u"||o.Platform.isNode)this._httpClient=new Te(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new ke(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new o.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)}}const Ae=[0,2e3,1e4,3e4,null];class ee{constructor(e){this._retryDelays=e!==void 0?[...e,null]:Ae}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class j{}j.Authorization="Authorization";j.Cookie="Cookie";class De extends G{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 r=await this._innerClient.send(e);return n&&r.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):r}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[j.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[j.Authorization]&&delete e.headers[j.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}var x;(function(t){t[t.None=0]="None",t[t.WebSockets=1]="WebSockets",t[t.ServerSentEvents=2]="ServerSentEvents",t[t.LongPolling=4]="LongPolling"})(x||(x={}));var P;(function(t){t[t.Text=1]="Text",t[t.Binary=2]="Binary"})(P||(P={}));let Re=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 te{get pollAborted(){return this._pollAbort.aborted}constructor(e,n,r){this._httpClient=e,this._logger=n,this._pollAbort=new Re,this._options=r,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,n){if(o.Arg.isRequired(e,"url"),o.Arg.isRequired(n,"transferFormat"),o.Arg.isIn(n,P,"transferFormat"),this._url=e,this._logger.log(o.LogLevel.Trace,"(LongPolling transport) Connecting."),n===P.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[r,s]=o.getUserAgentHeader(),a={[r]:s,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:a,timeout:1e5,withCredentials:this._options.withCredentials};n===P.Binary&&(i.responseType="arraybuffer");const l=`${e}&_=${Date.now()}`;this._logger.log(o.LogLevel.Trace,`(LongPolling transport) polling: ${l}.`);const c=await this._httpClient.get(l,i);c.statusCode!==200?(this._logger.log(o.LogLevel.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new o.HttpError(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(e,n){try{for(;this._running;)try{const r=`${e}&_=${Date.now()}`;this._logger.log(o.LogLevel.Trace,`(LongPolling transport) polling: ${r}.`);const s=await this._httpClient.get(r,n);s.statusCode===204?(this._logger.log(o.LogLevel.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):s.statusCode!==200?(this._logger.log(o.LogLevel.Error,`(LongPolling transport) Unexpected response code: ${s.statusCode}.`),this._closeError=new o.HttpError(s.statusText||"",s.statusCode),this._running=!1):s.content?(this._logger.log(o.LogLevel.Trace,`(LongPolling transport) data received. ${o.getDataDetail(s.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(s.content)):this._logger.log(o.LogLevel.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(r){this._running?r instanceof o.TimeoutError?this._logger.log(o.LogLevel.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=r,this._running=!1):this._logger.log(o.LogLevel.Trace,`(LongPolling transport) Poll errored after shutdown: ${r.message}`)}}finally{this._logger.log(o.LogLevel.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?o.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(o.LogLevel.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(o.LogLevel.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[n,r]=o.getUserAgentHeader();e[n]=r;const s={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let a;try{await this._httpClient.delete(this._url,s)}catch(i){a=i}a?a instanceof o.HttpError&&(a.statusCode===404?this._logger.log(o.LogLevel.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(o.LogLevel.Trace,`(LongPolling transport) Error sending a DELETE request: ${a}`)):this._logger.log(o.LogLevel.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(o.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(o.LogLevel.Trace,e),this.onclose(this._closeError)}}}class Me{constructor(e,n,r,s){this._httpClient=e,this._accessToken=n,this._logger=r,this._options=s,this.onreceive=null,this.onclose=null}async connect(e,n){return o.Arg.isRequired(e,"url"),o.Arg.isRequired(n,"transferFormat"),o.Arg.isIn(n,P,"transferFormat"),this._logger.log(o.LogLevel.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((r,s)=>{let a=!1;if(n!==P.Text){s(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let i;if(o.Platform.isBrowser||o.Platform.isWebWorker)i=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const l=this._httpClient.getCookieString(e),c={};c.Cookie=l;const[u,h]=o.getUserAgentHeader();c[u]=h,i=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...c,...this._options.headers}})}try{i.onmessage=l=>{if(this.onreceive)try{this._logger.log(o.LogLevel.Trace,`(SSE transport) data received. ${o.getDataDetail(l.data,this._options.logMessageContent)}.`),this.onreceive(l.data)}catch(c){this._close(c);return}},i.onerror=l=>{a?this._close():s(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."))},i.onopen=()=>{this._logger.log(o.LogLevel.Information,`SSE connected to ${this._url}`),this._eventSource=i,a=!0,r()}}catch(l){s(l);return}})}async send(e){return this._eventSource?o.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 Ie{constructor(e,n,r,s,a,i){this._logger=r,this._accessTokenFactory=n,this._logMessageContent=s,this._webSocketConstructor=a,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=i}async connect(e,n){o.Arg.isRequired(e,"url"),o.Arg.isRequired(n,"transferFormat"),o.Arg.isIn(n,P,"transferFormat"),this._logger.log(o.LogLevel.Trace,"(WebSockets transport) Connecting.");let r;return this._accessTokenFactory&&(r=await this._accessTokenFactory()),new Promise((s,a)=>{e=e.replace(/^http/,"ws");let i;const l=this._httpClient.getCookieString(e);let c=!1;if(o.Platform.isNode||o.Platform.isReactNative){const u={},[h,w]=o.getUserAgentHeader();u[h]=w,r&&(u[j.Authorization]=`Bearer ${r}`),l&&(u[j.Cookie]=l),i=new this._webSocketConstructor(e,void 0,{headers:{...u,...this._headers}})}else r&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(r)}`);i||(i=new this._webSocketConstructor(e)),n===P.Binary&&(i.binaryType="arraybuffer"),i.onopen=u=>{this._logger.log(o.LogLevel.Information,`WebSocket connected to ${e}.`),this._webSocket=i,c=!0,s()},i.onerror=u=>{let h=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?h=u.error:h="There was an error with the transport",this._logger.log(o.LogLevel.Information,`(WebSockets transport) ${h}.`)},i.onmessage=u=>{if(this._logger.log(o.LogLevel.Trace,`(WebSockets transport) data received. ${o.getDataDetail(u.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(u.data)}catch(h){this._close(h);return}},i.onclose=u=>{if(c)this._close(u);else{let h=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?h=u.error:h="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.",a(new Error(h))}}})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(o.LogLevel.Trace,`(WebSockets transport) sending data. ${o.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(o.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 oe=100;class $e{constructor(e,n={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,o.Arg.isRequired(e,"url"),this._logger=o.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 r=null,s=null;if(o.Platform.isNode&&typeof require<"u"){const a=typeof __webpack_require__=="function"?__non_webpack_require__:require;r=a("ws"),s=a("eventsource")}!o.Platform.isNode&&typeof WebSocket<"u"&&!n.WebSocket?n.WebSocket=WebSocket:o.Platform.isNode&&!n.WebSocket&&r&&(n.WebSocket=r),!o.Platform.isNode&&typeof EventSource<"u"&&!n.EventSource?n.EventSource=EventSource:o.Platform.isNode&&!n.EventSource&&typeof s<"u"&&(n.EventSource=s),this._httpClient=new De(n.httpClient||new Pe(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||P.Binary,o.Arg.isIn(e,P,"transferFormat"),this._logger.log(o.LogLevel.Debug,`Starting connection with transfer format '${P[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(o.LogLevel.Error,n),await this._stopPromise,Promise.reject(new o.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(o.LogLevel.Error,n),Promise.reject(new o.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 J(this.transport)),this._sendQueue.send(e))}async stop(e){if(this._connectionState==="Disconnected")return this._logger.log(o.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(o.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(o.LogLevel.Error,`HttpConnection.transport.stop() threw error '${n}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(o.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===x.WebSockets)this.transport=this._constructTransport(x.WebSockets),await this._startTransport(n,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let r=null,s=0;do{if(r=await this._getNegotiationResponse(n),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new o.AbortError("The connection was stopped during negotiation.");if(r.error)throw new Error(r.error);if(r.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(r.url&&(n=r.url),r.accessToken){const a=r.accessToken;this._accessTokenFactory=()=>a,this._httpClient._accessToken=a,this._httpClient._accessTokenFactory=void 0}s++}while(r.url&&s<oe);if(s===oe&&r.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(n,this._options.transport,r,e)}this.transport instanceof te&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(o.LogLevel.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(r){return this._logger.log(o.LogLevel.Error,"Failed to start the connection: "+r),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(r)}}async _getNegotiationResponse(e){const n={},[r,s]=o.getUserAgentHeader();n[r]=s;const a=this._resolveNegotiateUrl(e);this._logger.log(o.LogLevel.Debug,`Sending negotiation request: ${a}.`);try{const i=await this._httpClient.post(a,{content:"",headers:{...n,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(i.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${i.statusCode}'`));const l=JSON.parse(i.content);return(!l.negotiateVersion||l.negotiateVersion<1)&&(l.connectionToken=l.connectionId),l.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new o.FailedToNegotiateWithServerError("Client didn't negotiate Stateful Reconnect but the server did.")):l}catch(i){let l="Failed to complete negotiation with the server: "+i;return i instanceof o.HttpError&&i.statusCode===404&&(l=l+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(o.LogLevel.Error,l),Promise.reject(new o.FailedToNegotiateWithServerError(l))}}_createConnectUrl(e,n){return n?e+(e.indexOf("?")===-1?"?":"&")+`id=${n}`:e}async _createTransport(e,n,r,s){let a=this._createConnectUrl(e,r.connectionToken);if(this._isITransport(n)){this._logger.log(o.LogLevel.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=n,await this._startTransport(a,s),this.connectionId=r.connectionId;return}const i=[],l=r.availableTransports||[];let c=r;for(const u of l){const h=this._resolveTransportOrError(u,n,s,(c==null?void 0:c.useStatefulReconnect)===!0);if(h instanceof Error)i.push(`${u.transport} failed:`),i.push(h);else if(this._isITransport(h)){if(this.transport=h,!c){try{c=await this._getNegotiationResponse(e)}catch(w){return Promise.reject(w)}a=this._createConnectUrl(e,c.connectionToken)}try{await this._startTransport(a,s),this.connectionId=c.connectionId;return}catch(w){if(this._logger.log(o.LogLevel.Error,`Failed to start the transport '${u.transport}': ${w}`),c=void 0,i.push(new o.FailedToStartTransportError(`${u.transport} failed: ${w}`,x[u.transport])),this._connectionState!=="Connecting"){const d="Failed to select transport before stop() was called.";return this._logger.log(o.LogLevel.Debug,d),Promise.reject(new o.AbortError(d))}}}}return i.length>0?Promise.reject(new o.AggregateErrors(`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 x.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new Ie(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case x.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Me(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case x.LongPolling:return new te(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 r=>{let s=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(e,n),await this.features.resend()}catch{s=!0}else{this._stopConnection(r);return}s&&this._stopConnection(r)}:this.transport.onclose=r=>this._stopConnection(r),this.transport.connect(e,n)}_resolveTransportOrError(e,n,r,s){const a=x[e.transport];if(a==null)return this._logger.log(o.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(Ne(n,a))if(e.transferFormats.map(l=>P[l]).indexOf(r)>=0){if(a===x.WebSockets&&!this._options.WebSocket||a===x.ServerSentEvents&&!this._options.EventSource)return this._logger.log(o.LogLevel.Debug,`Skipping transport '${x[a]}' because it is not supported in your environment.'`),new o.UnsupportedTransportError(`'${x[a]}' is not supported in your environment.`,a);this._logger.log(o.LogLevel.Debug,`Selecting transport '${x[a]}'.`);try{return this.features.reconnect=a===x.WebSockets?s:void 0,this._constructTransport(a)}catch(l){return l}}else return this._logger.log(o.LogLevel.Debug,`Skipping transport '${x[a]}' because it does not support the requested transfer format '${P[r]}'.`),new Error(`'${x[a]}' does not support ${P[r]}.`);else return this._logger.log(o.LogLevel.Debug,`Skipping transport '${x[a]}' because it was disabled by the client.`),new o.DisabledTransportError(`'${x[a]}' is disabled by the client.`,a)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(o.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(o.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(o.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(o.LogLevel.Error,`Connection disconnected with error '${e}'.`):this._logger.log(o.LogLevel.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(n=>{this._logger.log(o.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(o.LogLevel.Error,`HttpConnection.onclose(${e}) threw error '${n}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!o.Platform.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const n=window.document.createElement("a");return n.href=e,this._logger.log(o.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 r=new URLSearchParams(n.searchParams);return r.has("negotiateVersion")||r.append("negotiateVersion",this._negotiateVersion.toString()),r.has("useStatefulReconnect")?r.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&r.append("useStatefulReconnect","true"),n.search=r.toString(),n.toString()}}function Ne(t,e){return!t||(e&t)!==0}class J{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new z,this._transportResult=new z,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new z),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 z;const e=this._transportResult;this._transportResult=void 0;const n=typeof this._buffer[0]=="string"?this._buffer.join(""):J._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(n),e.resolve()}catch(r){e.reject(r)}}}static _concatBuffers(e){const n=e.map(a=>a.byteLength).reduce((a,i)=>a+i),r=new Uint8Array(n);let s=0;for(const a of e)r.set(new Uint8Array(a),s),s+=a.byteLength;return r.buffer}}class z{constructor(){this.promise=new Promise((e,n)=>[this._resolver,this._rejecter]=[e,n])}resolve(){this._resolver()}reject(e){this._rejecter(e)}}const je="json";class He{constructor(){this.name=je,this.version=2,this.transferFormat=P.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=o.NullLogger.instance);const r=o.TextMessageFormat.parse(e),s=[];for(const a of r){const i=JSON.parse(a);if(typeof i.type!="number")throw new Error("Invalid payload.");switch(i.type){case o.MessageType.Invocation:this._isInvocationMessage(i);break;case o.MessageType.StreamItem:this._isStreamItemMessage(i);break;case o.MessageType.Completion:this._isCompletionMessage(i);break;case o.MessageType.Ping:break;case o.MessageType.Close:break;case o.MessageType.Ack:this._isAckMessage(i);break;case o.MessageType.Sequence:this._isSequenceMessage(i);break;default:n.log(o.LogLevel.Information,"Unknown message type '"+i.type+"' ignored.");continue}s.push(i)}return s}writeMessage(e){return o.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 Oe={trace:o.LogLevel.Trace,debug:o.LogLevel.Debug,info:o.LogLevel.Information,information:o.LogLevel.Information,warn:o.LogLevel.Warning,warning:o.LogLevel.Warning,error:o.LogLevel.Error,critical:o.LogLevel.Critical,none:o.LogLevel.None};function Ue(t){const e=Oe[t.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${t}`)}class We{configureLogging(e){if(o.Arg.isRequired(e,"logging"),Be(e))this.logger=e;else if(typeof e=="string"){const n=Ue(e);this.logger=new o.ConsoleLogger(n)}else this.logger=new o.ConsoleLogger(e);return this}withUrl(e,n){return o.Arg.isRequired(e,"url"),o.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 o.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 ee(e):this.reconnectPolicy=e:this.reconnectPolicy=new ee,this}withServerTimeout(e){return o.Arg.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return o.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 $e(this.url,e);return o.HubConnection.create(n,this.logger||o.NullLogger.instance,this.protocol||new He,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function Be(t){return t.log!==void 0}const Fe=10*1e3,ze=15*1e3,Ge=({children:t,apiUrl:e,endpoint:n})=>{const{authState:r,getToken:s}=m.useContext(o.AuthContext),a=ae.useIsBrowserOnline(),[i,l]=m.useState(o.HubConnectionState.Disconnected),[c,u]=m.useState(!1),h=m.useRef(null),w=m.useRef(s);w.current=s;const d=m.useCallback(()=>{var g;return l(((g=h.current)==null?void 0:g.state)??o.HubConnectionState.Disconnected)},[]);m.useEffect(()=>{if(r!=="AUTH_OK"||!a)return;let g=!1,v=null;const p=new We().withUrl(`${e}/${n}`,{accessTokenFactory:()=>w.current().then(_=>(_==null?void 0:_.token)??"")}).withAutomaticReconnect({nextRetryDelayInMilliseconds:_=>Math.min(1e3*2**_.previousRetryCount,ze)}).build();h.current=p,p.on("Connected",_=>{console.log("Server says:",_)}),p.onreconnecting(_=>{g||(console.log("Reconnecting...",_),d(),u(!0))}),p.onreconnected(()=>{g||(console.log("Reconnected"),d(),u(!1))}),p.onclose(_=>{g||(console.log("Connection closed",_),d(),u(!0))});const y=()=>{v!==null&&window.clearTimeout(v),p.start().then(()=>{if(g){p.stop().catch(_=>{console.log("Error stopping connection:",_)});return}console.log("Connection started"),d(),u(!1)}).catch(_=>{g||(console.log("Error starting connection:",_),d(),u(!0),v=window.setTimeout(y,Fe))})};return y(),()=>{g=!0,v!==null&&window.clearTimeout(v),h.current=null,p.stop().catch(_=>{console.log("Error stopping connection:",_)})}},[e,r,n,d,a]);const f=m.useMemo(()=>i===o.HubConnectionState.Connected,[i]),S=m.useMemo(()=>r==="AUTH_OK",[r]),C=m.useMemo(()=>({isAlive:f,shouldBeAlive:S,connectionState:i,hasLastConnectionEnded:c}),[f,S,i,c]);return b.jsx(o.ApiWebSocketContext.Provider,{value:C,children:t})},qe=()=>{const t=m.useContext(o.ApiWebSocketContext);if(!t)throw new Error("useApiWebSocket must be used within a ApiWebSocketProvider");return t},ne=50,Ve=()=>{const t=o.compilerRuntimeExports.c(22),{texts:e}=m.useContext(o.LuminusComponentsContext),{confirm:n}=e,{onConfirm:r,onCancel:s,text:a,show:i,textSm:l}=o.useConfirm(),c=l===void 0?a.length>ne:l,u=a.length>ne;let h;t[0]!==s||t[1]!==r||t[2]!==i?(h=p=>{if(i)e:switch(p.key){case"Enter":{p.preventDefault(),p.stopPropagation(),r();break e}case"Escape":{p.preventDefault(),p.stopPropagation(),s();break e}}},t[0]=s,t[1]=r,t[2]=i,t[3]=h):h=t[3];const w=h;o.useKeyPress(w);const d=u?void 0:"sm";let f;t[4]!==c||t[5]!==a?(f=b.jsx(o.Modal.Header,{className:"justify-content-center",children:c?b.jsx(o.Typography,{variant:"body",children:a}):b.jsx(o.Modal.Title,{children:a})}),t[4]=c,t[5]=a,t[6]=f):f=t[6];let S;t[7]!==n.no||t[8]!==s?(S=b.jsx(o.PrimaryButton,{type:"button",variant:"outlined",color:"secondary",className:"w-100",onClick:s,children:n.no}),t[7]=n.no,t[8]=s,t[9]=S):S=t[9];let C;t[10]!==n.yes||t[11]!==r?(C=b.jsx(o.PrimaryButton,{type:"button",color:"primary",onClick:r,className:"w-100 ml",children:n.yes}),t[10]=n.yes,t[11]=r,t[12]=C):C=t[12];let g;t[13]!==S||t[14]!==C?(g=b.jsx(o.Modal.Body,{children:b.jsxs("div",{className:"w-100 d-flex gap-5",children:[S,C]})}),t[13]=S,t[14]=C,t[15]=g):g=t[15];let v;return t[16]!==s||t[17]!==i||t[18]!==d||t[19]!==f||t[20]!==g?(v=b.jsxs(o.Modal,{show:i,size:d,centered:!0,onHide:s,children:[f,g]}),t[16]=s,t[17]=i,t[18]=d,t[19]=f,t[20]=g,t[21]=v):v=t[21],v};exports.ApiWebSocketContext=o.ApiWebSocketContext;exports.AuthContext=o.AuthContext;exports.DelegationContext=o.DelegationContext;exports.FormDisabledContext=o.FormDisabledContext;exports.HelmetContext=o.HelmetContext;exports.LoadingContext=o.LoadingContext;exports.LuminusComponentsContext=o.LuminusComponentsContext;exports.UserContext=o.UserContext;exports.useFormDisabledContext=o.useFormDisabledContext;exports.FormDisabledProvider=K.FormDisabledProvider;exports.ApiWebSocketProvider=Ge;exports.AuthProvider=ye;exports.DelegationProvider=Le;exports.HelmetProvider=Ee;exports.LoadingProvider=we;exports.LuminusComponentsProvider=me;exports.UserProvider=Se;exports.useApiWebSocketContext=qe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./nivo-bar-SBWBmyeI.cjs"),b=require("react/jsx-runtime"),w=require("react");require("react-router");const O=require("@azure/msal-browser"),se=require("@azure/msal-react");require("react-dom");require("react-hook-form");require("react-flexmonster");const K=require("./FormDisabledProvider-Dt39yr7W.cjs"),ie=require("./useLocalStorageState-Ca7olZgH.cjs"),ae=require("./useIsBrowserOnline-CREGrf2l.cjs");function le(t){const e=o.toDate(t);return e.setHours(23,59,59,999),e}function ce(){return le(Date.now())}function ue(t,e){const n=+o.toDate(t),[r,s]=[+o.toDate(e.start),+o.toDate(e.end)].sort((a,i)=>a-i);return n>=r&&n<=s}function he(){return o.startOfDay(Date.now())}const ge=t=>{const e=o.compilerRuntimeExports.c(10),{children:n}=t,[r,s]=w.useState(!1),[a,i]=w.useState(""),[l,c]=w.useState(void 0);let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=(v,p)=>{s(!0),i(v),c(p)},e[0]=u):u=e[0];const h=u;let m;e[1]===Symbol.for("react.memo_cache_sentinel")?(m=()=>{s(!1)},e[1]=m):m=e[1];const d=m;let f;e[2]!==r||e[3]!==a||e[4]!==l?(f={show:r,text:a,showConfirm:h,hideConfirm:d,textSm:l},e[2]=r,e[3]=a,e[4]=l,e[5]=f):f=e[5];const S=f;let C;e[6]===Symbol.for("react.memo_cache_sentinel")?(C=b.jsx(Ve,{}),e[6]=C):C=e[6];let g;return e[7]!==n||e[8]!==S?(g=b.jsxs(o.ConfirmContext.Provider,{value:S,children:[C,n]}),e[7]=n,e[8]=S,e[9]=g):g=e[9],g},de=()=>{const t=o.compilerRuntimeExports.c(49),{texts:e}=w.useContext(o.LuminusComponentsContext),{confirm:n}=e,{isShown:r,text:s,onFinish:a}=o.usePrompt(),{options:i}=w.useContext(o.PromptContext),[l,c]=w.useState(i.defaultValue??"");let u;t[0]!==a?(u=()=>{a(null)},t[0]=a,t[1]=u):u=t[1];const h=u;let m;t[2]!==a||t[3]!==i.required||t[4]!==l?(m=N=>{N.preventDefault(),!(i.required&&!l)&&(a(l),c(""))},t[2]=a,t[3]=i.required,t[4]=l,t[5]=m):m=t[5];const d=m;let f;t[6]===Symbol.for("react.memo_cache_sentinel")?(f=N=>c(N.currentTarget.value),t[6]=f):f=t[6];let S;t[7]!==l?(S={value:l,onChange:f,className:"w-100",autoFocus:!0,tabIndex:0},t[7]=l,t[8]=S):S=t[8];const C=S;let g,v;t[9]!==r||t[10]!==i.defaultValue?(g=()=>{r===!0&&c(i.defaultValue??"")},v=[r,i.defaultValue],t[9]=r,t[10]=i.defaultValue,t[11]=g,t[12]=v):(g=t[11],v=t[12]),w.useEffect(g,v);let p;t[13]!==s?(p=b.jsx(o.Modal.Header,{className:"justify-content-center",children:b.jsx(o.Modal.Title,{children:s})}),t[13]=s,t[14]=p):p=t[14];let y;t[15]!==C||t[16]!==i.input||t[17]!==i.maxLength?(y=i.input==="textarea"?b.jsx("textarea",{...C,rows:5,maxLength:i.maxLength}):void 0,t[15]=C,t[16]=i.input,t[17]=i.maxLength,t[18]=y):y=t[18];let _;t[19]!==C||t[20]!==i.input||t[21]!==i.maxLength||t[22]!==i.type?(_=i.input==="input"?b.jsx(o.FormControl,{...C,type:i.type,maxLength:i.maxLength}):void 0,t[19]=C,t[20]=i.input,t[21]=i.maxLength,t[22]=i.type,t[23]=_):_=t[23];let L;t[24]!==i.maxLength||t[25]!==l?(L=i.maxLength!=null&&b.jsx("div",{className:"d-flex justify-content-end",children:b.jsxs(o.Typography,{variant:"caption",children:[l.length,"/",i.maxLength]})}),t[24]=i.maxLength,t[25]=l,t[26]=L):L=t[26];let E;t[27]!==L||t[28]!==y||t[29]!==_?(E=b.jsxs(o.Modal.Body,{children:[y,_,L]}),t[27]=L,t[28]=y,t[29]=_,t[30]=E):E=t[30];let D;t[31]!==n.cancel||t[32]!==h?(D=b.jsx(o.PrimaryButton,{variant:"outlined",color:"secondary",onClick:h,className:"flex-grow-1",children:n.cancel}),t[31]=n.cancel,t[32]=h,t[33]=D):D=t[33];const A=i.required&&!l;let R;t[34]!==n.confirm||t[35]!==A?(R=b.jsx(o.PrimaryButton,{color:"primary",disabled:A,type:"submit",className:"flex-grow-1",children:n.confirm}),t[34]=n.confirm,t[35]=A,t[36]=R):R=t[36];let T;t[37]!==D||t[38]!==R?(T=b.jsxs(o.Modal.Footer,{className:"w-100 d-flex gap-5",children:[D,R]}),t[37]=D,t[38]=R,t[39]=T):T=t[39];let M;t[40]!==d||t[41]!==E||t[42]!==T?(M=b.jsxs("form",{onSubmit:d,onKeyDown:fe,children:[E,T]}),t[40]=d,t[41]=E,t[42]=T,t[43]=M):M=t[43];let $;return t[44]!==r||t[45]!==h||t[46]!==M||t[47]!==p?($=b.jsxs(o.Modal,{show:r,size:"sm",centered:!0,onHide:h,children:[p,M]}),t[44]=r,t[45]=h,t[46]=M,t[47]=p,t[48]=$):$=t[48],$};function fe(t){return t.stopPropagation()}const pe=t=>{const e=o.compilerRuntimeExports.c(11),{children:n}=t,[r,s]=w.useState(!1),[a,i]=w.useState("");let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={input:"textarea",type:"text"},e[0]=l):l=e[0];const[c,u]=w.useState(l),h=w.useRef(_e);let m;e[1]===Symbol.for("react.memo_cache_sentinel")?(m=y=>{i(y),s(!0)},e[1]=m):m=e[1];const d=m;let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{s(!1)},e[2]=f):f=e[2];const S=f;let C;e[3]!==r||e[4]!==c||e[5]!==a?(C={isShown:r,text:a,showPrompt:d,hidePrompt:S,resolveRef:h,options:c,setOptions:u},e[3]=r,e[4]=c,e[5]=a,e[6]=C):C=e[6];const g=C;let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=b.jsx(de,{}),e[7]=v):v=e[7];let p;return e[8]!==n||e[9]!==g?(p=b.jsxs(o.PromptContext.Provider,{value:g,children:[n,v]}),e[8]=n,e[9]=g,e[10]=p):p=e[10],p};function _e(){}const me=t=>{const e=o.compilerRuntimeExports.c(14),{cookieDomain:n,axiosOptions:r,language:s,texts:a,ProjectIconComponent:i,localizationContext:l,chartColorPalette:c,children:u}=t;let h;e[0]!==i||e[1]!==r||e[2]!==c||e[3]!==n||e[4]!==s||e[5]!==l||e[6]!==a?(h={axiosOptions:r,cookieDomain:n,language:s,texts:a,ProjectIconComponent:i,localizationContext:l,chartColorPalette:c},e[0]=i,e[1]=r,e[2]=c,e[3]=n,e[4]=s,e[5]=l,e[6]=a,e[7]=h):h=e[7];const m=h;let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=b.jsx(o.Fe,{}),e[8]=d):d=e[8];let f;e[9]!==u?(f=b.jsx(ge,{children:b.jsxs(pe,{children:[d,u]})}),e[9]=u,e[10]=f):f=e[10];let S;return e[11]!==m||e[12]!==f?(S=b.jsx(o.LuminusComponentsContext.Provider,{value:m,children:f}),e[11]=m,e[12]=f,e[13]=S):S=e[13],S},we=t=>{const e=o.compilerRuntimeExports.c(15),{children:n}=t,[r,s]=w.useState(!1);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=new Set,e[0]=a):a=e[0];const[i]=w.useState(a);let l;e[1]!==i?(l=C=>{i.add(C),s(!0)},e[1]=i,e[2]=l):l=e[2];const c=l;let u;e[3]!==i?(u=C=>{i.delete(C),i.size===0&&s(!1)},e[3]=i,e[4]=u):u=e[4];const h=u;let m;e[5]!==r||e[6]!==c||e[7]!==h?(m={isLoading:r,startLoading:c,stopLoading:h},e[5]=r,e[6]=c,e[7]=h,e[8]=m):m=e[8];const d=m;let f;e[9]!==r?(f=r&&b.jsx(K.Loading,{}),e[9]=r,e[10]=f):f=e[10];let S;return e[11]!==n||e[12]!==d||e[13]!==f?(S=b.jsxs(o.LoadingContext.Provider,{value:d,children:[f,n]}),e[11]=n,e[12]=d,e[13]=f,e[14]=S):S=e[14],S},Se=t=>{const e=o.compilerRuntimeExports.c(39),{children:n}=t,r=o.useAxios(),{msalInstance:s,getToken:a}=w.useContext(o.AuthContext),{delegation:i,setDelegation:l,setAvailableDelegations:c,refreshAvailableDelegations:u}=w.useContext(o.DelegationContext),[h,m]=w.useState(null);let d;e[0]!==a?(d=async()=>{const k=await a();k&&m(k.token)},e[0]=a,e[1]=d):d=e[1];const f=d;let S,C;e[2]!==f?(S=()=>{f()},C=[f],e[2]=f,e[3]=S,e[4]=C):(S=e[3],C=e[4]),w.useEffect(S,C);let g;if(e[5]===Symbol.for("react.memo_cache_sentinel")){e:{const k=localStorage.getItem("user")??null;if(!k){g=null;break e}g=JSON.parse(k??"")}e[5]=g}else g=e[5];const v=g;let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p={state:v?o.LoginState.LOGGED_IN:o.LoginState.LOGGED_OUT,user:v},e[6]=p):p=e[6];const[y,_]=w.useState(p);let L;e[7]!==r?(L=async k=>{let I=null;return await r.get("/user/detail",k?{headers:{Authorization:`Bearer ${k}`}}:void 0).then(X=>{I=X.data}).catch(()=>{I=null}),I},e[7]=r,e[8]=L):L=e[8];const E=L;let D;e[9]!==c||e[10]!==l?(D=()=>{localStorage.removeItem("user"),_({state:o.LoginState.LOGGED_OUT,user:null}),l(null),c(null)},e[9]=c,e[10]=l,e[11]=D):D=e[11];const A=D;let R;e[12]!==E||e[13]!==u?(R=async k=>{_({state:o.LoginState.LOGGING_IN,user:null});const I=await E(k);return I?(_({state:o.LoginState.LOGGED_IN,user:I}),localStorage.setItem("user",JSON.stringify(I)),await u(),!0):(_({state:o.LoginState.LOGIN_FAILED,user:null}),!1)},e[12]=E,e[13]=u,e[14]=R):R=e[14];const T=R;let M;e[15]!==s?(M=()=>{if(s){const k=s.addEventCallback(I=>{if(I.eventType===O.EventType.LOGIN_SUCCESS&&I.payload){const X=I.payload;m(X.accessToken)}});return()=>{k&&s.removeEventCallback(k)}}return ve},e[15]=s,e[16]=M):M=e[16];let $;e[17]!==T||e[18]!==A||e[19]!==s?($=[s,T,A],e[17]=T,e[18]=A,e[19]=s,e[20]=$):$=e[20],w.useEffect(M,$);let N;e[21]!==T||e[22]!==A||e[23]!==l?(N=async k=>{k&&await T(k).catch(()=>{A(),l(null)})},e[21]=T,e[22]=A,e[23]=l,e[24]=N):N=e[24];const H=N;let U;e[25]!==h||e[26]!==H?(U=()=>{H(h)},e[25]=h,e[26]=H,e[27]=U):U=e[27];const q=i==null?void 0:i.id;let W;e[28]!==h||e[29]!==H||e[30]!==q?(W=[h,q,H],e[28]=h,e[29]=H,e[30]=q,e[31]=W):W=e[31],w.useEffect(U,W);let B;e[32]!==T||e[33]!==A||e[34]!==y?(B={user:y.user,userLoginState:y,loginUser:T,logoutUser:A},e[32]=T,e[33]=A,e[34]=y,e[35]=B):B=e[35];const V=B;let F;return e[36]!==n||e[37]!==V?(F=b.jsx(o.UserContext.Provider,{value:V,children:n}),e[36]=n,e[37]=V,e[38]=F):F=e[38],F};function ve(){}const Ce=()=>{const t=o.compilerRuntimeExports.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=b.jsx("p",{children:"Redirecting..."}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=b.jsxs("div",{children:[e,b.jsxs("p",{children:["If you are not redirected within 10 seconds, please click"," ",b.jsx("a",{href:window.location.href.replace("/blank","/"),children:"here"})]})]}),t[1]=n):n=t[1],n},be=t=>{const e=t==null?void 0:t.getActiveAccount();console.log("getTokenMsal activeAccount",e);const n=t==null?void 0:t.getAllAccounts();console.log("getTokenMsal allAccounts",n);const r=(n==null?void 0:n.at(0))??void 0;return console.log("getTokenMsal account",r),r?(e||t==null||t.setActiveAccount(r),r):null},Q=({...t})=>{const{inProgress:e}=se.useMsal(),{cookieDomain:n}=w.useContext(o.LuminusComponentsContext),[,r]=o.useCookies(["Authorization"]),s=w.useMemo(()=>t.useMsal?t.msalInstance:null,[t.useMsal,t.useMsal?t.msalInstance:null]),a=w.useMemo(()=>t.useMsal?t.msalScopes:[],[t.useMsal,t.useMsal?t.msalScopes:null]),i=w.useMemo(()=>t.useMsal?t.msalExtraScopes:[],[t.useMsal,t.useMsal?t.msalExtraScopes:null]),l=w.useRef(null),c=w.useRef(!1),u=w.useCallback(()=>{const g=localStorage.getItem("token");return g?{token:g,expiresOn:K.addYears(new Date(Date.now()),1)}:null},[]),h=w.useCallback(async()=>{if(console.log("getTokenMsal"),s==null)throw console.log("getTokenMsal throwing error because msalInstance is null"),new Error("getTokenMsal: msalInstance is null");if(l.current)return console.log("getTokenMsal returning tokenRequestPromise.current",l.current),l.current;const g=new Promise((v,p)=>{const y=_=>{const L=be(s);if(!L){console.log("getTokenMsal no account found. Redirecting to login"),s==null||s.loginRedirect({scopes:a,extraScopesToConsent:i});return}s==null||s.acquireTokenSilent({scopes:a,account:L,redirectUri:t.useMsal?t.msalSilentRedirectUri:void 0}).then(E=>{_(),v({token:E.accessToken,expiresOn:E.expiresOn??new Date(Date.now())})}).catch(E=>{console.error("Error acquiring token",E),E instanceof O.InteractionRequiredAuthError&&(console.log("Silent token acquisition failed. Acquiring token using redirect"),s==null||s.acquireTokenRedirect({scopes:a,extraScopesToConsent:i}),_(),v(null)),_(),p(E)}).finally(()=>{_(),p(new Error("No access token returned from handleRedirectPromise"))})};c.current?y(()=>{l.current=null}):s.handleRedirectPromise().then(_=>{if(console.log("getTokenMsal tokenResponse",_),!(_!=null&&_.accessToken)){y(()=>{l.current=null,c.current=!0});return}l.current=null,c.current=!0,v({token:_.accessToken,expiresOn:_.expiresOn??new Date(Date.now())})})});return l.current=g,g},[i,s,a,t.msalSilentRedirectUri,t.useMsal]),m=w.useCallback(async()=>t.useMsal?h():u(),[u,h,t.useMsal]),d=w.useCallback(g=>t.useMsal?()=>{}:(window.addEventListener("storage",g),window.addEventListener("dev-auth-change",g),()=>{window.removeEventListener("storage",g),window.removeEventListener("dev-auth-change",g)}),[t.useMsal]),f=w.useSyncExternalStore(d,()=>localStorage.getItem("token")!==null?"AUTH_OK":"NO_AUTH"),S=w.useMemo(()=>{var g;return t.useMsal?e!==O.InteractionStatus.None?"AUTH_IN_PROGRESS":(s==null?void 0:s.getActiveAccount())??((g=s==null?void 0:s.getAllAccounts())==null?void 0:g[0])??null?"AUTH_OK":"NO_AUTH":f},[f,e,s,t.useMsal]),C=w.useMemo(()=>({useMsal:t.useMsal??!1,msalInstance:s,msalScopes:a,msalExtraScopes:i,getToken:m,authState:S}),[t.useMsal,s,a,i,m,S]);return w.useEffect(()=>{if(t.useMsal&&s){const g=s.addEventCallback(v=>{if(v.eventType===O.EventType.LOGIN_SUCCESS||v.eventType===O.EventType.ACQUIRE_TOKEN_SUCCESS&&v.payload){const p=v.payload,y=p.account;s.setActiveAccount(y);const _=p.accessToken,L=p.expiresOn;r("Authorization",_,{path:"/",secure:!0,sameSite:"none",domain:n,expires:L??void 0})}v.error&&console.error("AuthProvider MSAL Error",v)});return()=>{g&&s.removeEventCallback(g)}}return()=>{}},[t.useMsal,s,r,n]),b.jsx(o.AuthContext.Provider,{value:C,children:window.location.pathname==="/blank"?b.jsx(Ce,{}):t.children})},ye=t=>{const e=o.compilerRuntimeExports.c(9);let n;if(e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1],n.useMsal){let s;e[2]!==n?(s=b.jsx(Q,{...n}),e[2]=n,e[3]=s):s=e[3];let a;return e[4]!==n.msalInstance||e[5]!==s?(a=b.jsx(se.MsalProvider,{instance:n.msalInstance,children:s}),e[4]=n.msalInstance,e[5]=s,e[6]=a):a=e[6],a}let r;return e[7]!==n?(r=b.jsx(Q,{...n}),e[7]=n,e[8]=r):r=e[8],r},Le=t=>{const e=o.compilerRuntimeExports.c(18),{children:n,relativeEndpoint:r}=t,[s,a,i]=ie.useLocalStorageState("user-delegation",null);let l;e:{if(!s){l=null;break e}const L=s.from?o.parseISO(s.from):he(),E=s.to?o.parseISO(s.to):ce();if(!ue(new Date(Date.now()),{start:L,end:E})){a(null),l=null;break e}l=s}const c=l;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={nullStateBeforeLoad:!1,nullStateOnFail:!0},e[0]=u):u=e[0];const{data:h,setData:m,reloadData:d}=o.useGetApiData(r,u),f=w.useRef(null);let S,C;e[1]!==d?(S=()=>{const L=()=>{d(),f.current=window.setTimeout(L,o.msToStartOfNextDay()+5e3)};return L(),()=>{f.current!==null&&window.clearTimeout(f.current)}},C=[d],e[1]=d,e[2]=S,e[3]=C):(S=e[2],C=e[3]),w.useEffect(S,C);let g;e[4]!==i?(g=()=>{const L=()=>{i()};return window.addEventListener("focus",L),()=>{window.removeEventListener("focus",L)}},e[4]=i,e[5]=g):g=e[5];let v;e[6]!==i||e[7]!==d?(v=[i,d],e[6]=i,e[7]=d,e[8]=v):v=e[8],w.useEffect(g,v);let p;e[9]!==h||e[10]!==d||e[11]!==m||e[12]!==a||e[13]!==c?(p={delegation:c,setDelegation:a,availableDelegations:h,setAvailableDelegations:m,refreshAvailableDelegations:d},e[9]=h,e[10]=d,e[11]=m,e[12]=a,e[13]=c,e[14]=p):p=e[14];const y=p;let _;return e[15]!==n||e[16]!==y?(_=b.jsx(o.DelegationContext.Provider,{value:y,children:n}),e[15]=n,e[16]=y,e[17]=_):_=e[17],_},Y=(t,e)=>t?`${t} | ${e}`:e,Ee=t=>{const e=o.compilerRuntimeExports.c(18),{defaultHelmet:n,children:r,helmetPrefix:s}=t,a=s??"";let i;e[0]!==n||e[1]!==a?(i=Y(a,n),e[0]=n,e[1]=a,e[2]=i):i=e[2];let l;e[3]!==i?(l=[i],e[3]=i,e[4]=l):l=e[4];const[c,u]=w.useState(l);let h;e[5]!==s?(h=_=>{u(L=>[...L,Y(s??"",_)])},e[5]=s,e[6]=h):h=e[6];const m=h;let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{u(xe)},e[7]=d):d=e[7];const f=d;let S;e[8]!==c?(S=c.at(-1)??"",e[8]=c,e[9]=S):S=e[9];const C=S;let g;e[10]!==m?(g={addHelmet:m,removeHelmet:f},e[10]=m,e[11]=g):g=e[11];const v=g;let p;e[12]!==C?(p=b.jsx("title",{children:C}),e[12]=C,e[13]=p):p=e[13];let y;return e[14]!==r||e[15]!==v||e[16]!==p?(y=b.jsxs(o.HelmetContext.Provider,{value:v,children:[p,r]}),e[14]=r,e[15]=v,e[16]=p,e[17]=y):y=e[17],y};function xe(t){return t.length>1?t.slice(0,-1):t}class re{constructor(e,n,r){this.statusCode=e,this.statusText=n,this.content=r}}class G{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""}}class Te extends G{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||o.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(o.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 o.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 r;e.abortSignal&&(e.abortSignal.onabort=()=>{n.abort(),r=new o.AbortError});let s=null;if(e.timeout){const c=e.timeout;s=setTimeout(()=>{n.abort(),this._logger.log(o.LogLevel.Warning,"Timeout from HTTP request."),r=new o.TimeoutError},c)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},o.isArrayBuffer(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let a;try{a=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(c){throw r||(this._logger.log(o.LogLevel.Warning,`Error from HTTP request. ${c}.`),c)}finally{s&&clearTimeout(s),e.abortSignal&&(e.abortSignal.onabort=null)}if(!a.ok){const c=await Z(a,"text");throw new o.HttpError(c||a.statusText,a.status)}const l=await Z(a,e.responseType);return new re(a.status,a.statusText,l)}getCookieString(e){let n="";return o.Platform.isNode&&this._jar&&this._jar.getCookies(e,(r,s)=>n=s.join("; ")),n}}function Z(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 ke extends G{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new o.AbortError):e.method?e.url?new Promise((n,r)=>{const s=new XMLHttpRequest;s.open(e.method,e.url,!0),s.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,s.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(o.isArrayBuffer(e.content)?s.setRequestHeader("Content-Type","application/octet-stream"):s.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const a=e.headers;a&&Object.keys(a).forEach(i=>{s.setRequestHeader(i,a[i])}),e.responseType&&(s.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{s.abort(),r(new o.AbortError)}),e.timeout&&(s.timeout=e.timeout),s.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),s.status>=200&&s.status<300?n(new re(s.status,s.statusText,s.response||s.responseText)):r(new o.HttpError(s.response||s.responseText||s.statusText,s.status))},s.onerror=()=>{this._logger.log(o.LogLevel.Warning,`Error from HTTP request. ${s.status}: ${s.statusText}.`),r(new o.HttpError(s.statusText,s.status))},s.ontimeout=()=>{this._logger.log(o.LogLevel.Warning,"Timeout from HTTP request."),r(new o.TimeoutError)},s.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Pe extends G{constructor(e){if(super(),typeof fetch<"u"||o.Platform.isNode)this._httpClient=new Te(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new ke(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new o.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)}}const Ae=[0,2e3,1e4,3e4,null];class ee{constructor(e){this._retryDelays=e!==void 0?[...e,null]:Ae}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class j{}j.Authorization="Authorization";j.Cookie="Cookie";class De extends G{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 r=await this._innerClient.send(e);return n&&r.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):r}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[j.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[j.Authorization]&&delete e.headers[j.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}var x;(function(t){t[t.None=0]="None",t[t.WebSockets=1]="WebSockets",t[t.ServerSentEvents=2]="ServerSentEvents",t[t.LongPolling=4]="LongPolling"})(x||(x={}));var P;(function(t){t[t.Text=1]="Text",t[t.Binary=2]="Binary"})(P||(P={}));let Re=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 te{get pollAborted(){return this._pollAbort.aborted}constructor(e,n,r){this._httpClient=e,this._logger=n,this._pollAbort=new Re,this._options=r,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,n){if(o.Arg.isRequired(e,"url"),o.Arg.isRequired(n,"transferFormat"),o.Arg.isIn(n,P,"transferFormat"),this._url=e,this._logger.log(o.LogLevel.Trace,"(LongPolling transport) Connecting."),n===P.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[r,s]=o.getUserAgentHeader(),a={[r]:s,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:a,timeout:1e5,withCredentials:this._options.withCredentials};n===P.Binary&&(i.responseType="arraybuffer");const l=`${e}&_=${Date.now()}`;this._logger.log(o.LogLevel.Trace,`(LongPolling transport) polling: ${l}.`);const c=await this._httpClient.get(l,i);c.statusCode!==200?(this._logger.log(o.LogLevel.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new o.HttpError(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(e,n){try{for(;this._running;)try{const r=`${e}&_=${Date.now()}`;this._logger.log(o.LogLevel.Trace,`(LongPolling transport) polling: ${r}.`);const s=await this._httpClient.get(r,n);s.statusCode===204?(this._logger.log(o.LogLevel.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):s.statusCode!==200?(this._logger.log(o.LogLevel.Error,`(LongPolling transport) Unexpected response code: ${s.statusCode}.`),this._closeError=new o.HttpError(s.statusText||"",s.statusCode),this._running=!1):s.content?(this._logger.log(o.LogLevel.Trace,`(LongPolling transport) data received. ${o.getDataDetail(s.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(s.content)):this._logger.log(o.LogLevel.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(r){this._running?r instanceof o.TimeoutError?this._logger.log(o.LogLevel.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=r,this._running=!1):this._logger.log(o.LogLevel.Trace,`(LongPolling transport) Poll errored after shutdown: ${r.message}`)}}finally{this._logger.log(o.LogLevel.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?o.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(o.LogLevel.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(o.LogLevel.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[n,r]=o.getUserAgentHeader();e[n]=r;const s={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let a;try{await this._httpClient.delete(this._url,s)}catch(i){a=i}a?a instanceof o.HttpError&&(a.statusCode===404?this._logger.log(o.LogLevel.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(o.LogLevel.Trace,`(LongPolling transport) Error sending a DELETE request: ${a}`)):this._logger.log(o.LogLevel.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(o.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(o.LogLevel.Trace,e),this.onclose(this._closeError)}}}class Me{constructor(e,n,r,s){this._httpClient=e,this._accessToken=n,this._logger=r,this._options=s,this.onreceive=null,this.onclose=null}async connect(e,n){return o.Arg.isRequired(e,"url"),o.Arg.isRequired(n,"transferFormat"),o.Arg.isIn(n,P,"transferFormat"),this._logger.log(o.LogLevel.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((r,s)=>{let a=!1;if(n!==P.Text){s(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let i;if(o.Platform.isBrowser||o.Platform.isWebWorker)i=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const l=this._httpClient.getCookieString(e),c={};c.Cookie=l;const[u,h]=o.getUserAgentHeader();c[u]=h,i=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...c,...this._options.headers}})}try{i.onmessage=l=>{if(this.onreceive)try{this._logger.log(o.LogLevel.Trace,`(SSE transport) data received. ${o.getDataDetail(l.data,this._options.logMessageContent)}.`),this.onreceive(l.data)}catch(c){this._close(c);return}},i.onerror=l=>{a?this._close():s(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."))},i.onopen=()=>{this._logger.log(o.LogLevel.Information,`SSE connected to ${this._url}`),this._eventSource=i,a=!0,r()}}catch(l){s(l);return}})}async send(e){return this._eventSource?o.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 Ie{constructor(e,n,r,s,a,i){this._logger=r,this._accessTokenFactory=n,this._logMessageContent=s,this._webSocketConstructor=a,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=i}async connect(e,n){o.Arg.isRequired(e,"url"),o.Arg.isRequired(n,"transferFormat"),o.Arg.isIn(n,P,"transferFormat"),this._logger.log(o.LogLevel.Trace,"(WebSockets transport) Connecting.");let r;return this._accessTokenFactory&&(r=await this._accessTokenFactory()),new Promise((s,a)=>{e=e.replace(/^http/,"ws");let i;const l=this._httpClient.getCookieString(e);let c=!1;if(o.Platform.isNode||o.Platform.isReactNative){const u={},[h,m]=o.getUserAgentHeader();u[h]=m,r&&(u[j.Authorization]=`Bearer ${r}`),l&&(u[j.Cookie]=l),i=new this._webSocketConstructor(e,void 0,{headers:{...u,...this._headers}})}else r&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(r)}`);i||(i=new this._webSocketConstructor(e)),n===P.Binary&&(i.binaryType="arraybuffer"),i.onopen=u=>{this._logger.log(o.LogLevel.Information,`WebSocket connected to ${e}.`),this._webSocket=i,c=!0,s()},i.onerror=u=>{let h=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?h=u.error:h="There was an error with the transport",this._logger.log(o.LogLevel.Information,`(WebSockets transport) ${h}.`)},i.onmessage=u=>{if(this._logger.log(o.LogLevel.Trace,`(WebSockets transport) data received. ${o.getDataDetail(u.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(u.data)}catch(h){this._close(h);return}},i.onclose=u=>{if(c)this._close(u);else{let h=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?h=u.error:h="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.",a(new Error(h))}}})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(o.LogLevel.Trace,`(WebSockets transport) sending data. ${o.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(o.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 oe=100;class $e{constructor(e,n={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,o.Arg.isRequired(e,"url"),this._logger=o.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 r=null,s=null;if(o.Platform.isNode&&typeof require<"u"){const a=typeof __webpack_require__=="function"?__non_webpack_require__:require;r=a("ws"),s=a("eventsource")}!o.Platform.isNode&&typeof WebSocket<"u"&&!n.WebSocket?n.WebSocket=WebSocket:o.Platform.isNode&&!n.WebSocket&&r&&(n.WebSocket=r),!o.Platform.isNode&&typeof EventSource<"u"&&!n.EventSource?n.EventSource=EventSource:o.Platform.isNode&&!n.EventSource&&typeof s<"u"&&(n.EventSource=s),this._httpClient=new De(n.httpClient||new Pe(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||P.Binary,o.Arg.isIn(e,P,"transferFormat"),this._logger.log(o.LogLevel.Debug,`Starting connection with transfer format '${P[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(o.LogLevel.Error,n),await this._stopPromise,Promise.reject(new o.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(o.LogLevel.Error,n),Promise.reject(new o.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 J(this.transport)),this._sendQueue.send(e))}async stop(e){if(this._connectionState==="Disconnected")return this._logger.log(o.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(o.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(o.LogLevel.Error,`HttpConnection.transport.stop() threw error '${n}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(o.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===x.WebSockets)this.transport=this._constructTransport(x.WebSockets),await this._startTransport(n,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let r=null,s=0;do{if(r=await this._getNegotiationResponse(n),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new o.AbortError("The connection was stopped during negotiation.");if(r.error)throw new Error(r.error);if(r.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(r.url&&(n=r.url),r.accessToken){const a=r.accessToken;this._accessTokenFactory=()=>a,this._httpClient._accessToken=a,this._httpClient._accessTokenFactory=void 0}s++}while(r.url&&s<oe);if(s===oe&&r.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(n,this._options.transport,r,e)}this.transport instanceof te&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(o.LogLevel.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(r){return this._logger.log(o.LogLevel.Error,"Failed to start the connection: "+r),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(r)}}async _getNegotiationResponse(e){const n={},[r,s]=o.getUserAgentHeader();n[r]=s;const a=this._resolveNegotiateUrl(e);this._logger.log(o.LogLevel.Debug,`Sending negotiation request: ${a}.`);try{const i=await this._httpClient.post(a,{content:"",headers:{...n,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(i.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${i.statusCode}'`));const l=JSON.parse(i.content);return(!l.negotiateVersion||l.negotiateVersion<1)&&(l.connectionToken=l.connectionId),l.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new o.FailedToNegotiateWithServerError("Client didn't negotiate Stateful Reconnect but the server did.")):l}catch(i){let l="Failed to complete negotiation with the server: "+i;return i instanceof o.HttpError&&i.statusCode===404&&(l=l+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(o.LogLevel.Error,l),Promise.reject(new o.FailedToNegotiateWithServerError(l))}}_createConnectUrl(e,n){return n?e+(e.indexOf("?")===-1?"?":"&")+`id=${n}`:e}async _createTransport(e,n,r,s){let a=this._createConnectUrl(e,r.connectionToken);if(this._isITransport(n)){this._logger.log(o.LogLevel.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=n,await this._startTransport(a,s),this.connectionId=r.connectionId;return}const i=[],l=r.availableTransports||[];let c=r;for(const u of l){const h=this._resolveTransportOrError(u,n,s,(c==null?void 0:c.useStatefulReconnect)===!0);if(h instanceof Error)i.push(`${u.transport} failed:`),i.push(h);else if(this._isITransport(h)){if(this.transport=h,!c){try{c=await this._getNegotiationResponse(e)}catch(m){return Promise.reject(m)}a=this._createConnectUrl(e,c.connectionToken)}try{await this._startTransport(a,s),this.connectionId=c.connectionId;return}catch(m){if(this._logger.log(o.LogLevel.Error,`Failed to start the transport '${u.transport}': ${m}`),c=void 0,i.push(new o.FailedToStartTransportError(`${u.transport} failed: ${m}`,x[u.transport])),this._connectionState!=="Connecting"){const d="Failed to select transport before stop() was called.";return this._logger.log(o.LogLevel.Debug,d),Promise.reject(new o.AbortError(d))}}}}return i.length>0?Promise.reject(new o.AggregateErrors(`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 x.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new Ie(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case x.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Me(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case x.LongPolling:return new te(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 r=>{let s=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(e,n),await this.features.resend()}catch{s=!0}else{this._stopConnection(r);return}s&&this._stopConnection(r)}:this.transport.onclose=r=>this._stopConnection(r),this.transport.connect(e,n)}_resolveTransportOrError(e,n,r,s){const a=x[e.transport];if(a==null)return this._logger.log(o.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(Ne(n,a))if(e.transferFormats.map(l=>P[l]).indexOf(r)>=0){if(a===x.WebSockets&&!this._options.WebSocket||a===x.ServerSentEvents&&!this._options.EventSource)return this._logger.log(o.LogLevel.Debug,`Skipping transport '${x[a]}' because it is not supported in your environment.'`),new o.UnsupportedTransportError(`'${x[a]}' is not supported in your environment.`,a);this._logger.log(o.LogLevel.Debug,`Selecting transport '${x[a]}'.`);try{return this.features.reconnect=a===x.WebSockets?s:void 0,this._constructTransport(a)}catch(l){return l}}else return this._logger.log(o.LogLevel.Debug,`Skipping transport '${x[a]}' because it does not support the requested transfer format '${P[r]}'.`),new Error(`'${x[a]}' does not support ${P[r]}.`);else return this._logger.log(o.LogLevel.Debug,`Skipping transport '${x[a]}' because it was disabled by the client.`),new o.DisabledTransportError(`'${x[a]}' is disabled by the client.`,a)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(o.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(o.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(o.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(o.LogLevel.Error,`Connection disconnected with error '${e}'.`):this._logger.log(o.LogLevel.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(n=>{this._logger.log(o.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(o.LogLevel.Error,`HttpConnection.onclose(${e}) threw error '${n}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!o.Platform.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const n=window.document.createElement("a");return n.href=e,this._logger.log(o.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 r=new URLSearchParams(n.searchParams);return r.has("negotiateVersion")||r.append("negotiateVersion",this._negotiateVersion.toString()),r.has("useStatefulReconnect")?r.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&r.append("useStatefulReconnect","true"),n.search=r.toString(),n.toString()}}function Ne(t,e){return!t||(e&t)!==0}class J{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new z,this._transportResult=new z,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new z),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 z;const e=this._transportResult;this._transportResult=void 0;const n=typeof this._buffer[0]=="string"?this._buffer.join(""):J._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(n),e.resolve()}catch(r){e.reject(r)}}}static _concatBuffers(e){const n=e.map(a=>a.byteLength).reduce((a,i)=>a+i),r=new Uint8Array(n);let s=0;for(const a of e)r.set(new Uint8Array(a),s),s+=a.byteLength;return r.buffer}}class z{constructor(){this.promise=new Promise((e,n)=>[this._resolver,this._rejecter]=[e,n])}resolve(){this._resolver()}reject(e){this._rejecter(e)}}const je="json";class He{constructor(){this.name=je,this.version=2,this.transferFormat=P.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=o.NullLogger.instance);const r=o.TextMessageFormat.parse(e),s=[];for(const a of r){const i=JSON.parse(a);if(typeof i.type!="number")throw new Error("Invalid payload.");switch(i.type){case o.MessageType.Invocation:this._isInvocationMessage(i);break;case o.MessageType.StreamItem:this._isStreamItemMessage(i);break;case o.MessageType.Completion:this._isCompletionMessage(i);break;case o.MessageType.Ping:break;case o.MessageType.Close:break;case o.MessageType.Ack:this._isAckMessage(i);break;case o.MessageType.Sequence:this._isSequenceMessage(i);break;default:n.log(o.LogLevel.Information,"Unknown message type '"+i.type+"' ignored.");continue}s.push(i)}return s}writeMessage(e){return o.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 Oe={trace:o.LogLevel.Trace,debug:o.LogLevel.Debug,info:o.LogLevel.Information,information:o.LogLevel.Information,warn:o.LogLevel.Warning,warning:o.LogLevel.Warning,error:o.LogLevel.Error,critical:o.LogLevel.Critical,none:o.LogLevel.None};function Ue(t){const e=Oe[t.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${t}`)}class We{configureLogging(e){if(o.Arg.isRequired(e,"logging"),Be(e))this.logger=e;else if(typeof e=="string"){const n=Ue(e);this.logger=new o.ConsoleLogger(n)}else this.logger=new o.ConsoleLogger(e);return this}withUrl(e,n){return o.Arg.isRequired(e,"url"),o.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 o.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 ee(e):this.reconnectPolicy=e:this.reconnectPolicy=new ee,this}withServerTimeout(e){return o.Arg.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return o.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 $e(this.url,e);return o.HubConnection.create(n,this.logger||o.NullLogger.instance,this.protocol||new He,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function Be(t){return t.log!==void 0}const Fe=10*1e3,ze=15*1e3,Ge=({children:t,apiUrl:e,endpoint:n})=>{const{authState:r,getToken:s}=w.useContext(o.AuthContext),a=ae.useIsBrowserOnline(),[i,l]=w.useState(o.HubConnectionState.Disconnected),[c,u]=w.useState(!1),h=w.useRef(null),m=w.useRef(s);m.current=s;const d=w.useCallback(()=>{var g;return l(((g=h.current)==null?void 0:g.state)??o.HubConnectionState.Disconnected)},[]);w.useEffect(()=>{if(r!=="AUTH_OK"||!a)return;let g=!1,v=null;const p=new We().withUrl(`${e}/${n}`,{accessTokenFactory:()=>m.current().then(_=>(_==null?void 0:_.token)??"")}).withAutomaticReconnect({nextRetryDelayInMilliseconds:_=>Math.min(1e3*2**_.previousRetryCount,ze)}).build();h.current=p,p.on("Connected",_=>{console.log("WS: Server says:",_)}),p.onreconnecting(_=>{g||(console.log("WS: Reconnecting...",_),d())}),p.onreconnected(()=>{g||(console.log("WS: Reconnected"),d(),u(!1))}),p.onclose(_=>{g||(console.log("WS: Connection closed",_),d(),u(!0))});const y=()=>{v!==null&&window.clearTimeout(v),p.start().then(()=>{if(g){p.stop().catch(_=>{console.log("WS: Error stopping connection:",_)});return}console.log("WS: Connection started"),d(),u(!1)}).catch(_=>{g||(console.log("WS: Error starting connection:",_),d(),u(!0),v=window.setTimeout(y,Fe))})};return y(),()=>{g=!0,v!==null&&window.clearTimeout(v),h.current=null,d(),u(!1),p.stop().catch(_=>{console.log("WS: Error stopping connection:",_)})}},[e,r,n,d,a]);const f=w.useMemo(()=>i===o.HubConnectionState.Connected,[i]),S=r==="AUTH_OK"&&a,C=w.useMemo(()=>({isAlive:f,shouldBeAlive:S,connectionState:i,hasLastConnectionEnded:c}),[f,S,i,c]);return b.jsx(o.ApiWebSocketContext.Provider,{value:C,children:t})},qe=()=>{const t=w.useContext(o.ApiWebSocketContext);if(!t)throw new Error("useApiWebSocket must be used within a ApiWebSocketProvider");return t},ne=50,Ve=()=>{const t=o.compilerRuntimeExports.c(22),{texts:e}=w.useContext(o.LuminusComponentsContext),{confirm:n}=e,{onConfirm:r,onCancel:s,text:a,show:i,textSm:l}=o.useConfirm(),c=l===void 0?a.length>ne:l,u=a.length>ne;let h;t[0]!==s||t[1]!==r||t[2]!==i?(h=p=>{if(i)e:switch(p.key){case"Enter":{p.preventDefault(),p.stopPropagation(),r();break e}case"Escape":{p.preventDefault(),p.stopPropagation(),s();break e}}},t[0]=s,t[1]=r,t[2]=i,t[3]=h):h=t[3];const m=h;o.useKeyPress(m);const d=u?void 0:"sm";let f;t[4]!==c||t[5]!==a?(f=b.jsx(o.Modal.Header,{className:"justify-content-center",children:c?b.jsx(o.Typography,{variant:"body",children:a}):b.jsx(o.Modal.Title,{children:a})}),t[4]=c,t[5]=a,t[6]=f):f=t[6];let S;t[7]!==n.no||t[8]!==s?(S=b.jsx(o.PrimaryButton,{type:"button",variant:"outlined",color:"secondary",className:"w-100",onClick:s,children:n.no}),t[7]=n.no,t[8]=s,t[9]=S):S=t[9];let C;t[10]!==n.yes||t[11]!==r?(C=b.jsx(o.PrimaryButton,{type:"button",color:"primary",onClick:r,className:"w-100 ml",children:n.yes}),t[10]=n.yes,t[11]=r,t[12]=C):C=t[12];let g;t[13]!==S||t[14]!==C?(g=b.jsx(o.Modal.Body,{children:b.jsxs("div",{className:"w-100 d-flex gap-5",children:[S,C]})}),t[13]=S,t[14]=C,t[15]=g):g=t[15];let v;return t[16]!==s||t[17]!==i||t[18]!==d||t[19]!==f||t[20]!==g?(v=b.jsxs(o.Modal,{show:i,size:d,centered:!0,onHide:s,children:[f,g]}),t[16]=s,t[17]=i,t[18]=d,t[19]=f,t[20]=g,t[21]=v):v=t[21],v};exports.ApiWebSocketContext=o.ApiWebSocketContext;exports.AuthContext=o.AuthContext;exports.DelegationContext=o.DelegationContext;exports.FormDisabledContext=o.FormDisabledContext;exports.HelmetContext=o.HelmetContext;exports.LoadingContext=o.LoadingContext;exports.LuminusComponentsContext=o.LuminusComponentsContext;exports.UserContext=o.UserContext;exports.useFormDisabledContext=o.useFormDisabledContext;exports.FormDisabledProvider=K.FormDisabledProvider;exports.ApiWebSocketProvider=Ge;exports.AuthProvider=ye;exports.DelegationProvider=Le;exports.HelmetProvider=Ee;exports.LoadingProvider=we;exports.LuminusComponentsProvider=me;exports.UserProvider=Se;exports.useApiWebSocketContext=qe;
|
package/dist/contexts.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as re, bZ as Oe, c as H, b_ as He, W as ae, ag as
|
|
1
|
+
import { t as re, bZ as Oe, c as H, b_ as He, W as ae, ag as We, b$ as Le, X as U, ad as Ue, Z as Ae, an as ie, c0 as je, ak as Fe, ai as Be, bi as pe, bD as De, bk as Q, aj as ze, c1 as Ge, aA as we, ap as Xe, c2 as Ve, c3 as Ke, c4 as R, c5 as Je, c6 as j, c7 as l, c8 as _e, c9 as Ie, ca as V, cb as E, cc as Z, cd as ce, ce as Re, cf as Qe, cg as Se, ch as Ye, ci as qe, cj as Ze, ck as et, cl as be, cm as G, cn as Me, co as Ce, cp as tt, cq as fe, cr as $e, ah as nt, bd as ot } from "./nivo-bar-D6NJLYWS.js";
|
|
2
2
|
import { cs as pn, a6 as _n } from "./nivo-bar-D6NJLYWS.js";
|
|
3
3
|
import { jsxs as A, jsx as y } from "react/jsx-runtime";
|
|
4
|
-
import { useState as D, useContext as
|
|
4
|
+
import { useState as D, useContext as z, useEffect as B, useRef as Y, useMemo as X, useCallback as q, useSyncExternalStore as st } from "react";
|
|
5
5
|
import "react-router";
|
|
6
6
|
import { EventType as ge, InteractionStatus as rt, InteractionRequiredAuthError as it } from "@azure/msal-browser";
|
|
7
7
|
import { MsalProvider as ct, useMsal as at } from "@azure/msal-react";
|
|
@@ -62,15 +62,15 @@ const mt = (t) => {
|
|
|
62
62
|
}, wt = () => {
|
|
63
63
|
const t = H.c(49), {
|
|
64
64
|
texts: e
|
|
65
|
-
} =
|
|
65
|
+
} = z(ae), {
|
|
66
66
|
confirm: n
|
|
67
67
|
} = e, {
|
|
68
68
|
isShown: s,
|
|
69
69
|
text: o,
|
|
70
70
|
onFinish: i
|
|
71
|
-
} =
|
|
71
|
+
} = We(), {
|
|
72
72
|
options: r
|
|
73
|
-
} =
|
|
73
|
+
} = z(Le), [c, a] = D(r.defaultValue ?? "");
|
|
74
74
|
let h;
|
|
75
75
|
t[0] !== i ? (h = () => {
|
|
76
76
|
i(null);
|
|
@@ -95,13 +95,13 @@ const mt = (t) => {
|
|
|
95
95
|
let d, S;
|
|
96
96
|
t[9] !== s || t[10] !== r.defaultValue ? (d = () => {
|
|
97
97
|
s === !0 && a(r.defaultValue ?? "");
|
|
98
|
-
}, S = [s, r.defaultValue], t[9] = s, t[10] = r.defaultValue, t[11] = d, t[12] = S) : (d = t[11], S = t[12]),
|
|
98
|
+
}, S = [s, r.defaultValue], t[9] = s, t[10] = r.defaultValue, t[11] = d, t[12] = S) : (d = t[11], S = t[12]), B(d, S);
|
|
99
99
|
let p;
|
|
100
|
-
t[13] !== o ? (p = /* @__PURE__ */ y(
|
|
100
|
+
t[13] !== o ? (p = /* @__PURE__ */ y(U.Header, { className: "justify-content-center", children: /* @__PURE__ */ y(U.Title, { children: o }) }), t[13] = o, t[14] = p) : p = t[14];
|
|
101
101
|
let C;
|
|
102
102
|
t[15] !== b || t[16] !== r.input || t[17] !== r.maxLength ? (C = r.input === "textarea" ? /* @__PURE__ */ y("textarea", { ...b, rows: 5, maxLength: r.maxLength }) : void 0, t[15] = b, t[16] = r.input, t[17] = r.maxLength, t[18] = C) : C = t[18];
|
|
103
103
|
let _;
|
|
104
|
-
t[19] !== b || t[20] !== r.input || t[21] !== r.maxLength || t[22] !== r.type ? (_ = r.input === "input" ? /* @__PURE__ */ y(
|
|
104
|
+
t[19] !== b || t[20] !== r.input || t[21] !== r.maxLength || t[22] !== r.type ? (_ = r.input === "input" ? /* @__PURE__ */ y(Ue, { ...b, type: r.type, maxLength: r.maxLength }) : void 0, t[19] = b, t[20] = r.input, t[21] = r.maxLength, t[22] = r.type, t[23] = _) : _ = t[23];
|
|
105
105
|
let v;
|
|
106
106
|
t[24] !== r.maxLength || t[25] !== c ? (v = r.maxLength != null && /* @__PURE__ */ y("div", { className: "d-flex justify-content-end", children: /* @__PURE__ */ A(Ae, { variant: "caption", children: [
|
|
107
107
|
c.length,
|
|
@@ -109,7 +109,7 @@ const mt = (t) => {
|
|
|
109
109
|
r.maxLength
|
|
110
110
|
] }) }), t[24] = r.maxLength, t[25] = c, t[26] = v) : v = t[26];
|
|
111
111
|
let k;
|
|
112
|
-
t[27] !== v || t[28] !== C || t[29] !== _ ? (k = /* @__PURE__ */ A(
|
|
112
|
+
t[27] !== v || t[28] !== C || t[29] !== _ ? (k = /* @__PURE__ */ A(U.Body, { children: [
|
|
113
113
|
C,
|
|
114
114
|
_,
|
|
115
115
|
v
|
|
@@ -120,7 +120,7 @@ const mt = (t) => {
|
|
|
120
120
|
let $;
|
|
121
121
|
t[34] !== n.confirm || t[35] !== I ? ($ = /* @__PURE__ */ y(ie, { color: "primary", disabled: I, type: "submit", className: "flex-grow-1", children: n.confirm }), t[34] = n.confirm, t[35] = I, t[36] = $) : $ = t[36];
|
|
122
122
|
let P;
|
|
123
|
-
t[37] !== M || t[38] !== $ ? (P = /* @__PURE__ */ A(
|
|
123
|
+
t[37] !== M || t[38] !== $ ? (P = /* @__PURE__ */ A(U.Footer, { className: "w-100 d-flex gap-5", children: [
|
|
124
124
|
M,
|
|
125
125
|
$
|
|
126
126
|
] }), t[37] = M, t[38] = $, t[39] = P) : P = t[39];
|
|
@@ -129,11 +129,11 @@ const mt = (t) => {
|
|
|
129
129
|
k,
|
|
130
130
|
P
|
|
131
131
|
] }), t[40] = f, t[41] = k, t[42] = P, t[43] = N) : N = t[43];
|
|
132
|
-
let
|
|
133
|
-
return t[44] !== s || t[45] !== u || t[46] !== N || t[47] !== p ? (
|
|
132
|
+
let W;
|
|
133
|
+
return t[44] !== s || t[45] !== u || t[46] !== N || t[47] !== p ? (W = /* @__PURE__ */ A(U, { show: s, size: "sm", centered: !0, onHide: u, children: [
|
|
134
134
|
p,
|
|
135
135
|
N
|
|
136
|
-
] }), t[44] = s, t[45] = u, t[46] = N, t[47] = p, t[48] =
|
|
136
|
+
] }), t[44] = s, t[45] = u, t[46] = N, t[47] = p, t[48] = W) : W = t[48], W;
|
|
137
137
|
};
|
|
138
138
|
function St(t) {
|
|
139
139
|
return t.stopPropagation();
|
|
@@ -247,12 +247,12 @@ const on = (t) => {
|
|
|
247
247
|
} = t, s = Be(), {
|
|
248
248
|
msalInstance: o,
|
|
249
249
|
getToken: i
|
|
250
|
-
} =
|
|
250
|
+
} = z(pe), {
|
|
251
251
|
delegation: r,
|
|
252
252
|
setDelegation: c,
|
|
253
253
|
setAvailableDelegations: a,
|
|
254
254
|
refreshAvailableDelegations: h
|
|
255
|
-
} =
|
|
255
|
+
} = z(De), [u, m] = D(null);
|
|
256
256
|
let f;
|
|
257
257
|
e[0] !== i ? (f = async () => {
|
|
258
258
|
const x = await i();
|
|
@@ -262,7 +262,7 @@ const on = (t) => {
|
|
|
262
262
|
let w, b;
|
|
263
263
|
e[2] !== g ? (w = () => {
|
|
264
264
|
g();
|
|
265
|
-
}, b = [g], e[2] = g, e[3] = w, e[4] = b) : (w = e[3], b = e[4]),
|
|
265
|
+
}, b = [g], e[2] = g, e[3] = w, e[4] = b) : (w = e[3], b = e[4]), B(w, b);
|
|
266
266
|
let d;
|
|
267
267
|
if (e[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
268
268
|
e: {
|
|
@@ -336,8 +336,8 @@ const on = (t) => {
|
|
|
336
336
|
}
|
|
337
337
|
return yt;
|
|
338
338
|
}, e[15] = o, e[16] = N) : N = e[16];
|
|
339
|
-
let
|
|
340
|
-
e[17] !== P || e[18] !== I || e[19] !== o ? (
|
|
339
|
+
let W;
|
|
340
|
+
e[17] !== P || e[18] !== I || e[19] !== o ? (W = [o, P, I], e[17] = P, e[18] = I, e[19] = o, e[20] = W) : W = e[20], B(N, W);
|
|
341
341
|
let F;
|
|
342
342
|
e[21] !== P || e[22] !== I || e[23] !== c ? (F = async (x) => {
|
|
343
343
|
x && await P(x).catch(() => {
|
|
@@ -351,7 +351,7 @@ const on = (t) => {
|
|
|
351
351
|
}, e[25] = u, e[26] = J, e[27] = ee) : ee = e[27];
|
|
352
352
|
const he = r == null ? void 0 : r.id;
|
|
353
353
|
let te;
|
|
354
|
-
e[28] !== u || e[29] !== J || e[30] !== he ? (te = [u, he, J], e[28] = u, e[29] = J, e[30] = he, e[31] = te) : te = e[31],
|
|
354
|
+
e[28] !== u || e[29] !== J || e[30] !== he ? (te = [u, he, J], e[28] = u, e[29] = J, e[30] = he, e[31] = te) : te = e[31], B(ee, te);
|
|
355
355
|
let ne;
|
|
356
356
|
e[32] !== P || e[33] !== I || e[34] !== C ? (ne = {
|
|
357
357
|
user: C.user,
|
|
@@ -392,15 +392,15 @@ const vt = () => {
|
|
|
392
392
|
inProgress: e
|
|
393
393
|
} = at(), {
|
|
394
394
|
cookieDomain: n
|
|
395
|
-
} =
|
|
395
|
+
} = z(ae), [, s] = Ge(["Authorization"]), o = X(
|
|
396
396
|
() => t.useMsal ? t.msalInstance : null,
|
|
397
397
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
398
398
|
[t.useMsal, t.useMsal ? t.msalInstance : null]
|
|
399
|
-
), i =
|
|
399
|
+
), i = X(
|
|
400
400
|
() => t.useMsal ? t.msalScopes : [],
|
|
401
401
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
402
402
|
[t.useMsal, t.useMsal ? t.msalScopes : null]
|
|
403
|
-
), r =
|
|
403
|
+
), r = X(
|
|
404
404
|
() => t.useMsal ? t.msalExtraScopes : [],
|
|
405
405
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
406
406
|
[t.useMsal, t.useMsal ? t.msalExtraScopes : null]
|
|
@@ -462,10 +462,10 @@ const vt = () => {
|
|
|
462
462
|
}, [r, o, i, t.msalSilentRedirectUri, t.useMsal]), m = q(async () => t.useMsal ? u() : h(), [h, u, t.useMsal]), f = q((d) => t.useMsal ? () => {
|
|
463
463
|
} : (window.addEventListener("storage", d), window.addEventListener("dev-auth-change", d), () => {
|
|
464
464
|
window.removeEventListener("storage", d), window.removeEventListener("dev-auth-change", d);
|
|
465
|
-
}), [t.useMsal]), g = st(f, () => localStorage.getItem("token") !== null ? "AUTH_OK" : "NO_AUTH"), w =
|
|
465
|
+
}), [t.useMsal]), g = st(f, () => localStorage.getItem("token") !== null ? "AUTH_OK" : "NO_AUTH"), w = X(() => {
|
|
466
466
|
var d;
|
|
467
467
|
return t.useMsal ? e !== rt.None ? "AUTH_IN_PROGRESS" : (o == null ? void 0 : o.getActiveAccount()) ?? ((d = o == null ? void 0 : o.getAllAccounts()) == null ? void 0 : d[0]) ?? null ? "AUTH_OK" : "NO_AUTH" : g;
|
|
468
|
-
}, [g, e, o, t.useMsal]), b =
|
|
468
|
+
}, [g, e, o, t.useMsal]), b = X(() => ({
|
|
469
469
|
useMsal: t.useMsal ?? !1,
|
|
470
470
|
msalInstance: o,
|
|
471
471
|
msalScopes: i,
|
|
@@ -473,7 +473,7 @@ const vt = () => {
|
|
|
473
473
|
getToken: m,
|
|
474
474
|
authState: w
|
|
475
475
|
}), [t.useMsal, o, i, r, m, w]);
|
|
476
|
-
return
|
|
476
|
+
return B(() => {
|
|
477
477
|
if (t.useMsal && o) {
|
|
478
478
|
const d = o.addEventCallback((S) => {
|
|
479
479
|
if (S.eventType === ge.LOGIN_SUCCESS || S.eventType === ge.ACQUIRE_TOKEN_SUCCESS && S.payload) {
|
|
@@ -550,7 +550,7 @@ const vt = () => {
|
|
|
550
550
|
return v(), () => {
|
|
551
551
|
g.current !== null && window.clearTimeout(g.current);
|
|
552
552
|
};
|
|
553
|
-
}, b = [f], e[1] = f, e[2] = w, e[3] = b) : (w = e[2], b = e[3]),
|
|
553
|
+
}, b = [f], e[1] = f, e[2] = w, e[3] = b) : (w = e[2], b = e[3]), B(w, b);
|
|
554
554
|
let d;
|
|
555
555
|
e[4] !== r ? (d = () => {
|
|
556
556
|
const v = () => {
|
|
@@ -561,7 +561,7 @@ const vt = () => {
|
|
|
561
561
|
};
|
|
562
562
|
}, e[4] = r, e[5] = d) : d = e[5];
|
|
563
563
|
let S;
|
|
564
|
-
e[6] !== r || e[7] !== f ? (S = [r, f], e[6] = r, e[7] = f, e[8] = S) : S = e[8],
|
|
564
|
+
e[6] !== r || e[7] !== f ? (S = [r, f], e[6] = r, e[7] = f, e[8] = S) : S = e[8], B(d, S);
|
|
565
565
|
let p;
|
|
566
566
|
e[9] !== u || e[10] !== f || e[11] !== m || e[12] !== i || e[13] !== a ? (p = {
|
|
567
567
|
delegation: a,
|
|
@@ -1319,23 +1319,23 @@ class Ot {
|
|
|
1319
1319
|
if (typeof r.type != "number")
|
|
1320
1320
|
throw new Error("Invalid payload.");
|
|
1321
1321
|
switch (r.type) {
|
|
1322
|
-
case
|
|
1322
|
+
case G.Invocation:
|
|
1323
1323
|
this._isInvocationMessage(r);
|
|
1324
1324
|
break;
|
|
1325
|
-
case
|
|
1325
|
+
case G.StreamItem:
|
|
1326
1326
|
this._isStreamItemMessage(r);
|
|
1327
1327
|
break;
|
|
1328
|
-
case
|
|
1328
|
+
case G.Completion:
|
|
1329
1329
|
this._isCompletionMessage(r);
|
|
1330
1330
|
break;
|
|
1331
|
-
case
|
|
1331
|
+
case G.Ping:
|
|
1332
1332
|
break;
|
|
1333
|
-
case
|
|
1333
|
+
case G.Close:
|
|
1334
1334
|
break;
|
|
1335
|
-
case
|
|
1335
|
+
case G.Ack:
|
|
1336
1336
|
this._isAckMessage(r);
|
|
1337
1337
|
break;
|
|
1338
|
-
case
|
|
1338
|
+
case G.Sequence:
|
|
1339
1339
|
this._isSequenceMessage(r);
|
|
1340
1340
|
break;
|
|
1341
1341
|
default:
|
|
@@ -1390,18 +1390,18 @@ const Ht = {
|
|
|
1390
1390
|
critical: l.Critical,
|
|
1391
1391
|
none: l.None
|
|
1392
1392
|
};
|
|
1393
|
-
function
|
|
1393
|
+
function Wt(t) {
|
|
1394
1394
|
const e = Ht[t.toLowerCase()];
|
|
1395
1395
|
if (typeof e < "u")
|
|
1396
1396
|
return e;
|
|
1397
1397
|
throw new Error(`Unknown log level: ${t}`);
|
|
1398
1398
|
}
|
|
1399
|
-
class
|
|
1399
|
+
class Ut {
|
|
1400
1400
|
configureLogging(e) {
|
|
1401
1401
|
if (E.isRequired(e, "logging"), jt(e))
|
|
1402
1402
|
this.logger = e;
|
|
1403
1403
|
else if (typeof e == "string") {
|
|
1404
|
-
const n =
|
|
1404
|
+
const n = Wt(e);
|
|
1405
1405
|
this.logger = new Ce(n);
|
|
1406
1406
|
} else
|
|
1407
1407
|
this.logger = new Ce(e);
|
|
@@ -1469,50 +1469,50 @@ const Ft = 10 * 1e3, Bt = 15 * 1e3, un = ({
|
|
|
1469
1469
|
const {
|
|
1470
1470
|
authState: s,
|
|
1471
1471
|
getToken: o
|
|
1472
|
-
} =
|
|
1472
|
+
} = z(pe), i = dt(), [r, c] = D(fe.Disconnected), [a, h] = D(!1), u = Y(null), m = Y(o);
|
|
1473
1473
|
m.current = o;
|
|
1474
1474
|
const f = q(() => {
|
|
1475
1475
|
var d;
|
|
1476
1476
|
return c(((d = u.current) == null ? void 0 : d.state) ?? fe.Disconnected);
|
|
1477
1477
|
}, []);
|
|
1478
|
-
|
|
1478
|
+
B(() => {
|
|
1479
1479
|
if (s !== "AUTH_OK" || !i)
|
|
1480
1480
|
return;
|
|
1481
1481
|
let d = !1, S = null;
|
|
1482
|
-
const p = new
|
|
1482
|
+
const p = new Ut().withUrl(`${e}/${n}`, {
|
|
1483
1483
|
accessTokenFactory: () => m.current().then((_) => (_ == null ? void 0 : _.token) ?? "")
|
|
1484
1484
|
}).withAutomaticReconnect({
|
|
1485
1485
|
nextRetryDelayInMilliseconds: (_) => Math.min(1e3 * 2 ** _.previousRetryCount, Bt)
|
|
1486
1486
|
}).build();
|
|
1487
1487
|
u.current = p, p.on("Connected", (_) => {
|
|
1488
|
-
console.log("Server says:", _);
|
|
1488
|
+
console.log("WS: Server says:", _);
|
|
1489
1489
|
}), p.onreconnecting((_) => {
|
|
1490
|
-
d || (console.log("Reconnecting...", _), f()
|
|
1490
|
+
d || (console.log("WS: Reconnecting...", _), f());
|
|
1491
1491
|
}), p.onreconnected(() => {
|
|
1492
|
-
d || (console.log("Reconnected"), f(), h(!1));
|
|
1492
|
+
d || (console.log("WS: Reconnected"), f(), h(!1));
|
|
1493
1493
|
}), p.onclose((_) => {
|
|
1494
|
-
d || (console.log("Connection closed", _), f(), h(!0));
|
|
1494
|
+
d || (console.log("WS: Connection closed", _), f(), h(!0));
|
|
1495
1495
|
});
|
|
1496
1496
|
const C = () => {
|
|
1497
1497
|
S !== null && window.clearTimeout(S), p.start().then(() => {
|
|
1498
1498
|
if (d) {
|
|
1499
1499
|
p.stop().catch((_) => {
|
|
1500
|
-
console.log("Error stopping connection:", _);
|
|
1500
|
+
console.log("WS: Error stopping connection:", _);
|
|
1501
1501
|
});
|
|
1502
1502
|
return;
|
|
1503
1503
|
}
|
|
1504
|
-
console.log("Connection started"), f(), h(!1);
|
|
1504
|
+
console.log("WS: Connection started"), f(), h(!1);
|
|
1505
1505
|
}).catch((_) => {
|
|
1506
|
-
d || (console.log("Error starting connection:", _), f(), h(!0), S = window.setTimeout(C, Ft));
|
|
1506
|
+
d || (console.log("WS: Error starting connection:", _), f(), h(!0), S = window.setTimeout(C, Ft));
|
|
1507
1507
|
});
|
|
1508
1508
|
};
|
|
1509
1509
|
return C(), () => {
|
|
1510
|
-
d = !0, S !== null && window.clearTimeout(S), u.current = null, p.stop().catch((_) => {
|
|
1511
|
-
console.log("Error stopping connection:", _);
|
|
1510
|
+
d = !0, S !== null && window.clearTimeout(S), u.current = null, f(), h(!1), p.stop().catch((_) => {
|
|
1511
|
+
console.log("WS: Error stopping connection:", _);
|
|
1512
1512
|
});
|
|
1513
1513
|
};
|
|
1514
1514
|
}, [e, s, n, f, i]);
|
|
1515
|
-
const g =
|
|
1515
|
+
const g = X(() => r === fe.Connected, [r]), w = s === "AUTH_OK" && i, b = X(() => ({
|
|
1516
1516
|
isAlive: g,
|
|
1517
1517
|
shouldBeAlive: w,
|
|
1518
1518
|
connectionState: r,
|
|
@@ -1520,14 +1520,14 @@ const Ft = 10 * 1e3, Bt = 15 * 1e3, un = ({
|
|
|
1520
1520
|
}), [g, w, r, a]);
|
|
1521
1521
|
return /* @__PURE__ */ y($e.Provider, { value: b, children: t });
|
|
1522
1522
|
}, dn = () => {
|
|
1523
|
-
const t =
|
|
1523
|
+
const t = z($e);
|
|
1524
1524
|
if (!t)
|
|
1525
1525
|
throw new Error("useApiWebSocket must be used within a ApiWebSocketProvider");
|
|
1526
1526
|
return t;
|
|
1527
1527
|
}, xe = 50, zt = () => {
|
|
1528
1528
|
const t = H.c(22), {
|
|
1529
1529
|
texts: e
|
|
1530
|
-
} =
|
|
1530
|
+
} = z(ae), {
|
|
1531
1531
|
confirm: n
|
|
1532
1532
|
} = e, {
|
|
1533
1533
|
onConfirm: s,
|
|
@@ -1552,18 +1552,18 @@ const Ft = 10 * 1e3, Bt = 15 * 1e3, un = ({
|
|
|
1552
1552
|
}, t[0] = o, t[1] = s, t[2] = r, t[3] = u) : u = t[3], ot(u);
|
|
1553
1553
|
const f = h ? void 0 : "sm";
|
|
1554
1554
|
let g;
|
|
1555
|
-
t[4] !== a || t[5] !== i ? (g = /* @__PURE__ */ y(
|
|
1555
|
+
t[4] !== a || t[5] !== i ? (g = /* @__PURE__ */ y(U.Header, { className: "justify-content-center", children: a ? /* @__PURE__ */ y(Ae, { variant: "body", children: i }) : /* @__PURE__ */ y(U.Title, { children: i }) }), t[4] = a, t[5] = i, t[6] = g) : g = t[6];
|
|
1556
1556
|
let w;
|
|
1557
1557
|
t[7] !== n.no || t[8] !== o ? (w = /* @__PURE__ */ y(ie, { type: "button", variant: "outlined", color: "secondary", className: "w-100", onClick: o, children: n.no }), t[7] = n.no, t[8] = o, t[9] = w) : w = t[9];
|
|
1558
1558
|
let b;
|
|
1559
1559
|
t[10] !== n.yes || t[11] !== s ? (b = /* @__PURE__ */ y(ie, { type: "button", color: "primary", onClick: s, className: "w-100 ml", children: n.yes }), t[10] = n.yes, t[11] = s, t[12] = b) : b = t[12];
|
|
1560
1560
|
let d;
|
|
1561
|
-
t[13] !== w || t[14] !== b ? (d = /* @__PURE__ */ y(
|
|
1561
|
+
t[13] !== w || t[14] !== b ? (d = /* @__PURE__ */ y(U.Body, { children: /* @__PURE__ */ A("div", { className: "w-100 d-flex gap-5", children: [
|
|
1562
1562
|
w,
|
|
1563
1563
|
b
|
|
1564
1564
|
] }) }), t[13] = w, t[14] = b, t[15] = d) : d = t[15];
|
|
1565
1565
|
let S;
|
|
1566
|
-
return t[16] !== o || t[17] !== r || t[18] !== f || t[19] !== g || t[20] !== d ? (S = /* @__PURE__ */ A(
|
|
1566
|
+
return t[16] !== o || t[17] !== r || t[18] !== f || t[19] !== g || t[20] !== d ? (S = /* @__PURE__ */ A(U, { show: r, size: f, centered: !0, onHide: o, children: [
|
|
1567
1567
|
g,
|
|
1568
1568
|
d
|
|
1569
1569
|
] }), t[16] = o, t[17] = r, t[18] = f, t[19] = g, t[20] = d, t[21] = S) : S = t[21], S;
|