@clarify-labs/renderer 0.4.0 → 0.5.0

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 (97) hide show
  1. package/output/AppShell-D3FsVHQK.js +390 -0
  2. package/output/AppShell-D3FsVHQK.js.map +1 -0
  3. package/output/AppShell-DeaJ-rgo.cjs +409 -0
  4. package/output/AppShell-DeaJ-rgo.cjs.map +1 -0
  5. package/output/OpenApiOperation-DYXG-6Rw.js +1772 -0
  6. package/output/OpenApiOperation-DYXG-6Rw.js.map +1 -0
  7. package/output/OpenApiOperation-mhoi-s4N.cjs +1840 -0
  8. package/output/OpenApiOperation-mhoi-s4N.cjs.map +1 -0
  9. package/output/app/PageNavigation.d.ts +7 -0
  10. package/output/app/PageSkeleton.d.ts +1 -0
  11. package/output/{components → app}/SectionProvider.d.ts +3 -2
  12. package/output/chunk-DakpK96I.cjs +43 -0
  13. package/output/client.cjs +1 -1
  14. package/output/client.js +1 -1
  15. package/output/components/Button.d.ts +18 -0
  16. package/output/components/Code.d.ts +11 -7
  17. package/output/components/Collapse.d.ts +9 -0
  18. package/output/components/Heading.d.ts +10 -0
  19. package/output/components/Logo.d.ts +2 -0
  20. package/output/components/Prose.d.ts +7 -0
  21. package/output/components/Tag.d.ts +34 -0
  22. package/output/components/index.d.ts +9 -80
  23. package/output/components/patterns.d.ts +4 -2
  24. package/output/context.d.ts +1 -8
  25. package/output/core/context.d.ts +8 -0
  26. package/output/core/i18n.d.ts +5 -0
  27. package/output/core/index.d.ts +3 -0
  28. package/output/core/types.d.ts +174 -0
  29. package/output/i18n.d.ts +1 -5
  30. package/output/index.cjs +105 -1741
  31. package/output/index.cjs.map +1 -1
  32. package/output/index.d.ts +15 -4
  33. package/output/index.js +71 -1719
  34. package/output/index.js.map +1 -1
  35. package/output/markdown.cjs +3 -0
  36. package/output/markdown.d.ts +1 -0
  37. package/output/markdown.js +2 -0
  38. package/output/mdx/DocShell.d.ts +7 -0
  39. package/output/mdx/Markdown.d.ts +7 -0
  40. package/output/mdx/components.d.ts +7 -7
  41. package/output/mdx/primitives.d.ts +18 -12
  42. package/output/mdx/remark.d.ts +2 -0
  43. package/output/openapi/{example-panels.d.ts → components/ExamplePanels.d.ts} +14 -9
  44. package/output/openapi/components/OpenApiOperation.d.ts +33 -0
  45. package/output/openapi/components/SchemaProperties.d.ts +20 -0
  46. package/output/openapi/entry.d.ts +13 -0
  47. package/output/openapi/index.d.ts +3 -3
  48. package/output/openapi/{helpers.d.ts → lib/helpers.d.ts} +7 -6
  49. package/output/openapi/{request-code.d.ts → lib/request-code.d.ts} +7 -5
  50. package/output/openapi/types.d.ts +5 -1
  51. package/output/preview/openapi.d.ts +28 -0
  52. package/output/preview.cjs +734 -0
  53. package/output/preview.cjs.map +1 -0
  54. package/output/preview.d.ts +19 -0
  55. package/output/preview.js +731 -0
  56. package/output/preview.js.map +1 -0
  57. package/output/remark-DNOdJz5i.cjs +14 -0
  58. package/output/remark-DNOdJz5i.cjs.map +1 -0
  59. package/output/remark-o5sg9Ilv.js +7 -0
  60. package/output/remark-o5sg9Ilv.js.map +1 -0
  61. package/output/{render-BCiQn6Q1.js → render-BpavVnAe.js} +3 -2
  62. package/output/render-BpavVnAe.js.map +1 -0
  63. package/output/{render-CZsdzmme.cjs → render-CjZt3edL.cjs} +6 -5
  64. package/output/render-CjZt3edL.cjs.map +1 -0
  65. package/output/renderer.css +403 -63
  66. package/output/server.cjs +7 -5
  67. package/output/server.cjs.map +1 -1
  68. package/output/server.js +4 -2
  69. package/output/server.js.map +1 -1
  70. package/output/shell/Navigation.d.ts +3 -2
  71. package/output/shell/Search.d.ts +6 -4
  72. package/output/{components → shell}/SiteLogo.d.ts +1 -1
  73. package/output/shell/icons.d.ts +3 -2
  74. package/output/shell/mobile.d.ts +3 -2
  75. package/output/{AppShell-nQnuKyn2.js → shell-BlMMdTpZ.js} +1118 -1320
  76. package/output/shell-BlMMdTpZ.js.map +1 -0
  77. package/output/{AppShell-CZw1MrPG.cjs → shell-_MyLsMUI.cjs} +1192 -1394
  78. package/output/shell-_MyLsMUI.cjs.map +1 -0
  79. package/output/{components → theme}/ThemeProvider.d.ts +3 -2
  80. package/output/types.d.ts +1 -174
  81. package/output/utils/clipboard.d.ts +1 -0
  82. package/output/utils/hash.d.ts +1 -0
  83. package/output/utils/href.d.ts +5 -0
  84. package/output/utils/lucide.d.ts +17 -0
  85. package/package.json +15 -2
  86. package/output/AppShell-CZw1MrPG.cjs.map +0 -1
  87. package/output/AppShell-nQnuKyn2.js.map +0 -1
  88. package/output/components/PageNavigation.d.ts +0 -5
  89. package/output/openapi/openapi-page.d.ts +0 -19
  90. package/output/openapi/schema-properties.d.ts +0 -15
  91. package/output/render-BCiQn6Q1.js.map +0 -1
  92. package/output/render-CZsdzmme.cjs.map +0 -1
  93. /package/output/{components → app}/BuiltWithClarify.d.ts +0 -0
  94. /package/output/{components → app}/PageFooter.d.ts +0 -0
  95. /package/output/openapi/{spec-path.d.ts → lib/spec-path.d.ts} +0 -0
  96. /package/output/openapi/{utils.d.ts → lib/utils.d.ts} +0 -0
  97. /package/output/{components → theme}/ThemeToggle.d.ts +0 -0
