@clarify-labs/renderer 0.9.2 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/output/{ClarifyShell-DdYRgrfY.cjs → ClarifyShell-7r92MZg9.cjs} +134 -75
  2. package/output/ClarifyShell-7r92MZg9.cjs.map +1 -0
  3. package/output/{ClarifyShell-C38EkErX.js → ClarifyShell-D2P0iZ_m.js} +128 -75
  4. package/output/ClarifyShell-D2P0iZ_m.js.map +1 -0
  5. package/output/{OpenApiOperation-CP_fxT_F.cjs → OpenApiOperation-CyyPlZL6.cjs} +389 -135
  6. package/output/OpenApiOperation-CyyPlZL6.cjs.map +1 -0
  7. package/output/{OpenApiOperation-DIFaYAe5.js → OpenApiOperation-Dhlz3JSx.js} +391 -137
  8. package/output/OpenApiOperation-Dhlz3JSx.js.map +1 -0
  9. package/output/{PageActions-B08cDCzq.cjs → PageActions-CTn2XkPg.cjs} +16 -31
  10. package/output/PageActions-CTn2XkPg.cjs.map +1 -0
  11. package/output/{PageActions-tmnpzi23.js → PageActions-D0PA8Zv5.js} +11 -26
  12. package/output/PageActions-D0PA8Zv5.js.map +1 -0
  13. package/output/app/ContentDiagnostic.d.ts +9 -0
  14. package/output/app/ErrorBoundary.d.ts +0 -2
  15. package/output/app/RenderErrorPanel.d.ts +20 -0
  16. package/output/client.cjs +3 -3
  17. package/output/client.js +3 -3
  18. package/output/components/Tabs.d.ts +16 -0
  19. package/output/components/index.d.ts +1 -0
  20. package/output/core/context.d.ts +1 -0
  21. package/output/core/i18n.d.ts +1 -1
  22. package/output/core/types.d.ts +1 -0
  23. package/output/index.cjs +43 -4
  24. package/output/index.cjs.map +1 -1
  25. package/output/index.d.ts +5 -3
  26. package/output/index.js +42 -5
  27. package/output/index.js.map +1 -1
  28. package/output/openapi/components/EndpointSections.d.ts +2 -0
  29. package/output/openapi/components/ExamplePanels.d.ts +2 -0
  30. package/output/openapi/components/OpenApiOperation.d.ts +6 -0
  31. package/output/openapi/components/SchemaProperties.d.ts +3 -0
  32. package/output/openapi/entry.d.ts +5 -0
  33. package/output/openapi/index.d.ts +2 -2
  34. package/output/preview.cjs +2 -2
  35. package/output/preview.js +2 -2
  36. package/output/{render-6gHfrR9h.js → render-CwSsfrs7.js} +2 -2
  37. package/output/{render-6gHfrR9h.js.map → render-CwSsfrs7.js.map} +1 -1
  38. package/output/{render-Bvf5ZMZb.cjs → render-DXDSIfZ8.cjs} +2 -2
  39. package/output/{render-Bvf5ZMZb.cjs.map → render-DXDSIfZ8.cjs.map} +1 -1
  40. package/output/renderer.css +47 -1
  41. package/output/server.cjs +2 -2
  42. package/output/server.js +2 -2
  43. package/package.json +1 -1
  44. package/output/ClarifyShell-C38EkErX.js.map +0 -1
  45. package/output/ClarifyShell-DdYRgrfY.cjs.map +0 -1
  46. package/output/OpenApiOperation-CP_fxT_F.cjs.map +0 -1
  47. package/output/OpenApiOperation-DIFaYAe5.js.map +0 -1
  48. package/output/PageActions-B08cDCzq.cjs.map +0 -1
  49. package/output/PageActions-tmnpzi23.js.map +0 -1
@@ -1,12 +1,12 @@
1
- import { D as copyTextToClipboard, M as useConfig, N as useLocale, O as useBuiltInText, T as localizeHref, c as remToPx, g as useTheme, l as lucideIconRegistry, n as PageTitleActions, s as useSectionStore, u as resolveLucideIconName, w as isExternalHref } from "./PageActions-tmnpzi23.js";
1
+ import { C as isExternalHref, D as useBuiltInText, E as copyTextToClipboard, N as useLocale, c as lucideIconRegistry, h as useTheme, j as useConfig, l as resolveLucideIconName, n as PageTitleActions, o as useSectionStore, s as remToPx, w as localizeHref } from "./PageActions-D0PA8Zv5.js";
2
2
  import { t as markdownRemarkPlugins } from "./remark-Dd2WU50s.js";
3
3
  import clsx from "clsx";
4
4
  import { Children, createContext, createElement, forwardRef, isValidElement, useContext, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
5
5
  import { Link } from "react-router-dom";
6
6
  import { Listbox, ListboxButton, ListboxOption, ListboxOptions, Tab, TabGroup, TabList, TabPanel, TabPanels, Transition } from "@headlessui/react";
7
- import { AlertTriangle, ArrowRight, Check, CheckCircle2, CheckIcon, ChevronDown, ChevronDownIcon, ChevronRight, ChevronsUpDownIcon, CircleCheck, Clipboard, ClipboardIcon, CodeIcon, Info, Lightbulb, LinkIcon, LockKeyholeIcon, Maximize2, PackageIcon, ServerIcon, UnlockKeyholeIcon, XCircle, ZoomIn, ZoomOut } from "lucide-react";
7
+ import { AlertTriangle, ArrowRight, Check, CheckCircle2, CheckIcon, ChevronDown, ChevronDownIcon, ChevronRight, ChevronsUpDownIcon, CircleCheck, Clipboard, ClipboardIcon, CodeIcon, CopyIcon, Info, Lightbulb, LinkIcon, LockKeyholeIcon, Maximize2, PackageIcon, ServerIcon, UnlockKeyholeIcon, XCircle, ZoomIn, ZoomOut } from "lucide-react";
8
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
- import { useInView } from "framer-motion";
9
+ import { motion, useInView } from "framer-motion";
10
10
  import { create } from "zustand";
11
11
  import { TransformComponent, TransformWrapper, useControls } from "react-zoom-pan-pinch";
12
12
  import ReactMarkdown from "react-markdown";
@@ -915,6 +915,44 @@ function Prose(arg0) {
915
915
  });
916
916
  }
917
917
  //#endregion
