zudoku 0.43.0 → 0.43.1

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 (180) hide show
  1. package/dist/config/validators/common.d.ts +193 -0
  2. package/dist/config/validators/common.js +2 -0
  3. package/dist/config/validators/common.js.map +1 -1
  4. package/dist/config/validators/validate.d.ts +70 -0
  5. package/dist/lib/components/Banner.js +1 -1
  6. package/dist/lib/components/Banner.js.map +1 -1
  7. package/dist/lib/components/Heading.d.ts +2 -2
  8. package/dist/lib/components/Heading.js +1 -1
  9. package/dist/lib/components/Heading.js.map +1 -1
  10. package/dist/lib/components/Layout.js +1 -1
  11. package/dist/lib/components/Layout.js.map +1 -1
  12. package/dist/lib/components/Main.js +3 -2
  13. package/dist/lib/components/Main.js.map +1 -1
  14. package/dist/lib/components/MobileTopNavigation.js +1 -1
  15. package/dist/lib/components/MobileTopNavigation.js.map +1 -1
  16. package/dist/lib/components/Pagination.js +2 -2
  17. package/dist/lib/components/Pagination.js.map +1 -1
  18. package/dist/lib/components/Search.js +1 -1
  19. package/dist/lib/components/Search.js.map +1 -1
  20. package/dist/lib/components/TopNavigation.js +1 -1
  21. package/dist/lib/components/TopNavigation.js.map +1 -1
  22. package/dist/lib/components/navigation/PoweredByZudoku.js +1 -1
  23. package/dist/lib/components/navigation/PoweredByZudoku.js.map +1 -1
  24. package/dist/lib/components/navigation/Sidebar.js +1 -1
  25. package/dist/lib/components/navigation/Sidebar.js.map +1 -1
  26. package/dist/lib/components/navigation/SidebarCategory.js +9 -5
  27. package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
  28. package/dist/lib/components/navigation/SidebarItem.js +2 -3
  29. package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
  30. package/dist/lib/components/navigation/Toc.js +2 -2
  31. package/dist/lib/components/navigation/Toc.js.map +1 -1
  32. package/dist/lib/core/ZudokuContext.d.ts +2 -1
  33. package/dist/lib/core/ZudokuContext.js.map +1 -1
  34. package/dist/lib/oas/parser/upgrade/index.d.ts +1 -0
  35. package/dist/lib/oas/parser/upgrade/index.js +76 -24
  36. package/dist/lib/oas/parser/upgrade/index.js.map +1 -1
  37. package/dist/lib/plugins/openapi/CollapsibleCode.js +1 -1
  38. package/dist/lib/plugins/openapi/OperationList.js +1 -1
  39. package/dist/lib/plugins/openapi/OperationListItem.js +4 -2
  40. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  41. package/dist/lib/plugins/openapi/SchemaList.js +1 -1
  42. package/dist/lib/plugins/openapi/client/useCreateQuery.d.ts +5 -0
  43. package/dist/lib/plugins/openapi/client/useCreateQuery.js +10 -4
  44. package/dist/lib/plugins/openapi/client/useCreateQuery.js.map +1 -1
  45. package/dist/lib/plugins/openapi/index.d.ts +3 -4
  46. package/dist/lib/plugins/openapi/index.js +6 -4
  47. package/dist/lib/plugins/openapi/index.js.map +1 -1
  48. package/dist/lib/plugins/openapi/interfaces.d.ts +4 -3
  49. package/dist/lib/plugins/openapi/playground/IdentitySelector.js +1 -1
  50. package/dist/lib/plugins/openapi/playground/Playground.js +2 -2
  51. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
  52. package/dist/lib/plugins/openapi/playground/QueryParams.d.ts +1 -1
  53. package/dist/lib/plugins/openapi/playground/QueryParams.js +1 -1
  54. package/dist/lib/plugins/openapi/playground/SubmitButton.d.ts +1 -1
  55. package/dist/lib/plugins/openapi/playground/SubmitButton.js +1 -1
  56. package/dist/lib/plugins/openapi/playground/result-panel/RequestTab.js +1 -1
  57. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js +1 -1
  58. package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js +1 -1
  59. package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js +2 -2
  60. package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js.map +1 -1
  61. package/dist/lib/plugins/openapi/util/getRoutes.js +33 -3
  62. package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
  63. package/dist/lib/ui/SyntaxHighlight.js +1 -1
  64. package/dist/lib/ui/SyntaxHighlight.js.map +1 -1
  65. package/dist/lib/util/traverse.d.ts +1 -1
  66. package/dist/lib/util/traverse.js +6 -5
  67. package/dist/lib/util/traverse.js.map +1 -1
  68. package/dist/vite/build.js +1 -0
  69. package/dist/vite/build.js.map +1 -1
  70. package/dist/vite/dev-server.js +5 -2
  71. package/dist/vite/dev-server.js.map +1 -1
  72. package/dist/vite/html.d.ts +6 -2
  73. package/dist/vite/html.js +11 -8
  74. package/dist/vite/html.js.map +1 -1
  75. package/dist/vite/plugin-api.js +2 -2
  76. package/dist/vite/plugin-api.js.map +1 -1
  77. package/lib/{AuthenticationPlugin-ByDF051g.js → AuthenticationPlugin-BxoEZCSJ.js} +4 -4
  78. package/lib/{AuthenticationPlugin-ByDF051g.js.map → AuthenticationPlugin-BxoEZCSJ.js.map} +1 -1
  79. package/lib/{Markdown-mFpg_n9p.js → Markdown-DvdVn1O7.js} +1839 -1836
  80. package/lib/Markdown-DvdVn1O7.js.map +1 -0
  81. package/lib/{MdxPage-Cm7atiW3.js → MdxPage-DUcuusMU.js} +7 -7
  82. package/lib/{MdxPage-Cm7atiW3.js.map → MdxPage-DUcuusMU.js.map} +1 -1
  83. package/lib/{OasProvider-DOs0v9u7.js → OasProvider-CjMm8pB7.js} +8 -9
  84. package/lib/{OasProvider-DOs0v9u7.js.map → OasProvider-CjMm8pB7.js.map} +1 -1
  85. package/lib/{OperationList-CKac6iap.js → OperationList-BhJcPgGi.js} +1269 -1261
  86. package/lib/{OperationList-CKac6iap.js.map → OperationList-BhJcPgGi.js.map} +1 -1
  87. package/lib/Pagination-BgQxwq5j.js +48 -0
  88. package/lib/Pagination-BgQxwq5j.js.map +1 -0
  89. package/lib/{RouteGuard-DRtEu9nh.js → RouteGuard-D2gX29iI.js} +3 -3
  90. package/lib/{RouteGuard-DRtEu9nh.js.map → RouteGuard-D2gX29iI.js.map} +1 -1
  91. package/lib/{SchemaList-BTX2mRMW.js → SchemaList-BexhT_Z0.js} +22 -23
  92. package/lib/{SchemaList-BTX2mRMW.js.map → SchemaList-BexhT_Z0.js.map} +1 -1
  93. package/lib/{SchemaView-BYRn_-2l.js → SchemaView-Dt_-u8rW.js} +123 -146
  94. package/lib/SchemaView-Dt_-u8rW.js.map +1 -0
  95. package/lib/{Select-CT64Ou40.js → Select-CYaEBIYK.js} +3 -3
  96. package/lib/{Select-CT64Ou40.js.map → Select-CYaEBIYK.js.map} +1 -1
  97. package/lib/{SlotletProvider-CS_nO-XT.js → SlotletProvider-wWbHYqWf.js} +7 -7
  98. package/lib/SlotletProvider-wWbHYqWf.js.map +1 -0
  99. package/lib/{SyntaxHighlight-CxhyyMkF.js → SyntaxHighlight-o7q0acut.js} +81 -81
  100. package/lib/{SyntaxHighlight-CxhyyMkF.js.map → SyntaxHighlight-o7q0acut.js.map} +1 -1
  101. package/lib/{Toc-D_tV8_Ri.js → Toc-BnN4zBb3.js} +17 -17
  102. package/lib/Toc-BnN4zBb3.js.map +1 -0
  103. package/lib/{chunk-BAXFHI7N-BVBOl9s0.js → chunk-BAXFHI7N-BLTsN6tl.js} +679 -659
  104. package/lib/{chunk-BAXFHI7N-BVBOl9s0.js.map → chunk-BAXFHI7N-BLTsN6tl.js.map} +1 -1
  105. package/lib/{circular-ByJI6Mci.js → circular-BWEIet3w.js} +4616 -5567
  106. package/lib/circular-BWEIet3w.js.map +1 -0
  107. package/lib/{createServer-IW7v5hWm.js → createServer-BQD3Eeqb.js} +1998 -1970
  108. package/lib/createServer-BQD3Eeqb.js.map +1 -0
  109. package/lib/{hook-CldJlP5c.js → hook-8GM2HXNM.js} +24 -24
  110. package/lib/{hook-CldJlP5c.js.map → hook-8GM2HXNM.js.map} +1 -1
  111. package/lib/index-CFf9AN-y.js +3208 -0
  112. package/lib/index-CFf9AN-y.js.map +1 -0
  113. package/lib/{index-DnQftvP4.js → index-DGNSSXgR.js} +77 -69
  114. package/lib/{index-DnQftvP4.js.map → index-DGNSSXgR.js.map} +1 -1
  115. package/lib/{mutation-DBQh7AOZ.js → mutation-Bq5bn7Hf.js} +2 -2
  116. package/lib/{mutation-DBQh7AOZ.js.map → mutation-Bq5bn7Hf.js.map} +1 -1
  117. package/lib/processors/traverse.js +9 -7
  118. package/lib/processors/traverse.js.map +1 -1
  119. package/lib/ui/SyntaxHighlight.js +1 -1
  120. package/lib/{useExposedProps-DbIZXspi.js → useExposedProps-DmTJxEXG.js} +2 -2
  121. package/lib/{useExposedProps-DbIZXspi.js.map → useExposedProps-DmTJxEXG.js.map} +1 -1
  122. package/lib/zudoku.auth-auth0.js +1 -1
  123. package/lib/zudoku.auth-clerk.js +2 -2
  124. package/lib/zudoku.auth-openid.js +3 -3
  125. package/lib/zudoku.components.js +6 -6
  126. package/lib/zudoku.hooks.js +1 -1
  127. package/lib/zudoku.plugin-api-catalog.js +5 -5
  128. package/lib/zudoku.plugin-api-keys.js +4 -4
  129. package/lib/zudoku.plugin-custom-pages.js +2 -2
  130. package/lib/zudoku.plugin-markdown.js +1 -1
  131. package/lib/zudoku.plugin-openapi.js +6 -5
  132. package/lib/zudoku.plugin-redirect.js +1 -1
  133. package/lib/zudoku.plugin-search-pagefind.js +3 -3
  134. package/package.json +3 -3
  135. package/src/app/main.css +2 -2
  136. package/src/lib/components/Banner.tsx +1 -1
  137. package/src/lib/components/Heading.tsx +3 -3
  138. package/src/lib/components/Layout.tsx +1 -4
  139. package/src/lib/components/Main.tsx +4 -3
  140. package/src/lib/components/MobileTopNavigation.tsx +2 -2
  141. package/src/lib/components/Pagination.tsx +3 -3
  142. package/src/lib/components/Search.tsx +1 -1
  143. package/src/lib/components/TopNavigation.tsx +1 -1
  144. package/src/lib/components/navigation/PoweredByZudoku.tsx +6 -1
  145. package/src/lib/components/navigation/Sidebar.tsx +1 -1
  146. package/src/lib/components/navigation/SidebarCategory.tsx +9 -5
  147. package/src/lib/components/navigation/SidebarItem.tsx +2 -3
  148. package/src/lib/components/navigation/Toc.tsx +4 -4
  149. package/src/lib/core/ZudokuContext.ts +2 -1
  150. package/src/lib/oas/parser/upgrade/index.ts +97 -27
  151. package/src/lib/plugins/openapi/CollapsibleCode.tsx +2 -2
  152. package/src/lib/plugins/openapi/OperationList.tsx +1 -1
  153. package/src/lib/plugins/openapi/OperationListItem.tsx +15 -6
  154. package/src/lib/plugins/openapi/SchemaList.tsx +1 -1
  155. package/src/lib/plugins/openapi/client/useCreateQuery.ts +23 -4
  156. package/src/lib/plugins/openapi/index.tsx +8 -7
  157. package/src/lib/plugins/openapi/interfaces.ts +4 -3
  158. package/src/lib/plugins/openapi/playground/IdentitySelector.tsx +2 -2
  159. package/src/lib/plugins/openapi/playground/Playground.tsx +5 -5
  160. package/src/lib/plugins/openapi/playground/QueryParams.tsx +2 -2
  161. package/src/lib/plugins/openapi/playground/SubmitButton.tsx +2 -2
  162. package/src/lib/plugins/openapi/playground/result-panel/RequestTab.tsx +2 -2
  163. package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +1 -1
  164. package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +1 -1
  165. package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +2 -2
  166. package/src/lib/plugins/openapi/util/getRoutes.tsx +67 -3
  167. package/src/lib/ui/SyntaxHighlight.tsx +2 -2
  168. package/src/lib/util/traverse.ts +8 -5
  169. package/lib/Markdown-mFpg_n9p.js.map +0 -1
  170. package/lib/Pagination-DLPL5z77.js +0 -48
  171. package/lib/Pagination-DLPL5z77.js.map +0 -1
  172. package/lib/SchemaView-BYRn_-2l.js.map +0 -1
  173. package/lib/SlotletProvider-CS_nO-XT.js.map +0 -1
  174. package/lib/Toc-D_tV8_Ri.js.map +0 -1
  175. package/lib/circular-ByJI6Mci.js.map +0 -1
  176. package/lib/context-Lrf2Y9bR.js +0 -22
  177. package/lib/context-Lrf2Y9bR.js.map +0 -1
  178. package/lib/createServer-IW7v5hWm.js.map +0 -1
  179. package/lib/index-DuB48L78.js +0 -2184
  180. package/lib/index-DuB48L78.js.map +0 -1
