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

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-wJ7A9MGt.d.ts +20 -0
  2. package/dist/chunk-DsStOjWQ.js +13 -0
  3. package/dist/component-generics--y1IC_M-.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-CMNI3ctP.js +3799 -0
  46. package/dist/docs-BvahWQ28.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-BmPNhnpe.d.ts +14 -0
  50. package/dist/index-D5NMSAld.d.ts +240 -0
  51. package/dist/index-rVFBdVz8.d.ts +15 -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-BmpyokB7.js +43 -0
  75. package/dist/markdown-w5UpIiGc.d.ts +22 -0
  76. package/dist/md-DxiV1_vy.js +41 -0
  77. package/dist/method-CLpRObBV.d.ts +71 -0
  78. package/dist/navigation-Blr3LaES.d.ts +29 -0
  79. package/dist/navigation-CGr5_w6z.js +24 -0
  80. package/dist/overview-DBnqhjAg.d.ts +39 -0
  81. package/dist/pagefind-BaK1krMe.js +15 -0
  82. package/dist/primitives-BFubD3w8.d.ts +99 -0
  83. package/dist/properties-DeQRa6VK.d.ts +46 -0
  84. package/dist/routing-8itEXLx6.js +189 -0
  85. package/dist/routing-DNN8R6bZ.d.ts +54 -0
  86. package/dist/routing.d.ts +2 -0
  87. package/dist/routing.js +3 -180
  88. package/dist/sdk-BVQyp5Dw.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-CPp6HpUy.d.ts +21 -0
  102. package/dist/sidebar-BoPLeaxp.d.ts +36 -0
  103. package/dist/snippets-DLHH_Voi.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 +34 -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-DNSz4kuM.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-DVi3gJLL.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,3799 @@
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-BmpyokB7.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: `${style_default.Markdown} ${style_default.Content}`,
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 && (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
+ if (responseType === "application/json") value = JSON.stringify(value, null, 2);
920
+ return {
921
+ responseCode: key,
922
+ content: value
923
+ };
924
+ }).filter(Boolean);
925
+ if (mappedResponses.length === 0) return null;
926
+ return /* @__PURE__ */ jsx("div", {
927
+ className: style_default.SnippetMultiResponse,
928
+ children: /* @__PURE__ */ jsxs("div", {
929
+ className: clsx(style_default.Snippet),
930
+ children: [/* @__PURE__ */ jsx("div", {
931
+ className: clsx(style_default.SnippetResponseTab, mappedResponses.length === 1 && style_default.SnippetResponseTabSingleReturn),
932
+ children: mappedResponses.map(({ responseCode }, index) => /* @__PURE__ */ jsx("div", {
933
+ "data-snippet-response-tab-id": `snippet-response-tab-${responseCode}-${index}`,
934
+ className: clsx(style_default.SnippetResponseTabItem, index === 0 && style_default.SnippetResponseTabItemActive),
935
+ children: /* @__PURE__ */ jsxs(Button, {
936
+ disabled: mappedResponses.length === 1,
937
+ variant: "ghost",
938
+ children: [responseCode, " example"]
939
+ })
940
+ }, `snippet-response-tab-item-${responseCode}-${index}`))
941
+ }), mappedResponses.map(({ responseCode, content }, index) => {
942
+ return /* @__PURE__ */ jsx("div", {
943
+ className: clsx(style_default.SnippetResponsePane, index === 0 && style_default.SnippetResponsePaneActive),
944
+ "data-snippet-response-pane-id": `snippet-response-tab-${responseCode}-${index}`,
945
+ children: /* @__PURE__ */ jsx(SnippetCode$1, {
946
+ content,
947
+ language: "json"
948
+ })
949
+ }, `snippet-response-${responseCode}-${index}`);
950
+ })]
951
+ })
952
+ });
953
+ }
954
+
955
+ //#endregion
956
+ //#region src/components/overview.tsx
957
+ function SDKResourceHeader({ resource, parents }) {
958
+ const segments = parents?.map((parent, index) => /* @__PURE__ */ jsxs("span", {
959
+ className: style_default.ResourceTitleSegment,
960
+ children: [parent.title, index < parents.length && /* @__PURE__ */ jsx(ChevronRight, {
961
+ size: 16,
962
+ className: style_default.Icon
963
+ })]
964
+ }, parent.stainlessPath));
965
+ if (!segments && !resource.description) return null;
966
+ return /* @__PURE__ */ jsxs("div", {
967
+ className: style_default.ResourceHeader,
968
+ children: [segments && /* @__PURE__ */ jsxs("h4", {
969
+ id: resource.stainlessPath,
970
+ className: style_default.ResourceTitle,
971
+ children: [segments, /* @__PURE__ */ jsx("span", {
972
+ className: style_default.ResourceTitleSegment,
973
+ children: resource.title
974
+ })]
975
+ }), resource.description && /* @__PURE__ */ jsx("div", {
976
+ className: style_default.ResourceDescription,
977
+ children: /* @__PURE__ */ jsx(Markdown, { content: resource.description })
978
+ })]
979
+ });
980
+ }
981
+ function SDKMethodSummary({ method }) {
982
+ const Docs = useComponents();
983
+ const Lang = useLanguageComponents();
984
+ const decl = useDeclaration(method.stainlessPath, true);
985
+ return /* @__PURE__ */ jsx(Docs.MethodHeader, {
986
+ level: "h5",
987
+ title: /* @__PURE__ */ jsx(Docs.Link, {
988
+ stainlessPath: method.stainlessPath,
989
+ children: method.summary ?? method.title
990
+ }),
991
+ signature: /* @__PURE__ */ jsx(Lang.MethodSignature, { decl }),
992
+ badges: method.deprecated && /* @__PURE__ */ jsx(Docs.Badge, {
993
+ id: "deprecated",
994
+ children: "Deprecated"
995
+ }),
996
+ children: /* @__PURE__ */ jsx(Docs.MethodRoute, {
997
+ httpMethod: method.httpMethod,
998
+ endpoint: method.endpoint.split(" ", 2).at(-1)
999
+ })
1000
+ });
1001
+ }
1002
+ function SDKResource({ resource, parents, showModels }) {
1003
+ const Docs = useComponents();
1004
+ const language = useLanguage();
1005
+ const spec = useSpec();
1006
+ const methods = Object.values(resource.methods).filter((method) => spec?.decls?.[language]?.[method.stainlessPath]);
1007
+ const models = Object.values(resource.models).filter((model) => spec?.decls?.[language]?.[`${model.stainlessPath} > (schema)`]);
1008
+ return /* @__PURE__ */ jsx("div", {
1009
+ className: style_default.Resource,
1010
+ children: /* @__PURE__ */ jsxs("div", {
1011
+ className: style_default.ResourceContent,
1012
+ children: [
1013
+ /* @__PURE__ */ jsx(Docs.SDKResourceHeader, {
1014
+ resource,
1015
+ parents
1016
+ }),
1017
+ methods.length > 0 && /* @__PURE__ */ jsx("div", {
1018
+ className: style_default.ResourceContentGroup,
1019
+ children: methods.map((method) => /* @__PURE__ */ jsx("div", {
1020
+ className: style_default.MethodSummary,
1021
+ children: /* @__PURE__ */ jsx(Docs.SDKMethodSummary, { method })
1022
+ }, method.stainlessPath))
1023
+ }),
1024
+ showModels !== false && models.length > 0 && /* @__PURE__ */ jsxs("div", {
1025
+ className: style_default.ResourceContentGroup,
1026
+ "data-stldocs-property-group": "models",
1027
+ children: [/* @__PURE__ */ jsxs("h5", {
1028
+ className: style_default.ResourceContentGroupModelTitle,
1029
+ children: ["Models", /* @__PURE__ */ jsx(PropertyToggle, { target: "models" })]
1030
+ }), models.map((model) => /* @__PURE__ */ jsx(Docs.SDKModel, { model }, model.stainlessPath))]
1031
+ })
1032
+ ]
1033
+ })
1034
+ });
1035
+ }
1036
+ function SDKOverview({ resource }) {
1037
+ const { SDKResource: SDKResource$1 } = useComponents();
1038
+ const nested = React$1.useMemo(() => flatResources(resource.subresources, [resource]), [resource]);
1039
+ return /* @__PURE__ */ jsxs("div", {
1040
+ className: style_default.Overview,
1041
+ children: [
1042
+ /* @__PURE__ */ jsx("div", {
1043
+ className: style_default.OverviewHeader,
1044
+ children: /* @__PURE__ */ jsx("h1", { children: resource.title })
1045
+ }),
1046
+ /* @__PURE__ */ jsx(SDKResource$1, { resource }),
1047
+ nested.map((props, index) => /* @__PURE__ */ createElement(SDKResource$1, {
1048
+ ...props,
1049
+ key: index
1050
+ }))
1051
+ ]
1052
+ });
1053
+ }
1054
+ function SDKRoot({ stainlessPath }) {
1055
+ const spec = useSpec();
1056
+ const Docs = useComponents();
1057
+ const parsed = parseStainlessPath(stainlessPath);
1058
+ const resource = spec && getResourceFromSpec(stainlessPath, spec);
1059
+ if (!resource || !parsed) {
1060
+ console.warn(`Could not find resource or parsed path for '${stainlessPath}'`);
1061
+ return null;
1062
+ }
1063
+ if (parsed.method) {
1064
+ const method = resource.methods[parsed.method];
1065
+ if (!method) {
1066
+ console.warn(`Method '${parsed.method}' not found in resource '${resource.stainlessPath}'`);
1067
+ return null;
1068
+ }
1069
+ return /* @__PURE__ */ jsx("div", {
1070
+ className: style_default.Root,
1071
+ children: /* @__PURE__ */ jsx(Docs.SDKMethod, { method })
1072
+ });
1073
+ }
1074
+ return /* @__PURE__ */ jsx("div", {
1075
+ className: style_default.Root,
1076
+ children: /* @__PURE__ */ jsx(Docs.SDKOverview, { resource })
1077
+ });
1078
+ }
1079
+
1080
+ //#endregion
1081
+ //#region src/components/breadcrumbs.tsx
1082
+ function generateApiBreadcrumbs(fullPath, spec, basePath) {
1083
+ const cleanBasePath = basePath.replace(/\/+$/, "");
1084
+ const cleanPath = fullPath.replace(/\/+$/, "");
1085
+ if (!cleanPath.startsWith(cleanBasePath)) return null;
1086
+ const rest = cleanPath.slice(cleanBasePath.length).split("/").filter(Boolean);
1087
+ const breadcrumbs = [];
1088
+ let href = cleanBasePath;
1089
+ let i = 0;
1090
+ if (Languages.includes(rest[0])) {
1091
+ href += `/${rest[0]}`;
1092
+ i++;
1093
+ }
1094
+ breadcrumbs.push({
1095
+ title: "API Reference",
1096
+ href
1097
+ });
1098
+ let currentSpec = spec;
1099
+ while (i < rest.length) {
1100
+ const idType = rest[i];
1101
+ const idValue = rest[i + 1];
1102
+ if (!idType || !idValue || !currentSpec?.[idType]?.[idValue]) break;
1103
+ currentSpec = currentSpec[idType][idValue];
1104
+ href += `/${idType}/${idValue}`;
1105
+ const title = (idType === "methods" ? currentSpec.summary : currentSpec.title) ?? idValue;
1106
+ breadcrumbs.push({
1107
+ title,
1108
+ href
1109
+ });
1110
+ i += 2;
1111
+ }
1112
+ return breadcrumbs;
1113
+ }
1114
+ function SDKBreadcrumbs({ spec, currentPath, basePath = "/api", config = { includeCurrentPage: false } }) {
1115
+ const breadcrumbs = generateApiBreadcrumbs(currentPath, spec, basePath);
1116
+ if (!breadcrumbs || breadcrumbs.length === 0) return null;
1117
+ if (!config?.includeCurrentPage && breadcrumbs.length > 1) breadcrumbs.pop();
1118
+ const items = breadcrumbs.map((crumb, index) => /* @__PURE__ */ jsx("div", {
1119
+ className: style_default.BreadcrumbsItem,
1120
+ children: /* @__PURE__ */ jsx("a", {
1121
+ href: crumb.href,
1122
+ className: style_default.BreadcrumbsLink,
1123
+ children: crumb.title
1124
+ })
1125
+ }, index));
1126
+ return /* @__PURE__ */ jsx("div", {
1127
+ className: style_default.Breadcrumbs,
1128
+ children: /* @__PURE__ */ jsx(Join, {
1129
+ limit: breadcrumbs.length,
1130
+ items,
1131
+ children: /* @__PURE__ */ jsx(ChevronRight, {})
1132
+ })
1133
+ });
1134
+ }
1135
+
1136
+ //#endregion
1137
+ //#region src/components/sidebar.tsx
1138
+ function SidebarExpander({ open, summary, children }) {
1139
+ return /* @__PURE__ */ jsxs("details", {
1140
+ className: style_default.SidebarExpander,
1141
+ open,
1142
+ children: [/* @__PURE__ */ jsxs("summary", {
1143
+ className: style_default.ExpanderSummary,
1144
+ children: [/* @__PURE__ */ jsx("div", {
1145
+ className: style_default.ExpanderSummaryContent,
1146
+ children: summary
1147
+ }), /* @__PURE__ */ jsxs("div", {
1148
+ className: style_default.ExpanderSummaryIcon,
1149
+ children: [/* @__PURE__ */ jsx(ChevronRight, {
1150
+ size: 16,
1151
+ strokeWidth: 1,
1152
+ className: style_default.Icon
1153
+ }), /* @__PURE__ */ jsx(ChevronDown, {
1154
+ size: 16,
1155
+ strokeWidth: 1,
1156
+ className: style_default.Icon
1157
+ })]
1158
+ })]
1159
+ }), /* @__PURE__ */ jsx("div", {
1160
+ className: style_default.ExpanderContent,
1161
+ children
1162
+ })]
1163
+ });
1164
+ }
1165
+ function SidebarMethod({ method }) {
1166
+ const Docs = useComponents();
1167
+ const { selectedPath } = useNavigation();
1168
+ return /* @__PURE__ */ jsxs("div", {
1169
+ className: style_default.SidebarMethod,
1170
+ "data-selected": method.stainlessPath === selectedPath,
1171
+ children: [/* @__PURE__ */ jsx(MethodIconBadge, { httpMethod: method.httpMethod }), /* @__PURE__ */ jsx(Docs.Link, {
1172
+ stainlessPath: method.stainlessPath,
1173
+ children: method.summary
1174
+ })]
1175
+ });
1176
+ }
1177
+ function SidebarResource({ resource }) {
1178
+ const Docs = useComponents();
1179
+ const { selectedPath } = useNavigation();
1180
+ const subresources = Object.values(resource.subresources ?? {}).map((sub) => /* @__PURE__ */ jsx(SidebarResource, { resource: sub }, sub.stainlessPath));
1181
+ const methods = Object.values(resource.methods).map((method) => /* @__PURE__ */ jsx(SidebarMethod, { method }, method.stainlessPath));
1182
+ const hasChildren = subresources.length > 0 || methods.length > 0;
1183
+ const title = /* @__PURE__ */ jsx("div", {
1184
+ className: style_default.SidebarResourceTitle,
1185
+ children: /* @__PURE__ */ jsx(Docs.Link, {
1186
+ stainlessPath: resource.stainlessPath,
1187
+ children: resource.title
1188
+ })
1189
+ });
1190
+ return /* @__PURE__ */ jsx("div", {
1191
+ className: style_default.SidebarResource,
1192
+ "data-selected": resource.stainlessPath === selectedPath,
1193
+ children: hasChildren ? /* @__PURE__ */ jsxs(SidebarExpander, {
1194
+ summary: title,
1195
+ open: true,
1196
+ children: [methods, subresources]
1197
+ }) : title
1198
+ });
1199
+ }
1200
+ function Sidebar({ resources }) {
1201
+ return /* @__PURE__ */ jsx("div", {
1202
+ className: `${style_default.Root} ${style_default.Sidebar}`,
1203
+ children: resources.filter((resource) => !isResourceEmpty(resource)).map((resource) => /* @__PURE__ */ jsx(SidebarResource, { resource }, resource.stainlessPath))
1204
+ });
1205
+ }
1206
+
1207
+ //#endregion
1208
+ //#region src/components/index.ts
1209
+ var components_exports = /* @__PURE__ */ __export({
1210
+ Badge: () => Badge,
1211
+ Expander: () => Expander,
1212
+ HttpMethodIcons: () => HttpMethodIcons,
1213
+ HttpMethods: () => HttpMethods,
1214
+ Input: () => Input,
1215
+ Join: () => Join,
1216
+ Link: () => Link,
1217
+ ListView: () => ListView,
1218
+ Markdown: () => Markdown,
1219
+ Method: () => Method,
1220
+ MethodDescription: () => MethodDescription,
1221
+ MethodHeader: () => MethodHeader,
1222
+ MethodIconBadge: () => MethodIconBadge,
1223
+ MethodInfo: () => MethodInfo$1,
1224
+ MethodRoute: () => MethodRoute,
1225
+ Property: () => Property$6,
1226
+ PropertyDescription: () => PropertyDescription,
1227
+ PropertyModelContext: () => PropertyModelContext,
1228
+ PropertyToggle: () => PropertyToggle,
1229
+ ReferenceNestingContext: () => ReferenceNestingContext,
1230
+ SDKBreadcrumbs: () => SDKBreadcrumbs,
1231
+ SDKChildren: () => SDKChildren,
1232
+ SDKConstraints: () => SDKConstraints,
1233
+ SDKDeclaration: () => SDKDeclaration,
1234
+ SDKExample: () => SDKExample,
1235
+ SDKIcon: () => SDKIcon,
1236
+ SDKLanguageBlock: () => SDKLanguageBlock,
1237
+ SDKMethod: () => SDKMethod,
1238
+ SDKMethodHeader: () => SDKMethodHeader,
1239
+ SDKMethodInfo: () => SDKMethodInfo,
1240
+ SDKMethodSummary: () => SDKMethodSummary,
1241
+ SDKModel: () => SDKModel,
1242
+ SDKOverview: () => SDKOverview,
1243
+ SDKReference: () => SDKReference,
1244
+ SDKRequestTitle: () => SDKRequestTitle,
1245
+ SDKResource: () => SDKResource,
1246
+ SDKResourceHeader: () => SDKResourceHeader,
1247
+ SDKRoot: () => SDKRoot,
1248
+ SDKSnippetLanguages: () => SDKSnippetLanguages,
1249
+ Sidebar: () => Sidebar,
1250
+ SidebarExpander: () => SidebarExpander,
1251
+ SidebarMethod: () => SidebarMethod,
1252
+ SidebarResource: () => SidebarResource,
1253
+ Snippet: () => Snippet,
1254
+ SnippetCode: () => SnippetCode,
1255
+ SnippetContainer: () => SnippetContainer,
1256
+ SnippetRequestContainer: () => SnippetRequestContainer,
1257
+ SnippetResponse: () => SnippetResponse,
1258
+ ToggleButton: () => ToggleButton,
1259
+ Tooltip: () => Tooltip,
1260
+ VirtualExpander: () => VirtualExpander,
1261
+ usePropertyModel: () => usePropertyModel,
1262
+ useReferenceNesting: () => useReferenceNesting
1263
+ });
1264
+
1265
+ //#endregion
1266
+ //#region src/languages/typescript.tsx
1267
+ var typescript_exports = /* @__PURE__ */ __export({
1268
+ Declaration: () => Declaration$5,
1269
+ MethodSignature: () => MethodSignature$5,
1270
+ Property: () => Property$5,
1271
+ Type: () => Type$5,
1272
+ TypeName: () => TypeName$5
1273
+ });
1274
+ const ComplexTypes$3 = {
1275
+ TSTypeObject: "object",
1276
+ TSTypeUnion: "union",
1277
+ TSTypeInterface: "interface",
1278
+ TSTypeIntersection: "intersection",
1279
+ TSTypeArray: "array"
1280
+ };
1281
+ const constStyle$3 = {
1282
+ string: style_default.LiteralString,
1283
+ number: style_default.LiteralNumeric,
1284
+ boolean: style_default.LiteralBoolean
1285
+ };
1286
+ function Identifier$1({ name, optional }) {
1287
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
1288
+ className: style_default.TextIdentifier,
1289
+ children: /^[_a-zA-Z][_a-zA-Z0-9]*$/.test(name) ? name : JSON.stringify(name)
1290
+ }), optional && /* @__PURE__ */ jsx("span", {
1291
+ className: style_default.TextPunctuation,
1292
+ children: "?"
1293
+ })] });
1294
+ }
1295
+ function TypeParams({ params }) {
1296
+ const Lang = useLanguageComponents();
1297
+ const { Join: Join$1 } = useComponents();
1298
+ if (!params?.length) return null;
1299
+ const typeParams = params?.map((param, key) => param.constraint ? /* @__PURE__ */ jsxs(React$1.Fragment, { children: [
1300
+ /* @__PURE__ */ jsx("span", {
1301
+ className: style_default.TypeReference,
1302
+ children: param.name
1303
+ }),
1304
+ /* @__PURE__ */ jsx("span", {
1305
+ className: style_default.TextKeyword,
1306
+ children: "extends "
1307
+ }),
1308
+ /* @__PURE__ */ jsx(Lang.Type, { type: param.constraint })
1309
+ ] }, key) : /* @__PURE__ */ jsx(React$1.Fragment, { children: "param.name" }, key));
1310
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1311
+ /* @__PURE__ */ jsx("span", {
1312
+ className: style_default.TypeBracket,
1313
+ children: "<"
1314
+ }),
1315
+ /* @__PURE__ */ jsx(Join$1, {
1316
+ items: typeParams,
1317
+ limit: 3,
1318
+ children: /* @__PURE__ */ jsx("span", {
1319
+ className: style_default.TextOperator,
1320
+ children: ", "
1321
+ })
1322
+ }),
1323
+ /* @__PURE__ */ jsx("span", {
1324
+ className: style_default.TypeBracket,
1325
+ children: ">"
1326
+ })
1327
+ ] });
1328
+ }
1329
+ function TypePreview$2({ path }) {
1330
+ const spec = useSpec();
1331
+ const language = useLanguage();
1332
+ const decl = useDeclaration(path, false);
1333
+ const { Join: Join$1 } = useComponents();
1334
+ if (!(decl && "children" in decl && decl.children && decl.children.length > 0) || decl && "type" in decl && "kind" in decl["type"] && decl["type"]["kind"] === "TSTypeUnion") return;
1335
+ const items = decl.children.map((prop, key) => {
1336
+ const p = spec?.decls?.[language]?.[prop];
1337
+ return /* @__PURE__ */ jsx("span", {
1338
+ className: style_default.TypePropertyName,
1339
+ children: /* @__PURE__ */ jsx("span", {
1340
+ className: style_default.TextIdentifier,
1341
+ children: p && "key" in p ? p["key"] : null
1342
+ })
1343
+ }, key);
1344
+ });
1345
+ return /* @__PURE__ */ jsxs("span", {
1346
+ className: style_default.TypePreview,
1347
+ "data-stldocs-type-preview": "properties",
1348
+ children: [
1349
+ /* @__PURE__ */ jsx("span", {
1350
+ className: style_default.TypeBrace,
1351
+ children: " {"
1352
+ }),
1353
+ /* @__PURE__ */ jsxs("span", {
1354
+ className: style_default.TypePreviewContent,
1355
+ children: [
1356
+ " ",
1357
+ /* @__PURE__ */ jsx(Join$1, {
1358
+ items,
1359
+ limit: 3,
1360
+ children: /* @__PURE__ */ jsx("span", {
1361
+ className: style_default.TextOperator,
1362
+ children: ", "
1363
+ })
1364
+ }),
1365
+ " "
1366
+ ]
1367
+ }),
1368
+ /* @__PURE__ */ jsx("span", {
1369
+ className: style_default.TypeBrace,
1370
+ children: "} "
1371
+ })
1372
+ ]
1373
+ });
1374
+ }
1375
+ function TypeName$5({ type }) {
1376
+ const Lang = useLanguageComponents();
1377
+ return ComplexTypes$3[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
1378
+ }
1379
+ function Type$5({ type }) {
1380
+ const Lang = useLanguageComponents();
1381
+ const { Join: Join$1, SDKReference: SDKReference$1 } = useComponents();
1382
+ switch (type.kind) {
1383
+ case "TSTypeUnknown":
1384
+ case "TSTypeUndefined":
1385
+ case "TSTypeNever":
1386
+ case "TSTypeVoid":
1387
+ case "TSTypeNull":
1388
+ case "TSTypeAny":
1389
+ case "TSTypeBoolean":
1390
+ case "TSTypeNumber": return /* @__PURE__ */ jsx("span", {
1391
+ className: style_default.Type,
1392
+ children: /* @__PURE__ */ jsx("span", {
1393
+ className: style_default.TypeKeyword,
1394
+ children: type.kind.slice(6).toLowerCase()
1395
+ })
1396
+ });
1397
+ case "TSTypeString": return /* @__PURE__ */ jsx("span", {
1398
+ className: style_default.Type,
1399
+ children: /* @__PURE__ */ jsx("span", {
1400
+ className: style_default.TypeString,
1401
+ children: "string"
1402
+ })
1403
+ });
1404
+ case "TSTypeLiteral": return /* @__PURE__ */ jsx("span", {
1405
+ className: style_default.Type,
1406
+ children: /* @__PURE__ */ jsx("span", {
1407
+ className: constStyle$3[typeof type.literal],
1408
+ children: JSON.stringify(type.literal)
1409
+ })
1410
+ });
1411
+ case "TSTypeArray": return /* @__PURE__ */ jsxs("span", {
1412
+ className: style_default.Type,
1413
+ children: [
1414
+ /* @__PURE__ */ jsx("span", {
1415
+ className: style_default.TypeArray,
1416
+ children: "Array<"
1417
+ }),
1418
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType }),
1419
+ /* @__PURE__ */ jsx("span", {
1420
+ className: style_default.TypeArray,
1421
+ children: ">"
1422
+ })
1423
+ ]
1424
+ });
1425
+ case "TSTypeReference": {
1426
+ const name = type.ident.split(".").at(-1);
1427
+ const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
1428
+ return /* @__PURE__ */ jsxs("span", {
1429
+ className: style_default.Type,
1430
+ children: [
1431
+ /* @__PURE__ */ jsx(SDKReference$1, {
1432
+ stainlessPath: type.$ref,
1433
+ children: name
1434
+ }),
1435
+ params && params.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
1436
+ /* @__PURE__ */ jsx("span", {
1437
+ className: style_default.TypeBracket,
1438
+ children: "<"
1439
+ }),
1440
+ /* @__PURE__ */ jsx(Join$1, {
1441
+ items: params,
1442
+ limit: 3,
1443
+ children: /* @__PURE__ */ jsx("span", {
1444
+ className: style_default.TextOperator,
1445
+ children: ", "
1446
+ })
1447
+ }),
1448
+ /* @__PURE__ */ jsx("span", {
1449
+ className: style_default.TypeBracket,
1450
+ children: ">"
1451
+ })
1452
+ ] }),
1453
+ /* @__PURE__ */ jsx(TypePreview$2, { path: type.$ref })
1454
+ ]
1455
+ });
1456
+ }
1457
+ case "TSTypeIntersection":
1458
+ case "TSTypeUnion": {
1459
+ const items = type.types.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
1460
+ const delimiter = type.kind === "TSTypeUnion" ? "|" : "&";
1461
+ return /* @__PURE__ */ jsx("span", {
1462
+ className: style_default.Type,
1463
+ children: /* @__PURE__ */ jsx("span", {
1464
+ className: style_default.TypePreview,
1465
+ "data-stldocs-type-preview": "union",
1466
+ children: /* @__PURE__ */ jsx("span", {
1467
+ className: style_default.TypePreviewContent,
1468
+ children: /* @__PURE__ */ jsx(Join$1, {
1469
+ items,
1470
+ limit: 3,
1471
+ children: /* @__PURE__ */ jsxs("span", {
1472
+ className: style_default.TextOperator,
1473
+ children: [
1474
+ " ",
1475
+ delimiter,
1476
+ " "
1477
+ ]
1478
+ })
1479
+ })
1480
+ })
1481
+ })
1482
+ });
1483
+ }
1484
+ case "TSTypeObject":
1485
+ case "TSTypeInterface": {
1486
+ const extend = type.kind === "TSTypeObject" ? null : type.extends?.map((ref, key) => /* @__PURE__ */ jsx(Lang.Type, { type: ref }, key));
1487
+ const items = type.members.map((prop, key) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [
1488
+ /* @__PURE__ */ jsx("span", {
1489
+ className: style_default.TypePropertyName,
1490
+ children: /* @__PURE__ */ jsx(Identifier$1, {
1491
+ name: prop.ident,
1492
+ optional: prop.optional
1493
+ })
1494
+ }),
1495
+ /* @__PURE__ */ jsx("span", {
1496
+ className: style_default.TextPunctuation,
1497
+ children: ": "
1498
+ }),
1499
+ /* @__PURE__ */ jsx(Lang.Type, { type: prop.type })
1500
+ ] }, key));
1501
+ return /* @__PURE__ */ jsxs("span", {
1502
+ className: style_default.Type,
1503
+ children: [extend?.length && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
1504
+ className: style_default.TypeKeyword,
1505
+ children: " extends "
1506
+ }), /* @__PURE__ */ jsx(Join$1, {
1507
+ items: extend,
1508
+ limit: 3,
1509
+ children: /* @__PURE__ */ jsx("span", {
1510
+ className: style_default.TextOperator,
1511
+ children: ", "
1512
+ })
1513
+ })] }), /* @__PURE__ */ jsxs("span", {
1514
+ className: style_default.TypePreview,
1515
+ "data-stldocs-type-preview": "properties",
1516
+ children: [
1517
+ /* @__PURE__ */ jsx("span", {
1518
+ className: style_default.TypeBrace,
1519
+ children: "{ "
1520
+ }),
1521
+ /* @__PURE__ */ jsx("span", {
1522
+ className: style_default.TypePreviewContent,
1523
+ children: /* @__PURE__ */ jsx(Join$1, {
1524
+ items,
1525
+ limit: 3,
1526
+ children: /* @__PURE__ */ jsx("span", {
1527
+ className: style_default.TextOperator,
1528
+ children: ", "
1529
+ })
1530
+ })
1531
+ }),
1532
+ /* @__PURE__ */ jsx("span", {
1533
+ className: style_default.TypeBrace,
1534
+ children: "} "
1535
+ })
1536
+ ]
1537
+ })]
1538
+ });
1539
+ }
1540
+ }
1541
+ }
1542
+ function MethodSignature$5({ decl }) {
1543
+ const Lang = useLanguageComponents();
1544
+ const { Join: Join$1, Tooltip: Tooltip$1 } = useComponents();
1545
+ const params = decl.signature.parameters.map((param, i) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx(Tooltip$1, {
1546
+ content: /* @__PURE__ */ jsx(Lang.Type, { type: param.type }),
1547
+ children: /* @__PURE__ */ jsx("span", {
1548
+ className: style_default.TextIdentifier,
1549
+ children: param.ident
1550
+ })
1551
+ }), param.optional && /* @__PURE__ */ jsx("span", {
1552
+ className: style_default.TextPunctuation,
1553
+ children: "?"
1554
+ })] }, i));
1555
+ return /* @__PURE__ */ jsx("div", {
1556
+ className: style_default.MethodSignature,
1557
+ children: /* @__PURE__ */ jsxs("span", {
1558
+ className: style_default.SignatureTitle,
1559
+ children: [
1560
+ decl.signature.async && /* @__PURE__ */ jsx("span", {
1561
+ className: style_default.TextKeyword,
1562
+ children: "async "
1563
+ }),
1564
+ /* @__PURE__ */ jsx("span", {
1565
+ className: style_default.SignatureQualified,
1566
+ children: /* @__PURE__ */ jsx("span", {
1567
+ className: style_default.TextIdentifier,
1568
+ children: decl.qualified?.slice(0, -decl.ident.length)
1569
+ })
1570
+ }),
1571
+ /* @__PURE__ */ jsx("span", {
1572
+ className: style_default.SignatureName,
1573
+ children: /* @__PURE__ */ jsx("span", {
1574
+ className: style_default.TextIdentifier,
1575
+ children: decl.ident
1576
+ })
1577
+ }),
1578
+ /* @__PURE__ */ jsxs("span", {
1579
+ className: style_default.MethodSignature,
1580
+ children: [
1581
+ decl.signature.typeParameters && /* @__PURE__ */ jsx(TypeParams, { params: decl.signature.typeParameters }),
1582
+ /* @__PURE__ */ jsx("span", {
1583
+ className: style_default.SignatureParen,
1584
+ children: "("
1585
+ }),
1586
+ /* @__PURE__ */ jsx("span", {
1587
+ className: style_default.SignatureParams,
1588
+ children: /* @__PURE__ */ jsx(Join$1, {
1589
+ items: params,
1590
+ children: /* @__PURE__ */ jsx("span", {
1591
+ className: style_default.TextOperator,
1592
+ children: ", "
1593
+ })
1594
+ })
1595
+ }),
1596
+ /* @__PURE__ */ jsx("span", {
1597
+ className: style_default.SignatureParen,
1598
+ children: ")"
1599
+ }),
1600
+ decl.signature.returns && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
1601
+ className: style_default.TextPunctuation,
1602
+ children: ": "
1603
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: decl.signature.returns })] })
1604
+ ]
1605
+ })
1606
+ ]
1607
+ })
1608
+ });
1609
+ }
1610
+ function Property$5({ decl, children }) {
1611
+ const Lang = useLanguageComponents();
1612
+ if (!decl) return;
1613
+ switch (decl.kind) {
1614
+ case "TSDeclProperty": return children({
1615
+ name: decl.key,
1616
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
1617
+ type: decl.type.kind in ComplexTypes$3 && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
1618
+ });
1619
+ case "TSDeclTypeAlias": return children({
1620
+ name: decl.ident,
1621
+ typeName: "alias",
1622
+ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
1623
+ });
1624
+ case "TSDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
1625
+ case "TSDeclInterface": return children({ type: /* @__PURE__ */ jsxs(Fragment$1, { children: [
1626
+ /* @__PURE__ */ jsx("span", {
1627
+ className: style_default.TextIdentifier,
1628
+ children: decl.ident
1629
+ }),
1630
+ decl.typeParameters && /* @__PURE__ */ jsx(TypeParams, { params: decl.typeParameters }),
1631
+ decl.extends?.flatMap((t, key) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx("span", {
1632
+ className: style_default.TextKeyword,
1633
+ children: " extends "
1634
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: t })] }, `extends:${key}`))
1635
+ ] }) });
1636
+ }
1637
+ }
1638
+ function Declaration$5({ decl }) {
1639
+ const Lang = useLanguageComponents();
1640
+ if (!decl) return;
1641
+ switch (decl.kind) {
1642
+ case "TSDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1643
+ decl.declare && /* @__PURE__ */ jsx("span", {
1644
+ className: style_default.TextKeyword,
1645
+ children: "declare "
1646
+ }),
1647
+ /* @__PURE__ */ jsx("span", {
1648
+ className: style_default.TypePropertyName,
1649
+ children: /* @__PURE__ */ jsx(Identifier$1, {
1650
+ name: decl.key,
1651
+ optional: decl.optional
1652
+ })
1653
+ }),
1654
+ /* @__PURE__ */ jsx("span", {
1655
+ className: style_default.TextPunctuation,
1656
+ children: ": "
1657
+ }),
1658
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
1659
+ ] });
1660
+ case "TSDeclFunction": return /* @__PURE__ */ jsx(Lang.MethodSignature, { decl });
1661
+ case "TSDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1662
+ /* @__PURE__ */ jsx(Identifier$1, { name: decl.ident }),
1663
+ /* @__PURE__ */ jsx(TypeParams, { params: decl.typeParameters }),
1664
+ /* @__PURE__ */ jsx("span", {
1665
+ className: style_default.TextOperator,
1666
+ children: " = "
1667
+ }),
1668
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
1669
+ ] });
1670
+ case "TSDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
1671
+ case "TSDeclInterface": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1672
+ /* @__PURE__ */ jsx("span", {
1673
+ className: style_default.TextIdentifier,
1674
+ children: decl.ident
1675
+ }),
1676
+ /* @__PURE__ */ jsx(TypeParams, { params: decl.typeParameters }),
1677
+ decl.extends?.map((t, index) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx("span", {
1678
+ className: style_default.TextKeyword,
1679
+ children: " extends "
1680
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: t })] }, index)),
1681
+ /* @__PURE__ */ jsx(TypePreview$2, { path: decl.stainlessPath })
1682
+ ] });
1683
+ case "TSDeclClass": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1684
+ /* @__PURE__ */ jsx("span", {
1685
+ className: style_default.TextKeyword,
1686
+ children: "class "
1687
+ }),
1688
+ /* @__PURE__ */ jsx("span", {
1689
+ className: style_default.TextIdentifier,
1690
+ children: decl.ident
1691
+ }),
1692
+ /* @__PURE__ */ jsx(TypeParams, { params: decl.typeParameters }),
1693
+ decl.superClass ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
1694
+ className: style_default.TextKeyword,
1695
+ children: " extends "
1696
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: decl.superClass })] }) : null,
1697
+ decl.implements?.map((t, index) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx("span", {
1698
+ className: style_default.TextKeyword,
1699
+ children: " implements "
1700
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: t })] }, index))
1701
+ ] });
1702
+ }
1703
+ }
1704
+
1705
+ //#endregion
1706
+ //#region src/languages/java.tsx
1707
+ var java_exports = /* @__PURE__ */ __export({
1708
+ Declaration: () => Declaration$4,
1709
+ MethodSignature: () => MethodSignature$4,
1710
+ Property: () => Property$4,
1711
+ Type: () => Type$4,
1712
+ TypeName: () => TypeName$4
1713
+ });
1714
+ function showFullType$1(type) {
1715
+ return type.kind === "JavaTypeReference" && (type.typeName === "List" || type.typeParameters && type.typeParameters.length > 0);
1716
+ }
1717
+ const constStyle$2 = {
1718
+ string: style_default.LiteralString,
1719
+ number: style_default.LiteralNumeric,
1720
+ boolean: style_default.LiteralBoolean
1721
+ };
1722
+ function TypeName$4({ type, optional }) {
1723
+ const Lang = useLanguageComponents();
1724
+ if (type.kind === "JavaTypeReference" && type.typeName === "List") return "List";
1725
+ return /* @__PURE__ */ jsx(Lang.Type, {
1726
+ type,
1727
+ optional
1728
+ });
1729
+ }
1730
+ function Type$4({ type, optional }) {
1731
+ const language = useLanguage();
1732
+ const Lang = useLanguageComponents();
1733
+ const { Join: Join$1, SDKReference: SDKReference$1 } = useComponents();
1734
+ switch (type.kind) {
1735
+ case "JavaTypeReference": {
1736
+ const name = type.typeName.split(".").at(-1);
1737
+ const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, {
1738
+ type: param,
1739
+ optional
1740
+ }, key));
1741
+ return /* @__PURE__ */ jsxs("span", {
1742
+ className: style_default.Type,
1743
+ children: [/* @__PURE__ */ jsx(SDKReference$1, {
1744
+ stainlessPath: type.$ref,
1745
+ children: name
1746
+ }), params && params.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
1747
+ /* @__PURE__ */ jsx("span", {
1748
+ className: style_default.TypeBracket,
1749
+ children: "<"
1750
+ }),
1751
+ /* @__PURE__ */ jsx(Join$1, {
1752
+ items: params,
1753
+ limit: 3,
1754
+ children: /* @__PURE__ */ jsx("span", {
1755
+ className: style_default.TextOperator,
1756
+ children: ", "
1757
+ })
1758
+ }),
1759
+ /* @__PURE__ */ jsx("span", {
1760
+ className: style_default.TypeBracket,
1761
+ children: ">"
1762
+ })
1763
+ ] }) : null]
1764
+ });
1765
+ }
1766
+ case "JavaTypeClass":
1767
+ case "JavaTypeUnion": return /* @__PURE__ */ jsx("span", {
1768
+ className: style_default.Type,
1769
+ children: /* @__PURE__ */ jsx("span", {
1770
+ className: style_default.TypeKeyword,
1771
+ children: "class"
1772
+ })
1773
+ });
1774
+ case "JavaTypeEnum": return /* @__PURE__ */ jsx("span", {
1775
+ className: style_default.Type,
1776
+ children: /* @__PURE__ */ jsx("span", {
1777
+ className: style_default.TypeKeyword,
1778
+ children: language === "kotlin" ? "enum class" : "enum"
1779
+ })
1780
+ });
1781
+ case "JavaTypeVoid": return /* @__PURE__ */ jsx("span", {
1782
+ className: style_default.Type,
1783
+ children: /* @__PURE__ */ jsx("span", {
1784
+ className: style_default.TypeKeyword,
1785
+ children: language === "kotlin" ? "Nothing?" : "Void"
1786
+ })
1787
+ });
1788
+ case "JavaTypeBoolean": return /* @__PURE__ */ jsx("span", {
1789
+ className: style_default.Type,
1790
+ children: /* @__PURE__ */ jsx("span", {
1791
+ className: style_default.TypeKeyword,
1792
+ children: language === "kotlin" || optional ? "Boolean" : "boolean"
1793
+ })
1794
+ });
1795
+ case "JavaTypeDouble": return /* @__PURE__ */ jsx("span", {
1796
+ className: style_default.Type,
1797
+ children: /* @__PURE__ */ jsx("span", {
1798
+ className: style_default.TypeKeyword,
1799
+ children: language === "kotlin" || optional ? "Double" : "double"
1800
+ })
1801
+ });
1802
+ case "JavaTypeLong": return /* @__PURE__ */ jsx("span", {
1803
+ className: style_default.Type,
1804
+ children: /* @__PURE__ */ jsx("span", {
1805
+ className: style_default.TypeKeyword,
1806
+ children: language === "kotlin" || optional ? "Long" : "long"
1807
+ })
1808
+ });
1809
+ case "JavaTypeString": return /* @__PURE__ */ jsx("span", {
1810
+ className: style_default.Type,
1811
+ children: /* @__PURE__ */ jsx("span", {
1812
+ className: style_default.TypeString,
1813
+ children: "String"
1814
+ })
1815
+ });
1816
+ case "JavaTypeConstant": return /* @__PURE__ */ jsxs("span", {
1817
+ className: style_default.Type,
1818
+ children: [/* @__PURE__ */ jsx("span", {
1819
+ className: style_default.TypeKeyword,
1820
+ children: "JsonValue"
1821
+ }), ";"]
1822
+ });
1823
+ }
1824
+ }
1825
+ function MethodSignature$4({ decl }) {
1826
+ const Lang = useLanguageComponents();
1827
+ const language = useLanguage();
1828
+ const { Join: Join$1, Tooltip: Tooltip$1 } = useComponents();
1829
+ const params = decl.parameters.map((param, i) => /* @__PURE__ */ jsx(React$1.Fragment, { children: /* @__PURE__ */ jsxs(Tooltip$1, {
1830
+ content: /* @__PURE__ */ jsx(Lang.Type, { type: param.typeAnnotation }),
1831
+ children: [/* @__PURE__ */ jsx("span", {
1832
+ className: style_default.TextIdentifier,
1833
+ children: param.ident
1834
+ }), param.hasDefault && /* @__PURE__ */ jsxs(Fragment$1, { children: [
1835
+ " ",
1836
+ /* @__PURE__ */ jsx("span", {
1837
+ className: style_default.TextOperator,
1838
+ children: "="
1839
+ }),
1840
+ " ",
1841
+ /* @__PURE__ */ jsx(Lang.Type, { type: param.typeAnnotation }),
1842
+ /* @__PURE__ */ jsx("span", {
1843
+ className: style_default.TextOperator,
1844
+ children: "."
1845
+ }),
1846
+ /* @__PURE__ */ jsx("span", {
1847
+ className: style_default.TextIdentifier,
1848
+ children: "none"
1849
+ }),
1850
+ /* @__PURE__ */ jsx("span", {
1851
+ className: style_default.TextOperator,
1852
+ children: "()"
1853
+ })
1854
+ ] })]
1855
+ }) }, i));
1856
+ return /* @__PURE__ */ jsx("div", {
1857
+ className: style_default.MethodSignature,
1858
+ children: /* @__PURE__ */ jsxs("span", {
1859
+ className: style_default.SignatureTitle,
1860
+ children: [
1861
+ decl.returnType && language !== "kotlin" && /* @__PURE__ */ jsxs("span", {
1862
+ className: style_default.SignatureReturns,
1863
+ children: [/* @__PURE__ */ jsx(Lang.Type, { type: decl.returnType }), " "]
1864
+ }),
1865
+ decl.qualified && /* @__PURE__ */ jsx("span", {
1866
+ className: style_default.SignatureQualified,
1867
+ children: /* @__PURE__ */ jsx("span", {
1868
+ className: style_default.TextIdentifier,
1869
+ children: decl.qualified?.slice(0, -decl.ident.length)
1870
+ })
1871
+ }),
1872
+ /* @__PURE__ */ jsx("span", {
1873
+ className: style_default.SignatureName,
1874
+ children: /* @__PURE__ */ jsx("span", {
1875
+ className: style_default.TextIdentifier,
1876
+ children: decl.ident
1877
+ })
1878
+ }),
1879
+ /* @__PURE__ */ jsxs("span", {
1880
+ className: style_default.MethodSignature,
1881
+ children: [
1882
+ /* @__PURE__ */ jsx("span", {
1883
+ className: style_default.SignatureParen,
1884
+ children: "("
1885
+ }),
1886
+ /* @__PURE__ */ jsx("span", {
1887
+ className: style_default.SignatureParams,
1888
+ children: /* @__PURE__ */ jsx(Join$1, {
1889
+ items: params,
1890
+ children: /* @__PURE__ */ jsx("span", {
1891
+ className: style_default.TextOperator,
1892
+ children: ", "
1893
+ })
1894
+ })
1895
+ }),
1896
+ /* @__PURE__ */ jsxs("span", {
1897
+ className: style_default.SignatureParen,
1898
+ children: [")", " "]
1899
+ }),
1900
+ decl.returnType && language === "kotlin" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
1901
+ /* @__PURE__ */ jsx("span", {
1902
+ className: style_default.TextOperator,
1903
+ children: ":"
1904
+ }),
1905
+ " ",
1906
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.returnType })
1907
+ ] })
1908
+ ]
1909
+ })
1910
+ ]
1911
+ })
1912
+ });
1913
+ }
1914
+ function Property$4({ decl, children }) {
1915
+ const Docs = useComponents();
1916
+ const Lang = useLanguageComponents();
1917
+ const language = useLanguage();
1918
+ if (!decl) return null;
1919
+ switch (decl.kind) {
1920
+ case "JavaDeclProperty": {
1921
+ const typeRaw = /* @__PURE__ */ jsx(Lang.Type, {
1922
+ type: decl.type,
1923
+ optional: decl.optional
1924
+ });
1925
+ const typeWrapped = decl.optional ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
1926
+ /* @__PURE__ */ jsx("span", {
1927
+ className: style_default.TypeKeyword,
1928
+ children: "Optional"
1929
+ }),
1930
+ /* @__PURE__ */ jsx("span", {
1931
+ className: style_default.TypeBracket,
1932
+ children: "<"
1933
+ }),
1934
+ typeRaw,
1935
+ /* @__PURE__ */ jsx("span", {
1936
+ className: style_default.TypeBracket,
1937
+ children: ">"
1938
+ })
1939
+ ] }) : typeRaw;
1940
+ const badges = /* @__PURE__ */ jsx(Fragment$1, { children: decl.type.kind === "JavaTypeConstant" && /* @__PURE__ */ jsx(Docs.Tooltip, {
1941
+ content: /* @__PURE__ */ jsx("span", {
1942
+ className: style_default.TextIdentifier,
1943
+ children: decl.type.value
1944
+ }),
1945
+ children: /* @__PURE__ */ jsx("span", {
1946
+ className: style_default.TextIdentifier,
1947
+ children: "constant"
1948
+ })
1949
+ }) });
1950
+ return children({
1951
+ name: decl.ident,
1952
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, {
1953
+ type: decl.type,
1954
+ optional: decl.optional
1955
+ }),
1956
+ type: showFullType$1(decl.type) && typeWrapped,
1957
+ badges
1958
+ });
1959
+ }
1960
+ case "JavaDeclConst": return children({
1961
+ name: decl.ident,
1962
+ typeName: "const",
1963
+ type: /* @__PURE__ */ jsx("span", {
1964
+ className: constStyle$2[typeof decl.value],
1965
+ children: JSON.stringify(decl.value)
1966
+ })
1967
+ });
1968
+ case "JavaDeclType": {
1969
+ const typeName$1 = decl.type.kind === "JavaTypeUnion" ? "union" : decl.type.kind === "JavaTypeEnum" ? language === "kotlin" ? "enum class" : "enum" : "class";
1970
+ return children({
1971
+ name: decl.ident,
1972
+ typeName: typeName$1
1973
+ });
1974
+ }
1975
+ case "JavaDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
1976
+ }
1977
+ }
1978
+ function Declaration$4({ decl }) {
1979
+ const Docs = useComponents();
1980
+ const Lang = useLanguageComponents();
1981
+ const language = useLanguage();
1982
+ if (!decl) return null;
1983
+ switch (decl.kind) {
1984
+ case "JavaDeclConst": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1985
+ /* @__PURE__ */ jsx("span", {
1986
+ className: style_default.TextIdentifier,
1987
+ children: decl.ident
1988
+ }),
1989
+ /* @__PURE__ */ jsx("span", {
1990
+ className: style_default.TextPunctuation,
1991
+ children: "("
1992
+ }),
1993
+ JSON.stringify(decl.value),
1994
+ /* @__PURE__ */ jsx("span", {
1995
+ className: style_default.TextPunctuation,
1996
+ children: ")"
1997
+ })
1998
+ ] });
1999
+ case "JavaDeclType": {
2000
+ const keyword = decl.type.kind === "JavaTypeEnum" ? language === "kotlin" ? "enum class" : "enum" : "class";
2001
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2002
+ /* @__PURE__ */ jsx("span", {
2003
+ className: style_default.TextKeyword,
2004
+ children: keyword
2005
+ }),
2006
+ " ",
2007
+ /* @__PURE__ */ jsx("span", {
2008
+ className: style_default.TextIdentifier,
2009
+ children: decl.ident
2010
+ }),
2011
+ /* @__PURE__ */ jsx("span", {
2012
+ className: style_default.TextPunctuation,
2013
+ children: ":"
2014
+ }),
2015
+ decl.type.kind === "JavaTypeUnion" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
2016
+ " ",
2017
+ /* @__PURE__ */ jsx(Docs.Tooltip, {
2018
+ content: "A class that can be one of several variants.",
2019
+ children: /* @__PURE__ */ jsx(Docs.Badge, {
2020
+ id: "java-union",
2021
+ children: "union"
2022
+ })
2023
+ }),
2024
+ " "
2025
+ ] })
2026
+ ] });
2027
+ }
2028
+ case "JavaDeclProperty": {
2029
+ const inlineType = /* @__PURE__ */ jsx(Lang.Type, {
2030
+ type: decl.type,
2031
+ optional: decl.optional
2032
+ });
2033
+ const ident = /* @__PURE__ */ jsx("span", {
2034
+ className: style_default.TypePropertyName,
2035
+ children: /* @__PURE__ */ jsx("span", {
2036
+ className: style_default.TextIdentifier,
2037
+ children: decl.ident
2038
+ })
2039
+ });
2040
+ const suffix = decl.type.kind === "JavaTypeConstant" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [" ", /* @__PURE__ */ jsx(Docs.Tooltip, {
2041
+ content: /* @__PURE__ */ jsx("span", {
2042
+ className: style_default.TextIdentifier,
2043
+ children: decl.type.value
2044
+ }),
2045
+ children: /* @__PURE__ */ jsx(Docs.Badge, {
2046
+ id: "java-constant",
2047
+ children: "constant"
2048
+ })
2049
+ })] }) : null;
2050
+ if (language === "kotlin") return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2051
+ ident,
2052
+ /* @__PURE__ */ jsx("span", {
2053
+ className: style_default.TextPunctuation,
2054
+ children: ":"
2055
+ }),
2056
+ " ",
2057
+ decl.optional ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
2058
+ /* @__PURE__ */ jsx("span", {
2059
+ className: style_default.TypeReference,
2060
+ children: "Optional"
2061
+ }),
2062
+ /* @__PURE__ */ jsx("span", {
2063
+ className: style_default.TypeBracket,
2064
+ children: "<"
2065
+ }),
2066
+ inlineType,
2067
+ /* @__PURE__ */ jsx("span", {
2068
+ className: style_default.TypeBracket,
2069
+ children: ">"
2070
+ })
2071
+ ] }) : inlineType,
2072
+ suffix
2073
+ ] });
2074
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2075
+ decl.optional ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
2076
+ /* @__PURE__ */ jsx("span", {
2077
+ className: style_default.TypeReference,
2078
+ children: "Optional"
2079
+ }),
2080
+ /* @__PURE__ */ jsx("span", {
2081
+ className: style_default.TypeBracket,
2082
+ children: "<"
2083
+ }),
2084
+ inlineType,
2085
+ /* @__PURE__ */ jsx("span", {
2086
+ className: style_default.TypeBracket,
2087
+ children: ">"
2088
+ })
2089
+ ] }) : inlineType,
2090
+ " ",
2091
+ ident,
2092
+ suffix
2093
+ ] });
2094
+ }
2095
+ case "JavaDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
2096
+ }
2097
+ }
2098
+
2099
+ //#endregion
2100
+ //#region src/languages/go.tsx
2101
+ var go_exports = /* @__PURE__ */ __export({
2102
+ Declaration: () => Declaration$3,
2103
+ MethodSignature: () => MethodSignature$3,
2104
+ Property: () => Property$3,
2105
+ Type: () => Type$3,
2106
+ TypeName: () => TypeName$3
2107
+ });
2108
+ const ComplexTypes$2 = {
2109
+ GoTypeMap: "map",
2110
+ GoTypeArray: "array"
2111
+ };
2112
+ const Keywords$1 = {
2113
+ GoTypeAny: "any",
2114
+ GoTypeUnknown: "unknown",
2115
+ GoTypeInt: "int64",
2116
+ GoTypeFloat: "float64",
2117
+ GoTypeBool: "bool",
2118
+ GoTypeError: "error"
2119
+ };
2120
+ function isField(type) {
2121
+ return type.kind === "GoTypeReference" && type.typeName === "param.Field";
2122
+ }
2123
+ function TypeName$3({ type }) {
2124
+ const Lang = useLanguageComponents();
2125
+ return isField(type) ? "field" : ComplexTypes$2[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
2126
+ }
2127
+ function Type$3({ type }) {
2128
+ const Lang = useLanguageComponents();
2129
+ const { Join: Join$1, SDKReference: SDKReference$1 } = useComponents();
2130
+ switch (type.kind) {
2131
+ case "GoTypeReference": {
2132
+ const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
2133
+ return /* @__PURE__ */ jsxs("span", {
2134
+ className: style_default.Type,
2135
+ children: [type.$ref ? /* @__PURE__ */ jsx(SDKReference$1, {
2136
+ stainlessPath: type.$ref,
2137
+ children: type.typeName
2138
+ }) : type.typeName, params && params.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
2139
+ /* @__PURE__ */ jsx("span", {
2140
+ className: style_default.TypeBracket,
2141
+ children: "["
2142
+ }),
2143
+ /* @__PURE__ */ jsx(Join$1, {
2144
+ items: params,
2145
+ limit: 3,
2146
+ children: /* @__PURE__ */ jsx("span", {
2147
+ className: style_default.TextOperator,
2148
+ children: ", "
2149
+ })
2150
+ }),
2151
+ /* @__PURE__ */ jsx("span", {
2152
+ className: style_default.TypeBracket,
2153
+ children: "]"
2154
+ })
2155
+ ] }) : null]
2156
+ });
2157
+ }
2158
+ case "GoTypeAny":
2159
+ case "GoTypeUnknown":
2160
+ case "GoTypeInt":
2161
+ case "GoTypeFloat":
2162
+ case "GoTypeBool":
2163
+ case "GoTypeError": return /* @__PURE__ */ jsx("span", {
2164
+ className: style_default.Type,
2165
+ children: /* @__PURE__ */ jsx("span", {
2166
+ className: style_default.TypeKeyword,
2167
+ children: Keywords$1[type.kind]
2168
+ })
2169
+ });
2170
+ case "GoTypeString": return /* @__PURE__ */ jsx("span", {
2171
+ className: style_default.Type,
2172
+ children: /* @__PURE__ */ jsx("span", {
2173
+ className: style_default.TypeString,
2174
+ children: "string"
2175
+ })
2176
+ });
2177
+ case "GoTypeArray": return /* @__PURE__ */ jsxs("span", {
2178
+ className: style_default.Type,
2179
+ children: [/* @__PURE__ */ jsx("span", {
2180
+ className: style_default.TextOperator,
2181
+ children: "[]"
2182
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType })]
2183
+ });
2184
+ case "GoTypeStruct": return /* @__PURE__ */ jsx("span", {
2185
+ className: style_default.Type,
2186
+ children: /* @__PURE__ */ jsx("span", {
2187
+ className: style_default.TypeKeyword,
2188
+ children: "struct{…}"
2189
+ })
2190
+ });
2191
+ case "GoTypeInterface": return /* @__PURE__ */ jsx("span", {
2192
+ className: style_default.Type,
2193
+ children: /* @__PURE__ */ jsx("span", {
2194
+ className: style_default.TypeKeyword,
2195
+ children: "interface{…}"
2196
+ })
2197
+ });
2198
+ case "GoTypeMap": return /* @__PURE__ */ jsxs("span", {
2199
+ className: style_default.Type,
2200
+ children: [
2201
+ /* @__PURE__ */ jsx("span", {
2202
+ className: style_default.TypeKeyword,
2203
+ children: "map"
2204
+ }),
2205
+ /* @__PURE__ */ jsx("span", {
2206
+ className: style_default.TypeBracket,
2207
+ children: "["
2208
+ }),
2209
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.indexType }),
2210
+ /* @__PURE__ */ jsx("span", {
2211
+ className: style_default.TextPunctuation,
2212
+ children: ","
2213
+ }),
2214
+ " ",
2215
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.itemType }),
2216
+ /* @__PURE__ */ jsx("span", {
2217
+ className: style_default.TypeBracket,
2218
+ children: "]"
2219
+ })
2220
+ ]
2221
+ });
2222
+ case "GoTypePointer": return /* @__PURE__ */ jsxs("span", {
2223
+ className: style_default.Type,
2224
+ children: [/* @__PURE__ */ jsx("span", {
2225
+ className: style_default.TextOperator,
2226
+ children: "*"
2227
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: type.inner })]
2228
+ });
2229
+ }
2230
+ }
2231
+ function MethodSignature$3({ decl }) {
2232
+ const Lang = useLanguageComponents();
2233
+ const { Join: Join$1 } = useComponents();
2234
+ const params = decl.parameters.map((param, i) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx("span", {
2235
+ className: style_default.TextIdentifier,
2236
+ children: param.ident
2237
+ }), param.optional && /* @__PURE__ */ jsx("span", {
2238
+ className: style_default.TextPunctuation,
2239
+ children: "?"
2240
+ })] }, i));
2241
+ const returns = decl.returnType.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
2242
+ return /* @__PURE__ */ jsx("div", {
2243
+ className: style_default.MethodSignature,
2244
+ children: /* @__PURE__ */ jsxs("span", {
2245
+ className: style_default.SignatureTitle,
2246
+ children: [
2247
+ decl.async && /* @__PURE__ */ jsx("span", {
2248
+ className: style_default.TextKeyword,
2249
+ children: "async "
2250
+ }),
2251
+ decl.qualified && /* @__PURE__ */ jsx("span", {
2252
+ className: style_default.SignatureQualified,
2253
+ children: /* @__PURE__ */ jsx("span", {
2254
+ className: style_default.TextIdentifier,
2255
+ children: decl.qualified?.slice(0, -decl.ident.length)
2256
+ })
2257
+ }),
2258
+ decl.kind === "GoDeclFunction" && /* @__PURE__ */ jsx("span", {
2259
+ className: style_default.SignatureName,
2260
+ children: /* @__PURE__ */ jsx("span", {
2261
+ className: style_default.TextIdentifier,
2262
+ children: decl.ident
2263
+ })
2264
+ }),
2265
+ /* @__PURE__ */ jsxs("span", {
2266
+ className: style_default.MethodSignature,
2267
+ children: [
2268
+ /* @__PURE__ */ jsx("span", {
2269
+ className: style_default.SignatureParen,
2270
+ children: "("
2271
+ }),
2272
+ /* @__PURE__ */ jsx("span", {
2273
+ className: style_default.SignatureParams,
2274
+ children: /* @__PURE__ */ jsx(Join$1, {
2275
+ items: params,
2276
+ children: /* @__PURE__ */ jsx("span", {
2277
+ className: style_default.TextOperator,
2278
+ children: ", "
2279
+ })
2280
+ })
2281
+ }),
2282
+ /* @__PURE__ */ jsxs("span", {
2283
+ className: style_default.SignatureParen,
2284
+ children: [")", " "]
2285
+ }),
2286
+ decl.returnType.length === 1 ? returns : /* @__PURE__ */ jsxs(Fragment$1, { children: [
2287
+ /* @__PURE__ */ jsx("span", {
2288
+ className: style_default.SignatureParen,
2289
+ children: "("
2290
+ }),
2291
+ /* @__PURE__ */ jsx(Join$1, {
2292
+ items: returns,
2293
+ children: /* @__PURE__ */ jsx("span", {
2294
+ className: style_default.TextOperator,
2295
+ children: ", "
2296
+ })
2297
+ }),
2298
+ /* @__PURE__ */ jsx("span", {
2299
+ className: style_default.SignatureParen,
2300
+ children: ")"
2301
+ })
2302
+ ] })
2303
+ ]
2304
+ })
2305
+ ]
2306
+ })
2307
+ });
2308
+ }
2309
+ function Property$3({ decl, children }) {
2310
+ const Docs = useComponents();
2311
+ const Lang = useLanguageComponents();
2312
+ if (!decl) return null;
2313
+ switch (decl.kind) {
2314
+ case "GoDeclProperty": return children({
2315
+ name: decl.ident,
2316
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
2317
+ badges: decl.optional && /* @__PURE__ */ jsx(Docs.Badge, { id: "optional" }),
2318
+ type: (isField(decl.type) || decl.type.kind in ComplexTypes$2) && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2319
+ });
2320
+ case "GoDeclConst": return children({
2321
+ name: decl.ident,
2322
+ typeName: "const",
2323
+ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2324
+ });
2325
+ case "GoDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
2326
+ case "GoDeclType":
2327
+ case "GoDeclTypeAlias": {
2328
+ const typeName$1 = decl.type.kind === "GoTypeStruct" ? "struct" : decl.type.kind === "GoTypeInterface" ? "interface" : decl.kind === "GoDeclTypeAlias" ? "alias" : "type";
2329
+ return children({
2330
+ name: decl.ident,
2331
+ typeName: typeName$1,
2332
+ type: ["GoTypeStruct", "GoTypeInterface"].includes(decl.type.kind) || /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2333
+ });
2334
+ }
2335
+ }
2336
+ }
2337
+ function Declaration$3({ decl }) {
2338
+ const Lang = useLanguageComponents();
2339
+ if (!decl) return;
2340
+ switch (decl.kind) {
2341
+ case "GoDeclType": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2342
+ /* @__PURE__ */ jsx("span", {
2343
+ className: style_default.TextKeyword,
2344
+ children: "type "
2345
+ }),
2346
+ /* @__PURE__ */ jsxs("span", {
2347
+ className: style_default.TextIdentifier,
2348
+ children: [decl.ident, " "]
2349
+ }),
2350
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2351
+ ] });
2352
+ case "GoDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2353
+ /* @__PURE__ */ jsx("span", {
2354
+ className: style_default.TextKeyword,
2355
+ children: "type "
2356
+ }),
2357
+ /* @__PURE__ */ jsxs("span", {
2358
+ className: style_default.TextIdentifier,
2359
+ children: [decl.ident, " "]
2360
+ }),
2361
+ /* @__PURE__ */ jsx("span", {
2362
+ className: style_default.TextOperator,
2363
+ children: "= "
2364
+ }),
2365
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2366
+ ] });
2367
+ case "GoDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
2368
+ className: style_default.TypePropertyName,
2369
+ children: /* @__PURE__ */ jsxs("span", {
2370
+ className: style_default.TextIdentifier,
2371
+ children: [decl.ident, " "]
2372
+ })
2373
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })] });
2374
+ case "GoDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
2375
+ case "GoDeclConst": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2376
+ /* @__PURE__ */ jsx("span", {
2377
+ className: style_default.TextKeyword,
2378
+ children: "const "
2379
+ }),
2380
+ /* @__PURE__ */ jsxs("span", {
2381
+ className: style_default.TextIdentifier,
2382
+ children: [decl.ident, " "]
2383
+ }),
2384
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }),
2385
+ /* @__PURE__ */ jsx("span", {
2386
+ className: style_default.TextOperator,
2387
+ children: " = "
2388
+ }),
2389
+ JSON.stringify(decl.value)
2390
+ ] });
2391
+ }
2392
+ }
2393
+
2394
+ //#endregion
2395
+ //#region src/languages/python.tsx
2396
+ var python_exports = /* @__PURE__ */ __export({
2397
+ Declaration: () => Declaration$2,
2398
+ MethodSignature: () => MethodSignature$2,
2399
+ Property: () => Property$2,
2400
+ Type: () => Type$2,
2401
+ TypeName: () => TypeName$2
2402
+ });
2403
+ const constStyle$1 = {
2404
+ string: style_default.LiteralString,
2405
+ number: style_default.LiteralNumeric,
2406
+ boolean: style_default.LiteralBoolean
2407
+ };
2408
+ function showFullType(type) {
2409
+ if (type.kind !== "PythonTypeReference") return false;
2410
+ return type.typeName === "Optional" ? showFullType(type.typeParameters[0]) : type.typeParameters.length > 0;
2411
+ }
2412
+ function TypeName$2({ type }) {
2413
+ const Lang = useLanguageComponents();
2414
+ if (type.kind === "PythonTypeReference") switch (type.typeName) {
2415
+ case "Optional": return /* @__PURE__ */ jsx(Lang.TypeName, { type: type.typeParameters[0] });
2416
+ case "List":
2417
+ case "Iterable":
2418
+ case "Literal":
2419
+ case "Union": return type.typeName.toLowerCase();
2420
+ }
2421
+ return /* @__PURE__ */ jsx(Lang.Type, { type });
2422
+ }
2423
+ function Type$2({ type }) {
2424
+ const Lang = useLanguageComponents();
2425
+ const { Join: Join$1, SDKReference: SDKReference$1 } = useComponents();
2426
+ switch (type.kind) {
2427
+ case "PythonTypeAny":
2428
+ case "PythonTypeUnknown":
2429
+ case "PythonTypeInt":
2430
+ case "PythonTypeFloat":
2431
+ case "PythonTypeBool": return /* @__PURE__ */ jsx("span", {
2432
+ className: style_default.Type,
2433
+ children: /* @__PURE__ */ jsx("span", {
2434
+ className: style_default.TypeKeyword,
2435
+ children: type.kind.slice(10).toLowerCase()
2436
+ })
2437
+ });
2438
+ case "PythonTypeString": return /* @__PURE__ */ jsx("span", {
2439
+ className: style_default.Type,
2440
+ children: /* @__PURE__ */ jsx("span", {
2441
+ className: style_default.TypeString,
2442
+ children: "str"
2443
+ })
2444
+ });
2445
+ case "PythonTypeLiteral": return /* @__PURE__ */ jsx("span", {
2446
+ className: style_default.Type,
2447
+ children: /* @__PURE__ */ jsx("span", {
2448
+ className: constStyle$1[typeof type.literal.value],
2449
+ children: JSON.stringify(type.literal.value)
2450
+ })
2451
+ });
2452
+ case "PythonTypeArray": return /* @__PURE__ */ jsxs("span", {
2453
+ className: style_default.Type,
2454
+ children: [
2455
+ /* @__PURE__ */ jsx("span", {
2456
+ className: style_default.TypeArray,
2457
+ children: "Array<"
2458
+ }),
2459
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType }),
2460
+ /* @__PURE__ */ jsx("span", {
2461
+ className: style_default.TypeArray,
2462
+ children: ">"
2463
+ })
2464
+ ]
2465
+ });
2466
+ case "PythonTypeClass": return /* @__PURE__ */ jsx("span", {
2467
+ className: style_default.Type,
2468
+ children: /* @__PURE__ */ jsx("span", {
2469
+ className: style_default.TypeKeyword,
2470
+ children: "class"
2471
+ })
2472
+ });
2473
+ case "PythonTypeMap": return /* @__PURE__ */ jsx("span", {
2474
+ className: style_default.Type,
2475
+ children: /* @__PURE__ */ jsx("span", {
2476
+ className: style_default.TypeKeyword,
2477
+ children: "Dict"
2478
+ })
2479
+ });
2480
+ case "PythonTypeReference": {
2481
+ const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
2482
+ return /* @__PURE__ */ jsxs("span", {
2483
+ className: style_default.Type,
2484
+ children: [/* @__PURE__ */ jsx("span", {
2485
+ className: type.typeName === "Optional" ? style_default.TypeArray : "",
2486
+ children: /* @__PURE__ */ jsx(SDKReference$1, {
2487
+ stainlessPath: type.$ref,
2488
+ children: type.typeName
2489
+ })
2490
+ }), params && params.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
2491
+ /* @__PURE__ */ jsx("span", {
2492
+ className: style_default.TypeBracket,
2493
+ children: "["
2494
+ }),
2495
+ /* @__PURE__ */ jsx(Join$1, {
2496
+ items: params,
2497
+ limit: 3,
2498
+ children: /* @__PURE__ */ jsx("span", {
2499
+ className: style_default.TextOperator,
2500
+ children: ", "
2501
+ })
2502
+ }),
2503
+ /* @__PURE__ */ jsx("span", {
2504
+ className: style_default.TypeBracket,
2505
+ children: "]"
2506
+ })
2507
+ ] })]
2508
+ });
2509
+ }
2510
+ }
2511
+ }
2512
+ function MethodSignature$2({ decl }) {
2513
+ const Lang = useLanguageComponents();
2514
+ const { Join: Join$1, Tooltip: Tooltip$1 } = useComponents();
2515
+ const params = decl.parameters.map((param, i) => /* @__PURE__ */ jsx(React$1.Fragment, { children: /* @__PURE__ */ jsx(Tooltip$1, {
2516
+ content: /* @__PURE__ */ jsx(Lang.Type, { type: param.type }),
2517
+ children: /* @__PURE__ */ jsx("span", {
2518
+ className: style_default.TextIdentifier,
2519
+ children: param.ident
2520
+ })
2521
+ }) }, i));
2522
+ return /* @__PURE__ */ jsx("div", {
2523
+ className: style_default.MethodSignature,
2524
+ children: /* @__PURE__ */ jsxs("span", {
2525
+ className: style_default.SignatureTitle,
2526
+ children: [
2527
+ decl.async && /* @__PURE__ */ jsx("span", {
2528
+ className: style_default.TextKeyword,
2529
+ children: "async "
2530
+ }),
2531
+ decl.qualified && /* @__PURE__ */ jsx("span", {
2532
+ className: style_default.SignatureQualified,
2533
+ children: /* @__PURE__ */ jsx("span", {
2534
+ className: style_default.TextIdentifier,
2535
+ children: decl.qualified?.slice(0, -decl.ident.length)
2536
+ })
2537
+ }),
2538
+ /* @__PURE__ */ jsx("span", {
2539
+ className: style_default.SignatureName,
2540
+ children: /* @__PURE__ */ jsx("span", {
2541
+ className: style_default.TextIdentifier,
2542
+ children: decl.ident
2543
+ })
2544
+ }),
2545
+ /* @__PURE__ */ jsxs("span", {
2546
+ className: style_default.MethodSignature,
2547
+ children: [
2548
+ /* @__PURE__ */ jsx("span", {
2549
+ className: style_default.SignatureParen,
2550
+ children: "("
2551
+ }),
2552
+ /* @__PURE__ */ jsx("span", {
2553
+ className: style_default.SignatureParams,
2554
+ children: /* @__PURE__ */ jsx(Join$1, {
2555
+ items: params,
2556
+ children: /* @__PURE__ */ jsx("span", {
2557
+ className: style_default.TextOperator,
2558
+ children: ", "
2559
+ })
2560
+ })
2561
+ }),
2562
+ /* @__PURE__ */ jsxs("span", {
2563
+ className: style_default.SignatureParen,
2564
+ children: [")", " "]
2565
+ }),
2566
+ decl.returns && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
2567
+ className: style_default.TextOperator,
2568
+ children: " -> "
2569
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: decl.returns })] })
2570
+ ]
2571
+ })
2572
+ ]
2573
+ })
2574
+ });
2575
+ }
2576
+ function Property$2({ decl, children }) {
2577
+ const Lang = useLanguageComponents();
2578
+ if (!decl) return;
2579
+ switch (decl.kind) {
2580
+ case "PythonDeclProperty": return children({
2581
+ name: decl.ident,
2582
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
2583
+ type: showFullType(decl.type) && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2584
+ });
2585
+ case "PythonDeclClass": return children({
2586
+ name: decl.ident,
2587
+ typeName: "class"
2588
+ });
2589
+ case "PythonDeclType": return children({
2590
+ name: decl.ident,
2591
+ typeName: "type",
2592
+ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2593
+ });
2594
+ case "PythonDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
2595
+ }
2596
+ }
2597
+ function Declaration$2({ decl }) {
2598
+ const Lang = useLanguageComponents();
2599
+ if (!decl) return;
2600
+ switch (decl.kind) {
2601
+ case "PythonDeclProperty": {
2602
+ const nullable = decl.type.kind === "PythonTypeReference" && decl.type.typeName === "Optional" && (decl.type.typeParameters ?? []).length > 0;
2603
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2604
+ /* @__PURE__ */ jsx("span", {
2605
+ className: style_default.TypePropertyName,
2606
+ children: /* @__PURE__ */ jsx("span", {
2607
+ className: style_default.TextIdentifier,
2608
+ children: decl.ident
2609
+ })
2610
+ }),
2611
+ /* @__PURE__ */ jsx("span", {
2612
+ className: style_default.TextPunctuation,
2613
+ children: ": "
2614
+ }),
2615
+ decl.optional && !nullable ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
2616
+ /* @__PURE__ */ jsx("span", {
2617
+ className: style_default.TypePlain,
2618
+ children: "Optional"
2619
+ }),
2620
+ /* @__PURE__ */ jsx("span", {
2621
+ className: style_default.TypeBracket,
2622
+ children: "["
2623
+ }),
2624
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }),
2625
+ /* @__PURE__ */ jsx("span", {
2626
+ className: style_default.TypeBrace,
2627
+ children: "]"
2628
+ })
2629
+ ] }) : /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2630
+ ] });
2631
+ }
2632
+ case "PythonDeclClass": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2633
+ /* @__PURE__ */ jsx("span", {
2634
+ className: style_default.TextKeyword,
2635
+ children: "class "
2636
+ }),
2637
+ /* @__PURE__ */ jsx("span", {
2638
+ className: style_default.TextIdentifier,
2639
+ children: decl.ident
2640
+ }),
2641
+ /* @__PURE__ */ jsx("span", {
2642
+ className: style_default.TextPunctuation,
2643
+ children: ": "
2644
+ }),
2645
+ /* @__PURE__ */ jsx("span", {
2646
+ className: `${style_default.TypePreviewContent} ${style_default.TextPunctuation}`,
2647
+ children: "…"
2648
+ })
2649
+ ] });
2650
+ case "PythonDeclType": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2651
+ /* @__PURE__ */ jsx("span", {
2652
+ className: style_default.TextIdentifier,
2653
+ children: decl.ident
2654
+ }),
2655
+ /* @__PURE__ */ jsx("span", {
2656
+ className: style_default.TextOperator,
2657
+ children: " = "
2658
+ }),
2659
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2660
+ ] });
2661
+ case "PythonDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
2662
+ }
2663
+ }
2664
+
2665
+ //#endregion
2666
+ //#region src/languages/ruby.tsx
2667
+ var ruby_exports = /* @__PURE__ */ __export({
2668
+ Declaration: () => Declaration$1,
2669
+ MethodSignature: () => MethodSignature$1,
2670
+ Property: () => Property$1,
2671
+ Type: () => Type$1,
2672
+ TypeName: () => TypeName$1
2673
+ });
2674
+ const ComplexTypes$1 = {
2675
+ RubyTypeObject: "object",
2676
+ RubyTypeUnion: "union",
2677
+ RubyTypeIntersection: "intersection",
2678
+ RubyTypeArray: "array",
2679
+ RubyTypeMap: "hash"
2680
+ };
2681
+ const Keywords = {
2682
+ RubyTypeBinary: "StringIO",
2683
+ RubyTypeUnknown: "untyped",
2684
+ RubyTypeNull: "nil",
2685
+ RubyTypeInteger: "Integer",
2686
+ RubyTypeFloat: "Float",
2687
+ RubyTypeBoolean: "bool"
2688
+ };
2689
+ function TypeName$1({ type }) {
2690
+ const Lang = useLanguageComponents();
2691
+ return ComplexTypes$1[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
2692
+ }
2693
+ const VALID_IDENTIFIER = /^[_A-Za-z][_A-Za-z0-9]*$/;
2694
+ function TypePreview$1({ path }) {
2695
+ const spec = useSpec();
2696
+ const language = useLanguage();
2697
+ const decl = useDeclaration(path, false);
2698
+ const { Join: Join$1 } = useComponents();
2699
+ 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;
2700
+ const items = decl.children.map((prop, key) => {
2701
+ const p = spec?.decls?.[language]?.[prop];
2702
+ return /* @__PURE__ */ jsx("span", {
2703
+ className: style_default.TypePropertyName,
2704
+ children: /* @__PURE__ */ jsx("span", {
2705
+ className: style_default.TextIdentifier,
2706
+ children: p && "ident" in p ? p["ident"] : null
2707
+ })
2708
+ }, key);
2709
+ });
2710
+ return /* @__PURE__ */ jsxs("span", {
2711
+ className: style_default.TypePreview,
2712
+ "data-stldocs-type-preview": "properties",
2713
+ children: [
2714
+ /* @__PURE__ */ jsx("span", {
2715
+ className: style_default.TypeBrace,
2716
+ children: " {"
2717
+ }),
2718
+ /* @__PURE__ */ jsxs("span", {
2719
+ className: style_default.TypePreviewContent,
2720
+ children: [
2721
+ " ",
2722
+ /* @__PURE__ */ jsx(Join$1, {
2723
+ items,
2724
+ limit: 3,
2725
+ children: /* @__PURE__ */ jsx("span", {
2726
+ className: style_default.TextOperator,
2727
+ children: ", "
2728
+ })
2729
+ }),
2730
+ " "
2731
+ ]
2732
+ }),
2733
+ /* @__PURE__ */ jsx("span", {
2734
+ className: style_default.TypeBrace,
2735
+ children: "} "
2736
+ })
2737
+ ]
2738
+ });
2739
+ }
2740
+ function Type$1({ type }) {
2741
+ const Lang = useLanguageComponents();
2742
+ const { SDKReference: SDKReference$1, Join: Join$1 } = useComponents();
2743
+ switch (type.kind) {
2744
+ case "RubyTypeBinary":
2745
+ case "RubyTypeUnknown":
2746
+ case "RubyTypeNull":
2747
+ case "RubyTypeInteger":
2748
+ case "RubyTypeFloat":
2749
+ case "RubyTypeBoolean": return /* @__PURE__ */ jsx("span", {
2750
+ className: style_default.Type,
2751
+ children: /* @__PURE__ */ jsx("span", {
2752
+ className: style_default.TypeKeyword,
2753
+ children: Keywords[type.kind]
2754
+ })
2755
+ });
2756
+ case "RubyTypeString": return /* @__PURE__ */ jsx("span", {
2757
+ className: style_default.Type,
2758
+ children: /* @__PURE__ */ jsx("span", {
2759
+ className: style_default.TypeString,
2760
+ children: "String"
2761
+ })
2762
+ });
2763
+ case "RubyTypeLiteral":
2764
+ switch (typeof type.literal) {
2765
+ case "string": return /* @__PURE__ */ jsx("span", {
2766
+ className: style_default.Type,
2767
+ children: /* @__PURE__ */ jsxs("span", {
2768
+ className: style_default.LiteralString,
2769
+ children: [":", type.literal.match(VALID_IDENTIFIER) ? type.literal : JSON.stringify(type.literal)]
2770
+ })
2771
+ });
2772
+ case "number": return /* @__PURE__ */ jsx("span", {
2773
+ className: style_default.Type,
2774
+ children: /* @__PURE__ */ jsx("span", {
2775
+ className: style_default.LiteralNumeric,
2776
+ children: JSON.stringify(type.literal)
2777
+ })
2778
+ });
2779
+ case "boolean": return /* @__PURE__ */ jsx("span", {
2780
+ className: style_default.Type,
2781
+ children: /* @__PURE__ */ jsx("span", {
2782
+ className: style_default.LiteralBoolean,
2783
+ children: JSON.stringify(type.literal)
2784
+ })
2785
+ });
2786
+ }
2787
+ break;
2788
+ case "RubyTypeArray": return /* @__PURE__ */ jsxs("span", {
2789
+ className: style_default.Type,
2790
+ children: [
2791
+ /* @__PURE__ */ jsx("span", {
2792
+ className: style_default.TypeArray,
2793
+ children: "Array["
2794
+ }),
2795
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType }),
2796
+ /* @__PURE__ */ jsx("span", {
2797
+ className: style_default.TypeArray,
2798
+ children: "]"
2799
+ })
2800
+ ]
2801
+ });
2802
+ case "RubyTypeMap": return /* @__PURE__ */ jsxs("span", {
2803
+ className: style_default.Type,
2804
+ children: [
2805
+ /* @__PURE__ */ jsx("span", {
2806
+ className: style_default.TypeArray,
2807
+ children: "Hash["
2808
+ }),
2809
+ type.indexType.kind === "RubyTypeString" ? /* @__PURE__ */ jsx("span", {
2810
+ className: style_default.TypeString,
2811
+ children: "Symbol"
2812
+ }) : /* @__PURE__ */ jsx(Lang.Type, { type: type.indexType }),
2813
+ ", ",
2814
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.itemType }),
2815
+ /* @__PURE__ */ jsx("span", {
2816
+ className: style_default.TypeArray,
2817
+ children: "]"
2818
+ })
2819
+ ]
2820
+ });
2821
+ case "RubyTypeReference": {
2822
+ const name = type.ident.split(".").at(-1);
2823
+ if (!type.typeParameters || type.typeParameters.length === 0) return /* @__PURE__ */ jsxs("span", {
2824
+ className: style_default.Type,
2825
+ children: [/* @__PURE__ */ jsx(SDKReference$1, {
2826
+ stainlessPath: type.$ref,
2827
+ children: name
2828
+ }), /* @__PURE__ */ jsx(TypePreview$1, { path: type.$ref })]
2829
+ });
2830
+ const typeParameters = type.typeParameters.map((t, i) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, i));
2831
+ return /* @__PURE__ */ jsxs("span", {
2832
+ className: style_default.Type,
2833
+ children: [
2834
+ /* @__PURE__ */ jsx(SDKReference$1, {
2835
+ stainlessPath: type.$ref,
2836
+ children: name
2837
+ }),
2838
+ /* @__PURE__ */ jsx("span", {
2839
+ className: style_default.TypeBracket,
2840
+ children: "<"
2841
+ }),
2842
+ /* @__PURE__ */ jsx(Join$1, {
2843
+ items: typeParameters,
2844
+ children: /* @__PURE__ */ jsx("span", {
2845
+ className: style_default.TextOperator,
2846
+ children: ", "
2847
+ })
2848
+ }),
2849
+ /* @__PURE__ */ jsx("span", {
2850
+ className: style_default.TypeBracket,
2851
+ children: ">"
2852
+ }),
2853
+ /* @__PURE__ */ jsx(TypePreview$1, { path: type.$ref })
2854
+ ]
2855
+ });
2856
+ }
2857
+ case "RubyTypeIntersection":
2858
+ case "RubyTypeUnion": {
2859
+ const items = type.types.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
2860
+ const delimiter = type.kind === "RubyTypeUnion" ? "|" : "&";
2861
+ return /* @__PURE__ */ jsx("span", {
2862
+ className: style_default.Type,
2863
+ children: /* @__PURE__ */ jsx("span", {
2864
+ className: style_default.TypePreview,
2865
+ "data-stldocs-type-preview": "union",
2866
+ children: /* @__PURE__ */ jsx("span", {
2867
+ className: style_default.TypePreviewContent,
2868
+ children: /* @__PURE__ */ jsx(Join$1, {
2869
+ items,
2870
+ limit: 3,
2871
+ children: /* @__PURE__ */ jsxs("span", {
2872
+ className: style_default.TextOperator,
2873
+ children: [
2874
+ " ",
2875
+ delimiter,
2876
+ " "
2877
+ ]
2878
+ })
2879
+ })
2880
+ })
2881
+ })
2882
+ });
2883
+ }
2884
+ case "RubyTypeBuiltinClass": return /* @__PURE__ */ jsx("span", {
2885
+ className: style_default.TypeReference,
2886
+ children: type.className
2887
+ });
2888
+ case "RubyTypeObject": {
2889
+ const items = type.members.map((prop, key) => /* @__PURE__ */ jsx("span", {
2890
+ className: style_default.TextIdentifier,
2891
+ children: prop.ident
2892
+ }, key));
2893
+ return /* @__PURE__ */ jsx("span", {
2894
+ className: style_default.Type,
2895
+ children: /* @__PURE__ */ jsx("span", {
2896
+ className: style_default.TypePreview,
2897
+ "data-stldocs-type-preview": "properties",
2898
+ children: /* @__PURE__ */ jsxs("span", {
2899
+ className: style_default.TypePreviewContent,
2900
+ children: [
2901
+ /* @__PURE__ */ jsx("span", {
2902
+ className: style_default.TypeBrace,
2903
+ children: "{ "
2904
+ }),
2905
+ /* @__PURE__ */ jsx(Join$1, {
2906
+ items,
2907
+ limit: 3,
2908
+ children: /* @__PURE__ */ jsx("span", {
2909
+ className: style_default.TextOperator,
2910
+ children: ", "
2911
+ })
2912
+ }),
2913
+ /* @__PURE__ */ jsx("span", {
2914
+ className: style_default.TypeBrace,
2915
+ children: "}"
2916
+ })
2917
+ ]
2918
+ })
2919
+ })
2920
+ });
2921
+ }
2922
+ }
2923
+ }
2924
+ function MethodSignature$1({ decl }) {
2925
+ const Lang = useLanguageComponents();
2926
+ const { Join: Join$1 } = useComponents();
2927
+ const params = decl.args.map((param, i) => /* @__PURE__ */ jsx(React$1.Fragment, { children: /* @__PURE__ */ jsx("span", {
2928
+ className: style_default.TextIdentifier,
2929
+ children: param.ident
2930
+ }) }, i));
2931
+ return /* @__PURE__ */ jsx("div", {
2932
+ className: style_default.MethodSignature,
2933
+ children: /* @__PURE__ */ jsxs("span", {
2934
+ className: style_default.SignatureTitle,
2935
+ children: [
2936
+ /* @__PURE__ */ jsx("span", {
2937
+ className: style_default.SignatureQualified,
2938
+ children: /* @__PURE__ */ jsx("span", {
2939
+ className: style_default.TextIdentifier,
2940
+ children: decl.qualified?.slice(0, -decl.ident.length)
2941
+ })
2942
+ }),
2943
+ /* @__PURE__ */ jsx("span", {
2944
+ className: style_default.SignatureName,
2945
+ children: /* @__PURE__ */ jsx("span", {
2946
+ className: style_default.TextIdentifier,
2947
+ children: decl.ident
2948
+ })
2949
+ }),
2950
+ /* @__PURE__ */ jsxs("span", {
2951
+ className: style_default.MethodSignature,
2952
+ children: [
2953
+ /* @__PURE__ */ jsx("span", {
2954
+ className: style_default.SignatureParen,
2955
+ children: "("
2956
+ }),
2957
+ /* @__PURE__ */ jsx("span", {
2958
+ className: style_default.SignatureParams,
2959
+ children: /* @__PURE__ */ jsx(Join$1, {
2960
+ items: params,
2961
+ children: /* @__PURE__ */ jsx("span", {
2962
+ className: style_default.TextOperator,
2963
+ children: ", "
2964
+ })
2965
+ })
2966
+ }),
2967
+ /* @__PURE__ */ jsx("span", {
2968
+ className: style_default.SignatureParen,
2969
+ children: ")"
2970
+ }),
2971
+ " -> ",
2972
+ decl.returns ? /* @__PURE__ */ jsx(Lang.Type, { type: decl.returns }) : "void"
2973
+ ]
2974
+ })
2975
+ ]
2976
+ })
2977
+ });
2978
+ }
2979
+ function Property$1({ decl, children }) {
2980
+ const Lang = useLanguageComponents();
2981
+ switch (decl.kind) {
2982
+ case "RubyDeclProperty": return children({
2983
+ name: decl.ident,
2984
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
2985
+ type: decl.type.kind in ComplexTypes$1 && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2986
+ });
2987
+ case "RubyDeclTypeAlias": return children({
2988
+ name: decl.ident,
2989
+ typeName: "alias",
2990
+ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
2991
+ });
2992
+ case "RubyDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
2993
+ case "RubyDeclClass": return children({
2994
+ name: decl.ident,
2995
+ typeName: "class"
2996
+ });
2997
+ }
2998
+ }
2999
+ function Declaration$1({ decl }) {
3000
+ const Lang = useLanguageComponents();
3001
+ if (!decl) return;
3002
+ switch (decl.kind) {
3003
+ case "RubyDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3004
+ /* @__PURE__ */ jsx("span", {
3005
+ className: style_default.TypePropertyName,
3006
+ children: /* @__PURE__ */ jsx("span", {
3007
+ className: style_default.TextIdentifier,
3008
+ children: decl.ident
3009
+ })
3010
+ }),
3011
+ /* @__PURE__ */ jsx("span", {
3012
+ className: style_default.TextPunctuation,
3013
+ children: ": "
3014
+ }),
3015
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
3016
+ ] });
3017
+ case "RubyDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3018
+ /* @__PURE__ */ jsx("span", {
3019
+ className: style_default.TextIdentifier,
3020
+ children: decl.ident
3021
+ }),
3022
+ /* @__PURE__ */ jsx("span", {
3023
+ className: style_default.TextOperator,
3024
+ children: " = "
3025
+ }),
3026
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
3027
+ ] });
3028
+ case "RubyDeclClass": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3029
+ /* @__PURE__ */ jsx("span", {
3030
+ className: style_default.TextKeyword,
3031
+ children: "class "
3032
+ }),
3033
+ /* @__PURE__ */ jsx("span", {
3034
+ className: style_default.TextIdentifier,
3035
+ children: decl.ident
3036
+ }),
3037
+ /* @__PURE__ */ jsx(TypePreview$1, { path: decl.stainlessPath })
3038
+ ] });
3039
+ case "RubyDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
3040
+ }
3041
+ }
3042
+
3043
+ //#endregion
3044
+ //#region src/languages/http.tsx
3045
+ var http_exports = /* @__PURE__ */ __export({
3046
+ Declaration: () => Declaration,
3047
+ MethodInfo: () => MethodInfo,
3048
+ MethodSignature: () => MethodSignature,
3049
+ Property: () => Property,
3050
+ Type: () => Type,
3051
+ TypeName: () => TypeName
3052
+ });
3053
+ const ComplexTypes = {
3054
+ HttpTypeUnion: "union",
3055
+ HttpTypeIntersection: "intersection"
3056
+ };
3057
+ const constStyle = {
3058
+ string: style_default.LiteralString,
3059
+ number: style_default.LiteralNumeric,
3060
+ boolean: style_default.LiteralBoolean
3061
+ };
3062
+ function Identifier({ name }) {
3063
+ return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx("span", {
3064
+ className: style_default.TextIdentifier,
3065
+ children: /^[_a-zA-Z][_a-zA-Z0-9]*$/.test(name) ? name : JSON.stringify(name)
3066
+ }) });
3067
+ }
3068
+ function TypePreview({ path }) {
3069
+ const spec = useSpec();
3070
+ const language = useLanguage();
3071
+ const decl = useDeclaration(path, false);
3072
+ const { Join: Join$1 } = useComponents();
3073
+ 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;
3074
+ const items = decl.children.map((prop, key) => {
3075
+ const decl$1 = spec?.decls?.[language]?.[prop];
3076
+ return /* @__PURE__ */ jsx("span", {
3077
+ className: style_default.TypePropertyName,
3078
+ children: /* @__PURE__ */ jsx("span", {
3079
+ className: style_default.TextIdentifier,
3080
+ children: decl$1 && "key" in decl$1 ? decl$1?.["key"] : null
3081
+ })
3082
+ }, key);
3083
+ });
3084
+ return /* @__PURE__ */ jsxs("span", {
3085
+ className: style_default.TypePreview,
3086
+ "data-stldocs-type-preview": "properties",
3087
+ children: [
3088
+ /* @__PURE__ */ jsx("span", {
3089
+ className: style_default.TypeBrace,
3090
+ children: " { "
3091
+ }),
3092
+ /* @__PURE__ */ jsx("span", {
3093
+ className: style_default.TypePreviewContent,
3094
+ children: /* @__PURE__ */ jsx(Join$1, {
3095
+ items,
3096
+ limit: 3,
3097
+ children: /* @__PURE__ */ jsx("span", {
3098
+ className: style_default.TextOperator,
3099
+ children: ", "
3100
+ })
3101
+ })
3102
+ }),
3103
+ /* @__PURE__ */ jsx("span", {
3104
+ className: style_default.TypeBrace,
3105
+ children: " } "
3106
+ })
3107
+ ]
3108
+ });
3109
+ }
3110
+ function TypeName({ type }) {
3111
+ const Lang = useLanguageComponents();
3112
+ if (type.kind === "HttpTypeArray") return /* @__PURE__ */ jsxs(Fragment$1, { children: ["array of ", /* @__PURE__ */ jsx(Lang.TypeName, { type: type.elementType })] });
3113
+ if (type.kind === "HttpTypeUnion" && type.types.every((t) => t.kind === "HttpTypeLiteral")) return "enum";
3114
+ if (type.kind === "HttpTypeReference" && type.ident.split(".").at(-1) === "Record") return "map";
3115
+ return ComplexTypes[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
3116
+ }
3117
+ function Type({ type }) {
3118
+ const Lang = useLanguageComponents();
3119
+ const { Join: Join$1, SDKReference: SDKReference$1 } = useComponents();
3120
+ switch (type.kind) {
3121
+ case "HttpTypeUnknown":
3122
+ case "HttpTypeUndefined":
3123
+ case "HttpTypeNull":
3124
+ case "HttpTypeBoolean":
3125
+ case "HttpTypeNumber": return /* @__PURE__ */ jsx("span", {
3126
+ className: style_default.Type,
3127
+ children: /* @__PURE__ */ jsx("span", {
3128
+ className: style_default.TypePlain,
3129
+ children: type.kind.slice(8).toLowerCase()
3130
+ })
3131
+ });
3132
+ case "HttpTypeString": return /* @__PURE__ */ jsx("span", {
3133
+ className: style_default.Type,
3134
+ children: /* @__PURE__ */ jsx("span", {
3135
+ className: style_default.TypePlain,
3136
+ children: "string"
3137
+ })
3138
+ });
3139
+ case "HttpTypeLiteral": return /* @__PURE__ */ jsx("span", {
3140
+ className: style_default.Type,
3141
+ children: /* @__PURE__ */ jsx("span", {
3142
+ className: constStyle[typeof type.literal],
3143
+ children: JSON.stringify(type.literal)
3144
+ })
3145
+ });
3146
+ case "HttpTypeArray": return /* @__PURE__ */ jsxs("span", {
3147
+ className: style_default.Type,
3148
+ children: [/* @__PURE__ */ jsx("span", {
3149
+ className: style_default.TypeArray,
3150
+ children: "array of "
3151
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType })]
3152
+ });
3153
+ case "HttpTypeIntersection":
3154
+ case "HttpTypeUnion": {
3155
+ const items = type.types.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
3156
+ const delimiter = type.kind === "HttpTypeUnion" ? "or" : "and";
3157
+ return /* @__PURE__ */ jsx("span", {
3158
+ className: style_default.Type,
3159
+ children: /* @__PURE__ */ jsx("span", {
3160
+ className: style_default.TypePreview,
3161
+ "data-stldocs-type-preview": "union",
3162
+ children: /* @__PURE__ */ jsx("span", {
3163
+ className: style_default.TypePreviewContent,
3164
+ children: /* @__PURE__ */ jsx(Join$1, {
3165
+ items,
3166
+ limit: 3,
3167
+ children: /* @__PURE__ */ jsxs("span", {
3168
+ className: style_default.TextOperator,
3169
+ children: [
3170
+ " ",
3171
+ delimiter,
3172
+ " "
3173
+ ]
3174
+ })
3175
+ })
3176
+ })
3177
+ })
3178
+ });
3179
+ }
3180
+ case "HttpTypeReference": {
3181
+ const name = type.ident.split(".").at(-1);
3182
+ const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
3183
+ if (name === "Record" && type.typeParameters?.length === 2 && type.typeParameters?.at(0).kind === "HttpTypeString") return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3184
+ /* @__PURE__ */ jsx("span", {
3185
+ className: style_default.TypeArray,
3186
+ children: "map"
3187
+ }),
3188
+ "[",
3189
+ params?.[1],
3190
+ "]"
3191
+ ] });
3192
+ return /* @__PURE__ */ jsxs("span", {
3193
+ className: style_default.Type,
3194
+ children: [
3195
+ /* @__PURE__ */ jsx(SDKReference$1, {
3196
+ stainlessPath: type.$ref,
3197
+ children: name
3198
+ }),
3199
+ params && params.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
3200
+ /* @__PURE__ */ jsx("span", {
3201
+ className: style_default.TypeBracket,
3202
+ children: "<"
3203
+ }),
3204
+ /* @__PURE__ */ jsx(Join$1, {
3205
+ items: params,
3206
+ limit: 3,
3207
+ children: /* @__PURE__ */ jsx("span", {
3208
+ className: style_default.TextOperator,
3209
+ children: ", "
3210
+ })
3211
+ }),
3212
+ /* @__PURE__ */ jsx("span", {
3213
+ className: style_default.TypeBracket,
3214
+ children: ">"
3215
+ })
3216
+ ] }),
3217
+ /* @__PURE__ */ jsx(TypePreview, { path: type.$ref })
3218
+ ]
3219
+ });
3220
+ }
3221
+ case "HttpTypeObject": {
3222
+ const items = type.members.map(({ ident }) => /* @__PURE__ */ jsx("span", {
3223
+ className: style_default.TypePropertyName,
3224
+ children: /* @__PURE__ */ jsx(Identifier, { name: ident })
3225
+ }, ident));
3226
+ return /* @__PURE__ */ jsxs("span", {
3227
+ className: style_default.Type,
3228
+ children: [/* @__PURE__ */ jsx("span", {
3229
+ className: style_default.TypePlain,
3230
+ children: "object"
3231
+ }), /* @__PURE__ */ jsxs("span", {
3232
+ className: style_default.TypePreview,
3233
+ "data-stldocs-type-preview": "properties",
3234
+ children: [
3235
+ /* @__PURE__ */ jsx("span", {
3236
+ className: style_default.TypeBrace,
3237
+ children: " {"
3238
+ }),
3239
+ /* @__PURE__ */ jsxs("span", {
3240
+ className: style_default.TypePreviewContent,
3241
+ children: [
3242
+ " ",
3243
+ /* @__PURE__ */ jsx(Join$1, {
3244
+ items,
3245
+ limit: 3,
3246
+ children: /* @__PURE__ */ jsx("span", {
3247
+ className: style_default.TextOperator,
3248
+ children: ", "
3249
+ })
3250
+ }),
3251
+ " "
3252
+ ]
3253
+ }),
3254
+ /* @__PURE__ */ jsx("span", {
3255
+ className: style_default.TypeBrace,
3256
+ children: "} "
3257
+ })
3258
+ ]
3259
+ })]
3260
+ });
3261
+ }
3262
+ }
3263
+ }
3264
+ function MethodSignature({ decl }) {
3265
+ return null;
3266
+ }
3267
+ function MethodInfo({ decl, children }) {
3268
+ const Docs = useComponents();
3269
+ const params = Object.entries(decl.paramsChildren).filter(([, value]) => value.length).map(([location, value]) => /* @__PURE__ */ jsx(React.Fragment, { children: /* @__PURE__ */ jsxs("div", {
3270
+ className: style_default.MethodParameters,
3271
+ "data-stldocs-property-group": location.at(0),
3272
+ children: [/* @__PURE__ */ jsxs("h5", { children: [
3273
+ location.at(0).toUpperCase(),
3274
+ location.slice(1),
3275
+ " Parameters",
3276
+ /* @__PURE__ */ jsx(PropertyToggle, { target: location.at(0) })
3277
+ ] }), /* @__PURE__ */ jsx(Docs.SDKChildren, { paths: value })]
3278
+ }) }, location));
3279
+ if ((decl.bodyParamsChildren?.["application/json"]?.length ?? 0) > 0) params.push(/* @__PURE__ */ jsxs("div", {
3280
+ className: style_default.MethodInfoSection,
3281
+ children: [/* @__PURE__ */ jsxs("h5", { children: ["Body Parameters", /* @__PURE__ */ jsx(PropertyToggle, { target: "body" })] }), /* @__PURE__ */ jsx("div", {
3282
+ className: style_default.MethodParameters,
3283
+ "data-stldocs-property-group": "body",
3284
+ children: /* @__PURE__ */ jsx(Docs.SDKChildren, { paths: decl.bodyParamsChildren?.["application/json"] ?? [] })
3285
+ })]
3286
+ }));
3287
+ return /* @__PURE__ */ jsxs("div", {
3288
+ className: style_default.MethodInfo,
3289
+ children: [
3290
+ children && /* @__PURE__ */ jsx("div", {
3291
+ className: style_default.MethodContent,
3292
+ children
3293
+ }),
3294
+ params.length > 0 && params,
3295
+ (decl.responseChildren?.length ?? 0) > 0 && /* @__PURE__ */ jsxs("div", {
3296
+ className: style_default.MethodInfoSection,
3297
+ children: [/* @__PURE__ */ jsxs("h5", { children: ["Returns", /* @__PURE__ */ jsx(PropertyToggle, { target: "returns" })] }), /* @__PURE__ */ jsx("div", {
3298
+ className: style_default.MethodReturns,
3299
+ "data-stldocs-property-group": "returns",
3300
+ children: /* @__PURE__ */ jsx(Docs.SDKChildren, { paths: decl.responseChildren ?? [] })
3301
+ })]
3302
+ })
3303
+ ]
3304
+ });
3305
+ }
3306
+ function renderVariantInfo(type) {
3307
+ if (type.kind === "HttpTypeUnion" && type.types.every((t) => t.kind === "HttpTypeObject" || t.kind === "HttpTypeReference")) return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3308
+ "One of the following ",
3309
+ type.types.length,
3310
+ " object variants:"
3311
+ ] });
3312
+ }
3313
+ function Property({ decl, children }) {
3314
+ const Lang = useLanguageComponents();
3315
+ if (!decl) return;
3316
+ switch (decl.kind) {
3317
+ case "HttpDeclProperty": {
3318
+ const variants = renderVariantInfo(decl.type);
3319
+ return children({
3320
+ name: decl.key,
3321
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
3322
+ type: decl.type.kind in ComplexTypes && !variants && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
3323
+ });
3324
+ }
3325
+ case "HttpDeclTypeAlias": return children({
3326
+ name: decl.ident,
3327
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type })
3328
+ });
3329
+ case "HttpDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
3330
+ }
3331
+ }
3332
+ function Declaration({ decl }) {
3333
+ const Lang = useLanguageComponents();
3334
+ if (!decl) return;
3335
+ switch (decl.kind) {
3336
+ case "HttpDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3337
+ /* @__PURE__ */ jsx("span", {
3338
+ className: style_default.TypePropertyName,
3339
+ children: /* @__PURE__ */ jsx(Identifier, { name: decl.key })
3340
+ }),
3341
+ /* @__PURE__ */ jsx("span", {
3342
+ className: style_default.TextPunctuation,
3343
+ children: ": "
3344
+ }),
3345
+ decl.optional && /* @__PURE__ */ jsx("span", {
3346
+ className: style_default.TextPunctuation,
3347
+ children: "optional "
3348
+ }),
3349
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
3350
+ ] });
3351
+ case "HttpDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3352
+ /* @__PURE__ */ jsx(Identifier, { name: decl.ident }),
3353
+ /* @__PURE__ */ jsx("span", {
3354
+ className: style_default.TextOperator,
3355
+ children: " = "
3356
+ }),
3357
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
3358
+ ] });
3359
+ case "HttpDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
3360
+ }
3361
+ }
3362
+
3363
+ //#endregion
3364
+ //#region src/languages/index.ts
3365
+ var languages_exports = /* @__PURE__ */ __export({
3366
+ go: () => go_exports,
3367
+ http: () => http_exports,
3368
+ java: () => java_exports,
3369
+ kotlin: () => kotlin,
3370
+ node: () => node,
3371
+ python: () => python_exports,
3372
+ ruby: () => ruby_exports,
3373
+ typescript: () => typescript_exports
3374
+ });
3375
+ const node = typescript_exports;
3376
+ const kotlin = java_exports;
3377
+
3378
+ //#endregion
3379
+ //#region src/contexts/component.tsx
3380
+ const defaultContextValue = {
3381
+ components: components_exports,
3382
+ language: languages_exports
3383
+ };
3384
+ function ComponentProvider({ components, language, children }) {
3385
+ return /* @__PURE__ */ jsx(ComponentProvider$1, {
3386
+ value: React.useMemo(() => customizeComponents(defaultContextValue, {
3387
+ components,
3388
+ language
3389
+ }), [components, language]),
3390
+ children
3391
+ });
3392
+ }
3393
+
3394
+ //#endregion
3395
+ //#region src/search/printer.tsx
3396
+ function Providers({ language, children }) {
3397
+ return /* @__PURE__ */ jsx(DocsProvider, {
3398
+ spec: null,
3399
+ language,
3400
+ children: /* @__PURE__ */ jsx(ComponentProvider, {
3401
+ components: { SDKReference({ stainlessPath, children: children$1 }) {
3402
+ if (!stainlessPath) return children$1;
3403
+ return /* @__PURE__ */ jsx("span", {
3404
+ className: style_default.TypeReference,
3405
+ children: children$1
3406
+ });
3407
+ } },
3408
+ children
3409
+ })
3410
+ });
3411
+ }
3412
+ function RenderType({ type, full }) {
3413
+ const { Type: Type$6, TypeName: TypeName$6 } = useLanguageComponents();
3414
+ return full ? /* @__PURE__ */ jsx(Type$6, { type }) : /* @__PURE__ */ jsx(TypeName$6, { type });
3415
+ }
3416
+ function typeName(language, type) {
3417
+ return renderToStaticMarkup(/* @__PURE__ */ jsx(Providers, {
3418
+ language,
3419
+ children: /* @__PURE__ */ jsx(RenderType, { type })
3420
+ }));
3421
+ }
3422
+ function RenderDeclaration({ decl }) {
3423
+ const { Declaration: Declaration$6 } = useLanguageComponents();
3424
+ return /* @__PURE__ */ jsx(Declaration$6, { decl });
3425
+ }
3426
+ function declaration$1(language, decl) {
3427
+ return renderToStaticMarkup(/* @__PURE__ */ jsx(Providers, {
3428
+ language,
3429
+ children: /* @__PURE__ */ jsx(RenderDeclaration, { decl })
3430
+ }));
3431
+ }
3432
+ function RenderMethod({ method }) {
3433
+ const { MethodSignature: MethodSignature$6 } = useLanguageComponents();
3434
+ return /* @__PURE__ */ jsx(MethodSignature$6, { decl: method });
3435
+ }
3436
+ function methodSignature(language, decl) {
3437
+ return renderToStaticMarkup(/* @__PURE__ */ jsx(Providers, {
3438
+ language,
3439
+ children: /* @__PURE__ */ jsx(RenderMethod, { method: decl })
3440
+ }));
3441
+ }
3442
+
3443
+ //#endregion
3444
+ //#region src/markdown/index.ts
3445
+ function declaration(env, decl) {
3446
+ const content = declaration$1(env.language, decl);
3447
+ return paragraph(code(stripMarkup(content)));
3448
+ }
3449
+ function renderChildren(env, children, nesting = []) {
3450
+ return list(...children.map((child) => renderDecl(env, child, nesting)));
3451
+ }
3452
+ function renderDecl(env, path, nesting = []) {
3453
+ const decl = getDecl(env, path);
3454
+ const item$1 = item(declaration(env, decl));
3455
+ const hasChildren = "children" in decl && decl.children && decl.children.length > 0;
3456
+ const showModelProps = !("modelPath" in decl && decl["modelPath"]) || env.options.includeModelProperties;
3457
+ if ("docstring" in decl && decl.docstring) item$1.children.push(...parse(decl.docstring));
3458
+ if (hasChildren && showModelProps && !nesting.includes(path)) item$1.push(renderChildren(env, decl.children ?? [], [...nesting, path]));
3459
+ return item$1;
3460
+ }
3461
+ function renderMethod(env, method) {
3462
+ const decl = getDecl(env, method.stainlessPath);
3463
+ if (!decl) return [paragraph(text("The method "), code(method.name), text(" is not available in this language."))];
3464
+ const signature = methodSignature(env.language, decl);
3465
+ const [httpMethod, endpoint] = method.endpoint.split(" ");
3466
+ const output = [
3467
+ heading(2, method.title),
3468
+ ...env.language === "http" ? [] : [paragraph(code(stripMarkup(signature)))],
3469
+ paragraph(strong(text(httpMethod)), text(" "), code(endpoint))
3470
+ ];
3471
+ if (method.description) output.push(...parse(method.description));
3472
+ if ("paramsChildren" in decl && Array.isArray(decl.paramsChildren) && decl.paramsChildren.length > 0) output.push(heading(3, "Parameters"), renderChildren(env, decl.paramsChildren));
3473
+ if ("responseChildren" in decl && decl.responseChildren && decl.responseChildren.length > 0) output.push(heading(3, "Returns"), renderChildren(env, decl.responseChildren));
3474
+ const snippet = getSnippet(env, method.stainlessPath);
3475
+ if (snippet) output.push(heading(3, "Example"), fence(env.language, snippet));
3476
+ return output;
3477
+ }
3478
+ function renderModel(env, model) {
3479
+ return [heading(3, model.title), list(renderDecl(env, `${model.stainlessPath} > (schema)`))];
3480
+ }
3481
+ function renderResource(env, resource) {
3482
+ const methods = Object.values(resource.methods).filter((method) => getDecl(env, method.stainlessPath)).flatMap((method) => renderMethod(env, method));
3483
+ const models = Object.values(resource.models).filter((model) => getDecl(env, `${model.stainlessPath} > (schema)`)).flatMap((model) => renderModel(env, model));
3484
+ const doc = [heading(1, resource.title), ...methods];
3485
+ if (models.length > 0) doc.push(heading(2, "Domain Types"), ...models);
3486
+ if (!env.options.renderNestedResources) return doc;
3487
+ const children = Object.values(resource.subresources ?? {}).flatMap((resource$1) => renderResource(env, resource$1));
3488
+ return [...doc, ...children];
3489
+ }
3490
+ function render(env, node$1) {
3491
+ switch (node$1.kind) {
3492
+ case "resource": return renderResource(env, node$1);
3493
+ case "http_method": return renderMethod(env, node$1);
3494
+ case "model": return renderModel(env, node$1);
3495
+ }
3496
+ }
3497
+ function renderMarkdown(env, node$1) {
3498
+ const content = render(env, node$1);
3499
+ const doc = new Markdoc.Ast.Node("document", {}, content);
3500
+ return Markdoc.format(doc);
3501
+ }
3502
+
3503
+ //#endregion
3504
+ //#region src/search/indexer.ts
3505
+ function getResourceNames(resourceIds, topResources) {
3506
+ let element = void 0;
3507
+ let resources = topResources;
3508
+ const resourceName = [];
3509
+ for (const resource of resourceIds) {
3510
+ element = resources?.[resource];
3511
+ if (!element) break;
3512
+ resourceName.push(element.title);
3513
+ resources = element?.subresources;
3514
+ }
3515
+ return resourceName;
3516
+ }
3517
+ function chunkByLines(content, maxSize = 6e4) {
3518
+ if (Buffer.byteLength(content, "utf8") < maxSize) return [content];
3519
+ const lines = content.split("\n");
3520
+ const chunks = [];
3521
+ let currentChunk = [];
3522
+ let currentSize = 0;
3523
+ for (const line of lines) {
3524
+ const lineSize = Buffer.byteLength(line + "\n", "utf8");
3525
+ if (currentSize + lineSize > maxSize) {
3526
+ chunks.push(currentChunk.join("\n"));
3527
+ currentChunk = [];
3528
+ currentSize = 0;
3529
+ }
3530
+ currentChunk.push(line);
3531
+ currentSize += lineSize;
3532
+ }
3533
+ if (currentChunk.length > 0) chunks.push(currentChunk.join("\n"));
3534
+ return chunks;
3535
+ }
3536
+ function* generateChatIndex(spec) {
3537
+ for (const [language, readme] of Object.entries(spec.readme)) {
3538
+ const chunks = chunkByLines(readme);
3539
+ for (const chunk of chunks) yield {
3540
+ language,
3541
+ title: "Overview",
3542
+ content: chunk,
3543
+ url: `docs://BASE_PATH/${language}`
3544
+ };
3545
+ }
3546
+ for (const { data } of walkTree(spec)) {
3547
+ if (data.kind !== "http_method") continue;
3548
+ const { title, name, stainlessPath, httpMethod, summary, description } = data;
3549
+ const endpoint = data.endpoint.slice(httpMethod.length).trim();
3550
+ for (const language of Languages) {
3551
+ const decl = spec.decls[language]?.[stainlessPath];
3552
+ if (!decl) continue;
3553
+ const chunks = chunkByLines(renderMarkdown({
3554
+ spec,
3555
+ language,
3556
+ options: { includeModelProperties: true }
3557
+ }, data));
3558
+ for (const chunk of chunks) yield {
3559
+ language,
3560
+ title,
3561
+ name,
3562
+ endpoint,
3563
+ httpMethod,
3564
+ summary,
3565
+ description,
3566
+ stainlessPath,
3567
+ qualified: "qualified" in decl ? decl["qualified"] : void 0,
3568
+ ident: "ident" in decl ? decl["ident"] : void 0,
3569
+ content: chunk,
3570
+ url: generateRoute("docs://BASE_PATH", language, stainlessPath)
3571
+ };
3572
+ }
3573
+ }
3574
+ }
3575
+ function* generateIndex(spec, renderMarkdownFn, includeTypes) {
3576
+ const parentCrumbs = {};
3577
+ for (const { data } of walkTree(spec, true)) {
3578
+ const { kind, name, title, stainlessPath } = data;
3579
+ const common = {
3580
+ name,
3581
+ title,
3582
+ stainlessPath
3583
+ };
3584
+ const crumbs = getResourceNames(parseStainlessPath(stainlessPath).resource, spec.resources);
3585
+ switch (kind) {
3586
+ case "resource":
3587
+ for (const language of Languages) {
3588
+ if (!data[language]) continue;
3589
+ parentCrumbs[stainlessPath] = crumbs;
3590
+ const { Name, QualifiedName } = data[language];
3591
+ yield {
3592
+ kind,
3593
+ crumbs,
3594
+ language,
3595
+ Name,
3596
+ QualifiedName,
3597
+ priority: 0,
3598
+ ...common
3599
+ };
3600
+ }
3601
+ break;
3602
+ case "http_method": {
3603
+ const { summary, endpoint, httpMethod } = data;
3604
+ for (const language of Languages) {
3605
+ const found = spec.decls[language]?.[stainlessPath];
3606
+ if (!found) continue;
3607
+ parentCrumbs[stainlessPath] = [...crumbs, title];
3608
+ const qualified = "qualified" in found ? found["qualified"] : void 0;
3609
+ const ident = qualified?.split(".")?.at(-1);
3610
+ yield {
3611
+ kind,
3612
+ crumbs: [...crumbs, title],
3613
+ ident,
3614
+ qualified,
3615
+ language,
3616
+ description: data.description ? renderMarkdownFn?.(data.description) ?? data.description : void 0,
3617
+ endpoint: endpoint.slice(httpMethod.length).trim(),
3618
+ httpMethod,
3619
+ summary,
3620
+ priority: 0,
3621
+ ...common
3622
+ };
3623
+ }
3624
+ break;
3625
+ }
3626
+ case "model": for (const language of Languages) {
3627
+ if (!spec.decls[language]) continue;
3628
+ parentCrumbs[stainlessPath] = [...crumbs, title];
3629
+ const schema = spec.decls[language]?.[`${stainlessPath} > (schema)`];
3630
+ const children = (schema && "children" in schema ? schema?.["children"] : void 0)?.map((childPath) => {
3631
+ const child = spec.decls?.[language]?.[childPath];
3632
+ return child?.["ident"] ?? child?.["name"] ?? child?.["key"] ?? child?.["type"]?.["literal"]?.["value"] ?? child?.["type"]?.["literal"] ?? child?.["type"]?.["value"];
3633
+ })?.filter((child) => child) ?? [];
3634
+ yield {
3635
+ kind,
3636
+ crumbs: [...crumbs, title],
3637
+ children,
3638
+ language,
3639
+ priority: 2,
3640
+ ident: schema && "ident" in schema ? schema?.["ident"] : void 0,
3641
+ ...common
3642
+ };
3643
+ }
3644
+ }
3645
+ }
3646
+ for (const language of Languages) {
3647
+ const decls = spec.decls?.[language];
3648
+ if (!decls) continue;
3649
+ for (const decl of Object.values(decls)) switch (decl.kind) {
3650
+ case "JavaDeclProperty":
3651
+ case "GoDeclProperty":
3652
+ case "PythonDeclProperty":
3653
+ case "RubyDeclProperty":
3654
+ case "HttpDeclProperty":
3655
+ case "TSDeclProperty":
3656
+ {
3657
+ const parsedPath = parseStainlessPath(decl.stainlessPath);
3658
+ const type = includeTypes === false ? void 0 : typeName(language, decl.type);
3659
+ const name = decl["ident"] ?? decl["name"] ?? decl["key"];
3660
+ const parent = parentCrumbs[parsedPath.routable];
3661
+ if (parent === void 0) continue;
3662
+ const matches = decl.stainlessPath.matchAll(/\((property|params|param)\) ([^\s]+)/g);
3663
+ const props = Array.from(matches).map((p) => p[2]).filter((p) => p !== void 0);
3664
+ yield {
3665
+ kind: "property",
3666
+ name,
3667
+ stainlessPath: decl.stainlessPath,
3668
+ crumbs: [...parent, ...props],
3669
+ docstring: decl.docstring ? renderMarkdownFn?.(decl.docstring) ?? decl.docstring : void 0,
3670
+ type,
3671
+ language,
3672
+ priority: 3
3673
+ };
3674
+ }
3675
+ break;
3676
+ }
3677
+ }
3678
+ }
3679
+
3680
+ //#endregion
3681
+ //#region src/search/providers/algolia.ts
3682
+ async function buildIndex(appId, indexName, writeKey, spec, renderMarkdown$1) {
3683
+ if (!appId || !indexName || !writeKey) return;
3684
+ const objects = Array.from(generateIndex(spec, renderMarkdown$1));
3685
+ const client = searchClient(appId, writeKey);
3686
+ await client.setSettings({
3687
+ indexName,
3688
+ indexSettings: {
3689
+ highlightPreTag: "<mark>",
3690
+ highlightPostTag: "</mark>",
3691
+ customRanking: ["asc(priority)"],
3692
+ attributesForFaceting: ["language", "kind"],
3693
+ searchableAttributes: [...SearchableAttributes]
3694
+ }
3695
+ });
3696
+ await client.replaceAllObjects({
3697
+ indexName,
3698
+ objects
3699
+ });
3700
+ }
3701
+ async function buildChatIndex(appId, indexName, writeKey, spec) {
3702
+ if (!appId || !indexName || !writeKey) return;
3703
+ const objects = Array.from(generateChatIndex(spec));
3704
+ const client = searchClient(appId, writeKey);
3705
+ await client.setSettings({
3706
+ indexName,
3707
+ indexSettings: {
3708
+ attributesForFaceting: ["language"],
3709
+ attributeForDistinct: "stainlessPath",
3710
+ searchableAttributes: SearchableAttributesChat
3711
+ }
3712
+ });
3713
+ await client.replaceAllObjects({
3714
+ indexName,
3715
+ objects
3716
+ });
3717
+ }
3718
+ async function search({ settings: { appId, indexName, searchKey }, params: { query, language, kind } }) {
3719
+ const client = searchClient(appId, searchKey);
3720
+ const filters = language ? `language:${language}` : void 0;
3721
+ const facetFilters = kind ? [`kind:${kind}`] : void 0;
3722
+ const { results } = await client.search({ requests: [{
3723
+ query,
3724
+ indexName,
3725
+ filters,
3726
+ hitsPerPage: 5,
3727
+ facets: ["kind"]
3728
+ }, {
3729
+ query,
3730
+ indexName,
3731
+ filters,
3732
+ facetFilters,
3733
+ facets: ["kind"],
3734
+ hitsPerPage: 50
3735
+ }] });
3736
+ if ("hits" in results[0] && "hits" in results[1]) {
3737
+ const [{ nbHits, facets }, { hits }] = results;
3738
+ return {
3739
+ hits,
3740
+ nbHits: nbHits ?? 0,
3741
+ facets
3742
+ };
3743
+ }
3744
+ }
3745
+
3746
+ //#endregion
3747
+ //#region src/contexts/search.tsx
3748
+ const [Provider, useSearchContext] = createStrictContext("SearchContext");
3749
+ function useSearch() {
3750
+ const { settings } = useSearchContext();
3751
+ return (params) => search({
3752
+ settings,
3753
+ params
3754
+ });
3755
+ }
3756
+ function SearchProvider({ children, ...props }) {
3757
+ return /* @__PURE__ */ jsx(Provider, {
3758
+ value: props,
3759
+ children
3760
+ });
3761
+ }
3762
+
3763
+ //#endregion
3764
+ //#region src/contexts/index.tsx
3765
+ var contexts_exports = /* @__PURE__ */ __export({
3766
+ ComponentProvider: () => ComponentProvider$1,
3767
+ DocsProvider: () => DocsProvider,
3768
+ MarkdownContext: () => MarkdownContext,
3769
+ MarkdownProvider: () => MarkdownProvider,
3770
+ NavigationProvider: () => NavigationProvider,
3771
+ SearchProvider: () => SearchProvider,
3772
+ customizeComponents: () => customizeComponents,
3773
+ useComponentContext: () => useComponentContext,
3774
+ useComponents: () => useComponents$1,
3775
+ useContentPanelLayout: () => useContentPanelLayout,
3776
+ useDeclaration: () => useDeclaration,
3777
+ useDocs: () => useDocs,
3778
+ useHighlight: () => useHighlight,
3779
+ useLanguage: () => useLanguage,
3780
+ useLanguageComponents: () => useLanguageComponents,
3781
+ useMarkdownContext: () => useMarkdownContext,
3782
+ useNavigation: () => useNavigation,
3783
+ useRenderMarkdown: () => useRenderMarkdown,
3784
+ useResource: () => useResource,
3785
+ useSearch: () => useSearch,
3786
+ useSearchContext: () => useSearchContext,
3787
+ useSettings: () => useSettings,
3788
+ useSnippet: () => useSnippet,
3789
+ useSpec: () => useSpec
3790
+ });
3791
+ function useLanguageComponents() {
3792
+ const language = useLanguage();
3793
+ const definition = useComponentContext().language[language];
3794
+ if (!definition) throw new Error(`Language component definition not found for language: ${language}`);
3795
+ return definition;
3796
+ }
3797
+
3798
+ //#endregion
3799
+ 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 };