918
+ //#region source/components/Tabs.tsx
919
+ function Tabs(arg0) {
920
+ const { items, selectedIndex, onChange, className, listClassName, panelsClassName } = arg0;
921
+ const [internalIndex, setInternalIndex] = useState(0);
922
+ const resolvedIndex = typeof selectedIndex === "number" ? selectedIndex : internalIndex;
923
+ const indicatorLayoutId = useId();
924
+ const handleChange = (index) => {
925
+ if (typeof selectedIndex !== "number") setInternalIndex(index);
926
+ onChange?.(index);
927
+ };
928
+ return /* @__PURE__ */ jsxs(TabGroup, {
929
+ selectedIndex: resolvedIndex,
930
+ onChange: handleChange,
931
+ className,
932
+ children: [/* @__PURE__ */ jsx(TabList, {
933
+ className: clsx("flex flex-wrap items-center gap-6 border-b border-(--clarify-theme-tokens-colors-border) pb-0", listClassName),
934
+ children: items.map((item) => /* @__PURE__ */ jsx(Tab, {
935
+ className: ({ selected }) => clsx("clarify-ui-tab relative inline-flex h-10 shrink-0 items-center px-0 py-0 text-sm font-medium transition focus:outline-none", selected && "clarify-ui-tab-active"),
936
+ children: ({ selected }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", { children: item.label }), selected ? /* @__PURE__ */ jsx(motion.span, {
937
+ layoutId: indicatorLayoutId,
938
+ className: "absolute inset-x-0 bottom-0 h-0.5 rounded-full bg-(--clarify-theme-tokens-colors-foreground)",
939
+ transition: {
940
+ type: "tween",
941
+ duration: .16,
942
+ ease: "easeOut"
943
+ }
944
+ }) : null] })
945
+ }, item.id))
946
+ }), /* @__PURE__ */ jsx(TabPanels, {
947
+ className: clsx("mt-4", panelsClassName),
948
+ children: items.map((item) => /* @__PURE__ */ jsx(TabPanel, {
949
+ className: "focus:outline-none",
950
+ children: item.panel
951
+ }, item.id))
952
+ })]
953
+ });
954
+ }
955
+ //#endregion
918
956
  //#region source/components/WebFrame.tsx
