@digi-frontend/dgate-api-documentation 4.0.0-beta.3 → 4.0.0-beta.4

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.cjs CHANGED
@@ -28,20 +28,20 @@ let react = require("react");
28
28
  let react$1 = __toESM(react, 1);
29
29
  react = __toESM(react);
30
30
  let antd = require("antd");
31
- let _ant_design_icons = require("@ant-design/icons");
32
- let react_jsx_runtime = require("react/jsx-runtime");
33
31
  let _ant_design_cssinjs = require("@ant-design/cssinjs");
34
- let antd_es_typography_Text = require("antd/es/typography/Text");
35
- antd_es_typography_Text = __toESM(antd_es_typography_Text, 1);
32
+ let react_jsx_runtime = require("react/jsx-runtime");
33
+ let antd_es_typography_Text_js = require("antd/es/typography/Text.js");
34
+ antd_es_typography_Text_js = __toESM(antd_es_typography_Text_js, 1);
35
+ let _ant_design_icons = require("@ant-design/icons");
36
36
  let re_resizable = require("re-resizable");
37
- let antd_es_typography_Title = require("antd/es/typography/Title");
38
- antd_es_typography_Title = __toESM(antd_es_typography_Title, 1);
39
- let nanoid = require("nanoid");
37
+ let antd_es_typography_Title_js = require("antd/es/typography/Title.js");
38
+ antd_es_typography_Title_js = __toESM(antd_es_typography_Title_js, 1);
40
39
  let react_syntax_highlighter = require("react-syntax-highlighter");
41
40
  let react_syntax_highlighter_dist_esm_languages_hljs_json_js = require("react-syntax-highlighter/dist/esm/languages/hljs/json.js");
42
41
  react_syntax_highlighter_dist_esm_languages_hljs_json_js = __toESM(react_syntax_highlighter_dist_esm_languages_hljs_json_js, 1);
43
42
  let react_syntax_highlighter_dist_esm_styles_hljs_index_js = require("react-syntax-highlighter/dist/esm/styles/hljs/index.js");
44
43
  react_syntax_highlighter_dist_esm_styles_hljs_index_js = __toESM(react_syntax_highlighter_dist_esm_styles_hljs_index_js, 1);
44
+ let nanoid = require("nanoid");
45
45
  //#region src/store/slices/view.ts
46
46
  const createViewSlice = (set) => ({ view: {
47
47
  selectedNodeKey: null,
@@ -451,41 +451,41 @@ var token = {
451
451
  };
452
452
  //#endregion
453
453
  //#region src/view/helper/sidebar.utils.ts
454
- const methodColors = {
454
+ const methodColors$1 = {
455
455
  GET: {
456
- bg: "transparent",
456
+ bg: token.colorPrimaryBgHover,
457
457
  color: token.colorPrimary
458
458
  },
459
459
  POST: {
460
- bg: "transparent",
460
+ bg: token["green.1"],
461
461
  color: token.colorSuccess
462
462
  },
463
463
  DELETE: {
464
- bg: "transparent",
464
+ bg: token.colorErrorBg,
465
465
  color: token.colorError
466
466
  },
467
467
  PUT: {
468
- bg: "transparent",
468
+ bg: token.colorWarningBg,
469
469
  color: token.colorWarning
470
470
  },
471
471
  PATCH: {
472
- bg: "transparent",
472
+ bg: token["volcano.1"],
473
473
  color: token["volcano.5"]
474
474
  },
475
475
  OPTIONS: {
476
- bg: "transparent",
476
+ bg: token["geekblue.2"],
477
477
  color: token["geekblue.6"]
478
478
  },
479
479
  HEAD: {
480
- bg: "transparent",
480
+ bg: token["purple.1"],
481
481
  color: token["purple.5"]
482
482
  },
483
483
  TRACE: {
484
- bg: "transparent",
485
- color: token["volcano.4"]
484
+ bg: token["cyan.1"],
485
+ color: token["cyan.5"]
486
486
  }
487
487
  };
488
- const darkerMethodColors = {
488
+ const darkerMethodColors$1 = {
489
489
  GET: {
490
490
  bg: token.colorPrimary,
491
491
  color: "#FFFFFF"
@@ -519,70 +519,18 @@ const darkerMethodColors = {
519
519
  color: "#FFFFFF"
520
520
  }
521
521
  };
522
- const sidebarMethodColors = {
523
- GET: {
524
- bg: token.colorPrimaryBgHover,
525
- color: token.colorPrimary
526
- },
527
- POST: {
528
- bg: token.colorSuccessBg,
529
- color: token.colorSuccess
530
- },
531
- DELETE: {
532
- bg: token.colorErrorBg,
533
- color: token.colorError
534
- },
535
- PUT: {
536
- bg: token.colorWarningBg,
537
- color: token.colorWarning
538
- },
539
- PATCH: {
540
- bg: token["volcano.1"],
541
- color: token["volcano.5"]
542
- },
543
- OPTIONS: {
544
- bg: token["geekblue.2"],
545
- color: token["geekblue.6"]
546
- },
547
- HEAD: {
548
- bg: token["purple.1"],
549
- color: token["purple.5"]
550
- },
551
- TRACE: {
552
- bg: token["volcano.1"],
553
- color: token["volcano.4"]
554
- }
555
- };
556
- const buildTreeDataStructure = (data) => {
522
+ const buildTreeDataStructure$1 = (data) => {
557
523
  if (!data) return [];
558
524
  return data.map((api) => {
559
525
  const tagEntries = Object.entries(api.tags);
560
- const defaultTag = tagEntries.find(([tag]) => tag.toLowerCase() === "default");
561
- const nonDefaultTags = tagEntries.filter(([tag]) => tag.toLowerCase() !== "default");
562
- const defaultEndpoints = defaultTag ? defaultTag[1].map((endpoint) => ({
563
- title: endpoint.summary,
564
- key: endpoint.id,
565
- isLeaf: true,
526
+ const hasOnlyDefaultTag = tagEntries.length === 1 && tagEntries[0][0] === "default";
527
+ return {
528
+ title: api.title,
529
+ key: api.id,
566
530
  selectable: true,
567
- method: endpoint.method,
568
- data: {
569
- endpoint,
570
- api,
571
- tagName: "default",
572
- parentApiId: api.id
573
- }
574
- })) : [];
575
- const tagNodes = nonDefaultTags.map(([tag, endpoints]) => {
576
- const tagId = `tag-${api.id}-${tag.replace(/\s+/g, "-").toLowerCase()}`;
577
- return {
578
- title: tag,
579
- key: tagId,
580
- selectable: true,
581
- data: {
582
- tagName: tag,
583
- apiData: api
584
- },
585
- children: endpoints.map((endpoint) => ({
531
+ data: api,
532
+ children: hasOnlyDefaultTag ? tagEntries[0][1].map((endpoint) => {
533
+ return {
586
534
  title: endpoint.summary,
587
535
  key: endpoint.id,
588
536
  isLeaf: true,
@@ -591,19 +539,38 @@ const buildTreeDataStructure = (data) => {
591
539
  data: {
592
540
  endpoint,
593
541
  api,
594
- tagName: tag,
595
- parentApiId: api.id,
596
- tagId
542
+ tagName: "default",
543
+ parentApiId: api.id
597
544
  }
598
- }))
599
- };
600
- });
601
- return {
602
- title: api.title,
603
- key: api.id,
604
- selectable: true,
605
- data: api,
606
- children: [...tagNodes, ...defaultEndpoints]
545
+ };
546
+ }) : tagEntries.map(([tag, endpoints]) => {
547
+ const tagId = `tag-${api.id}-${tag.replace(/\s+/g, "-").toLowerCase()}`;
548
+ return {
549
+ title: tag,
550
+ key: tagId,
551
+ selectable: true,
552
+ data: {
553
+ tagName: tag,
554
+ apiData: api
555
+ },
556
+ children: endpoints.map((endpoint) => {
557
+ return {
558
+ title: endpoint.summary,
559
+ key: endpoint.id,
560
+ isLeaf: true,
561
+ selectable: true,
562
+ method: endpoint.method,
563
+ data: {
564
+ endpoint,
565
+ api,
566
+ tagName: tag,
567
+ parentApiId: api.id,
568
+ tagId
569
+ }
570
+ };
571
+ })
572
+ };
573
+ })
607
574
  };
608
575
  });
609
576
  };
@@ -617,7 +584,11 @@ const findNodeByKey = (nodes, targetKey) => {
617
584
  }
618
585
  return null;
619
586
  };
620
- const getAllTreeKeys = (data) => {
587
+ const isApiSectionHighlighted = (apiKey, selectedEndpoint) => {
588
+ if (!selectedEndpoint) return false;
589
+ return selectedEndpoint.parentApiId === apiKey;
590
+ };
591
+ const getAllTreeKeys$1 = (data) => {
621
592
  const keys = [];
622
593
  const traverse = (nodes) => {
623
594
  nodes.forEach((node) => {
@@ -628,7 +599,7 @@ const getAllTreeKeys = (data) => {
628
599
  traverse(data);
629
600
  return keys;
630
601
  };
631
- const filterTreeData = (data, searchText) => {
602
+ const filterTreeData$1 = (data, searchText) => {
632
603
  if (!searchText) return data;
633
604
  const findOriginalNode = (nodes, key) => {
634
605
  for (const node of nodes) {
@@ -661,12 +632,12 @@ const filterTreeData = (data, searchText) => {
661
632
  };
662
633
  return data.map((node) => filterNode(node)).filter((node) => node !== null);
663
634
  };
664
- const getSidebarStyles = (token, scope) => ({
635
+ const getSidebarStyles$1 = (token, scope) => ({
665
636
  [scope("sider")]: {
666
- backgroundColor: token.colorBgElevated,
637
+ backgroundColor: token.colorBgContainer,
638
+ overflowY: "auto",
667
639
  overflowX: "clip",
668
- borderRadius: token.borderRadius,
669
- height: "auto"
640
+ borderRadius: token.borderRadius
670
641
  },
671
642
  [scope("content")]: { padding: token.padding },
672
643
  [scope("controls")]: {
@@ -677,15 +648,11 @@ const getSidebarStyles = (token, scope) => ({
677
648
  [scope("search-input")]: { flex: 1 },
678
649
  [scope("tree")]: {
679
650
  backgroundColor: "transparent",
680
- width: "100%",
681
- "& .ant-tree-list": { width: "100%" },
682
- "& .ant-tree-list-holder-inner": { width: "100%" },
683
651
  "& .ant-tree-node-content-wrapper": {
684
652
  overflow: "hidden",
685
- flex: 1,
653
+ width: "100%",
686
654
  display: "flex",
687
- alignItems: "center",
688
- padding: "0 !important"
655
+ alignItems: "center"
689
656
  },
690
657
  "& .ant-tree-title": {
691
658
  width: "100%",
@@ -698,7 +665,7 @@ const getSidebarStyles = (token, scope) => ({
698
665
  width: "100%",
699
666
  padding: 0
700
667
  },
701
- "& .ant-tree-switcher": { backgroundColor: token.colorBgElevated }
668
+ "& .ant-tree-node-content-wrapper:hover": { backgroundColor: token.colorFillTertiary }
702
669
  },
703
670
  [scope("endpoint-item")]: {
704
671
  display: "flex",
@@ -706,28 +673,16 @@ const getSidebarStyles = (token, scope) => ({
706
673
  gap: token.marginXS,
707
674
  width: "100%",
708
675
  maxWidth: "100%",
709
- minWidth: "100%",
710
- paddingLeft: token.marginXS,
711
- paddingRight: token.marginXS
676
+ minWidth: "100%"
712
677
  },
713
678
  [scope("method-tag")]: {
714
- width: 51,
715
- height: 16,
716
- lineHeight: "16px",
717
- fontSize: 12,
679
+ minWidth: "3.75rem",
718
680
  textAlign: "center",
719
- border: "none",
720
- borderRadius: 6,
721
- padding: "0 8px",
722
- display: "inline-flex",
723
- alignItems: "center",
724
- justifyContent: "center"
681
+ border: "none"
725
682
  },
726
683
  [scope("endpoint-text")]: {
727
684
  flex: 1,
728
685
  maxWidth: "100%",
729
- minWidth: 0,
730
- overflow: "hidden",
731
686
  display: "block"
732
687
  },
733
688
  [scope("tag-title")]: {
@@ -741,29 +696,27 @@ const getSidebarStyles = (token, scope) => ({
741
696
  color: token.colorText,
742
697
  maxWidth: "100%",
743
698
  display: "block",
744
- paddingLeft: "4px",
745
- paddingRight: "4px",
746
- margin: 0
699
+ padding: 0,
700
+ margin: 0,
701
+ "&.highlighted": { color: token.colorPrimary }
747
702
  }
748
703
  });
749
704
  //#endregion
750
705
  //#region src/view/helper/sidebar.components.tsx
751
- const { Text: Text$3 } = antd.Typography;
752
- const EndpointItem = ({ method, title, cx, isSelected = false }) => {
753
- const methodStyle = (isSelected ? darkerMethodColors : sidebarMethodColors)[method];
754
- const isPost = method?.toUpperCase() === "POST";
706
+ const { Text: Text$6 } = antd.Typography;
707
+ const EndpointItem$1 = ({ method, title, cx, isSelected = false }) => {
708
+ const methodStyle = (isSelected ? darkerMethodColors$1 : methodColors$1)[method];
755
709
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
756
- className: `${cx("endpoint-item")}${isSelected ? ` ${cx("endpoint-item-selected")}` : ""}`,
710
+ className: cx("endpoint-item"),
757
711
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, {
758
712
  className: cx("method-tag"),
759
713
  style: {
760
714
  backgroundColor: methodStyle?.bg,
761
715
  color: methodStyle?.color,
762
- border: "none",
763
- ...isPost ? { borderRadius: 4 } : {}
716
+ border: "none"
764
717
  },
765
718
  children: method
766
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text$3, {
719
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text$6, {
767
720
  className: cx("endpoint-text"),
768
721
  ellipsis: { tooltip: title },
769
722
  style: { flex: 1 },
@@ -771,23 +724,25 @@ const EndpointItem = ({ method, title, cx, isSelected = false }) => {
771
724
  })]
772
725
  });
773
726
  };
774
- const convertToRenderableTreeData = (treeDataStructure, selectedEndpoint, cx) => {
727
+ const convertToRenderableTreeData$1 = (treeDataStructure, selectedEndpoint, cx) => {
775
728
  const renderNode = (node) => {
776
729
  let title;
777
730
  if (node.isLeaf && node.method) {
778
731
  const isSelected = selectedEndpoint && "data" in node && node.data && "endpoint" in node.data ? node.data.endpoint?.id === selectedEndpoint?.id : false;
779
- title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointItem, {
732
+ title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointItem$1, {
780
733
  method: node.method,
781
734
  title: typeof node.title === "string" ? node.title : "Endpoint Name",
782
735
  cx,
783
736
  isSelected
784
737
  });
785
- } else if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data)) title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text$3, {
786
- className: cx("api-title"),
787
- ellipsis: { tooltip: typeof node.title === "string" ? node.title : "API Name" },
788
- children: node.title
789
- });
790
- else title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text$3, {
738
+ } else if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data)) {
739
+ const isHighlighted = isApiSectionHighlighted(node.key, selectedEndpoint);
740
+ title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text$6, {
741
+ className: cx("api-title") + (isHighlighted ? " highlighted" : ""),
742
+ ellipsis: { tooltip: typeof node.title === "string" ? node.title : "API Name" },
743
+ children: node.title
744
+ });
745
+ } else title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text$6, {
791
746
  className: cx("tag-title"),
792
747
  ellipsis: { tooltip: typeof node.title === "string" ? node.title : "" },
793
748
  children: node.title
@@ -1091,17 +1046,15 @@ const NoDataIcon = ({ width = 298, height = 237, fill = "#F1F5FD", stroke = "#E0
1091
1046
  };
1092
1047
  //#endregion
1093
1048
  //#region src/view/components/Sidebar.tsx
1094
- const { useBreakpoint: useBreakpoint$4 } = antd.Grid;
1095
- const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
1049
+ const Sidebar$1 = ({ searchValue, setSearchValue }) => {
1096
1050
  const expandedKeys = useStore((state) => state.view.expandedKeys);
1097
1051
  const { selectedNodeKey, selectedEndpoint, builtTreeData, setExpandedKeys, setSelectedNodeKey } = useStore(({ view }) => view);
1098
1052
  const { selectNodeByKey, clearSelection } = useNodeSelection();
1099
1053
  const [autoExpandParent, setAutoExpandParent] = (0, react$1.useState)(true);
1100
- const isMobile = !useBreakpoint$4().md;
1101
- const { wrapSSR, cx, token } = useStyle("Sidebar", getSidebarStyles);
1054
+ const { wrapSSR, cx, token } = useStyle("Sidebar", getSidebarStyles$1);
1102
1055
  const handleSearch = (value) => {
1103
1056
  if (value && builtTreeData) {
1104
- setExpandedKeys(getAllTreeKeys(builtTreeData));
1057
+ setExpandedKeys(getAllTreeKeys$1(builtTreeData));
1105
1058
  setSearchValue(value);
1106
1059
  setAutoExpandParent(true);
1107
1060
  } else {
@@ -1112,7 +1065,7 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
1112
1065
  };
1113
1066
  const renderTreeData = (0, react$1.useMemo)(() => {
1114
1067
  if (!builtTreeData) return [];
1115
- return convertToRenderableTreeData(builtTreeData, selectedEndpoint, cx);
1068
+ return convertToRenderableTreeData$1(builtTreeData, selectedEndpoint, cx);
1116
1069
  }, [
1117
1070
  builtTreeData,
1118
1071
  selectedEndpoint,
@@ -1121,7 +1074,7 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
1121
1074
  const filteredTreeData = (0, react$1.useMemo)(() => {
1122
1075
  if (!searchValue) return renderTreeData;
1123
1076
  if (!builtTreeData) return [];
1124
- return convertToRenderableTreeData(filterTreeData(builtTreeData, searchValue), selectedEndpoint, cx);
1077
+ return convertToRenderableTreeData$1(filterTreeData$1(builtTreeData, searchValue), selectedEndpoint, cx);
1125
1078
  }, [
1126
1079
  builtTreeData,
1127
1080
  searchValue,
@@ -1142,96 +1095,9 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
1142
1095
  selectNodeByKey(selectedKey);
1143
1096
  setSelectedNodeKey(selectedKey);
1144
1097
  };
1145
- const inner = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1146
- className: cx("content"),
1147
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1148
- className: cx("controls"),
1149
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
1150
- title: "Search by APIs or Endpoints",
1151
- placement: "bottom",
1152
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Input, {
1153
- placeholder: "Search by APIs or Endpoints",
1154
- value: searchValue,
1155
- onChange: (e) => handleSearch(e.target.value),
1156
- allowClear: true,
1157
- className: cx("search-input"),
1158
- addonAfter: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.SearchOutlined, {})
1159
- })
1160
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
1161
- title: "Collapse All",
1162
- placement: "bottom",
1163
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
1164
- onClick: collapseAll,
1165
- title: "Collapse All",
1166
- icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Minify, {})
1167
- })
1168
- })]
1169
- }), filteredTreeData?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tree, {
1170
- showLine: { showLeafIcon: false },
1171
- showIcon: false,
1172
- switcherIcon: (nodeProps) => nodeProps.isLeaf ? null : nodeProps.expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.MinusSquareOutlined, { style: { fontSize: 12 } }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.PlusSquareOutlined, { style: { fontSize: 12 } }),
1173
- expandedKeys,
1174
- autoExpandParent,
1175
- selectedKeys: [selectedNodeKey || ""],
1176
- onSelect: (selectedKeys) => {
1177
- if (!selectedKeys?.length) return;
1178
- onTreeNodeSelect(selectedKeys);
1179
- setSelectedNodeKey(selectedKeys[0]);
1180
- onNodeSelect?.();
1181
- },
1182
- onExpand: (expandedKeysValue) => {
1183
- setExpandedKeys(expandedKeysValue);
1184
- setAutoExpandParent(false);
1185
- },
1186
- treeData: filteredTreeData,
1187
- className: cx("tree")
1188
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
1189
- justify: "center",
1190
- align: "center",
1191
- gap: token.marginSM,
1192
- vertical: true,
1193
- style: { marginTop: token.paddingXL },
1194
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoDataIcon, {
1195
- stroke: token.colorPrimaryHover,
1196
- fill: token.colorPrimaryBg,
1197
- width: "10.375rem",
1198
- height: "8.1875rem"
1199
- }), searchValue.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text.default, {
1200
- style: {
1201
- textAlign: "center",
1202
- fontFamily: token.fontFamily,
1203
- fontWeight: 400,
1204
- fontSize: token.fontSizeLG,
1205
- color: token.colorTextTertiary
1206
- },
1207
- children: "No results found"
1208
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd_es_typography_Text.default, {
1209
- style: {
1210
- textAlign: "center",
1211
- fontFamily: token.fontFamily,
1212
- fontWeight: 400,
1213
- fontSize: token.fontSizeLG,
1214
- color: token.colorTextTertiary
1215
- },
1216
- children: [
1217
- "No API",
1218
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {}),
1219
- "Documentation Found"
1220
- ]
1221
- })]
1222
- })]
1223
- });
1224
- if (isMobile) return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
1225
- className: cx("sider"),
1226
- style: {
1227
- width: "100%",
1228
- height: "100%"
1229
- },
1230
- children: inner
1231
- }));
1232
1098
  return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(re_resizable.Resizable, {
1233
1099
  as: "aside",
1234
- minWidth: isMobile ? 180 : 300,
1100
+ minWidth: 300,
1235
1101
  maxWidth: 386,
1236
1102
  enable: {
1237
1103
  top: false,
@@ -1244,21 +1110,97 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
1244
1110
  topLeft: false
1245
1111
  },
1246
1112
  defaultSize: {
1247
- width: isMobile ? 225 : 333,
1248
- height: "auto"
1113
+ width: 333,
1114
+ height: "100%"
1249
1115
  },
1250
1116
  className: cx("sider"),
1251
- children: inner
1252
- }));
1253
- };
1254
- //#endregion
1255
- //#region src/assets/link.tsx
1256
- const Link = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
1257
- width: "12",
1258
- height: "12",
1259
- viewBox: "0 0 12 12",
1260
- fill: "none",
1261
- xmlns: "http://www.w3.org/2000/svg",
1117
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1118
+ className: cx("content"),
1119
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1120
+ className: cx("controls"),
1121
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
1122
+ title: "Search by APIs or Endpoints",
1123
+ placement: "bottom",
1124
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Input, {
1125
+ placeholder: "Search by APIs or Endpoints",
1126
+ value: searchValue,
1127
+ onChange: (e) => handleSearch(e.target.value),
1128
+ allowClear: true,
1129
+ className: cx("search-input"),
1130
+ addonAfter: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.SearchOutlined, {})
1131
+ })
1132
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
1133
+ title: "Collapse All",
1134
+ placement: "bottom",
1135
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
1136
+ onClick: collapseAll,
1137
+ title: "Collapse All",
1138
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Minify, {})
1139
+ })
1140
+ })]
1141
+ }), filteredTreeData?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tree, {
1142
+ showLine: { showLeafIcon: false },
1143
+ showIcon: false,
1144
+ expandedKeys,
1145
+ autoExpandParent,
1146
+ selectedKeys: [selectedNodeKey || ""],
1147
+ onSelect: (selectedKeys) => {
1148
+ if (!selectedKeys?.length) return;
1149
+ onTreeNodeSelect(selectedKeys);
1150
+ setSelectedNodeKey(selectedKeys[0]);
1151
+ },
1152
+ onExpand: (expandedKeysValue) => {
1153
+ setExpandedKeys(expandedKeysValue);
1154
+ setAutoExpandParent(false);
1155
+ },
1156
+ treeData: filteredTreeData,
1157
+ className: cx("tree")
1158
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
1159
+ justify: "center",
1160
+ align: "center",
1161
+ gap: token.marginSM,
1162
+ vertical: true,
1163
+ style: { marginTop: token.paddingXL },
1164
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoDataIcon, {
1165
+ stroke: token.colorPrimaryHover,
1166
+ fill: token.colorPrimaryBg,
1167
+ width: "10.375rem",
1168
+ height: "8.1875rem"
1169
+ }), searchValue.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text_js.default, {
1170
+ style: {
1171
+ textAlign: "center",
1172
+ fontFamily: token.fontFamily,
1173
+ fontWeight: 400,
1174
+ fontSize: token.fontSizeLG,
1175
+ color: "rgba(0,0,0,0.45)"
1176
+ },
1177
+ children: "No results found"
1178
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd_es_typography_Text_js.default, {
1179
+ style: {
1180
+ textAlign: "center",
1181
+ fontFamily: token.fontFamily,
1182
+ fontWeight: 400,
1183
+ fontSize: token.fontSizeLG,
1184
+ color: "rgba(0,0,0,0.45)"
1185
+ },
1186
+ children: [
1187
+ "No API",
1188
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {}),
1189
+ "Documentation Found"
1190
+ ]
1191
+ })]
1192
+ })]
1193
+ })
1194
+ }));
1195
+ };
1196
+ //#endregion
1197
+ //#region src/assets/link.tsx
1198
+ const Link = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
1199
+ width: "12",
1200
+ height: "12",
1201
+ viewBox: "0 0 12 12",
1202
+ fill: "none",
1203
+ xmlns: "http://www.w3.org/2000/svg",
1262
1204
  ...props,
