"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClearCustomLabelUC = void 0;
const core_1 = require("@vived/core");
const Dispatcher_1 = require("../../Dispatcher");
const Entities_1 = require("../Entities");
const ClearCustomLabelUndoRedo_1 = require("./ClearCustomLabelUndoRedo");
class ClearCustomLabelUC extends core_1.AppObjectUC {
    get label() {
        return this.getCachedLocalComponent(Entities_1.LabelEntity.type);
    }
    constructor(appObject) {
        super(appObject, ClearCustomLabelUC.type);
        this.clearCustomLabel = () => {
            if (!this.label) {
                this.warn("[ClearCustomLabelUC] Unable to get Entity");
                return;
            }
            if (this.label.custom === "")
                return;
            const prevLabel = this.label.custom;
            this.label.custom = "";
            new ClearCustomLabelUndoRedo_1.ClearCustomLabelUndoRedo(prevLabel, this.appObject);
            (0, Dispatcher_1.dispatchStateChange)(this.appObjects);
        };
    }
    static get(appObj) {
        return appObj.getComponent(this.type);
    }
}
exports.ClearCustomLabelUC = ClearCustomLabelUC;
ClearCustomLabelUC.type = "ClearCustomLabelUC";
//# sourceMappingURL=ClearCustomLabelUC.js.map