@digi-frontend/dgate-api-documentation 4.0.4 → 4.0.7

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.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import { create } from "zustand";
2
2
  import { devtools } from "zustand/middleware";
3
3
  import { immer } from "zustand/middleware/immer";
4
- import { useEffect, useMemo, useRef, useState } from "react";
5
- import { Alert, Breadcrumb, Button, Card, Col, Divider, Drawer, Empty, Flex, Form, Grid, Input, Modal, Pagination, Row, Select, Switch, Table, Tabs, Tag, Tooltip, Tree, Typography, message, theme } from "antd";
4
+ import { useEffect, useId, useMemo, useRef, useState } from "react";
5
+ import { Alert, Breadcrumb, Button, Card, Col, Divider, Drawer, Empty, Flex, Form, Grid, Input, Menu, Modal, Pagination, Row, Select, Switch, Table, Tabs, Tag, Tooltip, Tree, Typography, message, theme } from "antd";
6
6
  import { useStyleRegister } from "@ant-design/cssinjs";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
8
  import Text from "antd/es/typography/Text.js";
9
- import { AppstoreOutlined, BarsOutlined, CheckCircleOutlined, DownOutlined, EditOutlined, ExclamationCircleFilled, EyeOutlined, InfoCircleOutlined, LeftOutlined, MinusSquareOutlined, PlusOutlined, PlusSquareOutlined, RightOutlined, SafetyOutlined, SearchOutlined, UpCircleOutlined } from "@ant-design/icons";
9
+ import { AppstoreOutlined, BarsOutlined, CheckCircleOutlined, CloseCircleOutlined, DownOutlined, EditOutlined, ExclamationCircleFilled, ExclamationCircleOutlined, EyeOutlined, InfoCircleOutlined, LeftOutlined, MinusSquareOutlined, PlusOutlined, PlusSquareOutlined, RightOutlined, SafetyOutlined, SearchOutlined, TagOutlined, UpCircleOutlined } from "@ant-design/icons";
10
10
  import { Resizable } from "re-resizable";
11
11
  import Title from "antd/es/typography/Title.js";
12
12
  import { Light } from "react-syntax-highlighter";
@@ -1069,8 +1069,8 @@ const Sidebar$1 = ({ searchValue, setSearchValue }) => {
1069
1069
  };
1070
1070
  return wrapSSR(/* @__PURE__ */ jsx(Resizable, {
1071
1071
  as: "aside",
1072
- minWidth: 300,
1073
- maxWidth: 386,
1072
+ minWidth: 240,
1073
+ maxWidth: 240,
1074
1074
  enable: {
1075
1075
  top: false,
1076
1076
  right: true,
@@ -1082,7 +1082,7 @@ const Sidebar$1 = ({ searchValue, setSearchValue }) => {
1082
1082
  topLeft: false
1083
1083
  },
1084
1084
  defaultSize: {
1085
- width: 333,
1085
+ width: 240,
1086
1086
  height: "100%"
1087
1087
  },
1088
1088
  className: cx("sider"),
@@ -1732,7 +1732,7 @@ const requestColumns$1 = [
1732
1732
  }
1733
1733
  ];
1734
1734
  const responseColumns$1 = [...requestColumns$1];
1735
- const buildRequestData$1 = (params) => [...params].sort((a, b) => a.required === b.required ? 0 : a.required ? -1 : 1).map((p, index) => {
1735
+ const buildRequestData$1 = (params, colors) => [...params].sort((a, b) => a.required === b.required ? 0 : a.required ? -1 : 1).map((p, index) => {
1736
1736
  let typeLabel = p.schema?.type;
1737
1737
  if (p.schema?.type === "array" && p.schema?.items?.type) typeLabel = `${p.schema.type}_${p.schema.items.type}`;
1738
1738
  return {
@@ -1741,17 +1741,17 @@ const buildRequestData$1 = (params) => [...params].sort((a, b) => a.required ===
1741
1741
  p.name,
1742
1742
  typeLabel && /* @__PURE__ */ jsx("span", {
1743
1743
  style: {
1744
- color: "rgba(0,0,0,0.45)",
1744
+ color: colors.typeLabel,
1745
1745
  marginLeft: "0.25rem",
1746
1746
  marginRight: "0.25rem"
1747
1747
  },
1748
1748
  children: typeLabel
1749
1749
  }),
1750
1750
  p.required ? /* @__PURE__ */ jsx("span", {
1751
- style: { color: "red" },
1751
+ style: { color: colors.required },
1752
1752
  children: "*"
1753
1753
  }) : /* @__PURE__ */ jsx("span", {
1754
- style: { color: "#52C41A" },
1754
+ style: { color: colors.optional },
1755
1755
  children: "Optional"
1756
1756
  })
1757
1757
  ] }),
@@ -1759,7 +1759,7 @@ const buildRequestData$1 = (params) => [...params].sort((a, b) => a.required ===
1759
1759
  enum: p.schema?.enum ? p.schema.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
1760
1760
  };
1761
1761
  });
1762
- const buildHeaderData$1 = (headers) => {
1762
+ const buildHeaderData$1 = (headers, colors) => {
1763
1763
  if (!headers) return [];
1764
1764
  return Object.entries(headers).sort(([, a], [, b]) => a.required === b.required ? 0 : a.required ? -1 : 1).map(([name, header], idx) => {
1765
1765
  let typeLabel = header.schema?.type;
@@ -1770,17 +1770,17 @@ const buildHeaderData$1 = (headers) => {
1770
1770
  name,
1771
1771
  typeLabel && /* @__PURE__ */ jsx("span", {
1772
1772
  style: {
1773
- color: "rgba(0,0,0,0.45)",
1773
+ color: colors.typeLabel,
1774
1774
  marginLeft: "0.25rem",
1775
1775
  marginRight: "0.25rem"
1776
1776
  },
1777
1777
  children: typeLabel
1778
1778
  }),
1779
1779
  header.required ? /* @__PURE__ */ jsx("span", {
1780
- style: { color: "red" },
1780
+ style: { color: colors.required },
1781
1781
  children: "*"
1782
1782
  }) : /* @__PURE__ */ jsx("span", {
1783
- style: { color: "#52C41A" },
1783
+ style: { color: colors.optional },
1784
1784
  children: "Optional"
1785
1785
  })
1786
1786
  ] }, idx),
@@ -1793,7 +1793,7 @@ const EndpointPage$1 = () => {
1793
1793
  const { selectedEndpoint, selectedApi, selectedStatusCode, setSelectedNodeKey, setFocusedContent, setFocusedTag } = useStore(({ view }) => view);
1794
1794
  const [endpointTooltip, setEndpointTooltip] = useState("Copy endpoint");
1795
1795
  const [selectedServer, setSelectedServer] = useState(0);
1796
- const { cx } = useStyle("EndpointPage", (token, scope) => ({
1796
+ const { cx, token } = useStyle("EndpointPage", (token, scope) => ({
1797
1797
  [scope("docs-endpoint-container")]: {
1798
1798
  display: "flex",
1799
1799
  flexDirection: "column",
@@ -1823,12 +1823,19 @@ const EndpointPage$1 = () => {
1823
1823
  padding: "0px 0.75rem 0.75rem 0.75rem",
1824
1824
  ".ant-tabs-tab": { paddingTop: "0" }
1825
1825
  }
1826
- }
1826
+ },
1827
+ [scope("row-odd")]: { "& > td": { background: `${token.colorBgLayout} !important` } },
1828
+ [scope("row-even")]: { "& > td": { background: `${token.colorBgContainer} !important` } }
1827
1829
  }));
1828
1830
  const methodStyle = methodColors$1[selectedEndpoint?.method];
1829
- const headerParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || []);
1830
- const pathParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || []);
1831
- const queryParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || []);
1831
+ const paramColors = {
1832
+ typeLabel: token.colorTextQuaternary,
1833
+ required: token.colorError,
1834
+ optional: token.colorSuccess
1835
+ };
1836
+ const headerParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || [], paramColors);
1837
+ const pathParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || [], paramColors);
1838
+ const queryParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || [], paramColors);
1832
1839
  const requestTabs = [
1833
1840
  {
1834
1841
  key: "header",
@@ -1838,7 +1845,8 @@ const EndpointPage$1 = () => {
1838
1845
  dataSource: headerParams,
1839
1846
  pagination: false,
1840
1847
  bordered: true,
1841
- size: "small"
1848
+ size: "small",
1849
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-odd" : "row-even")
1842
1850
  })
1843
1851
  },
1844
1852
  {
@@ -1849,7 +1857,8 @@ const EndpointPage$1 = () => {
1849
1857
  dataSource: pathParams,
1850
1858
  pagination: false,
1851
1859
  bordered: true,
1852
- size: "small"
1860
+ size: "small",
1861
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-odd" : "row-even")
1853
1862
  })
1854
1863
  },
1855
1864
  {
@@ -1860,12 +1869,13 @@ const EndpointPage$1 = () => {
1860
1869
  dataSource: queryParams,
1861
1870
  pagination: false,
1862
1871
  bordered: true,
1863
- size: "small"
1872
+ size: "small",
1873
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-odd" : "row-even")
1864
1874
  })
1865
1875
  }
1866
1876
  ].filter((t) => t !== null);
1867
1877
  const responseHeaders = (selectedEndpoint?.responses?.[selectedStatusCode || 200])?.headers;
1868
- const responseHeaderData = buildHeaderData$1(responseHeaders);
1878
+ const responseHeaderData = buildHeaderData$1(responseHeaders, paramColors);
1869
1879
  selectedApi?.servers?.map((server, index) => ({
1870
1880
  value: index,
1871
1881
  label: `${server.url}${selectedEndpoint?.path || ""}`
@@ -1909,7 +1919,7 @@ const EndpointPage$1 = () => {
1909
1919
  display: "flex",
1910
1920
  flexDirection: "row",
1911
1921
  alignItems: "center",
1912
- color: "rgba(0,0,0,0.45)",
1922
+ color: token.colorTextQuaternary,
1913
1923
  gap: "0.25rem"
1914
1924
  },
1915
1925
  children: /* @__PURE__ */ jsx("span", { children: selectedEndpoint?.tagName || "default" })
@@ -1974,7 +1984,8 @@ const EndpointPage$1 = () => {
1974
1984
  dataSource: responseHeaderData,
1975
1985
  pagination: false,
1976
1986
  bordered: true,
1977
- size: "small"
1987
+ size: "small",
1988
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-odd" : "row-even")
1978
1989
  })
1979
1990
  })
1980
1991
  ]
@@ -2099,7 +2110,7 @@ const MainContent$1 = ({ searchEnabled, handleResetSearch, handleVisitLandingPag
2099
2110
  //#region src/view/components/ApiPage/components/ApiDocumentationBar.tsx
2100
2111
  const { useBreakpoint: useBreakpoint$4 } = Grid;
2101
2112
  const { Title: Title$2 } = Typography;
2102
- const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, hasChanges = false, switcherNode }) => {
2113
+ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, hasChanges = false, hasErrors = false, switcherNode }) => {
2103
2114
  const isMobile = !useBreakpoint$4().md;
2104
2115
  const { wrapSSR, cx, token } = useStyle("ApiDocumentationBar", (token, scope) => ({
2105
2116
  [scope("root")]: {
@@ -2235,7 +2246,7 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
2235
2246
  }), /* @__PURE__ */ jsx(Button, {
2236
2247
  size: "large",
2237
2248
  type: "primary",
2238
- disabled: !hasChanges,
2249
+ disabled: !hasChanges || hasErrors,
2239
2250
  onClick: onSave,
2240
2251
  children: "Save"
2241
2252
  })]
@@ -2293,7 +2304,7 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
2293
2304
  }), /* @__PURE__ */ jsx(Button, {
2294
2305
  size: "large",
2295
2306
  type: "primary",
2296
- disabled: !hasChanges,
2307
+ disabled: !hasChanges || hasErrors,
2297
2308
  onClick: onSave,
2298
2309
  children: "Save & Publish Changes"
2299
2310
  })]
@@ -2304,14 +2315,16 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
2304
2315
  //#endregion
2305
2316
  //#region src/view/components/ApiPage/components/GeneralSection.tsx
2306
2317
  const { useBreakpoint: useBreakpoint$3 } = Grid;