1263
1205
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
1264
1206
  d: "M3.875 9.25C2.085 9.25 0.625 7.79 0.625 6C0.625 4.21 2.085 2.75 3.875 2.75C4.08 2.75 4.25 2.92 4.25 3.125C4.25 3.33 4.08 3.5 3.875 3.5C2.495 3.5 1.375 4.62 1.375 6C1.375 7.38 2.495 8.5 3.875 8.5C5.255 8.5 6.375 7.38 6.375 6C6.375 5.795 6.545 5.625 6.75 5.625C6.955 5.625 7.125 5.795 7.125 6C7.125 7.79 5.665 9.25 3.875 9.25Z",
@@ -1402,7 +1344,7 @@ const ApiCard = ({ api, viewStyle }) => {
1402
1344
  });
1403
1345
  };
1404
1346
  const MethodChip = ({ method }) => {
1405
- const methodStyle = methodColors[method];
1347
+ const methodStyle = methodColors$1[method];
1406
1348
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1407
1349
  className: cx("method-chip"),
1408
1350
  style: {
@@ -1410,7 +1352,7 @@ const ApiCard = ({ api, viewStyle }) => {
1410
1352
  color: methodStyle?.color,
1411
1353
  border: "none"
1412
1354
  },
1413
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
1355
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title_js.default, {
1414
1356
  style: { color: methodStyle?.color },
1415
1357
  className: cx("chip-title"),
1416
1358
  level: 5,
@@ -1427,7 +1369,7 @@ const ApiCard = ({ api, viewStyle }) => {
1427
1369
  className: cx("list-container"),
1428
1370
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
1429
1371
  gap: token.marginSM,
1430
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MethodChip, { method: api.method }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
1372
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MethodChip, { method: api.method }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title_js.default, {
1431
1373
  className: cx("list-title"),
1432
1374
  level: 4,
1433
1375
  onClick: handleOpenEndPointView,
@@ -1441,7 +1383,7 @@ const ApiCard = ({ api, viewStyle }) => {
1441
1383
  }),
1442
1384
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1443
1385
  className: cx("list-content"),
1444
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Link, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text.default, {
1386
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Link, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text_js.default, {
1445
1387
  className: cx("path-name"),
1446
1388
  children: api?.path
1447
1389
  })]
@@ -1459,14 +1401,14 @@ const ApiCard = ({ api, viewStyle }) => {
1459
1401
  gap: token.marginSM,
1460
1402
  children: [
1461
1403
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MethodChip, { method: api?.method }),
1462
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
1404
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title_js.default, {
1463
1405
  className: cx("grid-title"),
1464
1406
  level: 4,
1465
1407
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltippedText, { text: api?.summary || "Endpoint Name" })
1466
1408
  }),
1467
1409
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1468
1410
  className: cx("grid-content"),
1469
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Link, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text.default, {
1411
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Link, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text_js.default, {
1470
1412
  className: cx("grid-path-name"),
1471
1413
  children: api?.path
1472
1414
  })]
@@ -1755,7 +1697,7 @@ const APIsRenderer = ({ apis, withTitle, tagName, haveUnderLine, contextPath, vi
1755
1697
  },
1756
1698
  vertical: true,
1757
1699
  children: [
1758
- withTitle && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
1700
+ withTitle && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title_js.default, {
1759
1701
  id: tagName,
1760
1702
  style: { marginBottom: 0 },
1761
1703
  level: 4,
@@ -1789,8 +1731,8 @@ const handleStatusColor = (code) => {
1789
1731
  };
1790
1732
  //#endregion
1791
1733
  //#region src/view/components/EndpointPage/EndpointPage.tsx
1792
- const { Title: Title$5, Paragraph } = antd.Typography;
1793
- const requestColumns = [
1734
+ const { Title: Title$7, Paragraph: Paragraph$1 } = antd.Typography;
1735
+ const requestColumns$1 = [
1794
1736
  {
1795
1737
  title: "Parameter",
1796
1738
  dataIndex: "param",
@@ -1807,8 +1749,8 @@ const requestColumns = [
1807
1749
  key: "enum"
1808
1750
  }
1809
1751
  ];
1810
- const responseColumns = [...requestColumns];
1811
- const buildRequestData = (params, token) => [...params].sort((a, b) => a.required === b.required ? 0 : a.required ? -1 : 1).map((p, index) => {
1752
+ const responseColumns$1 = [...requestColumns$1];
1753
+ const buildRequestData$1 = (params) => [...params].sort((a, b) => a.required === b.required ? 0 : a.required ? -1 : 1).map((p, index) => {
1812
1754
  let typeLabel = p.schema?.type;
1813
1755
  if (p.schema?.type === "array" && p.schema?.items?.type) typeLabel = `${p.schema.type}_${p.schema.items.type}`;
1814
1756
  return {
@@ -1817,17 +1759,17 @@ const buildRequestData = (params, token) => [...params].sort((a, b) => a.require
1817
1759
  p.name,
1818
1760
  typeLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1819
1761
  style: {
1820
- color: token.colorTextTertiary,
1762
+ color: "rgba(0,0,0,0.45)",
1821
1763
  marginLeft: "0.25rem",
1822
1764
  marginRight: "0.25rem"
1823
1765
  },
1824
1766
  children: typeLabel
1825
1767
  }),
1826
1768
  p.required ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1827
- style: { color: token.colorError },
1769
+ style: { color: "red" },
1828
1770
  children: "*"
1829
1771
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1830
- style: { color: token.colorSuccess },
1772
+ style: { color: "#52C41A" },
1831
1773
  children: "Optional"
1832
1774
  })
1833
1775
  ] }),
@@ -1835,7 +1777,7 @@ const buildRequestData = (params, token) => [...params].sort((a, b) => a.require
1835
1777
  enum: p.schema?.enum ? p.schema.enum.map((e) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, { children: e }, e)) : "--"
1836
1778
  };
1837
1779
  });
1838
- const buildHeaderData = (headers, token) => {
1780
+ const buildHeaderData$1 = (headers) => {
1839
1781
  if (!headers) return [];
1840
1782
  return Object.entries(headers).sort(([, a], [, b]) => a.required === b.required ? 0 : a.required ? -1 : 1).map(([name, header], idx) => {
1841
1783
  let typeLabel = header.schema?.type;
@@ -1846,17 +1788,17 @@ const buildHeaderData = (headers, token) => {
1846
1788
  name,
1847
1789
  typeLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1848
1790
  style: {
1849
- color: token.colorTextTertiary,
1791
+ color: "rgba(0,0,0,0.45)",
1850
1792
  marginLeft: "0.25rem",
1851
1793
  marginRight: "0.25rem"
1852
1794
  },
1853
1795
  children: typeLabel
1854
1796
  }),
1855
1797
  header.required ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1856
- style: { color: token.colorError },
1798
+ style: { color: "red" },
1857
1799
  children: "*"
1858
1800
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1859
- style: { color: token.colorSuccess },
1801
+ style: { color: "#52C41A" },
1860
1802
  children: "Optional"
1861
1803
  })
1862
1804
  ] }, idx),
