@digi-frontend/dgate-api-documentation 2.0.1-test.9 → 2.0.2

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,18 +28,28 @@ const react = __toESM(require("react"));
28
28
  const antd = __toESM(require("antd"));
29
29
  const __ant_design_cssinjs = __toESM(require("@ant-design/cssinjs"));
30
30
  const react_jsx_runtime = __toESM(require("react/jsx-runtime"));
31
- const nanoid = __toESM(require("nanoid"));
31
+ const antd_es_typography_Text = __toESM(require("antd/es/typography/Text"));
32
+ const antd_es_typography_Title = __toESM(require("antd/es/typography/Title"));
33
+ const __ant_design_icons = __toESM(require("@ant-design/icons"));
32
34
  const __ant_design_nextjs_registry = __toESM(require("@ant-design/nextjs-registry"));
35
+ const nanoid = __toESM(require("nanoid"));
36
+ const react_syntax_highlighter = __toESM(require("react-syntax-highlighter"));
37
+ const react_syntax_highlighter_dist_esm_languages_hljs_json = __toESM(require("react-syntax-highlighter/dist/esm/languages/hljs/json"));
38
+ const react_syntax_highlighter_dist_esm_styles_hljs = __toESM(require("react-syntax-highlighter/dist/esm/styles/hljs"));
33
39
 
34
40
  //#region src/store/slices/view.ts
35
41
  const createViewSlice = (set) => ({ view: {
36
42
  selectedNodeKey: null,
37
- expandedKeys: ["custom-auth", "api-name-01"],
38
- originalData: [],
39
- transformedData: [],
40
- selectedApi: null,
41
- selectedEndpoint: null,
42
- setSelectedNode: (key) => set((state) => {
43
+ expandedKeys: [],
44
+ originalData: null,
45
+ transformedData: null,
46
+ builtTreeData: null,
47
+ selectedApi: void 0,
48
+ selectedEndpoint: void 0,
49
+ focusedContent: void 0,
50
+ selectedStatusCode: null,
51
+ statusCodeOptions: null,
52
+ setSelectedNodeKey: (key) => set((state) => {
43
53
  state.view.selectedNodeKey = key;
44
54
  }),
45
55
  setExpandedKeys: (keys) => set((state) => {
@@ -52,10 +62,24 @@ const createViewSlice = (set) => ({ view: {
52
62
  state.view.selectedApi = api;
53
63
  }),
54
64
  setSelectedEndpoint: (endpoint) => set((state) => {
65
+ if (endpoint) {
66
+ const availableStatusCodes = Object.keys(endpoint?.responses);
67
+ state.view.statusCodeOptions = availableStatusCodes.map(Number);
68
+ state.view.selectedStatusCode = availableStatusCodes.at(0) ? Number(availableStatusCodes.at(0)) : null;
69
+ }
55
70
  state.view.selectedEndpoint = endpoint;
56
71
  }),
57
72
  setTransformedData: (data) => set((state) => {
58
73
  state.view.transformedData = data;
74
+ }),
75
+ setBuiltTreeData: (data) => set((state) => {
76
+ state.view.builtTreeData = data;
77
+ }),
78
+ setFocusedContent: (content) => set((state) => {
79
+ state.view.focusedContent = content;
80
+ }),
81
+ setSelectedStatusCode: (code) => set((state) => {
82
+ state.view.selectedStatusCode = code;
59
83
  })
60
84
  } });
61
85
 
@@ -135,41 +159,76 @@ function useStyle(componentName, stylesFn) {
135
159
  }
136
160
 
137
161
  //#endregion
138
- //#region src/view/components/Header.tsx
162
+ //#region src/view/components/Header/Header.tsx
139
163
  const { Header: AntHeader } = antd.Layout;
140
164
  const Header = () => {
141
- const { wrapSSR, cx } = useStyle("Header", (token$1, scope) => ({ [scope("header")]: {
142
- width: "100%",
143
- height: "4rem",
144
- backgroundColor: token$1.colorBgContainer
145
- } }));
146
- return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AntHeader, { className: cx("header") }));
147
- };
148
-
149
- //#endregion
150
- //#region src/assets/Minify.svg
151
- var _path;
152
- function _extends() {
153
- return _extends = Object.assign ? Object.assign.bind() : function(n) {
154
- for (var e = 1; e < arguments.length; e++) {
155
- var t = arguments[e];
156
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
157
- }
158
- return n;
159
- }, _extends.apply(null, arguments);
160
- }
161
- var SvgMinify = function SvgMinify$1(props) {
162
- return /* @__PURE__ */ react.createElement("svg", _extends({
163
- xmlns: "http://www.w3.org/2000/svg",
164
- width: 16,
165
- height: 16,
166
- fill: "none"
167
- }, props), _path || (_path = /* @__PURE__ */ react.createElement("path", {
168
- stroke: "currentcolor",
169
- d: "m6 11.334 2-2 2 2M6 4.666l2 2 2-2"
170
- })));
165
+ const { wrapSSR, cx } = useStyle("Header", (token$1, scope) => ({
166
+ [scope("header")]: {
167
+ width: "100%",
168
+ height: "4rem",
169
+ padding: "0 !important",
170
+ margin: "0 !important",
171
+ background: "url(/project-details-title-img.svg) no-repeat top",
172
+ backgroundSize: "cover",
173
+ backgroundPosition: "right",
174
+ backgroundPositionX: "20rem"
175
+ },
176
+ [scope("documentation-title-container")]: {
177
+ justifyContent: "space-between",
178
+ alignItems: "center",
179
+ marginBottom: token$1.marginLG
180
+ },
181
+ [scope("projects-title")]: {
182
+ fontSize: token$1.fontSizeHeading3,
183
+ lineHeight: token$1.lineHeightLG,
184
+ fontWeight: 500,
185
+ marginBottom: token$1.marginXS
186
+ },
187
+ [scope("description")]: {
188
+ fontSize: token$1.fontSizeLG,
189
+ fontWeight: "400",
190
+ fontStyle: "normal",
191
+ lineHeight: token$1.lineHeightLG,
192
+ color: token$1.colorText
193
+ },
194
+ [scope("projects-search-input")]: { width: "28.9375rem" }
195
+ }));
196
+ return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AntHeader, {
197
+ className: cx("header"),
198
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
199
+ className: cx("documentation-title-container"),
200
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
201
+ vertical: true,
202
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Typography.Title, {
203
+ className: cx("projects-title"),
204
+ level: 3,
205
+ children: "Documentation"
206
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Typography.Text, {
207
+ className: cx("description"),
208
+ children: "Explore and integrate with ease clear API references, guides, instructions, and examples, all in one place."
209
+ })]
210
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Radio.Group, {
211
+ optionType: "button",
212
+ buttonStyle: "outline",
213
+ defaultValue: "reference",
214
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Radio.Button, {
215
+ value: "reference",
216
+ className: cx("sdb-radio"),
217
+ children: "API Reference"
218
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
219
+ title: "Coming Soon",
220
+ placement: "bottomRight",
221
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Radio.Button, {
222
+ disabled: true,
223
+ value: "guide",
224
+ className: cx("prd-radio"),
225
+ children: "Guide"
226
+ })
227
+ })]
228
+ })]
229
+ })
230
+ }));
171
231
  };
172
- var Minify_default = SvgMinify;
173
232
 
174
233
  //#endregion
175
234
  //#region src/theme/light.json
@@ -522,8 +581,8 @@ const methodColors = {
522
581
  color: token.colorWarning
523
582
  },
524
583
  PATCH: {
525
- bg: token["volcano.5"],
526
- color: token.colorWhite
584
+ bg: token["volcano.1"],
585
+ color: token["volcano.5"]
527
586
  },
528
587
  OPTIONS: {
529
588
  bg: token["geekblue.2"],
@@ -547,7 +606,7 @@ const buildTreeDataStructure = (data) => {
547
606
  selectable: true,
548
607
  data: api,
549
608
  children: Object.entries(api.tags).map(([tag, endpoints]) => {
550
- const tagId = `tag-${(0, nanoid.nanoid)(8)}`;
609
+ const tagId = `tag-${api.id}-${tag.replace(/\s+/g, "-").toLowerCase()}`;
551
610
  return {
552
611
  title: tag,
553
612
  key: tagId,
@@ -566,7 +625,9 @@ const buildTreeDataStructure = (data) => {
566
625
  data: {
567
626
  endpoint,
568
627
  api,
569
- tagName: tag
628
+ tagName: tag,
629
+ parentApiId: api.id,
630
+ tagId
570
631
  }
571
632
  };
572
633
  })
@@ -585,24 +646,9 @@ const findNodeByKey = (nodes, targetKey) => {
585
646
  }
586
647
  return null;
587
648
  };
588
- const isApiSectionHighlighted = (apiKey, selectedNode, treeDataStructure) => {
589
- if (!selectedNode || selectedNode.length === 0) return false;
590
- const selectedKey = selectedNode[0];
591
- if (selectedKey === apiKey) return false;
592
- const findNodeParentApi = (nodes, targetKey) => {
593
- for (const node of nodes) if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data)) {
594
- const apiId = node.key;
595
- if (node.children) for (const child of node.children) {
596
- if (child.key === targetKey) return apiId;
597
- if (child.children) {
598
- for (const grandChild of child.children) if (grandChild.key === targetKey) return apiId;
599
- }
600
- }
601
- }
602
- return null;
603
- };
604
- const parentApiKey = findNodeParentApi(treeDataStructure, selectedKey);
605
- return parentApiKey === apiKey;
649
+ const isApiSectionHighlighted = (apiKey, selectedEndpoint) => {
650
+ if (!selectedEndpoint) return false;
651
+ return selectedEndpoint.parentApiId === apiKey;
606
652
  };
607
653
  const getAllTreeKeys = (data) => {
608
654
  const keys = [];
@@ -653,7 +699,8 @@ const getSidebarStyles = (token$1, scope) => ({
653
699
  backgroundColor: token$1.colorBgContainer,
654
700
  maxWidth: "17.5rem",
655
701
  overflowY: "auto",
656
- overflowX: "clip"
702
+ overflowX: "clip",
703
+ borderRadius: token$1.borderRadius
657
704
  },
658
705
  [scope("content")]: { padding: token$1.padding },
659
706
  [scope("controls")]: {
@@ -718,7 +765,7 @@ const getSidebarStyles = (token$1, scope) => ({
718
765
 
719
766
  //#endregion
720
767
  //#region src/view/helper/sidebar.components.tsx
721
- const { Text } = antd.Typography;
768
+ const { Text: Text$4 } = antd.Typography;
722
769
  const EndpointItem = ({ method, title, cx }) => {
723
770
  const methodStyle = methodColors[method];
724
771
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -731,7 +778,7 @@ const EndpointItem = ({ method, title, cx }) => {
731
778
  border: "none"
732
779
  },
733
780
  children: method
734
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text, {
781
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text$4, {
735
782
  className: cx("endpoint-text"),
736
783
  ellipsis: { tooltip: title },
737
784
  style: { flex: 1 },
@@ -739,22 +786,22 @@ const EndpointItem = ({ method, title, cx }) => {
739
786
  })]
740
787
  });
741
788
  };
742
- const convertToRenderableTreeData = (treeDataStructure, selectedNode, cx) => {
789
+ const convertToRenderableTreeData = (treeDataStructure, selectedEndpoint, cx) => {
743
790
  const renderNode = (node) => {
744
791
  let title;
745
792
  if (node.isLeaf && node.method) title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointItem, {
746
793
  method: node.method,
747
- title: typeof node.title === "string" ? node.title.replace(`${node.method} `, "") : "",
794
+ title: typeof node.title === "string" ? node.title : "",
748
795
  cx
749
796
  });
750
797
  else if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data)) {
751
- const isHighlighted = isApiSectionHighlighted(node.key, selectedNode, treeDataStructure);
752
- title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text, {
798
+ const isHighlighted = isApiSectionHighlighted(node.key, selectedEndpoint);
799
+ title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text$4, {
753
800
  className: cx("api-title") + (isHighlighted ? " highlighted" : ""),
754
801
  ellipsis: { tooltip: typeof node.title === "string" ? node.title : "" },
755
802
  children: node.title
756
803
  });
757
- } else title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text, {
804
+ } else title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text$4, {
758
805
  className: cx("tag-title"),
759
806
  ellipsis: { tooltip: typeof node.title === "string" ? node.title : "" },
760
807
  children: node.title
@@ -769,153 +816,231 @@ const convertToRenderableTreeData = (treeDataStructure, selectedNode, cx) => {
769
816
  };
770
817
 
771
818
  //#endregion
772
- //#region src/view/components/Sidebar.tsx
773
- const { Sider } = antd.Layout;
774
- var SidebarErrorBoundary = class extends react.default.Component {
775
- constructor(props) {
776
- super(props);
777
- this.state = { hasError: false };
778
- }
779
- static getDerivedStateFromError(error) {
780
- console.error("[Sidebar] Error caught by ErrorBoundary:", error);
781
- return {
782
- hasError: true,
783
- error
784
- };
785
- }
786
- componentDidCatch(error, errorInfo) {
787
- console.error("[Sidebar] ComponentDidCatch - Error:", error);
788
- console.error("[Sidebar] ComponentDidCatch - ErrorInfo:", errorInfo);
789
- setTimeout(() => {
790
- throw new Error(`Sidebar component error: ${error.message}`);
791
- }, 0);
792
- }
793
- render() {
794
- if (this.state.hasError) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sider, {
795
- width: 280,
796
- style: {
797
- backgroundColor: "#f5f5f5",
798
- border: "1px solid #d9d9d9"
799
- },
800
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
801
- style: { padding: 16 },
802
- children: [
803
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
804
- style: {
805
- color: "#ff4d4f",
806
- margin: 0,
807
- marginBottom: 8
808
- },
809
- children: "Sidebar Test Mode"
810
- }),
811
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
812
- style: {
813
- margin: 0,
814
- fontSize: "12px",
815
- color: "#666"
816
- },
817
- children: "Original sidebar failed. This is a test element."
818
- }),
819
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
820
- style: {
821
- marginTop: 8,
822
- fontSize: "11px"
823
- },
824
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", {
825
- style: {
826
- cursor: "pointer",
827
- color: "#1890ff"
828
- },
829
- children: "Error Details"
830
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
831
- style: {
832
- marginTop: 4,
833
- fontSize: "10px",
834
- color: "#ff4d4f"
835
- },
836
- children: this.state.error?.message
837
- })]
838
- })
839
- ]
840
- })
841
- });
842
- return this.props.children;
843
- }
819
+ //#region src/hooks/useNodeSelection.ts
820
+ const useNodeSelection = () => {
821
+ const { setSelectedNodeKey, setFocusedContent, setSelectedApi, setSelectedEndpoint, setExpandedKeys, expandedKeys, builtTreeData } = useStore(({ view }) => view);
822
+ const handleNodeSelection = (nodeData, nodeKey) => {
823
+ if (!nodeData) return null;
824
+ if (nodeKey.startsWith("endpoint-")) {
825
+ const endpointNodeData = nodeData;
826
+ setSelectedEndpoint({
827
+ ...endpointNodeData.endpoint,
828
+ tagName: endpointNodeData.tagName,
829
+ parentApiId: endpointNodeData.parentApiId
830
+ });
831
+ setSelectedApi(endpointNodeData.api);
832
+ setFocusedContent("ENDPOINT");
833
+ const toExpand = [
834
+ endpointNodeData.parentApiId,
835
+ endpointNodeData.tagId,
836
+ endpointNodeData.api.id
837
+ ];
838
+ const expanded = [...expandedKeys];
839
+ toExpand.forEach((key) => {
840
+ if (key && expanded.indexOf(key) < 0) expanded.push(key);
841
+ });
842
+ setExpandedKeys(expanded);
843
+ return {
844
+ type: "endpoint",
845
+ endpoint: endpointNodeData.endpoint,
846
+ api: endpointNodeData.api,
847
+ tag: endpointNodeData.tagName
848
+ };
849
+ } else if (nodeKey.startsWith("api-") || nodeKey === "custom-auth") {
850
+ const apiData = nodeData;
851
+ setSelectedApi(apiData);
852
+ setSelectedEndpoint(null);
853
+ setFocusedContent("API");
854
+ return {
855
+ type: "api",
856
+ api: apiData
857
+ };
858
+ } else {
859
+ const tagData = nodeData;
860
+ return {
861
+ type: "tag",
862
+ tag: tagData.tagName,
863
+ api: tagData.apiData
864
+ };
865
+ }
866
+ };
867
+ const selectNodeByKey = (nodeKey) => {
868
+ const selectedNode = findNodeByKey(builtTreeData, nodeKey);
869
+ if (selectedNode) {
870
+ const result = handleNodeSelection(selectedNode.data, nodeKey);
871
+ setSelectedNodeKey(nodeKey);
872
+ return result;
873
+ }
874
+ return null;
875
+ };
876
+ const expandNode = (nodeKey) => {
877
+ if (!expandedKeys.includes(nodeKey)) setExpandedKeys([...expandedKeys, nodeKey]);
878
+ };
879
+ const selectFirstApi = (treeData) => {
880
+ if (!treeData || treeData.length === 0) return null;
881
+ const firstApiNode = treeData.find((node) => node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data));
882
+ if (firstApiNode) {
883
+ const keysToExpand = [firstApiNode.key];
884
+ if (firstApiNode.children) firstApiNode.children.forEach((tagNode) => {
885
+ keysToExpand.push(tagNode.key);
886
+ });
887
+ setExpandedKeys([...expandedKeys, ...keysToExpand.filter((key) => !expandedKeys.includes(key))]);
888
+ return selectNodeByKey(firstApiNode.key);
889
+ }
890
+ return null;
891
+ };
892
+ const clearSelection = () => {
893
+ setSelectedNodeKey(null);
894
+ setSelectedApi(null);
895
+ setSelectedEndpoint(null);
896
+ };
897
+ return {
898
+ handleNodeSelection,
899
+ selectNodeByKey,
900
+ selectFirstApi,
901
+ clearSelection,
902
+ expandNode
903
+ };
844
904
  };