2307
- const GeneralSection = ({ apiName, authType, version, description, onApiNameChange, onDescriptionChange, collapsed = false, onToggleCollapse, onChangeDetected }) => {
2318
+ const GeneralSection = ({ apiName, authType, version, description, onApiNameChange, onDescriptionChange, onChangeDetected, collapsed, onToggleCollapse, apiNameError, descriptionError }) => {
2308
2319
  const isMobile = !useBreakpoint$3().md;
2309
2320
  const { wrapSSR, cx, token } = useStyle("GeneralSection", (token, scope) => ({
2310
2321
  [scope("root")]: {
2311
2322
  display: "flex",
2312
2323
  flexDirection: "column",
2313
- borderRadius: token.borderRadius,
2314
- overflow: "hidden",
2324
+ gap: token.margin,
2325
+ padding: `${token.marginLG}px ${token.marginLG}px 48px`,
2326
+ background: token.colorBgElevated,
2327
+ borderRadius: token.borderRadiusLG,
2315
2328
  width: "100%"
2316
2329
  },
2317
2330
  [scope("head")]: {
@@ -2325,15 +2338,20 @@ const GeneralSection = ({ apiName, authType, version, description, onApiNameChan
2325
2338
  [scope("body")]: {
2326
2339
  display: "flex",
2327
2340
  flexDirection: "column",
2328
- gap: token.paddingLG,
2341
+ gap: token.margin,
2329
2342
  padding: token.paddingLG,
2330
- paddingBottom: token.paddingXXL ?? 48,
2331
2343
  background: token.colorBgElevated,
2332
2344
  borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`
2333
2345
  },
2346
+ [scope("fields")]: {
2347
+ display: "flex",
2348
+ flexDirection: "column",
2349
+ gap: token.margin,
2350
+ width: "100%"
2351
+ },
2334
2352
  [scope("row")]: {
2335
2353
  display: "flex",
2336
- gap: token.paddingLG,
2354
+ gap: token.margin,
2337
2355
  width: "100%"
2338
2356
  },
2339
2357
  [scope("field")]: {
@@ -2352,108 +2370,91 @@ const GeneralSection = ({ apiName, authType, version, description, onApiNameChan
2352
2370
  paddingBottom: token.paddingXS,
2353
2371
  lineHeight: "22px"
2354
2372
  },
2355
- [scope("label-required")]: {
2373
+ [scope("required")]: {
2356
2374
  color: token.colorError,
2357
2375
  fontSize: token.fontSize
2358
- },
2359
- [scope("count")]: {
2360
- alignSelf: "flex-end",
2361
- fontSize: token.fontSize,
2362
- color: token.colorTextDescription,
2363
- marginTop: token.marginXXS
2364
2376
  }
2365
2377
  }));
2366
- return wrapSSR(/* @__PURE__ */ jsxs("div", {
2367
- className: cx("root"),
2368
- children: [/* @__PURE__ */ jsxs("div", {
2369
- className: cx("head"),
2370
- children: [/* @__PURE__ */ jsx(Title, {
2371
- level: 4,
2372
- style: {
2373
- margin: 0,
2374
- color: token.colorTextHeading
2375
- },
2376
- children: "General"
2377
- }), /* @__PURE__ */ jsx(Button, {
2378
- type: "text",
2379
- size: "large",
2380
- icon: /* @__PURE__ */ jsx(UpCircleOutlined, { style: { fontSize: 18 } }),
2381
- onClick: onToggleCollapse,
2382
- style: {
2383
- transform: collapsed ? "rotate(180deg)" : "rotate(0deg)",
2384
- transition: "transform 0.2s"
2385
- }
2386
- })]
2387
- }), !collapsed && /* @__PURE__ */ jsxs("div", {
2388
- className: cx("body"),
2389
- style: isMobile ? {
2390
- padding: token.paddingMD,
2391
- paddingBottom: token.paddingXXL ?? 48
2392
- } : void 0,
2393
- children: [/* @__PURE__ */ jsxs("div", {
2378
+ const fieldsContent = /* @__PURE__ */ jsxs("div", {
2379
+ className: cx("fields"),
2380
+ children: [
2381
+ /* @__PURE__ */ jsxs("div", {
2382
+ className: cx("field"),
2383
+ children: [/* @__PURE__ */ jsxs("div", {
2384
+ className: cx("label"),
2385
+ children: [/* @__PURE__ */ jsx("span", { children: "API Name" }), /* @__PURE__ */ jsx("span", {
2386
+ className: cx("required"),
2387
+ children: "*"
2388
+ })]
2389
+ }), /* @__PURE__ */ jsx(Input, {
2390
+ size: "large",
2391
+ value: apiName,
2392
+ status: apiNameError ? "error" : void 0,
2393
+ suffix: apiNameError ? /* @__PURE__ */ jsx(CloseCircleOutlined, {
2394
+ style: {
2395
+ color: token.colorError,
2396
+ cursor: "pointer"
2397
+ },
2398
+ onClick: () => {
2399
+ onApiNameChange("");
2400
+ onChangeDetected?.();
2401
+ }
2402
+ }) : void 0,
2403
+ onChange: (e) => {
2404
+ onApiNameChange(e.target.value);
2405
+ onChangeDetected?.();
2406
+ },
2407
+ maxLength: 100,
2408
+ showCount: true
2409
+ })]
2410
+ }),
2411
+ /* @__PURE__ */ jsxs("div", {
2394
2412
  className: cx("row"),
2395
2413
  style: isMobile ? { flexDirection: "column" } : void 0,
2396
- children: [
2397
- /* @__PURE__ */ jsxs("div", {
2398
- className: cx("field"),
2399
- children: [/* @__PURE__ */ jsxs("div", {
2400
- className: cx("label"),
2401
- children: [/* @__PURE__ */ jsx("span", { children: "API Name" }), /* @__PURE__ */ jsx("span", {
2402
- className: cx("label-required"),
2403
- children: "*"
2404
- })]
2405
- }), /* @__PURE__ */ jsx(Input, {
2406
- size: "large",
2407
- value: apiName,
2408
- onChange: (e) => {
2409
- onApiNameChange(e.target.value);
2410
- onChangeDetected?.();
2411
- },
2412
- maxLength: 35,
2413
- showCount: true
2414
- })]
2415
- }),
2416
- /* @__PURE__ */ jsxs("div", {
2417
- className: cx("field"),
2418
- children: [/* @__PURE__ */ jsxs("div", {
2419
- className: cx("label"),
2420
- children: [/* @__PURE__ */ jsx("span", { children: "Authentication Type" }), /* @__PURE__ */ jsx("span", {
2421
- className: cx("label-required"),
2422
- children: "*"
2423
- })]
2424
- }), /* @__PURE__ */ jsx(Input, {
2425
- size: "large",
2426
- value: authType,
2427
- disabled: true
2414
+ children: [/* @__PURE__ */ jsxs("div", {
2415
+ className: cx("field"),
2416
+ style: isMobile ? void 0 : {
2417
+ flex: "none",
2418
+ width: 436
2419
+ },
2420
+ children: [/* @__PURE__ */ jsxs("div", {
2421
+ className: cx("label"),
2422
+ children: [/* @__PURE__ */ jsx("span", { children: "Authentication Type" }), /* @__PURE__ */ jsx("span", {
2423
+ className: cx("required"),
2424
+ children: "*"
2428
2425
  })]
2429
- }),
2430
- /* @__PURE__ */ jsxs("div", {
2431
- className: cx("field"),
2432
- children: [/* @__PURE__ */ jsxs("div", {
2433
- className: cx("label"),
2434
- children: [/* @__PURE__ */ jsx("span", { children: "Version" }), /* @__PURE__ */ jsx("span", {
2435
- className: cx("label-required"),
2436
- children: "*"
2437
- })]
2438
- }), /* @__PURE__ */ jsx(Input, {
2439
- size: "large",
2440
- value: version,
2441
- disabled: true
2426
+ }), /* @__PURE__ */ jsx(Input, {
2427
+ size: "large",
2428
+ value: authType,
2429
+ disabled: true
2430
+ })]
2431
+ }), /* @__PURE__ */ jsxs("div", {
2432
+ className: cx("field"),
2433
+ children: [/* @__PURE__ */ jsxs("div", {
2434
+ className: cx("label"),
2435
+ children: [/* @__PURE__ */ jsx("span", { children: "Version" }), /* @__PURE__ */ jsx("span", {
2436
+ className: cx("required"),
2437
+ children: "*"
2442
2438
  })]
2443
- })
2444
- ]
2445
- }), /* @__PURE__ */ jsxs("div", {
2439
+ }), /* @__PURE__ */ jsx(Input, {
2440
+ size: "large",
2441
+ value: version,
2442
+ disabled: true
2443
+ })]
2444
+ })]
2445
+ }),
2446
+ /* @__PURE__ */ jsxs("div", {
2446
2447
  className: cx("field"),
2447
- style: { width: "100%" },
2448
2448
  children: [/* @__PURE__ */ jsxs("div", {
2449
2449
  className: cx("label"),
2450
2450
  children: [/* @__PURE__ */ jsx("span", { children: "Description" }), /* @__PURE__ */ jsx("span", {
2451
- className: cx("label-required"),
2451
+ className: cx("required"),
2452
2452
  children: "*"
2453
2453
  })]
2454
2454
  }), /* @__PURE__ */ jsx(Input.TextArea, {
2455
2455
  size: "large",
2456
2456
  value: description,
2457
+ status: descriptionError ? "error" : void 0,
2457
2458
  onChange: (e) => {
2458
2459
  onDescriptionChange(e.target.value);
2459
2460
  onChangeDetected?.();
@@ -2465,64 +2466,138 @@ const GeneralSection = ({ apiName, authType, version, description, onApiNameChan
2465
2466
  resize: "vertical"
2466
2467
  }
2467
2468
  })]
2469
+ })
2470
+ ]
2471
+ });
2472
+ return wrapSSR(isMobile ? /* @__PURE__ */ jsxs("div", {
2473
+ style: { width: "100%" },
2474
+ children: [/* @__PURE__ */ jsxs("div", {
2475
+ className: cx("head"),
2476
+ children: [/* @__PURE__ */ jsx(Title, {
2477
+ level: 4,
2478
+ style: {
2479
+ margin: 0,
2480
+ color: token.colorTextHeading
2481
+ },
2482
+ children: "General"
2483
+ }), /* @__PURE__ */ jsx(Button, {
2484
+ type: "text",
2485
+ size: "large",
2486
+ icon: /* @__PURE__ */ jsx(UpCircleOutlined, { style: { fontSize: 18 } }),
2487
+ onClick: onToggleCollapse,
2488
+ style: {
2489
+ transform: collapsed ? "rotate(180deg)" : "rotate(0deg)",
2490
+ transition: "transform 0.2s"
2491
+ }
2468
2492
  })]
2493
+ }), !collapsed && /* @__PURE__ */ jsx("div", {
2494
+ className: cx("body"),
2495
+ children: fieldsContent
2469
2496
  })]
2497
+ }) : /* @__PURE__ */ jsxs("div", {
2498
+ className: cx("root"),
2499
+ children: [/* @__PURE__ */ jsx(Title, {
2500
+ level: 4,
2501
+ style: {
2502
+ margin: 0,
2503
+ color: token.colorTextHeading
2504
+ },
2505
+ children: "General"
2506
+ }), fieldsContent]
2470
2507
  }));
2471
2508
  };
2472
2509
  //#endregion
2473
2510
  //#region src/assets/trash.tsx
2474
- const Trash = (props) => /* @__PURE__ */ jsxs("svg", {
2475
- viewBox: "0 0 40 40",
2511
+ const Trash = (props) => {
2512
+ const maskId = `trash-mask-${useId()}`;
2513
+ return /* @__PURE__ */ jsxs("svg", {
2514
+ viewBox: "0 0 40 40",
2515
+ fill: "none",
2516
+ xmlns: "http://www.w3.org/2000/svg",
2517
+ ...props,
2518
+ children: [
2519
+ /* @__PURE__ */ jsx("mask", {
2520
+ id: maskId,
2521
+ fill: "white",
2522
+ children: /* @__PURE__ */ jsx("path", { d: "M0 8C0 3.58172 3.58172 0 8 0H32C36.4183 0 40 3.58172 40 8V32C40 36.4183 36.4183 40 32 40H8C3.58172 40 0 36.4183 0 32V8Z" })
2523
+ }),
2524
+ /* @__PURE__ */ jsx("path", {
2525
+ d: "M8 0V1H32V0V-1H8V0ZM40 8H39V32H40H41V8H40ZM32 40V39H8V40V41H32V40ZM0 32H1V8H0H-1V32H0ZM8 40V39C4.13401 39 1 35.866 1 32H0H-1C-1 36.9706 3.02944 41 8 41V40ZM40 32H39C39 35.866 35.866 39 32 39V40V41C36.9706 41 41 36.9706 41 32H40ZM32 0V1C35.866 1 39 4.13401 39 8H40H41C41 3.02944 36.9706 -1 32 -1V0ZM8 0V-1C3.02944 -1 -1 3.02944 -1 8H0H1C1 4.13401 4.13401 1 8 1V0Z",
2526
+ fill: "currentColor",
2527
+ mask: `url(#${maskId})`
2528
+ }),
2529
+ /* @__PURE__ */ jsx("path", {
2530
+ d: "M26.75 15.4844C24.2525 15.2369 21.74 15.1094 19.235 15.1094C17.75 15.1094 16.265 15.1844 14.78 15.3344L13.25 15.4844",
2531
+ fill: "currentColor"
2532
+ }),
2533
+ /* @__PURE__ */ jsx("path", {
2534
+ d: "M26.75 15.4844C24.2525 15.2369 21.74 15.1094 19.235 15.1094C17.75 15.1094 16.265 15.1844 14.78 15.3344L13.25 15.4844",
2535
+ stroke: "currentColor",
2536
+ strokeWidth: "1.5",
2537
+ strokeLinecap: "round",
2538
+ strokeLinejoin: "round"
2539
+ }),
2540
+ /* @__PURE__ */ jsx("path", {
2541
+ d: "M17.375 14.7275L17.54 13.745C17.66 13.0325 17.75 12.5 19.0175 12.5H20.9825C22.25 12.5 22.3475 13.0625 22.46 13.7525L22.625 14.7275",
2542
+ stroke: "currentColor",
2543
+ strokeWidth: "1.5",
2544
+ strokeLinecap: "round",
2545
+ strokeLinejoin: "round"
2546
+ }),
2547
+ /* @__PURE__ */ jsx("path", {
2548
+ d: "M25.1373 17.8555L24.6498 25.408C24.5673 26.5855 24.4998 27.5005 22.4073 27.5005H17.5923C15.4998 27.5005 15.4323 26.5855 15.3498 25.408L14.8623 17.8555",
2549
+ stroke: "currentColor",
2550
+ strokeWidth: "1.5",
2551
+ strokeLinecap: "round",
2552
+ strokeLinejoin: "round"
2553
+ }),
2554
+ /* @__PURE__ */ jsx("path", {
2555
+ d: "M18.7476 23.375H21.2451",
2556
+ stroke: "currentColor",
2557
+ strokeWidth: "1.5",
2558
+ strokeLinecap: "round",
2559
+ strokeLinejoin: "round"
2560
+ }),
2561
+ /* @__PURE__ */ jsx("path", {
2562
+ d: "M18.125 20.375H21.875",
2563
+ stroke: "currentColor",
2564
+ strokeWidth: "1.5",
2565
+ strokeLinecap: "round",
2566
+ strokeLinejoin: "round"
2567
+ })
2568
+ ]
2569
+ });
2570
+ };
2571
+ //#endregion
2572
+ //#region src/assets/icons/editTag.tsx
2573
+ const EditTag = (props) => /* @__PURE__ */ jsxs("svg", {
2574
+ width: "18",
2575
+ height: "18",
2576
+ viewBox: "0 0 18 18",
2476
2577
  fill: "none",
2477
2578
  xmlns: "http://www.w3.org/2000/svg",
2478
2579
  ...props,
2479
2580
  children: [
2480
- /* @__PURE__ */ jsx("mask", {
2481
- id: "path-1-inside-1_17984_239034",
2482
- fill: "white",
2483
- children: /* @__PURE__ */ jsx("path", { d: "M0 8C0 3.58172 3.58172 0 8 0H32C36.4183 0 40 3.58172 40 8V32C40 36.4183 36.4183 40 32 40H8C3.58172 40 0 36.4183 0 32V8Z" })
2484
- }),
2485
- /* @__PURE__ */ jsx("path", {
2486
- d: "M8 0V1H32V0V-1H8V0ZM40 8H39V32H40H41V8H40ZM32 40V39H8V40V41H32V40ZM0 32H1V8H0H-1V32H0ZM8 40V39C4.13401 39 1 35.866 1 32H0H-1C-1 36.9706 3.02944 41 8 41V40ZM40 32H39C39 35.866 35.866 39 32 39V40V41C36.9706 41 41 36.9706 41 32H40ZM32 0V1C35.866 1 39 4.13401 39 8H40H41C41 3.02944 36.9706 -1 32 -1V0ZM8 0V-1C3.02944 -1 -1 3.02944 -1 8H0H1C1 4.13401 4.13401 1 8 1V0Z",
2487
- fill: "#FF4D4F",
2488
- mask: "url(#path-1-inside-1_17984_239034)"
2489
- }),
2490
- /* @__PURE__ */ jsx("path", {
2491
- d: "M26.75 15.4844C24.2525 15.2369 21.74 15.1094 19.235 15.1094C17.75 15.1094 16.265 15.1844 14.78 15.3344L13.25 15.4844",
2492
- fill: "#FF4D4F"
2493
- }),
2494
- /* @__PURE__ */ jsx("path", {
2495
- d: "M26.75 15.4844C24.2525 15.2369 21.74 15.1094 19.235 15.1094C17.75 15.1094 16.265 15.1844 14.78 15.3344L13.25 15.4844",
2496
- stroke: "#FF4D4F",
2497
- strokeWidth: "1.5",
2498
- strokeLinecap: "round",
2499
- strokeLinejoin: "round"
2500
- }),
2501
- /* @__PURE__ */ jsx("path", {
2502
- d: "M17.375 14.7275L17.54 13.745C17.66 13.0325 17.75 12.5 19.0175 12.5H20.9825C22.25 12.5 22.3475 13.0625 22.46 13.7525L22.625 14.7275",
2503
- stroke: "#FF4D4F",
2504
- strokeWidth: "1.5",
2505
- strokeLinecap: "round",
2506
- strokeLinejoin: "round"
2507
- }),
2508
2581
  /* @__PURE__ */ jsx("path", {
2509
- d: "M25.1373 17.8555L24.6498 25.408C24.5673 26.5855 24.4998 27.5005 22.4073 27.5005H17.5923C15.4998 27.5005 15.4323 26.5855 15.3498 25.408L14.8623 17.8555",
2510
- stroke: "#FF4D4F",
2582
+ d: "M8.25 1.5H6.75C3 1.5 1.5 3 1.5 6.75V11.25C1.5 15 3 16.5 6.75 16.5H11.25C15 16.5 16.5 15 16.5 11.25V9.75",
2583
+ stroke: "currentColor",
2511
2584
  strokeWidth: "1.5",
2512
2585
  strokeLinecap: "round",
2513
2586
  strokeLinejoin: "round"
2514
2587
  }),
2515
2588
  /* @__PURE__ */ jsx("path", {
2516
- d: "M18.7476 23.375H21.2451",
2517
- stroke: "#FF4D4F",
2589
+ d: "M12.0299 2.26592L6.11991 8.17592C5.89491 8.40092 5.66991 8.84342 5.62491 9.16592L5.30241 11.4234C5.18241 12.2409 5.75991 12.8109 6.57741 12.6984L8.83491 12.3759C9.14991 12.3309 9.59241 12.1059 9.82491 11.8809L15.7349 5.97092C16.7549 4.95092 17.2349 3.76592 15.7349 2.26592C14.2349 0.765922 13.0499 1.24592 12.0299 2.26592Z",
2590
+ stroke: "currentColor",
2518
2591
  strokeWidth: "1.5",
2592
+ strokeMiterlimit: "10",
2519
2593
  strokeLinecap: "round",
2520
2594
  strokeLinejoin: "round"
2521
2595
  }),
2522
2596
  /* @__PURE__ */ jsx("path", {
2523
- d: "M18.125 20.375H21.875",
2524
- stroke: "#FF4D4F",
2597
+ d: "M11.1826 3.11328C11.6851 4.90578 13.0876 6.30828 14.8876 6.81828",
2598
+ stroke: "currentColor",
2525
2599
  strokeWidth: "1.5",
2600
+ strokeMiterlimit: "10",
2526
2601
  strokeLinecap: "round",
2527
2602
  strokeLinejoin: "round"
2528
2603
  })
@@ -2594,6 +2669,7 @@ const PARAM_IN_OPTIONS = [
2594
2669
  value: "path"
2595
2670
  }
2596
2671
  ];
2672
+ const RESPONSE_PARAM_IN_OPTIONS = PARAM_IN_OPTIONS.filter((o) => o.value === "header");
2597
2673
  const PARAM_TYPE_OPTIONS = [
2598
2674
  {
2599
2675
  label: "string",
@@ -2620,7 +2696,7 @@ const PARAM_TYPE_OPTIONS = [
2620
2696
  value: "object"
2621
2697
  }
2622
2698
  ];
2623
- const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initialValues }) => {
2699
+ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initialValues, source }) => {
2624
2700
  const [form] = Form.useForm();
2625
2701
  const [messageApi, contextHolder] = message.useMessage();
2626
2702
  const [confirmModalOpen, setConfirmModalOpen] = useState(false);
@@ -2838,6 +2914,7 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
2838
2914
  }
2839
2915
  }));
2840
2916
  const isAddEnabled = mode === "edit" ? hasChanges : !!(nameValue?.trim() && inValue && typeValue);
2917
+ const paramInOptions = source === "response" ? RESPONSE_PARAM_IN_OPTIONS : PARAM_IN_OPTIONS;
2841
2918
  const resetForm = () => {
2842
2919
  form.resetFields();
2843
2920
  setEnumInput("");
@@ -2942,10 +3019,11 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
2942
3019
  className: cx("form-body"),
2943
3020
  initialValues: {
2944
3021
  required: true,
2945
- in: "query",
3022
+ in: source === "response" ? "header" : "query",
2946
3023
  type: "string"
2947
3024
  },
2948
- onValuesChange: () => {
3025
+ onValuesChange: (_changed, allValues) => {
3026
+ if (allValues.in === "path") form.setFieldValue("required", true);
2949
3027
  if (mode === "edit" && initialValues) {
2950
3028
  const current = form.getFieldsValue();
2951
3029
  setHasChanges(current.name !== initialValues.name || current.in !== initialValues.in || current.type !== initialValues.type || current.required !== initialValues.required || (current.description ?? "") !== (initialValues.description ?? "") || JSON.stringify(enumValues) !== JSON.stringify(initialValues.enum ?? []));
@@ -2990,7 +3068,7 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
2990
3068
  children: /* @__PURE__ */ jsx(Select, {
2991
3069
  size: "large",
2992
3070
  placeholder: "Select",
2993
- options: PARAM_IN_OPTIONS
3071
+ options: paramInOptions
2994
3072
  })
2995
3073
  }),
2996
3074
  /* @__PURE__ */ jsx(Form.Item, {
@@ -3017,12 +3095,20 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
3017
3095
  children: /* @__PURE__ */ jsxs("div", {
3018
3096
  className: cx("switch-row"),
3019
3097
  children: [/* @__PURE__ */ jsx(Switch, {
3020
- checked: requiredValue ?? true,
3098
+ checked: inValue === "path" ? true : requiredValue ?? true,
3099
+ disabled: inValue === "path",
3021
3100
  onChange: (checked) => form.setFieldValue("required", checked),
3022
- style: { backgroundColor: requiredValue ?? true ? token.colorPrimary : void 0 }
3023
- }), /* @__PURE__ */ jsx("span", {
3101
+ style: { backgroundColor: (inValue === "path" ? true : requiredValue ?? true) ? token.colorPrimary : void 0 }
3102
+ }), /* @__PURE__ */ jsxs("span", {
3024
3103
  className: cx("switch-label"),
3025
- children: "Required?"
3104
+ children: ["Required?", inValue === "path" && /* @__PURE__ */ jsx("span", {
3105
+ style: {
3106
+ color: token.colorTextTertiary,
3107
+ fontSize: 12,
3108
+ marginLeft: 4
3109
+ },
3110
+ children: "(Always required for path parameter)"
3111
+ })]
3026
3112
  })]
3027
3113
  })
3028
3114
  }),
@@ -3174,7 +3260,8 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
3174
3260
  //#endregion
3175
3261
  //#region src/view/components/ApiPage/components/EndpointsSection.tsx
3176
3262
  const { useBreakpoint: useBreakpoint$2 } = Grid;
3177
- const PAGE_SIZE = 5;
3263
+ const PAGE_SIZE = 4;
3264
+ const VIEW_PAGE_SIZE = 4;
3178
3265
  const getStatusCodeColor = (code, token) => {
3179
3266
  const n = parseInt(code, 10);
3180
3267
  if (n >= 400 && n < 500) return {
@@ -3194,8 +3281,24 @@ const buildViewParamRows = (params) => params.map((p, idx) => ({
3194
3281
  description: p.description ?? "",
3195
3282
  enum: p.enum ?? []
3196
3283
  }));
3197
- const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse, endpointNames, endpointDescs, endpointTags, availableTags, onEndpointNameChange, onEndpointDescChange, onEndpointTagsChange, endpointParams, onAddParameter, onEditParameter, onDeleteParameter, endpointResponseParams, onAddResponseParameter, onEditResponseParameter, onDeleteResponseParameter, mode = "edit" }) => {
3284
+ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse, endpointNames, endpointDescs, endpointTags, availableTags, onEndpointNameChange, onEndpointDescChange, onEndpointTagsChange, endpointParams, onAddParameter, onEditParameter, onDeleteParameter, endpointResponseParams, onAddResponseParameter, onEditResponseParameter, onDeleteResponseParameter, onRequestContentChange, onResponseContentChange, requestBodySchemas, responseBodySchemas, mode = "edit", selectedEndpointKey }) => {
3198
3285
  const [expandedId, setExpandedId] = useState(null);
3286
+ const [activeTab, setActiveTab] = useState("general");
3287
+ useEffect(() => {
3288
+ setActiveTab("general");
3289
+ }, [selectedEndpointKey]);
3290
+ useEffect(() => {
3291
+ if (!selectedEndpointKey) return;
3292
+ if (selectedStatusCodes[selectedEndpointKey]) return;
3293
+ const ep = Object.values(endpointsByTag).flat().find((e) => e.id === selectedEndpointKey);
3294
+ if (!ep) return;
3295
+ const keys = Object.keys(ep.responses ?? {});
3296
+ const defaultCode = keys.includes("200") ? "200" : keys[0];
3297
+ if (defaultCode) setSelectedStatusCodes((prev) => ({
3298
+ ...prev,
3299
+ [selectedEndpointKey]: defaultCode
3300
+ }));
3301
+ }, [selectedEndpointKey]);
3199
3302
  const [paramDrawerOpen, setParamDrawerOpen] = useState(false);
3200
3303
  const [paramDrawerEndpointId, setParamDrawerEndpointId] = useState(null);
3201
3304
  const [paramDrawerMode, setParamDrawerMode] = useState("add");
@@ -3219,6 +3322,48 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3219
3322
  const [showResponseSearch, setShowResponseSearch] = useState({});
3220
3323
  const debouncedRequestSearches = useDebounce(requestSearches);
3221
3324
  const debouncedResponseSearches = useDebounce(responseSearches);
3325
+ const [editableRequestContent, setEditableRequestContent] = useState({});
3326
+ const [editableResponseContent, setEditableResponseContent] = useState({});
3327
+ useEffect(() => {
3328
+ if (!openRequestPanels.size) return;
3329
+ openRequestPanels.forEach((epId) => {
3330
+ if (editableRequestContent[epId] !== void 0) return;
3331
+ const val = requestBodySchemas?.[epId];
3332
+ const json = val ? JSON.stringify(val, null, 2) : "";
3333
+ setEditableRequestContent((prev) => ({
3334
+ ...prev,
3335
+ [epId]: json
3336
+ }));
3337
+ });
3338
+ }, [openRequestPanels, requestBodySchemas]);
3339
+ useEffect(() => {
3340
+ if (!openResponsePanels.size) return;
3341
+ openResponsePanels.forEach((epId) => {
3342
+ if (editableResponseContent[epId] !== void 0) return;
3343
+ const val = responseBodySchemas?.[epId];
3344
+ const json = val ? JSON.stringify(val, null, 2) : "";
3345
+ setEditableResponseContent((prev) => ({
3346
+ ...prev,
3347
+ [epId]: json
3348
+ }));
3349
+ });
3350
+ }, [openResponsePanels, responseBodySchemas]);
3351
+ const handleValidate = (content) => {
3352
+ try {
3353
+ JSON.parse(content);
3354
+ message.success("Definition is valid JSON.");
3355
+ } catch {
3356
+ message.error("Invalid JSON definition.");
3357
+ }
3358
+ };
3359
+ const handleBeautify = (content, setter) => {
3360
+ try {
3361
+ const parsed = JSON.parse(content);
3362
+ setter(JSON.stringify(parsed, null, 2));
3363
+ } catch {
3364
+ message.error("Could not beautify — content is not valid JSON.");
3365
+ }
3366
+ };
3222
3367
  const { selectNodeByKey } = useNodeSelection();
3223
3368
  const { token: antdToken } = theme.useToken();
3224
3369
  const isMobile = !useBreakpoint$2().md;
@@ -3242,10 +3387,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3242
3387
  [scope("root")]: {
3243
3388
  display: "flex",
3244
3389
  flexDirection: "column",
3245
- borderRadius: token.borderRadius,
3246
- overflow: "hidden",
3247
3390
  width: "100%",
3248
- flexShrink: 0
3391
+ flexShrink: 0,
3392
+ "& .ant-tabs-content-holder": {
3393
+ background: token.colorBgElevated,
3394
+ borderRadius: token.borderRadiusLG,
3395
+ padding: `${token.paddingLG}px ${token.paddingLG}px 48px`
3396
+ }
3249
3397
  },
3250
3398
  [scope("head")]: {
3251
3399
  display: "flex",
@@ -3294,15 +3442,12 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3294
3442
  display: "flex",
3295
3443
  alignItems: "center",
3296
3444
  justifyContent: "center",
3297
- width: 64,
3298
- padding: `0 ${token.paddingXS}px`,
3445
+ padding: "0 15px",
3299
3446
  borderRadius: token.borderRadius,
3300
- border: "1px solid",
3301
3447
  fontSize: token.fontSize,
3302
3448
  fontWeight: 400,
3303
3449
  lineHeight: "22px",
3304
- whiteSpace: "nowrap",
3305
- alignSelf: "stretch"
3450
+ whiteSpace: "nowrap"
3306
3451
  },
3307
3452
  [scope("endpoint-path")]: {
3308
3453
  fontSize: token.fontSizeLG,
@@ -3373,6 +3518,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3373
3518
  userSelect: "none",
3374
3519
  "&:hover": { background: token.colorFillTertiary }
3375
3520
  },
3521
+ [scope("param-row--open")]: { borderRadius: `${token.borderRadius}px ${token.borderRadius}px 0 0` },
3376
3522
  [scope("param-row-icon")]: {
3377
3523
  fontSize: 12,
3378
3524
  transition: "transform 0.2s"
@@ -3380,10 +3526,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3380
3526
  [scope("param-row-icon--open")]: { transform: "rotate(180deg)" },
3381
3527
  [scope("code-panel")]: {
3382
3528
  width: "100%",
3383
- overflow: "hidden"
3529
+ overflow: "hidden",
3530
+ background: "#1D2856",
3531
+ borderBottomLeftRadius: 8,
3532
+ borderBottomRightRadius: 8
3384
3533
  },
3385
3534
  [scope("code-area")]: {
3386
- background: "#1d2856",
3535
+ background: "#1D2856",
3387
3536
  padding: "10px 12px",
3388
3537
  fontFamily: "Cairo, sans-serif",
3389
3538
  fontSize: 14,
@@ -3395,7 +3544,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3395
3544
  display: "block"
3396
3545
  },
3397
3546
  [scope("code-footer")]: {
3398
- background: "#161d40",
3547
+ background: "#161D40",
3399
3548
  padding: 12,
3400
3549
  borderBottomLeftRadius: 8,
3401
3550
  borderBottomRightRadius: 8,
@@ -3552,26 +3701,36 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3552
3701
  gap: 8
3553
3702
  },
3554
3703
  [scope("param-edit-btn")]: {
3555
- width: 32,
3556
- height: 32,
3704
+ width: 40,
3705
+ height: 40,
3557
3706
  padding: 0,
3707
+ lineHeight: 1,
3558
3708
  display: "flex",
3559
3709
  alignItems: "center",
3560
3710
  justifyContent: "center",
3561
- borderColor: token.colorPrimary,
3711
+ borderRadius: 8,
3712
+ borderColor: "#D9D9D9",
3713
+ background: "#FFF !important",
3714
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.02) !important",
3562
3715
  color: token.colorPrimary,
3716
+ "& .ant-btn-icon": {
3717
+ display: "flex",
3718
+ alignItems: "center",
3719
+ justifyContent: "center"
3720
+ },
3563
3721
  "&:hover": {
3564
3722
  borderColor: `${token.colorPrimary} !important`,
3565
3723
  color: `${token.colorPrimary} !important`
3566
3724
  }
3567
3725
  },
3568
3726
  [scope("param-delete-btn")]: {
3569
- width: 32,
3570
- height: 32,
3727
+ width: 40,
3728
+ height: 40,
3571
3729
  padding: 0,
3572
3730
  display: "flex",
3573
3731
  alignItems: "center",
3574
- justifyContent: "center"
3732
+ justifyContent: "center",
3733
+ "& svg path[mask]": { display: "none" }
3575
3734
  },
3576
3735
  [".delete-param-confirm-modal .ant-modal-container"]: {
3577
3736
  "--ant-modal-content-padding": "0px !important",
@@ -3895,30 +4054,1185 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3895
4054
  }
3896
4055
  }
3897
4056
  ];
3898
- return wrapSSR(/* @__PURE__ */ jsxs("div", {
3899
- className: cx("root"),
3900
- children: [
3901
- /* @__PURE__ */ jsxs("div", {
3902
- className: cx("head"),
3903
- children: [/* @__PURE__ */ jsx(Title, {
4057
+ if (selectedEndpointKey) {
4058
+ const ep = Object.values(endpointsByTag).flat().find((e) => e.id === selectedEndpointKey);
4059
+ if (!ep) return wrapSSR(/* @__PURE__ */ jsx("div", {}));
4060
+ const methodColor = methodColors$1[ep.method];
4061
+ const epHeader = /* @__PURE__ */ jsxs("div", {
4062
+ style: {
4063
+ display: "flex",
4064
+ alignItems: "center",
4065
+ gap: token.marginXS,
4066
+ marginBottom: token.marginLG
4067
+ },
4068
+ children: [/* @__PURE__ */ jsx("span", {
4069
+ className: cx("method-badge"),
4070
+ style: {
4071
+ color: methodColor?.color,
4072
+ backgroundColor: methodColor?.bg ?? "transparent"
4073
+ },
4074
+ children: ep.method
4075
+ }), /* @__PURE__ */ jsx(Tooltip, {
4076
+ title: ep.path,
4077
+ children: /* @__PURE__ */ jsx(Title, {
3904
4078
  level: 4,
3905
4079
  style: {
3906
4080
  margin: 0,
3907
4081
  color: token.colorTextHeading
3908
4082
  },
3909
- children: "Endpoints"
3910
- }), /* @__PURE__ */ jsx(Button, {
3911
- type: "text",
3912
- size: "large",
3913
- icon: /* @__PURE__ */ jsx(UpCircleOutlined, { style: { fontSize: 18 } }),
3914
- onClick: onToggleCollapse,
3915
- style: {
3916
- transform: collapsed ? "rotate(180deg)" : "rotate(0deg)",
3917
- transition: "transform 0.2s"
3918
- }
3919
- })]
3920
- }),
3921
- !collapsed && /* @__PURE__ */ jsx("div", {
4083
+ children: ep.path
4084
+ })
4085
+ })]
4086
+ });
4087
+ return wrapSSR(/* @__PURE__ */ jsxs("div", {
4088
+ className: cx("root"),
4089
+ children: [
4090
+ /* @__PURE__ */ jsx(Tabs, {
4091
+ activeKey: activeTab,
4092
+ onChange: setActiveTab,
4093
+ tabBarStyle: {
4094
+ background: "transparent",
4095
+ padding: "0 16px",
4096
+ marginBottom: 16
4097
+ },
4098
+ tabBarGutter: 32,
4099
+ style: { borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px` },
4100
+ items: [
4101
+ {
4102
+ key: "general",
4103
+ label: "General",
4104
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [epHeader, /* @__PURE__ */ jsxs("div", {
4105
+ style: {
4106
+ display: "flex",
4107
+ flexDirection: "column",
4108
+ gap: token.paddingLG
4109
+ },
4110
+ children: [/* @__PURE__ */ jsxs("div", {
4111
+ className: cx("form-row"),
4112
+ style: isMobile ? { flexDirection: "column" } : void 0,
4113
+ children: [/* @__PURE__ */ jsxs("div", {
4114
+ className: cx("form-field"),
4115
+ children: [/* @__PURE__ */ jsxs("div", {
4116
+ className: cx("field-label"),
4117
+ children: [/* @__PURE__ */ jsx("span", { children: "Endpoint Name" }), /* @__PURE__ */ jsx("span", {
4118
+ className: cx("label-required"),
4119
+ children: "*"
4120
+ })]
4121
+ }), /* @__PURE__ */ jsx(Input, {
4122
+ size: "large",
4123
+ value: endpointNames[ep.id] ?? ep.summary ?? "",
4124
+ onChange: (e) => onEndpointNameChange(ep.id, e.target.value),
4125
+ maxLength: 100,
4126
+ showCount: true
4127
+ })]
4128
+ }), /* @__PURE__ */ jsxs("div", {
4129
+ className: cx("form-field"),
4130
+ children: [/* @__PURE__ */ jsx("div", {
4131
+ className: cx("field-label"),
4132
+ children: /* @__PURE__ */ jsx("span", { children: "Endpoint Tag" })
4133
+ }), /* @__PURE__ */ jsx(Select, {
4134
+ mode: "multiple",
4135
+ size: "large",
4136
+ style: { width: "100%" },
4137
+ placeholder: "Select",
4138
+ value: endpointTags[ep.id] ?? ep.tags ?? [],
4139
+ options: availableTags.map((t) => ({
4140
+ label: t,
4141
+ value: t
4142
+ })),
4143
+ onChange: (val) => onEndpointTagsChange(ep.id, val)
4144
+ })]
4145
+ })]
4146
+ }), /* @__PURE__ */ jsxs("div", {
4147
+ className: cx("form-field"),
4148
+ style: { width: "100%" },
4149
+ children: [/* @__PURE__ */ jsxs("div", {
4150
+ className: cx("field-label"),
4151
+ children: [/* @__PURE__ */ jsx("span", { children: "Description" }), /* @__PURE__ */ jsx("span", {
4152
+ className: cx("label-optional"),
4153
+ children: "(optional)"
4154
+ })]
4155
+ }), /* @__PURE__ */ jsx(Input.TextArea, {
4156
+ value: endpointDescs[ep.id] ?? ep.description ?? "",
4157
+ onChange: (e) => onEndpointDescChange(ep.id, e.target.value),
4158
+ maxLength: 500,
4159
+ showCount: true,
4160
+ style: {
4161
+ height: 52,
4162
+ resize: "vertical"
4163
+ }
4164
+ })]
4165
+ })]
4166
+ })] })
4167
+ },
4168
+ {
4169
+ key: "request",
4170
+ label: "Request",
4171
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [epHeader, /* @__PURE__ */ jsxs("div", {
4172
+ className: cx("form-field"),
4173
+ style: { width: "100%" },
4174
+ children: [
4175
+ /* @__PURE__ */ jsx("div", {
4176
+ className: cx("section-header"),
4177
+ children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4178
+ style: {
4179
+ display: "flex",
4180
+ alignItems: "center",
4181
+ gap: token.marginMD
4182
+ },
4183
+ children: [/* @__PURE__ */ jsx("span", {
4184
+ className: cx("section-title"),
4185
+ children: "Request Details"
4186
+ }), /* @__PURE__ */ jsx(Button, {
4187
+ ghost: true,
4188
+ type: "primary",
4189
+ icon: /* @__PURE__ */ jsx(SearchOutlined, {}),
4190
+ size: "large",
4191
+ style: {
4192
+ width: 40,
4193
+ height: 40,
4194
+ padding: 0
4195
+ },
4196
+ disabled: (endpointParams[ep.id] ?? []).length === 0,
4197
+ onClick: () => setShowRequestSearch((prev) => ({
4198
+ ...prev,
4199
+ [ep.id]: !prev[ep.id]
4200
+ }))
4201
+ })]
4202
+ }), /* @__PURE__ */ jsx(Button, {
4203
+ ghost: true,
4204
+ type: "primary",
4205
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
4206
+ onClick: () => {
4207
+ setDrawerSource("request");
4208
+ setParamDrawerMode("add");
4209
+ setEditParamIdx(null);
4210
+ setParamDrawerEndpointId(ep.id);
4211
+ setParamDrawerOpen(true);
4212
+ },
4213
+ children: "Add Parameter"
4214
+ })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4215
+ style: {
4216
+ display: "flex",
4217
+ alignItems: "center",
4218
+ gap: 24
4219
+ },
4220
+ children: [/* @__PURE__ */ jsx("span", {
4221
+ className: cx("section-title"),
4222
+ children: "Request Details"
4223
+ }), /* @__PURE__ */ jsx(Input.Search, {
4224
+ placeholder: "Search by parameter name",
4225
+ style: { width: 310 },
4226
+ disabled: (endpointParams[ep.id] ?? []).length === 0,
4227
+ value: requestSearches[ep.id] ?? "",
4228
+ onChange: (e) => {
4229
+ const val = e.target.value;
4230
+ setRequestSearches((prev) => ({
4231
+ ...prev,
4232
+ [ep.id]: val
4233
+ }));
4234
+ setRequestPages((prev) => new Map(prev).set(ep.id, 1));
4235
+ },
4236
+ allowClear: true
4237
+ })]
4238
+ }), /* @__PURE__ */ jsx(Button, {
4239
+ ghost: true,
4240
+ type: "primary",
4241
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
4242
+ onClick: () => {
4243
+ setDrawerSource("request");
4244
+ setParamDrawerMode("add");
4245
+ setEditParamIdx(null);
4246
+ setParamDrawerEndpointId(ep.id);
4247
+ setParamDrawerOpen(true);
4248
+ },
4249
+ children: "Add Parameter"
4250
+ })] })
4251
+ }),
4252
+ isMobile && showRequestSearch[ep.id] && /* @__PURE__ */ jsx(Input.Search, {
4253
+ placeholder: "Search by parameter name",
4254
+ style: {
4255
+ width: "100%",
4256
+ marginTop: 8
4257
+ },
4258
+ disabled: (endpointParams[ep.id] ?? []).length === 0,
4259
+ value: requestSearches[ep.id] ?? "",
4260
+ onChange: (e) => {
4261
+ const val = e.target.value;
4262
+ setRequestSearches((prev) => ({
4263
+ ...prev,
4264
+ [ep.id]: val
4265
+ }));
4266
+ setRequestPages((prev) => new Map(prev).set(ep.id, 1));
4267
+ },
4268
+ allowClear: true,
4269
+ autoFocus: true
4270
+ }),
4271
+ (endpointParams[ep.id] ?? []).length === 0 ? /* @__PURE__ */ jsx("div", {
4272
+ className: cx("empty-wrapper"),
4273
+ children: /* @__PURE__ */ jsx(Empty, {
4274
+ image: Empty.PRESENTED_IMAGE_SIMPLE,
4275
+ imageStyle: {
4276
+ width: 184,
4277
+ height: 117
4278
+ },
4279
+ description: /* @__PURE__ */ jsx("span", {
4280
+ className: cx("empty-description"),
4281
+ children: "No Data"
4282
+ })
4283
+ })
4284
+ }) : (() => {
4285
+ const reqSearch = (debouncedRequestSearches[ep.id] ?? "").toLowerCase();
4286
+ const allReqParams = (endpointParams[ep.id] ?? []).filter((p) => p.name.toLowerCase().includes(reqSearch));
4287
+ if (allReqParams.length === 0) return /* @__PURE__ */ jsx("div", {
4288
+ className: cx("empty-wrapper"),
4289
+ children: /* @__PURE__ */ jsx(Empty, {
4290
+ image: Empty.PRESENTED_IMAGE_SIMPLE,
4291
+ imageStyle: {
4292
+ width: 184,
4293
+ height: 117
4294
+ },
4295
+ description: /* @__PURE__ */ jsx("span", {
4296
+ className: cx("empty-description"),
4297
+ children: "No Data"
4298
+ })
4299
+ })
4300
+ });
4301
+ const reqPage = requestPages.get(ep.id) ?? 1;
4302
+ const pagedReqParams = allReqParams.slice((reqPage - 1) * PAGE_SIZE, reqPage * PAGE_SIZE);
4303
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
4304
+ className: cx("param-list"),
4305
+ style: { marginTop: token.margin },
4306
+ children: pagedReqParams.map((param, i) => {
4307
+ const idx = (reqPage - 1) * PAGE_SIZE + i;
4308
+ return /* @__PURE__ */ jsx("div", {
4309
+ className: cx("param-item-row"),
4310
+ children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4311
+ style: {
4312
+ display: "flex",
4313
+ alignItems: "center",
4314
+ gap: 24,
4315
+ flex: 1,
4316
+ minWidth: 0
4317
+ },
4318
+ children: [/* @__PURE__ */ jsxs("div", {
4319
+ className: cx("param-detail-cell"),
4320
+ children: [/* @__PURE__ */ jsx("span", {
4321
+ className: cx("param-detail-label"),
4322
+ children: "Parameter Name"
4323
+ }), /* @__PURE__ */ jsx("span", {
4324
+ className: cx("param-detail-value"),
4325
+ children: param.name
4326
+ })]
4327
+ }), /* @__PURE__ */ jsxs("div", {
4328
+ className: cx("param-detail-cell"),
4329
+ style: {
4330
+ flex: 1,
4331
+ minWidth: 0
4332
+ },
4333
+ children: [/* @__PURE__ */ jsx("span", {
4334
+ className: cx("param-detail-label"),
4335
+ children: "Parameter In"
4336
+ }), /* @__PURE__ */ jsx("span", {
4337
+ className: cx("param-detail-value"),
4338
+ children: param.in
4339
+ })]
4340
+ })]
4341
+ }), /* @__PURE__ */ jsxs("div", {
4342
+ style: {
4343
+ display: "flex",
4344
+ alignItems: "center",
4345
+ gap: token.margin,
4346
+ background: token.colorFillTertiary,
4347
+ borderRadius: token.borderRadius,
4348
+ padding: `0 ${token.marginSM}px`,
4349
+ height: 50,
4350
+ flexShrink: 0
4351
+ },
4352
+ children: [/* @__PURE__ */ jsx(Button, {
4353
+ danger: true,
4354
+ icon: /* @__PURE__ */ jsx(Trash, {
4355
+ width: 32,
4356
+ height: 32
4357
+ }),
4358
+ style: {
4359
+ padding: 0,
4360
+ lineHeight: 1,
4361
+ width: 40,
4362
+ height: 40
4363
+ },
4364
+ className: cx("param-delete-btn"),
4365
+ onClick: () => setDeleteParamModal({
4366
+ open: true,
4367
+ endpointId: ep.id,
4368
+ idx,
4369
+ name: param.name,
4370
+ source: "request"
4371
+ })
4372
+ }), /* @__PURE__ */ jsx(Button, {
4373
+ ghost: true,
4374
+ icon: /* @__PURE__ */ jsx(EditTag, {
4375
+ width: 18,
4376
+ height: 18
4377
+ }),
4378
+ style: {
4379
+ width: 40,
4380
+ height: 40,
4381
+ padding: 0,
4382
+ lineHeight: 1
4383
+ },
4384
+ className: cx("param-edit-btn"),
4385
+ onClick: () => {
4386
+ setDrawerSource("request");
4387
+ setParamDrawerMode("edit");
4388
+ setEditParamIdx(idx);
4389
+ setParamDrawerEndpointId(ep.id);
4390
+ setParamDrawerOpen(true);
4391
+ }
4392
+ })]
4393
+ })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4394
+ className: cx("param-details"),
4395
+ children: [
4396
+ /* @__PURE__ */ jsxs("div", {
4397
+ className: cx("param-detail-cell"),
4398
+ children: [/* @__PURE__ */ jsx("span", {
4399
+ className: cx("param-detail-label"),
4400
+ children: "Parameter Name"
4401
+ }), /* @__PURE__ */ jsx("span", {
4402
+ className: cx("param-detail-value"),
4403
+ children: param.name
4404
+ })]
4405
+ }),
4406
+ /* @__PURE__ */ jsxs("div", {
4407
+ className: cx("param-detail-cell"),
4408
+ children: [/* @__PURE__ */ jsx("span", {
4409
+ className: cx("param-detail-label"),
4410
+ children: "Parameter In"
4411
+ }), /* @__PURE__ */ jsx("span", {
4412
+ className: cx("param-detail-value"),
4413
+ children: param.in
4414
+ })]
4415
+ }),
4416
+ /* @__PURE__ */ jsxs("div", {
4417
+ className: cx("param-detail-cell"),
4418
+ children: [/* @__PURE__ */ jsx("span", {
4419
+ className: cx("param-detail-label"),
4420
+ children: "Parameter Type"
4421
+ }), /* @__PURE__ */ jsx("span", {
4422
+ className: cx("param-detail-value"),
4423
+ children: param.type
4424
+ })]
4425
+ }),
4426
+ /* @__PURE__ */ jsxs("div", {
4427
+ className: cx("param-detail-cell"),
4428
+ children: [/* @__PURE__ */ jsx("span", {
4429
+ className: cx("param-detail-label"),
4430
+ children: "Enum"
4431
+ }), param.enum && param.enum.length > 0 ? /* @__PURE__ */ jsxs("span", {
4432
+ className: cx("param-enum-container"),
4433
+ children: [/* @__PURE__ */ jsx("span", {
4434
+ className: cx("param-enum-tag"),
4435
+ children: param.enum[0]
4436
+ }), param.enum.length > 1 && /* @__PURE__ */ jsx(Tooltip, {
4437
+ title: /* @__PURE__ */ jsx("ul", {
4438
+ style: {
4439
+ margin: 0,
4440
+ paddingLeft: 16
4441
+ },
4442
+ children: param.enum.map((e) => /* @__PURE__ */ jsx("li", { children: e }, e))
4443
+ }),
4444
+ placement: "bottom",
4445
+ children: /* @__PURE__ */ jsxs("span", {
4446
+ className: cx("param-enum-pill"),
4447
+ children: ["+", param.enum.length - 1]
4448
+ })
4449
+ })]
4450
+ }) : /* @__PURE__ */ jsx("span", {
4451
+ className: cx("param-detail-value"),
4452
+ children: "—"
4453
+ })]
4454
+ }),
4455
+ /* @__PURE__ */ jsxs("div", {
4456
+ className: cx("param-detail-cell"),
4457
+ children: [/* @__PURE__ */ jsx("span", {
4458
+ className: cx("param-detail-label"),
4459
+ children: "Required?"
4460
+ }), /* @__PURE__ */ jsx("span", {
4461
+ className: cx("param-detail-value"),
4462
+ children: param.required ? "Yes" : "No"
4463
+ })]
4464
+ }),
4465
+ /* @__PURE__ */ jsxs("div", {
4466
+ className: cx("param-detail-cell"),
4467
+ children: [/* @__PURE__ */ jsx("span", {
4468
+ className: cx("param-detail-label"),
4469
+ children: "Description"
4470
+ }), /* @__PURE__ */ jsx("span", {
4471
+ className: cx("param-detail-value", "param-detail-value--ellipsis"),
4472
+ children: param.description || "—"
4473
+ })]
4474
+ })
4475
+ ]
4476
+ }), /* @__PURE__ */ jsxs("div", {
4477
+ className: cx("param-actions"),
4478
+ children: [/* @__PURE__ */ jsx(Button, {
4479
+ danger: true,
4480
+ icon: /* @__PURE__ */ jsx(Trash, {
4481
+ width: 32,
4482
+ height: 32
4483
+ }),
4484
+ style: {
4485
+ padding: 0,
4486
+ lineHeight: 1,
4487
+ width: 40,
4488
+ height: 40
4489
+ },
4490
+ className: cx("param-delete-btn"),
4491
+ onClick: () => setDeleteParamModal({
4492
+ open: true,
4493
+ endpointId: ep.id,
4494
+ idx,
4495
+ name: param.name,
4496
+ source: "request"
4497
+ })
4498
+ }), /* @__PURE__ */ jsx(Button, {
4499
+ ghost: true,
4500
+ icon: /* @__PURE__ */ jsx(EditTag, {
4501
+ width: 18,
4502
+ height: 18
4503
+ }),
4504
+ style: {
4505
+ width: 40,
4506
+ height: 40,
4507
+ padding: 0,
4508
+ lineHeight: 1
4509
+ },
4510
+ className: cx("param-edit-btn"),
4511
+ onClick: () => {
4512
+ setDrawerSource("request");
4513
+ setParamDrawerMode("edit");
4514
+ setEditParamIdx(idx);
4515
+ setParamDrawerEndpointId(ep.id);
4516
+ setParamDrawerOpen(true);
4517
+ }
4518
+ })]
4519
+ })] })
4520
+ }, idx);
4521
+ })
4522
+ }), allReqParams.length > PAGE_SIZE && /* @__PURE__ */ jsx(Pagination, {
4523
+ current: reqPage,
4524
+ pageSize: PAGE_SIZE,
4525
+ total: allReqParams.length,
4526
+ onChange: (page) => setRequestPages((prev) => new Map(prev).set(ep.id, page)),
4527
+ showSizeChanger: false,
4528
+ className: cx("pagination")
4529
+ })] });
4530
+ })(),
4531
+ !["GET", "DELETE"].includes(ep.method) && /* @__PURE__ */ jsxs("div", {
4532
+ className: cx("param-row", openRequestPanels.has(ep.id) ? "param-row--open" : ""),
4533
+ style: { marginTop: token.margin },
4534
+ onClick: () => toggleRequestPanel(ep.id),
4535
+ children: [/* @__PURE__ */ jsx(DownOutlined, { className: cx("param-row-icon", openRequestPanels.has(ep.id) ? "param-row-icon--open" : "") }), /* @__PURE__ */ jsxs("span", {
4536
+ style: { fontSize: token.fontSize },
4537
+ children: ["Request ", /* @__PURE__ */ jsx("span", {
4538
+ style: { color: token.colorError },
4539
+ children: "*"
4540
+ })]
4541
+ })]
4542
+ }),
4543
+ !["GET", "DELETE"].includes(ep.method) && openRequestPanels.has(ep.id) && /* @__PURE__ */ jsxs("div", {
4544
+ className: cx("code-panel"),
4545
+ children: [/* @__PURE__ */ jsx(Input.TextArea, {
4546
+ value: editableRequestContent[ep.id] ?? "",
4547
+ onChange: (e) => {
4548
+ setEditableRequestContent((prev) => ({
4549
+ ...prev,
4550
+ [ep.id]: e.target.value
4551
+ }));
4552
+ onRequestContentChange?.(ep.id, e.target.value);
4553
+ },
4554
+ rows: Math.max(3, (editableRequestContent[ep.id] ?? "").split("\n").length),
4555
+ style: {
4556
+ fontFamily: "monospace",
4557
+ fontSize: "0.75rem",
4558
+ background: "#1D2856",
4559
+ color: "#fff",
4560
+ outline: "none",
4561
+ boxShadow: "none",
4562
+ border: "none"
4563
+ }
4564
+ }), /* @__PURE__ */ jsxs("div", {
4565
+ className: cx("code-footer"),
4566
+ children: [/* @__PURE__ */ jsx(Button, {
4567
+ ghost: true,
4568
+ size: "small",
4569
+ className: cx("code-btn"),
4570
+ onClick: () => handleValidate(editableRequestContent[ep.id] ?? ""),
4571
+ children: "Validate"
4572
+ }), /* @__PURE__ */ jsx(Button, {
4573
+ ghost: true,
4574
+ size: "small",
4575
+ className: cx("code-btn"),
4576
+ onClick: () => handleBeautify(editableRequestContent[ep.id] ?? "", (v) => setEditableRequestContent((prev) => ({
4577
+ ...prev,
4578
+ [ep.id]: v
4579
+ }))),
4580
+ children: "Beautify"
4581
+ })]
4582
+ })]
4583
+ })
4584
+ ]
4585
+ })] })
4586
+ },
4587
+ {
4588
+ key: "response",
4589
+ label: "Response",
4590
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [epHeader, /* @__PURE__ */ jsxs("div", {
4591
+ className: cx("form-field"),
4592
+ style: { width: "100%" },
4593
+ children: [
4594
+ /* @__PURE__ */ jsx("div", {
4595
+ className: cx("section-header"),
4596
+ children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4597
+ style: {
4598
+ display: "flex",
4599
+ alignItems: "center",
4600
+ gap: token.marginMD
4601
+ },
4602
+ children: [/* @__PURE__ */ jsx("span", {
4603
+ className: cx("section-title"),
4604
+ children: "Response Details"
4605
+ }), /* @__PURE__ */ jsx(Button, {
4606
+ ghost: true,
4607
+ type: "primary",
4608
+ icon: /* @__PURE__ */ jsx(SearchOutlined, {}),
4609
+ size: "large",
4610
+ style: {
4611
+ width: 40,
4612
+ height: 40,
4613
+ padding: 0
4614
+ },
4615
+ disabled: (endpointResponseParams[ep.id] ?? []).length === 0,
4616
+ onClick: () => setShowResponseSearch((prev) => ({
4617
+ ...prev,
4618
+ [ep.id]: !prev[ep.id]
4619
+ }))
4620
+ })]
4621
+ }), /* @__PURE__ */ jsx(Button, {
4622
+ ghost: true,
4623
+ type: "primary",
4624
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
4625
+ onClick: () => {
4626
+ setDrawerSource("response");
4627
+ setParamDrawerMode("add");
4628
+ setEditParamIdx(null);
4629
+ setParamDrawerEndpointId(ep.id);
4630
+ setParamDrawerOpen(true);
4631
+ },
4632
+ children: "Add Parameter"
4633
+ })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4634
+ style: {
4635
+ display: "flex",
4636
+ alignItems: "center",
4637
+ gap: 24
4638
+ },
4639
+ children: [/* @__PURE__ */ jsx("span", {
4640
+ className: cx("section-title"),
4641
+ children: "Response Details"
4642
+ }), /* @__PURE__ */ jsxs("div", {
4643
+ className: cx("response-controls"),
4644
+ children: [/* @__PURE__ */ jsx(Input.Search, {
4645
+ placeholder: "Search by parameter name",
4646
+ style: { width: 310 },
4647
+ disabled: (endpointResponseParams[ep.id] ?? []).length === 0,
4648
+ value: responseSearches[ep.id] ?? "",
4649
+ onChange: (e) => {
4650
+ const val = e.target.value;
4651
+ setResponseSearches((prev) => ({
4652
+ ...prev,
4653
+ [ep.id]: val
4654
+ }));
4655
+ setResponsePages((prev) => new Map(prev).set(ep.id, 1));
4656
+ },
4657
+ allowClear: true
4658
+ }), /* @__PURE__ */ jsx(Tooltip, {
4659
+ title: selectedStatusCodes[ep.id] ? "Filled" : void 0,
4660
+ placement: "bottom",
4661
+ children: /* @__PURE__ */ jsx(Select, {
4662
+ className: cx("status-select"),
4663
+ popupClassName: "status-code-dropdown",
4664
+ value: selectedStatusCodes[ep.id] ?? void 0,
4665
+ onChange: (val) => setSelectedStatusCodes((prev) => ({
4666
+ ...prev,
4667
+ [ep.id]: val
4668
+ })),
4669
+ options: Object.keys(ep.responses ?? {}).map((code) => ({
4670
+ value: code,
4671
+ label: /* @__PURE__ */ jsxs("span", {
4672
+ className: cx("status-label"),
4673
+ children: [/* @__PURE__ */ jsx("span", {
4674
+ className: cx("status-dot"),
4675
+ style: { background: getStatusCodeColor(code, antdToken).dot }
4676
+ }), /* @__PURE__ */ jsx("span", {
4677
+ style: { color: getStatusCodeColor(code, antdToken).text },
4678
+ children: code
4679
+ })]
4680
+ })
4681
+ })),
4682
+ optionRender: (option) => {
4683
+ const code = option.value;
4684
+ const { dot, text } = getStatusCodeColor(code, antdToken);
4685
+ const isSelected = selectedStatusCodes[ep.id] === code;
4686
+ return /* @__PURE__ */ jsx(Tooltip, {
4687
+ title: "Filled",
4688
+ placement: "bottom",
4689
+ children: /* @__PURE__ */ jsxs("span", {
4690
+ className: cx("status-option-content"),
4691
+ children: [
4692
+ /* @__PURE__ */ jsx("span", {
4693
+ className: cx("status-dot"),
4694
+ style: { background: dot }
4695
+ }),
4696
+ /* @__PURE__ */ jsx("span", {
4697
+ style: { color: text },
4698
+ children: code
4699
+ }),
4700
+ isSelected && /* @__PURE__ */ jsx(CheckCircleOutlined, {
4701
+ className: cx("status-checkmark"),
4702
+ style: { color: text }
4703
+ })
4704
+ ]
4705
+ })
4706
+ });
4707
+ }
4708
+ })
4709
+ })]
4710
+ })]
4711
+ }), /* @__PURE__ */ jsx(Button, {
4712
+ ghost: true,
4713
+ type: "primary",
4714
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
4715
+ onClick: () => {
4716
+ setDrawerSource("response");
4717
+ setParamDrawerMode("add");
4718
+ setEditParamIdx(null);
4719
+ setParamDrawerEndpointId(ep.id);
4720
+ setParamDrawerOpen(true);
4721
+ },
4722
+ children: "Add Parameter"
4723
+ })] })
4724
+ }),
4725
+ isMobile && showResponseSearch[ep.id] && /* @__PURE__ */ jsx(Input.Search, {
4726
+ placeholder: "Search by parameter name",
4727
+ style: {
4728
+ width: "100%",
4729
+ marginTop: 8
4730
+ },
4731
+ disabled: (endpointResponseParams[ep.id] ?? []).length === 0,
4732
+ value: responseSearches[ep.id] ?? "",
4733
+ onChange: (e) => {
4734
+ const val = e.target.value;
4735
+ setResponseSearches((prev) => ({
4736
+ ...prev,
4737
+ [ep.id]: val
4738
+ }));
4739
+ setResponsePages((prev) => new Map(prev).set(ep.id, 1));
4740
+ },
4741
+ allowClear: true,
4742
+ autoFocus: true
4743
+ }),
4744
+ (endpointResponseParams[ep.id] ?? []).length === 0 ? /* @__PURE__ */ jsx("div", {
4745
+ className: cx("empty-wrapper"),
4746
+ children: /* @__PURE__ */ jsx(Empty, {
4747
+ image: Empty.PRESENTED_IMAGE_SIMPLE,
4748
+ imageStyle: {
4749
+ width: 184,
4750
+ height: 117
4751
+ },
4752
+ description: /* @__PURE__ */ jsx("span", {
4753
+ className: cx("empty-description"),
4754
+ children: "No Data"
4755
+ })
4756
+ })
4757
+ }) : (() => {
4758
+ const resSearch = (debouncedResponseSearches[ep.id] ?? "").toLowerCase();
4759
+ const allResParams = (endpointResponseParams[ep.id] ?? []).filter((p) => p.name.toLowerCase().includes(resSearch));
4760
+ if (allResParams.length === 0) return /* @__PURE__ */ jsx("div", {
4761
+ className: cx("empty-wrapper"),
4762
+ children: /* @__PURE__ */ jsx(Empty, {
4763
+ image: Empty.PRESENTED_IMAGE_SIMPLE,
4764
+ imageStyle: {
4765
+ width: 184,
4766
+ height: 117
4767
+ },
4768
+ description: /* @__PURE__ */ jsx("span", {
4769
+ className: cx("empty-description"),
4770
+ children: "No Data"
4771
+ })
4772
+ })
4773
+ });
4774
+ const resPage = responsePages.get(ep.id) ?? 1;
4775
+ const pagedResParams = allResParams.slice((resPage - 1) * PAGE_SIZE, resPage * PAGE_SIZE);
4776
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
4777
+ className: cx("param-list"),
4778
+ style: { marginTop: token.margin },
4779
+ children: pagedResParams.map((param, i) => {
4780
+ const idx = (resPage - 1) * PAGE_SIZE + i;
4781
+ return /* @__PURE__ */ jsx("div", {
4782
+ className: cx("param-item-row"),
4783
+ children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4784
+ style: {
4785
+ display: "flex",
4786
+ alignItems: "center",
4787
+ gap: 24,
4788
+ flex: 1,
4789
+ minWidth: 0
4790
+ },
4791
+ children: [/* @__PURE__ */ jsxs("div", {
4792
+ className: cx("param-detail-cell"),
4793
+ children: [/* @__PURE__ */ jsx("span", {
4794
+ className: cx("param-detail-label"),
4795
+ children: "Parameter Name"
4796
+ }), /* @__PURE__ */ jsx("span", {
4797
+ className: cx("param-detail-value"),
4798
+ children: param.name
4799
+ })]
4800
+ }), /* @__PURE__ */ jsxs("div", {
4801
+ className: cx("param-detail-cell"),
4802
+ style: {
4803
+ flex: 1,
4804
+ minWidth: 0
4805
+ },
4806
+ children: [/* @__PURE__ */ jsx("span", {
4807
+ className: cx("param-detail-label"),
4808
+ children: "Parameter In"
4809
+ }), /* @__PURE__ */ jsx("span", {
4810
+ className: cx("param-detail-value"),
4811
+ children: param.in
4812
+ })]
4813
+ })]
4814
+ }), /* @__PURE__ */ jsxs("div", {
4815
+ style: {
4816
+ display: "flex",
4817
+ alignItems: "center",
4818
+ gap: token.margin,
4819
+ background: token.colorFillTertiary,
4820
+ borderRadius: token.borderRadius,
4821
+ padding: `0 ${token.marginSM}px`,
4822
+ height: 50,
4823
+ flexShrink: 0
4824
+ },
4825
+ children: [/* @__PURE__ */ jsx(Button, {
4826
+ danger: true,
4827
+ icon: /* @__PURE__ */ jsx(Trash, {
4828
+ width: 32,
4829
+ height: 32
4830
+ }),
4831
+ style: {
4832
+ padding: 0,
4833
+ lineHeight: 1,
4834
+ width: 40,
4835
+ height: 40
4836
+ },
4837
+ className: cx("param-delete-btn"),
4838
+ onClick: () => setDeleteParamModal({
4839
+ open: true,
4840
+ endpointId: ep.id,
4841
+ idx,
4842
+ name: param.name,
4843
+ source: "response"
4844
+ })
4845
+ }), /* @__PURE__ */ jsx(Button, {
4846
+ ghost: true,
4847
+ icon: /* @__PURE__ */ jsx(EditTag, {
4848
+ width: 18,
4849
+ height: 18
4850
+ }),
4851
+ style: {
4852
+ width: 40,
4853
+ height: 40,
4854
+ padding: 0,
4855
+ lineHeight: 1
4856
+ },
4857
+ className: cx("param-edit-btn"),
4858
+ onClick: () => {
4859
+ setDrawerSource("response");
4860
+ setParamDrawerMode("edit");
4861
+ setEditParamIdx(idx);
4862
+ setParamDrawerEndpointId(ep.id);
4863
+ setParamDrawerOpen(true);
4864
+ }
4865
+ })]
4866
+ })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4867
+ className: cx("param-details"),
4868
+ children: [
4869
+ /* @__PURE__ */ jsxs("div", {
4870
+ className: cx("param-detail-cell"),
4871
+ children: [/* @__PURE__ */ jsx("span", {
4872
+ className: cx("param-detail-label"),
4873
+ children: "Parameter Name"
4874
+ }), /* @__PURE__ */ jsx("span", {
4875
+ className: cx("param-detail-value"),
4876
+ children: param.name
4877
+ })]
4878
+ }),
4879
+ /* @__PURE__ */ jsxs("div", {
4880
+ className: cx("param-detail-cell"),
4881
+ children: [/* @__PURE__ */ jsx("span", {
4882
+ className: cx("param-detail-label"),
4883
+ children: "Parameter In"
4884
+ }), /* @__PURE__ */ jsx("span", {
4885
+ className: cx("param-detail-value"),
4886
+ children: param.in
4887
+ })]
4888
+ }),
4889
+ /* @__PURE__ */ jsxs("div", {
4890
+ className: cx("param-detail-cell"),
4891
+ children: [/* @__PURE__ */ jsx("span", {
4892
+ className: cx("param-detail-label"),
4893
+ children: "Parameter Type"
4894
+ }), /* @__PURE__ */ jsx("span", {
4895
+ className: cx("param-detail-value"),
4896
+ children: param.type
4897
+ })]
4898
+ }),
4899
+ /* @__PURE__ */ jsxs("div", {
4900
+ className: cx("param-detail-cell"),
4901
+ children: [/* @__PURE__ */ jsx("span", {
4902
+ className: cx("param-detail-label"),
4903
+ children: "Enum"
4904
+ }), param.enum && param.enum.length > 0 ? /* @__PURE__ */ jsxs("span", {
4905
+ className: cx("param-enum-container"),
4906
+ children: [/* @__PURE__ */ jsx("span", {
4907
+ className: cx("param-enum-tag"),
4908
+ children: param.enum[0]
4909
+ }), param.enum.length > 1 && /* @__PURE__ */ jsx(Tooltip, {
4910
+ title: /* @__PURE__ */ jsx("ul", {
4911
+ style: {
4912
+ margin: 0,
4913
+ paddingLeft: 16
4914
+ },
4915
+ children: param.enum.map((e) => /* @__PURE__ */ jsx("li", { children: e }, e))
4916
+ }),
4917
+ placement: "bottom",
4918
+ children: /* @__PURE__ */ jsxs("span", {
4919
+ className: cx("param-enum-pill"),
4920
+ children: ["+", param.enum.length - 1]
4921
+ })
4922
+ })]
4923
+ }) : /* @__PURE__ */ jsx("span", {
4924
+ className: cx("param-detail-value"),
4925
+ children: "—"
4926
+ })]
4927
+ }),
4928
+ /* @__PURE__ */ jsxs("div", {
4929
+ className: cx("param-detail-cell"),
4930
+ children: [/* @__PURE__ */ jsx("span", {
4931
+ className: cx("param-detail-label"),
4932
+ children: "Required?"
4933
+ }), /* @__PURE__ */ jsx("span", {
4934
+ className: cx("param-detail-value"),
4935
+ children: param.required ? "Yes" : "No"
4936
+ })]
4937
+ }),
4938
+ /* @__PURE__ */ jsxs("div", {
4939
+ className: cx("param-detail-cell"),
4940
+ children: [/* @__PURE__ */ jsx("span", {
4941
+ className: cx("param-detail-label"),
4942
+ children: "Description"
4943
+ }), /* @__PURE__ */ jsx("span", {
4944
+ className: cx("param-detail-value", "param-detail-value--ellipsis"),
4945
+ children: param.description || "—"
4946
+ })]
4947
+ })
4948
+ ]
4949
+ }), /* @__PURE__ */ jsxs("div", {
4950
+ className: cx("param-actions"),
4951
+ children: [/* @__PURE__ */ jsx(Button, {
4952
+ danger: true,
4953
+ icon: /* @__PURE__ */ jsx(Trash, {
4954
+ width: 32,
4955
+ height: 32
4956
+ }),
4957
+ style: {
4958
+ padding: 0,
4959
+ lineHeight: 1,
4960
+ width: 40,
4961
+ height: 40
4962
+ },
4963
+ className: cx("param-delete-btn"),
4964
+ onClick: () => setDeleteParamModal({
4965
+ open: true,
4966
+ endpointId: ep.id,
4967
+ idx,
4968
+ name: param.name,
4969
+ source: "response"
4970
+ })
4971
+ }), /* @__PURE__ */ jsx(Button, {
4972
+ ghost: true,
4973
+ icon: /* @__PURE__ */ jsx(EditTag, {
4974
+ width: 18,
4975
+ height: 18
4976
+ }),
4977
+ style: {
4978
+ width: 40,
4979
+ height: 40,
4980
+ padding: 0,
4981
+ lineHeight: 1
4982
+ },
4983
+ className: cx("param-edit-btn"),
4984
+ onClick: () => {
4985
+ setDrawerSource("response");
4986
+ setParamDrawerMode("edit");
4987
+ setEditParamIdx(idx);
4988
+ setParamDrawerEndpointId(ep.id);
4989
+ setParamDrawerOpen(true);
4990
+ }
4991
+ })]
4992
+ })] })
4993
+ }, idx);
4994
+ })
4995
+ }), allResParams.length > PAGE_SIZE && /* @__PURE__ */ jsx(Pagination, {
4996
+ current: resPage,
4997
+ pageSize: PAGE_SIZE,
4998
+ total: allResParams.length,
4999
+ onChange: (page) => setResponsePages((prev) => new Map(prev).set(ep.id, page)),
5000
+ showSizeChanger: false,
5001
+ className: cx("pagination")
5002
+ })] });
5003
+ })(),
5004
+ /* @__PURE__ */ jsxs("div", {
5005
+ className: cx("param-row", openResponsePanels.has(ep.id) ? "param-row--open" : ""),
5006
+ style: { marginTop: token.margin },
5007
+ onClick: () => toggleResponsePanel(ep.id),
5008
+ children: [
5009
+ /* @__PURE__ */ jsx(DownOutlined, { className: cx("param-row-icon", openResponsePanels.has(ep.id) ? "param-row-icon--open" : "") }),
5010
+ /* @__PURE__ */ jsxs("span", {
5011
+ style: { fontSize: token.fontSize },
5012
+ children: ["Response ", /* @__PURE__ */ jsx("span", {
5013
+ style: { color: token.colorError },
5014
+ children: "*"
5015
+ })]
5016
+ }),
5017
+ /* @__PURE__ */ jsx(InfoCircle, { style: {
5018
+ width: 24,
5019
+ height: 24
5020
+ } })
5021
+ ]
5022
+ }),
5023
+ openResponsePanels.has(ep.id) && /* @__PURE__ */ jsxs("div", {
5024
+ className: cx("code-panel"),
5025
+ children: [/* @__PURE__ */ jsx(Input.TextArea, {
5026
+ value: editableResponseContent[ep.id] ?? "",
5027
+ onChange: (e) => {
5028
+ setEditableResponseContent((prev) => ({
5029
+ ...prev,
5030
+ [ep.id]: e.target.value
5031
+ }));
5032
+ onResponseContentChange?.(ep.id, e.target.value);
5033
+ },
5034
+ rows: Math.max(3, (editableResponseContent[ep.id] ?? "").split("\n").length),
5035
+ style: {
5036
+ fontFamily: "monospace",
5037
+ fontSize: "0.75rem",
5038
+ background: "#1D2856",
5039
+ color: "#fff",
5040
+ outline: "none",
5041
+ boxShadow: "none",
5042
+ border: "none"
5043
+ }
5044
+ }), /* @__PURE__ */ jsxs("div", {
5045
+ className: cx("code-footer"),
5046
+ children: [/* @__PURE__ */ jsx(Button, {
5047
+ ghost: true,
5048
+ size: "small",
5049
+ className: cx("code-btn"),
5050
+ onClick: () => handleValidate(editableResponseContent[ep.id] ?? ""),
5051
+ children: "Validate"
5052
+ }), /* @__PURE__ */ jsx(Button, {
5053
+ ghost: true,
5054
+ size: "small",
5055
+ className: cx("code-btn"),
5056
+ onClick: () => handleBeautify(editableResponseContent[ep.id] ?? "", (v) => setEditableResponseContent((prev) => ({
5057
+ ...prev,
5058
+ [ep.id]: v
5059
+ }))),
5060
+ children: "Beautify"
5061
+ })]
5062
+ })]
5063
+ })
5064
+ ]
5065
+ })] })
5066
+ }
5067
+ ]
5068
+ }),
5069
+ /* @__PURE__ */ jsxs(Modal, {
5070
+ open: deleteParamModal.open,
5071
+ onCancel: () => setDeleteParamModal({
5072
+ open: false,
5073
+ endpointId: "",
5074
+ idx: -1,
5075
+ name: "",
5076
+ source: "request"
5077
+ }),
5078
+ centered: true,
5079
+ title: null,
5080
+ footer: null,
5081
+ closable: false,
5082
+ width: 520,
5083
+ className: "delete-param-confirm-modal",
5084
+ styles: {
5085
+ content: {
5086
+ padding: 0,
5087
+ borderRadius: 8,
5088
+ overflow: "hidden"
5089
+ },
5090
+ body: {
5091
+ padding: 0,
5092
+ margin: 0
5093
+ }
5094
+ },
5095
+ children: [
5096
+ /* @__PURE__ */ jsxs("div", {
5097
+ className: cx("deleteModalHead"),
5098
+ children: [/* @__PURE__ */ jsxs("span", {
5099
+ className: cx("deleteModalTitle"),
5100
+ children: [
5101
+ "Delete ",
5102
+ deleteParamModal.name,
5103
+ " parameter"
5104
+ ]
5105
+ }), /* @__PURE__ */ jsx("button", {
5106
+ className: cx("deleteModalCloseBtn"),
5107
+ onClick: () => setDeleteParamModal({
5108
+ open: false,
5109
+ endpointId: "",
5110
+ idx: -1,
5111
+ name: "",
5112
+ source: "request"
5113
+ }),
5114
+ "aria-label": "Close",
5115
+ children: "×"
5116
+ })]
5117
+ }),
5118
+ /* @__PURE__ */ jsx("div", {
5119
+ className: cx("deleteModalContent"),
5120
+ children: /* @__PURE__ */ jsxs("span", {
5121
+ className: cx("deleteModalContentText"),
5122
+ children: [
5123
+ "Are you sure you want to delete ",
5124
+ deleteParamModal.name,
5125
+ " parameter?"
5126
+ ]
5127
+ })
5128
+ }),
5129
+ /* @__PURE__ */ jsxs("div", {
5130
+ className: cx("deleteModalFooter"),
5131
+ children: [/* @__PURE__ */ jsx(Button, {
5132
+ size: "middle",
5133
+ onClick: () => setDeleteParamModal({
5134
+ open: false,
5135
+ endpointId: "",
5136
+ idx: -1,
5137
+ name: "",
5138
+ source: "request"
5139
+ }),
5140
+ style: {
5141
+ borderRadius: 8,
5142
+ height: 32,
5143
+ paddingInline: 15
5144
+ },
5145
+ children: "Cancel"
5146
+ }), /* @__PURE__ */ jsx(Button, {
5147
+ type: "primary",
5148
+ danger: true,
5149
+ size: "middle",
5150
+ style: {
5151
+ borderRadius: 8,
5152
+ height: 32,
5153
+ paddingInline: 16
5154
+ },
5155
+ onClick: () => {
5156
+ const epId = deleteParamModal.endpointId;
5157
+ if (deleteParamModal.source === "response") {
5158
+ const total = (endpointResponseParams[epId] ?? []).length - 1;
5159
+ const maxPage = Math.max(1, Math.ceil(total / PAGE_SIZE));
5160
+ if ((responsePages.get(epId) ?? 1) > maxPage) setResponsePages((prev) => new Map(prev).set(epId, 1));
5161
+ onDeleteResponseParameter?.(epId, deleteParamModal.idx);
5162
+ } else {
5163
+ const total = (endpointParams[epId] ?? []).length - 1;
5164
+ const maxPage = Math.max(1, Math.ceil(total / PAGE_SIZE));
5165
+ if ((requestPages.get(epId) ?? 1) > maxPage) setRequestPages((prev) => new Map(prev).set(epId, 1));
5166
+ onDeleteParameter?.(epId, deleteParamModal.idx);
5167
+ }
5168
+ setDeleteParamModal({
5169
+ open: false,
5170
+ endpointId: "",
5171
+ idx: -1,
5172
+ name: "",
5173
+ source: "request"
5174
+ });
5175
+ },
5176
+ children: "Yes, Delete"
5177
+ })]
5178
+ })
5179
+ ]
5180
+ }),
5181
+ /* @__PURE__ */ jsx(AddParameterDrawer, {
5182
+ open: paramDrawerOpen,
5183
+ mode: paramDrawerMode,
5184
+ initialValues: paramDrawerMode === "edit" && paramDrawerEndpointId && editParamIdx !== null ? drawerSource === "response" ? endpointResponseParams[paramDrawerEndpointId]?.[editParamIdx] : endpointParams[paramDrawerEndpointId]?.[editParamIdx] : void 0,
5185
+ onClose: () => {
5186
+ setParamDrawerOpen(false);
5187
+ setParamDrawerEndpointId(null);
5188
+ setParamDrawerMode("add");
5189
+ setEditParamIdx(null);
5190
+ },
5191
+ onAdd: (param) => {
5192
+ if (paramDrawerEndpointId) if (drawerSource === "response") onAddResponseParameter?.(paramDrawerEndpointId, param);
5193
+ else onAddParameter?.(paramDrawerEndpointId, param);
5194
+ setParamDrawerOpen(false);
5195
+ setParamDrawerEndpointId(null);
5196
+ setParamDrawerMode("add");
5197
+ setEditParamIdx(null);
5198
+ },
5199
+ onEdit: (param) => {
5200
+ if (paramDrawerEndpointId && editParamIdx !== null) if (drawerSource === "response") onEditResponseParameter?.(paramDrawerEndpointId, editParamIdx, param);
5201
+ else onEditParameter?.(paramDrawerEndpointId, editParamIdx, param);
5202
+ setParamDrawerOpen(false);
5203
+ setParamDrawerEndpointId(null);
5204
+ setParamDrawerMode("add");
5205
+ setEditParamIdx(null);
5206
+ },
5207
+ source: drawerSource
5208
+ })
5209
+ ]
5210
+ }));
5211
+ }
5212
+ return wrapSSR(/* @__PURE__ */ jsxs("div", {
5213
+ className: cx("root"),
5214
+ children: [
5215
+ /* @__PURE__ */ jsxs("div", {
5216
+ className: cx("head"),
5217
+ children: [/* @__PURE__ */ jsx(Title, {
5218
+ level: 4,
5219
+ style: {
5220
+ margin: 0,
5221
+ color: token.colorTextHeading
5222
+ },
5223
+ children: "Endpoints"
5224
+ }), /* @__PURE__ */ jsx(Button, {
5225
+ type: "text",
5226
+ size: "large",
5227
+ icon: /* @__PURE__ */ jsx(UpCircleOutlined, { style: { fontSize: 18 } }),
5228
+ onClick: onToggleCollapse,
5229
+ style: {
5230
+ transform: collapsed ? "rotate(180deg)" : "rotate(0deg)",
5231
+ transition: "transform 0.2s"
5232
+ }
5233
+ })]
5234
+ }),
5235
+ !collapsed && /* @__PURE__ */ jsx("div", {
3922
5236
  className: cx("body"),
3923
5237
  children: Object.values(endpointsByTag).flat().map((ep) => {
3924
5238
  const isExpanded = expandedId === ep.id;
@@ -3966,49 +5280,95 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3966
5280
  className: cx("view-params-title"),
3967
5281
  children: "Request"
3968
5282
  })
3969
- }), /* @__PURE__ */ jsx(Table, {
3970
- dataSource: buildViewParamRows(endpointParams[ep.id] ?? []),
3971
- columns: viewParamColumns,
3972
- pagination: false,
3973
- rowClassName: (_, idx) => cx(idx % 2 === 0 ? "view-row-odd" : "view-row-even"),
3974
- size: "small",
3975
- bordered: true
3976
- })]
5283
+ }), (() => {
5284
+ const allVReqRows = buildViewParamRows(endpointParams[ep.id] ?? []);
5285
+ const vReqPage = requestPages.get(ep.id) ?? 1;
5286
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Table, {
5287
+ dataSource: allVReqRows.slice((vReqPage - 1) * VIEW_PAGE_SIZE, vReqPage * VIEW_PAGE_SIZE),
5288
+ columns: viewParamColumns,
5289
+ pagination: false,
5290
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "view-row-odd" : "view-row-even"),
5291
+ size: "small",
5292
+ bordered: true
5293
+ }), allVReqRows.length > VIEW_PAGE_SIZE && /* @__PURE__ */ jsx("div", {
5294
+ style: { paddingBottom: 12 },
5295
+ children: /* @__PURE__ */ jsx(Pagination, {
5296
+ current: vReqPage,
5297
+ pageSize: VIEW_PAGE_SIZE,
5298
+ total: allVReqRows.length,
5299
+ onChange: (page) => setRequestPages((prev) => new Map(prev).set(ep.id, page)),
5300
+ showSizeChanger: false,
5301
+ className: cx("pagination")
5302
+ })
5303
+ })] });
5304
+ })()]
3977
5305
  }), /* @__PURE__ */ jsxs("div", {
3978
5306
  className: cx("view-params-card"),
3979
- children: [/* @__PURE__ */ jsxs("div", {
3980
- className: cx("view-params-header"),
3981
- children: [/* @__PURE__ */ jsx("span", {
3982
- className: cx("view-params-title"),
3983
- children: "Response"
3984
- }), /* @__PURE__ */ jsx(Select, {
3985
- className: cx("view-status-select-sm"),
3986
- popupClassName: "status-code-dropdown",
3987
- value: selectedStatusCodes[ep.id] ?? (Object.keys(ep.responses ?? {}).includes("200") ? "200" : Object.keys(ep.responses ?? {})[0]),
3988
- onChange: (val) => setSelectedStatusCodes((prev) => ({
3989
- ...prev,
3990
- [ep.id]: val
3991
- })),
3992
- options: Object.keys(ep.responses ?? {}).map((code) => ({
3993
- value: code,
3994
- label: /* @__PURE__ */ jsxs("span", {
3995
- className: cx("status-label"),
3996
- children: [/* @__PURE__ */ jsx("span", {
3997
- className: cx("status-dot"),
3998
- style: { background: getStatusCodeColor(code, antdToken).dot }
3999
- }), /* @__PURE__ */ jsx("span", { children: code })]
5307
+ children: [
5308
+ /* @__PURE__ */ jsxs("div", {
5309
+ className: cx("view-params-header"),
5310
+ children: [/* @__PURE__ */ jsx("span", {
5311
+ className: cx("view-params-title"),
5312
+ children: "Response"
5313
+ }), /* @__PURE__ */ jsx(Select, {
5314
+ className: cx("view-status-select-sm"),
5315
+ popupClassName: "status-code-dropdown",
5316
+ value: selectedStatusCodes[ep.id] ?? (Object.keys(ep.responses ?? {}).includes("200") ? "200" : Object.keys(ep.responses ?? {})[0]),
5317
+ onChange: (val) => setSelectedStatusCodes((prev) => ({
5318
+ ...prev,
5319
+ [ep.id]: val
5320
+ })),
5321
+ options: Object.keys(ep.responses ?? {}).map((code) => ({
5322
+ value: code,
5323
+ label: /* @__PURE__ */ jsxs("span", {
5324
+ className: cx("status-label"),
5325
+ children: [/* @__PURE__ */ jsx("span", {
5326
+ className: cx("status-dot"),
5327
+ style: { background: getStatusCodeColor(code, antdToken).dot }
5328
+ }), /* @__PURE__ */ jsx("span", { children: code })]
5329
+ })
5330
+ })),
5331
+ size: "middle"
5332
+ })]
5333
+ }),
5334
+ (() => {
5335
+ const allVResRows = buildViewParamRows(endpointResponseParams[ep.id] ?? []);
5336
+ const vResPage = responsePages.get(ep.id) ?? 1;
5337
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Table, {
5338
+ dataSource: allVResRows.slice((vResPage - 1) * VIEW_PAGE_SIZE, vResPage * VIEW_PAGE_SIZE),
5339
+ columns: viewParamColumns,
5340
+ pagination: false,
5341
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "view-row-odd" : "view-row-even"),
5342
+ size: "small",
5343
+ bordered: true
5344
+ }), allVResRows.length > VIEW_PAGE_SIZE && /* @__PURE__ */ jsx("div", {
5345
+ style: { paddingBottom: 12 },
5346
+ children: /* @__PURE__ */ jsx(Pagination, {
5347
+ current: vResPage,
5348
+ pageSize: VIEW_PAGE_SIZE,
5349
+ total: allVResRows.length,
5350
+ onChange: (page) => setResponsePages((prev) => new Map(prev).set(ep.id, page)),
5351
+ showSizeChanger: false,
5352
+ className: cx("pagination")
4000
5353
  })
4001
- })),
4002
- size: "middle"
4003
- })]
4004
- }), /* @__PURE__ */ jsx(Table, {
4005
- dataSource: buildViewParamRows(endpointResponseParams[ep.id] ?? []),
4006
- columns: viewParamColumns,
4007
- pagination: false,
4008
- rowClassName: (_, idx) => cx(idx % 2 === 0 ? "view-row-odd" : "view-row-even"),
4009
- size: "small",
4010
- bordered: true
4011
- })]
5354
+ })] });
5355
+ })(),
5356
+ (() => {
5357
+ const selectedCode = selectedStatusCodes[ep.id] ?? (Object.keys(ep.responses ?? {}).includes("200") ? "200" : Object.keys(ep.responses ?? {})[0]);
5358
+ const responseContent = ep.responses?.[selectedCode]?.content;
5359
+ if (!responseContent) return null;
5360
+ const schema = Object.values(responseContent)[0]?.schema;
5361
+ if (!schema) return null;
5362
+ return /* @__PURE__ */ jsx("div", {
5363
+ className: cx("code-panel"),
5364
+ style: { marginTop: token.marginSM },
5365
+ children: /* @__PURE__ */ jsx("code", {
5366
+ className: cx("code-area"),
5367
+ children: JSON.stringify(schema, null, 2)
5368
+ })
5369
+ });
5370
+ })()
5371
+ ]
4012
5372
  })]
4013
5373
  }),
4014
5374
  isExpanded && mode !== "view" && /* @__PURE__ */ jsxs("div", {
@@ -4028,7 +5388,9 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4028
5388
  }), /* @__PURE__ */ jsx(Input, {
4029
5389
  size: "large",
4030
5390
  value: endpointNames[ep.id] ?? ep.summary ?? "",
4031
- onChange: (e) => onEndpointNameChange(ep.id, e.target.value)
5391
+ onChange: (e) => onEndpointNameChange(ep.id, e.target.value),
5392
+ maxLength: 100,
5393
+ showCount: true
4032
5394
  })]
4033
5395
  }), /* @__PURE__ */ jsxs("div", {
4034
5396
  className: cx("form-field"),
@@ -4261,9 +5623,8 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4261
5623
  style: {
4262
5624
  padding: 0,
4263
5625
  lineHeight: 1,
4264
- width: 32,
4265
- height: 32,
4266
- fontSize: 20
5626
+ width: 40,
5627
+ height: 40
4267
5628
  },
4268
5629
  className: cx("param-delete-btn"),
4269
5630
  onClick: () => setDeleteParamModal({
@@ -4275,7 +5636,16 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4275
5636
  })
4276
5637
  }), /* @__PURE__ */ jsx(Button, {
4277
5638
  ghost: true,
4278
- icon: /* @__PURE__ */ jsx(EditOutlined, {}),
5639
+ icon: /* @__PURE__ */ jsx(EditTag, {
5640
+ width: 18,
5641
+ height: 18
5642
+ }),
5643
+ style: {
5644
+ width: 40,
5645
+ height: 40,
5646
+ padding: 0,
5647
+ lineHeight: 1
5648
+ },
4279
5649
  className: cx("param-edit-btn"),
4280
5650
  onClick: () => {
4281
5651
  setDrawerSource("request");
@@ -4372,14 +5742,15 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4372
5742
  className: cx("param-actions"),
4373
5743
  children: [/* @__PURE__ */ jsx(Button, {
4374
5744
  danger: true,
4375
- type: "text",
4376
5745
  icon: /* @__PURE__ */ jsx(Trash, {
4377
- height: 32,
4378
- width: 32
5746
+ width: 32,
5747
+ height: 32
4379
5748
  }),
4380
5749
  style: {
4381
5750
  padding: 0,
4382
- lineHeight: 1
5751
+ lineHeight: 1,
5752
+ width: 40,
5753
+ height: 40
4383
5754
  },
4384
5755
  className: cx("param-delete-btn"),
4385
5756
  onClick: () => setDeleteParamModal({
@@ -4391,7 +5762,16 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4391
5762
  })
4392
5763
  }), /* @__PURE__ */ jsx(Button, {
4393
5764
  ghost: true,
4394
- icon: /* @__PURE__ */ jsx(EditOutlined, {}),
5765
+ icon: /* @__PURE__ */ jsx(EditTag, {
5766
+ width: 18,
5767
+ height: 18
5768
+ }),
5769
+ style: {
5770
+ width: 40,
5771
+ height: 40,
5772
+ padding: 0,
5773
+ lineHeight: 1
5774
+ },
4395
5775
  className: cx("param-edit-btn"),
4396
5776
  onClick: () => {
4397
5777
  setDrawerSource("request");
@@ -4413,8 +5793,8 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4413
5793
  className: cx("pagination")
4414
5794
  })] });
4415
5795
  })(),
4416
- /* @__PURE__ */ jsxs("div", {
4417
- className: cx("param-row"),
5796
+ !["GET", "DELETE"].includes(ep.method) && /* @__PURE__ */ jsxs("div", {
5797
+ className: cx("param-row", openRequestPanels.has(ep.id) ? "param-row--open" : ""),
4418
5798
  style: { marginTop: token.margin },
4419
5799
  onClick: () => toggleRequestPanel(ep.id),
4420
5800
  children: [/* @__PURE__ */ jsx(DownOutlined, { className: cx("param-row-icon", openRequestPanels.has(ep.id) ? "param-row-icon--open" : "") }), /* @__PURE__ */ jsxs("span", {
@@ -4425,29 +5805,43 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4425
5805
  })]
4426
5806
  })]
4427
5807
  }),
4428
- openRequestPanels.has(ep.id) && /* @__PURE__ */ jsxs("div", {
5808
+ !["GET", "DELETE"].includes(ep.method) && openRequestPanels.has(ep.id) && /* @__PURE__ */ jsxs("div", {
4429
5809
  className: cx("code-panel"),
4430
- children: [/* @__PURE__ */ jsx("code", {
4431
- className: cx("code-area"),
4432
- children: JSON.stringify((endpointParams[ep.id] ?? []).map((p) => ({
4433
- name: p.name,
4434
- in: p.in,
4435
- type: p.type,
4436
- required: p.required,
4437
- ...p.description ? { description: p.description } : {},
4438
- ...p.enum && p.enum.length > 0 ? { enum: p.enum } : {}
4439
- })), null, 2)
5810
+ children: [/* @__PURE__ */ jsx(Input.TextArea, {
5811
+ value: editableRequestContent[ep.id] ?? "",
5812
+ onChange: (e) => {
5813
+ setEditableRequestContent((prev) => ({
5814
+ ...prev,
5815
+ [ep.id]: e.target.value
5816
+ }));
5817
+ onRequestContentChange?.(ep.id, e.target.value);
5818
+ },
5819
+ rows: Math.max(3, (editableRequestContent[ep.id] ?? "").split("\n").length),
5820
+ style: {
5821
+ fontFamily: "monospace",
5822
+ fontSize: "0.75rem",
5823
+ background: "#1D2856",
5824
+ color: "#fff",
5825
+ outline: "none",
5826
+ boxShadow: "none",
5827
+ border: "none"
5828
+ }
4440
5829
  }), /* @__PURE__ */ jsxs("div", {
4441
5830
  className: cx("code-footer"),
4442
5831
  children: [/* @__PURE__ */ jsx(Button, {
4443
5832
  ghost: true,
4444
5833
  size: "small",
4445
5834
  className: cx("code-btn"),
5835
+ onClick: () => handleValidate(editableRequestContent[ep.id] ?? ""),
4446
5836
  children: "Validate"
4447
5837
  }), /* @__PURE__ */ jsx(Button, {
4448
5838
  ghost: true,
4449
5839
  size: "small",
4450
5840
  className: cx("code-btn"),
5841
+ onClick: () => handleBeautify(editableRequestContent[ep.id] ?? "", (v) => setEditableRequestContent((prev) => ({
5842
+ ...prev,
5843
+ [ep.id]: v
5844
+ }))),
4451
5845
  children: "Beautify"
4452
5846
  })]
4453
5847
  })]
@@ -4700,9 +6094,8 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4700
6094
  style: {
4701
6095
  padding: 0,
4702
6096
  lineHeight: 1,
4703
- width: 32,
4704
- height: 32,
4705
- fontSize: 20
6097
+ width: 40,
6098
+ height: 40
4706
6099
  },
4707
6100
  className: cx("param-delete-btn"),
4708
6101
  onClick: () => setDeleteParamModal({
@@ -4714,7 +6107,16 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4714
6107
  })
4715
6108
  }), /* @__PURE__ */ jsx(Button, {
4716
6109
  ghost: true,
4717
- icon: /* @__PURE__ */ jsx(EditOutlined, {}),
6110
+ icon: /* @__PURE__ */ jsx(EditTag, {
6111
+ width: 18,
6112
+ height: 18
6113
+ }),
6114
+ style: {
6115
+ width: 40,
6116
+ height: 40,
6117
+ padding: 0,
6118
+ lineHeight: 1
6119
+ },
4718
6120
  className: cx("param-edit-btn"),
4719
6121
  onClick: () => {
4720
6122
  setDrawerSource("response");
@@ -4811,7 +6213,16 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4811
6213
  className: cx("param-actions"),
4812
6214
  children: [/* @__PURE__ */ jsx(Button, {
4813
6215
  ghost: true,
4814
- icon: /* @__PURE__ */ jsx(EditOutlined, {}),
6216
+ icon: /* @__PURE__ */ jsx(EditTag, {
6217
+ width: 18,
6218
+ height: 18
6219
+ }),
6220
+ style: {
6221
+ width: 40,
6222
+ height: 40,
6223
+ padding: 0,
6224
+ lineHeight: 1
6225
+ },
4815
6226
  className: cx("param-edit-btn"),
4816
6227
  onClick: () => {
4817
6228
  setDrawerSource("response");
@@ -4822,14 +6233,15 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4822
6233
  }
4823
6234
  }), /* @__PURE__ */ jsx(Button, {
4824
6235
  danger: true,
4825
- type: "text",
4826
6236
  icon: /* @__PURE__ */ jsx(Trash, {
4827
- height: 18,
4828
- width: 18
6237
+ width: 32,
6238
+ height: 32
4829
6239
  }),
4830
6240
  style: {
4831
6241
  padding: 0,
4832
- lineHeight: 1
6242
+ lineHeight: 1,
6243
+ width: 40,
6244
+ height: 40
4833
6245
  },
4834
6246
  className: cx("param-delete-btn"),
4835
6247
  onClick: () => setDeleteParamModal({
@@ -4853,7 +6265,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4853
6265
  })] });
4854
6266
  })(),
4855
6267
  /* @__PURE__ */ jsxs("div", {
4856
- className: cx("param-row"),
6268
+ className: cx("param-row", openResponsePanels.has(ep.id) ? "param-row--open" : ""),
4857
6269
  style: { marginTop: token.margin },
4858
6270
  onClick: () => toggleResponsePanel(ep.id),
4859
6271
  children: [
@@ -4873,27 +6285,41 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4873
6285
  }),
4874
6286
  openResponsePanels.has(ep.id) && /* @__PURE__ */ jsxs("div", {
4875
6287
  className: cx("code-panel"),
4876
- children: [/* @__PURE__ */ jsx("code", {
4877
- className: cx("code-area"),
4878
- children: JSON.stringify((endpointResponseParams[ep.id] ?? []).map((p) => ({
4879
- name: p.name,
4880
- in: p.in,
4881
- type: p.type,
4882
- required: p.required,
4883
- ...p.description ? { description: p.description } : {},
4884
- ...p.enum && p.enum.length > 0 ? { enum: p.enum } : {}
4885
- })), null, 2)
6288
+ children: [/* @__PURE__ */ jsx(Input.TextArea, {
6289
+ value: editableResponseContent[ep.id] ?? "",
6290
+ onChange: (e) => {
6291
+ setEditableResponseContent((prev) => ({
6292
+ ...prev,
6293
+ [ep.id]: e.target.value
6294
+ }));
6295
+ onResponseContentChange?.(ep.id, e.target.value);
6296
+ },
6297
+ rows: Math.max(3, (editableResponseContent[ep.id] ?? "").split("\n").length),
6298
+ style: {
6299
+ fontFamily: "monospace",
6300
+ fontSize: "0.75rem",
6301
+ background: "#1D2856",
6302
+ color: "#fff",
6303
+ outline: "none",
6304
+ boxShadow: "none",
6305
+ border: "none"
6306
+ }
4886
6307
  }), /* @__PURE__ */ jsxs("div", {
4887
6308
  className: cx("code-footer"),
4888
6309
  children: [/* @__PURE__ */ jsx(Button, {
4889
6310
  ghost: true,
4890
6311
  size: "small",
4891
6312
  className: cx("code-btn"),
6313
+ onClick: () => handleValidate(editableResponseContent[ep.id] ?? ""),
4892
6314
  children: "Validate"
4893
6315
  }), /* @__PURE__ */ jsx(Button, {
4894
6316
  ghost: true,
4895
6317
  size: "small",
4896
6318
  className: cx("code-btn"),
6319
+ onClick: () => handleBeautify(editableResponseContent[ep.id] ?? "", (v) => setEditableResponseContent((prev) => ({
6320
+ ...prev,
6321
+ [ep.id]: v
6322
+ }))),
4897
6323
  children: "Beautify"
4898
6324
  })]
4899
6325
  })]
@@ -5042,7 +6468,8 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
5042
6468
  setParamDrawerEndpointId(null);
5043
6469
  setParamDrawerMode("add");
5044
6470
  setEditParamIdx(null);
5045
- }
6471
+ },
6472
+ source: drawerSource
5046
6473
  })
5047
6474
  ]
5048
6475
  }));
@@ -5070,7 +6497,7 @@ const UnsavedChangesBanner = ({ onClose }) => {
5070
6497
  children: /* @__PURE__ */ jsx(Alert, {
5071
6498
  className: cx("alert"),
5072
6499
  type: "warning",
5073
- message: "There are changes you made may not be saved",
6500
+ message: "There are changes you made that may not be saved",
5074
6501
  closable: true,
5075
6502
  onClose,
5076
6503
  icon: /* @__PURE__ */ jsx(ExclamationCircleFilled, {}),
@@ -5081,57 +6508,50 @@ const UnsavedChangesBanner = ({ onClose }) => {
5081
6508
  //#endregion
5082
6509
  //#region src/view/components/ApiPage/components/TagsSection.tsx
5083
6510
  const { useBreakpoint: useBreakpoint$1 } = Grid;
5084
- const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEditTag, onDeleteTag }) => {
6511
+ const TAGS_PAGE_SIZE = 8;
6512
+ const TagsSection = ({ tags, collapsed, onToggleCollapse, onAddTag, onEditTag, onDeleteTag }) => {
5085
6513
  const isMobile = !useBreakpoint$1().md;
6514
+ const [currentPage, setCurrentPage] = useState(1);
6515
+ const sortedTags = [...tags].sort((a, b) => a.isDefault === b.isDefault ? 0 : a.isDefault ? -1 : 1);
6516
+ const maxPage = Math.max(1, Math.ceil(tags.length / TAGS_PAGE_SIZE));
6517
+ const safePage = Math.min(currentPage, maxPage);
6518
+ const paginatedTags = sortedTags.slice((safePage - 1) * TAGS_PAGE_SIZE, safePage * TAGS_PAGE_SIZE);
5086
6519
  const { wrapSSR, cx, token } = useStyle("TagsSection", (token, scope) => ({
5087
6520
  [scope("root")]: {
5088
6521
  display: "flex",
5089
6522
  flexDirection: "column",
5090
- borderRadius: token.borderRadius,
5091
- overflow: "hidden",
5092
- width: "100%",
5093
- flexShrink: 0
6523
+ gap: token.margin,
6524
+ padding: token.marginLG,
6525
+ background: token.colorBgElevated,
6526
+ borderRadius: token.borderRadiusLG,
6527
+ width: "100%"
5094
6528
  },
5095
6529
  [scope("head")]: {
5096
6530
  display: "flex",
5097
6531
  alignItems: "center",
5098
6532
  justifyContent: "space-between",
5099
- padding: `${token.paddingXS}px ${token.paddingLG}px`,
5100
- background: token.colorPrimaryBg,
5101
- borderRadius: `${token.borderRadius}px ${token.borderRadius}px 0 0`
5102
- },
5103
- [scope("head-actions")]: {
5104
- display: "flex",
5105
- alignItems: "center",
5106
- gap: token.margin
6533
+ width: "100%"
5107
6534
  },
5108
- [scope("body")]: {
6535
+ [scope("tags-list")]: {
5109
6536
  display: "flex",
5110
6537
  flexDirection: "column",
5111
- gap: 0,
5112
- padding: token.paddingLG,
5113
- background: token.colorBgElevated,
5114
- borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`
6538
+ width: "100%"
5115
6539
  },
5116
6540
  [scope("tag-row")]: {
5117
6541
  display: "flex",
5118
6542
  alignItems: "center",
5119
6543
  justifyContent: "space-between",
5120
- height: 50,
5121
- paddingTop: token.controlHeightLG,
5122
- paddingBottom: token.controlHeightLG,
5123
- paddingRight: token.paddingLG,
5124
- borderBottom: `1px solid ${token.colorBorder}`,
5125
- width: "100%"
5126
- },
5127
- [scope("tag-row-last")]: {
5128
- borderBottom: "none",
5129
- paddingBottom: token.marginLG
6544
+ minHeight: 50,
6545
+ paddingTop: 12,
6546
+ paddingBottom: 12,
6547
+ width: "100%",
6548
+ borderBottom: `1px solid ${token.colorBorder}`
5130
6549
  },
6550
+ [scope("tag-row-last")]: { borderBottom: "none" },
5131
6551
  [scope("tag-info")]: {
5132
6552
  display: "flex",
5133
6553
  alignItems: "center",
5134
- gap: 32,
6554
+ gap: token.marginXL,
5135
6555
  flex: 1,
5136
6556
  minWidth: 0
5137
6557
  },
@@ -5167,32 +6587,13 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
5167
6587
  alignItems: "center",
5168
6588
  gap: token.margin
5169
6589
  },
5170
- [scope("btn-delete")]: {
5171
- width: 40,
5172
- height: 40,
5173
- border: `1px solid ${token.colorError}`,
5174
- borderRadius: token.borderRadius,
5175
- display: "flex",
5176
- alignItems: "center",
5177
- justifyContent: "center"
5178
- },
5179
- [scope("btn-edit")]: {
5180
- width: 40,
5181
- height: 40,
5182
- border: `1px solid ${token.colorBorder}`,
5183
- borderRadius: token.borderRadius,
5184
- background: token.colorBgContainer,
5185
- boxShadow: "0px 2px 0px 0px rgba(0,0,0,0.02)",
5186
- display: "flex",
5187
- alignItems: "center",
5188
- justifyContent: "center"
5189
- },
5190
6590
  [scope("tag-row-mobile")]: {
5191
6591
  display: "flex",
5192
6592
  flexDirection: "row",
5193
6593
  alignItems: "flex-start",
5194
6594
  justifyContent: "space-between",
5195
6595
  gap: 8,
6596
+ paddingTop: 12,
5196
6597
  paddingBottom: token.margin,
5197
6598
  borderBottom: `1px solid ${token.colorBorder}`,
5198
6599
  width: "100%",
@@ -5222,16 +6623,176 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
5222
6623
  display: "flex",
5223
6624
  flexDirection: "column",
5224
6625
  gap: 0,
5225
- padding: token.paddingMD,
5226
- background: token.colorBgElevated,
5227
- borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`,
5228
6626
  overflowX: "auto"
6627
+ },
6628
+ [scope("head-collapse")]: {
6629
+ display: "flex",
6630
+ alignItems: "center",
6631
+ justifyContent: "space-between",
6632
+ padding: `${token.paddingXS}px ${token.paddingLG}px`,
6633
+ background: token.colorPrimaryBg,
6634
+ borderRadius: `${token.borderRadius}px ${token.borderRadius}px 0 0`
6635
+ },
6636
+ [scope("body-collapse")]: {
6637
+ display: "flex",
6638
+ flexDirection: "column",
6639
+ gap: token.margin,
6640
+ padding: token.paddingLG,
6641
+ background: token.colorBgElevated,
6642
+ borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`
6643
+ },
6644
+ [scope("pagination")]: {
6645
+ display: "flex",
6646
+ justifyContent: "center",
6647
+ marginTop: token.marginMD,
6648
+ ".ant-pagination-item-active": {
6649
+ backgroundColor: token.colorBgContainer,
6650
+ borderColor: token.colorPrimary,
6651
+ borderRadius: token.borderRadius,
6652
+ display: "flex",
6653
+ alignItems: "center",
6654
+ justifyContent: "center",
6655
+ a: {
6656
+ color: token.colorPrimary,
6657
+ fontWeight: token.fontWeightStrong,
6658
+ fontSize: token.fontSize,
6659
+ lineHeight: "22px",
6660
+ display: "flex",
6661
+ alignItems: "center",
6662
+ justifyContent: "center",
6663
+ height: "100%"
6664
+ }
6665
+ },
6666
+ ".ant-pagination-item": {
6667
+ borderRadius: token.borderRadius,
6668
+ minWidth: 32,
6669
+ height: 32,
6670
+ lineHeight: "32px",
6671
+ a: {
6672
+ color: token.colorText,
6673
+ fontWeight: 400,
6674
+ fontSize: token.fontSize
6675
+ }
6676
+ },
6677
+ ".ant-pagination-prev .ant-pagination-item-link, .ant-pagination-next .ant-pagination-item-link": {
6678
+ borderRadius: token.borderRadius,
6679
+ width: 32,
6680
+ height: 32,
6681
+ display: "flex",
6682
+ alignItems: "center",
6683
+ justifyContent: "center",
6684
+ border: "none",
6685
+ background: "transparent"
6686
+ }
5229
6687
  }
5230
6688
  }));
5231
- return wrapSSR(/* @__PURE__ */ jsxs("div", {
5232
- className: cx("root"),
6689
+ const mobileTagsList = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
6690
+ className: cx("body-mobile"),
6691
+ children: paginatedTags.map((tag, index) => {
6692
+ return /* @__PURE__ */ jsxs("div", {
6693
+ className: cx("tag-row-mobile", index === paginatedTags.length - 1 ? "tag-row-mobile-last" : ""),
6694
+ children: [/* @__PURE__ */ jsxs("div", {
6695
+ className: cx("tag-info-mobile"),
6696
+ children: [/* @__PURE__ */ jsxs("div", {
6697
+ className: cx("tag-col-mobile"),
6698
+ children: [/* @__PURE__ */ jsx("span", {
6699
+ className: cx("col-label"),
6700
+ style: {
6701
+ fontSize: token.fontSize,
6702
+ lineHeight: "20px"
6703
+ },
6704
+ children: "Tag Name:"
6705
+ }), /* @__PURE__ */ jsx("span", {
6706
+ className: cx("col-value"),
6707
+ style: {
6708
+ fontSize: token.fontSize,
6709
+ lineHeight: "20px",
6710
+ overflow: "hidden",
6711
+ textOverflow: "ellipsis",
6712
+ whiteSpace: "nowrap"
6713
+ },
6714
+ children: tag.name
6715
+ })]
6716
+ }), /* @__PURE__ */ jsxs("div", {
6717
+ className: cx("tag-col-mobile"),
6718
+ children: [/* @__PURE__ */ jsx("span", {
6719
+ className: cx("col-label"),
6720
+ style: {
6721
+ fontSize: token.fontSize,
6722
+ lineHeight: "20px"
6723
+ },
6724
+ children: "Description:"
6725
+ }), /* @__PURE__ */ jsx(Tooltip, {
6726
+ title: tag.description && tag.description.length > 20 ? tag.description : "",
6727
+ children: /* @__PURE__ */ jsx("span", {
6728
+ className: cx("col-value"),
6729
+ style: {
6730
+ fontSize: token.fontSize,
6731
+ lineHeight: "20px",
6732
+ overflow: "hidden",
6733
+ textOverflow: "ellipsis",
6734
+ whiteSpace: "nowrap",
6735
+ maxWidth: 140,
6736
+ display: "block"
6737
+ },
6738
+ children: tag.description ?? "-"
6739
+ })
6740
+ })]
6741
+ })]
6742
+ }), /* @__PURE__ */ jsxs("div", {
6743
+ className: cx("tag-actions"),
6744
+ style: {
6745
+ paddingTop: 6,
6746
+ flexShrink: 0
6747
+ },
6748
+ children: [/* @__PURE__ */ jsx(Tooltip, {
6749
+ title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
6750
+ children: /* @__PURE__ */ jsx(Button, {
6751
+ danger: true,
6752
+ type: "text",
6753
+ icon: /* @__PURE__ */ jsx(Trash, {
6754
+ width: 32,
6755
+ height: 32
6756
+ }),
6757
+ disabled: tag.isDefault,
6758
+ onClick: () => !tag.isDefault && onDeleteTag?.(tag.name),
6759
+ style: {
6760
+ width: 40,
6761
+ height: 40,
6762
+ padding: 0,
6763
+ lineHeight: 1
6764
+ }
6765
+ })
6766
+ }), /* @__PURE__ */ jsx(Tooltip, {
6767
+ title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
6768
+ children: /* @__PURE__ */ jsx(Button, {
6769
+ icon: /* @__PURE__ */ jsx(EditTag, {}),
6770
+ disabled: tag.isDefault,
6771
+ onClick: () => !tag.isDefault && onEditTag?.(tag),
6772
+ style: {
6773
+ width: 32,
6774
+ height: 32,
6775
+ padding: 0,
6776
+ lineHeight: 1,
6777
+ ...!tag.isDefault && { color: "#A146B3" }
6778
+ }
6779
+ })
6780
+ })]
6781
+ })]
6782
+ }, tag.name);
6783
+ })
6784
+ }), tags.length > TAGS_PAGE_SIZE && /* @__PURE__ */ jsx(Pagination, {
6785
+ current: safePage,
6786
+ pageSize: TAGS_PAGE_SIZE,
6787
+ total: tags.length,
6788
+ onChange: setCurrentPage,
6789
+ showSizeChanger: false,
6790
+ className: cx("pagination")
6791
+ })] });
6792
+ return wrapSSR(isMobile ? /* @__PURE__ */ jsxs("div", {
6793
+ style: { width: "100%" },
5233
6794
  children: [/* @__PURE__ */ jsxs("div", {
5234
- className: cx("head"),
6795
+ className: cx("head-collapse"),
5235
6796
  children: [/* @__PURE__ */ jsx(Title, {
5236
6797
  level: 4,
5237
6798
  style: {
@@ -5240,7 +6801,11 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
5240
6801
  },
5241
6802
  children: "Tags"
5242
6803
  }), /* @__PURE__ */ jsxs("div", {
5243
- className: cx("head-actions"),
6804
+ style: {
6805
+ display: "flex",
6806
+ alignItems: "center",
6807
+ gap: token.marginXS
6808
+ },
5244
6809
  children: [/* @__PURE__ */ jsx(Button, {
5245
6810
  ghost: true,
5246
6811
  type: "primary",
@@ -5259,215 +6824,156 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
5259
6824
  }
5260
6825
  })]
5261
6826
  })]
5262
- }), !collapsed && (isMobile ? /* @__PURE__ */ jsx("div", {
5263
- className: cx("body-mobile"),
5264
- children: tags.map((tag, index) => {
5265
- return /* @__PURE__ */ jsxs("div", {
5266
- className: cx("tag-row-mobile", index === tags.length - 1 ? "tag-row-mobile-last" : ""),
5267
- children: [/* @__PURE__ */ jsxs("div", {
5268
- className: cx("tag-info-mobile"),
6827
+ }), !collapsed && /* @__PURE__ */ jsx("div", {
6828
+ className: cx("body-collapse"),
6829
+ children: mobileTagsList
6830
+ })]
6831
+ }) : /* @__PURE__ */ jsxs("div", {
6832
+ className: cx("root"),
6833
+ children: [
6834
+ /* @__PURE__ */ jsxs("div", {
6835
+ className: cx("head"),
6836
+ children: [/* @__PURE__ */ jsx(Title, {
6837
+ level: 4,
6838
+ style: {
6839
+ margin: 0,
6840
+ color: token.colorTextHeading
6841
+ },
6842
+ children: "Tags"
6843
+ }), /* @__PURE__ */ jsx(Button, {
6844
+ ghost: true,
6845
+ type: "primary",
6846
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
6847
+ onClick: onAddTag,
6848
+ style: { borderRadius: token.borderRadius },
6849
+ children: "Add Tag"
6850
+ })]
6851
+ }),
6852
+ /* @__PURE__ */ jsx("div", {
6853
+ className: cx("tags-list"),
6854
+ children: paginatedTags.map((tag, index) => {
6855
+ return /* @__PURE__ */ jsxs("div", {
6856
+ className: cx("tag-row", index === paginatedTags.length - 1 ? "tag-row-last" : ""),
5269
6857
  children: [/* @__PURE__ */ jsxs("div", {
5270
- className: cx("tag-col-mobile"),
5271
- children: [/* @__PURE__ */ jsx("span", {
5272
- className: cx("col-label"),
5273
- style: {
5274
- fontSize: token.fontSize,
5275
- lineHeight: "20px"
5276
- },
5277
- children: "Tag Name:"
5278
- }), /* @__PURE__ */ jsx("span", {
5279
- className: cx("col-value"),
5280
- style: {
5281
- fontSize: token.fontSize,
5282
- lineHeight: "20px",
5283
- overflow: "hidden",
5284
- textOverflow: "ellipsis",
5285
- whiteSpace: "nowrap"
5286
- },
5287
- children: tag.name
5288
- })]
5289
- }), /* @__PURE__ */ jsxs("div", {
5290
- className: cx("tag-col-mobile"),
5291
- children: [/* @__PURE__ */ jsx("span", {
5292
- className: cx("col-label"),
5293
- style: {
5294
- fontSize: token.fontSize,
5295
- lineHeight: "20px"
5296
- },
5297
- children: "Description:"
5298
- }), /* @__PURE__ */ jsx(Tooltip, {
5299
- title: tag.description && tag.description.length > 20 ? tag.description : "",
5300
- children: /* @__PURE__ */ jsx("span", {
5301
- className: cx("col-value"),
5302
- style: {
5303
- fontSize: token.fontSize,
5304
- lineHeight: "20px",
5305
- overflow: "hidden",
5306
- textOverflow: "ellipsis",
5307
- whiteSpace: "nowrap",
5308
- maxWidth: 140,
5309
- display: "block"
5310
- },
5311
- children: tag.description ?? "-"
5312
- })
5313
- })]
5314
- })]
5315
- }), /* @__PURE__ */ jsxs("div", {
5316
- className: cx("tag-actions"),
5317
- style: {
5318
- paddingTop: 6,
5319
- flexShrink: 0
5320
- },
5321
- children: [/* @__PURE__ */ jsx(Tooltip, {
5322
- title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
5323
- children: /* @__PURE__ */ jsx(Button, {
5324
- danger: true,
5325
- type: "text",
5326
- icon: /* @__PURE__ */ jsx(Trash, {
5327
- width: 32,
5328
- height: 32
5329
- }),
5330
- disabled: tag.isDefault,
5331
- onClick: () => !tag.isDefault && onDeleteTag?.(tag.name),
5332
- style: {
5333
- width: 40,
5334
- height: 40,
5335
- padding: 0,
5336
- lineHeight: 1
5337
- }
5338
- })
5339
- }), /* @__PURE__ */ jsx(Tooltip, {
5340
- title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
5341
- children: /* @__PURE__ */ jsx(Button, {
5342
- icon: /* @__PURE__ */ jsx(EditOutlined, { style: { fontSize: 18 } }),
5343
- disabled: tag.isDefault,
5344
- onClick: () => !tag.isDefault && onEditTag?.(tag),
5345
- style: {
5346
- width: 32,
5347
- height: 32,
5348
- padding: 0,
5349
- lineHeight: 1
5350
- }
5351
- })
5352
- })]
5353
- })]
5354
- }, tag.name);
5355
- })
5356
- }) : /* @__PURE__ */ jsx("div", {
5357
- className: cx("body"),
5358
- children: tags.map((tag, index) => {
5359
- return /* @__PURE__ */ jsxs("div", {
5360
- className: cx("tag-row", index === tags.length - 1 ? "tag-row-last" : ""),
5361
- children: [/* @__PURE__ */ jsxs("div", {
5362
- className: cx("tag-info"),
5363
- children: [
5364
- /* @__PURE__ */ jsxs("div", {
5365
- className: cx("tag-col"),
5366
- style: { width: 200 },
5367
- children: [/* @__PURE__ */ jsx("span", {
5368
- className: cx("col-label"),
5369
- children: "Tag Name"
5370
- }), /* @__PURE__ */ jsx("span", {
5371
- className: cx("col-value"),
5372
- children: tag.name
5373
- })]
5374
- }),
5375
- /* @__PURE__ */ jsxs("div", {
5376
- className: cx("tag-col"),
5377
- style: { width: 280 },
5378
- children: [/* @__PURE__ */ jsx("span", {
5379
- className: cx("col-label"),
5380
- children: "Description"
5381
- }), /* @__PURE__ */ jsx(Tooltip, {
5382
- title: tag.description && tag.description.length > 30 ? tag.description : "",
5383
- children: /* @__PURE__ */ jsx("span", {
6858
+ className: cx("tag-info"),
6859
+ children: [
6860
+ /* @__PURE__ */ jsxs("div", {
6861
+ className: cx("tag-col"),
6862
+ style: { width: 200 },
6863
+ children: [/* @__PURE__ */ jsx("span", {
6864
+ className: cx("col-label"),
6865
+ children: "Tag Name"
6866
+ }), /* @__PURE__ */ jsx("span", {
5384
6867
  className: cx("col-value"),
5385
- style: {
5386
- overflow: "hidden",
5387
- textOverflow: "ellipsis",
5388
- whiteSpace: "nowrap",
5389
- maxWidth: 280,
5390
- display: "block"
5391
- },
5392
- children: tag.description ?? "-"
5393
- })
5394
- })]
5395
- }),
5396
- /* @__PURE__ */ jsxs("div", {
5397
- className: cx("tag-col"),
5398
- style: {
5399
- flex: 1,
5400
- minWidth: 0
5401
- },
5402
- children: [/* @__PURE__ */ jsx("span", {
5403
- className: cx("col-label"),
5404
- children: "External Docs"
5405
- }), tag.externalDocsUrl ? /* @__PURE__ */ jsx(Tooltip, {
5406
- title: tag.externalDocsUrl.length > 25 ? tag.externalDocsUrl : "",
5407
- children: /* @__PURE__ */ jsx("a", {
5408
- href: tag.externalDocsUrl,
5409
- target: "_blank",
5410
- rel: "noreferrer",
5411
- className: cx("col-value-link"),
5412
- style: {
5413
- overflow: "hidden",
5414
- textOverflow: "ellipsis",
5415
- whiteSpace: "nowrap",
5416
- display: "block"
5417
- },
5418
- children: tag.externalDocsUrl
5419
- })
5420
- }) : /* @__PURE__ */ jsx("span", {
5421
- className: cx("col-value"),
5422
- children: "-"
5423
- })]
5424
- })
5425
- ]
5426
- }), /* @__PURE__ */ jsxs("div", {
5427
- className: cx("tag-actions"),
5428
- children: [/* @__PURE__ */ jsx(Tooltip, {
5429
- title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
5430
- children: /* @__PURE__ */ jsx(Button, {
5431
- danger: true,
5432
- type: "text",
5433
- icon: /* @__PURE__ */ jsx(Trash, {
5434
- width: 32,
5435
- height: 32
6868
+ children: tag.name
6869
+ })]
6870
+ }),
6871
+ /* @__PURE__ */ jsxs("div", {
6872
+ className: cx("tag-col"),
6873
+ style: { width: 280 },
6874
+ children: [/* @__PURE__ */ jsx("span", {
6875
+ className: cx("col-label"),
6876
+ children: "Description"
6877
+ }), /* @__PURE__ */ jsx(Tooltip, {
6878
+ title: tag.description && tag.description.length > 30 ? tag.description : "",
6879
+ children: /* @__PURE__ */ jsx("span", {
6880
+ className: cx("col-value"),
6881
+ style: {
6882
+ overflow: "hidden",
6883
+ textOverflow: "ellipsis",
6884
+ whiteSpace: "nowrap",
6885
+ maxWidth: 280,
6886
+ display: "block"
6887
+ },
6888
+ children: tag.description ?? "-"
6889
+ })
6890
+ })]
5436
6891
  }),
5437
- disabled: tag.isDefault,
5438
- onClick: () => !tag.isDefault && onDeleteTag?.(tag.name),
5439
- style: {
5440
- width: 40,
5441
- height: 40,
5442
- padding: 0,
5443
- lineHeight: 1
5444
- }
5445
- })
5446
- }), /* @__PURE__ */ jsx(Tooltip, {
5447
- title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
5448
- children: /* @__PURE__ */ jsx(Button, {
5449
- icon: /* @__PURE__ */ jsx(EditOutlined, { style: { fontSize: 18 } }),
5450
- disabled: tag.isDefault,
5451
- onClick: () => !tag.isDefault && onEditTag?.(tag),
5452
- style: {
5453
- width: 32,
5454
- height: 32,
5455
- padding: 0,
5456
- lineHeight: 1
5457
- }
5458
- })
6892
+ /* @__PURE__ */ jsxs("div", {
6893
+ className: cx("tag-col"),
6894
+ style: {
6895
+ flex: 1,
6896
+ minWidth: 0
6897
+ },
6898
+ children: [/* @__PURE__ */ jsx("span", {
6899
+ className: cx("col-label"),
6900
+ children: "External Docs"
6901
+ }), tag.externalDocsUrl ? /* @__PURE__ */ jsx(Tooltip, {
6902
+ title: tag.externalDocsUrl.length > 25 ? tag.externalDocsUrl : "",
6903
+ children: /* @__PURE__ */ jsx("a", {
6904
+ href: tag.externalDocsUrl,
6905
+ target: "_blank",
6906
+ rel: "noreferrer",
6907
+ className: cx("col-value-link"),
6908
+ style: {
6909
+ overflow: "hidden",
6910
+ textOverflow: "ellipsis",
6911
+ whiteSpace: "nowrap",
6912
+ display: "block"
6913
+ },
6914
+ children: tag.externalDocsUrl
6915
+ })
6916
+ }) : /* @__PURE__ */ jsx("span", {
6917
+ className: cx("col-value"),
6918
+ children: "-"
6919
+ })]
6920
+ })
6921
+ ]
6922
+ }), /* @__PURE__ */ jsxs("div", {
6923
+ className: cx("tag-actions"),
6924
+ children: [/* @__PURE__ */ jsx(Tooltip, {
6925
+ title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
6926
+ children: /* @__PURE__ */ jsx(Button, {
6927
+ danger: true,
6928
+ type: "text",
6929
+ icon: /* @__PURE__ */ jsx(Trash, {
6930
+ width: 32,
6931
+ height: 32
6932
+ }),
6933
+ disabled: tag.isDefault,
6934
+ onClick: () => !tag.isDefault && onDeleteTag?.(tag.name),
6935
+ style: {
6936
+ width: 40,
6937
+ height: 40,
6938
+ padding: 0,
6939
+ lineHeight: 1
6940
+ }
6941
+ })
6942
+ }), /* @__PURE__ */ jsx(Tooltip, {
6943
+ title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
6944
+ children: /* @__PURE__ */ jsx(Button, {
6945
+ icon: /* @__PURE__ */ jsx(EditTag, {}),
6946
+ disabled: tag.isDefault,
6947
+ onClick: () => !tag.isDefault && onEditTag?.(tag),
6948
+ style: {
6949
+ width: 32,
6950
+ height: 32,
6951
+ padding: 0,
6952
+ lineHeight: 1,
6953
+ ...!tag.isDefault && { color: "#A146B3" }
6954
+ }
6955
+ })
6956
+ })]
5459
6957
  })]
5460
- })]
5461
- }, tag.name);
6958
+ }, tag.name);
6959
+ })
6960
+ }),
6961
+ tags.length > TAGS_PAGE_SIZE && /* @__PURE__ */ jsx(Pagination, {
6962
+ current: safePage,
6963
+ pageSize: TAGS_PAGE_SIZE,
6964
+ total: tags.length,
6965
+ onChange: setCurrentPage,
6966
+ showSizeChanger: false,
6967
+ className: cx("pagination")
5462
6968
  })
5463
- }))]
6969
+ ]
5464
6970
  }));
5465
6971
  };
5466
6972
  //#endregion
5467
6973
  //#region src/view/components/ApiPage/components/AddTagDrawer.tsx
5468
- const TAG_NAME_REGEX = /^[A-Za-z0-9_-]+$/;
5469
- const TAG_DESC_REGEX = /^[A-Za-z0-9_-]+$/;
5470
- const EXT_DESC_REGEX = /^[A-Za-z0-9_-]+$/;
6974
+ const TAG_NAME_REGEX = /^[A-Za-z0-9_\s-]+$/;
6975
+ const TAG_DESC_REGEX = /^[A-Za-z0-9_\s-]+$/;
6976
+ const EXTERNAL_DOCS_DESC_REGEX = /^[A-Za-z0-9_\s-]+$/;
5471
6977
  const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag }) => {
5472
6978
  const [form] = Form.useForm();
5473
6979
  const [messageApi, contextHolder] = message.useMessage();
@@ -5604,13 +7110,6 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
5604
7110
  if (open && mode === "edit" && initialValues) form.setFieldsValue(initialValues);
5605
7111
  if (!open) form.resetFields();
5606
7112
  }, [open]);
5607
- useEffect(() => {
5608
- if (!extDocsDesc?.trim()) form.setFields([{
5609
- name: "externalDocsLink",
5610
- value: void 0,
5611
- errors: []
5612
- }]);
5613
- }, [extDocsDesc]);
5614
7113
  useEffect(() => {
5615
7114
  if (extDocsDesc?.trim()) form.validateFields(["externalDocsLink"]).catch(() => {});
5616
7115
  }, [extDocsLink, extDocsDesc]);
@@ -5715,7 +7214,7 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
5715
7214
  },
5716
7215
  {
5717
7216
  pattern: TAG_NAME_REGEX,
5718
- message: "Only letters, numbers, underscores, and hyphens"
7217
+ message: "Only letters, numbers, spaces, underscores, and hyphens"
5719
7218
  }
5720
7219
  ],
5721
7220
  children: /* @__PURE__ */ jsx(Input, {
@@ -5736,10 +7235,10 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
5736
7235
  rules: [{
5737
7236
  max: 50,
5738
7237
  message: "Maximum 50 characters"
5739
- }, { validator: (_, value) => {
5740
- if (!value || TAG_DESC_REGEX.test(value)) return Promise.resolve();
5741
- return Promise.reject(/* @__PURE__ */ new Error("Only letters, numbers, underscores, and hyphens"));
5742
- } }],
7238
+ }, {
7239
+ pattern: TAG_DESC_REGEX,
7240
+ message: "Only letters, numbers, spaces, _ and - allowed"
7241
+ }],
5743
7242
  children: /* @__PURE__ */ jsx(Input.TextArea, {
5744
7243
  showCount: true,
5745
7244
  maxLength: 50,
@@ -5759,14 +7258,21 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
5759
7258
  rules: [{
5760
7259
  max: 25,
5761
7260
  message: "Maximum 25 characters"
5762
- }, { validator: (_, value) => {
5763
- if (!value || EXT_DESC_REGEX.test(value)) return Promise.resolve();
5764
- return Promise.reject(/* @__PURE__ */ new Error("Only letters, numbers, underscores, and hyphens"));
5765
- } }],
7261
+ }, {
7262
+ pattern: EXTERNAL_DOCS_DESC_REGEX,
7263
+ message: "Only letters, numbers, spaces, _ and - allowed"
7264
+ }],
5766
7265
  children: /* @__PURE__ */ jsx(Input, {
5767
7266
  showCount: true,
5768
7267
  maxLength: 25,
5769
- placeholder: "Describe External Docs"
7268
+ placeholder: "Describe External Docs",
7269
+ onChange: (e) => {
7270
+ if (!e.target.value?.trim()) form.setFields([{
7271
+ name: "externalDocsLink",
7272
+ value: void 0,
7273
+ errors: []
7274
+ }]);
7275
+ }
5770
7276
  })
5771
7277
  }),