919
957
  function WebFrame(arg0) {
920
958
  const { src, title = "Embedded content", children, showWindow = true, className, iframeClassName, height = 420, style, ...props } = arg0;
@@ -1274,10 +1312,10 @@ function schemaToType(schema) {
1274
1312
  if (!isRecord(schema)) return void 0;
1275
1313
  if (isReference(schema)) return resolveReferenceName(schema.$ref);
1276
1314
  if (typeof schema.const !== "undefined") return JSON.stringify(schema.const);
1277
- if (Array.isArray(schema.enum)) return schema.enum.map(String).join(" | ");
1315
+ if (Array.isArray(schema.enum)) return "enum";
1278
1316
  const oneOf = schema.oneOf ?? schema.anyOf;
1279
- if (Array.isArray(oneOf)) return oneOf.map(schemaToType).filter(Boolean).join(" | ");
1280
- if (Array.isArray(schema.allOf)) return schema.allOf.map(schemaToType).filter(Boolean).join(" & ");
1317
+ if (Array.isArray(oneOf)) return oneOf.map((branch) => schemaToType(branch)).filter(Boolean).join(" | ");
1318
+ if (Array.isArray(schema.allOf)) return schema.allOf.map((branch) => schemaToType(branch)).filter(Boolean).join(" & ");
1281
1319
  if (schemaHasType(schema, "array")) return `${schemaToType(schema.items) ?? "unknown"}[]`;
1282
1320
  const type = Array.isArray(schema.type) ? schema.type.map(String).join(" | ") : schema.type;
1283
1321
  return typeof type === "string" ? [type, typeof schema.format === "string" ? `<${schema.format}>` : void 0].filter(Boolean).join("") : void 0;
@@ -2086,19 +2124,36 @@ function firstExampleKeyForResponseContent(content) {
2086
2124
  return getExampleEntries(content?.value)[0]?.key ?? "";
2087
2125
  }
2088
2126
  function useResponseExamplesState(arg0) {
2089
- const { operation, spec, sharedExampleKey, onSelectExampleKey } = arg0;
2090
- const responses = getResponseEntries(operation, spec).filter(({ response }) => getMediaTypeEntries(response.content, spec).length > 0);
2091
- const [selectedStatus, setSelectedStatus] = useState(responses.find(({ status }) => status.startsWith("2"))?.status ?? responses[0]?.status ?? "");
2092
- const selectedResponse = responses.find(({ status }) => status === selectedStatus) ?? responses[0];
2127
+ const { operation, spec, sharedExampleKey, onSelectExampleKey, selectedStatus, onSelectStatus } = arg0;
2128
+ const orderedResponses = [...getResponseEntries(operation, spec).filter(({ response }) => getMediaTypeEntries(response.content, spec).length > 0)].sort((left, right) => {
2129
+ if (left.status === "default") return -1;
2130
+ if (right.status === "default") return 1;
2131
+ const leftCode = Number(left.status);
2132
+ const rightCode = Number(right.status);
2133
+ if (!Number.isNaN(leftCode) && !Number.isNaN(rightCode)) return leftCode - rightCode;
2134
+ return left.status.localeCompare(right.status);
2135
+ });
2136
+ const [internalSelectedStatus, setInternalSelectedStatus] = useState(orderedResponses.find(({ status }) => status === "default")?.status ?? orderedResponses.find(({ status }) => status.startsWith("2"))?.status ?? orderedResponses[0]?.status ?? "");
2137
+ const activeStatus = selectedStatus ?? internalSelectedStatus;
2138
+ const selectedResponse = orderedResponses.find(({ status }) => status === activeStatus) ?? orderedResponses[0];
2093
2139
  const responseContents = getMediaTypeEntries(selectedResponse?.response.content, spec);
2094
- const [selectedMediaType, setSelectedMediaType] = useState(responseContents[0]?.mediaType ?? "");
2095
- const selectedContent = responseContents.find((content) => content.mediaType === selectedMediaType) ?? responseContents[0];
2140
+ const [selection, setSelection] = useState(() => ({
2141
+ status: activeStatus,
2142
+ mediaType: responseContents[0]?.mediaType ?? "",
2143
+ exampleKey: firstExampleKeyForResponseContent(responseContents[0])
2144
+ }));
2145
+ const resolvedSelection = selection.status === activeStatus ? selection : {
2146
+ status: activeStatus,
2147
+ mediaType: responseContents[0]?.mediaType ?? "",
2148
+ exampleKey: firstExampleKeyForResponseContent(responseContents[0])
2149
+ };
2150
+ const selectedContent = responseContents.find((content) => content.mediaType === resolvedSelection.mediaType) ?? responseContents[0];
2096
2151
  const examples = getExampleEntries(selectedContent?.value);
2097
- const [selectedExampleKey, setSelectedExampleKey] = useState(examples[0]?.key ?? "");
2152
+ const selectedExampleKey = examples.some((example) => example.key === resolvedSelection.exampleKey) ? resolvedSelection.exampleKey : examples[0]?.key ?? "";
2098
2153
  const currentExampleKey = (sharedExampleKey && examples.some((example) => example.key === sharedExampleKey) ? sharedExampleKey : void 0) ?? selectedExampleKey;
2099
2154
  const selectedExample = examples.find((example) => example.key === currentExampleKey) ?? examples[0];
2100
2155
  return {
2101
- responses,
2156
+ responses: orderedResponses,
2102
2157
  selectedResponse,
2103
2158
  responseContents,
2104
2159
  selectedContent,
@@ -2106,29 +2161,42 @@ function useResponseExamplesState(arg0) {
2106
2161
  selectedExample,
2107
2162
  responseCode: stringifyExample(selectedExample?.value),
2108
2163
  onSelectStatus: (value) => {
2109
- const nextContents = getMediaTypeEntries(responses.find(({ status }) => status === value)?.response.content, spec);
2110
- setSelectedStatus(value);
2111
- setSelectedMediaType(nextContents[0]?.mediaType ?? "");
2112
- setSelectedExampleKey(firstExampleKeyForResponseContent(nextContents[0]));
2164
+ const nextContents = getMediaTypeEntries(orderedResponses.find(({ status }) => status === value)?.response.content, spec);
2165
+ if (typeof selectedStatus === "undefined") setInternalSelectedStatus(value);
2166
+ onSelectStatus?.(value);
2167
+ setSelection({
2168
+ status: value,
2169
+ mediaType: nextContents[0]?.mediaType ?? "",
2170
+ exampleKey: firstExampleKeyForResponseContent(nextContents[0])
2171
+ });
2113
2172
  },
2114
2173
  onSelectMediaType: (value) => {
2115
- setSelectedMediaType(value);
2116
- setSelectedExampleKey(firstExampleKeyForResponseContent(responseContents.find((content) => content.mediaType === value)));
2174
+ const nextContent = responseContents.find((content) => content.mediaType === value);
2175
+ setSelection((current) => ({
2176
+ ...current,
2177
+ mediaType: value,
2178
+ exampleKey: firstExampleKeyForResponseContent(nextContent)
2179
+ }));
2117
2180
  },
2118
2181
  onSelectExample: (value) => {
2119
- setSelectedExampleKey(value);
2182
+ setSelection((current) => ({
2183
+ ...current,
2184
+ exampleKey: value
2185
+ }));
2120
2186
  onSelectExampleKey?.(value);
2121
2187
  }
2122
2188
  };
2123
2189
  }
2124
2190
  function ResponseExamplesPanel(arg0) {
2125
- const { operation, spec, sharedExampleKey, onSelectExampleKey } = arg0;
2191
+ const { operation, spec, sharedExampleKey, onSelectExampleKey, selectedStatus, onSelectStatus } = arg0;
2126
2192
  const t = useBuiltInText();
2127
2193
  const state = useResponseExamplesState({
2128
2194
  operation,
2129
2195
  spec,
2130
2196
  sharedExampleKey,
2131
- onSelectExampleKey
2197
+ onSelectExampleKey,
2198
+ selectedStatus,
2199
+ onSelectStatus
2132
2200
  });
2133
2201
  if (!state.selectedResponse || !state.selectedContent || !state.responseCode) return null;
2134
2202
  return /* @__PURE__ */ jsx(ApiExampleCodeGroup, {
@@ -2149,9 +2217,17 @@ function ResponseExamplesPanel(arg0) {
2149
2217
  }
2150
2218
  //#endregion
2151
2219
  //#region source/openapi/components/SchemaProperties.tsx
2220
+ function getEnumDescriptions(schema) {
2221
+ const descriptions = schema["x-enumDescriptions"];
2222
+ if (Array.isArray(descriptions)) return descriptions.map((value) => typeof value === "string" ? value : void 0);
2223
+ if (isRecord(descriptions)) return Array.isArray(schema.enum) ? schema.enum.map((value) => {
2224
+ const description = descriptions[String(value)];
2225
+ return typeof description === "string" ? description : void 0;
2226
+ }) : [];
2227
+ return [];
2228
+ }
2152
2229
  function getSchemaDetails(schema) {
2153
2230
  const details = [
2154
- Array.isArray(schema.enum) ? `enum: ${schema.enum.map(String).join(", ")}` : void 0,
2155
2231
  typeof schema.const !== "undefined" ? `const: ${String(schema.const)}` : void 0,
2156
2232
  typeof schema.default !== "undefined" ? `default: ${String(schema.default)}` : void 0,
2157
2233
  typeof schema.pattern === "string" ? `pattern: ${schema.pattern}` : void 0,
@@ -2164,6 +2240,21 @@ function getSchemaDetails(schema) {
2164
2240
  function getSchemaDescription(schema) {
2165
2241
  return typeof schema.description === "string" ? schema.description : void 0;
2166
2242
  }
2243
+ function getSchemaNodeType(schema) {
2244
+ return schemaToType(schema);
2245
+ }
2246
+ function getEnumChildren(schema, path) {
2247
+ if (!Array.isArray(schema.enum) || schema.enum.length === 0) return [];
2248
+ const descriptions = getEnumDescriptions(schema);
2249
+ return schema.enum.map((value, index) => ({
2250
+ key: `${path || "root"}.enum[${index}]`,
2251
+ name: String(value),
2252
+ kind: "enum",
2253
+ description: descriptions[index],
2254
+ required: false,
2255
+ children: []
2256
+ }));
2257
+ }
2167
2258
  function getComposedBranches(schema) {
2168
2259
  const entries = [];
2169
2260
  for (const key of [
@@ -2181,7 +2272,7 @@ function getComposedBranches(schema) {
2181
2272
  return entries;
2182
2273
  }
2183
2274
  function getSchemaChildren(arg0) {
2184
- const { spec, schema, path, required = [], depth = 0, seen = /* @__PURE__ */ new Set() } = arg0;
2275
+ const { spec, path, schema, depth = 0, required = [], seen = /* @__PURE__ */ new Set(), defaultExpanded } = arg0;
2185
2276
  if (depth > 12) return [];
2186
2277
  if (isReference(schema)) {
2187
2278
  if (seen.has(schema.$ref)) return [];
@@ -2191,7 +2282,8 @@ function getSchemaChildren(arg0) {
2191
2282
  path,
2192
2283
  required,
2193
2284
  depth,
2194
- seen: new Set([...seen, schema.$ref])
2285
+ seen: new Set([...seen, schema.$ref]),
2286
+ defaultExpanded
2195
2287
  });
2196
2288
  }
2197
2289
  if (!isRecord(schema)) return [];
@@ -2200,9 +2292,11 @@ function getSchemaChildren(arg0) {
2200
2292
  schema: schema.items,
2201
2293
  path: `${path}[]`,
2202
2294
  depth: depth + 1,
2203
- seen
2295
+ seen,
2296
+ defaultExpanded
2204
2297
  }) : [];
2205
2298
  const objectRequired = Array.isArray(schema.required) ? schema.required.map(String) : required;
2299
+ const enumChildren = getEnumChildren(schema, path);
2206
2300
  const properties = isRecord(schema.properties) ? schema.properties : {};
2207
2301
  const propertyChildren = Object.entries(properties).map(([name, propertySchema]) => {
2208
2302
  const resolvedProperty = resolveSchema(spec, propertySchema);
@@ -2214,31 +2308,38 @@ function getSchemaChildren(arg0) {
2214
2308
  schema: isArray ? property.items : propertySchema,
2215
2309
  path: isArray ? `${childPath}[]` : childPath,
2216
2310
  depth: depth + 1,
2217
- seen
2311
+ seen,
2312
+ defaultExpanded
2218
2313
  });
2314
+ const hasEnumValues = Array.isArray(property.enum) && property.enum.length > 0;
2219
2315
  return {
2220
2316
  key: childPath,
2221
2317
  name,
2222
- type: schemaToType(propertySchema),
2318
+ kind: "property",
2319
+ type: getSchemaNodeType(property),
2223
2320
  description: getSchemaDescription(property),
2224
2321
  details: getSchemaDetails(property),
2225
2322
  required: objectRequired.includes(name),
2323
+ defaultExpanded: hasEnumValues ? defaultExpanded === true : defaultExpanded ?? depth < 1,
2226
2324
  children
2227
2325
  };
2228
2326
  });
2229
2327
  const additionalPropertyChildren = isRecord(schema.additionalProperties) ? [{
2230
2328
  key: `${path || "root"}.*`,
2231
2329
  name: "*",
2232
- type: schemaToType(schema.additionalProperties),
2330
+ kind: "property",
2331
+ type: getSchemaNodeType(schema.additionalProperties),
2233
2332
  description: getSchemaDescription(schema.additionalProperties),
2234
2333
  details: getSchemaDetails(schema.additionalProperties),
2235
2334
  required: false,
2335
+ defaultExpanded: defaultExpanded ?? depth < 1,
2236
2336
  children: getSchemaChildren({
2237
2337
  spec,
2238
2338
  schema: schema.additionalProperties,
2239
2339
  path: `${path || "root"}.*`,
2240
2340
  depth: depth + 1,
2241
- seen
2341
+ seen,
2342
+ defaultExpanded
2242
2343
  })
2243
2344
  }] : [];
2244
2345
  const composedChildren = getComposedBranches(schema).map(({ label, schema: branchSchema }) => {
@@ -2247,35 +2348,40 @@ function getSchemaChildren(arg0) {
2247
2348
  return {
2248
2349
  key: `${path || "root"}.${label}`,
2249
2350
  name: label,
2250
- type: schemaToType(branchSchema),
2351
+ kind: "property",
2352
+ type: getSchemaNodeType(branch),
2251
2353
  description: branch ? getSchemaDescription(branch) : void 0,
2252
2354
  details: branch ? getSchemaDetails(branch) : void 0,
2253
2355
  required: false,
2356
+ defaultExpanded: defaultExpanded ?? depth < 1,
2254
2357
  children: getSchemaChildren({
2255
2358
  spec,
2256
2359
  schema: branchSchema,
2257
2360
  path: `${path || "root"}.${label}`,
2258
2361
  required: objectRequired,
2259
2362
  depth: depth + 1,
2260
- seen
2363
+ seen,
2364
+ defaultExpanded
2261
2365
  })
2262
2366
  };
2263
2367
  });
2264
2368
  return [
2265
2369
  ...arrayChildren,
2370
+ ...enumChildren,
2266
2371
  ...propertyChildren,
2267
2372
  ...additionalPropertyChildren,
2268
2373
  ...composedChildren
2269
2374
  ];
2270
2375
  }
2271
- function getRootSchemaNode(spec, schema) {
2376
+ function getRootSchemaNode(spec, schema, defaultExpanded) {
2272
2377
  if (isReference(schema)) {
2273
2378
  const resolvedSchema = resolveSchema(spec, schema);
2274
2379
  const resolved = isRecord(resolvedSchema) ? resolvedSchema : {};
2275
2380
  return {
2276
2381
  key: schema.$ref,
2277
2382
  name: resolveReferenceName(schema.$ref),
2278
- type: schemaToType(schema),
2383
+ kind: "property",
2384
+ type: getSchemaNodeType(resolved),
2279
2385
  description: getSchemaDescription(resolved),
2280
2386
  details: getSchemaDetails(resolved),
2281
2387
  required: false,
@@ -2283,7 +2389,8 @@ function getRootSchemaNode(spec, schema) {
2283
2389
  spec,
2284
2390
  schema: resolvedSchema,
2285
2391
  path: resolveReferenceName(schema.$ref),
2286
- seen: new Set([schema.$ref])
2392
+ seen: new Set([schema.$ref]),
2393
+ defaultExpanded
2287
2394
  })
2288
2395
  };
2289
2396
  }
@@ -2291,24 +2398,58 @@ function getRootSchemaNode(spec, schema) {
2291
2398
  return {
2292
2399
  key: "root",
2293
2400
  name: "body",
2294
- type: schemaToType(schema),
2401
+ kind: "property",
2402
+ type: getSchemaNodeType(schema),
2295
2403
  description: getSchemaDescription(schema),
2296
2404
  details: getSchemaDetails(schema),
2297
2405
  required: false,
2298
2406
  children: getSchemaChildren({
2299
2407
  spec,
2300
2408
  schema,
2301
- path: ""
2409
+ path: "",
2410
+ defaultExpanded
2302
2411
  })
2303
2412
  };
2304
2413
  }
2305
- function SchemaNode(arg0) {
2414
+ function EnumValueNode(arg0) {
2306
2415
  const { node, depth = 0 } = arg0;
2416
+ return /* @__PURE__ */ jsx("li", {
2417
+ className: "clarify-schema-node m-0 px-0 py-2 first:pt-0 last:pb-0",
2418
+ children: /* @__PURE__ */ jsx("div", {
2419
+ className: clsx("flex min-w-0 items-start rounded py-0.5 text-left", depth > 0 ? "-mx-2 w-(--clarify-schema-row-nested-width) px-2" : "w-full px-1"),
2420
+ children: /* @__PURE__ */ jsxs("div", {
2421
+ className: "min-w-0 flex-1",
2422
+ children: [/* @__PURE__ */ jsx("div", {
2423
+ className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5",
2424
+ children: /* @__PURE__ */ jsx("span", {
2425
+ className: "text-sm/5 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
2426
+ children: node.name
2427
+ })
2428
+ }), node.description || node.details ? /* @__PURE__ */ jsxs("div", {
2429
+ className: "mt-0.5 text-sm/5 text-(--clarify-ui-text-soft) *:first:mt-0 *:last:mb-0",
2430
+ children: [node.description ? /* @__PURE__ */ jsx(Markdown, {
2431
+ className: "*:first:mt-0 *:last:mb-0",
2432
+ children: node.description
2433
+ }) : null, node.details ? /* @__PURE__ */ jsx("p", {
2434
+ className: "text-xs text-(--clarify-ui-text-faint)",
2435
+ children: node.details
2436
+ }) : null]
2437
+ }) : null]
2438
+ })
2439
+ })
2440
+ });
2441
+ }
2442
+ function SchemaNode(arg0) {
2443
+ const { node, depth = 0, defaultExpanded } = arg0;
2307
2444
  const t = useBuiltInText();
2308
- const [expanded, setExpanded] = useState(depth < 1);
2445
+ const [expanded, setExpanded] = useState(defaultExpanded ?? depth < 1);
2309
2446
  const hasChildren = node.children.length > 0;
2447
+ if (node.kind === "enum") return /* @__PURE__ */ jsx(EnumValueNode, {
2448
+ node,
2449
+ depth
2450
+ });
2310
2451
  const type = [node.type, node.required ? t("openapi.requiredBadge") : void 0].filter(Boolean).join(", ") || void 0;
2311
- const fallbackDescription = node.required ? t("openapi.required") : t("openapi.optional");
2452
+ const fallbackDescription = hasChildren ? void 0 : node.required ? t("openapi.required") : t("openapi.optional");
2312
2453
  const rowClassName = clsx("flex min-w-0 items-start rounded py-0.5 text-left", depth > 0 ? "-mx-2 w-(--clarify-schema-row-nested-width) px-2" : "w-full px-1");
2313
2454
  const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
2314
2455
  className: "min-w-0 flex-1",
@@ -2362,13 +2503,14 @@ function SchemaTree(arg0) {
2362
2503
  className: clsx("m-0 list-none divide-y divide-(--clarify-theme-tokens-colors-border) p-0", depth > 0 && "mt-2 rounded-lg bg-(--clarify-ui-subtle-background) px-2 py-1"),
2363
2504
  children: nodes.map((node) => /* @__PURE__ */ jsx(SchemaNode, {
2364
2505
  node,
2365
- depth
2506
+ depth,
2507
+ defaultExpanded: node.defaultExpanded
2366
2508
  }, node.key))
2367
2509
  });
2368
2510
  }
2369
2511
  function SchemaProperties(arg0) {
2370
- const { title, schema, spec } = arg0;
2371
- const root = getRootSchemaNode(spec, schema);
2512
+ const { title, schema, spec, defaultExpanded } = arg0;
2513
+ const root = getRootSchemaNode(spec, schema, defaultExpanded);
2372
2514
  if (!root || root.children.length === 0) return null;
2373
2515
  return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", { children: title }), /* @__PURE__ */ jsx("div", {
2374
2516
  className: "clarify-schema-properties my-6",
@@ -2378,97 +2520,172 @@ function SchemaProperties(arg0) {
2378
2520
  function ParameterList(arg0) {
2379
2521
  const { title, parameters } = arg0;
2380
2522
  const t = useBuiltInText();
2381
- if (parameters.length === 0) return null;
2382
- return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", { children: title }), /* @__PURE__ */ jsx(Properties, { children: parameters.map((parameter) => /* @__PURE__ */ jsx(Property, {
2523
+ return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", { children: title }), /* @__PURE__ */ jsx(Properties, { children: parameters.length > 0 ? parameters.map((parameter) => /* @__PURE__ */ jsx(Property, {
2383
2524
  name: parameter.name ?? t("openapi.parameter"),
2384
2525
  type: [schemaToType(parameter.schema), parameter.required ? t("openapi.requiredBadge") : void 0].filter(Boolean).join(", ") || void 0,
2385
2526
  children: parameter.description ? /* @__PURE__ */ jsx(Markdown, {
2386
2527
  className: "*:first:mt-0 *:last:mb-0",
2387
2528
  children: parameter.description
2388
2529
  }) : t("openapi.operationParameter")
2389
- }, `${parameter.in}-${parameter.name}`)) })] });
2530
+ }, `${parameter.in}-${parameter.name}`)) : /* @__PURE__ */ jsx("span", {
2531
+ className: "text-sm/5 text-(--clarify-ui-text-soft)",
2532
+ children: t("openapi.none")
2533
+ }) })] });
2390
2534
  }
