@ws-ui/http-handlers-editor 1.11.3-rc3 → 1.11.3-rc4

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.es.js CHANGED
@@ -1,45 +1,45 @@
1
- import { jsx as e, jsxs as o, Fragment as F } from "react/jsx-runtime";
2
- import { useSensors as he, useSensor as X, PointerSensor as me, KeyboardSensor as ge, DndContext as xe, closestCenter as fe, DragOverlay as ye } from "@dnd-kit/core";
3
- import { useSortable as be, sortableKeyboardCoordinates as ve, SortableContext as Ne, verticalListSortingStrategy as we, arrayMove as Ee } from "@dnd-kit/sortable";
4
- import { FdWarningDanger as q, FdRegex as Ce, FdUnRegex as De, FdDuplicate as te, FdPen as Te, FdTrash as He, FdCloseNaked as M, FdInfoCircle as ne, FdCheckCircle as Re, FdClose as Se, FdDragHandle as Pe, FdDown as J, FdEmpty as W, FdCode as Ie, FdPlus as Y } from "@ws-ui/icons";
5
- import { useAppDispatch as G, switchEditor as Ae, useAppSelector as B, selectCatalog as re, openModal as ae, selectTabByPath as ke, setContent as _e, selectModals as Le, editModal as Oe, closeModal as Fe, ReduxProvider as $e, getStore as je } from "@ws-ui/store";
6
- import { createContext as Ge, useReducer as qe, useEffect as $, useContext as Me, useState as _, Fragment as se, useMemo as Be } from "react";
7
- import { generate as K } from "short-uuid";
1
+ import { jsx as e, jsxs as o, Fragment as O } from "react/jsx-runtime";
2
+ import { useSensors as fe, useSensor as Z, PointerSensor as ye, KeyboardSensor as ve, DndContext as be, closestCenter as Ne, DragOverlay as we } from "@dnd-kit/core";
3
+ import { useSortable as Ee, sortableKeyboardCoordinates as Ce, SortableContext as Te, verticalListSortingStrategy as De, arrayMove as He } from "@dnd-kit/sortable";
4
+ import { FdWarningDanger as q, FdRegex as Se, FdUnRegex as Pe, FdDuplicate as re, FdPen as Re, FdTrash as Ie, FdCloseNaked as B, FdInfoCircle as ae, FdCheckCircle as Ae, FdClose as ke, FdDragHandle as _e, FdDown as Q, FdEmpty as X, FdCode as Le, FdPlus as ee } from "@ws-ui/icons";
5
+ import { useAppDispatch as $, switchEditor as Oe, useAppSelector as M, selectCatalog as se, openModal as le, selectTabByPath as ie, setContent as oe, selectModals as Fe, editModal as $e, closeModal as je, ReduxProvider as Ge, getStore as Me } from "@ws-ui/store";
6
+ import { createContext as qe, useReducer as Be, useEffect as F, useContext as Ue, useState as _, Fragment as de, useMemo as ze } from "react";
7
+ import { generate as W } from "short-uuid";
8
8
  import { z as k } from "zod";
9
- import { ToolbarIcon as Ue, Tooltip as E, ModalColor as le, ModalType as ie, useHotkeys as ze, ControlledSwitch as Ve, Modal as Ke, HTTP_HANDLERS_TAB_PATH as Je } from "@ws-ui/shared";
10
- import { CSS as We } from "@dnd-kit/utilities";
11
- import { Combobox as P, Transition as oe } from "@headlessui/react";
9
+ import { ToolbarIcon as Je, Tooltip as E, ModalColor as ce, ModalType as pe, useHotkeys as Ke, ControlledSwitch as We, Modal as Ve, TipsProvider as Qe, HTTP_HANDLERS_TAB_PATH as K, useDidMountEffect as Xe } from "@ws-ui/shared";
10
+ import { CSS as Ye } from "@dnd-kit/utilities";
11
+ import { Combobox as R, Transition as ue } from "@headlessui/react";
12
12
  import C from "classnames";
