import { AppObjectUC } from "@vived/core";
import { BaseAppState } from "../../BaseApp";
import { LabelDropRepo } from "../Entities";
export class ClearEditingLabelDropUCHook extends AppObjectUC {
    get baseApp() {
        return this.getCachedSingleton(BaseAppState.type);
    }
    get labelDropRepo() {
        return this.getCachedSingleton(LabelDropRepo.type);
    }
    constructor(appObject) {
        super(appObject, ClearEditingLabelDropUCHook.type);
        this.onBaseAppChange = () => {
            if (!this.baseApp || !this.labelDropRepo) {
                this.warn("Missing Components");
                return;
            }
            if (this.baseApp.isAuthoring === this.lastAuthoringState)
                return;
            if (this.baseApp.isAuthoring === false) {
                this.labelDropRepo.editingID = undefined;
            }
            this.lastAuthoringState = this.baseApp.isAuthoring;
        };
        this.baseApp?.addChangeObserver(this.onBaseAppChange);
    }
}
ClearEditingLabelDropUCHook.type = "ClearEditingLabelDropUCHook";
//# sourceMappingURL=ClearEditingLabelDropUCHook.js.map