@w6w/embed 0.2.11 → 0.2.20

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 (133) hide show
  1. package/README.md +22 -5
  2. package/dist/ConfirmModal-Pv2-A_3U.js +186 -0
  3. package/dist/ConfirmModal-Pv2-A_3U.js.map +1 -0
  4. package/dist/{CreateFunctionModal-D6CQLpa_.js → CreateFunctionModal-DScxp_LN.js} +2 -2
  5. package/dist/{CreateFunctionModal-D6CQLpa_.js.map → CreateFunctionModal-DScxp_LN.js.map} +1 -1
  6. package/dist/{DocumentFormModal-YauVdolr.js → DocumentFormModal-Br4s8wmi.js} +3 -3
  7. package/dist/{DocumentFormModal-YauVdolr.js.map → DocumentFormModal-Br4s8wmi.js.map} +1 -1
  8. package/dist/ImportSpecModal-Cpzp8ndt.js +251 -0
  9. package/dist/ImportSpecModal-Cpzp8ndt.js.map +1 -0
  10. package/dist/{ModelRoutesManager-BGESQahw.js → ModelRoutesManager-1Ac5wcas.js} +3 -3
  11. package/dist/{ModelRoutesManager-BGESQahw.js.map → ModelRoutesManager-1Ac5wcas.js.map} +1 -1
  12. package/dist/WorkflowEditor-CmhXHRxi.js +1109 -0
  13. package/dist/WorkflowEditor-CmhXHRxi.js.map +1 -0
  14. package/dist/apps-ItBvnWX3.js +92 -0
  15. package/dist/apps-ItBvnWX3.js.map +1 -0
  16. package/dist/chrome/DangerZone.d.ts +4 -3
  17. package/dist/chrome/ExecutionProfileHeader.d.ts +3 -3
  18. package/dist/chrome/JsonToggle.d.ts +29 -20
  19. package/dist/chrome/Modal.d.ts +3 -1
  20. package/dist/chrome/RightRail.d.ts +6 -1
  21. package/dist/chrome/VersionHistoryModal.d.ts +2 -0
  22. package/dist/chrome/index.d.ts +1 -0
  23. package/dist/chrome/workspace.d.ts +32 -1
  24. package/dist/{coerce-input-DttlcSdO.js → coerce-input-DFJ4n_wc.js} +68 -69
  25. package/dist/coerce-input-DFJ4n_wc.js.map +1 -0
  26. package/dist/{connections-D7cgXhDS.js → connections-CzsCyIxY.js} +10 -10
  27. package/dist/{connections-D7cgXhDS.js.map → connections-CzsCyIxY.js.map} +1 -1
  28. package/dist/{credentials-DaQU3Ca_.js → credentials-Cn92LGhJ.js} +4 -4
  29. package/dist/{credentials-DaQU3Ca_.js.map → credentials-Cn92LGhJ.js.map} +1 -1
  30. package/dist/data-stores-UeQvwVCa.js +170 -0
  31. package/dist/data-stores-UeQvwVCa.js.map +1 -0
  32. package/dist/document-sources-DNmBojx6.js +169 -0
  33. package/dist/document-sources-DNmBojx6.js.map +1 -0
  34. package/dist/draft/use-workflow-draft.d.ts +2 -0
  35. package/dist/draft.mjs +2 -2
  36. package/dist/editor/PublishTooltip.d.ts +7 -0
  37. package/dist/editor/SetupIncompleteBanner.d.ts +12 -0
  38. package/dist/editor/StartingStateModal.d.ts +14 -0
  39. package/dist/editor/WorkflowSettingsModal.d.ts +6 -1
  40. package/dist/editor/WorkflowVariablesEditor.d.ts +6 -0
  41. package/dist/editor/definition.d.ts +4 -0
  42. package/dist/editor/json-apply.d.ts +29 -0
  43. package/dist/editor/step-problems-feed.d.ts +5 -0
  44. package/dist/editor/types.d.ts +2 -2
  45. package/dist/editor-apps-DkkC7wOQ.js +152 -0
  46. package/dist/editor-apps-DkkC7wOQ.js.map +1 -0
  47. package/dist/editor-tools-BR27RGto.js +1683 -0
  48. package/dist/editor-tools-BR27RGto.js.map +1 -0
  49. package/dist/editor.mjs +1 -1
  50. package/dist/editors.mjs +536 -478
  51. package/dist/editors.mjs.map +1 -1
  52. package/dist/forms.mjs +3 -3
  53. package/dist/{rail-settings-XYGToh00.js → import-bindings-EUtxZ9Ti.js} +90 -24
  54. package/dist/import-bindings-EUtxZ9Ti.js.map +1 -0
  55. package/dist/index.mjs +138 -108
  56. package/dist/index.mjs.map +1 -1
  57. package/dist/lib/binding-problems.d.ts +5 -1
  58. package/dist/lib/history-query.d.ts +45 -0
  59. package/dist/lib/import-bindings.d.ts +89 -0
  60. package/dist/lib/index.d.ts +3 -0
  61. package/dist/lib/rail-settings.d.ts +1 -1
  62. package/dist/lib/setup-incomplete.d.ts +22 -0
  63. package/dist/lib/starting-data.d.ts +31 -0
  64. package/dist/lib/state-panel.d.ts +29 -0
  65. package/dist/lib/target-fields.d.ts +3 -15
  66. package/dist/lib/workflow-live-run.d.ts +84 -6
  67. package/dist/lib/workflow-validity.d.ts +64 -16
  68. package/dist/lib/workflow-variables.d.ts +1 -1
  69. package/dist/lib/workflow-version.d.ts +2 -0
  70. package/dist/lib.mjs +87 -72
  71. package/dist/lists/DataStoreList.d.ts +17 -0
  72. package/dist/lists/DataStoreView.d.ts +19 -0
  73. package/dist/lists/Logs.d.ts +19 -0
  74. package/dist/lists.d.ts +6 -0
  75. package/dist/lists.mjs +1255 -816
  76. package/dist/lists.mjs.map +1 -1
  77. package/dist/rail/ConnectionsTool.d.ts +2 -0
  78. package/dist/rail/HistoryTool.d.ts +2 -0
  79. package/dist/rail/StartingStateTool.d.ts +2 -0
  80. package/dist/rail/settings-sections.d.ts +4 -1
  81. package/dist/rail.mjs +1 -1
  82. package/dist/repos/connections.d.ts +1 -0
  83. package/dist/repos/constants.d.ts +12 -0
  84. package/dist/repos/data-stores.d.ts +84 -0
  85. package/dist/repos/history.d.ts +9 -0
  86. package/dist/repos/index.d.ts +2 -0
  87. package/dist/repos/spec-export.d.ts +3 -3
  88. package/dist/repos/spec-import.d.ts +30 -1
  89. package/dist/repos/step-tests.d.ts +2 -0
  90. package/dist/repos/webhook-listen.d.ts +35 -0
  91. package/dist/repos/workflows.d.ts +105 -2
  92. package/dist/repos.mjs +370 -328
  93. package/dist/repos.mjs.map +1 -1
  94. package/dist/setup-incomplete-BHs3Lpfy.js +199 -0
  95. package/dist/setup-incomplete-BHs3Lpfy.js.map +1 -0
  96. package/dist/{spec-export-CBbloO_n.js → spec-export-DGy5ijps.js} +72 -59
  97. package/dist/spec-export-DGy5ijps.js.map +1 -0
  98. package/dist/spec-import-SWOonsNr.js +116 -0
  99. package/dist/spec-import-SWOonsNr.js.map +1 -0
  100. package/dist/{step-tests-CivICmTq.js → step-tests-B4E4W3ly.js} +8 -7
  101. package/dist/step-tests-B4E4W3ly.js.map +1 -0
  102. package/dist/{use-callable-draft-DsALnSfF.js → use-callable-draft-DCauHt5o.js} +2 -2
  103. package/dist/{use-callable-draft-DsALnSfF.js.map → use-callable-draft-DCauHt5o.js.map} +1 -1
  104. package/dist/use-workflow-draft-l3P5KZzw.js +338 -0
  105. package/dist/use-workflow-draft-l3P5KZzw.js.map +1 -0
  106. package/dist/workflows-BZN4Hyz1.js +623 -0
  107. package/dist/workflows-BZN4Hyz1.js.map +1 -0
  108. package/package.json +4 -3
  109. package/src/styles.css +153 -1
  110. package/dist/ConfirmModal-BE-SdX-O.js +0 -185
  111. package/dist/ConfirmModal-BE-SdX-O.js.map +0 -1
  112. package/dist/ImportSpecModal-B7qd1Km2.js +0 -136
  113. package/dist/ImportSpecModal-B7qd1Km2.js.map +0 -1
  114. package/dist/WorkflowEditor-CwvmAGp2.js +0 -925
  115. package/dist/WorkflowEditor-CwvmAGp2.js.map +0 -1
  116. package/dist/apps-CboASBKr.js +0 -77
  117. package/dist/apps-CboASBKr.js.map +0 -1
  118. package/dist/coerce-input-DttlcSdO.js.map +0 -1
  119. package/dist/document-sources-UCwe8x77.js +0 -91
  120. package/dist/document-sources-UCwe8x77.js.map +0 -1
  121. package/dist/editor-apps-BUZWld-m.js +0 -95
  122. package/dist/editor-apps-BUZWld-m.js.map +0 -1
  123. package/dist/editor-tools-B_Lfx3kw.js +0 -1279
  124. package/dist/editor-tools-B_Lfx3kw.js.map +0 -1
  125. package/dist/rail-settings-XYGToh00.js.map +0 -1
  126. package/dist/spec-export-CBbloO_n.js.map +0 -1
  127. package/dist/spec-import-CW6R_Wk1.js +0 -469
  128. package/dist/spec-import-CW6R_Wk1.js.map +0 -1
  129. package/dist/step-tests-CivICmTq.js.map +0 -1
  130. package/dist/trigger-preview-DKxfjzUY.js +0 -145
  131. package/dist/trigger-preview-DKxfjzUY.js.map +0 -1
  132. package/dist/use-workflow-draft-DzAyUeA6.js +0 -316
  133. package/dist/use-workflow-draft-DzAyUeA6.js.map +0 -1
package/dist/editors.mjs CHANGED
@@ -1,29 +1,33 @@
1
1
  "use client";
