@motiadev/plugin-endpoint 0.17.6-beta.188-977165 → 0.17.6-beta.188-259338

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.
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import { c } from "react/compiler-runtime";
2
1
  import { BackgroundEffect, Badge, Button, Checkbox, Input, Panel, Sidebar, Tabs, TabsContent, TabsList, TabsTrigger, cn, useThemeStore } from "@motiadev/ui";
3
2
  import { Fragment, memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
4
3
  import { AlertCircle, Book, Check, ChevronDown, CircleX, Copy, Download, Loader2, Plus, Search, Trash2, X } from "lucide-react";
@@ -15,78 +14,31 @@ import { Prism } from "react-syntax-highlighter";
15
14
  import { atomDark, oneLight } from "react-syntax-highlighter/dist/esm/styles/prism";
16
15
 
17
16
  //#region src/components/endpoints-search.tsx
18
- const EndpointsSearch = (t0) => {
19
- const $ = c(16);
20
- if ($[0] !== "b04fe9fcf2dc81964e7b2f3a7fac01e0ffd66006443485e8e32bf9d2d88776cf") {
21
- for (let $i = 0; $i < 16; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
22
- $[0] = "b04fe9fcf2dc81964e7b2f3a7fac01e0ffd66006443485e8e32bf9d2d88776cf";
23
- }
24
- const { value, onChange, onClear } = t0;
25
- let t1;
26
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
27
- t1 = /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50" });
28
- $[1] = t1;
29
- } else t1 = $[1];
30
- let t2;
31
- if ($[2] !== onChange) {
32
- t2 = (e) => onChange(e.target.value);
33
- $[2] = onChange;
34
- $[3] = t2;
35
- } else t2 = $[3];
36
- let t3;
37
- if ($[4] !== t2 || $[5] !== value) {
38
- t3 = /* @__PURE__ */ jsx(Input, {
39
- variant: "shade",
40
- value,
41
- onChange: t2,
42
- className: "px-9! font-medium",
43
- placeholder: "Search by Method or Path"
44
- });
45
- $[4] = t2;
46
- $[5] = value;
47
- $[6] = t3;
48
- } else t3 = $[6];
49
- const t4 = value !== "";
50
- const t5 = value === "";
51
- let t6;
52
- if ($[7] !== t4 || $[8] !== t5) {
53
- t6 = cn("cursor-pointer absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50 hover:text-muted-foreground", {
54
- visible: t4,
55
- invisible: t5
56
- });
57
- $[7] = t4;
58
- $[8] = t5;
59
- $[9] = t6;
60
- } else t6 = $[9];
61
- let t7;
62
- if ($[10] !== onClear || $[11] !== t6) {
63
- t7 = /* @__PURE__ */ jsx(X, {
64
- className: t6,
65
- onClick: onClear
66
- });
67
- $[10] = onClear;
68
- $[11] = t6;
69
- $[12] = t7;
70
- } else t7 = $[12];
71
- let t8;
72
- if ($[13] !== t3 || $[14] !== t7) {
73
- t8 = /* @__PURE__ */ jsx("div", {
74
- className: "p-2 border-b gap-4",
75
- "data-testid": "endpoints-search-container",
76
- children: /* @__PURE__ */ jsxs("div", {
77
- className: "relative",
78
- children: [
79
- t1,
80
- t3,
81
- t7
82
- ]
83
- })
84
- });
85
- $[13] = t3;
86
- $[14] = t7;
87
- $[15] = t8;
88
- } else t8 = $[15];
89
- return t8;
17
+ const EndpointsSearch = ({ value, onChange, onClear }) => {
18
+ return /* @__PURE__ */ jsx("div", {
19
+ className: "p-2 border-b gap-4",
20
+ "data-testid": "endpoints-search-container",
21
+ children: /* @__PURE__ */ jsxs("div", {
22
+ className: "relative",
23
+ children: [
24
+ /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50" }),
25
+ /* @__PURE__ */ jsx(Input, {
26
+ variant: "shade",
27
+ value,
28
+ onChange: (e) => onChange(e.target.value),
29
+ className: "px-9! font-medium",
30
+ placeholder: "Search by Method or Path"
31
+ }),
32
+ /* @__PURE__ */ jsx(X, {
33
+ className: cn("cursor-pointer absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50 hover:text-muted-foreground", {
34
+ visible: value !== "",
35
+ invisible: value === ""
36
+ }),
37
+ onClick: onClear
38
+ })
39
+ ]
40
+ })
41
+ });
90
42
  };
91
43
 
92
44
  //#endregion
@@ -103,378 +55,129 @@ const getMethodStyles = (method) => {
103
55
  default: return "bg-[#258DC3]/15 text-[#258DC3]";
104
56
  }
105
57
  };
106
- const EndpointBadge = memo((t0) => {
107
- const $ = c(11);
108
- if ($[0] !== "1017d069da7af8d79b772819cd6ea273bc02186be5bf8c70750727fd63506daa") {
109
- for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
110
- $[0] = "1017d069da7af8d79b772819cd6ea273bc02186be5bf8c70750727fd63506daa";
111
- }
112
- let className;
113
- let props;
114
- let variant;
115
- if ($[1] !== t0) {
116
- ({className, variant, ...props} = t0);
117
- $[1] = t0;
118
- $[2] = className;
119
- $[3] = props;
120
- $[4] = variant;
121
- } else {
122
- className = $[2];
123
- props = $[3];
124
- variant = $[4];
125
- }
126
- let t1;
127
- if ($[5] !== className || $[6] !== variant) {
128
- t1 = cn("rounded-lg px-2 py-0.5 text-xs font-mono font-bold transition-colors", getMethodStyles(variant), className);
129
- $[5] = className;
130
- $[6] = variant;
131
- $[7] = t1;
132
- } else t1 = $[7];
133
- let t2;
134
- if ($[8] !== props || $[9] !== t1) {
135
- t2 = /* @__PURE__ */ jsx("div", {
136
- className: t1,
137
- ...props
138
- });
139
- $[8] = props;
140
- $[9] = t1;
141
- $[10] = t2;
142
- } else t2 = $[10];
143
- return t2;
58
+ const EndpointBadge = memo(({ className, variant, ...props }) => {
59
+ return /* @__PURE__ */ jsx("div", {
60
+ className: cn("rounded-lg px-2 py-0.5 text-xs font-mono font-bold transition-colors", getMethodStyles(variant), className),
61
+ ...props
62
+ });
144
63
  });
145
64
 
146
65
  //#endregion
147
66
  //#region src/components/endpoint-path.tsx
148
67
  const PathSeparator = () => {
149
- const $ = c(2);
150
- if ($[0] !== "603f796b38bb9b15093370b94bc9b921b7621c9f6baa94432316d5a5ca450c9c") {
151
- for (let $i = 0; $i < 2; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
152
- $[0] = "603f796b38bb9b15093370b94bc9b921b7621c9f6baa94432316d5a5ca450c9c";
153
- }
154
- let t0;
155
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
156
- t0 = /* @__PURE__ */ jsx("div", {
157
- className: "text-muted-foreground",
158
- children: "/"
159
- });
160
- $[1] = t0;
161
- } else t0 = $[1];
162
- return t0;
68
+ return /* @__PURE__ */ jsx("div", {
69
+ className: "text-muted-foreground",
70
+ children: "/"
71
+ });
163
72
  };
164
- const EndpointPath = (t0) => {
165
- const $ = c(14);
166
- if ($[0] !== "603f796b38bb9b15093370b94bc9b921b7621c9f6baa94432316d5a5ca450c9c") {
167
- for (let $i = 0; $i < 14; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
168
- $[0] = "603f796b38bb9b15093370b94bc9b921b7621c9f6baa94432316d5a5ca450c9c";
169
- }
170
- const { method, path } = t0;
171
- let t1;
172
- if ($[1] !== path) {
73
+ const EndpointPath = ({ method, path }) => {
74
+ const pathView = useMemo(() => {
173
75
  const parts = path.split("/").filter(Boolean);
174
76
  const partsLength = parts.length - 1;
175
- let t2$1;
176
- if ($[3] !== partsLength) {
177
- t2$1 = (part, index) => {
178
- const isLast = index === partsLength;
179
- const key = `part-${part}-${index}`;
180
- const separator = isLast ? void 0 : /* @__PURE__ */ jsx(PathSeparator, {}, `separator-${key}`);
181
- if (part.startsWith(":")) return [/* @__PURE__ */ jsx("div", {
182
- className: "bg-[#2862FE]/20 text-[#2862FE] rounded-sm px-1 py-0.5 text-sm font-mono font-bold font-medium",
183
- children: part
184
- }, key), separator];
185
- return [/* @__PURE__ */ jsx("div", { children: part }, key), separator];
186
- };
187
- $[3] = partsLength;
188
- $[4] = t2$1;
189
- } else t2$1 = $[4];
190
- t1 = parts.flatMap(t2$1);
191
- $[1] = path;
192
- $[2] = t1;
193
- } else t1 = $[2];
194
- const pathView = t1;
195
- const t2 = method;
196
- let t3;
197
- if ($[5] !== method || $[6] !== t2) {
198
- t3 = /* @__PURE__ */ jsx(EndpointBadge, {
199
- variant: t2,
200
- children: method
77
+ return parts.flatMap((part, index) => {
78
+ const isLast = index === partsLength;
79
+ const key = `part-${part}-${index}`;
80
+ const separator = isLast ? void 0 : /* @__PURE__ */ jsx(PathSeparator, {}, `separator-${key}`);
81
+ if (part.startsWith(":")) return [/* @__PURE__ */ jsx("div", {
82
+ className: "bg-[#2862FE]/20 text-[#2862FE] rounded-sm px-1 py-0.5 text-sm font-mono font-bold font-medium",
83
+ children: part
84
+ }, key), separator];
85
+ return [/* @__PURE__ */ jsx("div", { children: part }, key), separator];
201
86
  });
202
- $[5] = method;
203
- $[6] = t2;
204
- $[7] = t3;
205
- } else t3 = $[7];
206
- let t4;
207
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
208
- t4 = /* @__PURE__ */ jsx(PathSeparator, {});
209
- $[8] = t4;
210
- } else t4 = $[8];
211
- let t5;
212
- if ($[9] !== pathView) {
213
- t5 = /* @__PURE__ */ jsxs("span", {
87
+ }, [path]);
88
+ return /* @__PURE__ */ jsxs("div", {
89
+ className: "grid grid-cols-[auto_1fr] gap-2 items-center",
90
+ children: [/* @__PURE__ */ jsx(EndpointBadge, {
91
+ variant: method,
92
+ children: method
93
+ }), /* @__PURE__ */ jsxs("span", {
214
94
  className: "font-mono font-bold whitespace-nowrap flex flex-row gap-2 items-center truncate",
215
- children: [t4, pathView]
216
- });
217
- $[9] = pathView;
218
- $[10] = t5;
219
- } else t5 = $[10];
220
- let t6;
221
- if ($[11] !== t3 || $[12] !== t5) {
222
- t6 = /* @__PURE__ */ jsxs("div", {
223
- className: "grid grid-cols-[auto_1fr] gap-2 items-center",
224
- children: [t3, t5]
225
- });
226
- $[11] = t3;
227
- $[12] = t5;
228
- $[13] = t6;
229
- } else t6 = $[13];
230
- return t6;
95
+ children: [/* @__PURE__ */ jsx(PathSeparator, {}), pathView]
96
+ })]
97
+ });
231
98
  };
232
99
 
233
100
  //#endregion
234
101
  //#region src/components/endpoint-item.tsx
235
- const EndpointItem = (t0) => {
236
- const $ = c(22);
237
- if ($[0] !== "29651f7b7dd25cd15fa149793a83da8eadabea6c1b2d872f1881f15627da1c3a") {
238
- for (let $i = 0; $i < 22; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
239
- $[0] = "29651f7b7dd25cd15fa149793a83da8eadabea6c1b2d872f1881f15627da1c3a";
240
- }
241
- const { endpoint, isSelected, isLast, onSelect } = t0;
242
- const t1 = `endpoint-${endpoint.method}-${endpoint.path}`;
243
- let t2;
244
- if ($[1] !== endpoint.id || $[2] !== onSelect) {
245
- t2 = () => onSelect(endpoint.id);
246
- $[1] = endpoint.id;
247
- $[2] = onSelect;
248
- $[3] = t2;
249
- } else t2 = $[3];
250
- const t3 = isSelected && "bg-muted-foreground/10";
251
- let t4;
252
- if ($[4] !== t3) {
253
- t4 = cn("grid grid-cols-[auto_1fr] items-center justify-center px-[17px] select-none hover:bg-muted-foreground/10 cursor-pointer", t3);
254
- $[4] = t3;
255
- $[5] = t4;
256
- } else t4 = $[5];
257
- let t5;
258
- if ($[6] !== isLast) {
259
- t5 = isLast ? /* @__PURE__ */ jsx("svg", {
260
- width: "14",
261
- height: "34",
262
- viewBox: "0 0 12 34",
263
- fill: "none",
264
- xmlns: "http://www.w3.org/2000/svg",
265
- children: /* @__PURE__ */ jsx("path", {
266
- d: "M6.5 16.5C6.50006 19.2614 8.7386 21.4999 11.5 21.5C11.7759 21.5003 12 21.724 12 22C12 22.276 11.7759 22.4997 11.5 22.5C8.18632 22.4999 5.50006 19.8137 5.5 16.5V0H6.5V16.5Z",
267
- className: "fill-[#555]"
268
- })
269
- }) : /* @__PURE__ */ jsx("svg", {
270
- width: "14",
271
- height: "34",
272
- viewBox: "0 0 12 34",
273
- fill: "none",
274
- xmlns: "http://www.w3.org/2000/svg",
275
- children: /* @__PURE__ */ jsx("path", {
276
- d: "M6.5 0V11.5C6.50007 14.2614 8.73861 16.4999 11.5 16.5C11.7759 16.5003 12 16.724 12 17C12 17.276 11.7759 17.4997 11.5 17.5C9.41273 17.5 7.57486 16.4335 6.5 14.8164V34H5.5V0H6.5Z",
277
- className: "fill-[#555]"
278
- })
279
- });
280
- $[6] = isLast;
281
- $[7] = t5;
282
- } else t5 = $[7];
283
- let t6;
284
- if ($[8] !== endpoint.method || $[9] !== endpoint.path) {
285
- t6 = /* @__PURE__ */ jsx(EndpointPath, {
102
+ const EndpointItem = ({ endpoint, isSelected, isLast, onSelect }) => /* @__PURE__ */ jsxs("div", {
103
+ "data-testid": `endpoint-${endpoint.method}-${endpoint.path}`,
104
+ onClick: () => onSelect(endpoint.id),
105
+ className: cn("grid grid-cols-[auto_1fr] items-center justify-center px-[17px] select-none hover:bg-muted-foreground/10 cursor-pointer", isSelected && "bg-muted-foreground/10"),
106
+ children: [isLast ? /* @__PURE__ */ jsx("svg", {
107
+ width: "14",
108
+ height: "34",
109
+ viewBox: "0 0 12 34",
110
+ fill: "none",
111
+ xmlns: "http://www.w3.org/2000/svg",
112
+ children: /* @__PURE__ */ jsx("path", {
113
+ d: "M6.5 16.5C6.50006 19.2614 8.7386 21.4999 11.5 21.5C11.7759 21.5003 12 21.724 12 22C12 22.276 11.7759 22.4997 11.5 22.5C8.18632 22.4999 5.50006 19.8137 5.5 16.5V0H6.5V16.5Z",
114
+ className: "fill-[#555]"
115
+ })
116
+ }) : /* @__PURE__ */ jsx("svg", {
117
+ width: "14",
118
+ height: "34",
119
+ viewBox: "0 0 12 34",
120
+ fill: "none",
121
+ xmlns: "http://www.w3.org/2000/svg",
122
+ children: /* @__PURE__ */ jsx("path", {
123
+ d: "M6.5 0V11.5C6.50007 14.2614 8.73861 16.4999 11.5 16.5C11.7759 16.5003 12 16.724 12 17C12 17.276 11.7759 17.4997 11.5 17.5C9.41273 17.5 7.57486 16.4335 6.5 14.8164V34H5.5V0H6.5Z",
124
+ className: "fill-[#555]"
125
+ })
126
+ }), /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
127
+ className: "grid grid-cols-[auto_1fr] items-center gap-3 px-2",
128
+ children: [/* @__PURE__ */ jsx(EndpointPath, {
286
129
  method: endpoint.method,
287
130
  path: endpoint.path
288
- });
289
- $[8] = endpoint.method;
290
- $[9] = endpoint.path;
291
- $[10] = t6;
292
- } else t6 = $[10];
293
- let t7;
294
- if ($[11] !== endpoint.description) {
295
- t7 = /* @__PURE__ */ jsx("span", {
131
+ }), /* @__PURE__ */ jsx("span", {
296
132
  className: "text-sm text-muted-foreground truncate",
297
133
  children: endpoint.description
298
- });
299
- $[11] = endpoint.description;
300
- $[12] = t7;
301
- } else t7 = $[12];
302
- let t8;
303
- if ($[13] !== t6 || $[14] !== t7) {
304
- t8 = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
305
- className: "grid grid-cols-[auto_1fr] items-center gap-3 px-2",
306
- children: [t6, t7]
307
- }) });
308
- $[13] = t6;
309
- $[14] = t7;
310
- $[15] = t8;
311
- } else t8 = $[15];
312
- let t9;
313
- if ($[16] !== t1 || $[17] !== t2 || $[18] !== t4 || $[19] !== t5 || $[20] !== t8) {
314
- t9 = /* @__PURE__ */ jsxs("div", {
315
- "data-testid": t1,
316
- onClick: t2,
317
- className: t4,
318
- children: [t5, t8]
319
- });
320
- $[16] = t1;
321
- $[17] = t2;
322
- $[18] = t4;
323
- $[19] = t5;
324
- $[20] = t8;
325
- $[21] = t9;
326
- } else t9 = $[21];
327
- return t9;
328
- };
134
+ })]
135
+ }) })]
136
+ });
329
137
 