5772
7278
  /* @__PURE__ */ jsx(Form.Item, {
@@ -5777,8 +7283,8 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
5777
7283
  children: "External Docs Link"
5778
7284
  }),
5779
7285
  rules: [{
5780
- max: 512,
5781
- message: "Maximum 512 characters"
7286
+ max: 500,
7287
+ message: "Maximum 500 characters"
5782
7288
  }, { validator: async () => {
5783
7289
  const desc = form.getFieldValue("externalDocsDescription");
5784
7290
  const link = form.getFieldValue("externalDocsLink");
@@ -5791,19 +7297,11 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
5791
7297
  return Promise.reject(/* @__PURE__ */ new Error("Please enter a valid URL"));
5792
7298
  }
5793
7299
  } }],
5794
- children: /* @__PURE__ */ jsx(Tooltip, {
5795
- title: !isLinkEnabled ? "You need to add the External Docs Description first." : "",
5796
- color: "rgba(0,0,0,0.85)",
5797
- placement: "topLeft",
5798
- children: /* @__PURE__ */ jsx(Input, {
5799
- showCount: true,
5800
- maxLength: 512,
5801
- placeholder: "External Docs Link",
5802
- disabled: !isLinkEnabled,
5803
- onChange: (e) => {
5804
- form.setFieldValue("externalDocsLink", e.target.value);
5805
- }
5806
- })
7300
+ children: /* @__PURE__ */ jsx(Input, {
7301
+ showCount: true,
7302
+ maxLength: 500,
7303
+ placeholder: "External Docs Link",
7304
+ disabled: !isLinkEnabled
5807
7305
  })
5808
7306
  })
