@w6w/embed 0.2.24 → 0.2.27

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 (69) hide show
  1. package/dist/{CreateFunctionModal-DScxp_LN.js → CreateFunctionModal-B3LpcuI9.js} +2 -2
  2. package/dist/{CreateFunctionModal-DScxp_LN.js.map → CreateFunctionModal-B3LpcuI9.js.map} +1 -1
  3. package/dist/DocumentFormModal-DieWYFi4.js +175 -0
  4. package/dist/DocumentFormModal-DieWYFi4.js.map +1 -0
  5. package/dist/{ImportSpecModal-Cpzp8ndt.js → ImportSpecModal-xwTzj4KB.js} +22 -21
  6. package/dist/{ImportSpecModal-Cpzp8ndt.js.map → ImportSpecModal-xwTzj4KB.js.map} +1 -1
  7. package/dist/ModelRoutesManager-DtByS4mE.js +422 -0
  8. package/dist/ModelRoutesManager-DtByS4mE.js.map +1 -0
  9. package/dist/{WorkflowEditor-LesBKjb2.js → WorkflowEditor-CvWkVmFn.js} +6 -6
  10. package/dist/{WorkflowEditor-LesBKjb2.js.map → WorkflowEditor-CvWkVmFn.js.map} +1 -1
  11. package/dist/ai-keys-D676ly41.js +53 -0
  12. package/dist/ai-keys-D676ly41.js.map +1 -0
  13. package/dist/{apps-CYUgEfGf.js → apps-FMcQfyL2.js} +2 -2
  14. package/dist/{apps-CYUgEfGf.js.map → apps-FMcQfyL2.js.map} +1 -1
  15. package/dist/chrome/ImportSpecModal.d.ts +2 -0
  16. package/dist/credentials-4Nf2GfMc.js +212 -0
  17. package/dist/credentials-4Nf2GfMc.js.map +1 -0
  18. package/dist/editor-apps-HEOclsxL.js +152 -0
  19. package/dist/{editor-apps-LZmDWMqf.js.map → editor-apps-HEOclsxL.js.map} +1 -1
  20. package/dist/{editor-tools-DHyWiG21.js → editor-tools-CVYTsVFN.js} +326 -326
  21. package/dist/editor-tools-CVYTsVFN.js.map +1 -0
  22. package/dist/editor.mjs +1 -1
  23. package/dist/editors.mjs +11 -11
  24. package/dist/{endpoints-DSRo1Lc5.js → endpoints-DArAqoLT.js} +15 -15
  25. package/dist/endpoints-DArAqoLT.js.map +1 -0
  26. package/dist/forms/ModelRoutesManager.d.ts +8 -0
  27. package/dist/forms.mjs +128 -133
  28. package/dist/forms.mjs.map +1 -1
  29. package/dist/index.mjs +14 -14
  30. package/dist/lib/callable-descriptors.d.ts +1 -1
  31. package/dist/lib/document-upload.d.ts +8 -0
  32. package/dist/lists/ConnectionList.d.ts +3 -1
  33. package/dist/lists/CredentialCreate.d.ts +25 -0
  34. package/dist/lists/CredentialDetail.d.ts +5 -1
  35. package/dist/lists/CredentialList.d.ts +3 -1
  36. package/dist/lists/MyAiKeys.d.ts +5 -0
  37. package/dist/lists/TagChips.d.ts +4 -0
  38. package/dist/lists.d.ts +4 -0
  39. package/dist/lists.mjs +1703 -1107
  40. package/dist/lists.mjs.map +1 -1
  41. package/dist/models-CI0vLJ6o.js +346 -0
  42. package/dist/models-CI0vLJ6o.js.map +1 -0
  43. package/dist/rail.mjs +1 -1
  44. package/dist/repos/ai-keys.d.ts +14 -0
  45. package/dist/repos/credentials.d.ts +28 -14
  46. package/dist/repos/index.d.ts +1 -0
  47. package/dist/repos/models.d.ts +53 -4
  48. package/dist/repos.mjs +223 -204
  49. package/dist/repos.mjs.map +1 -1
  50. package/dist/{spec-export-DGigBUsP.js → spec-export-DMMET5VM.js} +2 -2
  51. package/dist/{spec-export-DGigBUsP.js.map → spec-export-DMMET5VM.js.map} +1 -1
  52. package/dist/{spec-import-SWOonsNr.js → spec-import-0B6oUewa.js} +5 -5
  53. package/dist/{spec-import-SWOonsNr.js.map → spec-import-0B6oUewa.js.map} +1 -1
  54. package/dist/{workflows-BK6IM4if.js → workflows-Dz8LMjnt.js} +37 -34
  55. package/dist/workflows-Dz8LMjnt.js.map +1 -0
  56. package/package.json +5 -5
  57. package/src/styles.css +23 -0
  58. package/dist/DocumentFormModal-Br4s8wmi.js +0 -89
  59. package/dist/DocumentFormModal-Br4s8wmi.js.map +0 -1
  60. package/dist/ModelRoutesManager-Bv6qefnq.js +0 -345
  61. package/dist/ModelRoutesManager-Bv6qefnq.js.map +0 -1
  62. package/dist/credentials-Cn92LGhJ.js +0 -171
  63. package/dist/credentials-Cn92LGhJ.js.map +0 -1
  64. package/dist/editor-apps-LZmDWMqf.js +0 -152
  65. package/dist/editor-tools-DHyWiG21.js.map +0 -1
  66. package/dist/endpoints-DSRo1Lc5.js.map +0 -1
  67. package/dist/models-CK1KHd39.js +0 -311
  68. package/dist/models-CK1KHd39.js.map +0 -1
  69. package/dist/workflows-BK6IM4if.js.map +0 -1
package/dist/lists.mjs CHANGED
@@ -1,39 +1,40 @@
1
1
  "use client";