330
138
  //#endregion
331
139
  //#region src/components/flow-group.tsx
332
- const FlowGroup = (t0) => {
333
- const $ = c(41);
334
- if ($[0] !== "a80b3cb43bb62d012f095b7847fb01d92f2a4fcd29fc05244f6ae839f1f0b9de") {
335
- for (let $i = 0; $i < 41; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
336
- $[0] = "a80b3cb43bb62d012f095b7847fb01d92f2a4fcd29fc05244f6ae839f1f0b9de";
337
- }
338
- const { flow, endpoints, isOpen, isSelected, onToggle, onClearSelection, selectedEndpointId, onSelectEndpoint } = t0;
339
- const t1 = `flow-group-${flow}`;
340
- let t2;
341
- if ($[1] !== flow || $[2] !== isSelected || $[3] !== onClearSelection || $[4] !== onToggle) {
342
- t2 = () => {
343
- if (isSelected) onClearSelection();
344
- onToggle(flow);
345
- };
346
- $[1] = flow;
347
- $[2] = isSelected;
348
- $[3] = onClearSelection;
349
- $[4] = onToggle;
350
- $[5] = t2;
351
- } else t2 = $[5];
352
- let t3;
353
- if ($[6] !== isOpen) {
354
- t3 = cn("w-4 h-4 transition-transform duration-300 text-[#555]", { "rotate-180 mt-2.5": isOpen });
355
- $[6] = isOpen;
356
- $[7] = t3;
357
- } else t3 = $[7];
358
- let t4;
359
- if ($[8] !== t3) {
360
- t4 = /* @__PURE__ */ jsx(ChevronDown, {
361
- className: t3,
362
- strokeWidth: 1.5
363
- });
364
- $[8] = t3;
365
- $[9] = t4;
366
- } else t4 = $[9];
367
- const t5 = !isOpen;
368
- let t6;
369
- if ($[10] !== t5) {
370
- t6 = cn("ml-[7px]", { hidden: t5 });
371
- $[10] = t5;
372
- $[11] = t6;
373
- } else t6 = $[11];
374
- let t7;
375
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
376
- t7 = /* @__PURE__ */ jsx("path", {
377
- d: "M1.5 1C1.5 0.723858 1.27614 0.5 1 0.5C0.723858 0.5 0.5 0.723858 0.5 1H1H1.5ZM1 1H0.5V10H1H1.5V1H1Z",
378
- className: "fill-[#555]"
379
- });
380
- $[12] = t7;
381
- } else t7 = $[12];
382
- let t8;
383
- if ($[13] !== t6) {
384
- t8 = /* @__PURE__ */ jsx("svg", {
385
- xmlns: "http://www.w3.org/2000/svg",
386
- width: "2",
387
- height: "10",
388
- viewBox: "0 0 2 10",
389
- fill: "none",
390
- className: t6,
391
- children: t7
392
- });
393
- $[13] = t6;
394
- $[14] = t8;
395
- } else t8 = $[14];
396
- let t9;
397
- if ($[15] !== t4 || $[16] !== t8) {
398
- t9 = /* @__PURE__ */ jsxs("div", {
399
- className: "grid grid-cols-1",
400
- children: [t4, t8]
401
- });
402
- $[15] = t4;
403
- $[16] = t8;
404
- $[17] = t9;
405
- } else t9 = $[17];
406
- let t10;
407
- if ($[18] !== flow) {
408
- t10 = /* @__PURE__ */ jsx("h3", {
409
- className: "text-sm font-medium text-left",
410
- children: flow
411
- });
412
- $[18] = flow;
413
- $[19] = t10;
414
- } else t10 = $[19];
415
- let t11;
416
- if ($[20] !== t1 || $[21] !== t10 || $[22] !== t2 || $[23] !== t9) {
417
- t11 = /* @__PURE__ */ jsxs("button", {
418
- "data-testid": t1,
140
+ const FlowGroup = ({ flow, endpoints, isOpen, isSelected, onToggle, onClearSelection, selectedEndpointId, onSelectEndpoint }) => {
141
+ return /* @__PURE__ */ jsxs("div", {
142
+ className: "pt-2",
143
+ children: [/* @__PURE__ */ jsxs("button", {
144
+ "data-testid": `flow-group-${flow}`,
419
145
  className: "w-full grid grid-cols-[auto_1fr] items-center gap-3 hover:bg-muted/40 cursor-pointer min-h-8.5 select-none hover:bg-muted-foreground/10 px-4",
420
- onClick: t2,
421
- children: [t9, t10]
422
- });
423
- $[20] = t1;
424
- $[21] = t10;
425
- $[22] = t2;
426
- $[23] = t9;
427
- $[24] = t11;
428
- } else t11 = $[24];
429
- const t12 = !isOpen;
430
- let t13;
431
- if ($[25] !== t12) {
432
- t13 = cn("grid grid-cols-1 items-center justify-center", { hidden: t12 });
433
- $[25] = t12;
434
- $[26] = t13;
435
- } else t13 = $[26];
436
- let t14;
437
- if ($[27] !== endpoints || $[28] !== onSelectEndpoint || $[29] !== selectedEndpointId) {
438
- let t15$1;
439
- if ($[31] !== endpoints.length || $[32] !== onSelectEndpoint || $[33] !== selectedEndpointId) {
440
- t15$1 = (endpoint, index) => /* @__PURE__ */ jsx(EndpointItem, {
146
+ onClick: () => {
147
+ if (isSelected) onClearSelection();
148
+ onToggle(flow);
149
+ },
150
+ children: [/* @__PURE__ */ jsxs("div", {
151
+ className: "grid grid-cols-1",
152
+ children: [/* @__PURE__ */ jsx(ChevronDown, {
153
+ className: cn("w-4 h-4 transition-transform duration-300 text-[#555]", { "rotate-180 mt-2.5": isOpen }),
154
+ strokeWidth: 1.5
155
+ }), /* @__PURE__ */ jsx("svg", {
156
+ xmlns: "http://www.w3.org/2000/svg",
157
+ width: "2",
158
+ height: "10",
159
+ viewBox: "0 0 2 10",
160
+ fill: "none",
161
+ className: cn("ml-[7px]", { hidden: !isOpen }),
162
+ children: /* @__PURE__ */ jsx("path", {
163
+ d: "M1.5 1C1.5 0.723858 1.27614 0.5 1 0.5C0.723858 0.5 0.5 0.723858 0.5 1H1H1.5ZM1 1H0.5V10H1H1.5V1H1Z",
164
+ className: "fill-[#555]"
165
+ })
166
+ })]
167
+ }), /* @__PURE__ */ jsx("h3", {
168
+ className: "text-sm font-medium text-left",
169
+ children: flow
170
+ })]
171
+ }), /* @__PURE__ */ jsx("div", {
172
+ className: cn("grid grid-cols-1 items-center justify-center", { hidden: !isOpen }),
173
+ children: endpoints.map((endpoint, index) => /* @__PURE__ */ jsx(EndpointItem, {
441
174
  endpoint,
442
175
  isSelected: selectedEndpointId === endpoint.id,
443
176
  isLast: index === endpoints.length - 1,
444
177
  onSelect: onSelectEndpoint
445
- }, endpoint.id);
446
- $[31] = endpoints.length;
447
- $[32] = onSelectEndpoint;
448
- $[33] = selectedEndpointId;
449
- $[34] = t15$1;
450
- } else t15$1 = $[34];
451
- t14 = endpoints.map(t15$1);
452
- $[27] = endpoints;
453
- $[28] = onSelectEndpoint;
454
- $[29] = selectedEndpointId;
455
- $[30] = t14;
456
- } else t14 = $[30];
457
- let t15;
458
- if ($[35] !== t13 || $[36] !== t14) {
459
- t15 = /* @__PURE__ */ jsx("div", {
460
- className: t13,
461
- children: t14
462
- });
463
- $[35] = t13;
464
- $[36] = t14;
465
- $[37] = t15;
466
- } else t15 = $[37];
467
- let t16;
468
- if ($[38] !== t11 || $[39] !== t15) {
469
- t16 = /* @__PURE__ */ jsxs("div", {
470
- className: "pt-2",
471
- children: [t11, t15]
472
- });
473
- $[38] = t11;
474
- $[39] = t15;
475
- $[40] = t16;
476
- } else t16 = $[40];
477
- return t16;
178
+ }, endpoint.id))
179
+ })]
180
+ });
478
181
  };
479
182
 
480
183
  //#endregion
@@ -621,50 +324,27 @@ const useEndpointConfiguration = create()(persist(devtools((set) => ({
621
324
  //#endregion
622
325
  //#region src/hooks/use-get-endpoints.ts
623
326
  const useGetEndpoints = () => {
624
- const $ = c(7);
625
- if ($[0] !== "cadd8d3432dfc6d2432c646eaf1f90c044b70a708974ecf5f816ef36004b4da0") {
626
- for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
627
- $[0] = "cadd8d3432dfc6d2432c646eaf1f90c044b70a708974ecf5f816ef36004b4da0";
628
- }
629
- let t0;
630
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
631
- t0 = {
632
- streamName: "__motia.api-endpoints",
633
- groupId: "default"
634
- };
635
- $[1] = t0;
636
- } else t0 = $[1];
637
- const { data: endpoints } = useStreamGroup(t0);
638
- let t1;
639
- if ($[2] !== endpoints) {
640
- t1 = endpoints.reduce(_temp$8, {});
641
- $[2] = endpoints;
642
- $[3] = t1;
643
- } else t1 = $[3];
644
- const groupedEndpoints = t1;
645
- let t2;
646
- if ($[4] !== endpoints || $[5] !== groupedEndpoints) {
647
- t2 = {
648
- endpoints,
649
- groupedEndpoints
650
- };
651
- $[4] = endpoints;
652
- $[5] = groupedEndpoints;
653
- $[6] = t2;
654
- } else t2 = $[6];
655
- return t2;
656
- };
657
- function _temp$8(acc, endpoint) {
658
- if (endpoint.flows && endpoint.flows.length > 0) endpoint.flows.forEach((flow) => {
659
- acc[flow] = acc[flow] || [];
660
- acc[flow].push(endpoint);
327
+ const { data: endpoints } = useStreamGroup({
328
+ streamName: "__motia.api-endpoints",
329
+ groupId: "default"
661
330
  });
662
- else {
663
- acc["no-flow"] = acc["no-flow"] || [];
664
- acc["no-flow"].push(endpoint);
665
- }
666
- return acc;
667
- }
331
+ return {
332
+ endpoints,
333
+ groupedEndpoints: useMemo(() => {
334
+ return endpoints.reduce((acc, endpoint) => {
335
+ if (endpoint.flows && endpoint.flows.length > 0) endpoint.flows.forEach((flow) => {
336
+ acc[flow] = acc[flow] || [];
337
+ acc[flow].push(endpoint);
338
+ });
339
+ else {
340
+ acc["no-flow"] = acc["no-flow"] || [];
341
+ acc["no-flow"].push(endpoint);
342
+ }
343
+ return acc;
344
+ }, {});
345
+ }, [endpoints])
346
+ };
347
+ };
668
348
 
669
349
  //#endregion
670
350
  //#region src/hooks/use-path-params.ts
@@ -719,210 +399,93 @@ const convertSchemaToJson = (schema, rootSchema) => {
719
399
  //#endregion
720
400
  //#region src/hooks/use-json-schema-to-json.tsx
721
401
  const useJsonSchemaToJson = (schema) => {
722
- const $ = c(6);
723
- if ($[0] !== "ba29f15b5046bda288d763530dc1c4ad1bc3136b6950394508cecd61132b94a3") {
724
- for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
725
- $[0] = "ba29f15b5046bda288d763530dc1c4ad1bc3136b6950394508cecd61132b94a3";
726
- }
727
402
  const [body, setBody] = useState("");
728
- let t0;
729
- let t1;
730
- if ($[1] !== schema) {
731
- t0 = () => {
732
- if (schema) setBody(JSON.stringify(convertSchemaToJson(schema), null, 2));
733
- };
734
- t1 = [schema];
735
- $[1] = schema;
736
- $[2] = t0;
737
- $[3] = t1;
738
- } else {
739
- t0 = $[2];
740
- t1 = $[3];
741
- }
742
- useEffect(t0, t1);
743
- let t2;
744
- if ($[4] !== body) {
745
- t2 = {
746
- body,
747
- setBody
748
- };
749
- $[4] = body;
750
- $[5] = t2;
751
- } else t2 = $[5];
752
- return t2;
403
+ useEffect(() => {
404
+ if (schema) setBody(JSON.stringify(convertSchemaToJson(schema), null, 2));
405
+ }, [schema]);
406
+ return {
407
+ body,
408
+ setBody
409
+ };
753
410
  };
754
411
 
755
412
  //#endregion
756
413
  //#region src/spec/spec-body-panel.tsx
757
- const EndpointBodyPanel = (t0) => {
758
- const $ = c(9);
759
- if ($[0] !== "b8eff7f7ce8e9189baa5c639bfd152e5d0c4e2073eede72b1020744bec7ba947") {
760
- for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
761
- $[0] = "b8eff7f7ce8e9189baa5c639bfd152e5d0c4e2073eede72b1020744bec7ba947";
762
- }
763
- const { endpoint, panelName, value } = t0;
414
+ const EndpointBodyPanel = ({ endpoint, panelName, value }) => {
764
415
  if (![
765
416
  "post",
766
417
  "put",
767
418
  "patch"
768
419
  ].includes(endpoint.method.toLowerCase())) return null;
769
- const t1 = `endpoint-body-panel__${panelName}`;
770
- let t2;
771
- if ($[1] !== value) {
772
- t2 = value ? JSON.parse(value) : {};
773
- $[1] = value;
774
- $[2] = t2;
775
- } else t2 = $[2];
776
- let t3;
777
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
778
- t3 = { backgroundColor: "transparent" };
779
- $[3] = t3;
780
- } else t3 = $[3];
781
- let t4;
782
- if ($[4] !== t2) {
783
- t4 = /* @__PURE__ */ jsx(ReactJson, {
784
- src: t2,
420
+ return /* @__PURE__ */ jsx(Panel, {
421
+ title: "Body",
422
+ size: "sm",
423
+ contentClassName: "p-0",
424
+ "data-testid": `endpoint-body-panel__${panelName}`,
425
+ children: /* @__PURE__ */ jsx(ReactJson, {
426
+ src: value ? JSON.parse(value) : {},
785
427
  theme: "default",
786
428
  enableClipboard: false,
787
- style: t3
788
- });
789
- $[4] = t2;
790
- $[5] = t4;
791
- } else t4 = $[5];
792
- let t5;
793
- if ($[6] !== t1 || $[7] !== t4) {
794
- t5 = /* @__PURE__ */ jsx(Panel, {
795
- title: "Body",
796
- size: "sm",
797
- contentClassName: "p-0",
798
- "data-testid": t1,
799
- children: t4
800
- });
801
- $[6] = t1;
802
- $[7] = t4;
803
- $[8] = t5;
804
- } else t5 = $[8];
805
- return t5;
429
+ style: { backgroundColor: "transparent" }
430
+ })
431
+ });
806
432
  };
807
433
 
808
434
  //#endregion
809
435
  //#region src/spec/spec-path-params-panel.tsx
810
- const EndpointPathParamsPanel = (t0) => {
811
- const $ = c(6);
812
- if ($[0] !== "4b99c635b467b8c34956e7f3473f52521462aab54a3d1e16ce1af5ee24ede587") {
813
- for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
814
- $[0] = "4b99c635b467b8c34956e7f3473f52521462aab54a3d1e16ce1af5ee24ede587";
815
- }
816
- const { endpoint } = t0;
436
+ const EndpointPathParamsPanel = ({ endpoint }) => {
817
437
  const pathParams = usePathParams(endpoint.path);
818
438
  if (!pathParams.length) return null;
819
- let t1;
820
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
821
- t1 = { gridTemplateColumns: "1fr 2fr" };
822
- $[1] = t1;
823
- } else t1 = $[1];
824
- let t2;
825
- if ($[2] !== pathParams) {
826
- t2 = pathParams.map(_temp$7);
827
- $[2] = pathParams;
828
- $[3] = t2;
829
- } else t2 = $[3];
830
- let t3;
831
- if ($[4] !== t2) {
832
- t3 = /* @__PURE__ */ jsx(Panel, {
833
- title: "Path params",
834
- size: "sm",
835
- variant: "default",
836
- children: /* @__PURE__ */ jsx("div", {
837
- className: "grid gap-3",
838
- style: t1,
839
- children: t2
840
- })
841
- });
842
- $[4] = t2;
843
- $[5] = t3;
844
- } else t3 = $[5];
845
- return t3;
439
+ return /* @__PURE__ */ jsx(Panel, {
440
+ title: "Path params",
441
+ size: "sm",
442
+ variant: "default",
443
+ children: /* @__PURE__ */ jsx("div", {
444
+ className: "grid gap-3",
445
+ style: { gridTemplateColumns: "1fr 2fr" },
446
+ children: pathParams.map((param) => /* @__PURE__ */ jsx("div", {
447
+ className: "font-bold leading-[36px] flex text-xs",
448
+ children: param
449
+ }, param))
450
+ })
451
+ });
846
452
  };
847
- function _temp$7(param) {
848
- return /* @__PURE__ */ jsx("div", {
849
- className: "font-bold leading-[36px] flex text-xs",
850
- children: param
851
- }, param);
852
- }
853
453
 
854
454
  //#endregion
855
455
  //#region src/spec/spec-query-params-panel.tsx
856
- const EndpointQueryParamsPanel = (t0) => {
857
- const $ = c(6);
858
- if ($[0] !== "4e1364928f69469968044d4855a06c351178a75725f12806c407b9bdbee699b0") {
859
- for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
860
- $[0] = "4e1364928f69469968044d4855a06c351178a75725f12806c407b9bdbee699b0";
861
- }
862
- const { endpoint } = t0;
456
+ const EndpointQueryParamsPanel = ({ endpoint }) => {
863
457
  if (!endpoint.queryParams?.length) return null;
864
- let t1;
865
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
866
- t1 = {
867
- gridTemplateColumns: "1fr 2fr",
868
- gridTemplateRows: "1fr 1fr"
869
- };
870
- $[1] = t1;
871
- } else t1 = $[1];
872
- let t2;
873
- if ($[2] !== endpoint.queryParams) {
874
- t2 = endpoint.queryParams.map(_temp$6);
875
- $[2] = endpoint.queryParams;
876
- $[3] = t2;
877
- } else t2 = $[3];
878
- let t3;
879
- if ($[4] !== t2) {
880
- t3 = /* @__PURE__ */ jsx(Panel, {
881
- title: "Query params",
882
- size: "sm",
883
- variant: "outlined",
884
- children: /* @__PURE__ */ jsx("div", {
885
- className: "grid gap-3",
886
- style: t1,
887
- children: t2
888
- })
889
- });
890
- $[4] = t2;
891
- $[5] = t3;
892
- } else t3 = $[5];
893
- return t3;
458
+ return /* @__PURE__ */ jsx(Panel, {
459
+ title: "Query params",
460
+ size: "sm",
461
+ variant: "outlined",
462
+ children: /* @__PURE__ */ jsx("div", {
463
+ className: "grid gap-3",
464
+ style: {
465
+ gridTemplateColumns: "1fr 2fr",
466
+ gridTemplateRows: "1fr 1fr"
467
+ },
468
+ children: endpoint.queryParams.map((param) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
469
+ className: "font-bold leading-[36px] flex text-xs",
470
+ children: param.name
471
+ }), /* @__PURE__ */ jsx("div", {
472
+ className: "flex items-center text-xs ",
473
+ children: /* @__PURE__ */ jsx("span", { children: param.description })
474
+ })] }, param.name))
475
+ })
476
+ });
894
477
  };
895
- function _temp$6(param) {
896
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
897
- className: "font-bold leading-[36px] flex text-xs",
898
- children: param.name
899
- }), /* @__PURE__ */ jsx("div", {
900
- className: "flex items-center text-xs ",
901
- children: /* @__PURE__ */ jsx("span", { children: param.description })
902
- })] }, param.name);
903
- }
904
478
 
