@stainless-api/docs-ui 0.1.0-beta.3 → 0.1.0-beta.31

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 (187) hide show
  1. package/dist/breadcrumbs-D2C-ipke.d.ts +20 -0
  2. package/dist/chunk-DsStOjWQ.js +13 -0
  3. package/dist/component-generics-CGwo6qAl.d.ts +30 -0
  4. package/dist/component-generics-D3ybuN5r.js +45 -0
  5. package/dist/components/breadcrumbs.d.ts +2 -0
  6. package/dist/components/breadcrumbs.js +15 -0
  7. package/dist/components/chat.d.ts +14 -0
  8. package/dist/components/chat.js +142 -0
  9. package/dist/components/icons.d.ts +50 -0
  10. package/dist/components/icons.js +3 -0
  11. package/dist/components/index.d.ts +11 -0
  12. package/dist/components/index.js +15 -0
  13. package/dist/components/method.d.ts +2 -0
  14. package/dist/components/method.js +15 -0
  15. package/dist/components/overview.d.ts +2 -0
  16. package/dist/components/overview.js +15 -0
  17. package/dist/components/primitives.d.ts +2 -0
  18. package/dist/components/primitives.js +15 -0
  19. package/dist/components/properties.d.ts +2 -0
  20. package/dist/components/properties.js +15 -0
  21. package/dist/components/sdk.d.ts +3 -0
  22. package/dist/components/sdk.js +15 -0
  23. package/dist/components/sidebar.d.ts +2 -0
  24. package/dist/components/sidebar.js +15 -0
  25. package/dist/components/snippets.d.ts +4 -0
  26. package/dist/components/snippets.js +15 -0
  27. package/dist/contexts/component-generics.d.ts +2 -0
  28. package/dist/contexts/component-generics.js +3 -0
  29. package/dist/contexts/component-types.d.ts +17 -0
  30. package/dist/contexts/component-types.js +0 -0
  31. package/dist/contexts/component.d.ts +30 -0
  32. package/dist/contexts/component.js +15 -0
  33. package/dist/contexts/docs.d.ts +2 -0
  34. package/dist/contexts/docs.js +3 -0
  35. package/dist/contexts/index.d.ts +19 -0
  36. package/dist/contexts/index.js +15 -0
  37. package/dist/contexts/markdown.d.ts +2 -0
  38. package/dist/contexts/markdown.js +4 -0
  39. package/dist/contexts/navigation.d.ts +3 -0
  40. package/dist/contexts/navigation.js +3 -0
  41. package/dist/contexts/search.d.ts +4 -0
  42. package/dist/contexts/search.js +15 -0
  43. package/dist/contexts/use-components.d.ts +15 -0
  44. package/dist/contexts/use-components.js +4 -0
  45. package/dist/contexts-Bpupku3r.js +3804 -0
  46. package/dist/docs-C5sBbvz9.d.ts +46 -0
  47. package/dist/docs-CopwX9a7.js +54 -0
  48. package/dist/icons-yb-Jhkmg.js +753 -0
  49. package/dist/index-BZvOzjGA.d.ts +15 -0
  50. package/dist/index-Cwjt4PqJ.d.ts +240 -0
  51. package/dist/index-Cx9sLoAB.d.ts +14 -0
  52. package/dist/index.d.ts +21 -0
  53. package/dist/index.js +15 -7542
  54. package/dist/languages/go.d.ts +12 -0
  55. package/dist/languages/go.js +15 -0
  56. package/dist/languages/http.d.ts +12 -0
  57. package/dist/languages/http.js +15 -0
  58. package/dist/languages/index.d.ts +12 -0
  59. package/dist/languages/index.js +15 -0
  60. package/dist/languages/java.d.ts +12 -0
  61. package/dist/languages/java.js +15 -0
  62. package/dist/languages/python.d.ts +12 -0
  63. package/dist/languages/python.js +15 -0
  64. package/dist/languages/ruby.d.ts +12 -0
  65. package/dist/languages/ruby.js +15 -0
  66. package/dist/languages/typescript.d.ts +12 -0
  67. package/dist/languages/typescript.js +15 -0
  68. package/dist/markdown/index.d.ts +12 -0
  69. package/dist/markdown/index.js +15 -0
  70. package/dist/markdown/md.d.ts +15 -0
  71. package/dist/markdown/md.js +3 -0
  72. package/dist/markdown/utils.d.ts +4 -0
  73. package/dist/markdown/utils.js +3 -0
  74. package/dist/markdown-CI4kbU64.js +44 -0
  75. package/dist/markdown-CswQW7Au.d.ts +22 -0
  76. package/dist/md-DxiV1_vy.js +41 -0
  77. package/dist/method-D0-gsw3H.d.ts +71 -0
  78. package/dist/navigation-Bc58Zt6l.d.ts +29 -0
  79. package/dist/navigation-CGr5_w6z.js +24 -0
  80. package/dist/overview-Ds69MW_g.d.ts +39 -0
  81. package/dist/pagefind-BaK1krMe.js +15 -0
  82. package/dist/primitives-DKSwbXPi.d.ts +99 -0
  83. package/dist/properties-4IkL0IVR.d.ts +46 -0
  84. package/dist/routing-8itEXLx6.js +189 -0
  85. package/dist/routing-ByeZ2P3d.d.ts +54 -0
  86. package/dist/routing.d.ts +2 -0
  87. package/dist/routing.js +3 -180
  88. package/dist/sdk-D1acaxlr.d.ts +119 -0
  89. package/dist/search/index.d.ts +26 -0
  90. package/dist/search/index.js +334 -0
  91. package/dist/search/providers/algolia.d.ts +24 -0
  92. package/dist/search/providers/algolia.js +15 -0
  93. package/dist/search/providers/fuse.d.ts +18 -0
  94. package/dist/search/providers/fuse.js +30 -0
  95. package/dist/search/providers/pagefind.d.ts +7 -0
  96. package/dist/search/providers/pagefind.js +3 -0
  97. package/dist/search/providers/walker.d.ts +9 -0
  98. package/dist/search/providers/walker.js +34 -0
  99. package/dist/search/types.d.ts +3 -0
  100. package/dist/search/types.js +3 -0
  101. package/dist/search-BwZ0UK72.d.ts +21 -0
  102. package/dist/sidebar-rqdLbjBO.d.ts +36 -0
  103. package/dist/snippets-Coq_j3S0.d.ts +46 -0
  104. package/dist/style-BEMLtSIK.d.ts +172 -0
  105. package/dist/style-CPgcT0Fw.js +173 -0
  106. package/dist/style.d.ts +2 -0
  107. package/dist/style.js +3 -0
  108. package/dist/styles/main.css +763 -736
  109. package/dist/styles/main.js +0 -0
  110. package/dist/styles/primitives.css +285 -464
  111. package/dist/styles/primitives.js +0 -0
  112. package/dist/styles/resets.css +31 -41
  113. package/dist/styles/resets.js +0 -0
  114. package/dist/styles/search.css +266 -248
  115. package/dist/styles/search.js +0 -0
  116. package/dist/styles/sidebar.css +59 -60
  117. package/dist/styles/sidebar.js +0 -0
  118. package/dist/styles/snippets.css +87 -88
  119. package/dist/styles/snippets.js +0 -0
  120. package/dist/styles/variables.css +87 -89
  121. package/dist/styles/variables.js +0 -0
  122. package/dist/types-BKUIuYYk.d.ts +83 -0
  123. package/dist/types-__XoFvJ_.js +34 -0
  124. package/dist/use-components-BHEwm0mE.js +7 -0
  125. package/dist/utils-2FmcHPHp.js +32 -0
  126. package/dist/utils-BCfb0F9R.js +30 -0
  127. package/dist/utils-D43p_yTd.d.ts +14 -0
  128. package/dist/utils-NYMx28lc.d.ts +21 -0
  129. package/dist/utils.d.ts +2 -0
  130. package/dist/utils.js +4 -0
  131. package/package.json +78 -16
  132. package/dist/mcp.js +0 -16003
  133. package/src/components/breadcrumbs.tsx +0 -94
  134. package/src/components/chat.tsx +0 -154
  135. package/src/components/dropdown.tsx +0 -91
  136. package/src/components/icons.tsx +0 -584
  137. package/src/components/index.ts +0 -9
  138. package/src/components/method.tsx +0 -144
  139. package/src/components/overview.tsx +0 -159
  140. package/src/components/primitives.tsx +0 -284
  141. package/src/components/properties.tsx +0 -130
  142. package/src/components/scripts/dropdown.ts +0 -78
  143. package/src/components/sdk.tsx +0 -402
  144. package/src/components/sidebar.tsx +0 -99
  145. package/src/components/snippets.tsx +0 -179
  146. package/src/contexts/component-generics.tsx +0 -48
  147. package/src/contexts/component-types.tsx +0 -5
  148. package/src/contexts/component.tsx +0 -32
  149. package/src/contexts/docs.tsx +0 -75
  150. package/src/contexts/index.tsx +0 -17
  151. package/src/contexts/markdown.tsx +0 -43
  152. package/src/contexts/navigation.tsx +0 -44
  153. package/src/contexts/search.tsx +0 -28
  154. package/src/contexts/use-components.tsx +0 -4
  155. package/src/index.ts +0 -6
  156. package/src/languages/go.tsx +0 -281
  157. package/src/languages/http.tsx +0 -321
  158. package/src/languages/index.ts +0 -26
  159. package/src/languages/java.tsx +0 -358
  160. package/src/languages/python.tsx +0 -255
  161. package/src/languages/ruby.tsx +0 -320
  162. package/src/languages/typescript.tsx +0 -393
  163. package/src/markdown/index.ts +0 -107
  164. package/src/markdown/md.ts +0 -45
  165. package/src/markdown/utils.ts +0 -49
  166. package/src/routing.ts +0 -238
  167. package/src/search/form.tsx +0 -127
  168. package/src/search/index.tsx +0 -1
  169. package/src/search/indexer.ts +0 -246
  170. package/src/search/mcp.ts +0 -61
  171. package/src/search/printer.tsx +0 -86
  172. package/src/search/providers/algolia.ts +0 -88
  173. package/src/search/providers/fuse.ts +0 -19
  174. package/src/search/providers/pagefind.ts +0 -17
  175. package/src/search/providers/walker.ts +0 -30
  176. package/src/search/results.tsx +0 -181
  177. package/src/search/state.ts +0 -64
  178. package/src/search/types.ts +0 -116
  179. package/src/style.ts +0 -197
  180. package/src/styles/main.css +0 -993
  181. package/src/styles/primitives.css +0 -572
  182. package/src/styles/resets.css +0 -47
  183. package/src/styles/search.css +0 -342
  184. package/src/styles/sidebar.css +0 -87
  185. package/src/styles/snippets.css +0 -132
  186. package/src/styles/variables.css +0 -90
  187. package/src/utils.ts +0 -41
