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

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
@@ -768,98 +815,232 @@ const convertToRenderableTreeData = (treeDataStructure, selectedNode, cx) => {
768
815
  return treeDataStructure.map(renderNode);
769
816
  };
770
817
 
818
+ //#endregion
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
+ };
904
+ };
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
+ })));
928
+ };
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
+ })));
1029
+ };
1030
+ var NoDataSM_default = SvgNoDataSm;
1031
+
771
1032
  //#endregion
772
1033
  //#region src/view/components/Sidebar.tsx
773
1034
  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
- }
844
- };
845
1035
  const Sidebar = () => {
846
1036
  const expandedKeys = useStore((state) => state.view.expandedKeys);
847
- const setExpandedKeys = useStore((state) => state.view.setExpandedKeys);
848
- const setSelectedApi = useStore((state) => state.view.setSelectedApi);
849
- const setSelectedEndpoint = useStore((state) => state.view.setSelectedEndpoint);
850
- const [selectedNode, setSelectedNodeState] = (0, react.useState)();
851
- const transformedData = useStore((state) => state.view.transformedData);
852
- const builtTreeData = (0, react.useMemo)(() => {
853
- console.log("[Sidebar] transformedData:", transformedData);
854
- const tree = buildTreeDataStructure(transformedData);
855
- console.log("[Sidebar] builtTreeData:", tree);
856
- return tree;
857
- }, [transformedData]);
1037
+ const { selectedNodeKey, selectedEndpoint, builtTreeData, setExpandedKeys, setSelectedNodeKey, transformedData } = useStore(({ view }) => view);
1038
+ const { selectNodeByKey, clearSelection } = useNodeSelection();
858
1039
  const [searchValue, setSearchValue] = (0, react.useState)("");
859
1040
  const [autoExpandParent, setAutoExpandParent] = (0, react.useState)(true);
860
- const { wrapSSR, cx } = useStyle("Sidebar", getSidebarStyles);
1041
+ const { wrapSSR, cx, token: token$1 } = useStyle("Sidebar", getSidebarStyles);
861
1042
  const handleSearch = (value) => {
862
- if (value) {
1043
+ if (value && builtTreeData) {
863
1044
  const allKeys = getAllTreeKeys(builtTreeData);
864
1045
  setExpandedKeys(allKeys);
865
1046
  setSearchValue(value);
@@ -870,77 +1051,39 @@ const Sidebar = () => {
870
1051
  }
871
1052
  };
872
1053
  const renderTreeData = (0, react.useMemo)(() => {
873
- const data = convertToRenderableTreeData(builtTreeData, selectedNode, cx);
874
- console.log("[Sidebar] renderTreeData:", data);
875
- return data;
1054
+ if (!builtTreeData) return [];
1055
+ return convertToRenderableTreeData(builtTreeData, selectedEndpoint, cx);
876
1056
  }, [
877
1057
  builtTreeData,
878
- selectedNode,
1058
+ selectedEndpoint,
879
1059
  cx
880
1060
  ]);
881
1061
  const filteredTreeData = (0, react.useMemo)(() => {
882
1062
  if (!searchValue) return renderTreeData;
1063
+ if (!builtTreeData) return [];
883
1064
  const filteredOriginal = filterTreeData(builtTreeData, searchValue);
884
- const data = convertToRenderableTreeData(filteredOriginal, selectedNode, cx);
885
- console.log("[Sidebar] filteredTreeData:", data);
886
- return data;
1065
+ return convertToRenderableTreeData(filteredOriginal, selectedEndpoint, cx);
887
1066
  }, [
888
1067
  builtTreeData,
889
1068
  searchValue,
890
- selectedNode,
1069
+ selectedEndpoint,
891
1070
  cx
892
1071
  ]);
893
1072
  const collapseAll = () => {
894
1073
  setExpandedKeys([]);
895
1074
  };
896
- const handleNodeSelection = (nodeData, nodeKey) => {
897
- if (!nodeData) return null;
898
- if (nodeKey.startsWith("endpoint-")) {
899
- const endpointNodeData = nodeData;
900
- setSelectedEndpoint(endpointNodeData.endpoint);
901
- setSelectedApi(endpointNodeData.api);
902
- return {
903
- type: "endpoint",
904
- endpoint: endpointNodeData.endpoint,
905
- api: endpointNodeData.api,
906
- tag: endpointNodeData.tagName
907
- };
908
- } else if (nodeKey.startsWith("api-") || nodeKey === "custom-auth") {
909
- const apiData = nodeData;
910
- setSelectedApi(apiData);
911
- setSelectedEndpoint(null);
912
- return {
913
- type: "api",
914
- api: apiData
915
- };
916
- } else {
917
- const tagData = nodeData;
918
- return {
919
- type: "tag",
920
- tag: tagData.tagName,
921
- api: tagData.apiData
922
- };
923
- }
924
- };
925
1075
  const onTreeNodeSelect = (selectedKeys) => {
926
1076
  const stringKeys = selectedKeys.map((key) => String(key));
927
- console.log("[Sidebar] onTreeNodeSelect - selectedKeys:", selectedKeys, "stringKeys:", stringKeys);
928
1077
  if (stringKeys.length === 0) {
929
- setSelectedNodeState([]);
930
- setSelectedApi(null);
931
- setSelectedEndpoint(null);
1078
+ clearSelection();
932
1079
  return;
933
1080
  }
1081
+ if (!builtTreeData) return;
934
1082
  const selectedKey = stringKeys[0];
935
- const selectedNode$1 = findNodeByKey(builtTreeData, selectedKey);
936
- console.log("[Sidebar] findNodeByKey result:", selectedNode$1);
937
- if (selectedNode$1) {
938
- const result = handleNodeSelection(selectedNode$1.data, selectedKey);
939
- console.log("[Sidebar] handleNodeSelection result:", result);
940
- }
941
- setSelectedNodeState(stringKeys);
1083
+ selectNodeByKey(selectedKey);
1084
+ setSelectedNodeKey(selectedKey);
942
1085
  };
943
- 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, {
944
1087
  width: 280,
945
1088
  className: cx("sider"),
946
1089
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -958,37 +1101,1038 @@ const Sidebar = () => {
958
1101
  title: "Collapse All",
959
1102
  icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Minify_default, {})
960
1103
  })]
961
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tree, {
1104
+ }), transformedData?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tree, {
962
1105
  showLine: { showLeafIcon: false },
963
1106
  showIcon: false,
964
1107
  expandedKeys,
965
1108
  autoExpandParent,
966
- selectedKeys: selectedNode,
967
- onSelect: onTreeNodeSelect,
1109
+ selectedKeys: [selectedNodeKey || ""],
1110
+ onSelect: (selectedKeys) => {
1111
+ if (!selectedKeys?.length) return;
1112
+ onTreeNodeSelect(selectedKeys);
1113
+ setSelectedNodeKey(selectedKeys[0]);
1114
+ },
968
1115
  onExpand: (expandedKeysValue) => {
969
1116
  setExpandedKeys(expandedKeysValue);
970
1117
  setAutoExpandParent(false);
971
1118
  },
972
1119
  treeData: filteredTreeData,
973
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
+ })]
974
1145
  })]
