PageSourceSearch

https://navpro.truckerpath.com/assets/trips-details-CB5VSABe.js

js truckerpath.com collected 2026-10-01 12:05:14 UTC 116,282 bytes, 3,714 lines download raw bytes

1import { a as __toESM } from "./rolldown-runtime-Cql5ZV07.js";
2import { p as require_react } from "./vendor-charts-D81iZKCV.js";
3import { f as useNavigate, g as require_compiler_runtime, r as Link, t as require_jsx_runtime } from "./vendor-react-HZz3WA9p.js";
4import { R as useDebounceFn_default, S as compact, t as require_validator } from "./vendor-utils-DiM3BD4o.js";
5import { a as Trigger2, i as Root2, n as Header, r as Item, t as Content2 } from "./vendor-ui-G6aSO5L-.js";
6import { n as toast } from "./dist-Bh07-69G.js";
7import { $t as Download, An as ChevronDown, G as Plus, Lt as Globe, Mn as Calendar, Ot as Info, Qt as EllipsisVertical, V as RefreshCw, b as Trash2, bn as CircleCheck, cn as Clock, et as NotepadText, g as Truck, lt as MessageSquareText, mt as MapPin, n as X, q as Phone, v as TriangleAlert, xt as LoaderCircle } from "./vendor-lucide-EY3Z5fcy.js";
8import { a as cn, r as T, t as Button } from "./button-BWyXpawe.js";
9import { t as BizIcon } from "./biz-icon-BHlHk8WD.js";
10import { a as getDisplay, i as formatPhone, s as getNumberValue } from "./strings-dAFeDkjR.js";
11import { D as toDate, p as format } from "./vendor-date-d6_4rWHy.js";
12import { a as _formatRelative, f as safeFormatDate, s as formatDateWithTimezone } from "./dates-B2P7D4-n.js";
13import { i as createColumnHelper } from "./vendor-tanstack-N3AJtZOe.js";
14import { t as Spin } from "./spin-Bjb5hq6_.js";
15import { b as useForm, c as enumType, f as objectType, i as arrayType, m as stringType, t } from "./vendor-form-DCqShb_y.js";
16import { t as Label } from "./label-BU8XDazs.js";
17import { a as AlertDialogDescription, c as AlertDialogTitle, i as AlertDialogContent, o as AlertDialogFooter, r as AlertDialogCancel, s as AlertDialogHeader, t as AlertDialog } from "./alert-dialog-DqgZ-9QP.js";
18import { a as ControlPosition, s as MapControl } from "./vendor-maps-1lAD1rp9.js";
19import { $t as useAppDispatch, Bt as uploadImage, C as TabsContent, Kn as Avatar, Qt as useAppSelector, Rt as useMessagesContext, S as Tabs, T as TabsTrigger, Wt as selectFriends, Xt as openDialerNumpad, Yn as trackMethodCall, Yt as tonsToLbs, _t as SelectTrigger, cn as DialogFooter, ct as Empty, d as Alert, dn as DialogTitle, dt as EmptyHeader, ft as EmptyMedia, gt as SelectItem, hn as Badge, ht as SelectContent, in as Dialog, ir as TooltipOverflowTrigger, ln as DialogHeader, m as InputField, mt as Select, nr as Tooltip, on as DialogContent, or as TooltipTrigger, p as AlertTitle, pr as Separator, pt as EmptyTitle, qn as AvatarFallback, qt as metersToFtIn, rr as TooltipContent, rt as FormWrapper, tt as Textarea, un as DialogInner, ut as EmptyDescription, vt as SelectValue, w as TabsList, zt as getShowEditRoute } from "./main-DDHJZG-i.js";
20import { n as DocumentItem, t as DocumentUpload } from "./document-upload-CFFEvI8B.js";
21import { E as useMapActions, O as MapAPIProvider, _ as MapProvider, a as ControlInfo, c as MAP_ELEMENT_ID, l as MapDefault, v as useMapContext, w as useIsMapFullscreen } from "./marker-tQkMpDnD.js";
22import { n as CheckboxGroupField } from "./checkbox-field-Bhc3M4dB.js";
23import { a as useDeleteTripDocumentMutation, c as useGetTripDocumentsQuery, f as useSaveTripNoteMutation, i as useAddTripDocumentsMutation, l as useGetTripNotesQuery, m as useSendTripUpdatesMutation, o as useDeleteTripMutation, s as useGetTripDetailsQuery } from "./use-map-trip-BnNvO0V0.js";
24import { t as MapDefaultControls } from "./map-default-controls-Cg-QqICw.js";
25import { i as useTripDetails, n as formatMinutes, r as formatRoutingOptions, t as MapTrip } from "./map-trip-BHmtbu7x.js";
26var import_compiler_runtime$24 = /* @__PURE__ */ __toESM(require_compiler_runtime());
27var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime());
28function ProgressSegment(t0) {
29	const $ = (0, import_compiler_runtime$24.c)(8);
30	let className;
31	let props;
32	if ($[0] !== t0) {
33		({className, ...props} = t0);
34		$[0] = t0;
35		$[1] = className;
36		$[2] = props;
37	} else {
38		className = $[1];
39		props = $[2];
40	}
41	let t1;
42	if ($[3] !== className) {
43		t1 = cn("flex h-1 w-full items-center gap-0.5", className);
44		$[3] = className;
45		$[4] = t1;
46	} else t1 = $[4];
47	let t2;
48	if ($[5] !== props || $[6] !== t1) {
49		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
50			...props,
51			className: t1
52		});
53		$[5] = props;
54		$[6] = t1;
55		$[7] = t2;
56	} else t2 = $[7];
57	return t2;
58}
59var progressSegmentItemVariants = T({
60	base: "h-full flex-1",
61	variants: { variant: {
62		default: "bg-[#E6E7EB]",
63		success: "bg-green-700",
64		destructive: "bg-destructive"
65	} },
66	defaultVariants: { variant: "default" }
67});
68function ProgressSegmentItem(t0) {
69	const $ = (0, import_compiler_runtime$24.c)(10);
70	let className;
71	let props;
72	let variant;
73	if ($[0] !== t0) {
74		({className, variant, ...props} = t0);
75		$[0] = t0;
76		$[1] = className;
77		$[2] = props;
78		$[3] = variant;
79	} else {
80		className = $[1];
81		props = $[2];
82		variant = $[3];
83	}
84	let t1;
85	if ($[4] !== className || $[5] !== variant) {
86		t1 = progressSegmentItemVariants({
87			variant,
88			className
89		});
90		$[4] = className;
91		$[5] = variant;
92		$[6] = t1;
93	} else t1 = $[6];
94	let t2;
95	if ($[7] !== props || $[8] !== t1) {
96		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
97			...props,
98			className: t1
99		});
100		$[7] = props;
101		$[8] = t1;
102		$[9] = t2;
103	} else t2 = $[9];
104	return t2;
105}
106const getTextFromProgressHistory = (progressHistory) => {
107	const totalDelay = progressHistory?.reduce((sum, { delayMinutes }) => sum + delayMinutes, 0) ?? 0;
108	if (totalDelay > 0) {
109		const hours = Math.floor(totalDelay / 60);
110		const minutes = totalDelay % 60;
111		return {
112			text: hours > 0 ? `Delay ${hours}h ${minutes}m` : `Delay ${minutes}m`,
113			color: "text-destructive"
114		};
115	}
116	if (!(progressHistory?.some((item) => item.onTime === true) ?? false)) return {
117		text: "Not Started",
118		color: "text-muted-foreground"
119	};
120	return {
121		text: "On Time",
122		color: "text-green-700"
123	};
124};
125const getStatusFromItem = (item) => {
126	if (item.onTime === true) return "success";
127	if (item.onTime === false) return "destructive";
128	return "default";
129};
130var columnHelper = createColumnHelper();
131var badgeVariantByStatus = {
132	Scheduled: "default",
133	In_Transit: "success",
134	Completed: "neutral-subtle",
135	Deleted: "destructive-subtle"
136};
137var getDisplayStatus = (status) => {
138	if (!status) return "-";
139	return status === "In_Transit" ? "IN TRANSIT" : status.toUpperCase();
140};
141const getBadgeVariantByStatus = (status) => {
142	return badgeVariantByStatus[status];
143};
144const getTripsTableColumns = (tripsTab) => {
145	return compact([
146		columnHelper.accessor("tripCustomId", {
147			id: "tripCustomId",
148			header: () => {
149				return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
150					className: "flex items-center justify-start gap-1 text-xs",
151					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "TRIP ID" })
152				});
153			},
154			size: 106,
155			cell: (info) => {
156				return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
157					className: "flex items-center",
158					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
159						className: "font-medium text-foreground",
160						children: getDisplay(info.getValue(), "--")
161					})
162				});
163			}
164		}),
165		columnHelper.accessor("status", {
166			id: "status",
167			header: () => {
168				return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
169					className: "flex items-center justify-start gap-1 text-xs",
170					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "STATUS" })
171				});
172			},
173			size: 106,
174			cell: (info) => {
175				const status = info.getValue();
176				if (status === "Deleted") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
177					className: "flex items-center",
178					children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
179						asChild: true,
180						children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
181							size: "lg",
182							className: "w-[118px] uppercase",
183							variant: getBadgeVariantByStatus(status),
184							children: getDisplayStatus(status)
185						})
186					}
186), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: "Deleted by driver" })] })
187				});
188				return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
189					className: "flex items-center",
190					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
191						size: "lg",
192						className: "w-[118px] uppercase",
193						variant: getBadgeVariantByStatus(info.getValue()),
194						children: getDisplayStatus(info.getValue())
195					})
196				});
197			}
198		}),
199		columnHelper.accessor("driverName", {
200			id: "driverName",
201			header: () => {
202				return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
203					className: "flex items-center justify-start gap-1 text-xs",
204					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "DRIVER" })
205				});
206			},
207			size: 130,
208			cell: (info) => {
209				return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
210					className: "flex items-center",
211					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
212						className: "max-w-35.5 truncate font-medium text-primary",
213						children: getDisplay(info.getValue())
214					})
215				});
216			}
217		}),
218		columnHelper.display({
219			id: "from",
220			header: () => {
221				return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
222					className: "flex items-center justify-start gap-1 text-xs",
223					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "FROM" })
224				});
225			},
226			size: 130,
227			cell: (info) => {
228				const row = info.row.original;
229				const pickupLocation = [row.pickupCity, row.pickupState].filter(Boolean).join(", ") || "-";
230				return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
231					className: "flex items-center",
232					children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipOverflowTrigger, {
233						asChild: true,
234						children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
235							className: "inline-block max-w-35.5 truncate font-medium text-foreground",
236							children: pickupLocation
237						})
238					}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: pickupLocation })] })
239				});
240			}
241		}),
242		columnHelper.accessor("stopCount", {
243			id: "stopCount",
244			header: () => {
245				return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
246					className: "flex items-center justify-center gap-1 text-xs",
247					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "STOPS" }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, { className: "size-4 cursor-help text-muted-foreground" }) }
247), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Number of stops in this trip" }) })] })]
248				});
249			},
250			size: 76,
251			cell: (info) => {
252				const stops = info.getValue();
253				if (stops === 0 || !stops) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
254					className: "flex items-center justify-center text-muted-foreground",
255					children: "-"
256				});
257				return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
258					className: "flex items-center justify-center",
259					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
260						className: "inline-flex size-6 items-center justify-center rounded-full border-2 border-foreground text-xs font-semibold",
261						children: stops
262					})
263				});
264			}
265		}),
266		columnHelper.display({
267			id: "to",
268			header: () => {
269				return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
270					className: "flex items-center justify-start gap-1 text-xs",
271					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "TO" })
272				});
273			},
274			size: 106,
275			cell: (info) => {
276				const row = info.row.original;
277				const dropoffLocation = [row.dropoffCity, row.dropoffState].filter(Boolean).join(", ") || "-";
278				return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
279					className: "flex items-center",
280					children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipOverflowTrigger, {
281						asChild: true,
282						children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
283							className: "inline-block max-w-35.5 truncate font-medium text-foreground",
284							children: dropoffLocation
285						})
286					}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: dropoffLocation })] })
287				});
288			}
289		}),
290		tripsTab !== "Shared" && columnHelper.display({
291			id: "progress",
292			header: () => {
293				return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
294					className: "flex items-center justify-start gap-1 text-xs",
295					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "PROGRESS" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TooltipTrigger, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, { className: "size-4 cursor-help text-muted-foreground" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Trip progress status" }) })] }) })]
296				});
297			},
298			size: 100,
299			cell: (info) => {
300				const status = info?.row?.original?.status;
301				const progressHistory = (info?.row?.original?.progressHistory ?? []).slice(1);
302				const { text, color } = getTextFromProgressHistory(progressHistory);
303				return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
304					className: "flex items-center gap-2",
305					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ProgressSegment, {
306						className: "w-17.5",
307						children: [progressHistory.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressSegmentItem, { variant: "default" }), progressHistory.map((item, index) => {
308							return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressSegmentItem, { variant: getStatusFromItem(item) }, index);
309						})]
310					}), text === "Not Started" && ["Completed", "In_Transit"].includes(status) ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
311						className: cn("text-sm", color),
312						children: text
313					})]
314				});
315			}
316		}),
317		columnHelper.accessor("docsCount", {
318			id: "docsCount",
319			header: () => {
320				return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
321					className: "flex items-center justify-center gap-1 text-xs",
322					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "DOCS" })
323				});
324			},
325			size: 52,
326			cell: (info) => {
327				return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
328					className: "flex items-center justify-center font-medium text-primary",
329					children: info.getValue()
330				});
331			}
332		}),
333		columnHelper.accessor("dropoffEta", {
334			id: "dropoffEta",
335			header: () => {
336				return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
337					className: "flex items-center justify-start gap-1 text-xs",
338					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "ARRIVAL TIME" })
339				});
340			},
341			size: 170,
342			cell: (info) => {
343				const dropoffEta = info.getValue();
344				const row = info.row.original;
345				const isETA = row.status === "Scheduled" || row.status === "In_Transit";
346				const arrivalTime = dropoffEta?.timestamp ? formatDateWithTimezone(dropoffEta.timestamp, "MMM d, HH:mm", dropoffEta.timezone) : "--";
347				return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
348					className: "flex items-center gap-2 font-medium",
349					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
350						className: "text-foreground",
351						children: arrivalTime
352					}), isETA && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
353						variant: "neutral-subtle",
354						children: "ETA"
355					})]
356				});
357			}
358		})
359	]);
360};
361var import_compiler_runtime$23 = /* @__PURE__ */ __toESM(require_compiler_runtime());
362var import_react = /* @__PURE__ */ __toESM(require_react());
363function Accordion(t0) {
364	const $ = (0, import_compiler_runtime$23.c)(4);
365	let props;
366	if ($[0] !== t0) {
367		({...props} = t0);
368		$[0] = t0;
369		$[1] = props;
370	} else props = $[1];
371	let t1;
372	if ($[2] !== props) {
373		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root2, {
374			"data-slot": "accordion",
375			...props
376		});
377		$[2] = props;
378		$[3] = t1;
379	} else t1 = $[3];
380	return t1;
381}
382function AccordionItem(t0) {
383	const $ = (0, import_compiler_runtime$23.c)(8);
384	let className;
385	let props;
386	if ($[0] !== t0) {
387		({className, ...props} = t0);
388		$[0] = t0;
389		$[1] = className;
390		$[2] = props;
391	} else {
392		className = $[1];
393		props = $[2];
394	}
395	let t1;
396	if ($[3] !== className) {
397		t1 = cn("border-b last:border-b-0", className);
398		$[3] = className;
399		$[4] = t1;
400	} else t1 = $[4];
401	let t2;
402	if ($[5] !== props || $[6] !== t1) {
403		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Item, {
404			"data-slot": "accordion-item",
405			className: t1,
406			...props
407		});
408		$[5] = props;
409		$[6] = t1;
410		$[7] = t2;
411	} else t2 = $[7];
412	return t2;
413}
414function AccordionTrigger(t0) {
415	const $ = (0, import_compiler_runtime$23.c)(11);
416	let children;
417	let className;
418	let props;
419	if ($[0] !== t0) {
420		({className, children, ...props} = t0);
421		$[0] = t0;
422		$[1] = children;
423		$[2] = className;
424		$[3] = props;
425	} else {
426		children = $[1];
427		className = $[2];
428		props = $[3];
429	}
430	let t1;
431	if ($[4] !== className) {
432		t1 = cn("flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/20 disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180", className);
433		$[4] = className;
434		$[5] = t1;
435	} else t1 = $[5];
436	let t2;
437	if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
438		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { className: "pointer-events-none m-2 size-4 shrink-0 translate-y-0.5 text-muted-foreground transition-transform duration-200" });
439		$[6] = t2;
440	} else t2 = $[6];
441	let t3;
442	if ($[7] !== children || $[8] !== props || $[9] !== t1) {
443		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Header, {
444			className: "flex",
445			children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Trigger2, {
446				"data-slot": "accordion-trigger",
447				className: t1,
448				...props,
449				children: [children, t2]
450			})
451		});
452		$[7] = children;
453		$[8] = props;
454		$[9] = t1;
455		$[10] = t3;
456	} else t3 = $[10];
457	return t3;
458}
459function AccordionContent(t0) {
460	const $ = (0, import_compiler_runtime$23.c)(12);
461	let children;
462	let className;
463	let props;
464	if ($[0] !== t0) {
465		({className, children, ...props} = t0);
466		$[0] = t0;
467		$[1] = children;
468		$[2] = className;
469		$[3] = props;
470	} else {
471		children = $[1];
472		className = $[2];
473		props = $[3];
474	}
475	let t1;
476	if ($[4] !== className) {
477		t1 = cn("pt-0 pb-4", className);
478		$[4] = className;
479		$[5] = t1;
480	} else t1 = $[5];
481	let t2;
482	if ($[6] !== children || $[7] !== t1) {
483		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
484			className: t1,
485			children
486		});
487		$[6] = children;
488		$[7] = t1;
489		$[8] = t2;
490	} else t2 = $[8];
491	let t3;
492	if ($[9] !== props || $[10] !== t2) {
493		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content2, {
494			"data-slot": "accordion-content",
495			className: "overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
496			...props,
497			children: t2
498		});
499		$[9] = props;
500		$[10] = t2;
501		$[11] = t3;
502	} else t3 = $[11];
503	return t3;
504}
505var import_compiler_runtime$22 = /* @__PURE__ */ __toESM(require_compiler_runtime());
506var RefreshIndicator = () => {
507	const $ = (0, import_compiler_runtime$22.c)(6);
508	const [isRotating, setIsRotating] = (0, import_react.useState)(false);
509	let t0;
510	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
511		t0 = () => {
512			trackMethodCall("handleRefresh", []);
513			setIsRotating(true);
514			setTimeout(() => {
515				setIsRotating(false);
516			}, 1e3);
517		};
518		$[0] = t0;
519	} else t0 = $[0];
520	const handleRefresh = t0;
521	const t1 = `text-primary transition-transform duration-500 ${isRotating ? "animate-spin" : ""} size-4 cursor-pointer`;
522	let t2;
523	if ($[1] !== t1) {
524		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RefreshCw, {
525			className: t1,
526			onClick: handleRefresh
527		});
528		$[1] = t1;
529		$[2] = t2;
530	} else t2 = $[2];
531	let t3;
532	if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
533		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
534			className: "text-sm text-muted-foreground",
535			children: "Just now"
536		});
537		$[3] = t3;
538	} else t3 = $[3];
539	let t4;
540	if ($[4] !== t2) {
541		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
542			className: "flex items-center gap-1",
543			children: [t2, t3]
544		});
545		$[4] = t2;
546		$[5] = t4;
547	} else t4 = $[5];
548	return t4;
549};
550var TopDriverInfo = (t0) => {
551	const $ = (0, import_compiler_runtime$22.c)(51);
552	const { driverInfo, tripsTab, status } = t0;
553	const dispatch = useAppDispatch();
554	const { messageTo } = useMessagesContext();
555	const friends = useAppSelector(selectFriends);
556	if (!driverInfo) {
557		let t1$1;
558		if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
559			t1$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
560			$[0] = t1$1;
561		} else t1$1 = $[0];
562		return t1$1;
563	}
564	const { driverName, phone, email, location } = driverInfo;
565	let t1;
566	if ($[1] !== email || $[2] !== friends) {
567		t1 = email ? friends?.find((f) => f.email === email) : void 0;
568		$[1] = email;
569		$[2] = friends;
570		$[3] = t1;
571	} else t1 = $[3];
572	const messageFriend = t1;
573	let t2;
574	bb0: {
575		if (!driverInfo.isFleetUser || !email) {
576			t2 = false;
577			break bb0;
578		}
579		if (!friends) {
580			t2 = false;
581			break bb0;
582		}
583		t2 = !!messageFriend?.accId;
584	}
585	const canMessage = t2;
586	let t3;
587	if ($[4] !== dispatch || $[5] !== driverInfo.id || $[6] !== phone) {
588		t3 = (e) => {
589			e.preventDefault();
590			openDialerNumpad(dispatch, {
591				phone,
592				role: "driver",
593				personId: driverInfo.id,
594				source: "Loads detail"
595			});
596		};
597		$[4] = dispatch;
598		$[5] = driverInfo.id;
599		$[6] = phone;
600		$[7] = t3;
601	} else t3 = $[7];
602	const onClickCall = t3;
603	let t4;
604	if ($[8] !== messageFriend || $[9] !== messageTo) {
605		t4 = (e_0) => {
606			e_0.preventDefault();
607			if (messageFriend?.accId) messageTo(messageFriend.accId);
608		};
609		$[8] = messageFriend;
610		$[9] = messageTo;
611		$[10] = t4;
612	} else t4 = $[10];
613	const onClickMessage = t4;
614	let t5;
615	if ($[11] !== driverName) {
616		t5 = driverName.charAt(0);
617		$[11] = driverName;
618		$[12] = t5;
619	} else t5 = $[12];
620	let t6;
621	if ($[13] !== t5) {
622		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Avatar, {
623			className: "h-8 w-8",
624			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarFallback, { children: t5 })
625		});
626		$[13] = t5;
627		$[14] = t6;
628	} else t6 = $[14];
629	let t7;
630	if ($[15] !== driverName) {
631		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
632			className: "text-base font-semibold text-foreground",
633			children: driverName
634		});
635		$[15] = driverName;
636		$[16] = t7;
637	} else t7 = $[16];
638	let t8;
639	if ($[17] !== phone) {
640		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: phone });
641		$[17] = phone;
642		$[18] = t8;
643	} else t8 = $[18];
644	let t9;
645	if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
646		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
647			className: "text-[#E6E7EB]",
648			children: "|"
649		});
650		$[19] = t9;
651	} else t9 = $[19];
652	const t10 = `mailto:${email}`;
653	let t11;
654	if ($[20] !== email || $[21] !== t10) {
655		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
656			href: t10,
657			className: "underline",
658			children: email
659		});
660		$[20] = email;
661		$[21] = t10;
662		$[22] = t11;
663	} else t11 = $[22];
664	let t12;
665	if ($[23] !== t11 || $[24] !== t8) {
666		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
667			className: "flex items-center gap-2 text-xs font-normal text-[#64748B]",
668			children: [
669				t8,
670				t9,
671				t11
672			]
673		});
674		$[23] = t11;
675		$[24] = t8;
676		$[25] = t12;
677	} else t12 = $[25];
678	let t13;
679	if ($[26] !== t12 || $[27] !== t7) {
680		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [t7, t12] });
681		$[26] = t12;
682		$[27] = t7;
683		$[28] = t13;
684	} else t13 = $[28];
685	let t14;
686	if ($[29] !== t13 || $[30] !== t6) {
687		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
688			className: "flex items-center gap-3",
689			children: [t6, t13]
690		});
691		$[29] = t13;
692		$[30] = t6;
693		$[31] = t14;
694	} else t14 = $[31];
695	let t15;
696	if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
697		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
698			role: "button",
699			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Phone, { className: "size-4" })
700		});
701		$[32] = t15;
702	} else t15 = $[32];
703	let t16;
704	if ($[33] !== onClickCall) {
705		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
706			size: "icon",
707			variant: "ghost",
708			className: "size-8 rounded-md bg-muted text-primary hover:bg-muted/80",
709			onClick: onClickCall,
710			"aria-label": "Call driver",
711			asChild: true,
712			children: t15
713		});
714		$[33] = onClickCall;
715		$[34] = t16;
716	} else t16 = $[34];
717	let t17;
718	if ($[35] !== canMessage || $[36] !== onClickMessage) {
719		t17 = canMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
720			size: "icon",
721			variant: "ghost",
722			className: "size-8 rounded-md bg-muted text-primary hover:bg-muted/80",
723			onClick: onClickMessage,
724			"aria-label": "Message driver",
725			asChild: true,
726			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
727				role: "button",
728				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageSquareText, { className: "size-4" })
729			})
730		});
731		$[35] = canMessage;
732		$[36] = onClickMessage;
733		$[37] = t17;
734	} else t17 = $[37];
735	let t18;
736	if ($[38] !== t16 || $[39] !== t17) {
737		t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
738			className: "flex items-center gap-2",
739			children: [t16, t17]
740		});
741		$[38] = t16;
742		$[39] = t17;
743		$[40] = t18;
744	} else t18 = $[40];
745	let t19;
746	if ($[41] !== t14 || $[42] !== t18) {
747		t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
748			className: "flex w-full items-center justify-between",
749			children: [t14, t18]
750		});
751		$[41] = t14;
752		$[42] = t18;
753		$[43] = t19;
754	} else t19 = $[43];
755	let t20;
756	if ($[44] !== location || $[45] !== status || $[46] !== tripsTab) {
757		t20 = tripsTab === "Shared" && status === "In_Transit" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
758			className: "flex items-center gap-2 pt-4",
759			children: [
760				/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapPin, { className: "size-4 shrink-0 text-muted-foreground" }),
761				/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
762					className: "text-sm text-foreground",
763					children: "Current Location:"
764				}),
765				/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
766					className: "text-sm text-foreground",
767					children: location
768				}),
769				/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
770					className: "ml-2 h-3 w-px rounded-sm bg-border",
771					"aria-hidden": "true"
772				}),
773				/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RefreshIndicator, {})
774			]
775		});
776		$[44] = location;
777		$[45] = status;
778		$[46] = tripsTab;
779		$[47] = t20;
780	} else t20 = $[47];
781	let t21;
782	if ($[48] !== t19 || $[49] !== t20) {
783		t21 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [t19, t20] });
784		$[48] = t19;
785		$[49] = t20;
786		$[50] = t21;
787	} else t21 = $[50];
788	return t21;
789};
790var TripDriverInfo = (t0) => {
791	const $ = (0, import_compiler_runtime$22.c)(40);
792	const { driverInfo, tripsTab, status, dropoffEta } = t0;
793	if (!driverInfo) {
794		let t1$1;
795		if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
796			t1$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
797			$[0] = t1$1;
798		} else t1$1 = $[0];
799		return t1$1;
800	}
801	const { eldInfo, location, truckModel, routingMode } = driverInfo;
802	if (tripsTab === "Shared") {
803		let t1$1;
804		if ($[1] !== driverInfo || $[2] !== status || $[3] !== tripsTab) {
805			t1$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
806				className: "border-b pt-5 pb-6",
807				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TopDriverInfo, {
808					driverInfo,
809					tripsTab,
810					status
811				})
812			});
813			$[1] = driverInfo;
814			$[2] = status;
815			$[3] = tripsTab;
816			$[4] = t1$1;
817		} else t1$1 = $[4];
818		return t1$1;
819	}
820	let t1;
821	if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
822		t1 = cn("border-b");
823		$[5] = t1;
824	} else t1 = $[5];
825	let t2;
826	if ($[6] !== driverInfo || $[7] !== status || $[8] !== tripsTab) {
827		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
828			className: "items-center py-4 hover:no-underline",
829			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TopDriverInfo, {
830				driverInfo,
831				tripsTab,
832				status
833			})
834		});
835		$[6] = driverInfo;
836		$[7] = status;
837		$[8] = tripsTab;
838		$[9] = t2;
839	} else t2 = $[9];
840	let t3;
841	if ($[10] !== eldInfo) {
842		t3 = eldInfo && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
843			className: "flex flex-wrap items-center gap-2",
844			children: [
845				/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Clock, { className: "size-4 text-muted-foreground" }),
846				/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
847					className: "text-sm font-medium text-foreground",
848					children: "HOS: "
849				}),
850				(() => {
851					const items = [
852						{
853							label: "Break",
854							value: eldInfo?.breakTime
855						},
856						{
857							label: "Drive",
858							value: eldInfo?.driveTime
859						},
860						{
861							label: "Shift",
862							value: eldInfo?.shiftTime
863						},
864						{
865							label: "Cycle",
866							value: eldInfo?.cycleTime || eldInfo.cycleToday
867						}
868					];
869					if (items.every(_temp$5)) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
870						className: "text-sm text-foreground",
871						children: "N/A"
872					});
873					return items.map(_temp2$1);
874				})(),
875				/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RefreshIndicator, {})
876			]
877		});
878		$[10] = eldInfo;
879		$[11] = t3;
880	} else t3 = $[11];
881	let t4;
882	if ($[12] !== dropoffEta || $[13] !== status) {
883		t4 = status === "In_Transit" && dropoffEta?.timestamp && /* @__P
883URE__ */ (0, import_jsx_runtime.jsx)("div", {
884			className: "flex flex-col gap-2",
885			children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
886				className: "flex items-center gap-2 text-sm",
887				children: [
888					/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Calendar, { className: "size-4 text-muted-foreground" }),
889					/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
890						className: "text-foreground",
891						children: "ETA:"
892					}),
893					/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
894						className: "font-medium text-foreground",
895						children: formatDateWithTimezone(dropoffEta.timestamp, "MMM dd, yyyy, HH:mm", dropoffEta.timezone)
896					})
897				]
898			})
899		});
900		$[12] = dropoffEta;
901		$[13] = status;
902		$[14] = t4;
903	} else t4 = $[14];
904	let t5;
905	if ($[15] !== location || $[16] !== status) {
906		t5 = status === "In_Transit" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
907			className: "flex flex-wrap items-center gap-2",
908			children: [
909				/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapPin, { className: "size-4 shrink-0 text-muted-foreground" }),
910				/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
911					className: "shrink text-foreground",
912					children: location
913				}),
914				/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
915					className: "ml-2 h-3 w-px rounded-sm bg-border",
916					"aria-hidden": "true"
917				}),
918				/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RefreshIndicator, {})
919			]
920		});
921		$[15] = location;
922		$[16] = status;
923		$[17] = t5;
924	} else t5 = $[17];
925	let t6;
926	if ($[18] !== routingMode || $[19] !== truckModel?.limitedVehicleWeight || $[20] !== truckModel?.trailersCount || $[21] !== truckModel?.truckAxleCount || $[22] !== truckModel?.truckName || $[23] !== truckModel?.vehicleHeight || $[24] !== truckModel?.vehicleLength || $[25] !== truckModel?.vehicleWidth) {
927		t6 = routingMode === "truck" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
928			className: "flex items-center gap-2",
929			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Truck, { className: "size-4 shrink-0 text-muted-foreground" }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
930				className: "text-foreground",
931				children: ["Truck: ", getDisplay(truckModel?.truckName)]
932			})]
933		}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
934			className: "mt-1 ml-6 text-sm text-muted-foreground",
935			children: [
936				/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
937					"Height: ",
938					metersToFtIn(truckModel?.vehicleHeight).text,
939					", "
940				] }),
941				/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
942					"Width: ",
943					metersToFtIn(truckModel?.vehicleWidth).text,
944					", "
945				] }),
946				/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
947					"Length: ",
948					metersToFtIn(truckModel?.vehicleLength).text,
949					", "
950				] }),
951				/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
952					"Weight: ",
953					tonsToLbs(truckModel?.limitedVehicleWeight).text,
954					", "
955				] }),
956				/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
957					"Axles: ",
958					getDisplay(truckModel?.truckAxleCount),
959					", "
960				] }),
961				/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: ["Trailers: ", getDisplay(truckModel?.trailersCount)] })
962			]
963		})] });
964		$[18] = routingMode;
965		$[19] = truckModel?.limitedVehicleWeight;
966		$[20] = truckModel?.trailersCount;
967		$[21] = truckModel?.truckAxleCount;
968		$[22] = truckModel?.truckName;
969		$[23] = truckModel?.vehicleHeight;
970		$[24] = truckModel?.vehicleLength;
971		$[25] = truckModel?.vehicleWidth;
972		$[26] = t6;
973	} else t6 = $[26];
974	let t7;
975	if ($[27] !== t3 || $[28] !== t4 || $[29] !== t5 || $[30] !== t6) {
976		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, {
977			className: "pb-5",
978			children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
979				className: "flex flex-col gap-2",
980				children: [
981					t3,
982					t4,
983					t5,
984					t6
985				]
986			})
987		});
988		$[27] = t3;
989		$[28] = t4;
990		$[29] = t5;
991		$[30] = t6;
992		$[31] = t7;
993	} else t7 = $[31];
994	let t8;
995	if ($[32] !== t2 || $[33] !== t7) {
996		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
997			className: t1,
998			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
999				type: "single",
1000				collapsible: true,
1001				defaultValue: "driver-info",
1002				children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccordionItem, {
1003					value: "driver-info",
1004					className: "border-0",
1005					children: [t2, t7]
1006				})
1007			})
1008		});
1009		$[32] = t2;
1010		$[33] = t7;
1011		$[34] = t8;
1012	} else t8 = $[34];
1013	let t9;
1014	if ($[35] !== routingMode) {
1015		t9 = routingMode == "car" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1016			className: "mt-6 flex items-center gap-3 rounded-[10px] bg-[#fbf4ec] px-4 py-3",
1017			children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1018				className: "flex flex-1 items-start gap-3",
1019				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { name: "triangle-alert" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
1020					className: "text-sm leading-5 font-medium text-foreground",
1021					children: "This route is not optimize for truck."
1022				})]
1023			})
1024		});
1025		$[35] = routingMode;
1026		$[36] = t9;
1027	} else t9 = $[36];
1028	let t10;
1029	if ($[37] !== t8 || $[38] !== t9) {
1030		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [t8, t9] });
1031		$[37] = t8;
1032		$[38] = t9;
1033		$[39] = t10;
1034	} else t10 = $[39];
1035	return t10;
1036};
1037function _temp$5(item) {
1038	return !item.value;
1039}
1040function _temp2$1(item_0) {
1041	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1042		className: "flex items-center text-foreground",
1043		children: [
1044			/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: item_0.label }),
1045			/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1046				className: "ml-1",
1047				children: item_0.value || "--"
1048			}),
1049			/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1050				className: "ml-2 h-3 w-px rounded-sm bg-border",
1051				"aria-hidden": "true"
1052			})
1053		]
1054	}) }, item_0.label);
1055}
1056var import_compiler_runtime$21 = /* @__PURE__ */ __toESM(require_compiler_runtime());
1057var getArrivalStatus = (onTime) => {
1058	return typeof onTime !== "boolean" ? onTime : onTime ? "On Time" : "Delayed";
1059};
1060var StopIcon = (t0) => {
1061	const $ = (0, import_compiler_runtime$21.c)(4);
1062	const { index, stops } = t0;
1063	if (index == 0) {
1064		let t1$1;
1065		if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1066			t1$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { name: "pick-up" });
1067			$[0] = t1$1;
1068		} else t1$1 = $[0];
1069		return t1$1;
1070	}
1071	if (index === stops.length - 1) {
1072		let t1$1;
1073		if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1074			t1$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { name: "drop-off" });
1075			$[1] = t1$1;
1076		} else t1$1 = $[1];
1077		return t1$1;
1078	}
1079	let t1;
1080	if ($[2] !== index) {
1081		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1082			className: "z-10 flex h-6 w-6 items-center justify-center rounded-full border-2 border-black bg-white",
1083			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1084				className: "text-sm text-[#151B38]",
1085				children: index
1086			})
1087		});
1088		$[2] = index;
1089		$[3] = t1;
1090	} else t1 = $[3];
1091	return t1;
1092};
1093var TripItinerary = ({ stops, roadOptions, tripsTab, nextStopEta }) => {
1094	const [accordionKey, setAccordionKey] = (0, import_react.useState)(0);
1095	(0, import_react.useEffect)(() => {
1096		setAccordionKey(accordionKey + 1);
1097	}, [stops, roadOptions]);
1098	return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1099		className: "flex flex-col gap-4 pt-4",
1100		children: [tripsTab !== "Shared" && roadOptions && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1101			className: "text-sm text-muted-foreground",
1102			children: [
1103				"Road Options:",
1104				" ",
1105				/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1106					className: "text-muted-foreground",
1107					children: formatRoutingOptions(roadOptions)
1108				})
1109			]
1110		}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
1111			type: "multiple",
1112			className: "relative flex flex-col",
1113			children: stops.map((stop, index) => {
1114				const isLast = index === stops.length - 1;
1115				const isArrived = !!stop.realArriveTime;
1116				return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1117					className: "relative z-10 flex gap-4",
1118					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StopTimeline, {
1119						index,
1120						stops,
1121						stop,
1122						isLast,
1123						isArrived
1124					}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccordionItem, {
1125						value: String(index),
1126						className: "flex-1 border-0 pb-8",
1127						children: [tripsTab !== "Shared" ? /* @__P
1127URE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
1128							className: "items-start py-0 hover:no-underline",
1129							children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StopTriggerContent, {
1130								...stop,
1131								tripsTab,
1132								isNextStop: nextStopEta != null && stop.index === nextStopEta.index,
1133								nextStopEta
1134							})
1135						}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StopTriggerContent, {
1136							...stop,
1137							tripsTab,
1138							isNextStop: nextStopEta != null && stop.index === nextStopEta.index,
1139							nextStopEta
1140						}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StopDetails, { ...stop }) })]
1141					})]
1142				}, index);
1143			})
1144		}, accordionKey)]
1145	});
1146};
1147var StopTimeline = (t0) => {
1148	const $ = (0, import_compiler_runtime$21.c)(9);
1149	const { index, stops, isLast, isArrived } = t0;
1150	let t1;
1151	if ($[0] !== index || $[1] !== stops) {
1152		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1153			className: "flex shrink-0 items-center justify-center rounded-full",
1154			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StopIcon, {
1155				index,
1156				stops
1157			})
1158		});
1159		$[0] = index;
1160		$[1] = stops;
1161		$[2] = t1;
1162	} else t1 = $[2];
1163	let t2;
1164	if ($[3] !== isArrived || $[4] !== isLast) {
1165		t2 = !isLast && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: cn("mt-0 min-h-[36px] w-px flex-1", isArrived ? "rounded-[1px] bg-[#0E132F]" : "[background:repeating-linear-gradient(to_bottom,#E5E7EB_0px,#E5E7EB_4px,transparent_4px,transparent_8px)]") });
1166		$[3] = isArrived;
1167		$[4] = isLast;
1168		$[5] = t2;
1169	} else t2 = $[5];
1170	let t3;
1171	if ($[6] !== t1 || $[7] !== t2) {
1172		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1173			className: "relative flex w-[36px] shrink-0 flex-col items-center self-stretch",
1174			children: [t1, t2]
1175		});
1176		$[6] = t1;
1177		$[7] = t2;
1178		$[8] = t3;
1179	} else t3 = $[8];
1180	return t3;
1181};
1182var StopTriggerContent = (t0) => {
1183	const $ = (0, import_compiler_runtime$21.c)(16);
1184	let t1;
1185	if ($[0] !== t0) {
1186		const { tripsTab, isNextStop, nextStopEta,...stop } = t0;
1187		const arrivalStatus = getArrivalStatus(stop.progressRecord?.onTime);
1188		const isETA = tripsTab === "Shared" && !stop.arrived;
1189		const displayETATime = formatDateWithTimezone((Number(stop.departureTime) || 0) * 1e3, void 0, stop.timeZone);
1190		const displayArrivalTime = formatDateWithTimezone(Number(stop.realArriveTime) || 0, void 0, stop.timeZone);
1191		const displayTime = isETA ? displayETATime : displayArrivalTime;
1192		const showNextStopEta = isNextStop && !!nextStopEta && !stop.realArriveTime;
1193		let t2;
1194		if ($[2] !== nextStopEta || $[3] !== showNextStopEta) {
1195			t2 = showNextStopEta ? formatDateWithTimezone(nextStopEta.timestamp, void 0, nextStopEta.timezone) : null;
1196			$[2] = nextStopEta;
1197			$[3] = showNextStopEta;
1198			$[4] = t2;
1199		} else t2 = $[4];
1200		const nextEtaDisplay = t2;
1201		const nextEtaLateMs = showNextStopEta ? (() => {
1202			const refMs = stop.appointmentTime ? (Number(stop.appointmentTime) || 0) * 1e3 : (Number(stop.departureTime) || 0) * 1e3;
1203			return refMs > 0 && nextStopEta.timestamp > refMs ? nextStopEta.timestamp - refMs : 0;
1204		})() : 0;
1205		const nextEtaLateMinutes = Math.round(nextEtaLateMs / 6e4);
1206		const t3 = isETA ? "ETA Time:" : "Actual Arrival:";
1207		let t4;
1208		if ($[5] !== t3) {
1209			t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1210				className: "font-normal text-muted-foreground",
1211				children: t3
1212			});
1213			$[5] = t3;
1214			$[6] = t4;
1215		} else t4 = $[6];
1216		const t5 = displayTime === "N/A" ? "text-muted-foreground" : "text-base-foreground";
1217		let t6;
1218		if ($[7] !== t5) {
1219			t6 = cn("font-normal", t5);
1220			$[7] = t5;
1221			$[8] = t6;
1222		} else t6 = $[8];
1223		const t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1224			className: t6,
1225			children: displayTime
1226		});
1227		const t8 = arrivalStatus === "Delayed" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1228			className: "ml-1 text-destructive",
1229			children: [
1230				"(+",
1231				formatMinutes(stop.progressRecord?.delayMinutes ?? 100),
1232				")"
1233			]
1234		});
1235		let t9;
1236		if ($[9] !== arrivalStatus) {
1237			t9 = arrivalStatus && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
1238				variant: arrivalStatus === "Delayed" ? "destructive-subtle" : "success-subtle",
1239				children: arrivalStatus
1240			});
1241			$[9] = arrivalStatus;
1242			$[10] = t9;
1243		} else t9 = $[10];
1244		let t10;
1245		if ($[11] !== t4 || $[12] !== t7 || $[13] !== t8 || $[14] !== t9) {
1246			t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1247				className: "mt-2 flex flex-wrap items-center gap-1",
1248				children: [
1249					t4,
1250					t7,
1251					t8,
1252					t9
1253				]
1254			});
1255			$[11] = t4;
1256			$[12] = t7;
1257			$[13] = t8;
1258			$[14] = t9;
1259			$[15] = t10;
1260		} else t10 = $[15];
1261		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1262			className: "flex flex-col items-start gap-1",
1263			children: [
1264				/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
1265					className: "text-base leading-6 font-semibold text-foreground",
1266					children: stop.addressName
1267				}),
1268				/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
1269					className: "font-normal text-muted-foreground",
1270					children: stop.title
1271				}),
1272				t10,
1273				showNextStopEta && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1274					className: "mt-1 flex flex-wrap items-center gap-x-2 gap-y-1.5",
1275					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1276						className: "flex items-center gap-1",
1277						children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1278							className: "text-sm text-muted-foreground",
1279							children: "ETA Time:"
1280						}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1281							className: cn("text-sm font-medium", nextEtaDisplay === "N/A" ? "text-muted-foreground" : "text-foreground"),
1282							children: nextEtaDisplay
1283						})]
1284					}), nextEtaLateMinutes > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1285						className: "flex items-center gap-1 text-[#d4770e]",
1286						children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TriangleAlert, {
1287							"aria-hidden": true,
1288							className: "size-5"
1289						}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1290							className: "text-sm font-medium",
1291							children: [
1292								"Estimated ",
1293								formatMinutes(nextEtaLateMinutes),
1294								" late"
1295							]
1296						})]
1297					})]
1298				})
1299			]
1300		});
1301		$[0] = t0;
1302		$[1] = t1;
1303	} else t1 = $[1];
1304	return t1;
1305};
1306var DetailRow = (t0) => {
1307	const $ = (0, import_compiler_runtime$21.c)(8);
1308	const { label, value } = t0;
1309	const display = value && value !== "N/A" ? value : "N/A";
1310	const isNA = display === "N/A";
1311	let t1;
1312	if ($[0] !== label) {
1313		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1314			className: "shrink-0 text-muted-foreground",
1315			children: [label, ":"]
1316		});
1317		$[0] = label;
1318		$[1] = t1;
1319	} else t1 = $[1];
1320	const t2 = `min-w-0 break-all whitespace-pre-wrap ${isNA ? "text-muted-foreground" : "text-base-foreground"}`;
1321	let t3;
1322	if ($[2] !== display || $[3] !== t2) {
1323		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1324			className: t2,
1325			children: display
1326		});
1327		$[2] = display;
1328		$[3] = t2;
1329		$[4] = t3;
1330	} else t3 = $[4];
1331	let t4;
1332	if ($[5] !== t1 || $[6] !== t3) {
1333		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1334			className: "mt-2 flex items-start gap-2 text-sm",
1335			children: [t1, t3]
1336		});
1337		$[5] = t1;
1338		$[6] = t3;
1339		$[7] = t4;
1340	} else t4 = $[7];
1341	return t4;
1342};
1343var StopDetails = (stop) => {
1344	const $ = (0, import_compiler_runtime$21.c)(21);
1345	const t0 = Number(stop.realDepartmentTime) || 0;
1346	let t1;
1347	if ($[0] !== stop.timeZone || $[1] !== t0) {
1348		t1 = formatDateWithTimezone(t0, void 0, stop.timeZone);
1349		$[0] = stop.timeZone;
1350		$[1] = t0;
1351		$[2] = t1;
1352	} else t1 = $[2];
1353	let t2;
1354	if ($[3] !== t1) {
1355		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DetailRow, {
1356			label: "Actual Departure",
1357			value: t1
1358		});
1359		$[3] = t1;
1360		$[4] = t2;
1361	} else t2 = $[4];
1362	const t3 = (Number(stop.departureTime) || 0) * 1e3;
1363	let t4;
1364	if ($[5] !== stop.timeZone || $[6] !== t3) {
1365		t4 = formatDateWithTimezone(t3, void 0, stop.timeZone);
1366		$[5] = stop.timeZone;
1367		$[6] = t3;
1368		$[7] = t4;
1369	} else t4 = $[7];
1370	let t5;
1371	if ($[8] !== t4) {
1372		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DetailRow, {
1373			label: "Schedule Arrival",
1374			value: t4
1375		});
1376		$[8] = t4;
1377		$[9] = t5;
1378	} else t5 = $[9];
1379	const t6 = Math.floor((stop.dwellTime ?? 0) / 60);
1380	let t7;
1381	if ($[10] !== t6) {
1382		t7 = formatMinutes(t6);
1383		$[10] = t6;
1384		$[11] = t7;
1385	} else t7 = $[11];
1386	let t8;
1387	if ($[12] !== t7) {
1388		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DetailRow, {
1389			label: "Schedule Dwell Time",
1390			value: t7
1391		});
1392		$[12] = t7;
1393		$[13] = t8;
1394	} else t8 = $[13];
1395	const t9 = stop.note || "N/A";
1396	let t10;
1397	if ($[14] !== t9) {
1398		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DetailRow, {
1399			label: "Notes",
1400			value: t9
1401		});
1402		$[14] = t9;
1403		$[15] = t10;
1404	} else t10 = $[15];
1405	let t11;
1406	if ($[16] !== t10 || $[17] !== t2 || $[18] !== t5 || $[19] !== t8) {
1407		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1408			className: "text-sm",
1409			children: [
1410				t2,
1411				t5,
1412				t8,
1413				t10
1414			]
1415		});
1416		$[16] = t10;
1417		$[17] = t2;
1418		$[18] = t5;
1419		$[19] = t8;
1420		$[20] = t11;
1421	} else t11 = $[20];
1422	return t11;
1423};
1424var import_compiler_runtime$20 = /* @__PURE__ */ __toESM(require_compiler_runtime());
1425var TripsDetailsOverview = (t0) => {
1426	const $ = (0, import_compiler_runtime$20.c)(13);
1427	const { driverInfo, itineraryInfo, tripsTab, status, dropoffEta, nextStopEta } = t0;
1428	let t1;
1429	if ($[0] !== driverInfo || $[1] !== dropoffEta || $[2] !== status || $[3] !== tripsTab) {
1430		t1 = tripsTab !== "Shared" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TripDriverInfo, {
1431			driverInfo,
1432			tripsTab,
1433			status,
1434			dropoffEta
1435		});
1436		$[0] = driverInfo;
1437		$[1] = dropoffEta;
1438		$[2] = status;
1439		$[3] = tripsTab;
1440		$[4] = t1;
1441	} else t1 = $[4];
1442	let t2;
1443	if ($[5] !== itineraryInfo.roadOptions || $[6] !== itineraryInfo.stops || $[7] !== nextStopEta || $[8] !== tripsTab) {
1444		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TripItinerary, {
1445			stops: itineraryInfo.stops,
1446			roadOptions: itineraryInfo.roadOptions,
1447			tripsTab,
1448			nextStopEta
1449		});
1450		$[5] = itineraryInfo.roadOptions;
1451		$[6] = itineraryInfo.stops;
1452		$[7] = nextStopEta;
1453		$[8] = tripsTab;
1454		$[9] = t2;
1455	} else t2 = $[9];
1456	let t3;
1457	if ($[10] !== t1 || $[11] !== t2) {
1458		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [t1, t2] });
1459		$[10] = t1;
1460		$[11] = t2;
1461		$[12] = t3;
1462	} else t3 = $[12];
1463	return t3;
1464};
1465var trips_details_overview_default = TripsDetailsOverview;
1466var import_compiler_runtime$19 = /* @__PURE__ */ __toESM(require_compiler_runtime());
1467var TripsDetailsDocumentsEmpty = (t0) => {
1468	const $ = (0, import_compiler_runtime$19.c)(5);
1469	const { onAdd } = t0;
1470	let t1;
1471	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1472		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyMedia, {
1473			variant: "default",
1474			className: "size-[100px]",
1475			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { name: "document-empty" })
1476		});
1477		$[0] = t1;
1478	} else t1 = $[0];
1479	let t2;
1480	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1481		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1482			className: "flex flex-col gap-2",
1483			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyTitle, {
1484				className: "text-2xl leading-8 font-semibold",
1485				children: "No documents yet"
1486			}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyDescription, {
1487				className: "text-sm leading-5",
1488				children: "Share documents on this trip with your driver"
1489			})]
1490		});
1491		$[1] = t2;
1492	} else t2 = $[1];
1493	let t3;
1494	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1495		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Plus, { className: "size-4" });
1496		$[2] = t3;
1497	} else t3 = $[2];
1498	let t4;
1499	if ($[3] !== onAdd) {
1500		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", {
1501			"aria-label": "documents-empty",
1502			className: "flex flex-1 items-center justify-center",
1503			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Empty, {
1504				className: "border-0 p-0",
1505				children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EmptyHeader, {
1506					className: "gap-6",
1507					children: [
1508						t1,
1509						t2,
1510						/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
1511							onClick: onAdd,
1512							className: "h-9 gap-2 px-4 py-2",
1513							children: [t3, "Add new doc"]
1514						})
1515					]
1516				})
1517			})
1518		}) });
1519		$[3] = onAdd;
1520		$[4] = t4;
1521	} else t4 = $[4];
1522	return t4;
1523};
1524var trips_details_documents_empty_default = TripsDetailsDocumentsEmpty;
1525var import_compiler_runtime$18 = /* @__PURE__ */ __toESM(require_compiler_runtime());
1526var PreviewDocumentItem = (t0) => {
1527	const $ = (0, import_compiler_runtime$18.c)(10);
1528	let onDelete;
1529	let restProps;
1530	if ($[0] !== t0) {
1531		({onDelete, ...restProps} = t0);
1532		$[0] = t0;
1533		$[1] = onDelete;
1534		$[2] = restProps;
1535	} else {
1536		onDelete = $[1];
1537		restProps = $[2];
1538	}
1539	let t1;
1540	if ($[3] !== onDelete || $[4] !== restProps.url) {
1541		t1 = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1542			className: "flex items-center gap-0.5",
1543			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1544				variant: "ghost",
1545				size: "icon",
1546				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
1547					to: restProps.url ?? "",
1548					target: "_blank",
1549					download: true,
1550					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Download, { className: "size-4" })
1551				})
1552			}
1552), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1553				variant: "ghost",
1554				size: "icon",
1555				onClick: onDelete,
1556				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, { className: "size-4" })
1557			})]
1558		});
1559		$[3] = onDelete;
1560		$[4] = restProps.url;
1561		$[5] = t1;
1562	} else t1 = $[5];
1563	let t2;
1564	if ($[6] !== onDelete || $[7] !== restProps || $[8] !== t1) {
1565		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DocumentItem, {
1566			className: "border-none py-3",
1567			onDelete,
1568			renderActions: t1,
1569			...restProps
1570		});
1571		$[6] = onDelete;
1572		$[7] = restProps;
1573		$[8] = t1;
1574		$[9] = t2;
1575	} else t2 = $[9];
1576	return t2;
1577};
1578var preview_document_item_default = PreviewDocumentItem;
1579var import_compiler_runtime$17 = /* @__PURE__ */ __toESM(require_compiler_runtime());
1580const TripsDetailsDeleteDocumentDialog = (t0) => {
1581	const $ = (0, import_compiler_runtime$17.c)(16);
1582	const { open, onOpenChange, onConfirm, isLoading: t1 } = t0;
1583	const isLoading = t1 === void 0 ? false : t1;
1584	let t2;
1585	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1586		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogHeader, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogTitle, { children: "Delete Document" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogDescription, { children: "Are you sure you want to delete this document? This action cannot be undone." })] });
1587		$[0] = t2;
1588	} else t2 = $[0];
1589	let t3;
1590	if ($[1] !== isLoading) {
1591		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogCancel, {
1592			disabled: isLoading,
1593			children: "Cancel"
1594		});
1595		$[1] = isLoading;
1596		$[2] = t3;
1597	} else t3 = $[2];
1598	let t4;
1599	if ($[3] !== isLoading) {
1600		t4 = isLoading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, { className: "mr-2 size-4 animate-spin" });
1601		$[3] = isLoading;
1602		$[4] = t4;
1603	} else t4 = $[4];
1604	let t5;
1605	if ($[5] !== isLoading || $[6] !== onConfirm || $[7] !== t4) {
1606		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
1607			onClick: onConfirm,
1608			disabled: isLoading,
1609			variant: "destructive",
1610			children: [t4, "Delete"]
1611		});
1612		$[5] = isLoading;
1613		$[6] = onConfirm;
1614		$[7] = t4;
1615		$[8] = t5;
1616	} else t5 = $[8];
1617	let t6;
1618	if ($[9] !== t3 || $[10] !== t5) {
1619		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogContent, { children: [t2, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogFooter, { children: [t3, t5] })] });
1620		$[9] = t3;
1621		$[10] = t5;
1622		$[11] = t6;
1623	} else t6 = $[11];
1624	let t7;
1625	if ($[12] !== onOpenChange || $[13] !== open || $[14] !== t6) {
1626		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialog, {
1627			open,
1628			onOpenChange,
1629			children: t6
1630		});
1631		$[12] = onOpenChange;
1632		$[13] = open;
1633		$[14] = t6;
1634		$[15] = t7;
1635	} else t7 = $[15];
1636	return t7;
1637};
1638var import_compiler_runtime$16 = /* @__PURE__ */ __toESM(require_compiler_runtime());
1639var DOCUMENT_TYPES = [
1640	{
1641		value: "Bill of Lading",
1642		label: "Bill of Lading"
1643	},
1644	{
1645		value: "Proof of Delivery",
1646		label: "Proof of Delivery"
1647	},
1648	{
1649		value: "Trip Sheet",
1650		label: "Trip Sheet"
1651	},
1652	{
1653		value: "Cat Scale",
1654		label: "Cat Scale"
1655	},
1656	{
1657		value: "Fuel Receipt",
1658		label: "Fuel Receipt"
1659	},
1660	{
1661		value: "Other Document",
1662		label: "Other Document"
1663	},
1664	{
1665		value: "Rate Confirmation",
1666		label: "Rate Confirmation"
1667	},
1668	{
1669		value: "W9 Doc",
1670		label: "W9 Doc"
1671	},
1672	{
1673		value: "DOT Doc",
1674		label: "DOT Doc"
1675	},
1676	{
1677		value: "COI Doc",
1678		label: "COI Doc"
1679	},
1680	{
1681		value: "Broker Onboard Agreement",
1682		label: "Broker Onboard Agreement"
1683	},
1684	{
1685		value: "Invoice",
1686		label: "Invoice"
1687	},
1688	{
1689		value: "Lumper Service Receipt",
1690		label: "Lumper Service Receipt"
1691	},
1692	{
1693		value: "MC Doc",
1694		label: "MC Doc"
1695	},
1696	{
1697		value: "Driver Settlement",
1698		label: "Driver Settlement"
1699	}
1700];
1701var TripsDetailsAddDocumentDialog = (t0) => {
1702	const $ = (0, import_compiler_runtime$16.c)(43);
1703	const { open, onOpenChange, tripId, refetchTrips } = t0;
1704	const [documentType, setDocumentType] = (0, import_react.useState)("");
1705	let t1;
1706	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1707		t1 = [];
1708		$[0] = t1;
1709	} else t1 = $[0];
1710	const [documents, setDocuments] = (0, import_react.useState)(t1);
1711	const [addTripDocuments, t2] = useAddTripDocumentsMutation();
1712	const { isLoading: isAddingTripDocuments } = t2;
1713	let t3;
1714	if ($[1] !== documents) {
1715		t3 = (newDocuments) => {
1716			const newDocument = {
1717				...newDocuments[0],
1718				status: "upload",
1719				progress: 0
1720			};
1721			if (!newDocument.file) return;
1722			setDocuments([...documents, newDocument]);
1723			const progressInterval = setInterval(() => {
1724				setDocuments((prevDocuments) => prevDocuments.map((doc) => doc.id === newDocument.id ? {
1725					...doc,
1726					progress: Math.min((doc.progress ?? 0) + 1, 99)
1727				} : doc));
1728			}, 100);
1729			uploadImage({ image: newDocument.file }).then((data) => {
1730				clearInterval(progressInterval);
1731				const { url, size } = data?.data ?? {};
1732				setDocuments((prevDocuments_0) => prevDocuments_0.map((doc_0) => doc_0.id === newDocument.id ? {
1733					...doc_0,
1734					url,
1735					size,
1736					status: "idle",
1737					progress: 100
1738				} : doc_0));
1739			});
1740		};
1741		$[1] = documents;
1742		$[2] = t3;
1743	} else t3 = $[2];
1744	const onAdd = t3;
1745	let t4;
1746	if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
1747		t4 = (id) => {
1748			setDocuments((prevDocuments_1) => prevDocuments_1.filter((doc_1) => doc_1.id !== id));
1749		};
1750		$[3] = t4;
1751	} else t4 = $[3];
1752	const onDelete = t4;
1753	let t5;
1754	if ($[4] !== addTripDocuments || $[5] !== documentType || $[6] !== documents || $[7] !== onOpenChange || $[8] !== refetchTrips || $[9] !== tripId) {
1755		t5 = () => {
1756			trackMethodCall("handleSaveAddDocument", []);
1757			addTripDocuments(documents.map((doc_2) => ({
1758				url: doc_2.url ?? "",
1759				fileName: doc_2.name ?? "",
1760				size: doc_2.size ?? "",
1761				type: documentType,
1762				fileType: doc_2.type ?? "",
1763				tripId
1764			}))).then((data_0) => {
1765				const { code, message } = data_0?.data ?? {};
1766				if (code === 200) {
1767					toast.success("Documents added successfully");
1768					refetchTrips?.();
1769					onOpenChange(false);
1770					setDocuments([]);
1771					setDocumentType("");
1772				} else toast.error(message);
1773			});
1774		};
1775		$[4] = addTripDocuments;
1776		$[5] = documentType;
1777		$[6] = documents;
1778		$[7] = onOpenChange;
1779		$[8] = refetchTrips;
1780		$[9] = tripId;
1781		$[10] = t5;
1782	} else t5 = $[10];
1783	const handleSaveAddDocument = t5;
1784	let t6;
1785	if ($[11] !== onOpenChange) {
1786		t6 = () => {
1787			trackMethodCall("handleCancelAddDocument", []);
1788			onOpenChange(false);
1789			setDocuments([]);
1790			setDocumentType("");
1791		};
1792		$[11] = onOpenChange;
1793		$[12] = t6;
1794	} else t6 = $[12];
1795	const handleCancelAddDocument = t6;
1796	let t7;
1797	if ($[13] !== documents) {
1798		t7 = documents.every(_temp$4);
1799		$[13] = documents;
1800		$[14] = t7;
1801	} else t7 = $[14];
1802	const areAllDocumentsUploaded = t7;
1803	let t8;
1804	if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
1805		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, { children: "Add Document" }) });
1806		$[15] = t8;
1807	} else t8 = $[15];
1808	let t9;
1809	if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
1810		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, {
1811			htmlFor: "document-type",
1812			className: "after:text-destructive after:content-['*']",
1813			children: "Document Type"
1814		});
1815		$[16] = t9;
1816	} else t9 = $[16];
1817	let t10;
1818	if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
1819		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTrigger, {
1820			id: "document-type",
1821			className: "w-full",
1822			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValue, { placeholder: "Please select document type" })
1823		});
1824		$[17] = t10;
1825	} else t10 = $[17];
1826	let t11;
1827	if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
1828		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContent, { children: DOCUMENT_TYPES.map(_temp2) });
1829		$[18] = t11;
1830	} else t11 = $[18];
1831	let t12;
1832	if ($[19] !== documentType) {
1833		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1834			className: "flex flex-col gap-2",
1835			children: [t9, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select, {
1836				value: documentType,
1837				onValueChange: setDocumentType,
1838				required: true,
1839				children: [t10, t11]
1840			})]
1841		});
1842		$[19] = documentType;
1843		$[20] = t12;
1844	} else t12 = $[20];
1845	let t13;
1846	if ($[21] !== documents || $[22] !== onAdd) {
1847		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DocumentUpload, {
1848			documents,
1849			onAdd,
1850			onDelete,
1851			maxFiles: 1,
1852			multiple: false
1853		});
1854		$[21] = documents;
1855		$[22] = onAdd;
1856		$[23] = t13;
1857	} else t13 = $[23];
1858	let t14;
1859	if ($[24] !== t12 || $[25] !== t13) {
1860		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogInner, {
1861			className: "gap-y-4",
1862			children: [t12, t13]
1863		});
1864		$[24] = t12;
1865		$[25] = t13;
1866		$[26] = t14;
1867	} else t14 = $[26];
1868	let t15;
1869	if ($[27] !== handleCancelAddDocument) {
1870		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1871			variant: "outline",
1872			onClick: handleCancelAddDocument,
1873			children: "Cancel"
1874		});
1875		$[27] = handleCancelAddDocument;
1876		$[28] = t15;
1877	} else t15 = $[28];
1878	const t16 = documents.length === 0 || !documentType || !areAllDocumentsUploaded;
1879	let t17;
1880	if ($[29] !== handleSaveAddDocument || $[30] !== isAddingTripDocuments || $[31] !== t16) {
1881		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1882			onClick: handleSaveAddDocument,
1883			disabled: t16,
1884			loading: isAddingTripDocuments,
1885			children: "Save"
1886		});
1887		$[29] = handleSaveAddDocument;
1888		$[30] = isAddingTripDocuments;
1889		$[31] = t16;
1890		$[32] = t17;
1891	} else t17 = $[32];
1892	let t18;
1893	if ($[33] !== t15 || $[34] !== t17) {
1894		t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogFooter, { children: [t15, t17] });
1895		$[33] = t15;
1896		$[34] = t17;
1897		$[35] = t18;
1898	} else t18 = $[35];
1899	let t19;
1900	if ($[36] !== t14 || $[37] !== t18) {
1901		t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, { children: [
1902			t8,
1903			t14,
1904			t18
1905		] });
1906		$[36] = t14;
1907		$[37] = t18;
1908		$[38] = t19;
1909	} else t19 = $[38];
1910	let t20;
1911	if ($[39] !== onOpenChange || $[40] !== open || $[41] !== t19) {
1912		t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, {
1913			open,
1914			onOpenChange,
1915			children: t19
1916		});
1917		$[39] = onOpenChange;
1918		$[40] = open;
1919		$[41] = t19;
1920		$[42] = t20;
1921	} else t20 = $[42];
1922	return t20;
1923};
1924var trips_details_add_document_dialog_default = TripsDetailsAddDocumentDialog;
1925function _temp$4(doc_3) {
1926	return doc_3.status === "idle" && doc_3.progress === 100;
1927}
1928function _temp2(type) {
1929	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, {
1930		value: type.value,
1931		children: type.label
1932	}, type.value);
1933}
1934var import_compiler_runtime$15 = /* @__PURE__ */ __toESM(require_compiler_runtime());
1935var TripsDetailsDocuments = (t0) => {
1936	const $ = (0, import_compiler_runtime$15.c)(32);
1937	const { tripId, refetchTrips } = t0;
1938	const [fileId, setFileId] = (0, import_react.useState)(null);
1939	const [openDeleteDialog, setOpenDeleteDialog] = (0, import_react.useState)(false);
1940	const [openAddDialogOpen, setOpenAddDialog] = (0, import_react.useState)(false);
1941	let t1;
1942	if ($[0] !== tripId) {
1943		t1 = { tripId };
1944		$[0] = tripId;
1945		$[1] = t1;
1946	} else t1 = $[1];
1947	const t2 = !tripId;
1948	let t3;
1949	if ($[2] !== t2) {
1950		t3 = { skip: t2 };
1951		$[2] = t2;
1952		$[3] = t3;
1953	} else t3 = $[3];
1954	const { data: tripDocumentsData, isLoading: isLoadingTripDocuments } = useGetTripDocumentsQuery(t1, t3);
1955	let t4;
1956	if ($[4] !== tripDocumentsData?.data) {
1957		t4 = tripDocumentsData?.data ?? [];
1958		$[4] = tripDocumentsData?.data;
1959		$[5] = t4;
1960	} else t4 = $[5];
1961	const tripDocuments = t4;
1962	const [deleteTripDocument, t5] = useDeleteTripDocumentMutation();
1963	const { isLoading } = t5;
1964	let t6;
1965	if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
1966		t6 = (fileId_0) => {
1967			setFileId(fileId_0);
1968			setOpenDeleteDialog(true);
1969		};
1970		$[6] = t6;
1971	} else t6 = $[6];
1972	const onDelete = t6;
1973	let t7;
1974	if ($[7] !== deleteTripDocument || $[8] !== fileId) {
1975		t7 = () => {
1976			if (fileId) {
1977				deleteTripDocument(fileId).then((data) => {
1978					const { code, message } = data?.data ?? {};
1979					if (code === 200) {
1980						toast.success("Document deleted successfully");
1981						setOpenDeleteDialog(false);
1982					} else toast.error(message);
1983				});
1984				setFileId(null);
1985			}
1986		};
1987		$[7] = deleteTripDocument;
1988		$[8] = fileId;
1989		$[9] = t7;
1990	} else t7 = $[9];
1991	const onConfirm = t7;
1992	let t8;
1993	if ($[10] !== isLoadingTripDocuments || $[11] !== tripDocuments.length) {
1994		t8 = isLoadingTripDocuments && tripDocuments.length === 0 && /* @__P
1994URE__ */ (0, import_jsx_runtime.jsx)(Spin, {
1995			spinning: true,
1996			className: "h-[200px] w-full"
1997		});
1998		$[10] = isLoadingTripDocuments;
1999		$[11] = tripDocuments.length;
2000		$[12] = t8;
2001	} else t8 = $[12];
2002	let t9;
2003	if ($[13] !== isLoadingTripDocuments || $[14] !== tripDocuments.length) {
2004		t9 = !isLoadingTripDocuments && tripDocuments.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(trips_details_documents_empty_default, { onAdd: () => setOpenAddDialog(true) });
2005		$[13] = isLoadingTripDocuments;
2006		$[14] = tripDocuments.length;
2007		$[15] = t9;
2008	} else t9 = $[15];
2009	let t10;
2010	if ($[16] !== tripDocuments) {
2011		t10 = tripDocuments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2012			className: "flex flex-col",
2013			children: [tripDocuments.map((document) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(preview_document_item_default, {
2014				id: document.fileId,
2015				name: document.fileName,
2016				type: document.fileType,
2017				author: document.createdName,
2018				created: toDate(document.createTime),
2019				url: document.url,
2020				onDelete: () => onDelete(document.fileId)
2021			}, document.fileId)), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
2022				onClick: () => setOpenAddDialog(true),
2023				className: "mt-3 w-[150px]",
2024				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Plus, { className: "size-4" }), "Add new doc"]
2025			})]
2026		});
2027		$[16] = tripDocuments;
2028		$[17] = t10;
2029	} else t10 = $[17];
2030	let t11;
2031	if ($[18] !== isLoading || $[19] !== onConfirm || $[20] !== openDeleteDialog) {
2032		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TripsDetailsDeleteDocumentDialog, {
2033			open: openDeleteDialog,
2034			onOpenChange: setOpenDeleteDialog,
2035			onConfirm,
2036			isLoading
2037		});
2038		$[18] = isLoading;
2039		$[19] = onConfirm;
2040		$[20] = openDeleteDialog;
2041		$[21] = t11;
2042	} else t11 = $[21];
2043	let t12;
2044	if ($[22] !== openAddDialogOpen || $[23] !== refetchTrips || $[24] !== tripId) {
2045		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(trips_details_add_document_dialog_default, {
2046			open: openAddDialogOpen,
2047			refetchTrips,
2048			onOpenChange: setOpenAddDialog,
2049			tripId
2050		});
2051		$[22] = openAddDialogOpen;
2052		$[23] = refetchTrips;
2053		$[24] = tripId;
2054		$[25] = t12;
2055	} else t12 = $[25];
2056	let t13;
2057	if ($[26] !== t10 || $[27] !== t11 || $[28] !== t12 || $[29] !== t8 || $[30] !== t9) {
2058		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2059			className: "pb-10",
2060			children: [
2061				t8,
2062				t9,
2063				t10,
2064				t11,
2065				t12
2066			]
2067		});
2068		$[26] = t10;
2069		$[27] = t11;
2070		$[28] = t12;
2071		$[29] = t8;
2072		$[30] = t9;
2073		$[31] = t13;
2074	} else t13 = $[31];
2075	return t13;
2076};
2077var trips_details_documents_default = TripsDetailsDocuments;
2078const getAlertMessage = (status) => {
2079	switch (status) {
2080		case "Scheduled":
2081		case "In_Transit": return "Data will be available once the trip is completed.";
2082		default: return "";
2083	}
2084};
2085var formatDuration = (seconds) => {
2086	if (!seconds) return "0hr 0min";
2087	const hours = Math.floor(seconds / 3600);
2088	const minutes = Math.floor(seconds % 3600 / 60);
2089	if (hours > 0) return `${hours}hr ${minutes}min`;
2090	return `${minutes}min`;
2091};
2092const formatMileage = (value) => {
2093	if (typeof value === "number" && Number.isFinite(value)) return `${value.toFixed(2)}mi`;
2094	return "--";
2095};
2096const formatOOREventDate = (dateString) => {
2097	return safeFormatDate(new Date(dateString), "MMM d HH:mm");
2098};
2099const formatOOREventStatus = (pointStatus) => {
2100	if (pointStatus === "rejoin_route") return "Rejoined";
2101	return pointStatus;
2102};
2103const calculateOORDistance = (status, postAnalysis) => {
2104	if (status === "Completed" && postAnalysis?.oorDistance !== void 0) return formatMileage(postAnalysis.oorDistance);
2105	if (status === "In_Transit" && postAnalysis?.list) {
2106		const rejoinEvents = postAnalysis.list.filter((event) => {
2107			return event.pointStatus === "rejoin_route";
2108		});
2109		if (rejoinEvents.length > 0) {
2110			const totalRejoinDistance = rejoinEvents.reduce((accumulator, event) => {
2111				return accumulator + event.distance;
2112			}, 0);
2113			return totalRejoinDistance ? formatMileage(totalRejoinDistance) : "N/A";
2114		}
2115	}
2116	return "N/A";
2117};
2118var countOOREvents = (postAnalysis) => {
2119	return postAnalysis.list ? postAnalysis.list.filter((event) => {
2120		return event.pointStatus === "left_route";
2121	}).length : postAnalysis.oorEvents || 0;
2122};
2123const getDisplayData = (status, postAnalysis) => {
2124	if (!postAnalysis) return {
2125		distance: {
2126			scheduled: "N/A",
2127			actual: "N/A",
2128			difference: "N/A"
2129		},
2130		time: {
2131			scheduled: "N/A",
2132			actual: "N/A",
2133			variance: "N/A"
2134		},
2135		outOfRoute: {
2136			events: "N/A",
2137			distance: "N/A",
2138			percentage: "N/A",
2139			eventsList: []
2140		}
2141	};
2142	switch (status) {
2143		case "Scheduled": return {
2144			distance: {
2145				scheduled: formatMileage(postAnalysis.scheduledMile),
2146				actual: "N/A",
2147				difference: "N/A"
2148			},
2149			time: {
2150				scheduled: formatDuration(postAnalysis.scheduledTime),
2151				actual: "N/A",
2152				variance: "N/A"
2153			},
2154			outOfRoute: {
2155				events: "N/A",
2156				distance: "N/A",
2157				percentage: "N/A",
2158				eventsList: []
2159			}
2160		};
2161		case "In_Transit": return {
2162			distance: {
2163				scheduled: formatMileage(postAnalysis.scheduledMile),
2164				actual: "N/A",
2165				difference: "N/A"
2166			},
2167			time: {
2168				scheduled: formatDuration(postAnalysis.scheduledTime),
2169				actual: "N/A",
2170				variance: "N/A"
2171			},
2172			outOfRoute: {
2173				events: String(countOOREvents(postAnalysis)),
2174				distance: calculateOORDistance(status, postAnalysis),
2175				percentage: "N/A",
2176				eventsList: postAnalysis.list || []
2177			}
2178		};
2179		case "Completed":
2180		case "Deleted":
2181		default: return {
2182			distance: {
2183				scheduled: formatMileage(postAnalysis.scheduledMile),
2184				actual: formatMileage(postAnalysis.actualMile),
2185				difference: formatMileage(postAnalysis.mileDifference)
2186			},
2187			time: {
2188				scheduled: formatDuration(postAnalysis.scheduledTime),
2189				actual: formatDuration(postAnalysis.actualTime),
2190				variance: formatDuration(postAnalysis.timeDifference)
2191			},
2192			outOfRoute: {
2193				events: String(countOOREvents(postAnalysis)),
2194				distance: calculateOORDistance(status, postAnalysis),
2195				percentage: `${parseFloat(((postAnalysis.oorPercentage || 0) * 100).toFixed(2))}%`,
2196				eventsList: postAnalysis.list || []
2197			}
2198		};
2199	}
2200};
2201var import_compiler_runtime$14 = /* @__PURE__ */ __toESM(require_compiler_runtime());
2202var TripsDetailsAnalysisAlert = (t0) => {
2203	const $ = (0, import_compiler_runtime$14.c)(13);
2204	const { status } = t0;
2205	const [isVisible, setIsVisible] = (0, import_react.useState)(true);
2206	let t1;
2207	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2208		t1 = () => {
2209			trackMethodCall("handleClose", []);
2210			return setIsVisible(false);
2211		};
2212		$[0] = t1;
2213	} else t1 = $[0];
2214	const handleClose = t1;
2215	if (!(["Scheduled", "In_Transit"].includes(status) && isVisible)) return null;
2216	let t2;
2217	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
2218		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleCheck, {});
2219		$[1] = t2;
2220	} else t2 = $[1];
2221	let t3;
2222	if ($[2] !== status) {
2223		t3 = getAlertMessage(status);
2224		$[2] = status;
2225		$[3] = t3;
2226	} else t3 = $[3];
2227	let t4;
2228	if ($[4] !== t3) {
2229		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertTitle, { children: t3 });
2230		$[4] = t3;
2231		$[5] = t4;
2232	} else t4 = $[5];
2233	let t5;
2234	if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
2235		t5 = cn(["absolute top-1/2 right-4 -translate-y-1/2", "h-6 w-8 shrink-0 text-foreground hover:text-foreground"]);
2236		$[6] = t5;
2237	} else t5 = $[6];
2238	let t6;
2239	if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
2240		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { className: "size-4" });
2241		$[7] = t6;
2242	} else t6 = $[7];
2243	let t7;
2244	if ($[8] !== t5) {
2245		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
2246			variant: "ghost",
2247			size: "icon",
2248			onClick: handleClose,
2249			className: t5,
2250			"aria-label": "Close",
2251			children: t6
2252		});
2253		$[8] = t5;
2254		$[9] = t7;
2255	} else t7 = $[9];
2256	let t8;
2257	if ($[10] !== t4 || $[11] !== t7) {
2258		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Alert, {
2259			variant: "info",
2260			children: [
2261				t2,
2262				t4,
2263				t7
2264			]
2265		});
2266		$[10] = t4;
2267		$[11] = t7;
2268		$[12] = t8;
2269	} else t8 = $[12];
2270	return t8;
2271};
2272var trips_details_analysis_alert_default = TripsDetailsAnalysisAlert;
2273var import_compiler_runtime$13 = /* @__PURE__ */ __toESM(require_compiler_runtime());
2274var StatItem = (t0) => {
2275	const $ = (0, import_compiler_runtime$13.c)(10);
2276	const { label, value } = t0;
2277	const isMuted = ["N/A", "--"].includes(value);
2278	let t1;
2279	if ($[0] !== label) {
2280		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
2281			className: "text-sm leading-5 text-muted-foreground",
2282			children: label
2283		});
2284		$[0] = label;
2285		$[1] = t1;
2286	} else t1 = $[1];
2287	const t2 = isMuted ? "text-muted-foreground" : "text-foreground";
2288	let t3;
2289	if ($[2] !== t2) {
2290		t3 = cn("text-sm leading-5 font-medium", t2);
2291		$[2] = t2;
2292		$[3] = t3;
2293	} else t3 = $[3];
2294	let t4;
2295	if ($[4] !== t3 || $[5] !== value) {
2296		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
2297			className: t3,
2298			children: value
2299		});
2300		$[4] = t3;
2301		$[5] = value;
2302		$[6] = t4;
2303	} else t4 = $[6];
2304	let t5;
2305	if ($[7] !== t1 || $[8] !== t4) {
2306		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2307			className: "flex flex-1 flex-col gap-1",
2308			children: [t1, t4]
2309		});
2310		$[7] = t1;
2311		$[8] = t4;
2312		$[9] = t5;
2313	} else t5 = $[9];
2314	return t5;
2315};
2316var stat_item_default = StatItem;
2317var import_compiler_runtime$12 = /* @__PURE__ */ __toESM(require_compiler_runtime());
2318var StatSection = (t0) => {
2319	const $ = (0, import_compiler_runtime$12.c)(9);
2320	const { title, items } = t0;
2321	let t1;
2322	if ($[0] !== title) {
2323		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", {
2324			className: "text-base leading-6 font-semibold text-foreground",
2325			children: title
2326		});
2327		$[0] = title;
2328		$[1] = t1;
2329	} else t1 = $[1];
2330	let t2;
2331	if ($[2] !== items) {
2332		t2 = items.map(_temp$3);
2333		$[2] = items;
2334		$[3] = t2;
2335	} else t2 = $[3];
2336	let t3;
2337	if ($[4] !== t2) {
2338		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2339			className: "flex w-full gap-3",
2340			children: t2
2341		});
2342		$[4] = t2;
2343		$[5] = t3;
2344	} else t3 = $[5];
2345	let t4;
2346	if ($[6] !== t1 || $[7] !== t3) {
2347		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
2348			className: "flex w-full flex-col gap-3 not-last-of-type:pb-6",
2349			children: [t1, t3]
2350		});
2351		$[6] = t1;
2352		$[7] = t3;
2353		$[8] = t4;
2354	} else t4 = $[8];
2355	return t4;
2356};
2357var stat_section_default = StatSection;
2358function _temp$3(item, index) {
2359	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(stat_item_default, { ...item }, index);
2360}
2361var import_compiler_runtime$11 = /* @__PURE__ */ __toESM(require_compiler_runtime());
2362var OOREventItem = (t0) => {
2363	const $ = (0, import_compiler_runtime$11.c)(29);
2364	const { event } = t0;
2365	const handleViewOOREvent = _temp$2;
2366	let t1;
2367	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2368		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TriangleAlert, {
2369			className: "size-6 shrink-0 p-0.5 text-pending [&>path:not(:first-of-type)]:text-white",
2370			fill: "currentColor"
2371		});
2372		$[0] = t1;
2373	} else t1 = $[0];
2374	let t2;
2375	if ($[1] !== event.pointStatus) {
2376		t2 = formatOOREventStatus(event.pointStatus);
2377		$[1] = event.pointStatus;
2378		$[2] = t2;
2379	} else t2 = $[2];
2380	let t3;
2381	if ($[3] !== t2) {
2382		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2383			className: "flex items-center gap-2",
2384			children: [t1, /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
2385				className: "flex-1 text-base leading-6 font-semibold text-foreground",
2386				children: t2
2387			})]
2388		});
2389		$[3] = t2;
2390		$[4] = t3;
2391	} else t3 = $[4];
2392	let t4;
2393	if ($[5] !== event.id) {
2394		t4 = () => handleViewOOREvent(event.id);
2395		$[5] = event.id;
2396		$[6] = t4;
2397	} else t4 = $[6];
2398	const t5 = `View ${event.pointStatus} event on map at ${event.label || "unknown location"}`;
2399	let t6;
2400	if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
2401		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapPin, { className: "size-4 shrink-0 text-muted-foreground" });
2402		$[7] = t6;
2403	} else t6 = $[7];
2404	const t7 = event.label || "--";
2405	let t8;
2406	if ($[8] !== t7) {
2407		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
2408			className: "flex-1 overflow-hidden text-sm leading-5 font-normal text-ellipsis whitespace-nowrap text-muted-foreground",
2409			children: t7
2410		});
2411		$[8] = t7;
2412		$[9] = t8;
2413	} else t8 = $[9];
2414	let t9;
2415	if ($[10] !== t4 || $[11] !== t5 || $[12] !== t8) {
2416		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
2417			type: "button",
2418			className: "inline-flex w-fit cursor-pointer items-center gap-2 px-1 text-left",
2419			onClick: t4,
2420			"aria-label": t5,
2421			children: [t6, t8]
2422		});
2423		$[10] = t4;
2424		$[11] = t5;
2425		$[12] = t8;
2426		$[13] = t9;
2427	} else t9 = $[13];
2428	let t10;
2429	if ($[14] !== event.lat || $[15] !== event.lon) {
2430		t10 = event.lat !== void 0 && event.lon !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
2431			/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Globe, { className: "size-4 shrink-0 text-muted-foreground" }),
2432			/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
2433				className: "overflow-hidden text-sm leading-5 font-normal text-ellipsis text-muted-foreground",
2434				children: `${event.lat.toFixed(6)},${event.lon.toFixed(6)}`
2435			}),
2436			/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-3 w-px bg-border" })
2437		] });
2438		$[14] = event.lat;
2439		$[15] = event.lon;
2440		$[16] = t10;
2441	} else t10 = $[16];
2442	let t11;
2443	if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
2444		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Calendar, { className: "size-4 shrink-0 text-muted-foreground" });
2445		$[17] = t11;
2446	} else t11 = $[17];
2447	let t12;
2448	if ($[18] !== event.timeString) {
2449		t12 = formatOOREventDate(event.timeString);
2450		$[18] = event.timeString;
2451		$[19] = t12;
2452	} else t12 = $[19];
2453	const t13 = `${t12} ${event.timeZone}`;
2454	let t14;
2455	if ($[20] !== t13) {
2456		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
2457			className: "overflow-hidden text-sm leading-5 font-normal text-ellipsis text-muted-foreground",
2458			children: t13
2459		});
2460		$[20] = t13;
2461		$[21] = t14;
2462	} else t14 = $[21];
2463	let t15;
2464	if ($[22] !== t10 || $[23] !== t14) {
2465		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2466			className: "flex items-center gap-2 pl-1",
2467			children: [
2468				t10,
2469				t11,
2470				t14
2471			]
2472		});
2473		$[22] = t10;
2474		$[23] = t14;
2475		$[24] = t15;
2476	} else t15 = $[24];
2477	let t16;
2478	if ($[25] !== t15 || $[26] !== t3 || $[27] !== t9) {
2479		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("article", {
2480			className: "flex w-full gap-2 rounded-md border border-border p-4",
2481			children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2482				className: "flex flex-1 flex-col gap-2",
2483				children: [
2484					t3,
2485					t9,
2486					t15
2487				]
2488			})
2489		});
2490		$[25] = t15;
2491		$[26] = t3;
2492		$[27] = t9;
2493		$[28] = t16;
2494	} else t16 = $[28];
2495	return t16;
2496};
2497var oor_event_item_default = OOREventItem;
2498function _temp$2(eventId) {
2499	trackMethodCall("handleViewOOREvent", [eventId]);
2500	console.log("View OOR event on map:", eventId);
2501}
2502var import_compiler_runtime$10 = /* @__PURE__ */ __toESM(require_compiler_runtime());
2503var OOREventSeparator = (t0) => {
2504	const $ = (0, import_compiler_runtime$10.c)(5);
2505	const { distance } = t0;
2506	let t1;
2507	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2508		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2509			className: "flex w-6 items-center justify-center",
2510			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EllipsisVertical, { className: "size-3 shrink-0 text-muted-foreground" })
2511		});
2512		$[0] = t1;
2513	} else t1 = $[0];
2514	let t2;
2515	if ($[1] !== distance) {
2516		t2 = formatMileage(distance);
2517		$[1] = distance;
2518		$[2] = t2;
2519	} else t2 = $[2];
2520	let t3;
2521	if ($[3] !== t2) {
2522		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2523			className: "flex items-center gap-2 py-1.5 pl-3",
2524			children: [t1, /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
2525				className: "text-sm leading-5 font-normal text-muted-foreground",
2526				children: t2
2527			})]
2528		});
2529		$[3] = t2;
2530		$[4] = t3;
2531	} else t3 = $[4];
2532	return t3;
2533};
2534var oor_event_separator_default = OOREventSeparator;
2535var import_compiler_runtime$9 = /* @__PURE__ */ __toESM(require_compiler_runtime());
2536var OOREventList = (t0) => {
2537	const $ = (0, import_compiler_runtime$9.c)(4);
2538	const { events } = t0;
2539	if (events.length === 0) return null;
2540	let t1;
2541	if ($[0] !== events) {
2542		t1 = events.map((event, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", {
2543			className: "flex w-full flex-col",
2544			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(oor_event_item_default, { event }), index < events.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(oor_event_separator_default, { distance: events[index + 1]?.distance || 0 })]
2545		}, event.id));
2546		$[0] = events;
2547		$[1] = t1;
2548	} else t1 = $[1];
2549	let t2;
2550	if ($[2] !== t1) {
2551		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", {
2552			className: "m-0 flex w-full list-none flex-col p-0",
2553			children: t1
2554		});
2555		$[2] = t1;
2556		$[3] = t2;
2557	} else t2 = $[3];
2558	return t2;
2559};
2560var oor_event_list_default = OOREventList;
2561var import_compiler_runtime$8 = /* @__PURE__ */ __toESM(require_compiler_runtime());
2562var TripsDetailsAnalysis = (t0) => {
2563	const $ = (0, import_compiler_runtime$8.c)(45);
2564	const { status, postAnalysis } = t0;
2565	let t1;
2566	if ($[0] !== postAnalysis || $[1] !== status) {
2567		t1 = getDisplayData(status, postAnalysis);
2568		$[0] = postAnalysis;
2569		$[1] = status;
2570		$[2] = t1;
2571	} else t1 = $[2];
2572	const displayData = t1;
2573	let t2;
2574	if ($[3] !== status) {
2575		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(trips_details_analysis_alert_default, { status });
2576		$[3] = status;
2577		$[4] = t2;
2578	} else t2 = $[4];
2579	let t3;
2580	if ($[5] !== displayData.distance.scheduled) {
2581		t3 = {
2582			label: "Scheduled Miles",
2583			value: displayData.distance.scheduled
2584		};
2585		$[5] = displayData.distance.scheduled;
2586		$[6] = t3;
2587	} else t3 = $[6];
2588	let t4;
2589	if ($[7] !== displayData.distance.actual) {
2590		t4 = {
2591			label: "Actual Miles",
2592			value: displayData.distance.actual
2593		};
2594		$[7] = displayData.distance.actual;
2595		$[8] = t4;
2596	} else t4 = $[8];
2597	let t5;
2598	if ($[9] !== displayData.distance.difference) {
2599		t5 = {
2600			label: "Mileage Difference",
2601			value: displayData.distance.difference
2602		};
2603		$[9] = displayData.distance.difference;
2604		$[10] = t5;
2605	} else t5 = $[10];
2606	let t6;
2607	if ($[11] !== t3 || $[12] !== t4 || $[13] !== t5) {
2608		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(stat_section_default, {
2609			title: "Distance",
2610			items: [
2611				t3,
2612				t4,
2613				t5
2614			]
2615		});
2616		$[11] = t3;
2617		$[12] = t4;
2618		$[13] = t5;
2619		$[14] = t6;
2620	} else t6 = $[14];
2621	let t7;
2622	if ($[15] !== displayData.time.scheduled) {
2623		t7 = {
2624			label: "Scheduled Time",
2625			value: displayData.time.scheduled
2626		};
2627		$[15] = displayData.time.scheduled;
2628		$[16] = t7;
2629	} else t7 = $[16];
2630	let t8;
2631	if ($[17] !== displayData.time.actual) {
2632		t8 = {
2633			label: "Actual Time",
2634			value: displayData.time.actual
2635		};
2636		$[17] = displayData.time.actual;
2637		$[18] = t8;
2638	} else t8 = $[18];
2639	let t9;
2640	if ($[19] !== displayData.time.variance) {
2641		t9 = {
2642			label: "Time Variance",
2643			value: displayData.time.variance
2644		};
2645		$[19] = displayData.time.variance;
2646		$[20] = t9;
2647	} else t9 = $[20];
2648	let t10;
2649	if ($[21] !== t7 || $[22] !== t8 || $[23] !== t9) {
2650		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(stat_section_default, {
2651			title: "Time",
2652			items: [
2653				t7,
2654				t8,
2655				t9
2656			]
2657		});
2658		$[21] = t7;
2659		$[22] = t8;
2660		$[23] = t9;
2661		$[24] = t10;
2662	} else t10 = $[24];
2663	let t11;
2664	if ($[25] !== displayData.outOfRoute.events) {
2665		t11 = {
2666			label: "OOR Events",
2667			value: displayData.outOfRoute.events
2668		};
2669		$[25] = displayData.outOfRoute.events;
2670		$[26] = t11;
2671	} else t11 = $[26];
2672	let t12;
2673	if ($[27] !== displayData.outOfRoute.distance) {
2674		t12 = {
2675			label: "OOR Distance",
2676			value: displayData.outOfRoute.distance
2677		};
2678		$[27] = displayData.outOfRoute.distance;
2679		$[28] = t12;
2680	} else t12 = $[28];
2681	let t13;
2682	if ($[29] !== displayData.outOfRoute.percentage) {
2683		t13 = {
2684			label: "OOR Percentage",
2685			value: displayData.outOfRoute.percentage
2686		};
2687		$[29] = displayData.outOfRoute.percentage;
2688		$[30] = t13;
2689	} else t13 = $[30];
2690	let t14;
2691	if ($[31] !== t11 || $[32] !== t12 || $[33] !== t13) {
2692		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(stat_section_default, {
2693			title: "Out Of Route",
2694			items: [
2695				t11,
2696				t12,
2697				t13
2698			]
2699		});
2700		$[31] = t11;
2701		$[32] = t12;
2702		$[33] = t13;
2703		$[34] = t14;
2704	} else t14 = $[34];
2705	let t15;
2706	if ($[35] !== t10 || $[36] !== t14 || $[37] !== t2 || $[38] !== t6) {
2707		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2708			className: "my-4 flex w-full flex-col space-y-6 divide-y divide-border",
2709			children: [
2710				t2,
2711				t6,
2712				t10,
2713				t14
2714			]
2715		});
2716		$[35] = t10;
2717		$[36] = t14;
2718		$[37] = t2;
2719		$[38] = t6;
2720		$[39] = t15;
2721	} else t15 = $[39];
2722	let t16;
2723	if ($[40] !== displayData.outOfRoute.eventsList) {
2724		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(oor_event_list_default, { events: displayData.outOfRoute.eventsList });
2725		$[40] = displayData.outOfRoute.eventsList;
2726		$[41] = t16;
2727	} else t16 = $[41];
2728	let t17;
2729	if ($[42] !== t15 || $[43] !== t16) {
2730		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2731			className: "mb-4",
2732			children: [t15, t16]
2733		});
2734		$[42] = t15;
2735		$[43] = t16;
2736		$[44] = t17;
2737	} else t17 = $[44];
2738	return t17;
2739};
2740var trips_details_analysis_default = TripsDetailsAnalysis;
2741var import_compiler_runtime$7 = /* @__PURE__ */ __toESM(require_compiler_runtime());
2742const TripNoteItem = (t0) => {
2743	const $ = (0, import_compiler_runtime$7.c)(15);
2744	const { note } = t0;
2745	let t1;
2746	if ($[0] !== note.createTime) {
2747		const noteDate = new Date(note.createTime);
2748		t1 = _formatRelative(noteDate, /* @__PURE__ */ new Date());
2749		$[0] = note.createTime;
2750		$[1] = t1;
2751	} else t1 = $[1];
2752	const formattedDate = t1;
2753	let t2;
2754	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
2755		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NotepadText, { className: "mt-0.5 size-4" });
2756		$[2] = t2;
2757	} else t2 = $[2];
2758	let t3;
2759	if ($[3] !== note.msgContent) {
2760		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
2761			className: "text-sm leading-5 text-foreground",
2762			children: note.msgContent
2763		});
2764		$[3] = note.msgContent;
2765		$[4] = t3;
2766	} else t3 = $[4];
2767	let t4;
2768	if ($[5] !== note.fullName) {
2769		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: note.fullName });
2770		$[5] = note.fullName;
2771		$[6] = t4;
2772	} else t4 = $[6];
2773	let t5;
2774	if ($[7] !== formattedDate) {
2775		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: formattedDate });
2776		$[7] = formattedDate;
2777		$[8] = t5;
2778	} else t5 = $[8];
2779	let t6;
2780	if ($[9] !== t4 || $[10] !== t5) {
2781		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2782			className: "mt-1.5 flex justify-between text-xs text-muted-foreground",
2783			children: [t4, t5]
2784		});
2785		$[9] = t4;
2786		$[10] = t5;
2787		$[11] = t6;
2788	} else t6 = $[11];
2789	let t7;
2790	if ($[12] !== t3 || $[13] !== t6) {
2791		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2792			className: "flex w-full flex-col gap-1",
2793			children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2794				className: "flex gap-2",
2795				children: [t2, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2796					className: "flex-1",
2797					children: [t3, t6]
2798				})]
2799			})
2800		});
2801		$[12] = t3;
2802		$[13] = t6;
2803		$[14] = t7;
2804	} else t7 = $[14];
2805	return t7;
2806};
2807var import_validator = /* @__PURE__ */ __toESM(require_validator());
2808var updatesEnum = enumType([
2809	"app",
2810	"email",
2811	"sms"
2812]);
2813var tripUpdatesOptions = [
2814	{
2815		value: "app",
2816		label: "In-app Message",
2817		disabled: true
2818	},
2819	{
2820		value: "email",
2821		label: "Email"
2822	},
2823	{
2824		value: "sms",
2825		label: "SMS"
2826	}
2827];
2828var updatesSchema = objectType({
2829	updates: arrayType(updatesEnum).default(["app"]),
2830	email: stringType().email("Invalid email address").optional(),
2831	sms: stringType().refine(import_validator.isMobilePhone, "Invalid phone number").optional()
2832});
2833var getUpdatesType = (updates) => {
2834	const useEmail = updates.includes("email");
2835	const useSms = updates.includes("sms");
2836	if (useEmail && useSms) return "email_and_text";
2837	if (useEmail) return "email";
2838	if (useSms) return "text";
2839	return "email_and_text";
2840};
2841var TripsDetailsDriverUpdates = ({ tripShareId, driverInfo, tripsTab, status = "Scheduled" }) => {
2842	const [notes, setNotes] = (0, import_react.useState)("");
2843	const form = useForm({
2844		defaultValues: {
2845			updates: ["app"],
2846			email: "",
2847			sms: ""
2848		},
2849		resolver: t(updatesSchema),
2850		mode: "onChange"
2851	});
2852	const { formState, watch } = form;
2853	const updates = watch("updates") || [];
2854	const useEmail = updates.includes("email");
2855	const useSms = updates.includes("sms");
2856	const email = watch("email");
2857	const sms = watch("sms");
2858	const { data: tripNotesData } = useGetTripNotesQuery(tripShareId);
2859	(0, import_react.useEffect)(() => {
2860		if (!useEmail) form.resetField("email");
2861	}, [useEmail, form]);
2862	(0, import_react.useEffect)(() => {
2863		if (!useSms) form.resetField("sms");
2864	}, [useSms, form]);
2865	const [saveTripNote, { isLoading: isSavingNote }] = useSaveTripNoteMutation();
2866	const [sendTripUpdates, { isLoading: isSendingTripUpdates }] = useSendTripUpdatesMutation();
2867	const tripNotes = tripNotesData?.data || [];
2868	const hasNotes = tripNotes.length > 0;
2869	const handleSaveNote = () => {
2870		trackMethodCall("handleSaveNote", []);
2871		saveTripNote({
2872			shareId: tripShareId,
2873			msgContent: notes
2874		}).then((data) => {
2875			if (!data?.data) return;
2876			const { code, message } = data.data;
2877			if (code !== 200) {
2878				toast.error(message);
2879				return;
2880			}
2881			toast.success("Note saved successfully");
2882			setNotes("");
2883		});
2884	};
2885	const handleSendTripUpdates = () => {
2886		trackMethodCall("handleSendTripUpdates", []);
2887		const formData = form.getValues();
2888		sendTripUpdates({
2889			tripId: tripShareId,
2890			type: getUpdatesType(formData.updates),
2891			email: formData.email ?? "",
2892			number: formData.sms ?? ""
2893		}).then((data_0) => {
2894			if (!data_0?.data) return;
2895			const { code: code_0, message: message_0 } = data_0.data;
2896			if (code_0 !== 200) {
2897				toast.error(message_0);
2898				return;
2899			}
2900			toast.success("Request sent successfully");
2901			form.reset({
2902				updates: ["app"],
2903				email: "",
2904				sms: ""
2905			});
2906		});
2907	};
2908	const isEmailValid = !useEmail || email && !formState.errors.email;
2909	const isSmsValid = !useSms || sms && !formState.errors.sms;
2910	const disabledSendRequest = !useEmail && !useSms || useEmail && !isEmailValid || useSms && !isSmsValid;
2911	return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2912		className: "flex flex-col gap-6 pb-24",
2913		children: [
2914			/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TripDriverInfo, {
2915				driverInfo,
2916				tripsTab,
2917				status
2918			}),
2919			/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2920				className: "flex flex-col gap-6",
2921				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2922					className: "flex flex-col gap-4",
2923					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
2924						className: "text-base font-semibold text-foreground",
2925						children: "Notes"
2926					}), hasNotes ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2927						className: "flex flex-col gap-2",
2928						children: tripNotes.map((note) => {
2929							return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TripNoteItem, { note }, note.createTime);
2930						})
2931					}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
2932						className: "text-sm text-muted-foreground",
2933						children: "There are no notes for this driver"
2934					})]
2935				}), status !== "Completed" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
2936					/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Textarea, {
2937						placeholder: "Leave important notes and updates for your drivers.",
2938						value: notes,
2939						onChange: (e) => {
2940							return setNotes(e.target.value);
2941						},
2942						className: "h-[80px]"
2943					}),
2944					/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
2945						onClick: handleSaveNote,
2946						className: "w-fit",
2947						disabled: !notes,
2948						loading: isSavingNote,
2949						children: "Save"
2950					}),
2951					/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Separator, { orientation: "horizontal" })
2952				] })]
2953			}),
2954			status !== "Completed" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2955				className: "flex flex-col gap-4",
2956				children: [
2957					/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
2958						className: "text-base font-semibold text-foreground",
2959						children: "Check Driver Status"
2960					}),
2961					/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
2962						className: "text-sm text-muted-foreground",
2963						children: "Send in-app, email or text messages to your drivers requesting trip updates."
2964					}),
2965					/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FormWrapper, {
2966						form,
2967						className: "flex flex-col gap-4",
2968						children: [
2969							/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxGroupField, {
2970								name: "updates",
2971								options: tripUpdatesOptions,
2972								groupClassName: "flex flex-wrap items-center gap-6"
2973							}),
2974							useEmail && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputField, {
2975								name: "email",
2976								type: "email",
2977								placeholder: "Please enter your driver's email"
2978							}),
2979							useSms && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputField, {
2980								name: "sms",
2981								type: "tel",
2982								placeholder: "Please enter your driver's phone number"
2983							}),
2984							/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
2985								onClick: handleSendTripUpdates,
2986								className: "w-fit",
2987								variant: "default",
2988								disabled: disabledSendRequest,
2989								loading: isSendingTripUpdates,
2990								children: "Send Request"
2991							})
2992						]
2993					})
2994				]
2995			})
2996		]
2997	});
2998};
2999var trips_details_driver_updates_default = TripsDetailsDriverUpdates;
3000var import_compiler_runtime$6 = /* @__PURE__ */ __toESM(require_compiler_runtime());
3001var FALLBACK = "N/A";
3002var formatRevenue = (value) => {
3003	return typeof value === "number" ? `$${value.toLocaleString("en-US")}` : FALLBACK;
3004};
3005var formatCreatedAt = (value) => {
3006	return typeof value === "number" ? format(new Date(value), "MMM d,yyyy") : FALLBACK;
3007};
3008var displayPhone = (value) => {
3009	if (!value) return FALLBACK;
3010	return getNumberValue(value).length === 10 ? formatPhone(value, "dash") : value;
3011};
3012var Field = (t0) => {
3013	const $ = (0, import_compiler_runtime$6.c)(7);
3014	const { label, children } = t0;
3015	let t1;
3016	if ($[0] !== label) {
3017		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", {
3018			className: "text-sm text-muted-foreground",
3019			children: label
3020		});
3021		$[0] = label;
3022		$[1] = t1;
3023	} else t1 = $[1];
3024	let t2;
3025	if ($[2] !== children) {
3026		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", {
3027			className: "text-sm wrap-break-word text-foreground",
3028			children
3029		});
3030		$[2] = children;
3031		$[3] = t2;
3032	} else t2 = $[3];
3033	let t3;
3034	if ($[4] !== t1 || $[5] !== t2) {
3035		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3036			className: "flex flex-col gap-1.5",
3037			children: [t1, t2]
3038		});
3039		$[4] = t1;
3040		$[5] = t2;
3041		$[6] = t3;
3042	} else t3 = $[6];
3043	return t3;
3044};
3045var EmailValue = (t0) => {
3046	const $ = (0, import_compiler_runtime$6.c)(2);
3047	const { email } = t0;
3048	let t1;
3049	if ($[0] !== email) {
3050		t1 = email ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
3051			href: `mailto:${email}`,
3052			className: "text-primary hover:underline",
3053			children: email
3054		}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: FALLBACK });
3055		$[0] = email;
3056		$[1] = t1;
3057	} else t1 = $[1];
3058	return t1;
3059};
3060var ContactSection = (t0) => {
3061	const $ = (0, import_compiler_runtime$6.c)(18);
3062	const { role, contact } = t0;
3063	const t1 = contact?.name || FALLBACK;
3064	let t2;
3065	if ($[0] !== role || $[1] !== t1) {
3066		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h3", {
3067			className: "text-base font-semibold text-foreground",
3068			children: [
3069				role,
3070				":",
3071				t1
3072			]
3073		});
3074		$[0] = role;
3075		$[1] = t1;
3076		$[2] = t2;
3077	} else t2 = $[2];
3078	const t3 = contact?.companyName || FALLBACK;
3079	let t4;
3080	if ($[3] !== t3) {
3081		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, {
3082			label: "Company Name",
3083			children: t3
3084		});
3085		$[3] = t3;
3086		$[4] = t4;
3087	} else t4 = $[4];
3088	const t5 = contact?.phone;
3089	let t6;
3090	if ($[5] !== t5) {
3091		t6 = displayPhone(t5);
3092		$[5] = t5;
3093		$[6] = t6;
3094	} else t6 = $[6];
3095	let t7;
3096	if ($[7] !== t6) {
3097		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, {
3098			label: "Phone",
3099			children: t6
3100		});
3101		$[7] = t6;
3102		$[8] = t7;
3103	} else t7 = $[8];
3104	const t8 = contact?.email;
3105	let t9;
3106	if ($[9] !== t8) {
3107		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, {
3108			label: "Email",
3109			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmailValue, { email: t8 })
3110		});
3111		$[9] = t8;
3112		$[10] = t9;
3113	} else t9 = $[10];
3114	let t10;
3115	if ($[11] !== t4 || $[12] !== t7 || $[13] !== t9) {
3116		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("dl", {
3117			className: "grid grid-cols-1 gap-6 sm:grid-cols-3",
3118			children: [
3119				t4,
3120				t7,
3121				t9
3122			]
3123		});
3124		$[11] = t4;
3125		$[12] = t7;
3126		$[13] = t9;
3127		$[14] = t10;
3128	} else t10 = $[14];
3129	let t11;
3130	if ($[15] !== t10 || $[16] !== t2) {
3131		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
3132			className: "flex flex-col gap-4 border-t border-border pt-6",
3133			children: [t2, t10]
3134		});
3135		$[15] = t10;
3136		$[16] = t2;
3137		$[17] = t11;
3138	} else t11 = $[17];
3139	return t11;
3140};
3141const TripsDetailsLoadInfo = (t0) => {
3142	const $ = (0, import_compiler_runtime$6.c)(27);
3143	const { loadInfo } = t0;
3144	const t1 = loadInfo.loadCustomId || FALLBACK;
3145	let t2;
3146	if ($[0] !== t1) {
3147		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h3", {
3148			className: "text-base font-semibold text-foreground",
3149			children: ["Load ID: ", t1]
3150		});
3151		$[0] = t1;
3152		$[1] = t2;
3153	} else t2 = $[1];
3154	const t3 = loadInfo.reference || FALLBACK;
3155	let t4;
3156	if ($[2] !== t3) {
3157		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, {
3158			label: "Reference #",
3159			children: t3
3160		});
3161		$[2] = t3;
3162		$[3] = t4;
3163	} else t4 = $[3];
3164	let t5;
3165	if ($[4] !== loadInfo.revenue) {
3166		t5 = formatRevenue(loadInfo.revenue);
3167		$[4] = loadInfo.revenue;
3168		$[5] = t5;
3169	} else t5 = $[5];
3170	let t6;
3171	if ($[6] !== t5) {
3172		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, {
3173			label: "Revenue",
3174			children: t5
3175		});
3176		$[6] = t5;
3177		$[7] = t6;
3178	} else t6 = $[7];
3179	let t7;
3180	if ($[8] !== loadInfo.createdAt) {
3181		t7 = formatCreatedAt(loadInfo.createdAt);
3182		$[8] = loadInfo.createdAt;
3183		$[9] = t7;
3184	} else t7 = $[9];
3185	let t8;
3186	if ($[10] !== t7) {
3187		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, {
3188			label: "Date Created",
3189			children: t7
3190		});
3191		$[10] = t7;
3192		$[11] = t8;
3193	} else t8 = $[11];
3194	let t9;
3195	if ($[12] !== t4 || $[13] !== t6 || $[14] !== t8) {
3196		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("dl", {
3197			className: "grid grid-cols-1 gap-6 sm:grid-cols-3",
3198			children: [
3199				t4,
3200				t6,
3201				t8
3202			]
3203		});
3204		$[12] = t4;
3205		$[13] = t6;
3206		$[14] = t8;
3207		$[15] = t9;
3208	} else t9 = $[15];
3209	let t10;
3210	if ($[16] !== t2 || $[17] !== t9) {
3211		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
3212			className: "flex flex-col gap-4",
3213			children: [t2, t9]
3214		});
3215		$[16] = t2;
3216		$[17] = t9;
3217		$[18] = t10;
3218	} else t10 = $[18];
3219	let t11;
3220	if ($[19] !== loadInfo.customer) {
3221		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContactSection, {
3222			role: "Customer",
3223			contact: loadInfo.customer
3224		});
3225		$[19] = loadInfo.customer;
3226		$[20] = t11;
3227	} else t11 = $[20];
3228	let t12;
3229	if ($[21] !== loadInfo.broker) {
3230		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContactSection, {
3231			role: "Broker",
3232			contact: loadInfo.broker
3233		});
3234		$[21] = loadInfo.broker;
3235		$[22] = t12;
3236	} else t12 = $[22];
3237	let t13;
3238	if ($[23] !== t10 || $[24] !== t11 || $[25] !== t12) {
3239		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3240			className: "flex flex-col gap-6 p-6",
3241			children: [
3242				t10,
3243				t11,
3244				t12
3245			]
3246		});
3247		$[23] = t10;
3248		$[24] = t11;
3249		$[25] = t12;
3250		$[26] = t13;
3251	} else t13 = $[26];
3252	return t13;
3253};
3254var import_compiler_runtime$5 = /* @__PURE__ */ __toESM(require_compiler_runtime());
3255var tabs = [
3256	{
3257		value: "overview",
3258		label: "Trip Overview"
3259	},
3260	{
3261		value: "documents",
3262		label: "Documents"
3263	},
3264	{
3265		value: "analysis",
3266		label: "Post Trip Analysis"
3267	}
3268];
3269var sharedTabs = [
3270	{
3271		value: "driver",
3272		label: "Driver Update"
3273	},
3274	{
3275		value: "overview",
3276		label: "Trip Overview"
3277	},
3278	{
3279		value: "documents",
3280		label: "Documents"
3281	}
3282];
3283var TripsDetailsTabs = (t0) => {
3284	const $ = (0, import_compiler_runtime$5.c)(12);
3285	const { tripsTab, tripDetails, tripShareId, refetchTrips } = t0;
3286	const tripLoadInfo = tripDetails.tripLoadInfo;
3287	const displayTabs = tripsTab === "Shared" ? sharedTabs : tripLoadInfo ? [...tabs, {
3288		value: "loadInfo",
3289		label: "Load Info"
3290	}] : tabs;
3291	const { driverInfo, itineraryInfo, postAnalysis, dropoffEta, nextStopEta } = useTripDetails(tripDetails);
3292	let t1;
3293	if ($[0] !== driverInfo || $[1] !== dropoffEta || $[2] !== itineraryInfo || $[3] !== nextStopEta || $[4] !== postAnalysis || $[5] !== refetchTrips || $[6] !== tripDetails.status || $[7] !== tripDetails.tripId || $[8] !== tripLoadInfo || $[9] !== tripShareId || $[10] !== tripsTab) {
3294		t1 = (tab_0) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TabsContent, {
3295			value: tab_0.value,
3296			className: "flex-1",
3297			children: [
3298				tab_0.value === "overview" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(trips_details_overview_default, {
3299					driverInfo,
3300					dropoffEta,
3301					nextStopEta,
3302					itineraryInfo,
3303					status: tripDetails.status,
3304					tripsTab
3305				}),
3306				tab_0.value === "documents" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(trips_details_documents_default, {
3307					refetchTrips,
3308					tripId: tripDetails.tripId
3309				}),
3310				tab_0.value === "analysis" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(trips_details_analysis_default, {
3311					postAnalysis,
3312					status: tripDetails.status
3313				}),
3314				tab_0.value === "loadInfo" && tripLoadInfo && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TripsDetailsLoadInfo, { loadInfo: tripLoadInfo }),
3315				tab_0.value === "driver" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(trips_details_driver_updates_default, {
3316					driverInfo,
3317					tripsTab,
3318					status: tripDetails.status,
3319					tripShareId
3320				})
3321			]
3322		}, tab_0.value);
3323		$[0] = driverInfo;
3324		$[1] = dropoffEta;
3325		$[2] = itineraryInfo;
3326		$[3] = nextStopEta;
3327		$[4] = postAnalysis;
3328		$[5] = refetchTrips;
3329		$[6] = tripDetails.status;
3330		$[7] = tripDetails.tripId;
3331		$[8] = tripLoadInfo;
3332		$[9] = tripShareId;
3333		$[10] = tripsTab;
3334		$[11] = t1;
3335	} else t1 = $[11];
3336	return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tabs, {
3337		variant: "underline",
3338		className: "flex flex-1 flex-col",
3339		defaultValue: displayTabs[0].value,
3340		children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsList, { children: displayTabs.map(_temp$1) }), displayTabs.map(t1)]
3341	});
3342};
3343var trips_details_tabs_default = TripsDetailsTabs;
3344function _temp$1(tab) {
3345	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsTrigger, {
3346		value: tab.value,
3347		children: tab.label
3348	}, tab.value);
3349}
3350var import_compiler_runtime$4 = /* @__PURE__ */ __toESM(require_compiler_runtime());
3351var TRIP_LEGEND_ITEMS = [
3352	{
3353		icon: "pick-up",
3354		label: "Origin"
3355	},
3356	{
3357		icon: "drop-off",
3358		label: "Destination"
3359	},
3360	{
3361		icon: "route-arrow",
3362		label: "Planned path"
3363	},
3364	{
3365		icon: "stop-added-by-driver",
3366		label: "Stop Added By Driver"
3367	},
3368	{
3369		icon: "drop-off-added-by-driver",
3370		label: "Destination Added By Driver"
3371	},
3372	{
3373		icon: "driver",
3374		label: "Driver Current Location"
3375	},
3376	{
3377		icon: "green-point",
3378		label: "Actual path"
3379	}
3380];
3381var MapTripLegendList = () => {
3382	const $ = (0, import_compiler_runtime$4.c)(1);
3383	let t0;
3384	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
3385		t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: TRIP_LEGEND_ITEMS.map(_temp) });
3386		$[0] = t0;
3387	} else t0 = $[0];
3388	return t0;
3389};
3390var MapTripLegend = () => {
3391	const $ = (0, import_compiler_runtime$4.c)(1);
3392	let t0;
3393	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
3394		t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapControl, {
3395			position: ControlPosition.LEFT_BOTTOM,
3396			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
3397				className: "mb-3 ml-3 rounded-md border bg-background p-1.5 text-sm shadow-sm",
3398				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapTripLegendList, {})
3399			})
3400		});
3401		$[0] = t0;
3402	} else t0 = $[0];
3403	return t0;
3404};
3405function _temp(item) {
3406	return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3407		className: "flex items-center gap-2 p-1.5",
3408		children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, {
3409			name: item.icon,
3410			className: "size-4"
3411		}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
3412			className: "whitespace-nowrap",
3413			children: item.label
3414		})]
3415	}, item.icon);
3416}
3417var import_compiler_runtime$3 = /* @__PURE__ */ __toESM(require_compiler_runtime());
3418var MapTripControlInfo = () => {
3419	const $ = (0, import_compiler_runtime$3.c)(1);
3420	let t0;
3421	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
3422		t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ControlInfo, {
3423			buttonClassName: "size-8",
3424			side: "left",
3425			align: "end",
3426			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapTripLegendList, {})
3427		});
3428		$[0] = t0;
3429	} else t0 = $[0];
3430	return t0;
3431};
3432var import_compiler_runtime$2 = /* @__PURE__ */ __toESM(require_compiler_runtime());
3433var TripsDetailsMapControls = () => {
3434	const $ = (0, import_compiler_runtime$2.c)(13);
3435	const { mapBoundPoints } = useMapContext();
3436	const { fitBounds } = useMapActions(MAP_ELEMENT_ID);
3437	const isFullscreen = useIsMapFullscreen();
3438	let t0;
3439	if ($[0] !== fitBounds || $[1] !== mapBoundPoints) {
3440		t0 = () => {
3441			trackMethodCall("handleRestart", []);
3442			if (!mapBoundPoints?.length) return;
3443			fitBounds(mapBoundPoints);
3444		};
3445		$[0] = fitBounds;
3446		$[1] = mapBoundPoints;
3447		$[2] = t0;
3448	} else t0 = $[2];
3449	const handleRestart = t0;
3450	let t1;
3451	if ($[3] !== isFullscreen) {
3452		t1 = isFullscreen ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapTripControlInfo, {});
3453		$[3] = isFullscreen;
3454		$[4] = t1;
3455	} else t1 = $[4];
3456	let t2;
3457	if ($[5] !== handleRestart || $[6] !== t1) {
3458		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapDefaultControls, {
3459			onRestart: handleRestart,
3460			showFullscreen: true,
3461			footer: t1
3462		});
3463		$[5] = handleRestart;
3464		$[6] = t1;
3465		$[7] = t2;
3466	} else t2 = $[7];
3467	let t3;
3468	if ($[8] !== isFullscreen) {
3469		t3 = isFullscreen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapTripLegend, {});
3470		$[8] = isFullscreen;
3471		$[9] = t3;
3472	} else t3 = $[9];
3473	let t4;
3474	if ($[10] !== t2 || $[11] !== t3) {
3475		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [t2, t3] });
3476		$[10] = t2;
3477		$[11] = t3;
3478		$[12] = t4;
3479	} else t4 = $[12];
3480	return t4;
3481};
3482var import_compiler_runtime$1 = /* @__PURE__ */ __toESM(require_compiler_runtime());
3483var TripsDetailsMap = (t0) => {
3484	const $ = (0, import_compiler_runtime$1.c)(11);
3485	const { tripDetails, defaultMapZoom, mapZoom, setMapZoom } = t0;
3486	let t1;
3487	if ($[0] !== mapZoom || $[1] !== setMapZoom) {
3488		t1 = (event) => {
3489			const zoom = event.map.getZoom();
3490			if (zoom !== void 0 && zoom !== mapZoom) setMapZoom(zoom);
3491		};
3492		$[0] = mapZoom;
3493		$[1] = setMapZoom;
3494		$[2] = t1;
3495	} else t1 = $[2];
3496	const onMapIdle = t1;
3497	let t2;
3498	if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
3499		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TripsDetailsMapControls, {});
3500		$[3] = t2;
3501	} else t2 = $[3];
3502	let t3;
3503	if ($[4] !== mapZoom || $[5] !== tripDetails) {
3504		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapTrip, {
3505			tripDetails,
3506			mapZoom
3507		});
3508		$[4] = mapZoom;
3509		$[5] = tripDetails;
3510		$[6] = t3;
3511	} else t3 = $[6];
3512	let t4;
3513	if ($[7] !== defaultMapZoom || $[8] !== onMapIdle || $[9] !== t3) {
3514		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapAPIProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MapDefault, {
3515			defaultZoom: defaultMapZoom,
3516			onIdle: onMapIdle,
3517			className: "h-[300px] w-full",
3518			children: [t2, t3]
3519		}) }) });
3520		$[7] = defaultMapZoom;
3521		$[8] = onMapIdle;
3522		$[9] = t3;
3523		$[10] = t4;
3524	} else t4 = $[10];
3525	return t4;
3526};
3527var import_compiler_runtime = /* @__PURE__ */ __toESM(require_compiler_runtime());
3528const TripsDetailsDeleteTripDialog = (t0) => {
3529	const $ = (0, import_compiler_runtime.c)(16);
3530	const { open, onOpenChange, onConfirm, isLoading: t1 } = t0;
3531	const isLoading = t1 === void 0 ? false : t1;
3532	let t2;
3533	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
3534		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogHeader, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogTitle, { children: "Delete this trip?" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogDescription, { children: "This action cannot be undone. All trip details, stops, and documents will be permanently removed." })] });
3535		$[0] = t2;
3536	} else t2 = $[0];
3537	let t3;
3538	if ($[1] !== isLoading) {
3539		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogCancel, {
3540			disabled: isLoading,
3541			children: "Cancel"
3542		});
3543		$[1] = isLoading;
3544		$[2] = t3;
3545	} else t3 = $[2];
3546	let t4;
3547	if ($[3] !== isLoading) {
3548		t4 = isLoading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, { className: "mr-2 size-4 animate-spin" });
3549		$[3] = isLoading;
3550		$[4] = t4;
3551	} else t4 = $[4];
3552	let t5;
3553	if ($[5] !== isLoading || $[6] !== onConfirm || $[7] !== t4) {
3554		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
3555			onClick: onConfirm,
3556			disabled: isLoading,
3557			variant: "destructive",
3558			children: [t4, "Delete"]
3559		});
3560		$[5] = isLoading;
3561		$[6] = onConfirm;
3562		$[7] = t4;
3563		$[8] = t5;
3564	} else t5 = $[8];
3565	let t6;
3566	if ($[9] !== t3 || $[10] !== t5) {
3567		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogContent, { children: [t2, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogFooter, { children: [t3, t5] })] });
3568		$[9] = t3;
3569		$[10] = t5;
3570		$[11] = t6;
3571	} else t6 = $[11];
3572	let t7;
3573	if ($[12] !== onOpenChange || $[13] !== open || $[14] !== t6) {
3574		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialog, {
3575			open,
3576			onOpenChange,
3577			children: t6
3578		});
3579		$[12] = onOpenChange;
3580		$[13] = open;
3581		$[14] = t6;
3582		$[15] = t7;
3583	} else t7 = $[15];
3584	return t7;
3585};
3586var DEFAULT_ZOOM = 5;
3587var TripsDetails = ({ tripShareId, tripId, tripsTab, refetchTrips }) => {
3588	const [zoom, setZoom] = (0, import_react.useState)(DEFAULT_ZOOM);
3589	const [debouncedZoom, setDebouncedZoom] = (0, import_react.useState)(DEFAULT_ZOOM);
3590	const [deleteTripDialogOpen, setDeleteTripDialogOpen] = (0, import_react.useState)(false);
3591	const [deleteTrip, { isLoading: isDeletingTrip }] = useDeleteTripMutation();
3592	const navigate = useNavigate();
3593	const { run: updateDebouncedZoom } = useDebounceFn_default((z) => {
3594		return setDebouncedZoom(z);
3595	}, { wait: 300 });
3596	const onZoomChange = (z_0) => {
3597		setZoom(z_0);
3598		updateDebouncedZoom(z_0);
3599	};
3600	const { data, isFetching, isError } = useGetTripDetailsQuery({
3601		tripId,
3602		zoom: debouncedZoom,
3603		model: tripsTab === "Shared" ? "shared" : "trip"
3604	}, { skip: !tripId });
3605	const tripDetails = data?.data;
3606	if (isFetching && !tripDetails) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
3607		className: "flex h-full items-center justify-center",
3608		children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spin, { spinning: true })
3609	});
3610	if (isError || !tripDetails) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
3611		className: "flex h-full items-center justify-center text-sm text-muted-foreground",
3612		children: "Failed to load trip details."
3613	});
3614	const isInitialLoadingPerTrip = isFetching && tripId !== data?.data?.tripId;
3615	const handleDeleteTrip = () => {
3616		trackMethodCall("handleDeleteTrip", []);
3617		setDeleteTripDialogOpen(true);
3618	};
3619	const handleConfirmDeleteTrip = async () => {
3620		trackMethodCall("handleConfirmDeleteTrip", []);
3621		try {
3622			const response = await deleteTrip({ tripId: tripDetails.tripId }).unwrap();
3623			if (response.code === 200) {
3624				setDeleteTripDialogOpen(false);
3625				refetchTrips?.();
3626				return;
3627			}
3628			if (response.code === 409) {
3629				setDeleteTripDialogOpen(false);
3630				toast.error(response.message);
3631				refetchTrips?.();
3632				return;
3633			}
3634			toast.error(response.message || "Failed to delete trip. Please try again.");
3635		} catch {
3636			toast.error("Failed to delete trip. Please try again.");
3637		}
3638	};
3639	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spin, {
3640		spinning: isInitialLoadingPerTrip,
3641		wrapperClassName: "h-full",
3642		children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
3643			"aria-label": "trips-details",
3644			className: "flex flex-1 flex-col",
3645			children: [
3646				/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
3647					className: "w-full overflow-hidden rounded-sm border",
3648					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TripsDetailsMap, {
3649						tripDetails,
3650						defaultMapZoom: DEFAULT_ZOOM,
3651						mapZoom: zoom,
3652						setMapZoom: onZoomChange
3653					})
3654				}),
3655				/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3656					className: "flex items-center justify-between pt-7",
3657					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3658						className: "flex items-center gap-3",
3659						children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", {
3660							className: "text-xl font-semibold",
3661							children: tripDetails.tripCustomId
3662						}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3663							variant: getBadgeVariantByStatus(tripDetails.status),
3664							children: tripDetails.status === "In_Transit" ? "IN TRANSIT" : tripDetails.status.toUpperCase()
3665						})]
3666					}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3667						className: "flex items-center gap-2",
3668						children: [
3669							tripsTab !== "Shared" && tripDetails.status === "Scheduled" && tripDetails.source === "command" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
3670								variant: "outline",
3671								size: "sm",
3672								"aria-label": "Delete trip",
3673								className: "hover:border-destructive hover:text-destructive",
3674								onClick: handleDeleteTrip,
3675								children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, { className: "size-4" })
3676							}),
3677							/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
3678								variant: "outline",
3679								size: "sm",
3680								onClick: () => {
3681									const id = tripDetails.routeId ? `routeId=${tripDetails.routeId}` : `tripId=${tripDetails.tripId}`;
3682									navigate(`/map?tripType=duplicate&${id}`);
3683								},
3684								children: "Duplicate"
3685							}),
3686							["Scheduled", "In_Transit"].includes(tripDetails.status) && tripDetails.routeId && getShowEditRoute() && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
3687								variant: "default",
3688								size: "sm",
3689								onClick: () => {
3690									return navigate(`/map?tripType=editRoute&tripId=${tripDetails.tripId}&routeId=${tripDetails.routeId}`);
3691								},
3692								children: "Edit Route"
3693							})
3694						]
3695					})]
3696				}),
3697				/* @__PURE__ */ (0, import_jsx_runtime.jsx)(trips_details_tabs_default, {
3698					refetchTrips,
3699					tripsTab,
3700					tripDetails,
3701					tripShareId
3702				}),
3703				/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TripsDetailsDeleteTripDialog, {
3704					open: deleteTripDialogOpen,
3705					onOpenChange: setDeleteTripDialogOpen,
3706					onConfirm: handleConfirmDeleteTrip,
3707					isLoading: isDeletingTrip
3708				})
3709			]
3710		})
3711	});
3712};
3713var trips_details_default = TripsDetails;
3714export { ProgressSegment as a, getTextFromProgressHistory as i, getTripsTableColumns as n, ProgressSegmentItem as o, getStatusFromItem as r, trips_details_default as t };

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.