{
  "version": 3,
  "sources": ["../../../src/react/PluginManagerProvider.ts", "../../../src/react/useCapabilities.ts", "../../../src/react/common.ts", "../../../src/react/ErrorBoundary.tsx", "../../../src/react/Surface.tsx", "../../../src/react/useIntentResolver.ts", "../../../src/App.tsx", "../../../src/helpers.ts"],
  "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { createContext, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { type PluginManager } from '../core';\n\nconst PluginManagerContext = createContext<PluginManager | undefined>(undefined);\n\n/**\n * Get the plugin manager.\n */\nexport const usePluginManager = (): PluginManager =>\n  useContext(PluginManagerContext) ?? raise(new Error('Missing PluginManagerContext'));\n\n/**\n * Context provider for a plugin manager.\n */\nexport const PluginManagerProvider = PluginManagerContext.Provider;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useRxValue } from '@effect-rx/rx-react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { usePluginManager } from './PluginManagerProvider';\nimport { type InterfaceDef } from '../core';\n\n/**\n * Hook to request capabilities from the plugin context.\n * @returns An array of capabilities.\n */\nexport const useCapabilities = <T>(interfaceDef: InterfaceDef<T>) => {\n  const manager = usePluginManager();\n  return useRxValue(manager.context.capabilities(interfaceDef));\n};\n\n/**\n * Hook to request a capability from the plugin context.\n * @returns The capability.\n * @throws If no capability is found.\n */\nexport const useCapability = <T>(interfaceDef: InterfaceDef<T>) => {\n  const capabilities = useCapabilities(interfaceDef);\n  invariant(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`);\n  return capabilities[0];\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCapability } from './useCapabilities';\nimport { Capabilities } from '../common';\n\nexport const useIntentDispatcher = () => useCapability(Capabilities.IntentDispatcher);\n\nexport const useAppGraph = () => useCapability(Capabilities.AppGraph);\n\nexport const useLayout = () => useCapability(Capabilities.Layout);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { Component, type FC, type PropsWithChildren } from 'react';\n\ntype Props = PropsWithChildren<{ data?: any; fallback: FC<{ data?: any; error: Error; reset: () => void }> }>;\ntype State = { error: Error | undefined };\n\n/**\n * Surface error boundary.\n *\n * For basic usage prefer providing a fallback component to `Surface`.\n *\n * For more information on error boundaries, see:\n * https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary\n */\nexport class ErrorBoundary extends Component<Props, State> {\n  constructor(props: Props) {\n    super(props);\n    this.state = { error: undefined };\n  }\n\n  static getDerivedStateFromError(error: Error): { error: Error } {\n    return { error };\n  }\n\n  override componentDidUpdate(prevProps: Props): void {\n    if (prevProps.data !== this.props.data) {\n      this.resetError();\n    }\n  }\n\n  override render(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined {\n    if (this.state.error) {\n      return <this.props.fallback data={this.props.data} error={this.state.error} reset={this.resetError} />;\n    }\n\n    return this.props.children;\n  }\n\n  private resetError(): void {\n    this.setState({ error: undefined });\n  }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { memo, forwardRef, Suspense, useMemo, Fragment } from 'react';\n\nimport { useDefaultValue } from '@dxos/react-hooks';\nimport { byPosition } from '@dxos/util';\n\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { useCapabilities } from './useCapabilities';\nimport { Capabilities, type SurfaceDefinition, type SurfaceProps } from '../common';\nimport { type PluginContext } from '../core';\n\nconst DEFAULT_PLACEHOLDER = <Fragment />;\n\n/**\n * @internal\n */\nexport const useSurfaces = () => {\n  const surfaces = useCapabilities(Capabilities.ReactSurface);\n  return useMemo(() => surfaces.flat(), [surfaces]);\n};\n\nconst findCandidates = (surfaces: SurfaceDefinition[], { role, data }: Pick<SurfaceProps, 'role' | 'data'>) => {\n  return Object.values(surfaces)\n    .filter((definition) =>\n      Array.isArray(definition.role) ? definition.role.includes(role) : definition.role === role,\n    )\n    .filter(({ filter }) => (filter ? filter(data ?? {}) : true))\n    .toSorted(byPosition);\n};\n\n/**\n * @returns `true` if there is a contributed surface which matches the specified role & data, `false` otherwise.\n */\nexport const isSurfaceAvailable = (context: PluginContext, { role, data }: Pick<SurfaceProps, 'role' | 'data'>) => {\n  const surfaces = context.getCapabilities(Capabilities.ReactSurface);\n  const candidates = findCandidates(surfaces.flat(), { role, data });\n  return candidates.length > 0;\n};\n\n/**\n * A surface is a named region of the screen that can be populated by plugins.\n */\nexport const Surface = memo(\n  forwardRef<HTMLElement, SurfaceProps>(\n    ({ id: _id, role, data: _data, limit, fallback, placeholder = DEFAULT_PLACEHOLDER, ...rest }, forwardedRef) => {\n      // TODO(wittjosiah): This will make all surfaces depend on a single signal.\n      //   This isn't ideal because it means that any change to the data will cause all surfaces to re-render.\n      //   This effectively means that plugin modules which contribute surfaces need to all be activated at startup.\n      //   This should be fine for now because it's how it worked prior to capabilities api anyways.\n      //   In the future, it would be nice to be able to bucket the surface contributions by role.\n      const surfaces = useSurfaces();\n      const data = useDefaultValue(_data, () => ({}));\n\n      // NOTE: Memoizing the candidates makes the surface not re-render based on reactivity within data.\n      const definitions = findCandidates(surfaces, { role, data });\n      const candidates = limit ? definitions.slice(0, limit) : definitions;\n      const nodes = candidates.map(({ component: Component, id }) => (\n        <Component ref={forwardedRef} key={id} id={id} role={role} data={data} limit={limit} {...rest} />\n      ));\n\n      const suspense = <Suspense fallback={placeholder}>{nodes}</Suspense>;\n\n      return fallback ? (\n        <ErrorBoundary data={data} fallback={fallback}>\n          {suspense}\n        </ErrorBoundary>\n      ) : (\n        suspense\n      );\n    },\n  ),\n);\n\nSurface.displayName = 'Surface';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useEffect } from 'react';\n\nimport { Capabilities } from '../common';\nimport { type AnyIntentResolver } from '../plugin-intent';\nimport { usePluginManager } from '../react';\n\nexport const useIntentResolver = (module: string, resolver: AnyIntentResolver) => {\n  const manager = usePluginManager();\n  useEffect(() => {\n    manager.context.contributeCapability({\n      module,\n      interface: Capabilities.IntentResolver,\n      implementation: resolver,\n    });\n\n    return () => manager.context.removeCapability(Capabilities.IntentResolver, resolver);\n  }, [module, resolver]);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { RegistryContext } from '@effect-rx/rx-react';\nimport { effect } from '@preact/signals-core';\nimport React, { useCallback, useEffect, useMemo, useState, type FC, type PropsWithChildren } from 'react';\n\nimport { invariant } from '@dxos/invariant';\nimport { live } from '@dxos/live-object';\nimport { useDefaultValue } from '@dxos/react-hooks';\n\nimport { Capabilities, Events } from './common';\nimport { PluginManager, type PluginManagerOptions, type Plugin } from './core';\nimport { topologicalSort } from './helpers';\nimport { ErrorBoundary, PluginManagerProvider, useCapabilities } from './react';\n\nconst ENABLED_KEY = 'dxos.org/app-framework/enabled';\n\nexport type CreateAppOptions = {\n  pluginManager?: PluginManager;\n  pluginLoader?: PluginManagerOptions['pluginLoader'];\n  plugins?: Plugin[];\n  core?: string[];\n  defaults?: string[];\n  placeholder?: FC<{ stage: number }>;\n  fallback?: ErrorBoundary['props']['fallback'];\n  cacheEnabled?: boolean;\n  safeMode?: boolean;\n};\n\n/**\n * Expected usage is for this to be the entrypoint of the application.\n * Initializes plugins and renders the root components.\n *\n * @example\n * const plugins = [LayoutPlugin(), MyPlugin()];\n * const core = [LayoutPluginId];\n * const default = [MyPluginId];\n * const fallback = <div>Initializing Plugins...</div>;\n * const App = createApp({ plugins, core, default, fallback });\n * createRoot(document.getElementById('root')!).render(\n *   <StrictMode>\n *     <App />\n *   </StrictMode>,\n * );\n *\n * @param params.pluginLoader A function which loads new plugins.\n * @param params.plugins All plugins available to the application.\n * @param params.core Core plugins which will always be enabled.\n * @param params.defaults Default plugins are enabled by default but can be disabled by the user.\n * @param params.placeholder Placeholder component to render during startup.\n * @param params.fallback Fallback component to render if an error occurs during startup.\n * @param params.cacheEnabled Whether to cache enabled plugins in localStorage.\n * @param params.safeMode Whether to enable safe mode, which disables optional plugins.\n */\nexport const useApp = ({\n  pluginManager,\n  pluginLoader: _pluginLoader,\n  plugins: _plugins,\n  core: _core,\n  defaults: _defaults,\n  placeholder,\n  fallback = DefaultFallback,\n  cacheEnabled = false,\n  safeMode = false,\n}: CreateAppOptions) => {\n  const plugins = useDefaultValue(_plugins, () => []);\n  const core = useDefaultValue(_core, () => plugins.map(({ meta }) => meta.id));\n  const defaults = useDefaultValue(_defaults, () => []);\n\n  // TODO(wittjosiah): Provide a custom plugin loader which supports loading via url.\n  const pluginLoader = useMemo(\n    () =>\n      _pluginLoader ??\n      ((id: string) => {\n        const plugin = plugins.find((plugin) => plugin.meta.id === id);\n        invariant(plugin, `Plugin not found: ${id}`);\n        return plugin;\n      }),\n    [_pluginLoader, plugins],\n  );\n\n  const state = useMemo(() => live({ ready: false, error: null }), []);\n  const cached: string[] = useMemo(() => JSON.parse(localStorage.getItem(ENABLED_KEY) ?? '[]'), []);\n  const enabled = useMemo(\n    () => (safeMode ? [] : cacheEnabled && cached.length > 0 ? cached : defaults),\n    [safeMode, cacheEnabled, cached, defaults],\n  );\n  const manager = useMemo(\n    () => pluginManager ?? new PluginManager({ pluginLoader, plugins, core, enabled }),\n    [pluginManager, pluginLoader, plugins, core, enabled],\n  );\n\n  useEffect(() => {\n    return manager.activation.on(({ event, state: _state, error }) => {\n      // Once the app is ready the first time, don't show the fallback again.\n      if (!state.ready && event === Events.Startup.id) {\n        state.ready = _state === 'activated';\n      }\n\n      if (error && !state.ready && !state.error) {\n        state.error = error;\n      }\n    });\n  }, [manager, state]);\n\n  useEffect(() => {\n    effect(() => {\n      cacheEnabled && localStorage.setItem(ENABLED_KEY, JSON.stringify(manager.enabled));\n    });\n  }, [cacheEnabled, manager]);\n\n  useEffect(() => {\n    manager.context.contributeCapability({\n      interface: Capabilities.PluginManager,\n      implementation: manager,\n      module: 'dxos.org/app-framework/plugin-manager',\n    });\n\n    manager.context.contributeCapability({\n      interface: Capabilities.RxRegistry,\n      implementation: manager.registry,\n      module: 'dxos.org/app-framework/rx-registry',\n    });\n\n    return () => {\n      manager.context.removeCapability(Capabilities.PluginManager, manager);\n      manager.context.removeCapability(Capabilities.RxRegistry, manager.registry);\n    };\n  }, [manager]);\n\n  useEffect(() => {\n    setupDevtools(manager);\n  }, [manager]);\n\n  useEffect(() => {\n    const timeout = setTimeout(async () => {\n      await Promise.all([\n        // TODO(wittjosiah): Factor out such that this could be called per surface role when attempting to render.\n        manager.activate(Events.SetupReactSurface),\n        manager.activate(Events.Startup),\n      ]);\n    });\n\n    return () => clearTimeout(timeout);\n  }, [manager]);\n\n  return useCallback(\n    () => (\n      <ErrorBoundary fallback={fallback}>\n        <PluginManagerProvider value={manager}>\n          <RegistryContext.Provider value={manager.registry}>\n            <App placeholder={placeholder} state={state} />\n          </RegistryContext.Provider>\n        </PluginManagerProvider>\n      </ErrorBoundary>\n    ),\n    [fallback, manager, placeholder, state],\n  );\n};\n\nconst DELAY_PLACEHOLDER = 2_000;\n\nenum LoadingState {\n  Loading = 0,\n  FadeIn = 1,\n  FadeOut = 2,\n  Done = 3,\n}\n\n/**\n * To avoid \"flashing\" the placeholder, we wait a period of time before starting the loading animation.\n * If loading completes during this time the placehoder is not shown, otherwise is it displayed for a minimum period of time.\n *\n * States:\n * 0: Loading   - Wait for a period of time before starting the loading animation.\n * 1: Fade-in   - Display a loading animation.\n * 2: Fade-out  - Fade out the loading animation.\n * 3: Done      - Remove the placeholder.\n */\nconst useLoading = (state: AppProps['state']) => {\n  const [stage, setStage] = useState<LoadingState>(LoadingState.Loading);\n  useEffect(() => {\n    const i = setInterval(() => {\n      setStage((tick) => {\n        switch (tick) {\n          case LoadingState.Loading:\n            if (!state.ready) {\n              return LoadingState.FadeIn;\n            } else {\n              clearInterval(i);\n              return LoadingState.Done;\n            }\n          case LoadingState.FadeIn:\n            if (state.ready) {\n              return LoadingState.FadeOut;\n            }\n            break;\n          case LoadingState.FadeOut:\n            clearInterval(i);\n            return LoadingState.Done;\n        }\n\n        return tick;\n      });\n    }, DELAY_PLACEHOLDER);\n\n    return () => clearInterval(i);\n  }, []);\n\n  return stage;\n};\n\ntype AppProps = Pick<CreateAppOptions, 'placeholder'> & {\n  state: { ready: boolean; error: unknown };\n};\n\nconst App = ({ placeholder: Placeholder, state }: AppProps) => {\n  const reactContexts = useCapabilities(Capabilities.ReactContext);\n  const reactRoots = useCapabilities(Capabilities.ReactRoot);\n  const stage = useLoading(state);\n\n  if (state.error) {\n    // This triggers the error boundary to provide UI feedback for the startup error.\n    throw state.error;\n  }\n\n  // TODO(wittjosiah): Consider using Suspense instead?\n  if (stage < LoadingState.Done) {\n    if (!Placeholder) {\n      return null;\n    }\n\n    return <Placeholder stage={stage} />;\n  }\n\n  const ComposedContext = composeContexts(reactContexts);\n  return (\n    <ComposedContext>\n      {reactRoots.map(({ id, root: Component }) => (\n        <Component key={id} />\n      ))}\n    </ComposedContext>\n  );\n};\n\n// Default fallback does not use tailwind or theme.\nconst DefaultFallback = ({ error }: { error: Error }) => {\n  return (\n    <div style={{ padding: '1rem' }}>\n      {/* TODO(wittjosiah): Link to docs for replacing default. */}\n      <h1 style={{ fontSize: '1.2rem', fontWeight: 700, margin: '0.5rem 0' }}>{error.message}</h1>\n      <pre>{error.stack}</pre>\n    </div>\n  );\n};\n\nconst composeContexts = (contexts: Capabilities.ReactContext[]) => {\n  if (contexts.length === 0) {\n    return ({ children }: PropsWithChildren) => <>{children}</>;\n  }\n\n  return topologicalSort(contexts)\n    .map(({ context }) => context)\n    .reduce((Acc, Next) => ({ children }) => (\n      <Acc>\n        <Next>{children}</Next>\n      </Acc>\n    ));\n};\n\nconst setupDevtools = (manager: PluginManager) => {\n  (globalThis as any).composer ??= {};\n  (globalThis as any).composer.manager = manager;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\ntype DependencyNode = {\n  id: string;\n  dependsOn?: string[];\n};\n\n/**\n * Topologically sorts a list of nodes based on their dependencies.\n */\n// TODO(wittjosiah): Factor out?\nexport const topologicalSort = <T extends DependencyNode>(nodes: T[]): T[] => {\n  const getDependencies = (nodeId: string, seen = new Set<string>(), path = new Set<string>()): string[] => {\n    if (path.has(nodeId)) {\n      throw new Error(`Circular dependency detected involving ${nodeId}`);\n    }\n    if (seen.has(nodeId)) {\n      return [];\n    }\n\n    const node = nodes.find((n) => n.id === nodeId);\n    if (!node) {\n      throw new Error(`Node ${nodeId} not found but is listed as a dependency`);\n    }\n\n    const newPath = new Set([...path, nodeId]);\n    const newSeen = new Set([...seen, nodeId]);\n\n    const dependsOn = node.dependsOn ?? [];\n    return [...dependsOn.flatMap((depId) => getDependencies(depId, newSeen, newPath)), nodeId];\n  };\n\n  // Get all unique dependencies.\n  const allDependencies = nodes\n    .map((node) => node.id)\n    .flatMap((id) => getDependencies(id))\n    .filter((id, index, self) => self.indexOf(id) === index);\n\n  // Map back to original nodes\n  return allDependencies\n    .map((id) => nodes.find((node) => node.id === id))\n    .filter((node): node is T => node !== undefined);\n};\n"],
  "mappings": ";;;;;;;AAIA,SAASA,eAAeC,kBAAkB;AAE1C,SAASC,aAAa;AAItB,IAAMC,uBAAuBC,cAAyCC,MAAAA;AAK/D,IAAMC,mBAAmB,MAC9BC,WAAWJ,oBAAAA,KAAyBK,MAAM,IAAIC,MAAM,8BAAA,CAAA;AAK/C,IAAMC,wBAAwBP,qBAAqBQ;;;ACjB1D,SAASC,kBAAkB;AAE3B,SAASC,iBAAiB;;AASnB,IAAMC,kBAAkB,CAAIC,iBAAAA;AACjC,QAAMC,UAAUC,iBAAAA;AAChB,SAAOC,WAAWF,QAAQG,QAAQC,aAAaL,YAAAA,CAAAA;AACjD;AAOO,IAAMM,gBAAgB,CAAIN,iBAAAA;AAC/B,QAAMK,eAAeN,gBAAgBC,YAAAA;AACrCO,YAAUF,aAAaG,SAAS,GAAG,2BAA2BR,aAAaS,UAAU,IAAE;;;;;;;;;AACvF,SAAOJ,aAAa,CAAA;AACtB;;;ACtBO,IAAMK,sBAAsB,MAAMC,cAAcC,aAAaC,gBAAgB;AAE7E,IAAMC,cAAc,MAAMH,cAAcC,aAAaG,QAAQ;AAE7D,IAAMC,YAAY,MAAML,cAAcC,aAAaK,MAAM;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,gBAAAN,OAAA,cAACM,YAAAA;MAAUC,KAAKH;;;;;AAIxB;AAGA,IAAMI,kBAAkB,CAAC,EAAET,MAAK,MAAoB;;;AAClD,WACE,gBAAAC,OAAA,cAACS,OAAAA;MAAIC,OAAO;QAAEC,SAAS;MAAO;OAE5B,gBAAAX,OAAA,cAACY,MAAAA;MAAGF,OAAO;QAAEG,UAAU;QAAUC,YAAY;QAAKC,QAAQ;MAAW;OAAIhB,MAAMiB,OAAO,GACtF,gBAAAhB,OAAA,cAACiB,OAAAA,MAAKlB,MAAMmB,KAAK,CAAA;;;;AAGvB;AAEA,IAAMhB,kBAAkB,CAACiB,aAAAA;AACvB,MAAIA,SAASC,WAAW,GAAG;AACzB,WAAO,CAAC,EAAEC,SAAQ,MAA0B,gBAAArB,OAAA,cAAAA,OAAA,UAAA,MAAGqB,QAAAA;EACjD;AAEA,SAAOC,gBAAgBH,QAAAA,EACpBhB,IAAI,CAAC,EAAEoB,QAAO,MAAOA,OAAAA,EACrBC,OAAO,CAACC,KAAKC,SAAS,CAAC,EAAEL,SAAQ,MAChC,gBAAArB,OAAA,cAACyB,KAAAA,MACC,gBAAAzB,OAAA,cAAC0B,MAAAA,MAAML,QAAAA,CAAAA,CAAAA;AAGf;AAEA,IAAMM,gBAAgB,CAACC,YAAAA;AACpBC,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAASF,UAAUA;AACzC;",
  "names": ["createContext", "useContext", "raise", "PluginManagerContext", "createContext", "undefined", "usePluginManager", "useContext", "raise", "Error", "PluginManagerProvider", "Provider", "useRxValue", "invariant", "useCapabilities", "interfaceDef", "manager", "usePluginManager", "useRxValue", "context", "capabilities", "useCapability", "invariant", "length", "identifier", "useIntentDispatcher", "useCapability", "Capabilities", "IntentDispatcher", "useAppGraph", "AppGraph", "useLayout", "Layout", "React", "Component", "ErrorBoundary", "Component", "props", "state", "error", "undefined", "getDerivedStateFromError", "componentDidUpdate", "prevProps", "data", "resetError", "render", "this", "fallback", "reset", "children", "setState", "React", "memo", "forwardRef", "Suspense", "useMemo", "Fragment", "useDefaultValue", "byPosition", "DEFAULT_PLACEHOLDER", "React", "Fragment", "useSurfaces", "surfaces", "useCapabilities", "Capabilities", "ReactSurface", "useMemo", "flat", "findCandidates", "role", "data", "Object", "values", "filter", "definition", "Array", "isArray", "includes", "toSorted", "byPosition", "isSurfaceAvailable", "context", "getCapabilities", "candidates", "length", "Surface", "memo", "forwardRef", "id", "_id", "_data", "limit", "fallback", "placeholder", "rest", "forwardedRef", "useDefaultValue", "definitions", "slice", "nodes", "map", "component", "Component", "ref", "key", "suspense", "Suspense", "ErrorBoundary", "displayName", "useEffect", "useIntentResolver", "module", "resolver", "manager", "usePluginManager", "useEffect", "context", "contributeCapability", "interface", "Capabilities", "IntentResolver", "implementation", "removeCapability", "RegistryContext", "effect", "React", "useCallback", "useEffect", "useMemo", "useState", "invariant", "live", "useDefaultValue", "topologicalSort", "nodes", "getDependencies", "nodeId", "seen", "Set", "path", "has", "Error", "node", "find", "n", "id", "newPath", "newSeen", "dependsOn", "flatMap", "depId", "allDependencies", "map", "filter", "index", "self", "indexOf", "undefined", "ENABLED_KEY", "useApp", "pluginManager", "pluginLoader", "_pluginLoader", "plugins", "_plugins", "core", "_core", "defaults", "_defaults", "placeholder", "fallback", "DefaultFallback", "cacheEnabled", "safeMode", "useDefaultValue", "map", "meta", "id", "useMemo", "plugin", "find", "invariant", "state", "live", "ready", "error", "cached", "JSON", "parse", "localStorage", "getItem", "enabled", "length", "manager", "PluginManager", "useEffect", "activation", "on", "event", "_state", "Events", "Startup", "effect", "setItem", "stringify", "context", "contributeCapability", "interface", "Capabilities", "implementation", "module", "RxRegistry", "registry", "removeCapability", "setupDevtools", "timeout", "setTimeout", "Promise", "all", "activate", "SetupReactSurface", "clearTimeout", "useCallback", "React", "ErrorBoundary", "PluginManagerProvider", "value", "RegistryContext", "Provider", "App", "DELAY_PLACEHOLDER", "useLoading", "state", "stage", "setStage", "useState", "useEffect", "i", "setInterval", "tick", "ready", "clearInterval", "DELAY_PLACEHOLDER", "App", "placeholder", "Placeholder", "reactContexts", "useCapabilities", "Capabilities", "ReactContext", "reactRoots", "ReactRoot", "error", "React", "ComposedContext", "composeContexts", "map", "id", "root", "Component", "key", "DefaultFallback", "div", "style", "padding", "h1", "fontSize", "fontWeight", "margin", "message", "pre", "stack", "contexts", "length", "children", "topologicalSort", "context", "reduce", "Acc", "Next", "setupDevtools", "manager", "globalThis", "composer"]
}
