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

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,36 +1,37 @@
1
- import { jsx as e, jsxs as o, Fragment as G } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as o, Fragment as F } from "react/jsx-runtime";
2
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
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 j, FdRegex as Ce, FdUnRegex as De, FdDuplicate as te, FdPen as Te, FdTrash as He, FdCloseNaked as q, FdInfoCircle as ne, FdCheckCircle as Re, FdClose as Pe, FdDragHandle as Se, FdDown as K, FdEmpty as J, FdCode as Ie, FdPlus as Y } from "@ws-ui/icons";
5
- import { useAppDispatch as B, switchEditor as ke, useAppSelector as W, selectCatalog as re, openModal as ae, selectTabByPath as Ae, setContent as _e, ReduxProvider as Le, getStore as Fe } from "@ws-ui/store";
6
- import { createContext as Oe, useReducer as $e, useEffect as O, useContext as je, useState as _, Fragment as se, useMemo as Ge } from "react";
7
- import { generate as V } from "short-uuid";
8
- import { z as A } from "zod";
9
- import { ToolbarIcon as qe, Tooltip as E, ModalColor as le, ModalType as ie, useHotkeys as Be, ControlledSwitch as Ue, HTTP_HANDLERS_TAB_PATH as ze } from "@ws-ui/shared";
10
- import { CSS as Me } from "@dnd-kit/utilities";
11
- import { Combobox as S, Transition as oe } from "@headlessui/react";
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";
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";
12
12
  import C from "classnames";
13
- import { useMultipleSelection as F, useCombobox as L } from "downshift";
14
- import { omit as de, isEqual as Ve } from "lodash";
15
- import { Subject as Ke } from "rxjs";
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
16
  import Z from "randexp";
