"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setupZSpace = setupZSpace;
const Dispatcher_1 = require("../../Dispatcher");
const Transform3D_1 = require("../../Transform3D");
const XR_1 = require("../../XR");
const Entities_1 = require("../Entities");
const PM_1 = require("../PM");
const UC_1 = require("../UC");
function setupZSpace(appObjectRepo) {
    const zSpaceAO = appObjectRepo.getOrCreate("zSpace");
    Transform3D_1.Transform3D.addIfMissing(zSpaceAO);
    const zSpaceEntity = (0, Entities_1.makeZSpaceEntity)(zSpaceAO);
    (0, XR_1.makeXREntity)(zSpaceAO);
    (0, UC_1.makeViewFromPoseHook)(zSpaceAO);
    (0, UC_1.makeStylusFromGamepadHook)(zSpaceAO);
    (0, PM_1.makeZSpaceIsEnabledPM)(zSpaceAO);
    (0, PM_1.makeZSpaceViewerScalePM)(zSpaceAO);
    (0, UC_1.makeCheckZSpaceDisplaySizeUC)(zSpaceAO);
    const displayAO = zSpaceEntity.display.appObject;
    (0, Transform3D_1.makeTransform3DPM)(displayAO);
    (0, PM_1.makeZSpaceDisplayPM)(displayAO);
    (0, PM_1.makeZSpaceIsSupportedPM)(zSpaceAO);
    const checkForZSpace = Dispatcher_1.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