package/output/index.js CHANGED
@@ -1,1306 +1,11 @@
1
- import { A as remToPx, C as useBuiltInText, D as useOpenApis, E as useClarifyConfig, O as SectionProvider, S as BuiltWithClarify, T as OpenApisContext, _ as CodeGroup, a as Heading, b as CardGroup, c as Tag, d as useTheme, f as PageFooter, g as Code, h as Feedback, i as DocShell, k as useSectionStore, l as ThemeToggle, m as HeroPattern, n as ApiEndpointCard, o as Logo, p as GridPattern, r as Button, s as Prose, t as AppShell, u as ThemeProvider, v as Pre, w as ClarifyConfigContext, x as Callout, y as Card } from "./AppShell-nQnuKyn2.js";
2
- import { t as render } from "./render-BCiQn6Q1.js";
3
- import clsx from "clsx";
4
- import { createElement, useState } from "react";
5
- import { Link, useLocation } from "react-router-dom";
6
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
- import { CheckIcon, ChevronDown, ChevronDownIcon, ChevronRight, ChevronsUpDownIcon, ClipboardIcon, CodeIcon, LockKeyholeIcon, PackageIcon, ServerIcon, UnlockKeyholeIcon } from "lucide-react";
8
- import { Listbox, ListboxButton, ListboxOption, ListboxOptions } from "@headlessui/react";
9
- import { slug } from "github-slugger";
10
- import { snippetz } from "@scalar/snippetz";
11
- //#region \0rolldown/runtime.js
12
- var __defProp = Object.defineProperty;
13
- var __exportAll = (all, no_symbols) => {
14
- let target = {};
15
- for (var name in all) __defProp(target, name, {
16
- get: all[name],
17
- enumerable: true
18
- });
19
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
20
- return target;
21
- };
22
- //#endregion
23
- //#region source/mdx/primitives.tsx
24
- var primitives_exports = /* @__PURE__ */ __exportAll({
25
- Button: () => Button,
26
- Callout: () => Callout,
27
- Card: () => Card,
28
- CardGroup: () => CardGroup,
29
- CodeGroup: () => CodeGroup,
30
- Col: () => Col,
31
- Note: () => Note,
32
- Properties: () => Properties,
33
- Property: () => Property,
34
- Row: () => Row,
35
- a: () => a,
36
- code: () => code,
37
- h2: () => h2,
38
- h3: () => h3,
39
- pre: () => pre,
40
- wrapper: () => wrapper
41
- });
42
- function wrapper(arg0) {
43
- const { children } = arg0;
44
- return /* @__PURE__ */ jsx("article", {
45
- className: "clarify-mdx-page flex h-full flex-col pt-16 pb-10",
46
- children: /* @__PURE__ */ jsx(Prose, {
47
- className: "flex-auto",
48
- children
49
- })
50
- });
51
- }
52
- function a(arg0) {
53
- const { href = "", ...props } = arg0;
54
- if (href.startsWith("/") && !href.startsWith("//")) return /* @__PURE__ */ jsx(Link, {
55
- to: href,
56
- ...props
57
- });
58
- return /* @__PURE__ */ jsx("a", {
59
- href,
60
- ...props
61
- });
62
- }
63
- var code = Code;
64
- var pre = Pre;
65
- function h2(props) {
66
- return createElement(Heading, {
67
- level: 2,
68
- ...props
69
- });
70
- }
71
- function h3(props) {
72
- return createElement(Heading, {
73
- level: 3,
74
- ...props
75
- });
76
- }
77
- function InfoIcon(props) {
78
- return /* @__PURE__ */ jsxs("svg", {
79
- viewBox: "0 0 16 16",
80
- "aria-hidden": "true",
81
- ...props,
82
- children: [
83
- /* @__PURE__ */ jsx("circle", {
84
- cx: "8",
85
- cy: "8",
86
- r: "8",
87
- strokeWidth: "0"
88
- }),
89
- /* @__PURE__ */ jsx("path", {
90
- fill: "none",
91
- strokeLinecap: "round",
92
- strokeLinejoin: "round",
93
- strokeWidth: "1.5",
94
- d: "M6.75 7.75h1.5v3.5"
95
- }),
96
- /* @__PURE__ */ jsx("circle", {
97
- cx: "8",
98
- cy: "4",
99
- r: ".5",
100
- fill: "none"
101
- })
102
- ]
103
- });
104
- }
105
- function Note(arg0) {
106
- const { children } = arg0;
107
- return /* @__PURE__ */ jsxs("div", {
108
- className: "clarify-note my-6 flex gap-2.5 rounded-(--clarify-theme-tokens-radius-xl) border border-(--clarify-ui-accent-border) bg-(--clarify-ui-accent-background) p-4 text-sm/6 text-(--clarify-theme-tokens-colors-foreground) dark:text-zinc-100 dark:[--tw-prose-links-hover:var(--clarify-ui-accent-text)] dark:[--tw-prose-links:var(--color-white)]",
109
- children: [/* @__PURE__ */ jsx(InfoIcon, { className: "mt-1 h-4 w-4 flex-none fill-(--clarify-ui-accent-text) stroke-(--clarify-theme-tokens-colors-surface) dark:fill-(--clarify-ui-accent-background) dark:stroke-(--clarify-ui-accent-text)" }), /* @__PURE__ */ jsx("div", {
110
- className: "*:first:mt-0 *:last:mb-0",
111
- children
112
- })]
113
- });
114
- }
115
- function Row(arg0) {
116
- const { children } = arg0;
117
- return /* @__PURE__ */ jsx("div", {
118
- className: "clarify-row grid grid-cols-1 items-start gap-x-8 gap-y-10 xl:max-w-none xl:grid-cols-2",
119
- children
120
- });
121
- }
122
- function Col(arg0) {
123
- const { children, sticky = false } = arg0;
124
- return /* @__PURE__ */ jsx("div", {
125
- className: clsx("clarify-col *:first:mt-0 *:last:mb-0", sticky && "xl:sticky xl:top-24"),
126
- children
127
- });
128
- }
129
- function Properties(arg0) {
130
- const { children } = arg0;
131
- return /* @__PURE__ */ jsx("div", {
132
- className: "clarify-properties my-6",
133
- children: /* @__PURE__ */ jsx("ul", {
134
- role: "list",
135
- className: "m-0 list-none divide-y divide-zinc-900/5 p-0 dark:divide-white/5",
136
- children
137
- })
138
- });
139
- }
140
- function Property(arg0) {
141
- const { name, children, type } = arg0;
142
- return /* @__PURE__ */ jsx("li", {
143
- className: "clarify-property m-0 px-0 py-4 first:pt-0 last:pb-0",
144
- children: /* @__PURE__ */ jsxs("dl", {
145
- className: "m-0 flex flex-wrap items-center gap-x-3 gap-y-2",
146
- children: [
147
- /* @__PURE__ */ jsx("dt", {
148
- className: "sr-only",
149
- children: "Name"
150
- }),
151
- /* @__PURE__ */ jsx("dd", { children: /* @__PURE__ */ jsx("span", {
152
- className: "text-sm/5 font-semibold text-zinc-950 dark:text-white",
153
- children: name
154
- }) }),
155
- type ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("dt", {
156
- className: "sr-only",
157
- children: "Type"
158
- }), /* @__PURE__ */ jsx("dd", {
159
- className: "font-mono text-xs text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-500",
160
- children: type
161
- })] }) : null,
162
- /* @__PURE__ */ jsx("dt", {
163
- className: "sr-only",
164
- children: "Description"
165
- }),
166
- /* @__PURE__ */ jsx("dd", {
167
- className: "w-full flex-none *:first:mt-0 *:last:mb-0",
168
- children
169
- })
170
- ]
171
- })
172
- });
173
- }
174
- //#endregion
175
- //#region source/openapi/helpers.ts
176
- function isRecord(value) {
177
- return typeof value === "object" && value !== null && !Array.isArray(value);
178
- }
179
- function isReference(value) {
180
- return isRecord(value) && typeof value.$ref === "string";
181
- }
182
- function resolveReferenceName(ref) {
183
- return ref.split("/").filter(Boolean).at(-1) ?? ref;
184
- }
185
- function resolveOpenApiRef(spec, ref) {
186
- if (!ref.startsWith("#/")) return void 0;
187
- return ref.slice(2).split("/").map((part) => part.replace(/~1/g, "/").replace(/~0/g, "~")).reduce((current, part) => isRecord(current) ? current[part] : void 0, spec);
188
- }
189
- function resolveSchema(spec, schema, seen = /* @__PURE__ */ new Set()) {
190
- if (!isReference(schema)) return schema;
191
- if (seen.has(schema.$ref)) return schema;
192
- seen.add(schema.$ref);
193
- return resolveSchema(spec, resolveOpenApiRef(spec, schema.$ref), seen) ?? schema;
194
- }
195
- function getPathItem(spec, path) {
196
- const pathItem = spec.paths?.[path];
197
- return isRecord(pathItem) ? pathItem : void 0;
198
- }
199
- function getOperationParameters(spec, path, operation) {
200
- const pathParameters = getPathItem(spec, path)?.parameters;
201
- const operationParameters = operation.parameters;
202
- return [...Array.isArray(pathParameters) ? pathParameters : [], ...Array.isArray(operationParameters) ? operationParameters : []].filter((parameter) => isRecord(parameter) && !isReference(parameter));
203
- }
204
- function getRequestBody$1(operation) {
205
- const requestBody = operation.requestBody;
206
- return isRecord(requestBody) && !isReference(requestBody) ? requestBody : void 0;
207
- }
208
- function getMediaTypeEntries(content) {
209
- if (!isRecord(content)) return [];
210
- return Object.entries(content).filter(([, value]) => isRecord(value) && !isReference(value)).map(([mediaType, value]) => ({
211
- mediaType,
212
- value
213
- })).sort((a, z) => {
214
- return (a.mediaType.includes("json") ? 0 : 1) - (z.mediaType.includes("json") ? 0 : 1);
215
- });
216
- }
217
- function getJsonLikeContent(content) {
218
- return getMediaTypeEntries(content)[0];
219
- }
220
- function getExampleValue(example) {
221
- if (isRecord(example) && "value" in example) return example.value;
222
- if (isRecord(example) && "externalValue" in example) return void 0;
223
- return example;
224
- }
225
- function getExampleTitle(key, example) {
226
- if (isRecord(example)) {
227
- const summary = typeof example.summary === "string" ? example.summary : void 0;
228
- return {
229
- title: summary ?? key,
230
- summary
231
- };
232
- }
233
- return { title: key };
234
- }
235
- function getExampleEntries(mediaType) {
236
- if (!mediaType) return [];
237
- if (isRecord(mediaType.examples)) {
238
- const examples = [];
239
- for (const [key, example] of Object.entries(mediaType.examples)) {
240
- const value = getExampleValue(example);
241
- if (typeof value === "undefined") continue;
242
- const { title, summary } = getExampleTitle(key, example);
243
- examples.push({
244
- key,
245
- title,
246
- summary,
247
- value
248
- });
249
- }
250
- if (examples.length > 0) return examples;
251
- }
252
- if (typeof mediaType.example !== "undefined") return [{
253
- key: "default",
254
- title: "Example",
255
- value: mediaType.example
256
- }];
257
- const generated = schemaToExample(mediaType.schema);
258
- return typeof generated === "undefined" ? [] : [{
259
- key: "schema",
260
- title: "schema",
261
- value: generated,
262
- generated: true
263
- }];
264
- }
265
- function getContentExample(mediaType) {
266
- return getExampleEntries(mediaType)[0]?.value;
267
- }
268
- function schemaToType(schema) {
269
- if (!isRecord(schema)) return void 0;
270
- if (isReference(schema)) return resolveReferenceName(schema.$ref);
271
- if (typeof schema.const !== "undefined") return JSON.stringify(schema.const);
272
- if (Array.isArray(schema.enum)) return schema.enum.map(String).join(" | ");
273
- const oneOf = schema.oneOf ?? schema.anyOf;
274
- if (Array.isArray(oneOf)) return oneOf.map(schemaToType).filter(Boolean).join(" | ");
275
- if (Array.isArray(schema.allOf)) return schema.allOf.map(schemaToType).filter(Boolean).join(" & ");
276
- if (schema.type === "array") return `${schemaToType(schema.items) ?? "unknown"}[]`;
277
- const type = Array.isArray(schema.type) ? schema.type.map(String).join(" | ") : schema.type;
278
- return typeof type === "string" ? [type, typeof schema.format === "string" ? `<${schema.format}>` : void 0].filter(Boolean).join("") : void 0;
279
- }
280
- function schemaToExample(schema, depth = 0) {
281
- if (!isRecord(schema) || depth > 3) return void 0;
282
- if (typeof schema.example !== "undefined") return schema.example;
283
- if (typeof schema.default !== "undefined") return schema.default;
284
- if (Array.isArray(schema.enum)) return schema.enum[0];
285
- if (isReference(schema)) return { id: resolveReferenceName(schema.$ref) };
286
- if (schema.type === "array") return [schemaToExample(schema.items, depth + 1) ?? "string"];
287
- if (schema.type === "object" || isRecord(schema.properties)) {
288
- const properties = isRecord(schema.properties) ? schema.properties : {};
289
- return Object.fromEntries(Object.entries(properties).slice(0, 8).map(([name, propertySchema]) => [name, schemaToExample(propertySchema, depth + 1) ?? exampleForType(schemaToType(propertySchema))]));
290
- }
291
- return exampleForType(schemaToType(schema));
292
- }
293
- function exampleForType(type) {
294
- if (!type) return "string";
295
- if (type.endsWith("[]")) return [];
296
- if (type.includes("integer") || type.includes("number")) return 42;
297
- if (type.includes("boolean")) return true;
298
- if (type.includes("object")) return {};
299
- return "string";
300
- }
301
- function stringifyExample(value) {
302
- if (typeof value === "undefined") return "";
303
- if (typeof value === "string") return value;
304
- return JSON.stringify(value, null, 2);
305
- }
306
- function getResponseEntries(operation) {
307
- const responses = operation.responses;
308
- if (!isRecord(responses)) return [];
309
- return Object.entries(responses).filter(([, response]) => isRecord(response) && !isReference(response)).map(([status, response]) => ({
310
- status,
311
- response
312
- }));
313
- }
314
- function codeLanguageForMediaType(mediaType) {
315
- if (!mediaType) return "json";
316
- if (mediaType.includes("json")) return "json";
317
- if (mediaType.includes("yaml") || mediaType.includes("yml")) return "yaml";
318
- if (mediaType.startsWith("text/")) return "text";
319
- if (mediaType.includes("xml")) return "xml";
320
- return "text";
321
- }
322
- //#endregion
323
- //#region source/openapi/request-code.ts
324
- var snippetGenerator = snippetz();
325
- function getDefaultServer(spec) {
326
- const servers = spec.servers;
327
- if (!Array.isArray(servers)) return { url: "https://api.example.com" };
328
- const firstServer = servers.find(isRecord);
329
- return firstServer && typeof firstServer.url === "string" ? firstServer : { url: "https://api.example.com" };
330
- }
331
- function expandServerUrl(server, serverVariables = {}) {
332
- return (server.url ?? "https://api.example.com").replace(/\{([^}]+)\}/g, (_, name) => {
333
- const fallback = server.variables?.[name]?.default ?? name;
334
- return serverVariables[name] ?? fallback;
335
- });
336
- }
337
- function buildOperationUrl(input) {
338
- return `${expandServerUrl(input.server ?? getDefaultServer(input.spec), input.serverVariables).replace(/\/$/, "")}${input.path}`;
339
- }
340
- function getQueryString(parameters, auth) {
341
- const queryString = parameters.filter((parameter) => parameter.in === "query" && parameter.name).map((parameter) => ({
342
- name: parameter.name,
343
- value: encodeUrlPlaceholders(`{${parameter.name}}`)
344
- }));
345
- if (auth?.scheme.type === "apiKey" && auth.scheme.in === "query" && auth.scheme.name) queryString.push({
346
- name: auth.scheme.name,
347
- value: auth.value
348
- });
349
- return queryString;
350
- }
351
- function isFormMediaType(mediaType) {
352
- return mediaType.includes("multipart/form-data") || mediaType.includes("application/x-www-form-urlencoded");
353
- }
354
- function isBinarySchema(schema) {
355
- return isRecord(schema) && schema.type === "string" && schema.format === "binary";
356
- }
357
- function getSchemaProperties(schema) {
358
- return isRecord(schema) && isRecord(schema.properties) ? schema.properties : {};
359
- }
360
- function getFieldValue(name, value, schema) {
361
- if (isRecord(value) && typeof value[name] !== "undefined") return value[name];
362
- if (isBinarySchema(schema)) return `@${name}`;
363
- }
364
- function getFormParams(value, requestContent) {
365
- const properties = getSchemaProperties(requestContent.value.schema);
366
- return Array.from(new Set([...Object.keys(properties), ...isRecord(value) ? Object.keys(value) : []])).flatMap((name) => {
367
- const fieldValue = getFieldValue(name, value, properties[name]);
368
- if (typeof fieldValue === "undefined") return [];
369
- const contentType = requestContent.value.encoding?.[name]?.contentType;
370
- return [{
371
- name,
372
- value: typeof fieldValue === "string" ? fieldValue : stringifyExample(fieldValue),
373
- ...contentType ? { contentType } : {}
374
- }];
375
- });
376
- }
377
- function getBodySize(requestBody) {
378
- if (requestBody?.serialized) return requestBody.serialized.length;
379
- return requestBody?.params?.reduce((size, param) => size + param.name.length + String(param.value ?? "").length, 0) ?? 0;
380
- }
381
- function getRequestBody(requestContent) {
382
- const value = getContentExample(requestContent?.value);
383
- if (!requestContent || typeof value === "undefined") return void 0;
384
- if (isFormMediaType(requestContent.mediaType)) {
385
- const params = getFormParams(value, requestContent);
386
- return params.length > 0 ? { params } : void 0;
387
- }
388
- return { serialized: stringifyExample(value) };
389
- }
390
- function getAuthorizationValue(auth) {
391
- if (auth.scheme.type === "http" && auth.scheme.scheme?.toLowerCase() === "bearer") return `Bearer ${auth.value}`;
392
- if (auth.scheme.type === "http" && auth.scheme.scheme?.toLowerCase() === "basic") return `Basic ${auth.value}`;
393
- if (auth.scheme.type === "oauth2" || auth.scheme.type === "openIdConnect") return `Bearer ${auth.value}`;
394
- }
395
- function getAuthHeaders(auth) {
396
- if (!auth) return {};
397
- if (auth.scheme.type === "apiKey" && auth.scheme.in === "header" && auth.scheme.name) return { [auth.scheme.name]: auth.value };
398
- const authorization = getAuthorizationValue(auth);
399
- return authorization ? { Authorization: authorization } : {};
400
- }
401
- function getRequestHeaders(requestContent, auth) {
402
- return {
403
- ...getAuthHeaders(auth),
404
- Accept: "application/json",
405
- ...requestContent ? { "Content-Type": requestContent.mediaType } : {}
406
- };
407
- }
408
- function encodeUrlPlaceholders(url) {
409
- return url.replace(/\{([^}]+)\}/g, (_, name) => `%7B${encodeURIComponent(name)}%7D`);
410
- }
411
- function decodeUrlPlaceholders(code) {
412
- return code.replace(/%7B([^%]+)%7D/g, (_, name) => `{${decodeURIComponent(name)}}`);
413
- }
414
- function buildHarRequest(input) {
415
- const requestBody = getRequestBody(input.requestContent);
416
- const url = encodeUrlPlaceholders(buildOperationUrl(input));
417
- return {
418
- method: input.method,
419
- url,
420
- httpVersion: "HTTP/1.1",
421
- cookies: [],
422
- headers: Object.entries(getRequestHeaders(input.requestContent, input.auth)).map(([name, value]) => ({
423
- name,
424
- value
425
- })),
426
- queryString: getQueryString(input.parameters, input.auth),
427
- headersSize: -1,
428
- bodySize: getBodySize(requestBody),
429
- postData: requestBody ? {
430
- mimeType: input.requestContent?.mediaType ?? "",
431
- ...requestBody.serialized ? { text: requestBody.serialized } : {},
432
- ...requestBody.params ? { params: requestBody.params } : {}
433
- } : void 0
434
- };
435
- }
436
- function buildSnippet(input, target) {
437
- return decodeUrlPlaceholders(snippetGenerator.print(target.target, target.client, buildHarRequest(input)) || "");
438
- }
439
- var requestSnippetOptions = [
440
- {
441
- languageKey: "shell",
442
- title: "Shell",
443
- language: "bash",
444
- target: "shell",
445
- client: "curl",
446
- clientTitle: "cURL"
447
- },
448
- {
449
- languageKey: "shell",
450
- title: "Shell",
451
- language: "bash",
452
- target: "shell",
453
- client: "wget",
454
- clientTitle: "Wget"
455
- },
456
- {
457
- languageKey: "shell",
458
- title: "Shell",
459
- language: "bash",
460
- target: "shell",
461
- client: "httpie",
462
- clientTitle: "HTTPie"
463
- },
464
- {
465
- languageKey: "javascript",
466
- title: "JavaScript",
467
- language: "javascript",
468
- target: "js",
469
- client: "fetch",
470
- clientTitle: "Fetch"
471
- },
472
- {
473
- languageKey: "javascript",
474
- title: "JavaScript",
475
- language: "javascript",
476
- target: "js",
477
- client: "axios",
478
- clientTitle: "Axios"
479
- },
480
- {
481
- languageKey: "javascript",
482
- title: "JavaScript",
483
- language: "javascript",
484
- target: "js",
485
- client: "ofetch",
486
- clientTitle: "ofetch"
487
- },
488
- {
489
- languageKey: "javascript",
490
- title: "JavaScript",
491
- language: "javascript",
492
- target: "js",
493
- client: "xhr",
494
- clientTitle: "XHR"
495
- },
496
- {
497
- languageKey: "typescript",
498
- title: "TypeScript",
499
- language: "typescript",
500
- target: "js",
501
- client: "fetch",
502
- clientTitle: "Fetch"
503
- },
504
- {
505
- languageKey: "typescript",
506
- title: "TypeScript",
507
- language: "typescript",
508
- target: "js",
509
- client: "axios",
510
- clientTitle: "Axios"
511
- },
512
- {
513
- languageKey: "typescript",
514
- title: "TypeScript",
515
- language: "typescript",
516
- target: "js",
517
- client: "ofetch",
518
- clientTitle: "ofetch"
519
- },
520
- {
521
- languageKey: "python",
522
- title: "Python",
523
- language: "python",
524
- target: "python",
525
- client: "requests",
526
- clientTitle: "Requests"
527
- },
528
- {
529
- languageKey: "python",
530
- title: "Python",
531
- language: "python",
532
- target: "python",
533
- client: "python3",
534
- clientTitle: "http.client"
535
- },
536
- {
537
- languageKey: "python",
538
- title: "Python",
539
- language: "python",
540
- target: "python",
541
- client: "httpx_sync",
542
- clientTitle: "HTTPX"
543
- },
544
- {
545
- languageKey: "python",
546
- title: "Python",
547
- language: "python",
548
- target: "python",
549
- client: "aiohttp",
550
- clientTitle: "aiohttp"
551
- },
552
- {
553
- languageKey: "go",
554
- title: "Go",
555
- language: "go",
556
- target: "go",
557
- client: "native",
558
- clientTitle: "NewRequest"
559
- },
560
- {
561
- languageKey: "node",
562
- title: "Node.js",
563
- language: "javascript",
564
- target: "node",
565
- client: "fetch",
566
- clientTitle: "Fetch"
567
- },
568
- {
569
- languageKey: "node",
570
- title: "Node.js",
571
- language: "javascript",
572
- target: "node",
573
- client: "axios",
574
- clientTitle: "Axios"
575
- },
576
- {
577
- languageKey: "node",
578
- title: "Node.js",
579
- language: "javascript",
580
- target: "node",
581
- client: "ofetch",
582
- clientTitle: "ofetch"
583
- },
584
- {
585
- languageKey: "node",
586
- title: "Node.js",
587
- language: "javascript",
588
- target: "node",
589
- client: "undici",
590
- clientTitle: "undici"
591
- },
592
- {
593
- languageKey: "java",
594
- title: "Java",
595
- language: "java",
596
- target: "java",
597
- client: "nethttp",
598
- clientTitle: "java.net.http"
599
- },
600
- {
601
- languageKey: "java",
602
- title: "Java",
603
- language: "java",
604
- target: "java",
605
- client: "okhttp",
606
- clientTitle: "OkHttp"
607
- },
608
- {
609
- languageKey: "java",
610
- title: "Java",
611
- language: "java",
612
- target: "java",
613
- client: "unirest",
614
- clientTitle: "Unirest"
615
- },
616
- {
617
- languageKey: "java",
618
- title: "Java",
619
- language: "java",
620
- target: "java",
621
- client: "asynchttp",
622
- clientTitle: "AsyncHttp"
623
- },
624
- {
625
- languageKey: "csharp",
626
- title: "C#",
627
- language: "csharp",
628
- target: "csharp",
629
- client: "httpclient",
630
- clientTitle: "HttpClient"
631
- },
632
- {
633
- languageKey: "csharp",
634
- title: "C#",
635
- language: "csharp",
636
- target: "csharp",
637
- client: "restsharp",
638
- clientTitle: "RestSharp"
639
- },
640
- {
641
- languageKey: "php",
642
- title: "PHP",
643
- language: "php",
644
- target: "php",
645
- client: "guzzle",
646
- clientTitle: "Guzzle"
647
- },
648
- {
649
- languageKey: "php",
650
- title: "PHP",
651
- language: "php",
652
- target: "php",
653
- client: "curl",
654
- clientTitle: "cURL"
655
- },
656
- {
657
- languageKey: "php",
658
- title: "PHP",
659
- language: "php",
660
- target: "php",
661
- client: "laravel",
662
- clientTitle: "Laravel HTTP Client"
663
- },
664
- {
665
- languageKey: "ruby",
666
- title: "Ruby",
667
- language: "ruby",
668
- target: "ruby",
669
- client: "native",
670
- clientTitle: "net::http"
671
- },
672
- {
673
- languageKey: "rust",
674
- title: "Rust",
675
- language: "rust",
676
- target: "rust",
677
- client: "reqwest",
678
- clientTitle: "reqwest"
679
- },
680
- {
681
- languageKey: "swift",
682
- title: "Swift",
683
- language: "swift",
684
- target: "swift",
685
- client: "nsurlsession",
686
- clientTitle: "NSURLSession"
687
- },
688
- {
689
- languageKey: "kotlin",
690
- title: "Kotlin",
691
- language: "kotlin",
692
- target: "kotlin",
693
- client: "okhttp",
694
- clientTitle: "OkHttp"
695
- },
696
- {
697
- languageKey: "powershell",
698
- title: "PowerShell",
699
- language: "powershell",
700
- target: "powershell",
701
- client: "restmethod",
702
- clientTitle: "Invoke-RestMethod"
703
- },
704
- {
705
- languageKey: "powershell",
706
- title: "PowerShell",
707
- language: "powershell",
708
- target: "powershell",
709
- client: "webrequest",
710
- clientTitle: "Invoke-WebRequest"
711
- }
712
- ];
713
- function buildRequestCodeExamples(input) {
714
- return requestSnippetOptions.map((option) => ({
715
- key: `${option.languageKey}:${option.client}`,
716
- title: option.title,
717
- language: option.language,
718
- languageKey: option.languageKey,
719
- clientKey: option.client,
720
- clientTitle: option.clientTitle,
721
- code: buildSnippet(input, option)
722
- }));
723
- }
724
- //#endregion
725
- //#region source/openapi/example-panels.tsx
726
- function SelectControl(arg0) {
727
- const { label, value, options, onChange, icon, compact = false } = arg0;
728
- const normalizedOptions = options.map((option) => typeof option === "string" ? {
729
- value: option,
730
- label: option
731
- } : option);
732
- const selectedOption = normalizedOptions.find((option) => option.value === value) ?? normalizedOptions[0];
733
- const wrapperClassName = compact ? "clarify-api-select relative min-w-0 text-xs" : "clarify-api-select relative shrink-0 text-xs";
734
- const buttonSizeClassName = compact ? "w-full min-w-0 max-w-32" : "min-w-28 max-w-48";
735
- if (normalizedOptions.length <= 1) return null;
736
- return /* @__PURE__ */ jsx(Listbox, {
737
- value,
738
- onChange,
739
- children: /* @__PURE__ */ jsxs("div", {
740
- className: wrapperClassName,
741
- children: [/* @__PURE__ */ jsxs(ListboxButton, {
742
- "aria-label": label,
743
- className: `clarify-api-select-button flex ${buttonSizeClassName} items-center justify-between gap-2 rounded-lg bg-black/30 px-2 py-1 font-mono text-xs font-medium whitespace-nowrap text-zinc-100 outline-hidden transition hover:bg-black/50 focus:ring-2 focus:ring-emerald-400/25 data-open:bg-white/10 data-open:ring-2 data-open:ring-emerald-400/25`,
744
- children: [/* @__PURE__ */ jsxs("span", {
745
- className: "flex min-w-0 items-center gap-1.5 overflow-hidden",
746
- children: [icon ? /* @__PURE__ */ jsx("span", {
747
- className: "shrink-0 text-zinc-500",
748
- children: icon
749
- }) : null, /* @__PURE__ */ jsx("span", {
750
- className: "truncate",
751
- children: selectedOption?.label ?? value
752
- })]
753
- }), /* @__PURE__ */ jsx(ChevronsUpDownIcon, {
754
- className: "h-3.5 w-3.5 shrink-0 text-zinc-500",
755
- "aria-hidden": "true"
756
- })]
757
- }), /* @__PURE__ */ jsx(ListboxOptions, {
758
- anchor: "bottom end",
759
- className: "clarify-api-select-options z-30 mt-1 max-h-64 w-max min-w-(--button-width) max-w-[min(32rem,calc(100vw-2rem))] overflow-auto rounded-xl bg-zinc-900 p-1 text-xs shadow-lg shadow-black/20 ring-1 ring-white/10 [--anchor-gap:--spacing(1)] focus:outline-none",
760
- children: normalizedOptions.map((option) => /* @__PURE__ */ jsxs(ListboxOption, {
761
- value: option.value,
762
- className: "clarify-api-select-option group flex cursor-default items-center justify-between gap-3 rounded-lg px-2.5 py-2 font-mono text-xs whitespace-nowrap text-zinc-300 select-none data-focus:bg-white/10 data-focus:text-white data-selected:text-emerald-300",
763
- children: [/* @__PURE__ */ jsx("span", { children: option.label }), /* @__PURE__ */ jsx(CheckIcon, {
764
- className: "h-3.5 w-3.5 shrink-0 opacity-0 group-data-selected:opacity-100",
765
- "aria-hidden": "true"
766
- })]
767
- }, option.value))
768
- })]
769
- })
770
- });
771
- }
772
- function getExampleLabel(example, t) {
773
- return example.generated && example.title === "schema" ? t("openapi.schemaExample") : example.title;
774
- }
775
- function getLanguageOptions(codeOptions) {
776
- const languages = /* @__PURE__ */ new Map();
777
- for (const option of codeOptions ?? []) languages.set(option.languageKey, option.title);
778
- return Array.from(languages, ([value, label]) => ({
779
- value,
780
- label
781
- }));
782
- }
783
- function getClientOptions(codeOptions, languageKey) {
784
- return (codeOptions ?? []).filter((option) => option.languageKey === languageKey).map((option) => ({
785
- value: option.clientKey,
786
- label: option.clientTitle
787
- }));
788
- }
789
- function getServers(spec, operation) {
790
- const operationServers = operation.servers;
791
- const servers = Array.isArray(operationServers) ? operationServers : spec.servers;
792
- if (!Array.isArray(servers)) return [{ url: "https://api.example.com" }];
793
- const validServers = servers.filter((server) => isRecord(server) && typeof server.url === "string");
794
- return validServers.length > 0 ? validServers : [{ url: "https://api.example.com" }];
795
- }
796
- function getServerKey(server, index) {
797
- return `${index}:${server.url ?? ""}`;
798
- }
799
- function getServerLabel(server, index) {
800
- return server.description ? `${server.description} (${server.url})` : server.url ?? `Server ${index + 1}`;
801
- }
802
- function defaultServerVariables(server) {
803
- return Object.fromEntries(Object.entries(server?.variables ?? {}).map(([name, variable]) => [name, variable.default ?? variable.enum?.[0] ?? ""]));
804
- }
805
- function getSecuritySchemes(spec) {
806
- const schemes = spec.components;
807
- if (!isRecord(schemes) || !isRecord(schemes.securitySchemes)) return {};
808
- return Object.fromEntries(Object.entries(schemes.securitySchemes).filter((entry) => isRecord(entry[1])));
809
- }
810
- function getSecurityRequirements(spec, operation) {
811
- const operationSecurity = operation.security;
812
- if (Array.isArray(operationSecurity)) return operationSecurity.filter(isRecord);
813
- const specSecurity = spec.security;
814
- return Array.isArray(specSecurity) ? specSecurity.filter(isRecord) : [];
815
- }
816
- function getAuthOptions(spec, operation) {
817
- const schemes = getSecuritySchemes(spec);
818
- const requirements = getSecurityRequirements(spec, operation);
819
- const names = new Set(requirements.flatMap((requirement) => Object.keys(requirement)));
820
- return Array.from(names).map((name) => ({
821
- name,
822
- scheme: schemes[name]
823
- })).filter((option) => Boolean(option.scheme));
824
- }
825
- function authPlaceholder(auth) {
826
- if (!auth) return "";
827
- if (auth.scheme.type === "apiKey") return "{api_key}";
828
- if (auth.scheme.type === "http" && auth.scheme.scheme?.toLowerCase() === "basic") return "{base64_credentials}";
829
- return "{token}";
830
- }
831
- function authLabel(name, scheme) {
832
- return `${name}${scheme.type === "apiKey" && scheme.in && scheme.name ? ` · ${scheme.in}: ${scheme.name}` : ""}`;
833
- }
834
- function CopyCodeButton(arg0) {
835
- const { code } = arg0;
836
- const t = useBuiltInText();
837
- const [copied, setCopied] = useState(false);
838
- return /* @__PURE__ */ jsxs("button", {
839
- type: "button",
840
- onClick: () => {
841
- window.navigator.clipboard.writeText(code).then(() => {
842
- setCopied(true);
843
- window.setTimeout(() => setCopied(false), 1e3);
844
- });
845
- },
846
- className: "flex items-center gap-1.5 rounded-full bg-black/ px-2.5 py-1.5 text-2xs font-medium text-zinc-400 transition hover:bg-black/50 hover:text-zinc-200 focus:bg-black/50 focus:text-zinc-200",
847
- children: [copied ? /* @__PURE__ */ jsx(CheckIcon, {
848
- className: "h-3.5 w-3.5 text-emerald-300",
849
- "aria-hidden": "true"
850
- }) : /* @__PURE__ */ jsx(ClipboardIcon, {
851
- className: "h-3.5 w-3.5 text-zinc-500",
852
- "aria-hidden": "true"
853
- }), /* @__PURE__ */ jsx("span", { children: copied ? t("actions.copied") : t("actions.copy") })]
854
- });
855
- }
856
- function ExampleMetaValue(arg0) {
857
- const { label, value, options, onChange, className } = arg0;
858
- if (options && options.length > 1 && onChange) return /* @__PURE__ */ jsx(SelectControl, {
859
- label,
860
- value,
861
- options,
862
- onChange
863
- });
864
- return /* @__PURE__ */ jsx("span", {
865
- className,
866
- children: value
867
- });
868
- }
869
- function CodeToolbar(arg0) {
870
- const { code, languageOptions, selectedLanguageKey, onSelectLanguage, clientOptions, selectedClientKey, onSelectClient } = arg0;
871
- const t = useBuiltInText();
872
- return /* @__PURE__ */ jsxs("div", {
873
- className: "absolute top-3.5 right-4 left-4 z-10 flex items-center justify-between gap-3",
874
- children: [/* @__PURE__ */ jsxs("div", {
875
- className: "flex min-w-0 items-center gap-2",
876
- children: [languageOptions && languageOptions.length > 1 && selectedLanguageKey && onSelectLanguage ? /* @__PURE__ */ jsx(SelectControl, {
877
- label: t("openapi.language"),
878
- value: selectedLanguageKey,
879
- options: languageOptions,
880
- onChange: onSelectLanguage,
881
- icon: /* @__PURE__ */ jsx(CodeIcon, {
882
- className: "h-3.5 w-3.5",
883
- "aria-hidden": "true"
884
- })
885
- }) : null, clientOptions && clientOptions.length > 1 && selectedClientKey && onSelectClient ? /* @__PURE__ */ jsx(SelectControl, {
886
- label: t("openapi.client"),
887
- value: selectedClientKey,
888
- options: clientOptions,
889
- onChange: onSelectClient,
890
- icon: /* @__PURE__ */ jsx(PackageIcon, {
891
- className: "h-3.5 w-3.5",
892
- "aria-hidden": "true"
893
- })
894
- }) : null]
895
- }), /* @__PURE__ */ jsx(CopyCodeButton, { code })]
896
- });
897
- }
898
- function ApiExampleCodeGroup(arg0) {
899
- const { title, tag, tagOptions, onSelectTag, label, labelOptions, onSelectLabel, comfortableMeta = false, code, language, mediaTypes, selectedMediaType, onSelectMediaType, examples, selectedExampleKey, onSelectExample, languageOptions, selectedLanguageKey, onSelectLanguage, clientOptions, selectedClientKey, onSelectClient } = arg0;
900
- const t = useBuiltInText();
901
- const metaClassName = comfortableMeta ? "flex min-h-11 min-w-0 items-center gap-2 border-y border-t-transparent border-b-white/7.5 bg-zinc-900 px-4 py-2 dark:border-b-white/5 dark:bg-white/1" : "flex h-9 min-w-0 items-center gap-2 border-y border-t-transparent border-b-white/7.5 bg-zinc-900 px-4 dark:border-b-white/5 dark:bg-white/1";
902
- return /* @__PURE__ */ jsx("div", {
903
- className: "clarify-api-example my-6 overflow-hidden rounded-2xl bg-zinc-900 shadow-md dark:ring-1 dark:ring-white/10",
904
- children: /* @__PURE__ */ jsxs("div", {
905
- className: "not-prose",
906
- children: [
907
- /* @__PURE__ */ jsxs("div", {
908
- className: "clarify-api-example-header flex min-h-[calc(--spacing(12)+1px)] items-center gap-3 border-b border-zinc-700 bg-zinc-800 px-4 py-2 dark:border-zinc-800 dark:bg-transparent",
909
- children: [/* @__PURE__ */ jsx("h3", {
910
- className: "mr-auto min-w-16 truncate py-1 text-xs font-semibold text-white",
911
- children: title
912
- }), /* @__PURE__ */ jsxs("div", {
913
- className: "ml-auto flex min-w-0 items-center gap-2 whitespace-nowrap",
914
- children: [mediaTypes && mediaTypes.length > 1 && selectedMediaType && onSelectMediaType ? /* @__PURE__ */ jsx(SelectControl, {
915
- label: t("openapi.mediaType"),
916
- value: selectedMediaType,
917
- options: mediaTypes,
918
- onChange: onSelectMediaType,
919
- compact: true
920
- }) : null, examples && examples.length > 1 && selectedExampleKey && onSelectExample ? /* @__PURE__ */ jsx(SelectControl, {
921
- label: t("openapi.example"),
922
- value: selectedExampleKey,
923
- options: examples.map((example) => ({
924
- value: example.key,
925
- label: getExampleLabel(example, t)
926
- })),
927
- onChange: onSelectExample,
928
- compact: true
929
- }) : null]
930
- })]
931
- }),
932
- tag || label ? /* @__PURE__ */ jsxs("div", {
933
- className: metaClassName,
934
- children: [
935
- tag ? /* @__PURE__ */ jsx(ExampleMetaValue, {
936
- label: t("openapi.status"),
937
- value: tag,
938
- options: tagOptions,
939
- onChange: onSelectTag,
940
- className: "font-mono text-[0.625rem]/6 font-semibold text-emerald-400"
941
- }) : null,
942
- tag && label ? /* @__PURE__ */ jsx("span", { className: "h-0.5 w-0.5 shrink-0 rounded-full bg-zinc-500" }) : null,
943
- label ? /* @__PURE__ */ jsx(ExampleMetaValue, {
944
- label: t("openapi.mediaType"),
945
- value: label,
946
- options: labelOptions,
947
- onChange: onSelectLabel,
948
- className: "min-w-0 truncate font-mono text-xs text-zinc-400"
949
- }) : null
950
- ]
951
- }) : null,
952
- /* @__PURE__ */ jsxs("div", {
953
- className: "clarify-api-example-code group relative",
954
- children: [/* @__PURE__ */ jsx(CodeToolbar, {
955
- code,
956
- languageOptions,
957
- selectedLanguageKey,
958
- onSelectLanguage,
959
- clientOptions,
960
- selectedClientKey,
961
- onSelectClient
962
- }), /* @__PURE__ */ jsx("pre", {
963
- className: `overflow-x-auto p-4 text-xs text-white ${languageOptions && languageOptions.length > 1 ? "pt-14" : ""}`,
964
- children: /* @__PURE__ */ jsx("code", {
965
- className: `language-${language}`,
966
- children: code
967
- })
968
- })]
969
- })
970
- ]
971
- })
972
- });
973
- }
974
- function RequestExamplesPanel(arg0) {
975
- const { spec, path, method, parameters, requestContents, selectedMediaType, onSelectMediaType, selectedServer, serverVariables, auth } = arg0;
976
- const t = useBuiltInText();
977
- const selectedContent = requestContents.find((content) => content.mediaType === selectedMediaType) ?? requestContents[0];
978
- const examples = getExampleEntries(selectedContent?.value);
979
- const [selectedExampleKey, setSelectedExampleKey] = useState(examples[0]?.key ?? "");
980
- const [selectedLanguageKey, setSelectedLanguageKey] = useState("shell");
981
- const [selectedClientKey, setSelectedClientKey] = useState("curl");
982
- const selectedExample = examples.find((example) => example.key === selectedExampleKey) ?? examples[0];
983
- const codeOptions = buildRequestCodeExamples({
984
- spec,
985
- path,
986
- method,
987
- parameters,
988
- requestContent: selectedContent ? {
989
- ...selectedContent,
990
- value: {
991
- ...selectedContent.value,
992
- example: selectedExample?.value,
993
- examples: void 0
994
- }
995
- } : void 0,
996
- server: selectedServer,
997
- serverVariables,
998
- auth
999
- });
1000
- const selectedLanguage = codeOptions.find((option) => option.languageKey === selectedLanguageKey) ?? codeOptions[0];
1001
- const selectedCode = codeOptions.find((option) => option.languageKey === selectedLanguage.languageKey && option.clientKey === selectedClientKey) ?? selectedLanguage;
1002
- const languageOptions = getLanguageOptions(codeOptions);
1003
- const clientOptions = getClientOptions(codeOptions, selectedCode.languageKey);
1004
- return /* @__PURE__ */ jsx(ApiExampleCodeGroup, {
1005
- title: t("openapi.request"),
1006
- tag: method,
1007
- label: path,
1008
- code: selectedCode.code,
1009
- language: selectedCode.language,
1010
- mediaTypes: requestContents.map((content) => content.mediaType),
1011
- selectedMediaType: selectedContent?.mediaType,
1012
- onSelectMediaType: (value) => {
1013
- onSelectMediaType(value);
1014
- setSelectedExampleKey(getExampleEntries(requestContents.find((content) => content.mediaType === value)?.value)[0]?.key ?? "");
1015
- },
1016
- examples,
1017
- selectedExampleKey: selectedExample?.key,
1018
- onSelectExample: setSelectedExampleKey,
1019
- languageOptions,
1020
- selectedLanguageKey: selectedCode.languageKey,
1021
- onSelectLanguage: (value) => {
1022
- const nextCode = codeOptions.find((option) => option.languageKey === value);
1023
- setSelectedLanguageKey(nextCode?.languageKey ?? value);
1024
- setSelectedClientKey(nextCode?.clientKey ?? "");
1025
- },
1026
- clientOptions,
1027
- selectedClientKey: selectedCode.clientKey,
1028
- onSelectClient: setSelectedClientKey
1029
- });
1030
- }
1031
- function ResponseExamplesPanel(arg0) {
1032
- const { operation } = arg0;
1033
- const t = useBuiltInText();
1034
- const responses = getResponseEntries(operation).filter(({ response }) => getMediaTypeEntries(response.content).length > 0);
1035
- const [selectedStatus, setSelectedStatus] = useState(responses.find(({ status }) => status.startsWith("2"))?.status ?? responses[0]?.status ?? "");
1036
- const selectedResponse = responses.find(({ status }) => status === selectedStatus) ?? responses[0];
1037
- const responseContents = getMediaTypeEntries(selectedResponse?.response.content);
1038
- const [selectedMediaType, setSelectedMediaType] = useState(responseContents[0]?.mediaType ?? "");
1039
- const selectedContent = responseContents.find((content) => content.mediaType === selectedMediaType) ?? responseContents[0];
1040
- const examples = getExampleEntries(selectedContent?.value);
1041
- const [selectedExampleKey, setSelectedExampleKey] = useState(examples[0]?.key ?? "");
1042
- const selectedExample = examples.find((example) => example.key === selectedExampleKey) ?? examples[0];
1043
- const responseCode = stringifyExample(selectedExample?.value);
1044
- if (!selectedResponse || !selectedContent || !responseCode) return null;
1045
- return /* @__PURE__ */ jsx(ApiExampleCodeGroup, {
1046
- title: t("openapi.response"),
1047
- tag: selectedResponse.status,
1048
- tagOptions: responses.map(({ status }) => status),
1049
- onSelectTag: (value) => {
1050
- const nextContents = getMediaTypeEntries(responses.find(({ status }) => status === value)?.response.content);
1051
- setSelectedStatus(value);
1052
- setSelectedMediaType(nextContents[0]?.mediaType ?? "");
1053
- setSelectedExampleKey(getExampleEntries(nextContents[0]?.value)[0]?.key ?? "");
1054
- },
1055
- label: selectedContent.mediaType,
1056
- labelOptions: responseContents.map((content) => content.mediaType),
1057
- onSelectLabel: (value) => {
1058
- setSelectedMediaType(value);
1059
- setSelectedExampleKey(getExampleEntries(responseContents.find((content) => content.mediaType === value)?.value)[0]?.key ?? "");
1060
- },
1061
- comfortableMeta: true,
1062
- code: responseCode,
1063
- language: codeLanguageForMediaType(selectedContent.mediaType),
1064
- examples,
1065
- selectedExampleKey: selectedExample?.key,
1066
- onSelectExample: setSelectedExampleKey
1067
- });
1068
- }
1069
- //#endregion
1070
- //#region source/openapi/schema-properties.tsx
1071
- function getSchemaDescription(schema) {
1072
- const details = [
1073
- Array.isArray(schema.enum) ? `enum: ${schema.enum.map(String).join(", ")}` : void 0,
1074
- typeof schema.const !== "undefined" ? `const: ${String(schema.const)}` : void 0,
1075
- typeof schema.default !== "undefined" ? `default: ${String(schema.default)}` : void 0,
1076
- typeof schema.pattern === "string" ? `pattern: ${schema.pattern}` : void 0,
1077
- typeof schema.minimum === "number" ? `minimum: ${String(schema.minimum)}` : void 0,
1078
- typeof schema.maximum === "number" ? `maximum: ${String(schema.maximum)}` : void 0,
1079
- typeof schema.additionalProperties === "boolean" ? `additionalProperties: ${String(schema.additionalProperties)}` : void 0
1080
- ].filter(Boolean);
1081
- return [typeof schema.description === "string" ? schema.description : void 0, details.length > 0 ? details.join("; ") : void 0].filter(Boolean).join(" ");
1082
- }
1083
- function getComposedBranches(schema) {
1084
- const entries = [];
1085
- for (const key of [
1086
- "allOf",
1087
- "oneOf",
1088
- "anyOf"
1089
- ]) {
1090
- const items = schema[key];
1091
- if (!Array.isArray(items)) continue;
1092
- for (const [index, item] of items.entries()) entries.push({
1093
- label: `${key}[${index}]`,
1094
- schema: item
1095
- });
1096
- }
1097
- return entries;
1098
- }
1099
- function getSchemaChildren(arg0) {
1100
- const { spec, schema, path, required = [], depth = 0, seen = /* @__PURE__ */ new Set() } = arg0;
1101
- if (depth > 12) return [];
1102
- if (isReference(schema)) {
1103
- if (seen.has(schema.$ref)) return [];
1104
- return getSchemaChildren({
1105
- spec,
1106
- schema: resolveSchema(spec, schema),
1107
- path,
1108
- required,
1109
- depth,
1110
- seen: new Set([...seen, schema.$ref])
1111
- });
1112
- }
1113
- if (!isRecord(schema)) return [];
1114
- const arrayChildren = schema.type === "array" ? getSchemaChildren({
1115
- spec,
1116
- schema: schema.items,
1117
- path: `${path}[]`,
1118
- depth: depth + 1,
1119
- seen
1120
- }) : [];
1121
- const objectRequired = Array.isArray(schema.required) ? schema.required.map(String) : required;
1122
- const properties = isRecord(schema.properties) ? schema.properties : {};
1123
- const propertyChildren = Object.entries(properties).map(([name, propertySchema]) => {
1124
- const resolvedProperty = resolveSchema(spec, propertySchema);
1125
- const property = isRecord(resolvedProperty) ? resolvedProperty : isRecord(propertySchema) ? propertySchema : {};
1126
- const isArray = isRecord(property) && property.type === "array";
1127
- const childPath = path ? `${path}.${name}` : name;
1128
- const children = getSchemaChildren({
1129
- spec,
1130
- schema: isArray ? property.items : propertySchema,
1131
- path: isArray ? `${childPath}[]` : childPath,
1132
- depth: depth + 1,
1133
- seen
1134
- });
1135
- return {
1136
- key: childPath,
1137
- name,
1138
- type: schemaToType(propertySchema),
1139
- description: getSchemaDescription(property),
1140
- required: objectRequired.includes(name),
1141
- children
1142
- };
1143
- });
1144
- const additionalPropertyChildren = isRecord(schema.additionalProperties) ? [{
1145
- key: `${path || "root"}.*`,
1146
- name: "*",
1147
- type: schemaToType(schema.additionalProperties),
1148
- description: getSchemaDescription(schema.additionalProperties),
1149
- required: false,
1150
- children: getSchemaChildren({
1151
- spec,
1152
- schema: schema.additionalProperties,
1153
- path: `${path || "root"}.*`,
1154
- depth: depth + 1,
1155
- seen
1156
- })
1157
- }] : [];
1158
- const composedChildren = getComposedBranches(schema).map(({ label, schema: branchSchema }) => ({
1159
- key: `${path || "root"}.${label}`,
1160
- name: label,
1161
- type: schemaToType(branchSchema),
1162
- description: isRecord(resolveSchema(spec, branchSchema)) ? getSchemaDescription(resolveSchema(spec, branchSchema)) : void 0,
1163
- required: false,
1164
- children: getSchemaChildren({
1165
- spec,
1166
- schema: branchSchema,
1167
- path: `${path || "root"}.${label}`,
1168
- required: objectRequired,
1169
- depth: depth + 1,
1170
- seen
1171
- })
1172
- }));
1173
- return [
1174
- ...arrayChildren,
1175
- ...propertyChildren,
1176
- ...additionalPropertyChildren,
1177
- ...composedChildren
1178
- ];
1179
- }
1180
- function getRootSchemaNode(spec, schema) {
1181
- if (isReference(schema)) {
1182
- const resolvedSchema = resolveSchema(spec, schema);
1183
- const resolved = isRecord(resolvedSchema) ? resolvedSchema : {};
1184
- return {
1185
- key: schema.$ref,
1186
- name: resolveReferenceName(schema.$ref),
1187
- type: schemaToType(schema),
1188
- description: getSchemaDescription(resolved),
1189
- required: false,
1190
- children: getSchemaChildren({
1191
- spec,
1192
- schema: resolvedSchema,
1193
- path: resolveReferenceName(schema.$ref),
1194
- seen: new Set([schema.$ref])
1195
- })
1196
- };
1197
- }
1198
- if (!isRecord(schema)) return void 0;
1199
- return {
1200
- key: "root",
1201
- name: "body",
1202
- type: schemaToType(schema),
1203
- description: getSchemaDescription(schema),
1204
- required: false,
1205
- children: getSchemaChildren({
1206
- spec,
1207
- schema,
1208
- path: ""
1209
- })
1210
- };
1211
- }
1212
- function SchemaNode(arg0) {
1213
- const { node, depth = 0 } = arg0;
1214
- const t = useBuiltInText();
1215
- const [expanded, setExpanded] = useState(depth < 1);
1216
- const hasChildren = node.children.length > 0;
1217
- const type = [node.type, node.required ? t("openapi.requiredBadge") : void 0].filter(Boolean).join(", ") || void 0;
1218
- const description = node.description || (node.required ? t("openapi.required") : t("openapi.optional"));
1219
- const rowClassName = clsx("flex min-w-0 items-start rounded py-0.5 text-left", depth > 0 ? "-mx-2 w-[calc(100%+1rem)] px-2" : "w-full px-1");
1220
- const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
1221
- className: "min-w-0 flex-1",
1222
- children: [/* @__PURE__ */ jsxs("div", {
1223
- className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5",
1224
- children: [/* @__PURE__ */ jsx("span", {
1225
- className: "text-sm/5 font-semibold text-zinc-950 dark:text-white",
1226
- children: node.name
1227
- }), type ? /* @__PURE__ */ jsx("span", {
1228
- className: "font-mono text-xs text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-500",
1229
- children: type
1230
- }) : null]
1231
- }), description ? /* @__PURE__ */ jsx("div", {
1232
- className: "mt-0.5 text-sm/5 text-zinc-600 dark:text-zinc-400",
1233
- children: description
1234
- }) : null]
1235
- }), hasChildren ? /* @__PURE__ */ jsx("span", {
1236
- className: "ml-2 flex h-5 w-5 flex-none items-center justify-center text-zinc-500 dark:text-zinc-400",
1237
- "aria-hidden": "true",
1238
- children: expanded ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
1239
- }) : null] });
1240
- return /* @__PURE__ */ jsxs("li", {
1241
- className: "clarify-schema-node m-0 px-0 py-2 first:pt-0 last:pb-0",
1242
- children: [hasChildren ? /* @__PURE__ */ jsx("button", {
1243
- type: "button",
1244
- "aria-label": expanded ? t("openapi.collapse") : t("openapi.expand"),
1245
- "aria-expanded": expanded,
1246
- onClick: () => setExpanded((value) => !value),
1247
- className: clsx(rowClassName, "cursor-pointer transition"),
1248
- children: content
1249
- }) : /* @__PURE__ */ jsx("div", {
1250
- className: rowClassName,
1251
- children: content
1252
- }), hasChildren && expanded ? /* @__PURE__ */ jsx(SchemaTree, {
1253
- nodes: node.children,
1254
- depth: depth + 1
1255
- }) : null]
1256
- });
1257
- }
1258
- function SchemaTree(arg0) {
1259
- const { nodes, depth = 0 } = arg0;
1260
- if (nodes.length === 0) return null;
1261
- return /* @__PURE__ */ jsx("ul", {
1262
- role: "list",
1263
- className: clsx("m-0 list-none divide-y divide-zinc-900/5 p-0 dark:divide-white/5", depth > 0 && "mt-2 rounded-lg bg-zinc-950/[0.025] px-2 py-1 dark:bg-white/[0.04]"),
1264
- children: nodes.map((node) => /* @__PURE__ */ jsx(SchemaNode, {
1265
- node,
1266
- depth
1267
- }, node.key))
1268
- });
1269
- }
1270
- function SchemaProperties(arg0) {
1271
- const { title, schema, spec } = arg0;
1272
- const root = getRootSchemaNode(spec, schema);
1273
- if (!root || root.children.length === 0) return null;
1274
- return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", { children: title }), /* @__PURE__ */ jsx("div", {
1275
- className: "clarify-schema-properties my-6",
1276
- children: /* @__PURE__ */ jsx(SchemaTree, { nodes: root.children })
1277
- })] });
1278
- }
1279
- function ParameterList(arg0) {
1280
- const { title, parameters } = arg0;
1281
- const t = useBuiltInText();
1282
- if (parameters.length === 0) return null;
1283
- return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", { children: title }), /* @__PURE__ */ jsx(Properties, { children: parameters.map((parameter) => /* @__PURE__ */ jsx(Property, {
1284
- name: parameter.name ?? t("openapi.parameter"),
1285
- type: [schemaToType(parameter.schema), parameter.required ? t("openapi.requiredBadge") : void 0].filter(Boolean).join(", ") || void 0,
1286
- children: parameter.description ?? t("openapi.operationParameter")
1287
- }, `${parameter.in}-${parameter.name}`)) })] });
1288
- }
1289
- function ResponseList(arg0) {
1290
- const { operation } = arg0;
1291
- const t = useBuiltInText();
1292
- const responses = getResponseEntries(operation);
1293
- if (responses.length === 0) return null;
1294
- return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", { children: t("openapi.responses") }), /* @__PURE__ */ jsx(Properties, { children: responses.map(({ status, response }) => {
1295
- return /* @__PURE__ */ jsx(Property, {
1296
- name: status,
1297
- type: schemaToType(getJsonLikeContent(response.content)?.value.schema),
1298
- children: response.description ?? `${t("openapi.response")}.`
1299
- }, status);
1300
- }) })] });
1301
- }
1302
- //#endregion
1303
- //#region source/openapi/spec-path.ts
1
+ import { f as Markdown, n as OpenApiOperation$1, p as primitives_exports } from "./OpenApiOperation-DYXG-6Rw.js";
2
+ import { E as useTheme, F as OpenApisContext, I as useClarifyConfig, L as useOpenApis, M as useBuiltInText, N as ClarifyConfigContext, T as ThemeProvider, _ as Callout, a as GridPattern, b as useSectionStore, c as Heading, d as Collapse, f as Code, g as CardGroup, h as Card, i as Prose, l as Tag, m as Pre, o as HeroPattern, p as CodeGroup, s as Logo, u as Feedback, v as Button, w as ThemeToggle, x as remToPx, y as SectionProvider } from "./shell-BlMMdTpZ.js";
3
+ import { n as PageFooter, r as BuiltWithClarify, t as AppShell } from "./AppShell-D3FsVHQK.js";
4
+ import { t as markdownRemarkPlugins } from "./remark-o5sg9Ilv.js";
5
+ import { t as render } from "./render-BpavVnAe.js";
6
+ import { useLocation } from "react-router-dom";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ //#region source/openapi/lib/spec-path.ts
1304
9
  var VIRTUAL_PREFIX = "virtual:clarify-page/";