845
- const FallbackSidebar = () => {
846
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sider, {
847
- width: 280,
848
- style: {
849
- backgroundColor: "#f5f5f5",
850
- border: "1px solid #d9d9d9"
851
- },
852
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
853
- style: { padding: 16 },
854
- children: [
855
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
856
- style: {
857
- color: "#ff4d4f",
858
- margin: 0,
859
- marginBottom: 8
860
- },
861
- children: "Sidebar Error"
862
- }),
863
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
864
- style: {
865
- margin: 0,
866
- fontSize: "12px",
867
- color: "#666"
868
- },
869
- children: "The sidebar component encountered an error and has been disabled."
870
- }),
871
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
872
- style: {
873
- margin: 0,
874
- fontSize: "11px",
875
- color: "#999",
876
- marginTop: 8
877
- },
878
- children: "Check the console for more details."
879
- })
880
- ]
881
- })
882
- });
905
+
906
+ //#endregion
907
+ //#region src/assets/Minify.svg
908
+ var _path$6;
909
+ function _extends$6() {
910
+ return _extends$6 = Object.assign ? Object.assign.bind() : function(n) {
911
+ for (var e = 1; e < arguments.length; e++) {
912
+ var t = arguments[e];
913
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
914
+ }
915
+ return n;
916
+ }, _extends$6.apply(null, arguments);
917
+ }
918
+ var SvgMinify = function SvgMinify$1(props) {
919
+ return /* @__PURE__ */ react.createElement("svg", _extends$6({
920
+ xmlns: "http://www.w3.org/2000/svg",
921
+ width: 16,
922
+ height: 16,
923
+ fill: "none"
924
+ }, props), _path$6 || (_path$6 = /* @__PURE__ */ react.createElement("path", {
925
+ stroke: "currentcolor",
926
+ d: "m6 11.334 2-2 2 2M6 4.666l2 2 2-2"
927
+ })));
883
928
  };
884
- const SafeSidebar = () => {
885
- try {
886
- const expandedKeys = useStore((state) => state.view.expandedKeys);
887
- const setExpandedKeys = useStore((state) => state.view.setExpandedKeys);
888
- const setSelectedApi = useStore((state) => state.view.setSelectedApi);
889
- const setSelectedEndpoint = useStore((state) => state.view.setSelectedEndpoint);
890
- const [selectedNode, setSelectedNodeState] = (0, react.useState)();
891
- const transformedData = useStore((state) => state.view.transformedData);
892
- console.log("[Sidebar] Store access successful, transformedData:", transformedData);
893
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarContent, {
894
- expandedKeys,
895
- setExpandedKeys,
896
- setSelectedApi,
897
- setSelectedEndpoint,
898
- selectedNode,
899
- setSelectedNodeState,
900
- transformedData
901
- });
902
- } catch (error) {
903
- console.error("[Sidebar] Error accessing store or rendering:", error);
904
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FallbackSidebar, {});
905
- }
929
+ var Minify_default = SvgMinify;
930
+
931
+ //#endregion
932
+ //#region src/assets/NoDataSM.svg
933
+ var _path$5, _path2$4, _path3$1, _path4$1, _path5$1, _path6$1, _path7$1, _path8$1, _path9$1, _path0$1, _path1$1, _path10$1, _path11$1, _path12$1, _path13$1, _path14$1, _path15$1, _path16$1;
934
+ function _extends$5() {
935
+ return _extends$5 = Object.assign ? Object.assign.bind() : function(n) {
936
+ for (var e = 1; e < arguments.length; e++) {
937
+ var t = arguments[e];
938
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
939
+ }
940
+ return n;
941
+ }, _extends$5.apply(null, arguments);
942
+ }
943
+ var SvgNoDataSm = function SvgNoDataSm$1(props) {
944
+ return /* @__PURE__ */ react.createElement("svg", _extends$5({
945
+ xmlns: "http://www.w3.org/2000/svg",
946
+ width: 166,
947
+ height: 132,
948
+ fill: "none"
949
+ }, props), _path$5 || (_path$5 = /* @__PURE__ */ react.createElement("path", {
950
+ fill: "#F1F5FD",
951
+ d: "M97.215 48.377c-10.257.061-20.673-.415-30.416-3.113-9.742-2.698-18.359-7.788-26.192-13.733-5.128-3.87-9.792-6.946-16.45-6.483a30.4 30.4 0 0 0-17.76 6.91c-8.469 7.398-7.184 21.07-3.806 30.69 5.092 14.49 20.587 24.55 33.744 31.105 15.214 7.581 31.92 11.988 48.677 14.515 14.687 2.222 33.548 3.845 46.265-5.726 11.689-8.777 14.895-28.846 12.031-42.397a16.68 16.68 0 0 0-6.009-10.157c-8.213-5.981-20.452-1.99-29.681-1.782-3.366.073-6.903.159-10.403.171"
952
+ })), _path2$4 || (_path2$4 = /* @__PURE__ */ react.createElement("path", {
953
+ stroke: "#E0E9F9",
954
+ strokeLinecap: "round",
955
+ strokeLinejoin: "round",
956
+ strokeWidth: .85,
957
+ d: "M47.204 1v5.25M44.572 3.625h5.263M147.054 105.631v5.249M144.422 108.256h5.263"
958
+ })), _path3$1 || (_path3$1 = /* @__PURE__ */ react.createElement("path", {
959
+ fill: "#E0E9F9",
960
+ d: "M7.438 82.963c.662 0 1.2-.536 1.2-1.196 0-.661-.538-1.197-1.2-1.197a1.198 1.198 0 1 0 0 2.393M109.564 6.42c.662 0 1.199-.536 1.199-1.196 0-.661-.537-1.197-1.199-1.197-.663 0-1.2.536-1.2 1.197 0 .66.537 1.196 1.2 1.196"
961
+ })), _path4$1 || (_path4$1 = /* @__PURE__ */ react.createElement("path", {
962
+ fill: "#F1F5FD",
963
+ d: "M76.321 132c24.808 0 44.919-1.246 44.919-2.783s-20.111-2.783-44.919-2.783-44.919 1.246-44.919 2.783S51.513 132 76.322 132"
964
+ })), _path5$1 || (_path5$1 = /* @__PURE__ */ react.createElement("path", {
965
+ fill: "#fff",
966
+ stroke: "#769DE4",
967
+ strokeLinecap: "round",
968
+ strokeLinejoin: "round",
969
+ d: "M41.72 15.258h65.237c1.623 0 3.179.643 4.327 1.788a6.1 6.1 0 0 1 1.793 4.316V98.77a6.1 6.1 0 0 1-1.793 4.316 6.13 6.13 0 0 1-4.327 1.788H33.361a6.13 6.13 0 0 1-4.327-1.788 6.1 6.1 0 0 1-1.793-4.316V29.846z"
970
+ })), _path6$1 || (_path6$1 = /* @__PURE__ */ react.createElement("path", {
971
+ fill: "#F1F5FD",
972
+ d: "M112.783 52.98H45.515v52.64h67.268z"
973
+ })), _path7$1 || (_path7$1 = /* @__PURE__ */ react.createElement("path", {
974
+ fill: "#fff",
975
+ stroke: "#769DE4",
976
+ strokeLinecap: "round",
977
+ strokeLinejoin: "round",
978
+ d: "M27.241 29.846h11.86a2.64 2.64 0 0 0 1.853-.773c.49-.492.767-1.158.767-1.852V15.258zM112.453 36.17H45.919a4.68 4.68 0 0 0-4.688 4.675v14.198a4.68 4.68 0 0 0 4.688 4.675h66.534a4.68 4.68 0 0 0 4.688-4.675V40.845a4.68 4.68 0 0 0-4.688-4.675"
979
+ })), _path8$1 || (_path8$1 = /* @__PURE__ */ react.createElement("path", {
980
+ fill: "#F1F5FD",
981
+ d: "M54.156 52.053a4.083 4.083 0 0 0 4.088-4.077 4.083 4.083 0 0 0-4.088-4.078 4.083 4.083 0 0 0-4.088 4.078 4.083 4.083 0 0 0 4.088 4.077M67.007 52.053a4.083 4.083 0 0 0 4.088-4.077 4.083 4.083 0 0 0-4.088-4.078 4.083 4.083 0 0 0-4.088 4.078 4.083 4.083 0 0 0 4.088 4.077M79.847 52.053a4.083 4.083 0 0 0 4.088-4.077 4.083 4.083 0 0 0-4.088-4.078 4.083 4.083 0 0 0-4.088 4.078 4.083 4.083 0 0 0 4.088 4.077"
982
+ })), _path9$1 || (_path9$1 = /* @__PURE__ */ react.createElement("path", {
983
+ fill: "#fff",
984
+ stroke: "#769DE4",
985
+ strokeLinecap: "round",
986
+ strokeLinejoin: "round",
987
+ d: "M112.453 62.27H45.919a4.68 4.68 0 0 0-4.688 4.675v14.198a4.68 4.68 0 0 0 4.688 4.675h66.534a4.68 4.68 0 0 0 4.688-4.675V66.945a4.68 4.68 0 0 0-4.688-4.675"
988
+ })), _path0$1 || (_path0$1 = /* @__PURE__ */ react.createElement("path", {
989
+ fill: "#F1F5FD",
990
+ d: "M54.156 78.165a4.083 4.083 0 0 0 4.088-4.078 4.083 4.083 0 0 0-4.088-4.077 4.083 4.083 0 0 0-4.088 4.077 4.083 4.083 0 0 0 4.088 4.078M67.007 78.165a4.083 4.083 0 0 0 4.088-4.078 4.083 4.083 0 0 0-4.088-4.077 4.083 4.083 0 0 0-4.088 4.077 4.083 4.083 0 0 0 4.088 4.078M79.847 78.165a4.083 4.083 0 0 0 4.088-4.078 4.083 4.083 0 0 0-4.088-4.077 4.083 4.083 0 0 0-4.088 4.077 4.083 4.083 0 0 0 4.088 4.078"
991
+ })), _path1$1 || (_path1$1 = /* @__PURE__ */ react.createElement("path", {
992
+ fill: "#fff",
993
+ stroke: "#769DE4",
994
+ strokeLinecap: "round",
995
+ strokeLinejoin: "round",
996
+ d: "M112.453 88.383H45.919a4.68 4.68 0 0 0-4.688 4.675v14.198a4.68 4.68 0 0 0 4.688 4.675h66.534a4.68 4.68 0 0 0 4.688-4.675V93.058a4.68 4.68 0 0 0-4.688-4.675"
997
+ })), _path10$1 || (_path10$1 = /* @__PURE__ */ react.createElement("path", {
998
+ fill: "#F1F5FD",
999
+ d: "M54.156 104.264a4.08 4.08 0 0 0 4.088-4.077 4.083 4.083 0 0 0-4.088-4.078 4.083 4.083 0 0 0-4.088 4.078 4.08 4.08 0 0 0 4.088 4.077M67.007 104.264a4.08 4.08 0 0 0 4.088-4.077 4.083 4.083 0 0 0-4.088-4.078 4.083 4.083 0 0 0-4.088 4.078 4.08 4.08 0 0 0 4.088 4.077M79.847 104.264a4.08 4.08 0 0 0 4.088-4.077 4.083 4.083 0 0 0-4.088-4.078 4.083 4.083 0 0 0-4.088 4.078 4.08 4.08 0 0 0 4.088 4.077"
1000
+ })), _path11$1 || (_path11$1 = /* @__PURE__ */ react.createElement("path", {
1001
+ fill: "#fff",
1002
+ stroke: "#769DE4",
1003
+ strokeLinecap: "round",
1004
+ strokeLinejoin: "round",
1005
+ d: "M118.609 66.212c14.013 0 25.372-11.33 25.372-25.306S132.622 15.6 118.609 15.6 93.236 26.93 93.236 40.906s11.36 25.306 25.373 25.306"
1006
+ })), _path12$1 || (_path12$1 = /* @__PURE__ */ react.createElement("path", {
1007
+ fill: "#fff",
1008
+ stroke: "#769DE4",
1009
+ strokeLinecap: "round",
1010
+ strokeLinejoin: "round",
1011
+ d: "M118.903 55.885c8.132 0 14.724-6.575 14.724-14.686 0-8.11-6.592-14.685-14.724-14.685s-14.724 6.575-14.724 14.685c0 8.111 6.592 14.686 14.724 14.686"
1012
+ })), _path13$1 || (_path13$1 = /* @__PURE__ */ react.createElement("path", {
1013
+ fill: "#fff",
1014
+ d: "M111.067 33.371c.308.638 15.672 15.643 15.672 15.643z"
1015
+ })), _path14$1 || (_path14$1 = /* @__PURE__ */ react.createElement("path", {
1016
+ stroke: "#769DE4",
1017
+ strokeLinecap: "round",
1018
+ strokeLinejoin: "round",
1019
+ d: "M111.067 33.371c.308.638 15.672 15.643 15.672 15.643"
1020
+ })), _path15$1 || (_path15$1 = /* @__PURE__ */ react.createElement("path", {
1021
+ fill: "#fff",
1022
+ d: "M126.739 33.371c-.32.638-15.672 15.643-15.672 15.643z"
1023
+ })), _path16$1 || (_path16$1 = /* @__PURE__ */ react.createElement("path", {
1024
+ stroke: "#769DE4",
1025
+ strokeLinecap: "round",
1026
+ strokeLinejoin: "round",
1027
+ d: "M126.739 33.371c-.32.638-15.672 15.643-15.672 15.643"
1028
+ })));
906
1029
  };
