import { __awaiter, __decorate } from "tslib";
import { Component, ChangeDetectionStrategy, Input } from '@angular/core';
import { LayoutComponentBase } from '@anglr/dynamic/layout';
import { LayoutEditorMetadata } from '@anglr/dynamic/layout-editor';
import { DebugData } from '@anglr/dynamic/relations';
import { RelationsEditorMetadata } from '@anglr/dynamic/relations-editor';
import { HostDisplayBlockStyle } from '@anglr/common';
import { nameof } from '@jscrpt/common';
import { HtmlBlockLayoutMetadataLoader, HtmlBlockRelationsMetadataLoader } from './htmlBlock.metadata';
import * as i0 from "@angular/core";
/**
 * Component used for displaying html block
 */
let HtmlBlockSAComponent = class HtmlBlockSAComponent extends LayoutComponentBase {
    //######################### public methods - implementation of OnChanges #########################
    /**
     * @inheritdoc
     */
    ngOnChanges(changes) {
        const _super = Object.create(null, {
            ngOnChanges: { get: () => super.ngOnChanges }
        });
        var _a;
        return __awaiter(this, void 0, void 0, function* () {
            yield _super.ngOnChanges.call(this, changes);
            if (nameof('content') in changes) {
                this.componentElement.nativeElement.innerHTML = (_a = this.content) !== null && _a !== void 0 ? _a : '';
            }
        });
    }
    //######################### protected - overrides #########################
    /**
     * @inheritdoc
     */
    onOptionsSet() {
        var _a, _b;
        if (!this.initialized) {
            return;
        }
        if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.content) {
            this.content = this.options.content;
            this.componentElement.nativeElement.innerHTML = (_b = this.content) !== null && _b !== void 0 ? _b : '';
        }
    }
};
HtmlBlockSAComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: HtmlBlockSAComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
HtmlBlockSAComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.4", type: HtmlBlockSAComponent, isStandalone: true, selector: "html-block", inputs: { content: "content" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '', isInline: true, styles: [":host{display: block;}"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
HtmlBlockSAComponent = __decorate([
    DebugData({
        inputs: [
            nameof('content'),
        ],
    }),
    RelationsEditorMetadata(HtmlBlockRelationsMetadataLoader),
    LayoutEditorMetadata(HtmlBlockLayoutMetadataLoader)
], HtmlBlockSAComponent);
export { HtmlBlockSAComponent };
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: HtmlBlockSAComponent, decorators: [{
            type: Component,
            args: [{ selector: 'html-block', template: '', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display: block;}"] }]
        }], propDecorators: { content: [{
                type: Input
            }] } });
//# sourceMappingURL=htmlBlock.component.js.map