{"version":3,"file":"performance.config.mjs","sources":["../../src/config/performance.config.ts"],"sourcesContent":["/**\n * @file Performance Configuration\n * @description Centralized performance thresholds, budgets, and monitoring configuration.\n *\n * This configuration defines:\n * - Core Web Vitals targets and thresholds\n * - Performance budgets for bundles, assets, and runtime\n * - Long task detection thresholds\n * - Memory pressure levels\n * - Network quality tiers\n * - Render performance baselines\n *\n * All values are calibrated based on Google's Core Web Vitals recommendations\n * and industry best practices for high-performance web applications.\n *\n * @see https://web.dev/vitals/\n * @see https://developer.chrome.com/docs/lighthouse/performance/\n */\n\nimport { isProd, isStaging } from '@/lib/core/config/env-helper';\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/**\n * Core Web Vitals metric configuration\n */\nexport interface VitalMetricThreshold {\n  /** Good threshold (green zone) */\n  readonly good: number;\n  /** Needs improvement threshold (yellow zone) */\n  readonly needsImprovement: number;\n  /** Poor threshold (red zone) */\n  readonly poor: number;\n  /** Unit of measurement */\n  readonly unit: 'ms' | 's' | 'score' | 'ratio';\n  /** Human-readable description */\n  readonly description: string;\n}\n\n/**\n * Bundle size budget configuration\n */\nexport interface BundleBudget {\n  /** Maximum size for initial bundle (bytes) */\n  readonly initial: number;\n  /** Maximum size for any async chunk (bytes) */\n  readonly asyncChunk: number;\n  /** Maximum total vendor bundle size (bytes) */\n  readonly vendor: number;\n  /** Maximum total application size (bytes) */\n  readonly total: number;\n  /** Warning threshold as percentage of limit */\n  readonly warningThreshold: number;\n}\n\n/**\n * Runtime performance budget\n */\nexport interface RuntimeBudget {\n  /** Maximum JavaScript execution time per frame (ms) */\n  readonly jsExecutionPerFrame: number;\n  /** Maximum style recalculation time (ms) */\n  readonly styleRecalc: number;\n  /** Maximum layout time (ms) */\n  readonly layout: number;\n  /** Maximum paint time (ms) */\n  readonly paint: number;\n  /** Maximum composite time (ms) */\n  readonly composite: number;\n  /** Target frames per second */\n  readonly targetFps: number;\n  /** Frame budget in milliseconds (1000 / targetFps) */\n  readonly frameBudget: number;\n}\n\n/**\n * Long task detection configuration\n */\nexport interface LongTaskConfig {\n  /** Threshold for classifying a task as \"long\" (ms) */\n  readonly threshold: number;\n  /** Threshold for critical long tasks (ms) */\n  readonly criticalThreshold: number;\n  /** Maximum long tasks per page load before warning */\n  readonly maxPerPageLoad: number;\n  /** Sampling rate for long task attribution (0-1) */\n  readonly attributionSampleRate: number;\n  /** Buffer size for storing long task history */\n  readonly historyBufferSize: number;\n}\n\n/**\n * Memory pressure configuration\n */\nexport interface MemoryConfig {\n  /** Warning threshold as percentage of JS heap limit */\n  readonly warningThreshold: number;\n  /** Critical threshold as percentage of JS heap limit */\n  readonly criticalThreshold: number;\n  /** Polling interval for memory checks (ms) */\n  readonly pollingInterval: number;\n  /** GC trigger threshold (MB) */\n  readonly gcTriggerSize: number;\n  /** Enable automatic cleanup on pressure */\n  readonly autoCleanup: boolean;\n}\n\n/**\n * Network quality tier configuration\n */\nexport interface NetworkTierConfig {\n  /** Tier name */\n  readonly name: string;\n  /** Minimum RTT for this tier (ms) */\n  readonly minRtt: number;\n  /** Maximum RTT for this tier (ms) */\n  readonly maxRtt: number;\n  /** Minimum downlink for this tier (Mbps) */\n  readonly minDownlink: number;\n  /** Recommended prefetch strategy */\n  readonly prefetchStrategy: 'aggressive' | 'moderate' | 'conservative' | 'none';\n  /** Recommended image quality */\n  readonly imageQuality: 'high' | 'medium' | 'low' | 'placeholder';\n}\n\n/**\n * Render performance configuration\n */\nexport interface RenderConfig {\n  /** Maximum acceptable render time for a component (ms) */\n  readonly maxComponentRenderTime: number;\n  /** Threshold for flagging a component as slow (ms) */\n  readonly slowComponentThreshold: number;\n  /** Maximum acceptable re-render count per interaction */\n  readonly maxRerendersPerInteraction: number;\n  /** Wasted render detection threshold (ms) */\n  readonly wastedRenderThreshold: number;\n  /** Enable render profiling in production */\n  readonly enableProdProfiling: boolean;\n  /** Sample rate for render metrics collection (0-1) */\n  readonly sampleRate: number;\n}\n\n/**\n * Complete performance configuration\n */\nexport interface PerformanceConfig {\n  readonly vitals: Record<string, VitalMetricThreshold>;\n  readonly bundle: BundleBudget;\n  readonly runtime: RuntimeBudget;\n  readonly longTask: LongTaskConfig;\n  readonly memory: MemoryConfig;\n  readonly networkTiers: NetworkTierConfig[];\n  readonly render: RenderConfig;\n  readonly monitoring: MonitoringConfig;\n}\n\n/**\n * Monitoring and reporting configuration\n */\nexport interface MonitoringConfig {\n  /** Enable real-time monitoring */\n  readonly enabled: boolean;\n  /** Reporting endpoint */\n  readonly endpoint: string;\n  /** Batch size for metric reports */\n  readonly batchSize: number;\n  /** Flush interval (ms) */\n  readonly flushInterval: number;\n  /** Sample rate for production (0-1) */\n  readonly productionSampleRate: number;\n  /** Include attribution data */\n  readonly includeAttribution: boolean;\n  /** Enable debug mode */\n  readonly debug: boolean;\n}\n\n// ============================================================================\n// Constants\n// ============================================================================\n\n/**\n * Core Web Vitals thresholds (Google recommended)\n *\n * @see https://web.dev/vitals/\n */\nexport const VITAL_THRESHOLDS: Record<string, VitalMetricThreshold> = {\n  LCP: {\n    good: 2500,\n    needsImprovement: 4000,\n    poor: 4000,\n    unit: 'ms',\n    description: 'Largest Contentful Paint - Time to render the largest visible element',\n  },\n  INP: {\n    good: 200,\n    needsImprovement: 500,\n    poor: 500,\n    unit: 'ms',\n    description: 'Interaction to Next Paint - Responsiveness to user interactions',\n  },\n  CLS: {\n    good: 0.1,\n    needsImprovement: 0.25,\n    poor: 0.25,\n    unit: 'score',\n    description: 'Cumulative Layout Shift - Visual stability of the page',\n  },\n  FCP: {\n    good: 1800,\n    needsImprovement: 3000,\n    poor: 3000,\n    unit: 'ms',\n    description: 'First Contentful Paint - Time to first content render',\n  },\n  TTFB: {\n    good: 800,\n    needsImprovement: 1800,\n    poor: 1800,\n    unit: 'ms',\n    description: 'Time to First Byte - Server response time',\n  },\n  FID: {\n    good: 100,\n    needsImprovement: 300,\n    poor: 300,\n    unit: 'ms',\n    description: 'First Input Delay - Time from first interaction to browser response',\n  },\n  TBT: {\n    good: 200,\n    needsImprovement: 600,\n    poor: 600,\n    unit: 'ms',\n    description: 'Total Blocking Time - Sum of blocking portions of long tasks',\n  },\n  SI: {\n    good: 3400,\n    needsImprovement: 5800,\n    poor: 5800,\n    unit: 'ms',\n    description: 'Speed Index - How quickly content is visually displayed',\n  },\n} as const;\n\n/**\n * Bundle size budgets (in bytes)\n *\n * Based on performance budget best practices:\n * - Initial bundle should be < 200KB gzipped for fast FCP\n * - Async chunks should be < 100KB for quick route transitions\n */\nexport const BUNDLE_BUDGET: BundleBudget = {\n  initial: 200 * 1024, // 200 KB\n  asyncChunk: 100 * 1024, // 100 KB\n  vendor: 150 * 1024, // 150 KB\n  total: 500 * 1024, // 500 KB\n  warningThreshold: 0.8, // Warn at 80% of budget\n} as const;\n\n/**\n * Runtime performance budgets\n *\n * Based on RAIL performance model:\n * - Response: < 100ms for user input\n * - Animation: 60fps = 16.67ms per frame\n * - Idle: Maximize idle time for background work\n * - Load: < 1000ms for interactive\n */\nexport const RUNTIME_BUDGET: RuntimeBudget = {\n  jsExecutionPerFrame: 10, // Leave 6ms for browser work\n  styleRecalc: 2,\n  layout: 2,\n  paint: 2,\n  composite: 1,\n  targetFps: 60,\n  frameBudget: 16.67,\n} as const;\n\n/**\n * Long task detection configuration\n *\n * Long tasks > 50ms block the main thread and impact INP.\n * Critical tasks > 100ms cause noticeable jank.\n */\nexport const LONG_TASK_CONFIG: LongTaskConfig = {\n  threshold: 50,\n  criticalThreshold: 100,\n  maxPerPageLoad: 10,\n  attributionSampleRate: 0.1,\n  historyBufferSize: 100,\n} as const;\n\n/**\n * Memory pressure configuration\n *\n * Chrome typically limits JS heap to ~4GB.\n * Warning at 70%, critical at 90% of available heap.\n */\nexport const MEMORY_CONFIG: MemoryConfig = {\n  warningThreshold: 0.7,\n  criticalThreshold: 0.9,\n  pollingInterval: 5000,\n  gcTriggerSize: 100, // 100 MB\n  autoCleanup: true,\n} as const;\n\n/**\n * Network quality tiers based on Network Information API\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Network_Information_API\n */\nexport const NETWORK_TIERS: NetworkTierConfig[] = [\n  {\n    name: '4g',\n    minRtt: 0,\n    maxRtt: 100,\n    minDownlink: 10,\n    prefetchStrategy: 'aggressive',\n    imageQuality: 'high',\n  },\n  {\n    name: '3g',\n    minRtt: 100,\n    maxRtt: 300,\n    minDownlink: 1,\n    prefetchStrategy: 'moderate',\n    imageQuality: 'medium',\n  },\n  {\n    name: 'slow-3g',\n    minRtt: 300,\n    maxRtt: 700,\n    minDownlink: 0.4,\n    prefetchStrategy: 'conservative',\n    imageQuality: 'low',\n  },\n  {\n    name: '2g',\n    minRtt: 700,\n    maxRtt: Infinity,\n    minDownlink: 0,\n    prefetchStrategy: 'none',\n    imageQuality: 'placeholder',\n  },\n] as const;\n\n/**\n * Render performance configuration\n *\n * Based on React DevTools Profiler recommendations:\n * - Components should render in < 16ms for 60fps\n * - Wasted renders indicate unnecessary re-renders\n */\nexport const RENDER_CONFIG: RenderConfig = {\n  maxComponentRenderTime: 16,\n  slowComponentThreshold: 8,\n  maxRerendersPerInteraction: 5,\n  wastedRenderThreshold: 2,\n  enableProdProfiling: false,\n  sampleRate: 0.1,\n} as const;\n\n/**\n * Monitoring and reporting configuration\n */\nexport const MONITORING_CONFIG: MonitoringConfig = {\n  enabled: true,\n  endpoint: '/api/analytics/performance',\n  batchSize: 10,\n  flushInterval: 30000,\n  productionSampleRate: 0.1,\n  includeAttribution: true,\n  debug: false,\n} as const;\n\n// ============================================================================\n// Environment-Specific Configurations\n// ============================================================================\n\n/**\n * Development configuration with relaxed thresholds\n */\nexport const DEV_PERFORMANCE_CONFIG: PerformanceConfig = {\n  vitals: VITAL_THRESHOLDS,\n  bundle: {\n    ...BUNDLE_BUDGET,\n    // Relax bundle limits in dev (source maps, HMR)\n    initial: BUNDLE_BUDGET.initial * 3,\n    total: BUNDLE_BUDGET.total * 3,\n  },\n  runtime: RUNTIME_BUDGET,\n  longTask: {\n    ...LONG_TASK_CONFIG,\n    // More permissive in dev\n    maxPerPageLoad: 50,\n    attributionSampleRate: 1.0,\n  },\n  memory: {\n    ...MEMORY_CONFIG,\n    pollingInterval: 10000,\n  },\n  networkTiers: NETWORK_TIERS,\n  render: {\n    ...RENDER_CONFIG,\n    enableProdProfiling: true,\n    sampleRate: 1.0,\n  },\n  monitoring: {\n    ...MONITORING_CONFIG,\n    debug: true,\n    productionSampleRate: 1.0,\n  },\n} as const;\n\n/**\n * Production configuration with strict thresholds\n */\nexport const PROD_PERFORMANCE_CONFIG: PerformanceConfig = {\n  vitals: VITAL_THRESHOLDS,\n  bundle: BUNDLE_BUDGET,\n  runtime: RUNTIME_BUDGET,\n  longTask: LONG_TASK_CONFIG,\n  memory: MEMORY_CONFIG,\n  networkTiers: NETWORK_TIERS,\n  render: RENDER_CONFIG,\n  monitoring: MONITORING_CONFIG,\n} as const;\n\n/**\n * Staging configuration (production-like with more monitoring)\n */\nexport const STAGING_PERFORMANCE_CONFIG: PerformanceConfig = {\n  vitals: VITAL_THRESHOLDS,\n  bundle: BUNDLE_BUDGET,\n  runtime: RUNTIME_BUDGET,\n  longTask: {\n    ...LONG_TASK_CONFIG,\n    attributionSampleRate: 0.5,\n  },\n  memory: MEMORY_CONFIG,\n  networkTiers: NETWORK_TIERS,\n  render: {\n    ...RENDER_CONFIG,\n    sampleRate: 0.5,\n  },\n  monitoring: {\n    ...MONITORING_CONFIG,\n    productionSampleRate: 0.5,\n    debug: false,\n  },\n} as const;\n\n// ============================================================================\n// Configuration Getters\n// ============================================================================\n\n/**\n * Get performance configuration based on environment\n */\nexport function getPerformanceConfig(): PerformanceConfig {\n  if (isProd()) {\n    return PROD_PERFORMANCE_CONFIG;\n  }\n  if (isStaging()) {\n    return STAGING_PERFORMANCE_CONFIG;\n  }\n  return DEV_PERFORMANCE_CONFIG;\n}\n\n/**\n * Check if a value meets a vital threshold\n */\nexport function meetsVitalThreshold(\n  metric: keyof typeof VITAL_THRESHOLDS,\n  value: number\n): 'good' | 'needs-improvement' | 'poor' {\n  const threshold = VITAL_THRESHOLDS[metric];\n  if (!threshold) return 'poor';\n\n  if (value <= threshold.good) return 'good';\n  if (value <= threshold.needsImprovement) return 'needs-improvement';\n  return 'poor';\n}\n\n/**\n * Get network tier based on current conditions\n */\nexport function getNetworkTier(rtt: number, downlink: number): NetworkTierConfig {\n  for (const tier of NETWORK_TIERS) {\n    if (rtt >= tier.minRtt && rtt < tier.maxRtt && downlink >= tier.minDownlink) {\n      return tier;\n    }\n  }\n  // Default to slowest tier\n  const lastTier = NETWORK_TIERS[NETWORK_TIERS.length - 1];\n  if (lastTier == null) {\n    throw new Error('NETWORK_TIERS array is empty');\n  }\n  return lastTier;\n}\n\n/**\n * Calculate bundle budget usage\n */\nexport function calculateBudgetUsage(\n  actualSize: number,\n  budgetType: keyof BundleBudget\n): { usage: number; status: 'ok' | 'warning' | 'exceeded' } {\n  const budget = BUNDLE_BUDGET[budgetType];\n\n  const usage = actualSize / budget;\n\n  if (usage > 1) {\n    return { usage, status: 'exceeded' };\n  }\n  if (usage > BUNDLE_BUDGET.warningThreshold) {\n    return { usage, status: 'warning' };\n  }\n  return { usage, status: 'ok' };\n}\n\n/**\n * Format bytes to human-readable string\n */\nexport function formatBytes(bytes: number): string {\n  if (bytes === 0) return '0 B';\n  const k = 1024;\n  const sizes = ['B', 'KB', 'MB', 'GB'];\n  const i = Math.floor(Math.log(bytes) / Math.log(k));\n  return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;\n}\n\n/**\n * Format milliseconds to human-readable string\n */\nexport function formatDuration(ms: number): string {\n  if (ms < 1) return `${(ms * 1000).toFixed(2)}us`;\n  if (ms < 1000) return `${ms.toFixed(2)}ms`;\n  return `${(ms / 1000).toFixed(2)}s`;\n}\n\n// ============================================================================\n// Export Default Configuration\n// ============================================================================\n\n/**\n * Default performance configuration (environment-aware)\n */\nexport const performanceConfig = getPerformanceConfig();\n"],"names":["VITAL_THRESHOLDS","BUNDLE_BUDGET","RUNTIME_BUDGET","LONG_TASK_CONFIG","MEMORY_CONFIG","NETWORK_TIERS","RENDER_CONFIG","MONITORING_CONFIG","DEV_PERFORMANCE_CONFIG","PROD_PERFORMANCE_CONFIG","STAGING_PERFORMANCE_CONFIG","getPerformanceConfig","isProd","isStaging","meetsVitalThreshold","metric","value","threshold","getNetworkTier","rtt","downlink","tier","lastTier","calculateBudgetUsage","actualSize","budgetType","budget","usage","formatBytes","bytes","k","sizes","i","formatDuration","ms","performanceConfig"],"mappings":";AA4LO,MAAMA,IAAyD;AAAA,EACpE,KAAK;AAAA,IACH,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,EAAA;AAAA,EAEf,KAAK;AAAA,IACH,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,EAAA;AAAA,EAEf,KAAK;AAAA,IACH,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,EAAA;AAAA,EAEf,KAAK;AAAA,IACH,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,EAAA;AAAA,EAEf,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,EAAA;AAAA,EAEf,KAAK;AAAA,IACH,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,EAAA;AAAA,EAEf,KAAK;AAAA,IACH,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,EAAA;AAAA,EAEf,IAAI;AAAA,IACF,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,MAAM;AAAA,IACN,MA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