907
- const SidebarContent = ({ expandedKeys, setExpandedKeys, setSelectedApi, setSelectedEndpoint, selectedNode, setSelectedNodeState, transformedData }) => {
908
- const builtTreeData = (0, react.useMemo)(() => {
909
- console.log("[Sidebar] transformedData:", transformedData);
910
- const tree = buildTreeDataStructure(transformedData);
911
- console.log("[Sidebar] builtTreeData:", tree);
912
- return tree;
913
- }, [transformedData]);
1030
+ var NoDataSM_default = SvgNoDataSm;
1031
+
1032
+ //#endregion
1033
+ //#region src/view/components/Sidebar.tsx
1034
+ const { Sider } = antd.Layout;
1035
+ const Sidebar = () => {
1036
+ const expandedKeys = useStore((state) => state.view.expandedKeys);
1037
+ const { selectedNodeKey, selectedEndpoint, builtTreeData, setExpandedKeys, setSelectedNodeKey, transformedData } = useStore(({ view }) => view);
1038
+ const { selectNodeByKey, clearSelection } = useNodeSelection();
914
1039
  const [searchValue, setSearchValue] = (0, react.useState)("");
915
1040
  const [autoExpandParent, setAutoExpandParent] = (0, react.useState)(true);
916
- const { wrapSSR, cx } = useStyle("Sidebar", getSidebarStyles);
1041
+ const { wrapSSR, cx, token: token$1 } = useStyle("Sidebar", getSidebarStyles);
917
1042
  const handleSearch = (value) => {
918
- if (value) {
1043
+ if (value && builtTreeData) {
919
1044
  const allKeys = getAllTreeKeys(builtTreeData);
920
1045
  setExpandedKeys(allKeys);
921
1046
  setSearchValue(value);
@@ -926,77 +1051,39 @@ const SidebarContent = ({ expandedKeys, setExpandedKeys, setSelectedApi, setSele
926
1051
  }
927
1052
  };
928
1053
  const renderTreeData = (0, react.useMemo)(() => {
929
- const data = convertToRenderableTreeData(builtTreeData, selectedNode, cx);
930
- console.log("[Sidebar] renderTreeData:", data);
931
- return data;
1054
+ if (!builtTreeData) return [];
1055
+ return convertToRenderableTreeData(builtTreeData, selectedEndpoint, cx);
932
1056
  }, [
933
1057
  builtTreeData,
934
- selectedNode,
1058
+ selectedEndpoint,
935
1059
  cx
936
1060
  ]);
937
1061
  const filteredTreeData = (0, react.useMemo)(() => {
938
1062
  if (!searchValue) return renderTreeData;
1063
+ if (!builtTreeData) return [];
939
1064
  const filteredOriginal = filterTreeData(builtTreeData, searchValue);
940
- const data = convertToRenderableTreeData(filteredOriginal, selectedNode, cx);
941
- console.log("[Sidebar] filteredTreeData:", data);
942
- return data;
1065
+ return convertToRenderableTreeData(filteredOriginal, selectedEndpoint, cx);
943
1066
  }, [
944
1067
  builtTreeData,
945
1068
  searchValue,
946
- selectedNode,
1069
+ selectedEndpoint,
947
1070
  cx
948
1071
  ]);
949
1072
  const collapseAll = () => {
950
1073
  setExpandedKeys([]);
951
1074
  };
952
- const handleNodeSelection = (nodeData, nodeKey) => {
953
- if (!nodeData) return null;
954
- if (nodeKey.startsWith("endpoint-")) {
955
- const endpointNodeData = nodeData;
956
- setSelectedEndpoint(endpointNodeData.endpoint);
957
- setSelectedApi(endpointNodeData.api);
958
- return {
959
- type: "endpoint",
960
- endpoint: endpointNodeData.endpoint,
961
- api: endpointNodeData.api,
962
- tag: endpointNodeData.tagName
963
- };
964
- } else if (nodeKey.startsWith("api-") || nodeKey === "custom-auth") {
965
- const apiData = nodeData;
966
- setSelectedApi(apiData);
967
- setSelectedEndpoint(null);
968
- return {
969
- type: "api",
970
- api: apiData
971
- };
972
- } else {
973
- const tagData = nodeData;
974
- return {
975
- type: "tag",
976
- tag: tagData.tagName,
977
- api: tagData.apiData
978
- };
979
- }
980
- };
981
1075
  const onTreeNodeSelect = (selectedKeys) => {
982
1076
  const stringKeys = selectedKeys.map((key) => String(key));
983
- console.log("[Sidebar] onTreeNodeSelect - selectedKeys:", selectedKeys, "stringKeys:", stringKeys);
984
1077
  if (stringKeys.length === 0) {
985
- setSelectedNodeState([]);
986
- setSelectedApi(null);
987
- setSelectedEndpoint(null);
1078
+ clearSelection();
988
1079
  return;
989
1080
  }
1081
+ if (!builtTreeData) return;
990
1082
  const selectedKey = stringKeys[0];
991
- const selectedNode$1 = findNodeByKey(builtTreeData, selectedKey);
992
- console.log("[Sidebar] findNodeByKey result:", selectedNode$1);
993
- if (selectedNode$1) {
994
- const result = handleNodeSelection(selectedNode$1.data, selectedKey);
995
- console.log("[Sidebar] handleNodeSelection result:", result);
996
- }
997
- setSelectedNodeState(stringKeys);
1083
+ selectNodeByKey(selectedKey);
1084
+ setSelectedNodeKey(selectedKey);
998
1085
  };
999
- return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarErrorBoundary, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sider, {
1086
+ return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sider, {
1000
1087
  width: 280,
1001
1088
  className: cx("sider"),
1002
1089
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -1014,40 +1101,1039 @@ const SidebarContent = ({ expandedKeys, setExpandedKeys, setSelectedApi, setSele
1014
1101
  title: "Collapse All",
1015
1102
  icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Minify_default, {})
1016
1103
  })]
1017
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tree, {
1104
+ }), transformedData?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tree, {
1018
1105
  showLine: { showLeafIcon: false },
1019
1106
  showIcon: false,
1020
1107
  expandedKeys,
1021
1108
  autoExpandParent,
1022
- selectedKeys: selectedNode,
1023
- onSelect: onTreeNodeSelect,
1109
+ selectedKeys: [selectedNodeKey || ""],
1110
+ onSelect: (selectedKeys) => {
1111
+ if (!selectedKeys?.length) return;
1112
+ onTreeNodeSelect(selectedKeys);
1113
+ setSelectedNodeKey(selectedKeys[0]);
1114
+ },
1024
1115
  onExpand: (expandedKeysValue) => {
1025
1116
  setExpandedKeys(expandedKeysValue);
1026
1117
  setAutoExpandParent(false);
1027
1118
  },
1028
1119
  treeData: filteredTreeData,
1029
1120
  className: cx("tree")
1121
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
1122
+ justify: "center",
1123
+ align: "center",
1124
+ gap: token$1.marginSM,
1125
+ vertical: true,
1126
+ style: { marginTop: token$1.paddingXL },
1127
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoDataSM_default, {
1128
+ width: "10.375rem",
1129
+ height: "8.1875rem",
1130
+ style: { backgroundSize: "cover" }
1131
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd_es_typography_Text.default, {
1132
+ style: {
1133
+ textAlign: "center",
1134
+ fontFamily: token$1.fontFamily,
1135
+ fontWeight: 400,
1136
+ fontSize: token$1.fontSizeLG,
1137
+ color: "rgba(0,0,0,0.45)"
1138
+ },
1139
+ children: [
1140
+ "No API",
1141
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {}),
1142
+ "Documentation Found"
1143
+ ]
1144
+ })]
1030
1145
  })]
1031
1146
  })
1032
- }) }));
1147
+ }));
1033
1148
  };
