'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const __chunk_1 = require('./chunk-2755df65.js');

class DrupalNode {
    constructor(hostRef) {
        __chunk_1.registerInstance(this, hostRef);
    }
    componentDidLoad() {
        this.postRender();
    }
    componentDidUpdate() {
        this.postRender();
    }
    postRender() {
        let bodyField = this.el.querySelector('.field--name-body');
        if (this.data.attributes.body) {
            bodyField.innerHTML = this.data.attributes.body.value;
        }
        else {
            bodyField.innerHTML = '';
        }
    }
    parseNode(node) {
        // console.log(node);
        let type = node.type.split('--')[1];
        return node;
    }
    render() {
        let data;
        if (this.dataJson) {
            data = this.data = this.parseNode(JSON.parse(this.dataJson).data);
        }
        return (__chunk_1.h("article", { id: 'node-' + data.attributes.nid, class: 'node node--type-' + data.type.split('--')[1] + ' node--view-mode-full clearfix' }, __chunk_1.h("header", null, __chunk_1.h("h2", { class: "title node__title" }, data.attributes.title)), __chunk_1.h("div", { class: "node__content clearfix" }, __chunk_1.h("div", { class: "field field--name-body" }), data.attributes.field_iframe &&
            __chunk_1.h("div", { class: "field field--name-iframe" }, __chunk_1.h("ema-iframe", { src: data.attributes.field_iframe.uri, width: data.attributes.field_width, height: data.attributes.field_height })))));
    }
    get el() { return __chunk_1.getElement(this); }
    static get style() { return ":root{--ema-color:#343a40;--ema-primary:#007bff;--ema-secondary:#6c757d;--ema-success:#28a745;--ema-info:#17a2b8;--ema-warning:#ffc107;--ema-danger:#dc3545;--ema-light:#f8f9fa;--ema-dark:#343a40;--ema-background:#fff;--ema-background-diap:rgba(29,29,29,0.97);--ema-border-color:#c5c9cd;--ema-border:1px solid #c5c9cd;--ema-border-radius:3px 3px 3px 3px;--ema-box-shadow:1px 1px 10px 1px #ccc;--ema-margin:0.25rem;--ema-margin-sm:0.5rem;--ema-margin-md:1rem;--ema-margin-lg:1.5rem;--ema-margin-xl:2rem;--ema-padding:0.25rem;--ema-padding-sm:0.5rem;--ema-padding-md:1rem;--ema-padding-lg:1.5rem;--ema-padding-xl:2rem;--ema-gray-100:#f8f9fa;--ema-gray-200:#e9ecef;--ema-gray-300:#dee2e6;--ema-gray-400:#ced4da;--ema-gray-500:#adb5bd;--ema-gray-600:#868e96;--ema-gray-700:#495057;--ema-gray-800:#343a40;--ema-gray-900:#212529}ema-drupal-node .node .field{margin-bottom:var(--ema-padding-md,1rem)}"; }
}

exports.ema_drupal_node = DrupalNode;
