import { AppObjectPM } from "@vived/core";
import { ThemeColors, ThemeColorType } from "../Entities/ThemeColors";
export class ThemeColorMapPM extends AppObjectPM {
    vmsAreEqual(a, b) {
        return false;
    }
    constructor(appObject) {
        super(appObject, ThemeColorMapPM.type);
        this.onThemeColorMapChange = () => {
            const colorMap = new Map();
            for (const themeColor in ThemeColorType) {
                if (!this.themeColors)
                    return;
                const castType = themeColor;
                colorMap.set(castType, this.themeColors.getColorForType(castType));
            }
            this.doUpdateView(colorMap);
        };
        this.dispose = () => {
            super.dispose();
            this.themeColors?.removeChangeObserver(this.onThemeColorMapChange);
        };
        this.themeColors = ThemeColors.get(appObject.appObjectRepo);
        if (!this.themeColors) {
            this.warn("ThemeColorMapPM is being added to an object that does not have a ThemeColors Entity");
            return;
        }
        else {
            this.themeColors.addChangeObserver(this.onThemeColorMapChange);
            this.onThemeColorMapChange();
        }
    }
}
ThemeColorMapPM.type = "ThemeColorMapPM";
//# sourceMappingURL=ThemeColorMapPM.js.map