@w6w/embed 0.2.27 → 0.2.29

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