1034
- const Sidebar = () => {
1035
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SafeSidebar, {});
1149
+
1150
+ //#endregion
1151
+ //#region src/assets/grid.svg
1152
+ var _mask, _path$4, _path2$3;
1153
+ function _extends$4() {
1154
+ return _extends$4 = Object.assign ? Object.assign.bind() : function(n) {
1155
+ for (var e = 1; e < arguments.length; e++) {
1156
+ var t = arguments[e];
1157
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1158
+ }
1159
+ return n;
1160
+ }, _extends$4.apply(null, arguments);
1161
+ }
1162
+ var SvgGrid = function SvgGrid$1(props) {
1163
+ return /* @__PURE__ */ react.createElement("svg", _extends$4({
1164
+ xmlns: "http://www.w3.org/2000/svg",
1165
+ width: 16,
1166
+ height: 16,
1167
+ fill: "none"
1168
+ }, props), _mask || (_mask = /* @__PURE__ */ react.createElement("mask", {
1169
+ id: "grid_svg__a",
1170
+ fill: "#fff"
1171
+ }, /* @__PURE__ */ react.createElement("path", { d: "M3.333 2.5a.833.833 0 0 0-.833.833v3.334c0 .46.373.833.833.833h2c.46 0 .834-.373.834-.833V3.333a.833.833 0 0 0-.834-.833zM1.5 3.333c0-1.012.82-1.833 1.833-1.833h2c1.013 0 1.834.82 1.834 1.833v3.334c0 1.012-.82 1.833-1.834 1.833h-2A1.833 1.833 0 0 1 1.5 6.667zm8.333 0c0-.46.373-.833.834-.833h2c.46 0 .833.373.833.833v1.334c0 .46-.373.833-.833.833h-2a.833.833 0 0 1-.834-.833zm.834-1.833c-1.013 0-1.834.82-1.834 1.833v1.334c0 1.012.82 1.833 1.834 1.833h2c1.013 0 1.833-.82 1.833-1.833V3.333c0-1.012-.82-1.833-1.833-1.833zm-.834 7.833c0-.46.373-.833.834-.833h2c.46 0 .833.373.833.833v3.334c0 .46-.373.833-.833.833h-2a.833.833 0 0 1-.834-.833zm.834-1.833c-1.013 0-1.834.82-1.834 1.833v3.334c0 1.013.82 1.833 1.834 1.833h2c1.013 0 1.833-.82 1.833-1.833V9.333c0-1.012-.82-1.833-1.833-1.833zM2.5 11.333c0-.46.373-.833.833-.833h2c.46 0 .834.373.834.833v1.334c0 .46-.373.833-.834.833h-2a.833.833 0 0 1-.833-.833zM3.333 9.5c-1.012 0-1.833.82-1.833 1.833v1.334c0 1.013.82 1.833 1.833 1.833h2c1.013 0 1.834-.82 1.834-1.833v-1.334c0-1.013-.82-1.833-1.834-1.833z" }))), _path$4 || (_path$4 = /* @__PURE__ */ react.createElement("path", {
1172
+ fill: "#D9D9D9",
1173
+ d: "M3.333 2.5a.833.833 0 0 0-.833.833v3.334c0 .46.373.833.833.833h2c.46 0 .834-.373.834-.833V3.333a.833.833 0 0 0-.834-.833zM1.5 3.333c0-1.012.82-1.833 1.833-1.833h2c1.013 0 1.834.82 1.834 1.833v3.334c0 1.012-.82 1.833-1.834 1.833h-2A1.833 1.833 0 0 1 1.5 6.667zm8.333 0c0-.46.373-.833.834-.833h2c.46 0 .833.373.833.833v1.334c0 .46-.373.833-.833.833h-2a.833.833 0 0 1-.834-.833zm.834-1.833c-1.013 0-1.834.82-1.834 1.833v1.334c0 1.012.82 1.833 1.834 1.833h2c1.013 0 1.833-.82 1.833-1.833V3.333c0-1.012-.82-1.833-1.833-1.833zm-.834 7.833c0-.46.373-.833.834-.833h2c.46 0 .833.373.833.833v3.334c0 .46-.373.833-.833.833h-2a.833.833 0 0 1-.834-.833zm.834-1.833c-1.013 0-1.834.82-1.834 1.833v3.334c0 1.013.82 1.833 1.834 1.833h2c1.013 0 1.833-.82 1.833-1.833V9.333c0-1.012-.82-1.833-1.833-1.833zM2.5 11.333c0-.46.373-.833.833-.833h2c.46 0 .834.373.834.833v1.334c0 .46-.373.833-.834.833h-2a.833.833 0 0 1-.833-.833zM3.333 9.5c-1.012 0-1.833.82-1.833 1.833v1.334c0 1.013.82 1.833 1.833 1.833h2c1.013 0 1.834-.82 1.834-1.833v-1.334c0-1.013-.82-1.833-1.834-1.833z"
1174
+ })), _path2$3 || (_path2$3 = /* @__PURE__ */ react.createElement("path", {
1175
+ fill: "#769DE4",
1176
+ d: "M3.333 2.5v-1C2.321 1.5 1.5 2.32 1.5 3.333h2a.167.167 0 0 1-.167.167zm-.833.833h-1v3.334h2V3.333zm0 3.334h-1c0 1.012.82 1.833 1.833 1.833v-2c.092 0 .167.075.167.167zm.833.833v1h2v-2h-2zm2 0v1c1.013 0 1.834-.82 1.834-1.833h-2c0-.092.075-.167.166-.167zm.834-.833h1V3.333h-2v3.334zm0-3.334h1c0-1.012-.82-1.833-1.834-1.833v2a.167.167 0 0 1-.166-.167zM5.333 2.5v-1h-2v2h2zM1.5 3.333h1c0-.46.373-.833.833-.833v-2A2.833 2.833 0 0 0 .5 3.333zM3.333 1.5v1h2v-2h-2zm2 0v1c.46 0 .834.373.834.833h2A2.833 2.833 0 0 0 5.333.5zm1.834 1.833h-1v3.334h2V3.333zm0 3.334h-1c0 .46-.373.833-.834.833v2a2.833 2.833 0 0 0 2.834-2.833zM5.333 8.5v-1h-2v2h2zm-2 0v-1a.833.833 0 0 1-.833-.833h-2A2.833 2.833 0 0 0 3.333 9.5zM1.5 6.667h1V3.333h-2v3.334zm8.333-3.334h1a.167.167 0 0 1-.166.167v-2c-1.013 0-1.834.82-1.834 1.833zm.834-.833v1h2v-2h-2zm2 0v1a.167.167 0 0 1-.167-.167h2c0-1.012-.82-1.833-1.833-1.833zm.833.833h-1v1.334h2V3.333zm0 1.334h-1c0-.092.075-.167.167-.167v2c1.013 0 1.833-.82 1.833-1.833zm-.833.833v-1h-2v2h2zm-2 0v-1c.091 0 .166.075.166.167h-2c0 1.012.82 1.833 1.834 1.833zm-.834-.833h1V3.333h-2v1.334zm.834-3.167v-1a2.833 2.833 0 0 0-2.834 2.833h2c0-.46.373-.833.834-.833zM8.833 3.333h-1v1.334h2V3.333zm0 1.334h-1A2.833 2.833 0 0 0 10.667 7.5v-2a.833.833 0 0 1-.834-.833zM10.667 6.5v1h2v-2h-2zm2 0v1A2.833 2.833 0 0 0 15.5 4.667h-2c0 .46-.373.833-.833.833zM14.5 4.667h1V3.333h-2v1.334zm0-1.334h1A2.833 2.833 0 0 0 12.667.5v2c.46 0 .833.373.833.833zM12.667 1.5v-1h-2v2h2zM9.833 9.333h1a.167.167 0 0 1-.166.167v-2c-1.013 0-1.834.82-1.834 1.833zm.834-.833v1h2v-2h-2zm2 0v1a.167.167 0 0 1-.167-.167h2c0-1.012-.82-1.833-1.833-1.833zm.833.833h-1v3.334h2V9.333zm0 3.334h-1c0-.092.075-.167.167-.167v2c1.013 0 1.833-.82 1.833-1.833zm-.833.833v-1h-2v2h2zm-2 0v-1c.091 0 .166.075.166.167h-2c0 1.013.82 1.833 1.834 1.833zm-.834-.833h1V9.333h-2v3.334zm.834-5.167v-1a2.833 2.833 0 0 0-2.834 2.833h2c0-.46.373-.833.834-.833zM8.833 9.333h-1v3.334h2V9.333zm0 3.334h-1a2.833 2.833 0 0 0 2.834 2.833v-2a.833.833 0 0 1-.834-.833zm1.834 1.833v1h2v-2h-2zm2 0v1a2.833 2.833 0 0 0 2.833-2.833h-2c0 .46-.373.833-.833.833zm1.833-1.833h1V9.333h-2v3.334zm0-3.334h1A2.833 2.833 0 0 0 12.667 6.5v2c.46 0 .833.373.833.833zM12.667 7.5v-1h-2v2h2zM2.5 11.333h1a.167.167 0 0 1-.167.167v-2c-1.012 0-1.833.82-1.833 1.833zm.833-.833v1h2v-2h-2zm2 0v1a.167.167 0 0 1-.166-.167h2c0-1.013-.82-1.833-1.834-1.833zm.834.833h-1v1.334h2v-1.334zm0 1.334h-1c0-.092.075-.167.166-.167v2c1.013 0 1.834-.82 1.834-1.833zm-.834.833v-1h-2v2h2zm-2 0v-1c.092 0 .167.075.167.167h-2c0 1.013.82 1.833 1.833 1.833zm-.833-.833h1v-1.334h-2v1.334zM3.333 9.5v-1A2.833 2.833 0 0 0 .5 11.333h2c0-.46.373-.833.833-.833zM1.5 11.333h-1v1.334h2v-1.334zm0 1.334h-1A2.833 2.833 0 0 0 3.333 15.5v-2a.833.833 0 0 1-.833-.833zM3.333 14.5v1h2v-2h-2zm2 0v1a2.833 2.833 0 0 0 2.834-2.833h-2c0 .46-.373.833-.834.833zm1.834-1.833h1v-1.334h-2v1.334zm0-1.334h1A2.833 2.833 0 0 0 5.333 8.5v2c.46 0 .834.373.834.833zM5.333 9.5v-1h-2v2h2z",
1177
+ mask: "url(#grid_svg__a)"
1178
+ })));
1179
+ };
1180
+ var grid_default = SvgGrid;
1181
+
1182
+ //#endregion
1183
+ //#region src/assets/list.svg
1184
+ var _path$3;
1185
+ function _extends$3() {
1186
+ return _extends$3 = Object.assign ? Object.assign.bind() : function(n) {
1187
+ for (var e = 1; e < arguments.length; e++) {
1188
+ var t = arguments[e];
1189
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1190
+ }
1191
+ return n;
1192
+ }, _extends$3.apply(null, arguments);
1193
+ }
1194
+ var SvgList = function SvgList$1(props) {
1195
+ return /* @__PURE__ */ react.createElement("svg", _extends$3({
1196
+ xmlns: "http://www.w3.org/2000/svg",
1197
+ width: 16,
1198
+ height: 16,
1199
+ fill: "none"
1200
+ }, props), _path$3 || (_path$3 = /* @__PURE__ */ react.createElement("path", {
1201
+ stroke: "#000",
1202
+ strokeLinecap: "round",
1203
+ strokeLinejoin: "round",
1204
+ strokeOpacity: .25,
1205
+ d: "M13.267 9H2.734c-1 0-1.4.427-1.4 1.487v2.693c0 1.06.4 1.487 1.4 1.487h10.533c1 0 1.4-.427 1.4-1.487v-2.693c0-1.06-.4-1.487-1.4-1.487M13.267 1.334H2.734c-1 0-1.4.427-1.4 1.487v2.693c0 1.06.4 1.487 1.4 1.487h10.533c1 0 1.4-.427 1.4-1.487V2.821c0-1.06-.4-1.487-1.4-1.487"
1206
+ })));
1036
1207
  };
