/**
 * Generate a complete HTML document from content
 *
 * @param content - The HTML content string
 * @param title - The document title
 * @param styles - Additional CSS styles to include
 * @returns A complete HTML document as a string
 */ export var generateHtmlDocument = function(content) {
    var title = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'Markdown Export', styles = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : '';
    return '<!DOCTYPE html>\n<html>\n<head>\n  <meta charset="UTF-8">\n  <meta name="viewport" content="width=device-width, initial-scale=1.0">\n  <title>'.concat(title, "</title>\n  <style>\n    body {\n      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n      line-height: 1.6;\n      padding: 12px;\n      max-width: 900px;\n      margin: 0 auto;\n      color: #333;\n    }\n    pre {\n      background-color: #f6f8fa;\n      border-radius: 3px;\n      padding: 16px;\n      overflow: auto;\n    }\n    code {\n      background-color: rgba(27, 31, 35, 0.05);\n      border-radius: 3px;\n      padding: 0.2em 0.4em;\n      font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;\n    }\n    blockquote {\n      border-left: 4px solid #ddd;\n      padding-left: 16px;\n      margin-left: 0;\n      color: #666;\n    }\n    img {\n      max-width: 100%;\n    }\n    table {\n      border-collapse: collapse;\n      width: 100%;\n      margin-bottom: 16px;\n    }\n    table, th, td {\n      border: 1px solid #ddd;\n    }\n    th, td {\n      padding: 8px;\n      text-align: left;\n      vertical-align: middle;\n    }\n    th {\n      background-color: #f6f8fa;\n    }\n    @media screen and (max-width: 768px) {\n      th, td {\n        padding: 2px;\n      }\n    }\n    ").concat(styles, "\n  </style>\n</head>\n<body>\n  ").concat(content, "\n</body>\n</html>");
};
/**
 * Export HTML content to a file
 *
 * @param htmlContent - The HTML content to export
 * @param filename - The name of the file to save
 */ export var exportHtml = function(htmlContent) {
    var filename = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'export.html';
    try {
        var fullHtml = generateHtmlDocument(htmlContent);
        var blob = new Blob([
            fullHtml
        ], {
            type: 'text/html;charset=utf-8'
        });
        // Create download link
        var url = URL.createObjectURL(blob);
        var a = document.createElement('a');
        a.href = url;
        a.download = filename;
        // Trigger download
        document.body.appendChild(a);
        a.click();
        // Cleanup
        setTimeout(function() {
            if (typeof document !== 'undefined') {
                document.body.removeChild(a);
            }
            URL.revokeObjectURL(url);
        }, 100);
    } catch (error) {
        console.error('Error exporting HTML:', error);
    }
};
