@apiboost/omnispec 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (347) hide show
  1. package/LICENSE.md +202 -0
  2. package/README.md +166 -0
  3. package/core/package.json +5 -0
  4. package/dist/cjs/asyncapi/index.js +17 -0
  5. package/dist/cjs/asyncapi/index.js.map +1 -0
  6. package/dist/cjs/chunks/AsyncApiSpec-TBlyRxTP.js +819 -0
  7. package/dist/cjs/chunks/AsyncApiSpec-TBlyRxTP.js.map +1 -0
  8. package/dist/cjs/chunks/Collapsible-BHAHk_Ep.js +7527 -0
  9. package/dist/cjs/chunks/Collapsible-BHAHk_Ep.js.map +1 -0
  10. package/dist/cjs/chunks/ErrorBoundary-c1piU8da.js +36 -0
  11. package/dist/cjs/chunks/ErrorBoundary-c1piU8da.js.map +1 -0
  12. package/dist/cjs/chunks/OmniSpecRenderer-CE4wxVTL.js +104 -0
  13. package/dist/cjs/chunks/OmniSpecRenderer-CE4wxVTL.js.map +1 -0
  14. package/dist/cjs/chunks/OpenApiSpec-D0JtmOVQ.js +3157 -0
  15. package/dist/cjs/chunks/OpenApiSpec-D0JtmOVQ.js.map +1 -0
  16. package/dist/cjs/chunks/OpenIdConnectManual-oEnN0QJ-.js +2416 -0
  17. package/dist/cjs/chunks/OpenIdConnectManual-oEnN0QJ-.js.map +1 -0
  18. package/dist/cjs/chunks/RendererRegistry-DQ7JBLMT.js +24 -0
  19. package/dist/cjs/chunks/RendererRegistry-DQ7JBLMT.js.map +1 -0
  20. package/dist/cjs/chunks/binary-response-CSrPCI-1.js +77 -0
  21. package/dist/cjs/chunks/binary-response-CSrPCI-1.js.map +1 -0
  22. package/dist/cjs/chunks/ref-resolver-DWu6Q6E5.js +7108 -0
  23. package/dist/cjs/chunks/ref-resolver-DWu6Q6E5.js.map +1 -0
  24. package/dist/cjs/chunks/ssrf-guard-B6T2A7Ho.js +25 -0
  25. package/dist/cjs/chunks/ssrf-guard-B6T2A7Ho.js.map +1 -0
  26. package/dist/cjs/chunks/useSpecDetector-A4OwYrmY.js +252 -0
  27. package/dist/cjs/chunks/useSpecDetector-A4OwYrmY.js.map +1 -0
  28. package/dist/cjs/chunks/useSpecFetcher-BKz1jHTV.js +13669 -0
  29. package/dist/cjs/chunks/useSpecFetcher-BKz1jHTV.js.map +1 -0
  30. package/dist/cjs/core/public.js +198 -0
  31. package/dist/cjs/core/public.js.map +1 -0
  32. package/dist/cjs/index.js +36 -0
  33. package/dist/cjs/index.js.map +1 -0
  34. package/dist/cjs/openapi/index.js +19 -0
  35. package/dist/cjs/openapi/index.js.map +1 -0
  36. package/dist/cjs/server/index.js +154 -0
  37. package/dist/cjs/server/index.js.map +1 -0
  38. package/dist/cjs/wc/index.js +428 -0
  39. package/dist/cjs/wc/index.js.map +1 -0
  40. package/dist/esm/asyncapi/index.js +11 -0
  41. package/dist/esm/asyncapi/index.js.map +1 -0
  42. package/dist/esm/chunks/AsyncApiSpec-C3lsUpZk.js +817 -0
  43. package/dist/esm/chunks/AsyncApiSpec-C3lsUpZk.js.map +1 -0
  44. package/dist/esm/chunks/Collapsible-DA6-nS46.js +7482 -0
  45. package/dist/esm/chunks/Collapsible-DA6-nS46.js.map +1 -0
  46. package/dist/esm/chunks/ErrorBoundary-posRNrbt.js +34 -0
  47. package/dist/esm/chunks/ErrorBoundary-posRNrbt.js.map +1 -0
  48. package/dist/esm/chunks/OmniSpecRenderer-MqsQFXro.js +102 -0
  49. package/dist/esm/chunks/OmniSpecRenderer-MqsQFXro.js.map +1 -0
  50. package/dist/esm/chunks/OpenApiSpec-Cy-oW6jA.js +3153 -0
  51. package/dist/esm/chunks/OpenApiSpec-Cy-oW6jA.js.map +1 -0
  52. package/dist/esm/chunks/OpenIdConnectManual-COfITasf.js +2393 -0
  53. package/dist/esm/chunks/OpenIdConnectManual-COfITasf.js.map +1 -0
  54. package/dist/esm/chunks/RendererRegistry-zlh-WYbU.js +21 -0
  55. package/dist/esm/chunks/RendererRegistry-zlh-WYbU.js.map +1 -0
  56. package/dist/esm/chunks/binary-response-Cre_H-Rt.js +72 -0
  57. package/dist/esm/chunks/binary-response-Cre_H-Rt.js.map +1 -0
  58. package/dist/esm/chunks/ref-resolver-BIrHJOjz.js +7105 -0
  59. package/dist/esm/chunks/ref-resolver-BIrHJOjz.js.map +1 -0
  60. package/dist/esm/chunks/ssrf-guard-CsZoYdEq.js +23 -0
  61. package/dist/esm/chunks/ssrf-guard-CsZoYdEq.js.map +1 -0
  62. package/dist/esm/chunks/useSpecDetector-5SGcKnJx.js +248 -0
  63. package/dist/esm/chunks/useSpecDetector-5SGcKnJx.js.map +1 -0
  64. package/dist/esm/chunks/useSpecFetcher-CZvAnU7Z.js +13625 -0
  65. package/dist/esm/chunks/useSpecFetcher-CZvAnU7Z.js.map +1 -0
  66. package/dist/esm/core/public.js +102 -0
  67. package/dist/esm/core/public.js.map +1 -0
  68. package/dist/esm/index.js +17 -0
  69. package/dist/esm/index.js.map +1 -0
  70. package/dist/esm/openapi/index.js +13 -0
  71. package/dist/esm/openapi/index.js.map +1 -0
  72. package/dist/esm/server/index.js +152 -0
  73. package/dist/esm/server/index.js.map +1 -0
  74. package/dist/esm/wc/index.js +403 -0
  75. package/dist/esm/wc/index.js.map +1 -0
  76. package/dist/types/asyncapi/AsyncApiSpec.d.ts +12 -0
  77. package/dist/types/asyncapi/AsyncApiSpec.d.ts.map +1 -0
  78. package/dist/types/asyncapi/components/AsyncOverview.d.ts +16 -0
  79. package/dist/types/asyncapi/components/AsyncOverview.d.ts.map +1 -0
  80. package/dist/types/asyncapi/components/ChannelDetail.d.ts +19 -0
  81. package/dist/types/asyncapi/components/ChannelDetail.d.ts.map +1 -0
  82. package/dist/types/asyncapi/components/ComponentsSection.d.ts +16 -0
  83. package/dist/types/asyncapi/components/ComponentsSection.d.ts.map +1 -0
  84. package/dist/types/asyncapi/components/ProtocolBadge.d.ts +16 -0
  85. package/dist/types/asyncapi/components/ProtocolBadge.d.ts.map +1 -0
  86. package/dist/types/asyncapi/components/ServerList.d.ts +16 -0
  87. package/dist/types/asyncapi/components/ServerList.d.ts.map +1 -0
  88. package/dist/types/asyncapi/hooks/useAsyncApiSpec.d.ts +12 -0
  89. package/dist/types/asyncapi/hooks/useAsyncApiSpec.d.ts.map +1 -0
  90. package/dist/types/asyncapi/index.d.ts +11 -0
  91. package/dist/types/asyncapi/index.d.ts.map +1 -0
  92. package/dist/types/asyncapi/parser/asyncapi-parser.d.ts +12 -0
  93. package/dist/types/asyncapi/parser/asyncapi-parser.d.ts.map +1 -0
  94. package/dist/types/asyncapi/types/asyncapi.types.d.ts +125 -0
  95. package/dist/types/asyncapi/types/asyncapi.types.d.ts.map +1 -0
  96. package/dist/types/core/components/Auth/ApiKeyAuth.d.ts +30 -0
  97. package/dist/types/core/components/Auth/ApiKeyAuth.d.ts.map +1 -0
  98. package/dist/types/core/components/Auth/AuthPanel.d.ts +18 -0
  99. package/dist/types/core/components/Auth/AuthPanel.d.ts.map +1 -0
  100. package/dist/types/core/components/Auth/AuthPanelModal.d.ts +24 -0
  101. package/dist/types/core/components/Auth/AuthPanelModal.d.ts.map +1 -0
  102. package/dist/types/core/components/Auth/BasicAuth.d.ts +20 -0
  103. package/dist/types/core/components/Auth/BasicAuth.d.ts.map +1 -0
  104. package/dist/types/core/components/Auth/BearerAuth.d.ts +20 -0
  105. package/dist/types/core/components/Auth/BearerAuth.d.ts.map +1 -0
  106. package/dist/types/core/components/Auth/OAuth2AuthManual.d.ts +37 -0
  107. package/dist/types/core/components/Auth/OAuth2AuthManual.d.ts.map +1 -0
  108. package/dist/types/core/components/Auth/OpenIdConnectManual.d.ts +33 -0
  109. package/dist/types/core/components/Auth/OpenIdConnectManual.d.ts.map +1 -0
  110. package/dist/types/core/components/Auth/SecretInput.d.ts +27 -0
  111. package/dist/types/core/components/Auth/SecretInput.d.ts.map +1 -0
  112. package/dist/types/core/components/Auth/index.d.ts +16 -0
  113. package/dist/types/core/components/Auth/index.d.ts.map +1 -0
  114. package/dist/types/core/components/CodeBlock/CodeBlock.d.ts +32 -0
  115. package/dist/types/core/components/CodeBlock/CodeBlock.d.ts.map +1 -0
  116. package/dist/types/core/components/CodeBlock/index.d.ts +12 -0
  117. package/dist/types/core/components/CodeBlock/index.d.ts.map +1 -0
  118. package/dist/types/core/components/Layout/DocLayout.d.ts +24 -0
  119. package/dist/types/core/components/Layout/DocLayout.d.ts.map +1 -0
  120. package/dist/types/core/components/Layout/MobileDrawerDismissContext.d.ts +20 -0
  121. package/dist/types/core/components/Layout/MobileDrawerDismissContext.d.ts.map +1 -0
  122. package/dist/types/core/components/Layout/SpecStatusScreen.d.ts +38 -0
  123. package/dist/types/core/components/Layout/SpecStatusScreen.d.ts.map +1 -0
  124. package/dist/types/core/components/Layout/index.d.ts +11 -0
  125. package/dist/types/core/components/Layout/index.d.ts.map +1 -0
  126. package/dist/types/core/components/MarkdownRenderer/MarkdownRenderer.d.ts +16 -0
  127. package/dist/types/core/components/MarkdownRenderer/MarkdownRenderer.d.ts.map +1 -0
  128. package/dist/types/core/components/MarkdownRenderer/index.d.ts +11 -0
  129. package/dist/types/core/components/MarkdownRenderer/index.d.ts.map +1 -0
  130. package/dist/types/core/components/Navigation/CustomNavSection.d.ts +16 -0
  131. package/dist/types/core/components/Navigation/CustomNavSection.d.ts.map +1 -0
  132. package/dist/types/core/components/Navigation/NavTree.d.ts +32 -0
  133. package/dist/types/core/components/Navigation/NavTree.d.ts.map +1 -0
  134. package/dist/types/core/components/Navigation/SearchBar.d.ts +16 -0
  135. package/dist/types/core/components/Navigation/SearchBar.d.ts.map +1 -0
  136. package/dist/types/core/components/Navigation/buildSidebar.d.ts +13 -0
  137. package/dist/types/core/components/Navigation/buildSidebar.d.ts.map +1 -0
  138. package/dist/types/core/components/Navigation/index.d.ts +13 -0
  139. package/dist/types/core/components/Navigation/index.d.ts.map +1 -0
  140. package/dist/types/core/components/Reference/ReferenceLayout.d.ts +19 -0
  141. package/dist/types/core/components/Reference/ReferenceLayout.d.ts.map +1 -0
  142. package/dist/types/core/components/Reference/ReferenceOperationDetail.d.ts +42 -0
  143. package/dist/types/core/components/Reference/ReferenceOperationDetail.d.ts.map +1 -0
  144. package/dist/types/core/components/Reference/SamplesPanel.d.ts +33 -0
  145. package/dist/types/core/components/Reference/SamplesPanel.d.ts.map +1 -0
  146. package/dist/types/core/components/SchemaViewer/SchemaPresentation.d.ts +147 -0
  147. package/dist/types/core/components/SchemaViewer/SchemaPresentation.d.ts.map +1 -0
  148. package/dist/types/core/components/SchemaViewer/SchemaPrimitives.d.ts +66 -0
  149. package/dist/types/core/components/SchemaViewer/SchemaPrimitives.d.ts.map +1 -0
  150. package/dist/types/core/components/SchemaViewer/SchemaTable.d.ts +16 -0
  151. package/dist/types/core/components/SchemaViewer/SchemaTable.d.ts.map +1 -0
  152. package/dist/types/core/components/SchemaViewer/SchemaTree.d.ts +26 -0
  153. package/dist/types/core/components/SchemaViewer/SchemaTree.d.ts.map +1 -0
  154. package/dist/types/core/components/SchemaViewer/index.d.ts +16 -0
  155. package/dist/types/core/components/SchemaViewer/index.d.ts.map +1 -0
  156. package/dist/types/core/components/SchemaViewer/schema-style.d.ts +45 -0
  157. package/dist/types/core/components/SchemaViewer/schema-style.d.ts.map +1 -0
  158. package/dist/types/core/components/SchemaViewer/schema-utils.d.ts +83 -0
  159. package/dist/types/core/components/SchemaViewer/schema-utils.d.ts.map +1 -0
  160. package/dist/types/core/components/TryIt/CodeSamples.d.ts +26 -0
  161. package/dist/types/core/components/TryIt/CodeSamples.d.ts.map +1 -0
  162. package/dist/types/core/components/TryIt/CustomHeaders.d.ts +24 -0
  163. package/dist/types/core/components/TryIt/CustomHeaders.d.ts.map +1 -0
  164. package/dist/types/core/components/TryIt/InlineTryIt.d.ts +26 -0
  165. package/dist/types/core/components/TryIt/InlineTryIt.d.ts.map +1 -0
  166. package/dist/types/core/components/TryIt/ParameterForm.d.ts +34 -0
  167. package/dist/types/core/components/TryIt/ParameterForm.d.ts.map +1 -0
  168. package/dist/types/core/components/TryIt/RequestBodyEditor.d.ts +34 -0
  169. package/dist/types/core/components/TryIt/RequestBodyEditor.d.ts.map +1 -0
  170. package/dist/types/core/components/TryIt/ResponseViewer.d.ts +18 -0
  171. package/dist/types/core/components/TryIt/ResponseViewer.d.ts.map +1 -0
  172. package/dist/types/core/components/TryIt/TryItPanel.d.ts +38 -0
  173. package/dist/types/core/components/TryIt/TryItPanel.d.ts.map +1 -0
  174. package/dist/types/core/components/TryIt/code-generators.d.ts +23 -0
  175. package/dist/types/core/components/TryIt/code-generators.d.ts.map +1 -0
  176. package/dist/types/core/components/TryIt/curl-generator.d.ts +12 -0
  177. package/dist/types/core/components/TryIt/curl-generator.d.ts.map +1 -0
  178. package/dist/types/core/components/TryIt/index.d.ts +16 -0
  179. package/dist/types/core/components/TryIt/index.d.ts.map +1 -0
  180. package/dist/types/core/components/common/Badge.d.ts +19 -0
  181. package/dist/types/core/components/common/Badge.d.ts.map +1 -0
  182. package/dist/types/core/components/common/Button.d.ts +44 -0
  183. package/dist/types/core/components/common/Button.d.ts.map +1 -0
  184. package/dist/types/core/components/common/Collapsible.d.ts +23 -0
  185. package/dist/types/core/components/common/Collapsible.d.ts.map +1 -0
  186. package/dist/types/core/components/common/CopyButton.d.ts +16 -0
  187. package/dist/types/core/components/common/CopyButton.d.ts.map +1 -0
  188. package/dist/types/core/components/common/ErrorBoundary.d.ts +40 -0
  189. package/dist/types/core/components/common/ErrorBoundary.d.ts.map +1 -0
  190. package/dist/types/core/components/common/ErrorMessage.d.ts +16 -0
  191. package/dist/types/core/components/common/ErrorMessage.d.ts.map +1 -0
  192. package/dist/types/core/components/common/ExampleSelector.d.ts +29 -0
  193. package/dist/types/core/components/common/ExampleSelector.d.ts.map +1 -0
  194. package/dist/types/core/components/common/ExpandableCard.d.ts +27 -0
  195. package/dist/types/core/components/common/ExpandableCard.d.ts.map +1 -0
  196. package/dist/types/core/components/common/Icon.d.ts +53 -0
  197. package/dist/types/core/components/common/Icon.d.ts.map +1 -0
  198. package/dist/types/core/components/common/LinkableHeading.d.ts +19 -0
  199. package/dist/types/core/components/common/LinkableHeading.d.ts.map +1 -0
  200. package/dist/types/core/components/common/LoadingScreen.d.ts +13 -0
  201. package/dist/types/core/components/common/LoadingScreen.d.ts.map +1 -0
  202. package/dist/types/core/components/common/MethodBar.d.ts +18 -0
  203. package/dist/types/core/components/common/MethodBar.d.ts.map +1 -0
  204. package/dist/types/core/components/common/Modal.d.ts +19 -0
  205. package/dist/types/core/components/common/Modal.d.ts.map +1 -0
  206. package/dist/types/core/components/common/ResponsiveColumns.d.ts +17 -0
  207. package/dist/types/core/components/common/ResponsiveColumns.d.ts.map +1 -0
  208. package/dist/types/core/components/common/SpecToolbar.d.ts +27 -0
  209. package/dist/types/core/components/common/SpecToolbar.d.ts.map +1 -0
  210. package/dist/types/core/components/common/Tabs.d.ts +29 -0
  211. package/dist/types/core/components/common/Tabs.d.ts.map +1 -0
  212. package/dist/types/core/components/common/Tooltip.d.ts +17 -0
  213. package/dist/types/core/components/common/Tooltip.d.ts.map +1 -0
  214. package/dist/types/core/components/common/UpgradePrompt.d.ts +18 -0
  215. package/dist/types/core/components/common/UpgradePrompt.d.ts.map +1 -0
  216. package/dist/types/core/components/common/index.d.ts +18 -0
  217. package/dist/types/core/components/common/index.d.ts.map +1 -0
  218. package/dist/types/core/context/AuthContext.d.ts +35 -0
  219. package/dist/types/core/context/AuthContext.d.ts.map +1 -0
  220. package/dist/types/core/context/ConfigContext.d.ts +55 -0
  221. package/dist/types/core/context/ConfigContext.d.ts.map +1 -0
  222. package/dist/types/core/context/ExpandContext.d.ts +33 -0
  223. package/dist/types/core/context/ExpandContext.d.ts.map +1 -0
  224. package/dist/types/core/context/RendererRegistry.d.ts +24 -0
  225. package/dist/types/core/context/RendererRegistry.d.ts.map +1 -0
  226. package/dist/types/core/context/index.d.ts +14 -0
  227. package/dist/types/core/context/index.d.ts.map +1 -0
  228. package/dist/types/core/hooks/index.d.ts +12 -0
  229. package/dist/types/core/hooks/index.d.ts.map +1 -0
  230. package/dist/types/core/hooks/useHashScroll.d.ts +15 -0
  231. package/dist/types/core/hooks/useHashScroll.d.ts.map +1 -0
  232. package/dist/types/core/hooks/useScrollSpy.d.ts +33 -0
  233. package/dist/types/core/hooks/useScrollSpy.d.ts.map +1 -0
  234. package/dist/types/core/hooks/useSegmentedRouter.d.ts +19 -0
  235. package/dist/types/core/hooks/useSegmentedRouter.d.ts.map +1 -0
  236. package/dist/types/core/hooks/useSpecDetector.d.ts +13 -0
  237. package/dist/types/core/hooks/useSpecDetector.d.ts.map +1 -0
  238. package/dist/types/core/hooks/useSpecFetcher.d.ts +17 -0
  239. package/dist/types/core/hooks/useSpecFetcher.d.ts.map +1 -0
  240. package/dist/types/core/public.d.ts +86 -0
  241. package/dist/types/core/public.d.ts.map +1 -0
  242. package/dist/types/core/styles/breakpoints.d.ts +33 -0
  243. package/dist/types/core/styles/breakpoints.d.ts.map +1 -0
  244. package/dist/types/core/styles/css.d.ts +17 -0
  245. package/dist/types/core/styles/css.d.ts.map +1 -0
  246. package/dist/types/core/styles/styled.d.ts +25 -0
  247. package/dist/types/core/styles/styled.d.ts.map +1 -0
  248. package/dist/types/core/themes/ThemeProvider.d.ts +25 -0
  249. package/dist/types/core/themes/ThemeProvider.d.ts.map +1 -0
  250. package/dist/types/core/themes/index.d.ts +12 -0
  251. package/dist/types/core/themes/index.d.ts.map +1 -0
  252. package/dist/types/core/themes/tokens.d.ts +13 -0
  253. package/dist/types/core/themes/tokens.d.ts.map +1 -0
  254. package/dist/types/core/types/auth.types.d.ts +83 -0
  255. package/dist/types/core/types/auth.types.d.ts.map +1 -0
  256. package/dist/types/core/types/common.types.d.ts +141 -0
  257. package/dist/types/core/types/common.types.d.ts.map +1 -0
  258. package/dist/types/core/types/index.d.ts +16 -0
  259. package/dist/types/core/types/index.d.ts.map +1 -0
  260. package/dist/types/core/types/interactive-auth.types.d.ts +37 -0
  261. package/dist/types/core/types/interactive-auth.types.d.ts.map +1 -0
  262. package/dist/types/core/types/sidebar-nav.types.d.ts +41 -0
  263. package/dist/types/core/types/sidebar-nav.types.d.ts.map +1 -0
  264. package/dist/types/core/types/spec-detection.types.d.ts +26 -0
  265. package/dist/types/core/types/spec-detection.types.d.ts.map +1 -0
  266. package/dist/types/core/types/theme.types.d.ts +119 -0
  267. package/dist/types/core/types/theme.types.d.ts.map +1 -0
  268. package/dist/types/core/types/try-it.types.d.ts +50 -0
  269. package/dist/types/core/types/try-it.types.d.ts.map +1 -0
  270. package/dist/types/core/utils/binary-response.d.ts +24 -0
  271. package/dist/types/core/utils/binary-response.d.ts.map +1 -0
  272. package/dist/types/core/utils/detect-spec.d.ts +12 -0
  273. package/dist/types/core/utils/detect-spec.d.ts.map +1 -0
  274. package/dist/types/core/utils/direct-client.d.ts +20 -0
  275. package/dist/types/core/utils/direct-client.d.ts.map +1 -0
  276. package/dist/types/core/utils/fetch-spec.d.ts +15 -0
  277. package/dist/types/core/utils/fetch-spec.d.ts.map +1 -0
  278. package/dist/types/core/utils/index.d.ts +14 -0
  279. package/dist/types/core/utils/index.d.ts.map +1 -0
  280. package/dist/types/core/utils/proxy-client.d.ts +19 -0
  281. package/dist/types/core/utils/proxy-client.d.ts.map +1 -0
  282. package/dist/types/core/utils/ref-security.d.ts +78 -0
  283. package/dist/types/core/utils/ref-security.d.ts.map +1 -0
  284. package/dist/types/core/utils/resolve-download-link.d.ts +23 -0
  285. package/dist/types/core/utils/resolve-download-link.d.ts.map +1 -0
  286. package/dist/types/core/utils/sanitize-html.d.ts +16 -0
  287. package/dist/types/core/utils/sanitize-html.d.ts.map +1 -0
  288. package/dist/types/core/utils/tryit-storage.d.ts +45 -0
  289. package/dist/types/core/utils/tryit-storage.d.ts.map +1 -0
  290. package/dist/types/index.d.ts +29 -0
  291. package/dist/types/index.d.ts.map +1 -0
  292. package/dist/types/openapi/OpenApiSpec.d.ts +12 -0
  293. package/dist/types/openapi/OpenApiSpec.d.ts.map +1 -0
  294. package/dist/types/openapi/components/ApiOverview.d.ts +19 -0
  295. package/dist/types/openapi/components/ApiOverview.d.ts.map +1 -0
  296. package/dist/types/openapi/components/CallbacksSection.d.ts +19 -0
  297. package/dist/types/openapi/components/CallbacksSection.d.ts.map +1 -0
  298. package/dist/types/openapi/components/ComponentsSection.d.ts +19 -0
  299. package/dist/types/openapi/components/ComponentsSection.d.ts.map +1 -0
  300. package/dist/types/openapi/components/EndpointCard.d.ts +20 -0
  301. package/dist/types/openapi/components/EndpointCard.d.ts.map +1 -0
  302. package/dist/types/openapi/components/OperationDetail.d.ts +28 -0
  303. package/dist/types/openapi/components/OperationDetail.d.ts.map +1 -0
  304. package/dist/types/openapi/components/OperationView.d.ts +19 -0
  305. package/dist/types/openapi/components/OperationView.d.ts.map +1 -0
  306. package/dist/types/openapi/components/SegmentedContent.d.ts +22 -0
  307. package/dist/types/openapi/components/SegmentedContent.d.ts.map +1 -0
  308. package/dist/types/openapi/components/ServerSelector.d.ts +18 -0
  309. package/dist/types/openapi/components/ServerSelector.d.ts.map +1 -0
  310. package/dist/types/openapi/components/TagGroup.d.ts +19 -0
  311. package/dist/types/openapi/components/TagGroup.d.ts.map +1 -0
  312. package/dist/types/openapi/hooks/useOpenApiSpec.d.ts +13 -0
  313. package/dist/types/openapi/hooks/useOpenApiSpec.d.ts.map +1 -0
  314. package/dist/types/openapi/index.d.ts +11 -0
  315. package/dist/types/openapi/index.d.ts.map +1 -0
  316. package/dist/types/openapi/parser/openapi-parser.d.ts +13 -0
  317. package/dist/types/openapi/parser/openapi-parser.d.ts.map +1 -0
  318. package/dist/types/openapi/parser/ref-resolver.d.ts +18 -0
  319. package/dist/types/openapi/parser/ref-resolver.d.ts.map +1 -0
  320. package/dist/types/openapi/search.d.ts +16 -0
  321. package/dist/types/openapi/search.d.ts.map +1 -0
  322. package/dist/types/openapi/types/openapi.types.d.ts +139 -0
  323. package/dist/types/openapi/types/openapi.types.d.ts.map +1 -0
  324. package/dist/types/server/index.d.ts +12 -0
  325. package/dist/types/server/index.d.ts.map +1 -0
  326. package/dist/types/server/proxy-router.d.ts +44 -0
  327. package/dist/types/server/proxy-router.d.ts.map +1 -0
  328. package/dist/types/server/ssrf-guard.d.ts +20 -0
  329. package/dist/types/server/ssrf-guard.d.ts.map +1 -0
  330. package/dist/types/test-setup.d.ts +11 -0
  331. package/dist/types/test-setup.d.ts.map +1 -0
  332. package/dist/types/unified/OmniSpecRenderer.d.ts +18 -0
  333. package/dist/types/unified/OmniSpecRenderer.d.ts.map +1 -0
  334. package/dist/types/unified/index.d.ts +12 -0
  335. package/dist/types/unified/index.d.ts.map +1 -0
  336. package/dist/types/wc/OmniSpecRendererElement.d.ts +48 -0
  337. package/dist/types/wc/OmniSpecRendererElement.d.ts.map +1 -0
  338. package/dist/types/wc/attribute-bridge.d.ts +96 -0
  339. package/dist/types/wc/attribute-bridge.d.ts.map +1 -0
  340. package/dist/types/wc/index.d.ts +42 -0
  341. package/dist/types/wc/index.d.ts.map +1 -0
  342. package/dist/types/wc/style-injection.d.ts +24 -0
  343. package/dist/types/wc/style-injection.d.ts.map +1 -0
  344. package/dist/wc/standalone.js +3 -0
  345. package/dist/wc/standalone.js.LICENSE.txt +65 -0
  346. package/dist/wc/standalone.js.map +1 -0
  347. package/package.json +167 -0