975
1146
  })
976
- }) }));
1147
+ }));
1148
+ };
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
+ })));
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("ApiCard", (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
+ className: cx("list-see-details"),
1427
+ onClick: handleOpenEndPointView,
1428
+ children: "See Details"
1429
+ })]
1430
+ }),
1431
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1432
+ className: cx("list-content"),
1433
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(link_default, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text.default, {
1434
+ className: cx("path-name"),
1435
+ children: api?.path
1436
+ })]
1437
+ }),
1438
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Divider, { style: {
1439
+ marginTop: "0.75rem",
1440
+ marginBottom: "0.25rem"
1441
+ } })
1442
+ ]
1443
+ }));
1444
+ return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Card, {
1445
+ className: cx("grid-card"),
1446
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
1447
+ vertical: true,
1448
+ gap: token$1.marginSM,
1449
+ children: [
1450
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MethodChip, { method: api?.method }),
1451
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
1452
+ className: cx("grid-title"),
1453
+ level: 4,
1454
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltippedText, { text: api?.summary || "Endpoint Name" })
1455
+ }),
1456
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1457
+ className: cx("grid-content"),
1458
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(link_default, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text.default, {
1459
+ className: cx("grid-path-name"),
1460
+ children: api?.path
1461
+ })]
1462
+ }),
1463
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
1464
+ className: cx("grid-see-details"),
1465
+ onClick: handleOpenEndPointView,
1466
+ children: "See Details"
1467
+ })
1468
+ ]
1469
+ })
1470
+ }));
1471
+ };
1472
+ var ApiCard_default = ApiCard;
1473
+
1474
+ //#endregion
1475
+ //#region src/utils/index.ts
1476
+ const handleStatusColor = (code) => {
1477
+ if (code >= 200 && code < 300) return "green";
1478
+ else if (code >= 400 && code < 500) return "red";
1479
+ else if (code >= 500 && code < 600) return "red";
1480
+ else if (code >= 100 && code < 200) return "blue";
1481
+ else if (code >= 300 && code < 400) return "orange";
1482
+ else return "gray";
1483
+ };
1484
+ const copyToClipboard = async (text) => {
1485
+ try {
1486
+ await navigator.clipboard.writeText(text);
1487
+ return;
1488
+ } catch (err) {
1489
+ return err;
1490
+ }
1491
+ };
1492
+
1493
+ //#endregion
1494
+ //#region src/view/components/ApiPage/index.tsx
1495
+ const APIPage = () => {
1496
+ const [selectedUrl, setSelectedUrl] = (0, react.useState)("");
1497
+ const [copying, setCopying] = (0, react.useState)(false);
1498
+ const { view: { selectedApi, transformedData, setSelectedApi, setFocusedContent, setSelectedNodeKey } } = store_default();
1499
+ const [viewStyle, setViewStyle] = (0, react.useState)("grid");
1500
+ const { wrapSSR, cx, token: token$1 } = useStyle("APIPage", () => ({}));
1501
+ const currentVersion = selectedApi?.relatedVersions?.find((v) => v.apiId === selectedApi?.currentVersion);
1502
+ const handleVersionChanged = (value) => {
1503
+ console.log("new value ", value);
1504
+ const apiByVersion = transformedData?.find((item) => item.currentVersion === value);
1505
+ if (apiByVersion) {
1506
+ setSelectedApi(apiByVersion);
1507
+ setFocusedContent("API");
1508
+ setSelectedNodeKey(apiByVersion.id);
1509
+ }
1510
+ };
1511
+ (0, react.useEffect)(() => {
1512
+ if (selectedApi?.servers && !selectedUrl) setSelectedUrl(selectedApi?.servers?.[0].url);
1513
+ }, [selectedApi?.servers]);
1514
+ const handleCopyUrl = async () => {
1515
+ setCopying(true);
1516
+ await copyToClipboard(selectedUrl);
1517
+ setTimeout(() => {
1518
+ setCopying(false);
1519
+ }, 700);
1520
+ };
1521
+ const APIsRenderer = ({ apis, withTitle, tagName, haveUnderLine }) => {
1522
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
1523
+ gap: viewStyle == "grid" ? token$1.marginXS : 0,
1524
+ style: {
1525
+ marginBottom: 0,
1526
+ paddingBottom: 0
1527
+ },
1528
+ vertical: true,
1529
+ children: [
1530
+ withTitle && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
1531
+ style: { marginBottom: 0 },
1532
+ level: 4,
1533
+ children: tagName
1534
+ }),
1535
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Flex, {
1536
+ wrap: "wrap",
1537
+ gap: viewStyle == "grid" ? "1.5rem" : 0,
1538
+ vertical: viewStyle == "list",
1539
+ children: apis.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ApiCard_default, {
1540
+ api: item,
1541
+ viewStyle
1542
+ }))
1543
+ }),
1544
+ haveUnderLine && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Divider, { style: {
1545
+ marginTop: token$1.marginSM,
1546
+ marginBottom: token$1.marginSM
1547
+ } })
1548
+ ]
1549
+ });
1550
+ };
1551
+ return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
1552
+ vertical: true,
1553
+ gap: token$1.margin,
1554
+ children: [
1555
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
1556
+ className: cx("container"),
1557
+ level: 4,
1558
+ children: selectedApi?.title
1559
+ }),
1560
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, { children: [
1561
+ selectedApi?.authType && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
1562
+ title: "Authenticator Type",
1563
+ placement: "bottomLeft",
1564
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, {
1565
+ style: {
1566
+ minWidth: "3.9375rem",
1567
+ width: "max-content",
1568
+ height: "2rem",
1569
+ background: "#fff",
1570
+ borderRadius: token$1.borderRadiusSM,
1571
+ paddingTop: "0.0625rem",
1572
+ paddingBottom: "0.0625rem",
1573
+ paddingRight: token$1.paddingContentHorizontalSM,
1574
+ paddingLeft: token$1.paddingContentHorizontalSM,
1575
+ display: "flex",
1576
+ justifyContent: "center",
1577
+ alignItems: "center"
1578
+ },
1579
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ant_design_icons.LockOutlined, {}),
1580
+ children: selectedApi?.authType?.replace(/_/g, " ")
1581
+ })
1582
+ }),
1583
+ selectedApi?.authType && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Divider, {
1584
+ style: { height: "2rem" },
1585
+ type: "vertical"
1586
+ }),
1587
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Select, {
1588
+ size: "middle",
1589
+ prefix: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
1590
+ title: "API Version",
1591
+ placement: "bottom",
1592
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ant_design_icons.InfoCircleOutlined, {})
1593
+ }),
1594
+ value: currentVersion?.apiId,
1595
+ onChange: handleVersionChanged,
1596
+ style: {
1597
+ minWidth: "6.1875rem",
1598
+ width: "max-content",
1599
+ display: "flex",
1600
+ justifyContent: "center",
1601
+ alignContent: "center",
1602
+ alignItems: "center",
1603
+ paddingLeft: "0.5rem",
1604
+ paddingRight: "0.5rem"
1605
+ },
1606
+ placeholder: "Version",
1607
+ options: selectedApi?.relatedVersions?.map((item) => ({
1608
+ label: item.version,
1609
+ value: item.apiId
1610
+ })),
1611
+ showSearch: false
1612
+ }),
1613
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Divider, {
1614
+ style: { height: "2rem" },
1615
+ type: "vertical"
1616
+ }),
1617
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Select, {
1618
+ size: "middle",
1619
+ prefix: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
1620
+ title: "URL",
1621
+ placement: "bottom",
1622
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ant_design_icons.InfoCircleOutlined, {})
1623
+ }),
1624
+ value: selectedApi?.servers?.[0]?.url,
1625
+ onChange: setSelectedUrl,
1626
+ style: {
1627
+ width: "24.75rem",
1628
+ display: "flex",
1629
+ justifyContent: "center",
1630
+ alignContent: "center",
1631
+ alignItems: "center",
1632
+ paddingLeft: "0.5rem"
1633
+ },
1634
+ placeholder: "API URLs",
1635
+ options: selectedApi?.servers?.map((server) => ({
1636
+ label: server?.url,
1637
+ value: server?.url
1638
+ })),
1639
+ showSearch: false
1640
+ }),
1641
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
1642
+ color: copying ? "green" : "default",
1643
+ variant: copying ? "filled" : "outlined",
1644
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(copy_default, {}),
1645
+ iconPosition: "end",
1646
+ style: { marginLeft: "0.69rem" },
1647
+ onClick: handleCopyUrl,
1648
+ children: !copying ? "Copy" : "Copied"
1649
+ }),
1650
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Radio.Group, {
1651
+ style: {
1652
+ marginLeft: "auto",
1653
+ display: "flex"
1654
+ },
1655
+ optionType: "button",
1656
+ buttonStyle: "outline",
1657
+ defaultValue: viewStyle,
1658
+ onChange: (e) => {
1659
+ setViewStyle(e.target.value);
1660
+ },
1661
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Radio.Button, {
1662
+ value: "grid",
1663
+ style: {
1664
+ display: "flex",
1665
+ alignItems: "center"
1666
+ },
1667
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(grid_default, {})
1668
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Radio.Button, {
1669
+ value: "list",
1670
+ style: {
1671
+ display: "flex",
1672
+ alignItems: "center"
1673
+ },
1674
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(list_default, {})
1675
+ })]
1676
+ })
1677
+ ] }),
1678
+ selectedApi?.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text.default, {
1679
+ style: {
1680
+ fontFamily: token$1.fontFamily,
1681
+ fontWeight: 400,
1682
+ fontSize: token$1.fontSizeLG,
1683
+ color: `rgba(0,0,0, 0.45)`
1684
+ },
1685
+ children: selectedApi?.description
1686
+ }),
1687
+ Object.keys(selectedApi?.tags || {}).sort((a, b) => {
1688
+ if (a.toLowerCase() === "default") return 1;
1689
+ if (b.toLowerCase() === "default") return -1;
1690
+ return 0;
1691
+ }).map((key, index) => {
1692
+ if (key.toLowerCase() == "default" && Object.keys(selectedApi?.tags).length <= 1) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(APIsRenderer, {
1693
+ apis: selectedApi?.tags[key],
1694
+ tagName: key,
1695
+ withTitle: false
1696
+ });
1697
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(APIsRenderer, {
1698
+ apis: selectedApi?.tags[key],
1699
+ tagName: key,
1700
+ withTitle: true,
1701
+ haveUnderLine: index < Object.keys(selectedApi?.tags || {}).length - 1
1702
+ });
1703
+ })
1704
+ ]
1705
+ }));
1706
+ };
1707
+
1708
+ //#endregion
1709
+ //#region src/view/components/EndpointPage/EndpointPage.tsx
1710
+ const { Title: Title$1, Paragraph } = antd.Typography;
1711
+ const requestColumns = [
1712
+ {
1713
+ title: "Parameter",
1714
+ dataIndex: "param",
1715
+ key: "param"
1716
+ },
1717
+ {
1718
+ title: "Description",
1719
+ dataIndex: "desc",
1720
+ key: "desc"
1721
+ },
1722
+ {
1723
+ title: "Enum",
1724
+ dataIndex: "enum",
1725
+ key: "enum"
1726
+ }
1727
+ ];
1728
+ const responseColumns = [...requestColumns];
1729
+ const buildRequestData = (params) => params.map((p, index) => ({
1730
+ key: index,
1731
+ param: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
1732
+ p.name,
1733
+ p.schema?.type && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1734
+ style: {
1735
+ color: "rgba(0,0,0,0.45)",
1736
+ marginLeft: "0.25rem",
1737
+ marginRight: "0.25rem"
1738
+ },
1739
+ children: p.schema.type
1740
+ }),
1741
+ p.required ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1742
+ style: { color: "red" },
1743
+ children: "*"
1744
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1745
+ style: { color: "#52C41A" },
1746
+ children: "Optional"
1747
+ })
1748
+ ] }),
1749
+ desc: p.description || "-",
1750
+ enum: p.schema?.enum ? p.schema.enum.map((e) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, { children: e }, e)) : "--"
1751
+ }));
1752
+ const buildHeaderData = (headers) => {
1753
+ if (!headers) return [];
1754
+ return Object.entries(headers).map(([name, header], idx) => ({
1755
+ key: idx,
1756
+ param: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
1757
+ name,
1758
+ header.schema?.type && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1759
+ style: {
1760
+ color: "rgba(0,0,0,0.45)",
1761
+ marginLeft: "0.25rem",
1762
+ marginRight: "0.25rem"
1763
+ },
1764
+ children: header.schema.type
1765
+ }),
1766
+ header.required ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1767
+ style: { color: "red" },
1768
+ children: "*"
1769
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1770
+ style: { color: "#52C41A" },
1771
+ children: "Optional"
1772
+ })
1773
+ ] }),
1774
+ desc: header.description || "-",
1775
+ enum: header.schema?.enum ? header.schema.enum.map((e) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, { children: e }, e)) : "--"
1776
+ }));
1777
+ };
1778
+ const EndpointPage = () => {
1779
+ const { selectedEndpoint, selectedApi, selectedStatusCode, setSelectedNodeKey, setFocusedContent } = store_default(({ view }) => view);
1780
+ const [endpointTooltip, setEndpointTooltip] = (0, react.useState)("Copy endpoint");
1781
+ const [selectedServer, setSelectedServer] = (0, react.useState)(0);
1782
+ const { cx } = useStyle("EndpointPage", (token$1, scope) => ({
1783
+ [scope("container")]: {
1784
+ display: "flex",
1785
+ flexDirection: "column",
1786
+ gap: token$1.marginLG,
1787
+ height: "100%"
1788
+ },
1789
+ [scope("content")]: {
1790
+ width: "100%",
1791
+ height: "100%"
1792
+ },
1793
+ [scope("code")]: {
1794
+ background: "unset",
1795
+ borderRadius: token$1.borderRadius,
1796
+ padding: token$1.paddingSM,
1797
+ fontFamily: "monospace",
1798
+ whiteSpace: "pre-wrap"
1799
+ },
1800
+ [scope("breadcrumb")]: {
1801
+ display: "flex",
1802
+ gap: token$1.marginLG,
1803
+ alignItems: "center",
1804
+ marginBottom: token$1.marginLG
1805
+ }
1806
+ }));
1807
+ const methodStyle = methodColors[selectedEndpoint?.method];
1808
+ const headerParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || []);
1809
+ const pathParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || []);
1810
+ const queryParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || []);
1811
+ const requestTabs = [
1812
+ headerParams.length > 0 ? {
1813
+ key: "header",
1814
+ label: "Header",
1815
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
1816
+ columns: requestColumns,
1817
+ dataSource: headerParams,
1818
+ pagination: false,
1819
+ bordered: true,
1820
+ size: "small"
1821
+ })
1822
+ } : null,
1823
+ pathParams.length > 0 ? {
1824
+ key: "path",
1825
+ label: "Path",
1826
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
1827
+ columns: requestColumns,
1828
+ dataSource: pathParams,
1829
+ pagination: false,
1830
+ bordered: true,
1831
+ size: "small"
1832
+ })
1833
+ } : null,
1834
+ queryParams.length > 0 ? {
1835
+ key: "query",
1836
+ label: "Query",
1837
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
1838
+ columns: requestColumns,
1839
+ dataSource: queryParams,
1840
+ pagination: false,
1841
+ bordered: true,
1842
+ size: "small"
1843
+ })
1844
+ } : null
1845
+ ].filter((t) => t !== null);
1846
+ const responseObj = selectedEndpoint?.responses?.[selectedStatusCode || 200];
1847
+ const responseHeaders = responseObj?.headers;
1848
+ const responseHeaderData = buildHeaderData(responseHeaders);
1849
+ const serverOptions = selectedApi?.servers?.map((server, index) => ({
1850
+ value: index,
1851
+ label: `${server.url}${selectedEndpoint?.path || ""}`
1852
+ })) || [];
1853
+ const getFullEndpointUrl = () => {
1854
+ if (!selectedApi?.servers || !selectedApi.servers[selectedServer]) return "";
1855
+ const server = selectedApi.servers[selectedServer];
1856
+ return `${server.url}${selectedEndpoint?.path || ""}`;
1857
+ };
1858
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ant_design_nextjs_registry.AntdRegistry, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1859
+ className: cx("container"),
1860
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1861
+ className: cx("content"),
1862
+ children: [
1863
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1864
+ className: cx("breadcrumb"),
1865
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
1866
+ color: "default",
1867
+ variant: "outlined",
1868
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ant_design_icons.LeftOutlined, {}),
1869
+ onClick: (e) => {
1870
+ e.preventDefault();
1871
+ setSelectedNodeKey(selectedApi?.id);
1872
+ setFocusedContent("API");
1873
+ }
1874
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Breadcrumb, { items: [
1875
+ {
1876
+ href: "",
1877
+ title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selectedApi?.title || "API Name" }),
1878
+ onClick: (e) => {
1879
+ e.preventDefault();
1880
+ setSelectedNodeKey(selectedApi?.id);
1881
+ setFocusedContent("API");
1882
+ }
1883
+ },
1884
+ { title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1885
+ style: {
1886
+ display: "flex",
1887
+ flexDirection: "row",
1888
+ alignItems: "center",
1889
+ color: "rgba(0,0,0,0.45)",
1890
+ gap: "0.25rem"
1891
+ },
1892
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selectedEndpoint?.tagName || "default" })
1893
+ }) },
1894
+ { title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selectedEndpoint?.summary || "Endpoint Name" }) }
1895
+ ] })]
1896
+ }),
1897
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Title$1, {
1898
+ level: 3,
1899
+ children: selectedEndpoint?.summary
1900
+ }),
1901
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Paragraph, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1902
+ style: {
1903
+ display: "flex",
1904
+ alignItems: "center",
1905
+ gap: 8
1906
+ },
1907
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Select, {
1908
+ value: selectedServer,
1909
+ style: { width: "100%" },
1910
+ onChange: (value) => setSelectedServer(value),
1911
+ prefix: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tag, {
1912
+ style: {
1913
+ backgroundColor: methodStyle?.bg,
1914
+ color: methodStyle?.color,
1915
+ border: "none"
1916
+ },
1917
+ children: selectedEndpoint?.method
1918
+ }),
1919
+ options: serverOptions
1920
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
1921
+ title: endpointTooltip,
1922
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
1923
+ color: "default",
1924
+ variant: "outlined",
1925
+ onClick: () => {
1926
+ const fullUrl = getFullEndpointUrl();
1927
+ if (fullUrl) {
1928
+ navigator.clipboard.writeText(fullUrl);
1929
+ setEndpointTooltip("Copied!");
1930
+ setTimeout(() => setEndpointTooltip("Copy endpoint"), 1500);
1931
+ }
1932
+ },
1933
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(copy_default, {})
1934
+ })
1935
+ })]
1936
+ }) }),
1937
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Paragraph, {
1938
+ style: {
1939
+ color: "rgba(0,0,0,0.45)",
1940
+ marginBottom: "1.5rem"
1941
+ },
1942
+ children: selectedEndpoint?.description
1943
+ }),
1944
+ requestTabs.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Card, {
1945
+ title: "Request",
1946
+ style: { marginBottom: "1.5rem" },
1947
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tabs, {
1948
+ defaultActiveKey: requestTabs[0].key,
1949
+ items: requestTabs
1950
+ })
1951
+ }),
1952
+ responseHeaderData.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Card, {
1953
+ title: "Response",
1954
+ extra: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Tag, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: {
1955
+ background: handleStatusColor(selectedStatusCode),
1956
+ borderRadius: "50%",
1957
+ display: "inline-block",
1958
+ width: "0.5rem",
1959
+ height: "0.5rem",
1960
+ marginRight: "0.5rem"
1961
+ } }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selectedStatusCode })] }),
1962
+ children: responseHeaderData.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Table, {
1963
+ columns: responseColumns,
1964
+ dataSource: responseHeaderData,
1965
+ pagination: false,
1966
+ bordered: true,
1967
+ size: "small"
1968
+ })
1969
+ })
1970
+ ]
1971
+ })
1972
+ }) });
977
1973
  };