5809
7307
  ]
@@ -5880,6 +7378,251 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
5880
7378
  })
5881
7379
  ] }));
5882
7380
  };
7381
+ //#endregion
7382
+ //#region src/assets/icons/restApi.tsx
7383
+ const RestApiIcon = (props) => /* @__PURE__ */ jsxs("svg", {
7384
+ width: "16",
7385
+ height: "16",
7386
+ viewBox: "0 0 16 16",
7387
+ fill: "none",
7388
+ xmlns: "http://www.w3.org/2000/svg",
7389
+ ...props,
7390
+ children: [/* @__PURE__ */ jsxs("g", {
7391
+ clipPath: "url(#restapi-clip)",
7392
+ children: [
7393
+ /* @__PURE__ */ jsx("path", {
7394
+ d: "M14.4059 7.73805H13.2601V7.23565C13.2601 7.11607 13.1787 7.01187 13.0626 6.98294L12.2915 6.79083L11.8883 5.81794L12.2975 5.13716C12.3591 5.03469 12.343 4.90341 12.2585 4.81888L11.1795 3.73987C11.0949 3.65531 10.9636 3.63922 10.8612 3.70081L10.1804 4.11003L9.20745 3.70685L9.01534 2.9357C8.98644 2.81966 8.88222 2.73823 8.76264 2.73823H8.26032V1.59245C8.26032 1.44862 8.14373 1.33203 7.9999 1.33203C7.85607 1.33203 7.73949 1.44862 7.73949 1.59245V2.73823H7.23709C7.11751 2.73823 7.01331 2.81966 6.98438 2.9357L6.79227 3.70685L5.81938 4.11003L5.1386 3.70081C5.03607 3.63919 4.90485 3.65529 4.82032 3.73987L3.74131 4.81888C3.65675 4.90344 3.64066 5.03471 3.70225 5.13716L4.11146 5.81794L3.70829 6.79083L2.93714 6.98294C2.8211 7.01185 2.73967 7.11607 2.73967 7.23565V7.73805H1.59391C1.45008 7.73805 1.3335 7.85463 1.3335 7.99846C1.3335 8.14226 1.45008 8.25888 1.59391 8.25888H2.73969V8.76128C2.73969 8.88086 2.82113 8.98508 2.93717 9.01396L3.70831 9.20609L4.11149 10.179L3.70225 10.8598C3.64063 10.9623 3.65675 11.0935 3.74131 11.1781L4.82032 12.2571C4.90488 12.3416 5.03615 12.3577 5.13865 12.2961L5.81941 11.8869L6.79232 12.2901L6.98443 13.0612C7.01334 13.1773 7.11756 13.2587 7.23714 13.2587H7.73951V14.4045C7.73951 14.5483 7.8561 14.6649 7.99993 14.6649C8.14376 14.6649 8.26034 14.5483 8.26034 14.4045V13.2587H8.76274C8.88232 13.2587 8.98652 13.1773 9.01545 13.0612L9.20756 12.2901L10.1805 11.8869L10.8612 12.2961C10.9637 12.3577 11.095 12.3416 11.1796 12.2571L12.2586 11.1781C12.3431 11.0935 12.3592 10.9622 12.2976 10.8598L11.8884 10.179L12.2916 9.20609L13.0627 9.01396C13.1788 8.98508 13.2602 8.88086 13.2602 8.76128V8.25888H14.406C14.5498 8.25888 14.6664 8.14226 14.6664 7.99846C14.6663 7.85463 14.5497 7.73805 14.4059 7.73805ZM12.7393 8.55779L12.0382 8.73247C11.9581 8.75245 11.8922 8.80919 11.8606 8.88547L11.3569 10.1009C11.3253 10.1772 11.3318 10.264 11.3743 10.3348L11.7463 10.9537L10.9551 11.7449L10.3362 11.3729C10.2654 11.3303 10.1786 11.3239 10.1023 11.3555L8.88686 11.8592C8.81058 11.8909 8.75383 11.9567 8.73386 12.0369L8.5592 12.7379H7.44055L7.26589 12.0369C7.24592 11.9567 7.18917 11.8909 7.1129 11.8592L5.89743 11.3555C5.82113 11.3239 5.73435 11.3303 5.66355 11.3729L5.04464 11.7449L4.25342 10.9537L4.62545 10.3348C4.668 10.264 4.67443 10.1772 4.64282 10.1009L4.13912 8.88547C4.10751 8.80919 4.04159 8.75245 3.96149 8.73247L3.26045 8.55779V7.43914L3.96152 7.26448C4.04162 7.2445 4.10753 7.18776 4.13915 7.11148L4.64284 5.89602C4.67446 5.81971 4.668 5.73294 4.62548 5.66216L4.25344 5.04325L5.04467 4.25203L5.66357 4.62406C5.73435 4.66661 5.82113 4.67307 5.89743 4.64143L7.1129 4.13773C7.18917 4.10612 7.24592 4.04021 7.26589 3.9601L7.44055 3.25904H8.5592L8.73386 3.9601C8.75383 4.04021 8.81058 4.10612 8.88686 4.13773L10.1023 4.64143C10.1787 4.67305 10.2654 4.66659 10.3362 4.62406L10.9551 4.25203L11.7463 5.04325L11.3743 5.66216C11.3317 5.73294 11.3253 5.81971 11.3569 5.89602L11.8606 7.11148C11.8922 7.18776 11.9581 7.2445 12.0382 7.26448L12.7393 7.43914V8.55779Z",
7395
+ fill: "currentColor"
7396
+ }),
7397
+ /* @__PURE__ */ jsx("path", {
7398
+ d: "M9.14809 4.86755C9.01309 4.81807 8.86346 4.88729 8.8139 5.02229C8.76434 5.15731 8.83364 5.30692 8.96864 5.35648C10.0712 5.76114 10.8121 6.82252 10.8121 7.99757C10.8121 9.54835 9.55041 10.81 7.99965 10.81C6.4489 10.81 5.18729 9.54833 5.18729 7.99755C5.18729 6.88567 5.84426 5.87593 6.86098 5.42515C6.99247 5.36687 7.05179 5.21302 6.99348 5.08156C6.9352 4.9501 6.78132 4.89075 6.64989 4.94906C5.44505 5.48325 4.6665 6.67987 4.6665 7.99755C4.6665 9.83546 6.16176 11.3308 7.99971 11.3308C9.83765 11.3308 11.3329 9.83546 11.3329 7.99755C11.3329 6.605 10.4549 5.34713 9.14809 4.86755Z",
7399
+ fill: "currentColor"
7400
+ }),
7401
+ /* @__PURE__ */ jsx("path", {
7402
+ d: "M8.01348 4.66409L7.99967 4.66406C7.85585 4.66406 7.73926 4.78065 7.73926 4.92448C7.73926 5.06831 7.85585 5.1849 7.99967 5.1849L8.01194 5.18492C8.0122 5.18492 8.01246 5.18492 8.01272 5.18492C8.15618 5.18492 8.2727 5.06883 8.27314 4.92526C8.27355 4.78143 8.1573 4.6645 8.01348 4.66409Z",
7403
+ fill: "currentColor"
7404
+ }),
7405
+ /* @__PURE__ */ jsx("path", {
7406
+ d: "M9.81413 6.96094C9.6703 6.96094 9.55371 7.07753 9.55371 7.22135V8.73919C9.55371 8.883 9.6703 8.99961 9.81413 8.99961C9.95796 8.99961 10.0745 8.883 10.0745 8.73919V7.22133C10.0745 7.0775 9.95796 6.96094 9.81413 6.96094Z",
7407
+ fill: "currentColor"
7408
+ }),
7409
+ /* @__PURE__ */ jsx("path", {
7410
+ d: "M8.55132 6.96094H8.01481C7.87098 6.96094 7.75439 7.07753 7.75439 7.22135V7.74057V8.09581V8.73917C7.75439 8.88297 7.87098 8.99958 8.01481 8.99958C8.15864 8.99958 8.27523 8.88297 8.27523 8.73917V8.35622H8.55135C8.91463 8.35622 9.2102 8.06063 9.2102 7.69737V7.61979C9.21018 7.25648 8.91463 6.96094 8.55132 6.96094ZM8.68937 7.69734C8.68937 7.77346 8.62744 7.83539 8.55132 7.83539H8.2752V7.74055V7.48172H8.55132C8.62744 7.48172 8.68937 7.54365 8.68937 7.61977V7.69734Z",
7411
+ fill: "currentColor"
7412
+ }),
7413
+ /* @__PURE__ */ jsx("path", {
7414
+ d: "M7.47523 8.67635L6.80685 7.1187C6.76581 7.02297 6.67169 6.96094 6.56755 6.96094C6.46341 6.96094 6.3693 7.02297 6.32823 7.11867L5.65984 8.67633C5.60312 8.80849 5.6643 8.96161 5.79648 9.01831C5.92867 9.075 6.08177 9.01385 6.13849 8.88169L6.56755 7.88172L6.99664 8.88169C7.03898 8.98039 7.13508 9.0395 7.23607 9.0395C7.27031 9.0395 7.30515 9.03268 7.33862 9.01833C7.47078 8.96164 7.53195 8.80852 7.47523 8.67635Z",
7415
+ fill: "currentColor"
7416
+ }),
7417
+ /* @__PURE__ */ jsx("path", {
7418
+ d: "M13.7813 1.33203C13.2931 1.33203 12.896 1.72919 12.896 2.21742C12.896 2.3668 12.9333 2.50755 12.9989 2.63107L12.0025 3.62737C11.9008 3.72906 11.9008 3.89396 12.0025 3.99565C12.0534 4.04648 12.1201 4.0719 12.1867 4.0719C12.2533 4.0719 12.32 4.04648 12.3708 3.99562L13.367 2.99951C13.4907 3.06531 13.6317 3.10279 13.7813 3.10279C14.2695 3.10279 14.6667 2.70562 14.6667 2.2174C14.6667 1.72917 14.2696 1.33203 13.7813 1.33203Z",
7419
+ fill: "currentColor"
7420
+ }),
7421
+ /* @__PURE__ */ jsx("path", {
7422
+ d: "M3.99712 12.002C3.89542 11.9004 3.73053 11.9004 3.62886 12.002L2.6329 12.998C2.50925 12.9323 2.36837 12.8949 2.21889 12.8949C1.73066 12.8949 1.3335 13.2921 1.3335 13.7803C1.3335 14.2685 1.73066 14.6657 2.21889 14.6657C2.70712 14.6657 3.10428 14.2685 3.10428 13.7803C3.10428 13.6308 3.06688 13.4899 3.00118 13.3663L3.99714 12.3703C4.09881 12.2686 4.09881 12.1037 3.99712 12.002Z",
7423
+ fill: "currentColor"
7424
+ }),
7425
+ /* @__PURE__ */ jsx("path", {
7426
+ d: "M12.3711 12.0021C12.3224 11.9536 12.2552 11.9258 12.1867 11.9258C12.1182 11.9258 12.051 11.9536 12.0026 12.0021C11.9541 12.0505 11.9263 12.1177 11.9263 12.1862C11.9263 12.2547 11.9541 12.3219 12.0026 12.3703C12.051 12.4187 12.1182 12.4466 12.1867 12.4466C12.2554 12.4466 12.3224 12.4187 12.3711 12.3703C12.4195 12.3219 12.4471 12.2549 12.4471 12.1862C12.4471 12.1177 12.4195 12.0505 12.3711 12.0021Z",
7427
+ fill: "currentColor"
7428
+ }),
7429
+ /* @__PURE__ */ jsx("path", {
7430
+ d: "M13.7813 12.8934C13.6316 12.8934 13.4906 12.9308 13.3669 12.9967L12.927 12.5567C12.8253 12.4551 12.6604 12.455 12.5587 12.5567C12.457 12.6584 12.457 12.8233 12.5587 12.925L12.9988 13.3651C12.9332 13.4887 12.8959 13.6294 12.8959 13.7788C12.8959 14.267 13.2931 14.6642 13.7813 14.6642C14.2695 14.6642 14.6666 14.267 14.6666 13.7788C14.6666 13.2905 14.2695 12.8934 13.7813 12.8934Z",
7431
+ fill: "currentColor"
7432
+ }),
7433
+ /* @__PURE__ */ jsx("path", {
7434
+ d: "M3.99712 3.62737L3.00118 2.63143C3.06688 2.50779 3.10428 2.3669 3.10428 2.21742C3.10428 1.72922 2.70712 1.33203 2.21889 1.33203C1.73066 1.33203 1.3335 1.72919 1.3335 2.21742C1.3335 2.70565 1.73066 3.10281 2.21889 3.10281C2.36839 3.10281 2.50928 3.06542 2.6329 2.99971L3.62886 3.99565C3.67972 4.04651 3.74636 4.07193 3.813 4.07193C3.87964 4.07193 3.94631 4.04651 3.99714 3.99565C4.09881 3.89396 4.09881 3.72906 3.99712 3.62737Z",
7435
+ fill: "currentColor"
7436
+ })
7437
+ ]
7438
+ }), /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", {
7439
+ id: "restapi-clip",
7440
+ children: /* @__PURE__ */ jsx("rect", {
7441
+ width: "13.3333",
7442
+ height: "13.3333",
7443
+ fill: "white",
7444
+ transform: "translate(1.3335 1.33203)"
7445
+ })
7446
+ }) })]
7447
+ });
7448
+ //#endregion
7449
+ //#region src/view/components/EditModeSidebar/index.tsx
7450
+ const EditModeSidebar = ({ selectedItem, onSelectItem, endpoints, hasGeneralError, hasSaveErrors }) => {
7451
+ const { wrapSSR, cx, token } = useStyle("EditModeSidebar", (token, scope) => ({
7452
+ [scope("root")]: {
7453
+ display: "flex",
7454
+ flexDirection: "column",
7455
+ gap: token.marginXS,
7456
+ padding: token.padding,
7457
+ backgroundColor: token.colorBgContainer,
7458
+ borderRadius: token.borderRadius,
7459
+ width: 320,
7460
+ minWidth: 320,
7461
+ flexShrink: 0,
7462
+ overflowY: "auto"
7463
+ },
7464
+ [scope("spec-icon")]: {
7465
+ fontSize: 16,
7466
+ color: token.colorTextSecondary,
7467
+ flexShrink: 0,
7468
+ display: "flex",
7469
+ alignItems: "center"
7470
+ },
7471
+ [scope("spec-label")]: {
7472
+ fontSize: token.fontSize,
7473
+ fontWeight: 400,
7474
+ color: token.colorText,
7475
+ lineHeight: "22px"
7476
+ },
7477
+ [scope("badge")]: {
7478
+ minWidth: "3.75rem",
7479
+ textAlign: "center",
7480
+ border: "none"
7481
+ },
7482
+ [scope("path")]: {
7483
+ fontSize: token.fontSize,
7484
+ fontWeight: 400,
7485
+ lineHeight: "22px",
7486
+ whiteSpace: "nowrap",
7487
+ overflow: "hidden",
7488
+ textOverflow: "ellipsis",
7489
+ flex: 1
7490
+ },
7491
+ [`${scope("root")} .ant-menu`]: {
7492
+ background: "transparent",
7493
+ border: "none",
7494
+ paddingInline: 0
7495
+ },
7496
+ [`${scope("root")} .ant-menu-item`]: {
7497
+ padding: `${token.paddingXS}px ${token.paddingLG}px`,
7498
+ borderRadius: token.borderRadius,
7499
+ height: "auto",
7500
+ lineHeight: "22px",
7501
+ display: "flex",
7502
+ alignItems: "center",
7503
+ gap: 12,
7504
+ marginInline: 0,
7505
+ marginBlock: 0,
7506
+ width: "100%",
7507
+ transition: "background-color 0.15s"
7508
+ },
7509
+ [`${scope("root")} .ant-menu-item:not(.ant-menu-item-selected):hover`]: { backgroundColor: token.colorFillTertiary },
7510
+ [`${scope("root")} .ant-menu-item-selected`]: { backgroundColor: token.colorPrimaryBg },
7511
+ [`${scope("root")} .ant-menu-item.error-active.ant-menu-item-selected`]: { backgroundColor: token.colorErrorBg },
7512
+ [`${scope("root")} .ant-menu-item-group-title`]: {
7513
+ fontSize: token.fontSize,
7514
+ fontWeight: 400,
7515
+ color: token.colorTextTertiary,
7516
+ lineHeight: "22px",
7517
+ paddingInline: 0,
7518
+ paddingTop: 0,
7519
+ paddingBottom: token.marginXXS,
7520
+ userSelect: "none"
7521
+ },
7522
+ [`${scope("root")} .ant-menu-item-group + .ant-menu-item-group`]: { marginTop: token.marginXS },
7523
+ [`${scope("spec-item")}:not(:last-child)`]: { marginBottom: token.marginXS },
7524
+ [`${scope("root")} .ant-menu-title-content`]: {
7525
+ overflow: "hidden",
7526
+ display: "flex",
7527
+ flex: 1,
7528
+ alignItems: "center",
7529
+ minWidth: 0,
7530
+ gap: 12
7531
+ },
7532
+ [`${scope("root")} .ant-menu-item-selected ${scope("spec-label")}`]: { color: token.colorPrimary }
7533
+ }));
7534
+ const selectedKeys = selectedItem.type === "endpoint" ? [selectedItem.key] : [selectedItem.type];
7535
+ const items = [{
7536
+ type: "group",
7537
+ label: "Specifications",
7538
+ children: [
7539
+ hasSaveErrors && {
7540
+ key: "errors",
7541
+ className: `${cx("spec-item")} error-active`,
7542
+ icon: /* @__PURE__ */ jsx("span", {
7543
+ className: cx("spec-icon"),
7544
+ style: { color: token.colorError },
7545
+ children: /* @__PURE__ */ jsx(ExclamationCircleOutlined, {})
7546
+ }),
7547
+ label: /* @__PURE__ */ jsx("span", {
7548
+ className: cx("spec-label"),
7549
+ style: { color: token.colorError },
7550
+ children: "Errors"
7551
+ })
7552
+ },
7553
+ {
7554
+ key: "general",
7555
+ className: cx("spec-item"),
7556
+ icon: /* @__PURE__ */ jsx("span", {
7557
+ className: cx("spec-icon"),
7558
+ style: hasGeneralError ? { color: token.colorError } : void 0,
7559
+ children: /* @__PURE__ */ jsx(RestApiIcon, {})
7560
+ }),
7561
+ label: /* @__PURE__ */ jsx("span", {
7562
+ className: cx("spec-label"),
7563
+ style: hasGeneralError ? { color: token.colorError } : void 0,
7564
+ children: "General"
7565
+ })
7566
+ },
7567
+ {
7568
+ key: "tags",
7569
+ className: cx("spec-item"),
7570
+ icon: /* @__PURE__ */ jsx("span", {
7571
+ className: cx("spec-icon"),
7572
+ children: /* @__PURE__ */ jsx(TagOutlined, {})
7573
+ }),
7574
+ label: /* @__PURE__ */ jsx("span", {
7575
+ className: cx("spec-label"),
7576
+ children: "Tags"
7577
+ })
7578
+ }
7579
+ ].filter(Boolean)
7580
+ }, {
7581
+ type: "group",
7582
+ label: "Endpoints",
7583
+ children: endpoints.map((ep) => {
7584
+ const colors = methodColors$1[ep.method];
7585
+ return {
7586
+ key: ep.id,
7587
+ label: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Tag, {
7588
+ className: cx("badge"),
7589
+ style: {
7590
+ backgroundColor: colors?.bg,
7591
+ color: colors?.color,
7592
+ border: "none"
7593
+ },
7594
+ children: ep.method
7595
+ }), /* @__PURE__ */ jsx("span", {
7596
+ className: cx("path"),
7597
+ style: { color: selectedItem.type === "endpoint" && selectedItem.key === ep.id ? token.colorPrimary : token.colorText },
7598
+ children: ep.path
7599
+ })] })
7600
+ };
7601
+ })
7602
+ }];
7603
+ const handleMenuClick = ({ key }) => {
7604
+ if (key === "errors") onSelectItem({ type: "errors" });
7605
+ else if (key === "general") onSelectItem({ type: "general" });
7606
+ else if (key === "tags") onSelectItem({ type: "tags" });
7607
+ else onSelectItem({
7608
+ type: "endpoint",
7609
+ key
7610
+ });
7611
+ };
7612
+ return wrapSSR(/* @__PURE__ */ jsx("div", {
7613
+ className: cx("root"),
7614
+ children: /* @__PURE__ */ jsx(Menu, {
7615
+ mode: "inline",
7616
+ selectedKeys,
7617
+ items,
7618
+ onClick: handleMenuClick,
7619
+ style: {
7620
+ background: "transparent",
7621
+ border: "none"
7622
+ }
7623
+ })
7624
+ }));
7625
+ };
5883
7626
  token.colorPrimary, token.colorSuccess, token.colorError, token.colorWarning, token["volcano.5"], token["geekblue.6"], token["purple.5"], token["volcano.4"];
