import{a as et,b as da,c as lt}from"/accounts/build/_shared/chunk-VUARYXZT.js";import{b as H}from"/accounts/build/_shared/chunk-7N3GWXXL.js";import{a as ge,b as be}from"/accounts/build/_shared/chunk-PARH5HSO.js";import{a as se,b as ie,d as ut,e as oe,f as ne,g as le,i as ce,j as O,m as de,n as pe,o as at,p as ue,q as me}from"/accounts/build/_shared/chunk-HP4BMUJL.js";import{a as P,c as Gt,d as Zt,f as Wt,g as Yt,h as $t,k as Xt,l as Jt,m as Qt,n as te,o as ee,p as ae,r as re,s as C}from"/accounts/build/_shared/chunk-2OSNKVOL.js";import{c as kt,d as v}from"/accounts/build/_shared/chunk-GOPQ4PBN.js";var ea=kt((ro,ta)=>{ta.exports={}});var ra=kt((so,aa)=>{aa.exports={}});var oa=kt((oo,ia)=>{ia.exports={}});var rt=v(C(),1);var he=v(C(),1),U=v(P(),1),fe=(0,U.createContext)(void 0),St=({isLoggedIn:t,children:e})=>{let[a,r]=(0,U.useState)({loaded:!1}),s=(0,U.useRef)(!1);(0,U.useEffect)(()=>{if(Boolean(a.user)||s.current)return;s.current=!0;let l=()=>{r({loaded:!0}),document.cookie=`__sso_status=;path=/;SameSite=Lax;expires=${new Date(0).toUTCString()}`};fetch("/sso/user").then(async c=>{let d=await c.json();"user"in d?d.user?r({user:d.user,loaded:!0}):l():(console.error("Invalid user data format"),l())}).catch(()=>{l()}).finally(()=>{s.current=!1})},[t,a.user]);let{user:i,loaded:o}=a,n={isLoggedIn:o?Boolean(i):t,user:i};return(0,he.jsx)(fe.Provider,{value:n,children:e})};function F(){let t=(0,U.useContext)(fe);if(!t)throw new Error("Setup SsoContextProvider");return t}var Mt=()=>{let{isLoggedIn:t,user:e}=F();return t&&e?(0,rt.jsxs)("p",{children:["You are using the account of",(0,rt.jsx)("br",{}),e.displayName]}):void 0},Nt=({children:t,location:e})=>{let{isLoggedIn:a}=F();return(0,rt.jsxs)("form",{name:"login-form",action:a?"/sso/logout":"/sso/login",children:[(0,rt.jsx)("input",{type:"hidden",name:"__sso_redirect",value:`${e.pathname}${e.search}${e.hash}`}),t]})};var X=async(t,e)=>{var a;let r=new AbortController,s=750,i=setTimeout(()=>{et().error(`AbortError: Aborting fetch to GC backend because it took longer than ${s}ms`),r.abort()},s);et().debug(`Fetching data from: ${t.toString()}`);let o=await fetch(t,{signal:r.signal,headers:{Cookie:(a=e.headers.get("cookie"))!==null&&a!==void 0?a:""}});if(clearTimeout(i),!o.ok)throw new Error(`Backend data is not available. Status code: ${o.status}: ${t.toString()}`);return o.json()};var pa={isEqual:!0,isMatchingKey:!0,isPromise:!0,maxSize:!0,onCacheAdd:!0,onCacheChange:!0,onCacheHit:!0,transformKey:!0},ua=Array.prototype.slice;function mt(t){var e=t.length;return e?e===1?[t[0]]:e===2?[t[0],t[1]]:e===3?[t[0],t[1],t[2]]:ua.call(t,0):[]}function ma(t){var e={};for(var a in t)pa[a]||(e[a]=t[a]);return e}function ga(t){return typeof t=="function"&&t.isMemoized}function ba(t,e){return t===e||t!==t&&e!==e}function ve(t,e){var a={};for(var r in t)a[r]=t[r];for(var r in e)a[r]=e[r];return a}var ha=function(){function t(e){this.keys=[],this.values=[],this.options=e;var a=typeof e.isMatchingKey=="function";a?this.getKeyIndex=this._getKeyIndexFromMatchingKey:e.maxSize>1?this.getKeyIndex=this._getKeyIndexForMany:this.getKeyIndex=this._getKeyIndexForSingle,this.canTransformKey=typeof e.transformKey=="function",this.shouldCloneArguments=this.canTransformKey||a,this.shouldUpdateOnAdd=typeof e.onCacheAdd=="function",this.shouldUpdateOnChange=typeof e.onCacheChange=="function",this.shouldUpdateOnHit=typeof e.onCacheHit=="function"}return Object.defineProperty(t.prototype,"size",{get:function(){return this.keys.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return{keys:mt(this.keys),size:this.size,values:mt(this.values)}},enumerable:!1,configurable:!0}),t.prototype._getKeyIndexFromMatchingKey=function(e){var a=this.options,r=a.isMatchingKey,s=a.maxSize,i=this.keys,o=i.length;if(!o)return-1;if(r(i[0],e))return 0;if(s>1){for(var n=1;n