@stainless-api/docs-ui 0.1.0-beta.4 → 0.1.0-beta.40

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