2
- import { E as en, B as nn, a as Be, J as Re, H as De, b as Ke } from "./WorkflowEditor-CwvmAGp2.js";
3
- import { W as Rt } from "./WorkflowEditor-CwvmAGp2.js";
4
- import { jsx as e, jsxs as o, Fragment as K } from "react/jsx-runtime";
5
- import { EditButton as tn, DeleteButton as an, Copyable as Te, CodeBlock as sn, IconButton as be, AppIcon as on, ExpressionInput as rn, StepBuilderModal as ln, ExpressionOptionsProvider as xe } from "@w6w/ui";
6
- import { useState as w, useMemo as L, useRef as X, useEffect as ce, useCallback as he } from "react";
7
- import { a as dn, C as cn } from "./ConfirmModal-BE-SdX-O.js";
8
- import { D as un } from "./DocumentFormModal-YauVdolr.js";
2
+ var tn = Object.defineProperty;
3
+ var an = (t, i, a) => i in t ? tn(t, i, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[i] = a;
4
+ var Se = (t, i, a) => an(t, typeof i != "symbol" ? i + "" : i, a);
5
+ import { H as sn, E as on, B as rn, a as Re, J as xe, b as De } from "./WorkflowEditor-CmhXHRxi.js";
6
+ import { W as Wt } from "./WorkflowEditor-CmhXHRxi.js";
7
+ import { jsx as e, jsxs as o, Fragment as D } from "react/jsx-runtime";
8
+ import { EditButton as ln, DeleteButton as dn, Copyable as Ke, CodeBlock as cn, IconButton as pe, AppIcon as un, ExpressionInput as hn, StepBuilderModal as mn, ExpressionOptionsProvider as Te } from "@w6w/ui";
9
+ import { useState as b, Component as fn, useRef as _, useEffect as se, useMemo as L, useCallback as he } from "react";
10
+ import { a as pn, C as yn } from "./ConfirmModal-Pv2-A_3U.js";
11
+ import { D as vn } from "./DocumentFormModal-Br4s8wmi.js";
9
12
  import { u as ke } from "./project-context-Tvp-La7A.js";
10
- import { O as hn, M as mn, o as Ae, Z as fn, Y as pn } from "./spec-import-CW6R_Wk1.js";
11
- import { ApiError as pe } from "@w6w/sdk";
12
- import { C as yn, d as Oe } from "./editor-tools-B_Lfx3kw.js";
13
- import { a as vn, b as gn } from "./use-callable-draft-DsALnSfF.js";
14
- import { E as bn, F as kn } from "./CreateFunctionModal-D6CQLpa_.js";
15
- import { d as je, z as wn, b as Nn, u as Cn, w as Me, v as Je, A as Sn } from "./endpoints-DSRo1Lc5.js";
16
- import { t as En, a as Le, c as We, I as In, b as Fn, p as ye, f as Pn, u as Se, s as Qe, m as Ue, g as qe, i as Ee, e as Bn, h as Rn } from "./coerce-input-DttlcSdO.js";
17
- import { e as me } from "./rail-settings-XYGToh00.js";
18
- import { f as $e, a as Dn, c as Kn } from "./spec-export-CBbloO_n.js";
13
+ import { j as gn, i as bn } from "./spec-import-SWOonsNr.js";
14
+ import { ApiError as ye } from "@w6w/sdk";
15
+ import { k as kn, i as wn } from "./apps-ItBvnWX3.js";
16
+ import { C as Nn, c as Ae } from "./editor-tools-BR27RGto.js";
17
+ import { a as Cn, b as Sn } from "./use-callable-draft-DCauHt5o.js";
18
+ import { E as En, F as In } from "./CreateFunctionModal-DScxp_LN.js";
19
+ import { d as Oe, z as Fn, b as Pn, u as Bn, w as je, v as Me, A as Rn } from "./endpoints-DSRo1Lc5.js";
20
+ import { t as xn, a as Je, c as Le, I as Dn, b as Kn, p as ve, f as Tn, u as Ee, s as We, m as Qe, g as Ue, i as Ie, e as An, h as On } from "./coerce-input-DFJ4n_wc.js";
21
+ import { e as me } from "./import-bindings-EUtxZ9Ti.js";
22
+ import { h as qe, b as jn, e as Mn } from "./spec-export-DGy5ijps.js";
19
23
  import { useQueryClient as we } from "@tanstack/react-query";
20
- import { SECRET_MASK as Tn } from "@w6w/sdk/console";
21
- import { f as He, d as xn } from "./trigger-preview-DKxfjzUY.js";
22
- import { f as An } from "./apps-CboASBKr.js";
23
- import { n as _e, e as On } from "./connections-D7cgXhDS.js";
24
- import { a as jn } from "./editor-apps-BUZWld-m.js";
25
- import { s as Mn } from "./slug-BVdgiP_L.js";
26
- function Jn(t) {
24
+ import { o as $e, a1 as Jn, a0 as Ln } from "./workflows-BZN4Hyz1.js";
25
+ import { SECRET_MASK as Wn } from "@w6w/sdk/console";
26
+ import { f as He, d as Qn } from "./setup-incomplete-BHs3Lpfy.js";
27
+ import { n as _e, d as Un } from "./connections-CzsCyIxY.js";
28
+ import { u as qn } from "./editor-apps-DkkC7wOQ.js";
29
+ import { s as $n } from "./slug-BVdgiP_L.js";
30
+ function Hn(t) {
27
31
  switch (t) {
28
32
  case "yaml":
29
33
  return "yaml";
@@ -37,29 +41,29 @@ function Jn(t) {
37
41
  return "plaintext";
38
42
  }
39
43
  }
40
- function Et({
44
+ function Ot({
41
45
  documentId: t,
42
- project: s,
46
+ project: i,
43
47
  onDeleted: a,
44
- onBack: m,
45
- slots: c
48
+ onBack: h,
49
+ slots: d
46
50
  }) {
47
- const n = ke(s), d = hn(t, n ?? void 0, n != null), I = mn(), [g, N] = w(!1), [h, y] = w(!1);
48
- if (d.isPending)
51
+ const n = ke(i), c = gn(t, n ?? void 0, n != null), I = bn(), [v, N] = b(!1), [m, y] = b(!1);
52
+ if (c.isPending)
49
53
  return /* @__PURE__ */ e("div", { className: "w6w-embed-root", children: /* @__PURE__ */ e("p", { className: "muted", children: "Loading…" }) });
50
- const i = d.data;
51
- if (!i) {
52
- const r = (c == null ? void 0 : c.empty) === void 0 ? /* @__PURE__ */ o(K, { children: [
54
+ const s = c.data;
55
+ if (!s) {
56
+ const r = (d == null ? void 0 : d.empty) === void 0 ? /* @__PURE__ */ o(D, { children: [
53
57
  /* @__PURE__ */ e("h3", { children: "Document not found" }),
54
- m && /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: m, children: "Back to documents" })
55
- ] }) : c.empty;
58
+ h && /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: h, children: "Back to documents" })
59
+ ] }) : d.empty;
56
60
  return /* @__PURE__ */ e("div", { className: "w6w-embed-root", children: r });
57
61
  }
58
- const P = (c == null ? void 0 : c.header) === void 0 ? /* @__PURE__ */ e("h3", { children: i.key }) : c.header, u = (c == null ? void 0 : c.actions) === void 0 ? /* @__PURE__ */ e("div", { className: "card", children: /* @__PURE__ */ o("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)" }, children: [
59
- /* @__PURE__ */ e(dn, { resource: { kind: "document", key: i.key } }),
60
- !i.shared && /* @__PURE__ */ o(K, { children: [
62
+ const P = (d == null ? void 0 : d.header) === void 0 ? /* @__PURE__ */ e("h3", { children: s.key }) : d.header, u = (d == null ? void 0 : d.actions) === void 0 ? /* @__PURE__ */ e("div", { className: "card", children: /* @__PURE__ */ o("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)" }, children: [
63
+ /* @__PURE__ */ e(pn, { resource: { kind: "document", key: s.key } }),
64
+ !s.shared && /* @__PURE__ */ o(D, { children: [
61
65
  /* @__PURE__ */ e(
62
- tn,
66
+ ln,
63
67
  {
64
68
  label: "Edit",
65
69
  onClick: () => N(!0),
@@ -67,7 +71,7 @@ function Et({
67
71
  }
68
72
  ),
69
73
  /* @__PURE__ */ e(
70
- an,
74
+ dn,
71
75
  {
72
76
  label: "Delete",
73
77
  onClick: () => y(!0),
@@ -76,13 +80,13 @@ function Et({
76
80
  }
77
81
  )
78
82
  ] })
79
- ] }) }) : c.actions;
83
+ ] }) }) : d.actions;
80
84
  return /* @__PURE__ */ o("div", { className: "w6w-embed-root w6w-doc-editor", children: [
81
85
  P,
82
86
  u,
83
87
  /* @__PURE__ */ o("div", { className: "card", children: [
84
88
  /* @__PURE__ */ e("h3", { children: "Key" }),
85
- /* @__PURE__ */ e(Te, { value: i.key, readOnly: !0, children: /* @__PURE__ */ e(
89
+ /* @__PURE__ */ e(Ke, { value: s.key, readOnly: !0, children: /* @__PURE__ */ e(
86
90
  "code",
87
91
  {
88
92
  style: {
@@ -93,7 +97,7 @@ function Et({
93
97
  textOverflow: "ellipsis",
94
98
  flex: 1
95
99
  },
96
- children: i.key
100
+ children: s.key
97
101
  }
98
102
  ) })
99
103
  ] }),
@@ -101,87 +105,141 @@ function Et({
101
105
  /* @__PURE__ */ e("h3", { children: "Content" }),
102
106
  /* @__PURE__ */ o("p", { className: "muted small", children: [
103
107
  "Format ",
104
- /* @__PURE__ */ e("code", { children: i.format }),
108
+ /* @__PURE__ */ e("code", { children: s.format }),
105
109
  ". Stored verbatim — this is a read-only view, not a rendered preview."
106
110
  ] }),
107
111
  /* @__PURE__ */ e(
108
- sn,
112
+ cn,
109
113
  {
110
- code: i.content,
111
- language: Jn(i.format),
114
+ code: s.content,
115
+ language: Hn(s.format),
112
116
  showLineNumbers: !0
113
117
  }
114
118
  )
115
119
  ] }),
116
- g && /* @__PURE__ */ e(
117
- un,
120
+ v && /* @__PURE__ */ e(
121
+ vn,
118
122
  {
119
- initial: i,
123
+ initial: s,
120
124
  project: n,
121
125
  onClose: () => N(!1),
122
126
  onSaved: () => N(!1)
123
127
  }
124
128
  ),
125
- h && /* @__PURE__ */ e(
126
- cn,
129
+ m && /* @__PURE__ */ e(
130
+ yn,
127
131
  {
128
132
  title: "Delete document",
129
- message: `Delete the document "${i.key}"? This cannot be undone.`,
133
+ message: `Delete the document "${s.key}"? This cannot be undone.`,
130
134
  confirmLabel: "Delete",
131
135
  onConfirm: () => {
132
- y(!1), n != null && I.mutate({ id: i.id, project: n }, { onSuccess: () => a == null ? void 0 : a() });
136
+ y(!1), n != null && I.mutate({ id: s.id, project: n }, { onSuccess: () => a == null ? void 0 : a() });
133
137
  },
134
138
  onClose: () => y(!1)
135
139
  }
136
140
  )
137
141
  ] });
138
142
  }
139
- const Ln = {
143
+ function Ve({
144
+ hasExecuted: t,
145
+ onClick: i,
146
+ buttonRef: a
147
+ }) {
148
+ return /* @__PURE__ */ e(
149
+ pe,
150
+ {
151
+ ref: a,
152
+ icon: "history",
153
+ "data-testid": "history-button",
154
+ label: "Execution history",
155
+ title: t ? "Execution history" : "No executions yet",
156
+ disabled: !t,
157
+ onClick: i
158
+ }
159
+ );
160
+ }
161
+ function _n({ kind: t, id: i, onOpenRun: a }) {
162
+ const { hasExecuted: h } = kn(i), [d, n] = b(!1), c = _(null), I = _(!1);
163
+ return se(() => {
164
+ var v;
165
+ I.current && !d && ((v = c.current) == null || v.focus()), I.current = d;
166
+ }, [d]), /* @__PURE__ */ o(D, { children: [
167
+ /* @__PURE__ */ e(
168
+ Ve,
169
+ {
170
+ hasExecuted: h,
171
+ buttonRef: c,
172
+ onClick: () => n(!0)
173
+ }
174
+ ),
175
+ d && /* @__PURE__ */ e(sn, { kind: t, id: i, onClose: () => n(!1), onOpenRun: a })
176
+ ] });
177
+ }
178
+ class Vn extends fn {
179
+ constructor() {
180
+ super(...arguments);
181
+ Se(this, "state", { failed: !1 });
182
+ }
183
+ static getDerivedStateFromError() {
184
+ return { failed: !0 };
185
+ }
186
+ componentDidCatch(a) {
187
+ console.error("history probe answer was unreadable; disabling the button", a);
188
+ }
189
+ render() {
190
+ return this.state.failed ? /* @__PURE__ */ e(Ve, { hasExecuted: !1, onClick: () => {
191
+ } }) : this.props.children;
192
+ }
193
+ }
194
+ function Ye(t) {
195
+ return /* @__PURE__ */ e(Vn, { children: /* @__PURE__ */ e(_n, { ...t }) });
196
+ }
197
+ const Yn = {
140
198
  kind: "action",
141
199
  uses: { app: "", action: "", connection: null }
142
200
  };
143
- function de(t) {
144
- return { input: [], ...t, target: t.target ?? Ln };
201
+ function ce(t) {
202
+ return { input: [], ...t, target: t.target ?? Yn };
145
203
  }
146
- function ve(t) {
147
- const { target: s, input: a, ...m } = de(t), c = {
148
- ...m,
204
+ function ge(t) {
205
+ const { target: i, input: a, ...h } = ce(t), d = {
206
+ ...h,
149
207
  key: String(t.key ?? "").trim()
150
208
  };
151
- En(s) && (c.target = s);
152
- const n = Le(a ?? [], { emptyMeansPassthrough: !0 });
153
- return n !== void 0 && (c.input = n), c;
209
+ xn(i) && (d.target = i);
210
+ const n = Je(a ?? [], { emptyMeansPassthrough: !0 });
211
+ return n !== void 0 && (d.input = n), d;
154
212
  }
155
- function Ve(t) {
213
+ function ze(t) {
156
214
  return t && t.length > 1 ? t : void 0;
157
215
  }
158
- function Wn(t, s) {
159
- const a = Ve(t);
160
- return a ? a.find((m) => m.domain === s) ?? a.find((m) => m.default) ?? a[0] : null;
216
+ function zn(t, i) {
217
+ const a = ze(t);
218
+ return a ? a.find((h) => h.domain === i) ?? a.find((h) => h.default) ?? a[0] : null;
161
219
  }
162
- function Qn(t, s, a) {
220
+ function Gn(t, i, a) {
163
221
  return t ?? {
164
- url: s ?? "",
222
+ url: i ?? "",
165
223
  urlByKey: a,
166
224
  resolves: !0
167
225
  };
168
226
  }
169
- const Un = (t) => t instanceof Error ? t.message : String(t);
170
- function qn(t) {
227
+ const Xn = (t) => t instanceof Error ? t.message : String(t);
228
+ function Zn(t) {
171
229
  var y;
172
- const { kind: s, id: a, onError: m } = t, c = $e(s, a, !0), n = Dn(s), [d, I] = w(!1), g = ((y = c.data) == null ? void 0 : y.currentPublishedVersion) != null, N = s === "function" ? "fn-publish" : "ep-publish";
173
- async function h() {
174
- m(null), I(!0);
230
+ const { kind: i, id: a, onError: h } = t, d = qe(i, a, !0), n = jn(i), [c, I] = b(!1), v = ((y = d.data) == null ? void 0 : y.currentPublishedVersion) != null, N = i === "function" ? "fn-publish" : "ep-publish";
231
+ async function m() {
232
+ h(null), I(!0);
175
233
  try {
176
- const i = await t.saveFirst();
177
- if (i.status === "blocked") {
178
- m(i.reason);
234
+ const s = await t.saveFirst();
235
+ if (s.status === "blocked") {
236
+ h(s.reason);
179
237
  return;
180
238
  }
181
- if (i.status === "failed") return;
239
+ if (s.status === "failed") return;
182
240
  await n.mutateAsync(a);
183
- } catch (i) {
184
- m(Un(i));
241
+ } catch (s) {
242
+ h(Xn(s));
185
243
  } finally {
186
244
  I(!1);
187
245
  }
@@ -190,34 +248,34 @@ function qn(t) {
190
248
  "button",
191
249
  {
192
250
  type: "button",
193
- className: `btn ghost wf-publish${g ? " active" : ""}`,
251
+ className: `btn ghost wf-publish${v ? " active" : ""}`,
194
252
  "data-testid": N,
195
- onClick: () => void h(),
196
- disabled: t.disabled || d || n.isPending,
197
- title: g ? "Published — click to publish a new version" : "Never published — click to publish",
198
- children: d || n.isPending ? "Publishing…" : g ? "● Published" : "Publish"
253
+ onClick: () => void m(),
254
+ disabled: t.disabled || c || n.isPending,
255
+ title: v ? "Published — click to publish a new version" : "Never published — click to publish",
256
+ children: c || n.isPending ? "Publishing…" : v ? "● Published" : "Publish"
199
257
  }
200
258
  );
201
259
  }
202
- function Ye(t) {
203
- const s = je(t.kind), [a, m] = w(null), c = t.slots, n = (c == null ? void 0 : c.backLabel) ?? s.editor.backLabel, d = () => t.onNavigate({ type: "list" });
260
+ function Ge(t) {
261
+ const i = Oe(t.kind), [a, h] = b(null), d = t.slots, n = (d == null ? void 0 : d.backLabel) ?? i.editor.backLabel, c = () => t.onNavigate({ type: "list" });
204
262
  return t.notFound ? /* @__PURE__ */ o("div", { children: [
205
- /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: d, children: n }),
263
+ /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: c, children: n }),
206
264
  /* @__PURE__ */ o("div", { className: "card", children: [
207
- /* @__PURE__ */ e("h3", { children: s.editor.notFoundTitle }),
265
+ /* @__PURE__ */ e("h3", { children: i.editor.notFoundTitle }),
208
266
  /* @__PURE__ */ e("p", { className: "error", children: t.error })
209
267
  ] })
210
268
  ] }) : /* @__PURE__ */ o("div", { className: "exec-profile-editor", children: [
211
- (c == null ? void 0 : c.header) ?? /* @__PURE__ */ e(
212
- en,
269
+ (d == null ? void 0 : d.header) ?? /* @__PURE__ */ e(
270
+ on,
213
271
  {
214
- onBack: d,
272
+ onBack: c,
215
273
  backLabel: n,
216
274
  title: { editable: !1, value: t.title },
217
275
  titleAdornment: t.incomplete && /* @__PURE__ */ e("span", { className: "badge status-failed", children: "incomplete" }),
218
- actions: /* @__PURE__ */ o(K, { children: [
276
+ actions: /* @__PURE__ */ o(D, { children: [
219
277
  t.headerActions,
220
- t.publish && t.kind !== "workflow" && /* @__PURE__ */ e(qn, { kind: t.kind, ...t.publish, onError: m }),
278
+ t.publish && t.kind !== "workflow" && /* @__PURE__ */ e(Zn, { kind: t.kind, ...t.publish, onError: h }),
221
279
  /* @__PURE__ */ e(
222
280
  "button",
223
281
  {
@@ -225,22 +283,22 @@ function Ye(t) {
225
283
  className: "btn",
226
284
  disabled: !t.canSave,
227
285
  onClick: t.onSave,
228
- children: t.isSaving ? "Saving…" : s.editor.saveLabel
286
+ children: t.isSaving ? "Saving…" : i.editor.saveLabel
229
287
  }
230
288
  ),
231
- c == null ? void 0 : c.headerActions
289
+ d == null ? void 0 : d.headerActions
232
290
  ] })
233
291
  }
234
292
  ),
235
293
  /* @__PURE__ */ o("div", { className: "exec-profile-body w6w-card-stack", children: [
236
294
  t.error && /* @__PURE__ */ e("div", { className: "error", children: t.error }),
237
- a && !(c != null && c.header) && /* @__PURE__ */ e("div", { className: "error", children: a }),
295
+ a && !(d != null && d.header) && /* @__PURE__ */ e("div", { className: "error", children: a }),
238
296
  t.banners,
239
297
  t.children
240
298
  ] })
241
299
  ] });
242
300
  }
243
- const Ie = {
301
+ const Fe = {
244
302
  function_not_published: "This Function has never been published, so callers outside the editor cannot run it yet. Publish it with the Publish button next to Save.",
245
303
  endpoint_not_published: "This Endpoint has never been published, so its public URL will not answer yet. Publish it with the Publish button next to Save.",
246
304
  function_disabled: "This Function is disabled. Enable it in Settings, then try again.",
@@ -249,9 +307,9 @@ const Ie = {
249
307
  endpoint_incomplete: "This Endpoint has no usable Target yet. Pick what it should dispatch to, then try again."
250
308
  };
251
309
  function fe(t) {
252
- return t instanceof pe ? Object.hasOwn(Ie, t.code) ? Ie[t.code] : t.message : t instanceof Error ? t.message : String(t);
310
+ return t instanceof ye ? Object.hasOwn(Fe, t.code) ? Fe[t.code] : t.message : t instanceof Error ? t.message : String(t);
253
311
  }
254
- const Fe = [
312
+ const Pe = [
255
313
  {
256
314
  value: "platform",
257
315
  label: "Platform auth (default)",
@@ -278,9 +336,9 @@ const Fe = [
278
336
  hint: "A Bearer JWT, verified HS256 against the shared secret below."
279
337
  }
280
338
  ];
281
- function $n(t) {
339
+ function et(t) {
282
340
  var N;
283
- const { entry: s, domainOptions: a, urlDomain: m, onUrlDomain: c, urlForm: n, onUrlForm: d } = t, I = s.urlByKey !== void 0 && s.urlByKey !== "", g = n === "key" && s.urlByKey ? s.urlByKey : s.url;
341
+ const { entry: i, domainOptions: a, urlDomain: h, onUrlDomain: d, urlForm: n, onUrlForm: c } = t, I = i.urlByKey !== void 0 && i.urlByKey !== "", v = n === "key" && i.urlByKey ? i.urlByKey : i.url;
284
342
  return /* @__PURE__ */ o("div", { className: "card", children: [
285
343
  /* @__PURE__ */ e("h3", { children: "URL" }),
286
344
  a && /* @__PURE__ */ o("label", { className: "field", children: [
@@ -289,40 +347,40 @@ function $n(t) {
289
347
  "select",
290
348
  {
291
349
  "data-testid": "url-domain",
292
- value: m ?? ((N = a[0]) == null ? void 0 : N.domain),
293
- onChange: (h) => c(h.target.value),
294
- children: a.map((h) => /* @__PURE__ */ e("option", { value: h.domain, children: h.domain + (h.default ? " · default" : "") + (h.resolves ? "" : " · not routable yet") }, h.domain))
350
+ value: h ?? ((N = a[0]) == null ? void 0 : N.domain),
351
+ onChange: (m) => d(m.target.value),
352
+ children: a.map((m) => /* @__PURE__ */ e("option", { value: m.domain, children: m.domain + (m.default ? " · default" : "") + (m.resolves ? "" : " · not routable yet") }, m.domain))
295
353
  }
296
354
  )
297
355
  ] }),
298
356
  I && /* @__PURE__ */ e("fieldset", { className: "seg", "aria-label": "URL form", children: [
299
357
  ["id", "By id", "The stable, host-issued address. Never changes."],
300
358
  ["key", "By key", "The readable address, built from the account and this key."]
301
- ].map(([h, y, i]) => /* @__PURE__ */ e(
359
+ ].map(([m, y, s]) => /* @__PURE__ */ e(
302
360
  "button",
303
361
  {
304
362
  type: "button",
305
- className: `seg-btn${n === h ? " active" : ""}`,
306
- "aria-pressed": n === h,
307
- "data-testid": `url-form-${h}`,
308
- title: i,
309
- onClick: () => d(h),
363
+ className: `seg-btn${n === m ? " active" : ""}`,
364
+ "aria-pressed": n === m,
365
+ "data-testid": `url-form-${m}`,
366
+ title: s,
367
+ onClick: () => c(m),
310
368
  children: y
311
369
  },
312
- h
370
+ m
313
371
  )) }),
314
- /* @__PURE__ */ e("div", { className: "row", style: { alignItems: "center", gap: "var(--w6w-sp-2)" }, children: /* @__PURE__ */ e(Te, { value: g, readOnly: !0, children: /* @__PURE__ */ o("code", { style: { overflowWrap: "anywhere" }, children: [
372
+ /* @__PURE__ */ e("div", { className: "row", style: { alignItems: "center", gap: "var(--w6w-sp-2)" }, children: /* @__PURE__ */ e(Ke, { value: v, readOnly: !0, children: /* @__PURE__ */ o("code", { style: { overflowWrap: "anywhere" }, children: [
315
373
  /* @__PURE__ */ e("strong", { children: "POST" }),
316
374
  " ",
317
- /* @__PURE__ */ e("span", { "data-testid": "invoke-url", children: g || "…" })
375
+ /* @__PURE__ */ e("span", { "data-testid": "invoke-url", children: v || "…" })
318
376
  ] }) }) }),
319
- !s.resolves && /* @__PURE__ */ e("p", { className: "muted small", "data-testid": "url-unroutable", children: "Not routable yet — this domain has no DNS or TLS behind it, so a call to this address will not answer." }),
377
+ !i.resolves && /* @__PURE__ */ e("p", { className: "muted small", "data-testid": "url-unroutable", children: "Not routable yet — this domain has no DNS or TLS behind it, so a call to this address will not answer." }),
320
378
  /* @__PURE__ */ e("p", { className: "muted small", style: { marginTop: "var(--w6w-sp-2)" }, children: "Send the declared input as a JSON body." })
321
379
  ] });
322
380
  }
323
- function Hn(t) {
324
- var c;
325
- const { security: s, onPatch: a } = t, m = s.auth;
381
+ function nt(t) {
382
+ var d;
383
+ const { security: i, onPatch: a } = t, h = i.auth;
326
384
  return /* @__PURE__ */ o("div", { className: "card", children: [
327
385
  /* @__PURE__ */ e("h3", { children: "Security" }),
328
386
  /* @__PURE__ */ o("label", { className: "field", children: [
@@ -330,39 +388,39 @@ function Hn(t) {
330
388
  /* @__PURE__ */ e(
331
389
  "select",
332
390
  {
333
- value: m,
391
+ value: h,
334
392
  onChange: (n) => a({ auth: n.target.value }),
335
- children: Fe.map((n) => /* @__PURE__ */ e("option", { value: n.value, children: n.label }, n.value))
393
+ children: Pe.map((n) => /* @__PURE__ */ e("option", { value: n.value, children: n.label }, n.value))
336
394
  }
337
395
  ),
338
- /* @__PURE__ */ e("span", { className: "hint", children: (c = Fe.find((n) => n.value === m)) == null ? void 0 : c.hint })
396
+ /* @__PURE__ */ e("span", { className: "hint", children: (d = Pe.find((n) => n.value === h)) == null ? void 0 : d.hint })
339
397
  ] }),
340
- m !== "platform" && /* @__PURE__ */ o("p", { className: "muted small", children: [
398
+ h !== "platform" && /* @__PURE__ */ o("p", { className: "muted small", children: [
341
399
  /* @__PURE__ */ e("strong", { children: "Runs as this Endpoint's owner." }),
342
400
  " A caller authenticated by the policy above carries no w6w identity, so the target runs with the connections and data of whoever owns this Endpoint."
343
401
  ] }),
344
- m === "basic" && /* @__PURE__ */ o(K, { children: [
402
+ h === "basic" && /* @__PURE__ */ o(D, { children: [
345
403
  /* @__PURE__ */ o("label", { className: "field", children: [
346
404
  /* @__PURE__ */ e("span", { children: "Username" }),
347
405
  /* @__PURE__ */ e(
348
406
  "input",
349
407
  {
350
408
  type: "text",
351
- value: s.basicUser ?? "",
409
+ value: i.basicUser ?? "",
352
410
  onChange: (n) => a({ basicUser: n.target.value })
353
411
  }
354
412
  )
355
413
  ] }),
356
414
  /* @__PURE__ */ e(
357
- ge,
415
+ be,
358
416
  {
359
417
  label: "Password",
360
- value: s.basicPassword,
418
+ value: i.basicPassword,
361
419
  onChange: (n) => a({ basicPassword: n })
362
420
  }
363
421
  )
364
422
  ] }),
365
- m === "header" && /* @__PURE__ */ o(K, { children: [
423
+ h === "header" && /* @__PURE__ */ o(D, { children: [
366
424
  /* @__PURE__ */ o("label", { className: "field", children: [
367
425
  /* @__PURE__ */ e("span", { children: "Header name" }),
368
426
  /* @__PURE__ */ e(
@@ -370,70 +428,70 @@ function Hn(t) {
370
428
  {
371
429
  type: "text",
372
430
  placeholder: "X-API-Key",
373
- value: s.headerName ?? "",
431
+ value: i.headerName ?? "",
374
432
  onChange: (n) => a({ headerName: n.target.value })
375
433
  }
376
434
  )
377
435
  ] }),
378
436
  /* @__PURE__ */ e(
379
- ge,
437
+ be,
380
438
  {
381
439
  label: "Header value",
382
- value: s.headerValue,
440
+ value: i.headerValue,
383
441
  onChange: (n) => a({ headerValue: n })
384
442
  }
385
443
  )
386
444
  ] }),
387
- m === "jwt" && /* @__PURE__ */ e(
388
- ge,
445
+ h === "jwt" && /* @__PURE__ */ e(
446
+ be,
389
447
  {
390
448
  label: "JWT secret (HS256)",
391
- value: s.jwtSecret,
449
+ value: i.jwtSecret,
392
450
  onChange: (n) => a({ jwtSecret: n })
393
451
  }
394
452
  )
395
453
  ] });
396
454
  }
397
- function ge(t) {
398
- const s = t.value === Tn;
455
+ function be(t) {
456
+ const i = t.value === Wn;
399
457
  return /* @__PURE__ */ o("label", { className: "field", children: [
400
458
  /* @__PURE__ */ e("span", { children: t.label }),
401
459
  /* @__PURE__ */ e(
402
460
  "input",
403
461
  {
404
462
  type: "password",
405
- value: s ? "" : t.value ?? "",
406
- placeholder: s ? "•••••••• (stored — type to replace)" : "",
463
+ value: i ? "" : t.value ?? "",
464
+ placeholder: i ? "•••••••• (stored — type to replace)" : "",
407
465
  onChange: (a) => t.onChange(a.target.value)
408
466
  }
409
467
  ),
410
- s && /* @__PURE__ */ e("span", { className: "hint", children: "A secret is stored — type to replace it." })
468
+ i && /* @__PURE__ */ e("span", { className: "hint", children: "A secret is stored — type to replace it." })
411
469
  ] });
412
470
  }
413
- function _n(t) {
414
- const { id: s, inputs: a } = t, [m, c] = w({}), [n, d] = w(void 0), [I, g] = w(null), [N, h] = w(!1), y = we(), i = wn(), P = async () => {
471
+ function tt(t) {
472
+ const { id: i, inputs: a } = t, [h, d] = b({}), [n, c] = b(void 0), [I, v] = b(null), [N, m] = b(!1), y = we(), s = Fn(), P = async () => {
415
473
  const u = {};
416
474
  for (const r of a) {
417
- const v = We(r.type, m[r.key] ?? "");
418
- v !== void 0 && (u[r.key] = v);
475
+ const g = Le(r.type, h[r.key] ?? "");
476
+ g !== void 0 && (u[r.key] = g);
419
477
  }
420
- h(!0);
478
+ m(!0);
421
479
  try {
422
480
  const r = await t.saveFirst();
423
481
  if (r.status === "blocked") {
424
- d(void 0), g(r.reason);
482
+ c(void 0), v(r.reason);
425
483
  return;
426
484
  }
427
485
  if (r.status === "failed") {
428
- d(void 0), g(fe(r.error));
486
+ c(void 0), v(fe(r.error));
429
487
  return;
430
488
  }
431
- const v = await i.mutateAsync({ id: s, input: u });
432
- g(null), d(v);
489
+ const g = await s.mutateAsync({ id: i, input: u });
490
+ v(null), c(g);
433
491
  } catch (r) {
434
- d(void 0), g(fe(r));
492
+ c(void 0), v(fe(r));
435
493
  } finally {
436
- h(!1), y.invalidateQueries({ queryKey: Ae.root });
494
+ m(!1), y.invalidateQueries({ queryKey: $e.root });
437
495
  }
438
496
  };
439
497
  return /* @__PURE__ */ o("div", { className: "card", children: [
@@ -441,7 +499,7 @@ function _n(t) {
441
499
  /* @__PURE__ */ e("p", { className: "muted small", children: "Dispatches the saved draft to its target — no need to publish first. Unsaved edits are saved first. An Action or Function target returns a value; a Workflow target returns a run id to poll." }),
442
500
  a.length === 0 && /* @__PURE__ */ e("p", { className: "muted small", children: "No declared inputs — the payload is passed through." }),
443
501
  a.map((u) => {
444
- const r = `ep-invoke-${s}-${u.key || u.label}`;
502
+ const r = `ep-invoke-${i}-${u.key || u.label}`;
445
503
  return /* @__PURE__ */ o("div", { className: "field", children: [
446
504
  /* @__PURE__ */ o("label", { htmlFor: r, children: [
447
505
  u.label || u.key,
@@ -451,8 +509,8 @@ function _n(t) {
451
509
  "select",
452
510
  {
453
511
  id: r,
454
- value: m[u.key] ?? "",
455
- onChange: (v) => c((F) => ({ ...F, [u.key]: v.target.value })),
512
+ value: h[u.key] ?? "",
513
+ onChange: (g) => d((F) => ({ ...F, [u.key]: g.target.value })),
456
514
  children: [
457
515
  /* @__PURE__ */ e("option", { value: "", children: "—" }),
458
516
  /* @__PURE__ */ e("option", { value: "true", children: "true" }),
@@ -464,9 +522,9 @@ function _n(t) {
464
522
  {
465
523
  id: r,
466
524
  type: u.type === "number" ? "number" : "text",
467
- value: m[u.key] ?? "",
525
+ value: h[u.key] ?? "",
468
526
  placeholder: u.type === "json" ? "{ }" : u.hint ?? "",
469
- onChange: (v) => c((F) => ({ ...F, [u.key]: v.target.value }))
527
+ onChange: (g) => d((F) => ({ ...F, [u.key]: g.target.value }))
470
528
  }
471
529
  )
472
530
  ] }, u.key || u.label);
@@ -476,63 +534,63 @@ function _n(t) {
476
534
  {
477
535
  type: "button",
478
536
  className: "btn",
479
- disabled: N || i.isPending,
537
+ disabled: N || s.isPending,
480
538
  onClick: () => void P(),
481
- children: N || i.isPending ? "Invoking…" : "Invoke"
539
+ children: N || s.isPending ? "Invoking…" : "Invoke"
482
540
  }
483
541
  ) }),
484
542
  I && /* @__PURE__ */ e("div", { className: "result error", children: I }),
485
543
  n !== void 0 && /* @__PURE__ */ e("pre", { className: "result", style: { overflow: "auto" }, children: JSON.stringify(n, null, 2) })
486
544
  ] });
487
545
  }
488
- function ze(t) {
489
- const { rows: s, onChange: a, title: m, description: c, emptyMeansPassthrough: n, uncoveredKeys: d } = t;
546
+ function Xe(t) {
547
+ const { rows: i, onChange: a, title: h, description: d, emptyMeansPassthrough: n, uncoveredKeys: c } = t;
490
548
  function I() {
491
- a([...s, { key: "", label: "", type: "string" }]);
549
+ a([...i, { key: "", label: "", type: "string" }]);
492
550
  }
493
- function g(h, y) {
494
- a(s.map((i, P) => P === h ? { ...i, ...y } : i));
551
+ function v(m, y) {
552
+ a(i.map((s, P) => P === m ? { ...s, ...y } : s));
495
553
  }
496
- function N(h) {
497
- a(s.filter((y, i) => i !== h));
554
+ function N(m) {
555
+ a(i.filter((y, s) => s !== m));
498
556
  }
499
557
  return /* @__PURE__ */ o("div", { className: "card", children: [
500
558
  /* @__PURE__ */ o("div", { className: "row", style: { justifyContent: "space-between", alignItems: "center" }, children: [
501
- /* @__PURE__ */ e("h3", { children: m }),
559
+ /* @__PURE__ */ e("h3", { children: h }),
502
560
  /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: I, children: "+ Add input" })
503
561
  ] }),
504
- /* @__PURE__ */ e("p", { className: "muted small", children: c }),
505
- s.length === 0 && /* @__PURE__ */ e("p", { className: "muted small", children: n ? "No inputs — payload is passed through." : "No inputs yet." }),
506
- /* @__PURE__ */ e("ul", { className: "list", "data-testid": "input-list", children: s.map((h, y) => (
562
+ /* @__PURE__ */ e("p", { className: "muted small", children: d }),
563
+ i.length === 0 && /* @__PURE__ */ e("p", { className: "muted small", children: n ? "No inputs — payload is passed through." : "No inputs yet." }),
564
+ /* @__PURE__ */ e("ul", { className: "list", "data-testid": "input-list", children: i.map((m, y) => (
507
565
  // biome-ignore lint/suspicious/noArrayIndexKey: rows are positional and reorderable
508
566
  /* @__PURE__ */ o("li", { style: { alignItems: "center", gap: 8 }, children: [
509
567
  /* @__PURE__ */ e(
510
568
  "input",
511
569
  {
512
570
  type: "text",
513
- value: h.key,
571
+ value: m.key,
514
572
  placeholder: "key",
515
573
  "aria-label": "Input key",
516
- onChange: (i) => g(y, { key: i.target.value })
574
+ onChange: (s) => v(y, { key: s.target.value })
517
575
  }
518
576
  ),
519
577
  /* @__PURE__ */ e(
520
578
  "input",
521
579
  {
522
580
  type: "text",
523
- value: h.label,
581
+ value: m.label,
524
582
  placeholder: "Label",
525
583
  "aria-label": "Input label",
526
- onChange: (i) => g(y, { label: i.target.value })
584
+ onChange: (s) => v(y, { label: s.target.value })
527
585
  }
528
586
  ),
529
587
  /* @__PURE__ */ e(
530
588
  "select",
531
589
  {
532
- value: h.type,
590
+ value: m.type,
533
591
  "aria-label": "Input type",
534
- onChange: (i) => g(y, { type: i.target.value }),
535
- children: In.map((i) => /* @__PURE__ */ e("option", { value: i, children: i }, i))
592
+ onChange: (s) => v(y, { type: s.target.value }),
593
+ children: Dn.map((s) => /* @__PURE__ */ e("option", { value: s, children: s }, s))
536
594
  }
537
595
  ),
538
596
  /* @__PURE__ */ o("label", { className: "row", style: { gap: 4, alignItems: "center" }, children: [
@@ -540,133 +598,133 @@ function ze(t) {
540
598
  "input",
541
599
  {
542
600
  type: "checkbox",
543
- checked: h.required ?? !1,
544
- onChange: (i) => g(y, { required: i.target.checked })
601
+ checked: m.required ?? !1,
602
+ onChange: (s) => v(y, { required: s.target.checked })
545
603
  }
546
604
  ),
547
605
  /* @__PURE__ */ e("span", { className: "muted small", children: "required" })
548
606
  ] }),
549
607
  /* @__PURE__ */ e(
550
- be,
608
+ pe,
551
609
  {
552
610
  danger: !0,
553
611
  icon: "close",
554
- label: `Remove input ${h.key || y + 1}`,
612
+ label: `Remove input ${m.key || y + 1}`,
555
613
  onClick: () => N(y)
556
614
  }
557
615
  )
558
616
  ] }, y)
559
617
  )) }),
560
- d && d.length > 0 && /* @__PURE__ */ o("p", { className: "muted small", "data-testid": "input-uncovered", children: [
618
+ c && c.length > 0 && /* @__PURE__ */ o("p", { className: "muted small", "data-testid": "input-uncovered", children: [
561
619
  "Missing required field",
562
- d.length > 1 ? "s" : "",
620
+ c.length > 1 ? "s" : "",
563
621
  " for the current target:",
564
622
  " ",
565
- d.join(", ")
623
+ c.join(", ")
566
624
  ] })
567
625
  ] });
568
626
  }
569
- const Vn = ["action", "function", "workflow", "endpoint"], Yn = {
627
+ const at = ["action", "function", "workflow", "endpoint"], it = {
570
628
  action: "Action (synchronous)",
571
629
  function: "Function (synchronous)",
572
630
  workflow: "Workflow (asynchronous)",
573
631
  endpoint: "Endpoint (dispatches to another Endpoint)"
574
632
  };
575
- function Ge(t) {
633
+ function Ze(t) {
576
634
  var F;
577
- const { kind: s, id: a, uses: m, dirty: c } = t, n = (m == null ? void 0 : m.app) ?? "", d = (m == null ? void 0 : m.connection) ?? "", I = we(), g = _e(n, n !== ""), N = (F = $e(s, a, !0).data) == null ? void 0 : F.enabled, h = Kn(s), y = g.isSuccess && !g.isFetching, i = L(() => new Set((g.data ?? []).map((b) => b.id)), [g.data]), P = He(
578
- [{ id: "target", uses: m }],
579
- () => y ? { state: "ready", ids: i } : void 0
580
- ).length, u = X({ id: a, had: !1 });
635
+ const { kind: i, id: a, uses: h, dirty: d } = t, n = (h == null ? void 0 : h.app) ?? "", c = (h == null ? void 0 : h.connection) ?? "", I = we(), v = _e(n, n !== ""), N = (F = qe(i, a, !0).data) == null ? void 0 : F.enabled, m = Mn(i), y = v.isSuccess && !v.isFetching, s = L(() => new Set((v.data ?? []).map((k) => k.id)), [v.data]), P = He(
636
+ [{ id: "target", uses: h }],
637
+ () => y ? { state: "ready", ids: s } : void 0
638
+ ).length, u = _({ id: a, had: !1 });
581
639
  u.current.id !== a && (u.current = { id: a, had: !1 }), P > 0 && (u.current.had = !0);
582
- const r = X(null);
583
- ce(() => {
584
- const b = `${n}|${d}`, B = r.current;
585
- r.current = b, B !== null && B !== b && y && d && !i.has(d) && I.invalidateQueries({ queryKey: On(n) });
586
- }, [n, d, y, i, I]);
587
- const v = xn({
640
+ const r = _(null);
641
+ se(() => {
642
+ const k = `${n}|${c}`, B = r.current;
643
+ r.current = k, B !== null && B !== k && y && c && !s.has(c) && I.invalidateQueries({ queryKey: Un(n) });
644
+ }, [n, c, y, s, I]);
645
+ const g = Qn({
588
646
  enabled: N,
589
647
  problemCount: P,
590
- dirty: c,
648
+ dirty: d,
591
649
  hadProblems: u.current.had
592
650
  });
593
- return v.show ? /* @__PURE__ */ e(
594
- nn,
651
+ return g.show ? /* @__PURE__ */ e(
652
+ rn,
595
653
  {
596
- kind: s,
597
- problemCount: v.problemCount,
598
- canEnable: v.canEnable,
599
- pending: h.isPending,
600
- onEnable: () => h.mutate({ id: a, enabled: !0 })
654
+ kind: i,
655
+ problemCount: g.problemCount,
656
+ canEnable: g.canEnable,
657
+ pending: m.isPending,
658
+ onEnable: () => m.mutate({ id: a, enabled: !0 })
601
659
  }
602
660
  ) : null;
603
661
  }
604
- function Xe(t) {
605
- var z, q, re;
662
+ function en(t) {
663
+ var G, q, le;
606
664
  const {
607
- allowedKinds: s,
665
+ allowedKinds: i,
608
666
  excludeCallableIds: a,
609
- value: m,
610
- onChange: c,
667
+ value: h,
668
+ onChange: d,
611
669
  onResolved: n,
612
- title: d,
670
+ title: c,
613
671
  description: I,
614
- passthroughHint: g
615
- } = t, [N, h] = w(!1), y = m, i = y.kind, P = (l) => s.includes(l);
672
+ passthroughHint: v
673
+ } = t, [N, m] = b(!1), y = h, s = y.kind, P = (l) => i.includes(l);
616
674
  function u(l) {
617
- c(l);
675
+ d(l);
618
676
  }
619
- const r = y.kind === "action" ? y : void 0, v = (r == null ? void 0 : r.uses.app) ?? "", F = (r == null ? void 0 : r.uses.action) ?? "", b = Fn(y), B = jn(v), [W, _] = w(null);
620
- ce(() => {
677
+ const r = y.kind === "action" ? y : void 0, g = (r == null ? void 0 : r.uses.app) ?? "", F = (r == null ? void 0 : r.uses.action) ?? "", k = Kn(y), B = qn(g), [W, V] = b(null);
678
+ se(() => {
621
679
  let l = !1;
622
680
  return import("@w6w/ui/flow").then((E) => {
623
- l || _({ isTriggerApp: E.isTriggerApp, asFieldDefs: E.asFieldDefs });
681
+ l || V({ isTriggerApp: E.isTriggerApp, asFieldDefs: E.asFieldDefs });
624
682
  }), () => {
625
683
  l = !0;
626
684
  };
627
685
  }, []);
628
- const Q = An(v, v !== ""), T = _e(v, v !== ""), se = He(
686
+ const Q = wn(g, g !== ""), K = _e(g, g !== ""), oe = He(
629
687
  [{ id: "target", uses: r == null ? void 0 : r.uses }],
630
- () => T.isSuccess && !T.isFetching ? { state: "ready", ids: new Set((T.data ?? []).map((l) => l.id)) } : void 0
688
+ () => K.isSuccess && !K.isFetching ? { state: "ready", ids: new Set((K.data ?? []).map((l) => l.id)) } : void 0
631
689
  ).length > 0, R = L(
632
690
  () => (Q.data ?? []).find((l) => l.key === F),
633
691
  [Q.data, F]
634
- ), $ = ["function", "workflow"].filter(P), oe = `Choose ${d.charAt(0).toLowerCase()}${d.slice(1)}`, S = Nn(P("function")), f = fn(void 0, P("workflow")), D = Cn(P("endpoint")), V = Me(b, i === "function" && b !== ""), Y = pn(b, i === "workflow" && b !== ""), Z = Je(b, i === "endpoint" && b !== ""), O = L(() => {
635
- var l, E, k;
636
- return i === "action" ? ye((R == null ? void 0 : R.params) ?? []) : i === "function" ? ye(((l = V.data) == null ? void 0 : l.inputs) ?? []) : i === "workflow" ? W ? Pn(
637
- (E = Y.data) == null ? void 0 : E.workflow,
692
+ ), $ = ["function", "workflow"].filter(P), re = `Choose ${c.charAt(0).toLowerCase()}${c.slice(1)}`, S = Pn(P("function")), f = Jn(void 0, P("workflow")), x = Bn(P("endpoint")), Y = je(k, s === "function" && k !== ""), z = Ln(k, s === "workflow" && k !== ""), Z = Me(k, s === "endpoint" && k !== ""), O = L(() => {
693
+ var l, E, w;
694
+ return s === "action" ? ve((R == null ? void 0 : R.params) ?? []) : s === "function" ? ve(((l = Y.data) == null ? void 0 : l.inputs) ?? []) : s === "workflow" ? W ? Tn(
695
+ (E = z.data) == null ? void 0 : E.workflow,
638
696
  W
639
- ) : [] : i === "endpoint" ? ye(((k = Z.data) == null ? void 0 : k.endpoint.input) ?? []) : [];
697
+ ) : [] : s === "endpoint" ? ve(((w = Z.data) == null ? void 0 : w.endpoint.input) ?? []) : [];
640
698
  }, [
641
- i,
699
+ s,
642
700
  R,
643
- V.data,
644
701
  Y.data,
702
+ z.data,
645
703
  Z.data,
646
704
  W
647
705
  ]);
648
- ce(() => {
649
- n == null || n({ meta: { kind: i, ref: i === "action" ? v : b }, kind: i, fields: O });
650
- }, [i, v, b, O, n]);
651
- function G(l) {
652
- if (l.uses.app === yn) {
653
- const x = l.with ?? {}, M = x.targetKind === "workflow" ? "workflow" : "function", p = typeof x.targetId == "string" ? x.targetId : "";
706
+ se(() => {
707
+ n == null || n({ meta: { kind: s, ref: s === "action" ? g : k }, kind: s, fields: O });
708
+ }, [s, g, k, O, n]);
709
+ function X(l) {
710
+ if (l.uses.app === Nn) {
711
+ const T = l.with ?? {}, M = T.targetKind === "workflow" ? "workflow" : "function", p = typeof T.targetId == "string" ? T.targetId : "";
654
712
  if (!p) return;
655
713
  u(
656
714
  M === "workflow" ? { kind: "workflow", workflow: p } : { kind: "function", function: p }
657
- ), h(!1);
715
+ ), m(!1);
658
716
  return;
659
717
  }
660
718
  if (l.uses.app.startsWith("@w6w/")) return;
661
- const E = y.kind === "action" ? y.with ?? {} : {}, k = l.with ?? {}, J = {};
662
- for (const x of Object.keys(k))
663
- J[x] = x in E ? E[x] : k[x];
664
- u({ kind: "action", uses: l.uses, with: J }), h(!1);
719
+ const E = y.kind === "action" ? y.with ?? {} : {}, w = l.with ?? {}, J = {};
720
+ for (const T of Object.keys(w))
721
+ J[T] = T in E ? E[T] : w[T];
722
+ u({ kind: "action", uses: l.uses, with: J }), m(!1);
665
723
  }
666
724
  function U(l, E) {
667
725
  if (y.kind !== "action") return;
668
- const k = { ...y.with ?? {} };
669
- E === "" || E === void 0 ? delete k[l] : k[l] = E, u({ ...y, with: k });
726
+ const w = { ...y.with ?? {} };
727
+ E === "" || E === void 0 ? delete w[l] : w[l] = E, u({ ...y, with: w });
670
728
  }
671
729
  function ee(l) {
672
730
  u(
@@ -675,58 +733,58 @@ function Xe(t) {
675
733
  }
676
734
  function ne(l) {
677
735
  u(
678
- i === "function" ? { kind: "function", function: l } : i === "workflow" ? { kind: "workflow", workflow: l } : { kind: "endpoint", endpoint: l }
736
+ s === "function" ? { kind: "function", function: l } : s === "workflow" ? { kind: "workflow", workflow: l } : { kind: "endpoint", endpoint: l }
679
737
  );
680
738
  }
681
739
  const te = L(() => {
682
740
  var l, E;
683
- if (b) {
684
- if (i === "function") {
685
- const k = (l = S.data) == null ? void 0 : l.find((J) => J.id === b);
686
- return k ? k.displayName || k.key : void 0;
741
+ if (k) {
742
+ if (s === "function") {
743
+ const w = (l = S.data) == null ? void 0 : l.find((J) => J.id === k);
744
+ return w ? w.displayName || w.key : void 0;
687
745
  }
688
- if (i === "workflow") {
689
- const k = (E = f.data) == null ? void 0 : E.find((J) => J.id === b);
690
- return k ? k.displayName || k.name : void 0;
746
+ if (s === "workflow") {
747
+ const w = (E = f.data) == null ? void 0 : E.find((J) => J.id === k);
748
+ return w ? w.displayName || w.name : void 0;
691
749
  }
692
750
  }
693
- }, [i, b, S.data, f.data]), ae = L(() => {
751
+ }, [s, k, S.data, f.data]), ae = L(() => {
694
752
  const l = (R == null ? void 0 : R.params) ?? [], E = (r == null ? void 0 : r.with) ?? {};
695
- return l.filter((k) => {
696
- if (k.showIf) {
697
- const { field: x, equals: M, in: p, notIn: A, truthy: ue } = k.showIf, ie = E[x];
753
+ return l.filter((w) => {
754
+ if (w.showIf) {
755
+ const { field: T, equals: M, in: p, notIn: A, truthy: ue } = w.showIf, ie = E[T];
698
756
  if (M !== void 0 && ie !== M || p !== void 0 && !p.includes(ie) || A != null && A.includes(ie) || ue !== void 0 && !!ie !== ue) return !1;
699
757
  }
700
- const J = k.key in E && E[k.key] !== "" && E[k.key] !== void 0;
701
- return k.required || J;
758
+ const J = w.key in E && E[w.key] !== "" && E[w.key] !== void 0;
759
+ return w.required || J;
702
760
  });
703
761
  }, [R, r == null ? void 0 : r.with]);
704
762
  return /* @__PURE__ */ o("div", { className: "card", children: [
705
- /* @__PURE__ */ e("h3", { children: d }),
763
+ /* @__PURE__ */ e("h3", { children: c }),
706
764
  /* @__PURE__ */ e("p", { className: "muted small", children: I }),
707
- s.length > 1 && /* @__PURE__ */ o("label", { className: "field", children: [
765
+ i.length > 1 && /* @__PURE__ */ o("label", { className: "field", children: [
708
766
  /* @__PURE__ */ e("span", { children: "Kind" }),
709
- /* @__PURE__ */ e("select", { value: i, onChange: (l) => ee(l.target.value), children: Vn.filter(P).map((l) => /* @__PURE__ */ e("option", { value: l, children: Yn[l] }, l)) })
767
+ /* @__PURE__ */ e("select", { value: s, onChange: (l) => ee(l.target.value), children: at.filter(P).map((l) => /* @__PURE__ */ e("option", { value: l, children: it[l] }, l)) })
710
768
  ] }),
711
- i === "action" && /* @__PURE__ */ o(K, { children: [
712
- v && F ? /* @__PURE__ */ o("div", { className: "row", style: { alignItems: "center", gap: 8 }, children: [
769
+ s === "action" && /* @__PURE__ */ o(D, { children: [
770
+ g && F ? /* @__PURE__ */ o("div", { className: "row", style: { alignItems: "center", gap: 8 }, children: [
713
771
  /* @__PURE__ */ e(
714
- on,
772
+ un,
715
773
  {
716
774
  src: B == null ? void 0 : B.iconSvg,
717
775
  srcDark: B == null ? void 0 : B.iconSvgDark,
718
776
  brandColor: B == null ? void 0 : B.brandColor,
719
- name: v
777
+ name: g
720
778
  }
721
779
  ),
722
780
  /* @__PURE__ */ o("span", { className: "list-main", children: [
723
781
  /* @__PURE__ */ e("strong", { children: (R == null ? void 0 : R.title) ?? F }),
724
782
  " ",
725
- /* @__PURE__ */ e("code", { className: "muted", children: v }),
726
- /* @__PURE__ */ e("span", { className: "muted small block", children: se ? /* @__PURE__ */ e("span", { className: "error", "data-testid": "binding-missing", children: "Missing connection — choose another" }) : r != null && r.uses.connection ? `via ${((q = (z = T.data) == null ? void 0 : z.find((l) => l.id === r.uses.connection)) == null ? void 0 : q.displayName) ?? r.uses.connection}` : "no connection" })
783
+ /* @__PURE__ */ e("code", { className: "muted", children: g }),
784
+ /* @__PURE__ */ e("span", { className: "muted small block", children: oe ? /* @__PURE__ */ e("span", { className: "error", "data-testid": "binding-missing", children: "Missing connection — choose another" }) : r != null && r.uses.connection ? `via ${((q = (G = K.data) == null ? void 0 : G.find((l) => l.id === r.uses.connection)) == null ? void 0 : q.displayName) ?? r.uses.connection}` : "no connection" })
727
785
  ] }),
728
- /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: () => h(!0), children: "Change" })
729
- ] }) : /* @__PURE__ */ e("button", { type: "button", className: "btn", onClick: () => h(!0), children: "+ Choose an action" }),
786
+ /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: () => m(!0), children: "Change" })
787
+ ] }) : /* @__PURE__ */ e("button", { type: "button", className: "btn", onClick: () => m(!0), children: "+ Choose an action" }),
730
788
  F && /* @__PURE__ */ o("div", { style: { marginTop: 12 }, children: [
731
789
  /* @__PURE__ */ e("h4", { children: "Input mapping" }),
732
790
  /* @__PURE__ */ o("p", { className: "muted small", children: [
@@ -734,7 +792,7 @@ function Xe(t) {
734
792
  " ",
735
793
  /* @__PURE__ */ e("code", { children: "inputs.<key>" }),
736
794
  "; anything else is a literal.",
737
- g && " Leave every cell blank to pass the inbound payload through as the action's params."
795
+ v && " Leave every cell blank to pass the inbound payload through as the action's params."
738
796
  ] }),
739
797
  ae.length === 0 ? /* @__PURE__ */ e("p", { className: "muted small", children: "This action declares no params." }) : /* @__PURE__ */ e("ul", { className: "list", children: ae.map((l) => {
740
798
  var E;
@@ -744,10 +802,10 @@ function Xe(t) {
744
802
  l.required && /* @__PURE__ */ e("span", { className: "muted small", children: " · required" })
745
803
  ] }),
746
804
  /* @__PURE__ */ e("div", { style: { flex: 1 }, children: /* @__PURE__ */ e(
747
- rn,
805
+ hn,
748
806
  {
749
807
  value: (E = r == null ? void 0 : r.with) == null ? void 0 : E[l.key],
750
- onChange: (k) => U(l.key, k),
808
+ onChange: (w) => U(l.key, w),
751
809
  placeholder: `inputs.${l.key}`,
752
810
  "aria-label": `Mapping for ${l.key}`
753
811
  }
@@ -756,17 +814,17 @@ function Xe(t) {
756
814
  }) })
757
815
  ] })
758
816
  ] }),
759
- (i === "function" || i === "workflow") && /* @__PURE__ */ e("div", { className: "row", style: { alignItems: "center", gap: 8 }, children: b ? /* @__PURE__ */ o(K, { children: [
817
+ (s === "function" || s === "workflow") && /* @__PURE__ */ e("div", { className: "row", style: { alignItems: "center", gap: 8 }, children: k ? /* @__PURE__ */ o(D, { children: [
760
818
  /* @__PURE__ */ o("span", { className: "list-main", children: [
761
- /* @__PURE__ */ e("strong", { children: te ?? b }),
819
+ /* @__PURE__ */ e("strong", { children: te ?? k }),
762
820
  " ",
763
- /* @__PURE__ */ e("code", { className: "muted", children: b }),
764
- /* @__PURE__ */ e("span", { className: "muted small block", children: i === "function" ? "Function (synchronous)" : "Workflow (asynchronous)" })
821
+ /* @__PURE__ */ e("code", { className: "muted", children: k }),
822
+ /* @__PURE__ */ e("span", { className: "muted small block", children: s === "function" ? "Function (synchronous)" : "Workflow (asynchronous)" })
765
823
  ] }),
766
- /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: () => h(!0), children: "Change" })
767
- ] }) : /* @__PURE__ */ o("button", { type: "button", className: "btn", onClick: () => h(!0), children: [
824
+ /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: () => m(!0), children: "Change" })
825
+ ] }) : /* @__PURE__ */ o("button", { type: "button", className: "btn", onClick: () => m(!0), children: [
768
826
  "+ Choose a ",
769
- i
827
+ s
770
828
  ] }) }),
771
829
  N && /* No provider here. The scope this modal needs is INHERITED from
772
830
  the page (which contributes its `inputs`) over the app shell
@@ -780,26 +838,26 @@ function Xe(t) {
780
838
  kind this card allows, so which arm is showing decides only which
781
839
  tab it OPENS on, never whether it renders. */
782
840
  /* @__PURE__ */ e(
783
- ln,
841
+ mn,
784
842
  {
785
843
  appsOnly: !0,
786
844
  callables: $,
787
845
  excludeCallableIds: a,
788
- initialTab: i === "function" || i === "workflow" ? `${i}s` : "connected",
789
- title: oe,
790
- onClose: () => h(!1),
791
- onAdd: G,
792
- initialApp: r && v ? B : void 0,
846
+ initialTab: s === "function" || s === "workflow" ? `${s}s` : "connected",
847
+ title: re,
848
+ onClose: () => m(!1),
849
+ onAdd: X,
850
+ initialApp: r && g ? B : void 0,
793
851
  initialAction: r ? F : void 0,
794
852
  initialConnection: (r == null ? void 0 : r.uses.connection) ?? void 0,
795
853
  initialWith: r == null ? void 0 : r.with
796
854
  }
797
855
  ),
798
- i === "endpoint" && /* @__PURE__ */ o("label", { className: "field", children: [
856
+ s === "endpoint" && /* @__PURE__ */ o("label", { className: "field", children: [
799
857
  /* @__PURE__ */ e("span", { children: "Endpoint" }),
800
- /* @__PURE__ */ o("select", { value: b, onChange: (l) => ne(l.target.value), children: [
858
+ /* @__PURE__ */ o("select", { value: k, onChange: (l) => ne(l.target.value), children: [
801
859
  /* @__PURE__ */ e("option", { value: "", children: "— pick an endpoint —" }),
802
- (re = D.data) == null ? void 0 : re.map((l) => /* @__PURE__ */ o("option", { value: l.id, children: [
860
+ (le = x.data) == null ? void 0 : le.map((l) => /* @__PURE__ */ o("option", { value: l.id, children: [
803
861
  l.displayName || l.key,
804
862
  " (",
805
863
  l.id,
@@ -809,13 +867,13 @@ function Xe(t) {
809
867
  ] })
810
868
  ] });
811
869
  }
812
- const zn = () => {
870
+ const st = () => {
813
871
  };
814
- function le(t) {
815
- return t instanceof pe || t instanceof Error ? t.message : String(t);
872
+ function de(t) {
873
+ return t instanceof ye || t instanceof Error ? t.message : String(t);
816
874
  }
817
- function It(t) {
818
- const { endpointId: s, onNavigate: a = zn, slots: m, tools: c } = t, n = ke(t.project), d = he(
875
+ function jt(t) {
876
+ const { endpointId: i, onNavigate: a = st, slots: h, tools: d } = t, n = ke(t.project), c = he(
819
877
  (I) => a(I),
820
878
  [a]
821
879
  );
@@ -825,146 +883,146 @@ function It(t) {
825
883
  className: "w6w-embed-root",
826
884
  style: { display: "flex", width: "100%", height: "100%", minHeight: 0 },
827
885
  children: /* @__PURE__ */ e(
828
- Be,
886
+ Re,
829
887
  {
830
888
  project: n,
831
- onNavigate: d,
889
+ onNavigate: c,
832
890
  rail: t.rail,
833
- tools: c,
891
+ tools: d,
834
892
  storageKey: n === null ? null : `w6w.rail.embed.${n}`,
835
893
  children: /* @__PURE__ */ e("div", { style: { flex: 1, minWidth: 0, overflow: "auto" }, children: /* @__PURE__ */ e(
836
- Gn,
894
+ ot,
837
895
  {
838
- id: s,
896
+ id: i,
839
897
  onNavigate: a,
840
- slots: m
898
+ slots: h
841
899
  },
842
- s
900
+ i
843
901
  ) })
844
902
  }
845
903
  )
846
904
  }
847
905
  );
848
906
  }
849
- function Gn(t) {
907
+ function ot(t) {
850
908
  var Ne;
851
- const { id: s, onNavigate: a, slots: m } = t, c = je("endpoint"), n = Je(s).data, [d, I] = w([]), g = X(d);
852
- g.current = d;
853
- const N = X(!1), h = X(!1), [y, i] = w("id"), [P, u] = w(null), [r, v] = w(!1), [F, b] = w(!1), [B, W] = w(!1), [_, Q] = w(""), [T, se] = w({ id: s, key: "" }), [R, $] = w(null), oe = he((C) => {
854
- const H = de(C), j = Se({
909
+ const { id: i, onNavigate: a, slots: h } = t, d = Oe("endpoint"), n = Me(i).data, [c, I] = b([]), v = _(c);
910
+ v.current = c;
911
+ const N = _(!1), m = _(!1), [y, s] = b("id"), [P, u] = b(null), [r, g] = b(!1), [F, k] = b(!1), [B, W] = b(!1), [V, Q] = b(""), [K, oe] = b({ id: i, key: "" }), [R, $] = b(null), re = he((C) => {
912
+ const H = ce(C), j = Ee({
855
913
  target: H.target,
856
914
  rows: H.input ?? [],
857
- fields: g.current
915
+ fields: v.current
858
916
  });
859
917
  return j.length > 0 ? `The target needs: ${j.join(", ")}` : null;
860
- }, []), S = vn({ id: s, saveGuard: oe }), f = L(
861
- () => S.definition ? de(S.definition) : null,
918
+ }, []), S = Cn({ id: i, saveGuard: re }), f = L(
919
+ () => S.definition ? ce(S.definition) : null,
862
920
  [S.definition]
863
- ), D = (f == null ? void 0 : f.input) ?? [], V = Ge({
921
+ ), x = (f == null ? void 0 : f.input) ?? [], Y = Ze({
864
922
  kind: "endpoint",
865
- id: s,
923
+ id: i,
866
924
  uses: (f == null ? void 0 : f.target.kind) === "action" ? f.target.uses : void 0,
867
925
  dirty: S.dirty
868
- }), Y = ((Ne = f == null ? void 0 : f.exposure) == null ? void 0 : Ne.security) ?? {
926
+ }), z = ((Ne = f == null ? void 0 : f.exposure) == null ? void 0 : Ne.security) ?? {
869
927
  auth: "platform"
870
- }, Z = Ve(n == null ? void 0 : n.invokeUrls), O = Wn(n == null ? void 0 : n.invokeUrls, P);
871
- Oe({
928
+ }, Z = ze(n == null ? void 0 : n.invokeUrls), O = zn(n == null ? void 0 : n.invokeUrls, P);
929
+ Ae({
872
930
  kind: "endpoint",
873
- id: s,
931
+ id: i,
874
932
  label: (f == null ? void 0 : f.displayName) || void 0,
875
933
  key: (f == null ? void 0 : f.key.trim()) || void 0,
876
934
  invokeUrl: O ? O.url : n == null ? void 0 : n.invokeUrl,
877
935
  invokeUrlByKey: O ? O.urlByKey : n == null ? void 0 : n.invokeUrlByKey,
878
936
  urlForm: y,
879
- inputs: d.map((C) => C.key),
937
+ inputs: c.map((C) => C.key),
880
938
  policy: S.policy,
881
939
  onPolicyChange: S.onPolicyChange
882
940
  });
883
- const { setDefinition: G } = S, U = he(
941
+ const { setDefinition: X } = S, U = he(
884
942
  (C) => {
885
- b(!1), G((H) => ({
886
- ...de(H),
943
+ k(!1), X((H) => ({
944
+ ...ce(H),
887
945
  ...C
888
946
  }));
889
947
  },
890
- [G]
948
+ [X]
891
949
  ), ee = (C) => {
892
- b(!1), G((H) => {
950
+ k(!1), X((H) => {
893
951
  var Ce;
894
- const j = de(H), Ze = {
952
+ const j = ce(H), nn = {
895
953
  ...((Ce = j.exposure) == null ? void 0 : Ce.security) ?? { auth: "platform" },
896
954
  ...C
897
955
  };
898
- return { ...j, exposure: { ...j.exposure, security: Ze } };
956
+ return { ...j, exposure: { ...j.exposure, security: nn } };
899
957
  });
900
958
  };
901
959
  function ne(C) {
902
960
  N.current = !0, U({ target: C });
903
961
  }
904
- ce(() => {
962
+ se(() => {
905
963
  if (N.current) {
906
- if (!Qe({ rows: D, touched: h.current })) {
964
+ if (!We({ rows: x, touched: m.current })) {
907
965
  N.current = !1;
908
966
  return;
909
967
  }
910
- d.length !== 0 && (U({ input: Ue(D, d) }), N.current = !1);
968
+ c.length !== 0 && (U({ input: Qe(x, c) }), N.current = !1);
911
969
  }
912
- }, [d]);
970
+ }, [c]);
913
971
  const te = L(
914
- () => ({ inputs: D.map((C) => C.key).filter(Boolean) }),
915
- [D]
972
+ () => ({ inputs: x.map((C) => C.key).filter(Boolean) }),
973
+ [x]
916
974
  ), ae = L(
917
- () => qe(D, d),
918
- [D, d]
919
- ), z = L(
920
- () => f ? Se({
975
+ () => Ue(x, c),
976
+ [x, c]
977
+ ), G = L(
978
+ () => f ? Ee({
921
979
  target: f.target,
922
- rows: D,
923
- fields: d
980
+ rows: x,
981
+ fields: c
924
982
  }) : [],
925
- [f, D, d]
926
- ), q = f && z.length > 0 ? /* @__PURE__ */ o("p", { className: "error small", "data-testid": "save-blocked", children: [
983
+ [f, x, c]
984
+ ), q = f && G.length > 0 ? /* @__PURE__ */ o("p", { className: "error small", "data-testid": "save-blocked", children: [
927
985
  "Can’t save yet — the target needs",
928
986
  " ",
929
987
  f.target.kind === "action" ? "these required params mapped under Input mapping" : "these required keys declared under Input",
930
988
  ": ",
931
- /* @__PURE__ */ e("strong", { children: z.join(", ") })
932
- ] }) : null, l = !!((f == null ? void 0 : f.key.trim()) ?? "") && z.length === 0 && S.canSave;
989
+ /* @__PURE__ */ e("strong", { children: G.join(", ") })
990
+ ] }) : null, l = !!((f == null ? void 0 : f.key.trim()) ?? "") && G.length === 0 && S.canSave;
933
991
  async function E() {
934
992
  if (!f) return;
935
- const C = await S.commit(ve(f));
936
- b(C.status === "saved" || C.status === "clean");
993
+ const C = await S.commit(ge(f));
994
+ k(C.status === "saved" || C.status === "clean");
937
995
  }
938
- async function k() {
939
- return !f || !S.dirty ? { status: "clean" } : l ? S.commit(ve(f)) : {
996
+ async function w() {
997
+ return !f || !S.dirty ? { status: "clean" } : l ? S.commit(ge(f)) : {
940
998
  status: "blocked",
941
999
  reason: "Fix the highlighted problems, then save, to test this Endpoint."
942
1000
  };
943
1001
  }
944
1002
  function J() {
945
1003
  if (!f) return;
946
- const C = ve(f);
947
- Q(JSON.stringify(C, null, 2)), se({ id: String(C.id), key: String(C.key) }), $(null), W(!0);
1004
+ const C = ge(f);
1005
+ Q(JSON.stringify(C, null, 2)), oe({ id: String(C.id), key: String(C.key) }), $(null), W(!0);
948
1006
  }
949
- async function x() {
950
- const C = me(_, T), H = C.parsed;
1007
+ async function T() {
1008
+ const C = me(V, K), H = C.parsed;
951
1009
  if (!H || C.blockedReason) return;
952
1010
  const j = await S.commit(H);
953
- j.status === "saved" || j.status === "clean" ? ($(null), W(!1), b(j.status === "saved" || j.status === "clean")) : j.status === "failed" ? $(le(j.error)) : $(j.reason);
1011
+ j.status === "saved" || j.status === "clean" ? ($(null), W(!1), k(j.status === "saved" || j.status === "clean")) : j.status === "failed" ? $(de(j.error)) : $(j.reason);
954
1012
  }
955
- const M = S.loadError, p = M instanceof pe && M.status === 404;
1013
+ const M = S.loadError, p = M instanceof ye && M.status === 404;
956
1014
  if (!f) {
957
1015
  if (M !== null && !p)
958
- return /* @__PURE__ */ e("div", { className: "error", role: "alert", children: le(M) });
1016
+ return /* @__PURE__ */ e("div", { className: "error", role: "alert", children: de(M) });
959
1017
  if (!p) return /* @__PURE__ */ e("p", { className: "muted", children: "Loading…" });
960
1018
  }
961
- const A = f && (f.displayName || f.key) || c.editor.newTitle, ue = S.error !== null && !S.stale ? le(S.error) : null, ie = S.stale || S.changedElsewhere ? /* @__PURE__ */ o("div", { className: "error", role: "alert", "data-testid": "endpoint-stale", children: [
962
- S.stale ? le(S.error) : "This endpoint was changed elsewhere. Reload to see the new version (your edits will be discarded).",
1019
+ const A = f && (f.displayName || f.key) || d.editor.newTitle, ue = S.error !== null && !S.stale ? de(S.error) : null, ie = S.stale || S.changedElsewhere ? /* @__PURE__ */ o("div", { className: "error", role: "alert", "data-testid": "endpoint-stale", children: [
1020
+ S.stale ? de(S.error) : "This endpoint was changed elsewhere. Reload to see the new version (your edits will be discarded).",
963
1021
  " ",
964
1022
  /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", onClick: () => void S.reload(), children: "Reload" })
965
1023
  ] }) : null;
966
- return /* @__PURE__ */ e(xe, { value: te, children: /* @__PURE__ */ e(
967
- Ye,
1024
+ return /* @__PURE__ */ e(Te, { value: te, children: /* @__PURE__ */ e(
1025
+ Ge,
968
1026
  {
969
1027
  kind: "endpoint",
970
1028
  title: A,
@@ -972,31 +1030,31 @@ function Gn(t) {
972
1030
  canSave: l,
973
1031
  isSaving: S.saving,
974
1032
  onSave: () => void E(),
975
- error: p ? le(M) : ue,
1033
+ error: p ? de(M) : ue,
976
1034
  notFound: p,
977
1035
  onNavigate: a,
978
- slots: m,
979
- publish: { id: s, saveFirst: k, disabled: !l },
980
- headerActions: /* @__PURE__ */ o(K, { children: [
981
- /* @__PURE__ */ e(De, { kind: "endpoint", id: s }),
982
- /* @__PURE__ */ e(Ke, { onClick: J })
1036
+ slots: h,
1037
+ publish: { id: i, saveFirst: w, disabled: !l },
1038
+ headerActions: /* @__PURE__ */ o(D, { children: [
1039
+ /* @__PURE__ */ e(Ye, { kind: "endpoint", id: i }),
1040
+ /* @__PURE__ */ e(De, { onClick: J })
983
1041
  ] }),
984
- banners: /* @__PURE__ */ o(K, { children: [
985
- V,
1042
+ banners: /* @__PURE__ */ o(D, { children: [
1043
+ Y,
986
1044
  ie,
987
1045
  q,
988
1046
  F && /* @__PURE__ */ e("span", { className: "ok", children: "Saved." })
989
1047
  ] }),
990
- children: f && /* @__PURE__ */ o(K, { children: [
1048
+ children: f && /* @__PURE__ */ o(D, { children: [
991
1049
  /* @__PURE__ */ o("div", { className: "card", children: [
992
1050
  /* @__PURE__ */ o("div", { className: "section-head", children: [
993
1051
  /* @__PURE__ */ e("h3", { children: "Identity" }),
994
1052
  /* @__PURE__ */ e(
995
- be,
1053
+ pe,
996
1054
  {
997
1055
  icon: "edit-2",
998
1056
  label: "Edit name, key, and description",
999
- onClick: () => v(!0)
1057
+ onClick: () => g(!0)
1000
1058
  }
1001
1059
  )
1002
1060
  ] }),
@@ -1014,35 +1072,35 @@ function Gn(t) {
1014
1072
  ] })
1015
1073
  ] }),
1016
1074
  /* @__PURE__ */ e(
1017
- $n,
1075
+ et,
1018
1076
  {
1019
- entry: Qn(O, n == null ? void 0 : n.invokeUrl, n == null ? void 0 : n.invokeUrlByKey),
1077
+ entry: Gn(O, n == null ? void 0 : n.invokeUrl, n == null ? void 0 : n.invokeUrlByKey),
1020
1078
  domainOptions: Z,
1021
1079
  urlDomain: (O == null ? void 0 : O.domain) ?? null,
1022
1080
  onUrlDomain: u,
1023
1081
  urlForm: y,
1024
- onUrlForm: i
1082
+ onUrlForm: s
1025
1083
  }
1026
1084
  ),
1027
1085
  /* @__PURE__ */ e(
1028
- ze,
1086
+ Xe,
1029
1087
  {
1030
1088
  title: "Input",
1031
1089
  description: "The declared inbound contract. Reuses core Param fields. Leave empty to pass the raw request payload through to the target unchanged.",
1032
1090
  emptyMeansPassthrough: !0,
1033
- rows: D,
1091
+ rows: x,
1034
1092
  onChange: (C) => {
1035
- h.current = !0, U({ input: C });
1093
+ m.current = !0, U({ input: C });
1036
1094
  },
1037
1095
  uncoveredKeys: ae
1038
1096
  }
1039
1097
  ),
1040
1098
  /* @__PURE__ */ e(
1041
- Xe,
1099
+ en,
1042
1100
  {
1043
1101
  allowedKinds: ["action", "function", "workflow"],
1044
1102
  title: "Target",
1045
- description: /* @__PURE__ */ o(K, { children: [
1103
+ description: /* @__PURE__ */ o(D, { children: [
1046
1104
  "The single thing this Endpoint dispatches to. An ",
1047
1105
  /* @__PURE__ */ e("strong", { children: "Action" }),
1048
1106
  " target runs one app action directly and a ",
@@ -1057,8 +1115,8 @@ function Gn(t) {
1057
1115
  onResolved: (C) => I(C.fields)
1058
1116
  }
1059
1117
  ),
1060
- /* @__PURE__ */ e(Hn, { security: Y, onPatch: ee }),
1061
- /* @__PURE__ */ e(_n, { id: s, inputs: D, saveFirst: k }),
1118
+ /* @__PURE__ */ e(nt, { security: z, onPatch: ee }),
1119
+ /* @__PURE__ */ e(tt, { id: i, inputs: x, saveFirst: w }),
1062
1120
  /* @__PURE__ */ o(
1063
1121
  "div",
1064
1122
  {
@@ -1085,33 +1143,33 @@ function Gn(t) {
1085
1143
  }
1086
1144
  ),
1087
1145
  r && /* @__PURE__ */ e(
1088
- bn,
1146
+ En,
1089
1147
  {
1090
1148
  initial: {
1091
1149
  key: f.key,
1092
1150
  displayName: f.displayName ?? "",
1093
1151
  description: f.description ?? ""
1094
1152
  },
1095
- onClose: () => v(!1),
1153
+ onClose: () => g(!1),
1096
1154
  onSaved: (C) => {
1097
1155
  U({
1098
1156
  displayName: C.displayName,
1099
1157
  description: C.description
1100
- }), v(!1);
1158
+ }), g(!1);
1101
1159
  }
1102
1160
  }
1103
1161
  ),
1104
1162
  /* @__PURE__ */ e(
1105
- Re,
1163
+ xe,
1106
1164
  {
1107
1165
  open: B,
1108
1166
  onClose: () => W(!1),
1109
1167
  title: `JSON — ${A}`,
1110
1168
  mode: "disconnected",
1111
- value: _,
1169
+ value: V,
1112
1170
  onChange: Q,
1113
- guard: (C) => me(C, T).blockedReason,
1114
- onSave: () => void x(),
1171
+ guard: (C) => me(C, K).blockedReason,
1172
+ onSave: () => void T(),
1115
1173
  saving: S.saving,
1116
1174
  error: R,
1117
1175
  editorLabel: "Endpoint definition JSON"
@@ -1121,131 +1179,131 @@ function Gn(t) {
1121
1179
  }
1122
1180
  ) });
1123
1181
  }
1124
- const Xn = () => {
1125
- }, Pe = (t) => t instanceof Error ? t.message : String(t);
1126
- function Ft(t) {
1127
- const { functionId: s, onNavigate: a = Xn, slots: m, tools: c } = t, n = ke(t.project);
1182
+ const rt = () => {
1183
+ }, Be = (t) => t instanceof Error ? t.message : String(t);
1184
+ function Mt(t) {
1185
+ const { functionId: i, onNavigate: a = rt, slots: h, tools: d } = t, n = ke(t.project);
1128
1186
  return /* @__PURE__ */ e(
1129
1187
  "div",
1130
1188
  {
1131
1189
  className: "w6w-embed-root",
1132
1190
  style: { display: "flex", width: "100%", height: "100%", minHeight: 0 },
1133
1191
  children: /* @__PURE__ */ e(
1134
- Be,
1192
+ Re,
1135
1193
  {
1136
1194
  project: n,
1137
1195
  onNavigate: a,
1138
1196
  rail: t.rail,
1139
- tools: c,
1197
+ tools: d,
1140
1198
  storageKey: n === null ? null : `w6w.rail.embed.${n}`,
1141
- children: /* @__PURE__ */ e(Zn, { functionId: s, onNavigate: a, slots: m })
1199
+ children: /* @__PURE__ */ e(lt, { functionId: i, onNavigate: a, slots: h })
1142
1200
  }
1143
1201
  )
1144
1202
  }
1145
1203
  );
1146
1204
  }
1147
- function Zn(t) {
1148
- const s = gn({ id: t.functionId });
1149
- return /* @__PURE__ */ e(et, { ...t, draft: s }, t.functionId);
1205
+ function lt(t) {
1206
+ const i = Sn({ id: t.functionId });
1207
+ return /* @__PURE__ */ e(dt, { ...t, draft: i }, t.functionId);
1150
1208
  }
1151
- function et(t) {
1209
+ function dt(t) {
1152
1210
  var M;
1153
- const { functionId: s, draft: a, onNavigate: m, slots: c } = t, n = a.definition, d = (n == null ? void 0 : n.inputs) ?? [], g = ((M = Me(s).data) == null ? void 0 : M.valid) === !0, N = a.loadError, h = n ? Ee(n.impl) : void 0, y = Ge({
1211
+ const { functionId: i, draft: a, onNavigate: h, slots: d } = t, n = a.definition, c = (n == null ? void 0 : n.inputs) ?? [], v = ((M = je(i).data) == null ? void 0 : M.valid) === !0, N = a.loadError, m = n ? Ie(n.impl) : void 0, y = Ze({
1154
1212
  kind: "function",
1155
- id: s,
1156
- uses: (h == null ? void 0 : h.kind) === "action" ? h.uses : void 0,
1213
+ id: i,
1214
+ uses: (m == null ? void 0 : m.kind) === "action" ? m.uses : void 0,
1157
1215
  dirty: a.dirty
1158
- }), i = N instanceof pe && N.status === 404, [P, u] = w(!1), [r, v] = w(null), [F, b] = w(!1), [B, W] = w(!1), _ = ((n == null ? void 0 : n.key) ?? "").trim() || Mn((n == null ? void 0 : n.displayName) ?? "");
1159
- Oe({
1216
+ }), s = N instanceof ye && N.status === 404, [P, u] = b(!1), [r, g] = b(null), [F, k] = b(!1), [B, W] = b(!1), V = ((n == null ? void 0 : n.key) ?? "").trim() || $n((n == null ? void 0 : n.displayName) ?? "");
1217
+ Ae({
1160
1218
  kind: "function",
1161
- id: s,
1219
+ id: i,
1162
1220
  label: (n == null ? void 0 : n.displayName) || void 0,
1163
- key: _ || void 0,
1164
- inputs: d.filter((p) => !!p.key).map((p) => ({ key: p.key, required: p.required === !0 })),
1221
+ key: V || void 0,
1222
+ inputs: c.filter((p) => !!p.key).map((p) => ({ key: p.key, required: p.required === !0 })),
1165
1223
  policy: a.policy,
1166
1224
  onPolicyChange: a.onPolicyChange
1167
1225
  });
1168
- const Q = (p) => a.setDefinition((A) => ({ ...A, ...p })), [T, se] = w([]), R = X(!1), $ = X(!1);
1169
- ce(() => {
1226
+ const Q = (p) => a.setDefinition((A) => ({ ...A, ...p })), [K, oe] = b([]), R = _(!1), $ = _(!1);
1227
+ se(() => {
1170
1228
  if (R.current) {
1171
- if (!Qe({ rows: d, touched: $.current })) {
1229
+ if (!We({ rows: c, touched: $.current })) {
1172
1230
  R.current = !1;
1173
1231
  return;
1174
1232
  }
1175
- T.length !== 0 && (Q({ inputs: Ue(d, T) }), R.current = !1);
1233
+ K.length !== 0 && (Q({ inputs: Qe(c, K) }), R.current = !1);
1176
1234
  }
1177
- }, [T]);
1178
- const oe = L(
1179
- () => qe(d, T),
1180
- [d, T]
1235
+ }, [K]);
1236
+ const re = L(
1237
+ () => Ue(c, K),
1238
+ [c, K]
1181
1239
  ), S = L(
1182
- () => ({ inputs: d.map((p) => p.key).filter(Boolean) }),
1183
- [d]
1240
+ () => ({ inputs: c.map((p) => p.key).filter(Boolean) }),
1241
+ [c]
1184
1242
  );
1185
1243
  function f(p) {
1186
- R.current = !0, Q({ impl: Rn(n == null ? void 0 : n.impl, p) });
1244
+ R.current = !0, Q({ impl: On(n == null ? void 0 : n.impl, p) });
1187
1245
  }
1188
- const D = L(
1189
- () => Bn({ impl: n == null ? void 0 : n.impl, fields: T }),
1190
- [n == null ? void 0 : n.impl, T]
1191
- ), V = !!_ && D.length === 0 && a.canSave;
1192
- function Y() {
1246
+ const x = L(
1247
+ () => An({ impl: n == null ? void 0 : n.impl, fields: K }),
1248
+ [n == null ? void 0 : n.impl, K]
1249
+ ), Y = !!V && x.length === 0 && a.canSave;
1250
+ function z() {
1193
1251
  return {
1194
1252
  ...n,
1195
- key: _,
1196
- inputs: Le(d, { emptyMeansPassthrough: !1 })
1253
+ key: V,
1254
+ inputs: Je(c, { emptyMeansPassthrough: !1 })
1197
1255
  };
1198
1256
  }
1199
1257
  async function Z() {
1200
- v(null), b(!1);
1201
- const p = await a.commit(Y());
1202
- p.status === "saved" || p.status === "clean" ? b(!0) : p.status === "blocked" && v(p.reason);
1258
+ g(null), k(!1);
1259
+ const p = await a.commit(z());
1260
+ p.status === "saved" || p.status === "clean" ? k(!0) : p.status === "blocked" && g(p.reason);
1203
1261
  }
1204
1262
  async function O() {
1205
- return a.dirty ? V ? a.commit(Y()) : {
1263
+ return a.dirty ? Y ? a.commit(z()) : {
1206
1264
  status: "blocked",
1207
1265
  reason: "Fix the highlighted problems, then save, to test this Function."
1208
1266
  } : { status: "clean" };
1209
1267
  }
1210
- const [G, U] = w(!1), [ee, ne] = w(""), [te, ae] = w({ id: s, key: "" }), [z, q] = w(null);
1211
- function re() {
1212
- const p = Y();
1268
+ const [X, U] = b(!1), [ee, ne] = b(""), [te, ae] = b({ id: i, key: "" }), [G, q] = b(null);
1269
+ function le() {
1270
+ const p = z();
1213
1271
  ne(JSON.stringify(p, null, 2)), ae({ id: String(p.id), key: String(p.key) }), q(null), U(!0);
1214
1272
  }
1215
1273
  async function l() {
1216
1274
  const p = me(ee, te);
1217
1275
  if (!p.parsed || p.blockedReason) return;
1218
- b(!1);
1276
+ k(!1);
1219
1277
  const A = await a.commit(p.parsed);
1220
- A.status === "saved" || A.status === "clean" ? (q(null), U(!1), b(!0)) : A.status === "blocked" ? q(A.reason) : A.status === "failed" && q(Pe(A.error));
1278
+ A.status === "saved" || A.status === "clean" ? (q(null), U(!1), k(!0)) : A.status === "blocked" ? q(A.reason) : A.status === "failed" && q(Be(A.error));
1221
1279
  }
1222
1280
  const E = he(async () => {
1223
1281
  W(!0);
1224
1282
  try {
1225
- await a.reload(), v(null), b(!1);
1283
+ await a.reload(), g(null), k(!1);
1226
1284
  } finally {
1227
1285
  W(!1);
1228
1286
  }
1229
- }, [a.reload]), k = a.stale ? null : a.error ?? N, J = r ?? (k === null ? null : Pe(k)), x = (n == null ? void 0 : n.displayName) || (n == null ? void 0 : n.key) || "New function";
1230
- return a.loading || n === null && N === null ? /* @__PURE__ */ e("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ e("div", { style: { flex: 1, minWidth: 0, overflow: "auto" }, children: /* @__PURE__ */ e(xe, { value: S, children: /* @__PURE__ */ e(
1231
- Ye,
1287
+ }, [a.reload]), w = a.stale ? null : a.error ?? N, J = r ?? (w === null ? null : Be(w)), T = (n == null ? void 0 : n.displayName) || (n == null ? void 0 : n.key) || "New function";
1288
+ return a.loading || n === null && N === null ? /* @__PURE__ */ e("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ e("div", { style: { flex: 1, minWidth: 0, overflow: "auto" }, children: /* @__PURE__ */ e(Te, { value: S, children: /* @__PURE__ */ e(
1289
+ Ge,
1232
1290
  {
1233
1291
  kind: "function",
1234
- title: x,
1235
- incomplete: n !== null && !g,
1236
- canSave: V,
1292
+ title: T,
1293
+ incomplete: n !== null && !v,
1294
+ canSave: Y,
1237
1295
  isSaving: a.saving,
1238
1296
  onSave: () => void Z(),
1239
1297
  error: J,
1240
- notFound: i,
1241
- onNavigate: m,
1242
- slots: c,
1243
- publish: { id: s, saveFirst: O, disabled: !V || !g },
1244
- headerActions: n && /* @__PURE__ */ o(K, { children: [
1245
- /* @__PURE__ */ e(De, { kind: "function", id: s }),
1246
- /* @__PURE__ */ e(Ke, { onClick: re })
1298
+ notFound: s,
1299
+ onNavigate: h,
1300
+ slots: d,
1301
+ publish: { id: i, saveFirst: O, disabled: !Y || !v },
1302
+ headerActions: n && /* @__PURE__ */ o(D, { children: [
1303
+ /* @__PURE__ */ e(Ye, { kind: "function", id: i }),
1304
+ /* @__PURE__ */ e(De, { onClick: le })
1247
1305
  ] }),
1248
- banners: /* @__PURE__ */ o(K, { children: [
1306
+ banners: /* @__PURE__ */ o(D, { children: [
1249
1307
  y,
1250
1308
  a.stale && /* @__PURE__ */ o("div", { className: "error", role: "alert", "data-testid": "save-stale", children: [
1251
1309
  /* @__PURE__ */ e("p", { children: "This function changed on the server after you opened it. Your save was refused, so their work is intact." }),
@@ -1255,24 +1313,24 @@ function et(t) {
1255
1313
  /* @__PURE__ */ e("p", { children: "This function was changed elsewhere. Reloading replaces your unsaved edits with the saved copy." }),
1256
1314
  /* @__PURE__ */ e("button", { type: "button", className: "btn ghost", disabled: B, onClick: E, children: B ? "Reloading…" : "Reload from server" })
1257
1315
  ] }),
1258
- D.length > 0 && /* @__PURE__ */ o("p", { className: "error small", "data-testid": "save-blocked", children: [
1316
+ x.length > 0 && /* @__PURE__ */ o("p", { className: "error small", "data-testid": "save-blocked", children: [
1259
1317
  "Can’t save yet — map ",
1260
- D.length > 1 ? "these" : "this",
1318
+ x.length > 1 ? "these" : "this",
1261
1319
  " required action",
1262
1320
  " ",
1263
- D.length > 1 ? "params" : "param",
1321
+ x.length > 1 ? "params" : "param",
1264
1322
  " under Input mapping above:",
1265
1323
  " ",
1266
- /* @__PURE__ */ e("strong", { children: D.join(", ") })
1324
+ /* @__PURE__ */ e("strong", { children: x.join(", ") })
1267
1325
  ] }),
1268
1326
  F && /* @__PURE__ */ e("span", { className: "ok", children: "Saved." })
1269
1327
  ] }),
1270
- children: n && /* @__PURE__ */ o(K, { children: [
1328
+ children: n && /* @__PURE__ */ o(D, { children: [
1271
1329
  /* @__PURE__ */ o("div", { className: "card", children: [
1272
1330
  /* @__PURE__ */ o("div", { className: "section-head", children: [
1273
1331
  /* @__PURE__ */ e("h3", { children: "Interface" }),
1274
1332
  /* @__PURE__ */ e(
1275
- be,
1333
+ pe,
1276
1334
  {
1277
1335
  icon: "edit-2",
1278
1336
  label: "Edit name, key, and description",
@@ -1294,46 +1352,46 @@ function et(t) {
1294
1352
  ] })
1295
1353
  ] }),
1296
1354
  /* @__PURE__ */ e(
1297
- ze,
1355
+ Xe,
1298
1356
  {
1299
1357
  title: "Inputs",
1300
1358
  description: "The canonical, vendor-stable interface a caller binds to. Reuses core Param fields.",
1301
1359
  emptyMeansPassthrough: !1,
1302
- rows: d,
1360
+ rows: c,
1303
1361
  onChange: (p) => {
1304
1362
  $.current = !0, Q({ inputs: p });
1305
1363
  },
1306
- uncoveredKeys: oe
1364
+ uncoveredKeys: re
1307
1365
  }
1308
1366
  ),
1309
1367
  /* @__PURE__ */ e(
1310
- Xe,
1368
+ en,
1311
1369
  {
1312
1370
  allowedKinds: ["action", "function", "workflow"],
1313
- excludeCallableIds: [s],
1371
+ excludeCallableIds: [i],
1314
1372
  title: "Implementation",
1315
- description: /* @__PURE__ */ o(K, { children: [
1373
+ description: /* @__PURE__ */ o(D, { children: [
1316
1374
  'Bind the interface to one concrete app action, another Function, or a Workflow. Switching the provider here (a "re-bind") rewrites only ',
1317
1375
  /* @__PURE__ */ e("code", { children: "impl" }),
1318
1376
  "'s target fields - the interface above, and every caller, is untouched."
1319
1377
  ] }),
1320
- value: Ee(n.impl),
1378
+ value: Ie(n.impl),
1321
1379
  onChange: f,
1322
- onResolved: (p) => se(p.fields)
1380
+ onResolved: (p) => oe(p.fields)
1323
1381
  }
1324
1382
  ),
1325
1383
  /* @__PURE__ */ e(
1326
- nt,
1384
+ ct,
1327
1385
  {
1328
- id: s,
1329
- inputs: d,
1330
- disabled: !g,
1331
- invalid: !g,
1386
+ id: i,
1387
+ inputs: c,
1388
+ disabled: !v,
1389
+ invalid: !v,
1332
1390
  saveFirst: O
1333
1391
  }
1334
1392
  ),
1335
1393
  P && /* @__PURE__ */ e(
1336
- kn,
1394
+ In,
1337
1395
  {
1338
1396
  initial: {
1339
1397
  key: n.key,
@@ -1347,18 +1405,18 @@ function et(t) {
1347
1405
  }
1348
1406
  ),
1349
1407
  /* @__PURE__ */ e(
1350
- Re,
1408
+ xe,
1351
1409
  {
1352
- open: G,
1410
+ open: X,
1353
1411
  onClose: () => U(!1),
1354
- title: `JSON — ${x}`,
1412
+ title: `JSON — ${T}`,
1355
1413
  mode: "disconnected",
1356
1414
  value: ee,
1357
1415
  onChange: ne,
1358
1416
  guard: (p) => me(p, te).blockedReason,
1359
1417
  onSave: () => void l(),
1360
1418
  saving: a.saving,
1361
- error: z,
1419
+ error: G,
1362
1420
  editorLabel: "Function definition JSON"
1363
1421
  }
1364
1422
  )
@@ -1366,31 +1424,31 @@ function et(t) {
1366
1424
  }
1367
1425
  ) }) });
1368
1426
  }
1369
- function nt(t) {
1370
- const { id: s, inputs: a } = t, [m, c] = w({}), [n, d] = w(void 0), [I, g] = w(null), [N, h] = w(!1), y = we(), i = Sn();
1427
+ function ct(t) {
1428
+ const { id: i, inputs: a } = t, [h, d] = b({}), [n, c] = b(void 0), [I, v] = b(null), [N, m] = b(!1), y = we(), s = Rn();
1371
1429
  async function P() {
1372
1430
  const u = {};
1373
1431
  for (const r of a) {
1374
- const v = We(r.type, m[r.key] ?? "");
1375
- v !== void 0 && (u[r.key] = v);
1432
+ const g = Le(r.type, h[r.key] ?? "");
1433
+ g !== void 0 && (u[r.key] = g);
1376
1434
  }
1377
- h(!0);
1435
+ m(!0);
1378
1436
  try {
1379
1437
  const r = await t.saveFirst();
1380
1438
  if (r.status === "blocked") {
1381
- d(void 0), g(r.reason);
1439
+ c(void 0), v(r.reason);
1382
1440
  return;
1383
1441
  }
1384
1442
  if (r.status === "failed") {
1385
- d(void 0), g(fe(r.error));
1443
+ c(void 0), v(fe(r.error));
1386
1444
  return;
1387
1445
  }
1388
- const v = await i.mutateAsync({ id: s, inputs: u });
1389
- g(null), d(v);
1446
+ const g = await s.mutateAsync({ id: i, inputs: u });
1447
+ v(null), c(g);
1390
1448
  } catch (r) {
1391
- d(void 0), g(fe(r));
1449
+ c(void 0), v(fe(r));
1392
1450
  } finally {
1393
- h(!1), y.invalidateQueries({ queryKey: Ae.root });
1451
+ m(!1), y.invalidateQueries({ queryKey: $e.root });
1394
1452
  }
1395
1453
  }
1396
1454
  return /* @__PURE__ */ o("div", { className: "card", children: [
@@ -1409,8 +1467,8 @@ function nt(t) {
1409
1467
  "select",
1410
1468
  {
1411
1469
  id: r,
1412
- value: m[u.key] ?? "",
1413
- onChange: (v) => c((F) => ({ ...F, [u.key]: v.target.value })),
1470
+ value: h[u.key] ?? "",
1471
+ onChange: (g) => d((F) => ({ ...F, [u.key]: g.target.value })),
1414
1472
  children: [
1415
1473
  /* @__PURE__ */ e("option", { value: "", children: "—" }),
1416
1474
  /* @__PURE__ */ e("option", { value: "true", children: "true" }),
@@ -1422,9 +1480,9 @@ function nt(t) {
1422
1480
  {
1423
1481
  id: r,
1424
1482
  type: u.type === "number" ? "number" : "text",
1425
- value: m[u.key] ?? "",
1483
+ value: h[u.key] ?? "",
1426
1484
  placeholder: u.type === "json" ? "{ }" : u.hint ?? "",
1427
- onChange: (v) => c((F) => ({ ...F, [u.key]: v.target.value }))
1485
+ onChange: (g) => d((F) => ({ ...F, [u.key]: g.target.value }))
1428
1486
  }
1429
1487
  )
1430
1488
  ] }, u.key || u.label);
@@ -1434,13 +1492,13 @@ function nt(t) {
1434
1492
  {
1435
1493
  type: "button",
1436
1494
  className: "btn",
1437
- disabled: t.disabled || N || i.isPending,
1495
+ disabled: t.disabled || N || s.isPending,
1438
1496
  onClick: () => void P(),
1439
- children: N || i.isPending ? "Invoking…" : "Invoke"
1497
+ children: N || s.isPending ? "Invoking…" : "Invoke"
1440
1498
  }
1441
1499
  ) }),
1442
1500
  I && /* @__PURE__ */ e("div", { className: "result error", children: I }),
1443
- n !== void 0 && /* @__PURE__ */ o(K, { children: [
1501
+ n !== void 0 && /* @__PURE__ */ o(D, { children: [
1444
1502
  n.invocationId && /* @__PURE__ */ o("p", { className: "muted small", children: [
1445
1503
  n.status ?? "done",
1446
1504
  n.durationMs !== void 0 ? ` · ${n.durationMs} ms` : "",
@@ -1452,9 +1510,9 @@ function nt(t) {
1452
1510
  ] });
1453
1511
  }
1454
1512
  export {
1455
- Et as DocumentEditor,
1456
- It as EndpointEditor,
1457
- Ft as FunctionEditor,
1458
- Rt as WorkflowEditor
1513
+ Ot as DocumentEditor,
1514
+ jt as EndpointEditor,
1515
+ Mt as FunctionEditor,
1516
+ Wt as WorkflowEditor
1459
1517
  };
1460
1518
  //# sourceMappingURL=editors.mjs.map