__('AI: Local mode', 'ai-flash-tune'), 'openai' => __('AI: OpenAI', 'ai-flash-tune'), 'zywrap' => __('AI: Zywrap', 'ai-flash-tune'), ]; $provider_label = $provider_labels[$ai_provider] ?? __('AI: Local mode', 'ai-flash-tune'); $growth_modules = [ 'aiftac' => class_exists('AIFTAC_Logic'), 'aiftpo' => class_exists('AIFTPO_Logic'), 'aiftas' => class_exists('AIFTAS_Logic'), 'aiftal' => class_exists('AIFTAL_Logic'), 'aiftrp' => class_exists('AIFTRP_Logic'), 'aiftcr' => class_exists('AIFTCR_Logic'), 'aiftco' => class_exists('AIFTCO_Logic'), ]; $active_growth_count = count(array_filter($growth_modules)); $total_growth_count = max(1, count($growth_modules)); $active_growth_percent = min(100, (int) round(($active_growth_count / $total_growth_count) * 100)); $reports_page = class_exists('AIFTRP_Logic') ? 'aiftrp-reports' : 'aiflt-ai-usage-reports'; $reports_pages = class_exists('AIFTRP_Logic') ? ['aiftrp-reports', 'aiflt-ai-usage-reports'] : ['aiflt-ai-usage-reports']; $nav_sections = [ [ 'label' => __('Overview', 'ai-flash-tune'), 'items' => [ ['title' => __('Revenue Leak Scan', 'ai-flash-tune'), 'page' => 'ai_flash_tune', 'pages' => ['ai_flash_tune', ''], 'icon' => 'fas fa-chart-line'], ['title' => __('Funnel Analysis', 'ai-flash-tune'), 'page' => 'funnelanalysis', 'pages' => ['funnelanalysis'], 'icon' => 'fas fa-route'], ['title' => __('Product Performance', 'ai-flash-tune'), 'page' => 'products', 'pages' => ['products', 'product-detail'], 'icon' => 'fas fa-box-open'], ['title' => __('Abandoned Carts', 'ai-flash-tune'), 'page' => 'abandonedcarts', 'pages' => ['abandonedcarts'], 'icon' => 'fas fa-shopping-cart'], ], ], [ 'label' => __('Optimization', 'ai-flash-tune'), 'items' => array_values(array_filter([ class_exists('AIFTAC_Logic') ? ['title' => __('AI Action Center', 'ai-flash-tune'), 'page' => 'aiftac-action-center', 'pages' => ['aiftac-action-center'], 'icon' => 'fas fa-magic'] : null, class_exists('AIFTPO_Logic') ? ['title' => __('Product Optimizer', 'ai-flash-tune'), 'page' => 'aiftpo-product-optimizer', 'pages' => ['aiftpo-product-optimizer'], 'icon' => 'fas fa-pen-nib'] : null, class_exists('AIFTCO_Logic') ? ['title' => __('Checkout Optimizer', 'ai-flash-tune'), 'page' => 'aiftco-optimizer-dashboard', 'pages' => ['aiftco-optimizer-dashboard'], 'icon' => 'fas fa-cash-register'] : null, class_exists('AIFTCR_Logic') ? ['title' => __('Cart Recovery', 'ai-flash-tune'), 'page' => 'aiftcr-recovery-center', 'pages' => ['aiftcr-recovery-center', 'aiftcr-email-log'], 'icon' => 'fas fa-envelope-open-text'] : null, class_exists('AIFTAL_Logic') ? ['title' => __('Alert Center', 'ai-flash-tune'), 'page' => 'aiftal-alert-center', 'pages' => ['aiftal-alert-center'], 'icon' => 'fas fa-bell'] : null, class_exists('AIFTAS_Logic') ? ['title' => __('Advanced Segmentation', 'ai-flash-tune'), 'page' => 'aiftas-segmentation', 'pages' => ['aiftas-segmentation'], 'icon' => 'fas fa-layer-group'] : null, ])), ], [ 'label' => __('Reports', 'ai-flash-tune'), 'items' => [ ['title' => __('Reports & Exports', 'ai-flash-tune'), 'page' => $reports_page, 'pages' => $reports_pages, 'icon' => 'fas fa-file-alt'], ['title' => __('Agency & Growth Toolkit', 'ai-flash-tune'), 'page' => 'aiflt-growth-tools', 'pages' => ['aiflt-growth-tools'], 'icon' => 'fas fa-briefcase'], ], ], [ 'label' => __('Setup', 'ai-flash-tune'), 'items' => [ ['title' => __('Setup Wizard', 'ai-flash-tune'), 'page' => 'aiflt-setup-wizard', 'pages' => ['aiflt-setup-wizard'], 'icon' => 'fas fa-check-circle'], ['title' => __('Settings & AI Keys', 'ai-flash-tune'), 'page' => 'aiflt_settings', 'pages' => ['aiflt_settings'], 'icon' => 'fas fa-cog'], ['title' => __('Modules & License', 'ai-flash-tune'), 'page' => 'addon-manager', 'pages' => ['addon-manager'], 'icon' => 'fas fa-puzzle-piece'], ['title' => __('Privacy Tools', 'ai-flash-tune'), 'page' => 'privacy-tools', 'pages' => ['privacy-tools'], 'icon' => 'fas fa-user-shield'], ['title' => __('Diagnostics & QA', 'ai-flash-tune'), 'page' => 'aiflt-help', 'pages' => ['aiflt-help'], 'icon' => 'fas fa-life-ring'], ['title' => __('Plans & Upgrade', 'ai-flash-tune'), 'page' => 'upgrade-to-pro', 'pages' => ['upgrade-to-pro'], 'icon' => 'fas fa-rocket'], ], ], ]; ?>