@@ -1865,41 +1807,10 @@ const buildHeaderData = (headers, token) => {
1865
1807
  };
1866
1808
  });
1867
1809
  };
1868
- const buildRequestBodyData = (requestBody, token) => {
1869
- if (!requestBody?.content) return [];
1870
- const contentType = Object.keys(requestBody.content)[0];
1871
- const schema = requestBody.content[contentType]?.schema;
1872
- if (!schema) return [];
1873
- const properties = schema.properties ?? {};
1874
- const required = schema.required ?? [];
1875
- return Object.entries(properties).map(([name, prop], idx) => ({
1876
- key: idx,
1877
- param: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
1878
- name,
1879
- prop.type && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1880
- style: {
1881
- color: token.colorTextTertiary,
1882
- marginLeft: "0.25rem",
1883
- marginRight: "0.25rem"
1884
- },
1885
- children: prop.type
1886
- }),
1887
- required.includes(name) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1888
- style: { color: token.colorError },
1889
- children: "*"
1890
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1891
- style: { color: token.colorSuccess },
1892
- children: "Optional"
1893
- })
1894
- ] }),
1895
- desc: prop.description || "--",
1896
- enum: prop.enum ? prop.enum.map((e) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, { children: e }, e)) : "--"
1897
- }));
1898
- };
1899
- const EndpointPage = () => {
1900
- const { selectedEndpoint, selectedApi, selectedStatusCode, setSelectedNodeKey, setFocusedContent, setFocusedTag, setActiveRequestTab } = useStore(({ view }) => view);
1901
- const [activeTabKey, setActiveTabKey] = (0, react$1.useState)("header");
1902
- const { token } = antd.theme.useToken();
1810
+ const EndpointPage$1 = () => {
1811
+ const { selectedEndpoint, selectedApi, selectedStatusCode, setSelectedNodeKey, setFocusedContent, setFocusedTag } = useStore(({ view }) => view);
1812
+ const [endpointTooltip, setEndpointTooltip] = (0, react$1.useState)("Copy endpoint");
1813
+ const [selectedServer, setSelectedServer] = (0, react$1.useState)(0);
1903
1814
  const { cx } = useStyle("EndpointPage", (token, scope) => ({
1904
1815
  [scope("docs-endpoint-container")]: {
1905
1816
  display: "flex",
@@ -1925,88 +1836,62 @@ const EndpointPage = () => {
1925
1836
  marginBottom: token.marginLG
1926
1837
  },
1927
1838
  [scope("request-card")]: {
1928
- borderRadius: token.borderRadius,
1929
- backgroundColor: token.colorBgBase,
1930
1839
  ".ant-card-head": {
1931
1840
  minHeight: "unset",
1932
1841
  borderBottom: "unset",
1933
- padding: "0.75rem",
1934
- backgroundColor: token.colorBgBase
1842
+ padding: "0.75rem"
1935
1843
  },
1936
1844
  ".ant-card-body": {
1937
1845
  padding: "0px 0.75rem 0.75rem 0.75rem",
1938
- backgroundColor: token.colorBgBase,
1939
1846
  ".ant-tabs-tab": { paddingTop: "0" }
1940
- },
1941
- "& .ant-table": { backgroundColor: `${token.colorBgBase} !important` },
1942
- "& .ant-table-thead > tr > th": { backgroundColor: `${token.colorBgBase} !important` },
1943
- "& .ant-table-tbody > tr > td": { backgroundColor: `${token.colorBgBase} !important` }
1944
- },
1945
- [scope("row-odd")]: { "& > td": { background: `${token.colorBgElevated} !important` } },
1946
- [scope("row-even")]: { "& > td": { background: `${token.colorBgLayout} !important` } }
1847
+ }
1848
+ }
1947
1849
  }));
1948
- const methodStyle = sidebarMethodColors[selectedEndpoint?.method];
1949
- const headerParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || [], token);
1950
- const pathParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || [], token);
1951
- const queryParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || [], token);
1952
- const requestBodyData = buildRequestBodyData(selectedEndpoint?.requestBody, token);
1850
+ const methodStyle = methodColors$1[selectedEndpoint?.method];
1851
+ const headerParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || []);
1852
+ const pathParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || []);
1853
+ const queryParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || []);
1953
1854
  const requestTabs = [
1954
1855
  {
1955
1856
  key: "header",
1956
1857
  label: "Header",
1957
1858
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
1958
- columns: requestColumns,
1859
+ columns: requestColumns$1,
1959
1860
  dataSource: headerParams,
1960
1861
  pagination: false,
1961
1862
  bordered: true,
1962
- size: "small",
1963
- rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
1863
+ size: "small"
1964
1864
  })
1965
1865
  },
1966
1866
  {
1967
1867
  key: "path",
1968
1868
  label: "Path",
1969
1869
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
1970
- columns: requestColumns,
1870
+ columns: requestColumns$1,
1971
1871
  dataSource: pathParams,
1972
1872
  pagination: false,
1973
1873
  bordered: true,
1974
- size: "small",
1975
- rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
1874
+ size: "small"
1976
1875
  })
1977
1876
  },
1978
1877
  {
1979
1878
  key: "query",
1980
1879
  label: "Query",
1981
1880
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
1982
- columns: requestColumns,
1881
+ columns: requestColumns$1,
1983
1882
  dataSource: queryParams,
1984
1883
  pagination: false,
1985
1884
  bordered: true,
1986
- size: "small",
1987
- rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
1988
- })
1989
- },
1990
- ...requestBodyData.length > 0 ? [{
1991
- key: "requestBody",
1992
- label: "Request Body",
1993
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
1994
- columns: requestColumns,
1995
- dataSource: requestBodyData,
1996
- pagination: false,
1997
- bordered: true,
1998
- size: "small",
1999
- rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
1885
+ size: "small"
2000
1886
  })
2001
- }] : []
1887
+ }
2002
1888
  ].filter((t) => t !== null);
2003
- (0, react$1.useEffect)(() => {
2004
- const firstKey = requestTabs[0]?.key ?? "header";
2005
- setActiveTabKey(firstKey);
2006
- setActiveRequestTab(firstKey);
2007
- }, [selectedEndpoint?.id]);
2008
1889
  const responseHeaders = (selectedEndpoint?.responses?.[selectedStatusCode || 200])?.headers;
2009
- const responseHeaderData = buildHeaderData(responseHeaders, token);
1890
+ const responseHeaderData = buildHeaderData$1(responseHeaders);
1891
+ selectedApi?.servers?.map((server, index) => ({
1892
+ value: index,
1893
+ label: `${server.url}${selectedEndpoint?.path || ""}`
1894
+ }));
2010
1895
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2011
1896
  className: cx("docs-endpoint-container"),
2012
1897
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -2046,61 +1931,42 @@ const EndpointPage = () => {
2046
1931
  display: "flex",
2047
1932
  flexDirection: "row",
2048
1933
  alignItems: "center",
2049
- color: token.colorTextTertiary,
1934
+ color: "rgba(0,0,0,0.45)",
2050
1935
  gap: "0.25rem"
2051
1936
  },
2052
1937
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selectedEndpoint?.tagName || "default" })
2053
1938
  })
2054
1939
  },
2055
- { title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
2056
- title: selectedEndpoint?.summary || "Endpoint Name",
2057
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2058
- style: {
2059
- overflow: "hidden",
2060
- textOverflow: "ellipsis",
2061
- whiteSpace: "nowrap",
2062
- display: "block",
2063
- maxWidth: "300px"
2064
- },
2065
- children: selectedEndpoint?.summary || "Endpoint Name"
2066
- })
1940
+ { title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1941
+ style: {
1942
+ display: "flex",
1943
+ gap: "1rem"
1944
+ },
1945
+ children: selectedEndpoint?.summary || "Endpoint Name"
2067
1946
  }) }
2068
1947
  ] })]
2069
1948
  }),
2070
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Title$5, {
1949
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Title$7, {
2071
1950
  level: 3,
2072
- style: {
2073
- display: "flex",
2074
- alignItems: "center",
2075
- gap: 12,
2076
- margin: 0
2077
- },
2078
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, {
2079
- style: {
2080
- backgroundColor: methodStyle?.bg,
2081
- color: methodStyle?.color,
2082
- border: "none",
2083
- width: "4.375rem",
2084
- height: "1.375rem",
2085
- textAlign: "center",
2086
- flexShrink: 0
2087
- },
2088
- children: selectedEndpoint?.method
2089
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
2090
- title: selectedEndpoint?.summary ?? "--",
2091
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1951
+ children: [
1952
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, {
2092
1953
  style: {
2093
- overflow: "hidden",
2094
- textOverflow: "ellipsis",
2095
- whiteSpace: "nowrap"
1954
+ backgroundColor: methodStyle?.bg,
1955
+ color: methodStyle?.color,
1956
+ border: "none",
1957
+ width: "4.375rem",
1958
+ height: "1.375rem",
1959
+ textAlign: "center"
2096
1960
  },
2097
- children: selectedEndpoint?.summary?.replace(selectedEndpoint?.method, "") ?? "--"
2098
- })
2099
- })]
1961
+ children: selectedEndpoint?.method
1962
+ }),
1963
+ " ",
1964
+ selectedEndpoint?.summary?.replace(selectedEndpoint?.method, "") ?? "--"
1965
+ ]
2100
1966
  }),
2101
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Paragraph, {
1967
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Paragraph$1, {
2102
1968
  style: {
2103
- color: token.colorTextTertiary,
1969
+ color: "rgba(0,0,0,0.45)",
2104
1970
  marginBottom: "1.5rem"
2105
1971
  },
2106
1972
  children: selectedEndpoint?.description ?? "--"
@@ -2108,17 +1974,9 @@ const EndpointPage = () => {
2108
1974
  requestTabs.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Card, {
2109
1975
  title: "Request",
2110
1976
  className: cx("request-card"),
2111
- style: {
2112
- marginBottom: "1.5rem",
2113
- backgroundColor: token.colorBgBase
2114
- },
2115
- styles: { body: { backgroundColor: token.colorBgBase } },
1977
+ style: { marginBottom: "1.5rem" },
2116
1978
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tabs, {
2117
- activeKey: activeTabKey,
2118
- onChange: (key) => {
2119
- setActiveTabKey(key);
2120
- setActiveRequestTab(key);
2121
- },
1979
+ defaultActiveKey: requestTabs[0].key,
2122
1980
  items: requestTabs
2123
1981
  })
2124
1982
  }),
@@ -2134,12 +1992,11 @@ const EndpointPage = () => {
2134
1992
  marginRight: "0.5rem"
2135
1993
  } }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selectedStatusCode })] }),
