import { IsZSpaceAvailableUC } from "../../Dispatcher";
import { makeTransform3DPM, Transform3D } from "../../Transform3D";
import { makeXREntity } from "../../XR";
import { makeZSpaceEntity } from "../Entities";
import { makeZSpaceDisplayPM, makeZSpaceIsEnabledPM, makeZSpaceIsSupportedPM, makeZSpaceViewerScalePM, } from "../PM";
import { makeCheckZSpaceDisplaySizeUC, makeStylusFromGamepadHook, makeViewFromPoseHook, } from "../UC";
export function setupZSpace(appObjectRepo) {
    const zSpaceAO = appObjectRepo.getOrCreate("zSpace");
    Transform3D.addIfMissing(zSpaceAO);
    const zSpaceEntity = makeZSpaceEntity(zSpaceAO);
    makeXREntity(zSpaceAO);
    makeViewFromPoseHook(zSpaceAO);
    makeStylusFromGamepadHook(zSpaceAO);
    makeZSpaceIsEnabledPM(zSpaceAO);
    makeZSpaceViewerScalePM(zSpaceAO);
    makeCheckZSpaceDisplaySizeUC(zSpaceAO);
    const displayAO = zSpaceEntity.display.appObject;
    makeTransform3DPM(displayAO);
    makeZSpaceDisplayPM(displayAO);
    makeZSpaceIsSupportedPM(zSpaceAO);
    const checkForZSpace = IsZSpaceAvailableUC.get(appObjectRepo);
    if (checkForZSpace) {
        checkForZSpace.doDispatch().then((isSupported) => {
            zSpaceEntity.isSupported = isSupported;
        });
    }
    else {
        appObjectRepo.submitWarning("setupZSpace", "Unable to find IsZSpaceAvailableUC. A dispatcher needs to be setup before zSpace");
    }
    return zSpaceAO;
}
//# sourceMappingURL=setupZSpace.js.map