5884
7627
  const darkerMethodColors = {
5885
7628
  GET: {
@@ -6321,10 +8064,7 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
6321
8064
  });
6322
8065
  if (isMobile) return wrapSSR(/* @__PURE__ */ jsx("aside", {
6323
8066
  className: cx("sider"),
6324
- style: {
6325
- width: "100%",
6326
- height: "100%"
6327
- },
8067
+ style: { height: "100%" },
6328
8068
  children: inner
6329
8069
  }));
6330
8070
  return wrapSSR(/* @__PURE__ */ jsx(Resizable, {
@@ -6352,6 +8092,47 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
6352
8092
  //#endregion
6353
8093
  //#region src/view/console/EndpointPage/EndpointPage.tsx
6354
8094
  const { Title: Title$1, Paragraph } = Typography;
8095
+ const MAX_VISIBLE_ENUMS = 2;
8096
+ const renderEnumTags = (enums, token) => {
8097
+ const tagStyle = {
8098
+ background: token.colorFillAlter,
8099
+ border: `1px solid ${token.colorBorder}`,
8100
+ borderRadius: token.borderRadiusSM
8101
+ };
8102
+ if (enums.length <= MAX_VISIBLE_ENUMS) return /* @__PURE__ */ jsx("span", {
8103
+ style: {
8104
+ display: "flex",
8105
+ flexWrap: "wrap",
8106
+ gap: token.marginXXS
8107
+ },
8108
+ children: enums.map((e) => /* @__PURE__ */ jsx(Tag, {
8109
+ style: tagStyle,
8110
+ children: e
8111
+ }, e))
8112
+ });
8113
+ const visible = enums.slice(0, MAX_VISIBLE_ENUMS);
8114
+ const hidden = enums.slice(MAX_VISIBLE_ENUMS);
8115
+ return /* @__PURE__ */ jsxs("span", {
8116
+ style: {
8117
+ display: "flex",
8118
+ flexWrap: "wrap",
8119
+ gap: token.marginXXS
8120
+ },
8121
+ children: [visible.map((e) => /* @__PURE__ */ jsx(Tag, {
8122
+ style: tagStyle,
8123
+ children: e
8124
+ }, e)), /* @__PURE__ */ jsx(Tooltip, {
8125
+ title: hidden.join(", "),
8126
+ children: /* @__PURE__ */ jsxs(Tag, {
8127
+ style: {
8128
+ ...tagStyle,
8129
+ cursor: "pointer"
8130
+ },
8131
+ children: ["+", hidden.length]
8132
+ })
8133
+ })]
8134
+ });
8135
+ };
6355
8136
  const requestColumns = [
6356
8137
  {
6357
8138
  title: "Parameter",
@@ -6394,7 +8175,7 @@ const buildRequestData = (params, token) => [...params].sort((a, b) => a.require
6394
8175
  })
6395
8176
  ] }),
6396
8177
  desc: p.description || "--",
6397
- enum: p.schema?.enum ? p.schema.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
8178
+ enum: p.schema?.enum ? renderEnumTags(p.schema.enum, token) : "--"
6398
8179
  };
