@digilogiclabs/saas-factory-ui 0.15.2 → 0.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1554,11 +1554,11 @@ function DataTable({
1554
1554
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "mt-2 text-sm text-muted-foreground", children: "Loading..." })
1555
1555
  ] }) }) });
1556
1556
  }
1557
- if (data.length === 0) {
1557
+ if ((data || []).length === 0) {
1558
1558
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "rounded-md border", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "p-8 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm text-muted-foreground", children: emptyMessage }) }) }) });
1559
1559
  }
1560
1560
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "rounded-md border", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("table", { className: "w-full", children: [
1561
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tr", { className: "border-b bg-muted/50", children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1561
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tr", { className: "border-b bg-muted/50", children: (columns || []).map((column) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1562
1562
  "th",
1563
1563
  {
1564
1564
  className: cn(
@@ -1574,7 +1574,7 @@ function DataTable({
1574
1574
  },
1575
1575
  String(column.key)
1576
1576
  )) }) }),
1577
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tbody", { children: sortedData.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1577
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tbody", { children: (sortedData || []).map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1578
1578
  "tr",
1579
1579
  {
1580
1580
  className: cn(
@@ -1582,7 +1582,7 @@ function DataTable({
1582
1582
  onRowClick && "cursor-pointer"
1583
1583
  ),
1584
1584
  onClick: () => onRowClick?.(row),
1585
- children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1585
+ children: (columns || []).map((column) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1586
1586
  "td",
1587
1587
  {
1588
1588
  className: cn(
@@ -3273,7 +3273,7 @@ var AudioPlayer = React19.forwardRef(
3273
3273
  const [isShuffled, setIsShuffled] = (0, import_react6.useState)(false);
3274
3274
  const [isRepeating, setIsRepeating] = (0, import_react6.useState)(false);
3275
3275
  const [shuffledPlaylist, setShuffledPlaylist] = (0, import_react6.useState)([]);
3276
- const currentTrack = track || (playlist.length > 0 ? playlist[currentTrackIndex] : null);
3276
+ const currentTrack = track || ((playlist?.length || 0) > 0 ? playlist?.[currentTrackIndex] : null);
3277
3277
  const activePlaylist = isShuffled ? shuffledPlaylist : playlist;
3278
3278
  const formatTime = (0, import_react6.useCallback)((time) => {
3279
3279
  const minutes = Math.floor(time / 60);
@@ -3282,7 +3282,7 @@ var AudioPlayer = React19.forwardRef(
3282
3282
  }, []);
3283
3283
  const shuffleArray = (0, import_react6.useCallback)((array) => {
3284
3284
  const shuffled = [...array];
3285
- for (let i = shuffled.length - 1; i > 0; i--) {
3285
+ for (let i = (shuffled?.length || 0) - 1; i > 0; i--) {
3286
3286
  const j = Math.floor(Math.random() * (i + 1));
3287
3287
  [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
3288
3288
  }
@@ -3313,14 +3313,14 @@ var AudioPlayer = React19.forwardRef(
3313
3313
  audioRef.current?.play();
3314
3314
  return;
3315
3315
  }
3316
- if (playlist.length > 1) {
3317
- const nextIndex = (currentTrackIndex + 1) % playlist.length;
3316
+ if (playlist?.length || 0 > 1) {
3317
+ const nextIndex = (currentTrackIndex + 1) % playlist?.length || 0;
3318
3318
  setCurrentTrackIndex(nextIndex);
3319
3319
  } else {
3320
3320
  setIsPlaying(false);
3321
3321
  onPlayStateChange?.(false);
3322
3322
  }
3323
- }, [currentTrack, isRepeating, playlist.length, currentTrackIndex, onTrackEnd, onPlayStateChange]);
3323
+ }, [currentTrack, isRepeating, playlist?.length, currentTrackIndex, onTrackEnd, onPlayStateChange]);
3324
3324
  const handleError = (0, import_react6.useCallback)(() => {
3325
3325
  const errorMsg = "Failed to load audio track";
3326
3326
  setError(errorMsg);
@@ -3369,17 +3369,17 @@ var AudioPlayer = React19.forwardRef(
3369
3369
  }
3370
3370
  }, []);
3371
3371
  const skipToNext = (0, import_react6.useCallback)(() => {
3372
- if (playlist.length > 1) {
3373
- const nextIndex = (currentTrackIndex + 1) % playlist.length;
3372
+ if (playlist?.length || 0 > 1) {
3373
+ const nextIndex = (currentTrackIndex + 1) % playlist?.length || 0;
3374
3374
  setCurrentTrackIndex(nextIndex);
3375
3375
  }
3376
- }, [playlist.length, currentTrackIndex]);
3376
+ }, [playlist?.length || 0, currentTrackIndex]);
3377
3377
  const skipToPrevious = (0, import_react6.useCallback)(() => {
3378
- if (playlist.length > 1) {
3379
- const prevIndex = (currentTrackIndex - 1 + playlist.length) % playlist.length;
3378
+ if (playlist?.length || 0 > 1) {
3379
+ const prevIndex = (currentTrackIndex - 1 + playlist?.length || 0) % playlist?.length || 0;
3380
3380
  setCurrentTrackIndex(prevIndex);
3381
3381
  }
3382
- }, [playlist.length, currentTrackIndex]);
3382
+ }, [playlist?.length || 0, currentTrackIndex]);
3383
3383
  const toggleShuffle = (0, import_react6.useCallback)(() => {
3384
3384
  if (!isShuffled) {
3385
3385
  setShuffledPlaylist(shuffleArray(playlist));
@@ -3472,7 +3472,7 @@ var AudioPlayer = React19.forwardRef(
3472
3472
  variant: "ghost",
3473
3473
  size: "icon",
3474
3474
  onClick: skipToPrevious,
3475
- disabled: playlist.length <= 1,
3475
+ disabled: (playlist?.length || 0) <= 1,
3476
3476
  className: "h-8 w-8",
3477
3477
  children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.SkipBack, { className: "h-4 w-4" })
3478
3478
  }
@@ -3494,7 +3494,7 @@ var AudioPlayer = React19.forwardRef(
3494
3494
  variant: "ghost",
3495
3495
  size: "icon",
3496
3496
  onClick: skipToNext,
3497
- disabled: playlist.length <= 1,
3497
+ disabled: (playlist?.length || 0) <= 1,
3498
3498
  className: "h-8 w-8",
3499
3499
  children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.SkipForward, { className: "h-4 w-4" })
3500
3500
  }
@@ -3536,10 +3536,10 @@ var AudioPlayer = React19.forwardRef(
3536
3536
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-sm text-muted-foreground font-mono w-8", children: Math.round((isMuted ? 0 : volume) * 100) })
3537
3537
  ] }),
3538
3538
  error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "text-sm text-destructive bg-destructive/10 p-2 rounded mb-4", children: error }),
3539
- showPlaylist && playlist.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "border-t pt-4", children: [
3539
+ showPlaylist && playlist?.length || 0 > 1 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "border-t pt-4", children: [
3540
3540
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("h4", { className: "font-medium mb-2", children: [
3541
3541
  "Playlist (",
3542
- playlist.length,
3542
+ playlist?.length || 0,
3543
3543
  " tracks)"
3544
3544
  ] }),
3545
3545
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "max-h-48 overflow-y-auto space-y-1", children: playlist.map((playlistTrack, index) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
@@ -3993,7 +3993,7 @@ var VideoPlayer = React20.forwardRef(
3993
3993
  ),
3994
3994
  showSettings && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "absolute bottom-full right-0 mb-2 bg-black/90 rounded-lg p-2 min-w-[120px]", children: [
3995
3995
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "text-white text-xs font-medium mb-2", children: "Quality" }),
3996
- currentVideo.qualities.map((quality) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3996
+ (currentVideo?.qualities || []).map((quality) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3997
3997
  "button",
3998
3998
  {
3999
3999
  onClick: () => {
@@ -4024,13 +4024,13 @@ var VideoPlayer = React20.forwardRef(
4024
4024
  ] })
4025
4025
  ] })
4026
4026
  ] }),
4027
- showPlaylist && playlist.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "absolute top-0 right-0 w-80 h-full bg-black/90 backdrop-blur-sm transform translate-x-full group-hover:translate-x-0 transition-transform duration-300", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "p-4", children: [
4027
+ showPlaylist && (playlist || []).length > 1 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "absolute top-0 right-0 w-80 h-full bg-black/90 backdrop-blur-sm transform translate-x-full group-hover:translate-x-0 transition-transform duration-300", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "p-4", children: [
4028
4028
  /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("h4", { className: "text-white font-medium mb-4", children: [
4029
4029
  "Playlist (",
4030
- playlist.length,
4030
+ (playlist || []).length,
4031
4031
  " videos)"
4032
4032
  ] }),
4033
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "space-y-2 max-h-[calc(100%-60px)] overflow-y-auto", children: playlist.map((playlistVideo, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4033
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "space-y-2 max-h-[calc(100%-60px)] overflow-y-auto", children: (playlist || []).map((playlistVideo, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4034
4034
  "div",
4035
4035
  {
4036
4036
  className: cn(
@@ -6569,13 +6569,13 @@ var WaveformPlayer = ({
6569
6569
  }, [hapticFeedback]);
6570
6570
  const drawWaveform = (0, import_react10.useCallback)(() => {
6571
6571
  const canvas = canvasRef.current;
6572
- if (!canvas || !waveform.peaks.length) return;
6572
+ if (!canvas || !waveform?.peaks?.length) return;
6573
6573
  const ctx = canvas.getContext("2d");
6574
6574
  if (!ctx) return;
6575
6575
  const { width, height } = canvas;
6576
6576
  const peaks = waveform.peaks;
6577
6577
  const barWidth = width / peaks.length;
6578
- const progressPoint = currentTime / waveform.duration * width;
6578
+ const progressPoint = currentTime / (waveform?.duration || 1) * width;
6579
6579
  ctx.clearRect(0, 0, width, height);
6580
6580
  peaks.forEach((peak, index) => {
6581
6581
  const barHeight = Math.max(2, peak * height * 0.8);
@@ -6598,7 +6598,7 @@ var WaveformPlayer = ({
6598
6598
  }
6599
6599
  if (showComments && comments.length > 0) {
6600
6600
  comments.forEach((comment) => {
6601
- const commentX = comment.timestamp / waveform.duration * width;
6601
+ const commentX = comment.timestamp / (waveform?.duration || 1) * width;
6602
6602
  ctx.fillStyle = "#ffffff";
6603
6603
  ctx.strokeStyle = "#ff5500";
6604
6604
  ctx.lineWidth = 2;
@@ -6633,20 +6633,20 @@ var WaveformPlayer = ({
6633
6633
  setHoverPosition(x);
6634
6634
  };
6635
6635
  const handleClick = (e) => {
6636
- if (!containerRef.current || !waveform.duration) return;
6636
+ if (!containerRef.current || !waveform?.duration) return;
6637
6637
  const rect = containerRef.current.getBoundingClientRect();
6638
6638
  const x = e.clientX - rect.left;
6639
6639
  const clickPercentage = x / rect.width;
6640
- const newTime = clickPercentage * waveform.duration;
6640
+ const newTime = clickPercentage * (waveform?.duration || 0);
6641
6641
  onSeek?.(newTime);
6642
6642
  triggerHaptic("light");
6643
6643
  };
6644
6644
  const handleDoubleClick = (e) => {
6645
- if (!containerRef.current || !waveform.duration) return;
6645
+ if (!containerRef.current || !waveform?.duration) return;
6646
6646
  const rect = containerRef.current.getBoundingClientRect();
6647
6647
  const x = e.clientX - rect.left;
6648
6648
  const clickPercentage = x / rect.width;
6649
- const timestamp = clickPercentage * waveform.duration;
6649
+ const timestamp = clickPercentage * (waveform?.duration || 0);
6650
6650
  setCommentPosition(timestamp);
6651
6651
  setShowCommentInput(true);
6652
6652
  triggerHaptic("medium");
@@ -6839,11 +6839,11 @@ var WaveformPlayer = ({
6839
6839
  transform: "translateX(-50%)",
6840
6840
  marginTop: "-30px"
6841
6841
  },
6842
- children: formatTime(hoverPosition / (containerRef.current?.getBoundingClientRect().width || 1) * waveform.duration)
6842
+ children: formatTime(hoverPosition / (containerRef.current?.getBoundingClientRect().width || 1) * (waveform?.duration || 0))
6843
6843
  }
6844
6844
  ),
6845
6845
  showComments && comments.map((comment) => {
6846
- const commentPosition2 = comment.timestamp / waveform.duration * 100;
6846
+ const commentPosition2 = comment.timestamp / (waveform?.duration || 1) * 100;
6847
6847
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
6848
6848
  import_framer_motion8.motion.div,
6849
6849
  {
@@ -6876,7 +6876,7 @@ var WaveformPlayer = ({
6876
6876
  /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { children: [
6877
6877
  formatTime(currentTime),
6878
6878
  " / ",
6879
- formatTime(waveform.duration)
6879
+ formatTime(waveform?.duration || 0)
6880
6880
  ] }),
6881
6881
  playCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center gap-1", children: [
6882
6882
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react17.Play, { className: "w-3 h-3" }),
@@ -6885,7 +6885,7 @@ var WaveformPlayer = ({
6885
6885
  ] }),
6886
6886
  /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center gap-1", children: [
6887
6887
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react17.Clock, { className: "w-3 h-3" }),
6888
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: formatTime(waveform.duration) })
6888
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: formatTime(waveform?.duration || 0) })
6889
6889
  ] })
6890
6890
  ] }),
6891
6891
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_framer_motion8.AnimatePresence, { children: showCommentInput && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
@@ -7008,6 +7008,7 @@ var TrackCard = ({
7008
7008
  return `${mins}:${secs.toString().padStart(2, "0")}`;
7009
7009
  };
7010
7010
  const formatDate3 = (date) => {
7011
+ if (!date) return "Unknown date";
7011
7012
  const now = /* @__PURE__ */ new Date();
7012
7013
  const diffTime = Math.abs(now.getTime() - date.getTime());
7013
7014
  const diffDays = Math.ceil(diffTime / (1e3 * 60 * 60 * 24));
@@ -7622,7 +7623,7 @@ var TabNavigation = ({
7622
7623
  }
7623
7624
  ) }),
7624
7625
  /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "relative", children: [
7625
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
7626
+ typeof tab.icon === "function" ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
7626
7627
  tab.icon,
7627
7628
  {
7628
7629
  className: cn(
@@ -7630,7 +7631,10 @@ var TabNavigation = ({
7630
7631
  variant === "compact" && "w-5 h-5"
7631
7632
  )
7632
7633
  }
7633
- ),
7634
+ ) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: cn(
7635
+ "w-6 h-6 bg-muted rounded flex items-center justify-center text-xs font-medium",
7636
+ variant === "compact" && "w-5 h-5"
7637
+ ), children: typeof tab.icon === "string" ? tab.icon.charAt(0).toUpperCase() : "?" }),
7634
7638
  showBadges && tab.badge && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
7635
7639
  import_framer_motion10.motion.div,
7636
7640
  {
@@ -7986,13 +7990,13 @@ var AudioFeed = ({
7986
7990
  { id: "random", label: "Discover", icon: import_lucide_react20.Music }
7987
7991
  ];
7988
7992
  const filterOptions = [
7989
- { id: "all", label: "All Content", count: items.length },
7990
- { id: "music", label: "Music", count: items.filter((item) => item.genre !== "Podcast").length },
7991
- { id: "podcast", label: "Podcasts", count: items.filter((item) => item.genre === "Podcast").length },
7992
- { id: "remix", label: "Remixes", count: items.filter((item) => item.tags?.includes("remix")).length },
7993
- { id: "original", label: "Originals", count: items.filter((item) => !item.tags?.includes("remix")).length }
7993
+ { id: "all", label: "All Content", count: items?.length || 0 },
7994
+ { id: "music", label: "Music", count: items?.filter((item) => item.genre !== "Podcast")?.length || 0 },
7995
+ { id: "podcast", label: "Podcasts", count: items?.filter((item) => item.genre === "Podcast")?.length || 0 },
7996
+ { id: "remix", label: "Remixes", count: items?.filter((item) => item.tags?.includes("remix"))?.length || 0 },
7997
+ { id: "original", label: "Originals", count: items?.filter((item) => !item.tags?.includes("remix"))?.length || 0 }
7994
7998
  ];
7995
- const displayItems = virtualScrolling ? items.slice(0, visibleItems) : items;
7999
+ const displayItems = virtualScrolling ? (items || []).slice(0, visibleItems) : items || [];
7996
8000
  const formatFeedContext = (item) => {
7997
8001
  const context = item.feedContext;
7998
8002
  if (!context) return null;
@@ -8399,8 +8403,8 @@ var SearchWithFilters = ({
8399
8403
  if (filters.sortBy !== "relevance") count++;
8400
8404
  if (filters.duration !== "any") count++;
8401
8405
  if (filters.dateRange !== "any") count++;
8402
- if (filters.genres.length > 0) count++;
8403
- if (filters.tags.length > 0) count++;
8406
+ if (filters.genres?.length > 0) count++;
8407
+ if (filters.tags?.length > 0) count++;
8404
8408
  if (filters.verified) count++;
8405
8409
  if (filters.downloadable) count++;
8406
8410
  if (filters.hasLyrics) count++;
@@ -8476,7 +8480,7 @@ var SearchWithFilters = ({
8476
8480
  )
8477
8481
  ] })
8478
8482
  ] }),
8479
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_framer_motion12.AnimatePresence, { children: showSuggestions && (enableSuggestions || recentSearches.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
8483
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_framer_motion12.AnimatePresence, { children: showSuggestions && (enableSuggestions || recentSearches?.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
8480
8484
  import_framer_motion12.motion.div,
8481
8485
  {
8482
8486
  initial: { opacity: 0, y: -10 },
@@ -8484,7 +8488,7 @@ var SearchWithFilters = ({
8484
8488
  exit: { opacity: 0, y: -10 },
8485
8489
  className: "absolute top-full left-0 right-0 mt-1 bg-popover border border-border rounded-lg shadow-lg z-10 max-h-96 overflow-y-auto",
8486
8490
  children: [
8487
- !localQuery && recentSearches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "p-3 border-b border-border", children: [
8491
+ !localQuery && recentSearches?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "p-3 border-b border-border", children: [
8488
8492
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between mb-2", children: [
8489
8493
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("h3", { className: "text-sm font-medium text-foreground", children: "Recent" }),
8490
8494
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
@@ -8513,7 +8517,7 @@ var SearchWithFilters = ({
8513
8517
  index
8514
8518
  )) })
8515
8519
  ] }),
8516
- filteredSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "p-3", children: [
8520
+ filteredSuggestions?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "p-3", children: [
8517
8521
  !localQuery && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("h3", { className: "text-sm font-medium text-foreground mb-2", children: "Trending" }),
8518
8522
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "space-y-1", children: filteredSuggestions.map((suggestion) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
8519
8523
  "button",
@@ -8673,7 +8677,7 @@ var SearchWithFilters = ({
8673
8677
  }
8674
8678
  ) })
8675
8679
  ] }),
8676
- showAdvancedFilters && availableGenres.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
8680
+ showAdvancedFilters && availableGenres?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
8677
8681
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
8678
8682
  "button",
8679
8683
  {
@@ -8765,11 +8769,11 @@ var SearchWithFilters = ({
8765
8769
  " results",
8766
8770
  localQuery && ` for "${localQuery}"`
8767
8771
  ] }),
8768
- results.tracks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
8772
+ results?.tracks?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
8769
8773
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("h2", { className: "text-lg font-semibold mb-4 flex items-center gap-2", children: [
8770
8774
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react21.Music, { className: "w-5 h-5" }),
8771
8775
  "Tracks (",
8772
- results.tracks.length,
8776
+ results?.tracks?.length || 0,
8773
8777
  ")"
8774
8778
  ] }),
8775
8779
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "space-y-4", children: results.tracks.map((track) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
@@ -8789,11 +8793,11 @@ var SearchWithFilters = ({
8789
8793
  track.id
8790
8794
  )) })
8791
8795
  ] }),
8792
- results.artists.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
8796
+ results?.artists?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
8793
8797
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("h2", { className: "text-lg font-semibold mb-4 flex items-center gap-2", children: [
8794
8798
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react21.User, { className: "w-5 h-5" }),
8795
8799
  "Artists (",
8796
- results.artists.length,
8800
+ results?.artists?.length || 0,
8797
8801
  ")"
8798
8802
  ] }),
8799
8803
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: results.artists.map((artist) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
@@ -8828,11 +8832,11 @@ var SearchWithFilters = ({
8828
8832
  artist.id
8829
8833
  )) })
8830
8834
  ] }),
8831
- results.playlists.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
8835
+ results?.playlists?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
8832
8836
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("h2", { className: "text-lg font-semibold mb-4 flex items-center gap-2", children: [
8833
8837
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react21.Play, { className: "w-5 h-5" }),
8834
8838
  "Playlists (",
8835
- results.playlists.length,
8839
+ results?.playlists?.length || 0,
8836
8840
  ")"
8837
8841
  ] }),
8838
8842
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: results.playlists.map((playlist) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
@@ -9005,10 +9009,10 @@ var PlaylistBuilder = ({
9005
9009
  const totalDuration = tracks.reduce((sum, track) => sum + track.duration, 0);
9006
9010
  const totalPlays = tracks.reduce((sum, track) => sum + track.playCount, 0);
9007
9011
  return {
9008
- trackCount: tracks.length,
9012
+ trackCount: tracks?.length || 0,
9009
9013
  totalDuration,
9010
9014
  totalPlays,
9011
- averageDuration: tracks.length > 0 ? totalDuration / tracks.length : 0
9015
+ averageDuration: (tracks?.length || 0) > 0 ? totalDuration / (tracks?.length || 1) : 0
9012
9016
  };
9013
9017
  }, [localPlaylist.tracks]);
9014
9018
  const formatDuration2 = (seconds) => {
@@ -9089,7 +9093,7 @@ var PlaylistBuilder = ({
9089
9093
  playlist?.followerCount && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex items-center gap-1", children: [
9090
9094
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react22.Users, { className: "w-4 h-4" }),
9091
9095
  /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { children: [
9092
- playlist.followerCount.toLocaleString(),
9096
+ playlist?.followerCount?.toLocaleString() || "0",
9093
9097
  " followers"
9094
9098
  ] })
9095
9099
  ] })
@@ -9266,7 +9270,7 @@ var PlaylistBuilder = ({
9266
9270
  animate: { opacity: 1, height: "auto" },
9267
9271
  exit: { opacity: 0, height: 0 },
9268
9272
  className: "space-y-2",
9269
- children: loading.search ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_framer_motion13.motion.div, { className: "w-6 h-6 border-2 border-primary border-t-transparent rounded-full animate-spin" }) }) : searchResults.map((track) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
9273
+ children: loading.search ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_framer_motion13.motion.div, { className: "w-6 h-6 border-2 border-primary border-t-transparent rounded-full animate-spin" }) }) : (searchResults || []).map((track) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
9270
9274
  import_framer_motion13.motion.div,
9271
9275
  {
9272
9276
  initial: { opacity: 0, y: 10 },
@@ -9344,10 +9348,10 @@ var PlaylistBuilder = ({
9344
9348
  import_framer_motion13.Reorder.Group,
9345
9349
  {
9346
9350
  axis: "y",
9347
- values: localPlaylist.tracks,
9351
+ values: localPlaylist.tracks || [],
9348
9352
  onReorder: handleReorder,
9349
9353
  className: "space-y-2",
9350
- children: localPlaylist.tracks.map((track, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
9354
+ children: (localPlaylist.tracks || []).map((track, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
9351
9355
  import_framer_motion13.Reorder.Item,
9352
9356
  {
9353
9357
  value: track,
@@ -9403,7 +9407,7 @@ var PlaylistBuilder = ({
9403
9407
  track.id
9404
9408
  ))
9405
9409
  }
9406
- ) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "space-y-2", children: localPlaylist.tracks.map((track, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
9410
+ ) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "space-y-2", children: (localPlaylist.tracks || []).map((track, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
9407
9411
  "div",
9408
9412
  {
9409
9413
  className: "flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 transition-colors group",
@@ -9761,11 +9765,11 @@ var TrendingSection = ({
9761
9765
  ] }),
9762
9766
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Badge, { variant: "outline", className: "text-xs", children: [
9763
9767
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react23.Users, { className: "w-3 h-3 mr-1" }),
9764
- section.tracks.length,
9768
+ section.tracks?.length || 0,
9765
9769
  " tracks"
9766
9770
  ] }) })
9767
9771
  ] }) }),
9768
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "divide-y divide-gray-100 dark:divide-gray-800", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_framer_motion14.AnimatePresence, { children: displayTracks.map((track) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9772
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "divide-y divide-gray-100 dark:divide-gray-800", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_framer_motion14.AnimatePresence, { children: (displayTracks || []).map((track) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9769
9773
  TrackRow,
9770
9774
  {
9771
9775
  track,
@@ -9780,7 +9784,7 @@ var TrendingSection = ({
9780
9784
  },
9781
9785
  track.id
9782
9786
  )) }) }),
9783
- section.tracks.length > 10 && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "p-4 border-t border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9787
+ (section.tracks?.length || 0) > 10 && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "p-4 border-t border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9784
9788
  Button,
9785
9789
  {
9786
9790
  variant: "ghost",
@@ -10389,7 +10393,7 @@ var CommentSystem = ({
10389
10393
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_lucide_react24.MessageCircle, { className: "w-5 h-5 text-gray-600 dark:text-gray-400" }),
10390
10394
  /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("h3", { className: "font-semibold text-gray-900 dark:text-gray-100", children: [
10391
10395
  "Comments (",
10392
- comments.length,
10396
+ comments?.length || 0,
10393
10397
  ")"
10394
10398
  ] })
10395
10399
  ] }),
@@ -10416,7 +10420,7 @@ var CommentSystem = ({
10416
10420
  formatTimestamp(currentTime),
10417
10421
  ":"
10418
10422
  ] }),
