@burdenoff/microfe-bigconsole 2026.1012.6 → 2026.1012.8

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.
@@ -1,23 +1,23 @@
1
1
  import { Section as e, SectionStack as t } from "../components/common/Section.js";
2
2
  import "../components/common/index.js";
3
3
  import n from "../components/widgets/WidgetErrorBoundary.js";
4
- import ee from "../renderers/adapters/BigConsoleRenderer.js";
5
- import { PROPOSABLE_WIDGET_TYPES as te, derivePreviewState as r, validateProposal as i } from "./proposalContract.js";
6
- import { localProposalSource as ne } from "./proposalSource.js";
7
- import { memo as a, useCallback as o, useEffect as re, useMemo as s, useState as c } from "react";
8
- import { AlertTriangle as l, Check as u, Loader2 as d, RefreshCw as ie, Sparkles as ae, X as oe } from "lucide-react";
9
- import { Button as f, Input as p, Label as m, Textarea as se } from "@burdenoff/fe-libs/ui";
10
- import { useI18n as ce } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
11
- import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
4
+ import r from "../renderers/adapters/BigConsoleRenderer.js";
5
+ import { PROPOSABLE_WIDGET_TYPES as ee, derivePreviewState as i, isProposableWidgetType as a, validateProposal as o } from "./proposalContract.js";
6
+ import { changeProposalWidgetType as s, localProposalSource as c } from "./proposalSource.js";
7
+ import { memo as l, useCallback as u, useEffect as d, useMemo as f, useState as p } from "react";
8
+ import { AlertTriangle as m, Check as h, Loader2 as g, RefreshCw as te, Sparkles as ne, X as _ } from "lucide-react";
9
+ import { Button as v, Input as y, Label as b, Textarea as re } from "@burdenoff/fe-libs/ui";
10
+ import { useI18n as ie } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
11
+ import { Fragment as ae, jsx as x, jsxs as S } from "react/jsx-runtime";
12
12
  //#region src/bigconsole/customWidget/CustomWidgetProposalPanel.tsx
