@notmrabhi/flowforge 0.1.16 → 0.1.18

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.
@@ -171,7 +171,7 @@ const De = ({ data: t }) => {
171
171
  fontSize: 12,
172
172
  color: "#212121",
173
173
  padding: "10px 6px",
174
- margin: "0 6px 12px",
174
+ margin: "0 6px 10px",
175
175
  borderRadius: 6
176
176
  },
177
177
  children: c
@@ -234,7 +234,7 @@ const We = ({ data: t }) => {
234
234
  fontSize: 13,
235
235
  color: "#212121",
236
236
  padding: "10px 12px",
237
- margin: "0 6px 12px",
237
+ margin: "0 6px 10px",
238
238
  borderRadius: 6
239
239
  },
240
240
  children: [
@@ -346,7 +346,7 @@ const We = ({ data: t }) => {
346
346
  /* @__PURE__ */ e(A, { title: r, placement: "right", arrow: !0, children: /* @__PURE__ */ e("div", { className: "ff-ms-2", children: /* @__PURE__ */ e(W, { color: "gray", size: 16 }) }) })
347
347
  ] })
348
348
  ] }),
349
- /* @__PURE__ */ e("div", { style: { margin: "0 6px 12px", padding: "10px 12px", borderRadius: 6, background: "#fafafa", fontSize: 12 }, children: s.length === 0 ? /* @__PURE__ */ e("span", { className: "ff-text-muted", children: "No conditions configured" }) : s.map((o, l) => /* @__PURE__ */ n("div", { className: "ff-d-flex ff-align-items-center ff-mb-1", children: [
349
+ /* @__PURE__ */ e("div", { style: { margin: "0 6px 10px", padding: "10px 12px", borderRadius: 6, background: "#fafafa", fontSize: 12 }, children: s.length === 0 ? /* @__PURE__ */ e("span", { className: "ff-text-muted", children: "No conditions configured" }) : s.map((o, l) => /* @__PURE__ */ n("div", { className: "ff-d-flex ff-align-items-center ff-mb-1", children: [
350
350
  /* @__PURE__ */ e("p", { className: "ff-m-0 ff-fw-bold ff-me-1 ff-text-truncate", style: { maxWidth: 100 }, title: o.field, children: o.field }),
351
351
  /* @__PURE__ */ e("span", { className: "ff-text-muted", children: o.operator }),
352
352
  /* @__PURE__ */ e("p", { className: "ff-text-dark ff-text-truncate ff-mx-1 ff-m-0", title: o.value, children: o.value }),
@@ -399,7 +399,7 @@ const We = ({ data: t }) => {
399
399
  p && /* @__PURE__ */ e(A, { title: p, placement: "right", arrow: !0, children: /* @__PURE__ */ e("div", { className: "ff-ms-2", children: /* @__PURE__ */ e(W, { color: "gray", size: 16 }) }) })
400
400
  ] })
401
401
  ] }),
402
- r !== "title-only" && /* @__PURE__ */ e("div", { style: { margin: "0 6px 12px", padding: "10px 12px", borderRadius: 6, background: "#fafafa", fontSize: 12 }, children: c != null && c.renderNode ? c.renderNode(i) : I ? /* @__PURE__ */ e("div", { className: "ff-d-flex ff-flex-wrap ff-gap-1", children: k.map((u, z) => /* @__PURE__ */ e("span", { className: "ff-badge ff-bg-dark ff-text-white ff-py-1 ff-px-2 ff-rounded", style: { fontSize: 11 }, title: u, children: u }, z)) }) : /* @__PURE__ */ e("span", { className: "ff-text-muted", children: "Not configured" }) })
402
+ r !== "title-only" && /* @__PURE__ */ e("div", { style: { margin: "0 6px 10px", padding: "10px 12px", borderRadius: 6, background: "#fafafa", fontSize: 12 }, children: c != null && c.renderNode ? c.renderNode(i) : I ? /* @__PURE__ */ e("div", { className: "ff-d-flex ff-flex-wrap ff-gap-1", children: k.map((u, z) => /* @__PURE__ */ e("span", { className: "ff-badge ff-bg-dark ff-text-white ff-py-1 ff-px-2 ff-rounded", style: { fontSize: 11 }, title: u, children: u }, z)) }) : /* @__PURE__ */ e("span", { className: "ff-text-muted", children: "Not configured" }) })
403
403
  ] }),
404
404
  /* @__PURE__ */ e(b, { type: "source", position: x.Bottom, style: { opacity: 0 } })
405
405
  ] });
@@ -448,7 +448,7 @@ const We = ({ data: t }) => {
448
448
  /* @__PURE__ */ e(A, { title: "This approval policy determines who must approve a request before the workflow continues.", arrow: !0, placement: "right", children: /* @__PURE__ */ e("span", { className: "ff-ms-2 ff-d-inline-flex", children: /* @__PURE__ */ e(W, { color: "gray", size: 16 }) }) })
449
449
  ] })
450
450
  ] }),
