@w6w/embed 0.2.30 → 0.2.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/{CreateFunctionModal-CCYi9deY.js → CreateFunctionModal-glk2zg1r.js} +28 -27
  2. package/dist/{CreateFunctionModal-CCYi9deY.js.map → CreateFunctionModal-glk2zg1r.js.map} +1 -1
  3. package/dist/{DocumentFormModal-B3VudaLb.js → DocumentFormModal-Cw85R4wk.js} +2 -2
  4. package/dist/{DocumentFormModal-B3VudaLb.js.map → DocumentFormModal-Cw85R4wk.js.map} +1 -1
  5. package/dist/{ImportSpecModal-C-B8Jwxk.js → ImportSpecModal-fU5RsVTa.js} +2 -2
  6. package/dist/{ImportSpecModal-C-B8Jwxk.js.map → ImportSpecModal-fU5RsVTa.js.map} +1 -1
  7. package/dist/{WorkflowEditor-8NAcpjO_.js → WorkflowEditor-B-Wc_r4X.js} +5 -5
  8. package/dist/{WorkflowEditor-8NAcpjO_.js.map → WorkflowEditor-B-Wc_r4X.js.map} +1 -1
  9. package/dist/callable-record-Bhxim8C1.js +14 -0
  10. package/dist/callable-record-Bhxim8C1.js.map +1 -0
  11. package/dist/callables-B49tS2vv.js +297 -0
  12. package/dist/callables-B49tS2vv.js.map +1 -0
  13. package/dist/{document-sources-DNmBojx6.js → document-sources-Khcw2zB5.js} +16 -16
  14. package/dist/document-sources-Khcw2zB5.js.map +1 -0
  15. package/dist/draft.mjs +1 -1
  16. package/dist/editor/WorkflowInputsModal.d.ts +12 -0
  17. package/dist/editor/WorkflowVariablesEditor.d.ts +1 -1
  18. package/dist/{editor-tools-BIAW-wzt.js → editor-tools-Ch1cAE4F.js} +423 -366
  19. package/dist/editor-tools-Ch1cAE4F.js.map +1 -0
  20. package/dist/editor.mjs +1 -1
  21. package/dist/editors.mjs +81 -80
  22. package/dist/editors.mjs.map +1 -1
  23. package/dist/endpoints-zOuwci2U.js +136 -0
  24. package/dist/endpoints-zOuwci2U.js.map +1 -0
  25. package/dist/fields-CXHRR5eK.js +28 -0
  26. package/dist/fields-CXHRR5eK.js.map +1 -0
  27. package/dist/forms.mjs +1 -1
  28. package/dist/index.mjs +91 -91
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/lib/callable-duplicate.d.ts +26 -0
  31. package/dist/lib/variable-preview.d.ts +6 -0
  32. package/dist/lib.mjs +41 -40
  33. package/dist/lib.mjs.map +1 -1
  34. package/dist/lists/CallableKindList.d.ts +4 -1
  35. package/dist/lists/CallableRowParts.d.ts +5 -0
  36. package/dist/lists/CredentialDetail.d.ts +2 -0
  37. package/dist/lists/CredentialFields.d.ts +1 -1
  38. package/dist/lists/EndpointList.d.ts +2 -1
  39. package/dist/lists/WorkflowList.d.ts +2 -1
  40. package/dist/lists.mjs +1509 -1421
  41. package/dist/lists.mjs.map +1 -1
  42. package/dist/rail.mjs +1 -1
  43. package/dist/repos/callables.d.ts +23 -0
  44. package/dist/repos/fields.d.ts +4 -1
  45. package/dist/repos.mjs +242 -239
  46. package/dist/settings-rail-BjsTjg2u.js +22 -0
  47. package/dist/settings-rail-BjsTjg2u.js.map +1 -0
  48. package/dist/{spec-import-FygyV8sy.js → spec-import-CGPqUUjN.js} +2 -2
  49. package/dist/{spec-import-FygyV8sy.js.map → spec-import-CGPqUUjN.js.map} +1 -1
  50. package/dist/{use-callable-draft-DCauHt5o.js → use-callable-draft-DjW7_9qb.js} +8 -7
  51. package/dist/{use-callable-draft-DCauHt5o.js.map → use-callable-draft-DjW7_9qb.js.map} +1 -1
  52. package/package.json +3 -3
  53. package/src/styles.css +165 -10
  54. package/dist/callables-tOlflvbl.js +0 -151
  55. package/dist/callables-tOlflvbl.js.map +0 -1
  56. package/dist/document-sources-DNmBojx6.js.map +0 -1
  57. package/dist/editor-tools-BIAW-wzt.js.map +0 -1
  58. package/dist/endpoints-DArAqoLT.js +0 -233
  59. package/dist/endpoints-DArAqoLT.js.map +0 -1
  60. package/dist/fields-DvS8XZFc.js +0 -21
  61. package/dist/fields-DvS8XZFc.js.map +0 -1
  62. package/dist/settings-rail--GdRMusb.js +0 -33
  63. package/dist/settings-rail--GdRMusb.js.map +0 -1
package/dist/lists.mjs CHANGED
@@ -1,160 +1,173 @@
1
1
  "use client";