13
- var v = "w-full", y = {
13
+ var oe = "w-full", se = {
14
14
  loading: "neutral",
15
15
  valid: "neutral",
16
16
  "no-data": "warning",
17
17
  "field-mismatch": "warning",
18
18
  "access-error": "danger"
19
19
  };
20
- function b(e, t) {
20
+ function ce(e, t) {
21
21
  let n = (/* @__PURE__ */ new Date(0)).toISOString();
22
22
  return {
23
23
  id: `preview-${e.id}`,
@@ -45,14 +45,14 @@ function b(e, t) {
45
45
  updatedAt: n
46
46
  };
47
47
  }
48
- function x(e) {
48
+ function le(e) {
49
49
  if (Array.isArray(e)) {
50
50
  let t = e.find((e) => e && typeof e == "object");
51
51
  return t ? Object.keys(t) : [];
52
52
  }
53
53
  if (e && typeof e == "object") return Object.keys(e);
54
54
  }
55
- function S(e) {
55
+ function C(e) {
56
56
  if (Array.isArray(e)) return e.length;
57
57
  if (e && typeof e == "object") {
58
58
  let t = e.cells;
@@ -60,247 +60,247 @@ function S(e) {
60
60
  }
61
61
  return 0;
62
62
  }
63
- var C = a(function({ sinks: a, parsers: C, resolvePreviewData: w, onApprove: T, onClose: E, source: D = ne }) {
64
- let { t: O } = ce(), k = s(() => ({
63
+ var w = l(function({ sinks: l, parsers: w, resolvePreviewData: T, onApprove: E, onClose: D, source: O = c }) {
64
+ let { t: k } = ie(), A = f(() => ({
65
65
  loading: {
66
- title: O("bigconsole.widget.customWidget.preview.loading.title", "Building preview…"),
67
- body: O("bigconsole.widget.customWidget.preview.loading.body", "Reading the selected data binding.")
66
+ title: k("bigconsole.widget.customWidget.preview.loading.title", "Building preview…"),
67
+ body: k("bigconsole.widget.customWidget.preview.loading.body", "Reading the selected data binding.")
68
68
  },
69
69
  valid: {
70
- title: O("bigconsole.widget.customWidget.preview.valid.title", "Preview"),
70
+ title: k("bigconsole.widget.customWidget.preview.valid.title", "Preview"),
71
71
  body: ""
72
72
  },
73
73
  "no-data": {
74
- title: O("bigconsole.widget.customWidget.preview.noData.title", "No data returned"),
75
- body: O("bigconsole.widget.customWidget.preview.noData.body", "The binding is valid but the data source returned no rows. The widget will render empty until the sink has data.")
74
+ title: k("bigconsole.widget.customWidget.preview.noData.title", "No data returned"),
75
+ body: k("bigconsole.widget.customWidget.preview.noData.body", "The binding is valid but the data source returned no rows. The widget will render empty until the sink has data.")
76
76
  },
77
77
  "field-mismatch": {
78
- title: O("bigconsole.widget.customWidget.preview.fieldMismatch.title", "Field mismatch"),
79
- body: O("bigconsole.widget.customWidget.preview.fieldMismatch.body", "Some mapped fields are not present in the parser output. Fix the mapping below before approving.")
78
+ title: k("bigconsole.widget.customWidget.preview.fieldMismatch.title", "Field mismatch"),
79
+ body: k("bigconsole.widget.customWidget.preview.fieldMismatch.body", "Some mapped fields are not present in the parser output. Fix the mapping below before approving.")
80
80
  },
81
81
  "access-error": {
82
- title: O("bigconsole.widget.customWidget.preview.accessError.title", "Cannot read this data"),
83
- body: O("bigconsole.widget.customWidget.preview.accessError.body", "You do not have access to the proposed DataSink or parser in this workspace.")
82
+ title: k("bigconsole.widget.customWidget.preview.accessError.title", "Cannot read this data"),
83
+ body: k("bigconsole.widget.customWidget.preview.accessError.body", "You do not have access to the proposed DataSink or parser in this workspace.")
84
84
  }
85
- }), [O]), [A, le] = c(""), [j, M] = c(null), [N, P] = c(!1), [F, I] = c(!1), [L, R] = c(null), [z, B] = c(void 0), [V, H] = c(!1), [U, W] = c(!1), G = s(() => a.map((e) => e.id), [a]), K = s(() => C.map((e) => e.id), [C]), q = s(() => x(z), [z]), J = s(() => j ? i(j, {
86
- permittedDataSinkIds: G,
87
- permittedParserIds: K,
88
- availableFields: q
85
+ }), [k]), [j, ue] = p(""), [M, N] = p(null), [P, F] = p(!1), [I, L] = p(!1), [R, z] = p(null), [B, V] = p(void 0), [H, U] = p(!1), [W, G] = p(!1), K = f(() => l.map((e) => e.id), [l]), q = f(() => w.map((e) => e.id), [w]), J = f(() => le(B), [B]), Y = f(() => M ? o(M, {
86
+ permittedDataSinkIds: K,
87
+ permittedParserIds: q,
88
+ availableFields: J
89
89
  }) : {
90
90
  issues: [],
91
91
  canApprove: !1
92
92
  }, [
93
- j,
94
- G,
93
+ M,
95
94
  K,
96
- q
97
- ]), Y = s(() => r(J, {
98
- loading: V,
99
- accessError: U,
100
- rowCount: S(z)
95
+ q,
96
+ J
97
+ ]), X = f(() => i(Y, {
98
+ loading: H,
99
+ accessError: W,
100
+ rowCount: C(B)
101
101
  }), [
102
- J,
103
- V,
104
- U,
105
- z
102
+ Y,
103
+ H,
104
+ W,
105
+ B
106
106
  ]);
107
- re(() => {
108
- if (!j || !j.binding.dataSinkId) {
109
- B(void 0);
107
+ d(() => {
108
+ if (!M || !M.binding.dataSinkId) {
109
+ V(void 0);
110
110
  return;
111
111
  }
112
112
  let e = !1;
113
- return H(!0), W(!1), w(j).then((t) => {
114
- e || B(t);
113
+ return U(!0), G(!1), T(M).then((t) => {
114
+ e || V(t);
115
115
  }).catch(() => {
116
- e || (B(void 0), W(!0));
116
+ e || (V(void 0), G(!0));
117
117
  }).finally(() => {
118
- e || H(!1);
118
+ e || U(!1);
119
119
  }), () => {
120
120
  e = !0;
121
121
  };
122
- }, [j ? `${j.binding.dataSinkId}|${j.binding.parserId ?? ""}|${j.binding.dataPath ?? ""}` : "", w]);
123
- let ue = o(async () => {
124
- if (A.trim()) {
125
- P(!0), R(null);
122
+ }, [M ? `${M.binding.dataSinkId}|${M.binding.parserId ?? ""}|${M.binding.dataPath ?? ""}` : "", T]);
123
+ let de = u(async () => {
124
+ if (j.trim()) {
125
+ F(!0), z(null);
126
126
  try {
127
- M(await D.propose({
128
- prompt: A.trim(),
129
- sinks: a,
130
- parsers: C
127
+ N(await O.propose({
128
+ prompt: j.trim(),
129
+ sinks: l,
130
+ parsers: w
131
131
  }));
132
132
  } finally {
133
- P(!1);
133
+ F(!1);
134
134
  }
135
135
  }
136
136
  }, [
137
- A,
138
- D,
139
- a,
140
- C
141
- ]), X = o((e) => {
142
- M((t) => t && e(t));
143
- }, []), de = o(() => {
144
- M(null), B(void 0), W(!1), R(null);
145
- }, []), Z = o(async () => {
146
- if (!(!j || !J.canApprove || V || U)) {
147
- I(!0), R(null);
137
+ j,
138
+ O,
139
+ l,
140
+ w
141
+ ]), Z = u((e) => {
142
+ N((t) => t && e(t));
143
+ }, []), fe = u(() => {
144
+ N(null), V(void 0), G(!1), z(null);
145
+ }, []), pe = u(async () => {
146
+ if (!(!M || !Y.canApprove || H || W)) {
147
+ L(!0), z(null);
148
148
  try {
149
- await T(j), E();
149
+ await E(M), D();
150
150
  } catch (e) {
151
- R(e instanceof Error ? e.message : O("bigconsole.widget.customWidget.error.couldNotSaveWidget", "Could not save the widget."));
151
+ z(e instanceof Error ? e.message : k("bigconsole.widget.customWidget.error.couldNotSaveWidget", "Could not save the widget."));
152
152
  } finally {
153
- I(!1);
153
+ L(!1);
154
154
  }
155
155
  }
156
156
  }, [
157
- j,
158
- J.canApprove,
159
- V,
160
- U,
161
- T,
157
+ M,
158
+ Y.canApprove,
159
+ H,
160
+ W,
162
161
  E,
163
- O
164
- ]), Q = J.issues.filter((e) => e.severity === "error"), $ = J.issues.filter((e) => e.severity === "warning");
165
- return /* @__PURE__ */ g("section", {
162
+ D,
163
+ k
164
+ ]), Q = Y.issues.filter((e) => e.severity === "error"), $ = Y.issues.filter((e) => e.severity === "warning");
165
+ return /* @__PURE__ */ x("section", {
166
166
  "data-testid": "custom-widget-proposal-panel",
167
- "aria-label": O("bigconsole.widget.customWidget.panel.ariaLabel", "AI custom widget builder"),
167
+ "aria-label": k("bigconsole.widget.customWidget.panel.ariaLabel", "AI custom widget builder"),
168
168
  className: "flex h-full w-full min-w-0 flex-col overflow-y-auto p-4",
169
- children: /* @__PURE__ */ _(t, { children: [/* @__PURE__ */ g(e, {
170
- title: O("bigconsole.widget.customWidget.prompt.label", "Describe the widget you need"),
169
+ children: /* @__PURE__ */ S(t, { children: [/* @__PURE__ */ x(e, {
170
+ title: k("bigconsole.widget.customWidget.prompt.label", "Describe the widget you need"),
171
171
  description: "Plain English. The assistant proposes a typed widget you can edit before anything is saved.",
172
- icon: /* @__PURE__ */ g(ae, {
172
+ icon: /* @__PURE__ */ x(ne, {
173
173
  className: "size-4",
174
174
  "aria-hidden": "true"
175
175
  }),
176
- actions: /* @__PURE__ */ _("div", {
176
+ actions: /* @__PURE__ */ S("div", {
177
177
  className: "flex flex-wrap gap-2",
178
- children: [/* @__PURE__ */ _(f, {
178
+ children: [/* @__PURE__ */ S(v, {
179
179
  "data-testid": "custom-widget-generate",
180
- onClick: ue,
181
- disabled: !A.trim() || N,
182
- children: [N ? /* @__PURE__ */ g(d, {
180
+ onClick: de,
181
+ disabled: !j.trim() || P,
182
+ children: [P ? /* @__PURE__ */ x(g, {
183
183
  className: "mr-2 size-4 animate-spin",
184
184
  "aria-hidden": "true"
185
- }) : null, j ? O("bigconsole.widget.customWidget.action.regenerate", "Regenerate") : O("bigconsole.widget.customWidget.action.generateProposal", "Generate proposal")]
186
- }), j ? /* @__PURE__ */ _(f, {
185
+ }) : null, M ? k("bigconsole.widget.customWidget.action.regenerate", "Regenerate") : k("bigconsole.widget.customWidget.action.generateProposal", "Generate proposal")]
186
+ }), M ? /* @__PURE__ */ S(v, {
187
187
  variant: "outline",
188
188
  "data-testid": "custom-widget-reject",
189
- onClick: de,
190
- children: [/* @__PURE__ */ g(oe, {
189
+ onClick: fe,
190
+ children: [/* @__PURE__ */ x(_, {
191
191
  className: "mr-1 size-4",
192
192
  "aria-hidden": "true"
193
- }), O("bigconsole.widget.customWidget.action.reject", "Reject")]
193
+ }), k("bigconsole.widget.customWidget.action.reject", "Reject")]
194
194
  }) : null]
195
195
  }),
196
- children: /* @__PURE__ */ _("div", {
196
+ children: /* @__PURE__ */ S("div", {
197
197
  className: "flex flex-col gap-2",
198
- children: [/* @__PURE__ */ g(m, {
198
+ children: [/* @__PURE__ */ x(b, {
199
199
  htmlFor: "custom-widget-prompt",
200
200
  children: "What should it show?"
201
- }), /* @__PURE__ */ g(se, {
201
+ }), /* @__PURE__ */ x(re, {
202
202
  id: "custom-widget-prompt",
203
203
  "data-testid": "custom-widget-prompt",
204
- value: A,
205
- onChange: (e) => le(e.target.value),
206
- placeholder: O("bigconsole.widget.customWidget.prompt.placeholder", "e.g. a funnel of signup conversion stages"),
204
+ value: j,
205
+ onChange: (e) => ue(e.target.value),
206
+ placeholder: k("bigconsole.widget.customWidget.prompt.placeholder", "e.g. a funnel of signup conversion stages"),
207
207
  rows: 3
208
208
  })]
209
209
  })
210
- }), j ? /* @__PURE__ */ _(h, { children: [
211
- /* @__PURE__ */ _(e, {
210
+ }), M ? /* @__PURE__ */ S(ae, { children: [
211
+ /* @__PURE__ */ S(e, {
212
212
  emphasis: "primary",
213
- tone: y[Y],
214
- title: k[Y].title,
215
- description: j.binding.parserId ? O("bigconsole.widget.customWidget.preview.parserDescription", "Rendered using the saved parser output.") : O("bigconsole.widget.customWidget.preview.sourceDescription", "Rendered using up to 50 source rows. Full data may differ."),
216
- meta: /* @__PURE__ */ g("span", {
213
+ tone: se[X],
214
+ title: A[X].title,
215
+ description: M.binding.parserId ? k("bigconsole.widget.customWidget.preview.parserDescription", "Rendered using the saved parser output.") : k("bigconsole.widget.customWidget.preview.sourceDescription", "Rendered using up to 50 source rows. Full data may differ."),
216
+ meta: /* @__PURE__ */ x("span", {
217
217
  "data-testid": "custom-widget-preview-state",
218
- "data-state": Y,
218
+ "data-state": X,
219
219
  className: "rounded-pill bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary",
220
- children: Y
220
+ children: X
221
221
  }),
222
- children: [/* @__PURE__ */ g("div", {
222
+ children: [/* @__PURE__ */ x("div", {
223
223
  "data-testid": "custom-widget-preview",
224
224
  className: "min-h-[220px] min-w-0 rounded-card border border-[var(--color-border-subtle)] bg-bg-surface p-2",
225
- children: Y === "loading" ? /* @__PURE__ */ _("div", {
225
+ children: X === "loading" ? /* @__PURE__ */ S("div", {
226
226
  className: "flex h-[200px] items-center justify-center text-text-secondary",
227
- children: [/* @__PURE__ */ g(d, {
227
+ children: [/* @__PURE__ */ x(g, {
228
228
  className: "mr-2 size-4 animate-spin",
229
229
  "aria-hidden": "true"
230
- }), /* @__PURE__ */ g("span", {
230
+ }), /* @__PURE__ */ x("span", {
231
231
  className: "text-sm",
232
- children: k.loading.body
232
+ children: A.loading.body
233
233
  })]
234
- }) : Y === "valid" ? /* @__PURE__ */ g("div", {
234
+ }) : X === "valid" ? /* @__PURE__ */ x("div", {
235
235
  className: "h-[200px]",
236
- children: /* @__PURE__ */ g(n, {
237
- widgetId: `preview-${j.id}`,
238
- children: /* @__PURE__ */ g(ee, {
239
- widget: b(j, O("bigconsole.widget.customWidget.untitledWidget", "Untitled widget")),
240
- data: z
236
+ children: /* @__PURE__ */ x(n, {
237
+ widgetId: `preview-${M.id}`,
238
+ children: /* @__PURE__ */ x(r, {
239
+ widget: ce(M, k("bigconsole.widget.customWidget.untitledWidget", "Untitled widget")),
240
+ data: B
241
241
  })
242
242
  })
243
- }) : /* @__PURE__ */ _("div", {
243
+ }) : /* @__PURE__ */ S("div", {
244
244
  className: "flex h-[200px] flex-col items-center justify-center gap-2 px-4 text-center",
245
245
  children: [
246
- /* @__PURE__ */ g(l, {
246
+ /* @__PURE__ */ x(m, {
247
247
  className: "size-5 text-[var(--color-status-warning-text)]",
248
248
  "aria-hidden": "true"
249
249
  }),
250
- /* @__PURE__ */ g("p", {
250
+ /* @__PURE__ */ x("p", {
251
251
  className: "text-sm text-text-secondary",
252
- children: k[Y].body
252
+ children: A[X].body
253
253
  }),
254
- Y === "access-error" ? /* @__PURE__ */ _(f, {
254
+ X === "access-error" ? /* @__PURE__ */ S(v, {
255
255
  size: "sm",
256
256
  variant: "outline",
257
- onClick: () => X((e) => ({ ...e })),
258
- children: [/* @__PURE__ */ g(ie, {
257
+ onClick: () => Z((e) => ({ ...e })),
258
+ children: [/* @__PURE__ */ x(te, {
259
259
  className: "mr-1 size-3.5",
260
260
  "aria-hidden": "true"
261
- }), O("bigconsole.widget.customWidget.action.retry", "Retry")]
261
+ }), k("bigconsole.widget.customWidget.action.retry", "Retry")]
262
262
  }) : null
263
263
  ]
264
264
  })
265
- }), j.rationale ? /* @__PURE__ */ g("p", {
265
+ }), M.rationale ? /* @__PURE__ */ x("p", {
266
266
  className: "mt-2 text-xs text-text-secondary",
267
267
  "data-testid": "custom-widget-rationale",
268
- children: j.rationale
268
+ children: M.rationale
269
269
  }) : null]
270
270
  }),
271
- Q.length > 0 || $.length > 0 ? /* @__PURE__ */ g(e, {
271
+ Q.length > 0 || $.length > 0 ? /* @__PURE__ */ x(e, {
272
272
  tone: Q.length > 0 ? "danger" : "warning",
273
273
  padding: "compact",
274
274
  headingLevel: 3,
275
275
  title: Q.length > 0 ? `${Q.length} ${Q.length === 1 ? "problem" : "problems"} to fix before approving` : `${$.length} ${$.length === 1 ? "warning" : "warnings"}`,
276
- children: /* @__PURE__ */ g("ul", {
276
+ children: /* @__PURE__ */ x("ul", {
277
277
  "data-testid": "custom-widget-issues",
278
278
  className: "flex min-w-0 flex-col gap-1",
279
- children: [...Q, ...$].map((e) => /* @__PURE__ */ g("li", {
279
+ children: [...Q, ...$].map((e) => /* @__PURE__ */ x("li", {
280
280
  "data-severity": e.severity,
281
281
  className: `break-words text-xs ${e.severity === "error" ? "text-[var(--color-status-error-text)]" : "text-[var(--color-status-warning-text)]"}`,
282
282
  children: e.message
283
283
  }, `${e.code}-${e.path ?? ""}`))
284
284
  })
285
285
  }) : null,
286
- /* @__PURE__ */ g(e, {
287
- title: O("bigconsole.widget.customWidget.proposal.heading", "Proposal"),
286
+ /* @__PURE__ */ x(e, {
287
+ title: k("bigconsole.widget.customWidget.proposal.heading", "Proposal"),
288
288
  description: "Every field is editable — the assistant proposes, you dispose.",
289
289
  "data-testid": "custom-widget-proposal-fields",
290
- children: /* @__PURE__ */ _("div", {
290
+ children: /* @__PURE__ */ S("div", {
291
291
  className: "flex flex-col gap-3",
292
292
  children: [
293
- /* @__PURE__ */ _("div", {
293
+ /* @__PURE__ */ S("div", {
294
294
  className: "flex flex-col gap-1",
295
- children: [/* @__PURE__ */ g(m, {
295
+ children: [/* @__PURE__ */ x(b, {
296
296
  htmlFor: "custom-widget-title",
297
- children: O("bigconsole.widget.customWidget.field.title", "Title")
298
- }), /* @__PURE__ */ g(p, {
297
+ children: k("bigconsole.widget.customWidget.field.title", "Title")
298
+ }), /* @__PURE__ */ x(y, {
299
299
  id: "custom-widget-title",
300
300
  "data-testid": "custom-widget-title",
301
- className: v,
302
- value: j.presentation.title,
303
- onChange: (e) => X((t) => ({
301
+ className: oe,
302
+ value: M.presentation.title,
303
+ onChange: (e) => Z((t) => ({
304
304
  ...t,
305
305
  presentation: {
306
306
  ...t.presentation,
@@ -309,104 +309,106 @@ var C = a(function({ sinks: a, parsers: C, resolvePreviewData: w, onApprove: T,
309
309
  }))
310
310
  })]
311
311
  }),
312
- /* @__PURE__ */ _("div", {
312
+ /* @__PURE__ */ S("div", {
313
313
  className: "flex flex-col gap-1",
314
- children: [/* @__PURE__ */ g(m, {
314
+ children: [/* @__PURE__ */ x(b, {
315
315
  htmlFor: "custom-widget-type",
316
- children: O("bigconsole.widget.customWidget.field.widgetType", "Widget type")
317
- }), /* @__PURE__ */ g("select", {
316
+ children: k("bigconsole.widget.customWidget.field.widgetType", "Widget type")
317
+ }), /* @__PURE__ */ x("select", {
318
318
  id: "custom-widget-type",
319
319
  "data-testid": "custom-widget-type",
320
- value: j.widgetType,
321
- onChange: (e) => X((t) => ({
322
- ...t,
323
- widgetType: e.target.value
324
- })),
320
+ value: M.widgetType,
321
+ onChange: (e) => {
322
+ let t = e.target.value;
323
+ a(t) && Z((e) => s(e, t));
324
+ },
325
325
  className: "w-full rounded-md border border-[var(--color-border-default)] bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg",
326
- children: te.map((e) => /* @__PURE__ */ g("option", {
326
+ children: ee.map((e) => /* @__PURE__ */ x("option", {
327
327
  value: e,
328
328
  children: e
329
329
  }, e))
330
330
  })]
331
331
  }),
332
- /* @__PURE__ */ _("div", {
332
+ /* @__PURE__ */ S("div", {
333
333
  className: "flex flex-col gap-1",
334
- children: [/* @__PURE__ */ g(m, {
334
+ children: [/* @__PURE__ */ x(b, {
335
335
  htmlFor: "custom-widget-sink",
336
- children: O("bigconsole.widget.customWidget.field.dataSink", "DataSink")
337
- }), /* @__PURE__ */ _("select", {
336
+ children: k("bigconsole.widget.customWidget.field.dataSink", "DataSink")
337
+ }), /* @__PURE__ */ S("select", {
338
338
  id: "custom-widget-sink",
339
339
  "data-testid": "custom-widget-sink",
340
- value: j.binding.dataSinkId,
340
+ value: M.binding.dataSinkId,
341
341
  onChange: (e) => {
342
- let t = a.find((t) => t.id === e.target.value);
343
- X((n) => ({
342
+ let t = l.find((t) => t.id === e.target.value);
343
+ Z((n) => ({
344
344
  ...n,
345
345
  binding: {
346
346
  ...n.binding,
347
347
  dataSinkId: e.target.value,
348
348
  dataSinkKey: t?.key
349
- }
349
+ },
350
+ rationale: void 0
350
351
  }));
351
352
  },
352
353
  className: "w-full rounded-md border border-[var(--color-border-default)] bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg",
353
- children: [/* @__PURE__ */ g("option", {
354
+ children: [/* @__PURE__ */ x("option", {
354
355
  value: "",
355
- children: O("bigconsole.widget.customWidget.field.selectDataSink", "Select a DataSink…")
356
- }), a.map((e) => /* @__PURE__ */ g("option", {
356
+ children: k("bigconsole.widget.customWidget.field.selectDataSink", "Select a DataSink…")
357
+ }), l.map((e) => /* @__PURE__ */ x("option", {
357
358
  value: e.id,
358
359
  children: e.name || e.key
359
360
  }, e.id))]
360
361
  })]
361
362
  }),
362
- /* @__PURE__ */ _("div", {
363
+ /* @__PURE__ */ S("div", {
363
364
  className: "flex flex-col gap-1",
364
- children: [/* @__PURE__ */ g(m, {
365
+ children: [/* @__PURE__ */ x(b, {
365
366
  htmlFor: "custom-widget-parser",
366
- children: O("bigconsole.widget.customWidget.field.parser", "Parser")
367
- }), /* @__PURE__ */ _("select", {
367
+ children: k("bigconsole.widget.customWidget.field.parser", "Parser")
368
+ }), /* @__PURE__ */ S("select", {
368
369
  id: "custom-widget-parser",
369
370
  "data-testid": "custom-widget-parser",
370
- value: j.binding.parserId ?? "",
371
+ value: M.binding.parserId ?? "",
371
372
  onChange: (e) => {
372
- let t = C.find((t) => t.id === e.target.value);
373
- X((n) => ({
373
+ let t = w.find((t) => t.id === e.target.value);
374
+ Z((n) => ({
374
375
  ...n,
375
376
  binding: {
376
377
  ...n.binding,
377
378
  parserId: e.target.value || void 0,
378
379
  parserName: t?.name
379
- }
380
+ },
381
+ rationale: void 0
380
382
  }));
381
383
  },
382
384
  className: "w-full rounded-md border border-[var(--color-border-default)] bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg",
383
- children: [/* @__PURE__ */ g("option", {
385
+ children: [/* @__PURE__ */ x("option", {
384
386
  value: "",
385
- children: O("bigconsole.widget.customWidget.field.noParser", "No parser")
386
- }), C.map((e) => /* @__PURE__ */ g("option", {
387
+ children: k("bigconsole.widget.customWidget.field.noParser", "No parser")
388
+ }), w.map((e) => /* @__PURE__ */ x("option", {
387
389
  value: e.id,
388
390
  children: e.name
389
391
  }, e.id))]
390
392
  })]
391
393
  }),
392
- Object.keys(j.fieldMapping).length > 0 ? /* @__PURE__ */ _("fieldset", {
394
+ Object.keys(M.fieldMapping).length > 0 ? /* @__PURE__ */ S("fieldset", {
393
395
  className: "flex flex-col gap-2",
394
396
  "data-testid": "custom-widget-field-mapping",
395
397
  children: [
396
- /* @__PURE__ */ g("legend", {
398
+ /* @__PURE__ */ x("legend", {
397
399
  className: "text-sm font-medium text-text-primary",
398
- children: O("bigconsole.widget.customWidget.fieldMapping.legend", "Field mapping")
400
+ children: k("bigconsole.widget.customWidget.fieldMapping.legend", "Field mapping")
399
401
  }),
400
- Object.entries(j.fieldMapping).map(([e, t]) => /* @__PURE__ */ _("div", {
402
+ Object.entries(M.fieldMapping).map(([e, t]) => /* @__PURE__ */ S("div", {
401
403
  className: "flex flex-col gap-1",
402
- children: [/* @__PURE__ */ g(m, {
404
+ children: [/* @__PURE__ */ x(b, {
403
405
  htmlFor: `custom-widget-field-${e}`,
404
406
  children: e
405
- }), /* @__PURE__ */ g(p, {
407
+ }), /* @__PURE__ */ x(y, {
406
408
  id: `custom-widget-field-${e}`,
407
409
  "data-testid": `custom-widget-field-${e}`,
408
410
  value: t,
409
- onChange: (t) => X((n) => ({
411
+ onChange: (t) => Z((n) => ({
410
412
  ...n,
411
413
  fieldMapping: {
412
414
  ...n.fieldMapping,
@@ -415,59 +417,59 @@ var C = a(function({ sinks: a, parsers: C, resolvePreviewData: w, onApprove: T,
415
417
  }))
416
418
  })]
417
419
  }, e)),
418
- q?.length ? /* @__PURE__ */ g("p", {
420
+ J?.length ? /* @__PURE__ */ x("p", {
419
421
  className: "break-words text-xs text-text-secondary",
420
- children: O("bigconsole.widget.customWidget.fieldMapping.available", "Available: {{fields}}", { fields: q.join(", ") })
422
+ children: k("bigconsole.widget.customWidget.fieldMapping.available", "Available: {{fields}}", { fields: J.join(", ") })
421
423
  }) : null
422
424
  ]
423
425
  }) : null
424
426
  ]
425
427
  })
426
428
  }),
427
- L ? /* @__PURE__ */ g(e, {
429
+ R ? /* @__PURE__ */ x(e, {
428
430
  tone: "danger",
429
431
  padding: "compact",
430
432
  headingLevel: 3,
431
433
  title: "Could not add the widget",
432
- children: /* @__PURE__ */ g("p", {
434
+ children: /* @__PURE__ */ x("p", {
433
435
  role: "alert",
434
436
  className: "break-words text-xs text-[var(--color-status-error-text)]",
435
437
  "data-testid": "custom-widget-approve-error",
436
- children: L
438
+ children: R
437
439
  })
438
440
  }) : null,
439
- /* @__PURE__ */ _("div", {
441
+ /* @__PURE__ */ S("div", {
440
442
  className: "flex flex-wrap gap-2 border-t border-[var(--color-border-subtle)] pt-3",
441
- children: [/* @__PURE__ */ _(f, {
443
+ children: [/* @__PURE__ */ S(v, {
442
444
  "data-testid": "custom-widget-approve",
443
- onClick: Z,
444
- disabled: !J.canApprove || V || U || F,
445
- children: [F ? /* @__PURE__ */ g(d, {
445
+ onClick: pe,
446
+ disabled: !Y.canApprove || H || W || I,
447
+ children: [I ? /* @__PURE__ */ x(g, {
446
448
  className: "mr-2 size-4 animate-spin",
447
449
  "aria-hidden": "true"
448
- }) : /* @__PURE__ */ g(u, {
450
+ }) : /* @__PURE__ */ x(h, {
449
451
  className: "mr-1 size-4",
450
452
  "aria-hidden": "true"
451
- }), O("bigconsole.widget.customWidget.action.approveAndAdd", "Approve & add to dashboard")]
452
- }), /* @__PURE__ */ g(f, {
453
+ }), k("bigconsole.widget.customWidget.action.approveAndAdd", "Approve & add to dashboard")]
454
+ }), /* @__PURE__ */ x(v, {
453
455
  variant: "outline",
454
- onClick: E,
456
+ onClick: D,
455
457
  "data-testid": "custom-widget-cancel",
456
- children: O("bigconsole.widget.customWidget.action.cancel", "Cancel")
458
+ children: k("bigconsole.widget.customWidget.action.cancel", "Cancel")
457
459
  })]
458
460
  })
459
- ] }) : /* @__PURE__ */ g(e, {
461
+ ] }) : /* @__PURE__ */ x(e, {
460
462
  emphasis: "muted",
461
463
  padding: "compact",
462
464
  title: "No proposal yet",
463
465
  headingLevel: 3,
464
- children: /* @__PURE__ */ g("p", {
466
+ children: /* @__PURE__ */ x("p", {
465
467
  className: "text-sm text-text-secondary",
466
468
  "data-testid": "custom-widget-empty",
467
- children: O("bigconsole.widget.customWidget.empty", "No proposal yet. Describe a widget and the assistant will propose one for you to review — nothing is added to the dashboard until you approve it.")
469
+ children: k("bigconsole.widget.customWidget.empty", "No proposal yet. Describe a widget and the assistant will propose one for you to review — nothing is added to the dashboard until you approve it.")
468
470
  })
469
471
  })] })
470
472
  });
471
473
  });
472
474
  //#endregion
473
- export { C as default };
475
+ export { w as default };