@deephaven/code-studio 0.38.1-beta.3 → 0.38.1-beta.7

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-4a7e2c7c.js";import{q as h}from"./index-fa08e3d2.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-d93998de.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-d93998de.js";import"./helpers-042e6b4d.js";import"./monaco-6eaf53f7.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-eca5b68f.js.map
1
+ import{A as e,C as n}from"./vendor-4a7e2c7c.js";import{q as h}from"./index-23b7a5db.js";import{aj as C,a8 as m,ak as P,ac as A,al as L,am as j,an as v,ao as y,ap as B,aq as w,ar as E,as as M,at as F,au as S,av as k}from"./useConnection-4123360f.js";import{aw as K,ax as Q,aC as W,ay as X,aA as Y,az as Z,aB as nn,ad as tn,ae as en}from"./useConnection-4123360f.js";import"./helpers-042e6b4d.js";import"./monaco-6eaf53f7.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 O(){const t=C();return e.useEffect(function(){t.postMessage(m(P))},[t]),null}const b=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,b)}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(O,{}),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-7d566d32.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-eca5b68f.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 { 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,EAKe,SAAAC,EAAc,CAAE,SAAAlB,GAAgC,CAC9D,MAAMmB,EAASC,IAGTC,EAAUC,aAAWC,CAAc,EACnC,CAACC,EAAYC,CAAa,EAAItB,EAAwB,SAAA,EACtD,CAACuB,EAAOC,CAAQ,EAAIxB,EAAkB,SAAA,EAE5CC,EAAA,UACE,UAAgC,CAC9B,IAAIwB,EAAa,GACjB,eAAeC,GAAuB,CAChC,GAAA,CACI,MAAAC,EAAsB,MAAMX,EAAO,sBACpCS,GACWH,EAAA,IAAI,IAAIK,CAAmB,CAAC,QAErCC,GACFH,GACHD,EAASI,CAAC,CAEd,CACF,CACqB,OAAAF,IACd,IAAM,CACED,EAAA,EAAA,CAEjB,EACA,CAACT,CAAM,CAAA,EAGH,MAAAa,EAAgBC,EAAAA,QAAQ,IAAM,CAC9B,GAAA,EAAAZ,GAAW,MAAQG,GAAc,MAIjC,GAAA,CACK,OAAAU,EAAuBb,EAASG,EAAYV,CAAiB,QAC7DiB,GACPJ,EAASI,CAAC,CACZ,CAAA,EACC,CAACP,EAAYH,CAAO,CAAC,EAElBc,EAAYH,GAAiB,MAAQR,GAAc,KAErD,OAAAW,GAAaT,GAAS,KAEtBnB,EAAA,IAAC6B,EAAA,CACC,UAAWD,GAAaT,GAAS,KACjC,aAAcW,EAAgBX,CAAK,CAAA,CAAA,EAKtCnB,EAAA,IAAAyB,EAAA,CAAc,iBAAkBR,EAC/B,SACEnB,EAAA,KAAAC,WAAA,CAAA,SAAA,CAAAC,EAAA,IAACE,EAAc,EAAA,EACdT,CAAA,CACH,CAAA,CACF,CAAA,CAEJ,CCrFO,SAASsC,EAAWC,EAAqB,CAC9C,OAAO,IAAI,IAAIA,EAAQ,GAAG,OAAO,UAAU,CAC7C,CAMO,SAASC,GAAgC,CAEvC,OADc,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAC3C,IAAI,aAAa,CACvC,CAEO,SAASC,GAAoC,CAClD,MAAMC,EAAcF,IACpB,OAAOE,GAAe,KAClB,CAAE,QAAS,CAAE,eAAgBA,CAAY,GACzC,CAAE,QAAS,CAAA,EACjB,CChBgB,SAAAC,EAAY,CAAE,SAAA3C,GAA8B,CAG1D,OAFsBsB,aAAW1B,CAAkB,oBAOzC,SAAAI,CAAS,CAAA,EAJVO,EAAA,IAAC6B,EAAe,CAAA,cAAY,sBAAuB,CAAA,CAK9D,CCgBO,SAASQ,EAAa,CAC3B,eAAA7C,EACA,WAAA8C,EACA,UAAAC,EACA,SAAA9C,CACF,EAAsB,CACpB,MAAM+C,EAAgBd,EAAQ,QAAA,IAAMQ,EAAkB,EAAG,CAAE,CAAA,EAGrD,CAACO,EAAaC,CAAc,EAAI9C,WAAS,CAAC,EAC1C+C,EAAUC,EAAA,YAAY,IAAM,GAAW,CAAE,CAAA,EACzCC,EAAWD,EAAAA,YAAY,IAAM,CAClBF,EAAAI,GAASA,EAAQ,CAAC,CACnC,EAAG,CAAE,CAAA,EACL,OAAAC,EAA0BJ,EAASE,CAAQ,EAExC7C,EAAA,IAAAT,EAAA,CAAc,eAAAC,EACb,SAAAQ,EAAA,IAACgD,GAAiB,WAAAV,EAChB,SAAAtC,EAAA,IAACiD,EAAA,CACC,UAAAV,EACA,QAASC,EAGT,SAAAxC,EAAAA,IAACkD,EACC,CAAA,SAAAlD,EAAAA,IAACW,EACC,CAAA,SAAAX,EAAA,IAACmD,EACC,CAAA,SAAAnD,EAAA,IAACoC,EAAa,CAAA,SAAA3C,CAAA,CAAS,CACzB,CAAA,CACF,CAAA,EACF,CAAA,EARKgD,CAAA,CAUT,CAAA,CACF,CAAA,CAEJ"}
1
+ {"version":3,"file":"index-7d566d32.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 { 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,EAKe,SAAAC,EAAc,CAAE,SAAAlB,GAAgC,CAC9D,MAAMmB,EAASC,IAGTC,EAAUC,aAAWC,CAAc,EACnC,CAACC,EAAYC,CAAa,EAAItB,EAAwB,SAAA,EACtD,CAACuB,EAAOC,CAAQ,EAAIxB,EAAkB,SAAA,EAE5CC,EAAA,UACE,UAAgC,CAC9B,IAAIwB,EAAa,GACjB,eAAeC,GAAuB,CAChC,GAAA,CACI,MAAAC,EAAsB,MAAMX,EAAO,sBACpCS,GACWH,EAAA,IAAI,IAAIK,CAAmB,CAAC,QAErCC,GACFH,GACHD,EAASI,CAAC,CAEd,CACF,CACqB,OAAAF,IACd,IAAM,CACED,EAAA,EAAA,CAEjB,EACA,CAACT,CAAM,CAAA,EAGH,MAAAa,EAAgBC,EAAAA,QAAQ,IAAM,CAC9B,GAAA,EAAAZ,GAAW,MAAQG,GAAc,MAIjC,GAAA,CACK,OAAAU,EAAuBb,EAASG,EAAYV,CAAiB,QAC7DiB,GACPJ,EAASI,CAAC,CACZ,CAAA,EACC,CAACP,EAAYH,CAAO,CAAC,EAElBc,EAAYH,GAAiB,MAAQR,GAAc,KAErD,OAAAW,GAAaT,GAAS,KAEtBnB,EAAA,IAAC6B,EAAA,CACC,UAAWD,GAAaT,GAAS,KACjC,aAAcW,EAAgBX,CAAK,CAAA,CAAA,EAKtCnB,EAAA,IAAAyB,EAAA,CAAc,iBAAkBR,EAC/B,SACEnB,EAAA,KAAAC,WAAA,CAAA,SAAA,CAAAC,EAAA,IAACE,EAAc,EAAA,EACdT,CAAA,CACH,CAAA,CACF,CAAA,CAEJ,CCrFO,SAASsC,EAAWC,EAAqB,CAC9C,OAAO,IAAI,IAAIA,EAAQ,GAAG,OAAO,UAAU,CAC7C,CAMO,SAASC,GAAgC,CAEvC,OADc,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAC3C,IAAI,aAAa,CACvC,CAEO,SAASC,GAAoC,CAClD,MAAMC,EAAcF,IACpB,OAAOE,GAAe,KAClB,CAAE,QAAS,CAAE,eAAgBA,CAAY,GACzC,CAAE,QAAS,CAAA,EACjB,CChBgB,SAAAC,EAAY,CAAE,SAAA3C,GAA8B,CAG1D,OAFsBsB,aAAW1B,CAAkB,oBAOzC,SAAAI,CAAS,CAAA,EAJVO,EAAA,IAAC6B,EAAe,CAAA,cAAY,sBAAuB,CAAA,CAK9D,CCgBO,SAASQ,EAAa,CAC3B,eAAA7C,EACA,WAAA8C,EACA,UAAAC,EACA,SAAA9C,CACF,EAAsB,CACpB,MAAM+C,EAAgBd,EAAQ,QAAA,IAAMQ,EAAkB,EAAG,CAAE,CAAA,EAGrD,CAACO,EAAaC,CAAc,EAAI9C,WAAS,CAAC,EAC1C+C,EAAUC,EAAA,YAAY,IAAM,GAAW,CAAE,CAAA,EACzCC,EAAWD,EAAAA,YAAY,IAAM,CAClBF,EAAAI,GAASA,EAAQ,CAAC,CACnC,EAAG,CAAE,CAAA,EACL,OAAAC,EAA0BJ,EAASE,CAAQ,EAExC7C,EAAA,IAAAT,EAAA,CAAc,eAAAC,EACb,SAAAQ,EAAA,IAACgD,GAAiB,WAAAV,EAChB,SAAAtC,EAAA,IAACiD,EAAA,CACC,UAAAV,EACA,QAASC,EAGT,SAAAxC,EAAAA,IAACkD,EACC,CAAA,SAAAlD,EAAAA,IAACW,EACC,CAAA,SAAAX,EAAA,IAACmD,EACC,CAAA,SAAAnD,EAAA,IAACoC,EAAa,CAAA,SAAA3C,CAAA,CAAS,CACzB,CAAA,CACF,CAAA,EACF,CAAA,EARKgD,CAAA,CAUT,CAAA,CACF,CAAA,CAEJ"}
@@ -0,0 +1,5 @@
1
+ import{A as d,B as g,H as I,aC as js,C as c,D as Te,F as x,R as Mn,N as Pe,O as Y,G,Z as Se,aD as $s,aE as Vs,a5 as Bs,a6 as Hs,aF as _s,a2 as gt,E as yn,aG as Us,aH as Oe,aI as Ks,aJ as Ws,aK as qs,aL as Tn,aM as Gs,aN as zs}from"./vendor-4a7e2c7c.js";import{T as le,g as V,aV as Zs,aW as Xs,aX as Qs,aY as Js,ad as It,ah as xt,ae as En,aZ as In,L as wt,ar as Ys,e as ei,a_ as ti,a$ as ni,p as si,ac as xn,X as ii,a3 as oi,m as ai,b0 as ri,c as wn,V as li,b1 as ci,q as je,b2 as Nn,b3 as ui}from"./index-23b7a5db.js";class di extends d.Component{static propTypes={children:g.node.isRequired,options:g.shape({}),className:g.string,timeout:g.number,onEntered:g.func,onExited:g.func,isShown:g.bool,closeOnBlur:g.bool,interactive:g.bool,referenceObject:g.shape({}),"data-testid":g.string};static defaultProps={options:{},className:"",timeout:le.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0};constructor(e){super(e),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=I.createRef(),this.rAF=0;const{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){const{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}element;container;rAF;getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){let{popper:e}=this.state;const{closeOnBlur:t,referenceObject:n}=this.props;if(e||this.container.current===null)return;let{options:s}=this.props;s={placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}},...s},document.body.appendChild(this.element);let i=this.getVisibleElement(this.container.current);i==null&&(i=this.container.current),e=new js(n||i,this.element,s),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){const a=this.element.firstElementChild;a instanceof HTMLElement&&a.focus()}}),this.setState({popper:e})}destroyPopper(e=!0){cancelAnimationFrame(this.rAF);const{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){const{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){const{onEntered:e}=this.props;e()}handleExit(){const{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){const{className:e,children:t,timeout:n,interactive:s,closeOnBlur:i}=this.props,{show:a}=this.state;return c.jsx(Te,{in:a,timeout:n,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:c.jsx("div",{onClick:r=>{r.stopPropagation()},onKeyDown:r=>{r.key==="Escape"&&this.hide()},className:x("popper",{interactive:s},e),onBlur:i?this.handleBlur:void 0,tabIndex:i?-1:void 0,role:"presentation",children:c.jsxs("div",{className:"popper-content",children:[t,c.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:e}=this.state,{"data-testid":t}=this.props;return c.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Mn.createPortal(this.renderContent(),this.element)})}}const Ae=di,hi=Object.freeze(Object.defineProperty({__proto__:null,Log:V,LogHistory:Zs,LogProxy:Xs,Logger:Qs,LoggerLevel:Js,default:V},Symbol.toStringTag,{value:"Module"})),pi=V.module("Tooltip");class Z extends d.Component{static defaultTimeout=500;static defaultReshowTimeout=100;static triggerReshowThreshold=300;static shownTooltipCount=0;static lastHiddenTime=Date.now();static defaultProps={interactive:!1,options:{},popperClassName:"",reshowTimeout:Z.defaultReshowTimeout,timeout:Z.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};static handleHidden(){Z.shownTooltipCount-=1,Z.shownTooltipCount===0&&(Z.lastHiddenTime=Date.now())}static handleShown(){Z.shownTooltipCount+=1}constructor(e){super(e),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=I.createRef(),this.popper=I.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();const{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){const{isShown:n}=t,{isShown:s}=this.state;s!==n&&(s?Z.handleShown():Z.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&Z.handleHidden()}container;popper;parent;timer;startListening(){if(!this.container.current||!this.container.current.parentElement){pi.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){const{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){const{isShown:e}=this.state;this.stopTimer();const{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){const t=e.clientX,n=e.clientY,{isShown:s}=this.state;if(!this.popper.current||!this.parent)return;const i=this.popper.current.element.getBoundingClientRect(),a=this.parent.getBoundingClientRect();t>=i.left&&t<=i.left+i.width&&n>=i.top&&n<=i.top+i.height?this.handleMouseMove():t>=a.left&&t<=a.left+a.width&&n>=a.top&&n<=a.top+a.height?this.handleMouseMove():s&&(this.stopTimer(),this.hide())}startTimer(){this.stopTimer();const{timeout:e,reshowTimeout:t}=this.props;let n=e;(Z.shownTooltipCount>0||Date.now()-Z.lastHiddenTime<Z.triggerReshowThreshold)&&(n=t),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){const{isShown:e}=this.state;if(this.stopTimer(),!e){this.popper.current?.show(),this.setState({isShown:!0});const{interactive:t}=this.props;t&&this.startListeningWindow()}}hide(){this.popper.current?.hide(),this.stopListeningWindow()}update(){this.popper.current?.scheduleUpdate()}handleExited(){this.setState({isShown:!1});const{onExited:e}=this.props;e()}stopShowingTooltip(){const{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){const{interactive:e,children:t,referenceObject:n,popperClassName:s,"data-testid":i,onEntered:a}=this.props,{isShown:r}=this.state;let{options:l}=this.props;return l={placement:"bottom",...l},c.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":i,children:c.jsx(Ae,{className:x(s),options:l,ref:this.popper,onEntered:a,onExited:this.handleExited,interactive:e,referenceObject:n,children:c.jsxs("div",{className:"tooltip-content",children:[" ",r&&t]})})})}}const Nt=Z;const mi=100;var kn=(o=>(o.UP="UP",o.DOWN="DOWN",o))(kn||{});class pe extends d.Component{static propTypes={options:g.arrayOf(g.shape({title:g.string.isRequired,value:g.string.isRequired})).isRequired,popperOptions:g.shape({}),onChange:g.func,inputPlaceholder:g.string,disabled:g.bool,className:g.string,defaultTitle:g.string,spellCheck:g.bool,onEnter:g.func,noMatchText:g.string,"data-testid":g.string};static defaultProps={onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0};static MENU_NAVIGATION_DIRECTION=kn;constructor(e){super(e);let{popperOptions:t}=this.props;t={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...t},this.state={title:"",filteredOptions:[],keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,invalid:!1,popperOptions:t},this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handelInputFocus=this.handelInputFocus.bind(this),this.handleInputClick=this.handleInputClick.bind(this),this.updateInputValue=Pe(this.updateInputValue,mi),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=I.createRef(),this.cbContainer=I.createRef(),this.menuContainer=I.createRef(),this.input=I.createRef()}popper;cbContainer;menuContainer;input;setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getCachedFilteredOptions=Y((e,t)=>e.filter(n=>n.title.toLowerCase().indexOf(t.toLowerCase())>=0));getValueAndValidate(e){if(!e)return this.setState({invalid:!1}),{value:e,isValid:!1};const{options:t}=this.props,n=t.filter(s=>s.title.toLowerCase()===e.toLowerCase());return n.length<1?(this.setState({invalid:!0}),{value:e,isValid:!1}):(this.setState({invalid:!1}),{value:n[0].value,isValid:!0})}updateInputValue(e){const{menuIsOpen:t}=this.state,{value:n,isValid:s}=this.getValueAndValidate(e);t&&this.processFilterChange(e),this.fireOnChange(n,s)}fireOnChange(e,t=!0){const{onChange:n}=this.props;n(e,t)}processFilterChange(e){const{options:t}=this.props,{menuIsOpen:n}=this.state,s=e?this.getCachedFilteredOptions(t,e):t,i=s.length===1&&s[0].title===e;if(this.setState({filteredOptions:s,keyboardOptionIndex:0}),i&&n){this.closeMenu();return}this.popper.current?.scheduleUpdate()}resetValue(){this.setState({title:""}),this.fireOnChange("")}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){const{filteredOptions:t,keyboardOptionIndex:n}=this.state,s=t[n];switch(e.key){case"Enter":case"ArrowRight":e.stopPropagation(),e.preventDefault(),s!=null&&(this.setState({title:s.title,invalid:!1}),this.fireOnChange(s.value)),this.closeMenu(),this.input.current?.focus();break;case"ArrowUp":e.stopPropagation(),e.preventDefault(),this.navigateMenu(pe.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(pe.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(pe.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(pe.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.closeMenu();break}}navigateMenu(e){const{filteredOptions:t,keyboardOptionIndex:n}=this.state;let s=n;e===pe.MENU_NAVIGATION_DIRECTION.UP?n>0?(s=(s-1)%t.length,this.setState({keyboardOptionIndex:s})):n===0&&(s=t.length-1,this.setState({keyboardOptionIndex:s})):e===pe.MENU_NAVIGATION_DIRECTION.DOWN&&n<t.length&&(s=(s+1)%t.length,this.setState({keyboardOptionIndex:s})),this.scrollOptionIntoView(s)}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:n}=this.state;n?this.handleMenuKeyDown(e):e.key==="Enter"?t():e.key==="Escape"?(this.resetValue(),e.preventDefault(),e.stopPropagation()):e.key==="ArrowRight"||e.key==="ArrowLeft"||e.key==="Tab"||e.key==="Shift"||this.openMenu()}handleInputChange(e){this.setState({title:e.target.value}),this.updateInputValue(e.target.value)}handleOptionClick(e){this.setState({title:e.title,invalid:!1}),this.fireOnChange(e.value),this.closeMenu(),this.input.current?.focus()}handelInputFocus(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputClick(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuBlur(e){e.relatedTarget===this.input.current||e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){this.input.current?.focus()}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}openMenu(){const{title:e}=this.state;this.processFilterChange(e),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{this.popper.current?.show()})}closeMenu(e=!0){this.setState({menuIsOpen:!1,keyboardOptionIndex:0}),e&&this.input.current?.focus(),this.popper.current?.hide()}scrollOptionIntoView(e){this.menuContainer.current&&this.menuContainer.current.children.item(e)?.scrollIntoView({behavior:"smooth",block:"nearest"})}renderMenuElement(){const{inputWidth:e}=this.state;return c.jsx("div",{className:x("aci-options"),ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,style:{width:e},onBlur:this.handleMenuBlur,children:this.renderOptions()})}renderOptions(){const{noMatchText:e}=this.props,{title:t,filteredOptions:n}=this.state;return t&&n.length===0?c.jsx("div",{className:"no-match",children:e}):n.map((s,i)=>this.renderOption(s,i))}renderOption(e,t){const{keyboardOptionIndex:n}=this.state,s=`option-${t}-${e.value}`;return c.jsx("button",{type:"button",className:x("aci-option-btn",{"keyboard-active":n===t}),onClick:()=>this.handleOptionClick(e),onFocus:()=>this.setState({keyboardOptionIndex:t}),children:e.title},s)}render(){const{options:e,inputPlaceholder:t,disabled:n,className:s,defaultTitle:i,spellCheck:a,"data-testid":r}=this.props,{title:l,menuIsOpen:u,popperOptions:h,invalid:p}=this.state;return c.jsxs("div",{className:"aci-container",ref:this.cbContainer,children:[c.jsx("input",{value:l||i,className:x("form-control",s,"aci-input",{"is-invalid":p&&!u}),ref:this.input,onChange:this.handleInputChange,placeholder:t||e[0].title,disabled:n,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:a,"data-testid":r}),c.jsx(Ae,{ref:this.popper,options:h,className:x("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}}const fi=pe;function kt({className:o="",value:e,onChange:t,spellCheck:n=!1,placeholder:s="",disabled:i=!1,delimiter:a="",id:r="","data-testid":l}){const[u,h]=d.useState(e),[p,m]=d.useState(!1),f=d.useRef(null);d.useEffect(function(){h(e)},[e]);function v(O){return O.trim().split(a).filter(P=>P).join(`
2
+ ${a.trim()}`)}function S(O){return O.split(`
3
+ `).map(P=>P.trim()).join(" ")}function C(){if(!f.current)return;f.current.style.height="0";const O=f.current.scrollHeight+(f.current.offsetHeight-f.current.clientHeight);O>0&&(f.current.style.height=`${O}px`)}function w(O){let P=O.target.value;p&&(a&&(P=v(P)),m(!1)),h(P),t(P)}function D(){f.current&&(a&&(h(v(u)),C()),f.current.scrollLeft=0)}function M(){f.current&&document.activeElement!==f.current&&f.current.focus()}function A(){a&&(h(S(u)),t(S(u)))}function R(){m(!0)}return d.useEffect(function(){C()},[u]),c.jsx("textarea",{ref:f,id:r,className:x(o,"auto-resize-textarea form-control"),placeholder:s,value:u,rows:1,onChange:w,onFocus:D,onMouseDown:M,onBlur:A,onPaste:R,spellCheck:n,disabled:i,"data-testid":l})}kt.propTypes={value:g.string.isRequired,onChange:g.func.isRequired,className:g.string,placeholder:g.string,spellCheck:g.bool,disabled:g.bool,delimiter:g.string,id:g.string,"data-testid":g.string};kt.defaultProps={className:"",id:"",placeholder:"",disabled:!1,spellCheck:!1,delimiter:"","data-testid":void 0};function $e(o){const{children:e,className:t,style:n,"data-testid":s}=o;return c.jsx("div",{className:x("btn-group",t),style:n,role:"group","data-testid":s,children:e})}$e.displayName="ButtonGroup";$e.propTypes={children:g.node.isRequired,className:g.string,style:g.object,"data-testid":g.string};$e.defaultProps={className:null,style:{},"data-testid":void 0};const gi=["primary","secondary","tertiary","success","danger","inline","ghost"],bi=["group-end"];function Ci(o,e){switch(o){case"primary":return"btn-primary";case"secondary":return"btn-outline-primary";case"tertiary":return"btn-secondary";case"success":return"btn-success";case"danger":return"btn-danger";case"inline":return"btn-inline";case"ghost":return x("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function Si(o){switch(o){case"group-end":return x("pl-2","pr-3")}}const Je=I.forwardRef((o,e)=>{const{kind:t,variant:n,type:s,tooltip:i,icon:a,disabled:r=!1,active:l,onClick:u,onContextMenu:h,onMouseDown:p,onMouseUp:m,onMouseEnter:f,onMouseLeave:v,onKeyDown:S,className:C,style:w,children:D,tabIndex:M,"data-testid":A,"aria-label":R}=o,O=Boolean(a&&D==null),P=Ci(t,O);let K;n&&(K=Si(n));let oe;a&&(oe=I.isValidElement(a)?a:c.jsx(G,{icon:a}));let j;i!==void 0&&(j=typeof i=="string"?c.jsx(Nt,{children:i}):i);let L=R;R===void 0&&O&&i!=null&&typeof i=="string"&&(L=i);const H=c.jsxs("button",{"data-testid":A,ref:e,type:s,className:x("btn",P,K,{active:l},C),onClick:u,onContextMenu:h,onMouseUp:m,onMouseDown:p,onMouseEnter:f,onMouseLeave:v,onKeyDown:S,style:w,disabled:r,tabIndex:M,"aria-label":L,children:[a&&oe,D,i!=null&&!r&&j]});return r?c.jsxs("span",{className:"btn-disabled-wrapper",children:[H,i!==void 0&&j]}):H});Je.displayName="Button";Je.propTypes={kind:g.oneOf(gi).isRequired,variant:g.oneOf(bi),type:g.oneOf(["submit","reset","button"]),tooltip(o){const{tooltip:e,icon:t,children:n}=o;return e===void 0&&t!=null&&n==null?new Error("Tooltip is required for icon only buttons"):null},icon(o){const{children:e,icon:t}=o;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!I.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:g.bool,active:g.bool,onClick(o){const{onClick:e,type:t}=o;return t==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:g.func,onMouseUp:g.func,onMouseDown:g.func,onMouseEnter:g.func,onMouseLeave:g.func,onKeyDown:g.func,tabIndex:g.number,children:g.node,className:g.string,style:g.object,"data-testid":g.string};Je.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const ee=Je;function Ve(o,e="No value available in context. Was code wrapped in a provider?"){const t=d.useContext(o);if(t==null)throw new Error(e);return t}function Dt(o){const e=d.useRef();return d.useEffect(function(){e.current=o}),e.current}function Ot(o){const e=d.useRef(null);return d.useEffect(function(){o&&(typeof o=="function"?o(e.current):o.current=e.current)}),e}const Tr=Object.freeze([]),Er=new Map,vi=()=>{};class Mi extends Error{isCanceled=!0}const bt=Mi;async function yi(o){const{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(o)}catch{return Jt(o)}Jt(o)}function Jt(o){const e=document.activeElement,t=document.createElement("textarea");t.value=o,document.body.appendChild(t),t.focus(),t.select();const n=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!n)throw new Error("Unable to execute copy command")}class Dn extends CustomEvent{constructor(e,t){super(e,t)}}class Ti extends Error{isTimeout=!0}const Ye=Ti;class Le{static makeCancelable(e,t){let n=!1,s,i;const a=new Promise((r,l)=>{i=l,Promise.resolve(e).then(u=>{n?t&&t(u):(s=u,r(u))}).catch(u=>l(u))});return a.cancel=()=>{n=!0,i(new bt),s!=null&&t&&t(s)},a}static isCanceled(e){return e instanceof bt}static isTimedOut(e){return e instanceof Ye}static withTimeout(e,t){return new Promise((n,s)=>{setTimeout(()=>{try{n(t())}catch(i){s(i)}},e)})}}function Ei(o){if(o==null)throw new Error("Value is null or undefined")}function Ir(o,e,t=void 0){const n=o.get(e)??t;if(n!==void 0)return n;throw new Error(`Missing value for key ${e}`)}function qe(o){let e=o;o instanceof CustomEvent&&(e=o.detail);let t="";if(e instanceof Error?t=e.message:e!=null&&(t=`${e}`),t=t.trim(),t.length>0)return t}class At{static isValidRange(e){return e!=null&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1])&&e[0]<=e[1]}static validateRange(e){if(!At.isValidRange(e))throw new Error(`Invalid range! ${e}`)}static isSelected(e,t){for(let n=0;n<e.length;n+=1){const s=e[n],i=s[0],a=s[1];if(i<=t&&t<=a)return!0}return!1}static selectRange(e,t){let[n,s]=t;const i=[...e];for(let a=i.length-1;a>=0;a-=1){const r=i[a],l=r[0],u=r[1];if(l<=n&&s<=u)return i;n<=u&&l<=s&&(n=Math.min(n,l),s=Math.max(s,u),i.splice(a,1))}return i.push([n,s]),i}static deselectRange(e,t){const[n,s]=t,i=[...e];for(let a=i.length-1;a>=0;a-=1){const r=i[a],l=r[0],u=r[1];if(!(s<l||u<n))if(l<n&&s<u){i[a]=[l,n-1],i.splice(a+1,0,[s+1,u]);break}else n<=l&&u<=s?i.splice(a,1):l<n?i[a]=[l,n-1]:i[a]=[s+1,u]}return i}static count(e){return e.reduce((t,n)=>t+(n[1]-n[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((n,s)=>{const i=[...n];for(let a=s[0];a<=s[1];a+=1)i.push(e[a]);return i},[])}}const re=At;class Ii{static join(e,t="and"){if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return`${e[0]} ${t} ${e[1]}`;const n=e.slice(0,e.length-1).join(", "),s=e[e.length-1];return`${n}, ${t} ${s}`}static toLower(e,t=!0){if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t,n=!0){return e<t?n?-1:1:e>t?n?1:-1:0}}const xi=Ii;class Ft{static TIME_PATTERN="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]";static TIME_ZONES=Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]);static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=Math.floor(e/3600),n=Math.floor(e%3600/60),s=e%60;return`${t>0?`${t}h `:""}${n>0||t>0?`${n}m `:""}${e>=60?`${s}s`.padStart(3,"0"):`${s}s`}`}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=String(Math.floor(e/(60*60))).padStart(2,"0"),n=e%(60*60),s=String(Math.floor(n/60)).padStart(2,"0"),i=n%60,a=String(Math.ceil(i)).padStart(2,"0");return`${t}:${s}:${a}`}static isTimeString(e){return new RegExp(Ft.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error(`${e} is not a valid string`);const t=e.split(":");if(t.length!==3)throw new Error(`${e} is not a time string that can be parsed`);return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}}const Fe=Ft,wi=3500,Ni=V.module("useCopyToClipboard");function On(){const[o,e]=d.useState(!1),t=d.useRef(null),n=d.useCallback(s=>{yi(s).then(()=>{e(!0)}).catch(i=>Ni.error(`Unable to copy ${s}`,`
4
+ `,i))},[]);return d.useEffect(()=>(t.current&&clearTimeout(t.current),o&&(t.current=setTimeout(()=>{e(!1)},wi)),()=>{t.current&&clearTimeout(t.current)}),[o]),[o,n]}function ki(o){o.preventDefault()}function Di(o=!1){const e=d.useMemo(()=>`useSubmitButtonRef-${Se()}`,[]),t=d.useCallback(i=>{i?.UNSAFE_getDOMNode().setAttribute("form",e)},[e]),n=d.useMemo(()=>({id:e,onSubmit:o?void 0:ki}),[e,o]),s=d.useMemo(()=>({form:e,ref:t}),[e,t]);return{formProps:n,submitButtonProps:s}}function An(o,e,{autoLoad:t=!0}={}){const[n,s]=d.useState(null),[i,a]=d.useState(null),[r,l]=d.useState(!1),u=d.useCallback(async()=>{l(!0);try{const h=await o(...e);s(h),a(null)}catch(h){s(null),a(h)}finally{l(!1)}},[o,...e]);return d.useEffect(()=>{t&&u()},[t,u]),{data:n,error:i,isError:i!=null,isLoading:r,reload:u}}function Fn(o,e){const[t,n]=d.useState(o);return d.useEffect(()=>{const s=setTimeout(()=>{n(o)},e);return()=>{clearTimeout(s)}},[o,e]),t}const Oi=Object.freeze(Object.defineProperty({__proto__:null,useContextOrThrow:Ve,useCopyToClipboard:On,useDebouncedValue:Fn,useFormWithDetachedSubmitButton:Di,useForwardedRef:Ot,usePrevious:Dt,usePromiseFactory:An},Symbol.toStringTag,{value:"Module"}));function Ai({blockInteraction:o=!0,children:e,debounceMs:t,isOpen:n=!1}){const s=Fn(n,t);return c.jsxs(c.Fragment,{children:[o&&n&&c.jsx("div",{className:"modal-backdrop",style:{backgroundColor:"transparent"},"data-testid":"debounced-modal-backdrop"}),I.cloneElement(e,{isOpen:n&&s})]})}function Fi({className:o,icon:e,isOpen:t=!1,subtitle:n,title:s}){return c.jsx(It,{isOpen:t,className:o,children:c.jsx(xt,{children:c.jsxs("div",{className:"info-modal",children:[e!=null&&c.jsx("div",{className:"message-icon",children:c.jsx(G,{icon:e})}),c.jsx("div",{className:"message-header",children:s}),n!=null&&c.jsx("div",{className:"message-content",children:n})]})})})}function Rn({className:o="modal-footer",children:e,"data-testid":t}){return c.jsx("div",{className:o,"data-testid":t,children:e})}function Rt(o){const{isOpen:e,headerText:t,bodyText:n,onCancel:s,onConfirm:i,onDiscard:a,onModalDisable:r,cancelButtonText:l="Cancel",confirmButtonText:u="Okay",discardButtonText:h="Discard",isConfirmDanger:p=!1,children:m,"data-testid":f}=o,v=d.useRef(null),S=d.useRef(null),C=d.useCallback(()=>{S.current!==null&&S.current.checked&&r&&r(),i()},[i,r]),w=d.useCallback(()=>{v.current?.focus()},[]);let D="";return e&&(D=typeof n=="function"?n():n),c.jsxs(It,{isOpen:e,className:"theme-bg-light",onOpened:w,children:[c.jsx(En,{closeButton:!1,children:t}),c.jsx(xt,{children:D}),c.jsxs(Rn,{children:[r&&c.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[c.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:S,"data-testid":f!==void 0?`${f}-checkbox-confirm`:void 0}),c.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),a&&c.jsx(ee,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:a,"data-testid":f!==void 0?`${f}-btn-discard`:void 0,children:h}),s&&c.jsx(ee,{kind:"secondary","data-dismiss":"modal",onClick:s,"data-testid":f!==void 0?`${f}-btn-cancel`:void 0,children:l}),c.jsxs($e,{children:[c.jsx(ee,{kind:p?"danger":"primary",onClick:C,ref:v,"data-testid":f!==void 0?`${f}-btn-confirm`:void 0,children:u}),m]})]})]})}Rt.propTypes={isOpen:g.bool.isRequired,headerText:g.string.isRequired,bodyText:g.oneOfType([g.string,g.func]).isRequired,onCancel:g.func,onConfirm:g.func.isRequired,onDiscard:g.func,onModalDisable:g.func,cancelButtonText:g.string,confirmButtonText:g.string,discardButtonText:g.string,children:g.node,"data-testid":g.string};Rt.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const et=I.forwardRef((o,e)=>{const{children:t,className:n,disabled:s,onClick:i,style:a,id:r}=o;return c.jsx("button",{ref:e,type:"button",className:x("btn",n),onClick:i,style:a,disabled:s,id:r,children:t})});et.displayName="Button";et.propTypes={children:g.node,className:g.string,disabled:g.bool,onClick:g.func,style:g.shape({}),id:g.string};et.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Ri=et;function Pi({className:o,isFlipped:e,children:t,"data-testid":n}){const s=l=>{if(t.length!==2)throw new Error("CardFlip requires 2 children to function");return t[l]},i=d.useRef(null),a=d.useCallback(l=>{l.target===l.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),r=d.useCallback(l=>{l.target===l.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return d.useEffect(function(){if(!i.current)throw Error("ref undefined");i.current.addEventListener("transitionstart",a);const u=i.current;return function(){if(u!=null)return u.removeEventListener("transitionstart",a)}},[a]),c.jsxs("div",{className:x(o,{"card-flip--show-front":e,"card-flip--show-back":!e}),"data-testid":n,children:[c.jsx("div",{className:"card-flip--back",children:s(0)}),c.jsx("div",{ref:i,className:"card-flip--front",onTransitionEnd:r,children:s(1)})]})}function dt(o){return o.then!==void 0}class ye{static actionsDisabled=!1;static disableAllActions(){ye.actionsDisabled=!0}static enableAllActions(){ye.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){return e.group!==t.group?(e.group??0)>(t.group??0)?1:-1:e.order!==t.order?(e.order??0)>(t.order??0)?1:-1:e.title!==t.title?(e.title??"")>(t.title??"")?1:-1:e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];const t=e.slice();return t.sort(ye.compareActions),t}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return ye.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){const t=ye.getModifierKey();return e[t]}static getMenuItems(e,t=!0){let n=[],s=e;Array.isArray(s)||(s=[s]);for(let i=0;i<s.length;i+=1){const a=s[i];let r;typeof a=="function"?r=a():r=a,r!=null&&(r instanceof Promise?t&&n.push(r):Array.isArray(r)?n=n.concat(r):n.push(r))}return n=n.filter(i=>i.title!==void 0||i.then!=null||i.menuElement),n}static getNextMenuItem(e,t,n){let s=e;s<0&&t<0&&(s=n.length);for(let i=1;i<n.length+1;i+=1){const a=(s+t*i+n.length)%n.length,r=n[a];if(!(r instanceof Promise)&&r.disabled!==!0)return a}return e}}const _=ye,Yt=V.module("GlobalContextAction");class Li extends d.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.body.addEventListener("contextmenu",this.handleContextMenu),document.body.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.body.removeEventListener("contextmenu",this.handleContextMenu),document.body.removeEventListener("keydown",this.handleKeyDown)}handleContextMenu(e){const t=e;t.contextActions==null&&(t.contextActions=[]);const{action:n}=this.props;n.title==null&&!n.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(n),Yt.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){const{action:t}=this.props;!_.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)&&(Yt.debug("Global hotkey matched!",e),t.action?.(e),e.preventDefault(),e.stopPropagation())}render(){return null}}const ji=Li;class $i extends d.Component{render(){const{actions:e,"data-testid":t}=this.props,n=[];for(let s=0;s<e.length;s+=1){const i=e[s],{shortcut:a}=i;if(i.title!=null||i.menuElement||a){const r=c.jsx(ji,{action:i,"data-testid":t},`${i.title}.${a?.id}`);n.push(r)}}return n}}const Vi=$i;const He=V.module("ContextActions");class Bi extends d.Component{static groups={default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100};static triggerMenu(e,t,n,s){if(s.length===0)return;const i=new MouseEvent("contextmenu",{clientX:t,clientY:n,bubbles:!0,cancelable:!0});i.contextActions=s,e.dispatchEvent(i)}constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=I.createRef(),this.state={globalActions:[],keyboardActions:[]}}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};const t=e.actions.filter(s=>!dt(s)&&typeof s!="function"&&s.isGlobal),n=e.actions.filter(s=>!dt(s)&&typeof s!="function"&&(s.isGlobal===void 0||!s.isGlobal)&&s.shortcut!=null);return{globalActions:t,keyboardActions:n}}componentDidMount(){this.container.current?.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){this.container.current?.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}container;handleContextMenu(e){const{ignoreClassNames:t=[]}=this.props;if(t.length>0){let s=e.target;for(;s!=null;){const{classList:i}=s,a=t.find(r=>i.contains(r));if(a!==void 0){He.debug2(`Contextmenu event ignored based on the target className "${a}"`);return}s=s.parentElement}}if(_.isContextActionEvent(e)||(e.contextActions=[]),!_.isContextActionEvent(e))return;const{actions:n}=this.props;if(n!=null){let s=n;Array.isArray(s)&&(s=s.filter(i=>dt(i)||typeof i=="function"||i.isGlobal===void 0||!i.isGlobal)),e.contextActions=e.contextActions.concat(s)}He.debug("Received context menu event! Menu items are now: ",e.contextActions)}handleKeyDown(e){const{keyboardActions:t}=this.state;for(let n=0;n<t.length;n+=1){const s=t[n];!_.actionsDisabled&&s.shortcut!=null&&s.shortcut.matchesEvent(e)&&(He.debug("Context hotkey matched!",e),s.action?.(e),e.stopPropagation(),e.preventDefault(),He.debug2("Matched hotkey returned false, key event not consumed"))}}render(){const{"data-testid":e}=this.props,{globalActions:t}=this.state;return c.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:c.jsx(Vi,{actions:t})})}}const Hi=Bi,Pt=I.forwardRef((o,e)=>{function t(C){const{menuItem:w,onMenuItemClick:D}=o;D(w,C)}function n(C){const{menuItem:w,onMenuItemMouseMove:D}=o;D(w,C)}function s(C){const{menuItem:w,onMenuItemContextMenu:D}=o;D(w,C)}function i(C,w,D){if(typeof C.type=="string")return C;const{closeMenu:M,menuItem:A,isKeyboardSelected:R,isMouseSelected:O,"data-testid":P}=o,K={menuItem:A,closeMenu:M,isKeyboardSelected:R,isMouseSelected:O,iconElement:w,displayShortcut:D,"data-testid":P};return I.cloneElement(C,{forwardedProps:K})}const{children:a,menuItem:r,isKeyboardSelected:l=!1,isMouseSelected:u=!1,"data-testid":h}=o,p=r.shortcut?.getDisplayText();let m=null;if(r.icon){const C=r.icon;if(I.isValidElement(C))m=C;else{let w;r.iconColor!=null&&(r.disabled===void 0||!r.disabled)&&(w={color:r.iconColor}),m=c.jsx(G,{icon:C,style:w})}}let f=null;const v=Boolean(a);r.actions&&(f=c.jsx(G,{icon:In}));let S=null;if(r.menuElement)S=c.jsx("div",{className:"custom-menu-item",onMouseMove:n,children:i(r.menuElement,m,p)});else{const C=r.disabled,w=r.iconOutline;S=c.jsx("button",{type:"button",className:x("btn-context-menu",{disabled:C},{active:(v||u)&&(C===void 0||!C)},{"keyboard-active":l&&(C===void 0||!C)}),onClick:t,onMouseMove:n,onContextMenu:s,title:r.description??"",children:c.jsxs("div",{className:"btn-context-menu-wrapper",children:[c.jsx("span",{className:x("icon",{outline:w}),children:m}),c.jsx("span",{className:"title",children:r.title}),p!==void 0&&c.jsx("span",{className:"shortcut",children:p}),f&&c.jsx("span",{className:x("submenu-indicator",{disabled:C}),children:f})]})})}return c.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":h,children:[a,S]})});Pt.displayName="ContextMenuItem";Pt.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const Lt=Pt,en=V.module("ContextMenu");class Ge extends d.PureComponent{static defaultProps={subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=I.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=I.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{this.container.current?.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e,t){const{actions:n}=this.props,{activeSubMenu:s}=this.state;s!==t.activeSubMenu&&(s==null?this.container.current?.focus():this.setActiveSubMenuPosition()),e.actions!==n&&(this.initMenu(),(this.container.current==null||!this.container.current.contains(document.activeElement))&&this.container.current?.focus()),this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}container;oldFocus;activeSubMenuRef;subMenuTimer;rAF;initialPosition;getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);const{options:e}=this.props;let t=e.initialKeyboardIndex;t===void 0&&(t=-1);const{actions:n}=this.props,s=_.getMenuItems(n),i=[];for(let a=s.length-1;a>=0;a-=1){const r=s[a];r instanceof Promise?this.initMenuPromise(r):i.push(r)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:_.sortActions(i)})}initMenuPromise(e){const t=Le.makeCancelable(e);this.setState(n=>({pendingItems:n.pendingItems.concat(t)})),t.then(n=>{this.setState(s=>{const i=s.pendingItems.indexOf(t);if(i>=0){const a=s.pendingItems.slice();return a.splice(i,1),{menuItems:_.sortActions(s.menuItems.concat(n)),pendingItems:a}}return null})},n=>{Le.isCanceled(n)||(this.setState(s=>{const i=s.pendingItems.indexOf(t);if(i>=0){const a=s.pendingItems.slice();return a.splice(i,1),{pendingItems:a}}return null}),en.error(n))})}cancelPromises(){const{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current===null)return;const e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}verifyPosition(){const{options:e,updatePosition:t,subMenuParentWidth:n,subMenuParentHeight:s,top:i,left:a}=this.props;if(!this.container.current||e.doNotVerifyPosition!=null&&e.doNotVerifyPosition)return;let{top:r,left:l}=this.initialPosition;const{width:u,height:h}=this.container.current?.getBoundingClientRect()??{width:0,height:0},p=(this.container.current?.scrollHeight??0)>window.innerHeight;h===0||u===0||(r+h>window.innerHeight&&(r-h-s>0?r-=h-s:r=window.innerHeight-h),l+u>window.innerWidth&&(l=l-u-n),(a!==l||i!==r)&&(this.setState({hasOverflow:p}),t(r,l)))}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){en.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){let t=e.relatedTarget,n=!1;for(;t&&!n;)n=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;n||this.closeMenu(!0)}}isEscapeKey(e){const{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){const{menuItems:t}=this.state,n=this.getKeyboardIndex();let s=n,i=!1;if(e.key==="Enter"||e.key===" "){n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}if(e.key==="ArrowRight"?n>=0&&n<=t.length?i=!0:s=0:this.isEscapeKey(e.key)?s=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?s=_.getNextMenuItem(s,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(s=_.getNextMenuItem(s,1,t)),i){this.openSubMenu(n),e.preventDefault(),e.stopPropagation();return}n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){const{menuItems:t,activeSubMenu:n}=this.state,s=t[e].actions?e:null;n!==s&&this.setState({activeSubMenu:s,subMenuTop:null,subMenuLeft:null})}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();const{menuItems:n}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(n.indexOf(e)):e.action!=null&&(e.action(),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n),n>=0&&n<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{top:t,left:n}=this.props,{activeSubMenu:s,hasOverflow:i,keyboardIndex:a,menuItems:r,mouseIndex:l,pendingItems:u,subMenuTop:h,subMenuLeft:p,subMenuParentWidth:m,subMenuParentHeight:f}=this.state;for(let D=0;D<r.length;D+=1){const M=r[D];D>0&&M.group!==r[D-1].group&&e.push(c.jsx("hr",{},`${D}.separator`));const A=c.jsx(Lt,{ref:s===D?this.activeSubMenuRef:null,isKeyboardSelected:a===D,isMouseSelected:l===D,menuItem:M,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},D);e.push(A)}let v=null;u.length>0&&(v=c.jsx("div",{className:"loading",children:c.jsx(wt,{})}));const{menuStyle:S,"data-testid":C}=this.props,w=s!==null&&h!==null&&p!==null;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:x({"has-overflow":i},"context-menu-container"),style:{top:t,left:n,...S},ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Ge.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":C,children:[e,v]}),w&&s!==null&&h!==null&&p!==null&&c.jsx(Ge,{actions:r[s].actions||[],closeMenu:this.handleCloseSubMenu,top:h,left:p,updatePosition:(D,M)=>{this.setState({subMenuTop:D,subMenuLeft:M})},subMenuParentWidth:m,subMenuParentHeight:f},`sub-${s}`)]})}}const _i=Ge;class Ui extends d.Component{constructor(e){super(e),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=I.createRef(),this.openMenu=I.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){this.container.current?.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){this.container.current?.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}container;openMenu;handleContextMenu(e){if(!_.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const t=_.getMenuItems(e.contextActions),n=this.container.current.getBoundingClientRect(),s=e.clientY-n.top,i=e.clientX-n.left;if(t.length===0){if(e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{const a=document.elementFromPoint(i,s),r=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});a?.dispatchEvent(r)});return}return}e.preventDefault(),this.setState({actions:t,top:s,left:i})}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){let e=null;const{"data-testid":t}=this.props,{actions:n,top:s,left:i}=this.state;return n&&(e=c.jsx(_i,{ref:this.openMenu,actions:n,onMenuClosed:this.handleMenuClose,top:s,left:i,updatePosition:(a,r)=>{this.setState({top:a,left:r})},"data-testid":t})),c.jsx("div",{className:x("context-menu-root",{active:n}),ref:this.container,children:e})}}const Ki=Ui;class me extends d.Component{static propTypes={className:g.string,in:g.bool.isRequired,children:g.node.isRequired,autoFocusOnShow:g.bool,"data-testid":g.string};static defaultProps={className:"",autoFocusOnShow:!1,"data-testid":void 0};static handleEnter(e){const t=e;t.style.height="0"}static handleEntering(e){const t=e;t.style.height=`${me.getHeight(t)}px`}static handleExiting(e){const t=e;t.style.height="0"}static handleExit(e){const t=e;t.style.height=`${me.getHeight(t)}px`}static getHeight(e){const t=e.scrollWidth-e.clientWidth;return e.scrollHeight-t}constructor(e){super(e),this.handleEntered=this.handleEntered.bind(this)}handleEntered(e){const t=e;t.style.height="";const{autoFocusOnShow:n}=this.props;if(n!==void 0&&n){const s=t.querySelector("input, select, textarea");s?.focus()}}render(){const{children:e,className:t,in:n,"data-testid":s}=this.props;return c.jsx(Te,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:me.handleEnter,onEntering:me.handleEntering,onEntered:this.handleEntered,onExit:me.handleExit,onExiting:me.handleExiting,timeout:350,children:i=>c.jsx("div",{className:x({collapse:i==="exited"},t),"data-testid":s,children:e})})}}const Wi=me,tt=I.forwardRef((o,e)=>{const{checked:t=!1,children:n,className:s,disabled:i,inputClassName:a,isInvalid:r,labelClassName:l,name:u,onChange:h,"data-testid":p}=o,[m]=d.useState(Se()),f=Ot(e);d.useEffect(function(){f.current&&(f.current.indeterminate=t===null)},[f,t]);const v=d.useCallback(S=>{f.current&&(f.current.indeterminate=t===null),h&&h(S)},[f,t,h]);return c.jsxs("div",{className:x("custom-control custom-checkbox",s),children:[c.jsx("input",{type:"checkbox",ref:f,checked:t??!1,className:x("custom-control-input",a,{"is-invalid":r}),disabled:i,id:m,name:u,onChange:v,"data-testid":p}),c.jsx("label",{className:x("custom-control-label",l),htmlFor:m,children:n})]})});tt.displayName="Checkbox";tt.propTypes={checked:(o,e)=>{const{[e]:t}=o;return t!==null&&typeof t!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:g.node.isRequired,className:g.string,disabled:g.bool,inputClassName:g.string,isInvalid:g.bool,labelClassName:g.string,name:g.string,onChange:g.func,"data-testid":g.string};tt.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const ze=tt;class qi extends d.PureComponent{static defaultProps={placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0};constructor(e){super(e),this.inputField=I.createRef()}inputField;focus(){this.inputField.current?.focus()}render(){const{value:e,placeholder:t,onBlur:n,onChange:s,className:i,disabled:a,matchCount:r,id:l,onKeyDown:u,"data-testid":h}=this.props;return c.jsxs("div",{className:x("search-group",i),children:[c.jsx("input",{type:"search",value:e,onBlur:n,onChange:s,onKeyDown:u,className:"form-control",disabled:a,placeholder:t,ref:this.inputField,id:l,"data-testid":h}),r!=null&&c.jsx("span",{className:"search-match",children:r}),c.jsx("span",{className:"search-icon",children:c.jsx(G,{icon:Ys})})]})}}const nt=qi;var Pn=(o=>(o.UP="UP",o.DOWN="DOWN",o))(Pn||{});class we extends d.Component{static MENU_NAVIGATION_DIRECTION=Pn;static DROP_DOWN_MENU_HEIGHT=200;static propTypes={options:g.arrayOf(g.shape({title:g.string.isRequired,value:g.string.isRequired})).isRequired,popperOptions:g.shape({title:g.string.isRequired,value:g.string.isRequired}),onChange:g.func,inputPlaceholder:g.string,searchPlaceholder:g.string,disabled:g.bool,className:g.string,defaultValue:g.string,spellCheck:g.bool,onEnter:g.func,"data-testid":g.string};static defaultProps={onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0};constructor(e){super(e),this.state={value:"",filter:"",filteredOptions:e.options,keyboardOptionIndex:-1,menuIsOpen:!1,inputWidth:100},this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=I.createRef(),this.cbContainer=I.createRef(),this.toggleButton=I.createRef(),this.menuContainer=I.createRef(),this.input=I.createRef(),this.searchInput=I.createRef()}componentDidUpdate(){const{menuIsOpen:e,keyboardOptionIndex:t}=this.state;e&&t>=0&&this.scrollOptionIntoView()}popper;cbContainer;toggleButton;menuContainer;input;searchInput;setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getCachedFilteredOptions=Y((e,t)=>e.filter(n=>n.title.toLowerCase().indexOf(t.toLowerCase())>=0||n.value.toLowerCase().indexOf(t.toLowerCase())>=0));focus(){this.input.current?.focus()}resetValue(){this.setState({value:""})}updateInputValue(e){const{onChange:t}=this.props;this.setState({value:e}),t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){const{filter:t,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,a=t?n:i;switch(e.key){case"Enter":a[s]?.value!=null&&this.updateInputValue(a[s].value),this.closeMenu(),this.input.current?.focus(),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(we.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(we.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":t!==""?(this.setState({filter:""}),e.stopPropagation()):this.closeMenu();break;case"Tab":!e.shiftKey&&s===a.length-1&&this.closeMenu();break}}handleMenuNavigation(e){const{filter:t,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,r=(t?n:i).length;let l=0;switch(e){case we.MENU_NAVIGATION_DIRECTION.UP:l=-1;break;case we.MENU_NAVIGATION_DIRECTION.DOWN:l=1;break}l!==0&&this.setState({keyboardOptionIndex:(s+l+r)%r})}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:n}=this.state;e.key==="ArrowDown"||e.key==="ArrowUp"?n||this.openMenu():e.key==="Enter"&&t()}handleInputChange(e){this.updateInputValue(e.target.value)}handleOptionClick(e){const t=Number(e.currentTarget.value),{filter:n,filteredOptions:s}=this.state,{options:i}=this.props,a=n?s:i;this.updateInputValue(a[t].value),this.closeMenu(),this.input.current?.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleFilterChange(e){const{options:t}=this.props,n=e.target.value,s=this.getCachedFilteredOptions(t,n);this.setState({filter:n,filteredOptions:s,keyboardOptionIndex:0}),this.popper.current?.scheduleUpdate()}handleMenuBlur(e){e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||e.relatedTarget===this.toggleButton.current||this.closeMenu(!1)}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){this.scrollOptionIntoView(),this.searchInput.current?.focus()}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&(this.setState({menuIsOpen:!1}),this.popper.current?.hide()),this.setState({filter:""})}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{this.popper.current?.show()})}closeMenu(e=!0){this.setState({menuIsOpen:!1}),e&&this.input.current?.focus(),this.popper.current?.hide()}updateKeyboardIndex(){const{value:e,filter:t,filteredOptions:n}=this.state,{options:s}=this.props,a=(t?n:s).findIndex(r=>r.value===e);this.setState({keyboardOptionIndex:a})}scrollOptionIntoView(){const e=this.menuContainer.current?.querySelector(".cb-option-btn.keyboard-active");e instanceof HTMLElement&&e.scrollIntoView({block:"nearest",inline:"nearest"})}renderMenuElement(){const{searchPlaceholder:e}=this.props,{filter:t,inputWidth:n}=this.state;return c.jsxs("div",{className:"cb-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:s=>{s.stopPropagation()},style:{width:n},onBlur:this.handleMenuBlur,children:[c.jsx("div",{className:"cb-search-input-container",children:c.jsx(nt,{value:t,ref:this.searchInput,onChange:this.handleFilterChange,className:"cb-search-input",placeholder:e})}),c.jsx("div",{className:"cb-options-container",children:c.jsx("div",{className:"cb-options",children:this.renderOptions()})})]})}renderOptions(){const{options:e}=this.props,{keyboardOptionIndex:t,filter:n,filteredOptions:s}=this.state;return(n?s:e).map((a,r)=>{const l=`option-${r}-${a.value}`;return c.jsx("button",{type:"button",value:r,className:x("cb-option-btn",{"keyboard-active":t===r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:a.title},l)})}render(){const{options:e,inputPlaceholder:t,disabled:n,className:s,defaultValue:i,spellCheck:a,"data-testid":r}=this.props,{value:l}=this.state;let{popperOptions:u}=this.props;return u={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...u},c.jsxs("div",{className:"input-group cb-container",ref:this.cbContainer,children:[c.jsx("input",{value:l||i,className:x("form-control",s,"cb-input"),ref:this.input,onChange:this.handleInputChange,placeholder:t||(e[0]!=null?e[0].title:void 0),disabled:n,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:a,"data-testid":r!==void 0?`${r}-input`:void 0}),c.jsx("div",{className:"input-group-append cb-dropdown",children:c.jsxs("button",{type:"button",className:"btn cb-btn form-control",ref:this.toggleButton,onClick:this.toggleMenu,onKeyDown:this.handleInputKeyDown,disabled:n,"data-testid":r!==void 0?`${r}-btn`:void 0,children:[c.jsx(G,{icon:ei}),c.jsx(Ae,{ref:this.popper,options:u,className:x("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}}const Gi=we;function zi({copy:o,kind:e="ghost",tooltip:t="Copy",className:n,"data-testid":s,children:i}){const[a,r]=On();return c.jsx(ee,{kind:e,className:n,"data-testid":s,icon:a?ti:ni,tooltip:a?"Copied":t,onClick:()=>{r(typeof o=="function"?o():o)},children:i})}function st(o,e,t){return o.substring(0,e)+t+o.substring(e+1)}function Ln(o,e,t){return o.length<t?`${o}${e.substring(o.length,t)}`:o}function Ct(o,e){let{length:t}=o;for(let n=o.length-1;n>=0&&e[n]===o[n];n-=1)t=n;return o.substring(0,t)}const se=V.module("MaskedInput"),Ie={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},_e=" ",jn=I.forwardRef((o,e)=>{const{className:t,example:n,getNextSegmentValue:s=(N,k,y)=>y,getPreferredReplacementString:i=st,onChange:a=()=>!1,onSelect:r=()=>!1,onSubmit:l,pattern:u,placeholder:h,selection:p,value:m,onFocus:f=()=>!1,onBlur:v=()=>!1,"data-testid":S}=o,C=Ot(e),w=d.useMemo(()=>Array.isArray(n)?n:[n],[n]),D=d.useMemo(()=>w[0].replace(/[a-zA-Z0-9]/g,_e),[w]);d.useEffect(function(){if(p!=null){se.debug("setting selection...",p);const{selectionStart:k,selectionEnd:y,selectionDirection:$}=p;C.current?.setSelectionRange(k,y,$),se.debug("selection set!")}},[p,C]);const M=d.useCallback(N=>{let k=N,y=N;const $=w.length>0?w[0]:m;for(let E=k-1;E>=0&&/[a-zA-Z0-9]/g.test($.charAt(E));E-=1)k=E;for(let E=y;E<$.length&&/[a-zA-Z0-9]/g.test($.charAt(E));E+=1)y=E+1;const F=k===y?Ie.NONE:Ie.BACKWARD;return{selectionStart:k,selectionEnd:y,selectionDirection:F}},[w,m]);function A(N,k,y=N.length){let $="";for(let F=0;F<y;F+=1)N.charAt(F)!==_e?$=$.concat(N[F]):$=$.concat(k[F]);return $=$.concat(k.substring(y)),$}function R(N,k=N.length){const y=new RegExp(`^${u}$`);if(y.test(N))return!0;for(let $=0;$<w.length;$+=1){const F=A(N,w[$],k);if(y.test(F))return!0}return!1}function O(N){const k=M(N),y=k.selectionEnd+1;return y>=m.length?k:M(y)}function P(N){const k=M(N),y=k.selectionStart-1;return y<=0?k:M(y)}function K(N,k){const y=M(N),$=m.substring(y.selectionStart,y.selectionEnd),F=s(y,k,$,m),E=m.substring(0,y.selectionStart)+F+m.substring(y.selectionEnd);R(E,y.selectionEnd)&&(a(E),r(y))}const oe=d.useCallback(N=>{const{selectionStart:k=0,selectionEnd:y=0,selectionDirection:$="none"}=N.target;if(k===null||y===null||$===null){se.error("Selection attempted on non-text input element",N.target);return}if(se.debug2("handleSelect",k,y,$),!(p!=null&&k===p.selectionStart&&y===p.selectionEnd)){if(p!=null&&k===m.length&&y===m.length&&N.nativeEvent.type!=="mouseup"){r({...p});return}if(k===y){const F=M(k);se.debug("Selection segment from ",k,y,"=>",F),r(F)}else r({selectionStart:k,selectionEnd:y,selectionDirection:$})}},[M,r,p,m]),j=d.useCallback(N=>{if(!C.current)return;se.debug("handleSelectCapture",N);const k=C.current.selectionStart??0;k===m.length&&p!=null&&k!==p.selectionStart&&(N.preventDefault(),N.stopPropagation())},[C,p,m]);function L(N){if(N.preventDefault(),N.stopPropagation(),!C.current)return;const{key:k}=N,{selectionStart:y=0,selectionEnd:$=0}=C.current;if(y===null||$===null){se.error("Selection arrow nvaigation attempted on non-text input element",N.target);return}k==="ArrowLeft"?r(P(y)):k==="ArrowRight"?r(O($)):k==="ArrowUp"?K(y,-1):k==="ArrowDown"&&K(y,1)}function H(N){if(!C.current)return;se.debug("handleKeyDown",N);const{key:k}=N,{selectionStart:y=0,selectionEnd:$=0}=C.current;if(y===null||$===null){se.error("Selection key event on non-text input element",N.target);return}if(k==="Enter"){l?.(N);return}if(k.startsWith("Arrow")){L(N);return}if(k==="Delete"||k==="Backspace"){if(N.preventDefault(),N.stopPropagation(),$>=Ct(m,D).length){const E=m.substring(0,y===$?y-1:y),B=Ct(E,D);B!==m&&(a(B),r({selectionStart:B.length,selectionEnd:B.length,selectionDirection:Ie.NONE}));return}if(y!==$){const E=m.substring(0,y)+m.substring(y,$).replace(/[a-zA-Z0-9]/g,_e)+m.substring($);se.debug("Range ",y,$,"deleted, setting value",E),a(E),r({selectionStart:y,selectionEnd:y,selectionDirection:Ie.NONE})}else if(y>0)for(let E=y-1;E>=0;E-=1){const B=m.substring(0,E)+m.substring(E,y).replace(/[a-zA-Z0-9]/g,_e)+m.substring(y);if(B!==m){a(B),r({selectionStart:E,selectionEnd:E,selectionDirection:Ie.NONE});return}}return}if(N.altKey||N.metaKey||N.ctrlKey||k.length>1)return;N.preventDefault(),N.stopPropagation();const F=Array.from(new Set([k,k.toUpperCase(),k.toLowerCase()]));for(let E=0;E<F.length;E+=1){const B=F[E],te=/[a-zA-Z0-9]/g.test(B)?w[0].length-1:y;for(let ne=y;ne<=te;ne+=1){const Ls=Ln(m,w[0],ne+1),lt=i(Ls,ne,B,y,$);if(R(lt,ne+1)){const Xt=M(ne),ct=ne+1;let ut={selectionStart:ct,selectionEnd:ct,selectionDirection:Ie.NONE};if(ct>=Xt.selectionEnd){const Qt=O(ne);Qt.selectionStart!==Xt.selectionStart&&(ut=Qt)}se.debug("handleKeyDown",k,"=>",lt,ut),a(lt),r(ut);return}}}}return c.jsx("input",{ref:C,className:x("form-control masked-input",t),type:"text",pattern:u,placeholder:h,value:m,onChange:()=>{},onKeyDown:H,onSelect:oe,onSelectCapture:j,onFocus:f,onBlur:v,"data-testid":S})});jn.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(o,e,t)=>t,getPreferredReplacementString:st,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const it=jn,Zi=V.module("TimeInput"),Xi="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",Qi=["00:00:00","12:34:56","23:59:59"],$n=I.forwardRef((o,e)=>{const{allowValueWrapping:t=!0,className:n="",onChange:s=()=>!1,value:i=0,onFocus:a=()=>!1,onBlur:r=()=>!1,onSelect:l=()=>!1,"data-testid":u}=o,[h,p]=d.useState(Fe.formatTime(i)),[m,f]=d.useState(),v=d.useRef(null);d.useImperativeHandle(e,()=>({focus:()=>{v.current?.focus()},setSelection:M=>{v.current?.focus(),f(M)}}),[]),d.useEffect(function(){p(Fe.formatTime(i))},[i]);function S(M,A,R){const O=M.selectionStart===0?24:60;let P=parseInt(R,10)-A;return Number.isNaN(P)?P=0:t?P=(P%O+O)%O:P=Math.min(Math.max(0,P),O-1),`${P}`.padStart(2,"0")}function C(M,A,R,O,P){return O===0&&P===2&&A===1&&parseInt(R,10)>1?`0${R}${M.substring(2)}`:st(M,A,R)}function w(M){Zi.debug("handleChange",M),p(M),Fe.isTimeString(M)&&s(Fe.parseTime(M))}const D=d.useCallback(M=>{f(M),l(M)},[l]);return c.jsx(it,{ref:v,className:n,example:Qi,getNextSegmentValue:S,getPreferredReplacementString:C,onChange:w,onSelect:D,pattern:Xi,selection:m,value:h,onFocus:a,onBlur:r,"data-testid":u})});$n.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const Ze=$n;let Ji=class extends d.PureComponent{static defaultProps={closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};constructor(e){super(e),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.container=I.createRef(),this.oldFocus=document.activeElement,this.rAF=0;const{options:t}=e,n=t.initialKeyboardIndex??-1;this.state={menuItems:[],keyboardIndex:n,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{this.container.current?.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e){const{actions:t}=this.props;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}container;oldFocus;rAF;getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});const{actions:e}=this.props,t=_.getMenuItems(e,!1);t.length>0&&this.setState(n=>({menuItems:_.sortActions(n.menuItems.concat(t))}))}handleKeyDown(e){const{menuItems:t}=this.state,n=this.getKeyboardIndex();let s=n;if(e.key==="Enter"||e.key===" "){n!=null&&n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}e.key==="Escape"?s=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?s=_.getNextMenuItem(s??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(s=_.getNextMenuItem(s??0,1,t)),n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(),this.closeMenu(!0))}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{"data-testid":t}=this.props,{keyboardIndex:n,menuItems:s,mouseIndex:i}=this.state;for(let r=0;r<s.length;r+=1){const l=s[r];r>0&&l.group!==s[r-1].group&&e.push(c.jsx("hr",{},`${r}.separator`));const u=c.jsx(Lt,{isKeyboardSelected:n===r,isMouseSelected:i===r,menuItem:l,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},r);e.push(u)}const{menuStyle:a}=this.props;return c.jsx("div",{className:"context-menu-container",style:{...a},ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}};const Yi=Ji;class eo extends d.PureComponent{static defaultProps={isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0};constructor(e){super(e),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=I.createRef(),this.parent=null,this.popper=I.createRef(),this.isOpen=!1}componentDidMount(){const{isShown:e}=this.props;e===null?this.container.current?.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick)):e&&this.openMenu()}componentDidUpdate(e){const{isShown:t}=this.props;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}container;parent;popper;isOpen;closeMenu(){this.popper.current?.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){this.popper.current?.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;const{onMenuClosed:e}=this.props;e()}render(){const{actions:e,onMenuOpened:t,popperClassName:n,"data-testid":s}=this.props,{menuStyle:i}=this.props;let{options:a,popperOptions:r}=this.props;return r={placement:"bottom",...r},a={separateKeyboardMouse:!0,...a},c.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":s,children:c.jsx(Ae,{ref:this.popper,options:r,className:x("menu-popper",n),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:c.jsx(Yi,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:a,menuStyle:i})})})}}const Vn=eo;const tn=-1;var Bn=(o=>(o.UP="UP",o.DOWN="DOWN",o))(Bn||{});class ae extends d.Component{static MENU_NAVIGATION_DIRECTION=Bn;static DROP_DOWN_MENU_HEIGHT=125;static defaultProps={onChange(){},value:null,disabled:!1,popperOptions:{},icon:si,customText:"Custom",placeholder:"Select a time",valueToTime:e=>e===null?0:Math.round(e/1e3),timeToValue:e=>e*1e3,invalid:!1,"data-testid":void 0};constructor(e){super(e);const{value:t,valueToTime:n}=e;this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.handleCustomInput=this.handleCustomInput.bind(this),this.csContainer=I.createRef(),this.menuContainer=I.createRef(),this.button=I.createRef(),this.input=I.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:n(t),inputFocused:!1}}csContainer;menuContainer;button;input;getSelectedText(){const{options:e,value:t,placeholder:n}=this.props,{customTime:s}=this.state;if(t===null)return n;for(let i=0;i<e.length;i+=1){const a=e[i];if(a.value===t)return a.title}return Fe.formatTime(s)}setInputWidth(){this.csContainer.current&&this.setState({inputWidth:this.csContainer.current.getBoundingClientRect().width})}focus(){this.button.current?.focus()}updateInputValue(e){const{onChange:t}=this.props;t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){const{keyboardOptionIndex:t,inputFocused:n}=this.state,{options:s}=this.props;switch(e.key){case"Enter":case" ":n?this.updateFromCustom():this.updateInputValue(s[t].value),this.closeMenu(),this.button.current?.focus(),e.stopPropagation(),e.preventDefault();break;case"Tab":e.shiftKey?this.handleMenuNavigation(ae.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(ae.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(ae.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(ae.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(e){const{keyboardOptionIndex:t,inputFocused:n}=this.state,{options:s}=this.props,i=s.length;let a=t;switch(e){case ae.MENU_NAVIGATION_DIRECTION.UP:if(!n&&t===0){this.focusInput();break}else n&&this.focusOption(t);t>0&&!n?(a=(a-1)%i,this.setState({keyboardOptionIndex:a})):t===0&&(a=i-1,this.setState({keyboardOptionIndex:a})),this.scrollOptionIntoView(a);break;case ae.MENU_NAVIGATION_DIRECTION.DOWN:if(!n&&t===i-1){this.focusInput();break}else n&&this.focusOption(t);t<i&&!(n&&t===0)&&(a=(a+1)%i,this.setState({keyboardOptionIndex:a})),this.scrollOptionIntoView(a);break}}handleOptionClick(e){const t=Number(e.currentTarget.value),{options:n,timeToValue:s}=this.props,{customTime:i}=this.state;if(t===tn){const a=s(i);this.updateAndClose(a)}else this.updateAndClose(n[t].value)}updateAndClose(e){this.updateInputValue(e),this.closeMenu(),this.button.current?.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleMenuOpened(){const{options:e,value:t}=this.props,{keyboardOptionIndex:n}=this.state;this.scrollOptionIntoView(n);const s=this.menuContainer.current?.querySelector(".cs-option-btn.keyboard-active");if(s instanceof HTMLElement&&s.focus(),t===null)return;e.map(a=>a.value).indexOf(t)<0&&this.focusInput()}focusInput(){this.input.current?.focus()}focusOption(e){const t=this.menuContainer.current?.querySelector(".cs-options");if(t&&t.children!=null){const n=t.children.item(e);n instanceof HTMLElement&&n.focus()}}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(e){const{timeToValue:t}=this.props,n=t(e);this.updateInputValue(n),this.setState({customTime:e})}updateFromCustom(){const{timeToValue:e}=this.props,{customTime:t}=this.state,n=e(t);this.updateInputValue(n)}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(e=!0){this.setState({menuIsOpen:!1}),e&&this.button.current?.focus()}updateKeyboardIndex(){const{options:e,value:t}=this.props;if(t===null)return;const n=e.map(s=>s.value).indexOf(t);n>0&&this.setState({keyboardOptionIndex:n})}scrollOptionIntoView(e){const t=this.menuContainer.current?.querySelector(".cs-options");if(t&&t.children!=null){const n=t.children.item(e);n instanceof HTMLElement&&n.offsetTop>ae.DROP_DOWN_MENU_HEIGHT?t.scrollTop=n.offsetTop-ae.DROP_DOWN_MENU_HEIGHT:(n instanceof HTMLElement&&n.offsetTop<0||e===0)&&(t.scrollTop=0)}}renderMenuElement(){const{inputWidth:e}=this.state;return c.jsx("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:t=>{t.stopPropagation()},style:{width:e},children:c.jsx("div",{className:"cs-options-container",children:c.jsx("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){const{options:e,value:t,icon:n,customText:s}=this.props,{keyboardOptionIndex:i,customTime:a,inputFocused:r}=this.state;let l=!1;const u=[];for(let h=0;h<e.length;h+=1){const p=e[h],m=`option-${h}-${p.value}`;l=l||p.value===t,u.push(c.jsxs("button",{type:"button",value:h,className:x("cs-option-btn",{"keyboard-active":i===h&&!r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[p.value===t&&c.jsx(G,{icon:n,className:"mr-2"}),p.value!==t&&c.jsx("span",{className:"mr-4"}),p.title]},m))}return u.push(c.jsx("hr",{className:"cs-divider"},"option-divider")),u.push(c.jsxs("button",{type:"button",value:tn,className:x("cs-option-btn",{"keyboard-active":r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!l&&t!==null?c.jsx(G,{icon:n,className:"mr-2"}):c.jsx("span",{className:"mr-4"}),s]},"option-custom-label")),u.push(c.jsxs("div",{className:"cs-custom-container",children:[c.jsx("span",{className:"mr-2"}),c.jsx(Ze,{ref:this.input,onChange:this.handleCustomInput,value:a,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),c.jsx("span",{className:"ml-2"})]},"cs-custom-container")),u.push(c.jsx("hr",{className:"mb-2"},"option-end")),u}render(){const{disabled:e,invalid:t,value:n,"data-testid":s}=this.props,{menuIsOpen:i}=this.state;let{popperOptions:a}=this.props;return a={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...a},c.jsx("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":s,children:c.jsx("div",{className:x("input-group-append cs-dropdown",{"cs-dropdown-invalid":t}),children:c.jsxs("button",{type:"button",className:x("btn cs-btn form-control",{"cs-btn-invalid":t}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[c.jsx("span",{className:x({"text-muted":n===null}),children:this.getSelectedText()}),c.jsx("span",{children:c.jsx(G,{icon:xn,className:"cs-caret"})}),c.jsx(Vn,{isShown:i,actions:{menuElement:this.renderMenuElement()},popperOptions:a,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}}const to=ae;function xe(o,e,t,n,s){const i=n-t+1;return`${((parseInt(e,10)-o-t)%i+i)%i+t}`.padStart(s,"0")}function Hn(o,e,t){const{selectionStart:n}=o;return n===0?xe(e,t,1900,2099,4):n===5?xe(e,t,1,12,2):n===8?xe(e,t,1,31,2):n===11?xe(e,t,0,23,2):n===17||n===14?xe(e,t,0,59,2):n===20||n===24||n===28?xe(e,t,0,999,3):t}function St(o){const e=o.substring(0,23),t=o.substring(23,26),n=o.substring(26);return[e,t,n].filter(s=>s!=="").join("​")}const no=V.module("DateTimeInput"),so="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",io="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}​[0-9]{3}​[0-9]{3}",oo=`${so} ${io}`,We="2022-01-01",_n=`${We} 00:00:00.000000000`,ao="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function nn(o){return o!=null&&o.length>=We.length?`${o.substring(0,We.length)}${o.substring(We.length).replace(/\u2007/g,"0")}${_n.substring(o.length)}`:o}function sn(o){return o.replace(/\u200B/g,"")}const ro=[St(_n)],jt=I.forwardRef((o,e)=>{const{className:t="",onChange:n=()=>{},defaultValue:s="",onFocus:i=()=>{},onBlur:a=()=>{},onSubmit:r,"data-testid":l}=o,[u,h]=d.useState(s.length>0?St(s):""),[p,m]=d.useState(),f=d.useCallback(S=>{no.debug("handleChange",S),h(S),n(nn(sn(S)))},[n]),v=d.useCallback(()=>{const S=sn(u),C=nn(S);C!==S&&h(St(C)),a()},[u,a]);return c.jsx("div",{className:"d-flex flex-row align-items-center",children:c.jsx(it,{ref:e,className:x(t),example:ro,getNextSegmentValue:Hn,onChange:f,onSelect:m,onSubmit:r,pattern:oo,placeholder:ao,selection:p,value:u,onFocus:i,onBlur:v,"data-testid":l})})});jt.displayName="DateTimeInput";jt.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const lo=jt,co=V.module("DateInput"),uo="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",ho=["2000-01-01","2022-12-31"],po="YYYY-MM-DD",$t=I.forwardRef((o,e)=>{const{className:t="",onChange:n=()=>{},defaultValue:s="",onFocus:i=()=>{},onBlur:a=()=>{},"data-testid":r}=o,[l,u]=d.useState(s),[h,p]=d.useState(),m=d.useCallback(f=>{co.debug("handleChange",f),u(f),n(f)},[n]);return c.jsx("div",{className:"d-flex flex-row align-items-center",children:c.jsx(it,{ref:e,className:x(t),example:ho,getNextSegmentValue:Hn,onChange:m,onSelect:p,pattern:uo,placeholder:po,selection:h,value:l,onFocus:i,onBlur:a,"data-testid":r})})});$t.displayName="DateInput";$t.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const mo=$t;class fo extends d.PureComponent{static defaultProps={placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0};constructor(e){super(e),this.searchInput=I.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Pe(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){const{value:t}=this.props;e.value!==t&&this.setState({value:t})}searchInput;focus(){this.searchInput.current?.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){const{onChange:e}=this.props,{value:t}=this.state;e(t)}render(){const{placeholder:e,className:t,matchCount:n,id:s,"data-testid":i}=this.props,{value:a}=this.state;return c.jsx(nt,{value:a,placeholder:e,onChange:this.handleChange,className:t,matchCount:n,ref:this.searchInput,id:s,"data-testid":i})}}const go=fo;const bo=V.module("ItemListItem");class Vt extends d.Component{static defaultProps={children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}};static handleKeyDown(){return bo.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=I.createRef()}itemRef;handleBlur(e){const{itemIndex:t,onBlur:n}=this.props;n(t,e)}handleFocus(e){const{itemIndex:t,onFocus:n}=this.props;n(t,e)}handleClick(e){const{itemIndex:t,onClick:n}=this.props;n(t,e)}handleContextMenu(e){const{itemIndex:t,onContextMenu:n}=this.props;n(t,e)}handleDragStart(e){const{itemIndex:t,onDragStart:n}=this.props;n(t,e)}handleDrag(e){const{itemIndex:t,onDrag:n}=this.props;n(t,e)}handleDragOver(e){e.preventDefault();const{itemIndex:t,onDragOver:n}=this.props;n(t,e)}handleDragEnd(e){const{itemIndex:t,onDragEnd:n}=this.props;n(t,e)}handleDrop(e){const{itemIndex:t,onDrop:n}=this.props;n(t,e)}handleDoubleClick(e){const{itemIndex:t,onDoubleClick:n}=this.props;n(t,e)}handleMouseMove(e){const{itemIndex:t,onMouseMove:n}=this.props;n(t,e)}handleMouseDown(e){const{itemIndex:t,onMouseDown:n}=this.props;n(t,e)}handleMouseUp(e){const{itemIndex:t,onMouseUp:n}=this.props;n(t,e)}render(){const{isDraggable:e,isFocused:t,isSelected:n,style:s,children:i,"data-testid":a}=this.props;return c.jsx("div",{className:x("item-list-item",{active:n},{"is-focused":t},{"is-draggable":e}),onKeyDown:Vt.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:s,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":a,children:i})}}const Un=Vt;const on=V.module("ItemList"),an=5;class ie extends d.PureComponent{static CACHE_SIZE=1e3;static DEFAULT_ROW_HEIGHT=20;static DEFAULT_OVERSCAN=10;static defaultProps={offset:0,items:[],rowHeight:ie.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:ie.DEFAULT_OVERSCAN,renderItem:ie.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0};static renderItem({item:e}){return c.jsx("div",{className:"item-list-item-content",children:e!=null&&(e.displayValue??e.value??`${e}`)})}constructor(e){super(e),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=I.createRef(),this.listContainer=I.createRef();const{isStickyBottom:t,selectedRanges:n}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:n,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){const{selectedRanges:n,itemCount:s}=this.props,{focusIndex:i,isStuckToBottom:a,scrollOffset:r,height:l,selectedRanges:u}=this.state;if(a&&!this.isListAtBottom()&&s>0&&this.scrollToBottom(),(r!==t.scrollOffset||l!==t.height)&&this.sendViewportUpdate(),n!==e.selectedRanges&&n!==u)this.setSelectedRanges(n);else if(u!==t.selectedRanges){const{onSelectionChange:h}=this.props;h(u)}if(i!==t.focusIndex){const{onFocusChange:h}=this.props;h(i)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}list;listContainer;getItemSelected=Y((e,t)=>re.isSelected(t,e),{max:ie.CACHE_SIZE});getCachedItem=Y((e,t,n,s,i,a,r,l)=>{const u=a({item:n,itemIndex:e,isFocused:s,isSelected:i,style:r});return c.jsx(Un,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:l,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:i,itemIndex:e,style:r,children:u},t)},{max:ie.CACHE_SIZE});getOuterElement=Y(e=>{const t=I.forwardRef((n,s)=>c.jsx("div",{ref:s,tabIndex:-1,onKeyDown:e,role:"presentation",...n}));return t.displayName="ItemListOuterElement",t});getInnerElement=Y(()=>{const e=I.forwardRef((t,n)=>c.jsx("div",{className:"item-list-inner-element",ref:n,...t}));return e.displayName="ItemListInnerElement",e});getItemData=Y((e,t,n)=>({items:e,selectedRanges:t,renderItem:n}));focus(){this.listContainer.current?.focus()}restoreScrollPosition(){const{scrollOffset:e}=this.state;e!=null&&this.listContainer.current?.scrollTo(0,e)}getElement(e){if(this.listContainer.current==null)return null;const{focusSelector:t}=this.props,{overscanStartIndex:n}=this.state,s=this.listContainer.current.querySelectorAll(t),i=e-n;return s[i]}focusItem(e){const{disableSelect:t}=this.props;if(t)return;this.setState({focusIndex:e});const n=this.getElement(e);n instanceof HTMLElement&&n.focus()}scrollToItem(e){const t=this.getElement(e);t?.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){const{selectedRanges:n}=this.state,i=re.isSelected(n,e)||_.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,i,!1)}handleItemDoubleClick(e,t){const{isDoubleClickSelect:n,onSelect:s}=this.props;n&&this.setState(({selectedRanges:i})=>({selectedRanges:re.selectRange(i,[e,e])}),()=>{s(e,t)})}handleItemMouseDown(e,t){const{selectedRanges:n}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&n.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e,mouseX:t.clientX,mouseY:t.clientY}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){on.debug2("item blur",e,t.currentTarget,t.relatedTarget),(!t.relatedTarget||this.listContainer.current&&t.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(t.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(e,t){on.debug2("item focus",e,t.target),this.setState(n=>{const{focusIndex:s}=n;return s!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){const{isDragSelect:n,isMultiSelect:s,disableSelect:i}=this.props,{mouseDownIndex:a,selectedRanges:r,mouseX:l,mouseY:u}=this.state;if(a==null||i)return;const h=Math.abs(t.clientX-(l??0)),p=Math.abs(t.clientY-(u??0));h>an&&p>an&&this.setState({isDragging:!0}),(n||a===e)&&(this.focusItem(e),s?(!n&&!this.getItemSelected(e,r)&&!_.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(a,e),Math.max(a,e)])):this.toggleSelect(e,t.shiftKey,_.isModifierKeyDown(t),!1))}handleItemMouseUp(e,t){const{isDeselectOnClick:n,isDoubleClickSelect:s,onSelect:i}=this.props,{mouseDownIndex:a,isDragging:r}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(a===e&&!r){const l=t.shiftKey,u=_.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,l,u,n),!s&&!l&&!u&&i(e,t)}this.resetMouseState()}}handleItemsRendered({overscanStartIndex:e}){this.setState({overscanStartIndex:e})}handleResize({height:e}){this.setState({height:e})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){const{isMultiSelect:t,itemCount:n,onSelect:s}=this.props,{focusIndex:i}=this.state;let a=i;if(e.key==="Enter"||e.key===" "){!t&&a!=null&&this.setState({selectedRanges:[[a,a]]},()=>{a!=null&&s(a,e)});return}if(e.key==="ArrowUp")a!=null&&a>=0?a=Math.max(0,a-1):a=n-1;else if(e.key==="ArrowDown")a!=null&&a>=0?a=Math.min(a+1,n-1):a=0;else return;if(i!==a){e.stopPropagation(),e.preventDefault(),this.focusItem(a);const{selectedRanges:r}=this.state;if(e.shiftKey&&r.length>0){const l=r[r.length-1];this.selectRange([Math.min(a,l[0]),Math.max(a,l[1])])}else this.deselectAll(),a!==null?this.selectItem(a):this.listContainer.current?.focus();this.scrollIntoView(a)}}handleScroll({scrollUpdateWasRequested:e,scrollOffset:t}){this.setState(n=>{if(e)return{scrollOffset:t};const{isStickyBottom:s}=this.props,{height:i}=n;return{isStuckToBottom:s&&this.isListAtBottom({scrollOffset:t,height:i}),scrollOffset:t}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){const{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,n,s=!0){const{isMultiSelect:i}=this.props,{selectedRanges:a}=this.state;if(i&&t&&a.length>0){const r=a[a.length-1];this.selectRange([Math.min(r[0],e),Math.max(e,r[1])])}else i&&a.length===1&&a[0][0]===e&&a[0][1]===e?s&&this.deselectItem(e):i&&n?this.getItemSelected(e,a)?s&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){const{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){re.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:re.deselectRange(t,e)}))}selectItem(e){const{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){re.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:re.selectRange(t,e)}))}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){const{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){const{onViewportChange:n,rowHeight:s}=this.props,i=Math.floor(e/s),a=i+Math.ceil(t/s);n(i,a)}}isListAtBottom({scrollOffset:e,height:t}=this.state){if(t==null||e==null)return!1;const{itemCount:n,rowHeight:s}=this.props;return e+t>=n*s}renderInnerElement({index:e,style:t}){const{items:n,offset:s,renderItem:i,disableSelect:a}=this.props,{focusIndex:r,selectedRanges:l}=this.state;if(e<s||e>=s+n.length)return null;const u=n[e-s];return this.getCachedItem(e,e,u,e===r&&!a,this.getItemSelected(e,l),i,t,a)}render(){const{items:e,itemCount:t,overscanCount:n,renderItem:s,rowHeight:i,"data-testid":a}=this.props,{selectedRanges:r,isStuckToBottom:l}=this.state;return c.jsx($s,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:u,height:h})=>c.jsx(Vs,{className:"item-list-scroll-pane",height:h,width:u,initialScrollOffset:l?t*i:0,itemCount:t,itemSize:i,itemData:this.getItemData(e,r,s),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:n,"data-testid":a,children:this.renderInnerElement})})}}class fe extends d.PureComponent{static DEFAULT_ROW_HEIGHT=30;static defaultProps={className:"",draggingItemClassName:"",offset:0,items:[],rowHeight:fe.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!0,isDropDisabled:!1,isDragDisabled:!1,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,style:null,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},renderItem:fe.renderItem,selectedRanges:[],draggablePrefix:"draggable-item",droppableId:"droppable-item-list","data-testid":void 0};static renderHandle(){return c.jsxs("div",{children:[c.jsx(Nt,{children:"Drag to re-order"}),c.jsx(G,{icon:ii})]})}static renderBadge({text:e}){return e!=null&&e.length>0?c.jsx("span",{className:"number-badge",children:e}):null}static renderTextItem({text:e,badgeText:t="",className:n=""}){return c.jsxs("div",{className:x("item-list-item-content","draggable-item-list-item-content",n),children:[c.jsx("span",{className:"title",children:e}),fe.renderBadge({text:t}),fe.renderHandle()]})}static renderItem({item:e,isClone:t,selectedCount:n}){const s=e!=null?e.displayValue??e.value??`${e}`:"",i=t!==void 0&&t?`${n}`:"",a=t!==void 0&&t?"item-list-item-clone":"";return fe.renderTextItem({text:s,badgeText:i,className:a})}static getDraggableId(e,t){return`${e}/${t}`}static getDraggableIndex(e){const t=e.split("/").pop();return parseInt(t!==void 0?t:"",10)}constructor(e){super(e),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.itemList=I.createRef(),this.state={selectedCount:0}}itemList;selectItem(e){this.itemList.current?.selectItem(e)}focusItem(e){this.itemList.current?.focusItem(e)}scrollToItem(e){this.itemList.current?.scrollToItem(e)}getCachedDraggableItem=Y((e,t,n,s,i,a,r,l)=>c.jsx(Bs,{draggableId:fe.getDraggableId(e,s),index:s,isDragDisabled:r,children:u=>c.jsx("div",{role:"menuitem",className:"draggable-item-list-item",ref:u.innerRef,tabIndex:-1,...u.draggableProps,...u.dragHandleProps,children:t({item:n,itemIndex:s,isFocused:i,isSelected:a,style:l,isClone:!1})})},s),{max:ie.CACHE_SIZE});handleSelectionChange(e){this.setState({selectedCount:re.count(e)});const{onSelectionChange:t}=this.props;t(e)}getCachedRenderDraggableItem=Y((e,t,n)=>({item:s,itemIndex:i,isFocused:a,isSelected:r,style:l})=>this.getCachedDraggableItem(e,n,s,i,a,r,t,l),{max:1});getCachedRenderClone=Y((e,t,n,s)=>(i,a,r)=>{const{selectedCount:l}=this.state,{draggableProps:u,dragHandleProps:h,innerRef:p}=i,{index:m}=r.source,f=t[m-n];return c.jsx("div",{className:x("draggable-item-list-dragging-item-container",e),...u,...h,ref:p,children:c.jsx("div",{className:x("draggable-item-list-dragging-item",{"two-dragged":l===2},{"multiple-dragged":l>2}),children:s({item:f,itemIndex:m,isFocused:!1,isSelected:!0,style:{},isClone:!0,selectedCount:l})})})},{max:1});render(){const{className:e,draggablePrefix:t,draggingItemClassName:n,droppableId:s,isDoubleClickSelect:i,isDragDisabled:a,isDropDisabled:r,isMultiSelect:l,isStickyBottom:u,itemCount:h,items:p,offset:m,onFocusChange:f,onSelect:v,onViewportChange:S,renderItem:C,rowHeight:w,selectedRanges:D,style:M,"data-testid":A}=this.props;return c.jsx(Hs,{isDropDisabled:r,droppableId:s,mode:"virtual",renderClone:this.getCachedRenderClone(n,p,m,C),"data-testid":A,children:(R,O)=>c.jsx("div",{role:"menu",className:x("draggable-item-list",e,{"is-drop-disabled":r,"is-drag-disabled":a,"is-dragging-from-this":O.draggingFromThisWith,"is-dragging-over":O.isDraggingOver,"is-dropping":O.draggingOverWith}),style:M,ref:R.innerRef,...R.droppableProps,children:c.jsx(ie,{focusSelector:".draggable-item-list-item",isDoubleClickSelect:i,isDragSelect:!1,isMultiSelect:l,isStickyBottom:u,itemCount:h,items:p,onFocusChange:f,onSelect:v,onSelectionChange:this.handleSelectionChange,onViewportChange:S,offset:m,ref:this.itemList,renderItem:this.getCachedRenderDraggableItem(t,a,C),rowHeight:w,selectedRanges:D})})})}}const Co=fe;class Xe{static reorder(e,t,n,s){const i=e===n?Xe.adjustDestinationIndex(s,t):s,a=Xe.removeItems(e,t);return n.splice(i,0,...a),a}static removeItems(e,t){const n=[],s=t.map((i,a)=>({range:i,index:a})).sort((i,a)=>a.range[0]-i.range[0]);for(let i=0;i<s.length;i+=1){const{range:a,index:r}=s[i],[l,u]=a;n[r]=e.splice(l,u-l+1)}return _s(n)}static adjustDestinationIndex(e,t){let n=e;for(let s=0;s<t.length;s+=1){const[i,a]=t[s];if(i>e)break;n-=Math.min(a,e-1)-i+1}return n}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}const So=Xe;function vo(o){const{isInvalid:e=!1,items:t,onAdd:n=()=>{},onDelete:s=()=>{},validate:i=()=>null}=o,[a,r]=d.useState(null),[l,u]=d.useState([]),[h,p]=d.useState(""),m=d.useCallback(M=>{u(M)},[]),f=d.useCallback(()=>{s(re.getItemsInRanges(t,l)),u([])},[t,l,s]),v=d.useCallback(()=>{if(h==="")return;const M=i(h);M==null?(n(h),p("")):r(M)},[h,n,i]),S=d.useCallback(M=>{const{value:A}=M.target;p(A),r(A===""?null:i(A))},[i]),C=d.useCallback(()=>{u([])},[]),w=d.useCallback(M=>{M.key==="Enter"&&v()},[v]),D=d.useMemo(()=>14+gt(t.length,1,6)*ie.DEFAULT_ROW_HEIGHT,[t.length]);return c.jsxs("div",{className:x("editable-item-list-container",{"is-invalid":e}),children:[c.jsx("div",{style:{height:D},children:c.jsx(ie,{itemCount:t.length,items:t.map((M,A)=>({value:M,isSelected:re.isSelected(l,A)})),offset:0,selectedRanges:l,onSelectionChange:m,isMultiSelect:!0})}),c.jsxs("div",{className:"d-flex flex-row pt-2",children:[c.jsx("div",{className:"d-flex flex-grow-1",children:c.jsx("input",{className:x("form-control",{"is-invalid":a!=null}),placeholder:"Enter value",type:"text",value:h,onChange:S,onFocus:C,onKeyDown:w})}),c.jsxs("div",{className:"d-flex align-items-start mt-1 ml-2",children:[c.jsx(ee,{kind:"ghost",onClick:v,disabled:a!=null||h==="",icon:oi,tooltip:"Add new item","data-testid":"add-item-button"}),c.jsx(ee,{kind:"ghost",onClick:f,disabled:l.length===0,icon:ai,tooltip:"Delete selected items","data-testid":"delete-item-button"})]})]})]})}class Re extends d.Component{static defaultProps={className:"",icon:null,id:"","data-testid":void 0};static isParentSelected(e,t){const n=t.get(e);if(n===void 0)return!1;if(typeof n=="boolean")return n;const s=Array.from(n.values()).includes(!0),i=Array.from(n.values()).includes(!1);return s&&i?null:s}constructor(e){super(e),this.toggleMenu=this.toggleMenu.bind(this),this.toggleValueFor=this.toggleValueFor.bind(this),this.selectAll=this.selectAll.bind(this),this.clear=this.clear.bind(this),this.state={menuIsOpen:!1}}toggleMenu(e){e.stopPropagation(),e.preventDefault(),this.setState(t=>{const{menuIsOpen:n}=t;return{menuIsOpen:!n}})}toggleValueFor(e,t){const{valueMap:n,onUpdateValueMap:s}=this.props,i=new Map(n),a=i.get(e);if(a instanceof Map){const l=new Map(a);if(t!=null)l.set(t,a.get(t)===void 0);else{const u=Re.isParentSelected(e,i),h=u==null||!u;a.forEach((p,m)=>l.set(m,h))}i.set(e,l)}else i.set(e,a==null||!a);const r=i.get(e);if(t===void 0&&r!==void 0&&typeof r!="boolean"){const l=Re.isParentSelected(e,n);l!=null&&l?r.forEach((u,h)=>r.set(h,!1)):r.forEach((u,h)=>r.set(h,!0))}s(i)}setAllValues(e){const{valueMap:t,onUpdateValueMap:n}=this.props,s=new Map;t.forEach((i,a)=>{if(typeof i=="boolean")s.set(a,e);else{const r=new Map;i.forEach((l,u)=>r.set(u,e)),s.set(a,r)}}),n(s)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){const{valueMap:e,"data-testid":t}=this.props;return c.jsxs("div",{className:"hcm-menu-container",children:[Array.from(e.entries()).map(([n,s])=>c.jsxs("div",{children:[c.jsx(ze,{className:"hcm-parent",checked:Re.isParentSelected(n,e),onChange:()=>this.toggleValueFor(n),children:n}),s!==void 0&&typeof s!="boolean"&&Array.from(s.entries()).map(([i,a])=>c.jsx(ze,{className:"hcm-child",checked:a,onChange:()=>this.toggleValueFor(n,i),children:i},i))]},n)),c.jsx(ee,{kind:"ghost",onClick:this.selectAll,"data-testid":t!==void 0?`${t}-btn-select-all`:void 0,children:"Select All"}),c.jsx(ee,{kind:"ghost",onClick:this.clear,"data-testid":t!==void 0?`${t}-btn-clear`:void 0,children:"Clear"})]})}render(){const{menuText:e,className:t,icon:n,id:s,"data-testid":i}=this.props,{menuIsOpen:a}=this.state;return c.jsxs("button",{type:"button",className:x("btn hcm-btn",t),onClick:this.toggleMenu,id:s,"data-testid":i,children:[c.jsxs("span",{children:[n&&c.jsx(G,{icon:n,className:"hcm-icon mr-1"}),e]}),c.jsx(G,{icon:xn,className:"hcm-icon ml-1"}),c.jsx(Ae,{options:{placement:"bottom"},isShown:a,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}}const Mo=Re;function Kn({on:o,id:e,className:t,isInvalid:n,disabled:s=!1,onClick:i,"data-testid":a}){return c.jsx("button",{type:"button",className:x("btn","btn-switch",t,{active:o},{"is-invalid":n}),id:e,onClick:i,disabled:s,"data-testid":a,children:c.jsx("div",{className:"handle"})})}function rn(o){return o.isOn!==void 0}function Wn({item:o,onSelect:e=()=>{},"data-testid":t}){const{icon:n,subtitle:s,title:i}=o,a=d.useMemo(()=>rn(o)?()=>{o.onChange(!o.isOn)}:e,[o,e]);return c.jsxs("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${i}`,onClick:a,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&a()},tabIndex:0,role:"menuitem",children:[n!==void 0&&c.jsx("div",{className:"icon",children:c.jsx(G,{icon:n})}),c.jsx("div",{className:"title",children:i}),s!==void 0&&c.jsx("div",{className:"shortcut",children:s}),c.jsx("div",{className:"accessory","data-testid":t,children:rn(o)?c.jsx(Kn,{on:o.isOn,onClick:r=>{r.stopPropagation(),a()}}):c.jsx(G,{icon:In})})]})}function yo({items:o,onSelect:e=()=>{},"data-testid":t}){return c.jsx("div",{className:"navigation-menu-view","data-testid":t,children:c.jsx("ul",{className:"navigation-menu-list",children:o.map((n,s)=>c.jsx("li",{children:c.jsx(Wn,{item:n,onSelect:()=>{e(s)}})},n.title))})})}function To({children:o,onBack:e,onClose:t,title:n,"data-testid":s}){return c.jsxs("div",{className:"navigation-page","data-testid":s,children:[c.jsxs("div",{className:"navigation-title-bar",children:[c.jsx("div",{className:"navigation-left-buttons",children:e!==void 0&&c.jsx(ee,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:e,icon:ri,children:"Back"})}),c.jsx("div",{className:"navigation-title",children:n}),c.jsx("div",{className:"navigation-right-buttons",children:t!==void 0&&c.jsx(ee,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:t,icon:wn,tooltip:"Close"})})]}),c.jsx("div",{className:"navigation-content",children:o})]})}function Eo({children:o,"data-testid":e}){const t=d.useMemo(()=>I.Children.toArray(o),[o]),n=Dt(t),[s,i]=d.useState(t[t.length-1]),[a,r]=d.useState(null),[l,u]=d.useState(null);d.useEffect(function(){if(n===void 0||t===n)return;const f=t[t.length-1];t.length===n.length||n.length===0||a!==null||l!==null?a!==null&&f!==a?r(f):f!==l&&f!==s&&i(f):t.length>n.length?r(f):t.length<n.length&&(i(f),u(n[n.length-1]))},[t,n,a,l,s]);const h=d.useCallback(()=>{i(a),r(null)},[a]),p=d.useCallback(()=>{u(null)},[]);return c.jsxs("div",{className:"navigation-stack",children:[c.jsx("div",{className:"main-view","data-testid":e,children:s}),c.jsx(Te,{in:l!=null,timeout:le.transitionMidMs,classNames:"slide-right",onEntered:p,children:c.jsx(c.Fragment,{children:l!=null&&c.jsx("div",{className:"popping-view",children:l})})}),c.jsx(Te,{in:a!=null,timeout:le.transitionMidMs,classNames:"slide-left",onEntered:h,children:c.jsx(c.Fragment,{children:a!=null&&c.jsx("div",{className:"pushing-view",children:a})})})]})}function Io({children:o,disabled:e,value:t,"data-testid":n}){return c.jsx("option",{value:t,disabled:e,"data-testid":n,children:o})}function xo(o){const{children:e,disabled:t=!1,name:n,onChange:s,value:i="","data-testid":a}=o,[r]=d.useState(n??Se());return c.jsx(c.Fragment,{children:I.Children.map(e,l=>l?I.cloneElement(l,{name:r,onChange:l.props.onChange??s,checked:i===l.props.value,disabled:l.props.disabled??t,"data-testid":a}):null)})}const Bt=I.forwardRef((o,e)=>{const{checked:t,children:n,className:s="",disabled:i=!1,inputClassName:a="",isInvalid:r=!1,labelClassName:l="",name:u,onChange:h,value:p,"data-testid":m}=o,[f]=d.useState(Se());return c.jsxs("div",{className:x("custom-control custom-radio",s),children:[c.jsx("input",{type:"radio",id:f,"data-testid":m,name:u,ref:e,className:x("custom-control-input",a,{"is-invalid":r}),checked:t,disabled:i,value:p,onChange:h}),c.jsx("label",{className:x("custom-control-label",l),htmlFor:f,children:n})]})});Bt.displayName="RadioItem";Bt.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const wo=Bt;const No=.025,ko=.9,Do=.1,Oo=.618,ht=le["primary-dark"],ln=80,Ao=le["gray-800"],Fo=le["gray-900"],ve={SIZE:8,DOT_SIZE:2,FILL_OPACITY:.25},he=18,Ro=250,Po=60*1e3,Lo=I.memo(()=>{const o=d.useRef(null),e=d.useRef(null),[t,n]=d.useState(!1),s=window.devicePixelRatio;let i,a,r,l,u,h=null,p=[];function m(){e.current!=null&&(r=e.current.offsetWidth,l=e.current.offsetHeight),o.current!=null&&(o.current.style.width=`${r}px`,o.current.style.height=`${l}px`,o.current.width=r*s,o.current.height=l*s),i?.scale(s,s)}function f(){const j=document.createElement("canvas");j.width=ve.SIZE,j.height=ve.SIZE;const L=j.getContext("2d");return L!=null&&(L.fillStyle=ht,L.fillRect(0,0,ve.DOT_SIZE,ve.DOT_SIZE),L.fillStyle=ht+Math.round(255*ve.FILL_OPACITY).toString(16).padStart(2,"0"),L.fillRect(0,0,ve.SIZE,ve.SIZE)),L?.createPattern(j,"repeat")}function v(j){const L=Math.random()-.5;let H=No*L;return j<Do?H=Math.abs(H):j>ko&&(H=-Math.abs(H)),j+H}function S(){const j=[];let L=Oo;for(let H=0;H<r+he;H+=1)L=v(L),j.push(L);return j}function C(){for(;p.length>=r+he;)p.pop();for(;p.length<r+he;)p.push(v(p[p.length-1]))}function w(j,L){L.beginPath(),L.moveTo(-1,l+1),L.lineTo(-1,l*j[0]);for(let H=0;H<j.length;H+=1)L.lineTo(H,l*j[H]);L.lineTo(r+he,l*j[j.length-1]),L.lineTo(r+he,l+1),L.closePath()}function D(j){j.beginPath();for(let L=1;L<r;L+=ln)j.moveTo(L,0),j.lineTo(L,l);for(let L=1;L<l;L+=ln)j.moveTo(0,L),j.lineTo(r,L)}function M(j){h=h??j,Ei(i),i.fillStyle=Fo,i.fillRect(0,0,r,l),D(i),i.lineWidth=1,i.strokeStyle=Ao,i.stroke();const L=((h??0)-(j??0))/(1e3/he);if(i.translate(L,0),w(p,i),i.lineWidth=2,i.strokeStyle=ht,i.stroke(),i.translate(-L,0),a!=null&&(i.fillStyle=a),i.fill(),i.setTransform(s,0,0,s,0,0),(j??0)-(h??0)>1e3/he){const H=Math.floor(((j??0)-(h??0))/(1e3/he));for(let N=0;N<H;N+=1)p.shift(),p.push(v(p[p.length-1]));h=j}u!=null&&cancelAnimationFrame(u),u=requestAnimationFrame(M)}const A=Pe(()=>{u=requestAnimationFrame(j=>{m(),C(),n(!1),M(j)})},Ro,{leading:!0});function R(){n(!0),u!=null&&cancelAnimationFrame(u),u=null,h=null}const O=Pe(()=>{R()},Po);function P(){u==null&&(n(!1),m(),C(),u=requestAnimationFrame(M)),O()}function K(){document.hasFocus()&&P()}function oe(){u!=null&&cancelAnimationFrame(u),O(),A()}return d.useEffect(()=>(i=o.current?.getContext("2d",{alpha:!1}),m(),p=S(),a=f(),M(),O(),window.addEventListener("resize",oe),window.addEventListener("focus",P),window.addEventListener("blur",R),window.addEventListener("mousemove",K),window.addEventListener("keydown",K),()=>{u!=null&&cancelAnimationFrame(u),window.removeEventListener("resize",oe),window.removeEventListener("focus",P),window.removeEventListener("blur",R),window.removeEventListener("mousemove",K),window.removeEventListener("keydown",K),O.cancel(),A.cancel()}),[]),c.jsx("div",{className:"random-area-plot-animation-container",ref:e,children:c.jsx("canvas",{ref:o,className:t?"shade":""})})}),qn=Lo;function jo({children:o,onBlur:e,onChange:t,className:n,defaultValue:s,name:i,value:a,disabled:r,"data-testid":l}){const u=d.useCallback(h=>{t(h.target.value)},[t]);return c.jsx("select",{className:x("custom-select",n),onBlur:e,onChange:u,defaultValue:s,value:a,name:i,disabled:r,"data-testid":l,children:o})}class $o extends d.PureComponent{static defaultProps={disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0};constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleSelect=this.handleSelect.bind(this),this.list=I.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}list;topRow;bottomRow;getCachedItem=Y((e,t,n,s,i,a,r)=>{const l={height:i},u=s??n;return c.jsx("li",{className:"value-list-item",style:l,tabIndex:-1,children:c.jsx(ze,{checked:a,disabled:r,onChange:()=>this.handleSelect(e),children:u})},t)},{max:1e3});getCachedItems=Y((e,t,n,s)=>{const i=[];for(let a=0;a<e.length;a+=1){const r=e[a],{value:l,displayValue:u,isSelected:h}=r,p=n+a,m=p,f=this.getCachedItem(p,m,l,u,t,h,s);i.push(f)}return i},{max:1});handleBlur(e){if(!e.relatedTarget||this.list.current&&e.relatedTarget instanceof HTMLElement&&!this.list.current.contains(e.relatedTarget)){const{onBlur:t}=this.props;t?.(e)}}handleScroll(){this.sendViewportUpdate()}handleSelect(e){const{items:t,offset:n,onSelect:s}=this.props,i=e-n;if(i>=0&&i<t.length){const a=t[i],{value:r}=a;s(e,r)}else s(e,null)}sendViewportUpdate(){if(!this.list.current||this.list.current.clientHeight===0)return;const{onViewportChange:e,rowHeight:t}=this.props,n=this.list.current.scrollTop,s=n+this.list.current.clientHeight,i=Math.floor(n/t),a=Math.ceil(s/t);(this.topRow!==i||this.bottomRow!==a)&&(this.topRow=i,this.bottomRow=a,e(i,a))}getElement(e){return this.list.current==null?null:this.list.current.querySelectorAll(".value-list-item")[e]}scrollIntoView(e){this.getElement(e)?.scrollIntoView({block:"center"})}render(){const{className:e,disabled:t,isInvalid:n,items:s,itemCount:i,offset:a,rowHeight:r,"data-testid":l}=this.props,u=this.getCachedItems(s,r,a,t);return c.jsx("div",{className:x("select-value-list-scroll-pane h-100 w-100",{"is-invalid":n},e),onBlur:this.handleBlur,onScroll:this.handleScroll,ref:this.list,"data-testid":l,children:c.jsx("div",{className:"select-value-list",style:{height:i*r},children:c.jsx("ol",{className:"select-value-list-content",style:{position:"absolute",height:s.length*r,top:a*r,left:0},children:u})})})}}const Gn=$o,cn=V.module("Shortcut");var J=(o=>(o.CTRL="MODIFIER_CTRL",o.CMD="MODIFIER_CMD",o.ALT="MODIFIER_ALT",o.OPTION="MODIFIER_OPTION",o.SHIFT="MODIFIER_SHIFT",o))(J||{}),z=(o=>(o.A="A",o.B="B",o.C="C",o.D="D",o.E="E",o.F="F",o.G="G",o.H="H",o.I="I",o.J="J",o.K="K",o.L="L",o.M="M",o.N="N",o.O="O",o.P="P",o.Q="Q",o.R="R",o.S="S",o.T="T",o.U="U",o.V="V",o.W="W",o.X="X",o.Y="Y",o.Z="Z",o.ZERO="0",o.ONE="1",o.TWO="2",o.THREE="3",o.FOUR="4",o.FIVE="5",o.SIX="6",o.SEVEN="7",o.EIGHT="8",o.NINE="9",o.BACKSPACE="Backspace",o.ESCAPE="Escape",o.ENTER="Enter",o.DELETE="Delete",o.SLASH="/",o.QUESTION_MARK="?",o.BACKSLASH="\\",o.PIPE="|",o.MINUS="-",o.UNDERSCORE="_",o.EQUALS="=",o.PLUS="+",o.BACKTICK="`",o.TILDE="~",o.COMMA=",",o.LEFT_CHEVRON="<",o.PERIOD=".",o.RIGHT_CHEVRON=">",o.SEMICOLON=";",o.COLON=":",o.SINGLE_QUOTE="'",o.DOUBLE_QUOTE='"',o.LEFT_BRACKET="[",o.RIGHT_BRACKET="]",o.LEFT_CURLY="{",o.RIGHT_CURLY="}",o.F1="F1",o.F2="F2",o.F3="F3",o.F4="F4",o.F5="F5",o.F6="F6",o.F7="F7",o.F8="F8",o.F9="F9",o.F10="F10",o.F11="F11",o.F12="F12",o))(z||{});const Vo=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]);class U extends yn{id;name;tooltip;isEditable;defaultKeyState;keyState;static NULL_KEY_STATE={metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null};static isAllowedKey(e){return Object.values(z).includes(e)}static isValidKeyState(e){const{keyValue:t}=e;return t===null?!0:!U.isMacPlatform&&e.metaKey||!U.isAllowedKey(t)?!1:!(!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey)||Vo.has(t)}static isMacPlatform=_.isMacPlatform();static createKeyState(e){const t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(n=>{switch(n){case"MODIFIER_CTRL":t.ctrlKey=!0;break;case"MODIFIER_ALT":case"MODIFIER_OPTION":t.altKey=!0;break;case"MODIFIER_CMD":t.metaKey=!0;break;case"MODIFIER_SHIFT":t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){const{key:t,keyCode:n}=e;let s="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?s="":!U.isAllowedKey(t)&&U.isAllowedKey(String.fromCharCode(n))?s=String.fromCharCode(n):s=t,{keyValue:s,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){let t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue==="Escape"?t+="Esc":e.keyValue!==null&&(t+=e.keyValue),t}static getMacDisplayText(e){let t="";switch(e.ctrlKey&&(t+="⌃"),e.altKey&&(t+="⌥"),e.shiftKey&&(t+="⇧"),e.metaKey&&(t+="⌘"),e.keyValue){case"Enter":t+="⏎";break;case"Escape":t+="⎋";break;case"Backspace":t+="⌫";break;case"Delete":t+="⌦";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){return e.keyValue?.toUpperCase()===t.keyValue?.toUpperCase()&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":U.isMacPlatform?U.getMacDisplayText(e):U.getWindowsDisplayText(e)}constructor({id:e,shortcut:t,macShortcut:n,isEditable:s=!0,name:i,tooltip:a}){super(),this.id=e,this.name=i,this.tooltip=a,this.isEditable=s;const l=U.isMacPlatform?n:t;this.defaultKeyState=U.createKeyState(l),this.keyState=this.defaultKeyState}getDisplayText(){return U.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){U.isValidKeyState(e)?(cn.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(e)}`),this.keyState=e,this.dispatchEvent(new Dn("onUpdate",{detail:this}))):cn.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(e)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return U.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(U.NULL_KEY_STATE)}isNull(){return U.doKeyStatesMatch(this.keyState,U.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return U.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(U.getKeyStateFromEvent(e))}}const un=V.module("ShortcutRegistry");class Bo extends yn{shortcutMap=new Map;shortcutsByCategory=new Map;createAndAdd(e){const t=new U(e);return this.add(t)}add(e){const t=this.shortcutMap.get(e.id);if(t)return un.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${e.id}`),t;un.debug2(`Adding shortcut to registry: ${e.id}`),e.addEventListener("onUpdate",({detail:s})=>this.dispatchEvent(new Dn("onUpdate",{detail:s})));const n=e.id.split(".")[0];return this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(n)?this.shortcutsByCategory.get(n)?.push(e):this.shortcutsByCategory.set(n,[e]),e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(t=>!t.isNull()&&t.matchesKeyState(e))}}const Ho=Object.freeze(new Bo),Me=Ho,_o={COPY:Me.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[J.CTRL,z.C],macShortcut:[J.CMD,z.C],isEditable:!1}),PASTE:Me.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[J.CTRL,z.V],macShortcut:[J.CMD,z.V],isEditable:!1}),SAVE:Me.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[J.CTRL,z.S],macShortcut:[J.CMD,z.S],isEditable:!1}),SELECT_ALL:Me.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[J.CTRL,z.A],macShortcut:[J.CMD,z.A],isEditable:!1}),LINKER:Me.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[J.CTRL,z.L],macShortcut:[J.CMD,z.L]}),LINKER_CLOSE:Me.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[z.ESCAPE],macShortcut:[z.ESCAPE],isEditable:!1})},Uo=_o;const Ht=I.forwardRef((o,e)=>{const{children:t,className:n,disabled:s,id:i,isLinked:a,isLinkedSource:r,isInvalid:l,onClick:u,onMouseEnter:h,onMouseLeave:p,style:m,"data-testid":f}=o;return c.jsxs("button",{ref:e,type:"button",className:x("btn-socketed",{"btn-socketed-linked":a!==void 0&&a||r},{"btn-socketed-linked-source":r},{"is-invalid":l},n),id:i,onClick:u,onMouseEnter:h,onMouseLeave:p,style:m,disabled:s,"data-testid":f,children:[t,c.jsx(G,{icon:li,className:"linked btn-socketed-icon",transform:"down-1"}),c.jsx(G,{icon:ci,className:"is-invalid btn-socketed-icon"})]})});Ht.displayName="SocketedButton";Ht.defaultProps={children:void 0,className:"",disabled:!1,id:void 0,isLinked:!1,isLinkedSource:!1,isInvalid:!1,onClick:void 0,onMouseEnter:void 0,onMouseLeave:void 0,style:void 0,"data-testid":void 0};const Ko=Ht,Wo={"dh-spectrum-theme--dark":"_dh-spectrum-theme--dark_i6xja_5"},qo={"dh-spectrum-theme--light":"_dh-spectrum-theme--light_16vb7_5"},{global:Go,light:zo,dark:Zo,medium:Xo,large:Qo}=Us,Jo={global:Go,light:{...zo,...qo},dark:{...Zo,...Wo},medium:Xo,large:Qo},Yo="_track_535ju_30",ea="_handle_535ju_13",ta="_ticks_535ju_98",zn={"handle-size":"15px","popover-width":"90px","time-slider":"_time-slider_535ju_3","time-slider-popovers":"_time-slider-popovers_535ju_8","handle-popper":"_handle-popper_535ju_13","flex-spacer":"_flex-spacer_535ju_26",track:Yo,"track-fills":"_track-fills_535ju_37","track-fill":"_track-fill_535ju_37","track-fill-start":"_track-fill-start_535ju_55","track-fill-middle":"_track-fill-middle_535ju_56","track-fill-end":"_track-fill-end_535ju_59","handle-track":"_handle-track_535ju_62",handle:ea,ticks:ta,"tick-labels":"_tick-labels_535ju_116","tick-label":"_tick-label_535ju_116","tick-label-wrapper":"_tick-label-wrapper_535ju_132"};const Ue=parseInt(zn["handle-size"],10),dn=parseInt(zn["popover-width"],10),Q=24*60*60-1,hn=5*60;function na({startTime:o,endTime:e,onChange:t,isStartModified:n=!1,isEndModified:s=!1,"data-testid":i}){const[a,r]=d.useState(o),[l,u]=d.useState(e),h=d.useRef(null);d.useEffect(function(){r(o),u(e)},[o,e]);const p=d.useCallback((v,S)=>{let C=v,w=S;C===w&&(w<Q?w+=1:C-=1),r(C),u(w),t({startTime:C,endTime:w})},[r,u,t]),m=d.useCallback(v=>{p(v,l)},[p,l]),f=d.useCallback(v=>{p(a,v)},[p,a]);return c.jsxs("div",{className:"time-slider","data-testid":i,children:[c.jsx(sa,{startTime:a,endTime:l,onStartTimeChange:m,onEndTimeChange:f,isStartModified:n,isEndModified:s}),c.jsxs("div",{className:"track",ref:h,children:[c.jsx(ia,{startTime:a,endTime:l}),c.jsx("div",{className:"ticks",children:Array(24).fill(null).map((v,S)=>c.jsx("div",{className:"tick"},S))}),c.jsx(pn,{track:h,time:a,setTime:m}),c.jsx(pn,{track:h,time:l,setTime:f})]}),c.jsxs("div",{className:"tick-labels",children:[c.jsx("div",{className:"tick-label",children:"0:00"}),c.jsx("div",{className:"tick-label-wrapper",children:Array(24).fill(null).map((v,S)=>c.jsx("div",{className:"tick-label",children:`${S+1}:00`},S))})]})]})}function sa(o){const{startTime:e,endTime:t,onStartTimeChange:n,onEndTimeChange:s,isStartModified:i,isEndModified:a,"data-testid":r}=o,l=e>t,[u,h]=d.useState(l?t:e),[p,m]=d.useState(l?e:t),f=d.useRef(null),v=d.useRef(null),S=d.useRef(null),C=d.useRef(null);d.useEffect(function(){h(e>t?t:e),m(e>t?e:t)},[e,t]),d.useEffect(function(){S.current!==null&&v.current?.setSelection(S.current),C.current!==null&&f.current?.setSelection(C.current)},[l]);function w(R){e<=t?n(R):s(R)}function D(R){e<=t?s(R):n(R)}const M=d.useCallback(R=>{S.current=R,C.current=null},[]),A=d.useCallback(R=>{S.current=null,C.current=R},[]);return c.jsxs("div",{className:"time-slider-popovers",children:[c.jsx("div",{className:"flex",style:{flexBasis:`calc(${u/Q*100}% - ${dn/2}px)`}}),c.jsxs("div",{className:"handle-popper",children:[c.jsx("label",{className:x({modified:l?a:i}),children:l?"End Time":"Start Time"}),c.jsx(Ze,{ref:f,allowValueWrapping:!1,value:u,onChange:w,onSelect:M,"data-testid":r!==void 0?`${r}-input-1`:void 0})]}),c.jsx("div",{className:"flex-spacer"}),c.jsxs("div",{className:"handle-popper",children:[c.jsx("label",{className:x({modified:l?i:a}),children:l?"Start Time":"End Time"}),c.jsx(Ze,{ref:v,allowValueWrapping:!1,value:p,onChange:D,onSelect:A,"data-testid":r!==void 0?`${r}-input-2`:void 0})]}),c.jsx("div",{className:"flex",style:{flexBasis:`calc(${(Q-p)/Q*100}% - ${dn/2}px)`}})]})}function ia(o){const{startTime:e,endTime:t,"data-testid":n}=o;return c.jsxs("div",{className:"track-fills","data-testid":n,children:[e>t&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"track-fill track-fill-start",style:{transform:`scaleX(${t/Q})`}}),c.jsx("div",{className:"track-fill track-fill-end",style:{transform:`scaleX(${(Q-e)/Q})`}})]}),e<t&&c.jsx("div",{className:"track-fill track-fill-middle",style:{transform:`translateX(${e/Q*100}%) scaleX(${(t-e)/Q})`}})]})}function pn(o){const{track:e,time:t,setTime:n,"data-testid":s}=o,i=d.useMemo(()=>{let f=Ue/2;return t<3600?f=t/3600*(Ue/2):t>23*3600&&(f=Ue/2+1/(Q-23*3600)*(t-23*3600)*(Ue/2)),`translateX(calc(${t/Q*100}% - ${f}px))`},[t]),a=d.useCallback(m=>{if(!e.current)return 0;const f=e.current.getBoundingClientRect(),v=Math.max(m-f.left,0),S=Q*Math.min(1,v/f.width),C=hn*Math.round(S/hn);return Math.min(Q,C)},[e]),r=d.useCallback(({clientX:m})=>{n(a(m))},[n,a]),l=d.useCallback(({clientX:m})=>{n(a(m)),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",l),document.documentElement.classList.remove("drag-pointer-events-none")},[n,a,r]),u=d.useCallback(()=>{window.addEventListener("mousemove",r),window.addEventListener("mouseup",l),document.documentElement.classList.add("drag-pointer-events-none")},[r,l]),h=d.useCallback(()=>{window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",l),document.documentElement.classList.remove("drag-pointer-events-none")},[r,l]),p=d.useCallback(()=>{u()},[u]);return d.useEffect(function(){return()=>{h()}},[h]),c.jsx("div",{className:"handle-track",style:{transform:i},children:c.jsx("button",{className:"handle",type:"button","aria-label":"Change time",onMouseDown:p,"data-testid":s})})}function Zn({buttons:o,isShown:e=!1,classNames:t,message:n,type:s,onClick:i,onDismiss:a,"data-testid":r}){const l=o&&o.length!==0;return c.jsx(Te,{in:e,timeout:le.transitionMs,classNames:"toast-notification-slide-up",mountOnEnter:!0,unmountOnExit:!0,children:c.jsxs("div",{className:x("toast-notification",t,s),role:"presentation",onClick:i,onKeyPress:i,"data-testid":r,children:[c.jsx("div",{className:"message-container",children:c.jsx("span",{className:"message",children:n})}),c.jsx(Te,{in:l,timeout:le.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:c.jsx("div",{className:"buttons-container",children:o})}),a&&c.jsx(ee,{kind:"ghost",icon:wn,tooltip:"Close notification",className:"my-2",onClick:a})]})})}Zn.TYPE=Object.freeze({ERROR:"error"});function oa(o){const{children:e,className:t,labelText:n,hintText:s,isModified:i,validationError:a,showValidationError:r=!0,"data-testid":l,id:u}=o,{current:h}=d.useRef(u??Se());return c.jsxs(c.Fragment,{children:[c.jsx("label",{className:x("validate-label",t,{modified:i}),htmlFor:h,"data-testid":l,children:n}),I.Children.toArray(e).map(p=>I.isValidElement(p)?I.cloneElement(p,{className:x(p.props.className,{"is-invalid":a})}):c.jsx("div",{className:x(t),children:p})),s!==void 0&&c.jsx("small",{className:"form-text text-muted",children:s}),a!==void 0&&r&&c.jsx("p",{className:"validate-label-error text-danger",children:a})]})}const aa=Object.freeze(Object.defineProperty({__proto__:null,AutoCompleteInput:fi,AutoResizeTextarea:kt,BasicModal:Rt,Button:ee,ButtonGroup:$e,ButtonOld:Ri,CardFlip:Pi,Checkbox:ze,Collapse:Wi,ComboBox:Gi,ContextActionUtils:_,ContextActions:Hi,ContextMenuItem:Lt,ContextMenuRoot:Ki,CopyButton:zi,CustomTimeSelect:to,DEFAULT_GET_PREFERRED_REPLACEMENT_STRING:st,DateInput:mo,DateTimeInput:lo,DebouncedModal:Ai,DebouncedSearchInput:go,DragUtils:So,DraggableItemList:Co,DropdownMenu:Vn,EditableItemList:vo,GLOBAL_SHORTCUTS:Uo,HierarchicalCheckboxMenu:Mo,InfoModal:Fi,ItemList:ie,ItemListItem:Un,KEY:z,LoadingOverlay:je,LoadingSpinner:wt,MODIFIER:J,MaskedInput:it,Menu:yo,MenuItem:Wn,Modal:It,ModalBody:xt,ModalFooter:Rn,ModalHeader:En,Option:Io,Page:To,Popper:Ae,RadioGroup:xo,RadioItem:wo,RandomAreaPlotAnimation:qn,SearchInput:nt,Select:jo,SelectValueList:Gn,Shortcut:U,ShortcutRegistry:Me,SocketedButton:Ko,Stack:Eo,ThemeExport:le,TimeInput:Ze,TimeSlider:na,ToastNotification:Zn,Tooltip:Nt,UISwitch:Kn,ValidateLabelInput:oa,fillToLength:Ln,themeDHDefault:Jo,trimTrailingMask:Ct},Symbol.toStringTag,{value:"Module"}));function Ee(){return Ve(Nn,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function ra(o,e){const t=Ee(),n=d.useMemo(()=>new t.CoreClient(o,e),[t,o,e]);return d.useEffect(()=>()=>{n.disconnect()},[n]),n}const _t=d.createContext(null);function la({serverUrl:o,options:e,children:t}){const n=ra(o,e);return c.jsx(_t.Provider,{value:n,children:t})}function Be(){return Ve(_t,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}const ca=Object.freeze(Object.defineProperty({__proto__:null,ApiBootstrap:ui,ApiContext:Nn,ClientBootstrap:la,ClientContext:_t,useApi:Ee,useClient:Be},Symbol.toStringTag,{value:"Module"})),{dh:ua}=globalThis,Ce=ua,Xn=1e4;function da(o,e,t=Xn){return new Promise((n,s)=>{let i;const a=setTimeout(()=>{i?.(),s(new Ye(`Variable ${e} not found`))},t);function r(l){const u=l.created.find(h=>h.title===e);u!=null&&(clearTimeout(a),i?.(),n(u))}i=o.subscribeToFieldUpdates(r)})}class ha{static TYPE_GLOBAL="type-global";static TYPE_CONTEXT_PRESET="type-context-preset";static TYPE_CONTEXT_CUSTOM="type-context-custom";static isValid(e){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,n){return{label:e,formatString:t,type:n}}format(e,t){return""}}const q=ha;class pa extends q{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}const Qn=pa;class ma extends q{format(e){return String.fromCharCode(e)}}const Jn=ma,mn=V.module("DateTimeColumnFormatter");class de extends q{static isValid(e){try{return Ce.i18n.DateTimeFormat.format(e.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t,n=q.TYPE_CONTEXT_PRESET){return{label:e,formatString:t,type:n}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static DEFAULT_DATETIME_FORMAT_STRING="yyyy-MM-dd HH:mm:ss.SSS";static DEFAULT_TIME_ZONE_ID="America/New_York";static makeGlobalFormatStringMap(e,t){const n=t?"'T'":" ",s=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${n}HH:mm:ss${s}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${n}HH:mm:ss.SSS${s}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${n}HH:mm:ss.SSSSSSSSS${s}`]])}static getGlobalFormats(e,t){return[...de.makeGlobalFormatStringMap(e,t).keys()]}static makeFormatStringMap(e,t){const n=t!==void 0&&t?"'T'":" ",s=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd",`yyyy-MM-dd${s}`],["MM-dd-yyyy",`MM-dd-yyyy${s}`],["HH:mm:ss",`HH:mm:ss${s}`],["HH:mm:ss.SSS",`HH:mm:ss.SSS${s}`],["HH:mm:ss.SSSSSSSSS",`HH:mm:ss.SSSSSSSSS${s}`],["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${n}HH:mm:ss${s}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${n}HH:mm:ss.SSS${s}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${n}HH:mm:ss.SSSSSSSSS${s}`]])}static getFormats(e,t){return[...de.makeFormatStringMap(e,t).keys()]}dhTimeZone;defaultDateTimeFormatString;showTimeZone;showTSeparator;formatStringMap;constructor({timeZone:e="",showTimeZone:t=!0,showTSeparator:n=!1,defaultDateTimeFormatString:s=de.DEFAULT_DATETIME_FORMAT_STRING}={}){super();const i=e||de.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=Ce.i18n.TimeZone.getTimeZone(i)}catch{mn.error("Unsupported time zone id",i),this.dhTimeZone=Ce.i18n.TimeZone.getTimeZone(de.DEFAULT_TIME_ZONE_ID)}this.defaultDateTimeFormatString=s,this.showTimeZone=t,this.showTSeparator=n,this.formatStringMap=de.makeFormatStringMap(t,n)}getEffectiveFormatString(e){return this.formatStringMap.get(e)??e}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,s=this.getEffectiveFormatString(n);try{return Ce.i18n.DateTimeFormat.format(s,e,this.dhTimeZone)}catch{mn.error("Invalid format arguments")}return""}}const fa=V.module("DecimalColumnFormatter");class X extends q{static isValid(e){try{return Ce.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,n=q.TYPE_CONTEXT_PRESET,s){return{label:e,type:n,formatString:t,multiplier:s}}static makePresetFormat(e,t="",n){return X.makeFormat(e,t,q.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(e="",t){return X.makeFormat("Custom Format",e,q.TYPE_CONTEXT_CUSTOM,t)}static DEFAULT_FORMAT_STRING="###,##0.0000";static FORMAT_PERCENT=X.makePresetFormat("Percent","##0.00%");static FORMAT_BASIS_POINTS=X.makePresetFormat("Basis Points","###,##0 bp",1e4);static FORMAT_MILLIONS=X.makePresetFormat("Millions","###,##0.000 mm",1e-6);static FORMAT_SCIENTIFIC_NOTATION=X.makePresetFormat("Scientific Notation","0.0000E0");static FORMAT_ROUND=X.makePresetFormat("Round","###,##0");static FORMAT_ROUND_TWO_DECIMALS=X.makePresetFormat("0.00","###,##0.00");static FORMAT_ROUND_FOUR_DECIMALS=X.makePresetFormat("0.0000","###,##0.0000");static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}defaultFormatString;constructor({defaultFormatString:e=X.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=e}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return Ce.i18n.NumberFormat.format(n,s)}catch{fa.error("Invalid format arguments")}return""}}class ga extends q{format(e){return`${e}`}}const Yn=ga,ba=V.module("IntegerColumnFormatter");class ge extends q{static isValid(e){try{return Ce.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,n=q.TYPE_CONTEXT_PRESET,s){return{label:e,type:n,formatString:t,multiplier:s}}static makePresetFormat(e,t="",n){return ge.makeFormat(e,t,q.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(e="",t){return ge.makeFormat("Custom Format",e,q.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}static DEFAULT_FORMAT_STRING="###,##0";static FORMAT_MILLIONS=ge.makePresetFormat("Millions","###,##0.000 mm",1e-6);static FORMAT_SCIENTIFIC_NOTATION=ge.makePresetFormat("Scientific Notation","0.0000E0");defaultFormatString;constructor({defaultFormatString:e=ge.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=e}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return Ce.i18n.NumberFormat.format(n,s)}catch{ba.error("Invalid format arguments")}return""}}class es extends q{format(e){return e}}class W{static FULL_DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSSSSS";static months=["january","february","march","april","may","june","july","august","september","october","november","december"];static makeDateWrapper(e,t,n,s=0,i=1,a=0,r=0,l=0,u=0){if(!t)throw new Error("No timezone provided");const h=`${n}`.padStart(4,"0"),p=`${s+1}`.padStart(2,"0"),m=`${i}`.padStart(2,"0"),f=`${a}`.padStart(2,"0"),v=`${r}`.padStart(2,"0"),S=`${l}`.padStart(2,"0"),C=`${u}`.padStart(9,"0"),w=`${h}-${p}-${m} ${f}:${v}:${S}.${C}`;return e.i18n.DateTimeFormat.parse(W.FULL_DATE_FORMAT,w,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){const t=parseInt(e,10),n="0".repeat(9-e.length),s=`${t+1}${n}`;return parseInt(s,10)}static getNextDate(e,t,n,s){let{year:i,month:a,date:r,hours:l,minutes:u,seconds:h,nanos:p}=n;if(t.nanos!=null){if(t.nanos.length===9)return null;p=W.getNextNanos(t.nanos),p>999999999&&(h+=1,p=0)}else t.seconds!=null?h+=1:t.minutes!=null?u+=1:t.hours!=null?l+=1:t.date!=null?r+=1:t.month!=null?a+=1:i+=1;const m=new Date(i,a,r,l,u,h);return W.makeDateWrapper(e,s,m.getFullYear(),m.getMonth(),m.getDate(),m.getHours(),m.getMinutes(),m.getSeconds(),p)}static parseMonth(e){const t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;const n=e.trim().toLowerCase();if(n.length>=3){for(let s=0;s<W.months.length;s+=1)if(W.months[s].startsWith(n))return s}return NaN}static parseDateValues(e,t,n,s,i,a,r){const l=parseInt(e,10),u=t!=null?this.parseMonth(t):0,h=n!=null?parseInt(n,10):1,p=s!=null?parseInt(s,10):0,m=i!=null?parseInt(i,10):0,f=a!=null?parseInt(a,10):0,v=r!=null?parseInt(r.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(u)||Number.isNaN(h)||Number.isNaN(p)||Number.isNaN(m)||Number.isNaN(f)||Number.isNaN(v)?null:{year:l,month:u,date:h,hours:p,minutes:m,seconds:f,nanos:v}}static parseDateTimeString(e){const n=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/.exec(e);if(n==null)throw new Error(`Unexpected date string: ${e}`);const[,s,,i,,a,,r,,l,,u,,h,p]=n;if(p!=null&&p.length>0)throw new Error(`Unexpected characters after date string '${e}': ${p}`);return{year:s,month:i,date:a,hours:r,minutes:l,seconds:u,nanos:h}}static parseDateRange(e,t,n){const s=t.trim().toLowerCase();if(s.length===0)throw new Error("Cannot parse date range from empty string");if(s==="null")return[null,null];if(s==="today"){const u=new Date(Date.now()),h=W.makeDateWrapper(e,n,u.getFullYear(),u.getMonth(),u.getDate()),p=W.makeDateWrapper(e,n,u.getFullYear(),u.getMonth(),u.getDate()+1);return[h,p]}if(s==="yesterday"){const u=new Date(Date.now()),h=W.makeDateWrapper(e,n,u.getFullYear(),u.getMonth(),u.getDate()-1),p=W.makeDateWrapper(e,n,u.getFullYear(),u.getMonth(),u.getDate());return[h,p]}if(s==="now"){const u=new Date(Date.now());return[e.DateWrapper.ofJsDate(u),null]}const i=W.parseDateTimeString(s);if(i.year==null&&i.month==null&&i.date==null)throw new Error(`Unable to extract year, month, or day ${s}`);const a=W.parseDateValues(i.year,i.month,i.date,i.hours,i.minutes,i.seconds,i.nanos);if(a==null)throw new Error(`Unable to extract date values from ${i}`);const r=W.makeDateWrapper(e,n,a.year,a.month,a.date,a.hours,a.minutes,a.seconds,a.nanos),l=W.getNextDate(e,i,a,n);return[r,l]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}}class fn{static not="not";static and="and";static or="or"}function wr(o){if(!(o==="not"||o==="and"||o==="or"))throw new Error("operator is not a valid FilterOperatorValue")}class T{static eq="eq";static eqIgnoreCase="eqIgnoreCase";static notEq="notEq";static notEqIgnoreCase="notEqIgnoreCase";static greaterThan="greaterThan";static greaterThanOrEqualTo="greaterThanOrEqualTo";static lessThan="lessThan";static lessThanOrEqualTo="lessThanOrEqualTo";static in="in";static inIgnoreCase="inIgnoreCase";static notIn="notIn";static notInIgnoreCase="notInIgnoreCase";static isTrue="isTrue";static isFalse="isFalse";static isNull="isNull";static invoke="invoke";static contains="contains";static notContains="notContains";static startsWith="startsWith";static endsWith="endsWith";static containsAny="containsAny"}const ce=V.module("TableUtils");class b{static dataType={BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"};static sortDirection={ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null};static APPLY_TABLE_CHANGE_TIMEOUT_MS=3e4;static REVERSE_TYPE=Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"});static NUMBER_REGEX=/^-?\d+(\.\d+)?$/;static executeAndWaitForEvent=async(e,t,n,s=b.APPLY_TABLE_CHANGE_TIMEOUT_MS)=>{if(t==null)return null;const i=b.makeCancelableTableEventPromise(t,n,s);return e(t),await i,t};static async applyCustomColumns(e,t,n=b.APPLY_TABLE_CHANGE_TIMEOUT_MS){return b.executeAndWaitForEvent(s=>s?.applyCustomColumns(t),e,dh.Table.EVENT_CUSTOMCOLUMNSCHANGED,n)}static async applyFilter(e,t,n=b.APPLY_TABLE_CHANGE_TIMEOUT_MS){return b.executeAndWaitForEvent(s=>s?.applyFilter(t),e,dh.Table.EVENT_FILTERCHANGED,n)}static async applyNeverFilter(e,t,n=b.APPLY_TABLE_CHANGE_TIMEOUT_MS){if(e==null)return null;const s=e.findColumn(t),i=[b.makeNeverFilter(s)];return await b.applyFilter(e,i,n),e}static async applySort(e,t,n=b.APPLY_TABLE_CHANGE_TIMEOUT_MS){return b.executeAndWaitForEvent(s=>s?.applySort(t),e,dh.Table.EVENT_SORTCHANGED,n)}static getSortIndex(e,t){for(let n=0;n<e.length;n+=1)if(e[n].column?.name===t)return n;return null}static getSortForColumn(e,t){const n=b.getSortIndex(e,t);return n!=null?e[n]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return b.isBooleanType(e)?[T.isTrue,T.isFalse,T.isNull]:b.isCharType(e)||b.isNumberType(e)||b.isDateType(e)?[T.eq,T.notEq,T.greaterThan,T.greaterThanOrEqualTo,T.lessThan,T.lessThanOrEqualTo]:b.isTextType(e)?[T.eq,T.eqIgnoreCase,T.notEq,T.notEqIgnoreCase,T.contains,T.notContains,T.startsWith,T.endsWith]:[]}static getNextSort(e,t,n){if(n<0||n>=e.length)return null;const s=b.getSortForColumn(t,e[n].name);return s===null?e[n].sort().asc():s.direction===b.sortDirection.ascending?s.desc():null}static makeColumnSort(e,t,n,s){if(t<0||t>=e.length||n===b.sortDirection.none)return null;let i=e[t].sort();switch(n){case b.sortDirection.ascending:i=i.asc();break;case b.sortDirection.descending:i=i.desc();break}return s&&(i=i.abs()),i}static toggleSortForColumn(e,t,n,s=!1){if(n<0||n>=t.length)return[];const i=b.getNextSort(t,e,n);return b.setSortForColumn(e,t[n].name,i,s)}static sortColumn(e,t,n,s,i,a){if(n<0||n>=t.length)return[];const r=b.makeColumnSort(t,n,s,i);return b.setSortForColumn(e,t[n].name,r,a)}static setSortForColumn(e,t,n,s=!1){const i=b.getSortIndex(e,t);let a=[];return s&&(a=a.concat(e.filter(({direction:r})=>r!==b.sortDirection.reverse)),i!==null&&a.splice(i,1)),n!==null&&a.push(n),a}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case b.dataType.BOOLEAN:return b.dataType.BOOLEAN;case"char":case"java.lang.Character":case b.dataType.CHAR:return b.dataType.CHAR;case"java.lang.String":case b.dataType.STRING:return b.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case b.dataType.DATETIME:return b.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case b.dataType.DECIMAL:return b.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case b.dataType.INT:return b.dataType.INT;default:return b.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return b.isIntegerType(e)||b.isDecimalType(e)}static isIntegerType(e){switch(e){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return b.getNormalizedType(e)===b.getNormalizedType(t)}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:`"${e}"`}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeRangeFilterWithOperation(e,t,n){switch(t){case"=":return e.eq(n);case"<":return e.lessThan(n);case"<=":case"=<":return e.lessThanOrEqualTo(n);case">":return e.greaterThan(n);case">=":case"=>":return e.greaterThanOrEqualTo(n);case"!=":case"!":return e.notEq(n);default:return null}}static makeCancelableTablePromise(e){return Le.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t,n=0,s=null){let i,a,r=!0;const l=new Promise((u,h)=>{a=setTimeout(()=>{i(),r=!1,h(new Ye(`Event "${t}" timed out.`))},n),i=e.addEventListener(t,p=>{if(s!=null&&!s(p)){ce.debug2("Event triggered, but matcher returned false.");return}ce.debug2("Event triggered, resolving."),i(),clearTimeout(a),r=!1,u(p)})});return l.cancel=()=>{if(r){ce.debug2("Pending promise cleanup."),i(),clearTimeout(a),r=!1;return}ce.debug2("Ignoring non-pending promise cancel.")},l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e,t=!1){if(e===""&&t)return null;switch(e?.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error(`Invalid boolean '${e}'`)}}static makeNumberValue(e){if(e==="null"||e==="")return null;const t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;const n=b.removeCommas(t);if(b.NUMBER_REGEX.test(n))return parseFloat(n);throw new Error(`Invalid number '${e}'`)}static getFilterOperatorString(e){switch(e){case T.eq:return"=";case T.notEq:return"!=";case T.greaterThan:return">";case T.greaterThanOrEqualTo:return">=";case T.lessThan:return"<";case T.lessThanOrEqualTo:return"<=";case T.contains:return"~";case T.notContains:return"!~";default:throw new Error(`Unexpected filter type ${e}`)}}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e,t=!0){return[...e].sort((n,s)=>{const i=n.name.toUpperCase(),a=s.name.toUpperCase();return xi.sort(i,a,t)})}dh;constructor(e){this.dh=e}makeQuickFilter(e,t,n){const s=t.split("||");let i=null;for(let a=0;a<s.length;a+=1){const l=s[a].split("&&");let u=null;for(let h=0;h<l.length;h+=1){const p=l[h].trim();if(p.length>0){const m=this.makeQuickFilterFromComponent(e,p,n);if(m)u?u=u.and(m):u=m;else throw new Error(`Unable to parse quick filter from text ${t}`)}}i&&u?i=i.or(u):i=u}return i}makeQuickFilterFromComponent(e,t,n){const{type:s}=e;return b.isNumberType(s)?this.makeQuickNumberFilter(e,t):b.isBooleanType(s)?this.makeQuickBooleanFilter(e,t):n!=null&&b.isDateType(s)?this.makeQuickDateFilter(e,t,n):b.isCharType(s)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){const n=e.filter(),{dh:s}=this;let i=null;const r=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i.exec(t);let l=null,u=null,h=null,p=null,m=null;if(r!==null&&r.length>3&&([,l,u,h,p,m]=r),m!=null&&m.trim().length>0)return null;if(l==null&&(l="="),p!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(p=p.trim().toLowerCase(),p){case"null":i=n.isNull();break;case"nan":i=s.FilterCondition.invoke("isNaN",n);break;case"infinity":case"inf":case"∞":u!=null?i=s.FilterCondition.invoke("isInf",n).and(n.lessThan(s.FilterValue.ofNumber(0))):i=s.FilterCondition.invoke("isInf",n).and(n.greaterThan(s.FilterValue.ofNumber(0)));break}return i!==null&&(l==="!"||l==="!=")&&(i=i.not()),i}if(h==null)return null;if(h=b.removeCommas(h),b.isLongType(e.type))try{h=s.FilterValue.ofNumber(s.LongWrapper.ofString(`${u!=null?"-":""}${h}`))}catch(f){return ce.warn("Unable to create long filter",f),null}else{if(h=parseFloat(h),h==null||Number.isNaN(h))return null;h=s.FilterValue.ofNumber(u!=null?0-h:h)}return i=e.filter(),b.makeRangeFilterWithOperation(i,l,h)}makeQuickTextFilter(e,t){const{dh:n}=this,s=`${t}`.trim(),a=/^(!~|!=|~|=|!)?(.*)/.exec(s);let r=null,l=null;if(a!==null&&a.length>2&&([,r,l]=a,l!=null&&(l=l.trim())),l==null||l.length===0)return null;r==null&&(r="=");const u=e.filter();if(l.toLowerCase()==="null")switch(r){case"=":return u.isNull();case"!=":case"!":return u.isNull().not()}let h=null,p=null;switch(l.startsWith("*")?(h="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(p="*",l=l.substring(0,l.length-1)),l=l.replace("\\",""),r){case"~":return u.isNull().not().and(u.invoke("matches",n.FilterValue.ofString(`(?s)(?i).*\\Q${l}\\E.*`)));case"!~":return u.isNull().or(u.invoke("matches",n.FilterValue.ofString(`(?s)(?i).*\\Q${l}\\E.*`)).not());case"!=":return h==="*"?u.isNull().or(u.invoke("matches",n.FilterValue.ofString(`(?s)(?i).*\\Q${l}\\E$`)).not()):p==="*"?u.isNull().or(u.invoke("matches",n.FilterValue.ofString(`(?s)(?i)^\\Q${l}\\E.*`)).not()):u.notEqIgnoreCase(n.FilterValue.ofString(l.toLowerCase()));case"=":return h==="*"?u.isNull().not().and(u.invoke("matches",n.FilterValue.ofString(`(?s)(?i).*\\Q${l}\\E$`))):p==="*"?u.isNull().not().and(u.invoke("matches",n.FilterValue.ofString(`(?s)(?i)^\\Q${l}\\E.*`))):u.eqIgnoreCase(n.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){const s=/^(!=|=|!)?(.*)/.exec(`${t}`.trim());if(s===null)return null;const[,i,a]=s,r=i==="!"||i==="!=",l=a.trim().toLowerCase();let u=e.filter();try{const h=b.makeBooleanValue(l);return h!=null&&h?u=u.isTrue():h===null?u=u.isNull():u=u.isFalse(),r?u.not():u}catch{return null}}makeQuickDateFilter(e,t,n){const s=t.trim(),a=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/.exec(s);if(a==null||a.length<=2)throw new Error(`Unable to parse date filter: ${t}`);let r=null,l=null;[,r,l]=a;let u=T.eq;switch(r){case"<":u=T.lessThan;break;case"<=":case"=<":u=T.lessThanOrEqualTo;break;case">":u=T.greaterThan;break;case">=":case"=>":u=T.greaterThanOrEqualTo;break;case"!=":case"!":u=T.notEq;break;case"=":case"==":default:u=T.eq;break}return this.makeQuickDateFilterWithOperation(e,l,u,n)}makeQuickDateFilterWithOperation(e,t,n,s){const{dh:i}=this,[a,r]=W.parseDateRange(i,t,s),l=a!=null?i.FilterValue.ofNumber(a):null,u=r!=null?i.FilterValue.ofNumber(r):null,h=e.filter();if(l==null)return n===T.notEq?h.isNull().not():h.isNull();switch(n){case T.eq:{if(u!=null){const p=h.greaterThanOrEqualTo(l),m=h.lessThan(u);return p.and(m)}return h.eq(l)}case T.lessThan:return h.lessThan(l);case T.lessThanOrEqualTo:return u!=null?h.lessThan(u):h.lessThanOrEqualTo(l);case T.greaterThan:return u!=null?h.greaterThanOrEqualTo(u):h.greaterThan(l);case T.greaterThanOrEqualTo:return h.greaterThanOrEqualTo(l);case T.notEq:{if(u!=null){const p=h.lessThan(l),m=h.greaterThanOrEqualTo(u);return p.or(m)}return h.notEq(l)}default:throw new Error(`Invalid operator: ${n}`)}}makeQuickCharFilter(e,t){const{dh:n}=this,s=`${t}`.trim(),a=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/.exec(s);let r=null,l=null,u=null;if(a!==null&&a.length>3&&([,r,l,u]=a),u!=null&&u.trim().length>0||l==null||l.length===0)return null;r==null&&(r="=");const h=e.filter();if(l.toLowerCase()==="null")switch(r){case"=":return h.isNull();case"!=":case"!":return h.isNull().not();default:return null}const p=n.FilterValue.ofString(b.isRangeOperation(r)?b.quoteValue(l):l);return b.makeRangeFilterWithOperation(h,r,p)}makeAdvancedFilter(e,t,n){const{filterItems:s,filterOperators:i,invertSelection:a,selectedValues:r}=t;let l=null;for(let h=0;h<s.length;h+=1){const p=s[h],{selectedType:m,value:f}=p;if(m!=null&&m.length>0&&f!=null&&f.length>0)try{const v=this.makeAdvancedValueFilter(e,m,f,n);if(v!=null){if(h===0)l=v;else if(l!==null&&h-1<i.length){const S=i[h-1];if(S===fn.and)l=l.and(v);else if(S===fn.or)l=l.or(v);else{ce.error("Unexpected filter operator",S,v),l=null;break}}}else ce.debug2("Empty filter ignored for",m,f)}catch(v){ce.error("Unable to create filter",v),l=null;break}}const u=this.makeSelectValueFilter(e,r,a);return u!=null&&(l!=null?l=l.and(u):l=u),l}makeAdvancedValueFilter(e,t,n,s){if(b.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,n,t,s);if(b.isNumberType(e.type)||b.isCharType(e.type))return this.makeQuickFilter(e,`${b.getFilterOperatorString(t)}${n}`);const i=this.makeFilterValue(e.type,n),a=e.filter();switch(t){case T.eq:return a.eq(i);case T.eqIgnoreCase:return a.eqIgnoreCase(i);case T.notEq:return a.notEq(i);case T.notEqIgnoreCase:return a.notEqIgnoreCase(i);case T.greaterThan:return a.greaterThan(i);case T.greaterThanOrEqualTo:return a.greaterThanOrEqualTo(i);case T.lessThan:return a.lessThan(i);case T.lessThanOrEqualTo:return a.lessThanOrEqualTo(i);case T.isTrue:return a.isTrue();case T.isFalse:return a.isFalse();case T.isNull:return a.isNull();case T.contains:return a.isNull().not().and(a.invoke("matches",dh.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)));case T.notContains:return a.isNull().or(a.invoke("matches",dh.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)).not());case T.startsWith:return a.isNull().not().and(a.invoke("matches",dh.FilterValue.ofString(`(?s)(?i)^\\Q${n}\\E.*`)));case T.endsWith:return a.isNull().not().and(a.invoke("matches",dh.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E$`)));case T.in:case T.inIgnoreCase:case T.notIn:case T.notInIgnoreCase:case T.invoke:default:throw new Error(`Unexpected filter operation: ${t}`)}}static makeNeverFilter(e){let t=null;b.isTextType(e.type)?t=dh.FilterValue.ofString("a"):b.isBooleanType(e.type)?t=dh.FilterValue.ofBoolean(!0):b.isDateType(e.type)?t=dh.FilterValue.ofNumber(dh.DateWrapper.ofJsDate(new Date)):t=dh.FilterValue.ofNumber(0);const n=e.filter().eq(t),s=e.filter().notEq(t);return n.and(s)}makeFilterValue(e,t){const{dh:n}=this,s=b.getBaseType(e);return b.isTextType(s)?n.FilterValue.ofString(t):b.isLongType(s)?n.FilterValue.ofNumber(n.LongWrapper.ofString(b.removeCommas(t))):n.FilterValue.ofNumber(b.removeCommas(t))}makeFilterRawValue(e,t){const{dh:n}=this;return b.isTextType(e)?n.FilterValue.ofString(t):b.isBooleanType(e)?n.FilterValue.ofBoolean(t):n.FilterValue.ofNumber(t)}makeValue(e,t,n){const{dh:s}=this;if(t==="null")return null;if(b.isTextType(e))return t;if(b.isLongType(e))return s.LongWrapper.ofString(b.removeCommas(t));if(b.isBooleanType(e))return b.makeBooleanValue(t,!0);if(b.isDateType(e)){const[i]=W.parseDateRange(s,t,n);return i}return b.isNumberType(e)?b.makeNumberValue(t):(ce.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,n){const{dh:s}=this;if(t.length===0)return n?null:b.makeNeverFilter(e);const i=[];let a=!1;for(let r=0;r<t.length;r+=1){const l=t[r];l==null?a=!0:b.isTextType(e.type)?i.push(s.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):b.isBooleanType(e.type)?i.push(s.FilterValue.ofBoolean(Boolean(l))):i.push(s.FilterValue.ofNumber(l))}return a?i.length>0?n?e.filter().isNull().not().and(e.filter().notIn(i)):e.filter().isNull().or(e.filter().in(i)):n?e.filter().isNull().not():e.filter().isNull():n?e.filter().notIn(i):e.filter().in(i)}}class ot{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,n)=>{const s=b.getNormalizedType(n.columnType);return s===null||(t.has(s)||t.set(s,new Map),t.get(s)?.set(n.columnName,n.format)),t},new Map)}static makeColumnFormattingRule(e,t,n){return{columnType:e,columnName:t,format:n}}constructor(e=[],t,n,s,i=!1){this.defaultColumnFormatter=new Yn,this.typeFormatterMap=new Map([[b.dataType.BOOLEAN,new Qn],[b.dataType.CHAR,new Jn],[b.dataType.DATETIME,new de(t)],[b.dataType.DECIMAL,new X(n)],[b.dataType.INT,new ge(s)],[b.dataType.STRING,new es]]),this.columnFormatMap=ot.makeColumnFormatMap(e),this.truncateNumbersWithPound=i}defaultColumnFormatter;typeFormatterMap;columnFormatMap;truncateNumbersWithPound;getColumnFormatMapForType(e,t=!1){const n=b.getNormalizedType(e);if(n!==null)return t&&!this.columnFormatMap.has(n)&&this.columnFormatMap.set(n,new Map),this.columnFormatMap.get(n)}getColumnFormat(e,t){return this.getColumnFormatMapForType(e)?.get(t)??null}getColumnTypeFormatter(e){const t=b.getNormalizedType(e);let n=this.defaultColumnFormatter;return t&&(n=this.typeFormatterMap.get(t)??n),n}getFormattedString(e,t,n="",s){if(e==null)return"";const i=this.getColumnTypeFormatter(t),a=s||this.getColumnFormat(t,n);return i.format(e,a??void 0)}get timeZone(){return this.typeFormatterMap.get(b.dataType.DATETIME)?.dhTimeZone?.id}}function ts(o){if(o&&o.formatter){const{formatter:e}=o;return e}}function ns(o){return{timeZone:o?.timeZone,defaultDateTimeFormatString:o?.defaultDateTimeFormat,showTimeZone:o?.showTimeZone,showTSeparator:o?.showTSeparator}}function ss(o,e,t){const n=o.getColumnFormat(t,e);return n!=null&&(n.type===q.TYPE_CONTEXT_PRESET||n.type===q.TYPE_CONTEXT_CUSTOM)}const vt={getColumnFormats:ts,getDateTimeFormatterOptions:ns,isCustomColumnFormatDefined:ss},pt=V.module("MessageUtils"),is="io.deephaven.message.LoginOptions.request",os="io.deephaven.message.SessionDetails.request",as="io.deephaven.broadcast",rs="io.deephaven.broadcast.Login",ls="io.deephaven.broadcast.Logout";function at(o){const e=o;return e!=null&&typeof e.id=="string"&&typeof e.message=="string"}function cs(o){return at(o)&&o.message===rs}function us(o){return at(o)&&o.message===ls}function ds(o){const e=o;return e!=null&&typeof e.id=="string"}function hs(o,e=Se(),t){return{message:o,id:e,payload:t}}function Ca(o,e){return{id:o,payload:e}}async function Ut(o,e=3e4){if(window.opener==null)throw new Error("window.opener is null, unable to send request.");return new Promise((t,n)=>{let s;const i=Se(),a=r=>{const{data:l}=r;if(!ds(l)){pt.debug("Ignoring non-deephaven response",l);return}if(pt.debug("Received message",l),l?.id!==i){pt.debug("Ignore message, id doesn't match",l);return}window.clearTimeout(s),window.removeEventListener("message",a),t(l.payload)};window.addEventListener("message",a),s=window.setTimeout(()=>{window.removeEventListener("message",a),n(new Ye("Request timed out"))},e),window.opener.postMessage(hs(o,i),"*")})}class ps extends Error{isNoConsolesError=!0}function ms(o){return o.isNoConsolesError}const Ne=V.module("SessionUtils");function Sa(o){return Ne.info(`Starting connection to '${o}'...`),new dh.IdeConnection(o)}async function fs(o,e){Ne.info("Getting console types...");const t=await o.getConsoleTypes();if(t.length===0)throw new ps("No console types available");Ne.info("Available types:",t);const n=t[0];Ne.info("Starting session with type",n);const s=await o.startSession(n),i={type:n,id:Se.generate()};return Ne.info("Console session established",i),{session:s,config:i,connection:o,details:e}}function va(o,e){return Ne.info("createCoreClient",o),new dh.CoreClient(o,e)}function Ma(o){return o!=null&&typeof o=="object"}async function ya(){const o=await Ut(os);if(!Ma(o))throw new Error(`Unexpected session details response: ${o}`);return o}async function Ta(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return ya()}return{}}async function Ea(o,e){let t;try{t=await fs(o,e)}catch(n){if(!ms(n))throw n}return t}const Ia=V.module("ViewportDataUtils");function gs(o,e){return String(o.offsetInSnapshot+e)}function bs(o,e){return function(n){const{columns:s,offset:i,rows:a}=n.detail;Ia.debug("table updated",n.detail),a.forEach(r=>{const l=e(r,s),u={key:gs(r,i),item:l};o.getItem(u.key)!=null?o.update(u.key,u):o.append(u)})}}function Cs(o,e){return e.reduce((t,n)=>(t[n.name]=o.get(n),t),{})}function*Ss(o,e){for(let t=o;t<=e;++t)yield{key:String(t)}}function xa(o,...e){return e.map(t=>o.getItem(t))}function Kt(o){return o==null||rt(o)?0:o.size}function rt(o){return"isClosed"in o?o.isClosed:!1}function vs(o,e,t,n){const s=o+e-1,[i,a]=[0,n-1],r=gt(o-t,i,a),l=gt(s+t,i,a);return[r,l]}const wa=Object.freeze(Object.defineProperty({__proto__:null,BROADCAST_CHANNEL_NAME:as,BROADCAST_LOGIN_MESSAGE:rs,BROADCAST_LOGOUT_MESSAGE:ls,BooleanColumnFormatter:Qn,CharColumnFormatter:Jn,DateTimeColumnFormatter:de,DateUtils:W,DecimalColumnFormatter:X,DefaultColumnFormatter:Yn,FETCH_TIMEOUT:Xn,Formatter:ot,FormatterUtils:vt,IntegerColumnFormatter:ge,LOGIN_OPTIONS_REQUEST:is,NoConsolesError:ps,SESSION_DETAILS_REQUEST:os,StringColumnFormatter:es,TableColumnFormatter:q,TableUtils:b,createConnection:Sa,createCoreClient:va,createKeyFromOffsetRow:gs,createOnTableUpdatedHandler:bs,createSessionWrapper:fs,defaultRowDeserializer:Cs,fetchVariableDefinition:da,generateEmptyKeyedItems:Ss,getColumnFormats:ts,getDateTimeFormatterOptions:ns,getItemsFromListData:xa,getSessionDetails:Ta,getSize:Kt,isBroadcastLoginMessage:cs,isBroadcastLogoutMessage:us,isClosed:rt,isCustomColumnFormatDefined:ss,isMessage:at,isNoConsolesError:ms,isResponse:ds,loadSessionWrapper:Ea,makeMessage:hs,makeResponse:Ca,padFirstAndLastRow:vs,requestParentResponse:Ut},Symbol.toStringTag,{value:"Module"}));function Ms(o){if(o==null)return!1;const e=o;return e.Component!==void 0&&typeof e.isAvailable=="function"}const ys="io.deephaven.auth.AnonymousAuthenticationHandler",Na="io.deephaven.authentication.psk.PskAuthenticationHandler";class ka extends Error{name="AuthenticationError";isAuthenticationError=!0}const Ts=ka,gn=V.module("AuthPluginBase");function Wt({children:o,getLoginOptions:e}){const t=Be(),[n,s]=d.useState(),[i,a]=d.useState(!1);return d.useEffect(()=>{let r=!1;function l(){if(r)throw new bt("Login canceled.")}async function u(){try{const h=await e();l(),gn.info("Logging in..."),await t.login(h),l(),a(!0)}catch(h){if(!r){gn.error("Unable to login:",h);const p=qe(h)??"Unable to login. Verify credentials.";s(new Ts(p)),a(!1)}}}return u(),()=>{r=!0}},[t,e]),i?c.jsx(c.Fragment,{children:o}):c.jsx(je,{"data-testid":"auth-base-loading",isLoading:n==null,isLoaded:!1,errorMessage:qe(n)})}const Da=d.createContext({}),qt=d.createContext({}),Oa={canLogout:!1};function Aa({children:o}){const e=Ee(),t=d.useCallback(()=>({type:e.CoreClient.LOGIN_TYPE_ANONYMOUS}),[e]);return c.jsx(Wt,{getLoginOptions:t,children:c.jsx(qt.Provider,{value:Oa,children:o})})}const Fa={Component:Aa,isAvailable:o=>o.includes(ys)},Ra=Fa,Pa=V.module("AuthPluginParent"),La={canLogout:!1};function ja(o){return o!=null&&typeof o.type=="string"}async function $a(){Pa.info("Logging in by delegating to parent window...");const o=await Ut(is);if(!ja(o))throw new Error(`Unexpected login options response: ${o}`);return o}function Va(){return new URLSearchParams(window.location.search).get("authProvider")??""}function Ba({children:o}){return c.jsx(Wt,{getLoginOptions:$a,children:c.jsx(qt.Provider,{value:La,children:o})})}const Ha={Component:Ba,isAvailable:()=>window.opener!=null&&Va()==="parent"},_a=Ha,bn=V.module("useTableListener"),Ua=(o,e,t)=>d.useEffect(function(){if(o==null){bn.debug2("Emitter undefined, skipping addEventListener",e);return}return bn.debug2("Adding listener",e),o.addEventListener(e,t)},[o,e,t]),De=Ua;class Ka extends Error{isColumnNameError=!0}const Wa=Ka;class qa extends Error{isTableDisconnectError=!0}const Ga=qa,Ke=V.module("useTable"),za=(o,e,t,n)=>{const s=Ee(),[i,a]=d.useState(void 0),[r,l]=d.useState([]),[u,h]=d.useState(null),[p,m]=d.useState(null);d.useEffect(()=>{if(n===void 0){a(o?.columns),h(null);return}try{a(o?.findColumns(n)),h(null)}catch(C){Ke.error("Column not found",C,n),h(new Wa("Invalid columnNames argument"))}},[o,n]),d.useEffect(()=>{if(!i||!o){Ke.debug2("Table or column not initialized, skip viewport update.");return}Ke.debug2("Setting viewport",e,t),o.setViewport(e,t,i)},[i,o,e,t]);const f=d.useCallback(({detail:C})=>{if(!i){Ke.error("Columns not initialized.");return}const w=i.map(D=>C.rows.map(M=>M.get(D)));l(w)},[i]),v=d.useCallback(()=>{m(new Ga("Table disconnected"))},[]),S=d.useCallback(()=>{m(null)},[]);return De(o,s.Table.EVENT_UPDATED,f),De(o,s.Table.EVENT_DISCONNECT,v),De(o,s.Table.EVENT_RECONNECT,S),{columns:i,data:r,error:p??u}},Es=za,Za=(o,e,t,n)=>{const s=d.useMemo(()=>[n],[n]),{columns:i=[],data:a=[],error:r}=Es(o,e,t,s);return{column:i[0],data:a[0],error:r}},Is=Za;const ue=V.module("TableInput"),mt=250;function Gt(o){const{className:e=void 0,columnName:t,settings:n,defaultValue:s=[],isInvalid:i=!1,onChange:a=()=>!1,onBlur:r=()=>!1,table:l}=o,u=d.useRef(null),h=d.useMemo(()=>{const F=vt.getColumnFormats(n),E=vt.getDateTimeFormatterOptions(n),{defaultDecimalFormatOptions:B={},defaultIntegerFormatOptions:te={}}=n;return new ot(F,E,B,te)},[n]),[p,m]=d.useState(""),[f,v]=d.useState(new Set(s)),[S,C]=d.useState(),w=d.useRef(null),D=Math.min(S?.size??0,mt),{column:M,data:A,error:R}=Is(S,0,mt-1,t),O=d.useCallback(F=>M?h.getFormattedString(F,M.type,M.name):`${F}`,[M,h]),[P,K]=d.useMemo(()=>{const F=new Set(f),E=[];if(A==null)return[E,null];if(A.forEach(B=>{const te=`${B}`,ne=f.has(te);ne&&F.delete(te),E.push({value:te,displayValue:O(B),isSelected:ne})}),F.size>0){ue.debug2("Selection has items that are missing from the viewport");const B=new Set(f);return Array.from(F).forEach(te=>{B.delete(te)}),[E,B]}return[E,null]},[A,f,O]);d.useEffect(()=>{K!==null&&(v(K),a(Array.from(K)))},[a,K]);const oe=d.useCallback(async F=>{try{const E=await F;ue.debug("Table resolved",E),C(E)}catch(E){if(Le.isCanceled(E))return;ue.error(E)}},[]);d.useEffect(()=>{const F=Le.makeCancelable(l);return oe(F),()=>{ue.debug2("Cancel table promise"),F.cancel()}},[l,oe]);const j=d.useCallback(F=>{const{value:E}=F.target;m(E);const B=P.findIndex(te=>te.displayValue.includes(E));B>-1?(ue.debug2(`Found ${E} at index ${B}`),w.current?.scrollIntoView(B)):ue.debug2(`${E} not found`)},[P,w]),L=d.useCallback(F=>{if(ue.debug("handleSelect",F),F>=P.length){ue.error("Invalid index",F);return}const E=P[F].value,B=new Set(f);P[F].isSelected?B.delete(E):B.add(E),v(B),a(Array.from(B))},[a,P,f]),H=d.useCallback(()=>{const F=P.map(B=>B.value),E=new Set(F);v(E),a(F)},[P,a]),N=d.useCallback(()=>{v(new Set),a([])},[a]),k=d.useCallback(()=>{},[]),y=d.useCallback(F=>{const{relatedTarget:E}=F;ue.debug("handleChildBlur",E,E instanceof HTMLElement,u.current,u.current?.contains(E)),(!E||u.current&&E instanceof HTMLElement&&!u.current.contains(E))&&r()},[r]),$=P.length===0;return c.jsxs("div",{ref:u,className:x("table-input-container d-flex flex-column position-relative",e),children:[c.jsx(nt,{disabled:!!R||$,value:p,placeholder:"Search",onChange:j,className:"mb-2 d-flex",onBlur:y}),c.jsx(Gn,{className:"table-input-list",disabled:S===void 0||$,isInvalid:i,items:$?[{value:"Empty",isSelected:!1}]:P,itemCount:D,offset:0,onSelect:L,onViewportChange:k,ref:w,onBlur:y}),S&&c.jsxs("div",{className:"meta-row",children:[c.jsx("div",{className:"d-flex align-items-center text-muted small",children:S!=null&&S.size>D&&c.jsxs(c.Fragment,{children:["Table is too large, showing the first ",mt," items."]})}),c.jsxs("div",{children:[c.jsx("button",{type:"button",className:"btn btn-link",onBlur:y,onClick:H,children:"Select All"}),c.jsx("button",{type:"button",className:"btn btn-link mr-a",onBlur:y,onClick:N,children:"Clear"})]})]}),S==null||R&&c.jsx("div",{className:"h-100 w-100 position-absolute",children:c.jsx(je,{isLoaded:S!=null,isLoading:S==null&&R==null,errorMessage:R?.message??null})})]})}Gt.displayName="TableInput";Gt.defaultProps={isInvalid:!1,className:void 0};const Cn=V.module("useBroadcastChannel");function xs(o=vi,e=as){const t=d.useMemo(()=>new BroadcastChannel(e),[e]);return d.useEffect(()=>()=>{t.close()},[t]),d.useEffect(()=>{function n(s){const{data:i}=s;if(!at(i)){Cn.debug("Ignoring non-deephaven message",i);return}Cn.debug("event received",i),o(s)}return t.addEventListener("message",n),()=>{t.removeEventListener("message",n)}},[t,o]),t}function zt(o,e){const t=d.useCallback(n=>{cs(n.data)?o?.(n.data):us(n.data)&&e?.(n.data)},[o,e]);xs(t)}const Qe="io.deephaven.web.client.auth.refreshToken",ws=d.createContext(null),Xa=V.module("RefreshTokenUtils");function Mt(){const o=Oe.get(Qe);try{if(o!=null)return JSON.parse(o)}catch(e){Xa.error("Error parsing refresh token",o,e)}return null}function yt(o){if(o==null){Oe.remove(Qe);return}const e=JSON.stringify({bytes:o.bytes,expiry:o.expiry}),t=new Date(o.expiry);Oe.set(Qe,e,{secure:!0,sameSite:"strict",expires:t})}function Qa({children:o}){const e=Ee(),t=Be(),[n,s]=d.useState(Mt());d.useEffect(function(){return t.addEventListener(e.CoreClient.EVENT_REFRESH_TOKEN_UPDATED,u=>{const{detail:h}=u;yt(h),s(h)})},[e,t,n]);const i=d.useCallback(()=>{s(Mt())},[]),a=d.useCallback(()=>{yt(null),s(null)},[]);return zt(i,a),c.jsx(ws.Provider,{value:n,children:o})}const Sn=V.module("useDebouncedViewportSearch"),Ja=200;function Ya(o,e,t=Ja){const n=Ee(),s=d.useMemo(()=>new b(n),[n]),{table:i,applyFiltersAndRefresh:a}=o,r=d.useMemo(()=>Pe(l=>{if(Sn.debug(`Applying debounced searchText '${l}'`),i==null)return;const u=l.trim();if(u===""){a([]);return}const h=i.findColumn(e),p=s.makeFilterValue(h.type,u),m=[h.filter().contains(p)];a(m)},t),[a,e,t,i,s]);return d.useEffect(()=>()=>{Sn.debug("Cancelling debounced search function"),r.cancel()},[r]),r}function Zt(o){const[,e]=d.useState(0);return De(o,dh.Table.EVENT_SIZECHANGED,()=>{e(t=>t+1)}),Kt(o)}function Ns(o){const e=Ks({}),t=Dt(o),n=Math.max(0,Zt(o));return d.useEffect(()=>{let s=e.items.length;if(o!==t&&s&&(e.remove(...e.items.map(({key:i})=>i)),s=0),!!o){if(n>s)e.insert(s,...Ss(s,n-1));else if(n<s){const i=e.items.slice(n).map(({key:a})=>a);e.remove(...i)}}},[n,o]),e}function er(o,...e){const t=d.useCallback(async()=>o?.selectDistinct(o.findColumns(e))??null,[o,...e]),{data:n,error:s,isError:i,isLoading:a}=An(t,[]);return d.useEffect(()=>()=>{n?.close()},[n]),{distinctTable:n,error:s,isError:i,isLoading:a}}function ks(o,e,t){return d.useCallback(function(s){const[i,a]=vs(s,e,t,Kt(o));o?.setViewport(i,a)},[o,t,e])}function tr(o){d.useEffect(()=>()=>{o!=null&&(rt(o)||o.close())},[o])}function nr({table:o,viewportSize:e=10,viewportPadding:t=50,deserializeRow:n=Cs}){const s=Ns(o),i=ks(o,e,t),a=d.useCallback(l=>{o?.applyFilter(l),i(0)},[i,o]);De(o,dh.Table.EVENT_UPDATED,bs(s,n));const r=Zt(o);return d.useEffect(()=>{o&&!rt(o)&&i(0)},[o,i,r]),{viewportData:s,size:r,table:o,applyFiltersAndRefresh:a,setViewport:i}}const sr=Object.freeze(Object.defineProperty({__proto__:null,REFRESH_TOKEN_KEY:Qe,RefreshTokenBootstrap:Qa,RefreshTokenContext:ws,TableInput:Gt,readRefreshToken:Mt,storeRefreshToken:yt,useBroadcastChannel:xs,useBroadcastLoginListener:zt,useDebouncedViewportSearch:Ya,useInitializeViewportData:Ns,useSelectDistinctTable:er,useSetPaddedViewportCallback:ks,useTable:Es,useTableClose:tr,useTableColumn:Is,useTableListener:De,useTableSize:Zt,useViewportData:nr},Symbol.toStringTag,{value:"Module"}));function Ds({children:o,errorMessage:e,isLoggingIn:t=!1,onSubmit:n}){return c.jsxs("form",{className:"login-form",onSubmit:s=>{s.preventDefault(),s.stopPropagation(),n?.(s)},children:[c.jsx("div",{className:"flex-spacer"}),c.jsxs("div",{className:"flex-wrapper",children:[c.jsx("fieldset",{disabled:t,className:"container-fluid",children:o}),c.jsx("div",{className:"form-group d-flex justify-content-end align-items-center mb-0",children:c.jsxs("button",{type:"submit",className:x("btn btn-primary",{"btn-spinner":t},{"btn-cancelable":t}),"data-testid":"btn-login",children:[t&&c.jsxs("span",{children:[c.jsx(wt,{}),c.jsx("span",{className:"btn-normal-content",children:"Logging in"}),c.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!t&&"Login"]})})]}),c.jsx("div",{className:"flex-spacer",children:e!=null&&c.jsx("p",{className:"error-message mb-0",role:"alert",children:`${e}`})})]})}function Os({children:o,logoPath:e="./logo.png"}){return c.jsxs("div",{className:"login-container",children:[c.jsx(qn,{}),c.jsxs("div",{className:"login-box",children:[c.jsx("div",{className:"logo",children:c.jsx("img",{src:e,alt:"Deephaven Data Labs"})}),o,c.jsxs("p",{className:"footer",children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})}const Tt="io.deephaven.authentication.psk.PskAuthenticationHandler",As="psk",Et="io.deephaven.web.client.auth.psk.token",ke=V.module("AuthPluginPsk");function ir(){return new URLSearchParams(window.location.search).get(As)}function or(){ke.debug2("clearWindowToken");const o=new URL(window.location.href);o.searchParams.delete(As),window.history.replaceState(null,"",o.href)}function vn(){return Oe.get(Et)??null}function ft(o){ke.debug2("Storing token in cookie",o),o!=null?Oe.set(Et,o,{secure:!0,sameSite:"strict"}):Oe.remove(Et)}function ar({children:o,logoPath:e}){const t=Be(),n=d.useRef(null),s=d.useRef(null),[i,a]=d.useState(),[r,l]=d.useState(!1),[u,h]=d.useState(!1),[p,m]=d.useState(!1),[f,v]=d.useState(""),S=d.useCallback(async(A,R=!0)=>{ke.info("Logging in..."),m(!0);let O=null;try{if(O=t.login({type:Tt,token:A}),s.current=O,await O,ke.info("Logged in successfully"),s.current!==O)return;ft(A),h(!0)}catch(P){if(s.current!==O)return;if(l(!0),R){ke.error("Unable to login",P);const K=qe(P)??"Unable to login: Verify credentials.";a(new Ts(K))}}m(!1)},[t]),C=d.useCallback(()=>{s.current=null,m(!1)},[]),w=d.useCallback(async()=>{ke.debug("onLogin");const A=vn();u||p||A==null||S(A,!1)},[u,p,S]),D=d.useCallback(()=>{ft(null)},[]);zt(w,D),d.useEffect(()=>{let A=!1;async function R(){const O=ir()??vn();if(or(),O==null){l(!0);return}m(!0);try{await t.login({type:Tt,token:O}),A||(ft(O),h(!0),m(!1))}catch{A||(l(!0),m(!1))}}return R(),()=>{A=!0}},[t]);const M=d.useCallback(()=>{p?C():S(f)},[C,p,S,f]);return d.useEffect(function(){n.current?.focus()},[n,r]),c.jsxs(c.Fragment,{children:[u&&o,r&&c.jsx(Te,{in:!u,timeout:le.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:c.jsx(Os,{logoPath:e,children:c.jsx(Ds,{errorMessage:qe(i),isLoggingIn:p,onSubmit:M,children:c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"auth-psk-token-input",children:"Token"}),c.jsx("input",{id:"auth-psk-token-input",name:"token",className:"input-token form-control",type:"text",autoComplete:"username",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",ref:n,value:f,onChange:A=>{a(void 0),v(A.target.value)}})]})})})}),c.jsx(je,{"data-testid":"auth-psk-loading",isLoaded:u||r,isLoading:!u&&!r})]})}const rr={Component:ar,isAvailable:o=>o.includes(Tt)},lr=rr,cr=Object.freeze(Object.defineProperty({__proto__:null,AUTH_HANDLER_TYPE_ANONYMOUS:ys,AUTH_HANDLER_TYPE_PSK:Na,AuthPluginAnonymous:Ra,AuthPluginBase:Wt,AuthPluginParent:_a,AuthPluginPsk:lr,Login:Os,LoginForm:Ds,UserOverrideContext:Da,UserPermissionsOverrideContext:qt,isAuthPlugin:Ms},Symbol.toStringTag,{value:"Module"})),Fs={react:I,"react-dom":Mn,redux:Ws,"react-redux":qs,"@deephaven/auth-plugins":cr,"@deephaven/components":aa,"@deephaven/jsapi-bootstrap":ca,"@deephaven/jsapi-components":sr,"@deephaven/jsapi-utils":wa,"@deephaven/log":hi,"@deephaven/react-hooks":Oi},ur=Tn.createRequires(()=>Fs),dr=Tn.createRemoteComponent({requires:ur}),hr=dr,pr=Gs.createRequires(Fs),mr=zs({requires:pr}),fr=mr,be=V.module("@deephaven/app-utils.PluginUtils");function Nr(o,e){const t=new URL(`${e}.js`,o),n=I.forwardRef((s,i)=>c.jsx(hr,{url:t.href,render:({err:a,Component:r})=>{if(a!=null&&a!==""){const l=`Error loading plugin ${e} from ${t} due to ${a}`;return be.error(l),c.jsx("div",{className:"error-message",children:`${l}`})}return c.jsx(r,{ref:i,...s})}}));return n.pluginName=e,n.displayName="Plugin",n}async function gr(o){return await fr(o)}async function br(o){const e=await fetch(o);if(!e.ok)throw new Error(e.statusText);try{return await e.json()}catch{throw new Error("Could not be parsed as JSON")}}async function Cr(o){be.debug("Loading plugins...");try{const e=await br(`${o}/manifest.json`);if(!Array.isArray(e.plugins))throw new Error("Plugin manifest JSON does not contain plugins array");be.debug("Plugin manifest loaded:",e);const t=[];for(let i=0;i<e.plugins.length;i+=1){const{name:a,main:r}=e.plugins[i],l=`${o}/${a}/${r}`;t.push(gr(l))}const n=await Promise.allSettled(t),s=new Map;for(let i=0;i<n.length;i+=1){const a=n[i],{name:r}=e.plugins[i];a.status==="fulfilled"?s.set(r,a.value):be.error(`Unable to load plugin ${r}`,a.reason)}return be.info("Plugins loaded:",s),s}catch(e){return be.error("Unable to load plugins:",e),new Map}}function Sr(o){return o.get("AuthHandlers")?.split(",")??[]}function kr(o,e,t){const n=Sr(e),s=[...o.entries()].filter(([,l])=>Ms(l.AuthPlugin)).map(([l,u])=>[l,u.AuthPlugin]);s.push(...t??[]);const i=s.filter(([l,u])=>u.isAvailable(n,e));if(i.length===0)throw new Error(`No login plugins found, please register a login plugin for auth handlers: ${n}`);i.length>1&&be.warn("More than one login plugin available, will use the first one: ",i.map(([l])=>l).join(", "));const[a,r]=i[0];return be.info("Using LoginPlugin",a),r.Component}const Rs=d.createContext(null);function Dr({pluginsUrl:o,children:e}){const[t,n]=d.useState(null);return d.useEffect(function(){let i=!1;async function a(){const r=await Cr(o);i||n(r)}return a(),()=>{i=!0}},[o]),c.jsx(Rs.Provider,{value:t,children:e})}const vr=V.module("@deephaven/jsapi-components.ConnectionBootstrap"),Ps=d.createContext(null);function Or({children:o}){const e=Ee(),t=Be(),[n,s]=d.useState(),[i,a]=d.useState();return d.useEffect(function(){let l=!1;async function u(){try{const h=await t.getAsIdeConnection();if(l)return;a(h)}catch(h){if(l)return;s(h)}}return u(),()=>{l=!0}},[e,t]),d.useEffect(function(){if(i==null)return;function l(h){const{detail:p}=h;vr.info("Shutdown",`${JSON.stringify(p)}`),s(`Server shutdown: ${p??"Unknown reason"}`)}return i.addEventListener(e.IdeConnection.EVENT_SHUTDOWN,l)},[e,i]),i==null||n!=null?c.jsx(je,{"data-testid":"connection-bootstrap-loading",isLoading:i==null,errorMessage:n!=null?`${n}`:void 0}):c.jsx(Ps.Provider,{value:i,children:o})}function Ar(){return Ve(Rs,"No Plugins available in usePlugins. Was code wrapped in PluginsBootstrap or PluginsContext.Provider?")}function Fr(){return Ve(Ps,"No IdeConnection available in useConnection. Was code wrapped in ConnectionBootstrap or ConnectionContext.Provider?")}export{re as $,Io as A,ee as B,Hi as C,Vn as D,Tr as E,vt as F,Uo as G,wo as H,ie as I,Ae as J,z as K,yo as L,J as M,Gi as N,fn as O,Le as P,lo as Q,xo as R,Me as S,Fe as T,Kn as U,Eo as V,To as W,Dn as X,Ri as Y,Ko as Z,Pi as _,Ei as a,Rt as a0,Rn as a1,go as a2,Ki as a3,Ee as a4,Wi as a5,U as a6,as as a7,hs as a8,ls as a9,br as aA,Cr as aB,Sr as aC,Ai as aa,Fi as ab,Be as ac,Fr as ad,Ar as ae,Da as af,qt as ag,Ta as ah,Ea as ai,xs as aj,rs as ak,Rs as al,kr as am,qe as an,lr as ao,_a as ap,Ra as aq,zt as ar,Dr as as,la as at,Qa as au,Or as av,Ps as aw,hr as ax,Nr as ay,gr as az,xi as b,ze as c,nt as d,bt as e,Nt as f,yi as g,T as h,b as i,W as j,ot as k,Ir as l,Er as m,_ as n,q as o,de as p,X as q,ge as r,Ce as s,zi as t,Dt as u,Gn as v,wr as w,So as x,Co as y,jo as z};
5
+ //# sourceMappingURL=useConnection-4123360f.js.map