1208
+ var list_default = SvgList;
1209
+
1210
+ //#endregion
1211
+ //#region src/assets/copy.svg
1212
+ var _path$2, _path2$2;
1213
+ function _extends$2() {
1214
+ return _extends$2 = Object.assign ? Object.assign.bind() : function(n) {
1215
+ for (var e = 1; e < arguments.length; e++) {
1216
+ var t = arguments[e];
1217
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1218
+ }
1219
+ return n;
1220
+ }, _extends$2.apply(null, arguments);
1221
+ }
1222
+ var SvgCopy = function SvgCopy$1(props) {
1223
+ return /* @__PURE__ */ react.createElement("svg", _extends$2({
1224
+ xmlns: "http://www.w3.org/2000/svg",
1225
+ width: 16,
1226
+ height: 16,
1227
+ fill: "none"
1228
+ }, props), _path$2 || (_path$2 = /* @__PURE__ */ react.createElement("path", {
1229
+ fill: "#000",
1230
+ fillOpacity: .45,
1231
+ d: "M7.4 15.167H4.6c-2.607 0-3.767-1.16-3.767-3.766V8.6c0-2.607 1.16-3.767 3.767-3.767h2.8c2.606 0 3.766 1.16 3.766 3.767v2.8c0 2.606-1.16 3.766-3.766 3.766M4.6 5.834c-2.067 0-2.767.7-2.767 2.767v2.8c0 2.066.7 2.766 2.767 2.766h2.8c2.066 0 2.766-.7 2.766-2.766V8.6c0-2.067-.7-2.767-2.766-2.767z"
1232
+ })), _path2$2 || (_path2$2 = /* @__PURE__ */ react.createElement("path", {
1233
+ fill: "#000",
1234
+ fillOpacity: .45,
1235
+ d: "M11.4 11.167h-.734a.504.504 0 0 1-.5-.5V8.601c0-2.067-.7-2.767-2.766-2.767H5.333a.504.504 0 0 1-.5-.5v-.733C4.833 1.994 5.993.834 8.6.834h2.8c2.606 0 3.766 1.16 3.766 3.767v2.8c0 2.606-1.16 3.766-3.766 3.766m-.234-1h.234c2.066 0 2.766-.7 2.766-2.766V4.6c0-2.067-.7-2.767-2.766-2.767H8.6c-2.067 0-2.767.7-2.767 2.767v.233H7.4c2.606 0 3.766 1.16 3.766 3.767z"
1236
+ })));
1237
+ };
1238
+ var copy_default = SvgCopy;
1239
+
1240
+ //#endregion
1241
+ //#region src/assets/link.svg
1242
+ var _path$1, _path2$1;
1243
+ function _extends$1() {
1244
+ return _extends$1 = Object.assign ? Object.assign.bind() : function(n) {
1245
+ for (var e = 1; e < arguments.length; e++) {
1246
+ var t = arguments[e];
1247
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1248
+ }
1249
+ return n;
1250
+ }, _extends$1.apply(null, arguments);
1251
+ }
1252
+ var SvgLink = function SvgLink$1(props) {
1253
+ return /* @__PURE__ */ react.createElement("svg", _extends$1({
1254
+ xmlns: "http://www.w3.org/2000/svg",
1255
+ width: 12,
1256
+ height: 12,
1257
+ fill: "none"
1258
+ }, props), _path$1 || (_path$1 = /* @__PURE__ */ react.createElement("path", {
1259
+ fill: "#4D75D9",
1260
+ d: "M3.875 9.25C2.085 9.25.625 7.79.625 6s1.46-3.25 3.25-3.25c.205 0 .375.17.375.375s-.17.375-.375.375a2.5 2.5 0 0 0 0 5 2.5 2.5 0 0 0 2.5-2.5c0-.205.17-.375.375-.375s.375.17.375.375c0 1.79-1.46 3.25-3.25 3.25"
1261
+ })), _path2$1 || (_path2$1 = /* @__PURE__ */ react.createElement("path", {
1262
+ fill: "#4D75D9",
1263
+ d: "M8 9.375A.38.38 0 0 1 7.625 9c0-.205.17-.375.375-.375A2.63 2.63 0 0 0 10.625 6 2.63 2.63 0 0 0 8 3.375 2.63 2.63 0 0 0 5.375 6c0 .205-.17.375-.375.375A.38.38 0 0 1 4.625 6 3.38 3.38 0 0 1 8 2.625 3.38 3.38 0 0 1 11.375 6 3.38 3.38 0 0 1 8 9.375"
1264
+ })));
1265
+ };
1266
+ var link_default = SvgLink;
1267
+
1268
+ //#endregion
1269
+ //#region src/view/components/ApiPage/components/ApiCard.tsx
1270
+ const ApiCard = ({ api, viewStyle }) => {
1271
+ const { wrapSSR, cx, token: token$1 } = useStyle("DocumentationApiCard", (token$2, scope) => ({
1272
+ [scope("method-chip")]: {
1273
+ minWidth: "5.375rem",
1274
+ width: "fit-content",
1275
+ paddingLeft: token$2.marginXS,
1276
+ paddingRight: token$2.marginXS,
1277
+ display: "flex",
1278
+ justifyContent: "center",
1279
+ alignItems: "center",
1280
+ borderRadius: token$2.borderRadius
1281
+ },
1282
+ [scope("list-container")]: {
1283
+ paddingTop: token$2.marginXS,
1284
+ paddingBottom: token$2.marginXS
1285
+ },
1286
+ [scope("chip-title")]: {
1287
+ alignSelf: "center",
1288
+ textAlign: "center",
1289
+ padding: 0,
1290
+ margin: 0,
1291
+ lineHeight: "1.375rem",
1292
+ fontSize: token$2.fontSize
1293
+ },
1294
+ [scope("list-see-details")]: {
1295
+ width: "6.5625rem",
1296
+ height: "2rem",
1297
+ borderRadius: token$2.borderRadius,
1298
+ border: `${token$2.lineWidth}rem solid ${token$2.Button?.defaultBorderColor}`,
1299
+ paddingRight: token$2.Button?.paddingInline,
1300
+ paddingLeft: token$2.Button?.paddingInline
1301
+ },
1302
+ [scope("list-content")]: {
1303
+ display: "flex",
1304
+ paddingTop: token$2.paddingXXS,
1305
+ paddingBottom: token$2.paddingXXS,
1306
+ paddingRight: token$2.paddingXS,
1307
+ paddingLeft: token$2.paddingXS,
1308
+ alignItems: "center",
1309
+ gap: token$2.marginXS,
1310
+ alignSelf: "stretch",
1311
+ flexDirection: "row",
1312
+ borderRadius: token$2.borderRadiusSM,
1313
+ border: `1px solid ${token$2.colorBorderSecondary}`,
1314
+ minWidth: "6.25rem",
1315
+ maxWidth: "fit-content"
1316
+ },
1317
+ [scope("list-title")]: {
1318
+ color: token$2.colorTextHeading,
1319
+ fontSize: token$2.fontSizeHeading3,
1320
+ fontWeight: token$2.fontWeightStrong,
1321
+ lineHeight: token$2.lineHeightHeading3,
1322
+ paddingBottom: 0,
1323
+ marginBottom: 0,
1324
+ fontFamily: "SF Pro",
1325
+ "&:hover": {
1326
+ color: `${token$2.colorPrimary} !important`,
1327
+ textDecoration: "underline"
1328
+ }
1329
+ },
1330
+ [scope("path-name")]: {
1331
+ color: token$2.colorText,
1332
+ fontSize: token$2.fontSizeSM,
1333
+ fontWeight: 400,
1334
+ fontFamily: token$2.fontFamily
1335
+ },
1336
+ [scope("grid-card")]: {
1337
+ width: "17.5rem",
1338
+ height: "100%",
1339
+ borderRadius: token$2.borderRadiusLG
1340
+ },
1341
+ [scope("grid-title")]: {
1342
+ color: token$2.colorTextHeading,
1343
+ fontSize: token$2.fontSizeHeading3,
1344
+ fontWeight: token$2.fontWeightStrong,
1345
+ lineHeight: token$2.lineHeightHeading3,
1346
+ paddingBottom: 0,
1347
+ marginBottom: 0,
1348
+ fontFamily: token$2.fontFamily
1349
+ },
1350
+ [scope("grid-content")]: {
1351
+ display: "flex",
1352
+ paddingTop: token$2.paddingXXS,
1353
+ paddingBottom: token$2.paddingXXS,
1354
+ paddingRight: token$2.paddingXS,
1355
+ paddingLeft: token$2.paddingXS,
1356
+ alignItems: "center",
1357
+ gap: token$2.marginXS,
1358
+ alignSelf: "stretch",
1359
+ flexDirection: "row",
1360
+ borderRadius: token$2.borderRadiusSM,
1361
+ border: `1px solid ${token$2.colorBorderSecondary}`
1362
+ },
1363
+ [scope("grid-path-name")]: {
1364
+ color: token$2.colorText,
1365
+ fontSize: token$2.fontSizeSM,
1366
+ fontWeight: 400,
1367
+ fontFamily: token$2.fontFamily
1368
+ },
1369
+ [scope("grid-see-details")]: {
1370
+ paddingTop: 0,
1371
+ paddingBottom: 0,
1372
+ paddingLeft: "0.4375rem",
1373
+ paddingRight: "0.4375rem",
1374
+ borderRadius: token$2.borderRadiusSM,
1375
+ border: `1px solid ${token$2.Button?.defaultBorderColor}`,
1376
+ background: token$2.Button?.defaultBg,
1377
+ boxShadow: `0 2px 0 0 rgba(0, 0, 0, 0.02)`,
1378
+ width: "100%",
1379
+ height: "1.5rem"
1380
+ }
1381
+ }));
1382
+ const { selectNodeByKey } = useNodeSelection();
1383
+ const handleOpenEndPointView = () => {
1384
+ selectNodeByKey(api.id);
1385
+ };
1386
+ const TooltippedText = ({ text }) => {
1387
+ const limitation = viewStyle == "grid" ? 15 : 36;
1388
+ if (text.length < limitation) return text;
1389
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Tooltip, {
1390
+ title: text,
1391
+ placement: "bottomLeft",
1392
+ children: [text.substring(0, limitation), "..."]
1393
+ });
1394
+ };
1395
+ const MethodChip = ({ method }) => {
1396
+ const { bg, color } = methodColors[method.toUpperCase()];
1397
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1398
+ className: cx("method-chip"),
1399
+ style: {
1400
+ color,
1401
+ backgroundColor: bg
1402
+ },
1403
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
1404
+ color,
1405
+ className: cx("chip-title"),
1406
+ level: 5,
1407
+ children: method
1408
+ })
1409
+ });
1410
+ };
1411
+ if (viewStyle == "list") return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
1412
+ vertical: true,
1413
+ children: [
1414
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
1415
+ justify: "space-between",
1416
+ align: "center",
1417
+ className: cx("list-container"),
1418
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
1419
+ gap: token$1.marginSM,
1420
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MethodChip, { method: api.method }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
1421
+ className: cx("list-title"),
1422
+ level: 4,
1423
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltippedText, { text: api?.summary || "Endpoint Name" })
1424
+ })]
1425
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
1426
+ color: "default",
1427
+ className: cx("list-see-details"),
1428
+ onClick: handleOpenEndPointView,
1429
+ children: "See Details"
1430
+ })]
1431
+ }),
1432
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1433
+ className: cx("list-content"),
1434
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(link_default, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text.default, {
1435
+ className: cx("path-name"),
1436
+ children: api?.path
1437
+ })]
1438
+ }),
1439
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Divider, { style: {
1440
+ marginTop: "0.75rem",
1441
+ marginBottom: "0.25rem"
1442
+ } })
1443
+ ]
1444
+ }));
1445
+ return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Card, {
1446
+ className: cx("grid-card"),
1447
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
1448
+ vertical: true,
1449
+ gap: token$1.marginSM,
1450
+ children: [
1451
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MethodChip, { method: api?.method }),
1452
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
1453
+ className: cx("grid-title"),
1454
+ level: 4,
1455
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltippedText, { text: api?.summary || "Endpoint Name" })
1456
+ }),
1457
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1458
+ className: cx("grid-content"),
1459
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(link_default, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text.default, {
1460
+ className: cx("grid-path-name"),
1461
+ children: api?.path
1462
+ })]
1463
+ }),
1464
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
1465
+ className: cx("grid-see-details"),
1466
+ onClick: handleOpenEndPointView,
1467
+ children: "See Details"
1468
+ })
1469
+ ]
1470
+ })
1471
+ }));
1472
+ };
1473
+ var ApiCard_default = ApiCard;
1474
+
1475
+ //#endregion
1476
+ //#region src/utils/index.ts
1477
+ const handleStatusColor = (code) => {
1478
+ if (code >= 200 && code < 300) return "green";
1479
+ else if (code >= 400 && code < 500) return "red";
1480
+ else if (code >= 500 && code < 600) return "red";
1481
+ else if (code >= 100 && code < 200) return "blue";
1482
+ else if (code >= 300 && code < 400) return "orange";
1483
+ else return "gray";
1484
+ };
1485
+ const copyToClipboard = async (text) => {
1486
+ try {
1487
+ await navigator.clipboard.writeText(text);
1488
+ return;
1489
+ } catch (err) {
1490
+ return err;
1491
+ }
1492
+ };
1493
+
1494
+ //#endregion
1495
+ //#region src/view/components/ApiPage/index.tsx
1496
+ const APIPage = () => {
1497
+ const [selectedUrl, setSelectedUrl] = (0, react.useState)("");
1498
+ const [copying, setCopying] = (0, react.useState)(false);
1499
+ const { view: { selectedApi, transformedData, setSelectedApi, setFocusedContent, setSelectedNodeKey } } = store_default();
1500
+ const [viewStyle, setViewStyle] = (0, react.useState)("grid");
1501
+ const { wrapSSR, cx, token: token$1 } = useStyle("DocumentationApiPage", () => ({}));
1502
+ const currentVersion = selectedApi?.relatedVersions?.find((v) => v.apiId === selectedApi?.currentVersion);
1503
+ const handleVersionChanged = (value) => {
1504
+ console.log("new value ", value);
1505
+ const apiByVersion = transformedData?.find((item) => item.currentVersion === value);
1506
+ if (apiByVersion) {
1507
+ setSelectedApi(apiByVersion);
1508
+ setFocusedContent("API");
1509
+ setSelectedNodeKey(apiByVersion.id);
1510
+ }
1511
+ };
1512
+ (0, react.useEffect)(() => {
1513
+ if (selectedApi?.servers && !selectedUrl) setSelectedUrl(selectedApi?.servers?.[0].url);
1514
+ }, [selectedApi?.servers]);
1515
+ const handleCopyUrl = async () => {
1516
+ setCopying(true);
1517
+ await copyToClipboard(selectedUrl);
1518
+ setTimeout(() => {
1519
+ setCopying(false);
1520
+ }, 700);
1521
+ };
1522
+ const APIsRenderer = ({ apis, withTitle, tagName, haveUnderLine }) => {
1523
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
1524
+ gap: viewStyle == "grid" ? token$1.marginXS : 0,
1525
+ style: {
1526
+ marginBottom: 0,
1527
+ paddingBottom: 0
1528
+ },
1529
+ vertical: true,
1530
+ children: [
1531
+ withTitle && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
1532
+ style: { marginBottom: 0 },
1533
+ level: 4,
1534
+ children: tagName
1535
+ }),
1536
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Flex, {
1537
+ wrap: "wrap",
1538
+ gap: viewStyle == "grid" ? "1.5rem" : 0,
1539
+ vertical: viewStyle == "list",
1540
+ children: apis.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ApiCard_default, {
1541
+ api: item,
1542
+ viewStyle
1543
+ }))
1544
+ }),
1545
+ haveUnderLine && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Divider, { style: {
1546
+ marginTop: token$1.marginSM,
1547
+ marginBottom: token$1.marginSM
1548
+ } })
1549
+ ]
1550
+ });
1551
+ };
1552
+ return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
1553
+ vertical: true,
1554
+ gap: token$1.margin,
1555
+ children: [
1556
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
1557
+ className: cx("container"),
1558
+ level: 4,
1559
+ children: selectedApi?.title
1560
+ }),
1561
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, { children: [
1562
+ selectedApi?.authType && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
1563
+ title: "Authenticator Type",
1564
+ placement: "bottomLeft",
1565
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, {
1566
+ style: {
1567
+ minWidth: "3.9375rem",
1568
+ width: "max-content",
1569
+ height: "2rem",
1570
+ background: "#fff",
1571
+ borderRadius: token$1.borderRadiusSM,
1572
+ paddingTop: "0.0625rem",
1573
+ paddingBottom: "0.0625rem",
1574
+ paddingRight: token$1.paddingContentHorizontalSM,
1575
+ paddingLeft: token$1.paddingContentHorizontalSM,
1576
+ display: "flex",
1577
+ justifyContent: "center",
1578
+ alignItems: "center"
1579
+ },
1580
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ant_design_icons.LockOutlined, {}),
1581
+ children: selectedApi?.authType?.replace(/_/g, " ")
1582
+ })
1583
+ }),
1584
+ selectedApi?.authType && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Divider, {
1585
+ style: { height: "2rem" },
1586
+ type: "vertical"
1587
+ }),
1588
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Select, {
1589
+ size: "middle",
1590
+ prefix: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
1591
+ title: "API Version",
1592
+ placement: "bottom",
1593
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ant_design_icons.InfoCircleOutlined, {})
1594
+ }),
1595
+ value: currentVersion?.apiId,
1596
+ onChange: handleVersionChanged,
1597
+ style: {
1598
+ minWidth: "6.1875rem",
1599
+ width: "max-content",
1600
+ display: "flex",
1601
+ justifyContent: "center",
1602
+ alignContent: "center",
1603
+ alignItems: "center",
1604
+ paddingLeft: "0.5rem",
1605
+ paddingRight: "0.5rem"
1606
+ },
1607
+ placeholder: "Version",
1608
+ options: selectedApi?.relatedVersions?.map((item) => ({
1609
+ label: item.version,
1610
+ value: item.apiId
1611
+ })),
1612
+ showSearch: false
1613
+ }),
1614
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Divider, {
1615
+ style: { height: "2rem" },
1616
+ type: "vertical"
1617
+ }),
1618
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Select, {
1619
+ size: "middle",
1620
+ prefix: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
1621
+ title: "URL",
1622
+ placement: "bottom",
1623
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ant_design_icons.InfoCircleOutlined, {})
1624
+ }),
1625
+ value: selectedApi?.servers?.[0]?.url,
1626
+ onChange: setSelectedUrl,
1627
+ style: {
1628
+ width: "24.75rem",
1629
+ display: "flex",
1630
+ justifyContent: "center",
1631
+ alignContent: "center",
1632
+ alignItems: "center",
1633
+ paddingLeft: "0.5rem"
1634
+ },
1635
+ placeholder: "API URLs",
1636
+ options: selectedApi?.servers?.map((server) => ({
1637
+ label: server?.url,
1638
+ value: server?.url
1639
+ })),
1640
+ showSearch: false
1641
+ }),
1642
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
1643
+ color: copying ? "green" : "default",
1644
+ variant: copying ? "filled" : "outlined",
1645
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(copy_default, {}),
1646
+ iconPosition: "end",
1647
+ style: { marginLeft: "0.69rem" },
1648
+ onClick: handleCopyUrl,
1649
+ children: !copying ? "Copy" : "Copied"
1650
+ }),
1651
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Radio.Group, {
1652
+ style: {
1653
+ marginLeft: "auto",
1654
+ display: "flex"
1655
+ },
1656
+ optionType: "button",
1657
+ buttonStyle: "outline",
1658
+ defaultValue: viewStyle,
1659
+ onChange: (e) => {
1660
+ setViewStyle(e.target.value);
1661
+ },
1662
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Radio.Button, {
1663
+ value: "grid",
1664
+ style: {
1665
+ display: "flex",
1666
+ alignItems: "center"
1667
+ },
1668
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(grid_default, {})
1669
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Radio.Button, {
1670
+ value: "list",
1671
+ style: {
1672
+ display: "flex",
1673
+ alignItems: "center"
1674
+ },
1675
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(list_default, {})
1676
+ })]
1677
+ })
1678
+ ] }),
1679
+ selectedApi?.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text.default, {
1680
+ style: {
1681
+ fontFamily: token$1.fontFamily,
1682
+ fontWeight: 400,
1683
+ fontSize: token$1.fontSizeLG,
1684
+ color: `rgba(0,0,0, 0.45)`
1685
+ },
1686
+ children: selectedApi?.description
1687
+ }),
1688
+ Object.keys(selectedApi?.tags || {}).sort((a, b) => {
1689
+ if (a.toLowerCase() === "default") return 1;
1690
+ if (b.toLowerCase() === "default") return -1;
1691
+ return 0;
1692
+ }).map((key, index) => {
1693
+ if (key.toLowerCase() == "default" && Object.keys(selectedApi?.tags).length <= 1) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(APIsRenderer, {
1694
+ apis: selectedApi?.tags[key],
1695
+ tagName: key,
1696
+ withTitle: false
1697
+ });
1698
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(APIsRenderer, {
1699
+ apis: selectedApi?.tags[key],
1700
+ tagName: key,
1701
+ withTitle: true,
1702
+ haveUnderLine: index < Object.keys(selectedApi?.tags || {}).length - 1
1703
+ });
1704
+ })
1705
+ ]
1706
+ }));
1707
+ };
1708
+
1709
+ //#endregion
1710
+ //#region src/view/components/EndpointPage/EndpointPage.tsx
1711
+ const { Title: Title$1, Paragraph } = antd.Typography;
1712
+ const requestColumns = [
1713
+ {
1714
+ title: "Parameter",
1715
+ dataIndex: "param",
1716
+ key: "param"
1717
+ },
1718
+ {
1719
+ title: "Description",
1720
+ dataIndex: "desc",
1721
+ key: "desc"
1722
+ },
1723
+ {
1724
+ title: "Enum",
1725
+ dataIndex: "enum",
1726
+ key: "enum"
1727
+ }
1728
+ ];
1729
+ const responseColumns = [...requestColumns];
1730
+ const buildRequestData = (params) => params.map((p, index) => ({
1731
+ key: index,
1732
+ param: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
1733
+ p.name,
1734
+ p.schema?.type && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1735
+ style: {
1736
+ color: "rgba(0,0,0,0.45)",
1737
+ marginLeft: "0.25rem",
1738
+ marginRight: "0.25rem"
1739
+ },
1740
+ children: p.schema.type
1741
+ }),
1742
+ p.required ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1743
+ style: { color: "red" },
1744
+ children: "*"
1745
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1746
+ style: { color: "#52C41A" },
1747
+ children: "Optional"
1748
+ })
1749
+ ] }),
1750
+ desc: p.description || "-",
1751
+ enum: p.schema?.enum ? p.schema.enum.map((e) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, { children: e }, e)) : "--"
1752
+ }));
1753
+ const buildHeaderData = (headers) => {
1754
+ if (!headers) return [];
1755
+ return Object.entries(headers).map(([name, header], idx) => ({
1756
+ key: idx,
1757
+ param: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
1758
+ name,
1759
+ header.schema?.type && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1760
+ style: {
1761
+ color: "rgba(0,0,0,0.45)",
1762
+ marginLeft: "0.25rem",
1763
+ marginRight: "0.25rem"
1764
+ },
1765
+ children: header.schema.type
1766
+ }),
1767
+ header.required ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1768
+ style: { color: "red" },
1769
+ children: "*"
1770
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1771
+ style: { color: "#52C41A" },
1772
+ children: "Optional"
1773
+ })
1774
+ ] }),
1775
+ desc: header.description || "-",
1776
+ enum: header.schema?.enum ? header.schema.enum.map((e) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, { children: e }, e)) : "--"
1777
+ }));
1778
+ };
1779
+ const EndpointPage = () => {
1780
+ const { selectedEndpoint, selectedApi, selectedStatusCode, setSelectedNodeKey, setFocusedContent } = store_default(({ view }) => view);
1781
+ const [endpointTooltip, setEndpointTooltip] = (0, react.useState)("Copy endpoint");
1782
+ const [selectedServer, setSelectedServer] = (0, react.useState)(0);
1783
+ const { cx } = useStyle("EndpointPage", (token$1, scope) => ({
1784
+ [scope("container")]: {
1785
+ display: "flex",
1786
+ flexDirection: "column",
1787
+ gap: token$1.marginLG,
1788
+ height: "100%"
1789
+ },
1790
+ [scope("content")]: {
1791
+ width: "100%",
1792
+ height: "100%"
1793
+ },
1794
+ [scope("code")]: {
1795
+ background: "unset",
1796
+ borderRadius: token$1.borderRadius,
1797
+ padding: token$1.paddingSM,
1798
+ fontFamily: "monospace",
1799
+ whiteSpace: "pre-wrap"
1800
+ },
1801
+ [scope("breadcrumb")]: {
1802
+ display: "flex",
1803
+ gap: token$1.marginLG,
1804
+ alignItems: "center",
1805
+ marginBottom: token$1.marginLG
1806
+ }
1807
+ }));
1808
+ const methodStyle = methodColors[selectedEndpoint?.method];
1809
+ const headerParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || []);
1810
+ const pathParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || []);
1811
+ const queryParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || []);
1812
+ const requestTabs = [
1813
+ headerParams.length > 0 ? {
1814
+ key: "header",
1815
+ label: "Header",
1816
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
1817
+ columns: requestColumns,
1818
+ dataSource: headerParams,
1819
+ pagination: false,
1820
+ bordered: true,
1821
+ size: "small"
1822
+ })
1823
+ } : null,
1824
+ pathParams.length > 0 ? {
1825
+ key: "path",
1826
+ label: "Path",
1827
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
1828
+ columns: requestColumns,
1829
+ dataSource: pathParams,
1830
+ pagination: false,
1831
+ bordered: true,
1832
+ size: "small"
1833
+ })
1834
+ } : null,
1835
+ queryParams.length > 0 ? {
1836
+ key: "query",
1837
+ label: "Query",
1838
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
1839
+ columns: requestColumns,
1840
+ dataSource: queryParams,
1841
+ pagination: false,
1842
+ bordered: true,
1843
+ size: "small"
1844
+ })
1845
+ } : null
1846
+ ].filter((t) => t !== null);
1847
+ const responseObj = selectedEndpoint?.responses?.[selectedStatusCode || 200];
1848
+ const responseHeaders = responseObj?.headers;
1849
+ const responseHeaderData = buildHeaderData(responseHeaders);
1850
+ const serverOptions = selectedApi?.servers?.map((server, index) => ({
1851
+ value: index,
1852
+ label: `${server.url}${selectedEndpoint?.path || ""}`
1853
+ })) || [];
1854
+ const getFullEndpointUrl = () => {
1855
+ if (!selectedApi?.servers || !selectedApi.servers[selectedServer]) return "";
1856
+ const server = selectedApi.servers[selectedServer];
1857
+ return `${server.url}${selectedEndpoint?.path || ""}`;
1858
+ };
1859
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ant_design_nextjs_registry.AntdRegistry, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1860
+ className: cx("container"),
1861
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1862
+ className: cx("content"),
1863
+ children: [
1864
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1865
+ className: cx("breadcrumb"),
1866
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
1867
+ color: "default",
1868
+ variant: "outlined",
1869
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ant_design_icons.LeftOutlined, {}),
1870
+ onClick: (e) => {
1871
+ e.preventDefault();
1872
+ setSelectedNodeKey(selectedApi?.id);
1873
+ setFocusedContent("API");
1874
+ }
1875
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Breadcrumb, { items: [
1876
+ {
1877
+ href: "",
1878
+ title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selectedApi?.title || "API Name" }),
1879
+ onClick: (e) => {
1880
+ e.preventDefault();
1881
+ setSelectedNodeKey(selectedApi?.id);
1882
+ setFocusedContent("API");
1883
+ }
1884
+ },
1885
+ { title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1886
+ style: {
1887
+ display: "flex",
1888
+ flexDirection: "row",
1889
+ alignItems: "center",
1890
+ color: "rgba(0,0,0,0.45)",
1891
+ gap: "0.25rem"
1892
+ },
1893
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selectedEndpoint?.tagName || "default" })
1894
+ }) },
1895
+ { title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selectedEndpoint?.summary || "Endpoint Name" }) }
1896
+ ] })]
1897
+ }),
1898
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Title$1, {
1899
+ level: 3,
1900
+ children: selectedEndpoint?.summary
1901
+ }),
1902
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Paragraph, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1903
+ style: {
1904
+ display: "flex",
1905
+ alignItems: "center",
1906
+ gap: 8
1907
+ },
1908
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Select, {
1909
+ value: selectedServer,
1910
+ style: { width: "100%" },
1911
+ onChange: (value) => setSelectedServer(value),
1912
+ prefix: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, {
1913
+ style: {
1914
+ backgroundColor: methodStyle?.bg,
1915
+ color: methodStyle?.color,
1916
+ border: "none"
1917
+ },
1918
+ children: selectedEndpoint?.method
1919
+ }),
1920
+ options: serverOptions
1921
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
1922
+ title: endpointTooltip,
1923
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
1924
+ color: "default",
1925
+ variant: "outlined",
1926
+ onClick: () => {
1927
+ const fullUrl = getFullEndpointUrl();
1928
+ if (fullUrl) {
1929
+ navigator.clipboard.writeText(fullUrl);
1930
+ setEndpointTooltip("Copied!");
1931
+ setTimeout(() => setEndpointTooltip("Copy endpoint"), 1500);
1932
+ }
1933
+ },
1934
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(copy_default, {})
1935
+ })
1936
+ })]
1937
+ }) }),
1938
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Paragraph, {
1939
+ style: {
1940
+ color: "rgba(0,0,0,0.45)",
1941
+ marginBottom: "1.5rem"
1942
+ },
1943
+ children: selectedEndpoint?.description
1944
+ }),
1945
+ requestTabs.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Card, {
1946
+ title: "Request",
1947
+ style: { marginBottom: "1.5rem" },
1948
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tabs, {
1949
+ defaultActiveKey: requestTabs[0].key,
1950
+ items: requestTabs
1951
+ })
1952
+ }),
1953
+ responseHeaderData.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Card, {
1954
+ title: "Response",
1955
+ extra: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Tag, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: {
1956
+ background: handleStatusColor(selectedStatusCode),
1957
+ borderRadius: "50%",
1958
+ display: "inline-block",
1959
+ width: "0.5rem",
1960
+ height: "0.5rem",
1961
+ marginRight: "0.5rem"
1962
+ } }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selectedStatusCode })] }),
1963
+ children: responseHeaderData.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
1964
+ columns: responseColumns,
1965
+ dataSource: responseHeaderData,
1966
+ pagination: false,
1967
+ bordered: true,
1968
+ size: "small"
1969
+ })
1970
+ })
1971
+ ]
1972
+ })
1973
+ }) });
1974
+ };
1975
+
1976
+ //#endregion
1977
+ //#region src/assets/NoData.svg
1978
+ var _path, _path2, _path3, _path4, _path5, _path6, _path7, _path8, _path9, _path0, _path1, _path10, _path11, _path12, _path13, _path14, _path15, _path16;
1979
+ function _extends() {
1980
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
1981
+ for (var e = 1; e < arguments.length; e++) {
1982
+ var t = arguments[e];
1983
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1984
+ }
1985
+ return n;
1986
+ }, _extends.apply(null, arguments);
1987
+ }
1988
+ var SvgNoData = function SvgNoData$1(props) {
1989
+ return /* @__PURE__ */ react.createElement("svg", _extends({
1990
+ xmlns: "http://www.w3.org/2000/svg",
1991
+ width: 298,
1992
+ height: 237,
1993
+ fill: "none"
1994
+ }, props), _path || (_path = /* @__PURE__ */ react.createElement("path", {
1995
+ fill: "#F1F5FD",
1996
+ d: "M174.518 86.353c-18.413.11-37.111-.748-54.601-5.608s-32.958-14.031-47.02-24.741c-9.206-6.972-17.578-12.514-29.53-11.678a54.46 54.46 0 0 0-31.882 12.447C-3.72 70.101-1.413 94.733 4.652 112.062c9.14 26.105 36.957 44.227 60.577 56.037 27.31 13.657 57.303 21.596 87.382 26.149 26.367 4.002 60.226 6.927 83.055-10.315 20.983-15.812 26.74-51.968 21.598-76.379a30.07 30.07 0 0 0-10.788-18.298c-14.743-10.776-36.715-3.585-53.282-3.21-6.042.131-12.392.285-18.676.307"
1997
+ })), _path2 || (_path2 = /* @__PURE__ */ react.createElement("path", {
1998
+ stroke: "#E0E9F9",
1999
+ strokeLinecap: "round",
2000
+ strokeLinejoin: "round",
2001
+ strokeWidth: .85,
2002
+ d: "M84.74 1v9.457M80.016 5.729h9.448M263.987 189.496v9.457M259.264 194.225h9.448"
2003
+ })), _path3 || (_path3 = /* @__PURE__ */ react.createElement("path", {
2004
+ fill: "#E0E9F9",
2005
+ d: "M13.353 148.656a2.154 2.154 0 1 0-.002-4.308 2.154 2.154 0 0 0 .001 4.308M196.687 10.764a2.154 2.154 0 1 0 0-4.31 2.154 2.154 0 0 0 0 4.31"
2006
+ })), _path4 || (_path4 = /* @__PURE__ */ react.createElement("path", {
2007
+ fill: "#F1F5FD",
2008
+ d: "M137.011 236.999c44.535 0 80.638-2.245 80.638-5.014s-36.103-5.014-80.638-5.014c-44.534 0-80.637 2.245-80.637 5.014s36.103 5.014 80.637 5.014"
2009
+ })), _path5 || (_path5 = /* @__PURE__ */ react.createElement("path", {
2010
+ fill: "#fff",
2011
+ stroke: "#769DE4",
2012
+ strokeLinecap: "round",
2013
+ strokeLinejoin: "round",
2014
+ d: "M74.896 26.688h117.111c2.914 0 5.708 1.158 7.769 3.22a11 11 0 0 1 3.217 7.776v139.453c0 2.917-1.157 5.714-3.217 7.776a10.98 10.98 0 0 1-7.769 3.22H59.889a10.98 10.98 0 0 1-7.768-3.22 11 11 0 0 1-3.218-7.776V52.968z"
2015
+ })), _path6 || (_path6 = /* @__PURE__ */ react.createElement("path", {
2016
+ fill: "#F1F5FD",
2017
+ d: "M202.465 94.645H81.707v94.831h120.758z"
2018
+ })), _path7 || (_path7 = /* @__PURE__ */ react.createElement("path", {
2019
+ fill: "#fff",
2020
+ stroke: "#769DE4",
2021
+ strokeLinecap: "round",
2022
+ strokeLinejoin: "round",
2023
+ d: "M48.903 52.968h21.291a4.73 4.73 0 0 0 4.702-4.728V26.687zM201.873 64.36H82.433c-4.648 0-8.415 3.77-8.415 8.422V98.36c0 4.651 3.767 8.423 8.415 8.423h119.44c4.648 0 8.415-3.772 8.415-8.423V72.782c0-4.651-3.767-8.423-8.415-8.423"
2024
+ })), _path8 || (_path8 = /* @__PURE__ */ react.createElement("path", {
2025
+ fill: "#F1F5FD",
2026
+ d: "M97.22 92.972a7.34 7.34 0 0 0 7.338-7.345 7.34 7.34 0 0 0-7.339-7.346 7.34 7.34 0 0 0-7.338 7.346 7.34 7.34 0 0 0 7.338 7.345M120.291 92.972a7.34 7.34 0 0 0 7.338-7.345c0-4.057-3.285-7.346-7.338-7.346a7.34 7.34 0 0 0-7.339 7.346 7.34 7.34 0 0 0 7.339 7.345M143.339 92.972a7.34 7.34 0 0 0 7.338-7.345c0-4.057-3.285-7.346-7.338-7.346A7.34 7.34 0 0 0 136 85.627a7.34 7.34 0 0 0 7.339 7.345"
2027
+ })), _path9 || (_path9 = /* @__PURE__ */ react.createElement("path", {
2028
+ fill: "#fff",
2029
+ stroke: "#769DE4",
2030
+ strokeLinecap: "round",
2031
+ strokeLinejoin: "round",
2032
+ d: "M201.873 111.379H82.433c-4.648 0-8.415 3.771-8.415 8.423v25.577c0 4.652 3.767 8.423 8.415 8.423h119.44c4.648 0 8.415-3.771 8.415-8.423v-25.577c0-4.652-3.767-8.423-8.415-8.423"
2033
+ })), _path0 || (_path0 = /* @__PURE__ */ react.createElement("path", {
2034
+ fill: "#F1F5FD",
2035
+ d: "M97.22 140.013a7.34 7.34 0 0 0 7.338-7.345c0-4.057-3.285-7.346-7.339-7.346-4.052 0-7.338 3.289-7.338 7.346a7.34 7.34 0 0 0 7.338 7.345M120.291 140.013c4.053 0 7.338-3.289 7.338-7.345 0-4.057-3.285-7.346-7.338-7.346a7.343 7.343 0 0 0-7.339 7.346 7.34 7.34 0 0 0 7.339 7.345M143.339 140.013c4.053 0 7.338-3.289 7.338-7.345 0-4.057-3.285-7.346-7.338-7.346a7.343 7.343 0 0 0-7.339 7.346 7.34 7.34 0 0 0 7.339 7.345"
2036
+ })), _path1 || (_path1 = /* @__PURE__ */ react.createElement("path", {
2037
+ fill: "#fff",
2038
+ stroke: "#769DE4",
2039
+ strokeLinecap: "round",
2040
+ strokeLinejoin: "round",
2041
+ d: "M201.873 158.422H82.433c-4.648 0-8.415 3.771-8.415 8.423v25.577c0 4.652 3.767 8.423 8.415 8.423h119.44c4.648 0 8.415-3.771 8.415-8.423v-25.577c0-4.652-3.767-8.423-8.415-8.423"
2042
+ })), _path10 || (_path10 = /* @__PURE__ */ react.createElement("path", {
2043
+ fill: "#F1F5FD",
2044
+ d: "M97.22 187.033c4.053 0 7.338-3.289 7.338-7.346a7.34 7.34 0 0 0-7.339-7.345 7.34 7.34 0 0 0-7.338 7.345c0 4.057 3.285 7.346 7.338 7.346M120.291 187.033c4.053 0 7.338-3.289 7.338-7.346a7.34 7.34 0 0 0-7.338-7.345 7.34 7.34 0 0 0-7.339 7.345 7.343 7.343 0 0 0 7.339 7.346M143.339 187.033c4.053 0 7.338-3.289 7.338-7.346a7.34 7.34 0 0 0-7.338-7.345 7.34 7.34 0 0 0-7.339 7.345 7.343 7.343 0 0 0 7.339 7.346"
2045
+ })), _path11 || (_path11 = /* @__PURE__ */ react.createElement("path", {
2046
+ fill: "#fff",
2047
+ stroke: "#769DE4",
2048
+ strokeLinecap: "round",
2049
+ strokeLinejoin: "round",
2050
+ d: "M212.924 118.483c25.156 0 45.548-20.411 45.548-45.59s-20.392-45.59-45.548-45.59c-25.155 0-45.548 20.411-45.548 45.59s20.393 45.59 45.548 45.59"
2051
+ })), _path12 || (_path12 = /* @__PURE__ */ react.createElement("path", {
2052
+ fill: "#fff",
2053
+ stroke: "#769DE4",
2054
+ strokeLinecap: "round",
2055
+ strokeLinejoin: "round",
2056
+ d: "M213.451 99.878c14.598 0 26.432-11.845 26.432-26.456 0-14.612-11.834-26.457-26.432-26.457s-26.432 11.845-26.432 26.457 11.834 26.456 26.432 26.456"
2057
+ })), _path13 || (_path13 = /* @__PURE__ */ react.createElement("path", {
2058
+ fill: "#fff",
2059
+ d: "M199.385 59.32c.552 1.15 28.132 28.181 28.132 28.181z"
2060
+ })), _path14 || (_path14 = /* @__PURE__ */ react.createElement("path", {
2061
+ stroke: "#769DE4",
2062
+ strokeLinecap: "round",
2063
+ strokeLinejoin: "round",
2064
+ d: "M199.385 59.32c.552 1.15 28.132 28.181 28.132 28.181"
2065
+ })), _path15 || (_path15 = /* @__PURE__ */ react.createElement("path", {
2066
+ fill: "#fff",
2067
+ d: "M227.517 59.32c-.574 1.15-28.132 28.181-28.132 28.181z"
2068
+ })), _path16 || (_path16 = /* @__PURE__ */ react.createElement("path", {
2069
+ stroke: "#769DE4",
2070
+ strokeLinecap: "round",
2071
+ strokeLinejoin: "round",
2072
+ d: "M227.517 59.32c-.574 1.15-28.132 28.181-28.132 28.181"
2073
+ })));
2074
+ };
2075
+ var NoData_default = SvgNoData;
1037
2076
 