978
1974
 
1975
+ //#endregion
1976
+ //#region src/assets/NoData.svg
1977
+ var _path, _path2, _path3, _path4, _path5, _path6, _path7, _path8, _path9, _path0, _path1, _path10, _path11, _path12, _path13, _path14, _path15, _path16;
1978
+ function _extends() {
1979
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
1980
+ for (var e = 1; e < arguments.length; e++) {
1981
+ var t = arguments[e];
1982
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1983
+ }
1984
+ return n;
1985
+ }, _extends.apply(null, arguments);
1986
+ }
1987
+ var SvgNoData = function SvgNoData$1(props) {
1988
+ return /* @__PURE__ */ react.createElement("svg", _extends({
1989
+ xmlns: "http://www.w3.org/2000/svg",
1990
+ width: 298,
1991
+ height: 237,
1992
+ fill: "none"
1993
+ }, props), _path || (_path = /* @__PURE__ */ react.createElement("path", {
1994
+ fill: "#F1F5FD",
1995
+ 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"
1996
+ })), _path2 || (_path2 = /* @__PURE__ */ react.createElement("path", {
1997
+ stroke: "#E0E9F9",
1998
+ strokeLinecap: "round",
1999
+ strokeLinejoin: "round",
2000
+ strokeWidth: .85,
2001
+ d: "M84.74 1v9.457M80.016 5.729h9.448M263.987 189.496v9.457M259.264 194.225h9.448"
2002
+ })), _path3 || (_path3 = /* @__PURE__ */ react.createElement("path", {
2003
+ fill: "#E0E9F9",
2004
+ 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"
2005
+ })), _path4 || (_path4 = /* @__PURE__ */ react.createElement("path", {
2006
+ fill: "#F1F5FD",
2007
+ 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"
2008
+ })), _path5 || (_path5 = /* @__PURE__ */ react.createElement("path", {
2009
+ fill: "#fff",
2010
+ stroke: "#769DE4",
2011
+ strokeLinecap: "round",
2012
+ strokeLinejoin: "round",
2013
+ 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"
2014
+ })), _path6 || (_path6 = /* @__PURE__ */ react.createElement("path", {
2015
+ fill: "#F1F5FD",
2016
+ d: "M202.465 94.645H81.707v94.831h120.758z"
2017
+ })), _path7 || (_path7 = /* @__PURE__ */ react.createElement("path", {
2018
+ fill: "#fff",
2019
+ stroke: "#769DE4",
2020
+ strokeLinecap: "round",
2021
+ strokeLinejoin: "round",
2022
+ 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"
2023
+ })), _path8 || (_path8 = /* @__PURE__ */ react.createElement("path", {
2024
+ fill: "#F1F5FD",
2025
+ 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"
2026
+ })), _path9 || (_path9 = /* @__PURE__ */ react.createElement("path", {
2027
+ fill: "#fff",
2028
+ stroke: "#769DE4",
2029
+ strokeLinecap: "round",
2030
+ strokeLinejoin: "round",
2031
+ 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"
2032
+ })), _path0 || (_path0 = /* @__PURE__ */ react.createElement("path", {
2033
+ fill: "#F1F5FD",
2034
+ 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"
2035
+ })), _path1 || (_path1 = /* @__PURE__ */ react.createElement("path", {
2036
+ fill: "#fff",
2037
+ stroke: "#769DE4",
2038
+ strokeLinecap: "round",
2039
+ strokeLinejoin: "round",
2040
+ 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"
2041
+ })), _path10 || (_path10 = /* @__PURE__ */ react.createElement("path", {
2042
+ fill: "#F1F5FD",
2043
+ 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"
2044
+ })), _path11 || (_path11 = /* @__PURE__ */ react.createElement("path", {
2045
+ fill: "#fff",
2046
+ stroke: "#769DE4",
2047
+ strokeLinecap: "round",
2048
+ strokeLinejoin: "round",
2049
+ 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"
2050
+ })), _path12 || (_path12 = /* @__PURE__ */ react.createElement("path", {
2051
+ fill: "#fff",
2052
+ stroke: "#769DE4",
2053
+ strokeLinecap: "round",
2054
+ strokeLinejoin: "round",
2055
+ 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"
2056
+ })), _path13 || (_path13 = /* @__PURE__ */ react.createElement("path", {
2057
+ fill: "#fff",
2058
+ d: "M199.385 59.32c.552 1.15 28.132 28.181 28.132 28.181z"
2059
+ })), _path14 || (_path14 = /* @__PURE__ */ react.createElement("path", {
2060
+ stroke: "#769DE4",
2061
+ strokeLinecap: "round",
2062
+ strokeLinejoin: "round",
2063
+ d: "M199.385 59.32c.552 1.15 28.132 28.181 28.132 28.181"
2064
+ })), _path15 || (_path15 = /* @__PURE__ */ react.createElement("path", {
2065
+ fill: "#fff",
2066
+ d: "M227.517 59.32c-.574 1.15-28.132 28.181-28.132 28.181z"
2067
+ })), _path16 || (_path16 = /* @__PURE__ */ react.createElement("path", {
2068
+ stroke: "#769DE4",
2069
+ strokeLinecap: "round",
2070
+ strokeLinejoin: "round",
2071
+ d: "M227.517 59.32c-.574 1.15-28.132 28.181-28.132 28.181"
2072
+ })));
2073
+ };
2074
+ var NoData_default = SvgNoData;
2075
+
979
2076
  //#endregion