2
- import { jsxs as r, jsx as t, Fragment as W } from "react/jsx-runtime";
3
- import { useState as y, useMemo as te, useEffect as zt } from "react";
4
- import { F as Yt, E as Gt } from "./CreateFunctionModal-CCYi9deY.js";
5
- import { d as Jt, f as Zt, h as Xt, b as rt, n as Pe, u as en, m as tn } from "./endpoints-DArAqoLT.js";
6
- import { u as ae, b as Ke } from "./project-context-Tvp-La7A.js";
7
- import { RowActionsMenu as Oe, ConfirmModal as He, CallableListStatus as ot, CallableList as nn, ReliabilityList as an, EmptyState as Fe, DataTable as ke, ListItem as Me, HealthStatusPill as be, HistoryTimeline as sn, useW6WApi as ct, connectionAppIdsToLookUp as dt, ConnectionList as ln, AddConnectionModal as rn, EditConnectionModal as ut, Modal as on, resolveConnectionAppMeta as xe, ConnectionHeader as cn, EditButton as dn, IconButton as un, AuthGuide as mn, ConnectionKeepAlive as hn, AppIcon as mt, secretClipboard as ht, AppPicker as pn, AppConnectionForm as wn, locateDataStoreError as fn, tableSchemaOf as yn, draftFromEntry as ye, CsvPanel as gn, DataTableGrid as vn, NEW_ROW_ID as le, newRowDraft as ze, kvValueTypeOf as bn, DataEntryList as Nn, DataEntryEditor as kn, dirtyColumns as Cn, csvFilenameOf as In, csvImportMessage as Ye, buildRowValue as An, rowWriteOf as $n, remainingTtlSeconds as pt, isVersionConflict as wt, cellErrorsOf as Dn, parseDocText as En, kvValueOf as Sn, serializeCell as Tn, DataStoreList as Ln, DATA_STORE_KINDS as Mn, DATA_STORE_KIND_LABEL as xn, SCALAR_TYPES as Rn, ColumnsEditor as Pn, errorPlacement as Kn } from "@w6w/ui";
8
- import { I as On } from "./ImportSpecModal-C-B8Jwxk.js";
9
- import { i as Fn } from "./import-bindings-EUtxZ9Ti.js";
10
- import { a3 as Qn, a1 as ft, T as jn, E as qn } from "./workflows-Dz8LMjnt.js";
11
- import { useQueryClient as de, useQuery as Qe, useInfiniteQuery as yt } from "@tanstack/react-query";
12
- import { k as _n, n as Un, c as Vn } from "./callables-tOlflvbl.js";
13
- import { o as Bn, r as Wn, k as Hn, i as zn } from "./spec-import-FygyV8sy.js";
14
- import { n as Yn, b as Gn } from "./workflow-blank-BJFLdGyE.js";
15
- import { f as Jn, e as Ge, g as Zn, b as Xn, h as ea, i as ta } from "./api-calls--JHyif6a.js";
16
- import { a as na, C as Ce, M as aa } from "./ConfirmModal-WqBfWftD.js";
17
- import { D as sa } from "./DocumentFormModal-B3VudaLb.js";
18
- import { H as ia, a as je } from "./editor-apps-HEOclsxL.js";
19
- import { ApiError as gt } from "@w6w/sdk";
20
- import { u as qe, o as vt, k as bt, c as ce, b as Re, m as la, p as Nt, e as Je, q as ra } from "./connections-CzsCyIxY.js";
21
- import { M as oa } from "./ModelRoutesManager-DqeY1mdP.js";
22
- import { j as ca } from "./apps-FMcQfyL2.js";
23
- import { u as he } from "./client-context-CX61Bgw-.js";
24
- import { v as da, A as ua, s as ma, E as ha, c as _e } from "./models-CI0vLJ6o.js";
25
- import { u as Ue, b as kt, d as Ct, c as It } from "./ai-keys-D676ly41.js";
26
- import { x as At, w as Ie, a as $t, g as me, c as pa, i as wa, o as se, h as Dt, p as fa, v as ya, q as ga, z as Et, A as St, B as va, y as Tt } from "./credentials-4Nf2GfMc.js";
27
- import { h as ba, k as Lt, p as Mt, o as Na, j as xt, n as ka, m as Ca, g as Rt, i as Ia, u as Aa, f as $a } from "./data-stores-UeQvwVCa.js";
28
- const Pt = {
2
+ import { jsxs as r, jsx as t, Fragment as H } from "react/jsx-runtime";
3
+ import { useState as f, useMemo as ae, useEffect as Yt } from "react";
4
+ import { F as Gt, E as Jt } from "./CreateFunctionModal-glk2zg1r.js";
5
+ import { p as Zt, r as Xt, t as en, c as tn, j as nn, n as Ke } from "./callables-B49tS2vv.js";
6
+ import { u as se, b as Oe } from "./project-context-Tvp-La7A.js";
7
+ import { d as an, g as sn, b as ot, u as ln, l as ze } from "./endpoints-zOuwci2U.js";
8
+ import { RowActionsMenu as Fe, ConfirmModal as Ye, CallableListStatus as ct, CallableList as rn, ReliabilityList as on, EmptyState as je, DataTable as ke, ListItem as xe, HealthStatusPill as ve, HistoryTimeline as cn, useW6WApi as dt, connectionAppIdsToLookUp as ut, ConnectionList as dn, AddConnectionModal as un, EditConnectionModal as mt, Modal as mn, resolveConnectionAppMeta as Re, ConnectionHeader as hn, EditButton as pn, IconButton as wn, AuthGuide as fn, ConnectionKeepAlive as yn, AppIcon as ht, secretClipboard as gn, SecretJsonField as pt, AppPicker as bn, AppConnectionForm as vn, locateDataStoreError as Nn, tableSchemaOf as kn, draftFromEntry as ye, CsvPanel as Cn, DataTableGrid as In, NEW_ROW_ID as re, newRowDraft as Ge, kvValueTypeOf as An, DataEntryList as $n, DataEntryEditor as Sn, dirtyColumns as Dn, csvFilenameOf as Tn, csvImportMessage as Je, buildRowValue as En, rowWriteOf as Ln, remainingTtlSeconds as wt, isVersionConflict as ft, cellErrorsOf as Mn, parseDocText as xn, kvValueOf as Rn, serializeCell as Pn, DataStoreList as Kn, DATA_STORE_KINDS as On, DATA_STORE_KIND_LABEL as Fn, SCALAR_TYPES as jn, ColumnsEditor as Qn, errorPlacement as qn } from "@w6w/ui";
9
+ import { I as _n } from "./ImportSpecModal-fU5RsVTa.js";
10
+ import { i as Un } from "./import-bindings-EUtxZ9Ti.js";
11
+ import { a3 as Vn, a1 as yt, T as Bn, E as Wn } from "./workflows-Dz8LMjnt.js";
12
+ import { useQueryClient as ue, useQuery as Qe, useInfiniteQuery as gt } from "@tanstack/react-query";
13
+ import { o as Hn, r as zn, k as Yn, i as Gn } from "./spec-import-CGPqUUjN.js";
14
+ import { n as Jn, b as Zn } from "./workflow-blank-BJFLdGyE.js";
15
+ import { f as Xn, e as Ze, g as ea, b as ta, h as na, i as aa } from "./api-calls--JHyif6a.js";
16
+ import { a as sa, C as Ce, M as ia } from "./ConfirmModal-WqBfWftD.js";
17
+ import { D as la } from "./DocumentFormModal-Cw85R4wk.js";
18
+ import { H as ra, a as qe } from "./editor-apps-HEOclsxL.js";
19
+ import { ApiError as bt } from "@w6w/sdk";
20
+ import { u as _e, o as vt, k as Nt, c as de, b as Pe, m as oa, p as kt, e as Xe, q as ca } from "./connections-CzsCyIxY.js";
21
+ import { M as da } from "./ModelRoutesManager-DqeY1mdP.js";
22
+ import { j as ua } from "./apps-FMcQfyL2.js";
23
+ import { u as pe } from "./client-context-CX61Bgw-.js";
24
+ import { v as ma, A as ha, s as pa, E as wa, c as Ue } from "./models-CI0vLJ6o.js";
25
+ import { u as Ve, b as Ct, d as It, c as At } from "./ai-keys-D676ly41.js";
26
+ import { x as $t, w as Ie, a as St, g as he, c as fa, i as ya, o as ie, h as Dt, p as ga, v as ba, q as va, z as Tt, A as Et, B as Na, y as Lt } from "./credentials-4Nf2GfMc.js";
27
+ import { h as ka, k as Mt, p as xt, o as Ca, j as Rt, n as Ia, m as Aa, g as Pt, i as $a, u as Sa, f as Da } from "./data-stores-UeQvwVCa.js";
28
+ const Kt = {
29
29
  function: "function",
30
30
  endpoint: "endpoint",
31
31
  workflow: "workflow"
32
32
  };
33
- function Ve(e, n, a) {
34
- var s;
35
- const i = Wn(e, n, !a);
36
- return typeof ((s = i.data) == null ? void 0 : s.enabled) == "boolean" ? i.data : void 0;
33
+ function Be(e, n, s) {
34
+ var a;
35
+ const i = zn(e, n, !s);
36
+ return typeof ((a = i.data) == null ? void 0 : a.enabled) == "boolean" ? i.data : void 0;
37
37
  }
38
- function Da(e, n = Date.now()) {
38
+ function Ta(e, n = Date.now()) {
39
39
  if (!e) return null;
40
- const a = Date.parse(e);
41
- if (Number.isNaN(a)) return null;
42
- const i = Math.max(0, Math.round((n - a) / 6e4));
40
+ const s = Date.parse(e);
41
+ if (Number.isNaN(s)) return null;
42
+ const i = Math.max(0, Math.round((n - s) / 6e4));
43
43
  if (i < 1) return "just now";
44
44
  if (i < 60) return `${i}m ago`;
45
- const s = Math.round(i / 60);
46
- if (s < 24) return `${s}h ago`;
47
- const l = Math.round(s / 24);
48
- return l < 30 ? `${l}d ago` : new Date(a).toLocaleDateString();
45
+ const a = Math.round(i / 60);
46
+ if (a < 24) return `${a}h ago`;
47
+ const l = Math.round(a / 24);
48
+ return l < 30 ? `${l}d ago` : new Date(s).toLocaleDateString();
49
49
  }
50
50
  function Ea(e) {
51
- const n = Ve(e.kind, e.id, e.archived);
51
+ const n = Be(e.kind, e.id, e.archived);
52
52
  return !e.archived && (n == null ? void 0 : n.enabled) === !1 ? /* @__PURE__ */ t(
53
- ot,
53
+ ct,
54
54
  {
55
55
  tone: "warn",
56
- title: `Switched off: this ${Pt[e.kind]} refuses every call until it is enabled again.`,
56
+ title: `Switched off: this ${Kt[e.kind]} refuses every call until it is enabled again.`,
57
57
  "data-testid": `callable-disabled-${e.id}`,
58
58
  children: "disabled"
59
59
  }
60
- ) : /* @__PURE__ */ t(W, { children: e.base ?? null });
60
+ ) : /* @__PURE__ */ t(H, { children: e.base ?? null });
61
61
  }
62
- function Sa(e) {
63
- const n = Ve(e.kind, e.id, e.archived), a = [];
64
- e.keyText && a.push(/* @__PURE__ */ t("code", { children: e.keyText }, "key"));
62
+ function La(e) {
63
+ const n = Be(e.kind, e.id, e.archived), s = [];
64
+ e.keyText && s.push(/* @__PURE__ */ t("code", { children: e.keyText }, "key"));
65
65
  const i = n == null ? void 0 : n.currentPublishedVersion;
66
- n && a.push(
66
+ n && s.push(
67
67
  /* @__PURE__ */ t("span", { children: i == null ? "not published" : `published v${i}` }, "pub")
68
- ), e.extra != null && a.push(/* @__PURE__ */ t("span", { children: e.extra }, "extra"));
69
- const s = Da(e.updatedAt);
70
- return s && a.push(/* @__PURE__ */ r("span", { children: [
68
+ ), e.extra != null && s.push(/* @__PURE__ */ t("span", { children: e.extra }, "extra"));
69
+ const a = Ta(e.updatedAt);
70
+ return a && s.push(/* @__PURE__ */ r("span", { children: [
71
71
  "updated ",
72
- s
73
- ] }, "ago")), /* @__PURE__ */ t(W, { children: a.map((l, o) => /* @__PURE__ */ r("span", { className: "w6w-callable-list-meta-part", children: [
72
+ a
73
+ ] }, "ago")), /* @__PURE__ */ t(H, { children: s.map((l, o) => /* @__PURE__ */ r("span", { className: "w6w-callable-list-meta-part", children: [
74
74
  o > 0 && /* @__PURE__ */ t("span", { "aria-hidden": "true", children: "· " }),
75
75
  l
76
76
  ] }, l.key ?? o)) });
77
77
  }
78
- function Ta(e) {
79
- const { kind: n, id: a, name: i, archived: s } = e, l = Pt[n], o = de(), u = Ve(n, a, s), m = Bn(n), w = _n(n), N = Un(n), [h, k] = y(null), [p, A] = y(null), b = () => o.invalidateQueries({ queryKey: [Vn(n)[0]] }), $ = u == null ? void 0 : u.enabled, I = (f) => {
80
- var E;
81
- (E = navigator.clipboard) == null || E.writeText(f).catch(() => {
78
+ function Ma(e) {
79
+ const { kind: n, id: s, name: i, archived: a } = e, l = Kt[n], o = ue(), d = Be(n, s, a), m = Hn(n), p = Zt(n), C = Xt(n), h = en(n, { project: e.project ?? void 0 }), [y, c] = f(null), [k, g] = f(null), S = () => o.invalidateQueries({ queryKey: [tn(n)[0]] }), I = d == null ? void 0 : d.enabled, A = (v) => {
80
+ var D;
81
+ (D = navigator.clipboard) == null || D.writeText(v).catch(() => {
82
82
  });
83
83
  };
84
84
  return (
85
85
  // The confirm dialogs render inside the row: their clicks must not reach the row's own click.
86
86
  // biome-ignore lint/a11y/useKeyWithClickEvents: propagation guard only; the controls are inside.
87
- /* @__PURE__ */ r("span", { className: "w6w-callable-row-menu", onClick: (f) => f.stopPropagation(), children: [
87
+ /* @__PURE__ */ r("span", { className: "w6w-callable-row-menu", onClick: (v) => v.stopPropagation(), children: [
88
88
  /* @__PURE__ */ t(
89
- Oe,
89
+ Fe,
90
90
  {
91
91
  label: `Actions for ${i}`,
92
- "data-testid": `${n}-actions-${a}`,
92
+ "data-testid": `${n}-actions-${s}`,
93
93
  actions: [
94
- ...(e.copy ?? []).map((f) => ({
95
- label: f.label,
94
+ ...(e.copy ?? []).map((v) => ({
95
+ label: v.label,
96
96
  icon: "copy",
97
- onSelect: () => I(f.value)
97
+ onSelect: () => A(v.value)
98
98
  })),
99
- !s && $ !== void 0 && {
100
- label: $ ? "Disable" : "Enable",
101
- icon: $ ? "pause" : "play",
99
+ !a && {
100
+ label: h.isPending ? "Duplicating…" : "Duplicate",
101
+ icon: "copy",
102
+ disabled: h.isPending,
103
+ onSelect: () => {
104
+ var v;
105
+ g(null), h.mutate(
106
+ { id: s, siblings: ((v = e.siblings) == null ? void 0 : v.call(e)) ?? { keys: [], names: [] } },
107
+ { onError: (D) => g(D instanceof Error ? D.message : String(D)) }
108
+ );
109
+ },
110
+ "data-testid": `${n}-duplicate-${s}`
111
+ },
112
+ !a && I !== void 0 && {
113
+ label: I ? "Disable" : "Enable",
114
+ icon: I ? "pause" : "play",
102
115
  disabled: m.isPending,
103
116
  onSelect: () => m.mutate(
104
- { id: a, enabled: !$ },
105
- { onError: (f) => A(f instanceof Error ? f.message : String(f)) }
117
+ { id: s, enabled: !I },
118
+ { onError: (v) => g(v instanceof Error ? v.message : String(v)) }
106
119
  ),
107
- "data-testid": `${n}-toggle-${a}`
120
+ "data-testid": `${n}-toggle-${s}`
108
121
  },
109
- !s && {
122
+ !a && {
110
123
  label: "Archive",
111
124
  icon: "archive",
112
- onSelect: () => k("archive"),
113
- "data-testid": `${n}-archive-${a}`
125
+ onSelect: () => c("archive"),
126
+ "data-testid": `${n}-archive-${s}`
114
127
  },
115
- s && {
128
+ a && {
116
129
  label: "Delete permanently",
117
130
  icon: "delete",
118
131
  danger: !0,
119
- onSelect: () => k("delete"),
120
- "data-testid": `${n}-delete-${a}`
132
+ onSelect: () => c("delete"),
133
+ "data-testid": `${n}-delete-${s}`
121
134
  }
122
135
  ]
123
136
  }
124
137
  ),
125
- p && /* @__PURE__ */ t("span", { className: "w6w-error w6w-small", role: "alert", children: p }),
126
- h === "archive" && /* @__PURE__ */ t(
127
- He,
138
+ k && /* @__PURE__ */ t("span", { className: "w6w-error w6w-small", role: "alert", children: k }),
139
+ y === "archive" && /* @__PURE__ */ t(
140
+ Ye,
128
141
  {
129
142
  title: `Archive ${l}`,
130
143
  message: `Archive “${i}”? It stops accepting calls and leaves the list (tick Show archived to see it). Archiving cannot be undone; an archived ${l} can then be deleted.`,
131
144
  confirmLabel: "Archive",
132
- pending: w.isPending,
133
- onClose: () => k(null),
134
- onConfirm: () => w.mutate(a, {
145
+ pending: p.isPending,
146
+ onClose: () => c(null),
147
+ onConfirm: () => p.mutate(s, {
135
148
  onSuccess: () => {
136
- k(null), b();
149
+ c(null), S();
137
150
  },
138
- onError: (f) => {
139
- k(null), A(f instanceof Error ? f.message : String(f));
151
+ onError: (v) => {
152
+ c(null), g(v instanceof Error ? v.message : String(v));
140
153
  }
141
154
  })
142
155
  }
143
156
  ),
144
- h === "delete" && /* @__PURE__ */ t(
145
- He,
157
+ y === "delete" && /* @__PURE__ */ t(
158
+ Ye,
146
159
  {
147
160
  title: `Delete ${l}`,
148
161
  message: `Delete “${i}” permanently? This cannot be undone.`,
149
162
  confirmLabel: "Delete",
150
- pending: N.isPending,
151
- onClose: () => k(null),
152
- onConfirm: () => N.mutate(a, {
163
+ pending: C.isPending,
164
+ onClose: () => c(null),
165
+ onConfirm: () => C.mutate(s, {
153
166
  onSuccess: () => {
154
- k(null), b();
167
+ c(null), S();
155
168
  },
156
- onError: (f) => {
157
- k(null), A(f instanceof Error ? f.message : String(f));
169
+ onError: (v) => {
170
+ c(null), g(v instanceof Error ? v.message : String(v));
158
171
  }
159
172
  })
160
173
  }
@@ -162,95 +175,128 @@ function Ta(e) {
162
175
  ] })
163
176
  );
164
177
  }
165
- const La = {
178
+ const xa = {
166
179
  function: "lambda",
167
180
  endpoint: "globe",
168
181
  workflow: "workflow"
169
182
  };
170
- function Be(e) {
171
- const { kind: n } = e, a = Jt(n), [i, s] = y(!1), l = (e.rows ?? []).map((o) => {
172
- const u = Fn(o), m = e.facts(o);
183
+ function We(e) {
184
+ var h;
185
+ const { kind: n } = e, s = nn(n), [i, a] = f(!1), l = `w6w.list-filter.${n}`, [o, d] = f(() => {
186
+ try {
187
+ return sessionStorage.getItem(l) ?? "all";
188
+ } catch {
189
+ return "all";
190
+ }
191
+ }), m = (y) => {
192
+ d(y);
193
+ try {
194
+ sessionStorage.setItem(l, y);
195
+ } catch {
196
+ }
197
+ }, p = () => {
198
+ const y = (e.rows ?? []).map((c) => e.facts(c));
199
+ return { keys: y.map((c) => c.keyText), names: y.map((c) => c.name) };
200
+ }, C = (e.rows ?? []).map((y) => {
201
+ var g;
202
+ const c = Un(y), k = e.facts(y);
173
203
  return {
174
- ...e.toRow(o),
175
- id: o.id,
176
- archived: u,
177
- status: /* @__PURE__ */ t(Ea, { kind: n, id: o.id, archived: u, base: m.status }),
204
+ ...e.toRow(y),
205
+ id: y.id,
206
+ archived: c,
207
+ group: (g = e.group) == null ? void 0 : g.call(e, y),
208
+ searchText: [k.name, k.keyText].filter(Boolean).join(" "),
209
+ status: /* @__PURE__ */ t(Ea, { kind: n, id: y.id, archived: c, base: k.status }),
178
210
  meta: /* @__PURE__ */ t(
179
- Sa,
211
+ La,
180
212
  {
181
213
  kind: n,
182
- id: o.id,
183
- archived: u,
184
- keyText: m.keyText,
185
- updatedAt: m.updatedAt,
186
- extra: m.metaExtra
214
+ id: y.id,
215
+ archived: c,
216
+ keyText: k.keyText,
217
+ updatedAt: k.updatedAt,
218
+ extra: k.metaExtra
187
219
  }
188
220
  ),
189
- menu: /* @__PURE__ */ t(Ta, { kind: n, id: o.id, name: m.name, archived: u, copy: m.copy })
221
+ menu: /* @__PURE__ */ t(
222
+ Ma,
223
+ {
224
+ kind: n,
225
+ id: y.id,
226
+ name: k.name,
227
+ archived: c,
228
+ copy: k.copy,
229
+ siblings: p,
230
+ project: e.project
231
+ }
232
+ )
190
233
  };
191
234
  });
192
235
  return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
193
236
  /* @__PURE__ */ t(
194
- nn,
237
+ rn,
195
238
  {
196
- rows: l,
197
- title: a.listTitle,
198
- icon: La[n],
199
- description: a.listDescription,
200
- emptyCopy: a.emptyCopy,
201
- newLabel: a.newLabel,
202
- openRowTitle: a.openRowTitle,
239
+ rows: C,
240
+ title: s.listTitle,
241
+ icon: xa[n],
242
+ description: s.listDescription,
243
+ emptyCopy: s.emptyCopy,
244
+ newLabel: s.newLabel,
245
+ openRowTitle: s.openRowTitle,
203
246
  testIds: {
204
- showArchived: a.showArchivedTestId,
205
- importOpen: a.importOpenTestId,
206
- archivedBadge: a.archivedBadgeTestId
247
+ showArchived: s.showArchivedTestId,
248
+ importOpen: s.importOpenTestId,
249
+ archivedBadge: s.archivedBadgeTestId
207
250
  },
251
+ groups: e.groups,
252
+ filter: o === "archived" || (h = e.groups) != null && h.some((y) => y.key === o) ? o : "all",
253
+ onFilterChange: m,
208
254
  loading: e.loading,
209
255
  error: e.error,
210
256
  onCreate: e.onCreate,
211
257
  creating: e.creating,
212
- onImport: () => s(!0),
258
+ onImport: () => a(!0),
213
259
  onOpen: e.onOpen,
214
260
  getHref: e.getHref,
215
261
  slots: e.slots
216
262
  }
217
263
  ),
218
264
  i && /* @__PURE__ */ t(
219
- On,
265
+ _n,
220
266
  {
221
267
  kind: n,
222
268
  project: e.project ?? void 0,
223
- listKeys: { functionsKey: Xt, endpointsKey: Zt, workflowsKey: Qn },
224
- onOpenImported: (o, u) => {
225
- var m;
226
- return (m = e.onOpen) == null ? void 0 : m.call(e, u);
269
+ listKeys: { functionsKey: sn, endpointsKey: an, workflowsKey: Vn },
270
+ onOpenImported: (y, c) => {
271
+ var k;
272
+ return (k = e.onOpen) == null ? void 0 : k.call(e, c);
227
273
  },
228
- onClose: () => s(!1)
274
+ onClose: () => a(!1)
229
275
  }
230
276
  ),
231
277
  e.children
232
278
  ] });
233
279
  }
234
- function Kt({ tags: e }) {
280
+ function Ot({ tags: e }) {
235
281
  return !e || e.length === 0 ? null : /* @__PURE__ */ t("span", { className: "wf-row-tags", "data-testid": "callable-row-tags", children: e.map((n) => /* @__PURE__ */ t("span", { className: "tag", children: n }, n)) });
236
282
  }
237
- function fi(e) {
238
- const n = rt(), a = ae(e.project), [i, s] = y(null);
283
+ function Ni(e) {
284
+ const n = ot(), s = se(e.project), [i, a] = f(null);
239
285
  return /* @__PURE__ */ t(
240
- Be,
286
+ We,
241
287
  {
242
288
  kind: "function",
243
289
  rows: n.data,
244
290
  loading: n.isLoading,
245
291
  error: n.error ? String(n.error) : null,
246
- project: a,
292
+ project: s,
247
293
  toRow: (l) => {
248
294
  var o;
249
295
  return {
250
296
  title: l.displayName || l.key,
251
297
  description: l.description,
252
- badges: (o = l.tags) != null && o.length || !l.valid ? /* @__PURE__ */ r(W, { children: [
253
- /* @__PURE__ */ t(Kt, { tags: l.tags }),
298
+ badges: (o = l.tags) != null && o.length || !l.valid ? /* @__PURE__ */ r(H, { children: [
299
+ /* @__PURE__ */ t(Ot, { tags: l.tags }),
254
300
  l.valid ? null : /* @__PURE__ */ t("span", { className: "w6w-callable-list-badge", children: "incomplete" })
255
301
  ] }) : null
256
302
  };
@@ -266,41 +312,47 @@ function fi(e) {
266
312
  }),
267
313
  onOpen: e.onOpen,
268
314
  getHref: e.getHref,
269
- onCreate: () => s(Pe("function")),
315
+ onCreate: () => a(Ke("function")),
270
316
  slots: e.slots,
271
317
  children: i !== null && /* @__PURE__ */ t(
272
- Yt,
318
+ Gt,
273
319
  {
274
320
  newId: i,
275
321
  takenKeys: (n.data ?? []).map((l) => l.key),
276
- onClose: () => s(null),
322
+ onClose: () => a(null),
277
323
  onCreated: (l) => {
278
324
  var o;
279
- s(null), (o = e.onCreated) == null || o.call(e, l);
325
+ a(null), (o = e.onCreated) == null || o.call(e, l);
280
326
  }
281
327
  }
282
328
  )
283
329
  }
284
330
  );
285
331
  }
286
- function yi(e) {
287
- const n = en(), a = ae(e.project), [i, s] = y(null);
332
+ const Ra = [
333
+ { key: "ready", label: "Ready" },
334
+ { key: "unfinished", label: "Unfinished" }
335
+ ];
336
+ function ki(e) {
337
+ const n = ln(), s = se(e.project), [i, a] = f(null);
288
338
  return /* @__PURE__ */ t(
289
- Be,
339
+ We,
290
340
  {
291
341
  kind: "endpoint",
292
342
  rows: n.data,
293
343
  loading: n.isLoading,
294
344
  error: n.error ? String(n.error) : null,
295
- project: a,
345
+ project: s,
346
+ groups: Ra,
347
+ group: (l) => ze(l) ? "unfinished" : "ready",
296
348
  toRow: (l) => {
297
349
  var o;
298
350
  return {
299
351
  // The draft tag sits INSIDE the title, after the name: ui `ListItem` puts `badges` in
300
352
  // a trailing `margin-left: auto` slot, which would strand it at the row's far edge.
301
- title: /* @__PURE__ */ r(W, { children: [
353
+ title: /* @__PURE__ */ r(H, { children: [
302
354
  /* @__PURE__ */ t("strong", { children: l.displayName || l.key }),
303
- tn(l) ? /* @__PURE__ */ t(
355
+ ze(l) ? /* @__PURE__ */ t(
304
356
  "span",
305
357
  {
306
358
  className: "tag warn",
@@ -311,7 +363,7 @@ function yi(e) {
311
363
  ) : null
312
364
  ] }),
313
365
  description: l.description,
314
- badges: (o = l.tags) != null && o.length ? /* @__PURE__ */ t(Kt, { tags: l.tags }) : null
366
+ badges: (o = l.tags) != null && o.length ? /* @__PURE__ */ t(Ot, { tags: l.tags }) : null
315
367
  };
316
368
  },
317
369
  facts: (l) => {
@@ -328,44 +380,50 @@ function yi(e) {
328
380
  },
329
381
  onOpen: e.onOpen,
330
382
  getHref: e.getHref,
331
- onCreate: () => s(Pe("endpoint")),
383
+ onCreate: () => a(Ke("endpoint")),
332
384
  slots: e.slots,
333
385
  children: i !== null && /* @__PURE__ */ t(
334
- Gt,
386
+ Jt,
335
387
  {
336
388
  newId: i,
337
389
  takenKeys: (n.data ?? []).map((l) => l.key),
338
- onClose: () => s(null),
390
+ onClose: () => a(null),
339
391
  onCreated: (l) => {
340
392
  var o;
341
- s(null), (o = e.onCreated) == null || o.call(e, l);
393
+ a(null), (o = e.onCreated) == null || o.call(e, l);
342
394
  }
343
395
  }
344
396
  )
345
397
  }
346
398
  );
347
399
  }
348
- function gi(e) {
349
- const n = ae(e.project), a = ft(n ?? void 0, n != null), i = jn(n ?? void 0), [s, l] = y(null);
400
+ const Pa = [
401
+ { key: "active", label: "Active" },
402
+ { key: "draft", label: "Draft" }
403
+ ];
404
+ function Ci(e) {
405
+ const n = se(e.project), s = yt(n ?? void 0, n != null), i = Bn(n ?? void 0), [a, l] = f(null);
350
406
  return /* @__PURE__ */ t(
351
- Be,
407
+ We,
352
408
  {
353
409
  kind: "workflow",
354
- rows: a.data,
355
- loading: a.isLoading,
356
- error: s ?? (a.error ? String(a.error) : null),
410
+ rows: s.data,
411
+ loading: s.isLoading,
412
+ error: a ?? (s.error ? String(s.error) : null),
357
413
  project: n,
414
+ groups: Pa,
415
+ group: (o) => o.status,
358
416
  toRow: (o) => ({
359
417
  title: o.displayName || o.name,
360
418
  description: o.description,
361
- badges: /* @__PURE__ */ t(W, { children: o.tags.length > 0 && /* @__PURE__ */ t("span", { className: "wf-row-tags", children: o.tags.map((u) => /* @__PURE__ */ t("span", { className: "tag", children: u }, u)) }) })
419
+ badges: /* @__PURE__ */ t(H, { children: o.tags.length > 0 && /* @__PURE__ */ t("span", { className: "wf-row-tags", children: o.tags.map((d) => /* @__PURE__ */ t("span", { className: "tag", children: d }, d)) }) })
362
420
  }),
363
421
  facts: (o) => ({
364
422
  name: o.displayName || o.name,
365
423
  keyText: o.key ?? o.name,
366
424
  updatedAt: o.updatedAt,
367
425
  status: o.status === "archived" ? null : /* @__PURE__ */ t(
368
- ot,
426
+ ct,
369
427
  {
370
428
  tone: o.status === "active" ? "ok" : "muted",
371
429
  "data-testid": `workflow-status-${o.id}`,
@@ -383,13 +441,13 @@ function gi(e) {
383
441
  getHref: e.getHref,
384
442
  onCreate: () => {
385
443
  l(null);
386
- const o = Yn((a.data ?? []).map((u) => u.displayName || u.name));
387
- i.mutate(Gn(Pe("workflow"), o), {
388
- onSuccess: (u) => {
444
+ const o = Jn((s.data ?? []).map((d) => d.displayName || d.name));
445
+ i.mutate(Zn(Ke("workflow"), o), {
446
+ onSuccess: (d) => {
389
447
  var m;
390
- return (m = e.onCreated) == null ? void 0 : m.call(e, u.workflow.id);
448
+ return (m = e.onCreated) == null ? void 0 : m.call(e, d.workflow.id);
391
449
  },
392
- onError: (u) => l(u instanceof Error ? u.message : String(u))
450
+ onError: (d) => l(d instanceof Error ? d.message : String(d))
393
451
  });
394
452
  },
395
453
  creating: i.isPending,
@@ -397,70 +455,70 @@ function gi(e) {
397
455
  }
398
456
  );
399
457
  }
400
- function vi({
458
+ function Ii({
401
459
  project: e,
402
460
  variant: n = "full",
403
- limit: a,
461
+ limit: s,
404
462
  days: i = 30,
405
- showChart: s,
463
+ showChart: a,
406
464
  getHref: l,
407
465
  onOpen: o,
408
- showAllHref: u,
466
+ showAllHref: d,
409
467
  onShowAll: m,
410
- slots: w
468
+ slots: p
411
469
  }) {
412
- var b, $;
413
- const N = Ke().project, h = e === void 0 ? N : e, k = h || null, p = Jn(k ?? void 0, i);
414
- let A = w == null ? void 0 : w.empty;
415
- return k ? p.isLoading ? A = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) : p.error && (A = /* @__PURE__ */ t("div", { className: "error", children: p.error.message })) : A = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see its reliability." }), /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
416
- an,
470
+ var g, S;
471
+ const C = Oe().project, h = e === void 0 ? C : e, y = h || null, c = Xn(y ?? void 0, i);
472
+ let k = p == null ? void 0 : p.empty;
473
+ return y ? c.isLoading ? k = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) : c.error && (k = /* @__PURE__ */ t("div", { className: "error", children: c.error.message })) : k = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see its reliability." }), /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
474
+ on,
417
475
  {
418
- services: k ? ((b = p.data) == null ? void 0 : b.services) ?? [] : [],
419
- window: k ? ($ = p.data) == null ? void 0 : $.window : void 0,
476
+ services: y ? ((g = c.data) == null ? void 0 : g.services) ?? [] : [],
477
+ window: y ? (S = c.data) == null ? void 0 : S.window : void 0,
420
478
  days: i,
421
479
  compact: n === "compact",
422
- showChart: s,
423
- limit: a,
480
+ showChart: a,
481
+ limit: s,
424
482
  getHref: l,
425
483
  onOpen: o,
426
- showAllHref: u,
484
+ showAllHref: d,
427
485
  onShowAll: m,
428
- slots: { ...w, empty: A }
486
+ slots: { ...p, empty: k }
429
487
  }
430
488
  ) });
431
489
  }
432
- function Ma(e) {
490
+ function Ka(e) {
433
491
  const n = e.replace(/\s+/g, " ").trim();
434
492
  return n.length > 80 ? `${n.slice(0, 80)}…` : n;
435
493
  }
436
- function bi({ project: e, onOpen: n, getHref: a, slots: i, rowSlots: s }) {
494
+ function Ai({ project: e, onOpen: n, getHref: s, slots: i, rowSlots: a }) {
437
495
  var I;
438
- const l = ae(e), o = Hn(l ?? void 0, l != null), u = zn(), [m, w] = y(null), [N, h] = y(null), [k, p] = y(null), A = (i == null ? void 0 : i.header) === void 0 ? /* @__PURE__ */ r("div", { children: [
496
+ const l = se(e), o = Yn(l ?? void 0, l != null), d = Gn(), [m, p] = f(null), [C, h] = f(null), [y, c] = f(null), k = (i == null ? void 0 : i.header) === void 0 ? /* @__PURE__ */ r("div", { children: [
439
497
  /* @__PURE__ */ t("h3", { children: "Documents" }),
440
498
  /* @__PURE__ */ t("p", { className: "muted small", children: "Each document is free-form content stored verbatim." })
441
- ] }) : i.header, b = (i == null ? void 0 : i.empty) === void 0 ? /* @__PURE__ */ t(Fe, { testId: "document-list-empty", children: "No documents yet." }) : i.empty, $ = [
499
+ ] }) : i.header, g = (i == null ? void 0 : i.empty) === void 0 ? /* @__PURE__ */ t(je, { testId: "document-list-empty", children: "No documents yet." }) : i.empty, S = [
442
500
  {
443
501
  key: "key",
444
502
  header: "Document",
445
- render: (f) => {
446
- var S;
447
- const E = (S = s == null ? void 0 : s.lead) == null ? void 0 : S.call(s, f);
503
+ render: (A) => {
504
+ var D;
505
+ const v = (D = a == null ? void 0 : a.lead) == null ? void 0 : D.call(a, A);
448
506
  return /* @__PURE__ */ r("span", { style: { display: "flex", alignItems: "center" }, children: [
449
- E,
507
+ v,
450
508
  /* @__PURE__ */ r(
451
509
  "span",
452
510
  {
453
511
  className: "list-main",
454
- style: { marginLeft: E != null ? "var(--w6w-sp-2)" : 0 },
512
+ style: { marginLeft: v != null ? "var(--w6w-sp-2)" : 0 },
455
513
  children: [
456
- /* @__PURE__ */ t("strong", { className: "list-name", title: f.key, children: f.key }),
514
+ /* @__PURE__ */ t("strong", { className: "list-name", title: A.key, children: A.key }),
457
515
  " ",
458
- /* @__PURE__ */ t("span", { className: "tag", children: f.format }),
516
+ /* @__PURE__ */ t("span", { className: "tag", children: A.format }),
459
517
  /* @__PURE__ */ r("div", { className: "muted small list-preview", children: [
460
- /* @__PURE__ */ t("code", { children: Ma(f.content) }),
461
- f.description && /* @__PURE__ */ r(W, { children: [
518
+ /* @__PURE__ */ t("code", { children: Ka(A.content) }),
519
+ A.description && /* @__PURE__ */ r(H, { children: [
462
520
  " · ",
463
- f.description
521
+ A.description
464
522
  ] })
465
523
  ] })
466
524
  ]
@@ -475,46 +533,46 @@ function bi({ project: e, onOpen: n, getHref: a, slots: i, rowSlots: s }) {
475
533
  align: "right",
476
534
  link: !1,
477
535
  actions: !0,
478
- render: (f) => {
479
- var S, C;
480
- const E = (S = s == null ? void 0 : s.footer) == null ? void 0 : S.call(s, f);
536
+ render: (A) => {
537
+ var D, $;
538
+ const v = (D = a == null ? void 0 : a.footer) == null ? void 0 : D.call(a, A);
481
539
  return (
482
540
  // Clicks here must not reach the row's onOpen.
483
541
  // biome-ignore lint/a11y/useKeyWithClickEvents: propagation guard only; the buttons inside are the controls.
484
- /* @__PURE__ */ r("div", { onClick: (Q) => Q.stopPropagation(), children: [
542
+ /* @__PURE__ */ r("div", { onClick: (j) => j.stopPropagation(), children: [
485
543
  /* @__PURE__ */ r("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)", justifyContent: "flex-end" }, children: [
486
- f.shared && ((C = s == null ? void 0 : s.sharedActions) == null ? void 0 : C.call(s, f)),
544
+ A.shared && (($ = a == null ? void 0 : a.sharedActions) == null ? void 0 : $.call(a, A)),
487
545
  /* @__PURE__ */ t(
488
- Oe,
546
+ Fe,
489
547
  {
490
- label: `Actions for ${f.key}`,
491
- "data-testid": `document-actions-${f.id}`,
548
+ label: `Actions for ${A.key}`,
549
+ "data-testid": `document-actions-${A.id}`,
492
550
  actions: [
493
551
  {
494
552
  label: "Call from code",
495
553
  icon: "code",
496
- onSelect: () => p(f.key),
497
- "data-testid": `document-code-${f.id}`
554
+ onSelect: () => c(A.key),
555
+ "data-testid": `document-code-${A.id}`
498
556
  },
499
- !f.shared && {
557
+ !A.shared && {
500
558
  label: "Edit",
501
559
  icon: "edit",
502
- onSelect: () => w({ mode: "edit", d: f }),
503
- "data-testid": `document-edit-${f.id}`
560
+ onSelect: () => p({ mode: "edit", d: A }),
561
+ "data-testid": `document-edit-${A.id}`
504
562
  },
505
- !f.shared && {
563
+ !A.shared && {
506
564
  label: "Delete",
507
565
  icon: "delete",
508
566
  danger: !0,
509
- disabled: u.isPending,
510
- onSelect: () => h(f),
511
- "data-testid": `document-delete-${f.id}`
567
+ disabled: d.isPending,
568
+ onSelect: () => h(A),
569
+ "data-testid": `document-delete-${A.id}`
512
570
  }
513
571
  ]
514
572
  }
515
573
  )
516
574
  ] }),
517
- E != null && /* @__PURE__ */ t("div", { className: "w6w-doc-footer", children: E })
575
+ v != null && /* @__PURE__ */ t("div", { className: "w6w-doc-footer", children: v })
518
576
  ] })
519
577
  );
520
578
  }
@@ -523,64 +581,64 @@ function bi({ project: e, onOpen: n, getHref: a, slots: i, rowSlots: s }) {
523
581
  return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
524
582
  /* @__PURE__ */ r("section", { className: "section", children: [
525
583
  /* @__PURE__ */ r("div", { className: "section-head", children: [
526
- A,
584
+ k,
527
585
  /* @__PURE__ */ t(
528
586
  "button",
529
587
  {
530
588
  type: "button",
531
589
  className: "btn",
532
590
  disabled: l == null,
533
- onClick: () => w({ mode: "create" }),
591
+ onClick: () => p({ mode: "create" }),
534
592
  children: "+ Add document"
535
593
  }
536
594
  )
537
595
  ] }),
538
596
  /* @__PURE__ */ r("div", { children: [
539
597
  o.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
540
- ((I = o.data) == null ? void 0 : I.length) === 0 && b,
598
+ ((I = o.data) == null ? void 0 : I.length) === 0 && g,
541
599
  o.data != null && o.data.length > 0 && /* @__PURE__ */ t(
542
600
  ke,
543
601
  {
544
- columns: $,
602
+ columns: S,
545
603
  rows: o.data,
546
- rowKey: (f) => f.id,
547
- getRowHref: a ? (f) => a(f.id) : void 0,
548
- onRowClick: n ? (f, E) => n(f.id, E) : void 0
604
+ rowKey: (A) => A.id,
605
+ getRowHref: s ? (A) => s(A.id) : void 0,
606
+ onRowClick: n ? (A, v) => n(A.id, v) : void 0
549
607
  }
550
608
  )
551
609
  ] })
552
610
  ] }),
553
611
  m && /* @__PURE__ */ t(
554
- sa,
612
+ la,
555
613
  {
556
614
  initial: m.mode === "edit" ? m.d : void 0,
557
615
  project: l,
558
- onClose: () => w(null),
559
- onSaved: () => w(null)
616
+ onClose: () => p(null),
617
+ onSaved: () => p(null)
560
618
  }
561
619
  ),
562
- k != null && /* @__PURE__ */ t(
563
- na,
620
+ y != null && /* @__PURE__ */ t(
621
+ sa,
564
622
  {
565
- resource: { kind: "document", key: k },
566
- onClose: () => p(null)
623
+ resource: { kind: "document", key: y },
624
+ onClose: () => c(null)
567
625
  }
568
626
  ),
569
- N && /* @__PURE__ */ t(
627
+ C && /* @__PURE__ */ t(
570
628
  Ce,
571
629
  {
572
630
  title: "Delete document",
573
- message: `Delete the document "${N.key}"? This cannot be undone.`,
631
+ message: `Delete the document "${C.key}"? This cannot be undone.`,
574
632
  confirmLabel: "Delete",
575
633
  onConfirm: () => {
576
- l != null && u.mutate({ id: N.id, project: l }), h(null);
634
+ l != null && d.mutate({ id: C.id, project: l }), h(null);
577
635
  },
578
636
  onClose: () => h(null)
579
637
  }
580
638
  )
581
639
  ] });
582
640
  }
583
- const xa = {
641
+ const Oa = {
584
642
  workflow: "Workflow run",
585
643
  workflow_step: "Workflow step",
586
644
  connection_test: "Connection test",
@@ -594,9 +652,9 @@ const xa = {
594
652
  workflow_adhoc: "Ad-hoc workflow run"
595
653
  };
596
654
  function Ne(e) {
597
- return xa[e] ?? e;
655
+ return Oa[e] ?? e;
598
656
  }
599
- const Ot = {
657
+ const Ft = {
600
658
  workflow: "workflow",
601
659
  workflow_step: "workflow_step",
602
660
  connection_test: "base",
@@ -608,207 +666,207 @@ const Ot = {
608
666
  // (the git source, or "(ad-hoc)") is its title.
609
667
  workflow_adhoc: "base"
610
668
  };
611
- function Ra(e) {
612
- return Object.hasOwn(Ot, e);
669
+ function Fa(e) {
670
+ return Object.hasOwn(Ft, e);
613
671
  }
614
- function Ft(e) {
615
- return Ra(e) ? Ot[e] : "base";
672
+ function jt(e) {
673
+ return Fa(e) ? Ft[e] : "base";
616
674
  }
617
- function Pa(e, n) {
618
- const a = /* @__PURE__ */ new Map();
619
- for (const s of e ?? []) {
620
- const l = s.displayName || s.key;
621
- l && a.set(s.id, l);
675
+ function ja(e, n) {
676
+ const s = /* @__PURE__ */ new Map();
677
+ for (const a of e ?? []) {
678
+ const l = a.displayName || a.key;
679
+ l && s.set(a.id, l);
622
680
  }
623
681
  const i = /* @__PURE__ */ new Map();
624
- for (const s of n ?? []) {
625
- const l = s.displayName || s.name;
626
- l && i.set(s.id, l);
682
+ for (const a of n ?? []) {
683
+ const l = a.displayName || a.name;
684
+ l && i.set(a.id, l);
627
685
  }
628
- return { functions: a, workflows: i };
686
+ return { functions: s, workflows: i };
629
687
  }
630
- function Ka(e, n) {
631
- const a = e.summary ?? Ne(e.kind), i = Ft(e.kind);
688
+ function Qa(e, n) {
689
+ const s = e.summary ?? Ne(e.kind), i = jt(e.kind);
632
690
  if (i === "function" && e.functionId !== null) {
633
- const s = n.functions.get(e.functionId);
634
- if (s !== void 0)
635
- return { text: s, target: { kind: "function", id: e.functionId } };
691
+ const a = n.functions.get(e.functionId);
692
+ if (a !== void 0)
693
+ return { text: a, target: { kind: "function", id: e.functionId } };
636
694
  }
637
695
  if (i === "workflow" && e.workflowId !== null) {
638
- const s = n.workflows.get(e.workflowId);
639
- if (s !== void 0)
640
- return { text: s, target: { kind: "workflow", id: e.workflowId } };
696
+ const a = n.workflows.get(e.workflowId);
697
+ if (a !== void 0)
698
+ return { text: a, target: { kind: "workflow", id: e.workflowId } };
641
699
  }
642
700
  if (i === "workflow_step") {
643
- const s = e.workflowId, l = s !== null ? n.workflows.get(s) : void 0, o = l ?? s ?? e.summary ?? "Unknown workflow", u = l !== void 0 && s !== null;
701
+ const a = e.workflowId, l = a !== null ? n.workflows.get(a) : void 0, o = l ?? a ?? e.summary ?? "Unknown workflow", d = l !== void 0 && a !== null;
644
702
  return {
645
703
  text: e.stepId ? `${o} - ${e.stepId}` : o,
646
- target: u ? { kind: "workflow", id: s } : null
704
+ target: d ? { kind: "workflow", id: a } : null
647
705
  };
648
706
  }
649
- return { text: a, target: null };
707
+ return { text: s, target: null };
650
708
  }
651
709
  const we = (e) => String(e).padStart(2, "0");
652
710
  function Qt(e) {
653
711
  const n = new Date(e);
654
712
  return Number.isNaN(n.getTime()) ? e : `${`${n.getFullYear()}-${we(n.getMonth() + 1)}-${we(n.getDate())}`} ${we(n.getHours())}:${we(n.getMinutes())}:${we(n.getSeconds())}`;
655
713
  }
656
- function jt(e) {
714
+ function qt(e) {
657
715
  return e == null || !Number.isFinite(e) || e < 0 ? null : e < 1e3 ? `${Math.round(e)} ms` : e < 6e4 ? `${(Math.floor(e / 100) / 10).toFixed(1)} s` : `${Math.floor(e / 6e4)}m ${Math.floor(e % 6e4 / 1e3)}s`;
658
716
  }
659
- function Oa() {
717
+ function qa() {
660
718
  const e = /* @__PURE__ */ new Date();
661
719
  return e.setHours(0, 0, 0, 0), e.toISOString();
662
720
  }
663
- function Fa(e, n) {
664
- const a = new Date(e);
665
- if (Number.isNaN(a.getTime())) return e;
666
- const i = a.toLocaleDateString(void 0, { month: "short", day: "numeric" });
721
+ function _a(e, n) {
722
+ const s = new Date(e);
723
+ if (Number.isNaN(s.getTime())) return e;
724
+ const i = s.toLocaleDateString(void 0, { month: "short", day: "numeric" });
667
725
  return n === "week" ? `Week of ${i}` : i;
668
726
  }
669
- function qt({ ok: e }) {
727
+ function _t({ ok: e }) {
670
728
  return e === null ? /* @__PURE__ */ t("span", { className: "muted", children: "–" }) : /* @__PURE__ */ t("span", { className: e ? "ok" : "error", children: e ? "✓" : "✗" });
671
729
  }
672
- function Se({ label: e, value: n }) {
730
+ function Te({ label: e, value: n }) {
673
731
  return /* @__PURE__ */ r("div", { className: "w6w-activity-card w6w-activity-stat", children: [
674
732
  /* @__PURE__ */ t("div", { className: "w6w-activity-stat-value", children: n }),
675
733
  /* @__PURE__ */ t("div", { className: "muted small", children: e })
676
734
  ] });
677
735
  }
678
- function Ze({
736
+ function et({
679
737
  title: e,
680
738
  headline: n,
681
- loading: a
739
+ loading: s
682
740
  }) {
683
741
  const i = n ?? { workflowRuns: 0, succeeded: 0, failed: 0 };
684
742
  return /* @__PURE__ */ r("section", { className: "w6w-activity-section", children: [
685
743
  /* @__PURE__ */ t("h3", { children: e }),
686
- a ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ r("div", { className: "w6w-activity-stats", children: [
687
- /* @__PURE__ */ t(Se, { label: "Workflow runs", value: i.workflowRuns }),
688
- /* @__PURE__ */ t(Se, { label: "Succeeded", value: i.succeeded }),
689
- /* @__PURE__ */ t(Se, { label: "Failed", value: i.failed })
744
+ s ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ r("div", { className: "w6w-activity-stats", children: [
745
+ /* @__PURE__ */ t(Te, { label: "Workflow runs", value: i.workflowRuns }),
746
+ /* @__PURE__ */ t(Te, { label: "Succeeded", value: i.succeeded }),
747
+ /* @__PURE__ */ t(Te, { label: "Failed", value: i.failed })
690
748
  ] })
691
749
  ] });
692
750
  }
693
- function Qa({
751
+ function Ua({
694
752
  entry: e,
695
753
  names: n,
696
- getHref: a,
754
+ getHref: s,
697
755
  onOpen: i
698
756
  }) {
699
- const { text: s, target: l } = Ka(e, n);
700
- if (l === null) return /* @__PURE__ */ t(W, { children: s });
701
- const o = i ? (u) => i(l, u) : void 0;
702
- return a ? /* @__PURE__ */ t("a", { href: a(l), onClick: o, children: s }) : o ? /* @__PURE__ */ t("button", { type: "button", className: "w6w-activity-link", onClick: o, children: s }) : /* @__PURE__ */ t(W, { children: s });
757
+ const { text: a, target: l } = Qa(e, n);
758
+ if (l === null) return /* @__PURE__ */ t(H, { children: a });
759
+ const o = i ? (d) => i(l, d) : void 0;
760
+ return s ? /* @__PURE__ */ t("a", { href: s(l), onClick: o, children: a }) : o ? /* @__PURE__ */ t("button", { type: "button", className: "w6w-activity-link", onClick: o, children: a }) : /* @__PURE__ */ t(H, { children: a });
703
761
  }
704
- function _t({ entry: e, title: n }) {
705
- const a = jt(e.durationMs);
762
+ function Ut({ entry: e, title: n }) {
763
+ const s = qt(e.durationMs);
706
764
  return /* @__PURE__ */ t(
707
- Me,
765
+ xe,
708
766
  {
709
- icon: /* @__PURE__ */ t(qt, { ok: e.ok }),
767
+ icon: /* @__PURE__ */ t(_t, { ok: e.ok }),
710
768
  title: n ?? e.summary ?? Ne(e.kind),
711
769
  subtitle: `${Ne(e.kind)} · ${Qt(e.occurredAt)}`,
712
- trailing: a === null ? void 0 : /* @__PURE__ */ t("span", { className: "muted small", children: a })
770
+ trailing: s === null ? void 0 : /* @__PURE__ */ t("span", { className: "muted small", children: s })
713
771
  }
714
772
  );
715
773
  }
716
- function Te(e) {
717
- return /* @__PURE__ */ t(_t, { entry: e.entry, title: /* @__PURE__ */ t(Qa, { ...e }) });
774
+ function Ee(e) {
775
+ return /* @__PURE__ */ t(Ut, { entry: e.entry, title: /* @__PURE__ */ t(Ua, { ...e }) });
718
776
  }
719
- const ja = {
720
- base: (e) => /* @__PURE__ */ t(_t, { entry: e.entry }),
721
- function: Te,
722
- workflow: Te,
723
- workflow_step: Te
777
+ const Va = {
778
+ base: (e) => /* @__PURE__ */ t(Ut, { entry: e.entry }),
779
+ function: Ee,
780
+ workflow: Ee,
781
+ workflow_step: Ee
724
782
  };
725
- function qa(e) {
726
- const n = ja[Ft(e.entry.kind)];
783
+ function Ba(e) {
784
+ const n = Va[jt(e.entry.kind)];
727
785
  return /* @__PURE__ */ t(n, { ...e });
728
786
  }
729
- function Ni({ getHref: e, onOpen: n, slots: a }) {
730
- var A, b, $, I, f, E;
731
- const i = Ge("today", { from: Oa(), bucket: "day" }), s = Ge("week", { bucket: "week" }), l = rt(), o = ft(), u = te(
732
- () => Pa(l.data, o.data),
787
+ function $i({ getHref: e, onOpen: n, slots: s }) {
788
+ var k, g, S, I, A, v;
789
+ const i = Ze("today", { from: qa(), bucket: "day" }), a = Ze("week", { bucket: "week" }), l = ot(), o = yt(), d = ae(
790
+ () => ja(l.data, o.data),
733
791
  [l.data, o.data]
734
- ), m = i.error ?? s.error, w = m ? m.message : null, N = ((A = s.data) == null ? void 0 : A.recent) ?? [], h = ((b = s.data) == null ? void 0 : b.series) ?? [], k = (($ = s.data) == null ? void 0 : $.range.bucket) ?? "week", p = !s.isLoading && N.length === 0 && (((I = s.data) == null ? void 0 : I.headline.workflowRuns) ?? 0) === 0;
792
+ ), m = i.error ?? a.error, p = m ? m.message : null, C = ((k = a.data) == null ? void 0 : k.recent) ?? [], h = ((g = a.data) == null ? void 0 : g.series) ?? [], y = ((S = a.data) == null ? void 0 : S.range.bucket) ?? "week", c = !a.isLoading && C.length === 0 && (((I = a.data) == null ? void 0 : I.headline.workflowRuns) ?? 0) === 0;
735
793
  return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
736
- w && /* @__PURE__ */ t("div", { className: "error", children: w }),
737
- a == null ? void 0 : a.header,
738
- a == null ? void 0 : a.actions,
794
+ p && /* @__PURE__ */ t("div", { className: "error", children: p }),
795
+ s == null ? void 0 : s.header,
796
+ s == null ? void 0 : s.actions,
739
797
  /* @__PURE__ */ t(
740
- Ze,
798
+ et,
741
799
  {
742
800
  title: "Today",
743
- headline: (f = i.data) == null ? void 0 : f.headline,
801
+ headline: (A = i.data) == null ? void 0 : A.headline,
744
802
  loading: i.isLoading
745
803
  }
746
804
  ),
747
805
  /* @__PURE__ */ t(
748
- Ze,
806
+ et,
749
807
  {
750
808
  title: "Last 7 days",
751
- headline: (E = s.data) == null ? void 0 : E.headline,
752
- loading: s.isLoading
809
+ headline: (v = a.data) == null ? void 0 : v.headline,
810
+ loading: a.isLoading
753
811
  }
754
812
  ),
755
- a == null ? void 0 : a.betweenHeadlineAndSeries,
813
+ s == null ? void 0 : s.betweenHeadlineAndSeries,
756
814
  /* @__PURE__ */ r("section", { className: "w6w-activity-section", children: [
757
815
  /* @__PURE__ */ t("h3", { children: "Activity over time" }),
758
- /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: s.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : h.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No activity in this window yet." }) : /* @__PURE__ */ t("ul", { className: "list", children: h.map((S) => /* @__PURE__ */ r("li", { children: [
816
+ /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: a.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : h.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No activity in this window yet." }) : /* @__PURE__ */ t("ul", { className: "list", children: h.map((D) => /* @__PURE__ */ r("li", { children: [
759
817
  /* @__PURE__ */ r("span", { className: "list-main", children: [
760
- /* @__PURE__ */ t("strong", { children: Fa(S.bucket, k) }),
818
+ /* @__PURE__ */ t("strong", { children: _a(D.bucket, y) }),
761
819
  " ",
762
- /* @__PURE__ */ t("span", { className: "muted small", children: Ne(S.kind) })
820
+ /* @__PURE__ */ t("span", { className: "muted small", children: Ne(D.kind) })
763
821
  ] }),
764
822
  " ",
765
- /* @__PURE__ */ t(qt, { ok: S.ok }),
823
+ /* @__PURE__ */ t(_t, { ok: D.ok }),
766
824
  " ",
767
- /* @__PURE__ */ t("span", { className: "muted small", children: S.count })
768
- ] }, `${S.bucket}-${S.kind}-${String(S.ok)}`)) }) })
825
+ /* @__PURE__ */ t("span", { className: "muted small", children: D.count })
826
+ ] }, `${D.bucket}-${D.kind}-${String(D.ok)}`)) }) })
769
827
  ] }),
770
828
  /* @__PURE__ */ r("section", { children: [
771
829
  /* @__PURE__ */ t("h3", { className: "w6w-activity-h3", children: "Recent activity" }),
772
- /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: s.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : p ? (a == null ? void 0 : a.empty) ?? /* @__PURE__ */ t("p", { className: "muted", children: "No runs yet — activity shows up here once your workflows run." }) : N.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No recent activity in this window." }) : /* @__PURE__ */ t("div", { className: "list", children: N.map((S) => /* @__PURE__ */ t(
773
- qa,
830
+ /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: a.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : c ? (s == null ? void 0 : s.empty) ?? /* @__PURE__ */ t("p", { className: "muted", children: "No runs yet — activity shows up here once your workflows run." }) : C.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No recent activity in this window." }) : /* @__PURE__ */ t("div", { className: "list", children: C.map((D) => /* @__PURE__ */ t(
831
+ Ba,
774
832
  {
775
- entry: S,
776
- names: u,
833
+ entry: D,
834
+ names: d,
777
835
  getHref: e,
778
836
  onOpen: n
779
837
  },
780
- S.id
838
+ D.id
781
839
  )) }) })
782
840
  ] })
783
841
  ] });
784
842
  }
785
- function _a(e) {
843
+ function Wa(e) {
786
844
  return e !== null && "project" in e;
787
845
  }
788
- function Ua(e) {
789
- const n = Ke().project, [a, i] = y(qn), s = e.scope !== void 0 ? e.scope : n ? { project: n } : null, l = e.filters !== void 0, o = e.filters ?? a, u = (m) => {
790
- var w;
791
- l || i(m), (w = e.onFiltersChange) == null || w.call(e, m);
846
+ function Ha(e) {
847
+ const n = Oe().project, [s, i] = f(Wn), a = e.scope !== void 0 ? e.scope : n ? { project: n } : null, l = e.filters !== void 0, o = e.filters ?? s, d = (m) => {
848
+ var p;
849
+ l || i(m), (p = e.onFiltersChange) == null || p.call(e, m);
792
850
  };
793
851
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
794
- ia,
852
+ ra,
795
853
  {
796
- scope: s,
797
- showKind: e.showKind ?? _a(s),
854
+ scope: a,
855
+ showKind: e.showKind ?? Wa(a),
798
856
  filters: o,
799
- onFiltersChange: u,
857
+ onFiltersChange: d,
800
858
  onOpenInEditor: e.onOpenInEditor
801
859
  }
802
860
  ) });
803
861
  }
804
- function Va({ title: e = "Logs", ...n }) {
862
+ function za({ title: e = "Logs", ...n }) {
805
863
  return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-logs", children: [
806
864
  e !== null && /* @__PURE__ */ t("h2", { children: e }),
807
- /* @__PURE__ */ t(Ua, { ...n })
865
+ /* @__PURE__ */ t(Ha, { ...n })
808
866
  ] });
809
867
  }
810
- const ki = Va, Ba = 1440 * 60 * 1e3;
811
- function Wa(e) {
868
+ const Si = za, Ya = 1440 * 60 * 1e3;
869
+ function Ga(e) {
812
870
  if (!(e === null || e.timeline === null))
813
871
  return e.timeline.map((n) => ({
814
872
  id: n.id,
@@ -821,39 +879,39 @@ function Wa(e) {
821
879
  link: n.link
822
880
  }));
823
881
  }
824
- function Ut(e) {
882
+ function Vt(e) {
825
883
  return e.startedAt !== void 0 && e.resolvedAt === void 0;
826
884
  }
827
- function Xe(e) {
885
+ function tt(e) {
828
886
  const n = new Date(e);
829
887
  return Number.isNaN(n.getTime()) ? e : n.toLocaleDateString("en-US", { month: "short", day: "numeric", timeZone: "UTC" });
830
888
  }
831
- function et(e, n) {
832
- const a = new Date(e).getTime();
833
- return Number.isNaN(a) ? 0 : Math.max(0, Math.floor((n - a) / Ba));
889
+ function nt(e, n) {
890
+ const s = new Date(e).getTime();
891
+ return Number.isNaN(s) ? 0 : Math.max(0, Math.floor((n - s) / Ya));
834
892
  }
835
- function Ha(e, n) {
836
- if (!Ut(e) || e.startedAt === void 0) return null;
837
- const a = et(e.startedAt, n), i = Xe(e.startedAt), s = a === 0 ? `open since ${i} (today)` : `open ${a}d (since ${i})`, l = e.updatedAt ?? e.startedAt, o = et(l, n), u = Xe(l), m = o === 0 ? `last update ${u} (today)` : `last update ${u} (${o}d ago)`;
838
- return `${s} · ${m}`;
893
+ function Ja(e, n) {
894
+ if (!Vt(e) || e.startedAt === void 0) return null;
895
+ const s = nt(e.startedAt, n), i = tt(e.startedAt), a = s === 0 ? `open since ${i} (today)` : `open ${s}d (since ${i})`, l = e.updatedAt ?? e.startedAt, o = nt(l, n), d = tt(l), m = o === 0 ? `last update ${d} (today)` : `last update ${d} (${o}d ago)`;
896
+ return `${a} · ${m}`;
839
897
  }
840
- function za(e) {
898
+ function Za(e) {
841
899
  return e ? Object.entries(e) : [];
842
900
  }
843
- function Ya(e) {
901
+ function Xa(e) {
844
902
  return e.uptime.map((n) => ({ day: n.day, state: n.state }));
845
903
  }
846
- const ue = [
904
+ const me = [
847
905
  ["e4xx", "4xx"],
848
906
  ["e429", "429 rate-limited"],
849
907
  ["eAuth", "auth (401/403)"],
850
908
  ["e5xx", "5xx"]
851
909
  ];
852
- function Vt(e) {
910
+ function Bt(e) {
853
911
  const n = new Date(e);
854
912
  return Number.isNaN(n.getTime()) ? e : n.toLocaleDateString(void 0, { month: "short", day: "numeric" });
855
913
  }
856
- function We(e) {
914
+ function He(e) {
857
915
  if (!e) return "—";
858
916
  const n = new Date(e);
859
917
  return Number.isNaN(n.getTime()) ? e : n.toLocaleString(void 0, {
@@ -863,14 +921,14 @@ function We(e) {
863
921
  minute: "2-digit"
864
922
  });
865
923
  }
866
- function ge({ label: e, value: n, hint: a }) {
924
+ function ge({ label: e, value: n, hint: s }) {
867
925
  return /* @__PURE__ */ r("div", { className: "w6w-rel-card", style: { flex: "1 1 150px", minWidth: 150 }, children: [
868
926
  /* @__PURE__ */ t("div", { style: { fontSize: "1.6rem", fontWeight: "var(--w6w-fw-semibold)", lineHeight: 1.15 }, children: n }),
869
927
  /* @__PURE__ */ t("div", { className: "muted small", children: e }),
870
- a && /* @__PURE__ */ t("div", { className: "muted small", children: a })
928
+ s && /* @__PURE__ */ t("div", { className: "muted small", children: s })
871
929
  ] });
872
930
  }
873
- function Ga({
931
+ function es({
874
932
  vendor: e,
875
933
  displayName: n
876
934
  }) {
@@ -887,25 +945,25 @@ function Ga({
887
945
  ", not a gap in the data above."
888
946
  ] })
889
947
  ] });
890
- const a = e.state === "unknown", i = za(e.components), s = (e.timeline ?? []).filter(Ut), l = Date.now();
948
+ const s = e.state === "unknown", i = Za(e.components), a = (e.timeline ?? []).filter(Vt), l = Date.now();
891
949
  return /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
892
950
  /* @__PURE__ */ r("h4", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
893
951
  n,
894
952
  " status",
895
953
  " ",
896
- /* @__PURE__ */ t(be, { state: e.state, label: a ? "Unavailable" : void 0 })
954
+ /* @__PURE__ */ t(ve, { state: e.state, label: s ? "Unavailable" : void 0 })
897
955
  ] }),
898
- a && /* @__PURE__ */ t("p", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "We could not get a status from this API, so we cannot say whether it is up. That is separate from your own calls above, which are measured here regardless." }),
956
+ s && /* @__PURE__ */ t("p", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "We could not get a status from this API, so we cannot say whether it is up. That is separate from your own calls above, which are measured here regardless." }),
899
957
  e.message && /* @__PURE__ */ t(
900
958
  "p",
901
959
  {
902
- className: a ? "muted small" : void 0,
960
+ className: s ? "muted small" : void 0,
903
961
  style: { margin: "0 0 var(--w6w-sp-2)" },
904
962
  children: e.message
905
963
  }
906
964
  ),
907
965
  /* @__PURE__ */ r("p", { className: "muted small", style: { margin: 0 }, children: [
908
- a ? "Tried to read" : "Read from",
966
+ s ? "Tried to read" : "Read from",
909
967
  " ",
910
968
  n,
911
969
  "'s own status page — what",
@@ -913,24 +971,24 @@ function Ga({
913
971
  n,
914
972
  " says about itself, not what your calls did · last checked",
915
973
  " ",
916
- We(e.checkedAt),
917
- e.attributedTo.length > 0 && /* @__PURE__ */ r(W, { children: [
974
+ He(e.checkedAt),
975
+ e.attributedTo.length > 0 && /* @__PURE__ */ r(H, { children: [
918
976
  " ",
919
977
  "· decided by",
920
978
  " ",
921
979
  e.attributedTo.map((o) => /* @__PURE__ */ t("code", { children: o }, o))
922
980
  ] })
923
981
  ] }),
924
- i.length > 0 && /* @__PURE__ */ t("div", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: i.map(([o, u]) => /* @__PURE__ */ r("span", { className: "w6w-rel-tag", children: [
982
+ i.length > 0 && /* @__PURE__ */ t("div", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: i.map(([o, d]) => /* @__PURE__ */ r("span", { className: "w6w-rel-tag", children: [
925
983
  o,
926
984
  ": ",
927
- u.state
985
+ d.state
928
986
  ] }, o)) }),
929
- s.length > 0 && /* @__PURE__ */ t("ul", { className: "list", style: { margin: "var(--w6w-sp-2) 0 0" }, children: s.map((o) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ r("div", { className: "list-main", children: [
987
+ a.length > 0 && /* @__PURE__ */ t("ul", { className: "list", style: { margin: "var(--w6w-sp-2) 0 0" }, children: a.map((o) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ r("div", { className: "list-main", children: [
930
988
  /* @__PURE__ */ t("strong", { children: o.title }),
931
989
  " ",
932
- /* @__PURE__ */ t(be, { state: o.state }),
933
- /* @__PURE__ */ t("div", { className: "muted small", children: Ha(o, l) })
990
+ /* @__PURE__ */ t(ve, { state: o.state }),
991
+ /* @__PURE__ */ t("div", { className: "muted small", children: Ja(o, l) })
934
992
  ] }) }, o.id ?? o.title)) }),
935
993
  e.statusPageUrl !== null && /* @__PURE__ */ t("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: /* @__PURE__ */ r("a", { href: e.statusPageUrl, target: "_blank", rel: "noopener noreferrer", children: [
936
994
  n,
@@ -938,10 +996,10 @@ function Ga({
938
996
  ] }) })
939
997
  ] });
940
998
  }
941
- function Ja({ service: e }) {
999
+ function ts({ service: e }) {
942
1000
  if (e.calls === 0)
943
1001
  return /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t("span", { className: "w6w-rel-idle-note", children: "No calls in this window" }) });
944
- const n = e.uptime, a = Math.max(1, ...n.map((i) => i.calls));
1002
+ const n = e.uptime, s = Math.max(1, ...n.map((i) => i.calls));
945
1003
  return /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
946
1004
  /* @__PURE__ */ t(
947
1005
  "div",
@@ -953,8 +1011,8 @@ function Ja({ service: e }) {
953
1011
  "span",
954
1012
  {
955
1013
  className: `rel-daily-bar rel-daily-bar-${i.state}`,
956
- style: { height: `${i.calls > 0 ? Math.max(i.calls / a * 100, 4) : 2}%` },
957
- title: `${Vt(`${i.day}T00:00:00.000Z`)} — ${i.calls} calls, ${i.state}`
1014
+ style: { height: `${i.calls > 0 ? Math.max(i.calls / s * 100, 4) : 2}%` },
1015
+ title: `${Bt(`${i.day}T00:00:00.000Z`)} — ${i.calls} calls, ${i.state}`
958
1016
  },
959
1017
  i.day
960
1018
  ))
@@ -963,18 +1021,18 @@ function Ja({ service: e }) {
963
1021
  /* @__PURE__ */ t("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: "Calls per day, oldest first. Bar colour is that day's own state." })
964
1022
  ] });
965
1023
  }
966
- function Za({
1024
+ function ns({
967
1025
  service: e,
968
1026
  window: n
969
1027
  }) {
970
- const a = [...e.uptime].reverse().filter((o) => o.calls > 0), i = e.vendorStatus, s = Wa(i), l = s === void 0 ? `${e.displayName} publishes no incident history.` : `No incidents from ${e.displayName} in this window.`;
1028
+ const s = [...e.uptime].reverse().filter((o) => o.calls > 0), i = e.vendorStatus, a = Ga(i), l = a === void 0 ? `${e.displayName} publishes no incident history.` : `No incidents from ${e.displayName} in this window.`;
971
1029
  return /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
972
1030
  /* @__PURE__ */ t(
973
- sn,
1031
+ cn,
974
1032
  {
975
1033
  window: n,
976
- days: Ya(e),
977
- incidents: s,
1034
+ days: Xa(e),
1035
+ incidents: a,
978
1036
  vendorEmptyLabel: l,
979
1037
  ariaLabel: `${e.displayName}, ${e.uptime.length}-day status and ${e.displayName} incidents, oldest day first`
980
1038
  }
@@ -984,45 +1042,45 @@ function Za({
984
1042
  /* @__PURE__ */ t("code", { children: "unknown" }),
985
1043
  " — never a quiet green."
986
1044
  ] }),
987
- a.length > 0 && /* @__PURE__ */ t("div", { className: "list", style: { marginTop: "var(--w6w-sp-3)" }, children: a.slice(0, 14).map((o) => /* @__PURE__ */ r("div", { className: "rel-day-row", children: [
988
- /* @__PURE__ */ t("span", { style: { minWidth: 96 }, children: /* @__PURE__ */ t("strong", { children: Vt(`${o.day}T00:00:00.000Z`) }) }),
989
- /* @__PURE__ */ t(be, { state: o.state }),
1045
+ s.length > 0 && /* @__PURE__ */ t("div", { className: "list", style: { marginTop: "var(--w6w-sp-3)" }, children: s.slice(0, 14).map((o) => /* @__PURE__ */ r("div", { className: "rel-day-row", children: [
1046
+ /* @__PURE__ */ t("span", { style: { minWidth: 96 }, children: /* @__PURE__ */ t("strong", { children: Bt(`${o.day}T00:00:00.000Z`) }) }),
1047
+ /* @__PURE__ */ t(ve, { state: o.state }),
990
1048
  /* @__PURE__ */ r("span", { className: "muted small", children: [
991
1049
  o.calls,
992
1050
  " calls"
993
1051
  ] }),
994
- /* @__PURE__ */ t("span", { className: "rel-errors", children: ue.filter(([u]) => o.errors[u] > 0).map(([u, m]) => /* @__PURE__ */ r("span", { className: "w6w-rel-tag", children: [
1052
+ /* @__PURE__ */ t("span", { className: "rel-errors", children: me.filter(([d]) => o.errors[d] > 0).map(([d, m]) => /* @__PURE__ */ r("span", { className: "w6w-rel-tag", children: [
995
1053
  m,
996
1054
  " ×",
997
- o.errors[u]
998
- ] }, u)) })
1055
+ o.errors[d]
1056
+ ] }, d)) })
999
1057
  ] }, o.day)) })
1000
1058
  ] });
1001
1059
  }
1002
- function Xa({ errors: e }) {
1003
- if (ue.reduce((i, [s]) => i + e[s], 0) === 0)
1060
+ function as({ errors: e }) {
1061
+ if (me.reduce((i, [a]) => i + e[a], 0) === 0)
1004
1062
  return /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t("p", { className: "muted", style: { margin: 0 }, children: "No errors in this window." }) });
1005
- const a = Math.max(1, ...ue.map(([i]) => e[i]));
1006
- return /* @__PURE__ */ t("div", { className: "w6w-rel-card rel-errormix-chart", children: ue.map(([i, s]) => /* @__PURE__ */ r("div", { className: "rel-errormix-row", children: [
1007
- /* @__PURE__ */ t("span", { className: "muted small", children: s }),
1063
+ const s = Math.max(1, ...me.map(([i]) => e[i]));
1064
+ return /* @__PURE__ */ t("div", { className: "w6w-rel-card rel-errormix-chart", children: me.map(([i, a]) => /* @__PURE__ */ r("div", { className: "rel-errormix-row", children: [
1065
+ /* @__PURE__ */ t("span", { className: "muted small", children: a }),
1008
1066
  /* @__PURE__ */ t("span", { className: "rel-errormix-track", children: /* @__PURE__ */ t(
1009
1067
  "span",
1010
1068
  {
1011
1069
  className: "rel-errormix-bar",
1012
- style: { width: `${Math.max(e[i] / a * 100, e[i] > 0 ? 2 : 0)}%` }
1070
+ style: { width: `${Math.max(e[i] / s * 100, e[i] > 0 ? 2 : 0)}%` }
1013
1071
  }
1014
1072
  ) }),
1015
1073
  /* @__PURE__ */ t("span", { className: "rel-errormix-value small", children: e[i] })
1016
1074
  ] }, i)) });
1017
1075
  }
1018
- function es({ project: e, appId: n }) {
1019
- const a = Xn(e, n, { limit: 50 });
1020
- if (a.isLoading) return /* @__PURE__ */ t("p", { className: "muted", children: "Loading calls…" });
1021
- if (a.error) {
1022
- const s = a.error;
1023
- return /* @__PURE__ */ t("div", { className: "error", children: (s instanceof gt, s.message) });
1076
+ function ss({ project: e, appId: n }) {
1077
+ const s = ta(e, n, { limit: 50 });
1078
+ if (s.isLoading) return /* @__PURE__ */ t("p", { className: "muted", children: "Loading calls…" });
1079
+ if (s.error) {
1080
+ const a = s.error;
1081
+ return /* @__PURE__ */ t("div", { className: "error", children: (a instanceof bt, a.message) });
1024
1082
  }
1025
- const i = a.data ?? [];
1083
+ const i = s.data ?? [];
1026
1084
  return i.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No calls captured for this service. Calls appear here once a workflow, function or ad-hoc invoke reaches it." }) : /* @__PURE__ */ r("div", { className: "rel-calls", children: [
1027
1085
  /* @__PURE__ */ r("div", { className: "rel-call rel-call-head", children: [
1028
1086
  /* @__PURE__ */ t("span", { children: "When" }),
@@ -1031,47 +1089,47 @@ function es({ project: e, appId: n }) {
1031
1089
  /* @__PURE__ */ t("span", { children: "Status" }),
1032
1090
  /* @__PURE__ */ t("span", { children: "Took" })
1033
1091
  ] }),
1034
- i.map((s, l) => /* @__PURE__ */ r("div", { className: "rel-call", children: [
1035
- /* @__PURE__ */ t("span", { className: "muted small", children: We(s.createdAt) }),
1036
- /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t("code", { children: s.actionKey ?? "—" }) }),
1037
- /* @__PURE__ */ t("span", { className: "muted small", children: s.method }),
1038
- /* @__PURE__ */ t("span", { className: s.status >= 400 || s.status === 0 ? "error" : "ok", children: s.status === 0 ? "no response" : s.status }),
1039
- /* @__PURE__ */ t("span", { className: "muted small", children: s.durationMs != null ? `${s.durationMs} ms` : "—" })
1040
- ] }, s.id ?? `${s.createdAt}-${l}`))
1092
+ i.map((a, l) => /* @__PURE__ */ r("div", { className: "rel-call", children: [
1093
+ /* @__PURE__ */ t("span", { className: "muted small", children: He(a.createdAt) }),
1094
+ /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t("code", { children: a.actionKey ?? "—" }) }),
1095
+ /* @__PURE__ */ t("span", { className: "muted small", children: a.method }),
1096
+ /* @__PURE__ */ t("span", { className: a.status >= 400 || a.status === 0 ? "error" : "ok", children: a.status === 0 ? "no response" : a.status }),
1097
+ /* @__PURE__ */ t("span", { className: "muted small", children: a.durationMs != null ? `${a.durationMs} ms` : "—" })
1098
+ ] }, a.id ?? `${a.createdAt}-${l}`))
1041
1099
  ] });
1042
1100
  }
1043
- function ts({
1101
+ function is({
1044
1102
  backHref: e,
1045
1103
  onBack: n
1046
1104
  }) {
1047
1105
  return e !== void 0 ? /* @__PURE__ */ t("p", { children: /* @__PURE__ */ t("a", { href: e, onClick: n, children: "← Back to all services" }) }) : n ? /* @__PURE__ */ t("p", { children: /* @__PURE__ */ t("button", { type: "button", className: "list-link", onClick: n, children: "← Back to all services" }) }) : null;
1048
1106
  }
1049
- function Ci({
1107
+ function Di({
1050
1108
  appId: e,
1051
1109
  project: n,
1052
- days: a = 30,
1110
+ days: s = 30,
1053
1111
  backHref: i,
1054
- onBack: s,
1112
+ onBack: a,
1055
1113
  slots: l
1056
1114
  }) {
1057
- var k, p, A, b;
1058
- const o = Ke().project, u = (n === void 0 ? o : n) || void 0, m = Zn(u, [e], a), w = m.error, N = w ? (w instanceof gt, w.message) : null, h = (k = m.data) == null ? void 0 : k.services.find(($) => $.appId === e);
1115
+ var y, c, k, g;
1116
+ const o = Oe().project, d = (n === void 0 ? o : n) || void 0, m = ea(d, [e], s), p = m.error, C = p ? (p instanceof bt, p.message) : null, h = (y = m.data) == null ? void 0 : y.services.find((S) => S.appId === e);
1059
1117
  return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
1060
1118
  l == null ? void 0 : l.header,
1061
1119
  l == null ? void 0 : l.actions,
1062
- !u && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see this service." }),
1063
- N && /* @__PURE__ */ t("div", { className: "error", children: N }),
1064
- u && m.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1120
+ !d && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see this service." }),
1121
+ C && /* @__PURE__ */ t("div", { className: "error", children: C }),
1122
+ d && m.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1065
1123
  m.data && !h && /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
1066
1124
  (l == null ? void 0 : l.empty) ?? /* @__PURE__ */ r("p", { className: "muted", children: [
1067
1125
  /* @__PURE__ */ t("code", { children: e }),
1068
1126
  " is not used by this project's definitions and has no calls in the last ",
1069
- a,
1127
+ s,
1070
1128
  " days."
1071
1129
  ] }),
1072
- /* @__PURE__ */ t(ts, { backHref: i, onBack: s })
1130
+ /* @__PURE__ */ t(is, { backHref: i, onBack: a })
1073
1131
  ] }),
1074
- h && /* @__PURE__ */ r(W, { children: [
1132
+ h && /* @__PURE__ */ r(H, { children: [
1075
1133
  /* @__PURE__ */ r("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
1076
1134
  /* @__PURE__ */ r(
1077
1135
  "div",
@@ -1083,7 +1141,7 @@ function Ci({
1083
1141
  marginBottom: "var(--w6w-sp-3)"
1084
1142
  },
1085
1143
  children: [
1086
- /* @__PURE__ */ t(be, { state: h.state }),
1144
+ /* @__PURE__ */ t(ve, { state: h.state }),
1087
1145
  /* @__PURE__ */ t("span", { className: "muted small", children: "from your calls" }),
1088
1146
  /* @__PURE__ */ t("code", { className: "muted small", children: h.appId }),
1089
1147
  h.ongoingOutageId && /* @__PURE__ */ t("span", { className: "w6w-rel-tag", children: "outage still open" })
@@ -1100,38 +1158,38 @@ function Ci({
1100
1158
  hint: h.p95Ms === null ? "no timed calls" : void 0
1101
1159
  }
1102
1160
  ),
1103
- /* @__PURE__ */ t(ge, { label: "Last call", value: We(h.lastCallAt) }),
1161
+ /* @__PURE__ */ t(ge, { label: "Last call", value: He(h.lastCallAt) }),
1104
1162
  /* @__PURE__ */ t(
1105
1163
  ge,
1106
1164
  {
1107
1165
  label: "Errors",
1108
- value: String(ue.reduce(($, [I]) => $ + h.errors[I], 0)),
1109
- hint: ue.filter(([$]) => h.errors[$] > 0).map(([$, I]) => `${I} ×${h.errors[$]}`).join(" · ") || "none"
1166
+ value: String(me.reduce((S, [I]) => S + h.errors[I], 0)),
1167
+ hint: me.filter(([S]) => h.errors[S] > 0).map(([S, I]) => `${I} ×${h.errors[S]}`).join(" · ") || "none"
1110
1168
  }
1111
1169
  )
1112
1170
  ] })
1113
1171
  ] }),
1114
1172
  /* @__PURE__ */ r("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
1115
1173
  /* @__PURE__ */ t("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "Error mix" }),
1116
- /* @__PURE__ */ t(Xa, { errors: h.errors })
1174
+ /* @__PURE__ */ t(as, { errors: h.errors })
1117
1175
  ] }),
1118
1176
  /* @__PURE__ */ r("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
1119
1177
  /* @__PURE__ */ t("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "API status" }),
1120
- /* @__PURE__ */ t(Ga, { vendor: h.vendorStatus, displayName: h.displayName })
1178
+ /* @__PURE__ */ t(es, { vendor: h.vendorStatus, displayName: h.displayName })
1121
1179
  ] }),
1122
1180
  /* @__PURE__ */ r("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
1123
1181
  /* @__PURE__ */ r("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
1124
1182
  "Last ",
1125
- ((p = m.data) == null ? void 0 : p.window.days) ?? a,
1183
+ ((c = m.data) == null ? void 0 : c.window.days) ?? s,
1126
1184
  " days",
1127
1185
  " ",
1128
1186
  /* @__PURE__ */ r("span", { className: "muted small", children: [
1129
1187
  "uptime means ",
1130
- (A = m.data) == null ? void 0 : A.uptimeMeans
1188
+ (k = m.data) == null ? void 0 : k.uptimeMeans
1131
1189
  ] })
1132
1190
  ] }),
1133
- /* @__PURE__ */ t(Za, { service: h, window: ((b = m.data) == null ? void 0 : b.window) ?? { from: "", to: "" } }),
1134
- /* @__PURE__ */ t(Ja, { service: h })
1191
+ /* @__PURE__ */ t(ns, { service: h, window: ((g = m.data) == null ? void 0 : g.window) ?? { from: "", to: "" } }),
1192
+ /* @__PURE__ */ t(ts, { service: h })
1135
1193
  ] }),
1136
1194
  /* @__PURE__ */ r("section", { children: [
1137
1195
  /* @__PURE__ */ r("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
@@ -1139,32 +1197,32 @@ function Ci({
1139
1197
  " ",
1140
1198
  /* @__PURE__ */ t("span", { className: "muted small", children: "the requests behind the numbers above" })
1141
1199
  ] }),
1142
- /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t(es, { project: u, appId: h.appId }) })
1200
+ /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t(ss, { project: d, appId: h.appId }) })
1143
1201
  ] })
1144
1202
  ] })
1145
1203
  ] });
1146
1204
  }
1147
- function ns(e) {
1205
+ function ls(e) {
1148
1206
  if (typeof e == "string") return e;
1149
1207
  if (e && typeof e == "object") {
1150
1208
  const n = e;
1151
- for (const a of ["stepId", "step", "id", "nodeId", "key"])
1152
- if (typeof n[a] == "string") return n[a];
1209
+ for (const s of ["stepId", "step", "id", "nodeId", "key"])
1210
+ if (typeof n[s] == "string") return n[s];
1153
1211
  }
1154
1212
  return String(e);
1155
1213
  }
1156
- function as({
1214
+ function rs({
1157
1215
  routes: e,
1158
1216
  projectId: n
1159
1217
  }) {
1160
- const [a, i] = y(null), s = e.find((l) => l.id === a);
1161
- return e.length === 0 ? null : /* @__PURE__ */ r(W, { children: [
1218
+ const [s, i] = f(null), a = e.find((l) => l.id === s);
1219
+ return e.length === 0 ? null : /* @__PURE__ */ r(H, { children: [
1162
1220
  /* @__PURE__ */ t("ul", { className: "list small", "data-testid": "connection-dependent-routes", children: e.map((l) => /* @__PURE__ */ r("li", { "data-testid": `connection-dependent-route-${l.id}`, children: [
1163
1221
  /* @__PURE__ */ t("span", { className: "badge", children: "route" }),
1164
1222
  " ",
1165
1223
  /* @__PURE__ */ t("span", { children: l.name }),
1166
1224
  " ",
1167
- l.status === "broken" && /* @__PURE__ */ r(W, { children: [
1225
+ l.status === "broken" && /* @__PURE__ */ r(H, { children: [
1168
1226
  /* @__PURE__ */ t("span", { className: "tag warn", children: "broken" }),
1169
1227
  " ",
1170
1228
  /* @__PURE__ */ t(
@@ -1179,156 +1237,156 @@ function as({
1179
1237
  )
1180
1238
  ] })
1181
1239
  ] }, l.id)) }),
1182
- s != null && /* @__PURE__ */ t(
1183
- ss,
1240
+ a != null && /* @__PURE__ */ t(
1241
+ os,
1184
1242
  {
1185
- routeId: s.id,
1186
- projectId: s.project ?? n,
1243
+ routeId: a.id,
1244
+ projectId: a.project ?? n,
1187
1245
  onDone: () => i(null)
1188
1246
  }
1189
1247
  )
1190
1248
  ] });
1191
1249
  }
1192
- function ss(e) {
1250
+ function os(e) {
1193
1251
  return /* @__PURE__ */ r("div", { "data-testid": "connection-route-reconnect-host", children: [
1194
- /* @__PURE__ */ t(oa, { projectId: e.projectId, initialEditRouteId: e.routeId }),
1252
+ /* @__PURE__ */ t(da, { projectId: e.projectId, initialEditRouteId: e.routeId }),
1195
1253
  /* @__PURE__ */ t("button", { type: "button", className: "btn link", onClick: e.onDone, children: "Done" })
1196
1254
  ] });
1197
1255
  }
1198
- function Bt({
1256
+ function Wt({
1199
1257
  callables: e,
1200
1258
  onOpenCallable: n,
1201
- routes: a,
1259
+ routes: s,
1202
1260
  projectId: i
1203
1261
  }) {
1204
- return /* @__PURE__ */ r(W, { children: [
1205
- /* @__PURE__ */ t(as, { routes: a ?? [], projectId: i }),
1206
- /* @__PURE__ */ t(is, { callables: e, onOpenCallable: n })
1262
+ return /* @__PURE__ */ r(H, { children: [
1263
+ /* @__PURE__ */ t(rs, { routes: s ?? [], projectId: i }),
1264
+ /* @__PURE__ */ t(cs, { callables: e, onOpenCallable: n })
1207
1265
  ] });
1208
1266
  }
1209
- function is({
1267
+ function cs({
1210
1268
  callables: e,
1211
1269
  onOpenCallable: n
1212
1270
  }) {
1213
- return /* @__PURE__ */ t("ul", { className: "list small", children: e.map((a) => {
1214
- const i = a.displayName || a.key || a.id, s = a.sites.map(ns);
1271
+ return /* @__PURE__ */ t("ul", { className: "list small", children: e.map((s) => {
1272
+ const i = s.displayName || s.key || s.id, a = s.sites.map(ls);
1215
1273
  return /* @__PURE__ */ r("li", { children: [
1216
- /* @__PURE__ */ t("span", { className: "badge", children: a.kind }),
1274
+ /* @__PURE__ */ t("span", { className: "badge", children: s.kind }),
1217
1275
  " ",
1218
1276
  n ? /* @__PURE__ */ t(
1219
1277
  "button",
1220
1278
  {
1221
1279
  type: "button",
1222
1280
  className: "btn link",
1223
- onClick: () => n(a.kind, a.id),
1281
+ onClick: () => n(s.kind, s.id),
1224
1282
  children: i
1225
1283
  }
1226
1284
  ) : /* @__PURE__ */ t("span", { children: i }),
1227
- !a.enabled && /* @__PURE__ */ t("span", { className: "muted", children: " (disabled)" }),
1228
- s.length > 0 && /* @__PURE__ */ r("span", { className: "muted", children: [
1285
+ !s.enabled && /* @__PURE__ */ t("span", { className: "muted", children: " (disabled)" }),
1286
+ a.length > 0 && /* @__PURE__ */ r("span", { className: "muted", children: [
1229
1287
  " · ",
1230
- s.join(", ")
1288
+ a.join(", ")
1231
1289
  ] })
1232
- ] }, `${a.kind}:${a.id}`);
1290
+ ] }, `${s.kind}:${s.id}`);
1233
1291
  }) });
1234
1292
  }
1235
- const ls = [];
1236
- function Ii({
1293
+ const ds = [];
1294
+ function Ti({
1237
1295
  onOpen: e,
1238
1296
  getHref: n,
1239
- addLabel: a,
1297
+ addLabel: s,
1240
1298
  slots: i,
1241
- onOpenCallable: s,
1299
+ onOpenCallable: a,
1242
1300
  onCreateSharedCredential: l
1243
1301
  }) {
1244
- var x, R;
1245
- const o = ct(), u = de(), m = qe(), N = m.data ?? ls, h = te(() => dt(N), [N]), { byId: k } = je(h), p = vt(), [A, b] = y(!1), [$, I] = y(null), [f, E] = y(null), S = ae(void 0), C = bt((f == null ? void 0 : f.id) ?? "", f !== null), Q = typeof o.updateConnection == "function", P = i && "actions" in i ? i.actions : /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", onClick: () => b(!0), children: a ?? "+ Add connection" });
1302
+ var x, P;
1303
+ const o = dt(), d = ue(), m = _e(), C = m.data ?? ds, h = ae(() => ut(C), [C]), { byId: y } = qe(h), c = vt(), [k, g] = f(!1), [S, I] = f(null), [A, v] = f(null), D = se(void 0), $ = Nt((A == null ? void 0 : A.id) ?? "", A !== null), j = typeof o.updateConnection == "function", R = i && "actions" in i ? i.actions : /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", onClick: () => g(!0), children: s ?? "+ Add connection" });
1246
1304
  return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
1247
1305
  /* @__PURE__ */ t(
1248
- ln,
1306
+ dn,
1249
1307
  {
1250
- connections: N,
1251
- appsById: k,
1308
+ connections: C,
1309
+ appsById: y,
1252
1310
  loading: m.isLoading,
1253
1311
  error: m.error ? m.error.message : null,
1254
1312
  onOpen: e,
1255
1313
  getHref: n,
1256
- onEdit: Q ? I : void 0,
1257
- onDelete: E,
1258
- busy: p.isPending,
1259
- slots: { ...i, actions: P }
1314
+ onEdit: j ? I : void 0,
1315
+ onDelete: v,
1316
+ busy: c.isPending,
1317
+ slots: { ...i, actions: R }
1260
1318
  }
1261
1319
  ),
1262
- A && /* @__PURE__ */ t(
1263
- rn,
1320
+ k && /* @__PURE__ */ t(
1321
+ un,
1264
1322
  {
1265
1323
  onCreateSharedCredential: l,
1266
- onClose: () => b(!1),
1324
+ onClose: () => g(!1),
1267
1325
  onCreated: () => {
1268
- b(!1), u.invalidateQueries({ queryKey: ce });
1326
+ g(!1), d.invalidateQueries({ queryKey: de });
1269
1327
  }
1270
1328
  }
1271
1329
  ),
1272
- $ && /* @__PURE__ */ t(
1273
- ut,
1330
+ S && /* @__PURE__ */ t(
1331
+ mt,
1274
1332
  {
1275
- connection: $,
1333
+ connection: S,
1276
1334
  onClose: () => I(null),
1277
1335
  onSaved: () => {
1278
- const j = $.id;
1279
- I(null), u.invalidateQueries({ queryKey: ce }), u.invalidateQueries({ queryKey: Re(j) });
1336
+ const _ = S.id;
1337
+ I(null), d.invalidateQueries({ queryKey: de }), d.invalidateQueries({ queryKey: Pe(_) });
1280
1338
  }
1281
1339
  }
1282
1340
  ),
1283
- f && /* @__PURE__ */ t(
1284
- rs,
1341
+ A && /* @__PURE__ */ t(
1342
+ us,
1285
1343
  {
1286
- name: f.displayName || f.id,
1287
- loading: C.isLoading,
1288
- callables: C.isError ? [] : ((x = C.data) == null ? void 0 : x.callables) ?? [],
1289
- routes: C.isError ? [] : ((R = C.data) == null ? void 0 : R.routes) ?? [],
1290
- projectId: S,
1291
- onOpenCallable: s,
1292
- onClose: () => E(null),
1344
+ name: A.displayName || A.id,
1345
+ loading: $.isLoading,
1346
+ callables: $.isError ? [] : ((x = $.data) == null ? void 0 : x.callables) ?? [],
1347
+ routes: $.isError ? [] : ((P = $.data) == null ? void 0 : P.routes) ?? [],
1348
+ projectId: D,
1349
+ onOpenCallable: a,
1350
+ onClose: () => v(null),
1293
1351
  onConfirm: () => {
1294
- const j = f.id;
1295
- E(null), p.mutate({ id: j, force: !0 });
1352
+ const _ = A.id;
1353
+ v(null), c.mutate({ id: _, force: !0 });
1296
1354
  }
1297
1355
  }
1298
1356
  )
1299
1357
  ] });
1300
1358
  }
1301
- function rs({
1359
+ function us({
1302
1360
  name: e,
1303
1361
  loading: n,
1304
- callables: a,
1362
+ callables: s,
1305
1363
  routes: i,
1306
- projectId: s,
1364
+ projectId: a,
1307
1365
  onOpenCallable: l,
1308
1366
  onClose: o,
1309
- onConfirm: u
1367
+ onConfirm: d
1310
1368
  }) {
1311
- const m = a.length, w = i.length, N = m + w, h = `Delete the connection "${e}"? This cannot be undone.`, k = (b, $, I) => `${b} ${b === 1 ? $ : I}`, p = [
1312
- m > 0 ? k(m, "callable", "callables") : null,
1313
- w > 0 ? k(w, "model route", "model routes") : null
1314
- ].filter(Boolean).join(" and "), A = [
1369
+ const m = s.length, p = i.length, C = m + p, h = `Delete the connection "${e}"? This cannot be undone.`, y = (g, S, I) => `${g} ${g === 1 ? S : I}`, c = [
1370
+ m > 0 ? y(m, "callable", "callables") : null,
1371
+ p > 0 ? y(p, "model route", "model routes") : null
1372
+ ].filter(Boolean).join(" and "), k = [
1315
1373
  m > 0 ? `Deleting disables ${m === 1 ? "this callable" : `these ${m} callables`} until you reconnect ${m === 1 ? "it" : "them"}.` : null,
1316
- w > 0 ? `${w === 1 ? "The model route becomes" : `The ${w} model routes become`} broken until ${w === 1 ? "it is" : "they are"} pointed at another connection.` : null
1317
- ].filter((b) => b != null);
1318
- return /* @__PURE__ */ r(on, { title: "Delete connection", onClose: o, children: [
1374
+ p > 0 ? `${p === 1 ? "The model route becomes" : `The ${p} model routes become`} broken until ${p === 1 ? "it is" : "they are"} pointed at another connection.` : null
1375
+ ].filter((g) => g != null);
1376
+ return /* @__PURE__ */ r(mn, { title: "Delete connection", onClose: o, children: [
1319
1377
  /* @__PURE__ */ r("div", { className: "w6w-modal-body", children: [
1320
- /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: N === 0 ? h : `Delete the connection "${e}"? Used by ${p}.` }),
1321
- N > 0 && /* @__PURE__ */ r(W, { children: [
1378
+ /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: C === 0 ? h : `Delete the connection "${e}"? Used by ${c}.` }),
1379
+ C > 0 && /* @__PURE__ */ r(H, { children: [
1322
1380
  /* @__PURE__ */ t(
1323
- Bt,
1381
+ Wt,
1324
1382
  {
1325
- callables: a,
1383
+ callables: s,
1326
1384
  routes: i,
1327
- projectId: s,
1385
+ projectId: a,
1328
1386
  onOpenCallable: l
1329
1387
  }
1330
1388
  ),
1331
- /* @__PURE__ */ t("p", { className: "w6w-small", children: A.join(" ") })
1389
+ /* @__PURE__ */ t("p", { className: "w6w-small", children: k.join(" ") })
1332
1390
  ] })
1333
1391
  ] }),
1334
1392
  /* @__PURE__ */ r("div", { className: "w6w-modal-actions", children: [
@@ -1339,7 +1397,7 @@ function rs({
1339
1397
  type: "button",
1340
1398
  className: "w6w-btn w6w-btn-danger",
1341
1399
  disabled: n,
1342
- onClick: u,
1400
+ onClick: d,
1343
1401
  children: "Delete"
1344
1402
  }
1345
1403
  )
@@ -1349,287 +1407,287 @@ function rs({
1349
1407
  function Le(e) {
1350
1408
  const n = new Date(e).getTime();
1351
1409
  if (Number.isNaN(n)) return "recently";
1352
- const a = Math.max(0, Math.round((Date.now() - n) / 1e3));
1353
- if (a < 45) return "just now";
1354
- const i = Math.round(a / 60);
1410
+ const s = Math.max(0, Math.round((Date.now() - n) / 1e3));
1411
+ if (s < 45) return "just now";
1412
+ const i = Math.round(s / 60);
1355
1413
  if (i < 60) return `${i}m ago`;
1356
- const s = Math.round(i / 60);
1357
- if (s < 24) return `${s}h ago`;
1358
- const l = Math.round(s / 24);
1414
+ const a = Math.round(i / 60);
1415
+ if (a < 24) return `${a}h ago`;
1416
+ const l = Math.round(a / 24);
1359
1417
  return l < 30 ? `${l}d ago` : new Date(e).toLocaleDateString();
1360
1418
  }
1361
- const os = {
1419
+ const ms = {
1362
1420
  ok: 6e3,
1363
1421
  warn: 1e4,
1364
1422
  error: 15e3
1365
- }, cs = { ok: "✓", warn: "!", error: "✕" };
1366
- function Ai({
1423
+ }, hs = { ok: "✓", warn: "!", error: "✕" };
1424
+ function Ei({
1367
1425
  connectionId: e,
1368
1426
  onOpenAction: n,
1369
- onBack: a,
1427
+ onBack: s,
1370
1428
  onOpenCallable: i,
1371
- slots: s
1429
+ slots: a
1372
1430
  }) {
1373
- var H, T, K, Y, G;
1374
- const l = ct(), o = de(), u = la(e), m = (H = u.data) == null ? void 0 : H.appId, w = te(
1375
- () => dt(u.data ? [u.data] : []),
1376
- [u.data]
1377
- ), { byId: N } = je(w), h = u.data ? xe(u.data, N) : void 0, k = ca(m, !!m), p = (T = u.data) == null ? void 0 : T.authKey, b = (K = Qe({
1431
+ var B, L, O, J, te;
1432
+ const l = dt(), o = ue(), d = oa(e), m = (B = d.data) == null ? void 0 : B.appId, p = ae(
1433
+ () => ut(d.data ? [d.data] : []),
1434
+ [d.data]
1435
+ ), { byId: C } = qe(p), h = d.data ? Re(d.data, C) : void 0, y = ua(m, !!m), c = (L = d.data) == null ? void 0 : L.authKey, g = (O = Qe({
1378
1436
  queryKey: ["app-auth", m ?? ""],
1379
1437
  queryFn: () => l.getAppAuth(m),
1380
1438
  enabled: !!m && typeof l.getAppAuth == "function",
1381
1439
  retry: !1
1382
- }).data) == null ? void 0 : K.find((D) => D.key === p), $ = !!b && (!!b.description || (((Y = b.setup) == null ? void 0 : Y.length) ?? 0) > 0 || (((G = b.serviceAccount) == null ? void 0 : G.scopes.length) ?? 0) > 0), I = ea(e), f = te(() => {
1383
- const D = /* @__PURE__ */ new Map();
1384
- for (const V of I.data ?? []) {
1385
- const c = D.get(V.actionKey) ?? [];
1386
- c.push(V), D.set(V.actionKey, c);
1440
+ }).data) == null ? void 0 : O.find((E) => E.key === c), S = !!g && (!!g.description || (((J = g.setup) == null ? void 0 : J.length) ?? 0) > 0 || (((te = g.serviceAccount) == null ? void 0 : te.scopes.length) ?? 0) > 0), I = na(e), A = ae(() => {
1441
+ const E = /* @__PURE__ */ new Map();
1442
+ for (const W of I.data ?? []) {
1443
+ const w = E.get(W.actionKey) ?? [];
1444
+ w.push(W), E.set(W.actionKey, w);
1387
1445
  }
1388
- return D;
1389
- }, [I.data]), E = bt(e).data, S = ae(void 0), C = (E == null ? void 0 : E.callables) ?? [], Q = (E == null ? void 0 : E.routes) ?? [], P = ta(e).data ?? [], [x, R] = y(!1), [j, q] = y(""), O = Nt(e), [_, g] = y(null);
1390
- zt(() => {
1391
- if (!_) return;
1392
- const D = setTimeout(() => g(null), os[_.kind]);
1393
- return () => clearTimeout(D);
1394
- }, [_]);
1395
- const d = () => {
1396
- g(null), O.mutate(void 0, {
1397
- onSuccess: (D) => {
1398
- var V;
1399
- if (!D.ok) {
1400
- g({
1446
+ return E;
1447
+ }, [I.data]), v = Nt(e).data, D = se(void 0), $ = (v == null ? void 0 : v.callables) ?? [], j = (v == null ? void 0 : v.routes) ?? [], R = aa(e).data ?? [], [x, P] = f(!1), [_, q] = f(""), K = kt(e), [U, b] = f(null);
1448
+ Yt(() => {
1449
+ if (!U) return;
1450
+ const E = setTimeout(() => b(null), ms[U.kind]);
1451
+ return () => clearTimeout(E);
1452
+ }, [U]);
1453
+ const u = () => {
1454
+ b(null), K.mutate(void 0, {
1455
+ onSuccess: (E) => {
1456
+ var W;
1457
+ if (!E.ok) {
1458
+ b({
1401
1459
  kind: "error",
1402
- text: `Connection test failed${(V = D.error) != null && V.message ? `: ${D.error.message}` : "."}`
1460
+ text: `Connection test failed${(W = E.error) != null && W.message ? `: ${E.error.message}` : "."}`
1403
1461
  });
1404
1462
  return;
1405
1463
  }
1406
- g(
1407
- D.untested ? { kind: "warn", text: `Connection stored. ${D.message ?? ""}`.trim() } : {
1464
+ b(
1465
+ E.untested ? { kind: "warn", text: `Connection stored. ${E.message ?? ""}`.trim() } : {
1408
1466
  kind: "ok",
1409
- text: `Connection is valid${D.actionKey ? ` — probed ${D.actionKey}` : ""}.`
1467
+ text: `Connection is valid${E.actionKey ? ` — probed ${E.actionKey}` : ""}.`
1410
1468
  }
1411
1469
  );
1412
1470
  },
1413
- onError: (D) => g({ kind: "error", text: (D == null ? void 0 : D.message) ?? "Test failed." })
1471
+ onError: (E) => b({ kind: "error", text: (E == null ? void 0 : E.message) ?? "Test failed." })
1414
1472
  });
1415
- }, v = te(() => {
1416
- var V;
1417
- const D = [...((V = k.data) == null ? void 0 : V.actions) ?? []];
1418
- return D.sort((c, M) => (c.title || c.key).localeCompare(M.title || M.key)), D;
1419
- }, [k.data]), L = te(() => {
1420
- const D = j.trim().toLowerCase();
1421
- return D ? v.filter(
1422
- (V) => (V.title || "").toLowerCase().includes(D) || V.key.toLowerCase().includes(D) || (V.description || "").toLowerCase().includes(D)
1423
- ) : v;
1424
- }, [v, j]);
1425
- if (u.isLoading || k.isLoading)
1473
+ }, N = ae(() => {
1474
+ var W;
1475
+ const E = [...((W = y.data) == null ? void 0 : W.actions) ?? []];
1476
+ return E.sort((w, F) => (w.title || w.key).localeCompare(F.title || F.key)), E;
1477
+ }, [y.data]), T = ae(() => {
1478
+ const E = _.trim().toLowerCase();
1479
+ return E ? N.filter(
1480
+ (W) => (W.title || "").toLowerCase().includes(E) || W.key.toLowerCase().includes(E) || (W.description || "").toLowerCase().includes(E)
1481
+ ) : N;
1482
+ }, [N, _]);
1483
+ if (d.isLoading || y.isLoading)
1426
1484
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root w6w-embed-conn-detail", children: /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) });
1427
- if (!u.data)
1485
+ if (!d.data)
1428
1486
  return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-conn-detail", "data-testid": "connection-not-found", children: [
1429
- (s == null ? void 0 : s.empty) ?? /* @__PURE__ */ t("h2", { children: "Connection not found" }),
1430
- a && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: a, children: "Back to integrations" })
1487
+ (a == null ? void 0 : a.empty) ?? /* @__PURE__ */ t("h2", { children: "Connection not found" }),
1488
+ s && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: s, children: "Back to integrations" })
1431
1489
  ] });
1432
- const F = u.data, U = k.data, B = !F.builtIn && typeof l.updateConnection == "function";
1490
+ const Q = d.data, V = y.data, z = !Q.builtIn && typeof l.updateConnection == "function";
1433
1491
  return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-conn-detail w6w-card-stack", children: [
1434
- (s == null ? void 0 : s.header) ?? /* @__PURE__ */ r(cn, { conn: F, app: h, children: [
1492
+ (a == null ? void 0 : a.header) ?? /* @__PURE__ */ r(hn, { conn: Q, app: h, children: [
1435
1493
  /* @__PURE__ */ t(
1436
1494
  "button",
1437
1495
  {
1438
1496
  type: "button",
1439
1497
  className: "w6w-btn w6w-btn-ghost",
1440
- disabled: O.isPending,
1441
- onClick: d,
1442
- children: O.isPending ? "Testing…" : "Test connection"
1498
+ disabled: K.isPending,
1499
+ onClick: u,
1500
+ children: K.isPending ? "Testing…" : "Test connection"
1443
1501
  }
1444
1502
  ),
1445
- B && /* @__PURE__ */ t(
1446
- dn,
1503
+ z && /* @__PURE__ */ t(
1504
+ pn,
1447
1505
  {
1448
1506
  label: "Edit",
1449
- onClick: () => R(!0),
1507
+ onClick: () => P(!0),
1450
1508
  "data-testid": "connection-detail-edit"
1451
1509
  }
1452
1510
  ),
1453
- s == null ? void 0 : s.actions
1511
+ a == null ? void 0 : a.actions
1454
1512
  ] }),
1455
- _ && /* @__PURE__ */ r(
1513
+ U && /* @__PURE__ */ r(
1456
1514
  "div",
1457
1515
  {
1458
- className: `w6w-result w6w-embed-conn-notice w6w-embed-conn-notice-${_.kind}`,
1459
- role: _.kind === "error" ? "alert" : "status",
1460
- "aria-live": _.kind === "error" ? "assertive" : "polite",
1516
+ className: `w6w-result w6w-embed-conn-notice w6w-embed-conn-notice-${U.kind}`,
1517
+ role: U.kind === "error" ? "alert" : "status",
1518
+ "aria-live": U.kind === "error" ? "assertive" : "polite",
1461
1519
  "data-testid": "connection-test-notice",
1462
1520
  children: [
1463
- /* @__PURE__ */ t("span", { "aria-hidden": "true", children: cs[_.kind] }),
1464
- /* @__PURE__ */ t("span", { className: "w6w-embed-conn-notice-text", children: _.text }),
1465
- /* @__PURE__ */ t(un, { icon: "close", label: "Dismiss", onClick: () => g(null) })
1521
+ /* @__PURE__ */ t("span", { "aria-hidden": "true", children: hs[U.kind] }),
1522
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-notice-text", children: U.text }),
1523
+ /* @__PURE__ */ t(wn, { icon: "close", label: "Dismiss", onClick: () => b(null) })
1466
1524
  ]
1467
1525
  }
1468
1526
  ),
1469
1527
  /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1470
1528
  /* @__PURE__ */ r("h3", { children: [
1471
1529
  "App: ",
1472
- (h == null ? void 0 : h.displayName) ?? F.appId
1530
+ (h == null ? void 0 : h.displayName) ?? Q.appId
1473
1531
  ] }),
1474
- U && /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", children: [
1532
+ V && /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", children: [
1475
1533
  "Version ",
1476
1534
  /* @__PURE__ */ r("code", { children: [
1477
1535
  "v",
1478
- U.version ?? "?"
1536
+ V.version ?? "?"
1479
1537
  ] }),
1480
1538
  " · source ",
1481
- /* @__PURE__ */ t("code", { children: U.sourceRef })
1539
+ /* @__PURE__ */ t("code", { children: V.sourceRef })
1482
1540
  ] }),
1483
- a && /* @__PURE__ */ t("p", { className: "w6w-small", children: /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: a, children: "← Integrations" }) })
1541
+ s && /* @__PURE__ */ t("p", { className: "w6w-small", children: /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: s, children: "← Integrations" }) })
1484
1542
  ] }),
1485
- $ && b && /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", "data-testid": "connection-auth-guide", children: [
1543
+ S && g && /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", "data-testid": "connection-auth-guide", children: [
1486
1544
  /* @__PURE__ */ t("h3", { children: "How to connect" }),
1487
- /* @__PURE__ */ t(mn, { auth: b })
1545
+ /* @__PURE__ */ t(fn, { auth: g })
1488
1546
  ] }),
1489
1547
  /* @__PURE__ */ t(
1490
- hn,
1548
+ yn,
1491
1549
  {
1492
- conn: F,
1550
+ conn: Q,
1493
1551
  className: "w6w-embed-conn-card",
1494
1552
  onChanged: () => {
1495
- o.invalidateQueries({ queryKey: Re(e) }), o.invalidateQueries({ queryKey: ce });
1553
+ o.invalidateQueries({ queryKey: Pe(e) }), o.invalidateQueries({ queryKey: de });
1496
1554
  }
1497
1555
  }
1498
1556
  ),
1499
1557
  /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1500
1558
  /* @__PURE__ */ t("h3", { children: "Actions" }),
1501
- v.length === 0 && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No actions exposed." }),
1502
- v.length > 10 && /* @__PURE__ */ t(
1559
+ N.length === 0 && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No actions exposed." }),
1560
+ N.length > 10 && /* @__PURE__ */ t(
1503
1561
  "input",
1504
1562
  {
1505
1563
  type: "search",
1506
- value: j,
1507
- placeholder: `Search ${v.length} actions…`,
1508
- onChange: (D) => q(D.target.value),
1564
+ value: _,
1565
+ placeholder: `Search ${N.length} actions…`,
1566
+ onChange: (E) => q(E.target.value),
1509
1567
  "aria-label": "Filter actions",
1510
1568
  className: "w6w-embed-conn-filter"
1511
1569
  }
1512
1570
  ),
1513
- v.length > 0 && L.length === 0 && /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", children: [
1571
+ N.length > 0 && T.length === 0 && /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", children: [
1514
1572
  "No actions match “",
1515
- j,
1573
+ _,
1516
1574
  "”."
1517
1575
  ] }),
1518
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Actions", children: L.map((D) => {
1519
- const V = f.get(D.key) ?? [];
1576
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Actions", children: T.map((E) => {
1577
+ const W = A.get(E.key) ?? [];
1520
1578
  return /* @__PURE__ */ r("li", { children: [
1521
1579
  /* @__PURE__ */ r(
1522
1580
  "button",
1523
1581
  {
1524
1582
  type: "button",
1525
1583
  className: "w6w-embed-conn-action",
1526
- "data-testid": `connection-action-${D.key}`,
1527
- onClick: () => n(D.key),
1584
+ "data-testid": `connection-action-${E.key}`,
1585
+ onClick: () => n(E.key),
1528
1586
  children: [
1529
- /* @__PURE__ */ t("strong", { children: D.title }),
1587
+ /* @__PURE__ */ t("strong", { children: E.title }),
1530
1588
  " ",
1531
- /* @__PURE__ */ t("code", { className: "w6w-muted", children: D.key }),
1589
+ /* @__PURE__ */ t("code", { className: "w6w-muted", children: E.key }),
1532
1590
  " ",
1533
- /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: D.type }),
1534
- D.description && /* @__PURE__ */ t("div", { className: "w6w-muted w6w-small", children: D.description })
1591
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: E.type }),
1592
+ E.description && /* @__PURE__ */ t("div", { className: "w6w-muted w6w-small", children: E.description })
1535
1593
  ]
1536
1594
  }
1537
1595
  ),
1538
- V.length > 0 && /* @__PURE__ */ t(
1596
+ W.length > 0 && /* @__PURE__ */ t(
1539
1597
  "ul",
1540
1598
  {
1541
1599
  className: "w6w-embed-conn-list w6w-embed-conn-tests",
1542
- "aria-label": `Saved tests for ${D.title || D.key}`,
1543
- children: V.map((c) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1544
- Me,
1600
+ "aria-label": `Saved tests for ${E.title || E.key}`,
1601
+ children: W.map((w) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1602
+ xe,
1545
1603
  {
1546
- title: c.name,
1547
- subtitle: c.lastRunAt ? /* @__PURE__ */ r("span", { children: [
1604
+ title: w.name,
1605
+ subtitle: w.lastRunAt ? /* @__PURE__ */ r("span", { children: [
1548
1606
  /* @__PURE__ */ t(
1549
1607
  "span",
1550
1608
  {
1551
- className: c.lastRunOk ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail",
1552
- children: c.lastRunOk ? "✓" : "✗"
1609
+ className: w.lastRunOk ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail",
1610
+ children: w.lastRunOk ? "✓" : "✗"
1553
1611
  }
1554
1612
  ),
1555
1613
  " ",
1556
- c.lastRunSummary ? `${c.lastRunSummary} · ` : "",
1557
- Le(c.lastRunAt)
1558
- ] }) : `saved ${Le(c.updatedAt)}`,
1559
- onClick: () => n(D.key, c.id)
1614
+ w.lastRunSummary ? `${w.lastRunSummary} · ` : "",
1615
+ Le(w.lastRunAt)
1616
+ ] }) : `saved ${Le(w.updatedAt)}`,
1617
+ onClick: () => n(E.key, w.id)
1560
1618
  }
1561
- ) }, c.id))
1619
+ ) }, w.id))
1562
1620
  }
1563
1621
  )
1564
- ] }, D.key);
1622
+ ] }, E.key);
1565
1623
  }) })
1566
1624
  ] }),
1567
- E && /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", "data-testid": "connection-used-by", children: [
1625
+ v && /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", "data-testid": "connection-used-by", children: [
1568
1626
  /* @__PURE__ */ t("h3", { children: "Used by" }),
1569
- C.length === 0 && Q.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Not used by any callable" }) : /* @__PURE__ */ t(
1570
- Bt,
1627
+ $.length === 0 && j.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Not used by any callable" }) : /* @__PURE__ */ t(
1628
+ Wt,
1571
1629
  {
1572
- callables: C,
1573
- routes: Q,
1574
- projectId: S,
1630
+ callables: $,
1631
+ routes: j,
1632
+ projectId: D,
1575
1633
  onOpenCallable: i
1576
1634
  }
1577
1635
  )
1578
1636
  ] }),
1579
- P.length > 0 && /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1637
+ R.length > 0 && /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1580
1638
  /* @__PURE__ */ t("h3", { children: "Recent runs" }),
1581
1639
  /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: "Most recent tester runs against this connection." }),
1582
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Recent runs", children: P.map((D) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1583
- Me,
1640
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Recent runs", children: R.map((E) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1641
+ xe,
1584
1642
  {
1585
- title: D.actionKey,
1643
+ title: E.actionKey,
1586
1644
  subtitle: /* @__PURE__ */ r("span", { children: [
1587
- /* @__PURE__ */ t("span", { className: D.ok ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail", children: D.ok ? "✓" : "✗" }),
1645
+ /* @__PURE__ */ t("span", { className: E.ok ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail", children: E.ok ? "✓" : "✗" }),
1588
1646
  " ",
1589
- D.summary ? `${D.summary} · ` : "",
1590
- Le(D.occurredAt)
1647
+ E.summary ? `${E.summary} · ` : "",
1648
+ Le(E.occurredAt)
1591
1649
  ] })
1592
1650
  }
1593
- ) }, D.id)) })
1651
+ ) }, E.id)) })
1594
1652
  ] }),
1595
1653
  x && /* @__PURE__ */ t(
1596
- ut,
1654
+ mt,
1597
1655
  {
1598
- connection: F,
1599
- onClose: () => R(!1),
1656
+ connection: Q,
1657
+ onClose: () => P(!1),
1600
1658
  onSaved: () => {
1601
- R(!1), o.invalidateQueries({ queryKey: Re(e) }), o.invalidateQueries({ queryKey: ce });
1659
+ P(!1), o.invalidateQueries({ queryKey: Pe(e) }), o.invalidateQueries({ queryKey: de });
1602
1660
  }
1603
1661
  }
1604
1662
  )
1605
1663
  ] });
1606
1664
  }
1607
- const ds = {};
1608
- function tt(e) {
1665
+ const ps = {};
1666
+ function at(e) {
1609
1667
  return String(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1610
1668
  }
1611
1669
  function fe(e) {
1612
1670
  return (e / 100).toFixed(2);
1613
1671
  }
1614
- function us(e) {
1672
+ function ws(e) {
1615
1673
  if (e == null) return null;
1616
- const n = e.rates, a = [];
1617
- return n.input != null && a.push(`in ${fe(n.input)}`), n.output != null && a.push(`out ${fe(n.output)}`), n.cachedInput != null && a.push(`cached ${fe(n.cachedInput)}`), n.cacheWrite != null && a.push(`cache write ${fe(n.cacheWrite)}`), n.perRequest != null && a.push(`${fe(n.perRequest)}/request`), a.length === 0 ? null : `${n.currency ?? "USD"} ${a.join(" · ")}`;
1674
+ const n = e.rates, s = [];
1675
+ return n.input != null && s.push(`in ${fe(n.input)}`), n.output != null && s.push(`out ${fe(n.output)}`), n.cachedInput != null && s.push(`cached ${fe(n.cachedInput)}`), n.cacheWrite != null && s.push(`cache write ${fe(n.cacheWrite)}`), n.perRequest != null && s.push(`${fe(n.perRequest)}/request`), s.length === 0 ? null : `${n.currency ?? "USD"} ${s.join(" · ")}`;
1618
1676
  }
1619
- function ms(e) {
1620
- const { maxInputTokens: n, maxOutputTokens: a } = e.limits ?? {};
1621
- return n == null && a == null ? "—" : /* @__PURE__ */ r("div", { className: "model-catalog-limits", children: [
1677
+ function fs(e) {
1678
+ const { maxInputTokens: n, maxOutputTokens: s } = e.limits ?? {};
1679
+ return n == null && s == null ? "—" : /* @__PURE__ */ r("div", { className: "model-catalog-limits", children: [
1622
1680
  n != null && /* @__PURE__ */ r("span", { children: [
1623
- tt(n),
1681
+ at(n),
1624
1682
  " input"
1625
1683
  ] }),
1626
- a != null && /* @__PURE__ */ r("span", { children: [
1627
- tt(a),
1684
+ s != null && /* @__PURE__ */ r("span", { children: [
1685
+ at(s),
1628
1686
  " output"
1629
1687
  ] })
1630
1688
  ] });
1631
1689
  }
1632
- const hs = [
1690
+ const ys = [
1633
1691
  {
1634
1692
  key: "model",
1635
1693
  header: "Model",
@@ -1651,7 +1709,7 @@ const hs = [
1651
1709
  header: "Price / 1M tokens",
1652
1710
  width: "28%",
1653
1711
  render: (e) => {
1654
- const n = us(e.currentRate);
1712
+ const n = ws(e.currentRate);
1655
1713
  return n == null ? /* @__PURE__ */ t("span", { className: "muted small", children: "Not configured" }) : /* @__PURE__ */ t(
1656
1714
  "span",
1657
1715
  {
@@ -1666,17 +1724,17 @@ const hs = [
1666
1724
  key: "limits",
1667
1725
  header: "Token limits",
1668
1726
  width: "24%",
1669
- render: (e) => /* @__PURE__ */ t("div", { className: "muted small", children: ms(e) })
1727
+ render: (e) => /* @__PURE__ */ t("div", { className: "muted small", children: fs(e) })
1670
1728
  }
1671
1729
  ];
1672
- function $i(e) {
1730
+ function Li(e) {
1673
1731
  var l;
1674
- const n = he(), a = e.filter ?? ds, i = yt({
1675
- queryKey: ua(a),
1732
+ const n = pe(), s = e.filter ?? ps, i = gt({
1733
+ queryKey: ha(s),
1676
1734
  initialPageParam: void 0,
1677
1735
  getNextPageParam: (o) => o.nextCursor ?? void 0,
1678
- queryFn: ({ pageParam: o }) => da(n, o ? { ...a, cursor: o } : a)
1679
- }), s = ((l = i.data) == null ? void 0 : l.pages.flatMap((o) => o.models)) ?? [];
1736
+ queryFn: ({ pageParam: o }) => ma(n, o ? { ...s, cursor: o } : s)
1737
+ }), a = ((l = i.data) == null ? void 0 : l.pages.flatMap((o) => o.models)) ?? [];
1680
1738
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ r("section", { className: "section", children: [
1681
1739
  /* @__PURE__ */ t("div", { className: "section-head", children: /* @__PURE__ */ r("div", { children: [
1682
1740
  /* @__PURE__ */ t("h3", { children: "Available models" }),
@@ -1685,13 +1743,13 @@ function $i(e) {
1685
1743
  /* @__PURE__ */ r("div", { children: [
1686
1744
  i.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1687
1745
  i.error != null && /* @__PURE__ */ t("div", { className: "error", children: i.error.message }),
1688
- i.isSuccess && s.length === 0 && /* @__PURE__ */ t(Fe, { testId: "model-catalog-empty", children: "No models yet. Discover them from a provider connection to start routing to them." }),
1689
- s.length > 0 && /* @__PURE__ */ t(
1746
+ i.isSuccess && a.length === 0 && /* @__PURE__ */ t(je, { testId: "model-catalog-empty", children: "No models yet. Discover them from a provider connection to start routing to them." }),
1747
+ a.length > 0 && /* @__PURE__ */ t(
1690
1748
  ke,
1691
1749
  {
1692
- columns: hs,
1750
+ columns: ys,
1693
1751
  className: "model-catalog-table",
1694
- rows: s,
1752
+ rows: a,
1695
1753
  rowKey: (o) => o.id,
1696
1754
  testId: "model-catalog-table",
1697
1755
  rowTestId: (o) => `model-catalog-${o.id}`
@@ -1711,23 +1769,23 @@ function $i(e) {
1711
1769
  ) })
1712
1770
  ] }) });
1713
1771
  }
1714
- const ps = {};
1715
- function Z(e) {
1772
+ const gs = {};
1773
+ function ee(e) {
1716
1774
  return String(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1717
1775
  }
1718
- function ws(e) {
1776
+ function bs(e) {
1719
1777
  return `${e.currency} ${(e.amountMinor / 100).toFixed(2)}`;
1720
1778
  }
1721
- function fs(e, n) {
1722
- return e.length > 0 ? e.map(ws).join(" · ") : n > 0 ? "unpriced" : "—";
1779
+ function vs(e, n) {
1780
+ return e.length > 0 ? e.map(bs).join(" · ") : n > 0 ? "unpriced" : "—";
1723
1781
  }
1724
- function ys(e) {
1782
+ function Ns(e) {
1725
1783
  return e.costMinor == null ? null : `${e.currency ?? "USD"} ${(e.costMinor / 100).toFixed(2)}`;
1726
1784
  }
1727
- function gs(e) {
1785
+ function ks(e) {
1728
1786
  return e.totalsTruncated === !0;
1729
1787
  }
1730
- const vs = [
1788
+ const Cs = [
1731
1789
  {
1732
1790
  key: "occurredAt",
1733
1791
  header: "When",
@@ -1758,8 +1816,8 @@ const vs = [
1758
1816
  "span",
1759
1817
  {
1760
1818
  className: "muted small",
1761
- title: `${Z(e.inputTokens)} in · ${Z(e.outputTokens)} out · ${Z(e.cachedInputTokens)} cached input · ${Z(e.cacheWriteTokens)} cache write`,
1762
- children: Z(e.totalTokens)
1819
+ title: `${ee(e.inputTokens)} in · ${ee(e.outputTokens)} out · ${ee(e.cachedInputTokens)} cached input · ${ee(e.cacheWriteTokens)} cache write`,
1820
+ children: ee(e.totalTokens)
1763
1821
  }
1764
1822
  )
1765
1823
  },
@@ -1768,7 +1826,7 @@ const vs = [
1768
1826
  header: "Cost",
1769
1827
  align: "right",
1770
1828
  render: (e) => {
1771
- const n = ys(e);
1829
+ const n = Ns(e);
1772
1830
  return n == null ? /* @__PURE__ */ t("span", { className: "tag warn", "data-testid": "model-usage-unpriced", title: "no usable rate", children: "unpriced" }) : /* @__PURE__ */ t("span", { className: "muted small", children: n });
1773
1831
  }
1774
1832
  },
@@ -1776,10 +1834,10 @@ const vs = [
1776
1834
  key: "result",
1777
1835
  header: "Result",
1778
1836
  render: (e) => {
1779
- const n = jt(e.durationMs);
1837
+ const n = qt(e.durationMs);
1780
1838
  return /* @__PURE__ */ r("span", { className: "muted small", title: e.errorCode ?? void 0, children: [
1781
1839
  /* @__PURE__ */ t("span", { className: e.ok ? "tag" : "tag warn", children: e.ok ? "ok" : e.errorCode ?? "failed" }),
1782
- n != null && /* @__PURE__ */ r(W, { children: [
1840
+ n != null && /* @__PURE__ */ r(H, { children: [
1783
1841
  " · ",
1784
1842
  n
1785
1843
  ] })
@@ -1787,52 +1845,52 @@ const vs = [
1787
1845
  }
1788
1846
  }
1789
1847
  ];
1790
- function Di(e) {
1791
- var w, N;
1792
- const n = ae(e.projectId), a = he(), i = e.filter ?? ps, s = yt({
1793
- queryKey: ha(n ?? void 0, i),
1848
+ function Mi(e) {
1849
+ var p, C;
1850
+ const n = se(e.projectId), s = pe(), i = e.filter ?? gs, a = gt({
1851
+ queryKey: wa(n ?? void 0, i),
1794
1852
  enabled: n != null,
1795
1853
  initialPageParam: void 0,
1796
1854
  getNextPageParam: (h) => h.nextCursor ?? void 0,
1797
- queryFn: ({ pageParam: h }) => ma(
1798
- a,
1855
+ queryFn: ({ pageParam: h }) => pa(
1856
+ s,
1799
1857
  n,
1800
1858
  h ? { ...i, cursor: h } : i
1801
1859
  )
1802
- }), l = ((w = s.data) == null ? void 0 : w.pages) ?? [], o = (N = l[0]) == null ? void 0 : N.totals, u = l.flatMap((h) => h.items), m = l.length > 0 && gs(l[0]);
1860
+ }), l = ((p = a.data) == null ? void 0 : p.pages) ?? [], o = (C = l[0]) == null ? void 0 : C.totals, d = l.flatMap((h) => h.items), m = l.length > 0 && ks(l[0]);
1803
1861
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ r("section", { className: "section", children: [
1804
1862
  /* @__PURE__ */ t("div", { className: "section-head", children: /* @__PURE__ */ r("div", { children: [
1805
1863
  /* @__PURE__ */ t("h3", { children: "Model usage" }),
1806
1864
  /* @__PURE__ */ t("p", { className: "muted small", children: "Every model call this project paid for, priced with the rate card in force when it ran. A call with no usable rate counts as unpriced, not as free." })
1807
1865
  ] }) }),
1808
- n == null ? /* @__PURE__ */ t("div", { className: "card", children: /* @__PURE__ */ t("p", { className: "muted", "data-testid": "model-usage-no-project", children: "Select a project to see its model usage." }) }) : /* @__PURE__ */ r(W, { children: [
1866
+ n == null ? /* @__PURE__ */ t("div", { className: "card", children: /* @__PURE__ */ t("p", { className: "muted", "data-testid": "model-usage-no-project", children: "Select a project to see its model usage." }) }) : /* @__PURE__ */ r(H, { children: [
1809
1867
  /* @__PURE__ */ r("div", { className: "card", "data-testid": "model-usage-totals", children: [
1810
1868
  m && /* @__PURE__ */ t("p", { className: "result warn", "data-testid": "model-usage-totals-partial", children: "Totals are partial: they cover a bounded scan of this window, not every matching call. Narrow the range for exact totals." }),
1811
1869
  o == null ? (
1812
1870
  // A failed query is reported once, below — never as a perpetual "loading".
1813
- s.error == null && /* @__PURE__ */ t("p", { className: "muted", children: "Loading totals…" })
1871
+ a.error == null && /* @__PURE__ */ t("p", { className: "muted", children: "Loading totals…" })
1814
1872
  ) : /* @__PURE__ */ r("p", { className: "muted small", children: [
1815
1873
  /* @__PURE__ */ r("span", { "data-testid": "model-usage-total-requests", children: [
1816
- Z(o.requests),
1874
+ ee(o.requests),
1817
1875
  " requests"
1818
1876
  ] }),
1819
1877
  " · ",
1820
1878
  /* @__PURE__ */ r("span", { "data-testid": "model-usage-total-tokens", children: [
1821
- Z(o.totalTokens),
1879
+ ee(o.totalTokens),
1822
1880
  " tokens (",
1823
- Z(o.inputTokens),
1881
+ ee(o.inputTokens),
1824
1882
  " in /",
1825
1883
  " ",
1826
- Z(o.outputTokens),
1884
+ ee(o.outputTokens),
1827
1885
  " out / ",
1828
- Z(o.cachedInputTokens),
1886
+ ee(o.cachedInputTokens),
1829
1887
  " cached / ",
1830
- Z(o.cacheWriteTokens),
1888
+ ee(o.cacheWriteTokens),
1831
1889
  " cache write)"
1832
1890
  ] }),
1833
1891
  " · ",
1834
- /* @__PURE__ */ t("span", { "data-testid": "model-usage-total-cost", children: fs(o.cost, o.unpriced) }),
1835
- o.unpriced > 0 && /* @__PURE__ */ r(W, { children: [
1892
+ /* @__PURE__ */ t("span", { "data-testid": "model-usage-total-cost", children: vs(o.cost, o.unpriced) }),
1893
+ o.unpriced > 0 && /* @__PURE__ */ r(H, { children: [
1836
1894
  " · ",
1837
1895
  /* @__PURE__ */ r(
1838
1896
  "span",
@@ -1841,7 +1899,7 @@ function Di(e) {
1841
1899
  "data-testid": "model-usage-unpriced-total",
1842
1900
  title: "calls with no usable rate — not included in any cost total",
1843
1901
  children: [
1844
- Z(o.unpriced),
1902
+ ee(o.unpriced),
1845
1903
  " unpriced"
1846
1904
  ]
1847
1905
  }
@@ -1849,38 +1907,38 @@ function Di(e) {
1849
1907
  ] })
1850
1908
  ] })
1851
1909
  ] }),
1852
- s.error != null && /* @__PURE__ */ t("div", { className: "error", role: "alert", "data-testid": "model-usage-error", children: s.error.message }),
1910
+ a.error != null && /* @__PURE__ */ t("div", { className: "error", role: "alert", "data-testid": "model-usage-error", children: a.error.message }),
1853
1911
  /* @__PURE__ */ r("div", { children: [
1854
- s.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1855
- s.isSuccess && u.length === 0 && /* @__PURE__ */ t(Fe, { testId: "model-usage-empty", children: "No model calls in this window. Usage rows appear here as routes are invoked." }),
1856
- u.length > 0 && /* @__PURE__ */ t(
1912
+ a.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1913
+ a.isSuccess && d.length === 0 && /* @__PURE__ */ t(je, { testId: "model-usage-empty", children: "No model calls in this window. Usage rows appear here as routes are invoked." }),
1914
+ d.length > 0 && /* @__PURE__ */ t(
1857
1915
  ke,
1858
1916
  {
1859
- columns: vs,
1860
- rows: u,
1917
+ columns: Cs,
1918
+ rows: d,
1861
1919
  rowKey: (h) => h.id,
1862
1920
  testId: "model-usage-table",
1863
1921
  rowTestId: (h) => `model-usage-${h.id}`
1864
1922
  }
1865
1923
  )
1866
1924
  ] }),
1867
- s.hasNextPage && /* @__PURE__ */ t("div", { className: "row", children: /* @__PURE__ */ t(
1925
+ a.hasNextPage && /* @__PURE__ */ t("div", { className: "row", children: /* @__PURE__ */ t(
1868
1926
  "button",
1869
1927
  {
1870
1928
  type: "button",
1871
1929
  className: "btn ghost",
1872
- disabled: s.isFetchingNextPage,
1873
- onClick: () => void s.fetchNextPage(),
1930
+ disabled: a.isFetchingNextPage,
1931
+ onClick: () => void a.fetchNextPage(),
1874
1932
  "data-testid": "model-usage-load-more",
1875
- children: s.isFetchingNextPage ? "Loading…" : "Load more"
1933
+ children: a.isFetchingNextPage ? "Loading…" : "Load more"
1876
1934
  }
1877
1935
  ) })
1878
1936
  ] })
1879
1937
  ] }) });
1880
1938
  }
1881
- function bs(e) {
1939
+ function Is(e) {
1882
1940
  if (!e) return "Credential";
1883
- const n = e.toLowerCase().replace(/[^a-z0-9]/g, ""), a = {
1941
+ const n = e.toLowerCase().replace(/[^a-z0-9]/g, ""), s = {
1884
1942
  apikey: "API key",
1885
1943
  key: "API key",
1886
1944
  token: "Token",
@@ -1891,106 +1949,106 @@ function bs(e) {
1891
1949
  oauth2: "OAuth",
1892
1950
  serviceaccount: "Service account"
1893
1951
  };
1894
- if (a[n]) return a[n];
1952
+ if (s[n]) return s[n];
1895
1953
  const i = e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim();
1896
1954
  return i.charAt(0).toUpperCase() + i.slice(1).toLowerCase();
1897
1955
  }
1898
- function Ns(e, n, a) {
1956
+ function As(e, n, s) {
1899
1957
  const i = /* @__PURE__ */ new Map();
1900
- for (const s of e)
1901
- s.private || i.set(s.id, { id: s.id, name: s.name, source: "shared", summary: s, uses: [] });
1902
- for (const s of n) {
1903
- const l = s.credentialId;
1958
+ for (const a of e)
1959
+ a.private || i.set(a.id, { id: a.id, name: a.name, source: "shared", summary: a, uses: [] });
1960
+ for (const a of n) {
1961
+ const l = a.credentialId;
1904
1962
  if (!l) continue;
1905
1963
  let o = i.get(l);
1906
1964
  if (!o) {
1907
- if (!a.includeAppCredentials) continue;
1908
- o = { id: l, name: s.displayName || s.appId, source: "app", uses: [] }, i.set(l, o);
1965
+ if (!s.includeAppCredentials) continue;
1966
+ o = { id: l, name: a.displayName || a.appId, source: "app", uses: [] }, i.set(l, o);
1909
1967
  }
1910
1968
  o.uses.push({
1911
- connectionId: s.id,
1912
- appId: s.appId,
1913
- connectionName: s.displayName || s.appId,
1914
- ...s.authKey ? { authKey: s.authKey } : {},
1915
- ...s.accessScope ? { accessScope: s.accessScope } : {}
1969
+ connectionId: a.id,
1970
+ appId: a.appId,
1971
+ connectionName: a.displayName || a.appId,
1972
+ ...a.authKey ? { authKey: a.authKey } : {},
1973
+ ...a.accessScope ? { accessScope: a.accessScope } : {}
1916
1974
  });
1917
1975
  }
1918
- return [...i.values()].sort((s, l) => s.name.localeCompare(l.name));
1976
+ return [...i.values()].sort((a, l) => a.name.localeCompare(l.name));
1919
1977
  }
1920
- const ks = [], Cs = [];
1921
- function Ei({
1978
+ const $s = [], Ss = [];
1979
+ function xi({
1922
1980
  contract: e,
1923
1981
  onOpen: n,
1924
- onOpenConnection: a,
1982
+ onOpenConnection: s,
1925
1983
  onCreate: i,
1926
- slots: s
1984
+ slots: a
1927
1985
  }) {
1928
- const l = At(e ? { contract: e } : void 0), o = qe(), u = Ie(), m = Ue(), w = _e(), N = kt(m), h = Ct(), k = It(), [p, A] = y(null), b = N.data ?? Cs, $ = te(
1986
+ const l = $t(e ? { contract: e } : void 0), o = _e(), d = Ie(), m = Ve(), p = Ue(), C = Ct(m), h = It(), y = At(), [c, k] = f(null), g = C.data ?? Ss, S = ae(
1929
1987
  () => new Map(
1930
- (w.data ?? []).filter((d) => d.designation).map((d) => [d.appId, d.provider ?? d.appId])
1988
+ (p.data ?? []).filter((u) => u.designation).map((u) => [u.appId, u.provider ?? u.appId])
1931
1989
  ),
1932
- [w.data]
1933
- ), I = o.data ?? ks, f = te(
1990
+ [p.data]
1991
+ ), I = o.data ?? $s, A = ae(
1934
1992
  () => [
1935
- ...new Set(I.filter((d) => d.credentialId && d.app === void 0).map((d) => d.appId))
1993
+ ...new Set(I.filter((u) => u.credentialId && u.app === void 0).map((u) => u.appId))
1936
1994
  ],
1937
1995
  [I]
1938
- ), { byId: E } = je(f), S = te(
1939
- () => Ns(l.data ?? [], I, { includeAppCredentials: !e }),
1996
+ ), { byId: v } = qe(A), D = ae(
1997
+ () => As(l.data ?? [], I, { includeAppCredentials: !e }),
1940
1998
  [l.data, I, e]
1941
- ), C = te(() => new Map(I.map((d) => [d.id, d])), [I]), Q = (d) => {
1942
- var v, L;
1943
- return ((L = (v = u.data) == null ? void 0 : v.find((F) => F.id === d)) == null ? void 0 : L.label) ?? d;
1944
- }, P = (d) => {
1945
- d.source === "shared" ? n == null || n(d.id) : d.uses[0] && (a == null || a(d.uses[0].connectionId));
1946
- }, x = i && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", onClick: i, children: "Add credential" }), R = l.isLoading || o.isLoading, j = (d) => m ? d.uses.filter((v) => v.accessScope === "user" && $.has(v.appId)) : [], q = (d) => {
1947
- const v = C.get(d.connectionId), L = v ? xe(v, E) : void 0;
1948
- return (L == null ? void 0 : L.displayName) ?? $.get(d.appId) ?? d.appId;
1949
- }, O = (d) => b.some((v) => v.providerAppId === d.appId && v.connectionId === d.connectionId), _ = (d, v) => {
1950
- A(null);
1951
- const L = { onError: () => A("Could not change the default key.") };
1952
- v ? h.mutate({ providerAppId: d.appId, connectionId: d.connectionId }, L) : k.mutate(d.appId, L);
1953
- }, g = [
1999
+ ), $ = ae(() => new Map(I.map((u) => [u.id, u])), [I]), j = (u) => {
2000
+ var N, T;
2001
+ return ((T = (N = d.data) == null ? void 0 : N.find((Q) => Q.id === u)) == null ? void 0 : T.label) ?? u;
2002
+ }, R = (u) => {
2003
+ u.source === "shared" ? n == null || n(u.id) : u.uses[0] && (s == null || s(u.uses[0].connectionId));
2004
+ }, x = i && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", onClick: i, children: "Add credential" }), P = l.isLoading || o.isLoading, _ = (u) => m ? u.uses.filter((N) => N.accessScope === "user" && S.has(N.appId)) : [], q = (u) => {
2005
+ const N = $.get(u.connectionId), T = N ? Re(N, v) : void 0;
2006
+ return (T == null ? void 0 : T.displayName) ?? S.get(u.appId) ?? u.appId;
2007
+ }, K = (u) => g.some((N) => N.providerAppId === u.appId && N.connectionId === u.connectionId), U = (u, N) => {
2008
+ k(null);
2009
+ const T = { onError: () => k("Could not change the default key.") };
2010
+ N ? h.mutate({ providerAppId: u.appId, connectionId: u.connectionId }, T) : y.mutate(u.appId, T);
2011
+ }, b = [
1954
2012
  {
1955
2013
  key: "name",
1956
2014
  header: "Credential",
1957
- render: (d) => {
1958
- const v = d.summary, L = v ? Object.values(v.display)[0] : void 0, F = d.uses[0], U = v ? Q(v.contract) : bs(F == null ? void 0 : F.authKey), B = v ? v.accessScope : F == null ? void 0 : F.accessScope, H = j(d).filter(O);
2015
+ render: (u) => {
2016
+ const N = u.summary, T = N ? Object.values(N.display)[0] : void 0, Q = u.uses[0], V = N ? j(N.contract) : Is(Q == null ? void 0 : Q.authKey), z = N ? N.accessScope : Q == null ? void 0 : Q.accessScope, B = _(u).filter(K);
1959
2017
  return /* @__PURE__ */ r(
1960
2018
  "button",
1961
2019
  {
1962
2020
  type: "button",
1963
2021
  className: "w6w-embed-cred-open",
1964
- "data-testid": `credential-row-${d.id}`,
1965
- onClick: (T) => {
1966
- T.stopPropagation(), P(d);
2022
+ "data-testid": `credential-row-${u.id}`,
2023
+ onClick: (L) => {
2024
+ L.stopPropagation(), R(u);
1967
2025
  },
1968
2026
  children: [
1969
2027
  /* @__PURE__ */ r("span", { className: "w6w-embed-cred-title", children: [
1970
- /* @__PURE__ */ t("strong", { children: d.name }),
1971
- v && v.status !== "active" && /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: v.status }),
1972
- H.map((T) => /* @__PURE__ */ r(
2028
+ /* @__PURE__ */ t("strong", { children: u.name }),
2029
+ N && N.status !== "active" && /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: N.status }),
2030
+ B.map((L) => /* @__PURE__ */ r(
1973
2031
  "span",
1974
2032
  {
1975
2033
  className: "w6w-embed-conn-badge w6w-embed-cred-default",
1976
- "data-testid": `credential-default-${d.id}`,
2034
+ "data-testid": `credential-default-${u.id}`,
1977
2035
  children: [
1978
2036
  "Default for ",
1979
- q(T)
2037
+ q(L)
1980
2038
  ]
1981
2039
  },
1982
- T.connectionId
2040
+ L.connectionId
1983
2041
  ))
1984
2042
  ] }),
1985
2043
  /* @__PURE__ */ r("span", { className: "w6w-muted w6w-small w6w-embed-cred-facts", children: [
1986
- /* @__PURE__ */ t("span", { "data-testid": `credential-type-${d.id}`, children: U }),
1987
- /* @__PURE__ */ r("span", { "data-testid": `credential-scope-${d.id}`, children: [
2044
+ /* @__PURE__ */ t("span", { "data-testid": `credential-type-${u.id}`, children: V }),
2045
+ /* @__PURE__ */ r("span", { "data-testid": `credential-scope-${u.id}`, children: [
1988
2046
  " · ",
1989
- $t(B)
2047
+ St(z)
1990
2048
  ] }),
1991
- L !== void 0 && /* @__PURE__ */ r("span", { children: [
2049
+ T !== void 0 && /* @__PURE__ */ r("span", { children: [
1992
2050
  " · ",
1993
- L
2051
+ T
1994
2052
  ] })
1995
2053
  ] })
1996
2054
  ]
@@ -2001,51 +2059,51 @@ function Ei({
2001
2059
  {
2002
2060
  key: "uses",
2003
2061
  header: "Used by",
2004
- render: (d) => {
2005
- var U;
2006
- const v = /* @__PURE__ */ new Map();
2007
- for (const B of d.uses) v.set(B.appId, [...v.get(B.appId) ?? [], B]);
2008
- const L = ((U = d.summary) == null ? void 0 : U.connectionCount) ?? d.uses.length;
2062
+ render: (u) => {
2063
+ var V;
2064
+ const N = /* @__PURE__ */ new Map();
2065
+ for (const z of u.uses) N.set(z.appId, [...N.get(z.appId) ?? [], z]);
2066
+ const T = ((V = u.summary) == null ? void 0 : V.connectionCount) ?? u.uses.length;
2009
2067
  if (o.isError)
2010
- return /* @__PURE__ */ r("span", { className: "w6w-muted", "data-testid": `credential-uses-${d.id}`, children: [
2011
- L,
2068
+ return /* @__PURE__ */ r("span", { className: "w6w-muted", "data-testid": `credential-uses-${u.id}`, children: [
2069
+ T,
2012
2070
  " connection",
2013
- L === 1 ? "" : "s"
2071
+ T === 1 ? "" : "s"
2014
2072
  ] });
2015
- const F = Math.max(0, L - d.uses.length);
2016
- return /* @__PURE__ */ r("span", { className: "w6w-embed-cred-uses", "data-testid": `credential-uses-${d.id}`, children: [
2017
- v.size === 0 && F === 0 && /* @__PURE__ */ t("span", { className: "w6w-muted", children: "Not used yet" }),
2018
- [...v.entries()].map(([B, H]) => {
2019
- const T = C.get(H[0].connectionId), K = T ? xe(T, E) : void 0, Y = (K == null ? void 0 : K.displayName) ?? B;
2073
+ const Q = Math.max(0, T - u.uses.length);
2074
+ return /* @__PURE__ */ r("span", { className: "w6w-embed-cred-uses", "data-testid": `credential-uses-${u.id}`, children: [
2075
+ N.size === 0 && Q === 0 && /* @__PURE__ */ t("span", { className: "w6w-muted", children: "Not used yet" }),
2076
+ [...N.entries()].map(([z, B]) => {
2077
+ const L = $.get(B[0].connectionId), O = L ? Re(L, v) : void 0, J = (O == null ? void 0 : O.displayName) ?? z;
2020
2078
  return /* @__PURE__ */ r(
2021
2079
  "span",
2022
2080
  {
2023
2081
  className: "w6w-embed-cred-app",
2024
- title: H.map((G) => G.connectionName).join(", "),
2082
+ title: B.map((te) => te.connectionName).join(", "),
2025
2083
  children: [
2026
2084
  /* @__PURE__ */ t(
2027
- mt,
2085
+ ht,
2028
2086
  {
2029
- src: K == null ? void 0 : K.iconSvg,
2030
- srcDark: K == null ? void 0 : K.iconSvgDark,
2031
- brandColor: K == null ? void 0 : K.brandColor,
2032
- name: Y,
2087
+ src: O == null ? void 0 : O.iconSvg,
2088
+ srcDark: O == null ? void 0 : O.iconSvgDark,
2089
+ brandColor: O == null ? void 0 : O.brandColor,
2090
+ name: J,
2033
2091
  size: 18
2034
2092
  }
2035
2093
  ),
2036
- /* @__PURE__ */ t("span", { children: Y }),
2037
- H.length > 1 && /* @__PURE__ */ r("span", { className: "w6w-muted", children: [
2094
+ /* @__PURE__ */ t("span", { children: J }),
2095
+ B.length > 1 && /* @__PURE__ */ r("span", { className: "w6w-muted", children: [
2038
2096
  "×",
2039
- H.length
2097
+ B.length
2040
2098
  ] })
2041
2099
  ]
2042
2100
  },
2043
- B
2101
+ z
2044
2102
  );
2045
2103
  }),
2046
- F > 0 && /* @__PURE__ */ r("span", { className: "w6w-muted w6w-small", children: [
2104
+ Q > 0 && /* @__PURE__ */ r("span", { className: "w6w-muted w6w-small", children: [
2047
2105
  "+",
2048
- F,
2106
+ Q,
2049
2107
  " more"
2050
2108
  ] })
2051
2109
  ] });
@@ -2055,34 +2113,34 @@ function Ei({
2055
2113
  key: "actions",
2056
2114
  header: "",
2057
2115
  actions: !0,
2058
- render: (d) => {
2059
- const v = [
2116
+ render: (u) => {
2117
+ const N = [
2060
2118
  {
2061
2119
  label: "Open",
2062
2120
  icon: "edit",
2063
- onSelect: () => P(d),
2064
- "data-testid": `credential-open-${d.id}`
2121
+ onSelect: () => R(u),
2122
+ "data-testid": `credential-open-${u.id}`
2065
2123
  },
2066
- ...j(d).map((L) => {
2067
- const F = O(L), U = q(L);
2124
+ ..._(u).map((T) => {
2125
+ const Q = K(T), V = q(T);
2068
2126
  return {
2069
- label: F ? `Stop using as my ${U} default` : `Make my default ${U} key`,
2127
+ label: Q ? `Stop using as my ${V} default` : `Make my default ${V} key`,
2070
2128
  icon: "check",
2071
- disabled: h.isPending || k.isPending,
2072
- onSelect: () => _(L, !F),
2073
- "data-testid": `credential-default-toggle-${L.connectionId}`
2129
+ disabled: h.isPending || y.isPending,
2130
+ onSelect: () => U(T, !Q),
2131
+ "data-testid": `credential-default-toggle-${T.connectionId}`
2074
2132
  };
2075
2133
  })
2076
2134
  ];
2077
2135
  return (
2078
2136
  // The menu sits inside a clickable row: its clicks must not open the row too.
2079
2137
  // biome-ignore lint/a11y/useKeyWithClickEvents: propagation guard only; the controls are inside.
2080
- /* @__PURE__ */ t("span", { className: "w6w-embed-cred-menu", onClick: (L) => L.stopPropagation(), children: /* @__PURE__ */ t(
2081
- Oe,
2138
+ /* @__PURE__ */ t("span", { className: "w6w-embed-cred-menu", onClick: (T) => T.stopPropagation(), children: /* @__PURE__ */ t(
2139
+ Fe,
2082
2140
  {
2083
- label: `Actions for ${d.name}`,
2084
- "data-testid": `credential-actions-${d.id}`,
2085
- actions: v
2141
+ label: `Actions for ${u.name}`,
2142
+ "data-testid": `credential-actions-${u.id}`,
2143
+ actions: N
2086
2144
  }
2087
2145
  ) })
2088
2146
  );
@@ -2091,23 +2149,23 @@ function Ei({
2091
2149
  ];
2092
2150
  return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-cred-list", children: [
2093
2151
  /* @__PURE__ */ r("div", { className: "w6w-connection-list-head", "data-testid": "credential-list-header", children: [
2094
- /* @__PURE__ */ t("div", { className: "w6w-connection-list-heading", children: (s == null ? void 0 : s.header) ?? /* @__PURE__ */ t("h2", { children: "Credentials" }) }),
2152
+ /* @__PURE__ */ t("div", { className: "w6w-connection-list-heading", children: (a == null ? void 0 : a.header) ?? /* @__PURE__ */ t("h2", { children: "Credentials" }) }),
2095
2153
  x && /* @__PURE__ */ t("div", { className: "w6w-connection-list-actions", children: x })
2096
2154
  ] }),
2097
- R && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
2098
- p && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-list-menu-error", children: p }),
2155
+ P && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
2156
+ c && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-list-menu-error", children: c }),
2099
2157
  l.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: l.error.message }),
2100
- !R && !l.error && S.length === 0 && /* @__PURE__ */ t("div", { "data-testid": "credential-list-empty", children: (s == null ? void 0 : s.empty) ?? /* @__PURE__ */ r(W, { children: [
2158
+ !P && !l.error && D.length === 0 && /* @__PURE__ */ t("div", { "data-testid": "credential-list-empty", children: (a == null ? void 0 : a.empty) ?? /* @__PURE__ */ r(H, { children: [
2101
2159
  /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No credentials yet." }),
2102
2160
  x
2103
2161
  ] }) }),
2104
- S.length > 0 && /* @__PURE__ */ t(
2162
+ D.length > 0 && /* @__PURE__ */ t(
2105
2163
  ke,
2106
2164
  {
2107
- columns: g,
2108
- rows: S,
2109
- rowKey: (d) => d.id,
2110
- onRowClick: (d) => P(d),
2165
+ columns: b,
2166
+ rows: D,
2167
+ rowKey: (u) => u.id,
2168
+ onRowClick: (u) => R(u),
2111
2169
  testId: "credential-list"
2112
2170
  }
2113
2171
  )
@@ -2116,14 +2174,14 @@ function Ei({
2116
2174
  function Ae({
2117
2175
  fields: e,
2118
2176
  values: n,
2119
- onChange: a,
2177
+ onChange: s,
2120
2178
  idPrefix: i
2121
2179
  }) {
2122
- return /* @__PURE__ */ t(W, { children: e.map((s) => {
2180
+ return /* @__PURE__ */ t(H, { children: e.map((a) => {
2123
2181
  const l = {
2124
- className: s.secret ? "w6w-input w6w-secret-input" : "w6w-input",
2125
- value: n[s.key] ?? "",
2126
- name: `${i}-${s.key}`,
2182
+ className: a.secret ? "w6w-input w6w-secret-input" : "w6w-input",
2183
+ value: n[a.key] ?? "",
2184
+ name: `${i}-${a.key}`,
2127
2185
  autoComplete: "off",
2128
2186
  autoCapitalize: "off",
2129
2187
  autoCorrect: "off",
@@ -2133,134 +2191,142 @@ function Ae({
2133
2191
  "data-bwignore": "true",
2134
2192
  "data-form-type": "other",
2135
2193
  // A masked field copies its dots, not the text, unless told otherwise.
2136
- ...s.secret ? ht : {}
2194
+ ...a.secret ? gn : {}
2137
2195
  };
2138
- return s.multiline ? /* @__PURE__ */ r("label", { className: "w6w-field", children: [
2139
- /* @__PURE__ */ t("span", { children: s.label }),
2140
- /* @__PURE__ */ t("textarea", { rows: 5, ...l, onChange: (o) => a(s.key, o.target.value) })
2141
- ] }, s.key) : /* @__PURE__ */ r("label", { className: "w6w-field", children: [
2142
- /* @__PURE__ */ t("span", { children: s.label }),
2143
- /* @__PURE__ */ t("input", { type: "text", ...l, onChange: (o) => a(s.key, o.target.value) })
2144
- ] }, s.key);
2196
+ return a.secret && a.multiline ? /* @__PURE__ */ t(
2197
+ pt,
2198
+ {
2199
+ field: { key: a.key, label: a.label, type: "json", secret: !0 },
2200
+ value: n[a.key] ?? "",
2201
+ onChange: (o) => s(a.key, o)
2202
+ },
2203
+ a.key
2204
+ ) : a.multiline ? /* @__PURE__ */ r("label", { className: "w6w-field", children: [
2205
+ /* @__PURE__ */ t("span", { children: a.label }),
2206
+ /* @__PURE__ */ t("textarea", { rows: 5, ...l, onChange: (o) => s(a.key, o.target.value) })
2207
+ ] }, a.key) : /* @__PURE__ */ r("label", { className: "w6w-field", children: [
2208
+ /* @__PURE__ */ t("span", { children: a.label }),
2209
+ /* @__PURE__ */ t("input", { type: "text", ...l, onChange: (o) => s(a.key, o.target.value) })
2210
+ ] }, a.key);
2145
2211
  }) });
2146
2212
  }
2147
- const $e = (e, n) => e.every((a) => (n[a.key] ?? "").length > 0), De = (e, n) => Object.fromEntries(e.map((a) => [a.key, n[a.key] ?? ""])), Is = "This provider is not supported for personal keys.", As = "Could not save the key. Nothing was kept.", $s = "Could not save the key, and a partial copy could not be removed. Remove it in Settings → Credentials.";
2148
- function Ds(e) {
2213
+ const $e = (e, n) => e.every((s) => (n[s.key] ?? "").length > 0), Se = (e, n) => Object.fromEntries(e.map((s) => [s.key, n[s.key] ?? ""])), Ds = "This provider is not supported for personal keys.", Ts = "Could not save the key. Nothing was kept.", Es = "Could not save the key, and a partial copy could not be removed. Remove it in Settings → Credentials.";
2214
+ function Ls(e) {
2149
2215
  var i;
2150
- const n = e ?? {}, a = Array.isArray(n.accepts) ? n.accepts : (i = n.serviceAccount) == null ? void 0 : i.accepts;
2151
- return Array.isArray(a) ? a.filter((s) => typeof s == "string") : [];
2216
+ const n = e ?? {}, s = Array.isArray(n.accepts) ? n.accepts : (i = n.serviceAccount) == null ? void 0 : i.accepts;
2217
+ return Array.isArray(s) ? s.filter((a) => typeof a == "string") : [];
2152
2218
  }
2153
- function Es(e, n) {
2154
- for (const a of e ?? []) {
2155
- const i = a;
2219
+ function Ms(e, n) {
2220
+ for (const s of e ?? []) {
2221
+ const i = s;
2156
2222
  if (i.type === "oauth2" || typeof i.key != "string") continue;
2157
- const s = Ds(a).find((l) => n.some((o) => o.id === l));
2158
- if (s) return { authKey: i.key, contract: s };
2223
+ const a = Ls(s).find((l) => n.some((o) => o.id === l));
2224
+ if (a) return { authKey: i.key, contract: a };
2159
2225
  }
2160
2226
  return null;
2161
2227
  }
2162
- function Wt(e) {
2228
+ function Ht(e) {
2163
2229
  const n = e ?? {};
2164
2230
  if (n.type === "oauth2" || n.userScope !== !0 || !Array.isArray(n.fields)) return null;
2165
- const a = n.fields.map((i) => i ?? {}).filter(
2231
+ const s = n.fields.map((i) => i ?? {}).filter(
2166
2232
  (i) => typeof i.key == "string"
2167
2233
  ).map((i) => ({
2168
2234
  key: i.key,
2169
2235
  label: typeof i.label == "string" ? i.label : i.key,
2170
2236
  secret: i.type === "secret" || i.secret === !0
2171
2237
  }));
2172
- return a.length > 0 ? a : null;
2238
+ return s.length > 0 ? s : null;
2173
2239
  }
2174
- function Ss(e) {
2240
+ function xs(e) {
2175
2241
  for (const n of e ?? []) {
2176
- const a = n.key, i = Wt(n);
2177
- if (typeof a == "string" && i) return { authKey: a, fields: i };
2242
+ const s = n.key, i = Ht(n);
2243
+ if (typeof s == "string" && i) return { authKey: s, fields: i };
2178
2244
  }
2179
2245
  return null;
2180
2246
  }
2181
- const oe = (e) => e.provider ?? e.appId;
2182
- function Ht({
2247
+ const ce = (e) => e.provider ?? e.appId;
2248
+ function zt({
2183
2249
  providers: e,
2184
2250
  initial: n,
2185
- types: a,
2251
+ types: s,
2186
2252
  onCreated: i,
2187
- hideHeading: s
2253
+ hideHeading: a
2188
2254
  }) {
2189
- var O, _;
2190
- const l = he(), o = de(), [u, m] = y(n), w = ((O = e.find((g) => g.appId === u)) == null ? void 0 : O.appId) ?? ((_ = e[0]) == null ? void 0 : _.appId) ?? "", N = e.find((g) => g.appId === w), [h, k] = y(""), [p, A] = y({}), [b, $] = y(null), [I, f] = y(!1), [E, S] = y(!1), C = Qe({
2191
- queryKey: ["app-auth", w],
2192
- queryFn: () => l.console.apps.getAuth(w),
2193
- enabled: w !== "",
2255
+ var K, U;
2256
+ const l = pe(), o = ue(), [d, m] = f(n), p = ((K = e.find((b) => b.appId === d)) == null ? void 0 : K.appId) ?? ((U = e[0]) == null ? void 0 : U.appId) ?? "", C = e.find((b) => b.appId === p), [h, y] = f(""), [c, k] = f({}), [g, S] = f(null), [I, A] = f(!1), [v, D] = f(!1), $ = Qe({
2257
+ queryKey: ["app-auth", p],
2258
+ queryFn: () => l.console.apps.getAuth(p),
2259
+ enabled: p !== "",
2194
2260
  retry: !1
2195
- }), Q = Es(C.data, a), P = Q ? a.find((g) => g.id === Q.contract) : void 0, x = P ? null : Ss(C.data), R = (P == null ? void 0 : P.fields) ?? (x == null ? void 0 : x.fields), j = (g) => {
2196
- m(g), A({}), $(null), S(!1);
2261
+ }), j = Ms($.data, s), R = j ? s.find((b) => b.id === j.contract) : void 0, x = R ? null : xs($.data), P = (R == null ? void 0 : R.fields) ?? (x == null ? void 0 : x.fields), _ = (b) => {
2262
+ m(b), k({}), S(null), D(!1);
2197
2263
  }, q = async () => {
2198
- if (!N || !R || I) return;
2199
- if (!$e(R, p)) {
2200
- $("Fill in every field.");
2264
+ if (!C || !P || I) return;
2265
+ if (!$e(P, c)) {
2266
+ S("Fill in every field.");
2201
2267
  return;
2202
2268
  }
2203
- $(null), S(!1);
2204
- const g = De(R, p);
2205
- if (A({}), f(!0), !Q || !P) {
2206
- if (!x) return f(!1);
2269
+ S(null), D(!1);
2270
+ const b = Se(P, c);
2271
+ if (k({}), A(!0), !j || !R) {
2272
+ if (!x) return A(!1);
2207
2273
  try {
2208
- await Je(l, w, {
2274
+ await Xe(l, p, {
2209
2275
  authKey: x.authKey,
2210
- credential: g,
2211
- displayName: h.trim() || `My ${oe(N)} key`,
2276
+ credential: b,
2277
+ displayName: h.trim() || `My ${ce(C)} key`,
2212
2278
  accessScope: "user"
2213
- }), k(""), S(!0), i == null || i();
2214
- } catch (v) {
2215
- $(me(v, "create"));
2279
+ }), y(""), D(!0), i == null || i();
2280
+ } catch (N) {
2281
+ S(he(N, "create"));
2216
2282
  } finally {
2217
- f(!1), o.invalidateQueries({ queryKey: ce });
2283
+ A(!1), o.invalidateQueries({ queryKey: de });
2218
2284
  }
2219
2285
  return;
2220
2286
  }
2221
- let d = null;
2287
+ let u = null;
2222
2288
  try {
2223
- const v = await pa(l, {
2224
- name: h.trim() || `My ${oe(N)} key`,
2225
- contract: Q.contract,
2226
- source: g,
2289
+ const N = await fa(l, {
2290
+ name: h.trim() || `My ${ce(C)} key`,
2291
+ contract: j.contract,
2292
+ source: b,
2227
2293
  accessScope: "user"
2228
2294
  });
2229
- d = v.id, await Je(l, w, {
2230
- authKey: Q.authKey,
2231
- credentialId: v.id,
2295
+ u = N.id, await Xe(l, p, {
2296
+ authKey: j.authKey,
2297
+ credentialId: N.id,
2232
2298
  accessScope: "user"
2233
- }), k(""), S(!0), i == null || i();
2234
- } catch (v) {
2235
- if (d) {
2236
- const L = await wa(l, d).then(
2237
- (F) => F.ok,
2299
+ }), y(""), D(!0), i == null || i();
2300
+ } catch (N) {
2301
+ if (u) {
2302
+ const T = await ya(l, u).then(
2303
+ (Q) => Q.ok,
2238
2304
  () => !1
2239
2305
  );
2240
- $(L ? se(v) ?? As : $s);
2306
+ S(T ? ie(N) ?? Ts : Es);
2241
2307
  } else
2242
- $(me(v, "create"));
2308
+ S(he(N, "create"));
2243
2309
  } finally {
2244
- f(!1), o.invalidateQueries({ queryKey: Dt }), o.invalidateQueries({ queryKey: ce });
2310
+ A(!1), o.invalidateQueries({ queryKey: Dt }), o.invalidateQueries({ queryKey: de });
2245
2311
  }
2246
2312
  };
2247
2313
  return /* @__PURE__ */ r(
2248
2314
  "form",
2249
2315
  {
2250
- className: s ? "w6w-card-stack" : "w6w-embed-conn-card w6w-card-stack",
2316
+ className: a ? "w6w-card-stack" : "w6w-embed-conn-card w6w-card-stack",
2251
2317
  "data-testid": "ai-key-add",
2252
- onSubmit: (g) => {
2253
- g.preventDefault(), q();
2318
+ onSubmit: (b) => {
2319
+ b.preventDefault(), q();
2254
2320
  },
2255
2321
  children: [
2256
- !s && /* @__PURE__ */ t("h3", { children: "Add a key" }),
2322
+ !a && /* @__PURE__ */ t("h3", { children: "Add a key" }),
2257
2323
  /* @__PURE__ */ r("label", { className: "w6w-field", children: [
2258
2324
  /* @__PURE__ */ t("span", { children: "Provider" }),
2259
- /* @__PURE__ */ t("select", { value: w, "aria-label": "Provider", onChange: (g) => j(g.target.value), children: e.map((g) => /* @__PURE__ */ t("option", { value: g.appId, children: oe(g) }, g.appId)) })
2325
+ /* @__PURE__ */ t("select", { value: p, "aria-label": "Provider", onChange: (b) => _(b.target.value), children: e.map((b) => /* @__PURE__ */ t("option", { value: b.appId, children: ce(b) }, b.appId)) })
2260
2326
  ] }),
2261
- C.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
2262
- !C.isLoading && !R && /* @__PURE__ */ t("p", { className: "w6w-muted", "data-testid": "ai-key-unsupported", children: Is }),
2263
- R && /* @__PURE__ */ r(W, { children: [
2327
+ $.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
2328
+ !$.isLoading && !P && /* @__PURE__ */ t("p", { className: "w6w-muted", "data-testid": "ai-key-unsupported", children: Ds }),
2329
+ P && /* @__PURE__ */ r(H, { children: [
2264
2330
  /* @__PURE__ */ r("label", { className: "w6w-field", children: [
2265
2331
  /* @__PURE__ */ t("span", { children: "Name" }),
2266
2332
  /* @__PURE__ */ t(
@@ -2269,8 +2335,8 @@ function Ht({
2269
2335
  type: "text",
2270
2336
  className: "w6w-input",
2271
2337
  value: h,
2272
- placeholder: N ? `My ${oe(N)} key` : "",
2273
- onChange: (g) => k(g.target.value),
2338
+ placeholder: C ? `My ${ce(C)} key` : "",
2339
+ onChange: (b) => y(b.target.value),
2274
2340
  maxLength: 120,
2275
2341
  autoComplete: "off"
2276
2342
  }
@@ -2279,28 +2345,28 @@ function Ht({
2279
2345
  /* @__PURE__ */ t(
2280
2346
  Ae,
2281
2347
  {
2282
- fields: R,
2283
- values: p,
2284
- onChange: (g, d) => A((v) => ({ ...v, [g]: d })),
2348
+ fields: P,
2349
+ values: c,
2350
+ onChange: (b, u) => k((N) => ({ ...N, [b]: u })),
2285
2351
  idPrefix: "w6w-ai-key-add"
2286
2352
  }
2287
2353
  ),
2288
- b && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "ai-key-add-error", children: b }),
2289
- E && /* @__PURE__ */ t("output", { "data-testid": "ai-key-saved", children: "Key saved. Only you can use it." }),
2354
+ g && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "ai-key-add-error", children: g }),
2355
+ v && /* @__PURE__ */ t("output", { "data-testid": "ai-key-saved", children: "Key saved. Only you can use it." }),
2290
2356
  /* @__PURE__ */ t("div", { className: "w6w-modal-actions", children: /* @__PURE__ */ t("button", { type: "submit", className: "w6w-btn", disabled: I, children: I ? "Saving…" : "Save key" }) })
2291
2357
  ] })
2292
2358
  ]
2293
2359
  }
2294
2360
  );
2295
2361
  }
2296
- const ve = "ai-provider-key", Ts = [
2362
+ const be = "ai-provider-key", Rs = [
2297
2363
  {
2298
2364
  value: "shared",
2299
2365
  label: "Any app that accepts it",
2300
2366
  hint: "A key, token or service account you can pick from many apps."
2301
2367
  },
2302
2368
  { value: "app", label: "One app", hint: "That app's own sign-in, with the fields it asks for." }
2303
- ], Ls = [
2369
+ ], Ps = [
2304
2370
  {
2305
2371
  value: "account",
2306
2372
  label: "This account",
@@ -2308,40 +2374,40 @@ const ve = "ai-provider-key", Ts = [
2308
2374
  },
2309
2375
  { value: "user", label: "Only me", hint: "Only you can use it. Others in the account cannot." }
2310
2376
  ];
2311
- function Si({
2377
+ function Ri({
2312
2378
  onCreated: e,
2313
2379
  onCancel: n,
2314
- aiProvider: a,
2380
+ aiProvider: s,
2315
2381
  onAiKeyCreated: i,
2316
- onAppCredentialCreated: s
2382
+ onAppCredentialCreated: a
2317
2383
  }) {
2318
- const l = de(), [o, u] = y("shared"), [m, w] = y(null), N = Ue(), h = _e(), k = N ? (h.data ?? []).filter((g) => g.designation) : [], [p, A] = y("account"), b = Ie(), $ = fa(), [I, f] = y(
2319
- a !== void 0 ? ve : null
2320
- ), [E, S] = y(""), [C, Q] = y({}), [P, x] = y(null), R = b.data ?? [], j = I === ve && k.length > 0, q = R.find((g) => g.id === I) ?? R[0], O = (g) => {
2321
- f(g), Q({}), x(null);
2322
- }, _ = () => {
2323
- if (!q || $.isPending) return;
2324
- if (E.trim() === "") {
2384
+ const l = ue(), [o, d] = f("shared"), [m, p] = f(null), C = Ve(), h = Ue(), y = C ? (h.data ?? []).filter((b) => b.designation) : [], [c, k] = f("account"), g = Ie(), S = ga(), [I, A] = f(
2385
+ s !== void 0 ? be : null
2386
+ ), [v, D] = f(""), [$, j] = f({}), [R, x] = f(null), P = g.data ?? [], _ = I === be && y.length > 0, q = P.find((b) => b.id === I) ?? P[0], K = (b) => {
2387
+ A(b), j({}), x(null);
2388
+ }, U = () => {
2389
+ if (!q || S.isPending) return;
2390
+ if (v.trim() === "") {
2325
2391
  x("Give the credential a name.");
2326
2392
  return;
2327
2393
  }
2328
- if (!$e(q.fields, C)) {
2394
+ if (!$e(q.fields, $)) {
2329
2395
  x("Fill in every field.");
2330
2396
  return;
2331
2397
  }
2332
2398
  x(null);
2333
- const g = {
2334
- name: E.trim(),
2399
+ const b = {
2400
+ name: v.trim(),
2335
2401
  contract: q.id,
2336
- source: De(q.fields, C),
2337
- ...N && p === "user" ? { accessScope: "user" } : {}
2402
+ source: Se(q.fields, $),
2403
+ ...C && c === "user" ? { accessScope: "user" } : {}
2338
2404
  };
2339
- Q({}), $.mutate(g, {
2340
- onSuccess: (d) => {
2341
- $.reset(), e == null || e(d.id);
2405
+ j({}), S.mutate(b, {
2406
+ onSuccess: (u) => {
2407
+ S.reset(), e == null || e(u.id);
2342
2408
  },
2343
- onError: (d) => {
2344
- $.reset(), x(me(d, "create"));
2409
+ onError: (u) => {
2410
+ S.reset(), x(he(u, "create"));
2345
2411
  }
2346
2412
  });
2347
2413
  };
@@ -2356,37 +2422,37 @@ function Si({
2356
2422
  "data-testid": "credential-target",
2357
2423
  children: [
2358
2424
  /* @__PURE__ */ t("span", { children: "Use it with" }),
2359
- Ts.map((g) => /* @__PURE__ */ r("label", { className: "w6w-radio", children: [
2425
+ Rs.map((b) => /* @__PURE__ */ r("label", { className: "w6w-radio", children: [
2360
2426
  /* @__PURE__ */ t(
2361
2427
  "input",
2362
2428
  {
2363
2429
  type: "radio",
2364
2430
  name: "w6w-cred-create-target",
2365
- value: g.value,
2366
- checked: o === g.value,
2431
+ value: b.value,
2432
+ checked: o === b.value,
2367
2433
  onChange: () => {
2368
- u(g.value), x(null);
2434
+ d(b.value), x(null);
2369
2435
  }
2370
2436
  }
2371
2437
  ),
2372
2438
  " ",
2373
- /* @__PURE__ */ t("strong", { children: g.label }),
2439
+ /* @__PURE__ */ t("strong", { children: b.label }),
2374
2440
  /* @__PURE__ */ r("span", { className: "w6w-muted w6w-small", children: [
2375
2441
  " ",
2376
- g.hint
2442
+ b.hint
2377
2443
  ] })
2378
- ] }, g.value))
2444
+ ] }, b.value))
2379
2445
  ]
2380
2446
  }
2381
2447
  ),
2382
2448
  o === "app" && !m && /* @__PURE__ */ r("div", { className: "w6w-card-stack", "data-testid": "credential-app-picker", children: [
2383
- /* @__PURE__ */ t(pn, { onSelectApp: w, searchPlaceholder: "Search apps…", categoryFilter: !0 }),
2449
+ /* @__PURE__ */ t(bn, { onSelectApp: p, searchPlaceholder: "Search apps…", categoryFilter: !0 }),
2384
2450
  n && /* @__PURE__ */ t("div", { className: "w6w-modal-actions", children: /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: n, children: "Cancel" }) })
2385
2451
  ] }),
2386
2452
  o === "app" && m && /* @__PURE__ */ r("div", { className: "w6w-card-stack", "data-testid": "credential-app-form", children: [
2387
2453
  /* @__PURE__ */ r("div", { className: "w6w-embed-cred-app-head", children: [
2388
2454
  /* @__PURE__ */ t(
2389
- mt,
2455
+ ht,
2390
2456
  {
2391
2457
  src: m.iconSvg,
2392
2458
  srcDark: m.iconSvgDark,
@@ -2396,46 +2462,46 @@ function Si({
2396
2462
  }
2397
2463
  ),
2398
2464
  /* @__PURE__ */ t("strong", { children: m.displayName }),
2399
- /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: () => w(null), children: "← Apps" })
2465
+ /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: () => p(null), children: "← Apps" })
2400
2466
  ] }),
2401
2467
  /* @__PURE__ */ t(
2402
- wn,
2468
+ vn,
2403
2469
  {
2404
2470
  app: m,
2405
- onCreated: ({ connectionId: g }) => {
2406
- l.invalidateQueries({ queryKey: ce }), l.invalidateQueries({ queryKey: Dt }), s == null || s(g);
2471
+ onCreated: ({ connectionId: b }) => {
2472
+ l.invalidateQueries({ queryKey: de }), l.invalidateQueries({ queryKey: Dt }), a == null || a(b);
2407
2473
  },
2408
- onClose: n ?? (() => w(null))
2474
+ onClose: n ?? (() => p(null))
2409
2475
  },
2410
2476
  m.id
2411
2477
  )
2412
2478
  ] }),
2413
- o === "shared" && b.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
2414
- o === "shared" && b.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-types-error", children: "Could not load the credential types." }),
2415
- o === "shared" && j && /* @__PURE__ */ r("div", { className: "w6w-card-stack", children: [
2416
- /* @__PURE__ */ t(nt, { list: R, value: ve, ai: !0, onChange: O }),
2479
+ o === "shared" && g.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
2480
+ o === "shared" && g.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-types-error", children: "Could not load the credential types." }),
2481
+ o === "shared" && _ && /* @__PURE__ */ r("div", { className: "w6w-card-stack", children: [
2482
+ /* @__PURE__ */ t(st, { list: P, value: be, ai: !0, onChange: K }),
2417
2483
  /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: "Only you can use it. It is never shown again after you save it." }),
2418
2484
  /* @__PURE__ */ t(
2419
- Ht,
2485
+ zt,
2420
2486
  {
2421
- providers: k,
2422
- initial: a || void 0,
2423
- types: R,
2487
+ providers: y,
2488
+ initial: s || void 0,
2489
+ types: P,
2424
2490
  onCreated: i,
2425
2491
  hideHeading: !0
2426
2492
  }
2427
2493
  ),
2428
2494
  n && /* @__PURE__ */ t("div", { className: "w6w-modal-actions", children: /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: n, children: "Cancel" }) })
2429
2495
  ] }),
2430
- o === "shared" && q && !j && /* @__PURE__ */ r(
2496
+ o === "shared" && q && !_ && /* @__PURE__ */ r(
2431
2497
  "form",
2432
2498
  {
2433
2499
  className: "w6w-card-stack",
2434
- onSubmit: (g) => {
2435
- g.preventDefault(), _();
2500
+ onSubmit: (b) => {
2501
+ b.preventDefault(), U();
2436
2502
  },
2437
2503
  children: [
2438
- /* @__PURE__ */ t(nt, { list: R, value: q.id, ai: k.length > 0, onChange: O }),
2504
+ /* @__PURE__ */ t(st, { list: P, value: q.id, ai: y.length > 0, onChange: K }),
2439
2505
  /* @__PURE__ */ r("label", { className: "w6w-field", children: [
2440
2506
  /* @__PURE__ */ t("span", { children: "Name" }),
2441
2507
  /* @__PURE__ */ t(
@@ -2443,14 +2509,14 @@ function Si({
2443
2509
  {
2444
2510
  type: "text",
2445
2511
  className: "w6w-input",
2446
- value: E,
2447
- onChange: (g) => S(g.target.value),
2512
+ value: v,
2513
+ onChange: (b) => D(b.target.value),
2448
2514
  maxLength: 120,
2449
2515
  autoComplete: "off"
2450
2516
  }
2451
2517
  )
2452
2518
  ] }),
2453
- N && /* @__PURE__ */ r(
2519
+ C && /* @__PURE__ */ r(
2454
2520
  "div",
2455
2521
  {
2456
2522
  role: "radiogroup",
@@ -2459,24 +2525,24 @@ function Si({
2459
2525
  "data-testid": "credential-owner",
2460
2526
  children: [
2461
2527
  /* @__PURE__ */ t("span", { children: "Who can use it" }),
2462
- Ls.map((g) => /* @__PURE__ */ r("label", { className: "w6w-radio", children: [
2528
+ Ps.map((b) => /* @__PURE__ */ r("label", { className: "w6w-radio", children: [
2463
2529
  /* @__PURE__ */ t(
2464
2530
  "input",
2465
2531
  {
2466
2532
  type: "radio",
2467
2533
  name: "w6w-cred-create-owner",
2468
- value: g.value,
2469
- checked: p === g.value,
2470
- onChange: () => A(g.value)
2534
+ value: b.value,
2535
+ checked: c === b.value,
2536
+ onChange: () => k(b.value)
2471
2537
  }
2472
2538
  ),
2473
2539
  " ",
2474
- /* @__PURE__ */ t("strong", { children: g.label }),
2540
+ /* @__PURE__ */ t("strong", { children: b.label }),
2475
2541
  /* @__PURE__ */ r("span", { className: "w6w-muted w6w-small", children: [
2476
2542
  " ",
2477
- g.hint
2543
+ b.hint
2478
2544
  ] })
2479
- ] }, g.value))
2545
+ ] }, b.value))
2480
2546
  ]
2481
2547
  }
2482
2548
  ),
@@ -2484,14 +2550,14 @@ function Si({
2484
2550
  Ae,
2485
2551
  {
2486
2552
  fields: q.fields,
2487
- values: C,
2488
- onChange: (g, d) => Q((v) => ({ ...v, [g]: d })),
2553
+ values: $,
2554
+ onChange: (b, u) => j((N) => ({ ...N, [b]: u })),
2489
2555
  idPrefix: "w6w-cred-create"
2490
2556
  }
2491
2557
  ),
2492
- P && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-create-error", children: P }),
2558
+ R && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-create-error", children: R }),
2493
2559
  /* @__PURE__ */ r("div", { className: "w6w-modal-actions", children: [
2494
- /* @__PURE__ */ t("button", { type: "submit", className: "w6w-btn", disabled: $.isPending, children: $.isPending ? "Creating…" : "Create credential" }),
2560
+ /* @__PURE__ */ t("button", { type: "submit", className: "w6w-btn", disabled: S.isPending, children: S.isPending ? "Creating…" : "Create credential" }),
2495
2561
  n && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: n, children: "Cancel" })
2496
2562
  ] })
2497
2563
  ]
@@ -2499,7 +2565,7 @@ function Si({
2499
2565
  )
2500
2566
  ] });
2501
2567
  }
2502
- function nt(e) {
2568
+ function st(e) {
2503
2569
  return /* @__PURE__ */ r("label", { className: "w6w-field", children: [
2504
2570
  /* @__PURE__ */ t("span", { children: "Type" }),
2505
2571
  /* @__PURE__ */ r(
@@ -2510,14 +2576,18 @@ function nt(e) {
2510
2576
  onChange: (n) => e.onChange(n.target.value),
2511
2577
  children: [
2512
2578
  e.list.map((n) => /* @__PURE__ */ t("option", { value: n.id, children: n.label }, n.id)),
2513
- e.ai && /* @__PURE__ */ t("option", { value: ve, children: "AI provider key (only you)" })
2579
+ e.ai && /* @__PURE__ */ t("option", { value: be, children: "AI provider key (only you)" })
2514
2580
  ]
2515
2581
  }
2516
2582
  )
2517
2583
  ] });
2518
2584
  }
2519
- const at = "google-service-account.v1";
2520
- function Ms(e) {
2585
+ const Me = "google-service-account.v1";
2586
+ function Ks(e) {
2587
+ const s = e.replace(/([a-z])([A-Z])/g, "$1 $2").split(/[_\s]+/).filter(Boolean).map((i) => /^(id|url|uri|api)$/i.test(i) ? i.toUpperCase() : i.toLowerCase()).join(" ");
2588
+ return s.charAt(0).toUpperCase() + s.slice(1);
2589
+ }
2590
+ function Os(e) {
2521
2591
  try {
2522
2592
  const n = JSON.parse(e);
2523
2593
  return n !== null && typeof n == "object" && !Array.isArray(n) ? n : null;
@@ -2525,177 +2595,138 @@ function Ms(e) {
2525
2595
  return null;
2526
2596
  }
2527
2597
  }
2528
- const st = (e) => Number.isNaN(Date.parse(e)) ? e : new Date(e).toLocaleString();
2529
- function Ti(e) {
2530
- return /* @__PURE__ */ t(xs, { ...e }, e.credentialId);
2598
+ const it = (e) => Number.isNaN(Date.parse(e)) ? e : new Date(e).toLocaleString();
2599
+ function Pi(e) {
2600
+ return /* @__PURE__ */ t(Fs, { ...e }, e.credentialId);
2531
2601
  }
2532
- function xs({
2602
+ function Fs({
2533
2603
  credentialId: e,
2534
2604
  onOpenConnection: n,
2535
- onDeleted: a,
2605
+ onDeleted: s,
2536
2606
  onBack: i,
2537
- slots: s
2607
+ slots: a
2538
2608
  }) {
2539
- var G, D, V;
2540
- const l = ya(e), o = ga(e), u = Et(e), m = St(e), w = va(e), N = Tt(), h = Ie(), [k, p] = y(""), [A, b] = y({}), [$, I] = y(null), [f, E] = y(!1), [S, C] = y(null), [Q, P] = y(null), [x, R] = y(!1), [j, q] = y(null), [O, _] = y(null), g = i && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: i, children: "← Credentials" });
2609
+ var w, F, G, X, Z;
2610
+ const l = ba(e), o = va(e), d = Tt(e), m = Et(e), p = Na(e), C = Lt(), h = Ie(), [y, c] = f(""), [k, g] = f({}), [S, I] = f(null), [A, v] = f(!1), [D, $] = f(!1), [j, R] = f(null), [x, P] = f(null), [_, q] = f(!1), [K, U] = f(null), [b, u] = f(null), N = i && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost w6w-btn-sm", onClick: i, children: "← Credentials" });
2541
2611
  if (l.isLoading)
2542
2612
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root w6w-embed-cred-detail", children: /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) });
2543
- const d = l.data;
2544
- if (!d)
2613
+ const T = l.data;
2614
+ if (!T)
2545
2615
  return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-cred-detail", "data-testid": "credential-not-found", children: [
2546
- (s == null ? void 0 : s.empty) ?? /* @__PURE__ */ t("h2", { children: "Credential not found" }),
2547
- g
2616
+ (a == null ? void 0 : a.empty) ?? /* @__PURE__ */ t("h2", { children: "Credential not found" }),
2617
+ N
2548
2618
  ] });
2549
- const v = ((G = o.data) == null ? void 0 : G.connections) ?? [], L = d.connectionCount, F = d.status === "disabled", U = d.contract === at || (D = h.data) == null ? void 0 : D.find((c) => c.id === d.contract), B = d.contract !== at && h.isLoading, H = () => {
2550
- if (!U) return;
2551
- if (E(!1), !$e(U.fields, A)) {
2619
+ const Q = ((w = o.data) == null ? void 0 : w.connections) ?? [], V = T.connectionCount, z = T.status === "disabled", B = T.contract === Me || (F = h.data) == null ? void 0 : F.find((M) => M.id === T.contract), L = T.contract !== Me && h.isLoading, O = ((X = (G = h.data) == null ? void 0 : G.find((M) => M.id === T.contract)) == null ? void 0 : X.label) ?? T.contract, J = () => {
2620
+ if (!B) return;
2621
+ if (v(!1), !$e(B.fields, k)) {
2552
2622
  I("Fill in every field.");
2553
2623
  return;
2554
2624
  }
2555
2625
  I(null);
2556
- const c = De(U.fields, A);
2557
- b({}), u.mutate(
2558
- { source: c },
2626
+ const M = Se(B.fields, k);
2627
+ g({}), d.mutate(
2628
+ { source: M },
2559
2629
  {
2560
2630
  onSuccess: () => {
2561
- u.reset(), E(!0);
2631
+ d.reset(), v(!0), $(!1);
2562
2632
  },
2563
- onError: (M) => {
2564
- u.reset(), I(me(M, "rotate"));
2633
+ onError: (Y) => {
2634
+ d.reset(), I(he(Y, "rotate"));
2565
2635
  }
2566
2636
  }
2567
2637
  );
2568
- }, T = () => {
2569
- E(!1);
2570
- const c = Ms(k);
2571
- if (!c) {
2638
+ }, te = () => {
2639
+ v(!1);
2640
+ const M = Os(y);
2641
+ if (!M) {
2572
2642
  I("Enter the new secret as a JSON object.");
2573
2643
  return;
2574
2644
  }
2575
- I(null), u.mutate(
2576
- { source: c },
2645
+ I(null), d.mutate(
2646
+ { source: M },
2577
2647
  {
2578
2648
  onSuccess: () => {
2579
- p(""), E(!0);
2649
+ c(""), v(!0), $(!1);
2580
2650
  },
2581
- onError: (M) => I(se(M) ?? (M == null ? void 0 : M.message) ?? "Rotate failed.")
2651
+ onError: (Y) => I(
2652
+ ie(Y) ?? (Y == null ? void 0 : Y.message) ?? "Replacing the secret failed."
2653
+ )
2582
2654
  }
2583
2655
  );
2584
- }, K = () => {
2585
- C(null), P(null), w.mutate(void 0, {
2586
- onSuccess: C,
2587
- onError: (c) => P(se(c) ?? (c == null ? void 0 : c.message) ?? "Test failed.")
2656
+ }, E = () => {
2657
+ R(null), P(null), p.mutate(void 0, {
2658
+ onSuccess: R,
2659
+ onError: (M) => P(ie(M) ?? (M == null ? void 0 : M.message) ?? "Test failed.")
2588
2660
  });
2589
- }, Y = () => {
2590
- _(null), N.mutate(e, {
2591
- onSuccess: (c) => {
2592
- R(!1), c.ok ? a == null || a() : q(c.dependents.connections);
2661
+ }, W = () => {
2662
+ u(null), C.mutate(e, {
2663
+ onSuccess: (M) => {
2664
+ q(!1), M.ok ? s == null || s() : U(M.dependents.connections);
2593
2665
  },
2594
- onError: (c) => _(se(c) ?? (c == null ? void 0 : c.message) ?? "Delete failed.")
2666
+ onError: (M) => u(ie(M) ?? (M == null ? void 0 : M.message) ?? "Delete failed.")
2595
2667
  });
2596
2668
  };
2597
2669
  return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-cred-detail w6w-card-stack", children: [
2598
- /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
2599
- /* @__PURE__ */ t("h2", { children: d.name }),
2600
- /* @__PURE__ */ r("p", { className: "w6w-small", children: [
2601
- /* @__PURE__ */ t("code", { children: d.contract }),
2602
- " ",
2603
- /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: d.status })
2670
+ /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card w6w-embed-cred-head", children: [
2671
+ N,
2672
+ /* @__PURE__ */ r("div", { className: "w6w-embed-cred-title", children: [
2673
+ /* @__PURE__ */ t("h2", { children: T.name }),
2674
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: T.status })
2604
2675
  ] }),
2605
- /* @__PURE__ */ r("p", { className: "w6w-small", children: [
2606
- /* @__PURE__ */ t("span", { "data-testid": "credential-scope", children: $t(d.accessScope) }),
2607
- /* @__PURE__ */ t("span", { className: "w6w-muted", children: " · Reusable credential" })
2676
+ /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", children: [
2677
+ O,
2678
+ " ·",
2679
+ " ",
2680
+ /* @__PURE__ */ t("span", { "data-testid": "credential-scope", children: St(T.accessScope) }),
2681
+ " · Reusable credential"
2608
2682
  ] }),
2609
- /* @__PURE__ */ t("dl", { className: "w6w-small", "data-testid": "credential-display", children: Object.entries(d.display).map(([c, M]) => /* @__PURE__ */ r("div", { children: [
2610
- /* @__PURE__ */ t("dt", { className: "w6w-muted", children: c }),
2611
- /* @__PURE__ */ t("dd", { children: M })
2612
- ] }, c)) }),
2683
+ /* @__PURE__ */ t("dl", { className: "w6w-embed-cred-facts", "data-testid": "credential-display", children: Object.entries(T.display).map(([M, Y]) => /* @__PURE__ */ r("div", { children: [
2684
+ /* @__PURE__ */ t("dt", { children: Ks(M) }),
2685
+ /* @__PURE__ */ t("dd", { children: /* @__PURE__ */ t("code", { children: Y }) })
2686
+ ] }, M)) }),
2613
2687
  /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", children: [
2614
- L,
2688
+ V,
2615
2689
  " connection",
2616
- L === 1 ? "" : "s",
2690
+ V === 1 ? "" : "s",
2617
2691
  " · created ",
2618
- st(d.createdAt),
2619
- " · updated",
2620
- " ",
2621
- st(d.updatedAt)
2622
- ] }),
2623
- g
2692
+ it(T.createdAt),
2693
+ T.updatedAt !== T.createdAt ? ` · updated ${it(T.updatedAt)}` : ""
2694
+ ] })
2624
2695
  ] }),
2625
2696
  /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", "data-testid": "credential-connections", children: [
2626
2697
  /* @__PURE__ */ t("h3", { children: "Connected apps" }),
2627
- v.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Not used by any connection." }) : /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Connected apps", children: v.map((c) => /* @__PURE__ */ t("li", { children: n ? /* @__PURE__ */ t(
2698
+ Q.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Not used by any connection." }) : /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Connected apps", children: Q.map((M) => /* @__PURE__ */ t("li", { children: n ? /* @__PURE__ */ t(
2628
2699
  "button",
2629
2700
  {
2630
2701
  type: "button",
2631
2702
  className: "w6w-embed-conn-action",
2632
- onClick: () => n(c.id),
2633
- children: c.displayName || c.appId
2634
- }
2635
- ) : /* @__PURE__ */ t("span", { children: c.displayName || c.appId }) }, c.id)) })
2636
- ] }),
2637
- /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
2638
- /* @__PURE__ */ t("h3", { children: "Rotate secret" }),
2639
- /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", "data-testid": "credential-rotation-impact", children: [
2640
- L,
2641
- " connection",
2642
- L === 1 ? "" : "s",
2643
- " will be marked untested"
2644
- ] }),
2645
- B && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
2646
- U && /* @__PURE__ */ t(
2647
- Ae,
2648
- {
2649
- fields: U.fields,
2650
- values: A,
2651
- onChange: (c, M) => b((z) => ({ ...z, [c]: M })),
2652
- idPrefix: "w6w-cred-rotate"
2653
- }
2654
- ),
2655
- !B && !U && /* @__PURE__ */ t(
2656
- "textarea",
2657
- {
2658
- className: "w6w-input w6w-secret-input",
2659
- ...ht,
2660
- "aria-label": "New secret (JSON object)",
2661
- rows: 5,
2662
- value: k,
2663
- onChange: (c) => p(c.target.value),
2664
- name: "w6w-cred-rotate",
2665
- autoComplete: "off",
2666
- autoCapitalize: "off",
2667
- autoCorrect: "off",
2668
- spellCheck: !1,
2669
- "data-1p-ignore": "true",
2670
- "data-lpignore": "true",
2671
- "data-bwignore": "true",
2672
- "data-form-type": "other"
2703
+ onClick: () => n(M.id),
2704
+ children: M.displayName || M.appId
2673
2705
  }
2674
- ),
2675
- $ && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-rotate-error", children: $ }),
2676
- f && /* @__PURE__ */ t("output", { children: "Secret rotated." }),
2677
- /* @__PURE__ */ t(
2678
- "button",
2679
- {
2680
- type: "button",
2681
- className: "w6w-btn",
2682
- disabled: u.isPending || B,
2683
- onClick: U ? H : T,
2684
- children: u.isPending ? "Rotating…" : "Rotate"
2685
- }
2686
- )
2706
+ ) : /* @__PURE__ */ t("span", { children: M.displayName || M.appId }) }, M.id)) })
2687
2707
  ] }),
2688
2708
  /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
2689
2709
  /* @__PURE__ */ t("h3", { children: "Manage" }),
2690
- /* @__PURE__ */ r("div", { className: "w6w-modal-actions", children: [
2710
+ /* @__PURE__ */ r("div", { className: "w6w-embed-cred-actions", children: [
2691
2711
  /* @__PURE__ */ t(
2692
2712
  "button",
2693
2713
  {
2694
2714
  type: "button",
2695
2715
  className: "w6w-btn w6w-btn-ghost",
2696
- disabled: m.isPending,
2697
- onClick: () => m.mutate(F ? "active" : "disabled"),
2698
- children: F ? "Enable" : "Disable"
2716
+ disabled: p.isPending,
2717
+ onClick: E,
2718
+ children: p.isPending ? "Testing…" : "Test credential"
2719
+ }
2720
+ ),
2721
+ !D && /* @__PURE__ */ t(
2722
+ "button",
2723
+ {
2724
+ type: "button",
2725
+ className: "w6w-btn w6w-btn-ghost",
2726
+ onClick: () => {
2727
+ v(!1), I(null), $(!0);
2728
+ },
2729
+ children: "Replace secret"
2699
2730
  }
2700
2731
  ),
2701
2732
  /* @__PURE__ */ t(
@@ -2703,9 +2734,9 @@ function xs({
2703
2734
  {
2704
2735
  type: "button",
2705
2736
  className: "w6w-btn w6w-btn-ghost",
2706
- disabled: w.isPending,
2707
- onClick: K,
2708
- children: w.isPending ? "Testing…" : "Test credential"
2737
+ disabled: m.isPending,
2738
+ onClick: () => m.mutate(z ? "active" : "disabled"),
2739
+ children: z ? "Enable" : "Disable"
2709
2740
  }
2710
2741
  ),
2711
2742
  /* @__PURE__ */ t(
@@ -2714,19 +2745,76 @@ function xs({
2714
2745
  type: "button",
2715
2746
  className: "w6w-btn w6w-btn-danger",
2716
2747
  onClick: () => {
2717
- q(null), R(!0);
2748
+ U(null), q(!0);
2718
2749
  },
2719
2750
  children: "Delete"
2720
2751
  }
2721
2752
  )
2722
2753
  ] }),
2723
- S && /* @__PURE__ */ t("output", { "data-testid": "credential-test-result", children: S.ok ? "ok" : S.code ?? "failed" }),
2724
- Q && /* @__PURE__ */ t("p", { role: "alert", children: Q }),
2725
- m.isError && /* @__PURE__ */ t("p", { role: "alert", children: se(m.error) ?? ((V = m.error) == null ? void 0 : V.message) ?? "Update failed." }),
2726
- x && /* @__PURE__ */ r("div", { "data-testid": "credential-delete-confirm", children: [
2754
+ A && /* @__PURE__ */ t("output", { children: "Secret replaced." }),
2755
+ D && /* @__PURE__ */ r("div", { className: "w6w-embed-cred-replace", "data-testid": "credential-replace", children: [
2756
+ /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", "data-testid": "credential-rotation-impact", children: [
2757
+ "Paste the new secret. The old one stops working for w6w at once",
2758
+ V > 0 ? `, and ${V} connection${V === 1 ? "" : "s"} will need a new test` : "",
2759
+ "."
2760
+ ] }),
2761
+ L && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
2762
+ B && /* @__PURE__ */ t(
2763
+ Ae,
2764
+ {
2765
+ fields: B.fields,
2766
+ values: k,
2767
+ onChange: (M, Y) => g((le) => ({ ...le, [M]: Y })),
2768
+ idPrefix: "w6w-cred-rotate"
2769
+ }
2770
+ ),
2771
+ !L && !B && // The whole JSON source (a service-account key file, or an unknown contract's
2772
+ // object): pasted in the clear, then previewed with its private parts hidden.
2773
+ /* @__PURE__ */ t(
2774
+ pt,
2775
+ {
2776
+ field: {
2777
+ key: "rotate",
2778
+ label: T.contract === Me ? "New key (JSON)" : "New secret (JSON object)",
2779
+ type: "json",
2780
+ secret: !0
2781
+ },
2782
+ value: y,
2783
+ onChange: c
2784
+ }
2785
+ ),
2786
+ S && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-rotate-error", children: S }),
2787
+ /* @__PURE__ */ r("div", { className: "w6w-embed-cred-actions", children: [
2788
+ /* @__PURE__ */ t(
2789
+ "button",
2790
+ {
2791
+ type: "button",
2792
+ className: "w6w-btn",
2793
+ disabled: d.isPending || L,
2794
+ onClick: B ? J : te,
2795
+ children: d.isPending ? "Saving…" : "Save new secret"
2796
+ }
2797
+ ),
2798
+ /* @__PURE__ */ t(
2799
+ "button",
2800
+ {
2801
+ type: "button",
2802
+ className: "w6w-btn w6w-btn-ghost",
2803
+ onClick: () => {
2804
+ $(!1), c(""), g({}), I(null);
2805
+ },
2806
+ children: "Cancel"
2807
+ }
2808
+ )
2809
+ ] })
2810
+ ] }),
2811
+ j && /* @__PURE__ */ t("output", { "data-testid": "credential-test-result", children: j.ok ? "ok" : j.code ?? "failed" }),
2812
+ x && /* @__PURE__ */ t("p", { role: "alert", children: x }),
2813
+ m.isError && /* @__PURE__ */ t("p", { role: "alert", children: ie(m.error) ?? ((Z = m.error) == null ? void 0 : Z.message) ?? "Update failed." }),
2814
+ _ && /* @__PURE__ */ r("div", { "data-testid": "credential-delete-confirm", children: [
2727
2815
  /* @__PURE__ */ r("p", { className: "w6w-small", children: [
2728
2816
  'Delete the credential "',
2729
- d.name,
2817
+ T.name,
2730
2818
  '"? This cannot be undone.'
2731
2819
  ] }),
2732
2820
  /* @__PURE__ */ t(
@@ -2734,8 +2822,8 @@ function xs({
2734
2822
  {
2735
2823
  type: "button",
2736
2824
  className: "w6w-btn w6w-btn-danger",
2737
- disabled: N.isPending,
2738
- onClick: Y,
2825
+ disabled: C.isPending,
2826
+ onClick: W,
2739
2827
  children: "Confirm delete"
2740
2828
  }
2741
2829
  ),
@@ -2745,194 +2833,194 @@ function xs({
2745
2833
  {
2746
2834
  type: "button",
2747
2835
  className: "w6w-btn w6w-btn-ghost",
2748
- onClick: () => R(!1),
2836
+ onClick: () => q(!1),
2749
2837
  children: "Cancel"
2750
2838
  }
2751
2839
  )
2752
2840
  ] }),
2753
- j && /* @__PURE__ */ r("div", { role: "alert", "data-testid": "credential-in-use", children: [
2841
+ K && /* @__PURE__ */ r("div", { role: "alert", "data-testid": "credential-in-use", children: [
2754
2842
  /* @__PURE__ */ r("p", { className: "w6w-small", children: [
2755
2843
  "This credential is still used by ",
2756
- j.length,
2844
+ K.length,
2757
2845
  " connection",
2758
- j.length === 1 ? "" : "s",
2846
+ K.length === 1 ? "" : "s",
2759
2847
  ". Delete those integrations first, or rotate this credential instead of deleting it."
2760
2848
  ] }),
2761
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", children: j.map((c) => /* @__PURE__ */ t("li", { children: c.displayName || c.appId }, c.id)) })
2849
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", children: K.map((M) => /* @__PURE__ */ t("li", { children: M.displayName || M.appId }, M.id)) })
2762
2850
  ] }),
2763
- O && /* @__PURE__ */ t("p", { role: "alert", children: O })
2851
+ b && /* @__PURE__ */ t("p", { role: "alert", children: b })
2764
2852
  ] })
2765
2853
  ] });
2766
2854
  }
2767
- const Rs = "Keys that only you can use are not turned on for this account.", Ps = "Models that only your personal key can see are not added to the account's catalog.", it = "The key was removed, but its stored copy was not.";
2768
- function Ks(e, n, a) {
2769
- const i = he(), s = Qe({
2855
+ const js = "Keys that only you can use are not turned on for this account.", Qs = "Models that only your personal key can see are not added to the account's catalog.", lt = "The key was removed, but its stored copy was not.";
2856
+ function qs(e, n, s) {
2857
+ const i = pe(), a = Qe({
2770
2858
  queryKey: ["app-auth", e],
2771
2859
  queryFn: () => i.console.apps.getAuth(e),
2772
- enabled: a,
2860
+ enabled: s,
2773
2861
  retry: !1
2774
2862
  });
2775
- return Wt((s.data ?? []).find((l) => l.key === n));
2863
+ return Ht((a.data ?? []).find((l) => l.key === n));
2776
2864
  }
2777
- function Li({ providerAppId: e }) {
2778
- const n = Ue(), a = _e(), i = qe(), s = At({ accessScope: "user" }), l = kt(n), o = Ie(), u = (a.data ?? []).filter((p) => p.designation), m = new Map((s.data ?? []).map((p) => [p.id, p])), w = (i.data ?? []).filter(
2779
- (p) => p.accessScope === "user" && p.credentialId && (m.has(p.credentialId) || s.data !== void 0)
2780
- ), N = l.data ?? [], [h, k] = y(null);
2865
+ function Ki({ providerAppId: e }) {
2866
+ const n = Ve(), s = Ue(), i = _e(), a = $t({ accessScope: "user" }), l = Ct(n), o = Ie(), d = (s.data ?? []).filter((c) => c.designation), m = new Map((a.data ?? []).map((c) => [c.id, c])), p = (i.data ?? []).filter(
2867
+ (c) => c.accessScope === "user" && c.credentialId && (m.has(c.credentialId) || a.data !== void 0)
2868
+ ), C = l.data ?? [], [h, y] = f(null);
2781
2869
  return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-ai-keys w6w-card-stack", "data-testid": "my-ai-keys", children: [
2782
2870
  /* @__PURE__ */ t("h2", { children: "My AI keys" }),
2783
2871
  /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: "Keys that only you can use. They are never shown again after you save them." }),
2784
- /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", "data-testid": "ai-keys-private-note", children: Ps }),
2785
- !n && /* @__PURE__ */ t("output", { className: "w6w-muted", "data-testid": "ai-keys-disabled", children: Rs }),
2786
- (a.isLoading || i.isLoading || s.isLoading) && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
2787
- a.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: "Could not load the AI providers." }),
2788
- n && u.length > 0 && /* @__PURE__ */ t(Ht, { providers: u, initial: e, types: o.data ?? [] }),
2789
- !a.isLoading && !a.error && u.length === 0 && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No AI providers are available." }),
2872
+ /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", "data-testid": "ai-keys-private-note", children: Qs }),
2873
+ !n && /* @__PURE__ */ t("output", { className: "w6w-muted", "data-testid": "ai-keys-disabled", children: js }),
2874
+ (s.isLoading || i.isLoading || a.isLoading) && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
2875
+ s.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: "Could not load the AI providers." }),
2876
+ n && d.length > 0 && /* @__PURE__ */ t(zt, { providers: d, initial: e, types: o.data ?? [] }),
2877
+ !s.isLoading && !s.error && d.length === 0 && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No AI providers are available." }),
2790
2878
  h && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "ai-keys-notice", children: h }),
2791
- u.map((p) => {
2792
- const A = w.filter((b) => b.appId === p.appId);
2793
- return A.length === 0 ? null : /* @__PURE__ */ t(
2794
- Os,
2879
+ d.map((c) => {
2880
+ const k = p.filter((g) => g.appId === c.appId);
2881
+ return k.length === 0 ? null : /* @__PURE__ */ t(
2882
+ _s,
2795
2883
  {
2796
- provider: p,
2797
- keys: A,
2884
+ provider: c,
2885
+ keys: k,
2798
2886
  creds: m,
2799
- current: N.find((b) => b.providerAppId === p.appId),
2887
+ current: C.find((g) => g.providerAppId === c.appId),
2800
2888
  types: o.data ?? [],
2801
- onNotice: k
2889
+ onNotice: y
2802
2890
  },
2803
- p.appId
2891
+ c.appId
2804
2892
  );
2805
2893
  })
2806
2894
  ] });
2807
2895
  }
2808
- function Os({
2896
+ function _s({
2809
2897
  provider: e,
2810
2898
  keys: n,
2811
- creds: a,
2899
+ creds: s,
2812
2900
  current: i,
2813
- types: s,
2901
+ types: a,
2814
2902
  onNotice: l
2815
2903
  }) {
2816
- const o = Ct(), u = It(), [m, w] = y(null), N = e.appId, h = i && n.some((p) => p.id === i.connectionId) ? i : void 0, k = (p) => {
2817
- w(null);
2818
- const A = {
2819
- onError: (b) => w(se(b) ?? "Could not change the default key.")
2904
+ const o = It(), d = At(), [m, p] = f(null), C = e.appId, h = i && n.some((c) => c.id === i.connectionId) ? i : void 0, y = (c) => {
2905
+ p(null);
2906
+ const k = {
2907
+ onError: (g) => p(ie(g) ?? "Could not change the default key.")
2820
2908
  };
2821
- p === null ? u.mutate(N, A) : o.mutate({ providerAppId: N, connectionId: p }, A);
2909
+ c === null ? d.mutate(C, k) : o.mutate({ providerAppId: C, connectionId: c }, k);
2822
2910
  };
2823
- return /* @__PURE__ */ r("section", { className: "w6w-embed-conn-card w6w-card-stack", "data-testid": `ai-provider-${N}`, children: [
2824
- /* @__PURE__ */ t("h3", { children: oe(e) }),
2825
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": `${oe(e)} keys`, children: n.map((p) => {
2826
- const A = a.get(p.credentialId);
2911
+ return /* @__PURE__ */ r("section", { className: "w6w-embed-conn-card w6w-card-stack", "data-testid": `ai-provider-${C}`, children: [
2912
+ /* @__PURE__ */ t("h3", { children: ce(e) }),
2913
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": `${ce(e)} keys`, children: n.map((c) => {
2914
+ const k = s.get(c.credentialId);
2827
2915
  return /* @__PURE__ */ t(
2828
- Fs,
2916
+ Us,
2829
2917
  {
2830
- connection: p,
2831
- credential: A,
2832
- descriptor: A ? s.find((b) => b.id === A.contract) : void 0,
2918
+ connection: c,
2919
+ credential: k,
2920
+ descriptor: k ? a.find((g) => g.id === k.contract) : void 0,
2833
2921
  onNotice: l
2834
2922
  },
2835
- p.id
2923
+ c.id
2836
2924
  );
2837
2925
  }) }),
2838
- /* @__PURE__ */ r("div", { role: "radiogroup", "aria-label": `Default key for ${oe(e)}`, children: [
2926
+ /* @__PURE__ */ r("div", { role: "radiogroup", "aria-label": `Default key for ${ce(e)}`, children: [
2839
2927
  /* @__PURE__ */ t("span", { className: "w6w-small", children: "Default key" }),
2840
2928
  /* @__PURE__ */ r("label", { className: "w6w-radio", children: [
2841
2929
  /* @__PURE__ */ t(
2842
2930
  "input",
2843
2931
  {
2844
2932
  type: "radio",
2845
- name: `ai-default-${N}`,
2933
+ name: `ai-default-${C}`,
2846
2934
  checked: !h,
2847
2935
  onChange: () => {
2848
- h && k(null);
2936
+ h && y(null);
2849
2937
  }
2850
2938
  }
2851
2939
  ),
2852
2940
  " ",
2853
2941
  "None"
2854
2942
  ] }),
2855
- n.map((p) => /* @__PURE__ */ r("label", { className: "w6w-radio", children: [
2943
+ n.map((c) => /* @__PURE__ */ r("label", { className: "w6w-radio", children: [
2856
2944
  /* @__PURE__ */ t(
2857
2945
  "input",
2858
2946
  {
2859
2947
  type: "radio",
2860
- name: `ai-default-${N}`,
2861
- "data-testid": `ai-default-${p.id}`,
2862
- checked: (h == null ? void 0 : h.connectionId) === p.id,
2863
- onChange: () => k(p.id)
2948
+ name: `ai-default-${C}`,
2949
+ "data-testid": `ai-default-${c.id}`,
2950
+ checked: (h == null ? void 0 : h.connectionId) === c.id,
2951
+ onChange: () => y(c.id)
2864
2952
  }
2865
2953
  ),
2866
2954
  " ",
2867
- p.displayName
2868
- ] }, p.id))
2955
+ c.displayName
2956
+ ] }, c.id))
2869
2957
  ] }),
2870
- (i == null ? void 0 : i.status) === "unavailable" && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": `ai-default-warning-${N}`, children: "Your default key for this provider is not available. Enable it, replace it or pick another." }),
2958
+ (i == null ? void 0 : i.status) === "unavailable" && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": `ai-default-warning-${C}`, children: "Your default key for this provider is not available. Enable it, replace it or pick another." }),
2871
2959
  m && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: m })
2872
2960
  ] });
2873
2961
  }
2874
- function Fs({
2962
+ function Us({
2875
2963
  connection: e,
2876
2964
  credential: n,
2877
- descriptor: a,
2965
+ descriptor: s,
2878
2966
  onNotice: i
2879
2967
  }) {
2880
- const s = Nt(e.id), l = Et((n == null ? void 0 : n.id) ?? ""), o = St((n == null ? void 0 : n.id) ?? ""), u = ra(e.id), m = Ks(e.appId, e.authKey, !n), w = n ? a == null ? void 0 : a.fields : m ?? void 0, N = vt(), h = Tt(), [k, p] = y(!1), [A, b] = y({}), [$, I] = y(!1), [f, E] = y(null), [S, C] = y(null), [Q, P] = y(null), x = (n == null ? void 0 : n.status) === "disabled", R = n ? Object.values(n.display)[0] : void 0, j = n ? l.isPending : u.isPending, q = (d, v) => C(se(d) ?? v), O = () => {
2881
- P(null), C(null), s.mutate(void 0, {
2882
- onSuccess: (d) => P(d.ok ? "ok" : "failed"),
2883
- onError: (d) => q(d, "Could not test the key.")
2968
+ const a = kt(e.id), l = Tt((n == null ? void 0 : n.id) ?? ""), o = Et((n == null ? void 0 : n.id) ?? ""), d = ca(e.id), m = qs(e.appId, e.authKey, !n), p = n ? s == null ? void 0 : s.fields : m ?? void 0, C = vt(), h = Lt(), [y, c] = f(!1), [k, g] = f({}), [S, I] = f(!1), [A, v] = f(null), [D, $] = f(null), [j, R] = f(null), x = (n == null ? void 0 : n.status) === "disabled", P = n ? Object.values(n.display)[0] : void 0, _ = n ? l.isPending : d.isPending, q = (u, N) => $(ie(u) ?? N), K = () => {
2969
+ R(null), $(null), a.mutate(void 0, {
2970
+ onSuccess: (u) => R(u.ok ? "ok" : "failed"),
2971
+ onError: (u) => q(u, "Could not test the key.")
2884
2972
  });
2885
- }, _ = () => {
2886
- if (!w) return;
2887
- if (E(null), !$e(w, A)) {
2888
- C("Fill in every field.");
2973
+ }, U = () => {
2974
+ if (!p) return;
2975
+ if (v(null), !$e(p, k)) {
2976
+ $("Fill in every field.");
2889
2977
  return;
2890
2978
  }
2891
- C(null);
2892
- const d = De(w, A);
2893
- if (b({}), !n) {
2894
- u.mutate(
2895
- { credential: d },
2979
+ $(null);
2980
+ const u = Se(p, k);
2981
+ if (g({}), !n) {
2982
+ d.mutate(
2983
+ { credential: u },
2896
2984
  {
2897
2985
  onSuccess: () => {
2898
- u.reset(), p(!1), E("Key replaced.");
2986
+ d.reset(), c(!1), v("Key replaced.");
2899
2987
  },
2900
- onError: (v) => {
2901
- u.reset(), C(me(v, "rotate"));
2988
+ onError: (N) => {
2989
+ d.reset(), $(he(N, "rotate"));
2902
2990
  }
2903
2991
  }
2904
2992
  );
2905
2993
  return;
2906
2994
  }
2907
2995
  l.mutate(
2908
- { source: d },
2996
+ { source: u },
2909
2997
  {
2910
2998
  onSuccess: () => {
2911
- l.reset(), p(!1), E("Key replaced.");
2999
+ l.reset(), c(!1), v("Key replaced.");
2912
3000
  },
2913
- onError: (v) => {
2914
- l.reset(), C(me(v, "rotate"));
3001
+ onError: (N) => {
3002
+ l.reset(), $(he(N, "rotate"));
2915
3003
  }
2916
3004
  }
2917
3005
  );
2918
- }, g = () => {
2919
- C(null), i(null), N.mutate(
3006
+ }, b = () => {
3007
+ $(null), i(null), C.mutate(
2920
3008
  { id: e.id },
2921
3009
  {
2922
- onSuccess: (d) => {
2923
- if (!d.ok) {
2924
- I(!1), C("This key is still in use. Remove what uses it first.");
3010
+ onSuccess: (u) => {
3011
+ if (!u.ok) {
3012
+ I(!1), $("This key is still in use. Remove what uses it first.");
2925
3013
  return;
2926
3014
  }
2927
3015
  n && h.mutate(n.id, {
2928
- onSuccess: (v) => {
2929
- v.ok || i(it);
3016
+ onSuccess: (N) => {
3017
+ N.ok || i(lt);
2930
3018
  },
2931
- onError: (v) => i(se(v) ?? it)
3019
+ onError: (N) => i(ie(N) ?? lt)
2932
3020
  });
2933
3021
  },
2934
- onError: (d) => {
2935
- I(!1), q(d, "Could not remove the key.");
3022
+ onError: (u) => {
3023
+ I(!1), q(u, "Could not remove the key.");
2936
3024
  }
2937
3025
  }
2938
3026
  );
@@ -2942,9 +3030,9 @@ function Fs({
2942
3030
  /* @__PURE__ */ t("strong", { children: e.displayName }),
2943
3031
  " ",
2944
3032
  /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", "data-testid": `ai-key-status-${e.id}`, children: (n == null ? void 0 : n.status) ?? e.state }),
2945
- R !== void 0 && /* @__PURE__ */ r("span", { className: "w6w-muted w6w-small", "data-testid": `ai-key-display-${e.id}`, children: [
3033
+ P !== void 0 && /* @__PURE__ */ r("span", { className: "w6w-muted w6w-small", "data-testid": `ai-key-display-${e.id}`, children: [
2946
3034
  " ",
2947
- R
3035
+ P
2948
3036
  ] })
2949
3037
  ] }),
2950
3038
  /* @__PURE__ */ r("div", { className: "w6w-modal-actions", children: [
@@ -2953,17 +3041,17 @@ function Fs({
2953
3041
  {
2954
3042
  type: "button",
2955
3043
  className: "w6w-btn w6w-btn-ghost",
2956
- disabled: s.isPending,
2957
- onClick: O,
2958
- children: s.isPending ? "Testing…" : "Test"
3044
+ disabled: a.isPending,
3045
+ onClick: K,
3046
+ children: a.isPending ? "Testing…" : "Test"
2959
3047
  }
2960
3048
  ),
2961
- w && /* @__PURE__ */ t(
3049
+ p && /* @__PURE__ */ t(
2962
3050
  "button",
2963
3051
  {
2964
3052
  type: "button",
2965
3053
  className: "w6w-btn w6w-btn-ghost",
2966
- onClick: () => p((d) => !d),
3054
+ onClick: () => c((u) => !u),
2967
3055
  children: "Replace key"
2968
3056
  }
2969
3057
  ),
@@ -2974,7 +3062,7 @@ function Fs({
2974
3062
  className: "w6w-btn w6w-btn-ghost",
2975
3063
  disabled: o.isPending,
2976
3064
  onClick: () => o.mutate(x ? "active" : "disabled", {
2977
- onError: (d) => q(d, "Could not change the key's status.")
3065
+ onError: (u) => q(u, "Could not change the key's status.")
2978
3066
  }),
2979
3067
  children: x ? "Enable" : "Disable"
2980
3068
  }
@@ -2989,20 +3077,20 @@ function Fs({
2989
3077
  }
2990
3078
  )
2991
3079
  ] }),
2992
- Q && /* @__PURE__ */ t("output", { "data-testid": `ai-key-test-${e.id}`, children: Q === "ok" ? "Test passed" : "Test failed" }),
2993
- k && w && /* @__PURE__ */ r("div", { className: "w6w-card-stack", "data-testid": `ai-key-replace-${e.id}`, children: [
3080
+ j && /* @__PURE__ */ t("output", { "data-testid": `ai-key-test-${e.id}`, children: j === "ok" ? "Test passed" : "Test failed" }),
3081
+ y && p && /* @__PURE__ */ r("div", { className: "w6w-card-stack", "data-testid": `ai-key-replace-${e.id}`, children: [
2994
3082
  /* @__PURE__ */ t(
2995
3083
  Ae,
2996
3084
  {
2997
- fields: w,
2998
- values: A,
2999
- onChange: (d, v) => b((L) => ({ ...L, [d]: v })),
3085
+ fields: p,
3086
+ values: k,
3087
+ onChange: (u, N) => g((T) => ({ ...T, [u]: N })),
3000
3088
  idPrefix: `w6w-ai-key-replace-${e.id}`
3001
3089
  }
3002
3090
  ),
3003
- /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", disabled: j, onClick: _, children: j ? "Replacing…" : "Save new key" })
3091
+ /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", disabled: _, onClick: U, children: _ ? "Replacing…" : "Save new key" })
3004
3092
  ] }),
3005
- $ && /* @__PURE__ */ r("div", { "data-testid": `ai-key-remove-confirm-${e.id}`, children: [
3093
+ S && /* @__PURE__ */ r("div", { "data-testid": `ai-key-remove-confirm-${e.id}`, children: [
3006
3094
  /* @__PURE__ */ r("p", { className: "w6w-small", children: [
3007
3095
  'Remove "',
3008
3096
  e.displayName,
@@ -3013,8 +3101,8 @@ function Fs({
3013
3101
  {
3014
3102
  type: "button",
3015
3103
  className: "w6w-btn w6w-btn-danger",
3016
- disabled: N.isPending,
3017
- onClick: g,
3104
+ disabled: C.isPending,
3105
+ onClick: b,
3018
3106
  children: "Confirm remove"
3019
3107
  }
3020
3108
  ),
@@ -3029,156 +3117,156 @@ function Fs({
3029
3117
  }
3030
3118
  )
3031
3119
  ] }),
3032
- f && /* @__PURE__ */ t("output", { children: f }),
3033
- S && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: S })
3120
+ A && /* @__PURE__ */ t("output", { children: A }),
3121
+ D && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: D })
3034
3122
  ] });
3035
3123
  }
3036
- function X(e) {
3037
- const n = fn(e), a = e == null ? void 0 : e.code;
3038
- return n.code === void 0 && typeof a == "string" && a !== "" ? { ...n, code: a } : n;
3124
+ function ne(e) {
3125
+ const n = Nn(e), s = e == null ? void 0 : e.code;
3126
+ return n.code === void 0 && typeof s == "string" && s !== "" ? { ...n, code: s } : n;
3039
3127
  }
3040
- const lt = 80;
3041
- function Qs(e, n) {
3128
+ const rt = 80;
3129
+ function Vs(e, n) {
3042
3130
  if (typeof URL > "u" || typeof URL.createObjectURL != "function") return;
3043
- const a = URL.createObjectURL(new Blob([n], { type: "text/csv" })), i = document.createElement("a");
3044
- i.href = a, i.download = e, i.click(), URL.revokeObjectURL(a);
3045
- }
3046
- function js({ store: e, project: n }) {
3047
- var V;
3048
- const a = yn(e), i = (a == null ? void 0 : a.columns) ?? [], s = (a == null ? void 0 : a.key) ?? "", [l, o] = y(""), [u, m] = y({}), [w, N] = y({}), [h, k] = y({}), [p, A] = y({}), [b, $] = y(null), [I, f] = y(null), [E, S] = y(null), C = he(), Q = de(), P = Lt(e.id, n, l), x = Mt(), R = Na(), j = xt(), q = ka(), O = Ca(), _ = (((V = P.data) == null ? void 0 : V.pages.flatMap((c) => c.items)) ?? []).map(
3049
- (c) => p[c.key] ?? c
3050
- ), g = new Map(_.map((c) => [c.key, c])), d = [], v = (c) => u[c], L = v(le), F = (c, M, z) => {
3051
- const ne = z === void 0 ? null : ye(z, i);
3052
- d.push({
3053
- id: c,
3054
- isNew: c === le,
3055
- cells: M.cells,
3056
- version: M.version,
3057
- dirty: ne === null ? !0 : Cn(M, ne, i).length > 0,
3058
- conflict: h[c] === !0,
3059
- cellErrors: w[c]
3131
+ const s = URL.createObjectURL(new Blob([n], { type: "text/csv" })), i = document.createElement("a");
3132
+ i.href = s, i.download = e, i.click(), URL.revokeObjectURL(s);
3133
+ }
3134
+ function Bs({ store: e, project: n }) {
3135
+ var W;
3136
+ const s = kn(e), i = (s == null ? void 0 : s.columns) ?? [], a = (s == null ? void 0 : s.key) ?? "", [l, o] = f(""), [d, m] = f({}), [p, C] = f({}), [h, y] = f({}), [c, k] = f({}), [g, S] = f(null), [I, A] = f(null), [v, D] = f(null), $ = pe(), j = ue(), R = Mt(e.id, n, l), x = xt(), P = Ca(), _ = Rt(), q = Ia(), K = Aa(), U = (((W = R.data) == null ? void 0 : W.pages.flatMap((w) => w.items)) ?? []).map(
3137
+ (w) => c[w.key] ?? w
3138
+ ), b = new Map(U.map((w) => [w.key, w])), u = [], N = (w) => d[w], T = N(re), Q = (w, F, G) => {
3139
+ const X = G === void 0 ? null : ye(G, i);
3140
+ u.push({
3141
+ id: w,
3142
+ isNew: w === re,
3143
+ cells: F.cells,
3144
+ version: F.version,
3145
+ dirty: X === null ? !0 : Dn(F, X, i).length > 0,
3146
+ conflict: h[w] === !0,
3147
+ cellErrors: p[w]
3060
3148
  });
3061
3149
  };
3062
- L !== void 0 && F(le, L, void 0);
3063
- for (const c of _)
3064
- F(c.key, v(c.key) ?? ye(c, i), c);
3065
- const U = (c) => {
3066
- N((M) => re(M, c)), k((M) => re(M, c));
3067
- }, B = (c) => {
3068
- m((M) => re(M, c)), U(c);
3150
+ T !== void 0 && Q(re, T, void 0);
3151
+ for (const w of U)
3152
+ Q(w.key, N(w.key) ?? ye(w, i), w);
3153
+ const V = (w) => {
3154
+ C((F) => oe(F, w)), y((F) => oe(F, w));
3155
+ }, z = (w) => {
3156
+ m((F) => oe(F, w)), V(w);
3069
3157
  };
3070
- function H(c, M, z) {
3071
- const ne = g.get(c), ee = v(c) ?? (ne ? ye(ne, i) : ze(i));
3072
- m((J) => ({ ...J, [c]: { ...ee, cells: { ...ee.cells, [M]: z } } })), N((J) => {
3073
- const ie = J[c];
3074
- if (ie === void 0 || !(M in ie)) return J;
3075
- const pe = re(ie, M);
3076
- return Object.keys(pe).length === 0 ? re(J, c) : { ...J, [c]: pe };
3158
+ function B(w, F, G) {
3159
+ const X = b.get(w), Z = N(w) ?? (X ? ye(X, i) : Ge(i));
3160
+ m((M) => ({ ...M, [w]: { ...Z, cells: { ...Z.cells, [F]: G } } })), C((M) => {
3161
+ const Y = M[w];
3162
+ if (Y === void 0 || !(F in Y)) return M;
3163
+ const le = oe(Y, F);
3164
+ return Object.keys(le).length === 0 ? oe(M, w) : { ...M, [w]: le };
3077
3165
  });
3078
3166
  }
3079
- async function T(c) {
3080
- const M = g.get(c), z = v(c) ?? (M ? ye(M, i) : void 0);
3081
- if (z === void 0) return;
3082
- $(null), U(c);
3083
- const ne = An(z, i);
3084
- if (!ne.ok) {
3085
- N((J) => ({ ...J, [c]: ne.errors }));
3167
+ async function L(w) {
3168
+ const F = b.get(w), G = N(w) ?? (F ? ye(F, i) : void 0);
3169
+ if (G === void 0) return;
3170
+ S(null), V(w);
3171
+ const X = En(G, i);
3172
+ if (!X.ok) {
3173
+ C((M) => ({ ...M, [w]: X.errors }));
3086
3174
  return;
3087
3175
  }
3088
- const ee = $n(
3089
- z,
3090
- ne.value,
3091
- pt((M == null ? void 0 : M.expiresAt) ?? null, Date.now())
3176
+ const Z = Ln(
3177
+ G,
3178
+ X.value,
3179
+ wt((F == null ? void 0 : F.expiresAt) ?? null, Date.now())
3092
3180
  );
3093
3181
  try {
3094
- ee.kind === "insert" ? await R.mutateAsync({
3182
+ Z.kind === "insert" ? await P.mutateAsync({
3095
3183
  id: e.id,
3096
- row: ee.value,
3097
- ttlSeconds: ee.ttlSeconds,
3184
+ row: Z.value,
3185
+ ttlSeconds: Z.ttlSeconds,
3098
3186
  project: n
3099
3187
  }) : await x.mutateAsync({
3100
3188
  id: e.id,
3101
- key: ee.key,
3102
- value: ee.value,
3103
- ifVersion: ee.ifVersion,
3104
- ttlSeconds: ee.ttlSeconds,
3189
+ key: Z.key,
3190
+ value: Z.value,
3191
+ ifVersion: Z.ifVersion,
3192
+ ttlSeconds: Z.ttlSeconds,
3105
3193
  project: n
3106
- }), A((J) => re(J, c)), B(c);
3107
- } catch (J) {
3108
- const ie = X(J);
3109
- if (wt(ie)) {
3110
- k((Ee) => ({ ...Ee, [c]: !0 }));
3194
+ }), k((M) => oe(M, w)), z(w);
3195
+ } catch (M) {
3196
+ const Y = ne(M);
3197
+ if (ft(Y)) {
3198
+ y((De) => ({ ...De, [w]: !0 }));
3111
3199
  return;
3112
3200
  }
3113
- const pe = Dn(ie, i);
3114
- if (pe !== null) {
3115
- N((Ee) => ({ ...Ee, [c]: pe }));
3201
+ const le = Mn(Y, i);
3202
+ if (le !== null) {
3203
+ C((De) => ({ ...De, [w]: le }));
3116
3204
  return;
3117
3205
  }
3118
- $(ie.message);
3206
+ S(Y.message);
3119
3207
  }
3120
3208
  }
3121
- async function K(c) {
3209
+ async function O(w) {
3122
3210
  try {
3123
- const M = await Rt(C, e.id, c, n);
3124
- A((z) => ({ ...z, [c]: M })), B(c), await Q.invalidateQueries({ queryKey: ["data-stores"] });
3125
- } catch (M) {
3126
- $(X(M).message);
3211
+ const F = await Pt($, e.id, w, n);
3212
+ k((G) => ({ ...G, [w]: F })), z(w), await j.invalidateQueries({ queryKey: ["data-stores"] });
3213
+ } catch (F) {
3214
+ S(ne(F).message);
3127
3215
  }
3128
3216
  }
3129
- function Y() {
3130
- const c = I;
3131
- f(null), c !== null && (c !== le && j.mutate({ id: e.id, key: c, project: n }), B(c));
3217
+ function J() {
3218
+ const w = I;
3219
+ A(null), w !== null && (w !== re && _.mutate({ id: e.id, key: w, project: n }), z(w));
3132
3220
  }
3133
- async function G(c) {
3134
- S(null);
3221
+ async function te(w) {
3222
+ D(null);
3135
3223
  try {
3136
- const M = await q.mutateAsync({ id: e.id, csv: await c.text(), project: n });
3137
- S(Ye({ status: 200, text: JSON.stringify(M) }));
3138
- } catch (M) {
3139
- const z = M;
3140
- S(
3141
- typeof z.status == "number" ? Ye({ status: z.status, text: JSON.stringify(z.raw ?? null) }) : { ok: !1, message: X(M).message }
3224
+ const F = await q.mutateAsync({ id: e.id, csv: await w.text(), project: n });
3225
+ D(Je({ status: 200, text: JSON.stringify(F) }));
3226
+ } catch (F) {
3227
+ const G = F;
3228
+ D(
3229
+ typeof G.status == "number" ? Je({ status: G.status, text: JSON.stringify(G.raw ?? null) }) : { ok: !1, message: ne(F).message }
3142
3230
  );
3143
3231
  }
3144
3232
  }
3145
- async function D() {
3233
+ async function E() {
3146
3234
  try {
3147
- const c = await O.mutateAsync({ id: e.id, project: n });
3148
- Qs(In(null, e.name), c), S(null);
3149
- } catch (c) {
3150
- S({ ok: !1, message: X(c).message });
3235
+ const w = await K.mutateAsync({ id: e.id, project: n });
3236
+ Vs(Tn(null, e.name), w), D(null);
3237
+ } catch (w) {
3238
+ D({ ok: !1, message: ne(w).message });
3151
3239
  }
3152
3240
  }
3153
3241
  return /* @__PURE__ */ r("div", { children: [
3154
3242
  /* @__PURE__ */ t(
3155
- gn,
3243
+ Cn,
3156
3244
  {
3157
- result: E,
3158
- busy: O.isPending,
3159
- onImport: G,
3160
- onRefuse: (c) => S({ ok: !1, message: c }),
3161
- onExport: D
3245
+ result: v,
3246
+ busy: K.isPending,
3247
+ onImport: te,
3248
+ onRefuse: (w) => D({ ok: !1, message: w }),
3249
+ onExport: E
3162
3250
  }
3163
3251
  ),
3164
3252
  /* @__PURE__ */ t(
3165
- vn,
3253
+ In,
3166
3254
  {
3167
3255
  columns: i,
3168
- keyColumn: s,
3169
- rows: d,
3170
- error: b,
3171
- loading: P.isPending,
3172
- hasMore: P.hasNextPage,
3256
+ keyColumn: a,
3257
+ rows: u,
3258
+ error: g,
3259
+ loading: R.isPending,
3260
+ hasMore: R.hasNextPage,
3173
3261
  empty: /* @__PURE__ */ t("p", { className: "muted small", children: "No rows match this key prefix." }),
3174
- onCellChange: H,
3175
- onSave: (c) => void T(c),
3176
- onDelete: f,
3177
- onReload: (c) => void K(c),
3262
+ onCellChange: B,
3263
+ onSave: (w) => void L(w),
3264
+ onDelete: A,
3265
+ onReload: (w) => void O(w),
3178
3266
  onAddRow: () => {
3179
- le in u || (m((c) => ({ ...c, [le]: ze(i) })), $(null));
3267
+ re in d || (m((w) => ({ ...w, [re]: Ge(i) })), S(null));
3180
3268
  },
3181
- onLoadMore: () => void P.fetchNextPage(),
3269
+ onLoadMore: () => void R.fetchNextPage(),
3182
3270
  onSearch: o
3183
3271
  }
3184
3272
  ),
@@ -3186,137 +3274,137 @@ function js({ store: e, project: n }) {
3186
3274
  Ce,
3187
3275
  {
3188
3276
  title: "Delete entry",
3189
- message: I === le ? "Discard this unsaved row?" : `Delete "${I}"? This cannot be undone.`,
3277
+ message: I === re ? "Discard this unsaved row?" : `Delete "${I}"? This cannot be undone.`,
3190
3278
  confirmLabel: "Delete",
3191
- onConfirm: Y,
3192
- onClose: () => f(null)
3279
+ onConfirm: J,
3280
+ onClose: () => A(null)
3193
3281
  }
3194
3282
  )
3195
3283
  ] });
3196
3284
  }
3197
- function qs({ store: e, project: n }) {
3198
- var H;
3199
- const a = e.kind === "doc", i = bn(e), [s, l] = y(""), [o, u] = y(null), [m, w] = y(!1), [N, h] = y(""), [k, p] = y(""), [A, b] = y(null), [$, I] = y(!1), [f, E] = y({}), [S, C] = y(null), Q = he(), P = de(), x = Lt(e.id, n, s), R = Mt(), j = xt(), q = (((H = x.data) == null ? void 0 : H.pages.flatMap((T) => T.items)) ?? []).map(
3200
- (T) => f[T.key] ?? T
3201
- ), O = o === null ? void 0 : q.find((T) => T.key === o), _ = m || o !== null, g = (T) => a ? JSON.stringify(T.value ?? null, null, 2) : Tn(i, T.value), d = (T) => {
3202
- const K = g(T).replace(/\s+/g, " ");
3203
- return K.length > lt ? `${K.slice(0, lt)}…` : K;
3285
+ function Ws({ store: e, project: n }) {
3286
+ var B;
3287
+ const s = e.kind === "doc", i = An(e), [a, l] = f(""), [o, d] = f(null), [m, p] = f(!1), [C, h] = f(""), [y, c] = f(""), [k, g] = f(null), [S, I] = f(!1), [A, v] = f({}), [D, $] = f(null), j = pe(), R = ue(), x = Mt(e.id, n, a), P = xt(), _ = Rt(), q = (((B = x.data) == null ? void 0 : B.pages.flatMap((L) => L.items)) ?? []).map(
3288
+ (L) => A[L.key] ?? L
3289
+ ), K = o === null ? void 0 : q.find((L) => L.key === o), U = m || o !== null, b = (L) => s ? JSON.stringify(L.value ?? null, null, 2) : Pn(i, L.value), u = (L) => {
3290
+ const O = b(L).replace(/\s+/g, " ");
3291
+ return O.length > rt ? `${O.slice(0, rt)}…` : O;
3204
3292
  };
3205
- function v(T) {
3206
- u(T.key), w(!1), p(g(T)), b(null), I(!1);
3293
+ function N(L) {
3294
+ d(L.key), p(!1), c(b(L)), g(null), I(!1);
3207
3295
  }
3208
- function L() {
3209
- u(null), w(!1), h(""), p(""), b(null), I(!1);
3296
+ function T() {
3297
+ d(null), p(!1), h(""), c(""), g(null), I(!1);
3210
3298
  }
3211
- async function F() {
3212
- b(null), I(!1);
3213
- const T = a ? En(k) : Sn(i, k);
3214
- if (!T.ok) {
3215
- b(T.message);
3299
+ async function Q() {
3300
+ g(null), I(!1);
3301
+ const L = s ? xn(y) : Rn(i, y);
3302
+ if (!L.ok) {
3303
+ g(L.message);
3216
3304
  return;
3217
3305
  }
3218
- const K = m ? N.trim() : o;
3219
- if (K === null || K === "") {
3220
- b("Enter a key.");
3306
+ const O = m ? C.trim() : o;
3307
+ if (O === null || O === "") {
3308
+ g("Enter a key.");
3221
3309
  return;
3222
3310
  }
3223
3311
  try {
3224
- await R.mutateAsync({
3312
+ await P.mutateAsync({
3225
3313
  id: e.id,
3226
- key: K,
3227
- value: T.value,
3314
+ key: O,
3315
+ value: L.value,
3228
3316
  // A new entry must not exist yet; an existing one is guarded by the version loaded.
3229
- ifVersion: m ? 0 : (O == null ? void 0 : O.version) ?? 0,
3230
- ttlSeconds: m ? void 0 : pt((O == null ? void 0 : O.expiresAt) ?? null, Date.now()),
3317
+ ifVersion: m ? 0 : (K == null ? void 0 : K.version) ?? 0,
3318
+ ttlSeconds: m ? void 0 : wt((K == null ? void 0 : K.expiresAt) ?? null, Date.now()),
3231
3319
  project: n
3232
- }), E((Y) => re(Y, K)), L();
3233
- } catch (Y) {
3234
- const G = X(Y);
3235
- wt(G) ? I(!0) : b(G.message);
3320
+ }), v((J) => oe(J, O)), T();
3321
+ } catch (J) {
3322
+ const te = ne(J);
3323
+ ft(te) ? I(!0) : g(te.message);
3236
3324
  }
3237
3325
  }
3238
- async function U() {
3326
+ async function V() {
3239
3327
  if (o !== null)
3240
3328
  try {
3241
- const T = await Rt(Q, e.id, o, n);
3242
- E((K) => ({ ...K, [o]: T })), p(g(T)), I(!1), b(null), await P.invalidateQueries({ queryKey: ["data-stores"] });
3243
- } catch (T) {
3244
- b(X(T).message);
3329
+ const L = await Pt(j, e.id, o, n);
3330
+ v((O) => ({ ...O, [o]: L })), c(b(L)), I(!1), g(null), await R.invalidateQueries({ queryKey: ["data-stores"] });
3331
+ } catch (L) {
3332
+ g(ne(L).message);
3245
3333
  }
3246
3334
  }
3247
- async function B() {
3248
- const T = S;
3249
- if (C(null), T !== null)
3335
+ async function z() {
3336
+ const L = D;
3337
+ if ($(null), L !== null)
3250
3338
  try {
3251
- await j.mutateAsync({ id: e.id, key: T, project: n }), T === o && L();
3252
- } catch (K) {
3253
- b(X(K).message);
3339
+ await _.mutateAsync({ id: e.id, key: L, project: n }), L === o && T();
3340
+ } catch (O) {
3341
+ g(ne(O).message);
3254
3342
  }
3255
3343
  }
3256
3344
  return /* @__PURE__ */ r("div", { children: [
3257
3345
  /* @__PURE__ */ t(
3258
- Nn,
3346
+ $n,
3259
3347
  {
3260
- rows: q.map((T) => ({ key: T.key, version: T.version, preview: d(T) })),
3348
+ rows: q.map((L) => ({ key: L.key, version: L.version, preview: u(L) })),
3261
3349
  loading: x.isPending,
3262
3350
  empty: /* @__PURE__ */ t("p", { className: "muted small", children: "No entries match this key prefix." }),
3263
3351
  hasMore: x.hasNextPage,
3264
- onOpen: (T) => {
3265
- const K = q.find((Y) => Y.key === T);
3266
- K && v(K);
3352
+ onOpen: (L) => {
3353
+ const O = q.find((J) => J.key === L);
3354
+ O && N(O);
3267
3355
  },
3268
3356
  onSearch: l,
3269
3357
  onNew: () => {
3270
- u(null), w(!0), h(""), p(""), b(null), I(!1);
3358
+ d(null), p(!0), h(""), c(""), g(null), I(!1);
3271
3359
  },
3272
3360
  onLoadMore: () => void x.fetchNextPage()
3273
3361
  }
3274
3362
  ),
3275
- _ && /* @__PURE__ */ t(
3276
- kn,
3363
+ U && /* @__PURE__ */ t(
3364
+ Sn,
3277
3365
  {
3278
- kind: a ? "doc" : "kv",
3366
+ kind: s ? "doc" : "kv",
3279
3367
  isNew: m,
3280
3368
  entryKey: o ?? void 0,
3281
- newKey: N,
3282
- version: (O == null ? void 0 : O.version) ?? null,
3283
- expiresAt: (O == null ? void 0 : O.expiresAt) ?? null,
3284
- text: k,
3285
- error: A,
3286
- conflict: $,
3287
- saving: R.isPending || j.isPending,
3288
- onDelete: m ? void 0 : () => C(o),
3289
- onTextChange: (T) => {
3290
- p(T), b(null);
3369
+ newKey: C,
3370
+ version: (K == null ? void 0 : K.version) ?? null,
3371
+ expiresAt: (K == null ? void 0 : K.expiresAt) ?? null,
3372
+ text: y,
3373
+ error: k,
3374
+ conflict: S,
3375
+ saving: P.isPending || _.isPending,
3376
+ onDelete: m ? void 0 : () => $(o),
3377
+ onTextChange: (L) => {
3378
+ c(L), g(null);
3291
3379
  },
3292
3380
  onKeyChange: h,
3293
- onSave: () => void F(),
3294
- onCancel: L,
3295
- onReload: () => void U()
3381
+ onSave: () => void Q(),
3382
+ onCancel: T,
3383
+ onReload: () => void V()
3296
3384
  }
3297
3385
  ),
3298
- S !== null && /* @__PURE__ */ t(
3386
+ D !== null && /* @__PURE__ */ t(
3299
3387
  Ce,
3300
3388
  {
3301
3389
  title: "Delete entry",
3302
- message: `Delete "${S}"? This cannot be undone.`,
3390
+ message: `Delete "${D}"? This cannot be undone.`,
3303
3391
  confirmLabel: "Delete",
3304
- onConfirm: B,
3305
- onClose: () => C(null)
3392
+ onConfirm: z,
3393
+ onClose: () => $(null)
3306
3394
  }
3307
3395
  )
3308
3396
  ] });
3309
3397
  }
3310
- function re(e, n) {
3398
+ function oe(e, n) {
3311
3399
  if (!(n in e)) return e;
3312
- const a = { ...e };
3313
- return delete a[n], a;
3400
+ const s = { ...e };
3401
+ return delete s[n], s;
3314
3402
  }
3315
- function Mi({ id: e, project: n, slots: a }) {
3316
- const i = ae(n), s = ba(e, i ?? void 0), l = s.data;
3403
+ function Oi({ id: e, project: n, slots: s }) {
3404
+ const i = se(n), a = ka(e, i ?? void 0), l = a.data;
3317
3405
  let o;
3318
- i == null ? o = /* @__PURE__ */ t("p", { className: "muted", children: "No project selected." }) : s.isError ? o = /* @__PURE__ */ t("p", { className: "result error", children: X(s.error).message }) : l === void 0 ? o = /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : l.kind === "table" ? o = /* @__PURE__ */ t(js, { store: l, project: i }, l.id) : o = /* @__PURE__ */ t(qs, { store: l, project: i }, l.id);
3319
- const u = (a == null ? void 0 : a.header) === void 0 ? l && /* @__PURE__ */ r("div", { children: [
3406
+ i == null ? o = /* @__PURE__ */ t("p", { className: "muted", children: "No project selected." }) : a.isError ? o = /* @__PURE__ */ t("p", { className: "result error", children: ne(a.error).message }) : l === void 0 ? o = /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : l.kind === "table" ? o = /* @__PURE__ */ t(Bs, { store: l, project: i }, l.id) : o = /* @__PURE__ */ t(Ws, { store: l, project: i }, l.id);
3407
+ const d = (s == null ? void 0 : s.header) === void 0 ? l && /* @__PURE__ */ r("div", { children: [
3320
3408
  /* @__PURE__ */ t("h3", { children: l.name }),
3321
3409
  /* @__PURE__ */ r("p", { className: "muted small", children: [
3322
3410
  l.kind,
@@ -3325,43 +3413,43 @@ function Mi({ id: e, project: n, slots: a }) {
3325
3413
  " ",
3326
3414
  l.entryCount === 1 ? "entry" : "entries"
3327
3415
  ] })
3328
- ] }) : a.header;
3416
+ ] }) : s.header;
3329
3417
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ r("section", { className: "section", children: [
3330
- u,
3418
+ d,
3331
3419
  o
3332
3420
  ] }) });
3333
3421
  }
3334
- const _s = ["name", "kind", "description", "schema"];
3335
- function Us(e) {
3336
- const [n, a] = y(""), [i, s] = y(""), [l, o] = y("kv"), [u, m] = y("string"), [w, N] = y([]), [h, k] = y(""), [p, A] = y({}), [b, $] = y({}), [I, f] = y(null), E = $a();
3337
- function S() {
3338
- A({}), $({}), f(null);
3339
- const C = {
3422
+ const Hs = ["name", "kind", "description", "schema"];
3423
+ function zs(e) {
3424
+ const [n, s] = f(""), [i, a] = f(""), [l, o] = f("kv"), [d, m] = f("string"), [p, C] = f([]), [h, y] = f(""), [c, k] = f({}), [g, S] = f({}), [I, A] = f(null), v = Da();
3425
+ function D() {
3426
+ k({}), S({}), A(null);
3427
+ const $ = {
3340
3428
  kind: l,
3341
3429
  name: n
3342
3430
  };
3343
- l === "kv" && (C.schema = { valueType: u }), l === "table" && (C.schema = h === "" ? { columns: w } : { columns: w, key: h }), i !== "" && (C.description = i), E.mutate(
3431
+ l === "kv" && ($.schema = { valueType: d }), l === "table" && ($.schema = h === "" ? { columns: p } : { columns: p, key: h }), i !== "" && ($.description = i), v.mutate(
3344
3432
  // The SDK's create body types `schema` as table columns only; the wire takes the S-2 shape
3345
3433
  // per kind, so the kv `{valueType}` schema is passed through as the host defines it.
3346
- { input: C, project: e.project },
3434
+ { input: $, project: e.project },
3347
3435
  {
3348
3436
  onSuccess: () => e.onClose(),
3349
- onError: (Q) => {
3350
- const P = X(Q), x = Kn(P);
3351
- if (x.kind === "cell" && w.some((R) => R.name === x.column)) {
3352
- $({ [x.column]: P.message });
3437
+ onError: (j) => {
3438
+ const R = ne(j), x = qn(R);
3439
+ if (x.kind === "cell" && p.some((P) => P.name === x.column)) {
3440
+ S({ [x.column]: R.message });
3353
3441
  return;
3354
3442
  }
3355
- if (x.kind === "field" && _s.includes(x.field)) {
3356
- A({ [x.field]: P.message });
3443
+ if (x.kind === "field" && Hs.includes(x.field)) {
3444
+ k({ [x.field]: R.message });
3357
3445
  return;
3358
3446
  }
3359
- f(P.message);
3447
+ A(R.message);
3360
3448
  }
3361
3449
  }
3362
3450
  );
3363
3451
  }
3364
- return /* @__PURE__ */ r(aa, { title: "New data store", onClose: e.onClose, children: [
3452
+ return /* @__PURE__ */ r(ia, { title: "New data store", onClose: e.onClose, children: [
3365
3453
  /* @__PURE__ */ r("div", { className: "modal-body", children: [
3366
3454
  /* @__PURE__ */ r("label", { className: "field", children: [
3367
3455
  /* @__PURE__ */ t("span", { children: "Name" }),
@@ -3371,12 +3459,12 @@ function Us(e) {
3371
3459
  type: "text",
3372
3460
  "data-testid": "data-store-name",
3373
3461
  value: n,
3374
- onChange: (C) => a(C.target.value),
3462
+ onChange: ($) => s($.target.value),
3375
3463
  placeholder: "e.g. counters"
3376
3464
  }
3377
3465
  )
3378
3466
  ] }),
3379
- p.name !== void 0 && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "data-store-field-error-name", children: p.name }),
3467
+ c.name !== void 0 && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "data-store-field-error-name", children: c.name }),
3380
3468
  /* @__PURE__ */ r("label", { className: "field", children: [
3381
3469
  /* @__PURE__ */ t("span", { children: "Description" }),
3382
3470
  /* @__PURE__ */ t(
@@ -3384,7 +3472,7 @@ function Us(e) {
3384
3472
  {
3385
3473
  type: "text",
3386
3474
  value: i,
3387
- onChange: (C) => s(C.target.value),
3475
+ onChange: ($) => a($.target.value),
3388
3476
  placeholder: "What this store holds"
3389
3477
  }
3390
3478
  )
@@ -3396,30 +3484,30 @@ function Us(e) {
3396
3484
  {
3397
3485
  "data-testid": "data-store-kind",
3398
3486
  value: l,
3399
- onChange: (C) => {
3400
- o(C.target.value), k("");
3487
+ onChange: ($) => {
3488
+ o($.target.value), y("");
3401
3489
  },
3402
- children: Mn.map((C) => /* @__PURE__ */ t("option", { value: C, children: xn[C] }, C))
3490
+ children: On.map(($) => /* @__PURE__ */ t("option", { value: $, children: Fn[$] }, $))
3403
3491
  }
3404
3492
  ),
3405
3493
  /* @__PURE__ */ t("span", { className: "hint", children: "The kind is fixed once the store exists." })
3406
3494
  ] }),
3407
- p.kind !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: p.kind }),
3495
+ c.kind !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: c.kind }),
3408
3496
  l === "kv" && /* @__PURE__ */ r("label", { className: "field", children: [
3409
3497
  /* @__PURE__ */ t("span", { children: "Value type" }),
3410
- /* @__PURE__ */ t("select", { value: u, onChange: (C) => m(C.target.value), children: Rn.map((C) => /* @__PURE__ */ t("option", { value: C, children: C }, C)) })
3498
+ /* @__PURE__ */ t("select", { value: d, onChange: ($) => m($.target.value), children: jn.map(($) => /* @__PURE__ */ t("option", { value: $, children: $ }, $)) })
3411
3499
  ] }),
3412
3500
  l === "table" && /* @__PURE__ */ t(
3413
- Pn,
3501
+ Qn,
3414
3502
  {
3415
- columns: w,
3416
- onChange: N,
3503
+ columns: p,
3504
+ onChange: C,
3417
3505
  keyColumn: h,
3418
- onKeyColumnChange: k,
3419
- columnErrors: b
3506
+ onKeyColumnChange: y,
3507
+ columnErrors: g
3420
3508
  }
3421
3509
  ),
3422
- p.schema !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: p.schema }),
3510
+ c.schema !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: c.schema }),
3423
3511
  I !== null && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "data-store-form-error", children: I })
3424
3512
  ] }),
3425
3513
  /* @__PURE__ */ r("div", { className: "modal-actions", children: [
@@ -3430,41 +3518,41 @@ function Us(e) {
3430
3518
  type: "button",
3431
3519
  className: "btn",
3432
3520
  "data-testid": "data-store-create",
3433
- disabled: E.isPending,
3434
- onClick: S,
3435
- children: E.isPending ? "Creating…" : "Create"
3521
+ disabled: v.isPending,
3522
+ onClick: D,
3523
+ children: v.isPending ? "Creating…" : "Create"
3436
3524
  }
3437
3525
  )
3438
3526
  ] })
3439
3527
  ] });
3440
3528
  }
3441
- function xi({ project: e, onOpen: n, getHref: a, slots: i }) {
3442
- const s = ae(e), l = Ia(s ?? void 0), o = Aa(), [u, m] = y(!1), [w, N] = y(null), [h, k] = y(null), p = (i == null ? void 0 : i.header) === void 0 ? /* @__PURE__ */ r("div", { children: [
3529
+ function Fi({ project: e, onOpen: n, getHref: s, slots: i }) {
3530
+ const a = se(e), l = $a(a ?? void 0), o = Sa(), [d, m] = f(!1), [p, C] = f(null), [h, y] = f(null), c = (i == null ? void 0 : i.header) === void 0 ? /* @__PURE__ */ r("div", { children: [
3443
3531
  /* @__PURE__ */ t("h3", { children: "Data stores" }),
3444
3532
  /* @__PURE__ */ t("p", { className: "muted small", children: "Key-value, document and table storage for this project." })
3445
3533
  ] }) : i.header;
3446
3534
  return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
3447
3535
  /* @__PURE__ */ t(
3448
- Ln,
3536
+ Kn,
3449
3537
  {
3450
3538
  stores: l.data ?? [],
3451
3539
  loading: l.isLoading,
3452
- error: h ?? (l.error != null ? X(l.error).message : null),
3540
+ error: h ?? (l.error != null ? ne(l.error).message : null),
3453
3541
  onOpen: n,
3454
- getHref: a,
3455
- onArchive: (A) => {
3456
- k(null), N(A);
3542
+ getHref: s,
3543
+ onArchive: (k) => {
3544
+ y(null), C(k);
3457
3545
  },
3458
3546
  busy: o.isPending,
3459
3547
  slots: {
3460
- header: p,
3548
+ header: c,
3461
3549
  actions: /* @__PURE__ */ t(
3462
3550
  "button",
3463
3551
  {
3464
3552
  type: "button",
3465
3553
  className: "btn",
3466
3554
  "data-testid": "data-store-new",
3467
- disabled: s == null,
3555
+ disabled: a == null,
3468
3556
  onClick: () => m(!0),
3469
3557
  children: "+ New data store"
3470
3558
  }
@@ -3473,46 +3561,46 @@ function xi({ project: e, onOpen: n, getHref: a, slots: i }) {
3473
3561
  }
3474
3562
  }
3475
3563
  ),
3476
- u && s != null && /* @__PURE__ */ t(Us, { project: s, onClose: () => m(!1) }),
3477
- w && /* @__PURE__ */ t(
3564
+ d && a != null && /* @__PURE__ */ t(zs, { project: a, onClose: () => m(!1) }),
3565
+ p && /* @__PURE__ */ t(
3478
3566
  Ce,
3479
3567
  {
3480
3568
  title: "Archive data store",
3481
- message: `Archive "${w.name}" and its ${w.entryCount} ${w.entryCount === 1 ? "entry" : "entries"}? Workflows and the API can no longer reach it.`,
3569
+ message: `Archive "${p.name}" and its ${p.entryCount} ${p.entryCount === 1 ? "entry" : "entries"}? Workflows and the API can no longer reach it.`,
3482
3570
  confirmLabel: "Archive",
3483
3571
  onConfirm: () => {
3484
- const A = w;
3485
- N(null), s != null && o.mutate(
3486
- { id: A.id, project: s },
3487
- { onError: (b) => k(X(b).message) }
3572
+ const k = p;
3573
+ C(null), a != null && o.mutate(
3574
+ { id: k.id, project: a },
3575
+ { onError: (g) => y(ne(g).message) }
3488
3576
  );
3489
3577
  },
3490
- onClose: () => N(null)
3578
+ onClose: () => C(null)
3491
3579
  }
3492
3580
  )
3493
3581
  ] });
3494
3582
  }
3495
3583
  export {
3496
- Ni as ActivitySummary,
3497
- Ht as AiKeyCreate,
3498
- Ai as ConnectionDetail,
3499
- Ii as ConnectionList,
3500
- Si as CredentialCreate,
3501
- Ti as CredentialDetail,
3502
- Ei as CredentialList,
3503
- xi as DataStoreList,
3504
- Mi as DataStoreView,
3505
- bi as DocumentList,
3506
- yi as EndpointList,
3507
- fi as FunctionList,
3508
- Va as Logs,
3509
- ki as LogsView,
3510
- $i as ModelCatalog,
3511
- Di as ModelUsage,
3512
- Li as MyAiKeys,
3513
- vi as ReliabilityBoard,
3514
- Ua as RunHistory,
3515
- Ci as ServiceDetail,
3516
- gi as WorkflowList
3584
+ $i as ActivitySummary,
3585
+ zt as AiKeyCreate,
3586
+ Ei as ConnectionDetail,
3587
+ Ti as ConnectionList,
3588
+ Ri as CredentialCreate,
3589
+ Pi as CredentialDetail,
3590
+ xi as CredentialList,
3591
+ Fi as DataStoreList,
3592
+ Oi as DataStoreView,
3593
+ Ai as DocumentList,
3594
+ ki as EndpointList,
3595
+ Ni as FunctionList,
3596
+ za as Logs,
3597
+ Si as LogsView,
3598
+ Li as ModelCatalog,
3599
+ Mi as ModelUsage,
3600
+ Ki as MyAiKeys,
3601
+ Ii as ReliabilityBoard,
3602
+ Ha as RunHistory,
3603
+ Di as ServiceDetail,
3604
+ Ci as WorkflowList
3517
3605
  };
3518
3606
  //# sourceMappingURL=lists.mjs.map