@@ -1,2184 +0,0 @@
1
- var Ft = Object.defineProperty;
2
- var tt = (t) => {
3
- throw TypeError(t);
4
- };
5
- var zt = (t, n, s) => n in t ? Ft(t, n, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[n] = s;
6
- var J = (t, n, s) => zt(t, typeof n != "symbol" ? n + "" : n, s), Mt = (t, n, s) => n.has(t) || tt("Cannot " + s);
7
- var pe = (t, n, s) => (Mt(t, n, "read from private field"), s ? s.call(t) : n.get(t)), he = (t, n, s) => n.has(t) ? tt("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(t) : n.set(t, s);
8
- import { j as e } from "./jsx-runtime-C5mzlN2N.js";
9
- import { ChevronRightIcon as Q, CheckIcon as Ht, DotIcon as _t, Check as Bt, XIcon as Gt, Circle as Jt, ChevronDownIcon as Ut, InfoIcon as nt, LogInIcon as Qt, CirclePlayIcon as Wt } from "lucide-react";
10
- import { r as Zt, m as st } from "./chunk-BAXFHI7N-BVBOl9s0.js";
11
- import { p as xt, q as gt, r as Xt, m as Kt, t as Yt, f as R, l as en } from "./hook-CldJlP5c.js";
12
- import { Button as W } from "./ui/Button.js";
13
- import { Z as tn } from "./invariant-Caa8-XvF.js";
14
- import { VisuallyHidden as nn } from "@radix-ui/react-visually-hidden";
15
- import * as b from "react";
16
- import { Fragment as q, useRef as G, useEffect as ne, useMemo as sn, useState as k, useCallback as an, useTransition as rn } from "react";
17
- import { D as Pe, a as ke, b as Ie, d as ft, e as yt, f as on } from "./Dialog-ByYz4ABw.js";
18
- import { S as je, a as be, b as Ne, c as we, e as U, u as ln } from "./Select-CT64Ou40.js";
19
- import { b as Re, u as Oe, C as L, a as cn, F as dn } from "./index.esm-D2ZUREQN.js";
20
- import { c as vt } from "./index-CPNSgwSb.js";
21
- import { c as g } from "./cn-qaFjX9_3.js";
22
- import { Tabs as jt, TabsList as bt, TabsTrigger as M, TabsContent as H } from "./ui/Tabs.js";
23
- import { o as mn } from "./objectEntries-yMIkr2mI.js";
24
- import { u as un } from "./useLatest-hmRS46UF.js";
25
- import { z as pn } from "./index-DwT-v3zK.js";
26
- import { B as A } from "./Button-BBNrKpQd.js";
27
- import * as j from "@radix-ui/react-dropdown-menu";
28
- import { C as le } from "./Card-BtheiD7j.js";
29
- import * as Ce from "@radix-ui/react-checkbox";
30
- import * as se from "@radix-ui/react-popover";
31
- import { PopoverAnchor as hn } from "@radix-ui/react-popover";
32
- import { P as xn } from "./index-CuBIgTKC.js";
33
- import { g as gn, h as fn, C as yn, b as vn, f as jn } from "./Callout-D3Ja4OPX.js";
34
- import { Input as qe } from "./ui/Input.js";
35
- import { Slot as bn } from "@radix-ui/react-slot";
36
- import * as Nt from "@radix-ui/react-label";
37
- import * as Z from "@radix-ui/react-radio-group";
38
- import { S as Nn } from "./Spinner-mNLZ6awP.js";
39
- import { Callout as wn } from "./ui/Callout.js";
40
- import { Card as wt, CardHeader as Cn, CardTitle as Sn, CardContent as Tn } from "./ui/Card.js";
41
- import { Collapsible as at, CollapsibleTrigger as rt, CollapsibleContent as ot } from "./ui/Collapsible.js";
42
- import * as Le from "@radix-ui/react-collapsible";
43
- import { S as $n } from "./SyntaxHighlight-CxhyyMkF.js";
44
- let xe;
45
- const Pn = (t) => {
46
- var n;
47
- if ((n = t.errors) != null && n[0])
48
- throw new tn(t.errors[0].message, {
49
- developerHint: "Check your configuration value `apis.type` and `apis.input` in the Zudoku config."
50
- });
51
- };
52
- var oe, ie;
53
- class kn {
54
- constructor(n) {
55
- he(this, oe, async () => (xe || (xe = import("./createServer-IW7v5hWm.js").then(
56
- (n) => n.createServer(this.config)
57
- )), xe));
58
- he(this, ie, async (n) => this.config.server ? fetch(this.config.server, n) : (await pe(this, oe).call(this)).fetch("http://localhost/graphql", n));
59
- J(this, "fetch", async (n, s) => {
60
- var l;
61
- const a = (l = n.match(/query (\w+)/)) == null ? void 0 : l[1], r = await pe(this, ie).call(this, {
62
- method: "POST",
63
- body: JSON.stringify({ query: n, variables: s, operationName: a }),
64
- headers: { "Content-Type": "application/json" }
65
- });
66
- if (!r.ok)
67
- throw new Error("Network response was not ok");
68
- const i = await r.json();
69
- return Pn(i), i.data;
70
- });
71
- this.config = n;
72
- }
73
- }
74
- oe = new WeakMap(), ie = new WeakMap();
75
- class D extends String {
76
- constructor(s, a) {
77
- super(s);
78
- J(this, "__apiType");
79
- J(this, "value");
80
- J(this, "__meta__");
81
- this.value = s, this.__meta__ = a;
82
- }
83
- toString() {
84
- return this.value;
85
- }
86
- }
87
- const In = new D(
88
- `
89
- fragment OperationsFragment on OperationItem {
90
- slug
91
- summary
92
- method
93
- description
94
- operationId
95
- contentTypes
96
- path
97
- deprecated
98
- extensions
99
- parameters {
100
- name
101
- in
102
- description
103
- required
104
- schema
105
- style
106
- explode
107
- examples {
108
- name
109
- description
110
- externalValue
111
- value
112
- summary
113
- }
114
- }
115
- requestBody {
116
- content {
117
- mediaType
118
- encoding {
119
- name
120
- }
121
- examples {
122
- name
123
- description
124
- externalValue
125
- value
126
- summary
127
- }
128
- schema
129
- }
130
- description
131
- required
132
- }
133
- responses {
134
- statusCode
135
- links
136
- description
137
- content {
138
- examples {
139
- name
140
- description
141
- externalValue
142
- value
143
- summary
144
- }
145
- mediaType
146
- encoding {
147
- name
148
- }
149
- schema
150
- }
151
- }
152
- }
153
- `,
154
- { fragmentName: "OperationsFragment" }
155
- ), Rn = new D(`
156
- query ServersQuery($input: JSON!, $type: SchemaType!) {
157
- schema(input: $input, type: $type) {
158
- url
159
- servers {
160
- url
161
- }
162
- }
163
- }
164
- `), On = new D(`
165
- query SchemaWarmup($input: JSON!, $type: SchemaType!) {
166
- schema(input: $input, type: $type) {
167
- openapi
168
- }
169
- }
170
- `), qn = new D(`
171
- query OperationsForTag($input: JSON!, $type: SchemaType!, $tag: String, $untagged: Boolean) {
172
- schema(input: $input, type: $type) {
173
- servers {
174
- url
175
- }
176
- description
177
- summary
178
- title
179
- url
180
- version
181
- tag(slug: $tag, untagged: $untagged) {
182
- name
183
- description
184
- operations {
185
- slug
186
- ...OperationsFragment
187
- }
188
- next {
189
- name
190
- slug
191
- }
192
- prev {
193
- name
194
- slug
195
- }
196
- }
197
- }
198
- }
199
- fragment OperationsFragment on OperationItem {
200
- slug
201
- summary
202
- method
203
- description
204
- operationId
205
- contentTypes
206
- path
207
- deprecated
208
- extensions
209
- parameters {
210
- name
211
- in
212
- description
213
- required
214
- schema
215
- style
216
- explode
217
- examples {
218
- name
219
- description
220
- externalValue
221
- value
222
- summary
223
- }
224
- }
225
- requestBody {
226
- content {
227
- mediaType
228
- encoding {
229
- name
230
- }
231
- examples {
232
- name
233
- description
234
- externalValue
235
- value
236
- summary
237
- }
238
- schema
239
- }
240
- description
241
- required
242
- }
243
- responses {
244
- statusCode
245
- links
246
- description
247
- content {
248
- examples {
249
- name
250
- description
251
- externalValue
252
- value
253
- summary
254
- }
255
- mediaType
256
- encoding {
257
- name
258
- }
259
- schema
260
- }
261
- }
262
- }`), Ln = new D(`
263
- query GetSchemas($input: JSON!, $type: SchemaType!) {
264
- schema(input: $input, type: $type) {
265
- title
266
- description
267
- summary
268
- components {
269
- schemas {
270
- name
271
- schema
272
- extensions
273
- }
274
- }
275
- }
276
- }
277
- `), An = new D(`
278
- query getServerQuery($input: JSON!, $type: SchemaType!) {
279
- schema(input: $input, type: $type) {
280
- url
281
- servers {
282
- url
283
- }
284
- }
285
- }
286
- `), En = new D(`
287
- query GetSidebarOperations($input: JSON!, $type: SchemaType!) {
288
- schema(input: $input, type: $type) {
289
- tags {
290
- slug
291
- name
292
- extensions
293
- operations {
294
- summary
295
- slug
296
- method
297
- operationId
298
- path
299
- }
300
- }
301
- components {
302
- schemas {
303
- __typename
304
- }
305
- }
306
- }
307
- }
308
- `), Dn = {
309
- "\n query ServersQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n": Rn,
310
- "\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n deprecated\n extensions\n parameters {\n name\n in\n description\n required\n schema\n style\n explode\n examples {\n name\n description\n externalValue\n value\n summary\n }\n }\n requestBody {\n content {\n mediaType\n encoding {\n name\n }\n examples {\n name\n description\n externalValue\n value\n summary\n }\n schema\n }\n description\n required\n }\n responses {\n statusCode\n links\n description\n content {\n examples {\n name\n description\n externalValue\n value\n summary\n }\n mediaType\n encoding {\n name\n }\n schema\n }\n }\n }\n": In,
311
- "\n query SchemaWarmup($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n openapi\n }\n }\n": On,
312
- "\n query OperationsForTag(\n $input: JSON!\n $type: SchemaType!\n $tag: String\n $untagged: Boolean\n ) {\n schema(input: $input, type: $type) {\n servers {\n url\n }\n description\n summary\n title\n url\n version\n tag(slug: $tag, untagged: $untagged) {\n name\n description\n operations {\n slug\n ...OperationsFragment\n }\n next {\n name\n slug\n }\n prev {\n name\n slug\n }\n }\n }\n }\n": qn,
313
- "\n query GetSchemas($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n title\n description\n summary\n components {\n schemas {\n name\n schema\n extensions\n }\n }\n }\n }\n": Ln,
314
- "\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n": An,
315
- "\n query GetSidebarOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n slug\n name\n extensions\n operations {\n summary\n slug\n method\n operationId\n path\n }\n }\n components {\n schemas {\n __typename\n }\n }\n }\n }\n": En
316
- };
317
- function Vn(t) {
318
- return Dn[t] ?? {};
319
- }
320
- const Fn = vt(
321
- "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
322
- {
323
- variants: {
324
- variant: {
325
- default: "bg-background text-foreground",
326
- destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
327
- }
328
- },
329
- defaultVariants: {
330
- variant: "default"
331
- }
332
- }
333
- ), Se = b.forwardRef(({ className: t, variant: n, ...s }, a) => /* @__PURE__ */ e.jsx(
334
- "div",
335
- {
336
- ref: a,
337
- role: "alert",
338
- className: g(Fn({ variant: n }), t),
339
- ...s
340
- }
341
- ));
342
- Se.displayName = "Alert";
343
- const Te = b.forwardRef(({ className: t, ...n }, s) => /* @__PURE__ */ e.jsx(
344
- "h5",
345
- {
346
- ref: s,
347
- className: g("mb-1 font-medium leading-none tracking-tight", t),
348
- ...n
349
- }
350
- ));
351
- Te.displayName = "AlertTitle";
352
- const $e = b.forwardRef(({ className: t, ...n }, s) => /* @__PURE__ */ e.jsx(
353
- "div",
354
- {
355
- ref: s,
356
- className: g("text-sm [&_p]:leading-relaxed", t),
357
- ...n
358
- }
359
- ));
360
- $e.displayName = "AlertDescription";
361
- const zn = ({
362
- path: t,
363
- renderParam: n
364
- }) => {
365
- let s = 0;
366
- return t.split("/").map((a, r, i) => {
367
- const l = Array.from(a.matchAll(/{([^}]+)}/g)), d = [];
368
- let c = 0;
369
- return l.forEach((u) => {
370
- const [x, w] = u;
371
- if (!w) return;
372
- const v = u.index;
373
- v > c && d.push(
374
- /* @__PURE__ */ e.jsx(q, { children: a.slice(c, v) }, `text-${c}-${v}`)
375
- ), d.push(
376
- /* @__PURE__ */ e.jsx(q, { children: n({ name: w, originalValue: x, index: s++ }) }, `param-${w}`)
377
- ), c = v + x.length;
378
- }), c < a.length && d.push(
379
- /* @__PURE__ */ e.jsx(q, { children: a.slice(c) }, `text-${c}-${a.length}`)
380
- ), // eslint-disable-next-line react/no-array-index-key
381
- /* @__PURE__ */ e.jsxs(q, { children: [
382
- d,
383
- r < i.length - 1 && "/",
384
- /* @__PURE__ */ e.jsx("wbr", {})
385
- ] }, `${a}-${r}`);
386
- });
387
- }, Ct = b.forwardRef(
388
- ({ className: t, ...n }, s) => /* @__PURE__ */ e.jsx(
389
- "textarea",
390
- {
391
- className: g(
392
- "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
393
- t
394
- ),
395
- ref: s,
396
- ...n
397
- }
398
- )
399
- );
400
- Ct.displayName = "Textarea";
401
- const ge = (t) => Math.abs(
402
- isNaN(parseInt(t)) ? t.toLowerCase().charCodeAt(0) - 96 : isNaN(parseInt(t)) ? 0 : parseInt(t)
403
- ), fe = (t) => t.length > 1 ? parseInt(t.split("").reduce((n, s) => `${ge(n) + ge(s)}`)) : ge(t), it = (t, n = {}) => {
404
- const s = (3 * fe(t) + 2 * fe(t) + fe(t)) % 360, { saturation: a = 75, lightness: r = 60 } = n;
405
- return `${s}deg ${a}% ${r}%`;
406
- }, ye = "data-linked-param", Mn = (t) => {
407
- const { resolvedTheme: n } = pn();
408
- return {
409
- text: it(
410
- t,
411
- n === "light" ? { saturation: 95, lightness: 38 } : {}
412
- ),
413
- background: it(
414
- t,
415
- n === "light" ? { saturation: 85, lightness: 40 } : {}
416
- )
417
- };
418
- }, St = ({
419
- name: t,
420
- className: n,
421
- slug: s,
422
- title: a,
423
- children: r,
424
- onClick: i
425
- }) => {
426
- const l = G(null), d = s == null ? void 0 : s.replace(/[{}]/g, ""), c = t.replace(/[{}]/g, ""), { text: u, background: x } = Mn(c), w = `hsl(${u} / 100%)`, v = `hsl(${x} / 10%)`, p = `hsl(${x} / 50%)`;
427
- return ne(() => {
428
- if (!d || !l.current) return;
429
- const f = () => {
430
- document.querySelectorAll(`[${ye}="${d}"]`).forEach((h) => {
431
- h instanceof HTMLElement && (h.dataset.active = "true");
432
- });
433
- }, m = () => {
434
- document.querySelectorAll(`[${ye}="${d}"]`).forEach((h) => {
435
- h instanceof HTMLElement && (h.dataset.active = "false");
436
- });
437
- }, y = l.current;
438
- return y.addEventListener("mouseenter", f), y.addEventListener("mouseleave", m), () => {
439
- y.removeEventListener("mouseenter", f), y.removeEventListener("mouseleave", m);
440
- };
441
- }, [d]), /* @__PURE__ */ e.jsx(
442
- "span",
443
- {
444
- [ye]: d,
445
- className: g(
446
- // This may not contain (inline-)flex or (inline-)block otherwise it breaks the browser's full text search
447
- "relative transition-all duration-100 rounded-lg",
448
- "border border-[--border-color] p-0.5 text-[--param-color] bg-[--background-color]",
449
- "data-[active=true]:border-[--param-color] data-[active=true]:shadow data-[active=true]:bottom-px",
450
- n
451
- ),
452
- title: a,
453
- suppressHydrationWarning: !0,
454
- ref: l,
455
- onClick: i,
456
- style: {
457
- "--param-color": w,
458
- "--border-color": p,
459
- "--background-color": v
460
- },
461
- children: r ?? t
462
- }
463
- );
464
- }, Hn = xt()(
465
- gt(
466
- (t) => ({
467
- selectedServer: void 0,
468
- setSelectedServer: (n) => t({ selectedServer: n })
469
- }),
470
- { name: "zudoku-selected-server" }
471
- )
472
- ), _n = (t) => {
473
- const { selectedServer: n, setSelectedServer: s } = Hn();
474
- return { selectedServer: sn(
475
- () => {
476
- var r;
477
- return n && t.some((i) => i.url === n) ? n : ((r = t.at(0)) == null ? void 0 : r.url) ?? "";
478
- },
479
- [n, t]
480
- ), setSelectedServer: s };
481
- }, Bn = (t, n, s) => {
482
- const a = n.replace(/(:\w+|\{\w+})/g, (i) => {
483
- var c;
484
- const l = i.replace(/[:{}]/g, "");
485
- return ((c = s.pathParams.find((u) => u.name === l)) == null ? void 0 : c.value) ?? i;
486
- }), r = new URL(
487
- a.replace(/^\//, ""),
488
- t.endsWith("/") ? t : `${t}/`
489
- );
490
- return s.queryParams.filter((i) => i.active).forEach((i) => {
491
- r.searchParams.set(i.name, i.value);
492
- }), r;
493
- }, Tt = j.Root, $t = j.Trigger, Gn = j.Group, Jn = b.forwardRef(({ className: t, inset: n, children: s, ...a }, r) => /* @__PURE__ */ e.jsxs(
494
- j.SubTrigger,
495
- {
496
- ref: r,
497
- className: g(
498
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
499
- n && "pl-8",
500
- t
501
- ),
502
- ...a,
503
- children: [
504
- s,
505
- /* @__PURE__ */ e.jsx(Q, { className: "ml-auto h-4 w-4" })
506
- ]
507
- }
508
- ));
509
- Jn.displayName = j.SubTrigger.displayName;
510
- const Un = b.forwardRef(({ className: t, ...n }, s) => /* @__PURE__ */ e.jsx(
511
- j.SubContent,
512
- {
513
- ref: s,
514
- className: g(
515
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
516
- t
517
- ),
518
- ...n
519
- }
520
- ));
521
- Un.displayName = j.SubContent.displayName;
522
- const Ae = b.forwardRef(({ className: t, sideOffset: n = 4, ...s }, a) => /* @__PURE__ */ e.jsx(j.Portal, { children: /* @__PURE__ */ e.jsx(
523
- j.Content,
524
- {
525
- ref: a,
526
- sideOffset: n,
527
- className: g(
528
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
529
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
530
- t
531
- ),
532
- ...s
533
- }
534
- ) }));
535
- Ae.displayName = j.Content.displayName;
536
- const Ee = b.forwardRef(({ className: t, inset: n, ...s }, a) => /* @__PURE__ */ e.jsx(
537
- j.Item,
538
- {
539
- ref: a,
540
- className: g(
541
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
542
- n && "pl-8",
543
- t
544
- ),
545
- ...s
546
- }
547
- ));
548
- Ee.displayName = j.Item.displayName;
549
- const Qn = b.forwardRef(({ className: t, children: n, checked: s, ...a }, r) => /* @__PURE__ */ e.jsxs(
550
- j.CheckboxItem,
551
- {
552
- ref: r,
553
- className: g(
554
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
555
- t
556
- ),
557
- checked: s,
558
- ...a,
559
- children: [
560
- /* @__PURE__ */ e.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ e.jsx(j.ItemIndicator, { children: /* @__PURE__ */ e.jsx(Ht, { className: "h-4 w-4" }) }) }),
561
- n
562
- ]
563
- }
564
- ));
565
- Qn.displayName = j.CheckboxItem.displayName;
566
- const Wn = b.forwardRef(({ className: t, children: n, ...s }, a) => /* @__PURE__ */ e.jsxs(
567
- j.RadioItem,
568
- {
569
- ref: a,
570
- className: g(
571
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
572
- t
573
- ),
574
- ...s,
575
- children: [
576
- /* @__PURE__ */ e.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ e.jsx(j.ItemIndicator, { children: /* @__PURE__ */ e.jsx(_t, { className: "h-4 w-4 fill-current" }) }) }),
577
- n
578
- ]
579
- }
580
- ));
581
- Wn.displayName = j.RadioItem.displayName;
582
- const Pt = b.forwardRef(({ className: t, inset: n, ...s }, a) => /* @__PURE__ */ e.jsx(
583
- j.Label,
584
- {
585
- ref: a,
586
- className: g(
587
- "px-2 py-1.5 text-sm font-semibold",
588
- n && "pl-8",
589
- t
590
- ),
591
- ...s
592
- }
593
- ));
594
- Pt.displayName = j.Label.displayName;
595
- const kt = b.forwardRef(({ className: t, ...n }, s) => /* @__PURE__ */ e.jsx(
596
- j.Separator,
597
- {
598
- ref: s,
599
- className: g("-mx-1 my-1 h-px bg-muted", t),
600
- ...n
601
- }
602
- ));
603
- kt.displayName = j.Separator.displayName;
604
- const Zn = ({
605
- examples: t,
606
- onSelect: n
607
- }) => /* @__PURE__ */ e.jsxs(Tt, { children: [
608
- /* @__PURE__ */ e.jsx($t, { asChild: !0, children: /* @__PURE__ */ e.jsx(A, { variant: "outline", children: "Use Example" }) }),
609
- /* @__PURE__ */ e.jsx(Ae, { className: "max-w-72", children: t.map((s) => {
610
- var a;
611
- return /* @__PURE__ */ e.jsxs("div", { children: [
612
- /* @__PURE__ */ e.jsx(Pt, { children: s.mediaType }),
613
- /* @__PURE__ */ e.jsx(kt, {}),
614
- /* @__PURE__ */ e.jsx(Gn, { children: (a = s.examples) == null ? void 0 : a.map((r) => /* @__PURE__ */ e.jsx(
615
- Ee,
616
- {
617
- onSelect: () => n(r, s.mediaType),
618
- children: /* @__PURE__ */ e.jsx(
619
- "span",
620
- {
621
- className: "line-clamp-1",
622
- title: r.summary ?? r.name,
623
- children: r.summary ?? r.name
624
- }
625
- )
626
- },
627
- r.name
628
- )) })
629
- ] }, s.mediaType);
630
- }) })
631
- ] }), ce = b.forwardRef(({ className: t, ...n }, s) => /* @__PURE__ */ e.jsx(
632
- Ce.Root,
633
- {
634
- ref: s,
635
- className: g(
636
- "peer h-4 w-4 shrink-0 rounded-[min(6px,var(--radius)-4px)] ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:text-primary",
637
- "border border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary",
638
- t
639
- ),
640
- ...n,
641
- children: /* @__PURE__ */ e.jsx(
642
- Ce.Indicator,
643
- {
644
- className: g("flex items-center justify-center text-current"),
645
- children: /* @__PURE__ */ e.jsx(Bt, { className: "h-4 w-4" })
646
- }
647
- )
648
- }
649
- ));
650
- ce.displayName = Ce.Root.displayName;
651
- const Xn = se.Root, It = b.forwardRef(({ className: t, align: n = "center", sideOffset: s = 4, ...a }, r) => /* @__PURE__ */ e.jsx(se.Portal, { children: /* @__PURE__ */ e.jsx(
652
- se.Content,
653
- {
654
- ref: r,
655
- align: n,
656
- sideOffset: s,
657
- className: g(
658
- "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
659
- t
660
- ),
661
- ...a
662
- }
663
- ) }));
664
- It.displayName = se.Content.displayName;
665
- const Kn = ({
666
- value: t,
667
- options: n,
668
- onChange: s,
669
- className: a,
670
- placeholder: r = "Enter value",
671
- onEnterPress: i,
672
- ref: l
673
- }) => {
674
- const [d, c] = k(!1), [u, x] = k(!1), w = xn((p) => p.filtered.count), v = G(null);
675
- return /* @__PURE__ */ e.jsxs(Xn, { open: d, children: [
676
- /* @__PURE__ */ e.jsx(hn, { children: /* @__PURE__ */ e.jsx(
677
- fn,
678
- {
679
- ref: (p) => {
680
- v.current = p, typeof l == "function" ? l(p) : l && (l.current = p);
681
- },
682
- value: t,
683
- placeholder: r,
684
- className: g("h-9 bg-transparent", a),
685
- onFocus: () => c(!0),
686
- onBlur: () => {
687
- u || c(!1);
688
- },
689
- onKeyDown: (p) => {
690
- var f;
691
- p.key === "Enter" && (c(!1), (f = v.current) == null || f.blur(), i == null || i(p));
692
- },
693
- onValueChange: (p) => s(p)
694
- }
695
- ) }),
696
- /* @__PURE__ */ e.jsx(
697
- It,
698
- {
699
- onMouseEnter: () => x(!0),
700
- onMouseLeave: () => x(!1),
701
- onOpenAutoFocus: (p) => p.preventDefault(),
702
- className: g("p-0 w-[--radix-popover-trigger-width]", {
703
- "border-0": w === 0
704
- }),
705
- align: "start",
706
- side: "bottom",
707
- onWheel: (p) => {
708
- p.stopPropagation();
709
- },
710
- onTouchMove: (p) => {
711
- p.stopPropagation();
712
- },
713
- children: /* @__PURE__ */ e.jsx(yn, { className: "max-h-[140px]", children: n.map((p) => /* @__PURE__ */ e.jsx(
714
- vn,
715
- {
716
- value: p,
717
- onSelect: (f) => {
718
- s(f), c(!1);
719
- },
720
- className: "cursor-pointer",
721
- children: p
722
- },
723
- p
724
- )) })
725
- }
726
- )
727
- ] });
728
- }, ae = ({ shouldFilter: t, ...n }) => /* @__PURE__ */ e.jsx(gn, { className: "bg-transparent", shouldFilter: t, children: /* @__PURE__ */ e.jsx(Kn, { ...n }) }), De = (t, n) => {
729
- const s = b.forwardRef(({ className: a, asChild: r, ...i }, l) => {
730
- const d = r ? bn : t;
731
- return b.createElement(d, {
732
- ...i,
733
- ref: l,
734
- className: typeof n == "function" ? n({ className: a }) : g(n, a)
735
- });
736
- });
737
- return s.displayName = `VariantComponent(${t})`, s;
738
- }, Ve = De(
739
- "div",
740
- "grid grid-cols-[2fr_3fr] gap-2 items-center"
741
- ), Fe = De(
742
- "div",
743
- "group hover:bg-accent px-3 grid col-span-full grid-cols-subgrid"
744
- ), Yn = Object.freeze([
745
- "Accept",
746
- "Accept-Encoding",
747
- "Accept-Language",
748
- "Authorization",
749
- "Cache-Control",
750
- "Connection",
751
- "Content-Disposition",
752
- "Content-Encoding",
753
- "Content-Language",
754
- "Content-Length",
755
- "Content-Range",
756
- "Content-Security-Policy",
757
- "Content-Type",
758
- "Cookie",
759
- "Date",
760
- "ETag",
761
- "Expires",
762
- "Host",
763
- "If-Modified-Since",
764
- "Location",
765
- "Origin",
766
- "Pragma",
767
- "Referer",
768
- "Set-Cookie",
769
- "User-Agent",
770
- "X-Requested-With"
771
- ]), es = ({
772
- control: t,
773
- headers: n
774
- }) => {
775
- const { fields: s, append: a, remove: r } = Re({
776
- control: t,
777
- name: "headers"
778
- }), { setValue: i, watch: l } = Oe(), d = G([]), c = G([]), u = l("headers"), x = an(() => {
779
- a({ name: "", value: "", active: !1 });
780
- }, [a]);
781
- ne(() => {
782
- u.length === 0 && x();
783
- }, [u, x]);
784
- const w = (f) => {
785
- var m;
786
- (m = d.current[f]) == null || m.focus();
787
- }, v = (f) => {
788
- x(), requestAnimationFrame(() => {
789
- var m;
790
- return (m = c.current[f + 1]) == null ? void 0 : m.focus();
791
- });
792
- }, p = n.filter((f) => !u.some((m) => m.name === f.name)).map(({ name: f }) => f);
793
- return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
794
- /* @__PURE__ */ e.jsx(le, { className: "overflow-hidden", children: /* @__PURE__ */ e.jsx(Ve, { children: s.map((f, m) => {
795
- const y = n.find(
796
- (h) => h.name === l(`headers.${m}.name`)
797
- );
798
- return /* @__PURE__ */ e.jsxs(Fe, { children: [
799
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 ", children: [
800
- /* @__PURE__ */ e.jsx(
801
- L,
802
- {
803
- control: t,
804
- name: `headers.${m}.active`,
805
- render: ({ field: h }) => /* @__PURE__ */ e.jsx(
806
- ce,
807
- {
808
- id: `headers.${m}.active`,
809
- checked: h.value,
810
- onCheckedChange: (T) => {
811
- h.onChange(T);
812
- }
813
- }
814
- )
815
- }
816
- ),
817
- /* @__PURE__ */ e.jsx(
818
- L,
819
- {
820
- control: t,
821
- name: `headers.${m}.name`,
822
- render: ({ field: h }) => /* @__PURE__ */ e.jsx(
823
- ae,
824
- {
825
- ...h,
826
- placeholder: "Name",
827
- className: "border-0 shadow-none bg-transparent text-xs font-mono",
828
- options: [...p, ...Yn],
829
- onEnterPress: () => w(m),
830
- onChange: (T) => {
831
- h.onChange(T), i(`headers.${m}.active`, !0);
832
- },
833
- ref: (T) => {
834
- c.current[m] = T;
835
- }
836
- }
837
- )
838
- }
839
- )
840
- ] }),
841
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
842
- /* @__PURE__ */ e.jsx(
843
- L,
844
- {
845
- control: t,
846
- name: `headers.${m}.value`,
847
- render: ({ field: h }) => (y == null ? void 0 : y.enum) && y.enum.length > 0 ? /* @__PURE__ */ e.jsx(
848
- ae,
849
- {
850
- shouldFilter: !1,
851
- value: h.value,
852
- options: y.enum ?? [],
853
- onChange: ($) => {
854
- h.onChange($), i(`headers.${m}.active`, !0);
855
- },
856
- className: "font-mono text-xs border-0"
857
- }
858
- ) : /* @__PURE__ */ e.jsx(
859
- qe,
860
- {
861
- placeholder: "Value",
862
- className: "w-full border-0 shadow-none text-xs font-mono focus-visible:ring-0",
863
- ...h,
864
- ref: ($) => {
865
- d.current[m] = $;
866
- },
867
- onKeyDown: ($) => {
868
- $.key === "Enter" && $.currentTarget.value.trim() && v(m);
869
- },
870
- autoComplete: "off"
871
- }
872
- )
873
- }
874
- ),
875
- /* @__PURE__ */ e.jsx(
876
- W,
877
- {
878
- size: "icon",
879
- variant: "ghost",
880
- className: "text-muted-foreground opacity-0 group-hover:opacity-100 rounded-full w-8 h-7",
881
- onClick: () => r(m),
882
- type: "button",
883
- children: /* @__PURE__ */ e.jsx(Gt, { size: 16 })
884
- }
885
- )
886
- ] })
887
- ] }, f.id);
888
- }) }) }),
889
- /* @__PURE__ */ e.jsx("div", { className: "text-end", children: /* @__PURE__ */ e.jsx(
890
- W,
891
- {
892
- className: "",
893
- onClick: x,
894
- type: "button",
895
- variant: "secondary",
896
- children: "Add header"
897
- }
898
- ) })
899
- ] });
900
- }, ts = vt(
901
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
902
- ), _ = b.forwardRef(({ className: t, ...n }, s) => /* @__PURE__ */ e.jsx(
903
- Nt.Root,
904
- {
905
- ref: s,
906
- className: g(ts(), t),
907
- ...n
908
- }
909
- ));
910
- _.displayName = Nt.Root.displayName;
911
- const ze = b.forwardRef(({ className: t, ...n }, s) => /* @__PURE__ */ e.jsx(
912
- Z.Root,
913
- {
914
- className: g("grid gap-2", t),
915
- ...n,
916
- ref: s
917
- }
918
- ));
919
- ze.displayName = Z.Root.displayName;
920
- const re = b.forwardRef(({ className: t, ...n }, s) => /* @__PURE__ */ e.jsx(
921
- Z.Item,
922
- {
923
- ref: s,
924
- className: g(
925
- "aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
926
- t
927
- ),
928
- ...n,
929
- children: /* @__PURE__ */ e.jsx(Z.Indicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ e.jsx(Jt, { className: "h-2.5 w-2.5 fill-current text-current" }) })
930
- }
931
- ));
932
- re.displayName = Z.Item.displayName;
933
- const Rt = ({
934
- identities: t,
935
- setValue: n,
936
- value: s
937
- }) => /* @__PURE__ */ e.jsx(le, { className: "w-full overflow-hidden", children: /* @__PURE__ */ e.jsxs(
938
- ze,
939
- {
940
- onValueChange: (a) => n(a),
941
- value: s,
942
- defaultValue: B,
943
- className: "gap-0",
944
- disabled: (t == null ? void 0 : t.length) === 0,
945
- children: [
946
- /* @__PURE__ */ e.jsxs(
947
- _,
948
- {
949
- className: "h-12 border-b items-center flex p-4 cursor-pointer hover:bg-accent",
950
- htmlFor: "none",
951
- children: [
952
- /* @__PURE__ */ e.jsx(re, { value: B, id: "none", children: "None" }),
953
- /* @__PURE__ */ e.jsx(_, { htmlFor: "none", className: "ml-2", children: "None" })
954
- ]
955
- }
956
- ),
957
- t == null ? void 0 : t.map((a) => /* @__PURE__ */ e.jsxs(
958
- _,
959
- {
960
- className: "h-12 border-b items-center flex p-4 cursor-pointer hover:bg-accent",
961
- children: [
962
- /* @__PURE__ */ e.jsx(re, { value: a.id, id: a.id, children: a.label }),
963
- /* @__PURE__ */ e.jsx(_, { htmlFor: a.id, className: "ml-2", children: a.label })
964
- ]
965
- },
966
- a.id
967
- ))
968
- ]
969
- }
970
- ) }), ns = ({
971
- onSubmit: t,
972
- identities: n,
973
- open: s,
974
- onOpenChange: a
975
- }) => {
976
- const [r, i] = k(void 0), [l, d] = k(!1);
977
- return /* @__PURE__ */ e.jsx(Pe, { open: s, onOpenChange: a, children: /* @__PURE__ */ e.jsxs(ke, { children: [
978
- /* @__PURE__ */ e.jsx(Ie, { children: "Select an auth identity" }),
979
- /* @__PURE__ */ e.jsx(ft, { children: "Please select an identity for this request." }),
980
- /* @__PURE__ */ e.jsx("div", { className: "max-h-80 overflow-auto", children: /* @__PURE__ */ e.jsx(
981
- Rt,
982
- {
983
- identities: n,
984
- setValue: i,
985
- value: r
986
- }
987
- ) }),
988
- /* @__PURE__ */ e.jsxs(yt, { className: "flex flex-col gap-2", children: [
989
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
990
- /* @__PURE__ */ e.jsx(
991
- ce,
992
- {
993
- id: "remember",
994
- checked: l,
995
- onCheckedChange: (c) => d(
996
- c === "indeterminate" ? !1 : !!c
997
- )
998
- }
999
- ),
1000
- /* @__PURE__ */ e.jsx(_, { htmlFor: "remember", children: "Remember my choice" })
1001
- ] }),
1002
- /* @__PURE__ */ e.jsx(
1003
- A,
1004
- {
1005
- onClick: () => t({ identity: r, rememberedIdentity: l }),
1006
- children: "Send"
1007
- }
1008
- )
1009
- ] })
1010
- ] }) });
1011
- }, ss = ({
1012
- control: t,
1013
- url: n
1014
- }) => {
1015
- const { fields: s } = Re({
1016
- control: t,
1017
- name: "pathParams"
1018
- }), a = [...s].sort(
1019
- (r, i) => n.indexOf(`{${r.name}}`) - n.indexOf(`{${i.name}}`)
1020
- );
1021
- return /* @__PURE__ */ e.jsx(le, { className: "rounded-lg", children: /* @__PURE__ */ e.jsx(Ve, { children: a.map((r, i) => /* @__PURE__ */ e.jsxs(Fe, { children: [
1022
- /* @__PURE__ */ e.jsx(
1023
- L,
1024
- {
1025
- control: t,
1026
- name: `pathParams.${i}.name`,
1027
- render: () => /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsx(
1028
- St,
1029
- {
1030
- slug: r.name,
1031
- name: r.name,
1032
- className: "font-mono text-xs px-2"
1033
- }
1034
- ) })
1035
- }
1036
- ),
1037
- /* @__PURE__ */ e.jsx("div", { className: "flex justify-between items-center", children: /* @__PURE__ */ e.jsx(
1038
- L,
1039
- {
1040
- control: t,
1041
- name: `pathParams.${i}.value`,
1042
- render: ({ field: l }) => /* @__PURE__ */ e.jsx(
1043
- qe,
1044
- {
1045
- ...l,
1046
- required: !0,
1047
- placeholder: "Enter value",
1048
- className: "w-full border-0 shadow-none text-xs font-mono focus-visible:ring-0"
1049
- }
1050
- )
1051
- }
1052
- ) })
1053
- ] }, r.id)) }) });
1054
- }, as = De(
1055
- "input",
1056
- "px-2 bg-transparent h-6 font-mono text-xs m-2"
1057
- ), rs = ({
1058
- control: t,
1059
- queryParams: n
1060
- }) => {
1061
- const { fields: s } = Re({
1062
- control: t,
1063
- name: "queryParams"
1064
- }), a = Oe(), r = n.map((i) => !!i.isRequired);
1065
- return /* @__PURE__ */ e.jsx(le, { className: "rounded-lg", children: /* @__PURE__ */ e.jsx("div", { className: "w-full ", children: /* @__PURE__ */ e.jsx(Ve, { children: s.map((i, l) => {
1066
- const d = n.find(
1067
- (c) => c.name === a.watch(`queryParams.${l}.name`)
1068
- );
1069
- return /* @__PURE__ */ e.jsxs(Fe, { children: [
1070
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1071
- /* @__PURE__ */ e.jsx(
1072
- L,
1073
- {
1074
- control: t,
1075
- name: `queryParams.${l}.active`,
1076
- render: ({ field: c }) => /* @__PURE__ */ e.jsx(
1077
- ce,
1078
- {
1079
- id: `queryParams.${l}.active`,
1080
- className: "mr-2",
1081
- checked: c.value,
1082
- onCheckedChange: c.onChange
1083
- }
1084
- )
1085
- }
1086
- ),
1087
- /* @__PURE__ */ e.jsx(
1088
- L,
1089
- {
1090
- control: t,
1091
- render: ({ field: c }) => r[l] ? /* @__PURE__ */ e.jsx(as, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
1092
- "label",
1093
- {
1094
- className: "flex items-center cursor-pointer gap-1",
1095
- htmlFor: `queryParams.${l}.active`,
1096
- title: r[l] ? "Required field" : void 0,
1097
- children: [
1098
- c.value,
1099
- r[l] && /* @__PURE__ */ e.jsx("sup", { children: " *" })
1100
- ]
1101
- }
1102
- ) }) : /* @__PURE__ */ e.jsx(
1103
- ae,
1104
- {
1105
- value: c.value,
1106
- options: n.map((u) => u.name),
1107
- onChange: (u) => {
1108
- c.onChange(u);
1109
- },
1110
- className: "border-0 font-mono text-xs bg-transparent hover:bg-transparent"
1111
- }
1112
- ),
1113
- name: `queryParams.${l}.name`
1114
- }
1115
- )
1116
- ] }, i.id),
1117
- /* @__PURE__ */ e.jsx("div", { className: "flex justify-between items-center", children: /* @__PURE__ */ e.jsx(
1118
- L,
1119
- {
1120
- control: t,
1121
- render: ({ field: c }) => (d == null ? void 0 : d.enum) && d.enum.length > 0 ? /* @__PURE__ */ e.jsx(
1122
- ae,
1123
- {
1124
- value: c.value,
1125
- options: d.enum ?? [],
1126
- onChange: (x) => {
1127
- c.onChange(x), a.setValue(`queryParams.${l}.active`, !0);
1128
- },
1129
- className: "font-mono text-xs border-0 ring-1 ring-ring"
1130
- }
1131
- ) : /* @__PURE__ */ e.jsx(
1132
- qe,
1133
- {
1134
- ...c,
1135
- onChange: (x) => {
1136
- c.onChange(x.target.value), x.target.value.length > 0 && a.setValue(`queryParams.${l}.active`, !0);
1137
- },
1138
- placeholder: "Enter value",
1139
- className: "w-full border-0 shadow-none focus-visible:ring-0 text-xs font-mono"
1140
- }
1141
- ),
1142
- name: `queryParams.${l}.value`
1143
- }
1144
- ) })
1145
- ] }, i.id);
1146
- }) }) }) });
1147
- }, os = xt()(
1148
- gt(
1149
- (t, n) => ({
1150
- rememberedIdentity: null,
1151
- setRememberedIdentity: (s) => t({ rememberedIdentity: s }),
1152
- getRememberedIdentity: (s) => s.find(
1153
- (a) => a === n().rememberedIdentity
1154
- )
1155
- }),
1156
- {
1157
- name: "identity-storage",
1158
- storage: Xt(() => sessionStorage)
1159
- }
1160
- )
1161
- ), is = ({
1162
- open: t,
1163
- setOpen: n,
1164
- onSignUp: s,
1165
- onLogin: a
1166
- }) => /* @__PURE__ */ e.jsx(Pe, { open: t, onOpenChange: n, children: /* @__PURE__ */ e.jsxs(ke, { children: [
1167
- /* @__PURE__ */ e.jsx(Ie, { children: "Welcome to the Playground!" }),
1168
- /* @__PURE__ */ e.jsx(ft, { children: "The Playground is a tool for developers to test and explore our APIs. To use the Playground, you need to login." }),
1169
- /* @__PURE__ */ e.jsxs(yt, { className: "flex gap-2 sm:justify-between", children: [
1170
- /* @__PURE__ */ e.jsx(A, { type: "button", variant: "ghost", onClick: () => n(!1), children: "Skip" }),
1171
- /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
1172
- s && /* @__PURE__ */ e.jsx(A, { type: "button", variant: "outline", onClick: s, children: "Sign Up" }),
1173
- a && /* @__PURE__ */ e.jsx(A, { type: "button", variant: "default", onClick: a, children: "Login" })
1174
- ] })
1175
- ] })
1176
- ] }) }), I = {
1177
- green: "text-green-600",
1178
- blue: "text-sky-600",
1179
- yellow: "text-yellow-600",
1180
- red: "text-red-600",
1181
- purple: "text-purple-600",
1182
- indigo: "text-indigo-600",
1183
- gray: "text-gray-600"
1184
- }, ls = {
1185
- get: I.green,
1186
- post: I.blue,
1187
- put: I.yellow,
1188
- delete: I.red,
1189
- patch: I.purple,
1190
- options: I.indigo,
1191
- head: I.gray,
1192
- trace: I.gray
1193
- }, cs = (t) => ls[t.toLocaleLowerCase()] ?? I.gray, ds = ({
1194
- method: t,
1195
- url: n,
1196
- headers: s,
1197
- body: a
1198
- }) => /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2 font-mono text-xs", children: [
1199
- /* @__PURE__ */ e.jsxs("div", { className: "gap-2 p-2 bg-muted rounded-md", children: [
1200
- /* @__PURE__ */ e.jsx("span", { className: g(cs(t), "font-semibold"), children: t }),
1201
- " ",
1202
- /* @__PURE__ */ e.jsx("span", { className: "break-all", children: n }),
1203
- " ",
1204
- /* @__PURE__ */ e.jsx("span", { className: "text-muted-foreground", children: "HTTP/1.1" })
1205
- ] }),
1206
- /* @__PURE__ */ e.jsxs("div", { className: "mx-1.5 flex flex-col gap-3", children: [
1207
- /* @__PURE__ */ e.jsxs(at, { defaultOpen: !0, children: [
1208
- /* @__PURE__ */ e.jsxs(rt, { className: "flex items-center gap-2 hover:text-primary group", children: [
1209
- /* @__PURE__ */ e.jsx(Q, { className: "h-4 w-4 transition-transform duration-200 group-data-[state=open]:rotate-[90deg]" }),
1210
- /* @__PURE__ */ e.jsx("span", { className: "font-semibold", children: "Headers" })
1211
- ] }),
1212
- /* @__PURE__ */ e.jsx(ot, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-[auto,1fr] gap-x-8 gap-y-1 pl-1.5 pt-2", children: s.map(([r, i]) => /* @__PURE__ */ e.jsxs(q, { children: [
1213
- /* @__PURE__ */ e.jsx("div", { className: "text-primary", children: r }),
1214
- /* @__PURE__ */ e.jsx("div", { className: "break-all", children: i })
1215
- ] }, r)) }) })
1216
- ] }),
1217
- /* @__PURE__ */ e.jsxs(at, { defaultOpen: !0, children: [
1218
- /* @__PURE__ */ e.jsxs(rt, { className: "flex items-center gap-2 hover:text-primary group", children: [
1219
- /* @__PURE__ */ e.jsx(Q, { className: "h-4 w-4 transition-transform duration-200 group-data-[state=open]:rotate-[90deg]" }),
1220
- /* @__PURE__ */ e.jsx("span", { className: "font-semibold", children: "Body" })
1221
- ] }),
1222
- /* @__PURE__ */ e.jsx(ot, { children: /* @__PURE__ */ e.jsx("div", { className: "pl-0 pt-2", children: /* @__PURE__ */ e.jsx(
1223
- "div",
1224
- {
1225
- className: g(
1226
- "whitespace-pre-wrap break-all bg-muted p-2 rounded-md",
1227
- !a && "text-muted-foreground"
1228
- ),
1229
- children: a ?? "Empty body"
1230
- }
1231
- ) }) })
1232
- ] })
1233
- ] })
1234
- ] }), lt = Le.Root, ct = Le.CollapsibleTrigger, dt = Le.CollapsibleContent;
1235
- function Me(t) {
1236
- if (t === null) return "null";
1237
- if (Array.isArray(t)) {
1238
- if (t.length === 0) return "any[]";
1239
- const n = t[0];
1240
- return n === void 0 ? "any[]" : `${Me(n)}[]`;
1241
- }
1242
- return typeof t == "object" ? ms(t) : typeof t;
1243
- }
1244
- function ms(t, n = "") {
1245
- const s = ["{"];
1246
- for (const [a, r] of Object.entries(t)) {
1247
- const i = Me(r);
1248
- s.push(` ${a}: ${i};`);
1249
- }
1250
- return s.push("}"), s.join(`
1251
- `);
1252
- }
1253
- function us(t) {
1254
- return { lines: [`type GeneratedType = ${Me(t)};`] };
1255
- }
1256
- const ps = {
1257
- 200: "OK",
1258
- 201: "Created",
1259
- 202: "Accepted",
1260
- 204: "No Content",
1261
- 400: "Bad Request",
1262
- 401: "Unauthorized",
1263
- 403: "Forbidden",
1264
- 404: "Not Found",
1265
- 405: "Method Not Allowed",
1266
- 500: "Internal Server Error"
1267
- }, mt = (t) => {
1268
- const n = Math.floor(Math.log(t) / Math.log(1e3));
1269
- return `${(t / Math.pow(1e3, n)).toFixed(
1270
- n ? 2 : 0
1271
- )} ${n ? `${"kMGTPEZY"[n - 1]}B` : "B"}`;
1272
- }, hs = (t) => {
1273
- var s;
1274
- return (s = Object.entries({
1275
- "application/json": "json",
1276
- "text/json": "json",
1277
- "text/html": "html",
1278
- "text/css": "css",
1279
- "text/javascript": "javascript",
1280
- "application/xml": "xml",
1281
- "application/xhtml+xml": "xhtml"
1282
- }).find(
1283
- ([a]) => t.includes(a)
1284
- )) == null ? void 0 : s[1];
1285
- }, xs = (t) => {
1286
- var s;
1287
- const n = ((s = t.find(([a, r]) => a === "Content-Type")) == null ? void 0 : s[1]) || "";
1288
- return hs(n);
1289
- }, gs = (t) => {
1290
- try {
1291
- return JSON.stringify(JSON.parse(t), null, 2);
1292
- } catch {
1293
- return null;
1294
- }
1295
- }, fs = (t) => {
1296
- const n = [
1297
- "Content-Type",
1298
- "Content-Length",
1299
- "Authorization",
1300
- "X-RateLimit-Remaining",
1301
- "X-RateLimit-Limit",
1302
- "Cache-Control",
1303
- "ETag"
1304
- ].map((s) => s.toLowerCase());
1305
- return [...t].sort(([s], [a]) => {
1306
- const r = n.indexOf(s.toLowerCase()), i = n.indexOf(a.toLowerCase());
1307
- return r === i ? 0 : r === -1 ? 1 : i === -1 ? -1 : r - i;
1308
- });
1309
- }, ut = 64e3, ys = ({
1310
- body: t = "",
1311
- headers: n,
1312
- status: s,
1313
- time: a,
1314
- size: r,
1315
- url: i
1316
- }) => {
1317
- var f;
1318
- const l = xs(n), d = gs(t), c = d || t, [u, x] = k(
1319
- d ? "formatted" : "raw"
1320
- ), w = Kt({
1321
- queryKey: ["types", c],
1322
- queryFn: async () => us(JSON.parse(c)),
1323
- enabled: u === "types"
1324
- }), v = fs([...n]), p = r > ut;
1325
- return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2 h-full overflow-auto max-h-[calc(100vh-220px)] ", children: [
1326
- /* @__PURE__ */ e.jsxs(lt, { defaultOpen: !0, children: [
1327
- /* @__PURE__ */ e.jsxs(ct, { className: "flex items-center gap-2 hover:text-primary group", children: [
1328
- /* @__PURE__ */ e.jsx(Q, { className: "h-4 w-4 transition-transform duration-200 group-data-[state=open]:rotate-[90deg]" }),
1329
- /* @__PURE__ */ e.jsx("span", { className: "font-semibold", children: "Headers" })
1330
- ] }),
1331
- /* @__PURE__ */ e.jsx(dt, { children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-[auto,1fr] gap-x-8 gap-y-1 pl-1.5 pt-2 font-mono text-xs", children: [
1332
- v.slice(0, 5).map(([m, y]) => /* @__PURE__ */ e.jsxs(q, { children: [
1333
- /* @__PURE__ */ e.jsx("div", { className: "text-primary whitespace-pre", children: m }),
1334
- /* @__PURE__ */ e.jsx("div", { className: "break-all", children: y })
1335
- ] }, m)),
1336
- v.length > 5 && /* @__PURE__ */ e.jsxs(lt, { className: "col-span-full grid-cols-subgrid grid", children: [
1337
- /* @__PURE__ */ e.jsxs(ct, { className: "col-span-2 text-xs text-muted-foreground hover:text-primary flex items-center gap-1 py-1", children: [
1338
- /* @__PURE__ */ e.jsx(Q, { className: "h-3 w-3 transition-transform duration-200 group-data-[state=open]:rotate-[90deg]" }),
1339
- "Show ",
1340
- v.length - 5,
1341
- " more headers"
1342
- ] }),
1343
- /* @__PURE__ */ e.jsx(dt, { className: "col-span-full grid grid-cols-subgrid gap-x-8 gap-y-1 ", children: v.slice(5).map(([m, y]) => /* @__PURE__ */ e.jsxs(q, { children: [
1344
- /* @__PURE__ */ e.jsx("div", { className: "text-primary whitespace-pre", children: m }),
1345
- /* @__PURE__ */ e.jsx("div", { className: "break-all", children: y })
1346
- ] }, m)) })
1347
- ] })
1348
- ] }) })
1349
- ] }),
1350
- /* @__PURE__ */ e.jsxs(wt, { className: "shadow-none", children: [
1351
- p && /* @__PURE__ */ e.jsxs(jn, { type: "info", className: "my-0 p-2", children: [
1352
- "Code highlight is disabled for responses larger than",
1353
- " ",
1354
- mt(ut)
1355
- ] }),
1356
- /* @__PURE__ */ e.jsx(
1357
- $n,
1358
- {
1359
- language: u === "types" ? "typescript" : u === "raw" ? d ? "plain" : l : "json",
1360
- showCopy: "always",
1361
- disabled: p,
1362
- noBackground: !0,
1363
- className: "overflow-x-auto p-4 text-xs max-h-[calc(83.333vh-180px)]",
1364
- code: (u === "raw" ? t : u === "types" ? (f = w.data) == null ? void 0 : f.lines.join(`
1365
- `) : c) ?? ""
1366
- }
1367
- )
1368
- ] }),
1369
- /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 justify-between items-center", children: [
1370
- /* @__PURE__ */ e.jsxs("div", { className: "flex text-xs gap-2 border bg-muted rounded-md p-2 items-center h-8 font-mono divide-x", children: [
1371
- /* @__PURE__ */ e.jsxs("div", { children: [
1372
- /* @__PURE__ */ e.jsx("span", { className: "text-muted-foreground", children: "Status" }),
1373
- " ",
1374
- s,
1375
- " ",
1376
- ps[s] ?? ""
1377
- ] }),
1378
- /* @__PURE__ */ e.jsxs("div", { children: [
1379
- /* @__PURE__ */ e.jsx("span", { className: "text-muted-foreground", children: "Time" }),
1380
- " ",
1381
- a.toFixed(0),
1382
- "ms"
1383
- ] }),
1384
- /* @__PURE__ */ e.jsxs("div", { children: [
1385
- /* @__PURE__ */ e.jsx("span", { className: "text-muted-foreground", children: "Size" }),
1386
- " ",
1387
- mt(r)
1388
- ] })
1389
- ] }),
1390
- d && /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs(
1391
- je,
1392
- {
1393
- value: u,
1394
- onValueChange: (m) => x(m),
1395
- children: [
1396
- /* @__PURE__ */ e.jsx(be, { className: "min-w-32", children: /* @__PURE__ */ e.jsx(Ne, { placeholder: "View" }) }),
1397
- /* @__PURE__ */ e.jsxs(we, { children: [
1398
- /* @__PURE__ */ e.jsx(U, { value: "formatted", children: "Formatted" }),
1399
- /* @__PURE__ */ e.jsx(U, { value: "raw", children: "Raw" }),
1400
- /* @__PURE__ */ e.jsx(U, { value: "types", children: "Types" })
1401
- ] })
1402
- ]
1403
- }
1404
- ) })
1405
- ] })
1406
- ] });
1407
- }, vs = ({
1408
- queryMutation: t,
1409
- showPathParamsWarning: n,
1410
- showLongRunningWarning: s,
1411
- onCancel: a
1412
- }) => {
1413
- var i;
1414
- const r = ((((i = t.data) == null ? void 0 : i.status) ?? 0) / 100).toFixed(0);
1415
- return /* @__PURE__ */ e.jsx("div", { className: "min-w-0 p-4 py-8 bg-muted/50", children: t.error ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
1416
- n && /* @__PURE__ */ e.jsx(wn, { type: "caution", children: "Some path parameters are missing values. Please fill them in to ensure the request is sent correctly." }),
1417
- /* @__PURE__ */ e.jsxs(wt, { children: [
1418
- /* @__PURE__ */ e.jsx(Cn, { children: /* @__PURE__ */ e.jsx(Sn, { children: "Request failed" }) }),
1419
- /* @__PURE__ */ e.jsxs(Tn, { children: [
1420
- "Error:",
1421
- " ",
1422
- t.error.message || String(t.error) || "Unexpected error"
1423
- ] })
1424
- ] })
1425
- ] }) : t.data ? /* @__PURE__ */ e.jsxs(jt, { defaultValue: "response", children: [
1426
- /* @__PURE__ */ e.jsxs(bt, { children: [
1427
- /* @__PURE__ */ e.jsx(M, { value: "request", children: "Request" }),
1428
- /* @__PURE__ */ e.jsxs(M, { value: "response", children: [
1429
- "Response",
1430
- /* @__PURE__ */ e.jsxs(
1431
- "span",
1432
- {
1433
- className: g(
1434
- "text-xs font-mono ml-1",
1435
- r === "2" && "text-green-500",
1436
- r === "3" && "text-blue-500",
1437
- r === "4" && "text-yellow-500",
1438
- r === "5" && "text-red-500"
1439
- ),
1440
- children: [
1441
- "(",
1442
- t.data.status,
1443
- ")"
1444
- ]
1445
- }
1446
- )
1447
- ] })
1448
- ] }),
1449
- /* @__PURE__ */ e.jsx(H, { value: "request", children: /* @__PURE__ */ e.jsx(ds, { ...t.data.request }) }),
1450
- /* @__PURE__ */ e.jsx(H, { value: "response", children: /* @__PURE__ */ e.jsx(
1451
- ys,
1452
- {
1453
- status: t.data.status,
1454
- time: t.data.time,
1455
- size: t.data.size,
1456
- headers: t.data.headers,
1457
- body: t.data.body,
1458
- url: t.data.request.url
1459
- }
1460
- ) })
1461
- ] }) : /* @__PURE__ */ e.jsx("div", { className: "grid place-items-center h-full", children: t.isPending ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2 items-center mt-20", children: [
1462
- /* @__PURE__ */ e.jsx(Nn, { size: 20 }),
1463
- /* @__PURE__ */ e.jsxs(
1464
- "div",
1465
- {
1466
- className: g(
1467
- "opacity-0 pointer-events-none transition-opacity h-20 text-sm text-muted-foreground duration-300 flex flex-col gap-2 items-center",
1468
- s && "opacity-100 pointer-events-auto"
1469
- ),
1470
- children: [
1471
- "Looks like the request is taking longer than expected.",
1472
- /* @__PURE__ */ e.jsx(
1473
- W,
1474
- {
1475
- type: "button",
1476
- onClick: a,
1477
- size: "sm",
1478
- className: "w-fit",
1479
- variant: "outline",
1480
- children: "Cancel"
1481
- }
1482
- )
1483
- ]
1484
- }
1485
- )
1486
- ] }) : /* @__PURE__ */ e.jsx("span", { className: "text-[16px] font-semibold text-muted-foreground", children: "Send a request first to see the response here" }) }) });
1487
- }, js = ({
1488
- identities: t,
1489
- formRef: n,
1490
- disabled: s
1491
- }) => {
1492
- const { setValue: a } = Oe(), [r, i] = k();
1493
- return t.length === 0 ? /* @__PURE__ */ e.jsx(A, { disabled: s, children: "Send" }) : /* @__PURE__ */ e.jsxs("div", { className: "flex", children: [
1494
- /* @__PURE__ */ e.jsx(
1495
- A,
1496
- {
1497
- className: "rounded-r-none inset-shadow-sm",
1498
- disabled: s,
1499
- onClick: () => {
1500
- var l;
1501
- return (l = n == null ? void 0 : n.current) == null ? void 0 : l.requestSubmit();
1502
- },
1503
- children: "Send"
1504
- }
1505
- ),
1506
- /* @__PURE__ */ e.jsxs(Tt, { children: [
1507
- /* @__PURE__ */ e.jsx($t, { asChild: !0, children: /* @__PURE__ */ e.jsx(
1508
- A,
1509
- {
1510
- disabled: s,
1511
- className: "rounded-l-none border-l border-border/40 inset-shadow-sm w-6",
1512
- size: "icon",
1513
- children: /* @__PURE__ */ e.jsx(Ut, { className: "w-4 h-4" })
1514
- }
1515
- ) }),
1516
- /* @__PURE__ */ e.jsx(ze, { value: r, children: /* @__PURE__ */ e.jsx(Ae, { className: "w-56", align: "end", alignOffset: -150, children: [{ id: B, label: "None" }, ...t].map(
1517
- (l) => /* @__PURE__ */ e.jsxs(
1518
- Ee,
1519
- {
1520
- onClick: () => {
1521
- var d;
1522
- i(l.id), a("identity", l.id), (d = n == null ? void 0 : n.current) == null || d.requestSubmit();
1523
- },
1524
- onMouseEnter: () => i(l.id),
1525
- onMouseLeave: () => i(void 0),
1526
- children: [
1527
- /* @__PURE__ */ e.jsx(re, { value: l.id, className: "mr-2" }),
1528
- l.label
1529
- ]
1530
- },
1531
- l.id
1532
- )
1533
- ) }) })
1534
- ] })
1535
- ] });
1536
- }, B = "__none", ve = {
1537
- Plain: "text/plain",
1538
- JSON: "application/json",
1539
- XML: "application/xml",
1540
- YAML: "application/yaml",
1541
- CSV: "text/csv"
1542
- }, bs = ({
1543
- server: t,
1544
- servers: n = [],
1545
- url: s,
1546
- method: a,
1547
- headers: r = [],
1548
- queryParams: i = [],
1549
- pathParams: l = [],
1550
- defaultBody: d = "",
1551
- examples: c,
1552
- requiresLogin: u = !1,
1553
- onLogin: x,
1554
- onSignUp: w
1555
- }) => {
1556
- var Ze, Xe;
1557
- const { selectedServer: v, setSelectedServer: p } = _n(
1558
- n.map((o) => ({ url: o }))
1559
- ), [f, m] = k(!1), y = Yt(), { setRememberedIdentity: h, getRememberedIdentity: T } = os(), [, $] = rn(), [de, X] = k(!1), [K, E] = k(!1), Y = G(void 0), Be = un(h), { register: Ge, control: ee, handleSubmit: Je, watch: Ue, setValue: V, ...me } = cn({
1560
- defaultValues: {
1561
- body: d,
1562
- bodyContentType: "JSON",
1563
- queryParams: i.map((o) => ({
1564
- name: o.name,
1565
- value: o.defaultValue ?? "",
1566
- active: o.defaultActive ?? !1,
1567
- enum: o.enum ?? []
1568
- })).concat([
1569
- {
1570
- name: "",
1571
- value: "",
1572
- active: !1,
1573
- enum: []
1574
- }
1575
- ]),
1576
- pathParams: l.map((o) => ({
1577
- name: o.name,
1578
- value: o.defaultValue ?? ""
1579
- })),
1580
- headers: r.map((o) => ({
1581
- name: o.name,
1582
- value: o.defaultValue ?? "",
1583
- active: o.defaultActive ?? !1
1584
- })).concat([
1585
- {
1586
- name: "",
1587
- value: "",
1588
- active: !1
1589
- }
1590
- ]),
1591
- identity: T(
1592
- ((Ze = y.data) == null ? void 0 : Ze.map((o) => o.id)) ?? []
1593
- )
1594
- }
1595
- }), C = Ue(), Qe = G(null);
1596
- ne(() => {
1597
- C.identity && Be.current(C.identity);
1598
- }, [Be, C.identity]);
1599
- const ue = ln({
1600
- mutationFn: async (o) => {
1601
- var Ke, Ye;
1602
- const S = performance.now(), O = !o.headers.some(
1603
- (N) => N.active && N.name.toLowerCase() === "content-type"
1604
- ), F = Object.fromEntries([
1605
- ...o.headers.filter((N) => N.name && N.active).map((N) => [N.name, N.value]),
1606
- ...O ? [["content-type", ve[o.bodyContentType]]] : []
1607
- ]), P = new Request(
1608
- Bn(t ?? v, s, o),
1609
- {
1610
- method: a.toUpperCase(),
1611
- headers: F,
1612
- body: o.body ? o.body : void 0
1613
- }
1614
- );
1615
- o.identity !== B && await ((Ye = (Ke = y.data) == null ? void 0 : Ke.find((N) => N.id === o.identity)) == null ? void 0 : Ye.authorizeRequest(P));
1616
- const z = setTimeout(
1617
- () => E(!0),
1618
- 3210
1619
- );
1620
- Y.current = new AbortController();
1621
- try {
1622
- const N = await fetch(P, {
1623
- signal: Y.current.signal
1624
- });
1625
- clearTimeout(z), E(!1);
1626
- const Dt = performance.now() - S, et = await N.text(), Vt = new URL(P.url);
1627
- return {
1628
- status: N.status,
1629
- headers: Array.from(N.headers.entries()),
1630
- size: et.length,
1631
- body: et,
1632
- time: Dt,
1633
- request: {
1634
- method: P.method.toUpperCase(),
1635
- url: P.url,
1636
- headers: [
1637
- ["Host", Vt.host],
1638
- ["User-Agent", "Zudoku Playground"],
1639
- ...Array.from(P.headers.entries())
1640
- ],
1641
- body: o.body ? o.body : void 0
1642
- }
1643
- };
1644
- } catch (N) {
1645
- throw clearTimeout(z), E(!1), N instanceof TypeError ? new Error(
1646
- "The request failed, possibly due to network issues or CORS policy."
1647
- ) : N;
1648
- }
1649
- }
1650
- });
1651
- ne(() => () => {
1652
- var o;
1653
- (o = Y.current) == null || o.abort();
1654
- }, []);
1655
- const Lt = /* @__PURE__ */ e.jsx(
1656
- zn,
1657
- {
1658
- path: s,
1659
- renderParam: ({ name: o, originalValue: S, index: O }) => {
1660
- var P;
1661
- const F = (P = C.pathParams.find(
1662
- (z) => z.name === o
1663
- )) == null ? void 0 : P.value;
1664
- return /* @__PURE__ */ e.jsx(
1665
- St,
1666
- {
1667
- name: o,
1668
- backgroundOpacity: "0",
1669
- slug: o,
1670
- onClick: () => me.setFocus(`pathParams.${O}.value`),
1671
- children: F || S
1672
- }
1673
- );
1674
- }
1675
- }
1676
- ), We = C.queryParams.filter((o) => o.active).map((o, S, O) => /* @__PURE__ */ e.jsxs(q, { children: [
1677
- o.name,
1678
- "=",
1679
- encodeURIComponent(o.value).replaceAll("%20", "+"),
1680
- S < O.length - 1 && "&",
1681
- /* @__PURE__ */ e.jsx("wbr", {})
1682
- ] }, o.name)), At = /* @__PURE__ */ e.jsx("div", { className: "inline-block opacity-50 hover:opacity-100 transition", children: t ? /* @__PURE__ */ e.jsx("span", { children: t.replace(/^https?:\/\//, "").replace(/\/$/, "") }) : n.length > 1 && /* @__PURE__ */ e.jsxs(
1683
- je,
1684
- {
1685
- onValueChange: (o) => {
1686
- $(() => p(o));
1687
- },
1688
- value: v,
1689
- defaultValue: v,
1690
- children: [
1691
- /* @__PURE__ */ e.jsx(be, { className: "p-0 border-none flex-row-reverse bg-transparent text-xs gap-0.5 h-auto translate-y-[4px]", children: /* @__PURE__ */ e.jsx(Ne, {}) }),
1692
- /* @__PURE__ */ e.jsx(we, { children: n.map((o) => /* @__PURE__ */ e.jsx(U, { value: o, children: o.replace(/^https?:\/\//, "").replace(/\/$/, "") }, o)) })
1693
- ]
1694
- }
1695
- ) }), Et = u && !de, te = ["POST", "PUT", "PATCH", "DELETE"].includes(
1696
- a.toUpperCase()
1697
- );
1698
- return /* @__PURE__ */ e.jsx(
1699
- dn,
1700
- {
1701
- register: Ge,
1702
- control: ee,
1703
- handleSubmit: Je,
1704
- watch: Ue,
1705
- setValue: V,
1706
- ...me,
1707
- children: /* @__PURE__ */ e.jsxs(
1708
- "form",
1709
- {
1710
- onSubmit: Je((o) => {
1711
- var S;
1712
- ((S = y.data) == null ? void 0 : S.length) === 0 || o.identity ? ue.mutate(o) : m(!0);
1713
- }),
1714
- ref: Qe,
1715
- className: "relative",
1716
- children: [
1717
- /* @__PURE__ */ e.jsx(
1718
- ns,
1719
- {
1720
- identities: y.data ?? [],
1721
- open: f,
1722
- onOpenChange: m,
1723
- onSubmit: ({ rememberedIdentity: o, identity: S }) => {
1724
- o && V("identity", S ?? B), m(!1), ue.mutate({ ...C, identity: S });
1725
- }
1726
- }
1727
- ),
1728
- /* @__PURE__ */ e.jsx(
1729
- is,
1730
- {
1731
- open: Et,
1732
- setOpen: (o) => X(!o),
1733
- onSignUp: w,
1734
- onLogin: x
1735
- }
1736
- ),
1737
- /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2 text-sm h-full", children: [
1738
- /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4 p-4 after:bg-muted-foreground/20 relative after:absolute after:w-px after:inset-0 after:left-auto", children: [
1739
- /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 items-stretch", children: [
1740
- /* @__PURE__ */ e.jsxs("div", { className: "flex flex-1 items-center w-full border rounded-md", children: [
1741
- /* @__PURE__ */ e.jsx("div", { className: "border-r p-2 bg-muted rounded-l-md self-stretch font-semibold font-mono flex items-center", children: a.toUpperCase() }),
1742
- /* @__PURE__ */ e.jsxs("div", { className: "items-center px-2 py-0.5 font-mono text-xs break-all leading-6", children: [
1743
- At,
1744
- Lt,
1745
- We.length > 0 ? "?" : "",
1746
- We
1747
- ] })
1748
- ] }),
1749
- /* @__PURE__ */ e.jsx(
1750
- js,
1751
- {
1752
- identities: y.data ?? [],
1753
- formRef: Qe,
1754
- disabled: y.isLoading || me.formState.isSubmitting
1755
- }
1756
- )
1757
- ] }),
1758
- /* @__PURE__ */ e.jsxs(jt, { defaultValue: "parameters", children: [
1759
- /* @__PURE__ */ e.jsx("div", { className: "flex flex-wrap gap-1 justify-between", children: /* @__PURE__ */ e.jsxs(bt, { children: [
1760
- /* @__PURE__ */ e.jsxs(M, { value: "parameters", children: [
1761
- "Parameters",
1762
- (C.pathParams.some((o) => o.value !== "") || C.queryParams.some((o) => o.active)) && /* @__PURE__ */ e.jsx("div", { className: "w-2 h-2 rounded-full bg-blue-400 ml-2" })
1763
- ] }),
1764
- /* @__PURE__ */ e.jsxs(M, { value: "headers", children: [
1765
- "Headers",
1766
- C.headers.filter((o) => o.active).length > 0 && /* @__PURE__ */ e.jsx("div", { className: "w-2 h-2 rounded-full bg-blue-400 ml-2" })
1767
- ] }),
1768
- /* @__PURE__ */ e.jsxs(M, { value: "auth", children: [
1769
- "Auth",
1770
- C.identity !== B && /* @__PURE__ */ e.jsx("div", { className: "w-2 h-2 rounded-full bg-blue-400 ml-2" })
1771
- ] }),
1772
- /* @__PURE__ */ e.jsxs(M, { value: "body", children: [
1773
- "Body",
1774
- C.body && /* @__PURE__ */ e.jsx("div", { className: "w-2 h-2 rounded-full bg-blue-400 ml-2" })
1775
- ] })
1776
- ] }) }),
1777
- /* @__PURE__ */ e.jsx(H, { value: "headers", children: /* @__PURE__ */ e.jsx(es, { control: ee, headers: r }) }),
1778
- /* @__PURE__ */ e.jsxs(H, { value: "parameters", children: [
1779
- l.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4 my-4", children: [
1780
- /* @__PURE__ */ e.jsx("span", { className: "font-semibold", children: "Path Parameters" }),
1781
- /* @__PURE__ */ e.jsx(ss, { url: s, control: ee })
1782
- ] }),
1783
- /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4 my-4", children: [
1784
- /* @__PURE__ */ e.jsx("span", { className: "font-semibold", children: "Query Parameters" }),
1785
- /* @__PURE__ */ e.jsx(rs, { control: ee, queryParams: i })
1786
- ] })
1787
- ] }),
1788
- /* @__PURE__ */ e.jsxs(H, { value: "body", children: [
1789
- !["POST", "PUT", "PATCH", "DELETE"].includes(
1790
- a.toUpperCase()
1791
- ) && /* @__PURE__ */ e.jsxs(Se, { className: "mb-2", children: [
1792
- /* @__PURE__ */ e.jsx(nt, { className: "w-4 h-4" }),
1793
- /* @__PURE__ */ e.jsx(Te, { children: "Body" }),
1794
- /* @__PURE__ */ e.jsx($e, { children: "Body is only supported for POST, PUT, PATCH, and DELETE requests" })
1795
- ] }),
1796
- /* @__PURE__ */ e.jsx(
1797
- Ct,
1798
- {
1799
- ...Ge("body"),
1800
- className: g(
1801
- "border w-full rounded-lg bg-muted/40 p-2 h-64 font-mono text-[13px]",
1802
- !te && "h-20 bg-muted"
1803
- ),
1804
- placeholder: te ? void 0 : "This request does not support a body",
1805
- disabled: !te
1806
- }
1807
- ),
1808
- te && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 mt-2 justify-between", children: [
1809
- /* @__PURE__ */ e.jsxs(
1810
- je,
1811
- {
1812
- value: C.bodyContentType,
1813
- onValueChange: (o) => V(
1814
- "bodyContentType",
1815
- o
1816
- ),
1817
- children: [
1818
- /* @__PURE__ */ e.jsx(be, { className: "w-[100px]", children: /* @__PURE__ */ e.jsx(Ne, {}) }),
1819
- /* @__PURE__ */ e.jsx(we, { children: Object.keys(ve).map((o) => /* @__PURE__ */ e.jsx(U, { value: o, children: o }, o)) })
1820
- ]
1821
- }
1822
- ),
1823
- c && c.length > 0 && /* @__PURE__ */ e.jsx(
1824
- Zn,
1825
- {
1826
- examples: c,
1827
- onSelect: (o, S) => {
1828
- var F;
1829
- V(
1830
- "body",
1831
- JSON.stringify(o.value, null, 2)
1832
- );
1833
- const O = (F = mn(ve).find(
1834
- ([P, z]) => z === S
1835
- )) == null ? void 0 : F[0];
1836
- O && V("bodyContentType", O);
1837
- }
1838
- }
1839
- )
1840
- ] })
1841
- ] }),
1842
- /* @__PURE__ */ e.jsx(H, { value: "auth", children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4 my-4", children: [
1843
- ((Xe = y.data) == null ? void 0 : Xe.length) === 0 && /* @__PURE__ */ e.jsxs(Se, { children: [
1844
- /* @__PURE__ */ e.jsx(nt, { className: "w-4 h-4" }),
1845
- /* @__PURE__ */ e.jsx(Te, { children: "Authentication" }),
1846
- /* @__PURE__ */ e.jsx($e, { children: "No identities found. Please create an identity first." })
1847
- ] }),
1848
- /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center gap-2", children: /* @__PURE__ */ e.jsx(
1849
- Rt,
1850
- {
1851
- value: C.identity,
1852
- identities: y.data ?? [],
1853
- setValue: (o) => V("identity", o)
1854
- }
1855
- ) })
1856
- ] }) })
1857
- ] })
1858
- ] }),
1859
- /* @__PURE__ */ e.jsx(
1860
- vs,
1861
- {
1862
- queryMutation: ue,
1863
- showPathParamsWarning: C.pathParams.some(
1864
- (o) => o.value === ""
1865
- ),
1866
- showLongRunningWarning: K,
1867
- onCancel: () => {
1868
- var o;
1869
- (o = Y.current) == null || o.abort(
1870
- "Request cancelled by the user"
1871
- ), E(!1);
1872
- }
1873
- }
1874
- )
1875
- ] })
1876
- ]
1877
- }
1878
- )
1879
- }
1880
- );
1881
- }, Ns = ({
1882
- className: t,
1883
- size: n = 16
1884
- }) => /* @__PURE__ */ e.jsx(
1885
- "svg",
1886
- {
1887
- xmlns: "http://www.w3.org/2000/svg",
1888
- viewBox: "0 0 24 24",
1889
- fill: "currentColor",
1890
- className: t,
1891
- width: n,
1892
- height: n,
1893
- children: /* @__PURE__ */ e.jsx(
1894
- "path",
1895
- {
1896
- fillRule: "evenodd",
1897
- d: "M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm14.024-.983a1.125 1.125 0 0 1 0 1.966l-5.603 3.113A1.125 1.125 0 0 1 9 15.113V8.887c0-.857.921-1.4 1.671-.983l5.603 3.113Z",
1898
- clipRule: "evenodd"
1899
- }
1900
- )
1901
- }
1902
- ), ws = (t) => {
1903
- const [n, s] = k(!1);
1904
- return /* @__PURE__ */ e.jsxs(Pe, { onOpenChange: (a) => s(a), children: [
1905
- /* @__PURE__ */ e.jsx(on, { asChild: !0, children: t.children ?? /* @__PURE__ */ e.jsxs(
1906
- "button",
1907
- {
1908
- type: "button",
1909
- className: "flex gap-1 items-center px-2 py-1 rounded-md transition text-xs bg-primary text-primary-foreground shadow-sm hover:bg-primary/80",
1910
- children: [
1911
- "Test",
1912
- /* @__PURE__ */ e.jsx(Ns, { size: 14 })
1913
- ]
1914
- }
1915
- ) }),
1916
- /* @__PURE__ */ e.jsxs(
1917
- ke,
1918
- {
1919
- className: "max-w-screen-xl w-full h-5/6 overflow-hidden p-0",
1920
- "aria-describedby": void 0,
1921
- children: [
1922
- /* @__PURE__ */ e.jsx(nn, { children: /* @__PURE__ */ e.jsx(Ie, { children: "Playground" }) }),
1923
- n && /* @__PURE__ */ e.jsx(bs, { ...t })
1924
- ]
1925
- }
1926
- )
1927
- ] });
1928
- }, Cs = {
1929
- get: "green",
1930
- post: "blue",
1931
- put: "yellow",
1932
- delete: "red",
1933
- patch: "purple",
1934
- options: "gray",
1935
- head: "gray"
1936
- }, pt = ({
1937
- label: t,
1938
- path: n,
1939
- operations: s,
1940
- collapsible: a,
1941
- collapsed: r
1942
- }) => ({
1943
- type: "category",
1944
- label: t,
1945
- link: {
1946
- type: "doc",
1947
- id: n,
1948
- label: t
1949
- },
1950
- collapsible: a,
1951
- collapsed: r,
1952
- items: s.map((i) => ({
1953
- type: "link",
1954
- label: i.summary ?? i.path,
1955
- href: `${n}#${i.slug}`,
1956
- badge: {
1957
- label: i.method,
1958
- color: Cs[i.method.toLowerCase()],
1959
- invert: !0
1960
- }
1961
- }))
1962
- }), ht = (t) => ({
1963
- path: t.routePath,
1964
- async lazy() {
1965
- const { OasProvider: n } = await import("./OasProvider-DOs0v9u7.js");
1966
- return {
1967
- element: /* @__PURE__ */ e.jsx(
1968
- n,
1969
- {
1970
- basePath: t.basePath,
1971
- version: t.version,
1972
- client: t.client,
1973
- config: t.config
1974
- }
1975
- )
1976
- };
1977
- },
1978
- children: t.routes
1979
- }), He = ({
1980
- path: t,
1981
- tag: n,
1982
- untagged: s
1983
- }) => ({
1984
- path: t,
1985
- async lazy() {
1986
- const { OperationList: a } = await import("./OperationList-CKac6iap.js");
1987
- return { element: /* @__PURE__ */ e.jsx(a, { tag: n, untagged: s }) };
1988
- }
1989
- }), Ot = (t) => [
1990
- // Category without tagged operations
1991
- He({
1992
- path: R(t, _e),
1993
- untagged: !0
1994
- }),
1995
- // Schema list route
1996
- {
1997
- path: R(t, "~schemas"),
1998
- lazy: async () => {
1999
- const { SchemaList: n } = await import("./SchemaList-BTX2mRMW.js");
2000
- return { element: /* @__PURE__ */ e.jsx(n, {}) };
2001
- }
2002
- }
2003
- ], Ss = (t, n) => {
2004
- const s = R(t, n.at(0) ?? _e);
2005
- return [
2006
- // Redirect to first tag on the index route
2007
- { index: !0, loader: () => Zt(s) },
2008
- // Create routes for each tag
2009
- ...n.map(
2010
- (a) => He({
2011
- path: R(t, a),
2012
- tag: a
2013
- })
2014
- ),
2015
- ...Ot(t)
2016
- ];
2017
- }, qt = (t) => t.type === "file" ? Object.keys(t.input) : [], Ts = ({
2018
- basePath: t,
2019
- config: n,
2020
- client: s
2021
- }) => {
2022
- const a = n.tagPages;
2023
- if (!a)
2024
- return [
2025
- ht({
2026
- basePath: t,
2027
- routePath: t,
2028
- routes: [
2029
- He({ path: t + "/:tag?" }),
2030
- ...Ot(t)
2031
- ],
2032
- client: s,
2033
- config: n
2034
- })
2035
- ];
2036
- const r = qt(n);
2037
- return (r.length > 1 ? [void 0, ...r] : [void 0]).map((l) => {
2038
- const d = R(t, l);
2039
- return ht({
2040
- basePath: t,
2041
- version: l,
2042
- routePath: d,
2043
- routes: Ss(d, a),
2044
- client: s,
2045
- config: n
2046
- });
2047
- });
2048
- }, $s = Vn(`
2049
- query GetSidebarOperations($input: JSON!, $type: SchemaType!) {
2050
- schema(input: $input, type: $type) {
2051
- tags {
2052
- slug
2053
- name
2054
- extensions
2055
- operations {
2056
- summary
2057
- slug
2058
- method
2059
- operationId
2060
- path
2061
- }
2062
- }
2063
- components {
2064
- schemas {
2065
- __typename
2066
- }
2067
- }
2068
- }
2069
- }
2070
- `), _e = "~endpoints", aa = (t) => {
2071
- const n = R(t.navigationId ?? "/reference"), s = new kn(t);
2072
- return {
2073
- getHead: () => {
2074
- if (t.type === "url" && !t.skipPreload)
2075
- return /* @__PURE__ */ e.jsx(
2076
- "link",
2077
- {
2078
- rel: "preload",
2079
- href: t.input,
2080
- as: "fetch",
2081
- crossOrigin: "anonymous"
2082
- }
2083
- );
2084
- if (t.server)
2085
- return /* @__PURE__ */ e.jsx("link", { rel: "preconnect", href: t.server });
2086
- },
2087
- getMdxComponents: () => ({
2088
- OpenPlaygroundButton: ({
2089
- requireAuth: a,
2090
- server: r,
2091
- method: i,
2092
- url: l,
2093
- children: d,
2094
- ...c
2095
- }) => {
2096
- const u = en();
2097
- if (!r)
2098
- throw new Error("Server is required");
2099
- return a && !u.isAuthenticated ? /* @__PURE__ */ e.jsxs(
2100
- W,
2101
- {
2102
- className: "gap-2 items-center",
2103
- variant: "outline",
2104
- onClick: u.login,
2105
- children: [
2106
- "Login to open in Playground ",
2107
- /* @__PURE__ */ e.jsx(Qt, { size: 16 })
2108
- ]
2109
- }
2110
- ) : /* @__PURE__ */ e.jsx(
2111
- ws,
2112
- {
2113
- url: l ?? "/",
2114
- method: i ?? "get",
2115
- server: r,
2116
- ...c,
2117
- children: /* @__PURE__ */ e.jsx(W, { className: "gap-2 items-center", variant: "outline", children: d ?? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2118
- "Open in Playground ",
2119
- /* @__PURE__ */ e.jsx(Wt, { size: 16 })
2120
- ] }) })
2121
- }
2122
- );
2123
- }
2124
- }),
2125
- getSidebar: async (a, r) => {
2126
- var l, d, c, u;
2127
- if (!st({ path: n, end: !1 }, a))
2128
- return [];
2129
- const i = st(
2130
- { path: `${n}/:version?/:tag`, end: !0 },
2131
- a
2132
- );
2133
- try {
2134
- const x = i == null ? void 0 : i.params.version, w = x ?? qt(t).at(0), { type: v } = t, p = v === "file" ? t.input[w] : t.input, f = await r.queryClient.ensureQueryData({
2135
- queryKey: ["sidebar-operations-query", p],
2136
- queryFn: () => s.fetch($s, { type: v, input: p })
2137
- }), m = f.schema.tags.flatMap((h) => {
2138
- var X, K, E;
2139
- if (!h.name || h.operations.length === 0) return [];
2140
- const T = R(n, x, h.slug), $ = ((X = h.extensions) == null ? void 0 : X["x-zudoku-collapsed"]) ?? !((K = t.options) != null && K.expandAllTags), de = ((E = h.extensions) == null ? void 0 : E["x-zudoku-collapsible"]) ?? !0;
2141
- return pt({
2142
- label: h.name,
2143
- path: T,
2144
- operations: h.operations,
2145
- collapsed: $,
2146
- collapsible: de
2147
- });
2148
- }), y = (l = f.schema.tags.find(
2149
- (h) => !h.name
2150
- )) == null ? void 0 : l.operations;
2151
- return y && m.push(
2152
- pt({
2153
- label: "Other endpoints",
2154
- path: R(n, x, _e),
2155
- operations: y,
2156
- collapsed: !((d = t.options) != null && d.expandAllTags)
2157
- })
2158
- ), (u = (c = f.schema.components) == null ? void 0 : c.schemas) != null && u.length && m.push({
2159
- type: "link",
2160
- label: "Schemas",
2161
- href: R(n, x, "~schemas")
2162
- }), m;
2163
- } catch {
2164
- return [];
2165
- }
2166
- },
2167
- getRoutes: () => Ts({ basePath: n, config: t, client: s })
2168
- };
2169
- };
2170
- export {
2171
- lt as C,
2172
- ws as P,
2173
- _e as U,
2174
- ct as a,
2175
- dt as b,
2176
- Vn as c,
2177
- St as d,
2178
- zn as e,
2179
- qt as g,
2180
- cs as m,
2181
- aa as o,
2182
- _n as u
2183
- };
2184
- //# sourceMappingURL=index-DuB48L78.js.map