2136
1994
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
2137
- columns: responseColumns,
1995
+ columns: responseColumns$1,
2138
1996
  dataSource: responseHeaderData,
2139
1997
  pagination: false,
2140
1998
  bordered: true,
2141
- size: "small",
2142
- rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
1999
+ size: "small"
2143
2000
  })
2144
2001
  })
2145
2002
  ]
@@ -2171,16 +2028,17 @@ const MouseSquare = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg"
2171
2028
  });
2172
2029
  //#endregion
2173
2030
  //#region src/view/components/MainContent.tsx
2174
- const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage }) => {
2031
+ const MainContent$1 = ({ searchEnabled, handleResetSearch, handleVisitLandingPage }) => {
2175
2032
  const { focusedContent, transformedData } = useStore(({ view }) => view);
2176
2033
  const { wrapSSR, cx, token } = useStyle("MainContent", (token, scope) => ({
2177
2034
  [scope("inner-doc-container")]: {
2035
+ backgroundColor: token.colorBgContainer,
2036
+ height: "100%",
2178
2037
  width: "100%",
2179
- height: "auto",
2038
+ maxHeight: "100%",
2039
+ overflow: "auto",
2180
2040
  borderRadius: token.borderRadius,
2181
- padding: token.paddingXL,
2182
- overflow: "hidden",
2183
- minWidth: 0
2041
+ padding: token.paddingXL
2184
2042
  },
2185
2043
  [scope("centered")]: {
2186
2044
  display: "flex",
@@ -2194,10 +2052,10 @@ const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage
2194
2052
  fontFamily: token.fontFamily,
2195
2053
  fontWeight: 600,
2196
2054
  fontSize: token.fontSizeHeading4,
2197
- color: token.colorText
2055
+ color: "rgba(0, 0, 0, 0.88)"
2198
2056
  },
2199
2057
  [scope("text")]: {
2200
- color: token.colorText,
2058
+ color: "rgba(0, 0, 0, 0.88)",
2201
2059
  fontFamily: token.fontFamily
2202
2060
  },
2203
2061
  [scope("visit-landing-button")]: {
@@ -2215,7 +2073,6 @@ const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage
2215
2073
  }));
2216
2074
  return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2217
2075
  className: cx("inner-doc-container", !transformedData?.length ? "centered" : ""),
2218
- style: { backgroundColor: focusedContent === "ENDPOINT" ? token.colorBgBase : token.colorBgElevated },
2219
2076
  children: !transformedData?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
2220
2077
  justify: "center",
2221
2078
  align: "center",
@@ -2234,11 +2091,11 @@ const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage
2234
2091
  align: "center",
2235
2092
  gap: "0.5rem",
2236
2093
  vertical: true,
2237
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
2094
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title_js.default, {
2238
2095
  className: cx("no-space", "title"),
2239
2096
  level: 4,
2240
2097
  children: !searchEnabled ? "No API Documentation Found" : "No results found"
2241
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text.default, {
2098
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text_js.default, {
2242
2099
  className: cx("no-space", "text"),
2243
2100
  children: !searchEnabled ? "No API Documentation has been added yet. Contact admin for support." : "Adjust your Search and try again"
2244
2101
  })]
@@ -2257,15 +2114,15 @@ const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage
2257
2114
  children: "Reset Search"
2258
2115
  })
2259
2116
  ]
2260
- }) : focusedContent === "ENDPOINT" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointPage, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(APIPage, {})
2117
+ }) : focusedContent === "ENDPOINT" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointPage$1, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(APIPage, {})
2261
2118
  }));
2262
2119
  };
2263
2120
  //#endregion
2264
2121
  //#region src/view/components/ApiPage/components/ApiDocumentationBar.tsx