1038
2077
  //#endregion
1039
2078
  //#region src/view/components/MainContent.tsx
1040
2079
  const MainContent = () => {
1041
- const { wrapSSR, cx } = useStyle("MainContent", (token$1, scope) => ({ [scope("container")]: {
1042
- backgroundColor: token$1.colorBgContainer,
1043
- height: "100%",
1044
- width: "100%",
1045
- maxHeight: "100%",
1046
- overflow: "auto",
1047
- borderRadius: token$1.borderRadius,
1048
- padding: token$1.paddingXL
1049
- } }));
1050
- return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: cx("container") }));
2080
+ const { focusedContent, transformedData } = store_default(({ view }) => view);
2081
+ const { wrapSSR, cx } = useStyle("MainContent", (token$1, scope) => ({
2082
+ [scope("container")]: {
2083
+ backgroundColor: token$1.colorBgContainer,
2084
+ height: "100%",
2085
+ width: "100%",
2086
+ maxHeight: "100%",
2087
+ overflow: "auto",
2088
+ borderRadius: token$1.borderRadius,
2089
+ padding: token$1.paddingXL
2090
+ },
2091
+ [scope("centered")]: {
2092
+ display: "flex",
2093
+ justifyContent: "center"
2094
+ },
2095
+ [scope("no-space")]: {
2096
+ margin: 0,
2097
+ padding: 0
2098
+ },
2099
+ [scope("title")]: {
2100
+ fontFamily: token$1.fontFamily,
2101
+ fontWeight: 600,
2102
+ fontSize: token$1.fontSizeHeading4,
2103
+ color: "rgba(0, 0, 0, 0.88)"
2104
+ },
2105
+ [scope("text")]: {
2106
+ color: "rgba(0, 0, 0, 0.88)",
2107
+ fontFamily: token$1.fontFamily
2108
+ }
2109
+ }));
2110
+ return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2111
+ className: cx("container", !transformedData?.length ? "centered" : ""),
2112
+ children: !transformedData?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
2113
+ justify: "center",
2114
+ align: "center",
2115
+ gap: "1.5rem",
2116
+ vertical: true,
2117
+ flex: 1,
2118
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoData_default, {
2119
+ width: "18.625rem",
2120
+ height: "14.75rem"
2121
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
2122
+ justify: "center",
2123
+ align: "center",
2124
+ gap: "0.5rem",
2125
+ vertical: true,
2126
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
2127
+ className: cx("no-space", "title"),
2128
+ level: 4,
2129
+ children: "No API Documentation Found"
2130
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text.default, {
2131
+ className: cx("no-space", "text"),
2132
+ children: "No API Documentation has been added yet. Contact admin for support"
2133
+ })]
2134
+ })]
2135
+ }) : focusedContent === "ENDPOINT" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointPage, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(APIPage, {})
2136
+ }));
1051
2137
  };