10419
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "space-y-2", children: currentTimeComments.slice(0, 3).map((comment) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center gap-2 text-sm", children: [
10423
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "space-y-2", children: (currentTimeComments || []).slice(0, 3).map((comment) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center gap-2 text-sm", children: [
10420
10424
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("img", { src: comment.author.avatar, alt: "", className: "w-6 h-6 rounded-full" }),
10421
10425
  /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "font-medium", children: [
10422
10426
  comment.author.name,
@@ -10443,7 +10447,7 @@ var CommentSystem = ({
10443
10447
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_lucide_react24.MessageCircle, { className: "w-12 h-12 mx-auto mb-4 opacity-50" }),
10444
10448
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { children: "No comments yet" }),
10445
10449
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-sm", children: "Be the first to share your thoughts!" })
10446
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_framer_motion15.AnimatePresence, { children: sortedComments.map((comment) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { children: [
10450
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_framer_motion15.AnimatePresence, { children: (sortedComments || []).map((comment) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { children: [
10447
10451
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10448
10452
  CommentItem,
10449
10453
  {
@@ -10478,7 +10482,7 @@ var CommentSystem = ({
10478
10482
  hapticFeedback
10479
10483
  }
10480
10484
  ) }),
10481
- comment.replies && comment.replies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "ml-12 border-l border-gray-200 dark:border-gray-700", children: comment.replies.map((reply) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10485
+ comment.replies && comment.replies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "ml-12 border-l border-gray-200 dark:border-gray-700", children: (comment.replies || []).map((reply) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10482
10486
  CommentItem,
10483
10487
  {
10484
10488
  comment: reply,
@@ -10827,7 +10831,7 @@ var ContentTabs = ({
10827
10831
  if (isArtist) {
10828
10832
  tabs.splice(1, 0, { id: "popular", label: "Popular", icon: import_lucide_react25.TrendingUp });
10829
10833
  }
10830
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("nav", { className: "flex space-x-8 px-6", children: tabs.map((tab) => {
10834
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("nav", { className: "flex space-x-8 px-6", children: (tabs || []).map((tab) => {
10831
10835
  const Icon2 = tab.icon;
10832
10836
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
10833
10837
  "button",
@@ -10940,7 +10944,7 @@ var UserProfile = ({
10940
10944
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react25.Star, { className: "w-5 h-5 text-yellow-500" }),
10941
10945
  "Pinned Tracks"
10942
10946
  ] }) }),
10943
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: profile.pinnedTracks.slice(0, 4).map((track) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10947
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: (profile.pinnedTracks || []).slice(0, 4).map((track) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10944
10948
  TrackCard,
10945
10949
  {
10946
10950
  track,
@@ -10971,7 +10975,7 @@ var UserProfile = ({
10971
10975
  }
10972
10976
  )
10973
10977
  ] }),
10974
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "space-y-2", children: profile.recentTracks.slice(0, 3).map((track) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10978
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "space-y-2", children: (profile.recentTracks || []).slice(0, 3).map((track) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10975
10979
  TrackCard,
10976
10980
  {
10977
10981
  track,
@@ -11214,7 +11218,7 @@ var ShareModal = ({
11214
11218
  /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mb-2", children: "Share" }),
11215
11219
  /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-sm text-gray-600 dark:text-gray-400 truncate", children: shareTitle || shareUrl })
11216
11220
  ] }),
11217
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "grid grid-cols-3 gap-4", children: shareOptions.map((option) => {
11221
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "grid grid-cols-3 gap-4", children: (shareOptions || []).map((option) => {
11218
11222
  const Icon2 = option.icon;
11219
11223
  return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
11220
11224
  "button",
@@ -11505,7 +11509,7 @@ var SocialActions = ({
11505
11509
  };
11506
11510
  return configs;
11507
11511
  }, [actionStates, actionCounts, loadingStates]);
11508
- const visibleActions = actions.filter((action) => actionConfigs[action]);
11512
+ const visibleActions = (actions || []).filter((action) => actionConfigs[action]);
11509
11513
  const primaryActions = visibleActions.slice(0, variant === "compact" ? 3 : 4);
11510
11514
  const secondaryActions = visibleActions.slice(variant === "compact" ? 3 : 4);
11511
11515
  const containerClasses = cn(
@@ -11517,7 +11521,7 @@ var SocialActions = ({
11517
11521
  );
11518
11522
  return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
11519
11523
  /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: containerClasses, style: { backgroundColor }, children: [
11520
- primaryActions.map((actionType) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
11524
+ (primaryActions || []).map((actionType) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
11521
11525
  ActionButton,
11522
11526
  {
11523
11527
  action: actionConfigs[actionType],
@@ -11779,7 +11783,7 @@ var NotificationItemComponent = ({
11779
11783
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-start justify-between", children: [
11780
11784
  /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "min-w-0 flex-1", children: [
11781
11785
  notification.users && notification.users.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex -space-x-2 mb-2", children: [
11782
- notification.users.slice(0, 3).map((user) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
11786
+ (notification.users || []).slice(0, 3).map((user) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
11783
11787
  "img",
11784
11788
  {
11785
11789
  src: user.avatar,
@@ -11941,7 +11945,7 @@ var FilterTabs = ({ activeFilter, onFilterChange, counts }) => {
11941
11945
  { id: "content", label: "Content", count: counts.content },
11942
11946
  { id: "system", label: "System", count: counts.system }
11943
11947
  ];
11944
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex space-x-1 p-1 bg-gray-100 dark:bg-gray-800 rounded-lg", children: filters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
11948
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex space-x-1 p-1 bg-gray-100 dark:bg-gray-800 rounded-lg", children: (filters || []).map((filter) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
11945
11949
  "button",
11946
11950
  {
11947
11951
  onClick: () => onFilterChange(filter.id),
@@ -11991,7 +11995,8 @@ var NotificationCenter = ({
11991
11995
  let filtered = notifications;
11992
11996
  if (groupSimilar) {
11993
11997
  const grouped = {};
11994
- notifications.forEach((notification) => {
11998
+ const notificationArray = notifications || [];
11999
+ notificationArray.forEach((notification) => {
11995
12000
  const key = `${notification.type}-${notification.track?.id || notification.playlist?.id || "general"}`;
11996
12001
  if (!grouped[key]) {
11997
12002
  grouped[key] = [];
@@ -12160,6 +12165,7 @@ var AudioVisualizer = ({
12160
12165
  if (!ctx) return;
12161
12166
  const { width, height } = canvas;
12162
12167
  const { frequencies, waveform, rms, peak } = audioAnalysis;
12168
+ if (!frequencies || !waveform) return;
12163
12169
  ctx.clearRect(0, 0, width, height);
12164
12170
  ctx.fillStyle = accentColor;
12165
12171
  switch (type) {
@@ -12489,7 +12495,7 @@ var AdvancedPlayer = ({
12489
12495
  onRepeat?.(nextMode);
12490
12496
  }, [repeatMode, onRepeat, triggerHaptic]);
12491
12497
  const canGoPrevious = currentIndex > 0 || repeatMode === "all";
12492
- const canGoNext = currentIndex < playlist.length - 1 || repeatMode === "all";
12498
+ const canGoNext = currentIndex < (playlist?.length || 0) - 1 || repeatMode === "all";
12493
12499
  if (!track) {
12494
12500
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Card, { className: cn("p-6 text-center", className), children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col items-center gap-4", children: [
12495
12501
  /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "w-16 h-16 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_lucide_react28.Headphones, { className: "w-8 h-8 text-gray-400" }) }),
@@ -13087,10 +13093,10 @@ var ActivityFeed = ({
13087
13093
  }
13088
13094
  ) });
13089
13095
  }
13090
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: cn("space-y-3", className), children: activities.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "text-center py-8 text-gray-500 dark:text-gray-400", children: [
13096
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: cn("space-y-3", className), children: (activities?.length || 0) === 0 ? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "text-center py-8 text-gray-500 dark:text-gray-400", children: [
13091
13097
  /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_lucide_react29.Activity, { className: "w-8 h-8 mx-auto mb-2 opacity-50" }),
13092
13098
  /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-sm", children: "No recent activity" })
13093
- ] }) : activities.map((activity) => {
13099
+ ] }) : (activities || []).map((activity) => {
13094
13100
  const Icon2 = getActivityIcon(activity.type);
13095
13101
  return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
13096
13102
  import_framer_motion20.motion.div,
@@ -13210,7 +13216,7 @@ var LiveSessionControls = ({
13210
13216
  "Live Session Active"
13211
13217
  ] }),
13212
13218
  /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: [
13213
- playlist.liveSession.listeners.length,
13219
+ playlist.liveSession?.listeners?.length || 0,
13214
13220
  " listening",
13215
13221
  playlist.liveSession.chatEnabled && " \u2022 Chat enabled"
13216
13222
  ] })
@@ -14155,6 +14161,10 @@ function useMounted() {
14155
14161
  var import_react26 = require("react");
14156
14162
  function useLockBody() {
14157
14163
  (0, import_react26.useLayoutEffect)(() => {
14164
+ if (typeof window === "undefined" || typeof document === "undefined") {
14165
+ return () => {
14166
+ };
14167
+ }
14158
14168
  const originalStyle = window.getComputedStyle(
14159
14169
  document.body
14160
14170
  ).overflow;
@@ -14166,8 +14176,14 @@ function useLockBody() {
14166
14176
  // src/hooks/web/use-media-query.ts
14167
14177
  var import_react27 = require("react");
14168
14178
  function useMediaQuery(query) {
14169
- const [matches, setMatches] = (0, import_react27.useState)(false);
14179
+ const [matches, setMatches] = (0, import_react27.useState)(() => {
14180
+ if (typeof window !== "undefined") {
14181
+ return window.matchMedia(query).matches;
14182
+ }
14183
+ return false;
14184
+ });
14170
14185
  (0, import_react27.useEffect)(() => {
14186
+ if (typeof window === "undefined") return;
14171
14187
  const media = window.matchMedia(query);
14172
14188
  if (media.matches !== matches) {
14173
14189
  setMatches(media.matches);
@@ -15294,9 +15310,9 @@ var VirtualScrollList = ({
15294
15310
  const measurementsRef = (0, import_react33.useRef)({});
15295
15311
  const itemSizes = (0, import_react33.useMemo)(() => {
15296
15312
  if (typeof itemHeight === "number") {
15297
- return Array(items.length).fill(itemHeight);
15313
+ return Array(items?.length || 0).fill(itemHeight);
15298
15314
  }
15299
- return items.map((item, index) => {
15315
+ return (items || []).map((item, index) => {
15300
15316
  if (measurementsRef.current[index] !== void 0) {
15301
15317
  return measurementsRef.current[index];
15302
15318
  }
@@ -15320,9 +15336,9 @@ var VirtualScrollList = ({
15320
15336
  const containerHeight2 = scrollElementRef.current?.clientHeight || 400;
15321
15337
  const start = Math.max(0, Math.floor(scrollTop / (itemHeight || 50)) - overscan);
15322
15338
  const visibleCount = Math.ceil(containerHeight2 / (itemHeight || 50)) + overscan * 2;
15323
- const end = Math.min(items.length - 1, start + visibleCount);
15339
+ const end = Math.min((items?.length || 0) - 1, start + visibleCount);
15324
15340
  return { start, end };
15325
- }, [scrollTop, itemHeight, overscan, items.length]);
15341
+ }, [scrollTop, itemHeight, overscan, items?.length]);
15326
15342
  const visibleItems = (0, import_react33.useMemo)(() => {
15327
15343
  return itemPositions.slice(visibleRange.start, visibleRange.end + 1);
15328
15344
  }, [itemPositions, visibleRange]);
@@ -15906,15 +15922,22 @@ var formatDate2 = (date, options = {
15906
15922
  day: "numeric",
15907
15923
  year: "numeric"
15908
15924
  }) => {
15909
- return new Date(date).toLocaleDateString(void 0, options);
15925
+ if (!date) return "Invalid date";
15926
+ try {
15927
+ return new Date(date).toLocaleDateString(void 0, options);
15928
+ } catch (error) {
15929
+ return "Invalid date";
15930
+ }
15910
15931
  };
15911
15932
  var formatNumber3 = (number, options = {
15912
15933
  minimumFractionDigits: 0,
15913
15934
  maximumFractionDigits: 2
15914
15935
  }) => {
15936
+ if (typeof number !== "number" || isNaN(number)) return "0";
15915
15937
  return new Intl.NumberFormat(void 0, options).format(number);
15916
15938
  };
15917
15939
  var formatCurrency = (amount, currency = "USD", locale = "en-US") => {
15940
+ if (typeof amount !== "number" || isNaN(amount)) return "$0.00";
15918
15941
  return new Intl.NumberFormat(locale, {
15919
15942
  style: "currency",
15920
15943
  currency
@@ -15923,11 +15946,16 @@ var formatCurrency = (amount, currency = "USD", locale = "en-US") => {
15923
15946
 
15924
15947
  // src/utils/validation.ts
15925
15948
  var validateEmail = (email) => {
15949
+ if (!email || typeof email !== "string") return false;
15926
15950
  const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
15927
15951
  return re.test(email);
15928
15952
  };
15929
15953
  var validatePassword = (password) => {
15930
15954
  const errors = [];
15955
+ if (!password || typeof password !== "string") {
15956
+ errors.push("Password is required");
15957
+ return { isValid: false, errors };
15958
+ }
15931
15959
  if (password.length < 8) {
15932
15960
  errors.push("Password must be at least 8 characters long");
15933
15961
  }