@adatechnology/conversations-ui 0.16.0 → 0.18.0

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.
@@ -29,6 +29,17 @@ import {
29
29
  } from "lucide-react";
30
30
 
31
31
  // src/flows/labels.ts
32
+ var OPTIONAL_RUNNER_FIELD_LABEL_DEFAULTS = {
33
+ minTime: "A partir de",
34
+ maxTime: "At\xE9",
35
+ timeWindowsContextKey: "Faixas permitidas guardadas em",
36
+ timeWindowsContextKeyHint: 'Chave do contexto com as faixas (ex.: ["11:00-14:00"]), preenchida pelo sistema antes da pergunta.',
37
+ possibleNext: "Destinos que a a\xE7\xE3o pode escolher",
38
+ possibleNextHint: "A a\xE7\xE3o decide o caminho na hora. Liste aqui os destinos poss\xEDveis para eles aparecerem no mapa.",
39
+ addPossibleNext: "Adicionar destino",
40
+ removePossibleNext: "Remover destino",
41
+ possibleNextRowLabel: "Pode seguir para"
42
+ };
32
43
  var DEFAULT_FLOW_RUNNER_FIELD_LABELS = {
33
44
  section: "Resposta do cliente",
34
45
  fallbackMessage: "Mensagem quando a resposta n\xE3o serve",
@@ -37,6 +48,7 @@ var DEFAULT_FLOW_RUNNER_FIELD_LABELS = {
37
48
  maxInvalidAnswersHint: "Vazio = padr\xE3o do bot (2).",
38
49
  minDateToday: "S\xF3 aceitar de hoje em diante",
39
50
  afterContextKey: "Depois da data guardada em",
51
+ ...OPTIONAL_RUNNER_FIELD_LABEL_DEFAULTS,
40
52
  minValue: "M\xEDnimo",
41
53
  maxValue: "M\xE1ximo",
42
54
  minLength: "M\xEDnimo de caracteres",
@@ -95,6 +107,7 @@ var DEFAULT_FLOW_EDITOR_LABELS = {
95
107
  text: "Texto livre",
96
108
  money: "Valor em R$",
97
109
  date: "Data",
110
+ time: "Hor\xE1rio",
98
111
  int: "N\xFAmero inteiro",
99
112
  cpf: "CPF",
100
113
  choice: "Escolha (bot\xF5es/lista)"
@@ -205,6 +218,10 @@ var DEFAULT_FLOW_EDITOR_LABELS = {
205
218
  deadEndQuestion: (id) => `N\xF3 "${id}": pergunta sem pr\xF3ximo passo definido.`,
206
219
  conditionIncomplete: (id) => `N\xF3 "${id}": condi\xE7\xE3o incompleta \u2014 defina vari\xE1vel, operador e valor.`,
207
220
  conditionBranchMissing: (id, branch) => `N\xF3 "${id}": ramo "${branch === "true" ? "Verdadeiro" : "Falso"}" sem destino definido.`,
221
+ buttonTitleMayBeTooLong: (id, label) => `N\xF3 "${id}": bot\xE3o "${label}" tem vari\xE1vel e pode passar de 20 caracteres; confira o valor real.`,
222
+ listTitleMayBeTooLong: (id, label) => `N\xF3 "${id}": item de lista "${label}" tem vari\xE1vel e pode passar de 24 caracteres; confira o valor real.`,
223
+ listButtonLabelTooLong: (id, label) => `N\xF3 "${id}": bot\xE3o da lista "${label}" passa de 20 caracteres.`,
224
+ listButtonLabelMayBeTooLong: (id, label) => `N\xF3 "${id}": bot\xE3o da lista "${label}" tem vari\xE1vel e pode passar de 20 caracteres; confira o valor real.`,
208
225
  descriptionTooLong: (id, label) => `N\xF3 "${id}": a descri\xE7\xE3o de "${label}" passa de 72 caracteres.`,
209
226
  dynamicChoiceWithoutProvider: (id) => `N\xF3 "${id}": escolha din\xE2mica sem provedor de op\xE7\xF5es.`,
210
227
  choiceDefaultIgnored: (id) => `N\xF3 "${id}": o bot repergunta quando a resposta n\xE3o casa com uma op\xE7\xE3o, ent\xE3o "Caso contr\xE1rio" n\xE3o \xE9 seguido. Para seguir, mude "Resposta fora das op\xE7\xF5es".`
@@ -283,6 +300,11 @@ var keywordHandle = (keyword) => `${KEYWORD_HANDLE_PREFIX}${keyword}`;
283
300
  function keywordOfHandle(handle) {
284
301
  return handle.startsWith(KEYWORD_HANDLE_PREFIX) ? handle.slice(KEYWORD_HANDLE_PREFIX.length) : void 0;
285
302
  }
303
+ var POSSIBLE_NEXT_HANDLE_PREFIX = "maybe:";
304
+ var possibleNextHandle = (target) => `${POSSIBLE_NEXT_HANDLE_PREFIX}${target}`;
305
+ function possibleNextOfHandle(handle) {
306
+ return handle.startsWith(POSSIBLE_NEXT_HANDLE_PREFIX) ? handle.slice(POSSIBLE_NEXT_HANDLE_PREFIX.length) : void 0;
307
+ }
286
308
  var CROSS_FLOW_PREFIX = "flow:";
287
309
  var isCrossFlowTarget = (target) => target.startsWith(CROSS_FLOW_PREFIX);
288
310
  var crossFlowKey = (target) => target.slice(CROSS_FLOW_PREFIX.length);
@@ -293,8 +315,9 @@ function estimateNodeHeight(node) {
293
315
  const PADDING = 16;
294
316
  const ROW_HEIGHT = 34;
295
317
  const rowCount = node.type === "action" ? (
296
- // Ação de passagem desenha uma linha de saída; terminal não desenha nenhuma.
297
- isPassThroughAction(node) ? 1 : 0
318
+ // Ação de passagem desenha uma linha de saída; terminal não desenha nenhuma. Cada destino
319
+ // declarado em `possibleNext` é mais uma linha.
320
+ (isPassThroughAction(node) ? 1 : 0) + (node.possibleNext?.length ?? 0)
298
321
  ) : node.type === "condition" ? 2 : node.type === "menu" || node.questionType === "choice" ? (node.options?.length ?? 0) + 1 + keywordCount(node) : 1 + keywordCount(node);
299
322
  return HEADER_HEIGHT + BODY_HEIGHT + PADDING + rowCount * ROW_HEIGHT;
300
323
  }
@@ -305,6 +328,7 @@ var WHATSAPP_LIMITS = {
305
328
  MAX_BUTTONS: WHATSAPP_CHOICE_LIMIT.BUTTONS,
306
329
  MAX_LIST_ROWS: WHATSAPP_CHOICE_LIMIT.LIST_ROWS,
307
330
  BUTTON_TITLE_MAX: WHATSAPP_CHOICE_LIMIT.BUTTON_TITLE_LENGTH,
331
+ LIST_BUTTON_LABEL_MAX: WHATSAPP_CHOICE_LIMIT.LIST_BUTTON_LABEL_LENGTH,
308
332
  LIST_ROW_TITLE_MAX: WHATSAPP_CHOICE_LIMIT.LIST_ROW_TITLE_LENGTH,
309
333
  LIST_ROW_DESCRIPTION_MAX: WHATSAPP_CHOICE_LIMIT.LIST_ROW_DESCRIPTION_LENGTH,
310
334
  LIST_SECTION_TITLE_MAX: WHATSAPP_CHOICE_LIMIT.LIST_SECTION_TITLE_LENGTH,
@@ -313,13 +337,28 @@ var WHATSAPP_LIMITS = {
313
337
  function countCharacters(text) {
314
338
  return Array.from(text).length;
315
339
  }
340
+ var PLACEHOLDER_PATTERN = /\{\{\s*([\w.]+)\s*\}\}/g;
341
+ function measureLabel(label, variableExamples = {}) {
342
+ let isApproximate = false;
343
+ const text = label.replace(PLACEHOLDER_PATTERN, (_placeholder, key) => {
344
+ const example = variableExamples[key];
345
+ if (example === void 0) isApproximate = true;
346
+ return example ?? "";
347
+ });
348
+ return { length: countCharacters(text), isApproximate };
349
+ }
350
+ function judgeLabel(label, max, variableExamples) {
351
+ const measured = measureLabel(label, variableExamples);
352
+ if (measured.length > max) return "too-long";
353
+ return measured.isApproximate && countCharacters(label) > max ? "may-be-too-long" : "ok";
354
+ }
316
355
  function rendersAsButtons(options, optionDetails) {
317
356
  const hasDetails = (options ?? []).some(
318
357
  ([id]) => !!optionDetails?.[id]?.description || !!optionDetails?.[id]?.section
319
358
  );
320
359
  return !hasDetails && (options?.length ?? 0) <= WHATSAPP_LIMITS.MAX_BUTTONS;
321
360
  }
322
- function targetsOf(node) {
361
+ function nextTargetsOf(node) {
323
362
  if (!node.next) return [];
324
363
  if (typeof node.next === "string") return [{ target: node.next }];
325
364
  return [
@@ -328,7 +367,12 @@ function targetsOf(node) {
328
367
  { target: node.next.default, isDefault: true }
329
368
  ];
330
369
  }
331
- function validateGraph(graph, issueText) {
370
+ function targetsOf(node) {
371
+ const possible = (node.possibleNext ?? []).map((target) => ({ target, isPossible: true }));
372
+ return [...nextTargetsOf(node), ...possible];
373
+ }
374
+ function validateGraph(graph, issueText, settings = {}) {
375
+ const examples = settings.variableExamples ?? {};
332
376
  const issues = [];
333
377
  const nodeIds = new Set(Object.keys(graph.nodes));
334
378
  const isValidTarget = (target) => nodeIds.has(target) || isCrossFlowTarget(target);
@@ -358,11 +402,15 @@ function validateGraph(graph, issueText) {
358
402
  issues.push({ severity: "warning", nodeId: node.id, message: issueText.optionWithoutTarget(node.id, label) });
359
403
  }
360
404
  const usesButtons = rendersAsButtons(options, node.optionDetails);
361
- if (usesButtons && countCharacters(label) > WHATSAPP_LIMITS.BUTTON_TITLE_MAX) {
362
- issues.push({ severity: "error", nodeId: node.id, message: issueText.buttonTitleTooLong(node.id, label) });
405
+ const titleMax = usesButtons ? WHATSAPP_LIMITS.BUTTON_TITLE_MAX : WHATSAPP_LIMITS.LIST_ROW_TITLE_MAX;
406
+ const titleVerdict = judgeLabel(label, titleMax, examples);
407
+ if (titleVerdict === "too-long") {
408
+ const tooLong = usesButtons ? issueText.buttonTitleTooLong : issueText.listTitleTooLong;
409
+ issues.push({ severity: "error", nodeId: node.id, message: tooLong(node.id, label) });
363
410
  }
364
- if (!usesButtons && countCharacters(label) > WHATSAPP_LIMITS.LIST_ROW_TITLE_MAX) {
365
- issues.push({ severity: "error", nodeId: node.id, message: issueText.listTitleTooLong(node.id, label) });
411
+ if (titleVerdict === "may-be-too-long") {
412
+ const message = (usesButtons ? issueText.buttonTitleMayBeTooLong : issueText.listTitleMayBeTooLong)?.(node.id, label) ?? `N\xF3 "${node.id}": "${label}" tem vari\xE1vel e pode passar de ${titleMax} caracteres; confira o valor real.`;
413
+ issues.push({ severity: "warning", nodeId: node.id, message });
366
414
  }
367
415
  const description = node.optionDetails?.[optionId]?.description ?? "";
368
416
  if (countCharacters(description) > WHATSAPP_LIMITS.LIST_ROW_DESCRIPTION_MAX) {
@@ -370,6 +418,16 @@ function validateGraph(graph, issueText) {
370
418
  issues.push({ severity: "error", nodeId: node.id, message });
371
419
  }
372
420
  }
421
+ const listButtonLabel = node.listButtonLabel;
422
+ const listButtonVerdict = listButtonLabel ? judgeLabel(listButtonLabel, WHATSAPP_LIMITS.LIST_BUTTON_LABEL_MAX, examples) : "ok";
423
+ if (listButtonLabel && listButtonVerdict === "too-long") {
424
+ const message = issueText.listButtonLabelTooLong?.(node.id, listButtonLabel) ?? `N\xF3 "${node.id}": o bot\xE3o da lista "${listButtonLabel}" passa de ${WHATSAPP_LIMITS.LIST_BUTTON_LABEL_MAX} caracteres.`;
425
+ issues.push({ severity: "error", nodeId: node.id, message });
426
+ }
427
+ if (listButtonLabel && listButtonVerdict === "may-be-too-long") {
428
+ const message = issueText.listButtonLabelMayBeTooLong?.(node.id, listButtonLabel) ?? `N\xF3 "${node.id}": o bot\xE3o da lista "${listButtonLabel}" tem vari\xE1vel e pode passar de ${WHATSAPP_LIMITS.LIST_BUTTON_LABEL_MAX} caracteres; confira o valor real.`;
429
+ issues.push({ severity: "warning", nodeId: node.id, message });
430
+ }
373
431
  const defaultTarget = typeof node.next === "object" && node.next ? node.next.default : "";
374
432
  if (defaultTarget && defaultTarget !== node.id && node.unmatchedChoice !== "default") {
375
433
  const message = issueText.choiceDefaultIgnored?.(node.id) ?? `N\xF3 "${node.id}": "caso contr\xE1rio" s\xF3 \xE9 seguido com "resposta fora das op\xE7\xF5es" = seguir o caso contr\xE1rio.`;
@@ -379,6 +437,10 @@ function validateGraph(graph, issueText) {
379
437
  issues.push({ severity: "error", nodeId: node.id, message: issueText.tooManyOptions(node.id, options.length) });
380
438
  }
381
439
  }
440
+ if ((node.possibleNext?.length ?? 0) > 0 && (node.type !== "action" || !node.actionKind)) {
441
+ const message = issueText.possibleNextIgnored?.(node.id) ?? `${node.id}: "destinos que a a\xE7\xE3o pode escolher" s\xF3 valem em n\xF3 de a\xE7\xE3o com tipo de a\xE7\xE3o.`;
442
+ issues.push({ severity: "warning", nodeId: node.id, message });
443
+ }
382
444
  if (node.type === "dynamic_choice" && !node.choiceProvider) {
383
445
  const message = issueText.dynamicChoiceWithoutProvider?.(node.id) ?? `${node.id}: escolha din\xE2mica sem provedor de op\xE7\xF5es.`;
384
446
  issues.push({ severity: "error", nodeId: node.id, message });
@@ -601,7 +663,15 @@ function selfLoopHandles(node) {
601
663
  }
602
664
  function sourceRows(node, labels) {
603
665
  if (node.type === "action") {
604
- return isPassThroughAction(node) ? [{ id: "next", label: labels.nodePanel.nextRowLabel, isDefault: false, isSelfLoop: false }] : [];
666
+ const rowLabel = labels.runnerFields?.possibleNextRowLabel ?? OPTIONAL_RUNNER_FIELD_LABEL_DEFAULTS.possibleNextRowLabel;
667
+ const possibleRows = (node.possibleNext ?? []).map((target) => ({
668
+ id: possibleNextHandle(target),
669
+ label: `${rowLabel}: ${target}`,
670
+ isDefault: true,
671
+ isSelfLoop: target === node.id
672
+ }));
673
+ const nextRows = isPassThroughAction(node) ? [{ id: "next", label: labels.nodePanel.nextRowLabel, isDefault: false, isSelfLoop: false }] : [];
674
+ return [...nextRows, ...possibleRows];
605
675
  }
606
676
  const loops = selfLoopHandles(node);
607
677
  if (node.type === "condition") {
@@ -1365,7 +1435,7 @@ var flowEdgeTypes = { flowConnection: FlowConnectionEdge };
1365
1435
 
1366
1436
  // src/flows/FlowNodePanel.tsx
1367
1437
  import { useState as useState5 } from "react";
1368
- import { Plus as Plus4, Trash2 as Trash22, Save, X as X3, AlertTriangle as AlertTriangle2, AlertCircle as AlertCircle2 } from "lucide-react";
1438
+ import { Plus as Plus5, Trash2 as Trash23, Save, X as X3, AlertTriangle as AlertTriangle2, AlertCircle as AlertCircle2 } from "lucide-react";
1369
1439
 
1370
1440
  // src/flows/FlowWhatsAppPreview.tsx
1371
1441
  import { List } from "lucide-react";
@@ -1427,7 +1497,7 @@ function FlowWhatsAppPreview({
1427
1497
  );
1428
1498
  }
1429
1499
 
1430
- // src/flows/FlowKeywordRoutesField.tsx
1500
+ // src/flows/FlowPossibleNextField.tsx
1431
1501
  import { Plus as Plus3, Trash2 } from "lucide-react";
1432
1502
 
1433
1503
  // src/flows/flowPanelStyles.ts
@@ -1435,8 +1505,81 @@ var PANEL_FIELD_CLASSNAME = "border border-gray-200 dark:border-gray-600 dark:bg
1435
1505
  var PANEL_LABEL_CLASSNAME = "text-xs font-medium text-gray-500 dark:text-gray-400";
1436
1506
  var PANEL_HINT_CLASSNAME = "text-[11px] text-gray-400 dark:text-gray-500 mt-1";
1437
1507
 
1438
- // src/flows/FlowKeywordRoutesField.tsx
1508
+ // src/flows/FlowPossibleNextField.tsx
1439
1509
  import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1510
+ function withPossibleNext(node, targets) {
1511
+ return { ...node, possibleNext: targets.length > 0 ? targets : void 0 };
1512
+ }
1513
+ function FlowPossibleNextField({
1514
+ draft,
1515
+ onDraftChange,
1516
+ renderTargetOptions,
1517
+ labels
1518
+ }) {
1519
+ const defaults = OPTIONAL_RUNNER_FIELD_LABEL_DEFAULTS;
1520
+ const targets = draft.possibleNext ?? [];
1521
+ const addLabel = labels.addPossibleNext ?? defaults.addPossibleNext;
1522
+ const removeLabel = labels.removePossibleNext ?? defaults.removePossibleNext;
1523
+ const fieldLabel = labels.possibleNext ?? defaults.possibleNext;
1524
+ function updateTarget(index, value) {
1525
+ const next = targets.map((target, targetIndex) => targetIndex === index ? value : target);
1526
+ onDraftChange((previous) => withPossibleNext(previous, next));
1527
+ }
1528
+ return /* @__PURE__ */ jsxs10("div", { className: "pt-2 border-t border-gray-100 dark:border-gray-700", children: [
1529
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between", children: [
1530
+ /* @__PURE__ */ jsx11("label", { className: PANEL_LABEL_CLASSNAME, children: fieldLabel }),
1531
+ /* @__PURE__ */ jsxs10(
1532
+ "button",
1533
+ {
1534
+ type: "button",
1535
+ "aria-label": addLabel,
1536
+ onClick: () => onDraftChange((previous) => withPossibleNext(previous, [...targets, ""])),
1537
+ className: "text-xs text-blue-600 hover:underline flex items-center gap-1",
1538
+ children: [
1539
+ /* @__PURE__ */ jsx11(Plus3, { size: 12, "aria-hidden": "true" }),
1540
+ " ",
1541
+ addLabel
1542
+ ]
1543
+ }
1544
+ )
1545
+ ] }),
1546
+ /* @__PURE__ */ jsx11("p", { className: PANEL_HINT_CLASSNAME, children: labels.possibleNextHint ?? defaults.possibleNextHint }),
1547
+ /* @__PURE__ */ jsx11("div", { className: "space-y-2 mt-1", children: targets.map((target, index) => /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
1548
+ /* @__PURE__ */ jsxs10(
1549
+ "select",
1550
+ {
1551
+ value: target,
1552
+ "aria-label": fieldLabel,
1553
+ onChange: (event) => updateTarget(index, event.target.value),
1554
+ className: `flex-1 ${PANEL_FIELD_CLASSNAME}`,
1555
+ children: [
1556
+ /* @__PURE__ */ jsx11("option", { value: "", children: "\u2014" }),
1557
+ renderTargetOptions()
1558
+ ]
1559
+ }
1560
+ ),
1561
+ /* @__PURE__ */ jsx11(
1562
+ "button",
1563
+ {
1564
+ type: "button",
1565
+ "aria-label": removeLabel,
1566
+ onClick: () => onDraftChange(
1567
+ (previous) => withPossibleNext(
1568
+ previous,
1569
+ targets.filter((_, targetIndex) => targetIndex !== index)
1570
+ )
1571
+ ),
1572
+ className: "text-gray-400 hover:text-red-600",
1573
+ children: /* @__PURE__ */ jsx11(Trash2, { size: 14, "aria-hidden": "true" })
1574
+ }
1575
+ )
1576
+ ] }, index)) })
1577
+ ] });
1578
+ }
1579
+
1580
+ // src/flows/FlowKeywordRoutesField.tsx
1581
+ import { Plus as Plus4, Trash2 as Trash22 } from "lucide-react";
1582
+ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1440
1583
  function withRoutes(node, routes) {
1441
1584
  const current = typeof node.next === "object" && node.next ? node.next : { byAnswer: {}, default: node.next ?? "" };
1442
1585
  const rest = { ...current };
@@ -1468,10 +1611,10 @@ function FlowKeywordRoutesField({
1468
1611
  )
1469
1612
  );
1470
1613
  }
1471
- return /* @__PURE__ */ jsxs10("div", { children: [
1472
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between", children: [
1473
- /* @__PURE__ */ jsx11("label", { className: PANEL_LABEL_CLASSNAME, children: labels.keywordRoutes }),
1474
- /* @__PURE__ */ jsxs10(
1614
+ return /* @__PURE__ */ jsxs11("div", { children: [
1615
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
1616
+ /* @__PURE__ */ jsx12("label", { className: PANEL_LABEL_CLASSNAME, children: labels.keywordRoutes }),
1617
+ /* @__PURE__ */ jsxs11(
1475
1618
  "button",
1476
1619
  {
1477
1620
  type: "button",
@@ -1480,16 +1623,16 @@ function FlowKeywordRoutesField({
1480
1623
  onClick: addRoute,
1481
1624
  className: "text-xs text-blue-600 hover:underline flex items-center gap-1",
1482
1625
  children: [
1483
- /* @__PURE__ */ jsx11(Plus3, { size: 12, "aria-hidden": "true" }),
1626
+ /* @__PURE__ */ jsx12(Plus4, { size: 12, "aria-hidden": "true" }),
1484
1627
  " ",
1485
1628
  labels.addKeywordRoute
1486
1629
  ]
1487
1630
  }
1488
1631
  )
1489
1632
  ] }),
1490
- /* @__PURE__ */ jsx11("p", { className: PANEL_HINT_CLASSNAME, children: labels.keywordRoutesHint }),
1491
- /* @__PURE__ */ jsx11("div", { className: "space-y-2 mt-1", children: routes.map(([keyword, target], index) => /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
1492
- /* @__PURE__ */ jsx11(
1633
+ /* @__PURE__ */ jsx12("p", { className: PANEL_HINT_CLASSNAME, children: labels.keywordRoutesHint }),
1634
+ /* @__PURE__ */ jsx12("div", { className: "space-y-2 mt-1", children: routes.map(([keyword, target], index) => /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
1635
+ /* @__PURE__ */ jsx12(
1493
1636
  "input",
1494
1637
  {
1495
1638
  value: keyword,
@@ -1498,7 +1641,7 @@ function FlowKeywordRoutesField({
1498
1641
  className: `w-28 ${PANEL_FIELD_CLASSNAME}`
1499
1642
  }
1500
1643
  ),
1501
- /* @__PURE__ */ jsxs10(
1644
+ /* @__PURE__ */ jsxs11(
1502
1645
  "select",
1503
1646
  {
1504
1647
  value: target,
@@ -1506,12 +1649,12 @@ function FlowKeywordRoutesField({
1506
1649
  onChange: (event) => updateRoute(index, 1, event.target.value),
1507
1650
  className: `flex-1 ${PANEL_FIELD_CLASSNAME}`,
1508
1651
  children: [
1509
- /* @__PURE__ */ jsx11("option", { value: "", children: "\u2014" }),
1652
+ /* @__PURE__ */ jsx12("option", { value: "", children: "\u2014" }),
1510
1653
  renderTargetOptions()
1511
1654
  ]
1512
1655
  }
1513
1656
  ),
1514
- /* @__PURE__ */ jsx11(
1657
+ /* @__PURE__ */ jsx12(
1515
1658
  "button",
1516
1659
  {
1517
1660
  type: "button",
@@ -1519,7 +1662,7 @@ function FlowKeywordRoutesField({
1519
1662
  "aria-label": labels.removeKeywordRoute,
1520
1663
  onClick: () => removeRoute(index),
1521
1664
  className: "text-gray-400 hover:text-red-600",
1522
- children: /* @__PURE__ */ jsx11(Trash2, { size: 14, "aria-hidden": "true" })
1665
+ children: /* @__PURE__ */ jsx12(Trash22, { size: 14, "aria-hidden": "true" })
1523
1666
  }
1524
1667
  )
1525
1668
  ] }, index)) })
@@ -1527,7 +1670,7 @@ function FlowKeywordRoutesField({
1527
1670
  }
1528
1671
 
1529
1672
  // src/flows/FlowRunnerFields.tsx
1530
- import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1673
+ import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1531
1674
  function toNumber(value) {
1532
1675
  if (value.trim() === "") return void 0;
1533
1676
  const parsed = Number(value);
@@ -1539,9 +1682,9 @@ function withValidation(node, patch) {
1539
1682
  return { ...node, validation: Object.keys(cleaned).length > 0 ? cleaned : void 0 };
1540
1683
  }
1541
1684
  function NumberField(props) {
1542
- return /* @__PURE__ */ jsxs11("div", { className: "flex-1", children: [
1543
- /* @__PURE__ */ jsx12("label", { className: PANEL_LABEL_CLASSNAME, children: props.label }),
1544
- /* @__PURE__ */ jsx12(
1685
+ return /* @__PURE__ */ jsxs12("div", { className: "flex-1", children: [
1686
+ /* @__PURE__ */ jsx13("label", { className: PANEL_LABEL_CLASSNAME, children: props.label }),
1687
+ /* @__PURE__ */ jsx13(
1545
1688
  "input",
1546
1689
  {
1547
1690
  type: "number",
@@ -1552,13 +1695,63 @@ function NumberField(props) {
1552
1695
  )
1553
1696
  ] });
1554
1697
  }
1555
- function ValidationFields({ draft, onDraftChange, knownContextKeys, labels }) {
1698
+ function ContextKeyField(props) {
1699
+ return /* @__PURE__ */ jsxs12("div", { children: [
1700
+ /* @__PURE__ */ jsx13("label", { className: PANEL_LABEL_CLASSNAME, children: props.label }),
1701
+ /* @__PURE__ */ jsx13(
1702
+ "input",
1703
+ {
1704
+ value: props.value ?? "",
1705
+ list: "runner-context-keys",
1706
+ onChange: (event) => props.onValueChange(event.target.value || void 0),
1707
+ className: `w-full mt-1 ${PANEL_FIELD_CLASSNAME}`
1708
+ }
1709
+ ),
1710
+ /* @__PURE__ */ jsx13("datalist", { id: "runner-context-keys", children: props.knownContextKeys.map((key) => /* @__PURE__ */ jsx13("option", { value: key }, key)) }),
1711
+ props.hint && /* @__PURE__ */ jsx13("p", { className: PANEL_HINT_CLASSNAME, children: props.hint })
1712
+ ] });
1713
+ }
1714
+ function TimeValidationFields({ draft, onDraftChange, knownContextKeys, labels }) {
1715
+ const validation = draft.validation ?? {};
1716
+ const update = (patch) => onDraftChange((previous) => withValidation(previous, patch));
1717
+ const defaults = OPTIONAL_RUNNER_FIELD_LABEL_DEFAULTS;
1718
+ const timeInput = (label, value, onValueChange) => /* @__PURE__ */ jsxs12("div", { className: "flex-1", children: [
1719
+ /* @__PURE__ */ jsx13("label", { className: PANEL_LABEL_CLASSNAME, children: label }),
1720
+ /* @__PURE__ */ jsx13(
1721
+ "input",
1722
+ {
1723
+ type: "time",
1724
+ value: value ?? "",
1725
+ onChange: (event) => onValueChange(event.target.value || void 0),
1726
+ className: `w-full mt-1 ${PANEL_FIELD_CLASSNAME}`
1727
+ }
1728
+ )
1729
+ ] });
1730
+ return /* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
1731
+ /* @__PURE__ */ jsxs12("div", { className: "flex gap-2", children: [
1732
+ timeInput(labels.minTime ?? defaults.minTime, validation.minTime, (minTime) => update({ minTime })),
1733
+ timeInput(labels.maxTime ?? defaults.maxTime, validation.maxTime, (maxTime) => update({ maxTime }))
1734
+ ] }),
1735
+ /* @__PURE__ */ jsx13(
1736
+ ContextKeyField,
1737
+ {
1738
+ label: labels.timeWindowsContextKey ?? defaults.timeWindowsContextKey,
1739
+ hint: labels.timeWindowsContextKeyHint ?? defaults.timeWindowsContextKeyHint,
1740
+ value: validation.windowsContextKey,
1741
+ knownContextKeys,
1742
+ onValueChange: (windowsContextKey) => update({ windowsContextKey })
1743
+ }
1744
+ )
1745
+ ] });
1746
+ }
1747
+ function ValidationFields(props) {
1748
+ const { draft, onDraftChange, knownContextKeys, labels } = props;
1556
1749
  const validation = draft.validation ?? {};
1557
1750
  const update = (patch) => onDraftChange((previous) => withValidation(previous, patch));
1558
1751
  if (draft.questionType === "date") {
1559
- return /* @__PURE__ */ jsxs11("div", { className: "space-y-2", children: [
1560
- /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-2 text-xs text-gray-600 dark:text-gray-300", children: [
1561
- /* @__PURE__ */ jsx12(
1752
+ return /* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
1753
+ /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-xs text-gray-600 dark:text-gray-300", children: [
1754
+ /* @__PURE__ */ jsx13(
1562
1755
  "input",
1563
1756
  {
1564
1757
  type: "checkbox",
@@ -1568,30 +1761,27 @@ function ValidationFields({ draft, onDraftChange, knownContextKeys, labels }) {
1568
1761
  ),
1569
1762
  labels.minDateToday
1570
1763
  ] }),
1571
- /* @__PURE__ */ jsxs11("div", { children: [
1572
- /* @__PURE__ */ jsx12("label", { className: PANEL_LABEL_CLASSNAME, children: labels.afterContextKey }),
1573
- /* @__PURE__ */ jsx12(
1574
- "input",
1575
- {
1576
- value: validation.afterContextKey ?? "",
1577
- list: "runner-context-keys",
1578
- onChange: (event) => update({ afterContextKey: event.target.value || void 0 }),
1579
- className: `w-full mt-1 ${PANEL_FIELD_CLASSNAME}`
1580
- }
1581
- ),
1582
- /* @__PURE__ */ jsx12("datalist", { id: "runner-context-keys", children: knownContextKeys.map((key) => /* @__PURE__ */ jsx12("option", { value: key }, key)) })
1583
- ] })
1764
+ /* @__PURE__ */ jsx13(
1765
+ ContextKeyField,
1766
+ {
1767
+ label: labels.afterContextKey,
1768
+ value: validation.afterContextKey,
1769
+ knownContextKeys,
1770
+ onValueChange: (afterContextKey) => update({ afterContextKey })
1771
+ }
1772
+ )
1584
1773
  ] });
1585
1774
  }
1775
+ if (draft.questionType === "time") return /* @__PURE__ */ jsx13(TimeValidationFields, { ...props });
1586
1776
  if (draft.questionType === "int" || draft.questionType === "money") {
1587
- return /* @__PURE__ */ jsxs11("div", { className: "flex gap-2", children: [
1588
- /* @__PURE__ */ jsx12(NumberField, { label: labels.minValue, value: validation.min, onValueChange: (min) => update({ min }) }),
1589
- /* @__PURE__ */ jsx12(NumberField, { label: labels.maxValue, value: validation.max, onValueChange: (max) => update({ max }) })
1777
+ return /* @__PURE__ */ jsxs12("div", { className: "flex gap-2", children: [
1778
+ /* @__PURE__ */ jsx13(NumberField, { label: labels.minValue, value: validation.min, onValueChange: (min) => update({ min }) }),
1779
+ /* @__PURE__ */ jsx13(NumberField, { label: labels.maxValue, value: validation.max, onValueChange: (max) => update({ max }) })
1590
1780
  ] });
1591
1781
  }
1592
1782
  if (!draft.questionType || draft.questionType === "text") {
1593
- return /* @__PURE__ */ jsxs11("div", { className: "flex gap-2", children: [
1594
- /* @__PURE__ */ jsx12(
1783
+ return /* @__PURE__ */ jsxs12("div", { className: "flex gap-2", children: [
1784
+ /* @__PURE__ */ jsx13(
1595
1785
  NumberField,
1596
1786
  {
1597
1787
  label: labels.minLength,
@@ -1599,7 +1789,7 @@ function ValidationFields({ draft, onDraftChange, knownContextKeys, labels }) {
1599
1789
  onValueChange: (minLength) => update({ minLength })
1600
1790
  }
1601
1791
  ),
1602
- /* @__PURE__ */ jsx12(
1792
+ /* @__PURE__ */ jsx13(
1603
1793
  NumberField,
1604
1794
  {
1605
1795
  label: labels.maxLength,
@@ -1621,10 +1811,10 @@ function OptionDetailsField({ draft, onDraftChange, labels }) {
1621
1811
  return { ...previous, optionDetails: { ...previous.optionDetails, [optionId]: detail } };
1622
1812
  });
1623
1813
  }
1624
- return /* @__PURE__ */ jsx12("div", { className: "space-y-2", children: options.map(([optionId, title]) => /* @__PURE__ */ jsxs11("div", { className: "space-y-1", children: [
1625
- /* @__PURE__ */ jsx12("span", { className: "text-[11px] font-medium text-gray-500 dark:text-gray-400", children: title || optionId }),
1626
- /* @__PURE__ */ jsxs11("div", { className: "flex gap-2", children: [
1627
- /* @__PURE__ */ jsx12(
1814
+ return /* @__PURE__ */ jsx13("div", { className: "space-y-2", children: options.map(([optionId, title]) => /* @__PURE__ */ jsxs12("div", { className: "space-y-1", children: [
1815
+ /* @__PURE__ */ jsx13("span", { className: "text-[11px] font-medium text-gray-500 dark:text-gray-400", children: title || optionId }),
1816
+ /* @__PURE__ */ jsxs12("div", { className: "flex gap-2", children: [
1817
+ /* @__PURE__ */ jsx13(
1628
1818
  "input",
1629
1819
  {
1630
1820
  value: draft.optionDetails?.[optionId]?.description ?? "",
@@ -1634,7 +1824,7 @@ function OptionDetailsField({ draft, onDraftChange, labels }) {
1634
1824
  className: `flex-1 ${PANEL_FIELD_CLASSNAME}`
1635
1825
  }
1636
1826
  ),
1637
- /* @__PURE__ */ jsx12(
1827
+ /* @__PURE__ */ jsx13(
1638
1828
  "input",
1639
1829
  {
1640
1830
  value: draft.optionDetails?.[optionId]?.section ?? "",
@@ -1648,9 +1838,9 @@ function OptionDetailsField({ draft, onDraftChange, labels }) {
1648
1838
  ] }, optionId)) });
1649
1839
  }
1650
1840
  function TextField(props) {
1651
- return /* @__PURE__ */ jsxs11("div", { children: [
1652
- /* @__PURE__ */ jsx12("label", { className: PANEL_LABEL_CLASSNAME, children: props.label }),
1653
- /* @__PURE__ */ jsx12(
1841
+ return /* @__PURE__ */ jsxs12("div", { children: [
1842
+ /* @__PURE__ */ jsx13("label", { className: PANEL_LABEL_CLASSNAME, children: props.label }),
1843
+ /* @__PURE__ */ jsx13(
1654
1844
  "input",
1655
1845
  {
1656
1846
  value: props.value,
@@ -1659,7 +1849,7 @@ function TextField(props) {
1659
1849
  className: `w-full mt-1 ${PANEL_FIELD_CLASSNAME}`
1660
1850
  }
1661
1851
  ),
1662
- props.hint && /* @__PURE__ */ jsx12("p", { className: PANEL_HINT_CLASSNAME, children: props.hint })
1852
+ props.hint && /* @__PURE__ */ jsx13("p", { className: PANEL_HINT_CLASSNAME, children: props.hint })
1663
1853
  ] });
1664
1854
  }
1665
1855
  function FlowRunnerFields(props) {
@@ -1667,11 +1857,11 @@ function FlowRunnerFields(props) {
1667
1857
  const isDynamic = draft.type === "dynamic_choice";
1668
1858
  const isChoice = draft.type === "menu" || draft.questionType === "choice";
1669
1859
  const isQuestion = draft.type === "question" && !isChoice;
1670
- return /* @__PURE__ */ jsxs11("div", { className: "pt-2 border-t border-gray-100 dark:border-gray-700 space-y-3", children: [
1671
- /* @__PURE__ */ jsx12("p", { className: "text-xs font-semibold text-gray-700 dark:text-gray-200", children: labels.section }),
1672
- /* @__PURE__ */ jsx12("p", { className: PANEL_HINT_CLASSNAME, children: labels.placeholdersHint }),
1673
- isDynamic && /* @__PURE__ */ jsxs11(Fragment4, { children: [
1674
- /* @__PURE__ */ jsx12(
1860
+ return /* @__PURE__ */ jsxs12("div", { className: "pt-2 border-t border-gray-100 dark:border-gray-700 space-y-3", children: [
1861
+ /* @__PURE__ */ jsx13("p", { className: "text-xs font-semibold text-gray-700 dark:text-gray-200", children: labels.section }),
1862
+ /* @__PURE__ */ jsx13("p", { className: PANEL_HINT_CLASSNAME, children: labels.placeholdersHint }),
1863
+ isDynamic && /* @__PURE__ */ jsxs12(Fragment4, { children: [
1864
+ /* @__PURE__ */ jsx13(
1675
1865
  TextField,
1676
1866
  {
1677
1867
  label: labels.choiceProvider,
@@ -1680,7 +1870,7 @@ function FlowRunnerFields(props) {
1680
1870
  onValueChange: (value) => onDraftChange((previous) => ({ ...previous, choiceProvider: value || void 0 }))
1681
1871
  }
1682
1872
  ),
1683
- /* @__PURE__ */ jsx12(
1873
+ /* @__PURE__ */ jsx13(
1684
1874
  TextField,
1685
1875
  {
1686
1876
  label: labels.contextKey,
@@ -1689,11 +1879,11 @@ function FlowRunnerFields(props) {
1689
1879
  }
1690
1880
  )
1691
1881
  ] }),
1692
- isQuestion && /* @__PURE__ */ jsx12(ValidationFields, { ...props }),
1693
- isChoice && /* @__PURE__ */ jsx12(OptionDetailsField, { ...props }),
1694
- isChoice && /* @__PURE__ */ jsxs11("div", { children: [
1695
- /* @__PURE__ */ jsx12("label", { className: PANEL_LABEL_CLASSNAME, children: labels.unmatchedChoice }),
1696
- /* @__PURE__ */ jsxs11(
1882
+ isQuestion && /* @__PURE__ */ jsx13(ValidationFields, { ...props }),
1883
+ isChoice && /* @__PURE__ */ jsx13(OptionDetailsField, { ...props }),
1884
+ isChoice && /* @__PURE__ */ jsxs12("div", { children: [
1885
+ /* @__PURE__ */ jsx13("label", { className: PANEL_LABEL_CLASSNAME, children: labels.unmatchedChoice }),
1886
+ /* @__PURE__ */ jsxs12(
1697
1887
  "select",
1698
1888
  {
1699
1889
  value: draft.unmatchedChoice ?? "reask",
@@ -1703,13 +1893,13 @@ function FlowRunnerFields(props) {
1703
1893
  },
1704
1894
  className: `w-full mt-1 ${PANEL_FIELD_CLASSNAME}`,
1705
1895
  children: [
1706
- /* @__PURE__ */ jsx12("option", { value: "reask", children: labels.unmatchedChoiceReask }),
1707
- /* @__PURE__ */ jsx12("option", { value: "default", children: labels.unmatchedChoiceDefault })
1896
+ /* @__PURE__ */ jsx13("option", { value: "reask", children: labels.unmatchedChoiceReask }),
1897
+ /* @__PURE__ */ jsx13("option", { value: "default", children: labels.unmatchedChoiceDefault })
1708
1898
  ]
1709
1899
  }
1710
1900
  )
1711
1901
  ] }),
1712
- (isChoice || isDynamic) && /* @__PURE__ */ jsx12(
1902
+ (isChoice || isDynamic) && /* @__PURE__ */ jsx13(
1713
1903
  TextField,
1714
1904
  {
1715
1905
  label: labels.listButtonLabel,
@@ -1717,7 +1907,7 @@ function FlowRunnerFields(props) {
1717
1907
  onValueChange: (value) => onDraftChange((previous) => ({ ...previous, listButtonLabel: value || void 0 }))
1718
1908
  }
1719
1909
  ),
1720
- isQuestion && /* @__PURE__ */ jsx12(
1910
+ isQuestion && /* @__PURE__ */ jsx13(
1721
1911
  TextField,
1722
1912
  {
1723
1913
  label: labels.skipKeywords,
@@ -1729,7 +1919,7 @@ function FlowRunnerFields(props) {
1729
1919
  }
1730
1920
  }
1731
1921
  ),
1732
- /* @__PURE__ */ jsx12(
1922
+ /* @__PURE__ */ jsx13(
1733
1923
  TextField,
1734
1924
  {
1735
1925
  label: labels.fallbackMessage,
@@ -1738,8 +1928,8 @@ function FlowRunnerFields(props) {
1738
1928
  onValueChange: (value) => onDraftChange((previous) => ({ ...previous, fallbackMessage: value || void 0 }))
1739
1929
  }
1740
1930
  ),
1741
- /* @__PURE__ */ jsxs11("div", { children: [
1742
- /* @__PURE__ */ jsx12(
1931
+ /* @__PURE__ */ jsxs12("div", { children: [
1932
+ /* @__PURE__ */ jsx13(
1743
1933
  NumberField,
1744
1934
  {
1745
1935
  label: labels.maxInvalidAnswers,
@@ -1750,14 +1940,14 @@ function FlowRunnerFields(props) {
1750
1940
  }))
1751
1941
  }
1752
1942
  ),
1753
- /* @__PURE__ */ jsx12("p", { className: PANEL_HINT_CLASSNAME, children: labels.maxInvalidAnswersHint })
1943
+ /* @__PURE__ */ jsx13("p", { className: PANEL_HINT_CLASSNAME, children: labels.maxInvalidAnswersHint })
1754
1944
  ] }),
1755
- (draft.type === "menu" || draft.type === "question") && /* @__PURE__ */ jsx12(FlowKeywordRoutesField, { ...props })
1945
+ (draft.type === "menu" || draft.type === "question") && /* @__PURE__ */ jsx13(FlowKeywordRoutesField, { ...props })
1756
1946
  ] });
1757
1947
  }
1758
1948
 
1759
1949
  // src/flows/FlowNodePanel.tsx
1760
- import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1950
+ import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
1761
1951
  var SELECT_CLASSNAME = PANEL_FIELD_CLASSNAME;
1762
1952
  var INPUT_CLASSNAME = PANEL_FIELD_CLASSNAME;
1763
1953
  function truncateLabel(value, max = 60) {
@@ -1773,10 +1963,10 @@ function WhatsAppTextField({
1773
1963
  placeholder,
1774
1964
  labels
1775
1965
  }) {
1776
- return /* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
1777
- /* @__PURE__ */ jsxs12("div", { children: [
1778
- /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: label }),
1779
- /* @__PURE__ */ jsx13(
1966
+ return /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
1967
+ /* @__PURE__ */ jsxs13("div", { children: [
1968
+ /* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: label }),
1969
+ /* @__PURE__ */ jsx14(
1780
1970
  "textarea",
1781
1971
  {
1782
1972
  value,
@@ -1787,18 +1977,18 @@ function WhatsAppTextField({
1787
1977
  }
1788
1978
  )
1789
1979
  ] }),
1790
- /* @__PURE__ */ jsxs12("div", { children: [
1791
- /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.preview }),
1792
- /* @__PURE__ */ jsx13("div", { className: "mt-1", children: /* @__PURE__ */ jsx13(FlowWhatsAppPreview, { body: value, options, optionDetails, labels: labels.nodePanel }) })
1980
+ /* @__PURE__ */ jsxs13("div", { children: [
1981
+ /* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.preview }),
1982
+ /* @__PURE__ */ jsx14("div", { className: "mt-1", children: /* @__PURE__ */ jsx14(FlowWhatsAppPreview, { body: value, options, optionDetails, labels: labels.nodePanel }) })
1793
1983
  ] })
1794
1984
  ] });
1795
1985
  }
1796
1986
  function IssueRow({ issue }) {
1797
1987
  const Icon = issue.severity === "error" ? AlertCircle2 : AlertTriangle2;
1798
1988
  const color = issue.severity === "error" ? "text-red-600 dark:text-red-400" : "text-amber-600 dark:text-amber-400";
1799
- return /* @__PURE__ */ jsxs12("div", { className: `flex items-start gap-1.5 text-xs ${color}`, children: [
1800
- /* @__PURE__ */ jsx13(Icon, { size: 13, className: "mt-0.5 shrink-0" }),
1801
- /* @__PURE__ */ jsx13("span", { children: issue.message })
1989
+ return /* @__PURE__ */ jsxs13("div", { className: `flex items-start gap-1.5 text-xs ${color}`, children: [
1990
+ /* @__PURE__ */ jsx14(Icon, { size: 13, className: "mt-0.5 shrink-0" }),
1991
+ /* @__PURE__ */ jsx14("span", { children: issue.message })
1802
1992
  ] });
1803
1993
  }
1804
1994
  function FlowNodePanel({
@@ -1863,24 +2053,24 @@ function FlowNodePanel({
1863
2053
  setDraft((prev) => ({ ...prev, options: (prev.options ?? []).filter((_, i) => i !== index) }));
1864
2054
  }
1865
2055
  function nextNodeOptions() {
1866
- return /* @__PURE__ */ jsxs12(Fragment5, { children: [
1867
- otherNodeIds.map((id) => /* @__PURE__ */ jsx13("option", { value: id, children: truncateLabel(nodeLabel(graph.nodes[id], labels)) }, id)),
1868
- otherFlows.length > 0 && /* @__PURE__ */ jsx13("optgroup", { label: labels.nodePanel.otherFlowsGroup, children: otherFlows.map((flow) => /* @__PURE__ */ jsx13("option", { value: `${CROSS_FLOW_PREFIX}${flow.key}`, children: flow.label }, flow.key)) })
2056
+ return /* @__PURE__ */ jsxs13(Fragment5, { children: [
2057
+ otherNodeIds.map((id) => /* @__PURE__ */ jsx14("option", { value: id, children: truncateLabel(nodeLabel(graph.nodes[id], labels)) }, id)),
2058
+ otherFlows.length > 0 && /* @__PURE__ */ jsx14("optgroup", { label: labels.nodePanel.otherFlowsGroup, children: otherFlows.map((flow) => /* @__PURE__ */ jsx14("option", { value: `${CROSS_FLOW_PREFIX}${flow.key}`, children: flow.label }, flow.key)) })
1869
2059
  ] });
1870
2060
  }
1871
- return /* @__PURE__ */ jsxs12("div", { className: "fixed inset-y-0 right-0 w-96 bg-white dark:bg-gray-800 border-l border-gray-200 dark:border-gray-700 shadow-xl z-50 flex flex-col", children: [
1872
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-gray-700", children: [
1873
- /* @__PURE__ */ jsx13("h3", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: labels.nodePanel.title }),
1874
- /* @__PURE__ */ jsx13("button", { "data-cv-tooltip": labels.nodePanel.close, "aria-label": labels.nodePanel.close, onClick: onClose, className: "text-gray-400 hover:text-gray-600", children: /* @__PURE__ */ jsx13(X3, { size: 18 }) })
2061
+ return /* @__PURE__ */ jsxs13("div", { className: "fixed inset-y-0 right-0 w-96 bg-white dark:bg-gray-800 border-l border-gray-200 dark:border-gray-700 shadow-xl z-50 flex flex-col", children: [
2062
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-gray-700", children: [
2063
+ /* @__PURE__ */ jsx14("h3", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: labels.nodePanel.title }),
2064
+ /* @__PURE__ */ jsx14("button", { "data-cv-tooltip": labels.nodePanel.close, "aria-label": labels.nodePanel.close, onClick: onClose, className: "text-gray-400 hover:text-gray-600", children: /* @__PURE__ */ jsx14(X3, { size: 18 }) })
1875
2065
  ] }),
1876
- /* @__PURE__ */ jsxs12("div", { className: "flex-1 overflow-y-auto p-4 space-y-4", children: [
1877
- nodeIssues.length > 0 && /* @__PURE__ */ jsx13("div", { className: "rounded-lg border border-gray-100 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/40 p-2.5 space-y-1.5", children: nodeIssues.map((issue, i) => /* @__PURE__ */ jsx13(IssueRow, { issue }, i)) }),
1878
- isFixedLogic && /* @__PURE__ */ jsx13("p", { className: "text-xs text-purple-700 dark:text-purple-400 bg-purple-50 dark:bg-purple-950/30 rounded-lg p-2", children: labels.nodePanel.fixedLogicNotice }),
1879
- isAction && /* @__PURE__ */ jsx13("p", { className: "text-xs text-orange-700 dark:text-orange-400 bg-orange-50 dark:bg-orange-950/30 rounded-lg p-2", children: labels.nodePanel.actionNotice }),
1880
- isCondition && /* @__PURE__ */ jsx13("p", { className: "text-xs text-cyan-700 dark:text-cyan-400 bg-cyan-50 dark:bg-cyan-950/30 rounded-lg p-2", children: labels.nodePanel.conditionNotice }),
1881
- /* @__PURE__ */ jsxs12("div", { children: [
1882
- /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.nodeName }),
1883
- /* @__PURE__ */ jsx13(
2066
+ /* @__PURE__ */ jsxs13("div", { className: "flex-1 overflow-y-auto p-4 space-y-4", children: [
2067
+ nodeIssues.length > 0 && /* @__PURE__ */ jsx14("div", { className: "rounded-lg border border-gray-100 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/40 p-2.5 space-y-1.5", children: nodeIssues.map((issue, i) => /* @__PURE__ */ jsx14(IssueRow, { issue }, i)) }),
2068
+ isFixedLogic && /* @__PURE__ */ jsx14("p", { className: "text-xs text-purple-700 dark:text-purple-400 bg-purple-50 dark:bg-purple-950/30 rounded-lg p-2", children: labels.nodePanel.fixedLogicNotice }),
2069
+ isAction && /* @__PURE__ */ jsx14("p", { className: "text-xs text-orange-700 dark:text-orange-400 bg-orange-50 dark:bg-orange-950/30 rounded-lg p-2", children: labels.nodePanel.actionNotice }),
2070
+ isCondition && /* @__PURE__ */ jsx14("p", { className: "text-xs text-cyan-700 dark:text-cyan-400 bg-cyan-50 dark:bg-cyan-950/30 rounded-lg p-2", children: labels.nodePanel.conditionNotice }),
2071
+ /* @__PURE__ */ jsxs13("div", { children: [
2072
+ /* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.nodeName }),
2073
+ /* @__PURE__ */ jsx14(
1884
2074
  "input",
1885
2075
  {
1886
2076
  value: draft.label ?? "",
@@ -1889,11 +2079,11 @@ function FlowNodePanel({
1889
2079
  className: `w-full mt-1 ${INPUT_CLASSNAME}`
1890
2080
  }
1891
2081
  ),
1892
- /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-gray-400 dark:text-gray-500 mt-1", children: labels.nodePanel.nodeNameHint })
2082
+ /* @__PURE__ */ jsx14("p", { className: "text-[11px] text-gray-400 dark:text-gray-500 mt-1", children: labels.nodePanel.nodeNameHint })
1893
2083
  ] }),
1894
- draft.contextKey && /* @__PURE__ */ jsxs12("div", { children: [
1895
- /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.contextKey }),
1896
- /* @__PURE__ */ jsx13(
2084
+ draft.contextKey && /* @__PURE__ */ jsxs13("div", { children: [
2085
+ /* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.contextKey }),
2086
+ /* @__PURE__ */ jsx14(
1897
2087
  "input",
1898
2088
  {
1899
2089
  value: draft.contextKey,
@@ -1902,19 +2092,19 @@ function FlowNodePanel({
1902
2092
  }
1903
2093
  )
1904
2094
  ] }),
1905
- !isFixedLogic && !isAction && !isCondition && !isDynamicChoice && /* @__PURE__ */ jsxs12("div", { children: [
1906
- /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.questionType }),
1907
- /* @__PURE__ */ jsx13(
2095
+ !isFixedLogic && !isAction && !isCondition && !isDynamicChoice && /* @__PURE__ */ jsxs13("div", { children: [
2096
+ /* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.questionType }),
2097
+ /* @__PURE__ */ jsx14(
1908
2098
  "select",
1909
2099
  {
1910
2100
  value: draft.questionType ?? "text",
1911
2101
  onChange: (e) => setDraft((prev) => ({ ...prev, questionType: e.target.value })),
1912
2102
  className: `w-full mt-1 ${SELECT_CLASSNAME}`,
1913
- children: Object.entries(labels.questionTypeLabels).map(([key, label]) => /* @__PURE__ */ jsx13("option", { value: key, children: label }, key))
2103
+ children: Object.entries(labels.questionTypeLabels).map(([key, label]) => /* @__PURE__ */ jsx14("option", { value: key, children: label }, key))
1914
2104
  }
1915
2105
  )
1916
2106
  ] }),
1917
- !isFixedLogic && !isAction && !isCondition && /* @__PURE__ */ jsx13(
2107
+ !isFixedLogic && !isAction && !isCondition && /* @__PURE__ */ jsx14(
1918
2108
  WhatsAppTextField,
1919
2109
  {
1920
2110
  label: labels.nodePanel.question,
@@ -1925,10 +2115,10 @@ function FlowNodePanel({
1925
2115
  labels
1926
2116
  }
1927
2117
  ),
1928
- isCondition && /* @__PURE__ */ jsxs12("div", { className: "space-y-3", children: [
1929
- /* @__PURE__ */ jsxs12("div", { children: [
1930
- /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.conditionVariable }),
1931
- /* @__PURE__ */ jsx13(
2118
+ isCondition && /* @__PURE__ */ jsxs13("div", { className: "space-y-3", children: [
2119
+ /* @__PURE__ */ jsxs13("div", { children: [
2120
+ /* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.conditionVariable }),
2121
+ /* @__PURE__ */ jsx14(
1932
2122
  "input",
1933
2123
  {
1934
2124
  value: draft.conditionContextKey ?? "",
@@ -1937,11 +2127,11 @@ function FlowNodePanel({
1937
2127
  className: `w-full mt-1 ${INPUT_CLASSNAME}`
1938
2128
  }
1939
2129
  ),
1940
- /* @__PURE__ */ jsx13("datalist", { id: "condition-context-keys", children: knownContextKeys.map((key) => /* @__PURE__ */ jsx13("option", { value: key }, key)) })
2130
+ /* @__PURE__ */ jsx14("datalist", { id: "condition-context-keys", children: knownContextKeys.map((key) => /* @__PURE__ */ jsx14("option", { value: key }, key)) })
1941
2131
  ] }),
1942
- /* @__PURE__ */ jsxs12("div", { children: [
1943
- /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.conditionOperator }),
1944
- /* @__PURE__ */ jsx13(
2132
+ /* @__PURE__ */ jsxs13("div", { children: [
2133
+ /* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.conditionOperator }),
2134
+ /* @__PURE__ */ jsx14(
1945
2135
  "select",
1946
2136
  {
1947
2137
  value: draft.conditionOperator ?? ">",
@@ -1950,13 +2140,13 @@ function FlowNodePanel({
1950
2140
  conditionOperator: e.target.value
1951
2141
  })),
1952
2142
  className: `w-full mt-1 ${SELECT_CLASSNAME}`,
1953
- children: CONDITION_OPERATORS.map((operator) => /* @__PURE__ */ jsx13("option", { value: operator, children: labels.conditionOperatorLabels[operator] ?? operator }, operator))
2143
+ children: CONDITION_OPERATORS.map((operator) => /* @__PURE__ */ jsx14("option", { value: operator, children: labels.conditionOperatorLabels[operator] ?? operator }, operator))
1954
2144
  }
1955
2145
  )
1956
2146
  ] }),
1957
- /* @__PURE__ */ jsxs12("div", { children: [
1958
- /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.conditionValue }),
1959
- /* @__PURE__ */ jsx13(
2147
+ /* @__PURE__ */ jsxs13("div", { children: [
2148
+ /* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.conditionValue }),
2149
+ /* @__PURE__ */ jsx14(
1960
2150
  "input",
1961
2151
  {
1962
2152
  value: draft.conditionValue ?? "",
@@ -1966,7 +2156,7 @@ function FlowNodePanel({
1966
2156
  )
1967
2157
  ] })
1968
2158
  ] }),
1969
- isAction && draft.actionKind === "send_product_list" && /* @__PURE__ */ jsx13(
2159
+ isAction && draft.actionKind === "send_product_list" && /* @__PURE__ */ jsx14(
1970
2160
  WhatsAppTextField,
1971
2161
  {
1972
2162
  label: labels.nodePanel.fallbackMessage,
@@ -1976,11 +2166,11 @@ function FlowNodePanel({
1976
2166
  labels
1977
2167
  }
1978
2168
  ),
1979
- isSendMedia && /* @__PURE__ */ jsxs12("div", { children: [
1980
- /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.media }),
1981
- /* @__PURE__ */ jsx13("div", { className: "mt-1", children: renderMediaPicker?.(node, graph) ?? /* @__PURE__ */ jsx13("p", { className: "text-xs text-gray-400", children: labels.nodePanel.mediaUnavailable }) })
2169
+ isSendMedia && /* @__PURE__ */ jsxs13("div", { children: [
2170
+ /* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.media }),
2171
+ /* @__PURE__ */ jsx14("div", { className: "mt-1", children: renderMediaPicker?.(node, graph) ?? /* @__PURE__ */ jsx14("p", { className: "text-xs text-gray-400", children: labels.nodePanel.mediaUnavailable }) })
1982
2172
  ] }),
1983
- isAction && draft.actionKind !== "send_product_list" && !isSendMedia && /* @__PURE__ */ jsx13(
2173
+ isAction && draft.actionKind !== "send_product_list" && !isSendMedia && /* @__PURE__ */ jsx14(
1984
2174
  WhatsAppTextField,
1985
2175
  {
1986
2176
  label: labels.nodePanel.directMessage,
@@ -1990,17 +2180,17 @@ function FlowNodePanel({
1990
2180
  labels
1991
2181
  }
1992
2182
  ),
1993
- (draft.questionType === "choice" || draft.type === "menu") && /* @__PURE__ */ jsxs12("div", { children: [
1994
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between mb-1.5", children: [
1995
- /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.options }),
1996
- /* @__PURE__ */ jsxs12("button", { "data-cv-tooltip": labels.nodePanel.addOption, "aria-label": labels.nodePanel.addOption, onClick: addOption, className: "text-xs text-blue-600 hover:underline flex items-center gap-1", children: [
1997
- /* @__PURE__ */ jsx13(Plus4, { size: 12 }),
2183
+ (draft.questionType === "choice" || draft.type === "menu") && /* @__PURE__ */ jsxs13("div", { children: [
2184
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between mb-1.5", children: [
2185
+ /* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.options }),
2186
+ /* @__PURE__ */ jsxs13("button", { "data-cv-tooltip": labels.nodePanel.addOption, "aria-label": labels.nodePanel.addOption, onClick: addOption, className: "text-xs text-blue-600 hover:underline flex items-center gap-1", children: [
2187
+ /* @__PURE__ */ jsx14(Plus5, { size: 12 }),
1998
2188
  " ",
1999
2189
  labels.nodePanel.addOption
2000
2190
  ] })
2001
2191
  ] }),
2002
- /* @__PURE__ */ jsx13("div", { className: "space-y-2", children: (draft.options ?? []).map(([id, label], i) => /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
2003
- /* @__PURE__ */ jsx13(
2192
+ /* @__PURE__ */ jsx14("div", { className: "space-y-2", children: (draft.options ?? []).map(([id, label], i) => /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
2193
+ /* @__PURE__ */ jsx14(
2004
2194
  "input",
2005
2195
  {
2006
2196
  value: id,
@@ -2009,7 +2199,7 @@ function FlowNodePanel({
2009
2199
  className: `w-16 ${INPUT_CLASSNAME}`
2010
2200
  }
2011
2201
  ),
2012
- /* @__PURE__ */ jsx13(
2202
+ /* @__PURE__ */ jsx14(
2013
2203
  "input",
2014
2204
  {
2015
2205
  value: label,
@@ -2018,10 +2208,10 @@ function FlowNodePanel({
2018
2208
  className: `flex-1 ${INPUT_CLASSNAME}`
2019
2209
  }
2020
2210
  ),
2021
- /* @__PURE__ */ jsx13("button", { "data-cv-tooltip": labels.nodePanel.removeOption, "aria-label": labels.nodePanel.removeOption, onClick: () => removeOption(i), className: "text-gray-400 hover:text-red-600", children: /* @__PURE__ */ jsx13(Trash22, { size: 14 }) })
2211
+ /* @__PURE__ */ jsx14("button", { "data-cv-tooltip": labels.nodePanel.removeOption, "aria-label": labels.nodePanel.removeOption, onClick: () => removeOption(i), className: "text-gray-400 hover:text-red-600", children: /* @__PURE__ */ jsx14(Trash23, { size: 14 }) })
2022
2212
  ] }, i)) })
2023
2213
  ] }),
2024
- !isFixedLogic && !isAction && !isCondition && /* @__PURE__ */ jsx13(
2214
+ !isFixedLogic && !isAction && !isCondition && /* @__PURE__ */ jsx14(
2025
2215
  FlowRunnerFields,
2026
2216
  {
2027
2217
  draft,
@@ -2031,46 +2221,55 @@ function FlowNodePanel({
2031
2221
  labels: labels.runnerFields ?? DEFAULT_FLOW_RUNNER_FIELD_LABELS
2032
2222
  }
2033
2223
  ),
2034
- (!isAction || isPassThroughAction2) && /* @__PURE__ */ jsxs12("div", { className: "pt-2 border-t border-gray-100 dark:border-gray-700", children: [
2035
- /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.next }),
2036
- /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-gray-400 dark:text-gray-500 mb-1", children: labels.nodePanel.nextHint }),
2037
- typeof draft.next !== "object" && !isCondition ? /* @__PURE__ */ jsxs12(
2224
+ isAction && draft.actionKind && /* @__PURE__ */ jsx14(
2225
+ FlowPossibleNextField,
2226
+ {
2227
+ draft,
2228
+ onDraftChange: setDraft,
2229
+ renderTargetOptions: nextNodeOptions,
2230
+ labels: labels.runnerFields ?? DEFAULT_FLOW_RUNNER_FIELD_LABELS
2231
+ }
2232
+ ),
2233
+ (!isAction || isPassThroughAction2) && /* @__PURE__ */ jsxs13("div", { className: "pt-2 border-t border-gray-100 dark:border-gray-700", children: [
2234
+ /* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.next }),
2235
+ /* @__PURE__ */ jsx14("p", { className: "text-[11px] text-gray-400 dark:text-gray-500 mb-1", children: labels.nodePanel.nextHint }),
2236
+ typeof draft.next !== "object" && !isCondition ? /* @__PURE__ */ jsxs13(
2038
2237
  "select",
2039
2238
  {
2040
2239
  value: typeof draft.next === "string" ? draft.next : "",
2041
2240
  onChange: (e) => updateNextString(e.target.value),
2042
2241
  className: `w-full mt-1 ${SELECT_CLASSNAME}`,
2043
2242
  children: [
2044
- /* @__PURE__ */ jsx13("option", { value: "", children: "\u2014" }),
2243
+ /* @__PURE__ */ jsx14("option", { value: "", children: "\u2014" }),
2045
2244
  nextNodeOptions()
2046
2245
  ]
2047
2246
  }
2048
- ) : /* @__PURE__ */ jsxs12("div", { className: "space-y-2 mt-1", children: [
2049
- conditionAnswerIds.map((id) => /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
2050
- /* @__PURE__ */ jsx13("span", { className: "text-xs text-gray-500 w-32 shrink-0", children: isCondition ? id === "true" ? labels.nodePanel.conditionTrue : labels.nodePanel.conditionFalse : labels.nodePanel.nextByAnswer(id) }),
2051
- /* @__PURE__ */ jsxs12(
2247
+ ) : /* @__PURE__ */ jsxs13("div", { className: "space-y-2 mt-1", children: [
2248
+ conditionAnswerIds.map((id) => /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
2249
+ /* @__PURE__ */ jsx14("span", { className: "text-xs text-gray-500 w-32 shrink-0", children: isCondition ? id === "true" ? labels.nodePanel.conditionTrue : labels.nodePanel.conditionFalse : labels.nodePanel.nextByAnswer(id) }),
2250
+ /* @__PURE__ */ jsxs13(
2052
2251
  "select",
2053
2252
  {
2054
2253
  value: draft.next && typeof draft.next === "object" ? draft.next.byAnswer[id] ?? "" : "",
2055
2254
  onChange: (e) => updateNextByAnswer(id, e.target.value),
2056
2255
  className: `flex-1 ${SELECT_CLASSNAME}`,
2057
2256
  children: [
2058
- /* @__PURE__ */ jsx13("option", { value: "", children: "\u2014" }),
2257
+ /* @__PURE__ */ jsx14("option", { value: "", children: "\u2014" }),
2059
2258
  nextNodeOptions()
2060
2259
  ]
2061
2260
  }
2062
2261
  )
2063
2262
  ] }, id)),
2064
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
2065
- /* @__PURE__ */ jsx13("span", { className: "text-xs text-gray-500 w-32 shrink-0", children: isCondition ? labels.nodePanel.conditionVariableMissing : labels.nodePanel.nextDefault }),
2066
- /* @__PURE__ */ jsxs12(
2263
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
2264
+ /* @__PURE__ */ jsx14("span", { className: "text-xs text-gray-500 w-32 shrink-0", children: isCondition ? labels.nodePanel.conditionVariableMissing : labels.nodePanel.nextDefault }),
2265
+ /* @__PURE__ */ jsxs13(
2067
2266
  "select",
2068
2267
  {
2069
2268
  value: draft.next && typeof draft.next === "object" ? draft.next.default : "",
2070
2269
  onChange: (e) => updateNextDefault(e.target.value),
2071
2270
  className: `flex-1 ${SELECT_CLASSNAME}`,
2072
2271
  children: [
2073
- /* @__PURE__ */ jsx13("option", { value: "", children: "\u2014" }),
2272
+ /* @__PURE__ */ jsx14("option", { value: "", children: "\u2014" }),
2074
2273
  nextNodeOptions()
2075
2274
  ]
2076
2275
  }
@@ -2079,8 +2278,8 @@ function FlowNodePanel({
2079
2278
  ] })
2080
2279
  ] })
2081
2280
  ] }),
2082
- /* @__PURE__ */ jsxs12("div", { className: "p-4 border-t border-gray-100 dark:border-gray-700 flex gap-2", children: [
2083
- /* @__PURE__ */ jsxs12(
2281
+ /* @__PURE__ */ jsxs13("div", { className: "p-4 border-t border-gray-100 dark:border-gray-700 flex gap-2", children: [
2282
+ /* @__PURE__ */ jsxs13(
2084
2283
  "button",
2085
2284
  {
2086
2285
  "data-cv-tooltip": labels.nodePanel.save,
@@ -2088,13 +2287,13 @@ function FlowNodePanel({
2088
2287
  onClick: () => onChange(draft),
2089
2288
  className: "flex-1 inline-flex items-center justify-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700",
2090
2289
  children: [
2091
- /* @__PURE__ */ jsx13(Save, { size: 14 }),
2290
+ /* @__PURE__ */ jsx14(Save, { size: 14 }),
2092
2291
  " ",
2093
2292
  labels.nodePanel.save
2094
2293
  ]
2095
2294
  }
2096
2295
  ),
2097
- !isStart && /* @__PURE__ */ jsx13(
2296
+ !isStart && /* @__PURE__ */ jsx14(
2098
2297
  "button",
2099
2298
  {
2100
2299
  onClick: () => {
@@ -2103,10 +2302,10 @@ function FlowNodePanel({
2103
2302
  "data-cv-tooltip": labels.nodePanel.delete,
2104
2303
  "aria-label": labels.nodePanel.delete,
2105
2304
  className: "px-3 py-2 text-sm text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-950/30 rounded-lg",
2106
- children: /* @__PURE__ */ jsx13(Trash22, { size: 14 })
2305
+ children: /* @__PURE__ */ jsx14(Trash23, { size: 14 })
2107
2306
  }
2108
2307
  ),
2109
- /* @__PURE__ */ jsx13("button", { "data-cv-tooltip": labels.nodePanel.cancel, "aria-label": labels.nodePanel.cancel, onClick: onClose, className: "px-4 py-2 text-sm text-gray-600 dark:text-gray-300 hover:underline", children: labels.nodePanel.cancel })
2308
+ /* @__PURE__ */ jsx14("button", { "data-cv-tooltip": labels.nodePanel.cancel, "aria-label": labels.nodePanel.cancel, onClick: onClose, className: "px-4 py-2 text-sm text-gray-600 dark:text-gray-300 hover:underline", children: labels.nodePanel.cancel })
2110
2309
  ] })
2111
2310
  ] });
2112
2311
  }
@@ -2123,7 +2322,7 @@ import {
2123
2322
  applyNodeChanges
2124
2323
  } from "@xyflow/react";
2125
2324
  import "@xyflow/react/dist/style.css";
2126
- import { Plus as Plus5, Trash2 as Trash23, LayoutGrid, AlertTriangle as AlertTriangle3, AlertCircle as AlertCircle3, Save as Save2, Undo2, Map as MapIcon, Workflow } from "lucide-react";
2325
+ import { Plus as Plus6, Trash2 as Trash24, LayoutGrid, AlertTriangle as AlertTriangle3, AlertCircle as AlertCircle3, Save as Save2, Undo2, Map as MapIcon, Workflow } from "lucide-react";
2127
2326
 
2128
2327
  // src/flows/flowEditorOps.ts
2129
2328
  var NAMESPACE_SEPARATOR = "::";
@@ -2139,7 +2338,9 @@ function removeNodeAndCleanRefs(nodes, removedId) {
2139
2338
  const remaining = {};
2140
2339
  for (const [id, node] of Object.entries(nodes)) {
2141
2340
  if (id === removedId) continue;
2142
- remaining[id] = { ...node, next: cleanNext(node.next, removedId) };
2341
+ const cleaned = { ...node, next: cleanNext(node.next, removedId) };
2342
+ if (node.possibleNext) cleaned.possibleNext = node.possibleNext.filter((target) => target !== removedId);
2343
+ remaining[id] = cleaned;
2143
2344
  }
2144
2345
  return remaining;
2145
2346
  }
@@ -2188,6 +2389,8 @@ function resolveConnection(params) {
2188
2389
  function applyConnection(node, resolved) {
2189
2390
  const currentNext = typeof node.next === "object" && node.next ? node.next : void 0;
2190
2391
  if (resolved.handle === "next") return { ...node, next: resolved.targetValue };
2392
+ const possible = possibleNextOfHandle(resolved.handle);
2393
+ if (possible !== void 0) return withPossibleNext2(node, possible, resolved.targetValue);
2191
2394
  if (resolved.handle === "__default") {
2192
2395
  return { ...node, next: { ...currentNext, byAnswer: currentNext?.byAnswer ?? {}, default: resolved.targetValue } };
2193
2396
  }
@@ -2216,7 +2419,15 @@ function isGraphDirty(working, published) {
2216
2419
  if (!working || !published) return false;
2217
2420
  return JSON.stringify(working) !== JSON.stringify(published);
2218
2421
  }
2422
+ function withPossibleNext2(node, replaced, target) {
2423
+ const current = node.possibleNext ?? [];
2424
+ const updated = current.flatMap((entry) => entry === replaced ? target ? [target] : [] : [entry]);
2425
+ if (!current.includes(replaced) && target) updated.push(target);
2426
+ return { ...node, possibleNext: [...new Set(updated)] };
2427
+ }
2219
2428
  function clearConnection(node, handle) {
2429
+ const possible = possibleNextOfHandle(handle);
2430
+ if (possible !== void 0) return withPossibleNext2(node, possible, void 0);
2220
2431
  if (handle === "next" || typeof node.next === "string" || node.next === void 0) {
2221
2432
  return { ...node, next: "" };
2222
2433
  }
@@ -2317,7 +2528,7 @@ function buildFlowEdges(params) {
2317
2528
  const liveCounts = countLiveByNode({ flowKey, rootFlowKey, positions: livePositions });
2318
2529
  for (const [nodeId, node] of Object.entries(graph.nodes)) {
2319
2530
  const live = (liveCounts[nodeId] ?? 0) > 0;
2320
- for (const { target, optionId: answerId, keyword, isDefault } of targetsOf(node)) {
2531
+ for (const { target, optionId: answerId, keyword, isDefault, isPossible } of targetsOf(node)) {
2321
2532
  const optionId = keyword !== void 0 ? keywordHandle(keyword) : answerId;
2322
2533
  if (!target) continue;
2323
2534
  const crossFlow = isCrossFlowTarget(target);
@@ -2336,6 +2547,18 @@ function buildFlowEdges(params) {
2336
2547
  const source = namespaceNodeId(flowKey, nodeId);
2337
2548
  const edgeTarget = namespaceNodeId(targetFlowKey, targetNodeId);
2338
2549
  if (source === edgeTarget) continue;
2550
+ if (isPossible) {
2551
+ edges.push({
2552
+ id: `${source}->${edgeTarget}-possible`,
2553
+ source,
2554
+ target: edgeTarget,
2555
+ sourceHandle: possibleNextHandle(target),
2556
+ kind: "fallback",
2557
+ crossFlow,
2558
+ live: false
2559
+ });
2560
+ continue;
2561
+ }
2339
2562
  if (isDefault) {
2340
2563
  edges.push({
2341
2564
  id: `${source}->${edgeTarget}-default`,
@@ -2443,7 +2666,7 @@ function findFreeSlot(params) {
2443
2666
  }
2444
2667
 
2445
2668
  // src/flows/FlowsWorkspace.tsx
2446
- import { Fragment as Fragment6, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
2669
+ import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
2447
2670
  var RF_NODE_TYPES = {
2448
2671
  ...flowNodeTypes,
2449
2672
  ...flowPortalNodeTypes,
@@ -2517,6 +2740,7 @@ function FlowsWorkspace({
2517
2740
  renderMediaPicker,
2518
2741
  livePollIntervalMs = 5e3,
2519
2742
  showHeader = true,
2743
+ variableExamples,
2520
2744
  className
2521
2745
  }) {
2522
2746
  const labels = useMemo2(() => mergeFlowEditorLabels(labelsOverride), [labelsOverride]);
@@ -2608,10 +2832,10 @@ function FlowsWorkspace({
2608
2832
  const map = {};
2609
2833
  for (const key of openFlowKeys) {
2610
2834
  const graph = workingGraphs[key];
2611
- if (graph) map[key] = validateGraph(graph, labels.validation);
2835
+ if (graph) map[key] = validateGraph(graph, labels.validation, { variableExamples });
2612
2836
  }
2613
2837
  return map;
2614
- }, [openFlowKeys, workingGraphs, labels]);
2838
+ }, [openFlowKeys, workingGraphs, labels, variableExamples]);
2615
2839
  const errorCount = Object.values(issuesByFlow).reduce(
2616
2840
  (sum, list) => sum + list.filter((issue) => issue.severity === "error").length,
2617
2841
  0
@@ -3042,17 +3266,17 @@ function FlowsWorkspace({
3042
3266
  const keyIsValid = FLOW_KEY_PATTERN.test(newFlow.key);
3043
3267
  const canCreateFlow = Boolean(api.createFlow);
3044
3268
  const canDeleteFlow = Boolean(api.deleteFlow) && primaryFlowKey !== rootFlowKey;
3045
- return /* @__PURE__ */ jsxs13("div", { className: `space-y-4 h-full flex flex-col ${className ?? ""}`, children: [
3046
- /* @__PURE__ */ jsx14(TooltipLayer, {}),
3047
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between flex-wrap gap-3", children: [
3048
- showHeader && /* @__PURE__ */ jsxs13("div", { className: "min-w-0", children: [
3049
- /* @__PURE__ */ jsx14("h2", { className: "text-2xl font-bold text-gray-900 dark:text-gray-100", children: labels.workspace.title }),
3050
- /* @__PURE__ */ jsx14("p", { className: "text-gray-500 dark:text-gray-400 text-sm mt-1", children: labels.workspace.subtitle })
3269
+ return /* @__PURE__ */ jsxs14("div", { className: `space-y-4 h-full flex flex-col ${className ?? ""}`, children: [
3270
+ /* @__PURE__ */ jsx15(TooltipLayer, {}),
3271
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between flex-wrap gap-3", children: [
3272
+ showHeader && /* @__PURE__ */ jsxs14("div", { className: "min-w-0", children: [
3273
+ /* @__PURE__ */ jsx15("h2", { className: "text-2xl font-bold text-gray-900 dark:text-gray-100", children: labels.workspace.title }),
3274
+ /* @__PURE__ */ jsx15("p", { className: "text-gray-500 dark:text-gray-400 text-sm mt-1", children: labels.workspace.subtitle })
3051
3275
  ] }),
3052
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center justify-end gap-3 ml-auto", children: [
3053
- saveState === "success" && /* @__PURE__ */ jsx14("span", { className: "text-sm text-green-600", children: labels.workspace.saveSuccess }),
3054
- saveState === "error" && /* @__PURE__ */ jsx14("span", { className: "text-sm text-red-600", children: saveErrorMessage ?? labels.workspace.saveError }),
3055
- /* @__PURE__ */ jsxs13(
3276
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center justify-end gap-3 ml-auto", children: [
3277
+ saveState === "success" && /* @__PURE__ */ jsx15("span", { className: "text-sm text-green-600", children: labels.workspace.saveSuccess }),
3278
+ saveState === "error" && /* @__PURE__ */ jsx15("span", { className: "text-sm text-red-600", children: saveErrorMessage ?? labels.workspace.saveError }),
3279
+ /* @__PURE__ */ jsxs14(
3056
3280
  "button",
3057
3281
  {
3058
3282
  "data-cv-tooltip": viewMode === "map" ? labels.flowMap.toggleToDetail : labels.flowMap.toggleToMap,
@@ -3061,13 +3285,13 @@ function FlowsWorkspace({
3061
3285
  onClick: () => setViewMode((mode) => mode === "map" ? "detail" : "map"),
3062
3286
  className: OUTLINE_BUTTON,
3063
3287
  children: [
3064
- viewMode === "map" ? /* @__PURE__ */ jsx14(Workflow, { size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ jsx14(MapIcon, { size: 14, "aria-hidden": "true" }),
3288
+ viewMode === "map" ? /* @__PURE__ */ jsx15(Workflow, { size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ jsx15(MapIcon, { size: 14, "aria-hidden": "true" }),
3065
3289
  viewMode === "map" ? labels.flowMap.toggleToDetail : labels.flowMap.toggleToMap
3066
3290
  ]
3067
3291
  }
3068
3292
  ),
3069
- viewMode === "detail" && /* @__PURE__ */ jsxs13(Fragment6, { children: [
3070
- /* @__PURE__ */ jsxs13(
3293
+ viewMode === "detail" && /* @__PURE__ */ jsxs14(Fragment6, { children: [
3294
+ /* @__PURE__ */ jsxs14(
3071
3295
  "button",
3072
3296
  {
3073
3297
  type: "button",
@@ -3077,13 +3301,13 @@ function FlowsWorkspace({
3077
3301
  "aria-label": labels.workspace.organizeTooltip,
3078
3302
  disabled: !primaryGraph,
3079
3303
  children: [
3080
- /* @__PURE__ */ jsx14(LayoutGrid, { size: 14, "aria-hidden": "true" }),
3304
+ /* @__PURE__ */ jsx15(LayoutGrid, { size: 14, "aria-hidden": "true" }),
3081
3305
  " ",
3082
3306
  labels.workspace.organize
3083
3307
  ]
3084
3308
  }
3085
3309
  ),
3086
- /* @__PURE__ */ jsxs13(
3310
+ /* @__PURE__ */ jsxs14(
3087
3311
  "button",
3088
3312
  {
3089
3313
  type: "button",
@@ -3093,13 +3317,13 @@ function FlowsWorkspace({
3093
3317
  "aria-label": labels.workspace.discardTooltip,
3094
3318
  disabled: !isDirty || saveState === "saving",
3095
3319
  children: [
3096
- /* @__PURE__ */ jsx14(Undo2, { size: 14, "aria-hidden": "true" }),
3320
+ /* @__PURE__ */ jsx15(Undo2, { size: 14, "aria-hidden": "true" }),
3097
3321
  " ",
3098
3322
  labels.workspace.discardChanges
3099
3323
  ]
3100
3324
  }
3101
3325
  ),
3102
- /* @__PURE__ */ jsxs13(
3326
+ /* @__PURE__ */ jsxs14(
3103
3327
  "button",
3104
3328
  {
3105
3329
  "data-cv-tooltip": labels.workspace.saveGraph,
@@ -3109,7 +3333,7 @@ function FlowsWorkspace({
3109
3333
  className: PRIMARY_BUTTON,
3110
3334
  disabled: !isDirty || errorCount > 0 || saveState === "saving",
3111
3335
  children: [
3112
- /* @__PURE__ */ jsx14(Save2, { size: 14, "aria-hidden": "true" }),
3336
+ /* @__PURE__ */ jsx15(Save2, { size: 14, "aria-hidden": "true" }),
3113
3337
  saveState === "saving" ? labels.workspace.saving : labels.workspace.saveGraph
3114
3338
  ]
3115
3339
  }
@@ -3117,9 +3341,9 @@ function FlowsWorkspace({
3117
3341
  ] })
3118
3342
  ] })
3119
3343
  ] }),
3120
- viewMode === "detail" && /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
3121
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 flex-wrap", children: [
3122
- graphs && Object.values(graphs).map((graph) => /* @__PURE__ */ jsx14(
3344
+ viewMode === "detail" && /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
3345
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 flex-wrap", children: [
3346
+ graphs && Object.values(graphs).map((graph) => /* @__PURE__ */ jsx15(
3123
3347
  "button",
3124
3348
  {
3125
3349
  "data-cv-tooltip": graph.label,
@@ -3131,7 +3355,7 @@ function FlowsWorkspace({
3131
3355
  },
3132
3356
  graph.key
3133
3357
  )),
3134
- canCreateFlow && /* @__PURE__ */ jsxs13(
3358
+ canCreateFlow && /* @__PURE__ */ jsxs14(
3135
3359
  "button",
3136
3360
  {
3137
3361
  "data-cv-tooltip": labels.flowManager.newFlow,
@@ -3143,15 +3367,15 @@ function FlowsWorkspace({
3143
3367
  },
3144
3368
  className: "inline-flex items-center gap-1 px-3 py-1.5 rounded-full text-xs font-medium border border-dashed border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:border-blue-400 hover:text-blue-600",
3145
3369
  children: [
3146
- /* @__PURE__ */ jsx14(Plus5, { size: 12, "aria-hidden": "true" }),
3370
+ /* @__PURE__ */ jsx15(Plus6, { size: 12, "aria-hidden": "true" }),
3147
3371
  " ",
3148
3372
  labels.flowManager.newFlow
3149
3373
  ]
3150
3374
  }
3151
3375
  )
3152
3376
  ] }),
3153
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
3154
- primaryGraph && /* @__PURE__ */ jsx14(
3377
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
3378
+ primaryGraph && /* @__PURE__ */ jsx15(
3155
3379
  FlowPalette,
3156
3380
  {
3157
3381
  onAdd: handleAddNode,
@@ -3159,7 +3383,7 @@ function FlowsWorkspace({
3159
3383
  ...actionOptions ? { actionOptions: [...actionOptions] } : {}
3160
3384
  }
3161
3385
  ),
3162
- primaryGraph && canDeleteFlow && /* @__PURE__ */ jsxs13(
3386
+ primaryGraph && canDeleteFlow && /* @__PURE__ */ jsxs14(
3163
3387
  "button",
3164
3388
  {
3165
3389
  "data-cv-tooltip": labels.flowManager.deleteFlow,
@@ -3171,7 +3395,7 @@ function FlowsWorkspace({
3171
3395
  },
3172
3396
  className: "inline-flex items-center gap-1.5 rounded-lg border border-red-200 dark:border-red-900 px-3 py-1.5 text-xs font-medium text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-950/30",
3173
3397
  children: [
3174
- /* @__PURE__ */ jsx14(Trash23, { size: 13, "aria-hidden": "true" }),
3398
+ /* @__PURE__ */ jsx15(Trash24, { size: 13, "aria-hidden": "true" }),
3175
3399
  " ",
3176
3400
  labels.flowManager.deleteFlow
3177
3401
  ]
@@ -3179,26 +3403,26 @@ function FlowsWorkspace({
3179
3403
  )
3180
3404
  ] })
3181
3405
  ] }),
3182
- viewMode === "detail" && (errorCount > 0 || warningCount > 0) && /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/60 px-3 py-2 text-xs", children: [
3183
- /* @__PURE__ */ jsxs13("span", { className: "font-medium text-gray-600 dark:text-gray-300", children: [
3406
+ viewMode === "detail" && (errorCount > 0 || warningCount > 0) && /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/60 px-3 py-2 text-xs", children: [
3407
+ /* @__PURE__ */ jsxs14("span", { className: "font-medium text-gray-600 dark:text-gray-300", children: [
3184
3408
  labels.validation.title,
3185
3409
  ":"
3186
3410
  ] }),
3187
- errorCount > 0 && /* @__PURE__ */ jsxs13("span", { className: "flex items-center gap-1 text-red-600 dark:text-red-400 font-medium", children: [
3188
- /* @__PURE__ */ jsx14(AlertCircle3, { size: 13, "aria-hidden": "true" }),
3411
+ errorCount > 0 && /* @__PURE__ */ jsxs14("span", { className: "flex items-center gap-1 text-red-600 dark:text-red-400 font-medium", children: [
3412
+ /* @__PURE__ */ jsx15(AlertCircle3, { size: 13, "aria-hidden": "true" }),
3189
3413
  " ",
3190
3414
  labels.validation.errors(errorCount)
3191
3415
  ] }),
3192
- warningCount > 0 && /* @__PURE__ */ jsxs13("span", { className: "flex items-center gap-1 text-amber-600 dark:text-amber-400", children: [
3193
- /* @__PURE__ */ jsx14(AlertTriangle3, { size: 13, "aria-hidden": "true" }),
3416
+ warningCount > 0 && /* @__PURE__ */ jsxs14("span", { className: "flex items-center gap-1 text-amber-600 dark:text-amber-400", children: [
3417
+ /* @__PURE__ */ jsx15(AlertTriangle3, { size: 13, "aria-hidden": "true" }),
3194
3418
  " ",
3195
3419
  labels.validation.warnings(warningCount)
3196
3420
  ] })
3197
3421
  ] }),
3198
- /* @__PURE__ */ jsxs13("div", { className: "flex-1 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden relative", children: [
3199
- loadState === "loading" && /* @__PURE__ */ jsx14("p", { className: "text-center text-gray-400 py-12", children: labels.workspace.loading }),
3200
- loadState === "error" && /* @__PURE__ */ jsx14("p", { className: "text-center text-red-500 py-12", children: labels.workspace.loadError }),
3201
- loadState === "ready" && graphs && viewMode === "map" && /* @__PURE__ */ jsx14(
3422
+ /* @__PURE__ */ jsxs14("div", { className: "flex-1 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden relative", children: [
3423
+ loadState === "loading" && /* @__PURE__ */ jsx15("p", { className: "text-center text-gray-400 py-12", children: labels.workspace.loading }),
3424
+ loadState === "error" && /* @__PURE__ */ jsx15("p", { className: "text-center text-red-500 py-12", children: labels.workspace.loadError }),
3425
+ loadState === "ready" && graphs && viewMode === "map" && /* @__PURE__ */ jsx15(
3202
3426
  FlowMapCanvas,
3203
3427
  {
3204
3428
  graphs,
@@ -3210,7 +3434,7 @@ function FlowsWorkspace({
3210
3434
  }
3211
3435
  }
3212
3436
  ),
3213
- loadState === "ready" && viewMode === "detail" && primaryGraph && /* @__PURE__ */ jsxs13(
3437
+ loadState === "ready" && viewMode === "detail" && primaryGraph && /* @__PURE__ */ jsxs14(
3214
3438
  ReactFlow2,
3215
3439
  {
3216
3440
  nodes: rfNodes,
@@ -3226,9 +3450,9 @@ function FlowsWorkspace({
3226
3450
  proOptions: { hideAttribution: true },
3227
3451
  colorMode: isDark ? "dark" : "light",
3228
3452
  children: [
3229
- /* @__PURE__ */ jsx14(Background2, { color: isDark ? BACKGROUND_COLOR_DARK2 : BACKGROUND_COLOR_LIGHT2 }),
3230
- /* @__PURE__ */ jsx14(Controls2, {}),
3231
- /* @__PURE__ */ jsx14(Panel, { position: "top-right", children: /* @__PURE__ */ jsx14(
3453
+ /* @__PURE__ */ jsx15(Background2, { color: isDark ? BACKGROUND_COLOR_DARK2 : BACKGROUND_COLOR_LIGHT2 }),
3454
+ /* @__PURE__ */ jsx15(Controls2, {}),
3455
+ /* @__PURE__ */ jsx15(Panel, { position: "top-right", children: /* @__PURE__ */ jsx15(
3232
3456
  FlowLegend,
3233
3457
  {
3234
3458
  labels,
@@ -3236,22 +3460,22 @@ function FlowsWorkspace({
3236
3460
  nodeSwatches: LEGEND_NODE_SWATCHES
3237
3461
  }
3238
3462
  ) }),
3239
- /* @__PURE__ */ jsx14(MiniMap, { pannable: true, zoomable: true, className: "!bg-white dark:!bg-gray-800" })
3463
+ /* @__PURE__ */ jsx15(MiniMap, { pannable: true, zoomable: true, className: "!bg-white dark:!bg-gray-800" })
3240
3464
  ]
3241
3465
  }
3242
3466
  )
3243
3467
  ] }),
3244
- quickAddFrom && /* @__PURE__ */ jsxs13(Fragment6, { children: [
3245
- /* @__PURE__ */ jsx14("div", { className: "fixed inset-0 z-40", onClick: () => setQuickAddFrom(null) }),
3246
- /* @__PURE__ */ jsxs13(
3468
+ quickAddFrom && /* @__PURE__ */ jsxs14(Fragment6, { children: [
3469
+ /* @__PURE__ */ jsx15("div", { className: "fixed inset-0 z-40", onClick: () => setQuickAddFrom(null) }),
3470
+ /* @__PURE__ */ jsxs14(
3247
3471
  "div",
3248
3472
  {
3249
3473
  ref: quickAddMenuRef,
3250
3474
  className: "fixed z-50 w-64 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 shadow-lg py-1",
3251
3475
  style: quickAddMenuStyle,
3252
3476
  children: [
3253
- /* @__PURE__ */ jsx14("p", { className: "px-3 py-1.5 text-xs font-semibold uppercase tracking-wide text-gray-400 dark:text-gray-500", children: labels.quickAdd.title }),
3254
- /* @__PURE__ */ jsx14(
3477
+ /* @__PURE__ */ jsx15("p", { className: "px-3 py-1.5 text-xs font-semibold uppercase tracking-wide text-gray-400 dark:text-gray-500", children: labels.quickAdd.title }),
3478
+ /* @__PURE__ */ jsx15(
3255
3479
  FlowPaletteMenu,
3256
3480
  {
3257
3481
  onSelect: handleQuickAdd,
@@ -3263,7 +3487,7 @@ function FlowsWorkspace({
3263
3487
  }
3264
3488
  )
3265
3489
  ] }),
3266
- editingNode && editingGraph && /* @__PURE__ */ jsx14(
3490
+ editingNode && editingGraph && /* @__PURE__ */ jsx15(
3267
3491
  FlowNodePanel,
3268
3492
  {
3269
3493
  graph: editingGraph,
@@ -3278,11 +3502,11 @@ function FlowsWorkspace({
3278
3502
  },
3279
3503
  `${editingRef?.flowKey}:${editingRef?.nodeId}`
3280
3504
  ),
3281
- showCreateDialog && canCreateFlow && /* @__PURE__ */ jsxs13(FlowDialog, { title: labels.flowManager.createTitle, onClose: () => setShowCreateDialog(false), children: [
3282
- /* @__PURE__ */ jsxs13("div", { className: "space-y-3", children: [
3283
- /* @__PURE__ */ jsxs13("div", { children: [
3284
- /* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.flowManager.label }),
3285
- /* @__PURE__ */ jsx14(
3505
+ showCreateDialog && canCreateFlow && /* @__PURE__ */ jsxs14(FlowDialog, { title: labels.flowManager.createTitle, onClose: () => setShowCreateDialog(false), children: [
3506
+ /* @__PURE__ */ jsxs14("div", { className: "space-y-3", children: [
3507
+ /* @__PURE__ */ jsxs14("div", { children: [
3508
+ /* @__PURE__ */ jsx15("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.flowManager.label }),
3509
+ /* @__PURE__ */ jsx15(
3286
3510
  "input",
3287
3511
  {
3288
3512
  value: newFlow.label,
@@ -3291,9 +3515,9 @@ function FlowsWorkspace({
3291
3515
  }
3292
3516
  )
3293
3517
  ] }),
3294
- /* @__PURE__ */ jsxs13("div", { children: [
3295
- /* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.flowManager.key }),
3296
- /* @__PURE__ */ jsx14(
3518
+ /* @__PURE__ */ jsxs14("div", { children: [
3519
+ /* @__PURE__ */ jsx15("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.flowManager.key }),
3520
+ /* @__PURE__ */ jsx15(
3297
3521
  "input",
3298
3522
  {
3299
3523
  value: newFlow.key,
@@ -3301,10 +3525,10 @@ function FlowsWorkspace({
3301
3525
  className: `mt-1 ${DIALOG_INPUT}`
3302
3526
  }
3303
3527
  ),
3304
- /* @__PURE__ */ jsx14("p", { className: "text-[11px] text-gray-400 mt-1", children: newFlow.key && !keyIsValid ? labels.flowManager.keyInvalid : labels.flowManager.keyHint })
3528
+ /* @__PURE__ */ jsx15("p", { className: "text-[11px] text-gray-400 mt-1", children: newFlow.key && !keyIsValid ? labels.flowManager.keyInvalid : labels.flowManager.keyHint })
3305
3529
  ] }),
3306
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-sm text-gray-700 dark:text-gray-200", children: [
3307
- /* @__PURE__ */ jsx14(
3530
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-sm text-gray-700 dark:text-gray-200", children: [
3531
+ /* @__PURE__ */ jsx15(
3308
3532
  "input",
3309
3533
  {
3310
3534
  type: "checkbox",
@@ -3314,9 +3538,9 @@ function FlowsWorkspace({
3314
3538
  ),
3315
3539
  labels.flowManager.showInMenu
3316
3540
  ] }),
3317
- newFlow.showInMenu && /* @__PURE__ */ jsxs13("div", { children: [
3318
- /* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.flowManager.menuOptionLabel }),
3319
- /* @__PURE__ */ jsx14(
3541
+ newFlow.showInMenu && /* @__PURE__ */ jsxs14("div", { children: [
3542
+ /* @__PURE__ */ jsx15("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.flowManager.menuOptionLabel }),
3543
+ /* @__PURE__ */ jsx15(
3320
3544
  "input",
3321
3545
  {
3322
3546
  value: newFlow.menuOptionLabel,
@@ -3326,11 +3550,11 @@ function FlowsWorkspace({
3326
3550
  }
3327
3551
  )
3328
3552
  ] }),
3329
- flowMutationState.error && /* @__PURE__ */ jsx14("p", { className: "text-xs text-red-600", children: flowMutationState.error })
3553
+ flowMutationState.error && /* @__PURE__ */ jsx15("p", { className: "text-xs text-red-600", children: flowMutationState.error })
3330
3554
  ] }),
3331
- /* @__PURE__ */ jsxs13("div", { className: "flex justify-end gap-2 mt-4", children: [
3332
- /* @__PURE__ */ jsx14("button", { "data-cv-tooltip": labels.nodePanel.cancel, "aria-label": labels.nodePanel.cancel, type: "button", className: OUTLINE_BUTTON, onClick: () => setShowCreateDialog(false), children: labels.nodePanel.cancel }),
3333
- /* @__PURE__ */ jsx14(
3555
+ /* @__PURE__ */ jsxs14("div", { className: "flex justify-end gap-2 mt-4", children: [
3556
+ /* @__PURE__ */ jsx15("button", { "data-cv-tooltip": labels.nodePanel.cancel, "aria-label": labels.nodePanel.cancel, type: "button", className: OUTLINE_BUTTON, onClick: () => setShowCreateDialog(false), children: labels.nodePanel.cancel }),
3557
+ /* @__PURE__ */ jsx15(
3334
3558
  "button",
3335
3559
  {
3336
3560
  "data-cv-tooltip": labels.flowManager.create,
@@ -3344,12 +3568,12 @@ function FlowsWorkspace({
3344
3568
  )
3345
3569
  ] })
3346
3570
  ] }),
3347
- showDeleteDialog && canDeleteFlow && /* @__PURE__ */ jsxs13(FlowDialog, { title: labels.flowManager.deleteFlow, onClose: () => setShowDeleteDialog(false), children: [
3348
- /* @__PURE__ */ jsx14("p", { className: "text-sm text-gray-600 dark:text-gray-300", children: primaryGraph ? labels.flowManager.deleteConfirm(primaryGraph.label) : "" }),
3349
- flowMutationState.error && /* @__PURE__ */ jsx14("p", { className: "text-xs text-red-600 mt-2", children: flowMutationState.error }),
3350
- /* @__PURE__ */ jsxs13("div", { className: "flex justify-end gap-2 mt-4", children: [
3351
- /* @__PURE__ */ jsx14("button", { "data-cv-tooltip": labels.nodePanel.cancel, "aria-label": labels.nodePanel.cancel, type: "button", className: OUTLINE_BUTTON, onClick: () => setShowDeleteDialog(false), children: labels.nodePanel.cancel }),
3352
- /* @__PURE__ */ jsxs13(
3571
+ showDeleteDialog && canDeleteFlow && /* @__PURE__ */ jsxs14(FlowDialog, { title: labels.flowManager.deleteFlow, onClose: () => setShowDeleteDialog(false), children: [
3572
+ /* @__PURE__ */ jsx15("p", { className: "text-sm text-gray-600 dark:text-gray-300", children: primaryGraph ? labels.flowManager.deleteConfirm(primaryGraph.label) : "" }),
3573
+ flowMutationState.error && /* @__PURE__ */ jsx15("p", { className: "text-xs text-red-600 mt-2", children: flowMutationState.error }),
3574
+ /* @__PURE__ */ jsxs14("div", { className: "flex justify-end gap-2 mt-4", children: [
3575
+ /* @__PURE__ */ jsx15("button", { "data-cv-tooltip": labels.nodePanel.cancel, "aria-label": labels.nodePanel.cancel, type: "button", className: OUTLINE_BUTTON, onClick: () => setShowDeleteDialog(false), children: labels.nodePanel.cancel }),
3576
+ /* @__PURE__ */ jsxs14(
3353
3577
  "button",
3354
3578
  {
3355
3579
  "data-cv-tooltip": labels.flowManager.deleteFlow,
@@ -3359,7 +3583,7 @@ function FlowsWorkspace({
3359
3583
  onClick: () => void handleDeleteFlow(),
3360
3584
  disabled: flowMutationState.pending,
3361
3585
  children: [
3362
- /* @__PURE__ */ jsx14(Trash23, { size: 13, "aria-hidden": "true" }),
3586
+ /* @__PURE__ */ jsx15(Trash24, { size: 13, "aria-hidden": "true" }),
3363
3587
  " ",
3364
3588
  labels.flowManager.deleteFlow
3365
3589
  ]
@@ -3374,9 +3598,9 @@ function FlowDialog({
3374
3598
  onClose,
3375
3599
  children
3376
3600
  }) {
3377
- return /* @__PURE__ */ jsxs13("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/40 px-4", children: [
3378
- /* @__PURE__ */ jsx14("div", { className: "absolute inset-0", onClick: onClose, "aria-hidden": "true" }),
3379
- /* @__PURE__ */ jsxs13(
3601
+ return /* @__PURE__ */ jsxs14("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/40 px-4", children: [
3602
+ /* @__PURE__ */ jsx15("div", { className: "absolute inset-0", onClick: onClose, "aria-hidden": "true" }),
3603
+ /* @__PURE__ */ jsxs14(
3380
3604
  "div",
3381
3605
  {
3382
3606
  role: "dialog",
@@ -3384,7 +3608,7 @@ function FlowDialog({
3384
3608
  "aria-label": title,
3385
3609
  className: "relative w-full max-w-md rounded-2xl bg-white dark:bg-gray-800 p-5 shadow-xl",
3386
3610
  children: [
3387
- /* @__PURE__ */ jsx14("h3", { className: "text-base font-semibold text-gray-900 dark:text-gray-100 mb-3", children: title }),
3611
+ /* @__PURE__ */ jsx15("h3", { className: "text-base font-semibold text-gray-900 dark:text-gray-100 mb-3", children: title }),
3388
3612
  children
3389
3613
  ]
3390
3614
  }
@@ -3434,6 +3658,7 @@ export {
3434
3658
  flowPortalNodeTypes,
3435
3659
  isCrossFlowTarget,
3436
3660
  isGraphDirty,
3661
+ measureLabel,
3437
3662
  mergeFlowEditorLabels,
3438
3663
  mergedFlowKeysFrom,
3439
3664
  namespaceNodeId,