451
- /* @__PURE__ */ n("div", { style: { margin: "0 6px 12px", padding: "10px 12px", borderRadius: 6, background: "#FCFCFC" }, children: [
451
+ /* @__PURE__ */ n("div", { style: { margin: "0 6px 10px", padding: "10px 12px", borderRadius: 6, background: "#FCFCFC" }, children: [
452
452
  /* @__PURE__ */ n("div", { className: "ff-d-flex ff-justify-content-start ff-align-items-center ff-mb-2", children: [
453
453
  /* @__PURE__ */ e("h6", { className: "ff-text-dark ff-mb-0 ff-text-truncate ff-flex-grow-1 ff-me-2", style: { fontSize: 13, fontWeight: 700 }, title: N, children: N }),
454
454
  /* @__PURE__ */ n("span", { className: "ff-badge ff-rounded-pill ff-px-2 ff-py-1 ff-flex-shrink-0", style: { background: "#FFF9C4", color: "#616161", fontSize: 11, fontWeight: 600 }, children: [
@@ -634,7 +634,7 @@ const Ue = ({ id: t, data: i }) => {
634
634
  )
635
635
  ] })
636
636
  ] }),
637
- /* @__PURE__ */ e("div", { style: { margin: "0 6px 12px", padding: "10px 12px", borderRadius: 6, background: "#fafafa", fontSize: 12 }, children: l ? /* @__PURE__ */ n("div", { className: "ff-d-flex ff-flex-column ff-gap-1", children: [
637
+ /* @__PURE__ */ e("div", { style: { margin: "0 6px 10px", padding: "10px 12px", borderRadius: 6, background: "#fafafa", fontSize: 12 }, children: l ? /* @__PURE__ */ n("div", { className: "ff-d-flex ff-flex-column ff-gap-1", children: [
638
638
  /* @__PURE__ */ n("div", { className: "ff-d-flex ff-align-items-center ff-gap-2", children: [
639
639
  /* @__PURE__ */ e("span", { className: "ff-px-2 ff-py-1 ff-rounded", style: { fontSize: 10, background: r.bg, color: r.color, fontWeight: 600, flexShrink: 0 }, children: r.label }),
640
640
  /* @__PURE__ */ e("span", { className: "ff-text-dark ff-text-truncate", style: { maxWidth: 220 }, children: g })
@@ -677,7 +677,7 @@ const Ue = ({ id: t, data: i }) => {
677
677
  }
678
678
  )
679
679
  ] }),
680
- /* @__PURE__ */ n("div", { style: { margin: "0 6px 12px", padding: "10px 12px", borderRadius: 6, background: "#e3f2fd", border: "1px solid #90caf9" }, children: [
680
+ /* @__PURE__ */ n("div", { style: { margin: "0 6px 10px", padding: "10px 12px", borderRadius: 6, background: "#e3f2fd", border: "1px solid #90caf9" }, children: [
681
681
  /* @__PURE__ */ n("div", { className: "ff-d-flex ff-align-items-center ff-flex-wrap ff-gap-2 ff-mb-1", children: [
682
682
  /* @__PURE__ */ e("span", { style: { fontSize: 12, color: "#1565c0", fontWeight: 600 }, children: f }),
683
683
  r && /* @__PURE__ */ e("span", { className: "ff-px-2 ff-py-1 ff-rounded", style: { fontSize: 11, background: "#fff", border: "1px solid #90caf9", color: "#1565c0" }, children: r }),
@@ -746,7 +746,7 @@ const Ue = ({ id: t, data: i }) => {
746
746
  )
747
747
  ] })
748
748
  ] }),
749
- /* @__PURE__ */ e("div", { style: { margin: "0 6px 12px", padding: "10px 12px", borderRadius: 6, background: "#fafafa", fontSize: 12 }, children: d ? /* @__PURE__ */ n("div", { className: "ff-d-flex ff-align-items-center ff-gap-2", children: [
749
+ /* @__PURE__ */ e("div", { style: { margin: "0 6px 10px", padding: "10px 12px", borderRadius: 6, background: "#fafafa", fontSize: 12 }, children: d ? /* @__PURE__ */ n("div", { className: "ff-d-flex ff-align-items-center ff-gap-2", children: [
750
750
  h && /* @__PURE__ */ e("span", { style: { fontSize: 10, fontWeight: 700, padding: "2px 6px", borderRadius: 4, background: h.bg, color: h.color, flexShrink: 0 }, children: y }),
751
751
  /* @__PURE__ */ e("span", { className: "ff-text-dark ff-text-truncate", style: { fontFamily: "monospace", fontSize: 11 }, title: g, children: g })
752
752
  ] }) : /* @__PURE__ */ e("span", { className: "ff-text-muted", children: "Not configured" }) })
@@ -807,7 +807,7 @@ const Ue = ({ id: t, data: i }) => {
807
807
  )
808
808
  ] })
809
809
  ] }),
810
- /* @__PURE__ */ e("div", { style: { margin: "0 6px 12px", padding: "10px 12px", borderRadius: 6, background: "#fafafa", fontSize: 12 }, children: o ? /* @__PURE__ */ n("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
810
+ /* @__PURE__ */ e("div", { style: { margin: "0 6px 10px", padding: "10px 12px", borderRadius: 6, background: "#fafafa", fontSize: 12 }, children: o ? /* @__PURE__ */ n("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
811
811
  r.map((l, d) => {
812
812
  var p, c;
813
813
  const y = O[d % O.length], h = (p = l.conditions) == null ? void 0 : p[0], N = (((c = l.conditions) == null ? void 0 : c.length) ?? 0) - 1;
@@ -875,7 +875,7 @@ const Ue = ({ id: t, data: i }) => {
875
875
  )
876
876
  ] })
877
877
  ] }),
878
- /* @__PURE__ */ e("div", { style: { margin: "0 6px 12px", padding: "10px 12px", borderRadius: 6, background: h ? "#e0f2f1" : "#fafafa", fontSize: 12, border: h ? "1px solid #b2dfdb" : "none" }, children: h ? /* @__PURE__ */ n("div", { className: "ff-d-flex ff-align-items-center ff-justify-content-between", children: [
878
+ /* @__PURE__ */ e("div", { style: { margin: "0 6px 10px", padding: "10px 12px", borderRadius: 6, background: h ? "#e0f2f1" : "#fafafa", fontSize: 12, border: h ? "1px solid #b2dfdb" : "none" }, children: h ? /* @__PURE__ */ n("div", { className: "ff-d-flex ff-align-items-center ff-justify-content-between", children: [
879
879
  /* @__PURE__ */ n("div", { className: "ff-d-flex ff-flex-column ff-gap-1", children: [
880
880
  /* @__PURE__ */ e("span", { style: { fontSize: 12, fontWeight: 600, color: "#00695c" }, children: o || g }),
881
881
  /* @__PURE__ */ n("span", { style: { fontSize: 10, color: "#80cbc4", fontFamily: "monospace" }, children: [
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),l=require("reactflow"),E=require("@mui/material"),ce=require("react-icons/gr"),V=require("react"),fe=require("./messages-O9Tw_XXR.js"),h=require("react-icons/md"),L=require("react-icons/fa"),ae=require("react-icons/fi"),C=require("./canvasTokens-gKNYrPl4.js"),Z=V.createContext({onEditNode:()=>{},onDeleteNode:()=>{},onAddStep:()=>{},onClickAddTrigger:()=>{},messages:fe.defaultFlowForgeMessages,nodeRegistry:null,nodeBody:"full"}),w=()=>V.useContext(Z),Y=()=>e.jsxs("div",{style:{width:350,display:"flex",justifyContent:"center"},children:[e.jsx(l.Handle,{type:"source",position:l.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"})]}),J=()=>e.jsxs("div",{style:{width:350,display:"flex",justifyContent:"center"},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,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:"End"})]}),Q=()=>{const{onClickAddTrigger:t,messages:s}=w();return e.jsxs("div",{style:{width:350,display:"flex",justifyContent:"center"},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0,left:"50%"}}),e.jsx(E.Tooltip,{title:s.addTriggerTooltip,placement:"top",arrow:!0,children:e.jsxs("div",{onClick:t,role:"button",tabIndex:0,onKeyDown:d=>{d.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(ce.GrTrigger,{size:16}),e.jsx("span",{className:"ff-text-black",style:{fontSize:13},"data-testid":"add-trigger-btn-text",children:s.addTriggerButton})]})}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0,left:"50%"}})]})},pe=({id:t})=>{const{onAddStep:s}=w();return e.jsxs("div",{onClick:()=>s(t),role:"button",tabIndex:0,onKeyDown:d=>{d.key==="Enter"&&s(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(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0}}),"+",e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})};function xe(t){return t?t==="END_USER_CREATION"?"New User Registration":t==="END_USER_UPDATION"?"On User Update":t.replace(/[_-]+/g," ").replace(/\b\w/g,s=>s.toUpperCase()):""}function ge(t){const s=typeof t=="string"?t:t.value??"";return s==="SIGNUP_FLOW"?"User Self-Registration":s==="ADMIN_CREATION_FLOW"?"Create User via Admin Portal":s==="SHEDULAR"?"Scheduler":typeof t!="string"&&t.label?t.label:s.replace(/[_-]+/g," ").replace(/\b\w/g,d=>d.toUpperCase())}const X=({data:t})=>{const{onClickAddTrigger:s}=w(),{type:d,eventType:a,sources:r,label:o,source:x,previewWorkflow:n,executionStatus:i,infoText:f="This node decides the flow trigger type and configuration."}=t??{},y=m=>{m==null||m.stopPropagation(),s()},g=Array.isArray(r)&&r.length>0,j=!!(o||x),p=d==="scheduler"?"Scheduler Trigger":d==="event"||g||j?"Event Trigger Source":"Select Trigger",c=d==="scheduler"?e.jsx("span",{children:"Scheduler to be configured"}):d==="event"||g?e.jsxs("div",{children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[e.jsx("span",{style:{fontWeight:600},children:xe(a)}),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:g?r.map((m,k)=>e.jsx(E.Chip,{label:ge(m),variant:"outlined",size:"small",className:"ff-text-dark"},k)):e.jsx("span",{className:"ff-text-muted",style:{fontSize:12},children:"No source selected"})})]}):j?e.jsxs("div",{className:"ff-d-flex ff-flex-wrap ff-align-items-center",style:{gap:6},children:[o&&e.jsx("span",{style:{fontWeight:600},children:o}),x&&e.jsx(E.Chip,{label:x,variant:"outlined",size:"small"})]}):e.jsx("span",{role:"button",tabIndex:0,onClick:y,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&y(m)},style:{cursor:"pointer",color:"#1e88e5"},children:"Click to select a trigger to start your workflow"}),N=i?e.jsxs(e.Fragment,{children:[i.status==="success"&&e.jsx(L.FaCheckCircle,{size:16,color:"#1DBF60",style:{marginRight:8}}),i.status==="failed"&&e.jsx(L.FaTimesCircle,{size:16,color:"#f44336",style:{marginRight:8}})]}):e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[!n&&e.jsx("div",{role:"button",tabIndex:0,onClick:y,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&y(m)},className:"ff-me-2",style:{cursor:"pointer",color:"#212121"},"aria-label":"Edit trigger",children:e.jsx(h.MdOutlineModeEdit,{size:16})}),e.jsx(E.Tooltip,{title:e.jsx("div",{children:f}),placement:"right",arrow:!0,children:e.jsx("span",{children:e.jsx(h.MdInfoOutline,{color:"gray",size:16})})})]});return e.jsxs("div",{style:{width:350},children:[e.jsx(l.Handle,{type:"target",position:l.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:"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(76,175,80,0.1)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(h.MdInput,{size:16,color:"#388e3c"})}),e.jsx("span",{style:{fontSize:14,fontWeight:500,color:"#212121"},children:p})]}),e.jsx("div",{className:"ff-d-flex ff-align-items-center",children:N})]}),e.jsx("div",{style:{background:"#f5f5f5",fontSize:12,color:"#212121",padding:"10px 6px",margin:"0 6px 12px",borderRadius:6},children:c})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0},id:"1"})]})};function he(t){return t?t==="END_USER_CREATION"?"New User Registration":t==="END_USER_UPDATION"?"On User Update":t.replace(/[_-]+/g," ").replace(/\b\w/g,s=>s.toUpperCase()):""}function ye(t){const s=typeof t=="string"?t:t.value??"";return s==="SIGNUP_FLOW"?"User Self-Registration":s==="ADMIN_CREATION_FLOW"?"Create User via Admin Portal":s==="SHEDULAR"||s==="SCHEDULER"?"Scheduler":typeof t!="string"&&t.label?t.label:s.replace(/[_-]+/g," ").replace(/\b\w/g,d=>d.toUpperCase())}const ue=({data:t})=>{const{header:s="Event",title:d,eventType:a,sources:r,executionStatus:o,infoText:x="This event is raised by the system. It cannot be configured."}=t??{},n=d??he(a)??"—";return e.jsxs("div",{style:{width:350},children:[e.jsx(l.Handle,{type:"target",position:l.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:"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(76,175,80,0.1)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(h.MdInput,{size:16,color:"#388e3c"})}),e.jsx("span",{style:{fontSize:14,fontWeight:500,color:"#212121"},children:s})]}),e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[(o==null?void 0:o.status)==="success"&&e.jsx(L.FaCheckCircle,{size:16,color:"#1DBF60",style:{marginRight:8}}),(o==null?void 0:o.status)==="failed"&&e.jsx(L.FaTimesCircle,{size:16,color:"#f44336",style:{marginRight:8}}),!o&&e.jsx(E.Tooltip,{title:e.jsx("div",{children:x}),placement:"right",arrow:!0,children:e.jsx("span",{children:e.jsx(h.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsxs("div",{style:{background:"#f5f5f5",fontSize:13,color:"#212121",padding:"10px 12px",margin:"0 6px 12px",borderRadius:6},children:[e.jsx("div",{style:{fontWeight:600},children:n}),Array.isArray(r)&&r.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:r.map((i,f)=>e.jsx(E.Chip,{label:ye(i),variant:"outlined",size:"small",className:"ff-text-dark"},f))})]})]})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0},id:"1"})]})},ee=({rail:t,cardWidth:s})=>{const d=s/2;s/2+t.indent;const a="var(--ff-edge-color, #b0bec5)";return e.jsxs("svg",{width:s+t.indent+200,height:t.height,style:{position:"absolute",left:0,top:"100%",pointerEvents:"none",overflow:"visible"},children:[e.jsx("line",{x1:d,y1:0,x2:d,y2:t.height,stroke:a,strokeWidth:1.5}),t.branches.map((r,o)=>{const x=r.y;return e.jsxs("g",{transform:`translate(0, ${x})`,children:[e.jsx("rect",{x:d-5,y:-5,width:10,height:10,fill:"#fff",stroke:a,strokeWidth:1.5,transform:`rotate(45, ${d}, 0)`}),e.jsx("text",{x:d+14,y:4,fontSize:12,fontWeight:500,fill:"var(--ff-text, #212121)",style:{fontFamily:"sans-serif"},children:r.label})]},o)})]})},te=({id:t,data:s})=>{const{onEditNode:d,onDeleteNode:a}=w(),{conditions:r=[],infoText:o="Filter conditions applied to workflow data",_branchRail:x}=s;return e.jsxs("div",{style:{width:350,position:"relative"},children:[e.jsx(l.Handle,{type:"target",position:l.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(ae.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:n=>{n.stopPropagation(),d(t)},onKeyDown:n=>{n.key==="Enter"&&(n.stopPropagation(),d(t))},children:e.jsx(h.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:n=>{n.stopPropagation(),a(t)},onKeyDown:n=>{n.key==="Enter"&&(n.stopPropagation(),a(t))},children:e.jsx(h.MdDeleteOutline,{color:"red",size:16})}),e.jsx(E.Tooltip,{title:o,placement:"right",arrow:!0,children:e.jsx("div",{className:"ff-ms-2",children:e.jsx(h.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsx("div",{style:{margin:"0 6px 12px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:r.length===0?e.jsx("span",{className:"ff-text-muted",children:"No conditions configured"}):r.map((n,i)=>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:n.field,children:n.field}),e.jsx("span",{className:"ff-text-muted",children:n.operator}),e.jsx("p",{className:"ff-text-dark ff-text-truncate ff-mx-1 ff-m-0",title:n.value,children:n.value}),i<r.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:n.logicalOperator})]},i))})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}}),x&&e.jsx(ee,{rail:x,cardWidth:350})]})},ne=({id:t,data:s})=>{const{onEditNode:d,onDeleteNode:a,nodeRegistry:r,nodeBody:o="full"}=w(),{title:x="Task",descriptorType:n,groupBlocks:i,groups:f,roles:y,groupId:g,roleId:j,infoText:p=""}=s,c=n?r==null?void 0:r.forType(n):void 0,N=c==null?void 0:c.icon,m=u=>u==null?"":typeof u=="string"?u:typeof u=="object"&&"label"in u?String(u.label):String(u),k=u=>Array.isArray(u)?u.map(m).filter(Boolean):u!=null&&u!==""?[m(u)]:[],b=(i==null?void 0:i.flatMap(u=>u.groups??[]))??[...k(f),...k(y),...k(g),...k(j)],P=b.length>0;return e.jsxs("div",{style:{width:350},children:[e.jsx(l.Handle,{type:"target",position:l.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:[N&&e.jsx("div",{style:{display:"flex",alignItems:"center"},children:N}),e.jsx("span",{className:"ff-text-dark",style:{fontSize:14,fontWeight:500},children:x})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:u=>{u.stopPropagation(),d(t)},onKeyDown:u=>{u.key==="Enter"&&(u.stopPropagation(),d(t))},children:e.jsx(h.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:u=>{u.stopPropagation(),a(t)},onKeyDown:u=>{u.key==="Enter"&&(u.stopPropagation(),a(t))},children:e.jsx(h.MdDeleteOutline,{color:"red",size:16})}),p&&e.jsx(E.Tooltip,{title:p,placement:"right",arrow:!0,children:e.jsx("div",{className:"ff-ms-2",children:e.jsx(h.MdInfoOutline,{color:"gray",size:16})})})]})]}),o!=="title-only"&&e.jsx("div",{style:{margin:"0 6px 12px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:c!=null&&c.renderNode?c.renderNode(s):P?e.jsx("div",{className:"ff-d-flex ff-flex-wrap ff-gap-1",children:b.map((u,T)=>e.jsx("span",{className:"ff-badge ff-bg-dark ff-text-white ff-py-1 ff-px-2 ff-rounded",style:{fontSize:11},title:u,children:u},T))}):e.jsx("span",{className:"ff-text-muted",children:"Not configured"})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},M=5,se=({id:t,data:s})=>{const{onEditNode:d,onDeleteNode:a}=w(),{approvalData:r,isPreview:o=!1,_branchRail:x}=s,n=(r==null?void 0:r.policy)??{},i=n.stages??[],f=i.length,y=i.slice(0,M),g=f-M,j=n.name??n.policyName??"Untitled Policy";return e.jsxs("div",{style:{width:350,position:"relative"},children:[e.jsx(l.Handle,{type:"target",position:l.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 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(h.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:p=>{p.stopPropagation(),d(t)},onKeyDown:p=>{p.key==="Enter"&&(p.stopPropagation(),d(t))},children:e.jsx(h.MdOutlineModeEdit,{size:16,className:"ff-text-secondary"})}),!o&&e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,style:{cursor:"pointer"},onClick:p=>{p.stopPropagation(),a(t)},onKeyDown:p=>{p.key==="Enter"&&(p.stopPropagation(),a(t))},children:e.jsx(h.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(h.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsxs("div",{style:{margin:"0 6px 12px",padding:"10px 12px",borderRadius:6,background:"#FCFCFC"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-start ff-align-items-center ff-mb-2",children:[e.jsx("h6",{className:"ff-text-dark ff-mb-0 ff-text-truncate ff-flex-grow-1 ff-me-2",style:{fontSize:13,fontWeight:700},title:j,children:j}),e.jsxs("span",{className:"ff-badge ff-rounded-pill ff-px-2 ff-py-1 ff-flex-shrink-0",style:{background:"#FFF9C4",color:"#616161",fontSize:11,fontWeight:600},children:[f," Stage",f!==1?"s":""]})]}),i.length>0?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[y.map((p,c)=>{var T,I,S;const N=((T=p.stageName)==null?void 0:T.trim())||`Stage ${c+1}`,m=Array.isArray(p.userIds)?p.userIds.length:0,k=((I=p.groupName)==null?void 0:I.trim())??"",b=((S=p.roleName)==null?void 0:S.trim())??"",P=m>0||k||b;let u="Not configured";return k?u=`Group: ${k}`:b?u=`Role: ${b}`:m>0&&(u=`${m} approver${m!==1?"s":""}`),e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{className:"ff-rounded-circle ff-d-flex ff-align-items-center ff-justify-content-center ff-flex-shrink-0",style:{width:28,height:28,background:"#FFF9C4",color:"#5D4037",fontSize:12,fontWeight:700},children:c+1}),e.jsxs("div",{className:"ff-flex-grow-1 ff-rounded ff-p-2 ff-d-flex ff-justify-content-between ff-align-items-center ff-border",style:{background:"#FFFDE7",borderColor:"#FEE79A"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:700,color:"#212121"},children:N}),e.jsxs("span",{className:`ff-d-flex ff-align-items-center ff-gap-1 ${P?"ff-text-dark":"ff-text-muted"}`,style:{fontSize:12},children:[e.jsx(h.MdPeople,{size:16,className:"ff-flex-shrink-0",style:{color:P?"#5D4037":"#9E9E9E"}}),u]})]})]},c)}),g>0&&e.jsxs("div",{className:"ff-text-center ff-fw-bold ff-py-2 ff-border ff-rounded",style:{fontSize:11,color:"#1976d2",borderColor:"#FEE79A",background:"#FFFDE7",borderStyle:"dashed",cursor:o?"default":"pointer"},role:o?void 0:"button",tabIndex:o?void 0:0,onClick:p=>{o||(p.stopPropagation(),d(t))},onKeyDown:p=>{o||p.key!=="Enter"||(p.stopPropagation(),d(t))},children:["+ ",g," More Stage",g>1?"s":""]})]}):e.jsx("div",{className:"ff-text-center ff-py-3 ff-rounded ff-border",style:{fontSize:12,color:"#9e9e9e",background:"#FFFDE7",borderColor:"#FEE79A",borderStyle:"dashed"},children:"No stages configured"})]})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}}),x&&e.jsx(ee,{rail:x,cardWidth:350})]})},ie=({id:t,data:s})=>{const{onEditNode:d,onDeleteNode:a}=w(),{duration:r,unit:o}=s,x=r!=null&&o,n=x?`Wait ${r} ${o}`:"Not configured";return e.jsxs("div",{style:{width:350},children:[e.jsx(l.Handle,{type:"target",position:l.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(h.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:i=>{i.stopPropagation(),d(t)},onKeyDown:i=>{i.key==="Enter"&&(i.stopPropagation(),d(t))},children:e.jsx(h.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:i=>{i.stopPropagation(),a(t)},onKeyDown:i=>{i.key==="Enter"&&(i.stopPropagation(),a(t))},children:e.jsx(h.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:x?"ff-text-dark ff-fw-medium":"ff-text-muted",children:n})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},W={email:{label:"Email",bg:"#e3f2fd",color:"#1565c0",iconType:h.MdEmail},slack:{label:"Slack",bg:"#e8f5e9",color:"#2e7d32",iconType:h.MdNotifications},teams:{label:"MS Teams",bg:"#ede7f6",color:"#4527a0",iconType:h.MdNotifications},sms:{label:"SMS",bg:"#fce4ec",color:"#880e4f",iconType:h.MdSms},"in-app":{label:"In-App",bg:"#fff3e0",color:"#e65100",iconType:h.MdNotifications},webhook:{label:"Webhook",bg:"#f3e5f5",color:"#6a1b9a",iconType:h.MdWebhook}},me={label:"Notification",bg:"rgba(156,39,176,0.1)",color:"#7b1fa2",iconType:h.MdNotifications};function je(t){var s;switch(t.channel){case"email":return((s=t.emailTo)==null?void 0:s.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 be(t){switch(t.channel){case"email":return t.emailSubject??t.subject??null;case"slack":{const s=t.slackMessage;return s?s.length>60?`${s.slice(0,60)}…`:s:null}case"in-app":return t.inAppTitle??null;default:return t.subject??null}}const oe=({id:t,data:s})=>{const{onEditNode:d,onDeleteNode:a}=w(),r=s,o=r.channel&&W[r.channel]?W[r.channel]:me,x=je(r),n=be(r),i=!!(r.channel&&x),f=o.iconType;return e.jsxs("div",{style:{width:C.NODE_WIDTH},children:[e.jsx(l.Handle,{type:"target",position:l.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(f,{size:16,color:o.color})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:r.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:y=>{y.stopPropagation(),d(t)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.stopPropagation(),d(t))},children:e.jsx(h.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:y=>{y.stopPropagation(),a(t)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.stopPropagation(),a(t))},children:e.jsx(h.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{style:{margin:"0 6px 12px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:i?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:x})]}),n&&e.jsx("span",{className:"ff-text-muted ff-text-truncate",style:{maxWidth:280},children:n})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured"})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},F={"api-key":"API Key",hmac:"HMAC"},le=({data:t})=>{const{onClickAddTrigger:s}=w(),{label:d="Webhook Trigger",endpointUrl:a,authMethod:r,source:o}=t,x=i=>{i.stopPropagation(),s()},n=i=>{i.stopPropagation(),a&&navigator.clipboard.writeText(a).catch(()=>{})};return e.jsxs("div",{style:{width:C.NODE_WIDTH},children:[e.jsx(l.Handle,{type:"target",position:l.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(h.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:x,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&x(i)},className:"ff-d-flex ff-align-items-center",style:{paddingRight:4,cursor:"pointer"},children:e.jsx(h.MdOutlineModeEdit,{size:16,color:"#555"})})]}),e.jsxs("div",{style:{margin:"0 6px 12px",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:d}),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}),r&&r!=="none"&&F[r]&&e.jsx("span",{className:"ff-px-2 ff-py-1 ff-rounded",style:{fontSize:10,background:"#1565c0",color:"#fff",fontWeight:600},children:F[r]})]}),a&&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:a}),e.jsx(E.Tooltip,{title:"Copy URL",placement:"top",arrow:!0,children:e.jsx("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&n(i)},style:{cursor:"pointer",flexShrink:0},children:e.jsx(h.MdContentCopy,{size:12,color:"#1565c0"})})})]})]})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},re=({id:t,data:s})=>{var j;const{onEditNode:d,onDeleteNode:a,nodeRegistry:r}=w(),{method:o,url:x,descriptorType:n}=s,i=n?(j=r==null?void 0:r.forType(n))==null?void 0:j.icon:e.jsx(h.MdHttp,{size:16,color:"#546e7a"}),f=!!(o&&x),y=(o==null?void 0:o.toUpperCase())??"",g=C.HTTP_METHOD_STYLE[y]??null;return e.jsxs("div",{style:{width:C.NODE_WIDTH},children:[e.jsx(l.Handle,{type:"target",position:l.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:i}),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:p=>{p.stopPropagation(),d(t)},onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.stopPropagation(),d(t))},children:e.jsx(h.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:p=>{p.stopPropagation(),a(t)},onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.stopPropagation(),a(t))},children:e.jsx(h.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{style:{margin:"0 6px 12px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:f?e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[g&&e.jsx("span",{style:{fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:4,background:g.bg,color:g.color,flexShrink:0},children:y}),e.jsx("span",{className:"ff-text-dark ff-text-truncate",style:{fontFamily:"monospace",fontSize:11},title:x,children:x})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured"})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},Ne={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:s})=>{const{onEditNode:d,onDeleteNode:a}=w(),{title:r="Condition Branch",branchConfigs:o=[],defaultBranch:x}=s,n=o.length>0;return e.jsxs("div",{style:{width:C.NODE_WIDTH},children:[e.jsx(l.Handle,{type:"target",position:l.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(h.MdCallSplit,{size:16,color:"#512da8"})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:r})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:i=>{i.stopPropagation(),d(t)},onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.stopPropagation(),d(t))},children:e.jsx(h.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:i=>{i.stopPropagation(),a(t)},onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.stopPropagation(),a(t))},children:e.jsx(h.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{style:{margin:"0 6px 12px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:n?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[o.map((i,f)=>{var p,c;const y=C.BRANCH_PALETTE[f%C.BRANCH_PALETTE.length],g=(p=i.conditions)==null?void 0:p[0],j=(((c=i.conditions)==null?void 0:c.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:y.bg,color:y.color,flexShrink:0},children:i.label||i.key}),g?e.jsxs("span",{style:{fontSize:11,color:"#616161",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[g.field," ",Ne[g.operator]??g.operator,g.value?` ${g.value}`:"",j>0?` +${j} more`:""]}):e.jsx("span",{style:{fontSize:11,color:"#9e9e9e"},children:"No conditions yet"})]},i.key)}),x&&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(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},ve=({id:t,data:s})=>{var p;const{onEditNode:d,onDeleteNode:a,nodeRegistry:r}=w(),{title:o="Sub-Workflow",workflowId:x,workflowLabel:n,descriptorType:i,onPreview:f}=s,y=i?(p=r==null?void 0:r.forType(i))==null?void 0:p.icon:e.jsx(h.MdAccountTree,{size:16,color:"#00695c"}),g=!!x,j=c=>{c.stopPropagation(),x&&f&&f(x)};return e.jsxs("div",{style:{width:C.NODE_WIDTH},children:[e.jsx(l.Handle,{type:"target",position:l.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:y}),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:c=>{c.stopPropagation(),d(t)},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.stopPropagation(),d(t))},children:e.jsx(h.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:c=>{c.stopPropagation(),a(t)},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.stopPropagation(),a(t))},children:e.jsx(h.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{style:{margin:"0 6px 12px",padding:"10px 12px",borderRadius:6,background:g?"#e0f2f1":"#fafafa",fontSize:12,border:g?"1px solid #b2dfdb":"none"},children:g?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:n||x}),e.jsxs("span",{style:{fontSize:10,color:"#80cbc4",fontFamily:"monospace"},children:["ID: ",x]})]}),f&&e.jsxs("div",{role:"button",tabIndex:0,onClick:j,onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&j(c)},style:{cursor:"pointer",display:"flex",alignItems:"center",gap:3,fontSize:11,color:"#00897b"},children:[e.jsx(h.MdOpenInNew,{size:13}),"Preview"]})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured — select a workflow"})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},we={startNode:Y,endNode:J,addTriggerNode:Q,addStepNode:pe,triggerNode:X,eventNode:ue,filterNode:te,actionNode:ne,approvalNode:se,delayNode:ie,notificationNode:oe,webhookTriggerNode:le,restApiNode:re,conditionBranchNode:ke,subWorkflowNode:ve},Se=11.5,H=2,D=6,$=40,O=20,B=4,Ee=({id:t,sourceX:s,sourceY:d,targetX:a,targetY:r,sourcePosition:o,targetPosition:x,source:n,target:i,data:f})=>{const[y,g,j]=l.getStraightPath({sourceX:s,sourceY:d,targetX:a,targetY:r}),p=f==null?void 0:f.label,c=p==="Pass",N=c||p==="Fail",m=s+(a-s)/3,k=d+(r-d)/3,b=s+2*(a-s)/3,P=d+2*(r-d)/3,u=f==null?void 0:f.onAddStepClick,T=z=>{if(z.stopPropagation(),typeof u!="function")return;const de={edgeId:t,nodeId:n,sourceNodeId:n,targetNodeId:i,position:"between",referenceNodeId:n,referenceNodeType:f==null?void 0:f.referenceNodeType,stepVisibility:f==null?void 0:f.stepVisibility};u(n,de)},I=z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),T(z))},S=()=>e.jsxs(e.Fragment,{children:[e.jsxs("g",{className:"plus-icon-container",children:[e.jsx("circle",{r:Se,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-D,x2:0,y2:D,strokeWidth:H,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-D,y1:0,x2:D,y2:0,strokeWidth:H,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"})]})]}),v=u?{onClick:T,onKeyDown:I,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(l.BaseEdge,{id:t,path:y}),N?e.jsxs(e.Fragment,{children:[e.jsxs("g",{transform:`translate(${m}, ${k})`,children:[e.jsx("rect",{x:-$/2,y:-O/2,width:$,height:O,rx:B,ry:B,fill:c?"#ADE6C5":"#FDBFBF"}),e.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fill:c?"#1DBF60":"#C50000",style:{fontSize:12,fontWeight:500},children:p})]}),e.jsx("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${b}, ${P})`,"data-testid":"plus-node-icon",...v,children:e.jsx(S,{})})]}):e.jsx("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${g}, ${j})`,"data-testid":"plus-node-icon",...v,children:e.jsx(S,{})})]})},Te=11.5,_=2,A=6,Pe=({id:t,sourceX:s,sourceY:d,targetX:a,targetY:r,source:o,target:x,data:n})=>{const[i,f,y]=l.getStraightPath({sourceX:s,sourceY:d,targetX:a,targetY:r}),g=n==null?void 0:n.onAddStepClick,j=c=>{c.stopPropagation(),typeof g=="function"&&g(o,{edgeId:t,nodeId:o,sourceNodeId:o,targetNodeId:x,position:"between",referenceNodeId:o,referenceNodeType:n==null?void 0:n.referenceNodeType,stepVisibility:n==null?void 0:n.stepVisibility,filterId:n==null?void 0:n.filterId,branch:n==null?void 0:n.branch})},p=c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),j(c))};return e.jsxs("g",{className:"edge-with-plus-wrapper",children:[e.jsx(l.BaseEdge,{id:t,path:i,style:{stroke:"#b0bec5"}}),e.jsxs("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${f}, ${y})`,style:{cursor:g?"pointer":"default",pointerEvents:"all",outline:"none"},onClick:g?j:void 0,onKeyDown:g?p:void 0,role:g?"button":void 0,tabIndex:g?0:void 0,"data-testid":"plus-node-icon",children:[e.jsx("circle",{r:Te,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-A,x2:0,y2:A,strokeWidth:_,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-A,y1:0,x2:A,y2:0,strokeWidth:_,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"})]})]})]})},Ce=({id:t,sourceX:s,sourceY:d,targetX:a,targetY:r})=>{const[o]=l.getStraightPath({sourceX:s,sourceY:d,targetX:a,targetY:r});return e.jsx(l.BaseEdge,{id:t,path:o,style:{stroke:"#b0bec5"}})},Ie=11.5,K=2,R=6,ze=-24,U=40,q=20,G=4,De=({id:t,sourceX:s,sourceY:d,targetX:a,targetY:r,source:o,target:x,data:n})=>{const[i,f,y]=l.getStraightPath({sourceX:s,sourceY:d,targetX:a,targetY:r}),g=n==null?void 0:n.label,j=g==="Pass",p=j||g==="Fail",c=n==null?void 0:n.onAddStepClick,N=(n==null?void 0:n.showPlus)!==!1&&!!c,m=b=>{b.stopPropagation(),typeof c=="function"&&c(o,{edgeId:t,nodeId:o,sourceNodeId:o,targetNodeId:x,position:"between",referenceNodeId:o,referenceNodeType:n==null?void 0:n.referenceNodeType,stepVisibility:n==null?void 0:n.stepVisibility})},k=b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),m(b))};return e.jsxs("g",{className:"edge-with-plus-wrapper",children:[e.jsx(l.BaseEdge,{id:t,path:i,style:{stroke:"#b0bec5"}}),e.jsxs("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${f}, ${y})`,style:{cursor:c?"pointer":"default",pointerEvents:"all",outline:"none"},onClick:c?m:void 0,onKeyDown:c?k:void 0,role:c?"button":void 0,tabIndex:c?0:void 0,children:[p&&e.jsxs("g",{transform:`translate(0, ${N?ze:0})`,children:[e.jsx("rect",{x:-U/2,y:-q/2,width:U,height:q,rx:G,ry:G,fill:j?"#ADE6C5":"#FDBFBF"}),e.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fill:j?"#1DBF60":"#C50000",style:{fontSize:12,fontWeight:500},children:g})]}),N&&e.jsxs("g",{className:"plus-icon-container",children:[e.jsx("circle",{r:Ie,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-R,x2:0,y2:R,strokeWidth:K,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-R,y1:0,x2:R,y2:0,strokeWidth:K,strokeLinecap:"round",className:"plus-line"})]}),N&&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"})]})]})]})},Ae=({id:t,source:s,target:d,sourceX:a,sourceY:r,targetX:o,targetY:x,style:n={},markerEnd:i,data:f})=>{const y=(f==null?void 0:f.verticalRouting)??!1,g=30,j=y?(()=>{const v=x-g;return`M ${a},${v} L ${o},${v} L ${o},${x}`})():(()=>{const v=r+30;return`M ${a},${r} L ${a},${v} L ${o},${v} L ${o},${x}`})(),p=n.stroke||"#d1d5db",c=f==null?void 0:f.label,N=(f==null?void 0:f.isFirst)??!1,m=f==null?void 0:f.onAddStepClick,k=y?x-g:r+30,b=a+(o-a)*(y?.25:.35),P=a+(o-a)*(y?.65:.7),u=k,T=v=>{v.stopPropagation(),m&&m(s,{edgeId:t,nodeId:s,sourceNodeId:s,targetNodeId:d,position:"between",referenceNodeId:s,filterId:f==null?void 0:f.filterId,branch:f==null?void 0:f.branch})},I=11.5,S=6;return e.jsxs("g",{children:[e.jsx("path",{id:t,d:j,fill:"none",stroke:p,strokeWidth:1.5,markerEnd:i}),c&&!y&&e.jsx("g",{transform:`translate(${b}, ${u})`,children:(()=>{const v=Math.max(44,c.length*7+20);return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:-v/2,y:-11,width:v,height:22,rx:11,fill:N?"#e8f5e9":"#ffebee",stroke:N?"#81c784":"#e57373",strokeWidth:1}),e.jsx("text",{x:0,y:4,textAnchor:"middle",fontSize:10,fontWeight:600,fill:N?"#2e7d32":"#c62828",style:{fontFamily:"sans-serif",pointerEvents:"none"},children:c})]})})()}),m&&e.jsxs("g",{transform:`translate(${P}, ${u})`,onClick:T,style:{cursor:"pointer",pointerEvents:"all"},className:"nodrag nopan edge-plus-svg",children:[e.jsx("circle",{r:I,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-S,x2:0,y2:S,strokeWidth:2,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-S,y1:0,x2:S,y2:0,strokeWidth:2,strokeLinecap:"round",className:"plus-line"})]})]})};exports.ActionNode=ne;exports.AddTriggerNode=Q;exports.ApprovalNode=se;exports.DelayNode=ie;exports.EdgeWithPlusLabel=Ee;exports.EndNode=J;exports.FilterNode=te;exports.GatewayBranchEdge=Ae;exports.LabelPlusEdge=De;exports.NotificationNode=oe;exports.PlainEdge=Ce;exports.PlusEdge=Pe;exports.RestApiNode=re;exports.StartNode=Y;exports.TriggerNode=X;exports.WebhookTriggerNode=le;exports.WorkflowCanvasContext=Z;exports.builtInNodeTypes=we;
1
+ "use strict";const e=require("react/jsx-runtime"),l=require("reactflow"),E=require("@mui/material"),ce=require("react-icons/gr"),V=require("react"),fe=require("./messages-O9Tw_XXR.js"),h=require("react-icons/md"),L=require("react-icons/fa"),ae=require("react-icons/fi"),C=require("./canvasTokens-gKNYrPl4.js"),Z=V.createContext({onEditNode:()=>{},onDeleteNode:()=>{},onAddStep:()=>{},onClickAddTrigger:()=>{},messages:fe.defaultFlowForgeMessages,nodeRegistry:null,nodeBody:"full"}),w=()=>V.useContext(Z),Y=()=>e.jsxs("div",{style:{width:350,display:"flex",justifyContent:"center"},children:[e.jsx(l.Handle,{type:"source",position:l.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"})]}),J=()=>e.jsxs("div",{style:{width:350,display:"flex",justifyContent:"center"},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,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:"End"})]}),Q=()=>{const{onClickAddTrigger:t,messages:s}=w();return e.jsxs("div",{style:{width:350,display:"flex",justifyContent:"center"},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0,left:"50%"}}),e.jsx(E.Tooltip,{title:s.addTriggerTooltip,placement:"top",arrow:!0,children:e.jsxs("div",{onClick:t,role:"button",tabIndex:0,onKeyDown:d=>{d.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(ce.GrTrigger,{size:16}),e.jsx("span",{className:"ff-text-black",style:{fontSize:13},"data-testid":"add-trigger-btn-text",children:s.addTriggerButton})]})}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0,left:"50%"}})]})},pe=({id:t})=>{const{onAddStep:s}=w();return e.jsxs("div",{onClick:()=>s(t),role:"button",tabIndex:0,onKeyDown:d=>{d.key==="Enter"&&s(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(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0}}),"+",e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})};function xe(t){return t?t==="END_USER_CREATION"?"New User Registration":t==="END_USER_UPDATION"?"On User Update":t.replace(/[_-]+/g," ").replace(/\b\w/g,s=>s.toUpperCase()):""}function ge(t){const s=typeof t=="string"?t:t.value??"";return s==="SIGNUP_FLOW"?"User Self-Registration":s==="ADMIN_CREATION_FLOW"?"Create User via Admin Portal":s==="SHEDULAR"?"Scheduler":typeof t!="string"&&t.label?t.label:s.replace(/[_-]+/g," ").replace(/\b\w/g,d=>d.toUpperCase())}const X=({data:t})=>{const{onClickAddTrigger:s}=w(),{type:d,eventType:a,sources:r,label:o,source:x,previewWorkflow:n,executionStatus:i,infoText:f="This node decides the flow trigger type and configuration."}=t??{},y=m=>{m==null||m.stopPropagation(),s()},g=Array.isArray(r)&&r.length>0,j=!!(o||x),p=d==="scheduler"?"Scheduler Trigger":d==="event"||g||j?"Event Trigger Source":"Select Trigger",c=d==="scheduler"?e.jsx("span",{children:"Scheduler to be configured"}):d==="event"||g?e.jsxs("div",{children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[e.jsx("span",{style:{fontWeight:600},children:xe(a)}),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:g?r.map((m,k)=>e.jsx(E.Chip,{label:ge(m),variant:"outlined",size:"small",className:"ff-text-dark"},k)):e.jsx("span",{className:"ff-text-muted",style:{fontSize:12},children:"No source selected"})})]}):j?e.jsxs("div",{className:"ff-d-flex ff-flex-wrap ff-align-items-center",style:{gap:6},children:[o&&e.jsx("span",{style:{fontWeight:600},children:o}),x&&e.jsx(E.Chip,{label:x,variant:"outlined",size:"small"})]}):e.jsx("span",{role:"button",tabIndex:0,onClick:y,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&y(m)},style:{cursor:"pointer",color:"#1e88e5"},children:"Click to select a trigger to start your workflow"}),N=i?e.jsxs(e.Fragment,{children:[i.status==="success"&&e.jsx(L.FaCheckCircle,{size:16,color:"#1DBF60",style:{marginRight:8}}),i.status==="failed"&&e.jsx(L.FaTimesCircle,{size:16,color:"#f44336",style:{marginRight:8}})]}):e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[!n&&e.jsx("div",{role:"button",tabIndex:0,onClick:y,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&y(m)},className:"ff-me-2",style:{cursor:"pointer",color:"#212121"},"aria-label":"Edit trigger",children:e.jsx(h.MdOutlineModeEdit,{size:16})}),e.jsx(E.Tooltip,{title:e.jsx("div",{children:f}),placement:"right",arrow:!0,children:e.jsx("span",{children:e.jsx(h.MdInfoOutline,{color:"gray",size:16})})})]});return e.jsxs("div",{style:{width:350},children:[e.jsx(l.Handle,{type:"target",position:l.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:"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(76,175,80,0.1)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(h.MdInput,{size:16,color:"#388e3c"})}),e.jsx("span",{style:{fontSize:14,fontWeight:500,color:"#212121"},children:p})]}),e.jsx("div",{className:"ff-d-flex ff-align-items-center",children:N})]}),e.jsx("div",{style:{background:"#f5f5f5",fontSize:12,color:"#212121",padding:"10px 6px",margin:"0 6px 10px",borderRadius:6},children:c})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0},id:"1"})]})};function he(t){return t?t==="END_USER_CREATION"?"New User Registration":t==="END_USER_UPDATION"?"On User Update":t.replace(/[_-]+/g," ").replace(/\b\w/g,s=>s.toUpperCase()):""}function ye(t){const s=typeof t=="string"?t:t.value??"";return s==="SIGNUP_FLOW"?"User Self-Registration":s==="ADMIN_CREATION_FLOW"?"Create User via Admin Portal":s==="SHEDULAR"||s==="SCHEDULER"?"Scheduler":typeof t!="string"&&t.label?t.label:s.replace(/[_-]+/g," ").replace(/\b\w/g,d=>d.toUpperCase())}const ue=({data:t})=>{const{header:s="Event",title:d,eventType:a,sources:r,executionStatus:o,infoText:x="This event is raised by the system. It cannot be configured."}=t??{},n=d??he(a)??"—";return e.jsxs("div",{style:{width:350},children:[e.jsx(l.Handle,{type:"target",position:l.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:"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(76,175,80,0.1)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(h.MdInput,{size:16,color:"#388e3c"})}),e.jsx("span",{style:{fontSize:14,fontWeight:500,color:"#212121"},children:s})]}),e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[(o==null?void 0:o.status)==="success"&&e.jsx(L.FaCheckCircle,{size:16,color:"#1DBF60",style:{marginRight:8}}),(o==null?void 0:o.status)==="failed"&&e.jsx(L.FaTimesCircle,{size:16,color:"#f44336",style:{marginRight:8}}),!o&&e.jsx(E.Tooltip,{title:e.jsx("div",{children:x}),placement:"right",arrow:!0,children:e.jsx("span",{children:e.jsx(h.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsxs("div",{style:{background:"#f5f5f5",fontSize:13,color:"#212121",padding:"10px 12px",margin:"0 6px 10px",borderRadius:6},children:[e.jsx("div",{style:{fontWeight:600},children:n}),Array.isArray(r)&&r.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:r.map((i,f)=>e.jsx(E.Chip,{label:ye(i),variant:"outlined",size:"small",className:"ff-text-dark"},f))})]})]})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0},id:"1"})]})},ee=({rail:t,cardWidth:s})=>{const d=s/2;s/2+t.indent;const a="var(--ff-edge-color, #b0bec5)";return e.jsxs("svg",{width:s+t.indent+200,height:t.height,style:{position:"absolute",left:0,top:"100%",pointerEvents:"none",overflow:"visible"},children:[e.jsx("line",{x1:d,y1:0,x2:d,y2:t.height,stroke:a,strokeWidth:1.5}),t.branches.map((r,o)=>{const x=r.y;return e.jsxs("g",{transform:`translate(0, ${x})`,children:[e.jsx("rect",{x:d-5,y:-5,width:10,height:10,fill:"#fff",stroke:a,strokeWidth:1.5,transform:`rotate(45, ${d}, 0)`}),e.jsx("text",{x:d+14,y:4,fontSize:12,fontWeight:500,fill:"var(--ff-text, #212121)",style:{fontFamily:"sans-serif"},children:r.label})]},o)})]})},te=({id:t,data:s})=>{const{onEditNode:d,onDeleteNode:a}=w(),{conditions:r=[],infoText:o="Filter conditions applied to workflow data",_branchRail:x}=s;return e.jsxs("div",{style:{width:350,position:"relative"},children:[e.jsx(l.Handle,{type:"target",position:l.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(ae.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:n=>{n.stopPropagation(),d(t)},onKeyDown:n=>{n.key==="Enter"&&(n.stopPropagation(),d(t))},children:e.jsx(h.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:n=>{n.stopPropagation(),a(t)},onKeyDown:n=>{n.key==="Enter"&&(n.stopPropagation(),a(t))},children:e.jsx(h.MdDeleteOutline,{color:"red",size:16})}),e.jsx(E.Tooltip,{title:o,placement:"right",arrow:!0,children:e.jsx("div",{className:"ff-ms-2",children:e.jsx(h.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsx("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:r.length===0?e.jsx("span",{className:"ff-text-muted",children:"No conditions configured"}):r.map((n,i)=>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:n.field,children:n.field}),e.jsx("span",{className:"ff-text-muted",children:n.operator}),e.jsx("p",{className:"ff-text-dark ff-text-truncate ff-mx-1 ff-m-0",title:n.value,children:n.value}),i<r.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:n.logicalOperator})]},i))})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}}),x&&e.jsx(ee,{rail:x,cardWidth:350})]})},ne=({id:t,data:s})=>{const{onEditNode:d,onDeleteNode:a,nodeRegistry:r,nodeBody:o="full"}=w(),{title:x="Task",descriptorType:n,groupBlocks:i,groups:f,roles:y,groupId:g,roleId:j,infoText:p=""}=s,c=n?r==null?void 0:r.forType(n):void 0,N=c==null?void 0:c.icon,m=u=>u==null?"":typeof u=="string"?u:typeof u=="object"&&"label"in u?String(u.label):String(u),k=u=>Array.isArray(u)?u.map(m).filter(Boolean):u!=null&&u!==""?[m(u)]:[],b=(i==null?void 0:i.flatMap(u=>u.groups??[]))??[...k(f),...k(y),...k(g),...k(j)],P=b.length>0;return e.jsxs("div",{style:{width:350},children:[e.jsx(l.Handle,{type:"target",position:l.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:[N&&e.jsx("div",{style:{display:"flex",alignItems:"center"},children:N}),e.jsx("span",{className:"ff-text-dark",style:{fontSize:14,fontWeight:500},children:x})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:u=>{u.stopPropagation(),d(t)},onKeyDown:u=>{u.key==="Enter"&&(u.stopPropagation(),d(t))},children:e.jsx(h.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:u=>{u.stopPropagation(),a(t)},onKeyDown:u=>{u.key==="Enter"&&(u.stopPropagation(),a(t))},children:e.jsx(h.MdDeleteOutline,{color:"red",size:16})}),p&&e.jsx(E.Tooltip,{title:p,placement:"right",arrow:!0,children:e.jsx("div",{className:"ff-ms-2",children:e.jsx(h.MdInfoOutline,{color:"gray",size:16})})})]})]}),o!=="title-only"&&e.jsx("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:c!=null&&c.renderNode?c.renderNode(s):P?e.jsx("div",{className:"ff-d-flex ff-flex-wrap ff-gap-1",children:b.map((u,T)=>e.jsx("span",{className:"ff-badge ff-bg-dark ff-text-white ff-py-1 ff-px-2 ff-rounded",style:{fontSize:11},title:u,children:u},T))}):e.jsx("span",{className:"ff-text-muted",children:"Not configured"})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},M=5,se=({id:t,data:s})=>{const{onEditNode:d,onDeleteNode:a}=w(),{approvalData:r,isPreview:o=!1,_branchRail:x}=s,n=(r==null?void 0:r.policy)??{},i=n.stages??[],f=i.length,y=i.slice(0,M),g=f-M,j=n.name??n.policyName??"Untitled Policy";return e.jsxs("div",{style:{width:350,position:"relative"},children:[e.jsx(l.Handle,{type:"target",position:l.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 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(h.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:p=>{p.stopPropagation(),d(t)},onKeyDown:p=>{p.key==="Enter"&&(p.stopPropagation(),d(t))},children:e.jsx(h.MdOutlineModeEdit,{size:16,className:"ff-text-secondary"})}),!o&&e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,style:{cursor:"pointer"},onClick:p=>{p.stopPropagation(),a(t)},onKeyDown:p=>{p.key==="Enter"&&(p.stopPropagation(),a(t))},children:e.jsx(h.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(h.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsxs("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:"#FCFCFC"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-start ff-align-items-center ff-mb-2",children:[e.jsx("h6",{className:"ff-text-dark ff-mb-0 ff-text-truncate ff-flex-grow-1 ff-me-2",style:{fontSize:13,fontWeight:700},title:j,children:j}),e.jsxs("span",{className:"ff-badge ff-rounded-pill ff-px-2 ff-py-1 ff-flex-shrink-0",style:{background:"#FFF9C4",color:"#616161",fontSize:11,fontWeight:600},children:[f," Stage",f!==1?"s":""]})]}),i.length>0?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[y.map((p,c)=>{var T,I,S;const N=((T=p.stageName)==null?void 0:T.trim())||`Stage ${c+1}`,m=Array.isArray(p.userIds)?p.userIds.length:0,k=((I=p.groupName)==null?void 0:I.trim())??"",b=((S=p.roleName)==null?void 0:S.trim())??"",P=m>0||k||b;let u="Not configured";return k?u=`Group: ${k}`:b?u=`Role: ${b}`:m>0&&(u=`${m} approver${m!==1?"s":""}`),e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{className:"ff-rounded-circle ff-d-flex ff-align-items-center ff-justify-content-center ff-flex-shrink-0",style:{width:28,height:28,background:"#FFF9C4",color:"#5D4037",fontSize:12,fontWeight:700},children:c+1}),e.jsxs("div",{className:"ff-flex-grow-1 ff-rounded ff-p-2 ff-d-flex ff-justify-content-between ff-align-items-center ff-border",style:{background:"#FFFDE7",borderColor:"#FEE79A"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:700,color:"#212121"},children:N}),e.jsxs("span",{className:`ff-d-flex ff-align-items-center ff-gap-1 ${P?"ff-text-dark":"ff-text-muted"}`,style:{fontSize:12},children:[e.jsx(h.MdPeople,{size:16,className:"ff-flex-shrink-0",style:{color:P?"#5D4037":"#9E9E9E"}}),u]})]})]},c)}),g>0&&e.jsxs("div",{className:"ff-text-center ff-fw-bold ff-py-2 ff-border ff-rounded",style:{fontSize:11,color:"#1976d2",borderColor:"#FEE79A",background:"#FFFDE7",borderStyle:"dashed",cursor:o?"default":"pointer"},role:o?void 0:"button",tabIndex:o?void 0:0,onClick:p=>{o||(p.stopPropagation(),d(t))},onKeyDown:p=>{o||p.key!=="Enter"||(p.stopPropagation(),d(t))},children:["+ ",g," More Stage",g>1?"s":""]})]}):e.jsx("div",{className:"ff-text-center ff-py-3 ff-rounded ff-border",style:{fontSize:12,color:"#9e9e9e",background:"#FFFDE7",borderColor:"#FEE79A",borderStyle:"dashed"},children:"No stages configured"})]})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}}),x&&e.jsx(ee,{rail:x,cardWidth:350})]})},ie=({id:t,data:s})=>{const{onEditNode:d,onDeleteNode:a}=w(),{duration:r,unit:o}=s,x=r!=null&&o,n=x?`Wait ${r} ${o}`:"Not configured";return e.jsxs("div",{style:{width:350},children:[e.jsx(l.Handle,{type:"target",position:l.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(h.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:i=>{i.stopPropagation(),d(t)},onKeyDown:i=>{i.key==="Enter"&&(i.stopPropagation(),d(t))},children:e.jsx(h.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:i=>{i.stopPropagation(),a(t)},onKeyDown:i=>{i.key==="Enter"&&(i.stopPropagation(),a(t))},children:e.jsx(h.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:x?"ff-text-dark ff-fw-medium":"ff-text-muted",children:n})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},W={email:{label:"Email",bg:"#e3f2fd",color:"#1565c0",iconType:h.MdEmail},slack:{label:"Slack",bg:"#e8f5e9",color:"#2e7d32",iconType:h.MdNotifications},teams:{label:"MS Teams",bg:"#ede7f6",color:"#4527a0",iconType:h.MdNotifications},sms:{label:"SMS",bg:"#fce4ec",color:"#880e4f",iconType:h.MdSms},"in-app":{label:"In-App",bg:"#fff3e0",color:"#e65100",iconType:h.MdNotifications},webhook:{label:"Webhook",bg:"#f3e5f5",color:"#6a1b9a",iconType:h.MdWebhook}},me={label:"Notification",bg:"rgba(156,39,176,0.1)",color:"#7b1fa2",iconType:h.MdNotifications};function je(t){var s;switch(t.channel){case"email":return((s=t.emailTo)==null?void 0:s.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 be(t){switch(t.channel){case"email":return t.emailSubject??t.subject??null;case"slack":{const s=t.slackMessage;return s?s.length>60?`${s.slice(0,60)}…`:s:null}case"in-app":return t.inAppTitle??null;default:return t.subject??null}}const oe=({id:t,data:s})=>{const{onEditNode:d,onDeleteNode:a}=w(),r=s,o=r.channel&&W[r.channel]?W[r.channel]:me,x=je(r),n=be(r),i=!!(r.channel&&x),f=o.iconType;return e.jsxs("div",{style:{width:C.NODE_WIDTH},children:[e.jsx(l.Handle,{type:"target",position:l.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(f,{size:16,color:o.color})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:r.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:y=>{y.stopPropagation(),d(t)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.stopPropagation(),d(t))},children:e.jsx(h.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:y=>{y.stopPropagation(),a(t)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.stopPropagation(),a(t))},children:e.jsx(h.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:i?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:x})]}),n&&e.jsx("span",{className:"ff-text-muted ff-text-truncate",style:{maxWidth:280},children:n})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured"})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},F={"api-key":"API Key",hmac:"HMAC"},le=({data:t})=>{const{onClickAddTrigger:s}=w(),{label:d="Webhook Trigger",endpointUrl:a,authMethod:r,source:o}=t,x=i=>{i.stopPropagation(),s()},n=i=>{i.stopPropagation(),a&&navigator.clipboard.writeText(a).catch(()=>{})};return e.jsxs("div",{style:{width:C.NODE_WIDTH},children:[e.jsx(l.Handle,{type:"target",position:l.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(h.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:x,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&x(i)},className:"ff-d-flex ff-align-items-center",style:{paddingRight:4,cursor:"pointer"},children:e.jsx(h.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:d}),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}),r&&r!=="none"&&F[r]&&e.jsx("span",{className:"ff-px-2 ff-py-1 ff-rounded",style:{fontSize:10,background:"#1565c0",color:"#fff",fontWeight:600},children:F[r]})]}),a&&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:a}),e.jsx(E.Tooltip,{title:"Copy URL",placement:"top",arrow:!0,children:e.jsx("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&n(i)},style:{cursor:"pointer",flexShrink:0},children:e.jsx(h.MdContentCopy,{size:12,color:"#1565c0"})})})]})]})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},re=({id:t,data:s})=>{var j;const{onEditNode:d,onDeleteNode:a,nodeRegistry:r}=w(),{method:o,url:x,descriptorType:n}=s,i=n?(j=r==null?void 0:r.forType(n))==null?void 0:j.icon:e.jsx(h.MdHttp,{size:16,color:"#546e7a"}),f=!!(o&&x),y=(o==null?void 0:o.toUpperCase())??"",g=C.HTTP_METHOD_STYLE[y]??null;return e.jsxs("div",{style:{width:C.NODE_WIDTH},children:[e.jsx(l.Handle,{type:"target",position:l.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:i}),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:p=>{p.stopPropagation(),d(t)},onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.stopPropagation(),d(t))},children:e.jsx(h.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:p=>{p.stopPropagation(),a(t)},onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.stopPropagation(),a(t))},children:e.jsx(h.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:f?e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[g&&e.jsx("span",{style:{fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:4,background:g.bg,color:g.color,flexShrink:0},children:y}),e.jsx("span",{className:"ff-text-dark ff-text-truncate",style:{fontFamily:"monospace",fontSize:11},title:x,children:x})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured"})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},Ne={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:s})=>{const{onEditNode:d,onDeleteNode:a}=w(),{title:r="Condition Branch",branchConfigs:o=[],defaultBranch:x}=s,n=o.length>0;return e.jsxs("div",{style:{width:C.NODE_WIDTH},children:[e.jsx(l.Handle,{type:"target",position:l.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(h.MdCallSplit,{size:16,color:"#512da8"})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:r})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:i=>{i.stopPropagation(),d(t)},onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.stopPropagation(),d(t))},children:e.jsx(h.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:i=>{i.stopPropagation(),a(t)},onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.stopPropagation(),a(t))},children:e.jsx(h.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:"#fafafa",fontSize:12},children:n?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[o.map((i,f)=>{var p,c;const y=C.BRANCH_PALETTE[f%C.BRANCH_PALETTE.length],g=(p=i.conditions)==null?void 0:p[0],j=(((c=i.conditions)==null?void 0:c.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:y.bg,color:y.color,flexShrink:0},children:i.label||i.key}),g?e.jsxs("span",{style:{fontSize:11,color:"#616161",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[g.field," ",Ne[g.operator]??g.operator,g.value?` ${g.value}`:"",j>0?` +${j} more`:""]}):e.jsx("span",{style:{fontSize:11,color:"#9e9e9e"},children:"No conditions yet"})]},i.key)}),x&&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(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},ve=({id:t,data:s})=>{var p;const{onEditNode:d,onDeleteNode:a,nodeRegistry:r}=w(),{title:o="Sub-Workflow",workflowId:x,workflowLabel:n,descriptorType:i,onPreview:f}=s,y=i?(p=r==null?void 0:r.forType(i))==null?void 0:p.icon:e.jsx(h.MdAccountTree,{size:16,color:"#00695c"}),g=!!x,j=c=>{c.stopPropagation(),x&&f&&f(x)};return e.jsxs("div",{style:{width:C.NODE_WIDTH},children:[e.jsx(l.Handle,{type:"target",position:l.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:y}),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:c=>{c.stopPropagation(),d(t)},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.stopPropagation(),d(t))},children:e.jsx(h.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:c=>{c.stopPropagation(),a(t)},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.stopPropagation(),a(t))},children:e.jsx(h.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{style:{margin:"0 6px 10px",padding:"10px 12px",borderRadius:6,background:g?"#e0f2f1":"#fafafa",fontSize:12,border:g?"1px solid #b2dfdb":"none"},children:g?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:n||x}),e.jsxs("span",{style:{fontSize:10,color:"#80cbc4",fontFamily:"monospace"},children:["ID: ",x]})]}),f&&e.jsxs("div",{role:"button",tabIndex:0,onClick:j,onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&j(c)},style:{cursor:"pointer",display:"flex",alignItems:"center",gap:3,fontSize:11,color:"#00897b"},children:[e.jsx(h.MdOpenInNew,{size:13}),"Preview"]})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured — select a workflow"})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},we={startNode:Y,endNode:J,addTriggerNode:Q,addStepNode:pe,triggerNode:X,eventNode:ue,filterNode:te,actionNode:ne,approvalNode:se,delayNode:ie,notificationNode:oe,webhookTriggerNode:le,restApiNode:re,conditionBranchNode:ke,subWorkflowNode:ve},Se=11.5,H=2,D=6,$=40,O=20,B=4,Ee=({id:t,sourceX:s,sourceY:d,targetX:a,targetY:r,sourcePosition:o,targetPosition:x,source:n,target:i,data:f})=>{const[y,g,j]=l.getStraightPath({sourceX:s,sourceY:d,targetX:a,targetY:r}),p=f==null?void 0:f.label,c=p==="Pass",N=c||p==="Fail",m=s+(a-s)/3,k=d+(r-d)/3,b=s+2*(a-s)/3,P=d+2*(r-d)/3,u=f==null?void 0:f.onAddStepClick,T=z=>{if(z.stopPropagation(),typeof u!="function")return;const de={edgeId:t,nodeId:n,sourceNodeId:n,targetNodeId:i,position:"between",referenceNodeId:n,referenceNodeType:f==null?void 0:f.referenceNodeType,stepVisibility:f==null?void 0:f.stepVisibility};u(n,de)},I=z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),T(z))},S=()=>e.jsxs(e.Fragment,{children:[e.jsxs("g",{className:"plus-icon-container",children:[e.jsx("circle",{r:Se,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-D,x2:0,y2:D,strokeWidth:H,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-D,y1:0,x2:D,y2:0,strokeWidth:H,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"})]})]}),v=u?{onClick:T,onKeyDown:I,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(l.BaseEdge,{id:t,path:y}),N?e.jsxs(e.Fragment,{children:[e.jsxs("g",{transform:`translate(${m}, ${k})`,children:[e.jsx("rect",{x:-$/2,y:-O/2,width:$,height:O,rx:B,ry:B,fill:c?"#ADE6C5":"#FDBFBF"}),e.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fill:c?"#1DBF60":"#C50000",style:{fontSize:12,fontWeight:500},children:p})]}),e.jsx("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${b}, ${P})`,"data-testid":"plus-node-icon",...v,children:e.jsx(S,{})})]}):e.jsx("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${g}, ${j})`,"data-testid":"plus-node-icon",...v,children:e.jsx(S,{})})]})},Te=11.5,_=2,A=6,Pe=({id:t,sourceX:s,sourceY:d,targetX:a,targetY:r,source:o,target:x,data:n})=>{const[i,f,y]=l.getStraightPath({sourceX:s,sourceY:d,targetX:a,targetY:r}),g=n==null?void 0:n.onAddStepClick,j=c=>{c.stopPropagation(),typeof g=="function"&&g(o,{edgeId:t,nodeId:o,sourceNodeId:o,targetNodeId:x,position:"between",referenceNodeId:o,referenceNodeType:n==null?void 0:n.referenceNodeType,stepVisibility:n==null?void 0:n.stepVisibility,filterId:n==null?void 0:n.filterId,branch:n==null?void 0:n.branch})},p=c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),j(c))};return e.jsxs("g",{className:"edge-with-plus-wrapper",children:[e.jsx(l.BaseEdge,{id:t,path:i,style:{stroke:"#b0bec5"}}),e.jsxs("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${f}, ${y})`,style:{cursor:g?"pointer":"default",pointerEvents:"all",outline:"none"},onClick:g?j:void 0,onKeyDown:g?p:void 0,role:g?"button":void 0,tabIndex:g?0:void 0,"data-testid":"plus-node-icon",children:[e.jsx("circle",{r:Te,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-A,x2:0,y2:A,strokeWidth:_,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-A,y1:0,x2:A,y2:0,strokeWidth:_,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"})]})]})]})},Ce=({id:t,sourceX:s,sourceY:d,targetX:a,targetY:r})=>{const[o]=l.getStraightPath({sourceX:s,sourceY:d,targetX:a,targetY:r});return e.jsx(l.BaseEdge,{id:t,path:o,style:{stroke:"#b0bec5"}})},Ie=11.5,K=2,R=6,ze=-24,U=40,q=20,G=4,De=({id:t,sourceX:s,sourceY:d,targetX:a,targetY:r,source:o,target:x,data:n})=>{const[i,f,y]=l.getStraightPath({sourceX:s,sourceY:d,targetX:a,targetY:r}),g=n==null?void 0:n.label,j=g==="Pass",p=j||g==="Fail",c=n==null?void 0:n.onAddStepClick,N=(n==null?void 0:n.showPlus)!==!1&&!!c,m=b=>{b.stopPropagation(),typeof c=="function"&&c(o,{edgeId:t,nodeId:o,sourceNodeId:o,targetNodeId:x,position:"between",referenceNodeId:o,referenceNodeType:n==null?void 0:n.referenceNodeType,stepVisibility:n==null?void 0:n.stepVisibility})},k=b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),m(b))};return e.jsxs("g",{className:"edge-with-plus-wrapper",children:[e.jsx(l.BaseEdge,{id:t,path:i,style:{stroke:"#b0bec5"}}),e.jsxs("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${f}, ${y})`,style:{cursor:c?"pointer":"default",pointerEvents:"all",outline:"none"},onClick:c?m:void 0,onKeyDown:c?k:void 0,role:c?"button":void 0,tabIndex:c?0:void 0,children:[p&&e.jsxs("g",{transform:`translate(0, ${N?ze:0})`,children:[e.jsx("rect",{x:-U/2,y:-q/2,width:U,height:q,rx:G,ry:G,fill:j?"#ADE6C5":"#FDBFBF"}),e.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fill:j?"#1DBF60":"#C50000",style:{fontSize:12,fontWeight:500},children:g})]}),N&&e.jsxs("g",{className:"plus-icon-container",children:[e.jsx("circle",{r:Ie,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-R,x2:0,y2:R,strokeWidth:K,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-R,y1:0,x2:R,y2:0,strokeWidth:K,strokeLinecap:"round",className:"plus-line"})]}),N&&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"})]})]})]})},Ae=({id:t,source:s,target:d,sourceX:a,sourceY:r,targetX:o,targetY:x,style:n={},markerEnd:i,data:f})=>{const y=(f==null?void 0:f.verticalRouting)??!1,g=30,j=y?(()=>{const v=x-g;return`M ${a},${v} L ${o},${v} L ${o},${x}`})():(()=>{const v=r+30;return`M ${a},${r} L ${a},${v} L ${o},${v} L ${o},${x}`})(),p=n.stroke||"#d1d5db",c=f==null?void 0:f.label,N=(f==null?void 0:f.isFirst)??!1,m=f==null?void 0:f.onAddStepClick,k=y?x-g:r+30,b=a+(o-a)*(y?.25:.35),P=a+(o-a)*(y?.65:.7),u=k,T=v=>{v.stopPropagation(),m&&m(s,{edgeId:t,nodeId:s,sourceNodeId:s,targetNodeId:d,position:"between",referenceNodeId:s,filterId:f==null?void 0:f.filterId,branch:f==null?void 0:f.branch})},I=11.5,S=6;return e.jsxs("g",{children:[e.jsx("path",{id:t,d:j,fill:"none",stroke:p,strokeWidth:1.5,markerEnd:i}),c&&!y&&e.jsx("g",{transform:`translate(${b}, ${u})`,children:(()=>{const v=Math.max(44,c.length*7+20);return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:-v/2,y:-11,width:v,height:22,rx:11,fill:N?"#e8f5e9":"#ffebee",stroke:N?"#81c784":"#e57373",strokeWidth:1}),e.jsx("text",{x:0,y:4,textAnchor:"middle",fontSize:10,fontWeight:600,fill:N?"#2e7d32":"#c62828",style:{fontFamily:"sans-serif",pointerEvents:"none"},children:c})]})})()}),m&&e.jsxs("g",{transform:`translate(${P}, ${u})`,onClick:T,style:{cursor:"pointer",pointerEvents:"all"},className:"nodrag nopan edge-plus-svg",children:[e.jsx("circle",{r:I,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-S,x2:0,y2:S,strokeWidth:2,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-S,y1:0,x2:S,y2:0,strokeWidth:2,strokeLinecap:"round",className:"plus-line"})]})]})};exports.ActionNode=ne;exports.AddTriggerNode=Q;exports.ApprovalNode=se;exports.DelayNode=ie;exports.EdgeWithPlusLabel=Ee;exports.EndNode=J;exports.FilterNode=te;exports.GatewayBranchEdge=Ae;exports.LabelPlusEdge=De;exports.NotificationNode=oe;exports.PlainEdge=Ce;exports.PlusEdge=Pe;exports.RestApiNode=re;exports.StartNode=Y;exports.TriggerNode=X;exports.WebhookTriggerNode=le;exports.WorkflowCanvasContext=Z;exports.builtInNodeTypes=we;
package/dist/canvas.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./templateSkeletons-BKaXZuM9.js"),t=require("./messages-O9Tw_XXR.js"),r=require("./bpmn-CcuE2X_Q.js"),e=require("./GatewayBranchEdge-CFre76ne.js");exports.FlowForgeCanvas=o.FlowForgeCanvas;exports.SubWorkflowPreviewDrawer=o.SubWorkflowPreviewDrawer;exports.WorkflowCanvas=o.FlowForgeCanvas;exports.WorkflowExecutionHistory=o.WorkflowExecutionHistory;exports.WorkflowTemplateLibrary=o.WorkflowTemplateLibrary;exports.accessRequestSkeleton=o.accessRequestSkeleton;exports.offboardingSkeleton=o.offboardingSkeleton;exports.userOnboardingSkeleton=o.userOnboardingSkeleton;exports.webhookIntegrationSkeleton=o.webhookIntegrationSkeleton;exports.defaultFlowForgeMessages=t.defaultFlowForgeMessages;exports.loadWorkflowFromBpmn=r.loadWorkflowFromBpmn;exports.saveWorkflowToBpmn=r.saveWorkflowToBpmn;exports.ActionNode=e.ActionNode;exports.ApprovalNode=e.ApprovalNode;exports.EdgeWithPlusLabel=e.EdgeWithPlusLabel;exports.EndNode=e.EndNode;exports.FilterNode=e.FilterNode;exports.RestApiNode=e.RestApiNode;exports.StartNode=e.StartNode;exports.TriggerNode=e.TriggerNode;exports.WebhookTriggerNode=e.WebhookTriggerNode;exports.builtInNodeTypes=e.builtInNodeTypes;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./templateSkeletons-BRBQmvvx.js"),t=require("./messages-O9Tw_XXR.js"),r=require("./bpmn-CcuE2X_Q.js"),e=require("./GatewayBranchEdge-mRo5aZ3f.js");exports.FlowForgeCanvas=o.FlowForgeCanvas;exports.SubWorkflowPreviewDrawer=o.SubWorkflowPreviewDrawer;exports.WorkflowCanvas=o.FlowForgeCanvas;exports.WorkflowExecutionHistory=o.WorkflowExecutionHistory;exports.WorkflowTemplateLibrary=o.WorkflowTemplateLibrary;exports.accessRequestSkeleton=o.accessRequestSkeleton;exports.offboardingSkeleton=o.offboardingSkeleton;exports.userOnboardingSkeleton=o.userOnboardingSkeleton;exports.webhookIntegrationSkeleton=o.webhookIntegrationSkeleton;exports.defaultFlowForgeMessages=t.defaultFlowForgeMessages;exports.loadWorkflowFromBpmn=r.loadWorkflowFromBpmn;exports.saveWorkflowToBpmn=r.saveWorkflowToBpmn;exports.ActionNode=e.ActionNode;exports.ApprovalNode=e.ApprovalNode;exports.EdgeWithPlusLabel=e.EdgeWithPlusLabel;exports.EndNode=e.EndNode;exports.FilterNode=e.FilterNode;exports.RestApiNode=e.RestApiNode;exports.StartNode=e.StartNode;exports.TriggerNode=e.TriggerNode;exports.WebhookTriggerNode=e.WebhookTriggerNode;exports.builtInNodeTypes=e.builtInNodeTypes;
package/dist/canvas.js CHANGED
@@ -1,7 +1,7 @@
1
- import { F as a, S as s, F as r, W as t, a as l, b as n, o as d, u as i, w as f } from "./templateSkeletons-Bx-hGzdq.js";
1
+ import { F as a, S as s, F as r, W as t, a as l, b as n, o as d, u as i, w as f } from "./templateSkeletons-uBCB72rO.js";
2
2
  import { d as w } from "./messages-CO299wPN.js";
3
3
  import { l as p, s as b } from "./bpmn-CtfWDaOY.js";
4
- import { A as F, b as N, E as m, c as u, F as S, R as T, S as c, T as v, W as x, e as A } from "./GatewayBranchEdge-CwL3jMdK.js";
4
+ import { A as F, b as N, E as m, c as u, F as S, R as T, S as c, T as v, W as x, e as A } from "./GatewayBranchEdge-4XMPBHne.js";
5
5
  export {
6
6
  F as ActionNode,
7
7
  N as ApprovalNode,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./GatewayBranchEdge-CFre76ne.js");exports.ActionNode=e.ActionNode;exports.AddTriggerNode=e.AddTriggerNode;exports.ApprovalNode=e.ApprovalNode;exports.DelayNode=e.DelayNode;exports.EdgeWithPlusLabel=e.EdgeWithPlusLabel;exports.EndNode=e.EndNode;exports.FilterNode=e.FilterNode;exports.GatewayBranchEdge=e.GatewayBranchEdge;exports.LabelPlusEdge=e.LabelPlusEdge;exports.NotificationNode=e.NotificationNode;exports.PlainEdge=e.PlainEdge;exports.PlusEdge=e.PlusEdge;exports.StartNode=e.StartNode;exports.TriggerNode=e.TriggerNode;exports.builtInNodeTypes=e.builtInNodeTypes;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./GatewayBranchEdge-mRo5aZ3f.js");exports.ActionNode=e.ActionNode;exports.AddTriggerNode=e.AddTriggerNode;exports.ApprovalNode=e.ApprovalNode;exports.DelayNode=e.DelayNode;exports.EdgeWithPlusLabel=e.EdgeWithPlusLabel;exports.EndNode=e.EndNode;exports.FilterNode=e.FilterNode;exports.GatewayBranchEdge=e.GatewayBranchEdge;exports.LabelPlusEdge=e.LabelPlusEdge;exports.NotificationNode=e.NotificationNode;exports.PlainEdge=e.PlainEdge;exports.PlusEdge=e.PlusEdge;exports.StartNode=e.StartNode;exports.TriggerNode=e.TriggerNode;exports.builtInNodeTypes=e.builtInNodeTypes;
package/dist/defaultUi.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as d, a as s, b as o, D as N, E as i, c as l, F as r, G as t, L as g, N as E, P as n, d as P, S as b, T as c, e as p } from "./GatewayBranchEdge-CwL3jMdK.js";
1
+ import { A as d, a as s, b as o, D as N, E as i, c as l, F as r, G as t, L as g, N as E, P as n, d as P, S as b, T as c, e as p } from "./GatewayBranchEdge-4XMPBHne.js";
2
2
  export {
3
3
  d as ActionNode,
4
4
  s as AddTriggerNode,
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DNZlQp9z.js"),a=require("./SchemaBuilderDrawer-jbSe-O-O.js");require("react/jsx-runtime");require("react");require("@mui/material");require("react-icons/md");const r=require("./nodeRegistry.cjs"),l=require("./templateRegistry.cjs"),i=require("./templateSkeletons-BKaXZuM9.js"),d=require("./messages-O9Tw_XXR.js"),n=require("./bpmn-CcuE2X_Q.js"),o=require("./GatewayBranchEdge-CFre76ne.js");class u{constructor(){this.channels=new Map}register(t,s){this.channels.set(t,s)}get(t){return this.channels.get(t)}list(){return Array.from(this.channels.entries()).map(([t,s])=>({key:t,...s}))}has(t){return this.channels.has(t)}}const c=new u;exports.DynamicFormRenderer=e.DynamicFormRenderer;exports.FF=e.FF;exports.FlowForgeRegistry=e.FlowForgeRegistry;exports.FlowForm=e.FlowForm;exports.FormulaInput=e.FormulaInput;exports.InfiniteSelectField=e.InfiniteSelectField;exports.TablePickerField=e.TablePickerField;exports.VariablePicker=e.VariablePicker;exports.VariablePickerProvider=e.VariablePickerProvider;exports.astHasRefs=e.astHasRefs;exports.astToTokens=e.astToTokens;exports.buildEvaluationPayload=e.buildEvaluationPayload;exports.buildFieldConfig=e.buildFieldConfig;exports.buildFormulaPath=e.buildFormulaPath;exports.buildSelectStyles=e.buildSelectStyles;exports.buildValidationSchema=e.buildValidationSchema;exports.dataSourceRegistry=e.dataSourceRegistry;exports.errorTextStyle=e.errorTextStyle;exports.extractLabel=e.extractLabel;exports.fieldRegistry=e.fieldRegistry;exports.hasFormulaTokens=e.hasFormulaTokens;exports.helperTextStyle=e.helperTextStyle;exports.inputStyle=e.inputStyle;exports.isFormula=e.isFormula;exports.parseToAST=e.parseToAST;exports.serializeAST=e.serializeAST;exports.serializeASTAsConfig=e.serializeASTAsConfig;exports.serializeConditionExpressions=e.serializeConditionExpressions;exports.stripFormulaTokens=e.stripFormulaTokens;exports.tokenize=e.tokenize;exports.unwrapFormula=e.unwrapFormula;exports.useVariablePickerContext=e.useVariablePickerContext;exports.wrapFormula=e.wrapFormula;exports.FIELD_TYPE_OPTIONS=a.FIELD_TYPE_OPTIONS;exports.SchemaBuilder=a.SchemaBuilder;exports.SchemaBuilderDrawer=a.SchemaBuilderDrawer;exports.useFlowForm=a.useFlowForm;exports.NodeTypeRegistry=r.NodeTypeRegistry;exports.baseNodeDefaults=r.baseNodeDefaults;exports.conditionBranchDescriptor=r.conditionBranchDescriptor;exports.defineNode=r.defineNode;exports.endEventDescriptor=r.endEventDescriptor;exports.makeSubWorkflowDescriptor=r.makeSubWorkflowDescriptor;exports.nodeTypeRegistry=r.nodeTypeRegistry;exports.notificationDescriptor=r.notificationDescriptor;exports.restApiDescriptor=r.restApiDescriptor;exports.startEventDescriptor=r.startEventDescriptor;exports.subWorkflowDescriptor=r.subWorkflowDescriptor;exports.webhookTriggerDescriptor=r.webhookTriggerDescriptor;exports.webhookTriggerTemplate=r.webhookTriggerTemplate;exports.TemplateRegistry=l.TemplateRegistry;exports.templateRegistry=l.templateRegistry;exports.FlowForgeCanvas=i.FlowForgeCanvas;exports.SubWorkflowPreviewDrawer=i.SubWorkflowPreviewDrawer;exports.WorkflowCanvas=i.FlowForgeCanvas;exports.WorkflowExecutionHistory=i.WorkflowExecutionHistory;exports.WorkflowTemplateLibrary=i.WorkflowTemplateLibrary;exports.accessRequestSkeleton=i.accessRequestSkeleton;exports.offboardingSkeleton=i.offboardingSkeleton;exports.userOnboardingSkeleton=i.userOnboardingSkeleton;exports.webhookIntegrationSkeleton=i.webhookIntegrationSkeleton;exports.defaultFlowForgeMessages=d.defaultFlowForgeMessages;exports.loadWorkflowFromBpmn=n.loadWorkflowFromBpmn;exports.saveWorkflowToBpmn=n.saveWorkflowToBpmn;exports.ActionNode=o.ActionNode;exports.ApprovalNode=o.ApprovalNode;exports.EdgeWithPlusLabel=o.EdgeWithPlusLabel;exports.EndNode=o.EndNode;exports.FilterNode=o.FilterNode;exports.RestApiNode=o.RestApiNode;exports.StartNode=o.StartNode;exports.TriggerNode=o.TriggerNode;exports.WebhookTriggerNode=o.WebhookTriggerNode;exports.builtInNodeTypes=o.builtInNodeTypes;exports.notificationChannelRegistry=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DNZlQp9z.js"),a=require("./SchemaBuilderDrawer-jbSe-O-O.js");require("react/jsx-runtime");require("react");require("@mui/material");require("react-icons/md");const r=require("./nodeRegistry.cjs"),l=require("./templateRegistry.cjs"),i=require("./templateSkeletons-BRBQmvvx.js"),d=require("./messages-O9Tw_XXR.js"),n=require("./bpmn-CcuE2X_Q.js"),o=require("./GatewayBranchEdge-mRo5aZ3f.js");class u{constructor(){this.channels=new Map}register(t,s){this.channels.set(t,s)}get(t){return this.channels.get(t)}list(){return Array.from(this.channels.entries()).map(([t,s])=>({key:t,...s}))}has(t){return this.channels.has(t)}}const c=new u;exports.DynamicFormRenderer=e.DynamicFormRenderer;exports.FF=e.FF;exports.FlowForgeRegistry=e.FlowForgeRegistry;exports.FlowForm=e.FlowForm;exports.FormulaInput=e.FormulaInput;exports.InfiniteSelectField=e.InfiniteSelectField;exports.TablePickerField=e.TablePickerField;exports.VariablePicker=e.VariablePicker;exports.VariablePickerProvider=e.VariablePickerProvider;exports.astHasRefs=e.astHasRefs;exports.astToTokens=e.astToTokens;exports.buildEvaluationPayload=e.buildEvaluationPayload;exports.buildFieldConfig=e.buildFieldConfig;exports.buildFormulaPath=e.buildFormulaPath;exports.buildSelectStyles=e.buildSelectStyles;exports.buildValidationSchema=e.buildValidationSchema;exports.dataSourceRegistry=e.dataSourceRegistry;exports.errorTextStyle=e.errorTextStyle;exports.extractLabel=e.extractLabel;exports.fieldRegistry=e.fieldRegistry;exports.hasFormulaTokens=e.hasFormulaTokens;exports.helperTextStyle=e.helperTextStyle;exports.inputStyle=e.inputStyle;exports.isFormula=e.isFormula;exports.parseToAST=e.parseToAST;exports.serializeAST=e.serializeAST;exports.serializeASTAsConfig=e.serializeASTAsConfig;exports.serializeConditionExpressions=e.serializeConditionExpressions;exports.stripFormulaTokens=e.stripFormulaTokens;exports.tokenize=e.tokenize;exports.unwrapFormula=e.unwrapFormula;exports.useVariablePickerContext=e.useVariablePickerContext;exports.wrapFormula=e.wrapFormula;exports.FIELD_TYPE_OPTIONS=a.FIELD_TYPE_OPTIONS;exports.SchemaBuilder=a.SchemaBuilder;exports.SchemaBuilderDrawer=a.SchemaBuilderDrawer;exports.useFlowForm=a.useFlowForm;exports.NodeTypeRegistry=r.NodeTypeRegistry;exports.baseNodeDefaults=r.baseNodeDefaults;exports.conditionBranchDescriptor=r.conditionBranchDescriptor;exports.defineNode=r.defineNode;exports.endEventDescriptor=r.endEventDescriptor;exports.makeSubWorkflowDescriptor=r.makeSubWorkflowDescriptor;exports.nodeTypeRegistry=r.nodeTypeRegistry;exports.notificationDescriptor=r.notificationDescriptor;exports.restApiDescriptor=r.restApiDescriptor;exports.startEventDescriptor=r.startEventDescriptor;exports.subWorkflowDescriptor=r.subWorkflowDescriptor;exports.webhookTriggerDescriptor=r.webhookTriggerDescriptor;exports.webhookTriggerTemplate=r.webhookTriggerTemplate;exports.TemplateRegistry=l.TemplateRegistry;exports.templateRegistry=l.templateRegistry;exports.FlowForgeCanvas=i.FlowForgeCanvas;exports.SubWorkflowPreviewDrawer=i.SubWorkflowPreviewDrawer;exports.WorkflowCanvas=i.FlowForgeCanvas;exports.WorkflowExecutionHistory=i.WorkflowExecutionHistory;exports.WorkflowTemplateLibrary=i.WorkflowTemplateLibrary;exports.accessRequestSkeleton=i.accessRequestSkeleton;exports.offboardingSkeleton=i.offboardingSkeleton;exports.userOnboardingSkeleton=i.userOnboardingSkeleton;exports.webhookIntegrationSkeleton=i.webhookIntegrationSkeleton;exports.defaultFlowForgeMessages=d.defaultFlowForgeMessages;exports.loadWorkflowFromBpmn=n.loadWorkflowFromBpmn;exports.saveWorkflowToBpmn=n.saveWorkflowToBpmn;exports.ActionNode=o.ActionNode;exports.ApprovalNode=o.ApprovalNode;exports.EdgeWithPlusLabel=o.EdgeWithPlusLabel;exports.EndNode=o.EndNode;exports.FilterNode=o.FilterNode;exports.RestApiNode=o.RestApiNode;exports.StartNode=o.StartNode;exports.TriggerNode=o.TriggerNode;exports.WebhookTriggerNode=o.WebhookTriggerNode;exports.builtInNodeTypes=o.builtInNodeTypes;exports.notificationChannelRegistry=c;
package/dist/index.js CHANGED
@@ -6,10 +6,10 @@ import "@mui/material";
6
6
  import "react-icons/md";
7
7
  import { NodeTypeRegistry as U, baseNodeDefaults as X, conditionBranchDescriptor as Z, defineNode as $, endEventDescriptor as ee, makeSubWorkflowDescriptor as ae, nodeTypeRegistry as se, notificationDescriptor as re, restApiDescriptor as oe, startEventDescriptor as te, subWorkflowDescriptor as ie, webhookTriggerDescriptor as le, webhookTriggerTemplate as ne } from "./nodeRegistry.js";
8
8
  import { TemplateRegistry as de, templateRegistry as ce } from "./templateRegistry.js";
9
- import { F as me, S as fe, F as ge, W as Fe, a as he, b as be, o as ke, u as Te, w as we } from "./templateSkeletons-Bx-hGzdq.js";
9
+ import { F as me, S as fe, F as ge, W as Fe, a as he, b as be, o as ke, u as Te, w as we } from "./templateSkeletons-uBCB72rO.js";
10
10
  import { d as ye } from "./messages-CO299wPN.js";
11
11
  import { l as De, s as Ne } from "./bpmn-CtfWDaOY.js";
12
- import { A as We, b as Ae, E as Pe, c as ve, F as Ee, R as Ce, S as Ie, T as Be, W as ze, e as Ve } from "./GatewayBranchEdge-CwL3jMdK.js";
12
+ import { A as We, b as Ae, E as Pe, c as ve, F as Ee, R as Ce, S as Ie, T as Be, W as ze, e as Ve } from "./GatewayBranchEdge-4XMPBHne.js";
13
13
  class s {
14
14
  constructor() {
15
15
  this.channels = /* @__PURE__ */ new Map();
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),r=require("react-icons/md"),d=require("./canvasTokens-gKNYrPl4.js"),s={formSchema:[],bpmnEntry:e=>e,bpmnExit:e=>e,emitBpmnElements:e=>[{id:e,$type:"bpmn:Task"}]};function o(e){return{...s,...e}}const u=o({type:"startEvent",label:"Start",icon:a.createElement(r.MdPlayCircleOutline,{size:18,color:"#616161"}),matches:e=>e==="start",reactFlowType:"startNode",emitBpmnElements:e=>[{id:e,$type:"bpmn:StartEvent"}],maxPerWorkflow:1}),b=o({type:"endEvent",label:"End",icon:a.createElement(r.MdStopCircle,{size:18,color:"#616161"}),matches:e=>e==="end"||e.startsWith("end-"),reactFlowType:"endNode",emitBpmnElements:e=>[{id:e,$type:"bpmn:EndEvent"}]}),h=o({type:"restApi",label:"REST API Call",icon:a.createElement(r.MdHttp,{size:18,color:"#546e7a"}),matches:e=>e.startsWith("restApi-"),reactFlowType:"restApiNode",formSchema:[{id:"method",type:"select",label:"HTTP Method",required:!0,options:[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"PUT",value:"PUT"},{label:"PATCH",value:"PATCH"},{label:"DELETE",value:"DELETE"}]},{id:"url",type:"text",label:"URL",required:!0,placeholder:"https://api.example.com/endpoint",formulaEnabled:!0},{id:"headers",type:"key-value",label:"Request Headers",placeholder:"Add headers..."},{id:"queryParams",type:"key-value",label:"Query Parameters",shouldHide:({values:e})=>e.method!=="GET"&&e.method!=="DELETE"},{id:"body",type:"json-editor",label:"Request Body (JSON)",shouldHide:({values:e})=>e.method==="GET"||e.method==="DELETE"},{id:"responseMapping",type:"array",label:"Map Response Fields to Variables",children:[{id:"jsonPath",type:"text",label:"JSON Path",placeholder:"$.data.userId",required:!0},{id:"variableName",type:"text",label:"Variable Name",placeholder:"userId",required:!0}]},{id:"timeoutMs",type:"number",label:"Timeout (ms)",placeholder:"5000"},{id:"continueOnError",type:"toggle",label:"Continue workflow on error"}],bpmnEntry:e=>`REST API Call: ${e}`,bpmnExit:e=>`End REST API Call: ${e}`,emitBpmnElements:(e,t)=>{const l=t;return[{id:e,$type:"bpmn:ServiceTask",name:`${l.method??"HTTP"} ${l.url??""}`.trim()}]}}),m=o({type:"notification",label:"Send Notification",icon:a.createElement(r.MdNotifications,{size:18,color:"#7b1fa2"}),matches:e=>e.startsWith("notification-"),reactFlowType:"notificationNode",formSchema:[{id:"channel",type:"descriptive-select",label:"Notification Channel",required:!0,options:[{value:"email",label:"Email",description:"Send via SMTP or email provider"},{value:"slack",label:"Slack",description:"Post to a Slack channel or DM"},{value:"teams",label:"Microsoft Teams",description:"Post to a Teams channel or chat"},{value:"sms",label:"SMS",description:"Send a text message"},{value:"in-app",label:"In-App",description:"miniOrange notification center"},{value:"webhook",label:"Webhook",description:"POST to an external URL"}]},{id:"emailTo",type:"tags",label:"To",placeholder:"Add email address...",required:!0,shouldHide:({values:e})=>e.channel!=="email",formulaEnabled:!0},{id:"emailCc",type:"tags",label:"CC",placeholder:"Add email address...",shouldHide:({values:e})=>e.channel!=="email"},{id:"emailSubject",type:"text",label:"Subject",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="email"},{id:"emailBody",type:"rich-text",label:"Body",required:!0,shouldHide:({values:e})=>e.channel!=="email"},{id:"slackChannel",type:"text",label:"Channel / DM",required:!0,placeholder:"#general or @username",formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="slack"},{id:"slackMessage",type:"textarea",label:"Message",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="slack"},{id:"teamsWebhookUrl",type:"text",label:"Incoming Webhook URL",required:!0,placeholder:"https://...",shouldHide:({values:e})=>e.channel!=="teams"},{id:"teamsMessage",type:"textarea",label:"Message",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="teams"},{id:"smsTo",type:"text",label:"Phone Number",required:!0,placeholder:"+1234567890",formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="sms"},{id:"smsBody",type:"textarea",label:"Message",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="sms"},{id:"inAppRecipient",type:"text",label:"Recipient (User ID or Username)",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="in-app"},{id:"inAppTitle",type:"text",label:"Title",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="in-app"},{id:"inAppBody",type:"textarea",label:"Message",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="in-app"},{id:"webhookUrl",type:"text",label:"Webhook URL",required:!0,placeholder:"https://...",formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="webhook"},{id:"webhookPayload",type:"json-editor",label:"Payload (JSON)",shouldHide:({values:e})=>e.channel!=="webhook"},{id:"sendOnFailure",type:"toggle",label:"Also send notification on workflow failure"},{id:"deduplicationKey",type:"text",label:"Deduplication Key",placeholder:"Optional — prevents duplicate sends",formulaEnabled:!0}],bpmnEntry:e=>`Send Notification: ${e}`,bpmnExit:e=>`End Notification: ${e}`,emitBpmnElements:(e,t)=>[{id:e,$type:"bpmn:SendTask",name:`Notify via ${t.channel??"channel"}`}]}),y=[{label:"equals (=)",value:"eq"},{label:"not equals (≠)",value:"neq"},{label:"greater than (>)",value:"gt"},{label:"greater or equal (≥)",value:"gte"},{label:"less than (<)",value:"lt"},{label:"less or equal (≤)",value:"lte"},{label:"contains",value:"contains"},{label:"starts with",value:"startsWith"},{label:"ends with",value:"endsWith"},{label:"is empty",value:"isEmpty"},{label:"is not empty",value:"isNotEmpty"}],f=o({type:"conditionBranch",label:"Condition Branch",icon:a.createElement(r.MdCallSplit,{size:18,color:"#512da8"}),matches:e=>e.startsWith("conditionBranch-"),reactFlowType:"conditionBranchNode",branchLabels:{branch1:"Branch 1",branch2:"Branch 2",default:"Default"},formSchema:[{id:"title",type:"text",label:"Node Label",placeholder:"e.g. Route by User Role"},{id:"branchConfigs",type:"array",label:"Branches",required:!0,children:[{id:"key",type:"text",label:"Branch Key",required:!0,placeholder:"e.g. admin (no spaces)"},{id:"label",type:"text",label:"Branch Label",required:!0,placeholder:"e.g. Admin Users"},{id:"conditions",type:"array",label:"Conditions",children:[{id:"field",type:"text",label:"Field / Variable",required:!0,placeholder:"e.g. user.role",formulaEnabled:!0},{id:"operator",type:"select",label:"Operator",required:!0,options:y},{id:"value",type:"text",label:"Value",placeholder:"e.g. admin",formulaEnabled:!0,shouldHide:({values:e})=>e.operator==="isEmpty"||e.operator==="isNotEmpty"},{id:"logicalOperator",type:"select",label:"Combine with next",options:[{label:"AND",value:"AND"},{label:"OR",value:"OR"}]}]}]},{id:"defaultBranch",type:"text",label:"Default Branch Key (fallback if no condition matches)",placeholder:"e.g. default"}],bpmnEntry:e=>`Condition Branch: ${e}`,bpmnExit:e=>`End Condition Branch: ${e}`,emitBpmnElements:(e,t)=>{const l=t,i=l.branchConfigs??[];return[{id:e,$type:"bpmn:ExclusiveGateway",name:l.title??"Condition Branch"},...i.map(n=>({id:`${e}-${n.key}`,$type:"bpmn:SequenceFlow",name:n.label}))]}}),E=o({type:"webhookTrigger",label:"Webhook Trigger",icon:a.createElement(r.MdWebhook,{size:d.NODE_DESCRIPTOR_ICON_SIZE,color:"#1565c0"}),matches:e=>e.startsWith("webhookTrigger-"),reactFlowType:"webhookTriggerNode",formSchema:[{id:"endpointUrl",type:"text",label:"Endpoint URL",disabled:!0,placeholder:"Generated after saving"},{id:"authMethod",type:"select",label:"Authentication",required:!0,options:[{label:"None",value:"none"},{label:"API Key",value:"api-key"},{label:"HMAC Signature",value:"hmac"}]},{id:"apiKeyHeader",type:"text",label:"API Key Header Name",placeholder:"e.g. X-API-Key",shouldHide:({values:e})=>e.authMethod!=="api-key"},{id:"hmacSecret",type:"text",label:"HMAC Secret",placeholder:"Shared secret for signature verification",shouldHide:({values:e})=>e.authMethod!=="hmac"},{id:"payloadDescription",type:"textarea",label:"Expected Payload Description",placeholder:"Describe the expected JSON payload fields..."}],bpmnEntry:e=>`Webhook Trigger: ${e}`,bpmnExit:e=>`End Webhook Trigger: ${e}`,emitBpmnElements:e=>[{id:e,$type:"bpmn:StartEvent",name:"Webhook Trigger"}]}),g={triggerKey:"WEBHOOK_TRIGGER",label:"Incoming Webhook",description:"Start this workflow when an HTTP POST is received at a generated endpoint.",triggerCategory:"webhook",icon:a.createElement(r.MdWebhook,{size:d.NODE_DESCRIPTOR_ICON_SIZE,color:"#1565c0"})};function p(e={}){return o({type:"subWorkflow",label:"Sub-Workflow",icon:a.createElement(r.MdAccountTree,{size:18,color:"#00695c"}),matches:t=>t.startsWith("subWorkflow-"),reactFlowType:"subWorkflowNode",formSchema:[{id:"workflowId",type:"select",label:"Workflow to Call",required:!0,placeholder:"Select a workflow...",...e.fetchWorkflowOptions?{fetchOptions:e.fetchWorkflowOptions}:{options:[]}},{id:"workflowLabel",type:"text",label:"Display Name (optional)",placeholder:"Override display name shown on canvas"},{id:"inputMapping",type:"key-value",label:"Input Mapping",placeholder:"Map parent variables → sub-workflow inputs",formulaEnabled:!0},{id:"outputMapping",type:"key-value",label:"Output Mapping",placeholder:"Map sub-workflow outputs → parent variables"},{id:"waitForCompletion",type:"toggle",label:"Wait for sub-workflow to complete before continuing"},{id:"continueOnError",type:"toggle",label:"Continue parent workflow if sub-workflow fails"}],bpmnEntry:t=>`Sub-Workflow Call: ${t}`,bpmnExit:t=>`End Sub-Workflow Call: ${t}`,emitBpmnElements:(t,l)=>{const i=l;return[{id:t,$type:"bpmn:CallActivity",name:i.workflowLabel||i.workflowId||"Sub-Workflow",calledElement:i.workflowId}]}})}const k=p();class c{constructor(){this.descriptors=new Map}register(t){return this.descriptors.set(t.type,t),this}forType(t){return this.descriptors.get(t)}forId(t){for(const l of this.descriptors.values())if(l.matches(t))return l}list(){return[...this.descriptors.values()]}}const w=new c;exports.NodeTypeRegistry=c;exports.baseNodeDefaults=s;exports.conditionBranchDescriptor=f;exports.defineNode=o;exports.endEventDescriptor=b;exports.makeSubWorkflowDescriptor=p;exports.nodeTypeRegistry=w;exports.notificationDescriptor=m;exports.restApiDescriptor=h;exports.startEventDescriptor=u;exports.subWorkflowDescriptor=k;exports.webhookTriggerDescriptor=E;exports.webhookTriggerTemplate=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),r=require("react-icons/md"),d=require("./canvasTokens-gKNYrPl4.js"),s={formSchema:[],bpmnEntry:e=>e,bpmnExit:e=>e,emitBpmnElements:e=>[{id:e,$type:"bpmn:Task"}]};function o(e){return{...s,...e}}const u=o({type:"startEvent",label:"Start",icon:a.createElement(r.MdPlayCircleOutline,{size:18,color:"#616161"}),matches:e=>e==="start",reactFlowType:"startNode",emitBpmnElements:e=>[{id:e,$type:"bpmn:StartEvent"}],maxPerWorkflow:1}),b=o({type:"endEvent",label:"End",icon:a.createElement(r.MdStopCircle,{size:18,color:"#616161"}),matches:e=>e==="end"||e.startsWith("end-"),reactFlowType:"endNode",emitBpmnElements:e=>[{id:e,$type:"bpmn:EndEvent"}]}),h=o({type:"restApi",label:"REST API Call",icon:a.createElement(r.MdHttp,{size:18,color:"#546e7a"}),matches:e=>e.startsWith("restApi-"),reactFlowType:"restApiNode",formSchema:[{id:"method",type:"select",label:"HTTP Method",required:!0,options:[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"PUT",value:"PUT"},{label:"PATCH",value:"PATCH"},{label:"DELETE",value:"DELETE"}]},{id:"url",type:"text",label:"URL",required:!0,placeholder:"https://api.example.com/endpoint",formulaEnabled:!0},{id:"headers",type:"key-value",label:"Request Headers",placeholder:"Add headers..."},{id:"queryParams",type:"key-value",label:"Query Parameters",shouldHide:({values:e})=>e.method!=="GET"&&e.method!=="DELETE"},{id:"body",type:"json-editor",label:"Request Body (JSON)",shouldHide:({values:e})=>e.method==="GET"||e.method==="DELETE"},{id:"responseMapping",type:"array",label:"Map Response Fields to Variables",children:[{id:"jsonPath",type:"text",label:"JSON Path",placeholder:"$.data.userId",required:!0},{id:"variableName",type:"text",label:"Variable Name",placeholder:"userId",required:!0}]},{id:"timeoutMs",type:"number",label:"Timeout (ms)",placeholder:"5000"},{id:"continueOnError",type:"toggle",label:"Continue workflow on error"}],bpmnEntry:e=>`REST API Call: ${e}`,bpmnExit:e=>`End REST API Call: ${e}`,emitBpmnElements:(e,t)=>{const l=t;return[{id:e,$type:"bpmn:ServiceTask",name:`${l.method??"HTTP"} ${l.url??""}`.trim()}]}}),m=o({type:"notification",label:"Send Notification",icon:a.createElement(r.MdNotifications,{size:18,color:"#7b1fa2"}),matches:e=>e.startsWith("notification-"),reactFlowType:"notificationNode",formSchema:[{id:"channel",type:"descriptive-select",label:"Notification Channel",required:!0,options:[{value:"email",label:"Email",description:"Send via SMTP or email provider"},{value:"slack",label:"Slack",description:"Post to a Slack channel or DM"},{value:"teams",label:"Microsoft Teams",description:"Post to a Teams channel or chat"},{value:"sms",label:"SMS",description:"Send a text message"},{value:"in-app",label:"In-App",description:"miniOrange notification center"},{value:"webhook",label:"Webhook",description:"POST to an external URL"}]},{id:"emailTo",type:"tags",label:"To",placeholder:"Add email address...",required:!0,shouldHide:({values:e})=>e.channel!=="email",formulaEnabled:!0},{id:"emailCc",type:"tags",label:"CC",placeholder:"Add email address...",shouldHide:({values:e})=>e.channel!=="email"},{id:"emailSubject",type:"text",label:"Subject",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="email"},{id:"emailBody",type:"rich-text",label:"Body",required:!0,shouldHide:({values:e})=>e.channel!=="email"},{id:"slackChannel",type:"text",label:"Channel / DM",required:!0,placeholder:"#general or @username",formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="slack"},{id:"slackMessage",type:"textarea",label:"Message",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="slack"},{id:"teamsWebhookUrl",type:"text",label:"Incoming Webhook URL",required:!0,placeholder:"https://...",shouldHide:({values:e})=>e.channel!=="teams"},{id:"teamsMessage",type:"textarea",label:"Message",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="teams"},{id:"smsTo",type:"text",label:"Phone Number",required:!0,placeholder:"+1234567890",formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="sms"},{id:"smsBody",type:"textarea",label:"Message",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="sms"},{id:"inAppRecipient",type:"text",label:"Recipient (User ID or Username)",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="in-app"},{id:"inAppTitle",type:"text",label:"Title",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="in-app"},{id:"inAppBody",type:"textarea",label:"Message",required:!0,formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="in-app"},{id:"webhookUrl",type:"text",label:"Webhook URL",required:!0,placeholder:"https://...",formulaEnabled:!0,shouldHide:({values:e})=>e.channel!=="webhook"},{id:"webhookPayload",type:"json-editor",label:"Payload (JSON)",shouldHide:({values:e})=>e.channel!=="webhook"},{id:"sendOnFailure",type:"toggle",label:"Also send notification on workflow failure"},{id:"deduplicationKey",type:"text",label:"Deduplication Key",placeholder:"Optional — prevents duplicate sends",formulaEnabled:!0}],bpmnEntry:e=>`Send Notification: ${e}`,bpmnExit:e=>`End Notification: ${e}`,emitBpmnElements:(e,t)=>[{id:e,$type:"bpmn:SendTask",name:`Notify via ${t.channel??"channel"}`}]}),y=[{label:"equals (=)",value:"eq"},{label:"not equals (≠)",value:"neq"},{label:"greater than (>)",value:"gt"},{label:"greater or equal (≥)",value:"gte"},{label:"less than (<)",value:"lt"},{label:"less or equal (≤)",value:"lte"},{label:"contains",value:"contains"},{label:"starts with",value:"startsWith"},{label:"ends with",value:"endsWith"},{label:"is empty",value:"isEmpty"},{label:"is not empty",value:"isNotEmpty"}],E=o({type:"conditionBranch",label:"Condition Branch",icon:a.createElement(r.MdCallSplit,{size:18,color:"#512da8"}),matches:e=>e.startsWith("conditionBranch-"),reactFlowType:"conditionBranchNode",branchLabels:{branch1:"IF · Branch 1",branch2:"ELSE IF · Branch 2",default:"ELSE"},formSchema:[{id:"title",type:"text",label:"Node Label",placeholder:"e.g. Route by User Role"},{id:"branchConfigs",type:"array",label:"Branches",required:!0,children:[{id:"kind",type:"select",label:"Branch Type",required:!0,options:[{label:"IF",value:"if"},{label:"ELSE IF",value:"elseif"},{label:"ELSE",value:"else"}],placeholder:"elseif"},{id:"key",type:"text",label:"Branch Key",required:!0,placeholder:"e.g. admin (no spaces)"},{id:"label",type:"text",label:"Branch Label",required:!0,placeholder:"e.g. Admin Users"},{id:"conditions",type:"array",label:"Conditions",shouldHide:({values:e})=>e.kind==="else",children:[{id:"field",type:"text",label:"Field / Variable",required:!0,placeholder:"e.g. user.role",formulaEnabled:!0},{id:"operator",type:"select",label:"Operator",required:!0,options:y},{id:"value",type:"text",label:"Value",placeholder:"e.g. admin",formulaEnabled:!0,shouldHide:({values:e})=>e.operator==="isEmpty"||e.operator==="isNotEmpty"},{id:"logicalOperator",type:"select",label:"Combine with next",options:[{label:"AND",value:"AND"},{label:"OR",value:"OR"}]}]}]},{id:"defaultBranch",type:"text",label:"Default Branch Key (fallback if no condition matches)",placeholder:"e.g. default"}],bpmnEntry:e=>`Condition Branch: ${e}`,bpmnExit:e=>`End Condition Branch: ${e}`,emitBpmnElements:(e,t)=>{const l=t,i=l.branchConfigs??[];return[{id:e,$type:"bpmn:ExclusiveGateway",name:l.title??"Condition Branch"},...i.map(n=>({id:`${e}-${n.key}`,$type:"bpmn:SequenceFlow",name:n.label}))]}}),f=o({type:"webhookTrigger",label:"Webhook Trigger",icon:a.createElement(r.MdWebhook,{size:d.NODE_DESCRIPTOR_ICON_SIZE,color:"#1565c0"}),matches:e=>e.startsWith("webhookTrigger-"),reactFlowType:"webhookTriggerNode",formSchema:[{id:"endpointUrl",type:"text",label:"Endpoint URL",disabled:!0,placeholder:"Generated after saving"},{id:"authMethod",type:"select",label:"Authentication",required:!0,options:[{label:"None",value:"none"},{label:"API Key",value:"api-key"},{label:"HMAC Signature",value:"hmac"}]},{id:"apiKeyHeader",type:"text",label:"API Key Header Name",placeholder:"e.g. X-API-Key",shouldHide:({values:e})=>e.authMethod!=="api-key"},{id:"hmacSecret",type:"text",label:"HMAC Secret",placeholder:"Shared secret for signature verification",shouldHide:({values:e})=>e.authMethod!=="hmac"},{id:"payloadDescription",type:"textarea",label:"Expected Payload Description",placeholder:"Describe the expected JSON payload fields..."}],bpmnEntry:e=>`Webhook Trigger: ${e}`,bpmnExit:e=>`End Webhook Trigger: ${e}`,emitBpmnElements:e=>[{id:e,$type:"bpmn:StartEvent",name:"Webhook Trigger"}]}),g={triggerKey:"WEBHOOK_TRIGGER",label:"Incoming Webhook",description:"Start this workflow when an HTTP POST is received at a generated endpoint.",triggerCategory:"webhook",icon:a.createElement(r.MdWebhook,{size:d.NODE_DESCRIPTOR_ICON_SIZE,color:"#1565c0"})};function p(e={}){return o({type:"subWorkflow",label:"Sub-Workflow",icon:a.createElement(r.MdAccountTree,{size:18,color:"#00695c"}),matches:t=>t.startsWith("subWorkflow-"),reactFlowType:"subWorkflowNode",formSchema:[{id:"workflowId",type:"select",label:"Workflow to Call",required:!0,placeholder:"Select a workflow...",...e.fetchWorkflowOptions?{fetchOptions:e.fetchWorkflowOptions}:{options:[]}},{id:"workflowLabel",type:"text",label:"Display Name (optional)",placeholder:"Override display name shown on canvas"},{id:"inputMapping",type:"key-value",label:"Input Mapping",placeholder:"Map parent variables → sub-workflow inputs",formulaEnabled:!0},{id:"outputMapping",type:"key-value",label:"Output Mapping",placeholder:"Map sub-workflow outputs → parent variables"},{id:"waitForCompletion",type:"toggle",label:"Wait for sub-workflow to complete before continuing"},{id:"continueOnError",type:"toggle",label:"Continue parent workflow if sub-workflow fails"}],bpmnEntry:t=>`Sub-Workflow Call: ${t}`,bpmnExit:t=>`End Sub-Workflow Call: ${t}`,emitBpmnElements:(t,l)=>{const i=l;return[{id:t,$type:"bpmn:CallActivity",name:i.workflowLabel||i.workflowId||"Sub-Workflow",calledElement:i.workflowId}]}})}const k=p();class c{constructor(){this.descriptors=new Map}register(t){return this.descriptors.set(t.type,t),this}forType(t){return this.descriptors.get(t)}forId(t){for(const l of this.descriptors.values())if(l.matches(t))return l}list(){return[...this.descriptors.values()]}}const w=new c;exports.NodeTypeRegistry=c;exports.baseNodeDefaults=s;exports.conditionBranchDescriptor=E;exports.defineNode=o;exports.endEventDescriptor=b;exports.makeSubWorkflowDescriptor=p;exports.nodeTypeRegistry=w;exports.notificationDescriptor=m;exports.restApiDescriptor=h;exports.startEventDescriptor=u;exports.subWorkflowDescriptor=k;exports.webhookTriggerDescriptor=f;exports.webhookTriggerTemplate=g;
@@ -290,14 +290,15 @@ const T = r({
290
290
  { label: "ends with", value: "endsWith" },
291
291
  { label: "is empty", value: "isEmpty" },
292
292
  { label: "is not empty", value: "isNotEmpty" }
293
- ], N = r({
293
+ ], q = r({
294
294
  type: "conditionBranch",
295
295
  label: "Condition Branch",
296
296
  icon: a.createElement(b, { size: 18, color: "#512da8" }),
297
297
  matches: (e) => e.startsWith("conditionBranch-"),
298
298
  reactFlowType: "conditionBranchNode",
299
- /** Initial branch labels — canvas uses these keys to initialise BranchMap on insert */
300
- branchLabels: { branch1: "Branch 1", branch2: "Branch 2", default: "Default" },
299
+ /** Initial branch labels — canvas uses these keys to initialise BranchMap on insert.
300
+ * Pre-seeded as Workato-style IF / ELSE IF / ELSE chain. */
301
+ branchLabels: { branch1: "IF · Branch 1", branch2: "ELSE IF · Branch 2", default: "ELSE" },
301
302
  formSchema: [
302
303
  {
303
304
  id: "title",
@@ -311,6 +312,20 @@ const T = r({
311
312
  label: "Branches",
312
313
  required: !0,
313
314
  children: [
315
+ {
316
+ id: "kind",
317
+ type: "select",
318
+ label: "Branch Type",
319
+ required: !0,
320
+ options: [
321
+ { label: "IF", value: "if" },
322
+ { label: "ELSE IF", value: "elseif" },
323
+ { label: "ELSE", value: "else" }
324
+ ],
325
+ // Default for new branches is "elseif" so the chain reads correctly when
326
+ // appended between the first IF and the trailing ELSE.
327
+ placeholder: "elseif"
328
+ },
314
329
  {
315
330
  id: "key",
316
331
  type: "text",
@@ -329,6 +344,8 @@ const T = r({
329
344
  id: "conditions",
330
345
  type: "array",
331
346
  label: "Conditions",
347
+ // ELSE branches have no condition by definition — hide the array.
348
+ shouldHide: ({ values: e }) => e.kind === "else",
332
349
  children: [
333
350
  {
334
351
  id: "field",
@@ -386,7 +403,7 @@ const T = r({
386
403
  }))
387
404
  ];
388
405
  }
389
- }), q = r({
406
+ }), N = r({
390
407
  type: "webhookTrigger",
391
408
  label: "Webhook Trigger",
392
409
  icon: a.createElement(n, { size: d, color: "#1565c0" }),
@@ -442,7 +459,7 @@ const T = r({
442
459
  triggerCategory: "webhook",
443
460
  icon: a.createElement(n, { size: d, color: "#1565c0" })
444
461
  };
445
- function f(e = {}) {
462
+ function E(e = {}) {
446
463
  return r({
447
464
  type: "subWorkflow",
448
465
  label: "Sub-Workflow",
@@ -501,8 +518,8 @@ function f(e = {}) {
501
518
  }
502
519
  });
503
520
  }
504
- const M = f();
505
- class E {
521
+ const M = E();
522
+ class f {
506
523
  constructor() {
507
524
  this.descriptors = /* @__PURE__ */ new Map();
508
525
  }
@@ -520,19 +537,19 @@ class E {
520
537
  return [...this.descriptors.values()];
521
538
  }
522
539
  }
523
- const W = new E();
540
+ const H = new f();
524
541
  export {
525
- E as NodeTypeRegistry,
542
+ f as NodeTypeRegistry,
526
543
  m as baseNodeDefaults,
527
- N as conditionBranchDescriptor,
544
+ q as conditionBranchDescriptor,
528
545
  r as defineNode,
529
546
  v as endEventDescriptor,
530
- f as makeSubWorkflowDescriptor,
531
- W as nodeTypeRegistry,
547
+ E as makeSubWorkflowDescriptor,
548
+ H as nodeTypeRegistry,
532
549
  x as notificationDescriptor,
533
550
  S as restApiDescriptor,
534
551
  T as startEventDescriptor,
535
552
  M as subWorkflowDescriptor,
536
- q as webhookTriggerDescriptor,
553
+ N as webhookTriggerDescriptor,
537
554
  C as webhookTriggerTemplate
538
555
  };