"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZSpaceIsEnabledPM = void 0;
exports.makeZSpaceIsEnabledPM = makeZSpaceIsEnabledPM;
const core_1 = require("@vived/core");
const ZSpaceEntity_1 = require("../Entities/ZSpaceEntity");
class ZSpaceIsEnabledPM extends core_1.AppObjectPM {
}
exports.ZSpaceIsEnabledPM = ZSpaceIsEnabledPM;
ZSpaceIsEnabledPM.type = "ZSpaceIsEnabledPM";
ZSpaceIsEnabledPM.get = (appObjects) => (0, core_1.getSingletonComponent)(ZSpaceIsEnabledPM.type, appObjects);
function makeZSpaceIsEnabledPM(appObject) {
    return new ZSpaceIsEnabledPMImp(appObject);
}
class ZSpaceIsEnabledPMImp extends ZSpaceIsEnabledPM {
    get zSpace() {
        return this.getCachedSingleton(ZSpaceEntity_1.ZSpaceEntity.type);
    }
    vmsAreEqual(a, b) {
        return a === b;
    }
    constructor(appObject) {
        super(appObject, ZSpaceIsEnabledPM.type);
        this.onZSpaceChange = () => {
            if (!this.zSpace)
                return;
            this.doUpdateView(this.zSpace.enabled);
        };
        this.zSpace?.addChangeObserver(this.onZSpaceChange);
        this.onZSpaceChange();
        this.appObjects.registerSingleton(this);
    }
}
//# sourceMappingURL=ZSpaceIsEnabledPM.js.map