2265
- const { useBreakpoint: useBreakpoint$3 } = antd.Grid;
2266
- const { Title: Title$3 } = antd.Typography;
2122
+ const { useBreakpoint: useBreakpoint$4 } = antd.Grid;
2123
+ const { Title: Title$5 } = antd.Typography;
2267
2124
  const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, hasChanges = false, switcherNode }) => {
2268
- const isMobile = !useBreakpoint$3().md;
2125
+ const isMobile = !useBreakpoint$4().md;
2269
2126
  const { wrapSSR, cx, token } = useStyle("ApiDocumentationBar", (token, scope) => ({
2270
2127
  [scope("root")]: {
2271
2128
  display: "flex",
@@ -2376,7 +2233,7 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
2376
2233
  className: cx("title-section"),
2377
2234
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
2378
2235
  title: apiName,
2379
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Title$3, {
2236
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Title$5, {
2380
2237
  level: 3,
2381
2238
  ellipsis: true,
2382
2239
  style: {
@@ -2414,7 +2271,7 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
2414
2271
  className: cx("title-section"),
2415
2272
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
2416
2273
  title: `${apiName} API Documentation`,
2417
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Title$3, {
2274
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Title$5, {
2418
2275
  level: 3,
2419
2276
  style: {
2420
2277
  margin: 0,
@@ -2468,9 +2325,9 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
2468
2325
  };
2469
2326
  //#endregion
2470
2327
  //#region src/view/components/ApiPage/components/GeneralSection.tsx
2471
- const { useBreakpoint: useBreakpoint$2 } = antd.Grid;
2328
+ const { useBreakpoint: useBreakpoint$3 } = antd.Grid;
2472
2329
  const GeneralSection = ({ apiName, authType, version, description, onApiNameChange, onDescriptionChange, collapsed = false, onToggleCollapse, onChangeDetected }) => {
2473
- const isMobile = !useBreakpoint$2().md;
2330
+ const isMobile = !useBreakpoint$3().md;
2474
2331
  const { wrapSSR, cx, token } = useStyle("GeneralSection", (token, scope) => ({
2475
2332
  [scope("root")]: {
2476
2333
  display: "flex",
@@ -2532,7 +2389,7 @@ const GeneralSection = ({ apiName, authType, version, description, onApiNameChan
2532
2389
  className: cx("root"),
2533
2390
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2534
2391
  className: cx("head"),
2535
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
2392
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title_js.default, {
2536
2393
  level: 4,
2537
2394
  style: {
2538
2395
  margin: 0,
@@ -3338,7 +3195,7 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
3338
3195
  };
3339
3196
  //#endregion
3340
3197
  //#region src/view/components/ApiPage/components/EndpointsSection.tsx
3341
- const { useBreakpoint: useBreakpoint$1 } = antd.Grid;
3198
+ const { useBreakpoint: useBreakpoint$2 } = antd.Grid;
3342
3199
  const PAGE_SIZE = 5;
3343
3200
  const getStatusCodeColor = (code, token) => {
3344
3201
  const n = parseInt(code, 10);
@@ -3386,7 +3243,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3386
3243
  const debouncedResponseSearches = useDebounce(responseSearches);
3387
3244
  const { selectNodeByKey } = useNodeSelection();
3388
3245
  const { token: antdToken } = antd.theme.useToken();
3389
- const isMobile = !useBreakpoint$1().md;
3246
+ const isMobile = !useBreakpoint$2().md;
3390
3247
  const toggleRequestPanel = (epId) => {
3391
3248
  setOpenRequestPanels((prev) => {
3392
3249
  const next = new Set(prev);
@@ -4065,7 +3922,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4065
3922
  children: [
4066
3923
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4067
3924
  className: cx("head"),
4068
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
3925
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title_js.default, {
4069
3926
  level: 4,
4070
3927
  style: {
4071
3928
  margin: 0,
@@ -4087,7 +3944,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4087
3944
  className: cx("body"),
4088
3945
  children: Object.values(endpointsByTag).flat().map((ep) => {
4089
3946
  const isExpanded = expandedId === ep.id;
4090
- const methodColor = methodColors[ep.method];
3947
+ const methodColor = methodColors$1[ep.method];
4091
3948
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
4092
3949
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4093
3950
  className: cx("endpoint-row"),
@@ -5245,9 +5102,9 @@ const UnsavedChangesBanner = ({ onClose }) => {
5245
5102
  };
5246
5103
  //#endregion
5247
5104
  //#region src/view/components/ApiPage/components/TagsSection.tsx
5248
- const { useBreakpoint } = antd.Grid;
5105
+ const { useBreakpoint: useBreakpoint$1 } = antd.Grid;
5249
5106
  const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEditTag, onDeleteTag }) => {
5250
- const isMobile = !useBreakpoint().md;
5107
+ const isMobile = !useBreakpoint$1().md;
5251
5108
  const { wrapSSR, cx, token } = useStyle("TagsSection", (token, scope) => ({
5252
5109
  [scope("root")]: {
5253
5110
  display: "flex",
@@ -5397,7 +5254,7 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
5397
5254
  className: cx("root"),
5398
5255
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5399
5256
  className: cx("head"),
5400
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
5257
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title_js.default, {
5401
5258
  level: 4,
5402
5259
  style: {
5403
5260
  margin: 0,
@@ -6045,89 +5902,923 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
6045
5902
  })
6046
5903
  ] }));
6047
5904
  };
6048
- //#endregion
6049
- //#region src/view/helper/mutate.ts
6050
- const resolveSchema = (schema, components) => {
6051
- if (!schema) return void 0;
6052
- if (!schema.$ref) return schema;
6053
- const refName = schema.$ref.split("/").pop();
6054
- const resolved = components?.schemas?.[refName];
6055
- if (!resolved) return schema;
6056
- return resolveSchema(resolved, components);
5905
+ token.colorPrimary, token.colorSuccess, token.colorError, token.colorWarning, token["volcano.5"], token["geekblue.6"], token["purple.5"], token["volcano.4"];
5906
+ const darkerMethodColors = {
5907
+ GET: {
5908
+ bg: token.colorPrimary,
5909
+ color: "#FFFFFF"
5910
+ },
5911
+ POST: {
5912
+ bg: token.colorSuccess,
5913
+ color: "#FFFFFF"
5914
+ },
5915
+ DELETE: {
5916
+ bg: token.colorError,
5917
+ color: "#FFFFFF"
5918
+ },
5919
+ PUT: {
5920
+ bg: token.colorWarning,
5921
+ color: "#FFFFFF"
5922
+ },
5923
+ PATCH: {
5924
+ bg: token["volcano.5"],
5925
+ color: "#FFFFFF"
5926
+ },
5927
+ OPTIONS: {
5928
+ bg: token["geekblue.6"],
5929
+ color: "#FFFFFF"
5930
+ },
5931
+ HEAD: {
5932
+ bg: token["purple.5"],
5933
+ color: "#FFFFFF"
5934
+ },
5935
+ TRACE: {
5936
+ bg: token["cyan.5"],
5937
+ color: "#FFFFFF"
5938
+ }
6057
5939
  };
6058
- const transformOpenApiToDocs = (api) => {
6059
- const groupedPathsByTags = {};
6060
- const validTags = new Set(api?.tags?.map(({ name }) => name) || []);
6061
- const contextPath = Object.keys(api.paths)[0];
6062
- const relatedVersions = "x-related-versions" in api ? Object.entries(api["x-related-versions"]).map(([apiId, version]) => ({
6063
- apiId,
6064
- version
6065
- })) : [];
6066
- relatedVersions.unshift({
6067
- apiId: api["x-current-version"],
6068
- version: `${api.info.version}`
5940
+ const sidebarMethodColors = {
5941
+ GET: {
5942
+ bg: token.colorPrimaryBgHover,
5943
+ color: token.colorPrimary
5944
+ },
5945
+ POST: {
5946
+ bg: token.colorSuccessBg,
5947
+ color: token.colorSuccess
5948
+ },
5949
+ DELETE: {
5950
+ bg: token.colorErrorBg,
5951
+ color: token.colorError
5952
+ },
5953
+ PUT: {
5954
+ bg: token.colorWarningBg,
5955
+ color: token.colorWarning
5956
+ },
5957
+ PATCH: {
5958
+ bg: token["volcano.1"],
5959
+ color: token["volcano.5"]
5960
+ },
5961
+ OPTIONS: {
5962
+ bg: token["geekblue.2"],
5963
+ color: token["geekblue.6"]
5964
+ },
5965
+ HEAD: {
5966
+ bg: token["purple.1"],
5967
+ color: token["purple.5"]
5968
+ },
5969
+ TRACE: {
5970
+ bg: token["volcano.1"],
5971
+ color: token["volcano.4"]
5972
+ }
5973
+ };
5974
+ const buildTreeDataStructure = (data) => {
5975
+ if (!data) return [];
5976
+ return data.map((api) => {
5977
+ const tagEntries = Object.entries(api.tags);
5978
+ const defaultTag = tagEntries.find(([tag]) => tag.toLowerCase() === "default");
5979
+ const nonDefaultTags = tagEntries.filter(([tag]) => tag.toLowerCase() !== "default");
5980
+ const defaultEndpoints = defaultTag ? defaultTag[1].map((endpoint) => ({
5981
+ title: endpoint.summary,
5982
+ key: endpoint.id,
5983
+ isLeaf: true,
5984
+ selectable: true,
5985
+ method: endpoint.method,
5986
+ data: {
5987
+ endpoint,
5988
+ api,
5989
+ tagName: "default",
5990
+ parentApiId: api.id
5991
+ }
5992
+ })) : [];
5993
+ const tagNodes = nonDefaultTags.map(([tag, endpoints]) => {
5994
+ const tagId = `tag-${api.id}-${tag.replace(/\s+/g, "-").toLowerCase()}`;
5995
+ return {
5996
+ title: tag,
5997
+ key: tagId,
5998
+ selectable: true,
5999
+ data: {
6000
+ tagName: tag,
6001
+ apiData: api
6002
+ },
6003
+ children: endpoints.map((endpoint) => ({
6004
+ title: endpoint.summary,
6005
+ key: endpoint.id,
6006
+ isLeaf: true,
6007
+ selectable: true,
6008
+ method: endpoint.method,
6009
+ data: {
6010
+ endpoint,
6011
+ api,
6012
+ tagName: tag,
6013
+ parentApiId: api.id,
6014
+ tagId
6015
+ }
6016
+ }))
6017
+ };
6018
+ });
6019
+ return {
6020
+ title: api.title,
6021
+ key: api.id,
6022
+ selectable: true,
6023
+ data: api,
6024
+ children: [...tagNodes, ...defaultEndpoints]
6025
+ };
6026
+ });
6027
+ };
6028
+ const getAllTreeKeys = (data) => {
6029
+ const keys = [];
6030
+ const traverse = (nodes) => {
6031
+ nodes.forEach((node) => {
6032
+ keys.push(node.key);
6033
+ if (node.children && node.children.length > 0) traverse(node.children);
6034
+ });
6035
+ };
6036
+ traverse(data);
6037
+ return keys;
6038
+ };
6039
+ const filterTreeData = (data, searchText) => {
6040
+ if (!searchText) return data;
6041
+ const findOriginalNode = (nodes, key) => {
6042
+ for (const node of nodes) {
6043
+ if (node.key === key) return node;
6044
+ if (node.children) {
6045
+ const found = findOriginalNode(node.children, key);
6046
+ if (found) return found;
6047
+ }
6048
+ }
6049
+ return null;
6050
+ };
6051
+ const filterNode = (node) => {
6052
+ let titleText = "";
6053
+ const originalNode = findOriginalNode(data, node.key);
6054
+ if (originalNode && typeof originalNode.title === "string") titleText = originalNode.title;
6055
+ else if (typeof node.title === "string") titleText = node.title;
6056
+ let searchableText = titleText;
6057
+ if (node.isLeaf && node.method) searchableText = `${node.method} ${titleText}`.toLowerCase();
6058
+ else searchableText = titleText.toLowerCase();
6059
+ const searchLower = searchText.toLowerCase();
6060
+ const matchesSearch = searchableText.includes(searchLower);
6061
+ if (node.children) {
6062
+ const filteredChildren = node.children.map((child) => filterNode(child)).filter((child) => child !== null);
6063
+ if (matchesSearch || filteredChildren.length > 0) return {
6064
+ ...node,
6065
+ children: filteredChildren
6066
+ };
6067
+ } else if (matchesSearch) return node;
6068
+ return null;
6069
+ };
6070
+ return data.map((node) => filterNode(node)).filter((node) => node !== null);
6071
+ };
6072
+ const getSidebarStyles = (token, scope) => ({
6073
+ [scope("sider")]: {
6074
+ backgroundColor: token.colorBgElevated,
6075
+ overflowX: "clip",
6076
+ borderRadius: token.borderRadius,
6077
+ height: "auto"
6078
+ },
6079
+ [scope("content")]: { padding: token.padding },
6080
+ [scope("controls")]: {
6081
+ display: "flex",
6082
+ gap: token.marginXS,
6083
+ marginBottom: token.marginSM
6084
+ },
6085
+ [scope("search-input")]: { flex: 1 },
6086
+ [scope("tree")]: {
6087
+ backgroundColor: "transparent",
6088
+ width: "100%",
6089
+ "& .ant-tree-list": { width: "100%" },
6090
+ "& .ant-tree-list-holder-inner": { width: "100%" },
6091
+ "& .ant-tree-node-content-wrapper": {
6092
+ overflow: "hidden",
6093
+ flex: 1,
6094
+ display: "flex",
6095
+ alignItems: "center",
6096
+ padding: "0 !important"
6097
+ },
6098
+ "& .ant-tree-title": {
6099
+ width: "100%",
6100
+ overflow: "hidden",
6101
+ display: "flex",
6102
+ alignItems: "center",
6103
+ marginBlock: "auto"
6104
+ },
6105
+ "& .ant-tree-treenode": {
6106
+ width: "100%",
6107
+ padding: 0
6108
+ },
6109
+ "& .ant-tree-switcher": { backgroundColor: token.colorBgElevated }
6110
+ },
6111
+ [scope("endpoint-item")]: {
6112
+ display: "flex",
6113
+ alignItems: "center",
6114
+ gap: token.marginXS,
6115
+ width: "100%",
6116
+ maxWidth: "100%",
6117
+ minWidth: "100%",
6118
+ paddingLeft: token.marginXS,
6119
+ paddingRight: token.marginXS
6120
+ },
6121
+ [scope("method-tag")]: {
6122
+ width: 51,
6123
+ height: 16,
6124
+ lineHeight: "16px",
6125
+ fontSize: 12,
6126
+ textAlign: "center",
6127
+ border: "none",
6128
+ borderRadius: 6,
6129
+ padding: "0 8px",
6130
+ display: "inline-flex",
6131
+ alignItems: "center",
6132
+ justifyContent: "center"
6133
+ },
6134
+ [scope("endpoint-text")]: {
6135
+ flex: 1,
6136
+ maxWidth: "100%",
6137
+ minWidth: 0,
6138
+ overflow: "hidden",
6139
+ display: "block"
6140
+ },
6141
+ [scope("tag-title")]: {
6142
+ color: token.colorText,
6143
+ maxWidth: "100%",
6144
+ display: "block",
6145
+ flex: 1
6146
+ },
6147
+ [scope("api-title")]: {
6148
+ flex: 1,
6149
+ color: token.colorText,
6150
+ maxWidth: "100%",
6151
+ display: "block",
6152
+ paddingLeft: "4px",
6153
+ paddingRight: "4px",
6154
+ margin: 0
6155
+ }
6156
+ });
6157
+ //#endregion
6158
+ //#region src/view/console/helper/sidebar.components.tsx
6159
+ const { Text: Text$2 } = antd.Typography;
6160
+ const EndpointItem = ({ method, title, cx, isSelected = false }) => {
6161
+ const methodStyle = (isSelected ? darkerMethodColors : sidebarMethodColors)[method];
6162
+ const isPost = method?.toUpperCase() === "POST";
6163
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6164
+ className: `${cx("endpoint-item")}${isSelected ? ` ${cx("endpoint-item-selected")}` : ""}`,
6165
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, {
6166
+ className: cx("method-tag"),
6167
+ style: {
6168
+ backgroundColor: methodStyle?.bg,
6169
+ color: methodStyle?.color,
6170
+ border: "none",
6171
+ ...isPost ? { borderRadius: 4 } : {}
6172
+ },
6173
+ children: method
6174
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text$2, {
6175
+ className: cx("endpoint-text"),
6176
+ ellipsis: { tooltip: title },
6177
+ style: { flex: 1 },
6178
+ children: title
6179
+ })]
6180
+ });
6181
+ };
6182
+ const convertToRenderableTreeData = (treeDataStructure, selectedEndpoint, cx) => {
6183
+ const renderNode = (node) => {
6184
+ let title;
6185
+ if (node.isLeaf && node.method) {
6186
+ const isSelected = selectedEndpoint && "data" in node && node.data && "endpoint" in node.data ? node.data.endpoint?.id === selectedEndpoint?.id : false;
6187
+ title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointItem, {
6188
+ method: node.method,
6189
+ title: typeof node.title === "string" ? node.title : "Endpoint Name",
6190
+ cx,
6191
+ isSelected
6192
+ });
6193
+ } else if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data)) title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text$2, {
6194
+ className: cx("api-title"),
6195
+ ellipsis: { tooltip: typeof node.title === "string" ? node.title : "API Name" },
6196
+ children: node.title
6197
+ });
6198
+ else title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text$2, {
6199
+ className: cx("tag-title"),
6200
+ ellipsis: { tooltip: typeof node.title === "string" ? node.title : "" },
6201
+ children: node.title
6202
+ });
6203
+ return {
6204
+ ...node,
6205
+ title,
6206
+ children: node.children ? node.children.map(renderNode) : void 0
6207
+ };
6208
+ };
6209
+ return treeDataStructure.map(renderNode);
6210
+ };
6211
+ //#endregion
6212
+ //#region src/view/console/Sidebar.tsx
6213
+ const { useBreakpoint } = antd.Grid;
6214
+ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
6215
+ const expandedKeys = useStore((state) => state.view.expandedKeys);
6216
+ const { selectedNodeKey, selectedEndpoint, builtTreeData, setExpandedKeys, setSelectedNodeKey } = useStore(({ view }) => view);
6217
+ const { selectNodeByKey, clearSelection } = useNodeSelection();
6218
+ const [autoExpandParent, setAutoExpandParent] = (0, react$1.useState)(true);
6219
+ const isMobile = !useBreakpoint().md;
6220
+ const { wrapSSR, cx, token } = useStyle("Sidebar", getSidebarStyles);
6221
+ const handleSearch = (value) => {
6222
+ if (value && builtTreeData) {
6223
+ setExpandedKeys(getAllTreeKeys(builtTreeData));
6224
+ setSearchValue(value);
6225
+ setAutoExpandParent(true);
6226
+ } else {
6227
+ setSearchValue(value);
6228
+ setExpandedKeys([]);
6229
+ setAutoExpandParent(false);
6230
+ }
6231
+ };
6232
+ const renderTreeData = (0, react$1.useMemo)(() => {
6233
+ if (!builtTreeData) return [];
6234
+ return convertToRenderableTreeData(builtTreeData, selectedEndpoint, cx);
6235
+ }, [
6236
+ builtTreeData,
6237
+ selectedEndpoint,
6238
+ cx
6239
+ ]);
6240
+ const filteredTreeData = (0, react$1.useMemo)(() => {
6241
+ if (!searchValue) return renderTreeData;
6242
+ if (!builtTreeData) return [];
6243
+ return convertToRenderableTreeData(filterTreeData(builtTreeData, searchValue), selectedEndpoint, cx);
6244
+ }, [
6245
+ builtTreeData,
6246
+ searchValue,
6247
+ selectedEndpoint,
6248
+ cx
6249
+ ]);
6250
+ const collapseAll = () => {
6251
+ setExpandedKeys([]);
6252
+ };
6253
+ const onTreeNodeSelect = (selectedKeys) => {
6254
+ const stringKeys = selectedKeys.map((key) => String(key));
6255
+ if (stringKeys.length === 0) {
6256
+ clearSelection();
6257
+ return;
6258
+ }
6259
+ if (!builtTreeData) return;
6260
+ const selectedKey = stringKeys[0];
6261
+ selectNodeByKey(selectedKey);
6262
+ setSelectedNodeKey(selectedKey);
6263
+ };
6264
+ const inner = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6265
+ className: cx("content"),
6266
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6267
+ className: cx("controls"),
6268
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
6269
+ title: "Search by APIs or Endpoints",
6270
+ placement: "bottom",
6271
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Input, {
6272
+ placeholder: "Search by APIs or Endpoints",
6273
+ value: searchValue,
6274
+ onChange: (e) => handleSearch(e.target.value),
6275
+ allowClear: true,
6276
+ className: cx("search-input"),
6277
+ addonAfter: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.SearchOutlined, {})
6278
+ })
6279
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
6280
+ title: "Collapse All",
6281
+ placement: "bottom",
6282
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
6283
+ onClick: collapseAll,
6284
+ title: "Collapse All",
6285
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Minify, {})
6286
+ })
6287
+ })]
6288
+ }), filteredTreeData?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tree, {
6289
+ showLine: { showLeafIcon: false },
6290
+ showIcon: false,
6291
+ switcherIcon: (nodeProps) => nodeProps.isLeaf ? null : nodeProps.expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.MinusSquareOutlined, { style: { fontSize: 12 } }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.PlusSquareOutlined, { style: { fontSize: 12 } }),
6292
+ expandedKeys,
6293
+ autoExpandParent,
6294
+ selectedKeys: [selectedNodeKey || ""],
6295
+ onSelect: (selectedKeys) => {
6296
+ if (!selectedKeys?.length) return;
6297
+ onTreeNodeSelect(selectedKeys);
6298
+ setSelectedNodeKey(selectedKeys[0]);
6299
+ onNodeSelect?.();
6300
+ },
6301
+ onExpand: (expandedKeysValue) => {
6302
+ setExpandedKeys(expandedKeysValue);
6303
+ setAutoExpandParent(false);
6304
+ },
6305
+ treeData: filteredTreeData,
6306
+ className: cx("tree")
6307
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
6308
+ justify: "center",
6309
+ align: "center",
6310
+ gap: token.marginSM,
6311
+ vertical: true,
6312
+ style: { marginTop: token.paddingXL },
6313
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoDataIcon, {
6314
+ stroke: token.colorPrimaryHover,
6315
+ fill: token.colorPrimaryBg,
6316
+ width: "10.375rem",
6317
+ height: "8.1875rem"
6318
+ }), searchValue.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text_js.default, {
6319
+ style: {
6320
+ textAlign: "center",
6321
+ fontFamily: token.fontFamily,
6322
+ fontWeight: 400,
6323
+ fontSize: token.fontSizeLG,
6324
+ color: token.colorTextTertiary
6325
+ },
6326
+ children: "No results found"
6327
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd_es_typography_Text_js.default, {
6328
+ style: {
6329
+ textAlign: "center",
6330
+ fontFamily: token.fontFamily,
6331
+ fontWeight: 400,
6332
+ fontSize: token.fontSizeLG,
6333
+ color: token.colorTextTertiary
6334
+ },
6335
+ children: [
6336
+ "No API",
6337
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {}),
6338
+ "Documentation Found"
6339
+ ]
6340
+ })]
6341
+ })]
6342
+ });
6343
+ if (isMobile) return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
6344
+ className: cx("sider"),
6345
+ style: {
6346
+ width: "100%",
6347
+ height: "100%"
6348
+ },
6349
+ children: inner
6350
+ }));
6351
+ return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(re_resizable.Resizable, {
6352
+ as: "aside",
6353
+ minWidth: isMobile ? 180 : 300,
6354
+ maxWidth: 386,
6355
+ enable: {
6356
+ top: false,
6357
+ right: true,
6358
+ bottom: false,
6359
+ left: false,
6360
+ topRight: false,
6361
+ bottomRight: false,
6362
+ bottomLeft: false,
6363
+ topLeft: false
6364
+ },
6365
+ defaultSize: {
6366
+ width: isMobile ? 225 : 333,
6367
+ height: "auto"
6368
+ },
6369
+ className: cx("sider"),
6370
+ children: inner
6371
+ }));
6372
+ };
6373
+ //#endregion
6374
+ //#region src/view/console/EndpointPage/EndpointPage.tsx
6375
+ const { Title: Title$1, Paragraph } = antd.Typography;
6376
+ const requestColumns = [
6377
+ {
6378
+ title: "Parameter",
6379
+ dataIndex: "param",
6380
+ key: "param"
6381
+ },
6382
+ {
6383
+ title: "Description",
6384
+ dataIndex: "desc",
6385
+ key: "desc"
6386
+ },
6387
+ {
6388
+ title: "Enum",
6389
+ dataIndex: "enum",
6390
+ key: "enum"
6391
+ }
6392
+ ];
6393
+ const responseColumns = [...requestColumns];
6394
+ const buildRequestData = (params, token) => [...params].sort((a, b) => a.required === b.required ? 0 : a.required ? -1 : 1).map((p, index) => {
6395
+ let typeLabel = p.schema?.type;
6396
+ if (p.schema?.type === "array" && p.schema?.items?.type) typeLabel = `${p.schema.type}_${p.schema.items.type}`;
6397
+ return {
6398
+ key: index,
6399
+ param: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
6400
+ p.name,
6401
+ typeLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6402
+ style: {
6403
+ color: token.colorTextTertiary,
6404
+ marginLeft: "0.25rem",
6405
+ marginRight: "0.25rem"
6406
+ },
6407
+ children: typeLabel
6408
+ }),
6409
+ p.required ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6410
+ style: { color: token.colorError },
6411
+ children: "*"
6412
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6413
+ style: { color: token.colorSuccess },
6414
+ children: "Optional"
6415
+ })
6416
+ ] }),
6417
+ desc: p.description || "--",
6418
+ enum: p.schema?.enum ? p.schema.enum.map((e) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, { children: e }, e)) : "--"
6419
+ };
6420
+ });
6421
+ const buildHeaderData = (headers, token) => {
6422
+ if (!headers) return [];
6423
+ return Object.entries(headers).sort(([, a], [, b]) => a.required === b.required ? 0 : a.required ? -1 : 1).map(([name, header], idx) => {
6424
+ let typeLabel = header.schema?.type;
6425
+ if (header.schema?.type === "array" && header.schema?.items?.type) typeLabel = `${header.schema.type}_${header.schema.items.type}`;
6426
+ return {
6427
+ key: idx,
6428
+ param: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
6429
+ name,
6430
+ typeLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6431
+ style: {
6432
+ color: token.colorTextTertiary,
6433
+ marginLeft: "0.25rem",
6434
+ marginRight: "0.25rem"
6435
+ },
6436
+ children: typeLabel
6437
+ }),
6438
+ header.required ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6439
+ style: { color: token.colorError },
6440
+ children: "*"
6441
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6442
+ style: { color: token.colorSuccess },
6443
+ children: "Optional"
6444
+ })
6445
+ ] }, idx),
6446
+ desc: header.description || "--",
6447
+ enum: header.schema?.enum ? header.schema.enum.map((e) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, { children: e }, e)) : "--"
6448
+ };
6449
+ });
6450
+ };
6451
+ const buildRequestBodyData = (requestBody, token) => {
6452
+ if (!requestBody?.content) return [];
6453
+ const contentType = Object.keys(requestBody.content)[0];
6454
+ const schema = requestBody.content[contentType]?.schema;
6455
+ if (!schema) return [];
6456
+ const properties = schema.properties ?? {};
6457
+ const required = schema.required ?? [];
6458
+ return Object.entries(properties).map(([name, prop], idx) => ({
6459
+ key: idx,
6460
+ param: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
6461
+ name,
6462
+ prop.type && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6463
+ style: {
6464
+ color: token.colorTextTertiary,
6465
+ marginLeft: "0.25rem",
6466
+ marginRight: "0.25rem"
6467
+ },
6468
+ children: prop.type
6469
+ }),
6470
+ required.includes(name) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6471
+ style: { color: token.colorError },
6472
+ children: "*"
6473
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6474
+ style: { color: token.colorSuccess },
6475
+ children: "Optional"
6476
+ })
6477
+ ] }),
6478
+ desc: prop.description || "--",
6479
+ enum: prop.enum ? prop.enum.map((e) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, { children: e }, e)) : "--"
6480
+ }));
6481
+ };
6482
+ const EndpointPage = () => {
6483
+ const { selectedEndpoint, selectedApi, selectedStatusCode, setSelectedNodeKey, setFocusedContent, setFocusedTag, setActiveRequestTab } = useStore(({ view }) => view);
6484
+ const [activeTabKey, setActiveTabKey] = (0, react$1.useState)("header");
6485
+ const { token } = antd.theme.useToken();
6486
+ const { cx } = useStyle("EndpointPage", (token, scope) => ({
6487
+ [scope("docs-endpoint-container")]: {
6488
+ display: "flex",
6489
+ flexDirection: "column",
6490
+ gap: token.marginLG,
6491
+ height: "100%"
6492
+ },
6493
+ [scope("content")]: {
6494
+ width: "100%",
6495
+ height: "100%"
6496
+ },
6497
+ [scope("code")]: {
6498
+ background: "unset",
6499
+ borderRadius: token.borderRadius,
6500
+ padding: token.paddingSM,
6501
+ fontFamily: "monospace",
6502
+ whiteSpace: "pre-wrap"
6503
+ },
6504
+ [scope("breadcrumb")]: {
6505
+ display: "flex",
6506
+ gap: token.marginLG,
6507
+ alignItems: "center",
6508
+ marginBottom: token.marginLG
6509
+ },
6510
+ [scope("request-card")]: {
6511
+ borderRadius: token.borderRadius,
6512
+ backgroundColor: token.colorBgBase,
6513
+ ".ant-card-head": {
6514
+ minHeight: "unset",
6515
+ borderBottom: "unset",
6516
+ padding: "0.75rem",
6517
+ backgroundColor: token.colorBgBase
6518
+ },
6519
+ ".ant-card-body": {
6520
+ padding: "0px 0.75rem 0.75rem 0.75rem",
6521
+ backgroundColor: token.colorBgBase,
6522
+ ".ant-tabs-tab": { paddingTop: "0" }
6523
+ },
6524
+ "& .ant-table": { backgroundColor: `${token.colorBgBase} !important` },
6525
+ "& .ant-table-thead > tr > th": { backgroundColor: `${token.colorBgBase} !important` },
6526
+ "& .ant-table-tbody > tr > td": { backgroundColor: `${token.colorBgBase} !important` }
6527
+ },
6528
+ [scope("row-odd")]: { "& > td": { background: `${token.colorBgElevated} !important` } },
6529
+ [scope("row-even")]: { "& > td": { background: `${token.colorBgLayout} !important` } }
6530
+ }));
6531
+ const methodStyle = sidebarMethodColors[selectedEndpoint?.method];
6532
+ const headerParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || [], token);
6533
+ const pathParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || [], token);
6534
+ const queryParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || [], token);
6535
+ const requestBodyData = buildRequestBodyData(selectedEndpoint?.requestBody, token);
6536
+ const requestTabs = [
6537
+ {
6538
+ key: "header",
6539
+ label: "Header",
6540
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
6541
+ columns: requestColumns,
6542
+ dataSource: headerParams,
6543
+ pagination: false,
6544
+ bordered: true,
6545
+ size: "small",
6546
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
6547
+ })
6548
+ },
6549
+ {
6550
+ key: "path",
6551
+ label: "Path",
6552
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
6553
+ columns: requestColumns,
6554
+ dataSource: pathParams,
6555
+ pagination: false,
6556
+ bordered: true,
6557
+ size: "small",
6558
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
6559
+ })
6560
+ },
6561
+ {
6562
+ key: "query",
6563
+ label: "Query",
6564
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
6565
+ columns: requestColumns,
6566
+ dataSource: queryParams,
6567
+ pagination: false,
6568
+ bordered: true,
6569
+ size: "small",
6570
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
6571
+ })
6572
+ },
6573
+ ...requestBodyData.length > 0 ? [{
6574
+ key: "requestBody",
6575
+ label: "Request Body",
6576
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
6577
+ columns: requestColumns,
6578
+ dataSource: requestBodyData,
6579
+ pagination: false,
6580
+ bordered: true,
6581
+ size: "small",
6582
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
6583
+ })
6584
+ }] : []
6585
+ ].filter((t) => t !== null);
6586
+ (0, react$1.useEffect)(() => {
6587
+ const firstKey = requestTabs[0]?.key ?? "header";
6588
+ setActiveTabKey(firstKey);
6589
+ setActiveRequestTab(firstKey);
6590
+ }, [selectedEndpoint?.id]);
6591
+ const responseHeaders = (selectedEndpoint?.responses?.[selectedStatusCode || 200])?.headers;
6592
+ const responseHeaderData = buildHeaderData(responseHeaders, token);
6593
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6594
+ className: cx("docs-endpoint-container"),
6595
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6596
+ className: cx("content"),
6597
+ children: [
6598
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6599
+ className: cx("breadcrumb"),
6600
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
6601
+ color: "default",
6602
+ variant: "outlined",
6603
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.LeftOutlined, {}),
6604
+ onClick: (e) => {
6605
+ e.preventDefault();
6606
+ setSelectedNodeKey(selectedApi?.id);
6607
+ setFocusedContent("API");
6608
+ }
6609
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Breadcrumb, { items: [
6610
+ {
6611
+ href: "",
6612
+ title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selectedApi?.title || "API Name" }),
6613
+ onClick: (e) => {
6614
+ e.preventDefault();
6615
+ setSelectedNodeKey(selectedApi?.id);
6616
+ setFocusedContent("API");
6617
+ }
6618
+ },
6619
+ {
6620
+ href: ``,
6621
+ onClick: (e) => {
6622
+ e.preventDefault();
6623
+ setSelectedNodeKey(selectedApi?.id);
6624
+ setFocusedContent("API");
6625
+ setFocusedTag(selectedEndpoint?.tagName || "default");
6626
+ },
6627
+ title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
6628
+ style: {
6629
+ display: "flex",
6630
+ flexDirection: "row",
6631
+ alignItems: "center",
6632
+ color: token.colorTextTertiary,
6633
+ gap: "0.25rem"
6634
+ },
6635
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selectedEndpoint?.tagName || "default" })
6636
+ })
6637
+ },
6638
+ { title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
6639
+ title: selectedEndpoint?.summary || "Endpoint Name",
6640
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6641
+ style: {
6642
+ overflow: "hidden",
6643
+ textOverflow: "ellipsis",
6644
+ whiteSpace: "nowrap",
6645
+ display: "block",
6646
+ maxWidth: "300px"
6647
+ },
6648
+ children: selectedEndpoint?.summary || "Endpoint Name"
6649
+ })
6650
+ }) }
6651
+ ] })]
6652
+ }),
6653
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Title$1, {
6654
+ level: 3,
6655
+ style: {
6656
+ display: "flex",
6657
+ alignItems: "center",
6658
+ gap: 12,
6659
+ margin: 0
6660
+ },
6661
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, {
6662
+ style: {
6663
+ backgroundColor: methodStyle?.bg,
6664
+ color: methodStyle?.color,
6665
+ border: "none",
6666
+ width: "4.375rem",
6667
+ height: "1.375rem",
6668
+ textAlign: "center",
6669
+ flexShrink: 0
6670
+ },
6671
+ children: selectedEndpoint?.method
6672
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
6673
+ title: selectedEndpoint?.summary ?? "--",
6674
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6675
+ style: {
6676
+ overflow: "hidden",
6677
+ textOverflow: "ellipsis",
6678
+ whiteSpace: "nowrap"
6679
+ },
6680
+ children: selectedEndpoint?.summary?.replace(selectedEndpoint?.method, "") ?? "--"
6681
+ })
6682
+ })]
6683
+ }),
6684
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Paragraph, {
6685
+ style: {
6686
+ color: token.colorTextTertiary,
6687
+ marginBottom: "1.5rem"
6688
+ },
6689
+ children: selectedEndpoint?.description ?? "--"
6690
+ }),
6691
+ requestTabs.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Card, {
6692
+ title: "Request",
6693
+ className: cx("request-card"),
6694
+ style: {
6695
+ marginBottom: "1.5rem",
6696
+ backgroundColor: token.colorBgBase
6697
+ },
6698
+ styles: { body: { backgroundColor: token.colorBgBase } },
6699
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tabs, {
6700
+ activeKey: activeTabKey,
6701
+ onChange: (key) => {
6702
+ setActiveTabKey(key);
6703
+ setActiveRequestTab(key);
6704
+ },
6705
+ items: requestTabs
6706
+ })
6707
+ }),
6708
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Card, {
6709
+ title: "Response",
6710
+ className: cx("request-card"),
6711
+ extra: responseHeaderData.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Tag, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: {
6712
+ background: handleStatusColor(selectedStatusCode),
6713
+ borderRadius: "50%",
6714
+ display: "inline-block",
6715
+ width: "0.5rem",
6716
+ height: "0.5rem",
6717
+ marginRight: "0.5rem"
6718
+ } }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selectedStatusCode })] }),
6719
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
6720
+ columns: responseColumns,
6721
+ dataSource: responseHeaderData,
6722
+ pagination: false,
6723
+ bordered: true,
6724
+ size: "small",
6725
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-even" : "row-odd")
6726
+ })
6727
+ })
6728
+ ]
6729
+ })
6069
6730
  });
