@optifye/dashboard-core 6.12.39 → 6.12.41

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
@@ -1,7 +1,7 @@
1
1
  import { format, addDays, subMonths, endOfMonth, startOfMonth, endOfDay, eachDayOfInterval, getDay, isSameDay, isWithinInterval, startOfDay, parseISO, subDays, differenceInMinutes, addMinutes, addMonths, isValid, formatDistanceToNow, isToday, isFuture, isBefore } from 'date-fns';
2
2
  import { formatInTimeZone, fromZonedTime, toZonedTime } from 'date-fns-tz';
3
- import * as React146 from 'react';
4
- import React146__default, { createContext, useRef, useId, useCallback, useState, useMemo, useEffect, forwardRef, useImperativeHandle, useLayoutEffect, memo as memo$1, useContext, useSyncExternalStore, Children, isValidElement, useInsertionEffect, startTransition, Fragment as Fragment$1, createElement, Component } from 'react';
3
+ import * as React147 from 'react';
4
+ import React147__default, { createContext, useRef, useId, useCallback, useState, useMemo, useEffect, forwardRef, useImperativeHandle, useLayoutEffect, memo as memo$1, useContext, useSyncExternalStore, Children, isValidElement, useInsertionEffect, startTransition, Fragment as Fragment$1, createElement, Component } from 'react';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
6
  import { useRouter } from 'next/router';
7
7
  import { toast } from 'sonner';
@@ -10,13 +10,13 @@ import { EventEmitter } from 'events';
10
10
  import { createClient, REALTIME_SUBSCRIBE_STATES } from '@supabase/supabase-js';
11
11
  import Hls, { Events, ErrorTypes } from 'hls.js';
12
12
  import useSWR from 'swr';
13
- import { Camera, AlertTriangle, ChevronDown, ChevronUp, Check, ShieldCheck, Star, Award, RefreshCw, Filter, X, Coffee, Plus, ArrowUp, ArrowDown, ArrowRight, HelpCircle, ClipboardX, Activity, Wrench, UserX, Clock, Package, CheckCircle2, ArrowLeft, Calendar, Save, AlertCircle, Loader2, Minus, ChevronLeft, ChevronRight, TrendingUp, Sparkles, Pause, Play, XCircle, Palette, LockKeyhole, TrendingDown, FolderOpen, Folder, ArrowDownWideNarrow, Tag, Sliders, Layers, Search, Edit2, CheckCircle, User, Users, Shield, Building2, Mail, Lock, Info, Share2, Trophy, Target, Download, Video, Copy, Sun, Moon, MousePointer, UserPlus, UserCog, Trash2, Eye, MoreVertical, BarChart3, Pencil, UserCheck, LogOut, Film, MessageSquare, Menu, Send, Settings, LifeBuoy, EyeOff, Zap, Flame, Crown, Medal } from 'lucide-react';
13
+ import { Camera, AlertTriangle, ChevronDown, ChevronUp, Check, ShieldCheck, Star, Award, RefreshCw, Filter, X, Coffee, Plus, ArrowUp, ArrowDown, ArrowRight, HelpCircle, ClipboardX, Activity, Wrench, UserX, Clock, Package, CheckCircle2, ArrowLeft, Calendar, Save, AlertCircle, Loader2, Minus, ChevronLeft, ChevronRight, TrendingUp, Sparkles, Pause, Play, XCircle, Palette, LockKeyhole, TrendingDown, FolderOpen, Folder, ArrowDownWideNarrow, Tag, Sliders, Layers, Search, Edit2, CheckCircle, User, Users, Shield, Building2, Mail, Lock, Info, Share2, Trophy, Target, Download, Video, Copy, Sun, Moon, MousePointer, UserPlus, UserCog, Trash2, Eye, MoreVertical, BarChart3, Pencil, UserCheck, LogOut, Film, MessageSquare, Menu, Send, Settings, LifeBuoy, EyeOff, Zap, ExternalLink, Flame, Crown, Medal } from 'lucide-react';
14
14
  import { memo, noop, warning, invariant, progress, secondsToMilliseconds, millisecondsToSeconds } from 'motion-utils';
15
15
  import { BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, ReferenceLine, Tooltip, Legend, Bar, LabelList, ResponsiveContainer, LineChart as LineChart$1, Line, Customized, Cell, PieChart, Pie, ComposedChart, Area, ScatterChart, Scatter } from 'recharts';
16
16
  import { Slot } from '@radix-ui/react-slot';
17
+ import { AdjustmentsHorizontalIcon, ClipboardDocumentCheckIcon, ClockIcon, UsersIcon, UserCircleIcon, TicketIcon, CurrencyDollarIcon, QuestionMarkCircleIcon, XMarkIcon, ArrowRightIcon, SparklesIcon, PlayCircleIcon, Bars3Icon, HomeIcon, VideoCameraIcon, TrophyIcon, ChartBarIcon, LightBulbIcon, CubeIcon, HeartIcon, Cog6ToothIcon, ChevronRightIcon, ArrowRightStartOnRectangleIcon, ExclamationCircleIcon, ExclamationTriangleIcon, CalendarIcon, ChevronDownIcon, ChevronLeftIcon, EnvelopeIcon, DocumentTextIcon, ChevronUpIcon, ArrowDownTrayIcon, CheckCircleIcon, ChatBubbleLeftRightIcon, XCircleIcon, FunnelIcon, EyeIcon, InformationCircleIcon, ArrowLeftIcon } from '@heroicons/react/24/outline';
17
18
  import * as SelectPrimitive from '@radix-ui/react-select';
18
19
  import { DayPicker, useNavigation as useNavigation$1 } from 'react-day-picker';
19
- import { AdjustmentsHorizontalIcon, ClipboardDocumentCheckIcon, ClockIcon, UsersIcon, UserCircleIcon, TicketIcon, CurrencyDollarIcon, QuestionMarkCircleIcon, XMarkIcon, ArrowRightIcon, Bars3Icon, HomeIcon, VideoCameraIcon, TrophyIcon, ChartBarIcon, LightBulbIcon, CubeIcon, HeartIcon, Cog6ToothIcon, ChevronRightIcon, ArrowRightStartOnRectangleIcon, ExclamationCircleIcon, ExclamationTriangleIcon, CalendarIcon, ChevronDownIcon, ChevronLeftIcon, EnvelopeIcon, DocumentTextIcon, ChevronUpIcon, ArrowDownTrayIcon, CheckCircleIcon, ChatBubbleLeftRightIcon, XCircleIcon, FunnelIcon, EyeIcon, InformationCircleIcon, ArrowLeftIcon, PlayCircleIcon } from '@heroicons/react/24/outline';
20
20
  import { CheckIcon } from '@heroicons/react/24/solid';
21
21
  import html2canvas from 'html2canvas';
22
22
  import jsPDF, { jsPDF as jsPDF$1 } from 'jspdf';
@@ -2091,14 +2091,14 @@ var useIdleTimeVlmConfig = () => {
2091
2091
  }
2092
2092
  return context;
2093
2093
  };
