import { h } from "@stencil/core";
export class InternalTextRenderer {
    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 is() { return "internal-text-renderer"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["text-renderer.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["text-renderer.css"]
        };
    }
    static get properties() {
        return {
            "content": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "content",
                "defaultValue": "''"
            },
            "autoLink": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "auto-link",
                "defaultValue": "true"
            },
            "highlightCode": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "highlight-code",
                "defaultValue": "false"
            },
            "preserveWhitespace": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "preserve-whitespace",
                "defaultValue": "true"
            }
        };
    }
}
//# sourceMappingURL=text-renderer.js.map