6399
8180
  });
6400
8181
  const buildHeaderData = (headers, token) => {
@@ -6423,7 +8204,7 @@ const buildHeaderData = (headers, token) => {
6423
8204
  })
6424
8205
  ] }, idx),
6425
8206
  desc: header.description || "--",
6426
- enum: header.schema?.enum ? header.schema.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
8207
+ enum: header.schema?.enum ? renderEnumTags(header.schema.enum, token) : "--"
6427
8208
  };
6428
8209
  });
6429
8210
  };
@@ -6455,7 +8236,7 @@ const buildRequestBodyData = (requestBody, token) => {
6455
8236
  })
6456
8237
  ] }),
6457
8238
  desc: prop.description || "--",
6458
- enum: prop.enum ? prop.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
8239
+ enum: prop.enum ? renderEnumTags(prop.enum, token) : "--"
6459
8240
  }));
6460
8241
  };
6461
8242
  const EndpointPage = () => {
@@ -6497,8 +8278,7 @@ const EndpointPage = () => {
6497
8278
  ".ant-tabs-tab": { paddingTop: "0" }
6498
8279
  },
6499
8280
  "& .ant-table": { backgroundColor: `${token.colorBgBase} !important` },
6500
- "& .ant-table-thead > tr > th": { backgroundColor: `${token.colorBgBase} !important` },
6501
- "& .ant-table-tbody > tr > td": { backgroundColor: `${token.colorBgBase} !important` }
8281
+ "& .ant-table-thead > tr > th": { backgroundColor: `${token.colorBgBase} !important` }
6502
8282
  },