17
- const Je = ({
17
+ import { HTTP_HANDLERS_EDITOR_SCOPE_CLASS as Ye } from "./common.es.js";
18
+ const Ze = ({
18
19
  label: t,
19
20
  Icon: a,
20
21
  tab: r,
21
22
  editor: i,
22
- onBeforeClick: c
23
+ onBeforeClick: d
23
24
  }) => {
24
- const x = B();
25
+ const x = G();
25
26
  return /* @__PURE__ */ e(
26
- qe,
27
+ Ue,
27
28
  {
28
29
  label: t,
29
30
  Icon: a,
30
31
  as: "button",
31
32
  onClick: () => {
32
- c == null || c(), x(
33
- ke({
33
+ d == null || d(), x(
34
+ Ae({
34
35
  tab: r,
35
36
  editor: i
36
37
  })
@@ -38,7 +39,7 @@ const Je = ({
38
39
  }
39
40
  }
40
41
  );
41
- }, ce = Oe(void 0), $ = new Ke(), We = (t, a) => {
42
+ }, ce = Ge(void 0), j = new Xe(), et = (t, a) => {
42
43
  switch (a.type) {
43
44
  case "UPDATE_HANDLERS":
44
45
  return {
@@ -55,7 +56,7 @@ const Je = ({
55
56
  ).some(Boolean) && r.verbs.length === 0)
56
57
  return {
57
58
  ...t,
58
- content: t.content.filter((c) => c.id !== r.id),
59
+ content: t.content.filter((d) => d.id !== r.id),
59
60
  editing: a.payload
60
61
  };
61
62
  }
@@ -65,7 +66,7 @@ const Je = ({
65
66
  };
66
67
  }
67
68
  case "ADD_HANDLER": {
68
- const r = V();
69
+ const r = K();
69
70
  return {
70
71
  ...t,
71
72
  content: [...t.content, { ...a.payload, id: r }],
@@ -101,7 +102,7 @@ const Je = ({
101
102
  ...t,
102
103
  content: [
103
104
  ...t.content,
104
- { ...r, id: V(), isExpanded: !0 }
105
+ { ...r, id: K(), isExpanded: !0 }
105
106
  ]
106
107
  } : t;
107
108
  }
@@ -117,7 +118,7 @@ const Je = ({
117
118
  return {
118
119
  ...t,
119
120
  content: a.payload.map((r) => {
120
- const i = t.content.find((c) => c.id === r.id);
121
+ const i = t.content.find((d) => d.id === r.id);
121
122
  return i ? {
122
123
  ...r,
123
124
  ...i
@@ -127,7 +128,7 @@ const Je = ({
127
128
  default:
128
129
  throw new Error("Unknown action type");
129
130
  }
130
- }, Qe = ({
131
+ }, tt = ({
131
132
  children: t,
132
133
  content: a
133
134
  }) => {
@@ -135,41 +136,41 @@ const Je = ({
135
136
  content: a,
136
137
  editing: null,
137
138
  newlyCreatedHandlerID: null
138
- }, [i, c] = $e(We, r);
139
- return O(() => {
140
- c({
139
+ }, [i, d] = qe(et, r);
140
+ return $(() => {
141
+ d({
141
142
  type: "SYNC_DATA",
142
143
  payload: a
143
144
  });
144
- }, [a]), /* @__PURE__ */ e(ce.Provider, { value: { state: i, dispatch: c }, children: t });
145
+ }, [a]), /* @__PURE__ */ e(ce.Provider, { value: { state: i, dispatch: d }, children: t });
145
146
  }, Q = () => {
146
- const t = je(ce);
147
+ const t = Me(ce);
147
148
  if (!t)
148
149
  throw new Error("useHTTPHandlers must be used within a HandlerProvider");
149
150
  return t;
150
- }, Xe = ({ initialSelectedItems: t, onChange: a, touched: r, onBlur: i }) => {
151
- const c = ["GET", "POST", "PUT", "DELETE"];
151
+ }, nt = ({ initialSelectedItems: t, onChange: a, touched: r, onBlur: i }) => {
152
+ const d = ["GET", "POST", "PUT", "DELETE"];
152
153
  function x(h, u) {
153
154
  const N = u.toLowerCase();
154
- return c.filter(function(s) {
155
+ return d.filter(function(s) {
155
156
  return !h.includes(s) && s.toLowerCase().includes(N);
156
157
  });
157
158
  }
158
- const [f, g] = _(""), [d, n] = _(t);
159
- O(() => {
159
+ const [f, g] = _(""), [c, n] = _(t);
160
+ $(() => {
160
161
  n(t);
161
162
  }, [t]);
162
- const l = Ge(
163
- () => x(d, f),
164
- [d, f]
165
- ), { getSelectedItemProps: p, getDropdownProps: b, removeSelectedItem: v } = F({
166
- selectedItems: d,
163
+ const l = Be(
164
+ () => x(c, f),
165
+ [c, f]
166
+ ), { getSelectedItemProps: p, getDropdownProps: b, removeSelectedItem: v } = O({
167
+ selectedItems: c,
167
168
  onStateChange({ selectedItems: h = [], type: u }) {
168
169
  switch (u) {
169
- case F.stateChangeTypes.SelectedItemKeyDownBackspace:
170
- case F.stateChangeTypes.SelectedItemKeyDownDelete:
171
- case F.stateChangeTypes.DropdownKeyDownBackspace:
172
- case F.stateChangeTypes.FunctionRemoveSelectedItem:
170
+ case O.stateChangeTypes.SelectedItemKeyDownBackspace:
171
+ case O.stateChangeTypes.SelectedItemKeyDownDelete:
172
+ case O.stateChangeTypes.DropdownKeyDownBackspace:
173
+ case O.stateChangeTypes.FunctionRemoveSelectedItem:
173
174
  n(h);
174
175
  break;
175
176
  }
@@ -192,8 +193,8 @@ const Je = ({
192
193
  selectedItem: null,
193
194
  inputValue: f,
194
195
  stateReducer(h, u) {
195
- const { changes: N, type: P } = u;
196
- switch (P) {
196
+ const { changes: N, type: S } = u;
197
+ switch (S) {
197
198
  case L.stateChangeTypes.InputKeyDownEnter:
198
199
  case L.stateChangeTypes.ItemClick:
199
200
  return {
@@ -216,7 +217,7 @@ const Je = ({
216
217
  case L.stateChangeTypes.InputKeyDownEnter:
217
218
  case L.stateChangeTypes.ItemClick:
218
219
  case L.stateChangeTypes.InputBlur:
219
- N && (n([...d, N]), g(""));
220
+ N && (n([...c, N]), g(""));
220
221
  break;
221
222
  case L.stateChangeTypes.InputChange:
222
223
  g(h);
@@ -224,9 +225,9 @@ const Je = ({
224
225
  }
225
226
  }
226
227
  });
227
- return O(() => {
228
- a(d);
229
- }, [d]), /* @__PURE__ */ o("div", { className: "relative flex-1", children: [
228
+ return $(() => {
229
+ a(c);
230
+ }, [c]), /* @__PURE__ */ o("div", { className: "relative flex-1", children: [
230
231
  /* @__PURE__ */ o(
231
232
  "div",
232
233
  {
@@ -234,13 +235,13 @@ const Je = ({
234
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",
235
236
  {
236
237
  "ring-1 ring-primary-dark rounded-b-none": y && l.length,
237
- "ring-1 ring-red-400 overflow-visible": d.length === 0 && r
238
+ "ring-1 ring-red-400 overflow-visible": c.length === 0 && r
238
239
  }
239
240
  ),
240
241
  onBlur: i,
241
242
  children: [
242
- d.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: d.length === 0 && "At least one HTTP verb is required" }),
243
- d.map(
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" }),
244
+ c.map(
244
245
  function(u, N) {
245
246
  return /* @__PURE__ */ o(
246
247
  "span",
@@ -248,7 +249,7 @@ const Je = ({
248
249
  className: C(
249
250
  "bg-grey-600 text-s mr-1 flex items-center rounded px-1 py-0.5 uppercase",
250
251
  {
251
- "bg-red-400": !c.includes(u)
252
+ "bg-red-400": !d.includes(u)
252
253
  }
253
254
  ),
254
255
  ...p({
@@ -260,11 +261,11 @@ const Je = ({
260
261
  /* @__PURE__ */ e(
261
262
  "span",
262
263
  {
263
- onClick: (P) => {
264
- P.stopPropagation(), v(u);
264
+ onClick: (S) => {
265
+ S.stopPropagation(), v(u);
265
266
  },
266
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",
267
- children: /* @__PURE__ */ e(q, {})
268
+ children: /* @__PURE__ */ e(M, {})
268
269
  }
269
270
  )
270
271
  ]
@@ -283,7 +284,7 @@ const Je = ({
283
284
  )
284
285
  ),
285
286
  className: "flex-grow border-none bg-transparent px-1 py-1 text-xs outline-none",
286
- placeholder: d.length === 0 ? "Select HTTP verbs" : "",
287
+ placeholder: c.length === 0 ? "Select HTTP verbs" : "",
287
288
  size: 1
288
289
  }
289
290
  ),
@@ -293,7 +294,7 @@ const Je = ({
293
294
  className: "absolute inset-y-0 right-0 flex items-center pr-2",
294
295
  type: "button",
295
296
  ...w(),
296
- children: /* @__PURE__ */ e(K, { className: "h-3 w-3 text-gray-50", "aria-hidden": "true" })
297
+ children: /* @__PURE__ */ e(J, { className: "h-3 w-3 text-gray-50", "aria-hidden": "true" })
297
298
  }
298
299
  )
299
300
  ]
@@ -320,16 +321,16 @@ const Je = ({
320
321
  }
321
322
  )
322
323
  ] });
323
- }, Ye = ({
324
+ }, rt = ({
324
325
  value: t,
325
326
  options: a,
326
327
  errorMessage: r = "",
327
328
  onChange: i,
328
- onBlur: c
329
+ onBlur: d
329
330
  }) => {
330
- const [x, f] = _(""), g = a.find((n) => n.name === t), d = x === "" ? a : a.filter((n) => n.name.toLowerCase().includes(x.toLowerCase()));
331
+ const [x, f] = _(""), g = a.find((n) => n.name === t), c = x === "" ? a : a.filter((n) => n.name.toLowerCase().includes(x.toLowerCase()));
331
332
  return /* @__PURE__ */ e(
332
- S,
333
+ P,
333
334
  {
334
335
  value: { name: t },
335
336
  onChange: (n) => i(n.name),
@@ -347,7 +348,7 @@ const Je = ({
347
348
  ),
348
349
  children: [
349
350
  /* @__PURE__ */ e(
350
- S.Input,
351
+ P.Input,
351
352
  {
352
353
  className: C(
353
354
  "bg-grey-300 text-s w-full border-none py-1 px-2 focus:outline-none rounded",
@@ -358,12 +359,12 @@ const Je = ({
358
359
  displayValue: (l) => l.name,
359
360
  onChange: (l) => f(l.target.value),
360
361
  style: { caretColor: "white" },
361
- onBlur: c
362
+ onBlur: d
362
363
  }
363
364
  ),
364
365
  /* @__PURE__ */ o("span", { className: "inset-y-0 right-0 flex items-center gap-1 pr-2", children: [
365
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 }),
366
- t ? /* @__PURE__ */ o(G, { children: [
367
+ t ? /* @__PURE__ */ o(F, { children: [
367
368
  /* @__PURE__ */ e(
368
369
  "button",
369
370
  {
@@ -371,7 +372,7 @@ const Je = ({
371
372
  f(""), i("");
372
373
  },
373
374
  children: /* @__PURE__ */ e(
374
- q,
375
+ M,
375
376
  {
376
377
  className: "text-grey-50 h-3 w-3",
377
378
  "aria-hidden": "true"
@@ -381,7 +382,7 @@ const Je = ({
381
382
  ),
382
383
  /* @__PURE__ */ e("span", { className: "bg-grey-50 h-3 w-[1px] rounded-full" })
383
384
  ] }) : null,
384
- /* @__PURE__ */ e(S.Button, { children: /* @__PURE__ */ e(K, { className: "text-grey-50 h-3 w-3", "aria-hidden": "true" }) })
385
+ /* @__PURE__ */ e(P.Button, { children: /* @__PURE__ */ e(J, { className: "text-grey-50 h-3 w-3", "aria-hidden": "true" }) })
385
386
  ] })
386
387
  ]
387
388
  }
@@ -394,15 +395,15 @@ const Je = ({
394
395
  leaveFrom: "opacity-100",
395
396
  leaveTo: "opacity-0",
396
397
  afterLeave: () => f(""),
397
- children: /* @__PURE__ */ e(S.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: d.length === 0 ? /* @__PURE__ */ o("div", { className: "text-s text-grey-200 relative cursor-default select-none px-0.5 py-0.5 ", children: [
398
- /* @__PURE__ */ e(J, { className: "inline h-4 w-4" }),
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" }),
399
400
  " Nothing found."
400
- ] }) : d.map((l, p) => /* @__PURE__ */ e(
401
- S.Option,
401
+ ] }) : c.map((l, p) => /* @__PURE__ */ e(
402
+ P.Option,
402
403
  {
403
404
  className: ({ active: b }) => `relative cursor-default select-none ${b ? "bg-primary-hover" : ""}`,
404
405
  value: l,
405
- children: ({ selected: b }) => /* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(
406
+ children: ({ selected: b }) => /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(
406
407
  "span",
407
408
  {
408
409
  className: `block truncate p-2 py-1 ${b ? "bg-primary-dark font-medium text-white" : "font-normal"}`,
@@ -418,15 +419,15 @@ const Je = ({
418
419
  },
419
420
  t
420
421
  );
421
- }, Ze = ({
422
+ }, at = ({
422
423
  value: t,
423
424
  options: a,
424
425
  onChange: r,
425
426
  errorMessage: i,
426
- onBlur: c
427
+ onBlur: d
427
428
  }) => {
428
- const [x, f] = _(""), g = a.find((l) => l.name === t), d = g && g.exposed, n = x === "" ? a : a.filter((l) => l.name.toLowerCase().includes(x.toLowerCase()));
429
- return /* @__PURE__ */ e(S, { value: { name: t }, onChange: (l) => r(l.name), children: ({ open: l }) => /* @__PURE__ */ o("div", { className: "relative", children: [
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: [
430
431
  /* @__PURE__ */ o(
431
432
  "div",
432
433
  {
@@ -434,26 +435,26 @@ const Je = ({
434
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",
435
436
  {
436
437
  "ring-1 ring-red-400": i,
437
- "ring-1 ring-yellow-500": d,
438
+ "ring-1 ring-yellow-500": c,
438
439
  "ring-1 ring-primary-dark rounded-b-none": l,
439
440
  "overflow-visible": !l && i
440
441
  }
441
442
  ),
442
443
  children: [
443
444
  /* @__PURE__ */ e(
444
- S.Input,
445
+ P.Input,
445
446
  {
446
447
  className: C(
447
448
  "bg-grey-300 text-s w-full border-none py-1 px-2 focus:outline-none truncate rounded",
448
449
  {
449
450
  "!text-red-400": i,
450
- "!text-yellow-500": d
451
+ "!text-yellow-500": c
451
452
  }
452
453
  ),
453
454
  style: { caretColor: "white" },
454
455
  displayValue: (p) => p.name,
455
456
  onChange: (p) => f(p.target.value),
456
- onBlur: c
457
+ onBlur: d
457
458
  }
458
459
  ),
459
460
  !l && i && /* @__PURE__ */ e(
@@ -461,13 +462,13 @@ const Je = ({
461
462
  {
462
463
  className: C(
463
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",
464
- { "!text-yellow-500 ring-yellow-500 bg-white": d }
465
+ { "!text-yellow-500 ring-yellow-500 bg-white": c }
465
466
  ),
466
467
  children: i
467
468
  }
468
469
  ),
469
470
  /* @__PURE__ */ o("span", { className: "inset-y-0 right-0 flex items-center gap-1 pr-2", children: [
470
- t ? /* @__PURE__ */ o(G, { children: [
471
+ t ? /* @__PURE__ */ o(F, { children: [
471
472
  /* @__PURE__ */ e(
472
473
  "button",
473
474
  {
@@ -475,7 +476,7 @@ const Je = ({
475
476
  f(""), r("");
476
477
  },
477
478
  children: /* @__PURE__ */ e(
478
- q,
479
+ M,
479
480
  {
480
481
  className: "text-grey-50 h-3 w-3",
481
482
  "aria-hidden": "true"
@@ -485,7 +486,7 @@ const Je = ({
485
486
  ),
486
487
  /* @__PURE__ */ e("span", { className: "bg-grey-50 h-3 w-[1px] rounded-full" })
487
488
  ] }) : null,
488
- /* @__PURE__ */ e(S.Button, { children: /* @__PURE__ */ e(K, { className: "text-grey-50 h-3 w-3", "aria-hidden": "true" }) })
489
+ /* @__PURE__ */ e(P.Button, { children: /* @__PURE__ */ e(J, { className: "text-grey-50 h-3 w-3", "aria-hidden": "true" }) })
489
490
  ] })
490
491
  ]
491
492
  }
@@ -498,17 +499,17 @@ const Je = ({
498
499
  leaveFrom: "opacity-100",
499
500
  leaveTo: "opacity-0",
500
501
  afterLeave: () => f(""),
501
- children: /* @__PURE__ */ e(S.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(
502
- S.Option,
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,
503
504
  {
504
505
  className: ({ active: v }) => `relative cursor-default select-none ${v ? "bg-primary-hover" : ""}`,
505
506
  value: p,
506
- children: ({ selected: v }) => /* @__PURE__ */ e(G, { children: /* @__PURE__ */ o(
507
+ children: ({ selected: v }) => /* @__PURE__ */ e(F, { children: /* @__PURE__ */ o(
507
508
  "span",
508
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
511
  children: [
511
- p.exposed && /* @__PURE__ */ e(j, { className: "text-yellow-500" }),
512
+ p.exposed && /* @__PURE__ */ e(q, { className: "text-yellow-500" }),
512
513
  /* @__PURE__ */ e("span", { className: "flex-1 truncate", title: p.name, children: p.name })
513
514
  ]
514
515
  }
@@ -516,13 +517,13 @@ const Je = ({
516
517
  },
517
518
  b
518
519
  )) : /* @__PURE__ */ o("div", { className: "text-s text-grey-200 relative cursor-default select-none px-0.5 py-0.5", children: [
519
- /* @__PURE__ */ e(J, { className: "inline h-4 w-4" }),
520
+ /* @__PURE__ */ e(W, { className: "inline h-4 w-4" }),
520
521
  " Nothing found."
521
522
  ] }) })
522
523
  }
523
524
  )
524
525
  ] }) });
525
- }, pe = ({ listeners: t, attributes: a }) => /* @__PURE__ */ e("button", { ...a, ...t, children: /* @__PURE__ */ e(Se, {}) }), ue = (t) => {
526
+ }, pe = ({ listeners: t, attributes: a }) => /* @__PURE__ */ e("button", { ...a, ...t, children: /* @__PURE__ */ e(Pe, {}) }), ue = (t) => {
526
527
  var r;
527
528
  if (!t) return "";
528
529
  let a;
@@ -533,45 +534,45 @@ const Je = ({
533
534
  a = "";
534
535
  }
535
536
  return `Requests matching regex will be handled example: ${a}`;
536
- }, et = ({
537
+ }, st = ({
537
538
  id: t,
538
539
  class: a,
539
540
  method: r,
540
541
  pattern: i,
541
- verbs: c,
542
+ verbs: d,
542
543
  regexPattern: x,
543
544
  asRegex: f,
544
545
  listeners: g,
545
- attributes: d
546
+ attributes: c
546
547
  }) => {
547
- var P;
548
+ var S;
548
549
  const [n, l] = _({
549
550
  className: a,
550
551
  method: r,
551
552
  pattern: i,
552
- verbs: c,
553
+ verbs: d,
553
554
  asRegex: f,
554
555
  regexPattern: x
555
- }), p = W(re), b = Object.values((p == null ? void 0 : p.singletons) || {}), v = (P = b.find((s) => s.name === n.className)) == null ? void 0 : P.methods.map(({ name: s, exposed: m }) => ({ name: s, exposed: m })), {
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 })), {
556
557
  dispatch: y,
557
558
  state: { newlyCreatedHandlerID: w }
558
- } = Q(), I = B();
559
+ } = Q(), I = G();
559
560
  function D() {
560
- const { className: s, method: m, asRegex: k, regexPattern: U, pattern: z, verbs: M } = n;
561
- return !!(s && m && (k ? U : !z.endsWith("/")) && M.length);
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);
562
563
  }
563
564
  function T() {
564
565
  if (D()) {
565
- const { className: s, method: m, asRegex: k, regexPattern: U, pattern: z, verbs: M } = n;
566
+ const { className: s, method: m, asRegex: A, regexPattern: U, pattern: z, verbs: V } = n;
566
567
  y({
567
568
  type: "UPDATE_HANDLER",
568
569
  id: t,
569
570
  payload: {
570
571
  class: s,
571
572
  method: m,
572
- verbs: M,
573
- asRegex: k,
574
- ...k ? { regexPattern: U } : { pattern: z }
573
+ verbs: V,
574
+ asRegex: A,
575
+ ...A ? { regexPattern: U } : { pattern: z }
575
576
  }
576
577
  }), y({ type: "SET_EDITING_HANDLER", payload: null });
577
578
  }
@@ -582,14 +583,14 @@ const Je = ({
582
583
  method: r,
583
584
  pattern: i,
584
585
  regexPattern: x,
585
- verbs: c
586
+ verbs: d
586
587
  }, m = de(n, ["id", "isExpanded"]);
587
588
  if (!D()) {
588
589
  y({ type: "DELETE_HANDLER", id: `${w}` }), y({ type: "SET_EDITING_HANDLER", payload: null });
589
590
  return;
590
591
  }
591
- if (!Ve(s, m)) {
592
- const { confirmed: k } = await I(
592
+ if (!Qe(s, m)) {
593
+ const { confirmed: A } = await I(
593
594
  ae({
594
595
  title: "Cancel Changes",
595
596
  type: ie.CONFIRM,
@@ -598,13 +599,13 @@ const Je = ({
598
599
  icon: "FdWarningDanger"
599
600
  })
600
601
  ).unwrap();
601
- if (k) {
602
+ if (A) {
602
603
  w === t && y({ type: "DELETE_HANDLER", id: t }), y({ type: "SET_EDITING_HANDLER", payload: null });
603
604
  return;
604
605
  }
605
606
  }
606
607
  };
607
- Be(
608
+ ze(
608
609
  "esc",
609
610
  () => {
610
611
  setTimeout(() => {
@@ -612,8 +613,8 @@ const Je = ({
612
613
  }, 100);
613
614
  },
614
615
  []
615
- ), O(() => {
616
- $.subscribe((s) => {
616
+ ), $(() => {
617
+ j.subscribe((s) => {
617
618
  s === t && T();
618
619
  });
619
620
  }, [n, t]);
@@ -643,12 +644,12 @@ const Je = ({
643
644
  pe,
644
645
  {
645
646
  listeners: g,
646
- attributes: d
647
+ attributes: c
647
648
  },
648
649
  "grab-handle"
649
650
  ),
650
651
  /* @__PURE__ */ e(
651
- Ye,
652
+ rt,
652
653
  {
653
654
  value: n.className,
654
655
  onChange: (s) => {
@@ -662,7 +663,7 @@ const Je = ({
662
663
  )
663
664
  ] }),
664
665
  /* @__PURE__ */ e("div", { className: "w-60 flex-shrink-0", children: /* @__PURE__ */ e(
665
- Ze,
666
+ at,
666
667
  {
667
668
  value: n.method,
668
669
  onChange: (s) => {
@@ -716,7 +717,7 @@ const Je = ({
716
717
  },
717
718
  className: "absolute inset-y-0 right-6 flex items-center gap-2 pr-2",
718
719
  children: /* @__PURE__ */ e(
719
- q,
720
+ M,
720
721
  {
721
722
  className: "text-grey-200 h-3 w-3",
722
723
  "aria-hidden": "true"
@@ -735,12 +736,12 @@ const Je = ({
735
736
  )
736
737
  ] }),
737
738
  /* @__PURE__ */ e("div", { className: "w-20 px-2 flex justify-center", children: /* @__PURE__ */ e(
738
- Ue,
739
+ Ve,
739
740
  {
740
741
  value: !!n.asRegex,
741
742
  onChange: (s) => {
742
743
  const m = s ? { regexPattern: i, asRegex: s } : { pattern: x, asRegex: s };
743
- l((k) => ({ ...k, ...m }));
744
+ l((A) => ({ ...A, ...m }));
744
745
  },
745
746
  className: `${n.asRegex ? "bg-primary-dark" : "bg-grey-300"}
746
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`,
@@ -756,7 +757,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
756
757
  ) }),
757
758
  /* @__PURE__ */ o("div", { className: "flex flex-1 items-center", children: [
758
759
  /* @__PURE__ */ e(
759
- Xe,
760
+ nt,
760
761
  {
761
762
  initialSelectedItems: n.verbs || [],
762
763
  onChange: (s) => {
@@ -794,7 +795,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
794
795
  {
795
796
  className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
796
797
  onClick: H,
797
- children: /* @__PURE__ */ e(Pe, {})
798
+ children: /* @__PURE__ */ e(Se, {})
798
799
  }
799
800
  ) })
800
801
  ] })
@@ -805,41 +806,41 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
805
806
  class: a,
806
807
  method: r,
807
808
  pattern: i,
808
- verbs: c,
809
+ verbs: d,
809
810
  isExpanded: x,
810
811
  regexPattern: f,
811
812
  asRegex: g
812
813
  }) => {
813
- var P;
814
- const { attributes: d, listeners: n, setNodeRef: l, transform: p, transition: b } = be({ id: t }), v = {
815
- transform: Me.Transform.toString(p),
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),
816
817
  transition: b
817
818
  }, {
818
819
  dispatch: y,
819
820
  state: { editing: w }
820
- } = Q(), I = B(), D = g ? f : i, T = W(re), H = Object.values((T == null ? void 0 : T.singletons) || {}), R = (P = H == null ? void 0 : H.find((s) => s.name === a)) == null ? void 0 : P.methods.map(({ name: s, exposed: m }) => ({ name: s, exposed: m })), h = H == null ? void 0 : H.find(
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(
821
822
  (s) => s.name === a
822
823
  ), u = R == null ? void 0 : R.find((s) => s.name === r), N = u && u.exposed;
823
824
  return /* @__PURE__ */ e("div", { className: "odd:bg-grey-500", ref: l, style: v, children: w === t ? /* @__PURE__ */ e(
824
- et,
825
+ st,
825
826
  {
826
827
  id: t,
827
828
  class: a,
828
829
  method: r,
829
830
  pattern: i,
830
- verbs: c,
831
+ verbs: d,
831
832
  isExpanded: x,
832
833
  regexPattern: f,
833
834
  asRegex: g,
834
835
  listeners: n,
835
- attributes: d
836
+ attributes: c
836
837
  }
837
838
  ) : /* @__PURE__ */ o(
838
839
  "div",
839
840
  {
840
841
  className: "flex items-center gap-2 rounded-b py-2.5 text-grey-50",
841
842
  onDoubleClick: () => {
842
- $.next(w), y({ type: "SET_EDITING_HANDLER", payload: t });
843
+ j.next(w), y({ type: "SET_EDITING_HANDLER", payload: t });
843
844
  },
844
845
  children: [
845
846
  /* @__PURE__ */ o("div", { className: "flex w-60 flex-shrink-0 items-center gap-1 ", children: [
@@ -847,7 +848,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
847
848
  pe,
848
849
  {
849
850
  listeners: n,
850
- attributes: d
851
+ attributes: c
851
852
  },
852
853
  "grab-handle"
853
854
  ),
@@ -864,7 +865,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
864
865
  {
865
866
  label: `The singleton "${a}" doesn't exist.`,
866
867
  className: "!bg-red-300 !text-red-400",
867
- 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(j, { className: "inline h-4 w-4 pb-0.5 text-red-400" }) })
868
+ 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" }) })
868
869
  }
869
870
  ),
870
871
  " ",
@@ -887,7 +888,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
887
888
  {
888
889
  label: `The method "${r}" doesn't exist.`,
889
890
  className: "!bg-red-300 !text-red-400",
890
- 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(j, { className: "inline h-4 w-4 pb-0.5 text-red-400" }) })
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" }) })
891
892
  }
892
893
  ),
893
894
  " ",
@@ -896,7 +897,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
896
897
  {
897
898
  label: `Method "${r}" is already exposed`,
898
899
  className: "!bg-yellow-100 !text-yellow-500",
899
- 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(j, { className: "inline h-4 w-4 pb-0.5 text-yellow-500" }) })
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" }) })
900
901
  }
901
902
  ),
902
903
  " ",
@@ -913,7 +914,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
913
914
  ) : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "/" }) }),
914
915
  /* @__PURE__ */ e("div", { className: "px-5 w-20 flex justify-center text-grey-200", children: g ? /* @__PURE__ */ e(Ce, {}) : /* @__PURE__ */ e(De, {}) }),
915
916
  /* @__PURE__ */ o("div", { className: "flex flex-1 items-center", children: [
916
- /* @__PURE__ */ e("div", { className: "text-s w-full", children: c.length ? c.join(",") : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "undefined" }) }),
917
+ /* @__PURE__ */ e("div", { className: "text-s w-full", children: d.length ? d.join(",") : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "undefined" }) }),
917
918
  /* @__PURE__ */ o("div", { className: "flex items-center gap-0.5 px-2", children: [
918
919
  /* @__PURE__ */ e(E, { label: "Duplicate Handler", className: "px-1 py-3", children: /* @__PURE__ */ e(
919
920
  "button",
@@ -928,7 +929,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
928
929
  {
929
930
  className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
930
931
  onClick: () => {
931
- $.next(w), y({ type: "SET_EDITING_HANDLER", payload: t });
932
+ j.next(w), y({ type: "SET_EDITING_HANDLER", payload: t });
932
933
  },
933
934
  children: /* @__PURE__ */ e(Te, {})
934
935
  }
@@ -957,24 +958,24 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
957
958
  ]
958
959
  }
959
960
  ) });
960
- }, tt = A.object({
961
- class: A.string().optional(),
962
- method: A.string().optional(),
963
- verbs: A.string().optional(),
964
- id: A.string().optional(),
965
- pattern: A.string().optional(),
966
- regexPattern: A.string().optional()
967
- }), nt = A.array(tt), rt = ({ path: t }) => {
968
- const a = W(Ae(t)), {
961
+ }, lt = k.object({
962
+ class: k.string().optional(),
963
+ method: k.string().optional(),
964
+ verbs: k.string().optional(),
965
+ id: k.string().optional(),
966
+ pattern: k.string().optional(),
967
+ regexPattern: k.string().optional()
968
+ }), it = k.array(lt), ot = ({ path: t }) => {
969
+ const a = B(ke(t)), {
969
970
  dispatch: r,
970
- state: { content: i, editing: c }
971
+ state: { content: i, editing: d }
971
972
  } = Q(), x = he(
972
973
  X(me),
973
974
  X(ge, {
974
975
  coordinateGetter: ve
975
976
  })
976
- ), [f, g] = _(null), d = i.find((l) => l.id === f), n = B();
977
- return O(() => {
977
+ ), [f, g] = _(null), c = i.find((l) => l.id === f), n = G();
978
+ return $(() => {
978
979
  const l = JSON.stringify(
979
980
  i.map(
980
981
  ({ isExpanded: b, asRegex: v, pattern: y, regexPattern: w, ...I }) => {
@@ -999,7 +1000,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
999
1000
  }, [i]), /* @__PURE__ */ o("div", { className: "bg-grey-700 flex h-full w-full flex-col text-white", children: [
1000
1001
  /* @__PURE__ */ o("div", { className: "flex items-center justify-between border-b border-black p-2", children: [
1001
1002
  a && /* @__PURE__ */ e(
1002
- Je,
1003
+ Ze,
1003
1004
  {
1004
1005
  label: "Switch to text Editor",
1005
1006
  Icon: Ie,
@@ -1026,9 +1027,9 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
1026
1027
  /* @__PURE__ */ e("div", { className: "flex items-center gap-2 text-2xl", children: /* @__PURE__ */ e(E, { label: "Add a new HTTP Handler", children: /* @__PURE__ */ e(
1027
1028
  "button",
1028
1029
  {
1029
- disabled: !!c,
1030
+ disabled: !!d,
1030
1031
  onClick: () => {
1031
- $.next(c), r({
1032
+ j.next(d), r({
1032
1033
  type: "ADD_HANDLER",
1033
1034
  payload: {
1034
1035
  class: "",
@@ -1073,12 +1074,12 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
1073
1074
  children: i.map(({ id: l, ...p }) => /* @__PURE__ */ e(ee, { id: l, ...p }, l))
1074
1075
  }
1075
1076
  ),
1076
- /* @__PURE__ */ e(ye, { children: f && d ? /* @__PURE__ */ e("div", { className: "opacity-10", children: /* @__PURE__ */ e(ee, { ...d }) }) : null })
1077
+ /* @__PURE__ */ e(ye, { children: f && c ? /* @__PURE__ */ e("div", { className: "opacity-10", children: /* @__PURE__ */ e(ee, { ...c }) }) : null })
1077
1078
  ]
1078
1079
  }
1079
1080
  ) })
1080
1081
  ] }) : /* @__PURE__ */ o("div", { className: "mt-6", children: [
1081
- /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(J, { className: "text-grey-200 mx-auto h-9 w-9" }) }),
1082
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(W, { className: "text-grey-200 mx-auto h-9 w-9" }) }),
1082
1083
  /* @__PURE__ */ o("div", { className: "text-s text-grey-200 mx-auto mt-3 max-w-sm text-center", children: [
1083
1084
  "There are no http handlers configured yet ",
1084
1085
  /* @__PURE__ */ e("br", {}),
@@ -1088,7 +1089,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
1088
1089
  "button",
1089
1090
  {
1090
1091
  onClick: () => {
1091
- $.next(c), r({
1092
+ j.next(d), r({
1092
1093
  type: "ADD_HANDLER",
1093
1094
  payload: {
1094
1095
  class: "",
@@ -1109,40 +1110,58 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
1109
1110
  ) })
1110
1111
  ] }) })
1111
1112
  ] });
1112
- }, at = ({ content: t, path: a }) => {
1113
+ }, dt = ({ content: t, path: a }) => {
1113
1114
  const [r, i] = _(null);
1114
- function c(d) {
1115
+ function d(c) {
1115
1116
  let n;
1116
1117
  try {
1117
- n = JSON.parse(d);
1118
+ n = JSON.parse(c);
1118
1119
  } catch {
1119
1120
  i("HTTP Handler JSON is invalid"), n = [];
1120
1121
  }
1121
1122
  return n;
1122
1123
  }
1123
- const x = typeof t == "string" ? c(t) : t;
1124
- if (!nt.safeParse(x).success || r)
1124
+ const x = typeof t == "string" ? d(t) : t;
1125
+ if (!it.safeParse(x).success || r)
1125
1126
  throw new Error("Invalid JSON");
1126
- const g = x.map((d) => {
1127
+ const g = x.map((c) => {
1127
1128
  var l;
1128
- const n = !!d.regexPattern;
1129
+ const n = !!c.regexPattern;
1129
1130
  return {
1130
- ...d,
1131
- id: d.id ?? V(),
1132
- verbs: (l = d.verbs) == null ? void 0 : l.split(",").map((p) => p.toLocaleUpperCase()).filter(Boolean),
1131
+ ...c,
1132
+ id: c.id ?? K(),
1133
+ verbs: (l = c.verbs) == null ? void 0 : l.split(",").map((p) => p.toLocaleUpperCase()).filter(Boolean),
1133
1134
  asRegex: n
1134
1135
  };
1135
1136
  });
1136
- return /* @__PURE__ */ e(Qe, { content: g, children: /* @__PURE__ */ e(rt, { path: a }) });
1137
- }, wt = (t) => /* @__PURE__ */ e(Le, { store: Fe(), children: /* @__PURE__ */ e("div", { className: "h-screen bg-grey-900", children: /* @__PURE__ */ e(
1138
- at,
1139
- {
1140
- path: ze,
1141
- ...t
1142
- }
1143
- ) }) });
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,
1142
+ {
1143
+ hasOverlay: i === 0,
1144
+ ...r,
1145
+ onClose: (d) => a(Fe(d)),
1146
+ onEdit: (d) => a(Oe(d)),
1147
+ container: ct()
1148
+ },
1149
+ r.id
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
+ ] });
1144
1162
  export {
1145
- at as HTTPHandlersEditor,
1146
- wt as Standalone
1163
+ dt as HTTPHandlersEditor,
1164
+ Ye as HTTP_HANDLERS_EDITOR_SCOPE_CLASS,
1165
+ Pt as Standalone
1147
1166
  };
1148
1167
  //# sourceMappingURL=index.es.js.map