@optifye/dashboard-core 6.10.49 → 6.10.51

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
@@ -10,13 +10,13 @@ import { createClient, REALTIME_SUBSCRIBE_STATES } from '@supabase/supabase-js';
10
10
  import Hls, { Events, ErrorTypes } from 'hls.js';
11
11
  import useSWR from 'swr';
12
12
  import { memo, noop, warning, invariant, progress, secondsToMilliseconds, millisecondsToSeconds } from 'motion-utils';
13
- import { Camera, AlertTriangle, ChevronDown, ChevronUp, Check, Map as Map$1, Video, ShieldCheck, Star, Award, Filter, X, Coffee, Plus, ArrowLeft, Clock, Calendar, Save, AlertCircle, Loader2, Minus, ArrowDown, ArrowUp, ChevronLeft, ChevronRight, TrendingUp, Sparkles, Pause, Play, Wrench, XCircle, Package, UserX, Zap, HelpCircle, Tag, Palette, CheckCircle2, RefreshCw, TrendingDown, FolderOpen, Folder, Sliders, Activity, Layers, Search, Edit2, ArrowRight, CheckCircle, User, Users, Shield, Building2, Mail, Lock, Info, Share2, Trophy, Target, Download, Sun, Moon, MousePointer, UserPlus, UserCog, Trash2, Eye, MoreVertical, BarChart3, Pencil, UserCheck, LogOut, MessageSquare, Menu, Send, Copy, Settings, LifeBuoy, EyeOff, UserCircle, Flame, Crown, Medal } from 'lucide-react';
13
+ import { Camera, AlertTriangle, ChevronDown, ChevronUp, Check, Map as Map$1, Video, ShieldCheck, Star, Award, Filter, X, Coffee, Plus, ArrowLeft, Clock, Calendar, Save, AlertCircle, Loader2, Minus, ArrowDown, ArrowUp, ChevronLeft, ChevronRight, TrendingUp, Sparkles, Pause, Play, Wrench, XCircle, Package, UserX, Zap, HelpCircle, Tag, Palette, CheckCircle2, RefreshCw, TrendingDown, FolderOpen, Folder, Sliders, Activity, Layers, Search, Edit2, ArrowRight, CheckCircle, User, Users, Shield, Building2, Mail, Lock, Info, Share2, Trophy, Target, Download, Sun, Moon, MousePointer, UserPlus, UserCog, Trash2, Eye, MoreVertical, BarChart3, Pencil, UserCheck, LogOut, Film, MessageSquare, Menu, Send, Copy, Settings, LifeBuoy, EyeOff, UserCircle, Flame, Crown, Medal } from 'lucide-react';
14
14
  import { toast } from 'sonner';
15
15
  import { BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, ReferenceLine, Tooltip, Legend, Bar, LabelList, ResponsiveContainer, LineChart as LineChart$1, Line, PieChart, Pie, Cell, ComposedChart, Area, ScatterChart, Scatter } from 'recharts';
16
16
  import { Slot } from '@radix-ui/react-slot';
17
17
  import * as SelectPrimitive from '@radix-ui/react-select';
18
18
  import { DayPicker, useNavigation as useNavigation$1 } from 'react-day-picker';
19
- import { AdjustmentsHorizontalIcon, ClockIcon, UsersIcon, UserCircleIcon, TicketIcon, QuestionMarkCircleIcon, XMarkIcon, ArrowRightIcon, Bars3Icon, HomeIcon, TrophyIcon, ChartBarIcon, LightBulbIcon, CubeIcon, HeartIcon, Cog6ToothIcon, ChevronRightIcon, ArrowRightStartOnRectangleIcon, CalendarIcon, ChevronDownIcon, ChevronLeftIcon, ExclamationCircleIcon, EnvelopeIcon, DocumentTextIcon, ChevronUpIcon, ArrowDownTrayIcon, CheckCircleIcon, ChatBubbleLeftRightIcon, XCircleIcon, FunnelIcon, EyeIcon, InformationCircleIcon, ArrowLeftIcon, PlayCircleIcon } from '@heroicons/react/24/outline';
19
+ import { AdjustmentsHorizontalIcon, ClockIcon, UsersIcon, UserCircleIcon, TicketIcon, CurrencyDollarIcon, QuestionMarkCircleIcon, XMarkIcon, ArrowRightIcon, Bars3Icon, HomeIcon, TrophyIcon, ChartBarIcon, LightBulbIcon, CubeIcon, HeartIcon, Cog6ToothIcon, ChevronRightIcon, ArrowRightStartOnRectangleIcon, CalendarIcon, ChevronDownIcon, ChevronLeftIcon, ExclamationCircleIcon, 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';
@@ -1029,6 +1029,44 @@ var fetchBackendJson = async (supabase, endpoint, options = {}) => {
1029
1029
  }
1030
1030
  };
1031
1031
 
1032
+ // src/lib/services/lineMetricsSelection.ts
1033
+ var toTimestamp = (value) => {
1034
+ if (typeof value !== "string") return 0;
1035
+ const parsed = Date.parse(value);
1036
+ return Number.isNaN(parsed) ? 0 : parsed;
1037
+ };
1038
+ var compareByLatestThenSku = (a, b) => {
1039
+ const timeDiff = toTimestamp(b.last_updated) - toTimestamp(a.last_updated);
1040
+ if (timeDiff !== 0) return timeDiff;
1041
+ const aSku = typeof a.sku_id === "string" ? a.sku_id : "";
1042
+ const bSku = typeof b.sku_id === "string" ? b.sku_id : "";
1043
+ return aSku.localeCompare(bSku);
1044
+ };
1045
+ var pickPreferredLineMetricsRow = async (supabase, lineId, rows, skuTable = "skus") => {
1046
+ if (!rows || rows.length === 0) {
1047
+ return null;
1048
+ }
1049
+ if (rows.length === 1) {
1050
+ return rows[0];
1051
+ }
1052
+ let dummySkuId = null;
1053
+ try {
1054
+ const { data } = await supabase.from(skuTable).select("id").eq("line_id", lineId).eq("sku_definition", "dummy_definition").eq("is_active", true).limit(1);
1055
+ if (Array.isArray(data) && data.length > 0) {
1056
+ dummySkuId = typeof data[0]?.id === "string" ? data[0].id : null;
1057
+ }
1058
+ } catch (error) {
1059
+ console.warn("[lineMetricsSelection] Failed dummy SKU lookup:", error);
1060
+ }
1061
+ if (dummySkuId) {
1062
+ const dummyRow = rows.find((row) => row.sku_id === dummySkuId);
1063
+ if (dummyRow) {
1064
+ return dummyRow;
1065
+ }
1066
+ }
1067
+ return rows.slice().sort(compareByLatestThenSku)[0] ?? null;
1068
+ };
1069
+
1032
1070
  // src/lib/services/dashboardService.ts