980
2077
  //#region src/view/components/MainContent.tsx
981
2078
  const MainContent = () => {
982
- const { wrapSSR, cx } = useStyle("MainContent", (token$1, scope) => ({ [scope("container")]: {
983
- backgroundColor: token$1.colorBgContainer,
984
- height: "100%",
985
- width: "100%",
986
- maxHeight: "100%",
987
- overflow: "auto",
988
- borderRadius: token$1.borderRadius,
989
- padding: token$1.paddingXL
990
- } }));
991
- return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: cx("container") }));
2079
+ const { focusedContent, transformedData } = store_default(({ view }) => view);
2080
+ const { wrapSSR, cx } = useStyle("MainContent", (token$1, scope) => ({
2081
+ [scope("container")]: {
2082
+ backgroundColor: token$1.colorBgContainer,
2083
+ height: "100%",
2084
+ width: "100%",
2085
+ maxHeight: "100%",
2086
+ overflow: "auto",
2087
+ borderRadius: token$1.borderRadius,
2088
+ padding: token$1.paddingXL
2089
+ },
2090
+ [scope("centered")]: {
2091
+ display: "flex",
2092
+ justifyContent: "center"
2093
+ },
2094
+ [scope("no-space")]: {
2095
+ margin: 0,
2096
+ padding: 0
2097
+ },
2098
+ [scope("title")]: {
2099
+ fontFamily: token$1.fontFamily,
2100
+ fontWeight: 600,
2101
+ fontSize: token$1.fontSizeHeading4,
2102
+ color: "rgba(0, 0, 0, 0.88)"
2103
+ },
2104
+ [scope("text")]: {
2105
+ color: "rgba(0, 0, 0, 0.88)",
2106
+ fontFamily: token$1.fontFamily
2107
+ }
2108
+ }));
2109
+ return wrapSSR(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2110
+ className: cx("container", !transformedData?.length ? "centered" : ""),
2111
+ children: !transformedData?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
2112
+ justify: "center",
2113
+ align: "center",
2114
+ gap: "1.5rem",
2115
+ vertical: true,
2116
+ flex: 1,
2117
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoData_default, {
2118
+ width: "18.625rem",
2119
+ height: "14.75rem"
2120
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Flex, {
2121
+ justify: "center",
2122
+ align: "center",
2123
+ gap: "0.5rem",
2124
+ vertical: true,
2125
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Title.default, {
2126
+ className: cx("no-space", "title"),
2127
+ level: 4,
2128
+ children: "No API Documentation Found"
2129
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd_es_typography_Text.default, {
2130
+ className: cx("no-space", "text"),
2131
+ children: "No API Documentation has been added yet. Contact admin for support"
2132
+ })]
2133
+ })]
2134
+ }) : focusedContent === "ENDPOINT" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointPage, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(APIPage, {})
2135
+ }));
992
2136
  };
