import { getContext, setContext } from 'svelte';
export const ENVIRONMENT_CONTEXT_KEY = Symbol('environment');
const defaults = () => ({
    viewerMode: 'monitor',
    isStandalone: true,
});
export const createEnvironment = () => {
    const environment = $state(defaults());
    const context = {
        get current() {
            return environment;
        },
    };
    return context;
};
export const provideEnvironment = () => {
    const context = createEnvironment();
    setContext(ENVIRONMENT_CONTEXT_KEY, context);
    return context;
};
export const useEnvironment = () => {
    return getContext(ENVIRONMENT_CONTEXT_KEY);
};