1052
2138
 
1053
2139
  //#endregion
@@ -1056,6 +2142,12 @@ const transformOpenApiToDocs = (api) => {
1056
2142
  const groupedPathsByTags = { default: [] };
1057
2143
  const validTags = new Set(api?.tags?.map(({ name }) => name) || []);
1058
2144
  const contextPath = Object.keys(api.paths)[0];
2145
+ const relatedVersions = "x-related-versions" in api ? Object.entries(api["x-related-versions"]).map(([apiId, version]) => ({
2146
+ apiId,
2147
+ version
2148
+ })) : [];
2149
+ const currentVersion = "x-current-version" in api ? api["x-current-version"] : "";
2150
+ const authType = "x-auth-type" in api ? api["x-auth-type"] : "";
1059
2151
  for (const [path, methods] of Object.entries(api.paths)) for (const [method, methodData] of Object.entries(methods)) {
1060
2152
  const entry = {
1061
2153
  ...methodData,
@@ -1081,20 +2173,193 @@ const transformOpenApiToDocs = (api) => {
1081
2173
  id: `api-${(0, nanoid.nanoid)(8)}`,
1082
2174
  contextPath,
1083
2175
  tags: groupedPathsByTags,
1084
- servers: api.servers
2176
+ servers: api.servers,
2177
+ relatedVersions,
2178
+ currentVersion,
2179
+ authType
1085
2180
  };
1086
2181
  };
1087
2182
 
2183
+ //#endregion
2184
+ //#region src/view/components/EndpointPage/Codebox/Codebox.tsx
2185
+ react_syntax_highlighter.Light.registerLanguage("json", react_syntax_highlighter_dist_esm_languages_hljs_json.default);
2186
+ const Codebox = ({ code }) => {
2187
+ const [theme, setTheme] = (0, react.useState)("DARK");
2188
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2189
+ className: "codebox",
2190
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2191
+ className: "codebox_header",
2192
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2193
+ role: "button",
2194
+ tabIndex: -1,
2195
+ onClick: () => theme !== "LIGHT" && setTheme("LIGHT"),
2196
+ className: "codebox_header_themeToggle codebox_header_themeToggle_light",
2197
+ title: "Light theme"
2198
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2199
+ role: "button",
2200
+ tabIndex: -1,
2201
+ onClick: () => theme !== "DARK" && setTheme("DARK"),
2202
+ className: "codebox_header_themeToggle codebox_header_themeToggle_dark",
2203
+ title: "Dark theme"
2204
+ })]
2205
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_syntax_highlighter.Light, {
2206
+ language: "json",
2207
+ style: theme === "LIGHT" ? react_syntax_highlighter_dist_esm_styles_hljs.stackoverflowLight : react_syntax_highlighter_dist_esm_styles_hljs.stackoverflowDark,
2208
+ showLineNumbers: true,
2209
+ wrapLines: true,
2210
+ customStyle: {
2211
+ margin: 0,
2212
+ minHeight: "3rem",
2213
+ overflowY: "auto",
2214
+ padding: "0.75rem 1rem 0.75rem 1.5rem",
2215
+ backgroundColor: theme === "DARK" ? "#20264B" : "#20264B",
2216
+ fontSize: "0.75rem"
2217
+ },
2218
+ lineProps: { className: "custom-code-line" },
2219
+ children: code
2220
+ })]
2221
+ });
2222
+ };
2223
+ var Codebox_default = Codebox;
2224
+
2225
+ //#endregion
2226
+ //#region src/view/components/CodeboxSidebar.tsx
2227
+ function CodeboxSidebar() {
2228
+ const { selectedEndpoint, selectedStatusCode, statusCodeOptions, setSelectedStatusCode } = store_default(({ view }) => view);
2229
+ const httpStatusOptions = (0, react.useMemo)(() => statusCodeOptions.map((code) => ({
2230
+ value: code,
2231
+ label: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: code })
2232
+ })), [statusCodeOptions]);
2233
+ const [requestTooltip, setRequestTooltip] = (0, react.useState)("Copy Request");
2234
+ const { cx } = useStyle("CodeboxSidebar", (token$1, scope) => ({
2235
+ [scope("container")]: {
2236
+ display: "flex",
2237
+ flexDirection: "column",
2238
+ gap: token$1.marginMD,
2239
+ background: token$1.colorBgContainer,
2240
+ borderRadius: token$1.borderRadiusLG,
2241
+ padding: token$1.paddingLG,
2242
+ overflow: "hidden",
2243
+ height: "100%",
2244
+ width: "23.625rem",
2245
+ minWidth: "23.625rem",
2246
+ ".ant-card-body": { padding: 0 },
2247
+ ".ant-card-head-title": { color: "white" },
2248
+ ".ant-card-head": { borderBottom: "2px solid #33419A" }
2249
+ },
2250
+ [scope("rightCard")]: {
2251
+ flex: "0 1 auto",
2252
+ maxHeight: "50%",
2253
+ overflowY: "auto",
2254
+ backgroundColor: "#20264B"
2255
+ },
2256
+ [scope("rightCardFlex")]: {
2257
+ overflowY: "auto",
2258
+ backgroundColor: "#20264B"
2259
+ },
2260
+ [scope("customSelect")]: {
2261
+ ".ant-select-selector": {
2262
+ backgroundColor: `${token["brnadColor.9"]} `,
2263
+ borderColor: `${token["brnadColor.9"]}`,
2264
+ borderRadius: "6px",
2265
+ color: "white"
2266
+ },
2267
+ ".ant-select-selection-item": { color: "white" },
2268
+ ".ant-select-selection-placeholder": { color: "rgba(255, 255, 255, 0.65)" },
2269
+ ".ant-select-arrow": { color: "white" },
2270
+ "&:hover .ant-select-selector": {
2271
+ borderColor: `${token["brnadColor.7"]}`,
2272
+ color: "white"
2273
+ },
2274
+ "&:focus .ant-select-selector, &.ant-select-focused .ant-select-selector": {
2275
+ borderColor: `${token["brnadColor.7"]}`,
2276
+ color: "white"
2277
+ }
2278
+ }
2279
+ }));
2280
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2281
+ className: cx("container"),
2282
+ children: [selectedEndpoint?.requestBody && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Card, {
2283
+ title: "Request",
2284
+ variant: "borderless",
2285
+ className: cx("rightCard"),
2286
+ extra: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
2287
+ title: requestTooltip,
2288
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
2289
+ color: "default",
2290
+ variant: "link",
2291
+ onClick: () => {
2292
+ if (selectedEndpoint?.requestBody) {
2293
+ navigator.clipboard.writeText(JSON.stringify(selectedEndpoint.requestBody, null, 2));
2294
+ setRequestTooltip("Copied!");
2295
+ setTimeout(() => setRequestTooltip("Copy Request"), 1500);
2296
+ }
2297
+ },
2298
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ant_design_icons.CopyOutlined, { style: { color: "white" } })
2299
+ })
2300
+ }),
2301
+ style: {
2302
+ padding: 0,
2303
+ border: "none"
2304
+ },
2305
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Codebox_default, { code: JSON.stringify(selectedEndpoint?.requestBody, null, 2) || "" })
2306
+ }), selectedEndpoint?.responses && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Card, {
2307
+ title: "Response",
2308
+ variant: "borderless",
2309
+ className: cx("rightCardFlex"),
2310
+ extra: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Select, {
2311
+ defaultActiveFirstOption: true,
2312
+ defaultValue: 200,
2313
+ className: cx("customSelect"),
2314
+ style: { width: "100%" },
2315
+ value: selectedStatusCode,
2316
+ onChange: setSelectedStatusCode,
2317
+ prefix: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: {
2318
+ background: handleStatusColor(selectedStatusCode),
2319
+ borderRadius: "50%",
2320
+ display: "inline-block",
2321
+ width: "0.5rem",
2322
+ height: "0.5rem",
2323
+ marginRight: "0.5rem"
2324
+ } }),
2325
+ options: httpStatusOptions
2326
+ }),
2327
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Codebox_default, { code: JSON.stringify(selectedEndpoint?.responses[selectedStatusCode], null, 2) || "" })
2328
+ })]
2329
+ });
2330
+ }
2331
+ var CodeboxSidebar_default = CodeboxSidebar;
2332
+
1088
2333
  //#endregion
