@tscircuit/runframe 0.0.970 → 0.0.971

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/runner.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  useRunFrameStore,
24
24
  useRunnerStore,
25
25
  useStyles
26
- } from "./chunk-GEXWDQ4P.js";
26
+ } from "./chunk-7PCGNX3W.js";
27
27
 
28
28
  // lib/components/RunFrame/RunFrame.tsx
29
29
  import { createCircuitWebWorker } from "@tscircuit/eval/worker";
@@ -125,8 +125,28 @@ function useMutex() {
125
125
  return { runWithMutex, isLocked, cancel };
126
126
  }
127
127
 
128
+ // lib/components/ui/LoadingSkeleton.tsx
129
+ import { jsx, jsxs } from "react/jsx-runtime";
130
+ var LoadingSkeleton = ({
131
+ message = "Loading files..."
132
+ }) => {
133
+ return /* @__PURE__ */ jsxs("div", { className: "rf-flex rf-flex-col rf-w-full rf-h-full", children: [
134
+ /* @__PURE__ */ jsxs("div", { className: "rf-flex rf-items-center rf-gap-4 rf-p-2 rf-border-b", children: [
135
+ /* @__PURE__ */ jsx("div", { className: "rf-w-20 rf-h-9 rf-bg-gray-200 dark:rf-bg-gray-700 rf-rounded-md rf-animate-pulse" }),
136
+ /* @__PURE__ */ jsx("div", { className: "rf-flex rf-gap-6 rf-ml-auto", children: ["PCB", "Schematic", "3D"].map((_, i) => /* @__PURE__ */ jsx(
137
+ "div",
138
+ {
139
+ className: "rf-h-6 rf-w-20 rf-bg-gray-200 dark:rf-bg-gray-700 rf-rounded rf-animate-pulse"
140
+ },
141
+ i
142
+ )) })
143
+ ] }),
144
+ /* @__PURE__ */ jsx("div", { className: "rf-flex-1 rf-p-4", children: /* @__PURE__ */ jsx("div", { className: "rf-w-full rf-h-full rf-rounded-lg rf-bg-gray-100 dark:rf-bg-gray-800 rf-animate-pulse rf-flex rf-items-center rf-justify-center", children: /* @__PURE__ */ jsx("div", { className: "rf-flex rf-flex-col rf-items-center rf-gap-4", children: /* @__PURE__ */ jsx("div", { className: "rf-text-sm rf-text-gray-400 dark:rf-text-gray-500", children: message }) }) }) })
145
+ ] });
146
+ };
147
+
128
148
  // lib/components/RunFrame/RunFrame.tsx
129
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
149
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
130
150
  var numRenderPhases = 26;
131
151
  var debug = Debug("run-frame:RunFrame");
132
152
  var fetchLatestEvalVersion = async () => {
@@ -499,21 +519,9 @@ var RunFrame = (props) => {
499
519
  });
500
520
  };
501
521
  if (props.isLoadingFiles) {
502
- return /* @__PURE__ */ jsxs("div", { className: "rf-flex rf-flex-col rf-w-full rf-h-full", children: [
503
- /* @__PURE__ */ jsxs("div", { className: "rf-flex rf-items-center rf-gap-4 rf-p-2 rf-border-b", children: [
504
- /* @__PURE__ */ jsx("div", { className: "rf-w-20 rf-h-9 rf-bg-gray-200 dark:rf-bg-gray-700 rf-rounded-md rf-animate-pulse" }),
505
- /* @__PURE__ */ jsx("div", { className: "rf-flex rf-gap-6 rf-ml-auto", children: ["PCB", "Schematic", "3D"].map((_, i) => /* @__PURE__ */ jsx(
506
- "div",
507
- {
508
- className: "rf-h-6 rf-w-20 rf-bg-gray-200 dark:rf-bg-gray-700 rf-rounded rf-animate-pulse"
509
- },
510
- i
511
- )) })
512
- ] }),
513
- /* @__PURE__ */ jsx("div", { className: "rf-flex-1 rf-p-4", children: /* @__PURE__ */ jsx("div", { className: "rf-w-full rf-h-full rf-rounded-lg rf-bg-gray-100 dark:rf-bg-gray-800 rf-animate-pulse rf-flex rf-items-center rf-justify-center", children: /* @__PURE__ */ jsx("div", { className: "rf-flex rf-flex-col rf-items-center rf-gap-4", children: /* @__PURE__ */ jsx("div", { className: "rf-text-sm rf-text-gray-400 dark:rf-text-gray-500", children: "Loading files..." }) }) }) })
514
- ] });
522
+ return /* @__PURE__ */ jsx2(LoadingSkeleton, {});
515
523
  }
