"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CalloutOffsetPM = void 0;
exports.makeCalloutOffsetPM = makeCalloutOffsetPM;
const core_1 = require("@vived/core");
const CalloutEntity_1 = require("../Entities/CalloutEntity");
class CalloutOffsetPM extends core_1.AppObjectPM {
    static get(id, appObjects) {
        return appObjects
            .get(id)
            ?.getComponent(CalloutOffsetPM.type);
    }
}
exports.CalloutOffsetPM = CalloutOffsetPM;
CalloutOffsetPM.type = "CalloutOffsetPM";
function makeCalloutOffsetPM(appObject) {
    return new CalloutOffsetPMImp(appObject);
}
class CalloutOffsetPMImp extends CalloutOffsetPM {
    get callout() {
        return this.getCachedLocalComponent(CalloutEntity_1.CalloutEntity.type);
    }
    vmsAreEqual(a, b) {
        return a === b;
    }
    constructor(appObject) {
        super(appObject, CalloutOffsetPM.type);
        this.onChange = () => {
            if (!this.callout)
                return;
            this.doUpdateView(this.callout.offsetDirection);
        };
        this.callout?.addChangeObserver(this.onChange);
        this.onChange();
    }
}
//# sourceMappingURL=CalloutOffsetPM.js.map