2391
2535
  function ResponseList(arg0) {
2392
- const { operation, spec } = arg0;
2536
+ const { operation, spec, selectedStatus, onSelectStatus } = arg0;
2393
2537
  const t = useBuiltInText();
2394
- const responses = getResponseEntries(operation, spec);
2395
- if (responses.length === 0) return null;
2396
- return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", { children: t("openapi.responses") }), /* @__PURE__ */ jsx(Properties, { children: responses.map(({ status, response }) => {
2397
- return /* @__PURE__ */ jsx(Property, {
2398
- name: status,
2399
- type: schemaToType(getJsonLikeContent(response.content, spec)?.value.schema),
2400
- children: response.description ? /* @__PURE__ */ jsx(Markdown, {
2401
- className: "*:first:mt-0 *:last:mb-0",
2402
- children: response.description
2403
- }) : `${t("openapi.response")}.`
2404
- }, status);
2405
- }) })] });
2538
+ const orderedResponses = [...getResponseEntries(operation, spec)].sort((left, right) => {
2539
+ if (left.status === "default") return -1;
2540
+ if (right.status === "default") return 1;
2541
+ const leftCode = Number(left.status);
2542
+ const rightCode = Number(right.status);
2543
+ if (!Number.isNaN(leftCode) && !Number.isNaN(rightCode)) return leftCode - rightCode;
2544
+ return left.status.localeCompare(right.status);
2545
+ });
2546
+ const activeStatus = selectedStatus ?? orderedResponses.find(({ status }) => status === "default")?.status ?? orderedResponses.find(({ status }) => status.startsWith("2"))?.status ?? orderedResponses[0]?.status ?? "";
2547
+ const selectedIndex = Math.max(0, orderedResponses.findIndex(({ status }) => status === activeStatus));
2548
+ if (orderedResponses.length === 0) return null;
2549
+ const renderResponsePanel = ({ status, response }) => {
2550
+ const responseSchema = getJsonLikeContent(response.content, spec)?.value.schema;
2551
+ const type = schemaToType(responseSchema);
2552
+ return /* @__PURE__ */ jsxs("div", {
2553
+ className: "rounded-(--clarify-theme-tokens-radius-xl) p-0",
2554
+ children: [
2555
+ /* @__PURE__ */ jsxs("div", {
2556
+ className: "flex flex-wrap items-center gap-2",
2557
+ children: [/* @__PURE__ */ jsx("span", {
2558
+ className: "text-sm/5 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
2559
+ children: status
2560
+ }), type ? /* @__PURE__ */ jsx("span", {
2561
+ className: "text-xs text-(--clarify-theme-tokens-colors-muted)",
2562
+ children: type
2563
+ }) : null]
2564
+ }),
2565
+ /* @__PURE__ */ jsx("div", {
2566
+ className: "mt-3 text-sm/6 text-(--clarify-ui-text-soft) *:first:mt-0 *:last:mb-0",
2567
+ children: response.description ? /* @__PURE__ */ jsx(Markdown, {
2568
+ className: "*:first:mt-0 *:last:mb-0",
2569
+ children: response.description
2570
+ }) : `${t("openapi.response")}.`
2571
+ }),
2572
+ responseSchema && spec ? /* @__PURE__ */ jsx("div", {
2573
+ className: "mt-4",
2574
+ children: /* @__PURE__ */ jsx(SchemaProperties, {
2575
+ title: t("openapi.responseBodyProperties"),
2576
+ schema: responseSchema,
2577
+ spec
2578
+ })
2579
+ }) : null
2580
+ ]
2581
+ });
2582
+ };
2583
+ if (orderedResponses.length === 1) {
2584
+ const [{ status, response }] = orderedResponses;
2585
+ return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", { children: t("openapi.responses") }), renderResponsePanel({
2586
+ status,
2587
+ response
2588
+ })] });
2589
+ }
2590
+ return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", { children: t("openapi.responses") }), /* @__PURE__ */ jsx(Tabs, {
2591
+ selectedIndex,
2592
+ onChange: (index) => {
2593
+ onSelectStatus?.(orderedResponses[index]?.status ?? "");
2594
+ },
2595
+ items: orderedResponses.map(({ status, response }) => ({
2596
+ id: status,
2597
+ label: status,
2598
+ panel: renderResponsePanel({
2599
+ status,
2600
+ response
2601
+ })
2602
+ })),
2603
+ panelsClassName: "mt-4"
2604
+ })] });
2406
2605
  }