6070
- const currentVersion = "x-current-version" in api ? api["x-current-version"] : "";
6071
- const authScheme = api.components?.securitySchemes;
6072
- let authType;
6073
- if (authScheme && Object.keys(authScheme)?.[0]) {
6074
- authType = Object.keys(authScheme)[0];
6075
- if (authType && authType.toLowerCase() === "public") authType = "KEYLESS";
6076
- if (authType && (authType.toLowerCase() === "oauth" || authType.toLowerCase() === "oauth2")) authType = "OAUTH2";
6077
- authType = authType.toUpperCase();
6078
- } else authType = "x-auth-type" in api ? api["x-auth-type"] : "";
6079
- const curl = "x-curls" in api ? api["x-curls"] : "";
6080
- const jwsEnabled = api["x-jws-enabled"] === true;
6081
- for (const [path, methods] of Object.entries(api.paths)) for (const [method, methodData] of Object.entries(methods)) {
6082
- const entry = {
6083
- ...methodData,
6084
- method: method?.toUpperCase(),
6085
- path
6086
- };
6087
- if (entry.requestBody?.content) {
6088
- const resolvedContent = {};
6089
- for (const [contentType, contentValue] of Object.entries(entry.requestBody.content)) resolvedContent[contentType] = { schema: resolveSchema(contentValue.schema, api.components) ?? contentValue.schema };
6090
- entry.requestBody = {
6091
- ...entry.requestBody,
6092
- content: resolvedContent
6093
- };
6094
- }
6095
- const matchedTags = (methodData.tags ?? []).filter((tag) => validTags.has(tag));
6096
- if (matchedTags.length > 0) matchedTags.forEach((tag) => {
6097
- if (!groupedPathsByTags[tag]) groupedPathsByTags[tag] = [];
6098
- groupedPathsByTags[tag].push({
6099
- ...entry,
6100
- id: `endpoint-${(0, nanoid.nanoid)(8)}`
6101
- });
6102
- });
6103
- else {
6104
- if (!groupedPathsByTags.default) groupedPathsByTags.default = [];
6105
- groupedPathsByTags.default.push({
6106
- ...entry,
6107
- id: `endpoint-${(0, nanoid.nanoid)(8)}`
6108
- });
6731
+ };
6732
+ //#endregion
6733
+ //#region src/view/console/MainContent.tsx
6734
+ const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage }) => {
6735
+ const { focusedContent, transformedData } = useStore(({ view }) => view);
6736
+ const { wrapSSR, cx, token } = useStyle("MainContent", (token, scope) => ({
6737
+ [scope("inner-doc-container")]: {
6738
+ width: "100%",
6739
+ height: "auto",
6740
+ borderRadius: token.borderRadius,
6741
+ padding: token.paddingXL,
6742
+ overflow: "hidden",
6743
+ minWidth: 0
6744
+ },
6745
+ [scope("centered")]: {
6746
+ display: "flex",
6747
+ justifyContent: "center"
6748
+ },
6749
+ [scope("no-space")]: {
6750
+ margin: 0,
6751
+ padding: 0
6752
+ },
6753
+ [scope("title")]: {
6754
+ fontFamily: token.fontFamily,
6755
+ fontWeight: 600,
6756
+ fontSize: token.fontSizeHeading4,
6757
+ color: token.colorText
6758
+ },
6759
+ [scope("text")]: {
6760
+ color: token.colorText,
6761
+ fontFamily: token.fontFamily
6762
+ },
6763
+ [scope("visit-landing-button")]: {
6764
+ width: "12.25rem",
6765
+ height: "2.5rem",
6766
+ borderRadius: token.borderRadiusLG
6767
+ },
6768
+ [scope("reset-button")]: {
6769
+ width: "8.125rem",
6770
+ height: "2.5rem",
6771
+ borderRadius: token.borderRadiusLG,
6772
+ backgroundColor: token?.Button?.primaryColor,
6773
+ fontSize: token.Button?.contentFontSizeLG
6109
6774
  }
6110
- }
6111
- const sortedGroupedPathsByTags = Object.keys(groupedPathsByTags).sort((a, b) => {
6112
- if (a === "default") return 1;
6113
- if (b === "default") return -1;
6114
- return a.localeCompare(b);
6115
- }).reduce((acc, key) => {
6116
- acc[key] = groupedPathsByTags[key];
6117
- return acc;
6118
- }, {});
6119
- return {
6120
- ...api.info,
6121
- id: `api-${(0, nanoid.nanoid)(8)}`,
6122
- contextPath,
6123
- tags: sortedGroupedPathsByTags,
6124
- servers: api.servers,
6125
- relatedVersions,
6126
- currentVersion,
6127
- authType,
6128
- jwsEnabled,
6129
- curl
6130
- };
6775
+ }));
6776
+ return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6777
+ className: cx("inner-doc-container", !transformedData?.length ? "centered" : ""),
6778
+ style: { backgroundColor: focusedContent === "ENDPOINT" ? token.colorBgBase : token.colorBgElevated },
6779
+ children: !transformedData?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
6780
+ justify: "center",
6781
+ align: "center",
6782
+ gap: "1.5rem",
6783
+ vertical: true,
6784
+ flex: 1,
6785
+ children: [
6786
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoDataIcon, {
6787
+ stroke: token.colorPrimaryHover,
6788
+ fill: token.colorPrimaryBg,
6789
+ width: "18.625rem",
6790
+ height: "14.75rem"
6791
+ }),
6792
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
6793
+ justify: "center",
6794
+ align: "center",
6795
+ gap: "0.5rem",
6796
+ vertical: true,
6797
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title_js.default, {
6798
+ className: cx("no-space", "title"),
6799
+ level: 4,
6800
+ children: !searchEnabled ? "No API Documentation Found" : "No results found"
6801
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text_js.default, {
6802
+ className: cx("no-space", "text"),
6803
+ children: !searchEnabled ? "No API Documentation has been added yet. Contact admin for support." : "Adjust your Search and try again"
6804
+ })]
6805
+ }),
6806
+ !searchEnabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
6807
+ type: "primary",
6808
+ onClick: handleVisitLandingPage,
6809
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MouseSquare, {}),
6810
+ iconPosition: "start",
6811
+ className: cx("visit-landing-button"),
6812
+ children: "Visit Landing Page"
6813
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
6814
+ type: "default",
6815
+ className: cx("reset-button"),
6816
+ onClick: handleResetSearch,
6817
+ children: "Reset Search"
6818
+ })
6819
+ ]
6820
+ }) : focusedContent === "ENDPOINT" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointPage, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(APIPage, {})
6821
+ }));
6131
6822
  };
