@deephaven/code-studio 0.39.1-beta.8 → 0.39.1-beta.9

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.
@@ -1,2 +1,2 @@
1
- import{A as e,C as n}from"./vendor-e5d695d3.js";import{q as h}from"./index-e16c2665.js";import{ai as C,a7 as m,aj as P,ab as A,ak as L,al as j,am as v,an as y,ao as B,ap as w,aq as E,ar as M,as as F,at as S,au as k}from"./useConnection-ee2c1d21.js";import{av as K,aw as Q,aB as W,ax as X,az as Y,ay as Z,aA as nn,ac as tn,ad as en}from"./useConnection-ee2c1d21.js";import"./helpers-042e6b4d.js";import"./monaco-13f9c9bb.js";const p=e.createContext(!1);function R({fontClassNames:t=["fira-sans-regular","fira-sans-bold","fira-mono"],children:s}){const[a,o]=e.useState(!1);return e.useEffect(function(){document.fonts.ready.then(()=>{o(!0)})},[]),n.jsxs(n.Fragment,{children:[n.jsx(p.Provider,{value:a,children:s}),n.jsx("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:t.map(i=>n.jsx("p",{className:i,children:"preload"},i))})]})}function b(){const t=C();return e.useEffect(function(){t.postMessage(m(P))},[t]),null}const O=new Map([["@deephaven/auth-plugins.AuthPluginPsk",y],["@deephaven/auth-plugins.AuthPluginParent",B],["@deephaven/auth-plugins.AuthPluginAnonymous",w]]);function U({children:t}){const s=A(),a=e.useContext(L),[o,i]=e.useState(),[r,u]=e.useState();e.useEffect(function(){let g=!1;async function x(){try{const f=await s.getAuthConfigValues();g||i(new Map(f))}catch(f){g||u(f)}}return x(),()=>{g=!0}},[s]);const l=e.useMemo(()=>{if(!(a==null||o==null))try{return j(a,o,O)}catch(d){u(d)}},[o,a]),c=l==null||o==null;return c||r!=null?n.jsx(h,{isLoading:c&&r==null,errorMessage:v(r)}):n.jsx(l,{authConfigValues:o,children:n.jsxs(n.Fragment,{children:[n.jsx(b,{}),t]})})}function z(t){return new URL(t,`${window.location}`)}function V(){return new URLSearchParams(window.location.search).get("envoyPrefix")}function _(){const t=V();return t!=null?{headers:{"envoy-prefix":t}}:{headers:{}}}function G({children:t}){return e.useContext(p)?n.jsx(n.Fragment,{children:t}):n.jsx(h,{"data-testid":"fonts-loaded-loading"})}function D({fontClassNames:t,pluginsUrl:s,serverUrl:a,children:o}){const i=e.useMemo(()=>_(),[]),[r,u]=e.useState(0),l=e.useCallback(()=>{},[]),c=e.useCallback(()=>{u(d=>d+1)},[]);return E(l,c),n.jsx(R,{fontClassNames:t,children:n.jsx(M,{pluginsUrl:s,children:n.jsx(F,{serverUrl:a,options:i,children:n.jsx(S,{children:n.jsx(U,{children:n.jsx(k,{children:n.jsx(G,{children:o})})})})},r)})})}export{D as AppBootstrap,U as AuthBootstrap,k as ConnectionBootstrap,K as ConnectionContext,R as FontBootstrap,G as FontsLoaded,p as FontsLoadedContext,M as PluginsBootstrap,L as PluginsContext,Q as RemoteComponent,W as getAuthHandlers,j as getAuthPluginComponent,z as getBaseUrl,_ as getConnectOptions,V as getEnvoyPrefix,X as loadComponentPlugin,Y as loadJson,Z as loadModulePlugin,nn as loadModulePlugins,tn as useConnection,en as usePlugins};
2
- //# sourceMappingURL=index-454c7b07.js.map
1
+ import{A as e,C as n}from"./vendor-e5d695d3.js";import{q as h}from"./index-19f6a2e3.js";import{ai as C,a7 as m,aj as P,ab as A,ak as L,al as j,am as v,an as y,ao as B,ap as w,aq as E,ar as M,as as F,at as S,au as k}from"./useConnection-67acb37a.js";import{av as K,aw as Q,aB as W,ax as X,az as Y,ay as Z,aA as nn,ac as tn,ad as en}from"./useConnection-67acb37a.js";import"./helpers-042e6b4d.js";import"./monaco-13f9c9bb.js";const p=e.createContext(!1);function R({fontClassNames:t=["fira-sans-regular","fira-sans-bold","fira-mono"],children:s}){const[a,o]=e.useState(!1);return e.useEffect(function(){document.fonts.ready.then(()=>{o(!0)})},[]),n.jsxs(n.Fragment,{children:[n.jsx(p.Provider,{value:a,children:s}),n.jsx("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:t.map(i=>n.jsx("p",{className:i,children:"preload"},i))})]})}function b(){const t=C();return e.useEffect(function(){t.postMessage(m(P))},[t]),null}const O=new Map([["@deephaven/auth-plugins.AuthPluginPsk",y],["@deephaven/auth-plugins.AuthPluginParent",B],["@deephaven/auth-plugins.AuthPluginAnonymous",w]]);function U({children:t}){const s=A(),a=e.useContext(L),[o,i]=e.useState(),[r,u]=e.useState();e.useEffect(function(){let g=!1;async function x(){try{const f=await s.getAuthConfigValues();g||i(new Map(f))}catch(f){g||u(f)}}return x(),()=>{g=!0}},[s]);const l=e.useMemo(()=>{if(!(a==null||o==null))try{return j(a,o,O)}catch(d){u(d)}},[o,a]),c=l==null||o==null;return c||r!=null?n.jsx(h,{isLoading:c&&r==null,errorMessage:v(r)}):n.jsx(l,{authConfigValues:o,children:n.jsxs(n.Fragment,{children:[n.jsx(b,{}),t]})})}function z(t){return new URL(t,`${window.location}`)}function V(){return new URLSearchParams(window.location.search).get("envoyPrefix")}function _(){const t=V();return t!=null?{headers:{"envoy-prefix":t}}:{headers:{}}}function G({children:t}){return e.useContext(p)?n.jsx(n.Fragment,{children:t}):n.jsx(h,{"data-testid":"fonts-loaded-loading"})}function D({fontClassNames:t,pluginsUrl:s,serverUrl:a,children:o}){const i=e.useMemo(()=>_(),[]),[r,u]=e.useState(0),l=e.useCallback(()=>{},[]),c=e.useCallback(()=>{u(d=>d+1)},[]);return E(l,c),n.jsx(R,{fontClassNames:t,children:n.jsx(M,{pluginsUrl:s,children:n.jsx(F,{serverUrl:a,options:i,children:n.jsx(S,{children:n.jsx(U,{children:n.jsx(k,{children:n.jsx(G,{children:o})})})})},r)})})}export{D as AppBootstrap,U as AuthBootstrap,k as ConnectionBootstrap,K as ConnectionContext,R as FontBootstrap,G as FontsLoaded,p as FontsLoadedContext,M as PluginsBootstrap,L as PluginsContext,Q as RemoteComponent,W as getAuthHandlers,j as getAuthPluginComponent,z as getBaseUrl,_ as getConnectOptions,V as getEnvoyPrefix,X as loadComponentPlugin,Y as loadJson,Z as loadModulePlugin,nn as loadModulePlugins,tn as useConnection,en as usePlugins};
2
+ //# sourceMappingURL=index-ea0bb999.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-454c7b07.js","sources":["../../../app-utils/src/components/FontBootstrap.tsx","../../../app-utils/src/components/LoginNotifier.tsx","../../../app-utils/src/components/AuthBootstrap.tsx","../../../app-utils/src/utils/ConnectUtils.ts","../../../app-utils/src/components/FontsLoaded.tsx","../../../app-utils/src/components/AppBootstrap.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState } from 'react';\nimport 'fira';\n\nexport const FontsLoadedContext = createContext<boolean>(false);\n\nexport type FontBootstrapProps = {\n /**\n * Class names of the font elements to pre load\n */\n fontClassNames?: string[];\n\n /**\n * The children to render wrapped with the FontsLoadedContext.\n * Note that it renders the children even if the fonts aren't loaded yet.\n */\n children: React.ReactNode;\n};\n\n/**\n * FontBootstrap component. Handles preloading fonts.\n */\nexport function FontBootstrap({\n fontClassNames = ['fira-sans-regular', 'fira-sans-bold', 'fira-mono'],\n children,\n}: FontBootstrapProps) {\n const [isLoaded, setIsLoaded] = useState(false);\n useEffect(function initFonts() {\n document.fonts.ready.then(() => {\n setIsLoaded(true);\n });\n }, []);\n\n return (\n <>\n <FontsLoadedContext.Provider value={isLoaded}>\n {children}\n </FontsLoadedContext.Provider>\n {/*\n Need to preload any monaco and Deephaven grid fonts.\n We hide text with all the fonts we need on the root app.jsx page\n Load the Fira Mono font so that Monaco calculates word wrapping properly.\n This element doesn't need to be visible, just load the font and stay hidden.\n https://github.com/microsoft/vscode/issues/88689\n Can be replaced with a rel=\"preload\" when firefox adds support\n https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content\n */}\n <div\n id=\"preload-fonts\"\n style={{ visibility: 'hidden', position: 'absolute', top: -10000 }}\n >\n {/* trigger loading of fonts needed by monaco and iris grid */}\n {fontClassNames.map(className => (\n <p key={className} className={className}>\n preload\n </p>\n ))}\n </div>\n </>\n );\n}\n\nexport default FontBootstrap;\n","import { useBroadcastChannel } from '@deephaven/jsapi-components';\nimport { BROADCAST_LOGIN_MESSAGE, makeMessage } from '@deephaven/jsapi-utils';\nimport { useEffect } from 'react';\n\n/**\n * Component that broadcasts a message when mounted. Should be mounted after the user has logged in.\n */\nexport function LoginNotifier() {\n const channel = useBroadcastChannel();\n useEffect(\n function notifyLogin() {\n channel.postMessage(makeMessage(BROADCAST_LOGIN_MESSAGE));\n },\n [channel]\n );\n return null;\n}\n\nexport default LoginNotifier;\n","import React, { useContext, useEffect, useMemo, useState } from 'react';\nimport {\n AuthConfigMap,\n AuthPluginAnonymous,\n AuthPluginParent,\n AuthPluginPsk,\n} from '@deephaven/auth-plugins';\nimport { LoadingOverlay } from '@deephaven/components';\nimport { useClient } from '@deephaven/jsapi-bootstrap';\nimport { getErrorMessage } from '@deephaven/utils';\nimport { PluginsContext } from './PluginsBootstrap';\nimport { getAuthPluginComponent } from '../plugins';\nimport LoginNotifier from './LoginNotifier';\n\nexport type AuthBootstrapProps = {\n /**\n * The children to render after authentication is completed.\n */\n children: React.ReactNode;\n};\n\n/** Core auth plugins that are always loaded */\nconst CORE_AUTH_PLUGINS = new Map([\n ['@deephaven/auth-plugins.AuthPluginPsk', AuthPluginPsk],\n ['@deephaven/auth-plugins.AuthPluginParent', AuthPluginParent],\n ['@deephaven/auth-plugins.AuthPluginAnonymous', AuthPluginAnonymous],\n]);\n\n/**\n * AuthBootstrap component. Handles displaying the auth plugin and authenticating.\n */\nexport function AuthBootstrap({ children }: AuthBootstrapProps) {\n const client = useClient();\n // `useContext` instead of `usePlugins` so that we don't have to wait for the plugins to load\n // We want to load the auth config values in parallel with the plugins\n const plugins = useContext(PluginsContext);\n const [authConfig, setAuthConfig] = useState<AuthConfigMap>();\n const [error, setError] = useState<unknown>();\n\n useEffect(\n function initAuthConfigValues() {\n let isCanceled = false;\n async function loadAuthConfigValues() {\n try {\n const newAuthConfigValues = await client.getAuthConfigValues();\n if (!isCanceled) {\n setAuthConfig(new Map(newAuthConfigValues));\n }\n } catch (e) {\n if (!isCanceled) {\n setError(e);\n }\n }\n }\n loadAuthConfigValues();\n return () => {\n isCanceled = true;\n };\n },\n [client]\n );\n\n const AuthComponent = useMemo(() => {\n if (plugins == null || authConfig == null) {\n return undefined;\n }\n\n try {\n return getAuthPluginComponent(plugins, authConfig, CORE_AUTH_PLUGINS);\n } catch (e) {\n setError(e);\n }\n }, [authConfig, plugins]);\n\n const isLoading = AuthComponent == null || authConfig == null;\n\n if (isLoading || error != null) {\n return (\n <LoadingOverlay\n isLoading={isLoading && error == null}\n errorMessage={getErrorMessage(error)}\n />\n );\n }\n return (\n <AuthComponent authConfigValues={authConfig}>\n <>\n <LoginNotifier />\n {children}\n </>\n </AuthComponent>\n );\n}\n\nexport default AuthBootstrap;\n","import type { ConnectOptions } from '@deephaven/jsapi-types';\n\n/**\n * Get the base URL of the API\n * @param apiUrl API URL\n * @returns URL for the base of the API\n */\nexport function getBaseUrl(apiUrl: string): URL {\n return new URL(apiUrl, `${window.location}`);\n}\n\n/**\n * Get the Envoy prefix header value\n * @returns Envoy prefix header value\n */\nexport function getEnvoyPrefix(): string | null {\n const searchParams = new URLSearchParams(window.location.search);\n return searchParams.get('envoyPrefix');\n}\n\nexport function getConnectOptions(): ConnectOptions {\n const envoyPrefix = getEnvoyPrefix();\n return envoyPrefix != null\n ? { headers: { 'envoy-prefix': envoyPrefix } }\n : { headers: {} };\n}\n","import React, { useContext } from 'react';\nimport { LoadingOverlay } from '@deephaven/components';\nimport { FontsLoadedContext } from './FontBootstrap';\n\nexport type FontsLoadedProps = {\n /** Children to show when the fonts have completed loading */\n children: React.ReactNode;\n};\n\nexport function FontsLoaded({ children }: FontsLoadedProps) {\n const isFontsLoaded = useContext(FontsLoadedContext);\n\n if (!isFontsLoaded) {\n return <LoadingOverlay data-testid=\"fonts-loaded-loading\" />;\n }\n\n // eslint-disable-next-line react/jsx-no-useless-fragment\n return <>{children}</>;\n}\n\nexport default FontsLoaded;\n","import React, { useCallback, useMemo, useState } from 'react';\nimport '@deephaven/components/scss/BaseStyleSheet.scss';\nimport { ClientBootstrap } from '@deephaven/jsapi-bootstrap';\nimport {\n RefreshTokenBootstrap,\n useBroadcastLoginListener,\n} from '@deephaven/jsapi-components';\nimport FontBootstrap from './FontBootstrap';\nimport PluginsBootstrap from './PluginsBootstrap';\nimport AuthBootstrap from './AuthBootstrap';\nimport ConnectionBootstrap from './ConnectionBootstrap';\nimport { getConnectOptions } from '../utils';\nimport FontsLoaded from './FontsLoaded';\n\nexport type AppBootstrapProps = {\n /** URL of the server. */\n serverUrl: string;\n\n /** URL of the plugins to load. */\n pluginsUrl: string;\n\n /** Font class names to load. */\n fontClassNames?: string[];\n\n /**\n * The children to render wrapped when everything is loaded and authenticated.\n */\n children: React.ReactNode;\n};\n\n/**\n * AppBootstrap component. Handles loading the fonts, client, and authentication.\n * Will display the children when everything is loaded and authenticated.\n */\nexport function AppBootstrap({\n fontClassNames,\n pluginsUrl,\n serverUrl,\n children,\n}: AppBootstrapProps) {\n const clientOptions = useMemo(() => getConnectOptions(), []);\n\n // On logout, we reset the client and have user login again\n const [logoutCount, setLogoutCount] = useState(0);\n const onLogin = useCallback(() => undefined, []);\n const onLogout = useCallback(() => {\n setLogoutCount(value => value + 1);\n }, []);\n useBroadcastLoginListener(onLogin, onLogout);\n return (\n <FontBootstrap fontClassNames={fontClassNames}>\n <PluginsBootstrap pluginsUrl={pluginsUrl}>\n <ClientBootstrap\n serverUrl={serverUrl}\n options={clientOptions}\n key={logoutCount}\n >\n <RefreshTokenBootstrap>\n <AuthBootstrap>\n <ConnectionBootstrap>\n <FontsLoaded>{children}</FontsLoaded>\n </ConnectionBootstrap>\n </AuthBootstrap>\n </RefreshTokenBootstrap>\n </ClientBootstrap>\n </PluginsBootstrap>\n </FontBootstrap>\n );\n}\n\nexport default AppBootstrap;\n"],"names":["FontsLoadedContext","createContext","FontBootstrap","fontClassNames","children","isLoaded","setIsLoaded","useState","useEffect","jsxs","Fragment","jsx","className","LoginNotifier","channel","useBroadcastChannel","makeMessage","BROADCAST_LOGIN_MESSAGE","CORE_AUTH_PLUGINS","AuthPluginPsk","AuthPluginParent","AuthPluginAnonymous","AuthBootstrap","client","useClient","plugins","useContext","PluginsContext","authConfig","setAuthConfig","error","setError","isCanceled","loadAuthConfigValues","newAuthConfigValues","e","AuthComponent","useMemo","getAuthPluginComponent","isLoading","LoadingOverlay","getErrorMessage","getBaseUrl","apiUrl","getEnvoyPrefix","getConnectOptions","envoyPrefix","FontsLoaded","AppBootstrap","pluginsUrl","serverUrl","clientOptions","logoutCount","setLogoutCount","onLogin","useCallback","onLogout","value","useBroadcastLoginListener","PluginsBootstrap","ClientBootstrap","RefreshTokenBootstrap","ConnectionBootstrap"],"mappings":"waAGa,MAAAA,EAAqBC,gBAAuB,EAAK,EAkBvD,SAASC,EAAc,CAC5B,eAAAC,EAAiB,CAAC,oBAAqB,iBAAkB,WAAW,EACpE,SAAAC,CACF,EAAuB,CACrB,KAAM,CAACC,EAAUC,CAAW,EAAIC,WAAS,EAAK,EAC9CC,OAAAA,EAAA,UAAU,UAAqB,CACpB,SAAA,MAAM,MAAM,KAAK,IAAM,CAC9BF,EAAY,EAAI,CAAA,CACjB,CACH,EAAG,CAAE,CAAA,EAIDG,EAAA,KAAAC,WAAA,CAAA,SAAA,CAAAC,EAAA,IAACX,EAAmB,SAAnB,CAA4B,MAAOK,EACjC,SAAAD,EACH,EAUAO,EAAA,IAAC,MAAA,CACC,GAAG,gBACH,MAAO,CAAE,WAAY,SAAU,SAAU,WAAY,IAAK,IAAO,EAGhE,SAAAR,EAAe,IACdS,GAAAD,EAAA,IAAC,KAAkB,UAAAC,EAAsB,SAAA,SAAA,EAAjCA,CAER,CACD,CAAA,CACH,CACF,CAAA,CAAA,CAEJ,CCpDO,SAASC,GAAgB,CAC9B,MAAMC,EAAUC,IAChBP,OAAAA,EAAA,UACE,UAAuB,CACbM,EAA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rap.tsx","../../../app-utils/src/components/LoginNotifier.tsx","../../../app-utils/src/components/AuthBootstrap.tsx","../../../app-utils/src/utils/ConnectUtils.ts","../../../app-utils/src/components/FontsLoaded.tsx","../../../app-utils/src/components/AppBootstrap.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState } from 'react';\nimport 'fira';\n\nexport const FontsLoadedContext = createContext<boolean>(false);\n\nexport type FontBootstrapProps = {\n /**\n * Class names of the font elements to pre load\n */\n fontClassNames?: string[];\n\n /**\n * The children to render wrapped with the FontsLoadedContext.\n * Note that it renders the children even if the fonts aren't loaded yet.\n */\n children: React.ReactNode;\n};\n\n/**\n * FontBootstrap component. Handles preloading fonts.\n */\nexport function FontBootstrap({\n fontClassNames = ['fira-sans-regular', 'fira-sans-bold', 'fira-mono'],\n children,\n}: FontBootstrapProps) {\n const [isLoaded, setIsLoaded] = useState(false);\n useEffect(function initFonts() {\n document.fonts.ready.then(() => {\n setIsLoaded(true);\n });\n }, []);\n\n return (\n <>\n <FontsLoadedContext.Provider value={isLoaded}>\n {children}\n </FontsLoadedContext.Provider>\n {/*\n Need to preload any monaco and Deephaven grid fonts.\n We hide text with all the fonts we need on the root app.jsx page\n Load the Fira Mono font so that Monaco calculates word wrapping properly.\n This element doesn't need to be visible, just load the font and stay hidden.\n https://github.com/microsoft/vscode/issues/88689\n Can be replaced with a rel=\"preload\" when firefox adds support\n https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content\n */}\n <div\n id=\"preload-fonts\"\n style={{ visibility: 'hidden', position: 'absolute', top: -10000 }}\n >\n {/* trigger loading of fonts needed by monaco and iris grid */}\n {fontClassNames.map(className => (\n <p key={className} className={className}>\n preload\n </p>\n ))}\n </div>\n </>\n );\n}\n\nexport default FontBootstrap;\n","import { useBroadcastChannel } from '@deephaven/jsapi-components';\nimport { BROADCAST_LOGIN_MESSAGE, makeMessage } from '@deephaven/jsapi-utils';\nimport { useEffect } from 'react';\n\n/**\n * Component that broadcasts a message when mounted. Should be mounted after the user has logged in.\n */\nexport function LoginNotifier() {\n const channel = useBroadcastChannel();\n useEffect(\n function notifyLogin() {\n channel.postMessage(makeMessage(BROADCAST_LOGIN_MESSAGE));\n },\n [channel]\n );\n return null;\n}\n\nexport default LoginNotifier;\n","import React, { useContext, useEffect, useMemo, useState } from 'react';\nimport {\n AuthConfigMap,\n AuthPluginAnonymous,\n AuthPluginParent,\n AuthPluginPsk,\n} from '@deephaven/auth-plugins';\nimport { LoadingOverlay } from '@deephaven/components';\nimport { useClient } from '@deephaven/jsapi-bootstrap';\nimport { getErrorMessage } from '@deephaven/utils';\nimport { PluginsContext } from './PluginsBootstrap';\nimport { getAuthPluginComponent } from '../plugins';\nimport LoginNotifier from './LoginNotifier';\n\nexport type AuthBootstrapProps = {\n /**\n * The children to render after authentication is completed.\n */\n children: React.ReactNode;\n};\n\n/** Core auth plugins that are always loaded */\nconst CORE_AUTH_PLUGINS = new Map([\n ['@deephaven/auth-plugins.AuthPluginPsk', AuthPluginPsk],\n ['@deephaven/auth-plugins.AuthPluginParent', AuthPluginParent],\n ['@deephaven/auth-plugins.AuthPluginAnonymous', AuthPluginAnonymous],\n]);\n\n/**\n * AuthBootstrap component. Handles displaying the auth plugin and authenticating.\n */\nexport function AuthBootstrap({ children }: AuthBootstrapProps) {\n const client = useClient();\n // `useContext` instead of `usePlugins` so that we don't have to wait for the plugins to load\n // We want to load the auth config values in parallel with the plugins\n const plugins = useContext(PluginsContext);\n const [authConfig, setAuthConfig] = useState<AuthConfigMap>();\n const [error, setError] = useState<unknown>();\n\n useEffect(\n function initAuthConfigValues() {\n let isCanceled = false;\n async function loadAuthConfigValues() {\n try {\n const newAuthConfigValues = await client.getAuthConfigValues();\n if (!isCanceled) {\n setAuthConfig(new Map(newAuthConfigValues));\n }\n } catch (e) {\n if (!isCanceled) {\n setError(e);\n }\n }\n }\n loadAuthConfigValues();\n return () => {\n isCanceled = true;\n };\n },\n [client]\n );\n\n const AuthComponent = useMemo(() => {\n if (plugins == null || authConfig == null) {\n return undefined;\n }\n\n try {\n return getAuthPluginComponent(plugins, authConfig, CORE_AUTH_PLUGINS);\n } catch (e) {\n setError(e);\n }\n }, [authConfig, plugins]);\n\n const isLoading = AuthComponent == null || authConfig == null;\n\n if (isLoading || error != null) {\n return (\n <LoadingOverlay\n isLoading={isLoading && error == null}\n errorMessage={getErrorMessage(error)}\n />\n );\n }\n return (\n <AuthComponent authConfigValues={authConfig}>\n <>\n <LoginNotifier />\n {children}\n </>\n </AuthComponent>\n );\n}\n\nexport default AuthBootstrap;\n","import type { ConnectOptions } from '@deephaven/jsapi-types';\n\n/**\n * Get the base URL of the API\n * @param apiUrl API URL\n * @returns URL for the base of the API\n */\nexport function getBaseUrl(apiUrl: string): URL {\n return new URL(apiUrl, `${window.location}`);\n}\n\n/**\n * Get the Envoy prefix header value\n * @returns Envoy prefix header value\n */\nexport function getEnvoyPrefix(): string | null {\n const searchParams = new URLSearchParams(window.location.search);\n return searchParams.get('envoyPrefix');\n}\n\nexport function getConnectOptions(): ConnectOptions {\n const envoyPrefix = getEnvoyPrefix();\n return envoyPrefix != null\n ? { headers: { 'envoy-prefix': envoyPrefix } }\n : { headers: {} };\n}\n","import React, { useContext } from 'react';\nimport { LoadingOverlay } from '@deephaven/components';\nimport { FontsLoadedContext } from './FontBootstrap';\n\nexport type FontsLoadedProps = {\n /** Children to show when the fonts have completed loading */\n children: React.ReactNode;\n};\n\nexport function FontsLoaded({ children }: FontsLoadedProps) {\n const isFontsLoaded = useContext(FontsLoadedContext);\n\n if (!isFontsLoaded) {\n return <LoadingOverlay data-testid=\"fonts-loaded-loading\" />;\n }\n\n // eslint-disable-next-line react/jsx-no-useless-fragment\n return <>{children}</>;\n}\n\nexport default FontsLoaded;\n","import React, { useCallback, useMemo, useState } from 'react';\nimport '@deephaven/components/scss/BaseStyleSheet.scss';\nimport { ClientBootstrap } from '@deephaven/jsapi-bootstrap';\nimport {\n RefreshTokenBootstrap,\n useBroadcastLoginListener,\n} from '@deephaven/jsapi-components';\nimport FontBootstrap from './FontBootstrap';\nimport PluginsBootstrap from './PluginsBootstrap';\nimport AuthBootstrap from './AuthBootstrap';\nimport ConnectionBootstrap from './ConnectionBootstrap';\nimport { getConnectOptions } from '../utils';\nimport FontsLoaded from './FontsLoaded';\n\nexport type AppBootstrapProps = {\n /** URL of the server. */\n serverUrl: string;\n\n /** URL of the plugins to load. */\n pluginsUrl: string;\n\n /** Font class names to load. */\n fontClassNames?: string[];\n\n /**\n * The children to render wrapped when everything is loaded and authenticated.\n */\n children: React.ReactNode;\n};\n\n/**\n * AppBootstrap component. Handles loading the fonts, client, and authentication.\n * Will display the children when everything is loaded and authenticated.\n */\nexport function AppBootstrap({\n fontClassNames,\n pluginsUrl,\n serverUrl,\n children,\n}: AppBootstrapProps) {\n const clientOptions = useMemo(() => getConnectOptions(), []);\n\n // On logout, we reset the client and have user login again\n const [logoutCount, setLogoutCount] = useState(0);\n const onLogin = useCallback(() => undefined, []);\n const onLogout = useCallback(() => {\n setLogoutCount(value => value + 1);\n }, []);\n useBroadcastLoginListener(onLogin, onLogout);\n return (\n <FontBootstrap fontClassNames={fontClassNames}>\n <PluginsBootstrap pluginsUrl={pluginsUrl}>\n <ClientBootstrap\n serverUrl={serverUrl}\n options={clientOptions}\n key={logoutCount}\n >\n <RefreshTokenBootstrap>\n <AuthBootstrap>\n <ConnectionBootstrap>\n <FontsLoaded>{children}</FontsLoaded>\n </ConnectionBootstrap>\n </AuthBootstrap>\n </RefreshTokenBootstrap>\n </ClientBootstrap>\n </PluginsBootstrap>\n </FontBootstrap>\n );\n}\n\nexport default AppBootstrap;\n"],"names":["FontsLoadedContext","createContext","FontBootstrap","fontClassNames","children","isLoaded","setIsLoaded","useState","useEffect","jsxs","Fragment","jsx","className","LoginNotifier","channel","useBroadcastChannel","makeMessage","BROADCAST_LOGIN_MESSAGE","CORE_AUTH_PLUGINS","AuthPluginPsk","AuthPluginParent","AuthPluginAnonymous","AuthBootstrap","client","useClient","plugins","useContext","PluginsContext","authConfig","setAuthConfig","error","setError","isCanceled","loadAuthConfigValues","newAuthConfigValues","e","AuthComponent","useMemo","getAuthPluginComponent","isLoading","LoadingOverlay","getErrorMessage","getBaseUrl","apiUrl","getEnvoyPrefix","getConnectOptions","envoyPrefix","FontsLoaded","AppBootstrap","pluginsUrl","serverUrl","clientOptions","logoutCount","setLogoutCount","onLogin","useCallback","onLogout","value","useBroadcastLoginListener","PluginsBootstrap","ClientBootstrap","RefreshTokenBootstrap","ConnectionBootstrap"],"mappings":"waAGa,MAAAA,EAAqBC,gBAAuB,EAAK,EAkBvD,SAASC,EAAc,CAC5B,eAAAC,EAAiB,CAAC,oBAAqB,iBAAkB,WAAW,EACpE,SAAAC,CACF,EAAuB,CACrB,KAAM,CAACC,EAAUC,CAAW,EAAIC,WAAS,EAAK,EAC9CC,OAAAA,EAAA,UAAU,UAAqB,CACpB,SAAA,MAAM,MAAM,KAAK,IAAM,CAC9BF,EAAY,EAAI,CAAA,CACjB,CACH,EAAG,CAAE,CAAA,EAIDG,EAAA,KAAAC,WAAA,CAAA,SAAA,CAAAC,EAAA,IAACX,EAAmB,SAAnB,CAA4B,MAAOK,EACjC,SAAAD,EACH,EAUAO,EAAA,IAAC,MAAA,CACC,GAAG,gBACH,MAAO,CAAE,WAAY,SAAU,SAAU,WAAY,IAAK,IAAO,EAGhE,SAAAR,EAAe,IACdS,GAAAD,EAAA,IAAC,KAAkB,UAAAC,EAAsB,SAAA,SAAA,EAAjCA,CAER,CACD,CAAA,CACH,CACF,CAAA,CAAA,CAEJ,CCpDO,SAASC,GAAgB,CAC9B,MAAMC,EAAUC,IAChBP,OAAAA,EAAA,UACE,UAAuB,CACbM,EAAA,YAAYE,EAAYC,CAAuB,CAAC,CAC1D,EACA,CAACH,CAAO,CAAA,EAEH,IACT,CCMA,MAAMI,MAAwB,IAAI,CAChC,CAAC,wCAAyCC,CAAa,EACvD,CAAC,2CAA4CC,CAAgB,EAC7D,CAAC,8CAA+CC,CAAmB,CACrE,CAAC,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