13
- import { useMultipleSelection as O, useCombobox as L } from "downshift";
14
- import { omit as de, isEqual as Qe } from "lodash";
15
- import { Subject as Xe } from "rxjs";
16
- import Z from "randexp";
17
- import { HTTP_HANDLERS_EDITOR_SCOPE_CLASS as Ye } from "./common.es.js";
18
- const Ze = ({
13
+ import { useMultipleSelection as j, useCombobox as L } from "downshift";
14
+ import { omit as he, isEqual as V } from "lodash";
15
+ import { Subject as Ze } from "rxjs";
16
+ import te from "randexp";
17
+ import { HTTP_HANDLERS_EDITOR_SCOPE_CLASS as et } from "./common.es.js";
18
+ const tt = ({
19
19
  label: t,
20
20
  Icon: a,
21
- tab: r,
22
- editor: i,
21
+ tab: n,
22
+ editor: s,
23
23
  onBeforeClick: d
24
24
  }) => {
25
- const x = G();
25
+ const p = $();
26
26
  return /* @__PURE__ */ e(
27
- Ue,
27
+ Je,
28
28
  {
29
29
  label: t,
30
30
  Icon: a,
31
31
  as: "button",
32
32
  onClick: () => {
33
- d == null || d(), x(
34
- Ae({
35
- tab: r,
36
- editor: i
33
+ d == null || d(), p(
34
+ Oe({
35
+ tab: n,
36
+ editor: s
37
37
  })
38
38
  );
39
39
  }
40
40
  }
41
41
  );
42
- }, ce = Ge(void 0), j = new Xe(), et = (t, a) => {
42
+ }, me = qe(void 0), G = new Ze(), nt = (t, a) => {
43
43
  switch (a.type) {
44
44
  case "UPDATE_HANDLERS":
45
45
  return {
@@ -48,15 +48,15 @@ const Ze = ({
48
48
  };
49
49
  case "SET_EDITING_HANDLER": {
50
50
  if (a.payload && a.payload !== t.editing) {
51
- const r = t.content.find(
52
- (i) => i.id === t.editing
51
+ const n = t.content.find(
52
+ (s) => s.id === t.editing
53
53
  );
54
- if (r && !Object.values(
55
- de(r, ["id", "verbs", "asRegex", "isExpanded"])
56
- ).some(Boolean) && r.verbs.length === 0)
54
+ if (n && !Object.values(
55
+ he(n, ["id", "verbs", "asRegex", "isExpanded"])
56
+ ).some(Boolean) && n.verbs.length === 0)
57
57
  return {
58
58
  ...t,
59
- content: t.content.filter((d) => d.id !== r.id),
59
+ content: t.content.filter((d) => d.id !== n.id),
60
60
  editing: a.payload
61
61
  };
62
62
  }
@@ -66,112 +66,112 @@ const Ze = ({
66
66
  };
67
67
  }
68
68
  case "ADD_HANDLER": {
69
- const r = K();
69
+ const n = W();
70
70
  return {
71
71
  ...t,
72
- content: [...t.content, { ...a.payload, id: r }],
73
- editing: r,
74
- newlyCreatedHandlerID: r
72
+ content: [...t.content, { ...a.payload, id: n }],
73
+ editing: n,
74
+ newlyCreatedHandlerID: n
75
75
  };
76
76
  }
77
77
  case "UPDATE_HANDLER":
78
78
  return {
79
79
  ...t,
80
80
  content: t.content.map(
81
- (r) => r.id === a.id ? { ...r, ...a.payload } : r
81
+ (n) => n.id === a.id ? { ...n, ...a.payload } : n
82
82
  ),
83
83
  newlyCreatedHandlerID: null
84
84
  };
85
85
  case "DELETE_HANDLER":
86
86
  return {
87
87
  ...t,
88
- content: t.content.filter((r) => r.id !== a.id)
88
+ content: t.content.filter((n) => n.id !== a.id)
89
89
  };
90
90
  case "TOGGLE_EXPANDED":
91
91
  return {
92
92
  ...t,
93
93
  content: t.content.map(
94
- (r) => r.id === a.id ? { ...r, isExpanded: !r.isExpanded } : r
94
+ (n) => n.id === a.id ? { ...n, isExpanded: !n.isExpanded } : n
95
95
  )
96
96
  };
97
97
  case "DUPLICATE_HANDLER": {
98
- const r = t.content.find(
99
- (i) => i.id === a.id
98
+ const n = t.content.find(
99
+ (s) => s.id === a.id
100
100
  );
101
- return r ? {
101
+ return n ? {
102
102
  ...t,
103
103
  content: [
104
104
  ...t.content,
105
- { ...r, id: K(), isExpanded: !0 }
105
+ { ...n, id: W(), isExpanded: !0 }
106
106
  ]
107
107
  } : t;
108
108
  }
109
109
  case "TOGGLE_ALL_EXPANDED":
110
110
  return {
111
111
  ...t,
112
- content: t.content.map((r) => ({
113
- ...r,
112
+ content: t.content.map((n) => ({
113
+ ...n,
114
114
  isExpanded: a.payload
115
115
  }))
116
116
  };
117
117
  case "SYNC_DATA":
118
118
  return {
119
119
  ...t,
120
- content: a.payload.map((r) => {
121
- const i = t.content.find((d) => d.id === r.id);
122
- return i ? {
123
- ...r,
124
- ...i
125
- } : r;
120
+ content: a.payload.map((n) => {
121
+ const s = t.content.find((d) => d.id === n.id);
122
+ return s ? {
123
+ ...n,
124
+ ...s
125
+ } : n;
126
126
  })
127
127
  };
128
128
  default:
129
129
  throw new Error("Unknown action type");
130
130
  }
131
- }, tt = ({
131
+ }, rt = ({
132
132
  children: t,
133
133
  content: a
134
134
  }) => {
135
- const r = {
135
+ const n = {
136
136
  content: a,
137
137
  editing: null,
138
138
  newlyCreatedHandlerID: null
139
- }, [i, d] = qe(et, r);
140
- return $(() => {
139
+ }, [s, d] = Be(nt, n);
140
+ return F(() => {
141
141
  d({
142
142
  type: "SYNC_DATA",
143
143
  payload: a
144
144
  });
145
- }, [a]), /* @__PURE__ */ e(ce.Provider, { value: { state: i, dispatch: d }, children: t });
146
- }, Q = () => {
147
- const t = Me(ce);
145
+ }, [a]), /* @__PURE__ */ e(me.Provider, { value: { state: s, dispatch: d }, children: t });
146
+ }, Y = () => {
147
+ const t = Ue(me);
148
148
  if (!t)
149
149
  throw new Error("useHTTPHandlers must be used within a HandlerProvider");
150
150
  return t;
151
- }, nt = ({ initialSelectedItems: t, onChange: a, touched: r, onBlur: i }) => {
151
+ }, at = ({ initialSelectedItems: t, onChange: a, touched: n, onBlur: s }) => {
152
152
  const d = ["GET", "POST", "PUT", "DELETE"];
153
- function x(h, u) {
154
- const N = u.toLowerCase();
155
- return d.filter(function(s) {
156
- return !h.includes(s) && s.toLowerCase().includes(N);
153
+ function p(g, h) {
154
+ const N = h.toLowerCase();
155
+ return d.filter(function(l) {
156
+ return !g.includes(l) && l.toLowerCase().includes(N);
157
157
  });
158
158
  }
159
- const [f, g] = _(""), [c, n] = _(t);
160
- $(() => {
161
- n(t);
159
+ const [m, f] = _(""), [c, r] = _(t);
160
+ F(() => {
161
+ r(t);
162
162
  }, [t]);
163
- const l = Be(
164
- () => x(c, f),
165
- [c, f]
166
- ), { getSelectedItemProps: p, getDropdownProps: b, removeSelectedItem: v } = O({
163
+ const i = ze(
164
+ () => p(c, m),
165
+ [c, m]
166
+ ), { getSelectedItemProps: u, getDropdownProps: v, removeSelectedItem: b } = j({
167
167
  selectedItems: c,
168
- onStateChange({ selectedItems: h = [], type: u }) {
169
- switch (u) {
170
- case O.stateChangeTypes.SelectedItemKeyDownBackspace:
171
- case O.stateChangeTypes.SelectedItemKeyDownDelete:
172
- case O.stateChangeTypes.DropdownKeyDownBackspace:
173
- case O.stateChangeTypes.FunctionRemoveSelectedItem:
174
- n(h);
168
+ onStateChange({ selectedItems: g = [], type: h }) {
169
+ switch (h) {
170
+ case j.stateChangeTypes.SelectedItemKeyDownBackspace:
171
+ case j.stateChangeTypes.SelectedItemKeyDownDelete:
172
+ case j.stateChangeTypes.DropdownKeyDownBackspace:
173
+ case j.stateChangeTypes.FunctionRemoveSelectedItem:
174
+ r(g);
175
175
  break;
176
176
  }
177
177
  }
@@ -179,22 +179,22 @@ const Ze = ({
179
179
  isOpen: y,
180
180
  getToggleButtonProps: w,
181
181
  getMenuProps: I,
182
- getInputProps: D,
183
- highlightedIndex: T,
182
+ getInputProps: T,
183
+ highlightedIndex: D,
184
184
  getItemProps: H,
185
- selectedItem: R
185
+ selectedItem: S
186
186
  } = L({
187
- items: l,
188
- itemToString(h) {
189
- return h || "";
187
+ items: i,
188
+ itemToString(g) {
189
+ return g || "";
190
190
  },
191
191
  defaultHighlightedIndex: 0,
192
192
  // after selection, highlight the first item.
193
193
  selectedItem: null,
194
- inputValue: f,
195
- stateReducer(h, u) {
196
- const { changes: N, type: S } = u;
197
- switch (S) {
194
+ inputValue: m,
195
+ stateReducer(g, h) {
196
+ const { changes: N, type: P } = h;
197
+ switch (P) {
198
198
  case L.stateChangeTypes.InputKeyDownEnter:
199
199
  case L.stateChangeTypes.ItemClick:
200
200
  return {
@@ -209,23 +209,23 @@ const Ze = ({
209
209
  }
210
210
  },
211
211
  onStateChange({
212
- inputValue: h = "",
213
- type: u,
212
+ inputValue: g = "",
213
+ type: h,
214
214
  selectedItem: N
215
215
  }) {
216
- switch (u) {
216
+ switch (h) {
217
217
  case L.stateChangeTypes.InputKeyDownEnter:
218
218
  case L.stateChangeTypes.ItemClick:
219
219
  case L.stateChangeTypes.InputBlur:
220
- N && (n([...c, N]), g(""));
220
+ N && (r([...c, N]), f(""));
221
221
  break;
222
222
  case L.stateChangeTypes.InputChange:
223
- g(h);
223
+ f(g);
224
224
  break;
225
225
  }
226
226
  }
227
227
  });
228
- return $(() => {
228
+ return F(() => {
229
229
  a(c);
230
230
  }, [c]), /* @__PURE__ */ o("div", { className: "relative flex-1", children: [
231
231
  /* @__PURE__ */ o(
@@ -234,51 +234,51 @@ const Ze = ({
234
234
  className: C(
235
235
  "bg-grey-300 focus-within:ring-1 focus-within:ring-primary-dark relative flex items-center w-full cursor-default overflow-hidden rounded p-px text-left focus:outline-none",
236
236
  {
237
- "ring-1 ring-primary-dark rounded-b-none": y && l.length,
238
- "ring-1 ring-red-400 overflow-visible": c.length === 0 && r
237
+ "ring-1 ring-primary-dark rounded-b-none": y && i.length,
238
+ "ring-1 ring-red-400 overflow-visible": c.length === 0 && n
239
239
  }
240
240
  ),
241
- onBlur: i,
241
+ onBlur: s,
242
242
  children: [
243
- c.length === 0 && !y && r && /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600", children: c.length === 0 && "At least one HTTP verb is required" }),
243
+ c.length === 0 && !y && n && /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600", children: c.length === 0 && "At least one HTTP verb is required" }),
244
244
  c.map(
245
- function(u, N) {
245
+ function(h, N) {
246
246
  return /* @__PURE__ */ o(
247
247
  "span",
248
248
  {
249
249
  className: C(
250
250
  "bg-grey-600 text-s mr-1 flex items-center rounded px-1 py-0.5 uppercase",
251
251
  {
252
- "bg-red-400": !d.includes(u)
252
+ "bg-red-400": !d.includes(h)
253
253
  }
254
254
  ),
255
- ...p({
256
- selectedItem: u,
255
+ ...u({
256
+ selectedItem: h,
257
257
  index: N
258
258
  }),
259
259
  children: [
260
- u,
260
+ h,
261
261
  /* @__PURE__ */ e(
262
262
  "span",
263
263
  {
264
- onClick: (S) => {
265
- S.stopPropagation(), v(u);
264
+ onClick: (P) => {
265
+ P.stopPropagation(), b(h);
266
266
  },
267
267
  className: "hover:bg-primary-hover ml-2 inline-block cursor-pointer rounded p-0.5 text-gray-100 hover:text-white active:outline-none",
268
- children: /* @__PURE__ */ e(M, {})
268
+ children: /* @__PURE__ */ e(B, {})
269
269
  }
270
270
  )
271
271
  ]
272
272
  },
273
- `selected-item-${N}-${u}`
273
+ `selected-item-${N}-${h}`
274
274
  );
275
275
  }
276
276
  ),
277
277
  /* @__PURE__ */ e(
278
278
  "input",
279
279
  {
280
- ...D(
281
- b(
280
+ ...T(
281
+ v(
282
282
  { preventKeyAction: y },
283
283
  { suppressRefError: !0 }
284
284
  )
@@ -294,7 +294,7 @@ const Ze = ({
294
294
  className: "absolute inset-y-0 right-0 flex items-center pr-2",
295
295
  type: "button",
296
296
  ...w(),
297
- children: /* @__PURE__ */ e(J, { className: "h-3 w-3 text-gray-50", "aria-hidden": "true" })
297
+ children: /* @__PURE__ */ e(Q, { className: "h-3 w-3 text-gray-50", "aria-hidden": "true" })
298
298
  }
299
299
  )
300
300
  ]
@@ -303,76 +303,76 @@ const Ze = ({
303
303
  /* @__PURE__ */ e(
304
304
  "ul",
305
305
  {
306
- className: `ring-primary-dark bg-grey-900 text-s absolute z-10 w-full rounded-b ring-1 p-1 text-white ${!(y && l.length) && "hidden"}`,
306
+ className: `ring-primary-dark bg-grey-900 text-s absolute z-10 w-full rounded-b ring-1 p-1 text-white ${!(y && i.length) && "hidden"}`,
307
307
  ...I(),
308
- children: y && l.map((h, u) => /* @__PURE__ */ e(
308
+ children: y && i.map((g, h) => /* @__PURE__ */ e(
309
309
  "li",
310
310
  {
311
311
  className: C(
312
- T === u && "bg-primary-hover",
313
- R === h && "font-bold",
312
+ D === h && "bg-primary-hover",
313
+ S === g && "font-bold",
314
314
  "flex flex-col p-1 shadow-sm"
315
315
  ),
316
- ...H({ item: h, index: u }),
317
- children: /* @__PURE__ */ e("span", { children: h })
316
+ ...H({ item: g, index: h }),
317
+ children: /* @__PURE__ */ e("span", { children: g })
318
318
  },
319
- `${h}${u}`
319
+ `${g}${h}`
320
320
  ))
321
321
  }
322
322
  )
323
323
  ] });
324
- }, rt = ({
324
+ }, st = ({
325
325
  value: t,
326
326
  options: a,
327
- errorMessage: r = "",
328
- onChange: i,
327
+ errorMessage: n = "",
328
+ onChange: s,
329
329
  onBlur: d
330
330
  }) => {
331
- const [x, f] = _(""), g = a.find((n) => n.name === t), c = x === "" ? a : a.filter((n) => n.name.toLowerCase().includes(x.toLowerCase()));
331
+ const [p, m] = _(""), f = a.find((r) => r.name === t), c = p === "" ? a : a.filter((r) => r.name.toLowerCase().includes(p.toLowerCase()));
332
332
  return /* @__PURE__ */ e(
333
- P,
333
+ R,
334
334
  {
335
335
  value: { name: t },
336
- onChange: (n) => i(n.name),
337
- children: ({ open: n }) => /* @__PURE__ */ o("div", { className: "relative w-full", children: [
336
+ onChange: (r) => s(r.name),
337
+ children: ({ open: r }) => /* @__PURE__ */ o("div", { className: "relative w-full", children: [
338
338
  /* @__PURE__ */ o(
339
339
  "div",
340
340
  {
341
341
  className: C(
342
342
  "bg-grey-300 focus-within:ring-1 focus-within:ring-primary-dark relative w-full cursor-default overflow-hidden rounded text-left inline-flex",
343
343
  {
344
- "ring-1 ring-red-400": !g && t || r,
345
- "ring-1 ring-primary-dark rounded-b-none": n,
346
- "overflow-visible": !g && !n && r
344
+ "ring-1 ring-red-400": !f && t || n,
345
+ "ring-1 ring-primary-dark rounded-b-none": r,
346
+ "overflow-visible": !f && !r && n
347
347
  }
348
348
  ),
349
349
  children: [
350
350
  /* @__PURE__ */ e(
351
- P.Input,
351
+ R.Input,
352
352
  {
353
353
  className: C(
354
354
  "bg-grey-300 text-s w-full border-none py-1 px-2 focus:outline-none rounded",
355
355
  {
356
- "!text-red-400": !g
356
+ "!text-red-400": !f
357
357
  }
358
358
  ),
359
- displayValue: (l) => l.name,
360
- onChange: (l) => f(l.target.value),
359
+ displayValue: (i) => i.name,
360
+ onChange: (i) => m(i.target.value),
361
361
  style: { caretColor: "white" },
362
362
  onBlur: d
363
363
  }
364
364
  ),
365
365
  /* @__PURE__ */ o("span", { className: "inset-y-0 right-0 flex items-center gap-1 pr-2", children: [
366
- !g && !n && r && /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600", children: r }),
367
- t ? /* @__PURE__ */ o(F, { children: [
366
+ !f && !r && n && /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600", children: n }),
367
+ t ? /* @__PURE__ */ o(O, { children: [
368
368
  /* @__PURE__ */ e(
369
369
  "button",
370
370
  {
371
371
  onClick: () => {
372
- f(""), i("");
372
+ m(""), s("");
373
373
  },
374
374
  children: /* @__PURE__ */ e(
375
- M,
375
+ B,
376
376
  {
377
377
  className: "text-grey-50 h-3 w-3",
378
378
  "aria-hidden": "true"
@@ -382,36 +382,36 @@ const Ze = ({
382
382
  ),
383
383
  /* @__PURE__ */ e("span", { className: "bg-grey-50 h-3 w-[1px] rounded-full" })
384
384
  ] }) : null,
385
- /* @__PURE__ */ e(P.Button, { children: /* @__PURE__ */ e(J, { className: "text-grey-50 h-3 w-3", "aria-hidden": "true" }) })
385
+ /* @__PURE__ */ e(R.Button, { children: /* @__PURE__ */ e(Q, { className: "text-grey-50 h-3 w-3", "aria-hidden": "true" }) })
386
386
  ] })
387
387
  ]
388
388
  }
389
389
  ),
390
390
  /* @__PURE__ */ e(
391
- oe,
391
+ ue,
392
392
  {
393
- as: se,
393
+ as: de,
394
394
  leave: "transition ease-in durati pb-0.5on-100",
395
395
  leaveFrom: "opacity-100",
396
396
  leaveTo: "opacity-0",
397
- afterLeave: () => f(""),
398
- children: /* @__PURE__ */ e(P.Options, { className: "bg-grey-900 text-s text-grey-100 sm:text-s absolute z-50 max-h-60 w-full overflow-auto rounded-b ring-1 ring-primary-dark p-1 focus:outline-none", children: c.length === 0 ? /* @__PURE__ */ o("div", { className: "text-s text-grey-200 relative cursor-default select-none px-0.5 py-0.5 ", children: [
399
- /* @__PURE__ */ e(W, { className: "inline h-4 w-4" }),
397
+ afterLeave: () => m(""),
398
+ children: /* @__PURE__ */ e(R.Options, { className: "bg-grey-900 text-s text-grey-100 sm:text-s absolute z-50 max-h-60 w-full overflow-auto rounded-b ring-1 ring-primary-dark p-1 focus:outline-none", children: c.length === 0 ? /* @__PURE__ */ o("div", { className: "text-s text-grey-200 relative cursor-default select-none px-0.5 py-0.5 ", children: [
399
+ /* @__PURE__ */ e(X, { className: "inline h-4 w-4" }),
400
400
  " Nothing found."
401
- ] }) : c.map((l, p) => /* @__PURE__ */ e(
402
- P.Option,
401
+ ] }) : c.map((i, u) => /* @__PURE__ */ e(
402
+ R.Option,
403
403
  {
404
- className: ({ active: b }) => `relative cursor-default select-none ${b ? "bg-primary-hover" : ""}`,
405
- value: l,
406
- children: ({ selected: b }) => /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(
404
+ className: ({ active: v }) => `relative cursor-default select-none ${v ? "bg-primary-hover" : ""}`,
405
+ value: i,
406
+ children: ({ selected: v }) => /* @__PURE__ */ e(O, { children: /* @__PURE__ */ e(
407
407
  "span",
408
408
  {
409
- className: `block truncate p-2 py-1 ${b ? "bg-primary-dark font-medium text-white" : "font-normal"}`,
410
- children: l.name
409
+ className: `block truncate p-2 py-1 ${v ? "bg-primary-dark font-medium text-white" : "font-normal"}`,
410
+ children: i.name
411
411
  }
412
412
  ) })
413
413
  },
414
- p
414
+ u
415
415
  )) })
416
416
  }
417
417
  )
@@ -419,64 +419,64 @@ const Ze = ({
419
419
  },
420
420
  t
421
421
  );
422
- }, at = ({
422
+ }, lt = ({
423
423
  value: t,
424
424
  options: a,
425
- onChange: r,
426
- errorMessage: i,
425
+ onChange: n,
426
+ errorMessage: s,
427
427
  onBlur: d
428
428
  }) => {
429
- const [x, f] = _(""), g = a.find((l) => l.name === t), c = g && g.exposed, n = x === "" ? a : a.filter((l) => l.name.toLowerCase().includes(x.toLowerCase()));
430
- return /* @__PURE__ */ e(P, { value: { name: t }, onChange: (l) => r(l.name), children: ({ open: l }) => /* @__PURE__ */ o("div", { className: "relative", children: [
429
+ const [p, m] = _(""), f = a.find((i) => i.name === t), c = f && f.exposed, r = p === "" ? a : a.filter((i) => i.name.toLowerCase().includes(p.toLowerCase()));
430
+ return /* @__PURE__ */ e(R, { value: { name: t }, onChange: (i) => n(i.name), children: ({ open: i }) => /* @__PURE__ */ o("div", { className: "relative", children: [
431
431
  /* @__PURE__ */ o(
432
432
  "div",
433
433
  {
434
434
  className: C(
435
435
  "bg-grey-300 focus-within:ring-1 focus-within:ring-primary-dark relative w-full cursor-default overflow-hidden rounded text-left inline-flex",
436
436
  {
437
- "ring-1 ring-red-400": i,
437
+ "ring-1 ring-red-400": s,
438
438
  "ring-1 ring-yellow-500": c,
439
- "ring-1 ring-primary-dark rounded-b-none": l,
440
- "overflow-visible": !l && i
439
+ "ring-1 ring-primary-dark rounded-b-none": i,
440
+ "overflow-visible": !i && s
441
441
  }
442
442
  ),
443
443
  children: [
444
444
  /* @__PURE__ */ e(
445
- P.Input,
445
+ R.Input,
446
446
  {
447
447
  className: C(
448
448
  "bg-grey-300 text-s w-full border-none py-1 px-2 focus:outline-none truncate rounded",
449
449
  {
450
- "!text-red-400": i,
450
+ "!text-red-400": s,
451
451
  "!text-yellow-500": c
452
452
  }
453
453
  ),
454
454
  style: { caretColor: "white" },
455
- displayValue: (p) => p.name,
456
- onChange: (p) => f(p.target.value),
455
+ displayValue: (u) => u.name,
456
+ onChange: (u) => m(u.target.value),
457
457
  onBlur: d
458
458
  }
459
459
  ),
460
- !l && i && /* @__PURE__ */ e(
460
+ !i && s && /* @__PURE__ */ e(
461
461
  "div",
462
462
  {
463
463
  className: C(
464
464
  "absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600",
465
465
  { "!text-yellow-500 ring-yellow-500 bg-white": c }
466
466
  ),
467
- children: i
467
+ children: s
468
468
  }
469
469
  ),
470
470
  /* @__PURE__ */ o("span", { className: "inset-y-0 right-0 flex items-center gap-1 pr-2", children: [
471
- t ? /* @__PURE__ */ o(F, { children: [
471
+ t ? /* @__PURE__ */ o(O, { children: [
472
472
  /* @__PURE__ */ e(
473
473
  "button",
474
474
  {
475
475
  onClick: () => {
476
- f(""), r("");
476
+ m(""), n("");
477
477
  },
478
478
  children: /* @__PURE__ */ e(
479
- M,
479
+ B,
480
480
  {
481
481
  className: "text-grey-50 h-3 w-3",
482
482
  "aria-hidden": "true"
@@ -486,91 +486,91 @@ const Ze = ({
486
486
  ),
487
487
  /* @__PURE__ */ e("span", { className: "bg-grey-50 h-3 w-[1px] rounded-full" })
488
488
  ] }) : null,
489
- /* @__PURE__ */ e(P.Button, { children: /* @__PURE__ */ e(J, { className: "text-grey-50 h-3 w-3", "aria-hidden": "true" }) })
489
+ /* @__PURE__ */ e(R.Button, { children: /* @__PURE__ */ e(Q, { className: "text-grey-50 h-3 w-3", "aria-hidden": "true" }) })
490
490
  ] })
491
491
  ]
492
492
  }
493
493
  ),
494
494
  /* @__PURE__ */ e(
495
- oe,
495
+ ue,
496
496
  {
497
- as: se,
497
+ as: de,
498
498
  leave: "transition ease-in duration-100",
499
499
  leaveFrom: "opacity-100",
500
500
  leaveTo: "opacity-0",
501
- afterLeave: () => f(""),
502
- children: /* @__PURE__ */ e(P.Options, { className: "bg-grey-900 text-s text-grey-100 sm:text-s absolute z-50 max-h-60 w-full overflow-auto rounded-b ring-1 ring-primary-dark p-1 focus:outline-none", children: n.length ? n.map((p, b) => /* @__PURE__ */ e(
503
- P.Option,
501
+ afterLeave: () => m(""),
502
+ children: /* @__PURE__ */ e(R.Options, { className: "bg-grey-900 text-s text-grey-100 sm:text-s absolute z-50 max-h-60 w-full overflow-auto rounded-b ring-1 ring-primary-dark p-1 focus:outline-none", children: r.length ? r.map((u, v) => /* @__PURE__ */ e(
503
+ R.Option,
504
504
  {
505
- className: ({ active: v }) => `relative cursor-default select-none ${v ? "bg-primary-hover" : ""}`,
506
- value: p,
507
- children: ({ selected: v }) => /* @__PURE__ */ e(F, { children: /* @__PURE__ */ o(
505
+ className: ({ active: b }) => `relative cursor-default select-none ${b ? "bg-primary-hover" : ""}`,
506
+ value: u,
507
+ children: ({ selected: b }) => /* @__PURE__ */ e(O, { children: /* @__PURE__ */ o(
508
508
  "span",
509
509
  {
510
- className: `text-s flex items-center gap-2 truncate p-2 py-1 ${v ? "bg-primary-dark font-medium text-white" : "font-normal"}`,
510
+ className: `text-s flex items-center gap-2 truncate p-2 py-1 ${b ? "bg-primary-dark font-medium text-white" : "font-normal"}`,
511
511
  children: [
512
- p.exposed && /* @__PURE__ */ e(q, { className: "text-yellow-500" }),
513
- /* @__PURE__ */ e("span", { className: "flex-1 truncate", title: p.name, children: p.name })
512
+ u.exposed && /* @__PURE__ */ e(q, { className: "text-yellow-500" }),
513
+ /* @__PURE__ */ e("span", { className: "flex-1 truncate", title: u.name, children: u.name })
514
514
  ]
515
515
  }
516
516
  ) })
517
517
  },
518
- b
518
+ v
519
519
  )) : /* @__PURE__ */ o("div", { className: "text-s text-grey-200 relative cursor-default select-none px-0.5 py-0.5", children: [
520
- /* @__PURE__ */ e(W, { className: "inline h-4 w-4" }),
520
+ /* @__PURE__ */ e(X, { className: "inline h-4 w-4" }),
521
521
  " Nothing found."
522
522
  ] }) })
523
523
  }
524
524
  )
525
525
  ] }) });
526
- }, pe = ({ listeners: t, attributes: a }) => /* @__PURE__ */ e("button", { ...a, ...t, children: /* @__PURE__ */ e(Pe, {}) }), ue = (t) => {
527
- var r;
526
+ }, ge = ({ listeners: t, attributes: a }) => /* @__PURE__ */ e("button", { ...a, ...t, children: /* @__PURE__ */ e(_e, {}) }), xe = (t) => {
527
+ var n;
528
528
  if (!t) return "";
529
529
  let a;
530
- Z.prototype.max = 8;
530
+ te.prototype.max = 8;
531
531
  try {
532
- a = (r = new Z(t)) == null ? void 0 : r.gen();
532
+ a = (n = new te(t)) == null ? void 0 : n.gen();
533
533
  } catch {
534
534
  a = "";
535
535
  }
536
536
  return `Requests matching regex will be handled example: ${a}`;
537
- }, st = ({
537
+ }, it = ({
538
538
  id: t,
539
539
  class: a,
540
- method: r,
541
- pattern: i,
540
+ method: n,
541
+ pattern: s,
542
542
  verbs: d,
543
- regexPattern: x,
544
- asRegex: f,
545
- listeners: g,
543
+ regexPattern: p,
544
+ asRegex: m,
545
+ listeners: f,
546
546
  attributes: c
547
547
  }) => {
548
- var S;
549
- const [n, l] = _({
548
+ var P;
549
+ const [r, i] = _({
550
550
  className: a,
551
- method: r,
552
- pattern: i,
551
+ method: n,
552
+ pattern: s,
553
553
  verbs: d,
554
- asRegex: f,
555
- regexPattern: x
556
- }), p = B(re), b = Object.values((p == null ? void 0 : p.singletons) || {}), v = (S = b.find((s) => s.name === n.className)) == null ? void 0 : S.methods.map(({ name: s, exposed: m }) => ({ name: s, exposed: m })), {
554
+ asRegex: m,
555
+ regexPattern: p
556
+ }), u = M(se), v = Object.values((u == null ? void 0 : u.singletons) || {}), b = (P = v.find((l) => l.name === r.className)) == null ? void 0 : P.methods.map(({ name: l, exposed: x }) => ({ name: l, exposed: x })), {
557
557
  dispatch: y,
558
558
  state: { newlyCreatedHandlerID: w }
559
- } = Q(), I = G();
560
- function D() {
561
- const { className: s, method: m, asRegex: A, regexPattern: U, pattern: z, verbs: V } = n;
562
- return !!(s && m && (A ? U : !z.endsWith("/")) && V.length);
563
- }
559
+ } = Y(), I = $();
564
560
  function T() {
565
- if (D()) {
566
- const { className: s, method: m, asRegex: A, regexPattern: U, pattern: z, verbs: V } = n;
561
+ const { className: l, method: x, asRegex: A, regexPattern: U, pattern: z, verbs: J } = r;
562
+ return !!(l && x && (A ? U : !z.endsWith("/")) && J.length);
563
+ }
564
+ function D() {
565
+ if (T()) {
566
+ const { className: l, method: x, asRegex: A, regexPattern: U, pattern: z, verbs: J } = r;
567
567
  y({
568
568
  type: "UPDATE_HANDLER",
569
569
  id: t,
570
570
  payload: {
571
- class: s,
572
- method: m,
573
- verbs: V,
571
+ class: l,
572
+ method: x,
573
+ verbs: J,
574
574
  asRegex: A,
575
575
  ...A ? { regexPattern: U } : { pattern: z }
576
576
  }
@@ -578,23 +578,23 @@ const Ze = ({
578
578
  }
579
579
  }
580
580
  const H = async () => {
581
- const s = {
581
+ const l = {
582
582
  className: a,
583
- method: r,
584
- pattern: i,
585
- regexPattern: x,
583
+ method: n,
584
+ pattern: s,
585
+ regexPattern: p,
586
586
  verbs: d
587
- }, m = de(n, ["id", "isExpanded"]);
588
- if (!D()) {
587
+ }, x = he(r, ["id", "isExpanded"]);
588
+ if (!T()) {
589
589
  y({ type: "DELETE_HANDLER", id: `${w}` }), y({ type: "SET_EDITING_HANDLER", payload: null });
590
590
  return;
591
591
  }
592
- if (!Qe(s, m)) {
592
+ if (!V(l, x)) {
593
593
  const { confirmed: A } = await I(
594
- ae({
594
+ le({
595
595
  title: "Cancel Changes",
596
- type: ie.CONFIRM,
597
- color: le.DANGER,
596
+ type: pe.CONFIRM,
597
+ color: ce.DANGER,
598
598
  message: "Are you sure you want to cancel changes made to this Handler?",
599
599
  icon: "FdWarningDanger"
600
600
  })
@@ -605,7 +605,7 @@ const Ze = ({
605
605
  }
606
606
  }
607
607
  };
608
- ze(
608
+ Ke(
609
609
  "esc",
610
610
  () => {
611
611
  setTimeout(() => {
@@ -613,74 +613,74 @@ const Ze = ({
613
613
  }, 100);
614
614
  },
615
615
  []
616
- ), $(() => {
617
- j.subscribe((s) => {
618
- s === t && T();
616
+ ), F(() => {
617
+ G.subscribe((l) => {
618
+ l === t && D();
619
619
  });
620
- }, [n, t]);
621
- const [R, h] = _({ className: !1, method: !1, pattern: !1, verbs: !1 }), u = () => {
622
- if (R.method && !n.method)
620
+ }, [r, t]);
621
+ const [S, g] = _({ className: !1, method: !1, pattern: !1, verbs: !1 }), h = () => {
622
+ if (S.method && !r.method)
623
623
  return "Method is required";
624
- if (v) {
625
- const s = v == null ? void 0 : v.find(
626
- (m) => m.name === n.method
624
+ if (b) {
625
+ const l = b == null ? void 0 : b.find(
626
+ (x) => x.name === r.method
627
627
  );
628
- if (n.method && !s)
629
- return `The method "${n.method}" doesn't exist.`;
630
- if (s && s.exposed)
631
- return `Method "${n.method}" is already exposed`;
628
+ if (r.method && !l)
629
+ return `The method "${r.method}" doesn't exist.`;
630
+ if (l && l.exposed)
631
+ return `Method "${r.method}" is already exposed`;
632
632
  }
633
633
  }, N = () => {
634
- if (R.pattern) {
635
- if (n.asRegex && !n.regexPattern)
634
+ if (S.pattern) {
635
+ if (r.asRegex && !r.regexPattern)
636
636
  return "Pattern is required";
637
- if (!n.asRegex && n.pattern.endsWith("/"))
637
+ if (!r.asRegex && r.pattern.endsWith("/"))
638
638
  return 'Pattern should not end with a "/"';
639
639
  }
640
640
  };
641
641
  return /* @__PURE__ */ o("div", { className: "flex items-center gap-2 rounded-b py-2", children: [
642
642
  /* @__PURE__ */ o("div", { className: "flex w-60 flex-shrink-0 items-center gap-1", children: [
643
643
  /* @__PURE__ */ e(
644
- pe,
644
+ ge,
645
645
  {
646
- listeners: g,
646
+ listeners: f,
647
647
  attributes: c
648
648
  },
649
649
  "grab-handle"
650
650
  ),
651
651
  /* @__PURE__ */ e(
652
- rt,
652
+ st,
653
653
  {
654
- value: n.className,
655
- onChange: (s) => {
656
- l((m) => ({ ...m, className: s }));
654
+ value: r.className,
655
+ onChange: (l) => {
656
+ i((x) => ({ ...x, className: l }));
657
657
  },
658
- onBlur: () => h((s) => ({ ...s, className: !0 })),
659
- options: b,
660
- errorMessage: R.className && !n.className ? "Class name is required" : n.className !== "" && !b.find((s) => s.name === n.className) ? `The singleton "${n.className}" doesn't exist.` : void 0
658
+ onBlur: () => g((l) => ({ ...l, className: !0 })),
659
+ options: v,
660
+ errorMessage: S.className && !r.className ? "Class name is required" : r.className !== "" && !v.find((l) => l.name === r.className) ? `The singleton "${r.className}" doesn't exist.` : void 0
661
661
  },
662
662
  a
663
663
  )
664
664
  ] }),
665
665
  /* @__PURE__ */ e("div", { className: "w-60 flex-shrink-0", children: /* @__PURE__ */ e(
666
- at,
666
+ lt,
667
667
  {
668
- value: n.method,
669
- onChange: (s) => {
670
- l((m) => ({ ...m, method: s }));
668
+ value: r.method,
669
+ onChange: (l) => {
670
+ i((x) => ({ ...x, method: l }));
671
671
  },
672
- options: v || [],
673
- errorMessage: u(),
674
- onBlur: () => h((s) => ({ ...s, method: !0 }))
672
+ options: b || [],
673
+ errorMessage: h(),
674
+ onBlur: () => g((l) => ({ ...l, method: !0 }))
675
675
  }
676
676
  ) }),
677
677
  /* @__PURE__ */ o("div", { className: "relative w-60 flex-shrink-0 flex items-center gap-1 overflow-visible", children: [
678
678
  /* @__PURE__ */ e(
679
679
  E,
680
680
  {
681
- label: n.asRegex ? ue(n.regexPattern) : n.pattern && !n.pattern.endsWith("/") ? `Requests starting with /${n.pattern}/ will be handled` : "",
681
+ label: r.asRegex ? xe(r.regexPattern) : r.pattern && !r.pattern.endsWith("/") ? `Requests starting with /${r.pattern}/ will be handled` : "",
682
682
  children: /* @__PURE__ */ o("div", { className: "relative w-full", children: [
683
- !n.asRegex && /* @__PURE__ */ e("span", { className: "absolute text-s inset-y-0 left-1 flex items-center gap-2", children: "/" }),
683
+ !r.asRegex && /* @__PURE__ */ e("span", { className: "absolute text-s inset-y-0 left-1 flex items-center gap-2", children: "/" }),
684
684
  /* @__PURE__ */ e(
685
685
  "input",
686
686
  {
@@ -688,36 +688,36 @@ const Ze = ({
688
688
  className: C(
689
689
  "bg-grey-300 text-s block w-full rounded p-1 pl-3 focus:outline-none focus:ring-1 focus:ring-primary-dark",
690
690
  {
691
- "focus:ring-red-400 ring-1 ring-red-400": R.pattern && n.asRegex && !n.regexPattern
691
+ "focus:ring-red-400 ring-1 ring-red-400": S.pattern && r.asRegex && !r.regexPattern
692
692
  }
693
693
  ),
694
- value: n.asRegex ? n.regexPattern : n.pattern,
695
- onChange: (s) => {
696
- l((m) => ({
697
- ...m,
698
- [n.asRegex ? "regexPattern" : "pattern"]: s.target.value
694
+ value: r.asRegex ? r.regexPattern : r.pattern,
695
+ onChange: (l) => {
696
+ i((x) => ({
697
+ ...x,
698
+ [r.asRegex ? "regexPattern" : "pattern"]: l.target.value
699
699
  }));
700
700
  },
701
- onBlur: () => h((s) => ({ ...s, pattern: !0 })),
702
- placeholder: n.asRegex ? "Required" : ""
701
+ onBlur: () => g((l) => ({ ...l, pattern: !0 })),
702
+ placeholder: r.asRegex ? "Required" : ""
703
703
  }
704
704
  ),
705
705
  N() && /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600", children: N() })
706
706
  ] })
707
707
  }
708
708
  ),
709
- (f ? x : i) && /* @__PURE__ */ e(
709
+ (m ? p : s) && /* @__PURE__ */ e(
710
710
  "button",
711
711
  {
712
- onClick: (s) => {
713
- s.stopPropagation(), l((m) => ({
714
- ...m,
715
- [n.asRegex ? "regexPattern" : "pattern"]: ""
712
+ onClick: (l) => {
713
+ l.stopPropagation(), i((x) => ({
714
+ ...x,
715
+ [r.asRegex ? "regexPattern" : "pattern"]: ""
716
716
  }));
717
717
  },
718
718
  className: "absolute inset-y-0 right-6 flex items-center gap-2 pr-2",
719
719
  children: /* @__PURE__ */ e(
720
- M,
720
+ B,
721
721
  {
722
722
  className: "text-grey-200 h-3 w-3",
723
723
  "aria-hidden": "true"
@@ -728,28 +728,28 @@ const Ze = ({
728
728
  /* @__PURE__ */ e(
729
729
  E,
730
730
  {
731
- label: n.asRegex ? "Requests matching this regex will be handled. Check the match with the __[Match regex command](https://developer.4d.com/docs/commands/match-regex)__" : `Prefixes are considered as regular expressions already containing starting and ending /
731
+ label: r.asRegex ? "Requests matching this regex will be handled. Check the match with the __[Match regex command](https://developer.4d.com/docs/commands/match-regex)__" : `Prefixes are considered as regular expressions already containing starting and ending /
732
732
 
733
733
  __[documentation](https://developer.qodly.com/docs/studio/httpHandlers)__`,
734
- children: /* @__PURE__ */ e("span", { className: "rounded hover:bg-gray-400/30 w-6 h-6 flex items-center content-center justify-center", children: /* @__PURE__ */ e(ne, { className: "inline h-4 w-4 text-gray-100" }) })
734
+ children: /* @__PURE__ */ e("span", { className: "rounded hover:bg-gray-400/30 w-6 h-6 flex items-center content-center justify-center", children: /* @__PURE__ */ e(ae, { className: "inline h-4 w-4 text-gray-100" }) })
735
735
  }
736
736
  )
737
737
  ] }),
738
738
  /* @__PURE__ */ e("div", { className: "w-20 px-2 flex justify-center", children: /* @__PURE__ */ e(
739
- Ve,
739
+ We,
740
740
  {
741
- value: !!n.asRegex,
742
- onChange: (s) => {
743
- const m = s ? { regexPattern: i, asRegex: s } : { pattern: x, asRegex: s };
744
- l((A) => ({ ...A, ...m }));
741
+ value: !!r.asRegex,
742
+ onChange: (l) => {
743
+ const x = l ? { regexPattern: s, asRegex: l } : { pattern: p, asRegex: l };
744
+ i((A) => ({ ...A, ...x }));
745
745
  },
746
- className: `${n.asRegex ? "bg-primary-dark" : "bg-grey-300"}
746
+ className: `${r.asRegex ? "bg-primary-dark" : "bg-grey-300"}
747
747
  relative inline-flex h-5 w-8 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,
748
748
  children: /* @__PURE__ */ e(
749
749
  "span",
750
750
  {
751
751
  "aria-hidden": "true",
752
- className: `${n.asRegex ? "translate-x-3" : "translate-x-0"}
752
+ className: `${r.asRegex ? "translate-x-3" : "translate-x-0"}
753
753
  pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0 transition duration-200 ease-in-out`
754
754
  }
755
755
  )
@@ -757,14 +757,14 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
757
757
  ) }),
758
758
  /* @__PURE__ */ o("div", { className: "flex flex-1 items-center", children: [
759
759
  /* @__PURE__ */ e(
760
- nt,
760
+ at,
761
761
  {
762
- initialSelectedItems: n.verbs || [],
763
- onChange: (s) => {
764
- l((m) => ({ ...m, verbs: s }));
762
+ initialSelectedItems: r.verbs || [],
763
+ onChange: (l) => {
764
+ i((x) => ({ ...x, verbs: l }));
765
765
  },
766
- touched: R.verbs,
767
- onBlur: () => h((s) => ({ ...s, verbs: !0 }))
766
+ touched: S.verbs,
767
+ onBlur: () => g((l) => ({ ...l, verbs: !0 }))
768
768
  }
769
769
  ),
770
770
  /* @__PURE__ */ o("div", { className: "flex items-center gap-0.5 px-2", children: [
@@ -774,7 +774,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
774
774
  className: C(
775
775
  "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none opacity-50 cursor-not-allowed"
776
776
  ),
777
- children: /* @__PURE__ */ e(te, {})
777
+ children: /* @__PURE__ */ e(re, {})
778
778
  }
779
779
  ) }),
780
780
  /* @__PURE__ */ e(E, { label: "Confirm Changes", className: "px-1 py-3", children: /* @__PURE__ */ e(
@@ -783,11 +783,11 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
783
783
  className: C(
784
784
  "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
785
785
  {
786
- "opacity-50 cursor-not-allowed": !D()
786
+ "opacity-50 cursor-not-allowed": !T()
787
787
  }
788
788
  ),
789
- onClick: T,
790
- children: /* @__PURE__ */ e(Re, {})
789
+ onClick: D,
790
+ children: /* @__PURE__ */ e(Ae, {})
791
791
  }
792
792
  ) }),
793
793
  /* @__PURE__ */ e(E, { label: "Cancel Changes", className: "px-1 py-3", children: /* @__PURE__ */ e(
@@ -795,44 +795,44 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
795
795
  {
796
796
  className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
797
797
  onClick: H,
798
- children: /* @__PURE__ */ e(Se, {})
798
+ children: /* @__PURE__ */ e(ke, {})
799
799
  }
800
800
  ) })
801
801
  ] })
802
802
  ] })
803
803
  ] });
804
- }, ee = ({
804
+ }, ne = ({
805
805
  id: t,
806
806
  class: a,
807
- method: r,
808
- pattern: i,
807
+ method: n,
808
+ pattern: s,
809
809
  verbs: d,
810
- isExpanded: x,
811
- regexPattern: f,
812
- asRegex: g
810
+ isExpanded: p,
811
+ regexPattern: m,
812
+ asRegex: f
813
813
  }) => {
814
- var S;
815
- const { attributes: c, listeners: n, setNodeRef: l, transform: p, transition: b } = be({ id: t }), v = {
816
- transform: We.Transform.toString(p),
817
- transition: b
814
+ var P;
815
+ const { attributes: c, listeners: r, setNodeRef: i, transform: u, transition: v } = Ee({ id: t }), b = {
816
+ transform: Ye.Transform.toString(u),
817
+ transition: v
818
818
  }, {
819
819
  dispatch: y,
820
820
  state: { editing: w }
821
- } = Q(), I = G(), D = g ? f : i, T = B(re), H = Object.values((T == null ? void 0 : T.singletons) || {}), R = (S = H == null ? void 0 : H.find((s) => s.name === a)) == null ? void 0 : S.methods.map(({ name: s, exposed: m }) => ({ name: s, exposed: m })), h = H == null ? void 0 : H.find(
822
- (s) => s.name === a
823
- ), u = R == null ? void 0 : R.find((s) => s.name === r), N = u && u.exposed;
824
- return /* @__PURE__ */ e("div", { className: "odd:bg-grey-500", ref: l, style: v, children: w === t ? /* @__PURE__ */ e(
825
- st,
821
+ } = Y(), I = $(), T = f ? m : s, D = M(se), H = Object.values((D == null ? void 0 : D.singletons) || {}), S = (P = H == null ? void 0 : H.find((l) => l.name === a)) == null ? void 0 : P.methods.map(({ name: l, exposed: x }) => ({ name: l, exposed: x })), g = H == null ? void 0 : H.find(
822
+ (l) => l.name === a
823
+ ), h = S == null ? void 0 : S.find((l) => l.name === n), N = h && h.exposed;
824
+ return /* @__PURE__ */ e("div", { className: "odd:bg-grey-500", ref: i, style: b, children: w === t ? /* @__PURE__ */ e(
825
+ it,
826
826
  {
827
827
  id: t,
828
828
  class: a,
829
- method: r,
830
- pattern: i,
829
+ method: n,
830
+ pattern: s,
831
831
  verbs: d,
832
- isExpanded: x,
833
- regexPattern: f,
834
- asRegex: g,
835
- listeners: n,
832
+ isExpanded: p,
833
+ regexPattern: m,
834
+ asRegex: f,
835
+ listeners: r,
836
836
  attributes: c
837
837
  }
838
838
  ) : /* @__PURE__ */ o(
@@ -840,14 +840,14 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
840
840
  {
841
841
  className: "flex items-center gap-2 rounded-b py-2.5 text-grey-50",
842
842
  onDoubleClick: () => {
843
- j.next(w), y({ type: "SET_EDITING_HANDLER", payload: t });
843
+ G.next(w), y({ type: "SET_EDITING_HANDLER", payload: t });
844
844
  },
845
845
  children: [
846
846
  /* @__PURE__ */ o("div", { className: "flex w-60 flex-shrink-0 items-center gap-1 ", children: [
847
847
  /* @__PURE__ */ e(
848
- pe,
848
+ ge,
849
849
  {
850
- listeners: n,
850
+ listeners: r,
851
851
  attributes: c
852
852
  },
853
853
  "grab-handle"
@@ -857,10 +857,10 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
857
857
  {
858
858
  className: C(
859
859
  "flex items-center gap-2",
860
- !h && "text-red-400"
860
+ !g && "text-red-400"
861
861
  ),
862
862
  children: [
863
- !h && /* @__PURE__ */ e(
863
+ !g && /* @__PURE__ */ e(
864
864
  E,
865
865
  {
866
866
  label: `The singleton "${a}" doesn't exist.`,
@@ -874,19 +874,19 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
874
874
  }
875
875
  ) : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "undefined" }) })
876
876
  ] }),
877
- /* @__PURE__ */ e("div", { className: "w-60 flex-shrink-0 ", children: /* @__PURE__ */ e("div", { className: "text-s w-full", children: r ? /* @__PURE__ */ o(
877
+ /* @__PURE__ */ e("div", { className: "w-60 flex-shrink-0 ", children: /* @__PURE__ */ e("div", { className: "text-s w-full", children: n ? /* @__PURE__ */ o(
878
878
  "div",
879
879
  {
880
880
  className: C(
881
881
  "flex items-center gap-2",
882
- !u && "text-red-400",
882
+ !h && "text-red-400",
883
883
  N && "text-yellow-400"
884
884
  ),
885
885
  children: [
886
- !u && /* @__PURE__ */ e(
886
+ !h && /* @__PURE__ */ e(
887
887
  E,
888
888
  {
889
- label: `The method "${r}" doesn't exist.`,
889
+ label: `The method "${n}" doesn't exist.`,
890
890
  className: "!bg-red-300 !text-red-400",
891
891
  children: /* @__PURE__ */ e("span", { className: "rounded p-0.5 hover:bg-red-400/30 pt-0.5 h-5 w-5 flex justify-center content-center", children: /* @__PURE__ */ e(q, { className: "inline h-4 w-4 pb-0.5 text-red-400" }) })
892
892
  }
@@ -895,24 +895,24 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
895
895
  N && /* @__PURE__ */ e(
896
896
  E,
897
897
  {
898
- label: `Method "${r}" is already exposed`,
898
+ label: `Method "${n}" is already exposed`,
899
899
  className: "!bg-yellow-100 !text-yellow-500",
900
900
  children: /* @__PURE__ */ e("span", { className: "rounded p-0.5 hover:bg-red-400/30 pt-0.5 h-5 w-5 flex justify-center content-center", children: /* @__PURE__ */ e(q, { className: "inline h-4 w-4 pb-0.5 text-yellow-500" }) })
901
901
  }
902
902
  ),
903
903
  " ",
904
- r
904
+ n
905
905
  ]
906
906
  }
907
907
  ) : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "undefined" }) }) }),
908
- /* @__PURE__ */ e("div", { className: "text-s relative w-60 flex-shrink-0 ", children: D ? /* @__PURE__ */ e(
908
+ /* @__PURE__ */ e("div", { className: "text-s relative w-60 flex-shrink-0 ", children: T ? /* @__PURE__ */ e(
909
909
  E,
910
910
  {
911
- label: g ? ue(D) : `Requests starting with /${D}/ will be handled`,
912
- children: /* @__PURE__ */ e("span", { children: D })
911
+ label: f ? xe(T) : `Requests starting with /${T}/ will be handled`,
912
+ children: /* @__PURE__ */ e("span", { children: T })
913
913
  }
914
914
  ) : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "/" }) }),
915
- /* @__PURE__ */ e("div", { className: "px-5 w-20 flex justify-center text-grey-200", children: g ? /* @__PURE__ */ e(Ce, {}) : /* @__PURE__ */ e(De, {}) }),
915
+ /* @__PURE__ */ e("div", { className: "px-5 w-20 flex justify-center text-grey-200", children: f ? /* @__PURE__ */ e(Se, {}) : /* @__PURE__ */ e(Pe, {}) }),
916
916
  /* @__PURE__ */ o("div", { className: "flex flex-1 items-center", children: [
917
917
  /* @__PURE__ */ e("div", { className: "text-s w-full", children: d.length ? d.join(",") : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "undefined" }) }),
918
918
  /* @__PURE__ */ o("div", { className: "flex items-center gap-0.5 px-2", children: [
@@ -921,7 +921,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
921
921
  {
922
922
  className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
923
923
  onClick: () => y({ type: "DUPLICATE_HANDLER", id: t }),
924
- children: /* @__PURE__ */ e(te, {})
924
+ children: /* @__PURE__ */ e(re, {})
925
925
  }
926
926
  ) }),
927
927
  /* @__PURE__ */ e(E, { label: "Edit Handler", className: "px-1 py-3", children: /* @__PURE__ */ e(
@@ -929,9 +929,9 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
929
929
  {
930
930
  className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
931
931
  onClick: () => {
932
- j.next(w), y({ type: "SET_EDITING_HANDLER", payload: t });
932
+ G.next(w), y({ type: "SET_EDITING_HANDLER", payload: t });
933
933
  },
934
- children: /* @__PURE__ */ e(Te, {})
934
+ children: /* @__PURE__ */ e(Re, {})
935
935
  }
936
936
  ) }),
937
937
  /* @__PURE__ */ e(E, { label: "Delete Handler", className: "px-1 py-3", placement: "top-end", children: /* @__PURE__ */ e(
@@ -939,18 +939,18 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
939
939
  {
940
940
  className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
941
941
  onClick: async () => {
942
- const { confirmed: s } = await I(
943
- ae({
942
+ const { confirmed: l } = await I(
943
+ le({
944
944
  title: "Delete Handler",
945
- type: ie.CONFIRM,
946
- color: le.DANGER,
945
+ type: pe.CONFIRM,
946
+ color: ce.DANGER,
947
947
  message: "Are you sure you want to remove this Handler?",
948
948
  icon: "FdWarningDanger"
949
949
  })
950
950
  ).unwrap();
951
- s && y({ type: "DELETE_HANDLER", id: t });
951
+ l && y({ type: "DELETE_HANDLER", id: t });
952
952
  },
953
- children: /* @__PURE__ */ e(He, {})
953
+ children: /* @__PURE__ */ e(Ie, {})
954
954
  }
955
955
  ) })
956
956
  ] })
@@ -958,52 +958,52 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
958
958
  ]
959
959
  }
960
960
  ) });
961
- }, lt = k.object({
961
+ }, ot = k.object({
962
962
  class: k.string().optional(),
963
963
  method: k.string().optional(),
964
964
  verbs: k.string().optional(),
965
965
  id: k.string().optional(),
966
966
  pattern: k.string().optional(),
967
967
  regexPattern: k.string().optional()
968
- }), it = k.array(lt), ot = ({ path: t }) => {
969
- const a = B(ke(t)), {
970
- dispatch: r,
971
- state: { content: i, editing: d }
972
- } = Q(), x = he(
973
- X(me),
974
- X(ge, {
975
- coordinateGetter: ve
968
+ }), dt = k.array(ot), ct = ({ path: t }) => {
969
+ const a = M(ie(t)), {
970
+ dispatch: n,
971
+ state: { content: s, editing: d }
972
+ } = Y(), p = fe(
973
+ Z(ye),
974
+ Z(ve, {
975
+ coordinateGetter: Ce
976
976
  })
977
- ), [f, g] = _(null), c = i.find((l) => l.id === f), n = G();
978
- return $(() => {
979
- const l = JSON.stringify(
980
- i.map(
981
- ({ isExpanded: b, asRegex: v, pattern: y, regexPattern: w, ...I }) => {
982
- var T;
983
- const D = v ? { regexPattern: w } : { pattern: y };
977
+ ), [m, f] = _(null), c = s.find((i) => i.id === m), r = $();
978
+ return F(() => {
979
+ const i = JSON.stringify(
980
+ s.map(
981
+ ({ isExpanded: v, asRegex: b, pattern: y, regexPattern: w, ...I }) => {
982
+ var D;
983
+ const T = b ? { regexPattern: w } : { pattern: y };
984
984
  return {
985
985
  ...I,
986
- verbs: (T = I.verbs) == null ? void 0 : T.join(","),
987
- ...D
986
+ verbs: (D = I.verbs) == null ? void 0 : D.join(","),
987
+ ...T
988
988
  };
989
989
  }
990
990
  ),
991
991
  null,
992
992
  2
993
- ), p = typeof (a == null ? void 0 : a.content) == "string" ? a.content : JSON.stringify(a == null ? void 0 : a.content, null, 2);
994
- l !== p && n(
995
- _e({
993
+ ), u = typeof (a == null ? void 0 : a.content) == "string" ? a.content : JSON.stringify(a == null ? void 0 : a.content, null, 2);
994
+ i !== u && r(
995
+ oe({
996
996
  path: t,
997
- content: l
997
+ content: i
998
998
  })
999
999
  );
1000
- }, [i]), /* @__PURE__ */ o("div", { className: "bg-grey-700 flex h-full w-full flex-col text-white", children: [
1000
+ }, [s]), /* @__PURE__ */ o("div", { className: "bg-grey-700 flex h-full w-full flex-col text-white", children: [
1001
1001
  /* @__PURE__ */ o("div", { className: "flex items-center justify-between border-b border-black p-2", children: [
1002
1002
  a && /* @__PURE__ */ e(
1003
- Ze,
1003
+ tt,
1004
1004
  {
1005
1005
  label: "Switch to text Editor",
1006
- Icon: Ie,
1006
+ Icon: Le,
1007
1007
  tab: a,
1008
1008
  editor: {
1009
1009
  config: { language: "json" },
@@ -1012,11 +1012,11 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
1012
1012
  }
1013
1013
  ),
1014
1014
  /* @__PURE__ */ o("p", { className: "text-grey-100 text-s flex items-center gap-1", children: [
1015
- /* @__PURE__ */ e(ne, { className: "inline text-base text-white" }),
1015
+ /* @__PURE__ */ e(ae, { className: "inline text-base text-white" }),
1016
1016
  " HTTP handlers are evaluated in the order they are declared"
1017
1017
  ] })
1018
1018
  ] }),
1019
- /* @__PURE__ */ e("div", { className: "mt-1 flex flex-1 flex-col overflow-x-auto px-4", children: i.length ? /* @__PURE__ */ o("div", { className: "flex h-full min-w-[1200px] flex-1 flex-col", children: [
1019
+ /* @__PURE__ */ e("div", { className: "mt-1 flex flex-1 flex-col overflow-x-auto px-4", children: s.length ? /* @__PURE__ */ o("div", { className: "flex h-full min-w-[1200px] flex-1 flex-col", children: [
1020
1020
  /* @__PURE__ */ o("div", { className: "mb-3 flex items-center gap-2 border-b", children: [
1021
1021
  /* @__PURE__ */ e("div", { className: "w-60 flex-shrink-0 text-xs", children: /* @__PURE__ */ e("span", { className: "pl-6", children: "Class" }) }),
1022
1022
  /* @__PURE__ */ e("div", { className: "w-60 flex-shrink-0 text-xs", children: "Method" }),
@@ -1029,7 +1029,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
1029
1029
  {
1030
1030
  disabled: !!d,
1031
1031
  onClick: () => {
1032
- j.next(d), r({
1032
+ G.next(d), n({
1033
1033
  type: "ADD_HANDLER",
1034
1034
  payload: {
1035
1035
  class: "",
@@ -1042,44 +1042,44 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
1042
1042
  });
1043
1043
  },
1044
1044
  className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none disabled:cursor-not-allowed disabled:opacity-30",
1045
- children: /* @__PURE__ */ e(Y, { className: "h-5 w-5" })
1045
+ children: /* @__PURE__ */ e(ee, { className: "h-5 w-5" })
1046
1046
  }
1047
1047
  ) }) })
1048
1048
  ] })
1049
1049
  ] }),
1050
1050
  /* @__PURE__ */ e("div", { className: "py-3", children: /* @__PURE__ */ o(
1051
- xe,
1051
+ be,
1052
1052
  {
1053
- sensors: x,
1054
- collisionDetection: fe,
1055
- onDragStart: (l) => {
1056
- g(l.active.id);
1053
+ sensors: p,
1054
+ collisionDetection: Ne,
1055
+ onDragStart: (i) => {
1056
+ f(i.active.id);
1057
1057
  },
1058
- onDragEnd: (l) => {
1059
- const { active: p, over: b } = l;
1060
- if (g(null), !(!p || !b) && p.id !== (b == null ? void 0 : b.id)) {
1061
- const v = i.map((w) => w.id).indexOf(p.id), y = i.map((w) => w.id).indexOf(b.id);
1062
- r({
1058
+ onDragEnd: (i) => {
1059
+ const { active: u, over: v } = i;
1060
+ if (f(null), !(!u || !v) && u.id !== (v == null ? void 0 : v.id)) {
1061
+ const b = s.map((w) => w.id).indexOf(u.id), y = s.map((w) => w.id).indexOf(v.id);
1062
+ n({
1063
1063
  type: "UPDATE_HANDLERS",
1064
- payload: Ee(i, v, y)
1064
+ payload: He(s, b, y)
1065
1065
  });
1066
1066
  }
1067
1067
  },
1068
1068
  children: [
1069
1069
  /* @__PURE__ */ e(
1070
- Ne,
1070
+ Te,
1071
1071
  {
1072
- items: i,
1073
- strategy: we,
1074
- children: i.map(({ id: l, ...p }) => /* @__PURE__ */ e(ee, { id: l, ...p }, l))
1072
+ items: s,
1073
+ strategy: De,
1074
+ children: s.map(({ id: i, ...u }) => /* @__PURE__ */ e(ne, { id: i, ...u }, i))
1075
1075
  }
1076
1076
  ),
1077
- /* @__PURE__ */ e(ye, { children: f && c ? /* @__PURE__ */ e("div", { className: "opacity-10", children: /* @__PURE__ */ e(ee, { ...c }) }) : null })
1077
+ /* @__PURE__ */ e(we, { children: m && c ? /* @__PURE__ */ e("div", { className: "opacity-10", children: /* @__PURE__ */ e(ne, { ...c }) }) : null })
1078
1078
  ]
1079
1079
  }
1080
1080
  ) })
1081
1081
  ] }) : /* @__PURE__ */ o("div", { className: "mt-6", children: [
1082
- /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(W, { className: "text-grey-200 mx-auto h-9 w-9" }) }),
1082
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(X, { className: "text-grey-200 mx-auto h-9 w-9" }) }),
1083
1083
  /* @__PURE__ */ o("div", { className: "text-s text-grey-200 mx-auto mt-3 max-w-sm text-center", children: [
1084
1084
  "There are no http handlers configured yet ",
1085
1085
  /* @__PURE__ */ e("br", {}),
@@ -1089,7 +1089,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
1089
1089
  "button",
1090
1090
  {
1091
1091
  onClick: () => {
1092
- j.next(d), r({
1092
+ G.next(d), n({
1093
1093
  type: "ADD_HANDLER",
1094
1094
  payload: {
1095
1095
  class: "",
@@ -1103,65 +1103,101 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
1103
1103
  },
1104
1104
  className: "bg-primary-dark text-s rounded px-2 py-1 flex items-center gap-1",
1105
1105
  children: [
1106
- /* @__PURE__ */ e(Y, { className: "inline text-white h-4 w-4" }),
1106
+ /* @__PURE__ */ e(ee, { className: "inline text-white h-4 w-4" }),
1107
1107
  " Add New Handler"
1108
1108
  ]
1109
1109
  }
1110
1110
  ) })
1111
1111
  ] }) })
1112
1112
  ] });
1113
- }, dt = ({ content: t, path: a }) => {
1114
- const [r, i] = _(null);
1113
+ }, pt = ({ content: t, path: a }) => {
1114
+ const [n, s] = _(null);
1115
1115
  function d(c) {
1116
- let n;
1116
+ let r;
1117
1117
  try {
1118
- n = JSON.parse(c);
1118
+ r = JSON.parse(c);
1119
1119
  } catch {
1120
- i("HTTP Handler JSON is invalid"), n = [];
1120
+ s("HTTP Handler JSON is invalid"), r = [];
1121
1121
  }
1122
- return n;
1122
+ return r;
1123
1123
  }
1124
- const x = typeof t == "string" ? d(t) : t;
1125
- if (!it.safeParse(x).success || r)
1124
+ const p = typeof t == "string" ? d(t) : t;
1125
+ if (!dt.safeParse(p).success || n)
1126
1126
  throw new Error("Invalid JSON");
1127
- const g = x.map((c) => {
1128
- var l;
1129
- const n = !!c.regexPattern;
1127
+ const f = p.map((c) => {
1128
+ var i;
1129
+ const r = !!c.regexPattern;
1130
1130
  return {
1131
1131
  ...c,
1132
- id: c.id ?? K(),
1133
- verbs: (l = c.verbs) == null ? void 0 : l.split(",").map((p) => p.toLocaleUpperCase()).filter(Boolean),
1134
- asRegex: n
1132
+ id: c.id ?? W(),
1133
+ verbs: (i = c.verbs) == null ? void 0 : i.split(",").map((u) => u.toLocaleUpperCase()).filter(Boolean),
1134
+ asRegex: r
1135
1135
  };
1136
1136
  });
1137
- return /* @__PURE__ */ e(tt, { content: g, children: /* @__PURE__ */ e(ot, { path: a }) });
1138
- }, ct = () => document.querySelector(`.${Ye}`) || document.body, pt = () => {
1139
- const t = B(Le), a = G();
1140
- return /* @__PURE__ */ e(F, { children: t.map((r, i) => /* @__PURE__ */ e(
1141
- Ke,
1137
+ return /* @__PURE__ */ e(rt, { content: f, children: /* @__PURE__ */ e(ct, { path: a }) });
1138
+ }, ut = () => document.querySelector(`.${et}`) || document.body, ht = () => {
1139
+ const t = M(Fe), a = $();
1140
+ return /* @__PURE__ */ e(O, { children: t.map((n, s) => /* @__PURE__ */ e(
1141
+ Ve,
1142
1142
  {
1143
- hasOverlay: i === 0,
1144
- ...r,
1145
- onClose: (d) => a(Fe(d)),
1146
- onEdit: (d) => a(Oe(d)),
1147
- container: ct()
1143
+ hasOverlay: s === 0,
1144
+ ...n,
1145
+ onClose: (d) => a(je(d)),
1146
+ onEdit: (d) => a($e(d)),
1147
+ container: ut()
1148
1148
  },
1149
- r.id
1149
+ n.id
1150
1150
  )) });
1151
- }, Pt = ({ content: t = [], ...a }) => /* @__PURE__ */ o($e, { store: je(), children: [
1152
- /* @__PURE__ */ e("div", { className: "h-screen bg-grey-900", children: /* @__PURE__ */ e(
1153
- dt,
1154
- {
1155
- path: Je,
1156
- content: t,
1157
- ...a
1158
- }
1159
- ) }),
1160
- /* @__PURE__ */ e(pt, {})
1161
- ] });
1151
+ }, mt = ({
1152
+ initialValue: t = [],
1153
+ onChange: a,
1154
+ ...n
1155
+ }) => {
1156
+ const s = M(
1157
+ ie(K),
1158
+ (p, m) => V(p, m)
1159
+ ), d = $();
1160
+ return F(() => {
1161
+ if (t)
1162
+ try {
1163
+ const p = typeof t == "string" ? JSON.parse(t) : t;
1164
+ if (V(p, s == null ? void 0 : s.content))
1165
+ return;
1166
+ d(
1167
+ oe({
1168
+ path: K,
1169
+ content: p
1170
+ })
1171
+ );
1172
+ } catch (p) {
1173
+ console.error(
1174
+ "[HTTP Handlers Editor Standalone] Error while parsing the initial value:",
1175
+ p
1176
+ );
1177
+ }
1178
+ }, [t]), Xe(() => {
1179
+ if (s != null && s.flags.touched && a)
1180
+ try {
1181
+ const p = JSON.stringify(s == null ? void 0 : s.content, null, 2);
1182
+ a(p);
1183
+ } catch (p) {
1184
+ console.error("[HTTP Handlers Editor Standalone] Error on value stringify:", p);
1185
+ }
1186
+ }, [s == null ? void 0 : s.content]), /* @__PURE__ */ o(O, { children: [
1187
+ /* @__PURE__ */ e("div", { className: "h-screen bg-grey-900", children: /* @__PURE__ */ e(
1188
+ pt,
1189
+ {
1190
+ path: K,
1191
+ content: t,
1192
+ ...n
1193
+ }
1194
+ ) }),
1195
+ /* @__PURE__ */ e(ht, {})
1196
+ ] });
1197
+ }, kt = (t) => /* @__PURE__ */ e(Ge, { store: Me(), children: /* @__PURE__ */ e(Qe, { children: /* @__PURE__ */ e(mt, { ...t }) }) });
1162
1198
  export {
1163
- dt as HTTPHandlersEditor,
1164
- Ye as HTTP_HANDLERS_EDITOR_SCOPE_CLASS,
1165
- Pt as Standalone
1199
+ pt as HTTPHandlersEditor,
1200
+ et as HTTP_HANDLERS_EDITOR_SCOPE_CLASS,
1201
+ kt as Standalone
1166
1202
  };
1167
1203
  //# sourceMappingURL=index.es.js.map