import { p as proxyCustomElement, H, h } from './p-bC5GQxyL.js';

const textRendererCss = ":host{--text-color:#333;--link-color:#007bff;--code-bg:#f8f9fa;--code-color:#e83e8c;--code-border:#e9ecef}.text-renderer{color:var(--text-color);line-height:1.6;word-wrap:break-word}.text-renderer a{color:var(--link-color);text-decoration:none;border-bottom:1px solid transparent;transition:border-color 0.2s}.text-renderer a:hover{border-bottom-color:var(--link-color)}.text-renderer code{background:var(--code-bg);color:var(--code-color);padding:2px 4px;border-radius:3px;font-family:'Monaco', 'Menlo', 'Ubuntu Mono', monospace;font-size:0.9em;border:1px solid var(--code-border)}";

const InternalTextRenderer = /*@__PURE__*/ proxyCustomElement(class InternalTextRenderer extends H {
    constructor(registerHost) {
        super();
        if (registerHost !== false) {
            this.__registerHost();
        }
        this.__attachShadow();
    }
    content = '';
    autoLink = true;
    highlightCode = false;
    preserveWhitespace = true;
    processContent() {
        if (!this.content)
            return '';
        let processedContent = this.content;
        // 保留换行符
        if (this.preserveWhitespace) {
            processedContent = processedContent.replace(/\n/g, '<br>');
        }
        // 自动链接识别
        if (this.autoLink) {
            const urlRegex = /(https?:\/\/[^\s]+)/g;
            processedContent = processedContent.replace(urlRegex, '<a href="$1" target="_blank" rel="noopener noreferrer">$1</a>');
        }
        // 代码高亮（简单实现）
        if (this.highlightCode) {
            const codeRegex = /`([^`]+)`/g;
            processedContent = processedContent.replace(codeRegex, '<code>$1</code>');
        }
        return processedContent;
    }
    render() {
        return (h("div", { key: '3d25ad4fcb4370ed26f8cf0f85f16cc544c53763', class: "text-renderer", innerHTML: this.processContent() }));
    }
    static get style() { return textRendererCss; }
}, [257, "internal-text-renderer", {
        "content": [1],
        "autoLink": [4, "auto-link"],
        "highlightCode": [4, "highlight-code"],
        "preserveWhitespace": [4, "preserve-whitespace"]
    }]);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["internal-text-renderer"];
    components.forEach(tagName => { switch (tagName) {
        case "internal-text-renderer":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, InternalTextRenderer);
            }
            break;
    } });
}
defineCustomElement();

export { InternalTextRenderer as I, defineCustomElement as d };
//# sourceMappingURL=p-BmDC0_8E.js.map

//# sourceMappingURL=p-BmDC0_8E.js.map