@@ -0,0 +1,3804 @@
1
+ import { t as __export } from "./chunk-DsStOjWQ.js";
2
+ import { a as useLanguage, c as useSnippet, i as useDocs, l as useSpec, n as useContentPanelLayout, o as useResource, r as useDeclaration, s as useSettings, t as DocsProvider } from "./docs-CopwX9a7.js";
3
+ import { a as createStrictContext, i as useComponents$1, n as customizeComponents, r as useComponentContext, t as ComponentProvider$1 } from "./component-generics-D3ybuN5r.js";
4
+ import { n as useNavigation, t as NavigationProvider } from "./navigation-CGr5_w6z.js";
5
+ import { a as useRenderMarkdown, i as useMarkdownContext, n as MarkdownProvider, r as useHighlight, t as MarkdownContext } from "./markdown-CI4kbU64.js";
6
+ import { _ as walkTree, c as getLanguageSnippet, f as parseStainlessPath, n as Languages, o as generateRoute } from "./routing-8itEXLx6.js";
7
+ import { t as style_default } from "./style-CPgcT0Fw.js";
8
+ import { t as useComponents } from "./use-components-BHEwm0mE.js";
9
+ import { a as PowershellIcon, c as TerraformIcon, i as KotlinIcon, l as TypescriptIcon, n as GoIcon, o as PythonIcon, r as JavaIcon, s as RubyIcon, t as CurlIcon } from "./icons-yb-Jhkmg.js";
10
+ import { n as getResourceFromSpec, r as isResourceEmpty, t as flatResources } from "./utils-2FmcHPHp.js";
11
+ import { a as item, c as parse, l as strong, n as fence, o as list, r as heading, s as paragraph, t as code, u as text } from "./md-DxiV1_vy.js";
12
+ import { n as getSnippet, r as stripMarkup, t as getDecl } from "./utils-BCfb0F9R.js";
13
+ import { n as SearchableAttributes, r as SearchableAttributesChat } from "./types-__XoFvJ_.js";
14
+ import * as React$1 from "react";
15
+ import React, { Fragment, createElement, useState } from "react";
16
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
17
+ import { searchClient } from "@algolia/client-search";
18
+ import { renderToStaticMarkup } from "react-dom/server";
19
+ import { ArrowDownLeft, ArrowDownWideNarrowIcon, ArrowUpNarrowWideIcon, ArrowUpRight, BookOpen, CheckIcon, ChevronDown, ChevronRight, CircleAlertIcon, Copy, CopyIcon, Github, MinusIcon, PlusIcon, X } from "lucide-react";
20
+ import clsx from "clsx";
21
+ import { Button } from "@stainless-api/ui-primitives";
22
+ import Markdoc from "@markdoc/markdoc";
23
+
24
+ //#region src/components/properties.tsx
25
+ function PropertyToggle({ target }) {
26
+ return /* @__PURE__ */ jsxs("span", {
27
+ className: style_default.ExpandToggle,
28
+ "data-stldocs-property-toggle-expanded": "false",
29
+ "data-stldocs-property-toggle-target": target,
30
+ children: [/* @__PURE__ */ jsxs("span", {
31
+ className: style_default.ExpandToggleContent,
32
+ children: ["Expand ", /* @__PURE__ */ jsx(ArrowDownWideNarrowIcon, {
33
+ className: style_default.Icon,
34
+ size: 16
35
+ })]
36
+ }), /* @__PURE__ */ jsxs("span", {
37
+ className: style_default.ExpandToggleContent,
38
+ children: ["Collapse ", /* @__PURE__ */ jsx(ArrowUpNarrowWideIcon, {
39
+ className: style_default.Icon,
40
+ size: 16
41
+ })]
42
+ })]
43
+ });
44
+ }
45
+ function PropertyDescription({ description }) {
46
+ const { Markdown: Markdown$1 } = useComponents();
47
+ if (description) return /* @__PURE__ */ jsx("div", {
48
+ className: style_default.PropertyDescription,
49
+ children: /* @__PURE__ */ jsx(Markdown$1, { content: description })
50
+ });
51
+ }
52
+ function Property$6({ id, name, typeName: typeName$1, badges, type, declaration: declaration$2, description, deprecated, expand, additional, constraints, children }) {
53
+ const Docs = useComponents();
54
+ const language = useLanguage();
55
+ const properties = useSettings()?.properties;
56
+ const collapseDescription = properties?.collapseDescription;
57
+ const types = properties?.types;
58
+ const textContent = /* @__PURE__ */ jsxs(Fragment$1, { children: [
59
+ typeof deprecated === "string" && /* @__PURE__ */ jsx("div", {
60
+ className: style_default.PropertyDeprecatedMessage,
61
+ children: deprecated
62
+ }),
63
+ description && /* @__PURE__ */ jsx(Docs.PropertyDescription, { description }),
64
+ constraints && /* @__PURE__ */ jsx("div", {
65
+ className: style_default.PropertyContent,
66
+ children: constraints
67
+ })
68
+ ] });
69
+ const rich = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
70
+ className: style_default.PropertyDeclaration,
71
+ children: [
72
+ deprecated && /* @__PURE__ */ jsx("span", {
73
+ className: style_default.PropertyDeprecated,
74
+ children: "Deprecated"
75
+ }),
76
+ declaration$2,
77
+ badges && /* @__PURE__ */ jsx("span", {
78
+ className: style_default.PropertyBadges,
79
+ children: badges
80
+ })
81
+ ]
82
+ }), collapseDescription === false ? textContent : null] });
83
+ const simple = /* @__PURE__ */ jsxs(Fragment$1, { children: [
84
+ name && /* @__PURE__ */ jsxs("div", {
85
+ className: style_default.PropertyHeader,
86
+ children: [
87
+ deprecated && /* @__PURE__ */ jsx("span", {
88
+ className: style_default.PropertyDeprecated,
89
+ children: "Deprecated"
90
+ }),
91
+ name && /* @__PURE__ */ jsx("span", {
92
+ className: style_default.PropertyName,
93
+ children: name
94
+ }),
95
+ typeName$1 && /* @__PURE__ */ jsx("span", {
96
+ className: style_default.PropertyTypeName,
97
+ children: typeName$1
98
+ }),
99
+ badges && /* @__PURE__ */ jsx("span", {
100
+ className: style_default.PropertyBadges,
101
+ children: badges
102
+ })
103
+ ]
104
+ }),
105
+ type && /* @__PURE__ */ jsx("div", {
106
+ className: style_default.PropertyType,
107
+ children: type
108
+ }),
109
+ collapseDescription === false ? textContent : null
110
+ ] });
111
+ const content = /* @__PURE__ */ jsx("div", {
112
+ id,
113
+ className: style_default.PropertyInfo,
114
+ children: types === "simple" ? simple : rich
115
+ });
116
+ return /* @__PURE__ */ jsx("div", {
117
+ className: style_default.Property,
118
+ "data-stldocs-language": language,
119
+ children: children || collapseDescription !== false && description ? /* @__PURE__ */ jsxs(Docs.Expander, {
120
+ summary: content,
121
+ muted: !children,
122
+ open: expand,
123
+ children: [
124
+ collapseDescription !== false ? textContent : null,
125
+ additional,
126
+ children && /* @__PURE__ */ jsx("div", {
127
+ className: style_default.PropertyChildren,
128
+ children
129
+ })
130
+ ]
131
+ }) : content
132
+ });
133
+ }
134
+
135
+ //#endregion
136
+ //#region src/components/method.tsx
137
+ const HttpMethods = [
138
+ "get",
139
+ "head",
140
+ "put",
141
+ "delete",
142
+ "post",
143
+ "patch"
144
+ ];
145
+ const HttpMethodIcons = {
146
+ get: ArrowDownLeft,
147
+ put: ArrowUpRight,
148
+ post: ArrowUpRight,
149
+ patch: ArrowUpRight,
150
+ delete: X
151
+ };
152
+ function MethodIconBadge({ httpMethod, showName }) {
153
+ if (!httpMethod || !HttpMethods.includes(httpMethod)) return null;
154
+ return /* @__PURE__ */ jsxs("span", {
155
+ className: clsx(style_default.MethodRouteHttpMethod, style_default.MethodRouteHttpMethodIconOnly),
156
+ "data-method": httpMethod,
157
+ children: [HttpMethodIcons[httpMethod] && React$1.createElement(HttpMethodIcons[httpMethod], {
158
+ size: 14,
159
+ strokeWidth: 3,
160
+ className: style_default.Icon
161
+ }), showName && httpMethod]
162
+ });
163
+ }
164
+ function MethodHeader({ title, badges, signature, children, level }) {
165
+ const Heading = level ?? "h5";
166
+ return /* @__PURE__ */ jsxs("div", {
167
+ className: style_default.MethodHeader,
168
+ children: [
169
+ /* @__PURE__ */ jsx(Heading, {
170
+ className: style_default.MethodTitle,
171
+ children: title
172
+ }),
173
+ badges && /* @__PURE__ */ jsx("div", {
174
+ className: style_default.MethodBadges,
175
+ children: badges
176
+ }),
177
+ signature,
178
+ children
179
+ ]
180
+ });
181
+ }
182
+ function MethodRoute({ httpMethod, endpoint, iconOnly }) {
183
+ return /* @__PURE__ */ jsxs("div", {
184
+ className: style_default.MethodRoute,
185
+ children: [/* @__PURE__ */ jsx(MethodIconBadge, {
186
+ httpMethod,
187
+ showName: !iconOnly
188
+ }), endpoint && /* @__PURE__ */ jsx("span", {
189
+ className: style_default.MethodRouteEndpoint,
190
+ children: endpoint
191
+ })]
192
+ });
193
+ }
194
+ function MethodDescription({ description }) {
195
+ const { Markdown: Markdown$1 } = useComponents();
196
+ if (description) return /* @__PURE__ */ jsx("div", {
197
+ className: style_default.MethodDescription,
198
+ children: /* @__PURE__ */ jsx(Markdown$1, { content: description })
199
+ });
200
+ }
201
+ function MethodInfo$1({ children, parameters, returns }) {
202
+ return /* @__PURE__ */ jsxs("div", {
203
+ className: style_default.MethodInfo,
204
+ children: [
205
+ children && /* @__PURE__ */ jsx("div", {
206
+ className: style_default.MethodContent,
207
+ children
208
+ }),
209
+ parameters && /* @__PURE__ */ jsxs("div", {
210
+ className: style_default.MethodInfoSection,
211
+ children: [/* @__PURE__ */ jsxs("h5", { children: ["Parameters", /* @__PURE__ */ jsx(PropertyToggle, { target: "parameters" })] }), /* @__PURE__ */ jsx("div", {
212
+ className: style_default.MethodParameters,
213
+ "data-stldocs-property-group": "parameters",
214
+ children: parameters
215
+ })]
216
+ }),
217
+ returns && /* @__PURE__ */ jsxs("div", {
218
+ className: style_default.MethodInfoSection,
219
+ children: [/* @__PURE__ */ jsxs("h5", { children: ["Returns", /* @__PURE__ */ jsx(PropertyToggle, { target: "returns" })] }), /* @__PURE__ */ jsx("div", {
220
+ className: style_default.MethodReturns,
221
+ "data-stldocs-property-group": "returns",
222
+ children: returns
223
+ })]
224
+ })
225
+ ]
226
+ });
227
+ }
228
+ function Method({ id, header, children, className, ...props }) {
229
+ return /* @__PURE__ */ jsxs("div", {
230
+ id,
231
+ className: clsx(style_default.Method, className),
232
+ tabIndex: 0,
233
+ ...props,
234
+ children: [header, /* @__PURE__ */ jsx("div", {
235
+ className: style_default.MethodBody,
236
+ children
237
+ })]
238
+ });
239
+ }
240
+
241
+ //#endregion
242
+ //#region src/components/primitives.tsx
243
+ function Join({ items, limit, children }) {
244
+ return (limit && items.length > limit + 1 ? [...items.slice(0, limit), /* @__PURE__ */ jsxs("span", {
245
+ className: style_default.Truncation,
246
+ children: [items.length - limit, " more"]
247
+ }, "truncation")] : items).map((item$1, index) => /* @__PURE__ */ jsxs(Fragment, { children: [!!index && children, item$1] }, `iterator:${index}`));
248
+ }
249
+ function Expander({ id, open, summary, virtual, muted, children }) {
250
+ const virtualExpanders = useSettings()?.virtualExpanders;
251
+ if (virtual || virtualExpanders) return /* @__PURE__ */ jsx(VirtualExpander, {
252
+ summary,
253
+ open,
254
+ muted,
255
+ id,
256
+ children
257
+ });
258
+ return /* @__PURE__ */ jsxs("details", {
259
+ className: style_default.Expander,
260
+ open,
261
+ "data-stldocs-expander-muted": muted,
262
+ "data-stldocs-expander-initial-state": open,
263
+ children: [/* @__PURE__ */ jsxs("summary", {
264
+ className: style_default.ExpanderSummary,
265
+ children: [/* @__PURE__ */ jsxs("div", {
266
+ className: style_default.ExpanderSummaryIcon,
267
+ children: [/* @__PURE__ */ jsx(PlusIcon, {
268
+ size: 16,
269
+ strokeWidth: 1,
270
+ className: style_default.Icon
271
+ }), /* @__PURE__ */ jsx(MinusIcon, {
272
+ size: 16,
273
+ strokeWidth: 1,
274
+ className: style_default.Icon
275
+ })]
276
+ }), /* @__PURE__ */ jsx("div", {
277
+ className: style_default.ExpanderSummaryContent,
278
+ children: summary
279
+ })]
280
+ }), /* @__PURE__ */ jsx("div", {
281
+ className: style_default.ExpanderContent,
282
+ id,
283
+ children
284
+ })]
285
+ });
286
+ }
287
+ function VirtualExpander({ id, open: isOpen, muted, summary, children }) {
288
+ const [open, setOpen] = useState(isOpen);
289
+ React$1.useEffect(() => {
290
+ if (isOpen) setOpen(true);
291
+ }, [isOpen]);
292
+ return /* @__PURE__ */ jsxs("div", {
293
+ className: style_default.Expander,
294
+ "data-open": open,
295
+ "data-stldocs-expander-muted": muted,
296
+ "data-stldocs-expander-initial-state": open,
297
+ children: [/* @__PURE__ */ jsxs("div", {
298
+ className: style_default.ExpanderSummary,
299
+ onClick: () => setOpen(!open),
300
+ children: [/* @__PURE__ */ jsxs("div", {
301
+ className: style_default.ExpanderSummaryIcon,
302
+ children: [/* @__PURE__ */ jsx(PlusIcon, {
303
+ size: 16,
304
+ className: style_default.Icon
305
+ }), /* @__PURE__ */ jsx(MinusIcon, {
306
+ size: 16,
307
+ className: style_default.Icon
308
+ })]
309
+ }), /* @__PURE__ */ jsx("div", {
310
+ className: style_default.ExpanderSummaryContent,
311
+ children: summary
312
+ })]
313
+ }), open && /* @__PURE__ */ jsx("div", {
314
+ className: style_default.ExpanderContent,
315
+ id,
316
+ children
317
+ })]
318
+ });
319
+ }
320
+ function Markdown({ content }) {
321
+ const rendered = useRenderMarkdown(content);
322
+ return rendered && /* @__PURE__ */ jsx("div", {
323
+ className: clsx(style_default.Markdown, style_default.Content, "stl-ui-prose"),
324
+ dangerouslySetInnerHTML: { __html: rendered }
325
+ });
326
+ }
327
+ function Badge({ id, children }) {
328
+ return /* @__PURE__ */ jsx("span", {
329
+ className: style_default.Badge,
330
+ "data-badge-id": id,
331
+ children: children ?? id
332
+ });
333
+ }
334
+ const TooltipNestingContext = React$1.createContext(false);
335
+ function Tooltip({ content, children }) {
336
+ if (React$1.useContext(TooltipNestingContext)) return children;
337
+ return /* @__PURE__ */ jsxs("span", {
338
+ className: style_default.Tooltip,
339
+ children: [/* @__PURE__ */ jsx("span", {
340
+ className: style_default.TooltipContent,
341
+ children: /* @__PURE__ */ jsx(TooltipNestingContext.Provider, {
342
+ value: true,
343
+ children: content
344
+ })
345
+ }), /* @__PURE__ */ jsx("span", {
346
+ className: style_default.TooltipHost,
347
+ children
348
+ })]
349
+ });
350
+ }
351
+ function Link({ stainlessPath, scroll = true, children, ...props }) {
352
+ const { basePath, onNavigate } = useNavigation();
353
+ const language = useLanguage();
354
+ const href = React$1.useMemo(() => {
355
+ if (props.href) return props.href;
356
+ if (stainlessPath && basePath) return generateRoute(basePath, language, stainlessPath);
357
+ }, [
358
+ basePath,
359
+ language,
360
+ stainlessPath,
361
+ props.href
362
+ ]);
363
+ const handleClick = React$1.useCallback((e) => {
364
+ if (props.onClick) props.onClick(e);
365
+ if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
366
+ if (href) onNavigate?.(e, {
367
+ href,
368
+ language,
369
+ stainlessPath,
370
+ scroll
371
+ });
372
+ }, [
373
+ href,
374
+ scroll,
375
+ onNavigate,
376
+ language,
377
+ props,
378
+ stainlessPath
379
+ ]);
380
+ if (!href) return children;
381
+ return /* @__PURE__ */ jsx("a", {
382
+ href,
383
+ onClick: handleClick,
384
+ ...props,
385
+ children
386
+ });
387
+ }
388
+ const Input = React$1.forwardRef(function Input$1({ left, right, ...props }, ref) {
389
+ return /* @__PURE__ */ jsxs("div", {
390
+ className: style_default.Input,
391
+ children: [
392
+ left,
393
+ /* @__PURE__ */ jsx("input", {
394
+ ...props,
395
+ ref,
396
+ className: style_default.InputTextField
397
+ }),
398
+ right
399
+ ]
400
+ });
401
+ });
402
+ const ToggleButton = React$1.forwardRef(function ToggleButton$1({ children, selected, ...props }, ref) {
403
+ return /* @__PURE__ */ jsx("button", {
404
+ ...props,
405
+ ref,
406
+ className: style_default.ToggleButton,
407
+ "data-stldocs-toggle-selected": selected,
408
+ children
409
+ });
410
+ });
411
+ function ListView({ items, itemDelegate, onSelectListItem, ...rest }) {
412
+ const [selectedIndex, setSelectedIndex] = React$1.useState(0);
413
+ const [keyboardIndex, setKeyboardIndex] = React$1.useState(0);
414
+ const listRef = React$1.useRef(null);
415
+ const itemRef = React$1.useRef(null);
416
+ React$1.useEffect(() => {
417
+ setSelectedIndex(0);
418
+ setKeyboardIndex(0);
419
+ }, [items]);
420
+ const handleSelect = React$1.useCallback(() => {
421
+ const item$1 = items[selectedIndex];
422
+ if (item$1) onSelectListItem?.(item$1);
423
+ }, [
424
+ items,
425
+ selectedIndex,
426
+ onSelectListItem
427
+ ]);
428
+ React$1.useEffect(() => {
429
+ function handleKeyPress(ev) {
430
+ switch (ev.key) {
431
+ case "ArrowUp": {
432
+ ev.preventDefault();
433
+ const value = Math.max(0, selectedIndex - 1);
434
+ setSelectedIndex(value);
435
+ setKeyboardIndex(value);
436
+ break;
437
+ }
438
+ case "ArrowDown": {
439
+ ev.preventDefault();
440
+ const value = Math.min(items.length, selectedIndex + 1);
441
+ setSelectedIndex(value);
442
+ setKeyboardIndex(value);
443
+ break;
444
+ }
445
+ case "Enter":
446
+ ev.preventDefault();
447
+ handleSelect();
448
+ break;
449
+ }
450
+ }
451
+ addEventListener("keydown", handleKeyPress);
452
+ return () => removeEventListener("keydown", handleKeyPress);
453
+ }, [
454
+ items,
455
+ selectedIndex,
456
+ handleSelect
457
+ ]);
458
+ React$1.useEffect(() => {
459
+ if (!keyboardIndex || !itemRef.current || !listRef.current) {
460
+ listRef?.current?.scroll(0, 0);
461
+ return;
462
+ }
463
+ const selectedBounds = itemRef.current.getBoundingClientRect();
464
+ const listBounds = listRef.current.getBoundingClientRect();
465
+ if (selectedBounds.top < listBounds.top || selectedBounds.bottom > listBounds.bottom) itemRef.current.scrollIntoView({ block: "nearest" });
466
+ }, [
467
+ keyboardIndex,
468
+ items,
469
+ listRef
470
+ ]);
471
+ return /* @__PURE__ */ jsx("div", {
472
+ ref: listRef,
473
+ className: style_default.ListView,
474
+ tabIndex: 0,
475
+ ...rest,
476
+ children: items.map((item$1, index) => /* @__PURE__ */ jsx("div", {
477
+ ref: index === selectedIndex ? itemRef : null,
478
+ className: style_default.ListViewItem,
479
+ "data-stldocs-listview-selected": index === selectedIndex,
480
+ onClick: handleSelect,
481
+ onMouseMove: () => setSelectedIndex(index),
482
+ children: itemDelegate(item$1, index === selectedIndex)
483
+ }, index))
484
+ });
485
+ }
486
+
487
+ //#endregion
488
+ //#region src/components/sdk.tsx
489
+ const PropertyModelContext = React$1.createContext({});
490
+ function usePropertyModel() {
491
+ return React$1.useContext(PropertyModelContext);
492
+ }
493
+ const ReferenceNestingContext = React$1.createContext([]);
494
+ function useReferenceNesting() {
495
+ return React$1.useContext(ReferenceNestingContext);
496
+ }
497
+ const SDKSnippetLanguages = {
498
+ "node.default": {
499
+ name: "TypeScript",
500
+ icon: "typescript"
501
+ },
502
+ "typescript.default": {
503
+ name: "TypeScript",
504
+ icon: "typescript"
505
+ },
506
+ "python.default": {
507
+ name: "Python",
508
+ icon: "python"
509
+ },
510
+ "go.default": {
511
+ name: "Go",
512
+ icon: "go"
513
+ },
514
+ "java.default": {
515
+ name: "Java",
516
+ icon: "java"
517
+ },
518
+ "kotlin.default": {
519
+ name: "Kotlin",
520
+ icon: "kotlin"
521
+ },
522
+ "http.curl": {
523
+ name: "cURL",
524
+ icon: "http"
525
+ },
526
+ "http.powershell": {
527
+ name: "Powershell",
528
+ icon: "powershell"
529
+ },
530
+ "terraform.default": {
531
+ name: "Terraform",
532
+ icon: "terraform"
533
+ },
534
+ "ruby.default": {
535
+ name: "Ruby",
536
+ icon: "ruby"
537
+ }
538
+ };
539
+ function SDKChildren({ paths, expand, depth }) {
540
+ const Docs = useComponents();
541
+ return /* @__PURE__ */ jsx("div", {
542
+ className: style_default.Properties,
543
+ children: paths.map((path, i) => /* @__PURE__ */ jsx(Docs.SDKDeclaration, {
544
+ path,
545
+ expand,
546
+ depth
547
+ }, i))
548
+ });
549
+ }
550
+ function SDKDeclaration({ path, expand, depth = 0 }) {
551
+ const Lang = useLanguageComponents();
552
+ const Docs = useComponents();
553
+ const decl = useDeclaration(path, true);
554
+ const settings = useSettings();
555
+ const model = usePropertyModel();
556
+ const nesting = useReferenceNesting();
557
+ const { selectedPath } = useNavigation();
558
+ if (decl.kind.endsWith("Reference")) {
559
+ const refId = "type" in decl && typeof decl.type !== "string" && "$ref" in decl.type ? decl.type["$ref"] : void 0;
560
+ if (refId && refId !== path && !nesting.includes(refId)) return /* @__PURE__ */ jsx(ReferenceNestingContext.Provider, {
561
+ value: [...nesting, refId],
562
+ children: /* @__PURE__ */ jsx(SDKDeclaration, {
563
+ path: refId,
564
+ expand,
565
+ depth
566
+ })
567
+ });
568
+ }
569
+ const isUnion = "childrenParentSchema" in decl && decl.childrenParentSchema && ["enum", "union"].includes(decl.childrenParentSchema);
570
+ const id = model?.propertyPath ? `${model.propertyPath} + ${path}` : path;
571
+ const shouldExpand = selectedPath?.startsWith(path) && nesting.length < 1 || settings?.properties?.expandDepth && depth <= settings?.properties?.expandDepth && !isUnion || expand;
572
+ const content = /* @__PURE__ */ jsx(Lang.Property, {
573
+ decl,
574
+ children: ({ ...props }) => /* @__PURE__ */ jsx(Docs.Property, {
575
+ id,
576
+ expand: shouldExpand,
577
+ constraints: "constraints" in decl && /* @__PURE__ */ jsx(Docs.SDKConstraints, { constraints: decl["constraints"] }),
578
+ declaration: /* @__PURE__ */ jsx(Lang.Declaration, { decl }),
579
+ description: "docstring" in decl ? decl["docstring"] : void 0,
580
+ deprecated: decl.deprecated,
581
+ ...props,
582
+ children: "children" in decl && (decl.children?.length ?? 0) > 0 && !decl.children?.includes(path) && (settings?.properties?.includeModelProperties !== false || !("modelPath" in decl)) && /* @__PURE__ */ jsxs(Fragment$1, { children: [isUnion && /* @__PURE__ */ jsx("div", {
583
+ className: style_default.PropertyAnnotation,
584
+ children: "Accepts one of the following:"
585
+ }), /* @__PURE__ */ jsx(Docs.SDKChildren, {
586
+ paths: decl.children ?? [],
587
+ depth: depth + 1
588
+ })] })
589
+ })
590
+ });
591
+ if ("modelPath" in decl) {
592
+ const value = {
593
+ modelPath: decl.modelPath,
594
+ propertyPath: decl.stainlessPath
595
+ };
596
+ return /* @__PURE__ */ jsx(PropertyModelContext.Provider, {
597
+ value,
598
+ children: content
599
+ });
600
+ }
601
+ return content;
602
+ }
603
+ function SDKConstraints({ constraints }) {
604
+ if (constraints) return /* @__PURE__ */ jsx("div", {
605
+ className: style_default.PropertyConstraints,
606
+ children: Object.entries(constraints).map(([name, value]) => /* @__PURE__ */ jsxs("div", {
607
+ className: style_default.PropertyConstraint,
608
+ children: [/* @__PURE__ */ jsx("span", {
609
+ className: style_default.PropertyConstraintName,
610
+ children: name
611
+ }), /* @__PURE__ */ jsx("span", {
612
+ className: style_default.PropertyConstraintValue,
613
+ children: value
614
+ })]
615
+ }, name))
616
+ });
617
+ }
618
+ const snippetIcons = {
619
+ "node.default": TypescriptIcon,
620
+ "typescript.default": TypescriptIcon,
621
+ "go.default": GoIcon,
622
+ "python.default": PythonIcon,
623
+ "terraform.default": TerraformIcon,
624
+ "http.curl": CurlIcon,
625
+ "http.powershell": PowershellIcon,
626
+ "ruby.default": RubyIcon,
627
+ "java.default": JavaIcon,
628
+ "kotlin.default": KotlinIcon
629
+ };
630
+ function SDKIcon({ language }) {
631
+ const LangIcon = snippetIcons[language];
632
+ if (!LangIcon) return null;
633
+ return /* @__PURE__ */ jsx(LangIcon, { className: clsx(style_default.Icon, language.split(".").shift()) });
634
+ }
635
+ function SDKRequestTitle({ snippetLanguage }) {
636
+ const languageName = SDKSnippetLanguages[snippetLanguage]?.name;
637
+ return /* @__PURE__ */ jsxs("span", {
638
+ className: style_default.SnippetRequestTitleLanguage,
639
+ children: [
640
+ /* @__PURE__ */ jsx(SDKIcon, { language: snippetLanguage }),
641
+ " ",
642
+ languageName
643
+ ]
644
+ });
645
+ }
646
+ function SDKExample({ method, transformRequestSnippet }) {
647
+ const Docs = useComponents();
648
+ const snippetLanguage = getLanguageSnippet(useLanguage());
649
+ return /* @__PURE__ */ jsx(Docs.Snippet, {
650
+ requestTitle: /* @__PURE__ */ jsx(Docs.SDKRequestTitle, { snippetLanguage }),
651
+ method,
652
+ transformRequestSnippet
653
+ });
654
+ }
655
+ function SDKMethodHeader({ method }) {
656
+ const Docs = useComponents();
657
+ const Lang = useLanguageComponents();
658
+ const decl = useDeclaration(method.stainlessPath, true);
659
+ return /* @__PURE__ */ jsx(Docs.MethodHeader, {
660
+ level: "h1",
661
+ title: method.summary ?? method.title,
662
+ signature: /* @__PURE__ */ jsx(Lang.MethodSignature, { decl }),
663
+ badges: method.deprecated && /* @__PURE__ */ jsx(Docs.Badge, {
664
+ id: "deprecated",
665
+ children: "Deprecated"
666
+ }),
667
+ children: /* @__PURE__ */ jsx(Docs.MethodRoute, {
668
+ httpMethod: method.httpMethod,
669
+ endpoint: method.endpoint.split(" ", 2).at(-1)
670
+ })
671
+ });
672
+ }
673
+ function SDKMethodInfo({ method }) {
674
+ const Docs = useComponents();
675
+ const Lang = useLanguageComponents();
676
+ const decl = useDeclaration(method.stainlessPath, true);
677
+ const spec = useSpec();
678
+ const language = useLanguage();
679
+ if (Lang.MethodInfo) return /* @__PURE__ */ jsx(Lang.MethodInfo, { decl });
680
+ function shouldExpand(items) {
681
+ if (items.length > 1) return false;
682
+ const item$1 = items[0];
683
+ if (!item$1) return false;
684
+ const decl$1 = spec?.decls?.[language]?.[item$1];
685
+ return decl$1 && "children" in decl$1 && decl$1.children && decl$1.children.length > 0;
686
+ }
687
+ return /* @__PURE__ */ jsx(Docs.MethodInfo, {
688
+ parameters: "paramsChildren" in decl && Array.isArray(decl.paramsChildren) && decl.paramsChildren.length > 0 && /* @__PURE__ */ jsx(Docs.SDKChildren, {
689
+ expand: shouldExpand(decl.paramsChildren),
690
+ paths: decl.paramsChildren
691
+ }),
692
+ returns: "responseChildren" in decl && decl.responseChildren && decl.responseChildren.length > 0 && /* @__PURE__ */ jsx(Docs.SDKChildren, {
693
+ expand: shouldExpand(decl.responseChildren),
694
+ paths: decl.responseChildren
695
+ })
696
+ });
697
+ }
698
+ function SDKMethod({ method, transformRequestSnippet }) {
699
+ const Docs = useComponents();
700
+ const decl = useDeclaration(method?.stainlessPath, true);
701
+ const layout = useContentPanelLayout();
702
+ if (!decl) return;
703
+ return /* @__PURE__ */ jsxs(Docs.Method, {
704
+ id: method.stainlessPath,
705
+ header: /* @__PURE__ */ jsx(Docs.SDKMethodHeader, { method }),
706
+ className: clsx({
707
+ [style_default.MethodSinglePane]: layout === "single-pane",
708
+ [style_default.MethodDoublePane]: layout === "double-pane"
709
+ }),
710
+ children: [
711
+ /* @__PURE__ */ jsxs("div", {
712
+ className: style_default.MethodContentColumn,
713
+ children: [/* @__PURE__ */ jsx(Docs.MethodDescription, { description: method.description }), /* @__PURE__ */ jsx(Docs.SDKMethodInfo, { method })]
714
+ }),
715
+ /* @__PURE__ */ jsx("div", {
716
+ className: style_default.MethodExample + " not-content",
717
+ children: /* @__PURE__ */ jsx(Docs.SDKExample, {
718
+ method,
719
+ transformRequestSnippet
720
+ })
721
+ }),
722
+ /* @__PURE__ */ jsxs("div", {
723
+ className: style_default.MethodResponseColumn,
724
+ children: [/* @__PURE__ */ jsx("h5", { children: "Returns Examples" }), /* @__PURE__ */ jsx(Docs.SnippetResponse, { responses: method.exampleResponses })]
725
+ })
726
+ ]
727
+ });
728
+ }
729
+ function SDKModel({ model }) {
730
+ const Docs = useComponents();
731
+ if (!useDeclaration(`${model.stainlessPath} > (schema)`, true)) return null;
732
+ return /* @__PURE__ */ jsx("div", {
733
+ className: style_default.Model,
734
+ tabIndex: 0,
735
+ children: /* @__PURE__ */ jsx("div", {
736
+ className: style_default.ResourceContentProperties,
737
+ children: /* @__PURE__ */ jsx(Docs.SDKDeclaration, { path: `${model.stainlessPath} > (schema)` })
738
+ })
739
+ });
740
+ }
741
+ function SDKReference({ stainlessPath, children }) {
742
+ const Docs = useComponents();
743
+ if (!stainlessPath || !stainlessPath.endsWith("(schema)")) return children;
744
+ return /* @__PURE__ */ jsx("span", {
745
+ className: style_default.TypeReference,
746
+ children: /* @__PURE__ */ jsx(Docs.Link, {
747
+ stainlessPath,
748
+ children
749
+ })
750
+ });
751
+ }
752
+ function SDKLanguageBlock({ language, version, install, links }) {
753
+ const Docs = useComponents();
754
+ const lang = `${language}.default`;
755
+ return /* @__PURE__ */ jsxs("div", {
756
+ className: style_default.LanguageBlock,
757
+ children: [
758
+ /* @__PURE__ */ jsxs("div", {
759
+ className: style_default.LanguageBlockContent,
760
+ children: [/* @__PURE__ */ jsx("div", {
761
+ className: style_default.LanguageBlockContentIcon,
762
+ children: /* @__PURE__ */ jsx(Docs.SDKIcon, {
763
+ language: lang,
764
+ size: 24
765
+ })
766
+ }), /* @__PURE__ */ jsxs("div", {
767
+ className: style_default.LanguageBlockContentInfo,
768
+ children: [/* @__PURE__ */ jsx("div", {
769
+ className: style_default.LanguageBlockContentInfoLanguage,
770
+ children: Docs.SDKSnippetLanguages[lang].name
771
+ }), /* @__PURE__ */ jsx("div", {
772
+ className: style_default.LanguageBlockContentInfoVersion,
773
+ children: version
774
+ })]
775
+ })]
776
+ }),
777
+ /* @__PURE__ */ jsxs("div", {
778
+ className: style_default.LanguageBlockInstall,
779
+ "data-stldocs-copy-parent": true,
780
+ children: [
781
+ /* @__PURE__ */ jsx("pre", {
782
+ "data-stldocs-copy-content": true,
783
+ children: install
784
+ }),
785
+ " ",
786
+ /* @__PURE__ */ jsx(Button, {
787
+ variant: "ghost",
788
+ size: "sm",
789
+ "data-stldocs-snippet-copy": true,
790
+ children: /* @__PURE__ */ jsx(Copy, {
791
+ size: 16,
792
+ className: style_default.Icon
793
+ })
794
+ })
795
+ ]
796
+ }),
797
+ /* @__PURE__ */ jsxs("div", {
798
+ className: style_default.LanguageBlockLinks,
799
+ children: [/* @__PURE__ */ jsx(Button, {
800
+ href: links.repo,
801
+ variant: "outline",
802
+ children: /* @__PURE__ */ jsx(Button.Icon, { icon: Github })
803
+ }), /* @__PURE__ */ jsxs(Button, {
804
+ href: links.docs,
805
+ variant: "outline",
806
+ children: [/* @__PURE__ */ jsx(Button.Icon, { icon: BookOpen }), /* @__PURE__ */ jsx(Button.Label, { children: "Read Docs" })]
807
+ })]
808
+ })
809
+ ]
810
+ });
811
+ }
812
+
813
+ //#endregion
814
+ //#region src/components/snippets.tsx
815
+ function SnippetCode({ content, language }) {
816
+ const lang = useLanguage();
817
+ const highlighted = useHighlight(content, language || lang);
818
+ return /* @__PURE__ */ jsx("div", {
819
+ className: style_default.SnippetCode,
820
+ children: /* @__PURE__ */ jsx("pre", {
821
+ className: style_default.SnippetCodeContent,
822
+ "data-stldocs-copy-content": true,
823
+ children: /* @__PURE__ */ jsx("code", {
824
+ className: language === "json" ? "snippet-json" : "snippet",
825
+ dangerouslySetInnerHTML: { __html: highlighted }
826
+ })
827
+ })
828
+ });
829
+ }
830
+ function SnippetContainer({ children }) {
831
+ return /* @__PURE__ */ jsx("div", {
832
+ className: clsx(style_default.Snippet),
833
+ children
834
+ });
835
+ }
836
+ function SnippetRequestContainer({ children }) {
837
+ return /* @__PURE__ */ jsx("div", { children });
838
+ }
839
+ function Snippet({ requestTitle, method, transformRequestSnippet }) {
840
+ const Docs = useComponents();
841
+ const language = useLanguage();
842
+ const [CopyButtonIcon, setCopyIcon] = React$1.useState(CopyIcon);
843
+ const originalSnippet = useSnippet(method.stainlessPath, void 0, language === "http" ? "curl" : "default");
844
+ const decl = useDeclaration(method.stainlessPath, false);
845
+ if (!originalSnippet) {
846
+ console.warn(`Snippet not found for method '${method.stainlessPath}'`);
847
+ return null;
848
+ }
849
+ const signature = decl && "qualified" in decl ? decl.qualified : void 0;
850
+ const responses = method.exampleResponses;
851
+ const snippet = transformRequestSnippet ? transformRequestSnippet({
852
+ snippet: originalSnippet,
853
+ language
854
+ }) : originalSnippet;
855
+ async function handleCopy() {
856
+ try {
857
+ await navigator.clipboard.writeText(snippet);
858
+ setCopyIcon(CheckIcon);
859
+ } catch {
860
+ setCopyIcon(CircleAlertIcon);
861
+ }
862
+ setTimeout(() => setCopyIcon(CopyIcon), 1e3);
863
+ }
864
+ return /* @__PURE__ */ jsxs(Docs.SnippetContainer, {
865
+ signature,
866
+ children: [snippet && /* @__PURE__ */ jsx(Docs.SnippetRequestContainer, {
867
+ signature,
868
+ children: /* @__PURE__ */ jsxs("div", {
869
+ className: style_default.SnippetRequest,
870
+ "data-stldocs-copy-parent": true,
871
+ children: [/* @__PURE__ */ jsxs("div", {
872
+ className: style_default.SnippetRequestTitle,
873
+ children: [
874
+ /* @__PURE__ */ jsxs("div", {
875
+ className: style_default.SnippetRequestTitleMethod,
876
+ children: [/* @__PURE__ */ jsx(Docs.MethodRoute, {
877
+ httpMethod: method.httpMethod,
878
+ iconOnly: true
879
+ }), /* @__PURE__ */ jsx("h5", { children: method.summary })]
880
+ }),
881
+ /* @__PURE__ */ jsx("div", {
882
+ className: style_default.SnippetRequestTitleContent,
883
+ children: requestTitle
884
+ }),
885
+ /* @__PURE__ */ jsx(Button, {
886
+ variant: "ghost",
887
+ "data-stldocs-snippet-copy": true,
888
+ children: /* @__PURE__ */ jsx(CopyButtonIcon, {
889
+ size: 16,
890
+ className: style_default.Icon,
891
+ onClick: handleCopy
892
+ })
893
+ })
894
+ ]
895
+ }), /* @__PURE__ */ jsx(Docs.SnippetCode, {
896
+ content: snippet,
897
+ signature
898
+ })]
899
+ })
900
+ }), responses && /* @__PURE__ */ jsx(Docs.SnippetResponse, { responses })]
901
+ });
902
+ }
903
+ function SnippetResponse({ responses }) {
904
+ const { SnippetCode: SnippetCode$1 } = useComponents();
905
+ if (!responses) return null;
906
+ const mappedResponses = Object.keys(responses).map((key) => {
907
+ const responseContent = responses[key];
908
+ if (!responseContent) return null;
909
+ const responseType = Object.keys(responseContent)[0];
910
+ if (!responseType) return null;
911
+ const response = responseContent[responseType];
912
+ if (!response) return null;
913
+ const examples = response?.examples;
914
+ if (!examples) return null;
915
+ const exampleType = Object.keys(examples)[0];
916
+ if (!exampleType) return null;
917
+ let value = examples[exampleType]?.value;
918
+ if (!value) return null;
919
+ let language = "none";
920
+ if (responseType === "application/json" || typeof value === "object") {
921
+ language = "json";
922
+ value = JSON.stringify(value, null, 2);
923
+ }
924
+ return {
925
+ language,
926
+ responseCode: key,
927
+ content: value
928
+ };
929
+ }).filter(Boolean);
930
+ if (mappedResponses.length === 0) return null;
931
+ return /* @__PURE__ */ jsx("div", {
932
+ className: style_default.SnippetMultiResponse,
933
+ children: /* @__PURE__ */ jsxs("div", {
934
+ className: clsx(style_default.Snippet),
935
+ children: [/* @__PURE__ */ jsx("div", {
936
+ className: clsx(style_default.SnippetResponseTab, mappedResponses.length === 1 && style_default.SnippetResponseTabSingleReturn),
937
+ children: mappedResponses.map(({ responseCode }, index) => /* @__PURE__ */ jsx("div", {
938
+ "data-snippet-response-tab-id": `snippet-response-tab-${responseCode}-${index}`,
939
+ className: clsx(style_default.SnippetResponseTabItem, index === 0 && style_default.SnippetResponseTabItemActive),
940
+ children: /* @__PURE__ */ jsxs(Button, {
941
+ disabled: mappedResponses.length === 1,
942
+ variant: "ghost",
943
+ children: [responseCode, " example"]
944
+ })
945
+ }, `snippet-response-tab-item-${responseCode}-${index}`))
946
+ }), mappedResponses.map(({ responseCode, content, language }, index) => {
947
+ return /* @__PURE__ */ jsx("div", {
948
+ className: clsx(style_default.SnippetResponsePane, index === 0 && style_default.SnippetResponsePaneActive),
949
+ "data-snippet-response-pane-id": `snippet-response-tab-${responseCode}-${index}`,
950
+ children: /* @__PURE__ */ jsx(SnippetCode$1, {
951
+ content,
952
+ language
953
+ })
954
+ }, `snippet-response-${responseCode}-${index}`);
955
+ })]
956
+ })
957
+ });
958
+ }
959
+
960
+ //#endregion
961
+ //#region src/components/overview.tsx
962
+ function SDKResourceHeader({ resource, parents }) {
963
+ const segments = parents?.map((parent, index) => /* @__PURE__ */ jsxs("span", {
964
+ className: style_default.ResourceTitleSegment,
965
+ children: [parent.title, index < parents.length && /* @__PURE__ */ jsx(ChevronRight, {
966
+ size: 16,
967
+ className: style_default.Icon
968
+ })]
969
+ }, parent.stainlessPath));
970
+ if (!segments && !resource.description) return null;
971
+ return /* @__PURE__ */ jsxs("div", {
972
+ className: style_default.ResourceHeader,
973
+ children: [segments && /* @__PURE__ */ jsxs("h4", {
974
+ id: resource.stainlessPath,
975
+ className: style_default.ResourceTitle,
976
+ children: [segments, /* @__PURE__ */ jsx("span", {
977
+ className: style_default.ResourceTitleSegment,
978
+ children: resource.title
979
+ })]
980
+ }), resource.description && /* @__PURE__ */ jsx("div", {
981
+ className: style_default.ResourceDescription,
982
+ children: /* @__PURE__ */ jsx(Markdown, { content: resource.description })
983
+ })]
984
+ });
985
+ }
986
+ function SDKMethodSummary({ method }) {
987
+ const Docs = useComponents();
988
+ const Lang = useLanguageComponents();
989
+ const decl = useDeclaration(method.stainlessPath, true);
990
+ return /* @__PURE__ */ jsx(Docs.MethodHeader, {
991
+ level: "h5",
992
+ title: /* @__PURE__ */ jsx(Docs.Link, {
993
+ stainlessPath: method.stainlessPath,
994
+ children: method.summary ?? method.title
995
+ }),
996
+ signature: /* @__PURE__ */ jsx(Lang.MethodSignature, { decl }),
997
+ badges: method.deprecated && /* @__PURE__ */ jsx(Docs.Badge, {
998
+ id: "deprecated",
999
+ children: "Deprecated"
1000
+ }),
1001
+ children: /* @__PURE__ */ jsx(Docs.MethodRoute, {
1002
+ httpMethod: method.httpMethod,
1003
+ endpoint: method.endpoint.split(" ", 2).at(-1)
1004
+ })
1005
+ });
1006
+ }
1007
+ function SDKResource({ resource, parents, showModels }) {
1008
+ const Docs = useComponents();
1009
+ const language = useLanguage();
1010
+ const spec = useSpec();
1011
+ const methods = Object.values(resource.methods).filter((method) => spec?.decls?.[language]?.[method.stainlessPath]);
1012
+ const models = Object.values(resource.models).filter((model) => spec?.decls?.[language]?.[`${model.stainlessPath} > (schema)`]);
1013
+ return /* @__PURE__ */ jsx("div", {
1014
+ className: style_default.Resource,
1015
+ children: /* @__PURE__ */ jsxs("div", {
1016
+ className: style_default.ResourceContent,
1017
+ children: [
1018
+ /* @__PURE__ */ jsx(Docs.SDKResourceHeader, {
1019
+ resource,
1020
+ parents
1021
+ }),
1022
+ methods.length > 0 && /* @__PURE__ */ jsx("div", {
1023
+ className: style_default.ResourceContentGroup,
1024
+ children: methods.map((method) => /* @__PURE__ */ jsx("div", {
1025
+ className: style_default.MethodSummary,
1026
+ children: /* @__PURE__ */ jsx(Docs.SDKMethodSummary, { method })
1027
+ }, method.stainlessPath))
1028
+ }),
1029
+ showModels !== false && models.length > 0 && /* @__PURE__ */ jsxs("div", {
1030
+ className: style_default.ResourceContentGroup,
1031
+ "data-stldocs-property-group": "models",
1032
+ children: [/* @__PURE__ */ jsxs("h5", {
1033
+ className: style_default.ResourceContentGroupModelTitle,
1034
+ children: ["Models", /* @__PURE__ */ jsx(PropertyToggle, { target: "models" })]
1035
+ }), models.map((model) => /* @__PURE__ */ jsx(Docs.SDKModel, { model }, model.stainlessPath))]
1036
+ })
1037
+ ]
1038
+ })
1039
+ });
1040
+ }
1041
+ function SDKOverview({ resource }) {
1042
+ const { SDKResource: SDKResource$1 } = useComponents();
1043
+ const nested = React$1.useMemo(() => flatResources(resource.subresources, [resource]), [resource]);
1044
+ return /* @__PURE__ */ jsxs("div", {
1045
+ className: style_default.Overview,
1046
+ children: [
1047
+ /* @__PURE__ */ jsx("div", {
1048
+ className: style_default.OverviewHeader,
1049
+ children: /* @__PURE__ */ jsx("h1", { children: resource.title })
1050
+ }),
1051
+ /* @__PURE__ */ jsx(SDKResource$1, { resource }),
1052
+ nested.map((props, index) => /* @__PURE__ */ createElement(SDKResource$1, {
1053
+ ...props,
1054
+ key: index
1055
+ }))
1056
+ ]
1057
+ });
1058
+ }
1059
+ function SDKRoot({ stainlessPath }) {
1060
+ const spec = useSpec();
1061
+ const Docs = useComponents();
1062
+ const parsed = parseStainlessPath(stainlessPath);
1063
+ const resource = spec && getResourceFromSpec(stainlessPath, spec);
1064
+ if (!resource || !parsed) {
1065
+ console.warn(`Could not find resource or parsed path for '${stainlessPath}'`);
1066
+ return null;
1067
+ }
1068
+ if (parsed.method) {
1069
+ const method = resource.methods[parsed.method];
1070
+ if (!method) {
1071
+ console.warn(`Method '${parsed.method}' not found in resource '${resource.stainlessPath}'`);
1072
+ return null;
1073
+ }
1074
+ return /* @__PURE__ */ jsx("div", {
1075
+ className: style_default.Root,
1076
+ children: /* @__PURE__ */ jsx(Docs.SDKMethod, { method })
1077
+ });
1078
+ }
1079
+ return /* @__PURE__ */ jsx("div", {
1080
+ className: style_default.Root,
1081
+ children: /* @__PURE__ */ jsx(Docs.SDKOverview, { resource })
1082
+ });
1083
+ }
1084
+
1085
+ //#endregion
1086
+ //#region src/components/breadcrumbs.tsx
1087
+ function generateApiBreadcrumbs(fullPath, spec, basePath) {
1088
+ const cleanBasePath = basePath.replace(/\/+$/, "");
1089
+ const cleanPath = fullPath.replace(/\/+$/, "");
1090
+ if (!cleanPath.startsWith(cleanBasePath)) return null;
1091
+ const rest = cleanPath.slice(cleanBasePath.length).split("/").filter(Boolean);
1092
+ const breadcrumbs = [];
1093
+ let href = cleanBasePath;
1094
+ let i = 0;
1095
+ if (Languages.includes(rest[0])) {
1096
+ href += `/${rest[0]}`;
1097
+ i++;
1098
+ }
1099
+ breadcrumbs.push({
1100
+ title: "API Reference",
1101
+ href
1102
+ });
1103
+ let currentSpec = spec;
1104
+ while (i < rest.length) {
1105
+ const idType = rest[i];
1106
+ const idValue = rest[i + 1];
1107
+ if (!idType || !idValue || !currentSpec?.[idType]?.[idValue]) break;
1108
+ currentSpec = currentSpec[idType][idValue];
1109
+ href += `/${idType}/${idValue}`;
1110
+ const title = (idType === "methods" ? currentSpec.summary : currentSpec.title) ?? idValue;
1111
+ breadcrumbs.push({
1112
+ title,
1113
+ href
1114
+ });
1115
+ i += 2;
1116
+ }
1117
+ return breadcrumbs;
1118
+ }
1119
+ function SDKBreadcrumbs({ spec, currentPath, basePath = "/api", config = { includeCurrentPage: false } }) {
1120
+ const breadcrumbs = generateApiBreadcrumbs(currentPath, spec, basePath);
1121
+ if (!breadcrumbs || breadcrumbs.length === 0) return null;
1122
+ if (!config?.includeCurrentPage && breadcrumbs.length > 1) breadcrumbs.pop();
1123
+ const items = breadcrumbs.map((crumb, index) => /* @__PURE__ */ jsx("div", {
1124
+ className: style_default.BreadcrumbsItem,
1125
+ children: /* @__PURE__ */ jsx("a", {
1126
+ href: crumb.href,
1127
+ className: style_default.BreadcrumbsLink,
1128
+ children: crumb.title
1129
+ })
1130
+ }, index));
1131
+ return /* @__PURE__ */ jsx("div", {
1132
+ className: style_default.Breadcrumbs,
1133
+ children: /* @__PURE__ */ jsx(Join, {
1134
+ limit: breadcrumbs.length,
1135
+ items,
1136
+ children: /* @__PURE__ */ jsx(ChevronRight, {})
1137
+ })
1138
+ });
1139
+ }
1140
+
1141
+ //#endregion
1142
+ //#region src/components/sidebar.tsx
1143
+ function SidebarExpander({ open, summary, children }) {
1144
+ return /* @__PURE__ */ jsxs("details", {
1145
+ className: style_default.SidebarExpander,
1146
+ open,
1147
+ children: [/* @__PURE__ */ jsxs("summary", {
1148
+ className: style_default.ExpanderSummary,
1149
+ children: [/* @__PURE__ */ jsx("div", {
1150
+ className: style_default.ExpanderSummaryContent,
1151
+ children: summary
1152
+ }), /* @__PURE__ */ jsxs("div", {
1153
+ className: style_default.ExpanderSummaryIcon,
1154
+ children: [/* @__PURE__ */ jsx(ChevronRight, {
1155
+ size: 16,
1156
+ strokeWidth: 1,
1157
+ className: style_default.Icon
1158
+ }), /* @__PURE__ */ jsx(ChevronDown, {
1159
+ size: 16,
1160
+ strokeWidth: 1,
1161
+ className: style_default.Icon
1162
+ })]
1163
+ })]
1164
+ }), /* @__PURE__ */ jsx("div", {
1165
+ className: style_default.ExpanderContent,
1166
+ children
1167
+ })]
1168
+ });
1169
+ }
1170
+ function SidebarMethod({ method }) {
1171
+ const Docs = useComponents();
1172
+ const { selectedPath } = useNavigation();
1173
+ return /* @__PURE__ */ jsxs("div", {
1174
+ className: style_default.SidebarMethod,
1175
+ "data-selected": method.stainlessPath === selectedPath,
1176
+ children: [/* @__PURE__ */ jsx(MethodIconBadge, { httpMethod: method.httpMethod }), /* @__PURE__ */ jsx(Docs.Link, {
1177
+ stainlessPath: method.stainlessPath,
1178
+ children: method.summary
1179
+ })]
1180
+ });
1181
+ }
1182
+ function SidebarResource({ resource }) {
1183
+ const Docs = useComponents();
1184
+ const { selectedPath } = useNavigation();
1185
+ const subresources = Object.values(resource.subresources ?? {}).map((sub) => /* @__PURE__ */ jsx(SidebarResource, { resource: sub }, sub.stainlessPath));
1186
+ const methods = Object.values(resource.methods).map((method) => /* @__PURE__ */ jsx(SidebarMethod, { method }, method.stainlessPath));
1187
+ const hasChildren = subresources.length > 0 || methods.length > 0;
1188
+ const title = /* @__PURE__ */ jsx("div", {
1189
+ className: style_default.SidebarResourceTitle,
1190
+ children: /* @__PURE__ */ jsx(Docs.Link, {
1191
+ stainlessPath: resource.stainlessPath,
1192
+ children: resource.title
1193
+ })
1194
+ });
1195
+ return /* @__PURE__ */ jsx("div", {
1196
+ className: style_default.SidebarResource,
1197
+ "data-selected": resource.stainlessPath === selectedPath,
1198
+ children: hasChildren ? /* @__PURE__ */ jsxs(SidebarExpander, {
1199
+ summary: title,
1200
+ open: true,
1201
+ children: [methods, subresources]
1202
+ }) : title
1203
+ });
1204
+ }
1205
+ function Sidebar({ resources }) {
1206
+ return /* @__PURE__ */ jsx("div", {
1207
+ className: `${style_default.Root} ${style_default.Sidebar}`,
1208
+ children: resources.filter((resource) => !isResourceEmpty(resource)).map((resource) => /* @__PURE__ */ jsx(SidebarResource, { resource }, resource.stainlessPath))
1209
+ });
1210
+ }
1211
+
1212
+ //#endregion
1213
+ //#region src/components/index.ts
1214
+ var components_exports = /* @__PURE__ */ __export({
1215
+ Badge: () => Badge,
1216
+ Expander: () => Expander,
1217
+ HttpMethodIcons: () => HttpMethodIcons,
1218
+ HttpMethods: () => HttpMethods,
1219
+ Input: () => Input,
1220
+ Join: () => Join,
1221
+ Link: () => Link,
1222
+ ListView: () => ListView,
1223
+ Markdown: () => Markdown,
1224
+ Method: () => Method,
1225
+ MethodDescription: () => MethodDescription,
1226
+ MethodHeader: () => MethodHeader,
1227
+ MethodIconBadge: () => MethodIconBadge,
1228
+ MethodInfo: () => MethodInfo$1,
1229
+ MethodRoute: () => MethodRoute,
1230
+ Property: () => Property$6,
1231
+ PropertyDescription: () => PropertyDescription,
1232
+ PropertyModelContext: () => PropertyModelContext,
1233
+ PropertyToggle: () => PropertyToggle,
1234
+ ReferenceNestingContext: () => ReferenceNestingContext,
1235
+ SDKBreadcrumbs: () => SDKBreadcrumbs,
1236
+ SDKChildren: () => SDKChildren,
1237
+ SDKConstraints: () => SDKConstraints,
1238
+ SDKDeclaration: () => SDKDeclaration,
1239
+ SDKExample: () => SDKExample,
1240
+ SDKIcon: () => SDKIcon,
1241
+ SDKLanguageBlock: () => SDKLanguageBlock,
1242
+ SDKMethod: () => SDKMethod,
1243
+ SDKMethodHeader: () => SDKMethodHeader,
1244
+ SDKMethodInfo: () => SDKMethodInfo,
1245
+ SDKMethodSummary: () => SDKMethodSummary,
1246
+ SDKModel: () => SDKModel,
1247
+ SDKOverview: () => SDKOverview,
1248
+ SDKReference: () => SDKReference,
1249
+ SDKRequestTitle: () => SDKRequestTitle,
1250
+ SDKResource: () => SDKResource,
1251
+ SDKResourceHeader: () => SDKResourceHeader,
1252
+ SDKRoot: () => SDKRoot,
1253
+ SDKSnippetLanguages: () => SDKSnippetLanguages,
1254
+ Sidebar: () => Sidebar,
1255
+ SidebarExpander: () => SidebarExpander,
1256
+ SidebarMethod: () => SidebarMethod,
1257
+ SidebarResource: () => SidebarResource,
1258
+ Snippet: () => Snippet,
1259
+ SnippetCode: () => SnippetCode,
1260
+ SnippetContainer: () => SnippetContainer,
1261
+ SnippetRequestContainer: () => SnippetRequestContainer,
1262
+ SnippetResponse: () => SnippetResponse,
1263
+ ToggleButton: () => ToggleButton,
1264
+ Tooltip: () => Tooltip,
1265
+ VirtualExpander: () => VirtualExpander,
1266
+ usePropertyModel: () => usePropertyModel,
1267
+ useReferenceNesting: () => useReferenceNesting
1268
+ });
1269
+
1270
+ //#endregion
1271
+ //#region src/languages/typescript.tsx
1272
+ var typescript_exports = /* @__PURE__ */ __export({
1273
+ Declaration: () => Declaration$5,
1274
+ MethodSignature: () => MethodSignature$5,
1275
+ Property: () => Property$5,
1276
+ Type: () => Type$5,
1277
+ TypeName: () => TypeName$5
1278
+ });
1279
+ const ComplexTypes$3 = {
1280
+ TSTypeObject: "object",
1281
+ TSTypeUnion: "union",
1282
+ TSTypeInterface: "interface",
1283
+ TSTypeIntersection: "intersection",
1284
+ TSTypeArray: "array"
1285
+ };
1286
+ const constStyle$3 = {
1287
+ string: style_default.LiteralString,
1288
+ number: style_default.LiteralNumeric,
1289
+ boolean: style_default.LiteralBoolean
1290
+ };
1291
+ function Identifier$1({ name, optional }) {
1292
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
1293
+ className: style_default.TextIdentifier,
1294
+ children: /^[_a-zA-Z][_a-zA-Z0-9]*$/.test(name) ? name : JSON.stringify(name)
1295
+ }), optional && /* @__PURE__ */ jsx("span", {
1296
+ className: style_default.TextPunctuation,
1297
+ children: "?"
1298
+ })] });
1299
+ }
1300
+ function TypeParams({ params }) {
1301
+ const Lang = useLanguageComponents();
1302
+ const { Join: Join$1 } = useComponents();
1303
+ if (!params?.length) return null;
1304
+ const typeParams = params?.map((param, key) => param.constraint ? /* @__PURE__ */ jsxs(React$1.Fragment, { children: [
1305
+ /* @__PURE__ */ jsx("span", {
1306
+ className: style_default.TypeReference,
1307
+ children: param.name
1308
+ }),
1309
+ /* @__PURE__ */ jsx("span", {
1310
+ className: style_default.TextKeyword,
1311
+ children: "extends "
1312
+ }),
1313
+ /* @__PURE__ */ jsx(Lang.Type, { type: param.constraint })
1314
+ ] }, key) : /* @__PURE__ */ jsx(React$1.Fragment, { children: "param.name" }, key));
1315
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1316
+ /* @__PURE__ */ jsx("span", {
1317
+ className: style_default.TypeBracket,
1318
+ children: "<"
1319
+ }),
1320
+ /* @__PURE__ */ jsx(Join$1, {
1321
+ items: typeParams,
1322
+ limit: 3,
1323
+ children: /* @__PURE__ */ jsx("span", {
1324
+ className: style_default.TextOperator,
1325
+ children: ", "
1326
+ })
1327
+ }),
1328
+ /* @__PURE__ */ jsx("span", {
1329
+ className: style_default.TypeBracket,
1330
+ children: ">"
1331
+ })
1332
+ ] });
1333
+ }
1334
+ function TypePreview$2({ path }) {
1335
+ const spec = useSpec();
1336
+ const language = useLanguage();
1337
+ const decl = useDeclaration(path, false);
1338
+ const { Join: Join$1 } = useComponents();
1339
+ if (!(decl && "children" in decl && decl.children && decl.children.length > 0) || decl && "type" in decl && "kind" in decl["type"] && decl["type"]["kind"] === "TSTypeUnion") return;
1340
+ const items = decl.children.map((prop, key) => {
1341
+ const p = spec?.decls?.[language]?.[prop];
1342
+ return /* @__PURE__ */ jsx("span", {
1343
+ className: style_default.TypePropertyName,
1344
+ children: /* @__PURE__ */ jsx("span", {
1345
+ className: style_default.TextIdentifier,
1346
+ children: p && "key" in p ? p["key"] : null
1347
+ })
1348
+ }, key);
1349
+ });
1350
+ return /* @__PURE__ */ jsxs("span", {
1351
+ className: style_default.TypePreview,
1352
+ "data-stldocs-type-preview": "properties",
1353
+ children: [
1354
+ /* @__PURE__ */ jsx("span", {
1355
+ className: style_default.TypeBrace,
1356
+ children: " {"
1357
+ }),
1358
+ /* @__PURE__ */ jsxs("span", {
1359
+ className: style_default.TypePreviewContent,
1360
+ children: [
1361
+ " ",
1362
+ /* @__PURE__ */ jsx(Join$1, {
1363
+ items,
1364
+ limit: 3,
1365
+ children: /* @__PURE__ */ jsx("span", {
1366
+ className: style_default.TextOperator,
1367
+ children: ", "
1368
+ })
1369
+ }),
1370
+ " "
1371
+ ]
1372
+ }),
1373
+ /* @__PURE__ */ jsx("span", {
1374
+ className: style_default.TypeBrace,
1375
+ children: "} "
1376
+ })
1377
+ ]
1378
+ });
1379
+ }
1380
+ function TypeName$5({ type }) {
1381
+ const Lang = useLanguageComponents();
1382
+ return ComplexTypes$3[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
1383
+ }
1384
+ function Type$5({ type }) {
1385
+ const Lang = useLanguageComponents();
1386
+ const { Join: Join$1, SDKReference: SDKReference$1 } = useComponents();
1387
+ switch (type.kind) {
1388
+ case "TSTypeUnknown":
1389
+ case "TSTypeUndefined":
1390
+ case "TSTypeNever":
1391
+ case "TSTypeVoid":
1392
+ case "TSTypeNull":
1393
+ case "TSTypeAny":
1394
+ case "TSTypeBoolean":
1395
+ case "TSTypeNumber": return /* @__PURE__ */ jsx("span", {
1396
+ className: style_default.Type,
1397
+ children: /* @__PURE__ */ jsx("span", {
1398
+ className: style_default.TypeKeyword,
1399
+ children: type.kind.slice(6).toLowerCase()
1400
+ })
1401
+ });
1402
+ case "TSTypeString": return /* @__PURE__ */ jsx("span", {
1403
+ className: style_default.Type,
1404
+ children: /* @__PURE__ */ jsx("span", {
1405
+ className: style_default.TypeString,
1406
+ children: "string"
1407
+ })
1408
+ });
1409
+ case "TSTypeLiteral": return /* @__PURE__ */ jsx("span", {
1410
+ className: style_default.Type,
1411
+ children: /* @__PURE__ */ jsx("span", {
1412
+ className: constStyle$3[typeof type.literal],
1413
+ children: JSON.stringify(type.literal)
1414
+ })
1415
+ });
1416
+ case "TSTypeArray": return /* @__PURE__ */ jsxs("span", {
1417
+ className: style_default.Type,
1418
+ children: [
1419
+ /* @__PURE__ */ jsx("span", {
1420
+ className: style_default.TypeArray,
1421
+ children: "Array<"
1422
+ }),
1423
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType }),
1424
+ /* @__PURE__ */ jsx("span", {
1425
+ className: style_default.TypeArray,
1426
+ children: ">"
1427
+ })
1428
+ ]
1429
+ });
1430
+ case "TSTypeReference": {
1431
+ const name = type.ident.split(".").at(-1);
1432
+ const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
1433
+ return /* @__PURE__ */ jsxs("span", {
1434
+ className: style_default.Type,
1435
+ children: [
1436
+ /* @__PURE__ */ jsx(SDKReference$1, {
1437
+ stainlessPath: type.$ref,
1438
+ children: name
1439
+ }),
1440
+ params && params.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
1441
+ /* @__PURE__ */ jsx("span", {
1442
+ className: style_default.TypeBracket,
1443
+ children: "<"
1444
+ }),
1445
+ /* @__PURE__ */ jsx(Join$1, {
1446
+ items: params,
1447
+ limit: 3,
1448
+ children: /* @__PURE__ */ jsx("span", {
1449
+ className: style_default.TextOperator,
1450
+ children: ", "
1451
+ })
1452
+ }),
1453
+ /* @__PURE__ */ jsx("span", {
1454
+ className: style_default.TypeBracket,
1455
+ children: ">"
1456
+ })
1457
+ ] }),
1458
+ /* @__PURE__ */ jsx(TypePreview$2, { path: type.$ref })
1459
+ ]
1460
+ });
1461
+ }
1462
+ case "TSTypeIntersection":
1463
+ case "TSTypeUnion": {
1464
+ const items = type.types.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
1465
+ const delimiter = type.kind === "TSTypeUnion" ? "|" : "&";
1466
+ return /* @__PURE__ */ jsx("span", {
1467
+ className: style_default.Type,
1468
+ children: /* @__PURE__ */ jsx("span", {
1469
+ className: style_default.TypePreview,
1470
+ "data-stldocs-type-preview": "union",
1471
+ children: /* @__PURE__ */ jsx("span", {
1472
+ className: style_default.TypePreviewContent,
1473
+ children: /* @__PURE__ */ jsx(Join$1, {
1474
+ items,
1475
+ limit: 3,
1476
+ children: /* @__PURE__ */ jsxs("span", {
1477
+ className: style_default.TextOperator,
1478
+ children: [
1479
+ " ",
1480
+ delimiter,
1481
+ " "
1482
+ ]
1483
+ })
1484
+ })
1485
+ })
1486
+ })
1487
+ });
1488
+ }
1489
+ case "TSTypeObject":
1490
+ case "TSTypeInterface": {
1491
+ const extend = type.kind === "TSTypeObject" ? null : type.extends?.map((ref, key) => /* @__PURE__ */ jsx(Lang.Type, { type: ref }, key));
1492
+ const items = type.members.map((prop, key) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [
1493
+ /* @__PURE__ */ jsx("span", {
1494
+ className: style_default.TypePropertyName,
1495
+ children: /* @__PURE__ */ jsx(Identifier$1, {
1496
+ name: prop.ident,
1497
+ optional: prop.optional
1498
+ })
1499
+ }),
1500
+ /* @__PURE__ */ jsx("span", {
1501
+ className: style_default.TextPunctuation,
1502
+ children: ": "
1503
+ }),
1504
+ /* @__PURE__ */ jsx(Lang.Type, { type: prop.type })
1505
+ ] }, key));
1506
+ return /* @__PURE__ */ jsxs("span", {
1507
+ className: style_default.Type,
1508
+ children: [extend?.length && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
1509
+ className: style_default.TypeKeyword,
1510
+ children: " extends "
1511
+ }), /* @__PURE__ */ jsx(Join$1, {
1512
+ items: extend,
1513
+ limit: 3,
1514
+ children: /* @__PURE__ */ jsx("span", {
1515
+ className: style_default.TextOperator,
1516
+ children: ", "
1517
+ })
1518
+ })] }), /* @__PURE__ */ jsxs("span", {
1519
+ className: style_default.TypePreview,
1520
+ "data-stldocs-type-preview": "properties",
1521
+ children: [
1522
+ /* @__PURE__ */ jsx("span", {
1523
+ className: style_default.TypeBrace,
1524
+ children: "{ "
1525
+ }),
1526
+ /* @__PURE__ */ jsx("span", {
1527
+ className: style_default.TypePreviewContent,
1528
+ children: /* @__PURE__ */ jsx(Join$1, {
1529
+ items,
1530
+ limit: 3,
1531
+ children: /* @__PURE__ */ jsx("span", {
1532
+ className: style_default.TextOperator,
1533
+ children: ", "
1534
+ })
1535
+ })
1536
+ }),
1537
+ /* @__PURE__ */ jsx("span", {
1538
+ className: style_default.TypeBrace,
1539
+ children: "} "
1540
+ })
1541
+ ]
1542
+ })]
1543
+ });
1544
+ }
1545
+ }
1546
+ }
1547
+ function MethodSignature$5({ decl }) {
1548
+ const Lang = useLanguageComponents();
1549
+ const { Join: Join$1, Tooltip: Tooltip$1 } = useComponents();
1550
+ const params = decl.signature.parameters.map((param, i) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx(Tooltip$1, {
1551
+ content: /* @__PURE__ */ jsx(Lang.Type, { type: param.type }),
1552
+ children: /* @__PURE__ */ jsx("span", {
1553
+ className: style_default.TextIdentifier,
1554
+ children: param.ident
1555
+ })
1556
+ }), param.optional && /* @__PURE__ */ jsx("span", {
1557
+ className: style_default.TextPunctuation,
1558
+ children: "?"
1559
+ })] }, i));
1560
+ return /* @__PURE__ */ jsx("div", {
1561
+ className: style_default.MethodSignature,
1562
+ children: /* @__PURE__ */ jsxs("span", {
1563
+ className: style_default.SignatureTitle,
1564
+ children: [
1565
+ decl.signature.async && /* @__PURE__ */ jsx("span", {
1566
+ className: style_default.TextKeyword,
1567
+ children: "async "
1568
+ }),
1569
+ /* @__PURE__ */ jsx("span", {
1570
+ className: style_default.SignatureQualified,
1571
+ children: /* @__PURE__ */ jsx("span", {
1572
+ className: style_default.TextIdentifier,
1573
+ children: decl.qualified?.slice(0, -decl.ident.length)
1574
+ })
1575
+ }),
1576
+ /* @__PURE__ */ jsx("span", {
1577
+ className: style_default.SignatureName,
1578
+ children: /* @__PURE__ */ jsx("span", {
1579
+ className: style_default.TextIdentifier,
1580
+ children: decl.ident
1581
+ })
1582
+ }),
1583
+ /* @__PURE__ */ jsxs("span", {
1584
+ className: style_default.MethodSignature,
1585
+ children: [
1586
+ decl.signature.typeParameters && /* @__PURE__ */ jsx(TypeParams, { params: decl.signature.typeParameters }),
1587
+ /* @__PURE__ */ jsx("span", {
1588
+ className: style_default.SignatureParen,
1589
+ children: "("
1590
+ }),
1591
+ /* @__PURE__ */ jsx("span", {
1592
+ className: style_default.SignatureParams,
1593
+ children: /* @__PURE__ */ jsx(Join$1, {
1594
+ items: params,
1595
+ children: /* @__PURE__ */ jsx("span", {
1596
+ className: style_default.TextOperator,
1597
+ children: ", "
1598
+ })
1599
+ })
1600
+ }),
1601
+ /* @__PURE__ */ jsx("span", {
1602
+ className: style_default.SignatureParen,
1603
+ children: ")"
1604
+ }),
1605
+ decl.signature.returns && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
1606
+ className: style_default.TextPunctuation,
1607
+ children: ": "
1608
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: decl.signature.returns })] })
1609
+ ]
1610
+ })
1611
+ ]
1612
+ })
1613
+ });
1614
+ }
1615
+ function Property$5({ decl, children }) {
1616
+ const Lang = useLanguageComponents();
1617
+ if (!decl) return;
1618
+ switch (decl.kind) {
1619
+ case "TSDeclProperty": return children({
1620
+ name: decl.key,
1621
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
1622
+ type: decl.type.kind in ComplexTypes$3 && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
1623
+ });
1624
+ case "TSDeclTypeAlias": return children({
1625
+ name: decl.ident,
1626
+ typeName: "alias",
1627
+ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
1628
+ });
1629
+ case "TSDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
1630
+ case "TSDeclInterface": return children({ type: /* @__PURE__ */ jsxs(Fragment$1, { children: [
1631
+ /* @__PURE__ */ jsx("span", {
1632
+ className: style_default.TextIdentifier,
1633
+ children: decl.ident
1634
+ }),
1635
+ decl.typeParameters && /* @__PURE__ */ jsx(TypeParams, { params: decl.typeParameters }),
1636
+ decl.extends?.flatMap((t, key) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx("span", {
1637
+ className: style_default.TextKeyword,
1638
+ children: " extends "
1639
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: t })] }, `extends:${key}`))
1640
+ ] }) });
1641
+ }
1642
+ }
1643
+ function Declaration$5({ decl }) {
1644
+ const Lang = useLanguageComponents();
1645
+ if (!decl) return;
1646
+ switch (decl.kind) {
1647
+ case "TSDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1648
+ decl.declare && /* @__PURE__ */ jsx("span", {
1649
+ className: style_default.TextKeyword,
1650
+ children: "declare "
1651
+ }),
1652
+ /* @__PURE__ */ jsx("span", {
1653
+ className: style_default.TypePropertyName,
1654
+ children: /* @__PURE__ */ jsx(Identifier$1, {
1655
+ name: decl.key,
1656
+ optional: decl.optional
1657
+ })
1658
+ }),
1659
+ /* @__PURE__ */ jsx("span", {
1660
+ className: style_default.TextPunctuation,
1661
+ children: ": "
1662
+ }),
1663
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
1664
+ ] });
1665
+ case "TSDeclFunction": return /* @__PURE__ */ jsx(Lang.MethodSignature, { decl });
1666
+ case "TSDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1667
+ /* @__PURE__ */ jsx(Identifier$1, { name: decl.ident }),
1668
+ /* @__PURE__ */ jsx(TypeParams, { params: decl.typeParameters }),
1669
+ /* @__PURE__ */ jsx("span", {
1670
+ className: style_default.TextOperator,
1671
+ children: " = "
1672
+ }),
1673
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
1674
+ ] });
1675
+ case "TSDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
1676
+ case "TSDeclInterface": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1677
+ /* @__PURE__ */ jsx("span", {
1678
+ className: style_default.TextIdentifier,
1679
+ children: decl.ident
1680
+ }),
1681
+ /* @__PURE__ */ jsx(TypeParams, { params: decl.typeParameters }),
1682
+ decl.extends?.map((t, index) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx("span", {
1683
+ className: style_default.TextKeyword,
1684
+ children: " extends "
1685
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: t })] }, index)),
1686
+ /* @__PURE__ */ jsx(TypePreview$2, { path: decl.stainlessPath })
1687
+ ] });
1688
+ case "TSDeclClass": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1689
+ /* @__PURE__ */ jsx("span", {
1690
+ className: style_default.TextKeyword,
1691
+ children: "class "
1692
+ }),
1693
+ /* @__PURE__ */ jsx("span", {
1694
+ className: style_default.TextIdentifier,
1695
+ children: decl.ident
1696
+ }),
1697
+ /* @__PURE__ */ jsx(TypeParams, { params: decl.typeParameters }),
1698
+ decl.superClass ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
1699
+ className: style_default.TextKeyword,
1700
+ children: " extends "
1701
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: decl.superClass })] }) : null,
1702
+ decl.implements?.map((t, index) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx("span", {
1703
+ className: style_default.TextKeyword,
1704
+ children: " implements "
1705
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: t })] }, index))
1706
+ ] });
1707
+ }
1708
+ }
1709
+
1710
+ //#endregion
1711
+ //#region src/languages/java.tsx
1712
+ var java_exports = /* @__PURE__ */ __export({
1713
+ Declaration: () => Declaration$4,
1714
+ MethodSignature: () => MethodSignature$4,
1715
+ Property: () => Property$4,
1716
+ Type: () => Type$4,
1717
+ TypeName: () => TypeName$4
1718
+ });
1719
+ function showFullType$1(type) {
1720
+ return type.kind === "JavaTypeReference" && (type.typeName === "List" || type.typeParameters && type.typeParameters.length > 0);
1721
+ }
1722
+ const constStyle$2 = {
1723
+ string: style_default.LiteralString,
1724
+ number: style_default.LiteralNumeric,
1725
+ boolean: style_default.LiteralBoolean
1726
+ };
1727
+ function TypeName$4({ type, optional }) {
1728
+ const Lang = useLanguageComponents();
1729
+ if (type.kind === "JavaTypeReference" && type.typeName === "List") return "List";
1730
+ return /* @__PURE__ */ jsx(Lang.Type, {
1731
+ type,
1732
+ optional
1733
+ });
1734
+ }
1735
+ function Type$4({ type, optional }) {
1736
+ const language = useLanguage();
1737
+ const Lang = useLanguageComponents();
1738
+ const { Join: Join$1, SDKReference: SDKReference$1 } = useComponents();
1739
+ switch (type.kind) {
1740
+ case "JavaTypeReference": {
1741
+ const name = type.typeName.split(".").at(-1);
1742
+ const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, {
1743
+ type: param,
1744
+ optional
1745
+ }, key));
1746
+ return /* @__PURE__ */ jsxs("span", {
1747
+ className: style_default.Type,
1748
+ children: [/* @__PURE__ */ jsx(SDKReference$1, {
1749
+ stainlessPath: type.$ref,
1750
+ children: name
1751
+ }), params && params.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
1752
+ /* @__PURE__ */ jsx("span", {
1753
+ className: style_default.TypeBracket,
1754
+ children: "<"
1755
+ }),
1756
+ /* @__PURE__ */ jsx(Join$1, {
1757
+ items: params,
1758
+ limit: 3,
1759
+ children: /* @__PURE__ */ jsx("span", {
1760
+ className: style_default.TextOperator,
1761
+ children: ", "
1762
+ })
1763
+ }),
1764
+ /* @__PURE__ */ jsx("span", {
1765
+ className: style_default.TypeBracket,
1766
+ children: ">"
1767
+ })
1768
+ ] }) : null]
1769
+ });
1770
+ }
1771
+ case "JavaTypeClass":
1772
+ case "JavaTypeUnion": return /* @__PURE__ */ jsx("span", {
1773
+ className: style_default.Type,
1774
+ children: /* @__PURE__ */ jsx("span", {
1775
+ className: style_default.TypeKeyword,
1776
+ children: "class"
1777
+ })
1778
+ });
1779
+ case "JavaTypeEnum": return /* @__PURE__ */ jsx("span", {
1780
+ className: style_default.Type,
1781
+ children: /* @__PURE__ */ jsx("span", {
1782
+ className: style_default.TypeKeyword,
1783
+ children: language === "kotlin" ? "enum class" : "enum"
1784
+ })
1785
+ });
1786
+ case "JavaTypeVoid": return /* @__PURE__ */ jsx("span", {
1787
+ className: style_default.Type,
1788
+ children: /* @__PURE__ */ jsx("span", {
1789
+ className: style_default.TypeKeyword,
1790
+ children: language === "kotlin" ? "Nothing?" : "Void"
1791
+ })
1792
+ });
1793
+ case "JavaTypeBoolean": return /* @__PURE__ */ jsx("span", {
1794
+ className: style_default.Type,
1795
+ children: /* @__PURE__ */ jsx("span", {
1796
+ className: style_default.TypeKeyword,
1797
+ children: language === "kotlin" || optional ? "Boolean" : "boolean"
1798
+ })
1799
+ });
1800
+ case "JavaTypeDouble": return /* @__PURE__ */ jsx("span", {
1801
+ className: style_default.Type,
1802
+ children: /* @__PURE__ */ jsx("span", {
1803
+ className: style_default.TypeKeyword,
1804
+ children: language === "kotlin" || optional ? "Double" : "double"
1805
+ })
1806
+ });
1807
+ case "JavaTypeLong": return /* @__PURE__ */ jsx("span", {
1808
+ className: style_default.Type,
1809
+ children: /* @__PURE__ */ jsx("span", {
1810
+ className: style_default.TypeKeyword,
1811
+ children: language === "kotlin" || optional ? "Long" : "long"
1812
+ })
1813
+ });
1814
+ case "JavaTypeString": return /* @__PURE__ */ jsx("span", {
1815
+ className: style_default.Type,
1816
+ children: /* @__PURE__ */ jsx("span", {
1817
+ className: style_default.TypeString,
1818
+ children: "String"
1819
+ })
1820
+ });
1821
+ case "JavaTypeConstant": return /* @__PURE__ */ jsxs("span", {
1822
+ className: style_default.Type,
1823
+ children: [/* @__PURE__ */ jsx("span", {
1824
+ className: style_default.TypeKeyword,
1825
+ children: "JsonValue"
1826
+ }), ";"]
1827
+ });
1828
+ }
1829
+ }
1830
+ function MethodSignature$4({ decl }) {
1831
+ const Lang = useLanguageComponents();
1832
+ const language = useLanguage();
1833
+ const { Join: Join$1, Tooltip: Tooltip$1 } = useComponents();
1834
+ const params = decl.parameters.map((param, i) => /* @__PURE__ */ jsx(React$1.Fragment, { children: /* @__PURE__ */ jsxs(Tooltip$1, {
1835
+ content: /* @__PURE__ */ jsx(Lang.Type, { type: param.typeAnnotation }),
1836
+ children: [/* @__PURE__ */ jsx("span", {
1837
+ className: style_default.TextIdentifier,
1838
+ children: param.ident
1839
+ }), param.hasDefault && /* @__PURE__ */ jsxs(Fragment$1, { children: [
1840
+ " ",
1841
+ /* @__PURE__ */ jsx("span", {
1842
+ className: style_default.TextOperator,
1843
+ children: "="
1844
+ }),
1845
+ " ",
1846
+ /* @__PURE__ */ jsx(Lang.Type, { type: param.typeAnnotation }),
1847
+ /* @__PURE__ */ jsx("span", {
1848
+ className: style_default.TextOperator,
1849
+ children: "."
1850
+ }),
1851
+ /* @__PURE__ */ jsx("span", {
1852
+ className: style_default.TextIdentifier,
1853
+ children: "none"
1854
+ }),
1855
+ /* @__PURE__ */ jsx("span", {
1856
+ className: style_default.TextOperator,
1857
+ children: "()"
1858
+ })
1859
+ ] })]
1860
+ }) }, i));
1861
+ return /* @__PURE__ */ jsx("div", {
1862
+ className: style_default.MethodSignature,
1863
+ children: /* @__PURE__ */ jsxs("span", {
1864
+ className: style_default.SignatureTitle,
1865
+ children: [
1866
+ decl.returnType && language !== "kotlin" && /* @__PURE__ */ jsxs("span", {
1867
+ className: style_default.SignatureReturns,
1868
+ children: [/* @__PURE__ */ jsx(Lang.Type, { type: decl.returnType }), " "]
1869
+ }),
1870
+ decl.qualified && /* @__PURE__ */ jsx("span", {
1871
+ className: style_default.SignatureQualified,
1872
+ children: /* @__PURE__ */ jsx("span", {
1873
+ className: style_default.TextIdentifier,
1874
+ children: decl.qualified?.slice(0, -decl.ident.length)
1875
+ })
1876
+ }),
1877
+ /* @__PURE__ */ jsx("span", {
1878
+ className: style_default.SignatureName,
1879
+ children: /* @__PURE__ */ jsx("span", {
1880
+ className: style_default.TextIdentifier,
1881
+ children: decl.ident
1882
+ })
1883
+ }),
1884
+ /* @__PURE__ */ jsxs("span", {
1885
+ className: style_default.MethodSignature,
1886
+ children: [
1887
+ /* @__PURE__ */ jsx("span", {
1888
+ className: style_default.SignatureParen,
1889
+ children: "("
1890
+ }),
1891
+ /* @__PURE__ */ jsx("span", {
1892
+ className: style_default.SignatureParams,
1893
+ children: /* @__PURE__ */ jsx(Join$1, {
1894
+ items: params,
1895
+ children: /* @__PURE__ */ jsx("span", {
1896
+ className: style_default.TextOperator,
1897
+ children: ", "
1898
+ })
1899
+ })
1900
+ }),
1901
+ /* @__PURE__ */ jsxs("span", {
1902
+ className: style_default.SignatureParen,
1903
+ children: [")", " "]
1904
+ }),
1905
+ decl.returnType && language === "kotlin" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
1906
+ /* @__PURE__ */ jsx("span", {
1907
+ className: style_default.TextOperator,
1908
+ children: ":"
1909
+ }),
1910
+ " ",
1911
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.returnType })
1912
+ ] })
1913
+ ]
1914
+ })
1915
+ ]
1916
+ })
1917
+ });
1918
+ }
1919
+ function Property$4({ decl, children }) {
1920
+ const Docs = useComponents();
1921
+ const Lang = useLanguageComponents();
1922
+ const language = useLanguage();
1923
+ if (!decl) return null;
1924
+ switch (decl.kind) {
1925
+ case "JavaDeclProperty": {
1926
+ const typeRaw = /* @__PURE__ */ jsx(Lang.Type, {
1927
+ type: decl.type,
1928
+ optional: decl.optional
1929
+ });
1930
+ const typeWrapped = decl.optional ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
1931
+ /* @__PURE__ */ jsx("span", {
1932
+ className: style_default.TypeKeyword,
1933
+ children: "Optional"
1934
+ }),
1935
+ /* @__PURE__ */ jsx("span", {
1936
+ className: style_default.TypeBracket,
1937
+ children: "<"
1938
+ }),
1939
+ typeRaw,
1940
+ /* @__PURE__ */ jsx("span", {
1941
+ className: style_default.TypeBracket,
1942
+ children: ">"
1943
+ })
1944
+ ] }) : typeRaw;
1945
+ const badges = /* @__PURE__ */ jsx(Fragment$1, { children: decl.type.kind === "JavaTypeConstant" && /* @__PURE__ */ jsx(Docs.Tooltip, {
1946
+ content: /* @__PURE__ */ jsx("span", {
1947
+ className: style_default.TextIdentifier,
1948
+ children: decl.type.value
1949
+ }),
1950
+ children: /* @__PURE__ */ jsx("span", {
1951
+ className: style_default.TextIdentifier,
1952
+ children: "constant"
1953
+ })
1954
+ }) });
1955
+ return children({
1956
+ name: decl.ident,
1957
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, {
1958
+ type: decl.type,
1959
+ optional: decl.optional
1960
+ }),
1961
+ type: showFullType$1(decl.type) && typeWrapped,
1962
+ badges
1963
+ });
1964
+ }
1965
+ case "JavaDeclConst": return children({
1966
+ name: decl.ident,
1967
+ typeName: "const",
1968
+ type: /* @__PURE__ */ jsx("span", {
1969
+ className: constStyle$2[typeof decl.value],
1970
+ children: JSON.stringify(decl.value)
1971
+ })
1972
+ });
1973
+ case "JavaDeclType": {
1974
+ const typeName$1 = decl.type.kind === "JavaTypeUnion" ? "union" : decl.type.kind === "JavaTypeEnum" ? language === "kotlin" ? "enum class" : "enum" : "class";
1975
+ return children({
1976
+ name: decl.ident,
1977
+ typeName: typeName$1
1978
+ });
1979
+ }
1980
+ case "JavaDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
1981
+ }
1982
+ }
1983
+ function Declaration$4({ decl }) {
1984
+ const Docs = useComponents();
1985
+ const Lang = useLanguageComponents();
1986
+ const language = useLanguage();
1987
+ if (!decl) return null;
1988
+ switch (decl.kind) {
1989
+ case "JavaDeclConst": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1990
+ /* @__PURE__ */ jsx("span", {
1991
+ className: style_default.TextIdentifier,
1992
+ children: decl.ident
1993
+ }),
1994
+ /* @__PURE__ */ jsx("span", {
1995
+ className: style_default.TextPunctuation,
1996
+ children: "("
1997
+ }),
1998
+ JSON.stringify(decl.value),
1999
+ /* @__PURE__ */ jsx("span", {
2000
+ className: style_default.TextPunctuation,
2001
+ children: ")"
2002
+ })
2003
+ ] });
2004
+ case "JavaDeclType": {
2005
+ const keyword = decl.type.kind === "JavaTypeEnum" ? language === "kotlin" ? "enum class" : "enum" : "class";
2006
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2007
+ /* @__PURE__ */ jsx("span", {
2008
+ className: style_default.TextKeyword,
2009
+ children: keyword
2010
+ }),
2011
+ " ",
2012
+ /* @__PURE__ */ jsx("span", {
2013
+ className: style_default.TextIdentifier,
2014
+ children: decl.ident
2015
+ }),
2016
+ /* @__PURE__ */ jsx("span", {
2017
+ className: style_default.TextPunctuation,
2018
+ children: ":"
2019
+ }),
2020
+ decl.type.kind === "JavaTypeUnion" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
2021
+ " ",
2022
+ /* @__PURE__ */ jsx(Docs.Tooltip, {
2023
+ content: "A class that can be one of several variants.",
2024
+ children: /* @__PURE__ */ jsx(Docs.Badge, {
2025
+ id: "java-union",
2026
+ children: "union"
2027
+ })
2028
+ }),
2029
+ " "
2030
+ ] })
2031
+ ] });
2032
+ }
2033
+ case "JavaDeclProperty": {
2034
+ const inlineType = /* @__PURE__ */ jsx(Lang.Type, {
2035
+ type: decl.type,
2036
+ optional: decl.optional
2037
+ });
2038
+ const ident = /* @__PURE__ */ jsx("span", {
2039
+ className: style_default.TypePropertyName,
2040
+ children: /* @__PURE__ */ jsx("span", {
2041
+ className: style_default.TextIdentifier,
2042
+ children: decl.ident
2043
+ })
2044
+ });
2045
+ const suffix = decl.type.kind === "JavaTypeConstant" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [" ", /* @__PURE__ */ jsx(Docs.Tooltip, {
2046
+ content: /* @__PURE__ */ jsx("span", {
2047
+ className: style_default.TextIdentifier,
2048
+ children: decl.type.value
2049
+ }),
2050
+ children: /* @__PURE__ */ jsx(Docs.Badge, {
2051
+ id: "java-constant",
2052
+ children: "constant"
2053
+ })
2054
+ })] }) : null;
2055
+ if (language === "kotlin") return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2056
+ ident,
2057
+ /* @__PURE__ */ jsx("span", {
2058
+ className: style_default.TextPunctuation,
2059
+ children: ":"
2060
+ }),
2061
+ " ",
2062
+ decl.optional ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
2063
+ /* @__PURE__ */ jsx("span", {
2064
+ className: style_default.TypeReference,
2065
+ children: "Optional"
2066
+ }),
2067
+ /* @__PURE__ */ jsx("span", {
2068
+ className: style_default.TypeBracket,
2069
+ children: "<"
2070
+ }),
2071
+ inlineType,
2072
+ /* @__PURE__ */ jsx("span", {
2073
+ className: style_default.TypeBracket,
2074
+ children: ">"
2075
+ })
2076
+ ] }) : inlineType,
2077
+ suffix
2078
+ ] });
2079
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2080
+ decl.optional ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
2081
+ /* @__PURE__ */ jsx("span", {
2082
+ className: style_default.TypeReference,
2083
+ children: "Optional"
2084
+ }),
2085
+ /* @__PURE__ */ jsx("span", {
2086
+ className: style_default.TypeBracket,
2087
+ children: "<"
2088
+ }),
2089
+ inlineType,
2090
+ /* @__PURE__ */ jsx("span", {
2091
+ className: style_default.TypeBracket,
2092
+ children: ">"
2093
+ })
2094
+ ] }) : inlineType,
2095
+ " ",
2096
+ ident,
2097
+ suffix
2098
+ ] });
2099
+ }
2100
+ case "JavaDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
2101
+ }
2102
+ }
2103
+
2104
+ //#endregion
2105
+ //#region src/languages/go.tsx
2106
+ var go_exports = /* @__PURE__ */ __export({
2107
+ Declaration: () => Declaration$3,
2108
+ MethodSignature: () => MethodSignature$3,
2109
+ Property: () => Property$3,
2110
+ Type: () => Type$3,
2111
+ TypeName: () => TypeName$3
2112
+ });
2113
+ const ComplexTypes$2 = {
2114
+ GoTypeMap: "map",
2115
+ GoTypeArray: "array"
2116
+ };
2117
+ const Keywords$1 = {
2118
+ GoTypeAny: "any",
2119
+ GoTypeUnknown: "unknown",
2120
+ GoTypeInt: "int64",
2121
+ GoTypeFloat: "float64",
2122
+ GoTypeBool: "bool",
2123
+ GoTypeError: "error"
2124
+ };
2125
+ function isField(type) {
2126
+ return type.kind === "GoTypeReference" && type.typeName === "param.Field";
2127
+ }
2128
+ function TypeName$3({ type }) {
2129
+ const Lang = useLanguageComponents();
2130
+ return isField(type) ? "field" : ComplexTypes$2[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
2131
+ }
2132
+ function Type$3({ type }) {
2133
+ const Lang = useLanguageComponents();
2134
+ const { Join: Join$1, SDKReference: SDKReference$1 } = useComponents();
2135
+ switch (type.kind) {
2136
+ case "GoTypeReference": {
2137
+ const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
2138
+ return /* @__PURE__ */ jsxs("span", {
2139
+ className: style_default.Type,
2140
+ children: [type.$ref ? /* @__PURE__ */ jsx(SDKReference$1, {
2141
+ stainlessPath: type.$ref,
2142
+ children: type.typeName
2143
+ }) : type.typeName, params && params.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
2144
+ /* @__PURE__ */ jsx("span", {
2145
+ className: style_default.TypeBracket,
2146
+ children: "["
2147
+ }),
2148
+ /* @__PURE__ */ jsx(Join$1, {
2149
+ items: params,
2150
+ limit: 3,
2151
+ children: /* @__PURE__ */ jsx("span", {
2152
+ className: style_default.TextOperator,
2153
+ children: ", "
2154
+ })
2155
+ }),
2156
+ /* @__PURE__ */ jsx("span", {
2157
+ className: style_default.TypeBracket,
2158
+ children: "]"
2159
+ })
2160
+ ] }) : null]
2161
+ });
2162
+ }
2163
+ case "GoTypeAny":
2164
+ case "GoTypeUnknown":
2165
+ case "GoTypeInt":
2166
+ case "GoTypeFloat":
2167
+ case "GoTypeBool":
2168
+ case "GoTypeError": return /* @__PURE__ */ jsx("span", {
2169
+ className: style_default.Type,
2170
+ children: /* @__PURE__ */ jsx("span", {
2171
+ className: style_default.TypeKeyword,
2172
+ children: Keywords$1[type.kind]
2173
+ })
2174
+ });
2175
+ case "GoTypeString": return /* @__PURE__ */ jsx("span", {
2176
+ className: style_default.Type,
2177
+ children: /* @__PURE__ */ jsx("span", {
2178
+ className: style_default.TypeString,
2179
+ children: "string"
2180
+ })
2181
+ });
2182
+ case "GoTypeArray": return /* @__PURE__ */ jsxs("span", {
2183
+ className: style_default.Type,
2184
+ children: [/* @__PURE__ */ jsx("span", {
2185
+ className: style_default.TextOperator,
2186
+ children: "[]"
2187
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType })]
2188
+ });
2189
+ case "GoTypeStruct": return /* @__PURE__ */ jsx("span", {
2190
+ className: style_default.Type,
2191
+ children: /* @__PURE__ */ jsx("span", {
2192
+ className: style_default.TypeKeyword,
2193
+ children: "struct{…}"
2194
+ })
2195
+ });
2196
+ case "GoTypeInterface": return /* @__PURE__ */ jsx("span", {
2197
+ className: style_default.Type,
2198
+ children: /* @__PURE__ */ jsx("span", {
2199
+ className: style_default.TypeKeyword,
2200
+ children: "interface{…}"
2201
+ })
2202
+ });
2203
+ case "GoTypeMap": return /* @__PURE__ */ jsxs("span", {
2204
+ className: style_default.Type,
2205
+ children: [
2206
+ /* @__PURE__ */ jsx("span", {
2207
+ className: style_default.TypeKeyword,
2208
+ children: "map"
2209
+ }),
2210
+ /* @__PURE__ */ jsx("span", {
2211
+ className: style_default.TypeBracket,
2212
+ children: "["
2213
+ }),
2214
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.indexType }),
2215
+ /* @__PURE__ */ jsx("span", {
2216
+ className: style_default.TextPunctuation,
2217
+ children: ","
2218
+ }),
2219
+ " ",
2220
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.itemType }),
2221
+ /* @__PURE__ */ jsx("span", {
2222
+ className: style_default.TypeBracket,
2223
+ children: "]"
2224
+ })
2225
+ ]
2226
+ });
2227
+ case "GoTypePointer": return /* @__PURE__ */ jsxs("span", {
2228
+ className: style_default.Type,
2229
+ children: [/* @__PURE__ */ jsx("span", {
2230
+ className: style_default.TextOperator,
2231
+ children: "*"
2232
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: type.inner })]
2233
+ });
2234
+ }
2235
+ }
2236
+ function MethodSignature$3({ decl }) {
2237
+ const Lang = useLanguageComponents();
2238
+ const { Join: Join$1 } = useComponents();
2239
+ const params = decl.parameters.map((param, i) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx("span", {
2240
+ className: style_default.TextIdentifier,
2241
+ children: param.ident
2242
+ }), param.optional && /* @__PURE__ */ jsx("span", {
2243
+ className: style_default.TextPunctuation,
2244
+ children: "?"
2245
+ })] }, i));
2246
+ const returns = decl.returnType.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
2247
+ return /* @__PURE__ */ jsx("div", {
2248
+ className: style_default.MethodSignature,
2249
+ children: /* @__PURE__ */ jsxs("span", {
2250
+ className: style_default.SignatureTitle,
2251
+ children: [
2252
+ decl.async && /* @__PURE__ */ jsx("span", {
2253
+ className: style_default.TextKeyword,
2254
+ children: "async "
2255
+ }),
2256
+ decl.qualified && /* @__PURE__ */ jsx("span", {
2257
+ className: style_default.SignatureQualified,
2258
+ children: /* @__PURE__ */ jsx("span", {
2259
+ className: style_default.TextIdentifier,
2260
+ children: decl.qualified?.slice(0, -decl.ident.length)
2261
+ })
2262
+ }),
2263
+ decl.kind === "GoDeclFunction" && /* @__PURE__ */ jsx("span", {
2264
+ className: style_default.SignatureName,
2265
+ children: /* @__PURE__ */ jsx("span", {
2266
+ className: style_default.TextIdentifier,
2267
+ children: decl.ident
2268
+ })
2269
+ }),
2270
+ /* @__PURE__ */ jsxs("span", {
2271
+ className: style_default.MethodSignature,
2272
+ children: [
2273
+ /* @__PURE__ */ jsx("span", {
2274
+ className: style_default.SignatureParen,
2275
+ children: "("
2276
+ }),
2277
+ /* @__PURE__ */ jsx("span", {
2278
+ className: style_default.SignatureParams,
2279
+ children: /* @__PURE__ */ jsx(Join$1, {
2280
+ items: params,
2281
+ children: /* @__PURE__ */ jsx("span", {
2282
+ className: style_default.TextOperator,
2283
+ children: ", "
2284
+ })
2285
+ })
2286
+ }),
2287
+ /* @__PURE__ */ jsxs("span", {
2288
+ className: style_default.SignatureParen,
2289
+ children: [")", " "]
2290
+ }),
2291
+ decl.returnType.length === 1 ? returns : /* @__PURE__ */ jsxs(Fragment$1, { children: [
2292
+ /* @__PURE__ */ jsx("span", {
2293
+ className: style_default.SignatureParen,
2294
+ children: "("
2295
+ }),
2296
+ /* @__PURE__ */ jsx(Join$1, {
2297
+ items: returns,
2298
+ children: /* @__PURE__ */ jsx("span", {
2299
+ className: style_default.TextOperator,
2300
+ children: ", "
2301
+ })
2302
+ }),
2303
+ /* @__PURE__ */ jsx("span", {
2304
+ className: style_default.SignatureParen,
2305
+ children: ")"
2306
+ })
2307
+ ] })
2308
+ ]
2309
+ })
2310
+ ]
2311
+ })
2312
+ });
2313
+ }
2314
+ function Property$3({ decl, children }) {
2315
+ const Docs = useComponents();
2316
+ const Lang = useLanguageComponents();
2317
+ if (!decl) return null;
2318
+ switch (decl.kind) {
2319
+ case "GoDeclProperty": return children({
2320
+ name: decl.ident,
2321
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
2322
+ badges: decl.optional && /* @__PURE__ */ jsx(Docs.Badge, { id: "optional" }),
2323
+ type: (isField(decl.type) || decl.type.kind in ComplexTypes$2) && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2324
+ });
2325
+ case "GoDeclConst": return children({
2326
+ name: decl.ident,
2327
+ typeName: "const",
2328
+ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2329
+ });
2330
+ case "GoDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
2331
+ case "GoDeclType":
2332
+ case "GoDeclTypeAlias": {
2333
+ const typeName$1 = decl.type.kind === "GoTypeStruct" ? "struct" : decl.type.kind === "GoTypeInterface" ? "interface" : decl.kind === "GoDeclTypeAlias" ? "alias" : "type";
2334
+ return children({
2335
+ name: decl.ident,
2336
+ typeName: typeName$1,
2337
+ type: ["GoTypeStruct", "GoTypeInterface"].includes(decl.type.kind) || /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2338
+ });
2339
+ }
2340
+ }
2341
+ }
2342
+ function Declaration$3({ decl }) {
2343
+ const Lang = useLanguageComponents();
2344
+ if (!decl) return;
2345
+ switch (decl.kind) {
2346
+ case "GoDeclType": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2347
+ /* @__PURE__ */ jsx("span", {
2348
+ className: style_default.TextKeyword,
2349
+ children: "type "
2350
+ }),
2351
+ /* @__PURE__ */ jsxs("span", {
2352
+ className: style_default.TextIdentifier,
2353
+ children: [decl.ident, " "]
2354
+ }),
2355
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2356
+ ] });
2357
+ case "GoDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2358
+ /* @__PURE__ */ jsx("span", {
2359
+ className: style_default.TextKeyword,
2360
+ children: "type "
2361
+ }),
2362
+ /* @__PURE__ */ jsxs("span", {
2363
+ className: style_default.TextIdentifier,
2364
+ children: [decl.ident, " "]
2365
+ }),
2366
+ /* @__PURE__ */ jsx("span", {
2367
+ className: style_default.TextOperator,
2368
+ children: "= "
2369
+ }),
2370
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2371
+ ] });
2372
+ case "GoDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
2373
+ className: style_default.TypePropertyName,
2374
+ children: /* @__PURE__ */ jsxs("span", {
2375
+ className: style_default.TextIdentifier,
2376
+ children: [decl.ident, " "]
2377
+ })
2378
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })] });
2379
+ case "GoDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
2380
+ case "GoDeclConst": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2381
+ /* @__PURE__ */ jsx("span", {
2382
+ className: style_default.TextKeyword,
2383
+ children: "const "
2384
+ }),
2385
+ /* @__PURE__ */ jsxs("span", {
2386
+ className: style_default.TextIdentifier,
2387
+ children: [decl.ident, " "]
2388
+ }),
2389
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }),
2390
+ /* @__PURE__ */ jsx("span", {
2391
+ className: style_default.TextOperator,
2392
+ children: " = "
2393
+ }),
2394
+ JSON.stringify(decl.value)
2395
+ ] });
2396
+ }
2397
+ }
2398
+
2399
+ //#endregion
2400
+ //#region src/languages/python.tsx
2401
+ var python_exports = /* @__PURE__ */ __export({
2402
+ Declaration: () => Declaration$2,
2403
+ MethodSignature: () => MethodSignature$2,
2404
+ Property: () => Property$2,
2405
+ Type: () => Type$2,
2406
+ TypeName: () => TypeName$2
2407
+ });
2408
+ const constStyle$1 = {
2409
+ string: style_default.LiteralString,
2410
+ number: style_default.LiteralNumeric,
2411
+ boolean: style_default.LiteralBoolean
2412
+ };
2413
+ function showFullType(type) {
2414
+ if (type.kind !== "PythonTypeReference") return false;
2415
+ return type.typeName === "Optional" ? showFullType(type.typeParameters[0]) : type.typeParameters.length > 0;
2416
+ }
2417
+ function TypeName$2({ type }) {
2418
+ const Lang = useLanguageComponents();
2419
+ if (type.kind === "PythonTypeReference") switch (type.typeName) {
2420
+ case "Optional": return /* @__PURE__ */ jsx(Lang.TypeName, { type: type.typeParameters[0] });
2421
+ case "List":
2422
+ case "Iterable":
2423
+ case "Literal":
2424
+ case "Union": return type.typeName.toLowerCase();
2425
+ }
2426
+ return /* @__PURE__ */ jsx(Lang.Type, { type });
2427
+ }
2428
+ function Type$2({ type }) {
2429
+ const Lang = useLanguageComponents();
2430
+ const { Join: Join$1, SDKReference: SDKReference$1 } = useComponents();
2431
+ switch (type.kind) {
2432
+ case "PythonTypeAny":
2433
+ case "PythonTypeUnknown":
2434
+ case "PythonTypeInt":
2435
+ case "PythonTypeFloat":
2436
+ case "PythonTypeBool": return /* @__PURE__ */ jsx("span", {
2437
+ className: style_default.Type,
2438
+ children: /* @__PURE__ */ jsx("span", {
2439
+ className: style_default.TypeKeyword,
2440
+ children: type.kind.slice(10).toLowerCase()
2441
+ })
2442
+ });
2443
+ case "PythonTypeString": return /* @__PURE__ */ jsx("span", {
2444
+ className: style_default.Type,
2445
+ children: /* @__PURE__ */ jsx("span", {
2446
+ className: style_default.TypeString,
2447
+ children: "str"
2448
+ })
2449
+ });
2450
+ case "PythonTypeLiteral": return /* @__PURE__ */ jsx("span", {
2451
+ className: style_default.Type,
2452
+ children: /* @__PURE__ */ jsx("span", {
2453
+ className: constStyle$1[typeof type.literal.value],
2454
+ children: JSON.stringify(type.literal.value)
2455
+ })
2456
+ });
2457
+ case "PythonTypeArray": return /* @__PURE__ */ jsxs("span", {
2458
+ className: style_default.Type,
2459
+ children: [
2460
+ /* @__PURE__ */ jsx("span", {
2461
+ className: style_default.TypeArray,
2462
+ children: "Array<"
2463
+ }),
2464
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType }),
2465
+ /* @__PURE__ */ jsx("span", {
2466
+ className: style_default.TypeArray,
2467
+ children: ">"
2468
+ })
2469
+ ]
2470
+ });
2471
+ case "PythonTypeClass": return /* @__PURE__ */ jsx("span", {
2472
+ className: style_default.Type,
2473
+ children: /* @__PURE__ */ jsx("span", {
2474
+ className: style_default.TypeKeyword,
2475
+ children: "class"
2476
+ })
2477
+ });
2478
+ case "PythonTypeMap": return /* @__PURE__ */ jsx("span", {
2479
+ className: style_default.Type,
2480
+ children: /* @__PURE__ */ jsx("span", {
2481
+ className: style_default.TypeKeyword,
2482
+ children: "Dict"
2483
+ })
2484
+ });
2485
+ case "PythonTypeReference": {
2486
+ const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
2487
+ return /* @__PURE__ */ jsxs("span", {
2488
+ className: style_default.Type,
2489
+ children: [/* @__PURE__ */ jsx("span", {
2490
+ className: type.typeName === "Optional" ? style_default.TypeArray : "",
2491
+ children: /* @__PURE__ */ jsx(SDKReference$1, {
2492
+ stainlessPath: type.$ref,
2493
+ children: type.typeName
2494
+ })
2495
+ }), params && params.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
2496
+ /* @__PURE__ */ jsx("span", {
2497
+ className: style_default.TypeBracket,
2498
+ children: "["
2499
+ }),
2500
+ /* @__PURE__ */ jsx(Join$1, {
2501
+ items: params,
2502
+ limit: 3,
2503
+ children: /* @__PURE__ */ jsx("span", {
2504
+ className: style_default.TextOperator,
2505
+ children: ", "
2506
+ })
2507
+ }),
2508
+ /* @__PURE__ */ jsx("span", {
2509
+ className: style_default.TypeBracket,
2510
+ children: "]"
2511
+ })
2512
+ ] })]
2513
+ });
2514
+ }
2515
+ }
2516
+ }
2517
+ function MethodSignature$2({ decl }) {
2518
+ const Lang = useLanguageComponents();
2519
+ const { Join: Join$1, Tooltip: Tooltip$1 } = useComponents();
2520
+ const params = decl.parameters.map((param, i) => /* @__PURE__ */ jsx(React$1.Fragment, { children: /* @__PURE__ */ jsx(Tooltip$1, {
2521
+ content: /* @__PURE__ */ jsx(Lang.Type, { type: param.type }),
2522
+ children: /* @__PURE__ */ jsx("span", {
2523
+ className: style_default.TextIdentifier,
2524
+ children: param.ident
2525
+ })
2526
+ }) }, i));
2527
+ return /* @__PURE__ */ jsx("div", {
2528
+ className: style_default.MethodSignature,
2529
+ children: /* @__PURE__ */ jsxs("span", {
2530
+ className: style_default.SignatureTitle,
2531
+ children: [
2532
+ decl.async && /* @__PURE__ */ jsx("span", {
2533
+ className: style_default.TextKeyword,
2534
+ children: "async "
2535
+ }),
2536
+ decl.qualified && /* @__PURE__ */ jsx("span", {
2537
+ className: style_default.SignatureQualified,
2538
+ children: /* @__PURE__ */ jsx("span", {
2539
+ className: style_default.TextIdentifier,
2540
+ children: decl.qualified?.slice(0, -decl.ident.length)
2541
+ })
2542
+ }),
2543
+ /* @__PURE__ */ jsx("span", {
2544
+ className: style_default.SignatureName,
2545
+ children: /* @__PURE__ */ jsx("span", {
2546
+ className: style_default.TextIdentifier,
2547
+ children: decl.ident
2548
+ })
2549
+ }),
2550
+ /* @__PURE__ */ jsxs("span", {
2551
+ className: style_default.MethodSignature,
2552
+ children: [
2553
+ /* @__PURE__ */ jsx("span", {
2554
+ className: style_default.SignatureParen,
2555
+ children: "("
2556
+ }),
2557
+ /* @__PURE__ */ jsx("span", {
2558
+ className: style_default.SignatureParams,
2559
+ children: /* @__PURE__ */ jsx(Join$1, {
2560
+ items: params,
2561
+ children: /* @__PURE__ */ jsx("span", {
2562
+ className: style_default.TextOperator,
2563
+ children: ", "
2564
+ })
2565
+ })
2566
+ }),
2567
+ /* @__PURE__ */ jsxs("span", {
2568
+ className: style_default.SignatureParen,
2569
+ children: [")", " "]
2570
+ }),
2571
+ decl.returns && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
2572
+ className: style_default.TextOperator,
2573
+ children: " -> "
2574
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: decl.returns })] })
2575
+ ]
2576
+ })
2577
+ ]
2578
+ })
2579
+ });
2580
+ }
2581
+ function Property$2({ decl, children }) {
2582
+ const Lang = useLanguageComponents();
2583
+ if (!decl) return;
2584
+ switch (decl.kind) {
2585
+ case "PythonDeclProperty": return children({
2586
+ name: decl.ident,
2587
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
2588
+ type: showFullType(decl.type) && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2589
+ });
2590
+ case "PythonDeclClass": return children({
2591
+ name: decl.ident,
2592
+ typeName: "class"
2593
+ });
2594
+ case "PythonDeclType": return children({
2595
+ name: decl.ident,
2596
+ typeName: "type",
2597
+ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2598
+ });
2599
+ case "PythonDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
2600
+ }
2601
+ }
2602
+ function Declaration$2({ decl }) {
2603
+ const Lang = useLanguageComponents();
2604
+ if (!decl) return;
2605
+ switch (decl.kind) {
2606
+ case "PythonDeclProperty": {
2607
+ const nullable = decl.type.kind === "PythonTypeReference" && decl.type.typeName === "Optional" && (decl.type.typeParameters ?? []).length > 0;
2608
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2609
+ /* @__PURE__ */ jsx("span", {
2610
+ className: style_default.TypePropertyName,
2611
+ children: /* @__PURE__ */ jsx("span", {
2612
+ className: style_default.TextIdentifier,
2613
+ children: decl.ident
2614
+ })
2615
+ }),
2616
+ /* @__PURE__ */ jsx("span", {
2617
+ className: style_default.TextPunctuation,
2618
+ children: ": "
2619
+ }),
2620
+ decl.optional && !nullable ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
2621
+ /* @__PURE__ */ jsx("span", {
2622
+ className: style_default.TypePlain,
2623
+ children: "Optional"
2624
+ }),
2625
+ /* @__PURE__ */ jsx("span", {
2626
+ className: style_default.TypeBracket,
2627
+ children: "["
2628
+ }),
2629
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }),
2630
+ /* @__PURE__ */ jsx("span", {
2631
+ className: style_default.TypeBrace,
2632
+ children: "]"
2633
+ })
2634
+ ] }) : /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2635
+ ] });
2636
+ }
2637
+ case "PythonDeclClass": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2638
+ /* @__PURE__ */ jsx("span", {
2639
+ className: style_default.TextKeyword,
2640
+ children: "class "
2641
+ }),
2642
+ /* @__PURE__ */ jsx("span", {
2643
+ className: style_default.TextIdentifier,
2644
+ children: decl.ident
2645
+ }),
2646
+ /* @__PURE__ */ jsx("span", {
2647
+ className: style_default.TextPunctuation,
2648
+ children: ": "
2649
+ }),
2650
+ /* @__PURE__ */ jsx("span", {
2651
+ className: `${style_default.TypePreviewContent} ${style_default.TextPunctuation}`,
2652
+ children: "…"
2653
+ })
2654
+ ] });
2655
+ case "PythonDeclType": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2656
+ /* @__PURE__ */ jsx("span", {
2657
+ className: style_default.TextIdentifier,
2658
+ children: decl.ident
2659
+ }),
2660
+ /* @__PURE__ */ jsx("span", {
2661
+ className: style_default.TextOperator,
2662
+ children: " = "
2663
+ }),
2664
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2665
+ ] });
2666
+ case "PythonDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
2667
+ }
2668
+ }
2669
+
2670
+ //#endregion
2671
+ //#region src/languages/ruby.tsx
2672
+ var ruby_exports = /* @__PURE__ */ __export({
2673
+ Declaration: () => Declaration$1,
2674
+ MethodSignature: () => MethodSignature$1,
2675
+ Property: () => Property$1,
2676
+ Type: () => Type$1,
2677
+ TypeName: () => TypeName$1
2678
+ });
2679
+ const ComplexTypes$1 = {
2680
+ RubyTypeObject: "object",
2681
+ RubyTypeUnion: "union",
2682
+ RubyTypeIntersection: "intersection",
2683
+ RubyTypeArray: "array",
2684
+ RubyTypeMap: "hash"
2685
+ };
2686
+ const Keywords = {
2687
+ RubyTypeBinary: "StringIO",
2688
+ RubyTypeUnknown: "untyped",
2689
+ RubyTypeNull: "nil",
2690
+ RubyTypeInteger: "Integer",
2691
+ RubyTypeFloat: "Float",
2692
+ RubyTypeBoolean: "bool"
2693
+ };
2694
+ function TypeName$1({ type }) {
2695
+ const Lang = useLanguageComponents();
2696
+ return ComplexTypes$1[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
2697
+ }
2698
+ const VALID_IDENTIFIER = /^[_A-Za-z][_A-Za-z0-9]*$/;
2699
+ function TypePreview$1({ path }) {
2700
+ const spec = useSpec();
2701
+ const language = useLanguage();
2702
+ const decl = useDeclaration(path, false);
2703
+ const { Join: Join$1 } = useComponents();
2704
+ if (!(decl && "children" in decl && decl.children && decl.children.length > 0) || "type" in decl && decl["type"] && "kind" in decl["type"] && decl["type"]?.["kind"] === "RubyTypeUnion") return;
2705
+ const items = decl.children.map((prop, key) => {
2706
+ const p = spec?.decls?.[language]?.[prop];
2707
+ return /* @__PURE__ */ jsx("span", {
2708
+ className: style_default.TypePropertyName,
2709
+ children: /* @__PURE__ */ jsx("span", {
2710
+ className: style_default.TextIdentifier,
2711
+ children: p && "ident" in p ? p["ident"] : null
2712
+ })
2713
+ }, key);
2714
+ });
2715
+ return /* @__PURE__ */ jsxs("span", {
2716
+ className: style_default.TypePreview,
2717
+ "data-stldocs-type-preview": "properties",
2718
+ children: [
2719
+ /* @__PURE__ */ jsx("span", {
2720
+ className: style_default.TypeBrace,
2721
+ children: " {"
2722
+ }),
2723
+ /* @__PURE__ */ jsxs("span", {
2724
+ className: style_default.TypePreviewContent,
2725
+ children: [
2726
+ " ",
2727
+ /* @__PURE__ */ jsx(Join$1, {
2728
+ items,
2729
+ limit: 3,
2730
+ children: /* @__PURE__ */ jsx("span", {
2731
+ className: style_default.TextOperator,
2732
+ children: ", "
2733
+ })
2734
+ }),
2735
+ " "
2736
+ ]
2737
+ }),
2738
+ /* @__PURE__ */ jsx("span", {
2739
+ className: style_default.TypeBrace,
2740
+ children: "} "
2741
+ })
2742
+ ]
2743
+ });
2744
+ }
2745
+ function Type$1({ type }) {
2746
+ const Lang = useLanguageComponents();
2747
+ const { SDKReference: SDKReference$1, Join: Join$1 } = useComponents();
2748
+ switch (type.kind) {
2749
+ case "RubyTypeBinary":
2750
+ case "RubyTypeUnknown":
2751
+ case "RubyTypeNull":
2752
+ case "RubyTypeInteger":
2753
+ case "RubyTypeFloat":
2754
+ case "RubyTypeBoolean": return /* @__PURE__ */ jsx("span", {
2755
+ className: style_default.Type,
2756
+ children: /* @__PURE__ */ jsx("span", {
2757
+ className: style_default.TypeKeyword,
2758
+ children: Keywords[type.kind]
2759
+ })
2760
+ });
2761
+ case "RubyTypeString": return /* @__PURE__ */ jsx("span", {
2762
+ className: style_default.Type,
2763
+ children: /* @__PURE__ */ jsx("span", {
2764
+ className: style_default.TypeString,
2765
+ children: "String"
2766
+ })
2767
+ });
2768
+ case "RubyTypeLiteral":
2769
+ switch (typeof type.literal) {
2770
+ case "string": return /* @__PURE__ */ jsx("span", {
2771
+ className: style_default.Type,
2772
+ children: /* @__PURE__ */ jsxs("span", {
2773
+ className: style_default.LiteralString,
2774
+ children: [":", type.literal.match(VALID_IDENTIFIER) ? type.literal : JSON.stringify(type.literal)]
2775
+ })
2776
+ });
2777
+ case "number": return /* @__PURE__ */ jsx("span", {
2778
+ className: style_default.Type,
2779
+ children: /* @__PURE__ */ jsx("span", {
2780
+ className: style_default.LiteralNumeric,
2781
+ children: JSON.stringify(type.literal)
2782
+ })
2783
+ });
2784
+ case "boolean": return /* @__PURE__ */ jsx("span", {
2785
+ className: style_default.Type,
2786
+ children: /* @__PURE__ */ jsx("span", {
2787
+ className: style_default.LiteralBoolean,
2788
+ children: JSON.stringify(type.literal)
2789
+ })
2790
+ });
2791
+ }
2792
+ break;
2793
+ case "RubyTypeArray": return /* @__PURE__ */ jsxs("span", {
2794
+ className: style_default.Type,
2795
+ children: [
2796
+ /* @__PURE__ */ jsx("span", {
2797
+ className: style_default.TypeArray,
2798
+ children: "Array["
2799
+ }),
2800
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType }),
2801
+ /* @__PURE__ */ jsx("span", {
2802
+ className: style_default.TypeArray,
2803
+ children: "]"
2804
+ })
2805
+ ]
2806
+ });
2807
+ case "RubyTypeMap": return /* @__PURE__ */ jsxs("span", {
2808
+ className: style_default.Type,
2809
+ children: [
2810
+ /* @__PURE__ */ jsx("span", {
2811
+ className: style_default.TypeArray,
2812
+ children: "Hash["
2813
+ }),
2814
+ type.indexType.kind === "RubyTypeString" ? /* @__PURE__ */ jsx("span", {
2815
+ className: style_default.TypeString,
2816
+ children: "Symbol"
2817
+ }) : /* @__PURE__ */ jsx(Lang.Type, { type: type.indexType }),
2818
+ ", ",
2819
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.itemType }),
2820
+ /* @__PURE__ */ jsx("span", {
2821
+ className: style_default.TypeArray,
2822
+ children: "]"
2823
+ })
2824
+ ]
2825
+ });
2826
+ case "RubyTypeReference": {
2827
+ const name = type.ident.split(".").at(-1);
2828
+ if (!type.typeParameters || type.typeParameters.length === 0) return /* @__PURE__ */ jsxs("span", {
2829
+ className: style_default.Type,
2830
+ children: [/* @__PURE__ */ jsx(SDKReference$1, {
2831
+ stainlessPath: type.$ref,
2832
+ children: name
2833
+ }), /* @__PURE__ */ jsx(TypePreview$1, { path: type.$ref })]
2834
+ });
2835
+ const typeParameters = type.typeParameters.map((t, i) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, i));
2836
+ return /* @__PURE__ */ jsxs("span", {
2837
+ className: style_default.Type,
2838
+ children: [
2839
+ /* @__PURE__ */ jsx(SDKReference$1, {
2840
+ stainlessPath: type.$ref,
2841
+ children: name
2842
+ }),
2843
+ /* @__PURE__ */ jsx("span", {
2844
+ className: style_default.TypeBracket,
2845
+ children: "<"
2846
+ }),
2847
+ /* @__PURE__ */ jsx(Join$1, {
2848
+ items: typeParameters,
2849
+ children: /* @__PURE__ */ jsx("span", {
2850
+ className: style_default.TextOperator,
2851
+ children: ", "
2852
+ })
2853
+ }),
2854
+ /* @__PURE__ */ jsx("span", {
2855
+ className: style_default.TypeBracket,
2856
+ children: ">"
2857
+ }),
2858
+ /* @__PURE__ */ jsx(TypePreview$1, { path: type.$ref })
2859
+ ]
2860
+ });
2861
+ }
2862
+ case "RubyTypeIntersection":
2863
+ case "RubyTypeUnion": {
2864
+ const items = type.types.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
2865
+ const delimiter = type.kind === "RubyTypeUnion" ? "|" : "&";
2866
+ return /* @__PURE__ */ jsx("span", {
2867
+ className: style_default.Type,
2868
+ children: /* @__PURE__ */ jsx("span", {
2869
+ className: style_default.TypePreview,
2870
+ "data-stldocs-type-preview": "union",
2871
+ children: /* @__PURE__ */ jsx("span", {
2872
+ className: style_default.TypePreviewContent,
2873
+ children: /* @__PURE__ */ jsx(Join$1, {
2874
+ items,
2875
+ limit: 3,
2876
+ children: /* @__PURE__ */ jsxs("span", {
2877
+ className: style_default.TextOperator,
2878
+ children: [
2879
+ " ",
2880
+ delimiter,
2881
+ " "
2882
+ ]
2883
+ })
2884
+ })
2885
+ })
2886
+ })
2887
+ });
2888
+ }
2889
+ case "RubyTypeBuiltinClass": return /* @__PURE__ */ jsx("span", {
2890
+ className: style_default.TypeReference,
2891
+ children: type.className
2892
+ });
2893
+ case "RubyTypeObject": {
2894
+ const items = type.members.map((prop, key) => /* @__PURE__ */ jsx("span", {
2895
+ className: style_default.TextIdentifier,
2896
+ children: prop.ident
2897
+ }, key));
2898
+ return /* @__PURE__ */ jsx("span", {
2899
+ className: style_default.Type,
2900
+ children: /* @__PURE__ */ jsx("span", {
2901
+ className: style_default.TypePreview,
2902
+ "data-stldocs-type-preview": "properties",
2903
+ children: /* @__PURE__ */ jsxs("span", {
2904
+ className: style_default.TypePreviewContent,
2905
+ children: [
2906
+ /* @__PURE__ */ jsx("span", {
2907
+ className: style_default.TypeBrace,
2908
+ children: "{ "
2909
+ }),
2910
+ /* @__PURE__ */ jsx(Join$1, {
2911
+ items,
2912
+ limit: 3,
2913
+ children: /* @__PURE__ */ jsx("span", {
2914
+ className: style_default.TextOperator,
2915
+ children: ", "
2916
+ })
2917
+ }),
2918
+ /* @__PURE__ */ jsx("span", {
2919
+ className: style_default.TypeBrace,
2920
+ children: "}"
2921
+ })
2922
+ ]
2923
+ })
2924
+ })
2925
+ });
2926
+ }
2927
+ }
2928
+ }
2929
+ function MethodSignature$1({ decl }) {
2930
+ const Lang = useLanguageComponents();
2931
+ const { Join: Join$1 } = useComponents();
2932
+ const params = decl.args.map((param, i) => /* @__PURE__ */ jsx(React$1.Fragment, { children: /* @__PURE__ */ jsx("span", {
2933
+ className: style_default.TextIdentifier,
2934
+ children: param.ident
2935
+ }) }, i));
2936
+ return /* @__PURE__ */ jsx("div", {
2937
+ className: style_default.MethodSignature,
2938
+ children: /* @__PURE__ */ jsxs("span", {
2939
+ className: style_default.SignatureTitle,
2940
+ children: [
2941
+ /* @__PURE__ */ jsx("span", {
2942
+ className: style_default.SignatureQualified,
2943
+ children: /* @__PURE__ */ jsx("span", {
2944
+ className: style_default.TextIdentifier,
2945
+ children: decl.qualified?.slice(0, -decl.ident.length)
2946
+ })
2947
+ }),
2948
+ /* @__PURE__ */ jsx("span", {
2949
+ className: style_default.SignatureName,
2950
+ children: /* @__PURE__ */ jsx("span", {
2951
+ className: style_default.TextIdentifier,
2952
+ children: decl.ident
2953
+ })
2954
+ }),
2955
+ /* @__PURE__ */ jsxs("span", {
2956
+ className: style_default.MethodSignature,
2957
+ children: [
2958
+ /* @__PURE__ */ jsx("span", {
2959
+ className: style_default.SignatureParen,
2960
+ children: "("
2961
+ }),
2962
+ /* @__PURE__ */ jsx("span", {
2963
+ className: style_default.SignatureParams,
2964
+ children: /* @__PURE__ */ jsx(Join$1, {
2965
+ items: params,
2966
+ children: /* @__PURE__ */ jsx("span", {
2967
+ className: style_default.TextOperator,
2968
+ children: ", "
2969
+ })
2970
+ })
2971
+ }),
2972
+ /* @__PURE__ */ jsx("span", {
2973
+ className: style_default.SignatureParen,
2974
+ children: ")"
2975
+ }),
2976
+ " -> ",
2977
+ decl.returns ? /* @__PURE__ */ jsx(Lang.Type, { type: decl.returns }) : "void"
2978
+ ]
2979
+ })
2980
+ ]
2981
+ })
2982
+ });
2983
+ }
2984
+ function Property$1({ decl, children }) {
2985
+ const Lang = useLanguageComponents();
2986
+ switch (decl.kind) {
2987
+ case "RubyDeclProperty": return children({
2988
+ name: decl.ident,
2989
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
2990
+ type: decl.type.kind in ComplexTypes$1 && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2991
+ });
2992
+ case "RubyDeclTypeAlias": return children({
2993
+ name: decl.ident,
2994
+ typeName: "alias",
2995
+ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2996
+ });
2997
+ case "RubyDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
2998
+ case "RubyDeclClass": return children({
2999
+ name: decl.ident,
3000
+ typeName: "class"
3001
+ });
3002
+ }
3003
+ }
3004
+ function Declaration$1({ decl }) {
3005
+ const Lang = useLanguageComponents();
3006
+ if (!decl) return;
3007
+ switch (decl.kind) {
3008
+ case "RubyDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3009
+ /* @__PURE__ */ jsx("span", {
3010
+ className: style_default.TypePropertyName,
3011
+ children: /* @__PURE__ */ jsx("span", {
3012
+ className: style_default.TextIdentifier,
3013
+ children: decl.ident
3014
+ })
3015
+ }),
3016
+ /* @__PURE__ */ jsx("span", {
3017
+ className: style_default.TextPunctuation,
3018
+ children: ": "
3019
+ }),
3020
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
3021
+ ] });
3022
+ case "RubyDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3023
+ /* @__PURE__ */ jsx("span", {
3024
+ className: style_default.TextIdentifier,
3025
+ children: decl.ident
3026
+ }),
3027
+ /* @__PURE__ */ jsx("span", {
3028
+ className: style_default.TextOperator,
3029
+ children: " = "
3030
+ }),
3031
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
3032
+ ] });
3033
+ case "RubyDeclClass": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3034
+ /* @__PURE__ */ jsx("span", {
3035
+ className: style_default.TextKeyword,
3036
+ children: "class "
3037
+ }),
3038
+ /* @__PURE__ */ jsx("span", {
3039
+ className: style_default.TextIdentifier,
3040
+ children: decl.ident
3041
+ }),
3042
+ /* @__PURE__ */ jsx(TypePreview$1, { path: decl.stainlessPath })
3043
+ ] });
3044
+ case "RubyDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
3045
+ }
3046
+ }
3047
+
3048
+ //#endregion
3049
+ //#region src/languages/http.tsx
3050
+ var http_exports = /* @__PURE__ */ __export({
3051
+ Declaration: () => Declaration,
3052
+ MethodInfo: () => MethodInfo,
3053
+ MethodSignature: () => MethodSignature,
3054
+ Property: () => Property,
3055
+ Type: () => Type,
3056
+ TypeName: () => TypeName
3057
+ });
3058
+ const ComplexTypes = {
3059
+ HttpTypeUnion: "union",
3060
+ HttpTypeIntersection: "intersection"
3061
+ };
3062
+ const constStyle = {
3063
+ string: style_default.LiteralString,
3064
+ number: style_default.LiteralNumeric,
3065
+ boolean: style_default.LiteralBoolean
3066
+ };
3067
+ function Identifier({ name }) {
3068
+ return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx("span", {
3069
+ className: style_default.TextIdentifier,
3070
+ children: /^[_a-zA-Z][_a-zA-Z0-9]*$/.test(name) ? name : JSON.stringify(name)
3071
+ }) });
3072
+ }
3073
+ function TypePreview({ path }) {
3074
+ const spec = useSpec();
3075
+ const language = useLanguage();
3076
+ const decl = useDeclaration(path, false);
3077
+ const { Join: Join$1 } = useComponents();
3078
+ if (!(decl && "children" in decl && decl.children && decl.children.length > 0) || "type" in decl && decl["type"] && "kind" in decl["type"] && decl["type"]["kind"] === "HttpTypeUnion") return;
3079
+ const items = decl.children.map((prop, key) => {
3080
+ const decl$1 = spec?.decls?.[language]?.[prop];
3081
+ return /* @__PURE__ */ jsx("span", {
3082
+ className: style_default.TypePropertyName,
3083
+ children: /* @__PURE__ */ jsx("span", {
3084
+ className: style_default.TextIdentifier,
3085
+ children: decl$1 && "key" in decl$1 ? decl$1?.["key"] : null
3086
+ })
3087
+ }, key);
3088
+ });
3089
+ return /* @__PURE__ */ jsxs("span", {
3090
+ className: style_default.TypePreview,
3091
+ "data-stldocs-type-preview": "properties",
3092
+ children: [
3093
+ /* @__PURE__ */ jsx("span", {
3094
+ className: style_default.TypeBrace,
3095
+ children: " { "
3096
+ }),
3097
+ /* @__PURE__ */ jsx("span", {
3098
+ className: style_default.TypePreviewContent,
3099
+ children: /* @__PURE__ */ jsx(Join$1, {
3100
+ items,
3101
+ limit: 3,
3102
+ children: /* @__PURE__ */ jsx("span", {
3103
+ className: style_default.TextOperator,
3104
+ children: ", "
3105
+ })
3106
+ })
3107
+ }),
3108
+ /* @__PURE__ */ jsx("span", {
3109
+ className: style_default.TypeBrace,
3110
+ children: " } "
3111
+ })
3112
+ ]
3113
+ });
3114
+ }
3115
+ function TypeName({ type }) {
3116
+ const Lang = useLanguageComponents();
3117
+ if (type.kind === "HttpTypeArray") return /* @__PURE__ */ jsxs(Fragment$1, { children: ["array of ", /* @__PURE__ */ jsx(Lang.TypeName, { type: type.elementType })] });
3118
+ if (type.kind === "HttpTypeUnion" && type.types.every((t) => t.kind === "HttpTypeLiteral")) return "enum";
3119
+ if (type.kind === "HttpTypeReference" && type.ident.split(".").at(-1) === "Record") return "map";
3120
+ return ComplexTypes[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
3121
+ }
3122
+ function Type({ type }) {
3123
+ const Lang = useLanguageComponents();
3124
+ const { Join: Join$1, SDKReference: SDKReference$1 } = useComponents();
3125
+ switch (type.kind) {
3126
+ case "HttpTypeUnknown":
3127
+ case "HttpTypeUndefined":
3128
+ case "HttpTypeNull":
3129
+ case "HttpTypeBoolean":
3130
+ case "HttpTypeNumber": return /* @__PURE__ */ jsx("span", {
3131
+ className: style_default.Type,
3132
+ children: /* @__PURE__ */ jsx("span", {
3133
+ className: style_default.TypePlain,
3134
+ children: type.kind.slice(8).toLowerCase()
3135
+ })
3136
+ });
3137
+ case "HttpTypeString": return /* @__PURE__ */ jsx("span", {
3138
+ className: style_default.Type,
3139
+ children: /* @__PURE__ */ jsx("span", {
3140
+ className: style_default.TypePlain,
3141
+ children: "string"
3142
+ })
3143
+ });
3144
+ case "HttpTypeLiteral": return /* @__PURE__ */ jsx("span", {
3145
+ className: style_default.Type,
3146
+ children: /* @__PURE__ */ jsx("span", {
3147
+ className: constStyle[typeof type.literal],
3148
+ children: JSON.stringify(type.literal)
3149
+ })
3150
+ });
3151
+ case "HttpTypeArray": return /* @__PURE__ */ jsxs("span", {
3152
+ className: style_default.Type,
3153
+ children: [/* @__PURE__ */ jsx("span", {
3154
+ className: style_default.TypeArray,
3155
+ children: "array of "
3156
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType })]
3157
+ });
3158
+ case "HttpTypeIntersection":
3159
+ case "HttpTypeUnion": {
3160
+ const items = type.types.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
3161
+ const delimiter = type.kind === "HttpTypeUnion" ? "or" : "and";
3162
+ return /* @__PURE__ */ jsx("span", {
3163
+ className: style_default.Type,
3164
+ children: /* @__PURE__ */ jsx("span", {
3165
+ className: style_default.TypePreview,
3166
+ "data-stldocs-type-preview": "union",
3167
+ children: /* @__PURE__ */ jsx("span", {
3168
+ className: style_default.TypePreviewContent,
3169
+ children: /* @__PURE__ */ jsx(Join$1, {
3170
+ items,
3171
+ limit: 3,
3172
+ children: /* @__PURE__ */ jsxs("span", {
3173
+ className: style_default.TextOperator,
3174
+ children: [
3175
+ " ",
3176
+ delimiter,
3177
+ " "
3178
+ ]
3179
+ })
3180
+ })
3181
+ })
3182
+ })
3183
+ });
3184
+ }
3185
+ case "HttpTypeReference": {
3186
+ const name = type.ident.split(".").at(-1);
3187
+ const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
3188
+ if (name === "Record" && type.typeParameters?.length === 2 && type.typeParameters?.at(0).kind === "HttpTypeString") return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3189
+ /* @__PURE__ */ jsx("span", {
3190
+ className: style_default.TypeArray,
3191
+ children: "map"
3192
+ }),
3193
+ "[",
3194
+ params?.[1],
3195
+ "]"
3196
+ ] });
3197
+ return /* @__PURE__ */ jsxs("span", {
3198
+ className: style_default.Type,
3199
+ children: [
3200
+ /* @__PURE__ */ jsx(SDKReference$1, {
3201
+ stainlessPath: type.$ref,
3202
+ children: name
3203
+ }),
3204
+ params && params.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
3205
+ /* @__PURE__ */ jsx("span", {
3206
+ className: style_default.TypeBracket,
3207
+ children: "<"
3208
+ }),
3209
+ /* @__PURE__ */ jsx(Join$1, {
3210
+ items: params,
3211
+ limit: 3,
3212
+ children: /* @__PURE__ */ jsx("span", {
3213
+ className: style_default.TextOperator,
3214
+ children: ", "
3215
+ })
3216
+ }),
3217
+ /* @__PURE__ */ jsx("span", {
3218
+ className: style_default.TypeBracket,
3219
+ children: ">"
3220
+ })
3221
+ ] }),
3222
+ /* @__PURE__ */ jsx(TypePreview, { path: type.$ref })
3223
+ ]
3224
+ });
3225
+ }
3226
+ case "HttpTypeObject": {
3227
+ const items = type.members.map(({ ident }) => /* @__PURE__ */ jsx("span", {
3228
+ className: style_default.TypePropertyName,
3229
+ children: /* @__PURE__ */ jsx(Identifier, { name: ident })
3230
+ }, ident));
3231
+ return /* @__PURE__ */ jsxs("span", {
3232
+ className: style_default.Type,
3233
+ children: [/* @__PURE__ */ jsx("span", {
3234
+ className: style_default.TypePlain,
3235
+ children: "object"
3236
+ }), /* @__PURE__ */ jsxs("span", {
3237
+ className: style_default.TypePreview,
3238
+ "data-stldocs-type-preview": "properties",
3239
+ children: [
3240
+ /* @__PURE__ */ jsx("span", {
3241
+ className: style_default.TypeBrace,
3242
+ children: " {"
3243
+ }),
3244
+ /* @__PURE__ */ jsxs("span", {
3245
+ className: style_default.TypePreviewContent,
3246
+ children: [
3247
+ " ",
3248
+ /* @__PURE__ */ jsx(Join$1, {
3249
+ items,
3250
+ limit: 3,
3251
+ children: /* @__PURE__ */ jsx("span", {
3252
+ className: style_default.TextOperator,
3253
+ children: ", "
3254
+ })
3255
+ }),
3256
+ " "
3257
+ ]
3258
+ }),
3259
+ /* @__PURE__ */ jsx("span", {
3260
+ className: style_default.TypeBrace,
3261
+ children: "} "
3262
+ })
3263
+ ]
3264
+ })]
3265
+ });
3266
+ }
3267
+ }
3268
+ }
3269
+ function MethodSignature({ decl }) {
3270
+ return null;
3271
+ }
3272
+ function MethodInfo({ decl, children }) {
3273
+ const Docs = useComponents();
3274
+ const params = Object.entries(decl.paramsChildren).filter(([, value]) => value.length).map(([location, value]) => /* @__PURE__ */ jsx(React.Fragment, { children: /* @__PURE__ */ jsxs("div", {
3275
+ className: style_default.MethodParameters,
3276
+ "data-stldocs-property-group": location.at(0),
3277
+ children: [/* @__PURE__ */ jsxs("h5", { children: [
3278
+ location.at(0).toUpperCase(),
3279
+ location.slice(1),
3280
+ " Parameters",
3281
+ /* @__PURE__ */ jsx(PropertyToggle, { target: location.at(0) })
3282
+ ] }), /* @__PURE__ */ jsx(Docs.SDKChildren, { paths: value })]
3283
+ }) }, location));
3284
+ if ((decl.bodyParamsChildren?.["application/json"]?.length ?? 0) > 0) params.push(/* @__PURE__ */ jsxs("div", {
3285
+ className: style_default.MethodInfoSection,
3286
+ children: [/* @__PURE__ */ jsxs("h5", { children: ["Body Parameters", /* @__PURE__ */ jsx(PropertyToggle, { target: "body" })] }), /* @__PURE__ */ jsx("div", {
3287
+ className: style_default.MethodParameters,
3288
+ "data-stldocs-property-group": "body",
3289
+ children: /* @__PURE__ */ jsx(Docs.SDKChildren, { paths: decl.bodyParamsChildren?.["application/json"] ?? [] })
3290
+ })]
3291
+ }));
3292
+ return /* @__PURE__ */ jsxs("div", {
3293
+ className: style_default.MethodInfo,
3294
+ children: [
3295
+ children && /* @__PURE__ */ jsx("div", {
3296
+ className: style_default.MethodContent,
3297
+ children
3298
+ }),
3299
+ params.length > 0 && params,
3300
+ (decl.responseChildren?.length ?? 0) > 0 && /* @__PURE__ */ jsxs("div", {
3301
+ className: style_default.MethodInfoSection,
3302
+ children: [/* @__PURE__ */ jsxs("h5", { children: ["Returns", /* @__PURE__ */ jsx(PropertyToggle, { target: "returns" })] }), /* @__PURE__ */ jsx("div", {
3303
+ className: style_default.MethodReturns,
3304
+ "data-stldocs-property-group": "returns",
3305
+ children: /* @__PURE__ */ jsx(Docs.SDKChildren, { paths: decl.responseChildren ?? [] })
3306
+ })]
3307
+ })
3308
+ ]
3309
+ });
3310
+ }
3311
+ function renderVariantInfo(type) {
3312
+ if (type.kind === "HttpTypeUnion" && type.types.every((t) => t.kind === "HttpTypeObject" || t.kind === "HttpTypeReference")) return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3313
+ "One of the following ",
3314
+ type.types.length,
3315
+ " object variants:"
3316
+ ] });
3317
+ }
3318
+ function Property({ decl, children }) {
3319
+ const Lang = useLanguageComponents();
3320
+ if (!decl) return;
3321
+ switch (decl.kind) {
3322
+ case "HttpDeclProperty": {
3323
+ const variants = renderVariantInfo(decl.type);
3324
+ return children({
3325
+ name: decl.key,
3326
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
3327
+ type: decl.type.kind in ComplexTypes && !variants && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
3328
+ });
3329
+ }
3330
+ case "HttpDeclTypeAlias": return children({
3331
+ name: decl.ident,
3332
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type })
3333
+ });
3334
+ case "HttpDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
3335
+ }
3336
+ }
3337
+ function Declaration({ decl }) {
3338
+ const Lang = useLanguageComponents();
3339
+ if (!decl) return;
3340
+ switch (decl.kind) {
3341
+ case "HttpDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3342
+ /* @__PURE__ */ jsx("span", {
3343
+ className: style_default.TypePropertyName,
3344
+ children: /* @__PURE__ */ jsx(Identifier, { name: decl.key })
3345
+ }),
3346
+ /* @__PURE__ */ jsx("span", {
3347
+ className: style_default.TextPunctuation,
3348
+ children: ": "
3349
+ }),
3350
+ decl.optional && /* @__PURE__ */ jsx("span", {
3351
+ className: style_default.TextPunctuation,
3352
+ children: "optional "
3353
+ }),
3354
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
3355
+ ] });
3356
+ case "HttpDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3357
+ /* @__PURE__ */ jsx(Identifier, { name: decl.ident }),
3358
+ /* @__PURE__ */ jsx("span", {
3359
+ className: style_default.TextOperator,
3360
+ children: " = "
3361
+ }),
3362
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
3363
+ ] });
3364
+ case "HttpDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
3365
+ }
3366
+ }
3367
+
3368
+ //#endregion
3369
+ //#region src/languages/index.ts
3370
+ var languages_exports = /* @__PURE__ */ __export({
3371
+ go: () => go_exports,
3372
+ http: () => http_exports,
3373
+ java: () => java_exports,
3374
+ kotlin: () => kotlin,
3375
+ node: () => node,
3376
+ python: () => python_exports,
3377
+ ruby: () => ruby_exports,
3378
+ typescript: () => typescript_exports
3379
+ });
3380
+ const node = typescript_exports;
3381
+ const kotlin = java_exports;
3382
+
3383
+ //#endregion
3384
+ //#region src/contexts/component.tsx
3385
+ const defaultContextValue = {
3386
+ components: components_exports,
3387
+ language: languages_exports
3388
+ };
3389
+ function ComponentProvider({ components, language, children }) {
3390
+ return /* @__PURE__ */ jsx(ComponentProvider$1, {
3391
+ value: React.useMemo(() => customizeComponents(defaultContextValue, {
3392
+ components,
3393
+ language
3394
+ }), [components, language]),
3395
+ children
3396
+ });
3397
+ }
3398
+
3399
+ //#endregion
3400
+ //#region src/search/printer.tsx
3401
+ function Providers({ language, children }) {
3402
+ return /* @__PURE__ */ jsx(DocsProvider, {
3403
+ spec: null,
3404
+ language,
3405
+ children: /* @__PURE__ */ jsx(ComponentProvider, {
3406
+ components: { SDKReference({ stainlessPath, children: children$1 }) {
3407
+ if (!stainlessPath) return children$1;
3408
+ return /* @__PURE__ */ jsx("span", {
3409
+ className: style_default.TypeReference,
3410
+ children: children$1
3411
+ });
3412
+ } },
3413
+ children
3414
+ })
3415
+ });
3416
+ }
3417
+ function RenderType({ type, full }) {
3418
+ const { Type: Type$6, TypeName: TypeName$6 } = useLanguageComponents();
3419
+ return full ? /* @__PURE__ */ jsx(Type$6, { type }) : /* @__PURE__ */ jsx(TypeName$6, { type });
3420
+ }
3421
+ function typeName(language, type) {
3422
+ return renderToStaticMarkup(/* @__PURE__ */ jsx(Providers, {
3423
+ language,
3424
+ children: /* @__PURE__ */ jsx(RenderType, { type })
3425
+ }));
3426
+ }
3427
+ function RenderDeclaration({ decl }) {
3428
+ const { Declaration: Declaration$6 } = useLanguageComponents();
3429
+ return /* @__PURE__ */ jsx(Declaration$6, { decl });
3430
+ }
3431
+ function declaration$1(language, decl) {
3432
+ return renderToStaticMarkup(/* @__PURE__ */ jsx(Providers, {
3433
+ language,
3434
+ children: /* @__PURE__ */ jsx(RenderDeclaration, { decl })
3435
+ }));
3436
+ }
3437
+ function RenderMethod({ method }) {
3438
+ const { MethodSignature: MethodSignature$6 } = useLanguageComponents();
3439
+ return /* @__PURE__ */ jsx(MethodSignature$6, { decl: method });
3440
+ }
3441
+ function methodSignature(language, decl) {
3442
+ return renderToStaticMarkup(/* @__PURE__ */ jsx(Providers, {
3443
+ language,
3444
+ children: /* @__PURE__ */ jsx(RenderMethod, { method: decl })
3445
+ }));
3446
+ }
3447
+
3448
+ //#endregion
3449
+ //#region src/markdown/index.ts
3450
+ function declaration(env, decl) {
3451
+ const content = declaration$1(env.language, decl);
3452
+ return paragraph(code(stripMarkup(content)));
3453
+ }
3454
+ function renderChildren(env, children, nesting = []) {
3455
+ return list(...children.map((child) => renderDecl(env, child, nesting)));
3456
+ }
3457
+ function renderDecl(env, path, nesting = []) {
3458
+ const decl = getDecl(env, path);
3459
+ const item$1 = item(declaration(env, decl));
3460
+ const hasChildren = "children" in decl && decl.children && decl.children.length > 0;
3461
+ const showModelProps = !("modelPath" in decl && decl["modelPath"]) || env.options.includeModelProperties;
3462
+ if ("docstring" in decl && decl.docstring) item$1.children.push(...parse(decl.docstring));
3463
+ if (hasChildren && showModelProps && !nesting.includes(path)) item$1.push(renderChildren(env, decl.children ?? [], [...nesting, path]));
3464
+ return item$1;
3465
+ }
3466
+ function renderMethod(env, method) {
3467
+ const decl = getDecl(env, method.stainlessPath);
3468
+ if (!decl) return [paragraph(text("The method "), code(method.name), text(" is not available in this language."))];
3469
+ const signature = methodSignature(env.language, decl);
3470
+ const [httpMethod, endpoint] = method.endpoint.split(" ");
3471
+ const output = [
3472
+ heading(2, method.title),
3473
+ ...env.language === "http" ? [] : [paragraph(code(stripMarkup(signature)))],
3474
+ paragraph(strong(text(httpMethod)), text(" "), code(endpoint))
3475
+ ];
3476
+ if (method.description) output.push(...parse(method.description));
3477
+ if ("paramsChildren" in decl && Array.isArray(decl.paramsChildren) && decl.paramsChildren.length > 0) output.push(heading(3, "Parameters"), renderChildren(env, decl.paramsChildren));
3478
+ if ("responseChildren" in decl && decl.responseChildren && decl.responseChildren.length > 0) output.push(heading(3, "Returns"), renderChildren(env, decl.responseChildren));
3479
+ const snippet = getSnippet(env, method.stainlessPath);
3480
+ if (snippet) output.push(heading(3, "Example"), fence(env.language, snippet));
3481
+ return output;
3482
+ }
3483
+ function renderModel(env, model) {
3484
+ return [heading(3, model.title), list(renderDecl(env, `${model.stainlessPath} > (schema)`))];
3485
+ }
3486
+ function renderResource(env, resource) {
3487
+ const methods = Object.values(resource.methods).filter((method) => getDecl(env, method.stainlessPath)).flatMap((method) => renderMethod(env, method));
3488
+ const models = Object.values(resource.models).filter((model) => getDecl(env, `${model.stainlessPath} > (schema)`)).flatMap((model) => renderModel(env, model));
3489
+ const doc = [heading(1, resource.title), ...methods];
3490
+ if (models.length > 0) doc.push(heading(2, "Domain Types"), ...models);
3491
+ if (!env.options.renderNestedResources) return doc;
3492
+ const children = Object.values(resource.subresources ?? {}).flatMap((resource$1) => renderResource(env, resource$1));
3493
+ return [...doc, ...children];
3494
+ }
3495
+ function render(env, node$1) {
3496
+ switch (node$1.kind) {
3497
+ case "resource": return renderResource(env, node$1);
3498
+ case "http_method": return renderMethod(env, node$1);
3499
+ case "model": return renderModel(env, node$1);
3500
+ }
3501
+ }
3502
+ function renderMarkdown(env, node$1) {
3503
+ const content = render(env, node$1);
3504
+ const doc = new Markdoc.Ast.Node("document", {}, content);
3505
+ return Markdoc.format(doc);
3506
+ }
3507
+
3508
+ //#endregion
3509
+ //#region src/search/indexer.ts
3510
+ function getResourceNames(resourceIds, topResources) {
3511
+ let element = void 0;
3512
+ let resources = topResources;
3513
+ const resourceName = [];
3514
+ for (const resource of resourceIds) {
3515
+ element = resources?.[resource];
3516
+ if (!element) break;
3517
+ resourceName.push(element.title);
3518
+ resources = element?.subresources;
3519
+ }
3520
+ return resourceName;
3521
+ }
3522
+ function chunkByLines(content, maxSize = 6e4) {
3523
+ if (Buffer.byteLength(content, "utf8") < maxSize) return [content];
3524
+ const lines = content.split("\n");
3525
+ const chunks = [];
3526
+ let currentChunk = [];
3527
+ let currentSize = 0;
3528
+ for (const line of lines) {
3529
+ const lineSize = Buffer.byteLength(line + "\n", "utf8");
3530
+ if (currentSize + lineSize > maxSize) {
3531
+ chunks.push(currentChunk.join("\n"));
3532
+ currentChunk = [];
3533
+ currentSize = 0;
3534
+ }
3535
+ currentChunk.push(line);
3536
+ currentSize += lineSize;
3537
+ }
3538
+ if (currentChunk.length > 0) chunks.push(currentChunk.join("\n"));
3539
+ return chunks;
3540
+ }
3541
+ function* generateChatIndex(spec) {
3542
+ for (const [language, readme] of Object.entries(spec.readme)) {
3543
+ const chunks = chunkByLines(readme);
3544
+ for (const chunk of chunks) yield {
3545
+ language,
3546
+ title: "Overview",
3547
+ content: chunk,
3548
+ url: `docs://BASE_PATH/${language}`
3549
+ };
3550
+ }
3551
+ for (const { data } of walkTree(spec)) {
3552
+ if (data.kind !== "http_method") continue;
3553
+ const { title, name, stainlessPath, httpMethod, summary, description } = data;
3554
+ const endpoint = data.endpoint.slice(httpMethod.length).trim();
3555
+ for (const language of Languages) {
3556
+ const decl = spec.decls[language]?.[stainlessPath];
3557
+ if (!decl) continue;
3558
+ const chunks = chunkByLines(renderMarkdown({
3559
+ spec,
3560
+ language,
3561
+ options: { includeModelProperties: true }
3562
+ }, data));
3563
+ for (const chunk of chunks) yield {
3564
+ language,
3565
+ title,
3566
+ name,
3567
+ endpoint,
3568
+ httpMethod,
3569
+ summary,
3570
+ description,
3571
+ stainlessPath,
3572
+ qualified: "qualified" in decl ? decl["qualified"] : void 0,
3573
+ ident: "ident" in decl ? decl["ident"] : void 0,
3574
+ content: chunk,
3575
+ url: generateRoute("docs://BASE_PATH", language, stainlessPath)
3576
+ };
3577
+ }
3578
+ }
3579
+ }
3580
+ function* generateIndex(spec, renderMarkdownFn, includeTypes) {
3581
+ const parentCrumbs = {};
3582
+ for (const { data } of walkTree(spec, true)) {
3583
+ const { kind, name, title, stainlessPath } = data;
3584
+ const common = {
3585
+ name,
3586
+ title,
3587
+ stainlessPath
3588
+ };
3589
+ const crumbs = getResourceNames(parseStainlessPath(stainlessPath).resource, spec.resources);
3590
+ switch (kind) {
3591
+ case "resource":
3592
+ for (const language of Languages) {
3593
+ if (!data[language]) continue;
3594
+ parentCrumbs[stainlessPath] = crumbs;
3595
+ const { Name, QualifiedName } = data[language];
3596
+ yield {
3597
+ kind,
3598
+ crumbs,
3599
+ language,
3600
+ Name,
3601
+ QualifiedName,
3602
+ priority: 0,
3603
+ ...common
3604
+ };
3605
+ }
3606
+ break;
3607
+ case "http_method": {
3608
+ const { summary, endpoint, httpMethod } = data;
3609
+ for (const language of Languages) {
3610
+ const found = spec.decls[language]?.[stainlessPath];
3611
+ if (!found) continue;
3612
+ parentCrumbs[stainlessPath] = [...crumbs, title];
3613
+ const qualified = "qualified" in found ? found["qualified"] : void 0;
3614
+ const ident = qualified?.split(".")?.at(-1);
3615
+ yield {
3616
+ kind,
3617
+ crumbs: [...crumbs, title],
3618
+ ident,
3619
+ qualified,
3620
+ language,
3621
+ description: data.description ? renderMarkdownFn?.(data.description) ?? data.description : void 0,
3622
+ endpoint: endpoint.slice(httpMethod.length).trim(),
3623
+ httpMethod,
3624
+ summary,
3625
+ priority: 0,
3626
+ ...common
3627
+ };
3628
+ }
3629
+ break;
3630
+ }
3631
+ case "model": for (const language of Languages) {
3632
+ if (!spec.decls[language]) continue;
3633
+ parentCrumbs[stainlessPath] = [...crumbs, title];
3634
+ const schema = spec.decls[language]?.[`${stainlessPath} > (schema)`];
3635
+ const children = (schema && "children" in schema ? schema?.["children"] : void 0)?.map((childPath) => {
3636
+ const child = spec.decls?.[language]?.[childPath];
3637
+ return child?.["ident"] ?? child?.["name"] ?? child?.["key"] ?? child?.["type"]?.["literal"]?.["value"] ?? child?.["type"]?.["literal"] ?? child?.["type"]?.["value"];
3638
+ })?.filter((child) => child) ?? [];
3639
+ yield {
3640
+ kind,
3641
+ crumbs: [...crumbs, title],
3642
+ children,
3643
+ language,
3644
+ priority: 2,
3645
+ ident: schema && "ident" in schema ? schema?.["ident"] : void 0,
3646
+ ...common
3647
+ };
3648
+ }
3649
+ }
3650
+ }
3651
+ for (const language of Languages) {
3652
+ const decls = spec.decls?.[language];
3653
+ if (!decls) continue;
3654
+ for (const decl of Object.values(decls)) switch (decl.kind) {
3655
+ case "JavaDeclProperty":
3656
+ case "GoDeclProperty":
3657
+ case "PythonDeclProperty":
3658
+ case "RubyDeclProperty":
3659
+ case "HttpDeclProperty":
3660
+ case "TSDeclProperty":
3661
+ {
3662
+ const parsedPath = parseStainlessPath(decl.stainlessPath);
3663
+ const type = includeTypes === false ? void 0 : typeName(language, decl.type);
3664
+ const name = decl["ident"] ?? decl["name"] ?? decl["key"];
3665
+ const parent = parentCrumbs[parsedPath.routable];
3666
+ if (parent === void 0) continue;
3667
+ const matches = decl.stainlessPath.matchAll(/\((property|params|param)\) ([^\s]+)/g);
3668
+ const props = Array.from(matches).map((p) => p[2]).filter((p) => p !== void 0);
3669
+ yield {
3670
+ kind: "property",
3671
+ name,
3672
+ stainlessPath: decl.stainlessPath,
3673
+ crumbs: [...parent, ...props],
3674
+ docstring: decl.docstring ? renderMarkdownFn?.(decl.docstring) ?? decl.docstring : void 0,
3675
+ type,
3676
+ language,
3677
+ priority: 3
3678
+ };
3679
+ }
3680
+ break;
3681
+ }
3682
+ }
3683
+ }
3684
+
3685
+ //#endregion
3686
+ //#region src/search/providers/algolia.ts
3687
+ async function buildIndex(appId, indexName, writeKey, spec, renderMarkdown$1) {
3688
+ if (!appId || !indexName || !writeKey) return;
3689
+ const objects = Array.from(generateIndex(spec, renderMarkdown$1));
3690
+ const client = searchClient(appId, writeKey);
3691
+ await client.setSettings({
3692
+ indexName,
3693
+ indexSettings: {
3694
+ highlightPreTag: "<mark>",
3695
+ highlightPostTag: "</mark>",
3696
+ customRanking: ["asc(priority)"],
3697
+ attributesForFaceting: ["language", "kind"],
3698
+ searchableAttributes: [...SearchableAttributes]
3699
+ }
3700
+ });
3701
+ await client.replaceAllObjects({
3702
+ indexName,
3703
+ objects
3704
+ });
3705
+ }
3706
+ async function buildChatIndex(appId, indexName, writeKey, spec) {
3707
+ if (!appId || !indexName || !writeKey) return;
3708
+ const objects = Array.from(generateChatIndex(spec));
3709
+ const client = searchClient(appId, writeKey);
3710
+ await client.setSettings({
3711
+ indexName,
3712
+ indexSettings: {
3713
+ attributesForFaceting: ["language"],
3714
+ attributeForDistinct: "stainlessPath",
3715
+ searchableAttributes: SearchableAttributesChat
3716
+ }
3717
+ });
3718
+ await client.replaceAllObjects({
3719
+ indexName,
3720
+ objects
3721
+ });
3722
+ }
3723
+ async function search({ settings: { appId, indexName, searchKey }, params: { query, language, kind } }) {
3724
+ const client = searchClient(appId, searchKey);
3725
+ const filters = language ? `language:${language}` : void 0;
3726
+ const facetFilters = kind ? [`kind:${kind}`] : void 0;
3727
+ const { results } = await client.search({ requests: [{
3728
+ query,
3729
+ indexName,
3730
+ filters,
3731
+ hitsPerPage: 5,
3732
+ facets: ["kind"]
3733
+ }, {
3734
+ query,
3735
+ indexName,
3736
+ filters,
3737
+ facetFilters,
3738
+ facets: ["kind"],
3739
+ hitsPerPage: 50
3740
+ }] });
3741
+ if ("hits" in results[0] && "hits" in results[1]) {
3742
+ const [{ nbHits, facets }, { hits }] = results;
3743
+ return {
3744
+ hits,
3745
+ nbHits: nbHits ?? 0,
3746
+ facets
3747
+ };
3748
+ }
3749
+ }
3750
+
3751
+ //#endregion
3752
+ //#region src/contexts/search.tsx
3753
+ const [Provider, useSearchContext] = createStrictContext("SearchContext");
3754
+ function useSearch() {
3755
+ const { settings } = useSearchContext();
3756
+ return (params) => search({
3757
+ settings,
3758
+ params
3759
+ });
3760
+ }
3761
+ function SearchProvider({ children, ...props }) {
3762
+ return /* @__PURE__ */ jsx(Provider, {
3763
+ value: props,
3764
+ children
3765
+ });
3766
+ }
3767
+
3768
+ //#endregion
3769
+ //#region src/contexts/index.tsx
3770
+ var contexts_exports = /* @__PURE__ */ __export({
3771
+ ComponentProvider: () => ComponentProvider$1,
3772
+ DocsProvider: () => DocsProvider,
3773
+ MarkdownContext: () => MarkdownContext,
3774
+ MarkdownProvider: () => MarkdownProvider,
3775
+ NavigationProvider: () => NavigationProvider,
3776
+ SearchProvider: () => SearchProvider,
3777
+ customizeComponents: () => customizeComponents,
3778
+ useComponentContext: () => useComponentContext,
3779
+ useComponents: () => useComponents$1,
3780
+ useContentPanelLayout: () => useContentPanelLayout,
3781
+ useDeclaration: () => useDeclaration,
3782
+ useDocs: () => useDocs,
3783
+ useHighlight: () => useHighlight,
3784
+ useLanguage: () => useLanguage,
3785
+ useLanguageComponents: () => useLanguageComponents,
3786
+ useMarkdownContext: () => useMarkdownContext,
3787
+ useNavigation: () => useNavigation,
3788
+ useRenderMarkdown: () => useRenderMarkdown,
3789
+ useResource: () => useResource,
3790
+ useSearch: () => useSearch,
3791
+ useSearchContext: () => useSearchContext,
3792
+ useSettings: () => useSettings,
3793
+ useSnippet: () => useSnippet,
3794
+ useSpec: () => useSpec
3795
+ });
3796
+ function useLanguageComponents() {
3797
+ const language = useLanguage();
3798
+ const definition = useComponentContext().language[language];
3799
+ if (!definition) throw new Error(`Language component definition not found for language: ${language}`);
3800
+ return definition;
3801
+ }
3802
+
3803
+ //#endregion
3804
+ export { TypeName$5 as $, PropertyDescription as $t, ruby_exports as A, SDKRequestTitle as At, Type$3 as B, Markdown as Bt, TypeName as C, SDKIcon as Ct, Property$1 as D, SDKMethodInfo as Dt, MethodSignature$1 as E, SDKMethodHeader as Et, TypeName$2 as F, Expander as Ft, Property$4 as G, HttpMethods as Gt, go_exports as H, Tooltip as Ht, python_exports as I, Input as It, java_exports as J, MethodHeader as Jt, Type$4 as K, Method as Kt, Declaration$3 as L, Join as Lt, MethodSignature$2 as M, usePropertyModel as Mt, Property$2 as N, useReferenceNesting as Nt, Type$1 as O, SDKModel as Ot, Type$2 as P, Badge as Pt, Type$5 as Q, Property$6 as Qt, MethodSignature$3 as R, Link as Rt, Type as S, SDKExample as St, Declaration$1 as T, SDKMethod as Tt, Declaration$4 as U, VirtualExpander as Ut, TypeName$3 as V, ToggleButton as Vt, MethodSignature$4 as W, HttpMethodIcons as Wt, MethodSignature$5 as X, MethodInfo$1 as Xt, Declaration$5 as Y, MethodIconBadge as Yt, Property$5 as Z, MethodRoute as Zt, node as _, PropertyModelContext as _t, useSearchContext as a, SidebarResource as at, MethodSignature as b, SDKConstraints as bt, search as c, SDKOverview as ct, render as d, SDKRoot as dt, PropertyToggle as en, typescript_exports as et, renderMarkdown as f, Snippet as ft, languages_exports as g, SnippetResponse as gt, kotlin as h, SnippetRequestContainer as ht, useSearch as i, SidebarMethod as it, Declaration$2 as j, SDKSnippetLanguages as jt, TypeName$1 as k, SDKReference as kt, generateIndex as l, SDKResource as lt, defaultContextValue as m, SnippetContainer as mt, useLanguageComponents as n, Sidebar as nt, buildChatIndex as o, SDKBreadcrumbs as ot, ComponentProvider as p, SnippetCode as pt, TypeName$4 as q, MethodDescription as qt, SearchProvider as r, SidebarExpander as rt, buildIndex as s, SDKMethodSummary as st, contexts_exports as t, components_exports as tt, declaration as u, SDKResourceHeader as ut, Declaration as v, ReferenceNestingContext as vt, http_exports as w, SDKLanguageBlock as wt, Property as x, SDKDeclaration as xt, MethodInfo as y, SDKChildren as yt, Property$3 as z, ListView as zt };