@w6w/embed 0.2.26 → 0.2.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/{CreateFunctionModal-DScxp_LN.js → CreateFunctionModal-B3LpcuI9.js} +2 -2
  2. package/dist/{CreateFunctionModal-DScxp_LN.js.map → CreateFunctionModal-B3LpcuI9.js.map} +1 -1
  3. package/dist/DocumentFormModal-DieWYFi4.js +175 -0
  4. package/dist/DocumentFormModal-DieWYFi4.js.map +1 -0
  5. package/dist/{ImportSpecModal-VdYN1QeZ.js → ImportSpecModal-xwTzj4KB.js} +2 -2
  6. package/dist/{ImportSpecModal-VdYN1QeZ.js.map → ImportSpecModal-xwTzj4KB.js.map} +1 -1
  7. package/dist/ModelRoutesManager-DtByS4mE.js +422 -0
  8. package/dist/ModelRoutesManager-DtByS4mE.js.map +1 -0
  9. package/dist/{WorkflowEditor-CGKoeSG7.js → WorkflowEditor-CvWkVmFn.js} +2 -2
  10. package/dist/{WorkflowEditor-CGKoeSG7.js.map → WorkflowEditor-CvWkVmFn.js.map} +1 -1
  11. package/dist/ai-keys-D676ly41.js +53 -0
  12. package/dist/ai-keys-D676ly41.js.map +1 -0
  13. package/dist/credentials-4Nf2GfMc.js +212 -0
  14. package/dist/credentials-4Nf2GfMc.js.map +1 -0
  15. package/dist/{editor-tools-Brw0cv2F.js → editor-tools-CVYTsVFN.js} +326 -326
  16. package/dist/editor-tools-CVYTsVFN.js.map +1 -0
  17. package/dist/editor.mjs +1 -1
  18. package/dist/editors.mjs +7 -7
  19. package/dist/{endpoints-DSRo1Lc5.js → endpoints-DArAqoLT.js} +15 -15
  20. package/dist/endpoints-DArAqoLT.js.map +1 -0
  21. package/dist/forms/ModelRoutesManager.d.ts +8 -0
  22. package/dist/forms.mjs +128 -133
  23. package/dist/forms.mjs.map +1 -1
  24. package/dist/index.mjs +16 -16
  25. package/dist/lib/callable-descriptors.d.ts +1 -1
  26. package/dist/lib/document-upload.d.ts +8 -0
  27. package/dist/lists/MyAiKeys.d.ts +5 -0
  28. package/dist/lists/TagChips.d.ts +4 -0
  29. package/dist/lists.d.ts +2 -0
  30. package/dist/lists.mjs +1589 -1166
  31. package/dist/lists.mjs.map +1 -1
  32. package/dist/models-CI0vLJ6o.js +346 -0
  33. package/dist/models-CI0vLJ6o.js.map +1 -0
  34. package/dist/rail.mjs +1 -1
  35. package/dist/repos/ai-keys.d.ts +14 -0
  36. package/dist/repos/credentials.d.ts +14 -14
  37. package/dist/repos/index.d.ts +1 -0
  38. package/dist/repos/models.d.ts +53 -4
  39. package/dist/repos.mjs +177 -162
  40. package/dist/repos.mjs.map +1 -1
  41. package/dist/{spec-import-SWOonsNr.js → spec-import-0B6oUewa.js} +5 -5
  42. package/dist/{spec-import-SWOonsNr.js.map → spec-import-0B6oUewa.js.map} +1 -1
  43. package/package.json +5 -5
  44. package/src/styles.css +23 -0
  45. package/dist/DocumentFormModal-Br4s8wmi.js +0 -89
  46. package/dist/DocumentFormModal-Br4s8wmi.js.map +0 -1
  47. package/dist/ModelRoutesManager-Bv6qefnq.js +0 -345
  48. package/dist/ModelRoutesManager-Bv6qefnq.js.map +0 -1
  49. package/dist/credentials-CMR_wEvx.js +0 -196
  50. package/dist/credentials-CMR_wEvx.js.map +0 -1
  51. package/dist/editor-tools-Brw0cv2F.js.map +0 -1
  52. package/dist/endpoints-DSRo1Lc5.js.map +0 -1
  53. package/dist/models-CK1KHd39.js +0 -311
  54. package/dist/models-CK1KHd39.js.map +0 -1
package/dist/forms.mjs CHANGED
@@ -1,43 +1,35 @@
1
1
  "use client";
2
- import { C as Je, a as Ge } from "./CreateFunctionModal-DScxp_LN.js";
3
- import { jsxs as a, jsx as t, Fragment as ne } from "react/jsx-runtime";
4
- import { ApiError as L } from "@w6w/sdk";
2
+ import { C as Je, a as He } from "./CreateFunctionModal-B3LpcuI9.js";
3
+ import { jsx as t, jsxs as l, Fragment as ne } from "react/jsx-runtime";
4
+ import { ApiError as I } from "@w6w/sdk";
5
5
  import { EmptyState as P, DataTable as U, EditButton as T, DeleteButton as A, useEnterSubmit as V, BudgetMeter as se } from "@w6w/ui";
6
6
  import { useState as m } from "react";
7
7
  import { C as O, a as re, M as R } from "./ConfirmModal-Pv2-A_3U.js";
8
8
  import { u as ae } from "./project-context-Tvp-La7A.js";
9
9
  import { i as oe, d as de, b as ce, h as ue, f as me, c as he, u as ge, g as ve } from "./vault-BSEWhMYC.js";
10
- import { M as Ye } from "./ModelRoutesManager-Bv6qefnq.js";
11
- import { J as be, G as pe, F as fe, M as ye, I as Ne } from "./models-CK1KHd39.js";
10
+ import { M as ze } from "./ModelRoutesManager-DtByS4mE.js";
11
+ import { N as be, K as pe, J as fe, Q as ye, M as Ne } from "./models-CI0vLJ6o.js";
12
12
  const Ce = ["string", "number", "boolean", "json"];
