import { getContext, setContext } from 'svelte';
const key = Symbol('origin-context');
export const provideOrigin = () => {
    const position = $state([0, 0, 0]);
    let rotation = $state(0);
    setContext(key, {
        get position() {
            return position;
        },
        get rotation() {
            return rotation;
        },
        set(pos, rot) {
            if (pos) {
                position[0] = pos[0];
                position[1] = pos[1];
                position[2] = pos[2];
            }
            if (rot !== undefined) {
                rotation = rot;
            }
        },
    });
};
export const useOrigin = () => {
    return getContext(key);
};
