@tomaszjarosz/react-visualizers 0.4.13 → 0.4.14

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$L = [
2053
+ const LEGEND_ITEMS$M = [
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$J = [
2059
+ const BADGES$K = [
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$J,
2405
+ badges: BADGES$K,
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$L,
2432
+ legendItems: LEGEND_ITEMS$M,
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$K = [
2500
+ const LEGEND_ITEMS$L = [
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$K,
3323
+ legendItems: LEGEND_ITEMS$L,
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$I = [
3877
+ const BADGES$J = [
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$J = [
3894
+ const LEGEND_ITEMS$K = [
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$I,
4218
+ badges: BADGES$J,
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$J,
4242
+ legendItems: LEGEND_ITEMS$K,
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$H = [
4259
+ const BADGES$I = [
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$I = [
4273
+ const LEGEND_ITEMS$J = [
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$H,
4532
+ badges: BADGES$I,
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$I,
4556
+ legendItems: LEGEND_ITEMS$J,
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$H = [
4598
+ const LEGEND_ITEMS$I = [
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$H,
5013
+ legendItems: LEGEND_ITEMS$I,
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$G = [
5068
+ const LEGEND_ITEMS$H = [
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$G = [
5074
5074
  { color: "bg-yellow-400", label: "Current" },
5075
5075
  { color: "bg-purple-400", label: "Path" }
5076
5076
  ];
5077
- const BADGES$G = [
5077
+ const BADGES$H = [
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$G,
5377
+ badges: BADGES$H,
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$G,
5401
+ legendItems: LEGEND_ITEMS$H,
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$F = [
5446
+ const LEGEND_ITEMS$G = [
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$F = [
5453
+ const BADGES$G = [
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$F,
5761
+ badges: BADGES$G,
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$F,
5785
+ legendItems: LEGEND_ITEMS$G,
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,
@@ -5793,7 +5793,7 @@ const TopologicalSortVisualizerComponent = ({
5793
5793
  };
5794
5794
  const TopologicalSortVisualizer = React.memo(TopologicalSortVisualizerComponent);
5795
5795
  const BUCKET_COUNT$2 = 8;
5796
- const OPERATIONS$n = [
5796
+ const OPERATIONS$o = [
5797
5797
  { op: "put", key: "Alice", value: 25 },
5798
5798
  { op: "put", key: "Bob", value: 30 },
5799
5799
  { op: "put", key: "Charlie", value: 35 },
@@ -5825,13 +5825,13 @@ const HASHMAP_CODE = [
5825
5825
  " return entry.value",
5826
5826
  " return null"
5827
5827
  ];
5828
- const LEGEND_ITEMS$E = [
5828
+ const LEGEND_ITEMS$F = [
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$E = [
5834
+ const BADGES$F = [
5835
5835
  { label: "Avg: O(1)", variant: "indigo" },
5836
5836
  { label: "Worst: O(n)", variant: "purple" }
5837
5837
  ];
@@ -5854,7 +5854,7 @@ function generateHashMapSteps$1() {
5854
5854
  description: `Initialize HashMap with ${BUCKET_COUNT$2} buckets. Each bucket is a linked list for collision handling.`,
5855
5855
  codeLine: -1
5856
5856
  });
5857
- for (const { op, key, value } of OPERATIONS$n) {
5857
+ for (const { op, key, value } of OPERATIONS$o) {
5858
5858
  const hash = simpleHash$7(key);
5859
5859
  const index = hash % BUCKET_COUNT$2;
5860
5860
  if (op === "put") {
@@ -6092,7 +6092,7 @@ const HashMapVisualizerComponent = ({
6092
6092
  {
6093
6093
  id: VISUALIZER_ID2,
6094
6094
  title: "HashMap Operations",
6095
- badges: BADGES$E,
6095
+ badges: BADGES$F,
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$E,
6119
+ legendItems: LEGEND_ITEMS$F,
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,
@@ -6127,7 +6127,7 @@ const HashMapVisualizerComponent = ({
6127
6127
  };
6128
6128
  const HashMapVisualizer = React.memo(HashMapVisualizerComponent);
6129
6129
  const CAPACITY$1 = 3;
6130
- const OPERATIONS$m = [
6130
+ const OPERATIONS$n = [
6131
6131
  { op: "put", key: 1, value: "A" },
6132
6132
  { op: "put", key: 2, value: "B" },
6133
6133
  { op: "put", key: 3, value: "C" },
@@ -6165,7 +6165,7 @@ const LRU_CODE = [
6165
6165
  " addToHead(node)",
6166
6166
  " cache[key] = node"
6167
6167
  ];
6168
- const LEGEND_ITEMS$D = [
6168
+ const LEGEND_ITEMS$E = [
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$D = [
6173
6173
  { color: "bg-yellow-200", label: "Cache hit", border: "#fbbf24" },
6174
6174
  { color: "bg-purple-400", label: "Evicted" }
6175
6175
  ];
6176
- const BADGES$D = [
6176
+ const BADGES$E = [
6177
6177
  { label: "O(1) get/put", variant: "orange" },
6178
6178
  { label: "HashMap + DLL", variant: "orange" }
6179
6179
  ];
@@ -6251,7 +6251,7 @@ function generateLRUSteps() {
6251
6251
  nodes.delete(evictedKey);
6252
6252
  return evictedKey;
6253
6253
  };
6254
- for (const operation of OPERATIONS$m) {
6254
+ for (const operation of OPERATIONS$n) {
6255
6255
  if (operation.op === "get") {
6256
6256
  const key = operation.key;
6257
6257
  steps.push({
@@ -6526,7 +6526,7 @@ const LRUCacheVisualizerComponent = ({
6526
6526
  {
6527
6527
  id: VISUALIZER_ID2,
6528
6528
  title: "LRU Cache",
6529
- badges: BADGES$D,
6529
+ badges: BADGES$E,
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$D,
6553
+ legendItems: LEGEND_ITEMS$E,
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,14 +6560,14 @@ const LRUCacheVisualizerComponent = ({
6560
6560
  );
6561
6561
  };
6562
6562
  const LRUCacheVisualizer = React.memo(LRUCacheVisualizerComponent);
6563
- const VISUALIZER_ID$a = "hashmap-interview-visualizer";
6563
+ const VISUALIZER_ID$b = "hashmap-interview-visualizer";
6564
6564
  const BUCKET_COUNT$1 = 8;
6565
- const BADGES$C = [
6565
+ const BADGES$D = [
6566
6566
  { label: "Interview Mode", variant: "purple" },
6567
6567
  { label: "O(1) avg", variant: "green" },
6568
6568
  { label: "Hash Table", variant: "indigo" }
6569
6569
  ];
6570
- const OPERATIONS$l = [
6570
+ const OPERATIONS$m = [
6571
6571
  { op: "put", key: "Alice", value: 25 },
6572
6572
  { op: "put", key: "Bob", value: 30 },
6573
6573
  { op: "put", key: "Charlie", value: 35 },
@@ -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$C = [
6579
+ const LEGEND_ITEMS$D = [
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" },
@@ -6705,7 +6705,7 @@ function generateHashMapSteps() {
6705
6705
  buckets: buckets.map((b) => ({ entries: [...b.entries] })),
6706
6706
  description: `Initialize HashMap with ${BUCKET_COUNT$1} buckets`
6707
6707
  });
6708
- for (const { op, key, value } of OPERATIONS$l) {
6708
+ for (const { op, key, value } of OPERATIONS$m) {
6709
6709
  const hash = simpleHash$6(key);
6710
6710
  const index = hash % BUCKET_COUNT$1;
6711
6711
  if (op === "put") {
@@ -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$a });
6801
+ const { copyUrlToClipboard } = useUrlState({ prefix: "hm-int", scrollToId: VISUALIZER_ID$b });
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$a,
6905
+ id: VISUALIZER_ID$b,
6906
6906
  title: "HashMap (Interview Mode)",
6907
- badges: BADGES$C,
6907
+ badges: BADGES$D,
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$C,
6931
+ legendItems: LEGEND_ITEMS$D,
6932
6932
  sidePanel,
6933
6933
  children: visualization
6934
6934
  }
@@ -6936,7 +6936,7 @@ const HashMapInterviewVisualizerComponent = ({
6936
6936
  };
6937
6937
  const HashMapInterviewVisualizer = React.memo(HashMapInterviewVisualizerComponent);
6938
6938
  const INITIAL_DATA = [10, 20, 30, 40, 50];
6939
- const OPERATIONS$k = [
6939
+ const OPERATIONS$l = [
6940
6940
  { op: "get", index: 2 },
6941
6941
  { op: "addLast", value: 60 },
6942
6942
  { op: "addFirst", value: 5 },
@@ -6945,10 +6945,10 @@ const OPERATIONS$k = [
6945
6945
  { op: "removeLast" },
6946
6946
  { op: "removeMiddle", index: 2 }
6947
6947
  ];
6948
- const BADGES$B = [
6948
+ const BADGES$C = [
6949
6949
  { label: "Comparison", variant: "blue" }
6950
6950
  ];
6951
- const LEGEND_ITEMS$B = [
6951
+ const LEGEND_ITEMS$C = [
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" },
@@ -6974,7 +6974,7 @@ function generateListComparisonSteps() {
6974
6974
  description: `Initialize both lists with [${INITIAL_DATA.join(", ")}]`,
6975
6975
  phase: "complete"
6976
6976
  });
6977
- for (const { op, index, value } of OPERATIONS$k) {
6977
+ for (const { op, index, value } of OPERATIONS$l) {
6978
6978
  switch (op) {
6979
6979
  case "get": {
6980
6980
  const idx = index;
@@ -7443,7 +7443,7 @@ const ListComparisonVisualizerComponent = ({
7443
7443
  {
7444
7444
  id: VISUALIZER_ID2,
7445
7445
  title: "ArrayList vs LinkedList",
7446
- badges: BADGES$B,
7446
+ badges: BADGES$C,
7447
7447
  gradient: "blue",
7448
7448
  className,
7449
7449
  minHeight: 400,
@@ -7467,19 +7467,19 @@ const ListComparisonVisualizerComponent = ({
7467
7467
  accentColor: "blue"
7468
7468
  },
7469
7469
  showControls,
7470
- legendItems: LEGEND_ITEMS$B,
7470
+ legendItems: LEGEND_ITEMS$C,
7471
7471
  children: visualization
7472
7472
  }
7473
7473
  );
7474
7474
  };
7475
7475
  const ListComparisonVisualizer = React.memo(ListComparisonVisualizerComponent);
7476
- const VISUALIZER_ID$9 = "treeset-interview-visualizer";
7477
- const BADGES$A = [
7476
+ const VISUALIZER_ID$a = "treeset-interview-visualizer";
7477
+ const BADGES$B = [
7478
7478
  { label: "Interview Mode", variant: "purple" },
7479
7479
  { label: "BST", variant: "green" },
7480
7480
  { label: "O(log n)", variant: "teal" }
7481
7481
  ];
7482
- const OPERATIONS$j = [
7482
+ const OPERATIONS$k = [
7483
7483
  { op: "add", value: 50 },
7484
7484
  { op: "add", value: 30 },
7485
7485
  { op: "add", value: 70 },
@@ -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$A = [
7493
+ const LEGEND_ITEMS$B = [
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" }
@@ -7654,7 +7654,7 @@ function generateTreeSetSteps$1() {
7654
7654
  path: [],
7655
7655
  description: "Initialize empty TreeSet (Binary Search Tree)"
7656
7656
  });
7657
- for (const { op, value } of OPERATIONS$j) {
7657
+ for (const { op, value } of OPERATIONS$k) {
7658
7658
  if (op === "add") {
7659
7659
  const path = tree ? findPath$1(tree, value) : [];
7660
7660
  if (tree) {
@@ -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$9 });
7718
+ const { copyUrlToClipboard } = useUrlState({ prefix: "ts-int", scrollToId: VISUALIZER_ID$a });
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$9,
7862
+ id: VISUALIZER_ID$a,
7863
7863
  title: "TreeSet / BST (Interview Mode)",
7864
- badges: BADGES$A,
7864
+ badges: BADGES$B,
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$A,
7888
+ legendItems: LEGEND_ITEMS$B,
7889
7889
  sidePanel,
7890
7890
  children: visualization
7891
7891
  }
7892
7892
  );
7893
7893
  };
7894
7894
  const TreeSetInterviewVisualizer = React.memo(TreeSetInterviewVisualizerComponent);
7895
- const VISUALIZER_ID$8 = "sorting-interview-visualizer";
7895
+ const VISUALIZER_ID$9 = "sorting-interview-visualizer";
7896
7896
  const INITIAL_ARRAY$2 = [64, 34, 25, 12, 22, 11, 90];
7897
- const BADGES$z = [
7897
+ const BADGES$A = [
7898
7898
  { label: "O(n log n) avg", variant: "amber" }
7899
7899
  ];
7900
- const LEGEND_ITEMS$z = [
7900
+ const LEGEND_ITEMS$A = [
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,7 +8093,7 @@ const SortingInterviewVisualizerComponent = ({
8093
8093
  showControls = true,
8094
8094
  className = ""
8095
8095
  }) => {
8096
- const { copyUrlToClipboard } = useUrlState({ prefix: "sort-int", scrollToId: VISUALIZER_ID$8 });
8096
+ const { copyUrlToClipboard } = useUrlState({ prefix: "sort-int", scrollToId: VISUALIZER_ID$9 });
8097
8097
  const [mode, setMode] = useState("visualize");
8098
8098
  const generateSteps = useMemo(() => () => generateQuickSortSteps(INITIAL_ARRAY$2), []);
8099
8099
  const playback = useVisualizerPlayback({ generateSteps });
@@ -8182,9 +8182,9 @@ const SortingInterviewVisualizerComponent = ({
8182
8182
  return /* @__PURE__ */ jsx(
8183
8183
  BaseVisualizerLayout,
8184
8184
  {
8185
- id: VISUALIZER_ID$8,
8185
+ id: VISUALIZER_ID$9,
8186
8186
  title: "QuickSort (Interview Mode)",
8187
- badges: BADGES$z,
8187
+ badges: BADGES$A,
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$z,
8212
+ legendItems: LEGEND_ITEMS$A,
8213
8213
  sidePanel,
8214
8214
  children: visualization
8215
8215
  }
8216
8216
  );
8217
8217
  };
8218
8218
  const SortingInterviewVisualizer = React.memo(SortingInterviewVisualizerComponent);
8219
- const VISUALIZER_ID$7 = "graph-interview-visualizer";
8220
- const BADGES$y = [
8219
+ const VISUALIZER_ID$8 = "graph-interview-visualizer";
8220
+ const BADGES$z = [
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$y = [
8243
+ const LEGEND_ITEMS$z = [
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$7 });
8469
+ const { copyUrlToClipboard } = useUrlState({ prefix: "graph-int", scrollToId: VISUALIZER_ID$8 });
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$7,
8621
+ id: VISUALIZER_ID$8,
8622
8622
  title: "Graph Traversal (Interview Mode)",
8623
- badges: BADGES$y,
8623
+ badges: BADGES$z,
8624
8624
  gradient: "blue",
8625
8625
  className,
8626
8626
  minHeight: 500,
@@ -8644,22 +8644,22 @@ const GraphInterviewVisualizerComponent = ({
8644
8644
  accentColor: "blue"
8645
8645
  },
8646
8646
  showControls,
8647
- legendItems: LEGEND_ITEMS$y,
8647
+ legendItems: LEGEND_ITEMS$z,
8648
8648
  sidePanel,
8649
8649
  children: visualization
8650
8650
  }
8651
8651
  );
8652
8652
  };
8653
8653
  const GraphInterviewVisualizer = React.memo(GraphInterviewVisualizerComponent);
8654
- const VISUALIZER_ID$6 = "bloomfilter-interview-visualizer";
8654
+ const VISUALIZER_ID$7 = "bloomfilter-interview-visualizer";
8655
8655
  const BIT_ARRAY_SIZE$1 = 16;
8656
8656
  const K_HASH_FUNCTIONS = 3;
8657
- const BADGES$x = [
8657
+ const BADGES$y = [
8658
8658
  { label: "Interview Mode", variant: "purple" },
8659
8659
  { label: "Probabilistic", variant: "pink" },
8660
8660
  { label: "No False Negatives", variant: "indigo" }
8661
8661
  ];
8662
- const OPERATIONS$i = [
8662
+ const OPERATIONS$j = [
8663
8663
  { op: "add", element: "apple" },
8664
8664
  { op: "add", element: "banana" },
8665
8665
  { op: "add", element: "cherry" },
@@ -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$x = [
8670
+ const LEGEND_ITEMS$y = [
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" }
@@ -8825,7 +8825,7 @@ function generateBloomFilterSteps$1() {
8825
8825
  bitArray: [...bitArray],
8826
8826
  description: `Initialize Bloom Filter: ${BIT_ARRAY_SIZE$1} bits, ${K_HASH_FUNCTIONS} hash functions`
8827
8827
  });
8828
- for (const { op, element } of OPERATIONS$i) {
8828
+ for (const { op, element } of OPERATIONS$j) {
8829
8829
  const positions = getHashPositions(element);
8830
8830
  if (op === "add") {
8831
8831
  steps.push({
@@ -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$6 });
8879
+ const { copyUrlToClipboard } = useUrlState({ prefix: "bf-int", scrollToId: VISUALIZER_ID$7 });
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$6,
8996
+ id: VISUALIZER_ID$7,
8997
8997
  title: "Bloom Filter (Interview Mode)",
8998
- badges: BADGES$x,
8998
+ badges: BADGES$y,
8999
8999
  gradient: "purple",
9000
9000
  className,
9001
9001
  minHeight: 500,
@@ -9020,21 +9020,21 @@ const BloomFilterInterviewVisualizerComponent = ({
9020
9020
  accentColor: "purple"
9021
9021
  },
9022
9022
  showControls,
9023
- legendItems: LEGEND_ITEMS$x,
9023
+ legendItems: LEGEND_ITEMS$y,
9024
9024
  sidePanel,
9025
9025
  children: visualization
9026
9026
  }
9027
9027
  );
9028
9028
  };
9029
9029
  const BloomFilterInterviewVisualizer = React.memo(BloomFilterInterviewVisualizerComponent);
9030
- const VISUALIZER_ID$5 = "btree-interview-visualizer";
9030
+ const VISUALIZER_ID$6 = "btree-interview-visualizer";
9031
9031
  const ORDER$1 = 3;
9032
- const BADGES$w = [
9032
+ const BADGES$x = [
9033
9033
  { label: "Interview Mode", variant: "purple" },
9034
9034
  { label: `Order ${ORDER$1}`, variant: "green" },
9035
9035
  { label: "O(log n)", variant: "teal" }
9036
9036
  ];
9037
- const OPERATIONS$h = [
9037
+ const OPERATIONS$i = [
9038
9038
  { op: "insert", value: 10 },
9039
9039
  { op: "insert", value: 20 },
9040
9040
  { op: "insert", value: 5 },
@@ -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$w = [
9046
+ const LEGEND_ITEMS$x = [
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" }
@@ -9235,7 +9235,7 @@ function generateBTreeSteps$1() {
9235
9235
  }
9236
9236
  return { node };
9237
9237
  }
9238
- for (const { op, value } of OPERATIONS$h) {
9238
+ for (const { op, value } of OPERATIONS$i) {
9239
9239
  if (op === "insert") {
9240
9240
  steps.push({
9241
9241
  operation: "insert",
@@ -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$5 });
9312
+ const { copyUrlToClipboard } = useUrlState({ prefix: "bt-int", scrollToId: VISUALIZER_ID$6 });
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$5,
9449
+ id: VISUALIZER_ID$6,
9450
9450
  title: "B-Tree (Interview Mode)",
9451
- badges: BADGES$w,
9451
+ badges: BADGES$x,
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$w,
9476
+ legendItems: LEGEND_ITEMS$x,
9477
9477
  sidePanel,
9478
9478
  children: visualization
9479
9479
  }
9480
9480
  );
9481
9481
  };
9482
9482
  const BTreeInterviewVisualizer = React.memo(BTreeInterviewVisualizerComponent);
9483
- const BADGES$v = [
9483
+ const BADGES$w = [
9484
9484
  { label: "O((V+E) log V)", variant: "orange" }
9485
9485
  ];
9486
- const LEGEND_ITEMS$v = [
9486
+ const LEGEND_ITEMS$w = [
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$v,
9845
+ badges: BADGES$w,
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$v,
9870
+ legendItems: LEGEND_ITEMS$w,
9871
9871
  sidePanel,
9872
9872
  children: visualization
9873
9873
  }
9874
9874
  );
9875
9875
  };
9876
9876
  const DijkstraInterviewVisualizer = React.memo(DijkstraInterviewVisualizerComponent);
9877
- const BADGES$u = [
9877
+ const BADGES$v = [
9878
9878
  { label: "O(n×W)", variant: "cyan" }
9879
9879
  ];
9880
- const LEGEND_ITEMS$u = [
9880
+ const LEGEND_ITEMS$v = [
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$u,
10237
+ badges: BADGES$v,
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$u,
10262
+ legendItems: LEGEND_ITEMS$v,
10263
10263
  sidePanel,
10264
10264
  children: visualization
10265
10265
  }
10266
10266
  );
10267
10267
  };
10268
10268
  const DPInterviewVisualizer = React.memo(DPInterviewVisualizerComponent);
10269
- const BADGES$t = [
10269
+ const BADGES$u = [
10270
10270
  { label: "Distributed Systems", variant: "cyan" }
10271
10271
  ];
10272
- const LEGEND_ITEMS$t = [
10272
+ const LEGEND_ITEMS$u = [
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$t,
10685
+ badges: BADGES$u,
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$t,
10710
+ legendItems: LEGEND_ITEMS$u,
10711
10711
  sidePanel,
10712
10712
  children: visualization
10713
10713
  }
10714
10714
  );
10715
10715
  };
10716
10716
  const ConsistentHashingInterviewVisualizer = React.memo(ConsistentHashingInterviewVisualizerComponent);
10717
- const BADGES$s = [
10717
+ const BADGES$t = [
10718
10718
  { label: "Distributed Consensus", variant: "orange" }
10719
10719
  ];
10720
- const LEGEND_ITEMS$s = [
10720
+ const LEGEND_ITEMS$t = [
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$s,
11150
+ badges: BADGES$t,
11151
11151
  gradient: "orange",
11152
11152
  className,
11153
11153
  minHeight: 400,
@@ -11172,18 +11172,18 @@ const RaftInterviewVisualizerComponent = ({
11172
11172
  accentColor: "orange"
11173
11173
  },
11174
11174
  showControls,
11175
- legendItems: LEGEND_ITEMS$s,
11175
+ legendItems: LEGEND_ITEMS$t,
11176
11176
  sidePanel,
11177
11177
  children: visualization
11178
11178
  }
11179
11179
  );
11180
11180
  };
11181
11181
  const RaftInterviewVisualizer = React.memo(RaftInterviewVisualizerComponent);
11182
- const VISUALIZER_ID$4 = "trie-interview-visualizer";
11183
- const BADGES$r = [
11182
+ const VISUALIZER_ID$5 = "trie-interview-visualizer";
11183
+ const BADGES$s = [
11184
11184
  { label: "O(m) ops", variant: "cyan" }
11185
11185
  ];
11186
- const OPERATIONS$g = [
11186
+ const OPERATIONS$h = [
11187
11187
  { op: "insert", word: "cat" },
11188
11188
  { op: "insert", word: "car" },
11189
11189
  { op: "insert", word: "card" },
@@ -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$r = [
11195
+ const LEGEND_ITEMS$s = [
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" },
@@ -11359,7 +11359,7 @@ function generateTrieSteps$1() {
11359
11359
  rootId,
11360
11360
  description: "Initialize empty Trie with root node"
11361
11361
  });
11362
- for (const { op, word } of OPERATIONS$g) {
11362
+ for (const { op, word } of OPERATIONS$h) {
11363
11363
  if (op === "insert") {
11364
11364
  let currentId = rootId;
11365
11365
  const path = [rootId];
@@ -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$4 });
11530
+ const { copyUrlToClipboard } = useUrlState({ prefix: "trie-int", scrollToId: VISUALIZER_ID$5 });
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$4,
11609
+ id: VISUALIZER_ID$5,
11610
11610
  title: "Trie (Prefix Tree) - Interview Mode",
11611
- badges: BADGES$r,
11611
+ badges: BADGES$s,
11612
11612
  gradient: "cyan",
11613
11613
  className,
11614
11614
  minHeight: 500,
@@ -11633,19 +11633,19 @@ const TrieInterviewVisualizerComponent = ({
11633
11633
  accentColor: "cyan"
11634
11634
  },
11635
11635
  showControls,
11636
- legendItems: LEGEND_ITEMS$r,
11636
+ legendItems: LEGEND_ITEMS$s,
11637
11637
  sidePanel,
11638
11638
  children: visualization
11639
11639
  }
11640
11640
  );
11641
11641
  };
11642
11642
  const TrieInterviewVisualizer = React.memo(TrieInterviewVisualizerComponent);
11643
- const VISUALIZER_ID$3 = "unionfind-interview-visualizer";
11643
+ const VISUALIZER_ID$4 = "unionfind-interview-visualizer";
11644
11644
  const INITIAL_SIZE$2 = 8;
11645
- const BADGES$q = [
11645
+ const BADGES$r = [
11646
11646
  { label: "O(α(n))", variant: "purple" }
11647
11647
  ];
11648
- const OPERATIONS$f = [
11648
+ const OPERATIONS$g = [
11649
11649
  { op: "union", a: 0, b: 1 },
11650
11650
  { op: "union", a: 2, b: 3 },
11651
11651
  { op: "union", a: 4, b: 5 },
@@ -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$q = [
11658
+ const LEGEND_ITEMS$r = [
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" }
@@ -11808,7 +11808,7 @@ function generateUnionFindSteps$1() {
11808
11808
  }
11809
11809
  return { root: current, path };
11810
11810
  };
11811
- for (const operation of OPERATIONS$f) {
11811
+ for (const operation of OPERATIONS$g) {
11812
11812
  if (operation.op === "find") {
11813
11813
  const x = operation.a;
11814
11814
  const { root, path } = find(x, true);
@@ -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$3 });
11887
+ const { copyUrlToClipboard } = useUrlState({ prefix: "uf-int", scrollToId: VISUALIZER_ID$4 });
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$3,
12010
+ id: VISUALIZER_ID$4,
12011
12011
  title: "Union-Find (DSU) - Interview Mode",
12012
- badges: BADGES$q,
12012
+ badges: BADGES$r,
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$q,
12037
+ legendItems: LEGEND_ITEMS$r,
12038
12038
  sidePanel,
12039
12039
  children: visualization
12040
12040
  }
12041
12041
  );
12042
12042
  };
12043
12043
  const UnionFindInterviewVisualizer = React.memo(UnionFindInterviewVisualizerComponent);
12044
- const VISUALIZER_ID$2 = "astar-interview-visualizer";
12044
+ const VISUALIZER_ID$3 = "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$p = [
12056
+ const BADGES$q = [
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$p = [
12061
+ const LEGEND_ITEMS$q = [
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$2 });
12315
+ const { copyUrlToClipboard } = useUrlState({ prefix: "astar-int", scrollToId: VISUALIZER_ID$3 });
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$2,
12418
+ id: VISUALIZER_ID$3,
12419
12419
  title: "A* Pathfinding (Interview Mode)",
12420
- badges: BADGES$p,
12420
+ badges: BADGES$q,
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$p,
12445
+ legendItems: LEGEND_ITEMS$q,
12446
12446
  sidePanel,
12447
12447
  children: visualization
12448
12448
  }
12449
12449
  );
12450
12450
  };
12451
12451
  const AStarInterviewVisualizer = React.memo(AStarInterviewVisualizerComponent);
12452
- const BADGES$o = [
12452
+ const BADGES$p = [
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$o = [
12463
+ const LEGEND_ITEMS$p = [
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$o,
12749
+ badges: BADGES$p,
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$o,
12774
+ legendItems: LEGEND_ITEMS$p,
12775
12775
  sidePanel,
12776
12776
  children: visualization
12777
12777
  }
12778
12778
  );
12779
12779
  };
12780
12780
  const SkipListInterviewVisualizer = React.memo(SkipListInterviewVisualizerComponent);
12781
- const VISUALIZER_ID$1 = "linkedlist-interview-visualizer";
12782
- const BADGES$n = [
12781
+ const VISUALIZER_ID$2 = "linkedlist-interview-visualizer";
12782
+ const BADGES$o = [
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$n = [
12788
+ const LEGEND_ITEMS$o = [
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$1 });
12960
+ const { copyUrlToClipboard } = useUrlState({ prefix: "ll-int", scrollToId: VISUALIZER_ID$2 });
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$1,
13047
+ id: VISUALIZER_ID$2,
13048
13048
  title: "Linked List (Interview Mode)",
13049
- badges: BADGES$n,
13049
+ badges: BADGES$o,
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$n,
13073
+ legendItems: LEGEND_ITEMS$o,
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$m = [
13101
+ const LEGEND_ITEMS$n = [
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$m = [
13107
+ const BADGES$n = [
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$m,
13422
+ badges: BADGES$n,
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$m,
13446
+ legendItems: LEGEND_ITEMS$n,
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,
@@ -13453,7 +13453,7 @@ const HashTableVisualizerComponent = ({
13453
13453
  );
13454
13454
  };
13455
13455
  const HashTableVisualizer = React.memo(HashTableVisualizerComponent);
13456
- const OPERATIONS$e = [
13456
+ const OPERATIONS$f = [
13457
13457
  { op: "addFirst", value: 10 },
13458
13458
  { op: "addLast", value: 20 },
13459
13459
  { op: "addLast", value: 30 },
@@ -13485,11 +13485,11 @@ const LINKEDLIST_CODE = [
13485
13485
  " node = node.next",
13486
13486
  " return node.value"
13487
13487
  ];
13488
- const LEGEND_ITEMS$l = [
13488
+ const LEGEND_ITEMS$m = [
13489
13489
  { color: "bg-white", label: "Node", border: "#d1d5db" },
13490
13490
  { color: "bg-blue-500", label: "Active" }
13491
13491
  ];
13492
- const BADGES$l = [
13492
+ const BADGES$m = [
13493
13493
  { label: "Ends: O(1)", variant: "blue" },
13494
13494
  { label: "Index: O(n)", variant: "indigo" }
13495
13495
  ];
@@ -13505,7 +13505,7 @@ function generateLinkedListSteps() {
13505
13505
  description: "Initialize empty LinkedList (doubly-linked). O(1) for add/remove at ends, O(n) for indexed access.",
13506
13506
  codeLine: -1
13507
13507
  });
13508
- for (const { op, value, index } of OPERATIONS$e) {
13508
+ for (const { op, value, index } of OPERATIONS$f) {
13509
13509
  if (op === "addFirst" && value !== void 0) {
13510
13510
  const newNode = { value, id: nodeIdCounter$2++ };
13511
13511
  nodes = [newNode, ...nodes];
@@ -13687,7 +13687,7 @@ const LinkedListVisualizerComponent = ({
13687
13687
  {
13688
13688
  id: VISUALIZER_ID2,
13689
13689
  title: "LinkedList Operations",
13690
- badges: BADGES$l,
13690
+ badges: BADGES$m,
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$l,
13714
+ legendItems: LEGEND_ITEMS$m,
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,
@@ -13722,7 +13722,7 @@ const LinkedListVisualizerComponent = ({
13722
13722
  };
13723
13723
  const LinkedListVisualizer = React.memo(LinkedListVisualizerComponent);
13724
13724
  const BUCKET_COUNT = 6;
13725
- const OPERATIONS$d = [
13725
+ const OPERATIONS$e = [
13726
13726
  { op: "put", key: "A", value: 10 },
13727
13727
  { op: "put", key: "B", value: 20 },
13728
13728
  { op: "put", key: "C", value: 30 },
@@ -13758,13 +13758,13 @@ const LINKEDHASHMAP_CODE = [
13758
13758
  " }",
13759
13759
  "}"
13760
13760
  ];
13761
- const LEGEND_ITEMS$k = [
13761
+ const LEGEND_ITEMS$l = [
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$k = [
13767
+ const BADGES$l = [
13768
13768
  { label: "O(1) ops", variant: "orange" },
13769
13769
  { label: "Ordered", variant: "amber" }
13770
13770
  ];
@@ -13791,7 +13791,7 @@ function generateLinkedHashMapSteps(accessOrder = true) {
13791
13791
  codeLine: 0,
13792
13792
  accessOrder
13793
13793
  });
13794
- for (const { op, key, value } of OPERATIONS$d) {
13794
+ for (const { op, key, value } of OPERATIONS$e) {
13795
13795
  const hash = simpleHash$2(key);
13796
13796
  const index = hash % BUCKET_COUNT;
13797
13797
  if (op === "put") {
@@ -14176,7 +14176,7 @@ const LinkedHashMapVisualizerComponent = ({
14176
14176
  {
14177
14177
  id: VISUALIZER_ID2,
14178
14178
  title: "LinkedHashMap",
14179
- badges: BADGES$k,
14179
+ badges: BADGES$l,
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$k,
14204
+ legendItems: LEGEND_ITEMS$l,
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,
@@ -14212,7 +14212,7 @@ const LinkedHashMapVisualizerComponent = ({
14212
14212
  };
14213
14213
  const LinkedHashMapVisualizer = React.memo(LinkedHashMapVisualizerComponent);
14214
14214
  const INITIAL_CAPACITY$1 = 4;
14215
- const OPERATIONS$c = [
14215
+ const OPERATIONS$d = [
14216
14216
  { op: "add", value: 10 },
14217
14217
  { op: "add", value: 20 },
14218
14218
  { op: "add", value: 30 },
@@ -14242,13 +14242,13 @@ const ARRAYLIST_CODE = [
14242
14242
  " shift elements left",
14243
14243
  " size--"
14244
14244
  ];
14245
- const LEGEND_ITEMS$j = [
14245
+ const LEGEND_ITEMS$k = [
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$j = [
14251
+ const BADGES$k = [
14252
14252
  { label: "Get: O(1)", variant: "orange" },
14253
14253
  { label: "Add: O(1)*", variant: "amber" }
14254
14254
  ];
@@ -14265,7 +14265,7 @@ function generateArrayListSteps() {
14265
14265
  description: `Initialize ArrayList with capacity ${capacity}. Auto-grows when full (amortized O(1) add).`,
14266
14266
  codeLine: -1
14267
14267
  });
14268
- for (const { op, value, index } of OPERATIONS$c) {
14268
+ for (const { op, value, index } of OPERATIONS$d) {
14269
14269
  if (op === "add" && value !== void 0) {
14270
14270
  if (size === capacity) {
14271
14271
  const oldCapacity = capacity;
@@ -14536,7 +14536,7 @@ const ArrayListVisualizerComponent = ({
14536
14536
  {
14537
14537
  id: VISUALIZER_ID2,
14538
14538
  title: "ArrayList Operations",
14539
- badges: BADGES$j,
14539
+ badges: BADGES$k,
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$j,
14563
+ legendItems: LEGEND_ITEMS$k,
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,
@@ -14571,7 +14571,7 @@ const ArrayListVisualizerComponent = ({
14571
14571
  };
14572
14572
  const ArrayListVisualizer = React.memo(ArrayListVisualizerComponent);
14573
14573
  const INITIAL_CAPACITY = 8;
14574
- const OPERATIONS$b = [
14574
+ const OPERATIONS$c = [
14575
14575
  { op: "addLast", value: 10 },
14576
14576
  { op: "addLast", value: 20 },
14577
14577
  { op: "addFirst", value: 5 },
@@ -14617,14 +14617,14 @@ const ARRAYDEQUE_CODE = [
14617
14617
  " }",
14618
14618
  "}"
14619
14619
  ];
14620
- const LEGEND_ITEMS$i = [
14620
+ const LEGEND_ITEMS$j = [
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$i = [
14627
+ const BADGES$j = [
14628
14628
  { label: "O(1) all ops", variant: "teal" },
14629
14629
  { label: "Circular buffer", variant: "purple" }
14630
14630
  ];
@@ -14645,7 +14645,7 @@ function generateArrayDequeSteps() {
14645
14645
  codeLine: 0,
14646
14646
  variables: { head, tail, capacity, size: 0 }
14647
14647
  });
14648
- for (const { op, value } of OPERATIONS$b) {
14648
+ for (const { op, value } of OPERATIONS$c) {
14649
14649
  if (op === "addFirst" && value !== void 0) {
14650
14650
  if (getSize() === capacity - 1) {
14651
14651
  const oldCapacity = capacity;
@@ -14976,7 +14976,7 @@ const ArrayDequeVisualizerComponent = ({
14976
14976
  {
14977
14977
  id: VISUALIZER_ID2,
14978
14978
  title: "ArrayDeque",
14979
- badges: BADGES$i,
14979
+ badges: BADGES$j,
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$i,
15004
+ legendItems: LEGEND_ITEMS$j,
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,
@@ -15011,7 +15011,7 @@ const ArrayDequeVisualizerComponent = ({
15011
15011
  );
15012
15012
  };
15013
15013
  const ArrayDequeVisualizer = React.memo(ArrayDequeVisualizerComponent);
15014
- const OPERATIONS$a = [
15014
+ const OPERATIONS$b = [
15015
15015
  { op: "add", value: 50 },
15016
15016
  { op: "add", value: 30 },
15017
15017
  { op: "add", value: 70 },
@@ -15042,13 +15042,13 @@ const TREESET_CODE = [
15042
15042
  " node = node.right",
15043
15043
  " else: return // duplicate"
15044
15044
  ];
15045
- const LEGEND_ITEMS$h = [
15045
+ const LEGEND_ITEMS$i = [
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$h = [
15051
+ const BADGES$i = [
15052
15052
  { label: "Avg: O(log n)", variant: "green" },
15053
15053
  { label: "Worst: O(n)", variant: "amber" }
15054
15054
  ];
@@ -15095,7 +15095,7 @@ function generateTreeSetSteps() {
15095
15095
  description: "Initialize empty TreeSet (Binary Search Tree). Values are stored in sorted order.",
15096
15096
  codeLine: -1
15097
15097
  });
15098
- for (const { op, value } of OPERATIONS$a) {
15098
+ for (const { op, value } of OPERATIONS$b) {
15099
15099
  if (op === "add") {
15100
15100
  const path = tree ? findPath(tree, value) : [];
15101
15101
  if (tree) {
@@ -15414,7 +15414,7 @@ const TreeSetVisualizerComponent = ({
15414
15414
  {
15415
15415
  id: VISUALIZER_ID2,
15416
15416
  title: "TreeSet Operations (BST)",
15417
- badges: BADGES$h,
15417
+ badges: BADGES$i,
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$h,
15441
+ legendItems: LEGEND_ITEMS$i,
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,
@@ -15457,7 +15457,7 @@ const DAYS_OF_WEEK = [
15457
15457
  "SATURDAY",
15458
15458
  "SUNDAY"
15459
15459
  ];
15460
- const OPERATIONS$9 = [
15460
+ const OPERATIONS$a = [
15461
15461
  { op: "add", value: "MONDAY" },
15462
15462
  { op: "add", value: "WEDNESDAY" },
15463
15463
  { op: "add", value: "FRIDAY" },
@@ -15490,13 +15490,13 @@ const ENUMSET_CODE = [
15490
15490
  " }",
15491
15491
  "}"
15492
15492
  ];
15493
- const LEGEND_ITEMS$g = [
15493
+ const LEGEND_ITEMS$h = [
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$g = [
15499
+ const BADGES$h = [
15500
15500
  { label: "O(1) all ops", variant: "green" },
15501
15501
  { label: "Memory efficient", variant: "green" }
15502
15502
  ];
@@ -15513,7 +15513,7 @@ function generateEnumSetSteps() {
15513
15513
  codeLine: 1,
15514
15514
  variables: { elements: "0b0000000" }
15515
15515
  });
15516
- for (const { op, value } of OPERATIONS$9) {
15516
+ for (const { op, value } of OPERATIONS$a) {
15517
15517
  const bitPos = getBitPosition(value);
15518
15518
  const bitMaskForValue = 1 << bitPos;
15519
15519
  const previousBitmask = bitmask;
@@ -15765,7 +15765,7 @@ const EnumSetVisualizerComponent = ({
15765
15765
  {
15766
15766
  id: VISUALIZER_ID2,
15767
15767
  title: "EnumSet Bit Operations",
15768
- badges: BADGES$g,
15768
+ badges: BADGES$h,
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$g,
15793
+ legendItems: LEGEND_ITEMS$h,
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,
@@ -15800,7 +15800,7 @@ const EnumSetVisualizerComponent = ({
15800
15800
  );
15801
15801
  };
15802
15802
  const EnumSetVisualizer = React.memo(EnumSetVisualizerComponent);
15803
- const OPERATIONS$8 = [
15803
+ const OPERATIONS$9 = [
15804
15804
  { op: "offer", value: 50 },
15805
15805
  { op: "offer", value: 30 },
15806
15806
  { op: "offer", value: 70 },
@@ -15829,18 +15829,18 @@ const HEAP_CODE$1 = [
15829
15829
  " siftDown(0)",
15830
15830
  " return result"
15831
15831
  ];
15832
- const LEGEND_ITEMS$f = [
15832
+ const LEGEND_ITEMS$g = [
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$f = [
15839
+ const BADGES$g = [
15840
15840
  { label: "offer: O(log n)", variant: "purple" },
15841
15841
  { label: "poll: O(log n)", variant: "purple" }
15842
15842
  ];
15843
- function generateHeapSteps$1() {
15843
+ function generateHeapSteps$2() {
15844
15844
  const steps = [];
15845
15845
  const heap = [];
15846
15846
  steps.push({
@@ -15849,7 +15849,7 @@ function generateHeapSteps$1() {
15849
15849
  description: "Initialize min-heap PriorityQueue. Parent is always smaller than children. O(log n) insert/remove.",
15850
15850
  codeLine: -1
15851
15851
  });
15852
- for (const { op, value } of OPERATIONS$8) {
15852
+ for (const { op, value } of OPERATIONS$9) {
15853
15853
  if (op === "offer" && value !== void 0) {
15854
15854
  heap.push(value);
15855
15855
  let idx = heap.length - 1;
@@ -16022,7 +16022,7 @@ function generateHeapSteps$1() {
16022
16022
  });
16023
16023
  return steps;
16024
16024
  }
16025
- function getTreePositions$1(size) {
16025
+ function getTreePositions$2(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$1();
16049
+ const newSteps = generateHeapSteps$2();
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$1(heap.length);
16137
+ const positions = getTreePositions$2(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$f,
16313
+ badges: BADGES$g,
16314
16314
  gradient: "purple",
16315
16315
  className,
16316
16316
  minHeight: 400,
@@ -16333,7 +16333,7 @@ const PriorityQueueVisualizerComponent = ({ showControls = true, showCode = true
16333
16333
  accentColor: "purple"
16334
16334
  },
16335
16335
  showControls,
16336
- legendItems: LEGEND_ITEMS$f,
16336
+ legendItems: LEGEND_ITEMS$g,
16337
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,
@@ -16345,9 +16345,9 @@ const PriorityQueueVisualizerComponent = ({ showControls = true, showCode = true
16345
16345
  const PriorityQueueVisualizer = React.memo(
16346
16346
  PriorityQueueVisualizerComponent
16347
16347
  );
16348
- const VISUALIZER_ID = "heap-visualizer";
16348
+ const VISUALIZER_ID$1 = "heap-visualizer";
16349
16349
  const INITIAL_ARRAY$1 = [4, 10, 3, 5, 1, 8, 7, 2, 9, 6];
16350
- const BADGES$e = [
16350
+ const BADGES$f = [
16351
16351
  { label: "Build: O(n)", variant: "orange" },
16352
16352
  { label: "Sort: O(n log n)", variant: "amber" }
16353
16353
  ];
@@ -16376,14 +16376,14 @@ const HEAP_CODE = [
16376
16376
  " swap(arr[0], arr[i]) # Move max to end",
16377
16377
  " heapify(arr, i, 0) # Restore heap"
16378
16378
  ];
16379
- const LEGEND_ITEMS$e = [
16379
+ const LEGEND_ITEMS$f = [
16380
16380
  { color: "bg-orange-500", label: "Root (max)" },
16381
16381
  { color: "bg-amber-400", label: "Comparing" },
16382
16382
  { color: "bg-green-400", label: "Swapped" },
16383
16383
  { color: "bg-blue-200", label: "Current node", border: "#60a5fa" },
16384
16384
  { color: "bg-gray-300", label: "Sorted portion" }
16385
16385
  ];
16386
- function generateHeapSteps(initialArray) {
16386
+ function generateHeapSteps$1(initialArray) {
16387
16387
  const steps = [];
16388
16388
  const arr = [...initialArray];
16389
16389
  const n = arr.length;
@@ -16550,7 +16550,7 @@ function heapifyWithSteps(arr, heapSize, i, steps, phase, sortedPortion = []) {
16550
16550
  });
16551
16551
  }
16552
16552
  }
16553
- function getTreePositions(size) {
16553
+ function getTreePositions$1(size) {
16554
16554
  const positions = [];
16555
16555
  const width = 320;
16556
16556
  for (let i = 0; i < size; i++) {
@@ -16571,8 +16571,8 @@ const HeapVisualizerComponent = ({
16571
16571
  showCode = true,
16572
16572
  className = ""
16573
16573
  }) => {
16574
- const { copyUrlToClipboard } = useUrlState({ prefix: "heap", scrollToId: VISUALIZER_ID });
16575
- const generateSteps = useMemo(() => () => generateHeapSteps(INITIAL_ARRAY$1), []);
16574
+ const { copyUrlToClipboard } = useUrlState({ prefix: "heap", scrollToId: VISUALIZER_ID$1 });
16575
+ const generateSteps = useMemo(() => () => generateHeapSteps$1(INITIAL_ARRAY$1), []);
16576
16576
  const {
16577
16577
  steps,
16578
16578
  currentStep,
@@ -16594,7 +16594,7 @@ const HeapVisualizerComponent = ({
16594
16594
  description: ""
16595
16595
  };
16596
16596
  const { array, heapSize, sortedPortion, highlightIndex, compareIndices, swapIndices, description, phase } = stepData;
16597
- const positions = getTreePositions(array.length);
16597
+ const positions = getTreePositions$1(array.length);
16598
16598
  const getNodeStyle = (idx) => {
16599
16599
  if (sortedPortion == null ? void 0 : sortedPortion.includes(idx)) {
16600
16600
  return "fill-gray-300 stroke-gray-400";
@@ -16757,9 +16757,9 @@ const HeapVisualizerComponent = ({
16757
16757
  return /* @__PURE__ */ jsx(
16758
16758
  BaseVisualizerLayout,
16759
16759
  {
16760
- id: VISUALIZER_ID,
16760
+ id: VISUALIZER_ID$1,
16761
16761
  title: "Heap (Max-Heap & HeapSort)",
16762
- badges: BADGES$e,
16762
+ badges: BADGES$f,
16763
16763
  gradient: "orange",
16764
16764
  className,
16765
16765
  minHeight: 450,
@@ -16783,7 +16783,7 @@ const HeapVisualizerComponent = ({
16783
16783
  accentColor: "orange"
16784
16784
  },
16785
16785
  showControls,
16786
- legendItems: LEGEND_ITEMS$e,
16786
+ legendItems: LEGEND_ITEMS$f,
16787
16787
  code: showCode ? HEAP_CODE : void 0,
16788
16788
  currentCodeLine: currentStepData == null ? void 0 : currentStepData.codeLine,
16789
16789
  codeVariables: currentStepData == null ? void 0 : currentStepData.variables,
@@ -16793,6 +16793,403 @@ const HeapVisualizerComponent = ({
16793
16793
  );
16794
16794
  };
16795
16795
  const HeapVisualizer = React.memo(HeapVisualizerComponent);
16796
+ const VISUALIZER_ID = "heap-interview-visualizer";
16797
+ const BADGES$e = [
16798
+ { label: "Interview Mode", variant: "orange" },
16799
+ { label: "Max-Heap", variant: "amber" }
16800
+ ];
16801
+ const OPERATIONS$8 = [
16802
+ { op: "insert", value: 40 },
16803
+ { op: "insert", value: 20 },
16804
+ { op: "insert", value: 60 },
16805
+ { op: "insert", value: 10 },
16806
+ { op: "insert", value: 50 },
16807
+ { op: "extractMax" },
16808
+ { op: "insert", value: 55 },
16809
+ { op: "extractMax" }
16810
+ ];
16811
+ const LEGEND_ITEMS$e = [
16812
+ { color: "bg-orange-500", label: "Root (max)" },
16813
+ { color: "bg-amber-400", label: "Comparing" },
16814
+ { color: "bg-green-400", label: "Swapped" },
16815
+ { color: "bg-blue-200", label: "Current", border: "#60a5fa" }
16816
+ ];
16817
+ const HEAP_QUESTIONS = [
16818
+ {
16819
+ id: "heap-1",
16820
+ question: "What is the time complexity of inserting an element into a heap?",
16821
+ options: ["O(1)", "O(log n)", "O(n)", "O(n log n)"],
16822
+ correctAnswer: 1,
16823
+ explanation: 'Insertion is O(log n) because after adding the element at the end, we may need to "sift up" through at most log n levels (height of the tree) to restore the heap property.',
16824
+ hint: "Think about the height of a complete binary tree.",
16825
+ difficulty: "easy",
16826
+ topic: "Time Complexity"
16827
+ },
16828
+ {
16829
+ id: "heap-2",
16830
+ question: "What is the time complexity of building a heap from an unsorted array?",
16831
+ options: ["O(n)", "O(n log n)", "O(n²)", "O(log n)"],
16832
+ correctAnswer: 0,
16833
+ explanation: "Building a heap using bottom-up heapify is O(n), not O(n log n)! This is because most nodes are near the bottom and require few swaps. The mathematical analysis shows the total work is O(n).",
16834
+ hint: "It's better than calling insert() n times.",
16835
+ difficulty: "medium",
16836
+ topic: "Build Heap"
16837
+ },
16838
+ {
16839
+ id: "heap-3",
16840
+ question: "In a max-heap stored as an array, what is the index of the left child of node at index i?",
16841
+ options: ["i + 1", "2i", "2i + 1", "(i - 1) / 2"],
16842
+ correctAnswer: 2,
16843
+ explanation: "For 0-indexed arrays: left child = 2i + 1, right child = 2i + 2, parent = ⌊(i-1)/2⌋. For 1-indexed: left = 2i, right = 2i + 1, parent = ⌊i/2⌋.",
16844
+ hint: "The formula depends on whether the array is 0-indexed or 1-indexed.",
16845
+ difficulty: "easy",
16846
+ topic: "Index Formulas"
16847
+ },
16848
+ {
16849
+ id: "heap-4",
16850
+ question: "What type of binary tree is a heap?",
16851
+ options: ["Full binary tree", "Complete binary tree", "Perfect binary tree", "Binary search tree"],
16852
+ correctAnswer: 1,
16853
+ explanation: "A heap is a complete binary tree: all levels are fully filled except possibly the last, which is filled from left to right. This allows efficient array storage without pointers.",
16854
+ difficulty: "easy",
16855
+ topic: "Structure"
16856
+ },
16857
+ {
16858
+ id: "heap-5",
16859
+ question: "What is the time complexity of HeapSort?",
16860
+ options: ["O(n)", "O(n log n)", "O(n²)", "O(log n)"],
16861
+ correctAnswer: 1,
16862
+ explanation: "HeapSort is O(n log n): O(n) to build the heap, then n extract operations each taking O(log n). Unlike QuickSort, HeapSort has guaranteed O(n log n) worst case.",
16863
+ difficulty: "easy",
16864
+ topic: "HeapSort"
16865
+ },
16866
+ {
16867
+ id: "heap-6",
16868
+ question: "Which operation is NOT efficiently supported by a standard heap?",
16869
+ options: ["Find min/max", "Insert", "Delete min/max", "Search for arbitrary element"],
16870
+ correctAnswer: 3,
16871
+ explanation: "Heaps don't support efficient search - finding an arbitrary element requires O(n) time as you may need to scan the entire array. Heaps are optimized for min/max operations only.",
16872
+ hint: "A heap is not ordered like a BST.",
16873
+ difficulty: "medium",
16874
+ topic: "Limitations"
16875
+ },
16876
+ {
16877
+ id: "heap-7",
16878
+ question: "What is the space complexity of HeapSort?",
16879
+ options: ["O(1)", "O(log n)", "O(n)", "O(n log n)"],
16880
+ correctAnswer: 0,
16881
+ explanation: "HeapSort is an in-place sorting algorithm with O(1) extra space. The heap is built within the original array. Only O(log n) stack space is used if implemented recursively.",
16882
+ difficulty: "medium",
16883
+ topic: "Space Complexity"
16884
+ },
16885
+ {
16886
+ id: "heap-8",
16887
+ question: "In a min-heap with n elements, where can the maximum element be?",
16888
+ options: ["Only at the root", "Only at the last level", "At any leaf node", "Anywhere in the heap"],
16889
+ correctAnswer: 2,
16890
+ explanation: "In a min-heap, the maximum must be at a leaf node (it cannot have any children smaller than it). The maximum could be any of the ⌈n/2⌉ leaf nodes.",
16891
+ hint: "Think about the heap property and where max cannot be.",
16892
+ difficulty: "medium",
16893
+ topic: "Heap Property"
16894
+ },
16895
+ {
16896
+ id: "heap-9",
16897
+ question: "What data structure is typically used to implement a priority queue?",
16898
+ options: ["Sorted array", "Linked list", "Binary heap", "Hash table"],
16899
+ correctAnswer: 2,
16900
+ explanation: "Binary heaps are the standard implementation for priority queues because they provide O(log n) insert and extract-min/max operations. Sorted arrays have O(n) insert, and hash tables don't maintain order.",
16901
+ difficulty: "easy",
16902
+ topic: "Applications"
16903
+ },
16904
+ {
16905
+ id: "heap-10",
16906
+ question: "What is a Fibonacci heap's advantage over a binary heap?",
16907
+ options: [
16908
+ "Simpler implementation",
16909
+ "Better worst-case insert and decrease-key: O(1) amortized",
16910
+ "Uses less memory",
16911
+ "Faster extract-min operation"
16912
+ ],
16913
+ correctAnswer: 1,
16914
+ explanation: "Fibonacci heaps have O(1) amortized insert and decrease-key operations (vs O(log n) for binary heaps). This makes them theoretically better for Dijkstra's algorithm, though binary heaps are often faster in practice due to constants.",
16915
+ difficulty: "hard",
16916
+ topic: "Advanced"
16917
+ }
16918
+ ];
16919
+ function generateHeapSteps() {
16920
+ const steps = [];
16921
+ const heap = [];
16922
+ steps.push({
16923
+ operation: "init",
16924
+ array: [],
16925
+ heapSize: 0,
16926
+ description: "Initialize empty Max-Heap. Parent ≥ children."
16927
+ });
16928
+ for (const { op, value } of OPERATIONS$8) {
16929
+ if (op === "insert" && value !== void 0) {
16930
+ heap.push(value);
16931
+ let idx = heap.length - 1;
16932
+ steps.push({
16933
+ operation: "insert",
16934
+ array: [...heap],
16935
+ heapSize: heap.length,
16936
+ highlightIndex: idx,
16937
+ description: `insert(${value}): Add at index ${idx}`
16938
+ });
16939
+ while (idx > 0) {
16940
+ const parentIdx = Math.floor((idx - 1) / 2);
16941
+ steps.push({
16942
+ operation: "siftUp",
16943
+ array: [...heap],
16944
+ heapSize: heap.length,
16945
+ compareIndices: [idx, parentIdx],
16946
+ description: `Compare ${heap[idx]} with parent ${heap[parentIdx]}`
16947
+ });
16948
+ if (heap[idx] > heap[parentIdx]) {
16949
+ [heap[idx], heap[parentIdx]] = [heap[parentIdx], heap[idx]];
16950
+ steps.push({
16951
+ operation: "siftUp",
16952
+ array: [...heap],
16953
+ heapSize: heap.length,
16954
+ swapIndices: [idx, parentIdx],
16955
+ description: `${heap[parentIdx]} > ${heap[idx]}, swap!`
16956
+ });
16957
+ idx = parentIdx;
16958
+ } else {
16959
+ break;
16960
+ }
16961
+ }
16962
+ } else if (op === "extractMax") {
16963
+ if (heap.length === 0) continue;
16964
+ const max = heap[0];
16965
+ const last = heap.pop();
16966
+ if (heap.length === 0) {
16967
+ steps.push({
16968
+ operation: "extractMax",
16969
+ array: [],
16970
+ heapSize: 0,
16971
+ description: `extractMax() = ${max}, heap is now empty`
16972
+ });
16973
+ continue;
16974
+ }
16975
+ heap[0] = last;
16976
+ steps.push({
16977
+ operation: "extractMax",
16978
+ array: [...heap],
16979
+ heapSize: heap.length,
16980
+ highlightIndex: 0,
16981
+ description: `extractMax() = ${max}, move ${last} to root`
16982
+ });
16983
+ let idx = 0;
16984
+ while (true) {
16985
+ const left = 2 * idx + 1;
16986
+ const right = 2 * idx + 2;
16987
+ let largest = idx;
16988
+ if (left < heap.length && heap[left] > heap[largest]) {
16989
+ largest = left;
16990
+ }
16991
+ if (right < heap.length && heap[right] > heap[largest]) {
16992
+ largest = right;
16993
+ }
16994
+ if (largest === idx) break;
16995
+ steps.push({
16996
+ operation: "siftDown",
16997
+ array: [...heap],
16998
+ heapSize: heap.length,
16999
+ compareIndices: [idx, largest],
17000
+ description: `Compare ${heap[idx]} with larger child ${heap[largest]}`
17001
+ });
17002
+ [heap[idx], heap[largest]] = [heap[largest], heap[idx]];
17003
+ steps.push({
17004
+ operation: "siftDown",
17005
+ array: [...heap],
17006
+ heapSize: heap.length,
17007
+ swapIndices: [idx, largest],
17008
+ description: `Swap! ${heap[idx]} moved up`
17009
+ });
17010
+ idx = largest;
17011
+ }
17012
+ }
17013
+ }
17014
+ steps.push({
17015
+ operation: "done",
17016
+ array: [...heap],
17017
+ heapSize: heap.length,
17018
+ description: `Done! Heap has ${heap.length} elements. Max = ${heap[0] || "none"}`
17019
+ });
17020
+ return steps;
17021
+ }
17022
+ function getTreePositions(size) {
17023
+ const positions = [];
17024
+ const width = 280;
17025
+ for (let i = 0; i < size; i++) {
17026
+ const level = Math.floor(Math.log2(i + 1));
17027
+ const levelStart = Math.pow(2, level) - 1;
17028
+ const posInLevel = i - levelStart;
17029
+ const nodesInLevel = Math.pow(2, level);
17030
+ const spacing = width / (nodesInLevel + 1);
17031
+ positions.push({
17032
+ x: spacing * (posInLevel + 1),
17033
+ y: level * 50 + 25
17034
+ });
17035
+ }
17036
+ return positions;
17037
+ }
17038
+ const HeapInterviewVisualizerComponent = ({
17039
+ showControls = true,
17040
+ className = ""
17041
+ }) => {
17042
+ const { copyUrlToClipboard } = useUrlState({ prefix: "heap-int", scrollToId: VISUALIZER_ID });
17043
+ const [mode, setMode] = useState("visualize");
17044
+ const generateSteps = useMemo(() => generateHeapSteps, []);
17045
+ const playback = useVisualizerPlayback({ generateSteps });
17046
+ const interview = useInterviewMode({
17047
+ questions: HEAP_QUESTIONS,
17048
+ shuffleQuestions: true
17049
+ });
17050
+ const stepData = playback.currentStepData || {
17051
+ operation: "init",
17052
+ array: [],
17053
+ description: ""
17054
+ };
17055
+ const { array, highlightIndex, compareIndices, swapIndices, description } = stepData;
17056
+ const positions = getTreePositions(array.length);
17057
+ const getNodeStyle = (idx) => {
17058
+ if (swapIndices == null ? void 0 : swapIndices.includes(idx)) return "fill-green-400 stroke-green-500";
17059
+ if (compareIndices == null ? void 0 : compareIndices.includes(idx)) return "fill-amber-400 stroke-amber-500";
17060
+ if (idx === highlightIndex) return "fill-blue-200 stroke-blue-400";
17061
+ if (idx === 0) return "fill-orange-500 stroke-orange-600";
17062
+ return "fill-white stroke-gray-300";
17063
+ };
17064
+ const getTextColor = (idx) => {
17065
+ if ((swapIndices == null ? void 0 : swapIndices.includes(idx)) || idx === 0) return "white";
17066
+ return "#374151";
17067
+ };
17068
+ const handleShare = useCallback(async () => {
17069
+ return copyUrlToClipboard({ step: playback.currentStep });
17070
+ }, [copyUrlToClipboard, playback.currentStep]);
17071
+ const visualization = /* @__PURE__ */ jsxs(Fragment, { children: [
17072
+ /* @__PURE__ */ jsx("div", { className: "mb-4 p-3 bg-orange-50 rounded-lg border border-orange-200", children: /* @__PURE__ */ jsxs("div", { className: "text-sm text-orange-800 text-center", children: [
17073
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: "Max-Heap Property:" }),
17074
+ " parent ≥ children"
17075
+ ] }) }),
17076
+ /* @__PURE__ */ jsx("div", { className: "mb-4 bg-gray-50 rounded-lg p-2 min-h-[160px] flex items-center justify-center", children: array.length > 0 ? /* @__PURE__ */ jsxs("svg", { width: "280", height: Math.max(Math.floor(Math.log2(array.length)) * 50 + 60, 80), className: "mx-auto", children: [
17077
+ array.map((_, idx) => {
17078
+ if (idx === 0) return null;
17079
+ const parentIdx = Math.floor((idx - 1) / 2);
17080
+ const parentPos = positions[parentIdx];
17081
+ const childPos = positions[idx];
17082
+ if (!parentPos || !childPos) return null;
17083
+ 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));
17084
+ return /* @__PURE__ */ jsx(
17085
+ "line",
17086
+ {
17087
+ x1: parentPos.x,
17088
+ y1: parentPos.y,
17089
+ x2: childPos.x,
17090
+ y2: childPos.y,
17091
+ stroke: isActive ? "#f59e0b" : "#d1d5db",
17092
+ strokeWidth: isActive ? 2 : 1
17093
+ },
17094
+ `edge-${idx}`
17095
+ );
17096
+ }),
17097
+ array.map((val, idx) => {
17098
+ const pos = positions[idx];
17099
+ if (!pos) return null;
17100
+ return /* @__PURE__ */ jsxs("g", { transform: `translate(${pos.x}, ${pos.y})`, children: [
17101
+ /* @__PURE__ */ jsx("circle", { r: "16", className: `${getNodeStyle(idx)} stroke-2` }),
17102
+ /* @__PURE__ */ jsx("text", { textAnchor: "middle", dy: "5", className: "text-xs font-bold", fill: getTextColor(idx), children: val })
17103
+ ] }, idx);
17104
+ })
17105
+ ] }) : /* @__PURE__ */ jsx("span", { className: "text-gray-400 text-sm", children: "Empty heap" }) }),
17106
+ /* @__PURE__ */ jsxs("div", { className: "mb-4 p-3 bg-gray-100 rounded-lg min-h-[60px]", children: [
17107
+ /* @__PURE__ */ jsx("div", { className: "text-xs text-gray-600 mb-1", children: "Array: " }),
17108
+ array.length > 0 ? /* @__PURE__ */ jsx("div", { className: "flex gap-1 flex-wrap", children: array.map((val, idx) => /* @__PURE__ */ jsx(
17109
+ "div",
17110
+ {
17111
+ className: `w-8 h-8 flex items-center justify-center rounded text-xs font-mono ${(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 === 0 ? "bg-orange-500 text-white" : "bg-white border border-gray-300"}`,
17112
+ children: val
17113
+ },
17114
+ idx
17115
+ )) }) : /* @__PURE__ */ jsx("span", { className: "text-gray-400 text-xs italic", children: "Elements will appear here..." })
17116
+ ] })
17117
+ ] });
17118
+ const modeToggle = /* @__PURE__ */ jsxs("div", { className: "flex gap-1 bg-gray-200 rounded-lg p-0.5", children: [
17119
+ /* @__PURE__ */ jsx(
17120
+ "button",
17121
+ {
17122
+ onClick: () => setMode("visualize"),
17123
+ className: `px-3 py-1 rounded-md text-xs font-medium transition-colors ${mode === "visualize" ? "bg-white text-orange-600 shadow-sm" : "text-gray-600 hover:text-gray-800"}`,
17124
+ children: "Visualize"
17125
+ }
17126
+ ),
17127
+ /* @__PURE__ */ jsx(
17128
+ "button",
17129
+ {
17130
+ onClick: () => setMode("interview"),
17131
+ className: `px-3 py-1 rounded-md text-xs font-medium transition-colors ${mode === "interview" ? "bg-white text-orange-600 shadow-sm" : "text-gray-600 hover:text-gray-800"}`,
17132
+ children: "Interview"
17133
+ }
17134
+ )
17135
+ ] });
17136
+ const sidePanel = mode === "interview" ? /* @__PURE__ */ jsx(
17137
+ InterviewModePanel,
17138
+ {
17139
+ currentQuestion: interview.currentQuestion,
17140
+ currentQuestionIndex: interview.session.currentQuestionIndex,
17141
+ totalQuestions: interview.session.questions.length,
17142
+ selectedAnswer: interview.selectedAnswer,
17143
+ showExplanation: interview.showExplanation,
17144
+ showHint: interview.showHint,
17145
+ isAnswered: interview.isAnswered,
17146
+ isComplete: interview.isComplete,
17147
+ score: interview.score,
17148
+ onSelectAnswer: interview.selectAnswer,
17149
+ onNextQuestion: interview.nextQuestion,
17150
+ onPreviousQuestion: interview.previousQuestion,
17151
+ onUseHint: interview.useHint,
17152
+ onRestart: interview.restartSession,
17153
+ accentColor: "orange"
17154
+ }
17155
+ ) : void 0;
17156
+ return /* @__PURE__ */ jsx(
17157
+ BaseVisualizerLayout,
17158
+ {
17159
+ id: VISUALIZER_ID,
17160
+ title: "Heap (Interview Mode)",
17161
+ badges: BADGES$e,
17162
+ gradient: "orange",
17163
+ className,
17164
+ minHeight: 450,
17165
+ onShare: handleShare,
17166
+ headerExtra: modeToggle,
17167
+ status: {
17168
+ description,
17169
+ currentStep: playback.currentStep,
17170
+ totalSteps: playback.steps.length,
17171
+ variant: stepData.operation === "done" ? "success" : swapIndices ? "warning" : "default"
17172
+ },
17173
+ controls: {
17174
+ isPlaying: playback.isPlaying,
17175
+ currentStep: playback.currentStep,
17176
+ totalSteps: playback.steps.length,
17177
+ speed: playback.speed,
17178
+ onPlayPause: playback.handlePlayPause,
17179
+ onStep: playback.handleStep,
17180
+ onStepBack: playback.handleStepBack,
17181
+ onReset: playback.handleReset,
17182
+ onSpeedChange: playback.setSpeed,
17183
+ accentColor: "orange"
17184
+ },
17185
+ showControls,
17186
+ legendItems: LEGEND_ITEMS$e,
17187
+ sidePanel,
17188
+ children: visualization
17189
+ }
17190
+ );
17191
+ };
17192
+ const HeapInterviewVisualizer = React.memo(HeapInterviewVisualizerComponent);
16796
17193
  const SEGMENT_COUNT = 4;
16797
17194
  const OPERATIONS$7 = [
16798
17195
  { thread: "T1", op: "put", key: "Alice", value: 100 },
@@ -22821,6 +23218,7 @@ export {
22821
23218
  HashMapInterviewVisualizer,
22822
23219
  HashMapVisualizer,
22823
23220
  HashTableVisualizer,
23221
+ HeapInterviewVisualizer,
22824
23222
  HeapVisualizer,
22825
23223
  HelpPanel,
22826
23224
  ImmutableCollectionsVisualizer,