2407
2606
  //#endregion
2408
2607
  //#region source/openapi/components/EndpointSections.tsx
2409
2608
  function EndpointRequest(arg0) {
2410
2609
  const { spec, path, method, description, groupedParameters, parameters, requestBody, requestContents, requestSchema, selectedRequestMediaType, onSelectRequestMediaType, selectedServer, serverVariables, auth, sharedExampleKey, onSelectExampleKey } = arg0;
2411
2610
  const t = useBuiltInText();
2412
- return /* @__PURE__ */ jsxs(Row, {
2611
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [description ? /* @__PURE__ */ jsx(Markdown, { children: description }) : null, /* @__PURE__ */ jsxs(Row, {
2413
2612
  className: "relative mt-6",
2414
- children: [/* @__PURE__ */ jsxs(Col, { children: [
2415
- description ? /* @__PURE__ */ jsx(Markdown, { children: description }) : null,
2416
- /* @__PURE__ */ jsx(ParameterList, {
2417
- title: t("openapi.pathParameters"),
2418
- parameters: groupedParameters.path
2419
- }),
2420
- /* @__PURE__ */ jsx(ParameterList, {
2421
- title: t("openapi.queryParameters"),
2422
- parameters: groupedParameters.query
2423
- }),
2424
- /* @__PURE__ */ jsx(ParameterList, {
2425
- title: t("openapi.headers"),
2426
- parameters: groupedParameters.header
2427
- }),
2428
- requestBody && requestContents.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
2429
- /* @__PURE__ */ jsx("h3", { children: t("openapi.requestBody") }),
2430
- typeof requestBody.description === "string" ? /* @__PURE__ */ jsx(Markdown, { children: requestBody.description }) : null,
2431
- /* @__PURE__ */ jsx(SchemaProperties, {
2432
- title: t("openapi.bodyProperties"),
2433
- schema: requestSchema,
2434
- spec
2435
- })
2436
- ] }) : null
2437
- ] }), /* @__PURE__ */ jsx(Col, {
2613
+ children: [/* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsxs("div", {
2614
+ className: "w-full",
2615
+ children: [
2616
+ /* @__PURE__ */ jsx(ParameterList, {
2617
+ title: t("openapi.pathParameters"),
2618
+ parameters: groupedParameters.path
2619
+ }),
2620
+ /* @__PURE__ */ jsx(ParameterList, {
2621
+ title: t("openapi.queryParameters"),
2622
+ parameters: groupedParameters.query
2623
+ }),
2624
+ /* @__PURE__ */ jsx(ParameterList, {
2625
+ title: t("openapi.headers"),
2626
+ parameters: groupedParameters.header
2627
+ }),
2628
+ requestBody && requestContents.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
2629
+ /* @__PURE__ */ jsx("h3", { children: t("openapi.requestBody") }),
2630
+ typeof requestBody.description === "string" ? /* @__PURE__ */ jsx(Markdown, { children: requestBody.description }) : null,
2631
+ /* @__PURE__ */ jsx(SchemaProperties, {
2632
+ title: t("openapi.bodyProperties"),
2633
+ schema: requestSchema,
2634
+ spec
2635
+ })
2636
+ ] }) : null
2637
+ ]
2638
+ }) }), /* @__PURE__ */ jsx(Col, {
2438
2639
  sticky: true,
2439
- children: /* @__PURE__ */ jsx(RequestExamplesPanel, {
2440
- spec,
2441
- path,
2442
- method,
2443
- parameters,
2444
- requestContents,
2445
- selectedMediaType: selectedRequestMediaType,
2446
- onSelectMediaType: onSelectRequestMediaType,
2447
- selectedServer,
2448
- serverVariables,
2449
- auth,
2450
- sharedExampleKey,
2451
- onSelectExampleKey
2640
+ children: /* @__PURE__ */ jsx("div", {
2641
+ className: "w-full",
2642
+ children: /* @__PURE__ */ jsx(RequestExamplesPanel, {
2643
+ spec,
2644
+ path,
2645
+ method,
2646
+ parameters,
2647
+ requestContents,
2648
+ selectedMediaType: selectedRequestMediaType,
2649
+ onSelectMediaType: onSelectRequestMediaType,
2650
+ selectedServer,
2651
+ serverVariables,
2652
+ auth,
2653
+ sharedExampleKey,
2654
+ onSelectExampleKey
2655
+ })
2452
2656
  })
2453
2657
  })]
2454
- });
2658
+ })] });
2455
2659
  }
