@notmrabhi/flowforge 0.1.111 → 0.1.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("react/jsx-runtime"),f=require("reactflow"),E=require("@mui/material"),we=require("react-icons/gr"),q=require("react"),Te=require("./messages-Bg7b9RbI.js"),y=require("react-icons/md"),F=require("react-icons/fa"),Se=require("react-icons/fi"),A=require("./canvasTokens-gKNYrPl4.js"),ce=q.createContext({onEditNode:()=>{},onDeleteNode:()=>{},onAddStep:()=>{},onClickAddTrigger:()=>{},messages:Te.defaultFlowForgeMessages,nodeRegistry:null,nodeBody:"full",activeTemplate:null}),w=()=>q.useContext(ce),de=()=>e.jsxs("div",{style:{width:350,display:"flex",justifyContent:"center"},children:[e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0,left:"50%"}}),e.jsx("div",{style:{padding:"8px 28px",borderRadius:999,background:"#f5f5f5",border:"1.5px solid #bdbdbd",fontSize:13,fontWeight:500,color:"#424242",userSelect:"none"},children:"Start"})]}),ae=()=>e.jsxs("div",{style:{width:350,display:"flex",justifyContent:"center"},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0,left:"50%"}}),e.jsx(f.Handle,{id:"left",type:"target",position:f.Position.Left,style:{opacity:0,left:"calc(50% - 48px)",top:"50%"}}),e.jsx("div",{style:{padding:"8px 28px",borderRadius:999,background:"#f5f5f5",border:"1.5px solid #bdbdbd",fontSize:13,fontWeight:500,color:"#424242",userSelect:"none"},children:"End"})]}),fe=()=>{const{onClickAddTrigger:t,messages:n}=w();return e.jsxs("div",{style:{width:350,display:"flex",justifyContent:"center"},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0,left:"50%"}}),e.jsx(E.Tooltip,{title:n.addTriggerTooltip,placement:"top",arrow:!0,children:e.jsxs("div",{onClick:t,role:"button",tabIndex:0,onKeyDown:i=>{i.key==="Enter"&&t()},style:{padding:"10px 24px",borderRadius:8,border:"1.5px dashed #d0d0d0",background:"#fff",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:8},children:[e.jsx(we.GrTrigger,{size:16}),e.jsx("span",{className:"ff-text-black",style:{fontSize:13},"data-testid":"add-trigger-btn-text",children:n.addTriggerButton})]})}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0,left:"50%"}})]})},Ee=({id:t})=>{const{onAddStep:n}=w();return e.jsxs("div",{onClick:()=>n(t),role:"button",tabIndex:0,onKeyDown:i=>{i.key==="Enter"&&n(t)},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"},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),"+",e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]})},Pe={equals:"is",notEquals:"is not",contains:"contains",notContains:"does not contain",startsWith:"starts with",endsWith:"ends with",isPresent:"is present",isNotPresent:"is not present",isEmpty:"is empty",isNotEmpty:"is not empty",greaterThan:"greater than",lessThan:"less than",greaterOrEquals:"greater or equal",lessOrEquals:"less or equal"},G=new Set(["descriptorType","title","header","icon","infoText","label","conditionConfig","_conditionConfig","_optionLabels","_formulaConfig","type","eventType","sources","source","previewWorkflow","executionStatus"]),B=(t,n)=>n.split(".").reduce((i,l)=>i==null?void 0:i[l],t),L=t=>{const n=i=>typeof i=="object"&&i?String(i.label??i.name??i.value??""):i==null?"":String(i);return Array.isArray(t)?t.map(n).filter(Boolean):t!=null&&t!==""?[n(t)].filter(Boolean):[]},V=(t,n)=>{const i=t._optionLabels;return L(B(i,n)??B(t,n))};function Ce(t){return(t.includes(".")?t.slice(t.lastIndexOf(".")+1):t).replace(/[_-]+/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,i=>i.toUpperCase())}const ze=new Set(["callout","header","section","divider","button","group","tabs","info","tree-map"]);function Ae(t){const n=[],i=l=>{(Array.isArray(l)?l:[]).forEach(s=>{if(!s||typeof s!="object")return;const o=s;(o.id||o.name)&&n.push(o),Array.isArray(o.fields)&&i(o.fields),Array.isArray(o.columns)&&i(o.columns),Array.isArray(o.tabs)&&o.tabs.forEach(d=>i(d==null?void 0:d.fields))})};return i(t),n}function Ie(t,n){const i=String(n.id||n.name||""),l=t._optionLabels,s=l?B(l,i):void 0;if(s!=null)return L(s);const o=B(t,i);if(typeof o=="boolean")return o?["Yes"]:[];if(Array.isArray(n.options)&&o!=null&&o!==""){const d=new Map(n.options.filter(r=>r&&typeof r=="object").map(r=>[String(r.value),String(r.label??r.value)]));return L(o).map(r=>d.get(r)??r)}return L(o)}function Le(t){const n=[],i=l=>{(Array.isArray(l)?l:[]).forEach(s=>{s&&s.type==="group"?i(s.entries):s&&n.push(s)})};return i(t),n}function pe(t,n){const i=Ae(n==null?void 0:n.formSchema),l=t.conditionConfig??t._conditionConfig,s=(n==null?void 0:n.label)||t.title||"Set",o=s.length<=18?s:"",d=c=>{const x=i.find(u=>(u==null?void 0:u.id)===c||(u==null?void 0:u.name)===c);return x!=null&&x.label?String(x.label):Ce(c)},r=[],p=new Set(l?Object.keys(l):[]);if(l&&typeof l=="object"&&Object.entries(l).forEach(([c,x])=>{const u=Le(x),g=V(t,c);u.length===0&&g.length===0||r.push({kind:"rule",when:u.map(h=>({field:h.fieldLabel||d(h.field||""),op:Pe[h.operator]||h.operator||"",value:h.value==null?void 0:L(h.value).join(", ")||void 0,connector:h.connector||"and"})),outcomeLabel:o,outcome:g})}),i.length)i.forEach(c=>{const x=String(c.id||c.name||"");if(!x||G.has(x)||p.has(x)||ze.has(c.type))return;const u=Ie(t,c);u.length&&r.push({kind:"value",label:d(x),value:u})});else{const c=(x,u)=>{Object.keys(x).forEach(g=>{const h=u?`${u}.${g}`:g;if(G.has(g)||p.has(h))return;const a=x[g];if(a&&typeof a=="object"&&!Array.isArray(a)){c(a,h);return}if(typeof a=="boolean"){a&&r.push({kind:"value",label:d(h),value:["Yes"]});return}const j=V(t,h);j.length&&r.push({kind:"value",label:d(h),value:j})})};c(t,"")}return r}function xe(t,n){const i=n==null?void 0:n.nodeBody;return typeof i=="function"?i(t):Array.isArray(i)?i:pe(t,n)}const z={color:"#64748b"},_={color:"#0f172a",fontWeight:600};function I({text:t,style:n}){return e.jsx("span",{title:t,style:{...n,display:"inline-block",maxWidth:230,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",verticalAlign:"bottom"},children:t})}function Z({conditions:t}){return e.jsx(e.Fragment,{children:t.map((n,i)=>e.jsxs(q.Fragment,{children:[i>0&&e.jsxs("span",{style:z,children:[" ",n.connector??"and"," "]}),e.jsx("span",{style:_,children:n.field}),e.jsxs("span",{style:z,children:[" ",n.op," "]}),n.value!=null&&e.jsx("span",{style:_,children:n.value})]},i))})}function U({data:t,descriptor:n,accent:i="#2563eb",emptyText:l}){const s=xe(t||{},n);if(!s.length)return e.jsx("span",{style:{color:"#94a3b8"},children:l??"Click edit to configure"});const o={color:i,fontWeight:600};return e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:s.map((d,r)=>{if(d.kind==="value")return e.jsxs("div",{style:{lineHeight:1.5},children:[e.jsxs("span",{style:z,children:[d.label," "]}),e.jsx(I,{text:d.value.join(", "),style:_})]},r);if(d.fallback)return e.jsxs("div",{style:{lineHeight:1.5},children:[e.jsx("span",{style:z,children:"Otherwise → "}),e.jsx(I,{text:d.outcome.join(", "),style:o})]},r);const p=d.outcome.length>0,c=!!d.when&&d.when.length>0;return d.outcomeLabel?e.jsxs("div",{style:{lineHeight:1.5},children:[e.jsxs("span",{style:z,children:[d.outcomeLabel," "]}),p&&e.jsx(I,{text:d.outcome.join(", "),style:o}),c&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:z,children:" when "}),e.jsx(Z,{conditions:d.when})]})]},r):c?e.jsxs("div",{style:{lineHeight:1.5},children:[e.jsx("span",{style:z,children:"When "}),e.jsx(Z,{conditions:d.when}),p&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:z,children:" → "}),e.jsx(I,{text:d.outcome.join(", "),style:o})]})]},r):e.jsx("div",{style:{lineHeight:1.5},children:e.jsx(I,{text:d.outcome.join(", "),style:o})},r)})})}const De="#ea580c";function he(t){return t?t.replace(/[_-]+/g," ").toLowerCase().replace(/\b\w/g,n=>n.toUpperCase()):""}function Re(t){if(typeof t!="string"&&t.label)return t.label;const n=typeof t=="string"?t:t.value??"";return he(n)}const ue=({id:t,data:n})=>{const{onClickAddTrigger:i,onEditNode:l,messages:s,activeTemplate:o}=w(),{type:d,eventType:r,sources:p,label:c,source:x,previewWorkflow:u,executionStatus:g,infoText:h="This node decides the flow trigger type and configuration."}=n??{},a=m=>{m==null||m.stopPropagation(),d==="scheduler"?l(t):i()},j=Array.isArray(p)&&p.length>0,N=!!(c||x),T=d==="scheduler"?(s==null?void 0:s.schedulerTriggerTitle)??"Scheduler Trigger":d==="event"||j||N?(s==null?void 0:s.eventTriggerSourceTitle)??"Event Trigger Source":(s==null?void 0:s.selectTriggerTitle)??"Select Trigger",b=(()=>{if(d==="scheduler")return e.jsx(U,{data:n,accent:De,emptyText:(s==null?void 0:s.schedulerToBeConfigured)??"Scheduler to be configured"});if(d==="event"||j){const m=c||he(r);return e.jsxs("div",{children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[e.jsx("span",{style:{fontWeight:600},children:m}),e.jsx("span",{className:"ff-ms-2 ff-text-muted",style:{fontSize:12},children:"via"})]}),e.jsx("div",{className:"ff-d-flex ff-flex-wrap ff-mt-2",style:{gap:4},children:j?p.map((S,P)=>e.jsx(E.Chip,{label:Re(S),variant:"outlined",size:"small",className:"ff-text-dark"},P)):e.jsx("span",{className:"ff-text-muted",style:{fontSize:12},children:(s==null?void 0:s.noSourceSelected)??"No source selected"})})]})}return N?e.jsxs("div",{className:"ff-d-flex ff-flex-wrap ff-align-items-center",style:{gap:6},children:[c&&e.jsx("span",{style:{fontWeight:600},children:c}),x&&e.jsx(E.Chip,{label:x,variant:"outlined",size:"small"})]}):e.jsx("span",{role:"button",tabIndex:0,onClick:a,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&a(m)},style:{cursor:"pointer",color:"#1e88e5"},children:(s==null?void 0:s.selectTriggerCta)??"Click to select a trigger to start your workflow"})})(),k=g?e.jsxs(e.Fragment,{children:[g.status==="success"&&e.jsx(F.FaCheckCircle,{size:16,color:"#1DBF60",style:{marginRight:8}}),g.status==="failed"&&e.jsx(F.FaTimesCircle,{size:16,color:"#f44336",style:{marginRight:8}})]}):e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[!u&&e.jsx("div",{role:"button",tabIndex:0,onClick:a,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&a(m)},className:"ff-me-2",style:{cursor:"pointer",color:"#212121"},"aria-label":"Edit trigger",children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx(E.Tooltip,{title:e.jsx("div",{children:h}),placement:"right",arrow:!0,children:e.jsx("span",{children:e.jsx(y.MdInfoOutline,{color:"gray",size:16})})})]});return o!=null&&o.renderFullTriggerNode?e.jsxs("div",{style:{position:"relative",display:"inline-block"},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),o.renderFullTriggerNode({data:n,onEdit:a}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0},id:"1"})]}):e.jsxs("div",{style:{width:350},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #a5d6a7",borderRadius:8,background:"#fff",overflow:"hidden"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"12px 14px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:28,height:28,borderRadius:6,background:"rgba(76,175,80,0.1)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(y.MdInput,{size:16,color:"#388e3c"})}),e.jsx("span",{style:{fontSize:14,fontWeight:500,color:"#212121"},children:T})]}),e.jsx("div",{className:"ff-d-flex ff-align-items-center",children:k})]}),e.jsx("div",{style:{background:"#f5f5f5",fontSize:12,color:"#212121",padding:"14px 16px",margin:"0 10px 12px",borderRadius:6,textAlign:"left"},children:b})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0},id:"1"})]})};function ge(t){return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}function We(t){if(typeof t!="string"&&t.label)return t.label;const n=typeof t=="string"?t:t.value??"";return ge(n)}const Me=({data:t})=>{const{header:n="Event",title:i,eventType:l,sources:s,executionStatus:o,infoText:d="This event is raised by the system. It cannot be configured."}=t??{},r=i||ge(l)||"—";return e.jsxs("div",{style:{width:350},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #a5d6a7",borderRadius:8,background:"#fff",overflow:"hidden"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"12px 14px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:28,height:28,borderRadius:6,background:"rgba(76,175,80,0.1)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(y.MdInput,{size:16,color:"#388e3c"})}),e.jsx("span",{style:{fontSize:14,fontWeight:500,color:"#212121"},children:n})]}),e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[(o==null?void 0:o.status)==="success"&&e.jsx(F.FaCheckCircle,{size:16,color:"#1DBF60",style:{marginRight:8}}),(o==null?void 0:o.status)==="failed"&&e.jsx(F.FaTimesCircle,{size:16,color:"#f44336",style:{marginRight:8}}),!o&&e.jsx(E.Tooltip,{title:e.jsx("div",{children:d}),placement:"right",arrow:!0,children:e.jsx("span",{children:e.jsx(y.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsxs("div",{style:{background:"#f5f5f5",fontSize:13,color:"#212121",padding:"14px 16px",margin:"0 10px 12px",borderRadius:6,textAlign:"left"},children:[e.jsx("div",{style:{fontWeight:600},children:r}),Array.isArray(s)&&s.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"ff-text-muted",style:{fontSize:12,marginTop:4},children:"via"}),e.jsx("div",{className:"ff-d-flex ff-flex-wrap ff-mt-1",style:{gap:4},children:s.map((p,c)=>e.jsx(E.Chip,{label:We(p),variant:"outlined",size:"small",className:"ff-text-dark"},c))})]})]})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0},id:"1"})]})},K=({rail:t,cardWidth:n})=>{const i=n/2;n/2+t.indent;const l="var(--ff-edge-color, #b0bec5)";return e.jsxs("svg",{width:n+t.indent+200,height:t.height,style:{position:"absolute",left:0,top:"100%",pointerEvents:"none",overflow:"visible"},children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:t.height,stroke:l,strokeWidth:1.5}),t.branches.map((s,o)=>{const d=s.y;return e.jsxs("g",{transform:`translate(0, ${d})`,children:[e.jsx("rect",{x:i-5,y:-5,width:10,height:10,fill:"#fff",stroke:l,strokeWidth:1.5,transform:`rotate(45, ${i}, 0)`}),e.jsx("text",{x:i+14,y:4,fontSize:12,fontWeight:500,fill:"var(--ff-text, #212121)",style:{fontFamily:"sans-serif"},children:s.label})]},o)})]})},ye=({id:t,data:n})=>{const{onEditNode:i,onDeleteNode:l,nodeRegistry:s}=w(),{conditions:o=[],infoText:d="Filter conditions applied to workflow data",_branchRail:r,descriptorType:p,branchStyle:c}=n,x=p?s==null?void 0:s.forType(p):void 0,u=c==="inline-gate",g=e.jsxs(e.Fragment,{children:[e.jsx(f.Handle,{id:"pass",type:"source",position:f.Position.Bottom,style:{opacity:0}}),e.jsx(f.Handle,{id:"fail",type:"source",position:f.Position.Right,style:{opacity:0,top:"50%"}})]});return x!=null&&x.renderFullNode?e.jsxs("div",{style:{position:"relative",display:"inline-block"},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),x.renderFullNode({id:t,data:n,onEdit:()=>i(t),onDelete:()=>l(t)}),g,!u&&r&&e.jsx(K,{rail:r,cardWidth:350})]}):e.jsxs("div",{style:{width:350,position:"relative"},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #ffe082",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 6px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[e.jsx("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)"},children:e.jsx(Se.FiFilter,{className:"ff-text-warning",size:16})}),e.jsx("span",{className:"ff-ms-2 ff-fw-medium ff-text-dark",style:{fontSize:14},children:"Filter"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:h=>{h.stopPropagation(),i(t)},onKeyDown:h=>{h.key==="Enter"&&(h.stopPropagation(),i(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:h=>{h.stopPropagation(),l(t)},onKeyDown:h=>{h.key==="Enter"&&(h.stopPropagation(),l(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})}),e.jsx(E.Tooltip,{title:d,placement:"right",arrow:!0,children:e.jsx("div",{className:"ff-ms-2",children:e.jsx(y.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsx("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:o.length===0?e.jsx("span",{className:"ff-text-muted",children:"No conditions configured"}):o.map((h,a)=>e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-mb-1",children:[e.jsx("p",{className:"ff-m-0 ff-fw-bold ff-me-1 ff-text-truncate",style:{maxWidth:100},title:h.field,children:h.field}),e.jsx("span",{className:"ff-text-muted",children:h.operator}),e.jsx("p",{className:"ff-text-dark ff-text-truncate ff-mx-1 ff-m-0",title:h.value,children:h.value}),a<o.length-1&&e.jsx("p",{className:"ff-bg-primary ff-text-white ff-fw-bold ff-ms-1 ff-px-1 ff-rounded-1 ff-m-0",children:h.logicalOperator})]},a))})]}),g,!u&&r&&e.jsx(K,{rail:r,cardWidth:350})]})},me=({id:t,data:n})=>{const{onEditNode:i,onDeleteNode:l,nodeRegistry:s,nodeBody:o="full",messages:d}=w(),{title:r="Task",descriptorType:p,infoText:c=""}=n,x=p?s==null?void 0:s.forType(p):void 0,u=x==null?void 0:x.icon;return x!=null&&x.renderFullNode?e.jsxs("div",{style:{position:"relative",display:"inline-block"},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),x.renderFullNode({id:t,data:n,onEdit:()=>i(t),onDelete:()=>l(t)}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]}):e.jsxs("div",{style:{width:350},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #b0bec5",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 8px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[u&&e.jsx("div",{style:{display:"flex",alignItems:"center"},children:u}),e.jsx("span",{className:"ff-text-dark",style:{fontSize:14,fontWeight:500},children:r})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:g=>{g.stopPropagation(),i(t)},onKeyDown:g=>{g.key==="Enter"&&(g.stopPropagation(),i(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:g=>{g.stopPropagation(),l(t)},onKeyDown:g=>{g.key==="Enter"&&(g.stopPropagation(),l(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})}),c&&e.jsx(E.Tooltip,{title:c,placement:"right",arrow:!0,children:e.jsx("div",{className:"ff-ms-2",children:e.jsx(y.MdInfoOutline,{color:"gray",size:16})})})]})]}),o!=="title-only"&&e.jsx("div",{style:{margin:"0 8px 8px",padding:8,borderRadius:4,background:"#f8f9fa",fontSize:12,textAlign:"left",color:"#212529",lineHeight:1.4},children:x!=null&&x.renderNode?x.renderNode(n):e.jsx(U,{data:n,descriptor:x,accent:"#2563eb",emptyText:(d==null?void 0:d.clickEditToConfigure)??"Click edit to configure"})})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]})},J=2;function $e(t,n,i){const l=(t==null?void 0:t.toLowerCase())||(n?"sequential":null);return l?(i==null?void 0:i[l])??l.charAt(0).toUpperCase()+l.slice(1):null}function He(t){var o,d;const n=Array.isArray(t.userIds)?t.userIds.length:0,i=((o=t.groupName)==null?void 0:o.trim())??"",l=((d=t.roleName)==null?void 0:d.trim())??"",s=n>0||!!i||!!l;return i?{label:`Group: ${i}`,configured:!0}:l?{label:`Role: ${l}`,configured:!0}:n>0?{label:`${n} approver${n!==1?"s":""}`,configured:!0}:{label:"Not configured",configured:s}}const je=({id:t,data:n})=>{const{onEditNode:i,onDeleteNode:l}=w(),{approvalData:s,isPreview:o=!1,_branchRail:d,executionModeLabel:r}=n,p=(s==null?void 0:s.policy)??{},c=p.stages??[],x=c.length,u=c.slice(0,J),g=x-J,h=p.name??p.policyName??"Untitled Policy";return e.jsxs("div",{style:{width:350,position:"relative"},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #ffe082",borderRadius:8,background:"#fff",overflow:"hidden"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 8px 8px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("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)"},children:e.jsx(y.MdCheckCircle,{style:{color:"#FBC02D"},size:16})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:"Approval Policy"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[!o&&e.jsx("div",{role:"button",tabIndex:0,style:{cursor:"pointer"},onClick:a=>{a.stopPropagation(),i(t)},onKeyDown:a=>{a.key==="Enter"&&(a.stopPropagation(),i(t))},"data-testid":"approval-node-edit-btn",children:e.jsx(y.MdOutlineModeEdit,{size:16,className:"ff-text-secondary"})}),!o&&e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,style:{cursor:"pointer"},onClick:a=>{a.stopPropagation(),l(t)},onKeyDown:a=>{a.key==="Enter"&&(a.stopPropagation(),l(t))},"data-testid":"approval-node-delete-btn",children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})}),e.jsx(E.Tooltip,{title:"This approval policy determines who must approve a request before the workflow continues.",arrow:!0,placement:"right",children:e.jsx("span",{className:"ff-ms-2 ff-d-inline-flex",children:e.jsx(y.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsx("div",{className:"ff-text-truncate ff-text-dark ff-fw-bold",style:{margin:"0 10px 8px",fontSize:13},title:h,children:h}),e.jsx("div",{style:{margin:"0 10px 10px",display:"flex",flexDirection:"column",gap:8},children:c.length===0?e.jsx("div",{className:"ff-text-center",style:{fontSize:12,color:"#9e9e9e",padding:"14px 0",borderRadius:6,border:"1px dashed #FEE79A",background:"#FFFDE7"},children:"No stages configured"}):e.jsxs(e.Fragment,{children:[u.map((a,j)=>{var m;const N=((m=a.stageName)==null?void 0:m.trim())||`Stage ${j+1}`,{label:T,configured:b}=He(a),k=$e(a.executionMode,a.isSequential,r);return e.jsxs("div",{style:{background:"#f5f5f5",borderRadius:6,padding:8},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center",style:{gap:8},children:[e.jsx("div",{className:"ff-d-flex ff-align-items-center ff-justify-content-center ff-flex-shrink-0",style:{width:28,height:28,borderRadius:"50%",background:"#f5f5f5b6",border:"1px solid #E0E0E0",color:"#424242",fontSize:12,fontWeight:700},children:j+1}),e.jsx("div",{className:"ff-text-dark ff-text-truncate",style:{fontSize:12,fontWeight:700,marginRight:"auto"},children:N}),e.jsxs("div",{className:`ff-d-flex ff-align-items-center ff-flex-shrink-0 ${b?"ff-text-dark":"ff-text-muted"}`,style:{gap:4,fontSize:12},children:[e.jsx(y.MdPeople,{size:15,style:{color:b?"#5D4037":"#9E9E9E"}}),T]})]}),k&&e.jsxs("div",{className:"ff-d-flex ff-align-items-center",style:{gap:4,fontSize:11,color:"#1a73e8",marginTop:4,paddingLeft:36},children:[e.jsx(y.MdArrowForward,{size:11}),k]})]},j)}),g>0&&e.jsxs("div",{className:"ff-text-primary",style:{fontSize:12,marginTop:4,cursor:o?"default":"pointer",color:"#1976d2"},role:o?void 0:"button",tabIndex:o?void 0:0,onClick:a=>{o||(a.stopPropagation(),i(t))},onKeyDown:a=>{o||(a.key==="Enter"||a.key===" ")&&(a.stopPropagation(),i(t))},children:["+ ",g," More Stage",g>1?"s":""]})]})})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}}),d&&e.jsx(K,{rail:d,cardWidth:350})]})},be=({id:t,data:n})=>{const{onEditNode:i,onDeleteNode:l}=w(),{duration:s,unit:o}=n,d=s!=null&&o,r=d?`Wait ${s} ${o}`:"Not configured";return e.jsxs("div",{style:{width:350},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #b0bec5",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center ff-mx-2 ff-mt-2 ff-mb-1",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("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)"},children:e.jsx(y.MdSchedule,{size:16,color:"#1976d2"})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:"Delay"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:p=>{p.stopPropagation(),i(t)},onKeyDown:p=>{p.key==="Enter"&&(p.stopPropagation(),i(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:p=>{p.stopPropagation(),l(t)},onKeyDown:p=>{p.key==="Enter"&&(p.stopPropagation(),l(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:e.jsx("span",{className:d?"ff-text-dark ff-fw-medium":"ff-text-muted",children:r})})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]})},Q={email:{label:"Email",bg:"#e3f2fd",color:"#1565c0",iconType:y.MdEmail},slack:{label:"Slack",bg:"#e8f5e9",color:"#2e7d32",iconType:y.MdNotifications},teams:{label:"MS Teams",bg:"#ede7f6",color:"#4527a0",iconType:y.MdNotifications},sms:{label:"SMS",bg:"#fce4ec",color:"#880e4f",iconType:y.MdSms},"in-app":{label:"In-App",bg:"#fff3e0",color:"#e65100",iconType:y.MdNotifications},webhook:{label:"Webhook",bg:"#f3e5f5",color:"#6a1b9a",iconType:y.MdWebhook}},Fe={label:"Notification",bg:"rgba(156,39,176,0.1)",color:"#7b1fa2",iconType:y.MdNotifications};function Be(t){var n;switch(t.channel){case"email":return((n=t.emailTo)==null?void 0:n.join(", "))??t.recipient??null;case"slack":return t.slackChannel??null;case"teams":return t.teamsMessage?"Message configured":null;case"sms":return t.smsTo??null;case"in-app":return t.inAppRecipient??null;case"webhook":return t.webhookUrl??null;default:return t.recipient??null}}function Oe(t){switch(t.channel){case"email":return t.emailSubject??t.subject??null;case"slack":{const n=t.slackMessage;return n?n.length>60?`${n.slice(0,60)}…`:n:null}case"in-app":return t.inAppTitle??null;default:return t.subject??null}}const ve=({id:t,data:n})=>{const{onEditNode:i,onDeleteNode:l}=w(),s=n,o=s.channel&&Q[s.channel]?Q[s.channel]:Fe,d=Be(s),r=Oe(s),p=!!(s.channel&&d),c=o.iconType;return e.jsxs("div",{style:{width:A.NODE_WIDTH},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #b0bec5",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 6px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{className:"ff-d-flex ff-align-items-center ff-justify-content-center ff-rounded",style:{width:25,height:25,background:o.bg},children:e.jsx(c,{size:16,color:o.color})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:s.channel?`${o.label} Notification`:"Notification"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:x=>{x.stopPropagation(),i(t)},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.stopPropagation(),i(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:x=>{x.stopPropagation(),l(t)},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.stopPropagation(),l(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:p?e.jsxs("div",{className:"ff-d-flex ff-flex-column ff-gap-1",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("span",{className:"ff-px-2 ff-py-1 ff-rounded",style:{fontSize:10,background:o.bg,color:o.color,fontWeight:600,flexShrink:0},children:o.label}),e.jsx("span",{className:"ff-text-dark ff-text-truncate",style:{maxWidth:220},children:d})]}),r&&e.jsx("span",{className:"ff-text-muted ff-text-truncate",style:{maxWidth:280},children:r})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured"})})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]})},Y={"api-key":"API Key",hmac:"HMAC"},Ne=({data:t})=>{const{onClickAddTrigger:n}=w(),{label:i="Webhook Trigger",endpointUrl:l,authMethod:s,source:o}=t,d=p=>{p.stopPropagation(),n()},r=p=>{p.stopPropagation(),l&&navigator.clipboard.writeText(l).catch(()=>{})};return e.jsxs("div",{style:{width:A.NODE_WIDTH},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #90caf9",borderRadius:8,background:"#fff",overflow:"hidden"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 6px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:28,height:28,borderRadius:6,background:"rgba(33,150,243,0.1)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(y.MdWebhook,{size:16,color:"#1565c0"})}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:"#212121"},children:"Webhook Trigger"})]}),e.jsx("div",{role:"button",tabIndex:0,onClick:d,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&d(p)},className:"ff-d-flex ff-align-items-center",style:{paddingRight:4,cursor:"pointer"},children:e.jsx(y.MdOutlineModeEdit,{size:16,color:"#555"})})]}),e.jsxs("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:"#e3f2fd",border:"1px solid #90caf9"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-flex-wrap ff-gap-2 ff-mb-1",children:[e.jsx("span",{style:{fontSize:12,color:"#1565c0",fontWeight:600},children:i}),o&&e.jsx("span",{className:"ff-px-2 ff-py-1 ff-rounded",style:{fontSize:11,background:"#fff",border:"1px solid #90caf9",color:"#1565c0"},children:o}),s&&s!=="none"&&Y[s]&&e.jsx("span",{className:"ff-px-2 ff-py-1 ff-rounded",style:{fontSize:10,background:"#1565c0",color:"#fff",fontWeight:600},children:Y[s]})]}),l&&e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-1",style:{marginTop:4},children:[e.jsx("span",{style:{fontSize:10,color:"#1565c0",fontFamily:"monospace",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l}),e.jsx(E.Tooltip,{title:"Copy URL",placement:"top",arrow:!0,children:e.jsx("div",{role:"button",tabIndex:0,onClick:r,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&r(p)},style:{cursor:"pointer",flexShrink:0},children:e.jsx(y.MdContentCopy,{size:12,color:"#1565c0"})})})]})]})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]})},ke=({id:t,data:n})=>{var g;const{onEditNode:i,onDeleteNode:l,nodeRegistry:s}=w(),{method:o,url:d,descriptorType:r}=n,p=r?(g=s==null?void 0:s.forType(r))==null?void 0:g.icon:e.jsx(y.MdHttp,{size:16,color:"#546e7a"}),c=!!(o&&d),x=(o==null?void 0:o.toUpperCase())??"",u=A.HTTP_METHOD_STYLE[x]??null;return e.jsxs("div",{style:{width:A.NODE_WIDTH},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #b0bec5",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 6px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:25,height:25,display:"flex",alignItems:"center",justifyContent:"center"},children:p}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:"REST API Call"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:h=>{h.stopPropagation(),i(t)},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.stopPropagation(),i(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:h=>{h.stopPropagation(),l(t)},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.stopPropagation(),l(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:c?e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[u&&e.jsx("span",{style:{fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:4,background:u.bg,color:u.color,flexShrink:0},children:x}),e.jsx("span",{className:"ff-text-dark ff-text-truncate",style:{fontFamily:"monospace",fontSize:11},title:d,children:d})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured"})})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]})},_e={eq:"=",neq:"≠",gt:">",gte:"≥",lt:"<",lte:"≤",contains:"contains",startsWith:"starts with",endsWith:"ends with",isEmpty:"is empty",isNotEmpty:"is not empty"},Ke=({id:t,data:n})=>{const{onEditNode:i,onDeleteNode:l}=w(),{title:s="Condition Branch",branchConfigs:o=[],defaultBranch:d}=n,r=o.length>0;return e.jsxs("div",{style:{width:A.NODE_WIDTH},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #b39ddb",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 6px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:25,height:25,borderRadius:6,background:"rgba(103,58,183,0.1)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(y.MdCallSplit,{size:16,color:"#512da8"})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:s})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:p=>{p.stopPropagation(),i(t)},onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.stopPropagation(),i(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:p=>{p.stopPropagation(),l(t)},onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.stopPropagation(),l(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:r?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[o.map((p,c)=>{var h,a;const x=A.BRANCH_PALETTE[c%A.BRANCH_PALETTE.length],u=(h=p.conditions)==null?void 0:h[0],g=(((a=p.conditions)==null?void 0:a.length)??0)-1;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:10,background:x.bg,color:x.color,flexShrink:0},children:p.label||p.key}),u?e.jsxs("span",{style:{fontSize:11,color:"#616161",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[u.field," ",_e[u.operator]??u.operator,u.value?` ${u.value}`:"",g>0?` +${g} more`:""]}):e.jsx("span",{style:{fontSize:11,color:"#9e9e9e"},children:"No conditions yet"})]},p.key)}),d&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:2},children:[e.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:10,background:"#f5f5f5",color:"#757575",flexShrink:0},children:"Default"}),e.jsx("span",{style:{fontSize:11,color:"#9e9e9e"},children:"fallback path"})]})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured — click edit to add branches"})})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]})},qe=({id:t,data:n})=>{var h;const{onEditNode:i,onDeleteNode:l,nodeRegistry:s}=w(),{title:o="Sub-Workflow",workflowId:d,workflowLabel:r,descriptorType:p,onPreview:c}=n,x=p?(h=s==null?void 0:s.forType(p))==null?void 0:h.icon:e.jsx(y.MdAccountTree,{size:16,color:"#00695c"}),u=!!d,g=a=>{a.stopPropagation(),d&&c&&c(d)};return e.jsxs("div",{style:{width:A.NODE_WIDTH},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #80cbc4",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 6px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:25,height:25,borderRadius:6,background:"rgba(0,137,123,0.1)",display:"flex",alignItems:"center",justifyContent:"center"},children:x}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:o})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),i(t)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.stopPropagation(),i(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),l(t)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.stopPropagation(),l(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:u?"#e0f2f1":"#fafafa",fontSize:12,border:u?"1px solid #b2dfdb":"none"},children:u?e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-justify-content-between",children:[e.jsxs("div",{className:"ff-d-flex ff-flex-column ff-gap-1",children:[e.jsx("span",{style:{fontSize:12,fontWeight:600,color:"#00695c"},children:r||d}),e.jsxs("span",{style:{fontSize:10,color:"#80cbc4",fontFamily:"monospace"},children:["ID: ",d]})]}),c&&e.jsxs("div",{role:"button",tabIndex:0,onClick:g,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&g(a)},style:{cursor:"pointer",display:"flex",alignItems:"center",gap:3,fontSize:11,color:"#00897b"},children:[e.jsx(y.MdOpenInNew,{size:13}),"Preview"]})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured — select a workflow"})})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]})},Ue={startNode:de,endNode:ae,addTriggerNode:fe,addStepNode:Ee,triggerNode:ue,eventNode:Me,filterNode:ye,actionNode:me,approvalNode:je,delayNode:be,notificationNode:ve,webhookTriggerNode:Ne,restApiNode:ke,conditionBranchNode:Ke,subWorkflowNode:qe},Ge=11.5,X=2,M=6,ee=40,te=20,ne=4,Ve=({id:t,sourceX:n,sourceY:i,targetX:l,targetY:s,sourcePosition:o,targetPosition:d,source:r,target:p,data:c})=>{const[x,u,g]=f.getStraightPath({sourceX:n,sourceY:i,targetX:l,targetY:s}),h=c==null?void 0:c.label,a=h==="Pass",j=a||h==="Fail",N=n+(l-n)/3,T=i+(s-i)/3,b=n+2*(l-n)/3,k=i+2*(s-i)/3,m=c==null?void 0:c.onAddStepClick,S=C=>{if(C.stopPropagation(),typeof m!="function")return;const O={edgeId:t,nodeId:r,sourceNodeId:r,targetNodeId:p,position:"between",referenceNodeId:r,referenceNodeType:c==null?void 0:c.referenceNodeType,stepVisibility:c==null?void 0:c.stepVisibility};m(r,O)},P=C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),S(C))},D=()=>e.jsxs(e.Fragment,{children:[e.jsxs("g",{className:"plus-icon-container",children:[e.jsx("circle",{r:Ge,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-M,x2:0,y2:M,strokeWidth:X,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-M,y1:0,x2:M,y2:0,strokeWidth:X,strokeLinecap:"round",className:"plus-line"})]}),e.jsxs("g",{className:"edge-plus-tooltip",transform:"translate(18, 0)",children:[e.jsx("rect",{x:0,y:-10,width:65,height:20,rx:4,className:"tooltip-bg"}),e.jsx("path",{d:"M0 -4 L-4 0 L0 4 Z",className:"tooltip-bg"}),e.jsx("text",{x:32,y:0,textAnchor:"middle",dominantBaseline:"central",fill:"white",style:{fontSize:10,fontWeight:600,pointerEvents:"none"},children:"Add Step"})]})]}),R=m?{onClick:S,onKeyDown:P,role:"button",tabIndex:0,style:{cursor:"pointer",pointerEvents:"all"}}:{style:{cursor:"default",pointerEvents:"all"}};return e.jsxs("g",{className:"edge-with-plus-wrapper",children:[e.jsx(f.BaseEdge,{id:t,path:x}),j?e.jsxs(e.Fragment,{children:[e.jsxs("g",{transform:`translate(${N}, ${T})`,children:[e.jsx("rect",{x:-ee/2,y:-te/2,width:ee,height:te,rx:ne,ry:ne,fill:a?"#ADE6C5":"#FDBFBF"}),e.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fill:a?"#1DBF60":"#C50000",style:{fontSize:12,fontWeight:500},children:h})]}),e.jsx("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${b}, ${k})`,"data-testid":"plus-node-icon",...R,children:e.jsx(D,{})})]}):e.jsx("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${u}, ${g})`,"data-testid":"plus-node-icon",...R,children:e.jsx(D,{})})]})},Ze=11.5,se=2,$=6,Je=({id:t,sourceX:n,sourceY:i,targetX:l,targetY:s,source:o,target:d,data:r})=>{const[p,c,x]=f.getStraightPath({sourceX:n,sourceY:i,targetX:l,targetY:s}),u=r==null?void 0:r.onAddStepClick,g=a=>{a.stopPropagation(),typeof u=="function"&&u(o,{edgeId:t,nodeId:o,sourceNodeId:o,targetNodeId:d,position:"between",referenceNodeId:o,referenceNodeType:r==null?void 0:r.referenceNodeType,stepVisibility:r==null?void 0:r.stepVisibility,filterId:r==null?void 0:r.filterId,branch:r==null?void 0:r.branch})},h=a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),g(a))};return e.jsxs("g",{className:"edge-with-plus-wrapper",children:[e.jsx(f.BaseEdge,{id:t,path:p,style:{stroke:"#b0bec5"}}),e.jsxs("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${c}, ${x})`,style:{cursor:u?"pointer":"default",pointerEvents:"all",outline:"none"},onClick:u?g:void 0,onKeyDown:u?h:void 0,role:u?"button":void 0,tabIndex:u?0:void 0,"data-testid":"plus-node-icon",children:[e.jsx("circle",{r:Ze,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-$,x2:0,y2:$,strokeWidth:se,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-$,y1:0,x2:$,y2:0,strokeWidth:se,strokeLinecap:"round",className:"plus-line"}),e.jsxs("g",{className:"edge-plus-tooltip",transform:"translate(18, 0)",children:[e.jsx("rect",{x:0,y:-10,width:65,height:20,rx:4,className:"tooltip-bg"}),e.jsx("path",{d:"M0 -4 L-4 0 L0 4 Z",className:"tooltip-bg"}),e.jsx("text",{x:32,y:0,textAnchor:"middle",dominantBaseline:"central",fill:"white",style:{fontSize:10,fontWeight:600,pointerEvents:"none"},children:"Add Step"})]})]})]})},Qe=({id:t,sourceX:n,sourceY:i,targetX:l,targetY:s})=>{const[o]=f.getStraightPath({sourceX:n,sourceY:i,targetX:l,targetY:s});return e.jsx(f.BaseEdge,{id:t,path:o,style:{stroke:"#b0bec5"}})},Ye=11.5,ie=2,H=6,Xe=-24,oe=40,le=20,re=4,et=({id:t,sourceX:n,sourceY:i,targetX:l,targetY:s,source:o,target:d,data:r})=>{const[p,c,x]=f.getStraightPath({sourceX:n,sourceY:i,targetX:l,targetY:s}),u=r==null?void 0:r.label,g=u==="Pass",h=g||u==="Fail",a=r==null?void 0:r.onAddStepClick,j=(r==null?void 0:r.showPlus)!==!1&&!!a,N=b=>{b.stopPropagation(),typeof a=="function"&&a(o,{edgeId:t,nodeId:o,sourceNodeId:o,targetNodeId:d,position:"between",referenceNodeId:o,referenceNodeType:r==null?void 0:r.referenceNodeType,stepVisibility:r==null?void 0:r.stepVisibility})},T=b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),N(b))};return e.jsxs("g",{className:"edge-with-plus-wrapper",children:[e.jsx(f.BaseEdge,{id:t,path:p,style:{stroke:"#b0bec5"}}),e.jsxs("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${c}, ${x})`,style:{cursor:a?"pointer":"default",pointerEvents:"all",outline:"none"},onClick:a?N:void 0,onKeyDown:a?T:void 0,role:a?"button":void 0,tabIndex:a?0:void 0,children:[h&&e.jsxs("g",{transform:`translate(0, ${j?Xe:0})`,children:[e.jsx("rect",{x:-oe/2,y:-le/2,width:oe,height:le,rx:re,ry:re,fill:g?"#ADE6C5":"#FDBFBF"}),e.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fill:g?"#1DBF60":"#C50000",style:{fontSize:12,fontWeight:500},children:u})]}),j&&e.jsxs("g",{className:"plus-icon-container",children:[e.jsx("circle",{r:Ye,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-H,x2:0,y2:H,strokeWidth:ie,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-H,y1:0,x2:H,y2:0,strokeWidth:ie,strokeLinecap:"round",className:"plus-line"})]}),j&&e.jsxs("g",{className:"edge-plus-tooltip",transform:"translate(22, 0)",children:[e.jsx("rect",{x:0,y:-10,width:65,height:20,rx:4,className:"tooltip-bg"}),e.jsx("path",{d:"M0 -4 L-4 0 L0 4 Z",className:"tooltip-bg"}),e.jsx("text",{x:32,y:0,textAnchor:"middle",dominantBaseline:"central",fill:"white",style:{fontSize:10,fontWeight:600,pointerEvents:"none"},children:"Add Step"})]})]})]})},tt=({id:t,source:n,target:i,sourceX:l,sourceY:s,targetX:o,targetY:d,style:r={},markerEnd:p,data:c})=>{const x=(c==null?void 0:c.verticalRouting)??!1,u=(c==null?void 0:c.sideRouting)??!1,g=(c==null?void 0:c.railless)??!1,h=30,a=u?`M ${l},${s} L ${o},${s} L ${o},${d}`:g?`M ${l},${s} L ${o},${d}`:x?(()=>{const v=d-h;return`M ${l},${v} L ${o},${v} L ${o},${d}`})():(()=>{const v=s+30;return`M ${l},${s} L ${l},${v} L ${o},${v} L ${o},${d}`})(),j=r.stroke||"#d1d5db",N=c==null?void 0:c.label,T=(c==null?void 0:c.isFirst)??!1,b=c==null?void 0:c.onAddStepClick;let k,m,S,P;if(u)k=l+(o-l)*.5,m=s,S=k,P=s;else if(g)k=l,m=s+24,S=l,P=s+(d-s)*.6;else if(x){const v=d-h;k=l+(o-l)*.25,m=v,S=l+(o-l)*.65,P=v}else{const v=s+30;k=l+(o-l)*.35,m=v,S=l+(o-l)*.7,P=v}const D=!!N&&(!x||u||g),R=!!b&&!u,C=v=>{v.stopPropagation(),b&&b(n,{edgeId:t,nodeId:n,sourceNodeId:n,targetNodeId:i,position:"between",referenceNodeId:n,filterId:c==null?void 0:c.filterId,branch:c==null?void 0:c.branch})},O=11.5,W=6;return e.jsxs("g",{children:[e.jsx("path",{id:t,d:a,fill:"none",stroke:j,strokeWidth:1.5,markerEnd:p}),D&&e.jsx("g",{transform:`translate(${k}, ${m})`,children:(()=>{const v=Math.max(44,N.length*7+20);return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:-v/2,y:-11,width:v,height:22,rx:11,fill:T?"#e8f5e9":"#ffebee",stroke:T?"#81c784":"#e57373",strokeWidth:1}),e.jsx("text",{x:0,y:4,textAnchor:"middle",fontSize:10,fontWeight:600,fill:T?"#2e7d32":"#c62828",style:{fontFamily:"sans-serif",pointerEvents:"none"},children:N})]})})()}),R&&e.jsxs("g",{transform:`translate(${S}, ${P})`,onClick:C,style:{cursor:"pointer",pointerEvents:"all"},className:"nodrag nopan edge-plus-svg",children:[e.jsx("circle",{r:O,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-W,x2:0,y2:W,strokeWidth:2,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-W,y1:0,x2:W,y2:0,strokeWidth:2,strokeLinecap:"round",className:"plus-line"})]})]})};exports.ActionNode=me;exports.AddTriggerNode=fe;exports.ApprovalNode=je;exports.DelayNode=be;exports.EdgeWithPlusLabel=Ve;exports.EndNode=ae;exports.FilterNode=ye;exports.GatewayBranchEdge=tt;exports.LabelPlusEdge=et;exports.NodeBody=U;exports.NotificationNode=ve;exports.PlainEdge=Qe;exports.PlusEdge=Je;exports.RestApiNode=ke;exports.StartNode=de;exports.TriggerNode=ue;exports.WebhookTriggerNode=Ne;exports.WorkflowCanvasContext=ce;exports.builtInNodeTypes=Ue;exports.deriveRows=pe;exports.resolveNodeRows=xe;
2
- //# sourceMappingURL=GatewayBranchEdge-D4TJNKL1.js.map
1
+ "use strict";const e=require("react/jsx-runtime"),f=require("reactflow"),E=require("@mui/material"),we=require("react-icons/gr"),q=require("react"),Te=require("./messages-Bg7b9RbI.js"),y=require("react-icons/md"),F=require("react-icons/fa"),Se=require("react-icons/fi"),A=require("./canvasTokens-gKNYrPl4.js"),ce=q.createContext({onEditNode:()=>{},onDeleteNode:()=>{},onAddStep:()=>{},onClickAddTrigger:()=>{},messages:Te.defaultFlowForgeMessages,nodeRegistry:null,nodeBody:"full",activeTemplate:null}),w=()=>q.useContext(ce),de=()=>e.jsxs("div",{style:{width:350,display:"flex",justifyContent:"center"},children:[e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0,left:"50%"}}),e.jsx("div",{style:{padding:"8px 28px",borderRadius:999,background:"#f5f5f5",border:"1.5px solid #bdbdbd",fontSize:13,fontWeight:500,color:"#424242",userSelect:"none"},children:"Start"})]}),ae=()=>e.jsxs("div",{style:{width:350,display:"flex",justifyContent:"center"},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0,left:"50%"}}),e.jsx(f.Handle,{id:"left",type:"target",position:f.Position.Left,style:{opacity:0,left:"calc(50% - 48px)",top:"50%"}}),e.jsx("div",{style:{padding:"8px 28px",borderRadius:999,background:"#f5f5f5",border:"1.5px solid #bdbdbd",fontSize:13,fontWeight:500,color:"#424242",userSelect:"none"},children:"End"})]}),fe=()=>{const{onClickAddTrigger:t,messages:n}=w();return e.jsxs("div",{style:{width:350,display:"flex",justifyContent:"center"},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0,left:"50%"}}),e.jsx(E.Tooltip,{title:n.addTriggerTooltip,placement:"top",arrow:!0,children:e.jsxs("div",{onClick:t,role:"button",tabIndex:0,onKeyDown:i=>{i.key==="Enter"&&t()},style:{padding:"10px 24px",borderRadius:8,border:"1.5px dashed #d0d0d0",background:"#fff",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:8},children:[e.jsx(we.GrTrigger,{size:16}),e.jsx("span",{className:"ff-text-black",style:{fontSize:13},"data-testid":"add-trigger-btn-text",children:n.addTriggerButton})]})}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0,left:"50%"}})]})},Ee=({id:t})=>{const{onAddStep:n}=w();return e.jsxs("div",{onClick:()=>n(t),role:"button",tabIndex:0,onKeyDown:i=>{i.key==="Enter"&&n(t)},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"},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),"+",e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]})},Pe={equals:"is",notEquals:"is not",contains:"contains",notContains:"does not contain",startsWith:"starts with",endsWith:"ends with",isPresent:"is present",isNotPresent:"is not present",isEmpty:"is empty",isNotEmpty:"is not empty",greaterThan:"greater than",lessThan:"less than",greaterOrEquals:"greater or equal",lessOrEquals:"less or equal"},G=new Set(["descriptorType","title","header","icon","infoText","label","conditionConfig","_conditionConfig","_optionLabels","_formulaConfig","type","eventType","sources","source","previewWorkflow","executionStatus"]),B=(t,n)=>n.split(".").reduce((i,l)=>i==null?void 0:i[l],t),L=t=>{const n=i=>typeof i=="object"&&i?String(i.label??i.name??i.value??""):i==null?"":String(i);return Array.isArray(t)?t.map(n).filter(Boolean):t!=null&&t!==""?[n(t)].filter(Boolean):[]},V=(t,n)=>{const i=t._optionLabels;return L(B(i,n)??B(t,n))};function Ce(t){return(t.includes(".")?t.slice(t.lastIndexOf(".")+1):t).replace(/[_-]+/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,i=>i.toUpperCase())}const ze=new Set(["callout","header","section","divider","button","group","tabs","info","tree-map"]);function Ae(t){const n=[],i=l=>{(Array.isArray(l)?l:[]).forEach(s=>{if(!s||typeof s!="object")return;const o=s;(o.id||o.name)&&n.push(o),Array.isArray(o.fields)&&i(o.fields),Array.isArray(o.columns)&&i(o.columns),Array.isArray(o.tabs)&&o.tabs.forEach(d=>i(d==null?void 0:d.fields))})};return i(t),n}function Ie(t,n){const i=String(n.id||n.name||""),l=t._optionLabels,s=l?B(l,i):void 0;if(s!=null)return L(s);const o=B(t,i);if(typeof o=="boolean")return o?["Yes"]:[];if(Array.isArray(n.options)&&o!=null&&o!==""){const d=new Map(n.options.filter(r=>r&&typeof r=="object").map(r=>[String(r.value),String(r.label??r.value)]));return L(o).map(r=>d.get(r)??r)}return L(o)}function Le(t){const n=[],i=l=>{(Array.isArray(l)?l:[]).forEach(s=>{s&&s.type==="group"?i(s.entries):s&&n.push(s)})};return i(t),n}function pe(t,n){const i=Ae(n==null?void 0:n.formSchema),l=t.conditionConfig??t._conditionConfig,s=(n==null?void 0:n.label)||t.title||"Set",o=s.length<=18?s:"",d=c=>{const x=i.find(u=>(u==null?void 0:u.id)===c||(u==null?void 0:u.name)===c);return x!=null&&x.label?String(x.label):Ce(c)},r=[],p=new Set(l?Object.keys(l):[]);if(l&&typeof l=="object"&&Object.entries(l).forEach(([c,x])=>{const u=Le(x),g=V(t,c);u.length===0&&g.length===0||r.push({kind:"rule",when:u.map(h=>({field:h.fieldLabel||d(h.field||""),op:Pe[h.operator]||h.operator||"",value:h.value==null?void 0:L(h.value).join(", ")||void 0,connector:h.connector||"and"})),outcomeLabel:o,outcome:g})}),i.length)i.forEach(c=>{const x=String(c.id||c.name||"");if(!x||G.has(x)||p.has(x)||ze.has(c.type))return;const u=Ie(t,c);u.length&&r.push({kind:"value",label:d(x),value:u})});else{const c=(x,u)=>{Object.keys(x).forEach(g=>{const h=u?`${u}.${g}`:g;if(G.has(g)||p.has(h))return;const a=x[g];if(a&&typeof a=="object"&&!Array.isArray(a)){c(a,h);return}if(typeof a=="boolean"){a&&r.push({kind:"value",label:d(h),value:["Yes"]});return}const b=V(t,h);b.length&&r.push({kind:"value",label:d(h),value:b})})};c(t,"")}return r}function xe(t,n){const i=n==null?void 0:n.nodeBody;return typeof i=="function"?i(t):Array.isArray(i)?i:pe(t,n)}const z={color:"#64748b"},_={color:"#0f172a",fontWeight:600};function I({text:t,style:n}){return e.jsx("span",{title:t,style:{...n,display:"inline-block",maxWidth:230,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",verticalAlign:"bottom"},children:t})}function Z({conditions:t}){return e.jsx(e.Fragment,{children:t.map((n,i)=>e.jsxs(q.Fragment,{children:[i>0&&e.jsxs("span",{style:z,children:[" ",n.connector??"and"," "]}),e.jsx("span",{style:_,children:n.field}),e.jsxs("span",{style:z,children:[" ",n.op," "]}),n.value!=null&&e.jsx("span",{style:_,children:n.value})]},i))})}function U({data:t,descriptor:n,accent:i="#2563eb",emptyText:l}){const s=xe(t||{},n);if(!s.length)return e.jsx("span",{style:{color:"#94a3b8"},children:l??"Click edit to configure"});const o={color:i,fontWeight:600};return e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:s.map((d,r)=>{if(d.kind==="value")return e.jsxs("div",{style:{lineHeight:1.5},children:[e.jsxs("span",{style:z,children:[d.label," "]}),e.jsx(I,{text:d.value.join(", "),style:_})]},r);if(d.fallback)return e.jsxs("div",{style:{lineHeight:1.5},children:[e.jsx("span",{style:z,children:"Otherwise → "}),e.jsx(I,{text:d.outcome.join(", "),style:o})]},r);const p=d.outcome.length>0,c=!!d.when&&d.when.length>0;return d.outcomeLabel?e.jsxs("div",{style:{lineHeight:1.5},children:[e.jsxs("span",{style:z,children:[d.outcomeLabel," "]}),p&&e.jsx(I,{text:d.outcome.join(", "),style:o}),c&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:z,children:" when "}),e.jsx(Z,{conditions:d.when})]})]},r):c?e.jsxs("div",{style:{lineHeight:1.5},children:[e.jsx("span",{style:z,children:"When "}),e.jsx(Z,{conditions:d.when}),p&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:z,children:" → "}),e.jsx(I,{text:d.outcome.join(", "),style:o})]})]},r):e.jsx("div",{style:{lineHeight:1.5},children:e.jsx(I,{text:d.outcome.join(", "),style:o})},r)})})}const De="#ea580c";function he(t){return t?t.replace(/[_-]+/g," ").toLowerCase().replace(/\b\w/g,n=>n.toUpperCase()):""}function Re(t){if(typeof t!="string"&&t.label)return t.label;const n=typeof t=="string"?t:t.value??"";return he(n)}const ue=({id:t,data:n})=>{const{onClickAddTrigger:i,onEditNode:l,messages:s,activeTemplate:o}=w(),{type:d,eventType:r,sources:p,label:c,source:x,previewWorkflow:u,executionStatus:g,infoText:h="This node decides the flow trigger type and configuration."}=n??{},a=m=>{m==null||m.stopPropagation(),d==="scheduler"?l(t):i()},b=Array.isArray(p)&&p.length>0,N=!!(c||x),T=d==="scheduler"?(s==null?void 0:s.schedulerTriggerTitle)??"Scheduler Trigger":d==="event"||b||N?(s==null?void 0:s.eventTriggerSourceTitle)??"Event Trigger Source":(s==null?void 0:s.selectTriggerTitle)??"Select Trigger",v=(()=>{if(d==="scheduler")return e.jsx(U,{data:n,accent:De,emptyText:(s==null?void 0:s.schedulerToBeConfigured)??"Scheduler to be configured"});if(d==="event"||b){const m=c||he(r);return e.jsxs("div",{children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[e.jsx("span",{style:{fontWeight:600},children:m}),e.jsx("span",{className:"ff-ms-2 ff-text-muted",style:{fontSize:12},children:"via"})]}),e.jsx("div",{className:"ff-d-flex ff-flex-wrap ff-mt-2",style:{gap:4},children:b?p.map((S,P)=>e.jsx(E.Chip,{label:Re(S),variant:"outlined",size:"small",className:"ff-text-dark"},P)):e.jsx("span",{className:"ff-text-muted",style:{fontSize:12},children:(s==null?void 0:s.noSourceSelected)??"No source selected"})})]})}return N?e.jsxs("div",{className:"ff-d-flex ff-flex-wrap ff-align-items-center",style:{gap:6},children:[c&&e.jsx("span",{style:{fontWeight:600},children:c}),x&&e.jsx(E.Chip,{label:x,variant:"outlined",size:"small"})]}):e.jsx("span",{role:"button",tabIndex:0,onClick:a,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&a(m)},style:{cursor:"pointer",color:"#1e88e5"},children:(s==null?void 0:s.selectTriggerCta)??"Click to select a trigger to start your workflow"})})(),k=g?e.jsxs(e.Fragment,{children:[g.status==="success"&&e.jsx(F.FaCheckCircle,{size:16,color:"#1DBF60",style:{marginRight:8}}),g.status==="failed"&&e.jsx(F.FaTimesCircle,{size:16,color:"#f44336",style:{marginRight:8}})]}):e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[!u&&e.jsx("div",{role:"button",tabIndex:0,onClick:a,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&a(m)},className:"ff-me-2",style:{cursor:"pointer",color:"#212121"},"aria-label":"Edit trigger",children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx(E.Tooltip,{title:e.jsx("div",{children:h}),placement:"right",arrow:!0,children:e.jsx("span",{children:e.jsx(y.MdInfoOutline,{color:"gray",size:16})})})]});return o!=null&&o.renderFullTriggerNode?e.jsxs("div",{style:{position:"relative",display:"inline-block"},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),o.renderFullTriggerNode({data:n,onEdit:a}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0},id:"1"})]}):e.jsxs("div",{style:{width:350},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #a5d6a7",borderRadius:8,background:"#fff",overflow:"hidden"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"12px 14px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:28,height:28,borderRadius:6,background:"rgba(76,175,80,0.1)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(y.MdInput,{size:16,color:"#388e3c"})}),e.jsx("span",{style:{fontSize:14,fontWeight:500,color:"#212121"},children:T})]}),e.jsx("div",{className:"ff-d-flex ff-align-items-center",children:k})]}),e.jsx("div",{style:{background:"#f5f5f5",fontSize:12,color:"#212121",padding:"14px 16px",margin:"0 10px 12px",borderRadius:6,textAlign:"left"},children:v})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0},id:"1"})]})};function ge(t){return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}function We(t){if(typeof t!="string"&&t.label)return t.label;const n=typeof t=="string"?t:t.value??"";return ge(n)}const Me=({data:t})=>{const{header:n="Event",title:i,eventType:l,sources:s,executionStatus:o,infoText:d="This event is raised by the system. It cannot be configured."}=t??{},r=i||ge(l)||"—";return e.jsxs("div",{style:{width:350},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #a5d6a7",borderRadius:8,background:"#fff",overflow:"hidden"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"12px 14px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:28,height:28,borderRadius:6,background:"rgba(76,175,80,0.1)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(y.MdInput,{size:16,color:"#388e3c"})}),e.jsx("span",{style:{fontSize:14,fontWeight:500,color:"#212121"},children:n})]}),e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[(o==null?void 0:o.status)==="success"&&e.jsx(F.FaCheckCircle,{size:16,color:"#1DBF60",style:{marginRight:8}}),(o==null?void 0:o.status)==="failed"&&e.jsx(F.FaTimesCircle,{size:16,color:"#f44336",style:{marginRight:8}}),!o&&e.jsx(E.Tooltip,{title:e.jsx("div",{children:d}),placement:"right",arrow:!0,children:e.jsx("span",{children:e.jsx(y.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsxs("div",{style:{background:"#f5f5f5",fontSize:13,color:"#212121",padding:"14px 16px",margin:"0 10px 12px",borderRadius:6,textAlign:"left"},children:[e.jsx("div",{style:{fontWeight:600},children:r}),Array.isArray(s)&&s.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"ff-text-muted",style:{fontSize:12,marginTop:4},children:"via"}),e.jsx("div",{className:"ff-d-flex ff-flex-wrap ff-mt-1",style:{gap:4},children:s.map((p,c)=>e.jsx(E.Chip,{label:We(p),variant:"outlined",size:"small",className:"ff-text-dark"},c))})]})]})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0},id:"1"})]})},K=({rail:t,cardWidth:n})=>{const i=n/2;n/2+t.indent;const l="var(--ff-edge-color, #b0bec5)";return e.jsxs("svg",{width:n+t.indent+200,height:t.height,style:{position:"absolute",left:0,top:"100%",pointerEvents:"none",overflow:"visible"},children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:t.height,stroke:l,strokeWidth:1.5}),t.branches.map((s,o)=>{const d=s.y;return e.jsxs("g",{transform:`translate(0, ${d})`,children:[e.jsx("rect",{x:i-5,y:-5,width:10,height:10,fill:"#fff",stroke:l,strokeWidth:1.5,transform:`rotate(45, ${i}, 0)`}),e.jsx("text",{x:i+14,y:4,fontSize:12,fontWeight:500,fill:"var(--ff-text, #212121)",style:{fontFamily:"sans-serif"},children:s.label})]},o)})]})},ye=({id:t,data:n})=>{const{onEditNode:i,onDeleteNode:l,nodeRegistry:s}=w(),{conditions:o=[],infoText:d="Filter conditions applied to workflow data",_branchRail:r,descriptorType:p,branchStyle:c}=n,x=p?s==null?void 0:s.forType(p):void 0,u=c==="inline-gate",g=e.jsxs(e.Fragment,{children:[e.jsx(f.Handle,{id:"pass",type:"source",position:f.Position.Bottom,style:{opacity:0}}),e.jsx(f.Handle,{id:"fail",type:"source",position:f.Position.Right,style:{opacity:0,top:"50%"}})]});return x!=null&&x.renderFullNode?e.jsxs("div",{style:{position:"relative",display:"inline-block"},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),x.renderFullNode({id:t,data:n,onEdit:()=>i(t),onDelete:()=>l(t)}),g,!u&&r&&e.jsx(K,{rail:r,cardWidth:350})]}):e.jsxs("div",{style:{width:350,position:"relative"},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #ffe082",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 6px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[e.jsx("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)"},children:e.jsx(Se.FiFilter,{className:"ff-text-warning",size:16})}),e.jsx("span",{className:"ff-ms-2 ff-fw-medium ff-text-dark",style:{fontSize:14},children:"Filter"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:h=>{h.stopPropagation(),i(t)},onKeyDown:h=>{h.key==="Enter"&&(h.stopPropagation(),i(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:h=>{h.stopPropagation(),l(t)},onKeyDown:h=>{h.key==="Enter"&&(h.stopPropagation(),l(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})}),e.jsx(E.Tooltip,{title:d,placement:"right",arrow:!0,children:e.jsx("div",{className:"ff-ms-2",children:e.jsx(y.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsx("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:o.length===0?e.jsx("span",{className:"ff-text-muted",children:"No conditions configured"}):o.map((h,a)=>e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-mb-1",children:[e.jsx("p",{className:"ff-m-0 ff-fw-bold ff-me-1 ff-text-truncate",style:{maxWidth:100},title:h.field,children:h.field}),e.jsx("span",{className:"ff-text-muted",children:h.operator}),e.jsx("p",{className:"ff-text-dark ff-text-truncate ff-mx-1 ff-m-0",title:h.value,children:h.value}),a<o.length-1&&e.jsx("p",{className:"ff-bg-primary ff-text-white ff-fw-bold ff-ms-1 ff-px-1 ff-rounded-1 ff-m-0",children:h.logicalOperator})]},a))})]}),g,!u&&r&&e.jsx(K,{rail:r,cardWidth:350})]})},me=({id:t,data:n})=>{const{onEditNode:i,onDeleteNode:l,nodeRegistry:s,nodeBody:o="full",messages:d}=w(),{title:r="Task",descriptorType:p,infoText:c=""}=n,x=p?s==null?void 0:s.forType(p):void 0,u=x==null?void 0:x.icon;return x!=null&&x.renderFullNode?e.jsxs("div",{style:{position:"relative",display:"inline-block"},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),x.renderFullNode({id:t,data:n,onEdit:()=>i(t),onDelete:()=>l(t)}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]}):e.jsxs("div",{style:{width:350},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #b0bec5",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 8px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[u&&e.jsx("div",{style:{display:"flex",alignItems:"center"},children:u}),e.jsx("span",{className:"ff-text-dark",style:{fontSize:14,fontWeight:500},children:r})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:g=>{g.stopPropagation(),i(t)},onKeyDown:g=>{g.key==="Enter"&&(g.stopPropagation(),i(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:g=>{g.stopPropagation(),l(t)},onKeyDown:g=>{g.key==="Enter"&&(g.stopPropagation(),l(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})}),c&&e.jsx(E.Tooltip,{title:c,placement:"right",arrow:!0,children:e.jsx("div",{className:"ff-ms-2",children:e.jsx(y.MdInfoOutline,{color:"gray",size:16})})})]})]}),o!=="title-only"&&e.jsx("div",{style:{margin:"0 8px 8px",padding:8,borderRadius:4,background:"#f8f9fa",fontSize:12,textAlign:"left",color:"#212529",lineHeight:1.4},children:x!=null&&x.renderNode?x.renderNode(n):e.jsx(U,{data:n,descriptor:x,accent:"#2563eb",emptyText:(d==null?void 0:d.clickEditToConfigure)??"Click edit to configure"})})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]})},J=2;function $e(t,n,i){const l=(t==null?void 0:t.toLowerCase())||(n?"sequential":null);return l?(i==null?void 0:i[l])??l.charAt(0).toUpperCase()+l.slice(1):null}function He(t){var o,d;const n=Array.isArray(t.userIds)?t.userIds.length:0,i=((o=t.groupName)==null?void 0:o.trim())??"",l=((d=t.roleName)==null?void 0:d.trim())??"",s=n>0||!!i||!!l;return i?{label:`Group: ${i}`,configured:!0}:l?{label:`Role: ${l}`,configured:!0}:n>0?{label:`${n} approver${n!==1?"s":""}`,configured:!0}:{label:"Not configured",configured:s}}const je=({id:t,data:n})=>{const{onEditNode:i,onDeleteNode:l}=w(),{approvalData:s,isPreview:o=!1,_branchRail:d,executionModeLabel:r}=n,p=(s==null?void 0:s.policy)??{},c=p.stages??[],x=c.length,u=c.slice(0,J),g=x-J,h=p.name??p.policyName??"Untitled Policy";return e.jsxs("div",{style:{width:350,position:"relative"},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #ffe082",borderRadius:8,background:"#fff",overflow:"hidden"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 8px 8px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("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)"},children:e.jsx(y.MdCheckCircle,{style:{color:"#FBC02D"},size:16})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:"Approval Policy"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[!o&&e.jsx("div",{role:"button",tabIndex:0,style:{cursor:"pointer"},onClick:a=>{a.stopPropagation(),i(t)},onKeyDown:a=>{a.key==="Enter"&&(a.stopPropagation(),i(t))},"data-testid":"approval-node-edit-btn",children:e.jsx(y.MdOutlineModeEdit,{size:16,className:"ff-text-secondary"})}),!o&&e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,style:{cursor:"pointer"},onClick:a=>{a.stopPropagation(),l(t)},onKeyDown:a=>{a.key==="Enter"&&(a.stopPropagation(),l(t))},"data-testid":"approval-node-delete-btn",children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})}),e.jsx(E.Tooltip,{title:"This approval policy determines who must approve a request before the workflow continues.",arrow:!0,placement:"right",children:e.jsx("span",{className:"ff-ms-2 ff-d-inline-flex",children:e.jsx(y.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsx("div",{className:"ff-text-truncate ff-text-dark ff-fw-bold",style:{margin:"0 10px 8px",fontSize:13},title:h,children:h}),e.jsx("div",{style:{margin:"0 10px 10px",display:"flex",flexDirection:"column",gap:8},children:c.length===0?e.jsx("div",{className:"ff-text-center",style:{fontSize:12,color:"#9e9e9e",padding:"14px 0",borderRadius:6,border:"1px dashed #FEE79A",background:"#FFFDE7"},children:"No stages configured"}):e.jsxs(e.Fragment,{children:[u.map((a,b)=>{var m;const N=((m=a.stageName)==null?void 0:m.trim())||`Stage ${b+1}`,{label:T,configured:v}=He(a),k=$e(a.executionMode,a.isSequential,r);return e.jsxs("div",{style:{background:"#f5f5f5",borderRadius:6,padding:8},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center",style:{gap:8},children:[e.jsx("div",{className:"ff-d-flex ff-align-items-center ff-justify-content-center ff-flex-shrink-0",style:{width:28,height:28,borderRadius:"50%",background:"#f5f5f5b6",border:"1px solid #E0E0E0",color:"#424242",fontSize:12,fontWeight:700},children:b+1}),e.jsx("div",{className:"ff-text-dark ff-text-truncate",style:{fontSize:12,fontWeight:700,marginRight:"auto"},children:N}),e.jsxs("div",{className:`ff-d-flex ff-align-items-center ff-flex-shrink-0 ${v?"ff-text-dark":"ff-text-muted"}`,style:{gap:4,fontSize:12},children:[e.jsx(y.MdPeople,{size:15,style:{color:v?"#5D4037":"#9E9E9E"}}),T]})]}),k&&e.jsxs("div",{className:"ff-d-flex ff-align-items-center",style:{gap:4,fontSize:11,color:"#1a73e8",marginTop:4,paddingLeft:36},children:[e.jsx(y.MdArrowForward,{size:11}),k]})]},b)}),g>0&&e.jsxs("div",{className:"ff-text-primary",style:{fontSize:12,marginTop:4,cursor:o?"default":"pointer",color:"#1976d2"},role:o?void 0:"button",tabIndex:o?void 0:0,onClick:a=>{o||(a.stopPropagation(),i(t))},onKeyDown:a=>{o||(a.key==="Enter"||a.key===" ")&&(a.stopPropagation(),i(t))},children:["+ ",g," More Stage",g>1?"s":""]})]})})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}}),d&&e.jsx(K,{rail:d,cardWidth:350})]})},be=({id:t,data:n})=>{const{onEditNode:i,onDeleteNode:l}=w(),{duration:s,unit:o}=n,d=s!=null&&o,r=d?`Wait ${s} ${o}`:"Not configured";return e.jsxs("div",{style:{width:350},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #b0bec5",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center ff-mx-2 ff-mt-2 ff-mb-1",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("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)"},children:e.jsx(y.MdSchedule,{size:16,color:"#1976d2"})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:"Delay"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:p=>{p.stopPropagation(),i(t)},onKeyDown:p=>{p.key==="Enter"&&(p.stopPropagation(),i(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:p=>{p.stopPropagation(),l(t)},onKeyDown:p=>{p.key==="Enter"&&(p.stopPropagation(),l(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:e.jsx("span",{className:d?"ff-text-dark ff-fw-medium":"ff-text-muted",children:r})})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]})},Q={email:{label:"Email",bg:"#e3f2fd",color:"#1565c0",iconType:y.MdEmail},slack:{label:"Slack",bg:"#e8f5e9",color:"#2e7d32",iconType:y.MdNotifications},teams:{label:"MS Teams",bg:"#ede7f6",color:"#4527a0",iconType:y.MdNotifications},sms:{label:"SMS",bg:"#fce4ec",color:"#880e4f",iconType:y.MdSms},"in-app":{label:"In-App",bg:"#fff3e0",color:"#e65100",iconType:y.MdNotifications},webhook:{label:"Webhook",bg:"#f3e5f5",color:"#6a1b9a",iconType:y.MdWebhook}},Fe={label:"Notification",bg:"rgba(156,39,176,0.1)",color:"#7b1fa2",iconType:y.MdNotifications};function Be(t){var n;switch(t.channel){case"email":return((n=t.emailTo)==null?void 0:n.join(", "))??t.recipient??null;case"slack":return t.slackChannel??null;case"teams":return t.teamsMessage?"Message configured":null;case"sms":return t.smsTo??null;case"in-app":return t.inAppRecipient??null;case"webhook":return t.webhookUrl??null;default:return t.recipient??null}}function Oe(t){switch(t.channel){case"email":return t.emailSubject??t.subject??null;case"slack":{const n=t.slackMessage;return n?n.length>60?`${n.slice(0,60)}…`:n:null}case"in-app":return t.inAppTitle??null;default:return t.subject??null}}const ve=({id:t,data:n})=>{const{onEditNode:i,onDeleteNode:l}=w(),s=n,o=s.channel&&Q[s.channel]?Q[s.channel]:Fe,d=Be(s),r=Oe(s),p=!!(s.channel&&d),c=o.iconType;return e.jsxs("div",{style:{width:A.NODE_WIDTH},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #b0bec5",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 6px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{className:"ff-d-flex ff-align-items-center ff-justify-content-center ff-rounded",style:{width:25,height:25,background:o.bg},children:e.jsx(c,{size:16,color:o.color})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:s.channel?`${o.label} Notification`:"Notification"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:x=>{x.stopPropagation(),i(t)},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.stopPropagation(),i(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:x=>{x.stopPropagation(),l(t)},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.stopPropagation(),l(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:p?e.jsxs("div",{className:"ff-d-flex ff-flex-column ff-gap-1",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("span",{className:"ff-px-2 ff-py-1 ff-rounded",style:{fontSize:10,background:o.bg,color:o.color,fontWeight:600,flexShrink:0},children:o.label}),e.jsx("span",{className:"ff-text-dark ff-text-truncate",style:{maxWidth:220},children:d})]}),r&&e.jsx("span",{className:"ff-text-muted ff-text-truncate",style:{maxWidth:280},children:r})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured"})})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]})},Y={"api-key":"API Key",hmac:"HMAC"},Ne=({data:t})=>{const{onClickAddTrigger:n}=w(),{label:i="Webhook Trigger",endpointUrl:l,authMethod:s,source:o}=t,d=p=>{p.stopPropagation(),n()},r=p=>{p.stopPropagation(),l&&navigator.clipboard.writeText(l).catch(()=>{})};return e.jsxs("div",{style:{width:A.NODE_WIDTH},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #90caf9",borderRadius:8,background:"#fff",overflow:"hidden"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 6px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:28,height:28,borderRadius:6,background:"rgba(33,150,243,0.1)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(y.MdWebhook,{size:16,color:"#1565c0"})}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:"#212121"},children:"Webhook Trigger"})]}),e.jsx("div",{role:"button",tabIndex:0,onClick:d,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&d(p)},className:"ff-d-flex ff-align-items-center",style:{paddingRight:4,cursor:"pointer"},children:e.jsx(y.MdOutlineModeEdit,{size:16,color:"#555"})})]}),e.jsxs("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:"#e3f2fd",border:"1px solid #90caf9"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-flex-wrap ff-gap-2 ff-mb-1",children:[e.jsx("span",{style:{fontSize:12,color:"#1565c0",fontWeight:600},children:i}),o&&e.jsx("span",{className:"ff-px-2 ff-py-1 ff-rounded",style:{fontSize:11,background:"#fff",border:"1px solid #90caf9",color:"#1565c0"},children:o}),s&&s!=="none"&&Y[s]&&e.jsx("span",{className:"ff-px-2 ff-py-1 ff-rounded",style:{fontSize:10,background:"#1565c0",color:"#fff",fontWeight:600},children:Y[s]})]}),l&&e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-1",style:{marginTop:4},children:[e.jsx("span",{style:{fontSize:10,color:"#1565c0",fontFamily:"monospace",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l}),e.jsx(E.Tooltip,{title:"Copy URL",placement:"top",arrow:!0,children:e.jsx("div",{role:"button",tabIndex:0,onClick:r,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&r(p)},style:{cursor:"pointer",flexShrink:0},children:e.jsx(y.MdContentCopy,{size:12,color:"#1565c0"})})})]})]})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]})},ke=({id:t,data:n})=>{var g;const{onEditNode:i,onDeleteNode:l,nodeRegistry:s}=w(),{method:o,url:d,descriptorType:r}=n,p=r?(g=s==null?void 0:s.forType(r))==null?void 0:g.icon:e.jsx(y.MdHttp,{size:16,color:"#546e7a"}),c=!!(o&&d),x=(o==null?void 0:o.toUpperCase())??"",u=A.HTTP_METHOD_STYLE[x]??null;return e.jsxs("div",{style:{width:A.NODE_WIDTH},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #b0bec5",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 6px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:25,height:25,display:"flex",alignItems:"center",justifyContent:"center"},children:p}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:"REST API Call"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:h=>{h.stopPropagation(),i(t)},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.stopPropagation(),i(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:h=>{h.stopPropagation(),l(t)},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.stopPropagation(),l(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:c?e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[u&&e.jsx("span",{style:{fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:4,background:u.bg,color:u.color,flexShrink:0},children:x}),e.jsx("span",{className:"ff-text-dark ff-text-truncate",style:{fontFamily:"monospace",fontSize:11},title:d,children:d})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured"})})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]})},_e={eq:"=",neq:"≠",gt:">",gte:"≥",lt:"<",lte:"≤",contains:"contains",startsWith:"starts with",endsWith:"ends with",isEmpty:"is empty",isNotEmpty:"is not empty"},Ke=({id:t,data:n})=>{const{onEditNode:i,onDeleteNode:l}=w(),{title:s="Condition Branch",branchConfigs:o=[],defaultBranch:d}=n,r=o.length>0;return e.jsxs("div",{style:{width:A.NODE_WIDTH},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #b39ddb",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 6px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:25,height:25,borderRadius:6,background:"rgba(103,58,183,0.1)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(y.MdCallSplit,{size:16,color:"#512da8"})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:s})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:p=>{p.stopPropagation(),i(t)},onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.stopPropagation(),i(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:p=>{p.stopPropagation(),l(t)},onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.stopPropagation(),l(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:r?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[o.map((p,c)=>{var h,a;const x=A.BRANCH_PALETTE[c%A.BRANCH_PALETTE.length],u=(h=p.conditions)==null?void 0:h[0],g=(((a=p.conditions)==null?void 0:a.length)??0)-1;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:10,background:x.bg,color:x.color,flexShrink:0},children:p.label||p.key}),u?e.jsxs("span",{style:{fontSize:11,color:"#616161",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[u.field," ",_e[u.operator]??u.operator,u.value?` ${u.value}`:"",g>0?` +${g} more`:""]}):e.jsx("span",{style:{fontSize:11,color:"#9e9e9e"},children:"No conditions yet"})]},p.key)}),d&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:2},children:[e.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:10,background:"#f5f5f5",color:"#757575",flexShrink:0},children:"Default"}),e.jsx("span",{style:{fontSize:11,color:"#9e9e9e"},children:"fallback path"})]})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured — click edit to add branches"})})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]})},qe=({id:t,data:n})=>{var h;const{onEditNode:i,onDeleteNode:l,nodeRegistry:s}=w(),{title:o="Sub-Workflow",workflowId:d,workflowLabel:r,descriptorType:p,onPreview:c}=n,x=p?(h=s==null?void 0:s.forType(p))==null?void 0:h.icon:e.jsx(y.MdAccountTree,{size:16,color:"#00695c"}),u=!!d,g=a=>{a.stopPropagation(),d&&c&&c(d)};return e.jsxs("div",{style:{width:A.NODE_WIDTH},children:[e.jsx(f.Handle,{type:"target",position:f.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #80cbc4",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 6px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:25,height:25,borderRadius:6,background:"rgba(0,137,123,0.1)",display:"flex",alignItems:"center",justifyContent:"center"},children:x}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:o})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),i(t)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.stopPropagation(),i(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),l(t)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.stopPropagation(),l(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:u?"#e0f2f1":"#fafafa",fontSize:12,border:u?"1px solid #b2dfdb":"none"},children:u?e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-justify-content-between",children:[e.jsxs("div",{className:"ff-d-flex ff-flex-column ff-gap-1",children:[e.jsx("span",{style:{fontSize:12,fontWeight:600,color:"#00695c"},children:r||d}),e.jsxs("span",{style:{fontSize:10,color:"#80cbc4",fontFamily:"monospace"},children:["ID: ",d]})]}),c&&e.jsxs("div",{role:"button",tabIndex:0,onClick:g,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&g(a)},style:{cursor:"pointer",display:"flex",alignItems:"center",gap:3,fontSize:11,color:"#00897b"},children:[e.jsx(y.MdOpenInNew,{size:13}),"Preview"]})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured — select a workflow"})})]}),e.jsx(f.Handle,{type:"source",position:f.Position.Bottom,style:{opacity:0}})]})},Ue={startNode:de,endNode:ae,addTriggerNode:fe,addStepNode:Ee,triggerNode:ue,eventNode:Me,filterNode:ye,actionNode:me,approvalNode:je,delayNode:be,notificationNode:ve,webhookTriggerNode:Ne,restApiNode:ke,conditionBranchNode:Ke,subWorkflowNode:qe},Ge=11.5,X=2,M=6,ee=40,te=20,ne=4,Ve=({id:t,sourceX:n,sourceY:i,targetX:l,targetY:s,sourcePosition:o,targetPosition:d,source:r,target:p,data:c})=>{const[x,u,g]=f.getStraightPath({sourceX:n,sourceY:i,targetX:l,targetY:s}),h=c==null?void 0:c.label,a=h==="Pass",b=a||h==="Fail",N=n+(l-n)/3,T=i+(s-i)/3,v=n+2*(l-n)/3,k=i+2*(s-i)/3,m=c==null?void 0:c.onAddStepClick,S=C=>{if(C.stopPropagation(),typeof m!="function")return;const O={edgeId:t,nodeId:r,sourceNodeId:r,targetNodeId:p,position:"between",referenceNodeId:r,referenceNodeType:c==null?void 0:c.referenceNodeType,stepVisibility:c==null?void 0:c.stepVisibility};m(r,O)},P=C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),S(C))},D=()=>e.jsxs(e.Fragment,{children:[e.jsxs("g",{className:"plus-icon-container",children:[e.jsx("circle",{r:Ge,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-M,x2:0,y2:M,strokeWidth:X,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-M,y1:0,x2:M,y2:0,strokeWidth:X,strokeLinecap:"round",className:"plus-line"})]}),e.jsxs("g",{className:"edge-plus-tooltip",transform:"translate(18, 0)",children:[e.jsx("rect",{x:0,y:-10,width:65,height:20,rx:4,className:"tooltip-bg"}),e.jsx("path",{d:"M0 -4 L-4 0 L0 4 Z",className:"tooltip-bg"}),e.jsx("text",{x:32,y:0,textAnchor:"middle",dominantBaseline:"central",fill:"white",style:{fontSize:10,fontWeight:600,pointerEvents:"none"},children:"Add Step"})]})]}),R=m?{onClick:S,onKeyDown:P,role:"button",tabIndex:0,style:{cursor:"pointer",pointerEvents:"all"}}:{style:{cursor:"default",pointerEvents:"all"}};return e.jsxs("g",{className:"edge-with-plus-wrapper",children:[e.jsx(f.BaseEdge,{id:t,path:x}),b?e.jsxs(e.Fragment,{children:[e.jsxs("g",{transform:`translate(${N}, ${T})`,children:[e.jsx("rect",{x:-ee/2,y:-te/2,width:ee,height:te,rx:ne,ry:ne,fill:a?"#ADE6C5":"#FDBFBF"}),e.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fill:a?"#1DBF60":"#C50000",style:{fontSize:12,fontWeight:500},children:h})]}),e.jsx("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${v}, ${k})`,"data-testid":"plus-node-icon",...R,children:e.jsx(D,{})})]}):e.jsx("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${u}, ${g})`,"data-testid":"plus-node-icon",...R,children:e.jsx(D,{})})]})},Ze=11.5,se=2,$=6,Je=({id:t,sourceX:n,sourceY:i,targetX:l,targetY:s,source:o,target:d,data:r})=>{const[p,c,x]=f.getStraightPath({sourceX:n,sourceY:i,targetX:l,targetY:s}),u=r==null?void 0:r.onAddStepClick,g=a=>{a.stopPropagation(),typeof u=="function"&&u(o,{edgeId:t,nodeId:o,sourceNodeId:o,targetNodeId:d,position:"between",referenceNodeId:o,referenceNodeType:r==null?void 0:r.referenceNodeType,stepVisibility:r==null?void 0:r.stepVisibility,filterId:r==null?void 0:r.filterId,branch:r==null?void 0:r.branch})},h=a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),g(a))};return e.jsxs("g",{className:"edge-with-plus-wrapper",children:[e.jsx(f.BaseEdge,{id:t,path:p,style:{stroke:"#b0bec5"}}),e.jsxs("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${c}, ${x})`,style:{cursor:u?"pointer":"default",pointerEvents:"all",outline:"none"},onClick:u?g:void 0,onKeyDown:u?h:void 0,role:u?"button":void 0,tabIndex:u?0:void 0,"data-testid":"plus-node-icon",children:[e.jsx("circle",{r:Ze,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-$,x2:0,y2:$,strokeWidth:se,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-$,y1:0,x2:$,y2:0,strokeWidth:se,strokeLinecap:"round",className:"plus-line"}),e.jsxs("g",{className:"edge-plus-tooltip",transform:"translate(18, 0)",children:[e.jsx("rect",{x:0,y:-10,width:65,height:20,rx:4,className:"tooltip-bg"}),e.jsx("path",{d:"M0 -4 L-4 0 L0 4 Z",className:"tooltip-bg"}),e.jsx("text",{x:32,y:0,textAnchor:"middle",dominantBaseline:"central",fill:"white",style:{fontSize:10,fontWeight:600,pointerEvents:"none"},children:"Add Step"})]})]})]})},Qe=({id:t,sourceX:n,sourceY:i,targetX:l,targetY:s})=>{const[o]=f.getStraightPath({sourceX:n,sourceY:i,targetX:l,targetY:s});return e.jsx(f.BaseEdge,{id:t,path:o,style:{stroke:"#b0bec5"}})},Ye=11.5,ie=2,H=6,Xe=-24,oe=40,le=20,re=4,et=({id:t,sourceX:n,sourceY:i,targetX:l,targetY:s,source:o,target:d,data:r})=>{const[p,c,x]=f.getStraightPath({sourceX:n,sourceY:i,targetX:l,targetY:s}),u=r==null?void 0:r.label,g=u==="Pass",h=g||u==="Fail",a=r==null?void 0:r.onAddStepClick,b=(r==null?void 0:r.showPlus)!==!1&&!!a,N=v=>{v.stopPropagation(),typeof a=="function"&&a(o,{edgeId:t,nodeId:o,sourceNodeId:o,targetNodeId:d,position:"between",referenceNodeId:o,referenceNodeType:r==null?void 0:r.referenceNodeType,stepVisibility:r==null?void 0:r.stepVisibility})},T=v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),N(v))};return e.jsxs("g",{className:"edge-with-plus-wrapper",children:[e.jsx(f.BaseEdge,{id:t,path:p,style:{stroke:"#b0bec5"}}),e.jsxs("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${c}, ${x})`,style:{cursor:a?"pointer":"default",pointerEvents:"all",outline:"none"},onClick:a?N:void 0,onKeyDown:a?T:void 0,role:a?"button":void 0,tabIndex:a?0:void 0,children:[h&&e.jsxs("g",{transform:`translate(0, ${b?Xe:0})`,children:[e.jsx("rect",{x:-oe/2,y:-le/2,width:oe,height:le,rx:re,ry:re,fill:g?"#ADE6C5":"#FDBFBF"}),e.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fill:g?"#1DBF60":"#C50000",style:{fontSize:12,fontWeight:500},children:u})]}),b&&e.jsxs("g",{className:"plus-icon-container",children:[e.jsx("circle",{r:Ye,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-H,x2:0,y2:H,strokeWidth:ie,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-H,y1:0,x2:H,y2:0,strokeWidth:ie,strokeLinecap:"round",className:"plus-line"})]}),b&&e.jsxs("g",{className:"edge-plus-tooltip",transform:"translate(22, 0)",children:[e.jsx("rect",{x:0,y:-10,width:65,height:20,rx:4,className:"tooltip-bg"}),e.jsx("path",{d:"M0 -4 L-4 0 L0 4 Z",className:"tooltip-bg"}),e.jsx("text",{x:32,y:0,textAnchor:"middle",dominantBaseline:"central",fill:"white",style:{fontSize:10,fontWeight:600,pointerEvents:"none"},children:"Add Step"})]})]})]})},tt=({id:t,source:n,target:i,sourceX:l,sourceY:s,targetX:o,targetY:d,style:r={},markerEnd:p,data:c})=>{const x=(c==null?void 0:c.verticalRouting)??!1,u=(c==null?void 0:c.sideRouting)??!1,g=(c==null?void 0:c.railless)??!1,h=30,a=u?`M ${l},${s} L ${o},${s} L ${o},${d}`:g?`M ${l},${s} L ${o},${d}`:x?(()=>{const j=d-h;return`M ${l},${j} L ${o},${j} L ${o},${d}`})():(()=>{const j=s+30;return`M ${l},${s} L ${l},${j} L ${o},${j} L ${o},${d}`})(),b=r.stroke||"#d1d5db",N=c==null?void 0:c.label,T=(c==null?void 0:c.isFirst)??!1,v=c==null?void 0:c.onAddStepClick;let k,m,S,P;if(u)k=l+(o-l)*.5,m=s,S=k,P=s;else if(g){const j=d-s;k=l,m=s+j/3,S=l,P=s+j*2/3}else if(x){const j=d-h;k=l+(o-l)*.25,m=j,S=l+(o-l)*.65,P=j}else{const j=s+30;k=l+(o-l)*.35,m=j,S=l+(o-l)*.7,P=j}const D=!!N&&(!x||u||g),R=!!v&&!u,C=j=>{j.stopPropagation(),v&&v(n,{edgeId:t,nodeId:n,sourceNodeId:n,targetNodeId:i,position:"between",referenceNodeId:n,filterId:c==null?void 0:c.filterId,branch:c==null?void 0:c.branch})},O=11.5,W=6;return e.jsxs("g",{children:[e.jsx("path",{id:t,d:a,fill:"none",stroke:b,strokeWidth:1.5,markerEnd:p}),D&&e.jsx("g",{transform:`translate(${k}, ${m})`,children:(()=>{const j=Math.max(44,N.length*7+20);return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:-j/2,y:-11,width:j,height:22,rx:11,fill:T?"#e8f5e9":"#ffebee",stroke:T?"#81c784":"#e57373",strokeWidth:1}),e.jsx("text",{x:0,y:4,textAnchor:"middle",fontSize:10,fontWeight:600,fill:T?"#2e7d32":"#c62828",style:{fontFamily:"sans-serif",pointerEvents:"none"},children:N})]})})()}),R&&e.jsxs("g",{transform:`translate(${S}, ${P})`,onClick:C,style:{cursor:"pointer",pointerEvents:"all"},className:"nodrag nopan edge-plus-svg",children:[e.jsx("circle",{r:O,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-W,x2:0,y2:W,strokeWidth:2,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-W,y1:0,x2:W,y2:0,strokeWidth:2,strokeLinecap:"round",className:"plus-line"})]})]})};exports.ActionNode=me;exports.AddTriggerNode=fe;exports.ApprovalNode=je;exports.DelayNode=be;exports.EdgeWithPlusLabel=Ve;exports.EndNode=ae;exports.FilterNode=ye;exports.GatewayBranchEdge=tt;exports.LabelPlusEdge=et;exports.NodeBody=U;exports.NotificationNode=ve;exports.PlainEdge=Qe;exports.PlusEdge=Je;exports.RestApiNode=ke;exports.StartNode=de;exports.TriggerNode=ue;exports.WebhookTriggerNode=Ne;exports.WorkflowCanvasContext=ce;exports.builtInNodeTypes=Ue;exports.deriveRows=pe;exports.resolveNodeRows=xe;
2
+ //# sourceMappingURL=GatewayBranchEdge-CDNn0TfD.js.map