1import{a as i,j as e}from"./vendor-core.6lta8LCj.js";import{D as k,bu as A,bl as R,B as y,S as j,dB as b,dh as E,dC as I,dD as W,V as w,X as C}from"./bootstrap.Yl9dpo2n.js";import{E as D}from"./ErrorState.CTkw3FNO.js";import{Z as P,_ as v,y as T,$ as F,a0 as B}from"./App.DVmysEmP.js";import"./vendor-mui-x.CmnfcHjQ.js";import"./vendor-firebase.dbYXL2Q0.js";const U=async n=>{try{const a=w(n);if(!a)return null;const t=await C({refresh:!1,parent:a});return t!=null&&t.type&&t.token?`${t.type} ${t.token}`:null}catch(a){return null}},K=()=>{const{signedIn:n}=k(),{authRedirectionReady:a}=A(),{workspace:t,loaded:c,load:d}=P(),{data:s,isLoading:l}=v(t!=null?t:void 0),u=i.useRef(!1),[L,h]=i.useState(!1);return i.useEffect(()=>{if(!n||!a)return;if(!c){d();return}if(t&&l||u.current)return;u.current=!0,(async()=>{var g;try{const r=b(),m=await E();if(!m){h(!0);return}const p=t?await U(t):null,f=new URLSearchParams(globalThis.location.search),x=I(W((g=f.get("redirect"))!=null?g:void 0,r.origin),globalThis.location.hash);x&&r.searchParams.set("redirect",x);const S=f.get("state");S&&r.searchParams.set("state",S);const o=new URLSearchParams({token:m});t&&o.set("workspace",t),t&&(s!=null&&s.primaryLanguage)&&o.set("workspaceLanguageCode",s.primaryLanguage),p&&t&&(o.set("assistantAuthorization",p),o.set("assistantWorkspace",t)),r.hash=o.toString(),globalThis.location.replace(r.toString())}catch(r){h(!0)}})()},[n,a,c,d,t,s==null?void 0:s.primaryLanguage,l]),e.jsxs(e.Fragment,{children:[e.jsx(R,{}),e.jsx(y,{component:"div",children:n?e.jsx(y,{component:"div",sx:{maxWidth:"640px",width:"100%",mx:"auto",textAlign:"center",px:"1rem"},children:e.jsx(j,{direction:"column",spacing:2,sx:{alignItems:"center"},children:L?e.jsx(D,{title:"Could not open Docs",message:"Reload and try again. If this continues, contact support to check your Docs sign-in configuration.",onRetry:()=>globalThis.location.reload(),retryLabel:"Reload"}):e.jsx(T,{messages:F,sx:{py:0}})})}):e.jsx(B,{authWidgetProps:{heading:e.jsxs(e.Fragment,{children:["Log in to",e.jsx("br",{}),"Inworld Docs"]}),arrow:!0}})})]})};export{K as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.