@tomaszjarosz/react-visualizers 0.4.12 → 0.4.13

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
@@ -2050,13 +2050,13 @@ const BINARY_SEARCH_CODE = [
2050
2050
  " right = mid - 1",
2051
2051
  " return -1 // Not found"
2052
2052
  ];
2053
- const LEGEND_ITEMS$K = [
2053
+ const LEGEND_ITEMS$L = [
2054
2054
  { color: "bg-blue-100", label: "Search Space" },
2055
2055
  { color: "bg-gray-200", label: "Eliminated" },
2056
2056
  { color: "bg-purple-500", label: "Mid" },
2057
2057
  { color: "bg-green-500", label: "Found" }
2058
2058
  ];
2059
- const BADGES$I = [
2059
+ const BADGES$J = [
2060
2060
  { label: "Time: O(log n)", variant: "green" },
2061
2061
  { label: "Space: O(1)", variant: "green" }
2062
2062
  ];
@@ -2402,7 +2402,7 @@ const BinarySearchVisualizerComponent = ({
2402
2402
  {
2403
2403
  id: "binarysearch-visualizer",
2404
2404
  title: "Binary Search",
2405
- badges: BADGES$I,
2405
+ badges: BADGES$J,
2406
2406
  gradient: "green",
2407
2407
  className,
2408
2408
  minHeight: 350,
@@ -2429,7 +2429,7 @@ const BinarySearchVisualizerComponent = ({
2429
2429
  accentColor: "green"
2430
2430
  },
2431
2431
  showControls,
2432
- legendItems: LEGEND_ITEMS$K,
2432
+ legendItems: LEGEND_ITEMS$L,
2433
2433
  code: showCode ? BINARY_SEARCH_CODE : void 0,
2434
2434
  currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
2435
2435
  codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
@@ -2497,7 +2497,7 @@ const ALGORITHM_CODE = {
2497
2497
  " else arr[k++] = right[j++]"
2498
2498
  ]
2499
2499
  };
2500
- const LEGEND_ITEMS$J = [
2500
+ const LEGEND_ITEMS$K = [
2501
2501
  { color: "bg-blue-500", label: "Default" },
2502
2502
  { color: "bg-amber-400", label: "Comparing" },
2503
2503
  { color: "bg-red-500", label: "Swapping" },
@@ -3320,7 +3320,7 @@ const SortingVisualizerComponent = ({
3320
3320
  extraControls: sizeControl
3321
3321
  },
3322
3322
  showControls,
3323
- legendItems: LEGEND_ITEMS$J,
3323
+ legendItems: LEGEND_ITEMS$K,
3324
3324
  code: showCode ? ALGORITHM_CODE[algorithm] : void 0,
3325
3325
  currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
3326
3326
  codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
@@ -3874,7 +3874,7 @@ const SortingComparisonVisualizerComponent = ({
3874
3874
  );
3875
3875
  };
3876
3876
  const SortingComparisonVisualizer = React.memo(SortingComparisonVisualizerComponent);
3877
- const BADGES$H = [
3877
+ const BADGES$I = [
3878
3878
  { label: "Time: O((V+E) log V)", variant: "orange" },
3879
3879
  { label: "Space: O(V)", variant: "amber" }
3880
3880
  ];
@@ -3891,7 +3891,7 @@ const DIJKSTRA_CODE = [
3891
3891
  " dist[v] = dist[u]+w",
3892
3892
  " pq.add((dist[v], v))"
3893
3893
  ];
3894
- const LEGEND_ITEMS$I = [
3894
+ const LEGEND_ITEMS$J = [
3895
3895
  { color: "bg-blue-100", label: "Unvisited", border: "#60a5fa" },
3896
3896
  { color: "bg-yellow-400", label: "Current", border: "#ca8a04" },
3897
3897
  { color: "bg-green-400", label: "Visited", border: "#16a34a" }
@@ -4215,7 +4215,7 @@ const DijkstraVisualizerComponent = ({
4215
4215
  {
4216
4216
  id: VISUALIZER_ID2,
4217
4217
  title: "Dijkstra's Algorithm",
4218
- badges: BADGES$H,
4218
+ badges: BADGES$I,
4219
4219
  gradient: "orange",
4220
4220
  className,
4221
4221
  minHeight: 500,
@@ -4239,7 +4239,7 @@ const DijkstraVisualizerComponent = ({
4239
4239
  accentColor: "orange"
4240
4240
  },
4241
4241
  showControls,
4242
- legendItems: LEGEND_ITEMS$I,
4242
+ legendItems: LEGEND_ITEMS$J,
4243
4243
  code: showCode ? DIJKSTRA_CODE : void 0,
4244
4244
  currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
4245
4245
  codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
@@ -4256,7 +4256,7 @@ const DEFAULT_ITEMS$1 = [
4256
4256
  { weight: 5, value: 6 }
4257
4257
  ];
4258
4258
  const DEFAULT_CAPACITY$1 = 8;
4259
- const BADGES$G = [
4259
+ const BADGES$H = [
4260
4260
  { label: "Time: O(nW)", variant: "teal" },
4261
4261
  { label: "Space: O(nW)", variant: "cyan" }
4262
4262
  ];
@@ -4270,7 +4270,7 @@ const KNAPSACK_CODE = [
4270
4270
  " take = dp[i-1][w-weight] + value",
4271
4271
  " dp[i][w] = max(skip, take)"
4272
4272
  ];
4273
- const LEGEND_ITEMS$H = [
4273
+ const LEGEND_ITEMS$I = [
4274
4274
  { color: "bg-gray-50", label: "Not computed", border: "#d1d5db" },
4275
4275
  { color: "bg-blue-100", label: "Computed" },
4276
4276
  { color: "bg-green-400", label: "Take item" },
@@ -4529,7 +4529,7 @@ const DPVisualizerComponent = ({
4529
4529
  {
4530
4530
  id: VISUALIZER_ID2,
4531
4531
  title: "0/1 Knapsack (Dynamic Programming)",
4532
- badges: BADGES$G,
4532
+ badges: BADGES$H,
4533
4533
  gradient: "teal",
4534
4534
  className,
4535
4535
  minHeight: 450,
@@ -4553,7 +4553,7 @@ const DPVisualizerComponent = ({
4553
4553
  accentColor: "teal"
4554
4554
  },
4555
4555
  showControls,
4556
- legendItems: LEGEND_ITEMS$H,
4556
+ legendItems: LEGEND_ITEMS$I,
4557
4557
  code: showCode ? KNAPSACK_CODE : void 0,
4558
4558
  currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
4559
4559
  codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
@@ -4595,7 +4595,7 @@ const BFS_CODE = [
4595
4595
  " visited[neighbor] = true",
4596
4596
  " queue.enqueue(neighbor)"
4597
4597
  ];
4598
- const LEGEND_ITEMS$G = [
4598
+ const LEGEND_ITEMS$H = [
4599
4599
  { color: "bg-blue-100", label: "Unvisited", border: "#60a5fa" },
4600
4600
  { color: "bg-yellow-400", label: "Current", border: "#ca8a04" },
4601
4601
  { color: "bg-green-400", label: "Visited", border: "#16a34a" }
@@ -5010,7 +5010,7 @@ const GraphVisualizerComponent = ({
5010
5010
  accentColor: "purple"
5011
5011
  },
5012
5012
  showControls,
5013
- legendItems: LEGEND_ITEMS$G,
5013
+ legendItems: LEGEND_ITEMS$H,
5014
5014
  code: showCode ? algorithmCode : void 0,
5015
5015
  currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
5016
5016
  codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
@@ -5065,7 +5065,7 @@ const ASTAR_CODE = [
5065
5065
  " openSet.add(neighbor)",
5066
5066
  " return failure"
5067
5067
  ];
5068
- const LEGEND_ITEMS$F = [
5068
+ const LEGEND_ITEMS$G = [
5069
5069
  { color: "bg-green-500", label: "Start" },
5070
5070
  { color: "bg-red-500", label: "End" },
5071
5071
  { color: "bg-gray-700", label: "Wall" },
@@ -5074,7 +5074,7 @@ const LEGEND_ITEMS$F = [
5074
5074
  { color: "bg-yellow-400", label: "Current" },
5075
5075
  { color: "bg-purple-400", label: "Path" }
5076
5076
  ];
5077
- const BADGES$F = [
5077
+ const BADGES$G = [
5078
5078
  { label: "Time: O(E log V)", variant: "orange" },
5079
5079
  { label: "Optimal Path", variant: "orange" }
5080
5080
  ];
@@ -5374,7 +5374,7 @@ const AStarVisualizerComponent = ({
5374
5374
  {
5375
5375
  id: VISUALIZER_ID2,
5376
5376
  title: "A* Pathfinding",
5377
- badges: BADGES$F,
5377
+ badges: BADGES$G,
5378
5378
  gradient: "orange",
5379
5379
  className,
5380
5380
  minHeight: 400,
@@ -5398,7 +5398,7 @@ const AStarVisualizerComponent = ({
5398
5398
  accentColor: "orange"
5399
5399
  },
5400
5400
  showControls,
5401
- legendItems: LEGEND_ITEMS$F,
5401
+ legendItems: LEGEND_ITEMS$G,
5402
5402
  code: showCode ? ASTAR_CODE : void 0,
5403
5403
  currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
5404
5404
  codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
@@ -5443,14 +5443,14 @@ const TOPO_CODE = [
5443
5443
  ' return "Cycle detected!"',
5444
5444
  " return result"
5445
5445
  ];
5446
- const LEGEND_ITEMS$E = [
5446
+ const LEGEND_ITEMS$F = [
5447
5447
  { color: "bg-gray-100", label: "Unprocessed", border: "#d1d5db" },
5448
5448
  { color: "bg-blue-400", label: "In queue" },
5449
5449
  { color: "bg-amber-400", label: "Processing" },
5450
5450
  { color: "bg-green-400", label: "Sorted" },
5451
5451
  { color: "bg-purple-200", label: "Edge being processed" }
5452
5452
  ];
5453
- const BADGES$E = [
5453
+ const BADGES$F = [
5454
5454
  { label: "Time: O(V+E)", variant: "blue" },
5455
5455
  { label: "Kahn Algorithm", variant: "cyan" }
5456
5456
  ];
@@ -5758,7 +5758,7 @@ const TopologicalSortVisualizerComponent = ({
5758
5758
  {
5759
5759
  id: VISUALIZER_ID2,
5760
5760
  title: "Topological Sort",
5761
- badges: BADGES$E,
5761
+ badges: BADGES$F,
5762
5762
  gradient: "cyan",
5763
5763
  className,
5764
5764
  minHeight: 400,
@@ -5782,7 +5782,7 @@ const TopologicalSortVisualizerComponent = ({
5782
5782
  accentColor: "cyan"
5783
5783
  },
5784
5784
  showControls,
5785
- legendItems: LEGEND_ITEMS$E,
5785
+ legendItems: LEGEND_ITEMS$F,
5786
5786
  code: showCode ? TOPO_CODE : void 0,
5787
5787
  currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
5788
5788
  codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
@@ -5825,13 +5825,13 @@ const HASHMAP_CODE = [
5825
5825
  " return entry.value",
5826
5826
  " return null"
5827
5827
  ];
5828
- const LEGEND_ITEMS$D = [
5828
+ const LEGEND_ITEMS$E = [
5829
5829
  { color: "bg-blue-50", label: "Current bucket", border: "#60a5fa" },
5830
5830
  { color: "bg-blue-500", label: "Insert/Update" },
5831
5831
  { color: "bg-green-400", label: "Found" },
5832
5832
  { color: "bg-red-400", label: "Not found" }
5833
5833
  ];
5834
- const BADGES$D = [
5834
+ const BADGES$E = [
5835
5835
  { label: "Avg: O(1)", variant: "indigo" },
5836
5836
  { label: "Worst: O(n)", variant: "purple" }
5837
5837
  ];
@@ -6092,7 +6092,7 @@ const HashMapVisualizerComponent = ({
6092
6092
  {
6093
6093
  id: VISUALIZER_ID2,
6094
6094
  title: "HashMap Operations",
6095
- badges: BADGES$D,
6095
+ badges: BADGES$E,
6096
6096
  gradient: "indigo",
6097
6097
  onShare: handleShare,
6098
6098
  className,
@@ -6116,7 +6116,7 @@ const HashMapVisualizerComponent = ({
6116
6116
  accentColor: "indigo"
6117
6117
  },
6118
6118
  showControls,
6119
- legendItems: LEGEND_ITEMS$D,
6119
+ legendItems: LEGEND_ITEMS$E,
6120
6120
  code: showCode ? HASHMAP_CODE : void 0,
6121
6121
  currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
6122
6122
  codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
@@ -6165,7 +6165,7 @@ const LRU_CODE = [
6165
6165
  " addToHead(node)",
6166
6166
  " cache[key] = node"
6167
6167
  ];
6168
- const LEGEND_ITEMS$C = [
6168
+ const LEGEND_ITEMS$D = [
6169
6169
  { color: "bg-gray-100", label: "Cache entry", border: "#d1d5db" },
6170
6170
  { color: "bg-green-400", label: "Head (MRU)" },
6171
6171
  { color: "bg-red-400", label: "Tail (LRU)" },
@@ -6173,7 +6173,7 @@ const LEGEND_ITEMS$C = [
6173
6173
  { color: "bg-yellow-200", label: "Cache hit", border: "#fbbf24" },
6174
6174
  { color: "bg-purple-400", label: "Evicted" }
6175
6175
  ];
6176
- const BADGES$C = [
6176
+ const BADGES$D = [
6177
6177
  { label: "O(1) get/put", variant: "orange" },
6178
6178
  { label: "HashMap + DLL", variant: "orange" }
6179
6179
  ];
@@ -6526,7 +6526,7 @@ const LRUCacheVisualizerComponent = ({
6526
6526
  {
6527
6527
  id: VISUALIZER_ID2,
6528
6528
  title: "LRU Cache",
6529
- badges: BADGES$C,
6529
+ badges: BADGES$D,
6530
6530
  gradient: "orange",
6531
6531
  className,
6532
6532
  minHeight: 380,
@@ -6550,7 +6550,7 @@ const LRUCacheVisualizerComponent = ({
6550
6550
  accentColor: "orange"
6551
6551
  },
6552
6552
  showControls,
6553
- legendItems: LEGEND_ITEMS$C,
6553
+ legendItems: LEGEND_ITEMS$D,
6554
6554
  code: showCode ? LRU_CODE : void 0,
6555
6555
  currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
6556
6556
  codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
@@ -6560,9 +6560,9 @@ const LRUCacheVisualizerComponent = ({
6560
6560
  );
6561
6561
  };
6562
6562
  const LRUCacheVisualizer = React.memo(LRUCacheVisualizerComponent);
6563
- const VISUALIZER_ID$9 = "hashmap-interview-visualizer";
6563
+ const VISUALIZER_ID$a = "hashmap-interview-visualizer";
6564
6564
  const BUCKET_COUNT$1 = 8;
6565
- const BADGES$B = [
6565
+ const BADGES$C = [
6566
6566
  { label: "Interview Mode", variant: "purple" },
6567
6567
  { label: "O(1) avg", variant: "green" },
6568
6568
  { label: "Hash Table", variant: "indigo" }
@@ -6576,7 +6576,7 @@ const OPERATIONS$l = [
6576
6576
  { op: "put", key: "Alice", value: 26 },
6577
6577
  { op: "get", key: "Frank" }
6578
6578
  ];
6579
- const LEGEND_ITEMS$B = [
6579
+ const LEGEND_ITEMS$C = [
6580
6580
  { color: "bg-blue-50", label: "Current bucket", border: "#60a5fa" },
6581
6581
  { color: "bg-blue-500", label: "Insert/Update" },
6582
6582
  { color: "bg-green-400", label: "Found" },
@@ -6798,7 +6798,7 @@ const HashMapInterviewVisualizerComponent = ({
6798
6798
  showControls = true,
6799
6799
  className = ""
6800
6800
  }) => {
6801
- const { copyUrlToClipboard } = useUrlState({ prefix: "hm-int", scrollToId: VISUALIZER_ID$9 });
6801
+ const { copyUrlToClipboard } = useUrlState({ prefix: "hm-int", scrollToId: VISUALIZER_ID$a });
6802
6802
  const [mode, setMode] = useState("visualize");
6803
6803
  const generateSteps = useMemo(() => generateHashMapSteps, []);
6804
6804
  const {
@@ -6902,9 +6902,9 @@ const HashMapInterviewVisualizerComponent = ({
6902
6902
  return /* @__PURE__ */ jsx(
6903
6903
  BaseVisualizerLayout,
6904
6904
  {
6905
- id: VISUALIZER_ID$9,
6905
+ id: VISUALIZER_ID$a,
6906
6906
  title: "HashMap (Interview Mode)",
6907
- badges: BADGES$B,
6907
+ badges: BADGES$C,
6908
6908
  gradient: "indigo",
6909
6909
  className,
6910
6910
  minHeight: 500,
@@ -6928,7 +6928,7 @@ const HashMapInterviewVisualizerComponent = ({
6928
6928
  accentColor: "indigo"
6929
6929
  },
6930
6930
  showControls,
6931
- legendItems: LEGEND_ITEMS$B,
6931
+ legendItems: LEGEND_ITEMS$C,
6932
6932
  sidePanel,
6933
6933
  children: visualization
6934
6934
  }
@@ -6945,10 +6945,10 @@ const OPERATIONS$k = [
6945
6945
  { op: "removeLast" },
6946
6946
  { op: "removeMiddle", index: 2 }
6947
6947
  ];
6948
- const BADGES$A = [
6948
+ const BADGES$B = [
6949
6949
  { label: "Comparison", variant: "blue" }
6950
6950
  ];
6951
- const LEGEND_ITEMS$A = [
6951
+ const LEGEND_ITEMS$B = [
6952
6952
  { color: "bg-blue-500", label: "ArrayList" },
6953
6953
  { color: "bg-green-500", label: "LinkedList" },
6954
6954
  { color: "bg-amber-400", label: "Current element" },
@@ -7443,7 +7443,7 @@ const ListComparisonVisualizerComponent = ({
7443
7443
  {
7444
7444
  id: VISUALIZER_ID2,
7445
7445
  title: "ArrayList vs LinkedList",
7446
- badges: BADGES$A,
7446
+ badges: BADGES$B,
7447
7447
  gradient: "blue",
7448
7448
  className,
7449
7449
  minHeight: 400,
@@ -7467,14 +7467,14 @@ const ListComparisonVisualizerComponent = ({
7467
7467
  accentColor: "blue"
7468
7468
  },
7469
7469
  showControls,
7470
- legendItems: LEGEND_ITEMS$A,
7470
+ legendItems: LEGEND_ITEMS$B,
7471
7471
  children: visualization
7472
7472
  }
7473
7473
  );
7474
7474
  };
7475
7475
  const ListComparisonVisualizer = React.memo(ListComparisonVisualizerComponent);
7476
- const VISUALIZER_ID$8 = "treeset-interview-visualizer";
7477
- const BADGES$z = [
7476
+ const VISUALIZER_ID$9 = "treeset-interview-visualizer";
7477
+ const BADGES$A = [
7478
7478
  { label: "Interview Mode", variant: "purple" },
7479
7479
  { label: "BST", variant: "green" },
7480
7480
  { label: "O(log n)", variant: "teal" }
@@ -7490,7 +7490,7 @@ const OPERATIONS$j = [
7490
7490
  { op: "contains", value: 40 },
7491
7491
  { op: "contains", value: 55 }
7492
7492
  ];
7493
- const LEGEND_ITEMS$z = [
7493
+ const LEGEND_ITEMS$A = [
7494
7494
  { color: "bg-yellow-100", label: "Path", border: "#facc15" },
7495
7495
  { color: "bg-green-500", label: "Current/Found" },
7496
7496
  { color: "bg-red-500", label: "Not found" }
@@ -7715,7 +7715,7 @@ const TreeSetInterviewVisualizerComponent = ({
7715
7715
  showControls = true,
7716
7716
  className = ""
7717
7717
  }) => {
7718
- const { copyUrlToClipboard } = useUrlState({ prefix: "ts-int", scrollToId: VISUALIZER_ID$8 });
7718
+ const { copyUrlToClipboard } = useUrlState({ prefix: "ts-int", scrollToId: VISUALIZER_ID$9 });
7719
7719
  const [mode, setMode] = useState("visualize");
7720
7720
  const generateSteps = useMemo(() => generateTreeSetSteps$1, []);
7721
7721
  const {
@@ -7859,9 +7859,9 @@ const TreeSetInterviewVisualizerComponent = ({
7859
7859
  return /* @__PURE__ */ jsx(
7860
7860
  BaseVisualizerLayout,
7861
7861
  {
7862
- id: VISUALIZER_ID$8,
7862
+ id: VISUALIZER_ID$9,
7863
7863
  title: "TreeSet / BST (Interview Mode)",
7864
- badges: BADGES$z,
7864
+ badges: BADGES$A,
7865
7865
  gradient: "green",
7866
7866
  className,
7867
7867
  minHeight: 500,
@@ -7885,19 +7885,19 @@ const TreeSetInterviewVisualizerComponent = ({
7885
7885
  accentColor: "green"
7886
7886
  },
7887
7887
  showControls,
7888
- legendItems: LEGEND_ITEMS$z,
7888
+ legendItems: LEGEND_ITEMS$A,
7889
7889
  sidePanel,
7890
7890
  children: visualization
7891
7891
  }
7892
7892
  );
7893
7893
  };
7894
7894
  const TreeSetInterviewVisualizer = React.memo(TreeSetInterviewVisualizerComponent);
7895
- const VISUALIZER_ID$7 = "sorting-interview-visualizer";
7896
- const INITIAL_ARRAY$1 = [64, 34, 25, 12, 22, 11, 90];
7897
- const BADGES$y = [
7895
+ const VISUALIZER_ID$8 = "sorting-interview-visualizer";
7896
+ const INITIAL_ARRAY$2 = [64, 34, 25, 12, 22, 11, 90];
7897
+ const BADGES$z = [
7898
7898
  { label: "O(n log n) avg", variant: "amber" }
7899
7899
  ];
7900
- const LEGEND_ITEMS$y = [
7900
+ const LEGEND_ITEMS$z = [
7901
7901
  { color: "bg-amber-400", label: "Comparing" },
7902
7902
  { color: "bg-red-400", label: "Swapping" },
7903
7903
  { color: "bg-green-400", label: "Sorted" },
@@ -8093,16 +8093,16 @@ const SortingInterviewVisualizerComponent = ({
8093
8093
  showControls = true,
8094
8094
  className = ""
8095
8095
  }) => {
8096
- const { copyUrlToClipboard } = useUrlState({ prefix: "sort-int", scrollToId: VISUALIZER_ID$7 });
8096
+ const { copyUrlToClipboard } = useUrlState({ prefix: "sort-int", scrollToId: VISUALIZER_ID$8 });
8097
8097
  const [mode, setMode] = useState("visualize");
8098
- const generateSteps = useMemo(() => () => generateQuickSortSteps(INITIAL_ARRAY$1), []);
8098
+ const generateSteps = useMemo(() => () => generateQuickSortSteps(INITIAL_ARRAY$2), []);
8099
8099
  const playback = useVisualizerPlayback({ generateSteps });
8100
8100
  const interview = useInterviewMode({
8101
8101
  questions: SORTING_QUESTIONS,
8102
8102
  shuffleQuestions: true
8103
8103
  });
8104
8104
  const stepData = playback.currentStepData || {
8105
- array: INITIAL_ARRAY$1,
8105
+ array: INITIAL_ARRAY$2,
8106
8106
  description: ""
8107
8107
  };
8108
8108
  const { array, comparing, swapping, sorted, pivot, description } = stepData;
@@ -8182,9 +8182,9 @@ const SortingInterviewVisualizerComponent = ({
8182
8182
  return /* @__PURE__ */ jsx(
8183
8183
  BaseVisualizerLayout,
8184
8184
  {
8185
- id: VISUALIZER_ID$7,
8185
+ id: VISUALIZER_ID$8,
8186
8186
  title: "QuickSort (Interview Mode)",
8187
- badges: BADGES$y,
8187
+ badges: BADGES$z,
8188
8188
  gradient: "orange",
8189
8189
  className,
8190
8190
  minHeight: 500,
@@ -8209,15 +8209,15 @@ const SortingInterviewVisualizerComponent = ({
8209
8209
  accentColor: "orange"
8210
8210
  },
8211
8211
  showControls,
8212
- legendItems: LEGEND_ITEMS$y,
8212
+ legendItems: LEGEND_ITEMS$z,
8213
8213
  sidePanel,
8214
8214
  children: visualization
8215
8215
  }
8216
8216
  );
8217
8217
  };
8218
8218
  const SortingInterviewVisualizer = React.memo(SortingInterviewVisualizerComponent);
8219
- const VISUALIZER_ID$6 = "graph-interview-visualizer";
8220
- const BADGES$x = [
8219
+ const VISUALIZER_ID$7 = "graph-interview-visualizer";
8220
+ const BADGES$y = [
8221
8221
  { label: "Interview Mode", variant: "purple" },
8222
8222
  { label: "BFS/DFS", variant: "blue" },
8223
8223
  { label: "O(V+E)", variant: "cyan" }
@@ -8240,7 +8240,7 @@ const EDGES$1 = [
8240
8240
  { from: "C", to: "G" },
8241
8241
  { from: "E", to: "F" }
8242
8242
  ];
8243
- const LEGEND_ITEMS$x = [
8243
+ const LEGEND_ITEMS$y = [
8244
8244
  { color: "bg-blue-500", label: "Current" },
8245
8245
  { color: "bg-green-400", label: "Visited" },
8246
8246
  { color: "bg-yellow-100", label: "In Queue/Stack", border: "#facc15" }
@@ -8466,7 +8466,7 @@ const GraphInterviewVisualizerComponent = ({
8466
8466
  className = ""
8467
8467
  }) => {
8468
8468
  var _a;
8469
- const { copyUrlToClipboard } = useUrlState({ prefix: "graph-int", scrollToId: VISUALIZER_ID$6 });
8469
+ const { copyUrlToClipboard } = useUrlState({ prefix: "graph-int", scrollToId: VISUALIZER_ID$7 });
8470
8470
  const [mode, setMode] = useState("visualize");
8471
8471
  const [algorithm, setAlgorithm] = useState("bfs");
8472
8472
  const generateSteps = useMemo(
@@ -8618,9 +8618,9 @@ const GraphInterviewVisualizerComponent = ({
8618
8618
  return /* @__PURE__ */ jsx(
8619
8619
  BaseVisualizerLayout,
8620
8620
  {
8621
- id: VISUALIZER_ID$6,
8621
+ id: VISUALIZER_ID$7,
8622
8622
  title: "Graph Traversal (Interview Mode)",
8623
- badges: BADGES$x,
8623
+ badges: BADGES$y,
8624
8624
  gradient: "blue",
8625
8625
  className,
8626
8626
  minHeight: 500,
@@ -8644,17 +8644,17 @@ const GraphInterviewVisualizerComponent = ({
8644
8644
  accentColor: "blue"
8645
8645
  },
8646
8646
  showControls,
8647
- legendItems: LEGEND_ITEMS$x,
8647
+ legendItems: LEGEND_ITEMS$y,
8648
8648
  sidePanel,
8649
8649
  children: visualization
8650
8650
  }
8651
8651
  );
8652
8652
  };
8653
8653
  const GraphInterviewVisualizer = React.memo(GraphInterviewVisualizerComponent);
8654
- const VISUALIZER_ID$5 = "bloomfilter-interview-visualizer";
8654
+ const VISUALIZER_ID$6 = "bloomfilter-interview-visualizer";
8655
8655
  const BIT_ARRAY_SIZE$1 = 16;
8656
8656
  const K_HASH_FUNCTIONS = 3;
8657
- const BADGES$w = [
8657
+ const BADGES$x = [
8658
8658
  { label: "Interview Mode", variant: "purple" },
8659
8659
  { label: "Probabilistic", variant: "pink" },
8660
8660
  { label: "No False Negatives", variant: "indigo" }
@@ -8667,7 +8667,7 @@ const OPERATIONS$i = [
8667
8667
  { op: "query", element: "grape" },
8668
8668
  { op: "query", element: "banana" }
8669
8669
  ];
8670
- const LEGEND_ITEMS$w = [
8670
+ const LEGEND_ITEMS$x = [
8671
8671
  { color: "bg-gray-200", label: "Bit = 0" },
8672
8672
  { color: "bg-purple-500", label: "Bit = 1" },
8673
8673
  { color: "bg-pink-400", label: "Current hash position" }
@@ -8876,7 +8876,7 @@ const BloomFilterInterviewVisualizerComponent = ({
8876
8876
  showControls = true,
8877
8877
  className = ""
8878
8878
  }) => {
8879
- const { copyUrlToClipboard } = useUrlState({ prefix: "bf-int", scrollToId: VISUALIZER_ID$5 });
8879
+ const { copyUrlToClipboard } = useUrlState({ prefix: "bf-int", scrollToId: VISUALIZER_ID$6 });
8880
8880
  const [mode, setMode] = useState("visualize");
8881
8881
  const generateSteps = useMemo(() => generateBloomFilterSteps$1, []);
8882
8882
  const {
@@ -8993,9 +8993,9 @@ const BloomFilterInterviewVisualizerComponent = ({
8993
8993
  return /* @__PURE__ */ jsx(
8994
8994
  BaseVisualizerLayout,
8995
8995
  {
8996
- id: VISUALIZER_ID$5,
8996
+ id: VISUALIZER_ID$6,
8997
8997
  title: "Bloom Filter (Interview Mode)",
8998
- badges: BADGES$w,
8998
+ badges: BADGES$x,
8999
8999
  gradient: "purple",
9000
9000
  className,
9001
9001
  minHeight: 500,
@@ -9020,16 +9020,16 @@ const BloomFilterInterviewVisualizerComponent = ({
9020
9020
  accentColor: "purple"
9021
9021
  },
9022
9022
  showControls,
9023
- legendItems: LEGEND_ITEMS$w,
9023
+ legendItems: LEGEND_ITEMS$x,
9024
9024
  sidePanel,
9025
9025
  children: visualization
9026
9026
  }
9027
9027
  );
9028
9028
  };
9029
9029
  const BloomFilterInterviewVisualizer = React.memo(BloomFilterInterviewVisualizerComponent);
9030
- const VISUALIZER_ID$4 = "btree-interview-visualizer";
9030
+ const VISUALIZER_ID$5 = "btree-interview-visualizer";
9031
9031
  const ORDER$1 = 3;
9032
- const BADGES$v = [
9032
+ const BADGES$w = [
9033
9033
  { label: "Interview Mode", variant: "purple" },
9034
9034
  { label: `Order ${ORDER$1}`, variant: "green" },
9035
9035
  { label: "O(log n)", variant: "teal" }
@@ -9043,7 +9043,7 @@ const OPERATIONS$h = [
9043
9043
  { op: "search", value: 15 },
9044
9044
  { op: "search", value: 12 }
9045
9045
  ];
9046
- const LEGEND_ITEMS$v = [
9046
+ const LEGEND_ITEMS$w = [
9047
9047
  { color: "bg-green-400", label: "Current node" },
9048
9048
  { color: "bg-amber-100", label: "Search path", border: "#fbbf24" },
9049
9049
  { color: "bg-blue-400", label: "Found/Inserted" }
@@ -9309,7 +9309,7 @@ const BTreeInterviewVisualizerComponent = ({
9309
9309
  showControls = true,
9310
9310
  className = ""
9311
9311
  }) => {
9312
- const { copyUrlToClipboard } = useUrlState({ prefix: "bt-int", scrollToId: VISUALIZER_ID$4 });
9312
+ const { copyUrlToClipboard } = useUrlState({ prefix: "bt-int", scrollToId: VISUALIZER_ID$5 });
9313
9313
  const [mode, setMode] = useState("visualize");
9314
9314
  const generateSteps = useMemo(() => generateBTreeSteps$1, []);
9315
9315
  const {
@@ -9446,9 +9446,9 @@ const BTreeInterviewVisualizerComponent = ({
9446
9446
  return /* @__PURE__ */ jsx(
9447
9447
  BaseVisualizerLayout,
9448
9448
  {
9449
- id: VISUALIZER_ID$4,
9449
+ id: VISUALIZER_ID$5,
9450
9450
  title: "B-Tree (Interview Mode)",
9451
- badges: BADGES$v,
9451
+ badges: BADGES$w,
9452
9452
  gradient: "green",
9453
9453
  className,
9454
9454
  minHeight: 500,
@@ -9473,17 +9473,17 @@ const BTreeInterviewVisualizerComponent = ({
9473
9473
  accentColor: "green"
9474
9474
  },
9475
9475
  showControls,
9476
- legendItems: LEGEND_ITEMS$v,
9476
+ legendItems: LEGEND_ITEMS$w,
9477
9477
  sidePanel,
9478
9478
  children: visualization
9479
9479
  }
9480
9480
  );
9481
9481
  };
9482
9482
  const BTreeInterviewVisualizer = React.memo(BTreeInterviewVisualizerComponent);
9483
- const BADGES$u = [
9483
+ const BADGES$v = [
9484
9484
  { label: "O((V+E) log V)", variant: "orange" }
9485
9485
  ];
9486
- const LEGEND_ITEMS$u = [
9486
+ const LEGEND_ITEMS$v = [
9487
9487
  { color: "bg-blue-100", label: "Unvisited", border: "#60a5fa" },
9488
9488
  { color: "bg-amber-400", label: "Current" },
9489
9489
  { color: "bg-green-400", label: "Visited" }
@@ -9842,7 +9842,7 @@ const DijkstraInterviewVisualizerComponent = ({
9842
9842
  {
9843
9843
  id: VISUALIZER_ID2,
9844
9844
  title: "Dijkstra's Algorithm (Interview Mode)",
9845
- badges: BADGES$u,
9845
+ badges: BADGES$v,
9846
9846
  gradient: "orange",
9847
9847
  className,
9848
9848
  minHeight: 500,
@@ -9867,17 +9867,17 @@ const DijkstraInterviewVisualizerComponent = ({
9867
9867
  accentColor: "orange"
9868
9868
  },
9869
9869
  showControls,
9870
- legendItems: LEGEND_ITEMS$u,
9870
+ legendItems: LEGEND_ITEMS$v,
9871
9871
  sidePanel,
9872
9872
  children: visualization
9873
9873
  }
9874
9874
  );
9875
9875
  };
9876
9876
  const DijkstraInterviewVisualizer = React.memo(DijkstraInterviewVisualizerComponent);
9877
- const BADGES$t = [
9877
+ const BADGES$u = [
9878
9878
  { label: "O(n×W)", variant: "cyan" }
9879
9879
  ];
9880
- const LEGEND_ITEMS$t = [
9880
+ const LEGEND_ITEMS$u = [
9881
9881
  { color: "bg-gray-50", label: "Not computed", border: "#d1d5db" },
9882
9882
  { color: "bg-blue-100", label: "Computed" },
9883
9883
  { color: "bg-green-400", label: "Take item" },
@@ -10234,7 +10234,7 @@ const DPInterviewVisualizerComponent = ({
10234
10234
  {
10235
10235
  id: VISUALIZER_ID2,
10236
10236
  title: "0/1 Knapsack (DP)",
10237
- badges: BADGES$t,
10237
+ badges: BADGES$u,
10238
10238
  gradient: "cyan",
10239
10239
  className,
10240
10240
  minHeight: 400,
@@ -10259,17 +10259,17 @@ const DPInterviewVisualizerComponent = ({
10259
10259
  accentColor: "cyan"
10260
10260
  },
10261
10261
  showControls,
10262
- legendItems: LEGEND_ITEMS$t,
10262
+ legendItems: LEGEND_ITEMS$u,
10263
10263
  sidePanel,
10264
10264
  children: visualization
10265
10265
  }
10266
10266
  );
10267
10267
  };
10268
10268
  const DPInterviewVisualizer = React.memo(DPInterviewVisualizerComponent);
10269
- const BADGES$s = [
10269
+ const BADGES$t = [
10270
10270
  { label: "Distributed Systems", variant: "cyan" }
10271
10271
  ];
10272
- const LEGEND_ITEMS$s = [
10272
+ const LEGEND_ITEMS$t = [
10273
10273
  { color: "bg-blue-500", label: "Server A" },
10274
10274
  { color: "bg-green-500", label: "Server B" },
10275
10275
  { color: "bg-purple-500", label: "Server C" },
@@ -10682,7 +10682,7 @@ const ConsistentHashingInterviewVisualizerComponent = ({
10682
10682
  {
10683
10683
  id: VISUALIZER_ID2,
10684
10684
  title: "Consistent Hashing (Interview Mode)",
10685
- badges: BADGES$s,
10685
+ badges: BADGES$t,
10686
10686
  gradient: "cyan",
10687
10687
  className,
10688
10688
  minHeight: 500,
@@ -10707,17 +10707,17 @@ const ConsistentHashingInterviewVisualizerComponent = ({
10707
10707
  accentColor: "cyan"
10708
10708
  },
10709
10709
  showControls,
10710
- legendItems: LEGEND_ITEMS$s,
10710
+ legendItems: LEGEND_ITEMS$t,
10711
10711
  sidePanel,
10712
10712
  children: visualization
10713
10713
  }
10714
10714
  );
10715
10715
  };
10716
10716
  const ConsistentHashingInterviewVisualizer = React.memo(ConsistentHashingInterviewVisualizerComponent);
10717
- const BADGES$r = [
10717
+ const BADGES$s = [
10718
10718
  { label: "Distributed Consensus", variant: "orange" }
10719
10719
  ];
10720
- const LEGEND_ITEMS$r = [
10720
+ const LEGEND_ITEMS$s = [
10721
10721
  { color: "bg-gray-400", label: "Follower" },
10722
10722
  { color: "bg-amber-500", label: "Candidate" },
10723
10723
  { color: "bg-green-500", label: "Leader" },
@@ -11147,7 +11147,7 @@ const RaftInterviewVisualizerComponent = ({
11147
11147
  {
11148
11148
  id: VISUALIZER_ID2,
11149
11149
  title: "Raft Consensus",
11150
- badges: BADGES$r,
11150
+ badges: BADGES$s,
11151
11151
  gradient: "orange",
11152
11152
  className,
11153
11153
  minHeight: 400,
@@ -11172,15 +11172,15 @@ const RaftInterviewVisualizerComponent = ({
11172
11172
  accentColor: "orange"
11173
11173
  },
11174
11174
  showControls,
11175
- legendItems: LEGEND_ITEMS$r,
11175
+ legendItems: LEGEND_ITEMS$s,
11176
11176
  sidePanel,
11177
11177
  children: visualization
11178
11178
  }
11179
11179
  );
11180
11180
  };
11181
11181
  const RaftInterviewVisualizer = React.memo(RaftInterviewVisualizerComponent);
11182
- const VISUALIZER_ID$3 = "trie-interview-visualizer";
11183
- const BADGES$q = [
11182
+ const VISUALIZER_ID$4 = "trie-interview-visualizer";
11183
+ const BADGES$r = [
11184
11184
  { label: "O(m) ops", variant: "cyan" }
11185
11185
  ];
11186
11186
  const OPERATIONS$g = [
@@ -11192,7 +11192,7 @@ const OPERATIONS$g = [
11192
11192
  { op: "search", word: "car" },
11193
11193
  { op: "prefix", word: "car" }
11194
11194
  ];
11195
- const LEGEND_ITEMS$q = [
11195
+ const LEGEND_ITEMS$r = [
11196
11196
  { color: "bg-gray-100", label: "Node", border: "#d1d5db" },
11197
11197
  { color: "bg-blue-200", label: "Current", border: "#60a5fa" },
11198
11198
  { color: "bg-green-400", label: "End of word" },
@@ -11527,7 +11527,7 @@ const TrieInterviewVisualizerComponent = ({
11527
11527
  showControls = true,
11528
11528
  className = ""
11529
11529
  }) => {
11530
- const { copyUrlToClipboard } = useUrlState({ prefix: "trie-int", scrollToId: VISUALIZER_ID$3 });
11530
+ const { copyUrlToClipboard } = useUrlState({ prefix: "trie-int", scrollToId: VISUALIZER_ID$4 });
11531
11531
  const [mode, setMode] = useState("visualize");
11532
11532
  const generateSteps = useMemo(() => generateTrieSteps$1, []);
11533
11533
  const playback = useVisualizerPlayback({ generateSteps });
@@ -11606,9 +11606,9 @@ const TrieInterviewVisualizerComponent = ({
11606
11606
  return /* @__PURE__ */ jsx(
11607
11607
  BaseVisualizerLayout,
11608
11608
  {
11609
- id: VISUALIZER_ID$3,
11609
+ id: VISUALIZER_ID$4,
11610
11610
  title: "Trie (Prefix Tree) - Interview Mode",
11611
- badges: BADGES$q,
11611
+ badges: BADGES$r,
11612
11612
  gradient: "cyan",
11613
11613
  className,
11614
11614
  minHeight: 500,
@@ -11633,16 +11633,16 @@ const TrieInterviewVisualizerComponent = ({
11633
11633
  accentColor: "cyan"
11634
11634
  },
11635
11635
  showControls,
11636
- legendItems: LEGEND_ITEMS$q,
11636
+ legendItems: LEGEND_ITEMS$r,
11637
11637
  sidePanel,
11638
11638
  children: visualization
11639
11639
  }
11640
11640
  );
11641
11641
  };
11642
11642
  const TrieInterviewVisualizer = React.memo(TrieInterviewVisualizerComponent);
11643
- const VISUALIZER_ID$2 = "unionfind-interview-visualizer";
11643
+ const VISUALIZER_ID$3 = "unionfind-interview-visualizer";
11644
11644
  const INITIAL_SIZE$2 = 8;
11645
- const BADGES$p = [
11645
+ const BADGES$q = [
11646
11646
  { label: "O(α(n))", variant: "purple" }
11647
11647
  ];
11648
11648
  const OPERATIONS$f = [
@@ -11655,7 +11655,7 @@ const OPERATIONS$f = [
11655
11655
  { op: "connected", a: 1, b: 3 },
11656
11656
  { op: "union", a: 0, b: 4 }
11657
11657
  ];
11658
- const LEGEND_ITEMS$p = [
11658
+ const LEGEND_ITEMS$q = [
11659
11659
  { color: "bg-gray-100", label: "Element", border: "#d1d5db" },
11660
11660
  { color: "bg-blue-200", label: "Current", border: "#60a5fa" },
11661
11661
  { color: "bg-green-400", label: "Root / Same set" }
@@ -11884,7 +11884,7 @@ const UnionFindInterviewVisualizerComponent = ({
11884
11884
  showControls = true,
11885
11885
  className = ""
11886
11886
  }) => {
11887
- const { copyUrlToClipboard } = useUrlState({ prefix: "uf-int", scrollToId: VISUALIZER_ID$2 });
11887
+ const { copyUrlToClipboard } = useUrlState({ prefix: "uf-int", scrollToId: VISUALIZER_ID$3 });
11888
11888
  const [mode, setMode] = useState("visualize");
11889
11889
  const generateSteps = useMemo(() => generateUnionFindSteps$1, []);
11890
11890
  const playback = useVisualizerPlayback({ generateSteps });
@@ -12007,9 +12007,9 @@ const UnionFindInterviewVisualizerComponent = ({
12007
12007
  return /* @__PURE__ */ jsx(
12008
12008
  BaseVisualizerLayout,
12009
12009
  {
12010
- id: VISUALIZER_ID$2,
12010
+ id: VISUALIZER_ID$3,
12011
12011
  title: "Union-Find (DSU) - Interview Mode",
12012
- badges: BADGES$p,
12012
+ badges: BADGES$q,
12013
12013
  gradient: "purple",
12014
12014
  className,
12015
12015
  minHeight: 500,
@@ -12034,14 +12034,14 @@ const UnionFindInterviewVisualizerComponent = ({
12034
12034
  accentColor: "purple"
12035
12035
  },
12036
12036
  showControls,
12037
- legendItems: LEGEND_ITEMS$p,
12037
+ legendItems: LEGEND_ITEMS$q,
12038
12038
  sidePanel,
12039
12039
  children: visualization
12040
12040
  }
12041
12041
  );
12042
12042
  };
12043
12043
  const UnionFindInterviewVisualizer = React.memo(UnionFindInterviewVisualizerComponent);
12044
- const VISUALIZER_ID$1 = "astar-interview-visualizer";
12044
+ const VISUALIZER_ID$2 = "astar-interview-visualizer";
12045
12045
  const GRID_ROWS = 6;
12046
12046
  const GRID_COLS = 8;
12047
12047
  const START = { row: 1, col: 1 };
@@ -12053,12 +12053,12 @@ const WALLS = [
12053
12053
  { row: 3, col: 5 },
12054
12054
  { row: 4, col: 5 }
12055
12055
  ];
12056
- const BADGES$o = [
12056
+ const BADGES$p = [
12057
12057
  { label: "Interview Mode", variant: "purple" },
12058
12058
  { label: "f = g + h", variant: "amber" },
12059
12059
  { label: "O(b^d)", variant: "orange" }
12060
12060
  ];
12061
- const LEGEND_ITEMS$o = [
12061
+ const LEGEND_ITEMS$p = [
12062
12062
  { color: "bg-green-500", label: "Start" },
12063
12063
  { color: "bg-red-500", label: "End" },
12064
12064
  { color: "bg-gray-700", label: "Wall" },
@@ -12312,7 +12312,7 @@ const AStarInterviewVisualizerComponent = ({
12312
12312
  showControls = true,
12313
12313
  className = ""
12314
12314
  }) => {
12315
- const { copyUrlToClipboard } = useUrlState({ prefix: "astar-int", scrollToId: VISUALIZER_ID$1 });
12315
+ const { copyUrlToClipboard } = useUrlState({ prefix: "astar-int", scrollToId: VISUALIZER_ID$2 });
12316
12316
  const [mode, setMode] = useState("visualize");
12317
12317
  const generateSteps = useMemo(() => generateAStarSteps, []);
12318
12318
  const {
@@ -12415,9 +12415,9 @@ const AStarInterviewVisualizerComponent = ({
12415
12415
  return /* @__PURE__ */ jsx(
12416
12416
  BaseVisualizerLayout,
12417
12417
  {
12418
- id: VISUALIZER_ID$1,
12418
+ id: VISUALIZER_ID$2,
12419
12419
  title: "A* Pathfinding (Interview Mode)",
12420
- badges: BADGES$o,
12420
+ badges: BADGES$p,
12421
12421
  gradient: "orange",
12422
12422
  className,
12423
12423
  minHeight: 500,
@@ -12442,14 +12442,14 @@ const AStarInterviewVisualizerComponent = ({
12442
12442
  accentColor: "orange"
12443
12443
  },
12444
12444
  showControls,
12445
- legendItems: LEGEND_ITEMS$o,
12445
+ legendItems: LEGEND_ITEMS$p,
12446
12446
  sidePanel,
12447
12447
  children: visualization
12448
12448
  }
12449
12449
  );
12450
12450
  };
12451
12451
  const AStarInterviewVisualizer = React.memo(AStarInterviewVisualizerComponent);
12452
- const BADGES$n = [
12452
+ const BADGES$o = [
12453
12453
  { label: "O(log n) avg", variant: "indigo" }
12454
12454
  ];
12455
12455
  const INITIAL_NODES = [
@@ -12460,7 +12460,7 @@ const INITIAL_NODES = [
12460
12460
  { value: 9, levels: 2 },
12461
12461
  { value: 12, levels: 1 }
12462
12462
  ];
12463
- const LEGEND_ITEMS$n = [
12463
+ const LEGEND_ITEMS$o = [
12464
12464
  { color: "bg-blue-100", label: "Node", border: "#60a5fa" },
12465
12465
  { color: "bg-amber-400", label: "Current" },
12466
12466
  { color: "bg-green-400", label: "Found" }
@@ -12746,7 +12746,7 @@ const SkipListInterviewVisualizerComponent = ({
12746
12746
  {
12747
12747
  id: VISUALIZER_ID2,
12748
12748
  title: "Skip List",
12749
- badges: BADGES$n,
12749
+ badges: BADGES$o,
12750
12750
  gradient: "indigo",
12751
12751
  className,
12752
12752
  minHeight: 260,
@@ -12771,21 +12771,21 @@ const SkipListInterviewVisualizerComponent = ({
12771
12771
  accentColor: "indigo"
12772
12772
  },
12773
12773
  showControls,
12774
- legendItems: LEGEND_ITEMS$n,
12774
+ legendItems: LEGEND_ITEMS$o,
12775
12775
  sidePanel,
12776
12776
  children: visualization
12777
12777
  }
12778
12778
  );
12779
12779
  };
12780
12780
  const SkipListInterviewVisualizer = React.memo(SkipListInterviewVisualizerComponent);
12781
- const VISUALIZER_ID = "linkedlist-interview-visualizer";
12782
- const BADGES$m = [
12781
+ const VISUALIZER_ID$1 = "linkedlist-interview-visualizer";
12782
+ const BADGES$n = [
12783
12783
  { label: "Interview Mode", variant: "purple" },
12784
12784
  { label: "O(1) insert", variant: "blue" },
12785
12785
  { label: "Linked List", variant: "cyan" }
12786
12786
  ];
12787
12787
  const INITIAL_VALUES = [10, 20, 30, 40, 50];
12788
- const LEGEND_ITEMS$m = [
12788
+ const LEGEND_ITEMS$n = [
12789
12789
  { color: "bg-blue-100", label: "Node", border: "#60a5fa" },
12790
12790
  { color: "bg-yellow-400", label: "Current" },
12791
12791
  { color: "bg-green-400", label: "Head" },
@@ -12957,7 +12957,7 @@ const LinkedListInterviewVisualizerComponent = ({
12957
12957
  showControls = true,
12958
12958
  className = ""
12959
12959
  }) => {
12960
- const { copyUrlToClipboard } = useUrlState({ prefix: "ll-int", scrollToId: VISUALIZER_ID });
12960
+ const { copyUrlToClipboard } = useUrlState({ prefix: "ll-int", scrollToId: VISUALIZER_ID$1 });
12961
12961
  const [mode, setMode] = useState("visualize");
12962
12962
  const generateSteps = useMemo(() => generateLinkedListSteps$1, []);
12963
12963
  const {
@@ -13044,9 +13044,9 @@ const LinkedListInterviewVisualizerComponent = ({
13044
13044
  return /* @__PURE__ */ jsx(
13045
13045
  BaseVisualizerLayout,
13046
13046
  {
13047
- id: VISUALIZER_ID,
13047
+ id: VISUALIZER_ID$1,
13048
13048
  title: "Linked List (Interview Mode)",
13049
- badges: BADGES$m,
13049
+ badges: BADGES$n,
13050
13050
  gradient: "blue",
13051
13051
  className,
13052
13052
  minHeight: 400,
@@ -13070,7 +13070,7 @@ const LinkedListInterviewVisualizerComponent = ({
13070
13070
  accentColor: "blue"
13071
13071
  },
13072
13072
  showControls,
13073
- legendItems: LEGEND_ITEMS$m,
13073
+ legendItems: LEGEND_ITEMS$n,
13074
13074
  sidePanel,
13075
13075
  children: visualization
13076
13076
  }
@@ -13098,13 +13098,13 @@ const HASH_TABLE_CODE = [
13098
13098
  " if loadFactor > threshold:",
13099
13099
  " rehash(newSize = size * 2)"
13100
13100
  ];
13101
- const LEGEND_ITEMS$l = [
13101
+ const LEGEND_ITEMS$m = [
13102
13102
  { color: "bg-gray-50", label: "Empty", border: "#d1d5db" },
13103
13103
  { color: "bg-yellow-50", label: "Hashing", border: "#facc15" },
13104
13104
  { color: "bg-red-50", label: "Collision", border: "#f87171" },
13105
13105
  { color: "bg-green-50", label: "Placed", border: "#4ade80" }
13106
13106
  ];
13107
- const BADGES$l = [
13107
+ const BADGES$m = [
13108
13108
  { label: "Avg: O(1)", variant: "purple" },
13109
13109
  { label: "Worst: O(n)", variant: "purple" }
13110
13110
  ];
@@ -13419,7 +13419,7 @@ const HashTableVisualizerComponent = ({
13419
13419
  {
13420
13420
  id: "hashtable-visualizer",
13421
13421
  title: "Hash Table (Chaining)",
13422
- badges: BADGES$l,
13422
+ badges: BADGES$m,
13423
13423
  gradient: "purple",
13424
13424
  className,
13425
13425
  minHeight: 400,
@@ -13443,7 +13443,7 @@ const HashTableVisualizerComponent = ({
13443
13443
  extraControls
13444
13444
  },
13445
13445
  showControls,
13446
- legendItems: LEGEND_ITEMS$l,
13446
+ legendItems: LEGEND_ITEMS$m,
13447
13447
  code: showCode ? HASH_TABLE_CODE : void 0,
13448
13448
  currentCodeLine: stepData == null ? void 0 : stepData.codeLine,
13449
13449
  codeVariables: stepData == null ? void 0 : stepData.variables,
@@ -13485,11 +13485,11 @@ const LINKEDLIST_CODE = [
13485
13485
  " node = node.next",
13486
13486
  " return node.value"
13487
13487
  ];
13488
- const LEGEND_ITEMS$k = [
13488
+ const LEGEND_ITEMS$l = [
13489
13489
  { color: "bg-white", label: "Node", border: "#d1d5db" },
13490
13490
  { color: "bg-blue-500", label: "Active" }
13491
13491
  ];
13492
- const BADGES$k = [
13492
+ const BADGES$l = [
13493
13493
  { label: "Ends: O(1)", variant: "blue" },
13494
13494
  { label: "Index: O(n)", variant: "indigo" }
13495
13495
  ];
@@ -13687,7 +13687,7 @@ const LinkedListVisualizerComponent = ({
13687
13687
  {
13688
13688
  id: VISUALIZER_ID2,
13689
13689
  title: "LinkedList Operations",
13690
- badges: BADGES$k,
13690
+ badges: BADGES$l,
13691
13691
  gradient: "blue",
13692
13692
  onShare: handleShare,
13693
13693
  className,
@@ -13711,7 +13711,7 @@ const LinkedListVisualizerComponent = ({
13711
13711
  accentColor: "blue"
13712
13712
  },
13713
13713
  showControls,
13714
- legendItems: LEGEND_ITEMS$k,
13714
+ legendItems: LEGEND_ITEMS$l,
13715
13715
  code: showCode ? LINKEDLIST_CODE : void 0,
13716
13716
  currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
13717
13717
  codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
@@ -13758,13 +13758,13 @@ const LINKEDHASHMAP_CODE = [
13758
13758
  " }",
13759
13759
  "}"
13760
13760
  ];
13761
- const LEGEND_ITEMS$j = [
13761
+ const LEGEND_ITEMS$k = [
13762
13762
  { color: "bg-blue-50", label: "Current bucket", border: "#60a5fa" },
13763
13763
  { color: "bg-blue-500", label: "Insert/Update" },
13764
13764
  { color: "bg-green-400", label: "Found" },
13765
13765
  { color: "bg-orange-400", label: "Linked list order" }
13766
13766
  ];
13767
- const BADGES$j = [
13767
+ const BADGES$k = [
13768
13768
  { label: "O(1) ops", variant: "orange" },
13769
13769
  { label: "Ordered", variant: "amber" }
13770
13770
  ];
@@ -14176,7 +14176,7 @@ const LinkedHashMapVisualizerComponent = ({
14176
14176
  {
14177
14177
  id: VISUALIZER_ID2,
14178
14178
  title: "LinkedHashMap",
14179
- badges: BADGES$j,
14179
+ badges: BADGES$k,
14180
14180
  gradient: "orange",
14181
14181
  onShare: handleShare,
14182
14182
  className,
@@ -14201,7 +14201,7 @@ const LinkedHashMapVisualizerComponent = ({
14201
14201
  accentColor: "orange"
14202
14202
  },
14203
14203
  showControls,
14204
- legendItems: LEGEND_ITEMS$j,
14204
+ legendItems: LEGEND_ITEMS$k,
14205
14205
  code: showCode ? LINKEDHASHMAP_CODE : void 0,
14206
14206
  currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
14207
14207
  codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
@@ -14242,13 +14242,13 @@ const ARRAYLIST_CODE = [
14242
14242
  " shift elements left",
14243
14243
  " size--"
14244
14244
  ];
14245
- const LEGEND_ITEMS$i = [
14245
+ const LEGEND_ITEMS$j = [
14246
14246
  { color: "bg-white border-gray-300", label: "Used", border: "#d1d5db" },
14247
14247
  { color: "bg-gray-100", label: "Empty" },
14248
14248
  { color: "bg-orange-500", label: "Active" },
14249
14249
  { color: "bg-yellow-200", label: "Shifted", border: "#fbbf24" }
14250
14250
  ];
14251
- const BADGES$i = [
14251
+ const BADGES$j = [
14252
14252
  { label: "Get: O(1)", variant: "orange" },
14253
14253
  { label: "Add: O(1)*", variant: "amber" }
14254
14254
  ];
@@ -14536,7 +14536,7 @@ const ArrayListVisualizerComponent = ({
14536
14536
  {
14537
14537
  id: VISUALIZER_ID2,
14538
14538
  title: "ArrayList Operations",
14539
- badges: BADGES$i,
14539
+ badges: BADGES$j,
14540
14540
  gradient: "orange",
14541
14541
  onShare: handleShare,
14542
14542
  className,
@@ -14560,7 +14560,7 @@ const ArrayListVisualizerComponent = ({
14560
14560
  accentColor: "orange"
14561
14561
  },
14562
14562
  showControls,
14563
- legendItems: LEGEND_ITEMS$i,
14563
+ legendItems: LEGEND_ITEMS$j,
14564
14564
  code: showCode ? ARRAYLIST_CODE : void 0,
14565
14565
  currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
14566
14566
  codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
@@ -14617,14 +14617,14 @@ const ARRAYDEQUE_CODE = [
14617
14617
  " }",
14618
14618
  "}"
14619
14619
  ];
14620
- const LEGEND_ITEMS$h = [
14620
+ const LEGEND_ITEMS$i = [
14621
14621
  { color: "bg-teal-500", label: "Head pointer" },
14622
14622
  { color: "bg-violet-500", label: "Tail pointer" },
14623
14623
  { color: "bg-green-400", label: "Added element" },
14624
14624
  { color: "bg-red-400", label: "Removed element" },
14625
14625
  { color: "bg-yellow-200", label: "Resize" }
14626
14626
  ];
14627
- const BADGES$h = [
14627
+ const BADGES$i = [
14628
14628
  { label: "O(1) all ops", variant: "teal" },
14629
14629
  { label: "Circular buffer", variant: "purple" }
14630
14630
  ];
@@ -14976,7 +14976,7 @@ const ArrayDequeVisualizerComponent = ({
14976
14976
  {
14977
14977
  id: VISUALIZER_ID2,
14978
14978
  title: "ArrayDeque",
14979
- badges: BADGES$h,
14979
+ badges: BADGES$i,
14980
14980
  gradient: "teal",
14981
14981
  onShare: handleShare,
14982
14982
  className,
@@ -15001,7 +15001,7 @@ const ArrayDequeVisualizerComponent = ({
15001
15001
  accentColor: "teal"
15002
15002
  },
15003
15003
  showControls,
15004
- legendItems: LEGEND_ITEMS$h,
15004
+ legendItems: LEGEND_ITEMS$i,
15005
15005
  code: showCode ? ARRAYDEQUE_CODE : void 0,
15006
15006
  currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
15007
15007
  codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
@@ -15042,13 +15042,13 @@ const TREESET_CODE = [
15042
15042
  " node = node.right",
15043
15043
  " else: return // duplicate"
15044
15044
  ];
15045
- const LEGEND_ITEMS$g = [
15045
+ const LEGEND_ITEMS$h = [
15046
15046
  { color: "bg-yellow-100", label: "Path", border: "#facc15" },
15047
15047
  { color: "bg-blue-500", label: "Current/Insert" },
15048
15048
  { color: "bg-green-500", label: "Found" },
15049
15049
  { color: "bg-red-500", label: "Not found" }
15050
15050
  ];
15051
- const BADGES$g = [
15051
+ const BADGES$h = [
15052
15052
  { label: "Avg: O(log n)", variant: "green" },
15053
15053
  { label: "Worst: O(n)", variant: "amber" }
15054
15054
  ];
@@ -15414,7 +15414,7 @@ const TreeSetVisualizerComponent = ({
15414
15414
  {
15415
15415
  id: VISUALIZER_ID2,
15416
15416
  title: "TreeSet Operations (BST)",
15417
- badges: BADGES$g,
15417
+ badges: BADGES$h,
15418
15418
  gradient: "green",
15419
15419
  className,
15420
15420
  minHeight: 400,
@@ -15438,7 +15438,7 @@ const TreeSetVisualizerComponent = ({
15438
15438
  accentColor: "green"
15439
15439
  },
15440
15440
  showControls,
15441
- legendItems: LEGEND_ITEMS$g,
15441
+ legendItems: LEGEND_ITEMS$h,
15442
15442
  code: showCode ? TREESET_CODE : void 0,
15443
15443
  currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
15444
15444
  codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
@@ -15490,13 +15490,13 @@ const ENUMSET_CODE = [
15490
15490
  " }",
15491
15491
  "}"
15492
15492
  ];
15493
- const LEGEND_ITEMS$f = [
15493
+ const LEGEND_ITEMS$g = [
15494
15494
  { color: "bg-green-500", label: "Bit set (1)" },
15495
15495
  { color: "bg-gray-200", label: "Bit clear (0)" },
15496
15496
  { color: "bg-blue-500", label: "Current operation" },
15497
15497
  { color: "bg-yellow-400", label: "Changed bit" }
15498
15498
  ];
15499
- const BADGES$f = [
15499
+ const BADGES$g = [
15500
15500
  { label: "O(1) all ops", variant: "green" },
15501
15501
  { label: "Memory efficient", variant: "green" }
15502
15502
  ];
@@ -15765,7 +15765,7 @@ const EnumSetVisualizerComponent = ({
15765
15765
  {
15766
15766
  id: VISUALIZER_ID2,
15767
15767
  title: "EnumSet Bit Operations",
15768
- badges: BADGES$f,
15768
+ badges: BADGES$g,
15769
15769
  gradient: "green",
15770
15770
  onShare: handleShare,
15771
15771
  className,
@@ -15790,7 +15790,7 @@ const EnumSetVisualizerComponent = ({
15790
15790
  accentColor: "green"
15791
15791
  },
15792
15792
  showControls,
15793
- legendItems: LEGEND_ITEMS$f,
15793
+ legendItems: LEGEND_ITEMS$g,
15794
15794
  code: showCode ? ENUMSET_CODE : void 0,
15795
15795
  currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
15796
15796
  codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
@@ -15811,7 +15811,7 @@ const OPERATIONS$8 = [
15811
15811
  { op: "poll" },
15812
15812
  { op: "offer", value: 15 }
15813
15813
  ];
15814
- const HEAP_CODE = [
15814
+ const HEAP_CODE$1 = [
15815
15815
  "offer(value):",
15816
15816
  " heap.add(value)",
15817
15817
  " siftUp(size - 1)",
@@ -15829,18 +15829,18 @@ const HEAP_CODE = [
15829
15829
  " siftDown(0)",
15830
15830
  " return result"
15831
15831
  ];
15832
- const LEGEND_ITEMS$e = [
15832
+ const LEGEND_ITEMS$f = [
15833
15833
  { color: "bg-purple-100", label: "Root (min)", border: "#c4b5fd" },
15834
15834
  { color: "bg-purple-500", label: "Active" },
15835
15835
  { color: "bg-purple-200", label: "Sift Path", border: "#a78bfa" },
15836
15836
  { color: "bg-yellow-300", label: "Comparing" },
15837
15837
  { color: "bg-green-400", label: "Swapped" }
15838
15838
  ];
15839
- const BADGES$e = [
15839
+ const BADGES$f = [
15840
15840
  { label: "offer: O(log n)", variant: "purple" },
15841
15841
  { label: "poll: O(log n)", variant: "purple" }
15842
15842
  ];
15843
- function generateHeapSteps() {
15843
+ function generateHeapSteps$1() {
15844
15844
  const steps = [];
15845
15845
  const heap = [];
15846
15846
  steps.push({
@@ -16022,7 +16022,7 @@ function generateHeapSteps() {
16022
16022
  });
16023
16023
  return steps;
16024
16024
  }
16025
- function getTreePositions(size) {
16025
+ function getTreePositions$1(size) {
16026
16026
  const positions = [];
16027
16027
  const width = 280;
16028
16028
  for (let i = 0; i < size; i++) {
@@ -16046,7 +16046,7 @@ const PriorityQueueVisualizerComponent = ({ showControls = true, showCode = true
16046
16046
  const playingRef = useRef(false);
16047
16047
  const timeoutRef = useRef(null);
16048
16048
  const initialize = useCallback(() => {
16049
- const newSteps = generateHeapSteps();
16049
+ const newSteps = generateHeapSteps$1();
16050
16050
  setSteps(newSteps);
16051
16051
  setCurrentStep(0);
16052
16052
  setIsPlaying(false);
@@ -16134,7 +16134,7 @@ const PriorityQueueVisualizerComponent = ({ showControls = true, showCode = true
16134
16134
  description: ""
16135
16135
  };
16136
16136
  const { heap, highlightIndex, swapIndices, compareIndices, description, siftPath, currentIndex } = currentStepData;
16137
- const positions = getTreePositions(heap.length);
16137
+ const positions = getTreePositions$1(heap.length);
16138
16138
  const getNodeStyle = (idx) => {
16139
16139
  if (idx === highlightIndex) {
16140
16140
  return "fill-purple-500 stroke-purple-600";
@@ -16310,7 +16310,7 @@ const PriorityQueueVisualizerComponent = ({ showControls = true, showCode = true
16310
16310
  {
16311
16311
  id: "priorityqueue-visualizer",
16312
16312
  title: "PriorityQueue (Min-Heap)",
16313
- badges: BADGES$e,
16313
+ badges: BADGES$f,
16314
16314
  gradient: "purple",
16315
16315
  className,
16316
16316
  minHeight: 400,
@@ -16333,8 +16333,8 @@ const PriorityQueueVisualizerComponent = ({ showControls = true, showCode = true
16333
16333
  accentColor: "purple"
16334
16334
  },
16335
16335
  showControls,
16336
- legendItems: LEGEND_ITEMS$e,
16337
- code: showCode ? HEAP_CODE : void 0,
16336
+ legendItems: LEGEND_ITEMS$f,
16337
+ code: showCode ? HEAP_CODE$1 : void 0,
16338
16338
  currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
16339
16339
  codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
16340
16340
  showCode,
@@ -16345,6 +16345,454 @@ const PriorityQueueVisualizerComponent = ({ showControls = true, showCode = true
16345
16345
  const PriorityQueueVisualizer = React.memo(
16346
16346
  PriorityQueueVisualizerComponent
16347
16347
  );
16348
+ const VISUALIZER_ID = "heap-visualizer";
16349
+ const INITIAL_ARRAY$1 = [4, 10, 3, 5, 1, 8, 7, 2, 9, 6];
16350
+ const BADGES$e = [
16351
+ { label: "Build: O(n)", variant: "orange" },
16352
+ { label: "Sort: O(n log n)", variant: "amber" }
16353
+ ];
16354
+ const HEAP_CODE = [
16355
+ "function buildMaxHeap(arr):",
16356
+ " n = arr.length",
16357
+ " # Start from last non-leaf node",
16358
+ " for i = n/2 - 1 down to 0:",
16359
+ " heapify(arr, n, i)",
16360
+ "",
16361
+ "function heapify(arr, n, i):",
16362
+ " largest = i",
16363
+ " left = 2*i + 1",
16364
+ " right = 2*i + 2",
16365
+ " if left < n and arr[left] > arr[largest]:",
16366
+ " largest = left",
16367
+ " if right < n and arr[right] > arr[largest]:",
16368
+ " largest = right",
16369
+ " if largest != i:",
16370
+ " swap(arr[i], arr[largest])",
16371
+ " heapify(arr, n, largest)",
16372
+ "",
16373
+ "function heapSort(arr):",
16374
+ " buildMaxHeap(arr)",
16375
+ " for i = n-1 down to 1:",
16376
+ " swap(arr[0], arr[i]) # Move max to end",
16377
+ " heapify(arr, i, 0) # Restore heap"
16378
+ ];
16379
+ const LEGEND_ITEMS$e = [
16380
+ { color: "bg-orange-500", label: "Root (max)" },
16381
+ { color: "bg-amber-400", label: "Comparing" },
16382
+ { color: "bg-green-400", label: "Swapped" },
16383
+ { color: "bg-blue-200", label: "Current node", border: "#60a5fa" },
16384
+ { color: "bg-gray-300", label: "Sorted portion" }
16385
+ ];
16386
+ function generateHeapSteps(initialArray) {
16387
+ const steps = [];
16388
+ const arr = [...initialArray];
16389
+ const n = arr.length;
16390
+ steps.push({
16391
+ operation: "init",
16392
+ array: [...arr],
16393
+ heapSize: n,
16394
+ description: `Initial array: [${arr.join(", ")}]. Will build max-heap then sort.`,
16395
+ codeLine: -1,
16396
+ phase: "build"
16397
+ });
16398
+ steps.push({
16399
+ operation: "buildHeap",
16400
+ array: [...arr],
16401
+ heapSize: n,
16402
+ description: `Build Max-Heap: Start from last non-leaf node (index ${Math.floor(n / 2) - 1})`,
16403
+ codeLine: 3,
16404
+ variables: { n, "start": Math.floor(n / 2) - 1 },
16405
+ phase: "build"
16406
+ });
16407
+ for (let i = Math.floor(n / 2) - 1; i >= 0; i--) {
16408
+ heapifyWithSteps(arr, n, i, steps, "build");
16409
+ }
16410
+ steps.push({
16411
+ operation: "buildHeap",
16412
+ array: [...arr],
16413
+ heapSize: n,
16414
+ description: `✓ Max-Heap built! Root (${arr[0]}) is the maximum element.`,
16415
+ codeLine: 4,
16416
+ phase: "build"
16417
+ });
16418
+ steps.push({
16419
+ operation: "heapSort",
16420
+ array: [...arr],
16421
+ heapSize: n,
16422
+ description: "HeapSort: Extract max elements one by one",
16423
+ codeLine: 18,
16424
+ phase: "sort"
16425
+ });
16426
+ const sorted = [];
16427
+ for (let i = n - 1; i > 0; i--) {
16428
+ steps.push({
16429
+ operation: "extract",
16430
+ array: [...arr],
16431
+ heapSize: i + 1,
16432
+ sortedPortion: [...sorted],
16433
+ highlightIndex: 0,
16434
+ description: `Extract max: Move ${arr[0]} (root) to position ${i}`,
16435
+ codeLine: 21,
16436
+ variables: { max: arr[0], position: i },
16437
+ phase: "sort"
16438
+ });
16439
+ [arr[0], arr[i]] = [arr[i], arr[0]];
16440
+ sorted.unshift(i);
16441
+ steps.push({
16442
+ operation: "extract",
16443
+ array: [...arr],
16444
+ heapSize: i,
16445
+ sortedPortion: [...sorted],
16446
+ swapIndices: [0, i],
16447
+ description: `Swapped! ${arr[i]} is now in final sorted position. Heap size reduced to ${i}.`,
16448
+ codeLine: 21,
16449
+ variables: { "sorted": arr[i] },
16450
+ phase: "sort"
16451
+ });
16452
+ if (i > 1) {
16453
+ heapifyWithSteps(arr, i, 0, steps, "sort", sorted);
16454
+ }
16455
+ }
16456
+ sorted.unshift(0);
16457
+ steps.push({
16458
+ operation: "done",
16459
+ array: [...arr],
16460
+ heapSize: 0,
16461
+ sortedPortion: Array.from({ length: n }, (_, i) => i),
16462
+ description: `✓ HeapSort complete! Array sorted: [${arr.join(", ")}]`,
16463
+ codeLine: -1,
16464
+ phase: "sort"
16465
+ });
16466
+ return steps;
16467
+ }
16468
+ function heapifyWithSteps(arr, heapSize, i, steps, phase, sortedPortion = []) {
16469
+ const left = 2 * i + 1;
16470
+ const right = 2 * i + 2;
16471
+ let largest = i;
16472
+ steps.push({
16473
+ operation: "heapify",
16474
+ array: [...arr],
16475
+ heapSize,
16476
+ sortedPortion: [...sortedPortion],
16477
+ highlightIndex: i,
16478
+ description: `heapify(${i}): Check node ${arr[i]} against children`,
16479
+ codeLine: 6,
16480
+ variables: { i, "arr[i]": arr[i], left, right },
16481
+ phase
16482
+ });
16483
+ if (left < heapSize) {
16484
+ steps.push({
16485
+ operation: "compare",
16486
+ array: [...arr],
16487
+ heapSize,
16488
+ sortedPortion: [...sortedPortion],
16489
+ compareIndices: [i, left],
16490
+ description: `Compare: ${arr[left]} (left) ${arr[left] > arr[largest] ? ">" : "≤"} ${arr[largest]} (current largest)`,
16491
+ codeLine: 10,
16492
+ variables: { left, "arr[left]": arr[left], largest, "arr[largest]": arr[largest] },
16493
+ phase
16494
+ });
16495
+ if (arr[left] > arr[largest]) {
16496
+ largest = left;
16497
+ }
16498
+ }
16499
+ if (right < heapSize) {
16500
+ steps.push({
16501
+ operation: "compare",
16502
+ array: [...arr],
16503
+ heapSize,
16504
+ sortedPortion: [...sortedPortion],
16505
+ compareIndices: [largest, right],
16506
+ description: `Compare: ${arr[right]} (right) ${arr[right] > arr[largest] ? ">" : "≤"} ${arr[largest]} (current largest)`,
16507
+ codeLine: 12,
16508
+ variables: { right, "arr[right]": arr[right], largest, "arr[largest]": arr[largest] },
16509
+ phase
16510
+ });
16511
+ if (arr[right] > arr[largest]) {
16512
+ largest = right;
16513
+ }
16514
+ }
16515
+ if (largest !== i) {
16516
+ steps.push({
16517
+ operation: "swap",
16518
+ array: [...arr],
16519
+ heapSize,
16520
+ sortedPortion: [...sortedPortion],
16521
+ swapIndices: [i, largest],
16522
+ description: `Swap: ${arr[i]} ↔ ${arr[largest]} (largest child)`,
16523
+ codeLine: 15,
16524
+ variables: { i, largest, "arr[i]": arr[i], "arr[largest]": arr[largest] },
16525
+ phase
16526
+ });
16527
+ [arr[i], arr[largest]] = [arr[largest], arr[i]];
16528
+ steps.push({
16529
+ operation: "swap",
16530
+ array: [...arr],
16531
+ heapSize,
16532
+ sortedPortion: [...sortedPortion],
16533
+ highlightIndex: largest,
16534
+ description: `Swapped! Continue heapify from index ${largest}`,
16535
+ codeLine: 16,
16536
+ variables: { "next": largest },
16537
+ phase
16538
+ });
16539
+ heapifyWithSteps(arr, heapSize, largest, steps, phase, sortedPortion);
16540
+ } else {
16541
+ steps.push({
16542
+ operation: "heapify",
16543
+ array: [...arr],
16544
+ heapSize,
16545
+ sortedPortion: [...sortedPortion],
16546
+ highlightIndex: i,
16547
+ description: `Node ${arr[i]} satisfies heap property (≥ both children)`,
16548
+ codeLine: 14,
16549
+ phase
16550
+ });
16551
+ }
16552
+ }
16553
+ function getTreePositions(size) {
16554
+ const positions = [];
16555
+ const width = 320;
16556
+ for (let i = 0; i < size; i++) {
16557
+ const level = Math.floor(Math.log2(i + 1));
16558
+ const levelStart = Math.pow(2, level) - 1;
16559
+ const posInLevel = i - levelStart;
16560
+ const nodesInLevel = Math.pow(2, level);
16561
+ const spacing = width / (nodesInLevel + 1);
16562
+ positions.push({
16563
+ x: spacing * (posInLevel + 1),
16564
+ y: level * 55 + 30
16565
+ });
16566
+ }
16567
+ return positions;
16568
+ }
16569
+ const HeapVisualizerComponent = ({
16570
+ showControls = true,
16571
+ showCode = true,
16572
+ className = ""
16573
+ }) => {
16574
+ const { copyUrlToClipboard } = useUrlState({ prefix: "heap", scrollToId: VISUALIZER_ID });
16575
+ const generateSteps = useMemo(() => () => generateHeapSteps(INITIAL_ARRAY$1), []);
16576
+ const {
16577
+ steps,
16578
+ currentStep,
16579
+ currentStepData,
16580
+ isPlaying,
16581
+ speed,
16582
+ setSpeed,
16583
+ handlePlayPause,
16584
+ handleStep,
16585
+ handleStepBack,
16586
+ handleReset
16587
+ } = useVisualizerPlayback({
16588
+ generateSteps
16589
+ });
16590
+ const stepData = currentStepData || {
16591
+ operation: "init",
16592
+ array: INITIAL_ARRAY$1,
16593
+ heapSize: INITIAL_ARRAY$1.length,
16594
+ description: ""
16595
+ };
16596
+ const { array, heapSize, sortedPortion, highlightIndex, compareIndices, swapIndices, description, phase } = stepData;
16597
+ const positions = getTreePositions(array.length);
16598
+ const getNodeStyle = (idx) => {
16599
+ if (sortedPortion == null ? void 0 : sortedPortion.includes(idx)) {
16600
+ return "fill-gray-300 stroke-gray-400";
16601
+ }
16602
+ if (swapIndices == null ? void 0 : swapIndices.includes(idx)) {
16603
+ return "fill-green-400 stroke-green-500";
16604
+ }
16605
+ if (compareIndices == null ? void 0 : compareIndices.includes(idx)) {
16606
+ return "fill-amber-400 stroke-amber-500";
16607
+ }
16608
+ if (idx === highlightIndex) {
16609
+ return "fill-blue-200 stroke-blue-400";
16610
+ }
16611
+ if (idx === 0 && idx < heapSize) {
16612
+ return "fill-orange-500 stroke-orange-600";
16613
+ }
16614
+ if (idx < heapSize) {
16615
+ return "fill-white stroke-gray-300";
16616
+ }
16617
+ return "fill-gray-200 stroke-gray-300";
16618
+ };
16619
+ const getTextColor = (idx) => {
16620
+ if (sortedPortion == null ? void 0 : sortedPortion.includes(idx)) return "#374151";
16621
+ if ((swapIndices == null ? void 0 : swapIndices.includes(idx)) || idx === 0 && idx < heapSize) return "white";
16622
+ return "#374151";
16623
+ };
16624
+ const getStatusVariant = () => {
16625
+ if (stepData.operation === "done") return "success";
16626
+ if (stepData.operation === "swap") return "warning";
16627
+ return "default";
16628
+ };
16629
+ const handleShare = useCallback(async () => {
16630
+ return copyUrlToClipboard({ step: currentStep });
16631
+ }, [copyUrlToClipboard, currentStep]);
16632
+ const visualization = /* @__PURE__ */ jsxs(Fragment, { children: [
16633
+ /* @__PURE__ */ jsxs("div", { className: "mb-4 p-4 bg-gradient-to-r from-orange-50 to-amber-50 rounded-xl border-2 border-orange-200", children: [
16634
+ /* @__PURE__ */ jsxs("div", { className: "text-sm font-bold text-orange-800 mb-2 flex items-center gap-2", children: [
16635
+ /* @__PURE__ */ jsx("span", { className: "text-lg", children: "🔺" }),
16636
+ " Max-Heap Property"
16637
+ ] }),
16638
+ /* @__PURE__ */ jsxs("div", { className: "font-mono text-sm bg-white rounded-lg p-3 border border-orange-200", children: [
16639
+ /* @__PURE__ */ jsx("div", { className: "text-center text-orange-700 font-bold mb-2", children: "heap[parent] ≥ heap[children]" }),
16640
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-3 gap-2 text-xs text-gray-600", children: [
16641
+ /* @__PURE__ */ jsxs("div", { className: "bg-orange-50 p-2 rounded text-center", children: [
16642
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "parent(i)" }),
16643
+ " = ⌊(i-1)/2⌋"
16644
+ ] }),
16645
+ /* @__PURE__ */ jsxs("div", { className: "bg-orange-50 p-2 rounded text-center", children: [
16646
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "left(i)" }),
16647
+ " = 2i + 1"
16648
+ ] }),
16649
+ /* @__PURE__ */ jsxs("div", { className: "bg-orange-50 p-2 rounded text-center", children: [
16650
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "right(i)" }),
16651
+ " = 2i + 2"
16652
+ ] })
16653
+ ] })
16654
+ ] }),
16655
+ /* @__PURE__ */ jsx("div", { className: "mt-3 p-2 bg-white rounded-lg border border-orange-200 min-h-[36px] flex items-center justify-center", children: /* @__PURE__ */ jsx("span", { className: `px-3 py-1 rounded-full text-xs font-medium ${phase === "build" ? "bg-orange-100 text-orange-700" : phase === "sort" ? "bg-amber-100 text-amber-700" : "bg-gray-100 text-gray-500"}`, children: phase === "build" ? "🔨 Building Max-Heap" : phase === "sort" ? "📊 HeapSort in progress" : "Ready" }) })
16656
+ ] }),
16657
+ /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
16658
+ /* @__PURE__ */ jsxs("div", { className: "text-sm font-medium text-gray-700 mb-2 flex items-center justify-between", children: [
16659
+ /* @__PURE__ */ jsxs("span", { children: [
16660
+ "Binary Max-Heap (size: ",
16661
+ heapSize,
16662
+ ")"
16663
+ ] }),
16664
+ sortedPortion && sortedPortion.length > 0 && /* @__PURE__ */ jsxs("span", { className: "text-xs text-gray-500", children: [
16665
+ "Sorted: ",
16666
+ sortedPortion.length,
16667
+ " elements"
16668
+ ] })
16669
+ ] }),
16670
+ /* @__PURE__ */ jsx("div", { className: "bg-gray-50 rounded-lg p-2 overflow-x-auto", children: /* @__PURE__ */ jsxs(
16671
+ "svg",
16672
+ {
16673
+ width: "320",
16674
+ height: Math.max(Math.floor(Math.log2(array.length)) * 55 + 80, 120),
16675
+ className: "mx-auto",
16676
+ children: [
16677
+ array.map((_, idx) => {
16678
+ if (idx === 0) return null;
16679
+ const parentIdx = Math.floor((idx - 1) / 2);
16680
+ const parentPos = positions[parentIdx];
16681
+ const childPos = positions[idx];
16682
+ if (!parentPos || !childPos) return null;
16683
+ const isSorted = (sortedPortion == null ? void 0 : sortedPortion.includes(idx)) || (sortedPortion == null ? void 0 : sortedPortion.includes(parentIdx));
16684
+ const isActive = (compareIndices == null ? void 0 : compareIndices.includes(idx)) && (compareIndices == null ? void 0 : compareIndices.includes(parentIdx)) || (swapIndices == null ? void 0 : swapIndices.includes(idx)) && (swapIndices == null ? void 0 : swapIndices.includes(parentIdx));
16685
+ return /* @__PURE__ */ jsx(
16686
+ "line",
16687
+ {
16688
+ x1: parentPos.x,
16689
+ y1: parentPos.y,
16690
+ x2: childPos.x,
16691
+ y2: childPos.y,
16692
+ stroke: isSorted ? "#d1d5db" : isActive ? "#f59e0b" : "#d1d5db",
16693
+ strokeWidth: isActive ? 3 : 1,
16694
+ strokeDasharray: idx >= heapSize ? "4,2" : void 0
16695
+ },
16696
+ `edge-${idx}`
16697
+ );
16698
+ }),
16699
+ array.map((val, idx) => {
16700
+ const pos = positions[idx];
16701
+ if (!pos) return null;
16702
+ return /* @__PURE__ */ jsxs("g", { transform: `translate(${pos.x}, ${pos.y})`, children: [
16703
+ /* @__PURE__ */ jsx(
16704
+ "circle",
16705
+ {
16706
+ r: "18",
16707
+ className: `${getNodeStyle(idx)} stroke-2 transition-colors`
16708
+ }
16709
+ ),
16710
+ /* @__PURE__ */ jsx(
16711
+ "text",
16712
+ {
16713
+ textAnchor: "middle",
16714
+ dy: "5",
16715
+ className: "text-xs font-bold",
16716
+ fill: getTextColor(idx),
16717
+ children: val
16718
+ }
16719
+ ),
16720
+ /* @__PURE__ */ jsxs(
16721
+ "text",
16722
+ {
16723
+ textAnchor: "middle",
16724
+ dy: "32",
16725
+ className: "text-[9px]",
16726
+ fill: "#9ca3af",
16727
+ children: [
16728
+ "[",
16729
+ idx,
16730
+ "]"
16731
+ ]
16732
+ }
16733
+ )
16734
+ ] }, idx);
16735
+ })
16736
+ ]
16737
+ }
16738
+ ) })
16739
+ ] }),
16740
+ /* @__PURE__ */ jsxs("div", { className: "mb-4 p-3 bg-gray-100 rounded-lg", children: [
16741
+ /* @__PURE__ */ jsxs("div", { className: "text-xs text-gray-600 mb-2 font-medium", children: [
16742
+ "Array representation (heap size: ",
16743
+ heapSize,
16744
+ ")"
16745
+ ] }),
16746
+ /* @__PURE__ */ jsx("div", { className: "flex gap-1 overflow-x-auto", children: array.map((val, idx) => /* @__PURE__ */ jsx(
16747
+ "div",
16748
+ {
16749
+ className: `w-8 h-8 flex items-center justify-center rounded text-xs font-mono transition-colors ${(sortedPortion == null ? void 0 : sortedPortion.includes(idx)) ? "bg-gray-300 text-gray-600" : (swapIndices == null ? void 0 : swapIndices.includes(idx)) ? "bg-green-400 text-white" : (compareIndices == null ? void 0 : compareIndices.includes(idx)) ? "bg-amber-400 text-white" : idx === highlightIndex ? "bg-blue-200 text-blue-700 ring-2 ring-blue-400" : idx === 0 && idx < heapSize ? "bg-orange-500 text-white" : idx < heapSize ? "bg-white border border-gray-300 text-gray-700" : "bg-gray-200 text-gray-400"}`,
16750
+ children: val
16751
+ },
16752
+ idx
16753
+ )) }),
16754
+ /* @__PURE__ */ jsx("div", { className: "flex gap-1 mt-1", children: array.map((_, idx) => /* @__PURE__ */ jsx("div", { className: "w-8 text-center text-[9px] text-gray-400", children: idx }, idx)) })
16755
+ ] })
16756
+ ] });
16757
+ return /* @__PURE__ */ jsx(
16758
+ BaseVisualizerLayout,
16759
+ {
16760
+ id: VISUALIZER_ID,
16761
+ title: "Heap (Max-Heap & HeapSort)",
16762
+ badges: BADGES$e,
16763
+ gradient: "orange",
16764
+ className,
16765
+ minHeight: 450,
16766
+ onShare: handleShare,
16767
+ status: {
16768
+ description,
16769
+ currentStep,
16770
+ totalSteps: steps.length,
16771
+ variant: getStatusVariant()
16772
+ },
16773
+ controls: {
16774
+ isPlaying,
16775
+ currentStep,
16776
+ totalSteps: steps.length,
16777
+ speed,
16778
+ onPlayPause: handlePlayPause,
16779
+ onStep: handleStep,
16780
+ onStepBack: handleStepBack,
16781
+ onReset: handleReset,
16782
+ onSpeedChange: setSpeed,
16783
+ accentColor: "orange"
16784
+ },
16785
+ showControls,
16786
+ legendItems: LEGEND_ITEMS$e,
16787
+ code: showCode ? HEAP_CODE : void 0,
16788
+ currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
16789
+ codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
16790
+ showCode,
16791
+ children: visualization
16792
+ }
16793
+ );
16794
+ };
16795
+ const HeapVisualizer = React.memo(HeapVisualizerComponent);
16348
16796
  const SEGMENT_COUNT = 4;
16349
16797
  const OPERATIONS$7 = [
16350
16798
  { thread: "T1", op: "put", key: "Alice", value: 100 },
@@ -22373,6 +22821,7 @@ export {
22373
22821
  HashMapInterviewVisualizer,
22374
22822
  HashMapVisualizer,
22375
22823
  HashTableVisualizer,
22824
+ HeapVisualizer,
22376
22825
  HelpPanel,
22377
22826
  ImmutableCollectionsVisualizer,
22378
22827
  InterviewModePanel,