1033
1071
  var getTable = (dbConfig, tableName) => {
1034
1072
  const defaults2 = DEFAULT_DATABASE_CONFIG.tables;
@@ -1047,6 +1085,7 @@ var dashboardService = {
1047
1085
  const workspaceConfig = config.workspaceConfig ?? DEFAULT_WORKSPACE_CONFIG;
1048
1086
  const linesTable = getTable(dbConfig, "lines");
1049
1087
  const lineMetricsTable = getTable(dbConfig, "lineMetrics");
1088
+ const skuTable = dbConfig?.tables?.skus ?? "skus";
1050
1089
  const companyId = entityConfig.companyId;
1051
1090
  const metricsTablePrefixStr = getMetricsTablePrefix();
1052
1091
  `${metricsTablePrefixStr}_${companyId ? companyId.replace(/-/g, "_") : "unknown_company"}`;
@@ -1140,9 +1179,14 @@ var dashboardService = {
1140
1179
  if (!lineData) throw new Error(`Line with ID ${lineId} not found`);
1141
1180
  let metricsFromDb = null;
1142
1181
  try {
1143
- const { data: fetchedMetrics, error } = await supabase.from(lineMetricsTable).select("*").eq("line_id", lineId).eq("shift_id", shiftId).eq("date", date).maybeSingle();
1182
+ const { data: fetchedMetricsRows, error } = await supabase.from(lineMetricsTable).select("*").eq("line_id", lineId).eq("shift_id", shiftId).eq("date", date);
1144
1183
  if (error) throw error;
1145
- metricsFromDb = fetchedMetrics;
1184
+ metricsFromDb = await pickPreferredLineMetricsRow(
1185
+ supabase,
1186
+ lineId,
1187
+ fetchedMetricsRows,
1188
+ skuTable
1189
+ );
1146
1190
  } catch (err) {
1147
1191
  console.error(`Error fetching line metrics for ${lineId}:`, err);
1148
1192
  }
@@ -1553,6 +1597,7 @@ var dashboardService = {
1553
1597
  const workspaceConfig = config.workspaceConfig ?? DEFAULT_WORKSPACE_CONFIG;
1554
1598
  const linesTable = getTable(dbConfig, "lines");
1555
1599
  const lineMetricsTable = getTable(dbConfig, "lineMetrics");
1600
+ const skuTable = dbConfig?.tables?.skus ?? "skus";
1556
1601
  const companyId = entityConfig.companyId;
1557
1602
  const metricsTablePrefixStr = getMetricsTablePrefix();
1558
1603
  `${metricsTablePrefixStr}_${companyId ? companyId.replace(/-/g, "_") : "unknown_company"}`;
@@ -1651,7 +1696,7 @@ var dashboardService = {
1651
1696
  }
1652
1697
  const [lineResult, metricsResult] = await Promise.all([
1653
1698
  supabase.from(linesTable).select("id, line_name, factory_id, monitoring_mode, factories!lines_factory_id_fkey(factory_name), company_id, companies!lines_company_id_fkey(company_name:name)").eq("id", lineIdToQuery).single(),
1654
- supabase.from(lineMetricsTable).select("*").eq("line_id", lineIdToQuery).eq("shift_id", queryShiftId).eq("date", queryDate).maybeSingle()
1699
+ supabase.from(lineMetricsTable).select("*").eq("line_id", lineIdToQuery).eq("shift_id", queryShiftId).eq("date", queryDate)
1655
1700
  ]);
1656
1701
  if (lineResult.error) throw lineResult.error;
1657
1702
  if (!lineResult.data) {
@@ -1659,7 +1704,12 @@ var dashboardService = {
1659
1704
  }
1660
1705
  if (metricsResult.error) throw metricsResult.error;
1661
1706
  const lineData = lineResult.data;
1662
- const metrics2 = metricsResult.data;
1707
+ const metrics2 = await pickPreferredLineMetricsRow(
1708
+ supabase,
1709
+ lineIdToQuery,
1710
+ metricsResult.data,
1711
+ skuTable
1712
+ );
1663
1713
  return {
1664
1714
  line_id: lineData.id,
1665
1715
  line_name: lineData.line_name,
@@ -17322,6 +17372,79 @@ function useCompanyUsersUsage(companyId, options = {}) {
17322
17372
  refetchToday: fetchTodayUsage
17323
17373
  };
17324
17374
  }
17375
+ function useCompanyClipsCost() {
17376
+ const { user, session } = useAuth();
17377
+ const supabase = useSupabase();
17378
+ const config = useDashboardConfig();
17379
+ const entityConfig = useEntityConfig();
17380
+ const [data, setData] = useState(null);
17381
+ const [isLoading, setIsLoading] = useState(true);
17382
+ const [error, setError] = useState(null);
17383
+ const hasFetchedOnceRef = useRef(false);
17384
+ const canViewClipsCost = user?.role_level === "owner" || user?.role_level === "optifye";
17385
+ const companyId = user?.properties?.company_id || user?.company_id || entityConfig.companyId;
17386
+ const apiBaseUrl = config?.apiBaseUrl || process.env.NEXT_PUBLIC_API_BASE_URL || "";
17387
+ const fetchData = useCallback(async () => {
17388
+ if (!canViewClipsCost || !companyId || !supabase || !apiBaseUrl || !session?.access_token) {
17389
+ setIsLoading(false);
17390
+ setData(null);
17391
+ hasFetchedOnceRef.current = false;
17392
+ return;
17393
+ }
17394
+ if (!hasFetchedOnceRef.current) {
17395
+ setIsLoading(true);
17396
+ }
17397
+ setError(null);
17398
+ try {
17399
+ const [statsResponse, linesResult] = await Promise.all([
17400
+ fetch(`${apiBaseUrl}/api/classification/company-stats?company_id=${encodeURIComponent(companyId)}`, {
17401
+ headers: {
17402
+ "Authorization": `Bearer ${session.access_token}`
17403
+ }
17404
+ }),
17405
+ supabase.from("lines").select("id").eq("company_id", companyId).eq("idle_time_vlm_enabled", true).limit(1)
17406
+ ]);
17407
+ if (!statsResponse.ok) {
17408
+ const errorData = await statsResponse.json().catch(() => ({}));
17409
+ throw new Error(errorData.detail || `Failed to fetch classification stats: ${statsResponse.status}`);
17410
+ }
17411
+ const statsResult = await statsResponse.json();
17412
+ const totalClassifications = statsResult.total_classifications || 0;
17413
+ const monthlyClassifications = statsResult.monthly_classifications ?? totalClassifications;
17414
+ const monthStart = statsResult.month_start || null;
17415
+ const historicalMonthlyClassifications = Array.isArray(statsResult.historical_monthly_classifications) ? statsResult.historical_monthly_classifications.map((item) => ({
17416
+ monthStart: item?.month_start || "",
17417
+ classifications: Number(item?.classifications || 0)
17418
+ })).filter((item) => item.monthStart && item.classifications > 0) : [];
17419
+ const hasVlmEnabledLine = (linesResult.data?.length || 0) > 0;
17420
+ setData({
17421
+ totalClassifications,
17422
+ monthlyClassifications,
17423
+ monthStart,
17424
+ historicalMonthlyClassifications,
17425
+ hasVlmEnabledLine
17426
+ });
17427
+ } catch (err) {
17428
+ console.error("[useCompanyClipsCost] Error:", err);
17429
+ setError(err instanceof Error ? err.message : "Failed to load clips data");
17430
+ setData(null);
17431
+ } finally {
17432
+ hasFetchedOnceRef.current = true;
17433
+ setIsLoading(false);
17434
+ }
17435
+ }, [canViewClipsCost, companyId, supabase, apiBaseUrl, session?.access_token]);
17436
+ useEffect(() => {
17437
+ fetchData();
17438
+ }, [fetchData]);
17439
+ const hasData = !!(data && data.totalClassifications > 0 && data.hasVlmEnabledLine);
17440
+ return {
17441
+ data,
17442
+ isLoading,
17443
+ error,
17444
+ hasData,
17445
+ refetch: fetchData
17446
+ };
17447
+ }
17325
17448
 
17326
17449
  // src/lib/utils/api.ts
17327
17450
  var apiUtils = {
@@ -34379,6 +34502,8 @@ var HlsVideoPlayer = forwardRef(({
34379
34502
  if (effectiveSrc.startsWith("#EXTM3U")) {
34380
34503
  const safariMode = isSafari();
34381
34504
  const browserName = getBrowserName();
34505
+ const r2WorkerHost = r2WorkerDomain.replace(/^https?:\/\//, "");
34506
+ const isR2Playlist = effectiveSrc.includes(r2WorkerHost);
34382
34507
  const remuxUrl = extractRemuxUrl(effectiveSrc);
34383
34508
  if (remuxUrl) {
34384
34509
  console.log(`[HlsVideoPlayer] Remuxing enabled - using remux playlist URL: ${remuxUrl}`);
@@ -34422,10 +34547,58 @@ var HlsVideoPlayer = forwardRef(({
34422
34547
  } else {
34423
34548
  video.src = remuxUrl;
34424
34549
  }
34550
+ } else if (safariMode && isR2Playlist && Hls.isSupported()) {
34551
+ const blob = new Blob([effectiveSrc], { type: "application/vnd.apple.mpegurl" });
34552
+ const blobUrl = URL.createObjectURL(blob);
34553
+ blobUrlRef.current = blobUrl;
34554
+ console.log(`[HlsVideoPlayer] Safari R2 stream - using HLS.js for auth header support (${browserName})`);
34555
+ const hls = new Hls(mergedHlsConfig);
34556
+ hlsRef.current = hls;
34557
+ hls.on(Events.MANIFEST_PARSED, () => {
34558
+ console.log("[HlsVideoPlayer] Manifest parsed (Safari R2 HLS.js), ready to play");
34559
+ setIsReady(true);
34560
+ eventCallbacksRef.current.onReady?.(player);
34561
+ });
34562
+ hls.on(Events.ERROR, (event, data) => {
34563
+ console.error("[HlsVideoPlayer] HLS.js error (Safari R2):", data);
34564
+ if (maybeHandleR2Fallback(data)) {
34565
+ return;
34566
+ }
34567
+ if (data.fatal) {
34568
+ let errorInfo;
34569
+ switch (data.type) {
34570
+ case ErrorTypes.NETWORK_ERROR:
34571
+ errorInfo = ERROR_MAPPING.networkError;
34572
+ console.log("[HlsVideoPlayer] Attempting to recover from network error (Safari R2)");
34573
+ hls.startLoad();
34574
+ break;
34575
+ case ErrorTypes.MEDIA_ERROR:
34576
+ errorInfo = ERROR_MAPPING.mediaError;
34577
+ console.log("[HlsVideoPlayer] Attempting to recover from media error (Safari R2)");
34578
+ hls.recoverMediaError();
34579
+ break;
34580
+ case ErrorTypes.MUX_ERROR:
34581
+ errorInfo = ERROR_MAPPING.muxError;
34582
+ break;
34583
+ default:
34584
+ errorInfo = ERROR_MAPPING.otherError;
34585
+ break;
34586
+ }
34587
+ errorInfo.details = data.details;
34588
+ eventCallbacksRef.current.onError?.(player, errorInfo);
34589
+ }
34590
+ });
34591
+ hls.on(Events.FRAG_LOADED, () => {
34592
+ setIsLoading(false);
34593
+ eventCallbacksRef.current.onLoadingChange?.(false);
34594
+ });
34595
+ hls.loadSource(blobUrl);
34596
+ hls.attachMedia(video);
34425
34597
  } else if (safariMode) {
34426
34598
  const clipIdMatch = effectiveSrc.match(/# Clip ID: ([a-f0-9-]+)/i);
34427
34599
  if (clipIdMatch) {
34428
- const proxyUrl = `/api/clips/playlist/${clipIdMatch[1]}`;
34600
+ const safariParam = isR2Playlist ? "?safari=true" : "";
34601
+ const proxyUrl = `/api/clips/playlist/${clipIdMatch[1]}${safariParam}`;
34429
34602
  console.log(`[HlsVideoPlayer] Safari detected (${browserName}) - using playlist proxy URL:`, proxyUrl);
34430
34603
  video.src = proxyUrl;
34431
34604
  } else {
@@ -36627,6 +36800,7 @@ var FileManagerFilters = ({
36627
36800
  const endInputRef = useRef(null);
36628
36801
  const [idleLabelFilter, setIdleLabelFilter] = useState(null);
36629
36802
  const [showIdleLabelFilterModal, setShowIdleLabelFilterModal] = useState(false);
36803
+ const [isLoadingIdleReasonOptions, setIsLoadingIdleReasonOptions] = useState(false);
36630
36804
  const timezone = useAppTimezone();
36631
36805
  const supabase = useSupabase();
36632
36806
  const [clipMetadata, setClipMetadata] = useState({});
@@ -36669,18 +36843,27 @@ var FileManagerFilters = ({
36669
36843
  iconColor: colorConfig.text
36670
36844
  };
36671
36845
  };
36672
- const ROOT_CAUSE_OPTIONS = [
36673
- "Operator Absent",
36674
- "Operator Idle",
36675
- "Machine Downtime",
36676
- "No Material"
36677
- ];
36846
+ const normalizeIdleReasonLabel = useCallback((label) => {
36847
+ return label.replace(/_/g, " ").trim();
36848
+ }, []);
36678
36849
  const getIdleTimeRootCause = useCallback((clipId) => {
36679
36850
  const classification = mergedClipClassifications[clipId];
36680
36851
  if (!classification) return "processing";
36681
36852
  if (classification.status === "processing") return "processing";
36682
36853
  return classification.label || "processing";
36683
36854
  }, [mergedClipClassifications]);
36855
+ const idleReasonOptions = useMemo(() => {
36856
+ const idleClips = clipMetadata["idle_time"] || [];
36857
+ const uniqueReasons = /* @__PURE__ */ new Set();
36858
+ idleClips.forEach((clip) => {
36859
+ const clipId = clip.clipId || clip.id;
36860
+ if (!clipId) return;
36861
+ const reason = getIdleTimeRootCause(clipId);
36862
+ if (!reason || reason === "processing") return;
36863
+ uniqueReasons.add(normalizeIdleReasonLabel(reason));
36864
+ });
36865
+ return Array.from(uniqueReasons).sort((a, b) => a.localeCompare(b));
36866
+ }, [clipMetadata, getIdleTimeRootCause, normalizeIdleReasonLabel]);
36684
36867
  const getClipBadge = useCallback((node) => {
36685
36868
  if (node.categoryId === "idle_time" || node.categoryId === "low_value") {
36686
36869
  return { text: "Idle", className: "bg-red-100 text-red-700" };
@@ -36708,6 +36891,79 @@ var FileManagerFilters = ({
36708
36891
  return null;
36709
36892
  }
36710
36893
  }, [supabase]);
36894
+ const fetchClipMetadataPage = useCallback(async (categoryId, page = 1) => {
36895
+ if (!workspaceId || !date || shift === void 0) {
36896
+ throw new Error("Missing required params for clip metadata fetch");
36897
+ }
36898
+ const response = await fetchWithSupabaseAuth(supabase, "/api/clips/supabase", {
36899
+ method: "POST",
36900
+ headers: {
36901
+ "Content-Type": "application/json"
36902
+ },
36903
+ body: JSON.stringify({
36904
+ action: "clip-metadata",
36905
+ workspaceId,
36906
+ date,
36907
+ shift: shift.toString(),
36908
+ category: categoryId,
36909
+ page,
36910
+ limit: 50,
36911
+ snapshotDateTime,
36912
+ snapshotClipId
36913
+ }),
36914
+ redirectReason: "session_expired"
36915
+ });
36916
+ if (!response.ok) {
36917
+ throw new Error(`API error: ${response.status}`);
36918
+ }
36919
+ return response.json();
36920
+ }, [workspaceId, date, shift, snapshotDateTime, snapshotClipId, supabase]);
36921
+ const seedIdleClassifications = useCallback(async (clips) => {
36922
+ if (!idleTimeVlmEnabled || clips.length === 0) {
36923
+ return;
36924
+ }
36925
+ const authToken = await getAuthToken3();
36926
+ if (!authToken) {
36927
+ return;
36928
+ }
36929
+ const seededClassifications = {};
36930
+ clips.forEach((clip) => {
36931
+ if (!clip.clipId) {
36932
+ return;
36933
+ }
36934
+ if (clip.classification_status) {
36935
+ seededClassifications[clip.clipId] = {
36936
+ status: clip.classification_status,
36937
+ label: clip.classification_label || void 0,
36938
+ confidence: clip.classification_confidence ?? void 0
36939
+ };
36940
+ }
36941
+ });
36942
+ if (Object.keys(seededClassifications).length > 0) {
36943
+ setLocalClipClassifications((prev) => ({
36944
+ ...prev,
36945
+ ...seededClassifications
36946
+ }));
36947
+ }
36948
+ const clipIdsToFetch = clips.map((clip) => clip.clipId || clip.id).filter(Boolean).filter((id3) => {
36949
+ if (!id3) return false;
36950
+ if (mergedClipClassifications[id3]?.status === "classified") return false;
36951
+ if (seededClassifications[id3]?.status === "classified") return false;
36952
+ return true;
36953
+ });
36954
+ if (clipIdsToFetch.length === 0) {
36955
+ return;
36956
+ }
36957
+ try {
36958
+ const classifications = await fetchClassifications(clipIdsToFetch, authToken);
36959
+ setLocalClipClassifications((prev) => ({
36960
+ ...prev,
36961
+ ...classifications
36962
+ }));
36963
+ } catch (error) {
36964
+ console.error("[FileManager] Error fetching idle classifications:", error);
36965
+ }
36966
+ }, [idleTimeVlmEnabled, getAuthToken3, mergedClipClassifications]);
36711
36967
  const fetchClipMetadata = useCallback(async (categoryId, page = 1) => {
36712
36968
  if (!workspaceId || !date || shift === void 0) {
36713
36969
  console.warn("[FileManager] Missing required params for clip metadata fetch");
@@ -36716,69 +36972,13 @@ var FileManagerFilters = ({
36716
36972
  const loadingKey = `${categoryId}-${page}`;
36717
36973
  setLoadingCategories((prev) => /* @__PURE__ */ new Set([...prev, loadingKey]));
36718
36974
  try {
36719
- const response = await fetchWithSupabaseAuth(supabase, "/api/clips/supabase", {
36720
- method: "POST",
36721
- headers: {
36722
- "Content-Type": "application/json"
36723
- },
36724
- body: JSON.stringify({
36725
- action: "clip-metadata",
36726
- workspaceId,
36727
- date,
36728
- shift: shift.toString(),
36729
- category: categoryId,
36730
- page,
36731
- limit: 50,
36732
- snapshotDateTime,
36733
- snapshotClipId
36734
- }),
36735
- redirectReason: "session_expired"
36736
- });
36737
- if (!response.ok) {
36738
- throw new Error(`API error: ${response.status}`);
36739
- }
36740
- const data = await response.json();
36975
+ const data = await fetchClipMetadataPage(categoryId, page);
36741
36976
  setClipMetadata((prev) => ({
36742
36977
  ...prev,
36743
36978
  [categoryId]: page === 1 ? data.clips : [...prev[categoryId] || [], ...data.clips]
36744
36979
  }));
36745
- const authToken = categoryId === "idle_time" && idleTimeVlmEnabled ? await getAuthToken3() : null;
36746
- if (categoryId === "idle_time" && idleTimeVlmEnabled && authToken) {
36747
- const seededClassifications = {};
36748
- (data.clips || []).forEach((clip) => {
36749
- if (!clip.clipId) {
36750
- return;
36751
- }
36752
- if (clip.classification_status) {
36753
- seededClassifications[clip.clipId] = {
36754
- status: clip.classification_status,
36755
- label: clip.classification_label || void 0,
36756
- confidence: clip.classification_confidence ?? void 0
36757
- };
36758
- }
36759
- });
36760
- if (Object.keys(seededClassifications).length > 0) {
36761
- setLocalClipClassifications((prev) => ({
36762
- ...prev,
36763
- ...seededClassifications
36764
- }));
36765
- }
36766
- const clipIds = (data.clips || []).map((clip) => clip.clipId || clip.id).filter(Boolean);
36767
- const newClipIds = clipIds.filter((id3) => {
36768
- if (mergedClipClassifications[id3]?.status === "classified") return false;
36769
- if (seededClassifications[id3]?.status === "classified") return false;
36770
- return true;
36771
- });
36772
- if (newClipIds.length > 0) {
36773
- fetchClassifications(newClipIds, authToken).then((classifications) => {
36774
- setLocalClipClassifications((prev) => ({
36775
- ...prev,
36776
- ...classifications
36777
- }));
36778
- }).catch((error) => {
36779
- console.error("[FileManager] Error fetching idle classifications:", error);
36780
- });
36781
- }
36980
+ if (categoryId === "idle_time" && idleTimeVlmEnabled) {
36981
+ await seedIdleClassifications(data.clips || []);
36782
36982
  }
36783
36983
  setCategoryPages((prev) => ({ ...prev, [categoryId]: page }));
36784
36984
  setCategoryHasMore((prev) => ({ ...prev, [categoryId]: data.hasMore }));
@@ -36792,7 +36992,64 @@ var FileManagerFilters = ({
36792
36992
  return newSet;
36793
36993
  });
36794
36994
  }
36795
- }, [workspaceId, date, shift, mergedClipClassifications, snapshotDateTime, snapshotClipId, supabase, getAuthToken3, idleTimeVlmEnabled]);
36995
+ }, [workspaceId, date, shift, fetchClipMetadataPage, idleTimeVlmEnabled, seedIdleClassifications]);
36996
+ const ensureAllIdleTimeClipMetadataLoaded = useCallback(async () => {
36997
+ if (!workspaceId || !date || shift === void 0) {
36998
+ return;
36999
+ }
37000
+ let accumulatedClips = [...clipMetadata["idle_time"] || []];
37001
+ let currentPage = categoryPages["idle_time"] || 0;
37002
+ let hasMore = categoryHasMore["idle_time"];
37003
+ if (currentPage === 0) {
37004
+ const firstPageData = await fetchClipMetadataPage("idle_time", 1);
37005
+ accumulatedClips = firstPageData.clips || [];
37006
+ currentPage = 1;
37007
+ hasMore = firstPageData.hasMore;
37008
+ } else if (hasMore === void 0) {
37009
+ hasMore = false;
37010
+ }
37011
+ while (hasMore) {
37012
+ const nextPage = currentPage + 1;
37013
+ const nextPageData = await fetchClipMetadataPage("idle_time", nextPage);
37014
+ accumulatedClips = [...accumulatedClips, ...nextPageData.clips || []];
37015
+ currentPage = nextPage;
37016
+ hasMore = nextPageData.hasMore;
37017
+ }
37018
+ const dedupedClips = accumulatedClips.filter((clip, index, arr) => {
37019
+ const clipKey = clip.clipId || clip.id;
37020
+ return arr.findIndex((item) => (item.clipId || item.id) === clipKey) === index;
37021
+ });
37022
+ setClipMetadata((prev) => ({
37023
+ ...prev,
37024
+ idle_time: dedupedClips
37025
+ }));
37026
+ setCategoryPages((prev) => ({ ...prev, idle_time: currentPage }));
37027
+ setCategoryHasMore((prev) => ({ ...prev, idle_time: false }));
37028
+ if (idleTimeVlmEnabled) {
37029
+ await seedIdleClassifications(dedupedClips);
37030
+ }
37031
+ }, [
37032
+ workspaceId,
37033
+ date,
37034
+ shift,
37035
+ clipMetadata,
37036
+ categoryPages,
37037
+ categoryHasMore,
37038
+ fetchClipMetadataPage,
37039
+ idleTimeVlmEnabled,
37040
+ seedIdleClassifications
37041
+ ]);
37042
+ const handleOpenIdleLabelFilterModal = useCallback(async () => {
37043
+ setShowIdleLabelFilterModal(true);
37044
+ setIsLoadingIdleReasonOptions(true);
37045
+ try {
37046
+ await ensureAllIdleTimeClipMetadataLoaded();
37047
+ } catch (error) {
37048
+ console.error("[FileManager] Error loading idle reason options:", error);
37049
+ } finally {
37050
+ setIsLoadingIdleReasonOptions(false);
37051
+ }
37052
+ }, [ensureAllIdleTimeClipMetadataLoaded]);
36796
37053
  const fetchPercentileClips = useCallback(async (type) => {
36797
37054
  if (!workspaceId || !date || shift === void 0) {
36798
37055
  console.warn("[FileManager] Missing required params for percentile clips fetch");
@@ -37463,7 +37720,7 @@ var FileManagerFilters = ({
37463
37720
  activeFilter === "idle_time" && idleTimeVlmEnabled && /* @__PURE__ */ jsx(
37464
37721
  "button",
37465
37722
  {
37466
- onClick: () => setShowIdleLabelFilterModal(true),
37723
+ onClick: handleOpenIdleLabelFilterModal,
37467
37724
  className: `p-2 rounded-xl transition-all duration-200 ${idleLabelFilter ? "bg-purple-100 text-purple-600 hover:bg-purple-200 shadow-sm" : "bg-slate-100 text-slate-600 hover:bg-slate-200"}`,
37468
37725
  title: "Filter by idle reason",
37469
37726
  children: /* @__PURE__ */ jsx(Tag, { className: "h-5 w-5" })
@@ -37551,7 +37808,10 @@ var FileManagerFilters = ({
37551
37808
  }
37552
37809
  )
37553
37810
  ] }),
37554
- /* @__PURE__ */ jsx("div", { className: "p-2 max-h-60 overflow-y-auto", children: ROOT_CAUSE_OPTIONS.map((reason) => {
37811
+ /* @__PURE__ */ jsx("div", { className: "p-2 max-h-60 overflow-y-auto", children: isLoadingIdleReasonOptions ? /* @__PURE__ */ jsxs("div", { className: "px-3 py-4 text-sm text-slate-500 flex items-center gap-2", children: [
37812
+ /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
37813
+ "Loading idle reasons..."
37814
+ ] }) : idleReasonOptions.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-3 py-4 text-sm text-slate-500", children: "No classified idle reasons found yet." }) : idleReasonOptions.map((reason) => {
37555
37815
  const config = getRootCauseConfig(reason);
37556
37816
  return /* @__PURE__ */ jsxs(
37557
37817
  "button",
@@ -48888,6 +49148,7 @@ var SideNavBar = memo$1(({
48888
49148
  dashboardConfig?.supervisorConfig?.enabled || false;
48889
49149
  const showSupervisorManagement = false;
48890
49150
  const ticketsEnabled = dashboardConfig?.ticketsConfig?.enabled ?? true;
49151
+ const { hasData: hasClipsCostData } = useCompanyClipsCost();
48891
49152
  console.log("\u{1F50D} [SideNavBar] dashboardConfig:", dashboardConfig);
48892
49153
  console.log("\u{1F50D} [SideNavBar] ticketsConfig:", dashboardConfig?.ticketsConfig);
48893
49154
  console.log("\u{1F50D} [SideNavBar] ticketsEnabled:", ticketsEnabled);
@@ -49044,6 +49305,17 @@ var SideNavBar = memo$1(({
49044
49305
  });
49045
49306
  onMobileMenuClose?.();
49046
49307
  }, [navigate, onMobileMenuClose]);
49308
+ const handleClipsCostClick = useCallback(() => {
49309
+ navigate("/clips-cost", {
49310
+ trackingEvent: {
49311
+ name: "Clips Cost Page Clicked",
49312
+ properties: {
49313
+ source: "side_nav"
49314
+ }
49315
+ }
49316
+ });
49317
+ onMobileMenuClose?.();
49318
+ }, [navigate, onMobileMenuClose]);
49047
49319
  const [isSettingsOpen, setIsSettingsOpen] = useState(false);
49048
49320
  const settingsTriggerRef = useRef(null);
49049
49321
  const settingsItems = useMemo(() => {
@@ -49101,6 +49373,18 @@ var SideNavBar = memo$1(({
49101
49373
  isActive: pathname === "/tickets" || pathname.startsWith("/tickets/")
49102
49374
  });
49103
49375
  }
49376
+ if (hasClipsCostData) {
49377
+ items.push({
49378
+ key: "clips-analysis",
49379
+ label: "Billing",
49380
+ icon: CurrencyDollarIcon,
49381
+ onClick: () => {
49382
+ handleClipsCostClick();
49383
+ setIsSettingsOpen(false);
49384
+ },
49385
+ isActive: pathname === "/clips-cost" || pathname.startsWith("/clips-cost/")
49386
+ });
49387
+ }
49104
49388
  if (canAccessPath("/help")) {
49105
49389
  items.push({
49106
49390
  key: "help",
@@ -49114,7 +49398,7 @@ var SideNavBar = memo$1(({
49114
49398
  });
49115
49399
  }
49116
49400
  return items;
49117
- }, [handleTargetsClick, handleShiftsClick, handleTeamManagementClick, handleProfileClick, handleTicketsClick, handleHelpClick, pathname, ticketsEnabled, canAccessPath]);
49401
+ }, [handleTargetsClick, handleShiftsClick, handleTeamManagementClick, handleProfileClick, handleTicketsClick, handleClipsCostClick, handleHelpClick, pathname, ticketsEnabled, hasClipsCostData, canAccessPath]);
49118
49402
  const handleLogout = useCallback(async () => {
49119
49403
  setIsSettingsOpen(false);
49120
49404
  try {
@@ -61373,6 +61657,102 @@ var ProfileView = () => {
61373
61657
  ] });
61374
61658
  };
61375
61659
  var ProfileView_default = ProfileView;
61660
+ var REFRESH_INTERVAL_MS = 30 * 1e3;
61661
+ var ClipsCostView = () => {
61662
+ const { data, isLoading, error, refetch } = useCompanyClipsCost();
61663
+ const navigation = useNavigation();
61664
+ const refetchRef = useRef(refetch);
61665
+ useEffect(() => {
61666
+ refetchRef.current = refetch;
61667
+ }, [refetch]);
61668
+ useEffect(() => {
61669
+ const intervalId = setInterval(() => {
61670
+ void refetchRef.current();
61671
+ }, REFRESH_INTERVAL_MS);
61672
+ return () => clearInterval(intervalId);
61673
+ }, []);
61674
+ const mobileMenuContext = useMobileMenu();
61675
+ useHideMobileHeader(!!mobileMenuContext);
61676
+ const formatNumber = (num) => {
61677
+ return new Intl.NumberFormat("en-US").format(num);
61678
+ };
61679
+ const formatMonthLabel = (monthStart) => {
61680
+ if (!monthStart) {
61681
+ return "Current Month";
61682
+ }
61683
+ const parsed = /* @__PURE__ */ new Date(`${monthStart}T00:00:00`);
61684
+ if (Number.isNaN(parsed.getTime())) {
61685
+ return "Current Month";
61686
+ }
61687
+ return new Intl.DateTimeFormat("en-US", { month: "long", year: "numeric" }).format(parsed);
61688
+ };
61689
+ if (isLoading) {
61690
+ return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center min-h-screen bg-gray-50", children: /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "lg", message: "Loading usage data..." }) });
61691
+ }
61692
+ return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-gray-50 flex flex-col", children: [
61693
+ /* @__PURE__ */ jsx("header", { className: "sticky top-0 z-10 bg-white border-b border-gray-200 shadow-sm flex-shrink-0", children: /* @__PURE__ */ jsxs("div", { className: "px-3 sm:px-6 lg:px-8 py-3 sm:py-4 w-full", children: [
61694
+ /* @__PURE__ */ jsx("div", { className: "sm:hidden", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
61695
+ /* @__PURE__ */ jsx("div", { className: "flex items-center", children: mobileMenuContext && /* @__PURE__ */ jsx(
61696
+ HamburgerButton,
61697
+ {
61698
+ onClick: mobileMenuContext.onMobileMenuOpen,
61699
+ className: "flex-shrink-0 -ml-1"
61700
+ }
61701
+ ) }),
61702
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col items-center justify-center", children: [
61703
+ /* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold text-gray-900", children: "Billing" }),
61704
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: "Track your usage based features spend" })
61705
+ ] }),
61706
+ /* @__PURE__ */ jsx("div", { className: "w-9" })
61707
+ ] }) }),
61708
+ /* @__PURE__ */ jsx("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
61709
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 min-w-[120px]", children: /* @__PURE__ */ jsx(
61710
+ BackButtonMinimal,
61711
+ {
61712
+ onClick: () => navigation.goToDashboard(),
61713
+ text: "Back",
61714
+ size: "default",
61715
+ "aria-label": "Navigate back to dashboard"
61716
+ }
61717
+ ) }),
61718
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col items-center", children: [
61719
+ /* @__PURE__ */ jsx("h1", { className: "text-2xl lg:text-3xl font-semibold text-gray-900 text-center", children: "Billing" }),
61720
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 mt-1 text-center", children: "Track your usage based features spend" })
61721
+ ] }),
61722
+ /* @__PURE__ */ jsx("div", { className: "min-w-[120px]" })
61723
+ ] }) })
61724
+ ] }) }),
61725
+ /* @__PURE__ */ jsx("main", { className: "flex-1 p-4 sm:p-6 lg:p-8 max-w-7xl mx-auto w-full", children: error ? /* @__PURE__ */ jsxs("div", { className: "p-4 bg-red-50 border border-red-200 rounded-lg flex items-start gap-3 text-red-700 animate-in fade-in slide-in-from-top-2 max-w-2xl mx-auto", children: [
61726
+ /* @__PURE__ */ jsx(AlertCircle, { className: "h-5 w-5 flex-shrink-0 mt-0.5" }),
61727
+ /* @__PURE__ */ jsxs("div", { children: [
61728
+ /* @__PURE__ */ jsx("h3", { className: "font-medium", children: "Error loading usage data" }),
61729
+ /* @__PURE__ */ jsx("p", { className: "text-sm mt-1 text-red-600", children: error })
61730
+ ] })
61731
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "max-w-xl mt-8 animate-in fade-in slide-in-from-bottom-4 duration-500", children: [
61732
+ /* @__PURE__ */ jsx(Card2, { className: "overflow-hidden shadow-sm border-gray-200 bg-white", children: /* @__PURE__ */ jsx(CardContent2, { className: "p-8", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center text-center", children: [
61733
+ /* @__PURE__ */ jsx("div", { className: "p-3 bg-blue-50 rounded-full mb-4", children: /* @__PURE__ */ jsx(Film, { className: "h-8 w-8 text-blue-600" }) }),
61734
+ /* @__PURE__ */ jsx("h2", { className: "text-sm font-medium text-gray-500 uppercase tracking-wider mb-2", children: "Clips Analyzed" }),
61735
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mb-3", children: formatMonthLabel(data?.monthStart) }),
61736
+ /* @__PURE__ */ jsx("div", { className: "text-5xl font-bold text-gray-900 mb-2 tabular-nums tracking-tight", children: formatNumber(data?.monthlyClassifications || 0) })
61737
+ ] }) }) }),
61738
+ /* @__PURE__ */ jsx(Card2, { className: "mt-4 overflow-hidden shadow-sm border-gray-200 bg-white", children: /* @__PURE__ */ jsxs(CardContent2, { className: "p-6", children: [
61739
+ /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-gray-900 mb-3 uppercase tracking-wider", children: "Previous Months" }),
61740
+ (data?.historicalMonthlyClassifications?.length || 0) === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: "No historical month usage yet." }) : /* @__PURE__ */ jsx("div", { className: "space-y-2", children: data?.historicalMonthlyClassifications.map((item) => /* @__PURE__ */ jsxs(
61741
+ "div",
61742
+ {
61743
+ className: "flex items-center justify-between rounded-md border border-gray-100 bg-gray-50 px-3 py-2",
61744
+ children: [
61745
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-gray-700", children: formatMonthLabel(item.monthStart) }),
61746
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-gray-900 tabular-nums", children: formatNumber(item.classifications) })
61747
+ ]
61748
+ },
61749
+ item.monthStart
61750
+ )) })
61751
+ ] }) })
61752
+ ] }) })
61753
+ ] });
61754
+ };
61755
+ var ClipsCostView_default = ClipsCostView;
61376
61756
 
61377
61757
  // src/lib/constants/actions.ts
61378
61758
  var ACTION_NAMES = {
@@ -64651,6 +65031,7 @@ var WorkspaceDetailView = ({
64651
65031
  }, [monthlyData, range]);
64652
65032
  const formattedWorkspaceName = displayName || formatWorkspaceName3(workspace?.workspace_name || "", effectiveLineId);
64653
65033
  const shouldShowCycleTimeChart = !isUptimeMode && (showCycleTimeChart ?? formattedWorkspaceName.startsWith("FINAL ASSY"));
65034
+ const showIdleBreakdownChart = !shouldShowCycleTimeChart && idleTimeVlmEnabled;
64654
65035
  const idleClipDate = date || workspace?.date || calculatedOperationalDate || getOperationalDate(timezone);
64655
65036
  const idleClipShiftId = parsedShiftId ?? workspace?.shift_id;
64656
65037
  const shiftDurationMinutes = useMemo(
@@ -65254,107 +65635,123 @@ var WorkspaceDetailView = ({
65254
65635
  ] }) : /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(WorkspaceMetricCards, { workspace, legend: efficiencyLegend, className: "flex-1" }) })
65255
65636
  ] }),
65256
65637
  /* @__PURE__ */ jsxs("div", { className: "hidden lg:flex lg:flex-col lg:h-full lg:min-h-0 gap-3", children: [
65257
- /* @__PURE__ */ jsxs("div", { className: clsx("grid grid-cols-1 lg:grid-cols-10 gap-3 min-h-0", desktopTopSectionClass), children: [
65258
- !shouldShowCycleTimeChart && !isUptimeMode && /* @__PURE__ */ jsxs(
65259
- motion.div,
65260
- {
65261
- className: "bg-white rounded-lg shadow-sm p-4 lg:col-span-2 flex flex-col min-h-0",
65262
- variants: chartCardVariants,
65263
- initial: "initial",
65264
- animate: "animate",
65265
- children: [
65266
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's Output" }),
65267
- /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: /* @__PURE__ */ jsx(
65268
- OutputProgressChart,
65269
- {
65270
- currentOutput: workspace.total_actions || 0,
65271
- targetOutput: workspace.target_output || 0
65272
- }
65273
- ) })
65274
- ]
65275
- }
65276
- ),
65277
- /* @__PURE__ */ jsxs(
65278
- motion.div,
65279
- {
65280
- className: `bg-white rounded-lg shadow-sm p-4 flex flex-col min-h-0 ${shouldShowCycleTimeChart || isUptimeMode ? "lg:col-span-10" : idleTimeVlmEnabled ? "lg:col-span-6" : "lg:col-span-8"}`,
65281
- variants: chartCardVariants,
65282
- initial: "initial",
65283
- animate: "animate",
65284
- children: [
65285
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 mb-4 flex-none", children: [
65286
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700", children: isUptimeMode ? "Machine Utilization" : shouldShowCycleTimeChart ? "Cycle Time (last 60 minutes)" : "Hourly Output" }),
65287
- !isUptimeMode && /* @__PURE__ */ jsx(
65288
- "button",
65289
- {
65290
- onClick: () => setShowChartIdleTime(!showChartIdleTime),
65291
- 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"}`,
65292
- children: showChartIdleTime ? /* @__PURE__ */ jsxs(Fragment, { children: [
65293
- /* @__PURE__ */ jsx(EyeOff, { className: "w-4 h-4 mr-1.5" }),
65294
- "Hide Idle Time"
65295
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
65296
- /* @__PURE__ */ jsx(Eye, { className: "w-4 h-4 mr-1.5" }),
65297
- "Show Idle Time"
65298
- ] })
65299
- }
65300
- )
65301
- ] }),
65302
- /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: isUptimeMode ? /* @__PURE__ */ jsx(
65303
- HourlyUptimeChart,
65304
- {
65305
- idleTimeHourly: workspace.idle_time_hourly,
65306
- shiftStart: workspace.shift_start,
65307
- shiftEnd: workspace.shift_end,
65308
- shiftDate: idleClipDate,
65309
- timezone,
65310
- elapsedMinutes: elapsedShiftMinutes
65311
- }
65312
- ) : shouldShowCycleTimeChart ? /* @__PURE__ */ jsx(
65313
- CycleTimeOverTimeChart,
65314
- {
65315
- data: workspace.hourly_action_counts || [],
65316
- idealCycleTime: workspace.ideal_cycle_time || 0,
65317
- shiftStart: workspace.shift_start || ""
65318
- }
65319
- ) : /* @__PURE__ */ jsx(
65320
- HourlyOutputChart2,
65321
- {
65322
- data: workspace.hourly_action_counts || [],
65323
- pphThreshold: workspace.pph_threshold || 0,
65324
- shiftStart: workspace.shift_start || "06:00",
65325
- shiftEnd: workspace.shift_end,
65326
- showIdleTime: showChartIdleTime,
65327
- idleTimeHourly: workspace.idle_time_hourly,
65328
- idleTimeClips,
65329
- idleTimeClipClassifications,
65330
- shiftDate: idleClipDate,
65331
- timezone
65332
- }
65333
- ) })
65334
- ]
65335
- }
65336
- ),
65337
- !shouldShowCycleTimeChart && idleTimeVlmEnabled && /* @__PURE__ */ jsxs(
65338
- motion.div,
65339
- {
65340
- className: "bg-white rounded-lg shadow-sm p-4 lg:col-span-2 flex flex-col min-h-0",
65341
- variants: chartCardVariants,
65342
- initial: "initial",
65343
- animate: "animate",
65344
- children: [
65345
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Idle Time Breakdown" }),
65346
- /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: /* @__PURE__ */ jsx(
65347
- IdleTimeReasonChart,
65348
- {
65349
- data: idleTimeData.chartData,
65350
- isLoading: idleTimeData.isLoading,
65351
- error: idleTimeData.error
65352
- }
65353
- ) })
65354
- ]
65355
- }
65356
- )
65357
- ] }),
65638
+ /* @__PURE__ */ jsxs(
65639
+ "div",
65640
+ {
65641
+ className: clsx(
65642
+ "grid grid-cols-1 gap-3 min-h-0",
65643
+ isUptimeMode && showIdleBreakdownChart ? "lg:grid-cols-3" : "lg:grid-cols-10",
65644
+ desktopTopSectionClass
65645
+ ),
65646
+ children: [
65647
+ !shouldShowCycleTimeChart && !isUptimeMode && /* @__PURE__ */ jsxs(
65648
+ motion.div,
65649
+ {
65650
+ className: "bg-white rounded-lg shadow-sm p-4 lg:col-span-2 flex flex-col min-h-0",
65651
+ variants: chartCardVariants,
65652
+ initial: "initial",
65653
+ animate: "animate",
65654
+ children: [
65655
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's Output" }),
65656
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: /* @__PURE__ */ jsx(
65657
+ OutputProgressChart,
65658
+ {
65659
+ currentOutput: workspace.total_actions || 0,
65660
+ targetOutput: workspace.target_output || 0
65661
+ }
65662
+ ) })
65663
+ ]
65664
+ }
65665
+ ),
65666
+ /* @__PURE__ */ jsxs(
65667
+ motion.div,
65668
+ {
65669
+ className: clsx(
65670
+ "bg-white rounded-lg shadow-sm p-4 flex flex-col min-h-0",
65671
+ isUptimeMode && showIdleBreakdownChart ? "lg:col-span-2" : shouldShowCycleTimeChart || isUptimeMode ? "lg:col-span-10" : idleTimeVlmEnabled ? "lg:col-span-6" : "lg:col-span-8"
65672
+ ),
65673
+ variants: chartCardVariants,
65674
+ initial: "initial",
65675
+ animate: "animate",
65676
+ children: [
65677
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 mb-4 flex-none", children: [
65678
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700", children: isUptimeMode ? "Machine Utilization" : shouldShowCycleTimeChart ? "Cycle Time (last 60 minutes)" : "Hourly Output" }),
65679
+ !isUptimeMode && /* @__PURE__ */ jsx(
65680
+ "button",
65681
+ {
65682
+ onClick: () => setShowChartIdleTime(!showChartIdleTime),
65683
+ 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"}`,
65684
+ children: showChartIdleTime ? /* @__PURE__ */ jsxs(Fragment, { children: [
65685
+ /* @__PURE__ */ jsx(EyeOff, { className: "w-4 h-4 mr-1.5" }),
65686
+ "Hide Idle Time"
65687
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
65688
+ /* @__PURE__ */ jsx(Eye, { className: "w-4 h-4 mr-1.5" }),
65689
+ "Show Idle Time"
65690
+ ] })
65691
+ }
65692
+ )
65693
+ ] }),
65694
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: isUptimeMode ? /* @__PURE__ */ jsx(
65695
+ HourlyUptimeChart,
65696
+ {
65697
+ idleTimeHourly: workspace.idle_time_hourly,
65698
+ shiftStart: workspace.shift_start,
65699
+ shiftEnd: workspace.shift_end,
65700
+ shiftDate: idleClipDate,
65701
+ timezone,
65702
+ elapsedMinutes: elapsedShiftMinutes
65703
+ }
65704
+ ) : shouldShowCycleTimeChart ? /* @__PURE__ */ jsx(
65705
+ CycleTimeOverTimeChart,
65706
+ {
65707
+ data: workspace.hourly_action_counts || [],
65708
+ idealCycleTime: workspace.ideal_cycle_time || 0,
65709
+ shiftStart: workspace.shift_start || ""
65710
+ }
65711
+ ) : /* @__PURE__ */ jsx(
65712
+ HourlyOutputChart2,
65713
+ {
65714
+ data: workspace.hourly_action_counts || [],
65715
+ pphThreshold: workspace.pph_threshold || 0,
65716
+ shiftStart: workspace.shift_start || "06:00",
65717
+ shiftEnd: workspace.shift_end,
65718
+ showIdleTime: showChartIdleTime,
65719
+ idleTimeHourly: workspace.idle_time_hourly,
65720
+ idleTimeClips,
65721
+ idleTimeClipClassifications,
65722
+ shiftDate: idleClipDate,
65723
+ timezone
65724
+ }
65725
+ ) })
65726
+ ]
65727
+ }
65728
+ ),
65729
+ !shouldShowCycleTimeChart && idleTimeVlmEnabled && /* @__PURE__ */ jsxs(
65730
+ motion.div,
65731
+ {
65732
+ className: clsx(
65733
+ "bg-white rounded-lg shadow-sm p-4 flex flex-col min-h-0",
65734
+ isUptimeMode ? "lg:col-span-1" : "lg:col-span-2"
65735
+ ),
65736
+ variants: chartCardVariants,
65737
+ initial: "initial",
65738
+ animate: "animate",
65739
+ children: [
65740
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Idle Time Breakdown" }),
65741
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: /* @__PURE__ */ jsx(
65742
+ IdleTimeReasonChart,
65743
+ {
65744
+ data: idleTimeData.chartData,
65745
+ isLoading: idleTimeData.isLoading,
65746
+ error: idleTimeData.error
65747
+ }
65748
+ ) })
65749
+ ]
65750
+ }
65751
+ )
65752
+ ]
65753
+ }
65754
+ ),
65358
65755
  isUptimeMode ? /* @__PURE__ */ jsx("div", { className: clsx("flex min-h-0", desktopBottomSectionClass), children: /* @__PURE__ */ jsx(UptimeMetricCards, { workspace, uptimePieData, className: "flex-1" }) }) : shouldShowCycleTimeChart ? /* @__PURE__ */ jsxs("div", { className: clsx("grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 min-h-0", desktopBottomSectionClass), children: [
65359
65756
  /* @__PURE__ */ jsxs(Card2, { children: [
65360
65757
  /* @__PURE__ */ jsx(CardHeader2, { className: "pb-2 flex-none", children: /* @__PURE__ */ jsx(CardTitle2, { className: "text-lg text-center", children: "Efficiency" }) }),
@@ -71640,4 +72037,4 @@ var streamProxyConfig = {
71640
72037
  }
71641
72038
  };
71642
72039
 
71643
- export { 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, 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, KPIsOverviewView_default as KPIsOverviewView, LINE_1_UUID, LINE_2_UUID, LargeOutputProgressChart, LeaderboardDetailView_default as LeaderboardDetailView, Legend6 as Legend, LineAssignmentDropdown, LineChart, LineHistoryCalendar, LineMonthlyHistory, LineMonthlyPdfGenerator, 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, PlayPauseIndicator, PrefetchConfigurationError, PrefetchError, PrefetchEvents, PrefetchStatus, PrefetchTimeoutError, ProfileView_default as ProfileView, RegistryProvider, RoleBadge, S3ClipsSupabaseService as S3ClipsService, S3Service, 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, WorkspaceDetailView_default as WorkspaceDetailView, WorkspaceDisplayNameExample, WorkspaceGrid, WorkspaceGridItem, WorkspaceHealthCard, WorkspaceHealthView_default as WorkspaceHealthView, WorkspaceHistoryCalendar, WorkspaceMetricCards, WorkspaceMetricCardsImpl, WorkspaceMonthlyDataFetcher, WorkspaceMonthlyHistory, WorkspaceMonthlyPdfGenerator, WorkspacePdfExportButton, WorkspacePdfGenerator, WorkspaceWhatsAppShareButton, actionService, aggregateKPIsFromLineMetricsRows, apiUtils, areAllLinesOnSameShift, authCoreService, authOTPService, authRateLimitService, awardsService, buildDateKey, buildKPIsFromLineMetricsRow, buildShiftGroupsKey, captureSentryException, captureSentryMessage, checkRateLimit2 as checkRateLimit, clearAllRateLimits2 as clearAllRateLimits, clearRateLimit2 as clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearSentryContext, clearWorkspaceDisplayNamesCache, cn, createDefaultKPIs, createInvitationService, createLinesService, createSessionTracker, createStorageService, createStreamProxyHandler, createSupabaseClient, createSupervisorService, createThrottledReload, createUserManagementService, createUserService, dashboardService, deleteThread, fetchIdleTimeReasons, filterDataByDateKeyRange, forceRefreshWorkspaceDisplayNames, formatAwardMonth, formatDateInZone, formatDateKeyForDisplay, formatDateTimeInZone, formatDuration, formatISTDate, formatIdleTime, formatRangeLabel, formatReasonLabel, formatRelativeTime, formatTimeInZone, fromUrlFriendlyName, getAllLineDisplayNames, getAllThreadMessages, getAllWorkspaceDisplayNamesAsync, getAllWorkspaceDisplayNamesSnapshot, getAnonClient, getAvailableShiftIds, getAwardBadgeType, getAwardDescription, getAwardTitle, getBrowserName, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getConfiguredLineIds, getCoreSessionRecordingProperties, getCoreSessionReplayUrl, getCurrentShift, getCurrentShiftForLine, getCurrentTimeInZone, getDashboardHeaderTimeInZone, getDateKeyFromDate, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultLineId, getDefaultTabForWorkspace, getInitials, getLineDisplayName, getManufacturingInsights, getMetricsTablePrefix, getMonthKeyBounds, getMonthWeekRanges, getNextUpdateInterval, getOperationalDate, getReasonColor, getS3SignedUrl, getS3VideoSrc, getShiftData, getShiftNameById, getShiftWorkDurationSeconds, getShortShiftName, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getSubscriptionManager, getThreadMessages, getUniformShiftGroup, getUserThreads, getUserThreadsPaginated, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceNavigationParams, groupLinesByShift, hasAnyShiftData, identifyCoreUser, initializeCoreMixpanel, isEfficiencyOnTrack, isFullMonthRange, isLegacyConfiguration, isPrefetchError, isSafari, isTransitionPeriod, isUrlPermanentlyFailed, isValidFactoryViewConfiguration, isValidLineInfoPayload, isValidPrefetchParams, isValidPrefetchStatus, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, lineLeaderboardService, linesService, mergeWithDefaultConfig, migrateLegacyConfiguration, normalizeDateKeyRange, optifyeAgentClient, parseDateKeyToDate, parseS3Uri, preInitializeWorkspaceDisplayNames, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, resetFailedUrl, resetSubscriptionManager, s3VideoPreloader, setSentryUserContext, setSentryWorkspaceContext, 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, 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 };
72040
+ export { 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, KPIsOverviewView_default as KPIsOverviewView, LINE_1_UUID, LINE_2_UUID, LargeOutputProgressChart, LeaderboardDetailView_default as LeaderboardDetailView, Legend6 as Legend, LineAssignmentDropdown, LineChart, LineHistoryCalendar, LineMonthlyHistory, LineMonthlyPdfGenerator, 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, PlayPauseIndicator, PrefetchConfigurationError, PrefetchError, PrefetchEvents, PrefetchStatus, PrefetchTimeoutError, ProfileView_default as ProfileView, RegistryProvider, RoleBadge, S3ClipsSupabaseService as S3ClipsService, S3Service, 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, WorkspaceDetailView_default as WorkspaceDetailView, WorkspaceDisplayNameExample, WorkspaceGrid, WorkspaceGridItem, WorkspaceHealthCard, WorkspaceHealthView_default as WorkspaceHealthView, WorkspaceHistoryCalendar, WorkspaceMetricCards, WorkspaceMetricCardsImpl, WorkspaceMonthlyDataFetcher, WorkspaceMonthlyHistory, WorkspaceMonthlyPdfGenerator, WorkspacePdfExportButton, WorkspacePdfGenerator, WorkspaceWhatsAppShareButton, actionService, aggregateKPIsFromLineMetricsRows, apiUtils, areAllLinesOnSameShift, authCoreService, authOTPService, authRateLimitService, awardsService, buildDateKey, buildKPIsFromLineMetricsRow, buildShiftGroupsKey, captureSentryException, captureSentryMessage, checkRateLimit2 as checkRateLimit, clearAllRateLimits2 as clearAllRateLimits, clearRateLimit2 as clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearSentryContext, clearWorkspaceDisplayNamesCache, cn, createDefaultKPIs, createInvitationService, createLinesService, createSessionTracker, createStorageService, createStreamProxyHandler, createSupabaseClient, createSupervisorService, createThrottledReload, createUserManagementService, createUserService, dashboardService, deleteThread, fetchIdleTimeReasons, filterDataByDateKeyRange, forceRefreshWorkspaceDisplayNames, formatAwardMonth, formatDateInZone, formatDateKeyForDisplay, formatDateTimeInZone, formatDuration, formatISTDate, formatIdleTime, formatRangeLabel, formatReasonLabel, formatRelativeTime, formatTimeInZone, fromUrlFriendlyName, getAllLineDisplayNames, getAllThreadMessages, getAllWorkspaceDisplayNamesAsync, getAllWorkspaceDisplayNamesSnapshot, getAnonClient, getAvailableShiftIds, getAwardBadgeType, getAwardDescription, getAwardTitle, getBrowserName, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getConfiguredLineIds, getCoreSessionRecordingProperties, getCoreSessionReplayUrl, getCurrentShift, getCurrentShiftForLine, getCurrentTimeInZone, getDashboardHeaderTimeInZone, getDateKeyFromDate, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultLineId, getDefaultTabForWorkspace, getInitials, getLineDisplayName, getManufacturingInsights, getMetricsTablePrefix, getMonthKeyBounds, getMonthWeekRanges, getNextUpdateInterval, getOperationalDate, getReasonColor, getS3SignedUrl, getS3VideoSrc, getShiftData, getShiftNameById, getShiftWorkDurationSeconds, getShortShiftName, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getSubscriptionManager, getThreadMessages, getUniformShiftGroup, getUserThreads, getUserThreadsPaginated, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceNavigationParams, groupLinesByShift, hasAnyShiftData, identifyCoreUser, initializeCoreMixpanel, isEfficiencyOnTrack, isFullMonthRange, isLegacyConfiguration, isPrefetchError, isSafari, isTransitionPeriod, isUrlPermanentlyFailed, isValidFactoryViewConfiguration, isValidLineInfoPayload, isValidPrefetchParams, isValidPrefetchStatus, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, lineLeaderboardService, linesService, mergeWithDefaultConfig, migrateLegacyConfiguration, normalizeDateKeyRange, optifyeAgentClient, parseDateKeyToDate, parseS3Uri, preInitializeWorkspaceDisplayNames, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, resetFailedUrl, resetSubscriptionManager, s3VideoPreloader, setSentryUserContext, setSentryWorkspaceContext, 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, 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 };