"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Common_1 = require("../Common");
const _ = require("lodash");
const uuid = require('@lukeed/uuid');
class Typography extends Common_1.default {
    constructor(params) {
        super();
        this.name = 'Typography';
        this.config = {};
        if (params.initType === 'auto') {
            this.config = params;
        }
        else {
            this.config = _.cloneDeep(require('./config').default);
            this.config.model.custom.type = params.type;
        }
    }
    wrapEditText(content) {
        const type = this.storage.get('preview_view_status') || 0;
        if (type === 0) {
            return `
        <edit-text-box :clearClass="true" uuid="${this.uuid}">
          ${content}
        </edit-text-box>
      `;
        }
        else {
            return content;
        }
    }
    fragment() {
        let typography = '';
        const label = _.get(this.config, 'model.custom.label');
        switch (this.config.model.custom.type) {
            case 'H1':
                typography = `
        <h1 class="s-typography">
          ${this.wrapEditText(label)}
        </h1>`;
                break;
            case 'H2':
                typography = `
        <h2 class="s-typography">
          ${this.wrapEditText(label)}
        </h2>`;
                break;
            case 'H3':
                typography = `
        <h3 class="s-typography">
          ${this.wrapEditText(label)}
        </h3>`;
                break;
            case 'H4':
                typography = `
        <h4 class="s-typography">
          ${this.wrapEditText(label)}
        </h4>`;
                break;
            case 'Text':
                typography = `
        <p class="s-typography">
          ${this.wrapEditText(label)}
        </p>`;
                break;
            case 'AText':
                typography = `
        <p class="s-typography minor-typography">
          ${this.wrapEditText(label)}
        </p>`;
                break;
            default:
                break;
        }
        return typography;
    }
    insertEditText(params) {
        this.config.model.custom.label = params.value;
    }
}
exports.default = Typography;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbGliL2FkYXB0ZXItdnVlL21vZHVsZXMvY29tcG9uZW50L1R5cG9ncmFwaHkvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFFQSxzQ0FBK0I7QUFDL0IsNEJBQTRCO0FBQzVCLE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