2456
2660
  function EndpointResponse(arg0) {
2457
- const { spec, operation, sharedExampleKey, onSelectExampleKey } = arg0;
2458
- return /* @__PURE__ */ jsxs(Row, {
2459
- className: "relative mt-6",
2460
- children: [/* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsx(ResponseList, {
2461
- operation,
2462
- spec
2463
- }) }), /* @__PURE__ */ jsx(Col, {
2464
- sticky: true,
2465
- children: /* @__PURE__ */ jsx(ResponseExamplesPanel, {
2466
- operation,
2467
- spec,
2468
- sharedExampleKey,
2469
- onSelectExampleKey
2470
- })
2471
- })]
2661
+ const { spec, operation, sharedExampleKey, onSelectExampleKey, selectedStatus, onSelectStatus } = arg0;
2662
+ return /* @__PURE__ */ jsx("div", {
2663
+ className: "mt-6",
2664
+ children: /* @__PURE__ */ jsxs(Row, {
2665
+ className: "relative",
2666
+ children: [/* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsx("div", {
2667
+ className: "w-full",
2668
+ children: /* @__PURE__ */ jsx(ResponseList, {
2669
+ operation,
2670
+ spec,
2671
+ selectedStatus,
2672
+ onSelectStatus
2673
+ })
2674
+ }) }), /* @__PURE__ */ jsx(Col, {
2675
+ sticky: true,
2676
+ children: /* @__PURE__ */ jsx("div", {
2677
+ className: "w-full",
2678
+ children: /* @__PURE__ */ jsx(ResponseExamplesPanel, {
2679
+ operation,
2680
+ spec,
2681
+ sharedExampleKey,
2682
+ onSelectExampleKey,
2683
+ selectedStatus,
2684
+ onSelectStatus
2685
+ })
2686
+ })
2687
+ })]
2688
+ })
2472
2689
  });
