// retoor <retoor@molodetz.nl>

import { Component } from "./Component.js";

export class AiMarkdownFallback extends Component {
  static get observedAttributes() {
    return ["source"];
  }

  connectedCallback() {
    this.classList.add("ai-markdown-fallback");
    const pre = document.createElement("pre");
    pre.textContent = this.attr("source", this.textContent || "");
    this.innerHTML = "";
    this.appendChild(pre);
  }
}

if (!customElements.get("ai-markdown-fallback")) {
  customElements.define("ai-markdown-fallback", AiMarkdownFallback);
}

export default AiMarkdownFallback;
