@optifye/dashboard-core 6.0.6 → 6.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -12,7 +12,7 @@ import { noop, warning, invariant, progress, secondsToMilliseconds, milliseconds
12
12
  import { getValueTransition, hover, press, isPrimaryPointer, GroupPlaybackControls, setDragLock, supportsLinearEasing, attachTimeline, isGenerator, calcGeneratorDuration, isWaapiSupportedEasing, mapEasingToNativeEasing, maxGeneratorDuration, generateLinearEasing, isBezierDefinition } from 'motion-dom';
13
13
  import { BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, Tooltip, Legend, Bar, LabelList, ResponsiveContainer, LineChart as LineChart$1, Line, PieChart, Pie, Cell, ReferenceLine, ComposedChart, Area, ScatterChart, Scatter } from 'recharts';
14
14
  import { Slot } from '@radix-ui/react-slot';
15
- import { Camera, ChevronDown, ChevronUp, Check, ShieldCheck, Star, Award, X, Coffee, Plus, Clock, Minus, ArrowDown, ArrowUp, Search, CheckCircle, AlertTriangle, Info, Share2, Download, User, XCircle, ChevronLeft, ChevronRight, AlertCircle, Sun, Moon, MessageSquare, Trash2, ArrowLeft, RefreshCw, Menu, Send, Copy, Edit2, UserCheck, Save, LogOut, Calendar, Package, Settings, LifeBuoy, Loader2, ArrowLeftIcon as ArrowLeftIcon$1, Settings2, CheckCircle2, EyeOff, Eye, Zap, UserCircle } from 'lucide-react';
15
+ import { Camera, ChevronDown, ChevronUp, Check, ShieldCheck, Star, Award, X, Coffee, Plus, Clock, Minus, ArrowDown, ArrowUp, Search, CheckCircle, AlertTriangle, Info, Share2, Download, User, XCircle, ChevronLeft, ChevronRight, AlertCircle, Sun, Moon, MessageSquare, Trash2, ArrowLeft, RefreshCw, Menu, Send, Copy, Edit2, UserCheck, Save, LogOut, Calendar, Package, Settings, LifeBuoy, ArrowLeftIcon as ArrowLeftIcon$1, Settings2, CheckCircle2, EyeOff, Eye, Zap, UserCircle } from 'lucide-react';
16
16
  import { DayPicker, useNavigation as useNavigation$1 } from 'react-day-picker';
17
17
  import html2canvas from 'html2canvas';
18
18
  import jsPDF, { jsPDF as jsPDF$1 } from 'jspdf';
@@ -349,24 +349,6 @@ function createMemoizedFunction(fn, getCacheKey) {
349
349
  return result;
350
350
  };
351
351
  }
