import { hasLink, linkify } from '@dvn/alaca/utils/utils';
import { Component, h, Host, Prop } from '@stencil/core';
export class DvnFieldDisplayCellText {
  render() {
    const { field } = this;
    let value = this.value;
    if (!value) {
      return (h(Host, null));
    }
    if (field.inputType === 'url') {
      value = h("a", { href: value.startsWith('http') ? value : `http://${value}`, target: "_blank" }, value);
    }
    else if (hasLink(this.value)) {
      return (h(Host, { innerHTML: linkify(value) }));
    }
    if (field.format === 'markdown') {
      return (h(Host, null,
        h("dvn-markdown", { content: value })));
    }
    return (h(Host, null, value));
  }
  static get is() { return "dvn-field-display-cell-text"; }
  static get encapsulation() { return "scoped"; }
  static get originalStyleUrls() { return {
    "$": ["dvn-field-display-cell-text.css"]
  }; }
  static get styleUrls() { return {
    "$": ["dvn-field-display-cell-text.css"]
  }; }
  static get properties() { return {
    "value": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "value",
      "reflect": false
    },
    "field": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "TextField",
        "resolved": "TextField",
        "references": {
          "TextField": {
            "location": "import",
            "path": "../text"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    }
  }; }
}