@@ -0,0 +1,3157 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var React = require('react');
5
+ var css = require('@emotion/css');
6
+ var useSpecFetcher = require('./useSpecFetcher-BKz1jHTV.js');
7
+ var Collapsible = require('./Collapsible-BHAHk_Ep.js');
8
+ var OpenIdConnectManual = require('./OpenIdConnectManual-oEnN0QJ-.js');
9
+ var refResolver = require('./ref-resolver-DWu6Q6E5.js');
10
+ var ErrorBoundary = require('./ErrorBoundary-c1piU8da.js');
11
+
12
+ const AUTH_SCHEME_LABELS = {
13
+ apiKey: "API Key",
14
+ "http-basic": "Basic Auth",
15
+ "http-bearer": "Bearer Token",
16
+ oauth2: "OAuth2",
17
+ openIdConnect: "OpenID Connect"
18
+ };
19
+ function authSchemeLabel(type) {
20
+ return AUTH_SCHEME_LABELS[type];
21
+ }
22
+
23
+ function BearerAuth({ scheme, onApply, onRemove, applied, appliedValue }) {
24
+ const [token, setToken] = React.useState(appliedValue?.input?.token ?? "");
25
+ const handleApply = () => {
26
+ if (!token.trim()) return;
27
+ onApply({
28
+ schemeId: scheme.id,
29
+ headerName: "Authorization",
30
+ headerValue: `Bearer ${token}`,
31
+ input: { token }
32
+ });
33
+ };
34
+ const handleRemove = () => {
35
+ setToken("");
36
+ onRemove(scheme.id);
37
+ };
38
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: OpenIdConnectManual.authStyles.section, children: [
39
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: OpenIdConnectManual.authStyles.label, children: [
40
+ scheme.displayName,
41
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: OpenIdConnectManual.authStyles.hint, children: "(Bearer Token)" })
42
+ ] }),
43
+ scheme.description && /* @__PURE__ */ jsxRuntime.jsx(Collapsible.MarkdownRenderer, { content: scheme.description, className: OpenIdConnectManual.authStyles.description }),
44
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: OpenIdConnectManual.authStyles.inputRow, children: [
45
+ /* @__PURE__ */ jsxRuntime.jsx(
46
+ OpenIdConnectManual.SecretInput,
47
+ {
48
+ value: token,
49
+ onChange: setToken,
50
+ placeholder: "Enter bearer token",
51
+ className: OpenIdConnectManual.authStyles.input,
52
+ "aria-label": `${scheme.displayName} bearer token`
53
+ }
54
+ ),
55
+ applied ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: handleRemove, className: OpenIdConnectManual.authStyles.removeBtn, children: "Remove" }) : /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: handleApply, className: OpenIdConnectManual.authStyles.applyBtn, children: "Apply" })
56
+ ] })
57
+ ] });
58
+ }
59
+
60
+ const fieldColumnStyle = css.css({
61
+ display: "flex",
62
+ flexDirection: "column",
63
+ gap: "8px"
64
+ });
65
+ function BasicAuth({ scheme, onApply, onRemove, applied, appliedValue }) {
66
+ const [username, setUsername] = React.useState(appliedValue?.input?.username ?? "");
67
+ const [password, setPassword] = React.useState(appliedValue?.input?.password ?? "");
68
+ const handleApply = () => {
69
+ if (!username.trim()) return;
70
+ const encoded = btoa(`${username}:${password}`);
71
+ onApply({
72
+ schemeId: scheme.id,
73
+ headerName: "Authorization",
74
+ headerValue: `Basic ${encoded}`,
75
+ input: { username, password }
76
+ });
77
+ };
78
+ const handleRemove = () => {
79
+ setUsername("");
80
+ setPassword("");
81
+ onRemove(scheme.id);
82
+ };
83
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: OpenIdConnectManual.authStyles.section, children: [
84
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: OpenIdConnectManual.authStyles.label, children: [
85
+ scheme.displayName,
86
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: OpenIdConnectManual.authStyles.hint, children: "(HTTP Basic)" })
87
+ ] }),
88
+ scheme.description && /* @__PURE__ */ jsxRuntime.jsx(Collapsible.MarkdownRenderer, { content: scheme.description, className: OpenIdConnectManual.authStyles.description }),
89
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldColumnStyle, children: [
90
+ /* @__PURE__ */ jsxRuntime.jsx(
91
+ "input",
92
+ {
93
+ type: "text",
94
+ value: username,
95
+ onChange: (e) => setUsername(e.target.value),
96
+ placeholder: "Username",
97
+ className: OpenIdConnectManual.authStyles.input,
98
+ autoComplete: "username"
99
+ }
100
+ ),
101
+ /* @__PURE__ */ jsxRuntime.jsx(
102
+ OpenIdConnectManual.SecretInput,
103
+ {
104
+ value: password,
105
+ onChange: setPassword,
106
+ placeholder: "Password",
107
+ className: OpenIdConnectManual.authStyles.input,
108
+ autoComplete: "current-password",
109
+ "aria-label": `${scheme.displayName} password`
110
+ }
111
+ ),
112
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: OpenIdConnectManual.authStyles.inputRow, children: applied ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: handleRemove, className: OpenIdConnectManual.authStyles.removeBtn, children: "Remove" }) : /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: handleApply, className: OpenIdConnectManual.authStyles.applyBtn, children: "Apply" }) })
113
+ ] })
114
+ ] });
115
+ }
116
+
117
+ function renderSchemeForm(props, Oauth2Component, OpenIdConnectComponent) {
118
+ const key = props.scheme.id;
119
+ switch (props.scheme.type) {
120
+ case "apiKey":
121
+ return /* @__PURE__ */ jsxRuntime.jsx(OpenIdConnectManual.ApiKeyAuth, { ...props }, key);
122
+ case "http-bearer":
123
+ return /* @__PURE__ */ jsxRuntime.jsx(BearerAuth, { ...props }, key);
124
+ case "http-basic":
125
+ return /* @__PURE__ */ jsxRuntime.jsx(BasicAuth, { ...props }, key);
126
+ case "oauth2":
127
+ return /* @__PURE__ */ jsxRuntime.jsx(Oauth2Component, { ...props }, key);
128
+ case "openIdConnect":
129
+ return /* @__PURE__ */ jsxRuntime.jsx(OpenIdConnectComponent, { ...props }, key);
130
+ default:
131
+ return null;
132
+ }
133
+ }
134
+ function AuthPanel({ schemes, serverUrl }) {
135
+ const { appliedAuth, applyAuth, removeAuth } = OpenIdConnectManual.useAuth();
136
+ const { interactiveAuth, interactiveOAuth } = useSpecFetcher.useConfig();
137
+ if (schemes.length === 0) return null;
138
+ const useInteractive = interactiveOAuth !== false;
139
+ const Oauth2Component = useInteractive && interactiveAuth?.oauth2 || OpenIdConnectManual.OAuth2AuthManual;
140
+ const OpenIdConnectComponent = useInteractive && interactiveAuth?.openIdConnect || OpenIdConnectManual.OpenIdConnectManual;
141
+ const buildProps = (scheme) => ({
142
+ scheme,
143
+ onApply: applyAuth,
144
+ onRemove: removeAuth,
145
+ applied: appliedAuth.has(scheme.id),
146
+ // Restored credential (if any) so the input can be prefilled.
147
+ appliedValue: appliedAuth.get(scheme.id),
148
+ serverUrl
149
+ });
150
+ const renderable = schemes.map((scheme) => ({ scheme, form: renderSchemeForm(buildProps(scheme), Oauth2Component, OpenIdConnectComponent) })).filter((entry) => entry.form !== null);
151
+ if (renderable.length === 0) return null;
152
+ if (renderable.length === 1) {
153
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `omnispec-auth-panel ${panelContainerStyle}`, children: renderable[0].form });
154
+ }
155
+ const typeCounts = renderable.reduce((acc, { scheme }) => {
156
+ acc[scheme.type] = (acc[scheme.type] ?? 0) + 1;
157
+ return acc;
158
+ }, {});
159
+ const tabLabel = (scheme) => {
160
+ const label = authSchemeLabel(scheme.type);
161
+ return typeCounts[scheme.type] > 1 ? `${label} (${scheme.id})` : label;
162
+ };
163
+ const tabs = renderable.map(({ scheme, form }) => ({
164
+ id: scheme.id,
165
+ label: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: tabLabelStyle, children: [
166
+ tabLabel(scheme),
167
+ appliedAuth.has(scheme.id) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: appliedIconStyle, title: "Authorized", role: "img", "aria-label": "Authorized", children: /* @__PURE__ */ jsxRuntime.jsx(useSpecFetcher.Icon, { name: "shield-check", size: "0.875rem" }) })
168
+ ] }),
169
+ content: form
170
+ }));
171
+ const defaultTab = renderable.find(({ scheme }) => appliedAuth.has(scheme.id))?.scheme.id ?? renderable[0].scheme.id;
172
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `omnispec-auth-panel ${panelContainerStyle}`, children: /* @__PURE__ */ jsxRuntime.jsx(Collapsible.Tabs, { tabs, defaultTab, flush: true }) });
173
+ }
174
+ const panelContainerStyle = css.css({
175
+ display: "flex",
176
+ flexDirection: "column",
177
+ gap: "1rem"
178
+ });
179
+ const tabLabelStyle = css.css({
180
+ display: "inline-flex",
181
+ alignItems: "center",
182
+ gap: "0.375rem"
183
+ });
184
+ const appliedIconStyle = css.css({
185
+ display: "inline-flex",
186
+ alignItems: "center",
187
+ color: "var(--omnispec-color-success)",
188
+ flexShrink: 0
189
+ });
190
+
191
+ function AuthPanelModal({ serverUrl } = {}) {
192
+ const { schemes, authPanelOpen, closeAuthPanel } = OpenIdConnectManual.useAuth();
193
+ if (schemes.length === 0) return null;
194
+ return /* @__PURE__ */ jsxRuntime.jsx(OpenIdConnectManual.Modal, { open: authPanelOpen, onClose: closeAuthPanel, title: "Authorization", children: /* @__PURE__ */ jsxRuntime.jsx(AuthPanel, { schemes, serverUrl }) });
195
+ }
196
+
197
+ async function parseOpenApiSpec(specInput, refOptions) {
198
+ const raw = typeof specInput === "string" ? parseSpecString(specInput) : specInput;
199
+ const api = await refResolver.resolveRefs(raw, refOptions);
200
+ const isSwagger2 = !!api.swagger;
201
+ const specVersion = api.openapi ?? api.swagger ?? "unknown";
202
+ const servers = extractServers(api, isSwagger2);
203
+ const securitySchemes = extractSecuritySchemes(api, isSwagger2);
204
+ const tags = extractTaggedOperations(api, isSwagger2);
205
+ const components = extractComponents(api, isSwagger2);
206
+ const webhooks = extractWebhooks(api, isSwagger2);
207
+ const root = api;
208
+ return {
209
+ title: api.info.title,
210
+ description: api.info.description,
211
+ version: api.info.version,
212
+ specVersion,
213
+ servers,
214
+ tags,
215
+ tagGroups: root["x-tagGroups"],
216
+ securitySchemes,
217
+ components,
218
+ externalDocs: api.externalDocs,
219
+ contact: api.info.contact,
220
+ license: api.info.license,
221
+ termsOfService: api.info.termsOfService,
222
+ logo: api.info["x-logo"],
223
+ webhooks
224
+ };
225
+ }
226
+ function extractWebhooks(api, isSwagger2) {
227
+ if (!api.webhooks) return void 0;
228
+ const methods = ["get", "post", "put", "delete", "patch", "options", "head"];
229
+ const operations = [];
230
+ for (const [name, pathItem] of Object.entries(api.webhooks)) {
231
+ const pathLevelParams = pathItem.parameters;
232
+ for (const method of methods) {
233
+ const operation = pathItem[method];
234
+ if (!operation) continue;
235
+ const op = convertOperation(method, name, operation, isSwagger2, pathLevelParams);
236
+ if (op.xInternal) continue;
237
+ operations.push(op);
238
+ }
239
+ }
240
+ return operations.length > 0 ? operations : void 0;
241
+ }
242
+ function extractServers(api, isSwagger2) {
243
+ if (!isSwagger2 && api.servers) {
244
+ return api.servers.map((s) => ({
245
+ url: s.url,
246
+ description: s.description,
247
+ variables: s.variables
248
+ }));
249
+ }
250
+ if (isSwagger2 && api.host) {
251
+ const schemes = api.schemes ?? ["https"];
252
+ return schemes.map((scheme) => ({
253
+ url: `${scheme}://${api.host}${api.basePath ?? ""}`
254
+ }));
255
+ }
256
+ return [{ url: "/" }];
257
+ }
258
+ function collectNoAuthSchemeIds(api, isSwagger2) {
259
+ const defs = isSwagger2 ? api.securityDefinitions : api.components?.securitySchemes;
260
+ const ids = /* @__PURE__ */ new Set();
261
+ if (defs) {
262
+ for (const [id, def] of Object.entries(defs)) {
263
+ if (def.type === "http" && def.scheme === "noauth") ids.add(id);
264
+ }
265
+ }
266
+ return ids;
267
+ }
268
+ function extractSecuritySchemes(api, isSwagger2) {
269
+ const schemes = [];
270
+ const defs = isSwagger2 ? api.securityDefinitions : api.components?.securitySchemes;
271
+ if (!defs) return schemes;
272
+ for (const [id, def] of Object.entries(defs)) {
273
+ const scheme = convertSecurityScheme(id, def);
274
+ if (scheme) schemes.push(scheme);
275
+ }
276
+ return schemes;
277
+ }
278
+ function pickXExtensions(obj) {
279
+ const out = {};
280
+ for (const [key, value] of Object.entries(obj)) {
281
+ if (key.startsWith("x-")) out[key] = value;
282
+ }
283
+ return Object.keys(out).length ? out : void 0;
284
+ }
285
+ function convertSecurityScheme(id, def) {
286
+ if (def.type === "http" && def.scheme === "noauth") {
287
+ return null;
288
+ }
289
+ switch (def.type) {
290
+ case "apiKey":
291
+ return {
292
+ id,
293
+ type: "apiKey",
294
+ displayName: id,
295
+ description: def.description,
296
+ in: def.in,
297
+ name: def.name
298
+ };
299
+ case "http":
300
+ return {
301
+ id,
302
+ type: def.scheme === "basic" ? "http-basic" : "http-bearer",
303
+ displayName: id,
304
+ description: def.description,
305
+ scheme: def.scheme
306
+ };
307
+ case "oauth2":
308
+ return {
309
+ id,
310
+ type: "oauth2",
311
+ displayName: id,
312
+ description: def.description,
313
+ // Raw scheme-level x-* passthrough (Pro interprets; free core does not).
314
+ extensions: pickXExtensions(def),
315
+ flows: def.flows ? Object.fromEntries(
316
+ Object.entries(def.flows).map(([flowType, flow]) => [
317
+ flowType,
318
+ {
319
+ authorizationUrl: flow.authorizationUrl,
320
+ tokenUrl: flow.tokenUrl,
321
+ refreshUrl: flow.refreshUrl,
322
+ scopes: flow.scopes ?? {},
323
+ // Raw flow-level x-* passthrough (Pro interprets; free core does not).
324
+ extensions: pickXExtensions(flow)
325
+ }
326
+ ])
327
+ ) : void 0
328
+ };
329
+ case "openIdConnect":
330
+ return {
331
+ id,
332
+ type: "openIdConnect",
333
+ displayName: id,
334
+ description: def.description,
335
+ openIdConnectUrl: def.openIdConnectUrl
336
+ };
337
+ case "basic":
338
+ return {
339
+ id,
340
+ type: "http-basic",
341
+ displayName: id,
342
+ description: def.description,
343
+ scheme: "basic"
344
+ };
345
+ default:
346
+ return null;
347
+ }
348
+ }
349
+ function extractTaggedOperations(api, isSwagger2) {
350
+ const tagMap = /* @__PURE__ */ new Map();
351
+ const definedTags = /* @__PURE__ */ new Map();
352
+ if (api.tags) {
353
+ for (const tag of api.tags) {
354
+ const raw = tag;
355
+ definedTags.set(tag.name, {
356
+ description: tag.description,
357
+ displayName: raw["x-displayName"],
358
+ externalDocs: raw.externalDocs,
359
+ xInternal: raw["x-internal"]
360
+ });
361
+ tagMap.set(tag.name, []);
362
+ }
363
+ }
364
+ const noAuthSchemeIds = collectNoAuthSchemeIds(api, isSwagger2);
365
+ const globalSecurity = api.security?.map(
366
+ (s) => Object.keys(s).filter((name) => !noAuthSchemeIds.has(name))
367
+ );
368
+ for (const [path, pathItem] of Object.entries(api.paths)) {
369
+ const pathLevelParams = pathItem.parameters;
370
+ const methods = ["get", "post", "put", "delete", "patch", "options", "head"];
371
+ for (const method of methods) {
372
+ const operation = pathItem[method];
373
+ if (!operation) continue;
374
+ const op = convertOperation(method, path, operation, isSwagger2, pathLevelParams, globalSecurity, noAuthSchemeIds);
375
+ if (op.xInternal) continue;
376
+ const opTags = op.tags.length > 0 ? op.tags : ["default"];
377
+ for (const tagName of opTags) {
378
+ if (!tagMap.has(tagName)) {
379
+ tagMap.set(tagName, []);
380
+ }
381
+ tagMap.get(tagName).push(op);
382
+ }
383
+ }
384
+ }
385
+ return Array.from(tagMap.entries()).filter(([name, ops]) => ops.length > 0 && !definedTags.get(name)?.xInternal).map(([name, operations]) => ({
386
+ name,
387
+ displayName: definedTags.get(name)?.displayName,
388
+ description: definedTags.get(name)?.description,
389
+ externalDocs: definedTags.get(name)?.externalDocs,
390
+ operations
391
+ }));
392
+ }
393
+ function convertOperation(method, path, op, isSwagger2, pathLevelParams, globalSecurity, noAuthSchemeIds) {
394
+ const mergedRawParams = mergeParameters(pathLevelParams, op.parameters);
395
+ const parameters = mergedRawParams.map((p) => ({
396
+ name: p.name,
397
+ in: p.in,
398
+ required: p.required ?? p.in === "path",
399
+ description: p.description,
400
+ deprecated: p.deprecated,
401
+ schema: p.schema ?? (isSwagger2 ? { type: p.type, format: p.format, enum: p.enum } : void 0),
402
+ example: p.example,
403
+ examples: p.examples,
404
+ style: p.style,
405
+ explode: p.explode
406
+ }));
407
+ let requestBody;
408
+ if (op.requestBody) {
409
+ requestBody = {
410
+ description: op.requestBody.description,
411
+ required: op.requestBody.required,
412
+ content: op.requestBody.content
413
+ };
414
+ }
415
+ const responses = op.responses ? Object.entries(op.responses).map(([code, resp]) => ({
416
+ statusCode: code,
417
+ description: resp.description ?? "",
418
+ content: resp.content,
419
+ headers: resp.headers
420
+ })) : [];
421
+ const rawSecurity = op.security ? op.security.map((s) => Object.keys(s)) : globalSecurity;
422
+ const security = noAuthSchemeIds ? rawSecurity?.map((group) => group.filter((name) => !noAuthSchemeIds.has(name))) : rawSecurity;
423
+ return {
424
+ operationId: op.operationId,
425
+ summary: op.summary,
426
+ description: op.description,
427
+ method,
428
+ path,
429
+ tags: op.tags ?? [],
430
+ deprecated: op.deprecated,
431
+ parameters,
432
+ requestBody,
433
+ responses,
434
+ security: security?.flat() ? security.map((s) => s) : void 0,
435
+ callbacks: op.callbacks,
436
+ externalDocs: op.externalDocs,
437
+ xCodeSamples: op["x-codeSamples"] ?? op["x-code-samples"],
438
+ xBadges: op["x-badges"],
439
+ xInternal: op["x-internal"]
440
+ };
441
+ }
442
+ function extractComponents(api, isSwagger2) {
443
+ if (!isSwagger2 && api.components) {
444
+ return {
445
+ schemas: api.components.schemas ?? {},
446
+ responses: api.components.responses,
447
+ parameters: api.components.parameters,
448
+ requestBodies: api.components.requestBodies
449
+ };
450
+ }
451
+ const rawApi = api;
452
+ return {
453
+ schemas: rawApi.definitions ?? {}
454
+ };
455
+ }
456
+ function mergeParameters(pathLevel, operationLevel) {
457
+ if (!pathLevel?.length) return operationLevel ?? [];
458
+ if (!operationLevel?.length) return pathLevel;
459
+ const opKeys = new Set(operationLevel.map((p) => `${p.in}:${p.name}`));
460
+ const inherited = pathLevel.filter((p) => !opKeys.has(`${p.in}:${p.name}`));
461
+ return [...operationLevel, ...inherited];
462
+ }
463
+ function parseSpecString(input) {
464
+ const trimmed = input.trim();
465
+ if (trimmed.startsWith("{")) {
466
+ try {
467
+ return JSON.parse(trimmed);
468
+ } catch {
469
+ }
470
+ }
471
+ return refResolver.parse(trimmed);
472
+ }
473
+
474
+ function useOpenApiSpec(spec, refOptions) {
475
+ const parser = React.useCallback(async (raw) => {
476
+ return parseOpenApiSpec(raw, refOptions);
477
+ }, [refOptions]);
478
+ return useSpecFetcher.useSpecFetcher(spec, parser);
479
+ }
480
+
481
+ function ApiVersionBadge({ version }) {
482
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: versionBadgeMobileStyle, children: [
483
+ "v",
484
+ version
485
+ ] });
486
+ }
487
+ function ApiOverview({ spec }) {
488
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `omnispec-api-overview ${containerStyle$4}`, children: [
489
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: titleRowStyle$1, children: [
490
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: titleStyle$4, children: spec.title }),
491
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: versionBadgeStyle, children: [
492
+ "v",
493
+ spec.version
494
+ ] })
495
+ ] }),
496
+ spec.description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: descriptionStyle$2, children: /* @__PURE__ */ jsxRuntime.jsx(Collapsible.MarkdownRenderer, { content: spec.description }) }),
497
+ (spec.contact || spec.license || spec.termsOfService || spec.externalDocs) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: metaRowStyle, children: [
498
+ spec.contact?.name && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: metaItemStyle, children: [
499
+ spec.contact.email ? /* @__PURE__ */ jsxRuntime.jsx("a", { href: `mailto:${spec.contact.email}`, className: linkStyle, children: spec.contact.name }) : spec.contact.name,
500
+ spec.contact.url && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
501
+ " \xB7 ",
502
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: spec.contact.url, target: "_blank", rel: "noopener noreferrer", className: linkStyle, children: spec.contact.url })
503
+ ] })
504
+ ] }),
505
+ spec.license && /* @__PURE__ */ jsxRuntime.jsx("span", { className: metaItemStyle, children: spec.license.url ? /* @__PURE__ */ jsxRuntime.jsx("a", { href: spec.license.url, target: "_blank", rel: "noopener noreferrer", className: linkStyle, children: spec.license.name }) : spec.license.name }),
506
+ spec.termsOfService && /* @__PURE__ */ jsxRuntime.jsx("span", { className: metaItemStyle, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: spec.termsOfService, target: "_blank", rel: "noopener noreferrer", className: linkStyle, children: "Terms of Service" }) }),
507
+ spec.externalDocs && /* @__PURE__ */ jsxRuntime.jsx("span", { className: metaItemStyle, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: spec.externalDocs.url, target: "_blank", rel: "noopener noreferrer", className: linkStyle, children: spec.externalDocs.description ?? "Docs" }) })
508
+ ] })
509
+ ] });
510
+ }
511
+ const containerStyle$4 = css.css({
512
+ marginBottom: 0,
513
+ minWidth: 0,
514
+ overflow: "hidden"
515
+ });
516
+ const titleRowStyle$1 = css.css({
517
+ display: "flex",
518
+ gap: "0.75rem",
519
+ marginBottom: "0.25rem",
520
+ flexWrap: "wrap",
521
+ flexDirection: "column"
522
+ });
523
+ const titleStyle$4 = css.css({
524
+ margin: 0,
525
+ fontSize: "var(--omnispec-h1-font-size)",
526
+ color: "var(--omnispec-h1-color)",
527
+ fontWeight: "var(--omnispec-h1-font-weight)",
528
+ letterSpacing: "-0.02em",
529
+ lineHeight: 1.2,
530
+ wordBreak: "break-word"
531
+ });
532
+ const versionBadgeStyle = css.css({
533
+ fontSize: "var(--omnispec-font-size-xs)",
534
+ color: "var(--omnispec-fg-muted)",
535
+ fontFamily: "var(--omnispec-font-mono)",
536
+ backgroundColor: "var(--omnispec-bg-tertiary)",
537
+ padding: "0.125rem 0.5rem",
538
+ borderRadius: "0.25rem",
539
+ alignSelf: "baseline",
540
+ fontWeight: 500,
541
+ [useSpecFetcher.mq.mobile]: {
542
+ display: "none"
543
+ }
544
+ });
545
+ const descriptionStyle$2 = css.css({
546
+ marginTop: "0.75rem"
547
+ });
548
+ const metaRowStyle = css.css({
549
+ display: "flex",
550
+ gap: "1rem",
551
+ marginTop: "0.75rem",
552
+ flexWrap: "wrap"
553
+ });
554
+ const metaItemStyle = css.css({
555
+ fontSize: "var(--omnispec-font-size-xs)",
556
+ color: "var(--omnispec-fg-muted)"
557
+ });
558
+ const versionBadgeMobileStyle = css.css({
559
+ fontSize: "var(--omnispec-font-size-xs)",
560
+ color: "var(--omnispec-fg-muted)",
561
+ fontFamily: "var(--omnispec-font-mono)",
562
+ backgroundColor: "var(--omnispec-bg-tertiary)",
563
+ padding: "0.125rem 0.5rem",
564
+ borderRadius: "0.25rem",
565
+ fontWeight: 500
566
+ });
567
+ const linkStyle = css.css({
568
+ color: "var(--omnispec-fg-link)",
569
+ textDecoration: "none",
570
+ "&:hover": {
571
+ textDecoration: "underline"
572
+ }
573
+ });
574
+
575
+ function ServerSelector({ servers, selectedUrl, onSelect }) {
576
+ const [variables, setVariables] = React.useState({});
577
+ const hasUsableServers = servers.length > 0 && servers.some(
578
+ (s) => s.url && s.url !== "/"
579
+ );
580
+ if (!hasUsableServers) return null;
581
+ const resolveUrl = (server, vars) => {
582
+ let resolved = server.url;
583
+ if (server.variables) {
584
+ for (const [key, variable] of Object.entries(server.variables)) {
585
+ resolved = resolved.replace(`{${key}}`, vars[key] ?? variable.default ?? "");
586
+ }
587
+ }
588
+ return resolved;
589
+ };
590
+ const serverIndex = servers.findIndex((s) => selectedUrl.startsWith(s.url.split("{")[0]));
591
+ const currentIndex = serverIndex >= 0 ? serverIndex : 0;
592
+ const currentServer = servers[currentIndex];
593
+ const resolvedUrl = resolveUrl(currentServer, variables);
594
+ const handleServerChange = (newIndex) => {
595
+ setVariables({});
596
+ onSelect(resolveUrl(servers[newIndex], {}));
597
+ };
598
+ const handleVariableChange = (name, value) => {
599
+ const newVars = { ...variables, [name]: value };
600
+ setVariables(newVars);
601
+ onSelect(resolveUrl(currentServer, newVars));
602
+ };
603
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `omnispec-server-selector ${serverContainerStyle}`, children: [
604
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: serverLabelStyle, children: "Server" }),
605
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: serverRowStyle, children: servers.length === 1 ? /* @__PURE__ */ jsxRuntime.jsx("code", { className: serverUrlStyle, children: resolvedUrl }) : /* @__PURE__ */ jsxRuntime.jsx(
606
+ "select",
607
+ {
608
+ value: currentIndex,
609
+ onChange: (e) => handleServerChange(Number(e.target.value)),
610
+ className: serverSelectStyle,
611
+ children: servers.map((server, idx) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: idx, children: [
612
+ server.url,
613
+ server.description ? ` - ${server.description}` : ""
614
+ ] }, idx))
615
+ }
616
+ ) }),
617
+ currentServer?.variables && Object.entries(currentServer.variables).length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: serverVariablesStyle, children: Object.entries(currentServer.variables).map(([name, variable]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: serverVarRowStyle, children: [
618
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: serverVarLabelStyle, children: name }),
619
+ variable.enum ? /* @__PURE__ */ jsxRuntime.jsx(
620
+ "select",
621
+ {
622
+ value: variables[name] ?? variable.default,
623
+ onChange: (e) => handleVariableChange(name, e.target.value),
624
+ className: serverVarInputStyle,
625
+ children: variable.enum.map((val) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: val, children: val }, val))
626
+ }
627
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
628
+ "input",
629
+ {
630
+ type: "text",
631
+ value: variables[name] ?? variable.default,
632
+ onChange: (e) => handleVariableChange(name, e.target.value),
633
+ className: serverVarInputStyle
634
+ }
635
+ ),
636
+ variable.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: serverVarDescStyle, children: variable.description })
637
+ ] }, name)) })
638
+ ] });
639
+ }
640
+ const serverContainerStyle = css.css({
641
+ marginBottom: "1rem",
642
+ padding: "0.75rem",
643
+ backgroundColor: "var(--omnispec-bg-secondary)",
644
+ borderRadius: "var(--omnispec-border-radius)",
645
+ border: "1px solid var(--omnispec-border-color)",
646
+ overflow: "hidden"
647
+ });
648
+ const serverLabelStyle = css.css({
649
+ fontSize: "var(--omnispec-font-size-xs)",
650
+ fontWeight: 600,
651
+ color: "var(--omnispec-fg-muted)",
652
+ textTransform: "uppercase",
653
+ letterSpacing: "0.5px",
654
+ marginBottom: "6px",
655
+ display: "block"
656
+ });
657
+ const serverRowStyle = css.css({
658
+ display: "flex",
659
+ alignItems: "center",
660
+ gap: "8px"
661
+ });
662
+ const serverUrlStyle = css.css({
663
+ fontFamily: "var(--omnispec-font-mono)",
664
+ fontSize: "var(--omnispec-font-size-sm)",
665
+ color: "var(--omnispec-fg-code)",
666
+ overflowX: "auto",
667
+ whiteSpace: "nowrap",
668
+ minWidth: 0,
669
+ maxWidth: "100%",
670
+ display: "block",
671
+ scrollbarWidth: "thin"
672
+ });
673
+ const serverSelectStyle = css.css({
674
+ flex: 1,
675
+ minWidth: 0,
676
+ maxWidth: "100%",
677
+ padding: "0.375rem 0.625rem",
678
+ border: "1px solid var(--omnispec-input-border)",
679
+ borderRadius: "var(--omnispec-border-radius)",
680
+ backgroundColor: "var(--omnispec-input-bg)",
681
+ color: "var(--omnispec-fg-primary)",
682
+ fontSize: "var(--omnispec-font-size-sm)",
683
+ fontFamily: "var(--omnispec-font-mono)",
684
+ overflow: "hidden",
685
+ textOverflow: "ellipsis"
686
+ });
687
+ const serverVariablesStyle = css.css({
688
+ marginTop: "8px",
689
+ display: "flex",
690
+ flexDirection: "column",
691
+ gap: "6px"
692
+ });
693
+ const serverVarRowStyle = css.css({
694
+ display: "flex",
695
+ alignItems: "center",
696
+ gap: "0.5rem",
697
+ flexWrap: "wrap"
698
+ });
699
+ const serverVarLabelStyle = css.css({
700
+ fontFamily: "var(--omnispec-font-mono)",
701
+ fontSize: "var(--omnispec-font-size-xs)",
702
+ color: "var(--omnispec-fg-secondary)",
703
+ fontWeight: 600,
704
+ minWidth: "80px"
705
+ });
706
+ const serverVarInputStyle = css.css({
707
+ flex: 1,
708
+ minWidth: 0,
709
+ padding: "0.25rem 0.5rem",
710
+ border: "1px solid var(--omnispec-input-border)",
711
+ borderRadius: "var(--omnispec-border-radius)",
712
+ backgroundColor: "var(--omnispec-input-bg)",
713
+ color: "var(--omnispec-fg-primary)",
714
+ fontSize: "var(--omnispec-font-size-xs)",
715
+ fontFamily: "var(--omnispec-font-mono)"
716
+ });
717
+ const serverVarDescStyle = css.css({
718
+ fontSize: "var(--omnispec-font-size-xs)",
719
+ color: "var(--omnispec-fg-muted)"
720
+ });
721
+
722
+ const MULTI_VALUE_DELIMITER = ",";
723
+ const sectionStyle$3 = css.css({
724
+ marginBottom: "16px"
725
+ });
726
+ const sectionTitleStyle$2 = css.css({
727
+ margin: "0 0 8px",
728
+ fontSize: "var(--omnispec-font-size-sm)",
729
+ color: "var(--omnispec-fg-muted)",
730
+ fontWeight: 600,
731
+ textTransform: "uppercase",
732
+ letterSpacing: "0.5px"
733
+ });
734
+ const fieldStyle = css.css({
735
+ marginBottom: "14px"
736
+ });
737
+ const labelStyle$1 = css.css({
738
+ display: "flex",
739
+ alignItems: "center",
740
+ gap: "2px",
741
+ marginBottom: "6px"
742
+ });
743
+ const nameStyle = css.css({
744
+ fontSize: "var(--omnispec-font-size-sm)",
745
+ fontWeight: 600,
746
+ color: "var(--omnispec-fg-primary)"
747
+ });
748
+ const requiredStyle = css.css({
749
+ color: "var(--omnispec-color-error)",
750
+ fontWeight: 600
751
+ });
752
+ const descriptionStyle$1 = css.css({
753
+ margin: "4px 0 0",
754
+ fontSize: "var(--omnispec-font-size-xs)",
755
+ color: "var(--omnispec-fg-muted)"
756
+ });
757
+ const inputStyle = css.css({
758
+ width: "100%",
759
+ padding: "8px 12px",
760
+ border: "1px solid var(--omnispec-input-border)",
761
+ borderRadius: "var(--omnispec-border-radius)",
762
+ backgroundColor: "var(--omnispec-input-bg)",
763
+ color: "var(--omnispec-fg-primary)",
764
+ fontSize: "var(--omnispec-font-size-sm)",
765
+ boxSizing: "border-box",
766
+ "&:focus": {
767
+ borderColor: "var(--omnispec-color-primary)",
768
+ outline: "none"
769
+ }
770
+ });
771
+ function ParameterForm({ parameters, values, onChange }) {
772
+ const grouped = groupByLocation(parameters);
773
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "adr-parameter-form", children: ["path", "query", "header", "cookie"].map((location) => {
774
+ const params = grouped[location];
775
+ if (!params || params.length === 0) return null;
776
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: sectionStyle$3, children: [
777
+ /* @__PURE__ */ jsxRuntime.jsx("h4", { className: sectionTitleStyle$2, children: locationLabels[location] }),
778
+ params.map((param) => /* @__PURE__ */ jsxRuntime.jsx(
779
+ ParameterInput,
780
+ {
781
+ param,
782
+ value: values[param.name] ?? "",
783
+ onChange
784
+ },
785
+ param.name
786
+ ))
787
+ ] }, location);
788
+ }) });
789
+ }
790
+ const locationLabels = {
791
+ path: "Path Parameters",
792
+ query: "Query Parameters",
793
+ header: "Header Parameters",
794
+ cookie: "Cookie Parameters"
795
+ };
796
+ function ParameterInput({ param, value, onChange }) {
797
+ const handleChange = React.useCallback((e) => {
798
+ onChange(param.name, e.target.value);
799
+ }, [param.name, onChange]);
800
+ const placeholder = param.example ?? param.default ?? `Filter by ${param.name}`;
801
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldStyle, children: [
802
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: labelStyle$1, htmlFor: `tryit-param-${param.name}`, children: [
803
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: nameStyle, children: param.name }),
804
+ param.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: requiredStyle, children: "*" })
805
+ ] }),
806
+ param.itemsEnum ? /* @__PURE__ */ jsxRuntime.jsx(
807
+ MultiEnumSelect,
808
+ {
809
+ param,
810
+ value,
811
+ onChange
812
+ }
813
+ ) : param.enum ? /* @__PURE__ */ jsxRuntime.jsxs("select", { id: `tryit-param-${param.name}`, value, onChange: handleChange, className: inputStyle, children: [
814
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "Select..." }),
815
+ param.enum.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt))
816
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(
817
+ "input",
818
+ {
819
+ id: `tryit-param-${param.name}`,
820
+ type: "text",
821
+ value,
822
+ onChange: handleChange,
823
+ placeholder,
824
+ className: inputStyle
825
+ }
826
+ ),
827
+ param.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: descriptionStyle$1, children: param.description })
828
+ ] });
829
+ }
830
+ function MultiEnumSelect({
831
+ param,
832
+ value,
833
+ onChange
834
+ }) {
835
+ const selected = new Set(value ? value.split(MULTI_VALUE_DELIMITER) : []);
836
+ const toggle = (option) => {
837
+ const next = new Set(selected);
838
+ if (next.has(option)) {
839
+ next.delete(option);
840
+ } else {
841
+ next.add(option);
842
+ }
843
+ onChange(param.name, Array.from(next).join(MULTI_VALUE_DELIMITER));
844
+ };
845
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: multiSelectStyle, role: "group", "aria-label": `${param.name} values`, children: (param.itemsEnum ?? []).map((option) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: multiOptionStyle, children: [
846
+ /* @__PURE__ */ jsxRuntime.jsx(
847
+ "input",
848
+ {
849
+ type: "checkbox",
850
+ checked: selected.has(option),
851
+ onChange: () => toggle(option)
852
+ }
853
+ ),
854
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: multiOptionLabelStyle, children: option })
855
+ ] }, option)) });
856
+ }
857
+ const multiSelectStyle = css.css({
858
+ display: "flex",
859
+ flexWrap: "wrap",
860
+ gap: "0.375rem"
861
+ });
862
+ const multiOptionStyle = css.css({
863
+ display: "inline-flex",
864
+ alignItems: "center",
865
+ gap: "0.25rem",
866
+ padding: "0.25rem 0.5rem",
867
+ border: "1px solid var(--omnispec-input-border)",
868
+ borderRadius: "1rem",
869
+ backgroundColor: "var(--omnispec-input-bg)",
870
+ cursor: "pointer",
871
+ fontSize: "var(--omnispec-font-size-xs)",
872
+ "&:hover": {
873
+ backgroundColor: "var(--omnispec-bg-secondary)"
874
+ }
875
+ });
876
+ const multiOptionLabelStyle = css.css({
877
+ color: "var(--omnispec-fg-primary)",
878
+ fontFamily: "var(--omnispec-font-mono)"
879
+ });
880
+ function groupByLocation(params) {
881
+ const grouped = {};
882
+ for (const param of params) {
883
+ if (!grouped[param.in]) grouped[param.in] = [];
884
+ grouped[param.in].push(param);
885
+ }
886
+ return grouped;
887
+ }
888
+
889
+ function getMultipartProps(schema) {
890
+ const properties = schema?.properties;
891
+ if (!properties) return [];
892
+ const required = schema?.required ?? [];
893
+ return Object.entries(properties).map(([name, prop]) => ({
894
+ name,
895
+ // `type: string, format: binary` (OAS 3.0) or `contentEncoding` (3.1)
896
+ // marks a file part; arrays of binary items also count.
897
+ isFile: prop.format === "binary" || prop.contentEncoding !== void 0 || prop.items?.format === "binary",
898
+ required: required.includes(name),
899
+ description: prop.description
900
+ }));
901
+ }
902
+ const containerStyle$3 = css.css({
903
+ marginBottom: "12px",
904
+ display: "flex",
905
+ flexDirection: "column"
906
+ });
907
+ const headerStyle = css.css({
908
+ display: "flex",
909
+ justifyContent: "space-between",
910
+ alignItems: "center",
911
+ marginBottom: "8px"
912
+ });
913
+ const labelStyle = css.css({
914
+ fontSize: "var(--omnispec-font-size-sm)",
915
+ fontWeight: 600,
916
+ color: "var(--omnispec-fg-secondary)",
917
+ textTransform: "uppercase",
918
+ letterSpacing: "0.5px"
919
+ });
920
+ const contentTypeSelectStyle = css.css({
921
+ padding: "4px 8px",
922
+ borderRadius: "var(--omnispec-border-radius)",
923
+ backgroundColor: "var(--omnispec-input-bg)",
924
+ color: "var(--omnispec-fg-primary)",
925
+ fontSize: "var(--omnispec-font-size-xs)",
926
+ fontFamily: "var(--omnispec-font-mono)"
927
+ });
928
+ const textareaStyle = css.css({
929
+ width: "100%",
930
+ minHeight: "120px",
931
+ padding: "10px",
932
+ borderRadius: "var(--omnispec-border-radius)",
933
+ backgroundColor: "var(--omnispec-bg-code)",
934
+ color: "var(--omnispec-fg-code)",
935
+ fontSize: "var(--omnispec-font-size-sm)",
936
+ fontFamily: "var(--omnispec-font-mono)",
937
+ resize: "vertical",
938
+ boxSizing: "border-box",
939
+ lineHeight: 1.5
940
+ });
941
+ function RequestBodyEditor({
942
+ value,
943
+ onChange,
944
+ contentType,
945
+ onContentTypeChange,
946
+ availableContentTypes = ["application/json"],
947
+ schema,
948
+ multipartFields = {},
949
+ onMultipartFieldChange
950
+ }) {
951
+ const textareaRef = React.useRef(null);
952
+ const autoResize = React.useCallback(() => {
953
+ const el = textareaRef.current;
954
+ if (!el) return;
955
+ el.style.height = "auto";
956
+ el.style.height = `${el.scrollHeight}px`;
957
+ }, []);
958
+ React.useEffect(() => {
959
+ autoResize();
960
+ }, [value, autoResize]);
961
+ const isMultipart = contentType.includes("multipart/form-data");
962
+ const isUrlEncoded = contentType.includes("application/x-www-form-urlencoded");
963
+ const multipartProps = isMultipart || isUrlEncoded ? getMultipartProps(schema) : [];
964
+ const showMultipartForm = (isMultipart || isUrlEncoded) && multipartProps.length > 0 && onMultipartFieldChange;
965
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `adr-request-body ${containerStyle$3}`, children: [
966
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: headerStyle, children: [
967
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: labelStyle, children: "Request Body" }),
968
+ availableContentTypes.length > 1 && onContentTypeChange && /* @__PURE__ */ jsxRuntime.jsx(
969
+ "select",
970
+ {
971
+ value: contentType,
972
+ onChange: (e) => onContentTypeChange(e.target.value),
973
+ className: contentTypeSelectStyle,
974
+ children: availableContentTypes.map((ct) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: ct, children: ct }, ct))
975
+ }
976
+ )
977
+ ] }),
978
+ showMultipartForm ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: multipartListStyle, children: multipartProps.map((prop) => {
979
+ const fieldValue = multipartFields[prop.name];
980
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: multipartFieldStyle, children: [
981
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: multipartLabelStyle, children: [
982
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: multipartNameStyle, children: prop.name }),
983
+ prop.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: multipartRequiredStyle, children: "*" })
984
+ ] }),
985
+ prop.isFile && isMultipart ? /* @__PURE__ */ jsxRuntime.jsx(
986
+ "input",
987
+ {
988
+ type: "file",
989
+ onChange: (e) => onMultipartFieldChange(prop.name, e.target.files?.[0] ?? null),
990
+ className: multipartFileInputStyle
991
+ }
992
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
993
+ "input",
994
+ {
995
+ type: "text",
996
+ value: typeof fieldValue === "string" ? fieldValue : "",
997
+ onChange: (e) => onMultipartFieldChange(prop.name, e.target.value),
998
+ placeholder: prop.description ?? prop.name,
999
+ className: multipartTextInputStyle
1000
+ }
1001
+ )
1002
+ ] }, prop.name);
1003
+ }) }) : /* @__PURE__ */ jsxRuntime.jsx(
1004
+ "textarea",
1005
+ {
1006
+ ref: textareaRef,
1007
+ name: "request-body",
1008
+ value,
1009
+ onChange: (e) => onChange(e.target.value),
1010
+ placeholder: getPlaceholder(contentType),
1011
+ className: textareaStyle,
1012
+ spellCheck: false
1013
+ }
1014
+ )
1015
+ ] });
1016
+ }
1017
+ const multipartListStyle = css.css({
1018
+ display: "flex",
1019
+ flexDirection: "column",
1020
+ gap: "0.625rem"
1021
+ });
1022
+ const multipartFieldStyle = css.css({
1023
+ display: "flex",
1024
+ flexDirection: "column",
1025
+ gap: "0.25rem"
1026
+ });
1027
+ const multipartLabelStyle = css.css({
1028
+ display: "flex",
1029
+ alignItems: "center",
1030
+ gap: "0.125rem"
1031
+ });
1032
+ const multipartNameStyle = css.css({
1033
+ fontSize: "var(--omnispec-font-size-sm)",
1034
+ fontWeight: 600,
1035
+ color: "var(--omnispec-fg-primary)",
1036
+ fontFamily: "var(--omnispec-font-mono)"
1037
+ });
1038
+ const multipartRequiredStyle = css.css({
1039
+ color: "var(--omnispec-color-error)",
1040
+ fontWeight: 600
1041
+ });
1042
+ const multipartTextInputStyle = css.css({
1043
+ width: "100%",
1044
+ padding: "0.5rem 0.625rem",
1045
+ borderRadius: "var(--omnispec-border-radius)",
1046
+ border: "1px solid var(--omnispec-input-border)",
1047
+ backgroundColor: "var(--omnispec-input-bg)",
1048
+ color: "var(--omnispec-fg-primary)",
1049
+ fontSize: "var(--omnispec-font-size-sm)",
1050
+ fontFamily: "var(--omnispec-font-mono)",
1051
+ boxSizing: "border-box"
1052
+ });
1053
+ const multipartFileInputStyle = css.css({
1054
+ width: "100%",
1055
+ fontSize: "var(--omnispec-font-size-sm)",
1056
+ color: "var(--omnispec-fg-secondary)",
1057
+ "&::file-selector-button": {
1058
+ padding: "0.375rem 0.75rem",
1059
+ marginRight: "0.5rem",
1060
+ borderRadius: "var(--omnispec-border-radius)",
1061
+ border: "1px solid var(--omnispec-input-border)",
1062
+ backgroundColor: "var(--omnispec-bg-secondary)",
1063
+ color: "var(--omnispec-fg-primary)",
1064
+ fontSize: "var(--omnispec-font-size-xs)",
1065
+ cursor: "pointer"
1066
+ }
1067
+ });
1068
+ function getPlaceholder(contentType) {
1069
+ if (contentType.includes("json")) return '{\n "key": "value"\n}';
1070
+ if (contentType.includes("xml")) return "<root>\n <element>value</element>\n</root>";
1071
+ return "Enter request body...";
1072
+ }
1073
+
1074
+ function CustomHeaders({ headers, onChange }) {
1075
+ const updateRow = (index, patch) => {
1076
+ onChange(headers.map((h, i) => i === index ? { ...h, ...patch } : h));
1077
+ };
1078
+ const removeRow = (index) => {
1079
+ onChange(headers.filter((_, i) => i !== index));
1080
+ };
1081
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `omnispec-custom-headers ${sectionStyle$2}`, children: [
1082
+ headers.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: sectionTitleStyle$1, children: "Custom Headers" }),
1083
+ headers.map((header, idx) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: rowStyle, children: [
1084
+ /* @__PURE__ */ jsxRuntime.jsx(
1085
+ "input",
1086
+ {
1087
+ type: "text",
1088
+ value: header.name,
1089
+ onChange: (e) => updateRow(idx, { name: e.target.value }),
1090
+ placeholder: "Header name",
1091
+ "aria-label": `Custom header ${idx + 1} name`,
1092
+ className: nameInputStyle
1093
+ }
1094
+ ),
1095
+ /* @__PURE__ */ jsxRuntime.jsx(
1096
+ "input",
1097
+ {
1098
+ type: "text",
1099
+ value: header.value,
1100
+ onChange: (e) => updateRow(idx, { value: e.target.value }),
1101
+ placeholder: "Value",
1102
+ "aria-label": `Custom header ${idx + 1} value`,
1103
+ className: valueInputStyle
1104
+ }
1105
+ ),
1106
+ /* @__PURE__ */ jsxRuntime.jsx(
1107
+ "button",
1108
+ {
1109
+ type: "button",
1110
+ onClick: () => removeRow(idx),
1111
+ "aria-label": `Remove custom header ${idx + 1}`,
1112
+ className: removeBtnStyle,
1113
+ children: /* @__PURE__ */ jsxRuntime.jsx(useSpecFetcher.Icon, { name: "xmark", size: "0.875rem" })
1114
+ }
1115
+ )
1116
+ ] }, idx)),
1117
+ /* @__PURE__ */ jsxRuntime.jsx(
1118
+ "button",
1119
+ {
1120
+ type: "button",
1121
+ onClick: () => onChange([...headers, { name: "", value: "" }]),
1122
+ className: addBtnStyle,
1123
+ children: "+ Add header"
1124
+ }
1125
+ )
1126
+ ] });
1127
+ }
1128
+ const sectionStyle$2 = css.css({
1129
+ display: "flex",
1130
+ flexDirection: "column",
1131
+ gap: "0.5rem",
1132
+ marginBottom: "0.75rem"
1133
+ });
1134
+ const sectionTitleStyle$1 = css.css({
1135
+ fontSize: "var(--omnispec-font-size-sm)",
1136
+ fontWeight: 600,
1137
+ color: "var(--omnispec-fg-muted)",
1138
+ textTransform: "uppercase",
1139
+ letterSpacing: "0.5px"
1140
+ });
1141
+ const rowStyle = css.css({
1142
+ display: "flex",
1143
+ alignItems: "center",
1144
+ gap: "0.375rem"
1145
+ });
1146
+ const inputBase = {
1147
+ padding: "0.375rem 0.5rem",
1148
+ borderRadius: "var(--omnispec-border-radius)",
1149
+ border: "1px solid var(--omnispec-input-border)",
1150
+ backgroundColor: "var(--omnispec-input-bg)",
1151
+ color: "var(--omnispec-fg-primary)",
1152
+ fontSize: "var(--omnispec-font-size-xs)",
1153
+ fontFamily: "var(--omnispec-font-mono)",
1154
+ minWidth: 0
1155
+ };
1156
+ const nameInputStyle = css.css({
1157
+ ...inputBase,
1158
+ flex: 1
1159
+ });
1160
+ const valueInputStyle = css.css({
1161
+ ...inputBase,
1162
+ flex: 1.4
1163
+ });
1164
+ const removeBtnStyle = css.css({
1165
+ display: "inline-flex",
1166
+ alignItems: "center",
1167
+ justifyContent: "center",
1168
+ padding: "0.25rem",
1169
+ backgroundColor: "transparent",
1170
+ border: "none",
1171
+ color: "var(--omnispec-fg-muted)",
1172
+ cursor: "pointer",
1173
+ "&:hover": {
1174
+ color: "var(--omnispec-color-error)"
1175
+ }
1176
+ });
1177
+ const addBtnStyle = css.css({
1178
+ alignSelf: "flex-start",
1179
+ padding: "0.25rem 0.625rem",
1180
+ fontSize: "var(--omnispec-font-size-xs)",
1181
+ fontFamily: "var(--omnispec-font-sans)",
1182
+ fontWeight: 500,
1183
+ color: "var(--omnispec-fg-link)",
1184
+ backgroundColor: "transparent",
1185
+ border: "1px solid var(--omnispec-border-color)",
1186
+ borderRadius: "1rem",
1187
+ cursor: "pointer",
1188
+ "&:hover": {
1189
+ backgroundColor: "var(--omnispec-bg-secondary)"
1190
+ }
1191
+ });
1192
+
1193
+ function TryItPanel({
1194
+ method,
1195
+ path,
1196
+ serverUrl,
1197
+ parameters = [],
1198
+ requestBodyContentTypes,
1199
+ defaultRequestBody,
1200
+ requestBodySchema,
1201
+ requestBodySchemas,
1202
+ security,
1203
+ xCodeSamples,
1204
+ docked = true,
1205
+ onRequest,
1206
+ onResponse
1207
+ }) {
1208
+ const { allowTryIt, proxyUrl, proxyHeaders, specKey, tryItPersistTtl } = useSpecFetcher.useConfig();
1209
+ const { getAuthHeaders, appliedAuth, openAuthPanel, hasAuth, clearAuth } = OpenIdConnectManual.useAuth();
1210
+ const authorized = appliedAuth.size > 0;
1211
+ const persistenceDisabled = tryItPersistTtl === 0;
1212
+ const operationKey = `${method.toUpperCase()} ${path}`;
1213
+ const persisted = React.useMemo(
1214
+ () => OpenIdConnectManual.loadTryItState(specKey, operationKey, tryItPersistTtl),
1215
+ [specKey, operationKey, tryItPersistTtl]
1216
+ );
1217
+ const defaultParamValues = () => {
1218
+ const initial = {};
1219
+ for (const param of parameters) {
1220
+ const val = param.example ?? param.default;
1221
+ if (val !== void 0) initial[param.name] = val;
1222
+ }
1223
+ return initial;
1224
+ };
1225
+ const [paramValues, setParamValues] = React.useState(() => ({
1226
+ ...defaultParamValues(),
1227
+ ...persisted?.paramValues
1228
+ }));
1229
+ const [body, setBody] = React.useState(persisted?.body ?? defaultRequestBody ?? "");
1230
+ const [contentType, setContentType] = React.useState(
1231
+ persisted?.contentType ?? requestBodyContentTypes?.[0] ?? "application/json"
1232
+ );
1233
+ const [multipartFields, setMultipartFields] = React.useState(
1234
+ () => ({ ...persisted?.formFields })
1235
+ );
1236
+ const [customHeaders, setCustomHeaders] = React.useState(
1237
+ () => persisted?.customHeaders ?? []
1238
+ );
1239
+ const [response, setResponse] = React.useState(null);
1240
+ const [loading, setLoading] = React.useState(false);
1241
+ const [error, setError] = React.useState();
1242
+ const [codeLang, setCodeLang] = React.useState("curl");
1243
+ const touchedParams = React.useRef(new Set(Object.keys(persisted?.paramValues ?? {})));
1244
+ React.useEffect(() => {
1245
+ if (!specKey || persistenceDisabled) return;
1246
+ const formFields = {};
1247
+ for (const [name, value] of Object.entries(multipartFields)) {
1248
+ if (typeof value === "string" && value !== "") formFields[name] = value;
1249
+ }
1250
+ OpenIdConnectManual.saveTryItState(specKey, operationKey, {
1251
+ paramValues,
1252
+ body,
1253
+ contentType,
1254
+ formFields,
1255
+ customHeaders
1256
+ });
1257
+ }, [specKey, operationKey, persistenceDisabled, paramValues, body, contentType, multipartFields, customHeaders]);
1258
+ const missingRequiredParams = React.useMemo(() => {
1259
+ const missing = [];
1260
+ for (const param of parameters) {
1261
+ if (!param.required) continue;
1262
+ if (param.in !== "path" && param.in !== "query") continue;
1263
+ if (!paramValues[param.name]?.trim()) missing.push(`${param.name} (${param.in})`);
1264
+ }
1265
+ return missing;
1266
+ }, [parameters, paramValues]);
1267
+ const authSatisfied = React.useMemo(() => {
1268
+ if (!security || security.length === 0) return true;
1269
+ return security.some((group) => group.length === 0 || group.every((name) => appliedAuth.has(name)));
1270
+ }, [security, appliedAuth]);
1271
+ const authMismatch = !authSatisfied && appliedAuth.size > 0;
1272
+ const authBlocked = !authSatisfied && appliedAuth.size === 0;
1273
+ const declaredSchemes = React.useMemo(
1274
+ () => Array.from(new Set((security ?? []).flat())),
1275
+ [security]
1276
+ );
1277
+ const sendBlocked = missingRequiredParams.length > 0 || authBlocked;
1278
+ const handleReset = () => {
1279
+ OpenIdConnectManual.clearTryItState(specKey, operationKey);
1280
+ touchedParams.current = /* @__PURE__ */ new Set();
1281
+ setParamValues(defaultParamValues());
1282
+ setBody(defaultRequestBody ?? "");
1283
+ setContentType(requestBodyContentTypes?.[0] ?? "application/json");
1284
+ setMultipartFields({});
1285
+ setCustomHeaders([]);
1286
+ clearAuth();
1287
+ };
1288
+ const handleParamChange = React.useCallback((name, value) => {
1289
+ touchedParams.current.add(name);
1290
+ setParamValues((prev) => ({ ...prev, [name]: value }));
1291
+ }, []);
1292
+ const exampleSignature = parameters.map((p) => `${p.name}=${p.example ?? ""}`).join("|");
1293
+ React.useEffect(() => {
1294
+ setParamValues((prev) => {
1295
+ let changed = false;
1296
+ const next = { ...prev };
1297
+ for (const param of parameters) {
1298
+ if (param.example === void 0) continue;
1299
+ if (touchedParams.current.has(param.name)) continue;
1300
+ if (next[param.name] !== param.example) {
1301
+ next[param.name] = param.example;
1302
+ changed = true;
1303
+ }
1304
+ }
1305
+ return changed ? next : prev;
1306
+ });
1307
+ }, [exampleSignature]);
1308
+ const buildRequest = React.useCallback(() => {
1309
+ const authHeaders = getAuthHeaders();
1310
+ const headers = { ...authHeaders };
1311
+ for (const param of parameters) {
1312
+ if (param.in === "header" && paramValues[param.name]) {
1313
+ headers[param.name] = paramValues[param.name];
1314
+ }
1315
+ }
1316
+ for (const header of customHeaders) {
1317
+ const name = header.name.trim();
1318
+ if (name) headers[name] = header.value;
1319
+ }
1320
+ const bodyCapable = ["post", "put", "patch"].includes(method.toLowerCase());
1321
+ const isMultipart = contentType.includes("multipart/form-data");
1322
+ const isUrlEncoded = contentType.includes("application/x-www-form-urlencoded");
1323
+ const hasFormFieldValues = Object.values(multipartFields).some((v) => v !== null && v !== "");
1324
+ const pathParams = {};
1325
+ const queryParams = {};
1326
+ for (const param of parameters) {
1327
+ const val = paramValues[param.name];
1328
+ if (!val) continue;
1329
+ if (param.in === "path") pathParams[param.name] = val;
1330
+ if (param.in === "query") {
1331
+ if (param.itemsEnum) {
1332
+ const values = val.split(MULTI_VALUE_DELIMITER).filter(Boolean);
1333
+ queryParams[param.name] = param.explode === false ? values.join(",") : values;
1334
+ } else {
1335
+ queryParams[param.name] = val;
1336
+ }
1337
+ }
1338
+ }
1339
+ let encodedBody;
1340
+ if (bodyCapable && isMultipart) {
1341
+ const formData = new FormData();
1342
+ let hasEntries = false;
1343
+ for (const [name, value] of Object.entries(multipartFields)) {
1344
+ if (value === null || value === "") continue;
1345
+ formData.append(name, value);
1346
+ hasEntries = true;
1347
+ }
1348
+ if (hasEntries) encodedBody = formData;
1349
+ } else if (bodyCapable && isUrlEncoded && hasFormFieldValues) {
1350
+ headers["Content-Type"] = contentType;
1351
+ const params = new URLSearchParams();
1352
+ for (const [name, value] of Object.entries(multipartFields)) {
1353
+ if (value === null || value === "" || typeof value !== "string") continue;
1354
+ params.set(name, value);
1355
+ }
1356
+ encodedBody = params.toString();
1357
+ } else if (bodyCapable && body) {
1358
+ headers["Content-Type"] = contentType;
1359
+ encodedBody = body;
1360
+ if (isUrlEncoded) {
1361
+ try {
1362
+ const parsed = JSON.parse(body);
1363
+ const params = new URLSearchParams();
1364
+ for (const [key, value] of Object.entries(parsed)) {
1365
+ params.set(key, String(value));
1366
+ }
1367
+ encodedBody = params.toString();
1368
+ } catch {
1369
+ encodedBody = body;
1370
+ }
1371
+ }
1372
+ }
1373
+ return {
1374
+ url: path,
1375
+ method: method.toUpperCase(),
1376
+ headers,
1377
+ pathParams,
1378
+ queryParams,
1379
+ body: encodedBody,
1380
+ bodyType: contentType
1381
+ };
1382
+ }, [parameters, paramValues, body, contentType, multipartFields, customHeaders, method, path, getAuthHeaders]);
1383
+ const handleSend = React.useCallback(async () => {
1384
+ setLoading(true);
1385
+ setError(void 0);
1386
+ setResponse(null);
1387
+ const request2 = buildRequest();
1388
+ onRequest?.(request2);
1389
+ const fullRequest = {
1390
+ ...request2,
1391
+ url: serverUrl + request2.url
1392
+ };
1393
+ try {
1394
+ const res = proxyUrl ? await OpenIdConnectManual.sendProxiedRequest(proxyUrl, fullRequest, proxyHeaders) : await OpenIdConnectManual.sendDirectRequest(fullRequest);
1395
+ setResponse(res);
1396
+ onResponse?.(res);
1397
+ } catch (err) {
1398
+ const message = err instanceof Error ? err.message : "Request failed";
1399
+ if (!proxyUrl && message.includes("Failed to fetch")) {
1400
+ const isHttpTarget = /^http:\/\//i.test(fullRequest.url);
1401
+ const hint = isHttpTarget ? "The spec's server URL uses http://, which browsers block from an https page and often can't follow to https (the redirect carries no CORS headers). Use an https:// server URL, or route requests through a proxyUrl." : "This is usually a CORS restriction \u2014 the API does not allow browser cross-origin requests. Configure a proxyUrl to route requests through your backend.";
1402
+ setError(`${message}. ${hint}`);
1403
+ } else {
1404
+ setError(message);
1405
+ }
1406
+ } finally {
1407
+ setLoading(false);
1408
+ }
1409
+ }, [proxyUrl, proxyHeaders, buildRequest, serverUrl, onRequest, onResponse]);
1410
+ const schemaBody = React.useMemo(() => {
1411
+ if (!requestBodySchema) return void 0;
1412
+ return JSON.stringify(Collapsible.generateExample(requestBodySchema), null, 2);
1413
+ }, [requestBodySchema]);
1414
+ if (!allowTryIt) return null;
1415
+ const request = buildRequest();
1416
+ const hasBodyMethods = ["post", "put", "patch"].includes(method.toLowerCase());
1417
+ const codeSampleRequest = React.useMemo(() => {
1418
+ const r = { ...request };
1419
+ if (hasBodyMethods && !r.body && schemaBody) {
1420
+ r.body = schemaBody;
1421
+ if (!r.headers["Content-Type"]) {
1422
+ r.headers = { ...r.headers, "Content-Type": contentType };
1423
+ }
1424
+ }
1425
+ return r;
1426
+ }, [request, hasBodyMethods, schemaBody, contentType]);
1427
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: css.cx("omnispec-tryit", docked && dockedContainerStyle), children: [
1428
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: titleRowStyle, children: [
1429
+ /* @__PURE__ */ jsxRuntime.jsx("h4", { className: titleStyle$3, children: "Try it" }),
1430
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: statusRowStyle, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: headerActionsStyle, children: [
1431
+ hasAuth && /* @__PURE__ */ jsxRuntime.jsxs(
1432
+ "button",
1433
+ {
1434
+ type: "button",
1435
+ onClick: openAuthPanel,
1436
+ className: headerBtnStyle,
1437
+ title: authorized ? "Update authorization credentials" : "Set authorization credentials",
1438
+ children: [
1439
+ /* @__PURE__ */ jsxRuntime.jsx(
1440
+ useSpecFetcher.Icon,
1441
+ {
1442
+ name: authorized ? "lock-keyhole" : "lock-keyhole-open",
1443
+ size: "0.875rem",
1444
+ color: authorized ? "var(--omnispec-color-success)" : void 0
1445
+ }
1446
+ ),
1447
+ authorized ? "Authorized" : "Authorize"
1448
+ ]
1449
+ }
1450
+ ),
1451
+ /* @__PURE__ */ jsxRuntime.jsxs(
1452
+ "button",
1453
+ {
1454
+ type: "button",
1455
+ onClick: handleReset,
1456
+ className: headerBtnStyle,
1457
+ title: "Reset Try-It inputs for this operation and clear all applied authorization",
1458
+ children: [
1459
+ /* @__PURE__ */ jsxRuntime.jsx(useSpecFetcher.Icon, { name: "rotate-ccw", size: "0.875rem" }),
1460
+ "Reset"
1461
+ ]
1462
+ }
1463
+ )
1464
+ ] }) })
1465
+ ] }),
1466
+ parameters.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
1467
+ ParameterForm,
1468
+ {
1469
+ parameters,
1470
+ values: paramValues,
1471
+ onChange: handleParamChange
1472
+ }
1473
+ ),
1474
+ /* @__PURE__ */ jsxRuntime.jsx(CustomHeaders, { headers: customHeaders, onChange: setCustomHeaders }),
1475
+ hasBodyMethods && requestBodyContentTypes && /* @__PURE__ */ jsxRuntime.jsx(
1476
+ RequestBodyEditor,
1477
+ {
1478
+ value: body,
1479
+ onChange: setBody,
1480
+ contentType,
1481
+ onContentTypeChange: setContentType,
1482
+ availableContentTypes: requestBodyContentTypes,
1483
+ schema: requestBodySchemas?.[contentType] ?? requestBodySchema,
1484
+ multipartFields,
1485
+ onMultipartFieldChange: (name, value) => setMultipartFields((prev) => ({ ...prev, [name]: value }))
1486
+ }
1487
+ ),
1488
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: actionsStyle, children: /* @__PURE__ */ jsxRuntime.jsx(
1489
+ useSpecFetcher.Button,
1490
+ {
1491
+ variant: "primary",
1492
+ onClick: handleSend,
1493
+ disabled: loading || sendBlocked,
1494
+ className: fullWidthBtnStyle,
1495
+ children: loading ? "Sending..." : "Send"
1496
+ }
1497
+ ) }),
1498
+ (sendBlocked || authMismatch) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: validationMsgStyle, role: "status", children: [
1499
+ missingRequiredParams.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1500
+ "Required: ",
1501
+ missingRequiredParams.join(", ")
1502
+ ] }),
1503
+ authBlocked && /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Authorization required \u2014 apply credentials in the Authorization panel." }),
1504
+ authMismatch && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1505
+ "This operation declares ",
1506
+ declaredSchemes.join(", "),
1507
+ " \u2014 your applied credentials will be sent with the request."
1508
+ ] })
1509
+ ] }),
1510
+ /* @__PURE__ */ jsxRuntime.jsx(
1511
+ OpenIdConnectManual.CodeSamples,
1512
+ {
1513
+ request: codeSampleRequest,
1514
+ serverUrl,
1515
+ selectedLanguage: codeLang,
1516
+ onLanguageChange: setCodeLang,
1517
+ xCodeSamples
1518
+ }
1519
+ ),
1520
+ /* @__PURE__ */ jsxRuntime.jsx(OpenIdConnectManual.ResponseViewer, { response, loading, error })
1521
+ ] });
1522
+ }
1523
+ const dockedContainerStyle = css.css({
1524
+ position: "sticky",
1525
+ top: "calc(var(--omnispec-offset-top, 0px) + 1.25rem)",
1526
+ [useSpecFetcher.mq.desktop]: {
1527
+ // When the panel is taller than the viewport, a sticky element would pin
1528
+ // its top and push its bottom off-screen with no way to reach it (the page
1529
+ // scroll tracks the taller left column). Cap it to the viewport and let the
1530
+ // panel scroll its own overflow so every control stays reachable.
1531
+ maxHeight: "calc(100vh - var(--omnispec-offset-top, 0px) - 2.5rem)",
1532
+ overflowY: "auto",
1533
+ // Keep the internal scrollbar off the content edge.
1534
+ paddingRight: "0.25rem"
1535
+ }
1536
+ });
1537
+ const titleRowStyle = css.css({
1538
+ display: "flex",
1539
+ alignItems: "center",
1540
+ gap: "8px",
1541
+ marginBottom: "12px"
1542
+ });
1543
+ const titleStyle$3 = css.css({
1544
+ margin: 0,
1545
+ fontSize: "var(--omnispec-font-size-base)",
1546
+ fontWeight: 600,
1547
+ color: "var(--omnispec-fg-primary)"
1548
+ });
1549
+ const actionsStyle = css.css({
1550
+ display: "flex",
1551
+ gap: "8px",
1552
+ marginBottom: "12px"
1553
+ });
1554
+ const fullWidthBtnStyle = css.css({
1555
+ width: "100%"
1556
+ });
1557
+ const statusRowStyle = css.css({
1558
+ display: "flex",
1559
+ alignItems: "center",
1560
+ gap: "6px",
1561
+ fontSize: "var(--omnispec-font-size-xs)",
1562
+ flex: 1
1563
+ });
1564
+ const validationMsgStyle = css.css({
1565
+ display: "flex",
1566
+ flexDirection: "column",
1567
+ gap: "0.25rem",
1568
+ marginBottom: "0.75rem",
1569
+ fontSize: "var(--omnispec-font-size-xs)",
1570
+ color: "var(--omnispec-color-warning)",
1571
+ lineHeight: 1.4
1572
+ });
1573
+ const headerActionsStyle = css.css({
1574
+ marginLeft: "auto",
1575
+ display: "flex",
1576
+ alignItems: "center",
1577
+ gap: "6px"
1578
+ });
1579
+ const headerBtnStyle = css.css({
1580
+ display: "inline-flex",
1581
+ alignItems: "center",
1582
+ gap: "0.375rem",
1583
+ padding: "0.25rem 0.625rem",
1584
+ fontSize: "var(--omnispec-font-size-sm)",
1585
+ fontFamily: "var(--omnispec-font-sans)",
1586
+ color: "var(--omnispec-fg-muted)",
1587
+ backgroundColor: "transparent",
1588
+ border: "1px solid var(--omnispec-border-color)",
1589
+ borderRadius: "var(--omnispec-border-radius)",
1590
+ cursor: "pointer",
1591
+ "&:hover": {
1592
+ color: "var(--omnispec-fg-primary)",
1593
+ backgroundColor: "var(--omnispec-bg-secondary)"
1594
+ }
1595
+ });
1596
+
1597
+ function InlineTryIt(props) {
1598
+ const [open, setOpen] = React.useState(false);
1599
+ const regionId = React.useId();
1600
+ const regionRef = React.useRef(null);
1601
+ React.useEffect(() => {
1602
+ if (open) {
1603
+ regionRef.current?.scrollIntoView({ block: "nearest" });
1604
+ }
1605
+ }, [open]);
1606
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperStyle, children: [
1607
+ /* @__PURE__ */ jsxRuntime.jsxs(
1608
+ "button",
1609
+ {
1610
+ type: "button",
1611
+ className: triggerStyle,
1612
+ onClick: () => setOpen((prev) => !prev),
1613
+ "aria-expanded": open,
1614
+ "aria-controls": regionId,
1615
+ children: [
1616
+ /* @__PURE__ */ jsxRuntime.jsx(useSpecFetcher.Icon, { name: "chevron-right", size: "0.875rem", className: css.cx(chevronStyle$1, open && chevronOpenStyle) }),
1617
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: open ? "Hide Try it" : "Try it" })
1618
+ ]
1619
+ }
1620
+ ),
1621
+ /* @__PURE__ */ jsxRuntime.jsx("div", { id: regionId, ref: regionRef, hidden: !open, className: regionStyle, children: /* @__PURE__ */ jsxRuntime.jsx(TryItPanel, { ...props, docked: false }) })
1622
+ ] });
1623
+ }
1624
+ const wrapperStyle = css.css({
1625
+ marginTop: "1rem"
1626
+ });
1627
+ const triggerStyle = css.css({
1628
+ display: "flex",
1629
+ alignItems: "center",
1630
+ gap: "0.5rem",
1631
+ width: "100%",
1632
+ padding: "0.625rem 1rem",
1633
+ background: "var(--omnispec-bg-secondary)",
1634
+ color: "var(--omnispec-fg-primary)",
1635
+ border: "none",
1636
+ borderRadius: "var(--omnispec-border-radius)",
1637
+ boxShadow: "var(--omnispec-btn-secondary-shadow)",
1638
+ cursor: "pointer",
1639
+ fontSize: "var(--omnispec-font-size-base)",
1640
+ fontWeight: 600,
1641
+ textAlign: "left",
1642
+ "&:hover": {
1643
+ background: "var(--omnispec-btn-secondary-bg-hover)"
1644
+ }
1645
+ });
1646
+ const chevronStyle$1 = css.css({
1647
+ display: "inline-flex",
1648
+ flexShrink: 0,
1649
+ transition: "transform 0.2s ease"
1650
+ });
1651
+ const chevronOpenStyle = css.css({
1652
+ transform: "rotate(90deg)"
1653
+ });
1654
+ const regionStyle = css.css({
1655
+ paddingTop: "0.75rem"
1656
+ });
1657
+
1658
+ const HTTP_METHODS = ["get", "post", "put", "delete", "patch", "options", "head"];
1659
+ function parseCallbacks(callbacks) {
1660
+ const result = [];
1661
+ for (const [name, callbackValue] of Object.entries(callbacks)) {
1662
+ if (!callbackValue || typeof callbackValue !== "object") continue;
1663
+ const pathItemMap = callbackValue;
1664
+ for (const [urlExpression, pathItem] of Object.entries(pathItemMap)) {
1665
+ if (!pathItem || typeof pathItem !== "object") continue;
1666
+ const pathItemObj = pathItem;
1667
+ for (const method of HTTP_METHODS) {
1668
+ const operation = pathItemObj[method];
1669
+ if (!operation || typeof operation !== "object") continue;
1670
+ const op = operation;
1671
+ let requestBodySchema;
1672
+ const requestBody = op.requestBody;
1673
+ if (requestBody?.content && typeof requestBody.content === "object") {
1674
+ const content = requestBody.content;
1675
+ const firstMedia = Object.values(content)[0];
1676
+ if (firstMedia?.schema && typeof firstMedia.schema === "object") {
1677
+ requestBodySchema = firstMedia.schema;
1678
+ }
1679
+ }
1680
+ const responseStatuses = [];
1681
+ const responses = op.responses;
1682
+ if (responses && typeof responses === "object") {
1683
+ for (const [code, responseValue] of Object.entries(responses)) {
1684
+ const response = responseValue;
1685
+ responseStatuses.push({
1686
+ code,
1687
+ description: typeof response?.description === "string" ? response.description : ""
1688
+ });
1689
+ }
1690
+ }
1691
+ result.push({
1692
+ name,
1693
+ urlExpression,
1694
+ method,
1695
+ summary: typeof op.summary === "string" ? op.summary : void 0,
1696
+ description: typeof op.description === "string" ? op.description : void 0,
1697
+ requestBodySchema,
1698
+ responseStatuses
1699
+ });
1700
+ }
1701
+ }
1702
+ }
1703
+ return result;
1704
+ }
1705
+ function CallbackCard({ callback }) {
1706
+ const [expanded, setExpanded] = React.useState(false);
1707
+ const method = callback.method;
1708
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cardStyle, children: [
1709
+ /* @__PURE__ */ jsxRuntime.jsxs(
1710
+ "button",
1711
+ {
1712
+ type: "button",
1713
+ className: cardHeaderStyle,
1714
+ onClick: () => setExpanded((prev) => !prev),
1715
+ "aria-expanded": expanded,
1716
+ children: [
1717
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: css.cx(chevronStyle, expanded && chevronExpandedStyle), children: /* @__PURE__ */ jsxRuntime.jsx(useSpecFetcher.Icon, { name: "chevron-right", size: "0.75rem" }) }),
1718
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: callbackNameStyle, children: callback.name }),
1719
+ /* @__PURE__ */ jsxRuntime.jsx("code", { className: urlExpressionStyle, children: callback.urlExpression })
1720
+ ]
1721
+ }
1722
+ ),
1723
+ expanded && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cardBodyStyle, children: [
1724
+ /* @__PURE__ */ jsxRuntime.jsx(
1725
+ Collapsible.MethodBar,
1726
+ {
1727
+ label: callback.method.toUpperCase(),
1728
+ path: callback.urlExpression,
1729
+ method
1730
+ }
1731
+ ),
1732
+ callback.summary && /* @__PURE__ */ jsxRuntime.jsx("p", { className: summaryStyle$1, children: callback.summary }),
1733
+ callback.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: descriptionStyle, children: callback.description }),
1734
+ callback.requestBodySchema && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: sectionStyle$1, children: [
1735
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: sectionLabelStyle, children: "Request Body" }),
1736
+ /* @__PURE__ */ jsxRuntime.jsx(Collapsible.SchemaTree, { nodes: Collapsible.schemaToNodes(callback.requestBodySchema), context: "request" })
1737
+ ] }),
1738
+ callback.responseStatuses.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: sectionStyle$1, children: [
1739
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: sectionLabelStyle, children: "Responses" }),
1740
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: responseListStyle$1, children: callback.responseStatuses.map(({ code, description }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: responseRowStyle, children: [
1741
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: css.cx(statusBadgeStyle$1, css.css({
1742
+ backgroundColor: getStatusBg$1(code),
1743
+ color: getStatusColor$1(code)
1744
+ })), children: code }),
1745
+ description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: responseDescStyle$1, children: description })
1746
+ ] }, code)) })
1747
+ ] })
1748
+ ] })
1749
+ ] });
1750
+ }
1751
+ function CallbacksSection({ callbacks }) {
1752
+ const parsed = parseCallbacks(callbacks);
1753
+ if (parsed.length === 0) return null;
1754
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: containerStyle$2, children: [
1755
+ /* @__PURE__ */ jsxRuntime.jsx("h4", { className: titleStyle$2, children: "Callbacks" }),
1756
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cardListStyle, children: parsed.map((cb, idx) => /* @__PURE__ */ jsxRuntime.jsx(CallbackCard, { callback: cb }, `${cb.name}-${cb.method}-${idx}`)) })
1757
+ ] });
1758
+ }
1759
+ function getStatusColor$1(code) {
1760
+ const num = parseInt(code, 10);
1761
+ if (num >= 200 && num < 300) return "var(--omnispec-color-success)";
1762
+ if (num >= 300 && num < 400) return "var(--omnispec-color-info)";
1763
+ if (num >= 400 && num < 500) return "var(--omnispec-color-warning)";
1764
+ if (num >= 500) return "var(--omnispec-color-error)";
1765
+ return "var(--omnispec-fg-primary)";
1766
+ }
1767
+ function getStatusBg$1(code) {
1768
+ const num = parseInt(code, 10);
1769
+ if (num >= 200 && num < 300) return "rgba(26, 127, 55, 0.1)";
1770
+ if (num >= 300 && num < 400) return "rgba(5, 80, 174, 0.1)";
1771
+ if (num >= 400 && num < 500) return "rgba(191, 135, 0, 0.1)";
1772
+ if (num >= 500) return "rgba(207, 34, 46, 0.1)";
1773
+ return "var(--omnispec-bg-tertiary)";
1774
+ }
1775
+ const containerStyle$2 = css.css({
1776
+ marginBottom: "1.5rem"
1777
+ });
1778
+ const titleStyle$2 = css.css({
1779
+ margin: "0 0 0.75rem",
1780
+ fontSize: "var(--omnispec-font-size-md)",
1781
+ fontWeight: 700,
1782
+ color: "var(--omnispec-fg-primary)",
1783
+ letterSpacing: "0.02em"
1784
+ });
1785
+ const cardListStyle = css.css({
1786
+ display: "flex",
1787
+ flexDirection: "column",
1788
+ gap: "0.5rem"
1789
+ });
1790
+ const cardStyle = css.css({
1791
+ borderRadius: "0.375rem",
1792
+ border: "1px dashed var(--omnispec-border-color)",
1793
+ overflow: "hidden"
1794
+ });
1795
+ const cardHeaderStyle = css.css({
1796
+ display: "flex",
1797
+ alignItems: "center",
1798
+ gap: "0.625rem",
1799
+ width: "100%",
1800
+ padding: "0.625rem 0.75rem",
1801
+ background: "var(--omnispec-bg-secondary)",
1802
+ border: "none",
1803
+ cursor: "pointer",
1804
+ textAlign: "left",
1805
+ flexWrap: "wrap",
1806
+ [useSpecFetcher.mq.desktop]: {
1807
+ flexWrap: "nowrap",
1808
+ gap: "0.75rem",
1809
+ padding: "0.625rem 1rem"
1810
+ }
1811
+ });
1812
+ const chevronStyle = css.css({
1813
+ color: "var(--omnispec-fg-muted)",
1814
+ flexShrink: 0,
1815
+ transition: "transform 0.2s ease"
1816
+ });
1817
+ const chevronExpandedStyle = css.css({
1818
+ transform: "rotate(90deg)"
1819
+ });
1820
+ const callbackNameStyle = css.css({
1821
+ fontSize: "var(--omnispec-font-size-sm)",
1822
+ fontWeight: 600,
1823
+ color: "var(--omnispec-fg-primary)",
1824
+ flexShrink: 0
1825
+ });
1826
+ const urlExpressionStyle = css.css({
1827
+ fontSize: "var(--omnispec-font-size-xs)",
1828
+ fontFamily: "var(--omnispec-font-mono)",
1829
+ color: "var(--omnispec-fg-muted)",
1830
+ backgroundColor: "var(--omnispec-bg-tertiary)",
1831
+ padding: "0.125rem 0.375rem",
1832
+ borderRadius: "0.25rem",
1833
+ minWidth: 0,
1834
+ wordBreak: "break-all",
1835
+ [useSpecFetcher.mq.desktop]: {
1836
+ wordBreak: "normal"
1837
+ }
1838
+ });
1839
+ const cardBodyStyle = css.css({
1840
+ padding: "0",
1841
+ borderTop: "1px solid var(--omnispec-border-color)"
1842
+ });
1843
+ const summaryStyle$1 = css.css({
1844
+ margin: "0.75rem 1rem 0",
1845
+ fontSize: "var(--omnispec-font-size-base)",
1846
+ color: "var(--omnispec-fg-secondary)",
1847
+ lineHeight: 1.5
1848
+ });
1849
+ const descriptionStyle = css.css({
1850
+ margin: "0.5rem 1rem 0",
1851
+ fontSize: "var(--omnispec-font-size-sm)",
1852
+ color: "var(--omnispec-fg-secondary)",
1853
+ lineHeight: 1.5
1854
+ });
1855
+ const sectionStyle$1 = css.css({
1856
+ padding: "0.75rem 1rem",
1857
+ borderTop: "1px solid color-mix(in srgb, var(--omnispec-border-color) 60%, transparent)"
1858
+ });
1859
+ const sectionLabelStyle = css.css({
1860
+ display: "block",
1861
+ fontSize: "var(--omnispec-font-size-xs)",
1862
+ fontWeight: 600,
1863
+ color: "var(--omnispec-fg-muted)",
1864
+ textTransform: "uppercase",
1865
+ letterSpacing: "0.05em",
1866
+ marginBottom: "0.5rem"
1867
+ });
1868
+ const responseListStyle$1 = css.css({
1869
+ display: "flex",
1870
+ flexDirection: "column",
1871
+ gap: "0.375rem"
1872
+ });
1873
+ const responseRowStyle = css.css({
1874
+ display: "flex",
1875
+ alignItems: "center",
1876
+ gap: "0.625rem"
1877
+ });
1878
+ const statusBadgeStyle$1 = css.css({
1879
+ fontFamily: "var(--omnispec-font-mono)",
1880
+ fontWeight: 700,
1881
+ fontSize: "var(--omnispec-font-size-sm)",
1882
+ padding: "0.125rem 0.5rem",
1883
+ borderRadius: "0.25rem",
1884
+ flexShrink: 0
1885
+ });
1886
+ const responseDescStyle$1 = css.css({
1887
+ fontSize: "var(--omnispec-font-size-sm)",
1888
+ color: "var(--omnispec-fg-secondary)"
1889
+ });
1890
+
1891
+ function ExampleBlock({ media }) {
1892
+ const namedExamples = OpenIdConnectManual.getNamedExamples(media);
1893
+ const [selectedExample, setSelectedExample] = React.useState(namedExamples[0]?.name ?? "");
1894
+ const activeExample = namedExamples.find((ex) => ex.name === selectedExample);
1895
+ const exampleValue = activeExample?.value;
1896
+ const displayCode = exampleValue !== void 0 ? typeof exampleValue === "string" ? exampleValue : JSON.stringify(exampleValue, null, 2) : media.schema ? JSON.stringify(Collapsible.generateExample(media.schema), null, 2) : "{}";
1897
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1898
+ /* @__PURE__ */ jsxRuntime.jsx(
1899
+ OpenIdConnectManual.ExampleSelector,
1900
+ {
1901
+ examples: namedExamples,
1902
+ selectedName: selectedExample,
1903
+ onSelect: setSelectedExample
1904
+ }
1905
+ ),
1906
+ /* @__PURE__ */ jsxRuntime.jsx(Collapsible.CodeBlock, { code: displayCode, language: "json" })
1907
+ ] });
1908
+ }
1909
+ function OperationDetail({
1910
+ operation,
1911
+ paramExampleSelections,
1912
+ onParamExampleSelect
1913
+ }) {
1914
+ const opId = operation.operationId ?? `${operation.method}-${operation.path}`;
1915
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1916
+ operation.deprecated && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: deprecatedBannerStyle, role: "alert", children: [
1917
+ /* @__PURE__ */ jsxRuntime.jsx(useSpecFetcher.Icon, { name: "warning", size: "1rem" }),
1918
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "This operation is deprecated and may be removed in a future release. Avoid using it in new integrations." })
1919
+ ] }),
1920
+ operation.summary && /* @__PURE__ */ jsxRuntime.jsx("p", { className: summaryStyle, children: operation.summary }),
1921
+ operation.externalDocs && /* @__PURE__ */ jsxRuntime.jsxs(
1922
+ "a",
1923
+ {
1924
+ href: operation.externalDocs.url,
1925
+ target: "_blank",
1926
+ rel: "noopener noreferrer",
1927
+ className: externalDocsLinkStyle,
1928
+ children: [
1929
+ operation.externalDocs.description ?? "External docs",
1930
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: externalDocsArrowStyle$1, children: "\u2197" })
1931
+ ]
1932
+ }
1933
+ ),
1934
+ operation.description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionStyle, children: /* @__PURE__ */ jsxRuntime.jsx(Collapsible.MarkdownRenderer, { content: operation.description }) }),
1935
+ operation.security && operation.security.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: sectionStyle, children: [
1936
+ /* @__PURE__ */ jsxRuntime.jsx(OpenIdConnectManual.LinkableHeading, { id: `${opId}-security`, as: "h4", className: sectionTitleStyle, children: "Security" }),
1937
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: securitySchemesList, children: operation.security.map((schemes, idx) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: securitySchemesRow, children: [
1938
+ schemes.map((scheme) => /* @__PURE__ */ jsxRuntime.jsxs("span", { className: securitySchemeBadge, children: [
1939
+ /* @__PURE__ */ jsxRuntime.jsx(useSpecFetcher.Icon, { name: "lock", size: "0.625rem", strokeWidth: 2.5 }),
1940
+ scheme
1941
+ ] }, scheme)),
1942
+ idx < operation.security.length - 1 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: securityOrLabel, children: "or" })
1943
+ ] }, idx)) })
1944
+ ] }),
1945
+ operation.parameters.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: sectionStyle, children: [
1946
+ /* @__PURE__ */ jsxRuntime.jsx(OpenIdConnectManual.LinkableHeading, { id: `${opId}-parameters`, as: "h4", className: sectionTitleStyle, children: "Parameters" }),
1947
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: paramListStyle, children: operation.parameters.map((param) => {
1948
+ const paramKey = `${param.in}-${param.name}`;
1949
+ const paramSchema = param.schema ?? {};
1950
+ const constraintBadges = Collapsible.buildConstraints(paramSchema);
1951
+ const paramFormat = paramSchema.format;
1952
+ const paramEnum = paramSchema.enum;
1953
+ const namedExamples = param.examples ? Object.entries(param.examples).map(([name, ex]) => ({
1954
+ name,
1955
+ summary: ex.summary,
1956
+ value: ex.value
1957
+ })) : [];
1958
+ const selectedName = paramExampleSelections?.[paramKey] ?? namedExamples[0]?.name ?? "";
1959
+ const activeExample = namedExamples.find((ex) => ex.name === selectedName);
1960
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: paramRowStyle, children: [
1961
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: paramHeaderStyle, children: [
1962
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: paramNameStyle, children: param.name }),
1963
+ /* @__PURE__ */ jsxRuntime.jsx("pre", { className: typeBadgeStyle, children: param.schema?.type ?? "any" }),
1964
+ param.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: requiredBadgeStyle, children: "Required" }),
1965
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: inBadgeStyle, children: param.in })
1966
+ ] }),
1967
+ (paramFormat || constraintBadges.length > 0 || paramEnum && paramEnum.length > 0) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: paramConstraintsStyle, children: [
1968
+ paramFormat && /* @__PURE__ */ jsxRuntime.jsx("span", { className: paramConstraintBadgeStyle, children: paramFormat }),
1969
+ constraintBadges.map((c) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: paramConstraintBadgeStyle, children: c }, c)),
1970
+ paramEnum && paramEnum.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: paramEnumBadgeStyle, children: [
1971
+ "enum: ",
1972
+ paramEnum.map(String).join(" | ")
1973
+ ] })
1974
+ ] }),
1975
+ param.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: paramDescStyle, children: param.description }),
1976
+ namedExamples.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
1977
+ OpenIdConnectManual.ExampleSelector,
1978
+ {
1979
+ examples: namedExamples,
1980
+ selectedName,
1981
+ onSelect: (name) => onParamExampleSelect?.(paramKey, name)
1982
+ }
1983
+ ),
1984
+ activeExample?.value !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("code", { className: paramExampleValueStyle, children: typeof activeExample.value === "string" ? activeExample.value : JSON.stringify(activeExample.value) })
1985
+ ] }, paramKey);
1986
+ }) })
1987
+ ] }),
1988
+ operation.requestBody && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: sectionStyle, children: [
1989
+ /* @__PURE__ */ jsxRuntime.jsxs(OpenIdConnectManual.LinkableHeading, { id: `${opId}-request-body`, as: "h4", className: sectionTitleStyle, children: [
1990
+ "Request Body",
1991
+ operation.requestBody.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: requiredBadgeStyle, children: " Required" })
1992
+ ] }),
1993
+ operation.requestBody.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: paramDescStyle, children: operation.requestBody.description }),
1994
+ Object.entries(operation.requestBody.content).map(([contentType, media]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: mediaTypeStyle, children: [
1995
+ /* @__PURE__ */ jsxRuntime.jsx("code", { className: contentTypeBadgeStyle, children: contentType }),
1996
+ media.schema && /* @__PURE__ */ jsxRuntime.jsx(
1997
+ Collapsible.Tabs,
1998
+ {
1999
+ tabs: [
2000
+ {
2001
+ id: "schema",
2002
+ label: "Schema",
2003
+ content: /* @__PURE__ */ jsxRuntime.jsx(Collapsible.SchemaTree, { nodes: Collapsible.schemaToNodes(media.schema), context: "request" })
2004
+ },
2005
+ {
2006
+ id: "example",
2007
+ label: "Example",
2008
+ content: /* @__PURE__ */ jsxRuntime.jsx(ExampleBlock, { media })
2009
+ }
2010
+ ]
2011
+ }
2012
+ )
2013
+ ] }, contentType))
2014
+ ] }),
2015
+ operation.responses.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: sectionStyle, children: [
2016
+ /* @__PURE__ */ jsxRuntime.jsx(OpenIdConnectManual.LinkableHeading, { id: `${opId}-responses`, as: "h4", className: sectionTitleStyle, children: "Responses" }),
2017
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: responseListStyle, children: operation.responses.map((response) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: responseCardStyle, children: [
2018
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: responseHeaderStyle, children: [
2019
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: css.cx(statusBadgeStyle, css.css({
2020
+ backgroundColor: getStatusBg(response.statusCode),
2021
+ color: getStatusColor(response.statusCode)
2022
+ })), children: response.statusCode }),
2023
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: responseDescStyle, children: response.description })
2024
+ ] }),
2025
+ response.headers && Object.keys(response.headers).length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: responseHeadersSection, children: [
2026
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: responseHeadersLabel, children: "Headers" }),
2027
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: responseHeadersList, children: Object.entries(response.headers).map(([headerName, header]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: responseHeaderWrapper, children: [
2028
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: responseHeaderRow, children: [
2029
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: responseHeaderName, children: headerName }),
2030
+ header.schema && /* @__PURE__ */ jsxRuntime.jsx("pre", { className: typeBadgeStyle, children: header.schema.type ?? "string" })
2031
+ ] }),
2032
+ header.description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: responseHeaderDesc, children: header.description })
2033
+ ] }, headerName)) })
2034
+ ] }),
2035
+ response.content && Object.entries(response.content).map(([contentType, media]) => {
2036
+ const hasNamedExamples = OpenIdConnectManual.getNamedExamples(media).length > 0;
2037
+ const hasSchema = !!media.schema;
2038
+ const hasExample = hasNamedExamples;
2039
+ if (!hasSchema && !hasExample) return null;
2040
+ const tabs = [];
2041
+ if (hasSchema) {
2042
+ tabs.push({
2043
+ id: `schema-${response.statusCode}-${contentType}`,
2044
+ label: "Schema",
2045
+ content: /* @__PURE__ */ jsxRuntime.jsx(Collapsible.SchemaTree, { nodes: Collapsible.schemaToNodes(media.schema), context: "response" })
2046
+ });
2047
+ }
2048
+ if (hasExample || hasSchema) {
2049
+ tabs.push({
2050
+ id: `example-${response.statusCode}-${contentType}`,
2051
+ label: "Example",
2052
+ content: /* @__PURE__ */ jsxRuntime.jsx(ExampleBlock, { media })
2053
+ });
2054
+ }
2055
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: mediaTypeStyle, children: [
2056
+ /* @__PURE__ */ jsxRuntime.jsx("code", { className: contentTypeLabel, children: contentType }),
2057
+ /* @__PURE__ */ jsxRuntime.jsx(Collapsible.Tabs, { tabs, defaultTab: hasExample && !hasSchema ? tabs[0]?.id : void 0 })
2058
+ ] }, contentType);
2059
+ })
2060
+ ] }, response.statusCode)) })
2061
+ ] }),
2062
+ operation.callbacks && Object.keys(operation.callbacks).length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionStyle, children: /* @__PURE__ */ jsxRuntime.jsx(CallbacksSection, { callbacks: operation.callbacks }) })
2063
+ ] });
2064
+ }
2065
+ function getStatusColor(code) {
2066
+ const num = parseInt(code, 10);
2067
+ if (num >= 200 && num < 300) return "var(--omnispec-color-success)";
2068
+ if (num >= 300 && num < 400) return "var(--omnispec-color-info)";
2069
+ if (num >= 400 && num < 500) return "var(--omnispec-color-warning)";
2070
+ if (num >= 500) return "var(--omnispec-color-error)";
2071
+ return "var(--omnispec-fg-primary)";
2072
+ }
2073
+ function getStatusBg(code) {
2074
+ const num = parseInt(code, 10);
2075
+ if (num >= 200 && num < 300) return "rgba(26, 127, 55, 0.1)";
2076
+ if (num >= 300 && num < 400) return "rgba(5, 80, 174, 0.1)";
2077
+ if (num >= 400 && num < 500) return "rgba(191, 135, 0, 0.1)";
2078
+ if (num >= 500) return "rgba(207, 34, 46, 0.1)";
2079
+ return "var(--omnispec-bg-tertiary)";
2080
+ }
2081
+ const summaryStyle = css.css({
2082
+ margin: "0 0 16px",
2083
+ fontSize: "var(--omnispec-font-size-base)",
2084
+ color: "var(--omnispec-fg-secondary)",
2085
+ lineHeight: 1.5
2086
+ });
2087
+ const sectionStyle = css.css({
2088
+ marginBottom: "24px"
2089
+ });
2090
+ const sectionTitleStyle = css.css({
2091
+ margin: "0 0 12px",
2092
+ fontSize: "var(--omnispec-font-size-md)",
2093
+ fontWeight: 700,
2094
+ color: "var(--omnispec-fg-primary)",
2095
+ letterSpacing: "0.02em"
2096
+ });
2097
+ const paramListStyle = css.css({
2098
+ display: "flex",
2099
+ flexDirection: "column"
2100
+ });
2101
+ const paramRowStyle = css.css({
2102
+ padding: "12px 0"
2103
+ });
2104
+ const paramHeaderStyle = css.css({
2105
+ display: "flex",
2106
+ alignItems: "center",
2107
+ gap: "8px",
2108
+ flexWrap: "wrap"
2109
+ });
2110
+ const paramNameStyle = css.css({
2111
+ fontSize: "var(--omnispec-font-size-sm)",
2112
+ fontWeight: 700,
2113
+ backgroundColor: "transparent",
2114
+ padding: 0
2115
+ });
2116
+ const typeBadgeStyle = css.css({
2117
+ fontSize: "var(--omnispec-font-size-xs)",
2118
+ fontWeight: 400
2119
+ });
2120
+ const requiredBadgeStyle = css.css({
2121
+ fontSize: "var(--omnispec-font-size-xxs)",
2122
+ fontWeight: 600,
2123
+ color: "var(--omnispec-color-error)",
2124
+ textTransform: "uppercase",
2125
+ letterSpacing: "0.05em"
2126
+ });
2127
+ const inBadgeStyle = css.css({
2128
+ fontSize: "var(--omnispec-font-size-xxs)",
2129
+ color: "var(--omnispec-fg-muted)",
2130
+ backgroundColor: "var(--omnispec-bg-tertiary)",
2131
+ padding: "1px 6px",
2132
+ borderRadius: "3px",
2133
+ fontFamily: "var(--omnispec-font-mono)"
2134
+ });
2135
+ const paramDescStyle = css.css({
2136
+ margin: "4px 0 0",
2137
+ fontSize: "var(--omnispec-font-size-base)",
2138
+ color: "var(--omnispec-fg-secondary)",
2139
+ lineHeight: 1.5
2140
+ });
2141
+ const deprecatedBannerStyle = css.css({
2142
+ display: "flex",
2143
+ alignItems: "flex-start",
2144
+ gap: "0.5rem",
2145
+ padding: "0.625rem 0.75rem",
2146
+ marginBottom: "1rem",
2147
+ borderRadius: "var(--omnispec-border-radius)",
2148
+ backgroundColor: "color-mix(in srgb, var(--omnispec-color-warning) 12%, transparent)",
2149
+ color: "var(--omnispec-color-warning)",
2150
+ fontSize: "var(--omnispec-font-size-sm)",
2151
+ lineHeight: 1.4
2152
+ });
2153
+ const paramConstraintsStyle = css.css({
2154
+ display: "flex",
2155
+ flexWrap: "wrap",
2156
+ gap: "0.375rem",
2157
+ marginTop: "0.375rem"
2158
+ });
2159
+ const paramConstraintBadgeStyle = css.css({
2160
+ fontFamily: "var(--omnispec-font-mono)",
2161
+ fontSize: "var(--omnispec-font-size-xs)",
2162
+ color: "var(--omnispec-fg-muted)",
2163
+ backgroundColor: "var(--omnispec-bg-secondary)",
2164
+ padding: "0.0625rem 0.375rem",
2165
+ borderRadius: "var(--omnispec-border-radius)"
2166
+ });
2167
+ const paramEnumBadgeStyle = css.css({
2168
+ fontFamily: "var(--omnispec-font-mono)",
2169
+ fontSize: "var(--omnispec-font-size-xs)",
2170
+ color: "var(--omnispec-color-info)",
2171
+ backgroundColor: "var(--omnispec-bg-secondary)",
2172
+ padding: "0.0625rem 0.375rem",
2173
+ borderRadius: "var(--omnispec-border-radius)",
2174
+ wordBreak: "break-word"
2175
+ });
2176
+ const paramExampleValueStyle = css.css({
2177
+ display: "block",
2178
+ marginTop: "0.375rem",
2179
+ fontFamily: "var(--omnispec-font-mono)",
2180
+ fontSize: "var(--omnispec-font-size-xs)",
2181
+ color: "var(--omnispec-fg-code)",
2182
+ wordBreak: "break-all"
2183
+ });
2184
+ const mediaTypeStyle = css.css({
2185
+ marginTop: "1rem",
2186
+ overflow: "hidden",
2187
+ minWidth: 0
2188
+ });
2189
+ const contentTypeLabel = css.css({
2190
+ display: "inline-block",
2191
+ fontFamily: "var(--omnispec-font-mono)",
2192
+ fontSize: "var(--omnispec-font-size-xs)",
2193
+ color: "var(--omnispec-fg-muted)",
2194
+ marginBottom: "4px"
2195
+ });
2196
+ const contentTypeBadgeStyle = css.css({
2197
+ marginBottom: "8px",
2198
+ fontSize: "var(--omnispec-font-size-sm)"
2199
+ });
2200
+ const responseListStyle = css.css({
2201
+ display: "flex",
2202
+ flexDirection: "column",
2203
+ gap: "8px"
2204
+ });
2205
+ const responseCardStyle = css.css({
2206
+ minWidth: 0,
2207
+ [useSpecFetcher.mq.desktop]: {
2208
+ padding: "0.625rem 1rem",
2209
+ borderRadius: "var(--omnispec-border-radius)",
2210
+ border: "1px solid color-mix(in srgb, var(--omnispec-border-color) 80%, transparent)"
2211
+ }
2212
+ });
2213
+ const responseHeaderStyle = css.css({
2214
+ display: "flex",
2215
+ alignItems: "center",
2216
+ gap: "10px"
2217
+ });
2218
+ const statusBadgeStyle = css.css({
2219
+ fontFamily: "var(--omnispec-font-mono)",
2220
+ fontWeight: 700,
2221
+ fontSize: "var(--omnispec-font-size-sm)",
2222
+ padding: "2px 8px",
2223
+ borderRadius: "4px"
2224
+ });
2225
+ const responseDescStyle = css.css({
2226
+ fontSize: "var(--omnispec-font-size-sm)",
2227
+ color: "var(--omnispec-fg-secondary)"
2228
+ });
2229
+ const securitySchemesList = css.css({
2230
+ display: "flex",
2231
+ gap: "8px"
2232
+ });
2233
+ const securitySchemesRow = css.css({
2234
+ display: "flex",
2235
+ alignItems: "center",
2236
+ gap: "6px",
2237
+ flexWrap: "wrap"
2238
+ });
2239
+ const securitySchemeBadge = css.css({
2240
+ display: "inline-flex",
2241
+ alignItems: "center",
2242
+ gap: "5px",
2243
+ fontSize: "var(--omnispec-font-size-xs)",
2244
+ fontFamily: "var(--omnispec-font-mono)",
2245
+ color: "var(--omnispec-fg-primary)",
2246
+ backgroundColor: "var(--omnispec-bg-tertiary)",
2247
+ padding: "3px 10px",
2248
+ borderRadius: "4px",
2249
+ fontWeight: 500
2250
+ });
2251
+ const securityOrLabel = css.css({
2252
+ fontSize: "var(--omnispec-font-size-xs)",
2253
+ color: "var(--omnispec-fg-muted)",
2254
+ fontStyle: "italic"
2255
+ });
2256
+ const externalDocsLinkStyle = css.css({
2257
+ display: "inline-flex",
2258
+ alignItems: "center",
2259
+ gap: "4px",
2260
+ fontSize: "var(--omnispec-font-size-xs)",
2261
+ color: "var(--omnispec-fg-link)",
2262
+ textDecoration: "none",
2263
+ backgroundColor: "var(--omnispec-bg-tertiary)",
2264
+ padding: "3px 10px",
2265
+ borderRadius: "12px",
2266
+ fontWeight: 500,
2267
+ marginBottom: "12px",
2268
+ "&:hover": {
2269
+ textDecoration: "underline"
2270
+ }
2271
+ });
2272
+ const externalDocsArrowStyle$1 = css.css({
2273
+ fontSize: "11px"
2274
+ });
2275
+ const responseHeadersSection = css.css({
2276
+ marginTop: "8px",
2277
+ paddingTop: "8px",
2278
+ borderTop: "1px dashed var(--omnispec-border-color)"
2279
+ });
2280
+ const responseHeadersLabel = css.css({
2281
+ fontSize: "var(--omnispec-font-size-xs)",
2282
+ fontWeight: 600,
2283
+ color: "var(--omnispec-fg-muted)",
2284
+ textTransform: "uppercase",
2285
+ letterSpacing: "0.05em",
2286
+ display: "block",
2287
+ marginBottom: "10px"
2288
+ });
2289
+ const responseHeadersList = css.css({
2290
+ display: "flex",
2291
+ flexDirection: "column",
2292
+ gap: "10px"
2293
+ });
2294
+ const responseHeaderWrapper = css.css({
2295
+ display: "flex",
2296
+ flexDirection: "column"
2297
+ });
2298
+ const responseHeaderRow = css.css({
2299
+ display: "flex",
2300
+ alignItems: "center",
2301
+ gap: "8px",
2302
+ padding: "4px 0"
2303
+ });
2304
+ const responseHeaderName = css.css({
2305
+ fontFamily: "var(--omnispec-font-mono)",
2306
+ fontSize: "var(--omnispec-font-size-sm)",
2307
+ fontWeight: 600,
2308
+ color: "var(--omnispec-fg-primary)",
2309
+ backgroundColor: "transparent",
2310
+ padding: 0
2311
+ });
2312
+ const responseHeaderDesc = css.css({
2313
+ fontSize: "var(--omnispec-font-size-xs)",
2314
+ color: "var(--omnispec-fg-secondary)"
2315
+ });
2316
+
2317
+ function EndpointCard({ operation, serverUrl, id, expandAll, expandGeneration }) {
2318
+ const { allowTryIt, displayMode, tryItLayout } = useSpecFetcher.useConfig();
2319
+ const title = operation.summary || operation.operationId || operation.path;
2320
+ const paramCount = operation.parameters.length + (operation.requestBody ? 1 : 0);
2321
+ const rightLabel = paramCount > 0 ? `${paramCount} param${paramCount !== 1 ? "s" : ""}` : void 0;
2322
+ const [paramExampleSelections, setParamExampleSelections] = React.useState({});
2323
+ const tryItParams = operation.parameters.map((p) => {
2324
+ const schema = p.schema;
2325
+ const items = schema?.items;
2326
+ const itemsEnum = schema?.type === "array" && Array.isArray(items?.enum) ? items.enum.map(String) : void 0;
2327
+ const exampleValue = resolveParamExampleValue(p, paramExampleSelections[`${p.in}-${p.name}`]);
2328
+ return {
2329
+ name: p.name,
2330
+ in: p.in,
2331
+ required: p.required,
2332
+ description: p.description,
2333
+ type: schema?.type,
2334
+ format: schema?.format,
2335
+ enum: schema?.enum,
2336
+ itemsEnum,
2337
+ explode: p.explode,
2338
+ example: exampleValue !== null && exampleValue !== void 0 ? String(exampleValue) : void 0,
2339
+ default: schema?.default !== null && schema?.default !== void 0 ? String(schema.default) : void 0
2340
+ };
2341
+ });
2342
+ const requestBodyContentTypes = operation.requestBody?.content ? Object.keys(operation.requestBody.content) : void 0;
2343
+ const defaultContentType = requestBodyContentTypes?.[0];
2344
+ const defaultBodySchema = defaultContentType ? operation.requestBody?.content[defaultContentType]?.schema : void 0;
2345
+ const requestBodySchemas = operation.requestBody?.content ? Object.fromEntries(
2346
+ Object.entries(operation.requestBody.content).map(([ct, media]) => [
2347
+ ct,
2348
+ media.schema
2349
+ ])
2350
+ ) : void 0;
2351
+ const defaultBodyExample = defaultBodySchema ? JSON.stringify(Collapsible.generateExample(defaultBodySchema), null, 2) : void 0;
2352
+ const tryItPanelProps = {
2353
+ method: operation.method,
2354
+ path: operation.path,
2355
+ serverUrl,
2356
+ parameters: tryItParams,
2357
+ requestBodyContentTypes,
2358
+ defaultRequestBody: defaultBodyExample,
2359
+ requestBodySchema: defaultBodySchema,
2360
+ requestBodySchemas,
2361
+ security: operation.security,
2362
+ xCodeSamples: operation.xCodeSamples
2363
+ };
2364
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2365
+ Collapsible.ExpandableCard,
2366
+ {
2367
+ id,
2368
+ title,
2369
+ rightLabel,
2370
+ deprecated: operation.deprecated,
2371
+ badges: operation.xBadges,
2372
+ expandAll,
2373
+ expandGeneration,
2374
+ children: [
2375
+ /* @__PURE__ */ jsxRuntime.jsx(
2376
+ Collapsible.MethodBar,
2377
+ {
2378
+ label: operation.method,
2379
+ path: operation.path,
2380
+ method: operation.method
2381
+ }
2382
+ ),
2383
+ displayMode === "reference" ? /* @__PURE__ */ jsxRuntime.jsx(
2384
+ OpenIdConnectManual.ReferenceLayout,
2385
+ {
2386
+ operationId: id ?? `${operation.method}-${operation.path}`,
2387
+ schema: /* @__PURE__ */ jsxRuntime.jsx(
2388
+ OpenIdConnectManual.ReferenceOperationDetail,
2389
+ {
2390
+ operationId: id ?? `${operation.method}-${operation.path}`,
2391
+ description: operation.description,
2392
+ parameters: operation.parameters,
2393
+ requestBody: operation.requestBody,
2394
+ responses: operation.responses,
2395
+ security: operation.security
2396
+ }
2397
+ ),
2398
+ samples: /* @__PURE__ */ jsxRuntime.jsx(
2399
+ OpenIdConnectManual.SamplesPanel,
2400
+ {
2401
+ method: operation.method,
2402
+ path: operation.path,
2403
+ serverUrl,
2404
+ operationId: id ?? `${operation.method}-${operation.path}`,
2405
+ requestBodySchema: defaultBodySchema,
2406
+ requestBodyContentType: defaultContentType,
2407
+ responses: operation.responses
2408
+ }
2409
+ ),
2410
+ tryIt: allowTryIt ? /* @__PURE__ */ jsxRuntime.jsx(TryItPanel, { ...tryItPanelProps }) : /* @__PURE__ */ jsxRuntime.jsx("div", {})
2411
+ }
2412
+ ) : tryItLayout === "inline" ? (
2413
+ // Inline (compact only): operation detail spans full width, with the
2414
+ // Try-It console in a collapsed-by-default disclosure below it.
2415
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: inlineWrapperStyle, children: [
2416
+ /* @__PURE__ */ jsxRuntime.jsx(
2417
+ OperationDetail,
2418
+ {
2419
+ operation,
2420
+ paramExampleSelections,
2421
+ onParamExampleSelect: (key, name) => setParamExampleSelections((prev) => ({ ...prev, [key]: name }))
2422
+ }
2423
+ ),
2424
+ allowTryIt && /* @__PURE__ */ jsxRuntime.jsx(InlineTryIt, { ...tryItPanelProps })
2425
+ ] })
2426
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
2427
+ OpenIdConnectManual.ResponsiveColumns,
2428
+ {
2429
+ left: /* @__PURE__ */ jsxRuntime.jsx(
2430
+ OperationDetail,
2431
+ {
2432
+ operation,
2433
+ paramExampleSelections,
2434
+ onParamExampleSelect: (key, name) => setParamExampleSelections((prev) => ({ ...prev, [key]: name }))
2435
+ }
2436
+ ),
2437
+ right: allowTryIt ? /* @__PURE__ */ jsxRuntime.jsx(TryItPanel, { ...tryItPanelProps }) : void 0,
2438
+ rightLabel: "Try It"
2439
+ }
2440
+ )
2441
+ ]
2442
+ }
2443
+ );
2444
+ }
2445
+ const inlineWrapperStyle = css.css({
2446
+ padding: "0.75rem 0",
2447
+ minWidth: 0,
2448
+ [useSpecFetcher.mq.desktop]: {
2449
+ padding: "1rem 1.25rem"
2450
+ }
2451
+ });
2452
+ function resolveParamExampleValue(param, selectedName) {
2453
+ if (param.examples && Object.keys(param.examples).length > 0) {
2454
+ if (selectedName && param.examples[selectedName]) {
2455
+ return param.examples[selectedName].value;
2456
+ }
2457
+ const first = Object.values(param.examples)[0];
2458
+ return first?.value;
2459
+ }
2460
+ return param.example;
2461
+ }
2462
+
2463
+ const TagGroup = React.memo(function TagGroup2({ tag, serverUrl, expandAll, expandGeneration }) {
2464
+ const title = /* @__PURE__ */ jsxRuntime.jsxs("span", { className: tagTitleStyle, children: [
2465
+ tag.displayName ?? tag.name,
2466
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: tagCountStyle, children: tag.operations.length })
2467
+ ] });
2468
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `omnispec-tag-group ${tagContainerStyle}`, id: `tag-${tag.name}`, children: /* @__PURE__ */ jsxRuntime.jsxs(Collapsible.Collapsible, { title, defaultOpen: true, headerStyle: tagHeaderStyleObj, children: [
2469
+ tag.description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: tagDescriptionStyle, children: /* @__PURE__ */ jsxRuntime.jsx(Collapsible.MarkdownRenderer, { content: tag.description }) }),
2470
+ tag.externalDocs && /* @__PURE__ */ jsxRuntime.jsxs(
2471
+ "a",
2472
+ {
2473
+ href: tag.externalDocs.url,
2474
+ target: "_blank",
2475
+ rel: "noopener noreferrer",
2476
+ className: externalDocsStyle,
2477
+ children: [
2478
+ tag.externalDocs.description ?? "External docs",
2479
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: externalDocsArrowStyle, children: "\u2197" })
2480
+ ]
2481
+ }
2482
+ ),
2483
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: tagOperationsStyle, children: tag.operations.map((op, idx) => /* @__PURE__ */ jsxRuntime.jsx(
2484
+ EndpointCard,
2485
+ {
2486
+ id: op.operationId ?? `${op.method}-${op.path}`,
2487
+ operation: op,
2488
+ serverUrl,
2489
+ expandAll,
2490
+ expandGeneration
2491
+ },
2492
+ op.operationId ?? `${op.method}-${op.path}-${idx}`
2493
+ )) })
2494
+ ] }) });
2495
+ });
2496
+ const tagContainerStyle = css.css({
2497
+ marginBottom: "32px"
2498
+ });
2499
+ const tagHeaderStyleObj = {
2500
+ paddingBottom: "8px",
2501
+ borderBottom: "2px solid var(--omnispec-border-color)",
2502
+ marginBottom: "12px"
2503
+ };
2504
+ const tagTitleStyle = css.css({
2505
+ fontSize: "18px",
2506
+ fontWeight: 800,
2507
+ color: "var(--omnispec-fg-primary)",
2508
+ display: "flex",
2509
+ alignItems: "center",
2510
+ gap: "10px",
2511
+ letterSpacing: "-0.01em"
2512
+ });
2513
+ const tagCountStyle = css.css({
2514
+ fontSize: "11px",
2515
+ fontWeight: 500,
2516
+ color: "var(--omnispec-fg-muted)",
2517
+ backgroundColor: "var(--omnispec-bg-tertiary)",
2518
+ padding: "2px 8px",
2519
+ borderRadius: "10px",
2520
+ fontFamily: "var(--omnispec-font-mono)"
2521
+ });
2522
+ const tagDescriptionStyle = css.css({
2523
+ marginBottom: "16px",
2524
+ fontSize: "var(--omnispec-font-size-sm)",
2525
+ color: "var(--omnispec-fg-secondary)",
2526
+ lineHeight: 1.6
2527
+ });
2528
+ const externalDocsStyle = css.css({
2529
+ display: "inline-flex",
2530
+ alignItems: "center",
2531
+ gap: "0.25rem",
2532
+ fontSize: "var(--omnispec-font-size-xs)",
2533
+ color: "var(--omnispec-fg-link)",
2534
+ textDecoration: "none",
2535
+ marginBottom: "1rem",
2536
+ "&:hover": {
2537
+ textDecoration: "underline"
2538
+ }
2539
+ });
2540
+ const externalDocsArrowStyle = css.css({
2541
+ fontSize: "0.75em"
2542
+ });
2543
+ const tagOperationsStyle = css.css({
2544
+ display: "flex",
2545
+ flexDirection: "column"
2546
+ });
2547
+
2548
+ function ComponentsSection({ components, expandAll, expandGeneration }) {
2549
+ const schemas = Object.entries(components.schemas);
2550
+ if (schemas.length === 0) return null;
2551
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `omnispec-components ${containerStyle$1}`, children: [
2552
+ /* @__PURE__ */ jsxRuntime.jsx(OpenIdConnectManual.LinkableHeading, { id: "schemas", as: "h2", className: titleStyle$1, children: "Schemas" }),
2553
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: schemaWrapperStyle, children: schemas.map(([name, schema]) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: schemaStyle, id: `schema-${name}`, children: /* @__PURE__ */ jsxRuntime.jsx(
2554
+ Collapsible.Collapsible,
2555
+ {
2556
+ title: /* @__PURE__ */ jsxRuntime.jsx("span", { className: schemaNameStyle, children: name }),
2557
+ defaultOpen: false,
2558
+ expandAll,
2559
+ expandGeneration,
2560
+ children: /* @__PURE__ */ jsxRuntime.jsx(Collapsible.SchemaTree, { nodes: Collapsible.schemaToNodes(schema) })
2561
+ }
2562
+ ) }, name)) })
2563
+ ] });
2564
+ }
2565
+ const containerStyle$1 = css.css({
2566
+ marginTop: "2rem",
2567
+ paddingTop: "1.5rem",
2568
+ borderTop: "1px solid var(--omnispec-border-color)",
2569
+ [useSpecFetcher.mq.mobile]: {
2570
+ borderTop: "none",
2571
+ marginTop: "1.5rem",
2572
+ paddingTop: "1rem"
2573
+ }
2574
+ });
2575
+ const titleStyle$1 = css.css({
2576
+ margin: "0 0 16px",
2577
+ fontSize: "var(--omnispec-h2-font-size)",
2578
+ color: "var(--omnispec-h2-color)",
2579
+ fontWeight: 700
2580
+ });
2581
+ const schemaWrapperStyle = css.css({
2582
+ border: "1px solid var(--omnispec-border-color)",
2583
+ borderRadius: "0.5rem",
2584
+ padding: "1.5rem 1rem",
2585
+ minWidth: 0
2586
+ });
2587
+ const schemaStyle = css.css({
2588
+ marginBottom: "8px"
2589
+ });
2590
+ const schemaNameStyle = css.css({
2591
+ fontFamily: "var(--omnispec-font-mono)",
2592
+ fontSize: "var(--omnispec-font-size-base)",
2593
+ fontWeight: 600,
2594
+ color: "var(--omnispec-color-primary)",
2595
+ overflowWrap: "break-word",
2596
+ wordBreak: "break-all",
2597
+ "&:hover": {
2598
+ textDecoration: "none"
2599
+ }
2600
+ });
2601
+
2602
+ function parseHash() {
2603
+ const hash = window.location.hash.slice(1);
2604
+ if (!hash || hash === "/") {
2605
+ return { view: "overview", operationId: null };
2606
+ }
2607
+ return { view: "operation", operationId: hash };
2608
+ }
2609
+ function useSegmentedRouter() {
2610
+ const [route, setRoute] = React.useState(parseHash);
2611
+ React.useEffect(() => {
2612
+ const onHashChange = () => setRoute(parseHash());
2613
+ window.addEventListener("hashchange", onHashChange);
2614
+ return () => window.removeEventListener("hashchange", onHashChange);
2615
+ }, []);
2616
+ const navigateToOperation = React.useCallback((operationId) => {
2617
+ window.location.hash = operationId;
2618
+ }, []);
2619
+ const navigateToOverview = React.useCallback(() => {
2620
+ window.history.replaceState(null, "", window.location.pathname);
2621
+ setRoute({ view: "overview", operationId: null });
2622
+ }, []);
2623
+ return { route, navigateToOperation, navigateToOverview };
2624
+ }
2625
+
2626
+ function OperationView({ operation, serverUrl, onBack, tagName }) {
2627
+ const { allowTryIt, displayMode, tryItLayout } = useSpecFetcher.useConfig();
2628
+ const title = operation.summary || operation.operationId || operation.path;
2629
+ const tryItParams = operation.parameters.map((p) => {
2630
+ const schema = p.schema;
2631
+ return {
2632
+ name: p.name,
2633
+ in: p.in,
2634
+ required: p.required,
2635
+ description: p.description,
2636
+ type: schema?.type,
2637
+ format: schema?.format,
2638
+ enum: schema?.enum,
2639
+ example: p.example !== null && p.example !== void 0 ? String(p.example) : void 0,
2640
+ default: schema?.default !== null && schema?.default !== void 0 ? String(schema.default) : void 0
2641
+ };
2642
+ });
2643
+ const requestBodyContentTypes = operation.requestBody?.content ? Object.keys(operation.requestBody.content) : void 0;
2644
+ const defaultContentType = requestBodyContentTypes?.[0];
2645
+ const defaultBodySchema = defaultContentType ? operation.requestBody?.content[defaultContentType]?.schema : void 0;
2646
+ const defaultBodyExample = defaultBodySchema ? JSON.stringify(Collapsible.generateExample(defaultBodySchema), null, 2) : void 0;
2647
+ const tryItPanelProps = {
2648
+ method: operation.method,
2649
+ path: operation.path,
2650
+ serverUrl,
2651
+ parameters: tryItParams,
2652
+ requestBodyContentTypes,
2653
+ defaultRequestBody: defaultBodyExample,
2654
+ requestBodySchema: defaultBodySchema,
2655
+ xCodeSamples: operation.xCodeSamples
2656
+ };
2657
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: containerStyle, children: [
2658
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", onClick: onBack, className: backBtnStyle, children: [
2659
+ "\u2190 ",
2660
+ tagName ?? "All Operations"
2661
+ ] }),
2662
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: titleStyle, children: title }),
2663
+ /* @__PURE__ */ jsxRuntime.jsx(
2664
+ Collapsible.MethodBar,
2665
+ {
2666
+ label: operation.method,
2667
+ path: operation.path,
2668
+ method: operation.method
2669
+ }
2670
+ ),
2671
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: contentStyle, children: displayMode === "reference" ? /* @__PURE__ */ jsxRuntime.jsx(
2672
+ OpenIdConnectManual.ReferenceLayout,
2673
+ {
2674
+ operationId: operation.operationId ?? `${operation.method}-${operation.path}`,
2675
+ schema: /* @__PURE__ */ jsxRuntime.jsx(
2676
+ OpenIdConnectManual.ReferenceOperationDetail,
2677
+ {
2678
+ operationId: operation.operationId ?? `${operation.method}-${operation.path}`,
2679
+ description: operation.description,
2680
+ parameters: operation.parameters,
2681
+ requestBody: operation.requestBody,
2682
+ responses: operation.responses,
2683
+ security: operation.security
2684
+ }
2685
+ ),
2686
+ samples: /* @__PURE__ */ jsxRuntime.jsx(
2687
+ OpenIdConnectManual.SamplesPanel,
2688
+ {
2689
+ method: operation.method,
2690
+ path: operation.path,
2691
+ serverUrl,
2692
+ operationId: operation.operationId ?? `${operation.method}-${operation.path}`,
2693
+ requestBodySchema: defaultBodySchema,
2694
+ requestBodyContentType: defaultContentType,
2695
+ responses: operation.responses
2696
+ }
2697
+ ),
2698
+ tryIt: allowTryIt ? /* @__PURE__ */ jsxRuntime.jsx(TryItPanel, { ...tryItPanelProps }) : /* @__PURE__ */ jsxRuntime.jsx("div", {})
2699
+ }
2700
+ ) : tryItLayout === "inline" ? (
2701
+ // Inline (compact only): operation detail full-width, Try-It console in
2702
+ // a collapsed-by-default disclosure below it.
2703
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2704
+ /* @__PURE__ */ jsxRuntime.jsx(OperationDetail, { operation }),
2705
+ allowTryIt && /* @__PURE__ */ jsxRuntime.jsx(InlineTryIt, { ...tryItPanelProps })
2706
+ ] })
2707
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
2708
+ OpenIdConnectManual.ResponsiveColumns,
2709
+ {
2710
+ left: /* @__PURE__ */ jsxRuntime.jsx(OperationDetail, { operation }),
2711
+ right: allowTryIt ? /* @__PURE__ */ jsxRuntime.jsx(TryItPanel, { ...tryItPanelProps }) : void 0,
2712
+ rightLabel: "Try It"
2713
+ }
2714
+ ) })
2715
+ ] });
2716
+ }
2717
+ const containerStyle = css.css({
2718
+ padding: 0
2719
+ });
2720
+ const backBtnStyle = css.css({
2721
+ display: "inline-flex",
2722
+ alignItems: "center",
2723
+ gap: "0.25rem",
2724
+ background: "none",
2725
+ border: "none",
2726
+ cursor: "pointer",
2727
+ fontSize: "var(--omnispec-font-size-sm)",
2728
+ color: "var(--omnispec-fg-link)",
2729
+ padding: "0 0 0.75rem",
2730
+ fontWeight: 500,
2731
+ "&:hover": {
2732
+ textDecoration: "underline"
2733
+ }
2734
+ });
2735
+ const titleStyle = css.css({
2736
+ fontSize: "var(--omnispec-h2-font-size)",
2737
+ fontWeight: "var(--omnispec-h2-font-weight)",
2738
+ color: "var(--omnispec-h2-color)",
2739
+ margin: "0 0 0.75rem"
2740
+ });
2741
+ const contentStyle = css.css({
2742
+ marginTop: "1rem"
2743
+ });
2744
+
2745
+ function SegmentedContent({
2746
+ route,
2747
+ parsedSpec,
2748
+ serverUrl,
2749
+ onBack,
2750
+ overviewContent
2751
+ }) {
2752
+ if (route.view === "overview" || !route.operationId) {
2753
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: overviewContent });
2754
+ }
2755
+ for (const tag of parsedSpec.tags) {
2756
+ for (const op of tag.operations) {
2757
+ const opId = op.operationId ?? `${op.method}-${op.path}`;
2758
+ if (opId === route.operationId) {
2759
+ return /* @__PURE__ */ jsxRuntime.jsx(
2760
+ OperationView,
2761
+ {
2762
+ operation: op,
2763
+ serverUrl,
2764
+ onBack,
2765
+ tagName: tag.displayName ?? tag.name
2766
+ }
2767
+ );
2768
+ }
2769
+ }
2770
+ }
2771
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: overviewContent });
2772
+ }
2773
+
2774
+ function operationMatchesSearch(op, lowercasedQuery) {
2775
+ return op.path.toLowerCase().includes(lowercasedQuery) || (op.summary?.toLowerCase().includes(lowercasedQuery) ?? false) || (op.description?.toLowerCase().includes(lowercasedQuery) ?? false) || (op.operationId?.toLowerCase().includes(lowercasedQuery) ?? false) || op.method.toLowerCase().includes(lowercasedQuery);
2776
+ }
2777
+
2778
+ const OVERVIEW_NAV_ID = "__apidoc_overview__";
2779
+ let warnedTryItLayoutIgnored = false;
2780
+ function OpenApiSpec({
2781
+ spec,
2782
+ theme,
2783
+ proxyUrl,
2784
+ proxyHeaders,
2785
+ oauth,
2786
+ interactiveOAuth = true,
2787
+ allowTryIt = true,
2788
+ downloadLink,
2789
+ layout = "sidebar",
2790
+ sidebarPosition = "left",
2791
+ // Default `panel` (docked side column). Non-breaking: the prop was dead until
2792
+ // inline was implemented, so `panel` matches every consumer's current Try-It.
2793
+ tryItLayout = "panel",
2794
+ defaultExpandOperations = false,
2795
+ displayMode,
2796
+ schemaStyle,
2797
+ externalRefOrigins,
2798
+ serverUrl: serverUrlOverride,
2799
+ servers: serversOverride,
2800
+ tryItPersistTtl,
2801
+ navigationMode,
2802
+ pro,
2803
+ sidebarNav,
2804
+ slots = {},
2805
+ onSpecLoaded,
2806
+ onTryItRequest: _onTryItRequest,
2807
+ onTryItResponse: _onTryItResponse,
2808
+ className
2809
+ }) {
2810
+ const refOptions = React.useMemo(() => ({
2811
+ specUrl: typeof spec === "string" ? spec : void 0,
2812
+ externalRefOrigins
2813
+ }), [spec, externalRefOrigins]);
2814
+ const { data: parsedSpec, state } = useOpenApiSpec(spec, refOptions);
2815
+ const [selectedServer, setSelectedServer] = React.useState("");
2816
+ const [searchQuery, setSearchQuery] = React.useState("");
2817
+ const [allExpanded, setAllExpanded] = React.useState(defaultExpandOperations);
2818
+ const [expandGeneration, setExpandGeneration] = React.useState(0);
2819
+ const handleToggleExpand = React.useCallback(() => {
2820
+ setAllExpanded((prev) => !prev);
2821
+ setExpandGeneration((prev) => prev + 1);
2822
+ }, []);
2823
+ React.useMemo(() => {
2824
+ if (parsedSpec && onSpecLoaded) {
2825
+ onSpecLoaded({
2826
+ title: parsedSpec.title,
2827
+ version: parsedSpec.version,
2828
+ type: parsedSpec.specVersion.startsWith("2") ? useSpecFetcher.SpecType.OPENAPI_2 : useSpecFetcher.SpecType.OPENAPI_3
2829
+ });
2830
+ }
2831
+ }, [parsedSpec, onSpecLoaded]);
2832
+ const specOrigin = React.useMemo(() => {
2833
+ if (typeof spec !== "string") return "";
2834
+ try {
2835
+ const parsed = new URL(spec, window.location.origin);
2836
+ return parsed.origin;
2837
+ } catch {
2838
+ return "";
2839
+ }
2840
+ }, [spec]);
2841
+ const resolveServerUrl = React.useCallback((url) => {
2842
+ if (url.startsWith("/") && specOrigin) {
2843
+ return specOrigin + url;
2844
+ }
2845
+ return url;
2846
+ }, [specOrigin]);
2847
+ const effectiveServers = React.useMemo(() => {
2848
+ if (serverUrlOverride) return [{ url: serverUrlOverride }];
2849
+ if (serversOverride?.length) {
2850
+ return serversOverride.map((s) => ({ url: s.url, description: s.description }));
2851
+ }
2852
+ return parsedSpec?.servers ?? [];
2853
+ }, [serverUrlOverride, serversOverride, parsedSpec]);
2854
+ const serverUrl = React.useMemo(() => {
2855
+ if (serverUrlOverride) return resolveServerUrl(serverUrlOverride);
2856
+ if (selectedServer) return resolveServerUrl(selectedServer);
2857
+ const first = effectiveServers[0];
2858
+ if (!first) return specOrigin || (typeof window !== "undefined" ? window.location.origin : "");
2859
+ let url = first.url;
2860
+ if (first.variables) {
2861
+ for (const [key, variable] of Object.entries(first.variables)) {
2862
+ if (variable.default) {
2863
+ url = url.replace(`{${key}}`, variable.default);
2864
+ }
2865
+ }
2866
+ }
2867
+ return resolveServerUrl(url);
2868
+ }, [serverUrlOverride, selectedServer, effectiveServers, specOrigin, resolveServerUrl]);
2869
+ const navItems = React.useMemo(() => {
2870
+ if (!parsedSpec) return [];
2871
+ const tagItemMap = /* @__PURE__ */ new Map();
2872
+ for (const tag of parsedSpec.tags) {
2873
+ tagItemMap.set(tag.name, {
2874
+ id: `tag-${tag.name}`,
2875
+ label: tag.displayName ?? tag.name,
2876
+ children: tag.operations.map((op) => ({
2877
+ id: op.operationId ?? `${op.method}-${op.path}`,
2878
+ label: op.summary ?? `${op.method.toUpperCase()} ${op.path}`,
2879
+ badge: op.method.toUpperCase(),
2880
+ badgeColor: `var(--omnispec-color-${op.method})`
2881
+ }))
2882
+ });
2883
+ }
2884
+ let items;
2885
+ if (parsedSpec.tagGroups?.length) {
2886
+ items = parsedSpec.tagGroups.map((group) => ({
2887
+ id: `group-${group.name}`,
2888
+ label: group.name,
2889
+ children: group.tags.map((tagName) => tagItemMap.get(tagName)).filter(Boolean)
2890
+ }));
2891
+ } else {
2892
+ items = Array.from(tagItemMap.values());
2893
+ }
2894
+ if (parsedSpec.webhooks?.length) {
2895
+ items.push({
2896
+ id: "tag-Webhooks",
2897
+ label: "Webhooks",
2898
+ children: parsedSpec.webhooks.map((op) => ({
2899
+ id: op.operationId ?? `${op.method}-${op.path}`,
2900
+ label: op.summary ?? `${op.method.toUpperCase()} ${op.path}`,
2901
+ badge: op.method.toUpperCase(),
2902
+ badgeColor: `var(--omnispec-color-${op.method})`
2903
+ }))
2904
+ });
2905
+ }
2906
+ if (parsedSpec.components && Object.keys(parsedSpec.components.schemas).length > 0) {
2907
+ items.push({
2908
+ id: "schemas",
2909
+ label: "Schemas",
2910
+ children: Object.keys(parsedSpec.components.schemas).map((name) => ({
2911
+ id: `schema-${name}`,
2912
+ label: name
2913
+ }))
2914
+ });
2915
+ }
2916
+ return items;
2917
+ }, [parsedSpec]);
2918
+ const filteredTags = React.useMemo(() => {
2919
+ if (!parsedSpec || !searchQuery.trim()) return parsedSpec?.tags ?? [];
2920
+ const q = searchQuery.toLowerCase();
2921
+ return parsedSpec.tags.map((tag) => ({
2922
+ ...tag,
2923
+ operations: tag.operations.filter((op) => operationMatchesSearch(op, q))
2924
+ })).filter((tag) => tag.operations.length > 0);
2925
+ }, [parsedSpec, searchQuery]);
2926
+ const webhooksTag = React.useMemo(() => {
2927
+ if (!parsedSpec?.webhooks?.length) return null;
2928
+ const q = searchQuery.trim().toLowerCase();
2929
+ const operations = q ? parsedSpec.webhooks.filter((op) => operationMatchesSearch(op, q)) : parsedSpec.webhooks;
2930
+ if (operations.length === 0) return null;
2931
+ return {
2932
+ name: "Webhooks",
2933
+ description: "Webhooks the API sends to registered subscribers.",
2934
+ operations
2935
+ };
2936
+ }, [parsedSpec, searchQuery]);
2937
+ const operationCount = React.useMemo(
2938
+ () => parsedSpec?.tags.reduce((sum, tag) => sum + tag.operations.length, 0) ?? 0,
2939
+ [parsedSpec]
2940
+ );
2941
+ const SEGMENTED_THRESHOLD = 50;
2942
+ const resolvedMode = React.useMemo(() => {
2943
+ if (navigationMode) return navigationMode;
2944
+ return operationCount > SEGMENTED_THRESHOLD ? "segmented" : "grouped";
2945
+ }, [navigationMode, operationCount]);
2946
+ const isSegmented = resolvedMode === "segmented";
2947
+ const resolvedDisplayMode = displayMode ?? "compact";
2948
+ const resolvedSchemaStyle = useSpecFetcher.resolveSchemaStyle(schemaStyle, pro?.advancedSchemaStyles ?? false);
2949
+ React.useEffect(() => {
2950
+ if (process.env.NODE_ENV !== "production" && resolvedDisplayMode === "reference" && tryItLayout === "inline" && !warnedTryItLayoutIgnored) {
2951
+ warnedTryItLayoutIgnored = true;
2952
+ console.warn(
2953
+ "[omnispec] `tryItLayout: 'inline'` is ignored in reference display mode \u2014 reference mode renders Try-It as its own right-column tab."
2954
+ );
2955
+ }
2956
+ }, [resolvedDisplayMode, tryItLayout]);
2957
+ const { route, navigateToOperation, navigateToOverview } = useSegmentedRouter();
2958
+ const { navigateTo } = Collapsible.useHashScroll(operationCount);
2959
+ const handleNavSelect = navigateTo;
2960
+ const handleSegmentedSelect = React.useCallback(
2961
+ (id) => {
2962
+ if (id === OVERVIEW_NAV_ID) {
2963
+ navigateToOverview();
2964
+ } else {
2965
+ navigateToOperation(id);
2966
+ }
2967
+ },
2968
+ [navigateToOverview, navigateToOperation]
2969
+ );
2970
+ const segmentedNavItems = React.useMemo(() => {
2971
+ if (!isSegmented) return navItems;
2972
+ return [
2973
+ { id: OVERVIEW_NAV_ID, label: "Overview", icon: /* @__PURE__ */ jsxRuntime.jsx(useSpecFetcher.Icon, { name: "home", size: "1rem" }) },
2974
+ ...navItems
2975
+ ];
2976
+ }, [isSegmented, navItems]);
2977
+ const navSectionIds = React.useMemo(() => Collapsible.flattenNavItemIds(navItems), [navItems]);
2978
+ const activeSection = Collapsible.useScrollSpy(navSectionIds);
2979
+ if (state.status === "loading") {
2980
+ return /* @__PURE__ */ jsxRuntime.jsx(useSpecFetcher.ThemeProvider, { theme, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: css.cx("omnispec-openapi", className), children: /* @__PURE__ */ jsxRuntime.jsx(useSpecFetcher.LoadingScreen, {}) }) });
2981
+ }
2982
+ if (state.status === "error") {
2983
+ return /* @__PURE__ */ jsxRuntime.jsx(
2984
+ useSpecFetcher.SpecStatusScreen,
2985
+ {
2986
+ theme,
2987
+ layout,
2988
+ sidebarPosition,
2989
+ slots,
2990
+ sidebarNav,
2991
+ premiumThemingEnabled: pro?.premiumThemingEnabled ?? false,
2992
+ className: css.cx("omnispec-openapi", className),
2993
+ children: /* @__PURE__ */ jsxRuntime.jsx(useSpecFetcher.ErrorMessage, { title: "Failed to load specification", message: state.error })
2994
+ }
2995
+ );
2996
+ }
2997
+ if (!parsedSpec) return null;
2998
+ const specNav = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2999
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: headingStyle, children: "Operations" }),
3000
+ /* @__PURE__ */ jsxRuntime.jsx(
3001
+ Collapsible.SearchBar,
3002
+ {
3003
+ placeholder: "Filter endpoints...",
3004
+ onSearch: setSearchQuery
3005
+ }
3006
+ ),
3007
+ /* @__PURE__ */ jsxRuntime.jsx(
3008
+ useSpecFetcher.NavTree,
3009
+ {
3010
+ items: segmentedNavItems,
3011
+ activeId: isSegmented ? route.operationId ?? OVERVIEW_NAV_ID : activeSection,
3012
+ onSelect: isSegmented ? handleSegmentedSelect : handleNavSelect,
3013
+ parentToggleOnly: isSegmented
3014
+ }
3015
+ )
3016
+ ] });
3017
+ const sidebar = useSpecFetcher.buildSidebar(sidebarNav, specNav);
3018
+ const resolvedDownloadLink = Collapsible.resolveDownloadLink(downloadLink, spec);
3019
+ return /* @__PURE__ */ jsxRuntime.jsx(useSpecFetcher.ConfigProvider, { config: { proxyUrl, proxyHeaders, oauth, allowTryIt, layout, sidebarPosition, tryItLayout, defaultExpandOperations, displayMode: resolvedDisplayMode, schemaStyle: resolvedSchemaStyle, slots, proRenderers: pro?.renderers ?? /* @__PURE__ */ new Map(), premiumThemingEnabled: pro?.premiumThemingEnabled ?? false, interactiveAuth: pro?.interactiveAuth, interactiveOAuth, specKey: `${parsedSpec.title}@${parsedSpec.version}`, tryItPersistTtl }, children: /* @__PURE__ */ jsxRuntime.jsx(Collapsible.ExpandProvider, { expandAll: allExpanded, expandGeneration, children: /* @__PURE__ */ jsxRuntime.jsx(useSpecFetcher.ThemeProvider, { theme, children: /* @__PURE__ */ jsxRuntime.jsx(OpenIdConnectManual.AuthProvider, { schemes: parsedSpec.securitySchemes, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `omnispec-openapi ${className ?? ""}`, children: [
3020
+ /* @__PURE__ */ jsxRuntime.jsx(AuthPanelModal, { serverUrl }),
3021
+ /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary.ErrorBoundary, { title: "Failed to render this API reference", children: /* @__PURE__ */ jsxRuntime.jsx(
3022
+ useSpecFetcher.DocLayout,
3023
+ {
3024
+ layout,
3025
+ sidebarPosition,
3026
+ sidebar,
3027
+ sidebarHeader: slots.sidebarHeader ?? (parsedSpec.logo ? /* @__PURE__ */ jsxRuntime.jsx("a", { href: parsedSpec.logo.href ?? "#", className: logoLinkStyle, children: /* @__PURE__ */ jsxRuntime.jsx(
3028
+ "img",
3029
+ {
3030
+ src: parsedSpec.logo.url,
3031
+ alt: parsedSpec.logo.altText ?? "Logo",
3032
+ className: logoImgStyle,
3033
+ style: parsedSpec.logo.backgroundColor ? { backgroundColor: parsedSpec.logo.backgroundColor } : void 0
3034
+ }
3035
+ ) }) : void 0),
3036
+ sidebarFooter: slots.sidebarFooter,
3037
+ header: slots.header,
3038
+ contentHeader: slots.contentHeader,
3039
+ footer: slots.footer,
3040
+ children: isSegmented ? /* @__PURE__ */ jsxRuntime.jsx(
3041
+ SegmentedContent,
3042
+ {
3043
+ route,
3044
+ parsedSpec,
3045
+ serverUrl,
3046
+ onBack: navigateToOverview,
3047
+ overviewContent: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3048
+ /* @__PURE__ */ jsxRuntime.jsx(
3049
+ Collapsible.SpecToolbar,
3050
+ {
3051
+ overview: /* @__PURE__ */ jsxRuntime.jsx(ApiOverview, { spec: parsedSpec }),
3052
+ versionBadge: /* @__PURE__ */ jsxRuntime.jsx(ApiVersionBadge, { version: parsedSpec.version }),
3053
+ expandLabel: "schemas",
3054
+ allExpanded,
3055
+ onToggleExpand: handleToggleExpand,
3056
+ downloadLink: resolvedDownloadLink
3057
+ }
3058
+ ),
3059
+ /* @__PURE__ */ jsxRuntime.jsx(
3060
+ ServerSelector,
3061
+ {
3062
+ servers: effectiveServers,
3063
+ selectedUrl: serverUrl,
3064
+ onSelect: setSelectedServer
3065
+ }
3066
+ ),
3067
+ /* @__PURE__ */ jsxRuntime.jsx(
3068
+ ComponentsSection,
3069
+ {
3070
+ components: parsedSpec.components,
3071
+ expandAll: allExpanded,
3072
+ expandGeneration
3073
+ }
3074
+ )
3075
+ ] })
3076
+ }
3077
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3078
+ /* @__PURE__ */ jsxRuntime.jsx(
3079
+ Collapsible.SpecToolbar,
3080
+ {
3081
+ overview: /* @__PURE__ */ jsxRuntime.jsx(ApiOverview, { spec: parsedSpec }),
3082
+ versionBadge: /* @__PURE__ */ jsxRuntime.jsx(ApiVersionBadge, { version: parsedSpec.version }),
3083
+ expandLabel: "operations",
3084
+ allExpanded,
3085
+ onToggleExpand: handleToggleExpand,
3086
+ downloadLink: resolvedDownloadLink
3087
+ }
3088
+ ),
3089
+ /* @__PURE__ */ jsxRuntime.jsx(
3090
+ ServerSelector,
3091
+ {
3092
+ servers: effectiveServers,
3093
+ selectedUrl: serverUrl,
3094
+ onSelect: setSelectedServer
3095
+ }
3096
+ ),
3097
+ filteredTags.map((tag) => /* @__PURE__ */ jsxRuntime.jsx(
3098
+ TagGroup,
3099
+ {
3100
+ tag,
3101
+ serverUrl,
3102
+ expandAll: allExpanded,
3103
+ expandGeneration
3104
+ },
3105
+ tag.name
3106
+ )),
3107
+ webhooksTag && /* @__PURE__ */ jsxRuntime.jsx(
3108
+ TagGroup,
3109
+ {
3110
+ tag: webhooksTag,
3111
+ serverUrl,
3112
+ expandAll: allExpanded,
3113
+ expandGeneration
3114
+ },
3115
+ "__webhooks__"
3116
+ ),
3117
+ /* @__PURE__ */ jsxRuntime.jsx(
3118
+ ComponentsSection,
3119
+ {
3120
+ components: parsedSpec.components,
3121
+ expandAll: allExpanded,
3122
+ expandGeneration
3123
+ }
3124
+ )
3125
+ ] })
3126
+ }
3127
+ ) })
3128
+ ] }) }) }) }) });
3129
+ }
3130
+ const headingStyle = css.css({
3131
+ fontSize: "var(--omnispec-font-size-xs)",
3132
+ fontWeight: 700,
3133
+ textTransform: "uppercase",
3134
+ letterSpacing: "0.08em",
3135
+ color: "var(--omnispec-nav-heading-color)",
3136
+ padding: "1rem 0.75rem 0.25rem"
3137
+ });
3138
+ const logoLinkStyle = css.css({
3139
+ display: "block",
3140
+ padding: "0.75rem",
3141
+ textDecoration: "none"
3142
+ });
3143
+ const logoImgStyle = css.css({
3144
+ maxWidth: "100%",
3145
+ maxHeight: "4rem",
3146
+ objectFit: "contain"
3147
+ });
3148
+
3149
+ var OpenApiSpec$1 = /*#__PURE__*/Object.freeze({
3150
+ __proto__: null,
3151
+ OpenApiSpec: OpenApiSpec
3152
+ });
3153
+
3154
+ exports.OpenApiSpec = OpenApiSpec;
3155
+ exports.OpenApiSpec$1 = OpenApiSpec$1;
3156
+ exports.authSchemeLabel = authSchemeLabel;
3157
+ //# sourceMappingURL=OpenApiSpec-D0JtmOVQ.js.map