352
- var memoizedEfficiencyFilter = createMemoizedFunction(
353
- (data, minEfficiency, maxEfficiency) => {
354
- return data.filter((item) => {
355
- const eff = item.efficiency ?? 0;
356
- return eff >= minEfficiency && (maxEfficiency === void 0 || eff < maxEfficiency);
357
- });
358
- },
359
- (data, min, max = void 0) => `${data.length}-${min}-${max}`
360
- );
361
- var memoizedAverageEfficiency = createMemoizedFunction(
362
- (data, minThreshold = 10) => {
363
- const validItems = data.filter((item) => (item.efficiency ?? 0) >= minThreshold);
364
- if (validItems.length === 0) return 0;
365
- const sum = validItems.reduce((acc, item) => acc + (item.efficiency ?? 0), 0);
366
- return sum / validItems.length;
367
- },
368
- (data, threshold) => `${data.length}-${threshold}`
369
- );
370
352
  var memoizedOutputArrayAggregation = createMemoizedFunction(
371
353
  (arrays) => {
372
354
  if (arrays.length === 0) return [];
@@ -577,7 +559,7 @@ var dashboardService = {
577
559
  const lineMetricsTable = getTable2(dbConfig, "lineMetrics");
578
560
  const companyId = entityConfig.companyId;
579
561
  const metricsTablePrefixStr = getMetricsTablePrefix();
580
- const metricsTable = `${metricsTablePrefixStr}_${companyId ? companyId.replace(/-/g, "_") : "unknown_company"}`;
562
+ `${metricsTablePrefixStr}_${companyId ? companyId.replace(/-/g, "_") : "unknown_company"}`;
581
563
  const configuredLineIds = getConfiguredLineIds(entityConfig);
582
564
  const defaultLineId = configuredLineIds[0];
583
565
  const factoryViewId = entityConfig.factoryViewId ?? "factory";
@@ -588,7 +570,7 @@ var dashboardService = {
588
570
  if (!isValidFactoryViewConfiguration(entityConfig) || !companyId) {
589
571
  throw new Error("Factory View requires at least one configured line and companyId to be configured.");
590
572
  }
591
- const [lineResult, metricsResult, performanceResult] = await Promise.all([
573
+ const [lineResult, metricsResult] = await Promise.all([
592
574
  // Get Line 1's info for general factory details
593
575
  supabase.from(linesTable).select(`
594
576
  id,
@@ -599,28 +581,29 @@ var dashboardService = {
599
581
  companies!lines_company_id_fkey(company_name:name)
600
582
  `).eq("id", defaultLineId).maybeSingle(),
601
583
  // Get metrics from line_metrics table for all configured lines
602
- supabase.from(lineMetricsTable).select("*").in("line_id", configuredLineIds).eq("shift_id", shiftId).eq("date", date),
603
- // Get performance data from the dynamic metrics table for all configured lines
604
- supabase.from(metricsTable).select("efficiency").in("line_id", configuredLineIds).eq("shift_id", shiftId).eq("date", date)
584
+ supabase.from(lineMetricsTable).select("*").in("line_id", configuredLineIds).eq("shift_id", shiftId).eq("date", date)
605
585
  ]);
606
586
  if (lineResult.error) throw lineResult.error;
607
587
  if (!lineResult.data) throw new Error(`Configured default line (${defaultLineId}) not found`);
608
588
  if (metricsResult.error) throw metricsResult.error;
609
- if (performanceResult.error) throw performanceResult.error;
610
589
  const lineData2 = lineResult.data;
611
590
  const metricsData = metricsResult.data;
612
- const performanceData2 = performanceResult.data;
613
- const underperformingWorkspaces2 = memoizedEfficiencyFilter(performanceData2 || [], 10, 70);
614
- const validWorkspaces2 = memoizedEfficiencyFilter(performanceData2 || [], 10);
615
- const underperformingCount2 = underperformingWorkspaces2.length;
616
- validWorkspaces2.length;
617
591
  const combinedMetrics = (metricsData || []).reduce((acc, m) => {
618
- acc.avg_efficiency += m.efficiency ?? 0;
619
592
  acc.current_output += m.current_output ?? 0;
620
593
  acc.ideal_output += m.ideal_output ?? m.line_threshold ?? 0;
594
+ acc.total_workspaces += m.total_workspaces ?? 0;
595
+ acc.underperforming_workspaces += m.underperforming_workspaces ?? 0;
596
+ acc.weightedEfficiencySum += (m.avg_efficiency ?? 0) * (m.total_workspaces ?? 0);
621
597
  return acc;
622
- }, { avg_efficiency: 0, current_output: 0, ideal_output: 0 });
598
+ }, {
599
+ current_output: 0,
600
+ ideal_output: 0,
601
+ total_workspaces: 0,
602
+ underperforming_workspaces: 0,
603
+ weightedEfficiencySum: 0
604
+ });
623
605
  metricsData?.length || 1;
606
+ const avgEfficiency = combinedMetrics.total_workspaces > 0 ? combinedMetrics.weightedEfficiencySum / combinedMetrics.total_workspaces : 0;
624
607
  return {
625
608
  line_id: factoryViewId,
626
609
  // Use configured factory view ID
@@ -633,15 +616,13 @@ var dashboardService = {
633
616
  shift_id: shiftId,
634
617
  date,
635
618
  metrics: {
636
- avg_efficiency: memoizedAverageEfficiency(performanceData2 || [], 10),
637
- // Use memoized calculation for efficiency
619
+ avg_efficiency: avgEfficiency,
638
620
  avg_cycle_time: 0,
639
621
  // Needs calculation logic if required for factory view
640
622
  current_output: combinedMetrics.current_output,
641
623
  ideal_output: combinedMetrics.ideal_output,
642
- total_workspaces: 0,
643
- // SRC ALIGNMENT: Use hardcoded 44 for factory view total_workspaces
644
- underperforming_workspaces: underperformingCount2,
624
+ total_workspaces: combinedMetrics.total_workspaces || 0,
625
+ underperforming_workspaces: combinedMetrics.underperforming_workspaces,
645
626
  underperforming_workspace_names: [],
646
627
  // Populate if needed
647
628
  underperforming_workspace_uuids: [],
@@ -675,13 +656,6 @@ var dashboardService = {
675
656
  } catch (err) {
676
657
  console.error(`Error fetching line metrics for ${lineId}:`, err);
677
658
  }
678
- const { data: performanceData, error: performanceError } = await supabase.from(metricsTable).select("efficiency").eq("line_id", lineId).eq("shift_id", shiftId).eq("date", date);
679
- if (performanceError) throw performanceError;
680
- const underperformingWorkspaces = memoizedEfficiencyFilter(performanceData || [], 10, 70);
681
- const validWorkspaces = memoizedEfficiencyFilter(performanceData || [], 10);
682
- const underperformingCount = underperformingWorkspaces.length;
683
- validWorkspaces.length;
684
- const avgEfficiencyFromPerf = memoizedAverageEfficiency(performanceData || [], 10);
685
659
  const useFallbackMetrics = !metricsFromDb;
686
660
  let metricsForReturn;
687
661
  if (useFallbackMetrics) {
@@ -691,7 +665,7 @@ var dashboardService = {
691
665
  current_output: 0,
692
666
  ideal_output: 0,
693
667
  total_workspaces: 42,
694
- underperforming_workspaces: underperformingCount,
668
+ underperforming_workspaces: 0,
695
669
  underperforming_workspace_names: [],
696
670
  underperforming_workspace_uuids: [],
697
671
  output_array: [],
@@ -704,12 +678,12 @@ var dashboardService = {
704
678
  };
705
679
  } else {
706
680
  metricsForReturn = {
707
- avg_efficiency: metricsFromDb.efficiency ?? avgEfficiencyFromPerf,
681
+ avg_efficiency: metricsFromDb.avg_efficiency ?? 0,
708
682
  avg_cycle_time: metricsFromDb.avg_cycle_time || 0,
709
683
  current_output: metricsFromDb.current_output || 0,
710
684
  ideal_output: metricsFromDb.ideal_output || metricsFromDb.line_threshold || 0,
711
685
  total_workspaces: metricsFromDb.total_workspaces ?? workspaceConfig.totalWorkspaces ?? 42,
712
- underperforming_workspaces: underperformingCount,
686
+ underperforming_workspaces: metricsFromDb.underperforming_workspaces ?? 0,
713
687
  underperforming_workspace_names: metricsFromDb.underperforming_workspace_names || [],
714
688
  underperforming_workspace_uuids: metricsFromDb.underperforming_workspace_uuids || [],
715
689
  output_array: metricsFromDb.output_array || [],
@@ -720,9 +694,6 @@ var dashboardService = {
720
694
  last_updated: metricsFromDb.last_updated || (/* @__PURE__ */ new Date()).toISOString(),
721
695
  poorest_performing_workspaces: metricsFromDb.poorest_performing_workspaces || []
722
696
  };
723
- if (metricsFromDb.efficiency === null || metricsFromDb.efficiency === void 0) {
724
- metricsForReturn.avg_efficiency = avgEfficiencyFromPerf;
725
- }
726
697
  }
727
698
  return {
728
699
  line_id: lineData.id,
@@ -985,7 +956,7 @@ var dashboardService = {
985
956
  const lineMetricsTable = getTable2(dbConfig, "lineMetrics");
986
957
  const companyId = entityConfig.companyId;
987
958
  const metricsTablePrefixStr = getMetricsTablePrefix();
988
- const metricsTable = `${metricsTablePrefixStr}_${companyId ? companyId.replace(/-/g, "_") : "unknown_company"}`;
959
+ `${metricsTablePrefixStr}_${companyId ? companyId.replace(/-/g, "_") : "unknown_company"}`;
989
960
  const configuredLineIds = getConfiguredLineIds(entityConfig);
990
961
  const defaultLineId = configuredLineIds[0];
991
962
  const factoryViewId = entityConfig.factoryViewId ?? "factory";
@@ -1000,25 +971,17 @@ var dashboardService = {
1000
971
  throw new Error("Factory View requires at least one configured line and companyId to be configured.");
1001
972
  }
1002
973
  const lineIdsToQuery = configuredLineIds;
1003
- const [line1Result, metricsResult2, performanceResult2] = await Promise.all([
974
+ const [line1Result, metricsResult2] = await Promise.all([
1004
975
  supabase.from(linesTable).select("id, line_name, factory_id, factories!lines_factory_id_fkey(factory_name), company_id, companies!lines_company_id_fkey(company_name:name)").eq("id", defaultLineId).single(),
1005
- supabase.from(lineMetricsTable).select("*").in("line_id", lineIdsToQuery).eq("shift_id", queryShiftId).eq("date", queryDate),
1006
- supabase.from(metricsTable).select("efficiency").in("line_id", lineIdsToQuery).eq("shift_id", queryShiftId).eq("date", queryDate)
976
+ supabase.from(lineMetricsTable).select("*").in("line_id", lineIdsToQuery).eq("shift_id", queryShiftId).eq("date", queryDate)
1007
977
  ]);
1008
978
  if (line1Result.error) throw line1Result.error;
1009
979
  if (!line1Result.data) {
1010
980
  throw new Error(`Default line ${defaultLineId} for Factory View not found.`);
1011
981
  }
1012
982
  if (metricsResult2.error) throw metricsResult2.error;
1013
- if (performanceResult2.error) throw performanceResult2.error;
1014
983
  const line1Data = line1Result.data;
1015
984
  const metricsData = metricsResult2.data;
1016
- const performanceData2 = performanceResult2.data;
1017
- const underperformingWorkspaces2 = memoizedEfficiencyFilter(performanceData2 || [], 10, 70);
1018
- const validWorkspaces2 = memoizedEfficiencyFilter(performanceData2 || [], 10);
1019
- const underperformingCount2 = underperformingWorkspaces2.length;
1020
- const totalValidWorkspaces2 = validWorkspaces2.length;
1021
- const avgEfficiencyFromPerf2 = memoizedAverageEfficiency(performanceData2 || [], 10);
1022
985
  const initialAccumulator = {
1023
986
  avg_cycle_time: 0,
1024
987
  current_output: 0,
@@ -1026,6 +989,10 @@ var dashboardService = {
1026
989
  line_threshold: 0,
1027
990
  threshold_pph: 0,
1028
991
  total_workspaces: 0,
992
+ underperforming_workspaces: 0,
993
+ weightedEfficiencySum: 0,
994
+ underperforming_workspace_names: [],
995
+ underperforming_workspace_uuids: [],
1029
996
  output_array: [],
1030
997
  outputArrays: []
1031
998
  };
@@ -1036,13 +1003,21 @@ var dashboardService = {
1036
1003
  acc.line_threshold += m.line_threshold ?? 0;
1037
1004
  acc.threshold_pph += m.threshold_pph ?? 0;
1038
1005
  acc.total_workspaces += m.total_workspaces ?? 0;
1006
+ acc.underperforming_workspaces += m.underperforming_workspaces ?? 0;
1007
+ acc.weightedEfficiencySum += (m.avg_efficiency ?? 0) * (m.total_workspaces ?? 0);
1008
+ if (m.underperforming_workspace_names) {
1009
+ acc.underperforming_workspace_names.push(...m.underperforming_workspace_names);
1010
+ }
1011
+ if (m.underperforming_workspace_uuids) {
1012
+ acc.underperforming_workspace_uuids.push(...m.underperforming_workspace_uuids);
1013
+ }
1039
1014
  if (m.output_array && m.output_array.length > 0) {
1040
1015
  acc.outputArrays.push(m.output_array);
1041
1016
  }
1042
1017
  return acc;
1043
1018
  }, initialAccumulator);
1044
1019
  const numLines = Math.max(metricsData?.length || 0, 1);
1045
- const avgEfficiencyFromLineMetrics = (metricsData?.reduce((sum, m) => sum + (m.avg_efficiency || 0), 0) || 0) / numLines;
1020
+ const avgEfficiency = combinedMetricsData.total_workspaces > 0 ? combinedMetricsData.weightedEfficiencySum / combinedMetricsData.total_workspaces : 0;
1046
1021
  return {
1047
1022
  line_id: factoryViewId,
1048
1023
  line_name: "Factory View",
@@ -1053,22 +1028,20 @@ var dashboardService = {
1053
1028
  date: queryDate,
1054
1029
  shift_id: queryShiftId,
1055
1030
  metrics: {
1056
- avg_efficiency: avgEfficiencyFromPerf2 > 0 ? avgEfficiencyFromPerf2 : avgEfficiencyFromLineMetrics,
1057
- // Use performance data first, fallback to line metrics
1031
+ avg_efficiency: avgEfficiency,
1058
1032
  avg_cycle_time: combinedMetricsData.avg_cycle_time / numLines,
1059
1033
  current_output: combinedMetricsData.current_output,
1060
1034
  ideal_output: combinedMetricsData.ideal_output,
1061
1035
  total_workspaces: combinedMetricsData.total_workspaces || 0,
1062
- // Use combined or default
1063
- underperforming_workspaces: underperformingCount2,
1036
+ underperforming_workspaces: combinedMetricsData.underperforming_workspaces,
1064
1037
  line_threshold: combinedMetricsData.line_threshold,
1065
1038
  threshold_pph: combinedMetricsData.threshold_pph / numLines,
1066
1039
  shift_start: metricsData?.[0]?.shift_start || shiftConfig.dayShift?.startTime || "06:00",
1067
1040
  shift_end: metricsData?.[0]?.shift_end || shiftConfig.dayShift?.endTime || "18:00",
1068
1041
  last_updated: (/* @__PURE__ */ new Date()).toISOString(),
1069
1042
  output_array: combinedMetricsData.outputArrays.length > 0 ? memoizedOutputArrayAggregation(combinedMetricsData.outputArrays) : [],
1070
- underperforming_workspace_names: [],
1071
- underperforming_workspace_uuids: [],
1043
+ underperforming_workspace_names: combinedMetricsData.underperforming_workspace_names,
1044
+ underperforming_workspace_uuids: combinedMetricsData.underperforming_workspace_uuids,
1072
1045
  poorest_performing_workspaces: []
1073
1046
  }
1074
1047
  };
@@ -1076,25 +1049,17 @@ var dashboardService = {
1076
1049
  if (!companyId) {
1077
1050
  throw new Error("Company ID must be configured for detailed line requests.");
1078
1051
  }
1079
- const [lineResult, metricsResult, performanceResult] = await Promise.all([
1052
+ const [lineResult, metricsResult] = await Promise.all([
1080
1053
  supabase.from(linesTable).select("id, line_name, factory_id, factories!lines_factory_id_fkey(factory_name), company_id, companies!lines_company_id_fkey(company_name:name)").eq("id", lineIdToQuery).single(),
1081
- supabase.from(lineMetricsTable).select("*").eq("line_id", lineIdToQuery).eq("shift_id", queryShiftId).eq("date", queryDate).maybeSingle(),
1082
- supabase.from(metricsTable).select("efficiency").eq("line_id", lineIdToQuery).eq("shift_id", queryShiftId).eq("date", queryDate)
1054
+ supabase.from(lineMetricsTable).select("*").eq("line_id", lineIdToQuery).eq("shift_id", queryShiftId).eq("date", queryDate).maybeSingle()
1083
1055
  ]);
1084
1056
  if (lineResult.error) throw lineResult.error;
1085
1057
  if (!lineResult.data) {
1086
1058
  throw new Error(`Line ${lineIdToQuery} not found.`);
1087
1059
  }
1088
1060
  if (metricsResult.error) throw metricsResult.error;
1089
- if (performanceResult.error) throw performanceResult.error;
1090
1061
  const lineData = lineResult.data;
1091
1062
  const metrics2 = metricsResult.data;
1092
- const performanceData = performanceResult.data;
1093
- const underperformingWorkspaces = memoizedEfficiencyFilter(performanceData || [], 10, 70);
1094
- const validWorkspaces = memoizedEfficiencyFilter(performanceData || [], 10);
1095
- const underperformingCount = underperformingWorkspaces.length;
1096
- const totalValidWorkspaces = validWorkspaces.length;
1097
- const avgEfficiencyFromPerf = memoizedAverageEfficiency(performanceData || [], 10);
1098
1063
  return {
1099
1064
  line_id: lineData.id,
1100
1065
  line_name: lineData.line_name,
@@ -1105,13 +1070,12 @@ var dashboardService = {
1105
1070
  date: queryDate,
1106
1071
  shift_id: queryShiftId,
1107
1072
  metrics: {
1108
- avg_efficiency: avgEfficiencyFromPerf > 0 ? avgEfficiencyFromPerf : metrics2?.avg_efficiency ?? 0,
1109
- // Use performance data first, fallback to line metrics
1073
+ avg_efficiency: metrics2?.avg_efficiency ?? 0,
1110
1074
  avg_cycle_time: metrics2?.avg_cycle_time || 0,
1111
1075
  current_output: metrics2?.current_output || 0,
1112
1076
  ideal_output: metrics2?.ideal_output || metrics2?.line_threshold || 0,
1113
1077
  total_workspaces: metrics2?.total_workspaces ?? workspaceConfig.totalWorkspaces ?? 42,
1114
- underperforming_workspaces: underperformingCount,
1078
+ underperforming_workspaces: metrics2?.underperforming_workspaces ?? 0,
1115
1079
  line_threshold: metrics2?.line_threshold || 0,
1116
1080
  threshold_pph: metrics2?.threshold_pph || 0,
1117
1081
  shift_start: metrics2?.shift_start || shiftConfig.dayShift?.startTime || "06:00",
@@ -1996,14 +1960,17 @@ var authOTPService = {
1996
1960
  const { error } = await supabase.auth.signInWithOtp({
1997
1961
  email,
1998
1962
  options: {
1999
- shouldCreateUser: true,
2000
- // Creates user if doesn't exist
1963
+ shouldCreateUser: false,
1964
+ // Only allow existing users to log in
2001
1965
  emailRedirectTo: void 0
2002
1966
  // Disable magic link redirect
2003
1967
  }
2004
1968
  });
2005
1969
  if (error) {
2006
1970
  console.error("Error sending OTP:", error);
1971
+ if (error.message.toLowerCase().includes("signups not allowed") || error.message.toLowerCase().includes("signup") || error.message.toLowerCase().includes("not allowed")) {
1972
+ error.message = "You don't have an account with us. Please contact the Optifye team for more details.";
1973
+ }
2007
1974
  }
2008
1975
  return { error };
2009
1976
  },
@@ -4617,20 +4584,13 @@ var useRealtimeLineMetrics = ({
4617
4584
  workspaceData: workspaceData?.length
4618
4585
  });
4619
4586
  }
4620
- let avgEfficiency = 0;
4621
- if (workspaceData && workspaceData.length > 0) {
4622
- const activeWorkspaces = workspaceData.filter((w) => w.efficiency >= 10);
4623
- if (activeWorkspaces.length > 0) {
4624
- const totalEfficiency = activeWorkspaces.reduce((sum, workspace) => sum + (workspace.efficiency || 0), 0);
4625
- avgEfficiency = totalEfficiency / activeWorkspaces.length;
4626
- }
4627
- }
4587
+ const avgEfficiency = metricsData.reduce((sum, m) => sum + (m.avg_efficiency || 0), 0) / metricsData.length;
4628
4588
  const combinedMetrics = {
4629
4589
  line_id: factoryViewId,
4630
4590
  shift_id: shiftId,
4631
4591
  date,
4632
4592
  factory_id: firstLine.factory_id,
4633
- avg_efficiency: avgEfficiency > 0 ? avgEfficiency : metricsData.reduce((sum, m) => sum + (m.avg_efficiency || 0), 0) / metricsData.length,
4593
+ avg_efficiency: avgEfficiency,
4634
4594
  avg_cycle_time: metricsData.reduce((sum, m) => sum + (m.avg_cycle_time || 0), 0) / metricsData.length,
4635
4595
  current_output: metricsData.reduce((sum, m) => sum + (m.current_output || 0), 0),
4636
4596
  ideal_output: metricsData.reduce((sum, m) => sum + (m.ideal_output || 0), 0),
@@ -4682,22 +4642,14 @@ var useRealtimeLineMetrics = ({
4682
4642
  workspaceData: workspaceData?.length
4683
4643
  });
4684
4644
  }
4685
- let avgEfficiency = 0;
4686
- if (workspaceData && workspaceData.length > 0) {
4687
- const activeWorkspaces = workspaceData.filter((w) => w.efficiency >= 10);
4688
- if (activeWorkspaces.length > 0) {
4689
- const totalEfficiency = activeWorkspaces.reduce((sum, workspace) => sum + (workspace.efficiency || 0), 0);
4690
- avgEfficiency = totalEfficiency / activeWorkspaces.length;
4691
- }
4692
- }
4693
4645
  if (!metricsData) {
4694
4646
  setMetrics({
4695
4647
  line_id: lineIdRef.current,
4696
4648
  shift_id: shiftId,
4697
4649
  date,
4698
4650
  factory_id: "",
4699
- avg_efficiency: avgEfficiency,
4700
- // Use calculated workspace average
4651
+ avg_efficiency: 0,
4652
+ // Default to 0 when no data
4701
4653
  avg_cycle_time: 0,
4702
4654
  current_output: 0,
4703
4655
  ideal_output: 0,
@@ -4716,7 +4668,6 @@ var useRealtimeLineMetrics = ({
4716
4668
  } else {
4717
4669
  setMetrics({
4718
4670
  ...metricsData,
4719
- avg_efficiency: avgEfficiency > 0 ? avgEfficiency : metricsData.avg_efficiency,
4720
4671
  poorest_performing_workspaces: poorestPerformingWorkspaces
4721
4672
  });
4722
4673
  }
@@ -5565,6 +5516,7 @@ console.log("\u{1F504} workspaceDisplayNames.ts module loaded");
5565
5516
  var runtimeWorkspaceDisplayNames = {};
5566
5517
  var isInitialized = false;
5567
5518
  var isInitializing = false;
5519
+ var initializedWithLineIds = [];
5568
5520
  function getCurrentLineIds() {
5569
5521
  try {
5570
5522
  const config = _getDashboardConfigInstance();
@@ -5596,28 +5548,29 @@ async function initializeWorkspaceDisplayNames(explicitLineId) {
5596
5548
  targetLineIds = getCurrentLineIds();
5597
5549
  }
5598
5550
  console.log("\u{1F504} Target line IDs for workspace filtering:", targetLineIds);
5599
- const allDisplayNamesMap = /* @__PURE__ */ new Map();
5551
+ runtimeWorkspaceDisplayNames = {};
5600
5552
  if (targetLineIds.length > 0) {
5601
5553
  for (const lineId of targetLineIds) {
5602
5554
  console.log(`\u{1F504} Fetching workspaces for line: ${lineId}`);
5603
5555
  const lineDisplayNamesMap = await workspaceService.getWorkspaceDisplayNames(void 0, lineId);
5556
+ runtimeWorkspaceDisplayNames[lineId] = {};
5604
5557
  lineDisplayNamesMap.forEach((displayName, workspaceId) => {
5605
- allDisplayNamesMap.set(workspaceId, displayName);
5558
+ runtimeWorkspaceDisplayNames[lineId][workspaceId] = displayName;
5606
5559
  });
5560
+ console.log(`\u2705 Stored ${lineDisplayNamesMap.size} workspaces for line ${lineId}`);
5607
5561
  }
5608
5562
  } else {
5609
5563
  console.warn("\u26A0\uFE0F No line IDs found, fetching all workspaces (less efficient)");
5610
5564
  const allWorkspacesMap = await workspaceService.getWorkspaceDisplayNames();
5565
+ runtimeWorkspaceDisplayNames["global"] = {};
5611
5566
  allWorkspacesMap.forEach((displayName, workspaceId) => {
5612
- allDisplayNamesMap.set(workspaceId, displayName);
5567
+ runtimeWorkspaceDisplayNames["global"][workspaceId] = displayName;
5613
5568
  });
5614
5569
  }
5615
- runtimeWorkspaceDisplayNames = {};
5616
- allDisplayNamesMap.forEach((displayName, workspaceId) => {
5617
- runtimeWorkspaceDisplayNames[workspaceId] = displayName;
5618
- });
5619
5570
  isInitialized = true;
5571
+ initializedWithLineIds = targetLineIds;
5620
5572
  console.log("\u2705 Workspace display names initialized from Supabase:", runtimeWorkspaceDisplayNames);
5573
+ console.log("\u2705 Initialized with line IDs:", initializedWithLineIds);
5621
5574
  } catch (error) {
5622
5575
  console.error("\u274C Failed to initialize workspace display names from Supabase:", error);
5623
5576
  } finally {
@@ -5627,7 +5580,20 @@ async function initializeWorkspaceDisplayNames(explicitLineId) {
5627
5580
  var preInitializeWorkspaceDisplayNames = async (lineId) => {
5628
5581
  console.log("\u{1F504} preInitializeWorkspaceDisplayNames called for lineId:", lineId);
5629
5582
  if (isInitialized || isInitializing) {
5630
- console.log("\u{1F504} Already initialized or initializing, skipping pre-init");
5583
+ console.log("\u{1F504} Already initialized or initializing");
5584
+ if (lineId && !runtimeWorkspaceDisplayNames[lineId]) {
5585
+ console.log(`\u{1F504} Line ${lineId} not in cache, fetching...`);
5586
+ try {
5587
+ const lineDisplayNamesMap = await workspaceService.getWorkspaceDisplayNames(void 0, lineId);
5588
+ runtimeWorkspaceDisplayNames[lineId] = {};
5589
+ lineDisplayNamesMap.forEach((displayName, workspaceId) => {
5590
+ runtimeWorkspaceDisplayNames[lineId][workspaceId] = displayName;
5591
+ });
5592
+ console.log(`\u2705 Added ${lineDisplayNamesMap.size} workspaces for line ${lineId}`);
5593
+ } catch (error) {
5594
+ console.error(`\u274C Failed to fetch workspaces for line ${lineId}:`, error);
5595
+ }
5596
+ }
5631
5597
  return;
5632
5598
  }
5633
5599
  await initializeWorkspaceDisplayNames(lineId);
@@ -5640,45 +5606,91 @@ var forceRefreshWorkspaceDisplayNames = async (lineId) => {
5640
5606
  console.log("\u{1F504} Module loaded, will initialize lazily when first function is called");
5641
5607
  var getWorkspaceDisplayName = (workspaceId, lineId) => {
5642
5608
  if (!isInitialized && !isInitializing) {
5643
- console.log(`\u{1F504} [DEBUG] getWorkspaceDisplayName(${workspaceId}) - Not initialized, triggering lazy init...`);
5609
+ console.log(`\u{1F504} [DEBUG] getWorkspaceDisplayName(${workspaceId}, lineId: ${lineId}) - Not initialized, triggering lazy init...`);
5644
5610
  } else if (isInitializing) {
5645
- console.log(`\u{1F504} [DEBUG] getWorkspaceDisplayName(${workspaceId}) - Currently initializing...`);
5611
+ console.log(`\u{1F504} [DEBUG] getWorkspaceDisplayName(${workspaceId}, lineId: ${lineId}) - Currently initializing...`);
5646
5612
  }
5647
5613
  if (!isInitialized && !isInitializing) {
5648
- console.log("\u{1F504} Lazy initialization triggered by getWorkspaceDisplayName");
5614
+ console.log("\u{1F504} Lazy initialization triggered by getWorkspaceDisplayName with lineId:", lineId);
5649
5615
  initializeWorkspaceDisplayNames(lineId).catch((error) => {
5650
5616
  console.error("\u274C Lazy initialization failed:", error);
5651
5617
  });
5652
5618
  }
5653
- const displayName = runtimeWorkspaceDisplayNames[workspaceId];
5619
+ if (isInitialized && lineId && !runtimeWorkspaceDisplayNames[lineId]) {
5620
+ console.log(`\u{1F504} Line ${lineId} not in cache, fetching its workspaces...`);
5621
+ workspaceService.getWorkspaceDisplayNames(void 0, lineId).then((lineDisplayNamesMap) => {
5622
+ runtimeWorkspaceDisplayNames[lineId] = {};
5623
+ lineDisplayNamesMap.forEach((displayName2, workspaceId2) => {
5624
+ runtimeWorkspaceDisplayNames[lineId][workspaceId2] = displayName2;
5625
+ });
5626
+ console.log(`\u2705 Added ${lineDisplayNamesMap.size} workspaces for line ${lineId} to cache`);
5627
+ }).catch((error) => {
5628
+ console.error(`\u274C Failed to fetch workspaces for line ${lineId}:`, error);
5629
+ });
5630
+ }
5631
+ let displayName;
5632
+ if (lineId && runtimeWorkspaceDisplayNames[lineId]) {
5633
+ displayName = runtimeWorkspaceDisplayNames[lineId][workspaceId];
5634
+ } else if (!lineId) {
5635
+ for (const cachedLineId of Object.keys(runtimeWorkspaceDisplayNames)) {
5636
+ if (runtimeWorkspaceDisplayNames[cachedLineId][workspaceId]) {
5637
+ displayName = runtimeWorkspaceDisplayNames[cachedLineId][workspaceId];
5638
+ console.warn(`\u26A0\uFE0F No lineId provided for ${workspaceId}, found in line ${cachedLineId}`);
5639
+ break;
5640
+ }
5641
+ }
5642
+ }
5654
5643
  if (displayName) {
5655
- console.log(`getWorkspaceDisplayName(${workspaceId}) -> ${displayName} (from Supabase)`);
5644
+ console.log(`getWorkspaceDisplayName(${workspaceId}, lineId: ${lineId}) -> ${displayName} (from Supabase)`);
5656
5645
  return displayName;
5657
5646
  } else {
5658
5647
  if (isInitialized) {
5659
- console.log(`getWorkspaceDisplayName(${workspaceId}) -> ${workspaceId} (not found in Supabase data)`);
5648
+ console.log(`getWorkspaceDisplayName(${workspaceId}, lineId: ${lineId}) -> ${workspaceId} (not found in Supabase data)`);
5660
5649
  } else {
5661
- console.log(`getWorkspaceDisplayName(${workspaceId}) -> ${workspaceId} (Supabase not initialized yet)`);
5650
+ console.log(`getWorkspaceDisplayName(${workspaceId}, lineId: ${lineId}) -> ${workspaceId} (Supabase not initialized yet)`);
5662
5651
  }
5663
5652
  return workspaceId;
5664
5653
  }
5665
5654
  };
5666
5655
  var getShortWorkspaceDisplayName = (workspaceId, lineId) => {
5667
5656
  if (!isInitialized && !isInitializing) {
5668
- console.log("\u{1F504} Lazy initialization triggered by getShortWorkspaceDisplayName");
5657
+ console.log("\u{1F504} Lazy initialization triggered by getShortWorkspaceDisplayName with lineId:", lineId);
5669
5658
  initializeWorkspaceDisplayNames(lineId).catch((error) => {
5670
5659
  console.error("\u274C Lazy initialization failed:", error);
5671
5660
  });
5672
5661
  }
5673
- const displayName = runtimeWorkspaceDisplayNames[workspaceId];
5662
+ if (isInitialized && lineId && !runtimeWorkspaceDisplayNames[lineId]) {
5663
+ console.log(`\u{1F504} Line ${lineId} not in cache, fetching its workspaces...`);
5664
+ workspaceService.getWorkspaceDisplayNames(void 0, lineId).then((lineDisplayNamesMap) => {
5665
+ runtimeWorkspaceDisplayNames[lineId] = {};
5666
+ lineDisplayNamesMap.forEach((displayName2, workspaceId2) => {
5667
+ runtimeWorkspaceDisplayNames[lineId][workspaceId2] = displayName2;
5668
+ });
5669
+ console.log(`\u2705 Added ${lineDisplayNamesMap.size} workspaces for line ${lineId} to cache`);
5670
+ }).catch((error) => {
5671
+ console.error(`\u274C Failed to fetch workspaces for line ${lineId}:`, error);
5672
+ });
5673
+ }
5674
+ let displayName;
5675
+ if (lineId && runtimeWorkspaceDisplayNames[lineId]) {
5676
+ displayName = runtimeWorkspaceDisplayNames[lineId][workspaceId];
5677
+ } else if (!lineId) {
5678
+ for (const cachedLineId of Object.keys(runtimeWorkspaceDisplayNames)) {
5679
+ if (runtimeWorkspaceDisplayNames[cachedLineId][workspaceId]) {
5680
+ displayName = runtimeWorkspaceDisplayNames[cachedLineId][workspaceId];
5681
+ console.warn(`\u26A0\uFE0F No lineId provided for ${workspaceId}, found in line ${cachedLineId}`);
5682
+ break;
5683
+ }
5684
+ }
5685
+ }
5674
5686
  if (displayName) {
5675
- console.log(`getShortWorkspaceDisplayName(${workspaceId}) -> ${displayName} (from Supabase)`);
5687
+ console.log(`getShortWorkspaceDisplayName(${workspaceId}, lineId: ${lineId}) -> ${displayName} (from Supabase)`);
5676
5688
  return displayName;
5677
5689
  } else {
5678
5690
  if (isInitialized) {
5679
- console.log(`getShortWorkspaceDisplayName(${workspaceId}) -> ${workspaceId} (not found in Supabase data)`);
5691
+ console.log(`getShortWorkspaceDisplayName(${workspaceId}, lineId: ${lineId}) -> ${workspaceId} (not found in Supabase data)`);
5680
5692
  } else {
5681
- console.log(`getShortWorkspaceDisplayName(${workspaceId}) -> ${workspaceId} (Supabase not initialized yet)`);
5693
+ console.log(`getShortWorkspaceDisplayName(${workspaceId}, lineId: ${lineId}) -> ${workspaceId} (Supabase not initialized yet)`);
5682
5694
  }
5683
5695
  return workspaceId;
5684
5696
  }
@@ -5699,7 +5711,14 @@ var getAllWorkspaceDisplayNamesAsync = async (companyId, lineId) => {
5699
5711
  while (isInitializing) {
5700
5712
  await new Promise((resolve) => setTimeout(resolve, 100));
5701
5713
  }
5702
- return { ...runtimeWorkspaceDisplayNames };
5714
+ if (lineId && runtimeWorkspaceDisplayNames[lineId]) {
5715
+ return { ...runtimeWorkspaceDisplayNames[lineId] };
5716
+ }
5717
+ const allNames = {};
5718
+ Object.values(runtimeWorkspaceDisplayNames).forEach((lineNames) => {
5719
+ Object.assign(allNames, lineNames);
5720
+ });
5721
+ return allNames;
5703
5722
  };
5704
5723
  var getWorkspaceDisplayNamesMap = async (workspaceIds, companyId, lineId) => {
5705
5724
  const allNames = await getAllWorkspaceDisplayNamesAsync(companyId, lineId);
@@ -5728,10 +5747,11 @@ var clearWorkspaceDisplayNamesCache = () => {
5728
5747
  runtimeWorkspaceDisplayNames = {};
5729
5748
  isInitialized = false;
5730
5749
  isInitializing = false;
5750
+ initializedWithLineIds = [];
5731
5751
  };
5732
5752
 
5733
5753
  // src/lib/hooks/useWorkspaceDisplayNames.ts
5734
- var useWorkspaceDisplayNames = (companyId, lineId) => {
5754
+ var useWorkspaceDisplayNames = (lineId, companyId) => {
5735
5755
  const [displayNames, setDisplayNames] = useState({});
5736
5756
  const [loading, setLoading] = useState(true);
5737
5757
  const [error, setError] = useState(null);
@@ -5757,7 +5777,7 @@ var useWorkspaceDisplayNames = (companyId, lineId) => {
5757
5777
  refetch: fetchDisplayNames
5758
5778
  };
5759
5779
  };
5760
- var useWorkspaceDisplayName = (workspaceId, companyId, lineId) => {
5780
+ var useWorkspaceDisplayName = (workspaceId, lineId, companyId) => {
5761
5781
  const [displayName, setDisplayName] = useState(workspaceId);
5762
5782
  const [loading, setLoading] = useState(true);
5763
5783
  const [error, setError] = useState(null);
@@ -5784,7 +5804,7 @@ var useWorkspaceDisplayName = (workspaceId, companyId, lineId) => {
5784
5804
  refetch: fetchDisplayName
5785
5805
  };
5786
5806
  };
5787
- var useWorkspaceDisplayNamesMap = (workspaceIds, companyId, lineId) => {
5807
+ var useWorkspaceDisplayNamesMap = (workspaceIds, lineId, companyId) => {
5788
5808
  const [displayNames, setDisplayNames] = useState({});
5789
5809
  const [loading, setLoading] = useState(true);
5790
5810
  const [error, setError] = useState(null);
@@ -16742,25 +16762,40 @@ var createMotionComponent = /* @__PURE__ */ createMotionComponentFactory({
16742
16762
 
16743
16763
  // ../../node_modules/framer-motion/dist/es/render/components/motion/proxy.mjs
16744
16764
  var motion = /* @__PURE__ */ createDOMMotionComponentProxy(createMotionComponent);
16745
- var LoadingSpinner = ({
16765
+ var OptifyeLogoLoader = ({
16746
16766
  size = "md",
16747
16767
  message,
16748
16768
  className
16749
16769
  }) => {
16750
16770
  const sizeClasses = {
16751
- sm: "w-5 h-5",
16752
- md: "w-8 h-8",
16753
- lg: "w-12 h-12"
16771
+ sm: "w-10",
16772
+ // 40px
16773
+ md: "w-16",
16774
+ // 64px
16775
+ lg: "w-24"
16776
+ // 96px
16754
16777
  };
16755
- return /* @__PURE__ */ jsxs("div", { className: `flex flex-col items-center justify-center p-4 ${className || ""}`, children: [
16756
- /* @__PURE__ */ jsx("div", { className: `${sizeClasses[size]} animate-spin`, children: /* @__PURE__ */ jsxs("svg", { className: "w-full h-full text-[var(--primary-DEFAULT)]", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
16757
- /* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
16758
- /* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
16759
- ] }) }),
16760
- message && /* @__PURE__ */ jsx("div", { className: "mt-3 text-gray-600 text-sm font-medium", children: message })
16761
- ] });
16778
+ return /* @__PURE__ */ jsxs(
16779
+ "div",
16780
+ {
16781
+ role: "status",
16782
+ "aria-label": "Loading",
16783
+ className: `flex flex-col items-center justify-center p-4 ${className || ""}`.trim(),
16784
+ children: [
16785
+ /* @__PURE__ */ jsx(
16786
+ "img",
16787
+ {
16788
+ src: "/optifye-logo.png",
16789
+ alt: "Optifye Logo",
16790
+ className: `${sizeClasses[size]} h-auto animate-pulse select-none pointer-events-none`
16791
+ }
16792
+ ),
16793
+ message && /* @__PURE__ */ jsx("div", { className: "mt-3 text-gray-600 text-sm font-medium text-center", children: message })
16794
+ ]
16795
+ }
16796
+ );
16762
16797
  };
16763
- var LoadingSpinner_default = LoadingSpinner;
16798
+ var OptifyeLogoLoader_default = OptifyeLogoLoader;
16764
16799
  var LoadingPage = ({
16765
16800
  message = "Loading Dashboard...",
16766
16801
  subMessage = "Please wait while we prepare your data",
@@ -16774,29 +16809,17 @@ var LoadingPage = ({
16774
16809
  return () => clearTimeout(timeout);
16775
16810
  }, [message]);
16776
16811
  return /* @__PURE__ */ jsx("div", { className: `flex h-full w-full items-center justify-center bg-slate-50 ${className || ""}`, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center space-y-6 text-center", children: [
16777
- /* @__PURE__ */ jsx(LoadingSpinner_default, { size: "lg", message: void 0 }),
16778
- /* @__PURE__ */ jsxs("div", { children: [
16779
- /* @__PURE__ */ jsx(
16780
- motion.h3,
16781
- {
16782
- className: "text-xl font-semibold text-gray-800",
16783
- initial: { opacity: 0, y: 10 },
16784
- animate: { opacity: 1, y: 0 },
16785
- transition: { delay: 0.1, duration: 0.3 },
16786
- children: message
16787
- }
16788
- ),
16789
- subMessage && /* @__PURE__ */ jsx(
16790
- motion.p,
16791
- {
16792
- className: "mt-2 text-base text-gray-600",
16793
- initial: { opacity: 0 },
16794
- animate: { opacity: 1 },
16795
- transition: { delay: 0.2, duration: 0.3 },
16796
- children: subMessage
16797
- }
16798
- )
16799
- ] })
16812
+ /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "lg", message }),
16813
+ subMessage && /* @__PURE__ */ jsx(
16814
+ motion.p,
16815
+ {
16816
+ className: "mt-2 text-base text-gray-600",
16817
+ initial: { opacity: 0 },
16818
+ animate: { opacity: 1 },
16819
+ transition: { delay: 0.2, duration: 0.3 },
16820
+ children: subMessage
16821
+ }
16822
+ )
16800
16823
  ] }) });
16801
16824
  };
16802
16825
  var LoadingPage_default = LoadingPage;
@@ -18492,7 +18515,7 @@ var VideoCard = React19__default.memo(({
18492
18515
  onFatalError: onFatalError ?? (() => throttledReloadDashboard())
18493
18516
  });
18494
18517
  }
18495
- const displayName = getWorkspaceDisplayName(workspace.workspace_name);
18518
+ const displayName = getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id);
18496
18519
  const getEfficiencyOverlayColor = (efficiency) => {
18497
18520
  if (efficiency >= 80) {
18498
18521
  return "bg-[#00D654]/25";
@@ -18641,7 +18664,7 @@ var VideoGridView = React19__default.memo(({
18641
18664
  }, [cropping]);
18642
18665
  const veryLowEfficiencyWorkspaces = useMemo(() => {
18643
18666
  return new Set(
18644
- workspaces.filter((w) => w.efficiency < 50 && w.efficiency >= 10).map((w) => w.workspace_name)
18667
+ workspaces.filter((w) => w.efficiency < 50 && w.efficiency >= 10).map((w) => `${w.line_id}_${w.workspace_name}`)
18645
18668
  );
18646
18669
  }, [workspaces]);
18647
18670
  const filteredWorkspaces = useMemo(() => {
@@ -18749,7 +18772,7 @@ var VideoGridView = React19__default.memo(({
18749
18772
  efficiency: workspace.efficiency,
18750
18773
  action_count: workspace.action_count
18751
18774
  });
18752
- const displayName = getWorkspaceDisplayName(workspace.workspace_name);
18775
+ const displayName = getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id);
18753
18776
  const navParams = getWorkspaceNavigationParams(workspaceId, displayName);
18754
18777
  router.push(`/workspace/${workspaceId}${navParams}`);
18755
18778
  }, [router]);
@@ -18777,7 +18800,7 @@ var VideoGridView = React19__default.memo(({
18777
18800
  }).map((workspace) => {
18778
18801
  const workspaceId = workspace.workspace_uuid || workspace.workspace_name;
18779
18802
  const isVisible = visibleWorkspaces.has(workspaceId);
18780
- const isVeryLowEfficiency = veryLowEfficiencyWorkspaces.has(workspace.workspace_name);
18803
+ const isVeryLowEfficiency = veryLowEfficiencyWorkspaces.has(`${workspace.line_id}_${workspace.workspace_name}`);
18781
18804
  const workspaceCropping = getWorkspaceCropping(workspace.workspace_name);
18782
18805
  return /* @__PURE__ */ jsx(
18783
18806
  "div",
@@ -19947,20 +19970,23 @@ var LineHistoryCalendar = ({
19947
19970
  } else {
19948
19971
  calendar.push({
19949
19972
  date: currentDate,
19950
- dayShift: { avg_efficiency: 0, underperforming_workspaces: 0, total_workspaces: 0 },
19951
- nightShift: { avg_efficiency: 0, underperforming_workspaces: 0, total_workspaces: 0 }
19973
+ dayShift: { avg_efficiency: 0, underperforming_workspaces: 0, total_workspaces: 0, hasData: false },
19974
+ nightShift: { avg_efficiency: 0, underperforming_workspaces: 0, total_workspaces: 0, hasData: false }
19952
19975
  });
19953
19976
  }
19954
19977
  }
19955
19978
  return calendar;
19956
19979
  }, [data, month, year, configuredTimezone]);
19957
- const getPerformanceColor = (efficiency, date) => {
19980
+ const hasRealData = (shift) => {
19981
+ if (shift.hasData !== void 0) return shift.hasData;
19982
+ return shift.total_workspaces > 0 || shift.avg_efficiency > 0 || shift.underperforming_workspaces > 0;
19983
+ };
19984
+ const getPerformanceColor = (efficiency, date, hasData) => {
19958
19985
  const istNow = todayInZone;
19959
19986
  const nowString = `${istNow.getFullYear()}-${String(istNow.getMonth() + 1).padStart(2, "0")}-${String(istNow.getDate()).padStart(2, "0")}`;
19960
19987
  const dateString = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
19961
- if (date.getDay() === 0) return "bg-gray-300 dark:bg-gray-600";
19962
19988
  if (dateString > nowString) return "bg-gray-200 dark:bg-gray-700";
19963
- if (efficiency < 10) return "bg-gray-300 dark:bg-gray-600";
19989
+ if (!hasData) return "bg-gray-300 dark:bg-gray-600";
19964
19990
  return efficiency >= 75 ? "bg-green-500 dark:bg-green-600" : "bg-red-500 dark:bg-red-600";
19965
19991
  };
19966
19992
  const isCurrentDate = (date) => {
@@ -19979,7 +20005,7 @@ var LineHistoryCalendar = ({
19979
20005
  const istNow = todayInZone;
19980
20006
  const nowString = `${istNow.getFullYear()}-${String(istNow.getMonth() + 1).padStart(2, "0")}-${String(istNow.getDate()).padStart(2, "0")}`;
19981
20007
  const dateString = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
19982
- if (dateString > nowString || date.getDay() === 0) return null;
20008
+ if (dateString > nowString) return null;
19983
20009
  return /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-black/80 rounded-lg p-2 text-white opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsxs("div", { className: "text-xs space-y-1", children: [
19984
20010
  /* @__PURE__ */ jsxs("div", { children: [
19985
20011
  "Efficiency: ",
@@ -20000,14 +20026,14 @@ var LineHistoryCalendar = ({
20000
20026
  if (!shiftData) return /* @__PURE__ */ jsx("div", { className: "h-full border border-gray-100 dark:border-gray-700 rounded-lg bg-gray-50 dark:bg-gray-800" });
20001
20027
  const isToday = isCurrentDate(day.date instanceof Date ? day.date : new Date(day.date));
20002
20028
  const isFuture = isFutureDate(day.date instanceof Date ? day.date : new Date(day.date));
20003
- const isInactive = (shiftData.avg_efficiency || 0) < 10;
20029
+ const hasData = hasRealData(shiftData);
20004
20030
  const dateObj = day.date instanceof Date ? day.date : new Date(day.date);
20005
20031
  return /* @__PURE__ */ jsx(
20006
20032
  "div",
20007
20033
  {
20008
- className: `group h-full ${isFuture || isInactive ? "cursor-not-allowed" : "cursor-pointer hover:opacity-90"}`,
20034
+ className: `group h-full ${isFuture || !hasData ? "cursor-not-allowed" : "cursor-pointer hover:opacity-90"}`,
20009
20035
  onClick: () => {
20010
- if (!isFuture && !isInactive) {
20036
+ if (!isFuture && hasData) {
20011
20037
  const dateObj2 = day.date instanceof Date ? day.date : new Date(day.date);
20012
20038
  const year2 = dateObj2.getFullYear();
20013
20039
  const month2 = String(dateObj2.getMonth() + 1).padStart(2, "0");
@@ -20032,15 +20058,15 @@ var LineHistoryCalendar = ({
20032
20058
  }
20033
20059
  },
20034
20060
  children: /* @__PURE__ */ jsxs("div", { className: `
20035
- ${getPerformanceColor(shiftData.avg_efficiency || 0, dateObj)}
20061
+ ${getPerformanceColor(shiftData.avg_efficiency || 0, dateObj, hasData)}
20036
20062
  rounded-lg h-full p-2 relative
20037
20063
  ${isToday ? "ring-2 ring-blue-500 dark:ring-blue-400 ring-offset-2 dark:ring-offset-gray-800 shadow-md" : ""}
20038
20064
  `, children: [
20039
20065
  /* @__PURE__ */ jsx("div", { className: `
20040
- text-base font-medium text-white flex items-center
20066
+ text-base font-medium ${hasData ? "text-white" : "text-gray-500"} flex items-center
20041
20067
  ${isToday ? "bg-blue-500 dark:bg-blue-600 rounded-full w-7 h-7 justify-center" : ""}
20042
20068
  `, children: dateObj.getDate() }),
20043
- !isFuture && !isInactive && renderStats(shiftData, dateObj)
20069
+ !isFuture && hasData && renderStats(shiftData, dateObj)
20044
20070
  ] })
20045
20071
  }
20046
20072
  );
@@ -20221,7 +20247,7 @@ var LineMonthlyHistory = ({
20221
20247
  className: "block hover:bg-gray-50 transition-colors rounded-lg w-full text-left",
20222
20248
  children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between py-3 px-2 border-b border-gray-100 last:border-b-0", children: [
20223
20249
  /* @__PURE__ */ jsxs("div", { className: "font-medium text-gray-900", children: [
20224
- getWorkspaceDisplayName(workspace.workspace_name),
20250
+ getWorkspaceDisplayName(workspace.workspace_name, lineId),
20225
20251
  workspace.avg_efficiency !== void 0 && /* @__PURE__ */ jsxs("span", { className: "ml-2 text-sm text-gray-500", children: [
20226
20252
  "(",
20227
20253
  workspace.avg_efficiency.toFixed(1),
@@ -20805,7 +20831,7 @@ var LinePdfGenerator = ({
20805
20831
  doc.setFillColor(252, 252, 252);
20806
20832
  doc.roundedRect(20, yPos - 5, 170, 8, 1, 1, "F");
20807
20833
  }
20808
- const workspaceName = getWorkspaceDisplayName(ws.workspace_name);
20834
+ const workspaceName = getWorkspaceDisplayName(ws.workspace_name, lineInfo.line_id);
20809
20835
  const maxWidth = 55;
20810
20836
  const truncatedName = workspaceName.length > 25 ? workspaceName.substring(0, 22) + "..." : workspaceName;
20811
20837
  doc.text(truncatedName, 25, yPos);
@@ -21138,6 +21164,10 @@ var WorkspaceHistoryCalendar = ({
21138
21164
  const { dateTimeConfig } = useDashboardConfig();
21139
21165
  const configuredTimezone = dateTimeConfig?.defaultTimezone || "Asia/Kolkata";
21140
21166
  const [animationComplete, setAnimationComplete] = useState(false);
21167
+ const hasRealData = (shift) => {
21168
+ if (shift.hasData !== void 0) return shift.hasData;
21169
+ return shift.efficiency > 0 || shift.output > 0 || shift.cycleTime > 0 || shift.pph > 0 || shift.idealOutput > 0 || shift.idleTime > 0;
21170
+ };
21141
21171
  useEffect(() => {
21142
21172
  setAnimationComplete(false);
21143
21173
  const timer = setTimeout(() => {
@@ -21190,10 +21220,14 @@ var WorkspaceHistoryCalendar = ({
21190
21220
  istNow.setHours(0, 0, 0, 0);
21191
21221
  const compareDate = new Date(date);
21192
21222
  compareDate.setHours(0, 0, 0, 0);
21193
- if (date.getDay() === 0 || compareDate > istNow) {
21223
+ if (compareDate > istNow) {
21194
21224
  return [];
21195
21225
  }
21196
- return [day.dayShift, day.nightShift];
21226
+ const shiftData = selectedShift === "day" ? day.dayShift : day.nightShift;
21227
+ if (hasRealData(shiftData)) {
21228
+ return [shiftData];
21229
+ }
21230
+ return [];
21197
21231
  });
21198
21232
  if (validShifts.length === 0) return null;
21199
21233
  const badShiftsCount = validShifts.filter((shift) => shift.efficiency < 75).length;
@@ -21206,7 +21240,7 @@ var WorkspaceHistoryCalendar = ({
21206
21240
  badDaysCount: badShiftsCount,
21207
21241
  totalDays: validShifts.length
21208
21242
  };
21209
- }, [data, month, year, configuredTimezone]);
21243
+ }, [data, month, year, configuredTimezone, selectedShift]);
21210
21244
  const handleDayClick = useCallback((day, shift) => {
21211
21245
  if (!day || isFutureDate(day.date)) return;
21212
21246
  const year2 = day.date.getFullYear();
@@ -21245,13 +21279,13 @@ var WorkspaceHistoryCalendar = ({
21245
21279
  compareDate.setHours(0, 0, 0, 0);
21246
21280
  return compareDate > istNow;
21247
21281
  }, [configuredTimezone]);
21248
- const getPerformanceColor = useCallback((efficiency, date) => {
21282
+ const getPerformanceColor = useCallback((efficiency, date, hasData) => {
21249
21283
  const istNow = getTimeInZoneAsDate(configuredTimezone);
21250
21284
  istNow.setHours(0, 0, 0, 0);
21251
21285
  const compareDate = toZonedTime(date, configuredTimezone);
21252
21286
  compareDate.setHours(0, 0, 0, 0);
21253
- if (compareDate.getDay() === 0) return "bg-gray-300";
21254
21287
  if (compareDate > istNow) return "bg-gray-200";
21288
+ if (!hasData) return "bg-gray-300";
21255
21289
  if (efficiency >= 80) return "bg-[#00AB45]/90";
21256
21290
  if (efficiency >= 70) return "bg-[#FFB020]/90";
21257
21291
  return "bg-[#E34329]/90";
@@ -21260,7 +21294,7 @@ var WorkspaceHistoryCalendar = ({
21260
21294
  const istNow = getTimeInZoneAsDate(configuredTimezone);
21261
21295
  const compareDate = toZonedTime(date, configuredTimezone);
21262
21296
  compareDate.setHours(0, 0, 0, 0);
21263
- if (compareDate > istNow || compareDate.getDay() === 0) return null;
21297
+ if (compareDate > istNow || !hasRealData(shift)) return null;
21264
21298
  return /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-black/80 rounded-lg p-2 text-white opacity-0 group-hover:opacity-100 transition-all duration-200 ease-in-out", children: /* @__PURE__ */ jsxs("div", { className: "text-xs space-y-1", children: [
21265
21299
  /* @__PURE__ */ jsxs("div", { children: [
21266
21300
  "Efficiency: ",
@@ -21312,25 +21346,26 @@ var WorkspaceHistoryCalendar = ({
21312
21346
  return /* @__PURE__ */ jsx("div", { className: `h-full border border-gray-200 rounded-lg ${bgColor} ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} cursor-not-allowed opacity-60`, children: /* @__PURE__ */ jsx("div", { className: "p-2", children: /* @__PURE__ */ jsx("div", { className: `text-base font-medium ${textColor} ${isToday ? "text-blue-500" : ""}`, children: dayNumber }) }) });
21313
21347
  }
21314
21348
  const shiftData = selectedShift === "day" ? day.dayShift : day.nightShift;
21349
+ const hasData = hasRealData(shiftData);
21315
21350
  return /* @__PURE__ */ jsx(
21316
21351
  "div",
21317
21352
  {
21318
- className: `group h-full ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} ${!isFuture && animationComplete ? "cursor-pointer hover:opacity-90 hover:scale-105" : "cursor-not-allowed"}`,
21319
- onClick: () => !isFuture && handleDayClick(day, selectedShift),
21353
+ className: `group h-full ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} ${!isFuture && hasData && animationComplete ? "cursor-pointer hover:opacity-90 hover:scale-105" : "cursor-not-allowed"}`,
21354
+ onClick: () => !isFuture && hasData && handleDayClick(day, selectedShift),
21320
21355
  children: /* @__PURE__ */ jsxs("div", { className: `
21321
- ${getPerformanceColor(shiftData.efficiency, day.date)}
21356
+ ${getPerformanceColor(shiftData.efficiency, day.date, hasData)}
21322
21357
  rounded-lg h-full p-2 relative ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} shadow-sm
21323
21358
  ${isToday ? "ring-2 ring-blue-500 ring-offset-2 shadow-md" : ""}
21324
21359
  `, children: [
21325
21360
  /* @__PURE__ */ jsx("div", { className: `
21326
- text-base font-medium text-white flex items-center ${animationComplete ? "transition-all duration-300 ease-in-out" : ""}
21361
+ text-base font-medium ${hasData ? "text-white" : "text-gray-500"} flex items-center ${animationComplete ? "transition-all duration-300 ease-in-out" : ""}
21327
21362
  ${isToday ? "bg-blue-500 rounded-full w-7 h-7 justify-center" : ""}
21328
21363
  `, children: day.date.getDate() }),
21329
- !isFuture && animationComplete && renderStats(shiftData, day.date)
21364
+ !isFuture && hasData && animationComplete && renderStats(shiftData, day.date)
21330
21365
  ] })
21331
21366
  }
21332
21367
  );
21333
- }, [selectedShift, isCurrentDate, isFutureDate, getPerformanceColor, handleDayClick, year, month, configuredTimezone, animationComplete]);
21368
+ }, [selectedShift, isCurrentDate, isFutureDate, getPerformanceColor, handleDayClick, year, month, configuredTimezone, animationComplete, hasRealData]);
21334
21369
  return /* @__PURE__ */ jsxs("div", { className: `calendar-wrapper space-y-6 ${className || ""} ${animationComplete ? "animation-complete" : ""}`, children: [
21335
21370
  /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: styles } }),
21336
21371
  /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-1 border border-gray-200 rounded-lg p-1 bg-gray-50", children: [
@@ -21368,7 +21403,10 @@ var WorkspaceHistoryCalendar = ({
21368
21403
  ] }),
21369
21404
  /* @__PURE__ */ jsxs("div", { className: "calendar-container bg-white rounded-xl shadow-sm border border-gray-100 p-6 transition-all duration-200 ease-in-out", children: [
21370
21405
  /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
21371
- /* @__PURE__ */ jsx("h3", { className: "font-semibold text-gray-900 text-lg", children: "Monthly Summary" }),
21406
+ /* @__PURE__ */ jsxs("h3", { className: "font-semibold text-gray-900 text-lg", children: [
21407
+ "Monthly Summary - ",
21408
+ selectedShift === "day" ? "Day Shift" : "Night Shift"
21409
+ ] }),
21372
21410
  /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 mt-1", children: "Overview of monthly performance metrics" })
21373
21411
  ] }),
21374
21412
  monthlyMetrics ? /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4", children: [
@@ -21474,7 +21512,7 @@ var WorkspacePdfGenerator = ({ workspace, className }) => {
21474
21512
  doc.setFontSize(22);
21475
21513
  doc.setFont("helvetica", "normal");
21476
21514
  doc.setTextColor(40, 40, 40);
21477
- doc.text(getWorkspaceDisplayName(workspace.workspace_name), 20, 52);
21515
+ doc.text(getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id), 20, 52);
21478
21516
  doc.setFontSize(13);
21479
21517
  doc.setFont("helvetica", "normal");
21480
21518
  doc.setTextColor(60, 60, 60);
@@ -22104,10 +22142,7 @@ var LoadingOverlay = ({
22104
22142
  className: `fixed inset-0 z-[100] flex items-center justify-center bg-black/30 backdrop-blur-sm ${className || ""}`,
22105
22143
  "aria-modal": "true",
22106
22144
  role: "dialog",
22107
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center space-y-3 rounded-lg bg-white p-8 shadow-xl", children: [
22108
- /* @__PURE__ */ jsx(LoadingSpinner_default, { size: "md" }),
22109
- /* @__PURE__ */ jsx("p", { className: "text-base font-medium text-gray-700", children: message })
22110
- ] })
22145
+ children: /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center space-y-3 rounded-lg bg-white p-8 shadow-xl", children: /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "md", message }) })
22111
22146
  }
22112
22147
  );
22113
22148
  };
@@ -22932,20 +22967,6 @@ var S3ClipsService = class {
22932
22967
  return videos;
22933
22968
  }
22934
22969
  };
22935
- var LoadingSpinner2 = ({
22936
- size = "md",
22937
- message = "Loading..."
22938
- }) => {
22939
- const sizeClasses = {
22940
- sm: "w-4 h-4",
22941
- md: "w-6 h-6",
22942
- lg: "w-8 h-8"
22943
- };
22944
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center", children: [
22945
- /* @__PURE__ */ jsx("div", { className: `${sizeClasses[size]} border-2 border-t-blue-500 border-r-blue-500 border-b-gray-200 border-l-gray-200 rounded-full animate-spin mb-2` }),
22946
- message && /* @__PURE__ */ jsx("span", { className: "text-gray-600 text-sm", children: message })
22947
- ] });
22948
- };
22949
22970
  var BottlenecksContent = ({
22950
22971
  workspaceId,
22951
22972
  workspaceName,
@@ -23464,7 +23485,7 @@ var BottlenecksContent = ({
23464
23485
  ] });
23465
23486
  }
23466
23487
  if (isLoading && allVideos.length === 0) {
23467
- return /* @__PURE__ */ jsx("div", { className: "flex-grow p-4 flex items-center justify-center h-[calc(100vh-12rem)]", children: /* @__PURE__ */ jsx(LoadingSpinner2, { size: "lg", message: "Loading clips..." }) });
23488
+ return /* @__PURE__ */ jsx("div", { className: "flex-grow p-4 flex items-center justify-center h-[calc(100vh-12rem)]", children: /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "lg", message: "Loading clips..." }) });
23468
23489
  }
23469
23490
  if (error) {
23470
23491
  return /* @__PURE__ */ jsxs("div", { className: "flex-grow p-4 flex flex-col items-center justify-center h-[calc(100vh-12rem)] text-center", children: [
@@ -23642,7 +23663,7 @@ var BottlenecksContent = ({
23642
23663
  }
23643
23664
  )
23644
23665
  ] }),
23645
- isLoading && allVideos.length > 0 ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-[calc(100%-4rem)]", children: /* @__PURE__ */ jsx(LoadingSpinner2, { size: "md", message: "Loading clips..." }) }) : allVideos.length === 0 ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-[calc(100%-4rem)]", children: /* @__PURE__ */ jsxs("div", { className: "text-center p-8", children: [
23666
+ isLoading && allVideos.length > 0 ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-[calc(100%-4rem)]", children: /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading clips..." }) }) : allVideos.length === 0 ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-[calc(100%-4rem)]", children: /* @__PURE__ */ jsxs("div", { className: "text-center p-8", children: [
23646
23667
  /* @__PURE__ */ jsx("svg", { className: "w-16 h-16 text-gray-300 mx-auto mb-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" }) }),
23647
23668
  /* @__PURE__ */ jsx("h3", { className: "text-xl font-medium text-gray-700 mb-2", children: "No Clips Found" }),
23648
23669
  /* @__PURE__ */ jsx("p", { className: "text-gray-500", children: "There were no video clips found for this workspace today." })
@@ -23960,7 +23981,7 @@ var WorkspaceGridItem = React19__default.memo(({
23960
23981
  const handleClick = useCallback((e) => {
23961
23982
  e.preventDefault();
23962
23983
  if (isInactive) return;
23963
- const displayName = getWorkspaceDisplayName(data.workspace_name);
23984
+ const displayName = getWorkspaceDisplayName(data.workspace_name, data.line_id);
23964
23985
  const navParams = getWorkspaceNavigationParams(data.workspace_id, displayName);
23965
23986
  navigate(`/workspace/${data.workspace_id}${navParams}`, {
23966
23987
  trackingEvent: {
@@ -24008,7 +24029,7 @@ var WorkspaceGridItem = React19__default.memo(({
24008
24029
  onClick: handleClick,
24009
24030
  className: `${styles2} ${colorClass} ${isBottleneck ? "ring-2 ring-red-500/70" : ""} ${isVeryLowEfficiency ? "ring-2 ring-red-500/50" : ""} ${isInactive ? "bg-gray-200" : ""} shadow-lg`,
24010
24031
  "aria-label": isInactive ? `Inactive workspace ${workspaceNumber}` : `View details for workspace ${workspaceNumber}`,
24011
- title: isInactive ? `Inactive: ${getWorkspaceDisplayName(data.workspace_name)}` : getWorkspaceDisplayName(data.workspace_name),
24032
+ title: isInactive ? `Inactive: ${getWorkspaceDisplayName(data.workspace_name, data.line_id)}` : getWorkspaceDisplayName(data.workspace_name, data.line_id),
24012
24033
  children: /* @__PURE__ */ jsx("div", { className: `font-semibold tracking-wide text-[min(4vw,2rem)] uppercase ${isInactive ? "text-gray-400" : "text-white"} drop-shadow-sm`, children: workspaceNumber })
24013
24034
  }
24014
24035
  ),
@@ -25332,11 +25353,8 @@ var LoadingState = ({
25332
25353
  className = ""
25333
25354
  }) => {
25334
25355
  return /* @__PURE__ */ jsx("div", { className: `flex h-full w-full items-center justify-center bg-gray-50/50 ${className}`, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center space-y-4 text-center", children: [
25335
- /* @__PURE__ */ jsx(LoadingSpinner_default, { size }),
25336
- /* @__PURE__ */ jsxs("div", { children: [
25337
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-medium text-gray-900", children: message }),
25338
- subMessage && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-gray-600", children: subMessage })
25339
- ] })
25356
+ /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size, message }),
25357
+ subMessage && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-gray-600", children: subMessage })
25340
25358
  ] }) });
25341
25359
  };
25342
25360
  var LoadingSkeleton = ({
@@ -25363,10 +25381,7 @@ var LoadingSkeleton = ({
25363
25381
  /* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-1/3" }),
25364
25382
  /* @__PURE__ */ jsxs("div", { className: "relative", children: [
25365
25383
  /* @__PURE__ */ jsx(Skeleton, { className: "h-64 w-full" }),
25366
- showLoadingIndicator && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "bg-white/80 rounded-lg p-3 shadow-sm", children: /* @__PURE__ */ jsxs("svg", { className: "animate-spin h-6 w-6 text-blue-500", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
25367
- /* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
25368
- /* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
25369
- ] }) }) })
25384
+ showLoadingIndicator && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "bg-white/80 rounded-lg p-3 shadow-sm", children: /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "sm" }) }) })
25370
25385
  ] })
25371
25386
  ] });
25372
25387
  case "table":
@@ -25417,10 +25432,7 @@ var LoadingInline = ({
25417
25432
  size = "sm",
25418
25433
  className = ""
25419
25434
  }) => {
25420
- return /* @__PURE__ */ jsxs("div", { className: `inline-flex items-center space-x-2 ${className}`, children: [
25421
- /* @__PURE__ */ jsx(LoadingSpinner_default, { size }),
25422
- message && /* @__PURE__ */ jsx("span", { className: "text-sm text-gray-600", children: message })
25423
- ] });
25435
+ return /* @__PURE__ */ jsx("div", { className: `inline-flex items-center space-x-2 ${className}`, children: /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size, message }) });
25424
25436
  };
25425
25437
  var DEFAULT_HLS_CONFIG = {
25426
25438
  maxBufferLength: 15,
@@ -25649,7 +25661,7 @@ var ThreadSidebar = ({
25649
25661
  /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "Chat History" }),
25650
25662
  /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 mt-1", children: "Your previous conversations" })
25651
25663
  ] }),
25652
- /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto min-h-0", children: isLoading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center p-8", children: /* @__PURE__ */ jsx(LoadingSpinner_default, { size: "sm" }) }) : threads.length === 0 ? /* @__PURE__ */ jsx("div", { className: "p-4 text-center text-gray-500 text-sm", children: "No conversations yet" }) : /* @__PURE__ */ jsx("div", { className: "py-2", children: threads.map((thread) => /* @__PURE__ */ jsxs(
25664
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto min-h-0", children: isLoading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center p-8", children: /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "sm" }) }) : threads.length === 0 ? /* @__PURE__ */ jsx("div", { className: "p-4 text-center text-gray-500 text-sm", children: "No conversations yet" }) : /* @__PURE__ */ jsx("div", { className: "py-2", children: threads.map((thread) => /* @__PURE__ */ jsxs(
25653
25665
  "div",
25654
25666
  {
25655
25667
  onClick: () => onSelectThread(thread.id),
@@ -25660,7 +25672,7 @@ var ThreadSidebar = ({
25660
25672
  /* @__PURE__ */ jsx("h3", { className: `text-sm font-medium truncate ${activeThreadId === thread.id ? "text-blue-900" : "text-gray-900"}`, children: thread.title || "Untitled Chat" }),
25661
25673
  /* @__PURE__ */ jsx("p", { className: `text-xs mt-0.5 ${activeThreadId === thread.id ? "text-blue-700" : "text-gray-500"}`, children: formatDate(thread.created_at) })
25662
25674
  ] }),
25663
- deletingId === thread.id ? /* @__PURE__ */ jsx(LoadingSpinner_default, { size: "sm", className: "flex-shrink-0" }) : /* @__PURE__ */ jsx(
25675
+ deletingId === thread.id ? /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "sm", className: "flex-shrink-0" }) : /* @__PURE__ */ jsx(
25664
25676
  "button",
25665
25677
  {
25666
25678
  onClick: (e) => handleDelete(e, thread.id),
@@ -27421,7 +27433,13 @@ var AIAgentView = () => {
27421
27433
  {
27422
27434
  className: `relative px-5 py-4 rounded-2xl shadow-sm ${message.role === "user" ? "bg-blue-600 text-white max-w-[85%] ml-auto" : "bg-white border border-gray-200/80 max-w-full"}`,
27423
27435
  children: /* @__PURE__ */ jsxs("div", { className: `${message.role === "user" ? "text-white" : "text-gray-800"}`, children: [
27424
- message.role === "assistant" ? renderAssistantContent(message.content) : /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap leading-relaxed", children: message.content }),
27436
+ message.role === "assistant" ? message.id === -1 ? /* @__PURE__ */ jsx(
27437
+ "div",
27438
+ {
27439
+ className: "formatted-content",
27440
+ dangerouslySetInnerHTML: { __html: formatMessage(message.content) }
27441
+ }
27442
+ ) : renderAssistantContent(message.content) : /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap leading-relaxed", children: message.content }),
27425
27443
  message.id === -1 && /* @__PURE__ */ jsx("span", { className: "inline-block w-0.5 h-4 bg-gray-400 animate-pulse ml-0.5" })
27426
27444
  ] })
27427
27445
  }
@@ -27451,7 +27469,13 @@ var AIAgentView = () => {
27451
27469
  className: `relative px-5 py-4 rounded-2xl shadow-sm ${message.role === "user" ? "bg-blue-600 text-white max-w-[85%] ml-auto" : "bg-white border border-gray-200/80 max-w-full"}`,
27452
27470
  children: [
27453
27471
  /* @__PURE__ */ jsxs("div", { className: `${message.role === "user" ? "text-white" : "text-gray-800"}`, children: [
27454
- message.role === "assistant" ? renderAssistantContent(message.content) : /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap leading-relaxed", children: message.content }),
27472
+ message.role === "assistant" ? message.id === -1 ? /* @__PURE__ */ jsx(
27473
+ "div",
27474
+ {
27475
+ className: "formatted-content",
27476
+ dangerouslySetInnerHTML: { __html: formatMessage(message.content) }
27477
+ }
27478
+ ) : renderAssistantContent(message.content) : /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap leading-relaxed", children: message.content }),
27455
27479
  message.id === -1 && /* @__PURE__ */ jsx("span", { className: "inline-block w-0.5 h-4 bg-gray-400 animate-pulse ml-0.5" })
27456
27480
  ] }),
27457
27481
  message.role === "assistant" && message.id !== -1 && /* @__PURE__ */ jsx(
@@ -28473,7 +28497,7 @@ var HelpView = ({
28473
28497
  disabled: isSubmitting,
28474
28498
  className: "px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2 shadow-sm text-sm",
28475
28499
  children: isSubmitting ? /* @__PURE__ */ jsxs(Fragment, { children: [
28476
- /* @__PURE__ */ jsx(LoadingSpinner_default, { className: "h-4 w-4" }),
28500
+ /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "sm" }),
28477
28501
  "Submitting..."
28478
28502
  ] }) : "Submit Ticket"
28479
28503
  }
@@ -28658,7 +28682,7 @@ function HomeView({
28658
28682
  ) }) }),
28659
28683
  /* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-y-auto sm:overflow-hidden relative", children: [
28660
28684
  lineSelectorComponent && /* @__PURE__ */ jsx("div", { className: "absolute right-3 top-2 sm:right-6 sm:top-3 z-30", children: lineSelectorComponent }),
28661
- /* @__PURE__ */ jsx("div", { className: "h-full sm:h-full min-h-[calc(100vh-80px)] sm:min-h-0", children: isDataLoading && hasInitialDataLoaded && memoizedWorkspaceMetrics.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-3 sm:px-6 lg:px-8 py-4", children: /* @__PURE__ */ jsx(LoadingSkeleton, { type: "workspace-card", count: 8, className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4" }) }) : memoizedWorkspaceMetrics.length > 0 ? /* @__PURE__ */ jsx(
28685
+ /* @__PURE__ */ jsx("div", { className: "h-full sm:h-full min-h-[calc(100vh-80px)] sm:min-h-0", children: isDataLoading || !hasInitialDataLoaded ? /* @__PURE__ */ jsx("div", { className: "px-3 sm:px-6 lg:px-8 py-4", children: /* @__PURE__ */ jsx(LoadingSkeleton, { type: "workspace-card", count: 8, className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4" }) }) : memoizedWorkspaceMetrics.length > 0 ? /* @__PURE__ */ jsx(
28662
28686
  motion.div,
28663
28687
  {
28664
28688
  initial: { opacity: 0, scale: 0.98 },
@@ -28820,6 +28844,7 @@ var MetricCards = memo(({ lineInfo }) => {
28820
28844
  MetricCards.displayName = "MetricCards";
28821
28845
  var BottomSection = memo(({
28822
28846
  lineInfo,
28847
+ lineId,
28823
28848
  workspaceData,
28824
28849
  sortedByEfficiency,
28825
28850
  hourlyOutputData,
@@ -28877,7 +28902,7 @@ var BottomSection = memo(({
28877
28902
  return null;
28878
28903
  }
28879
28904
  const clickHandler = () => handleWorkspaceClick(ws, index);
28880
- const displayName = getWorkspaceDisplayName(ws.workspace_name);
28905
+ const displayName = getWorkspaceDisplayName(ws.workspace_name, lineId);
28881
28906
  const navParams = wsUuid ? getWorkspaceNavigationParams2(wsUuid, displayName) : "";
28882
28907
  const dateShiftParams = urlDate ? `&date=${urlDate}&shift=${urlShift || "0"}` : "";
28883
28908
  const returnToParam = `&returnTo=${encodeURIComponent(`/kpis/${lineInfo?.line_id}`)}`;
@@ -28911,7 +28936,7 @@ var BottomSection = memo(({
28911
28936
  // Fallback to sorted workspaces if no poorest performing workspaces provided
28912
28937
  sortedByEfficiency.map((ws, index) => {
28913
28938
  const clickHandler = () => handleWorkspaceClick(ws, index);
28914
- const displayName = getWorkspaceDisplayName(ws.workspace_name);
28939
+ const displayName = getWorkspaceDisplayName(ws.workspace_name, lineId);
28915
28940
  const navParams = ws.workspace_uuid ? getWorkspaceNavigationParams2(ws.workspace_uuid, displayName) : "";
28916
28941
  const dateShiftParams = urlDate ? `&date=${urlDate}&shift=${urlShift || "0"}` : "";
28917
28942
  const returnToParam = `&returnTo=${encodeURIComponent(`/kpis/${lineInfo?.line_id}`)}`;
@@ -29408,6 +29433,7 @@ var KPIDetailView = ({
29408
29433
  BottomSection,
29409
29434
  {
29410
29435
  lineInfo,
29436
+ lineId,
29411
29437
  workspaceData: workspaces || [],
29412
29438
  sortedByEfficiency,
29413
29439
  hourlyOutputData,
@@ -29510,6 +29536,7 @@ var KPIDetailView = ({
29510
29536
  BottomSection,
29511
29537
  {
29512
29538
  lineInfo,
29539
+ lineId,
29513
29540
  workspaceData: workspaces || [],
29514
29541
  sortedByEfficiency,
29515
29542
  hourlyOutputData,
@@ -29528,34 +29555,10 @@ var KPIDetailView = ({
29528
29555
  var KPIDetailView_default = KPIDetailView;
29529
29556
  var LineCard = ({ line, onClick }) => {
29530
29557
  const { kpis, isLoading, error } = useLineKPIs({ lineId: line.id });
29531
- const shiftConfig = useShiftConfig();
29532
- const dateTimeConfig = useDateTimeConfig();
29533
29558
  const isOnTrack = React19__default.useMemo(() => {
29534
29559
  if (!kpis) return null;
29535
- const currentTime = /* @__PURE__ */ new Date();
29536
- const timezone = dateTimeConfig.defaultTimezone || "Asia/Kolkata";
29537
- const currentShiftDetails = getCurrentShift(timezone, shiftConfig);
29538
- const shiftStartTime = currentShiftDetails.shiftId === 0 ? shiftConfig.dayShift?.startTime || "06:00" : shiftConfig.nightShift?.startTime || "18:00";
29539
- const shiftEndTime = currentShiftDetails.shiftId === 0 ? shiftConfig.dayShift?.endTime || "14:00" : shiftConfig.nightShift?.endTime || "02:00";
29540
- const [startHour, startMin] = shiftStartTime.split(":").map(Number);
29541
- const [endHour, endMin] = shiftEndTime.split(":").map(Number);
29542
- const shiftStart = /* @__PURE__ */ new Date();
29543
- shiftStart.setHours(startHour, startMin, 0, 0);
29544
- const shiftEnd = /* @__PURE__ */ new Date();
29545
- shiftEnd.setHours(endHour, endMin, 0, 0);
29546
- if (endHour < startHour) {
29547
- if (currentTime.getHours() < endHour) {
29548
- shiftStart.setDate(shiftStart.getDate() - 1);
29549
- } else {
29550
- shiftEnd.setDate(shiftEnd.getDate() + 1);
29551
- }
29552
- }
29553
- const totalShiftMinutes = (shiftEnd.getTime() - shiftStart.getTime()) / (1e3 * 60);
29554
- const elapsedMinutes = (currentTime.getTime() - shiftStart.getTime()) / (1e3 * 60);
29555
- const shiftProgress = Math.max(0, Math.min(1, elapsedMinutes / totalShiftMinutes));
29556
- const outputProgress = kpis.outputProgress.current / kpis.outputProgress.target;
29557
- return outputProgress >= shiftProgress - 0.05;
29558
- }, [kpis, shiftConfig, dateTimeConfig]);
29560
+ return kpis.efficiency.value > 90;
29561
+ }, [kpis]);
29559
29562
  return /* @__PURE__ */ jsxs(
29560
29563
  motion.div,
29561
29564
  {
@@ -29871,7 +29874,7 @@ var MobileWorkspaceCard = memo(({
29871
29874
  getMedalIcon(rank)
29872
29875
  ] }),
29873
29876
  /* @__PURE__ */ jsxs("div", { children: [
29874
- /* @__PURE__ */ jsx("div", { className: "font-semibold text-gray-900", children: getWorkspaceDisplayName(workspace.workspace_name) }),
29877
+ /* @__PURE__ */ jsx("div", { className: "font-semibold text-gray-900", children: getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id) }),
29875
29878
  /* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500", children: getLineName(workspace.line_id) })
29876
29879
  ] })
29877
29880
  ] }),
@@ -29921,7 +29924,7 @@ var DesktopWorkspaceRow = memo(({
29921
29924
  /* @__PURE__ */ jsx("span", { children: index + 1 }),
29922
29925
  getMedalIcon(index + 1)
29923
29926
  ] }) }),
29924
- /* @__PURE__ */ jsx("td", { className: "px-3 py-2.5 sm:p-4 text-sm sm:text-base whitespace-nowrap", children: /* @__PURE__ */ jsx("div", { className: "font-medium", children: getWorkspaceDisplayName(workspace.workspace_name) }) }),
29927
+ /* @__PURE__ */ jsx("td", { className: "px-3 py-2.5 sm:p-4 text-sm sm:text-base whitespace-nowrap", children: /* @__PURE__ */ jsx("div", { className: "font-medium", children: getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id) }) }),
29925
29928
  /* @__PURE__ */ jsx("td", { className: "px-3 py-2.5 sm:p-4 text-sm sm:text-base whitespace-nowrap", children: /* @__PURE__ */ jsx("div", { className: "font-medium", children: getLineName(workspace.line_id) }) }),
29926
29929
  /* @__PURE__ */ jsxs("td", { className: "px-3 py-2.5 sm:p-4 text-sm sm:text-base font-medium whitespace-nowrap", children: [
29927
29930
  (workspace.efficiency || 0).toFixed(1),
@@ -30038,7 +30041,7 @@ var LeaderboardDetailView = memo(({
30038
30041
  action_count: workspace.action_count,
30039
30042
  action_threshold: workspace.action_threshold
30040
30043
  });
30041
- const displayName = getWorkspaceDisplayName(workspace.workspace_name);
30044
+ const displayName = getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id);
30042
30045
  const navParams = workspace.workspace_uuid ? getWorkspaceNavigationParams(workspace.workspace_uuid, displayName) : "";
30043
30046
  const returnToParam = `&returnTo=${encodeURIComponent(`/leaderboard`)}`;
30044
30047
  if (onWorkspaceClick) {
@@ -30285,7 +30288,7 @@ var ProfileView = () => {
30285
30288
  }
30286
30289
  };
30287
30290
  if (authLoading || loading) {
30288
- return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsx(LoadingSpinner_default, { size: "lg" }) });
30291
+ return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "lg" }) });
30289
30292
  }
30290
30293
  if (!user) {
30291
30294
  return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
@@ -30442,7 +30445,7 @@ var ProfileView = () => {
30442
30445
  ] })
30443
30446
  ] }),
30444
30447
  isEditing && /* @__PURE__ */ jsx("div", { className: "mt-6 flex gap-3", children: /* @__PURE__ */ jsx(Button2, { variant: "outline", onClick: handleSaveProfile, disabled: loading, children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
30445
- /* @__PURE__ */ jsx(LoadingSpinner_default, { size: "sm", className: "mr-2" }),
30448
+ /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "sm", className: "mr-2" }),
30446
30449
  "Saving..."
30447
30450
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
30448
30451
  /* @__PURE__ */ jsx(Save, { className: "h-4 w-4 mr-2" }),
@@ -30506,7 +30509,7 @@ var ProfileView = () => {
30506
30509
  disabled: loading,
30507
30510
  className: "flex items-center gap-2 text-red-600 hover:text-red-700 border-red-200 hover:border-red-300",
30508
30511
  children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
30509
- /* @__PURE__ */ jsx(LoadingSpinner_default, { size: "sm", className: "mr-2" }),
30512
+ /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "sm", className: "mr-2" }),
30510
30513
  "Signing out..."
30511
30514
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
30512
30515
  /* @__PURE__ */ jsx(LogOut, { className: "h-4 w-4" }),
@@ -31266,8 +31269,8 @@ var calculateDayOutput = (pph, shiftHours, breaks = []) => {
31266
31269
  const realWorkHours = shiftHours - totalBreakHours;
31267
31270
  return Math.round(pph * realWorkHours);
31268
31271
  };
31269
- var formatWorkspaceName = (name) => {
31270
- return getWorkspaceDisplayName(name);
31272
+ var formatWorkspaceName = (name, lineId) => {
31273
+ return getWorkspaceDisplayName(name, lineId);
31271
31274
  };
31272
31275
  var getStoredLineState2 = (lineId) => {
31273
31276
  try {
@@ -31295,6 +31298,7 @@ var BulkConfigureModal = ({
31295
31298
  isOpen,
31296
31299
  onClose,
31297
31300
  lineWorkspaces,
31301
+ lineNames,
31298
31302
  onSave,
31299
31303
  selectedShift
31300
31304
  }) => {
@@ -31445,10 +31449,7 @@ var BulkConfigureModal = ({
31445
31449
  className: "block w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm\n shadow-sm focus:border-blue-500 focus:ring-blue-500 \n transition-all duration-200 hover:border-blue-400\n appearance-none bg-no-repeat bg-right pr-10\n hover:bg-blue-50/50",
31446
31450
  children: [
31447
31451
  /* @__PURE__ */ jsx("option", { value: "", children: "Select a line" }),
31448
- Object.entries(lineWorkspaces).map(([lineId, line]) => /* @__PURE__ */ jsxs("option", { value: lineId, className: "py-2", children: [
31449
- lineId,
31450
- " "
31451
- ] }, lineId))
31452
+ Object.entries(lineWorkspaces).map(([lineId, line]) => /* @__PURE__ */ jsx("option", { value: lineId, className: "py-2", children: lineNames[lineId] || lineId }, lineId))
31452
31453
  ]
31453
31454
  }
31454
31455
  )
@@ -31506,7 +31507,7 @@ var BulkConfigureModal = ({
31506
31507
  className: "rounded border-gray-300 text-blue-600 focus:ring-blue-500"
31507
31508
  }
31508
31509
  ),
31509
- /* @__PURE__ */ jsx("span", { className: `text-sm ${selectedWorkspaces.includes(workspace.id) ? "text-blue-900 font-medium" : "text-gray-900"}`, children: formatWorkspaceName(workspace.name) })
31510
+ /* @__PURE__ */ jsx("span", { className: `text-sm ${selectedWorkspaces.includes(workspace.id) ? "text-blue-900 font-medium" : "text-gray-900"}`, children: formatWorkspaceName(workspace.name, selectedLine) })
31510
31511
  ]
31511
31512
  },
31512
31513
  workspace.id
@@ -31953,7 +31954,7 @@ var SKUList = ({
31953
31954
  }) => {
31954
31955
  if (isLoading) {
31955
31956
  return /* @__PURE__ */ jsx("div", { className: "bg-white rounded-xl shadow-sm border border-gray-200 p-8", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-center items-center", children: [
31956
- /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600" }),
31957
+ /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "md" }),
31957
31958
  /* @__PURE__ */ jsx("span", { className: "ml-3 text-gray-600", children: "Loading SKUs..." })
31958
31959
  ] }) });
31959
31960
  }
@@ -32039,7 +32040,7 @@ var TargetsViewUI = ({
32039
32040
  skuRequired = false
32040
32041
  }) => {
32041
32042
  if (isLoading) {
32042
- return /* @__PURE__ */ jsx("div", { className: "flex h-screen bg-gray-50", children: /* @__PURE__ */ jsx("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ jsx(Loader2, { className: "w-8 h-8 animate-spin text-blue-600" }) }) });
32043
+ return /* @__PURE__ */ jsx("div", { className: "flex h-screen bg-gray-50", children: /* @__PURE__ */ jsx("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "lg", message: "Loading targets..." }) }) });
32043
32044
  }
32044
32045
  return /* @__PURE__ */ jsxs("main", { className: "min-h-screen flex-1 bg-gray-50", children: [
32045
32046
  /* @__PURE__ */ jsx("div", { className: "bg-white px-8 py-6 shadow-sm border-b border-gray-200/80", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between relative", children: [
@@ -32141,7 +32142,7 @@ var TargetsViewUI = ({
32141
32142
  className: `ml-6 inline-flex items-center px-4 py-2 text-sm font-medium rounded-lg transition-all duration-200
32142
32143
  ${savingLines[lineId] ? "bg-gray-100 text-gray-400 cursor-not-allowed" : "bg-blue-600 text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"}`,
32143
32144
  children: savingLines[lineId] ? /* @__PURE__ */ jsxs(Fragment, { children: [
32144
- /* @__PURE__ */ jsx(Loader2, { className: "w-4 h-4 mr-2 animate-spin" }),
32145
+ /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "sm", className: "mr-2" }),
32145
32146
  "Saving..."
32146
32147
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
32147
32148
  /* @__PURE__ */ jsx(Save, { className: "w-4 h-4 mr-2" }),
@@ -32193,7 +32194,7 @@ var TargetsViewUI = ({
32193
32194
  {
32194
32195
  className: "px-6 py-4 hover:bg-gray-50 transition-all duration-200",
32195
32196
  children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-6 items-center", children: [
32196
- /* @__PURE__ */ jsx("div", { className: "col-span-2", children: /* @__PURE__ */ jsx("span", { className: "font-medium text-gray-900", children: formatWorkspaceName(workspace.name) }) }),
32197
+ /* @__PURE__ */ jsx("div", { className: "col-span-2", children: /* @__PURE__ */ jsx("span", { className: "font-medium text-gray-900", children: formatWorkspaceName(workspace.name, lineId) }) }),
32197
32198
  /* @__PURE__ */ jsx("div", { className: "col-span-2", children: /* @__PURE__ */ jsxs(
32198
32199
  "select",
32199
32200
  {
@@ -32203,7 +32204,7 @@ var TargetsViewUI = ({
32203
32204
  onActionTypeChange(lineId, workspace.id, newActionType);
32204
32205
  },
32205
32206
  className: "w-full p-2 border border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm",
32206
- "aria-label": `Action type for ${formatWorkspaceName(workspace.name)}`,
32207
+ "aria-label": `Action type for ${formatWorkspaceName(workspace.name, lineId)}`,
32207
32208
  children: [
32208
32209
  /* @__PURE__ */ jsx("option", { value: "assembly", className: "py-2", children: "Assembly" }),
32209
32210
  /* @__PURE__ */ jsx("option", { value: "packaging", className: "py-2", children: "Packaging" })
@@ -32262,6 +32263,7 @@ var TargetsViewUI = ({
32262
32263
  isOpen: isBulkConfigureOpen,
32263
32264
  onClose: onToggleBulkConfigure,
32264
32265
  lineWorkspaces,
32266
+ lineNames,
32265
32267
  onSave: onBulkConfigure,
32266
32268
  selectedShift
32267
32269
  }
@@ -33279,13 +33281,7 @@ var WorkspaceDetailView = ({
33279
33281
  ] }) }, i)) }),
33280
33282
  /* @__PURE__ */ jsx("div", { className: "bg-white rounded-lg p-6 shadow-sm", children: /* @__PURE__ */ jsxs("div", { className: "animate-pulse", children: [
33281
33283
  /* @__PURE__ */ jsx("div", { className: "h-6 w-40 bg-gray-200 rounded mb-4" }),
33282
- /* @__PURE__ */ jsx("div", { className: "h-64 bg-gray-100 rounded relative overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "bg-white/80 rounded-lg p-4 shadow-sm", children: [
33283
- /* @__PURE__ */ jsxs("svg", { className: "animate-spin h-8 w-8 text-blue-500", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
33284
- /* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
33285
- /* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
33286
- ] }),
33287
- /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600 mt-2", children: "Loading chart data..." })
33288
- ] }) }) })
33284
+ /* @__PURE__ */ jsx("div", { className: "h-64 bg-gray-100 rounded relative overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "bg-white/80 rounded-lg p-4 shadow-sm", children: /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading chart data..." }) }) }) })
33289
33285
  ] }) })
33290
33286
  ] })
33291
33287
  ] })
@@ -34106,4 +34102,4 @@ var S3Service = class {
34106
34102
  }
34107
34103
  };
34108
34104
 
34109
- export { ACTION_NAMES, AIAgentView_default as AIAgentView, AuthCallback, AuthCallbackView_default as AuthCallbackView, AuthProvider, AuthenticatedFactoryView, AuthenticatedHelpView, AuthenticatedHomeView, AuthenticatedTargetsView, BarChart, BaseHistoryCalendar, BottlenecksContent, BreakNotificationPopup, Card2 as Card, CardContent2 as CardContent, CardDescription2 as CardDescription, CardFooter2 as CardFooter, CardHeader2 as CardHeader, CardTitle2 as CardTitle, CycleTimeChart, CycleTimeOverTimeChart, DEFAULT_ANALYTICS_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_DATE_TIME_CONFIG, DEFAULT_ENDPOINTS_CONFIG, DEFAULT_ENTITY_CONFIG, DEFAULT_SHIFT_CONFIG, DEFAULT_THEME_CONFIG, DEFAULT_VIDEO_CONFIG, DEFAULT_WORKSPACE_CONFIG, DEFAULT_WORKSPACE_POSITIONS, DashboardHeader, DashboardLayout, DashboardOverridesProvider, DashboardProvider, DateDisplay_default as DateDisplay, DateTimeDisplay, DebugAuth, DebugAuthView_default as DebugAuthView, EmptyStateMessage, FactoryView_default as FactoryView, GaugeChart, GridComponentsPlaceholder, Header, HelpView_default as HelpView, HomeView_default as HomeView, HourlyOutputChart2 as HourlyOutputChart, ISTTimer_default as ISTTimer, KPICard, KPIDetailView_default as KPIDetailView, KPIGrid, KPIHeader, KPISection, KPIsOverviewView_default as KPIsOverviewView, LINE_1_UUID, LINE_2_UUID, LargeOutputProgressChart, LeaderboardDetailView_default as LeaderboardDetailView, Legend6 as Legend, LineChart, LineHistoryCalendar, LineMonthlyHistory, LineMonthlyPdfGenerator, LinePdfExportButton, LinePdfGenerator, LineWhatsAppShareButton, LiveTimer, LoadingInline, LoadingOverlay_default as LoadingOverlay, LoadingPage_default as LoadingPage, LoadingSkeleton, LoadingSpinner_default as LoadingSpinner, LoadingState, LoginPage, LoginView_default as LoginView, MainLayout, MetricCard_default as MetricCard, NoWorkspaceData, OptifyeAgentClient, OutputProgressChart, PageHeader, PieChart4 as PieChart, ProfileView_default as ProfileView, RegistryProvider, S3Service, SKUManagementView, SOPComplianceChart, SSEChatClient, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, ShiftDisplay_default as ShiftDisplay, ShiftsView_default as ShiftsView, SideNavBar, SingleVideoStream_default as SingleVideoStream, Skeleton, SlackAPI, SubscriptionManager, SubscriptionManagerProvider, SupabaseProvider, TargetWorkspaceGrid, TargetsView_default as TargetsView, ThreadSidebar, TimeDisplay_default as TimeDisplay, TimePickerDropdown, VideoCard, VideoGridView, VideoPreloader, WORKSPACE_POSITIONS, WhatsAppShareButton, WorkspaceCard, WorkspaceDetailView_default as WorkspaceDetailView, WorkspaceDisplayNameExample, WorkspaceGrid, WorkspaceGridItem, WorkspaceHistoryCalendar, WorkspaceMetricCards, WorkspaceMonthlyDataFetcher, WorkspaceMonthlyPdfGenerator, WorkspacePdfExportButton, WorkspacePdfGenerator, WorkspaceWhatsAppShareButton, actionService, apiUtils, authCoreService, authOTPService, authRateLimitService, cacheService, checkRateLimit2 as checkRateLimit, clearAllRateLimits2 as clearAllRateLimits, clearRateLimit2 as clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearWorkspaceDisplayNamesCache, cn, createStreamProxyHandler, createSupabaseClient, createThrottledReload, dashboardService, deleteThread, forceRefreshWorkspaceDisplayNames, formatDateInZone, formatDateTimeInZone, formatISTDate, formatIdleTime, formatTimeInZone, fromUrlFriendlyName, getAllLineDisplayNames, getAllThreadMessages, getAllWorkspaceDisplayNamesAsync, getAnonClient, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getConfiguredLineIds, getCoreSessionRecordingProperties, getCoreSessionReplayUrl, getCurrentShift, getCurrentTimeInZone, getDashboardHeaderTimeInZone, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultLineId, getDefaultTabForWorkspace, getLineDisplayName, getManufacturingInsights, getMetricsTablePrefix, getOperationalDate, getS3SignedUrl, getS3VideoSrc, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getSubscriptionManager, getThreadMessages, getUserThreads, getUserThreadsPaginated, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceNavigationParams, identifyCoreUser, initializeCoreMixpanel, isLegacyConfiguration, isTransitionPeriod, isValidFactoryViewConfiguration, isValidLineInfoPayload, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, mergeWithDefaultConfig, migrateLegacyConfiguration, optifyeAgentClient, preInitializeWorkspaceDisplayNames, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, resetSubscriptionManager, s3VideoPreloader, skuService, startCoreSessionRecording, stopCoreSessionRecording, storeWorkspaceMapping, streamProxyConfig, throttledReloadDashboard, toUrlFriendlyName, trackCoreEvent, trackCorePageView, updateThreadTitle, useActiveBreaks, useAllWorkspaceMetrics, useAnalyticsConfig, useAuth, useAuthConfig, useComponentOverride, useCustomConfig, useDashboardConfig, useDashboardMetrics, useDatabaseConfig, useDateFormatter, useDateTimeConfig, useEndpointsConfig, useEntityConfig, useFactoryOverviewMetrics, useFeatureFlags, useFormatNumber, useHistoricWorkspaceMetrics, useHlsStream, useHlsStreamWithCropping, useHookOverride, useLeaderboardMetrics, useLineDetailedMetrics, useLineKPIs, useLineMetrics, useLineWorkspaceMetrics, useMessages, useMetrics, useNavigation, useOverrides, usePageOverride, useRealtimeLineMetrics, useRegistry, useSKUs, useShiftConfig, useShifts, useSubscriptionManager, useSubscriptionManagerSafe, useSupabase, useSupabaseClient, useTargets, useTheme, useThemeConfig, useThreads, useVideoConfig, useWorkspaceConfig, useWorkspaceDetailedMetrics, useWorkspaceDisplayName, useWorkspaceDisplayNames, useWorkspaceDisplayNamesMap, useWorkspaceMetrics, useWorkspaceNavigation, useWorkspaceOperators, videoPreloader, whatsappService, withAuth, withRegistry, workspaceService };
34105
+ export { ACTION_NAMES, AIAgentView_default as AIAgentView, AuthCallback, AuthCallbackView_default as AuthCallbackView, AuthProvider, AuthenticatedFactoryView, AuthenticatedHelpView, AuthenticatedHomeView, AuthenticatedTargetsView, BarChart, BaseHistoryCalendar, BottlenecksContent, BreakNotificationPopup, Card2 as Card, CardContent2 as CardContent, CardDescription2 as CardDescription, CardFooter2 as CardFooter, CardHeader2 as CardHeader, CardTitle2 as CardTitle, CycleTimeChart, CycleTimeOverTimeChart, DEFAULT_ANALYTICS_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_DATE_TIME_CONFIG, DEFAULT_ENDPOINTS_CONFIG, DEFAULT_ENTITY_CONFIG, DEFAULT_SHIFT_CONFIG, DEFAULT_THEME_CONFIG, DEFAULT_VIDEO_CONFIG, DEFAULT_WORKSPACE_CONFIG, DEFAULT_WORKSPACE_POSITIONS, DashboardHeader, DashboardLayout, DashboardOverridesProvider, DashboardProvider, DateDisplay_default as DateDisplay, DateTimeDisplay, DebugAuth, DebugAuthView_default as DebugAuthView, EmptyStateMessage, FactoryView_default as FactoryView, GaugeChart, GridComponentsPlaceholder, Header, HelpView_default as HelpView, HomeView_default as HomeView, HourlyOutputChart2 as HourlyOutputChart, ISTTimer_default as ISTTimer, KPICard, KPIDetailView_default as KPIDetailView, KPIGrid, KPIHeader, KPISection, KPIsOverviewView_default as KPIsOverviewView, LINE_1_UUID, LINE_2_UUID, LargeOutputProgressChart, LeaderboardDetailView_default as LeaderboardDetailView, Legend6 as Legend, LineChart, LineHistoryCalendar, LineMonthlyHistory, LineMonthlyPdfGenerator, LinePdfExportButton, LinePdfGenerator, LineWhatsAppShareButton, LiveTimer, LoadingInline, LoadingOverlay_default as LoadingOverlay, LoadingPage_default as LoadingPage, LoadingSkeleton, LoadingState, LoginPage, LoginView_default as LoginView, MainLayout, MetricCard_default as MetricCard, NoWorkspaceData, OptifyeAgentClient, OptifyeLogoLoader_default as OptifyeLogoLoader, OutputProgressChart, PageHeader, PieChart4 as PieChart, ProfileView_default as ProfileView, RegistryProvider, S3Service, SKUManagementView, SOPComplianceChart, SSEChatClient, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, ShiftDisplay_default as ShiftDisplay, ShiftsView_default as ShiftsView, SideNavBar, SingleVideoStream_default as SingleVideoStream, Skeleton, SlackAPI, SubscriptionManager, SubscriptionManagerProvider, SupabaseProvider, TargetWorkspaceGrid, TargetsView_default as TargetsView, ThreadSidebar, TimeDisplay_default as TimeDisplay, TimePickerDropdown, VideoCard, VideoGridView, VideoPreloader, WORKSPACE_POSITIONS, WhatsAppShareButton, WorkspaceCard, WorkspaceDetailView_default as WorkspaceDetailView, WorkspaceDisplayNameExample, WorkspaceGrid, WorkspaceGridItem, WorkspaceHistoryCalendar, WorkspaceMetricCards, WorkspaceMonthlyDataFetcher, WorkspaceMonthlyPdfGenerator, WorkspacePdfExportButton, WorkspacePdfGenerator, WorkspaceWhatsAppShareButton, actionService, apiUtils, authCoreService, authOTPService, authRateLimitService, cacheService, checkRateLimit2 as checkRateLimit, clearAllRateLimits2 as clearAllRateLimits, clearRateLimit2 as clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearWorkspaceDisplayNamesCache, cn, createStreamProxyHandler, createSupabaseClient, createThrottledReload, dashboardService, deleteThread, forceRefreshWorkspaceDisplayNames, formatDateInZone, formatDateTimeInZone, formatISTDate, formatIdleTime, formatTimeInZone, fromUrlFriendlyName, getAllLineDisplayNames, getAllThreadMessages, getAllWorkspaceDisplayNamesAsync, getAnonClient, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getConfiguredLineIds, getCoreSessionRecordingProperties, getCoreSessionReplayUrl, getCurrentShift, getCurrentTimeInZone, getDashboardHeaderTimeInZone, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultLineId, getDefaultTabForWorkspace, getLineDisplayName, getManufacturingInsights, getMetricsTablePrefix, getOperationalDate, getS3SignedUrl, getS3VideoSrc, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getSubscriptionManager, getThreadMessages, getUserThreads, getUserThreadsPaginated, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceNavigationParams, identifyCoreUser, initializeCoreMixpanel, isLegacyConfiguration, isTransitionPeriod, isValidFactoryViewConfiguration, isValidLineInfoPayload, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, mergeWithDefaultConfig, migrateLegacyConfiguration, optifyeAgentClient, preInitializeWorkspaceDisplayNames, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, resetSubscriptionManager, s3VideoPreloader, skuService, startCoreSessionRecording, stopCoreSessionRecording, storeWorkspaceMapping, streamProxyConfig, throttledReloadDashboard, toUrlFriendlyName, trackCoreEvent, trackCorePageView, updateThreadTitle, useActiveBreaks, useAllWorkspaceMetrics, useAnalyticsConfig, useAuth, useAuthConfig, useComponentOverride, useCustomConfig, useDashboardConfig, useDashboardMetrics, useDatabaseConfig, useDateFormatter, useDateTimeConfig, useEndpointsConfig, useEntityConfig, useFactoryOverviewMetrics, useFeatureFlags, useFormatNumber, useHistoricWorkspaceMetrics, useHlsStream, useHlsStreamWithCropping, useHookOverride, useLeaderboardMetrics, useLineDetailedMetrics, useLineKPIs, useLineMetrics, useLineWorkspaceMetrics, useMessages, useMetrics, useNavigation, useOverrides, usePageOverride, useRealtimeLineMetrics, useRegistry, useSKUs, useShiftConfig, useShifts, useSubscriptionManager, useSubscriptionManagerSafe, useSupabase, useSupabaseClient, useTargets, useTheme, useThemeConfig, useThreads, useVideoConfig, useWorkspaceConfig, useWorkspaceDetailedMetrics, useWorkspaceDisplayName, useWorkspaceDisplayNames, useWorkspaceDisplayNamesMap, useWorkspaceMetrics, useWorkspaceNavigation, useWorkspaceOperators, videoPreloader, whatsappService, withAuth, withRegistry, workspaceService };