2473
2690
  }
2474
2691
  //#endregion
@@ -2563,26 +2780,30 @@ function EndpointMethodBadge(arg0) {
2563
2780
  });
2564
2781
  }
2565
2782
  function EndpointPath(arg0) {
2566
- const { path } = arg0;
2567
- const segments = path.split("/").filter(Boolean);
2568
- return /* @__PURE__ */ jsx("div", {
2569
- className: "flex min-w-0 flex-1 items-center overflow-x-auto text-sm font-bold leading-6 whitespace-nowrap",
2570
- children: segments.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
2571
- className: "text-(--clarify-ui-text-faint)",
2572
- children: "/"
2573
- }), segments.map((segment, index) => /* @__PURE__ */ jsxs("span", {
2574
- className: "flex items-center",
2575
- children: [index > 0 ? /* @__PURE__ */ jsx("span", {
2576
- className: "text-(--clarify-ui-text-faint)",
2577
- children: "/"
2578
- }) : null, /* @__PURE__ */ jsx("span", {
2579
- className: "font-bold text-(--clarify-theme-tokens-colors-foreground)",
2580
- children: segment
2581
- })]
2582
- }, `${segment}-${index}`))] }) : /* @__PURE__ */ jsx("span", {
2583
- className: "font-bold text-(--clarify-theme-tokens-colors-foreground)",
2584
- children: "/"
2585
- })
2783
+ const { path, copied = false, onCopy } = arg0;
2784
+ const t = useBuiltInText();
2785
+ return /* @__PURE__ */ jsxs("div", {
2786
+ className: "flex min-w-0 flex-1 items-center gap-2 overflow-hidden",
2787
+ children: [/* @__PURE__ */ jsx("div", {
2788
+ className: "min-w-0 flex-1 overflow-x-auto text-sm font-bold leading-6 whitespace-nowrap",
2789
+ children: /* @__PURE__ */ jsx("span", {
2790
+ className: "select-text font-mono text-(--clarify-theme-tokens-colors-foreground)",
2791
+ children: path || "/"
2792
+ })
2793
+ }), onCopy ? /* @__PURE__ */ jsx("button", {
2794
+ type: "button",
2795
+ "aria-label": copied ? t("actions.copied") : t("actions.copy"),
2796
+ title: copied ? t("actions.copied") : t("actions.copy"),
2797
+ onClick: onCopy,
2798
+ className: clsx("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) text-(--clarify-ui-text-soft) transition hover:border-(--clarify-ui-text-faint) hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-theme-tokens-colors-foreground)", copied && "border-emerald-400/70 bg-emerald-50 text-emerald-700 dark:bg-emerald-400/10 dark:text-emerald-200"),
2799
+ children: copied ? /* @__PURE__ */ jsx(CheckIcon, {
2800
+ className: "h-3.5 w-3.5",
2801
+ "aria-hidden": "true"
2802
+ }) : /* @__PURE__ */ jsx(CopyIcon, {
2803
+ className: "h-3.5 w-3.5",
2804
+ "aria-hidden": "true"
2805
+ })
2806
+ }) : null]
2586
2807
  });
