@w6w/embed 0.2.34 → 0.2.35

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 (74) hide show
  1. package/dist/{CreateFunctionModal-glk2zg1r.js → CreateFunctionModal-CYNHJUGJ.js} +3 -3
  2. package/dist/{CreateFunctionModal-glk2zg1r.js.map → CreateFunctionModal-CYNHJUGJ.js.map} +1 -1
  3. package/dist/{DocumentFormModal-B3OkvI5v.js → DocumentFormModal-CLmdGx34.js} +2 -2
  4. package/dist/{DocumentFormModal-B3OkvI5v.js.map → DocumentFormModal-CLmdGx34.js.map} +1 -1
  5. package/dist/ImportSpecModal-BzEyiNWD.js +378 -0
  6. package/dist/ImportSpecModal-BzEyiNWD.js.map +1 -0
  7. package/dist/WorkflowEditor-CxTuK8_d.js +1272 -0
  8. package/dist/WorkflowEditor-CxTuK8_d.js.map +1 -0
  9. package/dist/{apps-CFWdgGst.js → apps-CyEszfIu.js} +33 -33
  10. package/dist/{apps-CFWdgGst.js.map → apps-CyEszfIu.js.map} +1 -1
  11. package/dist/callable-row-actions-BPBPflMn.js +56 -0
  12. package/dist/callable-row-actions-BPBPflMn.js.map +1 -0
  13. package/dist/callables-dLF2IcwA.js +317 -0
  14. package/dist/callables-dLF2IcwA.js.map +1 -0
  15. package/dist/chrome/TagEditor.d.ts +6 -1
  16. package/dist/chrome/workspace.d.ts +16 -0
  17. package/dist/documents-hgltn0xe.js +1017 -0
  18. package/dist/documents-hgltn0xe.js.map +1 -0
  19. package/dist/draft.mjs +1 -1
  20. package/dist/editor/WaitingForm.d.ts +19 -0
  21. package/dist/{editor-apps-ShwCmvLY.js → editor-apps-DsGrGKfe.js} +3 -3
  22. package/dist/{editor-apps-ShwCmvLY.js.map → editor-apps-DsGrGKfe.js.map} +1 -1
  23. package/dist/{editor-tools-rY9nddqr.js → editor-tools-Ct7YPPj8.js} +682 -784
  24. package/dist/editor-tools-Ct7YPPj8.js.map +1 -0
  25. package/dist/editor.mjs +1 -1
  26. package/dist/editors.mjs +18 -18
  27. package/dist/{endpoints-zOuwci2U.js → endpoints-DJxXRh-I.js} +12 -12
  28. package/dist/{endpoints-zOuwci2U.js.map → endpoints-DJxXRh-I.js.map} +1 -1
  29. package/dist/forms.mjs +1 -1
  30. package/dist/index.mjs +140 -115
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/lib/callable-row-actions.d.ts +17 -0
  33. package/dist/lib/index.d.ts +2 -0
  34. package/dist/lib/run-event-stream.d.ts +122 -0
  35. package/dist/lib/tag-editor.d.ts +6 -0
  36. package/dist/lib/workflow-live-run.d.ts +7 -0
  37. package/dist/lib/workflow-validity.d.ts +7 -1
  38. package/dist/lib.mjs +52 -47
  39. package/dist/lists/CallableKindList.d.ts +12 -0
  40. package/dist/lists/CallableRowParts.d.ts +8 -1
  41. package/dist/lists/EndpointList.d.ts +3 -0
  42. package/dist/lists/FunctionList.d.ts +3 -0
  43. package/dist/lists/WorkflowList.d.ts +3 -0
  44. package/dist/lists.d.ts +1 -0
  45. package/dist/lists.mjs +1589 -1513
  46. package/dist/lists.mjs.map +1 -1
  47. package/dist/rail.mjs +1 -1
  48. package/dist/repos/callables.d.ts +25 -0
  49. package/dist/repos/documents.d.ts +9 -1
  50. package/dist/repos/saved-file-names.d.ts +10 -0
  51. package/dist/repos/workflows.d.ts +19 -13
  52. package/dist/repos.mjs +333 -328
  53. package/dist/{setup-incomplete-BHs3Lpfy.js → setup-incomplete-6PAbN0EW.js} +50 -49
  54. package/dist/setup-incomplete-6PAbN0EW.js.map +1 -0
  55. package/dist/spec-import-BKyfhTYG.js +200 -0
  56. package/dist/spec-import-BKyfhTYG.js.map +1 -0
  57. package/dist/{use-callable-draft-w4tDTYcb.js → use-callable-draft-7HwfTuYQ.js} +3 -3
  58. package/dist/{use-callable-draft-w4tDTYcb.js.map → use-callable-draft-7HwfTuYQ.js.map} +1 -1
  59. package/package.json +3 -3
  60. package/src/styles.css +43 -0
  61. package/dist/ImportSpecModal-SQvTwtcX.js +0 -252
  62. package/dist/ImportSpecModal-SQvTwtcX.js.map +0 -1
  63. package/dist/WorkflowEditor-D2EfEP-U.js +0 -1201
  64. package/dist/WorkflowEditor-D2EfEP-U.js.map +0 -1
  65. package/dist/callable-record-Bhxim8C1.js +0 -14
  66. package/dist/callable-record-Bhxim8C1.js.map +0 -1
  67. package/dist/callables-B49tS2vv.js +0 -297
  68. package/dist/callables-B49tS2vv.js.map +0 -1
  69. package/dist/editor-tools-rY9nddqr.js.map +0 -1
  70. package/dist/setup-incomplete-BHs3Lpfy.js.map +0 -1
  71. package/dist/spec-import-CPbDnnuv.js +0 -272
  72. package/dist/spec-import-CPbDnnuv.js.map +0 -1
  73. package/dist/workflows-RhR8kwt7.js +0 -667
  74. package/dist/workflows-RhR8kwt7.js.map +0 -1
