@djangocfg/ui-tools 2.1.91

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 (174) hide show
  1. package/dist/LottiePlayer.client-LBEC2JKY.mjs +161 -0
  2. package/dist/LottiePlayer.client-LBEC2JKY.mjs.map +1 -0
  3. package/dist/LottiePlayer.client-WFMG2OOW.cjs +168 -0
  4. package/dist/LottiePlayer.client-WFMG2OOW.cjs.map +1 -0
  5. package/dist/Mermaid.client-4TU2TSH3.mjs +477 -0
  6. package/dist/Mermaid.client-4TU2TSH3.mjs.map +1 -0
  7. package/dist/Mermaid.client-SBYY364Q.cjs +483 -0
  8. package/dist/Mermaid.client-SBYY364Q.cjs.map +1 -0
  9. package/dist/PlaygroundLayout-3YVSAEAF.cjs +1003 -0
  10. package/dist/PlaygroundLayout-3YVSAEAF.cjs.map +1 -0
  11. package/dist/PlaygroundLayout-4DYBORAS.mjs +996 -0
  12. package/dist/PlaygroundLayout-4DYBORAS.mjs.map +1 -0
  13. package/dist/PrettyCode.client-LCBPPTIX.mjs +152 -0
  14. package/dist/PrettyCode.client-LCBPPTIX.mjs.map +1 -0
  15. package/dist/PrettyCode.client-PNPLXRH6.cjs +154 -0
  16. package/dist/PrettyCode.client-PNPLXRH6.cjs.map +1 -0
  17. package/dist/chunk-37ZI6VD4.mjs +12 -0
  18. package/dist/chunk-37ZI6VD4.mjs.map +1 -0
  19. package/dist/chunk-3HK2OE62.cjs +81 -0
  20. package/dist/chunk-3HK2OE62.cjs.map +1 -0
  21. package/dist/chunk-7DGDQVQW.cjs +591 -0
  22. package/dist/chunk-7DGDQVQW.cjs.map +1 -0
  23. package/dist/chunk-M6P2FU7L.mjs +572 -0
  24. package/dist/chunk-M6P2FU7L.mjs.map +1 -0
  25. package/dist/chunk-UQ3XI5MY.cjs +15 -0
  26. package/dist/chunk-UQ3XI5MY.cjs.map +1 -0
  27. package/dist/chunk-YFRNE2IR.mjs +79 -0
  28. package/dist/chunk-YFRNE2IR.mjs.map +1 -0
  29. package/dist/index.cjs +5042 -0
  30. package/dist/index.cjs.map +1 -0
  31. package/dist/index.d.cts +1591 -0
  32. package/dist/index.d.ts +1591 -0
  33. package/dist/index.mjs +4941 -0
  34. package/dist/index.mjs.map +1 -0
  35. package/package.json +86 -0
  36. package/src/components/markdown/MarkdownMessage.tsx +340 -0
  37. package/src/components/markdown/index.ts +5 -0
  38. package/src/index.ts +26 -0
  39. package/src/stores/index.ts +9 -0
  40. package/src/stores/mediaCache.ts +534 -0
  41. package/src/tools/AudioPlayer/README.md +206 -0
  42. package/src/tools/AudioPlayer/components/HybridAudioPlayer.tsx +216 -0
  43. package/src/tools/AudioPlayer/components/HybridSimplePlayer.tsx +280 -0
  44. package/src/tools/AudioPlayer/components/HybridWaveform.tsx +279 -0
  45. package/src/tools/AudioPlayer/components/ReactiveCover/AudioReactiveCover.tsx +149 -0
  46. package/src/tools/AudioPlayer/components/ReactiveCover/effects/GlowEffect.tsx +110 -0
  47. package/src/tools/AudioPlayer/components/ReactiveCover/effects/MeshEffect.tsx +58 -0
  48. package/src/tools/AudioPlayer/components/ReactiveCover/effects/OrbsEffect.tsx +45 -0
  49. package/src/tools/AudioPlayer/components/ReactiveCover/effects/SpotlightEffect.tsx +82 -0
  50. package/src/tools/AudioPlayer/components/ReactiveCover/effects/index.ts +8 -0
  51. package/src/tools/AudioPlayer/components/ReactiveCover/index.ts +6 -0
  52. package/src/tools/AudioPlayer/components/index.ts +22 -0
  53. package/src/tools/AudioPlayer/context/HybridAudioProvider.tsx +158 -0
  54. package/src/tools/AudioPlayer/context/index.ts +16 -0
  55. package/src/tools/AudioPlayer/effects/index.ts +412 -0
  56. package/src/tools/AudioPlayer/hooks/index.ts +35 -0
  57. package/src/tools/AudioPlayer/hooks/useHybridAudio.ts +387 -0
  58. package/src/tools/AudioPlayer/hooks/useHybridAudioAnalysis.ts +95 -0
  59. package/src/tools/AudioPlayer/hooks/useVisualization.tsx +207 -0
  60. package/src/tools/AudioPlayer/index.ts +133 -0
  61. package/src/tools/AudioPlayer/types/effects.ts +73 -0
  62. package/src/tools/AudioPlayer/types/index.ts +27 -0
  63. package/src/tools/AudioPlayer/utils/debug.ts +14 -0
  64. package/src/tools/AudioPlayer/utils/formatTime.ts +10 -0
  65. package/src/tools/AudioPlayer/utils/index.ts +6 -0
  66. package/src/tools/ImageViewer/@refactoring/00-PLAN.md +71 -0
  67. package/src/tools/ImageViewer/@refactoring/01-TYPES.md +121 -0
  68. package/src/tools/ImageViewer/@refactoring/02-UTILS.md +143 -0
  69. package/src/tools/ImageViewer/@refactoring/03-HOOKS.md +261 -0
  70. package/src/tools/ImageViewer/@refactoring/04-COMPONENTS.md +427 -0
  71. package/src/tools/ImageViewer/@refactoring/05-EXECUTION-CHECKLIST.md +126 -0
  72. package/src/tools/ImageViewer/README.md +200 -0
  73. package/src/tools/ImageViewer/components/ImageInfo.tsx +44 -0
  74. package/src/tools/ImageViewer/components/ImageToolbar.tsx +145 -0
  75. package/src/tools/ImageViewer/components/ImageViewer.tsx +241 -0
  76. package/src/tools/ImageViewer/components/index.ts +7 -0
  77. package/src/tools/ImageViewer/hooks/index.ts +9 -0
  78. package/src/tools/ImageViewer/hooks/useImageLoading.ts +204 -0
  79. package/src/tools/ImageViewer/hooks/useImageTransform.ts +101 -0
  80. package/src/tools/ImageViewer/index.ts +60 -0
  81. package/src/tools/ImageViewer/types.ts +81 -0
  82. package/src/tools/ImageViewer/utils/constants.ts +59 -0
  83. package/src/tools/ImageViewer/utils/debug.ts +14 -0
  84. package/src/tools/ImageViewer/utils/index.ts +17 -0
  85. package/src/tools/ImageViewer/utils/lqip.ts +47 -0
  86. package/src/tools/JsonForm/JsonSchemaForm.tsx +197 -0
  87. package/src/tools/JsonForm/examples/BotConfigExample.tsx +249 -0
  88. package/src/tools/JsonForm/examples/RealBotConfigExample.tsx +161 -0
  89. package/src/tools/JsonForm/index.ts +46 -0
  90. package/src/tools/JsonForm/templates/ArrayFieldItemTemplate.tsx +47 -0
  91. package/src/tools/JsonForm/templates/ArrayFieldTemplate.tsx +74 -0
  92. package/src/tools/JsonForm/templates/BaseInputTemplate.tsx +107 -0
  93. package/src/tools/JsonForm/templates/ErrorListTemplate.tsx +35 -0
  94. package/src/tools/JsonForm/templates/FieldTemplate.tsx +62 -0
  95. package/src/tools/JsonForm/templates/ObjectFieldTemplate.tsx +116 -0
  96. package/src/tools/JsonForm/templates/index.ts +12 -0
  97. package/src/tools/JsonForm/types.ts +83 -0
  98. package/src/tools/JsonForm/utils.ts +213 -0
  99. package/src/tools/JsonForm/widgets/CheckboxWidget.tsx +37 -0
  100. package/src/tools/JsonForm/widgets/ColorWidget.tsx +219 -0
  101. package/src/tools/JsonForm/widgets/NumberWidget.tsx +89 -0
  102. package/src/tools/JsonForm/widgets/SelectWidget.tsx +97 -0
  103. package/src/tools/JsonForm/widgets/SliderWidget.tsx +148 -0
  104. package/src/tools/JsonForm/widgets/SwitchWidget.tsx +35 -0
  105. package/src/tools/JsonForm/widgets/TextWidget.tsx +96 -0
  106. package/src/tools/JsonForm/widgets/index.ts +14 -0
  107. package/src/tools/JsonTree/index.tsx +243 -0
  108. package/src/tools/LottiePlayer/LottiePlayer.client.tsx +213 -0
  109. package/src/tools/LottiePlayer/index.tsx +56 -0
  110. package/src/tools/LottiePlayer/types.ts +108 -0
  111. package/src/tools/LottiePlayer/useLottie.ts +164 -0
  112. package/src/tools/Mermaid/Mermaid.client.tsx +82 -0
  113. package/src/tools/Mermaid/components/MermaidCodeViewer.tsx +95 -0
  114. package/src/tools/Mermaid/components/MermaidFullscreenModal.tsx +103 -0
  115. package/src/tools/Mermaid/hooks/index.ts +4 -0
  116. package/src/tools/Mermaid/hooks/useMermaidCleanup.ts +73 -0
  117. package/src/tools/Mermaid/hooks/useMermaidFullscreen.ts +46 -0
  118. package/src/tools/Mermaid/hooks/useMermaidRenderer.ts +226 -0
  119. package/src/tools/Mermaid/hooks/useMermaidValidation.ts +29 -0
  120. package/src/tools/Mermaid/index.tsx +44 -0
  121. package/src/tools/Mermaid/utils/mermaid-helpers.ts +33 -0
  122. package/src/tools/OpenapiViewer/components/EndpointInfo.tsx +149 -0
  123. package/src/tools/OpenapiViewer/components/EndpointsLibrary.tsx +263 -0
  124. package/src/tools/OpenapiViewer/components/PlaygroundLayout.tsx +125 -0
  125. package/src/tools/OpenapiViewer/components/PlaygroundStepper.tsx +100 -0
  126. package/src/tools/OpenapiViewer/components/RequestBuilder.tsx +157 -0
  127. package/src/tools/OpenapiViewer/components/RequestParametersForm.tsx +253 -0
  128. package/src/tools/OpenapiViewer/components/ResponseViewer.tsx +173 -0
  129. package/src/tools/OpenapiViewer/components/VersionSelector.tsx +68 -0
  130. package/src/tools/OpenapiViewer/components/index.ts +14 -0
  131. package/src/tools/OpenapiViewer/constants.ts +39 -0
  132. package/src/tools/OpenapiViewer/context/PlaygroundContext.tsx +337 -0
  133. package/src/tools/OpenapiViewer/hooks/index.ts +8 -0
  134. package/src/tools/OpenapiViewer/hooks/useMobile.ts +10 -0
  135. package/src/tools/OpenapiViewer/hooks/useOpenApiSchema.ts +199 -0
  136. package/src/tools/OpenapiViewer/index.tsx +37 -0
  137. package/src/tools/OpenapiViewer/types.ts +151 -0
  138. package/src/tools/OpenapiViewer/utils/apiKeyManager.ts +149 -0
  139. package/src/tools/OpenapiViewer/utils/formatters.ts +71 -0
  140. package/src/tools/OpenapiViewer/utils/index.ts +9 -0
  141. package/src/tools/OpenapiViewer/utils/versionManager.ts +161 -0
  142. package/src/tools/PrettyCode/PrettyCode.client.tsx +208 -0
  143. package/src/tools/PrettyCode/index.tsx +47 -0
  144. package/src/tools/VideoPlayer/@refactoring/00-PLAN.md +91 -0
  145. package/src/tools/VideoPlayer/@refactoring/01-TYPES.md +284 -0
  146. package/src/tools/VideoPlayer/@refactoring/02-UTILS.md +141 -0
  147. package/src/tools/VideoPlayer/@refactoring/03-HOOKS.md +178 -0
  148. package/src/tools/VideoPlayer/@refactoring/04-COMPONENTS.md +95 -0
  149. package/src/tools/VideoPlayer/@refactoring/05-EXECUTION-CHECKLIST.md +139 -0
  150. package/src/tools/VideoPlayer/README.md +264 -0
  151. package/src/tools/VideoPlayer/components/VideoControls.tsx +138 -0
  152. package/src/tools/VideoPlayer/components/VideoErrorFallback.tsx +172 -0
  153. package/src/tools/VideoPlayer/components/VideoPlayer.tsx +201 -0
  154. package/src/tools/VideoPlayer/components/index.ts +14 -0
  155. package/src/tools/VideoPlayer/context/VideoPlayerContext.tsx +52 -0
  156. package/src/tools/VideoPlayer/context/index.ts +8 -0
  157. package/src/tools/VideoPlayer/hooks/index.ts +12 -0
  158. package/src/tools/VideoPlayer/hooks/useVideoPlayerSettings.ts +70 -0
  159. package/src/tools/VideoPlayer/hooks/useVideoPositionCache.ts +116 -0
  160. package/src/tools/VideoPlayer/index.ts +77 -0
  161. package/src/tools/VideoPlayer/providers/NativeProvider.tsx +284 -0
  162. package/src/tools/VideoPlayer/providers/StreamProvider.tsx +505 -0
  163. package/src/tools/VideoPlayer/providers/VidstackProvider.tsx +400 -0
  164. package/src/tools/VideoPlayer/providers/index.ts +8 -0
  165. package/src/tools/VideoPlayer/types/index.ts +38 -0
  166. package/src/tools/VideoPlayer/types/player.ts +116 -0
  167. package/src/tools/VideoPlayer/types/provider.ts +93 -0
  168. package/src/tools/VideoPlayer/types/sources.ts +97 -0
  169. package/src/tools/VideoPlayer/utils/debug.ts +14 -0
  170. package/src/tools/VideoPlayer/utils/fileSource.ts +78 -0
  171. package/src/tools/VideoPlayer/utils/index.ts +12 -0
  172. package/src/tools/VideoPlayer/utils/resolvers.ts +75 -0
  173. package/src/tools/_shared.ts +29 -0
  174. package/src/tools/index.ts +172 -0
