zudoku 0.1.1-dev.9 → 0.3.0-dev.10

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 (610) hide show
  1. package/dist/app/App.js +16 -6
  2. package/dist/app/App.js.map +1 -1
  3. package/dist/app/main.js +10 -2
  4. package/dist/app/main.js.map +1 -1
  5. package/dist/cli/build/handler.js +3 -1
  6. package/dist/cli/build/handler.js.map +1 -1
  7. package/dist/cli/common/analytics/lib.js +1 -1
  8. package/dist/cli/common/analytics/lib.js.map +1 -1
  9. package/dist/cli/common/logger.js +3 -1
  10. package/dist/cli/common/logger.js.map +1 -1
  11. package/dist/cli/common/outdated.js +4 -4
  12. package/dist/cli/common/outdated.js.map +1 -1
  13. package/dist/cli/common/output.js +4 -4
  14. package/dist/cli/common/output.js.map +1 -1
  15. package/dist/cli/common/utils/box.js +2 -2
  16. package/dist/cli/common/utils/box.js.map +1 -1
  17. package/dist/cli/dev/handler.js +4 -2
  18. package/dist/cli/dev/handler.js.map +1 -1
  19. package/dist/config/config.d.ts +30 -6
  20. package/dist/config/validators/auth.d.ts +2 -0
  21. package/dist/config/validators/auth.js +2 -0
  22. package/dist/config/validators/auth.js.map +1 -0
  23. package/dist/config/validators/validate.d.ts +2 -0
  24. package/dist/config/validators/validate.js +4 -0
  25. package/dist/config/validators/validate.js.map +1 -0
  26. package/dist/index.d.ts +2 -6
  27. package/dist/index.js +1 -5
  28. package/dist/index.js.map +1 -1
  29. package/dist/lib/authentication/Callback.d.ts +3 -0
  30. package/dist/lib/authentication/Callback.js +34 -0
  31. package/dist/lib/authentication/Callback.js.map +1 -0
  32. package/dist/lib/authentication/authentication.d.ts +14 -0
  33. package/dist/lib/authentication/authentication.js.map +1 -0
  34. package/dist/lib/authentication/errors.d.ts +15 -0
  35. package/dist/lib/authentication/errors.js +10 -0
  36. package/dist/lib/authentication/errors.js.map +1 -0
  37. package/dist/lib/authentication/hook.d.ts +8 -0
  38. package/dist/lib/authentication/hook.js +30 -0
  39. package/dist/lib/authentication/hook.js.map +1 -0
  40. package/dist/lib/authentication/providers/auth0.d.ts +4 -0
  41. package/dist/lib/authentication/providers/auth0.js +41 -0
  42. package/dist/lib/authentication/providers/auth0.js.map +1 -0
  43. package/dist/lib/authentication/providers/clerk.d.ts +4 -0
  44. package/dist/lib/authentication/providers/clerk.js +56 -0
  45. package/dist/lib/authentication/providers/clerk.js.map +1 -0
  46. package/dist/lib/authentication/providers/openid.d.ts +35 -0
  47. package/dist/lib/authentication/providers/openid.js +206 -0
  48. package/dist/lib/authentication/providers/openid.js.map +1 -0
  49. package/dist/lib/authentication/state.d.ts +14 -0
  50. package/dist/lib/authentication/state.js +6 -0
  51. package/dist/lib/authentication/state.js.map +1 -0
  52. package/dist/{app → lib}/components/AnchorLink.js.map +1 -1
  53. package/dist/{app → lib}/components/CategoryHeading.js.map +1 -1
  54. package/dist/lib/components/DevPortal.d.ts +25 -0
  55. package/dist/lib/components/DevPortal.js +31 -0
  56. package/dist/lib/components/DevPortal.js.map +1 -0
  57. package/dist/{app → lib}/components/Dialog.d.ts +2 -2
  58. package/dist/{app → lib}/components/Dialog.js +3 -3
  59. package/dist/lib/components/Dialog.js.map +1 -0
  60. package/dist/lib/components/Header.d.ts +1 -0
  61. package/dist/lib/components/Header.js +15 -0
  62. package/dist/lib/components/Header.js.map +1 -0
  63. package/dist/{app → lib/components}/Heading.js +2 -2
  64. package/dist/lib/components/Heading.js.map +1 -0
  65. package/dist/{app → lib}/components/Input.js.map +1 -1
  66. package/dist/{app → lib}/components/Layout.js +4 -7
  67. package/dist/lib/components/Layout.js.map +1 -0
  68. package/dist/lib/components/Link.d.ts +1 -0
  69. package/dist/lib/components/Link.js +2 -0
  70. package/dist/lib/components/Link.js.map +1 -0
  71. package/dist/{app → lib}/components/Markdown.js.map +1 -1
  72. package/dist/lib/components/Router.d.ts +4 -0
  73. package/dist/lib/components/Router.js +20 -0
  74. package/dist/lib/components/Router.js.map +1 -0
  75. package/dist/lib/components/Select.d.ts +13 -0
  76. package/dist/lib/components/Select.js +27 -0
  77. package/dist/lib/components/Select.js.map +1 -0
  78. package/dist/lib/components/Spinner.d.ts +3 -0
  79. package/dist/lib/components/Spinner.js +4 -0
  80. package/dist/lib/components/Spinner.js.map +1 -0
  81. package/dist/{app → lib}/components/SyntaxHighlight.d.ts +2 -1
  82. package/dist/{app → lib}/components/SyntaxHighlight.js +9 -2
  83. package/dist/lib/components/SyntaxHighlight.js.map +1 -0
  84. package/dist/{app → lib}/components/TopNavigation.js.map +1 -1
  85. package/dist/{app → lib}/components/context/ComponentsContext.d.ts +1 -1
  86. package/dist/{app → lib}/components/context/ComponentsContext.js.map +1 -1
  87. package/dist/{app → lib}/components/context/DevPortalProvider.js +1 -1
  88. package/dist/lib/components/context/DevPortalProvider.js.map +1 -0
  89. package/dist/lib/components/context/PluginSystem.js.map +1 -0
  90. package/dist/{app → lib}/components/context/ThemeContext.js +1 -1
  91. package/dist/{app → lib}/components/context/ThemeContext.js.map +1 -1
  92. package/dist/{app → lib}/components/context/ViewportAnchorContext.js.map +1 -1
  93. package/dist/lib/components/index.d.ts +3 -0
  94. package/dist/lib/components/index.js +4 -0
  95. package/dist/lib/components/index.js.map +1 -0
  96. package/dist/{app → lib}/components/navigation/SideNavigation.js +1 -1
  97. package/dist/{app → lib}/components/navigation/SideNavigation.js.map +1 -1
  98. package/dist/{app → lib}/components/navigation/SideNavigationCategory.js +1 -1
  99. package/dist/{app → lib}/components/navigation/SideNavigationCategory.js.map +1 -1
  100. package/dist/{app → lib}/components/navigation/SideNavigationItem.d.ts +2 -1
  101. package/dist/{app → lib}/components/navigation/SideNavigationItem.js +12 -6
  102. package/dist/lib/components/navigation/SideNavigationItem.js.map +1 -0
  103. package/dist/{app → lib}/components/navigation/SideNavigationWrapper.d.ts +3 -0
  104. package/dist/lib/components/navigation/SideNavigationWrapper.js +7 -0
  105. package/dist/lib/components/navigation/SideNavigationWrapper.js.map +1 -0
  106. package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.js.map +1 -1
  107. package/dist/{app → lib}/components/navigation/util.js.map +1 -1
  108. package/dist/{app → lib}/core/DevPortalContext.d.ts +10 -32
  109. package/dist/lib/core/DevPortalContext.js +50 -0
  110. package/dist/lib/core/DevPortalContext.js.map +1 -0
  111. package/dist/{app → lib}/core/helmet.js.map +1 -1
  112. package/dist/lib/core/icons.js.map +1 -0
  113. package/dist/{app → lib}/core/plugins.d.ts +2 -7
  114. package/dist/{app → lib}/core/plugins.js +1 -1
  115. package/dist/{app → lib}/core/plugins.js.map +1 -1
  116. package/dist/lib/core/router.js.map +1 -0
  117. package/dist/{app → lib}/oas/graphql/index.js +2 -2
  118. package/dist/lib/oas/graphql/index.js.map +1 -0
  119. package/dist/{app → lib}/oas/parser/dereference/index.js.map +1 -1
  120. package/dist/{app → lib}/oas/parser/dereference/resolveRef.js.map +1 -1
  121. package/dist/{app → lib}/oas/parser/index.js.map +1 -1
  122. package/dist/{app → lib}/oas/parser/upgrade/index.js.map +1 -1
  123. package/dist/lib/plugins/api-key/CreateApiKey.d.ts +4 -0
  124. package/dist/lib/plugins/api-key/CreateApiKey.js +37 -0
  125. package/dist/lib/plugins/api-key/CreateApiKey.js.map +1 -0
  126. package/dist/lib/plugins/api-key/SettingsApiKeys.d.ts +4 -0
  127. package/dist/lib/plugins/api-key/SettingsApiKeys.js +38 -0
  128. package/dist/lib/plugins/api-key/SettingsApiKeys.js.map +1 -0
  129. package/dist/lib/plugins/api-key/index.d.ts +30 -0
  130. package/dist/lib/plugins/api-key/index.js +94 -0
  131. package/dist/lib/plugins/api-key/index.js.map +1 -0
  132. package/dist/lib/plugins/index.d.ts +4 -0
  133. package/dist/lib/plugins/index.js +5 -0
  134. package/dist/lib/plugins/index.js.map +1 -0
  135. package/dist/lib/plugins/markdown/MdxPage.d.ts +5 -0
  136. package/dist/lib/plugins/markdown/MdxPage.js +60 -0
  137. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -0
  138. package/dist/{app → lib}/plugins/markdown/Toc.js.map +1 -1
  139. package/dist/{app → lib}/plugins/markdown/generateRoutes.js +1 -6
  140. package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -0
  141. package/dist/{app → lib}/plugins/markdown/index.js.map +1 -1
  142. package/dist/{app → lib}/plugins/openapi/ColorizedParam.d.ts +1 -2
  143. package/dist/{app → lib}/plugins/openapi/ColorizedParam.js +2 -2
  144. package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -0
  145. package/dist/lib/plugins/openapi/MakeRequest.js +43 -0
  146. package/dist/lib/plugins/openapi/MakeRequest.js.map +1 -0
  147. package/dist/{app → lib}/plugins/openapi/MethodBadge.js.map +1 -1
  148. package/dist/{app → lib}/plugins/openapi/OperationList.js +12 -3
  149. package/dist/lib/plugins/openapi/OperationList.js.map +1 -0
  150. package/dist/lib/plugins/openapi/OperationListItem.js +17 -0
  151. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -0
  152. package/dist/{app → lib}/plugins/openapi/ParameterList.d.ts +2 -2
  153. package/dist/lib/plugins/openapi/ParameterList.js +5 -0
  154. package/dist/lib/plugins/openapi/ParameterList.js.map +1 -0
  155. package/dist/lib/plugins/openapi/ParameterListItem.js +13 -0
  156. package/dist/{app → lib}/plugins/openapi/ParameterListItem.js.map +1 -1
  157. package/dist/{app → lib}/plugins/openapi/RequestBodySidecarBox.js +3 -3
  158. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -0
  159. package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.js +3 -3
  160. package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
  161. package/dist/lib/plugins/openapi/SchemaListView.d.ts +7 -0
  162. package/dist/lib/plugins/openapi/SchemaListView.js +43 -0
  163. package/dist/lib/plugins/openapi/SchemaListView.js.map +1 -0
  164. package/dist/{app → lib}/plugins/openapi/Sidecar.js +21 -19
  165. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -0
  166. package/dist/{app → lib}/plugins/openapi/SidecarBox.js.map +1 -1
  167. package/dist/{app/plugins/openapi/Select.d.ts → lib/plugins/openapi/SimpleSelect.d.ts} +3 -2
  168. package/dist/lib/plugins/openapi/SimpleSelect.js +5 -0
  169. package/dist/lib/plugins/openapi/SimpleSelect.js.map +1 -0
  170. package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.d.ts +1 -1
  171. package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.js.map +1 -1
  172. package/dist/{app → lib}/plugins/openapi/graphql/gql.d.ts +5 -5
  173. package/dist/{app → lib}/plugins/openapi/graphql/gql.js +2 -3
  174. package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -0
  175. package/dist/{app → lib}/plugins/openapi/graphql/graphql.d.ts +9 -0
  176. package/dist/{app → lib}/plugins/openapi/graphql/graphql.js +50 -0
  177. package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -0
  178. package/dist/lib/plugins/openapi/graphql/index.js.map +1 -0
  179. package/dist/{app → lib}/plugins/openapi/index.js +3 -1
  180. package/dist/lib/plugins/openapi/index.js.map +1 -0
  181. package/dist/lib/plugins/openapi/playground/Editor.d.ts +1 -0
  182. package/dist/lib/plugins/openapi/playground/Editor.js +5 -0
  183. package/dist/lib/plugins/openapi/playground/Editor.js.map +1 -0
  184. package/dist/lib/plugins/openapi/playground/Headers.d.ts +6 -0
  185. package/dist/lib/plugins/openapi/playground/Headers.js +25 -0
  186. package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -0
  187. package/dist/lib/plugins/openapi/playground/InlineInput.d.ts +4 -0
  188. package/dist/lib/plugins/openapi/playground/InlineInput.js +3 -0
  189. package/dist/lib/plugins/openapi/playground/InlineInput.js.map +1 -0
  190. package/dist/lib/plugins/openapi/playground/PathParams.d.ts +6 -0
  191. package/dist/lib/plugins/openapi/playground/PathParams.js +21 -0
  192. package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -0
  193. package/dist/lib/plugins/openapi/playground/Playground.d.ts +32 -0
  194. package/dist/lib/plugins/openapi/playground/Playground.js +97 -0
  195. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -0
  196. package/dist/lib/plugins/openapi/playground/QueryParams.d.ts +5 -0
  197. package/dist/lib/plugins/openapi/playground/QueryParams.js +22 -0
  198. package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -0
  199. package/dist/lib/plugins/openapi/playground/UrlDisplay.d.ts +4 -0
  200. package/dist/lib/plugins/openapi/playground/UrlDisplay.js +22 -0
  201. package/dist/lib/plugins/openapi/playground/UrlDisplay.js.map +1 -0
  202. package/dist/lib/plugins/openapi/playground/createUrl.d.ts +2 -0
  203. package/dist/lib/plugins/openapi/playground/createUrl.js +15 -0
  204. package/dist/lib/plugins/openapi/playground/createUrl.js.map +1 -0
  205. package/dist/{app → lib}/plugins/openapi/util/generateSchemaExample.d.ts +1 -1
  206. package/dist/{app → lib}/plugins/openapi/util/generateSchemaExample.js +17 -9
  207. package/dist/lib/plugins/openapi/util/generateSchemaExample.js.map +1 -0
  208. package/dist/{app → lib}/plugins/openapi/util/urql.js.map +1 -1
  209. package/dist/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.js +2 -1
  210. package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.js.map +1 -0
  211. package/dist/lib/plugins/openapi/worker/shared-worker.d.ts +1 -0
  212. package/dist/lib/plugins/openapi/worker/shared-worker.js +6 -0
  213. package/dist/lib/plugins/openapi/worker/shared-worker.js.map +1 -0
  214. package/dist/{app → lib}/plugins/openapi/worker/worker.js.map +1 -1
  215. package/dist/lib/plugins/openapi-worker.d.ts +1 -0
  216. package/dist/lib/plugins/openapi-worker.js +2 -0
  217. package/dist/lib/plugins/openapi-worker.js.map +1 -0
  218. package/dist/{app → lib}/plugins/redirect/index.d.ts +1 -2
  219. package/dist/{app → lib}/plugins/redirect/index.js.map +1 -1
  220. package/dist/lib/ui/Button.d.ts +7 -0
  221. package/dist/lib/ui/Button.js +11 -0
  222. package/dist/lib/ui/Button.js.map +1 -0
  223. package/dist/{app → lib}/ui/Callout.js.map +1 -1
  224. package/dist/{app → lib}/ui/Card.js.map +1 -1
  225. package/dist/{app → lib}/ui/Note.js.map +1 -1
  226. package/dist/{app → lib}/ui/Tabs.d.ts +2 -2
  227. package/dist/{app → lib}/ui/Tabs.js +2 -2
  228. package/dist/{app → lib}/ui/Tabs.js.map +1 -1
  229. package/dist/lib/ui/button-variants.d.ts +4 -0
  230. package/dist/{app/ui/Button.js → lib/ui/button-variants.js} +2 -12
  231. package/dist/lib/ui/button-variants.js.map +1 -0
  232. package/dist/{app → lib}/util/MdxComponents.js +9 -9
  233. package/dist/lib/util/MdxComponents.js.map +1 -0
  234. package/dist/{app → lib}/util/cn.js.map +1 -1
  235. package/dist/lib/util/createVariantComponent.d.ts +9 -0
  236. package/dist/lib/util/createVariantComponent.js +17 -0
  237. package/dist/lib/util/createVariantComponent.js.map +1 -0
  238. package/dist/{app → lib}/util/createWaitForNotify.js.map +1 -1
  239. package/dist/{app → lib}/util/groupBy.js.map +1 -1
  240. package/dist/{app → lib}/util/joinPath.js.map +1 -1
  241. package/dist/{app → lib}/util/pastellize.js.map +1 -1
  242. package/dist/lib/util/slugify.js.map +1 -0
  243. package/dist/{app → lib}/util/traverseNavigation.js.map +1 -1
  244. package/dist/{app → lib}/util/useScrollToAnchor.js.map +1 -1
  245. package/dist/{app → lib}/util/useScrollToTop.js.map +1 -1
  246. package/dist/ts.js +1 -2
  247. package/dist/ts.js.map +1 -1
  248. package/dist/vite/build.js +2 -8
  249. package/dist/vite/build.js.map +1 -1
  250. package/dist/vite/common.d.ts +1 -0
  251. package/dist/vite/common.js +5 -0
  252. package/dist/vite/common.js.map +1 -0
  253. package/dist/vite/config.d.ts +9 -2
  254. package/dist/vite/config.js +69 -28
  255. package/dist/vite/config.js.map +1 -1
  256. package/dist/vite/config.test.js +1 -1
  257. package/dist/vite/config.test.js.map +1 -1
  258. package/dist/vite/dev-server.d.ts +2 -0
  259. package/dist/vite/dev-server.js +30 -10
  260. package/dist/vite/dev-server.js.map +1 -1
  261. package/dist/vite/plugin-api-keys.d.ts +4 -0
  262. package/dist/vite/plugin-api-keys.js +33 -0
  263. package/dist/vite/plugin-api-keys.js.map +1 -0
  264. package/dist/vite/plugin-api.js +4 -2
  265. package/dist/vite/plugin-api.js.map +1 -1
  266. package/dist/vite/plugin-auth.js +3 -2
  267. package/dist/vite/plugin-auth.js.map +1 -1
  268. package/dist/vite/plugin-component.d.ts +4 -0
  269. package/dist/vite/plugin-component.js +16 -0
  270. package/dist/vite/plugin-component.js.map +1 -0
  271. package/dist/vite/plugin-config.d.ts +1 -0
  272. package/dist/vite/plugin-config.js +4 -3
  273. package/dist/vite/plugin-config.js.map +1 -1
  274. package/dist/vite/plugin-docs.js +4 -2
  275. package/dist/vite/plugin-docs.js.map +1 -1
  276. package/dist/vite/plugin-docs.test.js +1 -2
  277. package/dist/vite/plugin-docs.test.js.map +1 -1
  278. package/dist/vite/plugin-html.js +0 -3
  279. package/dist/vite/plugin-html.js.map +1 -1
  280. package/dist/vite/plugin-mdx.js +3 -1
  281. package/dist/vite/plugin-mdx.js.map +1 -1
  282. package/dist/vite/plugin-metadata.d.ts +6 -0
  283. package/dist/vite/plugin-metadata.js +24 -0
  284. package/dist/vite/plugin-metadata.js.map +1 -0
  285. package/dist/vite/plugin-openapi-worker.d.ts +4 -0
  286. package/dist/vite/plugin-openapi-worker.js +28 -0
  287. package/dist/vite/plugin-openapi-worker.js.map +1 -0
  288. package/dist/vite/plugin-redirect.d.ts +4 -0
  289. package/dist/vite/plugin-redirect.js +32 -0
  290. package/dist/vite/plugin-redirect.js.map +1 -0
  291. package/dist/vite/plugin.js +8 -0
  292. package/dist/vite/plugin.js.map +1 -1
  293. package/lib/Spinner-DCwVN24H.js +8441 -0
  294. package/lib/assets/index-BPdJm2ty.js +4764 -0
  295. package/lib/assets/worker-BCcpCNJ7.js +14473 -0
  296. package/lib/clerk-Wslx_mPo.js +19685 -0
  297. package/lib/index-PyGcnQFX.js +3462 -0
  298. package/lib/loglevel-CoH7VSwE.js +152 -0
  299. package/lib/prism-bash.min-DadFsM4Z.js +6 -0
  300. package/lib/prism-csharp.min-Yizuc34Y.js +34 -0
  301. package/lib/prism-java.min-d5iT_mOd.js +6 -0
  302. package/lib/prism-json.min-B1GJqK1k.js +1 -0
  303. package/lib/prism-markup-templating-DZrrEs0A.js +61 -0
  304. package/lib/prism-objectivec.min-BXSWqpJJ.js +1 -0
  305. package/lib/prism-php.min-o7FpoMP_.js +10 -0
  306. package/lib/prism-ruby.min-C7LwcKyz.js +9 -0
  307. package/lib/state-2Hu1renZ.js +313 -0
  308. package/lib/urql-DMlBWUKL.js +1591 -0
  309. package/lib/zudoku.auth-auth0.js +27 -0
  310. package/lib/zudoku.auth-clerk.js +49 -0
  311. package/lib/zudoku.auth-openid.js +912 -0
  312. package/lib/zudoku.components.js +894 -0
  313. package/lib/zudoku.openapi-worker.js +225 -0
  314. package/lib/zudoku.plugins.js +19908 -0
  315. package/package.json +70 -39
  316. package/src/app/App.tsx +17 -6
  317. package/src/app/main.css +1 -0
  318. package/src/app/main.tsx +12 -3
  319. package/src/lib/authentication/Callback.tsx +60 -0
  320. package/src/lib/authentication/authentication.ts +19 -0
  321. package/src/lib/authentication/errors.ts +21 -0
  322. package/src/lib/authentication/hook.ts +34 -0
  323. package/src/lib/authentication/providers/auth0.tsx +53 -0
  324. package/src/lib/authentication/providers/clerk.tsx +66 -0
  325. package/src/lib/authentication/providers/openid.tsx +314 -0
  326. package/src/lib/authentication/state.ts +21 -0
  327. package/src/{app → lib/components}/DevPortal.tsx +29 -42
  328. package/src/{app → lib}/components/Dialog.tsx +37 -37
  329. package/src/{app → lib}/components/Header.tsx +28 -23
  330. package/src/{app → lib/components}/Heading.tsx +2 -2
  331. package/src/{app → lib}/components/Layout.tsx +18 -12
  332. package/src/lib/components/Link.tsx +1 -0
  333. package/src/lib/components/Router.tsx +28 -0
  334. package/src/lib/components/Select.tsx +157 -0
  335. package/src/lib/components/Spinner.tsx +5 -0
  336. package/src/{app → lib}/components/SyntaxHighlight.tsx +15 -4
  337. package/src/{app → lib}/components/context/DevPortalProvider.ts +1 -1
  338. package/src/lib/components/index.ts +3 -0
  339. package/src/{app → lib}/components/navigation/SideNavigation.tsx +4 -1
  340. package/src/{app → lib}/components/navigation/SideNavigationCategory.tsx +3 -1
  341. package/src/{app → lib}/components/navigation/SideNavigationItem.tsx +16 -7
  342. package/src/lib/components/navigation/SideNavigationWrapper.tsx +24 -0
  343. package/src/{app → lib}/core/DevPortalContext.ts +33 -67
  344. package/src/{app → lib}/core/plugins.ts +5 -5
  345. package/src/{app → lib}/oas/graphql/index.ts +2 -2
  346. package/src/lib/plugins/api-key/CreateApiKey.tsx +94 -0
  347. package/src/lib/plugins/api-key/SettingsApiKeys.tsx +132 -0
  348. package/src/lib/plugins/api-key/index.tsx +160 -0
  349. package/src/lib/plugins/index.ts +4 -0
  350. package/src/{app → lib}/plugins/markdown/MdxPage.tsx +33 -11
  351. package/src/{app → lib}/plugins/markdown/generateRoutes.tsx +1 -16
  352. package/src/{app → lib}/plugins/openapi/ColorizedParam.tsx +1 -3
  353. package/src/lib/plugins/openapi/MakeRequest.tsx +63 -0
  354. package/src/{app → lib}/plugins/openapi/OperationList.tsx +14 -4
  355. package/src/lib/plugins/openapi/OperationListItem.tsx +93 -0
  356. package/src/{app → lib}/plugins/openapi/ParameterList.tsx +4 -4
  357. package/src/{app → lib}/plugins/openapi/ParameterListItem.tsx +5 -2
  358. package/src/{app → lib}/plugins/openapi/RequestBodySidecarBox.tsx +4 -3
  359. package/src/{app → lib}/plugins/openapi/ResponsesSidecarBox.tsx +2 -3
  360. package/src/lib/plugins/openapi/SchemaListView.tsx +228 -0
  361. package/src/{app → lib}/plugins/openapi/Sidecar.tsx +33 -28
  362. package/src/{app/plugins/openapi/Select.tsx → lib/plugins/openapi/SimpleSelect.tsx} +5 -2
  363. package/src/{app → lib}/plugins/openapi/graphql/gql.ts +7 -7
  364. package/src/{app → lib}/plugins/openapi/graphql/graphql.ts +59 -0
  365. package/src/{app → lib}/plugins/openapi/index.tsx +8 -2
  366. package/src/lib/plugins/openapi/playground/Editor.tsx +4 -0
  367. package/src/lib/plugins/openapi/playground/Headers.tsx +87 -0
  368. package/src/lib/plugins/openapi/playground/InlineInput.tsx +6 -0
  369. package/src/lib/plugins/openapi/playground/PathParams.tsx +63 -0
  370. package/src/lib/plugins/openapi/playground/Playground.tsx +361 -0
  371. package/src/lib/plugins/openapi/playground/QueryParams.tsx +89 -0
  372. package/src/lib/plugins/openapi/playground/UrlDisplay.tsx +32 -0
  373. package/src/lib/plugins/openapi/playground/createUrl.ts +22 -0
  374. package/src/{app → lib}/plugins/openapi/util/generateSchemaExample.ts +22 -9
  375. package/src/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.ts +2 -1
  376. package/src/lib/plugins/openapi/worker/shared-worker.ts +5 -0
  377. package/src/lib/plugins/openapi-worker.ts +1 -0
  378. package/src/{app → lib}/plugins/redirect/index.tsx +1 -1
  379. package/src/lib/ui/Button.tsx +25 -0
  380. package/src/{app → lib}/ui/Tabs.tsx +2 -2
  381. package/src/{app/ui/Button.tsx → lib/ui/button-variants.ts} +4 -29
  382. package/src/{app → lib}/util/MdxComponents.tsx +33 -8
  383. package/src/{app → lib}/util/createVariantComponent.tsx +12 -7
  384. package/dist/app/DevPortal.d.ts +0 -25
  385. package/dist/app/DevPortal.js +0 -41
  386. package/dist/app/DevPortal.js.map +0 -1
  387. package/dist/app/Heading.js.map +0 -1
  388. package/dist/app/authentication/authentication.d.ts +0 -13
  389. package/dist/app/authentication/authentication.js.map +0 -1
  390. package/dist/app/authentication/clerk.d.ts +0 -5
  391. package/dist/app/authentication/clerk.js +0 -36
  392. package/dist/app/authentication/clerk.js.map +0 -1
  393. package/dist/app/authentication/openid.d.ts +0 -11
  394. package/dist/app/authentication/openid.js +0 -118
  395. package/dist/app/authentication/openid.js.map +0 -1
  396. package/dist/app/components/Dialog.js.map +0 -1
  397. package/dist/app/components/DynamicIcon.d.ts +0 -6
  398. package/dist/app/components/DynamicIcon.js +0 -6
  399. package/dist/app/components/DynamicIcon.js.map +0 -1
  400. package/dist/app/components/Header.d.ts +0 -1
  401. package/dist/app/components/Header.js +0 -15
  402. package/dist/app/components/Header.js.map +0 -1
  403. package/dist/app/components/Layout.js.map +0 -1
  404. package/dist/app/components/SyntaxHighlight.js.map +0 -1
  405. package/dist/app/components/context/DevPortalProvider.js.map +0 -1
  406. package/dist/app/components/context/PluginSystem.js.map +0 -1
  407. package/dist/app/components/navigation/SideNavigationItem.js.map +0 -1
  408. package/dist/app/components/navigation/SideNavigationWrapper.js +0 -6
  409. package/dist/app/components/navigation/SideNavigationWrapper.js.map +0 -1
  410. package/dist/app/core/DevPortalContext.js +0 -68
  411. package/dist/app/core/DevPortalContext.js.map +0 -1
  412. package/dist/app/core/icons.js.map +0 -1
  413. package/dist/app/core/router.js.map +0 -1
  414. package/dist/app/core/types/combine.d.ts +0 -4
  415. package/dist/app/core/types/combine.js +0 -2
  416. package/dist/app/core/types/combine.js.map +0 -1
  417. package/dist/app/oas/graphql/index.js.map +0 -1
  418. package/dist/app/oas/graphql/server.d.ts +0 -1
  419. package/dist/app/oas/graphql/server.js +0 -8
  420. package/dist/app/oas/graphql/server.js.map +0 -1
  421. package/dist/app/plugins/api-key/SettingsApiKeys.d.ts +0 -4
  422. package/dist/app/plugins/api-key/SettingsApiKeys.js +0 -7
  423. package/dist/app/plugins/api-key/SettingsApiKeys.js.map +0 -1
  424. package/dist/app/plugins/api-key/index.d.ts +0 -32
  425. package/dist/app/plugins/api-key/index.js +0 -55
  426. package/dist/app/plugins/api-key/index.js.map +0 -1
  427. package/dist/app/plugins/markdown/MdxPage.d.ts +0 -3
  428. package/dist/app/plugins/markdown/MdxPage.js +0 -55
  429. package/dist/app/plugins/markdown/MdxPage.js.map +0 -1
  430. package/dist/app/plugins/markdown/generateRoutes.js.map +0 -1
  431. package/dist/app/plugins/openapi/ColorizedParam.js.map +0 -1
  432. package/dist/app/plugins/openapi/MakeRequest.js +0 -23
  433. package/dist/app/plugins/openapi/MakeRequest.js.map +0 -1
  434. package/dist/app/plugins/openapi/OperationList.js.map +0 -1
  435. package/dist/app/plugins/openapi/OperationListItem.js +0 -15
  436. package/dist/app/plugins/openapi/OperationListItem.js.map +0 -1
  437. package/dist/app/plugins/openapi/ParameterList.js +0 -5
  438. package/dist/app/plugins/openapi/ParameterList.js.map +0 -1
  439. package/dist/app/plugins/openapi/ParameterListItem.js +0 -13
  440. package/dist/app/plugins/openapi/RequestBodySidecarBox.js.map +0 -1
  441. package/dist/app/plugins/openapi/Select.js +0 -5
  442. package/dist/app/plugins/openapi/Select.js.map +0 -1
  443. package/dist/app/plugins/openapi/Sidecar.js.map +0 -1
  444. package/dist/app/plugins/openapi/graphql/gql.js.map +0 -1
  445. package/dist/app/plugins/openapi/graphql/graphql.js.map +0 -1
  446. package/dist/app/plugins/openapi/graphql/index.js.map +0 -1
  447. package/dist/app/plugins/openapi/index.js.map +0 -1
  448. package/dist/app/plugins/openapi/playground/Playground.d.ts +0 -8
  449. package/dist/app/plugins/openapi/playground/Playground.js +0 -98
  450. package/dist/app/plugins/openapi/playground/Playground.js.map +0 -1
  451. package/dist/app/plugins/openapi/util/generateSchemaExample.js.map +0 -1
  452. package/dist/app/plugins/openapi/worker/createSharedWorkerClient.js.map +0 -1
  453. package/dist/app/ui/Button.d.ts +0 -11
  454. package/dist/app/ui/Button.js.map +0 -1
  455. package/dist/app/util/MdxComponents.js.map +0 -1
  456. package/dist/app/util/createVariantComponent.d.ts +0 -15
  457. package/dist/app/util/createVariantComponent.js +0 -12
  458. package/dist/app/util/createVariantComponent.js.map +0 -1
  459. package/dist/app/util/slugify.js.map +0 -1
  460. package/dist/auth.d.ts +0 -2
  461. package/dist/auth.js +0 -3
  462. package/dist/auth.js.map +0 -1
  463. package/dist/plugins.d.ts +0 -4
  464. package/dist/plugins.js +0 -6
  465. package/dist/plugins.js.map +0 -1
  466. package/src/app/authentication/authentication.ts +0 -18
  467. package/src/app/authentication/clerk.ts +0 -47
  468. package/src/app/authentication/openid.ts +0 -192
  469. package/src/app/components/DynamicIcon.tsx +0 -60
  470. package/src/app/components/navigation/SideNavigationWrapper.tsx +0 -15
  471. package/src/app/core/types/combine.ts +0 -16
  472. package/src/app/oas/graphql/server.ts +0 -10
  473. package/src/app/plugins/api-key/SettingsApiKeys.tsx +0 -22
  474. package/src/app/plugins/api-key/index.tsx +0 -123
  475. package/src/app/plugins/openapi/MakeRequest.tsx +0 -49
  476. package/src/app/plugins/openapi/OperationListItem.tsx +0 -55
  477. package/src/app/plugins/openapi/playground/Playground.tsx +0 -309
  478. package/src/app/plugins/openapi/queries.graphql +0 -6
  479. package/dist/{app → lib}/authentication/authentication.js +0 -0
  480. package/dist/{app → lib}/components/AnchorLink.d.ts +0 -0
  481. package/dist/{app → lib}/components/AnchorLink.js +0 -0
  482. package/dist/{app → lib}/components/CategoryHeading.d.ts +0 -0
  483. package/dist/{app → lib}/components/CategoryHeading.js +0 -0
  484. package/dist/{app → lib/components}/Heading.d.ts +0 -0
  485. package/dist/{app → lib}/components/Input.d.ts +0 -0
  486. package/dist/{app → lib}/components/Input.js +0 -0
  487. package/dist/{app → lib}/components/Layout.d.ts +0 -0
  488. package/dist/{app → lib}/components/Markdown.d.ts +0 -0
  489. package/dist/{app → lib}/components/Markdown.js +0 -0
  490. package/dist/{app → lib}/components/TopNavigation.d.ts +0 -0
  491. package/dist/{app → lib}/components/TopNavigation.js +0 -0
  492. package/dist/{app → lib}/components/context/ComponentsContext.js +0 -0
  493. package/dist/{app → lib}/components/context/DevPortalProvider.d.ts +0 -0
  494. package/dist/{app → lib}/components/context/PluginSystem.d.ts +0 -0
  495. package/dist/{app → lib}/components/context/PluginSystem.js +0 -0
  496. package/dist/{app → lib}/components/context/ThemeContext.d.ts +0 -0
  497. package/dist/{app → lib}/components/context/ViewportAnchorContext.d.ts +0 -0
  498. package/dist/{app → lib}/components/context/ViewportAnchorContext.js +0 -0
  499. package/dist/{app → lib}/components/navigation/SideNavigation.d.ts +0 -0
  500. package/dist/{app → lib}/components/navigation/SideNavigationCategory.d.ts +0 -0
  501. package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.d.ts +0 -0
  502. package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.js +0 -0
  503. package/dist/{app → lib}/components/navigation/util.d.ts +0 -0
  504. package/dist/{app → lib}/components/navigation/util.js +0 -0
  505. package/dist/{app → lib}/core/helmet.d.ts +0 -0
  506. package/dist/{app → lib}/core/helmet.js +0 -0
  507. package/dist/{app → lib}/core/icons.d.ts +0 -0
  508. package/dist/{app → lib}/core/icons.js +0 -0
  509. package/dist/{app → lib}/core/router.d.ts +0 -0
  510. package/dist/{app → lib}/core/router.js +0 -0
  511. package/dist/{app → lib}/oas/graphql/index.d.ts +0 -0
  512. package/dist/{app → lib}/oas/parser/dereference/index.d.ts +0 -0
  513. package/dist/{app → lib}/oas/parser/dereference/index.js +0 -0
  514. package/dist/{app → lib}/oas/parser/dereference/resolveRef.d.ts +0 -0
  515. package/dist/{app → lib}/oas/parser/dereference/resolveRef.js +0 -0
  516. package/dist/{app → lib}/oas/parser/index.d.ts +0 -0
  517. package/dist/{app → lib}/oas/parser/index.js +0 -0
  518. package/dist/{app → lib}/oas/parser/upgrade/index.d.ts +0 -0
  519. package/dist/{app → lib}/oas/parser/upgrade/index.js +0 -0
  520. package/dist/{app → lib}/plugins/markdown/Toc.d.ts +0 -0
  521. package/dist/{app → lib}/plugins/markdown/Toc.js +0 -0
  522. package/dist/{app → lib}/plugins/markdown/generateRoutes.d.ts +0 -0
  523. package/dist/{app → lib}/plugins/markdown/index.d.ts +0 -0
  524. package/dist/{app → lib}/plugins/markdown/index.js +0 -0
  525. package/dist/{app → lib}/plugins/openapi/MakeRequest.d.ts +0 -0
  526. package/dist/{app → lib}/plugins/openapi/MethodBadge.d.ts +0 -0
  527. package/dist/{app → lib}/plugins/openapi/MethodBadge.js +0 -0
  528. package/dist/{app → lib}/plugins/openapi/OperationList.d.ts +0 -0
  529. package/dist/{app → lib}/plugins/openapi/OperationListItem.d.ts +0 -0
  530. package/dist/{app → lib}/plugins/openapi/ParameterListItem.d.ts +0 -0
  531. package/dist/{app → lib}/plugins/openapi/RequestBodySidecarBox.d.ts +0 -0
  532. package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.d.ts +0 -0
  533. package/dist/{app → lib}/plugins/openapi/Sidecar.d.ts +0 -0
  534. package/dist/{app → lib}/plugins/openapi/SidecarBox.d.ts +0 -0
  535. package/dist/{app → lib}/plugins/openapi/SidecarBox.js +0 -0
  536. package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.js +0 -0
  537. package/dist/{app → lib}/plugins/openapi/graphql/index.d.ts +0 -0
  538. package/dist/{app → lib}/plugins/openapi/graphql/index.js +0 -0
  539. package/dist/{app → lib}/plugins/openapi/index.d.ts +0 -0
  540. package/dist/{app → lib}/plugins/openapi/util/urql.d.ts +0 -0
  541. package/dist/{app → lib}/plugins/openapi/util/urql.js +0 -0
  542. package/dist/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.d.ts +0 -0
  543. package/dist/{app → lib}/plugins/openapi/worker/worker.d.ts +0 -0
  544. package/dist/{app → lib}/plugins/openapi/worker/worker.js +0 -0
  545. package/dist/{app → lib}/plugins/redirect/index.js +0 -0
  546. package/dist/{app → lib}/ui/Callout.d.ts +0 -0
  547. package/dist/{app → lib}/ui/Callout.js +0 -0
  548. package/dist/{app → lib}/ui/Card.d.ts +0 -0
  549. package/dist/{app → lib}/ui/Card.js +0 -0
  550. package/dist/{app → lib}/ui/Note.d.ts +0 -0
  551. package/dist/{app → lib}/ui/Note.js +0 -0
  552. package/dist/{app → lib}/util/MdxComponents.d.ts +0 -0
  553. package/dist/{app → lib}/util/cn.d.ts +0 -0
  554. package/dist/{app → lib}/util/cn.js +0 -0
  555. package/dist/{app → lib}/util/createWaitForNotify.d.ts +0 -0
  556. package/dist/{app → lib}/util/createWaitForNotify.js +0 -0
  557. package/dist/{app → lib}/util/groupBy.d.ts +0 -0
  558. package/dist/{app → lib}/util/groupBy.js +0 -0
  559. package/dist/{app → lib}/util/joinPath.d.ts +0 -0
  560. package/dist/{app → lib}/util/joinPath.js +0 -0
  561. package/dist/{app → lib}/util/pastellize.d.ts +0 -0
  562. package/dist/{app → lib}/util/pastellize.js +0 -0
  563. package/dist/{app → lib}/util/slugify.d.ts +0 -0
  564. package/dist/{app → lib}/util/slugify.js +0 -0
  565. package/dist/{app → lib}/util/traverseNavigation.d.ts +0 -0
  566. package/dist/{app → lib}/util/traverseNavigation.js +0 -0
  567. package/dist/{app → lib}/util/useScrollToAnchor.d.ts +0 -0
  568. package/dist/{app → lib}/util/useScrollToAnchor.js +0 -0
  569. package/dist/{app → lib}/util/useScrollToTop.d.ts +0 -0
  570. package/dist/{app → lib}/util/useScrollToTop.js +0 -0
  571. package/src/{app → lib}/components/AnchorLink.tsx +0 -0
  572. package/src/{app → lib}/components/CategoryHeading.tsx +1 -1
  573. package/src/{app → lib}/components/Input.tsx +0 -0
  574. package/src/{app → lib}/components/Markdown.tsx +0 -0
  575. package/src/{app → lib}/components/TopNavigation.tsx +0 -0
  576. package/src/{app → lib}/components/context/ComponentsContext.tsx +0 -0
  577. package/src/{app → lib}/components/context/PluginSystem.ts +0 -0
  578. package/src/{app → lib}/components/context/ThemeContext.tsx +1 -1
  579. package/src/{app → lib}/components/context/ViewportAnchorContext.tsx +0 -0
  580. package/src/{app → lib}/components/navigation/useNavigationCollapsibleState.ts +0 -0
  581. package/src/{app → lib}/components/navigation/util.ts +0 -0
  582. package/src/{app → lib}/core/helmet.ts +0 -0
  583. package/src/{app → lib}/core/icons.tsx +0 -0
  584. package/src/{app → lib}/core/router.tsx +0 -0
  585. package/src/{app → lib}/oas/parser/dereference/index.ts +0 -0
  586. package/src/{app → lib}/oas/parser/dereference/resolveRef.ts +0 -0
  587. package/src/{app → lib}/oas/parser/index.ts +0 -0
  588. package/src/{app → lib}/oas/parser/schemas/v3.0.json +0 -0
  589. package/src/{app → lib}/oas/parser/schemas/v3.1.json +0 -0
  590. package/src/{app → lib}/oas/parser/upgrade/index.ts +0 -0
  591. package/src/{app → lib}/plugins/markdown/Toc.tsx +0 -0
  592. package/src/{app → lib}/plugins/markdown/index.tsx +0 -0
  593. package/src/{app → lib}/plugins/openapi/MethodBadge.tsx +0 -0
  594. package/src/{app → lib}/plugins/openapi/SidecarBox.tsx +0 -0
  595. package/src/{app → lib}/plugins/openapi/graphql/fragment-masking.ts +1 -1
  596. /package/src/{app → lib}/plugins/openapi/graphql/index.ts +0 -0
  597. /package/src/{app → lib}/plugins/openapi/util/urql.ts +0 -0
  598. /package/src/{app → lib}/plugins/openapi/worker/worker.ts +0 -0
  599. /package/src/{app → lib}/ui/Callout.tsx +0 -0
  600. /package/src/{app → lib}/ui/Card.tsx +0 -0
  601. /package/src/{app → lib}/ui/Note.tsx +0 -0
  602. /package/src/{app → lib}/util/cn.ts +0 -0
  603. /package/src/{app → lib}/util/createWaitForNotify.ts +0 -0
  604. /package/src/{app → lib}/util/groupBy.ts +0 -0
  605. /package/src/{app → lib}/util/joinPath.tsx +0 -0
  606. /package/src/{app → lib}/util/pastellize.ts +0 -0
  607. /package/src/{app → lib}/util/slugify.ts +0 -0
  608. /package/src/{app → lib}/util/traverseNavigation.ts +0 -0
  609. /package/src/{app → lib}/util/useScrollToAnchor.ts +0 -0
  610. /package/src/{app → lib}/util/useScrollToTop.ts +0 -0