2094
- var DashboardConfigContext = React146.createContext(void 0);
2094
+ var DashboardConfigContext = React147.createContext(void 0);
2095
2095
  var DashboardProvider = ({ config: userProvidedConfig, children }) => {
2096
- const fullConfig = React146.useMemo(() => mergeWithDefaultConfig(userProvidedConfig), [userProvidedConfig]);
2096
+ const fullConfig = React147.useMemo(() => mergeWithDefaultConfig(userProvidedConfig), [userProvidedConfig]);
2097
2097
  _setDashboardConfigInstance(fullConfig);
2098
- React146.useEffect(() => {
2098
+ React147.useEffect(() => {
2099
2099
  _setDashboardConfigInstance(fullConfig);
2100
2100
  }, [fullConfig]);
2101
- React146.useEffect(() => {
2101
+ React147.useEffect(() => {
2102
2102
  if (!fullConfig.theme) return;
2103
2103
  const styleId = "dashboard-core-theme-vars";
2104
2104
  let styleEl = document.getElementById(styleId);
@@ -2124,7 +2124,7 @@ var DashboardProvider = ({ config: userProvidedConfig, children }) => {
2124
2124
  return /* @__PURE__ */ jsx(DashboardConfigContext.Provider, { value: fullConfig, children: /* @__PURE__ */ jsx(IdleTimeVlmConfigProvider, { children }) });
2125
2125
  };
2126
2126
  var useDashboardConfig = () => {
2127
- const ctx = React146.useContext(DashboardConfigContext);
2127
+ const ctx = React147.useContext(DashboardConfigContext);
2128
2128
  if (!ctx) throw new Error("useDashboardConfig must be used within a DashboardProvider");
2129
2129
  return ctx;
2130
2130
  };
@@ -12827,7 +12827,7 @@ var useMobileMenu = () => {
12827
12827
  };
12828
12828
  var useHideMobileHeader = (shouldHide = true) => {
12829
12829
  const context = useMobileMenu();
12830
- React146__default.useEffect(() => {
12830
+ React147__default.useEffect(() => {
12831
12831
  if (context && shouldHide) {
12832
12832
  context.setHideMobileHeader(true);
12833
12833
  return () => {
@@ -18812,7 +18812,7 @@ var useActiveBreaks = (lineIds) => {
18812
18812
  const [isLoading, setIsLoading] = useState(true);
18813
18813
  const [error, setError] = useState(null);
18814
18814
  const supabase = useSupabase();
18815
- const parseTimeToMinutes5 = (timeStr) => {
18815
+ const parseTimeToMinutes6 = (timeStr) => {
18816
18816
  const [hours, minutes] = timeStr.split(":").map(Number);
18817
18817
  return hours * 60 + minutes;
18818
18818
  };
@@ -18821,8 +18821,8 @@ var useActiveBreaks = (lineIds) => {
18821
18821
  return now4.getHours() * 60 + now4.getMinutes();
18822
18822
  };
18823
18823
  const isTimeInBreak = (breakStart, breakEnd, currentMinutes) => {
18824
- const startMinutes = parseTimeToMinutes5(breakStart);
18825
- const endMinutes = parseTimeToMinutes5(breakEnd);
18824
+ const startMinutes = parseTimeToMinutes6(breakStart);
18825
+ const endMinutes = parseTimeToMinutes6(breakEnd);
18826
18826
  if (endMinutes < startMinutes) {
18827
18827
  return currentMinutes >= startMinutes || currentMinutes < endMinutes;
18828
18828
  } else {
@@ -18830,8 +18830,8 @@ var useActiveBreaks = (lineIds) => {
18830
18830
  }
18831
18831
  };
18832
18832
  const calculateBreakProgress = (breakStart, breakEnd, currentMinutes) => {
18833
- const startMinutes = parseTimeToMinutes5(breakStart);
18834
- const endMinutes = parseTimeToMinutes5(breakEnd);
18833
+ const startMinutes = parseTimeToMinutes6(breakStart);
18834
+ const endMinutes = parseTimeToMinutes6(breakEnd);
18835
18835
  let elapsedMinutes = 0;
18836
18836
  let remainingMinutes = 0;
18837
18837
  if (endMinutes < startMinutes) {
@@ -18849,8 +18849,8 @@ var useActiveBreaks = (lineIds) => {
18849
18849
  return { elapsedMinutes, remainingMinutes };
18850
18850
  };
18851
18851
  const isTimeInShift = (startTime, endTime, currentMinutes) => {
18852
- const startMinutes = parseTimeToMinutes5(startTime);
18853
- const endMinutes = parseTimeToMinutes5(endTime);
18852
+ const startMinutes = parseTimeToMinutes6(startTime);
18853
+ const endMinutes = parseTimeToMinutes6(endTime);
18854
18854
  if (endMinutes < startMinutes) {
18855
18855
  return currentMinutes >= startMinutes || currentMinutes < endMinutes;
18856
18856
  } else {
@@ -18910,8 +18910,8 @@ var useActiveBreaks = (lineIds) => {
18910
18910
  const endTime = breakItem.end || breakItem.endTime || "00:00";
18911
18911
  let duration = breakItem.duration || 0;
18912
18912
  if (!duration || duration === 0) {
18913
- const startMinutes = parseTimeToMinutes5(startTime);
18914
- const endMinutes = parseTimeToMinutes5(endTime);
18913
+ const startMinutes = parseTimeToMinutes6(startTime);
18914
+ const endMinutes = parseTimeToMinutes6(endTime);
18915
18915
  duration = endMinutes < startMinutes ? endMinutes + 24 * 60 - startMinutes : endMinutes - startMinutes;
18916
18916
  }
18917
18917
  return {
@@ -18927,8 +18927,8 @@ var useActiveBreaks = (lineIds) => {
18927
18927
  const endTime = breakItem.end || breakItem.endTime || "00:00";
18928
18928
  let duration = breakItem.duration || 0;
18929
18929
  if (!duration || duration === 0) {
18930
- const startMinutes = parseTimeToMinutes5(startTime);
18931
- const endMinutes = parseTimeToMinutes5(endTime);
18930
+ const startMinutes = parseTimeToMinutes6(startTime);
18931
+ const endMinutes = parseTimeToMinutes6(endTime);
18932
18932
  duration = endMinutes < startMinutes ? endMinutes + 24 * 60 - startMinutes : endMinutes - startMinutes;
18933
18933
  }
18934
18934
  return {
@@ -20031,6 +20031,89 @@ var useMonthlyTrend = (params) => {
20031
20031
  }, [queryString2, supabase]);
20032
20032
  return { trendSummary, isLoading, error };
20033
20033
  };
20034
+
20035
+ // src/lib/services/workspaceHourSummaryService.ts
20036
+ var fetchWorkspaceHourSummary = (supabase, request) => {
20037
+ const {
20038
+ workspaceId,
20039
+ companyId,
20040
+ date,
20041
+ shiftId,
20042
+ hourIndex,
20043
+ hourStart,
20044
+ hourEnd,
20045
+ forceRefresh = false,
20046
+ selectionSource = "unknown"
20047
+ } = request;
20048
+ return fetchBackendJson(
20049
+ supabase,
20050
+ `/api/dashboard/workspace/${workspaceId}/hour-summary`,
20051
+ {
20052
+ method: "POST",
20053
+ body: JSON.stringify({
20054
+ companyId,
20055
+ date,
20056
+ shiftId,
20057
+ hourIndex,
20058
+ hourStart,
20059
+ hourEnd,
20060
+ forceRefresh,
20061
+ selectionSource
20062
+ }),
20063
+ timeoutMs: 45e3,
20064
+ retries: 0,
20065
+ sentry: {
20066
+ surface: "workspace_hour_summary",
20067
+ route: "/api/dashboard/workspace/:workspaceId/hour-summary"
20068
+ }
20069
+ }
20070
+ );
20071
+ };
20072
+
20073
+ // src/lib/hooks/useWorkspaceHourSummary.ts
20074
+ var useWorkspaceHourSummary = () => {
20075
+ const supabase = useSupabase();
20076
+ const [data, setData] = useState(null);
20077
+ const [isLoading, setIsLoading] = useState(false);
20078
+ const [error, setError] = useState(null);
20079
+ const activeRequestIdRef = useRef(0);
20080
+ const summarize = useCallback(async (request) => {
20081
+ const requestId = activeRequestIdRef.current + 1;
20082
+ activeRequestIdRef.current = requestId;
20083
+ setIsLoading(true);
20084
+ setError(null);
20085
+ try {
20086
+ const response = await fetchWorkspaceHourSummary(supabase, request);
20087
+ if (activeRequestIdRef.current === requestId) {
20088
+ setData(response);
20089
+ }
20090
+ return response;
20091
+ } catch (err) {
20092
+ const nextError = err instanceof Error ? err : new Error(String(err));
20093
+ if (activeRequestIdRef.current === requestId) {
20094
+ setError(nextError);
20095
+ }
20096
+ throw nextError;
20097
+ } finally {
20098
+ if (activeRequestIdRef.current === requestId) {
20099
+ setIsLoading(false);
20100
+ }
20101
+ }
20102
+ }, [supabase]);
20103
+ const reset = useCallback(() => {
20104
+ activeRequestIdRef.current += 1;
20105
+ setData(null);
20106
+ setError(null);
20107
+ setIsLoading(false);
20108
+ }, []);
20109
+ return {
20110
+ data,
20111
+ isLoading,
20112
+ error,
20113
+ summarize,
20114
+ reset
20115
+ };
20116
+ };
20034
20117
  var MAX_RETRIES = 10;
20035
20118
  var RETRY_DELAY = 500;
20036
20119
  function useNavigation(customNavigate) {
@@ -25727,7 +25810,7 @@ var MotionConfigContext = createContext({
25727
25810
  });
25728
25811
 
25729
25812
  // ../../node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs
25730
- var PopChildMeasure = class extends React146.Component {
25813
+ var PopChildMeasure = class extends React147.Component {
25731
25814
  getSnapshotBeforeUpdate(prevProps) {
25732
25815
  const element = this.props.childRef.current;
25733
25816
  if (element && prevProps.isPresent && !this.props.isPresent) {
@@ -25782,7 +25865,7 @@ function PopChild({ children, isPresent }) {
25782
25865
  document.head.removeChild(style);
25783
25866
  };
25784
25867
  }, [isPresent]);
25785
- return jsx(PopChildMeasure, { isPresent, childRef: ref, sizeRef: size, children: React146.cloneElement(children, { ref }) });
25868
+ return jsx(PopChildMeasure, { isPresent, childRef: ref, sizeRef: size, children: React147.cloneElement(children, { ref }) });
25786
25869
  }
25787
25870
 
25788
25871
  // ../../node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs
@@ -25819,7 +25902,7 @@ var PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, pre
25819
25902
  useMemo(() => {
25820
25903
  presenceChildren.forEach((_, key) => presenceChildren.set(key, false));
25821
25904
  }, [isPresent]);
25822
- React146.useEffect(() => {
25905
+ React147.useEffect(() => {
25823
25906
  !isPresent && !presenceChildren.size && onExitComplete && onExitComplete();
25824
25907
  }, [isPresent]);
25825
25908
  if (mode === "popLayout") {
@@ -33604,7 +33687,7 @@ var withAuth = (WrappedComponent2, options) => {
33604
33687
  requireAuth: true,
33605
33688
  ...options
33606
33689
  };
33607
- const WithAuthComponent = React146.memo(function WithAuthComponent2(props) {
33690
+ const WithAuthComponent = React147.memo(function WithAuthComponent2(props) {
33608
33691
  const {
33609
33692
  session,
33610
33693
  user,
@@ -33615,9 +33698,9 @@ var withAuth = (WrappedComponent2, options) => {
33615
33698
  retrySessionHydration
33616
33699
  } = useAuth();
33617
33700
  const router = useRouter();
33618
- const [localLoading, setLocalLoading] = React146.useState(loading);
33619
- const [loadingTimeoutReached, setLoadingTimeoutReached] = React146.useState(false);
33620
- React146.useEffect(() => {
33701
+ const [localLoading, setLocalLoading] = React147.useState(loading);
33702
+ const [loadingTimeoutReached, setLoadingTimeoutReached] = React147.useState(false);
33703
+ React147.useEffect(() => {
33621
33704
  if (process.env.NODE_ENV === "development" && process.env.DEBUG_AUTH === "true") {
33622
33705
  console.log("withAuth state:", {
33623
33706
  loading,
@@ -33629,7 +33712,7 @@ var withAuth = (WrappedComponent2, options) => {
33629
33712
  });
33630
33713
  }
33631
33714
  }, [authStatus, error, loading, session, user]);
33632
- const handleLoadingTimeout = React146.useCallback(() => {
33715
+ const handleLoadingTimeout = React147.useCallback(() => {
33633
33716
  console.warn("[withAuth] Loading timeout reached");
33634
33717
  setLoadingTimeoutReached(true);
33635
33718
  if (hasStoredSupabaseSession()) {
@@ -33641,13 +33724,13 @@ var withAuth = (WrappedComponent2, options) => {
33641
33724
  router.replace(defaultOptions.redirectTo);
33642
33725
  }
33643
33726
  }, [retrySessionHydration, router]);
33644
- React146.useEffect(() => {
33727
+ React147.useEffect(() => {
33645
33728
  if (!loading && authStatus !== "recovering" && defaultOptions.requireAuth && !session && !error) {
33646
33729
  console.log("[withAuth] No session found, redirecting to login");
33647
33730
  router.replace(defaultOptions.redirectTo);
33648
33731
  }
33649
33732
  }, [authStatus, defaultOptions.requireAuth, error, loading, router, session]);
33650
- React146.useEffect(() => {
33733
+ React147.useEffect(() => {
33651
33734
  setLocalLoading(loading);
33652
33735
  }, [loading]);
33653
33736
  if (loading || localLoading) {
@@ -34646,11 +34729,11 @@ var BarChartComponent = ({
34646
34729
  aspect = 2,
34647
34730
  ...restOfChartProps
34648
34731
  }) => {
34649
- const containerRef = React146__default.useRef(null);
34650
- const [containerReady, setContainerReady] = React146__default.useState(false);
34732
+ const containerRef = React147__default.useRef(null);
34733
+ const [containerReady, setContainerReady] = React147__default.useState(false);
34651
34734
  const themeConfig = useThemeConfig();
34652
34735
  const { formatNumber } = useFormatNumber();
34653
- React146__default.useEffect(() => {
34736
+ React147__default.useEffect(() => {
34654
34737
  const checkContainerDimensions = () => {
34655
34738
  if (containerRef.current) {
34656
34739
  const rect = containerRef.current.getBoundingClientRect();
@@ -34764,7 +34847,7 @@ var BarChartComponent = ({
34764
34847
  }
34765
34848
  return /* @__PURE__ */ jsx("div", { className: clsx("w-full", className), children: chartContent });
34766
34849
  };
34767
- var BarChart = React146__default.memo(BarChartComponent, (prevProps, nextProps) => {
34850
+ var BarChart = React147__default.memo(BarChartComponent, (prevProps, nextProps) => {
34768
34851
  if (prevProps.xAxisDataKey !== nextProps.xAxisDataKey || prevProps.xAxisLabel !== nextProps.xAxisLabel || prevProps.yAxisLabel !== nextProps.yAxisLabel || prevProps.yAxisUnit !== nextProps.yAxisUnit || JSON.stringify(prevProps.referenceLines || []) !== JSON.stringify(nextProps.referenceLines || []) || prevProps.layout !== nextProps.layout || prevProps.className !== nextProps.className || prevProps.showGrid !== nextProps.showGrid || prevProps.showLegend !== nextProps.showLegend || prevProps.showTooltip !== nextProps.showTooltip || prevProps.responsive !== nextProps.responsive || prevProps.aspect !== nextProps.aspect) {
34769
34852
  return false;
34770
34853
  }
@@ -34815,10 +34898,10 @@ var LineChartComponent = ({
34815
34898
  fillContainer = false,
34816
34899
  ...restOfChartProps
34817
34900
  }) => {
34818
- const containerRef = React146__default.useRef(null);
34819
- const [dimensions, setDimensions] = React146__default.useState({ width: 0, height: 0 });
34820
- const [hasValidData, setHasValidData] = React146__default.useState(false);
34821
- React146__default.useEffect(() => {
34901
+ const containerRef = React147__default.useRef(null);
34902
+ const [dimensions, setDimensions] = React147__default.useState({ width: 0, height: 0 });
34903
+ const [hasValidData, setHasValidData] = React147__default.useState(false);
34904
+ React147__default.useEffect(() => {
34822
34905
  const currentHasValidData = data && lines && lines.length > 0 && data.some(
34823
34906
  (item) => lines.some((line) => {
34824
34907
  const val = item[line.dataKey];
@@ -34829,7 +34912,7 @@ var LineChartComponent = ({
34829
34912
  setHasValidData(true);
34830
34913
  }
34831
34914
  }, [data, lines, hasValidData]);
34832
- React146__default.useEffect(() => {
34915
+ React147__default.useEffect(() => {
34833
34916
  if (!containerRef.current) return;
34834
34917
  const observer = new ResizeObserver((entries) => {
34835
34918
  const entry = entries[0];
@@ -34954,7 +35037,7 @@ var LineChartComponent = ({
34954
35037
  }
34955
35038
  return /* @__PURE__ */ jsx("div", { className: clsx("w-full", className), children: renderChartContent(restOfChartProps.width, restOfChartProps.height) });
34956
35039
  };
34957
- var LineChart = React146__default.memo(LineChartComponent, (prevProps, nextProps) => {
35040
+ var LineChart = React147__default.memo(LineChartComponent, (prevProps, nextProps) => {
34958
35041
  if (prevProps.xAxisDataKey !== nextProps.xAxisDataKey || prevProps.xAxisLabel !== nextProps.xAxisLabel || prevProps.yAxisLabel !== nextProps.yAxisLabel || prevProps.yAxisUnit !== nextProps.yAxisUnit || prevProps.className !== nextProps.className || prevProps.showGrid !== nextProps.showGrid || prevProps.showLegend !== nextProps.showLegend || prevProps.showTooltip !== nextProps.showTooltip || prevProps.responsive !== nextProps.responsive || prevProps.aspect !== nextProps.aspect || JSON.stringify(prevProps.yAxisDomain) !== JSON.stringify(nextProps.yAxisDomain)) {
34959
35042
  return false;
34960
35043
  }
@@ -35121,7 +35204,7 @@ var SkuRow = ({ sku, isSelected, isLive, onSelect }) => {
35121
35204
  );
35122
35205
  };
35123
35206
  var PerSkuView = ({ rows, className = "", selectedSkuId, liveSkuId, onSelectSku }) => {
35124
- const ordered = React146__default.useMemo(
35207
+ const ordered = React147__default.useMemo(
35125
35208
  () => [...rows].sort((a, b) => {
35126
35209
  const am = (b.active_minutes ?? 0) - (a.active_minutes ?? 0);
35127
35210
  if (am !== 0) return am;
@@ -35129,9 +35212,9 @@ var PerSkuView = ({ rows, className = "", selectedSkuId, liveSkuId, onSelectSku
35129
35212
  }),
35130
35213
  [rows]
35131
35214
  );
35132
- const scrollContainerRef = React146__default.useRef(null);
35133
- const [showScrollIndicatorBottom, setShowScrollIndicatorBottom] = React146__default.useState(ordered.length > 4);
35134
- const [showScrollIndicatorTop, setShowScrollIndicatorTop] = React146__default.useState(false);
35215
+ const scrollContainerRef = React147__default.useRef(null);
35216
+ const [showScrollIndicatorBottom, setShowScrollIndicatorBottom] = React147__default.useState(ordered.length > 4);
35217
+ const [showScrollIndicatorTop, setShowScrollIndicatorTop] = React147__default.useState(false);
35135
35218
  const handleScroll = (e) => {
35136
35219
  const target = e.currentTarget;
35137
35220
  if (target.scrollHeight - target.scrollTop <= target.clientHeight + 10) {
@@ -35155,7 +35238,7 @@ var PerSkuView = ({ rows, className = "", selectedSkuId, liveSkuId, onSelectSku
35155
35238
  scrollContainerRef.current.scrollBy({ top: -80, behavior: "smooth" });
35156
35239
  }
35157
35240
  };
35158
- React146__default.useEffect(() => {
35241
+ React147__default.useEffect(() => {
35159
35242
  if (scrollContainerRef.current) {
35160
35243
  const target = scrollContainerRef.current;
35161
35244
  setShowScrollIndicatorBottom(target.scrollHeight > target.clientHeight && target.scrollHeight - target.scrollTop > target.clientHeight + 10);
@@ -35228,7 +35311,7 @@ var OutputProgressChartComponent = ({
35228
35311
  liveSkuId,
35229
35312
  onSelectSku
35230
35313
  }) => {
35231
- const realSkuRows = React146__default.useMemo(
35314
+ const realSkuRows = React147__default.useMemo(
35232
35315
  () => filterRealSkuBreakdown(skuBreakdown),
35233
35316
  [skuBreakdown]
35234
35317
  );
@@ -35253,7 +35336,7 @@ var OutputProgressChartComponent = ({
35253
35336
  }
35254
35337
  );
35255
35338
  };
35256
- var OutputProgressChart = React146__default.memo(OutputProgressChartComponent);
35339
+ var OutputProgressChart = React147__default.memo(OutputProgressChartComponent);
35257
35340
  OutputProgressChart.displayName = "OutputProgressChart";
35258
35341
  var LargeOutputProgressChart = ({
35259
35342
  currentOutput,
@@ -35393,7 +35476,7 @@ var CycleTimeChartComponent = ({
35393
35476
  }
35394
35477
  ) }) });
35395
35478
  };
35396
- var CycleTimeChart = React146__default.memo(CycleTimeChartComponent, (prevProps, nextProps) => {
35479
+ var CycleTimeChart = React147__default.memo(CycleTimeChartComponent, (prevProps, nextProps) => {
35397
35480
  if (prevProps.className !== nextProps.className) {
35398
35481
  return false;
35399
35482
  }
@@ -35628,19 +35711,21 @@ var CycleTimeOverTimeChart = ({
35628
35711
  className = "",
35629
35712
  showIdleTime = false,
35630
35713
  idleTimeData = [],
35631
- idleTimeSlots = []
35714
+ idleTimeSlots = [],
35715
+ selectedHourIndex = null,
35716
+ onHourClick
35632
35717
  }) => {
35633
35718
  const MAX_DATA_POINTS = 40;
35634
- const containerRef = React146__default.useRef(null);
35635
- const [dimensions, setDimensions] = React146__default.useState({ width: 0, height: 0 });
35636
- const [hasValidData, setHasValidData] = React146__default.useState(false);
35637
- React146__default.useEffect(() => {
35719
+ const containerRef = React147__default.useRef(null);
35720
+ const [dimensions, setDimensions] = React147__default.useState({ width: 0, height: 0 });
35721
+ const [hasValidData, setHasValidData] = React147__default.useState(false);
35722
+ React147__default.useEffect(() => {
35638
35723
  const currentHasValidData = data && data.some((val) => val !== null && val > 0);
35639
35724
  if (currentHasValidData && !hasValidData) {
35640
35725
  setHasValidData(true);
35641
35726
  }
35642
35727
  }, [data, hasValidData]);
35643
- React146__default.useEffect(() => {
35728
+ React147__default.useEffect(() => {
35644
35729
  if (!containerRef.current) return;
35645
35730
  const observer = new ResizeObserver((entries) => {
35646
35731
  const entry = entries[0];
@@ -35654,13 +35739,19 @@ var CycleTimeOverTimeChart = ({
35654
35739
  observer.observe(containerRef.current);
35655
35740
  return () => observer.disconnect();
35656
35741
  }, []);
35657
- const parseTimeToMinutes5 = (value) => {
35742
+ const parseTimeToMinutes6 = (value) => {
35658
35743
  const [hours, minutes] = value.split(":").map(Number);
35659
35744
  if (!Number.isFinite(hours) || !Number.isFinite(minutes)) return 0;
35660
35745
  return hours * 60 + minutes;
35661
35746
  };
35747
+ const formatMinutesAsTimeFilter2 = (value) => {
35748
+ const normalized = (Math.round(value) % (24 * 60) + 24 * 60) % (24 * 60);
35749
+ const hour = Math.floor(normalized / 60);
35750
+ const minute = normalized % 60;
35751
+ return `${hour.toString().padStart(2, "0")}:${minute.toString().padStart(2, "0")}`;
35752
+ };
35662
35753
  const formatHourLabel = (slotIndex) => {
35663
- const baseMinutes = parseTimeToMinutes5(shiftStart);
35754
+ const baseMinutes = parseTimeToMinutes6(shiftStart);
35664
35755
  const absoluteMinutes = baseMinutes + slotIndex * 60;
35665
35756
  const hour24 = Math.floor(absoluteMinutes % (24 * 60) / 60);
35666
35757
  const ampm = hour24 >= 12 ? "PM" : "AM";
@@ -35672,7 +35763,7 @@ var CycleTimeOverTimeChart = ({
35672
35763
  const endLabel = shiftEnd && slotIndex === DURATION - 1 ? formatHourLabel(slotIndex + 1) : formatHourLabel(slotIndex + 1);
35673
35764
  return `${startLabel} - ${endLabel}`;
35674
35765
  };
35675
- const getDisplayData = React146__default.useCallback((rawData) => {
35766
+ const getDisplayData = React147__default.useCallback((rawData) => {
35676
35767
  if (xAxisMode === "hourly") return rawData;
35677
35768
  return rawData.slice(Math.max(0, rawData.length - MAX_DATA_POINTS));
35678
35769
  }, [xAxisMode]);
@@ -35680,7 +35771,7 @@ var CycleTimeOverTimeChart = ({
35680
35771
  const DURATION = displayData.length;
35681
35772
  const effectiveDatasetKey = datasetKey || `cycle-time:${xAxisMode}`;
35682
35773
  const finalData = displayData;
35683
- const labelInterval = React146__default.useMemo(() => {
35774
+ const labelInterval = React147__default.useMemo(() => {
35684
35775
  if (xAxisMode === "hourly") {
35685
35776
  return Math.max(1, Math.ceil(DURATION / 8));
35686
35777
  }
@@ -35721,8 +35812,27 @@ var CycleTimeOverTimeChart = ({
35721
35812
  return `${minutes} minutes ${seconds} seconds ago`;
35722
35813
  }
35723
35814
  };
35724
- const getNumericValue = React146__default.useCallback((value) => typeof value === "number" && Number.isFinite(value) ? value : null, []);
35725
- const renderChartTooltip = React146__default.useCallback((tooltipProps) => {
35815
+ const getNumericValue = React147__default.useCallback((value) => typeof value === "number" && Number.isFinite(value) ? value : null, []);
35816
+ const buildHourClickPayload = React147__default.useCallback((dataPoint) => {
35817
+ if (!onHourClick || xAxisMode !== "hourly") {
35818
+ return null;
35819
+ }
35820
+ const hourIndex = Number.isFinite(dataPoint?.hourIndex) ? Number(dataPoint.hourIndex) : 0;
35821
+ const slotStart = parseTimeToMinutes6(shiftStart) + hourIndex * 60;
35822
+ const slotEnd = shiftEnd && hourIndex === DURATION - 1 ? parseTimeToMinutes6(shiftEnd) : slotStart + 60;
35823
+ const cycleTime = getNumericValue(dataPoint?.cycleTime);
35824
+ return {
35825
+ hourIndex,
35826
+ timeRange: dataPoint?.timeRange || dataPoint?.tooltip || formatTooltipTime(hourIndex),
35827
+ startTime: formatMinutesAsTimeFilter2(slotStart),
35828
+ endTime: formatMinutesAsTimeFilter2(slotEnd),
35829
+ cycleTime,
35830
+ idealCycleTime,
35831
+ idleMinutes: getNumericValue(dataPoint?.idleMinutes),
35832
+ status: cycleTime !== null && cycleTime <= idealCycleTime ? "within_standard" : "above_standard"
35833
+ };
35834
+ }, [DURATION, getNumericValue, idealCycleTime, onHourClick, shiftEnd, shiftStart, xAxisMode]);
35835
+ const renderChartTooltip = React147__default.useCallback((tooltipProps) => {
35726
35836
  const { active, payload } = tooltipProps;
35727
35837
  if (!active || !Array.isArray(payload) || payload.length === 0) {
35728
35838
  return null;
@@ -35781,29 +35891,31 @@ var CycleTimeOverTimeChart = ({
35781
35891
  " mins)"
35782
35892
  ] }) })
35783
35893
  ] }, index)) })
35784
- ] })
35894
+ ] }),
35895
+ onHourClick && xAxisMode === "hourly" && /* @__PURE__ */ jsx("div", { className: "border-t border-blue-100 pt-2", children: /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-blue-100 bg-blue-50 px-3 py-2 text-xs font-semibold text-blue-700", children: "Click to inspect hour" }) })
35785
35896
  ] })
35786
35897
  ] });
35787
- }, [getNumericValue, shiftStart, showIdleTime]);
35788
- const renderCycleDot = React146__default.useCallback((props) => {
35898
+ }, [getNumericValue, onHourClick, shiftStart, showIdleTime, xAxisMode]);
35899
+ const renderCycleDot = React147__default.useCallback((props) => {
35789
35900
  const { cx: cx2, cy, payload } = props;
35790
35901
  const cycleTime = getNumericValue(payload?.cycleTime);
35791
35902
  if (cycleTime === null) {
35792
35903
  return /* @__PURE__ */ jsx("g", {});
35793
35904
  }
35905
+ const isSelected = selectedHourIndex === payload?.hourIndex;
35794
35906
  return /* @__PURE__ */ jsx(
35795
35907
  "circle",
35796
35908
  {
35797
35909
  cx: cx2,
35798
35910
  cy,
35799
- r: 4,
35911
+ r: isSelected ? 6 : 4,
35800
35912
  fill: cycleTime <= idealCycleTime ? "#00AB45" : "#E34329",
35801
- stroke: "#fff",
35802
- strokeWidth: 1,
35913
+ stroke: isSelected ? "#0f172a" : "#fff",
35914
+ strokeWidth: isSelected ? 2 : 1,
35803
35915
  style: {
35804
- filter: "brightness(1)",
35916
+ filter: isSelected ? "drop-shadow(0 0 3px rgba(15,23,42,0.35)) brightness(1.1)" : "brightness(1)",
35805
35917
  transition: "filter 0.3s ease, transform 0.3s ease",
35806
- cursor: "pointer"
35918
+ cursor: onHourClick ? "pointer" : "default"
35807
35919
  },
35808
35920
  onMouseEnter: (e) => {
35809
35921
  const target = e.target;
@@ -35812,34 +35924,48 @@ var CycleTimeOverTimeChart = ({
35812
35924
  },
35813
35925
  onMouseLeave: (e) => {
35814
35926
  const target = e.target;
35815
- target.style.filter = "brightness(1)";
35816
- target.style.transform = "scale(1)";
35927
+ target.style.filter = isSelected ? "drop-shadow(0 0 3px rgba(15,23,42,0.35)) brightness(1.1)" : "brightness(1)";
35928
+ target.style.transform = isSelected ? "scale(1.1)" : "scale(1)";
35929
+ },
35930
+ onClick: () => {
35931
+ const clickPayload = buildHourClickPayload(payload);
35932
+ if (clickPayload) {
35933
+ onHourClick?.(clickPayload);
35934
+ }
35817
35935
  }
35818
35936
  }
35819
35937
  );
35820
- }, [getNumericValue, idealCycleTime]);
35821
- const renderCycleActiveDot = React146__default.useCallback((props) => {
35938
+ }, [buildHourClickPayload, getNumericValue, idealCycleTime, onHourClick, selectedHourIndex]);
35939
+ const renderCycleActiveDot = React147__default.useCallback((props) => {
35822
35940
  const { cx: cx2, cy, payload } = props;
35823
35941
  const cycleTime = getNumericValue(payload?.cycleTime);
35824
35942
  if (cycleTime === null) {
35825
35943
  return /* @__PURE__ */ jsx("g", {});
35826
35944
  }
35945
+ const isSelected = selectedHourIndex === payload?.hourIndex;
35827
35946
  return /* @__PURE__ */ jsx(
35828
35947
  "circle",
35829
35948
  {
35830
35949
  cx: cx2,
35831
35950
  cy,
35832
- r: 6,
35951
+ r: isSelected ? 7 : 6,
35833
35952
  fill: cycleTime <= idealCycleTime ? "#00AB45" : "#E34329",
35834
- stroke: "#fff",
35953
+ stroke: isSelected ? "#0f172a" : "#fff",
35835
35954
  strokeWidth: 2,
35836
35955
  style: {
35837
- filter: "drop-shadow(0 0 2px rgba(0,0,0,0.2))"
35956
+ filter: "drop-shadow(0 0 2px rgba(0,0,0,0.2))",
35957
+ cursor: onHourClick ? "pointer" : "default"
35958
+ },
35959
+ onClick: () => {
35960
+ const clickPayload = buildHourClickPayload(payload);
35961
+ if (clickPayload) {
35962
+ onHourClick?.(clickPayload);
35963
+ }
35838
35964
  }
35839
35965
  }
35840
35966
  );
35841
- }, [getNumericValue, idealCycleTime]);
35842
- const renderIdleDot = React146__default.useCallback((props) => {
35967
+ }, [buildHourClickPayload, getNumericValue, idealCycleTime, onHourClick, selectedHourIndex]);
35968
+ const renderIdleDot = React147__default.useCallback((props) => {
35843
35969
  const { cx: cx2, cy, payload } = props;
35844
35970
  const idleMinutes = getNumericValue(payload?.idleMinutes);
35845
35971
  if (idleMinutes === null) {
@@ -35861,7 +35987,7 @@ var CycleTimeOverTimeChart = ({
35861
35987
  }
35862
35988
  );
35863
35989
  }, [getNumericValue, showIdleTime]);
35864
- const renderIdleActiveDot = React146__default.useCallback((props) => {
35990
+ const renderIdleActiveDot = React147__default.useCallback((props) => {
35865
35991
  const { cx: cx2, cy, payload } = props;
35866
35992
  const idleMinutes = getNumericValue(payload?.idleMinutes);
35867
35993
  if (idleMinutes === null || !showIdleTime) {
@@ -35879,7 +36005,7 @@ var CycleTimeOverTimeChart = ({
35879
36005
  }
35880
36006
  );
35881
36007
  }, [getNumericValue, showIdleTime]);
35882
- const chartData = React146__default.useMemo(() => Array.from({ length: DURATION }, (_, i) => {
36008
+ const chartData = React147__default.useMemo(() => Array.from({ length: DURATION }, (_, i) => {
35883
36009
  const cycleTime = getNumericValue(finalData[i]);
35884
36010
  const useIdleSlots = idleTimeSlots.length > 0;
35885
36011
  const idleSlot = useIdleSlots ? idleTimeSlots[i] ?? null : null;
@@ -36076,7 +36202,7 @@ var CycleTimeOverTimeChart = ({
36076
36202
  }
36077
36203
  );
36078
36204
  };
36079
- var Card = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36205
+ var Card = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36080
36206
  "div",
36081
36207
  {
36082
36208
  ref,
@@ -36088,7 +36214,7 @@ var Card = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
36088
36214
  }
36089
36215
  ));
36090
36216
  Card.displayName = "Card";
36091
- var CardHeader = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36217
+ var CardHeader = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36092
36218
  "div",
36093
36219
  {
36094
36220
  ref,
@@ -36097,7 +36223,7 @@ var CardHeader = React146.forwardRef(({ className, ...props }, ref) => /* @__PUR
36097
36223
  }
36098
36224
  ));
36099
36225
  CardHeader.displayName = "CardHeader";
36100
- var CardTitle = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36226
+ var CardTitle = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36101
36227
  "h3",
36102
36228
  {
36103
36229
  ref,
@@ -36109,7 +36235,7 @@ var CardTitle = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE
36109
36235
  }
36110
36236
  ));
36111
36237
  CardTitle.displayName = "CardTitle";
36112
- var CardDescription = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36238
+ var CardDescription = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36113
36239
  "p",
36114
36240
  {
36115
36241
  ref,
@@ -36118,9 +36244,9 @@ var CardDescription = React146.forwardRef(({ className, ...props }, ref) => /* @
36118
36244
  }
36119
36245
  ));
36120
36246
  CardDescription.displayName = "CardDescription";
36121
- var CardContent = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
36247
+ var CardContent = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
36122
36248
  CardContent.displayName = "CardContent";
36123
- var CardFooter = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36249
+ var CardFooter = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36124
36250
  "div",
36125
36251
  {
36126
36252
  ref,
@@ -36196,7 +36322,7 @@ var buttonVariants = cva(
36196
36322
  }
36197
36323
  }
36198
36324
  );
36199
- var Button = React146.forwardRef(
36325
+ var Button = React147.forwardRef(
36200
36326
  ({ className, variant, size, asChild = false, ...props }, ref) => {
36201
36327
  const Comp = asChild ? Slot : "button";
36202
36328
  return /* @__PURE__ */ jsx(
@@ -36906,6 +37032,35 @@ var buildCompactSkuRailLabel = (label, maxChars) => {
36906
37032
  }
36907
37033
  return acronym || firstWord;
36908
37034
  };
37035
+ var parseTimeToMinutes3 = (timeValue) => {
37036
+ const [hourPart, minutePart] = timeValue.split(":");
37037
+ const hour = Number.parseInt(hourPart, 10);
37038
+ const minute = Number.parseInt(minutePart ?? "0", 10);
37039
+ const safeHour = Number.isFinite(hour) ? hour : 0;
37040
+ const safeMinute = Number.isFinite(minute) ? minute : 0;
37041
+ return safeHour * 60 + safeMinute;
37042
+ };
37043
+ var formatMinutesAsTimeFilter = (totalMinutes) => {
37044
+ const minutesInDay = 24 * 60;
37045
+ const normalized = (Math.round(totalMinutes) % minutesInDay + minutesInDay) % minutesInDay;
37046
+ const hour = Math.floor(normalized / 60);
37047
+ const minute = normalized % 60;
37048
+ return `${hour.toString().padStart(2, "0")}:${minute.toString().padStart(2, "0")}`;
37049
+ };
37050
+ var buildHourClipFilterWindow = ({
37051
+ shiftStart,
37052
+ shiftEnd,
37053
+ hourIndex,
37054
+ slotCount
37055
+ }) => {
37056
+ const startMinutes = parseTimeToMinutes3(shiftStart) + hourIndex * 60;
37057
+ const isLastSlot = hourIndex === slotCount - 1;
37058
+ const endMinutes = isLastSlot && shiftEnd ? parseTimeToMinutes3(shiftEnd) : startMinutes + 60;
37059
+ return {
37060
+ startTime: formatMinutesAsTimeFilter(startMinutes),
37061
+ endTime: formatMinutesAsTimeFilter(endMinutes)
37062
+ };
37063
+ };
36909
37064
  var HourlyOutputChartComponent = ({
36910
37065
  data,
36911
37066
  pphThreshold,
@@ -36919,13 +37074,20 @@ var HourlyOutputChartComponent = ({
36919
37074
  timezone,
36920
37075
  skuSegments,
36921
37076
  activeSkuId,
37077
+ selectedHourIndex = null,
37078
+ onHourClick,
37079
+ onWatchClipsClick,
37080
+ onAiSummaryClick,
36922
37081
  className = ""
36923
37082
  }) => {
36924
- const containerRef = React146__default.useRef(null);
36925
- const [containerReady, setContainerReady] = React146__default.useState(false);
36926
- const [containerWidth, setContainerWidth] = React146__default.useState(0);
36927
- const [hoveredSkuRailLabel, setHoveredSkuRailLabel] = React146__default.useState(null);
36928
- const idleSlots = React146__default.useMemo(
37083
+ const containerRef = React147__default.useRef(null);
37084
+ const [containerReady, setContainerReady] = React147__default.useState(false);
37085
+ const [containerWidth, setContainerWidth] = React147__default.useState(0);
37086
+ const [hoveredSkuRailLabel, setHoveredSkuRailLabel] = React147__default.useState(null);
37087
+ const [isTooltipHovered, setIsTooltipHovered] = React147__default.useState(false);
37088
+ const lastTooltipDataRef = React147__default.useRef(null);
37089
+ const tooltipHoverTimeoutRef = React147__default.useRef(null);
37090
+ const idleSlots = React147__default.useMemo(
36929
37091
  () => buildHourlyIdleSlots({
36930
37092
  idleTimeHourly,
36931
37093
  shiftStart,
@@ -36934,12 +37096,12 @@ var HourlyOutputChartComponent = ({
36934
37096
  [idleTimeHourly, shiftStart, shiftEnd]
36935
37097
  );
36936
37098
  const SHIFT_DURATION = idleSlots.length;
36937
- const [animatedData, setAnimatedData] = React146__default.useState(
37099
+ const [animatedData, setAnimatedData] = React147__default.useState(
36938
37100
  () => Array(SHIFT_DURATION).fill(0)
36939
37101
  );
36940
- const prevDataRef = React146__default.useRef(Array(SHIFT_DURATION).fill(0));
36941
- const animationFrameRef = React146__default.useRef(null);
36942
- React146__default.useEffect(() => {
37102
+ const prevDataRef = React147__default.useRef(Array(SHIFT_DURATION).fill(0));
37103
+ const animationFrameRef = React147__default.useRef(null);
37104
+ React147__default.useEffect(() => {
36943
37105
  setAnimatedData((prev) => {
36944
37106
  if (prev.length !== SHIFT_DURATION) {
36945
37107
  return Array(SHIFT_DURATION).fill(0);
@@ -36948,14 +37110,14 @@ var HourlyOutputChartComponent = ({
36948
37110
  });
36949
37111
  prevDataRef.current = Array(SHIFT_DURATION).fill(0);
36950
37112
  }, [SHIFT_DURATION]);
36951
- const [idleBarState, setIdleBarState] = React146__default.useState({
37113
+ const [idleBarState, setIdleBarState] = React147__default.useState({
36952
37114
  visible: showIdleTime,
36953
37115
  key: 0,
36954
37116
  shouldAnimate: false
36955
37117
  });
36956
- const prevShowIdleTimeRef = React146__default.useRef(showIdleTime);
36957
- const stateUpdateTimeoutRef = React146__default.useRef(null);
36958
- React146__default.useEffect(() => {
37118
+ const prevShowIdleTimeRef = React147__default.useRef(showIdleTime);
37119
+ const stateUpdateTimeoutRef = React147__default.useRef(null);
37120
+ React147__default.useEffect(() => {
36959
37121
  if (stateUpdateTimeoutRef.current) {
36960
37122
  clearTimeout(stateUpdateTimeoutRef.current);
36961
37123
  }
@@ -36980,7 +37142,7 @@ var HourlyOutputChartComponent = ({
36980
37142
  }
36981
37143
  };
36982
37144
  }, [showIdleTime]);
36983
- const animateToNewData = React146__default.useCallback((targetData) => {
37145
+ const animateToNewData = React147__default.useCallback((targetData) => {
36984
37146
  const startData = [...prevDataRef.current];
36985
37147
  const startTime = performance.now();
36986
37148
  const duration = 1200;
@@ -37010,7 +37172,7 @@ var HourlyOutputChartComponent = ({
37010
37172
  }
37011
37173
  animationFrameRef.current = requestAnimationFrame(animate);
37012
37174
  }, []);
37013
- React146__default.useEffect(() => {
37175
+ React147__default.useEffect(() => {
37014
37176
  if (JSON.stringify(data) !== JSON.stringify(prevDataRef.current)) {
37015
37177
  const shiftData = data.slice(0, SHIFT_DURATION);
37016
37178
  animateToNewData(shiftData);
@@ -37021,7 +37183,14 @@ var HourlyOutputChartComponent = ({
37021
37183
  }
37022
37184
  };
37023
37185
  }, [data, animateToNewData]);
37024
- React146__default.useEffect(() => {
37186
+ React147__default.useEffect(() => {
37187
+ return () => {
37188
+ if (tooltipHoverTimeoutRef.current) {
37189
+ clearTimeout(tooltipHoverTimeoutRef.current);
37190
+ }
37191
+ };
37192
+ }, []);
37193
+ React147__default.useEffect(() => {
37025
37194
  const checkContainerDimensions = () => {
37026
37195
  if (containerRef.current) {
37027
37196
  const rect = containerRef.current.getBoundingClientRect();
@@ -37047,7 +37216,7 @@ var HourlyOutputChartComponent = ({
37047
37216
  clearTimeout(fallbackTimeout);
37048
37217
  };
37049
37218
  }, []);
37050
- const xAxisConfig = React146__default.useMemo(() => {
37219
+ const xAxisConfig = React147__default.useMemo(() => {
37051
37220
  if (containerWidth >= 960) {
37052
37221
  return {
37053
37222
  interval: 0,
@@ -37068,13 +37237,13 @@ var HourlyOutputChartComponent = ({
37068
37237
  }
37069
37238
  return { interval: 0, angle: -30, height: 64, tickFont: 9, tickMargin: 6 };
37070
37239
  }, [containerWidth]);
37071
- const shiftWindow = React146__default.useMemo(() => resolveShiftWindow2({
37240
+ const shiftWindow = React147__default.useMemo(() => resolveShiftWindow2({
37072
37241
  shiftStart,
37073
37242
  slotCount: SHIFT_DURATION,
37074
37243
  shiftDate,
37075
37244
  timezone
37076
37245
  }), [shiftStart, shiftEnd, SHIFT_DURATION, shiftDate, timezone]);
37077
- const fallbackTimelineEndOffset = React146__default.useMemo(
37246
+ const fallbackTimelineEndOffset = React147__default.useMemo(
37078
37247
  () => resolveTimelineEndOffset({
37079
37248
  shiftStart,
37080
37249
  shiftEnd,
@@ -37084,7 +37253,7 @@ var HourlyOutputChartComponent = ({
37084
37253
  }),
37085
37254
  [shiftStart, shiftEnd, SHIFT_DURATION, shiftDate, timezone]
37086
37255
  );
37087
- const observedTimelineEndOffset = React146__default.useMemo(() => {
37256
+ const observedTimelineEndOffset = React147__default.useMemo(() => {
37088
37257
  let lastObservedMinute = -1;
37089
37258
  idleSlots.forEach((slot) => {
37090
37259
  slot.idleArray.forEach((value, minuteIndex) => {
@@ -37100,7 +37269,7 @@ var HourlyOutputChartComponent = ({
37100
37269
  return Math.min((lastObservedMinute + 1) / 60, SHIFT_DURATION);
37101
37270
  }, [idleSlots, SHIFT_DURATION]);
37102
37271
  const timelineEndOffset = observedTimelineEndOffset ?? fallbackTimelineEndOffset;
37103
- const targetLineEndOffset = React146__default.useMemo(() => {
37272
+ const targetLineEndOffset = React147__default.useMemo(() => {
37104
37273
  if (timelineEndOffset >= SHIFT_DURATION) {
37105
37274
  return SHIFT_DURATION;
37106
37275
  }
@@ -37109,7 +37278,7 @@ var HourlyOutputChartComponent = ({
37109
37278
  }
37110
37279
  return Math.min(Math.floor(timelineEndOffset) + 1, SHIFT_DURATION);
37111
37280
  }, [timelineEndOffset, SHIFT_DURATION]);
37112
- const skuTimelineSegments = React146__default.useMemo(() => {
37281
+ const skuTimelineSegments = React147__default.useMemo(() => {
37113
37282
  if (!skuSegments || skuSegments.length === 0 || !shiftWindow || timelineEndOffset <= 0) {
37114
37283
  return [];
37115
37284
  }
@@ -37143,18 +37312,18 @@ var HourlyOutputChartComponent = ({
37143
37312
  };
37144
37313
  }).filter((segment) => segment.end > segment.start);
37145
37314
  }, [skuSegments, shiftWindow, timelineEndOffset, pphThreshold]);
37146
- const targetTimelineSegments = React146__default.useMemo(() => {
37315
+ const targetTimelineSegments = React147__default.useMemo(() => {
37147
37316
  if (skuTimelineSegments.length === 0) return [];
37148
37317
  return skuTimelineSegments.map((segment, index) => ({
37149
37318
  ...segment,
37150
37319
  end: index === skuTimelineSegments.length - 1 ? Math.max(segment.start, targetLineEndOffset) : segment.end
37151
37320
  })).filter((segment) => segment.end > segment.start);
37152
37321
  }, [skuTimelineSegments, targetLineEndOffset]);
37153
- const hasExplicitHourlyTargetOutputProp = React146__default.useMemo(
37322
+ const hasExplicitHourlyTargetOutputProp = React147__default.useMemo(
37154
37323
  () => hourlyTargetOutput !== void 0,
37155
37324
  [hourlyTargetOutput]
37156
37325
  );
37157
- const fallbackHourlyTargetOutput = React146__default.useMemo(() => {
37326
+ const fallbackHourlyTargetOutput = React147__default.useMemo(() => {
37158
37327
  if (hasExplicitHourlyTargetOutputProp) return void 0;
37159
37328
  if (skuTimelineSegments.length > 0) return void 0;
37160
37329
  const plan = buildHourlyTargetPlan({
@@ -37174,19 +37343,19 @@ var HourlyOutputChartComponent = ({
37174
37343
  shiftBreaks,
37175
37344
  pphThreshold
37176
37345
  ]);
37177
- const effectiveHourlyTargetOutput = React146__default.useMemo(
37346
+ const effectiveHourlyTargetOutput = React147__default.useMemo(
37178
37347
  () => hasExplicitHourlyTargetOutputProp ? hourlyTargetOutput : fallbackHourlyTargetOutput,
37179
37348
  [hasExplicitHourlyTargetOutputProp, hourlyTargetOutput, fallbackHourlyTargetOutput]
37180
37349
  );
37181
- const hasHourlyTargetOutputProp = React146__default.useMemo(
37350
+ const hasHourlyTargetOutputProp = React147__default.useMemo(
37182
37351
  () => effectiveHourlyTargetOutput !== void 0,
37183
37352
  [effectiveHourlyTargetOutput]
37184
37353
  );
37185
- const hasExplicitHourlyTargets = React146__default.useMemo(
37354
+ const hasExplicitHourlyTargets = React147__default.useMemo(
37186
37355
  () => Array.isArray(effectiveHourlyTargetOutput) && effectiveHourlyTargetOutput.some((value) => value !== null && value !== void 0),
37187
37356
  [effectiveHourlyTargetOutput]
37188
37357
  );
37189
- const hourlyTargetSegments = React146__default.useMemo(() => {
37358
+ const hourlyTargetSegments = React147__default.useMemo(() => {
37190
37359
  if (!hasExplicitHourlyTargets) return [];
37191
37360
  const segments = [];
37192
37361
  let runStart = null;
@@ -37218,7 +37387,7 @@ var HourlyOutputChartComponent = ({
37218
37387
  flush(SHIFT_DURATION);
37219
37388
  return segments.filter((segment) => segment.end > segment.start);
37220
37389
  }, [SHIFT_DURATION, hasExplicitHourlyTargets, effectiveHourlyTargetOutput]);
37221
- const activeSkuHourIndices = React146__default.useMemo(() => {
37390
+ const activeSkuHourIndices = React147__default.useMemo(() => {
37222
37391
  const indices = /* @__PURE__ */ new Set();
37223
37392
  const targets = Array(SHIFT_DURATION).fill(pphThreshold);
37224
37393
  if (!skuSegments || !shiftWindow) return { indices, targets, hasTimeline: false };
@@ -37251,13 +37420,14 @@ var HourlyOutputChartComponent = ({
37251
37420
  }
37252
37421
  return { indices, targets, hasTimeline: true };
37253
37422
  }, [skuSegments, activeSkuId, shiftWindow, SHIFT_DURATION, pphThreshold]);
37254
- const chartData = React146__default.useMemo(() => {
37423
+ const chartData = React147__default.useMemo(() => {
37255
37424
  const { indices, targets, hasTimeline } = activeSkuHourIndices;
37256
37425
  return Array.from({ length: SHIFT_DURATION }, (_, i) => {
37257
37426
  const idleSlot = idleSlots[i];
37258
37427
  const explicitTarget = hasHourlyTargetOutputProp ? effectiveHourlyTargetOutput?.[i] ?? null : void 0;
37259
37428
  const currentTarget = hasHourlyTargetOutputProp ? explicitTarget : targets[i] || pphThreshold;
37260
37429
  const outputForComparison = Math.round(animatedData[i] || 0);
37430
+ const actualOutputForComparison = Math.round(data[i] || 0);
37261
37431
  const comparisonTarget = currentTarget === null || currentTarget === void 0 ? targets[i] || pphThreshold : currentTarget;
37262
37432
  const targetForComparison = Math.round(comparisonTarget);
37263
37433
  return {
@@ -37272,12 +37442,14 @@ var HourlyOutputChartComponent = ({
37272
37442
  idleMinutes: idleSlot?.idleMinutes || 0,
37273
37443
  idleArray: idleSlot?.idleArray || [],
37274
37444
  skuIndex: i,
37445
+ isSelected: selectedHourIndex === (idleSlot?.hourIndex ?? i),
37275
37446
  isHighlighted: indices.has(i),
37276
- isDimmed: hasTimeline && !!activeSkuId && !indices.has(i)
37447
+ isDimmed: hasTimeline && !!activeSkuId && !indices.has(i),
37448
+ status: actualOutputForComparison >= targetForComparison ? "met_target" : "below_target"
37277
37449
  };
37278
37450
  });
37279
- }, [animatedData, data, pphThreshold, idleSlots, SHIFT_DURATION, activeSkuHourIndices, activeSkuId, effectiveHourlyTargetOutput, hasHourlyTargetOutputProp]);
37280
- const renderSkuTimelineRail = React146__default.useCallback((props) => {
37451
+ }, [animatedData, data, pphThreshold, idleSlots, SHIFT_DURATION, activeSkuHourIndices, activeSkuId, effectiveHourlyTargetOutput, hasHourlyTargetOutputProp, selectedHourIndex]);
37452
+ const renderSkuTimelineRail = React147__default.useCallback((props) => {
37281
37453
  if (!skuTimelineSegments.length || SHIFT_DURATION <= 0) return null;
37282
37454
  const offset = props?.offset;
37283
37455
  if (!offset) return null;
@@ -37426,7 +37598,7 @@ var HourlyOutputChartComponent = ({
37426
37598
  })
37427
37599
  ] });
37428
37600
  }, [skuTimelineSegments, SHIFT_DURATION, activeSkuId]);
37429
- const IdleBar = React146__default.useMemo(() => {
37601
+ const IdleBar = React147__default.useMemo(() => {
37430
37602
  if (!idleBarState.visible) return null;
37431
37603
  return /* @__PURE__ */ jsx(
37432
37604
  Bar,
@@ -37520,7 +37692,7 @@ var HourlyOutputChartComponent = ({
37520
37692
  }
37521
37693
  return filteredTicks;
37522
37694
  };
37523
- const renderTargetLine = React146__default.useCallback((props) => {
37695
+ const renderTargetLine = React147__default.useCallback((props) => {
37524
37696
  const { offset, yAxisMap } = props;
37525
37697
  if (!offset || !yAxisMap || SHIFT_DURATION <= 0 || targetLineEndOffset <= 0) return null;
37526
37698
  const { left, width } = offset;
@@ -37724,84 +37896,163 @@ var HourlyOutputChartComponent = ({
37724
37896
  Tooltip,
37725
37897
  {
37726
37898
  cursor: { fill: "#f1f5f9" },
37899
+ shared: false,
37900
+ offset: -5,
37901
+ wrapperStyle: { pointerEvents: "auto", zIndex: 100 },
37902
+ active: isTooltipHovered ? true : void 0,
37903
+ isAnimationActive: false,
37727
37904
  contentStyle: { backgroundColor: "transparent", border: "none", padding: 0 },
37728
37905
  content: (props) => {
37729
- if (!props.active || !props.payload || props.payload.length === 0)
37906
+ const activeData = props.active && props.payload && props.payload.length > 0 ? props.payload[0].payload : null;
37907
+ const data2 = activeData || (isTooltipHovered ? lastTooltipDataRef.current : null);
37908
+ if (!data2)
37730
37909
  return null;
37731
- const data2 = props.payload[0].payload;
37910
+ if (activeData) {
37911
+ lastTooltipDataRef.current = activeData;
37912
+ }
37732
37913
  const idlePeriods = showIdleTime ? getHourlyIdlePeriods({
37733
37914
  idleArray: data2.idleArray,
37734
37915
  shiftStart,
37735
37916
  hourIndex: Number.isFinite(data2.hourIndex) ? data2.hourIndex : 0
37736
37917
  }) : [];
37737
- return /* @__PURE__ */ jsxs("div", { className: "bg-white/95 backdrop-blur-md border border-slate-200/60 shadow-xl shadow-slate-200/40 rounded-xl p-4 min-w-[240px] text-slate-700", children: [
37738
- /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between mb-4 pb-3 border-b border-slate-100", children: /* @__PURE__ */ jsx("p", { className: "font-semibold text-slate-900 text-sm tracking-tight", children: data2.timeRange }) }),
37739
- /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
37740
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
37741
- /* @__PURE__ */ jsx("span", { className: "text-sm text-slate-500 font-medium tracking-wide", children: "Output" }),
37742
- /* @__PURE__ */ jsxs("span", { className: "font-bold text-slate-900 text-sm", children: [
37743
- Math.round(data2.output),
37744
- " ",
37745
- /* @__PURE__ */ jsx("span", { className: "text-slate-400 font-normal text-xs ml-0.5", children: "units" })
37746
- ] })
37747
- ] }),
37748
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
37749
- /* @__PURE__ */ jsx("span", { className: "text-sm text-slate-500 font-medium tracking-wide", children: "Target" }),
37750
- /* @__PURE__ */ jsxs("span", { className: "font-bold text-slate-700 text-sm", children: [
37751
- Math.round(data2.target),
37752
- " ",
37753
- /* @__PURE__ */ jsx("span", { className: "text-slate-400 font-normal text-xs ml-0.5", children: "units" })
37754
- ] })
37755
- ] }),
37756
- showIdleTime && data2.idleMinutes > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
37757
- /* @__PURE__ */ jsx("div", { className: "pt-3 mt-3 border-t border-slate-100", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
37758
- /* @__PURE__ */ jsx("span", { className: "text-sm text-slate-500 font-medium tracking-wide", children: "Idle Time" }),
37759
- /* @__PURE__ */ jsxs("span", { className: "font-bold text-orange-600 text-sm flex items-center gap-1.5", children: [
37760
- /* @__PURE__ */ jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-orange-500 shadow-[0_0_6px_rgba(249,115,22,0.6)] animate-pulse" }),
37761
- data2.idleMinutes,
37762
- " ",
37763
- /* @__PURE__ */ jsx("span", { className: "text-orange-500/70 font-normal text-xs ml-0.5", children: "min" })
37764
- ] })
37765
- ] }) }),
37766
- idlePeriods.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-3 bg-slate-50/80 rounded-lg p-3 border border-slate-100/50", children: [
37767
- /* @__PURE__ */ jsx("p", { className: "font-semibold text-slate-400 text-[10px] mb-2.5 uppercase tracking-wider", children: "Idle Periods" }),
37768
- /* @__PURE__ */ jsx("div", { className: "space-y-2.5 max-h-32 overflow-y-auto pr-1 custom-scrollbar", children: idlePeriods.map((period, index) => {
37769
- return /* @__PURE__ */ jsxs(
37770
- "div",
37771
- {
37772
- className: "flex items-start gap-2.5 text-xs",
37773
- children: [
37774
- /* @__PURE__ */ jsx("div", { className: "mt-[5px] w-1.5 h-1.5 bg-orange-400 rounded-full flex-shrink-0 shadow-[0_0_4px_rgba(251,146,60,0.5)]" }),
37775
- /* @__PURE__ */ jsx("span", { className: "text-slate-700 font-medium tracking-tight", children: period.duration === 1 ? /* @__PURE__ */ jsxs(Fragment, { children: [
37776
- period.startTime,
37777
- " ",
37778
- /* @__PURE__ */ jsxs("span", { className: "text-slate-400 font-normal ml-1", children: [
37779
- "(",
37780
- period.duration,
37781
- "m)"
37782
- ] })
37783
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
37784
- period.startTime,
37785
- " ",
37786
- /* @__PURE__ */ jsx("span", { className: "text-slate-400 mx-0.5", children: "\u2192" }),
37787
- " ",
37788
- period.endTime,
37789
- " ",
37790
- /* @__PURE__ */ jsxs("span", { className: "text-slate-400 font-normal ml-1", children: [
37791
- "(",
37792
- period.duration,
37793
- "m)"
37794
- ] })
37795
- ] }) })
37796
- ]
37918
+ const tooltipHourIndex = Number.isFinite(data2.hourIndex) ? data2.hourIndex : 0;
37919
+ const { startTime, endTime } = buildHourClipFilterWindow({
37920
+ shiftStart,
37921
+ shiftEnd,
37922
+ hourIndex: tooltipHourIndex,
37923
+ slotCount: SHIFT_DURATION
37924
+ });
37925
+ const clickPayload = {
37926
+ hourIndex: tooltipHourIndex,
37927
+ timeRange: data2.timeRange,
37928
+ startTime,
37929
+ endTime,
37930
+ output: Math.round(data2.originalOutput || 0),
37931
+ target: data2.target,
37932
+ status: data2.status
37933
+ };
37934
+ return /* @__PURE__ */ jsx(
37935
+ "div",
37936
+ {
37937
+ className: "p-3 -m-3 pointer-events-auto",
37938
+ style: { cursor: "default" },
37939
+ onMouseEnter: () => {
37940
+ if (tooltipHoverTimeoutRef.current) {
37941
+ clearTimeout(tooltipHoverTimeoutRef.current);
37942
+ tooltipHoverTimeoutRef.current = null;
37943
+ }
37944
+ setIsTooltipHovered(true);
37945
+ },
37946
+ onMouseLeave: () => {
37947
+ if (tooltipHoverTimeoutRef.current) {
37948
+ clearTimeout(tooltipHoverTimeoutRef.current);
37949
+ }
37950
+ tooltipHoverTimeoutRef.current = setTimeout(() => {
37951
+ setIsTooltipHovered(false);
37952
+ tooltipHoverTimeoutRef.current = null;
37953
+ }, 120);
37954
+ },
37955
+ children: /* @__PURE__ */ jsxs("div", { className: "bg-white/95 backdrop-blur-md border border-slate-200/60 shadow-xl shadow-slate-200/40 rounded-xl p-4 min-w-[240px] text-slate-700 pointer-events-auto", children: [
37956
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-4 pb-3 border-b border-slate-100", children: [
37957
+ /* @__PURE__ */ jsx("p", { className: "font-semibold text-slate-900 text-sm tracking-tight", children: data2.timeRange }),
37958
+ onAiSummaryClick && /* @__PURE__ */ jsxs(
37959
+ "button",
37960
+ {
37961
+ onClick: (e) => {
37962
+ e.stopPropagation();
37963
+ onAiSummaryClick(clickPayload);
37964
+ },
37965
+ className: "flex items-center gap-1 px-2 py-1 -mr-1 rounded-md border border-slate-200 bg-white hover:bg-slate-50 text-[11px] font-medium text-slate-600 shadow-sm transition-colors",
37966
+ children: [
37967
+ /* @__PURE__ */ jsx(SparklesIcon, { className: "w-3.5 h-3.5" }),
37968
+ "Ask AI"
37969
+ ]
37970
+ }
37971
+ )
37972
+ ] }),
37973
+ /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
37974
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
37975
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-slate-500 font-medium tracking-wide", children: "Output" }),
37976
+ /* @__PURE__ */ jsxs("span", { className: "font-bold text-slate-900 text-sm", children: [
37977
+ Math.round(data2.output),
37978
+ " ",
37979
+ /* @__PURE__ */ jsx("span", { className: "text-slate-400 font-normal text-xs ml-0.5", children: "units" })
37980
+ ] })
37981
+ ] }),
37982
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
37983
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-slate-500 font-medium tracking-wide", children: "Target" }),
37984
+ /* @__PURE__ */ jsxs("span", { className: "font-bold text-slate-700 text-sm", children: [
37985
+ Math.round(data2.target),
37986
+ " ",
37987
+ /* @__PURE__ */ jsx("span", { className: "text-slate-400 font-normal text-xs ml-0.5", children: "units" })
37988
+ ] })
37989
+ ] }),
37990
+ showIdleTime && data2.idleMinutes > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
37991
+ /* @__PURE__ */ jsx("div", { className: "pt-3 mt-3 border-t border-slate-100", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
37992
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-slate-500 font-medium tracking-wide", children: "Idle Time" }),
37993
+ /* @__PURE__ */ jsxs("span", { className: "font-bold text-orange-600 text-sm flex items-center gap-1.5", children: [
37994
+ /* @__PURE__ */ jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-orange-500 shadow-[0_0_6px_rgba(249,115,22,0.6)] animate-pulse" }),
37995
+ data2.idleMinutes,
37996
+ " ",
37997
+ /* @__PURE__ */ jsx("span", { className: "text-orange-500/70 font-normal text-xs ml-0.5", children: "min" })
37998
+ ] })
37999
+ ] }) }),
38000
+ idlePeriods.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-3 bg-slate-50/80 rounded-lg p-3 border border-slate-100/50", children: [
38001
+ /* @__PURE__ */ jsx("p", { className: "font-semibold text-slate-400 text-[10px] mb-2.5 uppercase tracking-wider", children: "Idle Periods" }),
38002
+ /* @__PURE__ */ jsx("div", { className: "space-y-2.5 max-h-32 overflow-y-auto pr-1 custom-scrollbar", children: idlePeriods.map((period, index) => {
38003
+ return /* @__PURE__ */ jsxs(
38004
+ "div",
38005
+ {
38006
+ className: "flex items-start gap-2.5 text-xs",
38007
+ children: [
38008
+ /* @__PURE__ */ jsx("div", { className: "mt-[5px] w-1.5 h-1.5 bg-orange-400 rounded-full flex-shrink-0 shadow-[0_0_4px_rgba(251,146,60,0.5)]" }),
38009
+ /* @__PURE__ */ jsx("span", { className: "text-slate-700 font-medium tracking-tight", children: period.duration === 1 ? /* @__PURE__ */ jsxs(Fragment, { children: [
38010
+ period.startTime,
38011
+ " ",
38012
+ /* @__PURE__ */ jsxs("span", { className: "text-slate-400 font-normal ml-1", children: [
38013
+ "(",
38014
+ period.duration,
38015
+ "m)"
38016
+ ] })
38017
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
38018
+ period.startTime,
38019
+ " ",
38020
+ /* @__PURE__ */ jsx("span", { className: "text-slate-400 mx-0.5", children: "\u2192" }),
38021
+ " ",
38022
+ period.endTime,
38023
+ " ",
38024
+ /* @__PURE__ */ jsxs("span", { className: "text-slate-400 font-normal ml-1", children: [
38025
+ "(",
38026
+ period.duration,
38027
+ "m)"
38028
+ ] })
38029
+ ] }) })
38030
+ ]
38031
+ },
38032
+ index
38033
+ );
38034
+ }) })
38035
+ ] })
38036
+ ] }),
38037
+ onWatchClipsClick && /* @__PURE__ */ jsx("div", { className: "pt-3 mt-3 border-t border-slate-100 flex items-center", children: /* @__PURE__ */ jsxs(
38038
+ "button",
38039
+ {
38040
+ onClick: (e) => {
38041
+ e.stopPropagation();
38042
+ onWatchClipsClick(clickPayload);
37797
38043
  },
37798
- index
37799
- );
37800
- }) })
38044
+ className: "w-full rounded-md border border-slate-200 bg-white hover:bg-slate-50 px-2 py-1.5 text-xs font-semibold text-slate-700 transition-colors flex items-center justify-center gap-1.5 shadow-sm",
38045
+ children: [
38046
+ /* @__PURE__ */ jsx(PlayCircleIcon, { className: "w-4 h-4 text-blue-500" }),
38047
+ "Watch Clips"
38048
+ ]
38049
+ }
38050
+ ) }),
38051
+ onHourClick && !onWatchClipsClick && !onAiSummaryClick && /* @__PURE__ */ jsx("div", { className: "pt-3 mt-3 border-t border-slate-100", children: /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-blue-100 bg-blue-50/70 px-3 py-2 text-xs font-semibold text-blue-700 text-center", children: "Click to inspect hour" }) })
37801
38052
  ] })
37802
38053
  ] })
37803
- ] })
37804
- ] });
38054
+ }
38055
+ );
37805
38056
  },
37806
38057
  animationDuration: 200
37807
38058
  }
@@ -37822,14 +38073,14 @@ var HourlyOutputChartComponent = ({
37822
38073
  Cell,
37823
38074
  {
37824
38075
  fill: entry.color,
37825
- stroke: "transparent",
37826
- strokeWidth: 0,
38076
+ stroke: entry.isSelected ? "#0f172a" : "transparent",
38077
+ strokeWidth: entry.isSelected ? 2 : 0,
37827
38078
  style: {
37828
- filter: entry.isHighlighted ? "drop-shadow(0 4px 6px rgba(0, 0, 0, 0.12)) brightness(1.05)" : "brightness(1)",
37829
- transform: entry.isHighlighted ? "translateY(-4px)" : "translateY(0)",
38079
+ filter: entry.isHighlighted || entry.isSelected ? "drop-shadow(0 4px 6px rgba(0, 0, 0, 0.12)) brightness(1.05)" : "brightness(1)",
38080
+ transform: entry.isHighlighted || entry.isSelected ? "translateY(-4px)" : "translateY(0)",
37830
38081
  opacity: entry.isDimmed ? 0.4 : 1,
37831
38082
  transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
37832
- cursor: "pointer"
38083
+ cursor: onHourClick || onWatchClipsClick || onAiSummaryClick ? "pointer" : "default"
37833
38084
  },
37834
38085
  onMouseEnter: (e) => {
37835
38086
  const target = e.target;
@@ -37839,9 +38090,28 @@ var HourlyOutputChartComponent = ({
37839
38090
  },
37840
38091
  onMouseLeave: (e) => {
37841
38092
  const target = e.target;
37842
- target.style.filter = entry.isHighlighted ? "drop-shadow(0 4px 6px rgba(0, 0, 0, 0.12)) brightness(1.05)" : "brightness(1)";
37843
- target.style.transform = entry.isHighlighted ? "translateY(-4px)" : "translateY(0)";
38093
+ target.style.filter = entry.isHighlighted || entry.isSelected ? "drop-shadow(0 4px 6px rgba(0, 0, 0, 0.12)) brightness(1.05)" : "brightness(1)";
38094
+ target.style.transform = entry.isHighlighted || entry.isSelected ? "translateY(-4px)" : "translateY(0)";
37844
38095
  target.style.opacity = entry.isDimmed ? "0.4" : "1";
38096
+ },
38097
+ onClick: () => {
38098
+ if (!onHourClick && !onWatchClipsClick && !onAiSummaryClick) return;
38099
+ const { startTime, endTime } = buildHourClipFilterWindow({
38100
+ shiftStart,
38101
+ shiftEnd,
38102
+ hourIndex: entry.hourIndex,
38103
+ slotCount: SHIFT_DURATION
38104
+ });
38105
+ const payload = {
38106
+ hourIndex: entry.hourIndex,
38107
+ timeRange: entry.timeRange,
38108
+ startTime,
38109
+ endTime,
38110
+ output: Math.round(entry.originalOutput || 0),
38111
+ target: entry.target,
38112
+ status: entry.status
38113
+ };
38114
+ if (onHourClick) onHourClick(payload);
37845
38115
  }
37846
38116
  },
37847
38117
  `cell-${index}`
@@ -37923,10 +38193,10 @@ var HourlyOutputChartComponent = ({
37923
38193
  }
37924
38194
  );
37925
38195
  };
37926
- var HourlyOutputChart = React146__default.memo(
38196
+ var HourlyOutputChart = React147__default.memo(
37927
38197
  HourlyOutputChartComponent,
37928
38198
  (prevProps, nextProps) => {
37929
- if (prevProps.pphThreshold !== nextProps.pphThreshold || prevProps.shiftStart !== nextProps.shiftStart || prevProps.shiftEnd !== nextProps.shiftEnd || prevProps.shiftDate !== nextProps.shiftDate || prevProps.timezone !== nextProps.timezone || prevProps.showIdleTime !== nextProps.showIdleTime || prevProps.activeSkuId !== nextProps.activeSkuId || prevProps.className !== nextProps.className) {
38199
+ if (prevProps.pphThreshold !== nextProps.pphThreshold || prevProps.shiftStart !== nextProps.shiftStart || prevProps.shiftEnd !== nextProps.shiftEnd || prevProps.shiftDate !== nextProps.shiftDate || prevProps.timezone !== nextProps.timezone || prevProps.showIdleTime !== nextProps.showIdleTime || prevProps.activeSkuId !== nextProps.activeSkuId || prevProps.selectedHourIndex !== nextProps.selectedHourIndex || prevProps.onHourClick !== nextProps.onHourClick || prevProps.className !== nextProps.className) {
37930
38200
  return false;
37931
38201
  }
37932
38202
  if (prevProps.data.length !== nextProps.data.length) {
@@ -38377,7 +38647,7 @@ function getTrendArrowAndColor(trend) {
38377
38647
  return { arrow: "\u2192", color: "text-gray-400" };
38378
38648
  }
38379
38649
  }
38380
- var VideoCard = React146__default.memo(({
38650
+ var VideoCard = React147__default.memo(({
38381
38651
  workspace,
38382
38652
  hlsUrl,
38383
38653
  shouldPlay,
@@ -38647,7 +38917,7 @@ var hasRecentHealthSignal = (lastHeartbeat) => {
38647
38917
  if (!Number.isFinite(heartbeatMs)) return false;
38648
38918
  return Date.now() - heartbeatMs <= RECENT_HEALTH_SIGNAL_MS;
38649
38919
  };
38650
- var VideoGridView = React146__default.memo(({
38920
+ var VideoGridView = React147__default.memo(({
38651
38921
  workspaces,
38652
38922
  blueComparisonWorkspaces,
38653
38923
  selectedLine,
@@ -39086,7 +39356,7 @@ var VideoGridView = React146__default.memo(({
39086
39356
  ) });
39087
39357
  });
39088
39358
  VideoGridView.displayName = "VideoGridView";
39089
- var MapGridView = React146__default.memo(({
39359
+ var MapGridView = React147__default.memo(({
39090
39360
  workspaces,
39091
39361
  className = "",
39092
39362
  displayNames = {},
@@ -39307,13 +39577,13 @@ var WorkspaceMetricCardsImpl = ({
39307
39577
  liveSkuId
39308
39578
  }) => {
39309
39579
  const effectiveLegend = legend || DEFAULT_EFFICIENCY_LEGEND;
39310
- const activeSku = React146__default.useMemo(() => {
39580
+ const activeSku = React147__default.useMemo(() => {
39311
39581
  if (skuAware && activeSkuId && skuBreakdown) {
39312
39582
  return skuBreakdown.find((s) => s.sku_id === activeSkuId);
39313
39583
  }
39314
39584
  return null;
39315
39585
  }, [skuAware, activeSkuId, skuBreakdown]);
39316
- const displaySku = React146__default.useMemo(() => {
39586
+ const displaySku = React147__default.useMemo(() => {
39317
39587
  if (activeSku) return activeSku;
39318
39588
  if (skuAware && !activeSkuId && liveSkuId && skuBreakdown) {
39319
39589
  return skuBreakdown.find((s) => s.sku_id === liveSkuId) ?? null;
@@ -39966,7 +40236,7 @@ var UptimeLineChartComponent = ({ points, className = "" }) => {
39966
40236
  )
39967
40237
  ] }) }) });
39968
40238
  };
39969
- var UptimeLineChart = React146__default.memo(UptimeLineChartComponent);
40239
+ var UptimeLineChart = React147__default.memo(UptimeLineChartComponent);
39970
40240
  var getTimeFromTimeString = (timeStr) => {
39971
40241
  if (!timeStr) {
39972
40242
  return { hour: 0, minute: 0, decimalHour: 0 };
@@ -39990,10 +40260,10 @@ var HourlyUptimeChartComponent = ({
39990
40260
  shiftBreaks,
39991
40261
  className = ""
39992
40262
  }) => {
39993
- const containerRef = React146__default.useRef(null);
39994
- const [containerReady, setContainerReady] = React146__default.useState(false);
39995
- const [containerWidth, setContainerWidth] = React146__default.useState(0);
39996
- const uptimeSeries = React146__default.useMemo(() => buildUptimeSeries({
40263
+ const containerRef = React147__default.useRef(null);
40264
+ const [containerReady, setContainerReady] = React147__default.useState(false);
40265
+ const [containerWidth, setContainerWidth] = React147__default.useState(0);
40266
+ const uptimeSeries = React147__default.useMemo(() => buildUptimeSeries({
39997
40267
  idleTimeHourly,
39998
40268
  shiftStart,
39999
40269
  shiftEnd,
@@ -40003,11 +40273,11 @@ var HourlyUptimeChartComponent = ({
40003
40273
  shiftBreaks
40004
40274
  }), [idleTimeHourly, shiftStart, shiftEnd, shiftDate, timezone, elapsedMinutes, shiftBreaks]);
40005
40275
  const hasAggregateData = Boolean(hourlyAggregates && hourlyAggregates.length > 0);
40006
- const shiftStartTime = React146__default.useMemo(
40276
+ const shiftStartTime = React147__default.useMemo(
40007
40277
  () => getTimeFromTimeString(shiftStart),
40008
40278
  [shiftStart]
40009
40279
  );
40010
- const { shiftDuration, shiftEndTime } = React146__default.useMemo(() => {
40280
+ const { shiftDuration, shiftEndTime } = React147__default.useMemo(() => {
40011
40281
  if (!shiftEnd) {
40012
40282
  const fallbackHours = uptimeSeries.shiftMinutes > 0 ? Math.ceil(uptimeSeries.shiftMinutes / 60) : 0;
40013
40283
  return { shiftDuration: fallbackHours, shiftEndTime: null };
@@ -40021,7 +40291,7 @@ var HourlyUptimeChartComponent = ({
40021
40291
  const hourCount = hasPartial ? Math.ceil(duration) : Math.round(duration);
40022
40292
  return { shiftDuration: hourCount, shiftEndTime: endTime };
40023
40293
  }, [shiftEnd, shiftStartTime.decimalHour, uptimeSeries.shiftMinutes]);
40024
- const formatHour = React146__default.useCallback((hourIndex) => {
40294
+ const formatHour = React147__default.useCallback((hourIndex) => {
40025
40295
  const isLastHour = hourIndex === shiftDuration - 1;
40026
40296
  const startDecimalHour = shiftStartTime.decimalHour + hourIndex;
40027
40297
  const startHour = Math.floor(startDecimalHour) % 24;
@@ -40046,7 +40316,7 @@ var HourlyUptimeChartComponent = ({
40046
40316
  };
40047
40317
  return `${formatTime5(startHour, startMinute)}-${formatTime5(endHour, endMinute)}`;
40048
40318
  }, [shiftDuration, shiftStartTime.decimalHour, shiftEndTime]);
40049
- const formatTimeRange2 = React146__default.useCallback((hourIndex) => {
40319
+ const formatTimeRange2 = React147__default.useCallback((hourIndex) => {
40050
40320
  const isLastHour = hourIndex === shiftDuration - 1;
40051
40321
  const startDecimalHour = shiftStartTime.decimalHour + hourIndex;
40052
40322
  const startHour = Math.floor(startDecimalHour) % 24;
@@ -40068,7 +40338,7 @@ var HourlyUptimeChartComponent = ({
40068
40338
  };
40069
40339
  return `${formatTime5(startHour, startMinute)} - ${formatTime5(endHour, endMinute)}`;
40070
40340
  }, [shiftDuration, shiftStartTime.decimalHour, shiftEndTime]);
40071
- const chartData = React146__default.useMemo(() => {
40341
+ const chartData = React147__default.useMemo(() => {
40072
40342
  if (shiftDuration <= 0) return [];
40073
40343
  if (hasAggregateData) {
40074
40344
  return hourlyAggregates.map((entry, hourIndex) => ({
@@ -40110,7 +40380,7 @@ var HourlyUptimeChartComponent = ({
40110
40380
  }, [hasAggregateData, hourlyAggregates, uptimeSeries.points, uptimeSeries.elapsedMinutes, uptimeSeries.shiftMinutes, shiftDuration, formatHour, formatTimeRange2]);
40111
40381
  const maxYValue = 100;
40112
40382
  const yAxisTicks = [0, 25, 50, 75, 100];
40113
- React146__default.useEffect(() => {
40383
+ React147__default.useEffect(() => {
40114
40384
  const checkContainerDimensions = () => {
40115
40385
  if (containerRef.current) {
40116
40386
  const rect = containerRef.current.getBoundingClientRect();
@@ -40136,7 +40406,7 @@ var HourlyUptimeChartComponent = ({
40136
40406
  clearTimeout(fallbackTimeout);
40137
40407
  };
40138
40408
  }, []);
40139
- const xAxisConfig = React146__default.useMemo(() => {
40409
+ const xAxisConfig = React147__default.useMemo(() => {
40140
40410
  if (containerWidth >= 960) {
40141
40411
  return { interval: 0, angle: -45, height: 92, tickFont: 10, tickMargin: 12, labelMode: "full" };
40142
40412
  }
@@ -40145,7 +40415,7 @@ var HourlyUptimeChartComponent = ({
40145
40415
  }
40146
40416
  return { interval: 0, angle: -30, height: 64, tickFont: 9, tickMargin: 6, labelMode: "start" };
40147
40417
  }, [containerWidth]);
40148
- const formatXAxisTick = React146__default.useCallback((raw) => {
40418
+ const formatXAxisTick = React147__default.useCallback((raw) => {
40149
40419
  const label = typeof raw === "string" ? raw : String(raw);
40150
40420
  if (xAxisConfig.labelMode === "full") return label;
40151
40421
  const parts = label.split("-");
@@ -40351,7 +40621,7 @@ var HourlyUptimeChartComponent = ({
40351
40621
  }
40352
40622
  );
40353
40623
  };
40354
- var HourlyUptimeChart = React146__default.memo(HourlyUptimeChartComponent);
40624
+ var HourlyUptimeChart = React147__default.memo(HourlyUptimeChartComponent);
40355
40625
  var DEFAULT_COLORS2 = ["#00AB45", "#ef4444"];
40356
40626
  var UptimeDonutChartComponent = ({
40357
40627
  data,
@@ -40421,7 +40691,7 @@ var UptimeDonutChartComponent = ({
40421
40691
  ] }) })
40422
40692
  ] }) });
40423
40693
  };
40424
- var UptimeDonutChart = React146__default.memo(UptimeDonutChartComponent);
40694
+ var UptimeDonutChart = React147__default.memo(UptimeDonutChartComponent);
40425
40695
  UptimeDonutChart.displayName = "UptimeDonutChart";
40426
40696
  var TrendIcon = ({ trend }) => {
40427
40697
  if (trend === "up") {
@@ -40542,7 +40812,7 @@ var EmptyStateMessage = ({
40542
40812
  iconClassName
40543
40813
  }) => {
40544
40814
  let IconContent = null;
40545
- if (React146__default.isValidElement(iconType)) {
40815
+ if (React147__default.isValidElement(iconType)) {
40546
40816
  IconContent = iconType;
40547
40817
  } else if (typeof iconType === "string") {
40548
40818
  const MappedIcon = IconMap[iconType];
@@ -42898,7 +43168,7 @@ function Skeleton({ className, ...props }) {
42898
43168
  var Select = SelectPrimitive.Root;
42899
43169
  var SelectGroup = SelectPrimitive.Group;
42900
43170
  var SelectValue = SelectPrimitive.Value;
42901
- var SelectTrigger = React146.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
43171
+ var SelectTrigger = React147.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
42902
43172
  SelectPrimitive.Trigger,
42903
43173
  {
42904
43174
  ref,
@@ -42914,7 +43184,7 @@ var SelectTrigger = React146.forwardRef(({ className, children, ...props }, ref)
42914
43184
  }
42915
43185
  ));
42916
43186
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
42917
- var SelectScrollUpButton = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
43187
+ var SelectScrollUpButton = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
42918
43188
  SelectPrimitive.ScrollUpButton,
42919
43189
  {
42920
43190
  ref,
@@ -42924,7 +43194,7 @@ var SelectScrollUpButton = React146.forwardRef(({ className, ...props }, ref) =>
42924
43194
  }
42925
43195
  ));
42926
43196
  SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
42927
- var SelectScrollDownButton = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
43197
+ var SelectScrollDownButton = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
42928
43198
  SelectPrimitive.ScrollDownButton,
42929
43199
  {
42930
43200
  ref,
@@ -42934,7 +43204,7 @@ var SelectScrollDownButton = React146.forwardRef(({ className, ...props }, ref)
42934
43204
  }
42935
43205
  ));
42936
43206
  SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
42937
- var SelectContent = React146.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
43207
+ var SelectContent = React147.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
42938
43208
  SelectPrimitive.Content,
42939
43209
  {
42940
43210
  ref,
@@ -42962,7 +43232,7 @@ var SelectContent = React146.forwardRef(({ className, children, position = "popp
42962
43232
  }
42963
43233
  ) }));
42964
43234
  SelectContent.displayName = SelectPrimitive.Content.displayName;
42965
- var SelectLabel = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
43235
+ var SelectLabel = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
42966
43236
  SelectPrimitive.Label,
42967
43237
  {
42968
43238
  ref,
@@ -42971,7 +43241,7 @@ var SelectLabel = React146.forwardRef(({ className, ...props }, ref) => /* @__PU
42971
43241
  }
42972
43242
  ));
42973
43243
  SelectLabel.displayName = SelectPrimitive.Label.displayName;
42974
- var SelectItem = React146.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
43244
+ var SelectItem = React147.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
42975
43245
  SelectPrimitive.Item,
42976
43246
  {
42977
43247
  ref,
@@ -42987,7 +43257,7 @@ var SelectItem = React146.forwardRef(({ className, children, ...props }, ref) =>
42987
43257
  }
42988
43258
  ));
42989
43259
  SelectItem.displayName = SelectPrimitive.Item.displayName;
42990
- var SelectSeparator = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
43260
+ var SelectSeparator = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
42991
43261
  SelectPrimitive.Separator,
42992
43262
  {
42993
43263
  ref,
@@ -43613,7 +43883,7 @@ var TimePickerDropdown = ({
43613
43883
  )
43614
43884
  ] });
43615
43885
  };
43616
- var SilentErrorBoundary = class extends React146__default.Component {
43886
+ var SilentErrorBoundary = class extends React147__default.Component {
43617
43887
  constructor(props) {
43618
43888
  super(props);
43619
43889
  this.handleClearAndReload = () => {
@@ -44463,12 +44733,15 @@ var FileManagerFilters = ({
44463
44733
  prefetchedClipMetadata,
44464
44734
  activeCategoryLoading,
44465
44735
  idleClipSort = "latest",
44466
- onIdleClipSortChange
44736
+ onIdleClipSortChange,
44737
+ initialTimeFilter
44467
44738
  }) => {
44468
44739
  const [expandedNodes, setExpandedNodes] = useState(/* @__PURE__ */ new Set());
44469
- const [startTime, setStartTime] = useState("");
44470
- const [endTime, setEndTime] = useState("");
44471
- const [isTimeFilterActive, setIsTimeFilterActive] = useState(false);
44740
+ const [startTime, setStartTime] = useState(initialTimeFilter?.startTime ?? "");
44741
+ const [endTime, setEndTime] = useState(initialTimeFilter?.endTime ?? "");
44742
+ const [isTimeFilterActive, setIsTimeFilterActive] = useState(
44743
+ Boolean(initialTimeFilter?.startTime && initialTimeFilter?.endTime)
44744
+ );
44472
44745
  const [showTimeFilterModal, setShowTimeFilterModal] = useState(false);
44473
44746
  const [startSearchTerm, setStartSearchTerm] = useState("");
44474
44747
  const [endSearchTerm, setEndSearchTerm] = useState("");
@@ -44494,6 +44767,17 @@ var FileManagerFilters = ({
44494
44767
  useEffect(() => {
44495
44768
  clipMetadataRef.current = clipMetadata;
44496
44769
  }, [clipMetadata]);
44770
+ useEffect(() => {
44771
+ if (!initialTimeFilter?.startTime || !initialTimeFilter?.endTime) {
44772
+ return;
44773
+ }
44774
+ setStartTime(initialTimeFilter.startTime);
44775
+ setEndTime(initialTimeFilter.endTime);
44776
+ setIsTimeFilterActive(true);
44777
+ setShowTimeFilterModal(false);
44778
+ setStartSearchTerm("");
44779
+ setEndSearchTerm("");
44780
+ }, [initialTimeFilter?.startTime, initialTimeFilter?.endTime]);
44497
44781
  useEffect(() => {
44498
44782
  if (previousIdleClipSortRef.current === idleClipSort) {
44499
44783
  return;
@@ -46287,7 +46571,8 @@ var BottlenecksContent = ({
46287
46571
  customCounterContent,
46288
46572
  triageMode = false,
46289
46573
  ticketId,
46290
- prefetchedPercentileCounts
46574
+ prefetchedPercentileCounts,
46575
+ initialTimeFilter
46291
46576
  }) => {
46292
46577
  console.log("\u{1F3AB} [BottlenecksContent] Rendered with ticketId:", ticketId || "NONE", "workspaceId:", workspaceId, "date:", date, "shift:", shift);
46293
46578
  const dashboardConfig = useDashboardConfig();
@@ -48496,6 +48781,7 @@ var BottlenecksContent = ({
48496
48781
  activeCategoryLoading: isCategoryLoading,
48497
48782
  idleClipSort,
48498
48783
  onIdleClipSortChange: setIdleClipSort,
48784
+ initialTimeFilter,
48499
48785
  onFilterChange: (filterId) => {
48500
48786
  if (filterId !== "idle_time") {
48501
48787
  setIdleClipSort("latest");
@@ -50674,8 +50960,8 @@ var IdleTimeReasonChartComponent = ({
50674
50960
  updateAnimation = "replay",
50675
50961
  variant = "pie"
50676
50962
  }) => {
50677
- const [activeData, setActiveData] = React146__default.useState([]);
50678
- React146__default.useEffect(() => {
50963
+ const [activeData, setActiveData] = React147__default.useState([]);
50964
+ React147__default.useEffect(() => {
50679
50965
  if (updateAnimation === "smooth") {
50680
50966
  setActiveData(data && data.length > 0 ? data : []);
50681
50967
  return;
@@ -50694,7 +50980,7 @@ var IdleTimeReasonChartComponent = ({
50694
50980
  setActiveData([]);
50695
50981
  }
50696
50982
  }, [data, updateAnimation]);
50697
- React146__default.useEffect(() => {
50983
+ React147__default.useEffect(() => {
50698
50984
  if (!data || data.length === 0) return;
50699
50985
  data.forEach((entry, index) => {
50700
50986
  if (entry.name.toLowerCase().includes("other")) {
@@ -50702,7 +50988,7 @@ var IdleTimeReasonChartComponent = ({
50702
50988
  }
50703
50989
  });
50704
50990
  }, [data]);
50705
- const pieKey = React146__default.useMemo(() => {
50991
+ const pieKey = React147__default.useMemo(() => {
50706
50992
  if (updateAnimation === "smooth") {
50707
50993
  return "smooth";
50708
50994
  }
@@ -50872,7 +51158,7 @@ var IdleTimeReasonChartComponent = ({
50872
51158
  )
50873
51159
  ] });
50874
51160
  };
50875
- var IdleTimeReasonChart = React146__default.memo(IdleTimeReasonChartComponent);
51161
+ var IdleTimeReasonChart = React147__default.memo(IdleTimeReasonChartComponent);
50876
51162
  IdleTimeReasonChart.displayName = "IdleTimeReasonChart";
50877
51163
  var IdleTimeReasonChart_default = IdleTimeReasonChart;
50878
51164
 
@@ -55399,13 +55685,13 @@ var WorkspaceCycleTimeMetricCards = ({
55399
55685
  liveSkuId
55400
55686
  }) => {
55401
55687
  const effectiveLegend = legend || DEFAULT_EFFICIENCY_LEGEND;
55402
- const activeSku = React146__default.useMemo(() => {
55688
+ const activeSku = React147__default.useMemo(() => {
55403
55689
  if (skuAware && activeSkuId && skuBreakdown) {
55404
55690
  return skuBreakdown.find((s) => s.sku_id === activeSkuId);
55405
55691
  }
55406
55692
  return null;
55407
55693
  }, [skuAware, activeSkuId, skuBreakdown]);
55408
- const displaySku = React146__default.useMemo(() => {
55694
+ const displaySku = React147__default.useMemo(() => {
55409
55695
  if (activeSku) return activeSku;
55410
55696
  if (skuAware && !activeSkuId && liveSkuId && skuBreakdown) {
55411
55697
  return skuBreakdown.find((s) => s.sku_id === liveSkuId) ?? null;
@@ -55649,7 +55935,7 @@ var arePropsEqual = (prevProps, nextProps) => {
55649
55935
  return prevProps.data.efficiency === nextProps.data.efficiency && prevProps.data.trend_score === nextProps.data.trend_score && prevProps.data.workspace_id === nextProps.data.workspace_id && prevProps.data.workspace_name === nextProps.data.workspace_name && prevProps.isBottleneck === nextProps.isBottleneck && prevProps.isLowEfficiency === nextProps.isLowEfficiency && prevProps.isVeryLowEfficiency === nextProps.isVeryLowEfficiency && prevLegend.green_min === nextLegend.green_min && prevLegend.green_max === nextLegend.green_max && prevLegend.yellow_min === nextLegend.yellow_min && prevLegend.yellow_max === nextLegend.yellow_max && prevLegend.red_min === nextLegend.red_min && prevLegend.red_max === nextLegend.red_max && prevLegend.critical_threshold === nextLegend.critical_threshold && // Position doesn't need deep equality check as it's generally static
55650
55936
  prevProps.position.id === nextProps.position.id;
55651
55937
  };
55652
- var WorkspaceGridItem = React146__default.memo(({
55938
+ var WorkspaceGridItem = React147__default.memo(({
55653
55939
  data,
55654
55940
  position,
55655
55941
  isBottleneck = false,
@@ -55744,7 +56030,7 @@ var WorkspaceGridItem = React146__default.memo(({
55744
56030
  );
55745
56031
  }, arePropsEqual);
55746
56032
  WorkspaceGridItem.displayName = "WorkspaceGridItem";
55747
- var WorkspaceGrid = React146__default.memo(({
56033
+ var WorkspaceGrid = React147__default.memo(({
55748
56034
  workspaces,
55749
56035
  blueComparisonWorkspaces,
55750
56036
  isPdfMode = false,
@@ -55997,7 +56283,7 @@ var KPICard = ({
55997
56283
  }) => {
55998
56284
  useThemeConfig();
55999
56285
  const { formatNumber } = useFormatNumber();
56000
- const trendInfo = React146__default.useMemo(() => {
56286
+ const trendInfo = React147__default.useMemo(() => {
56001
56287
  let trendValue = trend || "neutral";
56002
56288
  if (change !== void 0 && trend === void 0) {
56003
56289
  trendValue = change > 0 ? "up" : change < 0 ? "down" : "neutral";
@@ -56024,7 +56310,7 @@ var KPICard = ({
56024
56310
  const shouldShowTrend = !(change === 0 && trend === void 0);
56025
56311
  return { trendValue, Icon: Icon2, colorClass, bgClass, shouldShowTrend };
56026
56312
  }, [trend, change]);
56027
- const formattedValue = React146__default.useMemo(() => {
56313
+ const formattedValue = React147__default.useMemo(() => {
56028
56314
  if (title === "Quality Compliance" && typeof value === "number") {
56029
56315
  return value.toFixed(1);
56030
56316
  }
@@ -56038,7 +56324,7 @@ var KPICard = ({
56038
56324
  }
56039
56325
  return value;
56040
56326
  }, [value, title]);
56041
- const formattedChange = React146__default.useMemo(() => {
56327
+ const formattedChange = React147__default.useMemo(() => {
56042
56328
  if (change === void 0 || change === 0 && !showZeroChange) return null;
56043
56329
  const absChange = Math.abs(change);
56044
56330
  return formatNumber(absChange, { minimumFractionDigits: 0, maximumFractionDigits: 1 });
@@ -57545,7 +57831,7 @@ var Breadcrumbs = ({ items }) => {
57545
57831
  }
57546
57832
  }
57547
57833
  };
57548
- return /* @__PURE__ */ jsx("nav", { "aria-label": "Breadcrumb", className: "mb-1 flex items-center space-x-1 text-xs font-medium text-gray-500 dark:text-gray-400", children: items.map((item, index) => /* @__PURE__ */ jsxs(React146__default.Fragment, { children: [
57834
+ return /* @__PURE__ */ jsx("nav", { "aria-label": "Breadcrumb", className: "mb-1 flex items-center space-x-1 text-xs font-medium text-gray-500 dark:text-gray-400", children: items.map((item, index) => /* @__PURE__ */ jsxs(React147__default.Fragment, { children: [
57549
57835
  index > 0 && /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3 text-gray-400 dark:text-gray-500" }),
57550
57836
  /* @__PURE__ */ jsxs(
57551
57837
  "span",
@@ -59069,7 +59355,7 @@ var AwardBadge = ({
59069
59355
  }) => {
59070
59356
  const styles2 = getBadgeStyles(type);
59071
59357
  const Icon2 = CustomIcon || getDefaultIcon(type);
59072
- const randomDelay = React146__default.useMemo(() => Math.random() * 2, []);
59358
+ const randomDelay = React147__default.useMemo(() => Math.random() * 2, []);
59073
59359
  const floatingAnimation = {
59074
59360
  animate: {
59075
59361
  y: [0, -10, 0],
@@ -67388,7 +67674,7 @@ function HomeView({
67388
67674
  animate: { opacity: 1, scale: 1 },
67389
67675
  transition: { duration: 0.3 },
67390
67676
  className: "h-full",
67391
- children: React146__default.createElement(WorkspaceGrid, {
67677
+ children: React147__default.createElement(WorkspaceGrid, {
67392
67678
  workspaces: workspaceMetricsWithBreakState,
67393
67679
  blueComparisonWorkspaces: currentBlueComparisonWorkspaceMetrics || workspaceMetricsWithBreakState,
67394
67680
  lineNames: mergedLineNames,
@@ -67421,7 +67707,7 @@ function HomeView({
67421
67707
  animate: { opacity: 1, scale: 1 },
67422
67708
  transition: { duration: 0.3 },
67423
67709
  className: "h-full",
67424
- children: React146__default.createElement(WorkspaceGrid, {
67710
+ children: React147__default.createElement(WorkspaceGrid, {
67425
67711
  workspaces: [],
67426
67712
  // Show empty grid while loading
67427
67713
  blueComparisonWorkspaces: [],
@@ -67468,7 +67754,7 @@ function HomeView({
67468
67754
  contentVariant: "plain"
67469
67755
  }
67470
67756
  ),
67471
- /* @__PURE__ */ jsx(AnimatePresence, { children: showAllGreenCelebration ? /* @__PURE__ */ jsxs(React146__default.Fragment, { children: [
67757
+ /* @__PURE__ */ jsx(AnimatePresence, { children: showAllGreenCelebration ? /* @__PURE__ */ jsxs(React147__default.Fragment, { children: [
67472
67758
  /* @__PURE__ */ jsx(
67473
67759
  motion.div,
67474
67760
  {
@@ -67547,7 +67833,7 @@ function HomeView({
67547
67833
  "all-green-center-toast"
67548
67834
  )
67549
67835
  ] }, "all-green-celebration") : null }),
67550
- /* @__PURE__ */ jsx(AnimatePresence, { children: greenStreakMilestoneBanner ? /* @__PURE__ */ jsxs(React146__default.Fragment, { children: [
67836
+ /* @__PURE__ */ jsx(AnimatePresence, { children: greenStreakMilestoneBanner ? /* @__PURE__ */ jsxs(React147__default.Fragment, { children: [
67551
67837
  /* @__PURE__ */ jsx(
67552
67838
  motion.div,
67553
67839
  {
@@ -67641,7 +67927,7 @@ function HomeView({
67641
67927
  }
67642
67928
  );
67643
67929
  }
67644
- var AuthenticatedHomeView = withAuth(React146__default.memo(HomeView));
67930
+ var AuthenticatedHomeView = withAuth(React147__default.memo(HomeView));
67645
67931
  var HomeView_default = HomeView;
67646
67932
  function withWorkspaceDisplayNames(Component3, options = {}) {
67647
67933
  const {
@@ -70907,7 +71193,7 @@ var KPI_FACTORY_QUERY_PARAM = "factory_id";
70907
71193
  var KPI_FACTORY_AREA_QUERY_PARAM = "factory_area_id";
70908
71194
  var getSingleQueryValue = (value) => typeof value === "string" && value.length > 0 ? value : void 0;
70909
71195
  var resolveCompanyId2 = (...candidates) => candidates.find(isNonEmptyString2);
70910
- var parseTimeToMinutes3 = (value) => {
71196
+ var parseTimeToMinutes4 = (value) => {
70911
71197
  if (!value) return null;
70912
71198
  const [hourStr, minuteStr] = value.split(":");
70913
71199
  const hour = Number.parseInt(hourStr ?? "", 10);
@@ -70919,8 +71205,8 @@ var getShiftEndDate = (shift, timezone) => {
70919
71205
  if (!shift?.date) return null;
70920
71206
  const startTime = shift.startTime || "06:00";
70921
71207
  const endTime = shift.endTime || "18:00";
70922
- const startMinutes = parseTimeToMinutes3(startTime);
70923
- const endMinutes = parseTimeToMinutes3(endTime);
71208
+ const startMinutes = parseTimeToMinutes4(startTime);
71209
+ const endMinutes = parseTimeToMinutes4(endTime);
70924
71210
  if (startMinutes === null || endMinutes === null) return null;
70925
71211
  const shiftStartDate = fromZonedTime(`${shift.date}T${startTime}:00`, timezone);
70926
71212
  let durationMinutes = endMinutes - startMinutes;
@@ -71050,18 +71336,18 @@ var LinesLeaderboard = ({
71050
71336
  isHistoricalDaily
71051
71337
  }) => {
71052
71338
  const formatEfficiency = (value) => typeof value === "number" && Number.isFinite(value) ? `${value.toFixed(1)}%` : "--";
71053
- const assignedLineIdSet = React146__default.useMemo(
71339
+ const assignedLineIdSet = React147__default.useMemo(
71054
71340
  () => new Set(assignedLineIds || []),
71055
71341
  [assignedLineIds]
71056
71342
  );
71057
- const canClickLine = React146__default.useCallback(
71343
+ const canClickLine = React147__default.useCallback(
71058
71344
  (lineId) => {
71059
71345
  if (!assignedLineIds) return true;
71060
71346
  return assignedLineIdSet.has(lineId);
71061
71347
  },
71062
71348
  [assignedLineIds, assignedLineIdSet]
71063
71349
  );
71064
- const handleTimeRangeChange = React146__default.useCallback((newRange) => {
71350
+ const handleTimeRangeChange = React147__default.useCallback((newRange) => {
71065
71351
  if (newRange === timeRange) return;
71066
71352
  trackCoreEvent("Leaderboard Time Range Changed", {
71067
71353
  from_range: timeRange,
@@ -71072,11 +71358,11 @@ var LinesLeaderboard = ({
71072
71358
  });
71073
71359
  setTimeRange(newRange);
71074
71360
  }, [timeRange, lines.length, monthlyEfficiencyByLineId, setTimeRange]);
71075
- const canClickLeaderboardRow = React146__default.useCallback(
71361
+ const canClickLeaderboardRow = React147__default.useCallback(
71076
71362
  (item) => item.rowType === "line" && !!item.line && canClickLine(item.line.id),
71077
71363
  [canClickLine]
71078
71364
  );
71079
- const handleLeaderboardLineClick = React146__default.useCallback((item, clickSource) => {
71365
+ const handleLeaderboardLineClick = React147__default.useCallback((item, clickSource) => {
71080
71366
  if (!canClickLeaderboardRow(item) || !item.line) return;
71081
71367
  trackCoreEvent("Leaderboard Line Clicked", {
71082
71368
  line_id: item.line.id,
@@ -71090,8 +71376,8 @@ var LinesLeaderboard = ({
71090
71376
  });
71091
71377
  onLineClick(item.line);
71092
71378
  }, [canClickLeaderboardRow, onLineClick, timeRange]);
71093
- const viewLoadedTrackedRef = React146__default.useRef(null);
71094
- const leaderboardData = React146__default.useMemo(() => {
71379
+ const viewLoadedTrackedRef = React147__default.useRef(null);
71380
+ const leaderboardData = React147__default.useMemo(() => {
71095
71381
  const loading = timeRange === "today" ? isLoadingToday : isLoadingMonthly;
71096
71382
  const efficiencyMap = timeRange === "today" ? todayEfficiencyByLineId : monthlyEfficiencyByLineId;
71097
71383
  const fallbackEfficiencyMap = timeRange === "today" ? dailyFallbackEfficiencyByLineId : void 0;
@@ -71135,7 +71421,7 @@ var LinesLeaderboard = ({
71135
71421
  isLoadingToday,
71136
71422
  isLoadingMonthly
71137
71423
  ]);
71138
- React146__default.useEffect(() => {
71424
+ React147__default.useEffect(() => {
71139
71425
  const isLoading = timeRange === "today" ? isLoadingToday : isLoadingMonthly;
71140
71426
  const trackingKey = `${timeRange}-${leaderboardData.length}`;
71141
71427
  if (leaderboardData.length > 0 && !isLoading && viewLoadedTrackedRef.current !== trackingKey) {
@@ -71161,7 +71447,7 @@ var LinesLeaderboard = ({
71161
71447
  const countdownFormat = timeRange === "monthly" ? "days" : "clock";
71162
71448
  const countdownFinishedLabel = timeRange === "monthly" ? "Finished" : "Shift Ended";
71163
71449
  const showCountdown = timeRange === "monthly" || !isHistoricalDaily;
71164
- const handleCountdownFinished = React146__default.useCallback(() => {
71450
+ const handleCountdownFinished = React147__default.useCallback(() => {
71165
71451
  trackCoreEvent("Leaderboard Countdown Finished", {
71166
71452
  countdown_type: timeRange === "monthly" ? "month_end" : "shift_end",
71167
71453
  time_range: timeRange,
@@ -71188,7 +71474,7 @@ var LinesLeaderboard = ({
71188
71474
  return "bg-white border-gray-100";
71189
71475
  }
71190
71476
  };
71191
- React146__default.useEffect(() => {
71477
+ React147__default.useEffect(() => {
71192
71478
  const style = document.createElement("style");
71193
71479
  style.innerHTML = `
71194
71480
  @keyframes float {
@@ -71690,36 +71976,36 @@ var KPIsOverviewView = ({
71690
71976
  const configuredTimezone = dbTimezone || dateTimeConfig.defaultTimezone || "UTC";
71691
71977
  const { startDate: monthStartDate, endDate: monthEndDateKey, monthEndDate } = getMonthDateInfo(configuredTimezone);
71692
71978
  const isSuperAdmin = user?.scope_mode === "SUPER_ADMIN" || !!user?.access_scope?.is_super_admin;
71693
- const scopedLineIds = React146__default.useMemo(
71979
+ const scopedLineIds = React147__default.useMemo(
71694
71980
  () => Array.isArray(user?.access_scope?.line_ids) ? user.access_scope.line_ids.filter((lineId) => typeof lineId === "string" && lineId.length > 0) : [],
71695
71981
  [user?.access_scope?.line_ids]
71696
71982
  );
71697
71983
  const hasCanonicalScope = !!user?.scope_mode || !!user?.access_scope;
71698
71984
  const scopeRole = (user?.role_level || user?.role || "").toLowerCase();
71699
71985
  const isStrictLineScopedRole = scopeRole === "supervisor" || isFactoryScopedRole(scopeRole);
71700
- const resolvedAssignedLineIds = React146__default.useMemo(() => {
71986
+ const resolvedAssignedLineIds = React147__default.useMemo(() => {
71701
71987
  if (isSuperAdmin) return [];
71702
71988
  if (scopedLineIds.length > 0) return scopedLineIds;
71703
71989
  if (lineIds && lineIds.length > 0) return lineIds;
71704
71990
  if (isStrictLineScopedRole && hasCanonicalScope) return [];
71705
71991
  return [];
71706
71992
  }, [isSuperAdmin, scopedLineIds, lineIds, isStrictLineScopedRole, hasCanonicalScope]);
71707
- const assignedLineIdSet = React146__default.useMemo(
71993
+ const assignedLineIdSet = React147__default.useMemo(
71708
71994
  () => new Set(resolvedAssignedLineIds),
71709
71995
  [resolvedAssignedLineIds]
71710
71996
  );
71711
- const loadedLineIds = React146__default.useMemo(
71997
+ const loadedLineIds = React147__default.useMemo(
71712
71998
  () => lines.map((line) => line.id).filter(Boolean),
71713
71999
  [lines]
71714
72000
  );
71715
- const metricsLineIds = React146__default.useMemo(() => {
72001
+ const metricsLineIds = React147__default.useMemo(() => {
71716
72002
  if (isSuperAdmin) {
71717
72003
  return loadedLineIds.length > 0 ? loadedLineIds : lineIds ?? [];
71718
72004
  }
71719
72005
  return resolvedAssignedLineIds;
71720
72006
  }, [isSuperAdmin, loadedLineIds, lineIds, resolvedAssignedLineIds]);
71721
72007
  const assignedLineIdsForLeaderboard = isSuperAdmin ? void 0 : resolvedAssignedLineIds;
71722
- const leaderboardLinesForView = React146__default.useMemo(() => {
72008
+ const leaderboardLinesForView = React147__default.useMemo(() => {
71723
72009
  const targetMode = viewType === "machine" ? "uptime" : "output";
71724
72010
  const metadataByLineId = new Map(lines.map((line) => [line.id, line]));
71725
72011
  return leaderboardLines.map((line) => {
@@ -71738,17 +72024,17 @@ var KPIsOverviewView = ({
71738
72024
  } : line;
71739
72025
  }).filter((line) => (line.monitoring_mode ?? "output") === targetMode);
71740
72026
  }, [leaderboardLines, lines, viewType]);
71741
- const linesForView = React146__default.useMemo(() => {
72027
+ const linesForView = React147__default.useMemo(() => {
71742
72028
  const targetMode = viewType === "machine" ? "uptime" : "output";
71743
72029
  return lines.filter((line) => (line.monitoring_mode ?? "output") === targetMode);
71744
72030
  }, [lines, viewType]);
71745
- const relevantLinesForMode = React146__default.useMemo(() => {
72031
+ const relevantLinesForMode = React147__default.useMemo(() => {
71746
72032
  if (activeTab === "leaderboard") {
71747
72033
  return leaderboardLines.length > 0 ? leaderboardLines : lines;
71748
72034
  }
71749
72035
  return lines;
71750
72036
  }, [activeTab, leaderboardLines, lines]);
71751
- const { hasUptime, hasOutput } = React146__default.useMemo(() => {
72037
+ const { hasUptime, hasOutput } = React147__default.useMemo(() => {
71752
72038
  let uptime = false;
71753
72039
  let output = false;
71754
72040
  for (const line of relevantLinesForMode) {
@@ -71773,14 +72059,14 @@ var KPIsOverviewView = ({
71773
72059
  const currentShiftDetails = getCurrentShift(configuredTimezone, shiftConfig);
71774
72060
  const currentShiftDate = currentShiftDetails.date;
71775
72061
  const currentShiftId = currentShiftDetails.shiftId;
71776
- const activeFiltersCount = React146__default.useMemo(() => {
72062
+ const activeFiltersCount = React147__default.useMemo(() => {
71777
72063
  let count = 0;
71778
72064
  if (leaderboardDailyScopeMode === "historical" && selectedLeaderboardShiftId !== currentShiftId) {
71779
72065
  count++;
71780
72066
  }
71781
72067
  return count;
71782
72068
  }, [leaderboardDailyScopeMode, selectedLeaderboardShiftId, currentShiftId]);
71783
- const clearFilters = React146__default.useCallback(() => {
72069
+ const clearFilters = React147__default.useCallback(() => {
71784
72070
  setSelectedLeaderboardShiftId(currentShiftId);
71785
72071
  setSelectedLeaderboardDate(currentShiftDate);
71786
72072
  setLeaderboardDailyScopeMode("live");
@@ -71796,11 +72082,11 @@ var KPIsOverviewView = ({
71796
72082
  document.addEventListener("mousedown", handleClickOutside);
71797
72083
  return () => document.removeEventListener("mousedown", handleClickOutside);
71798
72084
  }, []);
71799
- const shiftEndDate = React146__default.useMemo(
72085
+ const shiftEndDate = React147__default.useMemo(
71800
72086
  () => getShiftEndDate(currentShiftDetails, configuredTimezone),
71801
72087
  [currentShiftDetails, configuredTimezone]
71802
72088
  );
71803
- const leaderboardShiftOptions = React146__default.useMemo(() => {
72089
+ const leaderboardShiftOptions = React147__default.useMemo(() => {
71804
72090
  if (shiftConfig?.shifts && shiftConfig.shifts.length > 0) {
71805
72091
  return shiftConfig.shifts.map((shift) => ({
71806
72092
  id: shift.shiftId,
@@ -71817,34 +72103,34 @@ var KPIsOverviewView = ({
71817
72103
  const effectiveLeaderboardDate = selectedLeaderboardDate || currentShiftDate;
71818
72104
  const effectiveLeaderboardShiftId = Number.isFinite(selectedLeaderboardShiftId) ? selectedLeaderboardShiftId : currentShiftId;
71819
72105
  const isHistoricalLeaderboardDaily = activeTab === "leaderboard" && timeRange === "today" && leaderboardDailyScopeMode === "historical" && (effectiveLeaderboardDate !== currentShiftDate || effectiveLeaderboardShiftId !== currentShiftId);
71820
- const updateLeaderboardDate = React146__default.useCallback((dateKey) => {
72106
+ const updateLeaderboardDate = React147__default.useCallback((dateKey) => {
71821
72107
  setSelectedLeaderboardDate(dateKey);
71822
72108
  setLeaderboardDailyScopeMode(
71823
72109
  dateKey === currentShiftDate && effectiveLeaderboardShiftId === currentShiftId ? "live" : "historical"
71824
72110
  );
71825
72111
  }, [currentShiftDate, currentShiftId, effectiveLeaderboardShiftId]);
71826
- const updateLeaderboardShiftId = React146__default.useCallback((shiftId) => {
72112
+ const updateLeaderboardShiftId = React147__default.useCallback((shiftId) => {
71827
72113
  setSelectedLeaderboardShiftId(shiftId);
71828
72114
  setLeaderboardDailyScopeMode(
71829
72115
  effectiveLeaderboardDate === currentShiftDate && shiftId === currentShiftId ? "live" : "historical"
71830
72116
  );
71831
72117
  }, [currentShiftDate, currentShiftId, effectiveLeaderboardDate]);
71832
- const returnLeaderboardToLive = React146__default.useCallback(() => {
72118
+ const returnLeaderboardToLive = React147__default.useCallback(() => {
71833
72119
  setSelectedLeaderboardDate(currentShiftDate);
71834
72120
  setSelectedLeaderboardShiftId(currentShiftId);
71835
72121
  setLeaderboardDailyScopeMode("live");
71836
72122
  }, [currentShiftDate, currentShiftId]);
71837
72123
  const selectedFactoryIdFromUrl = getSingleQueryValue(router.query[KPI_FACTORY_QUERY_PARAM]);
71838
72124
  const selectedFactoryAreaIdFromUrl = getSingleQueryValue(router.query[KPI_FACTORY_AREA_QUERY_PARAM]);
71839
- const kpiLineHierarchy = React146__default.useMemo(
72125
+ const kpiLineHierarchy = React147__default.useMemo(
71840
72126
  () => buildKpiLineHierarchy(linesForView),
71841
72127
  [linesForView]
71842
72128
  );
71843
- const selectedFactoryNode = React146__default.useMemo(
72129
+ const selectedFactoryNode = React147__default.useMemo(
71844
72130
  () => kpiLineHierarchy.showFactoryLevel && selectedFactoryIdFromUrl ? kpiLineHierarchy.factories.find((factory) => factory.id === selectedFactoryIdFromUrl) : void 0,
71845
72131
  [kpiLineHierarchy, selectedFactoryIdFromUrl]
71846
72132
  );
71847
- const selectedFactoryAreaNode = React146__default.useMemo(
72133
+ const selectedFactoryAreaNode = React147__default.useMemo(
71848
72134
  () => selectedFactoryNode && selectedFactoryAreaIdFromUrl ? selectedFactoryNode.areas.find((area) => area.id === selectedFactoryAreaIdFromUrl) : void 0,
71849
72135
  [selectedFactoryNode, selectedFactoryAreaIdFromUrl]
71850
72136
  );
@@ -71933,15 +72219,15 @@ var KPIsOverviewView = ({
71933
72219
  lineId: factoryViewId,
71934
72220
  userAccessibleLineIds: metricsLineIds
71935
72221
  });
71936
- const defaultKPIs = React146__default.useMemo(() => createDefaultKPIs(), []);
71937
- const lineModeById = React146__default.useMemo(() => {
72222
+ const defaultKPIs = React147__default.useMemo(() => createDefaultKPIs(), []);
72223
+ const lineModeById = React147__default.useMemo(() => {
71938
72224
  const map = /* @__PURE__ */ new Map();
71939
72225
  linesForView.forEach((line) => {
71940
72226
  map.set(line.id, line.monitoring_mode ?? "output");
71941
72227
  });
71942
72228
  return map;
71943
72229
  }, [linesForView]);
71944
- const lineMetricRowsByLineId = React146__default.useMemo(() => {
72230
+ const lineMetricRowsByLineId = React147__default.useMemo(() => {
71945
72231
  const map = /* @__PURE__ */ new Map();
71946
72232
  lineMetrics.forEach((row) => {
71947
72233
  if (!row?.line_id) return;
@@ -71953,7 +72239,7 @@ var KPIsOverviewView = ({
71953
72239
  });
71954
72240
  return map;
71955
72241
  }, [lineMetrics, lineModeById]);
71956
- const liveDailyFallbackEfficiencyByLineId = React146__default.useMemo(() => {
72242
+ const liveDailyFallbackEfficiencyByLineId = React147__default.useMemo(() => {
71957
72243
  const map = /* @__PURE__ */ new Map();
71958
72244
  lineMetricRowsByLineId.forEach((row, lineId) => {
71959
72245
  const value = Number(row?.avg_efficiency);
@@ -71975,31 +72261,31 @@ var KPIsOverviewView = ({
71975
72261
  isHistoricalLeaderboardDaily,
71976
72262
  lineMetricRowsByLineId
71977
72263
  ]);
71978
- const dailyFallbackEfficiencyByLineId = React146__default.useMemo(() => {
72264
+ const dailyFallbackEfficiencyByLineId = React147__default.useMemo(() => {
71979
72265
  const map = new Map(liveDailyFallbackEfficiencyByLineId);
71980
72266
  scopedDailyFallbackEfficiencyByLineId.forEach((value, lineId) => {
71981
72267
  map.set(lineId, value);
71982
72268
  });
71983
72269
  return map;
71984
72270
  }, [liveDailyFallbackEfficiencyByLineId, scopedDailyFallbackEfficiencyByLineId]);
71985
- const kpisByLineId = React146__default.useMemo(() => {
72271
+ const kpisByLineId = React147__default.useMemo(() => {
71986
72272
  const map = /* @__PURE__ */ new Map();
71987
72273
  lineMetricRowsByLineId.forEach((row, lineId) => {
71988
72274
  map.set(lineId, buildKPIsFromLineMetricsRow(row));
71989
72275
  });
71990
72276
  return map;
71991
72277
  }, [lineMetricRowsByLineId]);
71992
- const getLineCardKpis = React146__default.useCallback((line) => {
72278
+ const getLineCardKpis = React147__default.useCallback((line) => {
71993
72279
  if (metricsError) return null;
71994
72280
  return kpisByLineId.get(line.id) ?? (metricsLoading ? null : defaultKPIs);
71995
72281
  }, [defaultKPIs, kpisByLineId, metricsError, metricsLoading]);
71996
- const getAggregateCardKpis = React146__default.useCallback((cardLines) => {
72282
+ const getAggregateCardKpis = React147__default.useCallback((cardLines) => {
71997
72283
  if (metricsError) return null;
71998
72284
  const rows = cardLines.map((line) => lineMetricRowsByLineId.get(line.id)).filter(Boolean);
71999
72285
  if (metricsLoading && rows.length === 0) return null;
72000
72286
  return aggregateKPIsFromLineMetricsRows(rows);
72001
72287
  }, [lineMetricRowsByLineId, metricsError, metricsLoading]);
72002
- const supervisorLineIds = React146__default.useMemo(
72288
+ const supervisorLineIds = React147__default.useMemo(
72003
72289
  () => (leaderboardLines.length > 0 ? leaderboardLines : lines).map((l) => l.id),
72004
72290
  [leaderboardLines, lines]
72005
72291
  );
@@ -72251,7 +72537,7 @@ var KPIsOverviewView = ({
72251
72537
  { shallow: true }
72252
72538
  );
72253
72539
  }, [router]);
72254
- const lineDetailReturnTo = React146__default.useMemo(() => {
72540
+ const lineDetailReturnTo = React147__default.useMemo(() => {
72255
72541
  if (activeTab !== "today" || !selectedFactoryNode) return void 0;
72256
72542
  return createKpisOverviewUrl({
72257
72543
  factoryId: selectedFactoryNode.id,
@@ -73051,7 +73337,7 @@ var LeaderboardDetailView = memo$1(({
73051
73337
  return () => document.removeEventListener("mousedown", handleClickOutside);
73052
73338
  }, []);
73053
73339
  const [isMobile, setIsMobile] = useState(false);
73054
- React146__default.useEffect(() => {
73340
+ React147__default.useEffect(() => {
73055
73341
  const checkMobile = () => setIsMobile(window.innerWidth < 640);
73056
73342
  checkMobile();
73057
73343
  window.addEventListener("resize", checkMobile);
@@ -77101,7 +77387,7 @@ var ShiftsView = ({
77101
77387
  ] })
77102
77388
  ] });
77103
77389
  };
77104
- var AuthenticatedShiftsView = withAuth(React146__default.memo(ShiftsView));
77390
+ var AuthenticatedShiftsView = withAuth(React147__default.memo(ShiftsView));
77105
77391
  var ShiftsView_default = ShiftsView;
77106
77392
 
77107
77393
  // src/views/TargetsView.utils.ts
@@ -78968,7 +79254,7 @@ var TargetsView = ({
78968
79254
  };
78969
79255
  var TargetsViewWithDisplayNames = withAllWorkspaceDisplayNames(TargetsView);
78970
79256
  var TargetsView_default = TargetsViewWithDisplayNames;
78971
- var AuthenticatedTargetsView = withAuth(React146__default.memo(TargetsViewWithDisplayNames));
79257
+ var AuthenticatedTargetsView = withAuth(React147__default.memo(TargetsViewWithDisplayNames));
78972
79258
  function useTimezone(options = {}) {
78973
79259
  const dashboardConfig = useDashboardConfig();
78974
79260
  const workspaceConfig = useWorkspaceConfig();
@@ -79097,6 +79383,147 @@ var getInitialTab = (sourceType, defaultTab, fromMonthly, urlDate) => {
79097
79383
  }
79098
79384
  return "overview";
79099
79385
  };
79386
+ var to12HourClock = (timeValue) => {
79387
+ const match = timeValue.trim().match(/^(\d{1,2}):(\d{2})$/);
79388
+ if (!match) return timeValue;
79389
+ const hour24 = Number.parseInt(match[1], 10);
79390
+ const minute = match[2];
79391
+ if (!Number.isFinite(hour24) || hour24 < 0 || hour24 > 23) return timeValue;
79392
+ const meridiem = hour24 >= 12 ? "PM" : "AM";
79393
+ const hour12 = hour24 % 12 || 12;
79394
+ return `${hour12}:${minute} ${meridiem}`;
79395
+ };
79396
+ var formatTimeRangeTo12Hour = (timeRange) => {
79397
+ const segments = timeRange.split(" - ").map((segment) => segment.trim());
79398
+ if (segments.length !== 2) return timeRange;
79399
+ return `${to12HourClock(segments[0])} - ${to12HourClock(segments[1])}`;
79400
+ };
79401
+ var formatWholeNumber = (value) => {
79402
+ if (typeof value !== "number" || !Number.isFinite(value)) return null;
79403
+ return Math.round(value).toLocaleString();
79404
+ };
79405
+ var formatSeconds = (value) => {
79406
+ if (typeof value !== "number" || !Number.isFinite(value)) return null;
79407
+ return `${value.toFixed(1)}s`;
79408
+ };
79409
+ var WorkspaceHourSummaryPanel = ({
79410
+ workspaceId,
79411
+ companyId,
79412
+ date,
79413
+ shiftId,
79414
+ selectedHour,
79415
+ clipsEnabled,
79416
+ onOpenClips,
79417
+ onClose,
79418
+ className = ""
79419
+ }) => {
79420
+ const { data, isLoading, error, summarize, reset } = useWorkspaceHourSummary();
79421
+ const selectedKey = selectedHour ? `${selectedHour.source}:${selectedHour.hourIndex}:${date}:${shiftId}` : "none";
79422
+ const autoSummaryKeyRef = React147__default.useRef(null);
79423
+ React147__default.useEffect(() => {
79424
+ reset();
79425
+ autoSummaryKeyRef.current = null;
79426
+ }, [reset, selectedKey]);
79427
+ const canSummarize = Boolean(workspaceId && companyId && date && shiftId !== null && shiftId !== void 0);
79428
+ React147__default.useEffect(() => {
79429
+ if (!selectedHour || !canSummarize || !companyId || !date || shiftId === null || shiftId === void 0) {
79430
+ return;
79431
+ }
79432
+ const requestKey = `${selectedKey}:${workspaceId}:${companyId}`;
79433
+ if (autoSummaryKeyRef.current === requestKey) {
79434
+ return;
79435
+ }
79436
+ autoSummaryKeyRef.current = requestKey;
79437
+ void summarize({
79438
+ workspaceId,
79439
+ companyId,
79440
+ date,
79441
+ shiftId,
79442
+ hourIndex: selectedHour.hourIndex,
79443
+ hourStart: selectedHour.startTime,
79444
+ hourEnd: selectedHour.endTime,
79445
+ forceRefresh: false,
79446
+ selectionSource: selectedHour.source ?? "unknown"
79447
+ }).catch(() => void 0);
79448
+ }, [canSummarize, companyId, date, selectedHour, selectedKey, shiftId, summarize, workspaceId]);
79449
+ if (!selectedHour) {
79450
+ return null;
79451
+ }
79452
+ const evidenceHour = data?.evidence?.hour ?? {};
79453
+ const verifiedTimeRange = typeof evidenceHour.timeRange === "string" && evidenceHour.timeRange ? evidenceHour.timeRange : selectedHour.timeRange;
79454
+ const formattedTimeRange = formatTimeRangeTo12Hour(verifiedTimeRange);
79455
+ const selectedMetric = selectedHour.source === "cycle" ? {
79456
+ label: "Cycle time",
79457
+ actual: formatSeconds(selectedHour.cycleTime),
79458
+ standard: formatSeconds(selectedHour.idealCycleTime)
79459
+ } : {
79460
+ label: "Hourly output",
79461
+ actual: formatWholeNumber(selectedHour.output),
79462
+ standard: formatWholeNumber(selectedHour.target)
79463
+ };
79464
+ return /* @__PURE__ */ jsxs("aside", { className: `rounded-lg border border-slate-200 bg-white shadow-sm ${className}`, children: [
79465
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3 border-b border-slate-100 p-4", children: [
79466
+ /* @__PURE__ */ jsxs("div", { children: [
79467
+ /* @__PURE__ */ jsx("div", { className: "text-[11px] font-semibold uppercase tracking-wide text-slate-500", children: "Selected hour" }),
79468
+ /* @__PURE__ */ jsx("h4", { className: "mt-1 text-base font-semibold text-slate-950", children: formattedTimeRange })
79469
+ ] }),
79470
+ /* @__PURE__ */ jsx(
79471
+ "button",
79472
+ {
79473
+ type: "button",
79474
+ onClick: onClose,
79475
+ className: "inline-flex h-8 w-8 items-center justify-center rounded-md text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-800",
79476
+ "aria-label": "Close hour inspector",
79477
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
79478
+ }
79479
+ )
79480
+ ] }),
79481
+ /* @__PURE__ */ jsxs("div", { className: "space-y-3 p-4", children: [
79482
+ selectedMetric.actual ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 text-sm", children: [
79483
+ /* @__PURE__ */ jsx("div", { className: "font-semibold text-slate-700", children: selectedMetric.label }),
79484
+ /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
79485
+ /* @__PURE__ */ jsxs("div", { className: "font-semibold text-slate-950", children: [
79486
+ /* @__PURE__ */ jsx("span", { children: selectedMetric.actual }),
79487
+ selectedMetric.standard ? /* @__PURE__ */ jsxs(Fragment, { children: [
79488
+ /* @__PURE__ */ jsx("span", { className: "mx-1 text-slate-400", children: "/" }),
79489
+ /* @__PURE__ */ jsx("span", { children: selectedMetric.standard })
79490
+ ] }) : null
79491
+ ] }),
79492
+ selectedMetric.standard ? /* @__PURE__ */ jsx("div", { className: "text-xs font-medium text-slate-500", children: "actual / standard" }) : null
79493
+ ] })
79494
+ ] }) : null,
79495
+ /* @__PURE__ */ jsxs("section", { className: "rounded-md border border-slate-200 bg-slate-50/70 p-3", children: [
79496
+ /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-slate-500", children: [
79497
+ /* @__PURE__ */ jsx(Sparkles, { className: "h-3.5 w-3.5" }),
79498
+ "AI summary"
79499
+ ] }),
79500
+ isLoading && !data ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-slate-600", children: [
79501
+ /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
79502
+ "Generating summary..."
79503
+ ] }) : data ? /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
79504
+ /* @__PURE__ */ jsx("h5", { className: "text-sm font-semibold text-slate-900", children: data.summary.headline }),
79505
+ /* @__PURE__ */ jsx("ul", { className: "space-y-1.5", children: data.summary.bullets.map((bullet, index) => /* @__PURE__ */ jsxs("li", { className: "text-sm leading-5 text-slate-700", children: [
79506
+ "\u2022 ",
79507
+ bullet
79508
+ ] }, `${index}-${bullet}`)) }),
79509
+ data.aiError ? /* @__PURE__ */ jsx("p", { className: "text-xs text-slate-500", children: "AI unavailable, showing deterministic summary." }) : null
79510
+ ] }) : error ? /* @__PURE__ */ jsx("p", { className: "text-sm text-red-700", children: "Could not summarize this hour. Please retry from the chart." }) : /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-600", children: "Preparing summary..." })
79511
+ ] }),
79512
+ clipsEnabled ? /* @__PURE__ */ jsx("div", { className: "pt-1", children: /* @__PURE__ */ jsxs(
79513
+ "button",
79514
+ {
79515
+ type: "button",
79516
+ onClick: () => onOpenClips(selectedHour),
79517
+ className: "inline-flex items-center gap-2 rounded-md border border-slate-300 bg-white px-3 py-2 text-sm font-semibold text-slate-700 transition-colors hover:bg-slate-50",
79518
+ children: [
79519
+ /* @__PURE__ */ jsx(ExternalLink, { className: "h-4 w-4" }),
79520
+ "Open clips from this hour"
79521
+ ]
79522
+ }
79523
+ ) }) : null
79524
+ ] })
79525
+ ] });
79526
+ };
79100
79527
  var DEBUG_DASHBOARD2 = process.env.NEXT_PUBLIC_DEBUG_DASHBOARD === "true";
79101
79528
  var chartCardVariants = {
79102
79529
  initial: { opacity: 0, y: 10 },
@@ -79189,16 +79616,108 @@ var WorkspaceDetailView = ({
79189
79616
  const initialTab = getInitialTab(sourceType, defaultTab, fromMonthly, date);
79190
79617
  const [activeTab, setActiveTab] = useState(initialTab);
79191
79618
  const [isTransitioning, setIsTransitioning] = useState(false);
79619
+ const [pendingClipHourFilter, setPendingClipHourFilter] = useState(null);
79192
79620
  const [usingFallbackData, setUsingFallbackData] = useState(false);
79193
79621
  const { isIdleTimeVlmEnabled } = useIdleTimeVlmConfig();
79194
79622
  const [showChartIdleTime, setShowChartIdleTime] = useState(false);
79195
79623
  const [selectedSkuId, setSelectedSkuId] = useState(null);
79624
+ const [selectedHour, setSelectedHour] = useState(null);
79196
79625
  const desktopTopSectionClass = "flex-[3] min-h-0";
79197
79626
  const desktopBottomSectionClass = "flex-[2] min-h-0";
79627
+ useEffect(() => {
79628
+ setSelectedHour(null);
79629
+ }, [workspaceId, date, shift]);
79198
79630
  const dashboardConfig = useDashboardConfig();
79199
79631
  const { legend: efficiencyLegend } = useEfficiencyLegend();
79200
79632
  const prewarmedClipsRef = useRef(/* @__PURE__ */ new Set());
79201
79633
  const prewarmInFlightRef = useRef(/* @__PURE__ */ new Set());
79634
+ const [aiSummaryHour, setAiSummaryHour] = useState(null);
79635
+ const buildHourlyOutputActionTrackingProps = useCallback((payload) => ({
79636
+ workspace_id: workspaceId,
79637
+ workspace_name: displayName,
79638
+ line_id: lineId || selectedLineId || null,
79639
+ company_id: dashboardConfig?.entityConfig?.companyId,
79640
+ date: date || null,
79641
+ shift_id: parsedShiftId ?? selectedShift,
79642
+ timezone,
79643
+ hour_index: payload.hourIndex,
79644
+ time_range: payload.timeRange,
79645
+ start_time: payload.startTime,
79646
+ end_time: payload.endTime,
79647
+ output: payload.output,
79648
+ target: payload.target,
79649
+ target_gap: payload.target === null ? null : payload.output - payload.target,
79650
+ status: payload.status,
79651
+ source: "workspace_detail_hourly_output_chart"
79652
+ }), [
79653
+ dashboardConfig?.entityConfig?.companyId,
79654
+ date,
79655
+ displayName,
79656
+ lineId,
79657
+ parsedShiftId,
79658
+ selectedLineId,
79659
+ selectedShift,
79660
+ timezone,
79661
+ workspaceId
79662
+ ]);
79663
+ const handleOutputHourSelect = useCallback((payload) => {
79664
+ setSelectedHour({
79665
+ source: "output",
79666
+ hourIndex: payload.hourIndex,
79667
+ timeRange: payload.timeRange,
79668
+ startTime: payload.startTime,
79669
+ endTime: payload.endTime,
79670
+ status: payload.status,
79671
+ output: payload.output,
79672
+ target: payload.target
79673
+ });
79674
+ }, []);
79675
+ const handleAiSummaryClick = useCallback((payload) => {
79676
+ trackCoreEvent("Hourly Output Ask AI Clicked", buildHourlyOutputActionTrackingProps(payload));
79677
+ setAiSummaryHour(payload);
79678
+ }, [buildHourlyOutputActionTrackingProps]);
79679
+ const handleCycleHourSelect = useCallback((payload) => {
79680
+ setSelectedHour({
79681
+ source: "cycle",
79682
+ hourIndex: payload.hourIndex,
79683
+ timeRange: payload.timeRange,
79684
+ startTime: payload.startTime,
79685
+ endTime: payload.endTime,
79686
+ status: payload.status,
79687
+ cycleTime: payload.cycleTime,
79688
+ idealCycleTime: payload.idealCycleTime,
79689
+ idleMinutes: payload.idleMinutes
79690
+ });
79691
+ }, []);
79692
+ const handleOpenClipsForHour = useCallback((hour) => {
79693
+ setPendingClipHourFilter({
79694
+ startTime: hour.startTime,
79695
+ endTime: hour.endTime,
79696
+ sourceLabel: hour.timeRange,
79697
+ status: hour.status === "below_target" || hour.status === "above_standard" ? "below_target" : "met_target"
79698
+ });
79699
+ setActiveTab("bottlenecks");
79700
+ }, []);
79701
+ const handleWatchClipsFromChart = useCallback((payload) => {
79702
+ trackCoreEvent("Hourly Output Watch Clips Clicked", buildHourlyOutputActionTrackingProps(payload));
79703
+ handleOpenClipsForHour({
79704
+ source: "output",
79705
+ hourIndex: payload.hourIndex,
79706
+ timeRange: payload.timeRange,
79707
+ startTime: payload.startTime,
79708
+ endTime: payload.endTime,
79709
+ status: payload.status,
79710
+ output: payload.output,
79711
+ target: payload.target
79712
+ });
79713
+ }, [buildHourlyOutputActionTrackingProps, handleOpenClipsForHour]);
79714
+ const handleCloseHourSummary = useCallback(() => {
79715
+ setSelectedHour(null);
79716
+ }, []);
79717
+ const handleManualClipsTabClick = useCallback(() => {
79718
+ setPendingClipHourFilter(null);
79719
+ setActiveTab("bottlenecks");
79720
+ }, []);
79202
79721
  const { trendSummary: workspaceMonthlyTrend } = useMonthlyTrend({
79203
79722
  entityType: "workspace",
79204
79723
  entityId: workspaceId,
@@ -79583,6 +80102,10 @@ var WorkspaceDetailView = ({
79583
80102
  const monitoringMode = workspace?.monitoring_mode ?? "output";
79584
80103
  const isUptimeMode = monitoringMode === "uptime";
79585
80104
  const idleTimeVlmEnabled = isIdleTimeVlmEnabled(resolvedLineId);
80105
+ const showHourSummaryPanel = Boolean(selectedHour && !isUptimeMode);
80106
+ const hourSummaryCompanyId = workspace?.company_id || dashboardConfig?.entityConfig?.companyId || null;
80107
+ const hourSummaryDate = workspace?.date || date || calculatedOperationalDate || null;
80108
+ const hourSummaryShiftId = workspace?.shift_id ?? parsedShiftId ?? null;
79586
80109
  useEffect(() => {
79587
80110
  if (!isClipsEnabled || !dashboardConfig?.s3Config || !workspaceId) {
79588
80111
  return;
@@ -80154,91 +80677,66 @@ var WorkspaceDetailView = ({
80154
80677
  )
80155
80678
  ] });
80156
80679
  }
80157
- return /* @__PURE__ */ jsx(
80680
+ return /* @__PURE__ */ jsxs(
80158
80681
  motion.div,
80159
80682
  {
80160
80683
  className: `min-h-screen bg-slate-50 ${className}`,
80161
80684
  initial: { opacity: 1 },
80162
80685
  animate: { opacity: 1 },
80163
- children: /* @__PURE__ */ jsxs("div", { className: "min-h-screen w-full flex flex-col bg-slate-50", children: [
80164
- /* @__PURE__ */ jsxs("header", { className: "sticky top-0 z-40 px-3 sm:px-4 md:px-5 lg:px-6 py-3 sm:py-3 lg:py-3.5 flex flex-col shadow-sm bg-white", children: [
80165
- /* @__PURE__ */ jsx("div", { className: "sm:hidden", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
80166
- /* @__PURE__ */ jsx(
80167
- "button",
80168
- {
80169
- onClick: handleBackNavigation,
80170
- className: "p-2 -ml-2 rounded-full active:bg-gray-100 transition-colors",
80171
- "aria-label": "Navigate back",
80172
- children: /* @__PURE__ */ jsx(ArrowLeft, { className: "w-5 h-5 text-gray-700" })
80173
- }
80174
- ),
80175
- /* @__PURE__ */ jsx("div", { className: "flex-1 flex flex-col items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
80176
- /* @__PURE__ */ jsx("h1", { className: "text-base font-semibold text-gray-900 truncate max-w-[220px]", children: formattedWorkspaceName }),
80177
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxs("div", { className: "relative flex h-2 w-2", children: [
80178
- isLive && /* @__PURE__ */ jsx("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75" }),
80179
- /* @__PURE__ */ jsx("span", { className: clsx(
80180
- "relative inline-flex rounded-full h-2 w-2",
80181
- isLive ? "bg-green-500" : "bg-red-500"
80182
- ) })
80183
- ] }) })
80184
- ] }) }),
80185
- /* @__PURE__ */ jsx("div", { className: "w-9" })
80186
- ] }) }),
80187
- /* @__PURE__ */ jsx("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsxs("div", { className: "relative flex items-center", children: [
80188
- /* @__PURE__ */ jsx("div", { className: "absolute left-0 z-10", children: /* @__PURE__ */ jsx(
80189
- BackButtonMinimal,
80190
- {
80191
- onClick: handleBackNavigation,
80192
- text: previousView === "line_monthly_history" ? "Back to Line History" : returnUrl && returnUrl.includes("monthly_history") ? "Back to Line History" : returnUrl && returnUrl.includes("/kpis/") ? "Back to KPIs" : returnUrl && returnUrl.includes("/leaderboard/") ? "Back to Leaderboard" : isHistoricView && activeTab !== "monthly_history" ? "Back to Monthly History" : "Back",
80193
- size: "default",
80194
- "aria-label": "Navigate back to previous page"
80195
- }
80196
- ) }),
80197
- /* @__PURE__ */ jsx("div", { className: "absolute left-1/2 transform -translate-x-1/2 max-w-[calc(100%-200px)]", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center gap-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
80198
- /* @__PURE__ */ jsx("h1", { className: "text-lg md:text-xl lg:text-2xl xl:text-3xl font-semibold text-gray-900 truncate", children: formattedWorkspaceName }),
80199
- /* @__PURE__ */ jsxs("div", { className: "relative flex h-2.5 w-2.5", children: [
80200
- isLive && /* @__PURE__ */ jsx("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75" }),
80201
- /* @__PURE__ */ jsx("span", { className: clsx(
80202
- "relative inline-flex rounded-full h-2.5 w-2.5",
80203
- isLive ? "bg-green-500" : "bg-red-500"
80204
- ) })
80205
- ] })
80206
- ] }) }) }),
80207
- activeTab !== "monthly_history" && /* @__PURE__ */ jsx("div", { className: "absolute right-0 top-0 flex flex-col items-end gap-1", children: workspaceHealth && /* @__PURE__ */ jsxs("span", { className: "text-xs text-gray-500", children: [
80208
- "Last update: ",
80209
- workspaceHealth.timeSinceLastUpdate
80686
+ children: [
80687
+ /* @__PURE__ */ jsxs("div", { className: "min-h-screen w-full flex flex-col bg-slate-50", children: [
80688
+ /* @__PURE__ */ jsxs("header", { className: "sticky top-0 z-40 px-3 sm:px-4 md:px-5 lg:px-6 py-3 sm:py-3 lg:py-3.5 flex flex-col shadow-sm bg-white", children: [
80689
+ /* @__PURE__ */ jsx("div", { className: "sm:hidden", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
80690
+ /* @__PURE__ */ jsx(
80691
+ "button",
80692
+ {
80693
+ onClick: handleBackNavigation,
80694
+ className: "p-2 -ml-2 rounded-full active:bg-gray-100 transition-colors",
80695
+ "aria-label": "Navigate back",
80696
+ children: /* @__PURE__ */ jsx(ArrowLeft, { className: "w-5 h-5 text-gray-700" })
80697
+ }
80698
+ ),
80699
+ /* @__PURE__ */ jsx("div", { className: "flex-1 flex flex-col items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
80700
+ /* @__PURE__ */ jsx("h1", { className: "text-base font-semibold text-gray-900 truncate max-w-[220px]", children: formattedWorkspaceName }),
80701
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxs("div", { className: "relative flex h-2 w-2", children: [
80702
+ isLive && /* @__PURE__ */ jsx("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75" }),
80703
+ /* @__PURE__ */ jsx("span", { className: clsx(
80704
+ "relative inline-flex rounded-full h-2 w-2",
80705
+ isLive ? "bg-green-500" : "bg-red-500"
80706
+ ) })
80707
+ ] }) })
80708
+ ] }) }),
80709
+ /* @__PURE__ */ jsx("div", { className: "w-9" })
80210
80710
  ] }) }),
80211
- /* @__PURE__ */ jsx("div", { className: "w-full h-8" })
80212
- ] }) }),
80213
- /* @__PURE__ */ jsx(Fragment, { children: activeTab === "monthly_history" ? /* @__PURE__ */ jsxs(Fragment, { children: [
80214
- /* @__PURE__ */ jsxs("div", { className: "sm:hidden mt-3 flex items-center justify-center gap-2", children: [
80215
- /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: (() => {
80216
- const monthBounds2 = getMonthKeyBounds(selectedYear, selectedMonth);
80217
- const normalizedRange = normalizeDateKeyRangeUnbounded(rangeStart, rangeEnd);
80218
- const startDate = parseDateKeyToDate(normalizedRange.startKey);
80219
- const endDate = parseDateKeyToDate(normalizedRange.endKey);
80220
- const isFullMonth = normalizedRange.startKey === monthBounds2.startKey && normalizedRange.endKey === monthBounds2.endKey;
80221
- if (isFullMonth) {
80222
- return `${startDate.toLocaleDateString("en-US", { month: "short", day: "numeric" })} - ${endDate.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`;
80711
+ /* @__PURE__ */ jsx("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsxs("div", { className: "relative flex items-center", children: [
80712
+ /* @__PURE__ */ jsx("div", { className: "absolute left-0 z-10", children: /* @__PURE__ */ jsx(
80713
+ BackButtonMinimal,
80714
+ {
80715
+ onClick: handleBackNavigation,
80716
+ text: previousView === "line_monthly_history" ? "Back to Line History" : returnUrl && returnUrl.includes("monthly_history") ? "Back to Line History" : returnUrl && returnUrl.includes("/kpis/") ? "Back to KPIs" : returnUrl && returnUrl.includes("/leaderboard/") ? "Back to Leaderboard" : isHistoricView && activeTab !== "monthly_history" ? "Back to Monthly History" : "Back",
80717
+ size: "default",
80718
+ "aria-label": "Navigate back to previous page"
80223
80719
  }
80224
- return `${startDate.toLocaleDateString("en-US", { month: "short", day: "numeric" })} - ${endDate.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`;
80225
- })() }) }),
80226
- /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center gap-1 px-2.5 py-1 bg-gray-100 rounded-full", children: [
80227
- /* @__PURE__ */ jsx("div", { className: "text-gray-700 scale-90", children: (() => {
80228
- const shift2 = shiftConfig?.shifts?.find((s) => s.shiftId === selectedShift);
80229
- const shiftName = shift2?.shiftName || (selectedShift === 0 ? "Day Shift" : "Night Shift");
80230
- return getShiftIcon2(shiftName);
80231
- })() }),
80232
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: (() => {
80233
- const shift2 = shiftConfig?.shifts?.find((s) => s.shiftId === selectedShift);
80234
- return shift2?.shiftName || (selectedShift === 0 ? "Day Shift" : "Night Shift");
80235
- })() })
80236
- ] })
80237
- ] }),
80238
- /* @__PURE__ */ jsx("div", { className: "hidden sm:block mt-3 bg-blue-50/50 px-4 py-2 rounded-xl border border-blue-100/50 backdrop-blur-sm", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-center gap-6", children: [
80239
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-600", children: [
80240
- /* @__PURE__ */ jsx("svg", { className: "w-4 h-4 opacity-70", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
80241
- /* @__PURE__ */ jsx("span", { className: "text-sm md:text-base font-medium", children: (() => {
80720
+ ) }),
80721
+ /* @__PURE__ */ jsx("div", { className: "absolute left-1/2 transform -translate-x-1/2 max-w-[calc(100%-200px)]", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center gap-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
80722
+ /* @__PURE__ */ jsx("h1", { className: "text-lg md:text-xl lg:text-2xl xl:text-3xl font-semibold text-gray-900 truncate", children: formattedWorkspaceName }),
80723
+ /* @__PURE__ */ jsxs("div", { className: "relative flex h-2.5 w-2.5", children: [
80724
+ isLive && /* @__PURE__ */ jsx("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75" }),
80725
+ /* @__PURE__ */ jsx("span", { className: clsx(
80726
+ "relative inline-flex rounded-full h-2.5 w-2.5",
80727
+ isLive ? "bg-green-500" : "bg-red-500"
80728
+ ) })
80729
+ ] })
80730
+ ] }) }) }),
80731
+ activeTab !== "monthly_history" && /* @__PURE__ */ jsx("div", { className: "absolute right-0 top-0 flex flex-col items-end gap-1", children: workspaceHealth && /* @__PURE__ */ jsxs("span", { className: "text-xs text-gray-500", children: [
80732
+ "Last update: ",
80733
+ workspaceHealth.timeSinceLastUpdate
80734
+ ] }) }),
80735
+ /* @__PURE__ */ jsx("div", { className: "w-full h-8" })
80736
+ ] }) }),
80737
+ /* @__PURE__ */ jsx(Fragment, { children: activeTab === "monthly_history" ? /* @__PURE__ */ jsxs(Fragment, { children: [
80738
+ /* @__PURE__ */ jsxs("div", { className: "sm:hidden mt-3 flex items-center justify-center gap-2", children: [
80739
+ /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: (() => {
80242
80740
  const monthBounds2 = getMonthKeyBounds(selectedYear, selectedMonth);
80243
80741
  const normalizedRange = normalizeDateKeyRangeUnbounded(rangeStart, rangeEnd);
80244
80742
  const startDate = parseDateKeyToDate(normalizedRange.startKey);
@@ -80248,107 +80746,106 @@ var WorkspaceDetailView = ({
80248
80746
  return `${startDate.toLocaleDateString("en-US", { month: "short", day: "numeric" })} - ${endDate.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`;
80249
80747
  }
80250
80748
  return `${startDate.toLocaleDateString("en-US", { month: "short", day: "numeric" })} - ${endDate.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`;
80251
- })() })
80252
- ] }),
80253
- /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" }),
80254
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-600", children: [
80255
- /* @__PURE__ */ jsx("div", { className: "opacity-70", children: (() => {
80256
- const shift2 = shiftConfig?.shifts?.find((s) => s.shiftId === selectedShift);
80257
- const shiftName = shift2?.shiftName || (selectedShift === 0 ? "Day Shift" : "Night Shift");
80258
- return getShiftIcon2(shiftName);
80259
- })() }),
80260
- /* @__PURE__ */ jsx("span", { className: "text-sm md:text-base font-semibold uppercase tracking-wider", children: (() => {
80261
- const shift2 = shiftConfig?.shifts?.find((s) => s.shiftId === selectedShift);
80262
- const name = shift2?.shiftName || (selectedShift === 0 ? "Day Shift" : "Night Shift");
80263
- return name.replace(/ Shift$/i, "") + " Shift";
80264
- })() })
80265
- ] })
80266
- ] }) })
80267
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
80268
- /* @__PURE__ */ jsxs("div", { className: "sm:hidden mt-3 flex items-center justify-center gap-2", children: [
80269
- /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: formatISTDate2(new Date(workspace.date)) }) }),
80270
- /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center gap-1 px-2.5 py-1 bg-gray-100 rounded-full", children: [
80271
- /* @__PURE__ */ jsx("div", { className: "text-gray-700 scale-90", children: getShiftIcon2(workspace.shift_type) }),
80272
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: workspace.shift_type })
80749
+ })() }) }),
80750
+ /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center gap-1 px-2.5 py-1 bg-gray-100 rounded-full", children: [
80751
+ /* @__PURE__ */ jsx("div", { className: "text-gray-700 scale-90", children: (() => {
80752
+ const shift2 = shiftConfig?.shifts?.find((s) => s.shiftId === selectedShift);
80753
+ const shiftName = shift2?.shiftName || (selectedShift === 0 ? "Day Shift" : "Night Shift");
80754
+ return getShiftIcon2(shiftName);
80755
+ })() }),
80756
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: (() => {
80757
+ const shift2 = shiftConfig?.shifts?.find((s) => s.shiftId === selectedShift);
80758
+ return shift2?.shiftName || (selectedShift === 0 ? "Day Shift" : "Night Shift");
80759
+ })() })
80760
+ ] })
80273
80761
  ] }),
80274
- !date && !shift && !usingFallbackData ? /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-green-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-green-700", children: /* @__PURE__ */ jsx(LiveTimer, {}) }) }) : date ? /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-blue-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-blue-700", children: getDaysDifference(workspace.date, timezone, dashboardConfig?.shiftConfig?.dayShift?.startTime || "06:00") }) }) : usingFallbackData ? /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-amber-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-amber-700", children: getDaysDifference(workspace.date, timezone, dashboardConfig?.shiftConfig?.dayShift?.startTime || "06:00") }) }) : null
80275
- ] }),
80276
- /* @__PURE__ */ jsx("div", { className: "hidden sm:block mt-3 bg-blue-50/50 px-4 py-2 rounded-xl border border-blue-100/50 backdrop-blur-sm", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-center gap-6", children: [
80277
- !date && !shift && !usingFallbackData && /* @__PURE__ */ jsxs(Fragment, { children: [
80278
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-700", children: [
80279
- /* @__PURE__ */ jsx("svg", { className: "w-4 h-4 opacity-70", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
80280
- /* @__PURE__ */ jsx("span", { className: "text-base font-semibold tabular-nums", children: /* @__PURE__ */ jsx(LiveTimer, {}) })
80762
+ /* @__PURE__ */ jsx("div", { className: "hidden sm:block mt-3 bg-blue-50/50 px-4 py-2 rounded-xl border border-blue-100/50 backdrop-blur-sm", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-center gap-6", children: [
80763
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-600", children: [
80764
+ /* @__PURE__ */ jsx("svg", { className: "w-4 h-4 opacity-70", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
80765
+ /* @__PURE__ */ jsx("span", { className: "text-sm md:text-base font-medium", children: (() => {
80766
+ const monthBounds2 = getMonthKeyBounds(selectedYear, selectedMonth);
80767
+ const normalizedRange = normalizeDateKeyRangeUnbounded(rangeStart, rangeEnd);
80768
+ const startDate = parseDateKeyToDate(normalizedRange.startKey);
80769
+ const endDate = parseDateKeyToDate(normalizedRange.endKey);
80770
+ const isFullMonth = normalizedRange.startKey === monthBounds2.startKey && normalizedRange.endKey === monthBounds2.endKey;
80771
+ if (isFullMonth) {
80772
+ return `${startDate.toLocaleDateString("en-US", { month: "short", day: "numeric" })} - ${endDate.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`;
80773
+ }
80774
+ return `${startDate.toLocaleDateString("en-US", { month: "short", day: "numeric" })} - ${endDate.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`;
80775
+ })() })
80281
80776
  ] }),
80282
- /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" })
80283
- ] }),
80284
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-600", children: [
80285
- /* @__PURE__ */ jsx("svg", { className: "w-4 h-4 opacity-70", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
80286
- /* @__PURE__ */ jsx("span", { className: "text-sm md:text-base font-medium", children: formatISTDate2(new Date(workspace.date)) })
80287
- ] }),
80288
- /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" }),
80289
- date && /* @__PURE__ */ jsxs(Fragment, { children: [
80290
- /* @__PURE__ */ jsx("span", { className: "px-2 py-1 text-xs font-medium bg-blue-100 text-blue-700 border border-blue-200 rounded-md", children: getDaysDifference(workspace.date, timezone, dashboardConfig?.shiftConfig?.dayShift?.startTime || "06:00") }),
80291
- /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" })
80292
- ] }),
80293
- !date && !shift && usingFallbackData && /* @__PURE__ */ jsxs(Fragment, { children: [
80294
- /* @__PURE__ */ jsxs("span", { className: "px-2 py-1 text-xs font-medium bg-amber-50 text-amber-700 border border-amber-200 rounded-md", children: [
80295
- "Latest available data (",
80296
- getDaysDifference(workspace.date, timezone, dashboardConfig?.shiftConfig?.dayShift?.startTime || "06:00"),
80297
- ")"
80777
+ /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" }),
80778
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-600", children: [
80779
+ /* @__PURE__ */ jsx("div", { className: "opacity-70", children: (() => {
80780
+ const shift2 = shiftConfig?.shifts?.find((s) => s.shiftId === selectedShift);
80781
+ const shiftName = shift2?.shiftName || (selectedShift === 0 ? "Day Shift" : "Night Shift");
80782
+ return getShiftIcon2(shiftName);
80783
+ })() }),
80784
+ /* @__PURE__ */ jsx("span", { className: "text-sm md:text-base font-semibold uppercase tracking-wider", children: (() => {
80785
+ const shift2 = shiftConfig?.shifts?.find((s) => s.shiftId === selectedShift);
80786
+ const name = shift2?.shiftName || (selectedShift === 0 ? "Day Shift" : "Night Shift");
80787
+ return name.replace(/ Shift$/i, "") + " Shift";
80788
+ })() })
80789
+ ] })
80790
+ ] }) })
80791
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
80792
+ /* @__PURE__ */ jsxs("div", { className: "sm:hidden mt-3 flex items-center justify-center gap-2", children: [
80793
+ /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: formatISTDate2(new Date(workspace.date)) }) }),
80794
+ /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center gap-1 px-2.5 py-1 bg-gray-100 rounded-full", children: [
80795
+ /* @__PURE__ */ jsx("div", { className: "text-gray-700 scale-90", children: getShiftIcon2(workspace.shift_type) }),
80796
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: workspace.shift_type })
80298
80797
  ] }),
80299
- /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" })
80798
+ !date && !shift && !usingFallbackData ? /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-green-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-green-700", children: /* @__PURE__ */ jsx(LiveTimer, {}) }) }) : date ? /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-blue-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-blue-700", children: getDaysDifference(workspace.date, timezone, dashboardConfig?.shiftConfig?.dayShift?.startTime || "06:00") }) }) : usingFallbackData ? /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-amber-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-amber-700", children: getDaysDifference(workspace.date, timezone, dashboardConfig?.shiftConfig?.dayShift?.startTime || "06:00") }) }) : null
80300
80799
  ] }),
80301
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-600", children: [
80302
- /* @__PURE__ */ jsx("div", { className: "opacity-70", children: getShiftIcon2(workspace.shift_type) }),
80303
- /* @__PURE__ */ jsxs("span", { className: "text-sm md:text-base font-semibold uppercase tracking-wider", children: [
80304
- workspace.shift_type.replace(/ Shift$/i, ""),
80305
- " Shift"
80800
+ /* @__PURE__ */ jsx("div", { className: "hidden sm:block mt-3 bg-blue-50/50 px-4 py-2 rounded-xl border border-blue-100/50 backdrop-blur-sm", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-center gap-6", children: [
80801
+ !date && !shift && !usingFallbackData && /* @__PURE__ */ jsxs(Fragment, { children: [
80802
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-700", children: [
80803
+ /* @__PURE__ */ jsx("svg", { className: "w-4 h-4 opacity-70", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
80804
+ /* @__PURE__ */ jsx("span", { className: "text-base font-semibold tabular-nums", children: /* @__PURE__ */ jsx(LiveTimer, {}) })
80805
+ ] }),
80806
+ /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" })
80807
+ ] }),
80808
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-600", children: [
80809
+ /* @__PURE__ */ jsx("svg", { className: "w-4 h-4 opacity-70", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
80810
+ /* @__PURE__ */ jsx("span", { className: "text-sm md:text-base font-medium", children: formatISTDate2(new Date(workspace.date)) })
80811
+ ] }),
80812
+ /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" }),
80813
+ date && /* @__PURE__ */ jsxs(Fragment, { children: [
80814
+ /* @__PURE__ */ jsx("span", { className: "px-2 py-1 text-xs font-medium bg-blue-100 text-blue-700 border border-blue-200 rounded-md", children: getDaysDifference(workspace.date, timezone, dashboardConfig?.shiftConfig?.dayShift?.startTime || "06:00") }),
80815
+ /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" })
80816
+ ] }),
80817
+ !date && !shift && usingFallbackData && /* @__PURE__ */ jsxs(Fragment, { children: [
80818
+ /* @__PURE__ */ jsxs("span", { className: "px-2 py-1 text-xs font-medium bg-amber-50 text-amber-700 border border-amber-200 rounded-md", children: [
80819
+ "Latest available data (",
80820
+ getDaysDifference(workspace.date, timezone, dashboardConfig?.shiftConfig?.dayShift?.startTime || "06:00"),
80821
+ ")"
80822
+ ] }),
80823
+ /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" })
80824
+ ] }),
80825
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-600", children: [
80826
+ /* @__PURE__ */ jsx("div", { className: "opacity-70", children: getShiftIcon2(workspace.shift_type) }),
80827
+ /* @__PURE__ */ jsxs("span", { className: "text-sm md:text-base font-semibold uppercase tracking-wider", children: [
80828
+ workspace.shift_type.replace(/ Shift$/i, ""),
80829
+ " Shift"
80830
+ ] })
80306
80831
  ] })
80307
- ] })
80308
- ] }) })
80309
- ] }) }),
80310
- /* @__PURE__ */ jsxs("div", { className: "mt-2 sm:mt-1.5 lg:mt-2", children: [
80311
- /* @__PURE__ */ jsx("div", { className: "sm:hidden", children: /* @__PURE__ */ jsxs("div", { className: "flex bg-gray-100 rounded-lg p-0.5", children: [
80312
- /* @__PURE__ */ jsx(
80313
- "button",
80314
- {
80315
- onClick: () => setActiveTab("overview"),
80316
- className: `flex-1 px-2 py-1.5 text-xs font-medium rounded-md transition-all duration-200 ${activeTab === "overview" ? "bg-white text-gray-900 shadow-sm" : "text-gray-600"}`,
80317
- children: overviewTabLabel
80318
- }
80319
- ),
80320
- isClipsEnabled && /* @__PURE__ */ jsx(
80321
- "button",
80322
- {
80323
- onClick: () => setActiveTab("bottlenecks"),
80324
- className: `flex-1 px-2 py-1.5 text-xs font-medium rounded-md transition-all duration-200 ${activeTab === "bottlenecks" ? "bg-white text-gray-900 shadow-sm" : "text-gray-600"}`,
80325
- children: "Clips"
80326
- }
80327
- ),
80328
- /* @__PURE__ */ jsx(
80329
- "button",
80330
- {
80331
- onClick: () => setActiveTab("monthly_history"),
80332
- className: `flex-1 px-2 py-1.5 text-xs font-medium rounded-md transition-all duration-200 ${activeTab === "monthly_history" ? "bg-white text-gray-900 shadow-sm" : "text-gray-600"}`,
80333
- children: "History"
80334
- }
80335
- )
80832
+ ] }) })
80336
80833
  ] }) }),
80337
- /* @__PURE__ */ jsxs("div", { className: "hidden sm:flex items-center justify-between", children: [
80338
- /* @__PURE__ */ jsxs("div", { className: "flex gap-1.5 lg:gap-2", children: [
80834
+ /* @__PURE__ */ jsxs("div", { className: "mt-2 sm:mt-1.5 lg:mt-2", children: [
80835
+ /* @__PURE__ */ jsx("div", { className: "sm:hidden", children: /* @__PURE__ */ jsxs("div", { className: "flex bg-gray-100 rounded-lg p-0.5", children: [
80339
80836
  /* @__PURE__ */ jsx(
80340
80837
  "button",
80341
80838
  {
80342
80839
  onClick: () => setActiveTab("overview"),
80343
- className: `px-2 lg:px-3 py-1 lg:py-1.5 text-sm lg:text-base font-medium rounded-lg transition-colors whitespace-nowrap ${activeTab === "overview" ? "bg-blue-50 text-blue-600" : "text-gray-600 hover:bg-gray-50"}`,
80840
+ className: `flex-1 px-2 py-1.5 text-xs font-medium rounded-md transition-all duration-200 ${activeTab === "overview" ? "bg-white text-gray-900 shadow-sm" : "text-gray-600"}`,
80344
80841
  children: overviewTabLabel
80345
80842
  }
80346
80843
  ),
80347
80844
  isClipsEnabled && /* @__PURE__ */ jsx(
80348
80845
  "button",
80349
80846
  {
80350
- onClick: () => setActiveTab("bottlenecks"),
80351
- className: `px-2 lg:px-3 py-1 lg:py-1.5 text-sm lg:text-base font-medium rounded-lg transition-colors whitespace-nowrap ${activeTab === "bottlenecks" ? "bg-blue-50 text-blue-600" : "text-gray-600 hover:bg-gray-50"}`,
80847
+ onClick: handleManualClipsTabClick,
80848
+ className: `flex-1 px-2 py-1.5 text-xs font-medium rounded-md transition-all duration-200 ${activeTab === "bottlenecks" ? "bg-white text-gray-900 shadow-sm" : "text-gray-600"}`,
80352
80849
  children: "Clips"
80353
80850
  }
80354
80851
  ),
@@ -80356,280 +80853,153 @@ var WorkspaceDetailView = ({
80356
80853
  "button",
80357
80854
  {
80358
80855
  onClick: () => setActiveTab("monthly_history"),
80359
- className: `px-2 lg:px-3 py-1 lg:py-1.5 text-sm lg:text-base font-medium rounded-lg transition-colors whitespace-nowrap ${activeTab === "monthly_history" ? "bg-blue-50 text-blue-600" : "text-gray-600 hover:bg-gray-50"}`,
80360
- children: "Monthly History"
80856
+ className: `flex-1 px-2 py-1.5 text-xs font-medium rounded-md transition-all duration-200 ${activeTab === "monthly_history" ? "bg-white text-gray-900 shadow-sm" : "text-gray-600"}`,
80857
+ children: "History"
80361
80858
  }
80362
80859
  )
80363
- ] }),
80364
- activeTab === "overview" && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1.5 lg:gap-2", children: renderHeaderActions ? renderHeaderActions(workspace) : /* @__PURE__ */ jsx(
80365
- WorkspacePdfGenerator,
80366
- {
80367
- workspace,
80368
- idleTimeReasons: idleTimeChartData,
80369
- efficiencyLegend,
80370
- hourlyCycleTimes: cycleTimeChartData,
80371
- shiftBreaks: shiftConfig?.shifts?.find((shift2) => shift2.shiftId === workspace.shift_id)?.breaks || [],
80372
- reportTimezone: shiftConfig?.timezone || timezone
80373
- }
80374
- ) }),
80375
- activeTab === "monthly_history" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
80376
- /* @__PURE__ */ jsx(
80377
- MonthlyRangeFilter_default,
80378
- {
80379
- month: selectedMonth,
80380
- year: selectedYear,
80381
- timezone,
80382
- value: { startKey: rangeStart, endKey: rangeEnd },
80383
- onChange: (nextRange) => {
80384
- const startDate = parseDateKeyToDate(nextRange.startKey);
80385
- const nextMonth = startDate.getMonth();
80386
- const nextYear = startDate.getFullYear();
80387
- setRangeStart(nextRange.startKey);
80388
- setRangeEnd(nextRange.endKey);
80389
- if (nextMonth !== selectedMonth || nextYear !== selectedYear) {
80390
- setSelectedMonth(nextMonth);
80391
- setSelectedYear(nextYear);
80392
- }
80393
- },
80394
- showLabel: false
80395
- }
80396
- ),
80397
- /* @__PURE__ */ jsx(
80398
- WorkspaceMonthlyPdfGenerator,
80860
+ ] }) }),
80861
+ /* @__PURE__ */ jsxs("div", { className: "hidden sm:flex items-center justify-between", children: [
80862
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-1.5 lg:gap-2", children: [
80863
+ /* @__PURE__ */ jsx(
80864
+ "button",
80865
+ {
80866
+ onClick: () => setActiveTab("overview"),
80867
+ className: `px-2 lg:px-3 py-1 lg:py-1.5 text-sm lg:text-base font-medium rounded-lg transition-colors whitespace-nowrap ${activeTab === "overview" ? "bg-blue-50 text-blue-600" : "text-gray-600 hover:bg-gray-50"}`,
80868
+ children: overviewTabLabel
80869
+ }
80870
+ ),
80871
+ isClipsEnabled && /* @__PURE__ */ jsx(
80872
+ "button",
80873
+ {
80874
+ onClick: handleManualClipsTabClick,
80875
+ className: `px-2 lg:px-3 py-1 lg:py-1.5 text-sm lg:text-base font-medium rounded-lg transition-colors whitespace-nowrap ${activeTab === "bottlenecks" ? "bg-blue-50 text-blue-600" : "text-gray-600 hover:bg-gray-50"}`,
80876
+ children: "Clips"
80877
+ }
80878
+ ),
80879
+ /* @__PURE__ */ jsx(
80880
+ "button",
80881
+ {
80882
+ onClick: () => setActiveTab("monthly_history"),
80883
+ className: `px-2 lg:px-3 py-1 lg:py-1.5 text-sm lg:text-base font-medium rounded-lg transition-colors whitespace-nowrap ${activeTab === "monthly_history" ? "bg-blue-50 text-blue-600" : "text-gray-600 hover:bg-gray-50"}`,
80884
+ children: "Monthly History"
80885
+ }
80886
+ )
80887
+ ] }),
80888
+ activeTab === "overview" && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1.5 lg:gap-2", children: renderHeaderActions ? renderHeaderActions(workspace) : /* @__PURE__ */ jsx(
80889
+ WorkspacePdfGenerator,
80399
80890
  {
80400
- workspaceId,
80401
- workspaceName: formattedWorkspaceName,
80402
- lineName: resolvedLineName,
80403
- monthlyData,
80404
- analysisData: analysisMonthlyData,
80405
- selectedMonth,
80406
- selectedYear,
80407
- monitoringMode: workspace?.monitoring_mode,
80408
- rangeStart,
80409
- rangeEnd,
80410
- selectedShiftId: selectedShift,
80411
- availableShifts: shiftConfig?.shifts?.map((s) => ({ id: s.shiftId, name: s.shiftName })),
80412
- shiftConfig,
80891
+ workspace,
80892
+ idleTimeReasons: idleTimeChartData,
80413
80893
  efficiencyLegend,
80414
- trendSummary: workspaceMonthlyTrend,
80415
- compact: true,
80416
- isAssemblyWorkspace
80894
+ hourlyCycleTimes: cycleTimeChartData,
80895
+ shiftBreaks: shiftConfig?.shifts?.find((shift2) => shift2.shiftId === workspace.shift_id)?.breaks || [],
80896
+ reportTimezone: shiftConfig?.timezone || timezone
80417
80897
  }
80418
- )
80898
+ ) }),
80899
+ activeTab === "monthly_history" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
80900
+ /* @__PURE__ */ jsx(
80901
+ MonthlyRangeFilter_default,
80902
+ {
80903
+ month: selectedMonth,
80904
+ year: selectedYear,
80905
+ timezone,
80906
+ value: { startKey: rangeStart, endKey: rangeEnd },
80907
+ onChange: (nextRange) => {
80908
+ const startDate = parseDateKeyToDate(nextRange.startKey);
80909
+ const nextMonth = startDate.getMonth();
80910
+ const nextYear = startDate.getFullYear();
80911
+ setRangeStart(nextRange.startKey);
80912
+ setRangeEnd(nextRange.endKey);
80913
+ if (nextMonth !== selectedMonth || nextYear !== selectedYear) {
80914
+ setSelectedMonth(nextMonth);
80915
+ setSelectedYear(nextYear);
80916
+ }
80917
+ },
80918
+ showLabel: false
80919
+ }
80920
+ ),
80921
+ /* @__PURE__ */ jsx(
80922
+ WorkspaceMonthlyPdfGenerator,
80923
+ {
80924
+ workspaceId,
80925
+ workspaceName: formattedWorkspaceName,
80926
+ lineName: resolvedLineName,
80927
+ monthlyData,
80928
+ analysisData: analysisMonthlyData,
80929
+ selectedMonth,
80930
+ selectedYear,
80931
+ monitoringMode: workspace?.monitoring_mode,
80932
+ rangeStart,
80933
+ rangeEnd,
80934
+ selectedShiftId: selectedShift,
80935
+ availableShifts: shiftConfig?.shifts?.map((s) => ({ id: s.shiftId, name: s.shiftName })),
80936
+ shiftConfig,
80937
+ efficiencyLegend,
80938
+ trendSummary: workspaceMonthlyTrend,
80939
+ compact: true,
80940
+ isAssemblyWorkspace
80941
+ }
80942
+ )
80943
+ ] })
80419
80944
  ] })
80420
80945
  ] })
80421
- ] })
80422
- ] }),
80423
- /* @__PURE__ */ jsxs("div", { className: "flex-grow p-1.5 sm:p-2 lg:p-4", children: [
80424
- activeTab === "overview" && /* @__PURE__ */ jsx("div", { className: "flex flex-col h-full lg:h-[calc(100vh-12rem)] overflow-y-auto lg:min-h-0 pb-4", children: shouldShowAssemblyOverviewLoadingState ? assemblyOverviewLoadingView : /* @__PURE__ */ jsxs(Fragment, { children: [
80425
- /* @__PURE__ */ jsxs("div", { className: "block lg:hidden space-y-6 pb-6", children: [
80426
- isOutputLayout && !isUptimeMode && /* @__PURE__ */ jsxs(
80427
- motion.div,
80428
- {
80429
- className: "bg-white rounded-lg shadow-sm p-6 h-[300px]",
80430
- variants: chartCardVariants,
80431
- initial: "initial",
80432
- animate: "animate",
80433
- children: [
80434
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's Output" }),
80435
- /* @__PURE__ */ jsx("div", { className: "h-[calc(100%-3rem)]", children: /* @__PURE__ */ jsx(
80436
- OutputProgressChart,
80437
- {
80438
- currentOutput: workspace.total_actions || 0,
80439
- targetOutput: workspace.target_output || 0,
80440
- skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
80441
- selectedSkuId,
80442
- onSelectSku: setSelectedSkuId,
80443
- liveSkuId: isHistoricView ? null : liveSkuId
80444
- }
80445
- ) })
80446
- ]
80447
- }
80448
- ),
80449
- /* @__PURE__ */ jsxs(
80450
- motion.div,
80451
- {
80452
- className: "bg-white rounded-lg shadow-sm p-4",
80453
- variants: chartCardVariants,
80454
- initial: "initial",
80455
- animate: "animate",
80456
- children: [
80457
- /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4", children: [
80458
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-bold text-gray-700", children: isUptimeMode ? "Machine Utilization" : isAssemblyCycleLayout ? "Cycle time trend" : "Hourly Output" }),
80459
- canToggleChartIdleTime && /* @__PURE__ */ jsx(
80460
- "button",
80946
+ ] }),
80947
+ /* @__PURE__ */ jsxs("div", { className: "flex-grow p-1.5 sm:p-2 lg:p-4", children: [
80948
+ activeTab === "overview" && /* @__PURE__ */ jsx("div", { className: "flex flex-col h-full lg:h-[calc(100vh-12rem)] overflow-y-auto lg:min-h-0 pb-4", children: shouldShowAssemblyOverviewLoadingState ? assemblyOverviewLoadingView : /* @__PURE__ */ jsxs(Fragment, { children: [
80949
+ /* @__PURE__ */ jsxs("div", { className: "block lg:hidden space-y-6 pb-6", children: [
80950
+ isOutputLayout && !isUptimeMode && /* @__PURE__ */ jsxs(
80951
+ motion.div,
80952
+ {
80953
+ className: "bg-white rounded-lg shadow-sm p-6 h-[300px]",
80954
+ variants: chartCardVariants,
80955
+ initial: "initial",
80956
+ animate: "animate",
80957
+ children: [
80958
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's Output" }),
80959
+ /* @__PURE__ */ jsx("div", { className: "h-[calc(100%-3rem)]", children: /* @__PURE__ */ jsx(
80960
+ OutputProgressChart,
80461
80961
  {
80462
- onClick: () => setShowChartIdleTime(!showChartIdleTime),
80463
- className: `inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${showChartIdleTime ? "bg-blue-50 text-blue-700 border border-blue-200" : "bg-white text-gray-700 border border-gray-300 hover:bg-gray-50"}`,
80464
- children: showChartIdleTime ? /* @__PURE__ */ jsxs(Fragment, { children: [
80465
- /* @__PURE__ */ jsx(EyeOff, { className: "w-4 h-4 mr-1.5" }),
80466
- "Hide Idle Time"
80467
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
80468
- /* @__PURE__ */ jsx(Eye, { className: "w-4 h-4 mr-1.5" }),
80469
- "Show Idle Time"
80470
- ] })
80962
+ currentOutput: workspace.total_actions || 0,
80963
+ targetOutput: workspace.target_output || 0,
80964
+ skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
80965
+ selectedSkuId,
80966
+ onSelectSku: setSelectedSkuId,
80967
+ liveSkuId: isHistoricView ? null : liveSkuId
80471
80968
  }
80472
- )
80473
- ] }),
80474
- /* @__PURE__ */ jsx(
80475
- "div",
80476
- {
80477
- className: "h-[300px] min-h-[220px] min-w-0",
80478
- children: isUptimeMode ? /* @__PURE__ */ jsx(
80479
- HourlyUptimeChart,
80480
- {
80481
- idleTimeHourly: workspace.idle_time_hourly,
80482
- shiftStart: workspace.shift_start,
80483
- shiftEnd: workspace.shift_end,
80484
- shiftDate: idleClipDate,
80485
- timezone,
80486
- elapsedMinutes: elapsedShiftMinutes,
80487
- shiftBreaks: workspaceShiftBreaks
80488
- }
80489
- ) : isAssemblyCycleLayout ? shouldShowCycleTimeUnavailableState ? cycleTimeUnavailableView : shouldShowCycleTimeChart ? /* @__PURE__ */ jsx(
80490
- CycleTimeOverTimeChart,
80491
- {
80492
- data: maskedCycleTimeChartData,
80493
- idealCycleTime: authoritativeCycleMetrics?.ideal_cycle_time || 0,
80494
- shiftStart: authoritativeCycleMetrics?.shift_start || "",
80495
- shiftEnd: authoritativeCycleMetrics?.shift_end || "",
80496
- xAxisMode: "hourly",
80497
- datasetKey: cycleTimeDatasetKey,
80498
- showIdleTime: showChartIdleTime,
80499
- idleTimeData: hourlyIdleMinutes,
80500
- idleTimeSlots: hourlyIdleSlots
80501
- }
80502
- ) : null : /* @__PURE__ */ jsx(
80503
- HourlyOutputChart2,
80969
+ ) })
80970
+ ]
80971
+ }
80972
+ ),
80973
+ /* @__PURE__ */ jsxs(
80974
+ motion.div,
80975
+ {
80976
+ className: "bg-white rounded-lg shadow-sm p-4",
80977
+ variants: chartCardVariants,
80978
+ initial: "initial",
80979
+ animate: "animate",
80980
+ children: [
80981
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4", children: [
80982
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-bold text-gray-700", children: isUptimeMode ? "Machine Utilization" : isAssemblyCycleLayout ? "Cycle time trend" : "Hourly Output" }),
80983
+ canToggleChartIdleTime && /* @__PURE__ */ jsx(
80984
+ "button",
80504
80985
  {
80505
- data: workspace.hourly_action_counts || [],
80506
- pphThreshold: workspace.pph_threshold || 0,
80507
- hourlyTargetOutput: workspace.hourly_target_output,
80508
- shiftStart: workspace.shift_start || "06:00",
80509
- shiftEnd: workspace.shift_end,
80510
- shiftBreaks: shiftConfig?.shifts?.find((shift2) => shift2.shiftId === workspace.shift_id)?.breaks || [],
80511
- showIdleTime: showChartIdleTime,
80512
- idleTimeHourly: workspace.idle_time_hourly,
80513
- idleTimeClips,
80514
- idleTimeClipClassifications,
80515
- shiftDate: idleClipDate,
80516
- timezone: effectiveCycleTimeTimezone,
80517
- skuSegments: isSkuAware ? skuSegments : void 0,
80518
- activeSkuId
80986
+ onClick: () => setShowChartIdleTime(!showChartIdleTime),
80987
+ className: `inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${showChartIdleTime ? "bg-blue-50 text-blue-700 border border-blue-200" : "bg-white text-gray-700 border border-gray-300 hover:bg-gray-50"}`,
80988
+ children: showChartIdleTime ? /* @__PURE__ */ jsxs(Fragment, { children: [
80989
+ /* @__PURE__ */ jsx(EyeOff, { className: "w-4 h-4 mr-1.5" }),
80990
+ "Hide Idle Time"
80991
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
80992
+ /* @__PURE__ */ jsx(Eye, { className: "w-4 h-4 mr-1.5" }),
80993
+ "Show Idle Time"
80994
+ ] })
80519
80995
  }
80520
80996
  )
80521
- }
80522
- )
80523
- ]
80524
- }
80525
- ),
80526
- showIdleBreakdownChart && /* @__PURE__ */ jsxs(
80527
- motion.div,
80528
- {
80529
- className: "bg-white rounded-lg shadow-sm p-4 h-[300px]",
80530
- variants: chartCardVariants,
80531
- initial: "initial",
80532
- animate: "animate",
80533
- children: [
80534
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Idle Time Breakdown" }),
80535
- /* @__PURE__ */ jsx("div", { className: "h-[calc(100%-3rem)]", children: /* @__PURE__ */ jsx(
80536
- IdleTimeReasonChart,
80537
- {
80538
- data: idleTimeData.chartData,
80539
- isLoading: idleTimeData.isLoading,
80540
- error: idleTimeData.error
80541
- }
80542
- ) })
80543
- ]
80544
- }
80545
- ),
80546
- isUptimeMode ? /* @__PURE__ */ jsx(UptimeMetricCards, { workspace, uptimePieData }) : isAssemblyCycleLayout ? /* @__PURE__ */ jsx(
80547
- WorkspaceCycleTimeMetricCards,
80548
- {
80549
- workspace,
80550
- legend: efficiencyLegend,
80551
- layout: "stack",
80552
- idleTimeData: idleTimeVlmEnabled ? idleTimeData : void 0,
80553
- skuAware: isSkuAware,
80554
- skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
80555
- activeSkuId,
80556
- liveSkuId: isHistoricView ? null : liveSkuId
80557
- }
80558
- ) : /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
80559
- WorkspaceMetricCards,
80560
- {
80561
- workspace,
80562
- legend: efficiencyLegend,
80563
- className: "flex-1",
80564
- skuAware: isSkuAware,
80565
- skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
80566
- activeSkuId,
80567
- liveSkuId: isHistoricView ? null : liveSkuId
80568
- }
80569
- ) })
80570
- ] }),
80571
- /* @__PURE__ */ jsxs("div", { className: "hidden lg:flex lg:flex-col lg:h-full lg:min-h-0 gap-3", children: [
80572
- /* @__PURE__ */ jsxs(
80573
- "div",
80574
- {
80575
- className: clsx(
80576
- "grid grid-cols-1 gap-3 min-h-0",
80577
- isUptimeMode && showIdleBreakdownChart ? "lg:grid-cols-3" : "lg:grid-cols-10",
80578
- desktopTopSectionClass
80579
- ),
80580
- children: [
80581
- isOutputLayout && !isUptimeMode && /* @__PURE__ */ jsxs(
80582
- motion.div,
80583
- {
80584
- className: "bg-white rounded-lg shadow-sm p-4 lg:col-span-2 flex flex-col min-h-0",
80585
- variants: chartCardVariants,
80586
- initial: "initial",
80587
- animate: "animate",
80588
- children: [
80589
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's Output" }),
80590
- /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: /* @__PURE__ */ jsx(
80591
- OutputProgressChart,
80592
- {
80593
- currentOutput: workspace.total_actions || 0,
80594
- targetOutput: workspace.target_output || 0,
80595
- skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
80596
- selectedSkuId,
80597
- onSelectSku: setSelectedSkuId,
80598
- liveSkuId: isHistoricView ? null : liveSkuId
80599
- }
80600
- ) })
80601
- ]
80602
- }
80603
- ),
80604
- /* @__PURE__ */ jsxs(
80605
- motion.div,
80606
- {
80607
- className: clsx(
80608
- "bg-white rounded-lg shadow-sm p-4 flex flex-col min-h-0",
80609
- isUptimeMode && showIdleBreakdownChart ? "lg:col-span-2" : isAssemblyCycleLayout || isUptimeMode ? "lg:col-span-10" : idleTimeVlmEnabled ? "lg:col-span-6" : "lg:col-span-8"
80610
- ),
80611
- variants: chartCardVariants,
80612
- initial: "initial",
80613
- animate: "animate",
80614
- children: [
80615
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 mb-4 flex-none", children: [
80616
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-bold text-gray-700", children: isUptimeMode ? "Machine Utilization" : isAssemblyCycleLayout ? "Cycle time trend" : "Hourly Output" }),
80617
- canToggleChartIdleTime && /* @__PURE__ */ jsx(
80618
- "button",
80619
- {
80620
- onClick: () => setShowChartIdleTime(!showChartIdleTime),
80621
- className: `inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${showChartIdleTime ? "bg-blue-50 text-blue-700 border border-blue-200" : "bg-white text-gray-700 border border-gray-300 hover:bg-gray-50"}`,
80622
- children: showChartIdleTime ? /* @__PURE__ */ jsxs(Fragment, { children: [
80623
- /* @__PURE__ */ jsx(EyeOff, { className: "w-4 h-4 mr-1.5" }),
80624
- "Hide Idle Time"
80625
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
80626
- /* @__PURE__ */ jsx(Eye, { className: "w-4 h-4 mr-1.5" }),
80627
- "Show Idle Time"
80628
- ] })
80629
- }
80630
- )
80631
- ] }),
80632
- /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: isUptimeMode ? /* @__PURE__ */ jsx(
80997
+ ] }),
80998
+ /* @__PURE__ */ jsx(
80999
+ "div",
81000
+ {
81001
+ className: "h-[300px] min-h-[220px] min-w-0",
81002
+ children: isUptimeMode ? /* @__PURE__ */ jsx(
80633
81003
  HourlyUptimeChart,
80634
81004
  {
80635
81005
  idleTimeHourly: workspace.idle_time_hourly,
@@ -80651,7 +81021,9 @@ var WorkspaceDetailView = ({
80651
81021
  datasetKey: cycleTimeDatasetKey,
80652
81022
  showIdleTime: showChartIdleTime,
80653
81023
  idleTimeData: hourlyIdleMinutes,
80654
- idleTimeSlots: hourlyIdleSlots
81024
+ idleTimeSlots: hourlyIdleSlots,
81025
+ selectedHourIndex: selectedHour?.source === "cycle" ? selectedHour.hourIndex : null,
81026
+ onHourClick: handleCycleHourSelect
80655
81027
  }
80656
81028
  ) : null : /* @__PURE__ */ jsx(
80657
81029
  HourlyOutputChart2,
@@ -80669,142 +81041,378 @@ var WorkspaceDetailView = ({
80669
81041
  shiftDate: idleClipDate,
80670
81042
  timezone: effectiveCycleTimeTimezone,
80671
81043
  skuSegments: isSkuAware ? skuSegments : void 0,
80672
- activeSkuId
81044
+ activeSkuId,
81045
+ selectedHourIndex: selectedHour?.source === "output" ? selectedHour.hourIndex : aiSummaryHour?.hourIndex ?? null,
81046
+ onHourClick: handleOutputHourSelect,
81047
+ onWatchClipsClick: handleWatchClipsFromChart,
81048
+ onAiSummaryClick: handleAiSummaryClick
80673
81049
  }
80674
- ) })
80675
- ]
80676
- }
81050
+ )
81051
+ }
81052
+ )
81053
+ ]
81054
+ }
81055
+ ),
81056
+ showHourSummaryPanel && !aiSummaryHour && /* @__PURE__ */ jsx(
81057
+ WorkspaceHourSummaryPanel,
81058
+ {
81059
+ workspaceId,
81060
+ companyId: hourSummaryCompanyId,
81061
+ date: hourSummaryDate,
81062
+ shiftId: hourSummaryShiftId,
81063
+ selectedHour,
81064
+ clipsEnabled: isClipsEnabled,
81065
+ onOpenClips: handleOpenClipsForHour,
81066
+ onClose: handleCloseHourSummary
81067
+ }
81068
+ ),
81069
+ showIdleBreakdownChart && /* @__PURE__ */ jsxs(
81070
+ motion.div,
81071
+ {
81072
+ className: "bg-white rounded-lg shadow-sm p-4 h-[300px]",
81073
+ variants: chartCardVariants,
81074
+ initial: "initial",
81075
+ animate: "animate",
81076
+ children: [
81077
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Idle Time Breakdown" }),
81078
+ /* @__PURE__ */ jsx("div", { className: "h-[calc(100%-3rem)]", children: /* @__PURE__ */ jsx(
81079
+ IdleTimeReasonChart,
81080
+ {
81081
+ data: idleTimeData.chartData,
81082
+ isLoading: idleTimeData.isLoading,
81083
+ error: idleTimeData.error
81084
+ }
81085
+ ) })
81086
+ ]
81087
+ }
81088
+ ),
81089
+ isUptimeMode ? /* @__PURE__ */ jsx(UptimeMetricCards, { workspace, uptimePieData }) : isAssemblyCycleLayout ? /* @__PURE__ */ jsx(
81090
+ WorkspaceCycleTimeMetricCards,
81091
+ {
81092
+ workspace,
81093
+ legend: efficiencyLegend,
81094
+ layout: "stack",
81095
+ idleTimeData: idleTimeVlmEnabled ? idleTimeData : void 0,
81096
+ skuAware: isSkuAware,
81097
+ skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
81098
+ activeSkuId,
81099
+ liveSkuId: isHistoricView ? null : liveSkuId
81100
+ }
81101
+ ) : /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
81102
+ WorkspaceMetricCards,
81103
+ {
81104
+ workspace,
81105
+ legend: efficiencyLegend,
81106
+ className: "flex-1",
81107
+ skuAware: isSkuAware,
81108
+ skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
81109
+ activeSkuId,
81110
+ liveSkuId: isHistoricView ? null : liveSkuId
81111
+ }
81112
+ ) })
81113
+ ] }),
81114
+ /* @__PURE__ */ jsxs("div", { className: "hidden lg:flex lg:flex-col lg:h-full lg:min-h-0 gap-3", children: [
81115
+ /* @__PURE__ */ jsxs(
81116
+ "div",
81117
+ {
81118
+ className: clsx(
81119
+ "grid grid-cols-1 gap-3 min-h-0",
81120
+ showHourSummaryPanel ? "lg:grid-cols-12" : isUptimeMode && showIdleBreakdownChart ? "lg:grid-cols-3" : "lg:grid-cols-10",
81121
+ desktopTopSectionClass
80677
81122
  ),
80678
- showIdleBreakdownChart && /* @__PURE__ */ jsxs(
80679
- motion.div,
80680
- {
80681
- className: clsx(
80682
- "bg-white rounded-lg shadow-sm p-4 flex flex-col min-h-0",
80683
- isUptimeMode ? "lg:col-span-1" : "lg:col-span-2"
80684
- ),
80685
- variants: chartCardVariants,
80686
- initial: "initial",
80687
- animate: "animate",
80688
- children: [
80689
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Idle Time Breakdown" }),
80690
- /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: /* @__PURE__ */ jsx(
80691
- IdleTimeReasonChart,
80692
- {
80693
- data: idleTimeData.chartData,
80694
- isLoading: idleTimeData.isLoading,
80695
- error: idleTimeData.error
80696
- }
80697
- ) })
80698
- ]
80699
- }
80700
- )
80701
- ]
80702
- }
80703
- ),
80704
- isUptimeMode ? /* @__PURE__ */ jsx("div", { className: clsx("flex min-h-0", desktopBottomSectionClass), children: /* @__PURE__ */ jsx(UptimeMetricCards, { workspace, uptimePieData, className: "flex-1" }) }) : isAssemblyCycleLayout ? /* @__PURE__ */ jsx(
80705
- WorkspaceCycleTimeMetricCards,
80706
- {
80707
- workspace,
80708
- legend: efficiencyLegend,
80709
- layout: "grid",
80710
- className: desktopBottomSectionClass,
80711
- idleTimeData: idleTimeVlmEnabled ? idleTimeData : void 0,
80712
- skuAware: isSkuAware,
80713
- skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
80714
- activeSkuId,
80715
- liveSkuId: isHistoricView ? null : liveSkuId
80716
- }
80717
- ) : /* @__PURE__ */ jsx("div", { className: clsx("flex min-h-0", desktopBottomSectionClass), children: /* @__PURE__ */ jsx(
80718
- WorkspaceMetricCards,
81123
+ children: [
81124
+ isOutputLayout && !isUptimeMode && /* @__PURE__ */ jsxs(
81125
+ motion.div,
81126
+ {
81127
+ className: "bg-white rounded-lg shadow-sm p-4 lg:col-span-2 flex flex-col min-h-0",
81128
+ variants: chartCardVariants,
81129
+ initial: "initial",
81130
+ animate: "animate",
81131
+ children: [
81132
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's Output" }),
81133
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: /* @__PURE__ */ jsx(
81134
+ OutputProgressChart,
81135
+ {
81136
+ currentOutput: workspace.total_actions || 0,
81137
+ targetOutput: workspace.target_output || 0,
81138
+ skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
81139
+ selectedSkuId,
81140
+ onSelectSku: setSelectedSkuId,
81141
+ liveSkuId: isHistoricView ? null : liveSkuId
81142
+ }
81143
+ ) })
81144
+ ]
81145
+ }
81146
+ ),
81147
+ /* @__PURE__ */ jsxs(
81148
+ motion.div,
81149
+ {
81150
+ className: clsx(
81151
+ "bg-white rounded-lg shadow-sm p-4 flex flex-col min-h-0",
81152
+ showHourSummaryPanel ? isAssemblyCycleLayout || isUptimeMode ? "lg:col-span-9" : idleTimeVlmEnabled ? "lg:col-span-6" : "lg:col-span-8" : isUptimeMode && showIdleBreakdownChart ? "lg:col-span-2" : isAssemblyCycleLayout || isUptimeMode ? "lg:col-span-10" : idleTimeVlmEnabled ? "lg:col-span-6" : "lg:col-span-8"
81153
+ ),
81154
+ variants: chartCardVariants,
81155
+ initial: "initial",
81156
+ animate: "animate",
81157
+ children: [
81158
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 mb-4 flex-none", children: [
81159
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-bold text-gray-700", children: isUptimeMode ? "Machine Utilization" : isAssemblyCycleLayout ? "Cycle time trend" : "Hourly Output" }),
81160
+ canToggleChartIdleTime && /* @__PURE__ */ jsx(
81161
+ "button",
81162
+ {
81163
+ onClick: () => setShowChartIdleTime(!showChartIdleTime),
81164
+ className: `inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${showChartIdleTime ? "bg-blue-50 text-blue-700 border border-blue-200" : "bg-white text-gray-700 border border-gray-300 hover:bg-gray-50"}`,
81165
+ children: showChartIdleTime ? /* @__PURE__ */ jsxs(Fragment, { children: [
81166
+ /* @__PURE__ */ jsx(EyeOff, { className: "w-4 h-4 mr-1.5" }),
81167
+ "Hide Idle Time"
81168
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
81169
+ /* @__PURE__ */ jsx(Eye, { className: "w-4 h-4 mr-1.5" }),
81170
+ "Show Idle Time"
81171
+ ] })
81172
+ }
81173
+ )
81174
+ ] }),
81175
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: isUptimeMode ? /* @__PURE__ */ jsx(
81176
+ HourlyUptimeChart,
81177
+ {
81178
+ idleTimeHourly: workspace.idle_time_hourly,
81179
+ shiftStart: workspace.shift_start,
81180
+ shiftEnd: workspace.shift_end,
81181
+ shiftDate: idleClipDate,
81182
+ timezone,
81183
+ elapsedMinutes: elapsedShiftMinutes,
81184
+ shiftBreaks: workspaceShiftBreaks
81185
+ }
81186
+ ) : isAssemblyCycleLayout ? shouldShowCycleTimeUnavailableState ? cycleTimeUnavailableView : shouldShowCycleTimeChart ? /* @__PURE__ */ jsx(
81187
+ CycleTimeOverTimeChart,
81188
+ {
81189
+ data: maskedCycleTimeChartData,
81190
+ idealCycleTime: authoritativeCycleMetrics?.ideal_cycle_time || 0,
81191
+ shiftStart: authoritativeCycleMetrics?.shift_start || "",
81192
+ shiftEnd: authoritativeCycleMetrics?.shift_end || "",
81193
+ xAxisMode: "hourly",
81194
+ datasetKey: cycleTimeDatasetKey,
81195
+ showIdleTime: showChartIdleTime,
81196
+ idleTimeData: hourlyIdleMinutes,
81197
+ idleTimeSlots: hourlyIdleSlots,
81198
+ selectedHourIndex: selectedHour?.source === "cycle" ? selectedHour.hourIndex : null,
81199
+ onHourClick: handleCycleHourSelect
81200
+ }
81201
+ ) : null : /* @__PURE__ */ jsx(
81202
+ HourlyOutputChart2,
81203
+ {
81204
+ data: workspace.hourly_action_counts || [],
81205
+ pphThreshold: workspace.pph_threshold || 0,
81206
+ hourlyTargetOutput: workspace.hourly_target_output,
81207
+ shiftStart: workspace.shift_start || "06:00",
81208
+ shiftEnd: workspace.shift_end,
81209
+ shiftBreaks: shiftConfig?.shifts?.find((shift2) => shift2.shiftId === workspace.shift_id)?.breaks || [],
81210
+ showIdleTime: showChartIdleTime,
81211
+ idleTimeHourly: workspace.idle_time_hourly,
81212
+ idleTimeClips,
81213
+ idleTimeClipClassifications,
81214
+ shiftDate: idleClipDate,
81215
+ timezone: effectiveCycleTimeTimezone,
81216
+ skuSegments: isSkuAware ? skuSegments : void 0,
81217
+ activeSkuId,
81218
+ selectedHourIndex: selectedHour?.source === "output" ? selectedHour.hourIndex : aiSummaryHour?.hourIndex ?? null,
81219
+ onHourClick: handleOutputHourSelect,
81220
+ onWatchClipsClick: handleWatchClipsFromChart,
81221
+ onAiSummaryClick: handleAiSummaryClick
81222
+ }
81223
+ ) })
81224
+ ]
81225
+ }
81226
+ ),
81227
+ showIdleBreakdownChart && /* @__PURE__ */ jsxs(
81228
+ motion.div,
81229
+ {
81230
+ className: clsx(
81231
+ "bg-white rounded-lg shadow-sm p-4 flex flex-col min-h-0",
81232
+ isUptimeMode ? "lg:col-span-1" : "lg:col-span-2"
81233
+ ),
81234
+ variants: chartCardVariants,
81235
+ initial: "initial",
81236
+ animate: "animate",
81237
+ children: [
81238
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Idle Time Breakdown" }),
81239
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: /* @__PURE__ */ jsx(
81240
+ IdleTimeReasonChart,
81241
+ {
81242
+ data: idleTimeData.chartData,
81243
+ isLoading: idleTimeData.isLoading,
81244
+ error: idleTimeData.error
81245
+ }
81246
+ ) })
81247
+ ]
81248
+ }
81249
+ ),
81250
+ showHourSummaryPanel && /* @__PURE__ */ jsx(
81251
+ WorkspaceHourSummaryPanel,
81252
+ {
81253
+ workspaceId,
81254
+ companyId: hourSummaryCompanyId,
81255
+ date: hourSummaryDate,
81256
+ shiftId: hourSummaryShiftId,
81257
+ selectedHour,
81258
+ clipsEnabled: isClipsEnabled,
81259
+ onOpenClips: handleOpenClipsForHour,
81260
+ onClose: handleCloseHourSummary,
81261
+ className: clsx(
81262
+ "flex min-h-0 flex-col overflow-y-auto",
81263
+ isAssemblyCycleLayout || isUptimeMode ? "lg:col-span-3" : "lg:col-span-2"
81264
+ )
81265
+ }
81266
+ )
81267
+ ]
81268
+ }
81269
+ ),
81270
+ isUptimeMode ? /* @__PURE__ */ jsx("div", { className: clsx("flex min-h-0", desktopBottomSectionClass), children: /* @__PURE__ */ jsx(UptimeMetricCards, { workspace, uptimePieData, className: "flex-1" }) }) : isAssemblyCycleLayout ? /* @__PURE__ */ jsx(
81271
+ WorkspaceCycleTimeMetricCards,
81272
+ {
81273
+ workspace,
81274
+ legend: efficiencyLegend,
81275
+ layout: "grid",
81276
+ className: desktopBottomSectionClass,
81277
+ idleTimeData: idleTimeVlmEnabled ? idleTimeData : void 0,
81278
+ skuAware: isSkuAware,
81279
+ skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
81280
+ activeSkuId,
81281
+ liveSkuId: isHistoricView ? null : liveSkuId
81282
+ }
81283
+ ) : /* @__PURE__ */ jsx("div", { className: clsx("flex min-h-0", desktopBottomSectionClass), children: /* @__PURE__ */ jsx(
81284
+ WorkspaceMetricCards,
81285
+ {
81286
+ workspace,
81287
+ legend: efficiencyLegend,
81288
+ className: "flex-1",
81289
+ skuAware: isSkuAware,
81290
+ skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
81291
+ activeSkuId,
81292
+ liveSkuId: isHistoricView ? null : liveSkuId
81293
+ }
81294
+ ) })
81295
+ ] })
81296
+ ] }) }),
81297
+ activeTab === "monthly_history" && /* @__PURE__ */ jsxs("div", { className: "h-[calc(100vh-10rem)] overflow-y-auto px-2 sm:px-4 lg:px-0", children: [
81298
+ usingFallbackData && !date && !shift && /* @__PURE__ */ jsx("div", { className: "mb-3 sm:mb-4 bg-amber-50 border border-amber-200 rounded-lg px-3 sm:px-4 py-2 sm:py-3 text-amber-800", children: /* @__PURE__ */ jsxs("p", { className: "text-xs sm:text-sm font-medium flex items-center", children: [
81299
+ /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-4 w-4 sm:h-5 sm:w-5 mr-2", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z", clipRule: "evenodd" }) }),
81300
+ "No current data available for today. Showing monthly history instead."
81301
+ ] }) }),
81302
+ /* @__PURE__ */ jsx(
81303
+ WorkspaceMonthlyHistory,
80719
81304
  {
80720
- workspace,
81305
+ data: monthlyData,
81306
+ analysisData: analysisMonthlyData,
81307
+ month: selectedMonth,
81308
+ year: selectedYear,
81309
+ workspaceId,
81310
+ lineId: resolvedLineId,
81311
+ monitoringMode: workspace?.monitoring_mode,
81312
+ selectedShiftId: selectedShift,
81313
+ rangeStart,
81314
+ rangeEnd,
81315
+ timezone,
81316
+ shiftConfig,
81317
+ shiftConfigFromDatabase: isShiftConfigFromDatabase,
81318
+ monthlyDataLoading,
81319
+ availableShifts: shiftConfig?.shifts?.map((s) => ({ id: s.shiftId, name: s.shiftName })),
80721
81320
  legend: efficiencyLegend,
80722
- className: "flex-1",
80723
- skuAware: isSkuAware,
80724
- skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
80725
- activeSkuId,
80726
- liveSkuId: isHistoricView ? null : liveSkuId
81321
+ trendSummary: workspaceMonthlyTrend,
81322
+ isAssemblyWorkspace,
81323
+ onDateSelect: (selectedDate, shiftId) => {
81324
+ if (onDateSelect) {
81325
+ onDateSelect(selectedDate, shiftId);
81326
+ } else if (onNavigate) {
81327
+ const params = new URLSearchParams();
81328
+ params.set("date", selectedDate);
81329
+ params.set("shift", shiftId.toString());
81330
+ params.set("fromMonthly", "true");
81331
+ if (!isFullRange) {
81332
+ params.set("rangeStart", range.startKey);
81333
+ params.set("rangeEnd", range.endKey);
81334
+ }
81335
+ if (resolvedLineId) {
81336
+ params.set("lineId", resolvedLineId);
81337
+ }
81338
+ appendReturnUrl(params);
81339
+ onNavigate(`/workspace/${workspaceId}?${params.toString()}`);
81340
+ }
81341
+ },
81342
+ onMonthNavigate: (newMonth, newYear) => {
81343
+ setSelectedMonth(newMonth);
81344
+ setSelectedYear(newYear);
81345
+ const nextBounds = getMonthKeyBounds(newYear, newMonth);
81346
+ setRangeStart(nextBounds.startKey);
81347
+ setRangeEnd(nextBounds.endKey);
81348
+ },
81349
+ onShiftChange: setSelectedShift,
81350
+ onRangeChange: (nextRange) => {
81351
+ setRangeStart(nextRange.startKey);
81352
+ setRangeEnd(nextRange.endKey);
81353
+ },
81354
+ className: "w-full"
80727
81355
  }
80728
- ) })
80729
- ] })
80730
- ] }) }),
80731
- activeTab === "monthly_history" && /* @__PURE__ */ jsxs("div", { className: "h-[calc(100vh-10rem)] overflow-y-auto px-2 sm:px-4 lg:px-0", children: [
80732
- usingFallbackData && !date && !shift && /* @__PURE__ */ jsx("div", { className: "mb-3 sm:mb-4 bg-amber-50 border border-amber-200 rounded-lg px-3 sm:px-4 py-2 sm:py-3 text-amber-800", children: /* @__PURE__ */ jsxs("p", { className: "text-xs sm:text-sm font-medium flex items-center", children: [
80733
- /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-4 w-4 sm:h-5 sm:w-5 mr-2", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z", clipRule: "evenodd" }) }),
80734
- "No current data available for today. Showing monthly history instead."
80735
- ] }) }),
80736
- /* @__PURE__ */ jsx(
80737
- WorkspaceMonthlyHistory,
81356
+ )
81357
+ ] }),
81358
+ activeTab === "bottlenecks" && /* @__PURE__ */ jsx(ClipFilterProvider, { children: /* @__PURE__ */ jsx(
81359
+ BottlenecksContent,
80738
81360
  {
80739
- data: monthlyData,
80740
- analysisData: analysisMonthlyData,
80741
- month: selectedMonth,
80742
- year: selectedYear,
80743
81361
  workspaceId,
81362
+ workspaceName: formattedWorkspaceName,
81363
+ date,
80744
81364
  lineId: resolvedLineId,
80745
- monitoringMode: workspace?.monitoring_mode,
80746
- selectedShiftId: selectedShift,
80747
- rangeStart,
80748
- rangeEnd,
80749
- timezone,
80750
- shiftConfig,
80751
- shiftConfigFromDatabase: isShiftConfigFromDatabase,
80752
- monthlyDataLoading,
80753
- availableShifts: shiftConfig?.shifts?.map((s) => ({ id: s.shiftId, name: s.shiftName })),
80754
- legend: efficiencyLegend,
80755
- trendSummary: workspaceMonthlyTrend,
80756
- isAssemblyWorkspace,
80757
- onDateSelect: (selectedDate, shiftId) => {
80758
- if (onDateSelect) {
80759
- onDateSelect(selectedDate, shiftId);
80760
- } else if (onNavigate) {
80761
- const params = new URLSearchParams();
80762
- params.set("date", selectedDate);
80763
- params.set("shift", shiftId.toString());
80764
- params.set("fromMonthly", "true");
80765
- if (!isFullRange) {
80766
- params.set("rangeStart", range.startKey);
80767
- params.set("rangeEnd", range.endKey);
80768
- }
80769
- if (resolvedLineId) {
80770
- params.set("lineId", resolvedLineId);
80771
- }
80772
- appendReturnUrl(params);
80773
- onNavigate(`/workspace/${workspaceId}?${params.toString()}`);
81365
+ shift,
81366
+ totalOutput: workspace?.total_actions,
81367
+ workspaceMetrics: detailedWorkspaceMetrics || void 0,
81368
+ prefetchedPercentileCounts: isFastSlowClipFiltersEnabled ? prefetchedPercentileCounts : null,
81369
+ initialTimeFilter: pendingClipHourFilter,
81370
+ className: "h-[calc(100vh-10rem)]"
81371
+ }
81372
+ ) })
81373
+ ] })
81374
+ ] }),
81375
+ aiSummaryHour && /* @__PURE__ */ jsx(
81376
+ "div",
81377
+ {
81378
+ className: "fixed inset-0 bg-slate-900/40 backdrop-blur-sm flex items-center justify-center p-4 z-[9999]",
81379
+ onClick: () => setAiSummaryHour(null),
81380
+ children: /* @__PURE__ */ jsx(
81381
+ "div",
81382
+ {
81383
+ className: "max-w-xl w-full max-h-[90vh] overflow-y-auto animate-in zoom-in-95 duration-200",
81384
+ onClick: (e) => e.stopPropagation(),
81385
+ children: /* @__PURE__ */ jsx(
81386
+ WorkspaceHourSummaryPanel,
81387
+ {
81388
+ workspaceId,
81389
+ companyId: hourSummaryCompanyId,
81390
+ date: hourSummaryDate,
81391
+ shiftId: hourSummaryShiftId,
81392
+ selectedHour: {
81393
+ source: "output",
81394
+ hourIndex: aiSummaryHour.hourIndex,
81395
+ timeRange: aiSummaryHour.timeRange,
81396
+ startTime: aiSummaryHour.startTime,
81397
+ endTime: aiSummaryHour.endTime,
81398
+ status: aiSummaryHour.status,
81399
+ output: aiSummaryHour.output,
81400
+ target: aiSummaryHour.target
81401
+ },
81402
+ clipsEnabled: isClipsEnabled,
81403
+ onOpenClips: (hour) => {
81404
+ setAiSummaryHour(null);
81405
+ handleOpenClipsForHour(hour);
81406
+ },
81407
+ onClose: () => setAiSummaryHour(null),
81408
+ className: "shadow-2xl border-slate-200/60 ring-1 ring-black/5"
80774
81409
  }
80775
- },
80776
- onMonthNavigate: (newMonth, newYear) => {
80777
- setSelectedMonth(newMonth);
80778
- setSelectedYear(newYear);
80779
- const nextBounds = getMonthKeyBounds(newYear, newMonth);
80780
- setRangeStart(nextBounds.startKey);
80781
- setRangeEnd(nextBounds.endKey);
80782
- },
80783
- onShiftChange: setSelectedShift,
80784
- onRangeChange: (nextRange) => {
80785
- setRangeStart(nextRange.startKey);
80786
- setRangeEnd(nextRange.endKey);
80787
- },
80788
- className: "w-full"
81410
+ )
80789
81411
  }
80790
81412
  )
80791
- ] }),
80792
- activeTab === "bottlenecks" && /* @__PURE__ */ jsx(ClipFilterProvider, { children: /* @__PURE__ */ jsx(
80793
- BottlenecksContent,
80794
- {
80795
- workspaceId,
80796
- workspaceName: formattedWorkspaceName,
80797
- date,
80798
- lineId: resolvedLineId,
80799
- shift,
80800
- totalOutput: workspace?.total_actions,
80801
- workspaceMetrics: detailedWorkspaceMetrics || void 0,
80802
- prefetchedPercentileCounts: isFastSlowClipFiltersEnabled ? prefetchedPercentileCounts : null,
80803
- className: "h-[calc(100vh-10rem)]"
80804
- }
80805
- ) })
80806
- ] })
80807
- ] })
81413
+ }
81414
+ )
81415
+ ]
80808
81416
  }
80809
81417
  );
80810
81418
  };
@@ -82396,7 +83004,7 @@ function BottleneckClipsView({
82396
83004
  ) })
82397
83005
  ] }) });
82398
83006
  }
82399
- var AuthenticatedBottleneckClipsView = withAuth(React146__default.memo(BottleneckClipsView));
83007
+ var AuthenticatedBottleneckClipsView = withAuth(React147__default.memo(BottleneckClipsView));
82400
83008
  var BottleneckClipsView_default = BottleneckClipsView;
82401
83009
 
82402
83010
  // src/lib/services/ticketService.ts
@@ -83239,7 +83847,7 @@ Please ensure:
83239
83847
  )
83240
83848
  ] });
83241
83849
  }
83242
- var AuthenticatedTicketsView = withAuth(React146__default.memo(TicketsView));
83850
+ var AuthenticatedTicketsView = withAuth(React147__default.memo(TicketsView));
83243
83851
  var TicketsView_default = TicketsView;
83244
83852
 
83245
83853
  // src/lib/utils/improvementDisplay.ts
@@ -84210,7 +84818,7 @@ var ImprovementCenterView = () => {
84210
84818
  setSelectedMemberId("all");
84211
84819
  }
84212
84820
  }, [memberOptions, selectedMemberId]);
84213
- const getRecommendationDisplayMetadata = React146__default.useCallback((rec) => {
84821
+ const getRecommendationDisplayMetadata = React147__default.useCallback((rec) => {
84214
84822
  const supervisors = rec.line_id ? supervisorsByLineId.get(rec.line_id) || [] : [];
84215
84823
  return getImprovementDisplayMetadata({
84216
84824
  location: rec.location,
@@ -84684,7 +85292,7 @@ var ThreadSidebar = ({
84684
85292
  ] }) })
84685
85293
  ] });
84686
85294
  };
84687
- var ProfilePicture = React146__default.memo(({
85295
+ var ProfilePicture = React147__default.memo(({
84688
85296
  alt = "Axel",
84689
85297
  className = "",
84690
85298
  size = "md",
@@ -87244,7 +87852,7 @@ var OverviewImprovementsSkeleton = () => /* @__PURE__ */ jsx("div", { className:
87244
87852
  ] }),
87245
87853
  /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end flex-shrink-0 ml-4", children: /* @__PURE__ */ jsx(SectionPulse, { className: "h-6 w-20 rounded-full" }) })
87246
87854
  ] }, index)) });
87247
- var OperationsOverviewHeader = React146__default.memo(({
87855
+ var OperationsOverviewHeader = React147__default.memo(({
87248
87856
  dateRange,
87249
87857
  displayDateRange,
87250
87858
  trendMode,
@@ -87265,65 +87873,65 @@ var OperationsOverviewHeader = React146__default.memo(({
87265
87873
  bumpRenderCounter();
87266
87874
  const subtitleRange = displayDateRange || dateRange;
87267
87875
  const showLiveShiftMeta = isLiveScope && trendMode !== "all";
87268
- const liveShiftLabel = React146__default.useMemo(
87876
+ const liveShiftLabel = React147__default.useMemo(
87269
87877
  () => normalizeShiftLabel(liveShiftName, trendMode),
87270
87878
  [liveShiftName, trendMode]
87271
87879
  );
87272
- const liveShiftIcon = React146__default.useMemo(
87880
+ const liveShiftIcon = React147__default.useMemo(
87273
87881
  () => getShiftIcon(liveShiftName, trendMode),
87274
87882
  [liveShiftName, trendMode]
87275
87883
  );
87276
- const [isFilterOpen, setIsFilterOpen] = React146__default.useState(false);
87277
- const [isLinesDropdownOpen, setIsLinesDropdownOpen] = React146__default.useState(false);
87278
- const filterRef = React146__default.useRef(null);
87279
- const filterButtonRef = React146__default.useRef(null);
87280
- const mobileFilterButtonRef = React146__default.useRef(null);
87281
- const linesDropdownRef = React146__default.useRef(null);
87282
- const mobileSubtitle = React146__default.useMemo(() => {
87884
+ const [isFilterOpen, setIsFilterOpen] = React147__default.useState(false);
87885
+ const [isLinesDropdownOpen, setIsLinesDropdownOpen] = React147__default.useState(false);
87886
+ const filterRef = React147__default.useRef(null);
87887
+ const filterButtonRef = React147__default.useRef(null);
87888
+ const mobileFilterButtonRef = React147__default.useRef(null);
87889
+ const linesDropdownRef = React147__default.useRef(null);
87890
+ const mobileSubtitle = React147__default.useMemo(() => {
87283
87891
  if (subtitleRange.startKey === subtitleRange.endKey) {
87284
87892
  return format(parseDateKeyToDate(subtitleRange.startKey), "do MMM, yyyy");
87285
87893
  }
87286
87894
  return `${format(parseDateKeyToDate(subtitleRange.startKey), "do MMM")} - ${format(parseDateKeyToDate(subtitleRange.endKey), "do MMM, yyyy")}`;
87287
87895
  }, [subtitleRange.endKey, subtitleRange.startKey]);
87288
- const desktopSubtitle = React146__default.useMemo(() => {
87896
+ const desktopSubtitle = React147__default.useMemo(() => {
87289
87897
  if (subtitleRange.startKey === subtitleRange.endKey) {
87290
87898
  return format(parseDateKeyToDate(subtitleRange.startKey), "do MMMM, yyyy");
87291
87899
  }
87292
87900
  return `${format(parseDateKeyToDate(subtitleRange.startKey), "do MMMM, yyyy")} - ${format(parseDateKeyToDate(subtitleRange.endKey), "do MMMM, yyyy")}`;
87293
87901
  }, [subtitleRange.endKey, subtitleRange.startKey]);
87294
- const availableLineIds = React146__default.useMemo(
87902
+ const availableLineIds = React147__default.useMemo(
87295
87903
  () => lineOptions.map((line) => line.id),
87296
87904
  [lineOptions]
87297
87905
  );
87298
- const selectedLineIdSet = React146__default.useMemo(
87906
+ const selectedLineIdSet = React147__default.useMemo(
87299
87907
  () => new Set(selectedLineIds),
87300
87908
  [selectedLineIds]
87301
87909
  );
87302
- const isAllLinesSelected = React146__default.useMemo(() => {
87910
+ const isAllLinesSelected = React147__default.useMemo(() => {
87303
87911
  if (availableLineIds.length === 0) return true;
87304
87912
  return availableLineIds.every((lineId) => selectedLineIdSet.has(lineId));
87305
87913
  }, [availableLineIds, selectedLineIdSet]);
87306
- const activeFilterCount = React146__default.useMemo(() => {
87914
+ const activeFilterCount = React147__default.useMemo(() => {
87307
87915
  let count = 0;
87308
87916
  if (trendMode !== "all") count += 1;
87309
87917
  if (selectedSupervisorId !== "all") count += 1;
87310
87918
  if (!isAllLinesSelected) count += 1;
87311
87919
  return count;
87312
87920
  }, [isAllLinesSelected, selectedSupervisorId, trendMode]);
87313
- const handleFilterToggle = React146__default.useCallback(() => {
87921
+ const handleFilterToggle = React147__default.useCallback(() => {
87314
87922
  trackCoreEvent("Operations Overview Filter Toggled", {
87315
87923
  action: !isFilterOpen ? "open" : "close"
87316
87924
  });
87317
87925
  setIsFilterOpen((previous) => !previous);
87318
87926
  }, [isFilterOpen]);
87319
- const handleTrendModeChange = React146__default.useCallback((event) => {
87927
+ const handleTrendModeChange = React147__default.useCallback((event) => {
87320
87928
  const nextMode = event.target.value;
87321
87929
  trackCoreEvent("Operations Overview Shift Filter Changed", {
87322
87930
  shift_mode: nextMode
87323
87931
  });
87324
87932
  onTrendModeChange(nextMode);
87325
87933
  }, [onTrendModeChange]);
87326
- const handleAllLinesToggle = React146__default.useCallback(() => {
87934
+ const handleAllLinesToggle = React147__default.useCallback(() => {
87327
87935
  trackCoreEvent("Operations Overview Line Filter Changed", {
87328
87936
  selected_line_ids: availableLineIds,
87329
87937
  selected_line_count: availableLineIds.length,
@@ -87331,7 +87939,7 @@ var OperationsOverviewHeader = React146__default.memo(({
87331
87939
  });
87332
87940
  onSelectedLineIdsChange(availableLineIds);
87333
87941
  }, [availableLineIds, onSelectedLineIdsChange]);
87334
- const handleSupervisorChange = React146__default.useCallback((event) => {
87942
+ const handleSupervisorChange = React147__default.useCallback((event) => {
87335
87943
  const supervisorId = event.target.value;
87336
87944
  const selectedSupervisor = supervisorOptions.find((option) => option.id === supervisorId);
87337
87945
  trackCoreEvent("Operations Overview Supervisor Filter Changed", {
@@ -87342,7 +87950,7 @@ var OperationsOverviewHeader = React146__default.memo(({
87342
87950
  });
87343
87951
  onSelectedSupervisorIdChange(supervisorId);
87344
87952
  }, [availableLineIds, onSelectedSupervisorIdChange, supervisorOptions]);
87345
- const handleLineToggle = React146__default.useCallback((lineId) => {
87953
+ const handleLineToggle = React147__default.useCallback((lineId) => {
87346
87954
  const current = new Set(selectedLineIds);
87347
87955
  if (current.has(lineId)) {
87348
87956
  if (current.size <= 1) return;
@@ -87358,13 +87966,13 @@ var OperationsOverviewHeader = React146__default.memo(({
87358
87966
  });
87359
87967
  onSelectedLineIdsChange(next);
87360
87968
  }, [availableLineIds, onSelectedLineIdsChange, selectedLineIds]);
87361
- const handleClearAllFilters = React146__default.useCallback(() => {
87969
+ const handleClearAllFilters = React147__default.useCallback(() => {
87362
87970
  onTrendModeChange("all");
87363
87971
  onSelectedSupervisorIdChange("all");
87364
87972
  onSelectedLineIdsChange(availableLineIds);
87365
87973
  setIsFilterOpen(false);
87366
87974
  }, [availableLineIds, onSelectedLineIdsChange, onSelectedSupervisorIdChange, onTrendModeChange]);
87367
- React146__default.useEffect(() => {
87975
+ React147__default.useEffect(() => {
87368
87976
  const handleClickOutside = (event) => {
87369
87977
  const target = event.target;
87370
87978
  if (filterRef.current && !filterRef.current.contains(target) && filterButtonRef.current && !filterButtonRef.current.contains(target) && mobileFilterButtonRef.current && !mobileFilterButtonRef.current.contains(target)) {
@@ -87599,12 +88207,12 @@ var OperationsOverviewHeader = React146__default.memo(({
87599
88207
  ] }) });
87600
88208
  });
87601
88209
  OperationsOverviewHeader.displayName = "OperationsOverviewHeader";
87602
- var OverviewSummaryCards = React146__default.memo(({ store }) => {
88210
+ var OverviewSummaryCards = React147__default.memo(({ store }) => {
87603
88211
  bumpRenderCounter();
87604
88212
  const scope = useOperationsOverviewScope(store);
87605
88213
  const snapshot = useOperationsOverviewSnapshot(store);
87606
88214
  const showSnapshotSkeleton = snapshot.loading && !snapshot.hasLoadedOnce;
87607
- const comparisonLabel = React146__default.useMemo(() => {
88215
+ const comparisonLabel = React147__default.useMemo(() => {
87608
88216
  return formatComparisonWindow({
87609
88217
  currentDayCount: scope.current_range?.day_count ?? null,
87610
88218
  previousDayCount: scope.previous_range?.day_count ?? null,
@@ -87617,27 +88225,27 @@ var OverviewSummaryCards = React146__default.memo(({ store }) => {
87617
88225
  scope.previous_range?.day_count,
87618
88226
  scope.shift_mode
87619
88227
  ]);
87620
- const [isIdleContributorsOpen, setIsIdleContributorsOpen] = React146__default.useState(false);
87621
- const [isIdleContributorsPinned, setIsIdleContributorsPinned] = React146__default.useState(false);
87622
- const idleContributorsRef = React146__default.useRef(null);
87623
- const plantEfficiencyBadge = React146__default.useMemo(() => {
88228
+ const [isIdleContributorsOpen, setIsIdleContributorsOpen] = React147__default.useState(false);
88229
+ const [isIdleContributorsPinned, setIsIdleContributorsPinned] = React147__default.useState(false);
88230
+ const idleContributorsRef = React147__default.useRef(null);
88231
+ const plantEfficiencyBadge = React147__default.useMemo(() => {
87624
88232
  return buildDeltaBadge(snapshot.data.summary.plant_efficiency?.delta_pp, {
87625
88233
  positiveIsGood: true,
87626
88234
  formatter: (value) => `${value >= 0 ? "+" : ""}${roundOne(value)}%`,
87627
88235
  comparisonLabel
87628
88236
  });
87629
88237
  }, [comparisonLabel, snapshot.data.summary.plant_efficiency?.delta_pp]);
87630
- const idleBadge = React146__default.useMemo(() => {
88238
+ const idleBadge = React147__default.useMemo(() => {
87631
88239
  return buildDeltaBadge(snapshot.data.summary.avg_idle_per_workstation?.delta_seconds, {
87632
88240
  positiveIsGood: false,
87633
88241
  formatter: (value) => formatSignedIdleDuration(value),
87634
88242
  comparisonLabel
87635
88243
  });
87636
88244
  }, [comparisonLabel, snapshot.data.summary.avg_idle_per_workstation?.delta_seconds]);
87637
- const canInspectIdleContributors = React146__default.useMemo(() => {
88245
+ const canInspectIdleContributors = React147__default.useMemo(() => {
87638
88246
  return !showSnapshotSkeleton && snapshot.data.summary.avg_idle_per_workstation?.current_seconds !== null && snapshot.data.summary.avg_idle_per_workstation?.current_seconds !== void 0;
87639
88247
  }, [showSnapshotSkeleton, snapshot.data.summary.avg_idle_per_workstation?.current_seconds]);
87640
- const idleTopContributors = React146__default.useMemo(() => {
88248
+ const idleTopContributors = React147__default.useMemo(() => {
87641
88249
  return (snapshot.data.summary.avg_idle_per_workstation?.top_contributors || []).map((item) => ({
87642
88250
  workspaceId: item.workspace_id || "",
87643
88251
  workspaceName: item.workspace_name?.trim() || item.workspace_id || "Unknown",
@@ -87645,14 +88253,14 @@ var OverviewSummaryCards = React146__default.memo(({ store }) => {
87645
88253
  avgIdleSeconds: toNumber4(item.avg_idle_seconds)
87646
88254
  })).slice(0, 5);
87647
88255
  }, [snapshot.data.summary.avg_idle_per_workstation?.top_contributors]);
87648
- const showIdleContributorLineNames = React146__default.useMemo(() => {
88256
+ const showIdleContributorLineNames = React147__default.useMemo(() => {
87649
88257
  return (scope.line_count ?? 0) > 1;
87650
88258
  }, [scope.line_count]);
87651
- const closeIdleContributors = React146__default.useCallback(() => {
88259
+ const closeIdleContributors = React147__default.useCallback(() => {
87652
88260
  setIsIdleContributorsOpen(false);
87653
88261
  setIsIdleContributorsPinned(false);
87654
88262
  }, []);
87655
- const handleIdleContributorsToggle = React146__default.useCallback(() => {
88263
+ const handleIdleContributorsToggle = React147__default.useCallback(() => {
87656
88264
  if (!canInspectIdleContributors) return;
87657
88265
  setIsIdleContributorsPinned((previous) => {
87658
88266
  const next = !previous;
@@ -87660,7 +88268,7 @@ var OverviewSummaryCards = React146__default.memo(({ store }) => {
87660
88268
  return next;
87661
88269
  });
87662
88270
  }, [canInspectIdleContributors]);
87663
- const handleIdleContributorsKeyDown = React146__default.useCallback((event) => {
88271
+ const handleIdleContributorsKeyDown = React147__default.useCallback((event) => {
87664
88272
  if (!canInspectIdleContributors) return;
87665
88273
  if (event.key === "Enter" || event.key === " ") {
87666
88274
  event.preventDefault();
@@ -87672,11 +88280,11 @@ var OverviewSummaryCards = React146__default.memo(({ store }) => {
87672
88280
  closeIdleContributors();
87673
88281
  }
87674
88282
  }, [canInspectIdleContributors, closeIdleContributors, handleIdleContributorsToggle]);
87675
- React146__default.useEffect(() => {
88283
+ React147__default.useEffect(() => {
87676
88284
  setIsIdleContributorsOpen(false);
87677
88285
  setIsIdleContributorsPinned(false);
87678
88286
  }, [scope.comparison_strategy, scope.current_range?.start_date, scope.current_range?.end_date, scope.line_count, scope.shift_mode]);
87679
- React146__default.useEffect(() => {
88287
+ React147__default.useEffect(() => {
87680
88288
  if (!isIdleContributorsOpen) return void 0;
87681
88289
  const handleClickOutside = (event) => {
87682
88290
  if (!isIdleContributorsPinned) return;
@@ -87814,7 +88422,7 @@ var OverviewSummaryCards = React146__default.memo(({ store }) => {
87814
88422
  ] });
87815
88423
  });
87816
88424
  OverviewSummaryCards.displayName = "OverviewSummaryCards";
87817
- var PoorestPerformersCard = React146__default.memo(({
88425
+ var PoorestPerformersCard = React147__default.memo(({
87818
88426
  store,
87819
88427
  supervisorsByLineId,
87820
88428
  onViewAll,
@@ -87823,9 +88431,9 @@ var PoorestPerformersCard = React146__default.memo(({
87823
88431
  bumpRenderCounter();
87824
88432
  const scope = useOperationsOverviewScope(store);
87825
88433
  const snapshot = useOperationsOverviewSnapshot(store);
87826
- const [poorestLineMode, setPoorestLineMode] = React146__default.useState("output");
88434
+ const [poorestLineMode, setPoorestLineMode] = React147__default.useState("output");
87827
88435
  const availableLineModes = scope.available_line_modes;
87828
- React146__default.useEffect(() => {
88436
+ React147__default.useEffect(() => {
87829
88437
  const hasOutput = !!availableLineModes?.has_output;
87830
88438
  const hasUptime = !!availableLineModes?.has_uptime;
87831
88439
  if (hasOutput && !hasUptime && poorestLineMode !== "output") {
@@ -87834,7 +88442,7 @@ var PoorestPerformersCard = React146__default.memo(({
87834
88442
  setPoorestLineMode("uptime");
87835
88443
  }
87836
88444
  }, [availableLineModes?.has_output, availableLineModes?.has_uptime, poorestLineMode]);
87837
- const comparisonLabel = React146__default.useMemo(() => {
88445
+ const comparisonLabel = React147__default.useMemo(() => {
87838
88446
  return formatComparisonWindow({
87839
88447
  currentDayCount: scope.current_range?.day_count ?? null,
87840
88448
  previousDayCount: scope.previous_range?.day_count ?? null,
@@ -87848,7 +88456,7 @@ var PoorestPerformersCard = React146__default.memo(({
87848
88456
  scope.shift_mode
87849
88457
  ]);
87850
88458
  const showSnapshotSkeleton = snapshot.loading && !snapshot.hasLoadedOnce;
87851
- const mergedPoorestLines = React146__default.useMemo(() => {
88459
+ const mergedPoorestLines = React147__default.useMemo(() => {
87852
88460
  const rows = snapshot.data.poorest_lines?.[poorestLineMode] || [];
87853
88461
  const lineRows = [];
87854
88462
  const areaGroups = /* @__PURE__ */ new Map();
@@ -87928,7 +88536,7 @@ var PoorestPerformersCard = React146__default.memo(({
87928
88536
  }, [poorestLineMode, snapshot.data.poorest_lines, supervisorsByLineId]);
87929
88537
  const showPoorestModeToggle = !!availableLineModes?.has_output && !!availableLineModes?.has_uptime;
87930
88538
  const poorestMetricLabel = poorestLineMode === "uptime" ? "Uptime" : "Efficiency";
87931
- const handlePoorestLineModeChange = React146__default.useCallback((mode) => {
88539
+ const handlePoorestLineModeChange = React147__default.useCallback((mode) => {
87932
88540
  trackCoreEvent("Operations Overview Poorest Line Mode Changed", { mode });
87933
88541
  setPoorestLineMode(mode);
87934
88542
  }, []);
@@ -88014,14 +88622,14 @@ var PoorestPerformersCard = React146__default.memo(({
88014
88622
  ] });
88015
88623
  });
88016
88624
  PoorestPerformersCard.displayName = "PoorestPerformersCard";
88017
- var IdleBreakdownCard = React146__default.memo(({
88625
+ var IdleBreakdownCard = React147__default.memo(({
88018
88626
  store,
88019
88627
  scopedLineCount
88020
88628
  }) => {
88021
88629
  bumpRenderCounter();
88022
88630
  const idle = useOperationsOverviewIdle(store);
88023
88631
  const showInitialSkeleton = idle.loading && idle.lastUpdated === null;
88024
- const idleBreakdown = React146__default.useMemo(() => {
88632
+ const idleBreakdown = React147__default.useMemo(() => {
88025
88633
  return idle.data.map((item) => ({
88026
88634
  name: item.display_name?.trim() || item.reason?.trim() || "Unknown",
88027
88635
  reasonKey: item.reason_key?.trim() || item.reason?.trim() || "unknown",
@@ -88040,7 +88648,7 @@ var IdleBreakdownCard = React146__default.memo(({
88040
88648
  }))
88041
88649
  })).filter((item) => item.value > 0);
88042
88650
  }, [idle.data]);
88043
- const showIdleModuleNotEnabledState = React146__default.useMemo(() => {
88651
+ const showIdleModuleNotEnabledState = React147__default.useMemo(() => {
88044
88652
  const enabledLineCount = idle.scope.idle_time_vlm_enabled_line_count;
88045
88653
  return !showInitialSkeleton && scopedLineCount > 0 && typeof enabledLineCount === "number" && enabledLineCount === 0;
88046
88654
  }, [idle.scope.idle_time_vlm_enabled_line_count, scopedLineCount, showInitialSkeleton]);
@@ -88061,7 +88669,7 @@ var IdleBreakdownCard = React146__default.memo(({
88061
88669
  ] });
88062
88670
  });
88063
88671
  IdleBreakdownCard.displayName = "IdleBreakdownCard";
88064
- var EfficiencyTrendCard = React146__default.memo(({
88672
+ var EfficiencyTrendCard = React147__default.memo(({
88065
88673
  store,
88066
88674
  dateRange,
88067
88675
  appTimezone,
@@ -88069,14 +88677,14 @@ var EfficiencyTrendCard = React146__default.memo(({
88069
88677
  }) => {
88070
88678
  bumpRenderCounter();
88071
88679
  const trend = useOperationsOverviewTrend(store);
88072
- const currentWeekRange = React146__default.useMemo(
88680
+ const currentWeekRange = React147__default.useMemo(
88073
88681
  () => getCurrentWeekToDateRange(appTimezone),
88074
88682
  [appTimezone]
88075
88683
  );
88076
88684
  const isCurrentWeekToDateRange = dateRange.startKey === currentWeekRange.startKey && dateRange.endKey === currentWeekRange.endKey;
88077
88685
  const showInitialSkeleton = trend.loading && trend.lastUpdated === null;
88078
88686
  const isHourlyTrend = trend.data.granularity === "hour";
88079
- const trendData = React146__default.useMemo(() => {
88687
+ const trendData = React147__default.useMemo(() => {
88080
88688
  if (isHourlyTrend) {
88081
88689
  return (trend.data.points || []).map((point, index) => ({
88082
88690
  name: (() => {
@@ -88148,13 +88756,13 @@ var EfficiencyTrendCard = React146__default.memo(({
88148
88756
  };
88149
88757
  });
88150
88758
  }, [currentWeekRange.startKey, hourlyLabelStartTime, isCurrentWeekToDateRange, isHourlyTrend, trend.data.points]);
88151
- const trendTooltipLabelFormatter = React146__default.useCallback((label, payload) => {
88759
+ const trendTooltipLabelFormatter = React147__default.useCallback((label, payload) => {
88152
88760
  if (isHourlyTrend) return label;
88153
88761
  const dayOfWeek = payload?.[0]?.payload?.dayOfWeek;
88154
88762
  if (!dayOfWeek || typeof label !== "string") return label;
88155
88763
  return `${label} (${dayOfWeek})`;
88156
88764
  }, [isHourlyTrend]);
88157
- const trendXAxisTickFormatter = React146__default.useCallback((value, index) => {
88765
+ const trendXAxisTickFormatter = React147__default.useCallback((value, index) => {
88158
88766
  if (!isHourlyTrend) {
88159
88767
  return typeof value === "string" ? value : String(value ?? "");
88160
88768
  }
@@ -88181,7 +88789,7 @@ var EfficiencyTrendCard = React146__default.memo(({
88181
88789
  ] });
88182
88790
  });
88183
88791
  EfficiencyTrendCard.displayName = "EfficiencyTrendCard";
88184
- var TopImprovementsCard = React146__default.memo(({
88792
+ var TopImprovementsCard = React147__default.memo(({
88185
88793
  store,
88186
88794
  supervisorsByLineId,
88187
88795
  onViewAll,
@@ -88190,7 +88798,7 @@ var TopImprovementsCard = React146__default.memo(({
88190
88798
  bumpRenderCounter();
88191
88799
  const improvements = useOperationsOverviewImprovements(store);
88192
88800
  const showInitialSkeleton = improvements.loading && improvements.lastUpdated === null;
88193
- const displayImprovements = React146__default.useMemo(() => {
88801
+ const displayImprovements = React147__default.useMemo(() => {
88194
88802
  return improvements.data.map((item) => {
88195
88803
  const supervisors = item.lineId ? supervisorsByLineId.get(item.lineId) || [] : [];
88196
88804
  return {
@@ -88318,33 +88926,33 @@ var useOperationsOverviewRefresh = ({
88318
88926
  isLiveScope,
88319
88927
  enabled = true
88320
88928
  }) => {
88321
- const lineIdsKey = React146__default.useMemo(() => lineIds.join(","), [lineIds]);
88322
- const scopeSignature = React146__default.useMemo(
88929
+ const lineIdsKey = React147__default.useMemo(() => lineIds.join(","), [lineIds]);
88930
+ const scopeSignature = React147__default.useMemo(
88323
88931
  () => [companyId || "", startKey, endKey, trendMode, comparisonStrategy || "", lineIdsKey].join("::"),
88324
88932
  [companyId, comparisonStrategy, endKey, lineIdsKey, startKey, trendMode]
88325
88933
  );
88326
- const controllersRef = React146__default.useRef({});
88327
- const requestIdsRef = React146__default.useRef({
88934
+ const controllersRef = React147__default.useRef({});
88935
+ const requestIdsRef = React147__default.useRef({
88328
88936
  snapshot: 0,
88329
88937
  trend: 0,
88330
88938
  idle: 0,
88331
88939
  improvements: 0
88332
88940
  });
88333
- const intervalRef = React146__default.useRef(null);
88334
- const isPageActiveRef = React146__default.useRef(true);
88335
- const lastResumeRefreshAtRef = React146__default.useRef(0);
88336
- const abortAll = React146__default.useCallback(() => {
88941
+ const intervalRef = React147__default.useRef(null);
88942
+ const isPageActiveRef = React147__default.useRef(true);
88943
+ const lastResumeRefreshAtRef = React147__default.useRef(0);
88944
+ const abortAll = React147__default.useCallback(() => {
88337
88945
  Object.values(controllersRef.current).forEach((controller) => {
88338
88946
  controller?.abort();
88339
88947
  });
88340
88948
  controllersRef.current = {};
88341
88949
  }, []);
88342
- React146__default.useEffect(() => {
88950
+ React147__default.useEffect(() => {
88343
88951
  return () => {
88344
88952
  abortAll();
88345
88953
  };
88346
88954
  }, [abortAll]);
88347
- const getIsPageActive = React146__default.useCallback(() => {
88955
+ const getIsPageActive = React147__default.useCallback(() => {
88348
88956
  if (typeof document === "undefined") {
88349
88957
  return true;
88350
88958
  }
@@ -88352,7 +88960,7 @@ var useOperationsOverviewRefresh = ({
88352
88960
  const hasFocus = typeof document.hasFocus === "function" ? document.hasFocus() : true;
88353
88961
  return isVisible && hasFocus;
88354
88962
  }, []);
88355
- const stopPolling = React146__default.useCallback((reason) => {
88963
+ const stopPolling = React147__default.useCallback((reason) => {
88356
88964
  if (intervalRef.current === null) {
88357
88965
  return;
88358
88966
  }
@@ -88360,7 +88968,7 @@ var useOperationsOverviewRefresh = ({
88360
88968
  intervalRef.current = null;
88361
88969
  debugRefreshLog("poll stopped", { reason });
88362
88970
  }, []);
88363
- const runRefresh = React146__default.useCallback(
88971
+ const runRefresh = React147__default.useCallback(
88364
88972
  async (section, begin, onSuccess, onError, request, reason) => {
88365
88973
  if (!enabled || !supabase || !companyId || lineIds.length === 0) return;
88366
88974
  const requestId = requestIdsRef.current[section] + 1;
@@ -88407,7 +89015,7 @@ var useOperationsOverviewRefresh = ({
88407
89015
  },
88408
89016
  [companyId, comparisonStrategy, enabled, endKey, lineIds, startKey, supabase, trendMode]
88409
89017
  );
88410
- const refreshSnapshot = React146__default.useCallback(
89018
+ const refreshSnapshot = React147__default.useCallback(
88411
89019
  async (reason) => {
88412
89020
  await runRefresh(
88413
89021
  "snapshot",
@@ -88439,7 +89047,7 @@ var useOperationsOverviewRefresh = ({
88439
89047
  },
88440
89048
  [companyId, comparisonStrategy, endKey, lineIdsKey, runRefresh, scopeSignature, startKey, store, supabase, trendMode]
88441
89049
  );
88442
- const refreshTrend = React146__default.useCallback(
89050
+ const refreshTrend = React147__default.useCallback(
88443
89051
  async (reason) => {
88444
89052
  await runRefresh(
88445
89053
  "trend",
@@ -88468,7 +89076,7 @@ var useOperationsOverviewRefresh = ({
88468
89076
  },
88469
89077
  [companyId, endKey, lineIdsKey, runRefresh, scopeSignature, startKey, store, supabase, trendMode]
88470
89078
  );
88471
- const refreshIdle = React146__default.useCallback(
89079
+ const refreshIdle = React147__default.useCallback(
88472
89080
  async (reason) => {
88473
89081
  await runRefresh(
88474
89082
  "idle",
@@ -88497,7 +89105,7 @@ var useOperationsOverviewRefresh = ({
88497
89105
  },
88498
89106
  [companyId, endKey, lineIdsKey, runRefresh, scopeSignature, startKey, store, supabase, trendMode]
88499
89107
  );
88500
- const refreshImprovements = React146__default.useCallback(
89108
+ const refreshImprovements = React147__default.useCallback(
88501
89109
  async (reason) => {
88502
89110
  await runRefresh(
88503
89111
  "improvements",
@@ -88527,7 +89135,7 @@ var useOperationsOverviewRefresh = ({
88527
89135
  },
88528
89136
  [companyId, lineIds, lineIdsKey, runRefresh, scopeSignature, store, supabase]
88529
89137
  );
88530
- const refreshAll = React146__default.useCallback(
89138
+ const refreshAll = React147__default.useCallback(
88531
89139
  async (reason) => {
88532
89140
  await Promise.allSettled([
88533
89141
  refreshSnapshot(reason),
@@ -88538,7 +89146,7 @@ var useOperationsOverviewRefresh = ({
88538
89146
  },
88539
89147
  [refreshIdle, refreshImprovements, refreshSnapshot, refreshTrend]
88540
89148
  );
88541
- const startPolling = React146__default.useCallback((reason) => {
89149
+ const startPolling = React147__default.useCallback((reason) => {
88542
89150
  if (!isLiveScope || !supabase || !companyId || lineIds.length === 0) {
88543
89151
  return;
88544
89152
  }
@@ -88559,7 +89167,7 @@ var useOperationsOverviewRefresh = ({
88559
89167
  }, LIVE_REFRESH_INTERVAL_MS);
88560
89168
  debugRefreshLog("poll started", { reason, intervalMs: LIVE_REFRESH_INTERVAL_MS });
88561
89169
  }, [companyId, isLiveScope, lineIds.length, refreshAll, stopPolling, supabase]);
88562
- const refreshFromResume = React146__default.useCallback((reason) => {
89170
+ const refreshFromResume = React147__default.useCallback((reason) => {
88563
89171
  const now4 = Date.now();
88564
89172
  if (now4 - lastResumeRefreshAtRef.current < 1e3) {
88565
89173
  debugRefreshLog("resume refresh suppressed", { reason });
@@ -88574,7 +89182,7 @@ var useOperationsOverviewRefresh = ({
88574
89182
  }
88575
89183
  });
88576
89184
  }, [refreshAll, startPolling, stopPolling]);
88577
- React146__default.useEffect(() => {
89185
+ React147__default.useEffect(() => {
88578
89186
  if (!enabled) {
88579
89187
  stopPolling("disabled");
88580
89188
  abortAll();
@@ -88589,7 +89197,7 @@ var useOperationsOverviewRefresh = ({
88589
89197
  }
88590
89198
  void refreshAll("scope_change");
88591
89199
  }, [abortAll, companyId, enabled, lineIds.length, refreshAll, scopeSignature, stopPolling, store, supabase]);
88592
- React146__default.useEffect(() => {
89200
+ React147__default.useEffect(() => {
88593
89201
  if (!enabled || !isLiveScope || !supabase || !companyId || lineIds.length === 0) {
88594
89202
  isPageActiveRef.current = false;
88595
89203
  stopPolling("live_scope_disabled");
@@ -88648,7 +89256,7 @@ var useOperationsOverviewRefresh = ({
88648
89256
  };
88649
89257
  }, [companyId, enabled, getIsPageActive, isLiveScope, lineIds.length, refreshFromResume, startPolling, stopPolling, supabase]);
88650
89258
  };
88651
- var parseTimeToMinutes4 = (value) => {
89259
+ var parseTimeToMinutes5 = (value) => {
88652
89260
  if (!value) return null;
88653
89261
  const parts = value.split(":");
88654
89262
  if (parts.length < 2) return null;
@@ -88701,8 +89309,8 @@ var classifyShiftBucket = ({
88701
89309
  return "day";
88702
89310
  }
88703
89311
  }
88704
- const startMinutes = parseTimeToMinutes4(startTime);
88705
- const endMinutes = parseTimeToMinutes4(endTime);
89312
+ const startMinutes = parseTimeToMinutes5(startTime);
89313
+ const endMinutes = parseTimeToMinutes5(endTime);
88706
89314
  if (startMinutes !== null) {
88707
89315
  if (startMinutes >= 4 * 60 && startMinutes < 18 * 60) return "day";
88708
89316
  return "night";
@@ -88761,8 +89369,8 @@ var getShiftWindowsForConfig = (shiftConfig, timezone) => {
88761
89369
  ];
88762
89370
  };
88763
89371
  var normalizeShiftWindowMinutes = (startTime, endTime) => {
88764
- const startMinutes = parseTimeToMinutes4(startTime);
88765
- const endMinutesRaw = parseTimeToMinutes4(endTime);
89372
+ const startMinutes = parseTimeToMinutes5(startTime);
89373
+ const endMinutesRaw = parseTimeToMinutes5(endTime);
88766
89374
  if (startMinutes === null || endMinutesRaw === null) {
88767
89375
  return null;
88768
89376
  }
@@ -88802,55 +89410,55 @@ var PlantHeadView = () => {
88802
89410
  const { accessibleLineIds } = useUserLineAccess();
88803
89411
  const mobileMenuContext = useMobileMenu();
88804
89412
  useHideMobileHeader(!!mobileMenuContext);
88805
- const storeRef = React146__default.useRef(createOperationsOverviewStore());
89413
+ const storeRef = React147__default.useRef(createOperationsOverviewStore());
88806
89414
  const store = storeRef.current;
88807
- const fallbackOperationalDate = React146__default.useMemo(
89415
+ const fallbackOperationalDate = React147__default.useMemo(
88808
89416
  () => getOperationalDate(appTimezone),
88809
89417
  [appTimezone]
88810
89418
  );
88811
- const [dateRange, setDateRange] = React146__default.useState(() => ({
89419
+ const [dateRange, setDateRange] = React147__default.useState(() => ({
88812
89420
  startKey: fallbackOperationalDate,
88813
89421
  endKey: fallbackOperationalDate
88814
89422
  }));
88815
- const [usesThisWeekComparison, setUsesThisWeekComparison] = React146__default.useState(false);
88816
- const [trendMode, setTrendMode] = React146__default.useState("all");
88817
- const [selectedSupervisorId, setSelectedSupervisorId] = React146__default.useState("all");
88818
- const [selectedLineIds, setSelectedLineIds] = React146__default.useState([]);
88819
- const [isInitialScopeReady, setIsInitialScopeReady] = React146__default.useState(false);
88820
- const [shiftResolutionTick, setShiftResolutionTick] = React146__default.useState(0);
88821
- const hasAutoInitializedScopeRef = React146__default.useRef(false);
88822
- const hasUserAdjustedScopeRef = React146__default.useRef(false);
88823
- React146__default.useEffect(() => {
89423
+ const [usesThisWeekComparison, setUsesThisWeekComparison] = React147__default.useState(false);
89424
+ const [trendMode, setTrendMode] = React147__default.useState("all");
89425
+ const [selectedSupervisorId, setSelectedSupervisorId] = React147__default.useState("all");
89426
+ const [selectedLineIds, setSelectedLineIds] = React147__default.useState([]);
89427
+ const [isInitialScopeReady, setIsInitialScopeReady] = React147__default.useState(false);
89428
+ const [shiftResolutionTick, setShiftResolutionTick] = React147__default.useState(0);
89429
+ const hasAutoInitializedScopeRef = React147__default.useRef(false);
89430
+ const hasUserAdjustedScopeRef = React147__default.useRef(false);
89431
+ React147__default.useEffect(() => {
88824
89432
  trackCorePageView("Operations Overview", {
88825
89433
  dashboard_surface: "operations_overview"
88826
89434
  });
88827
89435
  }, []);
88828
- const currentWeekRange = React146__default.useMemo(
89436
+ const currentWeekRange = React147__default.useMemo(
88829
89437
  () => getCurrentWeekToDateRange(appTimezone),
88830
89438
  [appTimezone]
88831
89439
  );
88832
- const currentWeekDisplayRange = React146__default.useMemo(
89440
+ const currentWeekDisplayRange = React147__default.useMemo(
88833
89441
  () => getCurrentWeekFullRange(appTimezone),
88834
89442
  [appTimezone]
88835
89443
  );
88836
89444
  const isCurrentWeekToDateRange = dateRange.startKey === currentWeekRange.startKey && dateRange.endKey === currentWeekRange.endKey;
88837
- const headerDateRange = React146__default.useMemo(() => {
89445
+ const headerDateRange = React147__default.useMemo(() => {
88838
89446
  if (usesThisWeekComparison && isCurrentWeekToDateRange) {
88839
89447
  return currentWeekDisplayRange;
88840
89448
  }
88841
89449
  return dateRange;
88842
89450
  }, [currentWeekDisplayRange, dateRange, isCurrentWeekToDateRange, usesThisWeekComparison]);
88843
- const normalizedLineIds = React146__default.useMemo(
89451
+ const normalizedLineIds = React147__default.useMemo(
88844
89452
  () => Array.from(new Set(
88845
89453
  (accessibleLineIds || []).filter(Boolean).filter((lineId) => lineId !== factoryViewId)
88846
89454
  )).sort(),
88847
89455
  [accessibleLineIds, factoryViewId]
88848
89456
  );
88849
- const lineIdsKey = React146__default.useMemo(
89457
+ const lineIdsKey = React147__default.useMemo(
88850
89458
  () => normalizedLineIds.join(","),
88851
89459
  [normalizedLineIds]
88852
89460
  );
88853
- const lineOptions = React146__default.useMemo(
89461
+ const lineOptions = React147__default.useMemo(
88854
89462
  () => normalizedLineIds.map((lineId) => ({
88855
89463
  id: lineId,
88856
89464
  name: getLineDisplayName(entityConfig, lineId)
@@ -88862,7 +89470,7 @@ var PlantHeadView = () => {
88862
89470
  companyId: entityConfig.companyId,
88863
89471
  useBackend: true
88864
89472
  });
88865
- const supervisorOptions = React146__default.useMemo(
89473
+ const supervisorOptions = React147__default.useMemo(
88866
89474
  () => {
88867
89475
  const optionsById = /* @__PURE__ */ new Map();
88868
89476
  normalizedLineIds.forEach((lineId) => {
@@ -88888,7 +89496,7 @@ var PlantHeadView = () => {
88888
89496
  },
88889
89497
  [normalizedLineIds, supervisorsByLineId]
88890
89498
  );
88891
- React146__default.useEffect(() => {
89499
+ React147__default.useEffect(() => {
88892
89500
  if (selectedSupervisorId === "all") {
88893
89501
  setSelectedLineIds((previous) => {
88894
89502
  if (normalizedLineIds.length === 0) {
@@ -88914,7 +89522,7 @@ var PlantHeadView = () => {
88914
89522
  const scopedSupervisorLineIds = normalizedLineIds.filter((lineId) => supervisorLineIdSet.has(lineId));
88915
89523
  setSelectedLineIds((previous) => previous.length === scopedSupervisorLineIds.length && previous.every((lineId, index) => lineId === scopedSupervisorLineIds[index]) ? previous : scopedSupervisorLineIds);
88916
89524
  }, [lineIdsKey, normalizedLineIds, selectedSupervisorId, supervisorOptions]);
88917
- const scopedLineIds = React146__default.useMemo(
89525
+ const scopedLineIds = React147__default.useMemo(
88918
89526
  () => selectedLineIds.length > 0 ? selectedLineIds : normalizedLineIds,
88919
89527
  [normalizedLineIds, selectedLineIds]
88920
89528
  );
@@ -88922,7 +89530,7 @@ var PlantHeadView = () => {
88922
89530
  shiftConfigMap,
88923
89531
  isLoading: isShiftConfigLoading
88924
89532
  } = useMultiLineShiftConfigs(scopedLineIds, staticShiftConfig);
88925
- const shiftFilterOptions = React146__default.useMemo(() => {
89533
+ const shiftFilterOptions = React147__default.useMemo(() => {
88926
89534
  const optionsById = /* @__PURE__ */ new Map();
88927
89535
  scopedLineIds.forEach((lineId) => {
88928
89536
  const shiftConfig = shiftConfigMap.get(lineId) || staticShiftConfig;
@@ -88961,7 +89569,7 @@ var PlantHeadView = () => {
88961
89569
  ...dynamicOptions
88962
89570
  ];
88963
89571
  }, [appTimezone, scopedLineIds, shiftConfigMap, staticShiftConfig]);
88964
- React146__default.useEffect(() => {
89572
+ React147__default.useEffect(() => {
88965
89573
  if (scopedLineIds.length === 0 || isShiftConfigLoading) {
88966
89574
  return;
88967
89575
  }
@@ -88972,11 +89580,11 @@ var PlantHeadView = () => {
88972
89580
  clearInterval(intervalId);
88973
89581
  };
88974
89582
  }, [isShiftConfigLoading, scopedLineIds.length]);
88975
- const shiftResolutionNow = React146__default.useMemo(
89583
+ const shiftResolutionNow = React147__default.useMemo(
88976
89584
  () => /* @__PURE__ */ new Date(),
88977
89585
  [shiftResolutionTick]
88978
89586
  );
88979
- const earliestDayShiftStartTime = React146__default.useMemo(() => {
89587
+ const earliestDayShiftStartTime = React147__default.useMemo(() => {
88980
89588
  const candidateStarts = [];
88981
89589
  scopedLineIds.forEach((lineId) => {
88982
89590
  const shiftConfig = shiftConfigMap.get(lineId) || staticShiftConfig;
@@ -88987,7 +89595,7 @@ var PlantHeadView = () => {
88987
89595
  startTime: shift.startTime,
88988
89596
  endTime: shift.endTime
88989
89597
  });
88990
- const startMinutes = parseTimeToMinutes4(shift.startTime);
89598
+ const startMinutes = parseTimeToMinutes5(shift.startTime);
88991
89599
  if (bucket === "day" && startMinutes !== null) {
88992
89600
  candidateStarts.push(startMinutes);
88993
89601
  }
@@ -88997,7 +89605,7 @@ var PlantHeadView = () => {
88997
89605
  scopedLineIds.forEach((lineId) => {
88998
89606
  const shiftConfig = shiftConfigMap.get(lineId) || staticShiftConfig;
88999
89607
  getShiftWindowsForConfig(shiftConfig).forEach((shift) => {
89000
- const startMinutes = parseTimeToMinutes4(shift.startTime);
89608
+ const startMinutes = parseTimeToMinutes5(shift.startTime);
89001
89609
  if (startMinutes !== null) {
89002
89610
  candidateStarts.push(startMinutes);
89003
89611
  }
@@ -89012,11 +89620,11 @@ var PlantHeadView = () => {
89012
89620
  const minutes = earliestMinutes % 60;
89013
89621
  return `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`;
89014
89622
  }, [appTimezone, scopedLineIds, shiftConfigMap, staticShiftConfig]);
89015
- const resolvedOperationalToday = React146__default.useMemo(
89623
+ const resolvedOperationalToday = React147__default.useMemo(
89016
89624
  () => getOperationalDate(appTimezone, shiftResolutionNow, earliestDayShiftStartTime),
89017
89625
  [appTimezone, earliestDayShiftStartTime, shiftResolutionNow]
89018
89626
  );
89019
- const activeLineShiftStates = React146__default.useMemo(() => {
89627
+ const activeLineShiftStates = React147__default.useMemo(() => {
89020
89628
  return scopedLineIds.flatMap((lineId) => {
89021
89629
  const shiftConfig = shiftConfigMap.get(lineId) || staticShiftConfig;
89022
89630
  const activeShift = getActiveShift(appTimezone, shiftConfig, shiftResolutionNow);
@@ -89046,7 +89654,7 @@ var PlantHeadView = () => {
89046
89654
  });
89047
89655
  }, [appTimezone, scopedLineIds, shiftConfigMap, shiftResolutionNow, staticShiftConfig]);
89048
89656
  const resolvedTrendMode = isInitialScopeReady ? trendMode : "all";
89049
- const hourlyWindowStartTime = React146__default.useMemo(() => {
89657
+ const hourlyWindowStartTime = React147__default.useMemo(() => {
89050
89658
  if (scopedLineIds.length === 0) {
89051
89659
  return null;
89052
89660
  }
@@ -89088,7 +89696,7 @@ var PlantHeadView = () => {
89088
89696
  startTime: shift.startTime,
89089
89697
  endTime: shift.endTime
89090
89698
  });
89091
- return bucket === "day" ? parseTimeToMinutes4(shift.startTime) : null;
89699
+ return bucket === "day" ? parseTimeToMinutes5(shift.startTime) : null;
89092
89700
  }).filter((value) => value !== null);
89093
89701
  }) : [];
89094
89702
  if (dayStartCandidates.length > 0) {
@@ -89103,12 +89711,12 @@ var PlantHeadView = () => {
89103
89711
  const minutes = earliestMinutes % 60;
89104
89712
  return `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`;
89105
89713
  }, [appTimezone, resolvedTrendMode, scopedLineIds, shiftConfigMap, staticShiftConfig]);
89106
- const isShiftScopeResolved = React146__default.useMemo(
89714
+ const isShiftScopeResolved = React147__default.useMemo(
89107
89715
  () => !isShiftConfigLoading,
89108
89716
  [isShiftConfigLoading]
89109
89717
  );
89110
- const initializedTimezoneRef = React146__default.useRef(appTimezone);
89111
- React146__default.useEffect(() => {
89718
+ const initializedTimezoneRef = React147__default.useRef(appTimezone);
89719
+ React147__default.useEffect(() => {
89112
89720
  if (initializedTimezoneRef.current === appTimezone) return;
89113
89721
  hasAutoInitializedScopeRef.current = false;
89114
89722
  hasUserAdjustedScopeRef.current = false;
@@ -89121,7 +89729,7 @@ var PlantHeadView = () => {
89121
89729
  setIsInitialScopeReady(false);
89122
89730
  initializedTimezoneRef.current = appTimezone;
89123
89731
  }, [appTimezone, fallbackOperationalDate]);
89124
- React146__default.useEffect(() => {
89732
+ React147__default.useEffect(() => {
89125
89733
  if (hasAutoInitializedScopeRef.current || hasUserAdjustedScopeRef.current) {
89126
89734
  return;
89127
89735
  }
@@ -89146,7 +89754,7 @@ var PlantHeadView = () => {
89146
89754
  hasAutoInitializedScopeRef.current = true;
89147
89755
  setIsInitialScopeReady(true);
89148
89756
  }, [fallbackOperationalDate, isShiftScopeResolved, resolvedOperationalToday, scopedLineIds.length]);
89149
- const handleDateRangeChange = React146__default.useCallback((range, meta) => {
89757
+ const handleDateRangeChange = React147__default.useCallback((range, meta) => {
89150
89758
  hasUserAdjustedScopeRef.current = true;
89151
89759
  setIsInitialScopeReady(true);
89152
89760
  trackCoreEvent("Operations Overview Date Range Changed", {
@@ -89164,12 +89772,12 @@ var PlantHeadView = () => {
89164
89772
  return previous;
89165
89773
  });
89166
89774
  }, []);
89167
- const handleTrendModeChange = React146__default.useCallback((mode) => {
89775
+ const handleTrendModeChange = React147__default.useCallback((mode) => {
89168
89776
  hasUserAdjustedScopeRef.current = true;
89169
89777
  setIsInitialScopeReady(true);
89170
89778
  setTrendMode(mode);
89171
89779
  }, []);
89172
- const handleSelectedLineIdsChange = React146__default.useCallback((lineIds) => {
89780
+ const handleSelectedLineIdsChange = React147__default.useCallback((lineIds) => {
89173
89781
  setSelectedSupervisorId("all");
89174
89782
  if (normalizedLineIds.length === 0) {
89175
89783
  setSelectedLineIds([]);
@@ -89180,10 +89788,10 @@ var PlantHeadView = () => {
89180
89788
  const next = normalizedLineIds.filter((lineId) => selectedSet.has(lineId));
89181
89789
  setSelectedLineIds(next.length > 0 ? next : normalizedLineIds);
89182
89790
  }, [normalizedLineIds]);
89183
- const handleSelectedSupervisorIdChange = React146__default.useCallback((supervisorId) => {
89791
+ const handleSelectedSupervisorIdChange = React147__default.useCallback((supervisorId) => {
89184
89792
  setSelectedSupervisorId(supervisorId);
89185
89793
  }, []);
89186
- const buildLineMonthlyHistoryUrl = React146__default.useCallback((lineId) => {
89794
+ const buildLineMonthlyHistoryUrl = React147__default.useCallback((lineId) => {
89187
89795
  const rangeStartDate = parseDateKeyToDate(dateRange.startKey);
89188
89796
  const params = new URLSearchParams();
89189
89797
  params.set("tab", "monthly_history");
@@ -89193,15 +89801,15 @@ var PlantHeadView = () => {
89193
89801
  params.set("rangeEnd", dateRange.endKey);
89194
89802
  return `/kpis/${lineId}?${params.toString()}`;
89195
89803
  }, [dateRange.endKey, dateRange.startKey]);
89196
- const handleViewAllPoorestPerformers = React146__default.useCallback(() => {
89804
+ const handleViewAllPoorestPerformers = React147__default.useCallback(() => {
89197
89805
  trackCoreEvent("Operations Overview View All Clicked", { section: "poorest_performers" });
89198
89806
  navigate("/kpis?tab=leaderboard");
89199
89807
  }, [navigate]);
89200
- const handleViewAllImprovements = React146__default.useCallback(() => {
89808
+ const handleViewAllImprovements = React147__default.useCallback(() => {
89201
89809
  trackCoreEvent("Operations Overview View All Clicked", { section: "improvements" });
89202
89810
  navigate("/improvement-center");
89203
89811
  }, [navigate]);
89204
- const handleOpenImprovement = React146__default.useCallback((item) => {
89812
+ const handleOpenImprovement = React147__default.useCallback((item) => {
89205
89813
  trackCoreEvent("Operations Overview Improvement Clicked", {
89206
89814
  issue_id: item.issueId,
89207
89815
  issue_number: item.issueNumber,
@@ -89212,13 +89820,13 @@ var PlantHeadView = () => {
89212
89820
  });
89213
89821
  navigate(`/improvement-center?${params.toString()}`);
89214
89822
  }, [navigate]);
89215
- const comparisonStrategy = React146__default.useMemo(() => {
89823
+ const comparisonStrategy = React147__default.useMemo(() => {
89216
89824
  if (usesThisWeekComparison && isCurrentWeekToDateRange) {
89217
89825
  return "previous_full_week";
89218
89826
  }
89219
89827
  return void 0;
89220
89828
  }, [isCurrentWeekToDateRange, usesThisWeekComparison]);
89221
- const effectiveDateRange = React146__default.useMemo(() => {
89829
+ const effectiveDateRange = React147__default.useMemo(() => {
89222
89830
  if (isInitialScopeReady) {
89223
89831
  return dateRange;
89224
89832
  }
@@ -89228,11 +89836,11 @@ var PlantHeadView = () => {
89228
89836
  endKey: nextStartKey
89229
89837
  };
89230
89838
  }, [dateRange, fallbackOperationalDate, isInitialScopeReady, resolvedOperationalToday]);
89231
- const effectiveTrendMode = React146__default.useMemo(
89839
+ const effectiveTrendMode = React147__default.useMemo(
89232
89840
  () => resolvedTrendMode,
89233
89841
  [resolvedTrendMode]
89234
89842
  );
89235
- const hasActiveSelectedShiftLine = React146__default.useMemo(
89843
+ const hasActiveSelectedShiftLine = React147__default.useMemo(
89236
89844
  () => activeLineShiftStates.some((shift) => {
89237
89845
  if (shift.date !== resolvedOperationalToday) return false;
89238
89846
  if (effectiveTrendMode === "all") return true;
@@ -89244,7 +89852,7 @@ var PlantHeadView = () => {
89244
89852
  }),
89245
89853
  [activeLineShiftStates, effectiveTrendMode, resolvedOperationalToday]
89246
89854
  );
89247
- const activeLiveShiftName = React146__default.useMemo(
89855
+ const activeLiveShiftName = React147__default.useMemo(
89248
89856
  () => {
89249
89857
  if (effectiveTrendMode === "all") return null;
89250
89858
  const matchingShift = activeLineShiftStates.find((shift) => {
@@ -89259,17 +89867,17 @@ var PlantHeadView = () => {
89259
89867
  },
89260
89868
  [activeLineShiftStates, effectiveTrendMode, resolvedOperationalToday]
89261
89869
  );
89262
- const hourlyLabelStartTime = React146__default.useMemo(() => {
89870
+ const hourlyLabelStartTime = React147__default.useMemo(() => {
89263
89871
  if (scopedLineIds.length === 0) {
89264
89872
  return null;
89265
89873
  }
89266
89874
  return hourlyWindowStartTime;
89267
89875
  }, [hourlyWindowStartTime, scopedLineIds.length]);
89268
- const isSingleDayScope = React146__default.useMemo(
89876
+ const isSingleDayScope = React147__default.useMemo(
89269
89877
  () => effectiveDateRange.startKey === effectiveDateRange.endKey,
89270
89878
  [effectiveDateRange.endKey, effectiveDateRange.startKey]
89271
89879
  );
89272
- const isLiveScope = React146__default.useMemo(
89880
+ const isLiveScope = React147__default.useMemo(
89273
89881
  () => isSingleDayScope && effectiveDateRange.startKey === resolvedOperationalToday && hasActiveSelectedShiftLine,
89274
89882
  [
89275
89883
  effectiveDateRange.startKey,
@@ -89279,7 +89887,7 @@ var PlantHeadView = () => {
89279
89887
  resolvedOperationalToday
89280
89888
  ]
89281
89889
  );
89282
- const handleOpenLineDetails = React146__default.useCallback((line) => {
89890
+ const handleOpenLineDetails = React147__default.useCallback((line) => {
89283
89891
  trackCoreEvent("Operations Overview Line Clicked", {
89284
89892
  line_id: line.rowType === "line" ? line.id : null,
89285
89893
  line_name: line.name,
@@ -90103,4 +90711,4 @@ var RecentFlowSnapshotGrid = ({
90103
90711
  );
90104
90712
  };
90105
90713
 
90106
- export { ACTION_FAMILIES, ACTION_NAMES, AIAgentView_default as AIAgentView, AcceptInvite, AcceptInviteView_default as AcceptInviteView, AdvancedFilterDialog, AdvancedFilterPanel, AudioService, AuthCallback, AuthCallbackView_default as AuthCallbackView, AuthProvider, AuthService, AuthenticatedBottleneckClipsView, AuthenticatedFactoryView, AuthenticatedHelpView, AuthenticatedHomeView, AuthenticatedShiftsView, AuthenticatedTargetsView, AuthenticatedTicketsView, AuthenticatedWorkspaceHealthView, AvatarUpload, AxelNotificationPopup, AxelOrb, BackButton, BackButtonMinimal, BarChart, BaseHistoryCalendar, BottleneckClipsModal, BottleneckClipsView_default as BottleneckClipsView, BottlenecksContent, BreakNotificationPopup, CachePrefetchStatus, Card2 as Card, CardContent2 as CardContent, CardDescription2 as CardDescription, CardFooter2 as CardFooter, CardHeader2 as CardHeader, CardTitle2 as CardTitle, ChangeRoleDialog, ClipFilterProvider, ClipsCostView_default as ClipsCostView, CompactWorkspaceHealthCard, ConfirmRemoveUserDialog, CongratulationsOverlay, CroppedHlsVideoPlayer, CroppedVideoPlayer, CycleTimeChart, CycleTimeOverTimeChart, DEFAULT_ANALYTICS_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_DATE_TIME_CONFIG, DEFAULT_ENDPOINTS_CONFIG, DEFAULT_ENTITY_CONFIG, DEFAULT_HOME_VIEW_CONFIG, DEFAULT_MAP_VIEW_CONFIG, DEFAULT_SHIFT_CONFIG, DEFAULT_SHIFT_DATA, 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, DetailedHealthStatus, DiagnosisVideoModal, EFFICIENCY_ON_TRACK_THRESHOLD, EmptyStateMessage, EncouragementOverlay, FactoryAssignmentDropdown, FactoryView_default as FactoryView, FileManagerFilters, FilterDialogTrigger, FirstTimeLoginDebug, FirstTimeLoginHandler, FittingTitle, GaugeChart, GridComponentsPlaceholder, HamburgerButton, Header, HealthDateShiftSelector, HealthStatusGrid, HealthStatusIndicator, HelpView_default as HelpView, HlsVideoPlayer, HomeView_default as HomeView, HourlyOutputChart2 as HourlyOutputChart, HourlyUptimeChart, ISTTimer_default as ISTTimer, IdleTimeVlmConfigProvider, ImprovementCenterView_default as ImprovementCenterView, InlineEditableText, InteractiveOnboardingTour, InvitationService, InvitationsTable, InviteUserDialog, KPICard, KPIDetailView_default as KPIDetailView, KPIGrid, KPIHeader, KPISection, KPI_SIGNAL_LABELS, KPIsOverviewView_default as KPIsOverviewView, LINE_1_UUID, LINE_2_UUID, LargeOutputProgressChart, LeaderboardDetailView_default as LeaderboardDetailView, Legend5 as Legend, LineAssignmentDropdown, LineChart, LineHistoryCalendar, LineMonthlyHistory, LineMonthlyPdfGenerator, LineOvertakeNotificationManager, LinePdfExportButton, LinePdfGenerator, LineWhatsAppShareButton, LinesService, LiveTimer, LoadingInline, LoadingOverlay_default as LoadingOverlay, LoadingPage_default as LoadingPage, LoadingSkeleton, LoadingState, LoginPage, LoginView_default as LoginView, Logo, MainLayout, MapGridView, MetricCard_default as MetricCard, MinimalOnboardingPopup, MobileMenuProvider, NewClipsNotification, NoWorkspaceData, OnboardingDemo, OnboardingTour, OptifyeAgentClient, OptifyeLogoLoader_default as OptifyeLogoLoader, OutputProgressChart, PageHeader, PieChart4 as PieChart, PlantHeadView_default as PlantHeadView, PlayPauseIndicator, PrefetchConfigurationError, PrefetchError, PrefetchEvents, PrefetchStatus, PrefetchTimeoutError, ProductionPlanApiError, ProductionPlanView_default as ProductionPlanView, ProfileView_default as ProfileView, ROOT_DASHBOARD_EVENT_NAMES, RecentFlowSnapshotGrid, RegistryProvider, RoleBadge, S3ClipsSupabaseService as S3ClipsService, S3Service, SENTRY_HANDLED_EVENT_SESSION_LIMIT, SENTRY_HANDLED_EVENT_WINDOW_MS, SENTRY_QUOTA_STORAGE_KEY, SKUManagementView, SOPComplianceChart, SSEChatClient, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SessionTracker, SessionTrackingContext, SessionTrackingProvider, SettingsPopup, ShiftDisplay_default as ShiftDisplay, ShiftsView_default as ShiftsView, SideNavBar, SignupWithInvitation, SilentErrorBoundary, SimpleOnboardingPopup, SingleVideoStream_default as SingleVideoStream, Skeleton, SubscriptionManager, SubscriptionManagerProvider, SupabaseProvider, SupervisorDropdown_default as SupervisorDropdown, SupervisorManagementView_default as SupervisorManagementView, SupervisorService, TargetWorkspaceGrid, TargetsView_default as TargetsView, TeamManagementView_default as TeamManagementView, ThreadSidebar, TicketHistory_default as TicketHistory, TicketHistoryService, TicketsView_default as TicketsView, TimeDisplay_default as TimeDisplay, TimePickerDropdown, Timer_default as Timer, TimezoneProvider, TimezoneService, UptimeDonutChart, UptimeLineChart, UptimeMetricCards, UserAvatar, UserManagementService, UserManagementTable, UserService, UserUsageDetailModal, UserUsageStats, VideoCard, VideoGridView, VideoPlayer, VideoPreloader, WORKSPACE_POSITIONS, WhatsAppShareButton, WorkspaceCard, WorkspaceCycleTimeMetricCards, WorkspaceDetailView_default as WorkspaceDetailView, WorkspaceDisplayNameExample, WorkspaceGrid, WorkspaceGridItem, WorkspaceHealthCard, WorkspaceHealthView_default as WorkspaceHealthView, WorkspaceHistoryCalendar, WorkspaceMetricCards, WorkspaceMetricCardsImpl, WorkspaceMonthlyDataFetcher, WorkspaceMonthlyHistory, WorkspaceMonthlyPdfGenerator, WorkspacePdfExportButton, WorkspacePdfGenerator, WorkspaceWhatsAppShareButton, actionService, addSentryBreadcrumb, aggregateKPIsFromLineMetricsRows, aggregateLineSignals, alertsService, apiUtils, areAllLinesOnSameShift, authCoreService, authOTPService, authRateLimitService, awardsService, buildDateKey, buildKPIsFromLineMetricsRow, buildKpiLineHierarchy, buildLegacyLineOvertakeEventKey, buildLineLeaderboardRows, buildLineOvertakeEventKey, buildLineSkuBreakdown, buildShiftGroupsKey, canPermissionEditProductionPlan, canRoleAccessDashboardPath, canRoleAccessTeamManagement, canRoleAssignFactories, canRoleAssignLines, canRoleChangeRole, canRoleEditProductionPlan, canRoleInviteRole, canRoleManageCompany, canRoleManageTargets, canRoleManageUsers, canRoleRemoveUser, canRoleViewClipsCost, canRoleViewUsageStats, captureHandledFrontendException, captureSentryException, captureSentryMessage, checkRateLimit2 as checkRateLimit, clearAllRateLimits2 as clearAllRateLimits, clearRateLimit2 as clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearSentryContext, clearWorkspaceDisplayNamesCache, cn, combineLineMetricsRows, countRealSkus, createDefaultKPIs, createInvitationService, createLinesService, createSessionTracker, createStorageService, createStreamProxyHandler, createSupabaseClient, createSupervisorService, createThrottledReload, createUserManagementService, createUserService, dashboardService, deleteThread, detectLineOvertakeEvents, fetchIdleTimeReasons, fetchLineDummySkuId, fetchLineSkuCatalog, filterDataByDateKeyRange, filterRealSkuBreakdown, forceRefreshWorkspaceDisplayNames, formatAwardMonth, formatDateInZone, formatDateKeyForDisplay, formatDateTimeInZone, formatDuration2 as formatDuration, formatISTDate, formatIdleTime, formatRangeLabel, formatReasonLabel, formatRelativeTime, formatTimeInZone, fromUrlFriendlyName, getActionDisplayName, getActiveShift, getAllLineDisplayNames, getAllThreadMessages, getAllWorkspaceDisplayNamesAsync, getAllWorkspaceDisplayNamesSnapshot, getAnonClient, getAssignableRoles, getAssignmentColumnLabel, getAvailableShiftIds, getAwardBadgeType, getAwardDescription, getAwardTitle, getBrowserName, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getConfiguredLineIds, getCoreSessionRecordingProperties, getCoreSessionReplayUrl, getCurrentShift, getCurrentShiftForLine, getCurrentTimeInZone, getCurrentWeekFullRange, getCurrentWeekToDateRange, getDashboardHeaderTimeInZone, getDateKeyFromDate, getDateKeyFromValue, getDayDateKey, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultLineId, getDefaultTabForWorkspace, getInitials, getKpiSignalLabel, getKpiSignalStatus, getLineDisplayName, getManufacturingInsights, getMetricsTablePrefix, getMonthKeyBounds, getMonthWeekRanges, getMonthlyTrendComparisonLabel, getNextUpdateInterval, getOperationalDate, getRoleAssignmentKind, getRoleDescription, getRoleLabel, getRoleMetadata, getRoleNavPaths, getS3SignedUrl, getS3VideoSrc, getShiftData, getShiftNameById, getShiftWorkDurationSeconds, getShortShiftName, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getSubscriptionManager, getThreadMessages, getUniformShiftGroup, getUserThreads, getUserThreadsPaginated, getVisibleRolesForCurrentUser, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceNavigationParams, groupLinesByShift, hasAnyShiftData, identifyCoreUser, initializeCoreMixpanel, isEfficiencyOnTrack, isFactoryScopedRole, isFullMonthRange, isIgnorableFrontendError, isLegacyConfiguration, isLoopbackHostname, isPrefetchError, isRealSku, isRecentFlowVideoGridMetricMode, isSafari, isSupervisorRole, isTransitionPeriod, isUrlPermanentlyFailed, isValidFactoryViewConfiguration, isValidLineInfoPayload, isValidPrefetchParams, isValidPrefetchStatus, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWipGatedVideoGridMetricMode, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, lineLeaderboardService, linesService, mergeWithDefaultConfig, migrateLegacyConfiguration, normalizeActionFamily, normalizeDateKeyRange, normalizeDateKeyRangeUnbounded, normalizeRoleLevel, normalizeVideoGridMetricMode, optifyeAgentClient, parseDateKeyToDate, parseS3Uri, pickPreferredLineMetricsRow, preInitializeWorkspaceDisplayNames, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, productionPlanService, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, resetFailedUrl, resetSentryQuotaForTests, resetSubscriptionManager, resolveDefaultSkuId, resolveLiveSkuId, s3VideoPreloader, selectPreferredLineMetricsRow, setSentryUserContext, setSentryWorkspaceContext, shouldEnableLocalDevTestLogin, shuffleArray, simulateApiDelay, skuService, startCoreSessionRecording, stopCoreSessionRecording, storeWorkspaceMapping, streamProxyConfig, subscribeWorkspaceDisplayNames, throttledReloadDashboard, toUrlFriendlyName, trackCoreEvent, trackCorePageView, transformToChartData, updateThreadTitle, upsertWorkspaceDisplayNameInCache, useAccessControl, useActiveBreaks, useActiveLineId, useAllWorkspaceMetrics, useAnalyticsConfig, useAppTimezone, useAudioService, useAuth, useAuthConfig, useAxelNotifications, useCanSaveTargets, useClipFilter, useClipTypes, useClipTypesWithCounts, useClipsInit, useCompanyClipsCost, useCompanyFastSlowClipFiltersEnabled, useCompanyHasVlmEnabledLine, useCompanyUsersUsage, useComponentOverride, useCustomConfig, useDashboardConfig, useDashboardMetrics, useDatabaseConfig, useDateFormatter, useDateTimeConfig, useDynamicShiftConfig, useEndpointsConfig, useEntityConfig, useFactoryOverviewMetrics, useFeatureFlags, useFormatNumber, useHasLineAccess, useHideMobileHeader, useHistoricWorkspaceMetrics, useHlsStream, useHlsStreamWithCropping, useHookOverride, useHourEndTimer, useHourlyTargetAchievements, useHourlyTargetMisses, useIdleTimeClipClassifications, useIdleTimeReasons, useIdleTimeVlmConfig, useKpiTrends, useLeaderboardMetrics, useLineDetailedMetrics, useLineKPIs, useLineMetrics, useLineShiftConfig, useLineSupervisor, useLineWorkspaceMetrics, useLines, useMessages, useMetrics, useMobileMenu, useMonthlyTrend, useMultiLineShiftConfigs, useNavigation, useOperationalShiftKey, useOptionalSupabase, useOverrides, usePageOverride, usePrefetchClipCounts, useRealtimeLineMetrics, useRegistry, useSKUs, useSessionKeepAlive, useSessionTracking, useSessionTrackingContext, useShiftConfig, useShiftGroups, useShifts, useSubscriptionManager, useSubscriptionManagerSafe, useSupabase, useSupabaseClient, useSupervisorsByLineIds, useTargets, useTeamManagementPermissions, useTheme, useThemeConfig, useThreads, useTicketHistory, useTimezoneContext, useUserLineAccess, useUserUsage, useVideoConfig, useWorkspaceConfig, useWorkspaceDetailedMetrics, useWorkspaceDisplayName, useWorkspaceDisplayNames, useWorkspaceDisplayNamesMap, useWorkspaceHealthById, useWorkspaceHealthLastSeen, useWorkspaceHealthStatus, useWorkspaceMetrics, useWorkspaceNavigation, useWorkspaceOperators, useWorkspaceUptimeTimeline, useWorkspaceVideoStreams, userService, videoPrefetchManager, videoPreloader, weeklyTopPerformerService, whatsappService, withAccessControl, withAuth, withRegistry, withTimezone, workspaceHealthService, workspaceService };
90714
+ export { ACTION_FAMILIES, ACTION_NAMES, AIAgentView_default as AIAgentView, AcceptInvite, AcceptInviteView_default as AcceptInviteView, AdvancedFilterDialog, AdvancedFilterPanel, AudioService, AuthCallback, AuthCallbackView_default as AuthCallbackView, AuthProvider, AuthService, AuthenticatedBottleneckClipsView, AuthenticatedFactoryView, AuthenticatedHelpView, AuthenticatedHomeView, AuthenticatedShiftsView, AuthenticatedTargetsView, AuthenticatedTicketsView, AuthenticatedWorkspaceHealthView, AvatarUpload, AxelNotificationPopup, AxelOrb, BackButton, BackButtonMinimal, BarChart, BaseHistoryCalendar, BottleneckClipsModal, BottleneckClipsView_default as BottleneckClipsView, BottlenecksContent, BreakNotificationPopup, CachePrefetchStatus, Card2 as Card, CardContent2 as CardContent, CardDescription2 as CardDescription, CardFooter2 as CardFooter, CardHeader2 as CardHeader, CardTitle2 as CardTitle, ChangeRoleDialog, ClipFilterProvider, ClipsCostView_default as ClipsCostView, CompactWorkspaceHealthCard, ConfirmRemoveUserDialog, CongratulationsOverlay, CroppedHlsVideoPlayer, CroppedVideoPlayer, CycleTimeChart, CycleTimeOverTimeChart, DEFAULT_ANALYTICS_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_DATE_TIME_CONFIG, DEFAULT_ENDPOINTS_CONFIG, DEFAULT_ENTITY_CONFIG, DEFAULT_HOME_VIEW_CONFIG, DEFAULT_MAP_VIEW_CONFIG, DEFAULT_SHIFT_CONFIG, DEFAULT_SHIFT_DATA, 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, DetailedHealthStatus, DiagnosisVideoModal, EFFICIENCY_ON_TRACK_THRESHOLD, EmptyStateMessage, EncouragementOverlay, FactoryAssignmentDropdown, FactoryView_default as FactoryView, FileManagerFilters, FilterDialogTrigger, FirstTimeLoginDebug, FirstTimeLoginHandler, FittingTitle, GaugeChart, GridComponentsPlaceholder, HamburgerButton, Header, HealthDateShiftSelector, HealthStatusGrid, HealthStatusIndicator, HelpView_default as HelpView, HlsVideoPlayer, HomeView_default as HomeView, HourlyOutputChart2 as HourlyOutputChart, HourlyUptimeChart, ISTTimer_default as ISTTimer, IdleTimeVlmConfigProvider, ImprovementCenterView_default as ImprovementCenterView, InlineEditableText, InteractiveOnboardingTour, InvitationService, InvitationsTable, InviteUserDialog, KPICard, KPIDetailView_default as KPIDetailView, KPIGrid, KPIHeader, KPISection, KPI_SIGNAL_LABELS, KPIsOverviewView_default as KPIsOverviewView, LINE_1_UUID, LINE_2_UUID, LargeOutputProgressChart, LeaderboardDetailView_default as LeaderboardDetailView, Legend5 as Legend, LineAssignmentDropdown, LineChart, LineHistoryCalendar, LineMonthlyHistory, LineMonthlyPdfGenerator, LineOvertakeNotificationManager, LinePdfExportButton, LinePdfGenerator, LineWhatsAppShareButton, LinesService, LiveTimer, LoadingInline, LoadingOverlay_default as LoadingOverlay, LoadingPage_default as LoadingPage, LoadingSkeleton, LoadingState, LoginPage, LoginView_default as LoginView, Logo, MainLayout, MapGridView, MetricCard_default as MetricCard, MinimalOnboardingPopup, MobileMenuProvider, NewClipsNotification, NoWorkspaceData, OnboardingDemo, OnboardingTour, OptifyeAgentClient, OptifyeLogoLoader_default as OptifyeLogoLoader, OutputProgressChart, PageHeader, PieChart4 as PieChart, PlantHeadView_default as PlantHeadView, PlayPauseIndicator, PrefetchConfigurationError, PrefetchError, PrefetchEvents, PrefetchStatus, PrefetchTimeoutError, ProductionPlanApiError, ProductionPlanView_default as ProductionPlanView, ProfileView_default as ProfileView, ROOT_DASHBOARD_EVENT_NAMES, RecentFlowSnapshotGrid, RegistryProvider, RoleBadge, S3ClipsSupabaseService as S3ClipsService, S3Service, SENTRY_HANDLED_EVENT_SESSION_LIMIT, SENTRY_HANDLED_EVENT_WINDOW_MS, SENTRY_QUOTA_STORAGE_KEY, SKUManagementView, SOPComplianceChart, SSEChatClient, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SessionTracker, SessionTrackingContext, SessionTrackingProvider, SettingsPopup, ShiftDisplay_default as ShiftDisplay, ShiftsView_default as ShiftsView, SideNavBar, SignupWithInvitation, SilentErrorBoundary, SimpleOnboardingPopup, SingleVideoStream_default as SingleVideoStream, Skeleton, SubscriptionManager, SubscriptionManagerProvider, SupabaseProvider, SupervisorDropdown_default as SupervisorDropdown, SupervisorManagementView_default as SupervisorManagementView, SupervisorService, TargetWorkspaceGrid, TargetsView_default as TargetsView, TeamManagementView_default as TeamManagementView, ThreadSidebar, TicketHistory_default as TicketHistory, TicketHistoryService, TicketsView_default as TicketsView, TimeDisplay_default as TimeDisplay, TimePickerDropdown, Timer_default as Timer, TimezoneProvider, TimezoneService, UptimeDonutChart, UptimeLineChart, UptimeMetricCards, UserAvatar, UserManagementService, UserManagementTable, UserService, UserUsageDetailModal, UserUsageStats, VideoCard, VideoGridView, VideoPlayer, VideoPreloader, WORKSPACE_POSITIONS, WhatsAppShareButton, WorkspaceCard, WorkspaceCycleTimeMetricCards, WorkspaceDetailView_default as WorkspaceDetailView, WorkspaceDisplayNameExample, WorkspaceGrid, WorkspaceGridItem, WorkspaceHealthCard, WorkspaceHealthView_default as WorkspaceHealthView, WorkspaceHistoryCalendar, WorkspaceMetricCards, WorkspaceMetricCardsImpl, WorkspaceMonthlyDataFetcher, WorkspaceMonthlyHistory, WorkspaceMonthlyPdfGenerator, WorkspacePdfExportButton, WorkspacePdfGenerator, WorkspaceWhatsAppShareButton, actionService, addSentryBreadcrumb, aggregateKPIsFromLineMetricsRows, aggregateLineSignals, alertsService, apiUtils, areAllLinesOnSameShift, authCoreService, authOTPService, authRateLimitService, awardsService, buildDateKey, buildKPIsFromLineMetricsRow, buildKpiLineHierarchy, buildLegacyLineOvertakeEventKey, buildLineLeaderboardRows, buildLineOvertakeEventKey, buildLineSkuBreakdown, buildShiftGroupsKey, canPermissionEditProductionPlan, canRoleAccessDashboardPath, canRoleAccessTeamManagement, canRoleAssignFactories, canRoleAssignLines, canRoleChangeRole, canRoleEditProductionPlan, canRoleInviteRole, canRoleManageCompany, canRoleManageTargets, canRoleManageUsers, canRoleRemoveUser, canRoleViewClipsCost, canRoleViewUsageStats, captureHandledFrontendException, captureSentryException, captureSentryMessage, checkRateLimit2 as checkRateLimit, clearAllRateLimits2 as clearAllRateLimits, clearRateLimit2 as clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearSentryContext, clearWorkspaceDisplayNamesCache, cn, combineLineMetricsRows, countRealSkus, createDefaultKPIs, createInvitationService, createLinesService, createSessionTracker, createStorageService, createStreamProxyHandler, createSupabaseClient, createSupervisorService, createThrottledReload, createUserManagementService, createUserService, dashboardService, deleteThread, detectLineOvertakeEvents, fetchIdleTimeReasons, fetchLineDummySkuId, fetchLineSkuCatalog, filterDataByDateKeyRange, filterRealSkuBreakdown, forceRefreshWorkspaceDisplayNames, formatAwardMonth, formatDateInZone, formatDateKeyForDisplay, formatDateTimeInZone, formatDuration2 as formatDuration, formatISTDate, formatIdleTime, formatRangeLabel, formatReasonLabel, formatRelativeTime, formatTimeInZone, fromUrlFriendlyName, getActionDisplayName, getActiveShift, getAllLineDisplayNames, getAllThreadMessages, getAllWorkspaceDisplayNamesAsync, getAllWorkspaceDisplayNamesSnapshot, getAnonClient, getAssignableRoles, getAssignmentColumnLabel, getAvailableShiftIds, getAwardBadgeType, getAwardDescription, getAwardTitle, getBrowserName, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getConfiguredLineIds, getCoreSessionRecordingProperties, getCoreSessionReplayUrl, getCurrentShift, getCurrentShiftForLine, getCurrentTimeInZone, getCurrentWeekFullRange, getCurrentWeekToDateRange, getDashboardHeaderTimeInZone, getDateKeyFromDate, getDateKeyFromValue, getDayDateKey, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultLineId, getDefaultTabForWorkspace, getInitials, getKpiSignalLabel, getKpiSignalStatus, getLineDisplayName, getManufacturingInsights, getMetricsTablePrefix, getMonthKeyBounds, getMonthWeekRanges, getMonthlyTrendComparisonLabel, getNextUpdateInterval, getOperationalDate, getRoleAssignmentKind, getRoleDescription, getRoleLabel, getRoleMetadata, getRoleNavPaths, getS3SignedUrl, getS3VideoSrc, getShiftData, getShiftNameById, getShiftWorkDurationSeconds, getShortShiftName, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getSubscriptionManager, getThreadMessages, getUniformShiftGroup, getUserThreads, getUserThreadsPaginated, getVisibleRolesForCurrentUser, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceNavigationParams, groupLinesByShift, hasAnyShiftData, identifyCoreUser, initializeCoreMixpanel, isEfficiencyOnTrack, isFactoryScopedRole, isFullMonthRange, isIgnorableFrontendError, isLegacyConfiguration, isLoopbackHostname, isPrefetchError, isRealSku, isRecentFlowVideoGridMetricMode, isSafari, isSupervisorRole, isTransitionPeriod, isUrlPermanentlyFailed, isValidFactoryViewConfiguration, isValidLineInfoPayload, isValidPrefetchParams, isValidPrefetchStatus, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWipGatedVideoGridMetricMode, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, lineLeaderboardService, linesService, mergeWithDefaultConfig, migrateLegacyConfiguration, normalizeActionFamily, normalizeDateKeyRange, normalizeDateKeyRangeUnbounded, normalizeRoleLevel, normalizeVideoGridMetricMode, optifyeAgentClient, parseDateKeyToDate, parseS3Uri, pickPreferredLineMetricsRow, preInitializeWorkspaceDisplayNames, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, productionPlanService, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, resetFailedUrl, resetSentryQuotaForTests, resetSubscriptionManager, resolveDefaultSkuId, resolveLiveSkuId, s3VideoPreloader, selectPreferredLineMetricsRow, setSentryUserContext, setSentryWorkspaceContext, shouldEnableLocalDevTestLogin, shuffleArray, simulateApiDelay, skuService, startCoreSessionRecording, stopCoreSessionRecording, storeWorkspaceMapping, streamProxyConfig, subscribeWorkspaceDisplayNames, throttledReloadDashboard, toUrlFriendlyName, trackCoreEvent, trackCorePageView, transformToChartData, updateThreadTitle, upsertWorkspaceDisplayNameInCache, useAccessControl, useActiveBreaks, useActiveLineId, useAllWorkspaceMetrics, useAnalyticsConfig, useAppTimezone, useAudioService, useAuth, useAuthConfig, useAxelNotifications, useCanSaveTargets, useClipFilter, useClipTypes, useClipTypesWithCounts, useClipsInit, useCompanyClipsCost, useCompanyFastSlowClipFiltersEnabled, useCompanyHasVlmEnabledLine, useCompanyUsersUsage, useComponentOverride, useCustomConfig, useDashboardConfig, useDashboardMetrics, useDatabaseConfig, useDateFormatter, useDateTimeConfig, useDynamicShiftConfig, useEndpointsConfig, useEntityConfig, useFactoryOverviewMetrics, useFeatureFlags, useFormatNumber, useHasLineAccess, useHideMobileHeader, useHistoricWorkspaceMetrics, useHlsStream, useHlsStreamWithCropping, useHookOverride, useHourEndTimer, useHourlyTargetAchievements, useHourlyTargetMisses, useIdleTimeClipClassifications, useIdleTimeReasons, useIdleTimeVlmConfig, useKpiTrends, useLeaderboardMetrics, useLineDetailedMetrics, useLineKPIs, useLineMetrics, useLineShiftConfig, useLineSupervisor, useLineWorkspaceMetrics, useLines, useMessages, useMetrics, useMobileMenu, useMonthlyTrend, useMultiLineShiftConfigs, useNavigation, useOperationalShiftKey, useOptionalSupabase, useOverrides, usePageOverride, usePrefetchClipCounts, useRealtimeLineMetrics, useRegistry, useSKUs, useSessionKeepAlive, useSessionTracking, useSessionTrackingContext, useShiftConfig, useShiftGroups, useShifts, useSubscriptionManager, useSubscriptionManagerSafe, useSupabase, useSupabaseClient, useSupervisorsByLineIds, useTargets, useTeamManagementPermissions, useTheme, useThemeConfig, useThreads, useTicketHistory, useTimezoneContext, useUserLineAccess, useUserUsage, useVideoConfig, useWorkspaceConfig, useWorkspaceDetailedMetrics, useWorkspaceDisplayName, useWorkspaceDisplayNames, useWorkspaceDisplayNamesMap, useWorkspaceHealthById, useWorkspaceHealthLastSeen, useWorkspaceHealthStatus, useWorkspaceHourSummary, useWorkspaceMetrics, useWorkspaceNavigation, useWorkspaceOperators, useWorkspaceUptimeTimeline, useWorkspaceVideoStreams, userService, videoPrefetchManager, videoPreloader, weeklyTopPerformerService, whatsappService, withAccessControl, withAuth, withRegistry, withTimezone, workspaceHealthService, workspaceService };