@@ -0,0 +1,1003 @@
1
+ 'use strict';
2
+
3
+ var chunk7DGDQVQW_cjs = require('./chunk-7DGDQVQW.cjs');
4
+ var chunkUQ3XI5MY_cjs = require('./chunk-UQ3XI5MY.cjs');
5
+ var lucideReact = require('lucide-react');
6
+ var components = require('@djangocfg/ui-core/components');
7
+ var hooks = require('@djangocfg/ui-core/hooks');
8
+ var React = require('react');
9
+ var consola = require('consola');
10
+ var jsxRuntime = require('react/jsx-runtime');
11
+
12
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
+
14
+ var React__default = /*#__PURE__*/_interopDefault(React);
15
+ var consola__default = /*#__PURE__*/_interopDefault(consola);
16
+
17
+ var useMobile = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(() => {
18
+ const isMobile = hooks.useIsMobile();
19
+ return {
20
+ isMobile,
21
+ isDesktop: !isMobile
22
+ };
23
+ }, "useMobile");
24
+ var extractEndpoints = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name((schema) => {
25
+ const endpointMap = /* @__PURE__ */ new Map();
26
+ if (!schema.paths) return [];
27
+ const baseUrl = schema.servers && schema.servers.length > 0 ? schema.servers[0].url : "";
28
+ for (const [path, methods] of Object.entries(schema.paths)) {
29
+ const getOperation = methods.get;
30
+ if (!getOperation) continue;
31
+ const op = getOperation;
32
+ const description = op.description || op.summary || `GET ${path}`;
33
+ const category = op.tags?.[0] || "Other";
34
+ const parameters = [];
35
+ if (op.parameters) {
36
+ for (const param of op.parameters) {
37
+ parameters.push({
38
+ name: param.name,
39
+ type: param.schema?.type || "string",
40
+ required: param.required || false,
41
+ description: param.description
42
+ });
43
+ }
44
+ }
45
+ const responses = [];
46
+ if (op.responses) {
47
+ for (const [code, response] of Object.entries(op.responses)) {
48
+ responses.push({
49
+ code,
50
+ description: response.description || `Response ${code}`
51
+ });
52
+ }
53
+ }
54
+ const endpoint = {
55
+ name: path.split("/").pop() || path,
56
+ method: "GET",
57
+ path: baseUrl + path,
58
+ // Combine baseUrl with path
59
+ description,
60
+ category,
61
+ parameters: parameters.length > 0 ? parameters : void 0,
62
+ requestBody: void 0,
63
+ // GET requests don't have request body
64
+ responses: responses.length > 0 ? responses : void 0
65
+ };
66
+ endpointMap.set(path, endpoint);
67
+ }
68
+ return Array.from(endpointMap.values());
69
+ }, "extractEndpoints");
70
+ var getCategories = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name((endpoints) => {
71
+ const categories = /* @__PURE__ */ new Set();
72
+ endpoints.forEach((endpoint) => categories.add(endpoint.category));
73
+ return Array.from(categories).sort();
74
+ }, "getCategories");
75
+ var fetchSchema = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(async (url) => {
76
+ const response = await fetch(url, {
77
+ headers: {
78
+ "Accept": "application/json"
79
+ }
80
+ });
81
+ if (!response.ok) {
82
+ throw new Error(`Failed to fetch schema: ${response.statusText}`);
83
+ }
84
+ return response.json();
85
+ }, "fetchSchema");
86
+ function useOpenApiSchema({
87
+ schemas,
88
+ defaultSchemaId
89
+ }) {
90
+ const [loading, setLoading] = React.useState(true);
91
+ const [error, setError] = React.useState(null);
92
+ const [currentSchemaId, setCurrentSchemaId] = React.useState(
93
+ defaultSchemaId || schemas[0]?.id
94
+ );
95
+ const [loadedSchemas, setLoadedSchemas] = React.useState(
96
+ /* @__PURE__ */ new Map()
97
+ );
98
+ const currentSchema = React.useMemo(
99
+ () => schemas.find((s) => s.id === currentSchemaId) || null,
100
+ [schemas, currentSchemaId]
101
+ );
102
+ const currentOpenApiSchema = React.useMemo(
103
+ () => currentSchemaId ? loadedSchemas.get(currentSchemaId) : null,
104
+ [loadedSchemas, currentSchemaId]
105
+ );
106
+ const endpoints = React.useMemo(
107
+ () => currentOpenApiSchema ? extractEndpoints(currentOpenApiSchema) : [],
108
+ [currentOpenApiSchema]
109
+ );
110
+ const categories = React.useMemo(() => getCategories(endpoints), [endpoints]);
111
+ React.useEffect(() => {
112
+ if (!currentSchema) return;
113
+ if (loadedSchemas.has(currentSchema.id)) {
114
+ setLoading(false);
115
+ return;
116
+ }
117
+ setLoading(true);
118
+ setError(null);
119
+ fetchSchema(currentSchema.url).then((schema) => {
120
+ setLoadedSchemas((prev) => new Map(prev).set(currentSchema.id, schema));
121
+ consola__default.default.success(`Schema loaded: ${currentSchema.name}`);
122
+ setLoading(false);
123
+ }).catch((err) => {
124
+ consola__default.default.error(`Error loading schema from ${currentSchema.url}:`, err);
125
+ setError(err instanceof Error ? err.message : "Failed to load schema");
126
+ setLoading(false);
127
+ });
128
+ }, [currentSchema, loadedSchemas]);
129
+ const setCurrentSchema = React.useCallback((schemaId) => {
130
+ setCurrentSchemaId(schemaId);
131
+ }, []);
132
+ const refresh = React.useCallback(() => {
133
+ if (!currentSchema) return;
134
+ setLoading(true);
135
+ setError(null);
136
+ setLoadedSchemas((prev) => {
137
+ const next = new Map(prev);
138
+ next.delete(currentSchema.id);
139
+ return next;
140
+ });
141
+ fetchSchema(currentSchema.url).then((schema) => {
142
+ setLoadedSchemas((prev) => new Map(prev).set(currentSchema.id, schema));
143
+ consola__default.default.success(`Schema refreshed: ${currentSchema.name}`);
144
+ setLoading(false);
145
+ }).catch((err) => {
146
+ consola__default.default.error(`Error refreshing schema from ${currentSchema.url}:`, err);
147
+ setError(err instanceof Error ? err.message : "Failed to refresh schema");
148
+ setLoading(false);
149
+ });
150
+ }, [currentSchema]);
151
+ return {
152
+ loading,
153
+ error,
154
+ endpoints,
155
+ categories,
156
+ schemas,
157
+ currentSchema,
158
+ setCurrentSchema,
159
+ refresh
160
+ };
161
+ }
162
+ chunkUQ3XI5MY_cjs.__name(useOpenApiSchema, "useOpenApiSchema");
163
+ var VersionSelector = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(() => {
164
+ const { state, config, setSelectedVersion } = chunk7DGDQVQW_cjs.usePlaygroundContext();
165
+ const { endpoints } = useOpenApiSchema({
166
+ schemas: config.schemas,
167
+ defaultSchemaId: config.defaultSchemaId
168
+ });
169
+ const currentVersion = chunk7DGDQVQW_cjs.getVersionById(state.selectedVersion);
170
+ const versionStats = chunk7DGDQVQW_cjs.getVersionStats(endpoints);
171
+ const handleVersionChange = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name((versionId) => {
172
+ setSelectedVersion(versionId);
173
+ }, "handleVersionChange");
174
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-3", children: [
175
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
176
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.GitBranch, { className: "h-4 w-4 text-muted-foreground" }),
177
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: "API Version:" })
178
+ ] }),
179
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Select, { value: state.selectedVersion, onValueChange: handleVersionChange, children: [
180
+ /* @__PURE__ */ jsxRuntime.jsx(components.SelectTrigger, { className: "w-48", children: /* @__PURE__ */ jsxRuntime.jsx(components.SelectValue, {}) }),
181
+ /* @__PURE__ */ jsxRuntime.jsx(components.SelectContent, { children: chunk7DGDQVQW_cjs.API_VERSIONS.map((version) => /* @__PURE__ */ jsxRuntime.jsx(components.SelectItem, { value: version.id, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between w-full", children: [
182
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
183
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: version.name }),
184
+ version.isDefault && /* @__PURE__ */ jsxRuntime.jsx(components.Badge, { variant: "secondary", className: "text-xs", children: "Default" })
185
+ ] }),
186
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground ml-2", children: [
187
+ versionStats[version.id] || 0,
188
+ " endpoints"
189
+ ] })
190
+ ] }) }, version.id)) })
191
+ ] }),
192
+ currentVersion && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-1 text-xs text-muted-foreground", children: [
193
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { className: "h-3 w-3" }),
194
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: currentVersion.description })
195
+ ] })
196
+ ] });
197
+ }, "VersionSelector");
198
+ var categoryIcons = {
199
+ "Authentication": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Shield, { className: "h-4 w-4" }),
200
+ "Users": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Users, { className: "h-4 w-4" }),
201
+ "Data": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Database, { className: "h-4 w-4" }),
202
+ "Analytics": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BarChart3, { className: "h-4 w-4" }),
203
+ "Files": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "h-4 w-4" }),
204
+ "Settings": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings, { className: "h-4 w-4" }),
205
+ "Other": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Code, { className: "h-4 w-4" })
206
+ };
207
+ var EndpointsLibrary = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(() => {
208
+ const { state, config, setSelectedEndpoint, setSelectedCategory, setSearchTerm } = chunk7DGDQVQW_cjs.usePlaygroundContext();
209
+ const { endpoints, categories, loading, error } = useOpenApiSchema({
210
+ schemas: config.schemas,
211
+ defaultSchemaId: config.defaultSchemaId
212
+ });
213
+ const [viewMode, setViewMode] = React__default.default.useState("table");
214
+ const getRelativePath = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name((fullPath) => {
215
+ try {
216
+ const url = new URL(fullPath);
217
+ return url.pathname;
218
+ } catch {
219
+ return fullPath;
220
+ }
221
+ }, "getRelativePath");
222
+ const filteredEndpoints = React.useMemo(() => {
223
+ let filtered = chunk7DGDQVQW_cjs.deduplicateEndpoints(endpoints, state.selectedVersion);
224
+ if (state.selectedCategory && state.selectedCategory !== "All") {
225
+ filtered = filtered.filter((endpoint) => endpoint.category === state.selectedCategory);
226
+ }
227
+ if (state.searchTerm) {
228
+ const searchLower = state.searchTerm.toLowerCase();
229
+ filtered = filtered.filter(
230
+ (endpoint) => endpoint.name.toLowerCase().includes(searchLower) || endpoint.description.toLowerCase().includes(searchLower) || endpoint.path.toLowerCase().includes(searchLower)
231
+ );
232
+ }
233
+ return filtered;
234
+ }, [endpoints, state.selectedCategory, state.searchTerm, state.selectedVersion]);
235
+ const handleEndpointSelect = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name((endpoint) => {
236
+ setSelectedEndpoint(endpoint);
237
+ }, "handleEndpointSelect");
238
+ const getMethodBadges = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name((methods) => {
239
+ return methods.split(", ").map((method) => /* @__PURE__ */ jsxRuntime.jsx(components.Badge, { variant: chunk7DGDQVQW_cjs.getMethodColor(method) === "success" ? "default" : "secondary", className: "text-xs", children: method }, method));
240
+ }, "getMethodBadges");
241
+ if (loading) {
242
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
243
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
244
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-foreground", children: "API Endpoints" }),
245
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
246
+ /* @__PURE__ */ jsxRuntime.jsx(components.Skeleton, { className: "h-8 w-32" }),
247
+ /* @__PURE__ */ jsxRuntime.jsx(components.Skeleton, { className: "h-8 w-48" })
248
+ ] })
249
+ ] }),
250
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(components.Skeleton, { className: "h-20 w-full" }, i)) })
251
+ ] });
252
+ }
253
+ if (error) {
254
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
255
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-foreground", children: "API Endpoints" }) }),
256
+ /* @__PURE__ */ jsxRuntime.jsx(components.Card, { className: "bg-destructive/10 border-destructive/20", children: /* @__PURE__ */ jsxRuntime.jsx(components.CardContent, { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-destructive", children: [
257
+ "Error loading endpoints: ",
258
+ error
259
+ ] }) }) })
260
+ ] });
261
+ }
262
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
263
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
264
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-center justify-between gap-4", children: [
265
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-foreground", children: "API Endpoints" }),
266
+ /* @__PURE__ */ jsxRuntime.jsx(VersionSelector, {})
267
+ ] }),
268
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col sm:flex-row sm:items-center justify-between gap-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
269
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center border rounded-md", children: [
270
+ /* @__PURE__ */ jsxRuntime.jsx(
271
+ components.Button,
272
+ {
273
+ variant: viewMode === "table" ? "default" : "ghost",
274
+ size: "sm",
275
+ onClick: () => setViewMode("table"),
276
+ className: "rounded-r-none",
277
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.List, { className: "h-4 w-4" })
278
+ }
279
+ ),
280
+ /* @__PURE__ */ jsxRuntime.jsx(
281
+ components.Button,
282
+ {
283
+ variant: viewMode === "grid" ? "default" : "ghost",
284
+ size: "sm",
285
+ onClick: () => setViewMode("grid"),
286
+ className: "rounded-l-none",
287
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Grid3X3, { className: "h-4 w-4" })
288
+ }
289
+ )
290
+ ] }),
291
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Select, { value: state.selectedCategory, onValueChange: setSelectedCategory, children: [
292
+ /* @__PURE__ */ jsxRuntime.jsxs(components.SelectTrigger, { className: "w-32", children: [
293
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Filter, { className: "h-4 w-4 mr-2" }),
294
+ /* @__PURE__ */ jsxRuntime.jsx(components.SelectValue, {})
295
+ ] }),
296
+ /* @__PURE__ */ jsxRuntime.jsxs(components.SelectContent, { children: [
297
+ /* @__PURE__ */ jsxRuntime.jsx(components.SelectItem, { value: "All", children: "All" }),
298
+ categories.map((category) => /* @__PURE__ */ jsxRuntime.jsx(components.SelectItem, { value: category, children: category }, category))
299
+ ] })
300
+ ] }),
301
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
302
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
303
+ /* @__PURE__ */ jsxRuntime.jsx(
304
+ components.Input,
305
+ {
306
+ placeholder: "Search endpoints...",
307
+ value: state.searchTerm,
308
+ onChange: (e) => setSearchTerm(e.target.value),
309
+ className: "w-48 pl-8"
310
+ }
311
+ )
312
+ ] })
313
+ ] }) })
314
+ ] }),
315
+ viewMode === "table" ? /* @__PURE__ */ jsxRuntime.jsx(components.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(components.Table, { children: [
316
+ /* @__PURE__ */ jsxRuntime.jsx(components.TableHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(components.TableRow, { children: [
317
+ /* @__PURE__ */ jsxRuntime.jsx(components.TableHead, { className: "text-foreground", children: "Methods" }),
318
+ /* @__PURE__ */ jsxRuntime.jsx(components.TableHead, { className: "text-foreground", children: "Path" }),
319
+ /* @__PURE__ */ jsxRuntime.jsx(components.TableHead, { className: "text-foreground", children: "Description" })
320
+ ] }) }),
321
+ /* @__PURE__ */ jsxRuntime.jsx(components.TableBody, { children: filteredEndpoints.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(components.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(components.TableCell, { colSpan: 3, className: "text-center py-8 text-muted-foreground", children: "No endpoints found" }) }) : filteredEndpoints.map((endpoint) => /* @__PURE__ */ jsxRuntime.jsxs(
322
+ components.TableRow,
323
+ {
324
+ className: `cursor-pointer transition-colors hover:bg-muted/50 ${state.selectedEndpoint?.path === endpoint.path ? "bg-primary/10" : ""}`,
325
+ onClick: () => handleEndpointSelect(endpoint),
326
+ children: [
327
+ /* @__PURE__ */ jsxRuntime.jsx(components.TableCell, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex space-x-1", children: getMethodBadges(endpoint.method) }) }),
328
+ /* @__PURE__ */ jsxRuntime.jsx(components.TableCell, { className: "font-mono text-sm text-muted-foreground", children: getRelativePath(endpoint.path) }),
329
+ /* @__PURE__ */ jsxRuntime.jsx(components.TableCell, { className: "text-sm text-muted-foreground max-w-xs truncate", children: endpoint.description })
330
+ ]
331
+ },
332
+ `${endpoint.method}-${endpoint.path}`
333
+ )) })
334
+ ] }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: filteredEndpoints.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-full text-center py-8 text-muted-foreground", children: "No endpoints found" }) : filteredEndpoints.map((endpoint) => /* @__PURE__ */ jsxRuntime.jsxs(
335
+ components.Card,
336
+ {
337
+ className: `cursor-pointer transition-all hover:shadow-md ${state.selectedEndpoint?.path === endpoint.path ? "ring-2 ring-primary" : ""}`,
338
+ onClick: () => handleEndpointSelect(endpoint),
339
+ children: [
340
+ /* @__PURE__ */ jsxRuntime.jsx(components.CardHeader, { className: "pb-3", children: /* @__PURE__ */ jsxRuntime.jsxs(components.CardTitle, { className: "flex items-center justify-between text-sm", children: [
341
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
342
+ categoryIcons[endpoint.category] || /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Code, { className: "h-4 w-4" }),
343
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: endpoint.name })
344
+ ] }),
345
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex space-x-1", children: getMethodBadges(endpoint.method) })
346
+ ] }) }),
347
+ /* @__PURE__ */ jsxRuntime.jsxs(components.CardContent, { className: "space-y-2", children: [
348
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-mono text-muted-foreground break-all", children: getRelativePath(endpoint.path) }),
349
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground line-clamp-2", children: endpoint.description })
350
+ ] })
351
+ ]
352
+ },
353
+ `${endpoint.method}-${endpoint.path}`
354
+ )) })
355
+ ] });
356
+ }, "EndpointsLibrary");
357
+ var stepConfig = {
358
+ endpoints: {
359
+ title: "Endpoints",
360
+ icon: lucideReact.Code,
361
+ description: "Select API endpoint"
362
+ },
363
+ request: {
364
+ title: "Request",
365
+ icon: lucideReact.Send,
366
+ description: "Configure request"
367
+ },
368
+ response: {
369
+ title: "Response",
370
+ icon: lucideReact.FileText,
371
+ description: "View response"
372
+ }
373
+ };
374
+ var PlaygroundStepper = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(() => {
375
+ const { state, setCurrentStep, goToNextStep, goToPreviousStep } = chunk7DGDQVQW_cjs.usePlaygroundContext();
376
+ const { currentStep, steps } = state;
377
+ const currentIndex = steps.indexOf(currentStep);
378
+ const canGoNext = currentIndex < steps.length - 1;
379
+ const canGoPrevious = currentIndex > 0;
380
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between p-4 border-b", children: [
381
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center space-x-4", children: steps.map((step, index) => {
382
+ const config = stepConfig[step];
383
+ const Icon = config.icon;
384
+ const isActive = step === currentStep;
385
+ const isCompleted = index < currentIndex;
386
+ const isClickable = index <= currentIndex + 1;
387
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
388
+ /* @__PURE__ */ jsxRuntime.jsxs(
389
+ components.Button,
390
+ {
391
+ variant: isActive ? "default" : "ghost",
392
+ size: "sm",
393
+ onClick: () => isClickable && setCurrentStep(step),
394
+ className: `flex items-center space-x-2 ${isClickable ? "cursor-pointer" : "cursor-not-allowed opacity-50"}`,
395
+ disabled: !isClickable,
396
+ children: [
397
+ isCompleted ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "h-4 w-4" }),
398
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: config.title })
399
+ ]
400
+ }
401
+ ),
402
+ index < steps.length - 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-8 h-px bg-border" })
403
+ ] }, step);
404
+ }) }),
405
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
406
+ /* @__PURE__ */ jsxRuntime.jsxs(
407
+ components.Button,
408
+ {
409
+ variant: "outline",
410
+ size: "sm",
411
+ onClick: goToPreviousStep,
412
+ disabled: !canGoPrevious,
413
+ className: "flex items-center space-x-1",
414
+ children: [
415
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "h-4 w-4" }),
416
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: "Previous" })
417
+ ]
418
+ }
419
+ ),
420
+ /* @__PURE__ */ jsxRuntime.jsxs(
421
+ components.Button,
422
+ {
423
+ variant: "outline",
424
+ size: "sm",
425
+ onClick: goToNextStep,
426
+ disabled: !canGoNext,
427
+ className: "flex items-center space-x-1",
428
+ children: [
429
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: "Next" }),
430
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" })
431
+ ]
432
+ }
433
+ )
434
+ ] })
435
+ ] });
436
+ }, "PlaygroundStepper");
437
+ var EndpointInfo = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(() => {
438
+ const { state } = chunk7DGDQVQW_cjs.usePlaygroundContext();
439
+ const { selectedEndpoint } = state;
440
+ const endpointJson = React.useMemo(() => {
441
+ if (!selectedEndpoint) return "";
442
+ return JSON.stringify({
443
+ name: selectedEndpoint.name,
444
+ method: selectedEndpoint.method,
445
+ path: selectedEndpoint.path,
446
+ description: selectedEndpoint.description,
447
+ parameters: selectedEndpoint.parameters,
448
+ requestBody: selectedEndpoint.requestBody,
449
+ responses: selectedEndpoint.responses
450
+ }, null, 2);
451
+ }, [selectedEndpoint]);
452
+ if (!selectedEndpoint) {
453
+ return null;
454
+ }
455
+ const getMethodBadges = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name((methods) => {
456
+ return methods.split(", ").map((method) => /* @__PURE__ */ jsxRuntime.jsx(components.Badge, { variant: chunk7DGDQVQW_cjs.getMethodColor(method) === "success" ? "default" : "secondary", className: "text-xs", children: method }, method));
457
+ }, "getMethodBadges");
458
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
459
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
460
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-foreground", children: "Selected Endpoint" }),
461
+ /* @__PURE__ */ jsxRuntime.jsx(components.CopyButton, { value: endpointJson, variant: "outline", size: "sm", children: "Copy" })
462
+ ] }),
463
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Card, { children: [
464
+ /* @__PURE__ */ jsxRuntime.jsx(components.CardHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(components.CardTitle, { className: "flex items-center justify-between text-sm text-foreground", children: [
465
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
466
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Code, { className: "h-4 w-4" }),
467
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: selectedEndpoint.name })
468
+ ] }),
469
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex space-x-1", children: getMethodBadges(selectedEndpoint.method) })
470
+ ] }) }),
471
+ /* @__PURE__ */ jsxRuntime.jsxs(components.CardContent, { className: "space-y-4", children: [
472
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
473
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-mono text-muted-foreground break-all", children: selectedEndpoint.path }),
474
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: selectedEndpoint.description })
475
+ ] }),
476
+ selectedEndpoint.parameters && selectedEndpoint.parameters.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(components.Collapsible, { children: [
477
+ /* @__PURE__ */ jsxRuntime.jsxs(components.CollapsibleTrigger, { className: "flex items-center space-x-2 text-sm font-medium text-foreground", children: [
478
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Database, { className: "h-4 w-4" }),
479
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
480
+ "Parameters (",
481
+ selectedEndpoint.parameters.length,
482
+ ")"
483
+ ] }),
484
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4" })
485
+ ] }),
486
+ /* @__PURE__ */ jsxRuntime.jsx(components.CollapsibleContent, { className: "mt-2 space-y-2", children: selectedEndpoint.parameters.map((param, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2 text-xs", children: [
487
+ /* @__PURE__ */ jsxRuntime.jsx(components.Badge, { variant: param.required ? "destructive" : "secondary", className: "text-xs", children: param.required ? "Required" : "Optional" }),
488
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-mono text-muted-foreground", children: [
489
+ param.name,
490
+ ": ",
491
+ param.type
492
+ ] }),
493
+ param.description && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground", children: [
494
+ "- ",
495
+ param.description
496
+ ] })
497
+ ] }, index)) })
498
+ ] }),
499
+ selectedEndpoint.requestBody && /* @__PURE__ */ jsxRuntime.jsxs(components.Collapsible, { children: [
500
+ /* @__PURE__ */ jsxRuntime.jsxs(components.CollapsibleTrigger, { className: "flex items-center space-x-2 text-sm font-medium text-foreground", children: [
501
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "h-4 w-4" }),
502
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Request Body" }),
503
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4" })
504
+ ] }),
505
+ /* @__PURE__ */ jsxRuntime.jsx(components.CollapsibleContent, { className: "mt-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-muted-foreground", children: [
506
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
507
+ "Type: ",
508
+ selectedEndpoint.requestBody.type
509
+ ] }),
510
+ selectedEndpoint.requestBody.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1", children: selectedEndpoint.requestBody.description })
511
+ ] }) })
512
+ ] }),
513
+ selectedEndpoint.responses && selectedEndpoint.responses.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(components.Collapsible, { children: [
514
+ /* @__PURE__ */ jsxRuntime.jsxs(components.CollapsibleTrigger, { className: "flex items-center space-x-2 text-sm font-medium text-foreground", children: [
515
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-4 w-4" }),
516
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
517
+ "Responses (",
518
+ selectedEndpoint.responses.length,
519
+ ")"
520
+ ] }),
521
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4" })
522
+ ] }),
523
+ /* @__PURE__ */ jsxRuntime.jsx(components.CollapsibleContent, { className: "mt-2 space-y-2", children: selectedEndpoint.responses.map((response, index) => {
524
+ const statusColor = chunk7DGDQVQW_cjs.getStatusColor(parseInt(response.code));
525
+ const badgeVariant = statusColor === "success" ? "default" : statusColor === "error" ? "destructive" : "secondary";
526
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2 text-xs", children: [
527
+ /* @__PURE__ */ jsxRuntime.jsx(components.Badge, { variant: badgeVariant, className: "text-xs", children: response.code }),
528
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: response.description })
529
+ ] }, index);
530
+ }) })
531
+ ] })
532
+ ] })
533
+ ] })
534
+ ] });
535
+ }, "EndpointInfo");
536
+ var RequestParametersForm = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(() => {
537
+ const { state, setParameters } = chunk7DGDQVQW_cjs.usePlaygroundContext();
538
+ const [formData, setFormData] = React.useState({});
539
+ const [activeTab, setActiveTab] = React.useState("required");
540
+ React.useEffect(() => {
541
+ if (state.selectedEndpoint?.parameters) {
542
+ const initialData = {};
543
+ state.selectedEndpoint.parameters.forEach((param) => {
544
+ initialData[param.name] = "";
545
+ });
546
+ setFormData(initialData);
547
+ }
548
+ }, [state.selectedEndpoint?.path, state.selectedEndpoint?.parameters]);
549
+ const handleInputChange = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name((name, value) => {
550
+ const newFormData = {
551
+ ...formData,
552
+ [name]: value
553
+ };
554
+ setFormData(newFormData);
555
+ setParameters(newFormData);
556
+ }, "handleInputChange");
557
+ const handleClearForm = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(() => {
558
+ setFormData({});
559
+ setParameters({});
560
+ }, "handleClearForm");
561
+ const handleGenerateJson = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(() => {
562
+ const hasData = Object.values(formData).some((value) => value !== "" && value !== null && value !== void 0);
563
+ if (hasData) {
564
+ const jsonString = JSON.stringify(formData, null, 2);
565
+ navigator.clipboard.writeText(jsonString);
566
+ }
567
+ }, "handleGenerateJson");
568
+ if (!state.selectedEndpoint) return null;
569
+ const requiredParams = state.selectedEndpoint.parameters?.filter((param) => param.required) || [];
570
+ const optionalParams = state.selectedEndpoint.parameters?.filter((param) => !param.required) || [];
571
+ const hasParameters = (state.selectedEndpoint.parameters?.length || 0) > 0;
572
+ if (!hasParameters) {
573
+ return null;
574
+ }
575
+ const hasFormData = Object.values(formData).some((value) => value !== "" && value !== null && value !== void 0);
576
+ const ParameterField = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(({ param }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
577
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-1", children: [
578
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Label, { htmlFor: param.name, className: "text-xs font-medium text-foreground", children: [
579
+ param.name,
580
+ param.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive ml-1", children: "*" })
581
+ ] }),
582
+ param.description && /* @__PURE__ */ jsxRuntime.jsx(components.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(components.Tooltip, { children: [
583
+ /* @__PURE__ */ jsxRuntime.jsx(components.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.HelpCircle, { className: "h-3 w-3 text-muted-foreground hover:text-foreground cursor-help" }) }),
584
+ /* @__PURE__ */ jsxRuntime.jsx(components.TooltipContent, { side: "top", className: "max-w-xs", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs", children: param.description }) })
585
+ ] }) })
586
+ ] }),
587
+ /* @__PURE__ */ jsxRuntime.jsx(
588
+ components.Input,
589
+ {
590
+ id: param.name,
591
+ value: formData[param.name] || "",
592
+ onChange: (e) => handleInputChange(param.name, e.target.value),
593
+ placeholder: `Enter ${param.name}${param.required ? "" : " (optional)"}`,
594
+ className: "text-sm"
595
+ }
596
+ )
597
+ ] }), "ParameterField");
598
+ const ParametersGrid = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(({ params, title, badgeVariant }) => {
599
+ if (params.length === 0) return null;
600
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
601
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
602
+ /* @__PURE__ */ jsxRuntime.jsx(components.Badge, { variant: badgeVariant, className: "text-xs", children: title }),
603
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground", children: [
604
+ params.length,
605
+ " parameter",
606
+ params.length !== 1 ? "s" : ""
607
+ ] })
608
+ ] }) }),
609
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: params.map((param) => /* @__PURE__ */ jsxRuntime.jsx(ParameterField, { param }, param.name)) })
610
+ ] });
611
+ }, "ParametersGrid");
612
+ return /* @__PURE__ */ jsxRuntime.jsx(components.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(components.Card, { children: [
613
+ /* @__PURE__ */ jsxRuntime.jsx(components.CardHeader, { className: "pb-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
614
+ /* @__PURE__ */ jsxRuntime.jsx(components.CardTitle, { className: "text-sm text-foreground", children: "Request Parameters" }),
615
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
616
+ hasFormData && /* @__PURE__ */ jsxRuntime.jsx(
617
+ components.Button,
618
+ {
619
+ variant: "default",
620
+ size: "sm",
621
+ onClick: handleGenerateJson,
622
+ className: "text-xs",
623
+ children: "Copy JSON"
624
+ }
625
+ ),
626
+ /* @__PURE__ */ jsxRuntime.jsx(
627
+ components.Button,
628
+ {
629
+ variant: "outline",
630
+ size: "sm",
631
+ onClick: handleClearForm,
632
+ className: "text-xs",
633
+ children: "Clear"
634
+ }
635
+ )
636
+ ] })
637
+ ] }) }),
638
+ /* @__PURE__ */ jsxRuntime.jsxs(components.CardContent, { className: "space-y-4", children: [
639
+ requiredParams.length + optionalParams.length > 10 ? /* @__PURE__ */ jsxRuntime.jsxs(components.Tabs, { value: activeTab, onValueChange: setActiveTab, children: [
640
+ /* @__PURE__ */ jsxRuntime.jsxs(components.TabsList, { className: "grid w-full grid-cols-2", children: [
641
+ /* @__PURE__ */ jsxRuntime.jsxs(components.TabsTrigger, { value: "required", className: "text-xs", children: [
642
+ "Required (",
643
+ requiredParams.length,
644
+ ")"
645
+ ] }),
646
+ /* @__PURE__ */ jsxRuntime.jsxs(components.TabsTrigger, { value: "optional", className: "text-xs", children: [
647
+ "Optional (",
648
+ optionalParams.length,
649
+ ")"
650
+ ] })
651
+ ] }),
652
+ /* @__PURE__ */ jsxRuntime.jsx(components.TabsContent, { value: "required", className: "space-y-4", children: /* @__PURE__ */ jsxRuntime.jsx(
653
+ ParametersGrid,
654
+ {
655
+ params: requiredParams,
656
+ title: "Required",
657
+ badgeVariant: "destructive"
658
+ }
659
+ ) }),
660
+ /* @__PURE__ */ jsxRuntime.jsx(components.TabsContent, { value: "optional", className: "space-y-4", children: /* @__PURE__ */ jsxRuntime.jsx(
661
+ ParametersGrid,
662
+ {
663
+ params: optionalParams,
664
+ title: "Optional",
665
+ badgeVariant: "secondary"
666
+ }
667
+ ) })
668
+ ] }) : (
669
+ /* Use Accordion for smaller parameter sets */
670
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Accordion, { type: "multiple", defaultValue: requiredParams.length > 0 ? ["required"] : ["optional"], children: [
671
+ requiredParams.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(components.AccordionItem, { value: "required", children: [
672
+ /* @__PURE__ */ jsxRuntime.jsx(components.AccordionTrigger, { className: "text-sm text-foreground", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
673
+ /* @__PURE__ */ jsxRuntime.jsx(components.Badge, { variant: "destructive", className: "text-xs", children: "Required" }),
674
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground", children: [
675
+ requiredParams.length,
676
+ " parameter",
677
+ requiredParams.length !== 1 ? "s" : ""
678
+ ] })
679
+ ] }) }),
680
+ /* @__PURE__ */ jsxRuntime.jsx(components.AccordionContent, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 pt-2", children: requiredParams.map((param) => /* @__PURE__ */ jsxRuntime.jsx(ParameterField, { param }, param.name)) }) })
681
+ ] }),
682
+ optionalParams.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(components.AccordionItem, { value: "optional", children: [
683
+ /* @__PURE__ */ jsxRuntime.jsx(components.AccordionTrigger, { className: "text-sm text-foreground", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
684
+ /* @__PURE__ */ jsxRuntime.jsx(components.Badge, { variant: "secondary", className: "text-xs", children: "Optional" }),
685
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground", children: [
686
+ optionalParams.length,
687
+ " parameter",
688
+ optionalParams.length !== 1 ? "s" : ""
689
+ ] })
690
+ ] }) }),
691
+ /* @__PURE__ */ jsxRuntime.jsx(components.AccordionContent, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 pt-2", children: optionalParams.map((param) => /* @__PURE__ */ jsxRuntime.jsx(ParameterField, { param }, param.name)) }) })
692
+ ] })
693
+ ] })
694
+ ),
695
+ hasFormData && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 mt-6 pt-4 border-t", children: [
696
+ /* @__PURE__ */ jsxRuntime.jsx(components.Label, { className: "text-xs text-foreground", children: "Generated JSON" }),
697
+ /* @__PURE__ */ jsxRuntime.jsx(
698
+ components.Textarea,
699
+ {
700
+ value: JSON.stringify(formData, null, 2),
701
+ readOnly: true,
702
+ className: "text-xs font-mono",
703
+ rows: 4
704
+ }
705
+ ),
706
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: 'Click "Copy JSON" to copy this to clipboard, then paste it into the Request Body field above.' })
707
+ ] })
708
+ ] })
709
+ ] }) });
710
+ }, "RequestParametersForm");
711
+ var RequestBuilder = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(() => {
712
+ const {
713
+ state,
714
+ apiKeys,
715
+ setRequestBody,
716
+ setManualApiToken,
717
+ sendRequest
718
+ } = chunk7DGDQVQW_cjs.usePlaygroundContext();
719
+ const isJsonValid = state.requestBody ? chunk7DGDQVQW_cjs.isValidJson(state.requestBody) : true;
720
+ const generateCurlCommand = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(() => {
721
+ if (!state.requestUrl) return "";
722
+ const apiKey = state.selectedApiKey ? chunk7DGDQVQW_cjs.findApiKeyById(apiKeys, state.selectedApiKey) : null;
723
+ const headers = chunk7DGDQVQW_cjs.parseRequestHeaders(state.requestHeaders);
724
+ if (apiKey) {
725
+ headers["X-API-Key"] = apiKey.id || "";
726
+ }
727
+ let curl = `curl -X ${state.requestMethod} "${state.requestUrl}"`;
728
+ Object.entries(headers).forEach(([key, value]) => {
729
+ curl += ` \\
730
+ -H "${key}: ${value}"`;
731
+ });
732
+ if (state.requestBody && state.requestMethod !== "GET" && isJsonValid) {
733
+ curl += ` \\
734
+ -d '${state.requestBody}'`;
735
+ }
736
+ return curl;
737
+ }, "generateCurlCommand");
738
+ const curlCommand = generateCurlCommand();
739
+ const handleSendRequest = React.useCallback(async () => {
740
+ await sendRequest();
741
+ }, [sendRequest]);
742
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
743
+ state.selectedEndpoint && /* @__PURE__ */ jsxRuntime.jsx(EndpointInfo, {}),
744
+ state.selectedEndpoint && /* @__PURE__ */ jsxRuntime.jsx(RequestParametersForm, {}),
745
+ state.requestMethod !== "GET" && /* @__PURE__ */ jsxRuntime.jsxs(components.Card, { className: "", children: [
746
+ /* @__PURE__ */ jsxRuntime.jsx(components.CardHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(components.CardTitle, { className: "text-sm text-foreground", children: "Request Body" }) }),
747
+ /* @__PURE__ */ jsxRuntime.jsxs(components.CardContent, { children: [
748
+ /* @__PURE__ */ jsxRuntime.jsx(
749
+ components.Textarea,
750
+ {
751
+ placeholder: '{\\n "key": "value"\\n}',
752
+ value: state.requestBody,
753
+ onChange: (e) => setRequestBody(e.target.value),
754
+ className: `font-mono text-sm ${!isJsonValid ? "border-destructive" : ""}`,
755
+ rows: 6
756
+ }
757
+ ),
758
+ !isJsonValid && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-xs text-destructive", children: "Invalid JSON format" })
759
+ ] })
760
+ ] }),
761
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Card, { className: "", children: [
762
+ /* @__PURE__ */ jsxRuntime.jsx(components.CardHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(components.CardTitle, { className: "flex items-center space-x-2 text-sm text-foreground", children: [
763
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Key, { className: "h-4 w-4" }),
764
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Bearer Token" })
765
+ ] }) }),
766
+ /* @__PURE__ */ jsxRuntime.jsx(components.CardContent, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-center gap-2", children: [
767
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
768
+ /* @__PURE__ */ jsxRuntime.jsx(
769
+ components.Input,
770
+ {
771
+ type: "password",
772
+ placeholder: "Enter Bearer token (optional, uses JWT if empty)",
773
+ value: state.manualApiToken,
774
+ onChange: (e) => setManualApiToken(e.target.value),
775
+ className: "font-mono text-sm"
776
+ }
777
+ ),
778
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Leave empty to use JWT token from localStorage" })
779
+ ] }),
780
+ /* @__PURE__ */ jsxRuntime.jsx(
781
+ components.Button,
782
+ {
783
+ onClick: handleSendRequest,
784
+ disabled: state.loading || !state.requestUrl || !isJsonValid,
785
+ className: "bg-primary hover:bg-primary/90 text-primary-foreground flex items-center gap-2",
786
+ children: state.loading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
787
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin" }),
788
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: "Sending..." })
789
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
790
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Send, { className: "h-4 w-4" }),
791
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: "Send Request" })
792
+ ] })
793
+ }
794
+ )
795
+ ] }) })
796
+ ] }),
797
+ curlCommand && /* @__PURE__ */ jsxRuntime.jsxs(components.Card, { children: [
798
+ /* @__PURE__ */ jsxRuntime.jsx(components.CardHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
799
+ /* @__PURE__ */ jsxRuntime.jsx(components.CardTitle, { className: "text-sm text-foreground", children: "cURL Command" }),
800
+ /* @__PURE__ */ jsxRuntime.jsx(
801
+ components.CopyButton,
802
+ {
803
+ value: curlCommand,
804
+ variant: "outline",
805
+ size: "sm",
806
+ children: "Copy cURL"
807
+ }
808
+ )
809
+ ] }) }),
810
+ /* @__PURE__ */ jsxRuntime.jsx(components.CardContent, { children: /* @__PURE__ */ jsxRuntime.jsx(chunk7DGDQVQW_cjs.PrettyCode_default, { data: curlCommand, language: "bash" }) })
811
+ ] })
812
+ ] });
813
+ }, "RequestBuilder");
814
+ var ResponseViewer = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(() => {
815
+ const { state } = chunk7DGDQVQW_cjs.usePlaygroundContext();
816
+ const { response } = state;
817
+ const responseText = React.useMemo(() => {
818
+ if (!response?.data) return "";
819
+ return typeof response.data === "string" ? response.data : JSON.stringify(response.data, null, 2);
820
+ }, [response?.data]);
821
+ const handleDownloadResponse = React.useCallback(() => {
822
+ if (!responseText) return;
823
+ const blob = new Blob([responseText], { type: "application/json" });
824
+ const url = URL.createObjectURL(blob);
825
+ const a = document.createElement("a");
826
+ a.href = url;
827
+ a.download = "response.json";
828
+ document.body.appendChild(a);
829
+ a.click();
830
+ document.body.removeChild(a);
831
+ URL.revokeObjectURL(url);
832
+ }, [responseText]);
833
+ if (!response) {
834
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
835
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-foreground", children: "Response" }) }),
836
+ /* @__PURE__ */ jsxRuntime.jsx(components.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(components.CardContent, { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "No response yet. Send a request to see the response here." }) }) })
837
+ ] });
838
+ }
839
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
840
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
841
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-foreground", children: "Response" }),
842
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
843
+ /* @__PURE__ */ jsxRuntime.jsx(components.CopyButton, { value: responseText, variant: "outline", size: "sm", children: "Copy" }),
844
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Button, { variant: "outline", size: "sm", onClick: handleDownloadResponse, children: [
845
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Download, { className: "h-4 w-4" }),
846
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: "Download" })
847
+ ] })
848
+ ] })
849
+ ] }),
850
+ /* @__PURE__ */ jsxRuntime.jsxs(components.Card, { children: [
851
+ /* @__PURE__ */ jsxRuntime.jsx(components.CardHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(components.CardTitle, { className: "text-sm text-foreground", children: "Response Information" }) }),
852
+ /* @__PURE__ */ jsxRuntime.jsxs(components.CardContent, { className: "space-y-4", children: [
853
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
854
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
855
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
856
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: "Status Code:" }),
857
+ /* @__PURE__ */ jsxRuntime.jsx(
858
+ components.Badge,
859
+ {
860
+ variant: chunk7DGDQVQW_cjs.getStatusColor(response.status || 0) === "success" ? "default" : chunk7DGDQVQW_cjs.getStatusColor(response.status || 0) === "error" ? "destructive" : "secondary",
861
+ className: "text-xs",
862
+ children: response.status
863
+ }
864
+ )
865
+ ] }),
866
+ response.statusText && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
867
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: "Status Text:" }),
868
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: response.statusText })
869
+ ] })
870
+ ] }),
871
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
872
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
873
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: "Response Type:" }),
874
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: typeof response.data === "string" ? "Text" : "JSON" })
875
+ ] }),
876
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
877
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: "Data Size:" }),
878
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-muted-foreground", children: [
879
+ typeof response.data === "string" ? response.data.length : JSON.stringify(response.data).length,
880
+ " chars"
881
+ ] })
882
+ ] })
883
+ ] })
884
+ ] }),
885
+ response.error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-destructive/10 border border-destructive/20 rounded p-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
886
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: "h-4 w-4 text-destructive" }),
887
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: response.error })
888
+ ] }) })
889
+ ] })
890
+ ] }),
891
+ /* @__PURE__ */ jsxRuntime.jsx(components.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(components.CardContent, { className: "p-0", children: (() => {
892
+ const is404 = response.status === 404;
893
+ const isNonJson = typeof response.data === "string";
894
+ if (is404 || isNonJson) {
895
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-8 text-center", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: is404 ? "Response body hidden for 404 Not Found status" : "Response body hidden for non-JSON responses" }) });
896
+ }
897
+ if (response.data) {
898
+ return /* @__PURE__ */ jsxRuntime.jsx(
899
+ chunk7DGDQVQW_cjs.JsonTree_default,
900
+ {
901
+ title: "Response Body",
902
+ data: response.data,
903
+ config: {
904
+ // Smart defaults for API responses
905
+ maxAutoExpandDepth: 2,
906
+ maxAutoExpandArrayItems: 10,
907
+ maxAutoExpandObjectKeys: 5,
908
+ maxStringLength: 200,
909
+ collectionLimit: 50,
910
+ showCollectionInfo: true,
911
+ showExpandControls: true,
912
+ showActionButtons: false,
913
+ // We have our own copy/download buttons above
914
+ preserveKeyOrder: true,
915
+ className: "border-0 rounded-none"
916
+ }
917
+ }
918
+ );
919
+ }
920
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-8 text-center", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "No response body available" }) });
921
+ })() }) })
922
+ ] });
923
+ }, "ResponseViewer");
924
+ var PlaygroundLayout = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(() => {
925
+ const { state, setSidebarOpen } = chunk7DGDQVQW_cjs.usePlaygroundContext();
926
+ const { isMobile } = useMobile();
927
+ const renderStepContent = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(() => {
928
+ switch (state.currentStep) {
929
+ case "endpoints":
930
+ return /* @__PURE__ */ jsxRuntime.jsx(EndpointsLibrary, {});
931
+ case "request":
932
+ return /* @__PURE__ */ jsxRuntime.jsx(RequestBuilder, {});
933
+ case "response":
934
+ return /* @__PURE__ */ jsxRuntime.jsx(ResponseViewer, {});
935
+ default:
936
+ return /* @__PURE__ */ jsxRuntime.jsx(EndpointsLibrary, {});
937
+ }
938
+ }, "renderStepContent");
939
+ const getStepTitle = /* @__PURE__ */ chunkUQ3XI5MY_cjs.__name(() => {
940
+ switch (state.currentStep) {
941
+ case "endpoints":
942
+ return "API Endpoints";
943
+ case "request":
944
+ return "Request Builder";
945
+ case "response":
946
+ return "Response Viewer";
947
+ default:
948
+ return "API Playground";
949
+ }
950
+ }, "getStepTitle");
951
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-h-screen", children: [
952
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "container mx-auto px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
953
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-4", children: [
954
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-bold text-foreground", children: "API Playground" }),
955
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground hidden sm:block", children: "Test and explore API endpoints" })
956
+ ] }),
957
+ isMobile && /* @__PURE__ */ jsxRuntime.jsxs(components.Sheet, { open: state.sidebarOpen, onOpenChange: setSidebarOpen, children: [
958
+ /* @__PURE__ */ jsxRuntime.jsx(components.SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(components.Button, { variant: "outline", size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { className: "h-4 w-4" }) }) }),
959
+ /* @__PURE__ */ jsxRuntime.jsx(components.SheetContent, { side: "left", className: "w-80", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
960
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
961
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-foreground", children: "Navigation" }),
962
+ /* @__PURE__ */ jsxRuntime.jsx(
963
+ components.Button,
964
+ {
965
+ variant: "ghost",
966
+ size: "sm",
967
+ onClick: () => setSidebarOpen(false),
968
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" })
969
+ }
970
+ )
971
+ ] }),
972
+ /* @__PURE__ */ jsxRuntime.jsx(PlaygroundStepper, {})
973
+ ] }) })
974
+ ] })
975
+ ] }) }) }),
976
+ !isMobile && /* @__PURE__ */ jsxRuntime.jsx(PlaygroundStepper, {}),
977
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "container mx-auto px-6 py-6", children: [
978
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
979
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-bold text-foreground", children: getStepTitle() }),
980
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground mt-1", children: [
981
+ state.currentStep === "endpoints" && "Browse and select API endpoints",
982
+ state.currentStep === "request" && "Configure your API request",
983
+ state.currentStep === "response" && "View API response and details"
984
+ ] })
985
+ ] }),
986
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-6", children: renderStepContent() })
987
+ ] }),
988
+ isMobile && state.currentStep === "request" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "fixed bottom-4 right-4 z-50", children: /* @__PURE__ */ jsxRuntime.jsx(
989
+ components.Button,
990
+ {
991
+ size: "lg",
992
+ className: "rounded-full shadow-lg",
993
+ onClick: () => {
994
+ },
995
+ children: "Send Request"
996
+ }
997
+ ) })
998
+ ] });
999
+ }, "PlaygroundLayout");
1000
+
1001
+ exports.PlaygroundLayout = PlaygroundLayout;
1002
+ //# sourceMappingURL=PlaygroundLayout-3YVSAEAF.cjs.map
1003
+ //# sourceMappingURL=PlaygroundLayout-3YVSAEAF.cjs.map