6132
6823
  //#endregion
6133
6824
  //#region src/assets/copy.tsx
@@ -6147,9 +6838,9 @@ const Copy = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
6147
6838
  })]
6148
6839
  });
6149
6840
  //#endregion
6150
- //#region src/view/components/EndpointPage/Codebox/Codebox.tsx
6841
+ //#region src/view/console/EndpointPage/Codebox/Codebox.tsx
6151
6842
  react_syntax_highlighter.Light.registerLanguage("json", react_syntax_highlighter_dist_esm_languages_hljs_json_js.default);
6152
- const Codebox = ({ code, language, wrapLongLines }) => {
6843
+ const Codebox$1 = ({ code, language, wrapLongLines }) => {
6153
6844
  const [appTheme] = (0, react$1.useState)("DARK");
6154
6845
  const { token, theme: themeConfig } = antd.theme.useToken();
6155
6846
  const bodyBg = themeConfig.id == 1 ? token.colorBgContainer : "#1d2856";
@@ -6182,8 +6873,8 @@ const Codebox = ({ code, language, wrapLongLines }) => {
6182
6873
  });
6183
6874
  };
6184
6875
  //#endregion
6185
- //#region src/view/components/CodeboxSidebar.tsx
6186
- function CodeboxSidebar() {
6876
+ //#region src/view/console/CodeboxSidebar.tsx
6877
+ function CodeboxSidebar$1() {
6187
6878
  const { selectedEndpoint, selectedApi, activeRequestTab, selectedStatusCode, statusCodeOptions, setSelectedStatusCode } = useStore(({ view }) => view);
6188
6879
  const httpStatusOptions = (0, react$1.useMemo)(() => statusCodeOptions.map((code) => ({
6189
6880
  value: code,
@@ -6223,14 +6914,14 @@ function CodeboxSidebar() {
6223
6914
  const headerBg = isDark ? antdToken.colorBgElevated : "#1d2856";
6224
6915
  const bodyBg = isDark ? antdToken.colorBgContainer : "#1d2856";
6225
6916
  const codeTextColor = isDark ? "rgba(255,255,255,0.85)" : "#ffffff";
6226
- const { cx } = useStyle("CodeboxSidebar", (token$1, scope) => ({
6917
+ const { cx } = useStyle("CodeboxSidebar", (token$2, scope) => ({
6227
6918
  [scope("container")]: {
6228
6919
  display: "flex",
6229
6920
  flexDirection: "column",
6230
- gap: token$1.marginMD,
6231
- background: token$1.colorBgElevated,
6232
- borderRadius: token$1.borderRadiusLG,
6233
- padding: token$1.paddingLG,
6921
+ gap: token$2.marginMD,
6922
+ background: token$2.colorBgElevated,
6923
+ borderRadius: token$2.borderRadiusLG,
6924
+ padding: token$2.paddingLG,
6234
6925
  height: "auto",
6235
6926
  width: "23.625rem",
6236
6927
  minWidth: "23.625rem",
@@ -6242,24 +6933,24 @@ function CodeboxSidebar() {
6242
6933
  display: "flex",
6243
6934
  flexDirection: "column",
6244
6935
  backgroundColor: headerBg,
6245
- border: `1px solid ${token$1.colorBorder}`,
6936
+ border: `1px solid ${token$2.colorBorder}`,
6246
6937
  ".CodeboxSidebar-copyButton": { ".isolated-btn-icon": { path: { fill: "white" } } },
6247
6938
  ".isolated-card-body": {
6248
6939
  padding: " .125rem 0 0 0 !important",
6249
6940
  borderTop: ".125rem solid #33419A"
6250
6941
  },
6251
6942
  ".ant-card-head": { flex: "0 0 auto" },
6252
- borderRadius: token$1.borderRadius,
6943
+ borderRadius: token$2.borderRadius,
6253
6944
  overflow: "hidden"
6254
6945
  },
6255
6946
  [scope("rightCardRequest")]: { minHeight: "8.125rem" },
6256
- [scope("rightCardHeaderResponse")]: { padding: `0 ${token$1.margin}px ${token$1.marginXS}px ${token$1.margin}px` },
6947
+ [scope("rightCardHeaderResponse")]: { padding: `0 ${token$2.margin}px ${token$2.marginXS}px ${token$2.margin}px` },
6257
6948
  [scope("rightCardResponse")]: {
6258
6949
  height: "fit-content",
6259
6950
  overflow: "hidden",
6260
6951
  ".isolated-card-body": {
6261
6952
  display: "flex",
6262
- padding: `0 ${token$1.margin}px`,
6953
+ padding: `0 ${token$2.margin}px`,
6263
6954
  flexDirection: "column",
6264
6955
  alignItems: "flex-start",
6265
6956
  gap: "10px",
@@ -6270,8 +6961,8 @@ function CodeboxSidebar() {
6270
6961
  display: "flex",
6271
6962
  alignItems: "center",
6272
6963
  justifyContent: "space-between",
6273
- padding: `${token$1.marginXS}px ${token$1.margin}px`,
6274
- borderBottom: `1px solid ${token$1.colorBorderSecondary}`,
6964
+ padding: `${token$2.marginXS}px ${token$2.margin}px`,
6965
+ borderBottom: `1px solid ${token$2.colorBorderSecondary}`,
6275
6966
  height: "3.125rem",
6276
6967
  backgroundColor: headerBg
6277
6968
  },
@@ -6388,13 +7079,97 @@ function CodeboxSidebar() {
6388
7079
  open: httpStatusOptions.length === 1 ? false : void 0,
6389
7080
  suffixIcon: httpStatusOptions.length > 1 ? void 0 : false
6390
7081
  })]
6391
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Codebox, { code: JSON.stringify(selectedEndpoint?.responses[selectedStatusCode], null, 2) || "" })]
7082
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Codebox$1, { code: JSON.stringify(selectedEndpoint?.responses[selectedStatusCode], null, 2) || "" })]
6392
7083
  })]
6393
7084
  });
6394
- }
7085
+ }
7086
+ //#endregion
7087
+ //#region src/view/helper/mutate.ts
7088
+ const resolveSchema = (schema, components) => {
7089
+ if (!schema) return void 0;
7090
+ if (!schema.$ref) return schema;
7091
+ const refName = schema.$ref.split("/").pop();
7092
+ const resolved = components?.schemas?.[refName];
7093
+ if (!resolved) return schema;
7094
+ return resolveSchema(resolved, components);
7095
+ };
7096
+ const transformOpenApiToDocs = (api) => {
7097
+ const groupedPathsByTags = {};
7098
+ const validTags = new Set(api?.tags?.map(({ name }) => name) || []);
7099
+ const contextPath = Object.keys(api.paths)[0];
7100
+ const relatedVersions = "x-related-versions" in api ? Object.entries(api["x-related-versions"]).map(([apiId, version]) => ({
7101
+ apiId,
7102
+ version
7103
+ })) : [];
7104
+ relatedVersions.unshift({
7105
+ apiId: api["x-current-version"],
7106
+ version: `${api.info.version}`
7107
+ });
7108
+ const currentVersion = "x-current-version" in api ? api["x-current-version"] : "";
7109
+ const authScheme = api.components?.securitySchemes;
7110
+ let authType;
7111
+ if (authScheme && Object.keys(authScheme)?.[0]) {
7112
+ authType = Object.keys(authScheme)[0];
7113
+ if (authType && authType.toLowerCase() === "public") authType = "KEYLESS";
7114
+ if (authType && (authType.toLowerCase() === "oauth" || authType.toLowerCase() === "oauth2")) authType = "OAUTH2";
7115
+ authType = authType.toUpperCase();
7116
+ } else authType = "x-auth-type" in api ? api["x-auth-type"] : "";
7117
+ const curl = "x-curls" in api ? api["x-curls"] : "";
7118
+ const jwsEnabled = api["x-jws-enabled"] === true;
7119
+ for (const [path, methods] of Object.entries(api.paths)) for (const [method, methodData] of Object.entries(methods)) {
7120
+ const entry = {
7121
+ ...methodData,
7122
+ method: method?.toUpperCase(),
7123
+ path
7124
+ };
7125
+ if (entry.requestBody?.content) {
7126
+ const resolvedContent = {};
7127
+ for (const [contentType, contentValue] of Object.entries(entry.requestBody.content)) resolvedContent[contentType] = { schema: resolveSchema(contentValue.schema, api.components) ?? contentValue.schema };
7128
+ entry.requestBody = {
7129
+ ...entry.requestBody,
7130
+ content: resolvedContent
7131
+ };
7132
+ }
7133
+ const matchedTags = (methodData.tags ?? []).filter((tag) => validTags.has(tag));
7134
+ if (matchedTags.length > 0) matchedTags.forEach((tag) => {
7135
+ if (!groupedPathsByTags[tag]) groupedPathsByTags[tag] = [];
7136
+ groupedPathsByTags[tag].push({
7137
+ ...entry,
7138
+ id: `endpoint-${(0, nanoid.nanoid)(8)}`
7139
+ });
7140
+ });
7141
+ else {
7142
+ if (!groupedPathsByTags.default) groupedPathsByTags.default = [];
7143
+ groupedPathsByTags.default.push({
7144
+ ...entry,
7145
+ id: `endpoint-${(0, nanoid.nanoid)(8)}`
7146
+ });
7147
+ }
7148
+ }
7149
+ const sortedGroupedPathsByTags = Object.keys(groupedPathsByTags).sort((a, b) => {
7150
+ if (a === "default") return 1;
7151
+ if (b === "default") return -1;
7152
+ return a.localeCompare(b);
7153
+ }).reduce((acc, key) => {
7154
+ acc[key] = groupedPathsByTags[key];
7155
+ return acc;
7156
+ }, {});
7157
+ return {
7158
+ ...api.info,
7159
+ id: `api-${(0, nanoid.nanoid)(8)}`,
7160
+ contextPath,
7161
+ tags: sortedGroupedPathsByTags,
7162
+ servers: api.servers,
7163
+ relatedVersions,
7164
+ currentVersion,
7165
+ authType,
7166
+ jwsEnabled,
7167
+ curl
7168
+ };
7169
+ };
6395
7170
  //#endregion
6396
7171
  //#region src/view/layout.tsx
6397
- const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onSave }) => {
7172
+ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onSave }) => {
6398
7173
  const [searchValue, setSearchValue] = (0, react$1.useState)("");
6399
7174
  const [mode, setMode] = (0, react$1.useState)("edit");
6400
7175
  const [hasChanges, setHasChanges] = (0, react$1.useState)(false);
@@ -7035,7 +7810,7 @@ const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onS
7035
7810
  handleResetSearch,
7036
7811
  searchEnabled: !!searchValue
7037
7812
  }),
