//
// Copyright 2022 DXOS.org
//
import '@dxos-theme';
import React, { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { initializeAppObservability } from '@dxos/observability';
import { Config, Defaults, Remote, Storage } from '@dxos/react-client';
import { DevtoolsApp as App } from './app';
import { namespace } from './hooks';
const main = async () => {
    void initializeAppObservability({ namespace, config: new Config(Defaults()) });
    const searchProps = new URLSearchParams(window.location.search);
    const target = searchProps.get('target') ?? undefined;
    // TODO(nf): read wsAuthToken from localStorage?
    const wsAuthToken = searchProps.get('wsAuthToken') ?? undefined;
    const sources = target ? [Remote(target, wsAuthToken), Defaults()] : [await Storage(), Defaults()];
    const config = new Config(...sources);
    createRoot(document.getElementById('root')).render(React.createElement(StrictMode, null,
        React.createElement(App, { config: config })));
};
void main();
//# sourceMappingURL=main.js.map