@notmrabhi/flowforge 0.1.31 → 0.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/GatewayBranchEdge-9YF32wwN.js +1 -0
  2. package/dist/GatewayBranchEdge-9YF32wwN.js.map +1 -0
  3. package/dist/GatewayBranchEdge-Dxoy5B1A.js +1 -0
  4. package/dist/GatewayBranchEdge-Dxoy5B1A.js.map +1 -0
  5. package/dist/{SchemaBuilderDrawer-4ubE7KhK.js → SchemaBuilderDrawer-B1dLgTM1.js} +2 -1
  6. package/dist/SchemaBuilderDrawer-B1dLgTM1.js.map +1 -0
  7. package/dist/{SchemaBuilderDrawer-CC0gkAU_.js → SchemaBuilderDrawer-CkUfYbGB.js} +2 -1
  8. package/dist/SchemaBuilderDrawer-CkUfYbGB.js.map +1 -0
  9. package/dist/bpmn-CcuE2X_Q.js +1 -0
  10. package/dist/bpmn-CcuE2X_Q.js.map +1 -0
  11. package/dist/bpmn-CtfWDaOY.js +1 -0
  12. package/dist/bpmn-CtfWDaOY.js.map +1 -0
  13. package/dist/canvas.cjs +2 -1
  14. package/dist/canvas.cjs.map +1 -0
  15. package/dist/canvas.d.ts +26 -0
  16. package/dist/canvas.js +2 -1
  17. package/dist/canvas.js.map +1 -0
  18. package/dist/canvasTokens-CAD6G24b.js +1 -0
  19. package/dist/canvasTokens-CAD6G24b.js.map +1 -0
  20. package/dist/canvasTokens-gKNYrPl4.js +1 -0
  21. package/dist/canvasTokens-gKNYrPl4.js.map +1 -0
  22. package/dist/core.cjs +2 -1
  23. package/dist/core.cjs.map +1 -0
  24. package/dist/core.d.ts +13 -0
  25. package/dist/core.js +23 -23
  26. package/dist/core.js.map +1 -0
  27. package/dist/defaultUi.cjs +1 -0
  28. package/dist/defaultUi.cjs.map +1 -0
  29. package/dist/defaultUi.js +1 -0
  30. package/dist/defaultUi.js.map +1 -0
  31. package/dist/form.cjs +2 -1
  32. package/dist/form.cjs.map +1 -0
  33. package/dist/form.d.ts +22 -0
  34. package/dist/form.js +3 -2
  35. package/dist/form.js.map +1 -0
  36. package/dist/{index-DyXSbNQ1.js → index-8bqYHvzi.js} +990 -972
  37. package/dist/index-8bqYHvzi.js.map +1 -0
  38. package/dist/index-B31-Y5uO.js +1 -0
  39. package/dist/index-B31-Y5uO.js.map +1 -0
  40. package/dist/index-B3aHpb84.js +1 -0
  41. package/dist/index-B3aHpb84.js.map +1 -0
  42. package/dist/{index-BsJvlQWO.js → index-BAg_DA8n.js} +5 -4
  43. package/dist/index-BAg_DA8n.js.map +1 -0
  44. package/dist/{index-LWDTj1BM.js → index-BAiSdZW3.js} +2 -1
  45. package/dist/index-BAiSdZW3.js.map +1 -0
  46. package/dist/index-BnzttJ4w.js +1 -0
  47. package/dist/index-BnzttJ4w.js.map +1 -0
  48. package/dist/index-BysKSEtZ.js +1 -0
  49. package/dist/index-BysKSEtZ.js.map +1 -0
  50. package/dist/index-CkjEllpd.js +1 -0
  51. package/dist/index-CkjEllpd.js.map +1 -0
  52. package/dist/index-Cw9DC-tf.js +1 -0
  53. package/dist/index-Cw9DC-tf.js.map +1 -0
  54. package/dist/index-CzPi8KQC.js +1 -0
  55. package/dist/index-CzPi8KQC.js.map +1 -0
  56. package/dist/index-D14V8rKX.js +1 -0
  57. package/dist/index-D14V8rKX.js.map +1 -0
  58. package/dist/{index-DwTs1qiP.js → index-DNDp8nLT.js} +2 -1
  59. package/dist/index-DNDp8nLT.js.map +1 -0
  60. package/dist/{index-CH_7c8r7.js → index-Dlw7CMau.js} +2 -1
  61. package/dist/index-Dlw7CMau.js.map +1 -0
  62. package/dist/{index-D1D2Okji.js → index-Dpl-Q8a4.js} +2 -1
  63. package/dist/index-Dpl-Q8a4.js.map +1 -0
  64. package/dist/index-gtgq_241.js +1 -0
  65. package/dist/index-gtgq_241.js.map +1 -0
  66. package/dist/index-l6kvDx-m.js +1 -0
  67. package/dist/index-l6kvDx-m.js.map +1 -0
  68. package/dist/index-lcviy90e.js +1 -0
  69. package/dist/index-lcviy90e.js.map +1 -0
  70. package/dist/index-wOnYb3DO.js +1 -0
  71. package/dist/index-wOnYb3DO.js.map +1 -0
  72. package/dist/index.cjs +2 -1
  73. package/dist/index.cjs.map +1 -0
  74. package/dist/index.d.ts +22 -0
  75. package/dist/index.js +51 -51
  76. package/dist/index.js.map +1 -0
  77. package/dist/messages-CO299wPN.js +1 -0
  78. package/dist/messages-CO299wPN.js.map +1 -0
  79. package/dist/messages-O9Tw_XXR.js +1 -0
  80. package/dist/messages-O9Tw_XXR.js.map +1 -0
  81. package/dist/nodeRegistry.cjs +2 -1
  82. package/dist/nodeRegistry.cjs.map +1 -0
  83. package/dist/nodeRegistry.d.ts +13 -0
  84. package/dist/nodeRegistry.js +544 -23
  85. package/dist/nodeRegistry.js.map +1 -0
  86. package/dist/templateRegistry.cjs +1 -0
  87. package/dist/templateRegistry.cjs.map +1 -0
  88. package/dist/templateRegistry.js +1 -0
  89. package/dist/templateRegistry.js.map +1 -0
  90. package/dist/{templateSkeletons-x31LuHLb.js → templateSkeletons-B5x8nV9i.js} +2 -1
  91. package/dist/templateSkeletons-B5x8nV9i.js.map +1 -0
  92. package/dist/{templateSkeletons-DOVpyZef.js → templateSkeletons-BdFN__gr.js} +4 -3
  93. package/dist/templateSkeletons-BdFN__gr.js.map +1 -0
  94. package/package.json +3 -2
  95. package/dist/index-BeZylHBB.js +0 -43
  96. package/dist/index-BrJBVztu.js +0 -1
  97. package/dist/index-CUQQVdoY.js +0 -1
  98. package/dist/index-Dcur-XJ9.js +0 -35
  99. package/dist/subWorkflowDescriptor-DYOYgBzX.js +0 -534
  100. package/dist/subWorkflowDescriptor-JDKi2INh.js +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GatewayBranchEdge-Dxoy5B1A.js","sources":["../src/WorkflowCanvas/WorkflowCanvasContext.ts","../src/WorkflowCanvas/nodes/StartNode.tsx","../src/WorkflowCanvas/nodes/EndNode.tsx","../src/WorkflowCanvas/nodes/AddTriggerNode.tsx","../src/WorkflowCanvas/nodes/AddStepNode.tsx","../src/WorkflowCanvas/nodes/TriggerNode.tsx","../src/WorkflowCanvas/nodes/EventNode.tsx","../src/WorkflowCanvas/nodes/BranchRailDecoration.tsx","../src/WorkflowCanvas/nodes/FilterNode.tsx","../src/WorkflowCanvas/nodes/ActionNode.tsx","../src/WorkflowCanvas/nodes/ApprovalNode.tsx","../src/WorkflowCanvas/nodes/DelayNode.tsx","../src/WorkflowCanvas/nodes/NotificationNode.tsx","../src/WorkflowCanvas/nodes/WebhookTriggerNode.tsx","../src/WorkflowCanvas/nodes/RestApiNode.tsx","../src/WorkflowCanvas/nodes/ConditionBranchNode.tsx","../src/WorkflowCanvas/nodes/SubWorkflowNode.tsx","../src/WorkflowCanvas/nodes/index.ts","../src/WorkflowCanvas/edges/EdgeWithPlusLabel.tsx","../src/WorkflowCanvas/edges/PlusEdge.tsx","../src/WorkflowCanvas/edges/PlainEdge.tsx","../src/WorkflowCanvas/edges/LabelPlusEdge.tsx","../src/WorkflowCanvas/edges/GatewayBranchEdge.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\r\nimport { defaultFlowForgeMessages } from './messages';\r\nimport { FlowForgeMessages } from './types';\r\nimport type { NodeTypeRegistry } from '../nodeRegistry';\r\n\r\nexport interface CanvasHandlers {\r\n onEditNode: (slotId: string) => void;\r\n onDeleteNode: (slotId: string) => void;\r\n onAddStep: (afterSlotId: string) => void;\r\n onClickAddTrigger: () => void;\r\n messages: FlowForgeMessages;\r\n nodeRegistry: NodeTypeRegistry | null;\r\n /** How much of a node's data to show on its card. Default: 'full'. */\r\n nodeBody?: 'full' | 'title-only';\r\n}\r\n\r\nexport const WorkflowCanvasContext = createContext<CanvasHandlers>({\r\n onEditNode: () => {},\r\n onDeleteNode: () => {},\r\n onAddStep: () => {},\r\n onClickAddTrigger: () => {},\r\n messages: defaultFlowForgeMessages,\r\n nodeRegistry: null,\r\n nodeBody: 'full',\r\n});\r\n\r\nexport const useCanvasHandlers = () => useContext(WorkflowCanvasContext);\r\n","import React from 'react';\r\nimport { Handle, Position } from 'reactflow';\r\n\r\nconst StartNode = () => (\r\n <div style={{ width: 350, display: 'flex', justifyContent: 'center' }}>\r\n <Handle type=\"source\" position={Position.Bottom} style={{ opacity: 0, left: '50%' }} />\r\n <div style={{ padding: '8px 28px', borderRadius: 999, background: '#f5f5f5', border: '1.5px solid #bdbdbd', fontSize: 13, fontWeight: 500, color: '#424242', userSelect: 'none' }}>\r\n Start\r\n </div>\r\n </div>\r\n);\r\n\r\nexport default StartNode;\r\n","import React from 'react';\r\nimport { Handle, Position } from 'reactflow';\r\n\r\nconst EndNode = () => (\r\n <div style={{ width: 350, display: 'flex', justifyContent: 'center' }}>\r\n <Handle type=\"target\" position={Position.Top} style={{ opacity: 0, left: '50%' }} />\r\n <div style={{ padding: '8px 28px', borderRadius: 999, background: '#f5f5f5', border: '1.5px solid #bdbdbd', fontSize: 13, fontWeight: 500, color: '#424242', userSelect: 'none' }}>\r\n End\r\n </div>\r\n </div>\r\n);\r\n\r\nexport default EndNode;\r\n","import React from 'react';\r\nimport { Handle, Position } from 'reactflow';\r\nimport { Tooltip } from '@mui/material';\r\nimport { GrTrigger } from 'react-icons/gr';\r\nimport { useCanvasHandlers } from '../WorkflowCanvasContext';\r\n\r\nconst AddTriggerNode = () => {\r\n const { onClickAddTrigger, messages } = useCanvasHandlers();\r\n return (\r\n <div style={{ width: 350, display: 'flex', justifyContent: 'center' }}>\r\n <Handle type=\"target\" position={Position.Top} style={{ opacity: 0, left: '50%' }} />\r\n <Tooltip title={messages.addTriggerTooltip} placement=\"top\" arrow>\r\n <div\r\n onClick={onClickAddTrigger}\r\n role=\"button\"\r\n tabIndex={0}\r\n onKeyDown={(e) => { if (e.key === 'Enter') onClickAddTrigger(); }}\r\n style={{ padding: '10px 24px', borderRadius: 8, border: '1.5px dashed #d0d0d0', background: '#fff', cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 8 }}\r\n >\r\n <GrTrigger size={16} />\r\n <span className=\"ff-text-black\" style={{ fontSize: 13 }} data-testid=\"add-trigger-btn-text\">\r\n {messages.addTriggerButton}\r\n </span>\r\n </div>\r\n </Tooltip>\r\n <Handle type=\"source\" position={Position.Bottom} style={{ opacity: 0, left: '50%' }} />\r\n </div>\r\n );\r\n};\r\n\r\nexport default AddTriggerNode;\r\n","import React from 'react';\r\nimport { Handle, Position, NodeProps } from 'reactflow';\r\nimport { useCanvasHandlers } from '../WorkflowCanvasContext';\r\n\r\nconst AddStepNode = ({ id }: NodeProps) => {\r\n const { onAddStep } = useCanvasHandlers();\r\n return (\r\n <div\r\n onClick={() => onAddStep(id)}\r\n role=\"button\"\r\n tabIndex={0}\r\n onKeyDown={(e) => { if (e.key === 'Enter') onAddStep(id); }}\r\n style={{ width: 28, height: 28, borderRadius: '50%', border: '1.5px solid #9e9e9e', background: '#fff', display: 'flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer', fontSize: 18, color: '#757575', lineHeight: 1, userSelect: 'none' }}\r\n >\r\n <Handle type=\"target\" position={Position.Top} style={{ opacity: 0 }} />\r\n +\r\n <Handle type=\"source\" position={Position.Bottom} style={{ opacity: 0 }} />\r\n </div>\r\n );\r\n};\r\n\r\nexport default AddStepNode;\r\n","import React from 'react';\nimport { Handle, Position, NodeProps } from 'reactflow';\nimport { Chip, Tooltip } from '@mui/material';\nimport { MdInput, MdOutlineModeEdit, MdInfoOutline } from 'react-icons/md';\nimport { FaCheckCircle, FaTimesCircle } from 'react-icons/fa';\nimport { useCanvasHandlers } from '../WorkflowCanvasContext';\n\ninterface TriggerSource {\n value?: string;\n label?: string;\n}\n\ninterface TriggerExecutionStatus {\n status?: 'success' | 'failed' | string;\n}\n\ninterface TriggerNodeData {\n /** Trigger flavour. 'event' = event-based; 'scheduler' = cron/scheduler; absent = nothing chosen yet. */\n type?: 'event' | 'scheduler';\n /** Event-type label, e.g. 'END_USER_CREATION' → \"New User Registration\" */\n eventType?: string;\n /** Selected event sources (for type === 'event'). Each rendered as a chip. */\n sources?: TriggerSource[];\n /** Legacy / simple shape — single label + optional source, used when no `type`/`sources` are supplied. */\n label?: string;\n source?: string;\n /** Hides edit icon when previewing a stored workflow. */\n previewWorkflow?: boolean;\n /** When present, replaces the edit icon with a status badge. */\n executionStatus?: TriggerExecutionStatus;\n /** Optional info text shown in the (i) tooltip; defaults to a generic explanation. */\n infoText?: string;\n}\n\n// Last-resort humaniser for a raw code string. The package is generic — it\n// must NOT carry IAM-/PAM-/IGA-specific mappings. The host is expected to\n// supply human labels via `template.label` (merged into nodeData.label) and\n// via each source's `label` field (returned from loadTriggerSources). This\n// helper only runs when the host gave us nothing readable to display.\nfunction humaniseCode(code?: string): string {\n if (!code) return '';\n return code\n .replace(/[_-]+/g, ' ')\n .toLowerCase()\n .replace(/\\b\\w/g, (m) => m.toUpperCase());\n}\n\n// Source label preference: host-provided `label` first, then humanise.\nfunction formatSource(s: TriggerSource | string): string {\n if (typeof s !== 'string' && s.label) return s.label;\n const value = typeof s === 'string' ? s : (s.value ?? '');\n return humaniseCode(value);\n}\n\nconst TriggerNode = ({ data }: NodeProps) => {\n const { onClickAddTrigger } = useCanvasHandlers();\n const {\n type, eventType, sources,\n label, source,\n previewWorkflow, executionStatus,\n infoText = 'This node decides the flow trigger type and configuration.',\n } = (data ?? {}) as TriggerNodeData;\n\n const handleEdit = (e?: React.SyntheticEvent) => {\n e?.stopPropagation();\n onClickAddTrigger();\n };\n\n // ── Shape flags ─────────────────────────────────────────────────────────────\n const hasEventSources = Array.isArray(sources) && sources.length > 0;\n const hasSimpleShape = !!(label || source);\n\n // ── Title text — always a generic role label, never the configured value.\n // The configured value (event name, sources) lives in the body below.\n const title =\n type === 'scheduler' ? 'Scheduler Trigger'\n : (type === 'event' || hasEventSources || hasSimpleShape) ? 'Event Trigger Source'\n : 'Select Trigger';\n\n const body: React.ReactNode = (() => {\n if (type === 'scheduler') {\n return <span>Scheduler to be configured</span>;\n }\n\n if (type === 'event' || hasEventSources) {\n // Prefer the template's own `label` (human-curated) over a code-derived\n // title. Falls back to a humanised form of the raw code for back-compat\n // with shapes that only carry the eventType code.\n const eventDisplay = label || humaniseCode(eventType);\n return (\n <div>\n <div className=\"ff-d-flex ff-align-items-center\">\n <span style={{ fontWeight: 600 }}>{eventDisplay}</span>\n <span className=\"ff-ms-2 ff-text-muted\" style={{ fontSize: 12 }}>via</span>\n </div>\n <div className=\"ff-d-flex ff-flex-wrap ff-mt-2\" style={{ gap: 4 }}>\n {hasEventSources ? (\n sources!.map((s, i) => (\n <Chip\n key={i}\n label={formatSource(s)}\n variant=\"outlined\"\n size=\"small\"\n className=\"ff-text-dark\"\n />\n ))\n ) : (\n <span className=\"ff-text-muted\" style={{ fontSize: 12 }}>No source selected</span>\n )}\n </div>\n </div>\n );\n }\n\n if (hasSimpleShape) {\n return (\n <div className=\"ff-d-flex ff-flex-wrap ff-align-items-center\" style={{ gap: 6 }}>\n {label && <span style={{ fontWeight: 600 }}>{label}</span>}\n {source && <Chip label={source} variant=\"outlined\" size=\"small\" />}\n </div>\n );\n }\n\n return (\n <span\n role=\"button\"\n tabIndex={0}\n onClick={handleEdit}\n onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') handleEdit(e); }}\n style={{ cursor: 'pointer', color: '#1e88e5' }}\n >\n Click to select a trigger to start your workflow\n </span>\n );\n })();\n\n // ── Right-side cluster: execution status badge OR (edit + info) ─────────────\n const rightCluster = executionStatus ? (\n <>\n {executionStatus.status === 'success' && (\n <FaCheckCircle size={16} color=\"#1DBF60\" style={{ marginRight: 8 }} />\n )}\n {executionStatus.status === 'failed' && (\n <FaTimesCircle size={16} color=\"#f44336\" style={{ marginRight: 8 }} />\n )}\n </>\n ) : (\n <div className=\"ff-d-flex ff-align-items-center\">\n {!previewWorkflow && (\n <div\n role=\"button\"\n tabIndex={0}\n onClick={handleEdit}\n onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') handleEdit(e); }}\n className=\"ff-me-2\"\n style={{ cursor: 'pointer', color: '#212121' }}\n aria-label=\"Edit trigger\"\n >\n <MdOutlineModeEdit size={16} />\n </div>\n )}\n <Tooltip title={<div>{infoText}</div>} placement=\"right\" arrow>\n <span><MdInfoOutline color=\"gray\" size={16} /></span>\n </Tooltip>\n </div>\n );\n\n return (\n <div style={{ width: 350 }}>\n <Handle type=\"target\" position={Position.Top} style={{ opacity: 0 }} />\n <div style={{ border: '1.5px solid #a5d6a7', borderRadius: 8, background: '#fff', overflow: 'hidden' }}>\n {/* Header row — original layout: icon in tinted square + small generic title */}\n <div className=\"ff-d-flex ff-justify-content-between ff-align-items-center\" style={{ padding: '10px 6px'}}>\n <div className=\"ff-d-flex ff-align-items-center ff-gap-2\">\n <div\n style={{\n width: 28, height: 28, borderRadius: 6,\n background: 'rgba(76,175,80,0.1)',\n display: 'flex', alignItems: 'center', justifyContent: 'center',\n flexShrink: 0,\n }}\n >\n <MdInput size={16} color=\"#388e3c\" />\n </div>\n <span style={{ fontSize: 14, fontWeight: 500, color: '#212121' }}>{title}</span>\n </div>\n <div className=\"ff-d-flex ff-align-items-center\">{rightCluster}</div>\n </div>\n\n {/* Body */}\n <div\n style={{\n background: '#f5f5f5',\n fontSize: 12,\n color: '#212121',\n padding: '10px 6px',\n margin: '0 6px 10px',\n borderRadius: 6,\n }}\n >\n {body}\n </div>\n </div>\n <Handle type=\"source\" position={Position.Bottom} style={{ opacity: 0 }} id=\"1\" />\n </div>\n );\n};\n\nexport default TriggerNode;\n","import React from 'react';\nimport { Handle, Position, NodeProps } from 'reactflow';\nimport { Chip, Tooltip } from '@mui/material';\nimport { MdInput, MdInfoOutline } from 'react-icons/md';\nimport { FaCheckCircle, FaTimesCircle } from 'react-icons/fa';\n\n/**\n * EventNode — fixed, display-only \"system event\" marker (e.g. the\n * `User Created` step that's pre-seeded in the END_USER_CREATION template).\n *\n * Shares the green/event visual language with TriggerNode but has NO edit\n * affordance — this node represents an event the system raises, not something\n * the user configures. Click → no drawer opens.\n */\n\ninterface EventSource {\n value?: string;\n label?: string;\n}\n\ninterface EventExecutionStatus {\n status?: 'success' | 'failed' | string;\n}\n\ninterface EventNodeData {\n /** Header line, e.g. \"Event\" or \"Event Trigger Source\" */\n header?: string;\n /** Body title — the event being raised, e.g. \"User Created\" / \"New User Registration\" */\n title?: string;\n /** Optional event-type code (mapped to a friendly label below) */\n eventType?: string;\n /** Optional sources, rendered as chips */\n sources?: EventSource[];\n /** Optional tooltip text on the (i) icon */\n infoText?: string;\n /** Optional execution badge (success / failed) */\n executionStatus?: EventExecutionStatus;\n}\n\nfunction formatEventType(code?: string): string {\n if (!code) return '';\n if (code === 'END_USER_CREATION') return 'New User Registration';\n if (code === 'END_USER_UPDATION') return 'On User Update';\n return code.replace(/[_-]+/g, ' ').replace(/\\b\\w/g, (m) => m.toUpperCase());\n}\n\nfunction formatSource(s: EventSource | string): string {\n const value = typeof s === 'string' ? s : (s.value ?? '');\n if (value === 'SIGNUP_FLOW') return 'User Self-Registration';\n if (value === 'ADMIN_CREATION_FLOW') return 'Create User via Admin Portal';\n if (value === 'SHEDULAR' || value === 'SCHEDULER') return 'Scheduler';\n if (typeof s !== 'string' && s.label) return s.label;\n return value.replace(/[_-]+/g, ' ').replace(/\\b\\w/g, (m) => m.toUpperCase());\n}\n\nconst EventNode = ({ data }: NodeProps) => {\n const {\n header = 'Event',\n title,\n eventType,\n sources,\n executionStatus,\n infoText = 'This event is raised by the system. It cannot be configured.',\n } = (data ?? {}) as EventNodeData;\n\n const displayTitle = title ?? formatEventType(eventType) ?? '—';\n\n return (\n <div style={{ width: 350 }}>\n <Handle type=\"target\" position={Position.Top} style={{ opacity: 0 }} />\n <div style={{ border: '1.5px solid #a5d6a7', borderRadius: 8, background: '#fff', overflow: 'hidden' }}>\n {/* Header row */}\n <div className=\"ff-d-flex ff-justify-content-between ff-align-items-center\" style={{ padding: '10px 6px' }}>\n <div className=\"ff-d-flex ff-align-items-center ff-gap-2\">\n <div\n style={{\n width: 28, height: 28, borderRadius: 6,\n background: 'rgba(76,175,80,0.1)',\n display: 'flex', alignItems: 'center', justifyContent: 'center',\n flexShrink: 0,\n }}\n >\n <MdInput size={16} color=\"#388e3c\" />\n </div>\n <span style={{ fontSize: 14, fontWeight: 500, color: '#212121' }}>{header}</span>\n </div>\n <div className=\"ff-d-flex ff-align-items-center\">\n {executionStatus?.status === 'success' && (\n <FaCheckCircle size={16} color=\"#1DBF60\" style={{ marginRight: 8 }} />\n )}\n {executionStatus?.status === 'failed' && (\n <FaTimesCircle size={16} color=\"#f44336\" style={{ marginRight: 8 }} />\n )}\n {!executionStatus && (\n <Tooltip title={<div>{infoText}</div>} placement=\"right\" arrow>\n <span><MdInfoOutline color=\"gray\" size={16} /></span>\n </Tooltip>\n )}\n </div>\n </div>\n\n {/* Body */}\n <div\n style={{\n background: '#f5f5f5',\n fontSize: 13,\n color: '#212121',\n padding: '10px 12px',\n margin: '0 6px 10px',\n borderRadius: 6,\n }}\n >\n <div style={{ fontWeight: 600 }}>{displayTitle}</div>\n {Array.isArray(sources) && sources.length > 0 && (\n <>\n <div className=\"ff-text-muted\" style={{ fontSize: 12, marginTop: 4 }}>via</div>\n <div className=\"ff-d-flex ff-flex-wrap ff-mt-1\" style={{ gap: 4 }}>\n {sources.map((s, i) => (\n <Chip\n key={i}\n label={formatSource(s)}\n variant=\"outlined\"\n size=\"small\"\n className=\"ff-text-dark\"\n />\n ))}\n </div>\n </>\n )}\n </div>\n </div>\n <Handle type=\"source\" position={Position.Bottom} style={{ opacity: 0 }} id=\"1\" />\n </div>\n );\n};\n\nexport default EventNode;\n","import React from 'react';\n\nexport interface BranchRailEntry {\n /** Y position of this branch's bullet, relative to gateway card's bottom edge */\n y: number;\n label: string;\n /** First/primary branch — used for pill coloring */\n isPass: boolean;\n}\n\nexport interface BranchRailSpec {\n branches: BranchRailEntry[];\n /** Total rail height, from gateway card bottom to end of last branch */\n height: number;\n /** Horizontal offset from gateway center to branch step center (px) */\n indent: number;\n}\n\n/**\n * Vertical rail decoration that hangs off the bottom of a gateway (filter/approval)\n * card. Provides the Workato-style visual: a left vertical line with branch bullets\n * + labels at the Y position of each branch's first step.\n *\n * Positioned absolutely so it overflows the node's bounding box without affecting\n * ReactFlow's measured size.\n */\nconst BranchRailDecoration: React.FC<{ rail: BranchRailSpec; cardWidth: number }> = ({ rail, cardWidth }) => {\n // Rail X sits just inside the gateway card's left edge, descending from card bottom.\n // Branch step center is at (cardCenter + indent). Card center is at cardWidth/2.\n // The bullet anchors on the rail and a short connector reaches the step.\n const railX = cardWidth / 2; // center of gateway card; rail descends from here\n const stepCenterX = cardWidth / 2 + rail.indent;\n const stroke = 'var(--ff-edge-color, #b0bec5)';\n\n return (\n <svg\n width={cardWidth + rail.indent + 200}\n height={rail.height}\n style={{ position: 'absolute', left: 0, top: '100%', pointerEvents: 'none', overflow: 'visible' }}\n >\n {/* Vertical rail */}\n <line x1={railX} y1={0} x2={railX} y2={rail.height} stroke={stroke} strokeWidth={1.5} />\n\n {rail.branches.map((b, idx) => {\n const bulletY = b.y;\n return (\n <g key={idx} transform={`translate(0, ${bulletY})`}>\n {/* Diamond bullet on the rail */}\n <rect\n x={railX - 5} y={-5} width={10} height={10}\n fill=\"#fff\" stroke={stroke} strokeWidth={1.5}\n transform={`rotate(45, ${railX}, 0)`}\n />\n {/* Plain-text label to the right of the bullet (Workato-style) */}\n <text x={railX + 14} y={4} fontSize={12} fontWeight={500}\n fill=\"var(--ff-text, #212121)\" style={{ fontFamily: 'sans-serif' }}>\n {b.label}\n </text>\n </g>\n );\n })}\n </svg>\n );\n};\n\nexport default BranchRailDecoration;\n","import React from 'react';\nimport { Handle, Position, NodeProps } from 'reactflow';\nimport { FiFilter } from 'react-icons/fi';\nimport { MdInfoOutline, MdOutlineModeEdit, MdDeleteOutline } from 'react-icons/md';\nimport { Tooltip } from '@mui/material';\nimport { useCanvasHandlers } from '../WorkflowCanvasContext';\nimport BranchRailDecoration, { BranchRailSpec } from './BranchRailDecoration';\n\ninterface Condition {\n field: string;\n operator: string;\n value: string;\n logicalOperator?: string;\n}\n\nconst FilterNode = ({ id, data }: NodeProps) => {\n const { onEditNode, onDeleteNode } = useCanvasHandlers();\n const { conditions = [], infoText = 'Filter conditions applied to workflow data', _branchRail } = data as { conditions?: Condition[]; infoText?: string; _branchRail?: BranchRailSpec };\n\n return (\n <div style={{ width: 350, position: 'relative' }}>\n <Handle type=\"target\" position={Position.Top} style={{ opacity: 0 }} />\n <div style={{ border: '1.5px solid #ffe082', borderRadius: 8, background: '#fff' }}>\n <div className=\"ff-d-flex ff-justify-content-between ff-align-items-center\" style={{ padding: '10px 6px' }}>\n <div className=\"ff-d-flex ff-align-items-center\">\n <div className=\"ff-d-flex ff-align-items-center ff-justify-content-center ff-rounded\" style={{ width: 25, height: 25, background: 'rgba(255,160,0,0.1)' }}>\n <FiFilter className=\"ff-text-warning\" size={16} />\n </div>\n <span className=\"ff-ms-2 ff-fw-medium ff-text-dark\" style={{ fontSize: 14 }}>Filter</span>\n </div>\n <div className=\"node-actions ff-d-flex ff-align-items-center\">\n <div\n role=\"button\" tabIndex={0}\n onClick={(e) => { e.stopPropagation(); onEditNode(id); }}\n onKeyDown={(e) => { if (e.key === 'Enter') { e.stopPropagation(); onEditNode(id); } }}\n >\n <MdOutlineModeEdit size={16} />\n </div>\n <div\n className=\"ff-ms-2\" role=\"button\" tabIndex={0}\n onClick={(e) => { e.stopPropagation(); onDeleteNode(id); }}\n onKeyDown={(e) => { if (e.key === 'Enter') { e.stopPropagation(); onDeleteNode(id); } }}\n >\n <MdDeleteOutline color=\"red\" size={16} />\n </div>\n <Tooltip title={infoText} placement=\"right\" arrow>\n <div className=\"ff-ms-2\"><MdInfoOutline color=\"gray\" size={16} /></div>\n </Tooltip>\n </div>\n </div>\n <div style={{ margin: '0 6px 10px', padding: '10px 12px', borderRadius: 6, background: '#fafafa', fontSize: 12 }}>\n {conditions.length === 0 ? (\n <span className=\"ff-text-muted\">No conditions configured</span>\n ) : conditions.map((condition, index) => (\n <div key={index} className=\"ff-d-flex ff-align-items-center ff-mb-1\">\n <p className=\"ff-m-0 ff-fw-bold ff-me-1 ff-text-truncate\" style={{ maxWidth: 100 }} title={condition.field}>{condition.field}</p>\n <span className=\"ff-text-muted\">{condition.operator}</span>\n <p className=\"ff-text-dark ff-text-truncate ff-mx-1 ff-m-0\" title={condition.value}>{condition.value}</p>\n {index < conditions.length - 1 && (\n <p className=\"ff-bg-primary ff-text-white ff-fw-bold ff-ms-1 ff-px-1 ff-rounded-1 ff-m-0\">{condition.logicalOperator}</p>\n )}\n </div>\n ))}\n </div>\n </div>\n <Handle type=\"source\" position={Position.Bottom} style={{ opacity: 0 }} />\n {_branchRail && <BranchRailDecoration rail={_branchRail} cardWidth={350} />}\n </div>\n );\n};\n\nexport default FilterNode;\n","import { ReactNode } from 'react';\nimport { Handle, Position, NodeProps } from 'reactflow';\nimport { MdInfoOutline, MdOutlineModeEdit, MdDeleteOutline } from 'react-icons/md';\nimport { Tooltip } from '@mui/material';\nimport { useCanvasHandlers } from '../WorkflowCanvasContext';\n\ninterface ActionNodeData {\n title?: string;\n descriptorType?: string;\n // groupBlocks shape (from IAM frontend)\n groupBlocks?: { groups?: string[]; isFallback?: boolean; isAlways?: boolean }[];\n // multi-select fields saved by the IAM task descriptors\n groups?: unknown;\n roles?: unknown;\n // flat fields saved by simple descriptors\n groupId?: unknown;\n roleId?: unknown;\n notes?: string;\n infoText?: string;\n}\n\nconst ActionNode = ({ id, data }: NodeProps) => {\n const { onEditNode, onDeleteNode, nodeRegistry, nodeBody = 'full' } = useCanvasHandlers();\n const { title = 'Task', descriptorType, groupBlocks, groups, roles, groupId, roleId, infoText = '' } = data as ActionNodeData;\n const descriptor = descriptorType ? nodeRegistry?.forType(descriptorType) : undefined;\n const icon: ReactNode = descriptor?.icon as ReactNode;\n\n const toDisplayString = (v: unknown): string => {\n if (v == null) return '';\n if (typeof v === 'string') return v;\n if (typeof v === 'object' && 'label' in (v as object)) return String((v as Record<string, unknown>).label);\n return String(v);\n };\n\n // Normalise a field that may be a single value or an array of values into a string list.\n const toList = (v: unknown): string[] =>\n Array.isArray(v) ? v.map(toDisplayString).filter(Boolean)\n : (v != null && v !== '' ? [toDisplayString(v)] : []);\n\n // Derive display values from groupBlocks (IAM shape), the multi-select groups/roles,\n // or the legacy flat groupId/roleId fields.\n const displayValues: string[] = groupBlocks?.flatMap((b) => b.groups ?? [])\n ?? [...toList(groups), ...toList(roles), ...toList(groupId), ...toList(roleId)];\n\n const configured = displayValues.length > 0;\n\n return (\n <div style={{ width: 350 }}>\n <Handle type=\"target\" position={Position.Top} style={{ opacity: 0 }} />\n <div style={{ border: '1.5px solid #b0bec5', borderRadius: 8, background: '#fff' }}>\n <div className=\"ff-d-flex ff-justify-content-between ff-align-items-center\" style={{ padding: '10px 6px' }}>\n <div className=\"ff-d-flex ff-align-items-center ff-gap-2\">\n {icon && <div style={{ display: 'flex', alignItems: 'center' }}>{icon as ReactNode}</div>}\n <span className=\"ff-text-dark\" style={{ fontSize: 14, fontWeight: 500 }}>{title}</span>\n </div>\n <div className=\"node-actions ff-d-flex ff-align-items-center\">\n <div\n role=\"button\" tabIndex={0}\n onClick={(e) => { e.stopPropagation(); onEditNode(id); }}\n onKeyDown={(e) => { if (e.key === 'Enter') { e.stopPropagation(); onEditNode(id); } }}\n >\n <MdOutlineModeEdit size={16} />\n </div>\n <div\n className=\"ff-ms-2\" role=\"button\" tabIndex={0}\n onClick={(e) => { e.stopPropagation(); onDeleteNode(id); }}\n onKeyDown={(e) => { if (e.key === 'Enter') { e.stopPropagation(); onDeleteNode(id); } }}\n >\n <MdDeleteOutline color=\"red\" size={16} />\n </div>\n {infoText && (\n <Tooltip title={infoText} placement=\"right\" arrow>\n <div className=\"ff-ms-2\"><MdInfoOutline color=\"gray\" size={16} /></div>\n </Tooltip>\n )}\n </div>\n </div>\n\n {nodeBody !== 'title-only' && (\n <div style={{ margin: '0 6px 10px', padding: '10px 12px', borderRadius: 6, background: '#fafafa', fontSize: 12 }}>\n {descriptor?.renderNode ? (\n descriptor.renderNode(data as Record<string, unknown>)\n ) : configured ? (\n <div className=\"ff-d-flex ff-flex-wrap ff-gap-1\">\n {displayValues.map((v, i) => (\n <span key={i} className=\"ff-badge ff-bg-dark ff-text-white ff-py-1 ff-px-2 ff-rounded\" style={{ fontSize: 11 }} title={v}>{v}</span>\n ))}\n </div>\n ) : (\n <span className=\"ff-text-muted\">Not configured</span>\n )}\n </div>\n )}\n </div>\n <Handle type=\"source\" position={Position.Bottom} style={{ opacity: 0 }} />\n </div>\n );\n};\n\nexport default ActionNode;\n","import React from 'react';\nimport { Handle, Position, NodeProps } from 'reactflow';\nimport { MdOutlineModeEdit, MdDeleteOutline, MdInfoOutline, MdCheckCircle, MdPeople } from 'react-icons/md';\nimport { Tooltip } from '@mui/material';\nimport { useCanvasHandlers } from '../WorkflowCanvasContext';\nimport BranchRailDecoration, { BranchRailSpec } from './BranchRailDecoration';\n\nconst MAX_VISIBLE_STAGES = 5;\n\ninterface Stage {\n stageName?: string;\n userIds?: string[];\n groupName?: string;\n roleName?: string;\n}\n\ninterface ApprovalPolicy {\n name?: string;\n policyName?: string;\n stages?: Stage[];\n}\n\ninterface ApprovalNodeData {\n approvalData?: { policy?: ApprovalPolicy };\n isPreview?: boolean;\n _branchRail?: BranchRailSpec;\n}\n\nconst ApprovalNode = ({ id, data }: NodeProps) => {\n const { onEditNode, onDeleteNode } = useCanvasHandlers();\n const { approvalData, isPreview = false, _branchRail } = data as ApprovalNodeData;\n\n const policy = approvalData?.policy ?? {};\n const stages = policy.stages ?? [];\n const stageCount = stages.length;\n const visibleStages = stages.slice(0, MAX_VISIBLE_STAGES);\n const remainingStages = stageCount - MAX_VISIBLE_STAGES;\n const policyName = policy.name ?? policy.policyName ?? 'Untitled Policy';\n\n return (\n <div style={{ width: 350, position: 'relative' }}>\n <Handle type=\"target\" position={Position.Top} style={{ opacity: 0 }} />\n <div style={{ border: '1.5px solid #ffe082', borderRadius: 8, background: '#fff' }}>\n <div className=\"ff-d-flex ff-justify-content-between ff-align-items-center\" style={{ padding: '10px 6px' }}>\n <div className=\"ff-d-flex ff-align-items-center ff-gap-2\">\n <div className=\"ff-d-flex ff-align-items-center ff-justify-content-center ff-rounded\" style={{ width: 25, height: 25, background: 'rgba(251,192,45,0.2)' }}>\n <MdCheckCircle style={{ color: '#FBC02D' }} size={16} />\n </div>\n <span className=\"ff-fw-medium ff-text-dark\" style={{ fontSize: 14 }}>Approval Policy</span>\n </div>\n <div className=\"node-actions ff-d-flex ff-align-items-center\">\n {!isPreview && (\n <div\n role=\"button\" tabIndex={0} style={{ cursor: 'pointer' }}\n onClick={(e) => { e.stopPropagation(); onEditNode(id); }}\n onKeyDown={(e) => { if (e.key === 'Enter') { e.stopPropagation(); onEditNode(id); } }}\n >\n <MdOutlineModeEdit size={16} className=\"ff-text-secondary\" />\n </div>\n )}\n {!isPreview && (\n <div\n className=\"ff-ms-2\" role=\"button\" tabIndex={0} style={{ cursor: 'pointer' }}\n onClick={(e) => { e.stopPropagation(); onDeleteNode(id); }}\n onKeyDown={(e) => { if (e.key === 'Enter') { e.stopPropagation(); onDeleteNode(id); } }}\n >\n <MdDeleteOutline color=\"red\" size={16} />\n </div>\n )}\n <Tooltip title=\"This approval policy determines who must approve a request before the workflow continues.\" arrow placement=\"right\">\n <span className=\"ff-ms-2 ff-d-inline-flex\"><MdInfoOutline color=\"gray\" size={16} /></span>\n </Tooltip>\n </div>\n </div>\n\n <div style={{ margin: '0 6px 10px', padding: '10px 12px', borderRadius: 6, background: '#FCFCFC' }}>\n <div className=\"ff-d-flex ff-justify-content-start ff-align-items-center ff-mb-2\">\n <h6 className=\"ff-text-dark ff-mb-0 ff-text-truncate ff-flex-grow-1 ff-me-2\" style={{ fontSize: 13, fontWeight: 700 }} title={policyName}>\n {policyName}\n </h6>\n <span className=\"ff-badge ff-rounded-pill ff-px-2 ff-py-1 ff-flex-shrink-0\" style={{ background: '#FFF9C4', color: '#616161', fontSize: 11, fontWeight: 600 }}>\n {stageCount} Stage{stageCount !== 1 ? 's' : ''}\n </span>\n </div>\n\n {stages.length > 0 ? (\n <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>\n {visibleStages.map((stage, index) => {\n const displayName = stage.stageName?.trim() || `Stage ${index + 1}`;\n const approverCount = Array.isArray(stage.userIds) ? stage.userIds.length : 0;\n const groupName = stage.groupName?.trim() ?? '';\n const roleName = stage.roleName?.trim() ?? '';\n const configured = approverCount > 0 || groupName || roleName;\n let stageLabel = 'Not configured';\n if (groupName) stageLabel = `Group: ${groupName}`;\n else if (roleName) stageLabel = `Role: ${roleName}`;\n else if (approverCount > 0) stageLabel = `${approverCount} approver${approverCount !== 1 ? 's' : ''}`;\n return (\n <div key={index} className=\"ff-d-flex ff-align-items-center ff-gap-2\">\n <div className=\"ff-rounded-circle ff-d-flex ff-align-items-center ff-justify-content-center ff-flex-shrink-0\" style={{ width: 28, height: 28, background: '#FFF9C4', color: '#5D4037', fontSize: 12, fontWeight: 700 }}>\n {index + 1}\n </div>\n <div className=\"ff-flex-grow-1 ff-rounded ff-p-2 ff-d-flex ff-justify-content-between ff-align-items-center ff-border\" style={{ background: '#FFFDE7', borderColor: '#FEE79A' }}>\n <span style={{ fontSize: 12, fontWeight: 700, color: '#212121' }}>{displayName}</span>\n <span className={`ff-d-flex ff-align-items-center ff-gap-1 ${configured ? 'ff-text-dark' : 'ff-text-muted'}`} style={{ fontSize: 12 }}>\n <MdPeople size={16} className=\"ff-flex-shrink-0\" style={{ color: configured ? '#5D4037' : '#9E9E9E' }} />\n {stageLabel}\n </span>\n </div>\n </div>\n );\n })}\n {remainingStages > 0 && (\n <div\n className=\"ff-text-center ff-fw-bold ff-py-2 ff-border ff-rounded\"\n style={{ fontSize: 11, color: '#1976d2', borderColor: '#FEE79A', background: '#FFFDE7', borderStyle: 'dashed', cursor: isPreview ? 'default' : 'pointer' }}\n role={isPreview ? undefined : 'button'}\n tabIndex={isPreview ? undefined : 0}\n onClick={(e) => { if (isPreview) return; e.stopPropagation(); onEditNode(id); }}\n onKeyDown={(e) => { if (isPreview || e.key !== 'Enter') return; e.stopPropagation(); onEditNode(id); }}\n >\n + {remainingStages} More Stage{remainingStages > 1 ? 's' : ''}\n </div>\n )}\n </div>\n ) : (\n <div className=\"ff-text-center ff-py-3 ff-rounded ff-border\" style={{ fontSize: 12, color: '#9e9e9e', background: '#FFFDE7', borderColor: '#FEE79A', borderStyle: 'dashed' }}>\n No stages configured\n </div>\n )}\n </div>\n </div>\n <Handle type=\"source\" position={Position.Bottom} style={{ opacity: 0 }} />\n {_branchRail && <BranchRailDecoration rail={_branchRail} cardWidth={350} />}\n </div>\n );\n};\n\nexport default ApprovalNode;\n","import React from 'react';\r\nimport { Handle, Position, NodeProps } from 'reactflow';\r\nimport { MdOutlineModeEdit, MdDeleteOutline, MdSchedule } from 'react-icons/md';\r\nimport { useCanvasHandlers } from '../WorkflowCanvasContext';\r\n\r\ninterface DelayNodeData {\r\n duration?: number;\r\n unit?: 'minutes' | 'hours' | 'days';\r\n}\r\n\r\nconst DelayNode = ({ id, data }: NodeProps) => {\r\n const { onEditNode, onDeleteNode } = useCanvasHandlers();\r\n const { duration, unit } = data as DelayNodeData;\r\n const configured = duration !== undefined && duration !== null && unit;\r\n const displayText = configured ? `Wait ${duration} ${unit}` : 'Not configured';\r\n\r\n return (\r\n <div style={{ width: 350 }}>\r\n <Handle type=\"target\" position={Position.Top} style={{ opacity: 0 }} />\r\n <div style={{ border: '1.5px solid #b0bec5', borderRadius: 8, background: '#fff' }}>\r\n <div className=\"ff-d-flex ff-justify-content-between ff-align-items-center ff-mx-2 ff-mt-2 ff-mb-1\">\r\n <div className=\"ff-d-flex ff-align-items-center ff-gap-2\">\r\n <div className=\"ff-d-flex ff-align-items-center ff-justify-content-center ff-rounded\" style={{ width: 25, height: 25, background: 'rgba(33,150,243,0.1)' }}>\r\n <MdSchedule size={16} color=\"#1976d2\" />\r\n </div>\r\n <span className=\"ff-fw-medium ff-text-dark\" style={{ fontSize: 14 }}>Delay</span>\r\n </div>\r\n <div className=\"node-actions ff-d-flex ff-align-items-center\">\r\n <div\r\n role=\"button\" tabIndex={0}\r\n onClick={(e) => { e.stopPropagation(); onEditNode(id); }}\r\n onKeyDown={(e) => { if (e.key === 'Enter') { e.stopPropagation(); onEditNode(id); } }}\r\n >\r\n <MdOutlineModeEdit size={16} />\r\n </div>\r\n <div\r\n className=\"ff-ms-2\" role=\"button\" tabIndex={0}\r\n onClick={(e) => { e.stopPropagation(); onDeleteNode(id); }}\r\n onKeyDown={(e) => { if (e.key === 'Enter') { e.stopPropagation(); onDeleteNode(id); } }}\r\n >\r\n <MdDeleteOutline color=\"red\" size={16} />\r\n </div>\r\n </div>\r\n </div>\r\n <div className=\"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded\" style={{ background: '#fafafa', fontSize: 12 }}>\r\n <span className={configured ? 'ff-text-dark ff-fw-medium' : 'ff-text-muted'}>{displayText}</span>\r\n </div>\r\n </div>\r\n <Handle type=\"source\" position={Position.Bottom} style={{ opacity: 0 }} />\r\n </div>\r\n );\r\n};\r\n\r\nexport default DelayNode;\r\n","import React from 'react';\nimport { Handle, Position, NodeProps } from 'reactflow';\nimport { MdOutlineModeEdit, MdDeleteOutline, MdNotifications, MdEmail, MdSms, MdWebhook } from 'react-icons/md';\nimport { useCanvasHandlers } from '../WorkflowCanvasContext';\nimport { NODE_WIDTH } from '../canvasTokens';\n\ninterface NotificationNodeData {\n channel?: string;\n emailTo?: string[];\n emailSubject?: string;\n slackChannel?: string;\n slackMessage?: string;\n teamsMessage?: string;\n smsTo?: string;\n inAppRecipient?: string;\n inAppTitle?: string;\n webhookUrl?: string;\n // legacy shape\n recipient?: string;\n subject?: string;\n}\n\ninterface ChannelMeta {\n label: string;\n bg: string;\n color: string;\n iconType: React.ElementType;\n}\n\nconst CHANNEL_META: Record<string, ChannelMeta> = {\n email: { label: 'Email', bg: '#e3f2fd', color: '#1565c0', iconType: MdEmail },\n slack: { label: 'Slack', bg: '#e8f5e9', color: '#2e7d32', iconType: MdNotifications },\n teams: { label: 'MS Teams', bg: '#ede7f6', color: '#4527a0', iconType: MdNotifications },\n sms: { label: 'SMS', bg: '#fce4ec', color: '#880e4f', iconType: MdSms },\n 'in-app': { label: 'In-App', bg: '#fff3e0', color: '#e65100', iconType: MdNotifications },\n webhook: { label: 'Webhook', bg: '#f3e5f5', color: '#6a1b9a', iconType: MdWebhook },\n};\n\nconst FALLBACK_META: ChannelMeta = {\n label: 'Notification',\n bg: 'rgba(156,39,176,0.1)',\n color: '#7b1fa2',\n iconType: MdNotifications,\n};\n\nfunction getRecipientPreview(data: NotificationNodeData): string | null {\n switch (data.channel) {\n case 'email': return data.emailTo?.join(', ') ?? data.recipient ?? null;\n case 'slack': return data.slackChannel ?? null;\n case 'teams': return data.teamsMessage ? 'Message configured' : null;\n case 'sms': return data.smsTo ?? null;\n case 'in-app': return data.inAppRecipient ?? null;\n case 'webhook': return data.webhookUrl ?? null;\n default: return data.recipient ?? null;\n }\n}\n\nfunction getSubjectPreview(data: NotificationNodeData): string | null {\n switch (data.channel) {\n case 'email': return data.emailSubject ?? data.subject ?? null;\n case 'slack': {\n const msg = data.slackMessage;\n return msg ? (msg.length > 60 ? `${msg.slice(0, 60)}…` : msg) : null;\n }\n case 'in-app': return data.inAppTitle ?? null;\n default: return data.subject ?? null;\n }\n}\n\nconst NotificationNode = ({ id, data }: NodeProps) => {\n const { onEditNode, onDeleteNode } = useCanvasHandlers();\n const d = data as NotificationNodeData;\n const meta = (d.channel && CHANNEL_META[d.channel]) ? CHANNEL_META[d.channel] : FALLBACK_META;\n const recipient = getRecipientPreview(d);\n const subjectLine = getSubjectPreview(d);\n const configured = !!(d.channel && recipient);\n const IconComponent = meta.iconType;\n\n return (\n <div style={{ width: NODE_WIDTH }}>\n <Handle type=\"target\" position={Position.Top} style={{ opacity: 0 }} />\n <div style={{ border: '1.5px solid #b0bec5', borderRadius: 8, background: '#fff' }}>\n <div className=\"ff-d-flex ff-justify-content-between ff-align-items-center\" style={{ padding: '10px 6px' }}>\n <div className=\"ff-d-flex ff-align-items-center ff-gap-2\">\n <div className=\"ff-d-flex ff-align-items-center ff-justify-content-center ff-rounded\" style={{ width: 25, height: 25, background: meta.bg }}>\n <IconComponent size={16} color={meta.color} />\n </div>\n <span className=\"ff-fw-medium ff-text-dark\" style={{ fontSize: 14 }}>\n {d.channel ? `${meta.label} Notification` : 'Notification'}\n </span>\n </div>\n <div className=\"node-actions ff-d-flex ff-align-items-center\">\n <div\n role=\"button\" tabIndex={0}\n onClick={(e) => { e.stopPropagation(); onEditNode(id); }}\n onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => { if (e.key === 'Enter' || e.key === ' ') { e.stopPropagation(); onEditNode(id); } }}\n >\n <MdOutlineModeEdit size={16} />\n </div>\n <div\n className=\"ff-ms-2\" role=\"button\" tabIndex={0}\n onClick={(e) => { e.stopPropagation(); onDeleteNode(id); }}\n onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => { if (e.key === 'Enter' || e.key === ' ') { e.stopPropagation(); onDeleteNode(id); } }}\n >\n <MdDeleteOutline color=\"red\" size={16} />\n </div>\n </div>\n </div>\n\n <div style={{ margin: '0 6px 10px', padding: '10px 12px', borderRadius: 6, background: '#fafafa', fontSize: 12 }}>\n {configured ? (\n <div className=\"ff-d-flex ff-flex-column ff-gap-1\">\n <div className=\"ff-d-flex ff-align-items-center ff-gap-2\">\n <span className=\"ff-px-2 ff-py-1 ff-rounded\" style={{ fontSize: 10, background: meta.bg, color: meta.color, fontWeight: 600, flexShrink: 0 }}>\n {meta.label}\n </span>\n <span className=\"ff-text-dark ff-text-truncate\" style={{ maxWidth: 220 }}>{recipient}</span>\n </div>\n {subjectLine && <span className=\"ff-text-muted ff-text-truncate\" style={{ maxWidth: 280 }}>{subjectLine}</span>}\n </div>\n ) : (\n <span className=\"ff-text-muted\">Not configured</span>\n )}\n </div>\n </div>\n <Handle type=\"source\" position={Position.Bottom} style={{ opacity: 0 }} />\n </div>\n );\n};\n\nexport default NotificationNode;\n","import React from 'react';\nimport { Handle, Position, NodeProps } from 'reactflow';\nimport { MdOutlineModeEdit, MdContentCopy, MdWebhook } from 'react-icons/md';\nimport { Tooltip } from '@mui/material';\nimport { useCanvasHandlers } from '../WorkflowCanvasContext';\nimport { NODE_WIDTH } from '../canvasTokens';\n\ninterface WebhookTriggerNodeData {\n label?: string;\n endpointUrl?: string;\n authMethod?: 'none' | 'api-key' | 'hmac';\n source?: string;\n}\n\nconst AUTH_LABELS: Record<string, string> = {\n 'api-key': 'API Key',\n hmac: 'HMAC',\n};\n\nconst WebhookTriggerNode = ({ data }: NodeProps) => {\n const { onClickAddTrigger } = useCanvasHandlers();\n const { label = 'Webhook Trigger', endpointUrl, authMethod, source } = data as WebhookTriggerNodeData;\n\n const handleEdit = (e: React.MouseEvent | React.KeyboardEvent) => {\n e.stopPropagation();\n onClickAddTrigger();\n };\n\n const handleCopy = (e: React.MouseEvent | React.KeyboardEvent) => {\n e.stopPropagation();\n if (endpointUrl) navigator.clipboard.writeText(endpointUrl).catch(() => undefined);\n };\n\n return (\n <div style={{ width: NODE_WIDTH }}>\n <Handle type=\"target\" position={Position.Top} style={{ opacity: 0 }} />\n <div style={{ border: '1.5px solid #90caf9', borderRadius: 8, background: '#fff', overflow: 'hidden' }}>\n <div className=\"ff-d-flex ff-justify-content-between ff-align-items-center\" style={{ padding: '10px 6px' }}>\n <div className=\"ff-d-flex ff-align-items-center ff-gap-2\">\n <div style={{ width: 28, height: 28, borderRadius: 6, background: 'rgba(33,150,243,0.1)', display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>\n <MdWebhook size={16} color=\"#1565c0\" />\n </div>\n <span style={{ fontSize: 13, fontWeight: 600, color: '#212121' }}>Webhook Trigger</span>\n </div>\n <div\n role=\"button\"\n tabIndex={0}\n onClick={handleEdit}\n onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => { if (e.key === 'Enter' || e.key === ' ') handleEdit(e); }}\n className=\"ff-d-flex ff-align-items-center\"\n style={{ paddingRight: 4, cursor: 'pointer' }}\n >\n <MdOutlineModeEdit size={16} color=\"#555\" />\n </div>\n </div>\n\n <div style={{ margin: '0 6px 10px', padding: '10px 12px', borderRadius: 6, background: '#e3f2fd', border: '1px solid #90caf9' }}>\n <div className=\"ff-d-flex ff-align-items-center ff-flex-wrap ff-gap-2 ff-mb-1\">\n <span style={{ fontSize: 12, color: '#1565c0', fontWeight: 600 }}>{label}</span>\n {source && (\n <span className=\"ff-px-2 ff-py-1 ff-rounded\" style={{ fontSize: 11, background: '#fff', border: '1px solid #90caf9', color: '#1565c0' }}>\n {source}\n </span>\n )}\n {authMethod && authMethod !== 'none' && AUTH_LABELS[authMethod] && (\n <span className=\"ff-px-2 ff-py-1 ff-rounded\" style={{ fontSize: 10, background: '#1565c0', color: '#fff', fontWeight: 600 }}>\n {AUTH_LABELS[authMethod]}\n </span>\n )}\n </div>\n {endpointUrl && (\n <div className=\"ff-d-flex ff-align-items-center ff-gap-1\" style={{ marginTop: 4 }}>\n <span style={{ fontSize: 10, color: '#1565c0', fontFamily: 'monospace', flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>\n {endpointUrl}\n </span>\n <Tooltip title=\"Copy URL\" placement=\"top\" arrow>\n <div\n role=\"button\"\n tabIndex={0}\n onClick={handleCopy}\n onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => { if (e.key === 'Enter' || e.key === ' ') handleCopy(e); }}\n style={{ cursor: 'pointer', flexShrink: 0 }}\n >\n <MdContentCopy size={12} color=\"#1565c0\" />\n </div>\n </Tooltip>\n </div>\n )}\n </div>\n </div>\n <Handle type=\"source\" position={Position.Bottom} style={{ opacity: 0 }} />\n </div>\n );\n};\n\nexport default WebhookTriggerNode;\n","import React, { ReactNode } from 'react';\nimport { Handle, Position, NodeProps } from 'reactflow';\nimport { MdOutlineModeEdit, MdDeleteOutline, MdHttp } from 'react-icons/md';\nimport { useCanvasHandlers } from '../WorkflowCanvasContext';\nimport { NODE_WIDTH, HTTP_METHOD_STYLE } from '../canvasTokens';\n\ninterface RestApiNodeData {\n method?: string;\n url?: string;\n descriptorType?: string;\n}\n\nconst RestApiNode = ({ id, data }: NodeProps) => {\n const { onEditNode, onDeleteNode, nodeRegistry } = useCanvasHandlers();\n const { method, url, descriptorType } = data as RestApiNodeData;\n const icon: ReactNode = descriptorType\n ? (nodeRegistry?.forType(descriptorType)?.icon as ReactNode)\n : <MdHttp size={16} color=\"#546e7a\" />;\n const configured = !!(method && url);\n const methodKey = method?.toUpperCase() ?? '';\n const methodStyle = HTTP_METHOD_STYLE[methodKey] ?? null;\n\n return (\n <div style={{ width: NODE_WIDTH }}>\n <Handle type=\"target\" position={Position.Top} style={{ opacity: 0 }} />\n <div style={{ border: '1.5px solid #b0bec5', borderRadius: 8, background: '#fff' }}>\n <div className=\"ff-d-flex ff-justify-content-between ff-align-items-center\" style={{ padding: '10px 6px' }}>\n <div className=\"ff-d-flex ff-align-items-center ff-gap-2\">\n <div style={{ width: 25, height: 25, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>\n {icon as ReactNode}\n </div>\n <span className=\"ff-fw-medium ff-text-dark\" style={{ fontSize: 14 }}>REST API Call</span>\n </div>\n <div className=\"node-actions ff-d-flex ff-align-items-center\">\n <div\n role=\"button\" tabIndex={0}\n onClick={(e) => { e.stopPropagation(); onEditNode(id); }}\n onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => { if (e.key === 'Enter' || e.key === ' ') { e.stopPropagation(); onEditNode(id); } }}\n >\n <MdOutlineModeEdit size={16} />\n </div>\n <div\n className=\"ff-ms-2\" role=\"button\" tabIndex={0}\n onClick={(e) => { e.stopPropagation(); onDeleteNode(id); }}\n onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => { if (e.key === 'Enter' || e.key === ' ') { e.stopPropagation(); onDeleteNode(id); } }}\n >\n <MdDeleteOutline color=\"red\" size={16} />\n </div>\n </div>\n </div>\n\n <div style={{ margin: '0 6px 10px', padding: '10px 12px', borderRadius: 6, background: '#fafafa', fontSize: 12 }}>\n {configured ? (\n <div className=\"ff-d-flex ff-align-items-center ff-gap-2\">\n {methodStyle && (\n <span style={{ fontSize: 10, fontWeight: 700, padding: '2px 6px', borderRadius: 4, background: methodStyle.bg, color: methodStyle.color, flexShrink: 0 }}>\n {methodKey}\n </span>\n )}\n <span className=\"ff-text-dark ff-text-truncate\" style={{ fontFamily: 'monospace', fontSize: 11 }} title={url}>{url}</span>\n </div>\n ) : (\n <span className=\"ff-text-muted\">Not configured</span>\n )}\n </div>\n </div>\n <Handle type=\"source\" position={Position.Bottom} style={{ opacity: 0 }} />\n </div>\n );\n};\n\nexport default RestApiNode;\n","import React from 'react';\nimport { Handle, Position, NodeProps } from 'reactflow';\nimport { MdOutlineModeEdit, MdDeleteOutline, MdCallSplit } from 'react-icons/md';\nimport { useCanvasHandlers } from '../WorkflowCanvasContext';\nimport { NODE_WIDTH, BRANCH_PALETTE } from '../canvasTokens';\n\ninterface BranchCondition {\n field: string;\n operator: string;\n value?: string;\n logicalOperator?: string;\n}\n\ninterface BranchConfig {\n key: string;\n label: string;\n conditions?: BranchCondition[];\n}\n\ninterface ConditionBranchNodeData {\n title?: string;\n branchConfigs?: BranchConfig[];\n defaultBranch?: string;\n}\n\nconst OPERATOR_LABELS: Record<string, string> = {\n eq: '=', neq: '≠', gt: '>', gte: '≥', lt: '<', lte: '≤',\n contains: 'contains', startsWith: 'starts with', endsWith: 'ends with',\n isEmpty: 'is empty', isNotEmpty: 'is not empty',\n};\n\nconst ConditionBranchNode = ({ id, data }: NodeProps) => {\n const { onEditNode, onDeleteNode } = useCanvasHandlers();\n const { title = 'Condition Branch', branchConfigs = [], defaultBranch } = data as ConditionBranchNodeData;\n const configured = branchConfigs.length > 0;\n\n return (\n <div style={{ width: NODE_WIDTH }}>\n <Handle type=\"target\" position={Position.Top} style={{ opacity: 0 }} />\n <div style={{ border: '1.5px solid #b39ddb', borderRadius: 8, background: '#fff' }}>\n <div className=\"ff-d-flex ff-justify-content-between ff-align-items-center\" style={{ padding: '10px 6px' }}>\n <div className=\"ff-d-flex ff-align-items-center ff-gap-2\">\n <div style={{ width: 25, height: 25, borderRadius: 6, background: 'rgba(103,58,183,0.1)', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>\n <MdCallSplit size={16} color=\"#512da8\" />\n </div>\n <span className=\"ff-fw-medium ff-text-dark\" style={{ fontSize: 14 }}>{title}</span>\n </div>\n <div className=\"node-actions ff-d-flex ff-align-items-center\">\n <div\n role=\"button\" tabIndex={0}\n onClick={(e) => { e.stopPropagation(); onEditNode(id); }}\n onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => { if (e.key === 'Enter' || e.key === ' ') { e.stopPropagation(); onEditNode(id); } }}\n >\n <MdOutlineModeEdit size={16} />\n </div>\n <div\n className=\"ff-ms-2\" role=\"button\" tabIndex={0}\n onClick={(e) => { e.stopPropagation(); onDeleteNode(id); }}\n onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => { if (e.key === 'Enter' || e.key === ' ') { e.stopPropagation(); onDeleteNode(id); } }}\n >\n <MdDeleteOutline color=\"red\" size={16} />\n </div>\n </div>\n </div>\n\n <div style={{ margin: '0 6px 10px', padding: '10px 12px', borderRadius: 6, background: '#fafafa', fontSize: 12 }}>\n {configured ? (\n <div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>\n {branchConfigs.map((branch, idx) => {\n const palette = BRANCH_PALETTE[idx % BRANCH_PALETTE.length];\n const firstCondition = branch.conditions?.[0];\n const extraCount = (branch.conditions?.length ?? 0) - 1;\n return (\n <div key={branch.key} style={{ display: 'flex', alignItems: 'center', gap: 6 }}>\n <span style={{ fontSize: 10, fontWeight: 600, padding: '2px 7px', borderRadius: 10, background: palette.bg, color: palette.color, flexShrink: 0 }}>\n {branch.label || branch.key}\n </span>\n {firstCondition ? (\n <span style={{ fontSize: 11, color: '#616161', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>\n {firstCondition.field} {OPERATOR_LABELS[firstCondition.operator] ?? firstCondition.operator}\n {firstCondition.value ? ` ${firstCondition.value}` : ''}\n {extraCount > 0 ? ` +${extraCount} more` : ''}\n </span>\n ) : (\n <span style={{ fontSize: 11, color: '#9e9e9e' }}>No conditions yet</span>\n )}\n </div>\n );\n })}\n {defaultBranch && (\n <div style={{ display: 'flex', alignItems: 'center', gap: 6, marginTop: 2 }}>\n <span style={{ fontSize: 10, fontWeight: 600, padding: '2px 7px', borderRadius: 10, background: '#f5f5f5', color: '#757575', flexShrink: 0 }}>\n Default\n </span>\n <span style={{ fontSize: 11, color: '#9e9e9e' }}>fallback path</span>\n </div>\n )}\n </div>\n ) : (\n <span className=\"ff-text-muted\">Not configured — click edit to add branches</span>\n )}\n </div>\n </div>\n <Handle type=\"source\" position={Position.Bottom} style={{ opacity: 0 }} />\n </div>\n );\n};\n\nexport default ConditionBranchNode;\n","import React, { ReactNode } from 'react';\nimport { Handle, Position, NodeProps } from 'reactflow';\nimport { MdOutlineModeEdit, MdDeleteOutline, MdAccountTree, MdOpenInNew } from 'react-icons/md';\nimport { useCanvasHandlers } from '../WorkflowCanvasContext';\nimport { NODE_WIDTH } from '../canvasTokens';\n\ninterface SubWorkflowNodeData {\n title?: string;\n workflowId?: string;\n workflowLabel?: string;\n descriptorType?: string;\n onPreview?: (workflowId: string) => void;\n}\n\nconst SubWorkflowNode = ({ id, data }: NodeProps) => {\n const { onEditNode, onDeleteNode, nodeRegistry } = useCanvasHandlers();\n const { title = 'Sub-Workflow', workflowId, workflowLabel, descriptorType, onPreview } = data as SubWorkflowNodeData;\n const icon: ReactNode = descriptorType\n ? (nodeRegistry?.forType(descriptorType)?.icon as ReactNode)\n : <MdAccountTree size={16} color=\"#00695c\" />;\n const configured = !!workflowId;\n\n const handlePreview = (e: React.MouseEvent | React.KeyboardEvent) => {\n e.stopPropagation();\n if (workflowId && onPreview) onPreview(workflowId);\n };\n\n return (\n <div style={{ width: NODE_WIDTH }}>\n <Handle type=\"target\" position={Position.Top} style={{ opacity: 0 }} />\n <div style={{ border: '1.5px solid #80cbc4', borderRadius: 8, background: '#fff' }}>\n <div className=\"ff-d-flex ff-justify-content-between ff-align-items-center\" style={{ padding: '10px 6px' }}>\n <div className=\"ff-d-flex ff-align-items-center ff-gap-2\">\n <div style={{ width: 25, height: 25, borderRadius: 6, background: 'rgba(0,137,123,0.1)', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>\n {icon as ReactNode}\n </div>\n <span className=\"ff-fw-medium ff-text-dark\" style={{ fontSize: 14 }}>{title}</span>\n </div>\n <div className=\"node-actions ff-d-flex ff-align-items-center\">\n <div\n role=\"button\" tabIndex={0}\n onClick={(e) => { e.stopPropagation(); onEditNode(id); }}\n onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => { if (e.key === 'Enter' || e.key === ' ') { e.stopPropagation(); onEditNode(id); } }}\n >\n <MdOutlineModeEdit size={16} />\n </div>\n <div\n className=\"ff-ms-2\" role=\"button\" tabIndex={0}\n onClick={(e) => { e.stopPropagation(); onDeleteNode(id); }}\n onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => { if (e.key === 'Enter' || e.key === ' ') { e.stopPropagation(); onDeleteNode(id); } }}\n >\n <MdDeleteOutline color=\"red\" size={16} />\n </div>\n </div>\n </div>\n\n <div style={{ margin: '0 6px 10px', padding: '10px 12px', borderRadius: 6, background: configured ? '#e0f2f1' : '#fafafa', fontSize: 12, border: configured ? '1px solid #b2dfdb' : 'none' }}>\n {configured ? (\n <div className=\"ff-d-flex ff-align-items-center ff-justify-content-between\">\n <div className=\"ff-d-flex ff-flex-column ff-gap-1\">\n <span style={{ fontSize: 12, fontWeight: 600, color: '#00695c' }}>\n {workflowLabel || workflowId}\n </span>\n <span style={{ fontSize: 10, color: '#80cbc4', fontFamily: 'monospace' }}>ID: {workflowId}</span>\n </div>\n {onPreview && (\n <div\n role=\"button\"\n tabIndex={0}\n onClick={handlePreview}\n onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => { if (e.key === 'Enter' || e.key === ' ') handlePreview(e); }}\n style={{ cursor: 'pointer', display: 'flex', alignItems: 'center', gap: 3, fontSize: 11, color: '#00897b' }}\n >\n <MdOpenInNew size={13} />\n Preview\n </div>\n )}\n </div>\n ) : (\n <span className=\"ff-text-muted\">Not configured — select a workflow</span>\n )}\n </div>\n </div>\n <Handle type=\"source\" position={Position.Bottom} style={{ opacity: 0 }} />\n </div>\n );\n};\n\nexport default SubWorkflowNode;\n","import { NodeTypes } from 'reactflow';\r\nimport StartNode from './StartNode';\r\nimport EndNode from './EndNode';\r\nimport AddTriggerNode from './AddTriggerNode';\r\nimport AddStepNode from './AddStepNode';\r\nimport TriggerNode from './TriggerNode';\r\nimport EventNode from './EventNode';\r\nimport FilterNode from './FilterNode';\r\nimport ActionNode from './ActionNode';\r\nimport ApprovalNode from './ApprovalNode';\r\nimport DelayNode from './DelayNode';\r\nimport NotificationNode from './NotificationNode';\r\nimport WebhookTriggerNode from './WebhookTriggerNode';\r\nimport RestApiNode from './RestApiNode';\r\nimport ConditionBranchNode from './ConditionBranchNode';\r\nimport SubWorkflowNode from './SubWorkflowNode';\r\n\r\nexport const builtInNodeTypes: NodeTypes = {\r\n startNode: StartNode,\r\n endNode: EndNode,\r\n addTriggerNode: AddTriggerNode,\r\n addStepNode: AddStepNode,\r\n triggerNode: TriggerNode,\r\n eventNode: EventNode,\r\n filterNode: FilterNode,\r\n actionNode: ActionNode,\r\n approvalNode: ApprovalNode,\r\n delayNode: DelayNode,\r\n notificationNode: NotificationNode,\r\n webhookTriggerNode: WebhookTriggerNode,\r\n restApiNode: RestApiNode,\r\n conditionBranchNode: ConditionBranchNode,\r\n subWorkflowNode: SubWorkflowNode,\r\n};\r\n\r\nexport { StartNode, EndNode, AddTriggerNode, AddStepNode, TriggerNode, EventNode, FilterNode, ActionNode, ApprovalNode, DelayNode, NotificationNode, WebhookTriggerNode, RestApiNode, ConditionBranchNode, SubWorkflowNode };\r\n","import React from 'react';\r\nimport { getStraightPath, BaseEdge, EdgeProps } from 'reactflow';\r\nimport './EdgeWithPlusLabel.scss';\r\n\r\nconst R = 11.5;\r\nconst STROKE = 2;\r\nconst PLUS_HALF = 6;\r\nconst PILL_WIDTH = 40;\r\nconst PILL_HEIGHT = 20;\r\nconst PILL_R = 4;\r\n\r\nexport interface EdgeWithPlusLabelData {\r\n label?: string;\r\n onAddStepClick?: (sourceNodeId: string, context: AddStepContext) => void;\r\n referenceNodeType?: string;\r\n stepVisibility?: unknown;\r\n}\r\n\r\nexport interface AddStepContext {\r\n edgeId: string;\r\n nodeId: string;\r\n sourceNodeId: string;\r\n targetNodeId: string;\r\n position: 'between';\r\n referenceNodeId: string;\r\n referenceNodeType?: string;\r\n stepVisibility?: unknown;\r\n // branch context — set when this edge is inside a filter branch\r\n filterId?: string;\r\n branch?: string;\r\n}\r\n\r\nconst EdgeWithPlusLabel = ({\r\n id: edgeId,\r\n sourceX,\r\n sourceY,\r\n targetX,\r\n targetY,\r\n sourcePosition,\r\n targetPosition,\r\n source,\r\n target,\r\n data,\r\n}: EdgeProps<EdgeWithPlusLabelData>) => {\r\n const [edgePath, labelX, labelY] = getStraightPath({\r\n sourceX,\r\n sourceY,\r\n targetX,\r\n targetY,\r\n });\r\n\r\n const edgeLabel = data?.label;\r\n const isPass = edgeLabel === 'Pass';\r\n const showLabel = isPass || edgeLabel === 'Fail';\r\n\r\n const oneThirdX = sourceX + (targetX - sourceX) / 3;\r\n const oneThirdY = sourceY + (targetY - sourceY) / 3;\r\n const twoThirdsX = sourceX + (2 * (targetX - sourceX)) / 3;\r\n const twoThirdsY = sourceY + (2 * (targetY - sourceY)) / 3;\r\n\r\n const handleAddStepClick = data?.onAddStepClick;\r\n\r\n const handleClick = (e: React.MouseEvent | React.KeyboardEvent) => {\r\n e.stopPropagation();\r\n if (typeof handleAddStepClick !== 'function') return;\r\n const context: AddStepContext = {\r\n edgeId,\r\n nodeId: source,\r\n sourceNodeId: source,\r\n targetNodeId: target,\r\n position: 'between',\r\n referenceNodeId: source,\r\n referenceNodeType: data?.referenceNodeType,\r\n stepVisibility: data?.stepVisibility,\r\n };\r\n handleAddStepClick(source, context);\r\n };\r\n\r\n const handleKeyDown = (e: React.KeyboardEvent) => {\r\n if (e.key === 'Enter' || e.key === ' ') {\r\n e.preventDefault();\r\n handleClick(e);\r\n }\r\n };\r\n\r\n const PlusContent = () => (\r\n <>\r\n <g className=\"plus-icon-container\">\r\n <circle r={R} className=\"edge-plus-circle\" />\r\n <line x1={0} y1={-PLUS_HALF} x2={0} y2={PLUS_HALF} strokeWidth={STROKE} strokeLinecap=\"round\" className=\"plus-line\" />\r\n <line x1={-PLUS_HALF} y1={0} x2={PLUS_HALF} y2={0} strokeWidth={STROKE} strokeLinecap=\"round\" className=\"plus-line\" />\r\n </g>\r\n <g className=\"edge-plus-tooltip\" transform=\"translate(18, 0)\">\r\n <rect x={0} y={-10} width={65} height={20} rx={4} className=\"tooltip-bg\" />\r\n <path d=\"M0 -4 L-4 0 L0 4 Z\" className=\"tooltip-bg\" />\r\n <text x={32} y={0} textAnchor=\"middle\" dominantBaseline=\"central\" fill=\"white\" style={{ fontSize: 10, fontWeight: 600, pointerEvents: 'none' }}>\r\n Add Step\r\n </text>\r\n </g>\r\n </>\r\n );\r\n\r\n const plusProps = handleAddStepClick ? {\r\n onClick: handleClick,\r\n onKeyDown: handleKeyDown,\r\n role: 'button' as const,\r\n tabIndex: 0,\r\n style: { cursor: 'pointer', pointerEvents: 'all' as const },\r\n } : {\r\n style: { cursor: 'default', pointerEvents: 'all' as const },\r\n };\r\n\r\n return (\r\n <g className=\"edge-with-plus-wrapper\">\r\n <BaseEdge id={edgeId} path={edgePath} />\r\n {showLabel ? (\r\n <>\r\n <g transform={`translate(${oneThirdX}, ${oneThirdY})`}>\r\n <rect x={-PILL_WIDTH / 2} y={-PILL_HEIGHT / 2} width={PILL_WIDTH} height={PILL_HEIGHT} rx={PILL_R} ry={PILL_R} fill={isPass ? '#ADE6C5' : '#FDBFBF'} />\r\n <text textAnchor=\"middle\" dominantBaseline=\"central\" fill={isPass ? '#1DBF60' : '#C50000'} style={{ fontSize: 12, fontWeight: 500 }}>\r\n {edgeLabel}\r\n </text>\r\n </g>\r\n <g className=\"nodrag nopan edge-plus-svg\" transform={`translate(${twoThirdsX}, ${twoThirdsY})`} data-testid=\"plus-node-icon\" {...plusProps}>\r\n <PlusContent />\r\n </g>\r\n </>\r\n ) : (\r\n <g className=\"nodrag nopan edge-plus-svg\" transform={`translate(${labelX}, ${labelY})`} data-testid=\"plus-node-icon\" {...plusProps}>\r\n <PlusContent />\r\n </g>\r\n )}\r\n </g>\r\n );\r\n};\r\n\r\nexport default EdgeWithPlusLabel;\r\n","import React from \"react\";\r\nimport { getStraightPath, BaseEdge, EdgeProps } from \"reactflow\";\r\nimport { AddStepContext } from \"./EdgeWithPlusLabel\";\r\nimport \"./EdgeWithPlusLabel.scss\";\r\n\r\nconst R = 11.5;\r\nconst STROKE = 2;\r\nconst PLUS_HALF = 6;\r\n\r\nexport interface PlusEdgeData {\r\n onAddStepClick?: (sourceNodeId: string, context: AddStepContext) => void;\r\n referenceNodeType?: string;\r\n stepVisibility?: unknown;\r\n filterId?: string;\r\n branch?: string;\r\n}\r\n\r\nconst PlusEdge = ({\r\n id,\r\n sourceX,\r\n sourceY,\r\n targetX,\r\n targetY,\r\n source,\r\n target,\r\n data,\r\n}: EdgeProps<PlusEdgeData>) => {\r\n const [edgePath, labelX, labelY] = getStraightPath({\r\n sourceX,\r\n sourceY,\r\n targetX,\r\n targetY,\r\n });\r\n\r\n const handleAddStepClick = data?.onAddStepClick;\r\n\r\n const handleClick = (e: React.MouseEvent | React.KeyboardEvent) => {\r\n e.stopPropagation();\r\n if (typeof handleAddStepClick !== \"function\") return;\r\n handleAddStepClick(source, {\r\n edgeId: id,\r\n nodeId: source,\r\n sourceNodeId: source,\r\n targetNodeId: target,\r\n position: \"between\",\r\n referenceNodeId: source,\r\n referenceNodeType: data?.referenceNodeType,\r\n stepVisibility: data?.stepVisibility,\r\n filterId: data?.filterId,\r\n branch: data?.branch,\r\n });\r\n };\r\n\r\n const handleKeyDown = (e: React.KeyboardEvent) => {\r\n if (e.key === \"Enter\" || e.key === \" \") {\r\n e.preventDefault();\r\n handleClick(e);\r\n }\r\n };\r\n\r\n return (\r\n <g className=\"edge-with-plus-wrapper\">\r\n <BaseEdge id={id} path={edgePath} style={{ stroke: \"#b0bec5\" }} />\r\n <g\r\n className=\"nodrag nopan edge-plus-svg\"\r\n transform={`translate(${labelX}, ${labelY})`}\r\n style={{\r\n cursor: handleAddStepClick ? \"pointer\" : \"default\",\r\n pointerEvents: \"all\",\r\n outline: \"none\",\r\n }}\r\n onClick={handleAddStepClick ? handleClick : undefined}\r\n onKeyDown={handleAddStepClick ? handleKeyDown : undefined}\r\n role={handleAddStepClick ? \"button\" : undefined}\r\n tabIndex={handleAddStepClick ? 0 : undefined}\r\n data-testid=\"plus-node-icon\"\r\n >\r\n <circle r={R} className=\"edge-plus-circle\" />\r\n <line\r\n x1={0}\r\n y1={-PLUS_HALF}\r\n x2={0}\r\n y2={PLUS_HALF}\r\n strokeWidth={STROKE}\r\n strokeLinecap=\"round\"\r\n className=\"plus-line\"\r\n />\r\n <line\r\n x1={-PLUS_HALF}\r\n y1={0}\r\n x2={PLUS_HALF}\r\n y2={0}\r\n strokeWidth={STROKE}\r\n strokeLinecap=\"round\"\r\n className=\"plus-line\"\r\n />\r\n <g className=\"edge-plus-tooltip\" transform=\"translate(18, 0)\">\r\n <rect\r\n x={0}\r\n y={-10}\r\n width={65}\r\n height={20}\r\n rx={4}\r\n className=\"tooltip-bg\"\r\n />\r\n <path d=\"M0 -4 L-4 0 L0 4 Z\" className=\"tooltip-bg\" />\r\n <text\r\n x={32}\r\n y={0}\r\n textAnchor=\"middle\"\r\n dominantBaseline=\"central\"\r\n fill=\"white\"\r\n style={{ fontSize: 10, fontWeight: 600, pointerEvents: \"none\" }}\r\n >\r\n Add Step\r\n </text>\r\n </g>\r\n </g>\r\n </g>\r\n );\r\n};\r\n\r\nexport default PlusEdge;\r\n","import React from 'react';\r\nimport { getStraightPath, BaseEdge, EdgeProps } from 'reactflow';\r\n\r\nconst PlainEdge = ({ id, sourceX, sourceY, targetX, targetY }: EdgeProps) => {\r\n const [edgePath] = getStraightPath({ sourceX, sourceY, targetX, targetY });\r\n return <BaseEdge id={id} path={edgePath} style={{ stroke: '#b0bec5' }} />;\r\n};\r\n\r\nexport default PlainEdge;\r\n","import React from 'react';\r\nimport { getStraightPath, BaseEdge, EdgeProps } from 'reactflow';\r\nimport { AddStepContext } from './EdgeWithPlusLabel';\r\nimport './EdgeWithPlusLabel.scss';\r\n\r\nconst R = 11.5;\r\nconst STROKE = 2;\r\nconst PLUS_HALF = 6;\r\nconst LABEL_OFFSET_Y = -24;\r\nconst PILL_WIDTH = 40;\r\nconst PILL_HEIGHT = 20;\r\nconst PILL_R = 4;\r\n\r\nexport interface LabelPlusEdgeData {\r\n label?: string;\r\n onAddStepClick?: (sourceNodeId: string, context: AddStepContext) => void;\r\n referenceNodeType?: string;\r\n stepVisibility?: unknown;\r\n showPlus?: boolean;\r\n}\r\n\r\nconst LabelPlusEdge = ({\r\n id,\r\n sourceX,\r\n sourceY,\r\n targetX,\r\n targetY,\r\n source,\r\n target,\r\n data,\r\n}: EdgeProps<LabelPlusEdgeData>) => {\r\n const [edgePath, labelX, labelY] = getStraightPath({ sourceX, sourceY, targetX, targetY });\r\n\r\n const edgeLabel = data?.label;\r\n const isPass = edgeLabel === 'Pass';\r\n const showLabel = isPass || edgeLabel === 'Fail';\r\n const handleAddStepClick = data?.onAddStepClick;\r\n const showPlus = data?.showPlus !== false && !!handleAddStepClick;\r\n\r\n const handleClick = (e: React.MouseEvent | React.KeyboardEvent) => {\r\n e.stopPropagation();\r\n if (typeof handleAddStepClick !== 'function') return;\r\n handleAddStepClick(source, {\r\n edgeId: id,\r\n nodeId: source,\r\n sourceNodeId: source,\r\n targetNodeId: target,\r\n position: 'between',\r\n referenceNodeId: source,\r\n referenceNodeType: data?.referenceNodeType,\r\n stepVisibility: data?.stepVisibility,\r\n });\r\n };\r\n\r\n const handleKeyDown = (e: React.KeyboardEvent) => {\r\n if (e.key === 'Enter' || e.key === ' ') {\r\n e.preventDefault();\r\n handleClick(e);\r\n }\r\n };\r\n\r\n return (\r\n <g className=\"edge-with-plus-wrapper\">\r\n <BaseEdge id={id} path={edgePath} style={{ stroke: '#b0bec5' }} />\r\n <g\r\n className=\"nodrag nopan edge-plus-svg\"\r\n transform={`translate(${labelX}, ${labelY})`}\r\n style={{ cursor: handleAddStepClick ? 'pointer' : 'default', pointerEvents: 'all', outline: 'none' }}\r\n onClick={handleAddStepClick ? handleClick : undefined}\r\n onKeyDown={handleAddStepClick ? handleKeyDown : undefined}\r\n role={handleAddStepClick ? 'button' : undefined}\r\n tabIndex={handleAddStepClick ? 0 : undefined}\r\n >\r\n {showLabel && (\r\n <g transform={`translate(0, ${showPlus ? LABEL_OFFSET_Y : 0})`}>\r\n <rect\r\n x={-PILL_WIDTH / 2} y={-PILL_HEIGHT / 2}\r\n width={PILL_WIDTH} height={PILL_HEIGHT}\r\n rx={PILL_R} ry={PILL_R}\r\n fill={isPass ? '#ADE6C5' : '#FDBFBF'}\r\n />\r\n <text textAnchor=\"middle\" dominantBaseline=\"central\" fill={isPass ? '#1DBF60' : '#C50000'} style={{ fontSize: 12, fontWeight: 500 }}>\r\n {edgeLabel}\r\n </text>\r\n </g>\r\n )}\r\n\r\n {showPlus && (\r\n <g className=\"plus-icon-container\">\r\n <circle r={R} className=\"edge-plus-circle\" />\r\n <line x1={0} y1={-PLUS_HALF} x2={0} y2={PLUS_HALF} strokeWidth={STROKE} strokeLinecap=\"round\" className=\"plus-line\" />\r\n <line x1={-PLUS_HALF} y1={0} x2={PLUS_HALF} y2={0} strokeWidth={STROKE} strokeLinecap=\"round\" className=\"plus-line\" />\r\n </g>\r\n )}\r\n\r\n {showPlus && (\r\n <g className=\"edge-plus-tooltip\" transform=\"translate(22, 0)\">\r\n <rect x={0} y={-10} width={65} height={20} rx={4} className=\"tooltip-bg\" />\r\n <path d=\"M0 -4 L-4 0 L0 4 Z\" className=\"tooltip-bg\" />\r\n <text x={32} y={0} textAnchor=\"middle\" dominantBaseline=\"central\" fill=\"white\" style={{ fontSize: 10, fontWeight: 600, pointerEvents: 'none' }}>\r\n Add Step\r\n </text>\r\n </g>\r\n )}\r\n </g>\r\n </g>\r\n );\r\n};\r\n\r\nexport default LabelPlusEdge;\r\n","import React from 'react';\r\nimport { EdgeProps } from 'reactflow';\r\nimport { AddStepContext } from './EdgeWithPlusLabel';\r\n\r\ninterface GatewayBranchEdgeData {\r\n label?: string;\r\n branch?: string;\r\n isFirst?: boolean;\r\n filterId?: string;\r\n onAddStepClick?: (sourceNodeId: string, context: AddStepContext) => void;\r\n /** When true, route as a vertical rail (sourceX → down to targetY → right to target). Default: horizontal fan-out. */\r\n verticalRouting?: boolean;\r\n}\r\n\r\nconst GatewayBranchEdge = ({\r\n id,\r\n source,\r\n target,\r\n sourceX,\r\n sourceY,\r\n targetX,\r\n targetY,\r\n style = {},\r\n markerEnd,\r\n data,\r\n}: EdgeProps<GatewayBranchEdgeData>) => {\r\n const verticalRouting = data?.verticalRouting ?? false;\r\n // Workato-style vertical routing: the rail decoration draws the vertical line +\r\n // bullet. The edge L-routes (90° elbow) from the bullet Y (BULLET_OFFSET above the\r\n // target top) across to the step's centerX, then down into the step's top handle.\r\n // This applies to every branch, including empty ones (target = End).\r\n // BULLET_OFFSET must match BULLET_TO_STEP_GAP in WorkflowCanvas applyVerticalBranchLayout.\r\n const BULLET_OFFSET = 30;\r\n const path = verticalRouting\r\n ? (() => {\r\n const bulletY = targetY - BULLET_OFFSET;\r\n return `M ${sourceX},${bulletY} L ${targetX},${bulletY} L ${targetX},${targetY}`;\r\n })()\r\n : (() => {\r\n const elbowY = sourceY + 30;\r\n return `M ${sourceX},${sourceY} L ${sourceX},${elbowY} L ${targetX},${elbowY} L ${targetX},${targetY}`;\r\n })();\r\n const stroke = (style as React.CSSProperties & { stroke?: string }).stroke || '#d1d5db';\r\n const label = data?.label;\r\n const isPass = data?.isFirst ?? false;\r\n const onAddStepClick = data?.onAddStepClick;\r\n\r\n // Label + \"+\" sit on the horizontal segment.\r\n // - Vertical mode: horizontal segment is at bulletY (= targetY - BULLET_OFFSET)\r\n // - Horizontal mode: horizontal segment is at the elbow (sourceY+30)\r\n const segmentY = verticalRouting ? targetY - BULLET_OFFSET : sourceY + 30;\r\n const pillX = sourceX + (targetX - sourceX) * (verticalRouting ? 0.25 : 0.35);\r\n const plusX = sourceX + (targetX - sourceX) * (verticalRouting ? 0.65 : 0.7);\r\n const labelY = segmentY;\r\n\r\n const handlePlusClick = (e: React.MouseEvent) => {\r\n e.stopPropagation();\r\n if (!onAddStepClick) return;\r\n onAddStepClick(source, {\r\n edgeId: id,\r\n nodeId: source,\r\n sourceNodeId: source,\r\n targetNodeId: target,\r\n position: 'between',\r\n referenceNodeId: source,\r\n filterId: data?.filterId,\r\n branch: data?.branch,\r\n });\r\n };\r\n\r\n const R = 11.5;\r\n const HALF = 6;\r\n\r\n return (\r\n <g>\r\n <path id={id} d={path} fill=\"none\" stroke={stroke} strokeWidth={1.5} markerEnd={markerEnd} />\r\n\r\n {/* Pass / Fail pill — hidden in vertical-routing mode (the rail decoration renders the label instead) */}\r\n {label && !verticalRouting && (\r\n <g transform={`translate(${pillX}, ${labelY})`}>\r\n {(() => {\r\n const pillW = Math.max(44, label.length * 7 + 20);\r\n return (\r\n <>\r\n <rect x={-pillW / 2} y={-11} width={pillW} height={22} rx={11}\r\n fill={isPass ? '#e8f5e9' : '#ffebee'}\r\n stroke={isPass ? '#81c784' : '#e57373'}\r\n strokeWidth={1}\r\n />\r\n <text x={0} y={4} textAnchor=\"middle\" fontSize={10} fontWeight={600}\r\n fill={isPass ? '#2e7d32' : '#c62828'}\r\n style={{ fontFamily: 'sans-serif', pointerEvents: 'none' }}\r\n >\r\n {label}\r\n </text>\r\n </>\r\n );\r\n })()}\r\n </g>\r\n )}\r\n\r\n {/* \"+\" button */}\r\n {onAddStepClick && (\r\n <g\r\n transform={`translate(${plusX}, ${labelY})`}\r\n onClick={handlePlusClick}\r\n style={{ cursor: 'pointer', pointerEvents: 'all' }}\r\n className=\"nodrag nopan edge-plus-svg\"\r\n >\r\n <circle r={R} className=\"edge-plus-circle\" />\r\n <line x1={0} y1={-HALF} x2={0} y2={HALF} strokeWidth={2} strokeLinecap=\"round\" className=\"plus-line\" />\r\n <line x1={-HALF} y1={0} x2={HALF} y2={0} strokeWidth={2} strokeLinecap=\"round\" className=\"plus-line\" />\r\n </g>\r\n )}\r\n </g>\r\n );\r\n};\r\n\r\nexport default GatewayBranchEdge;\r\n"],"names":["WorkflowCanvasContext","createContext","defaultFlowForgeMessages","useCanvasHandlers","useContext","StartNode","jsxs","jsx","Handle","Position","EndNode","AddTriggerNode","onClickAddTrigger","messages","Tooltip","e","GrTrigger","AddStepNode","id","onAddStep","humaniseCode","code","m","formatSource","s","value","TriggerNode","data","type","eventType","sources","label","source","previewWorkflow","executionStatus","infoText","handleEdit","hasEventSources","hasSimpleShape","title","body","eventDisplay","i","Chip","rightCluster","Fragment","FaCheckCircle","FaTimesCircle","MdOutlineModeEdit","MdInfoOutline","MdInput","formatEventType","EventNode","header","displayTitle","BranchRailDecoration","rail","cardWidth","railX","stroke","b","idx","bulletY","FilterNode","onEditNode","onDeleteNode","conditions","_branchRail","FiFilter","MdDeleteOutline","condition","index","ActionNode","nodeRegistry","nodeBody","descriptorType","groupBlocks","groups","roles","groupId","roleId","descriptor","icon","toDisplayString","v","toList","displayValues","configured","MAX_VISIBLE_STAGES","ApprovalNode","approvalData","isPreview","policy","stages","stageCount","visibleStages","remainingStages","policyName","MdCheckCircle","stage","displayName","_a","approverCount","groupName","_b","roleName","_c","stageLabel","MdPeople","DelayNode","duration","unit","displayText","MdSchedule","CHANNEL_META","MdEmail","MdNotifications","MdSms","MdWebhook","FALLBACK_META","getRecipientPreview","getSubjectPreview","msg","NotificationNode","d","meta","recipient","subjectLine","IconComponent","NODE_WIDTH","AUTH_LABELS","WebhookTriggerNode","endpointUrl","authMethod","handleCopy","MdContentCopy","RestApiNode","method","url","MdHttp","methodKey","methodStyle","HTTP_METHOD_STYLE","OPERATOR_LABELS","ConditionBranchNode","branchConfigs","defaultBranch","MdCallSplit","branch","palette","BRANCH_PALETTE","firstCondition","extraCount","SubWorkflowNode","workflowId","workflowLabel","onPreview","MdAccountTree","handlePreview","MdOpenInNew","builtInNodeTypes","R","STROKE","PLUS_HALF","PILL_WIDTH","PILL_HEIGHT","PILL_R","EdgeWithPlusLabel","edgeId","sourceX","sourceY","targetX","targetY","sourcePosition","targetPosition","target","edgePath","labelX","labelY","getStraightPath","edgeLabel","isPass","showLabel","oneThirdX","oneThirdY","twoThirdsX","twoThirdsY","handleAddStepClick","handleClick","context","handleKeyDown","PlusContent","plusProps","BaseEdge","PlusEdge","PlainEdge","LABEL_OFFSET_Y","LabelPlusEdge","showPlus","GatewayBranchEdge","style","markerEnd","verticalRouting","BULLET_OFFSET","path","elbowY","onAddStepClick","segmentY","pillX","plusX","handlePlusClick","HALF","pillW"],"mappings":";;;;;;;;;;AAgBO,MAAMA,KAAwBC,GAA8B;AAAA,EACjE,YAAY,MAAM;AAAA,EAAC;AAAA,EACnB,cAAc,MAAM;AAAA,EAAC;AAAA,EACrB,WAAW,MAAM;AAAA,EAAC;AAAA,EAClB,mBAAmB,MAAM;AAAA,EAAC;AAAA,EAC1B,UAAUC;AAAA,EACV,cAAc;AAAA,EACd,UAAU;AACZ,CAAC,GAEYC,IAAoB,MAAMC,GAAWJ,EAAqB,GCvBjEK,KAAY,MAChB,gBAAAC,EAAC,OAAA,EAAI,OAAO,EAAE,OAAO,KAAK,SAAS,QAAQ,gBAAgB,SAAA,GACzD,UAAA;AAAA,EAAA,gBAAAC,EAACC,GAAA,EAAO,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A,IAEJ,KAAG,CACL;AAAA,IAID+K,KACC,gBAAAxM;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW,aAAa2M,CAAK,KAAK/B,CAAM;AAAA,QACxC,SAASgC;AAAA,QACT,OAAO,EAAE,QAAQ,WAAW,eAAe,MAAA;AAAA,QAC3C,WAAU;AAAA,QAEV,UAAA;AAAA,UAAA,gBAAA3M,EAAC,UAAA,EAAO,GAAG0J,GAAG,WAAU,oBAAmB;AAAA,4BAC1C,QAAA,EAAK,IAAI,GAAG,IAAI,CAACkD,GAAM,IAAI,GAAG,IAAIA,GAAM,aAAa,GAAG,eAAc,SAAQ,WAAU,aAAY;AAAA,4BACpG,QAAA,EAAK,IAAI,CAACA,GAAM,IAAI,GAAG,IAAIA,GAAM,IAAI,GAAG,aAAa,GAAG,eAAc,SAAQ,WAAU,YAAA,CAAY;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACvG,GAEJ;AAEJ;"}