993
2137
 
994
2138
  //#endregion
@@ -997,6 +2141,12 @@ const transformOpenApiToDocs = (api) => {
997
2141
  const groupedPathsByTags = { default: [] };
998
2142
  const validTags = new Set(api?.tags?.map(({ name }) => name) || []);
999
2143
  const contextPath = Object.keys(api.paths)[0];
2144
+ const relatedVersions = "x-related-versions" in api ? Object.entries(api["x-related-versions"]).map(([apiId, version]) => ({
2145
+ apiId,
2146
+ version
2147
+ })) : [];
2148
+ const currentVersion = "x-current-version" in api ? api["x-current-version"] : "";
2149
+ const authType = "x-auth-type" in api ? api["x-auth-type"] : "";
1000
2150
  for (const [path, methods] of Object.entries(api.paths)) for (const [method, methodData] of Object.entries(methods)) {
1001
2151
  const entry = {
1002
2152
  ...methodData,
@@ -1022,20 +2172,193 @@ const transformOpenApiToDocs = (api) => {
1022
2172
  id: `api-${(0, nanoid.nanoid)(8)}`,
1023
2173
  contextPath,
1024
2174
  tags: groupedPathsByTags,
1025
- servers: api.servers
2175
+ servers: api.servers,
2176
+ relatedVersions,
2177
+ currentVersion,
2178
+ authType
1026
2179
  };
1027
2180
  };
1028
2181
 
2182
+ //#endregion
2183
+ //#region src/view/components/EndpointPage/Codebox/Codebox.tsx
2184
+ react_syntax_highlighter.Light.registerLanguage("json", react_syntax_highlighter_dist_esm_languages_hljs_json.default);
2185
+ const Codebox = ({ code }) => {
2186
+ const [theme, setTheme] = (0, react.useState)("DARK");
2187
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2188
+ className: "codebox",
2189
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2190
+ className: "codebox_header",
2191
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2192
+ role: "button",
2193
+ tabIndex: -1,
2194
+ onClick: () => theme !== "LIGHT" && setTheme("LIGHT"),
2195
+ className: "codebox_header_themeToggle codebox_header_themeToggle_light",
2196
+ title: "Light theme"
2197
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2198
+ role: "button",
2199
+ tabIndex: -1,
2200
+ onClick: () => theme !== "DARK" && setTheme("DARK"),
2201
+ className: "codebox_header_themeToggle codebox_header_themeToggle_dark",
2202
+ title: "Dark theme"
2203
+ })]
2204
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_syntax_highlighter.Light, {
2205
+ language: "json",
2206
+ style: theme === "LIGHT" ? react_syntax_highlighter_dist_esm_styles_hljs.stackoverflowLight : react_syntax_highlighter_dist_esm_styles_hljs.stackoverflowDark,
2207
+ showLineNumbers: true,
2208
+ wrapLines: true,
2209
+ customStyle: {
2210
+ margin: 0,
2211
+ minHeight: "3rem",
2212
+ overflowY: "auto",
2213
+ padding: "0.75rem 1rem 0.75rem 1.5rem",
2214
+ backgroundColor: theme === "DARK" ? "#20264B" : "#20264B",
2215
+ fontSize: "0.75rem"
2216
+ },
2217
+ lineProps: { className: "custom-code-line" },
2218
+ children: code
2219
+ })]
2220
+ });
2221
+ };
2222
+ var Codebox_default = Codebox;
2223
+
2224
+ //#endregion
2225
+ //#region src/view/components/CodeboxSidebar.tsx
2226
+ function CodeboxSidebar() {
2227
+ const { selectedEndpoint, selectedStatusCode, statusCodeOptions, setSelectedStatusCode } = store_default(({ view }) => view);
2228
+ const httpStatusOptions = (0, react.useMemo)(() => statusCodeOptions.map((code) => ({
2229
+ value: code,
2230
+ label: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: code })
2231
+ })), [statusCodeOptions]);
2232
+ const [requestTooltip, setRequestTooltip] = (0, react.useState)("Copy Request");
2233
+ const { cx } = useStyle("CodeboxSidebar", (token$1, scope) => ({
2234
+ [scope("container")]: {
2235
+ display: "flex",
2236
+ flexDirection: "column",
2237
+ gap: token$1.marginMD,
2238
+ background: token$1.colorBgContainer,
2239
+ borderRadius: token$1.borderRadiusLG,
2240
+ padding: token$1.paddingLG,
2241
+ overflow: "hidden",
2242
+ height: "100%",
2243
+ width: "23.625rem",
2244
+ minWidth: "23.625rem",
2245
+ ".ant-card-body": { padding: 0 },
2246
+ ".ant-card-head-title": { color: "white" },
2247
+ ".ant-card-head": { borderBottom: "2px solid #33419A" }
2248
+ },
2249
+ [scope("rightCard")]: {
2250
+ flex: "0 1 auto",
2251
+ maxHeight: "50%",
2252
+ overflowY: "auto",
2253
+ backgroundColor: "#20264B"
2254
+ },
2255
+ [scope("rightCardFlex")]: {
2256
+ overflowY: "auto",
2257
+ backgroundColor: "#20264B"
2258
+ },
2259
+ [scope("customSelect")]: {
2260
+ ".ant-select-selector": {
2261
+ backgroundColor: `${token["brnadColor.9"]} `,
2262
+ borderColor: `${token["brnadColor.9"]}`,
2263
+ borderRadius: "6px",
2264
+ color: "white"
2265
+ },
2266
+ ".ant-select-selection-item": { color: "white" },
2267
+ ".ant-select-selection-placeholder": { color: "rgba(255, 255, 255, 0.65)" },
2268
+ ".ant-select-arrow": { color: "white" },
2269
+ "&:hover .ant-select-selector": {
2270
+ borderColor: `${token["brnadColor.7"]}`,
2271
+ color: "white"
2272
+ },
2273
+ "&:focus .ant-select-selector, &.ant-select-focused .ant-select-selector": {
2274
+ borderColor: `${token["brnadColor.7"]}`,
2275
+ color: "white"
2276
+ }
2277
+ }
2278
+ }));
2279
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2280
+ className: cx("container"),
2281
+ children: [selectedEndpoint?.requestBody && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Card, {
2282
+ title: "Request",
2283
+ variant: "borderless",
2284
+ className: cx("rightCard"),
2285
+ extra: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Tooltip, {
2286
+ title: requestTooltip,
2287
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
2288
+ color: "default",
2289
+ variant: "link",
2290
+ onClick: () => {
2291
+ if (selectedEndpoint?.requestBody) {
2292
+ navigator.clipboard.writeText(JSON.stringify(selectedEndpoint.requestBody, null, 2));
2293
+ setRequestTooltip("Copied!");
2294
+ setTimeout(() => setRequestTooltip("Copy Request"), 1500);
2295
+ }
2296
+ },
2297
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ant_design_icons.CopyOutlined, { style: { color: "white" } })
2298
+ })
2299
+ }),
2300
+ style: {
2301
+ padding: 0,
2302
+ border: "none"
2303
+ },
2304
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Codebox_default, { code: JSON.stringify(selectedEndpoint?.requestBody, null, 2) || "" })
2305
+ }), selectedEndpoint?.responses && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Card, {
2306
+ title: "Response",
2307
+ variant: "borderless",
2308
+ className: cx("rightCardFlex"),
2309
+ extra: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Select, {
2310
+ defaultActiveFirstOption: true,
2311
+ defaultValue: 200,
2312
+ className: cx("customSelect"),
2313
+ style: { width: "100%" },
2314
+ value: selectedStatusCode,
2315
+ onChange: setSelectedStatusCode,
2316
+ prefix: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: {
2317
+ background: handleStatusColor(selectedStatusCode),
2318
+ borderRadius: "50%",
2319
+ display: "inline-block",
2320
+ width: "0.5rem",
2321
+ height: "0.5rem",
2322
+ marginRight: "0.5rem"
2323
+ } }),
2324
+ options: httpStatusOptions
2325
+ }),
2326
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Codebox_default, { code: JSON.stringify(selectedEndpoint?.responses[selectedStatusCode], null, 2) || "" })
2327
+ })]
2328
+ });
2329
+ }
2330
+ var CodeboxSidebar_default = CodeboxSidebar;
2331
+
1029
2332
  //#endregion