1305
10
  function resolveRelativePath(fromDir, to) {
1306
11
  const parts = (fromDir + "/" + to).split("/").filter(Boolean);
@@ -1326,7 +31,7 @@ function useOpenApiSpec(spec, specPath) {
1326
31
  return specs[normalizeSpecPath(specPath, location.pathname, config.routePrefix)] ?? null;
1327
32
  }
1328
33
  //#endregion
1329
- //#region source/openapi/utils.ts
34
+ //#region source/openapi/lib/utils.ts
1330
35
  var OPENAPI_HTTP_METHODS = [
1331
36
  "get",
1332
37
  "put",
@@ -1340,14 +45,27 @@ var OPENAPI_HTTP_METHODS = [
1340
45
  function isOpenAPIHttpMethod(method) {
1341
46
  return OPENAPI_HTTP_METHODS.includes(method.toLowerCase());
1342
47
  }
48
+ function isRecord(value) {
49
+ return typeof value === "object" && value !== null && !Array.isArray(value);
50
+ }
51
+ function resolveOpenApiRef(spec, ref) {
52
+ if (!ref.startsWith("#/")) return void 0;
53
+ return ref.slice(2).split("/").map((part) => part.replace(/~1/g, "/").replace(/~0/g, "~")).reduce((current, part) => isRecord(current) ? current[part] : void 0, spec);
54
+ }
55
+ function getPathItem(spec, path) {
56
+ const pathItem = spec.paths?.[path];
57
+ const resolved = isRecord(pathItem) && typeof pathItem.$ref === "string" ? resolveOpenApiRef(spec, pathItem.$ref) : pathItem;
58
+ return isRecord(resolved) ? resolved : void 0;
59
+ }
1343
60
  function getOpenApiOperation(spec, path, method) {
1344
61
  if (!isOpenAPIHttpMethod(method)) return void 0;
1345
- return spec.paths?.[path]?.[method.toLowerCase()];
62
+ return getPathItem(spec, path)?.[method.toLowerCase()];
1346
63
  }
1347
64
  function listOpenApiOperations(spec) {
1348
65
  const paths = spec.paths ?? {};
1349
66
  const operations = [];
1350
- for (const [path, pathItem] of Object.entries(paths)) {
67
+ for (const path of Object.keys(paths)) {
68
+ const pathItem = getPathItem(spec, path);
1351
69
  if (!pathItem) continue;
1352
70
  for (const method of OPENAPI_HTTP_METHODS) {
1353
71
  const operation = pathItem[method];
@@ -1361,25 +79,7 @@ function listOpenApiOperations(spec) {
1361
79
  return operations;
1362
80
  }
1363
81
  //#endregion
1364
- //#region source/openapi/openapi-page.tsx
1365
- function EndpointExamples(arg0) {
1366
- const { spec, path, method, operation, parameters, requestContents, selectedRequestMediaType, onSelectRequestMediaType, selectedServer, serverVariables, auth } = arg0;
1367
- return /* @__PURE__ */ jsxs("div", {
1368
- className: "space-y-6",
1369
- children: [/* @__PURE__ */ jsx(RequestExamplesPanel, {
1370
- spec,
1371
- path,
1372
- method,
1373
- parameters,
1374
- requestContents,
1375
- selectedMediaType: selectedRequestMediaType,
1376
- onSelectMediaType: onSelectRequestMediaType,
1377
- selectedServer,
1378
- serverVariables,
1379
- auth
1380
- }), /* @__PURE__ */ jsx(ResponseExamplesPanel, { operation })]
1381
- });
1382
- }
82
+ //#region source/openapi/entry.tsx
1383
83
  function OpenApiHeader(arg0) {
1384
84
  const { spec } = arg0;
1385
85
  const t = useBuiltInText();
@@ -1387,12 +87,12 @@ function OpenApiHeader(arg0) {
1387
87
  className: "mb-16",
1388
88
  children: [
1389
89
  /* @__PURE__ */ jsx("p", {
1390
- className: "mb-3 font-mono text-xs/6 font-medium tracking-widest text-emerald-500 uppercase dark:text-emerald-400",
90
+ className: "mb-3 text-xs/6 font-medium tracking-widest text-emerald-500 uppercase dark:text-emerald-400",
1391
91
  children: t("openapi.openApiReference")
1392
92
  }),
1393
93
  /* @__PURE__ */ jsx("h1", { children: spec.info?.title ?? t("openapi.apiDocumentation") }),
1394
- spec.info?.description ? /* @__PURE__ */ jsx("p", {
1395
- className: "lead",
94
+ spec.info?.description ? /* @__PURE__ */ jsx(Markdown, {
95
+ className: "lead *:first:mt-0 *:last:mb-0",
1396
96
  children: spec.info.description
1397
97
  }) : null,
1398
98
  spec.info?.version ? /* @__PURE__ */ jsx("p", {
@@ -1402,381 +102,6 @@ function OpenApiHeader(arg0) {
1402
102
  ]
1403
103
  });
1404
104
  }
1405
- var endpointMethodStyles = {
1406
- GET: "bg-emerald-400/15 text-emerald-600 dark:bg-emerald-400/20 dark:text-emerald-300",
1407
- POST: "bg-sky-400/15 text-sky-600 dark:bg-sky-400/20 dark:text-sky-300",
1408
- PUT: "bg-amber-400/15 text-amber-600 dark:bg-amber-400/20 dark:text-amber-300",
1409
- PATCH: "bg-amber-400/15 text-amber-600 dark:bg-amber-400/20 dark:text-amber-300",
1410
- DELETE: "bg-rose-400/15 text-rose-600 dark:bg-rose-400/20 dark:text-rose-300"
1411
- };
1412
- function EndpointMethodBadge(arg0) {
1413
- const { method } = arg0;
1414
- return /* @__PURE__ */ jsx("span", {
1415
- className: clsx("rounded-(--clarify-theme-tokens-radius-md) px-2.5 py-0.5 font-mono text-xs/6 font-black tracking-wide", endpointMethodStyles[method] ?? "bg-zinc-400/15 text-zinc-700 dark:bg-zinc-400/20 dark:text-zinc-200"),
1416
- children: method
1417
- });
1418
- }
1419
- function InlineListbox(arg0) {
1420
- const { label, value, options, onChange, compact = false } = arg0;
1421
- const selected = options.find((option) => option.value === value) ?? options[0];
1422
- return /* @__PURE__ */ jsx(Listbox, {
1423
- value: selected?.value ?? value,
1424
- onChange,
1425
- children: /* @__PURE__ */ jsxs("div", {
1426
- className: "pointer-events-auto relative inline-flex min-w-0",
1427
- children: [/* @__PURE__ */ jsxs(ListboxButton, {
1428
- "aria-label": label,
1429
- className: clsx("inline-flex min-w-0 items-center gap-1 rounded-md border border-zinc-200 bg-white font-mono font-semibold text-zinc-900 shadow-xs outline-hidden transition hover:border-zinc-300 hover:bg-zinc-50 data-open:border-zinc-300 data-open:bg-zinc-50 dark:border-white/10 dark:bg-zinc-950 dark:text-zinc-100 dark:hover:border-white/15 dark:hover:bg-zinc-900 dark:data-open:border-white/15 dark:data-open:bg-zinc-900", compact ? "max-w-32 px-1.5 py-0.5 text-xs" : "w-full px-2.5 py-1.5 text-xs"),
1430
- children: [/* @__PURE__ */ jsx("span", {
1431
- className: "truncate",
1432
- children: selected?.label ?? value
1433
- }), /* @__PURE__ */ jsx(ChevronDownIcon, {
1434
- className: "h-3.5 w-3.5 shrink-0 text-zinc-500 dark:text-zinc-400",
1435
- "aria-hidden": "true"
1436
- })]
1437
- }), /* @__PURE__ */ jsx(ListboxOptions, {
1438
- anchor: "bottom start",
1439
- className: "z-30 mt-1 max-h-64 w-max min-w-(--button-width) max-w-[min(32rem,calc(100vw-2rem))] overflow-auto rounded-xl bg-white p-1 text-xs shadow-lg shadow-black/10 ring-1 ring-zinc-950/10 [--anchor-gap:--spacing(1)] focus:outline-none dark:bg-zinc-950 dark:ring-white/10",
1440
- children: options.map((option) => /* @__PURE__ */ jsxs(ListboxOption, {
1441
- value: option.value,
1442
- className: "group flex cursor-default items-center justify-between gap-3 rounded-lg px-2.5 py-2 font-mono text-xs text-zinc-700 select-none data-focus:bg-zinc-100 data-selected:text-emerald-700 dark:text-zinc-200 dark:data-focus:bg-white/10 dark:data-selected:text-emerald-300",
1443
- children: [/* @__PURE__ */ jsxs("span", {
1444
- className: "min-w-0",
1445
- children: [/* @__PURE__ */ jsx("span", {
1446
- className: "block truncate",
1447
- children: option.label
1448
- }), option.description ? /* @__PURE__ */ jsx("span", {
1449
- className: "mt-0.5 block truncate text-2xs text-zinc-500 dark:text-zinc-400",
1450
- children: option.description
1451
- }) : null]
1452
- }), /* @__PURE__ */ jsx(CheckIcon, {
1453
- className: "h-3.5 w-3.5 shrink-0 opacity-0 group-data-selected:opacity-100",
1454
- "aria-hidden": "true"
1455
- })]
1456
- }, option.value))
1457
- })]
1458
- })
1459
- });
1460
- }
1461
- function getServerPreviewUrl(server, variables) {
1462
- return (server.url ?? "").replace(/\{([^}]+)\}/g, (_, name) => variables[name] ?? server.variables?.[name]?.default ?? `{${name}}`);
1463
- }
1464
- function ServerUrlValue(arg0) {
1465
- const { server, variables, open, onToggle } = arg0;
1466
- const url = getServerPreviewUrl(server, variables);
1467
- return /* @__PURE__ */ jsxs("button", {
1468
- type: "button",
1469
- "aria-expanded": open,
1470
- "aria-label": "Server",
1471
- onClick: onToggle,
1472
- className: clsx("flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-zinc-100/50 text-zinc-600 transition hover:bg-zinc-100 hover:text-zinc-950 dark:bg-white/5 dark:text-zinc-300 dark:hover:bg-white/10 dark:hover:text-white sm:w-auto sm:min-w-16 sm:max-w-[min(36%,16rem)] sm:px-1.5", open ? "bg-zinc-200 text-zinc-950 dark:bg-white/12 dark:text-white" : null),
1473
- children: [/* @__PURE__ */ jsx("span", {
1474
- className: "sm:hidden",
1475
- children: /* @__PURE__ */ jsx(ServerIcon, {
1476
- className: "h-4 w-4",
1477
- "aria-hidden": "true"
1478
- })
1479
- }), /* @__PURE__ */ jsxs("span", {
1480
- className: "hidden min-w-0 items-center gap-1 overflow-hidden sm:flex",
1481
- children: [/* @__PURE__ */ jsx("span", {
1482
- className: "truncate font-mono text-xs",
1483
- children: url
1484
- }), /* @__PURE__ */ jsx(ChevronDownIcon, {
1485
- className: "h-3.5 w-3.5 shrink-0 text-zinc-400",
1486
- "aria-hidden": "true"
1487
- })]
1488
- })]
1489
- });
1490
- }
1491
- function ServerVariableControl(arg0) {
1492
- const { name, variable, value, onChange, compact = false } = arg0;
1493
- if (variable?.enum?.length) return /* @__PURE__ */ jsx(InlineListbox, {
1494
- label: name,
1495
- value,
1496
- options: variable.enum.map((option) => ({
1497
- value: option,
1498
- label: option
1499
- })),
1500
- onChange,
1501
- compact
1502
- });
1503
- return /* @__PURE__ */ jsx("input", {
1504
- "aria-label": name,
1505
- value,
1506
- placeholder: variable?.default ?? name,
1507
- onChange: (event) => onChange(event.target.value),
1508
- className: clsx("pointer-events-auto rounded-md border border-zinc-200 bg-white font-mono text-xs font-semibold text-zinc-900 shadow-xs outline-hidden transition placeholder:text-zinc-500 hover:border-zinc-300 hover:bg-zinc-50 focus:border-zinc-400 focus:bg-white dark:border-white/10 dark:bg-zinc-950 dark:text-zinc-100 dark:placeholder:text-zinc-500 dark:hover:border-white/15 dark:hover:bg-zinc-900 dark:focus:border-white/20 dark:focus:bg-zinc-950", compact ? "mx-0.5 w-24 px-1.5 py-0.5" : "w-full px-2.5 py-1.5")
1509
- });
1510
- }
1511
- function ServerPanel(arg0) {
1512
- const { servers, selectedKey, selectedServer, variables, onSelectServer, onChangeVariable } = arg0;
1513
- const variableEntries = Object.entries(selectedServer.variables ?? {});
1514
- return /* @__PURE__ */ jsx("div", {
1515
- className: "border-t border-zinc-200 bg-zinc-100/70 p-3 dark:border-white/10 dark:bg-zinc-900/60",
1516
- children: /* @__PURE__ */ jsxs("div", {
1517
- className: "grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,1.2fr)]",
1518
- children: [servers.length > 1 ? /* @__PURE__ */ jsxs("label", {
1519
- className: "flex min-w-0 flex-col gap-1.5",
1520
- children: [/* @__PURE__ */ jsx("span", {
1521
- className: "text-2xs font-semibold text-zinc-700 dark:text-zinc-300",
1522
- children: "Server"
1523
- }), /* @__PURE__ */ jsx(InlineListbox, {
1524
- label: "Server",
1525
- value: selectedKey,
1526
- options: servers.map((server, index) => ({
1527
- value: getServerKey(server, index),
1528
- label: getServerLabel(server, index),
1529
- description: server.description
1530
- })),
1531
- onChange: onSelectServer
1532
- })]
1533
- }) : null, variableEntries.map(([name, variable]) => /* @__PURE__ */ jsxs("label", {
1534
- className: "flex min-w-0 flex-col gap-1.5",
1535
- children: [/* @__PURE__ */ jsx("span", {
1536
- className: "text-2xs font-semibold text-zinc-700 dark:text-zinc-300",
1537
- children: name
1538
- }), /* @__PURE__ */ jsx(ServerVariableControl, {
1539
- name,
1540
- variable,
1541
- value: variables[name] ?? variable.default ?? "",
1542
- onChange: (value) => onChangeVariable(name, value)
1543
- })]
1544
- }, name))]
1545
- })
1546
- });
1547
- }
1548
- function AuthPanel(arg0) {
1549
- const { authOptions, selectedAuthName, selectedAuth, authValues, onSelectAuth, onChangeAuthValue } = arg0;
1550
- if (authOptions.length === 0) return null;
1551
- return /* @__PURE__ */ jsx("div", {
1552
- className: "border-t border-zinc-200 bg-zinc-100/70 p-3 dark:border-white/10 dark:bg-zinc-900/60",
1553
- children: /* @__PURE__ */ jsxs("div", {
1554
- className: "grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,1.2fr)]",
1555
- children: [/* @__PURE__ */ jsxs("label", {
1556
- className: "flex min-w-0 flex-col gap-1.5",
1557
- children: [/* @__PURE__ */ jsx("span", {
1558
- className: "text-2xs font-semibold text-zinc-700 dark:text-zinc-300",
1559
- children: "Auth"
1560
- }), /* @__PURE__ */ jsx(InlineListbox, {
1561
- label: "Auth",
1562
- value: selectedAuthName,
1563
- options: authOptions.map(({ name, scheme }) => ({
1564
- value: name,
1565
- label: name,
1566
- description: authLabel(name, scheme)
1567
- })),
1568
- onChange: onSelectAuth
1569
- })]
1570
- }), selectedAuth ? /* @__PURE__ */ jsxs("label", {
1571
- className: "flex min-w-0 flex-col gap-1.5",
1572
- children: [/* @__PURE__ */ jsx("span", {
1573
- className: "text-2xs font-semibold text-zinc-700 dark:text-zinc-300",
1574
- children: "Credential"
1575
- }), /* @__PURE__ */ jsxs("div", {
1576
- className: "flex min-w-0 items-center rounded-md border border-zinc-200 bg-white px-2.5 py-1.5 shadow-xs dark:border-white/10 dark:bg-zinc-950",
1577
- children: [/* @__PURE__ */ jsx("span", {
1578
- className: "mr-2 shrink-0 font-mono text-2xs font-semibold text-zinc-600 dark:text-zinc-400",
1579
- children: selectedAuth.scheme.type === "apiKey" ? selectedAuth.scheme.in ?? "apiKey" : selectedAuth.scheme.scheme ?? selectedAuth.scheme.type ?? "token"
1580
- }), /* @__PURE__ */ jsx("input", {
1581
- value: authValues[selectedAuth.name] ?? authPlaceholder(selectedAuth),
1582
- onChange: (event) => onChangeAuthValue(selectedAuth.name, event.target.value),
1583
- className: "min-w-0 flex-1 border-0 bg-transparent px-0 py-0 font-mono text-xs font-semibold text-zinc-900 outline-hidden placeholder:text-zinc-500 dark:text-zinc-100 dark:placeholder:text-zinc-500"
1584
- })]
1585
- })]
1586
- }) : null]
1587
- })
1588
- });
1589
- }
1590
- function EndpointIdentity(arg0) {
1591
- const { method, path, servers, selectedServerKey, selectedServer, serverVariables, serverOpen, authOptions, selectedAuthName, selectedAuth, authValues, authOpen, onSelectServer, onChangeServerVariable, onToggleServer, onToggleAuth, onSelectAuth, onChangeAuthValue } = arg0;
1592
- const segments = path.split("/").filter(Boolean);
1593
- return /* @__PURE__ */ jsxs("div", {
1594
- className: "not-prose flex w-full flex-col overflow-hidden rounded-xl border border-zinc-200 bg-white shadow-xs dark:border-white/10 dark:bg-zinc-950",
1595
- children: [
1596
- /* @__PURE__ */ jsxs("div", {
1597
- className: "flex min-w-0 items-center gap-1.5 overflow-hidden px-2.5 py-2",
1598
- children: [
1599
- /* @__PURE__ */ jsx(EndpointMethodBadge, { method }),
1600
- /* @__PURE__ */ jsx(ServerUrlValue, {
1601
- server: selectedServer,
1602
- variables: serverVariables,
1603
- open: serverOpen,
1604
- onToggle: onToggleServer
1605
- }),
1606
- /* @__PURE__ */ jsx("div", {
1607
- className: "flex min-w-0 flex-1 items-center overflow-x-auto font-mono text-sm font-bold leading-6 whitespace-nowrap",
1608
- children: segments.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
1609
- className: "text-zinc-400",
1610
- children: "/"
1611
- }), segments.map((segment, index) => /* @__PURE__ */ jsxs("span", {
1612
- className: "flex items-center",
1613
- children: [index > 0 ? /* @__PURE__ */ jsx("span", {
1614
- className: "text-zinc-400",
1615
- children: "/"
1616
- }) : null, /* @__PURE__ */ jsx("span", {
1617
- className: "font-bold text-zinc-800 dark:text-white",
1618
- children: segment
1619
- })]
1620
- }, `${segment}-${index}`))] }) : /* @__PURE__ */ jsx("span", {
1621
- className: "font-bold text-zinc-800 dark:text-white",
1622
- children: "/"
1623
- })
1624
- }),
1625
- authOptions.length > 0 ? /* @__PURE__ */ jsx("button", {
1626
- type: "button",
1627
- "aria-expanded": authOpen,
1628
- "aria-label": "Auth",
1629
- onClick: onToggleAuth,
1630
- className: clsx("ml-auto flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-zinc-600 transition hover:bg-zinc-100 hover:text-emerald-700 dark:text-zinc-300 dark:hover:bg-white/10 dark:hover:text-emerald-200", authOpen ? "bg-emerald-100 text-emerald-800 dark:bg-emerald-400/15 dark:text-emerald-100" : "bg-zinc-50 dark:bg-white/5"),
1631
- children: authOpen ? /* @__PURE__ */ jsx(UnlockKeyholeIcon, {
1632
- className: "h-4 w-4",
1633
- "aria-hidden": "true"
1634
- }) : /* @__PURE__ */ jsx(LockKeyholeIcon, {
1635
- className: "h-4 w-4",
1636
- "aria-hidden": "true"
1637
- })
1638
- }) : null
1639
- ]
1640
- }),
1641
- serverOpen ? /* @__PURE__ */ jsx(ServerPanel, {
1642
- servers,
1643
- selectedKey: selectedServerKey,
1644
- selectedServer,
1645
- variables: serverVariables,
1646
- onSelectServer,
1647
- onChangeVariable: onChangeServerVariable
1648
- }) : null,
1649
- authOpen ? /* @__PURE__ */ jsx(AuthPanel, {
1650
- authOptions,
1651
- selectedAuthName,
1652
- selectedAuth,
1653
- authValues,
1654
- onSelectAuth,
1655
- onChangeAuthValue
1656
- }) : null
1657
- ]
1658
- });
1659
- }
1660
- function OpenApiOperation(arg0) {
1661
- const { spec, path, method, operation } = arg0;
1662
- const t = useBuiltInText();
1663
- const id = slug(`${method.toLowerCase()} ${path}`);
1664
- const summary = operation.summary ?? `${method} ${path}`;
1665
- const description = operation.description;
1666
- const parameters = getOperationParameters(spec, path, operation);
1667
- const requestBody = getRequestBody$1(operation);
1668
- const requestContents = getMediaTypeEntries(requestBody?.content);
1669
- const [selectedRequestMediaType, setSelectedRequestMediaType] = useState(requestContents[0]?.mediaType ?? "");
1670
- const selectedRequestContent = requestContents.find((content) => content.mediaType === selectedRequestMediaType) ?? requestContents[0];
1671
- const requestSchema = selectedRequestContent?.value.schema;
1672
- const servers = getServers(spec, operation);
1673
- const [selectedServerKey, setSelectedServerKey] = useState(getServerKey(servers[0], 0));
1674
- const selectedServer = servers.find((server, index) => getServerKey(server, index) === selectedServerKey) ?? servers[0];
1675
- const [serverVariables, setServerVariables] = useState(defaultServerVariables(selectedServer));
1676
- const [serverOpen, setServerOpen] = useState(false);
1677
- const authOptions = getAuthOptions(spec, operation);
1678
- const [selectedAuthName, setSelectedAuthName] = useState(authOptions[0]?.name ?? "");
1679
- const selectedAuth = authOptions.find((option) => option.name === selectedAuthName);
1680
- const [authValues, setAuthValues] = useState({});
1681
- const [authOpen, setAuthOpen] = useState(false);
1682
- const authInput = selectedAuth ? {
1683
- name: selectedAuth.name,
1684
- scheme: selectedAuth.scheme,
1685
- value: authValues[selectedAuth.name] ?? authPlaceholder(selectedAuth)
1686
- } : void 0;
1687
- const groupedParameters = {
1688
- path: parameters.filter((parameter) => parameter.in === "path"),
1689
- query: parameters.filter((parameter) => parameter.in === "query"),
1690
- header: parameters.filter((parameter) => parameter.in === "header")
1691
- };
1692
- return /* @__PURE__ */ jsxs("section", {
1693
- className: "clarify-api-endpoint scroll-mt-24 py-16 first:pt-0 last:pb-0",
1694
- "aria-labelledby": id,
1695
- children: [
1696
- /* @__PURE__ */ jsx(EndpointIdentity, {
1697
- method,
1698
- path,
1699
- servers,
1700
- selectedServerKey,
1701
- selectedServer,
1702
- serverVariables,
1703
- serverOpen,
1704
- authOptions,
1705
- selectedAuthName,
1706
- selectedAuth,
1707
- authValues,
1708
- authOpen,
1709
- onSelectServer: (value) => {
1710
- const nextServer = servers.find((server, index) => getServerKey(server, index) === value) ?? servers[0];
1711
- setSelectedServerKey(value);
1712
- setServerVariables(defaultServerVariables(nextServer));
1713
- },
1714
- onChangeServerVariable: (name, value) => setServerVariables((current) => ({
1715
- ...current,
1716
- [name]: value
1717
- })),
1718
- onToggleServer: () => {
1719
- setServerOpen((current) => !current);
1720
- setAuthOpen(false);
1721
- },
1722
- onToggleAuth: () => {
1723
- setAuthOpen((current) => !current);
1724
- setServerOpen(false);
1725
- },
1726
- onSelectAuth: setSelectedAuthName,
1727
- onChangeAuthValue: (name, value) => setAuthValues((current) => ({
1728
- ...current,
1729
- [name]: value
1730
- }))
1731
- }),
1732
- /* @__PURE__ */ jsx(Heading, {
1733
- id,
1734
- className: "mt-4",
1735
- children: summary
1736
- }),
1737
- /* @__PURE__ */ jsxs(Row, { children: [/* @__PURE__ */ jsxs(Col, { children: [
1738
- description ? /* @__PURE__ */ jsx("p", { children: description }) : null,
1739
- /* @__PURE__ */ jsx(ParameterList, {
1740
- title: t("openapi.pathParameters"),
1741
- parameters: groupedParameters.path
1742
- }),
1743
- /* @__PURE__ */ jsx(ParameterList, {
1744
- title: t("openapi.queryParameters"),
1745
- parameters: groupedParameters.query
1746
- }),
1747
- /* @__PURE__ */ jsx(ParameterList, {
1748
- title: t("openapi.headers"),
1749
- parameters: groupedParameters.header
1750
- }),
1751
- requestBody && requestContents.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
1752
- /* @__PURE__ */ jsx("h3", { children: t("openapi.requestBody") }),
1753
- typeof requestBody.description === "string" ? /* @__PURE__ */ jsx("p", { children: requestBody.description }) : null,
1754
- /* @__PURE__ */ jsx(SchemaProperties, {
1755
- title: t("openapi.bodyProperties"),
1756
- schema: requestSchema,
1757
- spec
1758
- })
1759
- ] }) : null,
1760
- /* @__PURE__ */ jsx(ResponseList, { operation })
1761
- ] }), /* @__PURE__ */ jsx(Col, {
1762
- sticky: true,
1763
- children: /* @__PURE__ */ jsx(EndpointExamples, {
1764
- spec,
1765
- path,
1766
- method,
1767
- operation,
1768
- parameters,
1769
- requestContents,
1770
- selectedRequestMediaType: selectedRequestContent?.mediaType ?? "",
1771
- onSelectRequestMediaType: setSelectedRequestMediaType,
1772
- selectedServer,
1773
- serverVariables,
1774
- auth: authInput
1775
- })
1776
- })] })
1777
- ]
1778
- });
1779
- }
1780
105
  function OpenApiPaths(arg0) {
1781
106
  const { spec } = arg0;
1782
107
  return /* @__PURE__ */ jsx("div", {
@@ -1785,7 +110,7 @@ function OpenApiPaths(arg0) {
1785
110
  path,
1786
111
  method: method.toUpperCase(),
1787
112
  operation
1788
- })).map(({ path, method, operation }) => /* @__PURE__ */ jsx(OpenApiOperation, {
113
+ })).map(({ path, method, operation }) => /* @__PURE__ */ jsx(OpenApiOperation$1, {
1789
114
  spec,
1790
115
  path,
1791
116
  method,
@@ -1796,11 +121,11 @@ function OpenApiPaths(arg0) {
1796
121
  function WarningBox(arg0) {
1797
122
  const { children, tone = "amber" } = arg0;
1798
123
  return /* @__PURE__ */ jsx("div", {
1799
- className: clsx("clarify-warning", tone === "red" ? "rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200" : "rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200"),
124
+ className: `clarify-warning ${tone === "red" ? "rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200" : "rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200"}`,
1800
125
  children
1801
126
  });
1802
127
  }
1803
- function OpenApiPage(arg0) {
128
+ function OpenApiDocument(arg0) {
1804
129
  const { spec, specPath } = arg0;
1805
130
  const t = useBuiltInText();
1806
131
  const resolved = useOpenApiSpec(spec, specPath);
@@ -1813,7 +138,7 @@ function OpenApiPage(arg0) {
1813
138
  })
1814
139
  });
1815
140
  }
1816
- function ApiEndpoint(arg0) {
141
+ function OpenApiOperationWithSpec(arg0) {
1817
142
  const { spec, path, method } = arg0;
1818
143
  const t = useBuiltInText();
1819
144
  const op = getOpenApiOperation(spec, path, method);
@@ -1821,19 +146,20 @@ function ApiEndpoint(arg0) {
1821
146
  tone: "red",
1822
147
  children: t("openapi.endpointNotFound", { endpoint: `${method.toUpperCase()} ${path}` })
1823
148
  });
1824
- return /* @__PURE__ */ jsx(OpenApiOperation, {
149
+ const normalizedMethod = method.toUpperCase();
150
+ return /* @__PURE__ */ jsx(OpenApiOperation$1, {
1825
151
  spec,
1826
152
  path,
1827
- method: method.toUpperCase(),
153
+ method: normalizedMethod,
1828
154
  operation: op
1829
- });
155
+ }, `${normalizedMethod}-${path}`);
1830
156
  }
1831
- function OpenApiEndpoint(arg0) {
157
+ function OpenApiOperation(arg0) {
1832
158
  const { specPath, path, method } = arg0;
1833
159
  const t = useBuiltInText();
1834
160
  const spec = useOpenApiSpec(void 0, specPath);
1835
161
  if (!spec) return /* @__PURE__ */ jsx(WarningBox, { children: t("openapi.specNotFound", { specPath }) });
1836
- return /* @__PURE__ */ jsx(ApiEndpoint, {
162
+ return /* @__PURE__ */ jsx(OpenApiOperationWithSpec, {
1837
163
  spec,
1838
164
  path,
1839
165
  method
@@ -1841,18 +167,44 @@ function OpenApiEndpoint(arg0) {
1841
167
  }
1842
168
  //#endregion
1843
169
  //#region source/mdx/components.ts
170
+ var builtInMDXComponents = {
171
+ ...primitives_exports,
172
+ Markdown,
173
+ Collapse
174
+ };
175
+ var builtInOpenAPIComponents = {
176
+ OpenApiDocument,
177
+ OpenApiOperation
178
+ };
1844
179
  function useMDXComponents(components = {}) {
1845
180
  return {
1846
181
  ...components,
1847
- ...primitives_exports,
1848
- OpenApiPage,
1849
- ApiEndpoint,
1850
- OpenApiEndpoint,
1851
- ApiEndpointCard,
1852
- DocShell
182
+ ...builtInMDXComponents,
183
+ ...builtInOpenAPIComponents
1853
184
  };
1854
185
  }
1855
186
  //#endregion
1856
- export { ApiEndpoint, ApiEndpointCard, AppShell, BuiltWithClarify, Button, Callout, Card, CardGroup, ClarifyConfigContext, Code, CodeGroup, DocShell, Feedback, GridPattern, Heading, HeroPattern, Logo, OpenApiEndpoint, OpenApiPage, OpenApisContext, PageFooter, Pre, Prose, SectionProvider, Tag, ThemeProvider, ThemeToggle, remToPx, render, useClarifyConfig, useMDXComponents, useOpenApis, useSectionStore, useTheme };
187
+ //#region source/mdx/DocShell.tsx
188
+ function DocShell(arg0) {
189
+ const { title, subtitle, children } = arg0;
190
+ return /* @__PURE__ */ jsx("main", {
191
+ className: "clarify-doc-shell min-h-screen bg-white px-6 py-10 text-zinc-900 dark:bg-zinc-950 dark:text-white md:px-10",
192
+ children: /* @__PURE__ */ jsxs("div", {
193
+ className: "mx-auto max-w-6xl",
194
+ children: [/* @__PURE__ */ jsxs("header", {
195
+ className: "mb-10",
196
+ children: [/* @__PURE__ */ jsx("h1", {
197
+ className: "text-3xl font-bold tracking-tight md:text-5xl",
198
+ children: title
199
+ }), subtitle ? /* @__PURE__ */ jsx("p", {
200
+ className: "mt-3 max-w-2xl text-zinc-600 dark:text-zinc-400",
201
+ children: subtitle
202
+ }) : null]
203
+ }), /* @__PURE__ */ jsx(Prose, { children })]
204
+ })
205
+ });
206
+ }
207
+ //#endregion
208
+ export { AppShell, BuiltWithClarify, Button, Callout, Card, CardGroup, ClarifyConfigContext, Code, CodeGroup, Collapse, DocShell, Feedback, GridPattern, Heading, HeroPattern, Logo, Markdown, OpenApiDocument, OpenApiOperation, OpenApisContext, PageFooter, Pre, Prose, SectionProvider, Tag, ThemeProvider, ThemeToggle, markdownRemarkPlugins, remToPx, render, useClarifyConfig, useMDXComponents, useOpenApis, useSectionStore, useTheme };
1857
209
 
1858
210
  //# sourceMappingURL=index.js.map