905
479
  //#endregion
906
480
  //#region src/spec/spec-response-schema.tsx
907
- const EndpointResponseSchemaItem = (t0) => {
908
- const $ = c(10);
909
- if ($[0] !== "e4de7b36c48b33b1d8a3aa52a415bcc5b35556fbd21c0f6bc47983adc48a77ce") {
910
- for (let $i = 0; $i < 10; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
911
- $[0] = "e4de7b36c48b33b1d8a3aa52a415bcc5b35556fbd21c0f6bc47983adc48a77ce";
912
- }
913
- const { responseCode, bodySchema } = t0;
914
- const theme = useThemeStore(_temp$5);
915
- let t1;
916
- if ($[1] !== bodySchema) {
917
- t1 = convertSchemaToJson(bodySchema);
918
- $[1] = bodySchema;
919
- $[2] = t1;
920
- } else t1 = $[2];
921
- const schema = t1;
481
+ const EndpointResponseSchemaItem = ({ responseCode, bodySchema }) => {
482
+ const theme = useThemeStore((store) => store.theme);
483
+ const schema = useMemo(() => convertSchemaToJson(bodySchema), [bodySchema]);
922
484
  const description = typeof bodySchema.description === "string" ? bodySchema.description : "";
923
- let t2;
924
- if ($[3] !== description || $[4] !== schema || $[5] !== theme) {
925
- t2 = /* @__PURE__ */ jsx("div", {
485
+ return /* @__PURE__ */ jsx(TabsContent, {
486
+ value: responseCode,
487
+ className: "border-t",
488
+ children: /* @__PURE__ */ jsx("div", {
926
489
  className: "text-xs font-mono rounded-lg whitespace-pre-wrap",
927
490
  children: schema ? /* @__PURE__ */ jsx(ReactJson, {
928
491
  src: schema,
@@ -933,749 +496,315 @@ const EndpointResponseSchemaItem = (t0) => {
933
496
  className: "text-xs font-mono rounded-lg whitespace-pre-wrap p-4",
934
497
  children: description
935
498
  })
936
- });
937
- $[3] = description;
938
- $[4] = schema;
939
- $[5] = theme;
940
- $[6] = t2;
941
- } else t2 = $[6];
942
- let t3;
943
- if ($[7] !== responseCode || $[8] !== t2) {
944
- t3 = /* @__PURE__ */ jsx(TabsContent, {
945
- value: responseCode,
946
- className: "border-t",
947
- children: t2
948
- }, responseCode);
949
- $[7] = responseCode;
950
- $[8] = t2;
951
- $[9] = t3;
952
- } else t3 = $[9];
953
- return t3;
499
+ })
500
+ }, responseCode);
954
501
  };
955
- const EndpointResponseSchema = (t0) => {
956
- const $ = c(11);
957
- if ($[0] !== "e4de7b36c48b33b1d8a3aa52a415bcc5b35556fbd21c0f6bc47983adc48a77ce") {
958
- for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
959
- $[0] = "e4de7b36c48b33b1d8a3aa52a415bcc5b35556fbd21c0f6bc47983adc48a77ce";
960
- }
961
- const { items } = t0;
502
+ const EndpointResponseSchema = ({ items }) => {
962
503
  if (items.length === 0) return null;
963
- const t1 = items[0].responseCode;
964
- let t2;
965
- if ($[1] !== items) {
966
- t2 = items.map(_temp2);
967
- $[1] = items;
968
- $[2] = t2;
969
- } else t2 = $[2];
970
- let t3;
971
- if ($[3] !== t2) {
972
- t3 = /* @__PURE__ */ jsx("div", {
973
- className: "flex items-center justify-between bg-card",
974
- children: /* @__PURE__ */ jsx(TabsList, {
975
- className: "bg-transparent p-0",
976
- children: t2
977
- })
978
- });
979
- $[3] = t2;
980
- $[4] = t3;
981
- } else t3 = $[4];
982
- let t4;
983
- if ($[5] !== items) {
984
- t4 = items.map(_temp3);
985
- $[5] = items;
986
- $[6] = t4;
987
- } else t4 = $[6];
988
- let t5;
989
- if ($[7] !== items[0].responseCode || $[8] !== t3 || $[9] !== t4) {
990
- t5 = /* @__PURE__ */ jsx("div", {
991
- className: "flex flex-col rounded-lg border",
992
- children: /* @__PURE__ */ jsxs(Tabs, {
993
- defaultValue: t1,
994
- children: [t3, t4]
995
- })
996
- });
997
- $[7] = items[0].responseCode;
998
- $[8] = t3;
999
- $[9] = t4;
1000
- $[10] = t5;
1001
- } else t5 = $[10];
1002
- return t5;
504
+ return /* @__PURE__ */ jsx("div", {
505
+ className: "flex flex-col rounded-lg border",
506
+ children: /* @__PURE__ */ jsxs(Tabs, {
507
+ defaultValue: items[0].responseCode,
508
+ children: [/* @__PURE__ */ jsx("div", {
509
+ className: "flex items-center justify-between bg-card",
510
+ children: /* @__PURE__ */ jsx(TabsList, {
511
+ className: "bg-transparent p-0",
512
+ children: items.map((item) => /* @__PURE__ */ jsx(TabsTrigger, {
513
+ value: item.responseCode,
514
+ className: "text-xs font-bold cursor-pointer",
515
+ children: item.responseCode
516
+ }, item.responseCode))
517
+ })
518
+ }), items.map((props) => /* @__PURE__ */ jsx(EndpointResponseSchemaItem, { ...props }, props.responseCode))]
519
+ })
520
+ });
1003
521
  };
1004
- function _temp$5(store) {
1005
- return store.theme;
1006
- }
1007
- function _temp2(item) {
1008
- return /* @__PURE__ */ jsx(TabsTrigger, {
1009
- value: item.responseCode,
1010
- className: "text-xs font-bold cursor-pointer",
1011
- children: item.responseCode
1012
- }, item.responseCode);
1013
- }
1014
- function _temp3(props) {
1015
- return /* @__PURE__ */ jsx(EndpointResponseSchemaItem, { ...props }, props.responseCode);
1016
- }
1017
522
 
1018
523
  //#endregion
1019
524
  //#region src/spec/spec-side-panel.tsx
1020
- const SpecSidePanel = (t0) => {
1021
- const $ = c(26);
1022
- if ($[0] !== "1460e2628753bf80967063f35b14988afbd9dd8b96c8778ac3b5ebba7a833fc1") {
1023
- for (let $i = 0; $i < 26; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
1024
- $[0] = "1460e2628753bf80967063f35b14988afbd9dd8b96c8778ac3b5ebba7a833fc1";
1025
- }
1026
- const { endpoint, onClose } = t0;
525
+ const SpecSidePanel = ({ endpoint, onClose }) => {
1027
526
  const { body } = useJsonSchemaToJson(endpoint.bodySchema);
1028
- let t1;
1029
- if ($[1] !== endpoint.method || $[2] !== endpoint.path) {
1030
- t1 = /* @__PURE__ */ jsx(EndpointPath, {
527
+ return /* @__PURE__ */ jsxs(Sidebar, {
528
+ initialWidth: 600,
529
+ subtitle: endpoint.description,
530
+ title: /* @__PURE__ */ jsx(EndpointPath, {
1031
531
  method: endpoint.method,
1032
532
  path: endpoint.path
1033
- });
1034
- $[1] = endpoint.method;
1035
- $[2] = endpoint.path;
1036
- $[3] = t1;
1037
- } else t1 = $[3];
1038
- let t2;
1039
- if ($[4] !== onClose) {
1040
- t2 = /* @__PURE__ */ jsx(X, {
1041
- className: "cursor-pointer w-4 h-4",
1042
- onClick: onClose
1043
- });
1044
- $[4] = onClose;
1045
- $[5] = t2;
1046
- } else t2 = $[5];
1047
- let t3;
1048
- if ($[6] !== onClose || $[7] !== t2) {
1049
- t3 = [{
1050
- icon: t2,
533
+ }),
534
+ onClose,
535
+ actions: [{
536
+ icon: /* @__PURE__ */ jsx(X, {
537
+ className: "cursor-pointer w-4 h-4",
538
+ onClick: onClose
539
+ }),
1051
540
  onClick: onClose
1052
- }];
1053
- $[6] = onClose;
1054
- $[7] = t2;
1055
- $[8] = t3;
1056
- } else t3 = $[8];
1057
- let t4;
1058
- let t5;
1059
- if ($[9] !== endpoint) {
1060
- t4 = /* @__PURE__ */ jsx(EndpointPathParamsPanel, { endpoint });
1061
- t5 = /* @__PURE__ */ jsx(EndpointQueryParamsPanel, { endpoint });
1062
- $[9] = endpoint;
1063
- $[10] = t4;
1064
- $[11] = t5;
1065
- } else {
1066
- t4 = $[10];
1067
- t5 = $[11];
1068
- }
1069
- let t6;
1070
- if ($[12] !== body || $[13] !== endpoint) {
1071
- t6 = /* @__PURE__ */ jsx(EndpointBodyPanel, {
1072
- endpoint,
1073
- panelName: "details",
1074
- value: body
1075
- });
1076
- $[12] = body;
1077
- $[13] = endpoint;
1078
- $[14] = t6;
1079
- } else t6 = $[14];
1080
- let t7;
1081
- if ($[15] !== endpoint.responseSchema) {
1082
- t7 = /* @__PURE__ */ jsx(EndpointResponseSchema, { items: Object.entries(endpoint?.responseSchema ?? {}).map(_temp$4) });
1083
- $[15] = endpoint.responseSchema;
1084
- $[16] = t7;
1085
- } else t7 = $[16];
1086
- let t8;
1087
- if ($[17] !== endpoint.description || $[18] !== onClose || $[19] !== t1 || $[20] !== t3 || $[21] !== t4 || $[22] !== t5 || $[23] !== t6 || $[24] !== t7) {
1088
- t8 = /* @__PURE__ */ jsxs(Sidebar, {
1089
- initialWidth: 600,
1090
- subtitle: endpoint.description,
1091
- title: t1,
1092
- onClose,
1093
- actions: t3,
1094
- children: [
1095
- t4,
1096
- t5,
1097
- t6,
1098
- t7
1099
- ]
1100
- });
1101
- $[17] = endpoint.description;
1102
- $[18] = onClose;
1103
- $[19] = t1;
1104
- $[20] = t3;
1105
- $[21] = t4;
1106
- $[22] = t5;
1107
- $[23] = t6;
1108
- $[24] = t7;
1109
- $[25] = t8;
1110
- } else t8 = $[25];
1111
- return t8;
541
+ }],
542
+ children: [
543
+ /* @__PURE__ */ jsx(EndpointPathParamsPanel, { endpoint }),
544
+ /* @__PURE__ */ jsx(EndpointQueryParamsPanel, { endpoint }),
545
+ /* @__PURE__ */ jsx(EndpointBodyPanel, {
546
+ endpoint,
547
+ panelName: "details",
548
+ value: body
549
+ }),
550
+ /* @__PURE__ */ jsx(EndpointResponseSchema, { items: Object.entries(endpoint?.responseSchema ?? {}).map(([status, schema]) => ({
551
+ responseCode: status,
552
+ bodySchema: schema
553
+ })) })
554
+ ]
555
+ });
1112
556
  };
1113
- function _temp$4(t0) {
1114
- const [status, schema] = t0;
1115
- return {
1116
- responseCode: status,
1117
- bodySchema: schema
1118
- };
1119
- }
1120
557
 
1121
558
  //#endregion
1122
559
  //#region src/components/json-editor.tsx
1123
- const JsonEditor = (t0) => {
1124
- const $ = c(41);
1125
- if ($[0] !== "0b3355d4554a672310b1abdad893ca8974afca90f2334dd0d80cf3d8e960c55e") {
1126
- for (let $i = 0; $i < 41; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
1127
- $[0] = "0b3355d4554a672310b1abdad893ca8974afca90f2334dd0d80cf3d8e960c55e";
1128
- }
1129
- const { value, schema, onChange, onValidate, language: t1, readOnly: t2 } = t0;
1130
- const language = t1 === void 0 ? "json" : t1;
1131
- const readOnly = t2 === void 0 ? false : t2;
560
+ const JsonEditor = ({ value, schema, onChange, onValidate, language = "json", readOnly = false }) => {
1132
561
  const monaco = useMonaco();
1133
- const editorTheme = useThemeStore(_temp$3) === "dark" ? "transparent-dark" : "transparent-light";
562
+ const theme = useThemeStore((state) => state.theme);
563
+ const editorTheme = useMemo(() => theme === "dark" ? "transparent-dark" : "transparent-light", [theme]);
1134
564
  const [editor, setEditor] = useState(null);
1135
565
  const resizeAnimationFrameRef = useRef(null);
1136
566
  const isValidatingRef = useRef(false);
1137
- let t3;
1138
- let t4;
1139
- if ($[1] !== monaco) {
1140
- t3 = () => {
1141
- if (!monaco) return;
1142
- monaco.editor.defineTheme("transparent-light", {
1143
- base: "vs",
1144
- inherit: true,
1145
- rules: [],
1146
- colors: {
1147
- "editor.background": "#00000000",
1148
- "editor.lineHighlightBackground": "#00000000",
1149
- "editorLineNumber.foreground": "#999999",
1150
- "editorLineNumber.activeForeground": "#000000",
1151
- focusBorder: "#00000000",
1152
- "widget.border": "#00000000",
1153
- "editor.border": "#00000000",
1154
- "editorWidget.border": "#00000000"
1155
- }
1156
- });
1157
- monaco.editor.defineTheme("transparent-dark", {
1158
- base: "vs-dark",
1159
- inherit: true,
1160
- rules: [],
1161
- colors: {
1162
- "editor.background": "#00000000",
1163
- "editor.lineHighlightBackground": "#00000000",
1164
- "editorLineNumber.foreground": "#666666",
1165
- "editorLineNumber.activeForeground": "#ffffff",
1166
- focusBorder: "#00000000",
1167
- "widget.border": "#00000000",
1168
- "editor.border": "#00000000",
1169
- "editorWidget.border": "#00000000"
1170
- }
567
+ useLayoutEffect(() => {
568
+ if (!monaco) return;
569
+ monaco.editor.defineTheme("transparent-light", {
570
+ base: "vs",
571
+ inherit: true,
572
+ rules: [],
573
+ colors: {
574
+ "editor.background": "#00000000",
575
+ "editor.lineHighlightBackground": "#00000000",
576
+ "editorLineNumber.foreground": "#999999",
577
+ "editorLineNumber.activeForeground": "#000000",
578
+ focusBorder: "#00000000",
579
+ "widget.border": "#00000000",
580
+ "editor.border": "#00000000",
581
+ "editorWidget.border": "#00000000"
582
+ }
583
+ });
584
+ monaco.editor.defineTheme("transparent-dark", {
585
+ base: "vs-dark",
586
+ inherit: true,
587
+ rules: [],
588
+ colors: {
589
+ "editor.background": "#00000000",
590
+ "editor.lineHighlightBackground": "#00000000",
591
+ "editorLineNumber.foreground": "#666666",
592
+ "editorLineNumber.activeForeground": "#ffffff",
593
+ focusBorder: "#00000000",
594
+ "widget.border": "#00000000",
595
+ "editor.border": "#00000000",
596
+ "editorWidget.border": "#00000000"
597
+ }
598
+ });
599
+ }, [monaco]);
600
+ useEffect(() => {
601
+ if (!monaco) return;
602
+ monaco.languages.typescript.javascriptDefaults.setCompilerOptions({ isolatedModules: true });
603
+ monaco.languages.json.jsonDefaults.setDiagnosticsOptions({ schemas: schema ? [{
604
+ uri: window.location.href,
605
+ fileMatch: ["*"],
606
+ schema
607
+ }] : [] });
608
+ }, [monaco, schema]);
609
+ useLayoutEffect(() => {
610
+ if (!monaco) return;
611
+ monaco.editor.setTheme(editorTheme);
612
+ }, [monaco, editorTheme]);
613
+ useEffect(() => {
614
+ if (!editor) return;
615
+ const container = editor.getContainerDomNode().parentElement?.parentElement;
616
+ if (!container) return;
617
+ const handleResize = () => {
618
+ if (resizeAnimationFrameRef.current !== null) cancelAnimationFrame(resizeAnimationFrameRef.current);
619
+ resizeAnimationFrameRef.current = requestAnimationFrame(() => {
620
+ const { width, height } = container.getBoundingClientRect();
621
+ editor.layout({
622
+ width,
623
+ height
624
+ });
625
+ resizeAnimationFrameRef.current = null;
1171
626
  });
1172
627
  };
1173
- t4 = [monaco];
1174
- $[1] = monaco;
1175
- $[2] = t3;
1176
- $[3] = t4;
1177
- } else {
1178
- t3 = $[2];
1179
- t4 = $[3];
1180
- }
1181
- useLayoutEffect(t3, t4);
1182
- let t5;
1183
- let t6;
1184
- if ($[4] !== monaco || $[5] !== schema) {
1185
- t5 = () => {
1186
- if (!monaco) return;
1187
- monaco.languages.typescript.javascriptDefaults.setCompilerOptions({ isolatedModules: true });
1188
- monaco.languages.json.jsonDefaults.setDiagnosticsOptions({ schemas: schema ? [{
1189
- uri: window.location.href,
1190
- fileMatch: ["*"],
1191
- schema
1192
- }] : [] });
628
+ handleResize();
629
+ const resizeObserver = new ResizeObserver(handleResize);
630
+ resizeObserver.observe(container);
631
+ return () => {
632
+ resizeObserver.disconnect();
633
+ if (resizeAnimationFrameRef.current !== null) cancelAnimationFrame(resizeAnimationFrameRef.current);
1193
634
  };
1194
- t6 = [monaco, schema];
1195
- $[4] = monaco;
1196
- $[5] = schema;
1197
- $[6] = t5;
1198
- $[7] = t6;
1199
- } else {
1200
- t5 = $[6];
1201
- t6 = $[7];
1202
- }
1203
- useEffect(t5, t6);
1204
- let t7;
1205
- let t8;
1206
- if ($[8] !== editorTheme || $[9] !== monaco) {
1207
- t7 = () => {
1208
- if (!monaco) return;
1209
- monaco.editor.setTheme(editorTheme);
1210
- };
1211
- t8 = [monaco, editorTheme];
1212
- $[8] = editorTheme;
1213
- $[9] = monaco;
1214
- $[10] = t7;
1215
- $[11] = t8;
1216
- } else {
1217
- t7 = $[10];
1218
- t8 = $[11];
1219
- }
1220
- useLayoutEffect(t7, t8);
1221
- let t10;
1222
- let t9;
1223
- if ($[12] !== editor) {
1224
- t9 = () => {
1225
- if (!editor) return;
1226
- const container = editor.getContainerDomNode().parentElement?.parentElement;
1227
- if (!container) return;
1228
- const handleResize = () => {
1229
- if (resizeAnimationFrameRef.current !== null) cancelAnimationFrame(resizeAnimationFrameRef.current);
1230
- resizeAnimationFrameRef.current = requestAnimationFrame(() => {
1231
- const { width, height } = container.getBoundingClientRect();
1232
- editor.layout({
1233
- width,
1234
- height
1235
- });
1236
- resizeAnimationFrameRef.current = null;
1237
- });
1238
- };
1239
- handleResize();
1240
- const resizeObserver = new ResizeObserver(handleResize);
1241
- resizeObserver.observe(container);
1242
- return () => {
1243
- resizeObserver.disconnect();
1244
- if (resizeAnimationFrameRef.current !== null) cancelAnimationFrame(resizeAnimationFrameRef.current);
1245
- };
1246
- };
1247
- t10 = [editor];
1248
- $[12] = editor;
1249
- $[13] = t10;
1250
- $[14] = t9;
1251
- } else {
1252
- t10 = $[13];
1253
- t9 = $[14];
1254
- }
1255
- useEffect(t9, t10);
1256
- let t11;
1257
- let t12;
1258
- if ($[15] !== editor || $[16] !== monaco || $[17] !== onValidate || $[18] !== schema || $[19] !== value) {
1259
- t11 = () => {
1260
- if (!editor || !monaco || !onValidate || isValidatingRef.current) return;
1261
- const model = editor.getModel();
1262
- if (!model) return;
1263
- if (schema && !value) {
1264
- isValidatingRef.current = true;
1265
- onValidate(false);
1266
- isValidatingRef.current = false;
1267
- return;
1268
- }
635
+ }, [editor]);
636
+ useEffect(() => {
637
+ if (!editor || !monaco || !onValidate || isValidatingRef.current) return;
638
+ const model = editor.getModel();
639
+ if (!model) return;
640
+ if (schema && !value) {
1269
641
  isValidatingRef.current = true;
1270
- const timeoutId = setTimeout(() => {
1271
- onValidate(monaco.editor.getModelMarkers({ resource: model.uri }).length === 0);
1272
- isValidatingRef.current = false;
1273
- }, 100);
1274
- return () => {
1275
- clearTimeout(timeoutId);
1276
- isValidatingRef.current = false;
1277
- };
1278
- };
1279
- t12 = [
1280
- editor,
1281
- monaco,
1282
- onValidate,
1283
- value,
1284
- schema
1285
- ];
1286
- $[15] = editor;
1287
- $[16] = monaco;
1288
- $[17] = onValidate;
1289
- $[18] = schema;
1290
- $[19] = value;
1291
- $[20] = t11;
1292
- $[21] = t12;
1293
- } else {
1294
- t11 = $[20];
1295
- t12 = $[21];
1296
- }
1297
- useEffect(t11, t12);
1298
- let t13;
1299
- if ($[22] !== schema) {
1300
- t13 = schema ? JSON.stringify(schema) : "no-schema";
1301
- $[22] = schema;
1302
- $[23] = t13;
1303
- } else t13 = $[23];
1304
- const editorKey = t13;
1305
- let t14;
1306
- if ($[24] !== onChange) {
1307
- t14 = (value_0) => {
1308
- onChange?.(value_0 ?? "");
642
+ onValidate(false);
643
+ isValidatingRef.current = false;
644
+ return;
645
+ }
646
+ isValidatingRef.current = true;
647
+ const timeoutId = setTimeout(() => {
648
+ onValidate(monaco.editor.getModelMarkers({ resource: model.uri }).length === 0);
649
+ isValidatingRef.current = false;
650
+ }, 100);
651
+ return () => {
652
+ clearTimeout(timeoutId);
653
+ isValidatingRef.current = false;
1309
654
  };
1310
- $[24] = onChange;
1311
- $[25] = t14;
1312
- } else t14 = $[25];
1313
- let t15;
1314
- if ($[26] !== onValidate || $[27] !== schema || $[28] !== value) {
1315
- t15 = (markers_0) => {
655
+ }, [
656
+ editor,
657
+ monaco,
658
+ onValidate,
659
+ value,
660
+ schema
661
+ ]);
662
+ const editorKey = useMemo(() => schema ? JSON.stringify(schema) : "no-schema", [schema]);
663
+ return /* @__PURE__ */ jsx(Editor, {
664
+ "data-testid": "json-editor",
665
+ language,
666
+ value,
667
+ loading: "",
668
+ theme: editorTheme,
669
+ onMount: setEditor,
670
+ onChange: (value$1) => {
671
+ onChange?.(value$1 ?? "");
672
+ },
673
+ onValidate: (markers) => {
1316
674
  if (!onValidate || isValidatingRef.current) return;
1317
675
  isValidatingRef.current = true;
1318
676
  if (schema && !value) onValidate(false);
1319
- else onValidate(markers_0.length === 0);
677
+ else onValidate(markers.length === 0);
1320
678
  isValidatingRef.current = false;
1321
- };
1322
- $[26] = onValidate;
1323
- $[27] = schema;
1324
- $[28] = value;
1325
- $[29] = t15;
1326
- } else t15 = $[29];
1327
- let t16;
1328
- if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
1329
- t16 = { enabled: false };
1330
- $[30] = t16;
1331
- } else t16 = $[30];
1332
- let t17;
1333
- if ($[31] !== readOnly) {
1334
- t17 = {
679
+ },
680
+ options: {
1335
681
  automaticLayout: false,
1336
682
  readOnly,
1337
683
  scrollBeyondLastLine: false,
1338
- minimap: t16,
684
+ minimap: { enabled: false },
1339
685
  overviewRulerLanes: 0
1340
- };
1341
- $[31] = readOnly;
1342
- $[32] = t17;
1343
- } else t17 = $[32];
1344
- let t18;
1345
- if ($[33] !== editorKey || $[34] !== editorTheme || $[35] !== language || $[36] !== t14 || $[37] !== t15 || $[38] !== t17 || $[39] !== value) {
1346
- t18 = /* @__PURE__ */ jsx(Editor, {
1347
- "data-testid": "json-editor",
1348
- language,
1349
- value,
1350
- loading: "",
1351
- theme: editorTheme,
1352
- onMount: setEditor,
1353
- onChange: t14,
1354
- onValidate: t15,
1355
- options: t17
1356
- }, editorKey);
1357
- $[33] = editorKey;
1358
- $[34] = editorTheme;
1359
- $[35] = language;
1360
- $[36] = t14;
1361
- $[37] = t15;
1362
- $[38] = t17;
1363
- $[39] = value;
1364
- $[40] = t18;
1365
- } else t18 = $[40];
1366
- return t18;
686
+ }
687
+ }, editorKey);
1367
688
  };
1368
- function _temp$3(state) {
1369
- return state.theme;
1370
- }
1371
689
 
1372
690
  //#endregion
1373
691
  //#region src/play/side-panel-body-tab.tsx
1374
- const SidePanelBodyTab = memo((t0) => {
1375
- const $ = c(21);
1376
- if ($[0] !== "15cdaf91612bb3c1ef34320b0f01a80a135e66606fb87beb7a4a2f7f95e53a69") {
1377
- for (let $i = 0; $i < 21; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
1378
- $[0] = "15cdaf91612bb3c1ef34320b0f01a80a135e66606fb87beb7a4a2f7f95e53a69";
1379
- }
1380
- const { schema } = t0;
692
+ const SidePanelBodyTab = memo(({ schema }) => {
1381
693
  const { setBody, setBodyIsValid } = useEndpointConfiguration();
1382
694
  const bodyIsValid = useEndpointConfiguration(useShallow(getBodyIsValidSelector));
1383
695
  const body = useEndpointConfiguration(getBodySelector);
1384
696
  const previousSchemaRef = useRef(schema);
1385
697
  const userClearedRef = useRef(false);
1386
- let t1;
1387
- let t2;
1388
- if ($[1] !== body || $[2] !== schema || $[3] !== setBody || $[4] !== setBodyIsValid) {
1389
- t1 = () => {
1390
- const schemaChanged = previousSchemaRef.current !== schema;
1391
- previousSchemaRef.current = schema;
1392
- if (schemaChanged) userClearedRef.current = false;
1393
- if (schema && !body && !userClearedRef.current) {
1394
- setBody(JSON.stringify(convertSchemaToJson(schema), null, 2));
1395
- return;
1396
- }
1397
- if (!schema) {
1398
- setBody(body || "");
1399
- setBodyIsValid(true);
1400
- }
1401
- };
1402
- t2 = [
1403
- schema,
1404
- body,
1405
- setBody,
1406
- setBodyIsValid
1407
- ];
1408
- $[1] = body;
1409
- $[2] = schema;
1410
- $[3] = setBody;
1411
- $[4] = setBodyIsValid;
1412
- $[5] = t1;
1413
- $[6] = t2;
1414
- } else {
1415
- t1 = $[5];
1416
- t2 = $[6];
1417
- }
1418
- useEffect(t1, t2);
1419
- let t3;
1420
- if ($[7] !== schema || $[8] !== setBody || $[9] !== setBodyIsValid) {
1421
- t3 = (value) => {
1422
- setBody(value);
1423
- if (schema && !value) {
1424
- setBodyIsValid(false);
1425
- userClearedRef.current = true;
1426
- } else userClearedRef.current = false;
1427
- };
1428
- $[7] = schema;
1429
- $[8] = setBody;
1430
- $[9] = setBodyIsValid;
1431
- $[10] = t3;
1432
- } else t3 = $[10];
1433
- const handleBodyChange = t3;
1434
- let t4;
1435
- if ($[11] !== body || $[12] !== handleBodyChange || $[13] !== schema || $[14] !== setBodyIsValid) {
1436
- t4 = /* @__PURE__ */ jsx(JsonEditor, {
698
+ useEffect(() => {
699
+ const schemaChanged = previousSchemaRef.current !== schema;
700
+ previousSchemaRef.current = schema;
701
+ if (schemaChanged) userClearedRef.current = false;
702
+ if (schema && !body && !userClearedRef.current) {
703
+ setBody(JSON.stringify(convertSchemaToJson(schema), null, 2));
704
+ return;
705
+ }
706
+ if (!schema) {
707
+ setBody(body || "");
708
+ setBodyIsValid(true);
709
+ }
710
+ }, [
711
+ schema,
712
+ body,
713
+ setBody,
714
+ setBodyIsValid
715
+ ]);
716
+ return /* @__PURE__ */ jsxs("div", {
717
+ className: "max-h-full h-full relative",
718
+ children: [/* @__PURE__ */ jsx(JsonEditor, {
1437
719
  value: body,
1438
720
  schema,
1439
- onChange: handleBodyChange,
721
+ onChange: useCallback((value) => {
722
+ setBody(value);
723
+ if (schema && !value) {
724
+ setBodyIsValid(false);
725
+ userClearedRef.current = true;
726
+ } else userClearedRef.current = false;
727
+ }, [
728
+ setBody,
729
+ schema,
730
+ setBodyIsValid
731
+ ]),
1440
732
  onValidate: setBodyIsValid
1441
- });
1442
- $[11] = body;
1443
- $[12] = handleBodyChange;
1444
- $[13] = schema;
1445
- $[14] = setBodyIsValid;
1446
- $[15] = t4;
1447
- } else t4 = $[15];
1448
- let t5;
1449
- if ($[16] !== bodyIsValid) {
1450
- t5 = bodyIsValid === false && /* @__PURE__ */ jsxs("div", {
733
+ }), bodyIsValid === false && /* @__PURE__ */ jsxs("div", {
1451
734
  className: "absolute bottom-0 left-0 right-0 border-t border-border p-3 text-sm dark:text-yellow-500 text-yellow-700 flex items-center gap-1 font-medium",
1452
735
  "data-testid": "endpoint-body-tab-invalid",
1453
736
  children: [/* @__PURE__ */ jsx(CircleX, { className: "w-4 h-4" }), "The body payload is invalid"]
1454
- });
1455
- $[16] = bodyIsValid;
1456
- $[17] = t5;
1457
- } else t5 = $[17];
1458
- let t6;
1459
- if ($[18] !== t4 || $[19] !== t5) {
1460
- t6 = /* @__PURE__ */ jsxs("div", {
1461
- className: "max-h-full h-full relative",
1462
- children: [t4, t5]
1463
- });
1464
- $[18] = t4;
1465
- $[19] = t5;
1466
- $[20] = t6;
1467
- } else t6 = $[20];
1468
- return t6;
737
+ })]
738
+ });
1469
739
  });
1470
740
 
1471
741
  //#endregion
1472
742
  //#region src/components/configuration-list-item.tsx
1473
- const ConfigurationListItem = memo((t0) => {
1474
- const $ = c(59);
1475
- if ($[0] !== "49b457e4243ed5368ffc15725d84d290ce5fe7173cb1a11ee0a1be10ae181259") {
1476
- for (let $i = 0; $i < 59; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
1477
- $[0] = "49b457e4243ed5368ffc15725d84d290ce5fe7173cb1a11ee0a1be10ae181259";
1478
- }
1479
- const { value, id, onUpdate, onRemove, required: t1 } = t0;
1480
- const required = t1 === void 0 ? false : t1;
743
+ const ConfigurationListItem = memo(({ value, id, onUpdate, onRemove, required = false }) => {
1481
744
  const [activeConfiguration, setActiveConfiguration] = useState(null);
1482
745
  const [valueToDelete, setValueToDelete] = useState(null);
1483
746
  const deleteTimeout = useRef(void 0);
1484
747
  const isActive = activeConfiguration === id;
1485
- let t2;
1486
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1487
- t2 = (key) => {
1488
- clearTimeout(deleteTimeout.current);
1489
- setValueToDelete(key);
1490
- deleteTimeout.current = setTimeout(() => {
1491
- setValueToDelete(null);
1492
- }, 5e3);
1493
- };
1494
- $[1] = t2;
1495
- } else t2 = $[1];
1496
- const onDelete = t2;
1497
- let t3;
1498
- if ($[2] !== id || $[3] !== required) {
1499
- t3 = () => {
1500
- if (required) return;
1501
- setActiveConfiguration(id);
1502
- };
1503
- $[2] = id;
1504
- $[3] = required;
1505
- $[4] = t3;
1506
- } else t3 = $[4];
1507
- const onMouseOver = t3;
1508
- let t4;
1509
- if ($[5] !== required) {
1510
- t4 = () => {
1511
- if (required) return;
1512
- setActiveConfiguration(null);
1513
- };
1514
- $[5] = required;
1515
- $[6] = t4;
1516
- } else t4 = $[6];
1517
- const onMouseLeave = t4;
1518
- const t5 = isActive && "bg-card";
1519
- let t6;
1520
- if ($[7] !== t5) {
1521
- t6 = cn("grid grid-cols-[auto_1fr_auto] items-center py-2 px-4 bg-muted/30 rounded-lg gap-2", t5);
1522
- $[7] = t5;
1523
- $[8] = t6;
1524
- } else t6 = $[8];
1525
- let t7;
1526
- if ($[9] !== id || $[10] !== onUpdate) {
1527
- t7 = (checked) => onUpdate(id, "active", checked);
1528
- $[9] = id;
1529
- $[10] = onUpdate;
1530
- $[11] = t7;
1531
- } else t7 = $[11];
1532
- let t8;
1533
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
1534
- t8 = /* @__PURE__ */ jsx(Check, { className: "h-3 w-3" });
1535
- $[12] = t8;
1536
- } else t8 = $[12];
1537
- let t9;
1538
- if ($[13] !== required || $[14] !== t7 || $[15] !== value.active) {
1539
- t9 = /* @__PURE__ */ jsx(Checkbox, {
1540
- checked: value.active,
1541
- onCheckedChange: t7,
1542
- disabled: required,
1543
- children: t8
1544
- });
1545
- $[13] = required;
1546
- $[14] = t7;
1547
- $[15] = value.active;
1548
- $[16] = t9;
1549
- } else t9 = $[16];
1550
- const t10 = !value.active;
1551
- const t11 = required ? "outlineReadonly" : "outline";
1552
- const t12 = `name-${id}`;
1553
- let t13;
1554
- if ($[17] !== id || $[18] !== onUpdate) {
1555
- t13 = (e) => onUpdate(id, "name", e.target.value);
1556
- $[17] = id;
1557
- $[18] = onUpdate;
1558
- $[19] = t13;
1559
- } else t13 = $[19];
1560
- let t14;
1561
- if ($[20] !== required || $[21] !== t10 || $[22] !== t11 || $[23] !== t12 || $[24] !== t13 || $[25] !== value.name) {
1562
- t14 = /* @__PURE__ */ jsx(Input, {
1563
- readOnly: required,
1564
- disabled: t10,
1565
- variant: t11,
1566
- id: t12,
1567
- defaultValue: value.name,
1568
- onBlur: t13,
1569
- placeholder: "Name",
1570
- className: "h-8"
1571
- });
1572
- $[20] = required;
1573
- $[21] = t10;
1574
- $[22] = t11;
1575
- $[23] = t12;
1576
- $[24] = t13;
1577
- $[25] = value.name;
1578
- $[26] = t14;
1579
- } else t14 = $[26];
1580
- const t15 = !value.active;
1581
- const t16 = `value-${id}`;
1582
- let t17;
1583
- if ($[27] !== id || $[28] !== onUpdate) {
1584
- t17 = (e_0) => onUpdate(id, "value", e_0.target.value);
1585
- $[27] = id;
1586
- $[28] = onUpdate;
1587
- $[29] = t17;
1588
- } else t17 = $[29];
1589
- let t18;
1590
- if ($[30] !== t15 || $[31] !== t16 || $[32] !== t17 || $[33] !== value.value) {
1591
- t18 = /* @__PURE__ */ jsx(Input, {
1592
- disabled: t15,
1593
- variant: "outline",
1594
- id: t16,
1595
- defaultValue: value.value,
1596
- onBlur: t17,
1597
- placeholder: "Value",
1598
- className: "h-8"
1599
- });
1600
- $[30] = t15;
1601
- $[31] = t16;
1602
- $[32] = t17;
1603
- $[33] = value.value;
1604
- $[34] = t18;
1605
- } else t18 = $[34];
1606
- let t19;
1607
- if ($[35] !== t14 || $[36] !== t18) {
1608
- t19 = /* @__PURE__ */ jsxs("div", {
1609
- className: "grid grid-cols-2 gap-2",
1610
- children: [t14, t18]
1611
- });
1612
- $[35] = t14;
1613
- $[36] = t18;
1614
- $[37] = t19;
1615
- } else t19 = $[37];
1616
- let t20;
1617
- if ($[38] !== id || $[39] !== onRemove || $[40] !== valueToDelete) {
1618
- t20 = () => {
1619
- if (valueToDelete === id) onRemove?.(id);
1620
- else onDelete(id);
1621
- };
1622
- $[38] = id;
1623
- $[39] = onRemove;
1624
- $[40] = valueToDelete;
1625
- $[41] = t20;
1626
- } else t20 = $[41];
1627
- const t21 = isActive && "opacity-100";
1628
- let t22;
1629
- if ($[42] !== t21) {
1630
- t22 = cn("h-6 w-6 opacity-0 transition-opacity duration-200", t21);
1631
- $[42] = t21;
1632
- $[43] = t22;
1633
- } else t22 = $[43];
1634
- const t23 = valueToDelete === id && isActive ? "Click again to remove" : "Remove";
1635
- let t24;
1636
- if ($[44] !== id || $[45] !== valueToDelete) {
1637
- t24 = valueToDelete === id ? /* @__PURE__ */ jsx(AlertCircle, { className: "h-3 w-3 text-destructive" }) : /* @__PURE__ */ jsx(Trash2, { className: "h-3 w-3" });
1638
- $[44] = id;
1639
- $[45] = valueToDelete;
1640
- $[46] = t24;
1641
- } else t24 = $[46];
1642
- let t25;
1643
- if ($[47] !== t20 || $[48] !== t22 || $[49] !== t23 || $[50] !== t24) {
1644
- t25 = /* @__PURE__ */ jsx(Button, {
1645
- variant: "ghost",
1646
- size: "icon",
1647
- onClick: t20,
1648
- className: t22,
1649
- title: t23,
1650
- children: t24
1651
- });
1652
- $[47] = t20;
1653
- $[48] = t22;
1654
- $[49] = t23;
1655
- $[50] = t24;
1656
- $[51] = t25;
1657
- } else t25 = $[51];
1658
- let t26;
1659
- if ($[52] !== onMouseLeave || $[53] !== onMouseOver || $[54] !== t19 || $[55] !== t25 || $[56] !== t6 || $[57] !== t9) {
1660
- t26 = /* @__PURE__ */ jsxs("div", {
1661
- className: t6,
1662
- onMouseOver,
1663
- onMouseLeave,
1664
- children: [
1665
- t9,
1666
- t19,
1667
- t25
1668
- ]
1669
- });
1670
- $[52] = onMouseLeave;
1671
- $[53] = onMouseOver;
1672
- $[54] = t19;
1673
- $[55] = t25;
1674
- $[56] = t6;
1675
- $[57] = t9;
1676
- $[58] = t26;
1677
- } else t26 = $[58];
1678
- return t26;
748
+ const onDelete = useCallback((key) => {
749
+ clearTimeout(deleteTimeout.current);
750
+ setValueToDelete(key);
751
+ deleteTimeout.current = setTimeout(() => {
752
+ setValueToDelete(null);
753
+ }, 5e3);
754
+ }, [setValueToDelete]);
755
+ const onMouseOver = useCallback(() => {
756
+ if (required) return;
757
+ setActiveConfiguration(id);
758
+ }, [id, required]);
759
+ const onMouseLeave = useCallback(() => {
760
+ if (required) return;
761
+ setActiveConfiguration(null);
762
+ }, [required]);
763
+ return /* @__PURE__ */ jsxs("div", {
764
+ className: cn("grid grid-cols-[auto_1fr_auto] items-center py-2 px-4 bg-muted/30 rounded-lg gap-2", isActive && "bg-card"),
765
+ onMouseOver,
766
+ onMouseLeave,
767
+ children: [
768
+ /* @__PURE__ */ jsx(Checkbox, {
769
+ checked: value.active,
770
+ onCheckedChange: (checked) => onUpdate(id, "active", checked),
771
+ disabled: required,
772
+ children: /* @__PURE__ */ jsx(Check, { className: "h-3 w-3" })
773
+ }),
774
+ /* @__PURE__ */ jsxs("div", {
775
+ className: "grid grid-cols-2 gap-2",
776
+ children: [/* @__PURE__ */ jsx(Input, {
777
+ readOnly: required,
778
+ disabled: !value.active,
779
+ variant: required ? "outlineReadonly" : "outline",
780
+ id: `name-${id}`,
781
+ defaultValue: value.name,
782
+ onBlur: (e) => onUpdate(id, "name", e.target.value),
783
+ placeholder: "Name",
784
+ className: "h-8"
785
+ }), /* @__PURE__ */ jsx(Input, {
786
+ disabled: !value.active,
787
+ variant: "outline",
788
+ id: `value-${id}`,
789
+ defaultValue: value.value,
790
+ onBlur: (e) => onUpdate(id, "value", e.target.value),
791
+ placeholder: "Value",
792
+ className: "h-8"
793
+ })]
794
+ }),
795
+ /* @__PURE__ */ jsx(Button, {
796
+ variant: "ghost",
797
+ size: "icon",
798
+ onClick: () => {
799
+ if (valueToDelete === id) onRemove?.(id);
800
+ else onDelete(id);
801
+ },
802
+ className: cn("h-6 w-6 opacity-0 transition-opacity duration-200", isActive && "opacity-100"),
803
+ title: valueToDelete === id && isActive ? "Click again to remove" : "Remove",
804
+ children: valueToDelete === id ? /* @__PURE__ */ jsx(AlertCircle, { className: "h-3 w-3 text-destructive" }) : /* @__PURE__ */ jsx(Trash2, { className: "h-3 w-3" })
805
+ })
806
+ ]
807
+ });
1679
808
  });
1680
809
 
1681
810
  //#endregion
@@ -1715,12 +844,12 @@ const SidePanelHeadersTab = () => {
1715
844
  })
1716
845
  }), /* @__PURE__ */ jsxs("div", {
1717
846
  className: "p-2",
1718
- children: [Object.entries(headers).map(([key_0, header]) => /* @__PURE__ */ jsx(ConfigurationListItem, {
847
+ children: [Object.entries(headers).map(([key, header]) => /* @__PURE__ */ jsx(ConfigurationListItem, {
1719
848
  value: header,
1720
- id: key_0,
849
+ id: key,
1721
850
  onUpdate: updateHeader,
1722
851
  onRemove: removeHeaders
1723
- }, key_0)), Object.entries(headers).length === 0 && /* @__PURE__ */ jsx("div", {
852
+ }, key)), Object.entries(headers).length === 0 && /* @__PURE__ */ jsx("div", {
1724
853
  className: "grid grid-cols-1 items-center h-full",
1725
854
  children: /* @__PURE__ */ jsx("div", {
1726
855
  className: "text-sm text-muted-foreground text-center",
@@ -1735,127 +864,57 @@ const SidePanelHeadersTab = () => {
1735
864
  //#region src/hooks/use-path-url.ts
1736
865
  const queryParamsSelector = (state) => Object.values(getQueryParamsSelector(state)).filter((param) => param.active && param.value !== "" && param.name !== "");
1737
866
  const usePathUrl = (path) => {
1738
- const $ = c(6);
1739
- if ($[0] !== "7e3e8f17b13eb81e00060ed9f39b6042cd1d077a2d43f0c27437d6309314f3aa") {
1740
- for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
1741
- $[0] = "7e3e8f17b13eb81e00060ed9f39b6042cd1d077a2d43f0c27437d6309314f3aa";
1742
- }
1743
867
  const pathParams = useEndpointConfiguration(useShallow(getPathParamsSelector));
1744
868
  const queryParams = useEndpointConfiguration(useShallow(queryParamsSelector));
1745
- let t0;
1746
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1747
- t0 = /:(\w+)/g;
1748
- $[1] = t0;
1749
- } else t0 = $[1];
1750
- let t1;
1751
- if ($[2] !== pathParams) {
1752
- t1 = (match, p1) => pathParams[p1]?.value || match;
1753
- $[2] = pathParams;
1754
- $[3] = t1;
1755
- } else t1 = $[3];
1756
- const url = path.replace(t0, t1);
1757
- let t2;
1758
- if ($[4] !== queryParams) {
1759
- t2 = queryParams.length > 0 ? `?${queryParams.map(_temp$2).join("&")}` : "";
1760
- $[4] = queryParams;
1761
- $[5] = t2;
1762
- } else t2 = $[5];
1763
- return url + t2;
869
+ return useMemo(() => {
870
+ return path.replace(/:(\w+)/g, (match, p1) => {
871
+ return pathParams[p1]?.value || match;
872
+ }) + (queryParams.length > 0 ? `?${queryParams.map((param) => `${param.name}=${param.value}`).join("&")}` : "");
873
+ }, [
874
+ path,
875
+ pathParams,
876
+ queryParams
877
+ ]);
1764
878
  };
1765
- function _temp$2(param) {
1766
- return `${param.name}=${param.value}`;
1767
- }
1768
879
 
1769
880
  //#endregion
1770
881
  //#region src/components/endpoint-path-preview.tsx
1771
- const EndpointPathPreview = (t0) => {
1772
- const $ = c(17);
1773
- if ($[0] !== "d28e3e9329232a2b4ad7f30814822a8f9a40f9e19a3e5c4e80f13d7dbd0fed07") {
1774
- for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
1775
- $[0] = "d28e3e9329232a2b4ad7f30814822a8f9a40f9e19a3e5c4e80f13d7dbd0fed07";
1776
- }
1777
- const { path, baseUrl: t1 } = t0;
1778
- const fullUrl = `${t1 === void 0 ? window.location.origin : t1}${usePathUrl(path)}`;
882
+ const EndpointPathPreview = ({ path, baseUrl = window.location.origin }) => {
883
+ const fullUrl = `${baseUrl}${usePathUrl(path)}`;
1779
884
  const [copied, setCopied] = useState(false);
1780
- let t2;
1781
- if ($[1] !== fullUrl) {
1782
- t2 = async () => {
1783
- try {
1784
- await navigator.clipboard.writeText(fullUrl);
1785
- setCopied(true);
1786
- setTimeout(() => setCopied(false), 2e3);
1787
- } catch (t3$1) {
1788
- const err = t3$1;
1789
- console.error("Failed to copy URL:", err);
1790
- }
1791
- };
1792
- $[1] = fullUrl;
1793
- $[2] = t2;
1794
- } else t2 = $[2];
1795
- const handleCopy = t2;
1796
- let t3;
1797
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
1798
- t3 = /* @__PURE__ */ jsx("div", {
885
+ const handleCopy = async () => {
886
+ try {
887
+ await navigator.clipboard.writeText(fullUrl);
888
+ setCopied(true);
889
+ setTimeout(() => setCopied(false), 2e3);
890
+ } catch (err) {
891
+ console.error("Failed to copy URL:", err);
892
+ }
893
+ };
894
+ return /* @__PURE__ */ jsxs("div", {
895
+ className: "grid grid-cols-[auto_1fr] items-center gap-5 px-5 relative border-b border-border",
896
+ children: [/* @__PURE__ */ jsx("div", {
1799
897
  className: "text-sm font-medium py-2",
1800
898
  children: "URL Preview"
1801
- });
1802
- $[3] = t3;
1803
- } else t3 = $[3];
1804
- let t4;
1805
- if ($[4] !== fullUrl) {
1806
- t4 = /* @__PURE__ */ jsx("div", {
1807
- className: "min-w-0",
1808
- children: /* @__PURE__ */ jsx("div", {
1809
- className: "font-medium text-xs text-muted-foreground truncate",
1810
- title: fullUrl,
1811
- children: fullUrl
1812
- })
1813
- });
1814
- $[4] = fullUrl;
1815
- $[5] = t4;
1816
- } else t4 = $[5];
1817
- const t5 = copied ? "text-green-400" : "text-muted-foreground";
1818
- let t6;
1819
- if ($[6] !== t5) {
1820
- t6 = cn("w-3 h-3 grid place-items-center transition-colors cursor-pointer", t5);
1821
- $[6] = t5;
1822
- $[7] = t6;
1823
- } else t6 = $[7];
1824
- let t7;
1825
- if ($[8] !== copied) {
1826
- t7 = copied ? /* @__PURE__ */ jsx(Check, { className: "w-2.5 h-2.5" }) : /* @__PURE__ */ jsx(Copy, { className: "w-2.5 h-2.5" });
1827
- $[8] = copied;
1828
- $[9] = t7;
1829
- } else t7 = $[9];
1830
- let t8;
1831
- if ($[10] !== handleCopy || $[11] !== t6 || $[12] !== t7) {
1832
- t8 = /* @__PURE__ */ jsx(Button, {
1833
- onClick: handleCopy,
1834
- className: t6,
1835
- variant: "icon",
1836
- size: "sm",
1837
- "aria-label": "Copy URL",
1838
- children: t7
1839
- });
1840
- $[10] = handleCopy;
1841
- $[11] = t6;
1842
- $[12] = t7;
1843
- $[13] = t8;
1844
- } else t8 = $[13];
1845
- let t9;
1846
- if ($[14] !== t4 || $[15] !== t8) {
1847
- t9 = /* @__PURE__ */ jsxs("div", {
1848
- className: "grid grid-cols-[auto_1fr] items-center gap-5 px-5 relative border-b border-border",
1849
- children: [t3, /* @__PURE__ */ jsxs("div", {
1850
- className: "bg-muted-foreground/10 box-border grid grid-cols-[1fr_auto] gap-1 h-6 items-center px-2 py-1 rounded border border-border",
1851
- children: [t4, t8]
899
+ }), /* @__PURE__ */ jsxs("div", {
900
+ className: "bg-muted-foreground/10 box-border grid grid-cols-[1fr_auto] gap-1 h-6 items-center px-2 py-1 rounded border border-border",
901
+ children: [/* @__PURE__ */ jsx("div", {
902
+ className: "min-w-0",
903
+ children: /* @__PURE__ */ jsx("div", {
904
+ className: "font-medium text-xs text-muted-foreground truncate",
905
+ title: fullUrl,
906
+ children: fullUrl
907
+ })
908
+ }), /* @__PURE__ */ jsx(Button, {
909
+ onClick: handleCopy,
910
+ className: cn("w-3 h-3 grid place-items-center transition-colors cursor-pointer", copied ? "text-green-400" : "text-muted-foreground"),
911
+ variant: "icon",
912
+ size: "sm",
913
+ "aria-label": "Copy URL",
914
+ children: copied ? /* @__PURE__ */ jsx(Check, { className: "w-2.5 h-2.5" }) : /* @__PURE__ */ jsx(Copy, { className: "w-2.5 h-2.5" })
1852
915
  })]
1853
- });
1854
- $[14] = t4;
1855
- $[15] = t8;
1856
- $[16] = t9;
1857
- } else t9 = $[16];
1858
- return t9;
916
+ })]
917
+ });
1859
918
  };
1860
919
 
1861
920
  //#endregion
@@ -1894,13 +953,13 @@ const SidePanelParamsTab = ({ path }) => {
1894
953
  }
1895
954
  });
1896
955
  }, [queryParams, setQueryParams]);
1897
- const updatePathParam = useCallback((key_0, field_0, value_0) => {
1898
- if (!key_0) return;
956
+ const updatePathParam = useCallback((key, field, value) => {
957
+ if (!key) return;
1899
958
  setPathParams({
1900
959
  ...pathParams,
1901
- [key_0]: {
1902
- ...pathParams[key_0],
1903
- [field_0]: value_0
960
+ [key]: {
961
+ ...pathParams[key],
962
+ [field]: value
1904
963
  }
1905
964
  });
1906
965
  }, [pathParams, setPathParams]);
@@ -1940,12 +999,12 @@ const SidePanelParamsTab = ({ path }) => {
1940
999
  className: "text-sm font-medium pl-3",
1941
1000
  children: "Query parameters"
1942
1001
  }),
1943
- Object.entries(queryParams).map(([key_1, param_0]) => /* @__PURE__ */ jsx(ConfigurationListItem, {
1944
- value: param_0,
1945
- id: key_1,
1002
+ Object.entries(queryParams).map(([key, param]) => /* @__PURE__ */ jsx(ConfigurationListItem, {
1003
+ value: param,
1004
+ id: key,
1946
1005
  onUpdate: updateParam,
1947
1006
  onRemove: removeQueryParams
1948
- }, key_1)),
1007
+ }, key)),
1949
1008
  Object.entries(queryParams).length === 0 && /* @__PURE__ */ jsx("div", {
1950
1009
  className: "grid grid-cols-1 items-center h-full",
1951
1010
  children: /* @__PURE__ */ jsx("div", {
@@ -1963,64 +1022,19 @@ const SidePanelParamsTab = ({ path }) => {
1963
1022
  //#endregion
1964
1023
  //#region src/hooks/use-state-stream.ts
1965
1024
  const useStateStream = (object) => {
1966
- const $ = c(15);
1967
- if ($[0] !== "285f0ed50e2dd4fc3015728ea5aa13d2c7f564b6cdec2adc1e1f9b84c6cc298a") {
1968
- for (let $i = 0; $i < 15; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
1969
- $[0] = "285f0ed50e2dd4fc3015728ea5aa13d2c7f564b6cdec2adc1e1f9b84c6cc298a";
1970
- }
1971
- let t0;
1972
- if ($[1] !== object) {
1973
- t0 = typeof object === "string" ? {} : object || {};
1974
- $[1] = object;
1975
- $[2] = t0;
1976
- } else t0 = $[2];
1977
- let __motia;
1978
- let rest;
1979
- if ($[3] !== t0) {
1980
- ({__motia, ...rest} = t0);
1981
- $[3] = t0;
1982
- $[4] = __motia;
1983
- $[5] = rest;
1984
- } else {
1985
- __motia = $[4];
1986
- rest = $[5];
1987
- }
1025
+ const { __motia, ...rest } = typeof object === "string" ? {} : object || {};
1988
1026
  const { data } = useStreamItem(__motia);
1989
1027
  const originalData = Array.isArray(object) ? object : rest || object;
1990
- if (typeof object === "string") {
1991
- let t1$1;
1992
- if ($[6] !== object) {
1993
- t1$1 = {
1994
- data: object,
1995
- originalData: object,
1996
- isStreamed: false
1997
- };
1998
- $[6] = object;
1999
- $[7] = t1$1;
2000
- } else t1$1 = $[7];
2001
- return t1$1;
2002
- }
2003
- let t1;
2004
- if ($[8] !== data || $[9] !== originalData) {
2005
- t1 = JSON.stringify(data || originalData, null, 2);
2006
- $[8] = data;
2007
- $[9] = originalData;
2008
- $[10] = t1;
2009
- } else t1 = $[10];
2010
- const t2 = !!__motia;
2011
- let t3;
2012
- if ($[11] !== originalData || $[12] !== t1 || $[13] !== t2) {
2013
- t3 = {
2014
- data: t1,
2015
- originalData,
2016
- isStreamed: t2
2017
- };
2018
- $[11] = originalData;
2019
- $[12] = t1;
2020
- $[13] = t2;
2021
- $[14] = t3;
2022
- } else t3 = $[14];
2023
- return t3;
1028
+ if (typeof object === "string") return {
1029
+ data: object,
1030
+ originalData: object,
1031
+ isStreamed: false
1032
+ };
1033
+ return {
1034
+ data: JSON.stringify(data || originalData, null, 2),
1035
+ originalData,
1036
+ isStreamed: !!__motia
1037
+ };
2024
1038
  };
2025
1039
 
2026
1040
  //#endregion
@@ -2095,59 +1109,19 @@ const getStatusMessage = (statusCode) => {
2095
1109
 
2096
1110
  //#endregion
2097
1111
  //#region src/play/response-code.tsx
2098
- const ResponseCode = (t0) => {
2099
- const $ = c(13);
2100
- if ($[0] !== "0a8e4c92b858ecb81d25d971cc42d057e6dc5a30e6757fd87f3755a59a3871b2") {
2101
- for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
2102
- $[0] = "0a8e4c92b858ecb81d25d971cc42d057e6dc5a30e6757fd87f3755a59a3871b2";
2103
- }
2104
- const { statusCode } = t0;
2105
- let t1;
2106
- if ($[1] !== statusCode) {
2107
- t1 = getStatusMessage(statusCode);
2108
- $[1] = statusCode;
2109
- $[2] = t1;
2110
- } else t1 = $[2];
2111
- const statusMessage = t1;
2112
- const isSuccess = statusCode > 0 && statusCode < 400;
2113
- const isWarning = statusCode >= 400 && statusCode < 500;
2114
- const isError = statusCode >= 500;
2115
- const t2 = isWarning && "dark:bg-[#EAB71F]/20 dark:text-[#EAB71F] bg-[#EAB71F] text-white";
2116
- const t3 = isError && "dark:bg-[#F8367D]/20 dark:text-[#F8367D] bg-[#F8367D] text-white";
2117
- const t4 = isSuccess && "dark:bg-accent-200 dark:text-primary bg-accent text-white";
2118
- let t5;
2119
- if ($[3] !== t2 || $[4] !== t3 || $[5] !== t4) {
2120
- t5 = cn("px-2 py-1 rounded-sm flex items-center gap-1", t2, t3, t4);
2121
- $[3] = t2;
2122
- $[4] = t3;
2123
- $[5] = t4;
2124
- $[6] = t5;
2125
- } else t5 = $[6];
2126
- let t6;
2127
- if ($[7] !== statusCode) {
2128
- t6 = /* @__PURE__ */ jsx("span", {
2129
- className: "font-bold font-mono",
2130
- children: statusCode
2131
- });
2132
- $[7] = statusCode;
2133
- $[8] = t6;
2134
- } else t6 = $[8];
2135
- let t7;
2136
- if ($[9] !== statusMessage || $[10] !== t5 || $[11] !== t6) {
2137
- t7 = /* @__PURE__ */ jsxs("div", {
2138
- className: t5,
2139
- children: [
2140
- t6,
2141
- " ",
2142
- statusMessage
2143
- ]
2144
- });
2145
- $[9] = statusMessage;
2146
- $[10] = t5;
2147
- $[11] = t6;
2148
- $[12] = t7;
2149
- } else t7 = $[12];
2150
- return t7;
1112
+ const ResponseCode = ({ statusCode }) => {
1113
+ const statusMessage = getStatusMessage(statusCode);
1114
+ return /* @__PURE__ */ jsxs("div", {
1115
+ className: cn("px-2 py-1 rounded-sm flex items-center gap-1", statusCode >= 400 && statusCode < 500 && "dark:bg-[#EAB71F]/20 dark:text-[#EAB71F] bg-[#EAB71F] text-white", statusCode >= 500 && "dark:bg-[#F8367D]/20 dark:text-[#F8367D] bg-[#F8367D] text-white", statusCode > 0 && statusCode < 400 && "dark:bg-accent-200 dark:text-primary bg-accent text-white"),
1116
+ children: [
1117
+ /* @__PURE__ */ jsx("span", {
1118
+ className: "font-bold font-mono",
1119
+ children: statusCode
1120
+ }),
1121
+ " ",
1122
+ statusMessage
1123
+ ]
1124
+ });
2151
1125
  };
2152
1126
 
2153
1127
  //#endregion
@@ -2166,44 +1140,25 @@ const useLanguage = (contentType) => {
2166
1140
  if (contentType?.includes("html")) return "html";
2167
1141
  return "text";
2168
1142
  };
2169
- const ResponseContent = (t0) => {
2170
- const $ = c(14);
2171
- if ($[0] !== "51b73d23c1291874f81ba55f0a6e81eecd3ad0cede326e91ed482cd0ab995a8f") {
2172
- for (let $i = 0; $i < 14; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
2173
- $[0] = "51b73d23c1291874f81ba55f0a6e81eecd3ad0cede326e91ed482cd0ab995a8f";
2174
- }
2175
- const { code, blob, contentType } = t0;
2176
- const themeStyle = useThemeStore(_temp$1) === "dark" ? atomDark : oneLight;
1143
+ const ResponseContent = ({ code, blob, contentType }) => {
1144
+ const themeStyle = useThemeStore((state) => state.theme) === "dark" ? atomDark : oneLight;
2177
1145
  const language = useLanguage(contentType);
2178
- let t1;
2179
- if ($[1] !== blob) {
2180
- t1 = () => {
2181
- if (blob) {
2182
- const url = URL.createObjectURL(blob);
2183
- window.open(url, "_blank");
2184
- }
2185
- };
2186
- $[1] = blob;
2187
- $[2] = t1;
2188
- } else t1 = $[2];
2189
- const onDownload = t1;
2190
- let t2;
2191
- if ($[3] !== blob || $[4] !== onDownload) {
2192
- t2 = blob && /* @__PURE__ */ jsx("div", {
1146
+ const onDownload = () => {
1147
+ if (blob) {
1148
+ const url = URL.createObjectURL(blob);
1149
+ window.open(url, "_blank");
1150
+ }
1151
+ };
1152
+ return /* @__PURE__ */ jsxs("div", {
1153
+ className: "flex flex-col h-full overflow-y-auto",
1154
+ children: [blob && /* @__PURE__ */ jsx("div", {
2193
1155
  className: "flex p-8 justify-center",
2194
1156
  children: /* @__PURE__ */ jsxs(Button, {
2195
1157
  variant: "default",
2196
1158
  onClick: onDownload,
2197
1159
  children: [/* @__PURE__ */ jsx(Download, { className: "h-4 w-4" }), " Download"]
2198
1160
  })
2199
- });
2200
- $[3] = blob;
2201
- $[4] = onDownload;
2202
- $[5] = t2;
2203
- } else t2 = $[5];
2204
- let t3;
2205
- if ($[6] !== blob || $[7] !== code || $[8] !== language || $[9] !== themeStyle) {
2206
- t3 = !blob && code && /* @__PURE__ */ jsx(Prism, {
1161
+ }), !blob && code && /* @__PURE__ */ jsx(Prism, {
2207
1162
  showLineNumbers: true,
2208
1163
  language,
2209
1164
  style: themeStyle,
@@ -2211,182 +1166,76 @@ const ResponseContent = (t0) => {
2211
1166
  customStyle,
2212
1167
  wrapLines: true,
2213
1168
  children: code
2214
- });
2215
- $[6] = blob;
2216
- $[7] = code;
2217
- $[8] = language;
2218
- $[9] = themeStyle;
2219
- $[10] = t3;
2220
- } else t3 = $[10];
2221
- let t4;
2222
- if ($[11] !== t2 || $[12] !== t3) {
2223
- t4 = /* @__PURE__ */ jsxs("div", {
2224
- className: "flex flex-col h-full overflow-y-auto",
2225
- children: [t2, t3]
2226
- });
2227
- $[11] = t2;
2228
- $[12] = t3;
2229
- $[13] = t4;
2230
- } else t4 = $[13];
2231
- return t4;
1169
+ })]
1170
+ });
2232
1171
  };
2233
- function _temp$1(state) {
2234
- return state.theme;
2235
- }
2236
1172
 
2237
1173
  //#endregion
2238
1174
  //#region src/play/side-panel-response.tsx
2239
1175
  const SidePanelResponse = memo(() => {
2240
- const $ = c(29);
2241
- if ($[0] !== "c41d9d0c255bfb25883f458c9673498cbc698b0e44623ab8537e78707a43852c") {
2242
- for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
2243
- $[0] = "c41d9d0c255bfb25883f458c9673498cbc698b0e44623ab8537e78707a43852c";
2244
- }
2245
1176
  const { setResponse } = useEndpointConfiguration();
2246
1177
  const response = useEndpointConfiguration(getResponseSelector);
2247
1178
  const { data } = useStateStream(response?.body instanceof Blob ? void 0 : response?.body);
2248
1179
  const [activeTab, setActiveTab] = useState("preview");
2249
- let t0;
2250
- if ($[1] !== setResponse) {
2251
- t0 = () => setResponse(void 0);
2252
- $[1] = setResponse;
2253
- $[2] = t0;
2254
- } else t0 = $[2];
2255
- const onClose = t0;
1180
+ const onClose = () => setResponse(void 0);
2256
1181
  if (!response) return null;
2257
- let t1;
2258
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
2259
- t1 = (value) => setActiveTab(value);
2260
- $[3] = t1;
2261
- } else t1 = $[3];
2262
- let t2;
2263
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
2264
- t2 = /* @__PURE__ */ jsxs(TabsList, { children: [/* @__PURE__ */ jsx(TabsTrigger, {
2265
- value: "preview",
2266
- className: "cursor-pointer",
2267
- children: "Preview"
2268
- }), /* @__PURE__ */ jsx(TabsTrigger, {
2269
- value: "headers",
2270
- className: "grid grid-cols-[auto_auto] gap-2 items-center cursor-pointer",
2271
- children: "Headers"
2272
- })] });
2273
- $[4] = t2;
2274
- } else t2 = $[4];
2275
- let t3;
2276
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
2277
- t3 = /* @__PURE__ */ jsx(X, { className: "h-4 w-4" });
2278
- $[5] = t3;
2279
- } else t3 = $[5];
2280
- let t4;
2281
- if ($[6] !== onClose) {
2282
- t4 = /* @__PURE__ */ jsxs("div", {
2283
- className: "grid grid-cols-[1fr_auto] items-center h-10 border-b px-5 bg-card",
2284
- children: [t2, /* @__PURE__ */ jsx(Button, {
2285
- variant: "ghost",
2286
- size: "icon",
2287
- onClick: onClose,
2288
- children: t3
2289
- })]
2290
- });
2291
- $[6] = onClose;
2292
- $[7] = t4;
2293
- } else t4 = $[7];
2294
- let t5;
2295
- if ($[8] !== response.statusCode) {
2296
- t5 = /* @__PURE__ */ jsx(ResponseCode, { statusCode: response.statusCode });
2297
- $[8] = response.statusCode;
2298
- $[9] = t5;
2299
- } else t5 = $[9];
2300
- let t6;
2301
- if ($[10] !== response.executionTime) {
2302
- t6 = !!response.executionTime && /* @__PURE__ */ jsxs("div", {
2303
- className: "text-muted-foreground bg-muted-foreground/10 px-2 py-1 rounded-sm",
2304
- children: [response.executionTime, "ms"]
2305
- });
2306
- $[10] = response.executionTime;
2307
- $[11] = t6;
2308
- } else t6 = $[11];
2309
- let t7;
2310
- if ($[12] !== t5 || $[13] !== t6) {
2311
- t7 = /* @__PURE__ */ jsx("div", {
2312
- className: "sticky bottom-0 border-b border-border p-3 text-sm flex items-center gap-1 font-medium",
2313
- children: /* @__PURE__ */ jsxs("div", {
2314
- className: "flex flex-row items-center flex-1 gap-3",
2315
- children: [t5, t6]
2316
- })
2317
- });
2318
- $[12] = t5;
2319
- $[13] = t6;
2320
- $[14] = t7;
2321
- } else t7 = $[14];
2322
- const t8 = response?.body instanceof Blob ? response.body : void 0;
2323
- const t9 = response.headers["content-type"];
2324
- let t10;
2325
- if ($[15] !== data || $[16] !== t8 || $[17] !== t9) {
2326
- t10 = /* @__PURE__ */ jsx(TabsContent, {
2327
- value: "preview",
2328
- children: /* @__PURE__ */ jsx(ResponseContent, {
2329
- code: data,
2330
- blob: t8,
2331
- contentType: t9
2332
- })
2333
- });
2334
- $[15] = data;
2335
- $[16] = t8;
2336
- $[17] = t9;
2337
- $[18] = t10;
2338
- } else t10 = $[18];
2339
- let t11;
2340
- if ($[19] !== response.headers) {
2341
- t11 = response.headers && Object.entries(response.headers).map(_temp);
2342
- $[19] = response.headers;
2343
- $[20] = t11;
2344
- } else t11 = $[20];
2345
- let t12;
2346
- if ($[21] !== t11) {
2347
- t12 = /* @__PURE__ */ jsx(TabsContent, {
2348
- value: "headers",
2349
- children: /* @__PURE__ */ jsx("div", {
2350
- className: "grid grid-cols-[auto_minmax(0,1fr)] gap-4 p-4 overflow-auto auto-rows-max h-full",
2351
- children: t11
1182
+ return /* @__PURE__ */ jsxs(Tabs, {
1183
+ value: activeTab,
1184
+ onValueChange: (value) => setActiveTab(value),
1185
+ className: "border-l border-border",
1186
+ "data-testid": "endpoint-response-container",
1187
+ children: [
1188
+ /* @__PURE__ */ jsxs("div", {
1189
+ className: "grid grid-cols-[1fr_auto] items-center h-10 border-b px-5 bg-card",
1190
+ children: [/* @__PURE__ */ jsxs(TabsList, { children: [/* @__PURE__ */ jsx(TabsTrigger, {
1191
+ value: "preview",
1192
+ className: "cursor-pointer",
1193
+ children: "Preview"
1194
+ }), /* @__PURE__ */ jsx(TabsTrigger, {
1195
+ value: "headers",
1196
+ className: "grid grid-cols-[auto_auto] gap-2 items-center cursor-pointer",
1197
+ children: "Headers"
1198
+ })] }), /* @__PURE__ */ jsx(Button, {
1199
+ variant: "ghost",
1200
+ size: "icon",
1201
+ onClick: onClose,
1202
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
1203
+ })]
1204
+ }),
1205
+ /* @__PURE__ */ jsx("div", {
1206
+ className: "sticky bottom-0 border-b border-border p-3 text-sm flex items-center gap-1 font-medium",
1207
+ children: /* @__PURE__ */ jsxs("div", {
1208
+ className: "flex flex-row items-center flex-1 gap-3",
1209
+ children: [/* @__PURE__ */ jsx(ResponseCode, { statusCode: response.statusCode }), !!response.executionTime && /* @__PURE__ */ jsxs("div", {
1210
+ className: "text-muted-foreground bg-muted-foreground/10 px-2 py-1 rounded-sm",
1211
+ children: [response.executionTime, "ms"]
1212
+ })]
1213
+ })
1214
+ }),
1215
+ /* @__PURE__ */ jsx(TabsContent, {
1216
+ value: "preview",
1217
+ children: /* @__PURE__ */ jsx(ResponseContent, {
1218
+ code: data,
1219
+ blob: response?.body instanceof Blob ? response.body : void 0,
1220
+ contentType: response.headers["content-type"]
1221
+ })
1222
+ }),
1223
+ /* @__PURE__ */ jsx(TabsContent, {
1224
+ value: "headers",
1225
+ children: /* @__PURE__ */ jsx("div", {
1226
+ className: "grid grid-cols-[auto_minmax(0,1fr)] gap-4 p-4 overflow-auto auto-rows-max h-full",
1227
+ children: response.headers && Object.entries(response.headers).map(([key, value]) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
1228
+ className: "font-bold text-sm h-8 items-center grid whitespace-nowrap",
1229
+ children: key
1230
+ }), /* @__PURE__ */ jsx("span", {
1231
+ className: "text-sm text-muted-foreground h-8 items-center grid whitespace-nowrap",
1232
+ children: value
1233
+ })] }))
1234
+ })
2352
1235
  })
2353
- });
2354
- $[21] = t11;
2355
- $[22] = t12;
2356
- } else t12 = $[22];
2357
- let t13;
2358
- if ($[23] !== activeTab || $[24] !== t10 || $[25] !== t12 || $[26] !== t4 || $[27] !== t7) {
2359
- t13 = /* @__PURE__ */ jsxs(Tabs, {
2360
- value: activeTab,
2361
- onValueChange: t1,
2362
- className: "border-l border-border",
2363
- "data-testid": "endpoint-response-container",
2364
- children: [
2365
- t4,
2366
- t7,
2367
- t10,
2368
- t12
2369
- ]
2370
- });
2371
- $[23] = activeTab;
2372
- $[24] = t10;
2373
- $[25] = t12;
2374
- $[26] = t4;
2375
- $[27] = t7;
2376
- $[28] = t13;
2377
- } else t13 = $[28];
2378
- return t13;
1236
+ ]
1237
+ });
2379
1238
  });
2380
- function _temp(t0) {
2381
- const [key, value_0] = t0;
2382
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
2383
- className: "font-bold text-sm h-8 items-center grid whitespace-nowrap",
2384
- children: key
2385
- }), /* @__PURE__ */ jsx("span", {
2386
- className: "text-sm text-muted-foreground h-8 items-center grid whitespace-nowrap",
2387
- children: value_0
2388
- })] });
2389
- }
2390
1239
 
2391
1240
  //#endregion
2392
1241
  //#region src/play/trigger-button.tsx
@@ -2399,8 +1248,8 @@ const TriggerButton = memo(({ method, path }) => {
2399
1248
  const onClick = async () => {
2400
1249
  try {
2401
1250
  setIsLoading(true);
2402
- const _headers = Object.values(headers).filter((header) => header.active && header.name !== "" && header.value !== "").reduce((acc, header_0) => {
2403
- acc[header_0.name.toLowerCase()] = header_0.value;
1251
+ const _headers = Object.values(headers).filter((header) => header.active && header.name !== "" && header.value !== "").reduce((acc, header) => {
1252
+ acc[header.name.toLowerCase()] = header.value;
2404
1253
  return acc;
2405
1254
  }, {});
2406
1255
  const startTime = Date.now();
@@ -2435,416 +1284,157 @@ const TriggerButton = memo(({ method, path }) => {
2435
1284
  const headersCountSelector = (state) => Object.keys(getHeadersSelector(state)).length;
2436
1285
  const hasResponseSelector = (state) => getResponseSelector(state) !== void 0;
2437
1286
  const paramsCountSelector = (state) => Object.keys(getQueryParamsSelector(state)).length;
2438
- const SidePanel = memo((t0) => {
2439
- const $ = c(62);
2440
- if ($[0] !== "0020adea1162c54cf5aae85d8c5ed34a7262d6cfdf90ef6b8d89094328918944") {
2441
- for (let $i = 0; $i < 62; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
2442
- $[0] = "0020adea1162c54cf5aae85d8c5ed34a7262d6cfdf90ef6b8d89094328918944";
2443
- }
2444
- const { endpoint, onClose } = t0;
1287
+ const SidePanel = memo(({ endpoint, onClose }) => {
2445
1288
  const [activeTab, setActiveTab] = useState(endpoint.method === "GET" || endpoint.method === "DELETE" ? "params" : "body");
2446
1289
  const [isSpecOpen, setIsSpecOpen] = useState(false);
2447
1290
  const headersCount = useEndpointConfiguration(useShallow(headersCountSelector));
2448
1291
  const hasResponse = useEndpointConfiguration(useShallow(hasResponseSelector));
2449
1292
  const pathParamsCount = usePathParams(endpoint.path).length;
2450
1293
  const paramsCount = useEndpointConfiguration(useShallow(paramsCountSelector)) + pathParamsCount;
2451
- let t1;
2452
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
2453
- t1 = /* @__PURE__ */ jsx(BackgroundEffect, {});
2454
- $[1] = t1;
2455
- } else t1 = $[1];
2456
- let t2;
2457
- if ($[2] !== endpoint.method || $[3] !== endpoint.path) {
2458
- t2 = /* @__PURE__ */ jsx(EndpointPath, {
2459
- method: endpoint.method,
2460
- path: endpoint.path
2461
- });
2462
- $[2] = endpoint.method;
2463
- $[3] = endpoint.path;
2464
- $[4] = t2;
2465
- } else t2 = $[4];
2466
- let t3;
2467
- if ($[5] !== endpoint.description) {
2468
- t3 = endpoint.description && /* @__PURE__ */ jsx("p", {
2469
- className: "text-sm text-muted-foreground",
2470
- children: endpoint.description
2471
- });
2472
- $[5] = endpoint.description;
2473
- $[6] = t3;
2474
- } else t3 = $[6];
2475
- let t4;
2476
- if ($[7] !== t2 || $[8] !== t3) {
2477
- t4 = /* @__PURE__ */ jsxs("div", {
2478
- className: "grid grid-rows-2 gap-2",
2479
- children: [t2, t3]
2480
- });
2481
- $[7] = t2;
2482
- $[8] = t3;
2483
- $[9] = t4;
2484
- } else t4 = $[9];
2485
- let t5;
2486
- if ($[10] !== isSpecOpen) {
2487
- t5 = () => setIsSpecOpen(!isSpecOpen);
2488
- $[10] = isSpecOpen;
2489
- $[11] = t5;
2490
- } else t5 = $[11];
2491
- let t6;
2492
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
2493
- t6 = /* @__PURE__ */ jsx(Book, {});
2494
- $[12] = t6;
2495
- } else t6 = $[12];
2496
- let t7;
2497
- if ($[13] !== t5) {
2498
- t7 = /* @__PURE__ */ jsx("div", {
2499
- className: "flex items-end justify-end",
2500
- children: /* @__PURE__ */ jsx(Button, {
2501
- variant: "icon",
2502
- size: "icon",
2503
- onClick: t5,
2504
- "data-testid": "endpoint-spec-button",
2505
- children: t6
1294
+ return /* @__PURE__ */ jsxs("div", {
1295
+ className: "isolate grid grid-cols-1 overflow-y-auto min-w-0 grid-rows-[auto_1fr] border-l border-border",
1296
+ "data-testid": "endpoint-details-panel",
1297
+ children: [
1298
+ /* @__PURE__ */ jsx(BackgroundEffect, {}),
1299
+ /* @__PURE__ */ jsxs("div", {
1300
+ className: "grid grid-cols-[1fr_1fr_auto] items-start gap-4 px-5 py-4 border-b bg-card w-full",
1301
+ children: [
1302
+ /* @__PURE__ */ jsxs("div", {
1303
+ className: "grid grid-rows-2 gap-2",
1304
+ children: [/* @__PURE__ */ jsx(EndpointPath, {
1305
+ method: endpoint.method,
1306
+ path: endpoint.path
1307
+ }), endpoint.description && /* @__PURE__ */ jsx("p", {
1308
+ className: "text-sm text-muted-foreground",
1309
+ children: endpoint.description
1310
+ })]
1311
+ }),
1312
+ /* @__PURE__ */ jsx("div", {
1313
+ className: "flex items-end justify-end",
1314
+ children: /* @__PURE__ */ jsx(Button, {
1315
+ variant: "icon",
1316
+ size: "icon",
1317
+ onClick: () => setIsSpecOpen(!isSpecOpen),
1318
+ "data-testid": "endpoint-spec-button",
1319
+ children: /* @__PURE__ */ jsx(Book, {})
1320
+ })
1321
+ }),
1322
+ /* @__PURE__ */ jsx(Button, {
1323
+ variant: "icon",
1324
+ size: "icon",
1325
+ onClick: onClose,
1326
+ children: /* @__PURE__ */ jsx(X, {})
1327
+ })
1328
+ ]
1329
+ }),
1330
+ /* @__PURE__ */ jsxs("div", {
1331
+ className: cn("grid grid-cols-[minmax(380px,1fr)_minmax(auto,1fr)]", !hasResponse && "grid-cols-1"),
1332
+ children: [/* @__PURE__ */ jsxs(Tabs, {
1333
+ value: activeTab,
1334
+ onValueChange: (value) => setActiveTab(value),
1335
+ children: [
1336
+ /* @__PURE__ */ jsxs("div", {
1337
+ className: "grid grid-cols-[1fr_auto] items-center h-10 border-b px-5 bg-card",
1338
+ children: [/* @__PURE__ */ jsxs(TabsList, { children: [
1339
+ /* @__PURE__ */ jsxs(TabsTrigger, {
1340
+ value: "params",
1341
+ className: "grid grid-cols-[auto_auto] gap-2 items-center cursor-pointer",
1342
+ "data-testid": "endpoint-params-tab",
1343
+ children: ["Params", /* @__PURE__ */ jsx(Badge, {
1344
+ variant: "outline",
1345
+ className: "h-4 px-1.5 text-xs",
1346
+ children: paramsCount
1347
+ })]
1348
+ }),
1349
+ /* @__PURE__ */ jsx(TabsTrigger, {
1350
+ value: "body",
1351
+ className: "cursor-pointer",
1352
+ "data-testid": "endpoint-body-tab",
1353
+ children: "Body"
1354
+ }),
1355
+ /* @__PURE__ */ jsxs(TabsTrigger, {
1356
+ value: "headers",
1357
+ className: "grid grid-cols-[auto_auto] gap-2 items-center cursor-pointer",
1358
+ "data-testid": "endpoint-headers-tab",
1359
+ children: ["Headers", /* @__PURE__ */ jsx(Badge, {
1360
+ variant: "outline",
1361
+ className: "h-4 px-1.5 text-xs",
1362
+ children: headersCount
1363
+ })]
1364
+ })
1365
+ ] }), /* @__PURE__ */ jsx(TriggerButton, {
1366
+ method: endpoint.method,
1367
+ path: endpoint.path.toString()
1368
+ })]
1369
+ }),
1370
+ /* @__PURE__ */ jsx(TabsContent, {
1371
+ value: "params",
1372
+ children: /* @__PURE__ */ jsx(SidePanelParamsTab, { path: endpoint.path })
1373
+ }),
1374
+ /* @__PURE__ */ jsx(TabsContent, {
1375
+ value: "body",
1376
+ children: /* @__PURE__ */ jsx(SidePanelBodyTab, { schema: endpoint.bodySchema })
1377
+ }),
1378
+ /* @__PURE__ */ jsx(TabsContent, {
1379
+ value: "headers",
1380
+ children: /* @__PURE__ */ jsx(SidePanelHeadersTab, {})
1381
+ })
1382
+ ]
1383
+ }), /* @__PURE__ */ jsx(SidePanelResponse, {})]
1384
+ }),
1385
+ isSpecOpen && /* @__PURE__ */ jsx(SpecSidePanel, {
1386
+ endpoint,
1387
+ onClose: () => setIsSpecOpen(false)
2506
1388
  })
2507
- });
2508
- $[13] = t5;
2509
- $[14] = t7;
2510
- } else t7 = $[14];
2511
- let t8;
2512
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
2513
- t8 = /* @__PURE__ */ jsx(X, {});
2514
- $[15] = t8;
2515
- } else t8 = $[15];
2516
- let t9;
2517
- if ($[16] !== onClose) {
2518
- t9 = /* @__PURE__ */ jsx(Button, {
2519
- variant: "icon",
2520
- size: "icon",
2521
- onClick: onClose,
2522
- children: t8
2523
- });
2524
- $[16] = onClose;
2525
- $[17] = t9;
2526
- } else t9 = $[17];
2527
- let t10;
2528
- if ($[18] !== t4 || $[19] !== t7 || $[20] !== t9) {
2529
- t10 = /* @__PURE__ */ jsxs("div", {
2530
- className: "grid grid-cols-[1fr_1fr_auto] items-start gap-4 px-5 py-4 border-b bg-card w-full",
2531
- children: [
2532
- t4,
2533
- t7,
2534
- t9
2535
- ]
2536
- });
2537
- $[18] = t4;
2538
- $[19] = t7;
2539
- $[20] = t9;
2540
- $[21] = t10;
2541
- } else t10 = $[21];
2542
- const t11 = !hasResponse && "grid-cols-1";
2543
- let t12;
2544
- if ($[22] !== t11) {
2545
- t12 = cn("grid grid-cols-[minmax(380px,1fr)_minmax(auto,1fr)]", t11);
2546
- $[22] = t11;
2547
- $[23] = t12;
2548
- } else t12 = $[23];
2549
- let t13;
2550
- if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
2551
- t13 = (value) => setActiveTab(value);
2552
- $[24] = t13;
2553
- } else t13 = $[24];
2554
- let t14;
2555
- if ($[25] !== paramsCount) {
2556
- t14 = /* @__PURE__ */ jsxs(TabsTrigger, {
2557
- value: "params",
2558
- className: "grid grid-cols-[auto_auto] gap-2 items-center cursor-pointer",
2559
- "data-testid": "endpoint-params-tab",
2560
- children: ["Params", /* @__PURE__ */ jsx(Badge, {
2561
- variant: "outline",
2562
- className: "h-4 px-1.5 text-xs",
2563
- children: paramsCount
2564
- })]
2565
- });
2566
- $[25] = paramsCount;
2567
- $[26] = t14;
2568
- } else t14 = $[26];
2569
- let t15;
2570
- if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
2571
- t15 = /* @__PURE__ */ jsx(TabsTrigger, {
2572
- value: "body",
2573
- className: "cursor-pointer",
2574
- "data-testid": "endpoint-body-tab",
2575
- children: "Body"
2576
- });
2577
- $[27] = t15;
2578
- } else t15 = $[27];
2579
- let t16;
2580
- if ($[28] !== headersCount) {
2581
- t16 = /* @__PURE__ */ jsxs(TabsTrigger, {
2582
- value: "headers",
2583
- className: "grid grid-cols-[auto_auto] gap-2 items-center cursor-pointer",
2584
- "data-testid": "endpoint-headers-tab",
2585
- children: ["Headers", /* @__PURE__ */ jsx(Badge, {
2586
- variant: "outline",
2587
- className: "h-4 px-1.5 text-xs",
2588
- children: headersCount
2589
- })]
2590
- });
2591
- $[28] = headersCount;
2592
- $[29] = t16;
2593
- } else t16 = $[29];
2594
- let t17;
2595
- if ($[30] !== t14 || $[31] !== t16) {
2596
- t17 = /* @__PURE__ */ jsxs(TabsList, { children: [
2597
- t14,
2598
- t15,
2599
- t16
2600
- ] });
2601
- $[30] = t14;
2602
- $[31] = t16;
2603
- $[32] = t17;
2604
- } else t17 = $[32];
2605
- const t18 = endpoint.method;
2606
- let t19;
2607
- if ($[33] !== endpoint.path) {
2608
- t19 = endpoint.path.toString();
2609
- $[33] = endpoint.path;
2610
- $[34] = t19;
2611
- } else t19 = $[34];
2612
- let t20;
2613
- if ($[35] !== endpoint.method || $[36] !== t19) {
2614
- t20 = /* @__PURE__ */ jsx(TriggerButton, {
2615
- method: t18,
2616
- path: t19
2617
- });
2618
- $[35] = endpoint.method;
2619
- $[36] = t19;
2620
- $[37] = t20;
2621
- } else t20 = $[37];
2622
- let t21;
2623
- if ($[38] !== t17 || $[39] !== t20) {
2624
- t21 = /* @__PURE__ */ jsxs("div", {
2625
- className: "grid grid-cols-[1fr_auto] items-center h-10 border-b px-5 bg-card",
2626
- children: [t17, t20]
2627
- });
2628
- $[38] = t17;
2629
- $[39] = t20;
2630
- $[40] = t21;
2631
- } else t21 = $[40];
2632
- let t22;
2633
- if ($[41] !== endpoint.path) {
2634
- t22 = /* @__PURE__ */ jsx(TabsContent, {
2635
- value: "params",
2636
- children: /* @__PURE__ */ jsx(SidePanelParamsTab, { path: endpoint.path })
2637
- });
2638
- $[41] = endpoint.path;
2639
- $[42] = t22;
2640
- } else t22 = $[42];
2641
- let t23;
2642
- if ($[43] !== endpoint.bodySchema) {
2643
- t23 = /* @__PURE__ */ jsx(TabsContent, {
2644
- value: "body",
2645
- children: /* @__PURE__ */ jsx(SidePanelBodyTab, { schema: endpoint.bodySchema })
2646
- });
2647
- $[43] = endpoint.bodySchema;
2648
- $[44] = t23;
2649
- } else t23 = $[44];
2650
- let t24;
2651
- if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
2652
- t24 = /* @__PURE__ */ jsx(TabsContent, {
2653
- value: "headers",
2654
- children: /* @__PURE__ */ jsx(SidePanelHeadersTab, {})
2655
- });
2656
- $[45] = t24;
2657
- } else t24 = $[45];
2658
- let t25;
2659
- if ($[46] !== activeTab || $[47] !== t21 || $[48] !== t22 || $[49] !== t23) {
2660
- t25 = /* @__PURE__ */ jsxs(Tabs, {
2661
- value: activeTab,
2662
- onValueChange: t13,
2663
- children: [
2664
- t21,
2665
- t22,
2666
- t23,
2667
- t24
2668
- ]
2669
- });
2670
- $[46] = activeTab;
2671
- $[47] = t21;
2672
- $[48] = t22;
2673
- $[49] = t23;
2674
- $[50] = t25;
2675
- } else t25 = $[50];
2676
- let t26;
2677
- if ($[51] === Symbol.for("react.memo_cache_sentinel")) {
2678
- t26 = /* @__PURE__ */ jsx(SidePanelResponse, {});
2679
- $[51] = t26;
2680
- } else t26 = $[51];
2681
- let t27;
2682
- if ($[52] !== t12 || $[53] !== t25) {
2683
- t27 = /* @__PURE__ */ jsxs("div", {
2684
- className: t12,
2685
- children: [t25, t26]
2686
- });
2687
- $[52] = t12;
2688
- $[53] = t25;
2689
- $[54] = t27;
2690
- } else t27 = $[54];
2691
- let t28;
2692
- if ($[55] !== endpoint || $[56] !== isSpecOpen) {
2693
- t28 = isSpecOpen && /* @__PURE__ */ jsx(SpecSidePanel, {
2694
- endpoint,
2695
- onClose: () => setIsSpecOpen(false)
2696
- });
2697
- $[55] = endpoint;
2698
- $[56] = isSpecOpen;
2699
- $[57] = t28;
2700
- } else t28 = $[57];
2701
- let t29;
2702
- if ($[58] !== t10 || $[59] !== t27 || $[60] !== t28) {
2703
- t29 = /* @__PURE__ */ jsxs("div", {
2704
- className: "isolate grid grid-cols-1 overflow-y-auto min-w-0 grid-rows-[auto_1fr] border-l border-border",
2705
- "data-testid": "endpoint-details-panel",
2706
- children: [
2707
- t1,
2708
- t10,
2709
- t27,
2710
- t28
2711
- ]
2712
- });
2713
- $[58] = t10;
2714
- $[59] = t27;
2715
- $[60] = t28;
2716
- $[61] = t29;
2717
- } else t29 = $[61];
2718
- return t29;
1389
+ ]
1390
+ });
2719
1391
  });
2720
1392
 
2721
1393
  //#endregion
2722
1394
  //#region src/endpoints-page.tsx
2723
1395
  const EndpointsPage = () => {
2724
- const $ = c(33);
2725
- if ($[0] !== "198b8272767e037dafaba995069a2aa9f7c2ab3fe909e2acb55498bc6d00f981") {
2726
- for (let $i = 0; $i < 33; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
2727
- $[0] = "198b8272767e037dafaba995069a2aa9f7c2ab3fe909e2acb55498bc6d00f981";
2728
- }
2729
1396
  const { endpoints, groupedEndpoints } = useGetEndpoints();
2730
1397
  const { selectedEndpointId, setSelectedEndpointId, toggleFlowGroupStatus, flowGroupStatus } = useEndpointConfiguration();
2731
- let t0;
2732
- if ($[1] !== endpoints || $[2] !== selectedEndpointId) {
2733
- let t1$1;
2734
- if ($[4] !== selectedEndpointId) {
2735
- t1$1 = (endpoint) => endpoint.id === selectedEndpointId;
2736
- $[4] = selectedEndpointId;
2737
- $[5] = t1$1;
2738
- } else t1$1 = $[5];
2739
- t0 = endpoints.find(t1$1);
2740
- $[1] = endpoints;
2741
- $[2] = selectedEndpointId;
2742
- $[3] = t0;
2743
- } else t0 = $[3];
2744
- const selectedEndpoint = t0;
2745
- let t1;
2746
- if ($[6] !== setSelectedEndpointId) {
2747
- t1 = () => {
2748
- setSelectedEndpointId("");
2749
- };
2750
- $[6] = setSelectedEndpointId;
2751
- $[7] = t1;
2752
- } else t1 = $[7];
2753
- const onClose = t1;
1398
+ const selectedEndpoint = useMemo(() => endpoints.find((endpoint) => endpoint.id === selectedEndpointId), [endpoints, selectedEndpointId]);
1399
+ const onClose = useCallback(() => {
1400
+ setSelectedEndpointId("");
1401
+ }, [setSelectedEndpointId]);
2754
1402
  const [search, setSearch] = useState("");
2755
- let t2;
2756
- if ($[8] !== groupedEndpoints || $[9] !== search) {
2757
- t2 = Object.entries(groupedEndpoints).filter((t3$1) => {
2758
- const [, endpoints_0] = t3$1;
2759
- return endpoints_0.some((endpoint_0) => endpoint_0.method?.toLowerCase().includes(search.toLowerCase()) || endpoint_0.path?.toLowerCase().includes(search.toLowerCase()));
2760
- });
2761
- $[8] = groupedEndpoints;
2762
- $[9] = search;
2763
- $[10] = t2;
2764
- } else t2 = $[10];
2765
- const filteredEndpoints = t2;
2766
- const t3 = selectedEndpoint ? "grid-cols-[300px_1fr] " : "grid-cols-1";
2767
- let t4;
2768
- if ($[11] !== t3) {
2769
- t4 = cn("grid h-full max-h-full", t3);
2770
- $[11] = t3;
2771
- $[12] = t4;
2772
- } else t4 = $[12];
2773
- let t5;
2774
- if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
2775
- t5 = () => setSearch("");
2776
- $[13] = t5;
2777
- } else t5 = $[13];
2778
- let t6;
2779
- if ($[14] !== search) {
2780
- t6 = /* @__PURE__ */ jsx(EndpointsSearch, {
2781
- value: search,
2782
- onChange: setSearch,
2783
- onClear: t5
1403
+ const filteredEndpoints = useMemo(() => {
1404
+ return Object.entries(groupedEndpoints).filter(([_, endpoints$1]) => {
1405
+ return endpoints$1.some((endpoint) => endpoint.method?.toLowerCase().includes(search.toLowerCase()) || endpoint.path?.toLowerCase().includes(search.toLowerCase()));
2784
1406
  });
2785
- $[14] = search;
2786
- $[15] = t6;
2787
- } else t6 = $[15];
2788
- let t7;
2789
- if ($[16] !== filteredEndpoints || $[17] !== flowGroupStatus || $[18] !== search || $[19] !== selectedEndpointId || $[20] !== setSelectedEndpointId || $[21] !== toggleFlowGroupStatus) {
2790
- t7 = /* @__PURE__ */ jsx("div", {
2791
- className: "grid grid-cols-1 auto-rows-max overflow-auto min-w-0",
2792
- children: filteredEndpoints.map((t8$1) => {
2793
- const [flow, endpoints_1] = t8$1;
2794
- const isSelected = endpoints_1.some((endpoint_1) => endpoint_1.id === selectedEndpointId);
2795
- return /* @__PURE__ */ jsx(FlowGroup, {
2796
- flow,
2797
- endpoints: endpoints_1,
2798
- isOpen: !flowGroupStatus[flow] || isSelected || search !== "",
2799
- isSelected,
2800
- onToggle: toggleFlowGroupStatus,
2801
- onClearSelection: () => setSelectedEndpointId(""),
2802
- selectedEndpointId,
2803
- onSelectEndpoint: setSelectedEndpointId
2804
- }, flow);
2805
- })
2806
- });
2807
- $[16] = filteredEndpoints;
2808
- $[17] = flowGroupStatus;
2809
- $[18] = search;
2810
- $[19] = selectedEndpointId;
2811
- $[20] = setSelectedEndpointId;
2812
- $[21] = toggleFlowGroupStatus;
2813
- $[22] = t7;
2814
- } else t7 = $[22];
2815
- let t8;
2816
- if ($[23] !== t6 || $[24] !== t7) {
2817
- t8 = /* @__PURE__ */ jsxs("div", {
1407
+ }, [groupedEndpoints, search]);
1408
+ return /* @__PURE__ */ jsxs("div", {
1409
+ className: cn("grid h-full max-h-full", selectedEndpoint ? "grid-cols-[300px_1fr] " : "grid-cols-1"),
1410
+ "data-testid": "endpoints-list",
1411
+ children: [/* @__PURE__ */ jsxs("div", {
2818
1412
  className: "grid grid-rows-[auto_1fr] h-full overflow-auto min-w-0",
2819
- children: [t6, t7]
2820
- });
2821
- $[23] = t6;
2822
- $[24] = t7;
2823
- $[25] = t8;
2824
- } else t8 = $[25];
2825
- let t9;
2826
- if ($[26] !== onClose || $[27] !== selectedEndpoint) {
2827
- t9 = selectedEndpoint && /* @__PURE__ */ jsx(SidePanel, {
1413
+ children: [/* @__PURE__ */ jsx(EndpointsSearch, {
1414
+ value: search,
1415
+ onChange: setSearch,
1416
+ onClear: () => setSearch("")
1417
+ }), /* @__PURE__ */ jsx("div", {
1418
+ className: "grid grid-cols-1 auto-rows-max overflow-auto min-w-0",
1419
+ children: filteredEndpoints.map(([flow, endpoints$1]) => {
1420
+ const isSelected = endpoints$1.some((endpoint) => endpoint.id === selectedEndpointId);
1421
+ return /* @__PURE__ */ jsx(FlowGroup, {
1422
+ flow,
1423
+ endpoints: endpoints$1,
1424
+ isOpen: !flowGroupStatus[flow] || isSelected || search !== "",
1425
+ isSelected,
1426
+ onToggle: toggleFlowGroupStatus,
1427
+ onClearSelection: () => setSelectedEndpointId(""),
1428
+ selectedEndpointId,
1429
+ onSelectEndpoint: setSelectedEndpointId
1430
+ }, flow);
1431
+ })
1432
+ })]
1433
+ }), selectedEndpoint && /* @__PURE__ */ jsx(SidePanel, {
2828
1434
  endpoint: selectedEndpoint,
2829
1435
  onClose
2830
- });
2831
- $[26] = onClose;
2832
- $[27] = selectedEndpoint;
2833
- $[28] = t9;
2834
- } else t9 = $[28];
2835
- let t10;
2836
- if ($[29] !== t4 || $[30] !== t8 || $[31] !== t9) {
2837
- t10 = /* @__PURE__ */ jsxs("div", {
2838
- className: t4,
2839
- "data-testid": "endpoints-list",
2840
- children: [t8, t9]
2841
- });
2842
- $[29] = t4;
2843
- $[30] = t8;
2844
- $[31] = t9;
2845
- $[32] = t10;
2846
- } else t10 = $[32];
2847
- return t10;
1436
+ })]
1437
+ });
2848
1438
  };
2849
1439
 
2850
1440
  //#endregion