"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExperienceBuilderTemplates = exports.TEMPLATE_LIBRARY = exports.TEMPLATE_CATEGORIES = exports.AI_PLATFORM_TEMPLATES = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const Button_js_1 = require("../Button.js");
const Card_js_1 = require("../Card/Card.js");
const Modal_js_1 = require("../feedback/Modal.js");
const lucide_react_1 = require("lucide-react");
/**
 * Experience Builder Templates - Pre-built AI Platform Layouts
 *
 * Comprehensive template library featuring:
 * - AI platform dashboard templates
 * - Agent management layouts
 * - Workflow builder templates
 * - Data analytics dashboards
 * - Form and content templates
 * - Custom layout variations
 */
// Template definitions for AI Platform
exports.AI_PLATFORM_TEMPLATES = [
    {
        id: 'ai_control_center',
        name: 'AI Control Center',
        description: 'Comprehensive AI platform control center with real-time monitoring, agent management, and analytics',
        category: 'dashboard',
        preview: '/templates/previews/ai-control-center.png',
        tags: ['ai', 'dashboard', 'monitoring', 'real-time'],
        author: 'Bluefly AI',
        version: '1.0.0',
        license: 'MIT',
        layout: {
            id: 'ai_control_center',
            title: 'AI Control Center',
            description: 'Main control dashboard for AI platform operations',
            regions: [
                {
                    id: 'header',
                    type: 'header',
                    components: [
                        {
                            id: 'main_nav',
                            type: 'notification_system',
                            props: {
                                position: 'top-right',
                                enableRealtime: true,
                                enableSound: true
                            }
                        }
                    ],
                    className: 'header-region bg-primary text-white p-4'
                },
                {
                    id: 'main_content',
                    type: 'main',
                    components: [
                        {
                            id: 'ai_dashboard',
                            type: 'ai_dashboard',
                            props: {
                                layout: 'grid',
                                enableRealtime: true,
                                enableAlerts: true,
                                timeRange: '24h',
                                widgets: [
                                    'system-status',
                                    'ai-performance',
                                    'alerts-panel',
                                    'resource-usage',
                                    'ai-insights'
                                ]
                            }
                        }
                    ],
                    className: 'main-content flex-1 p-6'
                },
                {
                    id: 'sidebar',
                    type: 'sidebar',
                    components: [
                        {
                            id: 'agent_profiles',
                            type: 'agent_profiles',
                            props: {
                                compact: true,
                                showMetrics: true,
                                enableRealtime: true,
                                maxAgents: 10
                            }
                        },
                        {
                            id: 'quick_actions',
                            type: 'bfui_card',
                            props: {
                                title: 'Quick Actions',
                                elevation: 1
                            }
                        }
                    ],
                    className: 'sidebar w-80 bg-gray-50 p-4'
                }
            ],
            theme: 'ai-platform',
            settings: {
                layout: 'dashboard',
                responsive: true,
                animations: true
            }
        }
    },
    {
        id: 'agent_fleet_manager',
        name: 'Agent Fleet Manager',
        description: 'Dedicated interface for managing large-scale agent fleets with topology view and optimization tools',
        category: 'ai-workspace',
        preview: '/templates/previews/agent-fleet-manager.png',
        tags: ['agents', 'fleet', 'management', 'topology'],
        author: 'Bluefly AI',
        version: '1.0.0',
        layout: {
            id: 'agent_fleet_manager',
            title: 'Agent Fleet Manager',
            regions: [
                {
                    id: 'header',
                    type: 'header',
                    components: [
                        {
                            id: 'fleet_toolbar',
                            type: 'bfui_card',
                            props: {
                                title: 'Fleet Operations',
                                className: 'toolbar'
                            }
                        }
                    ]
                },
                {
                    id: 'main_grid',
                    type: 'main',
                    components: [
                        {
                            id: 'fleet_dashboard',
                            type: 'agent_fleet_dashboard',
                            props: {
                                showTopology: true,
                                enableOrchestration: true,
                                showMetrics: true,
                                enableAutoScaling: true
                            }
                        },
                        {
                            id: 'fleet_topology',
                            type: 'fleet_topology',
                            props: {
                                enableInteraction: true,
                                showConnections: true,
                                enableZoom: true,
                                layoutAlgorithm: 'force'
                            }
                        },
                        {
                            id: 'fleet_optimizer',
                            type: 'fleet_optimizer',
                            props: {
                                enableAI: true,
                                showRecommendations: true,
                                showCostAnalysis: true
                            }
                        }
                    ],
                    className: 'grid grid-cols-2 gap-6 p-6'
                }
            ]
        }
    },
    {
        id: 'workflow_designer',
        name: 'AI Workflow Designer',
        description: 'Visual workflow design environment with AI-powered suggestions and real-time testing',
        category: 'ai-workspace',
        preview: '/templates/previews/workflow-designer.png',
        tags: ['workflow', 'design', 'ai', 'visual-programming'],
        author: 'Bluefly AI',
        version: '1.0.0',
        layout: {
            id: 'workflow_designer',
            title: 'AI Workflow Designer',
            regions: [
                {
                    id: 'main_canvas',
                    type: 'main',
                    components: [
                        {
                            id: 'workflow_builder',
                            type: 'workflow_builder',
                            props: {
                                mode: 'design',
                                enableAISuggestions: true,
                                enableCollaboration: true,
                                enableVersionControl: true,
                                enableTesting: true,
                                height: '100vh'
                            }
                        }
                    ],
                    className: 'h-screen'
                }
            ]
        }
    },
    {
        id: 'model_management_hub',
        name: 'Model Management Hub',
        description: 'Centralized hub for AI model lifecycle management, versioning, and deployment',
        category: 'ai-workspace',
        preview: '/templates/previews/model-management-hub.png',
        tags: ['models', 'deployment', 'versioning', 'lifecycle'],
        author: 'Bluefly AI',
        version: '1.0.0',
        layout: {
            id: 'model_management_hub',
            title: 'Model Management Hub',
            regions: [
                {
                    id: 'main_content',
                    type: 'main',
                    components: [
                        {
                            id: 'model_registry',
                            type: 'model_registry',
                            props: {
                                enableVersioning: true,
                                enableDeployment: true,
                                showMetrics: true,
                                enableFiltering: true,
                                enableBulkOperations: true
                            }
                        },
                        {
                            id: 'deployment_metrics',
                            type: 'metric_chart',
                            props: {
                                title: 'Deployment Metrics',
                                type: 'line',
                                metrics: ['accuracy', 'latency', 'throughput'],
                                enableRealtime: true
                            }
                        }
                    ],
                    className: 'p-6 space-y-6'
                },
                {
                    id: 'sidebar',
                    type: 'sidebar',
                    components: [
                        {
                            id: 'quick_deploy',
                            type: 'advanced_form',
                            props: {
                                schema: {
                                    title: 'Quick Deploy',
                                    fields: [
                                        { id: 'model', type: 'select', label: 'Model' },
                                        { id: 'environment', type: 'select', label: 'Environment' },
                                        { id: 'replicas', type: 'number', label: 'Replicas' }
                                    ]
                                },
                                enableAI: true,
                                submitButtonText: 'Deploy'
                            }
                        }
                    ]
                }
            ]
        }
    },
    {
        id: 'analytics_workspace',
        name: 'AI Analytics Workspace',
        description: 'Advanced analytics workspace with interactive charts, data exploration, and AI insights',
        category: 'dashboard',
        preview: '/templates/previews/analytics-workspace.png',
        tags: ['analytics', 'charts', 'data', 'insights'],
        author: 'Bluefly AI',
        version: '1.0.0',
        layout: {
            id: 'analytics_workspace',
            title: 'AI Analytics Workspace',
            regions: [
                {
                    id: 'main_content',
                    type: 'main',
                    components: [
                        {
                            id: 'metrics_grid',
                            type: 'responsive_layout',
                            props: {
                                layout: 'grid',
                                columns: 3,
                                gap: 24,
                                components: [
                                    {
                                        type: 'metric_chart',
                                        props: { type: 'line', title: 'Performance Trends' }
                                    },
                                    {
                                        type: 'ai_metrics_chart',
                                        props: { showAccuracy: true, showThroughput: true }
                                    },
                                    {
                                        type: 'metric_chart',
                                        props: { type: 'bar', title: 'Resource Usage' }
                                    }
                                ]
                            }
                        },
                        {
                            id: 'data_table',
                            type: 'advanced_data_table',
                            props: {
                                virtualized: true,
                                enableFiltering: true,
                                enableExport: true,
                                pageSize: 100
                            }
                        }
                    ]
                }
            ]
        }
    },
    {
        id: 'content_generation_studio',
        name: 'Content Generation Studio',
        description: 'AI-powered content creation workspace with templates, editing tools, and collaboration features',
        category: 'ai-workspace',
        preview: '/templates/previews/content-generation-studio.png',
        tags: ['content', 'generation', 'ai', 'collaboration'],
        author: 'Bluefly AI',
        version: '1.0.0',
        layout: {
            id: 'content_generation_studio',
            title: 'Content Generation Studio',
            regions: [
                {
                    id: 'main_editor',
                    type: 'main',
                    components: [
                        {
                            id: 'rfp_generator',
                            type: 'rfp_content_generator',
                            props: {
                                enableTemplates: true,
                                enableAI: true,
                                showPreview: true,
                                enableExport: true
                            }
                        }
                    ]
                },
                {
                    id: 'sidebar',
                    type: 'sidebar',
                    components: [
                        {
                            id: 'template_library',
                            type: 'bfui_card',
                            props: {
                                title: 'Templates',
                                className: 'template-library'
                            }
                        },
                        {
                            id: 'ai_assistant',
                            type: 'ai_chat_widget',
                            props: {
                                enableHistory: true,
                                enableFileUpload: true,
                                maxMessages: 50
                            }
                        }
                    ]
                }
            ]
        }
    },
    {
        id: 'monitoring_center',
        name: 'System Monitoring Center',
        description: 'Comprehensive system monitoring with real-time alerts, performance metrics, and health dashboards',
        category: 'admin-panel',
        preview: '/templates/previews/monitoring-center.png',
        tags: ['monitoring', 'alerts', 'performance', 'health'],
        author: 'Bluefly AI',
        version: '1.0.0',
        layout: {
            id: 'monitoring_center',
            title: 'System Monitoring Center',
            regions: [
                {
                    id: 'alert_banner',
                    type: 'header',
                    components: [
                        {
                            id: 'alert_system',
                            type: 'notification_system',
                            props: {
                                position: 'top-center',
                                enableRealtime: true,
                                enableSound: true,
                                maxNotifications: 3
                            }
                        }
                    ]
                },
                {
                    id: 'monitoring_grid',
                    type: 'main',
                    components: [
                        {
                            id: 'fleet_health',
                            type: 'fleet_health_monitor',
                            props: {
                                enablePredictiveAnalytics: true,
                                showPerformanceMetrics: true,
                                enableAlerts: true,
                                refreshInterval: 5000
                            }
                        },
                        {
                            id: 'performance_monitor',
                            type: 'performance_monitor',
                            props: {
                                showCPU: true,
                                showMemory: true,
                                showNetwork: true,
                                showDisk: true,
                                enableAlerts: true
                            }
                        },
                        {
                            id: 'agent_health',
                            type: 'agent_health_monitor',
                            props: {
                                enablePredictiveAlerts: true,
                                showPerformanceMetrics: true
                            }
                        }
                    ],
                    className: 'grid grid-cols-2 lg:grid-cols-3 gap-6 p-6'
                }
            ]
        }
    }
];
// Template categories
exports.TEMPLATE_CATEGORIES = [
    {
        id: 'dashboard',
        label: 'Dashboards',
        description: 'Real-time monitoring and analytics dashboards',
        icon: 'BarChart3'
    },
    {
        id: 'ai-workspace',
        label: 'AI Workspaces',
        description: 'Specialized AI development and management interfaces',
        icon: 'Brain'
    },
    {
        id: 'admin-panel',
        label: 'Admin Panels',
        description: 'System administration and configuration interfaces',
        icon: 'Settings'
    },
    {
        id: 'landing-page',
        label: 'Landing Pages',
        description: 'Public-facing pages and marketing layouts',
        icon: 'Layout'
    },
    {
        id: 'custom',
        label: 'Custom',
        description: 'User-created and community templates',
        icon: 'Grid'
    }
];
// Template library configuration
exports.TEMPLATE_LIBRARY = {
    templates: exports.AI_PLATFORM_TEMPLATES,
    categories: exports.TEMPLATE_CATEGORIES,
    featured: ['ai_control_center', 'agent_fleet_manager', 'workflow_designer'],
    recent: ['model_management_hub', 'analytics_workspace']
};
const ExperienceBuilderTemplates = ({ isOpen, onClose, onTemplateSelect, onPreview, selectedCategory, searchTerm = '', className = '' }) => {
    const [activeCategory, setActiveCategory] = (0, react_1.useState)(selectedCategory || 'all');
    const [searchQuery, setSearchQuery] = (0, react_1.useState)(searchTerm);
    const [previewTemplate, setPreviewTemplate] = (0, react_1.useState)(null);
    // Filter templates based on category and search
    const filteredTemplates = (0, react_1.useMemo)(() => {
        let filtered = exports.TEMPLATE_LIBRARY.templates;
        // Filter by category
        if (activeCategory !== 'all') {
            filtered = filtered.filter(template => template.category === activeCategory);
        }
        // Filter by search term
        if (searchQuery.trim()) {
            const query = searchQuery.toLowerCase();
            filtered = filtered.filter(template => template.name.toLowerCase().includes(query) ||
                template.description.toLowerCase().includes(query) ||
                template.tags?.some(tag => tag.toLowerCase().includes(query)));
        }
        return filtered;
    }, [activeCategory, searchQuery]);
    // Get icon component by name
    const getIcon = (iconName) => {
        const icons = {
            BarChart3: lucide_react_1.BarChart3,
            Brain: lucide_react_1.Brain,
            Settings: lucide_react_1.Settings,
            Layout: lucide_react_1.Layout,
            Grid: lucide_react_1.Grid,
            Monitor: lucide_react_1.Monitor,
            Activity: lucide_react_1.Activity,
            Zap: lucide_react_1.Zap,
            Users: lucide_react_1.Users,
            FileText: lucide_react_1.FileText,
            Workflow: lucide_react_1.Workflow
        };
        return icons[iconName] || lucide_react_1.Grid;
    };
    const handleTemplateSelect = (template) => {
        onTemplateSelect(template);
        onClose();
    };
    const handlePreview = (template) => {
        setPreviewTemplate(template);
        onPreview(template);
    };
    const renderTemplate = (template) => {
        return ((0, jsx_runtime_1.jsxs)(Card_js_1.Card, { className: "template-card hover:shadow-lg transition-shadow cursor-pointer", onClick: () => handleTemplateSelect(template), children: [(0, jsx_runtime_1.jsx)("div", { className: "template-preview bg-gray-100 h-32 rounded-t-lg flex items-center justify-center", children: template.preview ? ((0, jsx_runtime_1.jsx)("img", { src: template.preview, alt: template.name, className: "w-full h-full object-cover rounded-t-lg" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.Layout, { className: "w-12 h-12 text-gray-400" })) }), (0, jsx_runtime_1.jsxs)("div", { className: "p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-start justify-between mb-2", children: [(0, jsx_runtime_1.jsx)("h3", { className: "font-semibold text-sm", children: template.name }), (0, jsx_runtime_1.jsxs)("div", { className: "flex space-x-1", children: [(0, jsx_runtime_1.jsx)(Button_js_1.Button, { variant: "ghost", size: "xs", onClick: (e) => {
                                                e.stopPropagation();
                                                handlePreview(template);
                                            }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Monitor, { className: "w-3 h-3" }) }), (0, jsx_runtime_1.jsx)(Button_js_1.Button, { variant: "ghost", size: "xs", onClick: (e) => {
                                                e.stopPropagation();
                                                // Add to favorites
                                            }, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Star, { className: "w-3 h-3" }) })] })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-gray-600 mb-3 line-clamp-2", children: template.description }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-wrap gap-1 mb-3", children: template.tags?.slice(0, 3).map(tag => ((0, jsx_runtime_1.jsxs)("span", { className: "inline-flex items-center px-2 py-0.5 rounded text-xs bg-blue-100 text-blue-800", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Tag, { className: "w-2 h-2 mr-1" }), tag] }, tag))) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between text-xs text-gray-500", children: [(0, jsx_runtime_1.jsxs)("span", { children: ["by ", template.author] }), (0, jsx_runtime_1.jsxs)("span", { children: ["v", template.version] })] })] })] }, template.id));
    };
    return ((0, jsx_runtime_1.jsx)(Modal_js_1.Modal, { isOpen: isOpen, onClose: onClose, title: "Experience Builder Templates", size: "xl", className: className, children: (0, jsx_runtime_1.jsxs)("div", { className: "template-library", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center space-x-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Search, { className: "w-4 h-4 absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400" }), (0, jsx_runtime_1.jsx)("input", { type: "text", placeholder: "Search templates...", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), className: "pl-10 pr-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" })] }), (0, jsx_runtime_1.jsxs)("select", { value: activeCategory, onChange: (e) => setActiveCategory(e.target.value), className: "px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500", children: [(0, jsx_runtime_1.jsx)("option", { value: "all", children: "All Categories" }), exports.TEMPLATE_CATEGORIES.map(category => ((0, jsx_runtime_1.jsx)("option", { value: category.id, children: category.label }, category.id)))] })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center space-x-2 text-sm text-gray-600", children: (0, jsx_runtime_1.jsxs)("span", { children: [filteredTemplates.length, " templates"] }) })] }), activeCategory === 'all' && !searchQuery && ((0, jsx_runtime_1.jsxs)("div", { className: "mb-8", children: [(0, jsx_runtime_1.jsxs)("h3", { className: "text-lg font-semibold mb-4 flex items-center", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Star, { className: "w-5 h-5 mr-2 text-yellow-500" }), "Featured Templates"] }), (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: exports.TEMPLATE_LIBRARY.featured?.map(templateId => {
                                const template = exports.TEMPLATE_LIBRARY.templates.find(t => t.id === templateId);
                                return template ? renderTemplate(template) : null;
                            }) })] })), activeCategory === 'all' && !searchQuery ? (exports.TEMPLATE_CATEGORIES.map(category => {
                    const categoryTemplates = exports.TEMPLATE_LIBRARY.templates.filter(template => template.category === category.id);
                    if (categoryTemplates.length === 0)
                        return null;
                    const IconComponent = getIcon(category.icon);
                    return ((0, jsx_runtime_1.jsxs)("div", { className: "mb-8", children: [(0, jsx_runtime_1.jsxs)("h3", { className: "text-lg font-semibold mb-4 flex items-center", children: [(0, jsx_runtime_1.jsx)(IconComponent, { className: "w-5 h-5 mr-2" }), category.label] }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-gray-600 mb-4", children: category.description }), (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: categoryTemplates.map(renderTemplate) })] }, category.id));
                })) : (
                /* Filtered Results */
                (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: filteredTemplates.map(renderTemplate) }), filteredTemplates.length === 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "text-center py-12", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Layout, { className: "w-12 h-12 text-gray-400 mx-auto mb-4" }), (0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-medium text-gray-900 mb-2", children: "No templates found" }), (0, jsx_runtime_1.jsx)("p", { className: "text-gray-600", children: "Try adjusting your search terms or category filter." })] }))] })), previewTemplate && ((0, jsx_runtime_1.jsx)(Modal_js_1.Modal, { isOpen: !!previewTemplate, onClose: () => setPreviewTemplate(null), title: `Preview: ${previewTemplate.name}`, size: "full", children: (0, jsx_runtime_1.jsxs)("div", { className: "template-preview-container", children: [(0, jsx_runtime_1.jsx)("div", { className: "preview-header mb-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold", children: previewTemplate.name }), (0, jsx_runtime_1.jsx)("p", { className: "text-gray-600", children: previewTemplate.description })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex space-x-2", children: [(0, jsx_runtime_1.jsx)(Button_js_1.Button, { onClick: () => handleTemplateSelect(previewTemplate), className: "bg-blue-600 text-white", children: "Use Template" }), (0, jsx_runtime_1.jsxs)(Button_js_1.Button, { variant: "outline", onClick: () => {
                                                        // Export template
                                                        const blob = new Blob([JSON.stringify(previewTemplate, null, 2)], {
                                                            type: 'application/json'
                                                        });
                                                        const url = URL.createObjectURL(blob);
                                                        const a = document.createElement('a');
                                                        a.href = url;
                                                        a.download = `${previewTemplate.id}-template.json`;
                                                        a.click();
                                                        URL.revokeObjectURL(url);
                                                    }, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Download, { className: "w-4 h-4 mr-2" }), "Export"] })] })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "preview-content bg-gray-100 rounded-lg p-4 min-h-96", children: (0, jsx_runtime_1.jsxs)("div", { className: "text-center py-20", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Layout, { className: "w-16 h-16 text-gray-400 mx-auto mb-4" }), (0, jsx_runtime_1.jsx)("p", { className: "text-gray-600", children: "Template preview would render here" })] }) })] }) }))] }) }));
};
exports.ExperienceBuilderTemplates = ExperienceBuilderTemplates;
exports.default = exports.ExperienceBuilderTemplates;
//# sourceMappingURL=ExperienceBuilderTemplates.js.map