var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { ShadowlessElement, WithDisposable } from '@blockeditor/lit';
import { property } from 'lit/decorators.js';
export class EdgelessPortalBase extends WithDisposable(ShadowlessElement) {
    renderModel(model) {
        return this.surface.host.renderModel(model);
    }
    connectedCallback() {
        super.connectedCallback();
        this._disposables.add(this.model.propsUpdated.on(event => {
            this.edgeless.slots.elementUpdated.emit({
                id: this.model.id,
                props: {
                    [event.key]: this.model[event.key],
                },
            });
        }));
        this._disposables.add(this.edgeless.slots.elementUpdated.on(({ id }) => {
            if (id === this.model.id) {
                this.requestUpdate();
            }
        }));
    }
}
__decorate([
    property({ attribute: false })
], EdgelessPortalBase.prototype, "index", void 0);
__decorate([
    property({ attribute: false })
], EdgelessPortalBase.prototype, "model", void 0);
__decorate([
    property({ attribute: false })
], EdgelessPortalBase.prototype, "surface", void 0);
__decorate([
    property({ attribute: false })
], EdgelessPortalBase.prototype, "edgeless", void 0);
//# sourceMappingURL=edgeless-portal-base.js.map