2587
2808
  }
2588
2809
  function InlineListbox(arg0) {
@@ -2630,6 +2851,22 @@ function InlineListbox(arg0) {
2630
2851
  function getServerPreviewUrl(server, variables) {
2631
2852
  return (server.url ?? "").replace(/\{([^}]+)\}/g, (_, name) => variables[name] ?? server.variables?.[name]?.default ?? `{${name}}`);
2632
2853
  }
2854
+ function getFullEndpointUrl(server, variables, path) {
2855
+ const base = getServerPreviewUrl(server, variables);
2856
+ if (!base) return path;
2857
+ return `${base.endsWith("/") ? base.slice(0, -1) : base}${path.startsWith("/") ? path : `/${path}`}`;
2858
+ }
2859
+ function getDefaultResponseStatus(operation, spec) {
2860
+ const orderedResponses = [...getResponseEntries(operation, spec).filter(({ response }) => getMediaTypeEntries(response.content, spec).length > 0)].sort((left, right) => {
2861
+ if (left.status === "default") return -1;
2862
+ if (right.status === "default") return 1;
2863
+ const leftCode = Number(left.status);
2864
+ const rightCode = Number(right.status);
2865
+ if (!Number.isNaN(leftCode) && !Number.isNaN(rightCode)) return leftCode - rightCode;
2866
+ return left.status.localeCompare(right.status);
2867
+ });
2868
+ return orderedResponses.find(({ status }) => status === "default")?.status ?? orderedResponses.find(({ status }) => status.startsWith("2"))?.status ?? orderedResponses[0]?.status ?? "";
2869
+ }
2633
2870
  function ServerUrlValue(arg0) {
2634
2871
  const { server, variables, open, interactive, onToggle } = arg0;
2635
2872
  const url = getServerPreviewUrl(server, variables);
@@ -2779,6 +3016,16 @@ function AuthPanel(arg0) {
2779
3016
  function EndpointIdentity(arg0) {
2780
3017
  const { method, path, servers, selectedServerKey, selectedServer, serverVariables, serverOpen, authOptions, selectedAuthName, selectedAuth, authValues, authOpen, onSelectServer, onChangeServerVariable, onToggleServer, onToggleAuth, onSelectAuth, onChangeAuthValue } = arg0;
2781
3018
  const serverInteractive = servers.length > 1 || Object.keys(selectedServer.variables ?? {}).length > 0;
3019
+ const [copiedUrl, setCopiedUrl] = useState(false);
3020
+ const fullUrl = getFullEndpointUrl(selectedServer, serverVariables, path);
3021
+ useEffect(() => {
3022
+ if (!copiedUrl) return void 0;
3023
+ const timeout = window.setTimeout(() => setCopiedUrl(false), 1200);
3024
+ return () => window.clearTimeout(timeout);
3025
+ }, [copiedUrl]);
3026
+ async function handleCopyUrl() {
3027
+ if (await copyTextToClipboard(fullUrl)) setCopiedUrl(true);
3028
+ }
2782
3029
  return /* @__PURE__ */ jsxs("div", {
2783
3030
  className: "not-prose flex w-full flex-col overflow-hidden rounded-xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) shadow-xs",
2784
3031
  children: [
@@ -2793,7 +3040,11 @@ function EndpointIdentity(arg0) {
2793
3040
  interactive: serverInteractive,
2794
3041
  onToggle: onToggleServer
2795
3042
  }),
2796
- /* @__PURE__ */ jsx(EndpointPath, { path }),
3043
+ /* @__PURE__ */ jsx(EndpointPath, {
3044
+ path,
3045
+ copied: copiedUrl,
3046
+ onCopy: handleCopyUrl
3047
+ }),
2797
3048
  authOptions.length > 0 ? /* @__PURE__ */ jsx("button", {
2798
3049
  type: "button",
2799
3050
  "aria-expanded": authOpen,
@@ -2838,6 +3089,7 @@ function OpenApiOperation(arg0) {
2838
3089
  const serverState = useOperationServerState(spec, operation, path);
2839
3090
  const authState = useOperationAuthState(spec, operation);
2840
3091
  const [linkedExampleKey, setLinkedExampleKey] = useState("");
3092
+ const [selectedResponseStatus, setSelectedResponseStatus] = useState(() => getDefaultResponseStatus(operation, spec));
2841
3093
  return /* @__PURE__ */ jsxs("section", {
2842
3094
  className: "clarify-api-endpoint scroll-mt-24 pb-16 first:pt-0 last:pb-0",
2843
3095
  "aria-labelledby": id,
@@ -2894,7 +3146,9 @@ function OpenApiOperation(arg0) {
2894
3146
  spec,
2895
3147
  operation,
2896
3148
  sharedExampleKey: linkedExampleKey,
2897
- onSelectExampleKey: setLinkedExampleKey
3149
+ onSelectExampleKey: setLinkedExampleKey,
3150
+ selectedStatus: selectedResponseStatus,
3151
+ onSelectStatus: setSelectedResponseStatus
2898
3152
  })
2899
3153
  ]
2900
3154
  });
@@ -2902,4 +3156,4 @@ function OpenApiOperation(arg0) {
2902
3156
  //#endregion
2903
3157
  export { Button as A, Code as C, Card as D, Mermaid as E, CardGroup as O, Collapse as S, Pre as T, HeroPattern as _, authPlaceholder as a, Tag as b, getServerKey as c, getRequestBody$1 as d, Markdown as f, GridPattern as g, Prose as h, ResponseExamplesPanel as i, Callout as k, getServers as l, WebFrame as m, OpenApiOperation as n, defaultServerVariables as o, primitives_exports as p, RequestExamplesPanel as r, getAuthOptions as s, EndpointIdentity as t, getMediaTypeEntries as u, Logo as v, CodeGroup as w, Feedback as x, Heading as y };
2904
3158
 
2905
- //# sourceMappingURL=OpenApiOperation-DIFaYAe5.js.map
3159
+ //# sourceMappingURL=OpenApiOperation-Dhlz3JSx.js.map