@@ -0,0 +1,912 @@
1
+ var ue = Object.defineProperty;
2
+ var he = (e, t, n) => t in e ? ue(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var w = (e, t, n) => he(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { a as de, j as g } from "./index-PyGcnQFX.js";
5
+ import { l as I } from "./loglevel-CoH7VSwE.js";
6
+ import { useRef as fe, useState as le, useEffect as pe } from "react";
7
+ import { u as M } from "./state-2Hu1renZ.js";
8
+ let z;
9
+ var v, Z;
10
+ (typeof navigator > "u" || !((Z = (v = navigator.userAgent) == null ? void 0 : v.startsWith) != null && Z.call(v, "Mozilla/5.0 "))) && (z = "oauth4webapi/v2.11.1");
11
+ function O(e, t) {
12
+ if (e == null)
13
+ return !1;
14
+ try {
15
+ return e instanceof t || Object.getPrototypeOf(e)[Symbol.toStringTag] === t.prototype[Symbol.toStringTag];
16
+ } catch {
17
+ return !1;
18
+ }
19
+ }
20
+ const P = Symbol(), we = Symbol(), K = Symbol(), me = new TextEncoder(), ye = new TextDecoder();
21
+ function _(e) {
22
+ return typeof e == "string" ? me.encode(e) : ye.decode(e);
23
+ }
24
+ const B = 32768;
25
+ function ge(e) {
26
+ e instanceof ArrayBuffer && (e = new Uint8Array(e));
27
+ const t = [];
28
+ for (let n = 0; n < e.byteLength; n += B)
29
+ t.push(String.fromCharCode.apply(null, e.subarray(n, n + B)));
30
+ return btoa(t.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
31
+ }
32
+ function _e(e) {
33
+ try {
34
+ const t = atob(e.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "")), n = new Uint8Array(t.length);
35
+ for (let r = 0; r < t.length; r++)
36
+ n[r] = t.charCodeAt(r);
37
+ return n;
38
+ } catch (t) {
39
+ throw new o("The input to be decoded is not correctly encoded.", { cause: t });
40
+ }
41
+ }
42
+ function y(e) {
43
+ return typeof e == "string" ? _e(e) : ge(e);
44
+ }
45
+ class be {
46
+ constructor(t) {
47
+ this.cache = /* @__PURE__ */ new Map(), this._cache = /* @__PURE__ */ new Map(), this.maxSize = t;
48
+ }
49
+ get(t) {
50
+ let n = this.cache.get(t);
51
+ if (n)
52
+ return n;
53
+ if (n = this._cache.get(t))
54
+ return this.update(t, n), n;
55
+ }
56
+ has(t) {
57
+ return this.cache.has(t) || this._cache.has(t);
58
+ }
59
+ set(t, n) {
60
+ return this.cache.has(t) ? this.cache.set(t, n) : this.update(t, n), this;
61
+ }
62
+ delete(t) {
63
+ return this.cache.has(t) ? this.cache.delete(t) : this._cache.has(t) ? this._cache.delete(t) : !1;
64
+ }
65
+ update(t, n) {
66
+ this.cache.set(t, n), this.cache.size >= this.maxSize && (this._cache = this.cache, this.cache = /* @__PURE__ */ new Map());
67
+ }
68
+ }
69
+ class f extends Error {
70
+ constructor(t) {
71
+ var n;
72
+ super(t ?? "operation not supported"), this.name = this.constructor.name, (n = Error.captureStackTrace) == null || n.call(Error, this, this.constructor);
73
+ }
74
+ }
75
+ class Se extends Error {
76
+ constructor(t, n) {
77
+ var r;
78
+ super(t, n), this.name = this.constructor.name, (r = Error.captureStackTrace) == null || r.call(Error, this, this.constructor);
79
+ }
80
+ }
81
+ const o = Se, Q = new be(100);
82
+ function X(e) {
83
+ return e instanceof CryptoKey;
84
+ }
85
+ function ee(e) {
86
+ return X(e) && e.type === "private";
87
+ }
88
+ function ke(e) {
89
+ return X(e) && e.type === "public";
90
+ }
91
+ function N(e) {
92
+ try {
93
+ const t = e.headers.get("dpop-nonce");
94
+ t && Q.set(new URL(e.url).origin, t);
95
+ } catch {
96
+ }
97
+ return e;
98
+ }
99
+ function E(e) {
100
+ return !(e === null || typeof e != "object" || Array.isArray(e));
101
+ }
102
+ function x(e) {
103
+ O(e, Headers) && (e = Object.fromEntries(e.entries()));
104
+ const t = new Headers(e);
105
+ if (z && !t.has("user-agent") && t.set("user-agent", z), t.has("authorization"))
106
+ throw new TypeError('"options.headers" must not include the "authorization" header name');
107
+ if (t.has("dpop"))
108
+ throw new TypeError('"options.headers" must not include the "dpop" header name');
109
+ return t;
110
+ }
111
+ function W(e) {
112
+ if (typeof e == "function" && (e = e()), !(e instanceof AbortSignal))
113
+ throw new TypeError('"options.signal" must return or be an instance of AbortSignal');
114
+ return e;
115
+ }
116
+ async function Ee(e, t) {
117
+ if (!(e instanceof URL))
118
+ throw new TypeError('"issuerIdentifier" must be an instance of URL');
119
+ if (e.protocol !== "https:" && e.protocol !== "http:")
120
+ throw new TypeError('"issuer.protocol" must be "https:" or "http:"');
121
+ const n = new URL(e.href);
122
+ switch (t == null ? void 0 : t.algorithm) {
123
+ case void 0:
124
+ case "oidc":
125
+ n.pathname = `${n.pathname}/.well-known/openid-configuration`.replace("//", "/");
126
+ break;
127
+ case "oauth2":
128
+ n.pathname === "/" ? n.pathname = ".well-known/oauth-authorization-server" : n.pathname = `.well-known/oauth-authorization-server/${n.pathname}`.replace("//", "/");
129
+ break;
130
+ default:
131
+ throw new TypeError('"options.algorithm" must be "oidc" (default), or "oauth2"');
132
+ }
133
+ const r = x(t == null ? void 0 : t.headers);
134
+ return r.set("accept", "application/json"), ((t == null ? void 0 : t[K]) || fetch)(n.href, {
135
+ headers: Object.fromEntries(r.entries()),
136
+ method: "GET",
137
+ redirect: "manual",
138
+ signal: t != null && t.signal ? W(t.signal) : null
139
+ }).then(N);
140
+ }
141
+ function h(e) {
142
+ return typeof e == "string" && e.length !== 0;
143
+ }
144
+ async function Te(e, t) {
145
+ if (!(e instanceof URL))
146
+ throw new TypeError('"expectedIssuer" must be an instance of URL');
147
+ if (!O(t, Response))
148
+ throw new TypeError('"response" must be an instance of Response');
149
+ if (t.status !== 200)
150
+ throw new o('"response" is not a conform Authorization Server Metadata response');
151
+ H(t);
152
+ let n;
153
+ try {
154
+ n = await t.json();
155
+ } catch (r) {
156
+ throw new o('failed to parse "response" body as JSON', { cause: r });
157
+ }
158
+ if (!E(n))
159
+ throw new o('"response" body must be a top level object');
160
+ if (!h(n.issuer))
161
+ throw new o('"response" body "issuer" property must be a non-empty string');
162
+ if (new URL(n.issuer).href !== e.href)
163
+ throw new o('"response" body "issuer" does not match "expectedIssuer"');
164
+ return n;
165
+ }
166
+ function j() {
167
+ return y(crypto.getRandomValues(new Uint8Array(32)));
168
+ }
169
+ function Ae() {
170
+ return j();
171
+ }
172
+ function ve() {
173
+ return j();
174
+ }
175
+ async function Re(e) {
176
+ if (!h(e))
177
+ throw new TypeError('"codeVerifier" must be a non-empty string');
178
+ return y(await crypto.subtle.digest("SHA-256", _(e)));
179
+ }
180
+ function Pe(e) {
181
+ if (e instanceof CryptoKey)
182
+ return { key: e };
183
+ if (!((e == null ? void 0 : e.key) instanceof CryptoKey))
184
+ return {};
185
+ if (e.kid !== void 0 && !h(e.kid))
186
+ throw new TypeError('"kid" must be a non-empty string');
187
+ return { key: e.key, kid: e.kid };
188
+ }
189
+ function F(e) {
190
+ return encodeURIComponent(e).replace(/%20/g, "+");
191
+ }
192
+ function xe(e, t) {
193
+ const n = F(e), r = F(t);
194
+ return `Basic ${btoa(`${n}:${r}`)}`;
195
+ }
196
+ function je(e) {
197
+ switch (e.algorithm.hash.name) {
198
+ case "SHA-256":
199
+ return "PS256";
200
+ case "SHA-384":
201
+ return "PS384";
202
+ case "SHA-512":
203
+ return "PS512";
204
+ default:
205
+ throw new f("unsupported RsaHashedKeyAlgorithm hash name");
206
+ }
207
+ }
208
+ function Ue(e) {
209
+ switch (e.algorithm.hash.name) {
210
+ case "SHA-256":
211
+ return "RS256";
212
+ case "SHA-384":
213
+ return "RS384";
214
+ case "SHA-512":
215
+ return "RS512";
216
+ default:
217
+ throw new f("unsupported RsaHashedKeyAlgorithm hash name");
218
+ }
219
+ }
220
+ function Ce(e) {
221
+ switch (e.algorithm.namedCurve) {
222
+ case "P-256":
223
+ return "ES256";
224
+ case "P-384":
225
+ return "ES384";
226
+ case "P-521":
227
+ return "ES512";
228
+ default:
229
+ throw new f("unsupported EcKeyAlgorithm namedCurve");
230
+ }
231
+ }
232
+ function te(e) {
233
+ switch (e.algorithm.name) {
234
+ case "RSA-PSS":
235
+ return je(e);
236
+ case "RSASSA-PKCS1-v1_5":
237
+ return Ue(e);
238
+ case "ECDSA":
239
+ return Ce(e);
240
+ case "Ed25519":
241
+ case "Ed448":
242
+ return "EdDSA";
243
+ default:
244
+ throw new f("unsupported CryptoKey algorithm name");
245
+ }
246
+ }
247
+ function U(e) {
248
+ const t = e == null ? void 0 : e[P];
249
+ return typeof t == "number" && Number.isFinite(t) ? t : 0;
250
+ }
251
+ function ze(e) {
252
+ const t = e == null ? void 0 : e[we];
253
+ return typeof t == "number" && Number.isFinite(t) && Math.sign(t) !== -1 ? t : 30;
254
+ }
255
+ function D() {
256
+ return Math.floor(Date.now() / 1e3);
257
+ }
258
+ function Je(e, t) {
259
+ const n = D() + U(t);
260
+ return {
261
+ jti: j(),
262
+ aud: [e.issuer, e.token_endpoint],
263
+ exp: n + 60,
264
+ iat: n,
265
+ nbf: n,
266
+ iss: t.client_id,
267
+ sub: t.client_id
268
+ };
269
+ }
270
+ async function Le(e, t, n, r) {
271
+ return ne({
272
+ alg: te(n),
273
+ kid: r
274
+ }, Je(e, t), n);
275
+ }
276
+ function T(e) {
277
+ if (typeof e != "object" || e === null)
278
+ throw new TypeError('"as" must be an object');
279
+ if (!h(e.issuer))
280
+ throw new TypeError('"as.issuer" property must be a non-empty string');
281
+ return !0;
282
+ }
283
+ function A(e) {
284
+ if (typeof e != "object" || e === null)
285
+ throw new TypeError('"client" must be an object');
286
+ if (!h(e.client_id))
287
+ throw new TypeError('"client.client_id" property must be a non-empty string');
288
+ return !0;
289
+ }
290
+ function q(e) {
291
+ if (!h(e))
292
+ throw new TypeError('"client.client_secret" property must be a non-empty string');
293
+ return e;
294
+ }
295
+ function C(e, t) {
296
+ if (t !== void 0)
297
+ throw new TypeError(`"options.clientPrivateKey" property must not be provided when ${e} client authentication method is used.`);
298
+ }
299
+ function V(e, t) {
300
+ if (t !== void 0)
301
+ throw new TypeError(`"client.client_secret" property must not be provided when ${e} client authentication method is used.`);
302
+ }
303
+ async function Oe(e, t, n, r, a) {
304
+ switch (n.delete("client_secret"), n.delete("client_assertion_type"), n.delete("client_assertion"), t.token_endpoint_auth_method) {
305
+ case void 0:
306
+ case "client_secret_basic": {
307
+ C("client_secret_basic", a), r.set("authorization", xe(t.client_id, q(t.client_secret)));
308
+ break;
309
+ }
310
+ case "client_secret_post": {
311
+ C("client_secret_post", a), n.set("client_id", t.client_id), n.set("client_secret", q(t.client_secret));
312
+ break;
313
+ }
314
+ case "private_key_jwt": {
315
+ if (V("private_key_jwt", t.client_secret), a === void 0)
316
+ throw new TypeError('"options.clientPrivateKey" must be provided when "client.token_endpoint_auth_method" is "private_key_jwt"');
317
+ const { key: i, kid: s } = Pe(a);
318
+ if (!ee(i))
319
+ throw new TypeError('"options.clientPrivateKey.key" must be a private CryptoKey');
320
+ n.set("client_id", t.client_id), n.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.set("client_assertion", await Le(e, t, i, s));
321
+ break;
322
+ }
323
+ case "tls_client_auth":
324
+ case "self_signed_tls_client_auth":
325
+ case "none": {
326
+ V(t.token_endpoint_auth_method, t.client_secret), C(t.token_endpoint_auth_method, a), n.set("client_id", t.client_id);
327
+ break;
328
+ }
329
+ default:
330
+ throw new f("unsupported client token_endpoint_auth_method");
331
+ }
332
+ }
333
+ async function ne(e, t, n) {
334
+ if (!n.usages.includes("sign"))
335
+ throw new TypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"');
336
+ const r = `${y(_(JSON.stringify(e)))}.${y(_(JSON.stringify(t)))}`, a = y(await crypto.subtle.sign(oe(n), n, _(r)));
337
+ return `${r}.${a}`;
338
+ }
339
+ async function Ke(e, t, n, r, a, i) {
340
+ const { privateKey: s, publicKey: c, nonce: d = Q.get(n.origin) } = t;
341
+ if (!ee(s))
342
+ throw new TypeError('"DPoP.privateKey" must be a private CryptoKey');
343
+ if (!ke(c))
344
+ throw new TypeError('"DPoP.publicKey" must be a public CryptoKey');
345
+ if (d !== void 0 && !h(d))
346
+ throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');
347
+ if (!c.extractable)
348
+ throw new TypeError('"DPoP.publicKey.extractable" must be true');
349
+ const l = D() + a, S = await ne({
350
+ alg: te(s),
351
+ typ: "dpop+jwt",
352
+ jwk: await We(c)
353
+ }, {
354
+ iat: l,
355
+ jti: j(),
356
+ htm: r,
357
+ nonce: d,
358
+ htu: `${n.origin}${n.pathname}`,
359
+ ath: i ? y(await crypto.subtle.digest("SHA-256", _(i))) : void 0
360
+ }, s);
361
+ e.set("dpop", S);
362
+ }
363
+ let R;
364
+ async function Ne(e) {
365
+ const { kty: t, e: n, n: r, x: a, y: i, crv: s } = await crypto.subtle.exportKey("jwk", e), c = { kty: t, e: n, n: r, x: a, y: i, crv: s };
366
+ return R.set(e, c), c;
367
+ }
368
+ async function We(e) {
369
+ return R || (R = /* @__PURE__ */ new WeakMap()), R.get(e) || Ne(e);
370
+ }
371
+ function De(e, t, n) {
372
+ if (typeof e != "string")
373
+ throw new TypeError(`"as.${t}" must be a string`);
374
+ return new URL(e);
375
+ }
376
+ function re(e, t, n) {
377
+ return De(e[t], t);
378
+ }
379
+ function J(e) {
380
+ const t = e;
381
+ return typeof t != "object" || Array.isArray(t) || t === null ? !1 : t.error !== void 0;
382
+ }
383
+ async function He(e, t, n, r, a, i) {
384
+ if (!h(e))
385
+ throw new TypeError('"accessToken" must be a non-empty string');
386
+ if (!(n instanceof URL))
387
+ throw new TypeError('"url" must be an instance of URL');
388
+ return r = x(r), (i == null ? void 0 : i.DPoP) === void 0 ? r.set("authorization", `Bearer ${e}`) : (await Ke(r, i.DPoP, n, "GET", U({ [P]: i == null ? void 0 : i[P] }), e), r.set("authorization", `DPoP ${e}`)), ((i == null ? void 0 : i[K]) || fetch)(n.href, {
389
+ body: a,
390
+ headers: Object.fromEntries(r.entries()),
391
+ method: t,
392
+ redirect: "manual",
393
+ signal: i != null && i.signal ? W(i.signal) : null
394
+ }).then(N);
395
+ }
396
+ async function $e(e, t, n, r) {
397
+ T(e), A(t);
398
+ const a = re(e, "userinfo_endpoint"), i = x(r == null ? void 0 : r.headers);
399
+ return t.userinfo_signed_response_alg ? i.set("accept", "application/jwt") : (i.set("accept", "application/json"), i.append("accept", "application/jwt")), He(n, "GET", a, i, null, {
400
+ ...r,
401
+ [P]: U(t)
402
+ });
403
+ }
404
+ async function Ie(e, t, n, r, a, i, s) {
405
+ return await Oe(e, t, a, i, s == null ? void 0 : s.clientPrivateKey), i.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((s == null ? void 0 : s[K]) || fetch)(r.href, {
406
+ body: a,
407
+ headers: Object.fromEntries(i.entries()),
408
+ method: n,
409
+ redirect: "manual",
410
+ signal: s != null && s.signal ? W(s.signal) : null
411
+ }).then(N);
412
+ }
413
+ async function ie(e, t, n, r, a) {
414
+ const i = re(e, "token_endpoint");
415
+ r.set("grant_type", n);
416
+ const s = x(a == null ? void 0 : a.headers);
417
+ return s.set("accept", "application/json"), Ie(e, t, "POST", i, r, s, a);
418
+ }
419
+ async function Me(e, t, n, r) {
420
+ if (T(e), A(t), !h(n))
421
+ throw new TypeError('"refreshToken" must be a non-empty string');
422
+ const a = new URLSearchParams(r == null ? void 0 : r.additionalParameters);
423
+ return a.set("refresh_token", n), ie(e, t, "refresh_token", a, r);
424
+ }
425
+ const Be = /* @__PURE__ */ new WeakMap();
426
+ async function se(e, t, n, r = !1, a = !1) {
427
+ if (T(e), A(t), !O(n, Response))
428
+ throw new TypeError('"response" must be an instance of Response');
429
+ if (n.status !== 200) {
430
+ let s;
431
+ if (s = await et(n))
432
+ return s;
433
+ throw new o('"response" is not a conform Token Endpoint response');
434
+ }
435
+ H(n);
436
+ let i;
437
+ try {
438
+ i = await n.json();
439
+ } catch (s) {
440
+ throw new o('failed to parse "response" body as JSON', { cause: s });
441
+ }
442
+ if (!E(i))
443
+ throw new o('"response" body must be a top level object');
444
+ if (!h(i.access_token))
445
+ throw new o('"response" body "access_token" property must be a non-empty string');
446
+ if (!h(i.token_type))
447
+ throw new o('"response" body "token_type" property must be a non-empty string');
448
+ if (i.token_type = i.token_type.toLowerCase(), i.token_type !== "dpop" && i.token_type !== "bearer")
449
+ throw new f("unsupported `token_type` value");
450
+ if (i.expires_in !== void 0 && (typeof i.expires_in != "number" || i.expires_in <= 0))
451
+ throw new o('"response" body "expires_in" property must be a positive number');
452
+ if (!a && i.refresh_token !== void 0 && !h(i.refresh_token))
453
+ throw new o('"response" body "refresh_token" property must be a non-empty string');
454
+ if (i.scope !== void 0 && typeof i.scope != "string")
455
+ throw new o('"response" body "scope" property must be a string');
456
+ if (!r) {
457
+ if (i.id_token !== void 0 && !h(i.id_token))
458
+ throw new o('"response" body "id_token" property must be a non-empty string');
459
+ if (i.id_token) {
460
+ const { claims: s } = await nt(i.id_token, rt.bind(void 0, t.id_token_signed_response_alg, e.id_token_signing_alg_values_supported), ce, U(t), ze(t)).then(Qe.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(Ve.bind(void 0, e.issuer)).then(qe.bind(void 0, t.client_id));
461
+ if (Array.isArray(s.aud) && s.aud.length !== 1 && s.azp !== t.client_id)
462
+ throw new o('unexpected ID Token "azp" (authorized party) claim value');
463
+ if (s.auth_time !== void 0 && (!Number.isFinite(s.auth_time) || Math.sign(s.auth_time) !== 1))
464
+ throw new o('ID Token "auth_time" (authentication time) must be a positive number');
465
+ Be.set(i, s);
466
+ }
467
+ }
468
+ return i;
469
+ }
470
+ async function Fe(e, t, n) {
471
+ return se(e, t, n);
472
+ }
473
+ function qe(e, t) {
474
+ if (Array.isArray(t.claims.aud)) {
475
+ if (!t.claims.aud.includes(e))
476
+ throw new o('unexpected JWT "aud" (audience) claim value');
477
+ } else if (t.claims.aud !== e)
478
+ throw new o('unexpected JWT "aud" (audience) claim value');
479
+ return t;
480
+ }
481
+ function Ve(e, t) {
482
+ if (t.claims.iss !== e)
483
+ throw new o('unexpected JWT "iss" (issuer) claim value');
484
+ return t;
485
+ }
486
+ const ae = /* @__PURE__ */ new WeakSet();
487
+ function Ge(e) {
488
+ return ae.add(e), e;
489
+ }
490
+ async function Ye(e, t, n, r, a, i) {
491
+ if (T(e), A(t), !ae.has(n))
492
+ throw new TypeError('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()');
493
+ if (!h(r))
494
+ throw new TypeError('"redirectUri" must be a non-empty string');
495
+ if (!h(a))
496
+ throw new TypeError('"codeVerifier" must be a non-empty string');
497
+ const s = m(n, "code");
498
+ if (!s)
499
+ throw new o('no authorization code in "callbackParameters"');
500
+ const c = new URLSearchParams(i == null ? void 0 : i.additionalParameters);
501
+ return c.set("redirect_uri", r), c.set("code_verifier", a), c.set("code", s), ie(e, t, "authorization_code", c, i);
502
+ }
503
+ const Ze = {
504
+ aud: "audience",
505
+ c_hash: "code hash",
506
+ client_id: "client id",
507
+ exp: "expiration time",
508
+ iat: "issued at",
509
+ iss: "issuer",
510
+ jti: "jwt id",
511
+ nonce: "nonce",
512
+ s_hash: "state hash",
513
+ sub: "subject",
514
+ ath: "access token hash",
515
+ htm: "http method",
516
+ htu: "http uri",
517
+ cnf: "confirmation"
518
+ };
519
+ function Qe(e, t) {
520
+ for (const n of e)
521
+ if (t.claims[n] === void 0)
522
+ throw new o(`JWT "${n}" (${Ze[n]}) claim missing`);
523
+ return t;
524
+ }
525
+ async function Xe(e, t, n) {
526
+ const r = await se(e, t, n, !0);
527
+ if (J(r))
528
+ return r;
529
+ if (r.id_token !== void 0) {
530
+ if (typeof r.id_token == "string" && r.id_token.length)
531
+ throw new o("Unexpected ID Token returned, use processAuthorizationCodeOpenIDResponse() for OpenID Connect callback processing");
532
+ delete r.id_token;
533
+ }
534
+ return r;
535
+ }
536
+ function H(e) {
537
+ if (e.bodyUsed)
538
+ throw new TypeError('"response" body has been used already');
539
+ }
540
+ async function et(e) {
541
+ if (e.status > 399 && e.status < 500) {
542
+ H(e);
543
+ try {
544
+ const t = await e.json();
545
+ if (E(t) && typeof t.error == "string" && t.error.length)
546
+ return t.error_description !== void 0 && typeof t.error_description != "string" && delete t.error_description, t.error_uri !== void 0 && typeof t.error_uri != "string" && delete t.error_uri, t.algs !== void 0 && typeof t.algs != "string" && delete t.algs, t.scope !== void 0 && typeof t.scope != "string" && delete t.scope, t;
547
+ } catch {
548
+ }
549
+ }
550
+ }
551
+ function G(e) {
552
+ if (typeof e.modulusLength != "number" || e.modulusLength < 2048)
553
+ throw new o(`${e.name} modulusLength must be at least 2048 bits`);
554
+ }
555
+ function tt(e) {
556
+ switch (e) {
557
+ case "P-256":
558
+ return "SHA-256";
559
+ case "P-384":
560
+ return "SHA-384";
561
+ case "P-521":
562
+ return "SHA-512";
563
+ default:
564
+ throw new f();
565
+ }
566
+ }
567
+ function oe(e) {
568
+ switch (e.algorithm.name) {
569
+ case "ECDSA":
570
+ return {
571
+ name: e.algorithm.name,
572
+ hash: tt(e.algorithm.namedCurve)
573
+ };
574
+ case "RSA-PSS":
575
+ switch (G(e.algorithm), e.algorithm.hash.name) {
576
+ case "SHA-256":
577
+ case "SHA-384":
578
+ case "SHA-512":
579
+ return {
580
+ name: e.algorithm.name,
581
+ saltLength: parseInt(e.algorithm.hash.name.slice(-3), 10) >> 3
582
+ };
583
+ default:
584
+ throw new f();
585
+ }
586
+ case "RSASSA-PKCS1-v1_5":
587
+ return G(e.algorithm), e.algorithm.name;
588
+ case "Ed448":
589
+ case "Ed25519":
590
+ return e.algorithm.name;
591
+ }
592
+ throw new f();
593
+ }
594
+ const ce = Symbol();
595
+ async function nt(e, t, n, r, a) {
596
+ const { 0: i, 1: s, 2: c, length: d } = e.split(".");
597
+ if (d === 5)
598
+ throw new f("JWE structure JWTs are not supported");
599
+ if (d !== 3)
600
+ throw new o("Invalid JWT");
601
+ let l;
602
+ try {
603
+ l = JSON.parse(_(y(i)));
604
+ } catch (k) {
605
+ throw new o("failed to parse JWT Header body as base64url encoded JSON", { cause: k });
606
+ }
607
+ if (!E(l))
608
+ throw new o("JWT Header must be a top level object");
609
+ if (t(l), l.crit !== void 0)
610
+ throw new o('unexpected JWT "crit" header parameter');
611
+ const S = y(c);
612
+ let p;
613
+ if (n !== ce) {
614
+ p = await n(l);
615
+ const k = `${i}.${s}`;
616
+ if (!await crypto.subtle.verify(oe(p), p, S, _(k)))
617
+ throw new o("JWT signature verification failed");
618
+ }
619
+ let u;
620
+ try {
621
+ u = JSON.parse(_(y(s)));
622
+ } catch (k) {
623
+ throw new o("failed to parse JWT Payload body as base64url encoded JSON", { cause: k });
624
+ }
625
+ if (!E(u))
626
+ throw new o("JWT Payload must be a top level object");
627
+ const $ = D() + r;
628
+ if (u.exp !== void 0) {
629
+ if (typeof u.exp != "number")
630
+ throw new o('unexpected JWT "exp" (expiration time) claim type');
631
+ if (u.exp <= $ - a)
632
+ throw new o('unexpected JWT "exp" (expiration time) claim value, timestamp is <= now()');
633
+ }
634
+ if (u.iat !== void 0 && typeof u.iat != "number")
635
+ throw new o('unexpected JWT "iat" (issued at) claim type');
636
+ if (u.iss !== void 0 && typeof u.iss != "string")
637
+ throw new o('unexpected JWT "iss" (issuer) claim type');
638
+ if (u.nbf !== void 0) {
639
+ if (typeof u.nbf != "number")
640
+ throw new o('unexpected JWT "nbf" (not before) claim type');
641
+ if (u.nbf > $ + a)
642
+ throw new o('unexpected JWT "nbf" (not before) claim value, timestamp is > now()');
643
+ }
644
+ if (u.aud !== void 0 && typeof u.aud != "string" && !Array.isArray(u.aud))
645
+ throw new o('unexpected JWT "aud" (audience) claim type');
646
+ return { header: l, claims: u, signature: S, key: p };
647
+ }
648
+ function rt(e, t, n) {
649
+ if (e !== void 0) {
650
+ if (n.alg !== e)
651
+ throw new o('unexpected JWT "alg" header parameter');
652
+ return;
653
+ }
654
+ if (Array.isArray(t)) {
655
+ if (!t.includes(n.alg))
656
+ throw new o('unexpected JWT "alg" header parameter');
657
+ return;
658
+ }
659
+ if (n.alg !== "RS256")
660
+ throw new o('unexpected JWT "alg" header parameter');
661
+ }
662
+ function m(e, t) {
663
+ const { 0: n, length: r } = e.getAll(t);
664
+ if (r > 1)
665
+ throw new o(`"${t}" parameter must be provided only once`);
666
+ return n;
667
+ }
668
+ const it = Symbol(), st = Symbol();
669
+ function at(e, t, n, r) {
670
+ if (T(e), A(t), n instanceof URL && (n = n.searchParams), !(n instanceof URLSearchParams))
671
+ throw new TypeError('"parameters" must be an instance of URLSearchParams, or URL');
672
+ if (m(n, "response"))
673
+ throw new o('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()');
674
+ const a = m(n, "iss"), i = m(n, "state");
675
+ if (!a && e.authorization_response_iss_parameter_supported)
676
+ throw new o('response parameter "iss" (issuer) missing');
677
+ if (a && a !== e.issuer)
678
+ throw new o('unexpected "iss" (issuer) response parameter value');
679
+ switch (r) {
680
+ case void 0:
681
+ case st:
682
+ if (i !== void 0)
683
+ throw new o('unexpected "state" response parameter encountered');
684
+ break;
685
+ case it:
686
+ break;
687
+ default:
688
+ if (!h(r))
689
+ throw new o('"expectedState" must be a non-empty string');
690
+ if (i === void 0)
691
+ throw new o('response parameter "state" missing');
692
+ if (i !== r)
693
+ throw new o('unexpected "state" response parameter value');
694
+ }
695
+ const s = m(n, "error");
696
+ if (s)
697
+ return {
698
+ error: s,
699
+ error_description: m(n, "error_description"),
700
+ error_uri: m(n, "error_uri")
701
+ };
702
+ const c = m(n, "id_token"), d = m(n, "token");
703
+ if (c !== void 0 || d !== void 0)
704
+ throw new f("implicit and hybrid flows are not supported");
705
+ return Ge(new URLSearchParams(n));
706
+ }
707
+ class b extends Error {
708
+ }
709
+ class L extends b {
710
+ constructor(t, n, r) {
711
+ super(t, r), this.error = n;
712
+ }
713
+ }
714
+ function ot({
715
+ handleCallback: e
716
+ }) {
717
+ const t = fe(!1), [n, r] = le(void 0), a = de();
718
+ return pe(() => {
719
+ t.current || (t.current = !0, e().then(() => {
720
+ a("/");
721
+ }).catch((i) => {
722
+ r(i);
723
+ }));
724
+ }, []), n ? n instanceof L ? /* @__PURE__ */ g.jsxs("div", { children: [
725
+ /* @__PURE__ */ g.jsx("h2", { children: "Error" }),
726
+ /* @__PURE__ */ g.jsxs("pre", { children: [
727
+ n.error.error,
728
+ n.error.error_description,
729
+ n.error.error_uri
730
+ ] })
731
+ ] }) : /* @__PURE__ */ g.jsxs("div", { children: [
732
+ /* @__PURE__ */ g.jsx("h2", { children: "Error" }),
733
+ /* @__PURE__ */ g.jsxs("pre", { children: [
734
+ n.message,
735
+ n.stack
736
+ ] })
737
+ ] }) : /* @__PURE__ */ g.jsx("div", { children: "Loading..." });
738
+ }
739
+ const Y = "code-verifier";
740
+ class ct {
741
+ constructor({
742
+ issuer: t,
743
+ authorizationEndpoint: n,
744
+ tokenEndpoint: r,
745
+ clientId: a
746
+ }) {
747
+ w(this, "client");
748
+ w(this, "issuer");
749
+ w(this, "authorizationEndpoint");
750
+ w(this, "tokenEndpoint");
751
+ w(this, "authorizationServer");
752
+ w(this, "tokens");
753
+ w(this, "callbackUrlPath", "/oauth/callback");
754
+ w(this, "logoutRedirectUrlPath", "/");
755
+ w(this, "handleCallback", async () => {
756
+ const t = new URL(window.location.href), n = t.searchParams.get("state"), r = localStorage.getItem(Y);
757
+ if (!r)
758
+ throw new b(
759
+ "Code verifier not found. Invalid auth state."
760
+ );
761
+ const a = await this.getAuthServer(), i = at(
762
+ a,
763
+ this.client,
764
+ t.searchParams,
765
+ n ?? void 0
766
+ );
767
+ if (J(i))
768
+ throw I.error("Error validating OAuth response", i), new L(
769
+ "Error validating OAuth response",
770
+ i
771
+ );
772
+ const s = new URL(t);
773
+ s.pathname = this.callbackUrlPath, s.search = "";
774
+ const c = await Ye(
775
+ a,
776
+ this.client,
777
+ i,
778
+ s.toString(),
779
+ r
780
+ ), d = await Xe(
781
+ a,
782
+ this.client,
783
+ c
784
+ );
785
+ this.setTokensFromResponse(d);
786
+ const l = await this.getAccessToken(), p = await (await $e(
787
+ a,
788
+ this.client,
789
+ l
790
+ )).json(), u = {
791
+ sub: p.sub,
792
+ email: p.email,
793
+ name: p.name,
794
+ emailVerified: p.email_verified ?? !1,
795
+ pictureUrl: p.picture
796
+ };
797
+ M.setState({
798
+ isAuthenticated: !0,
799
+ isPending: !1,
800
+ profile: u
801
+ });
802
+ });
803
+ this.client = {
804
+ client_id: a,
805
+ token_endpoint_auth_method: "none"
806
+ }, this.issuer = t, this.authorizationEndpoint = n, this.tokenEndpoint = r;
807
+ }
808
+ async getAuthServer() {
809
+ if (!this.authorizationServer)
810
+ if (this.tokenEndpoint && this.authorizationEndpoint)
811
+ this.authorizationServer = {
812
+ issuer: new URL(this.authorizationEndpoint).origin,
813
+ authorization_endpoint: this.authorizationEndpoint,
814
+ token_endpoint: this.tokenEndpoint,
815
+ code_challenge_methods_supported: []
816
+ };
817
+ else {
818
+ const t = new URL(this.issuer), n = await Ee(t);
819
+ this.authorizationServer = await Te(
820
+ t,
821
+ n
822
+ );
823
+ }
824
+ return this.authorizationServer;
825
+ }
826
+ /**
827
+ * Sets the tokens from various OAuth responses
828
+ * @param response
829
+ */
830
+ setTokensFromResponse(t) {
831
+ if (J(t))
832
+ throw I.error("Bad Token Response", t), new L("Bad Token Response", t);
833
+ if (!t.expires_in)
834
+ throw new b("No expires_in in response");
835
+ this.tokens = {
836
+ accessToken: t.access_token,
837
+ refreshToken: t.refresh_token,
838
+ expiresOn: new Date(Date.now() + t.expires_in * 1e3),
839
+ tokenType: t.token_type
840
+ };
841
+ }
842
+ async initialize() {
843
+ }
844
+ async login() {
845
+ var c;
846
+ const t = "S256", n = await this.getAuthServer();
847
+ if (!n.authorization_endpoint)
848
+ throw new b("No authorization endpoint");
849
+ const r = Ae(), a = await Re(r);
850
+ localStorage.setItem(Y, r);
851
+ const i = new URL(
852
+ n.authorization_endpoint
853
+ ), s = new URL(window.location.href);
854
+ if (s.pathname = this.callbackUrlPath, s.search = "", i.searchParams.set("client_id", this.client.client_id), i.searchParams.set("redirect_uri", s.toString()), i.searchParams.set("response_type", "code"), i.searchParams.set("scope", "openid+profile+email"), i.searchParams.set("code_challenge", a), i.searchParams.set(
855
+ "code_challenge_method",
856
+ t
857
+ ), ((c = n.code_challenge_methods_supported) == null ? void 0 : c.includes("S256")) !== !0) {
858
+ const d = ve();
859
+ i.searchParams.set("state", d);
860
+ }
861
+ location.href = i.href;
862
+ }
863
+ async getAccessToken() {
864
+ const t = await this.getAuthServer();
865
+ if (!this.tokens)
866
+ throw new b("User is not authenticated");
867
+ if (this.tokens.expiresOn < /* @__PURE__ */ new Date()) {
868
+ if (!this.tokens.refreshToken)
869
+ throw new b(
870
+ "Token expired and no refresh token available"
871
+ );
872
+ const n = await Me(
873
+ t,
874
+ this.client,
875
+ this.tokens.refreshToken
876
+ ), r = await Fe(
877
+ t,
878
+ this.client,
879
+ n
880
+ );
881
+ this.setTokensFromResponse(r);
882
+ }
883
+ return this.tokens.accessToken;
884
+ }
885
+ async logout() {
886
+ M.setState({
887
+ isAuthenticated: !1,
888
+ isPending: !1,
889
+ profile: void 0
890
+ });
891
+ const t = await this.getAuthServer(), n = new URL(window.location.href);
892
+ n.pathname = this.logoutRedirectUrlPath;
893
+ let r;
894
+ t.end_session_endpoint ? (r = new URL(t.end_session_endpoint), r.searchParams.set(
895
+ "post_logout_redirect_uri",
896
+ n.toString()
897
+ )) : r = n;
898
+ }
899
+ getRoutes() {
900
+ return [
901
+ {
902
+ path: this.callbackUrlPath,
903
+ element: /* @__PURE__ */ g.jsx(ot, { handleCallback: this.handleCallback })
904
+ }
905
+ ];
906
+ }
907
+ }
908
+ const wt = (e) => new ct(e);
909
+ export {
910
+ ct as OpenIDAuthenticationProvider,
911
+ wt as default
912
+ };