@@ -1 +1,2 @@
1
- "use strict";const h=require("react"),re=require("formik"),N=require("./index-BsJvlQWO.js"),e=require("react/jsx-runtime"),o=require("@mui/material"),S=require("react-icons/md"),ie=require("react-icons/fa6");function ae({schema:l,initialValues:s,onSubmit:d,showErrorsImmediately:a=!1}){const r=l.fields??[],t=h.useMemo(()=>N.buildValidationSchema(r),[r]),p=h.useMemo(()=>{if(a)return r.reduce((u,v)=>{const g=N.resolveFieldKey(v);return g&&(u[g]=!0),u},{})},[r,a]),[i,c]=h.useState({}),[m,y]=h.useState({}),B=h.useRef(s);h.useEffect(()=>{B.current!==s&&(B.current=s,c({}),y({}))},[s]);const x=re.useFormik({initialValues:s,validationSchema:t,initialTouched:p,validateOnMount:a,validateOnChange:!0,validateOnBlur:!0,enableReinitialize:!0,onSubmit:async u=>{const v=N.buildEvaluationPayload({values:u,conditionConfig:m});await d(u,v)}}),n=h.useCallback(()=>{x.submitForm()},[x]),f=h.useCallback(u=>{x.resetForm(u?{values:u}:void 0),c({}),y({})},[x]);return{values:x.values,errors:x.errors,isValid:x.isValid,isDirty:x.dirty,isSubmitting:x.isSubmitting,formulaConfig:i,conditionConfig:m,submit:n,reset:f,setFieldValue:x.setFieldValue,_schema:l,_formik:x,_formulaConfig:i,_onFormulaConfigChange:c,_conditionConfig:m,_onConditionConfigChange:y}}const Z=N.FlowForgeRegistry.getTypeOptions(),j="form-control font-14",b="text-14 text-dark fw-medium mb-1 align-items-center d-flex gap-1",F={fontSize:10,fontWeight:700,color:"#94a3b8",textTransform:"uppercase",letterSpacing:.6,marginBottom:8,display:"block"},ce=[{value:"text",label:"Text"},{value:"number",label:"Number"},{value:"email",label:"Email"},{value:"url",label:"URL"},{value:"password",label:"Password"},{value:"select",label:"Select"},{value:"object",label:"Object (sub-fields)"},{value:"array",label:"Array (nested)"}],de=[{value:3,label:"1/4"},{value:4,label:"1/3"},{value:6,label:"1/2"},{value:8,label:"2/3"},{value:12,label:"Full"}];function xe({value:l,onChange:s}){const d=l??12;return e.jsxs(o.Box,{children:[e.jsx("span",{className:b,children:"Column width"}),e.jsx(o.Box,{sx:{display:"flex",gap:.5},children:de.map(a=>e.jsx(o.Tooltip,{title:`colSpan: ${a.value}`,placement:"top",children:e.jsx(o.Box,{component:"button",onClick:()=>s(a.value),sx:{flex:1,border:"1px solid",borderColor:d===a.value?"#6366f1":"#dee2e6",borderRadius:"6px",cursor:"pointer",bgcolor:d===a.value?"#eef2ff":"#fff",color:d===a.value?"#6366f1":"#6c757d",fontSize:11,fontWeight:600,py:.6,px:0,"&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:a.label})},a.value))}),e.jsx(o.Box,{sx:{display:"flex",gap:"3px",mt:.75},children:Array.from({length:12}).map((a,r)=>e.jsx(o.Box,{sx:{flex:1,height:4,borderRadius:"2px",bgcolor:r<d?"#6366f1":"#e2e8f0",transition:"background 0.12s"}},r))})]})}function Q({options:l=[],onChange:s}){function d(a,r,t){s(l.map((p,i)=>i===a?{...p,[r]:t}:p))}return e.jsxs(o.Box,{children:[e.jsxs("span",{className:b,children:["Options ",e.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,mb:.75},children:l.map((a,r)=>e.jsxs(o.Box,{sx:{display:"flex",gap:.5,alignItems:"center"},children:[e.jsx("input",{className:j,style:{flex:1},placeholder:"Label",value:a.label,onChange:t=>d(r,"label",t.target.value)}),e.jsx("input",{className:j,style:{flex:1},placeholder:"Value",value:a.value,onChange:t=>d(r,"value",t.target.value)}),e.jsx(o.Box,{component:"button",onClick:()=>s(l.filter((t,p)=>p!==r)),sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:e.jsx(S.MdClose,{size:13})})]},r))}),e.jsxs(o.Box,{component:"button",onClick:()=>s([...l,{label:"",value:""}]),sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,px:1,py:.5,borderRadius:"6px",color:"#6366f1",width:"100%","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:[e.jsx(S.MdAdd,{size:13})," Add option"]})]})}const ee=[{value:"operator",label:"Operator (predefined)"},{value:"select",label:"Select"},{value:"text",label:"Text"}];function pe({col:l,onChange:s,onDelete:d}){const a=l.type==="select",r=l.type==="operator";return e.jsxs(o.Box,{sx:{border:"1px solid #e2e8f0",borderRadius:"7px",p:1.25,bgcolor:"#fff",display:"flex",flexDirection:"column",gap:1},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx(o.Box,{sx:{fontSize:10,fontWeight:700,px:.75,py:.2,borderRadius:"4px",bgcolor:r?"#fef9c3":"#eef2ff",color:r?"#92400e":"#6366f1",flexShrink:0},children:r?"OPERATOR":l.type.toUpperCase()}),e.jsx(o.Box,{sx:{fontSize:12,fontWeight:600,color:"#0f172a",flex:1},children:l.label||l.id||"Unnamed"}),e.jsx(o.Box,{component:"button",onClick:d,sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:e.jsx(S.MdClose,{size:13})})]}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Column type"}),e.jsx("select",{value:l.type,onChange:t=>s({...l,type:t.target.value,options:void 0}),className:j,style:{cursor:"pointer"},children:ee.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))})]}),e.jsxs(o.Box,{children:[e.jsxs("label",{className:b,children:["Column key ",e.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),e.jsx("input",{className:`${j} ${l.id?"":"border-danger"}`,value:l.id,onChange:t=>s({...l,id:t.target.value}),placeholder:"e.g. field, operator, value"}),!l.id&&e.jsx("span",{style:{fontSize:10,color:"#dc3545"},children:"Required — used as data key"})]})]}),!r&&e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Label"}),e.jsx("input",{className:j,value:l.label??"",onChange:t=>s({...l,label:t.target.value||void 0}),placeholder:"Column label"})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Placeholder"}),e.jsx("input",{className:j,value:l.placeholder??"",onChange:t=>s({...l,placeholder:t.target.value||void 0}),placeholder:"Hint…"})]})]}),a&&e.jsx(Q,{options:l.options??[],onChange:t=>s({...l,options:t})}),r&&e.jsx(o.Box,{sx:{bgcolor:"#fefce8",border:"1px solid #fef08a",borderRadius:"6px",px:1.25,py:.75},children:e.jsx(o.Box,{sx:{fontSize:11,color:"#78350f"},children:"Predefined: equals, not equals, contains, starts with, ends with, is present, is not present, greater than, less than…"})}),!r&&e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx("input",{type:"checkbox",id:`formula-${l.id}`,checked:!!l.formula,onChange:t=>s({...l,formula:t.target.checked||void 0}),style:{cursor:"pointer",width:14,height:14}}),e.jsx("label",{htmlFor:`formula-${l.id}`,className:b,style:{margin:0,cursor:"pointer"},children:"Formula input (chip editor)"})]})]})}function ue({condition:l,onChange:s}){const d=!!l;function a(){s(d?void 0:{fields:[]})}function r(i){if(!l)return;const c=i==="operator"?"operator":l.fields.filter(m=>m.type!=="operator").length===0?"field":"value";s({...l,fields:[...l.fields,{id:c,type:i}]})}function t(i,c){if(!l)return;const m=[...l.fields];m[i]=c,s({...l,fields:m})}function p(i){l&&s({...l,fields:l.fields.filter((c,m)=>m!==i)})}return e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75,mb:d?1.25:0},children:[e.jsx("input",{type:"checkbox",id:"enable-condition",checked:d,onChange:a,style:{cursor:"pointer",width:14,height:14}}),e.jsx("span",{style:{...F,margin:0,color:d?"#6366f1":"#94a3b8"},children:"Condition row"})]}),d&&l&&e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:[l.fields.map((i,c)=>e.jsx(pe,{col:i,onChange:m=>t(c,m),onDelete:()=>p(c)},c)),e.jsx(o.Box,{sx:{display:"flex",gap:.5},children:ee.map(i=>e.jsxs(o.Box,{component:"button",onClick:()=>r(i.value),sx:{flex:1,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,py:.5,borderRadius:"6px",color:i.value==="operator"?"#92400e":"#6366f1","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:["+ ",i.value==="operator"?"Operator":i.label.split(" ")[0]]},i.value))}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:2,flexWrap:"wrap"},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx("input",{type:"checkbox",id:"allow-groups",checked:!!l.allowGroups,onChange:i=>s({...l,allowGroups:i.target.checked||void 0}),style:{cursor:"pointer",width:14,height:14}}),e.jsx("label",{htmlFor:"allow-groups",className:b,style:{margin:0,cursor:"pointer"},children:"Allow nested groups"})]}),l.allowGroups&&e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx("label",{className:b,style:{margin:0},children:"Max depth"}),e.jsx("input",{type:"number",min:1,max:5,className:j,style:{width:60,textAlign:"center"},value:l.maxGroupDepth??"",onChange:i=>s({...l,maxGroupDepth:i.target.value?Number(i.target.value):void 0}),placeholder:"∞"})]})]})]})]})}function E({id:l,label:s,checked:d,onChange:a}){return e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx("input",{type:"checkbox",id:l,checked:d,onChange:r=>a(r.target.checked),style:{cursor:"pointer",width:14,height:14,flexShrink:0}}),e.jsx("label",{htmlFor:l,className:b,style:{margin:0,cursor:"pointer"},children:s})]})}function he({views:l=[],onChange:s}){function d(r,t,p){s(l.map((i,c)=>c===r?{...i,[t]:p}:i))}function a(){const r=`tab${l.length+1}`;s([...l,{id:r,label:`Tab ${l.length+1}`}])}return e.jsxs(o.Box,{children:[e.jsx("span",{className:b,children:"Views"}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,mb:.75},children:l.map((r,t)=>e.jsxs(o.Box,{sx:{display:"flex",gap:.5,alignItems:"center"},children:[e.jsx("input",{className:j,style:{flex:1},placeholder:"Label",value:r.label,onChange:p=>d(t,"label",p.target.value)}),e.jsx("input",{className:j,style:{flex:1},placeholder:"ID (no spaces)",value:r.id,onChange:p=>d(t,"id",p.target.value.replace(/\s/g,"_"))}),e.jsx(o.Box,{component:"button",onClick:()=>s(l.filter((p,i)=>i!==t)),sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:e.jsx(S.MdClose,{size:13})})]},t))}),e.jsxs(o.Box,{component:"button",onClick:a,sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,px:1,py:.5,borderRadius:"6px",color:"#6366f1",width:"100%","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:[e.jsx(S.MdAdd,{size:13})," Add view"]})]})}function _({label:l,value:s,options:d,onChange:a}){return e.jsxs(o.Box,{children:[e.jsx("span",{className:b,children:l}),e.jsx(o.Box,{sx:{display:"flex",border:"1px solid #dee2e6",borderRadius:"7px",overflow:"hidden"},children:d.map(r=>e.jsx(o.Box,{component:"button",onClick:()=>a(r.value),sx:{flex:1,border:"none",borderRight:"1px solid #dee2e6",cursor:"pointer",fontSize:12,fontWeight:600,py:.6,bgcolor:s===r.value?"#eef2ff":"#fff",color:s===r.value?"#6366f1":"#6c757d","&:last-child":{borderRight:"none"},"&:hover":{bgcolor:"#f5f3ff"}},children:r.label},r.value))})]})}function le({field:l,onChange:s,onSave:d,onCancel:a,noFooter:r}){const[t,p]=h.useState(!1),i=l.id??l.name??"",c=l,m=l.type==="select"||l.type==="descriptive-select"||l.type==="radio-group",y=N.FlowForgeRegistry.get(l.type),B=y==null?void 0:y.configSchema;function x(n,f){s({...l,[n]:f})}return e.jsxs(e.Fragment,{children:[e.jsxs(o.Box,{sx:{flex:1,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.75},children:[e.jsxs(o.Box,{children:[e.jsx("span",{style:F,children:"Required"}),e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Type"}),e.jsx("select",{value:l.type,onChange:n=>x("type",n.target.value),className:j,style:{cursor:"pointer"},children:Z.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))})]}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:l.type==="tabs"?"1fr":"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsxs("label",{className:b,children:["Field ID ",e.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),e.jsx("input",{className:j,value:l.id??l.name??"",onChange:n=>x("id",n.target.value),placeholder:"e.g. email"})]}),l.type!=="tabs"&&e.jsxs(o.Box,{children:[e.jsxs("label",{className:b,children:["Label ",e.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),e.jsx("input",{className:j,value:l.label??"",onChange:n=>x("label",n.target.value),placeholder:"Display label"})]})]}),l.type!=="tabs"&&e.jsx(xe,{value:l.colSpan,onChange:n=>x("colSpan",n===12?void 0:n)})]})]}),B&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[e.jsx("span",{style:F,children:"Specific Settings"}),e.jsx(N.FlowForm,{schema:{layout:"flat",compact:!0,fields:B.fields},initialValues:l,onValuesChange:n=>s({...l,...n}),onSubmit:()=>{}})]}),l.type==="tabs"&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5,display:"flex",flexDirection:"column",gap:1.5},children:[e.jsx("span",{style:F,children:"Content"}),e.jsx(he,{views:(c.tabs??[]).map(n=>({id:n.id,label:n.label})),onChange:n=>{const f=c.tabs??[],u=n.map(v=>{const g=f.find(w=>w.id===v.id);return g?{...g,...v}:{...v,fields:[]}});s({...l,tabs:u})}}),e.jsx("span",{style:{...F,marginTop:4},children:"Interaction"}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Disabled"}),e.jsx("input",{className:j,value:c.disabledExpr??"",onChange:n=>s({...l,disabledExpr:n.target.value||void 0}),placeholder:"false"})]}),e.jsx("span",{style:{...F,marginTop:4},children:"Appearance"}),e.jsx(_,{label:"Alignment",value:c.alignment??"left",options:[{value:"left",label:"|←"},{value:"center-left",label:"←|"},{value:"center",label:"|·|"},{value:"center-right",label:"|→"},{value:"right",label:"→|"}],onChange:n=>s({...l,alignment:n})}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Hidden"}),e.jsx("input",{className:j,value:c.hiddenExpr??"",onChange:n=>s({...l,hiddenExpr:n.target.value||void 0}),placeholder:"false"})]}),e.jsx(_,{label:"Variant",value:c.variant??"line",options:[{value:"pill",label:"Pill"},{value:"line",label:"Line"}],onChange:n=>s({...l,variant:n})}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Active color"}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx("input",{type:"color",value:c.activeColor??"#6366f1",onChange:n=>s({...l,activeColor:n.target.value}),style:{width:28,height:28,border:"1px solid #dee2e6",borderRadius:6,cursor:"pointer",padding:2,background:"#fff"}}),e.jsx("input",{className:j,value:c.activeColor??"",onChange:n=>s({...l,activeColor:n.target.value||void 0}),placeholder:"#6366f1",style:{flex:1}})]})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Active text"}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx("input",{type:"color",value:c.activeTextColor??"#ffffff",onChange:n=>s({...l,activeTextColor:n.target.value}),style:{width:28,height:28,border:"1px solid #dee2e6",borderRadius:6,cursor:"pointer",padding:2,background:"#fff"}}),e.jsx("input",{className:j,value:c.activeTextColor??"",onChange:n=>s({...l,activeTextColor:n.target.value||void 0}),placeholder:"auto",style:{flex:1}})]})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Inactive text"}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx("input",{type:"color",value:c.inactiveTextColor??"#64748b",onChange:n=>s({...l,inactiveTextColor:n.target.value}),style:{width:28,height:28,border:"1px solid #dee2e6",borderRadius:6,cursor:"pointer",padding:2,background:"#fff"}}),e.jsx("input",{className:j,value:c.inactiveTextColor??"",onChange:n=>s({...l,inactiveTextColor:n.target.value||void 0}),placeholder:"#64748b",style:{flex:1}})]})]})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Styles"}),e.jsx("input",{className:j,value:c.styles??"",onChange:n=>s({...l,styles:n.target.value||void 0}),placeholder:"None"})]}),e.jsx("span",{style:{...F,marginTop:4},children:"Spacing"}),e.jsx(_,{label:"Height",value:c.height??"auto",options:[{value:"auto",label:"Auto"},{value:"fixed",label:"Fixed"}],onChange:n=>s({...l,height:n})}),e.jsx(_,{label:"Margin",value:c.margin??"normal",options:[{value:"normal",label:"Normal"},{value:"none",label:"None"}],onChange:n=>s({...l,margin:n})})]}),m&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[e.jsx("span",{style:F,children:"Options"}),e.jsx(Q,{options:c.options??[],onChange:n=>s({...l,options:n})})]}),l.type==="array"&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5,display:"flex",flexDirection:"column",gap:1},children:[e.jsx("span",{style:F,children:"Array settings"}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Item type"}),e.jsx("select",{className:j,style:{cursor:"pointer"},value:c.itemType??"text",onChange:n=>s({...l,itemType:n.target.value}),children:ce.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))})]}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Item label"}),e.jsx("input",{className:j,value:c.itemLabel??"",onChange:n=>s({...l,itemLabel:n.target.value||void 0}),placeholder:'e.g. "Member"'})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Add button label"}),e.jsx("input",{className:j,value:c.addLabel??"",onChange:n=>s({...l,addLabel:n.target.value||void 0}),placeholder:"Add item"})]})]}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Min items"}),e.jsx("input",{type:"number",min:0,className:j,value:c.minItems??"",onChange:n=>s({...l,minItems:n.target.value?Number(n.target.value):void 0}),placeholder:"0"})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Max items"}),e.jsx("input",{type:"number",min:1,className:j,value:c.maxItems??"",onChange:n=>s({...l,maxItems:n.target.value?Number(n.target.value):void 0}),placeholder:"∞"})]})]}),!["object","array","select"].includes(c.itemType??"text")&&e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Item placeholder"}),e.jsx("input",{className:j,value:c.itemPlaceholder??"",onChange:n=>s({...l,itemPlaceholder:n.target.value||void 0}),placeholder:"Enter value…"})]})]}),e.jsx(ue,{condition:l.condition,onChange:n=>s({...l,condition:n})}),e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[e.jsx(o.Box,{component:"button",onClick:()=>p(n=>!n),sx:{background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:.5,p:0,mb:t?1.25:0},children:e.jsxs("span",{style:{...F,margin:0,color:t?"#6366f1":"#94a3b8"},children:[t?"▾":"▸"," Optional settings"]})}),e.jsx(o.Collapse,{in:t,children:e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Placeholder"}),e.jsx("input",{className:j,value:l.placeholder??"",onChange:n=>x("placeholder",n.target.value||void 0),placeholder:"Hint text…"})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Helper text"}),e.jsx("input",{className:j,value:l.helperText??"",onChange:n=>x("helperText",n.target.value||void 0),placeholder:"Description…"})]})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Info tooltip"}),e.jsx("input",{className:j,value:l.info??"",onChange:n=>x("info",n.target.value||void 0),placeholder:"Shown in ℹ tooltip"})]}),e.jsxs(o.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1.5},children:[e.jsx(E,{id:`${i}-req`,label:"Required",checked:!!l.required,onChange:n=>x("required",n||void 0)}),e.jsx(E,{id:`${i}-dis`,label:"Disabled",checked:!!l.disabled,onChange:n=>x("disabled",n||void 0)}),e.jsx(E,{id:`${i}-hid`,label:"Hidden",checked:!!l.hidden,onChange:n=>x("hidden",n||void 0)}),e.jsx(E,{id:`${i}-opt`,label:"Show optional",checked:!!l.showOptional,onChange:n=>x("showOptional",n||void 0)}),e.jsx(E,{id:`${i}-div`,label:"Divider after",checked:!!l.dividerAfter,onChange:n=>x("dividerAfter",n||void 0)}),e.jsx(E,{id:`${i}-frm`,label:"Formula input",checked:!!l.formula,onChange:n=>x("formula",n||void 0)})]})]})})]})]}),!r&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",gap:1,justifyContent:"flex-end",bgcolor:"#f8fafc",flexShrink:0},children:[e.jsx(o.Box,{component:"button",onClick:a,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),e.jsxs(o.Box,{component:"button",onClick:d,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[e.jsx(S.MdCheck,{size:15})," Save"]})]})]})}const L={text:"#0f172a",textMuted:"#64748b",borderInput:"rgba(0,0,0,0.23)",bg:"#ffffff"},fe={md:"6px"},oe={sm:11,md:13},G={width:"100%",fontSize:oe.md,fontFamily:"inherit",padding:"8px 12px",border:`1px solid ${L.borderInput}`,borderRadius:fe.md,outline:"none",background:L.bg,color:L.text,boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s"};function X(){return{type:"text",id:"",label:"",colSpan:12}}function be(l){return l.type==="object"||l.type==="array"||l.type==="schema"}function me(l){if(l.type==="object")return"Child Fields";if(l.type==="schema")return"Schema Fields";const s=l.itemType??"text";return s==="object"?"Item Fields":s==="select"?"Item Options":"Item Config"}function ge({field:l,onChange:s}){var r;const d=l,a=d.itemType??"text";if(l.type==="object")return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Define the fields nested inside this object. Each child field can itself be an object or array."}),e.jsx(W,{value:l.children??[],onChange:t=>s({...l,children:t}),label:"Child fields"})]});if(l.type==="schema")return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Define the fields inside this schema. When the form is filled, their values are collected into a single object as this field's value."}),e.jsx(W,{value:l.children??[],onChange:t=>s({...l,children:t}),label:"Schema fields"})]});if(l.type==="array"){if(a==="object")return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Define the fields for each item in the array. Each item will be an object with these fields."}),e.jsx(W,{value:d.itemFields??[],onChange:t=>s({...l,itemFields:t}),label:"Item fields"})]});if(a==="select"){const t=d.itemOptions??[];return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Options available in each select item."}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,mb:.75},children:t.map((p,i)=>e.jsxs(o.Box,{sx:{display:"flex",gap:.5,alignItems:"center"},children:[e.jsx("input",{style:{...G,flex:1,padding:"6px 10px"},placeholder:"Label",value:p.label,onChange:c=>{const m=t.map((y,B)=>B===i?{...y,label:c.target.value}:y);s({...l,itemOptions:m})}}),e.jsx("input",{style:{...G,flex:1,padding:"6px 10px"},placeholder:"Value",value:p.value,onChange:c=>{const m=t.map((y,B)=>B===i?{...y,value:c.target.value}:y);s({...l,itemOptions:m})}}),e.jsx(o.Box,{component:"button",onClick:()=>s({...l,itemOptions:t.filter((c,m)=>m!==i)}),sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:"✕"})]},i))}),e.jsx(o.Box,{component:"button",onClick:()=>s({...l,itemOptions:[...t,{label:"",value:""}]}),sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,px:1,py:.5,borderRadius:"6px",color:"#6366f1",width:"100%",justifyContent:"center","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:"+ Add option"})]})}if(a==="array"){const t=((r=d.itemSchema)==null?void 0:r.itemType)??"text",p=[{value:"text",label:"Text"},{value:"number",label:"Number"},{value:"email",label:"Email"},{value:"url",label:"URL"},{value:"password",label:"Password"},{value:"select",label:"Select"},{value:"object",label:"Object"}];return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Each item is itself an array. Configure the type of items inside the nested array."}),e.jsx("label",{style:{fontSize:oe.sm,fontWeight:600,color:L.textMuted,display:"block",marginBottom:3},children:"Nested item type"}),e.jsx("select",{style:{...G,padding:"6px 10px",cursor:"pointer"},value:t,onChange:i=>s({...l,itemSchema:{...d.itemSchema??{},itemType:i.target.value}}),children:p.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))})]})}return e.jsx(o.Box,{sx:{p:2.5},children:e.jsxs(o.Box,{sx:{border:"1.5px dashed #e2e8f0",borderRadius:"8px",py:3,textAlign:"center"},children:[e.jsxs(o.Typography,{sx:{fontSize:13,color:"#94a3b8"},children:["No extra configuration needed for ",e.jsx("strong",{children:a})," items."]}),e.jsx(o.Typography,{sx:{fontSize:11,color:"#cbd5e1",mt:.5},children:"Item placeholder and labels are set in the previous step."})]})})}return null}function je({field:l}){var p;const[s,d]=h.useState({}),a=l.id??l.name??"preview",r=[{value:3,label:"1/4"},{value:4,label:"1/3"},{value:6,label:"1/2"},{value:8,label:"2/3"},{value:12,label:"Full"}],t=l.colSpan&&l.colSpan<12?((p=r.find(i=>i.value===l.colSpan))==null?void 0:p.label)??l.colSpan:"Full";return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",mb:2,px:1.25,py:.75,bgcolor:"#f0fdf4",border:"1px solid #bbf7d0",borderRadius:"7px"},children:[e.jsx(o.Typography,{sx:{fontSize:11,color:"#15803d",fontWeight:500,flex:1},children:"Live preview — interact to test the field"}),e.jsxs(o.Typography,{sx:{fontSize:11,color:"#64748b"},children:["Width: ",t]})]}),e.jsx(N.FlowForm,{schema:{layout:"flat",fields:[l]},initialValues:{[a]:l.type==="array"?[]:l.type==="object"||l.type==="schema"?{}:""},onSubmit:()=>{},conditionConfig:s,onConditionConfigChange:d})]})}function J({open:l,initial:s,onSave:d,onClose:a,editMode:r=!1}){const[t,p]=h.useState(1),[i,c]=h.useState(()=>s??X());function m(){c(s??X()),p(1)}const y=be(i),B=y?3:2,x=y?["Configure",me(i),"Preview"]:["Configure","Preview"],n=!!(i.id||i.name)&&!!i.type;function f(){p(k=>Math.min(k+1,B))}function u(){p(k=>Math.max(k-1,1))}function v(){d(i),a()}const g=t-1,w=t===B,T=y&&t===3||!y&&t===2;return e.jsxs(o.Dialog,{open:l,onClose:a,TransitionProps:{onEnter:m},maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"90vh"}},children:[e.jsxs(o.Box,{sx:{px:2.5,pt:1.75,pb:0,borderBottom:"1px solid #e2e8f0",flexShrink:0},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",mb:1.5},children:[e.jsx(o.Typography,{sx:{fontSize:14,fontWeight:700,color:"#0f172a",flex:1},children:r?"Edit Field":"Add Field"}),e.jsx(o.IconButton,{size:"small",onClick:a,sx:{color:"#94a3b8"},children:e.jsx(S.MdClose,{size:17})})]}),e.jsx(o.Stepper,{activeStep:g,sx:{pb:1.5},children:x.map((k,R)=>e.jsx(o.Step,{completed:g>R,children:e.jsx(o.StepLabel,{children:k})},k))})]}),e.jsxs(o.Box,{sx:{flex:1,overflowY:"auto"},children:[t===1&&e.jsx(le,{field:i,onChange:c,onSave:f,onCancel:a,noFooter:!0}),t===2&&y&&e.jsx(ge,{field:i,onChange:c}),T&&e.jsx(je,{field:i})]}),e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",alignItems:"center",gap:1,flexShrink:0,bgcolor:"#f8fafc"},children:[t>1&&e.jsxs(o.Box,{component:"button",onClick:u,sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"none",cursor:"pointer",fontSize:13,fontWeight:500,color:"#6c757d",px:0,"&:hover":{color:"#0f172a"}},children:[e.jsx(S.MdArrowBack,{size:14})," Back"]}),e.jsx(o.Box,{sx:{flex:1}}),e.jsx(o.Box,{component:"button",onClick:a,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),w?e.jsxs(o.Box,{component:"button",onClick:v,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[e.jsx(S.MdCheck,{size:15})," ",r?"Save changes":"Add field"]}):e.jsx(o.Box,{component:"button",onClick:f,disabled:!n,sx:{border:"none",cursor:n?"pointer":"not-allowed",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:n?"#6366f1":"#c7d2fe",color:"#fff","&:hover":{bgcolor:n?"#4f46e5":"#c7d2fe"}},children:"Next →"})]})]})}function ye({field:l,index:s,total:d,onEdit:a,onDelete:r,onMoveUp:t,onMoveDown:p}){const i=l.label||l.id||l.name||"Untitled",c=l.id??l.name??"";return e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1,border:"1px solid #e2e8f0",borderRadius:"8px",bgcolor:"#fff"},children:[e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.25,color:"#cbd5e1"},children:[e.jsx(o.Box,{component:"button",onClick:t,disabled:s===0,sx:{background:"none",border:"none",p:0,cursor:s===0?"default":"pointer",color:s===0?"#e2e8f0":"#94a3b8",lineHeight:1,fontSize:10,"&:hover":{color:s===0?"#e2e8f0":"#475569"}},children:"▲"}),e.jsx(o.Box,{component:"button",onClick:p,disabled:s===d-1,sx:{background:"none",border:"none",p:0,cursor:s===d-1?"default":"pointer",color:s===d-1?"#e2e8f0":"#94a3b8",lineHeight:1,fontSize:10,"&:hover":{color:s===d-1?"#e2e8f0":"#475569"}},children:"▼"})]}),e.jsx(o.Box,{sx:{fontSize:10,fontWeight:700,px:.75,py:.2,borderRadius:"4px",bgcolor:"#eef2ff",color:"#6366f1",flexShrink:0},children:l.type}),e.jsxs(o.Box,{sx:{flex:1,minWidth:0},children:[e.jsxs(o.Typography,{sx:{fontSize:13,fontWeight:600,color:"#0f172a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[i,l.required&&e.jsx(o.Box,{component:"span",sx:{color:"#dc3545",ml:.25},children:"*"})]}),e.jsx(o.Typography,{sx:{fontSize:11,color:"#94a3b8",fontFamily:"monospace"},children:c})]}),e.jsx(o.Tooltip,{title:"Edit field",placement:"top",children:e.jsx(o.Box,{component:"button",onClick:a,sx:{background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:"6px",p:0,color:"#94a3b8","&:hover":{bgcolor:"#f1f5f9",color:"#475569"}},children:e.jsx(S.MdEdit,{size:14})})}),e.jsx(o.Tooltip,{title:"Remove field",placement:"top",children:e.jsx(o.Box,{component:"button",onClick:r,sx:{background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:"6px",p:0,color:"#94a3b8","&:hover":{bgcolor:"#fee2e2",color:"#dc2626"}},children:e.jsx(S.MdDeleteOutline,{size:16})})})]})}function ve({open:l,value:s,onSave:d,onClose:a}){const[r,t]=h.useState(s),[p,i]=h.useState(null);function c(){t(s),i(null)}function m(f){t(u=>u.filter((v,g)=>g!==f))}function y(f,u){t(v=>{const g=[...v],w=f+u;return w<0||w>=g.length?v:([g[f],g[w]]=[g[w],g[f]],g)})}function B(f){p!==null&&(t(u=>{const v=[...u];return v[p]=f,v}),i(null))}function x(){d(r),a()}const n=JSON.stringify(r)!==JSON.stringify(s);return e.jsxs(e.Fragment,{children:[e.jsxs(o.Dialog,{open:l,onClose:a,TransitionProps:{onEnter:c},maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"85vh"}},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",px:2.5,py:1.75,borderBottom:"1px solid #e2e8f0",flexShrink:0},children:[e.jsxs(o.Box,{sx:{flex:1},children:[e.jsx(o.Typography,{sx:{fontSize:14,fontWeight:700,color:"#0f172a"},children:"Edit Schema"}),e.jsxs(o.Typography,{sx:{fontSize:11,color:"#94a3b8"},children:[r.length," field",r.length!==1?"s":""," defined"]})]}),e.jsx(o.IconButton,{size:"small",onClick:a,sx:{color:"#94a3b8"},children:e.jsx(S.MdClose,{size:17})})]}),e.jsx(o.Box,{sx:{flex:1,overflowY:"auto",p:2.5},children:r.length===0?e.jsx(o.Box,{sx:{border:"1.5px dashed rgba(0,0,0,0.12)",borderRadius:"8px",py:4,textAlign:"center"},children:e.jsx(o.Typography,{sx:{fontSize:13,color:"#94a3b8"},children:"No fields defined yet"})}):e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.75},children:r.map((f,u)=>e.jsx(ye,{field:f,index:u,total:r.length,onEdit:()=>i(u),onDelete:()=>m(u),onMoveUp:()=>y(u,-1),onMoveDown:()=>y(u,1)},`${f.id??f.name}-${u}`))})}),e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",alignItems:"center",gap:1,flexShrink:0,bgcolor:"#f8fafc"},children:[n?e.jsx(o.Typography,{sx:{fontSize:11,color:"#f59e0b",fontWeight:500,flex:1},children:"Unsaved changes"}):e.jsx(o.Box,{sx:{flex:1}}),e.jsx(o.Box,{component:"button",onClick:a,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),e.jsxs(o.Box,{component:"button",onClick:x,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[e.jsx(S.MdCheck,{size:15})," Done"]})]})]}),p!==null&&e.jsx(J,{open:p!==null,initial:r[p],onSave:B,onClose:()=>i(null),editMode:!0})]})}function se(l){const s={};for(const d of l){const a=d.id??d.name??"";a&&(d.type==="array"?s[a]=[]:d.type==="object"||d.type==="schema"?s[a]=se(d.children??[]):s[a]="")}return s}function W({value:l,onChange:s,suggestions:d,label:a="Fields",onPayload:r,validate:t=!0,onValidityChange:p,variableGroups:i,initialValues:c,initialFormulaConfig:m,initialConditionConfig:y}){const[B,x]=h.useState(!1),[n,f]=h.useState(!1),[u,v]=h.useState(null),[g,w]=h.useState(m??{}),[T,k]=h.useState(y??{}),R=h.useRef(c??{}),A=h.useMemo(()=>se(l),[l]),$=h.useMemo(()=>c&&Object.keys(c).length>0?{...A,...c}:A,[A,c]),M=h.useMemo(()=>t?N.buildValidationSchema(l):void 0,[t,l]);h.useEffect(()=>{r&&r({schema:l,formulaConfig:g,conditionConfig:T,conditionExpressions:N.serializeConditionExpressions(T),values:R.current,evaluationPayload:N.buildEvaluationPayload({values:R.current,conditionConfig:T})})},[T,g,l]);const V=h.useCallback(z=>{R.current=z,r&&r({schema:l,formulaConfig:g,conditionConfig:T,conditionExpressions:N.serializeConditionExpressions(T),values:z,evaluationPayload:N.buildEvaluationPayload({values:z,conditionConfig:T})})},[l,g,T,r]);function P(z){s([...l,z])}function q(z){if(!u)return;const{containerFieldId:D,tabId:H}=u,U=l.map(I=>{if((I.id??I.name)!==D)return I;const Y=I.tabs??[];return{...I,tabs:Y.map(O=>O.id===H?{...O,fields:[...O.fields??[],z]}:O)}});s(U),v(null)}function C(z,D,H){const U=l.map(I=>{if((I.id??I.name)!==z)return I;const Y=I.tabs??[];return{...I,tabs:Y.map(O=>O.id===D?{...O,fields:(O.fields??[]).filter((Be,te)=>te!==H)}:O)}});s(U)}const ne=h.useMemo(()=>({openAddFieldDialog:(z,D)=>v({containerFieldId:z,tabId:D}),removeFieldFromTab:C}),[l,s]),K=e.jsxs("div",{className:"schema-builder-root",children:[l.length>0&&e.jsx("div",{className:"schema-builder-header",children:e.jsxs("div",{className:"schema-builder-actions",children:[e.jsx(o.Tooltip,{title:"Edit schema",placement:"top",children:e.jsxs("button",{className:"sb-btn sb-btn-outline",onClick:()=>f(!0),children:[e.jsx(S.MdSettings,{size:13})," Edit Schema"]})}),e.jsx(o.Tooltip,{title:"Add a new field",placement:"top",children:e.jsxs("button",{className:"sb-btn sb-btn-primary",onClick:()=>x(!0),children:[e.jsx(S.MdAdd,{size:14})," Add Field"]})})]})}),l.length>0?e.jsx(N.TabsEditContext.Provider,{value:ne,children:e.jsx(N.FlowForm,{schema:{layout:"flat",fields:l},initialValues:$,onSubmit:()=>{},validationSchema:M,onValidityChange:p,onValuesChange:r?V:void 0,formulaConfig:g,onFormulaConfigChange:w,conditionConfig:T,onConditionConfigChange:k})}):e.jsxs("div",{className:"schema-builder-empty-state",children:[e.jsx(ie.FaWpforms,{size:40,className:"schema-builder-empty-icon"}),e.jsx("p",{className:"schema-builder-empty-title",children:"Tell us what fields should be in the list, and assign values to them."}),e.jsx("div",{className:"schema-builder-empty-actions",children:e.jsx("button",{className:"btn",onClick:()=>x(!0),children:"Add field"})})]}),e.jsx(J,{open:B,onSave:P,onClose:()=>x(!1)}),e.jsx(ve,{open:n,value:l,onSave:s,onClose:()=>f(!1)}),e.jsx(J,{open:!!u,onSave:q,onClose:()=>v(null)})]});return i?e.jsxs(N.VariablePickerProvider,{groups:i,children:[e.jsx(N.VariablePicker,{width:260,mode:"popover"}),K]}):K}function Ce({fields:l,onOpen:s}){return e.jsxs(o.Box,{sx:{border:"1px solid #e2e8f0",borderRadius:"8px",bgcolor:"#fff",overflow:"hidden"},children:[l.length>0?e.jsx(o.Box,{sx:{px:1.5,py:1.25,display:"flex",flexWrap:"wrap",gap:.5},children:l.map((d,a)=>{const r=d.id??d.name??"";return e.jsx(o.Tooltip,{title:`${d.type} · ${r}`,placement:"top",children:e.jsx(o.Chip,{label:d.label||r,size:"small",sx:{fontSize:11,fontWeight:500,height:22,bgcolor:"#f1f5f9",color:"#334155",border:"1px solid #e2e8f0","& .MuiChip-label":{px:1}}})},a)})}):e.jsx(o.Box,{sx:{px:1.5,py:1.5},children:e.jsx(o.Typography,{sx:{fontSize:12,color:"#94a3b8"},children:"No fields defined yet"})}),e.jsx(o.Divider,{sx:{borderColor:"#f1f5f9"}}),e.jsxs(o.Box,{onClick:s,sx:{display:"flex",alignItems:"center",gap:.75,px:1.5,py:1,cursor:"pointer","&:hover":{bgcolor:"#f8fafc"},transition:"background 0.12s"},children:[l.length===0?e.jsx(S.MdAdd,{size:14,color:"#6366f1"}):e.jsx(S.MdSettings,{size:13,color:"#6366f1"}),e.jsx(o.Typography,{sx:{fontSize:12,fontWeight:600,color:"#6366f1",flex:1},children:l.length===0?"Add fields":"Configure fields"}),e.jsx(S.MdArrowForward,{size:13,color:"#94a3b8"})]})]})}function Se({value:l,onChange:s,suggestions:d,onPayload:a,onDone:r,validate:t,onValidityChange:p,label:i="Fields",drawerTitle:c="Configure Fields",drawerWidth:m=580}){const[y,B]=h.useState(!1),[x,n]=h.useState({type:"list"}),[f,u]=h.useState(l),v=h.useRef(null),g=h.useRef(void 0),w=h.useRef(void 0),T=h.useRef(void 0),[k,R]=h.useState(null);function A(){u(l),n({type:"list"}),B(!0)}function $(){const C=v.current;C&&(g.current=C.values,w.current=C.formulaConfig,T.current=C.conditionConfig),s(f),B(!1),r==null||r(f,C)}function M(){const C=v.current;C&&(g.current=C.values,w.current=C.formulaConfig,T.current=C.conditionConfig),u(l),B(!1)}function V(){if(x.type!=="edit"||!k)return;const C=[...f];C[x.index]=k,u(C),n({type:"list"}),R(null)}function P(){n({type:"list"}),R(null)}const q=JSON.stringify(f)!==JSON.stringify(l);return x.type==="edit"&&f[x.index],e.jsxs(e.Fragment,{children:[e.jsxs(o.Box,{children:[e.jsx(o.Typography,{sx:{fontSize:12,fontWeight:700,color:"#64748b",textTransform:"uppercase",letterSpacing:.5,mb:.75},children:i}),e.jsx(Ce,{fields:l,onOpen:A})]}),e.jsxs(o.Drawer,{anchor:"right",open:y,onClose:M,PaperProps:{sx:{width:m,display:"flex",flexDirection:"column",boxShadow:"-4px 0 24px rgba(0,0,0,0.12)",overflow:"hidden"}},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",px:2,py:1.5,borderBottom:"1px solid #e2e8f0",flexShrink:0,gap:1},children:[x.type==="edit"&&e.jsx(o.Tooltip,{title:"Back to fields",placement:"bottom",children:e.jsx(o.IconButton,{size:"small",onClick:P,sx:{color:"#64748b"},children:e.jsx(S.MdArrowBack,{size:17})})}),e.jsxs(o.Box,{sx:{flex:1},children:[e.jsx(o.Typography,{sx:{fontSize:14,fontWeight:700,color:"#0f172a"},children:x.type==="edit"?(k==null?void 0:k.label)||(k==null?void 0:k.id)||"Edit field":c}),e.jsx(o.Typography,{sx:{fontSize:11,color:"#94a3b8"},children:x.type==="edit"?"Configure field properties":`${f.length} field${f.length!==1?"s":""} defined`})]}),x.type==="list"&&e.jsx(o.Tooltip,{title:"Close",placement:"bottom",children:e.jsx(o.IconButton,{size:"small",onClick:M,sx:{color:"#94a3b8"},children:e.jsx(S.MdClose,{size:17})})})]}),x.type==="list"&&e.jsxs(e.Fragment,{children:[e.jsx(o.Box,{sx:{flex:1,overflowY:"auto",p:2.5},children:e.jsx(W,{value:f,onChange:u,suggestions:d,onPayload:C=>{v.current=C,g.current=C.values,w.current=C.formulaConfig,T.current=C.conditionConfig,a==null||a(C)},validate:t,onValidityChange:p,label:i,initialValues:g.current,initialFormulaConfig:w.current,initialConditionConfig:T.current})}),e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",alignItems:"center",gap:1,flexShrink:0,bgcolor:"#f8fafc"},children:[q?e.jsx(o.Typography,{sx:{fontSize:11,color:"#f59e0b",fontWeight:500,flex:1},children:"Unsaved changes"}):e.jsx(o.Box,{sx:{flex:1}}),e.jsx(o.Box,{component:"button",onClick:M,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),e.jsxs(o.Box,{component:"button",onClick:$,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[e.jsx(S.MdCheck,{size:15})," Done"]})]})]}),x.type==="edit"&&k&&e.jsx(le,{field:k,onChange:R,onSave:V,onCancel:P})]})]})}exports.FIELD_TYPE_OPTIONS=Z;exports.SchemaBuilder=W;exports.SchemaBuilderDrawer=Se;exports.useFlowForm=ae;
1
+ "use strict";const h=require("react"),re=require("formik"),N=require("./index-BAg_DA8n.js"),e=require("react/jsx-runtime"),o=require("@mui/material"),S=require("react-icons/md"),ie=require("react-icons/fa6");function ae({schema:l,initialValues:s,onSubmit:d,showErrorsImmediately:a=!1}){const r=l.fields??[],t=h.useMemo(()=>N.buildValidationSchema(r),[r]),p=h.useMemo(()=>{if(a)return r.reduce((u,v)=>{const g=N.resolveFieldKey(v);return g&&(u[g]=!0),u},{})},[r,a]),[i,c]=h.useState({}),[m,y]=h.useState({}),B=h.useRef(s);h.useEffect(()=>{B.current!==s&&(B.current=s,c({}),y({}))},[s]);const x=re.useFormik({initialValues:s,validationSchema:t,initialTouched:p,validateOnMount:a,validateOnChange:!0,validateOnBlur:!0,enableReinitialize:!0,onSubmit:async u=>{const v=N.buildEvaluationPayload({values:u,conditionConfig:m});await d(u,v)}}),n=h.useCallback(()=>{x.submitForm()},[x]),f=h.useCallback(u=>{x.resetForm(u?{values:u}:void 0),c({}),y({})},[x]);return{values:x.values,errors:x.errors,isValid:x.isValid,isDirty:x.dirty,isSubmitting:x.isSubmitting,formulaConfig:i,conditionConfig:m,submit:n,reset:f,setFieldValue:x.setFieldValue,_schema:l,_formik:x,_formulaConfig:i,_onFormulaConfigChange:c,_conditionConfig:m,_onConditionConfigChange:y}}const Z=N.FlowForgeRegistry.getTypeOptions(),j="form-control font-14",b="text-14 text-dark fw-medium mb-1 align-items-center d-flex gap-1",F={fontSize:10,fontWeight:700,color:"#94a3b8",textTransform:"uppercase",letterSpacing:.6,marginBottom:8,display:"block"},ce=[{value:"text",label:"Text"},{value:"number",label:"Number"},{value:"email",label:"Email"},{value:"url",label:"URL"},{value:"password",label:"Password"},{value:"select",label:"Select"},{value:"object",label:"Object (sub-fields)"},{value:"array",label:"Array (nested)"}],de=[{value:3,label:"1/4"},{value:4,label:"1/3"},{value:6,label:"1/2"},{value:8,label:"2/3"},{value:12,label:"Full"}];function xe({value:l,onChange:s}){const d=l??12;return e.jsxs(o.Box,{children:[e.jsx("span",{className:b,children:"Column width"}),e.jsx(o.Box,{sx:{display:"flex",gap:.5},children:de.map(a=>e.jsx(o.Tooltip,{title:`colSpan: ${a.value}`,placement:"top",children:e.jsx(o.Box,{component:"button",onClick:()=>s(a.value),sx:{flex:1,border:"1px solid",borderColor:d===a.value?"#6366f1":"#dee2e6",borderRadius:"6px",cursor:"pointer",bgcolor:d===a.value?"#eef2ff":"#fff",color:d===a.value?"#6366f1":"#6c757d",fontSize:11,fontWeight:600,py:.6,px:0,"&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:a.label})},a.value))}),e.jsx(o.Box,{sx:{display:"flex",gap:"3px",mt:.75},children:Array.from({length:12}).map((a,r)=>e.jsx(o.Box,{sx:{flex:1,height:4,borderRadius:"2px",bgcolor:r<d?"#6366f1":"#e2e8f0",transition:"background 0.12s"}},r))})]})}function Q({options:l=[],onChange:s}){function d(a,r,t){s(l.map((p,i)=>i===a?{...p,[r]:t}:p))}return e.jsxs(o.Box,{children:[e.jsxs("span",{className:b,children:["Options ",e.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,mb:.75},children:l.map((a,r)=>e.jsxs(o.Box,{sx:{display:"flex",gap:.5,alignItems:"center"},children:[e.jsx("input",{className:j,style:{flex:1},placeholder:"Label",value:a.label,onChange:t=>d(r,"label",t.target.value)}),e.jsx("input",{className:j,style:{flex:1},placeholder:"Value",value:a.value,onChange:t=>d(r,"value",t.target.value)}),e.jsx(o.Box,{component:"button",onClick:()=>s(l.filter((t,p)=>p!==r)),sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:e.jsx(S.MdClose,{size:13})})]},r))}),e.jsxs(o.Box,{component:"button",onClick:()=>s([...l,{label:"",value:""}]),sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,px:1,py:.5,borderRadius:"6px",color:"#6366f1",width:"100%","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:[e.jsx(S.MdAdd,{size:13})," Add option"]})]})}const ee=[{value:"operator",label:"Operator (predefined)"},{value:"select",label:"Select"},{value:"text",label:"Text"}];function pe({col:l,onChange:s,onDelete:d}){const a=l.type==="select",r=l.type==="operator";return e.jsxs(o.Box,{sx:{border:"1px solid #e2e8f0",borderRadius:"7px",p:1.25,bgcolor:"#fff",display:"flex",flexDirection:"column",gap:1},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx(o.Box,{sx:{fontSize:10,fontWeight:700,px:.75,py:.2,borderRadius:"4px",bgcolor:r?"#fef9c3":"#eef2ff",color:r?"#92400e":"#6366f1",flexShrink:0},children:r?"OPERATOR":l.type.toUpperCase()}),e.jsx(o.Box,{sx:{fontSize:12,fontWeight:600,color:"#0f172a",flex:1},children:l.label||l.id||"Unnamed"}),e.jsx(o.Box,{component:"button",onClick:d,sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:e.jsx(S.MdClose,{size:13})})]}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Column type"}),e.jsx("select",{value:l.type,onChange:t=>s({...l,type:t.target.value,options:void 0}),className:j,style:{cursor:"pointer"},children:ee.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))})]}),e.jsxs(o.Box,{children:[e.jsxs("label",{className:b,children:["Column key ",e.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),e.jsx("input",{className:`${j} ${l.id?"":"border-danger"}`,value:l.id,onChange:t=>s({...l,id:t.target.value}),placeholder:"e.g. field, operator, value"}),!l.id&&e.jsx("span",{style:{fontSize:10,color:"#dc3545"},children:"Required — used as data key"})]})]}),!r&&e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Label"}),e.jsx("input",{className:j,value:l.label??"",onChange:t=>s({...l,label:t.target.value||void 0}),placeholder:"Column label"})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Placeholder"}),e.jsx("input",{className:j,value:l.placeholder??"",onChange:t=>s({...l,placeholder:t.target.value||void 0}),placeholder:"Hint…"})]})]}),a&&e.jsx(Q,{options:l.options??[],onChange:t=>s({...l,options:t})}),r&&e.jsx(o.Box,{sx:{bgcolor:"#fefce8",border:"1px solid #fef08a",borderRadius:"6px",px:1.25,py:.75},children:e.jsx(o.Box,{sx:{fontSize:11,color:"#78350f"},children:"Predefined: equals, not equals, contains, starts with, ends with, is present, is not present, greater than, less than…"})}),!r&&e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx("input",{type:"checkbox",id:`formula-${l.id}`,checked:!!l.formula,onChange:t=>s({...l,formula:t.target.checked||void 0}),style:{cursor:"pointer",width:14,height:14}}),e.jsx("label",{htmlFor:`formula-${l.id}`,className:b,style:{margin:0,cursor:"pointer"},children:"Formula input (chip editor)"})]})]})}function ue({condition:l,onChange:s}){const d=!!l;function a(){s(d?void 0:{fields:[]})}function r(i){if(!l)return;const c=i==="operator"?"operator":l.fields.filter(m=>m.type!=="operator").length===0?"field":"value";s({...l,fields:[...l.fields,{id:c,type:i}]})}function t(i,c){if(!l)return;const m=[...l.fields];m[i]=c,s({...l,fields:m})}function p(i){l&&s({...l,fields:l.fields.filter((c,m)=>m!==i)})}return e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75,mb:d?1.25:0},children:[e.jsx("input",{type:"checkbox",id:"enable-condition",checked:d,onChange:a,style:{cursor:"pointer",width:14,height:14}}),e.jsx("span",{style:{...F,margin:0,color:d?"#6366f1":"#94a3b8"},children:"Condition row"})]}),d&&l&&e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:[l.fields.map((i,c)=>e.jsx(pe,{col:i,onChange:m=>t(c,m),onDelete:()=>p(c)},c)),e.jsx(o.Box,{sx:{display:"flex",gap:.5},children:ee.map(i=>e.jsxs(o.Box,{component:"button",onClick:()=>r(i.value),sx:{flex:1,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,py:.5,borderRadius:"6px",color:i.value==="operator"?"#92400e":"#6366f1","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:["+ ",i.value==="operator"?"Operator":i.label.split(" ")[0]]},i.value))}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:2,flexWrap:"wrap"},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx("input",{type:"checkbox",id:"allow-groups",checked:!!l.allowGroups,onChange:i=>s({...l,allowGroups:i.target.checked||void 0}),style:{cursor:"pointer",width:14,height:14}}),e.jsx("label",{htmlFor:"allow-groups",className:b,style:{margin:0,cursor:"pointer"},children:"Allow nested groups"})]}),l.allowGroups&&e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx("label",{className:b,style:{margin:0},children:"Max depth"}),e.jsx("input",{type:"number",min:1,max:5,className:j,style:{width:60,textAlign:"center"},value:l.maxGroupDepth??"",onChange:i=>s({...l,maxGroupDepth:i.target.value?Number(i.target.value):void 0}),placeholder:"∞"})]})]})]})]})}function E({id:l,label:s,checked:d,onChange:a}){return e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx("input",{type:"checkbox",id:l,checked:d,onChange:r=>a(r.target.checked),style:{cursor:"pointer",width:14,height:14,flexShrink:0}}),e.jsx("label",{htmlFor:l,className:b,style:{margin:0,cursor:"pointer"},children:s})]})}function he({views:l=[],onChange:s}){function d(r,t,p){s(l.map((i,c)=>c===r?{...i,[t]:p}:i))}function a(){const r=`tab${l.length+1}`;s([...l,{id:r,label:`Tab ${l.length+1}`}])}return e.jsxs(o.Box,{children:[e.jsx("span",{className:b,children:"Views"}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,mb:.75},children:l.map((r,t)=>e.jsxs(o.Box,{sx:{display:"flex",gap:.5,alignItems:"center"},children:[e.jsx("input",{className:j,style:{flex:1},placeholder:"Label",value:r.label,onChange:p=>d(t,"label",p.target.value)}),e.jsx("input",{className:j,style:{flex:1},placeholder:"ID (no spaces)",value:r.id,onChange:p=>d(t,"id",p.target.value.replace(/\s/g,"_"))}),e.jsx(o.Box,{component:"button",onClick:()=>s(l.filter((p,i)=>i!==t)),sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:e.jsx(S.MdClose,{size:13})})]},t))}),e.jsxs(o.Box,{component:"button",onClick:a,sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,px:1,py:.5,borderRadius:"6px",color:"#6366f1",width:"100%","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:[e.jsx(S.MdAdd,{size:13})," Add view"]})]})}function _({label:l,value:s,options:d,onChange:a}){return e.jsxs(o.Box,{children:[e.jsx("span",{className:b,children:l}),e.jsx(o.Box,{sx:{display:"flex",border:"1px solid #dee2e6",borderRadius:"7px",overflow:"hidden"},children:d.map(r=>e.jsx(o.Box,{component:"button",onClick:()=>a(r.value),sx:{flex:1,border:"none",borderRight:"1px solid #dee2e6",cursor:"pointer",fontSize:12,fontWeight:600,py:.6,bgcolor:s===r.value?"#eef2ff":"#fff",color:s===r.value?"#6366f1":"#6c757d","&:last-child":{borderRight:"none"},"&:hover":{bgcolor:"#f5f3ff"}},children:r.label},r.value))})]})}function le({field:l,onChange:s,onSave:d,onCancel:a,noFooter:r}){const[t,p]=h.useState(!1),i=l.id??l.name??"",c=l,m=l.type==="select"||l.type==="descriptive-select"||l.type==="radio-group",y=N.FlowForgeRegistry.get(l.type),B=y==null?void 0:y.configSchema;function x(n,f){s({...l,[n]:f})}return e.jsxs(e.Fragment,{children:[e.jsxs(o.Box,{sx:{flex:1,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.75},children:[e.jsxs(o.Box,{children:[e.jsx("span",{style:F,children:"Required"}),e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Type"}),e.jsx("select",{value:l.type,onChange:n=>x("type",n.target.value),className:j,style:{cursor:"pointer"},children:Z.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))})]}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:l.type==="tabs"?"1fr":"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsxs("label",{className:b,children:["Field ID ",e.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),e.jsx("input",{className:j,value:l.id??l.name??"",onChange:n=>x("id",n.target.value),placeholder:"e.g. email"})]}),l.type!=="tabs"&&e.jsxs(o.Box,{children:[e.jsxs("label",{className:b,children:["Label ",e.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),e.jsx("input",{className:j,value:l.label??"",onChange:n=>x("label",n.target.value),placeholder:"Display label"})]})]}),l.type!=="tabs"&&e.jsx(xe,{value:l.colSpan,onChange:n=>x("colSpan",n===12?void 0:n)})]})]}),B&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[e.jsx("span",{style:F,children:"Specific Settings"}),e.jsx(N.FlowForm,{schema:{layout:"flat",compact:!0,fields:B.fields},initialValues:l,onValuesChange:n=>s({...l,...n}),onSubmit:()=>{}})]}),l.type==="tabs"&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5,display:"flex",flexDirection:"column",gap:1.5},children:[e.jsx("span",{style:F,children:"Content"}),e.jsx(he,{views:(c.tabs??[]).map(n=>({id:n.id,label:n.label})),onChange:n=>{const f=c.tabs??[],u=n.map(v=>{const g=f.find(w=>w.id===v.id);return g?{...g,...v}:{...v,fields:[]}});s({...l,tabs:u})}}),e.jsx("span",{style:{...F,marginTop:4},children:"Interaction"}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Disabled"}),e.jsx("input",{className:j,value:c.disabledExpr??"",onChange:n=>s({...l,disabledExpr:n.target.value||void 0}),placeholder:"false"})]}),e.jsx("span",{style:{...F,marginTop:4},children:"Appearance"}),e.jsx(_,{label:"Alignment",value:c.alignment??"left",options:[{value:"left",label:"|←"},{value:"center-left",label:"←|"},{value:"center",label:"|·|"},{value:"center-right",label:"|→"},{value:"right",label:"→|"}],onChange:n=>s({...l,alignment:n})}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Hidden"}),e.jsx("input",{className:j,value:c.hiddenExpr??"",onChange:n=>s({...l,hiddenExpr:n.target.value||void 0}),placeholder:"false"})]}),e.jsx(_,{label:"Variant",value:c.variant??"line",options:[{value:"pill",label:"Pill"},{value:"line",label:"Line"}],onChange:n=>s({...l,variant:n})}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Active color"}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx("input",{type:"color",value:c.activeColor??"#6366f1",onChange:n=>s({...l,activeColor:n.target.value}),style:{width:28,height:28,border:"1px solid #dee2e6",borderRadius:6,cursor:"pointer",padding:2,background:"#fff"}}),e.jsx("input",{className:j,value:c.activeColor??"",onChange:n=>s({...l,activeColor:n.target.value||void 0}),placeholder:"#6366f1",style:{flex:1}})]})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Active text"}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx("input",{type:"color",value:c.activeTextColor??"#ffffff",onChange:n=>s({...l,activeTextColor:n.target.value}),style:{width:28,height:28,border:"1px solid #dee2e6",borderRadius:6,cursor:"pointer",padding:2,background:"#fff"}}),e.jsx("input",{className:j,value:c.activeTextColor??"",onChange:n=>s({...l,activeTextColor:n.target.value||void 0}),placeholder:"auto",style:{flex:1}})]})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Inactive text"}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx("input",{type:"color",value:c.inactiveTextColor??"#64748b",onChange:n=>s({...l,inactiveTextColor:n.target.value}),style:{width:28,height:28,border:"1px solid #dee2e6",borderRadius:6,cursor:"pointer",padding:2,background:"#fff"}}),e.jsx("input",{className:j,value:c.inactiveTextColor??"",onChange:n=>s({...l,inactiveTextColor:n.target.value||void 0}),placeholder:"#64748b",style:{flex:1}})]})]})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Styles"}),e.jsx("input",{className:j,value:c.styles??"",onChange:n=>s({...l,styles:n.target.value||void 0}),placeholder:"None"})]}),e.jsx("span",{style:{...F,marginTop:4},children:"Spacing"}),e.jsx(_,{label:"Height",value:c.height??"auto",options:[{value:"auto",label:"Auto"},{value:"fixed",label:"Fixed"}],onChange:n=>s({...l,height:n})}),e.jsx(_,{label:"Margin",value:c.margin??"normal",options:[{value:"normal",label:"Normal"},{value:"none",label:"None"}],onChange:n=>s({...l,margin:n})})]}),m&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[e.jsx("span",{style:F,children:"Options"}),e.jsx(Q,{options:c.options??[],onChange:n=>s({...l,options:n})})]}),l.type==="array"&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5,display:"flex",flexDirection:"column",gap:1},children:[e.jsx("span",{style:F,children:"Array settings"}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Item type"}),e.jsx("select",{className:j,style:{cursor:"pointer"},value:c.itemType??"text",onChange:n=>s({...l,itemType:n.target.value}),children:ce.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))})]}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Item label"}),e.jsx("input",{className:j,value:c.itemLabel??"",onChange:n=>s({...l,itemLabel:n.target.value||void 0}),placeholder:'e.g. "Member"'})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Add button label"}),e.jsx("input",{className:j,value:c.addLabel??"",onChange:n=>s({...l,addLabel:n.target.value||void 0}),placeholder:"Add item"})]})]}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Min items"}),e.jsx("input",{type:"number",min:0,className:j,value:c.minItems??"",onChange:n=>s({...l,minItems:n.target.value?Number(n.target.value):void 0}),placeholder:"0"})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Max items"}),e.jsx("input",{type:"number",min:1,className:j,value:c.maxItems??"",onChange:n=>s({...l,maxItems:n.target.value?Number(n.target.value):void 0}),placeholder:"∞"})]})]}),!["object","array","select"].includes(c.itemType??"text")&&e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Item placeholder"}),e.jsx("input",{className:j,value:c.itemPlaceholder??"",onChange:n=>s({...l,itemPlaceholder:n.target.value||void 0}),placeholder:"Enter value…"})]})]}),e.jsx(ue,{condition:l.condition,onChange:n=>s({...l,condition:n})}),e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[e.jsx(o.Box,{component:"button",onClick:()=>p(n=>!n),sx:{background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:.5,p:0,mb:t?1.25:0},children:e.jsxs("span",{style:{...F,margin:0,color:t?"#6366f1":"#94a3b8"},children:[t?"▾":"▸"," Optional settings"]})}),e.jsx(o.Collapse,{in:t,children:e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Placeholder"}),e.jsx("input",{className:j,value:l.placeholder??"",onChange:n=>x("placeholder",n.target.value||void 0),placeholder:"Hint text…"})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Helper text"}),e.jsx("input",{className:j,value:l.helperText??"",onChange:n=>x("helperText",n.target.value||void 0),placeholder:"Description…"})]})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Info tooltip"}),e.jsx("input",{className:j,value:l.info??"",onChange:n=>x("info",n.target.value||void 0),placeholder:"Shown in ℹ tooltip"})]}),e.jsxs(o.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1.5},children:[e.jsx(E,{id:`${i}-req`,label:"Required",checked:!!l.required,onChange:n=>x("required",n||void 0)}),e.jsx(E,{id:`${i}-dis`,label:"Disabled",checked:!!l.disabled,onChange:n=>x("disabled",n||void 0)}),e.jsx(E,{id:`${i}-hid`,label:"Hidden",checked:!!l.hidden,onChange:n=>x("hidden",n||void 0)}),e.jsx(E,{id:`${i}-opt`,label:"Show optional",checked:!!l.showOptional,onChange:n=>x("showOptional",n||void 0)}),e.jsx(E,{id:`${i}-div`,label:"Divider after",checked:!!l.dividerAfter,onChange:n=>x("dividerAfter",n||void 0)}),e.jsx(E,{id:`${i}-frm`,label:"Formula input",checked:!!l.formula,onChange:n=>x("formula",n||void 0)})]})]})})]})]}),!r&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",gap:1,justifyContent:"flex-end",bgcolor:"#f8fafc",flexShrink:0},children:[e.jsx(o.Box,{component:"button",onClick:a,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),e.jsxs(o.Box,{component:"button",onClick:d,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[e.jsx(S.MdCheck,{size:15})," Save"]})]})]})}const L={text:"#0f172a",textMuted:"#64748b",borderInput:"rgba(0,0,0,0.23)",bg:"#ffffff"},fe={md:"6px"},oe={sm:11,md:13},G={width:"100%",fontSize:oe.md,fontFamily:"inherit",padding:"8px 12px",border:`1px solid ${L.borderInput}`,borderRadius:fe.md,outline:"none",background:L.bg,color:L.text,boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s"};function X(){return{type:"text",id:"",label:"",colSpan:12}}function be(l){return l.type==="object"||l.type==="array"||l.type==="schema"}function me(l){if(l.type==="object")return"Child Fields";if(l.type==="schema")return"Schema Fields";const s=l.itemType??"text";return s==="object"?"Item Fields":s==="select"?"Item Options":"Item Config"}function ge({field:l,onChange:s}){var r;const d=l,a=d.itemType??"text";if(l.type==="object")return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Define the fields nested inside this object. Each child field can itself be an object or array."}),e.jsx(W,{value:l.children??[],onChange:t=>s({...l,children:t}),label:"Child fields"})]});if(l.type==="schema")return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Define the fields inside this schema. When the form is filled, their values are collected into a single object as this field's value."}),e.jsx(W,{value:l.children??[],onChange:t=>s({...l,children:t}),label:"Schema fields"})]});if(l.type==="array"){if(a==="object")return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Define the fields for each item in the array. Each item will be an object with these fields."}),e.jsx(W,{value:d.itemFields??[],onChange:t=>s({...l,itemFields:t}),label:"Item fields"})]});if(a==="select"){const t=d.itemOptions??[];return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Options available in each select item."}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,mb:.75},children:t.map((p,i)=>e.jsxs(o.Box,{sx:{display:"flex",gap:.5,alignItems:"center"},children:[e.jsx("input",{style:{...G,flex:1,padding:"6px 10px"},placeholder:"Label",value:p.label,onChange:c=>{const m=t.map((y,B)=>B===i?{...y,label:c.target.value}:y);s({...l,itemOptions:m})}}),e.jsx("input",{style:{...G,flex:1,padding:"6px 10px"},placeholder:"Value",value:p.value,onChange:c=>{const m=t.map((y,B)=>B===i?{...y,value:c.target.value}:y);s({...l,itemOptions:m})}}),e.jsx(o.Box,{component:"button",onClick:()=>s({...l,itemOptions:t.filter((c,m)=>m!==i)}),sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:"✕"})]},i))}),e.jsx(o.Box,{component:"button",onClick:()=>s({...l,itemOptions:[...t,{label:"",value:""}]}),sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,px:1,py:.5,borderRadius:"6px",color:"#6366f1",width:"100%",justifyContent:"center","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:"+ Add option"})]})}if(a==="array"){const t=((r=d.itemSchema)==null?void 0:r.itemType)??"text",p=[{value:"text",label:"Text"},{value:"number",label:"Number"},{value:"email",label:"Email"},{value:"url",label:"URL"},{value:"password",label:"Password"},{value:"select",label:"Select"},{value:"object",label:"Object"}];return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Each item is itself an array. Configure the type of items inside the nested array."}),e.jsx("label",{style:{fontSize:oe.sm,fontWeight:600,color:L.textMuted,display:"block",marginBottom:3},children:"Nested item type"}),e.jsx("select",{style:{...G,padding:"6px 10px",cursor:"pointer"},value:t,onChange:i=>s({...l,itemSchema:{...d.itemSchema??{},itemType:i.target.value}}),children:p.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))})]})}return e.jsx(o.Box,{sx:{p:2.5},children:e.jsxs(o.Box,{sx:{border:"1.5px dashed #e2e8f0",borderRadius:"8px",py:3,textAlign:"center"},children:[e.jsxs(o.Typography,{sx:{fontSize:13,color:"#94a3b8"},children:["No extra configuration needed for ",e.jsx("strong",{children:a})," items."]}),e.jsx(o.Typography,{sx:{fontSize:11,color:"#cbd5e1",mt:.5},children:"Item placeholder and labels are set in the previous step."})]})})}return null}function je({field:l}){var p;const[s,d]=h.useState({}),a=l.id??l.name??"preview",r=[{value:3,label:"1/4"},{value:4,label:"1/3"},{value:6,label:"1/2"},{value:8,label:"2/3"},{value:12,label:"Full"}],t=l.colSpan&&l.colSpan<12?((p=r.find(i=>i.value===l.colSpan))==null?void 0:p.label)??l.colSpan:"Full";return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",mb:2,px:1.25,py:.75,bgcolor:"#f0fdf4",border:"1px solid #bbf7d0",borderRadius:"7px"},children:[e.jsx(o.Typography,{sx:{fontSize:11,color:"#15803d",fontWeight:500,flex:1},children:"Live preview — interact to test the field"}),e.jsxs(o.Typography,{sx:{fontSize:11,color:"#64748b"},children:["Width: ",t]})]}),e.jsx(N.FlowForm,{schema:{layout:"flat",fields:[l]},initialValues:{[a]:l.type==="array"?[]:l.type==="object"||l.type==="schema"?{}:""},onSubmit:()=>{},conditionConfig:s,onConditionConfigChange:d})]})}function J({open:l,initial:s,onSave:d,onClose:a,editMode:r=!1}){const[t,p]=h.useState(1),[i,c]=h.useState(()=>s??X());function m(){c(s??X()),p(1)}const y=be(i),B=y?3:2,x=y?["Configure",me(i),"Preview"]:["Configure","Preview"],n=!!(i.id||i.name)&&!!i.type;function f(){p(k=>Math.min(k+1,B))}function u(){p(k=>Math.max(k-1,1))}function v(){d(i),a()}const g=t-1,w=t===B,T=y&&t===3||!y&&t===2;return e.jsxs(o.Dialog,{open:l,onClose:a,TransitionProps:{onEnter:m},maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"90vh"}},children:[e.jsxs(o.Box,{sx:{px:2.5,pt:1.75,pb:0,borderBottom:"1px solid #e2e8f0",flexShrink:0},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",mb:1.5},children:[e.jsx(o.Typography,{sx:{fontSize:14,fontWeight:700,color:"#0f172a",flex:1},children:r?"Edit Field":"Add Field"}),e.jsx(o.IconButton,{size:"small",onClick:a,sx:{color:"#94a3b8"},children:e.jsx(S.MdClose,{size:17})})]}),e.jsx(o.Stepper,{activeStep:g,sx:{pb:1.5},children:x.map((k,R)=>e.jsx(o.Step,{completed:g>R,children:e.jsx(o.StepLabel,{children:k})},k))})]}),e.jsxs(o.Box,{sx:{flex:1,overflowY:"auto"},children:[t===1&&e.jsx(le,{field:i,onChange:c,onSave:f,onCancel:a,noFooter:!0}),t===2&&y&&e.jsx(ge,{field:i,onChange:c}),T&&e.jsx(je,{field:i})]}),e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",alignItems:"center",gap:1,flexShrink:0,bgcolor:"#f8fafc"},children:[t>1&&e.jsxs(o.Box,{component:"button",onClick:u,sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"none",cursor:"pointer",fontSize:13,fontWeight:500,color:"#6c757d",px:0,"&:hover":{color:"#0f172a"}},children:[e.jsx(S.MdArrowBack,{size:14})," Back"]}),e.jsx(o.Box,{sx:{flex:1}}),e.jsx(o.Box,{component:"button",onClick:a,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),w?e.jsxs(o.Box,{component:"button",onClick:v,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[e.jsx(S.MdCheck,{size:15})," ",r?"Save changes":"Add field"]}):e.jsx(o.Box,{component:"button",onClick:f,disabled:!n,sx:{border:"none",cursor:n?"pointer":"not-allowed",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:n?"#6366f1":"#c7d2fe",color:"#fff","&:hover":{bgcolor:n?"#4f46e5":"#c7d2fe"}},children:"Next →"})]})]})}function ye({field:l,index:s,total:d,onEdit:a,onDelete:r,onMoveUp:t,onMoveDown:p}){const i=l.label||l.id||l.name||"Untitled",c=l.id??l.name??"";return e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1,border:"1px solid #e2e8f0",borderRadius:"8px",bgcolor:"#fff"},children:[e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.25,color:"#cbd5e1"},children:[e.jsx(o.Box,{component:"button",onClick:t,disabled:s===0,sx:{background:"none",border:"none",p:0,cursor:s===0?"default":"pointer",color:s===0?"#e2e8f0":"#94a3b8",lineHeight:1,fontSize:10,"&:hover":{color:s===0?"#e2e8f0":"#475569"}},children:"▲"}),e.jsx(o.Box,{component:"button",onClick:p,disabled:s===d-1,sx:{background:"none",border:"none",p:0,cursor:s===d-1?"default":"pointer",color:s===d-1?"#e2e8f0":"#94a3b8",lineHeight:1,fontSize:10,"&:hover":{color:s===d-1?"#e2e8f0":"#475569"}},children:"▼"})]}),e.jsx(o.Box,{sx:{fontSize:10,fontWeight:700,px:.75,py:.2,borderRadius:"4px",bgcolor:"#eef2ff",color:"#6366f1",flexShrink:0},children:l.type}),e.jsxs(o.Box,{sx:{flex:1,minWidth:0},children:[e.jsxs(o.Typography,{sx:{fontSize:13,fontWeight:600,color:"#0f172a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[i,l.required&&e.jsx(o.Box,{component:"span",sx:{color:"#dc3545",ml:.25},children:"*"})]}),e.jsx(o.Typography,{sx:{fontSize:11,color:"#94a3b8",fontFamily:"monospace"},children:c})]}),e.jsx(o.Tooltip,{title:"Edit field",placement:"top",children:e.jsx(o.Box,{component:"button",onClick:a,sx:{background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:"6px",p:0,color:"#94a3b8","&:hover":{bgcolor:"#f1f5f9",color:"#475569"}},children:e.jsx(S.MdEdit,{size:14})})}),e.jsx(o.Tooltip,{title:"Remove field",placement:"top",children:e.jsx(o.Box,{component:"button",onClick:r,sx:{background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:"6px",p:0,color:"#94a3b8","&:hover":{bgcolor:"#fee2e2",color:"#dc2626"}},children:e.jsx(S.MdDeleteOutline,{size:16})})})]})}function ve({open:l,value:s,onSave:d,onClose:a}){const[r,t]=h.useState(s),[p,i]=h.useState(null);function c(){t(s),i(null)}function m(f){t(u=>u.filter((v,g)=>g!==f))}function y(f,u){t(v=>{const g=[...v],w=f+u;return w<0||w>=g.length?v:([g[f],g[w]]=[g[w],g[f]],g)})}function B(f){p!==null&&(t(u=>{const v=[...u];return v[p]=f,v}),i(null))}function x(){d(r),a()}const n=JSON.stringify(r)!==JSON.stringify(s);return e.jsxs(e.Fragment,{children:[e.jsxs(o.Dialog,{open:l,onClose:a,TransitionProps:{onEnter:c},maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"85vh"}},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",px:2.5,py:1.75,borderBottom:"1px solid #e2e8f0",flexShrink:0},children:[e.jsxs(o.Box,{sx:{flex:1},children:[e.jsx(o.Typography,{sx:{fontSize:14,fontWeight:700,color:"#0f172a"},children:"Edit Schema"}),e.jsxs(o.Typography,{sx:{fontSize:11,color:"#94a3b8"},children:[r.length," field",r.length!==1?"s":""," defined"]})]}),e.jsx(o.IconButton,{size:"small",onClick:a,sx:{color:"#94a3b8"},children:e.jsx(S.MdClose,{size:17})})]}),e.jsx(o.Box,{sx:{flex:1,overflowY:"auto",p:2.5},children:r.length===0?e.jsx(o.Box,{sx:{border:"1.5px dashed rgba(0,0,0,0.12)",borderRadius:"8px",py:4,textAlign:"center"},children:e.jsx(o.Typography,{sx:{fontSize:13,color:"#94a3b8"},children:"No fields defined yet"})}):e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.75},children:r.map((f,u)=>e.jsx(ye,{field:f,index:u,total:r.length,onEdit:()=>i(u),onDelete:()=>m(u),onMoveUp:()=>y(u,-1),onMoveDown:()=>y(u,1)},`${f.id??f.name}-${u}`))})}),e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",alignItems:"center",gap:1,flexShrink:0,bgcolor:"#f8fafc"},children:[n?e.jsx(o.Typography,{sx:{fontSize:11,color:"#f59e0b",fontWeight:500,flex:1},children:"Unsaved changes"}):e.jsx(o.Box,{sx:{flex:1}}),e.jsx(o.Box,{component:"button",onClick:a,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),e.jsxs(o.Box,{component:"button",onClick:x,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[e.jsx(S.MdCheck,{size:15})," Done"]})]})]}),p!==null&&e.jsx(J,{open:p!==null,initial:r[p],onSave:B,onClose:()=>i(null),editMode:!0})]})}function se(l){const s={};for(const d of l){const a=d.id??d.name??"";a&&(d.type==="array"?s[a]=[]:d.type==="object"||d.type==="schema"?s[a]=se(d.children??[]):s[a]="")}return s}function W({value:l,onChange:s,suggestions:d,label:a="Fields",onPayload:r,validate:t=!0,onValidityChange:p,variableGroups:i,initialValues:c,initialFormulaConfig:m,initialConditionConfig:y}){const[B,x]=h.useState(!1),[n,f]=h.useState(!1),[u,v]=h.useState(null),[g,w]=h.useState(m??{}),[T,k]=h.useState(y??{}),R=h.useRef(c??{}),A=h.useMemo(()=>se(l),[l]),$=h.useMemo(()=>c&&Object.keys(c).length>0?{...A,...c}:A,[A,c]),M=h.useMemo(()=>t?N.buildValidationSchema(l):void 0,[t,l]);h.useEffect(()=>{r&&r({schema:l,formulaConfig:g,conditionConfig:T,conditionExpressions:N.serializeConditionExpressions(T),values:R.current,evaluationPayload:N.buildEvaluationPayload({values:R.current,conditionConfig:T})})},[T,g,l]);const V=h.useCallback(z=>{R.current=z,r&&r({schema:l,formulaConfig:g,conditionConfig:T,conditionExpressions:N.serializeConditionExpressions(T),values:z,evaluationPayload:N.buildEvaluationPayload({values:z,conditionConfig:T})})},[l,g,T,r]);function P(z){s([...l,z])}function q(z){if(!u)return;const{containerFieldId:D,tabId:H}=u,U=l.map(I=>{if((I.id??I.name)!==D)return I;const Y=I.tabs??[];return{...I,tabs:Y.map(O=>O.id===H?{...O,fields:[...O.fields??[],z]}:O)}});s(U),v(null)}function C(z,D,H){const U=l.map(I=>{if((I.id??I.name)!==z)return I;const Y=I.tabs??[];return{...I,tabs:Y.map(O=>O.id===D?{...O,fields:(O.fields??[]).filter((Be,te)=>te!==H)}:O)}});s(U)}const ne=h.useMemo(()=>({openAddFieldDialog:(z,D)=>v({containerFieldId:z,tabId:D}),removeFieldFromTab:C}),[l,s]),K=e.jsxs("div",{className:"schema-builder-root",children:[l.length>0&&e.jsx("div",{className:"schema-builder-header",children:e.jsxs("div",{className:"schema-builder-actions",children:[e.jsx(o.Tooltip,{title:"Edit schema",placement:"top",children:e.jsxs("button",{className:"sb-btn sb-btn-outline",onClick:()=>f(!0),children:[e.jsx(S.MdSettings,{size:13})," Edit Schema"]})}),e.jsx(o.Tooltip,{title:"Add a new field",placement:"top",children:e.jsxs("button",{className:"sb-btn sb-btn-primary",onClick:()=>x(!0),children:[e.jsx(S.MdAdd,{size:14})," Add Field"]})})]})}),l.length>0?e.jsx(N.TabsEditContext.Provider,{value:ne,children:e.jsx(N.FlowForm,{schema:{layout:"flat",fields:l},initialValues:$,onSubmit:()=>{},validationSchema:M,onValidityChange:p,onValuesChange:r?V:void 0,formulaConfig:g,onFormulaConfigChange:w,conditionConfig:T,onConditionConfigChange:k})}):e.jsxs("div",{className:"schema-builder-empty-state",children:[e.jsx(ie.FaWpforms,{size:40,className:"schema-builder-empty-icon"}),e.jsx("p",{className:"schema-builder-empty-title",children:"Tell us what fields should be in the list, and assign values to them."}),e.jsx("div",{className:"schema-builder-empty-actions",children:e.jsx("button",{className:"btn",onClick:()=>x(!0),children:"Add field"})})]}),e.jsx(J,{open:B,onSave:P,onClose:()=>x(!1)}),e.jsx(ve,{open:n,value:l,onSave:s,onClose:()=>f(!1)}),e.jsx(J,{open:!!u,onSave:q,onClose:()=>v(null)})]});return i?e.jsxs(N.VariablePickerProvider,{groups:i,children:[e.jsx(N.VariablePicker,{width:260,mode:"popover"}),K]}):K}function Ce({fields:l,onOpen:s}){return e.jsxs(o.Box,{sx:{border:"1px solid #e2e8f0",borderRadius:"8px",bgcolor:"#fff",overflow:"hidden"},children:[l.length>0?e.jsx(o.Box,{sx:{px:1.5,py:1.25,display:"flex",flexWrap:"wrap",gap:.5},children:l.map((d,a)=>{const r=d.id??d.name??"";return e.jsx(o.Tooltip,{title:`${d.type} · ${r}`,placement:"top",children:e.jsx(o.Chip,{label:d.label||r,size:"small",sx:{fontSize:11,fontWeight:500,height:22,bgcolor:"#f1f5f9",color:"#334155",border:"1px solid #e2e8f0","& .MuiChip-label":{px:1}}})},a)})}):e.jsx(o.Box,{sx:{px:1.5,py:1.5},children:e.jsx(o.Typography,{sx:{fontSize:12,color:"#94a3b8"},children:"No fields defined yet"})}),e.jsx(o.Divider,{sx:{borderColor:"#f1f5f9"}}),e.jsxs(o.Box,{onClick:s,sx:{display:"flex",alignItems:"center",gap:.75,px:1.5,py:1,cursor:"pointer","&:hover":{bgcolor:"#f8fafc"},transition:"background 0.12s"},children:[l.length===0?e.jsx(S.MdAdd,{size:14,color:"#6366f1"}):e.jsx(S.MdSettings,{size:13,color:"#6366f1"}),e.jsx(o.Typography,{sx:{fontSize:12,fontWeight:600,color:"#6366f1",flex:1},children:l.length===0?"Add fields":"Configure fields"}),e.jsx(S.MdArrowForward,{size:13,color:"#94a3b8"})]})]})}function Se({value:l,onChange:s,suggestions:d,onPayload:a,onDone:r,validate:t,onValidityChange:p,label:i="Fields",drawerTitle:c="Configure Fields",drawerWidth:m=580}){const[y,B]=h.useState(!1),[x,n]=h.useState({type:"list"}),[f,u]=h.useState(l),v=h.useRef(null),g=h.useRef(void 0),w=h.useRef(void 0),T=h.useRef(void 0),[k,R]=h.useState(null);function A(){u(l),n({type:"list"}),B(!0)}function $(){const C=v.current;C&&(g.current=C.values,w.current=C.formulaConfig,T.current=C.conditionConfig),s(f),B(!1),r==null||r(f,C)}function M(){const C=v.current;C&&(g.current=C.values,w.current=C.formulaConfig,T.current=C.conditionConfig),u(l),B(!1)}function V(){if(x.type!=="edit"||!k)return;const C=[...f];C[x.index]=k,u(C),n({type:"list"}),R(null)}function P(){n({type:"list"}),R(null)}const q=JSON.stringify(f)!==JSON.stringify(l);return x.type==="edit"&&f[x.index],e.jsxs(e.Fragment,{children:[e.jsxs(o.Box,{children:[e.jsx(o.Typography,{sx:{fontSize:12,fontWeight:700,color:"#64748b",textTransform:"uppercase",letterSpacing:.5,mb:.75},children:i}),e.jsx(Ce,{fields:l,onOpen:A})]}),e.jsxs(o.Drawer,{anchor:"right",open:y,onClose:M,PaperProps:{sx:{width:m,display:"flex",flexDirection:"column",boxShadow:"-4px 0 24px rgba(0,0,0,0.12)",overflow:"hidden"}},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",px:2,py:1.5,borderBottom:"1px solid #e2e8f0",flexShrink:0,gap:1},children:[x.type==="edit"&&e.jsx(o.Tooltip,{title:"Back to fields",placement:"bottom",children:e.jsx(o.IconButton,{size:"small",onClick:P,sx:{color:"#64748b"},children:e.jsx(S.MdArrowBack,{size:17})})}),e.jsxs(o.Box,{sx:{flex:1},children:[e.jsx(o.Typography,{sx:{fontSize:14,fontWeight:700,color:"#0f172a"},children:x.type==="edit"?(k==null?void 0:k.label)||(k==null?void 0:k.id)||"Edit field":c}),e.jsx(o.Typography,{sx:{fontSize:11,color:"#94a3b8"},children:x.type==="edit"?"Configure field properties":`${f.length} field${f.length!==1?"s":""} defined`})]}),x.type==="list"&&e.jsx(o.Tooltip,{title:"Close",placement:"bottom",children:e.jsx(o.IconButton,{size:"small",onClick:M,sx:{color:"#94a3b8"},children:e.jsx(S.MdClose,{size:17})})})]}),x.type==="list"&&e.jsxs(e.Fragment,{children:[e.jsx(o.Box,{sx:{flex:1,overflowY:"auto",p:2.5},children:e.jsx(W,{value:f,onChange:u,suggestions:d,onPayload:C=>{v.current=C,g.current=C.values,w.current=C.formulaConfig,T.current=C.conditionConfig,a==null||a(C)},validate:t,onValidityChange:p,label:i,initialValues:g.current,initialFormulaConfig:w.current,initialConditionConfig:T.current})}),e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",alignItems:"center",gap:1,flexShrink:0,bgcolor:"#f8fafc"},children:[q?e.jsx(o.Typography,{sx:{fontSize:11,color:"#f59e0b",fontWeight:500,flex:1},children:"Unsaved changes"}):e.jsx(o.Box,{sx:{flex:1}}),e.jsx(o.Box,{component:"button",onClick:M,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),e.jsxs(o.Box,{component:"button",onClick:$,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[e.jsx(S.MdCheck,{size:15})," Done"]})]})]}),x.type==="edit"&&k&&e.jsx(le,{field:k,onChange:R,onSave:V,onCancel:P})]})]})}exports.FIELD_TYPE_OPTIONS=Z;exports.SchemaBuilder=W;exports.SchemaBuilderDrawer=Se;exports.useFlowForm=ae;
2
+ //# sourceMappingURL=SchemaBuilderDrawer-B1dLgTM1.js.map