@@ -1,273 +1,272 @@
1
- import { jsx as n, jsxs as r, Fragment as V } from "react/jsx-runtime";
2
- import { r as Cn, l as We, m as $e, d as Re, e as En, h as je, c as An } from "./import-bindings-EUtxZ9Ti.js";
3
- import { useContext as ve, useState as u, useMemo as Fe, useEffect as be, createContext as He, useRef as qe } from "react";
4
- import { ExpressionOptionsProvider as Je, Icon as K, RetryPolicyFields as Pn, StepBuilderModal as Tn, IconButton as Se, useEnterSubmit as In, CodeBlock as ge, DeleteButton as Dn, EditButton as On, ConfirmModal as Le, JsonEditor as Mn, useExpressionOptions as Rn, ExpressionInput as jn, ResultViewer as Ln } from "@w6w/ui";
5
- import { d as Vn, p as Qn, i as Wn, t as $n, e as Ve, a as Fn, h as Hn, s as qn } from "./document-sources-Khcw2zB5.js";
6
- import { u as Jn, a as Be } from "./spec-export-BtnoV0ex.js";
7
- import { i as Bn, f as Kn, e as Un, b as zn, u as _n } from "./vault-BSEWhMYC.js";
8
- import { k as Gn, q as Yn, n as Zn, l as Xn, r as Ke, m as Ue, o as ze } from "./spec-import-CPbDnnuv.js";
9
- import { s as xn, M as B, c as et, C as nt } from "./ConfirmModal-WqBfWftD.js";
10
- import { u as tt, i as it, f as st } from "./slug-BVdgiP_L.js";
11
- import { WorkflowConnectionsPanel as at } from "@w6w/ui/flow";
12
- import { ApiError as j } from "@w6w/sdk";
13
- import { c as _e } from "./callable-record-Bhxim8C1.js";
14
- import { i as rt, d as ot, p as lt } from "./settings-rail-gUU2ZbSw.js";
15
- import { s as Ge, r as Ye, v as Ze, t as Xe, b as xe, d as dt, g as ct, u as ut, q as ht, p as ft, o as mt, n as pt } from "./endpoints-zOuwci2U.js";
16
- import { a3 as en, a2 as gt, a0 as vt, T as bt, W as yt, a6 as kt, $ as wt, X as Nt, Z as St, M as Ct, K as Et } from "./workflows-RhR8kwt7.js";
17
- import { j as At } from "./callables-B49tS2vv.js";
18
- import { I as nn } from "./ImportSpecModal-SQvTwtcX.js";
19
- import { useQueryClient as Pt } from "@tanstack/react-query";
20
- import { foldStateLog as Tt } from "@w6w/expr";
21
- const ye = He(null);
22
- function Fi({
1
+ import { jsx as n, jsxs as r, Fragment as R } from "react/jsx-runtime";
2
+ import { r as Cn, l as Qe, m as We, d as Me, e as En, h as Re, c as An } from "./import-bindings-EUtxZ9Ti.js";
3
+ import { useContext as ge, useState as f, useMemo as $e, useEffect as ve, createContext as He, useRef as Fe } from "react";
4
+ import { ExpressionOptionsProvider as qe, Icon as J, RetryPolicyFields as Pn, StepBuilderModal as In, CodeBlock as pe, DeleteButton as Dn, EditButton as Tn, IconButton as Be, ConfirmModal as je, JsonEditor as On, useExpressionOptions as Mn, ExpressionInput as Rn, ResultViewer as jn } from "@w6w/ui";
5
+ import { d as Ln, p as Vn, i as Qn, t as Wn, e as Le, a as $n, h as Hn, s as Fn } from "./document-sources-Khcw2zB5.js";
6
+ import { u as qn, a as Je } from "./spec-export-BtnoV0ex.js";
7
+ import { i as Bn, f as Jn, e as Kn, b as Un, u as zn } from "./vault-BSEWhMYC.js";
8
+ import { a3 as _n, ad as Ke, ac as Gn, a9 as Yn, Z as Zn, a1 as Xn, ag as xn, a8 as et, a4 as nt, a6 as tt, U as it, Q as st } from "./documents-hgltn0xe.js";
9
+ import { s as at, M as B, c as rt, C as ot } from "./ConfirmModal-WqBfWftD.js";
10
+ import { u as lt } from "./slug-BVdgiP_L.js";
11
+ import { WorkflowConnectionsPanel as dt } from "@w6w/ui/flow";
12
+ import { ApiError as M } from "@w6w/sdk";
13
+ import { c as Ue } from "./callable-row-actions-BPBPflMn.js";
14
+ import { i as ct, d as ut, p as ht } from "./settings-rail-gUU2ZbSw.js";
15
+ import { s as ze, r as _e, v as Ge, t as Ye, b as Ze, d as ft, g as mt, u as pt, q as gt, p as vt, o as bt, n as kt } from "./endpoints-DJxXRh-I.js";
16
+ import { C as Xe, I as xe } from "./ImportSpecModal-BzEyiNWD.js";
17
+ import { h as wt, e as yt, c as Nt, i as en, d as nn, f as tn } from "./spec-import-BKyfhTYG.js";
18
+ import { useQueryClient as St } from "@tanstack/react-query";
19
+ import { foldStateLog as Ct } from "@w6w/expr";
20
+ const be = He(null);
21
+ function Mi({
23
22
  children: e,
24
- base: t = null
23
+ base: i = null
25
24
  }) {
26
- const [i, s] = u(null), a = i ?? t, o = Fe(() => ({ resource: a, setCallable: s }), [a]);
27
- return /* @__PURE__ */ n(ye.Provider, { value: o, children: e });
25
+ const [s, t] = f(null), a = s ?? i, l = $e(() => ({ resource: a, setCallable: t }), [a]);
26
+ return /* @__PURE__ */ n(be.Provider, { value: l, children: e });
28
27
  }
29
- function Hi() {
30
- return ve(ye) !== null;
28
+ function Ri() {
29
+ return ge(be) !== null;
31
30
  }
32
- function qi(e) {
33
- const t = ve(ye);
34
- if (!t) throw new Error("useWorkspace must be used within <WorkspaceProvider>");
35
- const { setCallable: i } = t, s = e ? JSON.stringify(e) : "";
36
- be(() => (i(e), () => i(null)), [s, i]);
31
+ function ji(e) {
32
+ const i = ge(be);
33
+ if (!i) throw new Error("useWorkspace must be used within <WorkspaceProvider>");
34
+ const { setCallable: s } = i, t = e ? JSON.stringify(e) : "";
35
+ ve(() => (s(e), () => s(null)), [t, s]);
37
36
  }
38
- function It() {
39
- const e = ve(ye);
37
+ function Et() {
38
+ const e = ge(be);
40
39
  if (!e) throw new Error("useWorkspaceCallable must be used within <WorkspaceProvider>");
41
40
  return e.resource;
42
41
  }
43
- const tn = { open: !1, activeTool: null };
44
- function Dt(e) {
45
- if (typeof localStorage > "u") return tn;
46
- const t = localStorage.getItem(e), { activeTool: i } = Cn(t);
47
- return { open: !1, activeTool: i };
42
+ const sn = { open: !1, activeTool: null };
43
+ function At(e) {
44
+ if (typeof localStorage > "u") return sn;
45
+ const i = localStorage.getItem(e), { activeTool: s } = Cn(i);
46
+ return { open: !1, activeTool: s };
48
47
  }
49
- function sn({
48
+ function an({
50
49
  tools: e,
51
- ctx: t,
52
- state: i,
53
- onToggle: s
50
+ ctx: i,
51
+ state: s,
52
+ onToggle: t
54
53
  }) {
55
- const a = i.open ? e.find((l) => l.id === i.activeTool && l.Panel) ?? null : null, o = a == null ? void 0 : a.Panel;
54
+ const a = s.open ? e.find((o) => o.id === s.activeTool && o.Panel) ?? null : null, l = a == null ? void 0 : a.Panel;
56
55
  return /* @__PURE__ */ r("aside", { className: "right-rail", children: [
57
- /* @__PURE__ */ n("div", { className: "right-rail-strip", children: e.map((l) => {
58
- var d;
56
+ /* @__PURE__ */ n("div", { className: "right-rail-strip", children: e.map((o) => {
57
+ var c;
59
58
  return /* @__PURE__ */ r(
60
59
  "button",
61
60
  {
62
61
  type: "button",
63
- "data-testid": `rail-tool-${l.id}`,
64
- className: `right-rail-tool-btn${(a == null ? void 0 : a.id) === l.id ? " active" : ""}`,
65
- title: l.title,
66
- "aria-label": l.title,
67
- "aria-pressed": l.onActivate ? void 0 : (a == null ? void 0 : a.id) === l.id,
68
- onClick: () => l.onActivate ? l.onActivate(t) : s(l.id),
62
+ "data-testid": `rail-tool-${o.id}`,
63
+ className: `right-rail-tool-btn${(a == null ? void 0 : a.id) === o.id ? " active" : ""}`,
64
+ title: o.title,
65
+ "aria-label": o.title,
66
+ "aria-pressed": o.onActivate ? void 0 : (a == null ? void 0 : a.id) === o.id,
67
+ onClick: () => o.onActivate ? o.onActivate(i) : t(o.id),
69
68
  children: [
70
- /* @__PURE__ */ n(l.Icon, {}),
71
- ((d = l.hasIndicator) == null ? void 0 : d.call(l, t)) && /* @__PURE__ */ n(
69
+ /* @__PURE__ */ n(o.Icon, {}),
70
+ ((c = o.hasIndicator) == null ? void 0 : c.call(o, i)) && /* @__PURE__ */ n(
72
71
  "span",
73
72
  {
74
73
  className: "right-rail-tool-dot",
75
- "data-testid": `rail-tool-${l.id}-dot`,
74
+ "data-testid": `rail-tool-${o.id}-dot`,
76
75
  "aria-hidden": "true"
77
76
  }
78
77
  )
79
78
  ]
80
79
  },
81
- l.id
80
+ o.id
82
81
  );
83
82
  }) }),
84
- a && o && /* @__PURE__ */ r("div", { className: "right-rail-panel", "data-testid": `rail-panel-${a.id}`, children: [
83
+ a && l && /* @__PURE__ */ r("div", { className: "right-rail-panel", "data-testid": `rail-panel-${a.id}`, children: [
85
84
  !a.rendersHeading && /* @__PURE__ */ n("div", { className: "right-rail-panel-head", children: /* @__PURE__ */ n("h3", { children: a.title }) }),
86
- /* @__PURE__ */ n(o, { ctx: t })
85
+ /* @__PURE__ */ n(l, { ctx: i })
87
86
  ] })
88
87
  ] });
89
88
  }
90
- function Ot({
89
+ function Pt({
91
90
  storageKey: e,
92
- tools: t,
93
- ctx: i
91
+ tools: i,
92
+ ctx: s
94
93
  }) {
95
- const [s, a] = u(() => Dt(e));
96
- be(() => {
97
- typeof localStorage > "u" || localStorage.setItem(e, JSON.stringify({ activeTool: s.activeTool }));
98
- }, [e, s.activeTool]);
99
- function o(l) {
94
+ const [t, a] = f(() => At(e));
95
+ ve(() => {
96
+ typeof localStorage > "u" || localStorage.setItem(e, JSON.stringify({ activeTool: t.activeTool }));
97
+ }, [e, t.activeTool]);
98
+ function l(o) {
100
99
  a(
101
- (d) => d.open && d.activeTool === l ? { open: !1, activeTool: l } : { open: !0, activeTool: l }
100
+ (c) => c.open && c.activeTool === o ? { open: !1, activeTool: o } : { open: !0, activeTool: o }
102
101
  );
103
102
  }
104
- return /* @__PURE__ */ n(sn, { tools: t, ctx: i, state: s, onToggle: o });
103
+ return /* @__PURE__ */ n(an, { tools: i, ctx: s, state: t, onToggle: l });
105
104
  }
106
- function Ji({
105
+ function Li({
107
106
  tools: e,
108
- storageKey: t
107
+ storageKey: i
109
108
  }) {
110
- const i = It(), s = e.filter((a) => a.isAvailable(i));
111
- return s.length === 0 ? null : t === null ? /* @__PURE__ */ n(sn, { tools: s, ctx: i, state: tn, onToggle: () => {
112
- } }) : /* @__PURE__ */ n(Ot, { storageKey: t, tools: s, ctx: i }, t);
109
+ const s = Et(), t = e.filter((a) => a.isAvailable(s));
110
+ return t.length === 0 ? null : i === null ? /* @__PURE__ */ n(an, { tools: t, ctx: s, state: sn, onToggle: () => {
111
+ } }) : /* @__PURE__ */ n(Pt, { storageKey: i, tools: t, ctx: s }, i);
113
112
  }
114
- function Mt(e) {
115
- const t = e, i = Bn(t ?? void 0, t != null), s = Kn(), a = Jn(), o = Gn(t ?? void 0, t != null), l = Un(), d = zn(), h = _n();
116
- return Fe(
113
+ function It(e) {
114
+ const i = e, s = Bn(i ?? void 0, i != null), t = Jn(), a = qn(), l = _n(i ?? void 0, i != null), o = Kn(), c = Un(), h = zn();
115
+ return $e(
117
116
  () => ({
118
- vars: (i.data ?? []).map((c) => c.name),
119
- constants: (a.data ?? []).map((c) => c.name),
120
- secrets: (s.data ?? []).map((c) => c.name),
117
+ vars: (s.data ?? []).map((d) => d.name),
118
+ constants: (a.data ?? []).map((d) => d.name),
119
+ secrets: (t.data ?? []).map((d) => d.name),
121
120
  // `document-sources.ts` owns the `format === "json"` gate and the raw
122
121
  // field enumeration — no parsing, no gate logic, and no filtering here
123
122
  // (A5c); `isRefSafeKey` filtering happens once, downstream, at the
124
123
  // modal's render site.
125
- documents: Qn(o.data ?? []),
124
+ documents: Vn(l.data ?? []),
126
125
  // Real project values so the ƒx Result preview substitutes them for
127
126
  // `var.<name>` / `const.<name>` / `documents.<key>` / `documents.<key>.<field>` refs
128
127
  // instead of the raw template.
129
128
  sampleValues: {
130
- ...Object.fromEntries((i.data ?? []).map((c) => [`var.${c.name}`, c.value])),
131
- ...Object.fromEntries((a.data ?? []).map((c) => [`const.${c.name}`, c.value])),
132
- ...Vn(o.data ?? [])
129
+ ...Object.fromEntries((s.data ?? []).map((d) => [`var.${d.name}`, d.value])),
130
+ ...Object.fromEntries((a.data ?? []).map((d) => [`const.${d.name}`, d.value])),
131
+ ...Ln(l.data ?? [])
133
132
  },
134
- sealSecret: l,
133
+ sealSecret: o,
135
134
  // A created var carries the SAME project the read above carried (B3) —
136
135
  // it must land in the project whose rail asked for it. `type: "string"`
137
136
  // is pinned (a string type's `raw` passes through untouched) — the modal
138
137
  // has no type field.
139
- createVar: (c) => d.mutateAsync({
138
+ createVar: (d) => c.mutateAsync({
140
139
  input: {
141
- name: c.name,
140
+ name: d.name,
142
141
  type: "string",
143
- value: c.value,
144
- description: c.description
142
+ value: d.value,
143
+ description: d.description
145
144
  },
146
- project: t ?? void 0
145
+ project: i ?? void 0
147
146
  }).then(() => {
148
147
  }),
149
148
  // Secrets carry NO project (B4) — `vault_secrets` has no `project`
150
149
  // column and the routes read no `?project=`. Plaintext in, the server
151
150
  // encrypts; the resolved value is referenced nowhere (B5).
152
- createSecret: (c) => h.mutateAsync({ name: c.name, value: c.value, description: c.description }).then(() => {
151
+ createSecret: (d) => h.mutateAsync({ name: d.name, value: d.value, description: d.description }).then(() => {
153
152
  })
154
153
  }),
155
154
  [
156
- i.data,
157
- a.data,
158
155
  s.data,
159
- o.data,
160
- l,
161
- d.mutateAsync,
156
+ a.data,
157
+ t.data,
158
+ l.data,
159
+ o,
160
+ c.mutateAsync,
162
161
  h.mutateAsync,
163
- t
162
+ i
164
163
  ]
165
164
  );
166
165
  }
167
- function Bi({
166
+ function Vi({
168
167
  project: e,
169
- children: t
168
+ children: i
170
169
  }) {
171
- const i = Mt(e);
172
- return /* @__PURE__ */ n(Je, { value: i, children: t });
170
+ const s = It(e);
171
+ return /* @__PURE__ */ n(qe, { value: s, children: i });
173
172
  }
174
- function Rt({ ctx: e }) {
175
- const [t, i] = u(null), s = $n(e);
176
- if (!s) return null;
177
- const a = (e == null ? void 0 : e.kind) === "workflow" ? e.triggers : void 0, o = xn(s);
178
- return o.length === 0 ? /* @__PURE__ */ n("p", { className: "muted", children: tt(s) }) : /* @__PURE__ */ r("div", { children: [
173
+ function Dt({ ctx: e }) {
174
+ const [i, s] = f(null), t = Wn(e);
175
+ if (!t) return null;
176
+ const a = (e == null ? void 0 : e.kind) === "workflow" ? e.triggers : void 0, l = at(t);
177
+ return l.length === 0 ? /* @__PURE__ */ n("p", { className: "muted", children: lt(t) }) : /* @__PURE__ */ r("div", { children: [
179
178
  /* @__PURE__ */ n("p", { className: "muted small", style: { marginTop: 0 }, children: "Call this from:" }),
180
- /* @__PURE__ */ n("div", { className: "rail-code-langs", children: o.map(({ id: l, label: d, icon: h }) => /* @__PURE__ */ r(
179
+ /* @__PURE__ */ n("div", { className: "rail-code-langs", children: l.map(({ id: o, label: c, icon: h }) => /* @__PURE__ */ r(
181
180
  "button",
182
181
  {
183
182
  type: "button",
184
183
  className: "rail-code-lang",
185
- "data-testid": `rail-code-lang-${l}`,
186
- title: `Show the ${d} snippet`,
187
- "aria-label": `Show the ${d} snippet`,
188
- onClick: () => i(l),
184
+ "data-testid": `rail-code-lang-${o}`,
185
+ title: `Show the ${c} snippet`,
186
+ "aria-label": `Show the ${c} snippet`,
187
+ onClick: () => s(o),
189
188
  children: [
190
- /* @__PURE__ */ n(K, { name: h, size: 20 }),
191
- /* @__PURE__ */ n("span", { children: d })
189
+ /* @__PURE__ */ n(J, { name: h, size: 20 }),
190
+ /* @__PURE__ */ n("span", { children: c })
192
191
  ]
193
192
  },
194
- l
193
+ o
195
194
  )) }),
196
- t !== null && /* @__PURE__ */ n(B, { title: "Call from code", wide: !0, onClose: () => i(null), children: /* @__PURE__ */ n("div", { style: { height: 450 }, children: /* @__PURE__ */ n(et, { resource: s, triggers: a, initialTab: t }) }) })
195
+ i !== null && /* @__PURE__ */ n(B, { title: "Call from code", wide: !0, onClose: () => s(null), children: /* @__PURE__ */ n("div", { style: { height: 450 }, children: /* @__PURE__ */ n(rt, { resource: t, triggers: a, initialTab: i }) }) })
197
196
  ] });
198
197
  }
199
- function jt() {
200
- return /* @__PURE__ */ n(K, { name: "code" });
198
+ function Tt() {
199
+ return /* @__PURE__ */ n(J, { name: "code" });
201
200
  }
202
- const Lt = {
201
+ const Ot = {
203
202
  id: "code",
204
203
  title: "Code",
205
- Icon: jt,
206
- isAvailable: (e) => Wn(e),
207
- Panel: Rt
208
- }, Vt = {
204
+ Icon: Tt,
205
+ isAvailable: (e) => Qn(e),
206
+ Panel: Dt
207
+ }, Mt = {
209
208
  id: "connections",
210
209
  title: "Connections",
211
210
  rendersHeading: !0,
212
- Icon: () => /* @__PURE__ */ n(K, { name: "plug" }),
211
+ Icon: () => /* @__PURE__ */ n(J, { name: "plug" }),
213
212
  isAvailable: (e) => (e == null ? void 0 : e.kind) === "workflow" && !!e.connectionResources,
214
213
  hasIndicator: (e) => {
215
- var t;
216
- return (e == null ? void 0 : e.kind) === "workflow" && Object.keys(((t = e.connectionResources) == null ? void 0 : t.connections) ?? {}).length > 0;
214
+ var i;
215
+ return (e == null ? void 0 : e.kind) === "workflow" && Object.keys(((i = e.connectionResources) == null ? void 0 : i.connections) ?? {}).length > 0;
217
216
  },
218
- Panel: ({ ctx: e }) => (e == null ? void 0 : e.kind) === "workflow" && e.connectionResources ? /* @__PURE__ */ n(at, { resources: e.connectionResources }, e.id) : null
219
- }, Qt = { project: null, onNavigate: () => {
220
- } }, an = He(Qt);
221
- function Ki({
217
+ Panel: ({ ctx: e }) => (e == null ? void 0 : e.kind) === "workflow" && e.connectionResources ? /* @__PURE__ */ n(dt, { resources: e.connectionResources }, e.id) : null
218
+ }, Rt = { project: null, onNavigate: () => {
219
+ } }, rn = He(Rt);
220
+ function Qi({
222
221
  project: e,
223
- onNavigate: t,
224
- children: i
222
+ onNavigate: i,
223
+ children: s
225
224
  }) {
226
- return /* @__PURE__ */ n(an.Provider, { value: { project: e, onNavigate: t }, children: i });
225
+ return /* @__PURE__ */ n(rn.Provider, { value: { project: e, onNavigate: i }, children: s });
227
226
  }
228
- function rn() {
229
- return ve(an);
227
+ function on() {
228
+ return ge(rn);
230
229
  }
231
- const Wt = "@w6w/call";
232
- function Qe(e) {
230
+ const jt = "@w6w/call";
231
+ function Ve(e) {
233
232
  return e ? e.kind === "workflow" ? e.workflow : e.kind === "function" ? e.function : `${e.uses.app}/${e.uses.action}` : "";
234
233
  }
235
- function $t(e) {
234
+ function Lt(e) {
236
235
  return (e == null ? void 0 : e.kind) === "workflow" ? "Workflow (asynchronous)" : (e == null ? void 0 : e.kind) === "function" ? "Function (synchronous)" : "App action (synchronous)";
237
236
  }
238
- function on({
237
+ function ln({
239
238
  kind: e,
240
- id: t,
241
- policy: i,
242
- ready: s,
239
+ id: i,
240
+ policy: s,
241
+ ready: t,
243
242
  saving: a,
244
- onPersist: o
243
+ onPersist: l
245
244
  }) {
246
- var y, R, Q, N;
247
- const l = xe(!0), { project: d } = rn(), h = en(d ?? void 0, !0), [c, v] = u(!1), [b, m] = u(null), C = (y = i.reroute) == null ? void 0 : y.target, k = Qe(C), D = C ? Ve({
248
- resource: { kind: e, id: t },
249
- target: { kind: C.kind, id: k },
250
- hasAdapter: ((R = i.reroute) == null ? void 0 : R.with) !== void 0
251
- }) : "allow", O = (C == null ? void 0 : C.kind) === "workflow" ? ((N = (Q = h.data) == null ? void 0 : Q.find((g) => g.id === k)) == null ? void 0 : N.displayName) ?? void 0 : (() => {
252
- var A;
253
- const g = (A = l.data) == null ? void 0 : A.find((q) => q.id === k);
245
+ var N, H, K, O;
246
+ const o = Ze(!0), { project: c } = on(), h = Ke(c ?? void 0, !0), [d, b] = f(!1), [w, p] = f(null), P = (N = s.reroute) == null ? void 0 : N.target, y = Ve(P), T = P ? Le({
247
+ resource: { kind: e, id: i },
248
+ target: { kind: P.kind, id: y },
249
+ hasAdapter: ((H = s.reroute) == null ? void 0 : H.with) !== void 0
250
+ }) : "allow", j = (P == null ? void 0 : P.kind) === "workflow" ? ((O = (K = h.data) == null ? void 0 : K.find((g) => g.id === y)) == null ? void 0 : O.displayName) ?? void 0 : (() => {
251
+ var S;
252
+ const g = (S = o.data) == null ? void 0 : S.find((F) => F.id === y);
254
253
  return g ? g.displayName || g.key : void 0;
255
254
  })();
256
- be(() => {
257
- t && e && m(null);
258
- }, [t, e]);
259
- function E(g) {
260
- m(null), o(g, m);
255
+ ve(() => {
256
+ i && e && p(null);
257
+ }, [i, e]);
258
+ function D(g) {
259
+ p(null), l(g, p);
261
260
  }
262
- function M(g) {
261
+ function L(g) {
263
262
  var U;
264
- let A;
265
- if (g.uses.app === Wt) {
266
- const W = g.with ?? {}, $ = typeof W.targetId == "string" ? W.targetId : "";
267
- if (!$) return;
268
- A = W.targetKind === "workflow" ? { kind: "workflow", workflow: $ } : { kind: "function", function: $ };
263
+ let S;
264
+ if (g.uses.app === jt) {
265
+ const V = g.with ?? {}, Q = typeof V.targetId == "string" ? V.targetId : "";
266
+ if (!Q) return;
267
+ S = V.targetKind === "workflow" ? { kind: "workflow", workflow: Q } : { kind: "function", function: Q };
269
268
  } else if (!g.uses.app.startsWith("@w6w/"))
270
- A = {
269
+ S = {
271
270
  kind: "action",
272
271
  uses: {
273
272
  app: g.uses.app,
@@ -278,30 +277,30 @@ function on({
278
277
  };
279
278
  else
280
279
  return;
281
- if (Ve({
282
- resource: { kind: e, id: t },
283
- target: { kind: A.kind, id: Qe(A) },
284
- hasAdapter: ((U = i.reroute) == null ? void 0 : U.with) !== void 0
280
+ if (Le({
281
+ resource: { kind: e, id: i },
282
+ target: { kind: S.kind, id: Ve(S) },
283
+ hasAdapter: ((U = s.reroute) == null ? void 0 : U.with) !== void 0
285
284
  }) === "block") {
286
- m(
285
+ p(
287
286
  "This handler would call itself with the same inputs and can loop forever. Choose another handler or keep a differing imported adapter."
288
- ), v(!1);
287
+ ), b(!1);
289
288
  return;
290
289
  }
291
- E({ ...i, reroute: { ...i.reroute, target: A } }), v(!1);
290
+ D({ ...s, reroute: { ...s.reroute, target: S } }), b(!1);
292
291
  }
293
- return !s && !a ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : /* @__PURE__ */ r("div", { className: "w6w-stack", "data-testid": "rail-errorhandling-body", children: [
292
+ return !t && !a ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : /* @__PURE__ */ r("div", { className: "w6w-stack", "data-testid": "rail-errorhandling-body", children: [
294
293
  /* @__PURE__ */ r("section", { "data-testid": "rail-retry-section", children: [
295
294
  /* @__PURE__ */ n(
296
295
  Pn,
297
296
  {
298
- value: i.retry,
299
- onChange: (g) => E({ ...i, retry: g }),
297
+ value: s.retry,
298
+ onChange: (g) => D({ ...s, retry: g }),
300
299
  readOnly: a,
301
300
  target: e
302
301
  }
303
302
  ),
304
- e === "function" && i.timeoutApplicable && /* @__PURE__ */ r("label", { className: "w6w-field", "data-testid": "rail-timeout-field", children: [
303
+ e === "function" && s.timeoutApplicable && /* @__PURE__ */ r("label", { className: "w6w-field", "data-testid": "rail-timeout-field", children: [
305
304
  /* @__PURE__ */ n("span", { children: "Timeout (seconds)" }),
306
305
  /* @__PURE__ */ n(
307
306
  "input",
@@ -311,13 +310,13 @@ function on({
311
310
  max: 280,
312
311
  step: 1,
313
312
  placeholder: "120",
314
- value: i.timeoutMs === void 0 ? "" : i.timeoutMs / 1e3,
313
+ value: s.timeoutMs === void 0 ? "" : s.timeoutMs / 1e3,
315
314
  disabled: a,
316
315
  onChange: (g) => {
317
- const A = g.target.valueAsNumber;
318
- E({
319
- ...i,
320
- timeoutMs: g.target.value === "" || !Number.isFinite(A) ? void 0 : Math.round(A * 1e3)
316
+ const S = g.target.valueAsNumber;
317
+ D({
318
+ ...s,
319
+ timeoutMs: g.target.value === "" || !Number.isFinite(S) ? void 0 : Math.round(S * 1e3)
321
320
  });
322
321
  }
323
322
  }
@@ -327,12 +326,12 @@ function on({
327
326
  e === "workflow" && /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-retry-run-warning", children: "Retrying re-runs the whole workflow from its first step, so steps that already succeeded run again. For a step that must not repeat (a send or a charge), set retry on that step instead." })
328
327
  ] }),
329
328
  /* @__PURE__ */ n("p", { className: "muted small", children: e === "workflow" ? "What runs when this workflow's run fails, after every node's own retry is spent." : "What runs when this call fails, after retry (if any) is exhausted." }),
330
- k ? /* @__PURE__ */ r("div", { className: "row", style: { alignItems: "center", gap: 8 }, children: [
329
+ y ? /* @__PURE__ */ r("div", { className: "row", style: { alignItems: "center", gap: 8 }, children: [
331
330
  /* @__PURE__ */ r("span", { className: "list-main", children: [
332
- /* @__PURE__ */ n("strong", { children: O ?? k }),
331
+ /* @__PURE__ */ n("strong", { children: j ?? y }),
333
332
  " ",
334
- /* @__PURE__ */ n("code", { className: "muted", children: k }),
335
- /* @__PURE__ */ n("span", { className: "muted small block", children: $t(C) })
333
+ /* @__PURE__ */ n("code", { className: "muted", children: y }),
334
+ /* @__PURE__ */ n("span", { className: "muted small block", children: Lt(P) })
336
335
  ] }),
337
336
  /* @__PURE__ */ n(
338
337
  "button",
@@ -341,7 +340,7 @@ function on({
341
340
  className: "btn ghost",
342
341
  "data-testid": "rail-errorhandling-change",
343
342
  disabled: a,
344
- onClick: () => v(!0),
343
+ onClick: () => b(!0),
345
344
  children: "Change"
346
345
  }
347
346
  )
@@ -352,203 +351,94 @@ function on({
352
351
  className: "btn",
353
352
  "data-testid": "rail-errorhandling-choose",
354
353
  disabled: a,
355
- onClick: () => v(!0),
354
+ onClick: () => b(!0),
356
355
  children: "+ Choose what runs on failure"
357
356
  }
358
357
  ),
359
- k && /* @__PURE__ */ n(
358
+ y && /* @__PURE__ */ n(
360
359
  "button",
361
360
  {
362
361
  type: "button",
363
362
  className: "btn ghost",
364
363
  "data-testid": "rail-errorhandling-clear",
365
364
  disabled: a,
366
- onClick: () => E({ ...i, reroute: void 0 }),
365
+ onClick: () => D({ ...s, reroute: void 0 }),
367
366
  children: "Remove handler"
368
367
  }
369
368
  ),
370
- D === "warn" && /* @__PURE__ */ n("div", { className: "result error", "data-testid": "rail-errorhandling-self-caution", children: "This handler targets itself. Its imported input adapter is preserved; the server will refuse it if it resolves to the failed call's same inputs." }),
371
- b && /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-errorhandling-error", children: b }),
372
- c && /* @__PURE__ */ n(
373
- Tn,
369
+ T === "warn" && /* @__PURE__ */ n("div", { className: "result error", "data-testid": "rail-errorhandling-self-caution", children: "This handler targets itself. Its imported input adapter is preserved; the server will refuse it if it resolves to the failed call's same inputs." }),
370
+ w && /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-errorhandling-error", children: w }),
371
+ d && /* @__PURE__ */ n(
372
+ In,
374
373
  {
375
374
  appsOnly: !0,
376
375
  callables: ["function", "workflow"],
377
376
  title: "Choose what runs on failure",
378
- onClose: () => v(!1),
379
- onAdd: M
377
+ onClose: () => b(!1),
378
+ onAdd: L
380
379
  }
381
380
  )
382
381
  ] });
383
382
  }
384
- function Ft({ ctx: e }) {
385
- const t = "policy" in e ? e.policy : void 0, i = "onPolicyChange" in e ? e.onPolicyChange : void 0;
383
+ function Vt({ ctx: e }) {
384
+ const i = "policy" in e ? e.policy : void 0, s = "onPolicyChange" in e ? e.onPolicyChange : void 0;
386
385
  return /* @__PURE__ */ n(
387
- on,
386
+ ln,
388
387
  {
389
388
  kind: e.kind,
390
389
  id: e.id,
391
- policy: t ?? {},
392
- ready: !!i,
390
+ policy: i ?? {},
391
+ ready: !!s,
393
392
  saving: !1,
394
- onPersist: (s) => i == null ? void 0 : i(s)
393
+ onPersist: (t) => s == null ? void 0 : s(t)
395
394
  }
396
395
  );
397
396
  }
398
- function Ht({ id: e, kind: t }) {
399
- const i = Ge(e, t === "function"), s = Ye(e, t === "endpoint"), a = Ze(), o = Xe(), l = _e(t, t === "function" ? i.data : s.data), d = t === "function" ? a.isPending : o.isPending;
397
+ function Qt({ id: e, kind: i }) {
398
+ const s = ze(e, i === "function"), t = _e(e, i === "endpoint"), a = Ge(), l = Ye(), o = Ue(i, i === "function" ? s.data : t.data), c = i === "function" ? a.isPending : l.isPending;
400
399
  return /* @__PURE__ */ n(
401
- on,
400
+ ln,
402
401
  {
403
- kind: t,
402
+ kind: i,
404
403
  id: e,
405
- policy: l ? lt(l.definition) : {},
406
- ready: !!l,
407
- saving: d,
408
- onPersist: (h, c) => {
409
- if (!l) return;
410
- const v = {
411
- definition: ot(l.definition, h),
412
- ifUnmodifiedSince: l.updatedAt
413
- }, b = {
414
- onError: (m) => c(m instanceof j ? m.message : String(m))
404
+ policy: o ? ht(o.definition) : {},
405
+ ready: !!o,
406
+ saving: c,
407
+ onPersist: (h, d) => {
408
+ if (!o) return;
409
+ const b = {
410
+ definition: ut(o.definition, h),
411
+ ifUnmodifiedSince: o.updatedAt
412
+ }, w = {
413
+ onError: (p) => d(p instanceof M ? p.message : String(p))
415
414
  };
416
- t === "function" ? a.mutate(v, b) : o.mutate(v, b);
415
+ i === "function" ? a.mutate(b, w) : l.mutate(b, w);
417
416
  }
418
417
  }
419
418
  );
420
419
  }
421
- function qt({ ctx: e }) {
422
- return (e == null ? void 0 : e.kind) !== "workflow" && (e == null ? void 0 : e.kind) !== "function" && (e == null ? void 0 : e.kind) !== "endpoint" ? null : e.kind === "workflow" || typeof e.onPolicyChange == "function" ? /* @__PURE__ */ n(Ft, { ctx: e }) : /* @__PURE__ */ n(Ht, { id: e.id, kind: e.kind });
420
+ function Wt({ ctx: e }) {
421
+ return (e == null ? void 0 : e.kind) !== "workflow" && (e == null ? void 0 : e.kind) !== "function" && (e == null ? void 0 : e.kind) !== "endpoint" ? null : e.kind === "workflow" || typeof e.onPolicyChange == "function" ? /* @__PURE__ */ n(Vt, { ctx: e }) : /* @__PURE__ */ n(Qt, { id: e.id, kind: e.kind });
423
422
  }
424
- function Jt() {
425
- return /* @__PURE__ */ n(K, { name: "warning" });
423
+ function $t() {
424
+ return /* @__PURE__ */ n(J, { name: "warning" });
426
425
  }
427
- const Bt = {
426
+ const Ht = {
428
427
  id: "error-handling",
429
428
  title: "Error handling",
430
- Icon: Jt,
431
- isAvailable: (e) => rt(e),
432
- Panel: qt
433
- }, Kt = {
429
+ Icon: $t,
430
+ isAvailable: (e) => ct(e),
431
+ Panel: Wt
432
+ }, Ft = {
434
433
  id: "history",
435
434
  title: "Execution history",
436
- Icon: () => /* @__PURE__ */ n(K, { name: "history" }),
435
+ Icon: () => /* @__PURE__ */ n(J, { name: "history" }),
437
436
  isAvailable: (e) => (e == null ? void 0 : e.kind) === "workflow" && !!e.onOpenHistory,
438
437
  onActivate: (e) => {
439
- var t;
440
- (e == null ? void 0 : e.kind) === "workflow" && ((t = e.onOpenHistory) == null || t.call(e));
441
- }
442
- };
443
- function Ut(e, t) {
444
- if (!t.includes(",")) return { tags: e, typed: t };
445
- let i = e;
446
- for (const s of t.split(",")) {
447
- const a = s.trim();
448
- a && !i.includes(a) && (i = [...i, a]);
449
- }
450
- return { tags: i, typed: "" };
451
- }
452
- function zt(e, t) {
453
- return e.filter((i) => i !== t);
454
- }
455
- function _t({ tags: e, onChange: t }) {
456
- const [i, s] = u("");
457
- function a(o) {
458
- const l = Ut(e, o);
459
- s(l.typed), l.tags !== e && t(l.tags);
460
- }
461
- return /* @__PURE__ */ r("div", { className: "tag-list", "data-testid": "tag-editor", children: [
462
- e.map((o) => /* @__PURE__ */ r("span", { className: "tag removable", children: [
463
- o,
464
- /* @__PURE__ */ n(
465
- Se,
466
- {
467
- danger: !0,
468
- icon: "close",
469
- label: `Remove tag ${o}`,
470
- title: `Remove ${o}`,
471
- onClick: () => t(zt(e, o))
472
- }
473
- )
474
- ] }, o)),
475
- /* @__PURE__ */ n(
476
- "input",
477
- {
478
- type: "text",
479
- value: i,
480
- placeholder: "Add a tag…",
481
- "aria-label": "New tag",
482
- onChange: (o) => a(o.target.value)
483
- }
484
- )
485
- ] });
486
- }
487
- function ln(e) {
488
- const t = At(e.kind).settings, { initial: i } = e, [s, a] = u(i.displayName), [o, l] = u(i.key ?? ""), [d, h] = u(i.tags ?? []), [c, v] = u(!1), [b, m] = u(null), C = s !== i.displayName, k = o !== (i.key ?? ""), D = t.hasTags && JSON.stringify(d) !== JSON.stringify(i.tags ?? []), O = C || k || D, E = t.canEditKey, M = o === "" || it(o), y = O && M && !c;
489
- async function R() {
490
- if (y) {
491
- m(null), v(!0);
492
- try {
493
- await e.onSave({
494
- displayName: s.trim(),
495
- key: E && k ? o : i.key,
496
- tags: t.hasTags ? d : void 0
497
- }), e.onClose();
498
- } catch (N) {
499
- m(N instanceof j ? N.message : String(N));
500
- } finally {
501
- v(!1);
502
- }
503
- }
438
+ var i;
439
+ (e == null ? void 0 : e.kind) === "workflow" && ((i = e.onOpenHistory) == null || i.call(e));
504
440
  }
505
- const Q = In(R, { enabled: y });
506
- return /* @__PURE__ */ r(B, { title: "Edit settings", onClose: e.onClose, children: [
507
- /* @__PURE__ */ r("div", { className: "modal-body", children: [
508
- /* @__PURE__ */ r("label", { className: "field", children: [
509
- /* @__PURE__ */ n("span", { children: "Name" }),
510
- /* @__PURE__ */ n(
511
- "input",
512
- {
513
- type: "text",
514
- value: s,
515
- onChange: (N) => a(N.target.value),
516
- placeholder: t.namePlaceholder,
517
- autoFocus: !0,
518
- ...Q
519
- }
520
- )
521
- ] }),
522
- E && /* @__PURE__ */ r("label", { className: "field", children: [
523
- /* @__PURE__ */ n("span", { children: "Key" }),
524
- /* @__PURE__ */ n(
525
- "input",
526
- {
527
- type: "text",
528
- value: o,
529
- onChange: (N) => l(st(N.target.value)),
530
- placeholder: t.keyPlaceholder,
531
- ...Q
532
- }
533
- ),
534
- /* @__PURE__ */ r("span", { className: "muted small", children: [
535
- "Lowercase, kebab-case, 3–39 characters.",
536
- t.keyHintSuffix
537
- ] })
538
- ] }),
539
- t.hasTags && /* @__PURE__ */ r("div", { children: [
540
- /* @__PURE__ */ n("p", { className: "muted small", style: { marginBottom: "8px" }, children: "Tags" }),
541
- /* @__PURE__ */ n(_t, { tags: d, onChange: h })
542
- ] }),
543
- b && /* @__PURE__ */ n("div", { className: "error", children: b })
544
- ] }),
545
- /* @__PURE__ */ r("div", { className: "modal-actions", children: [
546
- /* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Cancel" }),
547
- /* @__PURE__ */ n("button", { type: "button", className: "btn", disabled: !y, onClick: R, children: c ? "Saving…" : "Save" })
548
- ] })
549
- ] });
550
- }
551
- const Gt = {
441
+ }, qt = {
552
442
  function: {
553
443
  json: "functions-version-json",
554
444
  error: "functions-version-error",
@@ -575,30 +465,30 @@ const Gt = {
575
465
  }
576
466
  };
577
467
  function dn(e) {
578
- const { kind: t, id: i, versionNumber: s } = e, a = Gt[t], o = Yn(t, i, s, !0), l = Zn(t), d = Xn(t), [h, c] = u(!1), [v, b] = u(null);
579
- return /* @__PURE__ */ r(V, { children: [
580
- /* @__PURE__ */ r(B, { title: `Version ${s}`, onClose: e.onClose, wide: !0, children: [
468
+ const { kind: i, id: s, versionNumber: t } = e, a = qt[i], l = wt(i, s, t, !0), o = yt(i), c = Nt(i), [h, d] = f(!1), [b, w] = f(null);
469
+ return /* @__PURE__ */ r(R, { children: [
470
+ /* @__PURE__ */ r(B, { title: `Version ${t}`, onClose: e.onClose, wide: !0, children: [
581
471
  /* @__PURE__ */ r("div", { className: "modal-body", children: [
582
- o.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : o.isError ? /* @__PURE__ */ n("div", { className: "error", "data-testid": a.error, children: o.error instanceof Error ? o.error.message : String(o.error) }) : o.data ? /* @__PURE__ */ n("div", { "data-testid": a.json, children: /* @__PURE__ */ n(
583
- ge,
472
+ l.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : l.isError ? /* @__PURE__ */ n("div", { className: "error", "data-testid": a.error, children: l.error instanceof Error ? l.error.message : String(l.error) }) : l.data ? /* @__PURE__ */ n("div", { "data-testid": a.json, children: /* @__PURE__ */ n(
473
+ pe,
584
474
  {
585
- code: JSON.stringify(o.data.definition, null, 2),
475
+ code: JSON.stringify(l.data.definition, null, 2),
586
476
  language: "json",
587
477
  maxHeight: "420px",
588
478
  copyable: !0
589
479
  }
590
480
  ) }) : null,
591
- (v || l.isError) && /* @__PURE__ */ n("div", { className: "error", children: v ?? String(l.error) }),
592
- d.data !== void 0 && /* @__PURE__ */ n("div", { "data-testid": a.invokeJson, children: /* @__PURE__ */ n(
593
- ge,
481
+ (b || o.isError) && /* @__PURE__ */ n("div", { className: "error", children: b ?? String(o.error) }),
482
+ c.data !== void 0 && /* @__PURE__ */ n("div", { "data-testid": a.invokeJson, children: /* @__PURE__ */ n(
483
+ pe,
594
484
  {
595
- code: JSON.stringify(d.data, null, 2),
485
+ code: JSON.stringify(c.data, null, 2),
596
486
  language: "json",
597
487
  maxHeight: "240px",
598
488
  copyable: !0
599
489
  }
600
490
  ) }),
601
- d.isError && /* @__PURE__ */ n("div", { className: "error", "data-testid": a.invokeError, children: d.error instanceof j ? d.error.message : String(d.error) })
491
+ c.isError && /* @__PURE__ */ n("div", { className: "error", "data-testid": a.invokeError, children: c.error instanceof M ? c.error.message : String(c.error) })
602
492
  ] }),
603
493
  /* @__PURE__ */ r("div", { className: "modal-actions", children: [
604
494
  /* @__PURE__ */ n(
@@ -607,9 +497,9 @@ function dn(e) {
607
497
  type: "button",
608
498
  className: "btn ghost",
609
499
  "data-testid": a.invokeButton,
610
- disabled: d.isPending,
611
- onClick: () => d.mutate({ id: i, versionNumber: s }),
612
- children: d.isPending ? "Invoking…" : "Invoke this version"
500
+ disabled: c.isPending,
501
+ onClick: () => c.mutate({ id: s, versionNumber: t }),
502
+ children: c.isPending ? "Invoking…" : "Invoke this version"
613
503
  }
614
504
  ),
615
505
  /* @__PURE__ */ n(
@@ -618,49 +508,49 @@ function dn(e) {
618
508
  type: "button",
619
509
  className: "btn danger",
620
510
  "data-testid": a.revertButton,
621
- disabled: l.isPending,
622
- onClick: () => c(!0),
623
- children: l.isPending ? "Reverting…" : "Revert to this version"
511
+ disabled: o.isPending,
512
+ onClick: () => d(!0),
513
+ children: o.isPending ? "Reverting…" : "Revert to this version"
624
514
  }
625
515
  ),
626
516
  /* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Close" })
627
517
  ] })
628
518
  ] }),
629
519
  h && /* @__PURE__ */ n(
630
- nt,
520
+ ot,
631
521
  {
632
522
  title: "Revert to this version",
633
- message: `Revert to version ${s}? This restores its content onto the resource's current draft; the resource's key and address stay unchanged.`,
523
+ message: `Revert to version ${t}? This restores its content onto the resource's current draft; the resource's key and address stay unchanged.`,
634
524
  confirmLabel: "Revert",
635
525
  destructive: !0,
636
526
  onConfirm: () => {
637
- c(!1), e.onRestore ? (b(null), e.onRestore(s).then(e.onClose, (m) => b(String(m)))) : l.mutate({ id: i, versionNumber: s });
527
+ d(!1), e.onRestore ? (w(null), e.onRestore(t).then(e.onClose, (p) => w(String(p)))) : o.mutate({ id: s, versionNumber: t });
638
528
  },
639
- onClose: () => c(!1)
529
+ onClose: () => d(!1)
640
530
  }
641
531
  )
642
532
  ] });
643
533
  }
644
- function Yt(e) {
534
+ function Bt(e) {
645
535
  const {
646
- archived: t,
647
- deleteLabel: i,
648
- deleteTestId: s,
536
+ archived: i,
537
+ deleteLabel: s,
538
+ deleteTestId: t,
649
539
  archiveTestId: a,
650
- onRequestDelete: o,
651
- onRequestArchive: l,
652
- deleteError: d,
540
+ onRequestDelete: l,
541
+ onRequestArchive: o,
542
+ deleteError: c,
653
543
  archiveError: h
654
544
  } = e;
655
545
  return /* @__PURE__ */ r("div", { className: "rail-danger-zone rail-danger-zone--panel", "data-testid": "rail-danger-zone-panel", children: [
656
546
  /* @__PURE__ */ r("div", { className: "rail-danger-zone-actions", children: [
657
- !t && /* @__PURE__ */ n(
547
+ !i && /* @__PURE__ */ n(
658
548
  "button",
659
549
  {
660
550
  type: "button",
661
551
  className: "btn danger",
662
552
  "data-testid": a,
663
- onClick: l,
553
+ onClick: o,
664
554
  disabled: e.pending,
665
555
  children: "Archive"
666
556
  }
@@ -670,37 +560,37 @@ function Yt(e) {
670
560
  {
671
561
  type: "button",
672
562
  className: "btn danger",
673
- "aria-label": i,
674
- "data-testid": s,
675
- onClick: o,
563
+ "aria-label": s,
564
+ "data-testid": t,
565
+ onClick: l,
676
566
  disabled: e.pending,
677
567
  children: "Delete"
678
568
  }
679
- ) : t ? /* @__PURE__ */ r("span", { className: "rail-danger-zone-delete", children: [
569
+ ) : i ? /* @__PURE__ */ r("span", { className: "rail-danger-zone-delete", children: [
680
570
  /* @__PURE__ */ n(
681
571
  Dn,
682
572
  {
683
- label: i,
684
- "data-testid": s,
685
- onClick: o,
573
+ label: s,
574
+ "data-testid": t,
575
+ onClick: l,
686
576
  disabled: e.pending
687
577
  }
688
578
  ),
689
579
  /* @__PURE__ */ n("span", { children: "Delete" })
690
580
  ] }) : null
691
581
  ] }),
692
- d && /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-delete-error", children: d }),
582
+ c && /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-delete-error", children: c }),
693
583
  h && /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-archive-error", children: h })
694
584
  ] });
695
585
  }
696
586
  function cn(e) {
697
587
  return /* @__PURE__ */ r("div", { className: "right-rail-panel-head rail-settings-head", children: [
698
588
  /* @__PURE__ */ n("h3", { children: "Settings" }),
699
- /* @__PURE__ */ n(On, { label: "Edit settings", "data-testid": "rail-settings-edit", onClick: e.onEdit })
589
+ /* @__PURE__ */ n(Tn, { label: "Edit settings", "data-testid": "rail-settings-edit", onClick: e.onEdit })
700
590
  ] });
701
591
  }
702
592
  function un(e) {
703
- const { id: t, displayName: i, fields: s, row: a, tags: o } = e;
593
+ const { id: i, displayName: s, fields: t, row: a, tags: l } = e;
704
594
  return /* @__PURE__ */ n("div", { className: "rail-meta", children: /* @__PURE__ */ n(
705
595
  "div",
706
596
  {
@@ -711,23 +601,23 @@ function un(e) {
711
601
  gap: "8px"
712
602
  },
713
603
  children: /* @__PURE__ */ r("dl", { className: "rail-meta-list", children: [
714
- i && /* @__PURE__ */ r(V, { children: [
604
+ s && /* @__PURE__ */ r(R, { children: [
715
605
  /* @__PURE__ */ n("dt", { children: "Name" }),
716
- /* @__PURE__ */ n("dd", { "data-testid": "rail-meta-name", children: /* @__PURE__ */ n("code", { children: i }) })
606
+ /* @__PURE__ */ n("dd", { "data-testid": "rail-meta-name", children: /* @__PURE__ */ n("code", { children: s }) })
717
607
  ] }),
718
608
  /* @__PURE__ */ n("dt", { children: "ID" }),
719
- /* @__PURE__ */ n("dd", { "data-testid": "rail-meta-id", children: /* @__PURE__ */ n("code", { children: t }) }),
720
- s.includes("key") && a && /* @__PURE__ */ r(V, { children: [
609
+ /* @__PURE__ */ n("dd", { "data-testid": "rail-meta-id", children: /* @__PURE__ */ n("code", { children: i }) }),
610
+ t.includes("key") && a && /* @__PURE__ */ r(R, { children: [
721
611
  /* @__PURE__ */ n("dt", { children: "Key" }),
722
612
  /* @__PURE__ */ n("dd", { "data-testid": "rail-meta-key", children: /* @__PURE__ */ n("code", { children: a.key || "unset" }) })
723
613
  ] }),
724
- s.includes("updatedAt") && a && /* @__PURE__ */ r(V, { children: [
614
+ t.includes("updatedAt") && a && /* @__PURE__ */ r(R, { children: [
725
615
  /* @__PURE__ */ n("dt", { children: "Updated" }),
726
616
  /* @__PURE__ */ n("dd", { "data-testid": "rail-meta-updated", "data-value": a.updatedAt, children: new Date(a.updatedAt).toLocaleString() })
727
617
  ] }),
728
- o !== void 0 && a && /* @__PURE__ */ r(V, { children: [
618
+ l !== void 0 && a && /* @__PURE__ */ r(R, { children: [
729
619
  /* @__PURE__ */ n("dt", { children: "Tags" }),
730
- /* @__PURE__ */ n("dd", { "data-testid": "rail-meta-tags", children: o.length > 0 ? o.map((l) => /* @__PURE__ */ n("span", { className: "tag", children: l }, l)) : "No tags" })
620
+ /* @__PURE__ */ n("dd", { "data-testid": "rail-meta-tags", children: l.length > 0 ? l.map((o) => /* @__PURE__ */ n("span", { className: "tag", children: o }, o)) : "No tags" })
731
621
  ] })
732
622
  ] })
733
623
  }
@@ -735,7 +625,7 @@ function un(e) {
735
625
  }
736
626
  function hn(e) {
737
627
  return /* @__PURE__ */ n("div", { className: "rail-spec-actions", children: /* @__PURE__ */ n(
738
- Se,
628
+ Be,
739
629
  {
740
630
  icon: "file-text",
741
631
  label: "Export, edit, or import",
@@ -745,15 +635,15 @@ function hn(e) {
745
635
  ) });
746
636
  }
747
637
  function fn(e) {
748
- const { kind: t, children: i, onImport: s, onClose: a } = e;
638
+ const { kind: i, children: s, onImport: t, onClose: a } = e;
749
639
  return /* @__PURE__ */ r(B, { title: "Definition", onClose: a, children: [
750
640
  /* @__PURE__ */ r("div", { className: "modal-body", children: [
751
- i,
641
+ s,
752
642
  /* @__PURE__ */ r("p", { className: "muted small", children: [
753
643
  "Import a spec document to create a NEW ",
754
- t,
644
+ i,
755
645
  " and navigate to it — this does not replace the ",
756
- t,
646
+ i,
757
647
  " you have open."
758
648
  ] }),
759
649
  /* @__PURE__ */ n("div", { className: "rail-spec-menu-row", children: /* @__PURE__ */ n(
@@ -762,7 +652,7 @@ function fn(e) {
762
652
  type: "button",
763
653
  className: "btn ghost",
764
654
  "data-testid": "rail-spec-import",
765
- onClick: s,
655
+ onClick: t,
766
656
  children: "Import"
767
657
  }
768
658
  ) })
@@ -771,7 +661,7 @@ function fn(e) {
771
661
  ] });
772
662
  }
773
663
  function mn(e) {
774
- const { open: t, versions: i } = e;
664
+ const { open: i, versions: s } = e;
775
665
  return /* @__PURE__ */ r("div", { className: "rail-version-section", children: [
776
666
  e.definitionStatus && /* @__PURE__ */ r("div", { "aria-live": "polite", "data-testid": "rail-definition-status", children: [
777
667
  /* @__PURE__ */ n("span", { className: `badge wf-definition-status ${e.definitionStatus}`, children: e.definitionStatus === "published" ? "Live" : "Draft" }),
@@ -787,13 +677,13 @@ function mn(e) {
787
677
  title: "Version history",
788
678
  onClick: e.onShow,
789
679
  children: [
790
- /* @__PURE__ */ n(K, { name: "clock", size: 14 }),
680
+ /* @__PURE__ */ n(J, { name: "clock", size: 14 }),
791
681
  /* @__PURE__ */ n("span", { children: "Version history" })
792
682
  ]
793
683
  }
794
684
  ),
795
- (t || e.definitionStatus) && /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-version-published", children: (i == null ? void 0 : i.currentPublishedVersion) != null ? `Published: v${i.currentPublishedVersion}` : "Never published" }),
796
- t && /* @__PURE__ */ r(V, { children: [
685
+ (i || e.definitionStatus) && /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-version-published", children: (s == null ? void 0 : s.currentPublishedVersion) != null ? `Published: v${s.currentPublishedVersion}` : "Never published" }),
686
+ i && /* @__PURE__ */ r(R, { children: [
797
687
  /* @__PURE__ */ r("div", { className: "rail-version-actions", children: [
798
688
  /* @__PURE__ */ n(
799
689
  "button",
@@ -803,7 +693,7 @@ function mn(e) {
803
693
  "data-testid": "rail-publish",
804
694
  disabled: e.publishing || e.publishDisabled || e.definitionStatus === "published",
805
695
  onClick: e.onPublish,
806
- children: e.publishing ? (i == null ? void 0 : i.currentPublishedVersion) != null ? "Republishing…" : "Publishing…" : e.definitionStatus === "published" || e.publishDisabled !== void 0 && e.definitionStatus === void 0 && (i == null ? void 0 : i.currentPublishedVersion) != null ? "Published" : (i == null ? void 0 : i.currentPublishedVersion) != null ? "Republish" : "Publish"
696
+ children: e.publishing ? (s == null ? void 0 : s.currentPublishedVersion) != null ? "Republishing…" : "Publishing…" : e.definitionStatus === "published" || e.publishDisabled !== void 0 && e.definitionStatus === void 0 && (s == null ? void 0 : s.currentPublishedVersion) != null ? "Published" : (s == null ? void 0 : s.currentPublishedVersion) != null ? "Republish" : "Publish"
807
697
  }
808
698
  ),
809
699
  " ",
@@ -813,9 +703,9 @@ function mn(e) {
813
703
  type: "button",
814
704
  className: "btn ghost",
815
705
  "data-testid": "rail-enable-toggle",
816
- disabled: e.togglingEnabled || i === void 0,
706
+ disabled: e.togglingEnabled || s === void 0,
817
707
  onClick: e.onToggleEnabled,
818
- children: e.togglingEnabled ? "Saving…" : i != null && i.enabled ? "Disable" : "Enable"
708
+ children: e.togglingEnabled ? "Saving…" : s != null && s.enabled ? "Disable" : "Enable"
819
709
  }
820
710
  )
821
711
  ] }),
@@ -825,34 +715,34 @@ function mn(e) {
825
715
  ] });
826
716
  }
827
717
  function pn(e) {
828
- const { loading: t, versions: i } = e;
718
+ const { loading: i, versions: s } = e;
829
719
  return /* @__PURE__ */ r(B, { title: "All versions", onClose: e.onClose, wide: !0, children: [
830
720
  /* @__PURE__ */ r("div", { className: "modal-body", children: [
831
- t && /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }),
832
- (i == null ? void 0 : i.length) === 0 && /* @__PURE__ */ n("p", { className: "muted small", children: "No versions yet." }),
833
- i && i.length > 0 && /* @__PURE__ */ n("ul", { className: "list", children: i.map((s) => /* @__PURE__ */ n("li", { className: "selectable", children: /* @__PURE__ */ n(
721
+ i && /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }),
722
+ (s == null ? void 0 : s.length) === 0 && /* @__PURE__ */ n("p", { className: "muted small", children: "No versions yet." }),
723
+ s && s.length > 0 && /* @__PURE__ */ n("ul", { className: "list", children: s.map((t) => /* @__PURE__ */ n("li", { className: "selectable", children: /* @__PURE__ */ n(
834
724
  "button",
835
725
  {
836
726
  type: "button",
837
727
  className: "row-select",
838
728
  "data-testid": "rail-version-row",
839
- onClick: () => e.onSelect(s.versionNumber),
729
+ onClick: () => e.onSelect(t.versionNumber),
840
730
  children: /* @__PURE__ */ r("div", { className: "list-main", children: [
841
731
  /* @__PURE__ */ r("code", { children: [
842
732
  "v",
843
- s.versionNumber
733
+ t.versionNumber
844
734
  ] }),
845
735
  " ",
846
- s.isCurrentPublished && /* @__PURE__ */ n("span", { className: "badge", "data-testid": "rail-version-current", children: "Published" }),
847
- /* @__PURE__ */ n("div", { className: "muted small", children: new Date(s.createdAt).toLocaleString() })
736
+ t.isCurrentPublished && /* @__PURE__ */ n("span", { className: "badge", "data-testid": "rail-version-current", children: "Published" }),
737
+ /* @__PURE__ */ n("div", { className: "muted small", children: new Date(t.createdAt).toLocaleString() })
848
738
  ] })
849
739
  }
850
- ) }, s.versionNumber)) })
740
+ ) }, t.versionNumber)) })
851
741
  ] }),
852
742
  /* @__PURE__ */ n("div", { className: "modal-actions", children: /* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Done" }) })
853
743
  ] });
854
744
  }
855
- const Zt = {
745
+ const Jt = {
856
746
  function: {
857
747
  deleteTitle: "Delete function",
858
748
  deleteMessage: "Delete this function permanently? Any endpoint, workflow, or call pointing to it will start failing with a not-found error the next time it runs, and this cannot be undone.",
@@ -882,17 +772,17 @@ const Zt = {
882
772
  }
883
773
  };
884
774
  function gn(e) {
885
- const t = Zt[e.kind];
886
- return /* @__PURE__ */ r(V, { children: [
775
+ const i = Jt[e.kind];
776
+ return /* @__PURE__ */ r(R, { children: [
887
777
  /* @__PURE__ */ n(
888
- Yt,
778
+ Bt,
889
779
  {
890
780
  archived: e.archived,
891
781
  allowDirectDelete: e.kind === "workflow",
892
782
  pending: e.pending,
893
- deleteLabel: t.deleteLabel,
894
- deleteTestId: t.deleteTestId,
895
- archiveTestId: t.archiveTestId,
783
+ deleteLabel: i.deleteLabel,
784
+ deleteTestId: i.deleteTestId,
785
+ archiveTestId: i.archiveTestId,
896
786
  onRequestDelete: e.onRequestDelete,
897
787
  onRequestArchive: e.onRequestArchive,
898
788
  deleteError: e.deleteError,
@@ -900,10 +790,10 @@ function gn(e) {
900
790
  }
901
791
  ),
902
792
  e.deleteConfirming && /* @__PURE__ */ n(
903
- Le,
793
+ je,
904
794
  {
905
- title: t.deleteTitle,
906
- message: t.deleteMessage,
795
+ title: i.deleteTitle,
796
+ message: i.deleteMessage,
907
797
  confirmLabel: "Delete",
908
798
  pending: e.pending,
909
799
  onConfirm: e.onConfirmDelete,
@@ -911,10 +801,10 @@ function gn(e) {
911
801
  }
912
802
  ),
913
803
  e.archiveConfirming && /* @__PURE__ */ n(
914
- Le,
804
+ je,
915
805
  {
916
- title: t.archiveTitle,
917
- message: t.archiveMessage,
806
+ title: i.archiveTitle,
807
+ message: i.archiveMessage,
918
808
  confirmLabel: "Archive",
919
809
  pending: e.pending,
920
810
  onConfirm: e.onConfirmArchive,
@@ -923,51 +813,51 @@ function gn(e) {
923
813
  )
924
814
  ] });
925
815
  }
926
- const vn = { functionsKey: ct, endpointsKey: dt, workflowsKey: kt };
927
- function Xt({
816
+ const vn = { functionsKey: mt, endpointsKey: ft, workflowsKey: xn };
817
+ function Kt({
928
818
  ctx: e,
929
- project: t,
930
- onNavigate: i,
931
- open: s
819
+ project: i,
820
+ onNavigate: s,
821
+ open: t
932
822
  }) {
933
- var ae, me;
823
+ var me, oe;
934
824
  const {
935
825
  editingSettings: a,
936
- setEditingSettings: o,
937
- historyOpen: l,
938
- setHistoryOpen: d,
826
+ setEditingSettings: l,
827
+ historyOpen: o,
828
+ setHistoryOpen: c,
939
829
  versionListOpen: h,
940
- setVersionListOpen: c
941
- } = s, v = en(t ?? void 0), b = (e == null ? void 0 : e.kind) === "workflow", m = (e == null ? void 0 : e.id) ?? "", C = gt(m, b), k = vt(t ?? void 0), D = bt(), O = yt(), E = qe(!1), [M, y] = u(!1), [R, Q] = u(!1), [N, g] = u(!1), [A, q] = u(!1), [U, W] = u(!1), [$, oe] = u(null), [z, le] = u(null), F = Be(We("workflow"), m, N), _ = Ke("workflow", m, l && b), te = Ue("workflow"), de = ze("workflow"), [ke, G] = u(null), [ie, ce] = u(null), [se, ue] = u(
830
+ setVersionListOpen: d
831
+ } = t, b = Ke(i ?? void 0), w = (e == null ? void 0 : e.kind) === "workflow", p = (e == null ? void 0 : e.id) ?? "", P = Gn(p, w), y = Yn(i ?? void 0), T = Zn(), j = Xn(), D = Fe(!1), [L, N] = f(!1), [H, K] = f(!1), [O, g] = f(!1), [S, F] = f(!1), [U, V] = f(!1), [Q, le] = f(null), [G, de] = f(null), W = Je(Qe("workflow"), p, O), Y = en("workflow", p, o && w), te = nn("workflow"), ce = tn("workflow"), [ke, Z] = f(null), [ie, ue] = f(null), [se, he] = f(
942
832
  null
943
833
  );
944
834
  if (!e || e.kind !== "workflow")
945
835
  return /* @__PURE__ */ n("p", { className: "muted small", children: "Open a workflow to see its settings." });
946
- const T = (ae = v.data) == null ? void 0 : ae.find((f) => f.id === e.id), he = T && typeof T.displayName == "string" ? T.displayName : "", H = (T == null ? void 0 : T.tags) ?? [], Y = (T == null ? void 0 : T.status) === "archived";
947
- async function Z() {
948
- if (!E.current) {
949
- E.current = !0, oe(null);
836
+ const C = (me = b.data) == null ? void 0 : me.find((u) => u.id === e.id), z = e.onSettingsChange, $ = C && typeof C.displayName == "string" ? C.displayName : "", X = z ? e.label ?? $ : $, _ = z ? e.key ?? null : (C == null ? void 0 : C.key) ?? null, ae = z ? e.tags ?? [] : (C == null ? void 0 : C.tags) ?? [], re = (C == null ? void 0 : C.status) === "archived";
837
+ async function we() {
838
+ if (!D.current) {
839
+ D.current = !0, le(null);
950
840
  try {
951
- Y || await D.mutateAsync(m), await O.mutateAsync(m), q(!1), i({ type: "list" });
952
- } catch (f) {
953
- q(!1), oe(f instanceof j ? f.message : String(f));
841
+ re || await T.mutateAsync(p), await j.mutateAsync(p), F(!1), s({ type: "list" });
842
+ } catch (u) {
843
+ F(!1), le(u instanceof M ? u.message : String(u));
954
844
  } finally {
955
- E.current = !1;
845
+ D.current = !1;
956
846
  }
957
847
  }
958
848
  }
959
849
  function fe() {
960
- le(null), D.mutate(m, {
850
+ de(null), T.mutate(p, {
961
851
  onSuccess: () => {
962
- W(!1), i({ type: "list" });
852
+ V(!1), s({ type: "list" });
963
853
  },
964
- onError: (f) => {
965
- W(!1), le(f instanceof j ? f.message : String(f));
854
+ onError: (u) => {
855
+ V(!1), de(u instanceof M ? u.message : String(u));
966
856
  }
967
857
  });
968
858
  }
969
859
  return /* @__PURE__ */ r("div", { className: "rail-settings-panel", children: [
970
- /* @__PURE__ */ n(cn, { onEdit: () => o(!0) }),
860
+ /* @__PURE__ */ n(cn, { onEdit: () => l(!0) }),
971
861
  e.authoringSettings && e.onAuthoringSettingChange && /* @__PURE__ */ r("section", { className: "w6w-stack", "data-testid": "rail-workflow-authoring", children: [
972
862
  /* @__PURE__ */ r("label", { children: [
973
863
  /* @__PURE__ */ n(
@@ -975,9 +865,9 @@ function Xt({
975
865
  {
976
866
  type: "checkbox",
977
867
  checked: e.authoringSettings.autoSave,
978
- onChange: (f) => {
979
- var P;
980
- return (P = e.onAuthoringSettingChange) == null ? void 0 : P.call(e, "autoSave", f.target.checked);
868
+ onChange: (u) => {
869
+ var E;
870
+ return (E = e.onAuthoringSettingChange) == null ? void 0 : E.call(e, "autoSave", u.target.checked);
981
871
  }
982
872
  }
983
873
  ),
@@ -989,9 +879,9 @@ function Xt({
989
879
  {
990
880
  type: "checkbox",
991
881
  checked: e.authoringSettings.savePosition,
992
- onChange: (f) => {
993
- var P;
994
- return (P = e.onAuthoringSettingChange) == null ? void 0 : P.call(e, "savePosition", f.target.checked);
882
+ onChange: (u) => {
883
+ var E;
884
+ return (E = e.onAuthoringSettingChange) == null ? void 0 : E.call(e, "savePosition", u.target.checked);
995
885
  }
996
886
  }
997
887
  ),
@@ -1002,41 +892,41 @@ function Xt({
1002
892
  un,
1003
893
  {
1004
894
  id: e.id,
1005
- displayName: he,
1006
- fields: $e("workflow"),
1007
- row: T,
1008
- tags: H
895
+ displayName: X,
896
+ fields: We("workflow"),
897
+ row: C ? { ...C, key: _ } : void 0,
898
+ tags: ae
1009
899
  }
1010
900
  ),
1011
- /* @__PURE__ */ n(hn, { onOpen: () => y(!0) }),
901
+ /* @__PURE__ */ n(hn, { onOpen: () => N(!0) }),
1012
902
  /* @__PURE__ */ n(
1013
903
  mn,
1014
904
  {
1015
905
  definitionStatus: e.definitionStatus,
1016
906
  publishDisabled: e.publishDisabled,
1017
- open: l,
1018
- versions: _.data,
907
+ open: o,
908
+ versions: Y.data,
1019
909
  publishing: te.isPending,
1020
- togglingEnabled: de.isPending,
910
+ togglingEnabled: ce.isPending,
1021
911
  publishError: ke,
1022
912
  enableError: ie,
1023
913
  onShow: () => {
1024
- d(!0), c(!0);
914
+ c(!0), d(!0);
1025
915
  },
1026
916
  onPublish: () => {
1027
917
  if (e.onPublish) {
1028
918
  e.onPublish();
1029
919
  return;
1030
920
  }
1031
- G(null), te.mutate(m, {
1032
- onError: (f) => G(f instanceof j ? f.message : String(f))
921
+ Z(null), te.mutate(p, {
922
+ onError: (u) => Z(u instanceof M ? u.message : String(u))
1033
923
  });
1034
924
  },
1035
925
  onToggleEnabled: () => {
1036
- var f;
1037
- ce(null), de.mutate(
1038
- { id: m, enabled: !((f = _.data) != null && f.enabled) },
1039
- { onError: (P) => ce(P instanceof j ? P.message : String(P)) }
926
+ var u;
927
+ ue(null), ce.mutate(
928
+ { id: p, enabled: !((u = Y.data) != null && u.enabled) },
929
+ { onError: (E) => ue(E instanceof M ? E.message : String(E)) }
1040
930
  );
1041
931
  }
1042
932
  }
@@ -1044,29 +934,29 @@ function Xt({
1044
934
  h && /* @__PURE__ */ n(
1045
935
  pn,
1046
936
  {
1047
- loading: _.isLoading,
1048
- versions: (me = _.data) == null ? void 0 : me.versions,
1049
- onSelect: (f) => ue({ id: m, versionNumber: f }),
1050
- onClose: () => c(!1)
937
+ loading: Y.isLoading,
938
+ versions: (oe = Y.data) == null ? void 0 : oe.versions,
939
+ onSelect: (u) => he({ id: p, versionNumber: u }),
940
+ onClose: () => d(!1)
1051
941
  }
1052
942
  ),
1053
- se && se.id === m && /* @__PURE__ */ n(
943
+ se && se.id === p && /* @__PURE__ */ n(
1054
944
  dn,
1055
945
  {
1056
946
  kind: "workflow",
1057
- id: m,
947
+ id: p,
1058
948
  onRestore: e.onRestoreVersion,
1059
949
  versionNumber: se.versionNumber,
1060
- onClose: () => ue(null)
950
+ onClose: () => he(null)
1061
951
  }
1062
952
  ),
1063
- M && /* @__PURE__ */ r(
953
+ L && /* @__PURE__ */ r(
1064
954
  fn,
1065
955
  {
1066
956
  kind: "workflow",
1067
- onClose: () => y(!1),
957
+ onClose: () => N(!1),
1068
958
  onImport: () => {
1069
- y(!1), Q(!0);
959
+ N(!1), K(!0);
1070
960
  },
1071
961
  children: [
1072
962
  /* @__PURE__ */ n("p", { className: "muted small", children: "Export a portable definition — the same shape Import accepts." }),
@@ -1077,7 +967,7 @@ function Xt({
1077
967
  className: "btn ghost",
1078
968
  "data-testid": "rail-spec-export",
1079
969
  onClick: () => {
1080
- y(!1), g(!0);
970
+ N(!1), g(!0);
1081
971
  },
1082
972
  children: "Export"
1083
973
  }
@@ -1085,11 +975,11 @@ function Xt({
1085
975
  ]
1086
976
  }
1087
977
  ),
1088
- N && /* @__PURE__ */ r(B, { title: "Export spec document", onClose: () => g(!1), wide: !0, children: [
1089
- /* @__PURE__ */ n("div", { className: "modal-body", children: F.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : F.isError ? /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-spec-error", children: F.error instanceof Error ? F.error.message : String(F.error) }) : F.data ? /* @__PURE__ */ n("div", { "data-testid": "rail-spec-json", children: /* @__PURE__ */ n(
1090
- ge,
978
+ O && /* @__PURE__ */ r(B, { title: "Export spec document", onClose: () => g(!1), wide: !0, children: [
979
+ /* @__PURE__ */ n("div", { className: "modal-body", children: W.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : W.isError ? /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-spec-error", children: W.error instanceof Error ? W.error.message : String(W.error) }) : W.data ? /* @__PURE__ */ n("div", { "data-testid": "rail-spec-json", children: /* @__PURE__ */ n(
980
+ pe,
1091
981
  {
1092
- code: JSON.stringify(F.data, null, 2),
982
+ code: JSON.stringify(W.data, null, 2),
1093
983
  language: "json",
1094
984
  maxHeight: "420px",
1095
985
  copyable: !0
@@ -1097,167 +987,175 @@ function Xt({
1097
987
  ) }) : null }),
1098
988
  /* @__PURE__ */ n("div", { className: "modal-actions", children: /* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: () => g(!1), children: "Close" }) })
1099
989
  ] }),
1100
- a && T && /* @__PURE__ */ n(
1101
- ln,
990
+ a && C && /* @__PURE__ */ n(
991
+ Xe,
1102
992
  {
1103
993
  kind: "workflow",
1104
- id: m,
994
+ id: p,
1105
995
  initial: {
1106
- displayName: he,
1107
- key: T.key ?? null,
1108
- tags: H
996
+ displayName: X,
997
+ key: _,
998
+ tags: ae
1109
999
  },
1110
- onSave: async (f) => {
1111
- if (!C.data) throw new Error("Unable to save settings");
1112
- const P = C.data;
1113
- return new Promise((pe, re) => {
1114
- const X = {
1115
- ...P.workflow,
1116
- displayName: f.displayName
1000
+ onSave: async (u) => {
1001
+ if (z) {
1002
+ await z({
1003
+ displayName: u.displayName,
1004
+ key: u.key,
1005
+ tags: u.tags
1006
+ });
1007
+ return;
1008
+ }
1009
+ if (!P.data) throw new Error("Unable to save settings");
1010
+ const E = P.data;
1011
+ return new Promise((v, A) => {
1012
+ const I = {
1013
+ ...E.workflow,
1014
+ displayName: u.displayName
1117
1015
  };
1118
- f.key !== void 0 && (X.key = f.key), f.tags !== void 0 && (X.tags = f.tags), k.mutate(
1119
- { definition: X, ifUnmodifiedSince: P.updatedAt },
1120
- { onSuccess: () => pe(), onError: re }
1016
+ u.key !== void 0 && (I.key = u.key), u.tags !== void 0 && (I.tags = u.tags), y.mutate(
1017
+ { definition: I, ifUnmodifiedSince: E.updatedAt },
1018
+ { onSuccess: () => v(), onError: A }
1121
1019
  );
1122
1020
  });
1123
1021
  },
1124
- onClose: () => o(!1)
1022
+ onClose: () => l(!1)
1125
1023
  },
1126
- m
1024
+ p
1127
1025
  ),
1128
1026
  /* @__PURE__ */ n(
1129
1027
  gn,
1130
1028
  {
1131
1029
  kind: "workflow",
1132
- archived: Y,
1133
- pending: D.isPending || O.isPending,
1134
- deleteConfirming: A,
1030
+ archived: re,
1031
+ pending: T.isPending || j.isPending,
1032
+ deleteConfirming: S,
1135
1033
  archiveConfirming: U,
1136
- deleteError: $,
1137
- archiveError: z,
1138
- onRequestDelete: () => q(!0),
1139
- onRequestArchive: () => W(!0),
1140
- onConfirmDelete: Z,
1034
+ deleteError: Q,
1035
+ archiveError: G,
1036
+ onRequestDelete: () => F(!0),
1037
+ onRequestArchive: () => V(!0),
1038
+ onConfirmDelete: we,
1141
1039
  onConfirmArchive: fe,
1142
- onCloseDelete: () => q(!1),
1143
- onCloseArchive: () => W(!1)
1040
+ onCloseDelete: () => F(!1),
1041
+ onCloseArchive: () => V(!1)
1144
1042
  }
1145
1043
  ),
1146
- R && /* @__PURE__ */ n(
1147
- nn,
1044
+ H && /* @__PURE__ */ n(
1045
+ xe,
1148
1046
  {
1149
1047
  kind: "workflow",
1150
- project: t ?? void 0,
1048
+ project: i ?? void 0,
1151
1049
  listKeys: vn,
1152
- onOpenImported: (f, P) => i({ type: "imported", kind: f, id: P }),
1153
- onClose: () => Q(!1)
1050
+ onOpenImported: (u, E) => s({ type: "imported", kind: u, id: E }),
1051
+ onClose: () => K(!1)
1154
1052
  }
1155
1053
  )
1156
1054
  ] });
1157
1055
  }
1158
- function xt({ ctx: e }) {
1159
- const { project: t, onNavigate: i } = rn(), [s, a] = u(!1), [o, l] = u(!1), [d, h] = u(!1), c = {
1160
- editingSettings: s,
1056
+ function Ut({ ctx: e }) {
1057
+ const { project: i, onNavigate: s } = on(), [t, a] = f(!1), [l, o] = f(!1), [c, h] = f(!1), d = {
1058
+ editingSettings: t,
1161
1059
  setEditingSettings: a,
1162
- historyOpen: o,
1163
- setHistoryOpen: l,
1164
- versionListOpen: d,
1060
+ historyOpen: l,
1061
+ setHistoryOpen: o,
1062
+ versionListOpen: c,
1165
1063
  setVersionListOpen: h
1166
1064
  };
1167
- return (e == null ? void 0 : e.kind) === "workflow" ? /* @__PURE__ */ n(Xt, { ctx: e, project: t, onNavigate: i, open: c }) : /* @__PURE__ */ n(ei, { ctx: e, project: t, onNavigate: i, open: c });
1065
+ return (e == null ? void 0 : e.kind) === "workflow" ? /* @__PURE__ */ n(Kt, { ctx: e, project: i, onNavigate: s, open: d }) : /* @__PURE__ */ n(zt, { ctx: e, project: i, onNavigate: s, open: d });
1168
1066
  }
1169
- function ei({
1067
+ function zt({
1170
1068
  ctx: e,
1171
- project: t,
1172
- onNavigate: i,
1173
- open: s
1069
+ project: i,
1070
+ onNavigate: s,
1071
+ open: t
1174
1072
  }) {
1175
- var Pe, Te, Ie;
1073
+ var Ae, Pe, Ie;
1176
1074
  const {
1177
1075
  editingSettings: a,
1178
- setEditingSettings: o,
1179
- historyOpen: l,
1180
- setHistoryOpen: d,
1076
+ setEditingSettings: l,
1077
+ historyOpen: o,
1078
+ setHistoryOpen: c,
1181
1079
  versionListOpen: h,
1182
- setVersionListOpen: c
1183
- } = s, v = e == null ? void 0 : e.kind, b = ut(v === "endpoint"), m = xe(v === "function"), [C, k] = u(!1), [D, O] = u(""), [E, M] = u(null), [y, R] = u(null), [Q, N] = u(!1), [g, A] = u(!1), [q, U] = u(!1), [W, $] = u(!1), [oe, z] = u(!1), [le, F] = u(null), [_, te] = u(null), de = Ge((e == null ? void 0 : e.id) ?? "", (e == null ? void 0 : e.kind) === "function"), ke = Ye((e == null ? void 0 : e.id) ?? "", (e == null ? void 0 : e.kind) === "endpoint"), G = Ze(), ie = Xe(), ce = ht(), se = ft(), ue = mt(), T = pt(), he = e ? We(e.kind) : null, H = Be(he, (e == null ? void 0 : e.id) ?? "", g), Y = e && Re(e.kind) ? e.kind : null, Z = Ke(Y, (e == null ? void 0 : e.id) ?? "", l), fe = Ue(Y ?? "function"), ae = ze(Y ?? "function"), [me, f] = u(null), [P, pe] = u(null), [re, X] = u(
1080
+ setVersionListOpen: d
1081
+ } = t, b = e == null ? void 0 : e.kind, w = pt(b === "endpoint"), p = Ze(b === "function"), [P, y] = f(!1), [T, j] = f(""), [D, L] = f(null), [N, H] = f(null), [K, O] = f(!1), [g, S] = f(!1), [F, U] = f(!1), [V, Q] = f(!1), [le, G] = f(!1), [de, W] = f(null), [Y, te] = f(null), ce = ze((e == null ? void 0 : e.id) ?? "", (e == null ? void 0 : e.kind) === "function"), ke = _e((e == null ? void 0 : e.id) ?? "", (e == null ? void 0 : e.kind) === "endpoint"), Z = Ge(), ie = Ye(), ue = gt(), se = vt(), he = bt(), C = kt(), z = e ? Qe(e.kind) : null, $ = Je(z, (e == null ? void 0 : e.id) ?? "", g), X = e && Me(e.kind) ? e.kind : null, _ = en(X, (e == null ? void 0 : e.id) ?? "", o), ae = nn(X ?? "function"), re = tn(X ?? "function"), [we, fe] = f(null), [me, oe] = f(null), [u, E] = f(
1184
1082
  null
1185
1083
  );
1186
1084
  if (!e || e.kind !== "function" && e.kind !== "endpoint")
1187
1085
  return /* @__PURE__ */ n("p", { className: "muted small", children: "Open a workflow, function, or endpoint to see its settings." });
1188
- const S = e.kind, I = e.id, L = S === "function" ? (Pe = m.data) == null ? void 0 : Pe.find((p) => p.id === I) : (Te = b.data) == null ? void 0 : Te.find((p) => p.id === I), J = _e(S, S === "function" ? de.data : ke.data), x = (J == null ? void 0 : J.definition) ?? null, Ee = L && typeof L.displayName == "string" ? L.displayName : "", bn = x ? JSON.stringify(x, null, 2) : "";
1189
- function yn() {
1190
- M(null), O(bn), R((J == null ? void 0 : J.updatedAt) ?? null), k(!0);
1191
- }
1192
- const ee = x ? En(D, { id: String(x.id), key: String(x.key) }) : { parsed: null, blockedReason: "No definition loaded yet." }, Ae = S === "function" ? G.isPending : ie.isPending;
1086
+ const v = e.kind, A = e.id, I = v === "function" ? (Ae = p.data) == null ? void 0 : Ae.find((m) => m.id === A) : (Pe = w.data) == null ? void 0 : Pe.find((m) => m.id === A), q = Ue(v, v === "function" ? ce.data : ke.data), x = (q == null ? void 0 : q.definition) ?? null, Ce = I && typeof I.displayName == "string" ? I.displayName : "", bn = x ? JSON.stringify(x, null, 2) : "";
1193
1087
  function kn() {
1088
+ L(null), j(bn), H((q == null ? void 0 : q.updatedAt) ?? null), y(!0);
1089
+ }
1090
+ const ee = x ? En(T, { id: String(x.id), key: String(x.key) }) : { parsed: null, blockedReason: "No definition loaded yet." }, Ee = v === "function" ? Z.isPending : ie.isPending;
1091
+ function wn() {
1194
1092
  if (!ee.parsed || ee.blockedReason) return;
1195
- M(null);
1196
- const p = {
1197
- onSuccess: () => k(!1),
1198
- onError: (ne) => M(ne instanceof j ? ne.message : String(ne))
1199
- }, w = { definition: ee.parsed, ifUnmodifiedSince: y };
1200
- S === "function" ? G.mutate(w, p) : ie.mutate(w, p);
1093
+ L(null);
1094
+ const m = {
1095
+ onSuccess: () => y(!1),
1096
+ onError: (ne) => L(ne instanceof M ? ne.message : String(ne))
1097
+ }, k = { definition: ee.parsed, ifUnmodifiedSince: N };
1098
+ v === "function" ? Z.mutate(k, m) : ie.mutate(k, m);
1201
1099
  }
1202
- const wn = (L == null ? void 0 : L.archivedAt) != null;
1100
+ const yn = (I == null ? void 0 : I.archivedAt) != null;
1203
1101
  function Nn() {
1204
- F(null);
1205
- const p = {
1102
+ W(null);
1103
+ const m = {
1206
1104
  onSuccess: () => {
1207
- $(!1), i({ type: "list" });
1105
+ Q(!1), s({ type: "list" });
1208
1106
  },
1209
- onError: (w) => {
1210
- $(!1), F(w instanceof j ? w.message : String(w));
1107
+ onError: (k) => {
1108
+ Q(!1), W(k instanceof M ? k.message : String(k));
1211
1109
  }
1212
1110
  };
1213
- S === "function" ? ce.mutate(I, p) : se.mutate(I, p);
1111
+ v === "function" ? ue.mutate(A, m) : se.mutate(A, m);
1214
1112
  }
1215
1113
  function Sn() {
1216
1114
  te(null);
1217
- const p = {
1115
+ const m = {
1218
1116
  onSuccess: () => {
1219
- z(!1), i({ type: "list" });
1117
+ G(!1), s({ type: "list" });
1220
1118
  },
1221
- onError: (w) => {
1222
- z(!1), te(w instanceof j ? w.message : String(w));
1119
+ onError: (k) => {
1120
+ G(!1), te(k instanceof M ? k.message : String(k));
1223
1121
  }
1224
1122
  };
1225
- S === "function" ? ue.mutate(I, p) : T.mutate(I, p);
1123
+ v === "function" ? he.mutate(A, m) : C.mutate(A, m);
1226
1124
  }
1227
1125
  return /* @__PURE__ */ r("div", { className: "rail-settings-panel", children: [
1228
- /* @__PURE__ */ n(cn, { onEdit: () => o(!0) }),
1126
+ /* @__PURE__ */ n(cn, { onEdit: () => l(!0) }),
1229
1127
  /* @__PURE__ */ n(
1230
1128
  un,
1231
1129
  {
1232
- id: I,
1233
- displayName: Ee,
1234
- fields: $e(S),
1235
- row: L
1130
+ id: A,
1131
+ displayName: Ce,
1132
+ fields: We(v),
1133
+ row: I
1236
1134
  }
1237
1135
  ),
1238
- je(S) && /* @__PURE__ */ n(hn, { onOpen: () => N(!0) }),
1239
- Re(S) && /* @__PURE__ */ n(
1136
+ Re(v) && /* @__PURE__ */ n(hn, { onOpen: () => O(!0) }),
1137
+ Me(v) && /* @__PURE__ */ n(
1240
1138
  mn,
1241
1139
  {
1242
- open: l,
1243
- versions: Z.data,
1244
- publishing: fe.isPending,
1245
- togglingEnabled: ae.isPending,
1246
- publishError: me,
1247
- enableError: P,
1140
+ open: o,
1141
+ versions: _.data,
1142
+ publishing: ae.isPending,
1143
+ togglingEnabled: re.isPending,
1144
+ publishError: we,
1145
+ enableError: me,
1248
1146
  onShow: () => {
1249
- d(!0), c(!0);
1147
+ c(!0), d(!0);
1250
1148
  },
1251
1149
  onPublish: () => {
1252
- f(null), fe.mutate(I, {
1253
- onError: (p) => f(p instanceof j ? p.message : String(p))
1150
+ fe(null), ae.mutate(A, {
1151
+ onError: (m) => fe(m instanceof M ? m.message : String(m))
1254
1152
  });
1255
1153
  },
1256
1154
  onToggleEnabled: () => {
1257
- var p;
1258
- pe(null), ae.mutate(
1259
- { id: I, enabled: !((p = Z.data) != null && p.enabled) },
1260
- { onError: (w) => pe(w instanceof j ? w.message : String(w)) }
1155
+ var m;
1156
+ oe(null), re.mutate(
1157
+ { id: A, enabled: !((m = _.data) != null && m.enabled) },
1158
+ { onError: (k) => oe(k instanceof M ? k.message : String(k)) }
1261
1159
  );
1262
1160
  }
1263
1161
  }
@@ -1265,30 +1163,30 @@ function ei({
1265
1163
  h && /* @__PURE__ */ n(
1266
1164
  pn,
1267
1165
  {
1268
- loading: Z.isLoading,
1269
- versions: (Ie = Z.data) == null ? void 0 : Ie.versions,
1270
- onSelect: (p) => X({ id: I, versionNumber: p }),
1271
- onClose: () => c(!1)
1166
+ loading: _.isLoading,
1167
+ versions: (Ie = _.data) == null ? void 0 : Ie.versions,
1168
+ onSelect: (m) => E({ id: A, versionNumber: m }),
1169
+ onClose: () => d(!1)
1272
1170
  }
1273
1171
  ),
1274
- re && re.id === I && /* @__PURE__ */ n(
1172
+ u && u.id === A && /* @__PURE__ */ n(
1275
1173
  dn,
1276
1174
  {
1277
- kind: S,
1278
- id: I,
1279
- versionNumber: re.versionNumber,
1280
- onClose: () => X(null)
1175
+ kind: v,
1176
+ id: A,
1177
+ versionNumber: u.versionNumber,
1178
+ onClose: () => E(null)
1281
1179
  }
1282
1180
  ),
1283
- Q && /* @__PURE__ */ n(
1181
+ K && /* @__PURE__ */ n(
1284
1182
  fn,
1285
1183
  {
1286
- kind: S,
1287
- onClose: () => N(!1),
1184
+ kind: v,
1185
+ onClose: () => O(!1),
1288
1186
  onImport: () => {
1289
- N(!1), U(!0);
1187
+ O(!1), U(!0);
1290
1188
  },
1291
- children: je(S) && /* @__PURE__ */ r(V, { children: [
1189
+ children: Re(v) && /* @__PURE__ */ r(R, { children: [
1292
1190
  /* @__PURE__ */ n("p", { className: "muted small", children: "Export a portable definition — the same shape Import accepts — or Edit JSON to change what's stored directly." }),
1293
1191
  /* @__PURE__ */ r("div", { className: "rail-spec-menu-row", children: [
1294
1192
  /* @__PURE__ */ n(
@@ -1298,7 +1196,7 @@ function ei({
1298
1196
  className: "btn ghost",
1299
1197
  "data-testid": "rail-spec-export",
1300
1198
  onClick: () => {
1301
- N(!1), A(!0);
1199
+ O(!1), S(!0);
1302
1200
  },
1303
1201
  children: "Export"
1304
1202
  }
@@ -1312,7 +1210,7 @@ function ei({
1312
1210
  disabled: !x,
1313
1211
  "data-testid": "rail-json-edit",
1314
1212
  onClick: () => {
1315
- N(!1), yn();
1213
+ O(!1), kn();
1316
1214
  },
1317
1215
  children: "Edit JSON"
1318
1216
  }
@@ -1321,128 +1219,128 @@ function ei({
1321
1219
  ] })
1322
1220
  }
1323
1221
  ),
1324
- g && /* @__PURE__ */ r(B, { title: "Export spec document", onClose: () => A(!1), wide: !0, children: [
1325
- /* @__PURE__ */ n("div", { className: "modal-body", children: H.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : H.isError ? /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-spec-error", children: H.error instanceof Error ? H.error.message : String(H.error) }) : H.data ? /* @__PURE__ */ n("div", { "data-testid": "rail-spec-json", children: /* @__PURE__ */ n(
1326
- ge,
1222
+ g && /* @__PURE__ */ r(B, { title: "Export spec document", onClose: () => S(!1), wide: !0, children: [
1223
+ /* @__PURE__ */ n("div", { className: "modal-body", children: $.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : $.isError ? /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-spec-error", children: $.error instanceof Error ? $.error.message : String($.error) }) : $.data ? /* @__PURE__ */ n("div", { "data-testid": "rail-spec-json", children: /* @__PURE__ */ n(
1224
+ pe,
1327
1225
  {
1328
- code: JSON.stringify(H.data, null, 2),
1226
+ code: JSON.stringify($.data, null, 2),
1329
1227
  language: "json",
1330
1228
  maxHeight: "420px",
1331
1229
  copyable: !0
1332
1230
  }
1333
1231
  ) }) : null }),
1334
- /* @__PURE__ */ n("div", { className: "modal-actions", children: /* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: () => A(!1), children: "Close" }) })
1232
+ /* @__PURE__ */ n("div", { className: "modal-actions", children: /* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: () => S(!1), children: "Close" }) })
1335
1233
  ] }),
1336
- C && /* @__PURE__ */ r(B, { title: "Edit definition", onClose: () => k(!1), wide: !0, children: [
1234
+ P && /* @__PURE__ */ r(B, { title: "Edit definition", onClose: () => y(!1), wide: !0, children: [
1337
1235
  /* @__PURE__ */ r("div", { className: "modal-body", children: [
1338
1236
  /* @__PURE__ */ n(
1339
- Mn,
1237
+ On,
1340
1238
  {
1341
- value: D,
1342
- onChange: O,
1239
+ value: T,
1240
+ onChange: j,
1343
1241
  minHeight: "320px",
1344
1242
  "aria-label": "Edit definition JSON"
1345
1243
  }
1346
1244
  ),
1347
1245
  ee.blockedReason && /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-edit-reason", children: ee.blockedReason }),
1348
- E && /* @__PURE__ */ n("div", { className: "error", children: E })
1246
+ D && /* @__PURE__ */ n("div", { className: "error", children: D })
1349
1247
  ] }),
1350
1248
  /* @__PURE__ */ r("div", { className: "modal-actions", children: [
1351
- /* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: () => k(!1), children: "Cancel" }),
1249
+ /* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: () => y(!1), children: "Cancel" }),
1352
1250
  /* @__PURE__ */ n(
1353
1251
  "button",
1354
1252
  {
1355
1253
  type: "button",
1356
1254
  className: "btn",
1357
- disabled: ee.blockedReason !== null || Ae,
1255
+ disabled: ee.blockedReason !== null || Ee,
1358
1256
  "data-testid": "rail-json-save",
1359
- onClick: kn,
1360
- children: Ae ? "Saving…" : "Save"
1257
+ onClick: wn,
1258
+ children: Ee ? "Saving…" : "Save"
1361
1259
  }
1362
1260
  )
1363
1261
  ] })
1364
1262
  ] }),
1365
- a && L && /* @__PURE__ */ n(
1366
- ln,
1263
+ a && I && /* @__PURE__ */ n(
1264
+ Xe,
1367
1265
  {
1368
- kind: S,
1369
- id: I,
1266
+ kind: v,
1267
+ id: A,
1370
1268
  initial: {
1371
- displayName: Ee,
1372
- key: L.key ?? null,
1373
- tags: L.tags ?? []
1269
+ displayName: Ce,
1270
+ key: I.key ?? null,
1271
+ tags: I.tags ?? []
1374
1272
  },
1375
- onSave: async (p) => {
1376
- if (!J) throw new Error("Unable to save settings");
1377
- const w = J.definition, ne = L.tags ?? [], De = p.tags !== void 0 && (p.tags.length !== ne.length || p.tags.some((we, Ne) => we !== ne[Ne])) ? { tags: p.tags } : {}, Oe = { definition: S === "function" ? (
1273
+ onSave: async (m) => {
1274
+ if (!q) throw new Error("Unable to save settings");
1275
+ const k = q.definition, ne = I.tags ?? [], De = m.tags !== void 0 && (m.tags.length !== ne.length || m.tags.some((ye, Ne) => ye !== ne[Ne])) ? { tags: m.tags } : {}, Te = { definition: v === "function" ? (
1378
1276
  // `canEditKey: true` for function (`callable-descriptors.ts`): `data.key` must
1379
1277
  // reach the server (the modal falls back to `initial.key` when unchanged).
1380
- { ...w, displayName: p.displayName, key: p.key ?? w.key, ...De }
1381
- ) : { ...w, displayName: p.displayName, ...De }, ifUnmodifiedSince: J.updatedAt };
1382
- return new Promise((we, Ne) => {
1383
- const Me = { onSuccess: () => we(), onError: Ne };
1384
- S === "function" ? G.mutate(Oe, Me) : ie.mutate(Oe, Me);
1278
+ { ...k, displayName: m.displayName, key: m.key ?? k.key, ...De }
1279
+ ) : { ...k, displayName: m.displayName, ...De }, ifUnmodifiedSince: q.updatedAt };
1280
+ return new Promise((ye, Ne) => {
1281
+ const Oe = { onSuccess: () => ye(), onError: Ne };
1282
+ v === "function" ? Z.mutate(Te, Oe) : ie.mutate(Te, Oe);
1385
1283
  });
1386
1284
  },
1387
- onClose: () => o(!1)
1285
+ onClose: () => l(!1)
1388
1286
  },
1389
- I
1287
+ A
1390
1288
  ),
1391
- An(S) && /* @__PURE__ */ n(
1289
+ An(v) && /* @__PURE__ */ n(
1392
1290
  gn,
1393
1291
  {
1394
- kind: S,
1395
- archived: wn,
1396
- deleteConfirming: W,
1397
- archiveConfirming: oe,
1398
- deleteError: le,
1399
- archiveError: _,
1400
- onRequestDelete: () => $(!0),
1401
- onRequestArchive: () => z(!0),
1292
+ kind: v,
1293
+ archived: yn,
1294
+ deleteConfirming: V,
1295
+ archiveConfirming: le,
1296
+ deleteError: de,
1297
+ archiveError: Y,
1298
+ onRequestDelete: () => Q(!0),
1299
+ onRequestArchive: () => G(!0),
1402
1300
  onConfirmDelete: Nn,
1403
1301
  onConfirmArchive: Sn,
1404
- onCloseDelete: () => $(!1),
1405
- onCloseArchive: () => z(!1)
1302
+ onCloseDelete: () => Q(!1),
1303
+ onCloseArchive: () => G(!1)
1406
1304
  }
1407
1305
  ),
1408
- q && /* @__PURE__ */ n(
1409
- nn,
1306
+ F && /* @__PURE__ */ n(
1307
+ xe,
1410
1308
  {
1411
- kind: S,
1412
- project: t ?? void 0,
1309
+ kind: v,
1310
+ project: i ?? void 0,
1413
1311
  listKeys: vn,
1414
- onOpenImported: (p, w) => i({ type: "imported", kind: p, id: w }),
1312
+ onOpenImported: (m, k) => s({ type: "imported", kind: m, id: k }),
1415
1313
  onClose: () => U(!1)
1416
1314
  }
1417
1315
  )
1418
1316
  ] });
1419
1317
  }
1420
- function ni() {
1421
- return /* @__PURE__ */ n(K, { name: "settings" });
1318
+ function _t() {
1319
+ return /* @__PURE__ */ n(J, { name: "settings" });
1422
1320
  }
1423
- const ti = {
1321
+ const Gt = {
1424
1322
  id: "settings",
1425
1323
  title: "Settings",
1426
1324
  rendersHeading: !0,
1427
- Icon: ni,
1325
+ Icon: _t,
1428
1326
  isAvailable: (e) => (e == null ? void 0 : e.kind) === "workflow" || (e == null ? void 0 : e.kind) === "function" || (e == null ? void 0 : e.kind) === "endpoint",
1429
- Panel: xt
1430
- }, ii = ["string", "number", "boolean", "object", "array"];
1431
- function si({
1327
+ Panel: Ut
1328
+ }, Yt = ["string", "number", "boolean", "object", "array"];
1329
+ function Zt({
1432
1330
  variables: e,
1433
- onVariablesChange: t
1331
+ onVariablesChange: i
1434
1332
  }) {
1435
- const i = Rn().vars ?? [];
1436
- function s() {
1437
- t([...e, { key: "" }]);
1333
+ const s = Mn().vars ?? [];
1334
+ function t() {
1335
+ i([...e, { key: "" }]);
1438
1336
  }
1439
- function a(d, h) {
1440
- t(e.map((c, v) => v === d ? { ...c, ...h } : c));
1337
+ function a(c, h) {
1338
+ i(e.map((d, b) => b === c ? { ...d, ...h } : d));
1441
1339
  }
1442
- function o(d) {
1443
- t(e.filter((h, c) => c !== d));
1340
+ function l(c) {
1341
+ i(e.filter((h, d) => d !== c));
1444
1342
  }
1445
- const l = Fn(e);
1343
+ const o = $n(e);
1446
1344
  return /* @__PURE__ */ r("div", { className: "workflow-variable-fields", children: [
1447
1345
  /* @__PURE__ */ r("p", { className: "muted small", children: [
1448
1346
  "Declaring variables here defines this workflow's ",
@@ -1451,7 +1349,7 @@ function si({
1451
1349
  ] }),
1452
1350
  /* @__PURE__ */ r("div", { className: "row", style: { justifyContent: "space-between", alignItems: "center" }, children: [
1453
1351
  /* @__PURE__ */ n("span", { className: "muted small", children: e.length === 0 ? "No variables declared." : `${e.length} variable${e.length === 1 ? "" : "s"} declared.` }),
1454
- /* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: s, children: "+ Add variable" })
1352
+ /* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: t, children: "+ Add variable" })
1455
1353
  ] }),
1456
1354
  e.length > 0 && /* @__PURE__ */ r("div", { className: "workflow-variable-head", "aria-hidden": "true", children: [
1457
1355
  /* @__PURE__ */ n("span", { children: "Key" }),
@@ -1460,7 +1358,7 @@ function si({
1460
1358
  /* @__PURE__ */ n("span", { children: "Required" }),
1461
1359
  /* @__PURE__ */ n("span", {})
1462
1360
  ] }),
1463
- e.length > 0 && /* @__PURE__ */ n("ul", { className: "workflow-variable-list", "data-testid": "workflow-variables-list", children: e.map((d, h) => (
1361
+ e.length > 0 && /* @__PURE__ */ n("ul", { className: "workflow-variable-list", "data-testid": "workflow-variables-list", children: e.map((c, h) => (
1464
1362
  // biome-ignore lint/suspicious/noArrayIndexKey: rows are positional and reorderable
1465
1363
  /* @__PURE__ */ r("li", { children: [
1466
1364
  /* @__PURE__ */ r("div", { className: "workflow-variable-row", children: [
@@ -1469,36 +1367,36 @@ function si({
1469
1367
  {
1470
1368
  type: "text",
1471
1369
  className: "workflow-variable-key",
1472
- value: d.key,
1370
+ value: c.key,
1473
1371
  placeholder: "key",
1474
1372
  "aria-label": "Variable key",
1475
1373
  spellCheck: !1,
1476
- onChange: (c) => a(h, { key: c.target.value })
1374
+ onChange: (d) => a(h, { key: d.target.value })
1477
1375
  }
1478
1376
  ),
1479
1377
  /* @__PURE__ */ r(
1480
1378
  "select",
1481
1379
  {
1482
- value: d.type ?? "",
1380
+ value: c.type ?? "",
1483
1381
  "aria-label": "Variable type",
1484
- onChange: (c) => a(h, {
1485
- type: c.target.value || void 0
1382
+ onChange: (d) => a(h, {
1383
+ type: d.target.value || void 0
1486
1384
  }),
1487
1385
  children: [
1488
1386
  /* @__PURE__ */ n("option", { value: "", children: "(any)" }),
1489
- ii.map((c) => /* @__PURE__ */ n("option", { value: c, children: c }, c))
1387
+ Yt.map((d) => /* @__PURE__ */ n("option", { value: d, children: d }, d))
1490
1388
  ]
1491
1389
  }
1492
1390
  ),
1493
1391
  /* @__PURE__ */ n(
1494
- Je,
1392
+ qe,
1495
1393
  {
1496
- value: { vars: Hn(e, h, i) },
1394
+ value: { vars: Hn(e, h, s) },
1497
1395
  children: /* @__PURE__ */ n(
1498
- jn,
1396
+ Rn,
1499
1397
  {
1500
- value: d.default,
1501
- onChange: (c) => a(h, { default: c }),
1398
+ value: c.default,
1399
+ onChange: (d) => a(h, { default: d }),
1502
1400
  placeholder: "no default",
1503
1401
  "aria-label": "Variable default"
1504
1402
  },
@@ -1511,110 +1409,110 @@ function si({
1511
1409
  {
1512
1410
  type: "checkbox",
1513
1411
  className: "workflow-variable-required",
1514
- checked: d.required ?? !1,
1515
- "aria-label": `${d.key || "Variable"} is required`,
1516
- onChange: (c) => a(h, { required: c.target.checked })
1412
+ checked: c.required ?? !1,
1413
+ "aria-label": `${c.key || "Variable"} is required`,
1414
+ onChange: (d) => a(h, { required: d.target.checked })
1517
1415
  }
1518
1416
  ),
1519
1417
  /* @__PURE__ */ n(
1520
- Se,
1418
+ Be,
1521
1419
  {
1522
1420
  danger: !0,
1523
1421
  icon: "close",
1524
- label: `Remove variable ${d.key || h + 1}`,
1525
- onClick: () => o(h)
1422
+ label: `Remove variable ${c.key || h + 1}`,
1423
+ onClick: () => l(h)
1526
1424
  }
1527
1425
  )
1528
1426
  ] }),
1529
- l.includes(h) && /* @__PURE__ */ n("span", { className: "muted small", "data-testid": "variable-duplicate", children: "Duplicate key — a later row with the same name wins." })
1427
+ o.includes(h) && /* @__PURE__ */ n("span", { className: "muted small", "data-testid": "variable-duplicate", children: "Duplicate key — a later row with the same name wins." })
1530
1428
  ] }, h)
1531
1429
  )) })
1532
1430
  ] });
1533
1431
  }
1534
- function ai({
1432
+ function Xt({
1535
1433
  variables: e,
1536
- onVariablesChange: t,
1537
- onClose: i
1434
+ onVariablesChange: i,
1435
+ onClose: s
1538
1436
  }) {
1539
- return /* @__PURE__ */ r(B, { title: "Workflow inputs", onClose: i, wide: !0, children: [
1540
- /* @__PURE__ */ n("div", { className: "modal-body", "data-testid": "workflow-inputs-modal", children: /* @__PURE__ */ n(si, { variables: e, onVariablesChange: t }) }),
1541
- /* @__PURE__ */ n("div", { className: "modal-actions", children: /* @__PURE__ */ n("button", { type: "button", className: "btn", onClick: i, children: "Done" }) })
1437
+ return /* @__PURE__ */ r(B, { title: "Workflow inputs", onClose: s, wide: !0, children: [
1438
+ /* @__PURE__ */ n("div", { className: "modal-body", "data-testid": "workflow-inputs-modal", children: /* @__PURE__ */ n(Zt, { variables: e, onVariablesChange: i }) }),
1439
+ /* @__PURE__ */ n("div", { className: "modal-actions", children: /* @__PURE__ */ n("button", { type: "button", className: "btn", onClick: s, children: "Done" }) })
1542
1440
  ] });
1543
1441
  }
1544
- function Ce(e) {
1442
+ function Se(e) {
1545
1443
  return e !== null && typeof e == "object" && !Array.isArray(e);
1546
1444
  }
1547
- function ri(e, t) {
1548
- if (Ce(e)) return e;
1549
- if (t && t.length > 0) return Tt(t);
1445
+ function xt(e, i) {
1446
+ if (Se(e)) return e;
1447
+ if (i && i.length > 0) return Ct(i);
1550
1448
  }
1551
- function oi(e) {
1552
- const t = /* @__PURE__ */ new Map(), i = [...e].sort((s, a) => s.seq - a.seq);
1553
- for (const s of i) {
1554
- if (s.warning !== void 0 || !Array.isArray(s.path)) continue;
1555
- const a = s.nodeId ?? null, o = s.new !== void 0 && s.new !== null;
1556
- if (s.path.length === 0) {
1557
- if (t.clear(), o && Ce(s.new)) for (const d of Object.keys(s.new)) t.set(d, a);
1449
+ function ei(e) {
1450
+ const i = /* @__PURE__ */ new Map(), s = [...e].sort((t, a) => t.seq - a.seq);
1451
+ for (const t of s) {
1452
+ if (t.warning !== void 0 || !Array.isArray(t.path)) continue;
1453
+ const a = t.nodeId ?? null, l = t.new !== void 0 && t.new !== null;
1454
+ if (t.path.length === 0) {
1455
+ if (i.clear(), l && Se(t.new)) for (const c of Object.keys(t.new)) i.set(c, a);
1558
1456
  continue;
1559
1457
  }
1560
- const l = s.path[0];
1561
- s.path.length === 1 && !o ? t.delete(l) : t.set(l, a);
1458
+ const o = t.path[0];
1459
+ t.path.length === 1 && !l ? i.delete(o) : i.set(o, a);
1562
1460
  }
1563
- return t;
1461
+ return i;
1564
1462
  }
1565
- const li = /\{\{[\s\S]*?\}\}/;
1566
- function di(e) {
1567
- const t = [], i = (s, a) => {
1568
- if (Ce(s) && Object.keys(s).length > 0) {
1569
- for (const [o, l] of Object.entries(s)) i(l, a ? `${a}.${o}` : o);
1463
+ const ni = /\{\{[\s\S]*?\}\}/;
1464
+ function ti(e) {
1465
+ const i = [], s = (t, a) => {
1466
+ if (Se(t) && Object.keys(t).length > 0) {
1467
+ for (const [l, o] of Object.entries(t)) s(o, a ? `${a}.${l}` : l);
1570
1468
  return;
1571
1469
  }
1572
- if (typeof s == "string" && li.test(s)) {
1573
- t.push({ path: a, kind: "reference", text: s });
1470
+ if (typeof t == "string" && ni.test(t)) {
1471
+ i.push({ path: a, kind: "reference", text: t });
1574
1472
  return;
1575
1473
  }
1576
- t.push({ path: a, kind: "literal", text: JSON.stringify(s) ?? String(s) });
1474
+ i.push({ path: a, kind: "literal", text: JSON.stringify(t) ?? String(t) });
1577
1475
  };
1578
- if (e) for (const [s, a] of Object.entries(e)) i(a, s);
1579
- return t;
1476
+ if (e) for (const [t, a] of Object.entries(e)) s(a, t);
1477
+ return i;
1580
1478
  }
1581
- function ci(e) {
1479
+ function ii(e) {
1582
1480
  if (e == null || e === "") return null;
1583
1481
  if (typeof e == "string" || typeof e == "number" || typeof e == "boolean")
1584
1482
  return String(e);
1585
1483
  if (typeof e == "object" && !Array.isArray(e)) {
1586
- const t = e;
1587
- if (t.type === "secret") return "•••";
1588
- if (t.type === "expr" && Array.isArray(t.parts)) {
1589
- const i = t.parts.map((s) => s.kind === "text" ? s.value ?? "" : s.kind === "secret" ? "•••" : (s.kind === "var" || s.kind === "render") && s.ref ? `{{${s.ref}}}` : "{{…}}").join("");
1590
- return i === "" ? null : i;
1484
+ const i = e;
1485
+ if (i.type === "secret") return "•••";
1486
+ if (i.type === "expr" && Array.isArray(i.parts)) {
1487
+ const s = i.parts.map((t) => t.kind === "text" ? t.value ?? "" : t.kind === "secret" ? "•••" : (t.kind === "var" || t.kind === "render") && t.ref ? `{{${t.ref}}}` : "{{…}}").join("");
1488
+ return s === "" ? null : s;
1591
1489
  }
1592
1490
  }
1593
1491
  return JSON.stringify(e);
1594
1492
  }
1595
- function ui(e) {
1493
+ function si(e) {
1596
1494
  return (e == null ? void 0 : e.kind) === "workflow" ? e.onOpenStartingState : void 0;
1597
1495
  }
1598
- function hi() {
1599
- return /* @__PURE__ */ n(K, { name: "database" });
1496
+ function ai() {
1497
+ return /* @__PURE__ */ n(J, { name: "database" });
1600
1498
  }
1601
- function fi({ ctx: e }) {
1602
- var k, D, O, E, M;
1603
- const t = Pt(), i = wt(e.id), s = (k = i.data) == null ? void 0 : k[0], a = Nt((s == null ? void 0 : s.runId) ?? null), o = ((D = a.data) == null ? void 0 : D.status) ?? (s == null ? void 0 : s.status), l = St((s == null ? void 0 : s.runId) ?? null, o), d = o !== void 0 && !Ct(o), h = qe(null);
1604
- if (be(() => {
1605
- !d || !s || s.finishedAt !== null || h.current !== s.runId && (h.current = s.runId, t.invalidateQueries({ queryKey: Et(e.id) }));
1606
- }, [d, s, t, e.id]), i.isLoading) return /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" });
1607
- if (!s)
1499
+ function ri({ ctx: e }) {
1500
+ var y, T, j, D, L;
1501
+ const i = St(), s = et(e.id), t = (y = s.data) == null ? void 0 : y[0], a = nt((t == null ? void 0 : t.runId) ?? null), l = ((T = a.data) == null ? void 0 : T.status) ?? (t == null ? void 0 : t.status), o = tt((t == null ? void 0 : t.runId) ?? null, l), c = l !== void 0 && !it(l), h = Fe(null);
1502
+ if (ve(() => {
1503
+ !c || !t || t.finishedAt !== null || h.current !== t.runId && (h.current = t.runId, i.invalidateQueries({ queryKey: st(e.id) }));
1504
+ }, [c, t, i, e.id]), s.isLoading) return /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" });
1505
+ if (!t)
1608
1506
  return /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-state-current-empty", children: "No run yet. Run the workflow and the state it ends with shows here." });
1609
- const c = ((O = l.data) == null ? void 0 : O.writes) ?? [], v = (E = a.data) == null ? void 0 : E.state, b = ri(v, c), m = oi(c), C = b ? Object.keys(b) : [];
1507
+ const d = ((j = o.data) == null ? void 0 : j.writes) ?? [], b = (D = a.data) == null ? void 0 : D.state, w = xt(b, d), p = ei(d), P = w ? Object.keys(w) : [];
1610
1508
  return /* @__PURE__ */ r("div", { className: "w6w-stack", "data-testid": "rail-state-current", children: [
1611
1509
  /* @__PURE__ */ r("dl", { className: "rail-meta-list", children: [
1612
1510
  /* @__PURE__ */ n("dt", { children: "Run" }),
1613
- /* @__PURE__ */ n("dd", { children: /* @__PURE__ */ n("code", { "data-testid": "rail-state-run-id", children: s.runId }) }),
1511
+ /* @__PURE__ */ n("dd", { children: /* @__PURE__ */ n("code", { "data-testid": "rail-state-run-id", children: t.runId }) }),
1614
1512
  /* @__PURE__ */ n("dt", { children: "Started" }),
1615
- /* @__PURE__ */ n("dd", { children: new Date(s.startedAt).toLocaleString() }),
1513
+ /* @__PURE__ */ n("dd", { children: new Date(t.startedAt).toLocaleString() }),
1616
1514
  /* @__PURE__ */ n("dt", { children: "Status" }),
1617
- /* @__PURE__ */ n("dd", { "data-testid": "rail-state-run-status", children: o })
1515
+ /* @__PURE__ */ n("dd", { "data-testid": "rail-state-run-status", children: l })
1618
1516
  ] }),
1619
1517
  e.onOpenRun && /* @__PURE__ */ n(
1620
1518
  "button",
@@ -1623,35 +1521,35 @@ function fi({ ctx: e }) {
1623
1521
  className: "btn ghost",
1624
1522
  "data-testid": "rail-state-open-run",
1625
1523
  onClick: () => {
1626
- var y;
1627
- return (y = e.onOpenRun) == null ? void 0 : y.call(e, s.runId);
1524
+ var N;
1525
+ return (N = e.onOpenRun) == null ? void 0 : N.call(e, t.runId);
1628
1526
  },
1629
1527
  children: "Open this run"
1630
1528
  }
1631
1529
  ),
1632
- a.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : C.length === 0 || !b ? /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-state-current-none", children: "This run has no state." }) : /* @__PURE__ */ r(V, { children: [
1633
- /* @__PURE__ */ n(Ln, { value: b }),
1634
- /* @__PURE__ */ n("ul", { className: "list", "data-testid": "rail-state-writers", children: C.map((y) => {
1635
- const R = m.get(y);
1530
+ a.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : P.length === 0 || !w ? /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-state-current-none", children: "This run has no state." }) : /* @__PURE__ */ r(R, { children: [
1531
+ /* @__PURE__ */ n(jn, { value: w }),
1532
+ /* @__PURE__ */ n("ul", { className: "list", "data-testid": "rail-state-writers", children: P.map((N) => {
1533
+ const H = p.get(N);
1636
1534
  return /* @__PURE__ */ n("li", { "data-testid": "rail-state-writer", children: /* @__PURE__ */ r("span", { className: "list-main", children: [
1637
- /* @__PURE__ */ n("code", { children: y }),
1638
- /* @__PURE__ */ n("span", { className: "muted small block", children: R ? /* @__PURE__ */ r(V, { children: [
1535
+ /* @__PURE__ */ n("code", { children: N }),
1536
+ /* @__PURE__ */ n("span", { className: "muted small block", children: H ? /* @__PURE__ */ r(R, { children: [
1639
1537
  "Last written by ",
1640
- /* @__PURE__ */ n("code", { children: R })
1641
- ] }) : m.has(y) ? "From the starting state" : "No step wrote it" })
1642
- ] }) }, y);
1538
+ /* @__PURE__ */ n("code", { children: H })
1539
+ ] }) : p.has(N) ? "From the starting state" : "No step wrote it" })
1540
+ ] }) }, N);
1643
1541
  }) }),
1644
- ((M = l.data) == null ? void 0 : M.truncated) && /* @__PURE__ */ n("p", { className: "muted small", children: "The run's state log reached its limit, so later writers aren't shown." })
1542
+ ((L = o.data) == null ? void 0 : L.truncated) && /* @__PURE__ */ n("p", { className: "muted small", children: "The run's state log reached its limit, so later writers aren't shown." })
1645
1543
  ] })
1646
1544
  ] });
1647
1545
  }
1648
- function mi({ ctx: e }) {
1649
- const t = di(e.startingState), i = qn(e.startingState, e.variables ?? []);
1546
+ function oi({ ctx: e }) {
1547
+ const i = ti(e.startingState), s = Fn(e.startingState, e.variables ?? []);
1650
1548
  return /* @__PURE__ */ r("div", { className: "w6w-stack", "data-testid": "rail-state-starting", children: [
1651
1549
  /* @__PURE__ */ n("p", { className: "muted small", children: "Workflow inputs override starting state; starting state overrides project variables with the same name." }),
1652
- i.length > 0 && /* @__PURE__ */ r("p", { className: "muted small", "data-testid": "starting-data-collision", children: [
1550
+ s.length > 0 && /* @__PURE__ */ r("p", { className: "muted small", "data-testid": "starting-data-collision", children: [
1653
1551
  "Overridden by workflow inputs: ",
1654
- i.join(", "),
1552
+ s.join(", "),
1655
1553
  "."
1656
1554
  ] }),
1657
1555
  /* @__PURE__ */ n(
@@ -1661,27 +1559,27 @@ function mi({ ctx: e }) {
1661
1559
  className: "btn",
1662
1560
  "data-testid": "rail-state-edit-starting",
1663
1561
  onClick: () => {
1664
- var s;
1665
- return (s = e.onOpenStartingState) == null ? void 0 : s.call(e);
1562
+ var t;
1563
+ return (t = e.onOpenStartingState) == null ? void 0 : t.call(e);
1666
1564
  },
1667
1565
  children: "Edit starting state"
1668
1566
  }
1669
1567
  ),
1670
- t.length === 0 ? /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-state-starting-empty", children: "No starting state. Every run begins with an empty state." }) : /* @__PURE__ */ n("ul", { className: "list", children: t.map((s) => /* @__PURE__ */ n("li", { "data-testid": "rail-state-starting-row", "data-kind": s.kind, children: /* @__PURE__ */ r("span", { className: "list-main", children: [
1671
- /* @__PURE__ */ n("code", { children: s.path }),
1672
- /* @__PURE__ */ n("span", { className: "muted small block", children: s.kind === "reference" ? /* @__PURE__ */ r(V, { children: [
1568
+ i.length === 0 ? /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-state-starting-empty", children: "No starting state. Every run begins with an empty state." }) : /* @__PURE__ */ n("ul", { className: "list", children: i.map((t) => /* @__PURE__ */ n("li", { "data-testid": "rail-state-starting-row", "data-kind": t.kind, children: /* @__PURE__ */ r("span", { className: "list-main", children: [
1569
+ /* @__PURE__ */ n("code", { children: t.path }),
1570
+ /* @__PURE__ */ n("span", { className: "muted small block", children: t.kind === "reference" ? /* @__PURE__ */ r(R, { children: [
1673
1571
  "Reference ",
1674
- /* @__PURE__ */ n("code", { children: s.text }),
1572
+ /* @__PURE__ */ n("code", { children: t.text }),
1675
1573
  ", resolved when a run starts"
1676
- ] }) : /* @__PURE__ */ n("code", { children: s.text }) })
1677
- ] }) }, s.path)) })
1574
+ ] }) : /* @__PURE__ */ n("code", { children: t.text }) })
1575
+ ] }) }, t.path)) })
1678
1576
  ] });
1679
1577
  }
1680
- function pi({
1578
+ function li({
1681
1579
  variables: e,
1682
- onVariablesChange: t
1580
+ onVariablesChange: i
1683
1581
  }) {
1684
- const [i, s] = u(!1), a = e.filter((o) => o.key !== "");
1582
+ const [s, t] = f(!1), a = e.filter((l) => l.key !== "");
1685
1583
  return /* @__PURE__ */ r("section", { "data-testid": "rail-workflow-variables", children: [
1686
1584
  /* @__PURE__ */ r("div", { className: "rail-section-head", children: [
1687
1585
  /* @__PURE__ */ n("h4", { children: "Workflow inputs" }),
@@ -1691,40 +1589,40 @@ function pi({
1691
1589
  type: "button",
1692
1590
  className: "btn ghost",
1693
1591
  "data-testid": "rail-workflow-variables-edit",
1694
- onClick: () => s(!0),
1592
+ onClick: () => t(!0),
1695
1593
  children: a.length === 0 ? "+ Add inputs" : "Edit inputs"
1696
1594
  }
1697
1595
  )
1698
1596
  ] }),
1699
- a.length === 0 ? /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-workflow-variables-empty", children: "None declared, so API and AI (MCP) callers may send anything." }) : /* @__PURE__ */ n("ul", { className: "rail-input-list", "data-testid": "rail-workflow-variables-list", children: a.map((o, l) => {
1700
- const d = ci(o.default);
1597
+ a.length === 0 ? /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-workflow-variables-empty", children: "None declared, so API and AI (MCP) callers may send anything." }) : /* @__PURE__ */ n("ul", { className: "rail-input-list", "data-testid": "rail-workflow-variables-list", children: a.map((l, o) => {
1598
+ const c = ii(l.default);
1701
1599
  return /* @__PURE__ */ r("li", { "data-testid": "rail-workflow-variable", children: [
1702
1600
  /* @__PURE__ */ r("span", { className: "rail-input-line", children: [
1703
- /* @__PURE__ */ n("code", { className: "rail-input-key", title: o.key, children: o.key }),
1704
- /* @__PURE__ */ n("span", { className: "muted small", children: o.type ?? "any" }),
1705
- o.required && /* @__PURE__ */ n("span", { className: "rail-input-req", children: "required" })
1601
+ /* @__PURE__ */ n("code", { className: "rail-input-key", title: l.key, children: l.key }),
1602
+ /* @__PURE__ */ n("span", { className: "muted small", children: l.type ?? "any" }),
1603
+ l.required && /* @__PURE__ */ n("span", { className: "rail-input-req", children: "required" })
1706
1604
  ] }),
1707
- d !== null && /* @__PURE__ */ r("span", { className: "muted small rail-input-default", title: d, children: [
1605
+ c !== null && /* @__PURE__ */ r("span", { className: "muted small rail-input-default", title: c, children: [
1708
1606
  "= ",
1709
- d
1607
+ c
1710
1608
  ] })
1711
- ] }, `${o.key}:${l}`);
1609
+ ] }, `${l.key}:${o}`);
1712
1610
  }) }),
1713
- i && /* @__PURE__ */ n(
1714
- ai,
1611
+ s && /* @__PURE__ */ n(
1612
+ Xt,
1715
1613
  {
1716
1614
  variables: e,
1717
- onVariablesChange: t,
1718
- onClose: () => s(!1)
1615
+ onVariablesChange: i,
1616
+ onClose: () => t(!1)
1719
1617
  }
1720
1618
  )
1721
1619
  ] });
1722
1620
  }
1723
- function gi({ ctx: e }) {
1621
+ function di({ ctx: e }) {
1724
1622
  return (e == null ? void 0 : e.kind) !== "workflow" || !e.onOpenStartingState ? null : /* @__PURE__ */ r("div", { className: "w6w-stack", "data-testid": "rail-state-body", children: [
1725
1623
  /* @__PURE__ */ n("div", { className: "right-rail-panel-head", children: /* @__PURE__ */ n("h3", { children: "Data" }) }),
1726
1624
  e.onVariablesChange && /* @__PURE__ */ n(
1727
- pi,
1625
+ li,
1728
1626
  {
1729
1627
  variables: e.variables ?? [],
1730
1628
  onVariablesChange: e.onVariablesChange
@@ -1732,41 +1630,41 @@ function gi({ ctx: e }) {
1732
1630
  ),
1733
1631
  /* @__PURE__ */ r("section", { "data-testid": "rail-state-current-section", children: [
1734
1632
  /* @__PURE__ */ n("h4", { children: "Current state" }),
1735
- /* @__PURE__ */ n(fi, { ctx: e })
1633
+ /* @__PURE__ */ n(ri, { ctx: e })
1736
1634
  ] }),
1737
1635
  /* @__PURE__ */ n("hr", {}),
1738
1636
  /* @__PURE__ */ r("section", { "data-testid": "rail-state-starting-section", children: [
1739
1637
  /* @__PURE__ */ n("h4", { children: "Starting state" }),
1740
- /* @__PURE__ */ n(mi, { ctx: e })
1638
+ /* @__PURE__ */ n(oi, { ctx: e })
1741
1639
  ] })
1742
1640
  ] });
1743
1641
  }
1744
- const vi = {
1642
+ const ci = {
1745
1643
  id: "starting-state",
1746
1644
  title: "Data",
1747
1645
  rendersHeading: !0,
1748
- Icon: hi,
1749
- isAvailable: (e) => ui(e) !== void 0,
1750
- Panel: gi,
1646
+ Icon: ai,
1647
+ isAvailable: (e) => si(e) !== void 0,
1648
+ Panel: di,
1751
1649
  hasIndicator: (e) => (e == null ? void 0 : e.kind) === "workflow" && e.hasStartingState === !0
1752
- }, Ui = [
1753
- ti,
1754
- Lt,
1755
- Bt,
1756
- vi,
1757
- Vt,
1758
- Kt
1650
+ }, Wi = [
1651
+ Gt,
1652
+ Ot,
1653
+ Ht,
1654
+ ci,
1655
+ Mt,
1656
+ Ft
1759
1657
  ];
1760
1658
  export {
1761
- Wt as C,
1762
- Bi as P,
1763
- Ki as R,
1764
- Fi as W,
1765
- rn as a,
1766
- Ji as b,
1767
- qi as c,
1768
- Hi as d,
1769
- Ui as e,
1770
- It as u
1659
+ jt as C,
1660
+ Vi as P,
1661
+ Qi as R,
1662
+ Mi as W,
1663
+ on as a,
1664
+ Li as b,
1665
+ ji as c,
1666
+ Ri as d,
1667
+ Wi as e,
1668
+ Et as u
1771
1669
  };
1772
- //# sourceMappingURL=editor-tools-rY9nddqr.js.map
1670
+ //# sourceMappingURL=editor-tools-Ct7YPPj8.js.map