7038
- !isMobile && focusedContent === "ENDPOINT" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeboxSidebar, {})
7813
+ !isMobile && focusedContent === "ENDPOINT" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeboxSidebar$1, {})
7039
7814
  ]
7040
7815
  }),
7041
7816
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AddTagDrawer, {
@@ -7136,8 +7911,234 @@ const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onS
7136
7911
  });
7137
7912
  };
7138
7913
  //#endregion
7914
+ //#region src/view/components/EndpointPage/Codebox/Codebox.tsx
7915
+ react_syntax_highlighter.Light.registerLanguage("json", react_syntax_highlighter_dist_esm_languages_hljs_json_js.default);
7916
+ const Codebox = ({ code, language }) => {
7917
+ const [theme] = (0, react$1.useState)("DARK");
7918
+ const { cx } = useStyle("codeBox", (token, scope) => ({ [scope("codebox")]: {
7919
+ borderRadius: token.borderRadius,
7920
+ height: "100%",
7921
+ maxHeight: "100%",
7922
+ overflow: "auto",
7923
+ pre: { height: "100%" }
7924
+ } }));
7925
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7926
+ className: cx("codebox"),
7927
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_syntax_highlighter.Light, {
7928
+ language: language || "json",
7929
+ style: theme === "LIGHT" ? react_syntax_highlighter_dist_esm_styles_hljs_index_js.stackoverflowLight : react_syntax_highlighter_dist_esm_styles_hljs_index_js.stackoverflowDark,
7930
+ showLineNumbers: true,
7931
+ wrapLines: true,
7932
+ customStyle: {
7933
+ margin: 0,
7934
+ minHeight: "3rem",
7935
+ overflowY: "auto",
7936
+ padding: "0.75rem 1rem 0.75rem 1.5rem",
7937
+ backgroundColor: theme === "DARK" ? "#20264B" : "#20264B",
7938
+ fontSize: "0.75rem"
7939
+ },
7940
+ lineProps: { style: { fontFamily: "Cascadia Code, sans-serif" } },
7941
+ children: code
7942
+ })
7943
+ });
7944
+ };
7945
+ //#endregion
7946
+ //#region src/view/components/CodeboxSidebar.tsx
7947
+ function CodeboxSidebar() {
7948
+ const { selectedEndpoint, selectedStatusCode, statusCodeOptions, setSelectedStatusCode } = useStore(({ view }) => view);
7949
+ const httpStatusOptions = (0, react$1.useMemo)(() => statusCodeOptions.map((code) => ({
7950
+ value: code,
7951
+ label: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
7952
+ style: {
7953
+ display: "flex",
7954
+ alignItems: "center",
7955
+ gap: "0.5rem"
7956
+ },
7957
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: {
7958
+ background: handleStatusColor(code),
7959
+ borderRadius: "50%",
7960
+ display: "inline-block",
7961
+ width: "0.5rem",
7962
+ height: "0.5rem",
7963
+ minWidth: "0.5rem",
7964
+ minHeight: "0.5rem"
7965
+ } }), code]
7966
+ })
7967
+ })), [statusCodeOptions]);
7968
+ const { originalData } = useStore(({ view }) => view);
7969
+ const [curlTooltip, setCurlTooltip] = (0, react$1.useState)("Copy Request");
7970
+ const findCurlForEndpoint = () => {
7971
+ if (!selectedEndpoint || !originalData) return "";
7972
+ const api = originalData.find((apiData) => {
7973
+ const paths = apiData.paths || {};
7974
+ return Object.keys(paths).some((path) => {
7975
+ const methods = paths[path] || {};
7976
+ return Object.keys(methods).some((method) => {
7977
+ const endpointMethod = method.toUpperCase();
7978
+ return path === selectedEndpoint.path && endpointMethod === selectedEndpoint.method;
7979
+ });
7980
+ });
7981
+ });
7982
+ if (!api || !api["x-curls"]) return "";
7983
+ const matchingCurls = api["x-curls"].filter((curlObj) => curlObj.path === selectedEndpoint.path && curlObj.method === selectedEndpoint.method);
7984
+ const sdbCurl = matchingCurls.find((curl) => curl.serverUrl.includes("sdb") || curl.serverUrl.includes("SDB"));
7985
+ return sdbCurl ? sdbCurl.curlCommand : matchingCurls[0]?.curlCommand || "";
7986
+ };
7987
+ const curlCommand = findCurlForEndpoint();
7988
+ const formatCurlCommand = (cmd) => {
7989
+ if (!cmd) return "";
7990
+ return cmd.replace(/ -X /g, " \\\n -X ").replace(/ -H /g, " \\\n -H ").replace(/ -d /g, " \\\n -d ").replace(/ (https?:\/\/[^\s'"]+)/g, " \\\n $1");
7991
+ };
7992
+ const { cx } = useStyle("CodeboxSidebar", (token$1, scope) => ({
7993
+ [scope("container")]: {
7994
+ display: "flex",
7995
+ flexDirection: "column",
7996
+ gap: token$1.marginMD,
7997
+ background: token$1.colorBgContainer,
7998
+ borderRadius: token$1.borderRadiusLG,
7999
+ padding: token$1.paddingLG,
8000
+ overflow: "hidden",
8001
+ height: "100%",
8002
+ maxHeight: "100%",
8003
+ width: "23.625rem",
8004
+ minWidth: "23.625rem",
8005
+ ".ant-card-body": { padding: 0 },
8006
+ ".ant-card-head-title": { color: "white" },
8007
+ ".ant-card-head": { borderBottom: ".125rem solid #33419A" }
8008
+ },
8009
+ [scope("rightCard")]: {
8010
+ display: "flex",
8011
+ flexDirection: "column",
8012
+ backgroundColor: "#20264B",
8013
+ ".CodeboxSidebar-copyButton": { ".isolated-btn-icon": { path: { fill: "white" } } },
8014
+ ".isolated-card-body": {
8015
+ padding: " .125rem 0 0 0 !important",
8016
+ borderTop: ".125rem solid #33419A"
8017
+ },
8018
+ ".ant-card-head": { flex: "0 0 auto" },
8019
+ borderRadius: token$1.borderRadius,
8020
+ overflow: "hidden"
8021
+ },
8022
+ [scope("rightCardRequest")]: {
8023
+ maxHeight: "50%",
8024
+ minHeight: "8.125rem"
8025
+ },
8026
+ [scope("rightCardResponse")]: {
8027
+ height: "fit-content",
8028
+ overflow: "hidden"
8029
+ },
8030
+ [scope("rightCardHeader")]: {
8031
+ display: "flex",
8032
+ alignItems: "center",
8033
+ justifyContent: "space-between",
8034
+ padding: `${token$1.marginXS}px ${token$1.margin}px`,
8035
+ borderBottom: ".125rem solid #33419A",
8036
+ height: "3.125rem"
8037
+ },
8038
+ [scope("rightCardFlex")]: {
8039
+ display: "flex",
8040
+ flexDirection: "column",
8041
+ height: "fit-content",
8042
+ overflow: "auto",
8043
+ backgroundColor: "#20264B",
8044
+ ".ant-card-head": { flex: "0 0 auto" },
8045
+ ".ant-card-body": {
8046
+ flex: "1 1 auto",
8047
+ overflowY: "auto",
8048
+ padding: ".125rem 0 0 0 !important"
8049
+ },
8050
+ ".isolated-card-body": {
8051
+ padding: " .125rem 0 0 0 !important",
8052
+ height: "fit-content",
8053
+ overflow: "auto",
8054
+ borderTop: ".125rem solid #33419A",
8055
+ ".codebox": {
8056
+ height: "fit-content",
8057
+ overflow: "auto"
8058
+ }
8059
+ }
8060
+ },
8061
+ [scope("customSelect")]: {
8062
+ width: "5.5rem",
8063
+ maxWidth: "5.5rem",
8064
+ ".ant-select-selector": {
8065
+ backgroundColor: "#fff",
8066
+ borderColor: "#fff",
8067
+ borderRadius: ".375rem",
8068
+ color: "#101010"
8069
+ },
8070
+ ".ant-select-selection-item": {
8071
+ color: "#101010",
8072
+ fontWeight: 400
8073
+ },
8074
+ ".ant-select-selection-placeholder": { color: "rgba(255, 255, 255, 0.65)" },
8075
+ ".ant-select-arrow": { color: "#101010" },
8076
+ "&:hover .ant-select-selector": {
8077
+ borderColor: `${token["brnadColor.7"]}`,
8078
+ color: "white"
8079
+ },
8080
+ "&:focus .ant-select-selector, &.ant-select-focused .ant-select-selector": {
8081
+ borderColor: `${token["brnadColor.7"]}`,
8082
+ color: "white"
8083
+ }
8084
+ }
8085
+ }));
8086
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8087
+ className: cx("container"),
8088
+ children: [curlCommand && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8089
+ className: cx("rightCard", "rightCardRequest"),
8090
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8091
+ className: cx("rightCardHeader"),
8092
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Typography.Text, {
8093
+ strong: true,
8094
+ style: { color: "#fff" },
8095
+ children: "Request"
8096
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
8097
+ title: curlTooltip,
8098
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
8099
+ color: "default",
8100
+ variant: "link",
8101
+ className: cx("copyButton"),
8102
+ onClick: () => {
8103
+ const cleaned = curlCommand.replace(/\\"/g, "\"").replace(/\\\\/g, "\\");
8104
+ navigator.clipboard.writeText(formatCurlCommand(cleaned));
8105
+ setCurlTooltip("Copied!");
8106
+ setTimeout(() => setCurlTooltip("Copy cURL"), 1500);
8107
+ },
8108
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Copy, { style: { color: "white" } })
8109
+ })
8110
+ })]
8111
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Codebox, {
8112
+ language: "bash",
8113
+ code: formatCurlCommand(curlCommand.replace(/\\"/g, "\"").replace(/\\\\/g, "\\"))
8114
+ })]
8115
+ }), selectedEndpoint?.responses && httpStatusOptions.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8116
+ className: cx("rightCard", "rightCardResponse"),
8117
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8118
+ className: cx("rightCardHeader", "rightCardHeaderResponse"),
8119
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Typography.Text, {
8120
+ strong: true,
8121
+ style: { color: "#fff" },
8122
+ children: "Response"
8123
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Select, {
8124
+ defaultActiveFirstOption: true,
8125
+ defaultValue: 200,
8126
+ className: cx("customSelect"),
8127
+ prefix: false,
8128
+ style: { width: "100%" },
8129
+ value: selectedStatusCode,
8130
+ onChange: setSelectedStatusCode,
8131
+ options: httpStatusOptions,
8132
+ open: httpStatusOptions.length === 1 ? false : void 0,
8133
+ suffixIcon: httpStatusOptions.length > 1 ? void 0 : false
8134
+ })]
8135
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Codebox, { code: JSON.stringify(selectedEndpoint?.responses[selectedStatusCode], null, 2) || "" })]
8136
+ })]
8137
+ });
8138
+ }
8139
+ //#endregion
7139
8140
  //#region src/view/devportal-layout.tsx
7140
- const DevportalDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage }) => {
8141
+ const DocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage }) => {
7141
8142
  const [searchValue, setSearchValue] = (0, react$1.useState)("");
7142
8143
  const { focusedContent, selectedNodeKey, selectedApi, builtTreeData, setOriginalData, setTransformedData, setBuiltTreeData, setFocusedContent, setExpandedKeys } = useStore(({ view }) => view);
7143
8144
  const { selectFirstApi, selectPreSelectedApi, clearSelection } = useNodeSelection();
@@ -7162,7 +8163,7 @@ const DevportalDocumentationLayout = ({ data, preSelectedApi, handleVisitLanding
7162
8163
  setOriginalData(data);
7163
8164
  const transformedData = data.map(transformOpenApiToDocs).sort((a, b) => a.title.localeCompare(b.title));
7164
8165
  setTransformedData(transformedData);
7165
- setBuiltTreeData(buildTreeDataStructure(transformedData));
8166
+ setBuiltTreeData(buildTreeDataStructure$1(transformedData));
7166
8167
  hasInitializedRef.current = true;
7167
8168
  }
7168
8169
  }, [
@@ -7216,11 +8217,11 @@ const DevportalDocumentationLayout = ({ data, preSelectedApi, handleVisitLanding
7216
8217
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7217
8218
  className: cx("docs-layout"),
7218
8219
  children: [
7219
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {
8220
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar$1, {
7220
8221
  searchValue,
7221
8222
  setSearchValue
7222
8223
  }),
7223
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MainContent, {
8224
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MainContent$1, {
7224
8225
  handleVisitLandingPage: _handleVisitLandingPage,
7225
8226
  handleResetSearch,
7226
8227
  searchEnabled: !!searchValue
@@ -7232,7 +8233,7 @@ const DevportalDocumentationLayout = ({ data, preSelectedApi, handleVisitLanding
7232
8233
  };
7233
8234
  //#endregion
7234
8235
  exports.ApiDocumentationBar = ApiDocumentationBar;
7235
- exports.DevportalDocumentationLayout = DevportalDocumentationLayout;
8236
+ exports.ConsoleDocumentationLayout = ConsoleDocumentationLayout;
7236
8237
  exports.DocumentationLayout = DocumentationLayout;
7237
8238
  exports.useStore = useStore;
7238
8239