1030
2333
  //#region src/view/layout.tsx
1031
2334
  const DocumentationLayout = ({ data }) => {
1032
- const { setOriginalData } = store_default(({ view }) => view);
1033
- const { setTransformedData } = store_default(({ view }) => view);
2335
+ const { focusedContent, selectedNodeKey, selectedApi, builtTreeData, setOriginalData, setTransformedData, setBuiltTreeData } = store_default(({ view }) => view);
2336
+ const { selectFirstApi } = useNodeSelection();
2337
+ const hasInitializedRef = (0, react.useRef)(false);
1034
2338
  (0, react.useEffect)(() => {
1035
2339
  setOriginalData(data);
1036
- const transformedData = data.map(transformOpenApiToDocs);
2340
+ const transformedData = data.map(transformOpenApiToDocs).sort((a, b) => a.title.localeCompare(b.title));
1037
2341
  setTransformedData(transformedData);
1038
- }, [data]);
2342
+ const builtTree = buildTreeDataStructure(transformedData);
2343
+ setBuiltTreeData(builtTree);
2344
+ hasInitializedRef.current = false;
2345
+ }, [
2346
+ data,
2347
+ setOriginalData,
2348
+ setTransformedData,
2349
+ setBuiltTreeData
2350
+ ]);
2351
+ (0, react.useEffect)(() => {
2352
+ if (builtTreeData && builtTreeData.length > 0 && !selectedNodeKey && !selectedApi && !hasInitializedRef.current) {
2353
+ selectFirstApi(builtTreeData);
2354
+ hasInitializedRef.current = true;
2355
+ }
2356
+ }, [
2357
+ builtTreeData,
2358
+ selectedNodeKey,
2359
+ selectedApi,
2360
+ selectFirstApi
2361
+ ]);
1039
2362
  const { cx } = useStyle("DocumentationLayout", (token$1, scope) => ({
1040
2363
  [scope("container")]: {
1041
2364
  display: "flex",
@@ -1050,14 +2373,19 @@ const DocumentationLayout = ({ data }) => {
1050
2373
  height: "100%",
1051
2374
  maxHeight: "100%",
1052
2375
  overflow: "hidden",
1053
- gap: token$1.marginLG
2376
+ gap: token$1.marginLG,
2377
+ width: "100%"
1054
2378
  }
1055
2379
  }));
1056
2380
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ant_design_nextjs_registry.AntdRegistry, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1057
2381
  className: cx("container"),
1058
2382
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Header, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1059
2383
  className: cx("layout"),
1060
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MainContent, {})]
2384
+ children: [
2385
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {}),
2386
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MainContent, {}),
2387
+ focusedContent === "ENDPOINT" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeboxSidebar_default, {})
2388
+ ]
1061
2389
  })]
1062
2390
  }) });
1063
2391
  };