@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.js CHANGED
@@ -1,23 +1,33 @@
1
1
  import { create } from "zustand";
2
2
  import { devtools } from "zustand/middleware";
3
3
  import { immer } from "zustand/middleware/immer";
4
- import * as React$1 from "react";
5
- import React, { useEffect, useMemo, useState } from "react";
6
- import { Button, Input, Layout, Tag, Tree, Typography, theme } from "antd";
4
+ import * as React from "react";
5
+ import { useEffect, useMemo, useRef, useState } from "react";
6
+ import { Breadcrumb, Button, Card, Divider, Flex, Input, Layout, Radio, Select, Table, Tabs, Tag, Tooltip, Tree, Typography, theme } from "antd";
7
7
  import { useStyleRegister } from "@ant-design/cssinjs";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
- import { nanoid } from "nanoid";
9
+ import Text from "antd/es/typography/Text";
10
+ import Title from "antd/es/typography/Title";
11
+ import { CopyOutlined, InfoCircleOutlined, LeftOutlined, LockOutlined } from "@ant-design/icons";
10
12
  import { AntdRegistry } from "@ant-design/nextjs-registry";
13
+ import { nanoid } from "nanoid";
14
+ import { Light } from "react-syntax-highlighter";
15
+ import json from "react-syntax-highlighter/dist/esm/languages/hljs/json";
16
+ import * as hljs from "react-syntax-highlighter/dist/esm/styles/hljs";
11
17
 
12
18
  //#region src/store/slices/view.ts
