@w6w/embed 0.2.28 → 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 +948 -909
  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,34 +1,34 @@
1
1
  "use client";
2
2
  import { jsxs as l, jsx as t, Fragment as q } from "react/jsx-runtime";
3
- import { useState as f, useMemo as le, useEffect as xt } from "react";
4
- import { F as Rt, E as Pt } from "./CreateFunctionModal-B3LpcuI9.js";
5
- import { d as Ot, f as Kt, h as Ft, b as ze, n as Se, u as jt, m as Qt } from "./endpoints-DArAqoLT.js";
6
- import { u as X, b as Me } from "./project-context-Tvp-La7A.js";
7
- import { CallableList as qt, ReliabilityList as _t, EmptyState as xe, DataTable as Re, EditButton as Je, DeleteButton as Vt, ListItem as Le, HealthStatusPill as ve, HistoryTimeline as Wt, useW6WApi as Ge, connectionAppIdsToLookUp as Ze, ConnectionList as Bt, AddConnectionModal as Ut, EditConnectionModal as Xe, Modal as Ht, resolveConnectionAppMeta as Yt, ConnectionHeader as zt, IconButton as Jt, locateDataStoreError as Gt, tableSchemaOf as Zt, draftFromEntry as ye, CsvPanel as Xt, DataTableGrid as en, NEW_ROW_ID as ae, newRowDraft as Ke, kvValueTypeOf as tn, DataEntryList as nn, DataEntryEditor as an, dirtyColumns as sn, csvFilenameOf as ln, csvImportMessage as Fe, buildRowValue as rn, rowWriteOf as on, remainingTtlSeconds as et, isVersionConflict as tt, cellErrorsOf as cn, parseDocText as dn, kvValueOf as un, serializeCell as mn, DataStoreList as hn, DATA_STORE_KINDS as wn, DATA_STORE_KIND_LABEL as pn, SCALAR_TYPES as fn, ColumnsEditor as yn, errorPlacement as gn } from "@w6w/ui";
8
- import { I as vn } from "./ImportSpecModal-xwTzj4KB.js";
9
- import { i as bn } from "./import-bindings-EUtxZ9Ti.js";
10
- import { a3 as Nn, a1 as nt, T as kn, E as Cn } from "./workflows-Dz8LMjnt.js";
11
- import { n as Tn, b as En } from "./workflow-blank-BJFLdGyE.js";
12
- import { f as In, e as je, g as Dn, b as $n, h as An, i as Ln } from "./api-calls--JHyif6a.js";
13
- import { C as Ne, a as Sn, M as Mn } from "./ConfirmModal-Pv2-A_3U.js";
14
- import { D as xn } from "./DocumentFormModal-DieWYFi4.js";
15
- import { k as Rn, i as Pn } from "./spec-import-0B6oUewa.js";
16
- import { H as On, a as at } from "./editor-apps-HEOclsxL.js";
17
- import { ApiError as st } from "@w6w/sdk";
18
- import { useQueryClient as pe, useInfiniteQuery as it, useQuery as lt } from "@tanstack/react-query";
19
- import { u as rt, o as ot, k as ct, c as we, b as dt, m as Kn, p as ut, e as Qe, q as Fn } from "./connections-CzsCyIxY.js";
20
- import { M as jn } from "./ModelRoutesManager-DtByS4mE.js";
21
- import { j as Qn } from "./apps-FMcQfyL2.js";
22
- import { u as ce } from "./client-context-CX61Bgw-.js";
23
- import { v as qn, A as _n, s as Vn, E as Wn, c as Bn } from "./models-CI0vLJ6o.js";
24
- import { x as mt, w as ke, a as ht, p as Un, g as oe, v as Hn, q as Yn, z as wt, A as pt, B as zn, y as ft, o as ee, c as Jn, i as Gn, h as Zn } from "./credentials-4Nf2GfMc.js";
25
- import { u as yt, b as Xn, d as ea, c as ta } from "./ai-keys-D676ly41.js";
26
- import { h as na, k as gt, p as vt, o as aa, j as bt, n as sa, m as ia, g as Nt, i as la, u as ra, f as oa } from "./data-stores-UeQvwVCa.js";
27
- function Pe(e) {
28
- const { kind: n } = e, a = Ot(n), [s, i] = f(!1), o = (e.rows ?? []).map((r) => ({
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: bn(r)
31
+ archived: Cn(r)
32
32
  }));
33
33
  return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
34
34
  /* @__PURE__ */ t(
@@ -56,14 +56,14 @@ function Pe(e) {
56
56
  }
57
57
  ),
58
58
  s && /* @__PURE__ */ t(
59
- vn,
59
+ kn,
60
60
  {
61
61
  kind: n,
62
62
  project: e.project ?? void 0,
63
- listKeys: { functionsKey: Ft, endpointsKey: Kt, workflowsKey: Nn },
64
- onOpenImported: (r, c) => {
65
- var m;
66
- return (m = e.onOpen) == null ? void 0 : m.call(e, c);
63
+ listKeys: { functionsKey: Ft, endpointsKey: Ot, workflowsKey: Tn },
64
+ onOpenImported: (r, d) => {
65
+ var u;
66
+ return (u = e.onOpen) == null ? void 0 : u.call(e, d);
67
67
  },
68
68
  onClose: () => i(!1)
69
69
  }
@@ -74,10 +74,10 @@ function Pe(e) {
74
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 Vs(e) {
78
- const n = ze(), a = X(e.project), [s, i] = 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,
@@ -97,7 +97,7 @@ function Vs(e) {
97
97
  },
98
98
  onOpen: e.onOpen,
99
99
  getHref: e.getHref,
100
- onCreate: () => i(Se("function")),
100
+ onCreate: () => i(Me("function")),
101
101
  slots: e.slots,
102
102
  children: s !== null && /* @__PURE__ */ t(
103
103
  Rt,
@@ -114,10 +114,10 @@ function Vs(e) {
114
114
  }
115
115
  );
116
116
  }
117
- function Ws(e) {
118
- const n = jt(), a = X(e.project), [s, i] = 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,
@@ -147,7 +147,7 @@ function Ws(e) {
147
147
  },
148
148
  onOpen: e.onOpen,
149
149
  getHref: e.getHref,
150
- onCreate: () => i(Se("endpoint")),
150
+ onCreate: () => i(Me("endpoint")),
151
151
  slots: e.slots,
152
152
  children: s !== null && /* @__PURE__ */ t(
153
153
  Pt,
@@ -164,10 +164,10 @@ function Ws(e) {
164
164
  }
165
165
  );
166
166
  }
167
- function Bs(e) {
168
- const n = X(e.project), a = nt(n ?? void 0, n != null), s = kn(n ?? void 0), [i, 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,
@@ -178,7 +178,7 @@ function Bs(e) {
178
178
  title: r.displayName || r.name,
179
179
  description: r.description,
180
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)) }),
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,13 +191,13 @@ function Bs(e) {
191
191
  getHref: e.getHref,
192
192
  onCreate: () => {
193
193
  o(null);
194
- const r = Tn((a.data ?? []).map((c) => c.displayName || c.name));
195
- s.mutate(En(Se("workflow"), r), {
196
- onSuccess: (c) => {
197
- var m;
198
- return (m = e.onCreated) == null ? void 0 : m.call(e, c.workflow.id);
194
+ const r = An((a.data ?? []).map((d) => d.displayName || d.name));
195
+ s.mutate(Dn(Me("workflow"), r), {
196
+ onSuccess: (d) => {
197
+ var u;
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
203
  creating: s.isPending,
@@ -205,7 +205,7 @@ function Bs(e) {
205
205
  }
206
206
  );
207
207
  }
208
- function Us({
208
+ function zs({
209
209
  project: e,
210
210
  variant: n = "full",
211
211
  limit: a,
@@ -213,62 +213,62 @@ function Us({
213
213
  showChart: i,
214
214
  getHref: o,
215
215
  onOpen: r,
216
- showAllHref: c,
217
- onShowAll: m,
218
- slots: u
216
+ showAllHref: d,
217
+ onShowAll: u,
218
+ slots: m
219
219
  }) {
220
- var y, p;
221
- const g = Me().project, h = e === void 0 ? g : e, C = h || null, w = In(C ?? void 0, s);
222
- let v = u == null ? void 0 : u.empty;
223
- return C ? 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(
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
224
  _t,
225
225
  {
226
- services: C ? ((y = w.data) == null ? void 0 : y.services) ?? [] : [],
227
- window: C ? (p = w.data) == null ? void 0 : p.window : void 0,
226
+ services: k ? ((y = w.data) == null ? void 0 : y.services) ?? [] : [],
227
+ window: k ? (E = w.data) == null ? void 0 : E.window : void 0,
228
228
  days: s,
229
229
  compact: n === "compact",
230
230
  showChart: i,
231
231
  limit: a,
232
232
  getHref: o,
233
233
  onOpen: r,
234
- showAllHref: c,
235
- onShowAll: m,
236
- slots: { ...u, empty: v }
234
+ showAllHref: d,
235
+ onShowAll: u,
236
+ slots: { ...m, empty: b }
237
237
  }
238
238
  ) });
239
239
  }
240
- function ca(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 Hs({ project: e, onOpen: n, getHref: a, slots: s, rowSlots: i }) {
245
- var y;
246
- const o = X(e), r = Rn(o ?? void 0, o != null), c = Pn(), [m, u] = f(null), [g, h] = f(null), C = (s == null ? void 0 : s.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
- ] }) : s.header, w = (s == null ? void 0 : s.empty) === void 0 ? /* @__PURE__ */ t(xe, { testId: "document-list-empty", children: "No documents yet." }) : s.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 $;
255
- const T = ($ = i == null ? void 0 : i.lead) == null ? void 0 : $.call(i, 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
- T,
257
+ f,
258
258
  /* @__PURE__ */ l(
259
259
  "span",
260
260
  {
261
261
  className: "list-main",
262
- style: { marginLeft: T != 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: ca(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 Hs({ project: e, onOpen: n, getHref: a, slots: s, rowSlots: i }) {
283
283
  align: "right",
284
284
  link: !1,
285
285
  actions: !0,
286
- render: (p) => {
287
- var $, b;
288
- const T = ($ = i == null ? void 0 : i.footer) == null ? void 0 : $.call(i, 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: (I) => I.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(Sn, { resource: { kind: "document", key: p.key } }),
295
- p.shared ? (b = i == null ? void 0 : i.sharedActions) == null ? void 0 : b.call(i, p) : /* @__PURE__ */ l(q, { children: [
296
- /* @__PURE__ */ t(
297
- Je,
298
- {
299
- label: "Edit",
300
- onClick: () => u({ mode: "edit", d: p }),
301
- "data-testid": `document-edit-${p.id}`
302
- }
303
- ),
304
- /* @__PURE__ */ t(
305
- Vt,
306
- {
307
- label: "Delete",
308
- onClick: () => h(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
- T != null && /* @__PURE__ */ t("div", { className: "w6w-doc-footer", children: T })
325
+ f != null && /* @__PURE__ */ t("div", { className: "w6w-doc-footer", children: f })
316
326
  ] })
317
327
  );
318
328
  }
@@ -321,40 +331,47 @@ function Hs({ project: e, onOpen: n, getHref: a, slots: s, rowSlots: i }) {
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
- C,
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: () => u({ 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, T) => n(p.id, T) : 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
- m && /* @__PURE__ */ t(
352
- xn,
361
+ u && /* @__PURE__ */ t(
362
+ Kn,
353
363
  {
354
- initial: m.mode === "edit" ? m.d : void 0,
364
+ initial: u.mode === "edit" ? u.d : void 0,
355
365
  project: o,
356
- onClose: () => u(null),
357
- onSaved: () => u(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(
@@ -364,14 +381,14 @@ function Hs({ project: e, onOpen: n, getHref: a, slots: s, rowSlots: i }) {
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 }), h(null);
384
+ o != null && d.mutate({ id: g.id, project: o }), h(null);
368
385
  },
369
386
  onClose: () => h(null)
370
387
  }
371
388
  )
372
389
  ] });
373
390
  }
374
- const da = {
391
+ const ha = {
375
392
  workflow: "Workflow run",
376
393
  workflow_step: "Workflow step",
377
394
  connection_test: "Connection test",
@@ -383,7 +400,7 @@ const da = {
383
400
  action: "App action"
384
401
  };
385
402
  function be(e) {
386
- return da[e] ?? e;
403
+ return ha[e] ?? e;
387
404
  }
388
405
  const Ct = {
389
406
  workflow: "workflow",
@@ -394,13 +411,13 @@ const Ct = {
394
411
  endpoint: "base",
395
412
  action: "base"
396
413
  };
397
- function ua(e) {
414
+ function wa(e) {
398
415
  return Object.hasOwn(Ct, e);
399
416
  }
400
417
  function Tt(e) {
401
- return ua(e) ? Ct[e] : "base";
418
+ return wa(e) ? Ct[e] : "base";
402
419
  }
403
- function ma(e, n) {
420
+ function pa(e, n) {
404
421
  const a = /* @__PURE__ */ new Map();
405
422
  for (const i of e ?? []) {
406
423
  const o = i.displayName || i.key;
@@ -413,7 +430,7 @@ function ma(e, n) {
413
430
  }
414
431
  return { functions: a, workflows: s };
415
432
  }
416
- function ha(e, n) {
433
+ function fa(e, n) {
417
434
  const a = e.summary ?? be(e.kind), s = Tt(e.kind);
418
435
  if (s === "function" && e.functionId !== null) {
419
436
  const i = n.functions.get(e.functionId);
@@ -426,42 +443,42 @@ function ha(e, n) {
426
443
  return { text: i, target: { kind: "workflow", id: e.workflowId } };
427
444
  }
428
445
  if (s === "workflow_step") {
429
- const i = e.workflowId, o = i !== null ? n.workflows.get(i) : void 0, r = o ?? i ?? e.summary ?? "Unknown workflow", c = o !== void 0 && i !== null;
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: i } : null
449
+ target: d ? { kind: "workflow", id: i } : null
433
450
  };
434
451
  }
435
452
  return { text: a, target: null };
436
453
  }
437
- const me = (e) => String(e).padStart(2, "0");
454
+ const we = (e) => String(e).padStart(2, "0");
438
455
  function Et(e) {
439
456
  const n = new Date(e);
440
- return Number.isNaN(n.getTime()) ? e : `${`${n.getFullYear()}-${me(n.getMonth() + 1)}-${me(n.getDate())}`} ${me(n.getHours())}:${me(n.getMinutes())}:${me(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
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 wa() {
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 pa(e, n) {
466
+ function ga(e, n) {
450
467
  const a = new Date(e);
451
468
  if (Number.isNaN(a.getTime())) return e;
452
469
  const s = a.toLocaleDateString(void 0, { month: "short", day: "numeric" });
453
470
  return n === "week" ? `Week of ${s}` : s;
454
471
  }
455
- function Dt({ 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
@@ -470,131 +487,131 @@ function qe({
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: s.workflowRuns }),
474
- /* @__PURE__ */ t(De, { label: "Succeeded", value: s.succeeded }),
475
- /* @__PURE__ */ t(De, { label: "Failed", value: s.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 fa({
496
+ function va({
480
497
  entry: e,
481
498
  names: n,
482
499
  getHref: a,
483
500
  onOpen: s
484
501
  }) {
485
- const { text: i, target: o } = ha(e, n);
502
+ const { text: i, target: o } = fa(e, n);
486
503
  if (o === null) return /* @__PURE__ */ t(q, { children: i });
487
- const r = s ? (c) => s(o, c) : void 0;
504
+ const r = s ? (d) => s(o, d) : void 0;
488
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 $t({ entry: e, title: n }) {
507
+ function Dt({ entry: e, title: n }) {
491
508
  const a = It(e.durationMs);
492
509
  return /* @__PURE__ */ t(
493
510
  Le,
494
511
  {
495
- icon: /* @__PURE__ */ t(Dt, { ok: e.ok }),
512
+ icon: /* @__PURE__ */ t(At, { ok: e.ok }),
496
513
  title: n ?? e.summary ?? be(e.kind),
497
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($t, { entry: e.entry, title: /* @__PURE__ */ t(fa, { ...e }) });
519
+ function De(e) {
520
+ return /* @__PURE__ */ t(Dt, { entry: e.entry, title: /* @__PURE__ */ t(va, { ...e }) });
504
521
  }
505
- const ya = {
506
- base: (e) => /* @__PURE__ */ t($t, { 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 ga(e) {
512
- const n = ya[Tt(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 Ys({ getHref: e, onOpen: n, slots: a }) {
516
- var v, y, p, T, $, b;
517
- const s = je("today", { from: wa(), bucket: "day" }), i = je("week", { bucket: "week" }), o = ze(), r = nt(), c = le(
518
- () => ma(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
- ), m = s.error ?? i.error, u = m ? m.message : null, g = ((v = i.data) == null ? void 0 : v.recent) ?? [], h = ((y = i.data) == null ? void 0 : y.series) ?? [], C = ((p = i.data) == null ? void 0 : p.range.bucket) ?? "week", w = !i.isLoading && g.length === 0 && (((T = i.data) == null ? void 0 : T.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
- u && /* @__PURE__ */ t("div", { className: "error", children: u }),
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: ($ = s.data) == null ? void 0 : $.headline,
546
+ headline: (v = s.data) == null ? void 0 : v.headline,
530
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 = i.data) == null ? void 0 : b.headline,
554
+ headline: (f = i.data) == null ? void 0 : f.headline,
538
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: 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((I) => /* @__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: pa(I.bucket, C) }),
563
+ /* @__PURE__ */ t("strong", { children: ga(T.bucket, k) }),
547
564
  " ",
548
- /* @__PURE__ */ t("span", { className: "muted small", children: be(I.kind) })
565
+ /* @__PURE__ */ t("span", { className: "muted small", children: be(T.kind) })
549
566
  ] }),
550
567
  " ",
551
- /* @__PURE__ */ t(Dt, { ok: I.ok }),
568
+ /* @__PURE__ */ t(At, { ok: T.ok }),
552
569
  " ",
553
- /* @__PURE__ */ t("span", { className: "muted small", children: I.count })
554
- ] }, `${I.bucket}-${I.kind}-${String(I.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: 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((I) => /* @__PURE__ */ t(
559
- ga,
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: I,
562
- names: c,
578
+ entry: T,
579
+ names: d,
563
580
  getHref: e,
564
581
  onOpen: n
565
582
  },
566
- I.id
583
+ T.id
567
584
  )) }) })
568
585
  ] })
569
586
  ] });
570
587
  }
571
- function va(e) {
588
+ function ka(e) {
572
589
  return e !== null && "project" in e;
573
590
  }
574
- function ba(e) {
575
- const n = Me().project, [a, s] = f(Cn), i = e.scope !== void 0 ? e.scope : n ? { project: n } : null, o = e.filters !== void 0, r = e.filters ?? a, c = (m) => {
576
- var u;
577
- o || s(m), (u = e.onFiltersChange) == null || u.call(e, m);
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
- On,
597
+ jn,
581
598
  {
582
599
  scope: i,
583
- showKind: e.showKind ?? va(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 Na({ 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(ba, { ...n })
610
+ /* @__PURE__ */ t(Ca, { ...n })
594
611
  ] });
595
612
  }
596
- const zs = Na, ka = 1440 * 60 * 1e3;
597
- function Ca(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,29 +624,29 @@ function Ca(e) {
607
624
  link: n.link
608
625
  }));
609
626
  }
610
- function At(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 Ve(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) / ka));
636
+ return Number.isNaN(a) ? 0 : Math.max(0, Math.floor((n - a) / Ea));
620
637
  }
621
- function Ta(e, n) {
622
- if (!At(e) || e.startedAt === void 0) return null;
623
- const a = Ve(e.startedAt, n), s = _e(e.startedAt), i = a === 0 ? `open since ${s} (today)` : `open ${a}d (since ${s})`, o = e.updatedAt ?? e.startedAt, r = Ve(o, n), c = _e(o), m = r === 0 ? `last update ${c} (today)` : `last update ${c} (${r}d ago)`;
624
- return `${i} · ${m}`;
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 Ea(e) {
643
+ function Da(e) {
627
644
  return e ? Object.entries(e) : [];
628
645
  }
629
- function Ia(e) {
646
+ function $a(e) {
630
647
  return e.uptime.map((n) => ({ day: n.day, state: n.state }));
631
648
  }
632
- const re = [
649
+ const ce = [
633
650
  ["e4xx", "4xx"],
634
651
  ["e429", "429 rate-limited"],
635
652
  ["eAuth", "auth (401/403)"],
@@ -639,7 +656,7 @@ 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, {
@@ -656,7 +673,7 @@ function ge({ label: e, value: n, hint: a }) {
656
673
  a && /* @__PURE__ */ t("div", { className: "muted small", children: a })
657
674
  ] });
658
675
  }
659
- function Da({
676
+ function La({
660
677
  vendor: e,
661
678
  displayName: n
662
679
  }) {
@@ -673,7 +690,7 @@ function Da({
673
690
  ", not a gap in the data above."
674
691
  ] })
675
692
  ] });
676
- const a = e.state === "unknown", s = Ea(e.components), i = (e.timeline ?? []).filter(At), 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,
@@ -699,7 +716,7 @@ function Da({
699
716
  n,
700
717
  " says about itself, not what your calls did · last checked",
701
718
  " ",
702
- Oe(e.checkedAt),
719
+ Fe(e.checkedAt),
703
720
  e.attributedTo.length > 0 && /* @__PURE__ */ l(q, { children: [
704
721
  " ",
705
722
  "· decided by",
@@ -707,16 +724,16 @@ function Da({
707
724
  e.attributedTo.map((r) => /* @__PURE__ */ t("code", { children: r }, r))
708
725
  ] })
709
726
  ] }),
710
- s.length > 0 && /* @__PURE__ */ t("div", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: s.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
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
735
  /* @__PURE__ */ t(ve, { state: r.state }),
719
- /* @__PURE__ */ t("div", { className: "muted small", children: Ta(r, o) })
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,7 +741,7 @@ function Da({
724
741
  ] }) })
725
742
  ] });
726
743
  }
727
- function $a({ 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
747
  const n = e.uptime, a = Math.max(1, ...n.map((s) => s.calls));
@@ -749,17 +766,17 @@ function $a({ service: e }) {
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 Aa({
769
+ function Ma({
753
770
  service: e,
754
771
  window: n
755
772
  }) {
756
- const a = [...e.uptime].reverse().filter((r) => r.calls > 0), s = e.vendorStatus, i = Ca(s), o = i === 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
776
  Wt,
760
777
  {
761
778
  window: n,
762
- days: Ia(e),
779
+ days: $a(e),
763
780
  incidents: i,
764
781
  vendorEmptyLabel: o,
765
782
  ariaLabel: `${e.displayName}, ${e.uptime.length}-day status and ${e.displayName} incidents, oldest day first`
@@ -777,19 +794,19 @@ function Aa({
777
794
  r.calls,
778
795
  " calls"
779
796
  ] }),
780
- /* @__PURE__ */ t("span", { className: "rel-errors", children: re.filter(([c]) => r.errors[c] > 0).map(([c, m]) => /* @__PURE__ */ l("span", { className: "w6w-rel-tag", children: [
781
- m,
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: [
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 La({ errors: e }) {
789
- if (re.reduce((s, [i]) => s + e[i], 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, ...re.map(([s]) => e[s]));
792
- return /* @__PURE__ */ t("div", { className: "w6w-rel-card rel-errormix-chart", children: re.map(([s, i]) => /* @__PURE__ */ l("div", { className: "rel-errormix-row", children: [
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: [
793
810
  /* @__PURE__ */ t("span", { className: "muted small", children: i }),
794
811
  /* @__PURE__ */ t("span", { className: "rel-errormix-track", children: /* @__PURE__ */ t(
795
812
  "span",
@@ -801,12 +818,12 @@ function La({ errors: e }) {
801
818
  /* @__PURE__ */ t("span", { className: "rel-errormix-value small", children: e[s] })
802
819
  ] }, s)) });
803
820
  }
804
- function Sa({ project: e, appId: n }) {
805
- const a = $n(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
825
  const i = a.error;
809
- return /* @__PURE__ */ t("div", { className: "error", children: (i instanceof st, i.message) });
826
+ return /* @__PURE__ */ t("div", { className: "error", children: (i instanceof lt, i.message) });
810
827
  }
811
828
  const s = a.data ?? [];
812
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: [
@@ -818,7 +835,7 @@ function Sa({ project: e, appId: n }) {
818
835
  /* @__PURE__ */ t("span", { children: "Took" })
819
836
  ] }),
820
837
  s.map((i, o) => /* @__PURE__ */ l("div", { className: "rel-call", children: [
821
- /* @__PURE__ */ t("span", { className: "muted small", children: Oe(i.createdAt) }),
838
+ /* @__PURE__ */ t("span", { className: "muted small", children: Fe(i.createdAt) }),
822
839
  /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t("code", { children: i.actionKey ?? "—" }) }),
823
840
  /* @__PURE__ */ t("span", { className: "muted small", children: i.method }),
824
841
  /* @__PURE__ */ t("span", { className: i.status >= 400 || i.status === 0 ? "error" : "ok", children: i.status === 0 ? "no response" : i.status }),
@@ -826,13 +843,13 @@ function Sa({ project: e, appId: n }) {
826
843
  ] }, i.id ?? `${i.createdAt}-${o}`))
827
844
  ] });
828
845
  }
829
- function Ma({
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 Js({
852
+ function Xs({
836
853
  appId: e,
837
854
  project: n,
838
855
  days: a = 30,
@@ -840,22 +857,22 @@ function Js({
840
857
  onBack: i,
841
858
  slots: o
842
859
  }) {
843
- var C, w, v, y;
844
- const r = Me().project, c = (n === void 0 ? r : n) || void 0, m = Dn(c, [e], a), u = m.error, g = u ? (u instanceof st, u.message) : null, h = (C = m.data) == null ? void 0 : C.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 && m.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
851
- m.data && !h && /* @__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(Ma, { backHref: s, onBack: i })
875
+ /* @__PURE__ */ t(Pa, { backHref: s, onBack: i })
859
876
  ] }),
860
877
  h && /* @__PURE__ */ l(q, { children: [
861
878
  /* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
@@ -886,38 +903,38 @@ function Js({
886
903
  hint: h.p95Ms === null ? "no timed calls" : void 0
887
904
  }
888
905
  ),
889
- /* @__PURE__ */ t(ge, { label: "Last call", value: Oe(h.lastCallAt) }),
906
+ /* @__PURE__ */ t(ge, { label: "Last call", value: Fe(h.lastCallAt) }),
890
907
  /* @__PURE__ */ t(
891
908
  ge,
892
909
  {
893
910
  label: "Errors",
894
- value: String(re.reduce((p, [T]) => p + h.errors[T], 0)),
895
- hint: re.filter(([p]) => h.errors[p] > 0).map(([p, T]) => `${T} ×${h.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(La, { errors: h.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(Da, { vendor: h.vendorStatus, displayName: h.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: [
910
927
  "Last ",
911
- ((w = m.data) == null ? void 0 : w.window.days) ?? a,
928
+ ((w = u.data) == null ? void 0 : w.window.days) ?? a,
912
929
  " days",
913
930
  " ",
914
931
  /* @__PURE__ */ l("span", { className: "muted small", children: [
915
932
  "uptime means ",
916
- (v = m.data) == null ? void 0 : v.uptimeMeans
933
+ (b = u.data) == null ? void 0 : b.uptimeMeans
917
934
  ] })
918
935
  ] }),
919
- /* @__PURE__ */ t(Aa, { service: h, window: ((y = m.data) == null ? void 0 : y.window) ?? { from: "", to: "" } }),
920
- /* @__PURE__ */ t($a, { service: h })
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 Js({
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(Sa, { project: c, appId: h.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 xa(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,11 +956,11 @@ function xa(e) {
939
956
  }
940
957
  return String(e);
941
958
  }
942
- function Ra({
959
+ function Oa({
943
960
  routes: e,
944
961
  projectId: n
945
962
  }) {
946
- const [a, s] = f(null), i = e.find((o) => o.id === a);
963
+ const [a, s] = p(null), i = e.find((o) => o.id === a);
947
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" }),
@@ -966,7 +983,7 @@ function Ra({
966
983
  ] })
967
984
  ] }, o.id)) }),
968
985
  i != null && /* @__PURE__ */ t(
969
- Pa,
986
+ Fa,
970
987
  {
971
988
  routeId: i.id,
972
989
  projectId: i.project ?? n,
@@ -975,9 +992,9 @@ function Ra({
975
992
  )
976
993
  ] });
977
994
  }
978
- function Pa(e) {
995
+ function Fa(e) {
979
996
  return /* @__PURE__ */ l("div", { "data-testid": "connection-route-reconnect-host", children: [
980
- /* @__PURE__ */ t(jn, { 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
  }
@@ -988,16 +1005,16 @@ function St({
988
1005
  projectId: s
989
1006
  }) {
990
1007
  return /* @__PURE__ */ l(q, { children: [
991
- /* @__PURE__ */ t(Ra, { routes: a ?? [], projectId: s }),
992
- /* @__PURE__ */ t(Oa, { callables: e, onOpenCallable: n })
1008
+ /* @__PURE__ */ t(Oa, { routes: a ?? [], projectId: s }),
1009
+ /* @__PURE__ */ t(ja, { callables: e, onOpenCallable: n })
993
1010
  ] });
994
1011
  }
995
- function Oa({
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 s = a.displayName || a.key || a.id, i = a.sites.map(xa);
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
  " ",
@@ -1018,8 +1035,8 @@ function Oa({
1018
1035
  ] }, `${a.kind}:${a.id}`);
1019
1036
  }) });
1020
1037
  }
1021
- const Ka = [];
1022
- function Gs({
1038
+ const Qa = [];
1039
+ function ei({
1023
1040
  onOpen: e,
1024
1041
  getHref: n,
1025
1042
  addLabel: a,
@@ -1027,64 +1044,64 @@ function Gs({
1027
1044
  onOpenCallable: i,
1028
1045
  onCreateSharedCredential: o
1029
1046
  }) {
1030
- var R, x;
1031
- const r = Ge(), c = pe(), m = rt(), g = m.data ?? Ka, h = le(() => Ze(g), [g]), { byId: C } = at(h), w = ot(), [v, y] = f(!1), [p, T] = f(null), [$, b] = f(null), I = X(void 0), N = ct(($ == null ? void 0 : $.id) ?? "", $ !== null), j = 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" });
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
1051
  Bt,
1035
1052
  {
1036
1053
  connections: g,
1037
- appsById: C,
1038
- loading: m.isLoading,
1039
- error: m.error ? m.error.message : null,
1054
+ appsById: k,
1055
+ loading: u.isLoading,
1056
+ error: u.error ? u.error.message : null,
1040
1057
  onOpen: e,
1041
1058
  getHref: n,
1042
- onEdit: j ? T : void 0,
1043
- onDelete: b,
1059
+ onEdit: K ? I : void 0,
1060
+ onDelete: f,
1044
1061
  busy: w.isPending,
1045
1062
  slots: { ...s, actions: M }
1046
1063
  }
1047
1064
  ),
1048
- v && /* @__PURE__ */ t(
1065
+ b && /* @__PURE__ */ t(
1049
1066
  Ut,
1050
1067
  {
1051
1068
  onCreateSharedCredential: o,
1052
1069
  onClose: () => y(!1),
1053
1070
  onCreated: () => {
1054
- y(!1), c.invalidateQueries({ queryKey: we });
1071
+ y(!1), d.invalidateQueries({ queryKey: de });
1055
1072
  }
1056
1073
  }
1057
1074
  ),
1058
- p && /* @__PURE__ */ t(
1059
- Xe,
1075
+ E && /* @__PURE__ */ t(
1076
+ et,
1060
1077
  {
1061
- connection: p,
1062
- onClose: () => T(null),
1078
+ connection: E,
1079
+ onClose: () => I(null),
1063
1080
  onSaved: () => {
1064
- const P = p.id;
1065
- T(null), c.invalidateQueries({ queryKey: we }), c.invalidateQueries({ queryKey: dt(P) });
1081
+ const O = E.id;
1082
+ I(null), d.invalidateQueries({ queryKey: de }), d.invalidateQueries({ queryKey: Se(O) });
1066
1083
  }
1067
1084
  }
1068
1085
  ),
1069
- $ && /* @__PURE__ */ t(
1070
- Fa,
1086
+ v && /* @__PURE__ */ t(
1087
+ qa,
1071
1088
  {
1072
- name: $.displayName || $.id,
1089
+ name: v.displayName || v.id,
1073
1090
  loading: N.isLoading,
1074
1091
  callables: N.isError ? [] : ((R = N.data) == null ? void 0 : R.callables) ?? [],
1075
- routes: N.isError ? [] : ((x = N.data) == null ? void 0 : x.routes) ?? [],
1076
- projectId: I,
1092
+ routes: N.isError ? [] : ((F = N.data) == null ? void 0 : F.routes) ?? [],
1093
+ projectId: T,
1077
1094
  onOpenCallable: i,
1078
- onClose: () => b(null),
1095
+ onClose: () => f(null),
1079
1096
  onConfirm: () => {
1080
- const P = $.id;
1081
- b(null), w.mutate({ id: P, 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 Fa({
1104
+ function qa({
1088
1105
  name: e,
1089
1106
  loading: n,
1090
1107
  callables: a,
@@ -1092,14 +1109,14 @@ function Fa({
1092
1109
  projectId: i,
1093
1110
  onOpenCallable: o,
1094
1111
  onClose: r,
1095
- onConfirm: c
1112
+ onConfirm: d
1096
1113
  }) {
1097
- const m = a.length, u = s.length, g = m + u, h = `Delete the connection "${e}"? This cannot be undone.`, C = (y, p, T) => `${y} ${y === 1 ? p : T}`, w = [
1098
- m > 0 ? C(m, "callable", "callables") : null,
1099
- u > 0 ? C(u, "model route", "model routes") : null
1100
- ].filter(Boolean).join(" and "), v = [
1101
- m > 0 ? `Deleting disables ${m === 1 ? "this callable" : `these ${m} callables`} until you reconnect ${m === 1 ? "it" : "them"}.` : null,
1102
- u > 0 ? `${u === 1 ? "The model route becomes" : `The ${u} model routes become`} broken until ${u === 1 ? "it is" : "they are"} pointed at another connection.` : null
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 = [
1115
+ u > 0 ? k(u, "callable", "callables") : null,
1116
+ m > 0 ? k(m, "model route", "model routes") : null
1117
+ ].filter(Boolean).join(" and "), b = [
1118
+ u > 0 ? `Deleting disables ${u === 1 ? "this callable" : `these ${u} callables`} until you reconnect ${u === 1 ? "it" : "them"}.` : 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
1121
  return /* @__PURE__ */ l(Ht, { title: "Delete connection", onClose: r, children: [
1105
1122
  /* @__PURE__ */ l("div", { className: "w6w-modal-body", children: [
@@ -1114,7 +1131,7 @@ function Fa({
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,14 +1142,14 @@ function Fa({
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 Ae(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));
@@ -1144,259 +1161,278 @@ function Ae(e) {
1144
1161
  const o = Math.round(i / 24);
1145
1162
  return o < 30 ? `${o}d ago` : new Date(e).toLocaleDateString();
1146
1163
  }
1147
- const ja = {
1164
+ const _a = {
1148
1165
  ok: 6e3,
1149
1166
  warn: 1e4,
1150
1167
  error: 15e3
1151
- }, Qa = { ok: "✓", warn: "!", error: "✕" };
1152
- function Zs({
1168
+ }, Va = { ok: "✓", warn: "!", error: "✕" };
1169
+ function ti({
1153
1170
  connectionId: e,
1154
1171
  onOpenAction: n,
1155
1172
  onBack: a,
1156
1173
  onOpenCallable: s,
1157
1174
  slots: i
1158
1175
  }) {
1159
- var W;
1160
- const o = Ge(), r = pe(), c = Kn(e), m = (W = c.data) == null ? void 0 : W.appId, u = le(
1161
- () => Ze(c.data ? [c.data] : []),
1162
- [c.data]
1163
- ), { byId: g } = at(u), h = c.data ? Yt(c.data, g) : void 0, C = Qn(m, !!m), w = An(e), v = le(() => {
1164
- const k = /* @__PURE__ */ new Map();
1165
- for (const S of w.data ?? []) {
1166
- const K = k.get(S.actionKey) ?? [];
1167
- K.push(S), k.set(S.actionKey, K);
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 k;
1170
- }, [w.data]), y = ct(e).data, p = X(void 0), T = (y == null ? void 0 : y.callables) ?? [], $ = (y == null ? void 0 : y.routes) ?? [], b = Ln(e).data ?? [], [I, N] = f(!1), [j, M] = f(""), R = ut(e), [x, P] = f(null);
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);
1171
1193
  xt(() => {
1172
- if (!x) return;
1173
- const k = setTimeout(() => P(null), ja[x.kind]);
1174
- return () => clearTimeout(k);
1175
- }, [x]);
1176
- const V = () => {
1177
- P(null), R.mutate(void 0, {
1178
- onSuccess: (k) => {
1179
- var S;
1180
- if (!k.ok) {
1181
- P({
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${(S = k.error) != null && S.message ? `: ${k.error.message}` : "."}`
1205
+ text: `Connection test failed${(Q = C.error) != null && Q.message ? `: ${C.error.message}` : "."}`
1184
1206
  });
1185
1207
  return;
1186
1208
  }
1187
- P(
1188
- k.untested ? { kind: "warn", text: `Connection stored. ${k.message ?? ""}`.trim() } : {
1209
+ x(
1210
+ C.untested ? { kind: "warn", text: `Connection stored. ${C.message ?? ""}`.trim() } : {
1189
1211
  kind: "ok",
1190
- text: `Connection is valid${k.actionKey ? ` — probed ${k.actionKey}` : ""}.`
1212
+ text: `Connection is valid${C.actionKey ? ` — probed ${C.actionKey}` : ""}.`
1191
1213
  }
1192
1214
  );
1193
1215
  },
1194
- onError: (k) => P({ kind: "error", text: (k == null ? void 0 : k.message) ?? "Test failed." })
1216
+ onError: (C) => x({ kind: "error", text: (C == null ? void 0 : C.message) ?? "Test failed." })
1195
1217
  });
1196
- }, E = le(() => {
1197
- var S;
1198
- const k = [...((S = C.data) == null ? void 0 : S.actions) ?? []];
1199
- return k.sort((K, J) => (K.title || K.key).localeCompare(J.title || J.key)), k;
1200
- }, [C.data]), _ = le(() => {
1201
- const k = j.trim().toLowerCase();
1202
- return k ? E.filter(
1203
- (S) => (S.title || "").toLowerCase().includes(k) || S.key.toLowerCase().includes(k) || (S.description || "").toLowerCase().includes(k)
1204
- ) : E;
1205
- }, [E, j]);
1206
- if (c.isLoading || C.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
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 O = c.data, D = C.data, F = !O.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
- (i == null ? void 0 : i.header) ?? /* @__PURE__ */ l(zt, { conn: O, app: h, 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: V,
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
- F && /* @__PURE__ */ t(
1227
- Je,
1248
+ J && /* @__PURE__ */ t(
1249
+ Jt,
1228
1250
  {
1229
1251
  label: "Edit",
1230
- onClick: () => N(!0),
1252
+ onClick: () => F(!0),
1231
1253
  "data-testid": "connection-detail-edit"
1232
1254
  }
1233
1255
  ),
1234
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: Qa[x.kind] }),
1245
- /* @__PURE__ */ t("span", { className: "w6w-embed-conn-notice-text", children: x.text }),
1246
- /* @__PURE__ */ t(Jt, { icon: "close", label: "Dismiss", onClick: () => P(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
- (h == null ? void 0 : h.displayName) ?? O.appId
1275
+ (h == null ? void 0 : h.displayName) ?? U.appId
1254
1276
  ] }),
1255
- D && /* @__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
- D.version ?? "?"
1281
+ W.version ?? "?"
1260
1282
  ] }),
1261
1283
  " · source ",
1262
- /* @__PURE__ */ t("code", { children: D.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
- E.length === 0 && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No actions exposed." }),
1269
- E.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 ${E.length} actions…`,
1275
- onChange: (k) => M(k.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
- E.length > 0 && _.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: _.map((k) => {
1286
- const S = v.get(k.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-${k.key}`,
1294
- onClick: () => n(k.key),
1329
+ "data-testid": `connection-action-${C.key}`,
1330
+ onClick: () => n(C.key),
1295
1331
  children: [
1296
- /* @__PURE__ */ t("strong", { children: k.title }),
1332
+ /* @__PURE__ */ t("strong", { children: C.title }),
1297
1333
  " ",
1298
- /* @__PURE__ */ t("code", { className: "w6w-muted", children: k.key }),
1334
+ /* @__PURE__ */ t("code", { className: "w6w-muted", children: C.key }),
1299
1335
  " ",
1300
- /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: k.type }),
1301
- k.description && /* @__PURE__ */ t("div", { className: "w6w-muted w6w-small", children: k.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
- S.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 ${k.title || k.key}`,
1310
- children: S.map((K) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1345
+ "aria-label": `Saved tests for ${C.title || C.key}`,
1346
+ children: Q.map((c) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1311
1347
  Le,
1312
1348
  {
1313
- title: K.name,
1314
- subtitle: K.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: K.lastRunOk ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail",
1319
- children: K.lastRunOk ? "✓" : "✗"
1354
+ className: c.lastRunOk ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail",
1355
+ children: c.lastRunOk ? "✓" : "✗"
1320
1356
  }
1321
1357
  ),
1322
1358
  " ",
1323
- K.lastRunSummary ? `${K.lastRunSummary} · ` : "",
1324
- Ae(K.lastRunAt)
1325
- ] }) : `saved ${Ae(K.updatedAt)}`,
1326
- onClick: () => n(k.key, K.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
- ) }, K.id))
1364
+ ) }, c.id))
1329
1365
  }
1330
1366
  )
1331
- ] }, k.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
- T.length === 0 && $.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Not used by any callable" }) : /* @__PURE__ */ t(
1372
+ N.length === 0 && K.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Not used by any callable" }) : /* @__PURE__ */ t(
1337
1373
  St,
1338
1374
  {
1339
- callables: T,
1340
- routes: $,
1341
- projectId: p,
1375
+ callables: N,
1376
+ routes: K,
1377
+ projectId: T,
1342
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((k) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1385
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Recent runs", children: M.map((C) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1350
1386
  Le,
1351
1387
  {
1352
- title: k.actionKey,
1388
+ title: C.actionKey,
1353
1389
  subtitle: /* @__PURE__ */ l("span", { children: [
1354
- /* @__PURE__ */ t("span", { className: k.ok ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail", children: k.ok ? "✓" : "✗" }),
1390
+ /* @__PURE__ */ t("span", { className: C.ok ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail", children: C.ok ? "✓" : "✗" }),
1355
1391
  " ",
1356
- k.summary ? `${k.summary} · ` : "",
1357
- Ae(k.occurredAt)
1392
+ C.summary ? `${C.summary} · ` : "",
1393
+ $e(C.occurredAt)
1358
1394
  ] })
1359
1395
  }
1360
- ) }, k.id)) })
1396
+ ) }, C.id)) })
1361
1397
  ] }),
1362
- I && /* @__PURE__ */ t(
1363
- Xe,
1398
+ R && /* @__PURE__ */ t(
1399
+ et,
1364
1400
  {
1365
- connection: O,
1366
- onClose: () => N(!1),
1401
+ connection: U,
1402
+ onClose: () => F(!1),
1367
1403
  onSaved: () => {
1368
- N(!1), r.invalidateQueries({ queryKey: dt(e) }), r.invalidateQueries({ queryKey: we });
1404
+ F(!1), r.invalidateQueries({ queryKey: Se(e) }), r.invalidateQueries({ queryKey: de });
1369
1405
  }
1370
1406
  }
1371
1407
  )
1372
1408
  ] });
1373
1409
  }
1374
- const qa = {};
1375
- function We(e) {
1410
+ const Wa = {};
1411
+ function Ue(e) {
1376
1412
  return String(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1377
1413
  }
1378
- function he(e) {
1414
+ function pe(e) {
1379
1415
  return (e / 100).toFixed(2);
1380
1416
  }
1381
- function _a(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 ${he(n.input)}`), n.output != null && a.push(`out ${he(n.output)}`), n.cachedInput != null && a.push(`cached ${he(n.cachedInput)}`), n.cacheWrite != null && a.push(`cache write ${he(n.cacheWrite)}`), n.perRequest != null && a.push(`${he(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 Va(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
- We(n),
1426
+ Ue(n),
1391
1427
  " input"
1392
1428
  ] }),
1393
1429
  a != null && /* @__PURE__ */ l("span", { children: [
1394
- We(a),
1430
+ Ue(a),
1395
1431
  " output"
1396
1432
  ] })
1397
1433
  ] });
1398
1434
  }
1399
- const Wa = [
1435
+ const Ha = [
1400
1436
  {
1401
1437
  key: "model",
1402
1438
  header: "Model",
@@ -1418,7 +1454,7 @@ const Wa = [
1418
1454
  header: "Price / 1M tokens",
1419
1455
  width: "28%",
1420
1456
  render: (e) => {
1421
- const n = _a(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,16 +1469,16 @@ const Wa = [
1433
1469
  key: "limits",
1434
1470
  header: "Token limits",
1435
1471
  width: "24%",
1436
- render: (e) => /* @__PURE__ */ t("div", { className: "muted small", children: Va(e) })
1472
+ render: (e) => /* @__PURE__ */ t("div", { className: "muted small", children: Ua(e) })
1437
1473
  }
1438
1474
  ];
1439
- function Xs(e) {
1475
+ function ni(e) {
1440
1476
  var o;
1441
- const n = ce(), a = e.filter ?? qa, s = it({
1442
- queryKey: _n(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 }) => qn(n, r ? { ...a, cursor: r } : a)
1481
+ queryFn: ({ pageParam: r }) => Wn(n, r ? { ...a, cursor: r } : a)
1446
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: [
@@ -1452,11 +1488,11 @@ function Xs(e) {
1452
1488
  /* @__PURE__ */ l("div", { children: [
1453
1489
  s.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1454
1490
  s.error != null && /* @__PURE__ */ t("div", { className: "error", children: s.error.message }),
1455
- s.isSuccess && i.length === 0 && /* @__PURE__ */ t(xe, { testId: "model-catalog-empty", children: "No models yet. Discover them from a provider connection to start routing to them." }),
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." }),
1456
1492
  i.length > 0 && /* @__PURE__ */ t(
1457
- Re,
1493
+ Pe,
1458
1494
  {
1459
- columns: Wa,
1495
+ columns: Ha,
1460
1496
  className: "model-catalog-table",
1461
1497
  rows: i,
1462
1498
  rowKey: (r) => r.id,
@@ -1478,23 +1514,23 @@ function Xs(e) {
1478
1514
  ) })
1479
1515
  ] }) });
1480
1516
  }
1481
- const Ba = {};
1482
- function H(e) {
1517
+ const Ya = {};
1518
+ function z(e) {
1483
1519
  return String(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1484
1520
  }
1485
- function Ua(e) {
1521
+ function za(e) {
1486
1522
  return `${e.currency} ${(e.amountMinor / 100).toFixed(2)}`;
1487
1523
  }
1488
- function Ha(e, n) {
1489
- return e.length > 0 ? e.map(Ua).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 Ya(e) {
1527
+ function Ga(e) {
1492
1528
  return e.costMinor == null ? null : `${e.currency ?? "USD"} ${(e.costMinor / 100).toFixed(2)}`;
1493
1529
  }
1494
- function za(e) {
1530
+ function Za(e) {
1495
1531
  return e.totalsTruncated === !0;
1496
1532
  }
1497
- const Ja = [
1533
+ const Xa = [
1498
1534
  {
1499
1535
  key: "occurredAt",
1500
1536
  header: "When",
@@ -1525,8 +1561,8 @@ const Ja = [
1525
1561
  "span",
1526
1562
  {
1527
1563
  className: "muted small",
1528
- title: `${H(e.inputTokens)} in · ${H(e.outputTokens)} out · ${H(e.cachedInputTokens)} cached input · ${H(e.cacheWriteTokens)} cache write`,
1529
- children: H(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 Ja = [
1535
1571
  header: "Cost",
1536
1572
  align: "right",
1537
1573
  render: (e) => {
1538
- const n = Ya(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
  },
@@ -1554,19 +1590,19 @@ const Ja = [
1554
1590
  }
1555
1591
  }
1556
1592
  ];
1557
- function ei(e) {
1558
- var u, g;
1559
- const n = X(e.projectId), a = ce(), s = e.filter ?? Ba, i = it({
1560
- queryKey: Wn(n ?? void 0, s),
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
1599
  getNextPageParam: (h) => h.nextCursor ?? void 0,
1564
- queryFn: ({ pageParam: h }) => Vn(
1600
+ queryFn: ({ pageParam: h }) => Un(
1565
1601
  a,
1566
1602
  n,
1567
1603
  h ? { ...s, cursor: h } : s
1568
1604
  )
1569
- }), o = ((u = i.data) == null ? void 0 : u.pages) ?? [], r = (g = o[0]) == null ? void 0 : g.totals, c = o.flatMap((h) => h.items), m = o.length > 0 && za(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" }),
@@ -1574,31 +1610,31 @@ function ei(e) {
1574
1610
  ] }) }),
1575
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
- m && /* @__PURE__ */ t("p", { className: "result warn", "data-testid": "model-usage-totals-partial", children: "Totals are partial: they cover a bounded scan of this window, not every matching call. Narrow the range for exact totals." }),
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
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
- H(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
- H(r.totalTokens),
1624
+ z(r.totalTokens),
1589
1625
  " tokens (",
1590
- H(r.inputTokens),
1626
+ z(r.inputTokens),
1591
1627
  " in /",
1592
1628
  " ",
1593
- H(r.outputTokens),
1629
+ z(r.outputTokens),
1594
1630
  " out / ",
1595
- H(r.cachedInputTokens),
1631
+ z(r.cachedInputTokens),
1596
1632
  " cached / ",
1597
- H(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: Ha(r.cost, r.unpriced) }),
1637
+ /* @__PURE__ */ t("span", { "data-testid": "model-usage-total-cost", children: Ja(r.cost, r.unpriced) }),
1602
1638
  r.unpriced > 0 && /* @__PURE__ */ l(q, { children: [
1603
1639
  " · ",
1604
1640
  /* @__PURE__ */ l(
@@ -1608,7 +1644,7 @@ function ei(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
- H(r.unpriced),
1647
+ z(r.unpriced),
1612
1648
  " unpriced"
1613
1649
  ]
1614
1650
  }
@@ -1619,12 +1655,12 @@ function ei(e) {
1619
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
1657
  i.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1622
- i.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,
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: Ja,
1627
- rows: c,
1662
+ columns: Xa,
1663
+ rows: d,
1628
1664
  rowKey: (h) => h.id,
1629
1665
  testId: "model-usage-table",
1630
1666
  rowTestId: (h) => `model-usage-${h.id}`
@@ -1645,44 +1681,44 @@ function ei(e) {
1645
1681
  ] })
1646
1682
  ] }) });
1647
1683
  }
1648
- const Ga = (e) => `${e} connection${e === 1 ? "" : "s"}`;
1649
- function ti({ contract: e, onOpen: n, onCreate: a, slots: s }) {
1650
- const i = mt(e ? { contract: e } : void 0), o = ke(), r = (i.data ?? []).filter((u) => !u.private), c = (u) => {
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) => {
1651
1687
  var g, h;
1652
- return ((h = (g = o.data) == null ? void 0 : g.find((C) => C.id === u)) == null ? void 0 : h.label) ?? u;
1653
- }, m = a && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", onClick: a, children: "Add credential" });
1688
+ return ((h = (g = o.data) == null ? void 0 : g.find((k) => k.id === m)) == null ? void 0 : h.label) ?? m;
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
1692
  /* @__PURE__ */ t("div", { className: "w6w-connection-list-heading", children: (s == null ? void 0 : s.header) ?? /* @__PURE__ */ t("h2", { children: "Credentials" }) }),
1657
- m && /* @__PURE__ */ t("div", { className: "w6w-connection-list-actions", children: m })
1693
+ u && /* @__PURE__ */ t("div", { className: "w6w-connection-list-actions", children: u })
1658
1694
  ] }),
1659
1695
  i.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
1660
1696
  i.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: i.error.message }),
1661
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
- m
1699
+ u
1664
1700
  ] }) }),
1665
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Credentials", children: r.map((u) => {
1666
- const g = Object.values(u.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-${u.id}`,
1673
- onClick: () => n == null ? void 0 : n(u.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: u.name }),
1711
+ /* @__PURE__ */ t("strong", { children: m.name }),
1676
1712
  " ",
1677
- /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: u.status }),
1678
- /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", "data-testid": `credential-type-${u.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(u.contract)
1716
+ d(m.contract)
1681
1717
  ] }),
1682
- /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", "data-testid": `credential-scope-${u.id}`, children: [
1718
+ /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", "data-testid": `credential-scope-${m.id}`, children: [
1683
1719
  " ",
1684
1720
  "· ",
1685
- ht(u.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 ti({ contract: e, onOpen: n, onCreate: a, slots: s }) {
1690
1726
  ] }),
1691
1727
  /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", children: [
1692
1728
  " · ",
1693
- Ga(u.connectionCount)
1729
+ es(m.connectionCount)
1694
1730
  ] })
1695
1731
  ]
1696
1732
  }
1697
- ) }, u.id);
1733
+ ) }, m.id);
1698
1734
  }) })
1699
1735
  ] });
1700
1736
  }
@@ -1716,7 +1752,9 @@ 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
1759
  return i.multiline ? /* @__PURE__ */ l("label", { className: "w6w-field", children: [
1722
1760
  /* @__PURE__ */ t("span", { children: i.label }),
@@ -1727,7 +1765,7 @@ function Ce({
1727
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] ?? ""])), Za = [
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 ni({ onCreated: e, onCancel: n }) {
1739
- const a = yt(), [s, i] = f("account"), o = ke(), r = Un(), [c, m] = f(null), [u, g] = f(""), [h, C] = f({}), [w, v] = f(null), y = o.data ?? [], p = y.find((b) => b.id === c) ?? y[0], T = (b) => {
1740
- m(b), C({}), v(null);
1741
- }, $ = () => {
1742
- if (!p || r.isPending) return;
1743
- if (u.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, h)) {
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: u.trim(),
1754
- contract: p.id,
1755
- source: Ee(p.fields, h),
1789
+ b(null);
1790
+ const f = {
1791
+ name: m.trim(),
1792
+ contract: E.id,
1793
+ source: Ee(E.fields, h),
1756
1794
  ...a && s === "user" ? { accessScope: "user" } : {}
1757
1795
  };
1758
- C({}), r.mutate(b, {
1759
- onSuccess: (I) => {
1760
- r.reset(), e == null || e(I.id);
1796
+ k({}), r.mutate(f, {
1797
+ onSuccess: (T) => {
1798
+ r.reset(), e == null || e(T.id);
1761
1799
  },
1762
- onError: (I) => {
1763
- r.reset(), v(oe(I, "create"));
1800
+ onError: (T) => {
1801
+ r.reset(), b(ue(T, "create"));
1764
1802
  }
1765
1803
  });
1766
1804
  };
@@ -1768,12 +1806,12 @@ function ni({ 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(), $();
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 ni({ 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) => T(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 ni({ onCreated: e, onCancel: n }) {
1795
1833
  {
1796
1834
  type: "text",
1797
1835
  className: "w6w-input",
1798
- value: u,
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 ni({ onCreated: e, onCancel: n }) {
1811
1849
  "data-testid": "credential-owner",
1812
1850
  children: [
1813
1851
  /* @__PURE__ */ t("span", { children: "Who can use it" }),
1814
- Za.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: s === b.value,
1822
- onChange: () => i(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,
1876
+ fields: E.fields,
1839
1877
  values: h,
1840
- onChange: (b, I) => C((N) => ({ ...N, [b]: I })),
1878
+ onChange: (f, T) => k((N) => ({ ...N, [f]: T })),
1841
1879
  idPrefix: "w6w-cred-create"
1842
1880
  }
1843
1881
  ),
@@ -1851,8 +1889,8 @@ function ni({ onCreated: e, onCancel: n }) {
1851
1889
  )
1852
1890
  ] });
1853
1891
  }
1854
- const Be = "google-service-account.v1";
1855
- function Xa(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,73 +1898,73 @@ function Xa(e) {
1860
1898
  return null;
1861
1899
  }
1862
1900
  }
1863
- const Ue = (e) => Number.isNaN(Date.parse(e)) ? e : new Date(e).toLocaleString();
1864
- function ai(e) {
1865
- return /* @__PURE__ */ t(es, { ...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 es({
1905
+ function as({
1868
1906
  credentialId: e,
1869
1907
  onOpenConnection: n,
1870
1908
  onDeleted: a,
1871
1909
  onBack: s,
1872
1910
  slots: i
1873
1911
  }) {
1874
- var te, fe, de;
1875
- const o = Hn(e), r = Yn(e), c = wt(e), m = pt(e), u = zn(e), g = ft(), h = ke(), [C, w] = f(""), [v, y] = f({}), [p, T] = f(null), [$, b] = f(!1), [I, N] = f(null), [j, M] = f(null), [R, x] = f(!1), [P, V] = f(null), [E, _] = f(null), O = s && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: s, 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
1916
  const D = o.data;
1879
1917
  if (!D)
1880
1918
  return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-cred-detail", "data-testid": "credential-not-found", children: [
1881
1919
  (i == null ? void 0 : i.empty) ?? /* @__PURE__ */ t("h2", { children: "Credential not found" }),
1882
- O
1920
+ x
1883
1921
  ] });
1884
- const F = ((te = r.data) == null ? void 0 : te.connections) ?? [], W = D.connectionCount, k = D.status === "disabled", S = D.contract === Be || (fe = h.data) == null ? void 0 : fe.find((d) => d.id === D.contract), K = D.contract !== Be && h.isLoading, J = () => {
1885
- if (!S) return;
1886
- if (b(!1), !Te(S.fields, v)) {
1887
- T("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
- T(null);
1891
- const d = Ee(S.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
1936
  onError: (L) => {
1899
- c.reset(), T(oe(L, "rotate"));
1937
+ d.reset(), I(ue(L, "rotate"));
1900
1938
  }
1901
1939
  }
1902
1940
  );
1903
- }, A = () => {
1904
- b(!1);
1905
- const d = Xa(C);
1906
- if (!d) {
1907
- T("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
- T(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: (L) => T(ee(L) ?? (L == null ? void 0 : L.message) ?? "Rotate failed.")
1954
+ onError: (L) => I(ae(L) ?? (L == null ? void 0 : L.message) ?? "Rotate failed.")
1917
1955
  }
1918
1956
  );
1919
- }, Q = () => {
1920
- N(null), M(null), u.mutate(void 0, {
1957
+ }, j = () => {
1958
+ N(null), M(null), m.mutate(void 0, {
1921
1959
  onSuccess: N,
1922
- onError: (d) => M(ee(d) ?? (d == null ? void 0 : d.message) ?? "Test failed.")
1960
+ onError: (c) => M(ae(c) ?? (c == null ? void 0 : c.message) ?? "Test failed.")
1923
1961
  });
1924
- }, G = () => {
1925
- _(null), g.mutate(e, {
1926
- onSuccess: (d) => {
1927
- x(!1), d.ok ? a == null || a() : V(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) => _(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: [
@@ -1941,60 +1979,61 @@ function es({
1941
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(D.display).map(([d, L]) => /* @__PURE__ */ l("div", { children: [
1945
- /* @__PURE__ */ t("dt", { className: "w6w-muted", children: 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 }),
1946
1984
  /* @__PURE__ */ t("dd", { children: L })
1947
- ] }, d)) }),
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
- Ue(D.createdAt),
1991
+ Ye(D.createdAt),
1954
1992
  " · updated",
1955
1993
  " ",
1956
- Ue(D.updatedAt)
1994
+ Ye(D.updatedAt)
1957
1995
  ] }),
1958
- O
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
- F.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: F.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
- K && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
1981
- S && /* @__PURE__ */ t(
2018
+ J && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
2019
+ W && /* @__PURE__ */ t(
1982
2020
  Ce,
1983
2021
  {
1984
- fields: S.fields,
1985
- values: v,
1986
- onChange: (d, L) => y((B) => ({ ...B, [d]: L })),
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
- !K && !S && /* @__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
- value: C,
1997
- onChange: (d) => w(d.target.value),
2035
+ value: k,
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 es({
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
- $ && /* @__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 || K,
2017
- onClick: S ? J : A,
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
  ] }),
@@ -2027,9 +2066,9 @@ function es({
2027
2066
  {
2028
2067
  type: "button",
2029
2068
  className: "w6w-btn w6w-btn-ghost",
2030
- disabled: m.isPending,
2031
- onClick: () => m.mutate(k ? "active" : "disabled"),
2032
- children: k ? "Enable" : "Disable"
2069
+ disabled: u.isPending,
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 es({
2037
2076
  {
2038
2077
  type: "button",
2039
2078
  className: "w6w-btn w6w-btn-ghost",
2040
- disabled: u.isPending,
2041
- onClick: Q,
2042
- children: u.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,15 +2087,15 @@ function es({
2048
2087
  type: "button",
2049
2088
  className: "w6w-btn w6w-btn-danger",
2050
2089
  onClick: () => {
2051
- V(null), x(!0);
2090
+ _(null), F(!0);
2052
2091
  },
2053
2092
  children: "Delete"
2054
2093
  }
2055
2094
  )
2056
2095
  ] }),
2057
- I && /* @__PURE__ */ t("output", { "data-testid": "credential-test-result", children: I.ok ? "ok" : I.code ?? "failed" }),
2058
- j && /* @__PURE__ */ t("p", { role: "alert", children: j }),
2059
- m.isError && /* @__PURE__ */ t("p", { role: "alert", children: ee(m.error) ?? ((de = m.error) == null ? void 0 : de.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 "',
@@ -2069,7 +2108,7 @@ function es({
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,36 +2118,36 @@ function es({
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
- P && /* @__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
- P.length,
2129
+ O.length,
2091
2130
  " connection",
2092
- P.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: P.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
- E && /* @__PURE__ */ t("p", { role: "alert", children: E })
2136
+ A && /* @__PURE__ */ t("p", { role: "alert", children: A })
2098
2137
  ] })
2099
2138
  ] });
2100
2139
  }
2101
- const ts = "Keys that only you can use are not turned on for this account.", ns = "Models that only your personal key can see are not added to the account's catalog.", as = "This provider is not supported for personal keys.", ss = "Could not save the key. Nothing was kept.", is = "Could not save the key, and a partial copy could not be removed. Remove it under Shared credentials.", He = "The key was removed, but its stored copy was not.";
2102
- function ls(e) {
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) {
2103
2142
  var s;
2104
2143
  const n = e ?? {}, a = Array.isArray(n.accepts) ? n.accepts : (s = n.serviceAccount) == null ? void 0 : s.accepts;
2105
2144
  return Array.isArray(a) ? a.filter((i) => typeof i == "string") : [];
2106
2145
  }
2107
- function rs(e, n) {
2146
+ function ds(e, n) {
2108
2147
  for (const a of e ?? []) {
2109
2148
  const s = a;
2110
2149
  if (s.type === "oauth2" || typeof s.key != "string") continue;
2111
- const i = ls(a).find((o) => n.some((r) => r.id === o));
2150
+ const i = cs(a).find((o) => n.some((r) => r.id === o));
2112
2151
  if (i) return { authKey: s.key, contract: i };
2113
2152
  }
2114
2153
  return null;
@@ -2125,15 +2164,15 @@ function Mt(e) {
2125
2164
  }));
2126
2165
  return a.length > 0 ? a : null;
2127
2166
  }
2128
- function os(e) {
2167
+ function us(e) {
2129
2168
  for (const n of e ?? []) {
2130
2169
  const a = n.key, s = Mt(n);
2131
2170
  if (typeof a == "string" && s) return { authKey: a, fields: s };
2132
2171
  }
2133
2172
  return null;
2134
2173
  }
2135
- function cs(e, n, a) {
2136
- const s = ce(), i = lt({
2174
+ function ms(e, n, a) {
2175
+ const s = me(), i = Ke({
2137
2176
  queryKey: ["app-auth", e],
2138
2177
  queryFn: () => s.console.apps.getAuth(e),
2139
2178
  enabled: a,
@@ -2141,99 +2180,99 @@ function cs(e, n, a) {
2141
2180
  });
2142
2181
  return Mt((i.data ?? []).find((o) => o.key === n));
2143
2182
  }
2144
- const ie = (e) => e.provider ?? e.appId;
2145
- function si({ providerAppId: e }) {
2146
- const n = yt(), a = Bn(), s = rt(), i = mt({ accessScope: "user" }), o = Xn(n), r = ke(), c = (a.data ?? []).filter((w) => w.designation), m = new Map((i.data ?? []).map((w) => [w.id, w])), u = (s.data ?? []).filter(
2147
- (w) => w.accessScope === "user" && w.credentialId && (m.has(w.credentialId) || i.data !== void 0)
2148
- ), g = o.data ?? [], [h, C] = f(null);
2183
+ const re = (e) => e.provider ?? e.appId;
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);
2149
2188
  return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-ai-keys w6w-card-stack", "data-testid": "my-ai-keys", children: [
2150
2189
  /* @__PURE__ */ t("h2", { children: "My AI keys" }),
2151
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." }),
2152
- /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", "data-testid": "ai-keys-private-note", children: ns }),
2153
- !n && /* @__PURE__ */ t("output", { className: "w6w-muted", "data-testid": "ai-keys-disabled", children: ts }),
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 }),
2154
2193
  (a.isLoading || s.isLoading || i.isLoading) && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
2155
2194
  a.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: "Could not load the AI providers." }),
2156
- n && c.length > 0 && /* @__PURE__ */ t(ds, { providers: c, initial: e, types: r.data ?? [] }),
2157
- !a.isLoading && !a.error && c.length === 0 && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No AI providers are available." }),
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." }),
2158
2197
  h && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "ai-keys-notice", children: h }),
2159
- c.map((w) => {
2160
- const v = u.filter((y) => y.appId === w.appId);
2161
- return v.length === 0 ? null : /* @__PURE__ */ t(
2162
- us,
2198
+ d.map((w) => {
2199
+ const b = m.filter((y) => y.appId === w.appId);
2200
+ return b.length === 0 ? null : /* @__PURE__ */ t(
2201
+ ws,
2163
2202
  {
2164
2203
  provider: w,
2165
- keys: v,
2166
- creds: m,
2204
+ keys: b,
2205
+ creds: u,
2167
2206
  current: g.find((y) => y.providerAppId === w.appId),
2168
2207
  types: r.data ?? [],
2169
- onNotice: C
2208
+ onNotice: k
2170
2209
  },
2171
2210
  w.appId
2172
2211
  );
2173
2212
  })
2174
2213
  ] });
2175
2214
  }
2176
- function ds({
2215
+ function hs({
2177
2216
  providers: e,
2178
2217
  initial: n,
2179
2218
  types: a
2180
2219
  }) {
2181
- var P, V;
2182
- const s = ce(), i = pe(), [o, r] = f(n), c = ((P = e.find((E) => E.appId === o)) == null ? void 0 : P.appId) ?? ((V = e[0]) == null ? void 0 : V.appId) ?? "", m = e.find((E) => E.appId === c), [u, g] = f(""), [h, C] = f({}), [w, v] = f(null), [y, p] = f(!1), [T, $] = f(!1), b = lt({
2183
- queryKey: ["app-auth", c],
2184
- queryFn: () => s.console.apps.getAuth(c),
2185
- 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 !== "",
2186
2225
  retry: !1
2187
- }), I = rs(b.data, a), N = I ? a.find((E) => E.id === I.contract) : void 0, j = N ? null : os(b.data), M = (N == null ? void 0 : N.fields) ?? (j == null ? void 0 : j.fields), R = (E) => {
2188
- r(E), C({}), v(null), $(!1);
2189
- }, x = async () => {
2190
- if (!m || !M || y) return;
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;
2191
2230
  if (!Te(M, h)) {
2192
- v("Fill in every field.");
2231
+ b("Fill in every field.");
2193
2232
  return;
2194
2233
  }
2195
- v(null), $(!1);
2196
- const E = Ee(M, h);
2197
- if (C({}), p(!0), !I || !N) {
2198
- if (!j) return p(!1);
2234
+ b(null), v(!1);
2235
+ const A = Ee(M, h);
2236
+ if (k({}), E(!0), !T || !N) {
2237
+ if (!K) return E(!1);
2199
2238
  try {
2200
- await Qe(s, c, {
2201
- authKey: j.authKey,
2202
- credential: E,
2203
- displayName: u.trim() || `My ${ie(m)} key`,
2239
+ await _e(s, d, {
2240
+ authKey: K.authKey,
2241
+ credential: A,
2242
+ displayName: m.trim() || `My ${re(u)} key`,
2204
2243
  accessScope: "user"
2205
- }), g(""), $(!0);
2206
- } catch (O) {
2207
- v(oe(O, "create"));
2244
+ }), g(""), v(!0);
2245
+ } catch (x) {
2246
+ b(ue(x, "create"));
2208
2247
  } finally {
2209
- p(!1), i.invalidateQueries({ queryKey: we });
2248
+ E(!1), i.invalidateQueries({ queryKey: de });
2210
2249
  }
2211
2250
  return;
2212
2251
  }
2213
- let _ = null;
2252
+ let P = null;
2214
2253
  try {
2215
- const O = await Jn(s, {
2216
- name: u.trim() || `My ${ie(m)} key`,
2217
- contract: I.contract,
2218
- source: E,
2254
+ const x = await Xn(s, {
2255
+ name: m.trim() || `My ${re(u)} key`,
2256
+ contract: T.contract,
2257
+ source: A,
2219
2258
  accessScope: "user"
2220
2259
  });
2221
- _ = O.id, await Qe(s, c, {
2222
- authKey: I.authKey,
2223
- credentialId: O.id,
2260
+ P = x.id, await _e(s, d, {
2261
+ authKey: T.authKey,
2262
+ credentialId: x.id,
2224
2263
  accessScope: "user"
2225
- }), g(""), $(!0);
2226
- } catch (O) {
2227
- if (_) {
2228
- const D = await Gn(s, _).then(
2229
- (F) => F.ok,
2264
+ }), g(""), v(!0);
2265
+ } catch (x) {
2266
+ if (P) {
2267
+ const D = await ea(s, P).then(
2268
+ (S) => S.ok,
2230
2269
  () => !1
2231
2270
  );
2232
- v(D ? ee(O) ?? ss : is);
2271
+ b(D ? ae(x) ?? rs : os);
2233
2272
  } else
2234
- v(oe(O, "create"));
2273
+ b(ue(x, "create"));
2235
2274
  } finally {
2236
- p(!1), i.invalidateQueries({ queryKey: Zn }), i.invalidateQueries({ queryKey: we });
2275
+ E(!1), i.invalidateQueries({ queryKey: ta }), i.invalidateQueries({ queryKey: de });
2237
2276
  }
2238
2277
  };
2239
2278
  return /* @__PURE__ */ l(
@@ -2241,17 +2280,17 @@ function ds({
2241
2280
  {
2242
2281
  className: "w6w-embed-conn-card w6w-card-stack",
2243
2282
  "data-testid": "ai-key-add",
2244
- onSubmit: (E) => {
2245
- E.preventDefault(), x();
2283
+ onSubmit: (A) => {
2284
+ A.preventDefault(), F();
2246
2285
  },
2247
2286
  children: [
2248
2287
  /* @__PURE__ */ t("h3", { children: "Add a key" }),
2249
2288
  /* @__PURE__ */ l("label", { className: "w6w-field", children: [
2250
2289
  /* @__PURE__ */ t("span", { children: "Provider" }),
2251
- /* @__PURE__ */ t("select", { value: c, "aria-label": "Provider", onChange: (E) => R(E.target.value), children: e.map((E) => /* @__PURE__ */ t("option", { value: E.appId, children: ie(E) }, E.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)) })
2252
2291
  ] }),
2253
- b.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
2254
- !b.isLoading && !M && /* @__PURE__ */ t("p", { className: "w6w-muted", "data-testid": "ai-key-unsupported", children: as }),
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 }),
2255
2294
  M && /* @__PURE__ */ l(q, { children: [
2256
2295
  /* @__PURE__ */ l("label", { className: "w6w-field", children: [
2257
2296
  /* @__PURE__ */ t("span", { children: "Name" }),
@@ -2260,9 +2299,9 @@ function ds({
2260
2299
  {
2261
2300
  type: "text",
2262
2301
  className: "w6w-input",
2263
- value: u,
2264
- placeholder: m ? `My ${ie(m)} key` : "",
2265
- onChange: (E) => g(E.target.value),
2302
+ value: m,
2303
+ placeholder: u ? `My ${re(u)} key` : "",
2304
+ onChange: (A) => g(A.target.value),
2266
2305
  maxLength: 120,
2267
2306
  autoComplete: "off"
2268
2307
  }
@@ -2273,19 +2312,19 @@ function ds({
2273
2312
  {
2274
2313
  fields: M,
2275
2314
  values: h,
2276
- onChange: (E, _) => C((O) => ({ ...O, [E]: _ })),
2315
+ onChange: (A, P) => k((x) => ({ ...x, [A]: P })),
2277
2316
  idPrefix: "w6w-ai-key-add"
2278
2317
  }
2279
2318
  ),
2280
2319
  w && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "ai-key-add-error", children: w }),
2281
- T && /* @__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." }),
2282
2321
  /* @__PURE__ */ t("div", { className: "w6w-modal-actions", children: /* @__PURE__ */ t("button", { type: "submit", className: "w6w-btn", disabled: y, children: y ? "Saving…" : "Save key" }) })
2283
2322
  ] })
2284
2323
  ]
2285
2324
  }
2286
2325
  );
2287
2326
  }
2288
- function us({
2327
+ function ws({
2289
2328
  provider: e,
2290
2329
  keys: n,
2291
2330
  creds: a,
@@ -2293,29 +2332,29 @@ function us({
2293
2332
  types: i,
2294
2333
  onNotice: o
2295
2334
  }) {
2296
- const r = ea(), c = ta(), [m, u] = f(null), g = e.appId, h = s && n.some((w) => w.id === s.connectionId) ? s : void 0, C = (w) => {
2297
- u(null);
2298
- const v = {
2299
- onError: (y) => u(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.")
2300
2339
  };
2301
- 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);
2302
2341
  };
2303
2342
  return /* @__PURE__ */ l("section", { className: "w6w-embed-conn-card w6w-card-stack", "data-testid": `ai-provider-${g}`, children: [
2304
- /* @__PURE__ */ t("h3", { children: ie(e) }),
2305
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": `${ie(e)} keys`, children: n.map((w) => {
2306
- const v = a.get(w.credentialId);
2343
+ /* @__PURE__ */ t("h3", { children: re(e) }),
2344
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": `${re(e)} keys`, children: n.map((w) => {
2345
+ const b = a.get(w.credentialId);
2307
2346
  return /* @__PURE__ */ t(
2308
- ms,
2347
+ ps,
2309
2348
  {
2310
2349
  connection: w,
2311
- credential: v,
2312
- descriptor: v ? i.find((y) => y.id === v.contract) : void 0,
2350
+ credential: b,
2351
+ descriptor: b ? i.find((y) => y.id === b.contract) : void 0,
2313
2352
  onNotice: o
2314
2353
  },
2315
2354
  w.id
2316
2355
  );
2317
2356
  }) }),
2318
- /* @__PURE__ */ l("div", { role: "radiogroup", "aria-label": `Default key for ${ie(e)}`, children: [
2357
+ /* @__PURE__ */ l("div", { role: "radiogroup", "aria-label": `Default key for ${re(e)}`, children: [
2319
2358
  /* @__PURE__ */ t("span", { className: "w6w-small", children: "Default key" }),
2320
2359
  /* @__PURE__ */ l("label", { className: "w6w-radio", children: [
2321
2360
  /* @__PURE__ */ t(
@@ -2325,7 +2364,7 @@ function us({
2325
2364
  name: `ai-default-${g}`,
2326
2365
  checked: !h,
2327
2366
  onChange: () => {
2328
- h && C(null);
2367
+ h && k(null);
2329
2368
  }
2330
2369
  }
2331
2370
  ),
@@ -2340,7 +2379,7 @@ function us({
2340
2379
  name: `ai-default-${g}`,
2341
2380
  "data-testid": `ai-default-${w.id}`,
2342
2381
  checked: (h == null ? void 0 : h.connectionId) === w.id,
2343
- onChange: () => C(w.id)
2382
+ onChange: () => k(w.id)
2344
2383
  }
2345
2384
  ),
2346
2385
  " ",
@@ -2348,37 +2387,37 @@ function us({
2348
2387
  ] }, w.id))
2349
2388
  ] }),
2350
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." }),
2351
- m && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: m })
2390
+ u && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: u })
2352
2391
  ] });
2353
2392
  }
2354
- function ms({
2393
+ function ps({
2355
2394
  connection: e,
2356
2395
  credential: n,
2357
2396
  descriptor: a,
2358
2397
  onNotice: s
2359
2398
  }) {
2360
- const i = ut(e.id), o = wt((n == null ? void 0 : n.id) ?? ""), r = pt((n == null ? void 0 : n.id) ?? ""), c = Fn(e.id), m = cs(e.appId, e.authKey, !n), u = n ? a == null ? void 0 : a.fields : m ?? void 0, g = ot(), h = ft(), [C, w] = f(!1), [v, y] = f({}), [p, T] = f(!1), [$, b] = f(null), [I, N] = f(null), [j, M] = f(null), R = (n == null ? void 0 : n.status) === "disabled", x = n ? Object.values(n.display)[0] : void 0, P = n ? o.isPending : c.isPending, V = (D, F) => N(ee(D) ?? F), E = () => {
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 = () => {
2361
2400
  M(null), N(null), i.mutate(void 0, {
2362
2401
  onSuccess: (D) => M(D.ok ? "ok" : "failed"),
2363
- onError: (D) => V(D, "Could not test the key.")
2402
+ onError: (D) => _(D, "Could not test the key.")
2364
2403
  });
2365
- }, _ = () => {
2366
- if (!u) return;
2367
- if (b(null), !Te(u, v)) {
2404
+ }, P = () => {
2405
+ if (!m) return;
2406
+ if (f(null), !Te(m, b)) {
2368
2407
  N("Fill in every field.");
2369
2408
  return;
2370
2409
  }
2371
2410
  N(null);
2372
- const D = Ee(u, v);
2411
+ const D = Ee(m, b);
2373
2412
  if (y({}), !n) {
2374
- c.mutate(
2413
+ d.mutate(
2375
2414
  { credential: D },
2376
2415
  {
2377
2416
  onSuccess: () => {
2378
- c.reset(), w(!1), b("Key replaced.");
2417
+ d.reset(), w(!1), f("Key replaced.");
2379
2418
  },
2380
- onError: (F) => {
2381
- c.reset(), N(oe(F, "rotate"));
2419
+ onError: (S) => {
2420
+ d.reset(), N(ue(S, "rotate"));
2382
2421
  }
2383
2422
  }
2384
2423
  );
@@ -2388,31 +2427,31 @@ function ms({
2388
2427
  { source: D },
2389
2428
  {
2390
2429
  onSuccess: () => {
2391
- o.reset(), w(!1), b("Key replaced.");
2430
+ o.reset(), w(!1), f("Key replaced.");
2392
2431
  },
2393
- onError: (F) => {
2394
- o.reset(), N(oe(F, "rotate"));
2432
+ onError: (S) => {
2433
+ o.reset(), N(ue(S, "rotate"));
2395
2434
  }
2396
2435
  }
2397
2436
  );
2398
- }, O = () => {
2437
+ }, x = () => {
2399
2438
  N(null), s(null), g.mutate(
2400
2439
  { id: e.id },
2401
2440
  {
2402
2441
  onSuccess: (D) => {
2403
2442
  if (!D.ok) {
2404
- T(!1), N("This key is still in use. Remove what uses it first.");
2443
+ I(!1), N("This key is still in use. Remove what uses it first.");
2405
2444
  return;
2406
2445
  }
2407
2446
  n && h.mutate(n.id, {
2408
- onSuccess: (F) => {
2409
- F.ok || s(He);
2447
+ onSuccess: (S) => {
2448
+ S.ok || s(ze);
2410
2449
  },
2411
- onError: (F) => s(ee(F) ?? He)
2450
+ onError: (S) => s(ae(S) ?? ze)
2412
2451
  });
2413
2452
  },
2414
2453
  onError: (D) => {
2415
- T(!1), V(D, "Could not remove the key.");
2454
+ I(!1), _(D, "Could not remove the key.");
2416
2455
  }
2417
2456
  }
2418
2457
  );
@@ -2422,9 +2461,9 @@ function ms({
2422
2461
  /* @__PURE__ */ t("strong", { children: e.displayName }),
2423
2462
  " ",
2424
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 }),
2425
- x !== void 0 && /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", "data-testid": `ai-key-display-${e.id}`, children: [
2464
+ F !== void 0 && /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", "data-testid": `ai-key-display-${e.id}`, children: [
2426
2465
  " ",
2427
- x
2466
+ F
2428
2467
  ] })
2429
2468
  ] }),
2430
2469
  /* @__PURE__ */ l("div", { className: "w6w-modal-actions", children: [
@@ -2434,11 +2473,11 @@ function ms({
2434
2473
  type: "button",
2435
2474
  className: "w6w-btn w6w-btn-ghost",
2436
2475
  disabled: i.isPending,
2437
- onClick: E,
2476
+ onClick: A,
2438
2477
  children: i.isPending ? "Testing…" : "Test"
2439
2478
  }
2440
2479
  ),
2441
- u && /* @__PURE__ */ t(
2480
+ m && /* @__PURE__ */ t(
2442
2481
  "button",
2443
2482
  {
2444
2483
  type: "button",
@@ -2454,7 +2493,7 @@ function ms({
2454
2493
  className: "w6w-btn w6w-btn-ghost",
2455
2494
  disabled: r.isPending,
2456
2495
  onClick: () => r.mutate(R ? "active" : "disabled", {
2457
- onError: (D) => V(D, "Could not change the key's status.")
2496
+ onError: (D) => _(D, "Could not change the key's status.")
2458
2497
  }),
2459
2498
  children: R ? "Enable" : "Disable"
2460
2499
  }
@@ -2464,25 +2503,25 @@ function ms({
2464
2503
  {
2465
2504
  type: "button",
2466
2505
  className: "w6w-btn w6w-btn-danger",
2467
- onClick: () => T(!0),
2506
+ onClick: () => I(!0),
2468
2507
  children: "Remove"
2469
2508
  }
2470
2509
  )
2471
2510
  ] }),
2472
- j && /* @__PURE__ */ t("output", { "data-testid": `ai-key-test-${e.id}`, children: j === "ok" ? "Test passed" : "Test failed" }),
2473
- C && u && /* @__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: [
2474
2513
  /* @__PURE__ */ t(
2475
2514
  Ce,
2476
2515
  {
2477
- fields: u,
2478
- values: v,
2479
- onChange: (D, F) => y((W) => ({ ...W, [D]: F })),
2516
+ fields: m,
2517
+ values: b,
2518
+ onChange: (D, S) => y((V) => ({ ...V, [D]: S })),
2480
2519
  idPrefix: `w6w-ai-key-replace-${e.id}`
2481
2520
  }
2482
2521
  ),
2483
- /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", disabled: P, onClick: _, children: P ? "Replacing…" : "Save new key" })
2522
+ /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", disabled: O, onClick: P, children: O ? "Replacing…" : "Save new key" })
2484
2523
  ] }),
2485
- p && /* @__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: [
2486
2525
  /* @__PURE__ */ l("p", { className: "w6w-small", children: [
2487
2526
  'Remove "',
2488
2527
  e.displayName,
@@ -2494,7 +2533,7 @@ function ms({
2494
2533
  type: "button",
2495
2534
  className: "w6w-btn w6w-btn-danger",
2496
2535
  disabled: g.isPending,
2497
- onClick: O,
2536
+ onClick: x,
2498
2537
  children: "Confirm remove"
2499
2538
  }
2500
2539
  ),
@@ -2504,145 +2543,145 @@ function ms({
2504
2543
  {
2505
2544
  type: "button",
2506
2545
  className: "w6w-btn w6w-btn-ghost",
2507
- onClick: () => T(!1),
2546
+ onClick: () => I(!1),
2508
2547
  children: "Cancel"
2509
2548
  }
2510
2549
  )
2511
2550
  ] }),
2512
- $ && /* @__PURE__ */ t("output", { children: $ }),
2513
- I && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: I })
2551
+ v && /* @__PURE__ */ t("output", { children: v }),
2552
+ T && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: T })
2514
2553
  ] });
2515
2554
  }
2516
- function Y(e) {
2517
- const n = Gt(e), a = e == null ? void 0 : e.code;
2555
+ function G(e) {
2556
+ const n = en(e), a = e == null ? void 0 : e.code;
2518
2557
  return n.code === void 0 && typeof a == "string" && a !== "" ? { ...n, code: a } : n;
2519
2558
  }
2520
- const Ye = 80;
2521
- function hs(e, n) {
2559
+ const Je = 80;
2560
+ function fs(e, n) {
2522
2561
  if (typeof URL > "u" || typeof URL.createObjectURL != "function") return;
2523
2562
  const a = URL.createObjectURL(new Blob([n], { type: "text/csv" })), s = document.createElement("a");
2524
2563
  s.href = a, s.download = e, s.click(), URL.revokeObjectURL(a);
2525
2564
  }
2526
- function ws({ store: e, project: n }) {
2527
- var de;
2528
- const a = Zt(e), s = (a == null ? void 0 : a.columns) ?? [], i = (a == null ? void 0 : a.key) ?? "", [o, r] = f(""), [c, m] = f({}), [u, g] = f({}), [h, C] = f({}), [w, v] = f({}), [y, p] = f(null), [T, $] = f(null), [b, I] = f(null), N = ce(), j = pe(), M = gt(e.id, n, o), R = vt(), x = aa(), P = bt(), V = sa(), E = ia(), _ = (((de = M.data) == null ? void 0 : de.pages.flatMap((d) => d.items)) ?? []).map(
2529
- (d) => w[d.key] ?? d
2530
- ), O = new Map(_.map((d) => [d.key, d])), D = [], F = (d) => c[d], W = F(ae), k = (d, L, B) => {
2531
- const Z = B === void 0 ? null : ye(B, s);
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);
2532
2571
  D.push({
2533
- id: d,
2534
- isNew: d === ae,
2572
+ id: c,
2573
+ isNew: c === ie,
2535
2574
  cells: L.cells,
2536
2575
  version: L.version,
2537
- dirty: Z === null ? !0 : sn(L, Z, s).length > 0,
2538
- conflict: h[d] === !0,
2539
- cellErrors: u[d]
2576
+ dirty: te === null ? !0 : on(L, te, s).length > 0,
2577
+ conflict: h[c] === !0,
2578
+ cellErrors: m[c]
2540
2579
  });
2541
2580
  };
2542
- W !== void 0 && k(ae, W, void 0);
2543
- for (const d of _)
2544
- k(d.key, F(d.key) ?? ye(d, s), d);
2545
- const S = (d) => {
2546
- g((L) => se(L, d)), C((L) => se(L, d));
2547
- }, K = (d) => {
2548
- m((L) => se(L, d)), S(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);
2549
2588
  };
2550
- function J(d, L, B) {
2551
- const Z = O.get(d), z = F(d) ?? (Z ? ye(Z, s) : Ke(s));
2552
- m((U) => ({ ...U, [d]: { ...z, cells: { ...z.cells, [L]: B } } })), g((U) => {
2553
- const ne = U[d];
2554
- if (ne === void 0 || !(L in ne)) return U;
2555
- const ue = se(ne, L);
2556
- return Object.keys(ue).length === 0 ? se(U, d) : { ...U, [d]: ue };
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 };
2557
2596
  });
2558
2597
  }
2559
- async function A(d) {
2560
- const L = O.get(d), B = F(d) ?? (L ? ye(L, s) : void 0);
2598
+ async function $(c) {
2599
+ const L = x.get(c), B = S(c) ?? (L ? ye(L, s) : void 0);
2561
2600
  if (B === void 0) return;
2562
- p(null), S(d);
2563
- const Z = rn(B, s);
2564
- if (!Z.ok) {
2565
- g((U) => ({ ...U, [d]: Z.errors }));
2601
+ E(null), W(c);
2602
+ const te = dn(B, s);
2603
+ if (!te.ok) {
2604
+ g((Y) => ({ ...Y, [c]: te.errors }));
2566
2605
  return;
2567
2606
  }
2568
- const z = on(
2607
+ const X = un(
2569
2608
  B,
2570
- Z.value,
2571
- et((L == null ? void 0 : L.expiresAt) ?? null, Date.now())
2609
+ te.value,
2610
+ nt((L == null ? void 0 : L.expiresAt) ?? null, Date.now())
2572
2611
  );
2573
2612
  try {
2574
- z.kind === "insert" ? await x.mutateAsync({
2613
+ X.kind === "insert" ? await F.mutateAsync({
2575
2614
  id: e.id,
2576
- row: z.value,
2577
- ttlSeconds: z.ttlSeconds,
2615
+ row: X.value,
2616
+ ttlSeconds: X.ttlSeconds,
2578
2617
  project: n
2579
2618
  }) : await R.mutateAsync({
2580
2619
  id: e.id,
2581
- key: z.key,
2582
- value: z.value,
2583
- ifVersion: z.ifVersion,
2584
- ttlSeconds: z.ttlSeconds,
2620
+ key: X.key,
2621
+ value: X.value,
2622
+ ifVersion: X.ifVersion,
2623
+ ttlSeconds: X.ttlSeconds,
2585
2624
  project: n
2586
- }), v((U) => se(U, d)), K(d);
2587
- } catch (U) {
2588
- const ne = Y(U);
2589
- if (tt(ne)) {
2590
- C((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 }));
2591
2630
  return;
2592
2631
  }
2593
- const ue = cn(ne, s);
2594
- if (ue !== null) {
2595
- g((Ie) => ({ ...Ie, [d]: ue }));
2632
+ const he = mn(se, s);
2633
+ if (he !== null) {
2634
+ g((Ie) => ({ ...Ie, [c]: he }));
2596
2635
  return;
2597
2636
  }
2598
- p(ne.message);
2637
+ E(se.message);
2599
2638
  }
2600
2639
  }
2601
- async function Q(d) {
2640
+ async function j(c) {
2602
2641
  try {
2603
- const L = await Nt(N, e.id, d, n);
2604
- v((B) => ({ ...B, [d]: L })), K(d), await j.invalidateQueries({ queryKey: ["data-stores"] });
2642
+ const L = await Nt(N, e.id, c, n);
2643
+ b((B) => ({ ...B, [c]: L })), J(c), await K.invalidateQueries({ queryKey: ["data-stores"] });
2605
2644
  } catch (L) {
2606
- p(Y(L).message);
2645
+ E(G(L).message);
2607
2646
  }
2608
2647
  }
2609
- function G() {
2610
- const d = T;
2611
- $(null), d !== null && (d !== ae && P.mutate({ id: e.id, key: d, project: n }), K(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));
2612
2651
  }
2613
- async function te(d) {
2614
- I(null);
2652
+ async function Z(c) {
2653
+ T(null);
2615
2654
  try {
2616
- const L = await V.mutateAsync({ id: e.id, csv: await d.text(), project: n });
2617
- I(Fe({ status: 200, text: JSON.stringify(L) }));
2655
+ const L = await _.mutateAsync({ id: e.id, csv: await c.text(), project: n });
2656
+ T(Qe({ status: 200, text: JSON.stringify(L) }));
2618
2657
  } catch (L) {
2619
2658
  const B = L;
2620
- I(
2621
- typeof B.status == "number" ? Fe({ status: B.status, text: JSON.stringify(B.raw ?? null) }) : { ok: !1, message: Y(L).message }
2659
+ T(
2660
+ typeof B.status == "number" ? Qe({ status: B.status, text: JSON.stringify(B.raw ?? null) }) : { ok: !1, message: G(L).message }
2622
2661
  );
2623
2662
  }
2624
2663
  }
2625
- async function fe() {
2664
+ async function C() {
2626
2665
  try {
2627
- const d = await E.mutateAsync({ id: e.id, project: n });
2628
- hs(ln(null, e.name), d), I(null);
2629
- } catch (d) {
2630
- I({ 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 });
2631
2670
  }
2632
2671
  }
2633
2672
  return /* @__PURE__ */ l("div", { children: [
2634
2673
  /* @__PURE__ */ t(
2635
- Xt,
2674
+ nn,
2636
2675
  {
2637
- result: b,
2638
- busy: E.isPending,
2639
- onImport: te,
2640
- onRefuse: (d) => I({ ok: !1, message: d }),
2641
- onExport: fe
2676
+ result: f,
2677
+ busy: A.isPending,
2678
+ onImport: Z,
2679
+ onRefuse: (c) => T({ ok: !1, message: c }),
2680
+ onExport: C
2642
2681
  }
2643
2682
  ),
2644
2683
  /* @__PURE__ */ t(
2645
- en,
2684
+ an,
2646
2685
  {
2647
2686
  columns: s,
2648
2687
  keyColumn: i,
@@ -2651,152 +2690,152 @@ function ws({ store: e, project: n }) {
2651
2690
  loading: M.isPending,
2652
2691
  hasMore: M.hasNextPage,
2653
2692
  empty: /* @__PURE__ */ t("p", { className: "muted small", children: "No rows match this key prefix." }),
2654
- onCellChange: J,
2655
- onSave: (d) => void A(d),
2656
- onDelete: $,
2657
- onReload: (d) => void Q(d),
2693
+ onCellChange: ee,
2694
+ onSave: (c) => void $(c),
2695
+ onDelete: v,
2696
+ onReload: (c) => void j(c),
2658
2697
  onAddRow: () => {
2659
- ae in c || (m((d) => ({ ...d, [ae]: Ke(s) })), p(null));
2698
+ ie in d || (u((c) => ({ ...c, [ie]: je(s) })), E(null));
2660
2699
  },
2661
2700
  onLoadMore: () => void M.fetchNextPage(),
2662
2701
  onSearch: r
2663
2702
  }
2664
2703
  ),
2665
- T !== null && /* @__PURE__ */ t(
2704
+ I !== null && /* @__PURE__ */ t(
2666
2705
  Ne,
2667
2706
  {
2668
2707
  title: "Delete entry",
2669
- message: T === ae ? "Discard this unsaved row?" : `Delete "${T}"? This cannot be undone.`,
2708
+ message: I === ie ? "Discard this unsaved row?" : `Delete "${I}"? This cannot be undone.`,
2670
2709
  confirmLabel: "Delete",
2671
- onConfirm: G,
2672
- onClose: () => $(null)
2710
+ onConfirm: H,
2711
+ onClose: () => v(null)
2673
2712
  }
2674
2713
  )
2675
2714
  ] });
2676
2715
  }
2677
- function ps({ store: e, project: n }) {
2678
- var J;
2679
- const a = e.kind === "doc", s = tn(e), [i, o] = f(""), [r, c] = f(null), [m, u] = f(!1), [g, h] = f(""), [C, w] = f(""), [v, y] = f(null), [p, T] = f(!1), [$, b] = f({}), [I, N] = f(null), j = ce(), M = pe(), R = gt(e.id, n, i), x = vt(), P = bt(), V = (((J = R.data) == null ? void 0 : J.pages.flatMap((A) => A.items)) ?? []).map(
2680
- (A) => $[A.key] ?? A
2681
- ), E = r === null ? void 0 : V.find((A) => A.key === r), _ = m || r !== null, O = (A) => a ? JSON.stringify(A.value ?? null, null, 2) : mn(s, A.value), D = (A) => {
2682
- const Q = O(A).replace(/\s+/g, " ");
2683
- return Q.length > Ye ? `${Q.slice(0, Ye)}…` : Q;
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;
2684
2723
  };
2685
- function F(A) {
2686
- c(A.key), u(!1), w(O(A)), y(null), T(!1);
2724
+ function S($) {
2725
+ d($.key), m(!1), w(x($)), y(null), I(!1);
2687
2726
  }
2688
- function W() {
2689
- c(null), u(!1), h(""), w(""), y(null), T(!1);
2727
+ function V() {
2728
+ d(null), m(!1), h(""), w(""), y(null), I(!1);
2690
2729
  }
2691
- async function k() {
2692
- y(null), T(!1);
2693
- const A = a ? dn(C) : un(s, C);
2694
- if (!A.ok) {
2695
- y(A.message);
2730
+ async function U() {
2731
+ y(null), I(!1);
2732
+ const $ = a ? hn(k) : wn(s, k);
2733
+ if (!$.ok) {
2734
+ y($.message);
2696
2735
  return;
2697
2736
  }
2698
- const Q = m ? g.trim() : r;
2699
- if (Q === null || Q === "") {
2737
+ const j = u ? g.trim() : r;
2738
+ if (j === null || j === "") {
2700
2739
  y("Enter a key.");
2701
2740
  return;
2702
2741
  }
2703
2742
  try {
2704
- await x.mutateAsync({
2743
+ await F.mutateAsync({
2705
2744
  id: e.id,
2706
- key: Q,
2707
- value: A.value,
2745
+ key: j,
2746
+ value: $.value,
2708
2747
  // A new entry must not exist yet; an existing one is guarded by the version loaded.
2709
- ifVersion: m ? 0 : (E == null ? void 0 : E.version) ?? 0,
2710
- ttlSeconds: m ? void 0 : et((E == null ? void 0 : E.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()),
2711
2750
  project: n
2712
- }), b((G) => se(G, Q)), W();
2713
- } catch (G) {
2714
- const te = Y(G);
2715
- tt(te) ? T(!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);
2716
2755
  }
2717
2756
  }
2718
- async function S() {
2757
+ async function W() {
2719
2758
  if (r !== null)
2720
2759
  try {
2721
- const A = await Nt(j, e.id, r, n);
2722
- b((Q) => ({ ...Q, [r]: A })), w(O(A)), T(!1), y(null), await M.invalidateQueries({ queryKey: ["data-stores"] });
2723
- } catch (A) {
2724
- y(Y(A).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);
2725
2764
  }
2726
2765
  }
2727
- async function K() {
2728
- const A = I;
2729
- if (N(null), A !== null)
2766
+ async function J() {
2767
+ const $ = T;
2768
+ if (N(null), $ !== null)
2730
2769
  try {
2731
- await P.mutateAsync({ id: e.id, key: A, project: n }), A === r && W();
2732
- } catch (Q) {
2733
- y(Y(Q).message);
2770
+ await O.mutateAsync({ id: e.id, key: $, project: n }), $ === r && V();
2771
+ } catch (j) {
2772
+ y(G(j).message);
2734
2773
  }
2735
2774
  }
2736
2775
  return /* @__PURE__ */ l("div", { children: [
2737
2776
  /* @__PURE__ */ t(
2738
- nn,
2777
+ ln,
2739
2778
  {
2740
- rows: V.map((A) => ({ key: A.key, version: A.version, preview: D(A) })),
2779
+ rows: _.map(($) => ({ key: $.key, version: $.version, preview: D($) })),
2741
2780
  loading: R.isPending,
2742
2781
  empty: /* @__PURE__ */ t("p", { className: "muted small", children: "No entries match this key prefix." }),
2743
2782
  hasMore: R.hasNextPage,
2744
- onOpen: (A) => {
2745
- const Q = V.find((G) => G.key === A);
2746
- Q && F(Q);
2783
+ onOpen: ($) => {
2784
+ const j = _.find((H) => H.key === $);
2785
+ j && S(j);
2747
2786
  },
2748
2787
  onSearch: o,
2749
2788
  onNew: () => {
2750
- c(null), u(!0), h(""), w(""), y(null), T(!1);
2789
+ d(null), m(!0), h(""), w(""), y(null), I(!1);
2751
2790
  },
2752
2791
  onLoadMore: () => void R.fetchNextPage()
2753
2792
  }
2754
2793
  ),
2755
- _ && /* @__PURE__ */ t(
2756
- an,
2794
+ P && /* @__PURE__ */ t(
2795
+ rn,
2757
2796
  {
2758
2797
  kind: a ? "doc" : "kv",
2759
- isNew: m,
2798
+ isNew: u,
2760
2799
  entryKey: r ?? void 0,
2761
2800
  newKey: g,
2762
- version: (E == null ? void 0 : E.version) ?? null,
2763
- expiresAt: (E == null ? void 0 : E.expiresAt) ?? null,
2764
- text: C,
2765
- error: v,
2766
- conflict: p,
2767
- saving: x.isPending || P.isPending,
2768
- onDelete: m ? void 0 : () => N(r),
2769
- onTextChange: (A) => {
2770
- w(A), y(null);
2801
+ version: (A == null ? void 0 : A.version) ?? null,
2802
+ expiresAt: (A == null ? void 0 : A.expiresAt) ?? null,
2803
+ text: k,
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);
2771
2810
  },
2772
2811
  onKeyChange: h,
2773
- onSave: () => void k(),
2774
- onCancel: W,
2775
- onReload: () => void S()
2812
+ onSave: () => void U(),
2813
+ onCancel: V,
2814
+ onReload: () => void W()
2776
2815
  }
2777
2816
  ),
2778
- I !== null && /* @__PURE__ */ t(
2817
+ T !== null && /* @__PURE__ */ t(
2779
2818
  Ne,
2780
2819
  {
2781
2820
  title: "Delete entry",
2782
- message: `Delete "${I}"? This cannot be undone.`,
2821
+ message: `Delete "${T}"? This cannot be undone.`,
2783
2822
  confirmLabel: "Delete",
2784
- onConfirm: K,
2823
+ onConfirm: J,
2785
2824
  onClose: () => N(null)
2786
2825
  }
2787
2826
  )
2788
2827
  ] });
2789
2828
  }
2790
- function se(e, n) {
2829
+ function le(e, n) {
2791
2830
  if (!(n in e)) return e;
2792
2831
  const a = { ...e };
2793
2832
  return delete a[n], a;
2794
2833
  }
2795
- function ii({ id: e, project: n, slots: a }) {
2796
- const s = X(n), i = na(e, s ?? void 0), o = i.data;
2834
+ function oi({ id: e, project: n, slots: a }) {
2835
+ const s = ne(n), i = ia(e, s ?? void 0), o = i.data;
2797
2836
  let r;
2798
- s == null ? r = /* @__PURE__ */ t("p", { className: "muted", children: "No project selected." }) : i.isError ? r = /* @__PURE__ */ t("p", { className: "result error", children: Y(i.error).message }) : o === void 0 ? r = /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : o.kind === "table" ? r = /* @__PURE__ */ t(ws, { store: o, project: s }, o.id) : r = /* @__PURE__ */ t(ps, { store: o, project: s }, o.id);
2799
- 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: [
2800
2839
  /* @__PURE__ */ t("h3", { children: o.name }),
2801
2840
  /* @__PURE__ */ l("p", { className: "muted small", children: [
2802
2841
  o.kind,
@@ -2807,41 +2846,41 @@ function ii({ id: e, project: n, slots: a }) {
2807
2846
  ] })
2808
2847
  ] }) : a.header;
2809
2848
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
2810
- c,
2849
+ d,
2811
2850
  r
2812
2851
  ] }) });
2813
2852
  }
2814
- const fs = ["name", "kind", "description", "schema"];
2815
- function ys(e) {
2816
- const [n, a] = f(""), [s, i] = f(""), [o, r] = f("kv"), [c, m] = f("string"), [u, g] = f([]), [h, C] = f(""), [w, v] = f({}), [y, p] = f({}), [T, $] = f(null), b = oa();
2817
- function I() {
2818
- v({}), p({}), $(null);
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);
2819
2858
  const N = {
2820
2859
  kind: o,
2821
2860
  name: n
2822
2861
  };
2823
- o === "kv" && (N.schema = { valueType: c }), o === "table" && (N.schema = h === "" ? { columns: u } : { columns: u, key: h }), s !== "" && (N.description = s), 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(
2824
2863
  // The SDK's create body types `schema` as table columns only; the wire takes the S-2 shape
2825
2864
  // per kind, so the kv `{valueType}` schema is passed through as the host defines it.
2826
2865
  { input: N, project: e.project },
2827
2866
  {
2828
2867
  onSuccess: () => e.onClose(),
2829
- onError: (j) => {
2830
- const M = Y(j), R = gn(M);
2831
- if (R.kind === "cell" && u.some((x) => x.name === R.column)) {
2832
- p({ [R.column]: M.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 });
2833
2872
  return;
2834
2873
  }
2835
- if (R.kind === "field" && fs.includes(R.field)) {
2836
- v({ [R.field]: M.message });
2874
+ if (R.kind === "field" && vs.includes(R.field)) {
2875
+ b({ [R.field]: M.message });
2837
2876
  return;
2838
2877
  }
2839
- $(M.message);
2878
+ v(M.message);
2840
2879
  }
2841
2880
  }
2842
2881
  );
2843
2882
  }
2844
- return /* @__PURE__ */ l(Mn, { title: "New data store", onClose: e.onClose, children: [
2883
+ return /* @__PURE__ */ l(Pn, { title: "New data store", onClose: e.onClose, children: [
2845
2884
  /* @__PURE__ */ l("div", { className: "modal-body", children: [
2846
2885
  /* @__PURE__ */ l("label", { className: "field", children: [
2847
2886
  /* @__PURE__ */ t("span", { children: "Name" }),
@@ -2877,9 +2916,9 @@ function ys(e) {
2877
2916
  "data-testid": "data-store-kind",
2878
2917
  value: o,
2879
2918
  onChange: (N) => {
2880
- r(N.target.value), C("");
2919
+ r(N.target.value), k("");
2881
2920
  },
2882
- children: wn.map((N) => /* @__PURE__ */ t("option", { value: N, children: pn[N] }, N))
2921
+ children: yn.map((N) => /* @__PURE__ */ t("option", { value: N, children: gn[N] }, N))
2883
2922
  }
2884
2923
  ),
2885
2924
  /* @__PURE__ */ t("span", { className: "hint", children: "The kind is fixed once the store exists." })
@@ -2887,20 +2926,20 @@ function ys(e) {
2887
2926
  w.kind !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: w.kind }),
2888
2927
  o === "kv" && /* @__PURE__ */ l("label", { className: "field", children: [
2889
2928
  /* @__PURE__ */ t("span", { children: "Value type" }),
2890
- /* @__PURE__ */ t("select", { value: c, onChange: (N) => m(N.target.value), children: fn.map((N) => /* @__PURE__ */ t("option", { value: N, children: N }, N)) })
2929
+ /* @__PURE__ */ t("select", { value: d, onChange: (N) => u(N.target.value), children: vn.map((N) => /* @__PURE__ */ t("option", { value: N, children: N }, N)) })
2891
2930
  ] }),
2892
2931
  o === "table" && /* @__PURE__ */ t(
2893
- yn,
2932
+ bn,
2894
2933
  {
2895
- columns: u,
2934
+ columns: m,
2896
2935
  onChange: g,
2897
2936
  keyColumn: h,
2898
- onKeyColumnChange: C,
2937
+ onKeyColumnChange: k,
2899
2938
  columnErrors: y
2900
2939
  }
2901
2940
  ),
2902
2941
  w.schema !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: w.schema }),
2903
- T !== null && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "data-store-form-error", children: T })
2942
+ I !== null && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "data-store-form-error", children: I })
2904
2943
  ] }),
2905
2944
  /* @__PURE__ */ l("div", { className: "modal-actions", children: [
2906
2945
  /* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Cancel" }),
@@ -2910,30 +2949,30 @@ function ys(e) {
2910
2949
  type: "button",
2911
2950
  className: "btn",
2912
2951
  "data-testid": "data-store-create",
2913
- disabled: b.isPending,
2914
- onClick: I,
2915
- children: b.isPending ? "Creating…" : "Create"
2952
+ disabled: f.isPending,
2953
+ onClick: T,
2954
+ children: f.isPending ? "Creating…" : "Create"
2916
2955
  }
2917
2956
  )
2918
2957
  ] })
2919
2958
  ] });
2920
2959
  }
2921
- function li({ project: e, onOpen: n, getHref: a, slots: s }) {
2922
- const i = X(e), o = la(i ?? void 0), r = ra(), [c, m] = f(!1), [u, g] = f(null), [h, C] = f(null), w = (s == null ? void 0 : s.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: [
2923
2962
  /* @__PURE__ */ t("h3", { children: "Data stores" }),
2924
2963
  /* @__PURE__ */ t("p", { className: "muted small", children: "Key-value, document and table storage for this project." })
2925
2964
  ] }) : s.header;
2926
2965
  return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
2927
2966
  /* @__PURE__ */ t(
2928
- hn,
2967
+ fn,
2929
2968
  {
2930
2969
  stores: o.data ?? [],
2931
2970
  loading: o.isLoading,
2932
- error: h ?? (o.error != null ? Y(o.error).message : null),
2971
+ error: h ?? (o.error != null ? G(o.error).message : null),
2933
2972
  onOpen: n,
2934
2973
  getHref: a,
2935
- onArchive: (v) => {
2936
- C(null), g(v);
2974
+ onArchive: (b) => {
2975
+ k(null), g(b);
2937
2976
  },
2938
2977
  busy: r.isPending,
2939
2978
  slots: {
@@ -2945,7 +2984,7 @@ function li({ project: e, onOpen: n, getHref: a, slots: s }) {
2945
2984
  className: "btn",
2946
2985
  "data-testid": "data-store-new",
2947
2986
  disabled: i == null,
2948
- onClick: () => m(!0),
2987
+ onClick: () => u(!0),
2949
2988
  children: "+ New data store"
2950
2989
  }
2951
2990
  ),
@@ -2953,18 +2992,18 @@ function li({ project: e, onOpen: n, getHref: a, slots: s }) {
2953
2992
  }
2954
2993
  }
2955
2994
  ),
2956
- c && i != null && /* @__PURE__ */ t(ys, { project: i, onClose: () => m(!1) }),
2957
- u && /* @__PURE__ */ t(
2995
+ d && i != null && /* @__PURE__ */ t(bs, { project: i, onClose: () => u(!1) }),
2996
+ m && /* @__PURE__ */ t(
2958
2997
  Ne,
2959
2998
  {
2960
2999
  title: "Archive data store",
2961
- message: `Archive "${u.name}" and its ${u.entryCount} ${u.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.`,
2962
3001
  confirmLabel: "Archive",
2963
3002
  onConfirm: () => {
2964
- const v = u;
3003
+ const b = m;
2965
3004
  g(null), i != null && r.mutate(
2966
- { id: v.id, project: i },
2967
- { onError: (y) => C(Y(y).message) }
3005
+ { id: b.id, project: i },
3006
+ { onError: (y) => k(G(y).message) }
2968
3007
  );
2969
3008
  },
2970
3009
  onClose: () => g(null)
@@ -2973,25 +3012,25 @@ function li({ project: e, onOpen: n, getHref: a, slots: s }) {
2973
3012
  ] });
2974
3013
  }
2975
3014
  export {
2976
- Ys as ActivitySummary,
2977
- Zs as ConnectionDetail,
2978
- Gs as ConnectionList,
2979
- ni as CredentialCreate,
2980
- ai as CredentialDetail,
2981
- ti as CredentialList,
2982
- li as DataStoreList,
2983
- ii as DataStoreView,
2984
- Hs as DocumentList,
2985
- Ws as EndpointList,
2986
- Vs as FunctionList,
2987
- Na as Logs,
2988
- zs as LogsView,
2989
- Xs as ModelCatalog,
2990
- ei as ModelUsage,
2991
- si as MyAiKeys,
2992
- Us as ReliabilityBoard,
2993
- ba as RunHistory,
2994
- Js as ServiceDetail,
2995
- Bs 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
2996
3035
  };
2997
3036
  //# sourceMappingURL=lists.mjs.map