1089
2334
  //#region src/view/layout.tsx
1090
2335
  const DocumentationLayout = ({ data }) => {
1091
- const { setOriginalData } = store_default(({ view }) => view);
1092
- const { setTransformedData } = store_default(({ view }) => view);
2336
+ const { focusedContent, selectedNodeKey, selectedApi, builtTreeData, setOriginalData, setTransformedData, setBuiltTreeData } = store_default(({ view }) => view);
2337
+ const { selectFirstApi } = useNodeSelection();
2338
+ const hasInitializedRef = (0, react.useRef)(false);
1093
2339
  (0, react.useEffect)(() => {
1094
2340
  setOriginalData(data);
1095
- const transformedData = data.map(transformOpenApiToDocs);
2341
+ const transformedData = data.map(transformOpenApiToDocs).sort((a, b) => a.title.localeCompare(b.title));
1096
2342
  setTransformedData(transformedData);
1097
- }, [data]);
2343
+ const builtTree = buildTreeDataStructure(transformedData);
2344
+ setBuiltTreeData(builtTree);
2345
+ hasInitializedRef.current = false;
2346
+ }, [
2347
+ data,
2348
+ setOriginalData,
2349
+ setTransformedData,
2350
+ setBuiltTreeData
2351
+ ]);
2352
+ (0, react.useEffect)(() => {
2353
+ if (builtTreeData && builtTreeData.length > 0 && !selectedNodeKey && !selectedApi && !hasInitializedRef.current) {
2354
+ selectFirstApi(builtTreeData);
2355
+ hasInitializedRef.current = true;
2356
+ }
2357
+ }, [
2358
+ builtTreeData,
2359
+ selectedNodeKey,
2360
+ selectedApi,
2361
+ selectFirstApi
2362
+ ]);
1098
2363
  const { cx } = useStyle("DocumentationLayout", (token$1, scope) => ({
1099
2364
  [scope("container")]: {
1100
2365
  display: "flex",
@@ -1109,14 +2374,19 @@ const DocumentationLayout = ({ data }) => {
1109
2374
  height: "100%",
1110
2375
  maxHeight: "100%",
1111
2376
  overflow: "hidden",
1112
- gap: token$1.marginLG
2377
+ gap: token$1.marginLG,
2378
+ width: "100%"
1113
2379
  }
1114
2380
  }));
1115
2381
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ant_design_nextjs_registry.AntdRegistry, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1116
2382
  className: cx("container"),
1117
2383
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Header, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1118
2384
  className: cx("layout"),
1119
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MainContent, {})]
2385
+ children: [
2386
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {}),
2387
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MainContent, {}),
2388
+ focusedContent === "ENDPOINT" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeboxSidebar_default, {})
2389
+ ]
1120
2390
  })]
1121
2391
  }) });
1122
2392
  };