13
19
  const createViewSlice = (set) => ({ view: {
14
20
  selectedNodeKey: null,
15
- expandedKeys: ["custom-auth", "api-name-01"],
16
- originalData: [],
17
- transformedData: [],
18
- selectedApi: null,
19
- selectedEndpoint: null,
20
- setSelectedNode: (key) => set((state) => {
21
+ expandedKeys: [],
22
+ originalData: null,
23
+ transformedData: null,
24
+ builtTreeData: null,
25
+ selectedApi: void 0,
26
+ selectedEndpoint: void 0,
27
+ focusedContent: void 0,
28
+ selectedStatusCode: null,
29
+ statusCodeOptions: null,
30
+ setSelectedNodeKey: (key) => set((state) => {
21
31
  state.view.selectedNodeKey = key;
22
32
  }),
23
33
  setExpandedKeys: (keys) => set((state) => {
@@ -30,10 +40,24 @@ const createViewSlice = (set) => ({ view: {
30
40
  state.view.selectedApi = api;
31
41
  }),
32
42
  setSelectedEndpoint: (endpoint) => set((state) => {
43
+ if (endpoint) {
44
+ const availableStatusCodes = Object.keys(endpoint?.responses);
45
+ state.view.statusCodeOptions = availableStatusCodes.map(Number);
46
+ state.view.selectedStatusCode = availableStatusCodes.at(0) ? Number(availableStatusCodes.at(0)) : null;
47
+ }
33
48
  state.view.selectedEndpoint = endpoint;
34
49
  }),
35
50
  setTransformedData: (data) => set((state) => {
36
51
  state.view.transformedData = data;
52
+ }),
53
+ setBuiltTreeData: (data) => set((state) => {
54
+ state.view.builtTreeData = data;
55
+ }),
56
+ setFocusedContent: (content) => set((state) => {
57
+ state.view.focusedContent = content;
58
+ }),
59
+ setSelectedStatusCode: (code) => set((state) => {
60
+ state.view.selectedStatusCode = code;
37
61
  })
38
62
  } });
39
63
 
@@ -113,41 +137,76 @@ function useStyle(componentName, stylesFn) {
113
137
  }
114
138
 
115
139
  //#endregion
116
- //#region src/view/components/Header.tsx
140
+ //#region src/view/components/Header/Header.tsx
117
141
  const { Header: AntHeader } = Layout;
118
142
  const Header = () => {
119
- const { wrapSSR, cx } = useStyle("Header", (token$1, scope) => ({ [scope("header")]: {
120
- width: "100%",
121
- height: "4rem",
122
- backgroundColor: token$1.colorBgContainer
123
- } }));
124
- return wrapSSR(/* @__PURE__ */ jsx(AntHeader, { className: cx("header") }));
125
- };
126
-
127
- //#endregion
128
- //#region src/assets/Minify.svg
129
- var _path;
130
- function _extends() {
131
- return _extends = Object.assign ? Object.assign.bind() : function(n) {
132
- for (var e = 1; e < arguments.length; e++) {
133
- var t = arguments[e];
134
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
135
- }
136
- return n;
137
- }, _extends.apply(null, arguments);
138
- }
139
- var SvgMinify = function SvgMinify$1(props) {
140
- return /* @__PURE__ */ React$1.createElement("svg", _extends({
141
- xmlns: "http://www.w3.org/2000/svg",
142
- width: 16,
143
- height: 16,
144
- fill: "none"
145
- }, props), _path || (_path = /* @__PURE__ */ React$1.createElement("path", {
146
- stroke: "currentcolor",
147
- d: "m6 11.334 2-2 2 2M6 4.666l2 2 2-2"
148
- })));
143
+ const { wrapSSR, cx } = useStyle("Header", (token$1, scope) => ({
144
+ [scope("header")]: {
145
+ width: "100%",
146
+ height: "4rem",
147
+ padding: "0 !important",
148
+ margin: "0 !important",
149
+ background: "url(/project-details-title-img.svg) no-repeat top",
150
+ backgroundSize: "cover",
151
+ backgroundPosition: "right",
152
+ backgroundPositionX: "20rem"
153
+ },
154
+ [scope("documentation-title-container")]: {
155
+ justifyContent: "space-between",
156
+ alignItems: "center",
157
+ marginBottom: token$1.marginLG
158
+ },
159
+ [scope("projects-title")]: {
160
+ fontSize: token$1.fontSizeHeading3,
161
+ lineHeight: token$1.lineHeightLG,
162
+ fontWeight: 500,
163
+ marginBottom: token$1.marginXS
164
+ },
165
+ [scope("description")]: {
166
+ fontSize: token$1.fontSizeLG,
167
+ fontWeight: "400",
168
+ fontStyle: "normal",
169
+ lineHeight: token$1.lineHeightLG,
170
+ color: token$1.colorText
171
+ },
172
+ [scope("projects-search-input")]: { width: "28.9375rem" }
173
+ }));
174
+ return wrapSSR(/* @__PURE__ */ jsx(AntHeader, {
175
+ className: cx("header"),
176
+ children: /* @__PURE__ */ jsxs(Flex, {
177
+ className: cx("documentation-title-container"),
178
+ children: [/* @__PURE__ */ jsxs(Flex, {
179
+ vertical: true,
180
+ children: [/* @__PURE__ */ jsx(Typography.Title, {
181
+ className: cx("projects-title"),
182
+ level: 3,
183
+ children: "Documentation"
184
+ }), /* @__PURE__ */ jsx(Typography.Text, {
185
+ className: cx("description"),
186
+ children: "Explore and integrate with ease clear API references, guides, instructions, and examples, all in one place."
187
+ })]
188
+ }), /* @__PURE__ */ jsxs(Radio.Group, {
189
+ optionType: "button",
190
+ buttonStyle: "outline",
191
+ defaultValue: "reference",
192
+ children: [/* @__PURE__ */ jsx(Radio.Button, {
193
+ value: "reference",
194
+ className: cx("sdb-radio"),
195
+ children: "API Reference"
196
+ }), /* @__PURE__ */ jsx(Tooltip, {
197
+ title: "Coming Soon",
198
+ placement: "bottomRight",
199
+ children: /* @__PURE__ */ jsx(Radio.Button, {
200
+ disabled: true,
201
+ value: "guide",
202
+ className: cx("prd-radio"),
203
+ children: "Guide"
204
+ })
205
+ })]
206
+ })]
207
+ })
208
+ }));
149
209
  };
150
- var Minify_default = SvgMinify;
151
210
 
152
211
  //#endregion
153
212
  //#region src/theme/light.json
@@ -500,8 +559,8 @@ const methodColors = {
500
559
  color: token.colorWarning
501
560
  },
502
561
  PATCH: {
503
- bg: token["volcano.5"],
504
- color: token.colorWhite
562
+ bg: token["volcano.1"],
563
+ color: token["volcano.5"]
505
564
  },
506
565
  OPTIONS: {
507
566
  bg: token["geekblue.2"],
@@ -525,7 +584,7 @@ const buildTreeDataStructure = (data) => {
525
584
  selectable: true,
526
585
  data: api,
527
586
  children: Object.entries(api.tags).map(([tag, endpoints]) => {
528
- const tagId = `tag-${nanoid(8)}`;
587
+ const tagId = `tag-${api.id}-${tag.replace(/\s+/g, "-").toLowerCase()}`;
529
588
  return {
530
589
  title: tag,
531
590
  key: tagId,
@@ -544,7 +603,9 @@ const buildTreeDataStructure = (data) => {
544
603
  data: {
545
604
  endpoint,
546
605
  api,
547
- tagName: tag
606
+ tagName: tag,
607
+ parentApiId: api.id,
608
+ tagId
548
609
  }
549
610
  };
550
611
  })
@@ -563,24 +624,9 @@ const findNodeByKey = (nodes, targetKey) => {
563
624
  }
564
625
  return null;
565
626
  };
566
- const isApiSectionHighlighted = (apiKey, selectedNode, treeDataStructure) => {
567
- if (!selectedNode || selectedNode.length === 0) return false;
568
- const selectedKey = selectedNode[0];
569
- if (selectedKey === apiKey) return false;
570
- const findNodeParentApi = (nodes, targetKey) => {
571
- for (const node of nodes) if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data)) {
572
- const apiId = node.key;
573
- if (node.children) for (const child of node.children) {
574
- if (child.key === targetKey) return apiId;
575
- if (child.children) {
576
- for (const grandChild of child.children) if (grandChild.key === targetKey) return apiId;
577
- }
578
- }
579
- }
580
- return null;
581
- };
582
- const parentApiKey = findNodeParentApi(treeDataStructure, selectedKey);
583
- return parentApiKey === apiKey;
627
+ const isApiSectionHighlighted = (apiKey, selectedEndpoint) => {
628
+ if (!selectedEndpoint) return false;
629
+ return selectedEndpoint.parentApiId === apiKey;
584
630
  };
585
631
  const getAllTreeKeys = (data) => {
586
632
  const keys = [];
@@ -631,7 +677,8 @@ const getSidebarStyles = (token$1, scope) => ({
631
677
  backgroundColor: token$1.colorBgContainer,
632
678
  maxWidth: "17.5rem",
633
679
  overflowY: "auto",
634
- overflowX: "clip"
680
+ overflowX: "clip",
681
+ borderRadius: token$1.borderRadius
635
682
  },
636
683
  [scope("content")]: { padding: token$1.padding },
637
684
  [scope("controls")]: {
@@ -696,7 +743,7 @@ const getSidebarStyles = (token$1, scope) => ({
696
743
 
697
744
  //#endregion
698
745
  //#region src/view/helper/sidebar.components.tsx
699
- const { Text } = Typography;
746
+ const { Text: Text$1 } = Typography;
700
747
  const EndpointItem = ({ method, title, cx }) => {
701
748
  const methodStyle = methodColors[method];
702
749
  return /* @__PURE__ */ jsxs("div", {
@@ -709,7 +756,7 @@ const EndpointItem = ({ method, title, cx }) => {
709
756
  border: "none"
710
757
  },
711
758
  children: method
712
- }), /* @__PURE__ */ jsx(Text, {
759
+ }), /* @__PURE__ */ jsx(Text$1, {
713
760
  className: cx("endpoint-text"),
714
761
  ellipsis: { tooltip: title },
715
762
  style: { flex: 1 },
@@ -717,22 +764,22 @@ const EndpointItem = ({ method, title, cx }) => {
717
764
  })]
718
765
  });
719
766
  };
720
- const convertToRenderableTreeData = (treeDataStructure, selectedNode, cx) => {
767
+ const convertToRenderableTreeData = (treeDataStructure, selectedEndpoint, cx) => {
721
768
  const renderNode = (node) => {
722
769
  let title;
723
770
  if (node.isLeaf && node.method) title = /* @__PURE__ */ jsx(EndpointItem, {
724
771
  method: node.method,
725
- title: typeof node.title === "string" ? node.title.replace(`${node.method} `, "") : "",
772
+ title: typeof node.title === "string" ? node.title : "",
726
773
  cx
727
774
  });
728
775
  else if (node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data)) {
729
- const isHighlighted = isApiSectionHighlighted(node.key, selectedNode, treeDataStructure);
730
- title = /* @__PURE__ */ jsx(Text, {
776
+ const isHighlighted = isApiSectionHighlighted(node.key, selectedEndpoint);
777
+ title = /* @__PURE__ */ jsx(Text$1, {
731
778
  className: cx("api-title") + (isHighlighted ? " highlighted" : ""),
732
779
  ellipsis: { tooltip: typeof node.title === "string" ? node.title : "" },
733
780
  children: node.title
734
781
  });
735
- } else title = /* @__PURE__ */ jsx(Text, {
782
+ } else title = /* @__PURE__ */ jsx(Text$1, {
736
783
  className: cx("tag-title"),
737
784
  ellipsis: { tooltip: typeof node.title === "string" ? node.title : "" },
738
785
  children: node.title
@@ -747,153 +794,231 @@ const convertToRenderableTreeData = (treeDataStructure, selectedNode, cx) => {
747
794
  };
748
795
 
749
796
  //#endregion
750
- //#region src/view/components/Sidebar.tsx
751
- const { Sider } = Layout;
752
- var SidebarErrorBoundary = class extends React.Component {
753
- constructor(props) {
754
- super(props);
755
- this.state = { hasError: false };
756
- }
757
- static getDerivedStateFromError(error) {
758
- console.error("[Sidebar] Error caught by ErrorBoundary:", error);
759
- return {
760
- hasError: true,
761
- error
762
- };
763
- }
764
- componentDidCatch(error, errorInfo) {
765
- console.error("[Sidebar] ComponentDidCatch - Error:", error);
766
- console.error("[Sidebar] ComponentDidCatch - ErrorInfo:", errorInfo);
767
- setTimeout(() => {
768
- throw new Error(`Sidebar component error: ${error.message}`);
769
- }, 0);
770
- }
771
- render() {
772
- if (this.state.hasError) return /* @__PURE__ */ jsx(Sider, {
773
- width: 280,
774
- style: {
775
- backgroundColor: "#f5f5f5",
776
- border: "1px solid #d9d9d9"
777
- },
778
- children: /* @__PURE__ */ jsxs("div", {
779
- style: { padding: 16 },
780
- children: [
781
- /* @__PURE__ */ jsx("h4", {
782
- style: {
783
- color: "#ff4d4f",
784
- margin: 0,
785
- marginBottom: 8
786
- },
787
- children: "Sidebar Test Mode"
788
- }),
789
- /* @__PURE__ */ jsx("p", {
790
- style: {
791
- margin: 0,
792
- fontSize: "12px",
793
- color: "#666"
794
- },
795
- children: "Original sidebar failed. This is a test element."
796
- }),
797
- /* @__PURE__ */ jsxs("details", {
798
- style: {
799
- marginTop: 8,
800
- fontSize: "11px"
801
- },
802
- children: [/* @__PURE__ */ jsx("summary", {
803
- style: {
804
- cursor: "pointer",
805
- color: "#1890ff"
806
- },
807
- children: "Error Details"
808
- }), /* @__PURE__ */ jsx("pre", {
809
- style: {
810
- marginTop: 4,
811
- fontSize: "10px",
812
- color: "#ff4d4f"
813
- },
814
- children: this.state.error?.message
815
- })]
816
- })
817
- ]
818
- })
819
- });
820
- return this.props.children;
821
- }
797
+ //#region src/hooks/useNodeSelection.ts
798
+ const useNodeSelection = () => {
799
+ const { setSelectedNodeKey, setFocusedContent, setSelectedApi, setSelectedEndpoint, setExpandedKeys, expandedKeys, builtTreeData } = useStore(({ view }) => view);
800
+ const handleNodeSelection = (nodeData, nodeKey) => {
801
+ if (!nodeData) return null;
802
+ if (nodeKey.startsWith("endpoint-")) {
803
+ const endpointNodeData = nodeData;
804
+ setSelectedEndpoint({
805
+ ...endpointNodeData.endpoint,
806
+ tagName: endpointNodeData.tagName,
807
+ parentApiId: endpointNodeData.parentApiId
808
+ });
809
+ setSelectedApi(endpointNodeData.api);
810
+ setFocusedContent("ENDPOINT");
811
+ const toExpand = [
812
+ endpointNodeData.parentApiId,
813
+ endpointNodeData.tagId,
814
+ endpointNodeData.api.id
815
+ ];
816
+ const expanded = [...expandedKeys];
817
+ toExpand.forEach((key) => {
818
+ if (key && expanded.indexOf(key) < 0) expanded.push(key);
819
+ });
820
+ setExpandedKeys(expanded);
821
+ return {
822
+ type: "endpoint",
823
+ endpoint: endpointNodeData.endpoint,
824
+ api: endpointNodeData.api,
825
+ tag: endpointNodeData.tagName
826
+ };
827
+ } else if (nodeKey.startsWith("api-") || nodeKey === "custom-auth") {
828
+ const apiData = nodeData;
829
+ setSelectedApi(apiData);
830
+ setSelectedEndpoint(null);
831
+ setFocusedContent("API");
832
+ return {
833
+ type: "api",
834
+ api: apiData
835
+ };
836
+ } else {
837
+ const tagData = nodeData;
838
+ return {
839
+ type: "tag",
840
+ tag: tagData.tagName,
841
+ api: tagData.apiData
842
+ };
843
+ }
844
+ };
845
+ const selectNodeByKey = (nodeKey) => {
846
+ const selectedNode = findNodeByKey(builtTreeData, nodeKey);
847
+ if (selectedNode) {
848
+ const result = handleNodeSelection(selectedNode.data, nodeKey);
849
+ setSelectedNodeKey(nodeKey);
850
+ return result;
851
+ }
852
+ return null;
853
+ };
854
+ const expandNode = (nodeKey) => {
855
+ if (!expandedKeys.includes(nodeKey)) setExpandedKeys([...expandedKeys, nodeKey]);
856
+ };
857
+ const selectFirstApi = (treeData) => {
858
+ if (!treeData || treeData.length === 0) return null;
859
+ const firstApiNode = treeData.find((node) => node.data && "id" in node.data && "tags" in node.data && !("endpoint" in node.data) && !("tagName" in node.data));
860
+ if (firstApiNode) {
861
+ const keysToExpand = [firstApiNode.key];
862
+ if (firstApiNode.children) firstApiNode.children.forEach((tagNode) => {
863
+ keysToExpand.push(tagNode.key);
864
+ });
865
+ setExpandedKeys([...expandedKeys, ...keysToExpand.filter((key) => !expandedKeys.includes(key))]);
866
+ return selectNodeByKey(firstApiNode.key);
867
+ }
868
+ return null;
869
+ };
870
+ const clearSelection = () => {
871
+ setSelectedNodeKey(null);
872
+ setSelectedApi(null);
873
+ setSelectedEndpoint(null);
874
+ };
875
+ return {
876
+ handleNodeSelection,
877
+ selectNodeByKey,
878
+ selectFirstApi,
879
+ clearSelection,
880
+ expandNode
881
+ };
822
882
  };
823
- const FallbackSidebar = () => {
824
- return /* @__PURE__ */ jsx(Sider, {
825
- width: 280,
826
- style: {
827
- backgroundColor: "#f5f5f5",
828
- border: "1px solid #d9d9d9"
829
- },
830
- children: /* @__PURE__ */ jsxs("div", {
831
- style: { padding: 16 },
832
- children: [
833
- /* @__PURE__ */ jsx("h4", {
834
- style: {
835
- color: "#ff4d4f",
836
- margin: 0,
837
- marginBottom: 8
838
- },
839
- children: "Sidebar Error"
840
- }),
841
- /* @__PURE__ */ jsx("p", {
842
- style: {
843
- margin: 0,
844
- fontSize: "12px",
845
- color: "#666"
846
- },
847
- children: "The sidebar component encountered an error and has been disabled."
848
- }),
849
- /* @__PURE__ */ jsx("p", {
850
- style: {
851
- margin: 0,
852
- fontSize: "11px",
853
- color: "#999",
854
- marginTop: 8
855
- },
856
- children: "Check the console for more details."
857
- })
858
- ]
859
- })
860
- });
883
+
884
+ //#endregion
885
+ //#region src/assets/Minify.svg
886
+ var _path$6;
887
+ function _extends$6() {
888
+ return _extends$6 = Object.assign ? Object.assign.bind() : function(n) {
889
+ for (var e = 1; e < arguments.length; e++) {
890
+ var t = arguments[e];
891
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
892
+ }
893
+ return n;
894
+ }, _extends$6.apply(null, arguments);
895
+ }
896
+ var SvgMinify = function SvgMinify$1(props) {
897
+ return /* @__PURE__ */ React.createElement("svg", _extends$6({
898
+ xmlns: "http://www.w3.org/2000/svg",
899
+ width: 16,
900
+ height: 16,
901
+ fill: "none"
902
+ }, props), _path$6 || (_path$6 = /* @__PURE__ */ React.createElement("path", {
903
+ stroke: "currentcolor",
904
+ d: "m6 11.334 2-2 2 2M6 4.666l2 2 2-2"
905
+ })));
861
906
  };
862
- const SafeSidebar = () => {
863
- try {
864
- const expandedKeys = useStore((state) => state.view.expandedKeys);
865
- const setExpandedKeys = useStore((state) => state.view.setExpandedKeys);
866
- const setSelectedApi = useStore((state) => state.view.setSelectedApi);
867
- const setSelectedEndpoint = useStore((state) => state.view.setSelectedEndpoint);
868
- const [selectedNode, setSelectedNodeState] = useState();
869
- const transformedData = useStore((state) => state.view.transformedData);
870
- console.log("[Sidebar] Store access successful, transformedData:", transformedData);
871
- return /* @__PURE__ */ jsx(SidebarContent, {
872
- expandedKeys,
873
- setExpandedKeys,
874
- setSelectedApi,
875
- setSelectedEndpoint,
876
- selectedNode,
877
- setSelectedNodeState,
878
- transformedData
879
- });
880
- } catch (error) {
881
- console.error("[Sidebar] Error accessing store or rendering:", error);
882
- return /* @__PURE__ */ jsx(FallbackSidebar, {});
883
- }
907
+ var Minify_default = SvgMinify;
908
+
909
+ //#endregion
910
+ //#region src/assets/NoDataSM.svg
911
+ 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;
912
+ function _extends$5() {
913
+ return _extends$5 = Object.assign ? Object.assign.bind() : function(n) {
914
+ for (var e = 1; e < arguments.length; e++) {
915
+ var t = arguments[e];
916
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
917
+ }
918
+ return n;
919
+ }, _extends$5.apply(null, arguments);
920
+ }
921
+ var SvgNoDataSm = function SvgNoDataSm$1(props) {
922
+ return /* @__PURE__ */ React.createElement("svg", _extends$5({
923
+ xmlns: "http://www.w3.org/2000/svg",
924
+ width: 166,
925
+ height: 132,
926
+ fill: "none"
927
+ }, props), _path$5 || (_path$5 = /* @__PURE__ */ React.createElement("path", {
928
+ fill: "#F1F5FD",
929
+ 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"
930
+ })), _path2$4 || (_path2$4 = /* @__PURE__ */ React.createElement("path", {
931
+ stroke: "#E0E9F9",
932
+ strokeLinecap: "round",
933
+ strokeLinejoin: "round",
934
+ strokeWidth: .85,
935
+ d: "M47.204 1v5.25M44.572 3.625h5.263M147.054 105.631v5.249M144.422 108.256h5.263"
936
+ })), _path3$1 || (_path3$1 = /* @__PURE__ */ React.createElement("path", {
937
+ fill: "#E0E9F9",
938
+ 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"
939
+ })), _path4$1 || (_path4$1 = /* @__PURE__ */ React.createElement("path", {
940
+ fill: "#F1F5FD",
941
+ 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"
942
+ })), _path5$1 || (_path5$1 = /* @__PURE__ */ React.createElement("path", {
943
+ fill: "#fff",
944
+ stroke: "#769DE4",
945
+ strokeLinecap: "round",
946
+ strokeLinejoin: "round",
947
+ 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"
948
+ })), _path6$1 || (_path6$1 = /* @__PURE__ */ React.createElement("path", {
949
+ fill: "#F1F5FD",
950
+ d: "M112.783 52.98H45.515v52.64h67.268z"
951
+ })), _path7$1 || (_path7$1 = /* @__PURE__ */ React.createElement("path", {
952
+ fill: "#fff",
953
+ stroke: "#769DE4",
954
+ strokeLinecap: "round",
955
+ strokeLinejoin: "round",
956
+ 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"
957
+ })), _path8$1 || (_path8$1 = /* @__PURE__ */ React.createElement("path", {
958
+ fill: "#F1F5FD",
959
+ 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"
960
+ })), _path9$1 || (_path9$1 = /* @__PURE__ */ React.createElement("path", {
961
+ fill: "#fff",
962
+ stroke: "#769DE4",
963
+ strokeLinecap: "round",
964
+ strokeLinejoin: "round",
965
+ 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"
966
+ })), _path0$1 || (_path0$1 = /* @__PURE__ */ React.createElement("path", {
967
+ fill: "#F1F5FD",
968
+ 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"
969
+ })), _path1$1 || (_path1$1 = /* @__PURE__ */ React.createElement("path", {
970
+ fill: "#fff",
971
+ stroke: "#769DE4",
972
+ strokeLinecap: "round",
973
+ strokeLinejoin: "round",
974
+ 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"
975
+ })), _path10$1 || (_path10$1 = /* @__PURE__ */ React.createElement("path", {
976
+ fill: "#F1F5FD",
977
+ 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"
978
+ })), _path11$1 || (_path11$1 = /* @__PURE__ */ React.createElement("path", {
979
+ fill: "#fff",
980
+ stroke: "#769DE4",
981
+ strokeLinecap: "round",
982
+ strokeLinejoin: "round",
983
+ 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"
984
+ })), _path12$1 || (_path12$1 = /* @__PURE__ */ React.createElement("path", {
985
+ fill: "#fff",
986
+ stroke: "#769DE4",
987
+ strokeLinecap: "round",
988
+ strokeLinejoin: "round",
989
+ 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"
990
+ })), _path13$1 || (_path13$1 = /* @__PURE__ */ React.createElement("path", {
991
+ fill: "#fff",
992
+ d: "M111.067 33.371c.308.638 15.672 15.643 15.672 15.643z"
993
+ })), _path14$1 || (_path14$1 = /* @__PURE__ */ React.createElement("path", {
994
+ stroke: "#769DE4",
995
+ strokeLinecap: "round",
996
+ strokeLinejoin: "round",
997
+ d: "M111.067 33.371c.308.638 15.672 15.643 15.672 15.643"
998
+ })), _path15$1 || (_path15$1 = /* @__PURE__ */ React.createElement("path", {
999
+ fill: "#fff",
1000
+ d: "M126.739 33.371c-.32.638-15.672 15.643-15.672 15.643z"
1001
+ })), _path16$1 || (_path16$1 = /* @__PURE__ */ React.createElement("path", {
1002
+ stroke: "#769DE4",
1003
+ strokeLinecap: "round",
1004
+ strokeLinejoin: "round",
1005
+ d: "M126.739 33.371c-.32.638-15.672 15.643-15.672 15.643"
1006
+ })));
884
1007
  };
885
- const SidebarContent = ({ expandedKeys, setExpandedKeys, setSelectedApi, setSelectedEndpoint, selectedNode, setSelectedNodeState, transformedData }) => {
886
- const builtTreeData = useMemo(() => {
887
- console.log("[Sidebar] transformedData:", transformedData);
888
- const tree = buildTreeDataStructure(transformedData);
889
- console.log("[Sidebar] builtTreeData:", tree);
890
- return tree;
891
- }, [transformedData]);
1008
+ var NoDataSM_default = SvgNoDataSm;
1009
+
1010
+ //#endregion
1011
+ //#region src/view/components/Sidebar.tsx
1012
+ const { Sider } = Layout;
1013
+ const Sidebar = () => {
1014
+ const expandedKeys = useStore((state) => state.view.expandedKeys);
1015
+ const { selectedNodeKey, selectedEndpoint, builtTreeData, setExpandedKeys, setSelectedNodeKey, transformedData } = useStore(({ view }) => view);
1016
+ const { selectNodeByKey, clearSelection } = useNodeSelection();
892
1017
  const [searchValue, setSearchValue] = useState("");
893
1018
  const [autoExpandParent, setAutoExpandParent] = useState(true);
894
- const { wrapSSR, cx } = useStyle("Sidebar", getSidebarStyles);
1019
+ const { wrapSSR, cx, token: token$1 } = useStyle("Sidebar", getSidebarStyles);
895
1020
  const handleSearch = (value) => {
896
- if (value) {
1021
+ if (value && builtTreeData) {
897
1022
  const allKeys = getAllTreeKeys(builtTreeData);
898
1023
  setExpandedKeys(allKeys);
899
1024
  setSearchValue(value);
@@ -904,77 +1029,39 @@ const SidebarContent = ({ expandedKeys, setExpandedKeys, setSelectedApi, setSele
904
1029
  }
905
1030
  };
906
1031
  const renderTreeData = useMemo(() => {
907
- const data = convertToRenderableTreeData(builtTreeData, selectedNode, cx);
908
- console.log("[Sidebar] renderTreeData:", data);
909
- return data;
1032
+ if (!builtTreeData) return [];
1033
+ return convertToRenderableTreeData(builtTreeData, selectedEndpoint, cx);
910
1034
  }, [
911
1035
  builtTreeData,
912
- selectedNode,
1036
+ selectedEndpoint,
913
1037
  cx
914
1038
  ]);
915
1039
  const filteredTreeData = useMemo(() => {
916
1040
  if (!searchValue) return renderTreeData;
1041
+ if (!builtTreeData) return [];
917
1042
  const filteredOriginal = filterTreeData(builtTreeData, searchValue);
918
- const data = convertToRenderableTreeData(filteredOriginal, selectedNode, cx);
919
- console.log("[Sidebar] filteredTreeData:", data);
920
- return data;
1043
+ return convertToRenderableTreeData(filteredOriginal, selectedEndpoint, cx);
921
1044
  }, [
922
1045
  builtTreeData,
923
1046
  searchValue,
924
- selectedNode,
1047
+ selectedEndpoint,
925
1048
  cx
926
1049
  ]);
927
1050
  const collapseAll = () => {
928
1051
  setExpandedKeys([]);
929
1052
  };
930
- const handleNodeSelection = (nodeData, nodeKey) => {
931
- if (!nodeData) return null;
932
- if (nodeKey.startsWith("endpoint-")) {
933
- const endpointNodeData = nodeData;
934
- setSelectedEndpoint(endpointNodeData.endpoint);
935
- setSelectedApi(endpointNodeData.api);
936
- return {
937
- type: "endpoint",
938
- endpoint: endpointNodeData.endpoint,
939
- api: endpointNodeData.api,
940
- tag: endpointNodeData.tagName
941
- };
942
- } else if (nodeKey.startsWith("api-") || nodeKey === "custom-auth") {
943
- const apiData = nodeData;
944
- setSelectedApi(apiData);
945
- setSelectedEndpoint(null);
946
- return {
947
- type: "api",
948
- api: apiData
949
- };
950
- } else {
951
- const tagData = nodeData;
952
- return {
953
- type: "tag",
954
- tag: tagData.tagName,
955
- api: tagData.apiData
956
- };
957
- }
958
- };
959
1053
  const onTreeNodeSelect = (selectedKeys) => {
960
1054
  const stringKeys = selectedKeys.map((key) => String(key));
961
- console.log("[Sidebar] onTreeNodeSelect - selectedKeys:", selectedKeys, "stringKeys:", stringKeys);
962
1055
  if (stringKeys.length === 0) {
963
- setSelectedNodeState([]);
964
- setSelectedApi(null);
965
- setSelectedEndpoint(null);
1056
+ clearSelection();
966
1057
  return;
967
1058
  }
1059
+ if (!builtTreeData) return;
968
1060
  const selectedKey = stringKeys[0];
969
- const selectedNode$1 = findNodeByKey(builtTreeData, selectedKey);
970
- console.log("[Sidebar] findNodeByKey result:", selectedNode$1);
971
- if (selectedNode$1) {
972
- const result = handleNodeSelection(selectedNode$1.data, selectedKey);
973
- console.log("[Sidebar] handleNodeSelection result:", result);
974
- }
975
- setSelectedNodeState(stringKeys);
1061
+ selectNodeByKey(selectedKey);
1062
+ setSelectedNodeKey(selectedKey);
976
1063
  };
977
- return wrapSSR(/* @__PURE__ */ jsx(SidebarErrorBoundary, { children: /* @__PURE__ */ jsx(Sider, {
1064
+ return wrapSSR(/* @__PURE__ */ jsx(Sider, {
978
1065
  width: 280,
979
1066
  className: cx("sider"),
980
1067
  children: /* @__PURE__ */ jsxs("div", {
@@ -992,40 +1079,1039 @@ const SidebarContent = ({ expandedKeys, setExpandedKeys, setSelectedApi, setSele
992
1079
  title: "Collapse All",
993
1080
  icon: /* @__PURE__ */ jsx(Minify_default, {})
994
1081
  })]
995
- }), /* @__PURE__ */ jsx(Tree, {
1082
+ }), transformedData?.length ? /* @__PURE__ */ jsx(Tree, {
996
1083
  showLine: { showLeafIcon: false },
997
1084
  showIcon: false,
998
1085
  expandedKeys,
999
1086
  autoExpandParent,
1000
- selectedKeys: selectedNode,
1001
- onSelect: onTreeNodeSelect,
1087
+ selectedKeys: [selectedNodeKey || ""],
1088
+ onSelect: (selectedKeys) => {
1089
+ if (!selectedKeys?.length) return;
1090
+ onTreeNodeSelect(selectedKeys);
1091
+ setSelectedNodeKey(selectedKeys[0]);
1092
+ },
1002
1093
  onExpand: (expandedKeysValue) => {
1003
1094
  setExpandedKeys(expandedKeysValue);
1004
1095
  setAutoExpandParent(false);
1005
1096
  },
1006
1097
  treeData: filteredTreeData,
1007
1098
  className: cx("tree")
1099
+ }) : /* @__PURE__ */ jsxs(Flex, {
1100
+ justify: "center",
1101
+ align: "center",
1102
+ gap: token$1.marginSM,
1103
+ vertical: true,
1104
+ style: { marginTop: token$1.paddingXL },
1105
+ children: [/* @__PURE__ */ jsx(NoDataSM_default, {
1106
+ width: "10.375rem",
1107
+ height: "8.1875rem",
1108
+ style: { backgroundSize: "cover" }
1109
+ }), /* @__PURE__ */ jsxs(Text, {
1110
+ style: {
1111
+ textAlign: "center",
1112
+ fontFamily: token$1.fontFamily,
1113
+ fontWeight: 400,
1114
+ fontSize: token$1.fontSizeLG,
1115
+ color: "rgba(0,0,0,0.45)"
1116
+ },
1117
+ children: [
1118
+ "No API",
1119
+ /* @__PURE__ */ jsx("br", {}),
1120
+ "Documentation Found"
1121
+ ]
1122
+ })]
1008
1123
  })]
1009
1124
  })
1010
- }) }));
1125
+ }));
1011
1126
  };
1012
- const Sidebar = () => {
1013
- return /* @__PURE__ */ jsx(SafeSidebar, {});
1127
+
1128
+ //#endregion
1129
+ //#region src/assets/grid.svg
1130
+ var _mask, _path$4, _path2$3;
1131
+ function _extends$4() {
1132
+ return _extends$4 = Object.assign ? Object.assign.bind() : function(n) {
1133
+ for (var e = 1; e < arguments.length; e++) {
1134
+ var t = arguments[e];
1135
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1136
+ }
1137
+ return n;
1138
+ }, _extends$4.apply(null, arguments);
1139
+ }
1140
+ var SvgGrid = function SvgGrid$1(props) {
1141
+ return /* @__PURE__ */ React.createElement("svg", _extends$4({
1142
+ xmlns: "http://www.w3.org/2000/svg",
1143
+ width: 16,
1144
+ height: 16,
1145
+ fill: "none"
1146
+ }, props), _mask || (_mask = /* @__PURE__ */ React.createElement("mask", {
1147
+ id: "grid_svg__a",
1148
+ fill: "#fff"
1149
+ }, /* @__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", {
1150
+ fill: "#D9D9D9",
1151
+ 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"
1152
+ })), _path2$3 || (_path2$3 = /* @__PURE__ */ React.createElement("path", {
1153
+ fill: "#769DE4",
1154
+ 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",
1155
+ mask: "url(#grid_svg__a)"
1156
+ })));
1014
1157
  };
1158
+ var grid_default = SvgGrid;
1159
+
1160
+ //#endregion
1161
+ //#region src/assets/list.svg
1162
+ var _path$3;
1163
+ function _extends$3() {
1164
+ return _extends$3 = Object.assign ? Object.assign.bind() : function(n) {
1165
+ for (var e = 1; e < arguments.length; e++) {
1166
+ var t = arguments[e];
1167
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1168
+ }
1169
+ return n;
1170
+ }, _extends$3.apply(null, arguments);
1171
+ }
1172
+ var SvgList = function SvgList$1(props) {
1173
+ return /* @__PURE__ */ React.createElement("svg", _extends$3({
1174
+ xmlns: "http://www.w3.org/2000/svg",
1175
+ width: 16,
1176
+ height: 16,
1177
+ fill: "none"
1178
+ }, props), _path$3 || (_path$3 = /* @__PURE__ */ React.createElement("path", {
1179
+ stroke: "#000",
1180
+ strokeLinecap: "round",
1181
+ strokeLinejoin: "round",
1182
+ strokeOpacity: .25,
1183
+ 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"
1184
+ })));
1185
+ };
1186
+ var list_default = SvgList;
1187
+
1188
+ //#endregion
1189
+ //#region src/assets/copy.svg
1190
+ var _path$2, _path2$2;
1191
+ function _extends$2() {
1192
+ return _extends$2 = Object.assign ? Object.assign.bind() : function(n) {
1193
+ for (var e = 1; e < arguments.length; e++) {
1194
+ var t = arguments[e];
1195
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1196
+ }
1197
+ return n;
1198
+ }, _extends$2.apply(null, arguments);
1199
+ }
1200
+ var SvgCopy = function SvgCopy$1(props) {
1201
+ return /* @__PURE__ */ React.createElement("svg", _extends$2({
1202
+ xmlns: "http://www.w3.org/2000/svg",
1203
+ width: 16,
1204
+ height: 16,
1205
+ fill: "none"
1206
+ }, props), _path$2 || (_path$2 = /* @__PURE__ */ React.createElement("path", {
1207
+ fill: "#000",
1208
+ fillOpacity: .45,
1209
+ 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"
1210
+ })), _path2$2 || (_path2$2 = /* @__PURE__ */ React.createElement("path", {
1211
+ fill: "#000",
1212
+ fillOpacity: .45,
1213
+ 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"
1214
+ })));
1215
+ };
1216
+ var copy_default = SvgCopy;
1217
+
1218
+ //#endregion
1219
+ //#region src/assets/link.svg
1220
+ var _path$1, _path2$1;
1221
+ function _extends$1() {
1222
+ return _extends$1 = Object.assign ? Object.assign.bind() : function(n) {
1223
+ for (var e = 1; e < arguments.length; e++) {
1224
+ var t = arguments[e];
1225
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1226
+ }
1227
+ return n;
1228
+ }, _extends$1.apply(null, arguments);
1229
+ }
1230
+ var SvgLink = function SvgLink$1(props) {
1231
+ return /* @__PURE__ */ React.createElement("svg", _extends$1({
1232
+ xmlns: "http://www.w3.org/2000/svg",
1233
+ width: 12,
1234
+ height: 12,
1235
+ fill: "none"
1236
+ }, props), _path$1 || (_path$1 = /* @__PURE__ */ React.createElement("path", {
1237
+ fill: "#4D75D9",
1238
+ 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"
1239
+ })), _path2$1 || (_path2$1 = /* @__PURE__ */ React.createElement("path", {
1240
+ fill: "#4D75D9",
1241
+ 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"
1242
+ })));
1243
+ };
1244
+ var link_default = SvgLink;
1245
+
1246
+ //#endregion
1247
+ //#region src/view/components/ApiPage/components/ApiCard.tsx
1248
+ const ApiCard = ({ api, viewStyle }) => {
1249
+ const { wrapSSR, cx, token: token$1 } = useStyle("DocumentationApiCard", (token$2, scope) => ({
1250
+ [scope("method-chip")]: {
1251
+ minWidth: "5.375rem",
1252
+ width: "fit-content",
1253
+ paddingLeft: token$2.marginXS,
1254
+ paddingRight: token$2.marginXS,
1255
+ display: "flex",
1256
+ justifyContent: "center",
1257
+ alignItems: "center",
1258
+ borderRadius: token$2.borderRadius
1259
+ },
1260
+ [scope("list-container")]: {
1261
+ paddingTop: token$2.marginXS,
1262
+ paddingBottom: token$2.marginXS
1263
+ },
1264
+ [scope("chip-title")]: {
1265
+ alignSelf: "center",
1266
+ textAlign: "center",
1267
+ padding: 0,
1268
+ margin: 0,
1269
+ lineHeight: "1.375rem",
1270
+ fontSize: token$2.fontSize
1271
+ },
1272
+ [scope("list-see-details")]: {
1273
+ width: "6.5625rem",
1274
+ height: "2rem",
1275
+ borderRadius: token$2.borderRadius,
1276
+ border: `${token$2.lineWidth}rem solid ${token$2.Button?.defaultBorderColor}`,
1277
+ paddingRight: token$2.Button?.paddingInline,
1278
+ paddingLeft: token$2.Button?.paddingInline
1279
+ },
1280
+ [scope("list-content")]: {
1281
+ display: "flex",
1282
+ paddingTop: token$2.paddingXXS,
1283
+ paddingBottom: token$2.paddingXXS,
1284
+ paddingRight: token$2.paddingXS,
1285
+ paddingLeft: token$2.paddingXS,
1286
+ alignItems: "center",
1287
+ gap: token$2.marginXS,
1288
+ alignSelf: "stretch",
1289
+ flexDirection: "row",
1290
+ borderRadius: token$2.borderRadiusSM,
1291
+ border: `1px solid ${token$2.colorBorderSecondary}`,
1292
+ minWidth: "6.25rem",
1293
+ maxWidth: "fit-content"
1294
+ },
1295
+ [scope("list-title")]: {
1296
+ color: token$2.colorTextHeading,
1297
+ fontSize: token$2.fontSizeHeading3,
1298
+ fontWeight: token$2.fontWeightStrong,
1299
+ lineHeight: token$2.lineHeightHeading3,
1300
+ paddingBottom: 0,
1301
+ marginBottom: 0,
1302
+ fontFamily: "SF Pro",
1303
+ "&:hover": {
1304
+ color: `${token$2.colorPrimary} !important`,
1305
+ textDecoration: "underline"
1306
+ }
1307
+ },
1308
+ [scope("path-name")]: {
1309
+ color: token$2.colorText,
1310
+ fontSize: token$2.fontSizeSM,
1311
+ fontWeight: 400,
1312
+ fontFamily: token$2.fontFamily
1313
+ },
1314
+ [scope("grid-card")]: {
1315
+ width: "17.5rem",
1316
+ height: "100%",
1317
+ borderRadius: token$2.borderRadiusLG
1318
+ },
1319
+ [scope("grid-title")]: {
1320
+ color: token$2.colorTextHeading,
1321
+ fontSize: token$2.fontSizeHeading3,
1322
+ fontWeight: token$2.fontWeightStrong,
1323
+ lineHeight: token$2.lineHeightHeading3,
1324
+ paddingBottom: 0,
1325
+ marginBottom: 0,
1326
+ fontFamily: token$2.fontFamily
1327
+ },
1328
+ [scope("grid-content")]: {
1329
+ display: "flex",
1330
+ paddingTop: token$2.paddingXXS,
1331
+ paddingBottom: token$2.paddingXXS,
1332
+ paddingRight: token$2.paddingXS,
1333
+ paddingLeft: token$2.paddingXS,
1334
+ alignItems: "center",
1335
+ gap: token$2.marginXS,
1336
+ alignSelf: "stretch",
1337
+ flexDirection: "row",
1338
+ borderRadius: token$2.borderRadiusSM,
1339
+ border: `1px solid ${token$2.colorBorderSecondary}`
1340
+ },
1341
+ [scope("grid-path-name")]: {
1342
+ color: token$2.colorText,
1343
+ fontSize: token$2.fontSizeSM,
1344
+ fontWeight: 400,
1345
+ fontFamily: token$2.fontFamily
1346
+ },
1347
+ [scope("grid-see-details")]: {
1348
+ paddingTop: 0,
1349
+ paddingBottom: 0,
1350
+ paddingLeft: "0.4375rem",
1351
+ paddingRight: "0.4375rem",
1352
+ borderRadius: token$2.borderRadiusSM,
1353
+ border: `1px solid ${token$2.Button?.defaultBorderColor}`,
1354
+ background: token$2.Button?.defaultBg,
1355
+ boxShadow: `0 2px 0 0 rgba(0, 0, 0, 0.02)`,
1356
+ width: "100%",
1357
+ height: "1.5rem"
1358
+ }
1359
+ }));
1360
+ const { selectNodeByKey } = useNodeSelection();
1361
+ const handleOpenEndPointView = () => {
1362
+ selectNodeByKey(api.id);
1363
+ };
1364
+ const TooltippedText = ({ text }) => {
1365
+ const limitation = viewStyle == "grid" ? 15 : 36;
1366
+ if (text.length < limitation) return text;
1367
+ return /* @__PURE__ */ jsxs(Tooltip, {
1368
+ title: text,
1369
+ placement: "bottomLeft",
1370
+ children: [text.substring(0, limitation), "..."]
1371
+ });
1372
+ };
1373
+ const MethodChip = ({ method }) => {
1374
+ const { bg, color } = methodColors[method.toUpperCase()];
1375
+ return /* @__PURE__ */ jsx("div", {
1376
+ className: cx("method-chip"),
1377
+ style: {
1378
+ color,
1379
+ backgroundColor: bg
1380
+ },
1381
+ children: /* @__PURE__ */ jsx(Title, {
1382
+ color,
1383
+ className: cx("chip-title"),
1384
+ level: 5,
1385
+ children: method
1386
+ })
1387
+ });
1388
+ };
1389
+ if (viewStyle == "list") return wrapSSR(/* @__PURE__ */ jsxs(Flex, {
1390
+ vertical: true,
1391
+ children: [
1392
+ /* @__PURE__ */ jsxs(Flex, {
1393
+ justify: "space-between",
1394
+ align: "center",
1395
+ className: cx("list-container"),
1396
+ children: [/* @__PURE__ */ jsxs(Flex, {
1397
+ gap: token$1.marginSM,
1398
+ children: [/* @__PURE__ */ jsx(MethodChip, { method: api.method }), /* @__PURE__ */ jsx(Title, {
1399
+ className: cx("list-title"),
1400
+ level: 4,
1401
+ children: /* @__PURE__ */ jsx(TooltippedText, { text: api?.summary || "Endpoint Name" })
1402
+ })]
1403
+ }), /* @__PURE__ */ jsx(Button, {
1404
+ color: "default",
1405
+ className: cx("list-see-details"),
1406
+ onClick: handleOpenEndPointView,
1407
+ children: "See Details"
1408
+ })]
1409
+ }),
1410
+ /* @__PURE__ */ jsxs("div", {
1411
+ className: cx("list-content"),
1412
+ children: [/* @__PURE__ */ jsx(link_default, {}), /* @__PURE__ */ jsx(Text, {
1413
+ className: cx("path-name"),
1414
+ children: api?.path
1415
+ })]
1416
+ }),
1417
+ /* @__PURE__ */ jsx(Divider, { style: {
1418
+ marginTop: "0.75rem",
1419
+ marginBottom: "0.25rem"
1420
+ } })
1421
+ ]
1422
+ }));
1423
+ return wrapSSR(/* @__PURE__ */ jsx(Card, {
1424
+ className: cx("grid-card"),
1425
+ children: /* @__PURE__ */ jsxs(Flex, {
1426
+ vertical: true,
1427
+ gap: token$1.marginSM,
1428
+ children: [
1429
+ /* @__PURE__ */ jsx(MethodChip, { method: api?.method }),
1430
+ /* @__PURE__ */ jsx(Title, {
1431
+ className: cx("grid-title"),
1432
+ level: 4,
1433
+ children: /* @__PURE__ */ jsx(TooltippedText, { text: api?.summary || "Endpoint Name" })
1434
+ }),
1435
+ /* @__PURE__ */ jsxs("div", {
1436
+ className: cx("grid-content"),
1437
+ children: [/* @__PURE__ */ jsx(link_default, {}), /* @__PURE__ */ jsx(Text, {
1438
+ className: cx("grid-path-name"),
1439
+ children: api?.path
1440
+ })]
1441
+ }),
1442
+ /* @__PURE__ */ jsx(Button, {
1443
+ className: cx("grid-see-details"),
1444
+ onClick: handleOpenEndPointView,
1445
+ children: "See Details"
1446
+ })
1447
+ ]
1448
+ })
1449
+ }));
1450
+ };
1451
+ var ApiCard_default = ApiCard;
1452
+
1453
+ //#endregion
1454
+ //#region src/utils/index.ts
1455
+ const handleStatusColor = (code) => {
1456
+ if (code >= 200 && code < 300) return "green";
1457
+ else if (code >= 400 && code < 500) return "red";
1458
+ else if (code >= 500 && code < 600) return "red";
1459
+ else if (code >= 100 && code < 200) return "blue";
1460
+ else if (code >= 300 && code < 400) return "orange";
1461
+ else return "gray";
1462
+ };
1463
+ const copyToClipboard = async (text) => {
1464
+ try {
1465
+ await navigator.clipboard.writeText(text);
1466
+ return;
1467
+ } catch (err) {
1468
+ return err;
1469
+ }
1470
+ };
1471
+
1472
+ //#endregion
1473
+ //#region src/view/components/ApiPage/index.tsx
1474
+ const APIPage = () => {
1475
+ const [selectedUrl, setSelectedUrl] = useState("");
1476
+ const [copying, setCopying] = useState(false);
1477
+ const { view: { selectedApi, transformedData, setSelectedApi, setFocusedContent, setSelectedNodeKey } } = store_default();
1478
+ const [viewStyle, setViewStyle] = useState("grid");
1479
+ const { wrapSSR, cx, token: token$1 } = useStyle("DocumentationApiPage", () => ({}));
1480
+ const currentVersion = selectedApi?.relatedVersions?.find((v) => v.apiId === selectedApi?.currentVersion);
1481
+ const handleVersionChanged = (value) => {
1482
+ console.log("new value ", value);
1483
+ const apiByVersion = transformedData?.find((item) => item.currentVersion === value);
1484
+ if (apiByVersion) {
1485
+ setSelectedApi(apiByVersion);
1486
+ setFocusedContent("API");
1487
+ setSelectedNodeKey(apiByVersion.id);
1488
+ }
1489
+ };
1490
+ useEffect(() => {
1491
+ if (selectedApi?.servers && !selectedUrl) setSelectedUrl(selectedApi?.servers?.[0].url);
1492
+ }, [selectedApi?.servers]);
1493
+ const handleCopyUrl = async () => {
1494
+ setCopying(true);
1495
+ await copyToClipboard(selectedUrl);
1496
+ setTimeout(() => {
1497
+ setCopying(false);
1498
+ }, 700);
1499
+ };
1500
+ const APIsRenderer = ({ apis, withTitle, tagName, haveUnderLine }) => {
1501
+ return /* @__PURE__ */ jsxs(Flex, {
1502
+ gap: viewStyle == "grid" ? token$1.marginXS : 0,
1503
+ style: {
1504
+ marginBottom: 0,
1505
+ paddingBottom: 0
1506
+ },
1507
+ vertical: true,
1508
+ children: [
1509
+ withTitle && /* @__PURE__ */ jsx(Title, {
1510
+ style: { marginBottom: 0 },
1511
+ level: 4,
1512
+ children: tagName
1513
+ }),
1514
+ /* @__PURE__ */ jsx(Flex, {
1515
+ wrap: "wrap",
1516
+ gap: viewStyle == "grid" ? "1.5rem" : 0,
1517
+ vertical: viewStyle == "list",
1518
+ children: apis.map((item) => /* @__PURE__ */ jsx(ApiCard_default, {
1519
+ api: item,
1520
+ viewStyle
1521
+ }))
1522
+ }),
1523
+ haveUnderLine && /* @__PURE__ */ jsx(Divider, { style: {
1524
+ marginTop: token$1.marginSM,
1525
+ marginBottom: token$1.marginSM
1526
+ } })
1527
+ ]
1528
+ });
1529
+ };
1530
+ return wrapSSR(/* @__PURE__ */ jsxs(Flex, {
1531
+ vertical: true,
1532
+ gap: token$1.margin,
1533
+ children: [
1534
+ /* @__PURE__ */ jsx(Title, {
1535
+ className: cx("container"),
1536
+ level: 4,
1537
+ children: selectedApi?.title
1538
+ }),
1539
+ /* @__PURE__ */ jsxs(Flex, { children: [
1540
+ selectedApi?.authType && /* @__PURE__ */ jsx(Tooltip, {
1541
+ title: "Authenticator Type",
1542
+ placement: "bottomLeft",
1543
+ children: /* @__PURE__ */ jsx(Tag, {
1544
+ style: {
1545
+ minWidth: "3.9375rem",
1546
+ width: "max-content",
1547
+ height: "2rem",
1548
+ background: "#fff",
1549
+ borderRadius: token$1.borderRadiusSM,
1550
+ paddingTop: "0.0625rem",
1551
+ paddingBottom: "0.0625rem",
1552
+ paddingRight: token$1.paddingContentHorizontalSM,
1553
+ paddingLeft: token$1.paddingContentHorizontalSM,
1554
+ display: "flex",
1555
+ justifyContent: "center",
1556
+ alignItems: "center"
1557
+ },
1558
+ icon: /* @__PURE__ */ jsx(LockOutlined, {}),
1559
+ children: selectedApi?.authType?.replace(/_/g, " ")
1560
+ })
1561
+ }),
1562
+ selectedApi?.authType && /* @__PURE__ */ jsx(Divider, {
1563
+ style: { height: "2rem" },
1564
+ type: "vertical"
1565
+ }),
1566
+ /* @__PURE__ */ jsx(Select, {
1567
+ size: "middle",
1568
+ prefix: /* @__PURE__ */ jsx(Tooltip, {
1569
+ title: "API Version",
1570
+ placement: "bottom",
1571
+ children: /* @__PURE__ */ jsx(InfoCircleOutlined, {})
1572
+ }),
1573
+ value: currentVersion?.apiId,
1574
+ onChange: handleVersionChanged,
1575
+ style: {
1576
+ minWidth: "6.1875rem",
1577
+ width: "max-content",
1578
+ display: "flex",
1579
+ justifyContent: "center",
1580
+ alignContent: "center",
1581
+ alignItems: "center",
1582
+ paddingLeft: "0.5rem",
1583
+ paddingRight: "0.5rem"
1584
+ },
1585
+ placeholder: "Version",
1586
+ options: selectedApi?.relatedVersions?.map((item) => ({
1587
+ label: item.version,
1588
+ value: item.apiId
1589
+ })),
1590
+ showSearch: false
1591
+ }),
1592
+ /* @__PURE__ */ jsx(Divider, {
1593
+ style: { height: "2rem" },
1594
+ type: "vertical"
1595
+ }),
1596
+ /* @__PURE__ */ jsx(Select, {
1597
+ size: "middle",
1598
+ prefix: /* @__PURE__ */ jsx(Tooltip, {
1599
+ title: "URL",
1600
+ placement: "bottom",
1601
+ children: /* @__PURE__ */ jsx(InfoCircleOutlined, {})
1602
+ }),
1603
+ value: selectedApi?.servers?.[0]?.url,
1604
+ onChange: setSelectedUrl,
1605
+ style: {
1606
+ width: "24.75rem",
1607
+ display: "flex",
1608
+ justifyContent: "center",
1609
+ alignContent: "center",
1610
+ alignItems: "center",
1611
+ paddingLeft: "0.5rem"
1612
+ },
1613
+ placeholder: "API URLs",
1614
+ options: selectedApi?.servers?.map((server) => ({
1615
+ label: server?.url,
1616
+ value: server?.url
1617
+ })),
1618
+ showSearch: false
1619
+ }),
1620
+ /* @__PURE__ */ jsx(Button, {
1621
+ color: copying ? "green" : "default",
1622
+ variant: copying ? "filled" : "outlined",
1623
+ icon: /* @__PURE__ */ jsx(copy_default, {}),
1624
+ iconPosition: "end",
1625
+ style: { marginLeft: "0.69rem" },
1626
+ onClick: handleCopyUrl,
1627
+ children: !copying ? "Copy" : "Copied"
1628
+ }),
1629
+ /* @__PURE__ */ jsxs(Radio.Group, {
1630
+ style: {
1631
+ marginLeft: "auto",
1632
+ display: "flex"
1633
+ },
1634
+ optionType: "button",
1635
+ buttonStyle: "outline",
1636
+ defaultValue: viewStyle,
1637
+ onChange: (e) => {
1638
+ setViewStyle(e.target.value);
1639
+ },
1640
+ children: [/* @__PURE__ */ jsx(Radio.Button, {
1641
+ value: "grid",
1642
+ style: {
1643
+ display: "flex",
1644
+ alignItems: "center"
1645
+ },
1646
+ children: /* @__PURE__ */ jsx(grid_default, {})
1647
+ }), /* @__PURE__ */ jsx(Radio.Button, {
1648
+ value: "list",
1649
+ style: {
1650
+ display: "flex",
1651
+ alignItems: "center"
1652
+ },
1653
+ children: /* @__PURE__ */ jsx(list_default, {})
1654
+ })]
1655
+ })
1656
+ ] }),
1657
+ selectedApi?.description && /* @__PURE__ */ jsx(Text, {
1658
+ style: {
1659
+ fontFamily: token$1.fontFamily,
1660
+ fontWeight: 400,
1661
+ fontSize: token$1.fontSizeLG,
1662
+ color: `rgba(0,0,0, 0.45)`
1663
+ },
1664
+ children: selectedApi?.description
1665
+ }),
1666
+ Object.keys(selectedApi?.tags || {}).sort((a, b) => {
1667
+ if (a.toLowerCase() === "default") return 1;
1668
+ if (b.toLowerCase() === "default") return -1;
1669
+ return 0;
1670
+ }).map((key, index) => {
1671
+ if (key.toLowerCase() == "default" && Object.keys(selectedApi?.tags).length <= 1) return /* @__PURE__ */ jsx(APIsRenderer, {
1672
+ apis: selectedApi?.tags[key],
1673
+ tagName: key,
1674
+ withTitle: false
1675
+ });
1676
+ return /* @__PURE__ */ jsx(APIsRenderer, {
1677
+ apis: selectedApi?.tags[key],
1678
+ tagName: key,
1679
+ withTitle: true,
1680
+ haveUnderLine: index < Object.keys(selectedApi?.tags || {}).length - 1
1681
+ });
1682
+ })
1683
+ ]
1684
+ }));
1685
+ };
1686
+
1687
+ //#endregion
1688
+ //#region src/view/components/EndpointPage/EndpointPage.tsx
1689
+ const { Title: Title$1, Paragraph } = Typography;
1690
+ const requestColumns = [
1691
+ {
1692
+ title: "Parameter",
1693
+ dataIndex: "param",
1694
+ key: "param"
1695
+ },
1696
+ {
1697
+ title: "Description",
1698
+ dataIndex: "desc",
1699
+ key: "desc"
1700
+ },
1701
+ {
1702
+ title: "Enum",
1703
+ dataIndex: "enum",
1704
+ key: "enum"
1705
+ }
1706
+ ];
1707
+ const responseColumns = [...requestColumns];
1708
+ const buildRequestData = (params) => params.map((p, index) => ({
1709
+ key: index,
1710
+ param: /* @__PURE__ */ jsxs("span", { children: [
1711
+ p.name,
1712
+ p.schema?.type && /* @__PURE__ */ jsx("span", {
1713
+ style: {
1714
+ color: "rgba(0,0,0,0.45)",
1715
+ marginLeft: "0.25rem",
1716
+ marginRight: "0.25rem"
1717
+ },
1718
+ children: p.schema.type
1719
+ }),
1720
+ p.required ? /* @__PURE__ */ jsx("span", {
1721
+ style: { color: "red" },
1722
+ children: "*"
1723
+ }) : /* @__PURE__ */ jsx("span", {
1724
+ style: { color: "#52C41A" },
1725
+ children: "Optional"
1726
+ })
1727
+ ] }),
1728
+ desc: p.description || "-",
1729
+ enum: p.schema?.enum ? p.schema.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
1730
+ }));
1731
+ const buildHeaderData = (headers) => {
1732
+ if (!headers) return [];
1733
+ return Object.entries(headers).map(([name, header], idx) => ({
1734
+ key: idx,
1735
+ param: /* @__PURE__ */ jsxs("span", { children: [
1736
+ name,
1737
+ header.schema?.type && /* @__PURE__ */ jsx("span", {
1738
+ style: {
1739
+ color: "rgba(0,0,0,0.45)",
1740
+ marginLeft: "0.25rem",
1741
+ marginRight: "0.25rem"
1742
+ },
1743
+ children: header.schema.type
1744
+ }),
1745
+ header.required ? /* @__PURE__ */ jsx("span", {
1746
+ style: { color: "red" },
1747
+ children: "*"
1748
+ }) : /* @__PURE__ */ jsx("span", {
1749
+ style: { color: "#52C41A" },
1750
+ children: "Optional"
1751
+ })
1752
+ ] }),
1753
+ desc: header.description || "-",
1754
+ enum: header.schema?.enum ? header.schema.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
1755
+ }));
1756
+ };
1757
+ const EndpointPage = () => {
1758
+ const { selectedEndpoint, selectedApi, selectedStatusCode, setSelectedNodeKey, setFocusedContent } = store_default(({ view }) => view);
1759
+ const [endpointTooltip, setEndpointTooltip] = useState("Copy endpoint");
1760
+ const [selectedServer, setSelectedServer] = useState(0);
1761
+ const { cx } = useStyle("EndpointPage", (token$1, scope) => ({
1762
+ [scope("container")]: {
1763
+ display: "flex",
1764
+ flexDirection: "column",
1765
+ gap: token$1.marginLG,
1766
+ height: "100%"
1767
+ },
1768
+ [scope("content")]: {
1769
+ width: "100%",
1770
+ height: "100%"
1771
+ },
1772
+ [scope("code")]: {
1773
+ background: "unset",
1774
+ borderRadius: token$1.borderRadius,
1775
+ padding: token$1.paddingSM,
1776
+ fontFamily: "monospace",
1777
+ whiteSpace: "pre-wrap"
1778
+ },
1779
+ [scope("breadcrumb")]: {
1780
+ display: "flex",
1781
+ gap: token$1.marginLG,
1782
+ alignItems: "center",
1783
+ marginBottom: token$1.marginLG
1784
+ }
1785
+ }));
1786
+ const methodStyle = methodColors[selectedEndpoint?.method];
1787
+ const headerParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || []);
1788
+ const pathParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || []);
1789
+ const queryParams = buildRequestData(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || []);
1790
+ const requestTabs = [
1791
+ headerParams.length > 0 ? {
1792
+ key: "header",
1793
+ label: "Header",
1794
+ children: /* @__PURE__ */ jsx(Table, {
1795
+ columns: requestColumns,
1796
+ dataSource: headerParams,
1797
+ pagination: false,
1798
+ bordered: true,
1799
+ size: "small"
1800
+ })
1801
+ } : null,
1802
+ pathParams.length > 0 ? {
1803
+ key: "path",
1804
+ label: "Path",
1805
+ children: /* @__PURE__ */ jsx(Table, {
1806
+ columns: requestColumns,
1807
+ dataSource: pathParams,
1808
+ pagination: false,
1809
+ bordered: true,
1810
+ size: "small"
1811
+ })
1812
+ } : null,
1813
+ queryParams.length > 0 ? {
1814
+ key: "query",
1815
+ label: "Query",
1816
+ children: /* @__PURE__ */ jsx(Table, {
1817
+ columns: requestColumns,
1818
+ dataSource: queryParams,
1819
+ pagination: false,
1820
+ bordered: true,
1821
+ size: "small"
1822
+ })
1823
+ } : null
1824
+ ].filter((t) => t !== null);
1825
+ const responseObj = selectedEndpoint?.responses?.[selectedStatusCode || 200];
1826
+ const responseHeaders = responseObj?.headers;
1827
+ const responseHeaderData = buildHeaderData(responseHeaders);
1828
+ const serverOptions = selectedApi?.servers?.map((server, index) => ({
1829
+ value: index,
1830
+ label: `${server.url}${selectedEndpoint?.path || ""}`
1831
+ })) || [];
1832
+ const getFullEndpointUrl = () => {
1833
+ if (!selectedApi?.servers || !selectedApi.servers[selectedServer]) return "";
1834
+ const server = selectedApi.servers[selectedServer];
1835
+ return `${server.url}${selectedEndpoint?.path || ""}`;
1836
+ };
1837
+ return /* @__PURE__ */ jsx(AntdRegistry, { children: /* @__PURE__ */ jsx("div", {
1838
+ className: cx("container"),
1839
+ children: /* @__PURE__ */ jsxs("div", {
1840
+ className: cx("content"),
1841
+ children: [
1842
+ /* @__PURE__ */ jsxs("div", {
1843
+ className: cx("breadcrumb"),
1844
+ children: [/* @__PURE__ */ jsx(Button, {
1845
+ color: "default",
1846
+ variant: "outlined",
1847
+ icon: /* @__PURE__ */ jsx(LeftOutlined, {}),
1848
+ onClick: (e) => {
1849
+ e.preventDefault();
1850
+ setSelectedNodeKey(selectedApi?.id);
1851
+ setFocusedContent("API");
1852
+ }
1853
+ }), /* @__PURE__ */ jsx(Breadcrumb, { items: [
1854
+ {
1855
+ href: "",
1856
+ title: /* @__PURE__ */ jsx("span", { children: selectedApi?.title || "API Name" }),
1857
+ onClick: (e) => {
1858
+ e.preventDefault();
1859
+ setSelectedNodeKey(selectedApi?.id);
1860
+ setFocusedContent("API");
1861
+ }
1862
+ },
1863
+ { title: /* @__PURE__ */ jsx("p", {
1864
+ style: {
1865
+ display: "flex",
1866
+ flexDirection: "row",
1867
+ alignItems: "center",
1868
+ color: "rgba(0,0,0,0.45)",
1869
+ gap: "0.25rem"
1870
+ },
1871
+ children: /* @__PURE__ */ jsx("span", { children: selectedEndpoint?.tagName || "default" })
1872
+ }) },
1873
+ { title: /* @__PURE__ */ jsx("span", { children: selectedEndpoint?.summary || "Endpoint Name" }) }
1874
+ ] })]
1875
+ }),
1876
+ /* @__PURE__ */ jsx(Title$1, {
1877
+ level: 3,
1878
+ children: selectedEndpoint?.summary
1879
+ }),
1880
+ /* @__PURE__ */ jsx(Paragraph, { children: /* @__PURE__ */ jsxs("div", {
1881
+ style: {
1882
+ display: "flex",
1883
+ alignItems: "center",
1884
+ gap: 8
1885
+ },
1886
+ children: [/* @__PURE__ */ jsx(Select, {
1887
+ value: selectedServer,
1888
+ style: { width: "100%" },
1889
+ onChange: (value) => setSelectedServer(value),
1890
+ prefix: /* @__PURE__ */ jsx(Tag, {
1891
+ style: {
1892
+ backgroundColor: methodStyle?.bg,
1893
+ color: methodStyle?.color,
1894
+ border: "none"
1895
+ },
1896
+ children: selectedEndpoint?.method
1897
+ }),
1898
+ options: serverOptions
1899
+ }), /* @__PURE__ */ jsx(Tooltip, {
1900
+ title: endpointTooltip,
1901
+ children: /* @__PURE__ */ jsx(Button, {
1902
+ color: "default",
1903
+ variant: "outlined",
1904
+ onClick: () => {
1905
+ const fullUrl = getFullEndpointUrl();
1906
+ if (fullUrl) {
1907
+ navigator.clipboard.writeText(fullUrl);
1908
+ setEndpointTooltip("Copied!");
1909
+ setTimeout(() => setEndpointTooltip("Copy endpoint"), 1500);
1910
+ }
1911
+ },
1912
+ icon: /* @__PURE__ */ jsx(copy_default, {})
1913
+ })
1914
+ })]
1915
+ }) }),
1916
+ /* @__PURE__ */ jsx(Paragraph, {
1917
+ style: {
1918
+ color: "rgba(0,0,0,0.45)",
1919
+ marginBottom: "1.5rem"
1920
+ },
1921
+ children: selectedEndpoint?.description
1922
+ }),
1923
+ requestTabs.length > 0 && /* @__PURE__ */ jsx(Card, {
1924
+ title: "Request",
1925
+ style: { marginBottom: "1.5rem" },
1926
+ children: /* @__PURE__ */ jsx(Tabs, {
1927
+ defaultActiveKey: requestTabs[0].key,
1928
+ items: requestTabs
1929
+ })
1930
+ }),
1931
+ responseHeaderData.length > 0 && /* @__PURE__ */ jsx(Card, {
1932
+ title: "Response",
1933
+ extra: /* @__PURE__ */ jsxs(Tag, { children: [/* @__PURE__ */ jsx("span", { style: {
1934
+ background: handleStatusColor(selectedStatusCode),
1935
+ borderRadius: "50%",
1936
+ display: "inline-block",
1937
+ width: "0.5rem",
1938
+ height: "0.5rem",
1939
+ marginRight: "0.5rem"
1940
+ } }), /* @__PURE__ */ jsx("span", { children: selectedStatusCode })] }),
1941
+ children: responseHeaderData.length > 0 && /* @__PURE__ */ jsx(Table, {
1942
+ columns: responseColumns,
1943
+ dataSource: responseHeaderData,
1944
+ pagination: false,
1945
+ bordered: true,
1946
+ size: "small"
1947
+ })
1948
+ })
1949
+ ]
1950
+ })
1951
+ }) });
1952
+ };
1953
+
1954
+ //#endregion
1955
+ //#region src/assets/NoData.svg
1956
+ var _path, _path2, _path3, _path4, _path5, _path6, _path7, _path8, _path9, _path0, _path1, _path10, _path11, _path12, _path13, _path14, _path15, _path16;
1957
+ function _extends() {
1958
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
1959
+ for (var e = 1; e < arguments.length; e++) {
1960
+ var t = arguments[e];
1961
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1962
+ }
1963
+ return n;
1964
+ }, _extends.apply(null, arguments);
1965
+ }
1966
+ var SvgNoData = function SvgNoData$1(props) {
1967
+ return /* @__PURE__ */ React.createElement("svg", _extends({
1968
+ xmlns: "http://www.w3.org/2000/svg",
1969
+ width: 298,
1970
+ height: 237,
1971
+ fill: "none"
1972
+ }, props), _path || (_path = /* @__PURE__ */ React.createElement("path", {
1973
+ fill: "#F1F5FD",
1974
+ 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"
1975
+ })), _path2 || (_path2 = /* @__PURE__ */ React.createElement("path", {
1976
+ stroke: "#E0E9F9",
1977
+ strokeLinecap: "round",
1978
+ strokeLinejoin: "round",
1979
+ strokeWidth: .85,
1980
+ d: "M84.74 1v9.457M80.016 5.729h9.448M263.987 189.496v9.457M259.264 194.225h9.448"
1981
+ })), _path3 || (_path3 = /* @__PURE__ */ React.createElement("path", {
1982
+ fill: "#E0E9F9",
1983
+ 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"
1984
+ })), _path4 || (_path4 = /* @__PURE__ */ React.createElement("path", {
1985
+ fill: "#F1F5FD",
1986
+ 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"
1987
+ })), _path5 || (_path5 = /* @__PURE__ */ React.createElement("path", {
1988
+ fill: "#fff",
1989
+ stroke: "#769DE4",
1990
+ strokeLinecap: "round",
1991
+ strokeLinejoin: "round",
1992
+ 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"
1993
+ })), _path6 || (_path6 = /* @__PURE__ */ React.createElement("path", {
1994
+ fill: "#F1F5FD",
1995
+ d: "M202.465 94.645H81.707v94.831h120.758z"
1996
+ })), _path7 || (_path7 = /* @__PURE__ */ React.createElement("path", {
1997
+ fill: "#fff",
1998
+ stroke: "#769DE4",
1999
+ strokeLinecap: "round",
2000
+ strokeLinejoin: "round",
2001
+ 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"
2002
+ })), _path8 || (_path8 = /* @__PURE__ */ React.createElement("path", {
2003
+ fill: "#F1F5FD",
2004
+ 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"
2005
+ })), _path9 || (_path9 = /* @__PURE__ */ React.createElement("path", {
2006
+ fill: "#fff",
2007
+ stroke: "#769DE4",
2008
+ strokeLinecap: "round",
2009
+ strokeLinejoin: "round",
2010
+ 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"
2011
+ })), _path0 || (_path0 = /* @__PURE__ */ React.createElement("path", {
2012
+ fill: "#F1F5FD",
2013
+ 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"
2014
+ })), _path1 || (_path1 = /* @__PURE__ */ React.createElement("path", {
2015
+ fill: "#fff",
2016
+ stroke: "#769DE4",
2017
+ strokeLinecap: "round",
2018
+ strokeLinejoin: "round",
2019
+ 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"
2020
+ })), _path10 || (_path10 = /* @__PURE__ */ React.createElement("path", {
2021
+ fill: "#F1F5FD",
2022
+ 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"
2023
+ })), _path11 || (_path11 = /* @__PURE__ */ React.createElement("path", {
2024
+ fill: "#fff",
2025
+ stroke: "#769DE4",
2026
+ strokeLinecap: "round",
2027
+ strokeLinejoin: "round",
2028
+ 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"
2029
+ })), _path12 || (_path12 = /* @__PURE__ */ React.createElement("path", {
2030
+ fill: "#fff",
2031
+ stroke: "#769DE4",
2032
+ strokeLinecap: "round",
2033
+ strokeLinejoin: "round",
2034
+ 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"
2035
+ })), _path13 || (_path13 = /* @__PURE__ */ React.createElement("path", {
2036
+ fill: "#fff",
2037
+ d: "M199.385 59.32c.552 1.15 28.132 28.181 28.132 28.181z"
2038
+ })), _path14 || (_path14 = /* @__PURE__ */ React.createElement("path", {
2039
+ stroke: "#769DE4",
2040
+ strokeLinecap: "round",
2041
+ strokeLinejoin: "round",
2042
+ d: "M199.385 59.32c.552 1.15 28.132 28.181 28.132 28.181"
2043
+ })), _path15 || (_path15 = /* @__PURE__ */ React.createElement("path", {
2044
+ fill: "#fff",
2045
+ d: "M227.517 59.32c-.574 1.15-28.132 28.181-28.132 28.181z"
2046
+ })), _path16 || (_path16 = /* @__PURE__ */ React.createElement("path", {
2047
+ stroke: "#769DE4",
2048
+ strokeLinecap: "round",
2049
+ strokeLinejoin: "round",
2050
+ d: "M227.517 59.32c-.574 1.15-28.132 28.181-28.132 28.181"
2051
+ })));
2052
+ };
2053
+ var NoData_default = SvgNoData;
1015
2054
 
1016
2055
  //#endregion
1017
2056
  //#region src/view/components/MainContent.tsx
1018
2057
  const MainContent = () => {
1019
- const { wrapSSR, cx } = useStyle("MainContent", (token$1, scope) => ({ [scope("container")]: {
1020
- backgroundColor: token$1.colorBgContainer,
1021
- height: "100%",
1022
- width: "100%",
1023
- maxHeight: "100%",
1024
- overflow: "auto",
1025
- borderRadius: token$1.borderRadius,
1026
- padding: token$1.paddingXL
1027
- } }));
1028
- return wrapSSR(/* @__PURE__ */ jsx("div", { className: cx("container") }));
2058
+ const { focusedContent, transformedData } = store_default(({ view }) => view);
2059
+ const { wrapSSR, cx } = useStyle("MainContent", (token$1, scope) => ({
2060
+ [scope("container")]: {
2061
+ backgroundColor: token$1.colorBgContainer,
2062
+ height: "100%",
2063
+ width: "100%",
2064
+ maxHeight: "100%",
2065
+ overflow: "auto",
2066
+ borderRadius: token$1.borderRadius,
2067
+ padding: token$1.paddingXL
2068
+ },
2069
+ [scope("centered")]: {
2070
+ display: "flex",
2071
+ justifyContent: "center"
2072
+ },
2073
+ [scope("no-space")]: {
2074
+ margin: 0,
2075
+ padding: 0
2076
+ },
2077
+ [scope("title")]: {
2078
+ fontFamily: token$1.fontFamily,
2079
+ fontWeight: 600,
2080
+ fontSize: token$1.fontSizeHeading4,
2081
+ color: "rgba(0, 0, 0, 0.88)"
2082
+ },
2083
+ [scope("text")]: {
2084
+ color: "rgba(0, 0, 0, 0.88)",
2085
+ fontFamily: token$1.fontFamily
2086
+ }
2087
+ }));
2088
+ return wrapSSR(/* @__PURE__ */ jsx("div", {
2089
+ className: cx("container", !transformedData?.length ? "centered" : ""),
2090
+ children: !transformedData?.length ? /* @__PURE__ */ jsxs(Flex, {
2091
+ justify: "center",
2092
+ align: "center",
2093
+ gap: "1.5rem",
2094
+ vertical: true,
2095
+ flex: 1,
2096
+ children: [/* @__PURE__ */ jsx(NoData_default, {
2097
+ width: "18.625rem",
2098
+ height: "14.75rem"
2099
+ }), /* @__PURE__ */ jsxs(Flex, {
2100
+ justify: "center",
2101
+ align: "center",
2102
+ gap: "0.5rem",
2103
+ vertical: true,
2104
+ children: [/* @__PURE__ */ jsx(Title, {
2105
+ className: cx("no-space", "title"),
2106
+ level: 4,
2107
+ children: "No API Documentation Found"
2108
+ }), /* @__PURE__ */ jsx(Text, {
2109
+ className: cx("no-space", "text"),
2110
+ children: "No API Documentation has been added yet. Contact admin for support"
2111
+ })]
2112
+ })]
2113
+ }) : focusedContent === "ENDPOINT" ? /* @__PURE__ */ jsx(EndpointPage, {}) : /* @__PURE__ */ jsx(APIPage, {})
2114
+ }));
1029
2115
  };
1030
2116
 
1031
2117
  //#endregion
@@ -1034,6 +2120,12 @@ const transformOpenApiToDocs = (api) => {
1034
2120
  const groupedPathsByTags = { default: [] };
1035
2121
  const validTags = new Set(api?.tags?.map(({ name }) => name) || []);
1036
2122
  const contextPath = Object.keys(api.paths)[0];
2123
+ const relatedVersions = "x-related-versions" in api ? Object.entries(api["x-related-versions"]).map(([apiId, version]) => ({
2124
+ apiId,
2125
+ version
2126
+ })) : [];
2127
+ const currentVersion = "x-current-version" in api ? api["x-current-version"] : "";
2128
+ const authType = "x-auth-type" in api ? api["x-auth-type"] : "";
1037
2129
  for (const [path, methods] of Object.entries(api.paths)) for (const [method, methodData] of Object.entries(methods)) {
1038
2130
  const entry = {
1039
2131
  ...methodData,
@@ -1059,20 +2151,193 @@ const transformOpenApiToDocs = (api) => {
1059
2151
  id: `api-${nanoid(8)}`,
1060
2152
  contextPath,
1061
2153
  tags: groupedPathsByTags,
1062
- servers: api.servers
2154
+ servers: api.servers,
2155
+ relatedVersions,
2156
+ currentVersion,
2157
+ authType
1063
2158
  };
1064
2159
  };
1065
2160
 
2161
+ //#endregion
2162
+ //#region src/view/components/EndpointPage/Codebox/Codebox.tsx
2163
+ Light.registerLanguage("json", json);
2164
+ const Codebox = ({ code }) => {
2165
+ const [theme$1, setTheme] = useState("DARK");
2166
+ return /* @__PURE__ */ jsxs("div", {
2167
+ className: "codebox",
2168
+ children: [/* @__PURE__ */ jsxs("div", {
2169
+ className: "codebox_header",
2170
+ children: [/* @__PURE__ */ jsx("div", {
2171
+ role: "button",
2172
+ tabIndex: -1,
2173
+ onClick: () => theme$1 !== "LIGHT" && setTheme("LIGHT"),
2174
+ className: "codebox_header_themeToggle codebox_header_themeToggle_light",
2175
+ title: "Light theme"
2176
+ }), /* @__PURE__ */ jsx("div", {
2177
+ role: "button",
2178
+ tabIndex: -1,
2179
+ onClick: () => theme$1 !== "DARK" && setTheme("DARK"),
2180
+ className: "codebox_header_themeToggle codebox_header_themeToggle_dark",
2181
+ title: "Dark theme"
2182
+ })]
2183
+ }), /* @__PURE__ */ jsx(Light, {
2184
+ language: "json",
2185
+ style: theme$1 === "LIGHT" ? hljs.stackoverflowLight : hljs.stackoverflowDark,
2186
+ showLineNumbers: true,
2187
+ wrapLines: true,
2188
+ customStyle: {
2189
+ margin: 0,
2190
+ minHeight: "3rem",
2191
+ overflowY: "auto",
2192
+ padding: "0.75rem 1rem 0.75rem 1.5rem",
2193
+ backgroundColor: theme$1 === "DARK" ? "#20264B" : "#20264B",
2194
+ fontSize: "0.75rem"
2195
+ },
2196
+ lineProps: { className: "custom-code-line" },
2197
+ children: code
2198
+ })]
2199
+ });
2200
+ };
2201
+ var Codebox_default = Codebox;
2202
+
2203
+ //#endregion
2204
+ //#region src/view/components/CodeboxSidebar.tsx
2205
+ function CodeboxSidebar() {
2206
+ const { selectedEndpoint, selectedStatusCode, statusCodeOptions, setSelectedStatusCode } = store_default(({ view }) => view);
2207
+ const httpStatusOptions = useMemo(() => statusCodeOptions.map((code) => ({
2208
+ value: code,
2209
+ label: /* @__PURE__ */ jsx("span", { children: code })
2210
+ })), [statusCodeOptions]);
2211
+ const [requestTooltip, setRequestTooltip] = useState("Copy Request");
2212
+ const { cx } = useStyle("CodeboxSidebar", (token$1, scope) => ({
2213
+ [scope("container")]: {
2214
+ display: "flex",
2215
+ flexDirection: "column",
2216
+ gap: token$1.marginMD,
2217
+ background: token$1.colorBgContainer,
2218
+ borderRadius: token$1.borderRadiusLG,
2219
+ padding: token$1.paddingLG,
2220
+ overflow: "hidden",
2221
+ height: "100%",
2222
+ width: "23.625rem",
2223
+ minWidth: "23.625rem",
2224
+ ".ant-card-body": { padding: 0 },
2225
+ ".ant-card-head-title": { color: "white" },
2226
+ ".ant-card-head": { borderBottom: "2px solid #33419A" }
2227
+ },
2228
+ [scope("rightCard")]: {
2229
+ flex: "0 1 auto",
2230
+ maxHeight: "50%",
2231
+ overflowY: "auto",
2232
+ backgroundColor: "#20264B"
2233
+ },
2234
+ [scope("rightCardFlex")]: {
2235
+ overflowY: "auto",
2236
+ backgroundColor: "#20264B"
2237
+ },
2238
+ [scope("customSelect")]: {
2239
+ ".ant-select-selector": {
2240
+ backgroundColor: `${token["brnadColor.9"]} `,
2241
+ borderColor: `${token["brnadColor.9"]}`,
2242
+ borderRadius: "6px",
2243
+ color: "white"
2244
+ },
2245
+ ".ant-select-selection-item": { color: "white" },
2246
+ ".ant-select-selection-placeholder": { color: "rgba(255, 255, 255, 0.65)" },
2247
+ ".ant-select-arrow": { color: "white" },
2248
+ "&:hover .ant-select-selector": {
2249
+ borderColor: `${token["brnadColor.7"]}`,
2250
+ color: "white"
2251
+ },
2252
+ "&:focus .ant-select-selector, &.ant-select-focused .ant-select-selector": {
2253
+ borderColor: `${token["brnadColor.7"]}`,
2254
+ color: "white"
2255
+ }
2256
+ }
2257
+ }));
2258
+ return /* @__PURE__ */ jsxs("div", {
2259
+ className: cx("container"),
2260
+ children: [selectedEndpoint?.requestBody && /* @__PURE__ */ jsx(Card, {
2261
+ title: "Request",
2262
+ variant: "borderless",
2263
+ className: cx("rightCard"),
2264
+ extra: /* @__PURE__ */ jsx(Tooltip, {
2265
+ title: requestTooltip,
2266
+ children: /* @__PURE__ */ jsx(Button, {
2267
+ color: "default",
2268
+ variant: "link",
2269
+ onClick: () => {
2270
+ if (selectedEndpoint?.requestBody) {
2271
+ navigator.clipboard.writeText(JSON.stringify(selectedEndpoint.requestBody, null, 2));
2272
+ setRequestTooltip("Copied!");
2273
+ setTimeout(() => setRequestTooltip("Copy Request"), 1500);
2274
+ }
2275
+ },
2276
+ icon: /* @__PURE__ */ jsx(CopyOutlined, { style: { color: "white" } })
2277
+ })
2278
+ }),
2279
+ style: {
2280
+ padding: 0,
2281
+ border: "none"
2282
+ },
2283
+ children: /* @__PURE__ */ jsx(Codebox_default, { code: JSON.stringify(selectedEndpoint?.requestBody, null, 2) || "" })
2284
+ }), selectedEndpoint?.responses && /* @__PURE__ */ jsx(Card, {
2285
+ title: "Response",
2286
+ variant: "borderless",
2287
+ className: cx("rightCardFlex"),
2288
+ extra: /* @__PURE__ */ jsx(Select, {
2289
+ defaultActiveFirstOption: true,
2290
+ defaultValue: 200,
2291
+ className: cx("customSelect"),
2292
+ style: { width: "100%" },
2293
+ value: selectedStatusCode,
2294
+ onChange: setSelectedStatusCode,
2295
+ prefix: /* @__PURE__ */ jsx("span", { style: {
2296
+ background: handleStatusColor(selectedStatusCode),
2297
+ borderRadius: "50%",
2298
+ display: "inline-block",
2299
+ width: "0.5rem",
2300
+ height: "0.5rem",
2301
+ marginRight: "0.5rem"
2302
+ } }),
2303
+ options: httpStatusOptions
2304
+ }),
2305
+ children: /* @__PURE__ */ jsx(Codebox_default, { code: JSON.stringify(selectedEndpoint?.responses[selectedStatusCode], null, 2) || "" })
2306
+ })]
2307
+ });
2308
+ }
2309
+ var CodeboxSidebar_default = CodeboxSidebar;
2310
+
1066
2311
  //#endregion
1067
2312
  //#region src/view/layout.tsx
1068
2313
  const DocumentationLayout = ({ data }) => {
1069
- const { setOriginalData } = store_default(({ view }) => view);
1070
- const { setTransformedData } = store_default(({ view }) => view);
2314
+ const { focusedContent, selectedNodeKey, selectedApi, builtTreeData, setOriginalData, setTransformedData, setBuiltTreeData } = store_default(({ view }) => view);
2315
+ const { selectFirstApi } = useNodeSelection();
2316
+ const hasInitializedRef = useRef(false);
1071
2317
  useEffect(() => {
1072
2318
  setOriginalData(data);
1073
- const transformedData = data.map(transformOpenApiToDocs);
2319
+ const transformedData = data.map(transformOpenApiToDocs).sort((a, b) => a.title.localeCompare(b.title));
1074
2320
  setTransformedData(transformedData);
1075
- }, [data]);
2321
+ const builtTree = buildTreeDataStructure(transformedData);
2322
+ setBuiltTreeData(builtTree);
2323
+ hasInitializedRef.current = false;
2324
+ }, [
2325
+ data,
2326
+ setOriginalData,
2327
+ setTransformedData,
2328
+ setBuiltTreeData
2329
+ ]);
2330
+ useEffect(() => {
2331
+ if (builtTreeData && builtTreeData.length > 0 && !selectedNodeKey && !selectedApi && !hasInitializedRef.current) {
2332
+ selectFirstApi(builtTreeData);
2333
+ hasInitializedRef.current = true;
2334
+ }
2335
+ }, [
2336
+ builtTreeData,
2337
+ selectedNodeKey,
2338
+ selectedApi,
2339
+ selectFirstApi
2340
+ ]);
1076
2341
  const { cx } = useStyle("DocumentationLayout", (token$1, scope) => ({
1077
2342
  [scope("container")]: {
1078
2343
  display: "flex",
@@ -1087,14 +2352,19 @@ const DocumentationLayout = ({ data }) => {
1087
2352
  height: "100%",
1088
2353
  maxHeight: "100%",
1089
2354
  overflow: "hidden",
1090
- gap: token$1.marginLG
2355
+ gap: token$1.marginLG,
2356
+ width: "100%"
1091
2357
  }
1092
2358
  }));
1093
2359
  return /* @__PURE__ */ jsx(AntdRegistry, { children: /* @__PURE__ */ jsxs("div", {
1094
2360
  className: cx("container"),
1095
2361
  children: [/* @__PURE__ */ jsx(Header, {}), /* @__PURE__ */ jsxs("div", {
1096
2362
  className: cx("layout"),
1097
- children: [/* @__PURE__ */ jsx(Sidebar, {}), /* @__PURE__ */ jsx(MainContent, {})]
2363
+ children: [
2364
+ /* @__PURE__ */ jsx(Sidebar, {}),
2365
+ /* @__PURE__ */ jsx(MainContent, {}),
2366
+ focusedContent === "ENDPOINT" && /* @__PURE__ */ jsx(CodeboxSidebar_default, {})
2367
+ ]
1098
2368
  })]
1099
2369
  }) });
1100
2370
  };