"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnvironmentalIntensityPM = void 0;
exports.makeEnvironmentalIntensityPM = makeEnvironmentalIntensityPM;
const core_1 = require("@vived/core");
const Environment_1 = require("../Entities/Environment");
class EnvironmentalIntensityPM extends core_1.AppObjectPM {
}
exports.EnvironmentalIntensityPM = EnvironmentalIntensityPM;
EnvironmentalIntensityPM.type = "EnvironmentalIntensityPM";
EnvironmentalIntensityPM.get = (appObjects) => (0, core_1.getSingletonComponent)(EnvironmentalIntensityPM.type, appObjects);
function makeEnvironmentalIntensityPM(appObject) {
    return new EnvironmentalIntensityPMImp(appObject);
}
class EnvironmentalIntensityPMImp extends EnvironmentalIntensityPM {
    vmsAreEqual(a, b) {
        return a === b;
    }
    get entity() {
        return this.getCachedSingleton(Environment_1.EnvironmentEntity.type);
    }
    constructor(appObject) {
        super(appObject, EnvironmentalIntensityPM.type);
        this.onEntityChange = () => {
            if (!this.entity)
                return;
            this.doUpdateView(this.entity.intensity);
        };
        this.entity?.addChangeObserver(this.onEntityChange);
        this.onEntityChange();
        this.appObjects.registerSingleton(this);
    }
}
//# sourceMappingURL=EnvironmentalIntensityPM.js.map