2
- import { jsxs as r, jsx as t, Fragment as Q } from "react/jsx-runtime";
3
- import { useState as f, useMemo as ae, useEffect as ut } from "react";
4
- import { F as mt, E as ht } from "./CreateFunctionModal-DScxp_LN.js";
5
- import { d as wt, f as pt, h as ft, b as Ke, n as ke, u as gt, m as yt } from "./endpoints-DSRo1Lc5.js";
6
- import { u as G, b as Ce } from "./project-context-Tvp-La7A.js";
7
- import { CallableList as vt, ReliabilityList as Nt, EmptyState as De, DataTable as $e, EditButton as Qe, DeleteButton as bt, ListItem as Ne, HealthStatusPill as ue, HistoryTimeline as kt, useW6WApi as Fe, connectionAppIdsToLookUp as qe, ConnectionList as Ct, AddConnectionModal as Dt, EditConnectionModal as _e, Modal as $t, resolveConnectionAppMeta as Tt, ConnectionHeader as Lt, IconButton as Mt, locateDataStoreError as xt, tableSchemaOf as It, draftFromEntry as ce, CsvPanel as Et, DataTableGrid as At, NEW_ROW_ID as te, newRowDraft as xe, kvValueTypeOf as Rt, DataEntryList as St, DataEntryEditor as Pt, dirtyColumns as Ot, csvFilenameOf as jt, csvImportMessage as Ie, buildRowValue as Kt, rowWriteOf as Qt, remainingTtlSeconds as We, isVersionConflict as Be, cellErrorsOf as Ft, parseDocText as qt, kvValueOf as _t, serializeCell as Wt, DataStoreList as Bt, DATA_STORE_KINDS as Ut, DATA_STORE_KIND_LABEL as Vt, SCALAR_TYPES as Ht, ColumnsEditor as Jt, errorPlacement as Yt } from "@w6w/ui";
8
- import { I as zt } from "./ImportSpecModal-Cpzp8ndt.js";
9
- import { i as Zt } from "./import-bindings-EUtxZ9Ti.js";
10
- import { a3 as Gt, a1 as Ue, T as Xt, E as en } from "./workflows-BK6IM4if.js";
11
- import { n as tn, b as nn } from "./workflow-blank-BJFLdGyE.js";
12
- import { f as an, e as Ee, g as sn, b as rn, h as ln, i as on } from "./api-calls--JHyif6a.js";
13
- import { C as he, a as cn, M as dn } from "./ConfirmModal-Pv2-A_3U.js";
14
- import { D as un } from "./DocumentFormModal-Br4s8wmi.js";
15
- import { k as mn, i as hn } from "./spec-import-SWOonsNr.js";
16
- import { H as wn, a as Ve } from "./editor-apps-LZmDWMqf.js";
17
- import { ApiError as He } from "@w6w/sdk";
18
- import { useQueryClient as we, useInfiniteQuery as Je } from "@tanstack/react-query";
19
- import { u as pn, o as fn, k as Ye, c as be, b as ze, m as gn, p as yn } from "./connections-CzsCyIxY.js";
20
- import { M as vn } from "./ModelRoutesManager-Bv6qefnq.js";
21
- import { j as Nn } from "./apps-CYUgEfGf.js";
22
- import { u as pe } from "./client-context-CX61Bgw-.js";
23
- import { r as bn, x as kn, p as Cn, A as Dn } from "./models-CK1KHd39.js";
24
- import { n as $n, m as Tn, k as Ln, p as Mn, q as xn, v as In, o as En } from "./credentials-Cn92LGhJ.js";
25
- import { h as An, k as Ze, p as Ge, o as Rn, j as Xe, n as Sn, m as Pn, g as et, i as On, u as jn, f as Kn } from "./data-stores-UeQvwVCa.js";
26
- function Te(e) {
27
- const { kind: n } = e, a = wt(n), [s, i] = f(!1), l = (e.rows ?? []).map((o) => ({
28
- ...e.toRow(o),
29
- id: o.id,
30
- archived: Zt(o)
2
+ import { jsxs as l, jsx as t, Fragment as Q } from "react/jsx-runtime";
3
+ import { useState as f, useMemo as ie, useEffect as At } from "react";
4
+ import { F as St, E as Mt } from "./CreateFunctionModal-B3LpcuI9.js";
5
+ import { d as xt, f as Rt, h as Pt, b as Ye, n as Se, u as Ot, m as Kt } from "./endpoints-DArAqoLT.js";
6
+ import { u as X, b as Me } from "./project-context-Tvp-La7A.js";
7
+ import { CallableList as jt, ReliabilityList as Ft, EmptyState as xe, DataTable as Re, EditButton as ze, DeleteButton as Qt, ListItem as Ae, HealthStatusPill as ye, HistoryTimeline as _t, useW6WApi as Je, connectionAppIdsToLookUp as Ge, ConnectionList as qt, AddConnectionModal as Vt, EditConnectionModal as Ze, Modal as Wt, resolveConnectionAppMeta as Bt, ConnectionHeader as Ut, IconButton as Ht, locateDataStoreError as Yt, tableSchemaOf as zt, draftFromEntry as pe, CsvPanel as Jt, DataTableGrid as Gt, NEW_ROW_ID as ae, newRowDraft as Ke, kvValueTypeOf as Zt, DataEntryList as Xt, DataEntryEditor as en, dirtyColumns as tn, csvFilenameOf as nn, csvImportMessage as je, buildRowValue as an, rowWriteOf as sn, remainingTtlSeconds as Xe, isVersionConflict as et, cellErrorsOf as ln, parseDocText as rn, kvValueOf as on, serializeCell as cn, DataStoreList as dn, DATA_STORE_KINDS as un, DATA_STORE_KIND_LABEL as mn, SCALAR_TYPES as hn, ColumnsEditor as wn, errorPlacement as pn } from "@w6w/ui";
8
+ import { I as fn } from "./ImportSpecModal-xwTzj4KB.js";
9
+ import { i as yn } from "./import-bindings-EUtxZ9Ti.js";
10
+ import { a3 as gn, a1 as tt, T as vn, E as bn } from "./workflows-Dz8LMjnt.js";
11
+ import { n as Nn, b as kn } from "./workflow-blank-BJFLdGyE.js";
12
+ import { f as Cn, e as Fe, g as Tn, b as En, h as In, i as Dn } from "./api-calls--JHyif6a.js";
13
+ import { C as be, a as $n, M as Ln } from "./ConfirmModal-Pv2-A_3U.js";
14
+ import { D as An } from "./DocumentFormModal-DieWYFi4.js";
15
+ import { k as Sn, i as Mn } from "./spec-import-0B6oUewa.js";
16
+ import { H as xn, a as nt } from "./editor-apps-HEOclsxL.js";
17
+ import { ApiError as at } from "@w6w/sdk";
18
+ import { useQueryClient as me, useInfiniteQuery as st, useQuery as Rn } from "@tanstack/react-query";
19
+ import { u as it, o as lt, k as rt, c as ge, b as ot, m as Pn, p as ct, e as On } from "./connections-CzsCyIxY.js";
20
+ import { M as Kn } from "./ModelRoutesManager-DtByS4mE.js";
21
+ import { j as jn } from "./apps-FMcQfyL2.js";
22
+ import { u as he } from "./client-context-CX61Bgw-.js";
23
+ import { v as Fn, A as Qn, s as _n, E as qn, c as Vn } from "./models-CI0vLJ6o.js";
24
+ import { x as dt, w as Ne, a as ut, p as Wn, g as ke, v as Bn, q as Un, z as mt, A as ht, B as Hn, y as wt, o as ee, c as Yn, i as zn, h as Jn } from "./credentials-4Nf2GfMc.js";
25
+ import { u as pt, b as Gn, d as Zn, c as Xn } from "./ai-keys-D676ly41.js";
26
+ import { h as ea, k as ft, p as yt, o as ta, j as gt, n as na, m as aa, g as vt, i as sa, u as ia, f as la } from "./data-stores-UeQvwVCa.js";
27
+ function Pe(e) {
28
+ const { kind: n } = e, a = xt(n), [i, s] = f(!1), o = (e.rows ?? []).map((r) => ({
29
+ ...e.toRow(r),
30
+ id: r.id,
31
+ archived: yn(r)
31
32
  }));
32
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
33
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
33
34
  /* @__PURE__ */ t(
34
- vt,
35
+ jt,
35
36
  {
36
- rows: l,
37
+ rows: o,
37
38
  title: a.listTitle,
38
39
  description: a.listDescription,
39
40
  emptyCopy: a.emptyCopy,
@@ -48,213 +49,226 @@ function Te(e) {
48
49
  error: e.error,
49
50
  onCreate: e.onCreate,
50
51
  creating: e.creating,
51
- onImport: () => i(!0),
52
+ onImport: () => s(!0),
52
53
  onOpen: e.onOpen,
53
54
  getHref: e.getHref,
54
55
  slots: e.slots
55
56
  }
56
57
  ),
57
- s && /* @__PURE__ */ t(
58
- zt,
58
+ i && /* @__PURE__ */ t(
59
+ fn,
59
60
  {
60
61
  kind: n,
61
62
  project: e.project ?? void 0,
62
- listKeys: { functionsKey: ft, endpointsKey: pt, workflowsKey: Gt },
63
- onOpenImported: (o, c) => {
64
- var d;
65
- return (d = e.onOpen) == null ? void 0 : d.call(e, c);
63
+ listKeys: { functionsKey: Pt, endpointsKey: Rt, workflowsKey: gn },
64
+ onOpenImported: (r, c) => {
65
+ var u;
66
+ return (u = e.onOpen) == null ? void 0 : u.call(e, c);
66
67
  },
67
- onClose: () => i(!1)
68
+ onClose: () => s(!1)
68
69
  }
69
70
  ),
70
71
  e.children
71
72
  ] });
72
73
  }
73
- function ii(e) {
74
- const n = Ke(), a = G(e.project), [s, i] = f(null);
74
+ function bt({ tags: e }) {
75
+ 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)) });
76
+ }
77
+ function Fs(e) {
78
+ const n = Ye(), a = X(e.project), [i, s] = f(null);
75
79
  return /* @__PURE__ */ t(
76
- Te,
80
+ Pe,
77
81
  {
78
82
  kind: "function",
79
83
  rows: n.data,
80
84
  loading: n.isLoading,
81
85
  error: n.error ? String(n.error) : null,
82
86
  project: a,
83
- toRow: (l) => ({
84
- title: l.displayName || l.key,
85
- description: l.description,
86
- badges: l.valid ? null : /* @__PURE__ */ t("span", { className: "w6w-callable-list-badge", children: "incomplete" })
87
- }),
87
+ toRow: (o) => {
88
+ var r;
89
+ return {
90
+ title: o.displayName || o.key,
91
+ description: o.description,
92
+ badges: (r = o.tags) != null && r.length || !o.valid ? /* @__PURE__ */ l(Q, { children: [
93
+ /* @__PURE__ */ t(bt, { tags: o.tags }),
94
+ o.valid ? null : /* @__PURE__ */ t("span", { className: "w6w-callable-list-badge", children: "incomplete" })
95
+ ] }) : null
96
+ };
97
+ },
88
98
  onOpen: e.onOpen,
89
99
  getHref: e.getHref,
90
- onCreate: () => i(ke("function")),
100
+ onCreate: () => s(Se("function")),
91
101
  slots: e.slots,
92
- children: s !== null && /* @__PURE__ */ t(
93
- mt,
102
+ children: i !== null && /* @__PURE__ */ t(
103
+ St,
94
104
  {
95
- newId: s,
96
- takenKeys: (n.data ?? []).map((l) => l.key),
97
- onClose: () => i(null),
98
- onCreated: (l) => {
99
- var o;
100
- i(null), (o = e.onCreated) == null || o.call(e, l);
105
+ newId: i,
106
+ takenKeys: (n.data ?? []).map((o) => o.key),
107
+ onClose: () => s(null),
108
+ onCreated: (o) => {
109
+ var r;
110
+ s(null), (r = e.onCreated) == null || r.call(e, o);
101
111
  }
102
112
  }
103
113
  )
104
114
  }
105
115
  );
106
116
  }
107
- function si(e) {
108
- const n = gt(), a = G(e.project), [s, i] = f(null);
117
+ function Qs(e) {
118
+ const n = Ot(), a = X(e.project), [i, s] = f(null);
109
119
  return /* @__PURE__ */ t(
110
- Te,
120
+ Pe,
111
121
  {
112
122
  kind: "endpoint",
113
123
  rows: n.data,
114
124
  loading: n.isLoading,
115
125
  error: n.error ? String(n.error) : null,
116
126
  project: a,
117
- toRow: (l) => ({
118
- // The draft tag sits INSIDE the title, after the name: ui `ListItem` puts `badges` in
119
- // a trailing `margin-left: auto` slot, which would strand it at the row's far edge.
120
- title: /* @__PURE__ */ r(Q, { children: [
121
- /* @__PURE__ */ t("strong", { children: l.displayName || l.key }),
122
- yt(l) ? /* @__PURE__ */ t(
123
- "span",
124
- {
125
- className: "tag warn",
126
- "data-testid": "endpoint-draft",
127
- title: "No target configured yet — it cannot be invoked until one is set.",
128
- children: "Unfinished"
129
- }
130
- ) : null
131
- ] }),
132
- description: l.description
133
- }),
127
+ toRow: (o) => {
128
+ var r;
129
+ return {
130
+ // The draft tag sits INSIDE the title, after the name: ui `ListItem` puts `badges` in
131
+ // a trailing `margin-left: auto` slot, which would strand it at the row's far edge.
132
+ title: /* @__PURE__ */ l(Q, { children: [
133
+ /* @__PURE__ */ t("strong", { children: o.displayName || o.key }),
134
+ Kt(o) ? /* @__PURE__ */ t(
135
+ "span",
136
+ {
137
+ className: "tag warn",
138
+ "data-testid": "endpoint-draft",
139
+ title: "No target configured yet — it cannot be invoked until one is set.",
140
+ children: "Unfinished"
141
+ }
142
+ ) : null
143
+ ] }),
144
+ description: o.description,
145
+ badges: (r = o.tags) != null && r.length ? /* @__PURE__ */ t(bt, { tags: o.tags }) : null
146
+ };
147
+ },
134
148
  onOpen: e.onOpen,
135
149
  getHref: e.getHref,
136
- onCreate: () => i(ke("endpoint")),
150
+ onCreate: () => s(Se("endpoint")),
137
151
  slots: e.slots,
138
- children: s !== null && /* @__PURE__ */ t(
139
- ht,
152
+ children: i !== null && /* @__PURE__ */ t(
153
+ Mt,
140
154
  {
141
- newId: s,
142
- takenKeys: (n.data ?? []).map((l) => l.key),
143
- onClose: () => i(null),
144
- onCreated: (l) => {
145
- var o;
146
- i(null), (o = e.onCreated) == null || o.call(e, l);
155
+ newId: i,
156
+ takenKeys: (n.data ?? []).map((o) => o.key),
157
+ onClose: () => s(null),
158
+ onCreated: (o) => {
159
+ var r;
160
+ s(null), (r = e.onCreated) == null || r.call(e, o);
147
161
  }
148
162
  }
149
163
  )
150
164
  }
151
165
  );
152
166
  }
153
- function ri(e) {
154
- const n = G(e.project), a = Ue(n ?? void 0, n != null), s = Xt(n ?? void 0), [i, l] = f(null);
167
+ function _s(e) {
168
+ const n = X(e.project), a = tt(n ?? void 0, n != null), i = vn(n ?? void 0), [s, o] = f(null);
155
169
  return /* @__PURE__ */ t(
156
- Te,
170
+ Pe,
157
171
  {
158
172
  kind: "workflow",
159
173
  rows: a.data,
160
174
  loading: a.isLoading,
161
- error: i ?? (a.error ? String(a.error) : null),
175
+ error: s ?? (a.error ? String(a.error) : null),
162
176
  project: n,
163
- toRow: (o) => ({
164
- title: o.displayName || o.name,
165
- description: o.description,
166
- badges: /* @__PURE__ */ r(Q, { children: [
167
- o.tags.length > 0 && /* @__PURE__ */ t("span", { className: "wf-row-tags", children: o.tags.map((c) => /* @__PURE__ */ t("span", { className: "tag", children: c }, c)) }),
168
- o.status !== "archived" && /* @__PURE__ */ t("span", { className: `badge wf-status ${o.status}`, children: o.status })
177
+ toRow: (r) => ({
178
+ title: r.displayName || r.name,
179
+ description: r.description,
180
+ badges: /* @__PURE__ */ l(Q, { children: [
181
+ r.tags.length > 0 && /* @__PURE__ */ t("span", { className: "wf-row-tags", children: r.tags.map((c) => /* @__PURE__ */ t("span", { className: "tag", children: c }, c)) }),
182
+ r.status !== "archived" && /* @__PURE__ */ t("span", { className: `badge wf-status ${r.status}`, children: r.status })
169
183
  ] }),
170
- trailing: /* @__PURE__ */ r("span", { className: "wf-col wf-col-stats muted small", children: [
171
- o.runCount,
184
+ trailing: /* @__PURE__ */ l("span", { className: "wf-col wf-col-stats muted small", children: [
185
+ r.runCount,
172
186
  " ",
173
- o.runCount === 1 ? "run" : "runs"
187
+ r.runCount === 1 ? "run" : "runs"
174
188
  ] })
175
189
  }),
176
190
  onOpen: e.onOpen,
177
191
  getHref: e.getHref,
178
192
  onCreate: () => {
179
- l(null);
180
- const o = tn((a.data ?? []).map((c) => c.displayName || c.name));
181
- s.mutate(nn(ke("workflow"), o), {
193
+ o(null);
194
+ const r = Nn((a.data ?? []).map((c) => c.displayName || c.name));
195
+ i.mutate(kn(Se("workflow"), r), {
182
196
  onSuccess: (c) => {
183
- var d;
184
- return (d = e.onCreated) == null ? void 0 : d.call(e, c.workflow.id);
197
+ var u;
198
+ return (u = e.onCreated) == null ? void 0 : u.call(e, c.workflow.id);
185
199
  },
186
- onError: (c) => l(c instanceof Error ? c.message : String(c))
200
+ onError: (c) => o(c instanceof Error ? c.message : String(c))
187
201
  });
188
202
  },
189
- creating: s.isPending,
203
+ creating: i.isPending,
190
204
  slots: e.slots
191
205
  }
192
206
  );
193
207
  }
194
- function li({
208
+ function qs({
195
209
  project: e,
196
210
  variant: n = "full",
197
211
  limit: a,
198
- days: s = 30,
199
- showChart: i,
200
- getHref: l,
201
- onOpen: o,
212
+ days: i = 30,
213
+ showChart: s,
214
+ getHref: o,
215
+ onOpen: r,
202
216
  showAllHref: c,
203
- onShowAll: d,
217
+ onShowAll: u,
204
218
  slots: h
205
219
  }) {
206
- var g, w;
207
- const N = Ce().project, u = e === void 0 ? N : e, k = u || null, b = an(k ?? void 0, s);
208
- let D = h == null ? void 0 : h.empty;
209
- return k ? b.isLoading ? D = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) : b.error && (D = /* @__PURE__ */ t("div", { className: "error", children: b.error.message })) : D = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see its reliability." }), /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
210
- Nt,
220
+ var y, p;
221
+ const g = Me().project, m = e === void 0 ? g : e, k = m || null, w = Cn(k ?? void 0, i);
222
+ let v = h == null ? void 0 : h.empty;
223
+ return k ? w.isLoading ? v = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) : w.error && (v = /* @__PURE__ */ t("div", { className: "error", children: w.error.message })) : v = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see its reliability." }), /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
224
+ Ft,
211
225
  {
212
- services: k ? ((g = b.data) == null ? void 0 : g.services) ?? [] : [],
213
- window: k ? (w = b.data) == null ? void 0 : w.window : void 0,
214
- days: s,
226
+ services: k ? ((y = w.data) == null ? void 0 : y.services) ?? [] : [],
227
+ window: k ? (p = w.data) == null ? void 0 : p.window : void 0,
228
+ days: i,
215
229
  compact: n === "compact",
216
- showChart: i,
230
+ showChart: s,
217
231
  limit: a,
218
- getHref: l,
219
- onOpen: o,
232
+ getHref: o,
233
+ onOpen: r,
220
234
  showAllHref: c,
221
- onShowAll: d,
222
- slots: { ...h, empty: D }
235
+ onShowAll: u,
236
+ slots: { ...h, empty: v }
223
237
  }
224
238
  ) });
225
239
  }
226
- function Qn(e) {
240
+ function ra(e) {
227
241
  const n = e.replace(/\s+/g, " ").trim();
228
242
  return n.length > 80 ? `${n.slice(0, 80)}…` : n;
229
243
  }
230
- function oi({ project: e, onOpen: n, getHref: a, slots: s, rowSlots: i }) {
231
- var g;
232
- const l = G(e), o = mn(l ?? void 0, l != null), c = hn(), [d, h] = f(null), [N, u] = f(null), k = (s == null ? void 0 : s.header) === void 0 ? /* @__PURE__ */ r("div", { children: [
244
+ function Vs({ project: e, onOpen: n, getHref: a, slots: i, rowSlots: s }) {
245
+ var y;
246
+ const o = X(e), r = Sn(o ?? void 0, o != null), c = Mn(), [u, h] = f(null), [g, m] = f(null), k = (i == null ? void 0 : i.header) === void 0 ? /* @__PURE__ */ l("div", { children: [
233
247
  /* @__PURE__ */ t("h3", { children: "Documents" }),
234
248
  /* @__PURE__ */ t("p", { className: "muted small", children: "Each document is free-form content stored verbatim." })
235
- ] }) : s.header, b = (s == null ? void 0 : s.empty) === void 0 ? /* @__PURE__ */ t(De, { testId: "document-list-empty", children: "No documents yet." }) : s.empty, D = [
249
+ ] }) : i.header, w = (i == null ? void 0 : i.empty) === void 0 ? /* @__PURE__ */ t(xe, { testId: "document-list-empty", children: "No documents yet." }) : i.empty, v = [
236
250
  {
237
251
  key: "key",
238
252
  header: "Document",
239
- render: (w) => {
240
- var x;
241
- const y = (x = i == null ? void 0 : i.lead) == null ? void 0 : x.call(i, w);
242
- return /* @__PURE__ */ r("span", { style: { display: "flex", alignItems: "center" }, children: [
243
- y,
244
- /* @__PURE__ */ r(
253
+ render: (p) => {
254
+ var I;
255
+ const C = (I = s == null ? void 0 : s.lead) == null ? void 0 : I.call(s, p);
256
+ return /* @__PURE__ */ l("span", { style: { display: "flex", alignItems: "center" }, children: [
257
+ C,
258
+ /* @__PURE__ */ l(
245
259
  "span",
246
260
  {
247
261
  className: "list-main",
248
- style: { marginLeft: y != null ? "var(--w6w-sp-2)" : 0 },
262
+ style: { marginLeft: C != null ? "var(--w6w-sp-2)" : 0 },
249
263
  children: [
250
- /* @__PURE__ */ t("strong", { className: "list-name", title: w.key, children: w.key }),
264
+ /* @__PURE__ */ t("strong", { className: "list-name", title: p.key, children: p.key }),
251
265
  " ",
252
- /* @__PURE__ */ t("span", { className: "tag", children: w.format }),
253
- /* @__PURE__ */ r("div", { className: "muted small list-preview", children: [
254
- /* @__PURE__ */ t("code", { children: Qn(w.content) }),
255
- w.description && /* @__PURE__ */ r(Q, { children: [
266
+ /* @__PURE__ */ t("span", { className: "tag", children: p.format }),
267
+ /* @__PURE__ */ l("div", { className: "muted small list-preview", children: [
268
+ /* @__PURE__ */ t("code", { children: ra(p.content) }),
269
+ p.description && /* @__PURE__ */ l(Q, { children: [
256
270
  " · ",
257
- w.description
271
+ p.description
258
272
  ] })
259
273
  ] })
260
274
  ]
@@ -268,95 +282,96 @@ function oi({ project: e, onOpen: n, getHref: a, slots: s, rowSlots: i }) {
268
282
  header: "",
269
283
  align: "right",
270
284
  link: !1,
271
- render: (w) => {
272
- var x, S;
273
- const y = (x = i == null ? void 0 : i.footer) == null ? void 0 : x.call(i, w);
285
+ actions: !0,
286
+ render: (p) => {
287
+ var I, b;
288
+ const C = (I = s == null ? void 0 : s.footer) == null ? void 0 : I.call(s, p);
274
289
  return (
275
290
  // Clicks here must not reach the row's onOpen.
276
291
  // biome-ignore lint/a11y/useKeyWithClickEvents: propagation guard only; the buttons inside are the controls.
277
- /* @__PURE__ */ r("div", { onClick: ($) => $.stopPropagation(), children: [
278
- /* @__PURE__ */ r("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)", justifyContent: "flex-end" }, children: [
279
- /* @__PURE__ */ t(cn, { resource: { kind: "document", key: w.key } }),
280
- w.shared ? (S = i == null ? void 0 : i.sharedActions) == null ? void 0 : S.call(i, w) : /* @__PURE__ */ r(Q, { children: [
292
+ /* @__PURE__ */ l("div", { onClick: (E) => E.stopPropagation(), children: [
293
+ /* @__PURE__ */ l("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)", justifyContent: "flex-end" }, children: [
294
+ /* @__PURE__ */ t($n, { resource: { kind: "document", key: p.key } }),
295
+ p.shared ? (b = s == null ? void 0 : s.sharedActions) == null ? void 0 : b.call(s, p) : /* @__PURE__ */ l(Q, { children: [
281
296
  /* @__PURE__ */ t(
282
- Qe,
297
+ ze,
283
298
  {
284
299
  label: "Edit",
285
- onClick: () => h({ mode: "edit", d: w }),
286
- "data-testid": `document-edit-${w.id}`
300
+ onClick: () => h({ mode: "edit", d: p }),
301
+ "data-testid": `document-edit-${p.id}`
287
302
  }
288
303
  ),
289
304
  /* @__PURE__ */ t(
290
- bt,
305
+ Qt,
291
306
  {
292
307
  label: "Delete",
293
- onClick: () => u(w),
308
+ onClick: () => m(p),
294
309
  disabled: c.isPending,
295
- "data-testid": `document-delete-${w.id}`
310
+ "data-testid": `document-delete-${p.id}`
296
311
  }
297
312
  )
298
313
  ] })
299
314
  ] }),
300
- y != null && /* @__PURE__ */ t("div", { className: "w6w-doc-footer", children: y })
315
+ C != null && /* @__PURE__ */ t("div", { className: "w6w-doc-footer", children: C })
301
316
  ] })
302
317
  );
303
318
  }
304
319
  }
305
320
  ];
306
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
307
- /* @__PURE__ */ r("section", { className: "section", children: [
308
- /* @__PURE__ */ r("div", { className: "section-head", children: [
321
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
322
+ /* @__PURE__ */ l("section", { className: "section", children: [
323
+ /* @__PURE__ */ l("div", { className: "section-head", children: [
309
324
  k,
310
325
  /* @__PURE__ */ t(
311
326
  "button",
312
327
  {
313
328
  type: "button",
314
329
  className: "btn",
315
- disabled: l == null,
330
+ disabled: o == null,
316
331
  onClick: () => h({ mode: "create" }),
317
332
  children: "+ Add document"
318
333
  }
319
334
  )
320
335
  ] }),
321
- /* @__PURE__ */ r("div", { children: [
322
- o.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
323
- ((g = o.data) == null ? void 0 : g.length) === 0 && b,
324
- o.data != null && o.data.length > 0 && /* @__PURE__ */ t(
325
- $e,
336
+ /* @__PURE__ */ l("div", { children: [
337
+ r.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
338
+ ((y = r.data) == null ? void 0 : y.length) === 0 && w,
339
+ r.data != null && r.data.length > 0 && /* @__PURE__ */ t(
340
+ Re,
326
341
  {
327
- columns: D,
328
- rows: o.data,
329
- rowKey: (w) => w.id,
330
- getRowHref: a ? (w) => a(w.id) : void 0,
331
- onRowClick: n ? (w, y) => n(w.id, y) : void 0
342
+ columns: v,
343
+ rows: r.data,
344
+ rowKey: (p) => p.id,
345
+ getRowHref: a ? (p) => a(p.id) : void 0,
346
+ onRowClick: n ? (p, C) => n(p.id, C) : void 0
332
347
  }
333
348
  )
334
349
  ] })
335
350
  ] }),
336
- d && /* @__PURE__ */ t(
337
- un,
351
+ u && /* @__PURE__ */ t(
352
+ An,
338
353
  {
339
- initial: d.mode === "edit" ? d.d : void 0,
340
- project: l,
354
+ initial: u.mode === "edit" ? u.d : void 0,
355
+ project: o,
341
356
  onClose: () => h(null),
342
357
  onSaved: () => h(null)
343
358
  }
344
359
  ),
345
- N && /* @__PURE__ */ t(
346
- he,
360
+ g && /* @__PURE__ */ t(
361
+ be,
347
362
  {
348
363
  title: "Delete document",
349
- message: `Delete the document "${N.key}"? This cannot be undone.`,
364
+ message: `Delete the document "${g.key}"? This cannot be undone.`,
350
365
  confirmLabel: "Delete",
351
366
  onConfirm: () => {
352
- l != null && c.mutate({ id: N.id, project: l }), u(null);
367
+ o != null && c.mutate({ id: g.id, project: o }), m(null);
353
368
  },
354
- onClose: () => u(null)
369
+ onClose: () => m(null)
355
370
  }
356
371
  )
357
372
  ] });
358
373
  }
359
- const Fn = {
374
+ const oa = {
360
375
  workflow: "Workflow run",
361
376
  workflow_step: "Workflow step",
362
377
  connection_test: "Connection test",
@@ -367,10 +382,10 @@ const Fn = {
367
382
  endpoint: "Endpoint call",
368
383
  action: "App action"
369
384
  };
370
- function me(e) {
371
- return Fn[e] ?? e;
385
+ function ve(e) {
386
+ return oa[e] ?? e;
372
387
  }
373
- const tt = {
388
+ const Nt = {
374
389
  workflow: "workflow",
375
390
  workflow_step: "workflow_step",
376
391
  connection_test: "base",
@@ -379,207 +394,207 @@ const tt = {
379
394
  endpoint: "base",
380
395
  action: "base"
381
396
  };
382
- function qn(e) {
383
- return Object.hasOwn(tt, e);
397
+ function ca(e) {
398
+ return Object.hasOwn(Nt, e);
384
399
  }
385
- function nt(e) {
386
- return qn(e) ? tt[e] : "base";
400
+ function kt(e) {
401
+ return ca(e) ? Nt[e] : "base";
387
402
  }
388
- function _n(e, n) {
403
+ function da(e, n) {
389
404
  const a = /* @__PURE__ */ new Map();
390
- for (const i of e ?? []) {
391
- const l = i.displayName || i.key;
392
- l && a.set(i.id, l);
405
+ for (const s of e ?? []) {
406
+ const o = s.displayName || s.key;
407
+ o && a.set(s.id, o);
393
408
  }
394
- const s = /* @__PURE__ */ new Map();
395
- for (const i of n ?? []) {
396
- const l = i.displayName || i.name;
397
- l && s.set(i.id, l);
409
+ const i = /* @__PURE__ */ new Map();
410
+ for (const s of n ?? []) {
411
+ const o = s.displayName || s.name;
412
+ o && i.set(s.id, o);
398
413
  }
399
- return { functions: a, workflows: s };
400
- }
401
- function Wn(e, n) {
402
- const a = e.summary ?? me(e.kind), s = nt(e.kind);
403
- if (s === "function" && e.functionId !== null) {
404
- const i = n.functions.get(e.functionId);
405
- if (i !== void 0)
406
- return { text: i, target: { kind: "function", id: e.functionId } };
414
+ return { functions: a, workflows: i };
415
+ }
416
+ function ua(e, n) {
417
+ const a = e.summary ?? ve(e.kind), i = kt(e.kind);
418
+ if (i === "function" && e.functionId !== null) {
419
+ const s = n.functions.get(e.functionId);
420
+ if (s !== void 0)
421
+ return { text: s, target: { kind: "function", id: e.functionId } };
407
422
  }
408
- if (s === "workflow" && e.workflowId !== null) {
409
- const i = n.workflows.get(e.workflowId);
410
- if (i !== void 0)
411
- return { text: i, target: { kind: "workflow", id: e.workflowId } };
423
+ if (i === "workflow" && e.workflowId !== null) {
424
+ const s = n.workflows.get(e.workflowId);
425
+ if (s !== void 0)
426
+ return { text: s, target: { kind: "workflow", id: e.workflowId } };
412
427
  }
413
- if (s === "workflow_step") {
414
- const i = e.workflowId, l = i !== null ? n.workflows.get(i) : void 0, o = l ?? i ?? e.summary ?? "Unknown workflow", c = l !== void 0 && i !== null;
428
+ if (i === "workflow_step") {
429
+ const s = e.workflowId, o = s !== null ? n.workflows.get(s) : void 0, r = o ?? s ?? e.summary ?? "Unknown workflow", c = o !== void 0 && s !== null;
415
430
  return {
416
- text: e.stepId ? `${o} - ${e.stepId}` : o,
417
- target: c ? { kind: "workflow", id: i } : null
431
+ text: e.stepId ? `${r} - ${e.stepId}` : r,
432
+ target: c ? { kind: "workflow", id: s } : null
418
433
  };
419
434
  }
420
435
  return { text: a, target: null };
421
436
  }
422
- const re = (e) => String(e).padStart(2, "0");
423
- function at(e) {
437
+ const de = (e) => String(e).padStart(2, "0");
438
+ function Ct(e) {
424
439
  const n = new Date(e);
425
- return Number.isNaN(n.getTime()) ? e : `${`${n.getFullYear()}-${re(n.getMonth() + 1)}-${re(n.getDate())}`} ${re(n.getHours())}:${re(n.getMinutes())}:${re(n.getSeconds())}`;
440
+ return Number.isNaN(n.getTime()) ? e : `${`${n.getFullYear()}-${de(n.getMonth() + 1)}-${de(n.getDate())}`} ${de(n.getHours())}:${de(n.getMinutes())}:${de(n.getSeconds())}`;
426
441
  }
427
- function it(e) {
442
+ function Tt(e) {
428
443
  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`;
429
444
  }
430
- function Bn() {
445
+ function ma() {
431
446
  const e = /* @__PURE__ */ new Date();
432
447
  return e.setHours(0, 0, 0, 0), e.toISOString();
433
448
  }
434
- function Un(e, n) {
449
+ function ha(e, n) {
435
450
  const a = new Date(e);
436
451
  if (Number.isNaN(a.getTime())) return e;
437
- const s = a.toLocaleDateString(void 0, { month: "short", day: "numeric" });
438
- return n === "week" ? `Week of ${s}` : s;
452
+ const i = a.toLocaleDateString(void 0, { month: "short", day: "numeric" });
453
+ return n === "week" ? `Week of ${i}` : i;
439
454
  }
440
- function st({ ok: e }) {
455
+ function Et({ ok: e }) {
441
456
  return e === null ? /* @__PURE__ */ t("span", { className: "muted", children: "–" }) : /* @__PURE__ */ t("span", { className: e ? "ok" : "error", children: e ? "✓" : "✗" });
442
457
  }
443
- function ge({ label: e, value: n }) {
444
- return /* @__PURE__ */ r("div", { className: "w6w-activity-card w6w-activity-stat", children: [
458
+ function De({ label: e, value: n }) {
459
+ return /* @__PURE__ */ l("div", { className: "w6w-activity-card w6w-activity-stat", children: [
445
460
  /* @__PURE__ */ t("div", { className: "w6w-activity-stat-value", children: n }),
446
461
  /* @__PURE__ */ t("div", { className: "muted small", children: e })
447
462
  ] });
448
463
  }
449
- function Ae({
464
+ function Qe({
450
465
  title: e,
451
466
  headline: n,
452
467
  loading: a
453
468
  }) {
454
- const s = n ?? { workflowRuns: 0, succeeded: 0, failed: 0 };
455
- return /* @__PURE__ */ r("section", { className: "w6w-activity-section", children: [
469
+ const i = n ?? { workflowRuns: 0, succeeded: 0, failed: 0 };
470
+ return /* @__PURE__ */ l("section", { className: "w6w-activity-section", children: [
456
471
  /* @__PURE__ */ t("h3", { children: e }),
457
- a ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ r("div", { className: "w6w-activity-stats", children: [
458
- /* @__PURE__ */ t(ge, { label: "Workflow runs", value: s.workflowRuns }),
459
- /* @__PURE__ */ t(ge, { label: "Succeeded", value: s.succeeded }),
460
- /* @__PURE__ */ t(ge, { label: "Failed", value: s.failed })
472
+ a ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ l("div", { className: "w6w-activity-stats", children: [
473
+ /* @__PURE__ */ t(De, { label: "Workflow runs", value: i.workflowRuns }),
474
+ /* @__PURE__ */ t(De, { label: "Succeeded", value: i.succeeded }),
475
+ /* @__PURE__ */ t(De, { label: "Failed", value: i.failed })
461
476
  ] })
462
477
  ] });
463
478
  }
464
- function Vn({
479
+ function wa({
465
480
  entry: e,
466
481
  names: n,
467
482
  getHref: a,
468
- onOpen: s
483
+ onOpen: i
469
484
  }) {
470
- const { text: i, target: l } = Wn(e, n);
471
- if (l === null) return /* @__PURE__ */ t(Q, { children: i });
472
- const o = s ? (c) => s(l, c) : void 0;
473
- return a ? /* @__PURE__ */ t("a", { href: a(l), onClick: o, children: i }) : o ? /* @__PURE__ */ t("button", { type: "button", className: "w6w-activity-link", onClick: o, children: i }) : /* @__PURE__ */ t(Q, { children: i });
485
+ const { text: s, target: o } = ua(e, n);
486
+ if (o === null) return /* @__PURE__ */ t(Q, { children: s });
487
+ const r = i ? (c) => i(o, c) : void 0;
488
+ return a ? /* @__PURE__ */ t("a", { href: a(o), onClick: r, children: s }) : r ? /* @__PURE__ */ t("button", { type: "button", className: "w6w-activity-link", onClick: r, children: s }) : /* @__PURE__ */ t(Q, { children: s });
474
489
  }
475
- function rt({ entry: e, title: n }) {
476
- const a = it(e.durationMs);
490
+ function It({ entry: e, title: n }) {
491
+ const a = Tt(e.durationMs);
477
492
  return /* @__PURE__ */ t(
478
- Ne,
493
+ Ae,
479
494
  {
480
- icon: /* @__PURE__ */ t(st, { ok: e.ok }),
481
- title: n ?? e.summary ?? me(e.kind),
482
- subtitle: `${me(e.kind)} · ${at(e.occurredAt)}`,
495
+ icon: /* @__PURE__ */ t(Et, { ok: e.ok }),
496
+ title: n ?? e.summary ?? ve(e.kind),
497
+ subtitle: `${ve(e.kind)} · ${Ct(e.occurredAt)}`,
483
498
  trailing: a === null ? void 0 : /* @__PURE__ */ t("span", { className: "muted small", children: a })
484
499
  }
485
500
  );
486
501
  }
487
- function ye(e) {
488
- return /* @__PURE__ */ t(rt, { entry: e.entry, title: /* @__PURE__ */ t(Vn, { ...e }) });
502
+ function $e(e) {
503
+ return /* @__PURE__ */ t(It, { entry: e.entry, title: /* @__PURE__ */ t(wa, { ...e }) });
489
504
  }
490
- const Hn = {
491
- base: (e) => /* @__PURE__ */ t(rt, { entry: e.entry }),
492
- function: ye,
493
- workflow: ye,
494
- workflow_step: ye
505
+ const pa = {
506
+ base: (e) => /* @__PURE__ */ t(It, { entry: e.entry }),
507
+ function: $e,
508
+ workflow: $e,
509
+ workflow_step: $e
495
510
  };
496
- function Jn(e) {
497
- const n = Hn[nt(e.entry.kind)];
511
+ function fa(e) {
512
+ const n = pa[kt(e.entry.kind)];
498
513
  return /* @__PURE__ */ t(n, { ...e });
499
514
  }
500
- function ci({ getHref: e, onOpen: n, slots: a }) {
501
- var D, g, w, y, x, S;
502
- const s = Ee("today", { from: Bn(), bucket: "day" }), i = Ee("week", { bucket: "week" }), l = Ke(), o = Ue(), c = ae(
503
- () => _n(l.data, o.data),
504
- [l.data, o.data]
505
- ), d = s.error ?? i.error, h = d ? d.message : null, N = ((D = i.data) == null ? void 0 : D.recent) ?? [], u = ((g = i.data) == null ? void 0 : g.series) ?? [], k = ((w = i.data) == null ? void 0 : w.range.bucket) ?? "week", b = !i.isLoading && N.length === 0 && (((y = i.data) == null ? void 0 : y.headline.workflowRuns) ?? 0) === 0;
506
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
515
+ function Ws({ getHref: e, onOpen: n, slots: a }) {
516
+ var v, y, p, C, I, b;
517
+ const i = Fe("today", { from: ma(), bucket: "day" }), s = Fe("week", { bucket: "week" }), o = Ye(), r = tt(), c = ie(
518
+ () => da(o.data, r.data),
519
+ [o.data, r.data]
520
+ ), u = i.error ?? s.error, h = u ? u.message : null, g = ((v = s.data) == null ? void 0 : v.recent) ?? [], m = ((y = s.data) == null ? void 0 : y.series) ?? [], k = ((p = s.data) == null ? void 0 : p.range.bucket) ?? "week", w = !s.isLoading && g.length === 0 && (((C = s.data) == null ? void 0 : C.headline.workflowRuns) ?? 0) === 0;
521
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
507
522
  h && /* @__PURE__ */ t("div", { className: "error", children: h }),
508
523
  a == null ? void 0 : a.header,
509
524
  a == null ? void 0 : a.actions,
510
525
  /* @__PURE__ */ t(
511
- Ae,
526
+ Qe,
512
527
  {
513
528
  title: "Today",
514
- headline: (x = s.data) == null ? void 0 : x.headline,
515
- loading: s.isLoading
529
+ headline: (I = i.data) == null ? void 0 : I.headline,
530
+ loading: i.isLoading
516
531
  }
517
532
  ),
518
533
  /* @__PURE__ */ t(
519
- Ae,
534
+ Qe,
520
535
  {
521
536
  title: "Last 7 days",
522
- headline: (S = i.data) == null ? void 0 : S.headline,
523
- loading: i.isLoading
537
+ headline: (b = s.data) == null ? void 0 : b.headline,
538
+ loading: s.isLoading
524
539
  }
525
540
  ),
526
541
  a == null ? void 0 : a.betweenHeadlineAndSeries,
527
- /* @__PURE__ */ r("section", { className: "w6w-activity-section", children: [
542
+ /* @__PURE__ */ l("section", { className: "w6w-activity-section", children: [
528
543
  /* @__PURE__ */ t("h3", { children: "Activity over time" }),
529
- /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: i.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : u.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No activity in this window yet." }) : /* @__PURE__ */ t("ul", { className: "list", children: u.map(($) => /* @__PURE__ */ r("li", { children: [
530
- /* @__PURE__ */ r("span", { className: "list-main", children: [
531
- /* @__PURE__ */ t("strong", { children: Un($.bucket, k) }),
544
+ /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: s.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : m.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No activity in this window yet." }) : /* @__PURE__ */ t("ul", { className: "list", children: m.map((E) => /* @__PURE__ */ l("li", { children: [
545
+ /* @__PURE__ */ l("span", { className: "list-main", children: [
546
+ /* @__PURE__ */ t("strong", { children: ha(E.bucket, k) }),
532
547
  " ",
533
- /* @__PURE__ */ t("span", { className: "muted small", children: me($.kind) })
548
+ /* @__PURE__ */ t("span", { className: "muted small", children: ve(E.kind) })
534
549
  ] }),
535
550
  " ",
536
- /* @__PURE__ */ t(st, { ok: $.ok }),
551
+ /* @__PURE__ */ t(Et, { ok: E.ok }),
537
552
  " ",
538
- /* @__PURE__ */ t("span", { className: "muted small", children: $.count })
539
- ] }, `${$.bucket}-${$.kind}-${String($.ok)}`)) }) })
553
+ /* @__PURE__ */ t("span", { className: "muted small", children: E.count })
554
+ ] }, `${E.bucket}-${E.kind}-${String(E.ok)}`)) }) })
540
555
  ] }),
541
- /* @__PURE__ */ r("section", { children: [
556
+ /* @__PURE__ */ l("section", { children: [
542
557
  /* @__PURE__ */ t("h3", { className: "w6w-activity-h3", children: "Recent activity" }),
543
- /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: i.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : b ? (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(($) => /* @__PURE__ */ t(
544
- Jn,
558
+ /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: s.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : w ? (a == null ? void 0 : a.empty) ?? /* @__PURE__ */ t("p", { className: "muted", children: "No runs yet — activity shows up here once your workflows run." }) : g.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No recent activity in this window." }) : /* @__PURE__ */ t("div", { className: "list", children: g.map((E) => /* @__PURE__ */ t(
559
+ fa,
545
560
  {
546
- entry: $,
561
+ entry: E,
547
562
  names: c,
548
563
  getHref: e,
549
564
  onOpen: n
550
565
  },
551
- $.id
566
+ E.id
552
567
  )) }) })
553
568
  ] })
554
569
  ] });
555
570
  }
556
- function Yn(e) {
571
+ function ya(e) {
557
572
  return e !== null && "project" in e;
558
573
  }
559
- function zn(e) {
560
- const n = Ce().project, [a, s] = f(en), i = e.scope !== void 0 ? e.scope : n ? { project: n } : null, l = e.filters !== void 0, o = e.filters ?? a, c = (d) => {
574
+ function ga(e) {
575
+ const n = Me().project, [a, i] = f(bn), s = e.scope !== void 0 ? e.scope : n ? { project: n } : null, o = e.filters !== void 0, r = e.filters ?? a, c = (u) => {
561
576
  var h;
562
- l || s(d), (h = e.onFiltersChange) == null || h.call(e, d);
577
+ o || i(u), (h = e.onFiltersChange) == null || h.call(e, u);
563
578
  };
564
579
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
565
- wn,
580
+ xn,
566
581
  {
567
- scope: i,
568
- showKind: e.showKind ?? Yn(i),
569
- filters: o,
582
+ scope: s,
583
+ showKind: e.showKind ?? ya(s),
584
+ filters: r,
570
585
  onFiltersChange: c,
571
586
  onOpenInEditor: e.onOpenInEditor
572
587
  }
573
588
  ) });
574
589
  }
575
- function Zn({ title: e = "Logs", ...n }) {
576
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-logs", children: [
590
+ function va({ title: e = "Logs", ...n }) {
591
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-logs", children: [
577
592
  e !== null && /* @__PURE__ */ t("h2", { children: e }),
578
- /* @__PURE__ */ t(zn, { ...n })
593
+ /* @__PURE__ */ t(ga, { ...n })
579
594
  ] });
580
595
  }
581
- const di = Zn, Gn = 1440 * 60 * 1e3;
582
- function Xn(e) {
596
+ const Bs = va, ba = 1440 * 60 * 1e3;
597
+ function Na(e) {
583
598
  if (!(e === null || e.timeline === null))
584
599
  return e.timeline.map((n) => ({
585
600
  id: n.id,
@@ -592,39 +607,39 @@ function Xn(e) {
592
607
  link: n.link
593
608
  }));
594
609
  }
595
- function lt(e) {
610
+ function Dt(e) {
596
611
  return e.startedAt !== void 0 && e.resolvedAt === void 0;
597
612
  }
598
- function Re(e) {
613
+ function _e(e) {
599
614
  const n = new Date(e);
600
615
  return Number.isNaN(n.getTime()) ? e : n.toLocaleDateString("en-US", { month: "short", day: "numeric", timeZone: "UTC" });
601
616
  }
602
- function Se(e, n) {
617
+ function qe(e, n) {
603
618
  const a = new Date(e).getTime();
604
- return Number.isNaN(a) ? 0 : Math.max(0, Math.floor((n - a) / Gn));
619
+ return Number.isNaN(a) ? 0 : Math.max(0, Math.floor((n - a) / ba));
605
620
  }
606
- function ea(e, n) {
607
- if (!lt(e) || e.startedAt === void 0) return null;
608
- const a = Se(e.startedAt, n), s = Re(e.startedAt), i = a === 0 ? `open since ${s} (today)` : `open ${a}d (since ${s})`, l = e.updatedAt ?? e.startedAt, o = Se(l, n), c = Re(l), d = o === 0 ? `last update ${c} (today)` : `last update ${c} (${o}d ago)`;
609
- return `${i} · ${d}`;
621
+ function ka(e, n) {
622
+ if (!Dt(e) || e.startedAt === void 0) return null;
623
+ const a = qe(e.startedAt, n), i = _e(e.startedAt), s = a === 0 ? `open since ${i} (today)` : `open ${a}d (since ${i})`, o = e.updatedAt ?? e.startedAt, r = qe(o, n), c = _e(o), u = r === 0 ? `last update ${c} (today)` : `last update ${c} (${r}d ago)`;
624
+ return `${s} · ${u}`;
610
625
  }
611
- function ta(e) {
626
+ function Ca(e) {
612
627
  return e ? Object.entries(e) : [];
613
628
  }
614
- function na(e) {
629
+ function Ta(e) {
615
630
  return e.uptime.map((n) => ({ day: n.day, state: n.state }));
616
631
  }
617
- const ie = [
632
+ const le = [
618
633
  ["e4xx", "4xx"],
619
634
  ["e429", "429 rate-limited"],
620
635
  ["eAuth", "auth (401/403)"],
621
636
  ["e5xx", "5xx"]
622
637
  ];
623
- function ot(e) {
638
+ function $t(e) {
624
639
  const n = new Date(e);
625
640
  return Number.isNaN(n.getTime()) ? e : n.toLocaleDateString(void 0, { month: "short", day: "numeric" });
626
641
  }
627
- function Le(e) {
642
+ function Oe(e) {
628
643
  if (!e) return "—";
629
644
  const n = new Date(e);
630
645
  return Number.isNaN(n.getTime()) ? e : n.toLocaleString(void 0, {
@@ -634,37 +649,37 @@ function Le(e) {
634
649
  minute: "2-digit"
635
650
  });
636
651
  }
637
- function de({ label: e, value: n, hint: a }) {
638
- return /* @__PURE__ */ r("div", { className: "w6w-rel-card", style: { flex: "1 1 150px", minWidth: 150 }, children: [
652
+ function fe({ label: e, value: n, hint: a }) {
653
+ return /* @__PURE__ */ l("div", { className: "w6w-rel-card", style: { flex: "1 1 150px", minWidth: 150 }, children: [
639
654
  /* @__PURE__ */ t("div", { style: { fontSize: "1.6rem", fontWeight: "var(--w6w-fw-semibold)", lineHeight: 1.15 }, children: n }),
640
655
  /* @__PURE__ */ t("div", { className: "muted small", children: e }),
641
656
  a && /* @__PURE__ */ t("div", { className: "muted small", children: a })
642
657
  ] });
643
658
  }
644
- function aa({
659
+ function Ea({
645
660
  vendor: e,
646
661
  displayName: n
647
662
  }) {
648
663
  if (!e)
649
- return /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
650
- /* @__PURE__ */ r("h4", { style: { margin: "0 0 var(--w6w-sp-1)" }, children: [
664
+ return /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
665
+ /* @__PURE__ */ l("h4", { style: { margin: "0 0 var(--w6w-sp-1)" }, children: [
651
666
  n,
652
667
  " status"
653
668
  ] }),
654
- /* @__PURE__ */ r("p", { className: "muted", children: [
669
+ /* @__PURE__ */ l("p", { className: "muted", children: [
655
670
  n,
656
671
  " publishes no public health check, so there is nothing to ask about it. That is a statement about ",
657
672
  n,
658
673
  ", not a gap in the data above."
659
674
  ] })
660
675
  ] });
661
- const a = e.state === "unknown", s = ta(e.components), i = (e.timeline ?? []).filter(lt), l = Date.now();
662
- return /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
663
- /* @__PURE__ */ r("h4", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
676
+ const a = e.state === "unknown", i = Ca(e.components), s = (e.timeline ?? []).filter(Dt), o = Date.now();
677
+ return /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
678
+ /* @__PURE__ */ l("h4", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
664
679
  n,
665
680
  " status",
666
681
  " ",
667
- /* @__PURE__ */ t(ue, { state: e.state, label: a ? "Unavailable" : void 0 })
682
+ /* @__PURE__ */ t(ye, { state: e.state, label: a ? "Unavailable" : void 0 })
668
683
  ] }),
669
684
  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." }),
670
685
  e.message && /* @__PURE__ */ t(
@@ -675,7 +690,7 @@ function aa({
675
690
  children: e.message
676
691
  }
677
692
  ),
678
- /* @__PURE__ */ r("p", { className: "muted small", style: { margin: 0 }, children: [
693
+ /* @__PURE__ */ l("p", { className: "muted small", style: { margin: 0 }, children: [
679
694
  a ? "Tried to read" : "Read from",
680
695
  " ",
681
696
  n,
@@ -684,167 +699,167 @@ function aa({
684
699
  n,
685
700
  " says about itself, not what your calls did · last checked",
686
701
  " ",
687
- Le(e.checkedAt),
688
- e.attributedTo.length > 0 && /* @__PURE__ */ r(Q, { children: [
702
+ Oe(e.checkedAt),
703
+ e.attributedTo.length > 0 && /* @__PURE__ */ l(Q, { children: [
689
704
  " ",
690
705
  "· decided by",
691
706
  " ",
692
- e.attributedTo.map((o) => /* @__PURE__ */ t("code", { children: o }, o))
707
+ e.attributedTo.map((r) => /* @__PURE__ */ t("code", { children: r }, r))
693
708
  ] })
694
709
  ] }),
695
- s.length > 0 && /* @__PURE__ */ t("div", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: s.map(([o, c]) => /* @__PURE__ */ r("span", { className: "w6w-rel-tag", children: [
696
- o,
710
+ i.length > 0 && /* @__PURE__ */ t("div", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: i.map(([r, c]) => /* @__PURE__ */ l("span", { className: "w6w-rel-tag", children: [
711
+ r,
697
712
  ": ",
698
713
  c.state
699
- ] }, o)) }),
700
- i.length > 0 && /* @__PURE__ */ t("ul", { className: "list", style: { margin: "var(--w6w-sp-2) 0 0" }, children: i.map((o) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ r("div", { className: "list-main", children: [
701
- /* @__PURE__ */ t("strong", { children: o.title }),
714
+ ] }, r)) }),
715
+ s.length > 0 && /* @__PURE__ */ t("ul", { className: "list", style: { margin: "var(--w6w-sp-2) 0 0" }, children: s.map((r) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ l("div", { className: "list-main", children: [
716
+ /* @__PURE__ */ t("strong", { children: r.title }),
702
717
  " ",
703
- /* @__PURE__ */ t(ue, { state: o.state }),
704
- /* @__PURE__ */ t("div", { className: "muted small", children: ea(o, l) })
705
- ] }) }, o.id ?? o.title)) }),
706
- 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: [
718
+ /* @__PURE__ */ t(ye, { state: r.state }),
719
+ /* @__PURE__ */ t("div", { className: "muted small", children: ka(r, o) })
720
+ ] }) }, r.id ?? r.title)) }),
721
+ e.statusPageUrl !== null && /* @__PURE__ */ t("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: /* @__PURE__ */ l("a", { href: e.statusPageUrl, target: "_blank", rel: "noopener noreferrer", children: [
707
722
  n,
708
723
  "'s status page ↗"
709
724
  ] }) })
710
725
  ] });
711
726
  }
712
- function ia({ service: e }) {
727
+ function Ia({ service: e }) {
713
728
  if (e.calls === 0)
714
729
  return /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t("span", { className: "w6w-rel-idle-note", children: "No calls in this window" }) });
715
- const n = e.uptime, a = Math.max(1, ...n.map((s) => s.calls));
716
- return /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
730
+ const n = e.uptime, a = Math.max(1, ...n.map((i) => i.calls));
731
+ return /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
717
732
  /* @__PURE__ */ t(
718
733
  "div",
719
734
  {
720
735
  className: "rel-daily-chart",
721
736
  role: "img",
722
737
  "aria-label": `${e.displayName}, calls per day, oldest first`,
723
- children: n.map((s) => /* @__PURE__ */ t(
738
+ children: n.map((i) => /* @__PURE__ */ t(
724
739
  "span",
725
740
  {
726
- className: `rel-daily-bar rel-daily-bar-${s.state}`,
727
- style: { height: `${s.calls > 0 ? Math.max(s.calls / a * 100, 4) : 2}%` },
728
- title: `${ot(`${s.day}T00:00:00.000Z`)} — ${s.calls} calls, ${s.state}`
741
+ className: `rel-daily-bar rel-daily-bar-${i.state}`,
742
+ style: { height: `${i.calls > 0 ? Math.max(i.calls / a * 100, 4) : 2}%` },
743
+ title: `${$t(`${i.day}T00:00:00.000Z`)} — ${i.calls} calls, ${i.state}`
729
744
  },
730
- s.day
745
+ i.day
731
746
  ))
732
747
  }
733
748
  ),
734
749
  /* @__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." })
735
750
  ] });
736
751
  }
737
- function sa({
752
+ function Da({
738
753
  service: e,
739
754
  window: n
740
755
  }) {
741
- const a = [...e.uptime].reverse().filter((o) => o.calls > 0), s = e.vendorStatus, i = Xn(s), l = i === void 0 ? `${e.displayName} publishes no incident history.` : `No incidents from ${e.displayName} in this window.`;
742
- return /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
756
+ const a = [...e.uptime].reverse().filter((r) => r.calls > 0), i = e.vendorStatus, s = Na(i), o = s === void 0 ? `${e.displayName} publishes no incident history.` : `No incidents from ${e.displayName} in this window.`;
757
+ return /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
743
758
  /* @__PURE__ */ t(
744
- kt,
759
+ _t,
745
760
  {
746
761
  window: n,
747
- days: na(e),
748
- incidents: i,
749
- vendorEmptyLabel: l,
762
+ days: Ta(e),
763
+ incidents: s,
764
+ vendorEmptyLabel: o,
750
765
  ariaLabel: `${e.displayName}, ${e.uptime.length}-day status and ${e.displayName} incidents, oldest day first`
751
766
  }
752
767
  ),
753
- /* @__PURE__ */ r("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: [
768
+ /* @__PURE__ */ l("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: [
754
769
  "Oldest day leftmost. Days with no calls are ",
755
770
  /* @__PURE__ */ t("code", { children: "unknown" }),
756
771
  " — never a quiet green."
757
772
  ] }),
758
- 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: [
759
- /* @__PURE__ */ t("span", { style: { minWidth: 96 }, children: /* @__PURE__ */ t("strong", { children: ot(`${o.day}T00:00:00.000Z`) }) }),
760
- /* @__PURE__ */ t(ue, { state: o.state }),
761
- /* @__PURE__ */ r("span", { className: "muted small", children: [
762
- o.calls,
773
+ a.length > 0 && /* @__PURE__ */ t("div", { className: "list", style: { marginTop: "var(--w6w-sp-3)" }, children: a.slice(0, 14).map((r) => /* @__PURE__ */ l("div", { className: "rel-day-row", children: [
774
+ /* @__PURE__ */ t("span", { style: { minWidth: 96 }, children: /* @__PURE__ */ t("strong", { children: $t(`${r.day}T00:00:00.000Z`) }) }),
775
+ /* @__PURE__ */ t(ye, { state: r.state }),
776
+ /* @__PURE__ */ l("span", { className: "muted small", children: [
777
+ r.calls,
763
778
  " calls"
764
779
  ] }),
765
- /* @__PURE__ */ t("span", { className: "rel-errors", children: ie.filter(([c]) => o.errors[c] > 0).map(([c, d]) => /* @__PURE__ */ r("span", { className: "w6w-rel-tag", children: [
766
- d,
780
+ /* @__PURE__ */ t("span", { className: "rel-errors", children: le.filter(([c]) => r.errors[c] > 0).map(([c, u]) => /* @__PURE__ */ l("span", { className: "w6w-rel-tag", children: [
781
+ u,
767
782
  " ×",
768
- o.errors[c]
783
+ r.errors[c]
769
784
  ] }, c)) })
770
- ] }, o.day)) })
785
+ ] }, r.day)) })
771
786
  ] });
772
787
  }
773
- function ra({ errors: e }) {
774
- if (ie.reduce((s, [i]) => s + e[i], 0) === 0)
788
+ function $a({ errors: e }) {
789
+ if (le.reduce((i, [s]) => i + e[s], 0) === 0)
775
790
  return /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t("p", { className: "muted", style: { margin: 0 }, children: "No errors in this window." }) });
776
- const a = Math.max(1, ...ie.map(([s]) => e[s]));
777
- return /* @__PURE__ */ t("div", { className: "w6w-rel-card rel-errormix-chart", children: ie.map(([s, i]) => /* @__PURE__ */ r("div", { className: "rel-errormix-row", children: [
778
- /* @__PURE__ */ t("span", { className: "muted small", children: i }),
791
+ const a = Math.max(1, ...le.map(([i]) => e[i]));
792
+ return /* @__PURE__ */ t("div", { className: "w6w-rel-card rel-errormix-chart", children: le.map(([i, s]) => /* @__PURE__ */ l("div", { className: "rel-errormix-row", children: [
793
+ /* @__PURE__ */ t("span", { className: "muted small", children: s }),
779
794
  /* @__PURE__ */ t("span", { className: "rel-errormix-track", children: /* @__PURE__ */ t(
780
795
  "span",
781
796
  {
782
797
  className: "rel-errormix-bar",
783
- style: { width: `${Math.max(e[s] / a * 100, e[s] > 0 ? 2 : 0)}%` }
798
+ style: { width: `${Math.max(e[i] / a * 100, e[i] > 0 ? 2 : 0)}%` }
784
799
  }
785
800
  ) }),
786
- /* @__PURE__ */ t("span", { className: "rel-errormix-value small", children: e[s] })
787
- ] }, s)) });
801
+ /* @__PURE__ */ t("span", { className: "rel-errormix-value small", children: e[i] })
802
+ ] }, i)) });
788
803
  }
789
- function la({ project: e, appId: n }) {
790
- const a = rn(e, n, { limit: 50 });
804
+ function La({ project: e, appId: n }) {
805
+ const a = En(e, n, { limit: 50 });
791
806
  if (a.isLoading) return /* @__PURE__ */ t("p", { className: "muted", children: "Loading calls…" });
792
807
  if (a.error) {
793
- const i = a.error;
794
- return /* @__PURE__ */ t("div", { className: "error", children: (i instanceof He, i.message) });
808
+ const s = a.error;
809
+ return /* @__PURE__ */ t("div", { className: "error", children: (s instanceof at, s.message) });
795
810
  }
796
- const s = a.data ?? [];
797
- return s.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: [
798
- /* @__PURE__ */ r("div", { className: "rel-call rel-call-head", children: [
811
+ const i = a.data ?? [];
812
+ 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__ */ l("div", { className: "rel-calls", children: [
813
+ /* @__PURE__ */ l("div", { className: "rel-call rel-call-head", children: [
799
814
  /* @__PURE__ */ t("span", { children: "When" }),
800
815
  /* @__PURE__ */ t("span", { children: "Action" }),
801
816
  /* @__PURE__ */ t("span", { children: "Method" }),
802
817
  /* @__PURE__ */ t("span", { children: "Status" }),
803
818
  /* @__PURE__ */ t("span", { children: "Took" })
804
819
  ] }),
805
- s.map((i, l) => /* @__PURE__ */ r("div", { className: "rel-call", children: [
806
- /* @__PURE__ */ t("span", { className: "muted small", children: Le(i.createdAt) }),
807
- /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t("code", { children: i.actionKey ?? "—" }) }),
808
- /* @__PURE__ */ t("span", { className: "muted small", children: i.method }),
809
- /* @__PURE__ */ t("span", { className: i.status >= 400 || i.status === 0 ? "error" : "ok", children: i.status === 0 ? "no response" : i.status }),
810
- /* @__PURE__ */ t("span", { className: "muted small", children: i.durationMs != null ? `${i.durationMs} ms` : "—" })
811
- ] }, i.id ?? `${i.createdAt}-${l}`))
820
+ i.map((s, o) => /* @__PURE__ */ l("div", { className: "rel-call", children: [
821
+ /* @__PURE__ */ t("span", { className: "muted small", children: Oe(s.createdAt) }),
822
+ /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t("code", { children: s.actionKey ?? "—" }) }),
823
+ /* @__PURE__ */ t("span", { className: "muted small", children: s.method }),
824
+ /* @__PURE__ */ t("span", { className: s.status >= 400 || s.status === 0 ? "error" : "ok", children: s.status === 0 ? "no response" : s.status }),
825
+ /* @__PURE__ */ t("span", { className: "muted small", children: s.durationMs != null ? `${s.durationMs} ms` : "—" })
826
+ ] }, s.id ?? `${s.createdAt}-${o}`))
812
827
  ] });
813
828
  }
814
- function oa({
829
+ function Aa({
815
830
  backHref: e,
816
831
  onBack: n
817
832
  }) {
818
833
  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;
819
834
  }
820
- function ui({
835
+ function Us({
821
836
  appId: e,
822
837
  project: n,
823
838
  days: a = 30,
824
- backHref: s,
825
- onBack: i,
826
- slots: l
839
+ backHref: i,
840
+ onBack: s,
841
+ slots: o
827
842
  }) {
828
- var k, b, D, g;
829
- const o = Ce().project, c = (n === void 0 ? o : n) || void 0, d = sn(c, [e], a), h = d.error, N = h ? (h instanceof He, h.message) : null, u = (k = d.data) == null ? void 0 : k.services.find((w) => w.appId === e);
830
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
831
- l == null ? void 0 : l.header,
832
- l == null ? void 0 : l.actions,
843
+ var k, w, v, y;
844
+ const r = Me().project, c = (n === void 0 ? r : n) || void 0, u = Tn(c, [e], a), h = u.error, g = h ? (h instanceof at, h.message) : null, m = (k = u.data) == null ? void 0 : k.services.find((p) => p.appId === e);
845
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
846
+ o == null ? void 0 : o.header,
847
+ o == null ? void 0 : o.actions,
833
848
  !c && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see this service." }),
834
- N && /* @__PURE__ */ t("div", { className: "error", children: N }),
835
- c && d.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
836
- d.data && !u && /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
837
- (l == null ? void 0 : l.empty) ?? /* @__PURE__ */ r("p", { className: "muted", children: [
849
+ g && /* @__PURE__ */ t("div", { className: "error", children: g }),
850
+ c && u.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
851
+ u.data && !m && /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
852
+ (o == null ? void 0 : o.empty) ?? /* @__PURE__ */ l("p", { className: "muted", children: [
838
853
  /* @__PURE__ */ t("code", { children: e }),
839
854
  " is not used by this project's definitions and has no calls in the last ",
840
855
  a,
841
856
  " days."
842
857
  ] }),
843
- /* @__PURE__ */ t(oa, { backHref: s, onBack: i })
858
+ /* @__PURE__ */ t(Aa, { backHref: i, onBack: s })
844
859
  ] }),
845
- u && /* @__PURE__ */ r(Q, { children: [
846
- /* @__PURE__ */ r("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
847
- /* @__PURE__ */ r(
860
+ m && /* @__PURE__ */ l(Q, { children: [
861
+ /* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
862
+ /* @__PURE__ */ l(
848
863
  "div",
849
864
  {
850
865
  style: {
@@ -854,68 +869,68 @@ function ui({
854
869
  marginBottom: "var(--w6w-sp-3)"
855
870
  },
856
871
  children: [
857
- /* @__PURE__ */ t(ue, { state: u.state }),
872
+ /* @__PURE__ */ t(ye, { state: m.state }),
858
873
  /* @__PURE__ */ t("span", { className: "muted small", children: "from your calls" }),
859
- /* @__PURE__ */ t("code", { className: "muted small", children: u.appId }),
860
- u.ongoingOutageId && /* @__PURE__ */ t("span", { className: "w6w-rel-tag", children: "outage still open" })
874
+ /* @__PURE__ */ t("code", { className: "muted small", children: m.appId }),
875
+ m.ongoingOutageId && /* @__PURE__ */ t("span", { className: "w6w-rel-tag", children: "outage still open" })
861
876
  ]
862
877
  }
863
878
  ),
864
- /* @__PURE__ */ r("div", { style: { display: "flex", gap: "var(--w6w-sp-3)", flexWrap: "wrap" }, children: [
865
- /* @__PURE__ */ t(de, { label: "Calls in window", value: String(u.calls) }),
879
+ /* @__PURE__ */ l("div", { style: { display: "flex", gap: "var(--w6w-sp-3)", flexWrap: "wrap" }, children: [
880
+ /* @__PURE__ */ t(fe, { label: "Calls in window", value: String(m.calls) }),
866
881
  /* @__PURE__ */ t(
867
- de,
882
+ fe,
868
883
  {
869
884
  label: "p95 latency",
870
- value: u.p95Ms === null ? "—" : `${u.p95Ms} ms`,
871
- hint: u.p95Ms === null ? "no timed calls" : void 0
885
+ value: m.p95Ms === null ? "—" : `${m.p95Ms} ms`,
886
+ hint: m.p95Ms === null ? "no timed calls" : void 0
872
887
  }
873
888
  ),
874
- /* @__PURE__ */ t(de, { label: "Last call", value: Le(u.lastCallAt) }),
889
+ /* @__PURE__ */ t(fe, { label: "Last call", value: Oe(m.lastCallAt) }),
875
890
  /* @__PURE__ */ t(
876
- de,
891
+ fe,
877
892
  {
878
893
  label: "Errors",
879
- value: String(ie.reduce((w, [y]) => w + u.errors[y], 0)),
880
- hint: ie.filter(([w]) => u.errors[w] > 0).map(([w, y]) => `${y} ×${u.errors[w]}`).join(" · ") || "none"
894
+ value: String(le.reduce((p, [C]) => p + m.errors[C], 0)),
895
+ hint: le.filter(([p]) => m.errors[p] > 0).map(([p, C]) => `${C} ×${m.errors[p]}`).join(" · ") || "none"
881
896
  }
882
897
  )
883
898
  ] })
884
899
  ] }),
885
- /* @__PURE__ */ r("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
900
+ /* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
886
901
  /* @__PURE__ */ t("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "Error mix" }),
887
- /* @__PURE__ */ t(ra, { errors: u.errors })
902
+ /* @__PURE__ */ t($a, { errors: m.errors })
888
903
  ] }),
889
- /* @__PURE__ */ r("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
904
+ /* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
890
905
  /* @__PURE__ */ t("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "API status" }),
891
- /* @__PURE__ */ t(aa, { vendor: u.vendorStatus, displayName: u.displayName })
906
+ /* @__PURE__ */ t(Ea, { vendor: m.vendorStatus, displayName: m.displayName })
892
907
  ] }),
893
- /* @__PURE__ */ r("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
894
- /* @__PURE__ */ r("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
908
+ /* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
909
+ /* @__PURE__ */ l("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
895
910
  "Last ",
896
- ((b = d.data) == null ? void 0 : b.window.days) ?? a,
911
+ ((w = u.data) == null ? void 0 : w.window.days) ?? a,
897
912
  " days",
898
913
  " ",
899
- /* @__PURE__ */ r("span", { className: "muted small", children: [
914
+ /* @__PURE__ */ l("span", { className: "muted small", children: [
900
915
  "uptime means ",
901
- (D = d.data) == null ? void 0 : D.uptimeMeans
916
+ (v = u.data) == null ? void 0 : v.uptimeMeans
902
917
  ] })
903
918
  ] }),
904
- /* @__PURE__ */ t(sa, { service: u, window: ((g = d.data) == null ? void 0 : g.window) ?? { from: "", to: "" } }),
905
- /* @__PURE__ */ t(ia, { service: u })
919
+ /* @__PURE__ */ t(Da, { service: m, window: ((y = u.data) == null ? void 0 : y.window) ?? { from: "", to: "" } }),
920
+ /* @__PURE__ */ t(Ia, { service: m })
906
921
  ] }),
907
- /* @__PURE__ */ r("section", { children: [
908
- /* @__PURE__ */ r("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
922
+ /* @__PURE__ */ l("section", { children: [
923
+ /* @__PURE__ */ l("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
909
924
  "Recent calls",
910
925
  " ",
911
926
  /* @__PURE__ */ t("span", { className: "muted small", children: "the requests behind the numbers above" })
912
927
  ] }),
913
- /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t(la, { project: c, appId: u.appId }) })
928
+ /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t(La, { project: c, appId: m.appId }) })
914
929
  ] })
915
930
  ] })
916
931
  ] });
917
932
  }
918
- function ca(e) {
933
+ function Sa(e) {
919
934
  if (typeof e == "string") return e;
920
935
  if (e && typeof e == "object") {
921
936
  const n = e;
@@ -924,18 +939,18 @@ function ca(e) {
924
939
  }
925
940
  return String(e);
926
941
  }
927
- function da({
942
+ function Ma({
928
943
  routes: e,
929
944
  projectId: n
930
945
  }) {
931
- const [a, s] = f(null), i = e.find((l) => l.id === a);
932
- return e.length === 0 ? null : /* @__PURE__ */ r(Q, { children: [
933
- /* @__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: [
946
+ const [a, i] = f(null), s = e.find((o) => o.id === a);
947
+ return e.length === 0 ? null : /* @__PURE__ */ l(Q, { children: [
948
+ /* @__PURE__ */ t("ul", { className: "list small", "data-testid": "connection-dependent-routes", children: e.map((o) => /* @__PURE__ */ l("li", { "data-testid": `connection-dependent-route-${o.id}`, children: [
934
949
  /* @__PURE__ */ t("span", { className: "badge", children: "route" }),
935
950
  " ",
936
- /* @__PURE__ */ t("span", { children: l.name }),
951
+ /* @__PURE__ */ t("span", { children: o.name }),
937
952
  " ",
938
- l.status === "broken" && /* @__PURE__ */ r(Q, { children: [
953
+ o.status === "broken" && /* @__PURE__ */ l(Q, { children: [
939
954
  /* @__PURE__ */ t("span", { className: "tag warn", children: "broken" }),
940
955
  " ",
941
956
  /* @__PURE__ */ t(
@@ -943,47 +958,47 @@ function da({
943
958
  {
944
959
  type: "button",
945
960
  className: "btn link",
946
- "data-testid": `connection-route-reconnect-${l.id}`,
947
- onClick: () => s(l.id),
961
+ "data-testid": `connection-route-reconnect-${o.id}`,
962
+ onClick: () => i(o.id),
948
963
  children: "Reconnect"
949
964
  }
950
965
  )
951
966
  ] })
952
- ] }, l.id)) }),
953
- i != null && /* @__PURE__ */ t(
954
- ua,
967
+ ] }, o.id)) }),
968
+ s != null && /* @__PURE__ */ t(
969
+ xa,
955
970
  {
956
- routeId: i.id,
957
- projectId: i.project ?? n,
958
- onDone: () => s(null)
971
+ routeId: s.id,
972
+ projectId: s.project ?? n,
973
+ onDone: () => i(null)
959
974
  }
960
975
  )
961
976
  ] });
962
977
  }
963
- function ua(e) {
964
- return /* @__PURE__ */ r("div", { "data-testid": "connection-route-reconnect-host", children: [
965
- /* @__PURE__ */ t(vn, { projectId: e.projectId, initialEditRouteId: e.routeId }),
978
+ function xa(e) {
979
+ return /* @__PURE__ */ l("div", { "data-testid": "connection-route-reconnect-host", children: [
980
+ /* @__PURE__ */ t(Kn, { projectId: e.projectId, initialEditRouteId: e.routeId }),
966
981
  /* @__PURE__ */ t("button", { type: "button", className: "btn link", onClick: e.onDone, children: "Done" })
967
982
  ] });
968
983
  }
969
- function ct({
984
+ function Lt({
970
985
  callables: e,
971
986
  onOpenCallable: n,
972
987
  routes: a,
973
- projectId: s
988
+ projectId: i
974
989
  }) {
975
- return /* @__PURE__ */ r(Q, { children: [
976
- /* @__PURE__ */ t(da, { routes: a ?? [], projectId: s }),
977
- /* @__PURE__ */ t(ma, { callables: e, onOpenCallable: n })
990
+ return /* @__PURE__ */ l(Q, { children: [
991
+ /* @__PURE__ */ t(Ma, { routes: a ?? [], projectId: i }),
992
+ /* @__PURE__ */ t(Ra, { callables: e, onOpenCallable: n })
978
993
  ] });
979
994
  }
980
- function ma({
995
+ function Ra({
981
996
  callables: e,
982
997
  onOpenCallable: n
983
998
  }) {
984
999
  return /* @__PURE__ */ t("ul", { className: "list small", children: e.map((a) => {
985
- const s = a.displayName || a.key || a.id, i = a.sites.map(ca);
986
- return /* @__PURE__ */ r("li", { children: [
1000
+ const i = a.displayName || a.key || a.id, s = a.sites.map(Sa);
1001
+ return /* @__PURE__ */ l("li", { children: [
987
1002
  /* @__PURE__ */ t("span", { className: "badge", children: a.kind }),
988
1003
  " ",
989
1004
  n ? /* @__PURE__ */ t(
@@ -992,116 +1007,118 @@ function ma({
992
1007
  type: "button",
993
1008
  className: "btn link",
994
1009
  onClick: () => n(a.kind, a.id),
995
- children: s
1010
+ children: i
996
1011
  }
997
- ) : /* @__PURE__ */ t("span", { children: s }),
1012
+ ) : /* @__PURE__ */ t("span", { children: i }),
998
1013
  !a.enabled && /* @__PURE__ */ t("span", { className: "muted", children: " (disabled)" }),
999
- i.length > 0 && /* @__PURE__ */ r("span", { className: "muted", children: [
1014
+ s.length > 0 && /* @__PURE__ */ l("span", { className: "muted", children: [
1000
1015
  " · ",
1001
- i.join(", ")
1016
+ s.join(", ")
1002
1017
  ] })
1003
1018
  ] }, `${a.kind}:${a.id}`);
1004
1019
  }) });
1005
1020
  }
1006
- const ha = [];
1007
- function mi({
1021
+ const Pa = [];
1022
+ function Hs({
1008
1023
  onOpen: e,
1009
1024
  getHref: n,
1010
1025
  addLabel: a,
1011
- slots: s,
1012
- onOpenCallable: i
1026
+ slots: i,
1027
+ onOpenCallable: s,
1028
+ onCreateSharedCredential: o
1013
1029
  }) {
1014
- var P, A;
1015
- const l = Fe(), o = we(), c = pn(), h = c.data ?? ha, N = ae(() => qe(h), [h]), { byId: u } = Ve(N), k = fn(), [b, D] = f(!1), [g, w] = f(null), [y, x] = f(null), S = G(void 0), $ = Ye((y == null ? void 0 : y.id) ?? "", y !== null), T = typeof l.updateConnection == "function", j = s && "actions" in s ? s.actions : /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", onClick: () => D(!0), children: a ?? "+ Add connection" });
1016
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
1030
+ var R, x;
1031
+ const r = Je(), c = me(), u = it(), g = u.data ?? Pa, m = ie(() => Ge(g), [g]), { byId: k } = nt(m), w = lt(), [v, y] = f(!1), [p, C] = f(null), [I, b] = f(null), E = X(void 0), T = rt((I == null ? void 0 : I.id) ?? "", I !== null), j = typeof r.updateConnection == "function", O = i && "actions" in i ? i.actions : /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", onClick: () => y(!0), children: a ?? "+ Add connection" });
1032
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
1017
1033
  /* @__PURE__ */ t(
1018
- Ct,
1034
+ qt,
1019
1035
  {
1020
- connections: h,
1021
- appsById: u,
1022
- loading: c.isLoading,
1023
- error: c.error ? c.error.message : null,
1036
+ connections: g,
1037
+ appsById: k,
1038
+ loading: u.isLoading,
1039
+ error: u.error ? u.error.message : null,
1024
1040
  onOpen: e,
1025
1041
  getHref: n,
1026
- onEdit: T ? w : void 0,
1027
- onDelete: x,
1028
- busy: k.isPending,
1029
- slots: { ...s, actions: j }
1042
+ onEdit: j ? C : void 0,
1043
+ onDelete: b,
1044
+ busy: w.isPending,
1045
+ slots: { ...i, actions: O }
1030
1046
  }
1031
1047
  ),
1032
- b && /* @__PURE__ */ t(
1033
- Dt,
1048
+ v && /* @__PURE__ */ t(
1049
+ Vt,
1034
1050
  {
1035
- onClose: () => D(!1),
1051
+ onCreateSharedCredential: o,
1052
+ onClose: () => y(!1),
1036
1053
  onCreated: () => {
1037
- D(!1), o.invalidateQueries({ queryKey: be });
1054
+ y(!1), c.invalidateQueries({ queryKey: ge });
1038
1055
  }
1039
1056
  }
1040
1057
  ),
1041
- g && /* @__PURE__ */ t(
1042
- _e,
1058
+ p && /* @__PURE__ */ t(
1059
+ Ze,
1043
1060
  {
1044
- connection: g,
1045
- onClose: () => w(null),
1061
+ connection: p,
1062
+ onClose: () => C(null),
1046
1063
  onSaved: () => {
1047
- const R = g.id;
1048
- w(null), o.invalidateQueries({ queryKey: be }), o.invalidateQueries({ queryKey: ze(R) });
1064
+ const D = p.id;
1065
+ C(null), c.invalidateQueries({ queryKey: ge }), c.invalidateQueries({ queryKey: ot(D) });
1049
1066
  }
1050
1067
  }
1051
1068
  ),
1052
- y && /* @__PURE__ */ t(
1053
- wa,
1069
+ I && /* @__PURE__ */ t(
1070
+ Oa,
1054
1071
  {
1055
- name: y.displayName || y.id,
1056
- loading: $.isLoading,
1057
- callables: $.isError ? [] : ((P = $.data) == null ? void 0 : P.callables) ?? [],
1058
- routes: $.isError ? [] : ((A = $.data) == null ? void 0 : A.routes) ?? [],
1059
- projectId: S,
1060
- onOpenCallable: i,
1061
- onClose: () => x(null),
1072
+ name: I.displayName || I.id,
1073
+ loading: T.isLoading,
1074
+ callables: T.isError ? [] : ((R = T.data) == null ? void 0 : R.callables) ?? [],
1075
+ routes: T.isError ? [] : ((x = T.data) == null ? void 0 : x.routes) ?? [],
1076
+ projectId: E,
1077
+ onOpenCallable: s,
1078
+ onClose: () => b(null),
1062
1079
  onConfirm: () => {
1063
- const R = y.id;
1064
- x(null), k.mutate({ id: R, force: !0 });
1080
+ const D = I.id;
1081
+ b(null), w.mutate({ id: D, force: !0 });
1065
1082
  }
1066
1083
  }
1067
1084
  )
1068
1085
  ] });
1069
1086
  }
1070
- function wa({
1087
+ function Oa({
1071
1088
  name: e,
1072
1089
  loading: n,
1073
1090
  callables: a,
1074
- routes: s,
1075
- projectId: i,
1076
- onOpenCallable: l,
1077
- onClose: o,
1091
+ routes: i,
1092
+ projectId: s,
1093
+ onOpenCallable: o,
1094
+ onClose: r,
1078
1095
  onConfirm: c
1079
1096
  }) {
1080
- const d = a.length, h = s.length, N = d + h, u = `Delete the connection "${e}"? This cannot be undone.`, k = (g, w, y) => `${g} ${g === 1 ? w : y}`, b = [
1081
- d > 0 ? k(d, "callable", "callables") : null,
1097
+ const u = a.length, h = i.length, g = u + h, m = `Delete the connection "${e}"? This cannot be undone.`, k = (y, p, C) => `${y} ${y === 1 ? p : C}`, w = [
1098
+ u > 0 ? k(u, "callable", "callables") : null,
1082
1099
  h > 0 ? k(h, "model route", "model routes") : null
1083
- ].filter(Boolean).join(" and "), D = [
1084
- d > 0 ? `Deleting disables ${d === 1 ? "this callable" : `these ${d} callables`} until you reconnect ${d === 1 ? "it" : "them"}.` : null,
1100
+ ].filter(Boolean).join(" and "), v = [
1101
+ u > 0 ? `Deleting disables ${u === 1 ? "this callable" : `these ${u} callables`} until you reconnect ${u === 1 ? "it" : "them"}.` : null,
1085
1102
  h > 0 ? `${h === 1 ? "The model route becomes" : `The ${h} model routes become`} broken until ${h === 1 ? "it is" : "they are"} pointed at another connection.` : null
1086
- ].filter((g) => g != null);
1087
- return /* @__PURE__ */ r($t, { title: "Delete connection", onClose: o, children: [
1088
- /* @__PURE__ */ r("div", { className: "w6w-modal-body", children: [
1089
- /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: N === 0 ? u : `Delete the connection "${e}"? Used by ${b}.` }),
1090
- N > 0 && /* @__PURE__ */ r(Q, { children: [
1103
+ ].filter((y) => y != null);
1104
+ return /* @__PURE__ */ l(Wt, { title: "Delete connection", onClose: r, children: [
1105
+ /* @__PURE__ */ l("div", { className: "w6w-modal-body", children: [
1106
+ /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: g === 0 ? m : `Delete the connection "${e}"? Used by ${w}.` }),
1107
+ g > 0 && /* @__PURE__ */ l(Q, { children: [
1091
1108
  /* @__PURE__ */ t(
1092
- ct,
1109
+ Lt,
1093
1110
  {
1094
1111
  callables: a,
1095
- routes: s,
1096
- projectId: i,
1097
- onOpenCallable: l
1112
+ routes: i,
1113
+ projectId: s,
1114
+ onOpenCallable: o
1098
1115
  }
1099
1116
  ),
1100
- /* @__PURE__ */ t("p", { className: "w6w-small", children: D.join(" ") })
1117
+ /* @__PURE__ */ t("p", { className: "w6w-small", children: v.join(" ") })
1101
1118
  ] })
1102
1119
  ] }),
1103
- /* @__PURE__ */ r("div", { className: "w6w-modal-actions", children: [
1104
- /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: o, children: "Cancel" }),
1120
+ /* @__PURE__ */ l("div", { className: "w6w-modal-actions", children: [
1121
+ /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: r, children: "Cancel" }),
1105
1122
  /* @__PURE__ */ t(
1106
1123
  "button",
1107
1124
  {
@@ -1115,294 +1132,294 @@ function wa({
1115
1132
  ] })
1116
1133
  ] });
1117
1134
  }
1118
- function ve(e) {
1135
+ function Le(e) {
1119
1136
  const n = new Date(e).getTime();
1120
1137
  if (Number.isNaN(n)) return "recently";
1121
1138
  const a = Math.max(0, Math.round((Date.now() - n) / 1e3));
1122
1139
  if (a < 45) return "just now";
1123
- const s = Math.round(a / 60);
1124
- if (s < 60) return `${s}m ago`;
1125
- const i = Math.round(s / 60);
1126
- if (i < 24) return `${i}h ago`;
1127
- const l = Math.round(i / 24);
1128
- return l < 30 ? `${l}d ago` : new Date(e).toLocaleDateString();
1129
- }
1130
- const pa = {
1140
+ const i = Math.round(a / 60);
1141
+ if (i < 60) return `${i}m ago`;
1142
+ const s = Math.round(i / 60);
1143
+ if (s < 24) return `${s}h ago`;
1144
+ const o = Math.round(s / 24);
1145
+ return o < 30 ? `${o}d ago` : new Date(e).toLocaleDateString();
1146
+ }
1147
+ const Ka = {
1131
1148
  ok: 6e3,
1132
1149
  warn: 1e4,
1133
1150
  error: 15e3
1134
- }, fa = { ok: "✓", warn: "!", error: "✕" };
1135
- function hi({
1151
+ }, ja = { ok: "✓", warn: "!", error: "✕" };
1152
+ function Ys({
1136
1153
  connectionId: e,
1137
1154
  onOpenAction: n,
1138
1155
  onBack: a,
1139
- onOpenCallable: s,
1140
- slots: i
1156
+ onOpenCallable: i,
1157
+ slots: s
1141
1158
  }) {
1142
- var U;
1143
- const l = Fe(), o = we(), c = gn(e), d = (U = c.data) == null ? void 0 : U.appId, h = ae(
1144
- () => qe(c.data ? [c.data] : []),
1159
+ var W;
1160
+ const o = Je(), r = me(), c = Pn(e), u = (W = c.data) == null ? void 0 : W.appId, h = ie(
1161
+ () => Ge(c.data ? [c.data] : []),
1145
1162
  [c.data]
1146
- ), { byId: N } = Ve(h), u = c.data ? Tt(c.data, N) : void 0, k = Nn(d, !!d), b = ln(e), D = ae(() => {
1147
- const p = /* @__PURE__ */ new Map();
1148
- for (const E of b.data ?? []) {
1149
- const I = p.get(E.actionKey) ?? [];
1150
- I.push(E), p.set(E.actionKey, I);
1163
+ ), { byId: g } = nt(h), m = c.data ? Bt(c.data, g) : void 0, k = jn(u, !!u), w = In(e), v = ie(() => {
1164
+ const N = /* @__PURE__ */ new Map();
1165
+ for (const M of w.data ?? []) {
1166
+ const P = N.get(M.actionKey) ?? [];
1167
+ P.push(M), N.set(M.actionKey, P);
1151
1168
  }
1152
- return p;
1153
- }, [b.data]), g = Ye(e).data, w = G(void 0), y = (g == null ? void 0 : g.callables) ?? [], x = (g == null ? void 0 : g.routes) ?? [], S = on(e).data ?? [], [$, T] = f(!1), [j, P] = f(""), A = yn(e), [R, F] = f(null);
1154
- ut(() => {
1155
- if (!R) return;
1156
- const p = setTimeout(() => F(null), pa[R.kind]);
1157
- return () => clearTimeout(p);
1158
- }, [R]);
1159
- const H = () => {
1160
- F(null), A.mutate(void 0, {
1161
- onSuccess: (p) => {
1162
- var E;
1163
- if (!p.ok) {
1164
- F({
1169
+ return N;
1170
+ }, [w.data]), y = rt(e).data, p = X(void 0), C = (y == null ? void 0 : y.callables) ?? [], I = (y == null ? void 0 : y.routes) ?? [], b = Dn(e).data ?? [], [E, T] = f(!1), [j, O] = f(""), R = ct(e), [x, D] = f(null);
1171
+ At(() => {
1172
+ if (!x) return;
1173
+ const N = setTimeout(() => D(null), Ka[x.kind]);
1174
+ return () => clearTimeout(N);
1175
+ }, [x]);
1176
+ const S = () => {
1177
+ D(null), R.mutate(void 0, {
1178
+ onSuccess: (N) => {
1179
+ var M;
1180
+ if (!N.ok) {
1181
+ D({
1165
1182
  kind: "error",
1166
- text: `Connection test failed${(E = p.error) != null && E.message ? `: ${p.error.message}` : "."}`
1183
+ text: `Connection test failed${(M = N.error) != null && M.message ? `: ${N.error.message}` : "."}`
1167
1184
  });
1168
1185
  return;
1169
1186
  }
1170
- F(
1171
- p.untested ? { kind: "warn", text: `Connection stored. ${p.message ?? ""}`.trim() } : {
1187
+ D(
1188
+ N.untested ? { kind: "warn", text: `Connection stored. ${N.message ?? ""}`.trim() } : {
1172
1189
  kind: "ok",
1173
- text: `Connection is valid${p.actionKey ? ` — probed ${p.actionKey}` : ""}.`
1190
+ text: `Connection is valid${N.actionKey ? ` — probed ${N.actionKey}` : ""}.`
1174
1191
  }
1175
1192
  );
1176
1193
  },
1177
- onError: (p) => F({ kind: "error", text: (p == null ? void 0 : p.message) ?? "Test failed." })
1194
+ onError: (N) => D({ kind: "error", text: (N == null ? void 0 : N.message) ?? "Test failed." })
1178
1195
  });
1179
- }, L = ae(() => {
1180
- var E;
1181
- const p = [...((E = k.data) == null ? void 0 : E.actions) ?? []];
1182
- return p.sort((I, C) => (I.title || I.key).localeCompare(C.title || C.key)), p;
1183
- }, [k.data]), J = ae(() => {
1184
- const p = j.trim().toLowerCase();
1185
- return p ? L.filter(
1186
- (E) => (E.title || "").toLowerCase().includes(p) || E.key.toLowerCase().includes(p) || (E.description || "").toLowerCase().includes(p)
1187
- ) : L;
1188
- }, [L, j]);
1196
+ }, $ = ie(() => {
1197
+ var M;
1198
+ const N = [...((M = k.data) == null ? void 0 : M.actions) ?? []];
1199
+ return N.sort((P, J) => (P.title || P.key).localeCompare(J.title || J.key)), N;
1200
+ }, [k.data]), V = ie(() => {
1201
+ const N = j.trim().toLowerCase();
1202
+ return N ? $.filter(
1203
+ (M) => (M.title || "").toLowerCase().includes(N) || M.key.toLowerCase().includes(N) || (M.description || "").toLowerCase().includes(N)
1204
+ ) : $;
1205
+ }, [$, j]);
1189
1206
  if (c.isLoading || k.isLoading)
1190
1207
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root w6w-embed-conn-detail", children: /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) });
1191
1208
  if (!c.data)
1192
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-conn-detail", "data-testid": "connection-not-found", children: [
1193
- (i == null ? void 0 : i.empty) ?? /* @__PURE__ */ t("h2", { children: "Connection not found" }),
1209
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-conn-detail", "data-testid": "connection-not-found", children: [
1210
+ (s == null ? void 0 : s.empty) ?? /* @__PURE__ */ t("h2", { children: "Connection not found" }),
1194
1211
  a && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: a, children: "Back to integrations" })
1195
1212
  ] });
1196
- const K = c.data, B = k.data, Y = !K.builtIn && typeof l.updateConnection == "function";
1197
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-conn-detail w6w-card-stack", children: [
1198
- (i == null ? void 0 : i.header) ?? /* @__PURE__ */ r(Lt, { conn: K, app: u, children: [
1213
+ const _ = c.data, K = k.data, H = !_.builtIn && typeof o.updateConnection == "function";
1214
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-conn-detail w6w-card-stack", children: [
1215
+ (s == null ? void 0 : s.header) ?? /* @__PURE__ */ l(Ut, { conn: _, app: m, children: [
1199
1216
  /* @__PURE__ */ t(
1200
1217
  "button",
1201
1218
  {
1202
1219
  type: "button",
1203
1220
  className: "w6w-btn w6w-btn-ghost",
1204
- disabled: A.isPending,
1205
- onClick: H,
1206
- children: A.isPending ? "Testing…" : "Test connection"
1221
+ disabled: R.isPending,
1222
+ onClick: S,
1223
+ children: R.isPending ? "Testing…" : "Test connection"
1207
1224
  }
1208
1225
  ),
1209
- Y && /* @__PURE__ */ t(
1210
- Qe,
1226
+ H && /* @__PURE__ */ t(
1227
+ ze,
1211
1228
  {
1212
1229
  label: "Edit",
1213
1230
  onClick: () => T(!0),
1214
1231
  "data-testid": "connection-detail-edit"
1215
1232
  }
1216
1233
  ),
1217
- i == null ? void 0 : i.actions
1234
+ s == null ? void 0 : s.actions
1218
1235
  ] }),
1219
- R && /* @__PURE__ */ r(
1236
+ x && /* @__PURE__ */ l(
1220
1237
  "div",
1221
1238
  {
1222
- className: `w6w-result w6w-embed-conn-notice w6w-embed-conn-notice-${R.kind}`,
1223
- role: R.kind === "error" ? "alert" : "status",
1224
- "aria-live": R.kind === "error" ? "assertive" : "polite",
1239
+ className: `w6w-result w6w-embed-conn-notice w6w-embed-conn-notice-${x.kind}`,
1240
+ role: x.kind === "error" ? "alert" : "status",
1241
+ "aria-live": x.kind === "error" ? "assertive" : "polite",
1225
1242
  "data-testid": "connection-test-notice",
1226
1243
  children: [
1227
- /* @__PURE__ */ t("span", { "aria-hidden": "true", children: fa[R.kind] }),
1228
- /* @__PURE__ */ t("span", { className: "w6w-embed-conn-notice-text", children: R.text }),
1229
- /* @__PURE__ */ t(Mt, { icon: "close", label: "Dismiss", onClick: () => F(null) })
1244
+ /* @__PURE__ */ t("span", { "aria-hidden": "true", children: ja[x.kind] }),
1245
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-notice-text", children: x.text }),
1246
+ /* @__PURE__ */ t(Ht, { icon: "close", label: "Dismiss", onClick: () => D(null) })
1230
1247
  ]
1231
1248
  }
1232
1249
  ),
1233
- /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1234
- /* @__PURE__ */ r("h3", { children: [
1250
+ /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1251
+ /* @__PURE__ */ l("h3", { children: [
1235
1252
  "App: ",
1236
- (u == null ? void 0 : u.displayName) ?? K.appId
1253
+ (m == null ? void 0 : m.displayName) ?? _.appId
1237
1254
  ] }),
1238
- B && /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", children: [
1255
+ K && /* @__PURE__ */ l("p", { className: "w6w-muted w6w-small", children: [
1239
1256
  "Version ",
1240
- /* @__PURE__ */ r("code", { children: [
1257
+ /* @__PURE__ */ l("code", { children: [
1241
1258
  "v",
1242
- B.version ?? "?"
1259
+ K.version ?? "?"
1243
1260
  ] }),
1244
1261
  " · source ",
1245
- /* @__PURE__ */ t("code", { children: B.sourceRef })
1262
+ /* @__PURE__ */ t("code", { children: K.sourceRef })
1246
1263
  ] }),
1247
1264
  a && /* @__PURE__ */ t("p", { className: "w6w-small", children: /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: a, children: "← Integrations" }) })
1248
1265
  ] }),
1249
- /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1266
+ /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1250
1267
  /* @__PURE__ */ t("h3", { children: "Actions" }),
1251
- L.length === 0 && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No actions exposed." }),
1252
- L.length > 10 && /* @__PURE__ */ t(
1268
+ $.length === 0 && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No actions exposed." }),
1269
+ $.length > 10 && /* @__PURE__ */ t(
1253
1270
  "input",
1254
1271
  {
1255
1272
  type: "search",
1256
1273
  value: j,
1257
- placeholder: `Search ${L.length} actions…`,
1258
- onChange: (p) => P(p.target.value),
1274
+ placeholder: `Search ${$.length} actions…`,
1275
+ onChange: (N) => O(N.target.value),
1259
1276
  "aria-label": "Filter actions",
1260
1277
  className: "w6w-embed-conn-filter"
1261
1278
  }
1262
1279
  ),
1263
- L.length > 0 && J.length === 0 && /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", children: [
1280
+ $.length > 0 && V.length === 0 && /* @__PURE__ */ l("p", { className: "w6w-muted w6w-small", children: [
1264
1281
  "No actions match “",
1265
1282
  j,
1266
1283
  "”."
1267
1284
  ] }),
1268
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Actions", children: J.map((p) => {
1269
- const E = D.get(p.key) ?? [];
1270
- return /* @__PURE__ */ r("li", { children: [
1271
- /* @__PURE__ */ r(
1285
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Actions", children: V.map((N) => {
1286
+ const M = v.get(N.key) ?? [];
1287
+ return /* @__PURE__ */ l("li", { children: [
1288
+ /* @__PURE__ */ l(
1272
1289
  "button",
1273
1290
  {
1274
1291
  type: "button",
1275
1292
  className: "w6w-embed-conn-action",
1276
- "data-testid": `connection-action-${p.key}`,
1277
- onClick: () => n(p.key),
1293
+ "data-testid": `connection-action-${N.key}`,
1294
+ onClick: () => n(N.key),
1278
1295
  children: [
1279
- /* @__PURE__ */ t("strong", { children: p.title }),
1296
+ /* @__PURE__ */ t("strong", { children: N.title }),
1280
1297
  " ",
1281
- /* @__PURE__ */ t("code", { className: "w6w-muted", children: p.key }),
1298
+ /* @__PURE__ */ t("code", { className: "w6w-muted", children: N.key }),
1282
1299
  " ",
1283
- /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: p.type }),
1284
- p.description && /* @__PURE__ */ t("div", { className: "w6w-muted w6w-small", children: p.description })
1300
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: N.type }),
1301
+ N.description && /* @__PURE__ */ t("div", { className: "w6w-muted w6w-small", children: N.description })
1285
1302
  ]
1286
1303
  }
1287
1304
  ),
1288
- E.length > 0 && /* @__PURE__ */ t(
1305
+ M.length > 0 && /* @__PURE__ */ t(
1289
1306
  "ul",
1290
1307
  {
1291
1308
  className: "w6w-embed-conn-list w6w-embed-conn-tests",
1292
- "aria-label": `Saved tests for ${p.title || p.key}`,
1293
- children: E.map((I) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1294
- Ne,
1309
+ "aria-label": `Saved tests for ${N.title || N.key}`,
1310
+ children: M.map((P) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1311
+ Ae,
1295
1312
  {
1296
- title: I.name,
1297
- subtitle: I.lastRunAt ? /* @__PURE__ */ r("span", { children: [
1313
+ title: P.name,
1314
+ subtitle: P.lastRunAt ? /* @__PURE__ */ l("span", { children: [
1298
1315
  /* @__PURE__ */ t(
1299
1316
  "span",
1300
1317
  {
1301
- className: I.lastRunOk ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail",
1302
- children: I.lastRunOk ? "✓" : "✗"
1318
+ className: P.lastRunOk ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail",
1319
+ children: P.lastRunOk ? "✓" : "✗"
1303
1320
  }
1304
1321
  ),
1305
1322
  " ",
1306
- I.lastRunSummary ? `${I.lastRunSummary} · ` : "",
1307
- ve(I.lastRunAt)
1308
- ] }) : `saved ${ve(I.updatedAt)}`,
1309
- onClick: () => n(p.key, I.id)
1323
+ P.lastRunSummary ? `${P.lastRunSummary} · ` : "",
1324
+ Le(P.lastRunAt)
1325
+ ] }) : `saved ${Le(P.updatedAt)}`,
1326
+ onClick: () => n(N.key, P.id)
1310
1327
  }
1311
- ) }, I.id))
1328
+ ) }, P.id))
1312
1329
  }
1313
1330
  )
1314
- ] }, p.key);
1331
+ ] }, N.key);
1315
1332
  }) })
1316
1333
  ] }),
1317
- g && /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", "data-testid": "connection-used-by", children: [
1334
+ y && /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", "data-testid": "connection-used-by", children: [
1318
1335
  /* @__PURE__ */ t("h3", { children: "Used by" }),
1319
- y.length === 0 && x.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Not used by any callable" }) : /* @__PURE__ */ t(
1320
- ct,
1336
+ C.length === 0 && I.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Not used by any callable" }) : /* @__PURE__ */ t(
1337
+ Lt,
1321
1338
  {
1322
- callables: y,
1323
- routes: x,
1324
- projectId: w,
1325
- onOpenCallable: s
1339
+ callables: C,
1340
+ routes: I,
1341
+ projectId: p,
1342
+ onOpenCallable: i
1326
1343
  }
1327
1344
  )
1328
1345
  ] }),
1329
- S.length > 0 && /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1346
+ b.length > 0 && /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1330
1347
  /* @__PURE__ */ t("h3", { children: "Recent runs" }),
1331
1348
  /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: "Most recent tester runs against this connection." }),
1332
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Recent runs", children: S.map((p) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1333
- Ne,
1349
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Recent runs", children: b.map((N) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1350
+ Ae,
1334
1351
  {
1335
- title: p.actionKey,
1336
- subtitle: /* @__PURE__ */ r("span", { children: [
1337
- /* @__PURE__ */ t("span", { className: p.ok ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail", children: p.ok ? "✓" : "✗" }),
1352
+ title: N.actionKey,
1353
+ subtitle: /* @__PURE__ */ l("span", { children: [
1354
+ /* @__PURE__ */ t("span", { className: N.ok ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail", children: N.ok ? "✓" : "✗" }),
1338
1355
  " ",
1339
- p.summary ? `${p.summary} · ` : "",
1340
- ve(p.occurredAt)
1356
+ N.summary ? `${N.summary} · ` : "",
1357
+ Le(N.occurredAt)
1341
1358
  ] })
1342
1359
  }
1343
- ) }, p.id)) })
1360
+ ) }, N.id)) })
1344
1361
  ] }),
1345
- $ && /* @__PURE__ */ t(
1346
- _e,
1362
+ E && /* @__PURE__ */ t(
1363
+ Ze,
1347
1364
  {
1348
- connection: K,
1365
+ connection: _,
1349
1366
  onClose: () => T(!1),
1350
1367
  onSaved: () => {
1351
- T(!1), o.invalidateQueries({ queryKey: ze(e) }), o.invalidateQueries({ queryKey: be });
1368
+ T(!1), r.invalidateQueries({ queryKey: ot(e) }), r.invalidateQueries({ queryKey: ge });
1352
1369
  }
1353
1370
  }
1354
1371
  )
1355
1372
  ] });
1356
1373
  }
1357
- const ga = {};
1358
- function Pe(e) {
1374
+ const Fa = {};
1375
+ function Ve(e) {
1359
1376
  return String(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1360
1377
  }
1361
- function le(e) {
1378
+ function ue(e) {
1362
1379
  return (e / 100).toFixed(2);
1363
1380
  }
1364
- function ya(e) {
1381
+ function Qa(e) {
1365
1382
  if (e == null) return null;
1366
1383
  const n = e.rates, a = [];
1367
- return n.input != null && a.push(`in ${le(n.input)}`), n.output != null && a.push(`out ${le(n.output)}`), n.cachedInput != null && a.push(`cached ${le(n.cachedInput)}`), n.cacheWrite != null && a.push(`cache write ${le(n.cacheWrite)}`), n.perRequest != null && a.push(`${le(n.perRequest)}/request`), a.length === 0 ? null : `${n.currency ?? "USD"} ${a.join(" · ")}`;
1384
+ return n.input != null && a.push(`in ${ue(n.input)}`), n.output != null && a.push(`out ${ue(n.output)}`), n.cachedInput != null && a.push(`cached ${ue(n.cachedInput)}`), n.cacheWrite != null && a.push(`cache write ${ue(n.cacheWrite)}`), n.perRequest != null && a.push(`${ue(n.perRequest)}/request`), a.length === 0 ? null : `${n.currency ?? "USD"} ${a.join(" · ")}`;
1368
1385
  }
1369
- function va(e) {
1386
+ function _a(e) {
1370
1387
  const { maxInputTokens: n, maxOutputTokens: a } = e.limits ?? {};
1371
- if (n == null && a == null) return "—";
1372
- const s = [];
1373
- return n != null && s.push(`${Pe(n)} in`), a != null && s.push(`${Pe(a)} out`), s.join(" · ");
1388
+ return n == null && a == null ? "—" : /* @__PURE__ */ l("div", { className: "model-catalog-limits", children: [
1389
+ n != null && /* @__PURE__ */ l("span", { children: [
1390
+ Ve(n),
1391
+ " input"
1392
+ ] }),
1393
+ a != null && /* @__PURE__ */ l("span", { children: [
1394
+ Ve(a),
1395
+ " output"
1396
+ ] })
1397
+ ] });
1374
1398
  }
1375
- const Na = [
1399
+ const qa = [
1376
1400
  {
1377
1401
  key: "model",
1378
1402
  header: "Model",
1379
- render: (e) => /* @__PURE__ */ r("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
1380
- /* @__PURE__ */ t("strong", { className: "list-name", title: e.displayName, children: e.displayName }),
1381
- /* @__PURE__ */ r("div", { className: "muted small list-preview", title: `${e.provider} · ${e.nativeId}`, children: [
1403
+ width: "48%",
1404
+ render: (e) => /* @__PURE__ */ l("div", { className: "model-catalog-identity", children: [
1405
+ /* @__PURE__ */ l("div", { className: "model-catalog-name", children: [
1406
+ /* @__PURE__ */ t("strong", { children: e.displayName }),
1407
+ /* @__PURE__ */ t("span", { className: e.status === "active" ? "tag" : "tag warn", children: e.status })
1408
+ ] }),
1409
+ /* @__PURE__ */ l("div", { className: "muted small", children: [
1382
1410
  e.provider,
1383
1411
  " · ",
1384
- e.nativeId,
1385
- " · ",
1386
- e.source
1412
+ e.nativeId
1387
1413
  ] })
1388
1414
  ] })
1389
1415
  },
1390
- {
1391
- key: "provider",
1392
- header: "Provider",
1393
- render: (e) => /* @__PURE__ */ t("span", { className: "muted small", children: e.provider || "—" })
1394
- },
1395
- {
1396
- key: "status",
1397
- header: "Status",
1398
- render: (e) => /* @__PURE__ */ t("span", { className: e.status === "active" ? "tag" : "tag warn", children: e.status })
1399
- },
1400
1416
  {
1401
1417
  key: "rate",
1402
- header: "Rate (per 1M tokens)",
1418
+ header: "Price / 1M tokens",
1419
+ width: "28%",
1403
1420
  render: (e) => {
1404
- const n = ya(e.currentRate);
1405
- return n == null ? /* @__PURE__ */ t("span", { className: "muted small", children: "—" }) : /* @__PURE__ */ t(
1421
+ const n = Qa(e.currentRate);
1422
+ return n == null ? /* @__PURE__ */ t("span", { className: "muted small", children: "Not configured" }) : /* @__PURE__ */ t(
1406
1423
  "span",
1407
1424
  {
1408
1425
  className: "muted small",
@@ -1414,78 +1431,80 @@ const Na = [
1414
1431
  },
1415
1432
  {
1416
1433
  key: "limits",
1417
- header: "Limits",
1418
- render: (e) => /* @__PURE__ */ t("span", { className: "muted small", children: va(e) })
1434
+ header: "Token limits",
1435
+ width: "24%",
1436
+ render: (e) => /* @__PURE__ */ t("div", { className: "muted small", children: _a(e) })
1419
1437
  }
1420
1438
  ];
1421
- function wi(e) {
1422
- var l;
1423
- const n = pe(), a = e.filter ?? ga, s = Je({
1424
- queryKey: kn(a),
1439
+ function zs(e) {
1440
+ var o;
1441
+ const n = he(), a = e.filter ?? Fa, i = st({
1442
+ queryKey: Qn(a),
1425
1443
  initialPageParam: void 0,
1426
- getNextPageParam: (o) => o.nextCursor ?? void 0,
1427
- queryFn: ({ pageParam: o }) => bn(n, o ? { ...a, cursor: o } : a)
1428
- }), i = ((l = s.data) == null ? void 0 : l.pages.flatMap((o) => o.models)) ?? [];
1429
- return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ r("section", { className: "section", children: [
1430
- /* @__PURE__ */ t("div", { className: "section-head", children: /* @__PURE__ */ r("div", { children: [
1431
- /* @__PURE__ */ t("h3", { children: "Model catalog" }),
1432
- /* @__PURE__ */ t("p", { className: "muted small", children: "The models discovered on this tenant's connections, plus any added by hand. A route may only name a model from this list; the rate card is what usage is priced with." })
1444
+ getNextPageParam: (r) => r.nextCursor ?? void 0,
1445
+ queryFn: ({ pageParam: r }) => Fn(n, r ? { ...a, cursor: r } : a)
1446
+ }), s = ((o = i.data) == null ? void 0 : o.pages.flatMap((r) => r.models)) ?? [];
1447
+ return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
1448
+ /* @__PURE__ */ t("div", { className: "section-head", children: /* @__PURE__ */ l("div", { children: [
1449
+ /* @__PURE__ */ t("h3", { children: "Available models" }),
1450
+ /* @__PURE__ */ t("p", { className: "muted small", children: "Models available through your tenant's integrations. Choose one when creating a model route. Prices shown here are used to calculate usage costs." })
1433
1451
  ] }) }),
1434
- /* @__PURE__ */ r("div", { children: [
1435
- s.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1436
- s.error != null && /* @__PURE__ */ t("div", { className: "error", children: s.error.message }),
1437
- s.isSuccess && i.length === 0 && /* @__PURE__ */ t(De, { testId: "model-catalog-empty", children: "No models yet. Discover them from a provider connection to start routing to them." }),
1438
- i.length > 0 && /* @__PURE__ */ t(
1439
- $e,
1452
+ /* @__PURE__ */ l("div", { children: [
1453
+ i.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1454
+ i.error != null && /* @__PURE__ */ t("div", { className: "error", children: i.error.message }),
1455
+ i.isSuccess && s.length === 0 && /* @__PURE__ */ t(xe, { testId: "model-catalog-empty", children: "No models yet. Discover them from a provider connection to start routing to them." }),
1456
+ s.length > 0 && /* @__PURE__ */ t(
1457
+ Re,
1440
1458
  {
1441
- columns: Na,
1442
- rows: i,
1443
- rowKey: (o) => o.id,
1459
+ columns: qa,
1460
+ className: "model-catalog-table",
1461
+ rows: s,
1462
+ rowKey: (r) => r.id,
1444
1463
  testId: "model-catalog-table",
1445
- rowTestId: (o) => `model-catalog-${o.id}`
1464
+ rowTestId: (r) => `model-catalog-${r.id}`
1446
1465
  }
1447
1466
  )
1448
1467
  ] }),
1449
- s.hasNextPage && /* @__PURE__ */ t("div", { className: "row", children: /* @__PURE__ */ t(
1468
+ i.hasNextPage && /* @__PURE__ */ t("div", { className: "row", children: /* @__PURE__ */ t(
1450
1469
  "button",
1451
1470
  {
1452
1471
  type: "button",
1453
1472
  className: "btn ghost",
1454
- disabled: s.isFetchingNextPage,
1455
- onClick: () => void s.fetchNextPage(),
1473
+ disabled: i.isFetchingNextPage,
1474
+ onClick: () => void i.fetchNextPage(),
1456
1475
  "data-testid": "model-catalog-load-more",
1457
- children: s.isFetchingNextPage ? "Loading…" : "Load more"
1476
+ children: i.isFetchingNextPage ? "Loading…" : "Load more"
1458
1477
  }
1459
1478
  ) })
1460
1479
  ] }) });
1461
1480
  }
1462
- const ba = {};
1463
- function W(e) {
1481
+ const Va = {};
1482
+ function U(e) {
1464
1483
  return String(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1465
1484
  }
1466
- function ka(e) {
1485
+ function Wa(e) {
1467
1486
  return `${e.currency} ${(e.amountMinor / 100).toFixed(2)}`;
1468
1487
  }
1469
- function Ca(e, n) {
1470
- return e.length > 0 ? e.map(ka).join(" · ") : n > 0 ? "unpriced" : "—";
1488
+ function Ba(e, n) {
1489
+ return e.length > 0 ? e.map(Wa).join(" · ") : n > 0 ? "unpriced" : "—";
1471
1490
  }
1472
- function Da(e) {
1491
+ function Ua(e) {
1473
1492
  return e.costMinor == null ? null : `${e.currency ?? "USD"} ${(e.costMinor / 100).toFixed(2)}`;
1474
1493
  }
1475
- function $a(e) {
1494
+ function Ha(e) {
1476
1495
  return e.totalsTruncated === !0;
1477
1496
  }
1478
- const Ta = [
1497
+ const Ya = [
1479
1498
  {
1480
1499
  key: "occurredAt",
1481
1500
  header: "When",
1482
- render: (e) => /* @__PURE__ */ t("span", { className: "muted small", title: e.occurredAt, children: at(e.occurredAt) })
1501
+ render: (e) => /* @__PURE__ */ t("span", { className: "muted small", title: e.occurredAt, children: Ct(e.occurredAt) })
1483
1502
  },
1484
1503
  {
1485
1504
  key: "model",
1486
1505
  header: "Model",
1487
- render: (e) => /* @__PURE__ */ r("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
1488
- /* @__PURE__ */ r("strong", { className: "list-name", title: `${e.provider} · ${e.nativeId}`, children: [
1506
+ render: (e) => /* @__PURE__ */ l("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
1507
+ /* @__PURE__ */ l("strong", { className: "list-name", title: `${e.provider} · ${e.nativeId}`, children: [
1489
1508
  e.provider,
1490
1509
  " · ",
1491
1510
  e.nativeId
@@ -1506,8 +1525,8 @@ const Ta = [
1506
1525
  "span",
1507
1526
  {
1508
1527
  className: "muted small",
1509
- title: `${W(e.inputTokens)} in · ${W(e.outputTokens)} out · ${W(e.cachedInputTokens)} cached input · ${W(e.cacheWriteTokens)} cache write`,
1510
- children: W(e.totalTokens)
1528
+ title: `${U(e.inputTokens)} in · ${U(e.outputTokens)} out · ${U(e.cachedInputTokens)} cached input · ${U(e.cacheWriteTokens)} cache write`,
1529
+ children: U(e.totalTokens)
1511
1530
  }
1512
1531
  )
1513
1532
  },
@@ -1516,7 +1535,7 @@ const Ta = [
1516
1535
  header: "Cost",
1517
1536
  align: "right",
1518
1537
  render: (e) => {
1519
- const n = Da(e);
1538
+ const n = Ua(e);
1520
1539
  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 });
1521
1540
  }
1522
1541
  },
@@ -1524,10 +1543,10 @@ const Ta = [
1524
1543
  key: "result",
1525
1544
  header: "Result",
1526
1545
  render: (e) => {
1527
- const n = it(e.durationMs);
1528
- return /* @__PURE__ */ r("span", { className: "muted small", title: e.errorCode ?? void 0, children: [
1546
+ const n = Tt(e.durationMs);
1547
+ return /* @__PURE__ */ l("span", { className: "muted small", title: e.errorCode ?? void 0, children: [
1529
1548
  /* @__PURE__ */ t("span", { className: e.ok ? "tag" : "tag warn", children: e.ok ? "ok" : e.errorCode ?? "failed" }),
1530
- n != null && /* @__PURE__ */ r(Q, { children: [
1549
+ n != null && /* @__PURE__ */ l(Q, { children: [
1531
1550
  " · ",
1532
1551
  n
1533
1552
  ] })
@@ -1535,61 +1554,61 @@ const Ta = [
1535
1554
  }
1536
1555
  }
1537
1556
  ];
1538
- function pi(e) {
1539
- var h, N;
1540
- const n = G(e.projectId), a = pe(), s = e.filter ?? ba, i = Je({
1541
- queryKey: Dn(n ?? void 0, s),
1557
+ function Js(e) {
1558
+ var h, g;
1559
+ const n = X(e.projectId), a = he(), i = e.filter ?? Va, s = st({
1560
+ queryKey: qn(n ?? void 0, i),
1542
1561
  enabled: n != null,
1543
1562
  initialPageParam: void 0,
1544
- getNextPageParam: (u) => u.nextCursor ?? void 0,
1545
- queryFn: ({ pageParam: u }) => Cn(
1563
+ getNextPageParam: (m) => m.nextCursor ?? void 0,
1564
+ queryFn: ({ pageParam: m }) => _n(
1546
1565
  a,
1547
1566
  n,
1548
- u ? { ...s, cursor: u } : s
1567
+ m ? { ...i, cursor: m } : i
1549
1568
  )
1550
- }), l = ((h = i.data) == null ? void 0 : h.pages) ?? [], o = (N = l[0]) == null ? void 0 : N.totals, c = l.flatMap((u) => u.items), d = l.length > 0 && $a(l[0]);
1551
- return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ r("section", { className: "section", children: [
1552
- /* @__PURE__ */ t("div", { className: "section-head", children: /* @__PURE__ */ r("div", { children: [
1569
+ }), o = ((h = s.data) == null ? void 0 : h.pages) ?? [], r = (g = o[0]) == null ? void 0 : g.totals, c = o.flatMap((m) => m.items), u = o.length > 0 && Ha(o[0]);
1570
+ return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
1571
+ /* @__PURE__ */ t("div", { className: "section-head", children: /* @__PURE__ */ l("div", { children: [
1553
1572
  /* @__PURE__ */ t("h3", { children: "Model usage" }),
1554
1573
  /* @__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." })
1555
1574
  ] }) }),
1556
- 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(Q, { children: [
1557
- /* @__PURE__ */ r("div", { className: "card", "data-testid": "model-usage-totals", children: [
1558
- d && /* @__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." }),
1559
- o == null ? (
1575
+ 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__ */ l(Q, { children: [
1576
+ /* @__PURE__ */ l("div", { className: "card", "data-testid": "model-usage-totals", children: [
1577
+ u && /* @__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." }),
1578
+ r == null ? (
1560
1579
  // A failed query is reported once, below — never as a perpetual "loading".
1561
- i.error == null && /* @__PURE__ */ t("p", { className: "muted", children: "Loading totals…" })
1562
- ) : /* @__PURE__ */ r("p", { className: "muted small", children: [
1563
- /* @__PURE__ */ r("span", { "data-testid": "model-usage-total-requests", children: [
1564
- W(o.requests),
1580
+ s.error == null && /* @__PURE__ */ t("p", { className: "muted", children: "Loading totals…" })
1581
+ ) : /* @__PURE__ */ l("p", { className: "muted small", children: [
1582
+ /* @__PURE__ */ l("span", { "data-testid": "model-usage-total-requests", children: [
1583
+ U(r.requests),
1565
1584
  " requests"
1566
1585
  ] }),
1567
1586
  " · ",
1568
- /* @__PURE__ */ r("span", { "data-testid": "model-usage-total-tokens", children: [
1569
- W(o.totalTokens),
1587
+ /* @__PURE__ */ l("span", { "data-testid": "model-usage-total-tokens", children: [
1588
+ U(r.totalTokens),
1570
1589
  " tokens (",
1571
- W(o.inputTokens),
1590
+ U(r.inputTokens),
1572
1591
  " in /",
1573
1592
  " ",
1574
- W(o.outputTokens),
1593
+ U(r.outputTokens),
1575
1594
  " out / ",
1576
- W(o.cachedInputTokens),
1595
+ U(r.cachedInputTokens),
1577
1596
  " cached / ",
1578
- W(o.cacheWriteTokens),
1597
+ U(r.cacheWriteTokens),
1579
1598
  " cache write)"
1580
1599
  ] }),
1581
1600
  " · ",
1582
- /* @__PURE__ */ t("span", { "data-testid": "model-usage-total-cost", children: Ca(o.cost, o.unpriced) }),
1583
- o.unpriced > 0 && /* @__PURE__ */ r(Q, { children: [
1601
+ /* @__PURE__ */ t("span", { "data-testid": "model-usage-total-cost", children: Ba(r.cost, r.unpriced) }),
1602
+ r.unpriced > 0 && /* @__PURE__ */ l(Q, { children: [
1584
1603
  " · ",
1585
- /* @__PURE__ */ r(
1604
+ /* @__PURE__ */ l(
1586
1605
  "span",
1587
1606
  {
1588
1607
  className: "tag warn",
1589
1608
  "data-testid": "model-usage-unpriced-total",
1590
1609
  title: "calls with no usable rate — not included in any cost total",
1591
1610
  children: [
1592
- W(o.unpriced),
1611
+ U(r.unpriced),
1593
1612
  " unpriced"
1594
1613
  ]
1595
1614
  }
@@ -1597,71 +1616,243 @@ function pi(e) {
1597
1616
  ] })
1598
1617
  ] })
1599
1618
  ] }),
1600
- i.error != null && /* @__PURE__ */ t("div", { className: "error", role: "alert", "data-testid": "model-usage-error", children: i.error.message }),
1601
- /* @__PURE__ */ r("div", { children: [
1602
- i.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1603
- i.isSuccess && c.length === 0 && /* @__PURE__ */ t(De, { testId: "model-usage-empty", children: "No model calls in this window. Usage rows appear here as routes are invoked." }),
1619
+ s.error != null && /* @__PURE__ */ t("div", { className: "error", role: "alert", "data-testid": "model-usage-error", children: s.error.message }),
1620
+ /* @__PURE__ */ l("div", { children: [
1621
+ s.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1622
+ s.isSuccess && c.length === 0 && /* @__PURE__ */ t(xe, { testId: "model-usage-empty", children: "No model calls in this window. Usage rows appear here as routes are invoked." }),
1604
1623
  c.length > 0 && /* @__PURE__ */ t(
1605
- $e,
1624
+ Re,
1606
1625
  {
1607
- columns: Ta,
1626
+ columns: Ya,
1608
1627
  rows: c,
1609
- rowKey: (u) => u.id,
1628
+ rowKey: (m) => m.id,
1610
1629
  testId: "model-usage-table",
1611
- rowTestId: (u) => `model-usage-${u.id}`
1630
+ rowTestId: (m) => `model-usage-${m.id}`
1612
1631
  }
1613
1632
  )
1614
1633
  ] }),
1615
- i.hasNextPage && /* @__PURE__ */ t("div", { className: "row", children: /* @__PURE__ */ t(
1634
+ s.hasNextPage && /* @__PURE__ */ t("div", { className: "row", children: /* @__PURE__ */ t(
1616
1635
  "button",
1617
1636
  {
1618
1637
  type: "button",
1619
1638
  className: "btn ghost",
1620
- disabled: i.isFetchingNextPage,
1621
- onClick: () => void i.fetchNextPage(),
1639
+ disabled: s.isFetchingNextPage,
1640
+ onClick: () => void s.fetchNextPage(),
1622
1641
  "data-testid": "model-usage-load-more",
1623
- children: i.isFetchingNextPage ? "Loading…" : "Load more"
1642
+ children: s.isFetchingNextPage ? "Loading…" : "Load more"
1624
1643
  }
1625
1644
  ) })
1626
1645
  ] })
1627
1646
  ] }) });
1628
1647
  }
1629
- const La = (e) => `${e} connection${e === 1 ? "" : "s"}`;
1630
- function fi({ contract: e, onOpen: n, slots: a }) {
1631
- const s = $n(e ? { contract: e } : void 0), i = s.data ?? [];
1632
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-cred-list", children: [
1633
- (a == null ? void 0 : a.header) ?? /* @__PURE__ */ t("h2", { children: "Credentials" }),
1648
+ const za = (e) => `${e} connection${e === 1 ? "" : "s"}`;
1649
+ function Gs({ contract: e, onOpen: n, onCreate: a, slots: i }) {
1650
+ const s = dt(e ? { contract: e } : void 0), o = Ne(), r = (s.data ?? []).filter((h) => !h.private), c = (h) => {
1651
+ var g, m;
1652
+ return ((m = (g = o.data) == null ? void 0 : g.find((k) => k.id === h)) == null ? void 0 : m.label) ?? h;
1653
+ }, u = a && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", onClick: a, children: "Add credential" });
1654
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-cred-list", children: [
1655
+ /* @__PURE__ */ l("div", { className: "w6w-connection-list-head", "data-testid": "credential-list-header", children: [
1656
+ /* @__PURE__ */ t("div", { className: "w6w-connection-list-heading", children: (i == null ? void 0 : i.header) ?? /* @__PURE__ */ t("h2", { children: "Credentials" }) }),
1657
+ u && /* @__PURE__ */ t("div", { className: "w6w-connection-list-actions", children: u })
1658
+ ] }),
1634
1659
  s.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
1635
1660
  s.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: s.error.message }),
1636
- !s.isLoading && !s.error && i.length === 0 && /* @__PURE__ */ t("div", { "data-testid": "credential-list-empty", children: (a == null ? void 0 : a.empty) ?? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No credentials yet." }) }),
1637
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Credentials", children: i.map((l) => {
1638
- const o = Object.values(l.display)[0];
1639
- return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ r(
1661
+ !s.isLoading && !s.error && r.length === 0 && /* @__PURE__ */ t("div", { "data-testid": "credential-list-empty", children: (i == null ? void 0 : i.empty) ?? /* @__PURE__ */ l(Q, { children: [
1662
+ /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No credentials yet." }),
1663
+ u
1664
+ ] }) }),
1665
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Credentials", children: r.map((h) => {
1666
+ const g = Object.values(h.display)[0];
1667
+ return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ l(
1640
1668
  "button",
1641
1669
  {
1642
1670
  type: "button",
1643
1671
  className: "w6w-embed-conn-action",
1644
- "data-testid": `credential-row-${l.id}`,
1645
- onClick: () => n == null ? void 0 : n(l.id),
1672
+ "data-testid": `credential-row-${h.id}`,
1673
+ onClick: () => n == null ? void 0 : n(h.id),
1646
1674
  children: [
1647
- /* @__PURE__ */ t("strong", { children: l.name }),
1675
+ /* @__PURE__ */ t("strong", { children: h.name }),
1648
1676
  " ",
1649
- /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: l.status }),
1650
- o !== void 0 && /* @__PURE__ */ r("span", { className: "w6w-muted w6w-small", children: [
1677
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: h.status }),
1678
+ /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", "data-testid": `credential-type-${h.id}`, children: [
1679
+ " ",
1680
+ c(h.contract)
1681
+ ] }),
1682
+ /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", "data-testid": `credential-scope-${h.id}`, children: [
1683
+ " ",
1684
+ "· ",
1685
+ ut(h.accessScope)
1686
+ ] }),
1687
+ g !== void 0 && /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", children: [
1651
1688
  " ",
1652
- o
1689
+ g
1653
1690
  ] }),
1654
- /* @__PURE__ */ r("span", { className: "w6w-muted w6w-small", children: [
1691
+ /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", children: [
1655
1692
  " · ",
1656
- La(l.connectionCount)
1693
+ za(h.connectionCount)
1657
1694
  ] })
1658
1695
  ]
1659
1696
  }
1660
- ) }, l.id);
1697
+ ) }, h.id);
1661
1698
  }) })
1662
1699
  ] });
1663
1700
  }
1664
- function Ma(e) {
1701
+ function Ce({
1702
+ fields: e,
1703
+ values: n,
1704
+ onChange: a,
1705
+ idPrefix: i
1706
+ }) {
1707
+ return /* @__PURE__ */ t(Q, { children: e.map((s) => {
1708
+ const o = {
1709
+ className: s.secret ? "w6w-input w6w-secret-input" : "w6w-input",
1710
+ value: n[s.key] ?? "",
1711
+ name: `${i}-${s.key}`,
1712
+ autoComplete: "off",
1713
+ autoCapitalize: "off",
1714
+ autoCorrect: "off",
1715
+ spellCheck: !1,
1716
+ "data-1p-ignore": "true",
1717
+ "data-lpignore": "true",
1718
+ "data-bwignore": "true",
1719
+ "data-form-type": "other"
1720
+ };
1721
+ return s.multiline ? /* @__PURE__ */ l("label", { className: "w6w-field", children: [
1722
+ /* @__PURE__ */ t("span", { children: s.label }),
1723
+ /* @__PURE__ */ t("textarea", { rows: 5, ...o, onChange: (r) => a(s.key, r.target.value) })
1724
+ ] }, s.key) : /* @__PURE__ */ l("label", { className: "w6w-field", children: [
1725
+ /* @__PURE__ */ t("span", { children: s.label }),
1726
+ /* @__PURE__ */ t("input", { type: "text", ...o, onChange: (r) => a(s.key, r.target.value) })
1727
+ ] }, s.key);
1728
+ }) });
1729
+ }
1730
+ const Te = (e, n) => e.every((a) => (n[a.key] ?? "").length > 0), Ee = (e, n) => Object.fromEntries(e.map((a) => [a.key, n[a.key] ?? ""])), Ja = [
1731
+ {
1732
+ value: "account",
1733
+ label: "This account",
1734
+ hint: "Authorized callers in the account can use it."
1735
+ },
1736
+ { value: "user", label: "Only me", hint: "Only you can use it. Others in the account cannot." }
1737
+ ];
1738
+ function Zs({ onCreated: e, onCancel: n }) {
1739
+ const a = pt(), [i, s] = f("account"), o = Ne(), r = Wn(), [c, u] = f(null), [h, g] = f(""), [m, k] = f({}), [w, v] = f(null), y = o.data ?? [], p = y.find((b) => b.id === c) ?? y[0], C = (b) => {
1740
+ u(b), k({}), v(null);
1741
+ }, I = () => {
1742
+ if (!p || r.isPending) return;
1743
+ if (h.trim() === "") {
1744
+ v("Give the credential a name.");
1745
+ return;
1746
+ }
1747
+ if (!Te(p.fields, m)) {
1748
+ v("Fill in every field.");
1749
+ return;
1750
+ }
1751
+ v(null);
1752
+ const b = {
1753
+ name: h.trim(),
1754
+ contract: p.id,
1755
+ source: Ee(p.fields, m),
1756
+ ...a && i === "user" ? { accessScope: "user" } : {}
1757
+ };
1758
+ k({}), r.mutate(b, {
1759
+ onSuccess: (E) => {
1760
+ r.reset(), e == null || e(E.id);
1761
+ },
1762
+ onError: (E) => {
1763
+ r.reset(), v(ke(E, "create"));
1764
+ }
1765
+ });
1766
+ };
1767
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-cred-create", "data-testid": "credential-create", children: [
1768
+ /* @__PURE__ */ t("h2", { children: "Add credential" }),
1769
+ o.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
1770
+ o.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-types-error", children: "Could not load the credential types." }),
1771
+ p && /* @__PURE__ */ l(
1772
+ "form",
1773
+ {
1774
+ className: "w6w-card-stack",
1775
+ onSubmit: (b) => {
1776
+ b.preventDefault(), I();
1777
+ },
1778
+ children: [
1779
+ /* @__PURE__ */ l("label", { className: "w6w-field", children: [
1780
+ /* @__PURE__ */ t("span", { children: "Type" }),
1781
+ /* @__PURE__ */ t(
1782
+ "select",
1783
+ {
1784
+ value: p.id,
1785
+ "aria-label": "Credential type",
1786
+ onChange: (b) => C(b.target.value),
1787
+ children: y.map((b) => /* @__PURE__ */ t("option", { value: b.id, children: b.label }, b.id))
1788
+ }
1789
+ )
1790
+ ] }),
1791
+ /* @__PURE__ */ l("label", { className: "w6w-field", children: [
1792
+ /* @__PURE__ */ t("span", { children: "Name" }),
1793
+ /* @__PURE__ */ t(
1794
+ "input",
1795
+ {
1796
+ type: "text",
1797
+ className: "w6w-input",
1798
+ value: h,
1799
+ onChange: (b) => g(b.target.value),
1800
+ maxLength: 120,
1801
+ autoComplete: "off"
1802
+ }
1803
+ )
1804
+ ] }),
1805
+ a && /* @__PURE__ */ l(
1806
+ "div",
1807
+ {
1808
+ role: "radiogroup",
1809
+ "aria-label": "Who can use it",
1810
+ className: "w6w-field",
1811
+ "data-testid": "credential-owner",
1812
+ children: [
1813
+ /* @__PURE__ */ t("span", { children: "Who can use it" }),
1814
+ Ja.map((b) => /* @__PURE__ */ l("label", { className: "w6w-radio", children: [
1815
+ /* @__PURE__ */ t(
1816
+ "input",
1817
+ {
1818
+ type: "radio",
1819
+ name: "w6w-cred-create-owner",
1820
+ value: b.value,
1821
+ checked: i === b.value,
1822
+ onChange: () => s(b.value)
1823
+ }
1824
+ ),
1825
+ " ",
1826
+ /* @__PURE__ */ t("strong", { children: b.label }),
1827
+ /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", children: [
1828
+ " ",
1829
+ b.hint
1830
+ ] })
1831
+ ] }, b.value))
1832
+ ]
1833
+ }
1834
+ ),
1835
+ /* @__PURE__ */ t(
1836
+ Ce,
1837
+ {
1838
+ fields: p.fields,
1839
+ values: m,
1840
+ onChange: (b, E) => k((T) => ({ ...T, [b]: E })),
1841
+ idPrefix: "w6w-cred-create"
1842
+ }
1843
+ ),
1844
+ w && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-create-error", children: w }),
1845
+ /* @__PURE__ */ l("div", { className: "w6w-modal-actions", children: [
1846
+ /* @__PURE__ */ t("button", { type: "submit", className: "w6w-btn", disabled: r.isPending, children: r.isPending ? "Creating…" : "Create credential" }),
1847
+ n && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: n, children: "Cancel" })
1848
+ ] })
1849
+ ]
1850
+ }
1851
+ )
1852
+ ] });
1853
+ }
1854
+ const We = "google-service-account.v1";
1855
+ function Ga(e) {
1665
1856
  try {
1666
1857
  const n = JSON.parse(e);
1667
1858
  return n !== null && typeof n == "object" && !Array.isArray(n) ? n : null;
@@ -1669,105 +1860,141 @@ function Ma(e) {
1669
1860
  return null;
1670
1861
  }
1671
1862
  }
1672
- const Oe = (e) => Number.isNaN(Date.parse(e)) ? e : new Date(e).toLocaleString();
1673
- function gi({
1863
+ const Be = (e) => Number.isNaN(Date.parse(e)) ? e : new Date(e).toLocaleString();
1864
+ function Xs(e) {
1865
+ return /* @__PURE__ */ t(Za, { ...e }, e.credentialId);
1866
+ }
1867
+ function Za({
1674
1868
  credentialId: e,
1675
1869
  onOpenConnection: n,
1676
1870
  onDeleted: a,
1677
- onBack: s,
1678
- slots: i
1871
+ onBack: i,
1872
+ slots: s
1679
1873
  }) {
1680
- var E, I;
1681
- const l = Tn(e), o = Ln(e), c = Mn(e), d = xn(e), h = In(e), N = En(), [u, k] = f(""), [b, D] = f(null), [g, w] = f(!1), [y, x] = f(null), [S, $] = f(null), [T, j] = f(!1), [P, A] = f(null), [R, F] = f(null), H = s && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: s, children: "← Credentials" });
1682
- if (l.isLoading)
1874
+ var te, we, oe;
1875
+ const o = Bn(e), r = Un(e), c = mt(e), u = ht(e), h = Hn(e), g = wt(), m = Ne(), [k, w] = f(""), [v, y] = f({}), [p, C] = f(null), [I, b] = f(!1), [E, T] = f(null), [j, O] = f(null), [R, x] = f(!1), [D, S] = f(null), [$, V] = f(null), _ = i && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: i, children: "← Credentials" });
1876
+ if (o.isLoading)
1683
1877
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root w6w-embed-cred-detail", children: /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) });
1684
- const L = l.data;
1685
- if (!L)
1686
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-cred-detail", "data-testid": "credential-not-found", children: [
1687
- (i == null ? void 0 : i.empty) ?? /* @__PURE__ */ t("h2", { children: "Credential not found" }),
1688
- H
1878
+ const K = o.data;
1879
+ if (!K)
1880
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-cred-detail", "data-testid": "credential-not-found", children: [
1881
+ (s == null ? void 0 : s.empty) ?? /* @__PURE__ */ t("h2", { children: "Credential not found" }),
1882
+ _
1689
1883
  ] });
1690
- const J = ((E = o.data) == null ? void 0 : E.connections) ?? [], K = L.connectionCount, B = L.status === "disabled", Y = () => {
1691
- w(!1);
1692
- const C = Ma(u);
1693
- if (!C) {
1694
- D("Enter the new secret as a JSON object.");
1884
+ const H = ((te = r.data) == null ? void 0 : te.connections) ?? [], W = K.connectionCount, N = K.status === "disabled", M = K.contract === We || (we = m.data) == null ? void 0 : we.find((d) => d.id === K.contract), P = K.contract !== We && m.isLoading, J = () => {
1885
+ if (!M) return;
1886
+ if (b(!1), !Te(M.fields, v)) {
1887
+ C("Fill in every field.");
1695
1888
  return;
1696
1889
  }
1697
- D(null), c.mutate(
1698
- { source: C },
1890
+ C(null);
1891
+ const d = Ee(M.fields, v);
1892
+ y({}), c.mutate(
1893
+ { source: d },
1699
1894
  {
1700
1895
  onSuccess: () => {
1701
- k(""), w(!0);
1896
+ c.reset(), b(!0);
1702
1897
  },
1703
- onError: (v) => D((v == null ? void 0 : v.message) ?? "Rotate failed.")
1898
+ onError: (A) => {
1899
+ c.reset(), C(ke(A, "rotate"));
1900
+ }
1704
1901
  }
1705
1902
  );
1706
- }, U = () => {
1707
- x(null), $(null), h.mutate(void 0, {
1708
- onSuccess: x,
1709
- onError: (C) => $((C == null ? void 0 : C.message) ?? "Test failed.")
1903
+ }, L = () => {
1904
+ b(!1);
1905
+ const d = Ga(k);
1906
+ if (!d) {
1907
+ C("Enter the new secret as a JSON object.");
1908
+ return;
1909
+ }
1910
+ C(null), c.mutate(
1911
+ { source: d },
1912
+ {
1913
+ onSuccess: () => {
1914
+ w(""), b(!0);
1915
+ },
1916
+ onError: (A) => C(ee(A) ?? (A == null ? void 0 : A.message) ?? "Rotate failed.")
1917
+ }
1918
+ );
1919
+ }, F = () => {
1920
+ T(null), O(null), h.mutate(void 0, {
1921
+ onSuccess: T,
1922
+ onError: (d) => O(ee(d) ?? (d == null ? void 0 : d.message) ?? "Test failed.")
1710
1923
  });
1711
- }, p = () => {
1712
- F(null), N.mutate(e, {
1713
- onSuccess: (C) => {
1714
- j(!1), C.ok ? a == null || a() : A(C.dependents.connections);
1924
+ }, G = () => {
1925
+ V(null), g.mutate(e, {
1926
+ onSuccess: (d) => {
1927
+ x(!1), d.ok ? a == null || a() : S(d.dependents.connections);
1715
1928
  },
1716
- onError: (C) => F((C == null ? void 0 : C.message) ?? "Delete failed.")
1929
+ onError: (d) => V(ee(d) ?? (d == null ? void 0 : d.message) ?? "Delete failed.")
1717
1930
  });
1718
1931
  };
1719
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-cred-detail w6w-card-stack", children: [
1720
- /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1721
- /* @__PURE__ */ t("h2", { children: L.name }),
1722
- /* @__PURE__ */ r("p", { className: "w6w-small", children: [
1723
- /* @__PURE__ */ t("code", { children: L.contract }),
1932
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-cred-detail w6w-card-stack", children: [
1933
+ /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1934
+ /* @__PURE__ */ t("h2", { children: K.name }),
1935
+ /* @__PURE__ */ l("p", { className: "w6w-small", children: [
1936
+ /* @__PURE__ */ t("code", { children: K.contract }),
1724
1937
  " ",
1725
- /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: L.status })
1938
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: K.status })
1939
+ ] }),
1940
+ /* @__PURE__ */ l("p", { className: "w6w-small", children: [
1941
+ /* @__PURE__ */ t("span", { "data-testid": "credential-scope", children: ut(K.accessScope) }),
1942
+ /* @__PURE__ */ t("span", { className: "w6w-muted", children: " · Reusable credential" })
1726
1943
  ] }),
1727
- /* @__PURE__ */ t("dl", { className: "w6w-small", "data-testid": "credential-display", children: Object.entries(L.display).map(([C, v]) => /* @__PURE__ */ r("div", { children: [
1728
- /* @__PURE__ */ t("dt", { className: "w6w-muted", children: C }),
1729
- /* @__PURE__ */ t("dd", { children: v })
1730
- ] }, C)) }),
1731
- /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", children: [
1732
- K,
1944
+ /* @__PURE__ */ t("dl", { className: "w6w-small", "data-testid": "credential-display", children: Object.entries(K.display).map(([d, A]) => /* @__PURE__ */ l("div", { children: [
1945
+ /* @__PURE__ */ t("dt", { className: "w6w-muted", children: d }),
1946
+ /* @__PURE__ */ t("dd", { children: A })
1947
+ ] }, d)) }),
1948
+ /* @__PURE__ */ l("p", { className: "w6w-muted w6w-small", children: [
1949
+ W,
1733
1950
  " connection",
1734
- K === 1 ? "" : "s",
1951
+ W === 1 ? "" : "s",
1735
1952
  " · created ",
1736
- Oe(L.createdAt),
1953
+ Be(K.createdAt),
1737
1954
  " · updated",
1738
1955
  " ",
1739
- Oe(L.updatedAt)
1956
+ Be(K.updatedAt)
1740
1957
  ] }),
1741
- H
1958
+ _
1742
1959
  ] }),
1743
- /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", "data-testid": "credential-connections", children: [
1960
+ /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", "data-testid": "credential-connections", children: [
1744
1961
  /* @__PURE__ */ t("h3", { children: "Connected apps" }),
1745
- J.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: J.map((C) => /* @__PURE__ */ t("li", { children: n ? /* @__PURE__ */ t(
1962
+ H.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: H.map((d) => /* @__PURE__ */ t("li", { children: n ? /* @__PURE__ */ t(
1746
1963
  "button",
1747
1964
  {
1748
1965
  type: "button",
1749
1966
  className: "w6w-embed-conn-action",
1750
- onClick: () => n(C.id),
1751
- children: C.displayName || C.appId
1967
+ onClick: () => n(d.id),
1968
+ children: d.displayName || d.appId
1752
1969
  }
1753
- ) : /* @__PURE__ */ t("span", { children: C.displayName || C.appId }) }, C.id)) })
1970
+ ) : /* @__PURE__ */ t("span", { children: d.displayName || d.appId }) }, d.id)) })
1754
1971
  ] }),
1755
- /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1972
+ /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1756
1973
  /* @__PURE__ */ t("h3", { children: "Rotate secret" }),
1757
- /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", "data-testid": "credential-rotation-impact", children: [
1758
- K,
1974
+ /* @__PURE__ */ l("p", { className: "w6w-muted w6w-small", "data-testid": "credential-rotation-impact", children: [
1975
+ W,
1759
1976
  " connection",
1760
- K === 1 ? "" : "s",
1977
+ W === 1 ? "" : "s",
1761
1978
  " will be marked untested"
1762
1979
  ] }),
1763
- /* @__PURE__ */ t(
1980
+ P && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
1981
+ M && /* @__PURE__ */ t(
1982
+ Ce,
1983
+ {
1984
+ fields: M.fields,
1985
+ values: v,
1986
+ onChange: (d, A) => y((q) => ({ ...q, [d]: A })),
1987
+ idPrefix: "w6w-cred-rotate"
1988
+ }
1989
+ ),
1990
+ !P && !M && /* @__PURE__ */ t(
1764
1991
  "textarea",
1765
1992
  {
1766
1993
  className: "w6w-input w6w-secret-input",
1767
1994
  "aria-label": "New secret (JSON object)",
1768
1995
  rows: 5,
1769
- value: u,
1770
- onChange: (C) => k(C.target.value),
1996
+ value: k,
1997
+ onChange: (d) => w(d.target.value),
1771
1998
  name: "w6w-cred-rotate",
1772
1999
  autoComplete: "off",
1773
2000
  autoCapitalize: "off",
@@ -1779,21 +2006,30 @@ function gi({
1779
2006
  "data-form-type": "other"
1780
2007
  }
1781
2008
  ),
1782
- b && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-rotate-error", children: b }),
1783
- g && /* @__PURE__ */ t("output", { children: "Secret rotated." }),
1784
- /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", disabled: c.isPending, onClick: Y, children: c.isPending ? "Rotating…" : "Rotate" })
2009
+ p && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-rotate-error", children: p }),
2010
+ I && /* @__PURE__ */ t("output", { children: "Secret rotated." }),
2011
+ /* @__PURE__ */ t(
2012
+ "button",
2013
+ {
2014
+ type: "button",
2015
+ className: "w6w-btn",
2016
+ disabled: c.isPending || P,
2017
+ onClick: M ? J : L,
2018
+ children: c.isPending ? "Rotating…" : "Rotate"
2019
+ }
2020
+ )
1785
2021
  ] }),
1786
- /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
2022
+ /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1787
2023
  /* @__PURE__ */ t("h3", { children: "Manage" }),
1788
- /* @__PURE__ */ r("div", { className: "w6w-modal-actions", children: [
2024
+ /* @__PURE__ */ l("div", { className: "w6w-modal-actions", children: [
1789
2025
  /* @__PURE__ */ t(
1790
2026
  "button",
1791
2027
  {
1792
2028
  type: "button",
1793
2029
  className: "w6w-btn w6w-btn-ghost",
1794
- disabled: d.isPending,
1795
- onClick: () => d.mutate(B ? "active" : "disabled"),
1796
- children: B ? "Enable" : "Disable"
2030
+ disabled: u.isPending,
2031
+ onClick: () => u.mutate(N ? "active" : "disabled"),
2032
+ children: N ? "Enable" : "Disable"
1797
2033
  }
1798
2034
  ),
1799
2035
  /* @__PURE__ */ t(
@@ -1802,7 +2038,7 @@ function gi({
1802
2038
  type: "button",
1803
2039
  className: "w6w-btn w6w-btn-ghost",
1804
2040
  disabled: h.isPending,
1805
- onClick: U,
2041
+ onClick: F,
1806
2042
  children: h.isPending ? "Testing…" : "Test credential"
1807
2043
  }
1808
2044
  ),
@@ -1812,19 +2048,19 @@ function gi({
1812
2048
  type: "button",
1813
2049
  className: "w6w-btn w6w-btn-danger",
1814
2050
  onClick: () => {
1815
- A(null), j(!0);
2051
+ S(null), x(!0);
1816
2052
  },
1817
2053
  children: "Delete"
1818
2054
  }
1819
2055
  )
1820
2056
  ] }),
1821
- y && /* @__PURE__ */ t("output", { "data-testid": "credential-test-result", children: y.ok ? "ok" : y.code ?? "failed" }),
1822
- S && /* @__PURE__ */ t("p", { role: "alert", children: S }),
1823
- d.isError && /* @__PURE__ */ t("p", { role: "alert", children: ((I = d.error) == null ? void 0 : I.message) ?? "Update failed." }),
1824
- T && /* @__PURE__ */ r("div", { "data-testid": "credential-delete-confirm", children: [
1825
- /* @__PURE__ */ r("p", { className: "w6w-small", children: [
2057
+ E && /* @__PURE__ */ t("output", { "data-testid": "credential-test-result", children: E.ok ? "ok" : E.code ?? "failed" }),
2058
+ j && /* @__PURE__ */ t("p", { role: "alert", children: j }),
2059
+ u.isError && /* @__PURE__ */ t("p", { role: "alert", children: ee(u.error) ?? ((oe = u.error) == null ? void 0 : oe.message) ?? "Update failed." }),
2060
+ R && /* @__PURE__ */ l("div", { "data-testid": "credential-delete-confirm", children: [
2061
+ /* @__PURE__ */ l("p", { className: "w6w-small", children: [
1826
2062
  'Delete the credential "',
1827
- L.name,
2063
+ K.name,
1828
2064
  '"? This cannot be undone.'
1829
2065
  ] }),
1830
2066
  /* @__PURE__ */ t(
@@ -1832,8 +2068,8 @@ function gi({
1832
2068
  {
1833
2069
  type: "button",
1834
2070
  className: "w6w-btn w6w-btn-danger",
1835
- disabled: N.isPending,
1836
- onClick: p,
2071
+ disabled: g.isPending,
2072
+ onClick: G,
1837
2073
  children: "Confirm delete"
1838
2074
  }
1839
2075
  ),
@@ -1843,356 +2079,714 @@ function gi({
1843
2079
  {
1844
2080
  type: "button",
1845
2081
  className: "w6w-btn w6w-btn-ghost",
1846
- onClick: () => j(!1),
2082
+ onClick: () => x(!1),
1847
2083
  children: "Cancel"
1848
2084
  }
1849
2085
  )
1850
2086
  ] }),
1851
- P && /* @__PURE__ */ r("div", { role: "alert", "data-testid": "credential-in-use", children: [
1852
- /* @__PURE__ */ r("p", { className: "w6w-small", children: [
2087
+ D && /* @__PURE__ */ l("div", { role: "alert", "data-testid": "credential-in-use", children: [
2088
+ /* @__PURE__ */ l("p", { className: "w6w-small", children: [
1853
2089
  "This credential is still used by ",
1854
- P.length,
2090
+ D.length,
1855
2091
  " connection",
1856
- P.length === 1 ? "" : "s",
2092
+ D.length === 1 ? "" : "s",
1857
2093
  ". Delete those integrations first, or rotate this credential instead of deleting it."
1858
2094
  ] }),
1859
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", children: P.map((C) => /* @__PURE__ */ t("li", { children: C.displayName || C.appId }, C.id)) })
2095
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", children: D.map((d) => /* @__PURE__ */ t("li", { children: d.displayName || d.appId }, d.id)) })
1860
2096
  ] }),
1861
- R && /* @__PURE__ */ t("p", { role: "alert", children: R })
2097
+ $ && /* @__PURE__ */ t("p", { role: "alert", children: $ })
1862
2098
  ] })
1863
2099
  ] });
1864
2100
  }
1865
- function V(e) {
1866
- const n = xt(e), a = e == null ? void 0 : e.code;
2101
+ const Xa = "Keys that only you can use are not turned on for this account.", es = "Models that only your personal key can see are not added to the account's catalog.", ts = "This provider is not supported for personal keys.", ns = "Could not save the key. Nothing was kept.", as = "Could not save the key, and a partial copy could not be removed. Remove it under Shared credentials.", Ue = "The key was removed, but its stored copy was not.";
2102
+ function ss(e) {
2103
+ var i;
2104
+ const n = e ?? {}, a = Array.isArray(n.accepts) ? n.accepts : (i = n.serviceAccount) == null ? void 0 : i.accepts;
2105
+ return Array.isArray(a) ? a.filter((s) => typeof s == "string") : [];
2106
+ }
2107
+ function is(e, n) {
2108
+ for (const a of e ?? []) {
2109
+ const i = a;
2110
+ if (i.type === "oauth2" || typeof i.key != "string") continue;
2111
+ const s = ss(a).find((o) => n.some((r) => r.id === o));
2112
+ if (s) return { authKey: i.key, contract: s };
2113
+ }
2114
+ return null;
2115
+ }
2116
+ const re = (e) => e.provider ?? e.appId;
2117
+ function ei({ providerAppId: e }) {
2118
+ const n = pt(), a = Vn(), i = it(), s = dt({ accessScope: "user" }), o = Gn(n), r = Ne(), c = (a.data ?? []).filter((w) => w.designation), u = new Map((s.data ?? []).map((w) => [w.id, w])), h = (i.data ?? []).filter(
2119
+ (w) => w.accessScope === "user" && w.credentialId && u.has(w.credentialId)
2120
+ ), g = o.data ?? [], [m, k] = f(null);
2121
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-ai-keys w6w-card-stack", "data-testid": "my-ai-keys", children: [
2122
+ /* @__PURE__ */ t("h2", { children: "My AI keys" }),
2123
+ /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: "Keys that only you can use. They are never shown again after you save them." }),
2124
+ /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", "data-testid": "ai-keys-private-note", children: es }),
2125
+ !n && /* @__PURE__ */ t("output", { className: "w6w-muted", "data-testid": "ai-keys-disabled", children: Xa }),
2126
+ (a.isLoading || i.isLoading || s.isLoading) && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
2127
+ a.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: "Could not load the AI providers." }),
2128
+ n && c.length > 0 && /* @__PURE__ */ t(ls, { providers: c, initial: e, types: r.data ?? [] }),
2129
+ !a.isLoading && !a.error && c.length === 0 && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No AI providers are available." }),
2130
+ m && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "ai-keys-notice", children: m }),
2131
+ c.map((w) => {
2132
+ const v = h.filter((y) => y.appId === w.appId);
2133
+ return v.length === 0 ? null : /* @__PURE__ */ t(
2134
+ rs,
2135
+ {
2136
+ provider: w,
2137
+ keys: v,
2138
+ creds: u,
2139
+ current: g.find((y) => y.providerAppId === w.appId),
2140
+ types: r.data ?? [],
2141
+ onNotice: k
2142
+ },
2143
+ w.appId
2144
+ );
2145
+ })
2146
+ ] });
2147
+ }
2148
+ function ls({
2149
+ providers: e,
2150
+ initial: n,
2151
+ types: a
2152
+ }) {
2153
+ var R, x;
2154
+ const i = he(), s = me(), [o, r] = f(n), c = ((R = e.find((D) => D.appId === o)) == null ? void 0 : R.appId) ?? ((x = e[0]) == null ? void 0 : x.appId) ?? "", u = e.find((D) => D.appId === c), [h, g] = f(""), [m, k] = f({}), [w, v] = f(null), [y, p] = f(!1), [C, I] = f(!1), b = Rn({
2155
+ queryKey: ["app-auth", c],
2156
+ queryFn: () => i.console.apps.getAuth(c),
2157
+ enabled: c !== "",
2158
+ retry: !1
2159
+ }), E = is(b.data, a), T = E ? a.find((D) => D.id === E.contract) : void 0, j = (D) => {
2160
+ r(D), k({}), v(null), I(!1);
2161
+ }, O = async () => {
2162
+ if (!u || !E || !T || y) return;
2163
+ if (!Te(T.fields, m)) {
2164
+ v("Fill in every field.");
2165
+ return;
2166
+ }
2167
+ v(null), I(!1);
2168
+ const D = Ee(T.fields, m);
2169
+ k({}), p(!0);
2170
+ let S = null;
2171
+ try {
2172
+ const $ = await Yn(i, {
2173
+ name: h.trim() || `My ${re(u)} key`,
2174
+ contract: E.contract,
2175
+ source: D,
2176
+ accessScope: "user"
2177
+ });
2178
+ S = $.id, await On(i, c, {
2179
+ authKey: E.authKey,
2180
+ credentialId: $.id,
2181
+ accessScope: "user"
2182
+ }), g(""), I(!0);
2183
+ } catch ($) {
2184
+ if (S) {
2185
+ const V = await zn(i, S).then(
2186
+ (_) => _.ok,
2187
+ () => !1
2188
+ );
2189
+ v(V ? ee($) ?? ns : as);
2190
+ } else
2191
+ v(ke($, "create"));
2192
+ } finally {
2193
+ p(!1), s.invalidateQueries({ queryKey: Jn }), s.invalidateQueries({ queryKey: ge });
2194
+ }
2195
+ };
2196
+ return /* @__PURE__ */ l(
2197
+ "form",
2198
+ {
2199
+ className: "w6w-embed-conn-card w6w-card-stack",
2200
+ "data-testid": "ai-key-add",
2201
+ onSubmit: (D) => {
2202
+ D.preventDefault(), O();
2203
+ },
2204
+ children: [
2205
+ /* @__PURE__ */ t("h3", { children: "Add a key" }),
2206
+ /* @__PURE__ */ l("label", { className: "w6w-field", children: [
2207
+ /* @__PURE__ */ t("span", { children: "Provider" }),
2208
+ /* @__PURE__ */ t("select", { value: c, "aria-label": "Provider", onChange: (D) => j(D.target.value), children: e.map((D) => /* @__PURE__ */ t("option", { value: D.appId, children: re(D) }, D.appId)) })
2209
+ ] }),
2210
+ b.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
2211
+ !b.isLoading && !T && /* @__PURE__ */ t("p", { className: "w6w-muted", "data-testid": "ai-key-unsupported", children: ts }),
2212
+ T && /* @__PURE__ */ l(Q, { children: [
2213
+ /* @__PURE__ */ l("label", { className: "w6w-field", children: [
2214
+ /* @__PURE__ */ t("span", { children: "Name" }),
2215
+ /* @__PURE__ */ t(
2216
+ "input",
2217
+ {
2218
+ type: "text",
2219
+ className: "w6w-input",
2220
+ value: h,
2221
+ placeholder: u ? `My ${re(u)} key` : "",
2222
+ onChange: (D) => g(D.target.value),
2223
+ maxLength: 120,
2224
+ autoComplete: "off"
2225
+ }
2226
+ )
2227
+ ] }),
2228
+ /* @__PURE__ */ t(
2229
+ Ce,
2230
+ {
2231
+ fields: T.fields,
2232
+ values: m,
2233
+ onChange: (D, S) => k(($) => ({ ...$, [D]: S })),
2234
+ idPrefix: "w6w-ai-key-add"
2235
+ }
2236
+ ),
2237
+ w && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "ai-key-add-error", children: w }),
2238
+ C && /* @__PURE__ */ t("output", { "data-testid": "ai-key-saved", children: "Key saved. Only you can use it." }),
2239
+ /* @__PURE__ */ t("div", { className: "w6w-modal-actions", children: /* @__PURE__ */ t("button", { type: "submit", className: "w6w-btn", disabled: y, children: y ? "Saving…" : "Save key" }) })
2240
+ ] })
2241
+ ]
2242
+ }
2243
+ );
2244
+ }
2245
+ function rs({
2246
+ provider: e,
2247
+ keys: n,
2248
+ creds: a,
2249
+ current: i,
2250
+ types: s,
2251
+ onNotice: o
2252
+ }) {
2253
+ const r = Zn(), c = Xn(), [u, h] = f(null), g = e.appId, m = i && n.some((w) => w.id === i.connectionId) ? i : void 0, k = (w) => {
2254
+ h(null);
2255
+ const v = {
2256
+ onError: (y) => h(ee(y) ?? "Could not change the default key.")
2257
+ };
2258
+ w === null ? c.mutate(g, v) : r.mutate({ providerAppId: g, connectionId: w }, v);
2259
+ };
2260
+ return /* @__PURE__ */ l("section", { className: "w6w-embed-conn-card w6w-card-stack", "data-testid": `ai-provider-${g}`, children: [
2261
+ /* @__PURE__ */ t("h3", { children: re(e) }),
2262
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": `${re(e)} keys`, children: n.map((w) => {
2263
+ const v = a.get(w.credentialId);
2264
+ return /* @__PURE__ */ t(
2265
+ os,
2266
+ {
2267
+ connection: w,
2268
+ credential: v,
2269
+ descriptor: s.find((y) => y.id === v.contract),
2270
+ onNotice: o
2271
+ },
2272
+ w.id
2273
+ );
2274
+ }) }),
2275
+ /* @__PURE__ */ l("div", { role: "radiogroup", "aria-label": `Default key for ${re(e)}`, children: [
2276
+ /* @__PURE__ */ t("span", { className: "w6w-small", children: "Default key" }),
2277
+ /* @__PURE__ */ l("label", { className: "w6w-radio", children: [
2278
+ /* @__PURE__ */ t(
2279
+ "input",
2280
+ {
2281
+ type: "radio",
2282
+ name: `ai-default-${g}`,
2283
+ checked: !m,
2284
+ onChange: () => {
2285
+ m && k(null);
2286
+ }
2287
+ }
2288
+ ),
2289
+ " ",
2290
+ "None"
2291
+ ] }),
2292
+ n.map((w) => /* @__PURE__ */ l("label", { className: "w6w-radio", children: [
2293
+ /* @__PURE__ */ t(
2294
+ "input",
2295
+ {
2296
+ type: "radio",
2297
+ name: `ai-default-${g}`,
2298
+ "data-testid": `ai-default-${w.id}`,
2299
+ checked: (m == null ? void 0 : m.connectionId) === w.id,
2300
+ onChange: () => k(w.id)
2301
+ }
2302
+ ),
2303
+ " ",
2304
+ w.displayName
2305
+ ] }, w.id))
2306
+ ] }),
2307
+ (i == null ? void 0 : i.status) === "unavailable" && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": `ai-default-warning-${g}`, children: "Your default key for this provider is not available. Enable it, replace it or pick another." }),
2308
+ u && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: u })
2309
+ ] });
2310
+ }
2311
+ function os({
2312
+ connection: e,
2313
+ credential: n,
2314
+ descriptor: a,
2315
+ onNotice: i
2316
+ }) {
2317
+ const s = ct(e.id), o = mt(n.id), r = ht(n.id), c = lt(), u = wt(), [h, g] = f(!1), [m, k] = f({}), [w, v] = f(!1), [y, p] = f(null), [C, I] = f(null), [b, E] = f(null), T = n.status === "disabled", j = Object.values(n.display)[0], O = (S, $) => I(ee(S) ?? $), R = () => {
2318
+ E(null), I(null), s.mutate(void 0, {
2319
+ onSuccess: (S) => E(S.ok ? "ok" : "failed"),
2320
+ onError: (S) => O(S, "Could not test the key.")
2321
+ });
2322
+ }, x = () => {
2323
+ if (!a) return;
2324
+ if (p(null), !Te(a.fields, m)) {
2325
+ I("Fill in every field.");
2326
+ return;
2327
+ }
2328
+ I(null);
2329
+ const S = Ee(a.fields, m);
2330
+ k({}), o.mutate(
2331
+ { source: S },
2332
+ {
2333
+ onSuccess: () => {
2334
+ o.reset(), g(!1), p("Key replaced.");
2335
+ },
2336
+ onError: ($) => {
2337
+ o.reset(), I(ke($, "rotate"));
2338
+ }
2339
+ }
2340
+ );
2341
+ }, D = () => {
2342
+ I(null), i(null), c.mutate(
2343
+ { id: e.id },
2344
+ {
2345
+ onSuccess: (S) => {
2346
+ if (!S.ok) {
2347
+ v(!1), I("This key is still in use. Remove what uses it first.");
2348
+ return;
2349
+ }
2350
+ u.mutate(n.id, {
2351
+ onSuccess: ($) => {
2352
+ $.ok || i(Ue);
2353
+ },
2354
+ onError: ($) => i(ee($) ?? Ue)
2355
+ });
2356
+ },
2357
+ onError: (S) => {
2358
+ v(!1), O(S, "Could not remove the key.");
2359
+ }
2360
+ }
2361
+ );
2362
+ };
2363
+ return /* @__PURE__ */ l("li", { "data-testid": `ai-key-${e.id}`, children: [
2364
+ /* @__PURE__ */ l("div", { children: [
2365
+ /* @__PURE__ */ t("strong", { children: e.displayName }),
2366
+ " ",
2367
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", "data-testid": `ai-key-status-${e.id}`, children: n.status }),
2368
+ j !== void 0 && /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", "data-testid": `ai-key-display-${e.id}`, children: [
2369
+ " ",
2370
+ j
2371
+ ] })
2372
+ ] }),
2373
+ /* @__PURE__ */ l("div", { className: "w6w-modal-actions", children: [
2374
+ /* @__PURE__ */ t(
2375
+ "button",
2376
+ {
2377
+ type: "button",
2378
+ className: "w6w-btn w6w-btn-ghost",
2379
+ disabled: s.isPending,
2380
+ onClick: R,
2381
+ children: s.isPending ? "Testing…" : "Test"
2382
+ }
2383
+ ),
2384
+ a && /* @__PURE__ */ t(
2385
+ "button",
2386
+ {
2387
+ type: "button",
2388
+ className: "w6w-btn w6w-btn-ghost",
2389
+ onClick: () => g((S) => !S),
2390
+ children: "Replace key"
2391
+ }
2392
+ ),
2393
+ /* @__PURE__ */ t(
2394
+ "button",
2395
+ {
2396
+ type: "button",
2397
+ className: "w6w-btn w6w-btn-ghost",
2398
+ disabled: r.isPending,
2399
+ onClick: () => r.mutate(T ? "active" : "disabled", {
2400
+ onError: (S) => O(S, "Could not change the key's status.")
2401
+ }),
2402
+ children: T ? "Enable" : "Disable"
2403
+ }
2404
+ ),
2405
+ /* @__PURE__ */ t(
2406
+ "button",
2407
+ {
2408
+ type: "button",
2409
+ className: "w6w-btn w6w-btn-danger",
2410
+ onClick: () => v(!0),
2411
+ children: "Remove"
2412
+ }
2413
+ )
2414
+ ] }),
2415
+ b && /* @__PURE__ */ t("output", { "data-testid": `ai-key-test-${e.id}`, children: b === "ok" ? "Test passed" : "Test failed" }),
2416
+ h && a && /* @__PURE__ */ l("div", { className: "w6w-card-stack", "data-testid": `ai-key-replace-${e.id}`, children: [
2417
+ /* @__PURE__ */ t(
2418
+ Ce,
2419
+ {
2420
+ fields: a.fields,
2421
+ values: m,
2422
+ onChange: (S, $) => k((V) => ({ ...V, [S]: $ })),
2423
+ idPrefix: `w6w-ai-key-replace-${e.id}`
2424
+ }
2425
+ ),
2426
+ /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", disabled: o.isPending, onClick: x, children: o.isPending ? "Replacing…" : "Save new key" })
2427
+ ] }),
2428
+ w && /* @__PURE__ */ l("div", { "data-testid": `ai-key-remove-confirm-${e.id}`, children: [
2429
+ /* @__PURE__ */ l("p", { className: "w6w-small", children: [
2430
+ 'Remove "',
2431
+ e.displayName,
2432
+ '"? This cannot be undone.'
2433
+ ] }),
2434
+ /* @__PURE__ */ t(
2435
+ "button",
2436
+ {
2437
+ type: "button",
2438
+ className: "w6w-btn w6w-btn-danger",
2439
+ disabled: c.isPending,
2440
+ onClick: D,
2441
+ children: "Confirm remove"
2442
+ }
2443
+ ),
2444
+ " ",
2445
+ /* @__PURE__ */ t(
2446
+ "button",
2447
+ {
2448
+ type: "button",
2449
+ className: "w6w-btn w6w-btn-ghost",
2450
+ onClick: () => v(!1),
2451
+ children: "Cancel"
2452
+ }
2453
+ )
2454
+ ] }),
2455
+ y && /* @__PURE__ */ t("output", { children: y }),
2456
+ C && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: C })
2457
+ ] });
2458
+ }
2459
+ function Y(e) {
2460
+ const n = Yt(e), a = e == null ? void 0 : e.code;
1867
2461
  return n.code === void 0 && typeof a == "string" && a !== "" ? { ...n, code: a } : n;
1868
2462
  }
1869
- const je = 80;
1870
- function xa(e, n) {
2463
+ const He = 80;
2464
+ function cs(e, n) {
1871
2465
  if (typeof URL > "u" || typeof URL.createObjectURL != "function") return;
1872
- const a = URL.createObjectURL(new Blob([n], { type: "text/csv" })), s = document.createElement("a");
1873
- s.href = a, s.download = e, s.click(), URL.revokeObjectURL(a);
1874
- }
1875
- function Ia({ store: e, project: n }) {
1876
- var Me;
1877
- const a = It(e), s = (a == null ? void 0 : a.columns) ?? [], i = (a == null ? void 0 : a.key) ?? "", [l, o] = f(""), [c, d] = f({}), [h, N] = f({}), [u, k] = f({}), [b, D] = f({}), [g, w] = f(null), [y, x] = f(null), [S, $] = f(null), T = pe(), j = we(), P = Ze(e.id, n, l), A = Ge(), R = Rn(), F = Xe(), H = Sn(), L = Pn(), J = (((Me = P.data) == null ? void 0 : Me.pages.flatMap((m) => m.items)) ?? []).map(
1878
- (m) => b[m.key] ?? m
1879
- ), K = new Map(J.map((m) => [m.key, m])), B = [], Y = (m) => c[m], U = Y(te), p = (m, M, q) => {
1880
- const Z = q === void 0 ? null : ce(q, s);
1881
- B.push({
1882
- id: m,
1883
- isNew: m === te,
1884
- cells: M.cells,
1885
- version: M.version,
1886
- dirty: Z === null ? !0 : Ot(M, Z, s).length > 0,
1887
- conflict: u[m] === !0,
1888
- cellErrors: h[m]
2466
+ const a = URL.createObjectURL(new Blob([n], { type: "text/csv" })), i = document.createElement("a");
2467
+ i.href = a, i.download = e, i.click(), URL.revokeObjectURL(a);
2468
+ }
2469
+ function ds({ store: e, project: n }) {
2470
+ var oe;
2471
+ const a = zt(e), i = (a == null ? void 0 : a.columns) ?? [], s = (a == null ? void 0 : a.key) ?? "", [o, r] = f(""), [c, u] = f({}), [h, g] = f({}), [m, k] = f({}), [w, v] = f({}), [y, p] = f(null), [C, I] = f(null), [b, E] = f(null), T = he(), j = me(), O = ft(e.id, n, o), R = yt(), x = ta(), D = gt(), S = na(), $ = aa(), V = (((oe = O.data) == null ? void 0 : oe.pages.flatMap((d) => d.items)) ?? []).map(
2472
+ (d) => w[d.key] ?? d
2473
+ ), _ = new Map(V.map((d) => [d.key, d])), K = [], H = (d) => c[d], W = H(ae), N = (d, A, q) => {
2474
+ const Z = q === void 0 ? null : pe(q, i);
2475
+ K.push({
2476
+ id: d,
2477
+ isNew: d === ae,
2478
+ cells: A.cells,
2479
+ version: A.version,
2480
+ dirty: Z === null ? !0 : tn(A, Z, i).length > 0,
2481
+ conflict: m[d] === !0,
2482
+ cellErrors: h[d]
1889
2483
  });
1890
2484
  };
1891
- U !== void 0 && p(te, U, void 0);
1892
- for (const m of J)
1893
- p(m.key, Y(m.key) ?? ce(m, s), m);
1894
- const E = (m) => {
1895
- N((M) => ne(M, m)), k((M) => ne(M, m));
1896
- }, I = (m) => {
1897
- d((M) => ne(M, m)), E(m);
2485
+ W !== void 0 && N(ae, W, void 0);
2486
+ for (const d of V)
2487
+ N(d.key, H(d.key) ?? pe(d, i), d);
2488
+ const M = (d) => {
2489
+ g((A) => se(A, d)), k((A) => se(A, d));
2490
+ }, P = (d) => {
2491
+ u((A) => se(A, d)), M(d);
1898
2492
  };
1899
- function C(m, M, q) {
1900
- const Z = K.get(m), z = Y(m) ?? (Z ? ce(Z, s) : xe(s));
1901
- d((_) => ({ ..._, [m]: { ...z, cells: { ...z.cells, [M]: q } } })), N((_) => {
1902
- const ee = _[m];
1903
- if (ee === void 0 || !(M in ee)) return _;
1904
- const se = ne(ee, M);
1905
- return Object.keys(se).length === 0 ? ne(_, m) : { ..._, [m]: se };
2493
+ function J(d, A, q) {
2494
+ const Z = _.get(d), z = H(d) ?? (Z ? pe(Z, i) : Ke(i));
2495
+ u((B) => ({ ...B, [d]: { ...z, cells: { ...z.cells, [A]: q } } })), g((B) => {
2496
+ const ne = B[d];
2497
+ if (ne === void 0 || !(A in ne)) return B;
2498
+ const ce = se(ne, A);
2499
+ return Object.keys(ce).length === 0 ? se(B, d) : { ...B, [d]: ce };
1906
2500
  });
1907
2501
  }
1908
- async function v(m) {
1909
- const M = K.get(m), q = Y(m) ?? (M ? ce(M, s) : void 0);
2502
+ async function L(d) {
2503
+ const A = _.get(d), q = H(d) ?? (A ? pe(A, i) : void 0);
1910
2504
  if (q === void 0) return;
1911
- w(null), E(m);
1912
- const Z = Kt(q, s);
2505
+ p(null), M(d);
2506
+ const Z = an(q, i);
1913
2507
  if (!Z.ok) {
1914
- N((_) => ({ ..._, [m]: Z.errors }));
2508
+ g((B) => ({ ...B, [d]: Z.errors }));
1915
2509
  return;
1916
2510
  }
1917
- const z = Qt(
2511
+ const z = sn(
1918
2512
  q,
1919
2513
  Z.value,
1920
- We((M == null ? void 0 : M.expiresAt) ?? null, Date.now())
2514
+ Xe((A == null ? void 0 : A.expiresAt) ?? null, Date.now())
1921
2515
  );
1922
2516
  try {
1923
- z.kind === "insert" ? await R.mutateAsync({
2517
+ z.kind === "insert" ? await x.mutateAsync({
1924
2518
  id: e.id,
1925
2519
  row: z.value,
1926
2520
  ttlSeconds: z.ttlSeconds,
1927
2521
  project: n
1928
- }) : await A.mutateAsync({
2522
+ }) : await R.mutateAsync({
1929
2523
  id: e.id,
1930
2524
  key: z.key,
1931
2525
  value: z.value,
1932
2526
  ifVersion: z.ifVersion,
1933
2527
  ttlSeconds: z.ttlSeconds,
1934
2528
  project: n
1935
- }), D((_) => ne(_, m)), I(m);
1936
- } catch (_) {
1937
- const ee = V(_);
1938
- if (Be(ee)) {
1939
- k((fe) => ({ ...fe, [m]: !0 }));
2529
+ }), v((B) => se(B, d)), P(d);
2530
+ } catch (B) {
2531
+ const ne = Y(B);
2532
+ if (et(ne)) {
2533
+ k((Ie) => ({ ...Ie, [d]: !0 }));
1940
2534
  return;
1941
2535
  }
1942
- const se = Ft(ee, s);
1943
- if (se !== null) {
1944
- N((fe) => ({ ...fe, [m]: se }));
2536
+ const ce = ln(ne, i);
2537
+ if (ce !== null) {
2538
+ g((Ie) => ({ ...Ie, [d]: ce }));
1945
2539
  return;
1946
2540
  }
1947
- w(ee.message);
2541
+ p(ne.message);
1948
2542
  }
1949
2543
  }
1950
- async function O(m) {
2544
+ async function F(d) {
1951
2545
  try {
1952
- const M = await et(T, e.id, m, n);
1953
- D((q) => ({ ...q, [m]: M })), I(m), await j.invalidateQueries({ queryKey: ["data-stores"] });
1954
- } catch (M) {
1955
- w(V(M).message);
2546
+ const A = await vt(T, e.id, d, n);
2547
+ v((q) => ({ ...q, [d]: A })), P(d), await j.invalidateQueries({ queryKey: ["data-stores"] });
2548
+ } catch (A) {
2549
+ p(Y(A).message);
1956
2550
  }
1957
2551
  }
1958
- function X() {
1959
- const m = y;
1960
- x(null), m !== null && (m !== te && F.mutate({ id: e.id, key: m, project: n }), I(m));
2552
+ function G() {
2553
+ const d = C;
2554
+ I(null), d !== null && (d !== ae && D.mutate({ id: e.id, key: d, project: n }), P(d));
1961
2555
  }
1962
- async function oe(m) {
1963
- $(null);
2556
+ async function te(d) {
2557
+ E(null);
1964
2558
  try {
1965
- const M = await H.mutateAsync({ id: e.id, csv: await m.text(), project: n });
1966
- $(Ie({ status: 200, text: JSON.stringify(M) }));
1967
- } catch (M) {
1968
- const q = M;
1969
- $(
1970
- typeof q.status == "number" ? Ie({ status: q.status, text: JSON.stringify(q.raw ?? null) }) : { ok: !1, message: V(M).message }
2559
+ const A = await S.mutateAsync({ id: e.id, csv: await d.text(), project: n });
2560
+ E(je({ status: 200, text: JSON.stringify(A) }));
2561
+ } catch (A) {
2562
+ const q = A;
2563
+ E(
2564
+ typeof q.status == "number" ? je({ status: q.status, text: JSON.stringify(q.raw ?? null) }) : { ok: !1, message: Y(A).message }
1971
2565
  );
1972
2566
  }
1973
2567
  }
1974
- async function dt() {
2568
+ async function we() {
1975
2569
  try {
1976
- const m = await L.mutateAsync({ id: e.id, project: n });
1977
- xa(jt(null, e.name), m), $(null);
1978
- } catch (m) {
1979
- $({ ok: !1, message: V(m).message });
2570
+ const d = await $.mutateAsync({ id: e.id, project: n });
2571
+ cs(nn(null, e.name), d), E(null);
2572
+ } catch (d) {
2573
+ E({ ok: !1, message: Y(d).message });
1980
2574
  }
1981
2575
  }
1982
- return /* @__PURE__ */ r("div", { children: [
2576
+ return /* @__PURE__ */ l("div", { children: [
1983
2577
  /* @__PURE__ */ t(
1984
- Et,
2578
+ Jt,
1985
2579
  {
1986
- result: S,
1987
- busy: L.isPending,
1988
- onImport: oe,
1989
- onRefuse: (m) => $({ ok: !1, message: m }),
1990
- onExport: dt
2580
+ result: b,
2581
+ busy: $.isPending,
2582
+ onImport: te,
2583
+ onRefuse: (d) => E({ ok: !1, message: d }),
2584
+ onExport: we
1991
2585
  }
1992
2586
  ),
1993
2587
  /* @__PURE__ */ t(
1994
- At,
2588
+ Gt,
1995
2589
  {
1996
- columns: s,
1997
- keyColumn: i,
1998
- rows: B,
1999
- error: g,
2000
- loading: P.isPending,
2001
- hasMore: P.hasNextPage,
2590
+ columns: i,
2591
+ keyColumn: s,
2592
+ rows: K,
2593
+ error: y,
2594
+ loading: O.isPending,
2595
+ hasMore: O.hasNextPage,
2002
2596
  empty: /* @__PURE__ */ t("p", { className: "muted small", children: "No rows match this key prefix." }),
2003
- onCellChange: C,
2004
- onSave: (m) => void v(m),
2005
- onDelete: x,
2006
- onReload: (m) => void O(m),
2597
+ onCellChange: J,
2598
+ onSave: (d) => void L(d),
2599
+ onDelete: I,
2600
+ onReload: (d) => void F(d),
2007
2601
  onAddRow: () => {
2008
- te in c || (d((m) => ({ ...m, [te]: xe(s) })), w(null));
2602
+ ae in c || (u((d) => ({ ...d, [ae]: Ke(i) })), p(null));
2009
2603
  },
2010
- onLoadMore: () => void P.fetchNextPage(),
2011
- onSearch: o
2604
+ onLoadMore: () => void O.fetchNextPage(),
2605
+ onSearch: r
2012
2606
  }
2013
2607
  ),
2014
- y !== null && /* @__PURE__ */ t(
2015
- he,
2608
+ C !== null && /* @__PURE__ */ t(
2609
+ be,
2016
2610
  {
2017
2611
  title: "Delete entry",
2018
- message: y === te ? "Discard this unsaved row?" : `Delete "${y}"? This cannot be undone.`,
2612
+ message: C === ae ? "Discard this unsaved row?" : `Delete "${C}"? This cannot be undone.`,
2019
2613
  confirmLabel: "Delete",
2020
- onConfirm: X,
2021
- onClose: () => x(null)
2614
+ onConfirm: G,
2615
+ onClose: () => I(null)
2022
2616
  }
2023
2617
  )
2024
2618
  ] });
2025
2619
  }
2026
- function Ea({ store: e, project: n }) {
2027
- var C;
2028
- const a = e.kind === "doc", s = Rt(e), [i, l] = f(""), [o, c] = f(null), [d, h] = f(!1), [N, u] = f(""), [k, b] = f(""), [D, g] = f(null), [w, y] = f(!1), [x, S] = f({}), [$, T] = f(null), j = pe(), P = we(), A = Ze(e.id, n, i), R = Ge(), F = Xe(), H = (((C = A.data) == null ? void 0 : C.pages.flatMap((v) => v.items)) ?? []).map(
2029
- (v) => x[v.key] ?? v
2030
- ), L = o === null ? void 0 : H.find((v) => v.key === o), J = d || o !== null, K = (v) => a ? JSON.stringify(v.value ?? null, null, 2) : Wt(s, v.value), B = (v) => {
2031
- const O = K(v).replace(/\s+/g, " ");
2032
- return O.length > je ? `${O.slice(0, je)}…` : O;
2620
+ function us({ store: e, project: n }) {
2621
+ var J;
2622
+ const a = e.kind === "doc", i = Zt(e), [s, o] = f(""), [r, c] = f(null), [u, h] = f(!1), [g, m] = f(""), [k, w] = f(""), [v, y] = f(null), [p, C] = f(!1), [I, b] = f({}), [E, T] = f(null), j = he(), O = me(), R = ft(e.id, n, s), x = yt(), D = gt(), S = (((J = R.data) == null ? void 0 : J.pages.flatMap((L) => L.items)) ?? []).map(
2623
+ (L) => I[L.key] ?? L
2624
+ ), $ = r === null ? void 0 : S.find((L) => L.key === r), V = u || r !== null, _ = (L) => a ? JSON.stringify(L.value ?? null, null, 2) : cn(i, L.value), K = (L) => {
2625
+ const F = _(L).replace(/\s+/g, " ");
2626
+ return F.length > He ? `${F.slice(0, He)}…` : F;
2033
2627
  };
2034
- function Y(v) {
2035
- c(v.key), h(!1), b(K(v)), g(null), y(!1);
2628
+ function H(L) {
2629
+ c(L.key), h(!1), w(_(L)), y(null), C(!1);
2036
2630
  }
2037
- function U() {
2038
- c(null), h(!1), u(""), b(""), g(null), y(!1);
2631
+ function W() {
2632
+ c(null), h(!1), m(""), w(""), y(null), C(!1);
2039
2633
  }
2040
- async function p() {
2041
- g(null), y(!1);
2042
- const v = a ? qt(k) : _t(s, k);
2043
- if (!v.ok) {
2044
- g(v.message);
2634
+ async function N() {
2635
+ y(null), C(!1);
2636
+ const L = a ? rn(k) : on(i, k);
2637
+ if (!L.ok) {
2638
+ y(L.message);
2045
2639
  return;
2046
2640
  }
2047
- const O = d ? N.trim() : o;
2048
- if (O === null || O === "") {
2049
- g("Enter a key.");
2641
+ const F = u ? g.trim() : r;
2642
+ if (F === null || F === "") {
2643
+ y("Enter a key.");
2050
2644
  return;
2051
2645
  }
2052
2646
  try {
2053
- await R.mutateAsync({
2647
+ await x.mutateAsync({
2054
2648
  id: e.id,
2055
- key: O,
2056
- value: v.value,
2649
+ key: F,
2650
+ value: L.value,
2057
2651
  // A new entry must not exist yet; an existing one is guarded by the version loaded.
2058
- ifVersion: d ? 0 : (L == null ? void 0 : L.version) ?? 0,
2059
- ttlSeconds: d ? void 0 : We((L == null ? void 0 : L.expiresAt) ?? null, Date.now()),
2652
+ ifVersion: u ? 0 : ($ == null ? void 0 : $.version) ?? 0,
2653
+ ttlSeconds: u ? void 0 : Xe(($ == null ? void 0 : $.expiresAt) ?? null, Date.now()),
2060
2654
  project: n
2061
- }), S((X) => ne(X, O)), U();
2062
- } catch (X) {
2063
- const oe = V(X);
2064
- Be(oe) ? y(!0) : g(oe.message);
2655
+ }), b((G) => se(G, F)), W();
2656
+ } catch (G) {
2657
+ const te = Y(G);
2658
+ et(te) ? C(!0) : y(te.message);
2065
2659
  }
2066
2660
  }
2067
- async function E() {
2068
- if (o !== null)
2661
+ async function M() {
2662
+ if (r !== null)
2069
2663
  try {
2070
- const v = await et(j, e.id, o, n);
2071
- S((O) => ({ ...O, [o]: v })), b(K(v)), y(!1), g(null), await P.invalidateQueries({ queryKey: ["data-stores"] });
2072
- } catch (v) {
2073
- g(V(v).message);
2664
+ const L = await vt(j, e.id, r, n);
2665
+ b((F) => ({ ...F, [r]: L })), w(_(L)), C(!1), y(null), await O.invalidateQueries({ queryKey: ["data-stores"] });
2666
+ } catch (L) {
2667
+ y(Y(L).message);
2074
2668
  }
2075
2669
  }
2076
- async function I() {
2077
- const v = $;
2078
- if (T(null), v !== null)
2670
+ async function P() {
2671
+ const L = E;
2672
+ if (T(null), L !== null)
2079
2673
  try {
2080
- await F.mutateAsync({ id: e.id, key: v, project: n }), v === o && U();
2081
- } catch (O) {
2082
- g(V(O).message);
2674
+ await D.mutateAsync({ id: e.id, key: L, project: n }), L === r && W();
2675
+ } catch (F) {
2676
+ y(Y(F).message);
2083
2677
  }
2084
2678
  }
2085
- return /* @__PURE__ */ r("div", { children: [
2679
+ return /* @__PURE__ */ l("div", { children: [
2086
2680
  /* @__PURE__ */ t(
2087
- St,
2681
+ Xt,
2088
2682
  {
2089
- rows: H.map((v) => ({ key: v.key, version: v.version, preview: B(v) })),
2090
- loading: A.isPending,
2683
+ rows: S.map((L) => ({ key: L.key, version: L.version, preview: K(L) })),
2684
+ loading: R.isPending,
2091
2685
  empty: /* @__PURE__ */ t("p", { className: "muted small", children: "No entries match this key prefix." }),
2092
- hasMore: A.hasNextPage,
2093
- onOpen: (v) => {
2094
- const O = H.find((X) => X.key === v);
2095
- O && Y(O);
2686
+ hasMore: R.hasNextPage,
2687
+ onOpen: (L) => {
2688
+ const F = S.find((G) => G.key === L);
2689
+ F && H(F);
2096
2690
  },
2097
- onSearch: l,
2691
+ onSearch: o,
2098
2692
  onNew: () => {
2099
- c(null), h(!0), u(""), b(""), g(null), y(!1);
2693
+ c(null), h(!0), m(""), w(""), y(null), C(!1);
2100
2694
  },
2101
- onLoadMore: () => void A.fetchNextPage()
2695
+ onLoadMore: () => void R.fetchNextPage()
2102
2696
  }
2103
2697
  ),
2104
- J && /* @__PURE__ */ t(
2105
- Pt,
2698
+ V && /* @__PURE__ */ t(
2699
+ en,
2106
2700
  {
2107
2701
  kind: a ? "doc" : "kv",
2108
- isNew: d,
2109
- entryKey: o ?? void 0,
2110
- newKey: N,
2111
- version: (L == null ? void 0 : L.version) ?? null,
2112
- expiresAt: (L == null ? void 0 : L.expiresAt) ?? null,
2702
+ isNew: u,
2703
+ entryKey: r ?? void 0,
2704
+ newKey: g,
2705
+ version: ($ == null ? void 0 : $.version) ?? null,
2706
+ expiresAt: ($ == null ? void 0 : $.expiresAt) ?? null,
2113
2707
  text: k,
2114
- error: D,
2115
- conflict: w,
2116
- saving: R.isPending || F.isPending,
2117
- onDelete: d ? void 0 : () => T(o),
2118
- onTextChange: (v) => {
2119
- b(v), g(null);
2708
+ error: v,
2709
+ conflict: p,
2710
+ saving: x.isPending || D.isPending,
2711
+ onDelete: u ? void 0 : () => T(r),
2712
+ onTextChange: (L) => {
2713
+ w(L), y(null);
2120
2714
  },
2121
- onKeyChange: u,
2122
- onSave: () => void p(),
2123
- onCancel: U,
2124
- onReload: () => void E()
2715
+ onKeyChange: m,
2716
+ onSave: () => void N(),
2717
+ onCancel: W,
2718
+ onReload: () => void M()
2125
2719
  }
2126
2720
  ),
2127
- $ !== null && /* @__PURE__ */ t(
2128
- he,
2721
+ E !== null && /* @__PURE__ */ t(
2722
+ be,
2129
2723
  {
2130
2724
  title: "Delete entry",
2131
- message: `Delete "${$}"? This cannot be undone.`,
2725
+ message: `Delete "${E}"? This cannot be undone.`,
2132
2726
  confirmLabel: "Delete",
2133
- onConfirm: I,
2727
+ onConfirm: P,
2134
2728
  onClose: () => T(null)
2135
2729
  }
2136
2730
  )
2137
2731
  ] });
2138
2732
  }
2139
- function ne(e, n) {
2733
+ function se(e, n) {
2140
2734
  if (!(n in e)) return e;
2141
2735
  const a = { ...e };
2142
2736
  return delete a[n], a;
2143
2737
  }
2144
- function yi({ id: e, project: n, slots: a }) {
2145
- const s = G(n), i = An(e, s ?? void 0), l = i.data;
2146
- let o;
2147
- s == null ? o = /* @__PURE__ */ t("p", { className: "muted", children: "No project selected." }) : i.isError ? o = /* @__PURE__ */ t("p", { className: "result error", children: V(i.error).message }) : l === void 0 ? o = /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : l.kind === "table" ? o = /* @__PURE__ */ t(Ia, { store: l, project: s }, l.id) : o = /* @__PURE__ */ t(Ea, { store: l, project: s }, l.id);
2148
- const c = (a == null ? void 0 : a.header) === void 0 ? l && /* @__PURE__ */ r("div", { children: [
2149
- /* @__PURE__ */ t("h3", { children: l.name }),
2150
- /* @__PURE__ */ r("p", { className: "muted small", children: [
2151
- l.kind,
2738
+ function ti({ id: e, project: n, slots: a }) {
2739
+ const i = X(n), s = ea(e, i ?? void 0), o = s.data;
2740
+ let r;
2741
+ i == null ? r = /* @__PURE__ */ t("p", { className: "muted", children: "No project selected." }) : s.isError ? r = /* @__PURE__ */ t("p", { className: "result error", children: Y(s.error).message }) : o === void 0 ? r = /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : o.kind === "table" ? r = /* @__PURE__ */ t(ds, { store: o, project: i }, o.id) : r = /* @__PURE__ */ t(us, { store: o, project: i }, o.id);
2742
+ const c = (a == null ? void 0 : a.header) === void 0 ? o && /* @__PURE__ */ l("div", { children: [
2743
+ /* @__PURE__ */ t("h3", { children: o.name }),
2744
+ /* @__PURE__ */ l("p", { className: "muted small", children: [
2745
+ o.kind,
2152
2746
  " · ",
2153
- l.entryCount,
2747
+ o.entryCount,
2154
2748
  " ",
2155
- l.entryCount === 1 ? "entry" : "entries"
2749
+ o.entryCount === 1 ? "entry" : "entries"
2156
2750
  ] })
2157
2751
  ] }) : a.header;
2158
- return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ r("section", { className: "section", children: [
2752
+ return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
2159
2753
  c,
2160
- o
2754
+ r
2161
2755
  ] }) });
2162
2756
  }
2163
- const Aa = ["name", "kind", "description", "schema"];
2164
- function Ra(e) {
2165
- const [n, a] = f(""), [s, i] = f(""), [l, o] = f("kv"), [c, d] = f("string"), [h, N] = f([]), [u, k] = f(""), [b, D] = f({}), [g, w] = f({}), [y, x] = f(null), S = Kn();
2166
- function $() {
2167
- D({}), w({}), x(null);
2757
+ const ms = ["name", "kind", "description", "schema"];
2758
+ function hs(e) {
2759
+ const [n, a] = f(""), [i, s] = f(""), [o, r] = f("kv"), [c, u] = f("string"), [h, g] = f([]), [m, k] = f(""), [w, v] = f({}), [y, p] = f({}), [C, I] = f(null), b = la();
2760
+ function E() {
2761
+ v({}), p({}), I(null);
2168
2762
  const T = {
2169
- kind: l,
2763
+ kind: o,
2170
2764
  name: n
2171
2765
  };
2172
- l === "kv" && (T.schema = { valueType: c }), l === "table" && (T.schema = u === "" ? { columns: h } : { columns: h, key: u }), s !== "" && (T.description = s), S.mutate(
2766
+ o === "kv" && (T.schema = { valueType: c }), o === "table" && (T.schema = m === "" ? { columns: h } : { columns: h, key: m }), i !== "" && (T.description = i), b.mutate(
2173
2767
  // The SDK's create body types `schema` as table columns only; the wire takes the S-2 shape
2174
2768
  // per kind, so the kv `{valueType}` schema is passed through as the host defines it.
2175
2769
  { input: T, project: e.project },
2176
2770
  {
2177
2771
  onSuccess: () => e.onClose(),
2178
2772
  onError: (j) => {
2179
- const P = V(j), A = Yt(P);
2180
- if (A.kind === "cell" && h.some((R) => R.name === A.column)) {
2181
- w({ [A.column]: P.message });
2773
+ const O = Y(j), R = pn(O);
2774
+ if (R.kind === "cell" && h.some((x) => x.name === R.column)) {
2775
+ p({ [R.column]: O.message });
2182
2776
  return;
2183
2777
  }
2184
- if (A.kind === "field" && Aa.includes(A.field)) {
2185
- D({ [A.field]: P.message });
2778
+ if (R.kind === "field" && ms.includes(R.field)) {
2779
+ v({ [R.field]: O.message });
2186
2780
  return;
2187
2781
  }
2188
- x(P.message);
2782
+ I(O.message);
2189
2783
  }
2190
2784
  }
2191
2785
  );
2192
2786
  }
2193
- return /* @__PURE__ */ r(dn, { title: "New data store", onClose: e.onClose, children: [
2194
- /* @__PURE__ */ r("div", { className: "modal-body", children: [
2195
- /* @__PURE__ */ r("label", { className: "field", children: [
2787
+ return /* @__PURE__ */ l(Ln, { title: "New data store", onClose: e.onClose, children: [
2788
+ /* @__PURE__ */ l("div", { className: "modal-body", children: [
2789
+ /* @__PURE__ */ l("label", { className: "field", children: [
2196
2790
  /* @__PURE__ */ t("span", { children: "Name" }),
2197
2791
  /* @__PURE__ */ t(
2198
2792
  "input",
@@ -2205,53 +2799,53 @@ function Ra(e) {
2205
2799
  }
2206
2800
  )
2207
2801
  ] }),
2208
- b.name !== void 0 && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "data-store-field-error-name", children: b.name }),
2209
- /* @__PURE__ */ r("label", { className: "field", children: [
2802
+ w.name !== void 0 && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "data-store-field-error-name", children: w.name }),
2803
+ /* @__PURE__ */ l("label", { className: "field", children: [
2210
2804
  /* @__PURE__ */ t("span", { children: "Description" }),
2211
2805
  /* @__PURE__ */ t(
2212
2806
  "input",
2213
2807
  {
2214
2808
  type: "text",
2215
- value: s,
2216
- onChange: (T) => i(T.target.value),
2809
+ value: i,
2810
+ onChange: (T) => s(T.target.value),
2217
2811
  placeholder: "What this store holds"
2218
2812
  }
2219
2813
  )
2220
2814
  ] }),
2221
- /* @__PURE__ */ r("label", { className: "field", children: [
2815
+ /* @__PURE__ */ l("label", { className: "field", children: [
2222
2816
  /* @__PURE__ */ t("span", { children: "Kind" }),
2223
2817
  /* @__PURE__ */ t(
2224
2818
  "select",
2225
2819
  {
2226
2820
  "data-testid": "data-store-kind",
2227
- value: l,
2821
+ value: o,
2228
2822
  onChange: (T) => {
2229
- o(T.target.value), k("");
2823
+ r(T.target.value), k("");
2230
2824
  },
2231
- children: Ut.map((T) => /* @__PURE__ */ t("option", { value: T, children: Vt[T] }, T))
2825
+ children: un.map((T) => /* @__PURE__ */ t("option", { value: T, children: mn[T] }, T))
2232
2826
  }
2233
2827
  ),
2234
2828
  /* @__PURE__ */ t("span", { className: "hint", children: "The kind is fixed once the store exists." })
2235
2829
  ] }),
2236
- b.kind !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: b.kind }),
2237
- l === "kv" && /* @__PURE__ */ r("label", { className: "field", children: [
2830
+ w.kind !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: w.kind }),
2831
+ o === "kv" && /* @__PURE__ */ l("label", { className: "field", children: [
2238
2832
  /* @__PURE__ */ t("span", { children: "Value type" }),
2239
- /* @__PURE__ */ t("select", { value: c, onChange: (T) => d(T.target.value), children: Ht.map((T) => /* @__PURE__ */ t("option", { value: T, children: T }, T)) })
2833
+ /* @__PURE__ */ t("select", { value: c, onChange: (T) => u(T.target.value), children: hn.map((T) => /* @__PURE__ */ t("option", { value: T, children: T }, T)) })
2240
2834
  ] }),
2241
- l === "table" && /* @__PURE__ */ t(
2242
- Jt,
2835
+ o === "table" && /* @__PURE__ */ t(
2836
+ wn,
2243
2837
  {
2244
2838
  columns: h,
2245
- onChange: N,
2246
- keyColumn: u,
2839
+ onChange: g,
2840
+ keyColumn: m,
2247
2841
  onKeyColumnChange: k,
2248
- columnErrors: g
2842
+ columnErrors: y
2249
2843
  }
2250
2844
  ),
2251
- b.schema !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: b.schema }),
2252
- y !== null && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "data-store-form-error", children: y })
2845
+ w.schema !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: w.schema }),
2846
+ C !== null && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "data-store-form-error", children: C })
2253
2847
  ] }),
2254
- /* @__PURE__ */ r("div", { className: "modal-actions", children: [
2848
+ /* @__PURE__ */ l("div", { className: "modal-actions", children: [
2255
2849
  /* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Cancel" }),
2256
2850
  /* @__PURE__ */ t(
2257
2851
  "button",
@@ -2259,86 +2853,88 @@ function Ra(e) {
2259
2853
  type: "button",
2260
2854
  className: "btn",
2261
2855
  "data-testid": "data-store-create",
2262
- disabled: S.isPending,
2263
- onClick: $,
2264
- children: S.isPending ? "Creating…" : "Create"
2856
+ disabled: b.isPending,
2857
+ onClick: E,
2858
+ children: b.isPending ? "Creating…" : "Create"
2265
2859
  }
2266
2860
  )
2267
2861
  ] })
2268
2862
  ] });
2269
2863
  }
2270
- function vi({ project: e, onOpen: n, getHref: a, slots: s }) {
2271
- const i = G(e), l = On(i ?? void 0), o = jn(), [c, d] = f(!1), [h, N] = f(null), [u, k] = f(null), b = (s == null ? void 0 : s.header) === void 0 ? /* @__PURE__ */ r("div", { children: [
2864
+ function ni({ project: e, onOpen: n, getHref: a, slots: i }) {
2865
+ const s = X(e), o = sa(s ?? void 0), r = ia(), [c, u] = f(!1), [h, g] = f(null), [m, k] = f(null), w = (i == null ? void 0 : i.header) === void 0 ? /* @__PURE__ */ l("div", { children: [
2272
2866
  /* @__PURE__ */ t("h3", { children: "Data stores" }),
2273
2867
  /* @__PURE__ */ t("p", { className: "muted small", children: "Key-value, document and table storage for this project." })
2274
- ] }) : s.header;
2275
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
2868
+ ] }) : i.header;
2869
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
2276
2870
  /* @__PURE__ */ t(
2277
- Bt,
2871
+ dn,
2278
2872
  {
2279
- stores: l.data ?? [],
2280
- loading: l.isLoading,
2281
- error: u ?? (l.error != null ? V(l.error).message : null),
2873
+ stores: o.data ?? [],
2874
+ loading: o.isLoading,
2875
+ error: m ?? (o.error != null ? Y(o.error).message : null),
2282
2876
  onOpen: n,
2283
2877
  getHref: a,
2284
- onArchive: (D) => {
2285
- k(null), N(D);
2878
+ onArchive: (v) => {
2879
+ k(null), g(v);
2286
2880
  },
2287
- busy: o.isPending,
2881
+ busy: r.isPending,
2288
2882
  slots: {
2289
- header: b,
2883
+ header: w,
2290
2884
  actions: /* @__PURE__ */ t(
2291
2885
  "button",
2292
2886
  {
2293
2887
  type: "button",
2294
2888
  className: "btn",
2295
2889
  "data-testid": "data-store-new",
2296
- disabled: i == null,
2297
- onClick: () => d(!0),
2890
+ disabled: s == null,
2891
+ onClick: () => u(!0),
2298
2892
  children: "+ New data store"
2299
2893
  }
2300
2894
  ),
2301
- empty: s == null ? void 0 : s.empty
2895
+ empty: i == null ? void 0 : i.empty
2302
2896
  }
2303
2897
  }
2304
2898
  ),
2305
- c && i != null && /* @__PURE__ */ t(Ra, { project: i, onClose: () => d(!1) }),
2899
+ c && s != null && /* @__PURE__ */ t(hs, { project: s, onClose: () => u(!1) }),
2306
2900
  h && /* @__PURE__ */ t(
2307
- he,
2901
+ be,
2308
2902
  {
2309
2903
  title: "Archive data store",
2310
2904
  message: `Archive "${h.name}" and its ${h.entryCount} ${h.entryCount === 1 ? "entry" : "entries"}? Workflows and the API can no longer reach it.`,
2311
2905
  confirmLabel: "Archive",
2312
2906
  onConfirm: () => {
2313
- const D = h;
2314
- N(null), i != null && o.mutate(
2315
- { id: D.id, project: i },
2316
- { onError: (g) => k(V(g).message) }
2907
+ const v = h;
2908
+ g(null), s != null && r.mutate(
2909
+ { id: v.id, project: s },
2910
+ { onError: (y) => k(Y(y).message) }
2317
2911
  );
2318
2912
  },
2319
- onClose: () => N(null)
2913
+ onClose: () => g(null)
2320
2914
  }
2321
2915
  )
2322
2916
  ] });
2323
2917
  }
2324
2918
  export {
2325
- ci as ActivitySummary,
2326
- hi as ConnectionDetail,
2327
- mi as ConnectionList,
2328
- gi as CredentialDetail,
2329
- fi as CredentialList,
2330
- vi as DataStoreList,
2331
- yi as DataStoreView,
2332
- oi as DocumentList,
2333
- si as EndpointList,
2334
- ii as FunctionList,
2335
- Zn as Logs,
2336
- di as LogsView,
2337
- wi as ModelCatalog,
2338
- pi as ModelUsage,
2339
- li as ReliabilityBoard,
2340
- zn as RunHistory,
2341
- ui as ServiceDetail,
2342
- ri as WorkflowList
2919
+ Ws as ActivitySummary,
2920
+ Ys as ConnectionDetail,
2921
+ Hs as ConnectionList,
2922
+ Zs as CredentialCreate,
2923
+ Xs as CredentialDetail,
2924
+ Gs as CredentialList,
2925
+ ni as DataStoreList,
2926
+ ti as DataStoreView,
2927
+ Vs as DocumentList,
2928
+ Qs as EndpointList,
2929
+ Fs as FunctionList,
2930
+ va as Logs,
2931
+ Bs as LogsView,
2932
+ zs as ModelCatalog,
2933
+ Js as ModelUsage,
2934
+ ei as MyAiKeys,
2935
+ qs as ReliabilityBoard,
2936
+ ga as RunHistory,
2937
+ Us as ServiceDetail,
2938
+ _s as WorkflowList
2343
2939
  };
2344
2940
  //# sourceMappingURL=lists.mjs.map