13
13
  function Z(e) {
14
14
  if (e.type === "boolean" || e.type === "number" || e.type === "string") return String(e.value);
15
15
  const n = JSON.stringify(e.value);
16
16
  return n.length > 80 ? `${n.slice(0, 80)}…` : n;
17
17
  }
18
- function We(e) {
18
+ function Ke(e) {
19
19
  var w;
20
- const n = e.slots, l = ae(e.project), [h, i] = m(null), [f, o] = m(null), g = oe(l ?? void 0, l != null), b = de(), y = l != null, p = () => {
21
- l != null && i({ mode: "create" });
22
- }, N = (n == null ? void 0 : n.header) === void 0 ? /* @__PURE__ */ a("div", { children: [
23
- /* @__PURE__ */ t("h3", { children: "Variables" }),
24
- /* @__PURE__ */ a("p", { className: "muted small", children: [
25
- "User-defined typed values addressable by name. Plaintext — use ",
26
- /* @__PURE__ */ t("strong", { children: "Secrets" }),
27
- " ",
28
- "for sensitive values."
29
- ] })
30
- ] }) : n.header, C = n == null ? void 0 : n.actions, S = C === void 0 ? /* @__PURE__ */ t("button", { type: "button", className: "btn", disabled: !y, onClick: p, children: "+ Add variable" }) : typeof C == "function" ? C({ openCreate: p, canCreate: y }) : C, s = (n == null ? void 0 : n.empty) === void 0 ? /* @__PURE__ */ t(P, { testId: "vars-manager-empty", children: "No variables yet." }) : n.empty, c = [
20
+ const n = e.slots, a = ae(e.project), [h, i] = m(null), [f, o] = m(null), g = oe(a ?? void 0, a != null), b = de(), y = a != null, p = () => {
21
+ a != null && i({ mode: "create" });
22
+ }, N = (n == null ? void 0 : n.header) === void 0 ? /* @__PURE__ */ t("h3", { children: "Variables" }) : n.header, C = n == null ? void 0 : n.actions, S = C === void 0 ? /* @__PURE__ */ t("button", { type: "button", className: "btn", disabled: !y, onClick: p, children: "+ Add variable" }) : typeof C == "function" ? C({ openCreate: p, canCreate: y }) : C, s = (n == null ? void 0 : n.empty) === void 0 ? /* @__PURE__ */ t(P, { testId: "vars-manager-empty", children: "No variables yet." }) : n.empty, c = [
31
23
  {
32
24
  key: "name",
33
25
  header: "Variable",
34
- render: (u) => /* @__PURE__ */ a("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
26
+ render: (u) => /* @__PURE__ */ l("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
35
27
  /* @__PURE__ */ t("strong", { className: "list-name", title: u.name, children: u.name }),
36
28
  " ",
37
29
  /* @__PURE__ */ t("span", { className: "tag", children: u.type }),
38
- /* @__PURE__ */ a("div", { className: "muted small list-preview", title: Z(u), children: [
30
+ /* @__PURE__ */ l("div", { className: "muted small list-preview", title: Z(u), children: [
39
31
  Z(u),
40
- u.description && /* @__PURE__ */ a(ne, { children: [
32
+ u.description && /* @__PURE__ */ l(ne, { children: [
41
33
  " · ",
42
34
  u.description
43
35
  ] })
@@ -48,10 +40,9 @@ function We(e) {
48
40
  key: "actions",
49
41
  header: "",
50
42
  align: "right",
51
- // Shrink to the buttons: the name cell's `maxWidth: 0` would otherwise split the width evenly.
52
- width: "1%",
53
43
  link: !1,
54
- render: (u) => /* @__PURE__ */ a("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)", whiteSpace: "nowrap" }, children: [
44
+ actions: !0,
45
+ render: (u) => /* @__PURE__ */ l("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)", whiteSpace: "nowrap" }, children: [
55
46
  /* @__PURE__ */ t(re, { resource: { kind: "var", name: u.name } }),
56
47
  /* @__PURE__ */ t(
57
48
  T,
@@ -73,11 +64,17 @@ function We(e) {
73
64
  ] })
74
65
  }
75
66
  ];
76
- return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ a("section", { className: "section", children: [
77
- (N != null || S != null) && /* @__PURE__ */ a("div", { className: "section-head", children: [
67
+ return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
68
+ (N != null || S != null) && /* @__PURE__ */ l("div", { className: "section-head", children: [
78
69
  N,
79
70
  S
80
71
  ] }),
72
+ (n == null ? void 0 : n.header) === void 0 && /* @__PURE__ */ l("p", { className: "muted small", children: [
73
+ "User-defined typed values addressable by name. Plaintext — use ",
74
+ /* @__PURE__ */ t("strong", { children: "Secrets" }),
75
+ " ",
76
+ "for sensitive values."
77
+ ] }),
81
78
  g.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
82
79
  ((w = g.data) == null ? void 0 : w.length) === 0 && s,
83
80
  g.data != null && g.data.length > 0 && /* @__PURE__ */ t(
@@ -89,23 +86,23 @@ function We(e) {
89
86
  rowKey: (u) => u.id
90
87
  }
91
88
  ),
92
- h && l != null && /* @__PURE__ */ t(
89
+ h && a != null && /* @__PURE__ */ t(
93
90
  Se,
94
91
  {
95
- project: l,
92
+ project: a,
96
93
  initial: h.mode === "edit" ? h.v : void 0,
97
94
  onClose: () => i(null),
98
95
  onSaved: () => i(null)
99
96
  }
100
97
  ),
101
- f && l != null && /* @__PURE__ */ t(
98
+ f && a != null && /* @__PURE__ */ t(
102
99
  O,
103
100
  {
104
101
  title: "Delete variable",
105
102
  message: `Delete the variable "${f.name}"? This cannot be undone.`,
106
103
  confirmLabel: "Delete",
107
104
  onConfirm: () => {
108
- b.mutate({ id: f.id, project: l }), o(null);
105
+ b.mutate({ id: f.id, project: a }), o(null);
109
106
  },
110
107
  onClose: () => o(null)
111
108
  }
@@ -114,7 +111,7 @@ function We(e) {
114
111
  }
115
112
  function Se(e) {
116
113
  var k, v, E;
117
- const n = !!e.initial, [l, h] = m(((k = e.initial) == null ? void 0 : k.name) ?? ""), [i, f] = m(((v = e.initial) == null ? void 0 : v.type) ?? "string"), [o, g] = m(() => e.initial ? e.initial.type === "string" ? String(e.initial.value ?? "") : JSON.stringify(e.initial.value, null, 2) : ""), [b, y] = m(((E = e.initial) == null ? void 0 : E.description) ?? ""), [p, N] = m(null);
114
+ const n = !!e.initial, [a, h] = m(((k = e.initial) == null ? void 0 : k.name) ?? ""), [i, f] = m(((v = e.initial) == null ? void 0 : v.type) ?? "string"), [o, g] = m(() => e.initial ? e.initial.type === "string" ? String(e.initial.value ?? "") : JSON.stringify(e.initial.value, null, 2) : ""), [b, y] = m(((E = e.initial) == null ? void 0 : E.description) ?? ""), [p, N] = m(null);
118
115
  function C() {
119
116
  if (i === "string") return { ok: !0, value: o };
120
117
  if (i === "boolean")
@@ -139,7 +136,7 @@ function Se(e) {
139
136
  N(null);
140
137
  const j = {
141
138
  onSuccess: () => e.onSaved(),
142
- onError: (M) => N((M instanceof L, M.message))
139
+ onError: (M) => N((M instanceof I, M.message))
143
140
  };
144
141
  if (e.initial) {
145
142
  s.mutate(
@@ -153,25 +150,25 @@ function Se(e) {
153
150
  return;
154
151
  }
155
152
  S.mutate(
156
- { input: { name: l, type: i, value: d.value, description: b }, project: e.project },
153
+ { input: { name: a, type: i, value: d.value, description: b }, project: e.project },
157
154
  j
158
155
  );
159
156
  }
160
- const u = V(w, { enabled: !!l && !c });
161
- return /* @__PURE__ */ a(
157
+ const u = V(w, { enabled: !!a && !c });
158
+ return /* @__PURE__ */ l(
162
159
  R,
163
160
  {
164
161
  title: e.initial ? `Edit ${e.initial.name}` : "Add variable",
165
162
  onClose: e.onClose,
166
163
  children: [
167
- /* @__PURE__ */ a("div", { className: "modal-body", children: [
168
- /* @__PURE__ */ a("label", { className: "field", children: [
164
+ /* @__PURE__ */ l("div", { className: "modal-body", children: [
165
+ /* @__PURE__ */ l("label", { className: "field", children: [
169
166
  /* @__PURE__ */ t("span", { children: "Name" }),
170
167
  /* @__PURE__ */ t(
171
168
  "input",
172
169
  {
173
170
  type: "text",
174
- value: l,
171
+ value: a,
175
172
  disabled: n,
176
173
  onChange: (d) => h(d.target.value),
177
174
  placeholder: "e.g. api_base_url",
@@ -181,13 +178,13 @@ function Se(e) {
181
178
  ),
182
179
  !n && /* @__PURE__ */ t("span", { className: "hint", children: "Letters, digits, and underscores. Must start with a letter or underscore. Case-sensitive." })
183
180
  ] }),
184
- /* @__PURE__ */ a("label", { className: "field", children: [
181
+ /* @__PURE__ */ l("label", { className: "field", children: [
185
182
  /* @__PURE__ */ t("span", { children: "Type" }),
186
183
  /* @__PURE__ */ t("select", { value: i, onChange: (d) => f(d.target.value), children: Ce.map((d) => /* @__PURE__ */ t("option", { value: d, children: d }, d)) })
187
184
  ] }),
188
- /* @__PURE__ */ a("label", { className: "field", htmlFor: "var-value", children: [
185
+ /* @__PURE__ */ l("label", { className: "field", htmlFor: "var-value", children: [
189
186
  /* @__PURE__ */ t("span", { children: "Value" }),
190
- i === "boolean" ? /* @__PURE__ */ a("select", { id: "var-value", value: o || "true", onChange: (d) => g(d.target.value), children: [
187
+ i === "boolean" ? /* @__PURE__ */ l("select", { id: "var-value", value: o || "true", onChange: (d) => g(d.target.value), children: [
191
188
  /* @__PURE__ */ t("option", { value: "true", children: "true" }),
192
189
  /* @__PURE__ */ t("option", { value: "false", children: "false" })
193
190
  ] }) : i === "number" ? /* @__PURE__ */ t(
@@ -222,7 +219,7 @@ function Se(e) {
222
219
  }
223
220
  )
224
221
  ] }),
225
- /* @__PURE__ */ a("label", { className: "field", children: [
222
+ /* @__PURE__ */ l("label", { className: "field", children: [
226
223
  /* @__PURE__ */ t("span", { children: "Description" }),
227
224
  /* @__PURE__ */ t(
228
225
  "input",
@@ -237,29 +234,26 @@ function Se(e) {
237
234
  ] }),
238
235
  p && /* @__PURE__ */ t("div", { className: "result error", children: p })
239
236
  ] }),
240
- /* @__PURE__ */ a("div", { className: "modal-actions", children: [
237
+ /* @__PURE__ */ l("div", { className: "modal-actions", children: [
241
238
  /* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Cancel" }),
242
- /* @__PURE__ */ t("button", { type: "button", className: "btn", disabled: !l || c, onClick: w, children: c ? "Saving…" : n ? "Save changes" : "Save variable" })
239
+ /* @__PURE__ */ t("button", { type: "button", className: "btn", disabled: !a || c, onClick: w, children: c ? "Saving…" : n ? "Save changes" : "Save variable" })
243
240
  ] })
244
241
  ]
245
242
  }
246
243
  );
247
244
  }
248
- function Fe(e) {
245
+ function We(e) {
249
246
  var s;
250
- const n = e.slots, [l, h] = m(null), [i, f] = m(null), o = me(), g = he(), b = () => h({ mode: "create" }), y = (n == null ? void 0 : n.header) === void 0 ? /* @__PURE__ */ a("div", { children: [
251
- /* @__PURE__ */ t("h3", { children: "Secrets" }),
252
- /* @__PURE__ */ t("p", { className: "muted small", children: "Secrets addressable by name. Stored encrypted at rest and never returned from the server — to change a secret, overwrite it." })
253
- ] }) : n.header, p = n == null ? void 0 : n.actions, N = p === void 0 ? /* @__PURE__ */ t("button", { type: "button", className: "btn", onClick: b, children: "+ Add secret" }) : typeof p == "function" ? p({ openCreate: b, canCreate: !0 }) : p, C = (n == null ? void 0 : n.empty) === void 0 ? /* @__PURE__ */ t(P, { testId: "secrets-manager-empty", children: "No secrets yet." }) : n.empty, S = [
247
+ const n = e.slots, [a, h] = m(null), [i, f] = m(null), o = me(), g = he(), b = () => h({ mode: "create" }), y = (n == null ? void 0 : n.header) === void 0 ? /* @__PURE__ */ t("h3", { children: "Secrets" }) : n.header, p = n == null ? void 0 : n.actions, N = p === void 0 ? /* @__PURE__ */ t("button", { type: "button", className: "btn", onClick: b, children: "+ Add secret" }) : typeof p == "function" ? p({ openCreate: b, canCreate: !0 }) : p, C = (n == null ? void 0 : n.empty) === void 0 ? /* @__PURE__ */ t(P, { testId: "secrets-manager-empty", children: "No secrets yet." }) : n.empty, S = [
254
248
  {
255
249
  key: "name",
256
250
  header: "Secret",
257
- render: (c) => /* @__PURE__ */ a("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
251
+ render: (c) => /* @__PURE__ */ l("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
258
252
  /* @__PURE__ */ t("strong", { className: "list-name", title: c.name, children: c.name }),
259
253
  " ",
260
254
  /* @__PURE__ */ t("code", { className: "muted small", children: "••••••••" }),
261
- /* @__PURE__ */ a("div", { className: "muted small list-preview", children: [
262
- c.description && /* @__PURE__ */ a(ne, { children: [
255
+ /* @__PURE__ */ l("div", { className: "muted small list-preview", children: [
256
+ c.description && /* @__PURE__ */ l(ne, { children: [
263
257
  c.description,
264
258
  " · "
265
259
  ] }),
@@ -272,10 +266,9 @@ function Fe(e) {
272
266
  key: "actions",
273
267
  header: "",
274
268
  align: "right",
275
- // Shrink to the buttons: the name cell's `maxWidth: 0` would otherwise split the width evenly.
276
- width: "1%",
277
269
  link: !1,
278
- render: (c) => /* @__PURE__ */ a("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)", whiteSpace: "nowrap" }, children: [
270
+ actions: !0,
271
+ render: (c) => /* @__PURE__ */ l("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)", whiteSpace: "nowrap" }, children: [
279
272
  /* @__PURE__ */ t(
280
273
  T,
281
274
  {
@@ -296,11 +289,12 @@ function Fe(e) {
296
289
  ] })
297
290
  }
298
291
  ];
299
- return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ a("section", { className: "section", children: [
300
- (y != null || N != null) && /* @__PURE__ */ a("div", { className: "section-head", children: [
292
+ return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
293
+ (y != null || N != null) && /* @__PURE__ */ l("div", { className: "section-head", children: [
301
294
  y,
302
295
  N
303
296
  ] }),
297
+ (n == null ? void 0 : n.header) === void 0 && /* @__PURE__ */ t("p", { className: "muted small", children: "Secrets addressable by name. Stored encrypted at rest and never returned from the server — to change a secret, overwrite it." }),
304
298
  o.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
305
299
  ((s = o.data) == null ? void 0 : s.length) === 0 && C,
306
300
  o.data != null && o.data.length > 0 && /* @__PURE__ */ t(
@@ -312,10 +306,10 @@ function Fe(e) {
312
306
  rowKey: (c) => c.id
313
307
  }
314
308
  ),
315
- l && /* @__PURE__ */ t(
309
+ a && /* @__PURE__ */ t(
316
310
  we,
317
311
  {
318
- initial: l.mode === "edit" ? l.s : void 0,
312
+ initial: a.mode === "edit" ? a.s : void 0,
319
313
  onClose: () => h(null),
320
314
  onSaved: () => h(null)
321
315
  }
@@ -336,14 +330,14 @@ function Fe(e) {
336
330
  }
337
331
  function we(e) {
338
332
  var w, u, k;
339
- const n = !!e.initial, [l, h] = m(((w = e.initial) == null ? void 0 : w.name) ?? ""), [i, f] = m(""), [o, g] = m(((u = e.initial) == null ? void 0 : u.description) ?? ""), [b, y] = m(null), p = ge(), N = ve(((k = e.initial) == null ? void 0 : k.id) ?? ""), C = n ? N : p, S = !!l && (n || !!i) && !C.isPending;
333
+ const n = !!e.initial, [a, h] = m(((w = e.initial) == null ? void 0 : w.name) ?? ""), [i, f] = m(""), [o, g] = m(((u = e.initial) == null ? void 0 : u.description) ?? ""), [b, y] = m(null), p = ge(), N = ve(((k = e.initial) == null ? void 0 : k.id) ?? ""), C = n ? N : p, S = !!a && (n || !!i) && !C.isPending;
340
334
  function s() {
341
335
  if (y(null), n) {
342
336
  N.mutate(
343
337
  { value: i === "" ? void 0 : i, description: o },
344
338
  {
345
339
  onSuccess: () => e.onSaved(),
346
- onError: (v) => y((v instanceof L, v.message))
340
+ onError: (v) => y((v instanceof I, v.message))
347
341
  }
348
342
  );
349
343
  return;
@@ -353,28 +347,28 @@ function we(e) {
353
347
  return;
354
348
  }
355
349
  p.mutate(
356
- { name: l, value: i, description: o },
350
+ { name: a, value: i, description: o },
357
351
  {
358
352
  onSuccess: () => e.onSaved(),
359
- onError: (v) => y((v instanceof L, v.message))
353
+ onError: (v) => y((v instanceof I, v.message))
360
354
  }
361
355
  );
362
356
  }
363
357
  const c = V(s, { enabled: S });
364
- return /* @__PURE__ */ a(
358
+ return /* @__PURE__ */ l(
365
359
  R,
366
360
  {
367
361
  title: e.initial ? `Rotate ${e.initial.name}` : "Add secret",
368
362
  onClose: e.onClose,
369
363
  children: [
370
- /* @__PURE__ */ a("div", { className: "modal-body", children: [
371
- /* @__PURE__ */ a("label", { className: "field", children: [
364
+ /* @__PURE__ */ l("div", { className: "modal-body", children: [
365
+ /* @__PURE__ */ l("label", { className: "field", children: [
372
366
  /* @__PURE__ */ t("span", { children: "Name" }),
373
367
  /* @__PURE__ */ t(
374
368
  "input",
375
369
  {
376
370
  type: "text",
377
- value: l,
371
+ value: a,
378
372
  disabled: n,
379
373
  onChange: (v) => h(v.target.value),
380
374
  placeholder: "e.g. openai_api_key",
@@ -384,7 +378,7 @@ function we(e) {
384
378
  ),
385
379
  !n && /* @__PURE__ */ t("span", { className: "hint", children: "Letters, digits, and underscores. Must start with a letter or underscore. Case-sensitive." })
386
380
  ] }),
387
- /* @__PURE__ */ a("label", { className: "field", children: [
381
+ /* @__PURE__ */ l("label", { className: "field", children: [
388
382
  /* @__PURE__ */ t("span", { children: n ? "New value" : "Value" }),
389
383
  /* @__PURE__ */ t(
390
384
  "textarea",
@@ -400,7 +394,7 @@ function we(e) {
400
394
  ),
401
395
  /* @__PURE__ */ t("span", { className: "hint", children: "Stored encrypted at rest. Once saved, it is not readable through the UI." })
402
396
  ] }),
403
- /* @__PURE__ */ a("label", { className: "field", children: [
397
+ /* @__PURE__ */ l("label", { className: "field", children: [
404
398
  /* @__PURE__ */ t("span", { children: "Description" }),
405
399
  /* @__PURE__ */ t(
406
400
  "input",
@@ -415,7 +409,7 @@ function we(e) {
415
409
  ] }),
416
410
  b && /* @__PURE__ */ t("div", { className: "result error", children: b })
417
411
  ] }),
418
- /* @__PURE__ */ a("div", { className: "modal-actions", children: [
412
+ /* @__PURE__ */ l("div", { className: "modal-actions", children: [
419
413
  /* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Cancel" }),
420
414
  /* @__PURE__ */ t("button", { type: "button", className: "btn", disabled: !S, onClick: s, children: C.isPending ? "Saving…" : n ? "Save changes" : "Save secret" })
421
415
  ] })
@@ -438,7 +432,7 @@ function B(e) {
438
432
  return String(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
439
433
  }
440
434
  function De(e, n) {
441
- return e === "costMinor" ? (l) => `${n} ${(l / 100).toFixed(2)}` : B;
435
+ return e === "costMinor" ? (a) => `${n} ${(a / 100).toFixed(2)}` : B;
442
436
  }
443
437
  function xe(e) {
444
438
  return e.costMinor != null ? "costMinor" : e.tokens != null ? "tokens" : e.requests != null ? "requests" : null;
@@ -446,35 +440,35 @@ function xe(e) {
446
440
  function $e(e) {
447
441
  return e.costMinor == null ? null : `${e.currency ?? "USD"} ${(e.costMinor / 100).toFixed(2)}`;
448
442
  }
449
- function Ie(e) {
443
+ function Le(e) {
450
444
  const n = [];
451
445
  e.requests != null && n.push(`${B(e.requests)} requests`), e.tokens != null && n.push(`${B(e.tokens)} tokens`);
452
- const l = $e(e);
453
- return l != null && n.push(l), n.length === 0 ? "no limit" : n.join(" · ");
446
+ const a = $e(e);
447
+ return a != null && n.push(a), n.length === 0 ? "no limit" : n.join(" · ");
454
448
  }
455
- function I(e) {
449
+ function L(e) {
456
450
  return e.scopeId == null ? `this ${e.scopeKind}` : `${e.scopeKind} ${e.scopeId}`;
457
451
  }
458
452
  function le(e) {
459
- return e instanceof L || e instanceof Error ? e.message : String(e);
453
+ return e instanceof I || e instanceof Error ? e.message : String(e);
460
454
  }
461
455
  function q(e) {
462
456
  const n = e.trim();
463
457
  if (n === "") return null;
464
- const l = Number(n);
465
- return Number.isFinite(l) ? l : null;
458
+ const a = Number(n);
459
+ return Number.isFinite(a) ? a : null;
466
460
  }
467
- function Ke(e) {
461
+ function Fe(e) {
468
462
  var S;
469
- const n = ae(e.projectId), [l, h] = m(null), [i, f] = m(null), [o, g] = m(null), b = be(n ?? void 0), y = pe(), p = b.data ?? [], N = n != null, C = [
463
+ const n = ae(e.projectId), [a, h] = m(null), [i, f] = m(null), [o, g] = m(null), b = be(n ?? void 0), y = pe(), p = b.data ?? [], N = n != null, C = [
470
464
  {
471
465
  key: "scope",
472
466
  header: "Scope",
473
- render: (s) => /* @__PURE__ */ a("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
474
- /* @__PURE__ */ t("strong", { className: "list-name", title: I(s), children: s.scopeKind }),
467
+ render: (s) => /* @__PURE__ */ l("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
468
+ /* @__PURE__ */ t("strong", { className: "list-name", title: L(s), children: s.scopeKind }),
475
469
  " ",
476
470
  /* @__PURE__ */ t("span", { className: s.onBreach === "warn" ? "tag warn" : "tag", children: s.onBreach }),
477
- /* @__PURE__ */ t("div", { className: "muted small list-preview", title: I(s), children: s.scopeId == null ? `the whole ${s.scopeKind}` : s.scopeId })
471
+ /* @__PURE__ */ t("div", { className: "muted small list-preview", title: L(s), children: s.scopeId == null ? `the whole ${s.scopeKind}` : s.scopeId })
478
472
  ] })
479
473
  },
480
474
  {
@@ -485,20 +479,21 @@ function Ke(e) {
485
479
  {
486
480
  key: "limits",
487
481
  header: "Limit",
488
- render: (s) => /* @__PURE__ */ t("span", { className: "muted small", children: Ie(s.limits) })
482
+ render: (s) => /* @__PURE__ */ t("span", { className: "muted small", children: Le(s.limits) })
489
483
  },
490
484
  {
491
485
  key: "usage",
492
486
  header: "Used",
493
487
  // Rows only exist once the project-scoped query ran, so `project` is set here.
494
- render: (s) => n == null ? null : /* @__PURE__ */ t(Le, { budget: s, projectId: n })
488
+ render: (s) => n == null ? null : /* @__PURE__ */ t(Ie, { budget: s, projectId: n })
495
489
  },
496
490
  {
497
491
  key: "actions",
498
492
  header: "",
499
493
  align: "right",
500
494
  link: !1,
501
- render: (s) => /* @__PURE__ */ a("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)" }, children: [
495
+ actions: !0,
496
+ render: (s) => /* @__PURE__ */ l("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)" }, children: [
502
497
  /* @__PURE__ */ t(
503
498
  T,
504
499
  {
@@ -519,9 +514,9 @@ function Ke(e) {
519
514
  ] })
520
515
  }
521
516
  ];
522
- return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ a("section", { className: "section", children: [
523
- /* @__PURE__ */ a("div", { className: "section-head", children: [
524
- /* @__PURE__ */ a("div", { children: [
517
+ return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
518
+ /* @__PURE__ */ l("div", { className: "section-head", children: [
519
+ /* @__PURE__ */ l("div", { children: [
525
520
  /* @__PURE__ */ t("h3", { children: "Model budgets" }),
526
521
  /* @__PURE__ */ t("p", { className: "muted small", children: "Caps on what a tenant, account, project, route or connection may spend. A breached budget either warns or blocks the call, per its own setting." })
527
522
  ] }),
@@ -538,7 +533,7 @@ function Ke(e) {
538
533
  )
539
534
  ] }),
540
535
  o && /* @__PURE__ */ t("div", { className: "result error", role: "alert", "data-testid": "model-budget-delete-error", children: o }),
541
- /* @__PURE__ */ a("div", { children: [
536
+ /* @__PURE__ */ l("div", { children: [
542
537
  b.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
543
538
  ((S = b.data) == null ? void 0 : S.length) === 0 && /* @__PURE__ */ t(P, { testId: "model-budgets-empty", children: "No model budgets yet. Add one to cap spend or request volume." }),
544
539
  p.length > 0 && /* @__PURE__ */ t(
@@ -551,11 +546,11 @@ function Ke(e) {
551
546
  }
552
547
  )
553
548
  ] }),
554
- l != null && n != null && /* @__PURE__ */ t(
549
+ a != null && n != null && /* @__PURE__ */ t(
555
550
  qe,
556
551
  {
557
552
  project: n,
558
- initial: l.budget,
553
+ initial: a.budget,
559
554
  onClose: () => h(null),
560
555
  onSaved: () => h(null)
561
556
  }
@@ -564,7 +559,7 @@ function Ke(e) {
564
559
  O,
565
560
  {
566
561
  title: "Delete model budget",
567
- message: `Delete the budget on ${I(i)}? Calls stop being capped by it immediately.`,
562
+ message: `Delete the budget on ${L(i)}? Calls stop being capped by it immediately.`,
568
563
  confirmLabel: "Delete",
569
564
  onConfirm: () => {
570
565
  const s = i;
@@ -572,7 +567,7 @@ function Ke(e) {
572
567
  { project: n, id: s.id },
573
568
  {
574
569
  onError: (c) => g(
575
- `Could not delete the budget on ${I(s)}: ${le(c)}`
570
+ `Could not delete the budget on ${L(s)}: ${le(c)}`
576
571
  )
577
572
  }
578
573
  ), f(null);
@@ -582,33 +577,33 @@ function Ke(e) {
582
577
  )
583
578
  ] }) });
584
579
  }
585
- function Le(e) {
580
+ function Ie(e) {
586
581
  const n = Ne(e.budget.id, e.projectId);
587
582
  if (n.isLoading) return /* @__PURE__ */ t("span", { className: "muted small", children: "Loading…" });
588
- const l = n.data;
589
- if (l == null) return /* @__PURE__ */ t("span", { className: "muted small", children: "—" });
590
- const h = l.limits ?? e.budget.limits, i = xe(h);
583
+ const a = n.data;
584
+ if (a == null) return /* @__PURE__ */ t("span", { className: "muted small", children: "—" });
585
+ const h = a.limits ?? e.budget.limits, i = xe(h);
591
586
  return i == null ? /* @__PURE__ */ t("span", { className: "muted small", children: "no limit" }) : /* @__PURE__ */ t(
592
587
  se,
593
588
  {
594
589
  label: ke[i],
595
- used: l.used[i],
590
+ used: a.used[i],
596
591
  limit: h[i] ?? 0,
597
- reserved: l.reserved[i],
592
+ reserved: a.reserved[i],
598
593
  format: De(i, h.currency ?? "USD"),
599
594
  testId: `model-budget-meter-${e.budget.id}`
600
595
  }
601
596
  );
602
597
  }
603
598
  function qe(e) {
604
- var K, Q, _, J, G, H, Y, z;
605
- const n = !!e.initial, [l, h] = m(((K = e.initial) == null ? void 0 : K.scopeKind) ?? "project"), [i, f] = m(((Q = e.initial) == null ? void 0 : Q.scopeId) ?? ""), [o, g] = m(((_ = e.initial) == null ? void 0 : _.window) ?? "day"), [b, y] = m(
599
+ var F, Q, _, J, H, Y, z, G;
600
+ const n = !!e.initial, [a, h] = m(((F = e.initial) == null ? void 0 : F.scopeKind) ?? "project"), [i, f] = m(((Q = e.initial) == null ? void 0 : Q.scopeId) ?? ""), [o, g] = m(((_ = e.initial) == null ? void 0 : _.window) ?? "day"), [b, y] = m(
606
601
  ((J = e.initial) == null ? void 0 : J.limits.requests) != null ? String(e.initial.limits.requests) : ""
607
602
  ), [p, N] = m(
608
- ((G = e.initial) == null ? void 0 : G.limits.tokens) != null ? String(e.initial.limits.tokens) : ""
603
+ ((H = e.initial) == null ? void 0 : H.limits.tokens) != null ? String(e.initial.limits.tokens) : ""
609
604
  ), [C, S] = m(
610
- ((H = e.initial) == null ? void 0 : H.limits.costMinor) != null ? String(e.initial.limits.costMinor / 100) : ""
611
- ), [s, c] = m(((Y = e.initial) == null ? void 0 : Y.limits.currency) ?? ""), [w, u] = m(((z = e.initial) == null ? void 0 : z.onBreach) ?? "warn"), [k, v] = m(null), E = fe(), d = ye(), j = E.isPending || d.isPending, M = je(l), W = !!l && !!o && (!M || n || i.trim() !== "") && !j;
605
+ ((Y = e.initial) == null ? void 0 : Y.limits.costMinor) != null ? String(e.initial.limits.costMinor / 100) : ""
606
+ ), [s, c] = m(((z = e.initial) == null ? void 0 : z.limits.currency) ?? ""), [w, u] = m(((G = e.initial) == null ? void 0 : G.onBreach) ?? "warn"), [k, v] = m(null), E = fe(), d = ye(), j = E.isPending || d.isPending, M = je(a), K = !!a && !!o && (!M || n || i.trim() !== "") && !j;
612
607
  function ie() {
613
608
  const r = {}, x = q(b);
614
609
  x != null && (r.requests = x);
@@ -617,7 +612,7 @@ function qe(e) {
617
612
  const X = q(C);
618
613
  return X != null && (r.costMinor = Math.round(X * 100)), r.costMinor != null && s.trim() !== "" && (r.currency = s.trim()), Object.keys(r).length === 0 ? null : r;
619
614
  }
620
- function F() {
615
+ function W() {
621
616
  const r = ie();
622
617
  if (r == null) {
623
618
  v("Set at least one limit: requests, tokens or cost.");
@@ -639,7 +634,7 @@ function qe(e) {
639
634
  {
640
635
  project: e.project,
641
636
  input: {
642
- scopeKind: l,
637
+ scopeKind: a,
643
638
  // Only route/connection budgets carry a scope id; the server refuses one elsewhere.
644
639
  ...M ? { scopeId: i.trim() } : {},
645
640
  window: o,
@@ -650,29 +645,29 @@ function qe(e) {
650
645
  x
651
646
  );
652
647
  }
653
- const D = V(F, { enabled: W });
654
- return /* @__PURE__ */ a(R, { title: e.initial ? "Edit model budget" : "Add model budget", onClose: e.onClose, children: [
655
- /* @__PURE__ */ a("div", { className: "modal-body", children: [
656
- /* @__PURE__ */ a("label", { className: "field", children: [
648
+ const D = V(W, { enabled: K });
649
+ return /* @__PURE__ */ l(R, { title: e.initial ? "Edit model budget" : "Add model budget", onClose: e.onClose, children: [
650
+ /* @__PURE__ */ l("div", { className: "modal-body", children: [
651
+ /* @__PURE__ */ l("label", { className: "field", children: [
657
652
  /* @__PURE__ */ t("span", { children: "Scope" }),
658
- /* @__PURE__ */ a(
653
+ /* @__PURE__ */ l(
659
654
  "select",
660
655
  {
661
- value: l,
656
+ value: a,
662
657
  disabled: n,
663
658
  onChange: (r) => h(r.target.value),
664
659
  "data-testid": "model-budget-scope-kind",
665
660
  children: [
666
- !ee.includes(l) && /* @__PURE__ */ t("option", { value: l, children: l }),
661
+ !ee.includes(a) && /* @__PURE__ */ t("option", { value: a, children: a }),
667
662
  ee.map((r) => /* @__PURE__ */ t("option", { value: r, children: Ee[r] }, r))
668
663
  ]
669
664
  }
670
665
  ),
671
666
  !n && /* @__PURE__ */ t("span", { className: "hint", children: "What the budget caps — this tenant, account or project as a whole, or one model route or connection. Fixed once created." })
672
667
  ] }),
673
- M && /* @__PURE__ */ a("label", { className: "field", children: [
674
- /* @__PURE__ */ a("span", { children: [
675
- l === "route" ? "Route" : "Connection id",
668
+ M && /* @__PURE__ */ l("label", { className: "field", children: [
669
+ /* @__PURE__ */ l("span", { children: [
670
+ a === "route" ? "Route" : "Connection id",
676
671
  " *"
677
672
  ] }),
678
673
  /* @__PURE__ */ t(
@@ -682,16 +677,16 @@ function qe(e) {
682
677
  value: i,
683
678
  disabled: n,
684
679
  onChange: (r) => f(r.target.value),
685
- placeholder: l === "route" ? "e.g. fast" : "e.g. conn_…",
680
+ placeholder: a === "route" ? "e.g. fast" : "e.g. conn_…",
686
681
  "data-testid": "model-budget-scope-id",
687
682
  ...D
688
683
  }
689
684
  ),
690
- !n && /* @__PURE__ */ t("span", { className: "hint", children: l === "route" ? "The route's name or id. Required for a route budget." : "The model-provider connection's id. Required for a connection budget." })
685
+ !n && /* @__PURE__ */ t("span", { className: "hint", children: a === "route" ? "The route's name or id. Required for a route budget." : "The model-provider connection's id. Required for a connection budget." })
691
686
  ] }),
692
- /* @__PURE__ */ a("label", { className: "field", children: [
687
+ /* @__PURE__ */ l("label", { className: "field", children: [
693
688
  /* @__PURE__ */ t("span", { children: "Window" }),
694
- /* @__PURE__ */ a(
689
+ /* @__PURE__ */ l(
695
690
  "select",
696
691
  {
697
692
  value: o,
@@ -705,7 +700,7 @@ function qe(e) {
705
700
  ),
706
701
  /* @__PURE__ */ t("span", { className: "hint", children: "The period the limits reset over, in UTC." })
707
702
  ] }),
708
- /* @__PURE__ */ a("label", { className: "field", children: [
703
+ /* @__PURE__ */ l("label", { className: "field", children: [
709
704
  /* @__PURE__ */ t("span", { children: "Requests" }),
710
705
  /* @__PURE__ */ t(
711
706
  "input",
@@ -720,7 +715,7 @@ function qe(e) {
720
715
  }
721
716
  )
722
717
  ] }),
723
- /* @__PURE__ */ a("label", { className: "field", children: [
718
+ /* @__PURE__ */ l("label", { className: "field", children: [
724
719
  /* @__PURE__ */ t("span", { children: "Tokens" }),
725
720
  /* @__PURE__ */ t(
726
721
  "input",
@@ -735,7 +730,7 @@ function qe(e) {
735
730
  }
736
731
  )
737
732
  ] }),
738
- /* @__PURE__ */ a("label", { className: "field", children: [
733
+ /* @__PURE__ */ l("label", { className: "field", children: [
739
734
  /* @__PURE__ */ t("span", { children: "Cost" }),
740
735
  /* @__PURE__ */ t(
741
736
  "input",
@@ -752,7 +747,7 @@ function qe(e) {
752
747
  ),
753
748
  /* @__PURE__ */ t("span", { className: "hint", children: "In major units of the currency below (12.50 = 12.50 USD)." })
754
749
  ] }),
755
- /* @__PURE__ */ a("label", { className: "field", children: [
750
+ /* @__PURE__ */ l("label", { className: "field", children: [
756
751
  /* @__PURE__ */ t("span", { children: "Currency" }),
757
752
  /* @__PURE__ */ t(
758
753
  "input",
@@ -767,7 +762,7 @@ function qe(e) {
767
762
  }
768
763
  )
769
764
  ] }),
770
- /* @__PURE__ */ a("label", { className: "field", children: [
765
+ /* @__PURE__ */ l("label", { className: "field", children: [
771
766
  /* @__PURE__ */ t("span", { children: "On breach" }),
772
767
  /* @__PURE__ */ t(
773
768
  "select",
@@ -782,15 +777,15 @@ function qe(e) {
782
777
  ] }),
783
778
  k && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "model-budget-error", children: k })
784
779
  ] }),
785
- /* @__PURE__ */ a("div", { className: "modal-actions", children: [
780
+ /* @__PURE__ */ l("div", { className: "modal-actions", children: [
786
781
  /* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Cancel" }),
787
782
  /* @__PURE__ */ t(
788
783
  "button",
789
784
  {
790
785
  type: "button",
791
786
  className: "btn",
792
- disabled: !W,
793
- onClick: F,
787
+ disabled: !K,
788
+ onClick: W,
794
789
  "data-testid": "model-budget-save",
795
790
  children: j ? "Saving…" : n ? "Save changes" : "Save budget"
796
791
  }
@@ -800,10 +795,10 @@ function qe(e) {
800
795
  }
801
796
  export {
802
797
  Je as CreateEndpointModal,
803
- Ge as CreateFunctionModal,
804
- Ke as ModelBudgetsManager,
805
- Ye as ModelRoutesManager,
806
- Fe as SecretsManager,
807
- We as VarsManager
798
+ He as CreateFunctionModal,
799
+ Fe as ModelBudgetsManager,
800
+ ze as ModelRoutesManager,
801
+ We as SecretsManager,
802
+ Ke as VarsManager
808
803
  };
809
804
  //# sourceMappingURL=forms.mjs.map