516
- return /* @__PURE__ */ jsx(
524
+ return /* @__PURE__ */ jsx2(
517
525
  CircuitJsonPreview,
518
526
  {
519
527
  code: fsMap.get(props.entrypoint ?? props.mainComponentPath),
@@ -525,9 +533,9 @@ var RunFrame = (props) => {
525
533
  autoroutingGraphics,
526
534
  autoroutingLog,
527
535
  onReportAutoroutingLog: props.onReportAutoroutingLog || handleReportAutoroutingLog,
528
- leftHeaderContent: /* @__PURE__ */ jsxs(Fragment, { children: [
529
- props.showRunButton && /* @__PURE__ */ jsxs("div", { className: "rf-relative rf-inline-flex", children: [
530
- /* @__PURE__ */ jsxs(
536
+ leftHeaderContent: /* @__PURE__ */ jsxs2(Fragment, { children: [
537
+ props.showRunButton && /* @__PURE__ */ jsxs2("div", { className: "rf-relative rf-inline-flex", children: [
538
+ /* @__PURE__ */ jsxs2(
531
539
  "button",
532
540
  {
533
541
  type: "button",
@@ -539,11 +547,11 @@ var RunFrame = (props) => {
539
547
  children: [
540
548
  "Run",
541
549
  " ",
542
- isRunning || !dependenciesLoaded ? /* @__PURE__ */ jsx(Loader2, { className: "rf-w-3 rf-h-3 rf-animate-spin" }) : /* @__PURE__ */ jsx(Play, { className: "rf-w-3 rf-h-3" })
550
+ isRunning || !dependenciesLoaded ? /* @__PURE__ */ jsx2(Loader2, { className: "rf-w-3 rf-h-3 rf-animate-spin" }) : /* @__PURE__ */ jsx2(Play, { className: "rf-w-3 rf-h-3" })
543
551
  ]
544
552
  }
545
553
  ),
546
- isRunning && /* @__PURE__ */ jsx("div", { className: "rf-flex rf-items-center rf-ml-1", children: /* @__PURE__ */ jsx(
554
+ isRunning && /* @__PURE__ */ jsx2("div", { className: "rf-flex rf-items-center rf-ml-1", children: /* @__PURE__ */ jsx2(
547
555
  Button,
548
556
  {
549
557
  onClick: (e) => {
@@ -565,7 +573,7 @@ var RunFrame = (props) => {
565
573
  variant: "ghost",
566
574
  size: "icon",
567
575
  className: "rf-text-red-300 hover:rf-text-red-400 hover:!rf-bg-transparent [&>svg]:rf-text-red-300 [&>svg]:hover:rf-text-red-400 rf-flex rf-items-center rf-justify-center",
568
- children: /* @__PURE__ */ jsx(
576
+ children: /* @__PURE__ */ jsx2(
569
577
  Square,
570
578
  {
571
579
  className: "!rf-h-2.5 !rf-w-2.5",
@@ -576,7 +584,7 @@ var RunFrame = (props) => {
576
584
  }
577
585
  ) })
578
586
  ] }),
579
- props.showFileMenu !== false && /* @__PURE__ */ jsx(FileMenuLeftHeader, { isWebEmbedded: props.isWebEmbedded }),
587
+ props.showFileMenu !== false && /* @__PURE__ */ jsx2(FileMenuLeftHeader, { isWebEmbedded: props.isWebEmbedded }),
580
588
  props.leftHeaderContent
581
589
  ] }),
582
590
  onActiveTabChange: setActiveTab,
@@ -694,8 +702,8 @@ import * as React from "react";
694
702
  import "@radix-ui/react-dialog";
695
703
  import { Command as CommandPrimitive } from "cmdk";
696
704
  import { Search } from "lucide-react";
697
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
698
- var Command = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
705
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
706
+ var Command = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
699
707
  CommandPrimitive,
700
708
  {
701
709
  ref,
@@ -707,14 +715,14 @@ var Command = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
707
715
  }
708
716
  ));
709
717
  Command.displayName = CommandPrimitive.displayName;
710
- var CommandInput = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs2(
718
+ var CommandInput = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs3(
711
719
  "div",
712
720
  {
713
721
  className: "rf-flex rf-items-center rf-border-b rf-px-3",
714
722
  "cmdk-input-wrapper": "",
715
723
  children: [
716
- /* @__PURE__ */ jsx2(Search, { className: "rf-mr-2 rf-h-4 rf-w-4 rf-shrink-0 rf-opacity-50" }),
717
- /* @__PURE__ */ jsx2(
724
+ /* @__PURE__ */ jsx3(Search, { className: "rf-mr-2 rf-h-4 rf-w-4 rf-shrink-0 rf-opacity-50" }),
725
+ /* @__PURE__ */ jsx3(
718
726
  CommandPrimitive.Input,
719
727
  {
720
728
  ref,
@@ -729,7 +737,7 @@ var CommandInput = React.forwardRef(({ className, ...props }, ref) => /* @__PURE
729
737
  }
730
738
  ));
731
739
  CommandInput.displayName = CommandPrimitive.Input.displayName;
732
- var CommandList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
740
+ var CommandList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
733
741
  CommandPrimitive.List,
734
742
  {
735
743
  ref,
@@ -741,7 +749,7 @@ var CommandList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE_
741
749
  }
742
750
  ));
743
751
  CommandList.displayName = CommandPrimitive.List.displayName;
744
- var CommandEmpty = React.forwardRef((props, ref) => /* @__PURE__ */ jsx2(
752
+ var CommandEmpty = React.forwardRef((props, ref) => /* @__PURE__ */ jsx3(
745
753
  CommandPrimitive.Empty,
746
754
  {
747
755
  ref,
@@ -750,7 +758,7 @@ var CommandEmpty = React.forwardRef((props, ref) => /* @__PURE__ */ jsx2(
750
758
  }
751
759
  ));
752
760
  CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
753
- var CommandGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
761
+ var CommandGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
754
762
  CommandPrimitive.Group,
755
763
  {
756
764
  ref,
@@ -762,7 +770,7 @@ var CommandGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE
762
770
  }
763
771
  ));
764
772
  CommandGroup.displayName = CommandPrimitive.Group.displayName;
765
- var CommandSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
773
+ var CommandSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
766
774
  CommandPrimitive.Separator,
767
775
  {
768
776
  ref,
@@ -774,7 +782,7 @@ var CommandSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__
774
782
  }
775
783
  ));
776
784
  CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
777
- var CommandItem = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
785
+ var CommandItem = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
778
786
  CommandPrimitive.Item,
779
787
  {
780
788
  ref,
@@ -790,7 +798,7 @@ var CommandShortcut = ({
790
798
  className,
791
799
  ...props
792
800
  }) => {
793
- return /* @__PURE__ */ jsx2(
801
+ return /* @__PURE__ */ jsx3(
794
802
  "span",
795
803
  {
796
804
  className: cn(
@@ -806,10 +814,10 @@ CommandShortcut.displayName = "CommandShortcut";
806
814
  // lib/components/ui/popover.tsx
807
815
  import * as React2 from "react";
808
816
  import * as PopoverPrimitive from "@radix-ui/react-popover";
809
- import { jsx as jsx3 } from "react/jsx-runtime";
817
+ import { jsx as jsx4 } from "react/jsx-runtime";
810
818
  var Popover = PopoverPrimitive.Root;
811
819
  var PopoverTrigger = PopoverPrimitive.Trigger;
812
- var PopoverContent = React2.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx3(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx3(
820
+ var PopoverContent = React2.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx4(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx4(
813
821
  PopoverPrimitive.Content,
814
822
  {
815
823
  ref,
@@ -893,42 +901,47 @@ function getCurrentFolderContents(tree, currentFolder) {
893
901
  }
894
902
 
895
903
  // lib/components/RunFrameWithApi/EnhancedFileSelectorCombobox/EnhancedFileSelectorCombobox.tsx
896
- import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
897
- function getFileIcon(fileName) {
904
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
905
+ var defaultFileIcon = (fileName) => {
898
906
  if (fileName.endsWith(".tsx") || fileName.endsWith(".jsx")) {
899
- return /* @__PURE__ */ jsx4(Code, { className: "rf-h-4 rf-w-4 rf-text-blue-500" });
907
+ return /* @__PURE__ */ jsx5(Code, { className: "rf-h-4 rf-w-4 rf-text-blue-500" });
900
908
  }
901
909
  if (fileName.endsWith(".ts") || fileName.endsWith(".js")) {
902
- return /* @__PURE__ */ jsx4(Code, { className: "rf-h-4 rf-w-4 rf-text-yellow-600" });
910
+ return /* @__PURE__ */ jsx5(Code, { className: "rf-h-4 rf-w-4 rf-text-yellow-600" });
903
911
  }
904
912
  if (fileName.endsWith(".md") || fileName.endsWith(".txt")) {
905
- return /* @__PURE__ */ jsx4(FileText, { className: "rf-h-4 rf-w-4 rf-text-gray-600" });
913
+ return /* @__PURE__ */ jsx5(FileText, { className: "rf-h-4 rf-w-4 rf-text-gray-600" });
906
914
  }
907
- return /* @__PURE__ */ jsx4(File, { className: "rf-h-4 rf-w-4 rf-text-gray-500" });
908
- }
915
+ return /* @__PURE__ */ jsx5(File, { className: "rf-h-4 rf-w-4 rf-text-gray-500" });
916
+ };
917
+ var defaultFileFilter = (filename) => {
918
+ return (filename.endsWith(".tsx") || filename.endsWith(".ts") || filename.endsWith(".jsx") || filename.endsWith(".js")) && !filename.endsWith(".d.ts");
919
+ };
920
+ var defaultDisplayName = (filename) => {
921
+ return filename.split("/").pop() || "";
922
+ };
909
923
  var EnhancedFileSelectorCombobox = ({
910
924
  files,
911
925
  onFileChange,
912
- currentFile
926
+ currentFile,
927
+ config = {}
913
928
  }) => {
914
929
  const [open, setOpen] = useState3(false);
915
930
  const [file, setFile] = useState3(currentFile);
916
931
  const [currentFolder, setCurrentFolder] = useState3("");
917
932
  const [currentFileIndex, setCurrentFileIndex] = useState3(0);
918
933
  const [searchValue, setSearchValue] = useState3("");
934
+ const {
935
+ fileFilter = defaultFileFilter,
936
+ getDisplayName = defaultDisplayName,
937
+ placeholder = "Select file",
938
+ searchPlaceholder = "Search for file",
939
+ emptyMessage = "No files found in this directory."
940
+ } = config;
919
941
  useEffect4(() => {
920
942
  setFile(currentFile);
921
943
  }, [currentFile]);
922
- const filteredFiles = files.filter((file2) => {
923
- const fileName = file2.split("/").pop() ?? "";
924
- const lowerCaseFileName = fileName.toLowerCase();
925
- const isScriptFile = file2.endsWith(".tsx") || file2.endsWith(".ts") || file2.endsWith(".jsx") || file2.endsWith(".js");
926
- if (!isScriptFile || file2.endsWith(".d.ts")) return false;
927
- if (lowerCaseFileName.startsWith("test.tsx")) {
928
- return false;
929
- }
930
- return true;
931
- });
944
+ const filteredFiles = files.filter(fileFilter);
932
945
  const fileTree = parseFilesToTree(filteredFiles);
933
946
  const { files: currentFiles, folders: currentFolders } = getCurrentFolderContents(fileTree, currentFolder);
934
947
  const getSearchResults = () => {
@@ -959,38 +972,10 @@ var EnhancedFileSelectorCombobox = ({
959
972
  };
960
973
  const searchResults = getSearchResults();
961
974
  const isSearching = searchValue.trim().length > 0;
962
- const canGoBack = currentFolder !== "";
963
- const canGoLeft = currentFiles.length > 0 && currentFileIndex > 0;
964
- const canGoRight = currentFiles.length > 0 && currentFileIndex < currentFiles.length - 1;
965
975
  const navigateToFolder = (folderPath) => {
966
976
  setCurrentFolder(folderPath);
967
977
  setCurrentFileIndex(0);
968
978
  };
969
- const goBack = () => {
970
- if (currentFolder) {
971
- const parentPath = currentFolder.includes("/") ? currentFolder.substring(0, currentFolder.lastIndexOf("/")) : "";
972
- setCurrentFolder(parentPath);
973
- setCurrentFileIndex(0);
974
- }
975
- };
976
- const goLeft = () => {
977
- if (canGoLeft) {
978
- const newIndex = currentFileIndex - 1;
979
- setCurrentFileIndex(newIndex);
980
- const selectedFile = currentFiles[newIndex];
981
- setFile(selectedFile.path);
982
- onFileChange(selectedFile.path);
983
- }
984
- };
985
- const goRight = () => {
986
- if (canGoRight) {
987
- const newIndex = currentFileIndex + 1;
988
- setCurrentFileIndex(newIndex);
989
- const selectedFile = currentFiles[newIndex];
990
- setFile(selectedFile.path);
991
- onFileChange(selectedFile.path);
992
- }
993
- };
994
979
  const selectFile = (filePath, index) => {
995
980
  setFile(filePath);
996
981
  setCurrentFileIndex(index);
@@ -1012,7 +997,7 @@ var EnhancedFileSelectorCombobox = ({
1012
997
  const getDropdownWidth = () => {
1013
998
  return "rf-w-[400px] rf-min-w-[400px] rf-max-w-[400px]";
1014
999
  };
1015
- return /* @__PURE__ */ jsx4("div", { className: "rf-flex rf-items-center rf-gap-1", children: /* @__PURE__ */ jsxs3(
1000
+ return /* @__PURE__ */ jsx5("div", { className: "rf-flex rf-items-center rf-gap-1", children: /* @__PURE__ */ jsxs4(
1016
1001
  Popover,
1017
1002
  {
1018
1003
  open,
@@ -1021,38 +1006,38 @@ var EnhancedFileSelectorCombobox = ({
1021
1006
  if (!newOpen) setSearchValue("");
1022
1007
  },
1023
1008
  children: [
1024
- /* @__PURE__ */ jsx4(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs3(
1009
+ /* @__PURE__ */ jsx5(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs4(
1025
1010
  Button,
1026
1011
  {
1027
1012
  variant: "outline",
1028
1013
  role: "combobox",
1029
1014
  "aria-expanded": open,
1030
- className: "rf-w-fit rf-min-w-32 rf-max-w-64 rf-justify-center rf-items-center rf-gap-1 !rf-font-normal rf-min-w-0",
1015
+ className: "rf-w-fit rf-min-w-32 rf-max-w-64 rf-justify-center rf-items-center rf-gap-1 !rf-font-normal",
1031
1016
  children: [
1032
- /* @__PURE__ */ jsx4("span", { className: "rf-truncate rf-text-left", children: file ? file.split("/").pop() : "Select file" }),
1033
- /* @__PURE__ */ jsx4(ChevronsUpDown, { className: "rf-opacity-50 rf-flex-shrink-0" })
1017
+ /* @__PURE__ */ jsx5("span", { className: "rf-truncate rf-text-left", children: file ? getDisplayName(file) : placeholder }),
1018
+ /* @__PURE__ */ jsx5(ChevronsUpDown, { className: "rf-opacity-50 rf-flex-shrink-0" })
1034
1019
  ]
1035
1020
  }
1036
1021
  ) }),
1037
- /* @__PURE__ */ jsx4(
1022
+ /* @__PURE__ */ jsx5(
1038
1023
  PopoverContent,
1039
1024
  {
1040
1025
  className: cn(
1041
1026
  "!rf-p-0 !rf-overflow-x-auto !rf-z-[200]",
1042
1027
  getDropdownWidth()
1043
1028
  ),
1044
- children: /* @__PURE__ */ jsxs3(Command, { shouldFilter: false, children: [
1045
- /* @__PURE__ */ jsx4(
1029
+ children: /* @__PURE__ */ jsxs4(Command, { shouldFilter: false, children: [
1030
+ /* @__PURE__ */ jsx5(
1046
1031
  CommandInput,
1047
1032
  {
1048
- placeholder: "Search for file",
1033
+ placeholder: searchPlaceholder,
1049
1034
  className: "rf-h-9 rf-w-full",
1050
1035
  value: searchValue,
1051
1036
  onValueChange: setSearchValue
1052
1037
  }
1053
1038
  ),
1054
- /* @__PURE__ */ jsx4("div", { className: "rf-px-3 rf-py-2 rf-border-t rf-border-b rf-border-gray-200 rf-bg-slate-50", children: /* @__PURE__ */ jsxs3("div", { className: "rf-flex rf-items-center rf-text-xs rf-text-slate-600 rf-min-w-0 rf-overflow-hidden", children: [
1055
- /* @__PURE__ */ jsx4(
1039
+ /* @__PURE__ */ jsx5("div", { className: "rf-px-3 rf-py-2 rf-border-t rf-border-b rf-border-gray-200 rf-bg-slate-50", children: /* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-items-center rf-text-xs rf-text-slate-600 rf-min-w-0 rf-overflow-hidden", children: [
1040
+ /* @__PURE__ */ jsx5(
1056
1041
  "button",
1057
1042
  {
1058
1043
  onClick: () => navigateToFolder(""),
@@ -1062,20 +1047,20 @@ var EnhancedFileSelectorCombobox = ({
1062
1047
  ),
1063
1048
  currentFolder.split("/").filter(Boolean).map((segment, index, array) => {
1064
1049
  const pathToSegment = array.slice(0, index + 1).join("/");
1065
- return /* @__PURE__ */ jsxs3(
1050
+ return /* @__PURE__ */ jsxs4(
1066
1051
  "span",
1067
1052
  {
1068
1053
  className: "rf-flex rf-items-center rf-min-w-0",
1069
1054
  children: [
1070
- /* @__PURE__ */ jsx4("span", { className: "rf-mx-1 rf-flex-shrink-0", children: "/" }),
1071
- index === array.length - 1 ? /* @__PURE__ */ jsx4(
1055
+ /* @__PURE__ */ jsx5("span", { className: "rf-mx-1 rf-flex-shrink-0", children: "/" }),
1056
+ index === array.length - 1 ? /* @__PURE__ */ jsx5(
1072
1057
  "span",
1073
1058
  {
1074
1059
  className: "rf-text-slate-800 rf-truncate rf-max-w-[150px]",
1075
1060
  title: segment,
1076
1061
  children: segment
1077
1062
  }
1078
- ) : /* @__PURE__ */ jsx4(
1063
+ ) : /* @__PURE__ */ jsx5(
1079
1064
  "button",
1080
1065
  {
1081
1066
  onClick: () => navigateToFolder(pathToSegment),
@@ -1090,13 +1075,13 @@ var EnhancedFileSelectorCombobox = ({
1090
1075
  );
1091
1076
  })
1092
1077
  ] }) }),
1093
- /* @__PURE__ */ jsx4(CommandList, { className: "rf-max-h-[70vh] rf-overflow-y-auto", children: !isSearching ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
1094
- /* @__PURE__ */ jsx4(CommandEmpty, { children: "No files found in this directory." }),
1095
- currentFiles.length > 0 && /* @__PURE__ */ jsx4(
1078
+ /* @__PURE__ */ jsx5(CommandList, { className: "rf-max-h-[70vh] rf-overflow-y-auto", children: !isSearching ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
1079
+ /* @__PURE__ */ jsx5(CommandEmpty, { children: emptyMessage }),
1080
+ currentFiles.length > 0 && /* @__PURE__ */ jsx5(
1096
1081
  CommandGroup,
1097
1082
  {
1098
1083
  className: `rf-border-b rf-border-gray-200 rf-pb-1`,
1099
- children: currentFiles.map((fileNode, index) => /* @__PURE__ */ jsxs3(
1084
+ children: currentFiles.map((fileNode, index) => /* @__PURE__ */ jsxs4(
1100
1085
  CommandItem,
1101
1086
  {
1102
1087
  value: fileNode.path,
@@ -1105,9 +1090,9 @@ var EnhancedFileSelectorCombobox = ({
1105
1090
  fileNode.path === currentFile && "rf-font-medium"
1106
1091
  ),
1107
1092
  children: [
1108
- /* @__PURE__ */ jsx4("span", { className: "rf-mr-2", children: getFileIcon(fileNode.name) }),
1109
- fileNode.name,
1110
- /* @__PURE__ */ jsx4(
1093
+ /* @__PURE__ */ jsx5("span", { className: "rf-mr-2", children: defaultFileIcon(fileNode.name) }),
1094
+ getDisplayName(fileNode.name),
1095
+ /* @__PURE__ */ jsx5(
1111
1096
  Check,
1112
1097
  {
1113
1098
  className: cn(
@@ -1122,34 +1107,34 @@ var EnhancedFileSelectorCombobox = ({
1122
1107
  ))
1123
1108
  }
1124
1109
  ),
1125
- currentFolders.length > 0 && /* @__PURE__ */ jsx4(
1110
+ currentFolders.length > 0 && /* @__PURE__ */ jsx5(
1126
1111
  CommandGroup,
1127
1112
  {
1128
1113
  className: `rf-border-b rf-border-gray-200 rf-pb-1`,
1129
- children: currentFolders.map((folderNode) => /* @__PURE__ */ jsxs3(
1114
+ children: currentFolders.map((folderNode) => /* @__PURE__ */ jsxs4(
1130
1115
  CommandItem,
1131
1116
  {
1132
1117
  value: `folder-${folderNode.path}`,
1133
1118
  onSelect: () => navigateToFolder(folderNode.path),
1134
1119
  className: "rf-text-slate-600 hover:rf-text-slate-900",
1135
1120
  children: [
1136
- /* @__PURE__ */ jsx4(Folder, { className: "rf-mr-2 rf-h-4 rf-w-4 rf-text-blue-600" }),
1121
+ /* @__PURE__ */ jsx5(Folder, { className: "rf-mr-2 rf-h-4 rf-w-4 rf-text-blue-600" }),
1137
1122
  folderNode.name,
1138
- /* @__PURE__ */ jsx4(ChevronRight, { className: "rf-ml-auto rf-h-4 rf-w-4" })
1123
+ /* @__PURE__ */ jsx5(ChevronRight, { className: "rf-ml-auto rf-h-4 rf-w-4" })
1139
1124
  ]
1140
1125
  },
1141
1126
  folderNode.path
1142
1127
  ))
1143
1128
  }
1144
1129
  ),
1145
- currentFiles.length === 0 && currentFolders.length === 0 && /* @__PURE__ */ jsx4("div", { className: "rf-p-4 rf-text-center rf-text-slate-500 rf-text-sm", children: "No files or folders in this directory" })
1146
- ] }) : /* @__PURE__ */ jsx4(Fragment2, { children: searchResults.currentDirResults.length === 0 && searchResults.globalResults.length === 0 ? /* @__PURE__ */ jsxs3(CommandEmpty, { children: [
1130
+ currentFiles.length === 0 && currentFolders.length === 0 && /* @__PURE__ */ jsx5("div", { className: "rf-p-4 rf-text-center rf-text-slate-500 rf-text-sm", children: "No files or folders in this directory" })
1131
+ ] }) : /* @__PURE__ */ jsx5(Fragment2, { children: searchResults.currentDirResults.length === 0 && searchResults.globalResults.length === 0 ? /* @__PURE__ */ jsxs4(CommandEmpty, { children: [
1147
1132
  'No files found matching "',
1148
1133
  searchValue,
1149
1134
  '".'
1150
- ] }) : /* @__PURE__ */ jsxs3(Fragment2, { children: [
1151
- searchResults.currentDirResults.length > 0 && /* @__PURE__ */ jsx4(CommandGroup, { className: "rf-border-b rf-border-gray-200 rf-pb-1", children: searchResults.currentDirResults.map(
1152
- (file2, index) => /* @__PURE__ */ jsxs3(
1135
+ ] }) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
1136
+ searchResults.currentDirResults.length > 0 && /* @__PURE__ */ jsx5(CommandGroup, { className: "rf-border-b rf-border-gray-200 rf-pb-1", children: searchResults.currentDirResults.map(
1137
+ (file2, index) => /* @__PURE__ */ jsxs4(
1153
1138
  CommandItem,
1154
1139
  {
1155
1140
  value: file2.path,
@@ -1162,18 +1147,18 @@ var EnhancedFileSelectorCombobox = ({
1162
1147
  file2.path === currentFile && "rf-font-medium"
1163
1148
  ),
1164
1149
  children: [
1165
- /* @__PURE__ */ jsx4("span", { className: "rf-mr-2", children: getFileIcon(file2.fileName) }),
1166
- /* @__PURE__ */ jsxs3("div", { className: "rf-flex rf-items-center rf-w-full rf-min-w-0", children: [
1167
- /* @__PURE__ */ jsx4("span", { className: "rf-truncate rf-flex-1", children: file2.fileName }),
1168
- /* @__PURE__ */ jsx4("span", { className: "rf-text-xs rf-text-muted-foreground rf-ml-2 rf-truncate rf-max-w-[120px]", children: currentFolder || "/" }),
1169
- file2.path === currentFile && /* @__PURE__ */ jsx4(Check, { className: "rf-ml-2 rf-h-4 rf-w-4 rf-flex-shrink-0" })
1150
+ /* @__PURE__ */ jsx5("span", { className: "rf-mr-2", children: defaultFileIcon(file2.fileName) }),
1151
+ /* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-items-center rf-w-full rf-min-w-0", children: [
1152
+ /* @__PURE__ */ jsx5("span", { className: "rf-truncate rf-flex-1", children: getDisplayName(file2.fileName) }),
1153
+ /* @__PURE__ */ jsx5("span", { className: "rf-text-xs rf-text-muted-foreground rf-ml-2 rf-truncate rf-max-w-[120px]", children: currentFolder || "/" }),
1154
+ file2.path === currentFile && /* @__PURE__ */ jsx5(Check, { className: "rf-ml-2 rf-h-4 rf-w-4 rf-flex-shrink-0" })
1170
1155
  ] })
1171
1156
  ]
1172
1157
  },
1173
1158
  file2.path
1174
1159
  )
1175
1160
  ) }),
1176
- searchResults.globalResults.length > 0 && /* @__PURE__ */ jsx4(CommandGroup, { className: "rf-pb-1", children: searchResults.globalResults.map((file2) => /* @__PURE__ */ jsxs3(
1161
+ searchResults.globalResults.length > 0 && /* @__PURE__ */ jsx5(CommandGroup, { className: "rf-pb-1", children: searchResults.globalResults.map((file2) => /* @__PURE__ */ jsxs4(
1177
1162
  CommandItem,
1178
1163
  {
1179
1164
  value: file2.path,
@@ -1186,14 +1171,14 @@ var EnhancedFileSelectorCombobox = ({
1186
1171
  file2.path === currentFile && "rf-font-medium"
1187
1172
  ),
1188
1173
  children: [
1189
- /* @__PURE__ */ jsx4("span", { className: "rf-mr-2", children: getFileIcon(file2.fileName) }),
1190
- /* @__PURE__ */ jsxs3("div", { className: "rf-flex rf-items-center rf-w-full rf-min-w-0", children: [
1191
- /* @__PURE__ */ jsx4("span", { className: "rf-truncate rf-flex-1", children: file2.fileName }),
1192
- /* @__PURE__ */ jsx4("span", { className: "rf-text-xs rf-text-muted-foreground rf-ml-2 rf-truncate rf-max-w-[120px]", children: file2.path.substring(
1174
+ /* @__PURE__ */ jsx5("span", { className: "rf-mr-2", children: defaultFileIcon(file2.fileName) }),
1175
+ /* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-items-center rf-w-full rf-min-w-0", children: [
1176
+ /* @__PURE__ */ jsx5("span", { className: "rf-truncate rf-flex-1", children: getDisplayName(file2.fileName) }),
1177
+ /* @__PURE__ */ jsx5("span", { className: "rf-text-xs rf-text-muted-foreground rf-ml-2 rf-truncate rf-max-w-[120px]", children: file2.path.substring(
1193
1178
  0,
1194
1179
  file2.path.lastIndexOf("/")
1195
1180
  ) || "/" }),
1196
- file2.path === currentFile && /* @__PURE__ */ jsx4(Check, { className: "rf-ml-2 rf-h-4 rf-w-4 rf-flex-shrink-0" })
1181
+ file2.path === currentFile && /* @__PURE__ */ jsx5(Check, { className: "rf-ml-2 rf-h-4 rf-w-4 rf-flex-shrink-0" })
1197
1182
  ] })
1198
1183
  ]
1199
1184
  },
@@ -1209,7 +1194,7 @@ var EnhancedFileSelectorCombobox = ({
1209
1194
  };
1210
1195
 
1211
1196
  // lib/components/RunFrameWithApi/RunFrameWithApi.tsx
1212
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
1197
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
1213
1198
  var debug3 = Debug2("run-frame:RunFrameWithApi");
1214
1199
  var guessEntrypoint = (files) => files.find((file) => file.includes("entrypoint.")) ?? files.find((file) => file.includes("index.")) ?? files.find((file) => file.includes("main.")) ?? files.find((file) => file.endsWith(".tsx"));
1215
1200
  var guessManualEditsFilePath = (files) => files.find((file) => file.includes("manual-edits.")) ?? files.find((file) => file.includes("manual-edit.")) ?? files.find((file) => file.endsWith(".json"));
@@ -1283,7 +1268,7 @@ var RunFrameWithApi = (props) => {
1283
1268
  } : {},
1284
1269
  [componentPath]
1285
1270
  );
1286
- return /* @__PURE__ */ jsx5(
1271
+ return /* @__PURE__ */ jsx6(
1287
1272
  RunFrame,
1288
1273
  {
1289
1274
  fsMap,
@@ -1293,9 +1278,9 @@ var RunFrameWithApi = (props) => {
1293
1278
  forceLatestEvalVersion: props.forceLatestEvalVersion,
1294
1279
  evalWebWorkerBlobUrl: props.evalWebWorkerBlobUrl ?? props.workerBlobUrl,
1295
1280
  enableFetchProxy: props.enableFetchProxy,
1296
- leftHeaderContent: /* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-items-center rf-justify-between rf-w-full", children: [
1281
+ leftHeaderContent: /* @__PURE__ */ jsxs5("div", { className: "rf-flex rf-items-center rf-justify-between rf-w-full", children: [
1297
1282
  props.leftHeaderContent,
1298
- props.showFilesSwitch && /* @__PURE__ */ jsx5("div", { className: "rf-absolute rf-left-1/2 rf-transform rf--translate-x-1/2", children: /* @__PURE__ */ jsx5(
1283
+ props.showFilesSwitch && /* @__PURE__ */ jsx6("div", { className: "rf-absolute rf-left-1/2 rf-transform rf--translate-x-1/2", children: /* @__PURE__ */ jsx6(
1299
1284
  EnhancedFileSelectorCombobox,
1300
1285
  {
1301
1286
  currentFile: componentPath,
@@ -1356,7 +1341,7 @@ var RunFrameWithApi = (props) => {
1356
1341
 
1357
1342
  // lib/components/RunFrameForCli/RunFrameForCli.tsx
1358
1343
  import { useCallback as useCallback3, useState as useState5 } from "react";
1359
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
1344
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1360
1345
  var RunFrameForCli = (props) => {
1361
1346
  const [shouldLoadLatestEval, setLoadLatestEval] = useLocalStorageState(
1362
1347
  "load-latest-eval",
@@ -1376,7 +1361,7 @@ var RunFrameForCli = (props) => {
1376
1361
  const newUrl = `${window.location.pathname}${window.location.search}` + (newHash.length > 0 ? `#${newHash}` : "");
1377
1362
  window.history.replaceState(null, "", newUrl);
1378
1363
  }, []);
1379
- return /* @__PURE__ */ jsx6(
1364
+ return /* @__PURE__ */ jsx7(
1380
1365
  RunFrameWithApi,
1381
1366
  {
1382
1367
  debug: props.debug,
@@ -1389,8 +1374,8 @@ var RunFrameForCli = (props) => {
1389
1374
  enableFetchProxy: props.enableFetchProxy,
1390
1375
  initialMainComponentPath,
1391
1376
  onMainComponentPathChange: updateMainComponentHash,
1392
- leftHeaderContent: /* @__PURE__ */ jsxs5("div", { className: "rf-flex rf-items-center rf-justify-between", children: [
1393
- /* @__PURE__ */ jsx6(
1377
+ leftHeaderContent: /* @__PURE__ */ jsxs6("div", { className: "rf-flex rf-items-center rf-justify-between", children: [
1378
+ /* @__PURE__ */ jsx7(
1394
1379
  FileMenuLeftHeader,
1395
1380
  {
1396
1381
  isWebEmbedded: false,
@@ -1406,15 +1391,249 @@ var RunFrameForCli = (props) => {
1406
1391
  }
1407
1392
  );
1408
1393
  };
1394
+
1395
+ // lib/components/RunFrameStaticBuildViewer/RunFrameStaticBuildViewer.tsx
1396
+ import { useCallback as useCallback4, useEffect as useEffect6, useState as useState6 } from "react";
1397
+
1398
+ // lib/components/RunFrameStaticBuildViewer/CircuitJsonFileSelectorCombobox.tsx
1399
+ import { jsx as jsx8 } from "react/jsx-runtime";
1400
+ var circuitJsonConfig = {
1401
+ fileFilter: () => true,
1402
+ placeholder: "Select circuit",
1403
+ searchPlaceholder: "Search for circuit file",
1404
+ emptyMessage: "No circuit files found in this directory."
1405
+ };
1406
+ var CircuitJsonFileSelectorCombobox = ({
1407
+ files,
1408
+ onFileChange,
1409
+ currentFile
1410
+ }) => {
1411
+ return /* @__PURE__ */ jsx8(
1412
+ EnhancedFileSelectorCombobox,
1413
+ {
1414
+ files,
1415
+ onFileChange,
1416
+ currentFile,
1417
+ config: circuitJsonConfig
1418
+ }
1419
+ );
1420
+ };
1421
+
1422
+ // lib/components/RunFrameStaticBuildViewer/RunFrameStaticBuildViewer.tsx
1423
+ import { ErrorBoundary } from "react-error-boundary";
1424
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1425
+ var RunFrameStaticBuildViewer = (props) => {
1426
+ useStyles();
1427
+ const [currentCircuitJsonPath, setCurrentCircuitJsonPath] = useState6(
1428
+ () => {
1429
+ return props.initialCircuitPath ?? "";
1430
+ }
1431
+ );
1432
+ const [circuitJson, setCircuitJson] = useState6(null);
1433
+ const [isLoadingCurrentFile, setIsLoadingCurrentFile] = useState6(false);
1434
+ const [fileCache, setFileCache] = useState6({});
1435
+ const [loadingFiles, setLoadingFiles] = useState6(/* @__PURE__ */ new Set());
1436
+ const [failedFiles, setFailedFiles] = useState6(/* @__PURE__ */ new Set());
1437
+ const fileReferences = props.files;
1438
+ const availableFiles = fileReferences.map((f) => f.filePath);
1439
+ const defaultFetchFile = useCallback4(
1440
+ async (fileRef) => {
1441
+ if (!fileRef.fileStaticAssetUrl) {
1442
+ throw new Error(
1443
+ `No fileStaticAssetUrl provided for ${fileRef.filePath}`
1444
+ );
1445
+ }
1446
+ const response = await fetch(fileRef.fileStaticAssetUrl);
1447
+ if (!response.ok) {
1448
+ throw new Error(
1449
+ `Failed to fetch ${fileRef.filePath}: ${response.statusText}`
1450
+ );
1451
+ }
1452
+ return await response.json();
1453
+ },
1454
+ []
1455
+ );
1456
+ const loadCircuitJsonFile = useCallback4(
1457
+ async (filePath) => {
1458
+ if (fileCache[filePath]) {
1459
+ setCircuitJson(fileCache[filePath]);
1460
+ props.onCircuitJsonPathChange?.(filePath);
1461
+ return;
1462
+ }
1463
+ if (failedFiles.has(filePath)) {
1464
+ console.warn(`Skipping failed file: ${filePath}`);
1465
+ setCircuitJson(null);
1466
+ return;
1467
+ }
1468
+ if (loadingFiles.has(filePath)) {
1469
+ return;
1470
+ }
1471
+ setLoadingFiles((prev) => new Set(prev).add(filePath));
1472
+ setIsLoadingCurrentFile(true);
1473
+ setCircuitJson(null);
1474
+ try {
1475
+ const fileRef = fileReferences.find((f) => f.filePath === filePath);
1476
+ if (!fileRef) {
1477
+ throw new Error(`File reference not found for ${filePath}`);
1478
+ }
1479
+ const fetchFn = props.onFetchFile || defaultFetchFile;
1480
+ const circuitJsonData = await fetchFn(fileRef);
1481
+ setFileCache((prev) => ({ ...prev, [filePath]: circuitJsonData }));
1482
+ setCircuitJson(circuitJsonData);
1483
+ props.onCircuitJsonPathChange?.(filePath);
1484
+ setFailedFiles((prev) => {
1485
+ const newSet = new Set(prev);
1486
+ newSet.delete(filePath);
1487
+ return newSet;
1488
+ });
1489
+ } catch (error) {
1490
+ console.error(`Failed to load circuit JSON file ${filePath}:`, error);
1491
+ setFailedFiles((prev) => new Set(prev).add(filePath));
1492
+ setCircuitJson(null);
1493
+ } finally {
1494
+ setLoadingFiles((prev) => {
1495
+ const newSet = new Set(prev);
1496
+ newSet.delete(filePath);
1497
+ return newSet;
1498
+ });
1499
+ setIsLoadingCurrentFile(false);
1500
+ }
1501
+ },
1502
+ [
1503
+ fileReferences,
1504
+ fileCache,
1505
+ loadingFiles,
1506
+ failedFiles,
1507
+ props.onFetchFile,
1508
+ props.onCircuitJsonPathChange,
1509
+ defaultFetchFile
1510
+ ]
1511
+ );
1512
+ useEffect6(() => {
1513
+ if (availableFiles.length === 0) return;
1514
+ let selectedPath = currentCircuitJsonPath;
1515
+ if (!selectedPath || !availableFiles.includes(selectedPath)) {
1516
+ selectedPath = guessEntrypoint(availableFiles) ?? availableFiles[0];
1517
+ setCurrentCircuitJsonPath(selectedPath);
1518
+ }
1519
+ if (selectedPath && availableFiles.includes(selectedPath)) {
1520
+ loadCircuitJsonFile(selectedPath);
1521
+ }
1522
+ }, [currentCircuitJsonPath]);
1523
+ const handleFileChange = useCallback4((newPath) => {
1524
+ setCurrentCircuitJsonPath(newPath);
1525
+ }, []);
1526
+ const retryFailedFile = useCallback4(
1527
+ (filePath) => {
1528
+ setFailedFiles((prev) => {
1529
+ const newSet = new Set(prev);
1530
+ newSet.delete(filePath);
1531
+ return newSet;
1532
+ });
1533
+ loadCircuitJsonFile(filePath);
1534
+ },
1535
+ [loadCircuitJsonFile]
1536
+ );
1537
+ if (availableFiles.length === 0) {
1538
+ return /* @__PURE__ */ jsx9("div", { className: "rf-flex rf-flex-col rf-w-full rf-h-full rf-items-center rf-justify-center", children: /* @__PURE__ */ jsxs7("div", { className: "rf-text-center rf-p-8", children: [
1539
+ /* @__PURE__ */ jsx9("h3", { className: "rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-2", children: "No Circuit JSON Files Found" }),
1540
+ /* @__PURE__ */ jsx9("p", { className: "rf-text-sm rf-text-gray-600", children: "Please provide circuit JSON files to view." })
1541
+ ] }) });
1542
+ }
1543
+ const currentFileFailed = failedFiles.has(currentCircuitJsonPath);
1544
+ return /* @__PURE__ */ jsx9(
1545
+ ErrorBoundary,
1546
+ {
1547
+ fallbackRender: ({ error }) => /* @__PURE__ */ jsx9("div", { className: "rf-mt-4 rf-mx-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200", children: /* @__PURE__ */ jsxs7("div", { className: "rf-p-4", children: [
1548
+ /* @__PURE__ */ jsx9("h3", { className: "rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3", children: "Error loading Circuit JSON Preview" }),
1549
+ /* @__PURE__ */ jsx9("p", { className: "rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2", children: error.message })
1550
+ ] }) }),
1551
+ children: currentFileFailed ? /* @__PURE__ */ jsxs7("div", { className: "rf-w-full rf-h-full rf-flex rf-flex-col", children: [
1552
+ /* @__PURE__ */ jsxs7("div", { className: "rf-flex rf-items-center rf-justify-between rf-w-full rf-p-4 rf-border-b rf-border-gray-200", children: [
1553
+ (props.showFileMenu ?? true) && /* @__PURE__ */ jsx9(
1554
+ FileMenuLeftHeader,
1555
+ {
1556
+ isWebEmbedded: false,
1557
+ circuitJson: null,
1558
+ projectName: props.projectName
1559
+ }
1560
+ ),
1561
+ availableFiles.length > 1 && /* @__PURE__ */ jsx9("div", { className: "rf-absolute rf-left-1/2 rf-transform rf--translate-x-1/2 rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */ jsx9(
1562
+ CircuitJsonFileSelectorCombobox,
1563
+ {
1564
+ currentFile: currentCircuitJsonPath,
1565
+ files: availableFiles,
1566
+ onFileChange: handleFileChange
1567
+ }
1568
+ ) })
1569
+ ] }),
1570
+ /* @__PURE__ */ jsx9("div", { className: "rf-flex-1 rf-flex rf-items-center rf-justify-center", children: /* @__PURE__ */ jsxs7("div", { className: "rf-text-center rf-p-8", children: [
1571
+ /* @__PURE__ */ jsx9("h3", { className: "rf-text-lg rf-font-semibold rf-text-red-600 rf-mb-2", children: "Failed to Load Circuit File" }),
1572
+ /* @__PURE__ */ jsxs7("p", { className: "rf-text-sm rf-text-gray-600 rf-mb-4", children: [
1573
+ "Could not load: ",
1574
+ currentCircuitJsonPath
1575
+ ] }),
1576
+ /* @__PURE__ */ jsxs7("div", { className: "rf-flex rf-flex-col rf-items-center rf-gap-2", children: [
1577
+ /* @__PURE__ */ jsx9(
1578
+ "button",
1579
+ {
1580
+ onClick: () => retryFailedFile(currentCircuitJsonPath),
1581
+ className: "rf-px-4 rf-py-2 rf-bg-blue-500 rf-text-white rf-rounded rf-hover:bg-blue-600",
1582
+ children: "Retry"
1583
+ }
1584
+ ),
1585
+ availableFiles.length > 1 && /* @__PURE__ */ jsx9("p", { className: "rf-text-xs rf-text-gray-500", children: "Or select a different file from the dropdown above" })
1586
+ ] })
1587
+ ] }) })
1588
+ ] }) : /* @__PURE__ */ jsx9(
1589
+ CircuitJsonPreview,
1590
+ {
1591
+ circuitJson,
1592
+ defaultToFullScreen: props.defaultToFullScreen,
1593
+ showToggleFullScreen: props.showToggleFullScreen,
1594
+ showFileMenu: false,
1595
+ isWebEmbedded: false,
1596
+ projectName: props.projectName,
1597
+ leftHeaderContent: /* @__PURE__ */ jsxs7("div", { className: "rf-flex rf-items-center rf-justify-between rf-w-full", children: [
1598
+ (props.showFileMenu ?? true) && /* @__PURE__ */ jsx9(
1599
+ FileMenuLeftHeader,
1600
+ {
1601
+ isWebEmbedded: false,
1602
+ circuitJson,
1603
+ projectName: props.projectName
1604
+ }
1605
+ ),
1606
+ availableFiles.length > 1 && /* @__PURE__ */ jsx9(
1607
+ "div",
1608
+ {
1609
+ className: `rf-absolute rf-left-1/2 rf-transform rf--translate-x-1/2 rf-flex rf-items-center rf-gap-2 ${isLoadingCurrentFile ? "rf-opacity-50" : ""}`,
1610
+ children: /* @__PURE__ */ jsx9(
1611
+ CircuitJsonFileSelectorCombobox,
1612
+ {
1613
+ currentFile: currentCircuitJsonPath,
1614
+ files: availableFiles,
1615
+ onFileChange: handleFileChange
1616
+ }
1617
+ )
1618
+ }
1619
+ )
1620
+ ] })
1621
+ }
1622
+ )
1623
+ }
1624
+ );
1625
+ };
1409
1626
  export {
1410
1627
  BomTable,
1411
1628
  CadViewer,
1629
+ CircuitJsonFileSelectorCombobox,
1412
1630
  CircuitJsonPreview,
1413
1631
  ImportComponentDialog,
1414
1632
  PCBViewer as PcbViewer,
1415
1633
  PcbViewerWithContainerHeight,
1416
1634
  RunFrame,
1417
1635
  RunFrameForCli,
1636
+ RunFrameStaticBuildViewer,
1418
1637
  RunFrameWithApi,
1419
1638
  SchematicViewer,
1420
1639
  guessEntrypoint,