@w6w/embed 0.2.1 → 0.2.19

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