6503
8283
  [scope("row-odd")]: { "& > td": { background: `${token.colorBgElevated} !important` } },
6504
8284
  [scope("row-even")]: { "& > td": { background: `${token.colorBgLayout} !important` } }
@@ -6710,10 +8490,7 @@ const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage
6710
8490
  const { focusedContent, transformedData } = useStore(({ view }) => view);
6711
8491
  const { wrapSSR, cx, token } = useStyle("MainContent", (token, scope) => ({
6712
8492
  [scope("inner-doc-container")]: {
6713
- flex: 1,
6714
8493
  minWidth: 0,
6715
- height: "100%",
6716
- overflow: "auto",
6717
8494
  borderRadius: token.borderRadius,
6718
8495
  padding: token.paddingXL
6719
8496
  },
@@ -6819,13 +8596,7 @@ const Codebox$1 = ({ code, language, wrapLongLines }) => {
6819
8596
  const [appTheme] = useState("DARK");
6820
8597
  const { token, theme: themeConfig } = theme.useToken();
6821
8598
  const bodyBg = themeConfig.id == 1 ? token.colorBgContainer : "#1d2856";
6822
- const { cx } = useStyle("codeBox", (token, scope) => ({ [scope("codebox")]: {
6823
- borderRadius: token.borderRadius,
6824
- height: "100%",
6825
- maxHeight: "100%",
6826
- overflow: "auto",
6827
- pre: { height: "100%" }
6828
- } }));
8599
+ const { cx } = useStyle("codeBox", (token, scope) => ({ [scope("codebox")]: { borderRadius: token.borderRadius } }));
6829
8600
  return /* @__PURE__ */ jsx("div", {
6830
8601
  className: cx("codebox"),
6831
8602
  children: /* @__PURE__ */ jsx(Light, {
@@ -6837,7 +8608,6 @@ const Codebox$1 = ({ code, language, wrapLongLines }) => {
6837
8608
  customStyle: {
6838
8609
  margin: 0,
6839
8610
  minHeight: "3rem",
6840
- overflowY: "auto",
6841
8611
  padding: "0.75rem 1rem 0.75rem 1.5rem",
6842
8612
  backgroundColor: bodyBg,
6843
8613
  fontSize: "0.75rem"
@@ -6850,7 +8620,7 @@ const Codebox$1 = ({ code, language, wrapLongLines }) => {
6850
8620
  //#endregion
6851
8621
  //#region src/view/console/CodeboxSidebar.tsx
6852
8622
  function CodeboxSidebar$1() {
6853
- const { selectedEndpoint, selectedApi, activeRequestTab, selectedStatusCode, statusCodeOptions, setSelectedStatusCode } = useStore(({ view }) => view);
8623
+ const { selectedEndpoint, selectedApi, selectedStatusCode, statusCodeOptions, setSelectedStatusCode } = useStore(({ view }) => view);
6854
8624
  const httpStatusOptions = useMemo(() => statusCodeOptions.map((code) => ({
6855
8625
  value: code,
6856
8626
  label: /* @__PURE__ */ jsxs("span", {
@@ -6883,7 +8653,7 @@ function CodeboxSidebar$1() {
6883
8653
  const queryParams = params.filter((p) => p.in === "query");
6884
8654
  return [`curl --location '${serverUrl}${resolvedPath}${queryParams.length > 0 ? "?" + queryParams.map((p) => `${p.name}=sample-value`).join("&") : ""}'`, ...params.filter((p) => p.in === "header").map((p) => `--header '${p.name}: sample-value'`)];
6885
8655
  })();
6886
- const hasActiveTabParams = (selectedEndpoint?.parameters ?? []).some((p) => p.in === activeRequestTab);
8656
+ const hasAnyParams = (selectedEndpoint?.parameters ?? []).some((p) => p.in === "header" || p.in === "path" || p.in === "query");
6887
8657
  const { token: antdToken, theme: themeConfig } = theme.useToken();
6888
8658
  const isDark = themeConfig.id == 1;
6889
8659
  const headerBg = isDark ? antdToken.colorBgElevated : "#1d2856";
@@ -7005,7 +8775,7 @@ function CodeboxSidebar$1() {
7005
8775
  }));
7006
8776
  return /* @__PURE__ */ jsxs("div", {
7007
8777
  className: cx("container"),
7008
- children: [hasActiveTabParams && /* @__PURE__ */ jsxs("div", {
8778
+ children: [hasAnyParams && /* @__PURE__ */ jsxs("div", {
7009
8779
  className: cx("rightCard", "rightCardRequest"),
7010
8780
  children: [/* @__PURE__ */ jsxs("div", {
7011
8781
  className: cx("rightCardHeader"),
@@ -7105,6 +8875,18 @@ const transformOpenApiToDocs = (api) => {
7105
8875
  content: resolvedContent
7106
8876
  };
7107
8877
  }
8878
+ if (entry.responses) {
8879
+ const resolvedResponses = {};
8880
+ for (const [code, responseValue] of Object.entries(entry.responses)) if (responseValue.content) {
8881
+ const resolvedContent = {};
8882
+ for (const [contentType, contentValue] of Object.entries(responseValue.content)) resolvedContent[contentType] = { schema: resolveSchema(contentValue.schema, api.components) ?? contentValue.schema };
8883
+ resolvedResponses[code] = {
8884
+ ...responseValue,
8885
+ content: resolvedContent
8886
+ };
8887
+ } else resolvedResponses[code] = responseValue;
8888
+ entry.responses = resolvedResponses;
8889
+ }
7108
8890
  const matchedTags = (methodData.tags ?? []).filter((tag) => validTags.has(tag));
7109
8891
  if (matchedTags.length > 0) matchedTags.forEach((tag) => {
7110
8892
  if (!groupedPathsByTags[tag]) groupedPathsByTags[tag] = [];
@@ -7147,20 +8929,31 @@ const transformOpenApiToDocs = (api) => {
7147
8929
  const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onSave }) => {
7148
8930
  const [searchValue, setSearchValue] = useState("");
7149
8931
  const [mode, setMode] = useState("edit");
7150
- const [hasChanges, setHasChanges] = useState(false);
7151
8932
  const [bannerVisible, setBannerVisible] = useState(false);
7152
8933
  const [resetKey, setResetKey] = useState(0);
7153
- const [generalCollapsed, setGeneralCollapsed] = useState(false);
7154
- const [tagsCollapsed, setTagsCollapsed] = useState(false);
8934
+ const [generalCollapsed, setGeneralCollapsed] = useState(true);
8935
+ const [tagsCollapsed, setTagsCollapsed] = useState(true);
7155
8936
  const [endpointsCollapsed, setEndpointsCollapsed] = useState(false);
8937
+ const [saveConfirmModal, setSaveConfirmModal] = useState(false);
8938
+ const [resetConfirmModal, setResetConfirmModal] = useState(false);
8939
+ const [selectedEditItem, setSelectedEditItem] = useState({ type: "general" });
8940
+ const [errorBoxExpanded, setErrorBoxExpanded] = useState(false);
7156
8941
  const [localApiName, setLocalApiName] = useState("");
8942
+ const [apiNameTouched, setApiNameTouched] = useState(false);
7157
8943
  const [localDescription, setLocalDescription] = useState("");
8944
+ const [descriptionTouched, setDescriptionTouched] = useState(false);
8945
+ const hasApiNameError = apiNameTouched && (!localApiName.trim() || !/^[A-Za-z0-9_\s-]+$/.test(localApiName.trim()));
8946
+ const hasDescriptionError = descriptionTouched && !localDescription.trim();
8947
+ const hasGeneralError = hasApiNameError || hasDescriptionError;
8948
+ const [saveErrors, setSaveErrors] = useState([]);
7158
8949
  const [selectedUrl, setSelectedUrl] = useState("");
7159
8950
  const [endpointNames, setEndpointNames] = useState({});
7160
8951
  const [endpointDescs, setEndpointDescs] = useState({});
7161
8952
  const [endpointTags, setEndpointTags] = useState({});
7162
8953
  const [endpointParams, setEndpointParams] = useState({});
7163
8954
  const [endpointResponseParams, setEndpointResponseParams] = useState({});
8955
+ const [endpointRequestBody, setEndpointRequestBody] = useState({});
8956
+ const [endpointResponseBody, setEndpointResponseBody] = useState({});
7164
8957
  const [tagDrawerState, setTagDrawerState] = useState({
7165
8958
  open: false,
7166
8959
  mode: "add"
@@ -7171,11 +8964,12 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7171
8964
  });
7172
8965
  const [localTags, setLocalTags] = useState([]);
7173
8966
  const [messageApi, contextHolder] = message.useMessage();
7174
- const { focusedContent, selectedNodeKey, selectedApi, originalData, builtTreeData, selectedEndpoint, setOriginalData, setTransformedData, setBuiltTreeData, setFocusedContent, setExpandedKeys, setSelectedEndpoint } = useStore(({ view }) => view);
8967
+ const { focusedContent, selectedNodeKey, selectedApi, originalData, transformedData, builtTreeData, selectedEndpoint, setOriginalData, setTransformedData, setBuiltTreeData, setSelectedApi, setFocusedContent, setExpandedKeys, setSelectedEndpoint } = useStore(({ view }) => view);
7175
8968
  const { selectFirstApi, selectPreSelectedApi, clearSelection } = useNodeSelection();
7176
8969
  const hasInitializedRef = useRef(false);
7177
8970
  const { useBreakpoint } = Grid;
7178
8971
  const isMobile = !useBreakpoint().md;
8972
+ const allEndpoints = useMemo(() => selectedApi ? Object.values(selectedApi.tags ?? {}).flat() : [], [selectedApi]);
7179
8973
  useEffect(() => {
7180
8974
  return () => {
7181
8975
  resetStore();
@@ -7235,6 +9029,14 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7235
9029
  gap: token.marginLG,
7236
9030
  width: "100%"
7237
9031
  },
9032
+ [scope("content-scroll-area")]: {
9033
+ display: "grid",
9034
+ gridTemplateColumns: "minmax(0, 1fr) auto",
9035
+ flex: 1,
9036
+ gap: token.marginLG,
9037
+ overflow: "auto",
9038
+ minWidth: 0
9039
+ },
7238
9040
  [".delete-tag-confirm-modal .ant-modal-container"]: {
7239
9041
  "--ant-modal-content-padding": "0px !important",
7240
9042
  padding: "0 !important"
@@ -7313,15 +9115,18 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7313
9115
  }, [selectedApi]);
7314
9116
  const tagMetadata = useMemo(() => {
7315
9117
  if (!originalData || !selectedApi) return [];
7316
- const rawFile = originalData.find((f) => Object.keys(f.paths)[0] === selectedApi.contextPath);
7317
- if (!rawFile?.tags) return [];
7318
- return rawFile.tags.map((t) => ({
9118
+ const mapped = originalData.find((f) => Object.keys(f.paths)[0] === selectedApi.contextPath)?.tags?.map((t) => ({
7319
9119
  name: t.name,
7320
9120
  description: t.description,
7321
9121
  externalDocsUrl: t.externalDocs?.url,
7322
9122
  externalDocsDescription: t.externalDocs?.description,
7323
9123
  isDefault: t.name.toLowerCase() === "default"
7324
- }));
9124
+ })) ?? [];
9125
+ if (!mapped.some((t) => t.isDefault) && selectedApi.tags["default"]) mapped.push({
9126
+ name: "default",
9127
+ isDefault: true
9128
+ });
9129
+ return mapped;
7325
9130
  }, [originalData, selectedApi]);
7326
9131
  const initialEndpointResponseParams = useMemo(() => {
7327
9132
  if (!originalData || !selectedApi) return {};
@@ -7383,11 +9188,89 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7383
9188
  });
7384
9189
  return result;
7385
9190
  }, [originalData, selectedApi]);
9191
+ const initialEndpointRequestBody = useMemo(() => {
9192
+ if (!originalData || !selectedApi) return {};
9193
+ const rawFile = originalData.find((f) => Object.keys(f.paths)[0] === selectedApi.contextPath);
9194
+ if (!rawFile) return {};
9195
+ const pathMethodToId = {};
9196
+ Object.values(selectedApi.tags).flat().forEach((ep) => {
9197
+ pathMethodToId[`${ep.path}||${ep.method.toLowerCase()}`] = ep.id;
9198
+ });
9199
+ const result = {};
9200
+ Object.entries(rawFile.paths).forEach(([path, methods]) => {
9201
+ Object.entries(methods).forEach(([method, operation]) => {
9202
+ const schema = operation.requestBody?.content?.["application/json"]?.schema;
9203
+ const epId = pathMethodToId[`${path}||${method}`];
9204
+ if (epId && schema) result[epId] = schema;
9205
+ });
9206
+ });
9207
+ return result;
9208
+ }, [originalData, selectedApi]);
9209
+ const initialEndpointResponseBody = useMemo(() => {
9210
+ if (!originalData || !selectedApi) return {};
9211
+ const rawFile = originalData.find((f) => Object.keys(f.paths)[0] === selectedApi.contextPath);
9212
+ if (!rawFile) return {};
9213
+ const pathMethodToId = {};
9214
+ Object.values(selectedApi.tags).flat().forEach((ep) => {
9215
+ pathMethodToId[`${ep.path}||${ep.method.toLowerCase()}`] = ep.id;
9216
+ });
9217
+ const result = {};
9218
+ Object.entries(rawFile.paths).forEach(([path, methods]) => {
9219
+ Object.entries(methods).forEach(([method, operation]) => {
9220
+ const responses = operation.responses;
9221
+ if (!responses) return;
9222
+ const schema = responses["200" in responses ? "200" : Object.keys(responses)[0]]?.content?.["application/json"]?.schema;
9223
+ const epId = pathMethodToId[`${path}||${method}`];
9224
+ if (epId && schema) result[epId] = schema;
9225
+ });
9226
+ });
9227
+ return result;
9228
+ }, [originalData, selectedApi]);
9229
+ useEffect(() => {
9230
+ setLocalTags(tagMetadata);
9231
+ setEndpointParams(initialEndpointParams);
9232
+ setEndpointResponseParams(initialEndpointResponseParams);
9233
+ setEndpointRequestBody(initialEndpointRequestBody);
9234
+ setEndpointResponseBody(initialEndpointResponseBody);
9235
+ }, [selectedApi]);
9236
+ const hasChanges = useMemo(() => {
9237
+ if (!selectedApi) return false;
9238
+ if (localApiName !== (selectedApi.title || "")) return true;
9239
+ if (localDescription !== (selectedApi.description || "")) return true;
9240
+ if (JSON.stringify(localTags) !== JSON.stringify(tagMetadata)) return true;
9241
+ for (const [id, name] of Object.entries(endpointNames)) {
9242
+ const ep = allEndpoints.find((e) => e.id === id);
9243
+ if (ep && name !== (ep.summary ?? "")) return true;
9244
+ }
9245
+ for (const [id, desc] of Object.entries(endpointDescs)) {
9246
+ const ep = allEndpoints.find((e) => e.id === id);
9247
+ if (ep && desc !== (ep.description ?? "")) return true;
9248
+ }
9249
+ for (const [id, tags] of Object.entries(endpointTags)) {
9250
+ const ep = allEndpoints.find((e) => e.id === id);
9251
+ if (ep && JSON.stringify(tags) !== JSON.stringify(ep.tags ?? [])) return true;
9252
+ }
9253
+ if (JSON.stringify(endpointParams) !== JSON.stringify(initialEndpointParams)) return true;
9254
+ if (JSON.stringify(endpointResponseParams) !== JSON.stringify(initialEndpointResponseParams)) return true;
9255
+ return false;
9256
+ }, [
9257
+ selectedApi,
9258
+ localApiName,
9259
+ localDescription,
9260
+ localTags,
9261
+ tagMetadata,
9262
+ allEndpoints,
9263
+ endpointNames,
9264
+ endpointDescs,
9265
+ endpointTags,
9266
+ endpointParams,
9267
+ endpointResponseParams,
9268
+ initialEndpointParams,
9269
+ initialEndpointResponseParams
9270
+ ]);
7386
9271
  useEffect(() => {
7387
- setLocalTags(tagMetadata);
7388
- setEndpointParams(initialEndpointParams);
7389
- setEndpointResponseParams(initialEndpointResponseParams);
7390
- }, [selectedApi]);
9272
+ setBannerVisible(hasChanges);
9273
+ }, [hasChanges]);
7391
9274
  useEffect(() => {
7392
9275
  if (mode !== "view" || !selectedEndpoint) return;
7393
9276
  const epId = selectedEndpoint.id;
@@ -7438,7 +9321,6 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7438
9321
  isDefault: false
7439
9322
  };
7440
9323
  setLocalTags((prev) => [...prev, newTag]);
7441
- setHasChanges(true);
7442
9324
  setBannerVisible(true);
7443
9325
  };
7444
9326
  const handleUpdateTag = (updatedTag) => {
@@ -7450,7 +9332,6 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7450
9332
  externalDocsUrl: updatedTag.externalDocsLink,
7451
9333
  externalDocsDescription: updatedTag.externalDocsDescription
7452
9334
  } : t));
7453
- setHasChanges(true);
7454
9335
  setBannerVisible(true);
7455
9336
  };
7456
9337
  const handleDeleteTagConfirm = () => {
@@ -7460,7 +9341,6 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7460
9341
  open: false,
7461
9342
  tagName: ""
7462
9343
  });
7463
- setHasChanges(true);
7464
9344
  setBannerVisible(true);
7465
9345
  };
7466
9346
  const getEndpointsByTag = () => {
@@ -7480,8 +9360,10 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7480
9360
  return filtered;
7481
9361
  };
7482
9362
  const handleReset = () => {
7483
- setHasChanges(false);
7484
9363
  setBannerVisible(false);
9364
+ setApiNameTouched(false);
9365
+ setDescriptionTouched(false);
9366
+ setSaveErrors([]);
7485
9367
  setLocalApiName(selectedApi?.title ?? "");
7486
9368
  setLocalDescription(selectedApi?.description ?? "");
7487
9369
  setEndpointNames({});
@@ -7490,6 +9372,7 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7490
9372
  setEndpointParams(initialEndpointParams);
7491
9373
  setEndpointResponseParams(initialEndpointResponseParams);
7492
9374
  setResetKey((prev) => prev + 1);
9375
+ messageApi.success("Changes have been reset successfully.");
7493
9376
  };
7494
9377
  const handleSave = async () => {
7495
9378
  if (!selectedApi || !originalData) return;
@@ -7563,9 +9446,55 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7563
9446
  else delete methodObj["x-response-params"];
7564
9447
  }
7565
9448
  });
7566
- await onSave?.(cloned);
7567
- setHasChanges(false);
7568
- setBannerVisible(false);
9449
+ Object.entries(endpointRequestBody).forEach(([id, schema]) => {
9450
+ const loc = idToPathMethod[id];
9451
+ if (!loc) return;
9452
+ const pathEntry = cloned.paths[loc.path];
9453
+ if (!pathEntry) return;
9454
+ const methodObj = pathEntry[loc.method];
9455
+ if (!methodObj) return;
9456
+ const methodObjAny = methodObj;
9457
+ if (!methodObjAny.requestBody) methodObjAny.requestBody = {};
9458
+ const rb = methodObjAny.requestBody;
9459
+ if (!rb.content) rb.content = {};
9460
+ rb.content["application/json"] = { schema };
9461
+ });
9462
+ Object.entries(endpointResponseBody).forEach(([id, schema]) => {
9463
+ const loc = idToPathMethod[id];
9464
+ if (!loc) return;
9465
+ const pathEntry = cloned.paths[loc.path];
9466
+ if (!pathEntry) return;
9467
+ const methodObj = pathEntry[loc.method];
9468
+ if (!methodObj) return;
9469
+ const methodObjAny = methodObj;
9470
+ if (!methodObjAny.responses) return;
9471
+ const responses = methodObjAny.responses;
9472
+ const statusCode = "200" in responses ? "200" : Object.keys(responses)[0];
9473
+ if (!responses[statusCode]) return;
9474
+ if (!responses[statusCode].content) responses[statusCode].content = {};
9475
+ responses[statusCode].content["application/json"] = { schema };
9476
+ });
9477
+ try {
9478
+ await onSave?.(cloned);
9479
+ setBannerVisible(false);
9480
+ setSaveErrors([]);
9481
+ messageApi.success("Changes have been saved and published successfully.");
9482
+ setOriginalData(originalData.map((f) => Object.keys(f.paths)[0] === selectedApi.contextPath ? cloned : f));
9483
+ const newTransformed = [cloned].map(transformOpenApiToDocs)[0];
9484
+ const newTransformedData = (transformedData ?? []).map((t) => t.contextPath === selectedApi.contextPath ? newTransformed : t);
9485
+ setTransformedData(newTransformedData);
9486
+ setBuiltTreeData(buildTreeDataStructure(newTransformedData) ?? []);
9487
+ setSelectedApi(newTransformed);
9488
+ } catch (err) {
9489
+ let messages = [];
9490
+ if (err && typeof err === "object" && "errors" in err) {
9491
+ const e = err;
9492
+ messages = Array.isArray(e.errors) ? e.errors : [e.errors];
9493
+ } else if (err instanceof Error) messages = err.message.split("\n").filter(Boolean);
9494
+ else messages = [String(err)];
9495
+ setSaveErrors(messages);
9496
+ setSelectedEditItem({ type: "errors" });
9497
+ }
7569
9498
  };
7570
9499
  const handleResetSearch = () => {
7571
9500
  setSearchValue("");
@@ -7577,6 +9506,102 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7577
9506
  }
7578
9507
  window.location.pathname = "/";
7579
9508
  };
9509
+ useEffect(() => {
9510
+ setErrorBoxExpanded(false);
9511
+ }, [selectedEditItem]);
9512
+ const errorBox = saveErrors.length > 0 ? /* @__PURE__ */ jsxs("div", {
9513
+ style: {
9514
+ background: token.colorErrorBg,
9515
+ borderRadius: token.borderRadiusLG,
9516
+ padding: `${token.marginLG}px ${token.marginLG}px 48px`,
9517
+ width: "100%"
9518
+ },
9519
+ children: [
9520
+ /* @__PURE__ */ jsxs("div", {
9521
+ style: {
9522
+ display: "flex",
9523
+ alignItems: "center",
9524
+ gap: token.marginXS
9525
+ },
9526
+ children: [selectedEditItem.type !== "errors" && /* @__PURE__ */ jsx("button", {
9527
+ onClick: () => setErrorBoxExpanded((prev) => !prev),
9528
+ style: {
9529
+ display: "flex",
9530
+ alignItems: "center",
9531
+ background: "transparent",
9532
+ border: "none",
9533
+ cursor: "pointer",
9534
+ padding: 0,
9535
+ lineHeight: 1
9536
+ },
9537
+ "aria-label": "Collapse",
9538
+ children: /* @__PURE__ */ jsx(RightOutlined, { style: {
9539
+ fontSize: 14,
9540
+ color: token.colorError,
9541
+ transform: errorBoxExpanded ? "rotate(90deg)" : "none",
9542
+ transition: "transform 0.2s"
9543
+ } })
9544
+ }), /* @__PURE__ */ jsx(Title, {
9545
+ level: 3,
9546
+ style: {
9547
+ margin: 0,
9548
+ color: token.colorError
9549
+ },
9550
+ children: "Errors"
9551
+ })]
9552
+ }),
9553
+ /* @__PURE__ */ jsx("p", {
9554
+ style: {
9555
+ color: token.colorError,
9556
+ fontSize: 16,
9557
+ lineHeight: "24px",
9558
+ marginTop: token.marginXS,
9559
+ marginBottom: token.marginSM
9560
+ },
9561
+ children: "Failed to update the OpenAPI documentation. Please resolve the following issues:"
9562
+ }),
9563
+ /* @__PURE__ */ jsx(Divider, { style: { margin: `${token.marginSM}px 0` } }),
9564
+ /* @__PURE__ */ jsx("ol", {
9565
+ style: {
9566
+ paddingLeft: token.marginLG,
9567
+ margin: 0
9568
+ },
9569
+ children: saveErrors.map((msg, i) => /* @__PURE__ */ jsx("li", {
9570
+ style: {
9571
+ color: token.colorText,
9572
+ marginBottom: token.marginXS
9573
+ },
9574
+ children: msg
9575
+ }, i))
9576
+ })
9577
+ ]
9578
+ }) : null;
9579
+ const errorBoxCollapsed = saveErrors.length > 0 ? /* @__PURE__ */ jsxs("button", {
9580
+ onClick: () => setErrorBoxExpanded(true),
9581
+ style: {
9582
+ display: "flex",
9583
+ alignItems: "center",
9584
+ gap: token.marginXS,
9585
+ padding: `${token.paddingXS}px ${token.paddingLG}px`,
9586
+ background: token.colorErrorBg,
9587
+ borderRadius: token.borderRadiusLG,
9588
+ border: "none",
9589
+ cursor: "pointer",
9590
+ width: "100%",
9591
+ textAlign: "left"
9592
+ },
9593
+ children: [/* @__PURE__ */ jsx(RightOutlined, { style: {
9594
+ fontSize: 14,
9595
+ color: token.colorError
9596
+ } }), /* @__PURE__ */ jsx("span", {
9597
+ style: {
9598
+ color: token.colorError,
9599
+ fontSize: token.fontSizeLG,
9600
+ fontWeight: 600
9601
+ },
9602
+ children: "Errors"
9603
+ })]
9604
+ }) : null;
7580
9605
  const switcherNode = /* @__PURE__ */ jsxs("div", {
7581
9606
  style: {
7582
9607
  display: "flex",
@@ -7635,158 +9660,365 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7635
9660
  apiName: selectedApi?.title || "API",
7636
9661
  mode,
7637
9662
  onModeChange: setMode,
7638
- onReset: handleReset,
7639
- onSave: handleSave,
9663
+ onReset: () => setResetConfirmModal(true),
9664
+ onSave: () => setSaveConfirmModal(true),
7640
9665
  hasChanges,
9666
+ hasErrors: hasGeneralError,
7641
9667
  switcherNode: isMobile ? switcherNode : void 0
7642
9668
  })
7643
9669
  }),
7644
9670
  bannerVisible && /* @__PURE__ */ jsx(UnsavedChangesBanner, { onClose: () => setBannerVisible(false) }),
7645
- mode === "edit" ? /* @__PURE__ */ jsxs(Fragment, { children: [
7646
- /* @__PURE__ */ jsx("div", {
7647
- className: cx("section"),
7648
- children: /* @__PURE__ */ jsx(GeneralSection, {
7649
- apiName: localApiName,
7650
- authType: selectedApi?.authType || "",
7651
- version: selectedApi?.relatedVersions?.find((v) => v.apiId === selectedApi?.currentVersion)?.version || "",
7652
- description: localDescription,
7653
- onApiNameChange: setLocalApiName,
7654
- onDescriptionChange: setLocalDescription,
7655
- collapsed: generalCollapsed,
7656
- onToggleCollapse: () => setGeneralCollapsed((c) => !c),
7657
- onChangeDetected: () => {
7658
- setHasChanges(true);
7659
- setBannerVisible(true);
7660
- }
7661
- })
7662
- }),
7663
- /* @__PURE__ */ jsx("div", {
7664
- className: cx("section"),
7665
- children: /* @__PURE__ */ jsx(TagsSection, {
7666
- tags: localTags,
7667
- collapsed: tagsCollapsed,
7668
- onToggleCollapse: () => setTagsCollapsed((prev) => !prev),
7669
- onAddTag: () => setTagDrawerState({
7670
- open: true,
7671
- mode: "add"
9671
+ mode === "edit" ? /* @__PURE__ */ jsxs("div", {
9672
+ style: {
9673
+ display: "flex",
9674
+ gap: token.marginLG,
9675
+ flex: 1,
9676
+ minHeight: 0
9677
+ },
9678
+ children: [!isMobile && /* @__PURE__ */ jsx(EditModeSidebar, {
9679
+ selectedItem: selectedEditItem,
9680
+ onSelectItem: setSelectedEditItem,
9681
+ endpoints: allEndpoints,
9682
+ hasGeneralError,
9683
+ hasSaveErrors: saveErrors.length > 0
9684
+ }), /* @__PURE__ */ jsx("div", {
9685
+ style: {
9686
+ display: "flex",
9687
+ flexDirection: "column",
9688
+ gap: token.marginLG,
9689
+ flex: 1,
9690
+ overflow: "auto"
9691
+ },
9692
+ children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [
9693
+ errorBox && /* @__PURE__ */ jsx("div", {
9694
+ className: cx("section"),
9695
+ children: errorBox
7672
9696
  }),
7673
- onEditTag: (tag) => setTagDrawerState({
7674
- open: true,
7675
- mode: "edit",
7676
- initialValues: {
7677
- name: tag.name,
7678
- description: tag.description,
7679
- externalDocsDescription: tag.externalDocsDescription,
7680
- externalDocsLink: tag.externalDocsUrl
7681
- }
9697
+ /* @__PURE__ */ jsx("div", {
9698
+ className: cx("section"),
9699
+ children: /* @__PURE__ */ jsx(GeneralSection, {
9700
+ apiName: localApiName,
9701
+ authType: selectedApi?.authType || "",
9702
+ version: selectedApi?.relatedVersions?.find((v) => v.apiId === selectedApi?.currentVersion)?.version || "",
9703
+ description: localDescription,
9704
+ onApiNameChange: (val) => {
9705
+ setApiNameTouched(true);
9706
+ setLocalApiName(val);
9707
+ },
9708
+ apiNameError: hasApiNameError,
9709
+ onDescriptionChange: (val) => {
9710
+ setDescriptionTouched(true);
9711
+ setLocalDescription(val);
9712
+ },
9713
+ descriptionError: hasDescriptionError,
9714
+ collapsed: generalCollapsed,
9715
+ onToggleCollapse: () => setGeneralCollapsed((c) => !c),
9716
+ onChangeDetected: () => {
9717
+ setBannerVisible(true);
9718
+ }
9719
+ })
9720
+ }),
9721
+ /* @__PURE__ */ jsx("div", {
9722
+ className: cx("section"),
9723
+ children: /* @__PURE__ */ jsx(TagsSection, {
9724
+ tags: localTags,
9725
+ collapsed: tagsCollapsed,
9726
+ onToggleCollapse: () => setTagsCollapsed((prev) => !prev),
9727
+ onAddTag: () => setTagDrawerState({
9728
+ open: true,
9729
+ mode: "add"
9730
+ }),
9731
+ onEditTag: (tag) => setTagDrawerState({
9732
+ open: true,
9733
+ mode: "edit",
9734
+ initialValues: {
9735
+ name: tag.name,
9736
+ description: tag.description,
9737
+ externalDocsDescription: tag.externalDocsDescription,
9738
+ externalDocsLink: tag.externalDocsUrl
9739
+ }
9740
+ }),
9741
+ onDeleteTag: (tagName) => setDeleteTagModal({
9742
+ open: true,
9743
+ tagName
9744
+ })
9745
+ })
7682
9746
  }),
7683
- onDeleteTag: (tagName) => setDeleteTagModal({
7684
- open: true,
7685
- tagName
9747
+ /* @__PURE__ */ jsx("div", {
9748
+ className: cx("section"),
9749
+ children: /* @__PURE__ */ jsx(EndpointsSection, {
9750
+ mode,
9751
+ endpointsByTag: getEndpointsByTag(),
9752
+ collapsed: endpointsCollapsed,
9753
+ onToggleCollapse: () => setEndpointsCollapsed((c) => !c),
9754
+ endpointNames,
9755
+ endpointDescs,
9756
+ endpointTags,
9757
+ availableTags: localTags.map((t) => t.name),
9758
+ onEndpointNameChange: (id, val) => {
9759
+ setEndpointNames((prev) => ({
9760
+ ...prev,
9761
+ [id]: val
9762
+ }));
9763
+ setBannerVisible(true);
9764
+ },
9765
+ onEndpointDescChange: (id, val) => {
9766
+ setEndpointDescs((prev) => ({
9767
+ ...prev,
9768
+ [id]: val
9769
+ }));
9770
+ setBannerVisible(true);
9771
+ },
9772
+ onEndpointTagsChange: (id, val) => {
9773
+ setEndpointTags((prev) => ({
9774
+ ...prev,
9775
+ [id]: val
9776
+ }));
9777
+ setBannerVisible(true);
9778
+ },
9779
+ endpointParams,
9780
+ onAddParameter: (endpointId, param) => {
9781
+ setEndpointParams((prev) => ({
9782
+ ...prev,
9783
+ [endpointId]: [...prev[endpointId] ?? [], param]
9784
+ }));
9785
+ setBannerVisible(true);
9786
+ },
9787
+ onEditParameter: (endpointId, idx, param) => {
9788
+ setEndpointParams((prev) => ({
9789
+ ...prev,
9790
+ [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
9791
+ }));
9792
+ setBannerVisible(true);
9793
+ },
9794
+ onDeleteParameter: (endpointId, idx) => {
9795
+ setEndpointParams((prev) => ({
9796
+ ...prev,
9797
+ [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
9798
+ }));
9799
+ setBannerVisible(true);
9800
+ },
9801
+ endpointResponseParams,
9802
+ onAddResponseParameter: (endpointId, param) => {
9803
+ setEndpointResponseParams((prev) => ({
9804
+ ...prev,
9805
+ [endpointId]: [...prev[endpointId] ?? [], param]
9806
+ }));
9807
+ setBannerVisible(true);
9808
+ },
9809
+ onEditResponseParameter: (endpointId, idx, param) => {
9810
+ setEndpointResponseParams((prev) => ({
9811
+ ...prev,
9812
+ [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
9813
+ }));
9814
+ setBannerVisible(true);
9815
+ },
9816
+ onDeleteResponseParameter: (endpointId, idx) => {
9817
+ setEndpointResponseParams((prev) => ({
9818
+ ...prev,
9819
+ [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
9820
+ }));
9821
+ setBannerVisible(true);
9822
+ },
9823
+ onRequestContentChange: (endpointId, jsonString) => {
9824
+ try {
9825
+ const schema = JSON.parse(jsonString);
9826
+ setEndpointRequestBody((prev) => ({
9827
+ ...prev,
9828
+ [endpointId]: schema
9829
+ }));
9830
+ setBannerVisible(true);
9831
+ } catch {}
9832
+ },
9833
+ onResponseContentChange: (endpointId, jsonString) => {
9834
+ try {
9835
+ const schema = JSON.parse(jsonString);
9836
+ setEndpointResponseBody((prev) => ({
9837
+ ...prev,
9838
+ [endpointId]: schema
9839
+ }));
9840
+ setBannerVisible(true);
9841
+ } catch {}
9842
+ },
9843
+ requestBodySchemas: endpointRequestBody,
9844
+ responseBodySchemas: endpointResponseBody
9845
+ }, resetKey)
7686
9846
  })
7687
- })
7688
- }),
7689
- /* @__PURE__ */ jsx("div", {
7690
- className: cx("section"),
7691
- children: /* @__PURE__ */ jsx(EndpointsSection, {
7692
- mode,
7693
- endpointsByTag: getEndpointsByTag(),
7694
- collapsed: endpointsCollapsed,
7695
- onToggleCollapse: () => setEndpointsCollapsed((c) => !c),
7696
- endpointNames,
7697
- endpointDescs,
7698
- endpointTags,
7699
- availableTags: localTags.map((t) => t.name),
7700
- onEndpointNameChange: (id, val) => {
7701
- setEndpointNames((prev) => ({
7702
- ...prev,
7703
- [id]: val
7704
- }));
7705
- setHasChanges(true);
7706
- setBannerVisible(true);
7707
- },
7708
- onEndpointDescChange: (id, val) => {
7709
- setEndpointDescs((prev) => ({
7710
- ...prev,
7711
- [id]: val
7712
- }));
7713
- setHasChanges(true);
7714
- setBannerVisible(true);
7715
- },
7716
- onEndpointTagsChange: (id, val) => {
7717
- setEndpointTags((prev) => ({
7718
- ...prev,
7719
- [id]: val
7720
- }));
7721
- setHasChanges(true);
7722
- setBannerVisible(true);
7723
- },
7724
- endpointParams,
7725
- onAddParameter: (endpointId, param) => {
7726
- setEndpointParams((prev) => ({
7727
- ...prev,
7728
- [endpointId]: [...prev[endpointId] ?? [], param]
7729
- }));
7730
- setHasChanges(true);
7731
- setBannerVisible(true);
7732
- },
7733
- onEditParameter: (endpointId, idx, param) => {
7734
- setEndpointParams((prev) => ({
7735
- ...prev,
7736
- [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
7737
- }));
7738
- setHasChanges(true);
7739
- setBannerVisible(true);
7740
- },
7741
- onDeleteParameter: (endpointId, idx) => {
7742
- setEndpointParams((prev) => ({
7743
- ...prev,
7744
- [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
7745
- }));
7746
- setHasChanges(true);
7747
- setBannerVisible(true);
7748
- },
7749
- endpointResponseParams,
7750
- onAddResponseParameter: (endpointId, param) => {
7751
- setEndpointResponseParams((prev) => ({
7752
- ...prev,
7753
- [endpointId]: [...prev[endpointId] ?? [], param]
7754
- }));
7755
- setHasChanges(true);
7756
- setBannerVisible(true);
7757
- },
7758
- onEditResponseParameter: (endpointId, idx, param) => {
7759
- setEndpointResponseParams((prev) => ({
7760
- ...prev,
7761
- [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
7762
- }));
7763
- setHasChanges(true);
7764
- setBannerVisible(true);
7765
- },
7766
- onDeleteResponseParameter: (endpointId, idx) => {
7767
- setEndpointResponseParams((prev) => ({
7768
- ...prev,
7769
- [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
7770
- }));
7771
- setHasChanges(true);
7772
- setBannerVisible(true);
7773
- }
7774
- }, resetKey)
7775
- })
7776
- ] }) : /* @__PURE__ */ jsxs("div", {
9847
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
9848
+ selectedEditItem.type === "errors" && errorBox && /* @__PURE__ */ jsx("div", {
9849
+ className: cx("section"),
9850
+ children: errorBox
9851
+ }),
9852
+ selectedEditItem.type !== "errors" && /* @__PURE__ */ jsx(Fragment, { children: errorBoxExpanded && errorBox ? /* @__PURE__ */ jsx("div", {
9853
+ className: cx("section"),
9854
+ children: errorBox
9855
+ }) : errorBoxCollapsed && /* @__PURE__ */ jsx("div", {
9856
+ className: cx("section"),
9857
+ children: errorBoxCollapsed
9858
+ }) }),
9859
+ selectedEditItem.type === "general" && /* @__PURE__ */ jsx("div", {
9860
+ className: cx("section"),
9861
+ children: /* @__PURE__ */ jsx(GeneralSection, {
9862
+ apiName: localApiName,
9863
+ authType: selectedApi?.authType || "",
9864
+ version: selectedApi?.relatedVersions?.find((v) => v.apiId === selectedApi?.currentVersion)?.version || "",
9865
+ description: localDescription,
9866
+ onApiNameChange: (val) => {
9867
+ setApiNameTouched(true);
9868
+ setLocalApiName(val);
9869
+ },
9870
+ apiNameError: hasApiNameError,
9871
+ onDescriptionChange: (val) => {
9872
+ setDescriptionTouched(true);
9873
+ setLocalDescription(val);
9874
+ },
9875
+ descriptionError: hasDescriptionError,
9876
+ collapsed: generalCollapsed,
9877
+ onToggleCollapse: () => setGeneralCollapsed((c) => !c),
9878
+ onChangeDetected: () => {
9879
+ setBannerVisible(true);
9880
+ }
9881
+ })
9882
+ }),
9883
+ selectedEditItem.type === "tags" && /* @__PURE__ */ jsx("div", {
9884
+ className: cx("section"),
9885
+ children: /* @__PURE__ */ jsx(TagsSection, {
9886
+ tags: localTags,
9887
+ collapsed: tagsCollapsed,
9888
+ onToggleCollapse: () => setTagsCollapsed((prev) => !prev),
9889
+ onAddTag: () => setTagDrawerState({
9890
+ open: true,
9891
+ mode: "add"
9892
+ }),
9893
+ onEditTag: (tag) => setTagDrawerState({
9894
+ open: true,
9895
+ mode: "edit",
9896
+ initialValues: {
9897
+ name: tag.name,
9898
+ description: tag.description,
9899
+ externalDocsDescription: tag.externalDocsDescription,
9900
+ externalDocsLink: tag.externalDocsUrl
9901
+ }
9902
+ }),
9903
+ onDeleteTag: (tagName) => setDeleteTagModal({
9904
+ open: true,
9905
+ tagName
9906
+ })
9907
+ })
9908
+ }),
9909
+ selectedEditItem.type === "endpoint" && /* @__PURE__ */ jsx(EndpointsSection, {
9910
+ mode,
9911
+ endpointsByTag: getEndpointsByTag(),
9912
+ selectedEndpointKey: selectedEditItem.key,
9913
+ collapsed: endpointsCollapsed,
9914
+ onToggleCollapse: () => setEndpointsCollapsed((c) => !c),
9915
+ endpointNames,
9916
+ endpointDescs,
9917
+ endpointTags,
9918
+ availableTags: localTags.map((t) => t.name),
9919
+ onEndpointNameChange: (id, val) => {
9920
+ setEndpointNames((prev) => ({
9921
+ ...prev,
9922
+ [id]: val
9923
+ }));
9924
+ setBannerVisible(true);
9925
+ },
9926
+ onEndpointDescChange: (id, val) => {
9927
+ setEndpointDescs((prev) => ({
9928
+ ...prev,
9929
+ [id]: val
9930
+ }));
9931
+ setBannerVisible(true);
9932
+ },
9933
+ onEndpointTagsChange: (id, val) => {
9934
+ setEndpointTags((prev) => ({
9935
+ ...prev,
9936
+ [id]: val
9937
+ }));
9938
+ setBannerVisible(true);
9939
+ },
9940
+ endpointParams,
9941
+ onAddParameter: (endpointId, param) => {
9942
+ setEndpointParams((prev) => ({
9943
+ ...prev,
9944
+ [endpointId]: [...prev[endpointId] ?? [], param]
9945
+ }));
9946
+ setBannerVisible(true);
9947
+ },
9948
+ onEditParameter: (endpointId, idx, param) => {
9949
+ setEndpointParams((prev) => ({
9950
+ ...prev,
9951
+ [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
9952
+ }));
9953
+ setBannerVisible(true);
9954
+ },
9955
+ onDeleteParameter: (endpointId, idx) => {
9956
+ setEndpointParams((prev) => ({
9957
+ ...prev,
9958
+ [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
9959
+ }));
9960
+ setBannerVisible(true);
9961
+ },
9962
+ endpointResponseParams,
9963
+ onAddResponseParameter: (endpointId, param) => {
9964
+ setEndpointResponseParams((prev) => ({
9965
+ ...prev,
9966
+ [endpointId]: [...prev[endpointId] ?? [], param]
9967
+ }));
9968
+ setBannerVisible(true);
9969
+ },
9970
+ onEditResponseParameter: (endpointId, idx, param) => {
9971
+ setEndpointResponseParams((prev) => ({
9972
+ ...prev,
9973
+ [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
9974
+ }));
9975
+ setBannerVisible(true);
9976
+ },
9977
+ onDeleteResponseParameter: (endpointId, idx) => {
9978
+ setEndpointResponseParams((prev) => ({
9979
+ ...prev,
9980
+ [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
9981
+ }));
9982
+ setBannerVisible(true);
9983
+ },
9984
+ onRequestContentChange: (endpointId, jsonString) => {
9985
+ try {
9986
+ const schema = JSON.parse(jsonString);
9987
+ setEndpointRequestBody((prev) => ({
9988
+ ...prev,
9989
+ [endpointId]: schema
9990
+ }));
9991
+ setBannerVisible(true);
9992
+ } catch {}
9993
+ },
9994
+ onResponseContentChange: (endpointId, jsonString) => {
9995
+ try {
9996
+ const schema = JSON.parse(jsonString);
9997
+ setEndpointResponseBody((prev) => ({
9998
+ ...prev,
9999
+ [endpointId]: schema
10000
+ }));
10001
+ setBannerVisible(true);
10002
+ } catch {}
10003
+ },
10004
+ requestBodySchemas: endpointRequestBody,
10005
+ responseBodySchemas: endpointResponseBody
10006
+ }, resetKey)
10007
+ ] })
10008
+ })]
10009
+ }) : /* @__PURE__ */ jsxs("div", {
7777
10010
  className: cx("docs-layout"),
7778
- children: [
7779
- /* @__PURE__ */ jsx(Sidebar, {
7780
- searchValue,
7781
- setSearchValue
7782
- }),
7783
- /* @__PURE__ */ jsx(MainContent, {
10011
+ children: [/* @__PURE__ */ jsx(Sidebar, {
10012
+ searchValue,
10013
+ setSearchValue
10014
+ }), /* @__PURE__ */ jsxs("div", {
10015
+ className: cx("content-scroll-area"),
10016
+ children: [/* @__PURE__ */ jsx(MainContent, {
7784
10017
  handleVisitLandingPage: _handleVisitLandingPage,
7785
10018
  handleResetSearch,
7786
10019
  searchEnabled: !!searchValue
7787
- }),
7788
- !isMobile && focusedContent === "ENDPOINT" && /* @__PURE__ */ jsx(CodeboxSidebar$1, {})
7789
- ]
10020
+ }), !isMobile && focusedContent === "ENDPOINT" && /* @__PURE__ */ jsx(CodeboxSidebar$1, {})]
10021
+ })]
7790
10022
  }),
7791
10023
  /* @__PURE__ */ jsx(AddTagDrawer, {
7792
10024
  open: tagDrawerState.open,
@@ -7799,6 +10031,144 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7799
10031
  onAddTag: handleAddTag,
7800
10032
  onEditTag: handleUpdateTag
7801
10033
  }),
10034
+ /* @__PURE__ */ jsxs(Modal, {
10035
+ open: saveConfirmModal,
10036
+ onCancel: () => setSaveConfirmModal(false),
10037
+ centered: true,
10038
+ title: null,
10039
+ footer: null,
10040
+ closable: false,
10041
+ width: 520,
10042
+ className: "delete-tag-confirm-modal",
10043
+ styles: {
10044
+ content: {
10045
+ padding: 0,
10046
+ borderRadius: 8,
10047
+ overflow: "hidden"
10048
+ },
10049
+ body: {
10050
+ padding: 0,
10051
+ margin: 0
10052
+ }
10053
+ },
10054
+ children: [
10055
+ /* @__PURE__ */ jsxs("div", {
10056
+ className: cx("deleteModalHead"),
10057
+ children: [/* @__PURE__ */ jsx("span", {
10058
+ className: cx("deleteModalTitle"),
10059
+ children: "Save & Publish Changes"
10060
+ }), /* @__PURE__ */ jsx("button", {
10061
+ className: cx("deleteModalCloseBtn"),
10062
+ onClick: () => setSaveConfirmModal(false),
10063
+ "aria-label": "Close",
10064
+ children: "×"
10065
+ })]
10066
+ }),
10067
+ /* @__PURE__ */ jsx("div", {
10068
+ className: cx("deleteModalContent"),
10069
+ children: /* @__PURE__ */ jsx("span", {
10070
+ className: cx("deleteModalContentText"),
10071
+ children: "Are you sure you want to Save & Publish Changes?"
10072
+ })
10073
+ }),
10074
+ /* @__PURE__ */ jsxs("div", {
10075
+ className: cx("deleteModalFooter"),
10076
+ children: [/* @__PURE__ */ jsx(Button, {
10077
+ size: "middle",
10078
+ onClick: () => setSaveConfirmModal(false),
10079
+ style: {
10080
+ borderRadius: 8,
10081
+ height: 32,
10082
+ paddingInline: 15
10083
+ },
10084
+ children: "Cancel"
10085
+ }), /* @__PURE__ */ jsx(Button, {
10086
+ type: "primary",
10087
+ size: "middle",
10088
+ onClick: () => {
10089
+ setSaveConfirmModal(false);
10090
+ handleSave();
10091
+ },
10092
+ style: {
10093
+ borderRadius: 8,
10094
+ height: 32,
10095
+ paddingInline: 16
10096
+ },
10097
+ children: "Yes, Save & Publish"
10098
+ })]
10099
+ })
10100
+ ]
10101
+ }),
10102
+ /* @__PURE__ */ jsxs(Modal, {
10103
+ open: resetConfirmModal,
10104
+ onCancel: () => setResetConfirmModal(false),
10105
+ centered: true,
10106
+ title: null,
10107
+ footer: null,
10108
+ closable: false,
10109
+ width: 520,
10110
+ className: "delete-tag-confirm-modal",
10111
+ styles: {
10112
+ content: {
10113
+ padding: 0,
10114
+ borderRadius: 8,
10115
+ overflow: "hidden"
10116
+ },
10117
+ body: {
10118
+ padding: 0,
10119
+ margin: 0
10120
+ }
10121
+ },
10122
+ children: [
10123
+ /* @__PURE__ */ jsxs("div", {
10124
+ className: cx("deleteModalHead"),
10125
+ children: [/* @__PURE__ */ jsx("span", {
10126
+ className: cx("deleteModalTitle"),
10127
+ children: "Reset changes?"
10128
+ }), /* @__PURE__ */ jsx("button", {
10129
+ className: cx("deleteModalCloseBtn"),
10130
+ onClick: () => setResetConfirmModal(false),
10131
+ "aria-label": "Close",
10132
+ children: "×"
10133
+ })]
10134
+ }),
10135
+ /* @__PURE__ */ jsx("div", {
10136
+ className: cx("deleteModalContent"),
10137
+ children: /* @__PURE__ */ jsx("span", {
10138
+ className: cx("deleteModalContentText"),
10139
+ children: "This will discard your unsaved changes."
10140
+ })
10141
+ }),
10142
+ /* @__PURE__ */ jsxs("div", {
10143
+ className: cx("deleteModalFooter"),
10144
+ children: [/* @__PURE__ */ jsx(Button, {
10145
+ size: "middle",
10146
+ onClick: () => setResetConfirmModal(false),
10147
+ style: {
10148
+ borderRadius: 8,
10149
+ height: 32,
10150
+ paddingInline: 15
10151
+ },
10152
+ children: "Cancel"
10153
+ }), /* @__PURE__ */ jsx(Button, {
10154
+ size: "middle",
10155
+ onClick: () => {
10156
+ setResetConfirmModal(false);
10157
+ handleReset();
10158
+ },
10159
+ style: {
10160
+ borderRadius: 8,
10161
+ height: 32,
10162
+ paddingInline: 16,
10163
+ backgroundColor: "#faad14",
10164
+ borderColor: "#faad14",
10165
+ color: "#fff"
10166
+ },
10167
+ children: "Yes, Reset"
10168
+ })]
10169
+ })
10170
+ ]
10171
+ }),
7802
10172
  /* @__PURE__ */ jsxs(Modal, {
7803
10173
  open: deleteTagModal.open,
7804
10174
  onCancel: () => setDeleteTagModal({