@notmrabhi/flowforge 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),l=require("reactflow"),T=require("@mui/material"),ce=require("react-icons/gr"),V=require("react"),de=require("./messages-O9Tw_XXR.js"),y=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:de.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:o}=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(T.Tooltip,{title:o.addTriggerTooltip,placement:"top",arrow:!0,children:e.jsxs("div",{onClick:t,role:"button",tabIndex:0,onKeyDown:f=>{f.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:o.addTriggerButton})]})}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0,left:"50%"}})]})},pe=({id:t})=>{const{onAddStep:o}=w();return e.jsxs("div",{onClick:()=>o(t),role:"button",tabIndex:0,onKeyDown:f=>{f.key==="Enter"&&o(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,o=>o.toUpperCase()):""}function he(t){const o=typeof t=="string"?t:t.value??"";return o==="SIGNUP_FLOW"?"User Self-Registration":o==="ADMIN_CREATION_FLOW"?"Create User via Admin Portal":o==="SHEDULAR"?"Scheduler":typeof t!="string"&&t.label?t.label:o.replace(/[_-]+/g," ").replace(/\b\w/g,f=>f.toUpperCase())}const X=({data:t})=>{const{onClickAddTrigger:o}=w(),{type:f,eventType:p,sources:r,label:i,source:x,previewWorkflow:s,executionStatus:n,infoText:d="This node decides the flow trigger type and configuration."}=t??{},g=m=>{m==null||m.stopPropagation(),o()},h=Array.isArray(r)&&r.length>0,j=!!(i||x),a=f==="scheduler"?"Scheduler Trigger":f==="event"||h||j?"Event Trigger Source":"Select Trigger",c=f==="scheduler"?e.jsx("span",{children:"Scheduler to be configured"}):f==="event"||h?e.jsxs("div",{children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[e.jsx("span",{style:{fontWeight:600},children:xe(p)}),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:h?r.map((m,k)=>e.jsx(T.Chip,{label:he(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:[i&&e.jsx("span",{style:{fontWeight:600},children:i}),x&&e.jsx(T.Chip,{label:x,variant:"outlined",size:"small"})]}):e.jsx("span",{role:"button",tabIndex:0,onClick:g,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&g(m)},style:{cursor:"pointer",color:"#1e88e5"},children:"Click to select a trigger to start your workflow"}),N=n?e.jsxs(e.Fragment,{children:[n.status==="success"&&e.jsx(L.FaCheckCircle,{size:16,color:"#1DBF60",style:{marginRight:8}}),n.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:[!s&&e.jsx("div",{role:"button",tabIndex:0,onClick:g,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&g(m)},className:"ff-me-2",style:{cursor:"pointer",color:"#212121"},"aria-label":"Edit trigger",children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx(T.Tooltip,{title:e.jsx("div",{children:d}),placement:"right",arrow:!0,children:e.jsx("span",{children:e.jsx(y.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(y.MdInput,{size:16,color:"#388e3c"})}),e.jsx("span",{style:{fontSize:14,fontWeight:500,color:"#212121"},children:a})]}),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 12px 12px",borderRadius:6},children:c})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0},id:"1"})]})},ee=({rail:t,cardWidth:o})=>{const f=o/2;o/2+t.indent;const p="var(--ff-edge-color, #b0bec5)";return e.jsxs("svg",{width:o+t.indent+200,height:t.height,style:{position:"absolute",left:0,top:"100%",pointerEvents:"none",overflow:"visible"},children:[e.jsx("line",{x1:f,y1:0,x2:f,y2:t.height,stroke:p,strokeWidth:1.5}),t.branches.map((r,i)=>{const x=r.y;return e.jsxs("g",{transform:`translate(0, ${x})`,children:[e.jsx("rect",{x:f-5,y:-5,width:10,height:10,fill:"#fff",stroke:p,strokeWidth:1.5,transform:`rotate(45, ${f}, 0)`}),e.jsx("text",{x:f+14,y:4,fontSize:12,fontWeight:500,fill:"var(--ff-text, #212121)",style:{fontFamily:"sans-serif"},children:r.label})]},i)})]})},te=({id:t,data:o})=>{const{onEditNode:f,onDeleteNode:p}=w(),{conditions:r=[],infoText:i="Filter conditions applied to workflow data",_branchRail:x}=o;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-mb-2 ff-justify-content-between ff-align-items-center ff-mx-2 ff-mt-2",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:s=>{s.stopPropagation(),f(t)},onKeyDown:s=>{s.key==="Enter"&&(s.stopPropagation(),f(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:s=>{s.stopPropagation(),p(t)},onKeyDown:s=>{s.key==="Enter"&&(s.stopPropagation(),p(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})}),e.jsx(T.Tooltip,{title:i,placement:"right",arrow:!0,children:e.jsx("div",{className:"ff-ms-2",children:e.jsx(y.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsx("div",{className:"ff-p-2 ff-mx-2 ff-mb-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:r.length===0?e.jsx("span",{className:"ff-text-muted",children:"No conditions configured"}):r.map((s,n)=>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:s.field,children:s.field}),e.jsx("span",{className:"ff-text-muted",children:s.operator}),e.jsx("p",{className:"ff-text-dark ff-text-truncate ff-mx-1 ff-m-0",title:s.value,children:s.value}),n<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:s.logicalOperator})]},n))})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}}),x&&e.jsx(ee,{rail:x,cardWidth:350})]})},se=({id:t,data:o})=>{const{onEditNode:f,onDeleteNode:p,nodeRegistry:r,nodeBody:i="full"}=w(),{title:x="Task",descriptorType:s,groupBlocks:n,groups:d,roles:g,groupId:h,roleId:j,infoText:a=""}=o,c=s?r==null?void 0:r.forType(s):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=(n==null?void 0:n.flatMap(u=>u.groups??[]))??[...k(d),...k(g),...k(h),...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 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:[N&&e.jsx("div",{style:{display:"flex",alignItems:"center"},children:N}),e.jsx("span",{className:"ff-text-dark",style:{fontSize:14,fontWeight:400},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(),f(t)},onKeyDown:u=>{u.key==="Enter"&&(u.stopPropagation(),f(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:u=>{u.stopPropagation(),p(t)},onKeyDown:u=>{u.key==="Enter"&&(u.stopPropagation(),p(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})}),a&&e.jsx(T.Tooltip,{title:a,placement:"right",arrow:!0,children:e.jsx("div",{className:"ff-ms-2",children:e.jsx(y.MdInfoOutline,{color:"gray",size:16})})})]})]}),i!=="title-only"&&e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:c!=null&&c.renderNode?c.renderNode(o):P?e.jsx("div",{className:"ff-d-flex ff-flex-wrap ff-gap-1",children:b.map((u,E)=>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},E))}):e.jsx("span",{className:"ff-text-muted",children:"Not configured"})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},W=5,ne=({id:t,data:o})=>{const{onEditNode:f,onDeleteNode:p}=w(),{approvalData:r,isPreview:i=!1,_branchRail:x}=o,s=(r==null?void 0:r.policy)??{},n=s.stages??[],d=n.length,g=n.slice(0,W),h=d-W,j=s.name??s.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-mb-2 ff-justify-content-between ff-align-items-center ff-mx-2 ff-mt-2",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{className:"ff-d-flex ff-align-items-center ff-justify-content-center ff-rounded",style:{width:25,height:25,background:"rgba(251,192,45,0.2)"},children:e.jsx(y.MdCheckCircle,{style:{color:"#FBC02D"},size:16})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:"Approval Policy"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[!i&&e.jsx("div",{role:"button",tabIndex:0,style:{cursor:"pointer"},onClick:a=>{a.stopPropagation(),f(t)},onKeyDown:a=>{a.key==="Enter"&&(a.stopPropagation(),f(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16,className:"ff-text-secondary"})}),!i&&e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,style:{cursor:"pointer"},onClick:a=>{a.stopPropagation(),p(t)},onKeyDown:a=>{a.key==="Enter"&&(a.stopPropagation(),p(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})}),e.jsx(T.Tooltip,{title:"This approval policy determines who must approve a request before the workflow continues.",arrow:!0,placement:"right",children:e.jsx("span",{className:"ff-ms-2 ff-d-inline-flex",children:e.jsx(y.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsxs("div",{className:"ff-p-2 ff-rounded ff-mx-2 ff-mb-2",style:{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:[d," Stage",d!==1?"s":""]})]}),n.length>0?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[g.map((a,c)=>{var E,I,S;const N=((E=a.stageName)==null?void 0:E.trim())||`Stage ${c+1}`,m=Array.isArray(a.userIds)?a.userIds.length:0,k=((I=a.groupName)==null?void 0:I.trim())??"",b=((S=a.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(y.MdPeople,{size:16,className:"ff-flex-shrink-0",style:{color:P?"#5D4037":"#9E9E9E"}}),u]})]})]},c)}),h>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:i?"default":"pointer"},role:i?void 0:"button",tabIndex:i?void 0:0,onClick:a=>{i||(a.stopPropagation(),f(t))},onKeyDown:a=>{i||a.key!=="Enter"||(a.stopPropagation(),f(t))},children:["+ ",h," More Stage",h>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})]})},oe=({id:t,data:o})=>{const{onEditNode:f,onDeleteNode:p}=w(),{duration:r,unit:i}=o,x=r!=null&&i,s=x?`Wait ${r} ${i}`:"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(y.MdSchedule,{size:16,color:"#1976d2"})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:"Delay"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:n=>{n.stopPropagation(),f(t)},onKeyDown:n=>{n.key==="Enter"&&(n.stopPropagation(),f(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:n=>{n.stopPropagation(),p(t)},onKeyDown:n=>{n.key==="Enter"&&(n.stopPropagation(),p(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:e.jsx("span",{className:x?"ff-text-dark ff-fw-medium":"ff-text-muted",children:s})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},F={email:{label:"Email",bg:"#e3f2fd",color:"#1565c0",iconType:y.MdEmail},slack:{label:"Slack",bg:"#e8f5e9",color:"#2e7d32",iconType:y.MdNotifications},teams:{label:"MS Teams",bg:"#ede7f6",color:"#4527a0",iconType:y.MdNotifications},sms:{label:"SMS",bg:"#fce4ec",color:"#880e4f",iconType:y.MdSms},"in-app":{label:"In-App",bg:"#fff3e0",color:"#e65100",iconType:y.MdNotifications},webhook:{label:"Webhook",bg:"#f3e5f5",color:"#6a1b9a",iconType:y.MdWebhook}},ge={label:"Notification",bg:"rgba(156,39,176,0.1)",color:"#7b1fa2",iconType:y.MdNotifications};function ue(t){var o;switch(t.channel){case"email":return((o=t.emailTo)==null?void 0:o.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 ye(t){switch(t.channel){case"email":return t.emailSubject??t.subject??null;case"slack":{const o=t.slackMessage;return o?o.length>60?`${o.slice(0,60)}…`:o:null}case"in-app":return t.inAppTitle??null;default:return t.subject??null}}const ie=({id:t,data:o})=>{const{onEditNode:f,onDeleteNode:p}=w(),r=o,i=r.channel&&F[r.channel]?F[r.channel]:ge,x=ue(r),s=ye(r),n=!!(r.channel&&x),d=i.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 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:i.bg},children:e.jsx(d,{size:16,color:i.color})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:r.channel?`${i.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:g=>{g.stopPropagation(),f(t)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.stopPropagation(),f(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:g=>{g.stopPropagation(),p(t)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.stopPropagation(),p(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:n?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:i.bg,color:i.color,fontWeight:600,flexShrink:0},children:i.label}),e.jsx("span",{className:"ff-text-dark ff-text-truncate",style:{maxWidth:220},children:x})]}),s&&e.jsx("span",{className:"ff-text-muted ff-text-truncate",style:{maxWidth:280},children:s})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured"})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},R={"api-key":"API Key",hmac:"HMAC"},le=({data:t})=>{const{onClickAddTrigger:o}=w(),{label:f="Webhook Trigger",endpointUrl:p,authMethod:r,source:i}=t,x=n=>{n.stopPropagation(),o()},s=n=>{n.stopPropagation(),p&&navigator.clipboard.writeText(p).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 ff-mx-2 ff-mt-2 ff-mb-2",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:28,height:28,borderRadius:6,background:"rgba(33,150,243,0.1)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(y.MdWebhook,{size:16,color:"#1565c0"})}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:"#212121"},children:"Webhook Trigger"})]}),e.jsx("div",{role:"button",tabIndex:0,onClick:x,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&x(n)},className:"ff-d-flex ff-align-items-center",style:{paddingRight:4,cursor:"pointer"},children:e.jsx(y.MdOutlineModeEdit,{size:16,color:"#555"})})]}),e.jsxs("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{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:f}),i&&e.jsx("span",{className:"ff-px-2 ff-py-1 ff-rounded",style:{fontSize:11,background:"#fff",border:"1px solid #90caf9",color:"#1565c0"},children:i}),r&&r!=="none"&&R[r]&&e.jsx("span",{className:"ff-px-2 ff-py-1 ff-rounded",style:{fontSize:10,background:"#1565c0",color:"#fff",fontWeight:600},children:R[r]})]}),p&&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:p}),e.jsx(T.Tooltip,{title:"Copy URL",placement:"top",arrow:!0,children:e.jsx("div",{role:"button",tabIndex:0,onClick:s,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&s(n)},style:{cursor:"pointer",flexShrink:0},children:e.jsx(y.MdContentCopy,{size:12,color:"#1565c0"})})})]})]})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},re=({id:t,data:o})=>{var j;const{onEditNode:f,onDeleteNode:p,nodeRegistry:r}=w(),{method:i,url:x,descriptorType:s}=o,n=s?(j=r==null?void 0:r.forType(s))==null?void 0:j.icon:e.jsx(y.MdHttp,{size:16,color:"#546e7a"}),d=!!(i&&x),g=(i==null?void 0:i.toUpperCase())??"",h=C.HTTP_METHOD_STYLE[g]??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 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",{style:{width:25,height:25,display:"flex",alignItems:"center",justifyContent:"center"},children:n}),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:a=>{a.stopPropagation(),f(t)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.stopPropagation(),f(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),p(t)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.stopPropagation(),p(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:d?e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[h&&e.jsx("span",{style:{fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:4,background:h.bg,color:h.color,flexShrink:0},children:g}),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}})]})},me={eq:"=",neq:"≠",gt:">",gte:"≥",lt:"<",lte:"≤",contains:"contains",startsWith:"starts with",endsWith:"ends with",isEmpty:"is empty",isNotEmpty:"is not empty"},je=({id:t,data:o})=>{const{onEditNode:f,onDeleteNode:p}=w(),{title:r="Condition Branch",branchConfigs:i=[],defaultBranch:x}=o,s=i.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 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",{style:{width:25,height:25,borderRadius:6,background:"rgba(103,58,183,0.1)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(y.MdCallSplit,{size:16,color:"#512da8"})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:r})]}),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(),f(t)},onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.stopPropagation(),f(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:n=>{n.stopPropagation(),p(t)},onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.stopPropagation(),p(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:s?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[i.map((n,d)=>{var a,c;const g=C.BRANCH_PALETTE[d%C.BRANCH_PALETTE.length],h=(a=n.conditions)==null?void 0:a[0],j=(((c=n.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:g.bg,color:g.color,flexShrink:0},children:n.label||n.key}),h?e.jsxs("span",{style:{fontSize:11,color:"#616161",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[h.field," ",me[h.operator]??h.operator,h.value?` ${h.value}`:"",j>0?` +${j} more`:""]}):e.jsx("span",{style:{fontSize:11,color:"#9e9e9e"},children:"No conditions yet"})]},n.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}})]})},be=({id:t,data:o})=>{var a;const{onEditNode:f,onDeleteNode:p,nodeRegistry:r}=w(),{title:i="Sub-Workflow",workflowId:x,workflowLabel:s,descriptorType:n,onPreview:d}=o,g=n?(a=r==null?void 0:r.forType(n))==null?void 0:a.icon:e.jsx(y.MdAccountTree,{size:16,color:"#00695c"}),h=!!x,j=c=>{c.stopPropagation(),x&&d&&d(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 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",{style:{width:25,height:25,borderRadius:6,background:"rgba(0,137,123,0.1)",display:"flex",alignItems:"center",justifyContent:"center"},children:g}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:i})]}),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(),f(t)},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.stopPropagation(),f(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:c=>{c.stopPropagation(),p(t)},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.stopPropagation(),p(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:h?"#e0f2f1":"#fafafa",fontSize:12,border:h?"1px solid #b2dfdb":"none"},children:h?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:s||x}),e.jsxs("span",{style:{fontSize:10,color:"#80cbc4",fontFamily:"monospace"},children:["ID: ",x]})]}),d&&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(y.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}})]})},Ne={startNode:Y,endNode:J,addTriggerNode:Q,addStepNode:pe,triggerNode:X,filterNode:te,actionNode:se,approvalNode:ne,delayNode:oe,notificationNode:ie,webhookTriggerNode:le,restApiNode:re,conditionBranchNode:je,subWorkflowNode:be},ke=11.5,H=2,D=6,$=40,B=20,O=4,ve=({id:t,sourceX:o,sourceY:f,targetX:p,targetY:r,sourcePosition:i,targetPosition:x,source:s,target:n,data:d})=>{const[g,h,j]=l.getStraightPath({sourceX:o,sourceY:f,targetX:p,targetY:r}),a=d==null?void 0:d.label,c=a==="Pass",N=c||a==="Fail",m=o+(p-o)/3,k=f+(r-f)/3,b=o+2*(p-o)/3,P=f+2*(r-f)/3,u=d==null?void 0:d.onAddStepClick,E=z=>{if(z.stopPropagation(),typeof u!="function")return;const fe={edgeId:t,nodeId:s,sourceNodeId:s,targetNodeId:n,position:"between",referenceNodeId:s,referenceNodeType:d==null?void 0:d.referenceNodeType,stepVisibility:d==null?void 0:d.stepVisibility};u(s,fe)},I=z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),E(z))},S=()=>e.jsxs(e.Fragment,{children:[e.jsxs("g",{className:"plus-icon-container",children:[e.jsx("circle",{r:ke,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:E,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:g}),N?e.jsxs(e.Fragment,{children:[e.jsxs("g",{transform:`translate(${m}, ${k})`,children:[e.jsx("rect",{x:-$/2,y:-B/2,width:$,height:B,rx:O,ry:O,fill:c?"#ADE6C5":"#FDBFBF"}),e.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fill:c?"#1DBF60":"#C50000",style:{fontSize:12,fontWeight:500},children:a})]}),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(${h}, ${j})`,"data-testid":"plus-node-icon",...v,children:e.jsx(S,{})})]})},we=11.5,_=2,A=6,Se=({id:t,sourceX:o,sourceY:f,targetX:p,targetY:r,source:i,target:x,data:s})=>{const[n,d,g]=l.getStraightPath({sourceX:o,sourceY:f,targetX:p,targetY:r}),h=s==null?void 0:s.onAddStepClick,j=c=>{c.stopPropagation(),typeof h=="function"&&h(i,{edgeId:t,nodeId:i,sourceNodeId:i,targetNodeId:x,position:"between",referenceNodeId:i,referenceNodeType:s==null?void 0:s.referenceNodeType,stepVisibility:s==null?void 0:s.stepVisibility,filterId:s==null?void 0:s.filterId,branch:s==null?void 0:s.branch})},a=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:n,style:{stroke:"#b0bec5"}}),e.jsxs("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${d}, ${g})`,style:{cursor:h?"pointer":"default",pointerEvents:"all",outline:"none"},onClick:h?j:void 0,onKeyDown:h?a:void 0,role:h?"button":void 0,tabIndex:h?0:void 0,"data-testid":"plus-node-icon",children:[e.jsx("circle",{r:we,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"})]})]})]})},Ee=({id:t,sourceX:o,sourceY:f,targetX:p,targetY:r})=>{const[i]=l.getStraightPath({sourceX:o,sourceY:f,targetX:p,targetY:r});return e.jsx(l.BaseEdge,{id:t,path:i,style:{stroke:"#b0bec5"}})},Pe=11.5,K=2,M=6,Te=-24,U=40,q=20,G=4,Ce=({id:t,sourceX:o,sourceY:f,targetX:p,targetY:r,source:i,target:x,data:s})=>{const[n,d,g]=l.getStraightPath({sourceX:o,sourceY:f,targetX:p,targetY:r}),h=s==null?void 0:s.label,j=h==="Pass",a=j||h==="Fail",c=s==null?void 0:s.onAddStepClick,N=(s==null?void 0:s.showPlus)!==!1&&!!c,m=b=>{b.stopPropagation(),typeof c=="function"&&c(i,{edgeId:t,nodeId:i,sourceNodeId:i,targetNodeId:x,position:"between",referenceNodeId:i,referenceNodeType:s==null?void 0:s.referenceNodeType,stepVisibility:s==null?void 0:s.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:n,style:{stroke:"#b0bec5"}}),e.jsxs("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${d}, ${g})`,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:[a&&e.jsxs("g",{transform:`translate(0, ${N?Te: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:h})]}),N&&e.jsxs("g",{className:"plus-icon-container",children:[e.jsx("circle",{r:Pe,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-M,x2:0,y2:M,strokeWidth:K,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-M,y1:0,x2:M,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"})]})]})]})},Ie=({id:t,source:o,target:f,sourceX:p,sourceY:r,targetX:i,targetY:x,style:s={},markerEnd:n,data:d})=>{const g=(d==null?void 0:d.verticalRouting)??!1,h=30,j=g?(()=>{const v=x-h;return`M ${p},${v} L ${i},${v} L ${i},${x}`})():(()=>{const v=r+30;return`M ${p},${r} L ${p},${v} L ${i},${v} L ${i},${x}`})(),a=s.stroke||"#d1d5db",c=d==null?void 0:d.label,N=(d==null?void 0:d.isFirst)??!1,m=d==null?void 0:d.onAddStepClick,k=g?x-h:r+30,b=p+(i-p)*(g?.25:.35),P=p+(i-p)*(g?.65:.7),u=k,E=v=>{v.stopPropagation(),m&&m(o,{edgeId:t,nodeId:o,sourceNodeId:o,targetNodeId:f,position:"between",referenceNodeId:o,filterId:d==null?void 0:d.filterId,branch:d==null?void 0:d.branch})},I=11.5,S=6;return e.jsxs("g",{children:[e.jsx("path",{id:t,d:j,fill:"none",stroke:a,strokeWidth:1.5,markerEnd:n}),c&&!g&&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:E,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=se;exports.AddTriggerNode=Q;exports.ApprovalNode=ne;exports.DelayNode=oe;exports.EdgeWithPlusLabel=ve;exports.EndNode=J;exports.FilterNode=te;exports.GatewayBranchEdge=Ie;exports.LabelPlusEdge=Ce;exports.NotificationNode=ie;exports.PlainEdge=Ee;exports.PlusEdge=Se;exports.RestApiNode=re;exports.StartNode=Y;exports.TriggerNode=X;exports.WebhookTriggerNode=le;exports.WorkflowCanvasContext=Z;exports.builtInNodeTypes=Ne;
1
+ "use strict";const e=require("react/jsx-runtime"),l=require("reactflow"),T=require("@mui/material"),ce=require("react-icons/gr"),V=require("react"),de=require("./messages-O9Tw_XXR.js"),y=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:de.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:o}=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(T.Tooltip,{title:o.addTriggerTooltip,placement:"top",arrow:!0,children:e.jsxs("div",{onClick:t,role:"button",tabIndex:0,onKeyDown:f=>{f.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:o.addTriggerButton})]})}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0,left:"50%"}})]})},pe=({id:t})=>{const{onAddStep:o}=w();return e.jsxs("div",{onClick:()=>o(t),role:"button",tabIndex:0,onKeyDown:f=>{f.key==="Enter"&&o(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,o=>o.toUpperCase()):""}function he(t){const o=typeof t=="string"?t:t.value??"";return o==="SIGNUP_FLOW"?"User Self-Registration":o==="ADMIN_CREATION_FLOW"?"Create User via Admin Portal":o==="SHEDULAR"?"Scheduler":typeof t!="string"&&t.label?t.label:o.replace(/[_-]+/g," ").replace(/\b\w/g,f=>f.toUpperCase())}const X=({data:t})=>{const{onClickAddTrigger:o}=w(),{type:f,eventType:p,sources:r,label:i,source:x,previewWorkflow:s,executionStatus:n,infoText:d="This node decides the flow trigger type and configuration."}=t??{},g=m=>{m==null||m.stopPropagation(),o()},h=Array.isArray(r)&&r.length>0,j=!!(i||x),a=f==="scheduler"?"Scheduler Trigger":f==="event"||h||j?"Event Trigger Source":"Select Trigger",c=f==="scheduler"?e.jsx("span",{children:"Scheduler to be configured"}):f==="event"||h?e.jsxs("div",{children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[e.jsx("span",{style:{fontWeight:600},children:xe(p)}),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:h?r.map((m,k)=>e.jsx(T.Chip,{label:he(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:[i&&e.jsx("span",{style:{fontWeight:600},children:i}),x&&e.jsx(T.Chip,{label:x,variant:"outlined",size:"small"})]}):e.jsx("span",{role:"button",tabIndex:0,onClick:g,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&g(m)},style:{cursor:"pointer",color:"#1e88e5"},children:"Click to select a trigger to start your workflow"}),N=n?e.jsxs(e.Fragment,{children:[n.status==="success"&&e.jsx(L.FaCheckCircle,{size:16,color:"#1DBF60",style:{marginRight:8}}),n.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:[!s&&e.jsx("div",{role:"button",tabIndex:0,onClick:g,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&g(m)},className:"ff-me-2",style:{cursor:"pointer",color:"#212121"},"aria-label":"Edit trigger",children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx(T.Tooltip,{title:e.jsx("div",{children:d}),placement:"right",arrow:!0,children:e.jsx("span",{children:e.jsx(y.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(y.MdInput,{size:16,color:"#388e3c"})}),e.jsx("span",{style:{fontSize:14,fontWeight:600,color:"#212121"},children:a})]}),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 12px 12px",borderRadius:6},children:c})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0},id:"1"})]})},ee=({rail:t,cardWidth:o})=>{const f=o/2;o/2+t.indent;const p="var(--ff-edge-color, #b0bec5)";return e.jsxs("svg",{width:o+t.indent+200,height:t.height,style:{position:"absolute",left:0,top:"100%",pointerEvents:"none",overflow:"visible"},children:[e.jsx("line",{x1:f,y1:0,x2:f,y2:t.height,stroke:p,strokeWidth:1.5}),t.branches.map((r,i)=>{const x=r.y;return e.jsxs("g",{transform:`translate(0, ${x})`,children:[e.jsx("rect",{x:f-5,y:-5,width:10,height:10,fill:"#fff",stroke:p,strokeWidth:1.5,transform:`rotate(45, ${f}, 0)`}),e.jsx("text",{x:f+14,y:4,fontSize:12,fontWeight:500,fill:"var(--ff-text, #212121)",style:{fontFamily:"sans-serif"},children:r.label})]},i)})]})},te=({id:t,data:o})=>{const{onEditNode:f,onDeleteNode:p}=w(),{conditions:r=[],infoText:i="Filter conditions applied to workflow data",_branchRail:x}=o;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-mb-2 ff-justify-content-between ff-align-items-center ff-mx-2 ff-mt-2",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:s=>{s.stopPropagation(),f(t)},onKeyDown:s=>{s.key==="Enter"&&(s.stopPropagation(),f(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:s=>{s.stopPropagation(),p(t)},onKeyDown:s=>{s.key==="Enter"&&(s.stopPropagation(),p(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})}),e.jsx(T.Tooltip,{title:i,placement:"right",arrow:!0,children:e.jsx("div",{className:"ff-ms-2",children:e.jsx(y.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsx("div",{className:"ff-p-2 ff-mx-2 ff-mb-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:r.length===0?e.jsx("span",{className:"ff-text-muted",children:"No conditions configured"}):r.map((s,n)=>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:s.field,children:s.field}),e.jsx("span",{className:"ff-text-muted",children:s.operator}),e.jsx("p",{className:"ff-text-dark ff-text-truncate ff-mx-1 ff-m-0",title:s.value,children:s.value}),n<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:s.logicalOperator})]},n))})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}}),x&&e.jsx(ee,{rail:x,cardWidth:350})]})},se=({id:t,data:o})=>{const{onEditNode:f,onDeleteNode:p,nodeRegistry:r,nodeBody:i="full"}=w(),{title:x="Task",descriptorType:s,groupBlocks:n,groups:d,roles:g,groupId:h,roleId:j,infoText:a=""}=o,c=s?r==null?void 0:r.forType(s):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=(n==null?void 0:n.flatMap(u=>u.groups??[]))??[...k(d),...k(g),...k(h),...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 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:[N&&e.jsx("div",{style:{display:"flex",alignItems:"center"},children:N}),e.jsx("span",{className:"ff-text-dark",style:{fontSize:14,fontWeight:600},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(),f(t)},onKeyDown:u=>{u.key==="Enter"&&(u.stopPropagation(),f(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:u=>{u.stopPropagation(),p(t)},onKeyDown:u=>{u.key==="Enter"&&(u.stopPropagation(),p(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})}),a&&e.jsx(T.Tooltip,{title:a,placement:"right",arrow:!0,children:e.jsx("div",{className:"ff-ms-2",children:e.jsx(y.MdInfoOutline,{color:"gray",size:16})})})]})]}),i!=="title-only"&&e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:c!=null&&c.renderNode?c.renderNode(o):P?e.jsx("div",{className:"ff-d-flex ff-flex-wrap ff-gap-1",children:b.map((u,E)=>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},E))}):e.jsx("span",{className:"ff-text-muted",children:"Not configured"})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},W=5,ne=({id:t,data:o})=>{const{onEditNode:f,onDeleteNode:p}=w(),{approvalData:r,isPreview:i=!1,_branchRail:x}=o,s=(r==null?void 0:r.policy)??{},n=s.stages??[],d=n.length,g=n.slice(0,W),h=d-W,j=s.name??s.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-mb-2 ff-justify-content-between ff-align-items-center ff-mx-2 ff-mt-2",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{className:"ff-d-flex ff-align-items-center ff-justify-content-center ff-rounded",style:{width:25,height:25,background:"rgba(251,192,45,0.2)"},children:e.jsx(y.MdCheckCircle,{style:{color:"#FBC02D"},size:16})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:"Approval Policy"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[!i&&e.jsx("div",{role:"button",tabIndex:0,style:{cursor:"pointer"},onClick:a=>{a.stopPropagation(),f(t)},onKeyDown:a=>{a.key==="Enter"&&(a.stopPropagation(),f(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16,className:"ff-text-secondary"})}),!i&&e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,style:{cursor:"pointer"},onClick:a=>{a.stopPropagation(),p(t)},onKeyDown:a=>{a.key==="Enter"&&(a.stopPropagation(),p(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})}),e.jsx(T.Tooltip,{title:"This approval policy determines who must approve a request before the workflow continues.",arrow:!0,placement:"right",children:e.jsx("span",{className:"ff-ms-2 ff-d-inline-flex",children:e.jsx(y.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsxs("div",{className:"ff-p-2 ff-rounded ff-mx-2 ff-mb-2",style:{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:[d," Stage",d!==1?"s":""]})]}),n.length>0?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[g.map((a,c)=>{var E,I,S;const N=((E=a.stageName)==null?void 0:E.trim())||`Stage ${c+1}`,m=Array.isArray(a.userIds)?a.userIds.length:0,k=((I=a.groupName)==null?void 0:I.trim())??"",b=((S=a.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(y.MdPeople,{size:16,className:"ff-flex-shrink-0",style:{color:P?"#5D4037":"#9E9E9E"}}),u]})]})]},c)}),h>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:i?"default":"pointer"},role:i?void 0:"button",tabIndex:i?void 0:0,onClick:a=>{i||(a.stopPropagation(),f(t))},onKeyDown:a=>{i||a.key!=="Enter"||(a.stopPropagation(),f(t))},children:["+ ",h," More Stage",h>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})]})},oe=({id:t,data:o})=>{const{onEditNode:f,onDeleteNode:p}=w(),{duration:r,unit:i}=o,x=r!=null&&i,s=x?`Wait ${r} ${i}`:"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(y.MdSchedule,{size:16,color:"#1976d2"})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:"Delay"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:n=>{n.stopPropagation(),f(t)},onKeyDown:n=>{n.key==="Enter"&&(n.stopPropagation(),f(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:n=>{n.stopPropagation(),p(t)},onKeyDown:n=>{n.key==="Enter"&&(n.stopPropagation(),p(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:e.jsx("span",{className:x?"ff-text-dark ff-fw-medium":"ff-text-muted",children:s})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},F={email:{label:"Email",bg:"#e3f2fd",color:"#1565c0",iconType:y.MdEmail},slack:{label:"Slack",bg:"#e8f5e9",color:"#2e7d32",iconType:y.MdNotifications},teams:{label:"MS Teams",bg:"#ede7f6",color:"#4527a0",iconType:y.MdNotifications},sms:{label:"SMS",bg:"#fce4ec",color:"#880e4f",iconType:y.MdSms},"in-app":{label:"In-App",bg:"#fff3e0",color:"#e65100",iconType:y.MdNotifications},webhook:{label:"Webhook",bg:"#f3e5f5",color:"#6a1b9a",iconType:y.MdWebhook}},ge={label:"Notification",bg:"rgba(156,39,176,0.1)",color:"#7b1fa2",iconType:y.MdNotifications};function ue(t){var o;switch(t.channel){case"email":return((o=t.emailTo)==null?void 0:o.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 ye(t){switch(t.channel){case"email":return t.emailSubject??t.subject??null;case"slack":{const o=t.slackMessage;return o?o.length>60?`${o.slice(0,60)}…`:o:null}case"in-app":return t.inAppTitle??null;default:return t.subject??null}}const ie=({id:t,data:o})=>{const{onEditNode:f,onDeleteNode:p}=w(),r=o,i=r.channel&&F[r.channel]?F[r.channel]:ge,x=ue(r),s=ye(r),n=!!(r.channel&&x),d=i.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 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:i.bg},children:e.jsx(d,{size:16,color:i.color})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:r.channel?`${i.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:g=>{g.stopPropagation(),f(t)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.stopPropagation(),f(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:g=>{g.stopPropagation(),p(t)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.stopPropagation(),p(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:n?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:i.bg,color:i.color,fontWeight:600,flexShrink:0},children:i.label}),e.jsx("span",{className:"ff-text-dark ff-text-truncate",style:{maxWidth:220},children:x})]}),s&&e.jsx("span",{className:"ff-text-muted ff-text-truncate",style:{maxWidth:280},children:s})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured"})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},R={"api-key":"API Key",hmac:"HMAC"},le=({data:t})=>{const{onClickAddTrigger:o}=w(),{label:f="Webhook Trigger",endpointUrl:p,authMethod:r,source:i}=t,x=n=>{n.stopPropagation(),o()},s=n=>{n.stopPropagation(),p&&navigator.clipboard.writeText(p).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 ff-mx-2 ff-mt-2 ff-mb-2",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:28,height:28,borderRadius:6,background:"rgba(33,150,243,0.1)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(y.MdWebhook,{size:16,color:"#1565c0"})}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:"#212121"},children:"Webhook Trigger"})]}),e.jsx("div",{role:"button",tabIndex:0,onClick:x,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&x(n)},className:"ff-d-flex ff-align-items-center",style:{paddingRight:4,cursor:"pointer"},children:e.jsx(y.MdOutlineModeEdit,{size:16,color:"#555"})})]}),e.jsxs("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{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:f}),i&&e.jsx("span",{className:"ff-px-2 ff-py-1 ff-rounded",style:{fontSize:11,background:"#fff",border:"1px solid #90caf9",color:"#1565c0"},children:i}),r&&r!=="none"&&R[r]&&e.jsx("span",{className:"ff-px-2 ff-py-1 ff-rounded",style:{fontSize:10,background:"#1565c0",color:"#fff",fontWeight:600},children:R[r]})]}),p&&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:p}),e.jsx(T.Tooltip,{title:"Copy URL",placement:"top",arrow:!0,children:e.jsx("div",{role:"button",tabIndex:0,onClick:s,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&s(n)},style:{cursor:"pointer",flexShrink:0},children:e.jsx(y.MdContentCopy,{size:12,color:"#1565c0"})})})]})]})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},re=({id:t,data:o})=>{var j;const{onEditNode:f,onDeleteNode:p,nodeRegistry:r}=w(),{method:i,url:x,descriptorType:s}=o,n=s?(j=r==null?void 0:r.forType(s))==null?void 0:j.icon:e.jsx(y.MdHttp,{size:16,color:"#546e7a"}),d=!!(i&&x),g=(i==null?void 0:i.toUpperCase())??"",h=C.HTTP_METHOD_STYLE[g]??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 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",{style:{width:25,height:25,display:"flex",alignItems:"center",justifyContent:"center"},children:n}),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:a=>{a.stopPropagation(),f(t)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.stopPropagation(),f(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),p(t)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.stopPropagation(),p(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:d?e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[h&&e.jsx("span",{style:{fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:4,background:h.bg,color:h.color,flexShrink:0},children:g}),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}})]})},me={eq:"=",neq:"≠",gt:">",gte:"≥",lt:"<",lte:"≤",contains:"contains",startsWith:"starts with",endsWith:"ends with",isEmpty:"is empty",isNotEmpty:"is not empty"},je=({id:t,data:o})=>{const{onEditNode:f,onDeleteNode:p}=w(),{title:r="Condition Branch",branchConfigs:i=[],defaultBranch:x}=o,s=i.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 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",{style:{width:25,height:25,borderRadius:6,background:"rgba(103,58,183,0.1)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(y.MdCallSplit,{size:16,color:"#512da8"})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:r})]}),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(),f(t)},onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.stopPropagation(),f(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:n=>{n.stopPropagation(),p(t)},onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.stopPropagation(),p(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:s?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[i.map((n,d)=>{var a,c;const g=C.BRANCH_PALETTE[d%C.BRANCH_PALETTE.length],h=(a=n.conditions)==null?void 0:a[0],j=(((c=n.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:g.bg,color:g.color,flexShrink:0},children:n.label||n.key}),h?e.jsxs("span",{style:{fontSize:11,color:"#616161",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[h.field," ",me[h.operator]??h.operator,h.value?` ${h.value}`:"",j>0?` +${j} more`:""]}):e.jsx("span",{style:{fontSize:11,color:"#9e9e9e"},children:"No conditions yet"})]},n.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}})]})},be=({id:t,data:o})=>{var a;const{onEditNode:f,onDeleteNode:p,nodeRegistry:r}=w(),{title:i="Sub-Workflow",workflowId:x,workflowLabel:s,descriptorType:n,onPreview:d}=o,g=n?(a=r==null?void 0:r.forType(n))==null?void 0:a.icon:e.jsx(y.MdAccountTree,{size:16,color:"#00695c"}),h=!!x,j=c=>{c.stopPropagation(),x&&d&&d(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 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",{style:{width:25,height:25,borderRadius:6,background:"rgba(0,137,123,0.1)",display:"flex",alignItems:"center",justifyContent:"center"},children:g}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:i})]}),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(),f(t)},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.stopPropagation(),f(t))},children:e.jsx(y.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:c=>{c.stopPropagation(),p(t)},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.stopPropagation(),p(t))},children:e.jsx(y.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:h?"#e0f2f1":"#fafafa",fontSize:12,border:h?"1px solid #b2dfdb":"none"},children:h?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:s||x}),e.jsxs("span",{style:{fontSize:10,color:"#80cbc4",fontFamily:"monospace"},children:["ID: ",x]})]}),d&&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(y.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}})]})},Ne={startNode:Y,endNode:J,addTriggerNode:Q,addStepNode:pe,triggerNode:X,filterNode:te,actionNode:se,approvalNode:ne,delayNode:oe,notificationNode:ie,webhookTriggerNode:le,restApiNode:re,conditionBranchNode:je,subWorkflowNode:be},ke=11.5,H=2,D=6,$=40,B=20,O=4,ve=({id:t,sourceX:o,sourceY:f,targetX:p,targetY:r,sourcePosition:i,targetPosition:x,source:s,target:n,data:d})=>{const[g,h,j]=l.getStraightPath({sourceX:o,sourceY:f,targetX:p,targetY:r}),a=d==null?void 0:d.label,c=a==="Pass",N=c||a==="Fail",m=o+(p-o)/3,k=f+(r-f)/3,b=o+2*(p-o)/3,P=f+2*(r-f)/3,u=d==null?void 0:d.onAddStepClick,E=z=>{if(z.stopPropagation(),typeof u!="function")return;const fe={edgeId:t,nodeId:s,sourceNodeId:s,targetNodeId:n,position:"between",referenceNodeId:s,referenceNodeType:d==null?void 0:d.referenceNodeType,stepVisibility:d==null?void 0:d.stepVisibility};u(s,fe)},I=z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),E(z))},S=()=>e.jsxs(e.Fragment,{children:[e.jsxs("g",{className:"plus-icon-container",children:[e.jsx("circle",{r:ke,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:E,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:g}),N?e.jsxs(e.Fragment,{children:[e.jsxs("g",{transform:`translate(${m}, ${k})`,children:[e.jsx("rect",{x:-$/2,y:-B/2,width:$,height:B,rx:O,ry:O,fill:c?"#ADE6C5":"#FDBFBF"}),e.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fill:c?"#1DBF60":"#C50000",style:{fontSize:12,fontWeight:500},children:a})]}),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(${h}, ${j})`,"data-testid":"plus-node-icon",...v,children:e.jsx(S,{})})]})},we=11.5,_=2,A=6,Se=({id:t,sourceX:o,sourceY:f,targetX:p,targetY:r,source:i,target:x,data:s})=>{const[n,d,g]=l.getStraightPath({sourceX:o,sourceY:f,targetX:p,targetY:r}),h=s==null?void 0:s.onAddStepClick,j=c=>{c.stopPropagation(),typeof h=="function"&&h(i,{edgeId:t,nodeId:i,sourceNodeId:i,targetNodeId:x,position:"between",referenceNodeId:i,referenceNodeType:s==null?void 0:s.referenceNodeType,stepVisibility:s==null?void 0:s.stepVisibility,filterId:s==null?void 0:s.filterId,branch:s==null?void 0:s.branch})},a=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:n,style:{stroke:"#b0bec5"}}),e.jsxs("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${d}, ${g})`,style:{cursor:h?"pointer":"default",pointerEvents:"all",outline:"none"},onClick:h?j:void 0,onKeyDown:h?a:void 0,role:h?"button":void 0,tabIndex:h?0:void 0,"data-testid":"plus-node-icon",children:[e.jsx("circle",{r:we,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"})]})]})]})},Ee=({id:t,sourceX:o,sourceY:f,targetX:p,targetY:r})=>{const[i]=l.getStraightPath({sourceX:o,sourceY:f,targetX:p,targetY:r});return e.jsx(l.BaseEdge,{id:t,path:i,style:{stroke:"#b0bec5"}})},Pe=11.5,K=2,M=6,Te=-24,U=40,q=20,G=4,Ce=({id:t,sourceX:o,sourceY:f,targetX:p,targetY:r,source:i,target:x,data:s})=>{const[n,d,g]=l.getStraightPath({sourceX:o,sourceY:f,targetX:p,targetY:r}),h=s==null?void 0:s.label,j=h==="Pass",a=j||h==="Fail",c=s==null?void 0:s.onAddStepClick,N=(s==null?void 0:s.showPlus)!==!1&&!!c,m=b=>{b.stopPropagation(),typeof c=="function"&&c(i,{edgeId:t,nodeId:i,sourceNodeId:i,targetNodeId:x,position:"between",referenceNodeId:i,referenceNodeType:s==null?void 0:s.referenceNodeType,stepVisibility:s==null?void 0:s.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:n,style:{stroke:"#b0bec5"}}),e.jsxs("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${d}, ${g})`,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:[a&&e.jsxs("g",{transform:`translate(0, ${N?Te: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:h})]}),N&&e.jsxs("g",{className:"plus-icon-container",children:[e.jsx("circle",{r:Pe,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-M,x2:0,y2:M,strokeWidth:K,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-M,y1:0,x2:M,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"})]})]})]})},Ie=({id:t,source:o,target:f,sourceX:p,sourceY:r,targetX:i,targetY:x,style:s={},markerEnd:n,data:d})=>{const g=(d==null?void 0:d.verticalRouting)??!1,h=30,j=g?(()=>{const v=x-h;return`M ${p},${v} L ${i},${v} L ${i},${x}`})():(()=>{const v=r+30;return`M ${p},${r} L ${p},${v} L ${i},${v} L ${i},${x}`})(),a=s.stroke||"#d1d5db",c=d==null?void 0:d.label,N=(d==null?void 0:d.isFirst)??!1,m=d==null?void 0:d.onAddStepClick,k=g?x-h:r+30,b=p+(i-p)*(g?.25:.35),P=p+(i-p)*(g?.65:.7),u=k,E=v=>{v.stopPropagation(),m&&m(o,{edgeId:t,nodeId:o,sourceNodeId:o,targetNodeId:f,position:"between",referenceNodeId:o,filterId:d==null?void 0:d.filterId,branch:d==null?void 0:d.branch})},I=11.5,S=6;return e.jsxs("g",{children:[e.jsx("path",{id:t,d:j,fill:"none",stroke:a,strokeWidth:1.5,markerEnd:n}),c&&!g&&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:E,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=se;exports.AddTriggerNode=Q;exports.ApprovalNode=ne;exports.DelayNode=oe;exports.EdgeWithPlusLabel=ve;exports.EndNode=J;exports.FilterNode=te;exports.GatewayBranchEdge=Ie;exports.LabelPlusEdge=Ce;exports.NotificationNode=ie;exports.PlainEdge=Ee;exports.PlusEdge=Se;exports.RestApiNode=re;exports.StartNode=Y;exports.TriggerNode=X;exports.WebhookTriggerNode=le;exports.WorkflowCanvasContext=Z;exports.builtInNodeTypes=Ne;
@@ -159,7 +159,7 @@ const Ae = ({ data: t }) => {
159
159
  children: /* @__PURE__ */ e(de, { size: 16, color: "#388e3c" })
160
160
  }
161
161
  ),
162
- /* @__PURE__ */ e("span", { style: { fontSize: 14, fontWeight: 500, color: "#212121" }, children: a })
162
+ /* @__PURE__ */ e("span", { style: { fontSize: 14, fontWeight: 600, color: "#212121" }, children: a })
163
163
  ] }),
164
164
  /* @__PURE__ */ e("div", { className: "ff-d-flex ff-align-items-center", children: v })
165
165
  ] }),
@@ -286,7 +286,7 @@ const Ae = ({ data: t }) => {
286
286
  /* @__PURE__ */ n("div", { className: "ff-d-flex ff-justify-content-between ff-align-items-center ff-mx-2 ff-mt-2 ff-mb-1", children: [
287
287
  /* @__PURE__ */ n("div", { className: "ff-d-flex ff-align-items-center ff-gap-2", children: [
288
288
  v && /* @__PURE__ */ e("div", { style: { display: "flex", alignItems: "center" }, children: v }),
289
- /* @__PURE__ */ e("span", { className: "ff-text-dark", style: { fontSize: 14, fontWeight: 400 }, children: h })
289
+ /* @__PURE__ */ e("span", { className: "ff-text-dark", style: { fontSize: 14, fontWeight: 600 }, children: h })
290
290
  ] }),
291
291
  /* @__PURE__ */ n("div", { className: "node-actions ff-d-flex ff-align-items-center", children: [
292
292
  /* @__PURE__ */ e(
@@ -1,6 +1,6 @@
1
1
  import { useState as E, useRef as G, useEffect as me, useCallback as be, useMemo as ue } from "react";
2
2
  import { useFormik as Pt } from "formik";
3
- import { A as Lt, F as ze, n as Vt, j as qt, l as Wt, B as ot, f as De, a as We, t as Ke, T as Ut, c as Bt, V as Zt } from "./index-DO5qci03.js";
3
+ import { A as Lt, F as ze, n as Vt, j as qt, l as Wt, B as ot, f as De, a as We, t as Ke, T as Ut, c as Bt, V as Zt } from "./index-D6g2IXSf.js";
4
4
  import { jsxs as f, jsx as l, Fragment as Te } from "react/jsx-runtime";
5
5
  import { Box as d, Collapse as Ht, Tooltip as te, Dialog as ct, Typography as A, IconButton as Fe, Stepper as Yt, Step as Gt, StepLabel as Jt, Drawer as Kt, Chip as Xt, Divider as Qt } from "@mui/material";
6
6
  import { MdSearch as ut, MdClose as re, MdCheck as Ee, MdAdd as _e, MdArrowBack as dt, MdEdit as er, MdDeleteOutline as tr, MdSettings as ft, MdArrowForward as rr } from "react-icons/md";
@@ -1,4 +1,4 @@
1
- "use strict";const b=require("react"),wt=require("formik"),B=require("./index-BSP3H9Cn.js"),n=require("react/jsx-runtime"),o=require("@mui/material"),E=require("react-icons/md"),kt=require("react-icons/fa6"),Tt=require("./_commonjsHelpers-DKOUU3wS.js");function oe(r){this._maxSize=r,this.clear()}oe.prototype.clear=function(){this._size=0,this._values=Object.create(null)};oe.prototype.get=function(r){return this._values[r]};oe.prototype.set=function(r,e){return this._size>=this._maxSize&&this.clear(),r in this._values||this._size++,this._values[r]=e};var Ct=/[^.^\]^[]+|(?=\[\]|\.\.)/g,Ye=/^\d+$/,Ft=/^\d/,Ot=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,Et=/^\s*(['"]?)(.*?)(\1)\s*$/,Ne=512,De=new oe(Ne);new oe(Ne);var Me=new oe(Ne),re={split:Fe,normalizePath:Pe,getter:function(r,e){var t=Pe(r);return Me.get(r)||Me.set(r,function(i){for(var l=0,a=t.length;l<a;)if(i!=null||!e)i=i[t[l++]];else return;return i})},join:function(r){return r.reduce(function(e,t){return e+(Ae(t)||Ye.test(t)?"["+t+"]":(e?".":"")+t)},"")},forEach:function(r,e,t){$t(Array.isArray(r)?r:Fe(r),e,t)}};function Pe(r){return De.get(r)||De.set(r,Fe(r).map(function(e){return e.replace(Et,"$2")}))}function Fe(r){return r.match(Ct)||[""]}function $t(r,e,t){var s=r.length,i,l,a,c;for(l=0;l<s;l++)i=r[l],i&&(Nt(i)&&(i='"'+i+'"'),c=Ae(i),a=!c&&/^\d+$/.test(i),e.call(t,i,c,a,l,r))}function Ae(r){return typeof r=="string"&&r&&["'",'"'].indexOf(r.charAt(0))!==-1}function _t(r){return r.match(Ft)&&!r.match(Ye)}function Bt(r){return Ot.test(r)}function Nt(r){return!Ae(r)&&(_t(r)||Bt(r))}const At=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,Ge=r=>r.match(At)||[],Rt=(r,e)=>Ge(r).join(e).toLowerCase(),zt=r=>Ge(r).reduce((e,t)=>`${e}${e?t[0].toUpperCase()+t.slice(1).toLowerCase():t.toLowerCase()}`,""),It=r=>Rt(r,"_");var Te={camelCase:zt,snakeCase:It},Re={exports:{}};Re.exports=function(r){return Je(Dt(r),r)};Re.exports.array=Je;function Je(r,e){var t=r.length,s=new Array(t),i={},l=t,a=Mt(e),c=Pt(r);for(e.forEach(function(f){if(!c.has(f[0])||!c.has(f[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});l--;)i[l]||u(r[l],l,new Set);return s;function u(f,h,x){if(x.has(f)){var p;try{p=", node was:"+JSON.stringify(f)}catch{p=""}throw new Error("Cyclic dependency"+p)}if(!c.has(f))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(f));if(!i[h]){i[h]=!0;var d=a.get(f)||new Set;if(d=Array.from(d),h=d.length){x.add(f);do{var g=d[--h];u(g,c.get(g),x)}while(h);x.delete(f)}s[--t]=f}}}function Dt(r){for(var e=new Set,t=0,s=r.length;t<s;t++){var i=r[t];e.add(i[0]),e.add(i[1])}return Array.from(e)}function Mt(r){for(var e=new Map,t=0,s=r.length;t<s;t++){var i=r[t];e.has(i[0])||e.set(i[0],new Set),e.has(i[1])||e.set(i[1],new Set),e.get(i[0]).add(i[1])}return e}function Pt(r){for(var e=new Map,t=0,s=r.length;t<s;t++)e.set(r[t],t);return e}var Lt=Re.exports;const qt=Tt.getDefaultExportFromCjs(Lt),Vt=Object.prototype.toString,Wt=Error.prototype.toString,Ut=RegExp.prototype.toString,Zt=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Ht=/^Symbol\((.*)\)(.*)$/;function Yt(r){return r!=+r?"NaN":r===0&&1/r<0?"-0":""+r}function Le(r,e=!1){if(r==null||r===!0||r===!1)return""+r;const t=typeof r;if(t==="number")return Yt(r);if(t==="string")return e?`"${r}"`:r;if(t==="function")return"[Function "+(r.name||"anonymous")+"]";if(t==="symbol")return Zt.call(r).replace(Ht,"Symbol($1)");const s=Vt.call(r).slice(8,-1);return s==="Date"?isNaN(r.getTime())?""+r:r.toISOString(r):s==="Error"||r instanceof Error?"["+Wt.call(r)+"]":s==="RegExp"?Ut.call(r):null}function J(r,e){let t=Le(r,e);return t!==null?t:JSON.stringify(r,function(s,i){let l=Le(this[s],e);return l!==null?l:i},2)}function Ke(r){return r==null?[]:[].concat(r)}let Xe,Qe,et,Gt=/\$\{\s*(\w+)\s*\}/g;Xe=Symbol.toStringTag;class qe{constructor(e,t,s,i){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[Xe]="Error",this.name="ValidationError",this.value=t,this.path=s,this.type=i,this.errors=[],this.inner=[],Ke(e).forEach(l=>{if(I.isError(l)){this.errors.push(...l.errors);const a=l.inner.length?l.inner:[l];this.inner.push(...a)}else this.errors.push(l)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}Qe=Symbol.hasInstance;et=Symbol.toStringTag;class I extends Error{static formatError(e,t){const s=t.label||t.path||"this";return t=Object.assign({},t,{path:s,originalPath:t.path}),typeof e=="string"?e.replace(Gt,(i,l)=>J(t[l])):typeof e=="function"?e(t):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,t,s,i,l){const a=new qe(e,t,s,i);if(l)return a;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[et]="Error",this.name=a.name,this.message=a.message,this.type=a.type,this.value=a.value,this.path=a.path,this.errors=a.errors,this.inner=a.inner,Error.captureStackTrace&&Error.captureStackTrace(this,I)}static[Qe](e){return qe[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Y={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:r,type:e,value:t,originalValue:s})=>{const i=s!=null&&s!==t?` (cast from the value \`${J(s,!0)}\`).`:".";return e!=="mixed"?`${r} must be a \`${e}\` type, but the final value was: \`${J(t,!0)}\``+i:`${r} must match the configured type. The validated value was: \`${J(t,!0)}\``+i}},M={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Q={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},Oe={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Ee={isValue:"${path} field must be ${value}"},he={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},xe={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},Jt={notType:r=>{const{path:e,value:t,spec:s}=r,i=s.types.length;if(Array.isArray(t)){if(t.length<i)return`${e} tuple value has too few items, expected a length of ${i} but got ${t.length} for value: \`${J(t,!0)}\``;if(t.length>i)return`${e} tuple value has too many items, expected a length of ${i} but got ${t.length} for value: \`${J(t,!0)}\``}return I.formatError(Y.notType,r)}};Object.assign(Object.create(null),{mixed:Y,string:M,number:Q,date:Oe,object:he,array:xe,boolean:Ee,tuple:Jt});const je=r=>r&&r.__isYupSchema__;class ye{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:s,then:i,otherwise:l}=t,a=typeof s=="function"?s:(...c)=>c.every(u=>u===s);return new ye(e,(c,u)=>{var f;let h=a(...c)?i:l;return(f=h==null?void 0:h(u))!=null?f:u})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let s=this.refs.map(l=>l.getValue(t==null?void 0:t.value,t==null?void 0:t.parent,t==null?void 0:t.context)),i=this.fn(s,e,t);if(i===void 0||i===e)return e;if(!je(i))throw new TypeError("conditions must return a schema object");return i.resolve(t)}}const fe={context:"$",value:"."};class se{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===fe.context,this.isValue=this.key[0]===fe.value,this.isSibling=!this.isContext&&!this.isValue;let s=this.isContext?fe.context:this.isValue?fe.value:"";this.path=this.key.slice(s.length),this.getter=this.path&&re.getter(this.path,!0),this.map=t.map}getValue(e,t,s){let i=this.isContext?s:this.isValue?e:t;return this.getter&&(i=this.getter(i||{})),this.map&&(i=this.map(i)),i}cast(e,t){return this.getValue(e,t==null?void 0:t.parent,t==null?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}se.prototype.__isYupRef=!0;const Z=r=>r==null;function ie(r){function e({value:t,path:s="",options:i,originalValue:l,schema:a},c,u){const{name:f,test:h,params:x,message:p,skipAbsent:d}=r;let{parent:g,context:m,abortEarly:v=a.spec.abortEarly,disableStackTrace:j=a.spec.disableStackTrace}=i;const C={value:t,parent:g,context:m};function _(O={}){const S=tt(Object.assign({value:t,originalValue:l,label:a.spec.label,path:O.path||s,spec:a.spec,disableStackTrace:O.disableStackTrace||j},x,O.params),C),X=new I(I.formatError(O.message||p,S),t,S.path,O.type||f,S.disableStackTrace);return X.params=S,X}const F=v?c:u;let z={path:s,parent:g,type:f,from:i.from,createError:_,resolve(O){return rt(O,C)},options:i,originalValue:l,schema:a};const q=O=>{I.isError(O)?F(O):O?u(null):F(_())},K=O=>{I.isError(O)?F(O):c(O)};if(d&&Z(t))return q(!0);let D;try{var V;if(D=h.call(z,t,z),typeof((V=D)==null?void 0:V.then)=="function"){if(i.sync)throw new Error(`Validation test of type: "${z.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(D).then(q,K)}}catch(O){K(O);return}q(D)}return e.OPTIONS=r,e}function tt(r,e){if(!r)return r;for(const t of Object.keys(r))r[t]=rt(r[t],e);return r}function rt(r,e){return se.isRef(r)?r.getValue(e.value,e.parent,e.context):r}function Kt(r,e,t,s=t){let i,l,a;return e?(re.forEach(e,(c,u,f)=>{let h=u?c.slice(1,c.length-1):c;r=r.resolve({context:s,parent:i,value:t});let x=r.type==="tuple",p=f?parseInt(h,10):0;if(r.innerType||x){if(x&&!f)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${a}" must contain an index to the tuple element, e.g. "${a}[0]"`);if(t&&p>=t.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${c}, in the path: ${e}. because there is no value at that index. `);i=t,t=t&&t[p],r=x?r.spec.types[p]:r.innerType}if(!f){if(!r.fields||!r.fields[h])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${a} which is a type: "${r.type}")`);i=t,t=t&&t[h],r=r.fields[h]}l=h,a=u?"["+c+"]":"."+c}),{schema:r,parent:i,parentPath:l}):{parent:i,parentPath:e,schema:r}}class ve extends Set{describe(){const e=[];for(const t of this.values())e.push(se.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const s of this.values())t.push(e(s));return t}clone(){return new ve(this.values())}merge(e,t){const s=this.clone();return e.forEach(i=>s.add(i)),t.forEach(i=>s.delete(i)),s}}function ae(r,e=new Map){if(je(r)||!r||typeof r!="object")return r;if(e.has(r))return e.get(r);let t;if(r instanceof Date)t=new Date(r.getTime()),e.set(r,t);else if(r instanceof RegExp)t=new RegExp(r),e.set(r,t);else if(Array.isArray(r)){t=new Array(r.length),e.set(r,t);for(let s=0;s<r.length;s++)t[s]=ae(r[s],e)}else if(r instanceof Map){t=new Map,e.set(r,t);for(const[s,i]of r.entries())t.set(s,ae(i,e))}else if(r instanceof Set){t=new Set,e.set(r,t);for(const s of r)t.add(ae(s,e))}else if(r instanceof Object){t={},e.set(r,t);for(const[s,i]of Object.entries(r))t[s]=ae(i,e)}else throw Error(`Unable to clone ${r}`);return t}function Xt(r){if(!(r!=null&&r.length))return;const e=[];let t="",s=!1,i=!1;for(let l=0;l<r.length;l++){const a=r[l];if(a==="["&&!i){t&&(e.push(...t.split(".").filter(Boolean)),t=""),s=!0;continue}if(a==="]"&&!i){t&&(/^\d+$/.test(t)?e.push(t):e.push(t.replace(/^"|"$/g,"")),t=""),s=!1;continue}if(a==='"'){i=!i;continue}if(a==="."&&!s&&!i){t&&(e.push(t),t="");continue}t+=a}return t&&e.push(...t.split(".").filter(Boolean)),e}function Qt(r,e){const t=e?`${e}.${r.path}`:r.path;return r.errors.map(s=>({message:s,path:Xt(t)}))}function st(r,e){var t;if(!((t=r.inner)!=null&&t.length)&&r.errors.length)return Qt(r,e);const s=e?`${e}.${r.path}`:r.path;return r.inner.flatMap(i=>st(i,s))}class L{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new ve,this._blacklist=new ve,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Y.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(t=>{t.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=ae(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(e.length===0)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let s=e(this);return this._mutate=t,s}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,s=e.clone();const i=Object.assign({},t.spec,s.spec);return s.spec=i,s.internalTests=Object.assign({},t.internalTests,s.internalTests),s._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),s._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),s.tests=t.tests,s.exclusiveTests=t.exclusiveTests,s.withMutation(l=>{e.tests.forEach(a=>{l.test(a.OPTIONS)})}),s.transforms=[...t.transforms,...s.transforms],s}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let s=t.conditions;t=t.clone(),t.conditions=[],t=s.reduce((i,l)=>l.resolve(i,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,s,i,l;return Object.assign({},e,{from:e.from||[],strict:(t=e.strict)!=null?t:this.spec.strict,abortEarly:(s=e.abortEarly)!=null?s:this.spec.abortEarly,recursive:(i=e.recursive)!=null?i:this.spec.recursive,disableStackTrace:(l=e.disableStackTrace)!=null?l:this.spec.disableStackTrace})}cast(e,t={}){let s=this.resolve(Object.assign({},t,{value:e})),i=t.assert==="ignore-optionality",l=s._cast(e,t);if(t.assert!==!1&&!s.isType(l)){if(i&&Z(l))return l;let a=J(e),c=J(l);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${s.type}".
1
+ "use strict";const b=require("react"),wt=require("formik"),B=require("./index-ucLEoH8L.js"),n=require("react/jsx-runtime"),o=require("@mui/material"),E=require("react-icons/md"),kt=require("react-icons/fa6"),Tt=require("./_commonjsHelpers-DKOUU3wS.js");function oe(r){this._maxSize=r,this.clear()}oe.prototype.clear=function(){this._size=0,this._values=Object.create(null)};oe.prototype.get=function(r){return this._values[r]};oe.prototype.set=function(r,e){return this._size>=this._maxSize&&this.clear(),r in this._values||this._size++,this._values[r]=e};var Ct=/[^.^\]^[]+|(?=\[\]|\.\.)/g,Ye=/^\d+$/,Ft=/^\d/,Ot=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,Et=/^\s*(['"]?)(.*?)(\1)\s*$/,Ne=512,De=new oe(Ne);new oe(Ne);var Me=new oe(Ne),re={split:Fe,normalizePath:Pe,getter:function(r,e){var t=Pe(r);return Me.get(r)||Me.set(r,function(i){for(var l=0,a=t.length;l<a;)if(i!=null||!e)i=i[t[l++]];else return;return i})},join:function(r){return r.reduce(function(e,t){return e+(Ae(t)||Ye.test(t)?"["+t+"]":(e?".":"")+t)},"")},forEach:function(r,e,t){$t(Array.isArray(r)?r:Fe(r),e,t)}};function Pe(r){return De.get(r)||De.set(r,Fe(r).map(function(e){return e.replace(Et,"$2")}))}function Fe(r){return r.match(Ct)||[""]}function $t(r,e,t){var s=r.length,i,l,a,c;for(l=0;l<s;l++)i=r[l],i&&(Nt(i)&&(i='"'+i+'"'),c=Ae(i),a=!c&&/^\d+$/.test(i),e.call(t,i,c,a,l,r))}function Ae(r){return typeof r=="string"&&r&&["'",'"'].indexOf(r.charAt(0))!==-1}function _t(r){return r.match(Ft)&&!r.match(Ye)}function Bt(r){return Ot.test(r)}function Nt(r){return!Ae(r)&&(_t(r)||Bt(r))}const At=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,Ge=r=>r.match(At)||[],Rt=(r,e)=>Ge(r).join(e).toLowerCase(),zt=r=>Ge(r).reduce((e,t)=>`${e}${e?t[0].toUpperCase()+t.slice(1).toLowerCase():t.toLowerCase()}`,""),It=r=>Rt(r,"_");var Te={camelCase:zt,snakeCase:It},Re={exports:{}};Re.exports=function(r){return Je(Dt(r),r)};Re.exports.array=Je;function Je(r,e){var t=r.length,s=new Array(t),i={},l=t,a=Mt(e),c=Pt(r);for(e.forEach(function(f){if(!c.has(f[0])||!c.has(f[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});l--;)i[l]||u(r[l],l,new Set);return s;function u(f,h,x){if(x.has(f)){var p;try{p=", node was:"+JSON.stringify(f)}catch{p=""}throw new Error("Cyclic dependency"+p)}if(!c.has(f))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(f));if(!i[h]){i[h]=!0;var d=a.get(f)||new Set;if(d=Array.from(d),h=d.length){x.add(f);do{var g=d[--h];u(g,c.get(g),x)}while(h);x.delete(f)}s[--t]=f}}}function Dt(r){for(var e=new Set,t=0,s=r.length;t<s;t++){var i=r[t];e.add(i[0]),e.add(i[1])}return Array.from(e)}function Mt(r){for(var e=new Map,t=0,s=r.length;t<s;t++){var i=r[t];e.has(i[0])||e.set(i[0],new Set),e.has(i[1])||e.set(i[1],new Set),e.get(i[0]).add(i[1])}return e}function Pt(r){for(var e=new Map,t=0,s=r.length;t<s;t++)e.set(r[t],t);return e}var Lt=Re.exports;const qt=Tt.getDefaultExportFromCjs(Lt),Vt=Object.prototype.toString,Wt=Error.prototype.toString,Ut=RegExp.prototype.toString,Zt=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Ht=/^Symbol\((.*)\)(.*)$/;function Yt(r){return r!=+r?"NaN":r===0&&1/r<0?"-0":""+r}function Le(r,e=!1){if(r==null||r===!0||r===!1)return""+r;const t=typeof r;if(t==="number")return Yt(r);if(t==="string")return e?`"${r}"`:r;if(t==="function")return"[Function "+(r.name||"anonymous")+"]";if(t==="symbol")return Zt.call(r).replace(Ht,"Symbol($1)");const s=Vt.call(r).slice(8,-1);return s==="Date"?isNaN(r.getTime())?""+r:r.toISOString(r):s==="Error"||r instanceof Error?"["+Wt.call(r)+"]":s==="RegExp"?Ut.call(r):null}function J(r,e){let t=Le(r,e);return t!==null?t:JSON.stringify(r,function(s,i){let l=Le(this[s],e);return l!==null?l:i},2)}function Ke(r){return r==null?[]:[].concat(r)}let Xe,Qe,et,Gt=/\$\{\s*(\w+)\s*\}/g;Xe=Symbol.toStringTag;class qe{constructor(e,t,s,i){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[Xe]="Error",this.name="ValidationError",this.value=t,this.path=s,this.type=i,this.errors=[],this.inner=[],Ke(e).forEach(l=>{if(I.isError(l)){this.errors.push(...l.errors);const a=l.inner.length?l.inner:[l];this.inner.push(...a)}else this.errors.push(l)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}Qe=Symbol.hasInstance;et=Symbol.toStringTag;class I extends Error{static formatError(e,t){const s=t.label||t.path||"this";return t=Object.assign({},t,{path:s,originalPath:t.path}),typeof e=="string"?e.replace(Gt,(i,l)=>J(t[l])):typeof e=="function"?e(t):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,t,s,i,l){const a=new qe(e,t,s,i);if(l)return a;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[et]="Error",this.name=a.name,this.message=a.message,this.type=a.type,this.value=a.value,this.path=a.path,this.errors=a.errors,this.inner=a.inner,Error.captureStackTrace&&Error.captureStackTrace(this,I)}static[Qe](e){return qe[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Y={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:r,type:e,value:t,originalValue:s})=>{const i=s!=null&&s!==t?` (cast from the value \`${J(s,!0)}\`).`:".";return e!=="mixed"?`${r} must be a \`${e}\` type, but the final value was: \`${J(t,!0)}\``+i:`${r} must match the configured type. The validated value was: \`${J(t,!0)}\``+i}},M={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Q={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},Oe={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Ee={isValue:"${path} field must be ${value}"},he={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},xe={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},Jt={notType:r=>{const{path:e,value:t,spec:s}=r,i=s.types.length;if(Array.isArray(t)){if(t.length<i)return`${e} tuple value has too few items, expected a length of ${i} but got ${t.length} for value: \`${J(t,!0)}\``;if(t.length>i)return`${e} tuple value has too many items, expected a length of ${i} but got ${t.length} for value: \`${J(t,!0)}\``}return I.formatError(Y.notType,r)}};Object.assign(Object.create(null),{mixed:Y,string:M,number:Q,date:Oe,object:he,array:xe,boolean:Ee,tuple:Jt});const je=r=>r&&r.__isYupSchema__;class ye{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:s,then:i,otherwise:l}=t,a=typeof s=="function"?s:(...c)=>c.every(u=>u===s);return new ye(e,(c,u)=>{var f;let h=a(...c)?i:l;return(f=h==null?void 0:h(u))!=null?f:u})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let s=this.refs.map(l=>l.getValue(t==null?void 0:t.value,t==null?void 0:t.parent,t==null?void 0:t.context)),i=this.fn(s,e,t);if(i===void 0||i===e)return e;if(!je(i))throw new TypeError("conditions must return a schema object");return i.resolve(t)}}const fe={context:"$",value:"."};class se{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===fe.context,this.isValue=this.key[0]===fe.value,this.isSibling=!this.isContext&&!this.isValue;let s=this.isContext?fe.context:this.isValue?fe.value:"";this.path=this.key.slice(s.length),this.getter=this.path&&re.getter(this.path,!0),this.map=t.map}getValue(e,t,s){let i=this.isContext?s:this.isValue?e:t;return this.getter&&(i=this.getter(i||{})),this.map&&(i=this.map(i)),i}cast(e,t){return this.getValue(e,t==null?void 0:t.parent,t==null?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}se.prototype.__isYupRef=!0;const Z=r=>r==null;function ie(r){function e({value:t,path:s="",options:i,originalValue:l,schema:a},c,u){const{name:f,test:h,params:x,message:p,skipAbsent:d}=r;let{parent:g,context:m,abortEarly:v=a.spec.abortEarly,disableStackTrace:j=a.spec.disableStackTrace}=i;const C={value:t,parent:g,context:m};function _(O={}){const S=tt(Object.assign({value:t,originalValue:l,label:a.spec.label,path:O.path||s,spec:a.spec,disableStackTrace:O.disableStackTrace||j},x,O.params),C),X=new I(I.formatError(O.message||p,S),t,S.path,O.type||f,S.disableStackTrace);return X.params=S,X}const F=v?c:u;let z={path:s,parent:g,type:f,from:i.from,createError:_,resolve(O){return rt(O,C)},options:i,originalValue:l,schema:a};const q=O=>{I.isError(O)?F(O):O?u(null):F(_())},K=O=>{I.isError(O)?F(O):c(O)};if(d&&Z(t))return q(!0);let D;try{var V;if(D=h.call(z,t,z),typeof((V=D)==null?void 0:V.then)=="function"){if(i.sync)throw new Error(`Validation test of type: "${z.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(D).then(q,K)}}catch(O){K(O);return}q(D)}return e.OPTIONS=r,e}function tt(r,e){if(!r)return r;for(const t of Object.keys(r))r[t]=rt(r[t],e);return r}function rt(r,e){return se.isRef(r)?r.getValue(e.value,e.parent,e.context):r}function Kt(r,e,t,s=t){let i,l,a;return e?(re.forEach(e,(c,u,f)=>{let h=u?c.slice(1,c.length-1):c;r=r.resolve({context:s,parent:i,value:t});let x=r.type==="tuple",p=f?parseInt(h,10):0;if(r.innerType||x){if(x&&!f)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${a}" must contain an index to the tuple element, e.g. "${a}[0]"`);if(t&&p>=t.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${c}, in the path: ${e}. because there is no value at that index. `);i=t,t=t&&t[p],r=x?r.spec.types[p]:r.innerType}if(!f){if(!r.fields||!r.fields[h])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${a} which is a type: "${r.type}")`);i=t,t=t&&t[h],r=r.fields[h]}l=h,a=u?"["+c+"]":"."+c}),{schema:r,parent:i,parentPath:l}):{parent:i,parentPath:e,schema:r}}class ve extends Set{describe(){const e=[];for(const t of this.values())e.push(se.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const s of this.values())t.push(e(s));return t}clone(){return new ve(this.values())}merge(e,t){const s=this.clone();return e.forEach(i=>s.add(i)),t.forEach(i=>s.delete(i)),s}}function ae(r,e=new Map){if(je(r)||!r||typeof r!="object")return r;if(e.has(r))return e.get(r);let t;if(r instanceof Date)t=new Date(r.getTime()),e.set(r,t);else if(r instanceof RegExp)t=new RegExp(r),e.set(r,t);else if(Array.isArray(r)){t=new Array(r.length),e.set(r,t);for(let s=0;s<r.length;s++)t[s]=ae(r[s],e)}else if(r instanceof Map){t=new Map,e.set(r,t);for(const[s,i]of r.entries())t.set(s,ae(i,e))}else if(r instanceof Set){t=new Set,e.set(r,t);for(const s of r)t.add(ae(s,e))}else if(r instanceof Object){t={},e.set(r,t);for(const[s,i]of Object.entries(r))t[s]=ae(i,e)}else throw Error(`Unable to clone ${r}`);return t}function Xt(r){if(!(r!=null&&r.length))return;const e=[];let t="",s=!1,i=!1;for(let l=0;l<r.length;l++){const a=r[l];if(a==="["&&!i){t&&(e.push(...t.split(".").filter(Boolean)),t=""),s=!0;continue}if(a==="]"&&!i){t&&(/^\d+$/.test(t)?e.push(t):e.push(t.replace(/^"|"$/g,"")),t=""),s=!1;continue}if(a==='"'){i=!i;continue}if(a==="."&&!s&&!i){t&&(e.push(t),t="");continue}t+=a}return t&&e.push(...t.split(".").filter(Boolean)),e}function Qt(r,e){const t=e?`${e}.${r.path}`:r.path;return r.errors.map(s=>({message:s,path:Xt(t)}))}function st(r,e){var t;if(!((t=r.inner)!=null&&t.length)&&r.errors.length)return Qt(r,e);const s=e?`${e}.${r.path}`:r.path;return r.inner.flatMap(i=>st(i,s))}class L{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new ve,this._blacklist=new ve,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Y.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(t=>{t.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=ae(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(e.length===0)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let s=e(this);return this._mutate=t,s}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,s=e.clone();const i=Object.assign({},t.spec,s.spec);return s.spec=i,s.internalTests=Object.assign({},t.internalTests,s.internalTests),s._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),s._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),s.tests=t.tests,s.exclusiveTests=t.exclusiveTests,s.withMutation(l=>{e.tests.forEach(a=>{l.test(a.OPTIONS)})}),s.transforms=[...t.transforms,...s.transforms],s}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let s=t.conditions;t=t.clone(),t.conditions=[],t=s.reduce((i,l)=>l.resolve(i,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,s,i,l;return Object.assign({},e,{from:e.from||[],strict:(t=e.strict)!=null?t:this.spec.strict,abortEarly:(s=e.abortEarly)!=null?s:this.spec.abortEarly,recursive:(i=e.recursive)!=null?i:this.spec.recursive,disableStackTrace:(l=e.disableStackTrace)!=null?l:this.spec.disableStackTrace})}cast(e,t={}){let s=this.resolve(Object.assign({},t,{value:e})),i=t.assert==="ignore-optionality",l=s._cast(e,t);if(t.assert!==!1&&!s.isType(l)){if(i&&Z(l))return l;let a=J(e),c=J(l);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${s.type}".
2
2
 
3
3
  attempted value: ${a}
4
4
  `+(c!==a?`result of cast: ${c}`:""))}return l}_cast(e,t){let s=e===void 0?e:this.transforms.reduce((i,l)=>l.call(this,i,e,this,t),e);return s===void 0&&(s=this.getDefault(t)),s}_validate(e,t={},s,i){let{path:l,originalValue:a=e,strict:c=this.spec.strict}=t,u=e;c||(u=this._cast(u,Object.assign({assert:!1},t)));let f=[];for(let h of Object.values(this.internalTests))h&&f.push(h);this.runTests({path:l,value:u,originalValue:a,options:t,tests:f},s,h=>{if(h.length)return i(h,u);this.runTests({path:l,value:u,originalValue:a,options:t,tests:this.tests},s,i)})}runTests(e,t,s){let i=!1,{tests:l,value:a,originalValue:c,path:u,options:f}=e,h=m=>{i||(i=!0,t(m,a))},x=m=>{i||(i=!0,s(m,a))},p=l.length,d=[];if(!p)return x([]);let g={value:a,originalValue:c,path:u,options:f,schema:this};for(let m=0;m<l.length;m++){const v=l[m];v(g,h,function(C){C&&(Array.isArray(C)?d.push(...C):d.push(C)),--p<=0&&x(d)})}}asNestedTest({key:e,index:t,parent:s,parentPath:i,originalParent:l,options:a}){const c=e??t;if(c==null)throw TypeError("Must include `key` or `index` for nested validations");const u=typeof c=="number";let f=s[c];const h=Object.assign({},a,{strict:!0,parent:s,value:f,originalValue:l[c],key:void 0,[u?"index":"key"]:c,path:u||c.includes(".")?`${i||""}[${u?c:`"${c}"`}]`:(i?`${i}.`:"")+e});return(x,p,d)=>this.resolve(h)._validate(f,h,p,d)}validate(e,t){var s;let i=this.resolve(Object.assign({},t,{value:e})),l=(s=t==null?void 0:t.disableStackTrace)!=null?s:i.spec.disableStackTrace;return new Promise((a,c)=>i._validate(e,t,(u,f)=>{I.isError(u)&&(u.value=f),c(u)},(u,f)=>{u.length?c(new I(u,f,void 0,void 0,l)):a(f)}))}validateSync(e,t){var s;let i=this.resolve(Object.assign({},t,{value:e})),l,a=(s=t==null?void 0:t.disableStackTrace)!=null?s:i.spec.disableStackTrace;return i._validate(e,Object.assign({},t,{sync:!0}),(c,u)=>{throw I.isError(c)&&(c.value=u),c},(c,u)=>{if(c.length)throw new I(c,e,void 0,void 0,a);l=u}),l}isValid(e,t){return this.validate(e,t).then(()=>!0,s=>{if(I.isError(s))return!1;throw s})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(s){if(I.isError(s))return!1;throw s}}_getDefault(e){let t=this.spec.default;return t==null?t:typeof t=="function"?t.call(this,e):ae(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const s=this.clone({nullable:e});return s.internalTests.nullable=ie({message:t,name:"nullable",test(i){return i===null?this.schema.spec.nullable:!0}}),s}optionality(e,t){const s=this.clone({optional:e});return s.internalTests.optionality=ie({message:t,name:"optionality",test(i){return i===void 0?this.schema.spec.optional:!0}}),s}optional(){return this.optionality(!0)}defined(e=Y.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Y.notNull){return this.nullability(!1,e)}required(e=Y.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(e.length===1?typeof e[0]=="function"?t={test:e[0]}:t=e[0]:e.length===2?t={name:e[0],test:e[1]}:t={name:e[0],message:e[1],test:e[2]},t.message===void 0&&(t.message=Y.default),typeof t.test!="function")throw new TypeError("`test` is a required parameters");let s=this.clone(),i=ie(t),l=t.exclusive||t.name&&s.exclusiveTests[t.name]===!0;if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(s.exclusiveTests[t.name]=!!t.exclusive),s.tests=s.tests.filter(a=>!(a.OPTIONS.name===t.name&&(l||a.OPTIONS.test===i.OPTIONS.test))),s.tests.push(i),s}when(e,t){!Array.isArray(e)&&typeof e!="string"&&(t=e,e=".");let s=this.clone(),i=Ke(e).map(l=>new se(l));return i.forEach(l=>{l.isSibling&&s.deps.push(l.key)}),s.conditions.push(typeof t=="function"?new ye(i,t):ye.fromOptions(i,t)),s}typeError(e){let t=this.clone();return t.internalTests.typeError=ie({message:e,name:"typeError",skipAbsent:!0,test(s){return this.schema._typeCheck(s)?!0:this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=Y.oneOf){let s=this.clone();return e.forEach(i=>{s._whitelist.add(i),s._blacklist.delete(i)}),s.internalTests.whiteList=ie({message:t,name:"oneOf",skipAbsent:!0,test(i){let l=this.schema._whitelist,a=l.resolveAll(this.resolve);return a.includes(i)?!0:this.createError({params:{values:Array.from(l).join(", "),resolved:a}})}}),s}notOneOf(e,t=Y.notOneOf){let s=this.clone();return e.forEach(i=>{s._blacklist.add(i),s._whitelist.delete(i)}),s.internalTests.blacklist=ie({message:t,name:"notOneOf",test(i){let l=this.schema._blacklist,a=l.resolveAll(this.resolve);return a.includes(i)?this.createError({params:{values:Array.from(l).join(", "),resolved:a}}):!0}}),s}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:s,meta:i,optional:l,nullable:a}=t.spec;return{meta:i,label:s,optional:l,nullable:a,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.filter((u,f,h)=>h.findIndex(x=>x.OPTIONS.name===u.OPTIONS.name)===f).map(u=>{const f=u.OPTIONS.params&&e?tt(Object.assign({},u.OPTIONS.params),e):u.OPTIONS.params;return{name:u.OPTIONS.name,params:f}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(s){try{return{value:await e.validate(s,{abortEarly:!1})}}catch(i){if(i instanceof I)return{issues:st(i)};throw i}}}}}L.prototype.__isYupSchema__=!0;for(const r of["validate","validateSync"])L.prototype[`${r}At`]=function(e,t,s={}){const{parent:i,parentPath:l,schema:a}=Kt(this,e,t,s.context);return a[r](i&&i[l],Object.assign({},s,{parent:i,path:e}))};for(const r of["equals","is"])L.prototype[r]=L.prototype.oneOf;for(const r of["not","nope"])L.prototype[r]=L.prototype.notOneOf;function nt(){return new it}class it extends L{constructor(){super({type:"boolean",check(e){return e instanceof Boolean&&(e=e.valueOf()),typeof e=="boolean"}}),this.withMutation(()=>{this.transform((e,t)=>{if(this.spec.coerce&&!this.isType(e)){if(/^(true|1)$/i.test(String(e)))return!0;if(/^(false|0)$/i.test(String(e)))return!1}return e})})}isTrue(e=Ee.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"true"},test(t){return Z(t)||t===!0}})}isFalse(e=Ee.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"false"},test(t){return Z(t)||t===!1}})}default(e){return super.default(e)}defined(e){return super.defined(e)}optional(){return super.optional()}required(e){return super.required(e)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(e){return super.nonNullable(e)}strip(e){return super.strip(e)}}nt.prototype=it.prototype;const er=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function tr(r){const e=$e(r);if(!e)return Date.parse?Date.parse(r):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let t=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(t=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(t=0-t)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+t,e.second,e.millisecond)}function $e(r){var e,t;const s=er.exec(r);return s?{year:G(s[1]),month:G(s[2],1)-1,day:G(s[3],1),hour:G(s[4]),minute:G(s[5]),second:G(s[6]),millisecond:s[7]?G(s[7].substring(0,3)):0,precision:(e=(t=s[7])==null?void 0:t.length)!=null?e:void 0,z:s[8]||void 0,plusMinus:s[9]||void 0,hourOffset:G(s[10]),minuteOffset:G(s[11])}:null}function G(r,e=0){return Number(r)||e}let rr=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,sr=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,nr=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,ir="^\\d{4}-\\d{2}-\\d{2}",lr="\\d{2}:\\d{2}:\\d{2}",ar="(([+-]\\d{2}(:?\\d{2})?)|Z)",or=new RegExp(`${ir}T${lr}(\\.\\d+)?${ar}$`),cr=r=>Z(r)||r===r.trim(),ur={}.toString();function me(){return new lt}class lt extends L{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce||this.isType(e)||Array.isArray(e))return e;const s=e!=null&&e.toString?e.toString():e;return s===ur?e:s})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||Y.required,name:"required",skipAbsent:!0,test:s=>!!s.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(t=>t.OPTIONS.name!=="required"),e))}length(e,t=M.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(s){return s.length===this.resolve(e)}})}min(e,t=M.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s.length>=this.resolve(e)}})}max(e,t=M.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(s){return s.length<=this.resolve(e)}})}matches(e,t){let s=!1,i,l;return t&&(typeof t=="object"?{excludeEmptyString:s=!1,message:i,name:l}=t:i=t),this.test({name:l||"matches",message:i||M.matches,params:{regex:e},skipAbsent:!0,test:a=>a===""&&s||a.search(e)!==-1})}email(e=M.email){return this.matches(rr,{name:"email",message:e,excludeEmptyString:!0})}url(e=M.url){return this.matches(sr,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=M.uuid){return this.matches(nr,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t="",s,i;return e&&(typeof e=="object"?{message:t="",allowOffset:s=!1,precision:i=void 0}=e:t=e),this.matches(or,{name:"datetime",message:t||M.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:t||M.datetime_offset,params:{allowOffset:s},skipAbsent:!0,test:l=>{if(!l||s)return!0;const a=$e(l);return a?!!a.z:!1}}).test({name:"datetime_precision",message:t||M.datetime_precision,params:{precision:i},skipAbsent:!0,test:l=>{if(!l||i==null)return!0;const a=$e(l);return a?a.precision===i:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=M.trim){return this.transform(t=>t!=null?t.trim():t).test({message:e,name:"trim",test:cr})}lowercase(e=M.lowercase){return this.transform(t=>Z(t)?t:t.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Z(t)||t===t.toLowerCase()})}uppercase(e=M.uppercase){return this.transform(t=>Z(t)?t:t.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Z(t)||t===t.toUpperCase()})}}me.prototype=lt.prototype;let dr=r=>r!=+r;function at(){return new ot}class ot extends L{constructor(){super({type:"number",check(e){return e instanceof Number&&(e=e.valueOf()),typeof e=="number"&&!dr(e)}}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce)return e;let s=e;if(typeof s=="string"){if(s=s.replace(/\s/g,""),s==="")return NaN;s=+s}return this.isType(s)||s===null?s:parseFloat(s)})})}min(e,t=Q.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s>=this.resolve(e)}})}max(e,t=Q.max){return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(s){return s<=this.resolve(e)}})}lessThan(e,t=Q.lessThan){return this.test({message:t,name:"max",exclusive:!0,params:{less:e},skipAbsent:!0,test(s){return s<this.resolve(e)}})}moreThan(e,t=Q.moreThan){return this.test({message:t,name:"min",exclusive:!0,params:{more:e},skipAbsent:!0,test(s){return s>this.resolve(e)}})}positive(e=Q.positive){return this.moreThan(0,e)}negative(e=Q.negative){return this.lessThan(0,e)}integer(e=Q.integer){return this.test({name:"integer",message:e,skipAbsent:!0,test:t=>Number.isInteger(t)})}truncate(){return this.transform(e=>Z(e)?e:e|0)}round(e){var t;let s=["ceil","floor","round","trunc"];if(e=((t=e)==null?void 0:t.toLowerCase())||"round",e==="trunc")return this.truncate();if(s.indexOf(e.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+s.join(", "));return this.transform(i=>Z(i)?i:Math[e](i))}}at.prototype=ot.prototype;let fr=new Date(""),pr=r=>Object.prototype.toString.call(r)==="[object Date]";class ze extends L{constructor(){super({type:"date",check(e){return pr(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,t)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=tr(e),isNaN(e)?ze.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let s;if(se.isRef(e))s=e;else{let i=this.cast(e);if(!this._typeCheck(i))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);s=i}return s}min(e,t=Oe.min){let s=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(i){return i>=this.resolve(s)}})}max(e,t=Oe.max){let s=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(i){return i<=this.resolve(s)}})}}ze.INVALID_DATE=fr;function hr(r,e=[]){let t=[],s=new Set,i=new Set(e.map(([a,c])=>`${a}-${c}`));function l(a,c){let u=re.split(a)[0];s.add(u),i.has(`${c}-${u}`)||t.push([c,u])}for(const a of Object.keys(r)){let c=r[a];s.add(a),se.isRef(c)&&c.isSibling?l(c.path,a):je(c)&&"deps"in c&&c.deps.forEach(u=>l(u,a))}return qt.array(Array.from(s),t).reverse()}function Ve(r,e){let t=1/0;return r.some((s,i)=>{var l;if((l=e.path)!=null&&l.includes(s))return t=i,!0}),t}function ct(r){return(e,t)=>Ve(r,e)-Ve(r,t)}const ut=(r,e,t)=>{if(typeof r!="string")return r;let s=r;try{s=JSON.parse(r)}catch{}return t.isType(s)?s:r};function be(r){if("fields"in r){const e={};for(const[t,s]of Object.entries(r.fields))e[t]=be(s);return r.setFields(e)}if(r.type==="array"){const e=r.optional();return e.innerType&&(e.innerType=be(e.innerType)),e}return r.type==="tuple"?r.optional().clone({types:r.spec.types.map(be)}):"optional"in r?r.optional():r}const xr=(r,e)=>{const t=[...re.normalizePath(e)];if(t.length===1)return t[0]in r;let s=t.pop(),i=re.getter(re.join(t),!0)(r);return!!(i&&s in i)};let We=r=>Object.prototype.toString.call(r)==="[object Object]";function Ue(r,e){let t=Object.keys(r.fields);return Object.keys(e).filter(s=>t.indexOf(s)===-1)}const mr=ct([]);function _e(r){return new dt(r)}class dt extends L{constructor(e){super({type:"object",check(t){return We(t)||typeof t=="function"}}),this.fields=Object.create(null),this._sortErrors=mr,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var s;let i=super._cast(e,t);if(i===void 0)return this.getDefault(t);if(!this._typeCheck(i))return i;let l=this.fields,a=(s=t.stripUnknown)!=null?s:this.spec.noUnknown,c=[].concat(this._nodes,Object.keys(i).filter(x=>!this._nodes.includes(x))),u={},f=Object.assign({},t,{parent:u,__validating:t.__validating||!1}),h=!1;for(const x of c){let p=l[x],d=x in i,g=i[x];if(p){let m;f.path=(t.path?`${t.path}.`:"")+x,p=p.resolve({value:g,context:t.context,parent:u});let v=p instanceof L?p.spec:void 0,j=v==null?void 0:v.strict;if(v!=null&&v.strip){h=h||x in i;continue}m=!t.__validating||!j?p.cast(g,f):g,m!==void 0&&(u[x]=m)}else d&&!a&&(u[x]=g);(d!==x in u||u[x]!==g)&&(h=!0)}return h?u:i}_validate(e,t={},s,i){let{from:l=[],originalValue:a=e,recursive:c=this.spec.recursive}=t;t.from=[{schema:this,value:a},...l],t.__validating=!0,t.originalValue=a,super._validate(e,t,s,(u,f)=>{if(!c||!We(f)){i(u,f);return}a=a||f;let h=[];for(let x of this._nodes){let p=this.fields[x];!p||se.isRef(p)||h.push(p.asNestedTest({options:t,key:x,parent:f,parentPath:t.path,originalParent:a}))}this.runTests({tests:h,value:f,originalValue:a,options:t},s,x=>{i(x.sort(this._sortErrors).concat(u),f)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),s=t.fields;for(let[i,l]of Object.entries(this.fields)){const a=s[i];s[i]=a===void 0?l:a}return t.withMutation(i=>i.setFields(s,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(s=>{var i;const l=this.fields[s];let a=e;(i=a)!=null&&i.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[s]})),t[s]=l&&"getDefault"in l?l.getDefault(a):void 0}),t}setFields(e,t){let s=this.clone();return s.fields=e,s._nodes=hr(e,t),s._sortErrors=ct(Object.keys(e)),t&&(s._excludedEdges=t),s}shape(e,t=[]){return this.clone().withMutation(s=>{let i=s._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),i=[...s._excludedEdges,...t]),s.setFields(Object.assign(s.fields,e),i)})}partial(){const e={};for(const[t,s]of Object.entries(this.fields))e[t]="optional"in s&&s.optional instanceof Function?s.optional():s;return this.setFields(e)}deepPartial(){return be(this)}pick(e){const t={};for(const s of e)this.fields[s]&&(t[s]=this.fields[s]);return this.setFields(t,this._excludedEdges.filter(([s,i])=>e.includes(s)&&e.includes(i)))}omit(e){const t=[];for(const s of Object.keys(this.fields))e.includes(s)||t.push(s);return this.pick(t)}from(e,t,s){let i=re.getter(e,!0);return this.transform(l=>{if(!l)return l;let a=l;return xr(l,e)&&(a=Object.assign({},l),s||delete a[e],a[t]=i(l)),a})}json(){return this.transform(ut)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||he.exact,test(t){if(t==null)return!0;const s=Ue(this.schema,t);return s.length===0||this.createError({params:{properties:s.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=he.noUnknown){typeof e!="boolean"&&(t=e,e=!0);let s=this.test({name:"noUnknown",exclusive:!0,message:t,test(i){if(i==null)return!0;const l=Ue(this.schema,i);return!e||l.length===0||this.createError({params:{unknown:l.join(", ")}})}});return s.spec.noUnknown=e,s}unknown(e=!0,t=he.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const s={};for(const i of Object.keys(t))s[e(i)]=t[i];return s})}camelCase(){return this.transformKeys(Te.camelCase)}snakeCase(){return this.transformKeys(Te.snakeCase)}constantCase(){return this.transformKeys(e=>Te.snakeCase(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),s=super.describe(e);s.fields={};for(const[l,a]of Object.entries(t.fields)){var i;let c=e;(i=c)!=null&&i.value&&(c=Object.assign({},c,{parent:c.value,value:c.value[l]})),s.fields[l]=a.describe(c)}return s}}_e.prototype=dt.prototype;function ft(r){return new pt(r)}class pt extends L{constructor(e){super({type:"array",spec:{types:e},check(t){return Array.isArray(t)}}),this.innerType=void 0,this.innerType=e}_cast(e,t){const s=super._cast(e,t);if(!this._typeCheck(s)||!this.innerType)return s;let i=!1;const l=s.map((a,c)=>{const u=this.innerType.cast(a,Object.assign({},t,{path:`${t.path||""}[${c}]`,parent:s,originalValue:a,value:a,index:c}));return u!==a&&(i=!0),u});return i?l:s}_validate(e,t={},s,i){var l;let a=this.innerType,c=(l=t.recursive)!=null?l:this.spec.recursive;t.originalValue!=null&&t.originalValue,super._validate(e,t,s,(u,f)=>{var h;if(!c||!a||!this._typeCheck(f)){i(u,f);return}let x=new Array(f.length);for(let d=0;d<f.length;d++){var p;x[d]=a.asNestedTest({options:t,index:d,parent:f,parentPath:t.path,originalParent:(p=t.originalValue)!=null?p:e})}this.runTests({value:f,tests:x,originalValue:(h=t.originalValue)!=null?h:e,options:t},s,d=>i(d.concat(u),f))})}clone(e){const t=super.clone(e);return t.innerType=this.innerType,t}json(){return this.transform(ut)}concat(e){let t=super.concat(e);return t.innerType=this.innerType,e.innerType&&(t.innerType=t.innerType?t.innerType.concat(e.innerType):e.innerType),t}of(e){let t=this.clone();if(!je(e))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+J(e));return t.innerType=e,t.spec=Object.assign({},t.spec,{types:e}),t}length(e,t=xe.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(s){return s.length===this.resolve(e)}})}min(e,t){return t=t||xe.min,this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s.length>=this.resolve(e)}})}max(e,t){return t=t||xe.max,this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(s){return s.length<=this.resolve(e)}})}ensure(){return this.default(()=>[]).transform((e,t)=>this._typeCheck(e)?e:t==null?[]:[].concat(t))}compact(e){let t=e?(s,i,l)=>!e(s,i,l):s=>!!s;return this.transform(s=>s!=null?s.filter(t):s)}describe(e){const t=(e?this.resolve(e):this).clone(),s=super.describe(e);if(t.innerType){var i;let l=e;(i=l)!=null&&i.value&&(l=Object.assign({},l,{parent:l.value,value:l.value[0]})),s.innerType=t.innerType.describe(l)}return s}}ft.prototype=pt.prototype;class br{constructor(){this.sources=new Map}register(e,t){this.sources.set(e,t)}get(e){return this.sources.get(e)}has(e){return this.sources.has(e)}}const ht=new br,gr=8,T={wrapper:r=>({border:`1px solid ${r?B.FF.BORDER_COLOR_ERROR:B.FF.BORDER_COLOR}`,borderRadius:B.FF.BORDER_RADIUS,overflow:"hidden",background:"#fff",fontSize:13}),toolbar:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",borderBottom:"1px solid #e0e0e0",minHeight:40,background:"#fff"},selectedLink:{fontSize:13,color:"#1976d2",cursor:"pointer",background:"none",border:"none",padding:0,fontWeight:500},searchWrap:{display:"flex",alignItems:"center",gap:6,border:"1px solid #e0e0e0",borderRadius:4,padding:"3px 8px",background:"#fafafa",flex:"0 0 220px"},searchInput:{border:"none",outline:"none",fontSize:13,background:"transparent",width:"100%"},table:{width:"100%",borderCollapse:"collapse"},thead:{background:"#f5f5f5"},th:r=>({textAlign:"left",padding:"0 16px",height:44,fontSize:12,fontWeight:600,color:"rgba(0,0,0,0.6)",borderBottom:"1px solid #e0e0e0",whiteSpace:"nowrap",width:r,letterSpacing:"0.01em"}),checkTh:{width:48,padding:"0 0 0 12px",height:44,borderBottom:"1px solid #e0e0e0",background:"#f5f5f5"},td:{padding:"0 16px",height:48,borderBottom:"1px solid #f0f0f0",color:"rgba(0,0,0,0.87)",verticalAlign:"middle"},checkTd:{padding:"0 0 0 12px",height:48,borderBottom:"1px solid #f0f0f0",verticalAlign:"middle",width:48},statusRow:{textAlign:"center",padding:"24px 16px",color:"rgba(0,0,0,0.38)",fontSize:13},footer:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:16,padding:"4px 8px",borderTop:"1px solid #e0e0e0",fontSize:12,color:"rgba(0,0,0,0.6)",background:"#fafafa",minHeight:40},pageBtn:r=>({display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:"50%",border:"none",background:"transparent",cursor:r?"default":"pointer",color:r?"rgba(0,0,0,0.26)":"rgba(0,0,0,0.54)",fontSize:16,transition:"background 0.15s"}),overlay:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center"},modal:{background:"#fff",borderRadius:8,width:560,maxWidth:"90vw",maxHeight:"80vh",display:"flex",flexDirection:"column",boxShadow:"0 8px 32px rgba(0,0,0,0.18)"},modalHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid #e0e0e0",fontSize:16,fontWeight:600,color:"rgba(0,0,0,0.87)"},modalCloseBtn:{background:"none",border:"none",cursor:"pointer",color:"rgba(0,0,0,0.54)",display:"flex",alignItems:"center",padding:4,borderRadius:4},modalSearch:{display:"flex",alignItems:"center",gap:8,margin:"12px 20px",border:"1px solid #e0e0e0",borderRadius:20,padding:"6px 12px",background:"#fafafa"},modalSearchInput:{flex:1,border:"none",outline:"none",fontSize:14,background:"transparent"},modalList:{flex:1,overflowY:"auto",padding:"0 20px 8px"},modalRow:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 0",borderBottom:"1px solid #f0f0f0",fontSize:14,color:"rgba(0,0,0,0.87)"},modalRemoveBtn:{background:"none",border:"none",cursor:"pointer",color:"#e53935",display:"flex",alignItems:"center",padding:2,borderRadius:4,flexShrink:0},modalFooter:{display:"flex",justifyContent:"flex-end",padding:"12px 20px",borderTop:"1px solid #e0e0e0"},closeBtn:{padding:"6px 20px",border:"1px solid #e0e0e0",borderRadius:4,background:"#fff",cursor:"pointer",fontSize:14,color:"rgba(0,0,0,0.87)"}};function Ze({checked:r,onChange:e,indeterminate:t,disabled:s}){const i=b.useRef(null);return b.useEffect(()=>{i.current&&(i.current.indeterminate=!!t)},[t]),n.jsx("input",{ref:i,type:"checkbox",checked:r,onChange:e,disabled:s,style:{width:16,height:16,cursor:s?"default":"pointer",accentColor:"#1976d2"}})}function yr({selected:r,onRemove:e,onClose:t}){const[s,i]=b.useState(""),l=r.filter(a=>a.label.toLowerCase().includes(s.toLowerCase()));return n.jsx("div",{style:T.overlay,onClick:t,children:n.jsxs("div",{style:T.modal,onClick:a=>a.stopPropagation(),children:[n.jsxs("div",{style:T.modalHeader,children:[n.jsx("span",{children:"Selected Rows"}),n.jsx("button",{type:"button",style:T.modalCloseBtn,onClick:t,children:n.jsx(E.MdClose,{size:20})})]}),n.jsxs("div",{style:T.modalSearch,children:[n.jsx(E.MdSearch,{size:18,color:"rgba(0,0,0,0.38)"}),n.jsx("input",{autoFocus:!0,type:"text",placeholder:"Search",value:s,onChange:a=>i(a.target.value),style:T.modalSearchInput})]}),n.jsxs("div",{style:T.modalList,children:[l.length===0&&n.jsx("div",{style:{textAlign:"center",padding:"24px 0",color:"rgba(0,0,0,0.38)",fontSize:13},children:"No items found"}),l.map(a=>n.jsxs("div",{style:T.modalRow,children:[n.jsx("span",{children:a.label}),n.jsx("button",{type:"button",style:T.modalRemoveBtn,onClick:()=>e(a.value),title:"Remove",children:n.jsx(E.MdClose,{size:16})})]},a.value))]}),n.jsx("div",{style:T.modalFooter,children:n.jsx("button",{type:"button",style:T.closeBtn,onClick:t,children:"Close"})})]})})}function xt({field:r,value:e,onChange:t,onBlur:s,error:i,touched:l}){const a=r,c=!!(l&&i),u=a.isMulti??!1,f=a.pageSize??gr,h=a.id??a.name??"",[x,p]=b.useState(""),[d,g]=b.useState(1),[m,v]=b.useState([]),[j,C]=b.useState(!1),[_,F]=b.useState(!1),[z,q]=b.useState(null),[K,U]=b.useState(!1),D=b.useRef(null),V=b.useRef(0),O=b.useRef(!0);b.useEffect(()=>()=>{O.current=!1,D.current&&clearTimeout(D.current)},[]);const S=u?Array.isArray(e)?e:[]:e?[e]:[],X=S.length,ce=b.useCallback((y,$)=>{if(a.fetchOptions)return a.fetchOptions(y,$);if(a.dataSource){const N=ht.get(a.dataSource);return N?N.fetch(y,$):Promise.reject(new Error(`[FlowForge] DataSource "${a.dataSource}" is not registered.`))}return Promise.reject(new Error(`[FlowForge] table-picker "${a.id}" requires fetchOptions or dataSource.`))},[a.fetchOptions,a.dataSource,a.id]),R=b.useCallback((y,$)=>{const N=++V.current;F(!0),ce(y,$).then(A=>{!O.current||N!==V.current||(v(A.options.slice(0,f)),C(A.hasNextPage))}).catch(()=>{!O.current||N!==V.current||(v([]),C(!1))}).finally(()=>{!O.current||N!==V.current||F(!1)})},[ce,f]);b.useEffect(()=>{R("",1)},[]);const ee=y=>{const $=y.target.value;p($),g(1),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>R($,1),300)},te=y=>{if(u){const $=Array.isArray(e)?e:[],N=$.some(A=>A.value===y.value);t(N?$.filter(A=>A.value!==y.value):[...$,y])}else t((e==null?void 0:e.value)===y.value?null:y);s==null||s()},ue=()=>{if(!u)return;const y=Array.isArray(e)?e:[];if(m.every(N=>y.some(A=>A.value===N.value)))t(y.filter(N=>!m.some(A=>A.value===N.value)));else{const N=m.filter(A=>!y.some(St=>St.value===A.value));t([...y,...N])}},P=y=>{if(u){const N=(Array.isArray(e)?e:[]).filter(A=>A.value!==y);t(N),N.length===0&&U(!1)}else t(null),U(!1);s==null||s()},ne=a.columns.length+1,W=m.length>0&&m.every(y=>S.some($=>$.value===y.value)),Ie=m.some(y=>S.some($=>$.value===y.value)),ke=y=>S.some($=>$.value===y.value);return n.jsxs("div",{style:{marginBottom:16},children:[n.jsx(B.FieldLabel,{label:a.label,required:a.required,showOptional:a.showOptional,info:a.info,htmlFor:h,dataTestId:a.dataTestId??h}),n.jsxs("div",{style:T.wrapper(c),onBlur:s,id:h,children:[n.jsxs("div",{style:T.toolbar,children:[X>0?n.jsxs("button",{type:"button",style:T.selectedLink,onClick:()=>U(!0),children:[X," ",X===1?"Item":"Items"," Selected"]}):n.jsx("span",{style:{fontSize:13,color:"rgba(0,0,0,0.38)"},children:"No selection"}),n.jsxs("div",{style:T.searchWrap,children:[n.jsx(E.MdSearch,{size:15,color:"rgba(0,0,0,0.38)"}),n.jsx("input",{type:"text",placeholder:a.placeholder??"Search…",value:x,onChange:ee,style:T.searchInput,"aria-label":`Search ${a.label??""}`})]})]}),n.jsx("div",{style:{overflowX:"auto"},children:n.jsxs("table",{style:T.table,children:[n.jsx("thead",{style:T.thead,children:n.jsxs("tr",{children:[n.jsx("th",{style:T.checkTh,children:u&&n.jsx(Ze,{checked:W,indeterminate:!W&&Ie,onChange:ue,disabled:_||m.length===0})}),a.columns.map(y=>n.jsx("th",{style:T.th(y.width),children:y.label},y.key))]})}),n.jsx("tbody",{children:_?n.jsx("tr",{children:n.jsx("td",{colSpan:ne,style:T.statusRow,children:"Loading…"})}):m.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:ne,style:T.statusRow,children:"No results found"})}):m.map(y=>{const $=ke(y),N=z===y.value;return n.jsxs("tr",{style:{cursor:"pointer",background:$?"rgba(25,118,210,0.06)":N?"rgba(0,0,0,0.03)":"#fff",transition:"background 0.1s"},onClick:()=>te(y),onMouseEnter:()=>q(y.value),onMouseLeave:()=>q(null),"aria-selected":$,children:[n.jsx("td",{style:T.checkTd,children:u?n.jsx(Ze,{checked:$,onChange:()=>te(y)}):n.jsx("input",{type:"radio",checked:$,onChange:()=>te(y),onClick:A=>A.stopPropagation(),name:h,style:{accentColor:"#1976d2",width:16,height:16,cursor:"pointer"}})}),a.columns.map(A=>n.jsx("td",{style:T.td,children:String(y[A.key]??"")},A.key))]},y.value)})})]})}),n.jsxs("div",{style:T.footer,children:[n.jsx("span",{children:`${(d-1)*f+1}–${(d-1)*f+m.length} of many`}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[n.jsx("button",{type:"button",onClick:()=>{const y=d-1;g(y),R(x,y)},disabled:d<=1,style:T.pageBtn(d<=1),"aria-label":"Previous page",children:"‹"}),n.jsx("button",{type:"button",onClick:()=>{const y=d+1;g(y),R(x,y)},disabled:!j,style:T.pageBtn(!j),"aria-label":"Next page",children:"›"})]})]})]}),a.helperText&&!c&&n.jsx("small",{style:B.helperTextStyle,children:a.helperText}),c&&n.jsx("small",{"data-testid":`${h}-error`,style:B.errorTextStyle,children:i}),K&&n.jsx(yr,{selected:S,onRemove:P,onClose:()=>U(!1)})]})}class vr{constructor(){this.fields=new Map,this.register({type:"text",label:"Text"}),this.register({type:"textarea",label:"Textarea"}),this.register({type:"number",label:"Number",configSchema:{fields:[{id:"min",type:"number",label:"Minimum limit"},{id:"max",type:"number",label:"Maximum limit"},{id:"step",type:"number",label:"Step size"},{id:"prefix",type:"text",label:"Prefix (e.g. $)"},{id:"suffix",type:"text",label:"Suffix (e.g. USD)"}]}}),this.register({type:"toggle",label:"Toggle/Switch"}),this.register({type:"select",label:"Select"}),this.register({type:"descriptive-select",label:"Descriptive Select"}),this.register({type:"radio-group",label:"Radio Group"}),this.register({type:"key-value",label:"Key-Value"}),this.register({type:"reference",label:"Reference"}),this.register({type:"cron",label:"Cron"}),this.register({type:"object",label:"Object"}),this.register({type:"schema",label:"Schema (nested form)"}),this.register({type:"tabs",label:"Tabs"}),this.register({type:"date",label:"Date"}),this.register({type:"datetime",label:"Date & Time"}),this.register({type:"time",label:"Time"}),this.register({type:"tags",label:"Tags",configSchema:{fields:[{id:"placeholder",type:"text",label:"Placeholder text"},{id:"maxTags",type:"number",label:"Max tags (leave empty for unlimited)"}]}}),this.register({type:"slider",label:"Slider",configSchema:{fields:[{id:"min",type:"number",label:"Minimum value"},{id:"max",type:"number",label:"Maximum value"},{id:"step",type:"number",label:"Step size"},{id:"showValue",type:"toggle",label:"Show current value"},{id:"marks",type:"toggle",label:"Show tick marks"}]}}),this.register({type:"color",label:"Color",configSchema:{fields:[{id:"showHex",type:"toggle",label:"Show hex input"}]}}),this.register({type:"file",label:"File Upload",configSchema:{fields:[{id:"accept",type:"text",label:"Accepted file types (e.g. .pdf,.png)"},{id:"maxSizeMb",type:"number",label:"Max file size (MB)"},{id:"multiple",type:"toggle",label:"Allow multiple files"}]}}),this.register({type:"json-editor",label:"JSON Editor",configSchema:{fields:[{id:"rows",type:"number",label:"Editor height (rows)"}]}}),this.register({type:"code",label:"Code",configSchema:{fields:[{id:"language",type:"select",label:"Language",options:[{value:"javascript",label:"JavaScript"},{value:"typescript",label:"TypeScript"},{value:"python",label:"Python"},{value:"json",label:"JSON"}]},{id:"rows",type:"number",label:"Editor height (rows)"}]}}),this.register({type:"rich-text",label:"Rich Text",configSchema:{fields:[{id:"rows",type:"number",label:"Editor height (rows)"},{id:"toolbar",type:"toggle",label:"Show toolbar"}]}}),this.register({type:"table-picker",label:"Table Picker",component:xt,configSchema:{fields:[{id:"label",type:"text",label:"Label"},{id:"required",type:"toggle",label:"Required"},{id:"isMulti",type:"toggle",label:"Multi-select"},{id:"pageSize",type:"number",label:"Page size"}]}})}register(e){this.fields.set(e.type,e),e.component&&B.fieldRegistry.register(e.type,e.component)}get(e){return this.fields.get(e)}getAll(){return Array.from(this.fields.values())}getTypeOptions(){return this.getAll().map(e=>({value:e.type,label:e.label}))}}const Se=new vr;function we(r){const e={};for(const t of r){let s;try{s=B.resolveFieldKey(t)}catch{continue}if(!s||t.hidden)continue;if(t.validation){e[s]=t.validation;continue}let i;const l=Se.get(t.type);if(l!=null&&l.buildValidation)i=l.buildValidation(t);else switch(t.type){case"select":case"descriptive-select":case"radio-group":i=me(),t.required&&(i=i.required(`${t.label??s} is required`));break;case"number":case"slider":{let a=at().typeError(`${t.label??s} must be a number`);t.min!=null&&(a=a.min(t.min,`${t.label??s} must be at least ${t.min}`)),t.max!=null&&(a=a.max(t.max,`${t.label??s} must be at most ${t.max}`)),t.required&&(a=a.required(`${t.label??s} is required`)),i=a;break}case"toggle":case"checkbox":i=nt(),t.required&&(i=i.oneOf([!0],`${t.label??s} must be checked`));break;case"array":case"tags":{let a=ft();t.required&&(a=a.min(1,`${t.label??s} must have at least one item`)),t.maxTags!=null&&(a=a.max(t.maxTags,`${t.label??s} can have at most ${t.maxTags} items`)),i=a;break}case"object":case"schema":{const a=t.children??[];i=a.length>0?we(a):_e(),t.required&&(i=i.required(`${t.label??s} is required`));break}case"date":case"datetime":case"time":{let a=me();t.required&&(a=a.required(`${t.label??s} is required`)),i=a;break}default:{const a=t.inputType;let c=me();a==="email"?c=c.email(`${t.label??s} must be a valid email address`):a==="url"&&(c=c.url(`${t.label??s} must be a valid URL`));const u=t.minLength,f=t.maxLength;u!=null&&(c=c.min(u,`${t.label??s} must be at least ${u} characters`)),f!=null&&(c=c.max(f,`${t.label??s} must be at most ${f} characters`)),t.required&&(c=c.trim().required(`${t.label??s} is required`)),i=c;break}}e[s]=i}return _e().shape(e)}function jr({schema:r,initialValues:e,onSubmit:t,showErrorsImmediately:s=!1}){const i=r.fields??[],l=b.useMemo(()=>we(i),[i]),a=b.useMemo(()=>{if(s)return i.reduce((m,v)=>{const j=B.resolveFieldKey(v);return j&&(m[j]=!0),m},{})},[i,s]),[c,u]=b.useState({}),[f,h]=b.useState({}),x=b.useRef(e);b.useEffect(()=>{x.current!==e&&(x.current=e,u({}),h({}))},[e]);const p=wt.useFormik({initialValues:e,validationSchema:l,initialTouched:a,validateOnMount:s,validateOnChange:!0,validateOnBlur:!0,enableReinitialize:!0,onSubmit:async m=>{const v=B.buildEvaluationPayload({values:m,conditionConfig:f});await t(m,v)}}),d=b.useCallback(()=>{p.submitForm()},[p]),g=b.useCallback(m=>{p.resetForm(m?{values:m}:void 0),u({}),h({})},[p]);return{values:p.values,errors:p.errors,isValid:p.isValid,isDirty:p.dirty,isSubmitting:p.isSubmitting,formulaConfig:c,conditionConfig:f,submit:d,reset:g,setFieldValue:p.setFieldValue,_schema:r,_formik:p,_formulaConfig:c,_onFormulaConfigChange:u,_conditionConfig:f,_onConditionConfigChange:h}}const mt=Se.getTypeOptions(),k="form-control font-14",w="text-14 text-dark fw-medium mb-1 align-items-center d-flex gap-1",H={fontSize:10,fontWeight:700,color:"#94a3b8",textTransform:"uppercase",letterSpacing:.6,marginBottom:8,display:"block"},Sr=[{value:"text",label:"Text"},{value:"number",label:"Number"},{value:"email",label:"Email"},{value:"url",label:"URL"},{value:"password",label:"Password"},{value:"select",label:"Select"},{value:"object",label:"Object (sub-fields)"},{value:"array",label:"Array (nested)"}],wr=[{value:3,label:"1/4"},{value:4,label:"1/3"},{value:6,label:"1/2"},{value:8,label:"2/3"},{value:12,label:"Full"}];function kr({value:r,onChange:e}){const t=r??12;return n.jsxs(o.Box,{children:[n.jsx("span",{className:w,children:"Column width"}),n.jsx(o.Box,{sx:{display:"flex",gap:.5},children:wr.map(s=>n.jsx(o.Tooltip,{title:`colSpan: ${s.value}`,placement:"top",children:n.jsx(o.Box,{component:"button",onClick:()=>e(s.value),sx:{flex:1,border:"1px solid",borderColor:t===s.value?"#6366f1":"#dee2e6",borderRadius:"6px",cursor:"pointer",bgcolor:t===s.value?"#eef2ff":"#fff",color:t===s.value?"#6366f1":"#6c757d",fontSize:11,fontWeight:600,py:.6,px:0,"&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:s.label})},s.value))}),n.jsx(o.Box,{sx:{display:"flex",gap:"3px",mt:.75},children:Array.from({length:12}).map((s,i)=>n.jsx(o.Box,{sx:{flex:1,height:4,borderRadius:"2px",bgcolor:i<t?"#6366f1":"#e2e8f0",transition:"background 0.12s"}},i))})]})}function bt({options:r=[],onChange:e}){function t(s,i,l){e(r.map((a,c)=>c===s?{...a,[i]:l}:a))}return n.jsxs(o.Box,{children:[n.jsxs("span",{className:w,children:["Options ",n.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),n.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,mb:.75},children:r.map((s,i)=>n.jsxs(o.Box,{sx:{display:"flex",gap:.5,alignItems:"center"},children:[n.jsx("input",{className:k,style:{flex:1},placeholder:"Label",value:s.label,onChange:l=>t(i,"label",l.target.value)}),n.jsx("input",{className:k,style:{flex:1},placeholder:"Value",value:s.value,onChange:l=>t(i,"value",l.target.value)}),n.jsx(o.Box,{component:"button",onClick:()=>e(r.filter((l,a)=>a!==i)),sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:n.jsx(E.MdClose,{size:13})})]},i))}),n.jsxs(o.Box,{component:"button",onClick:()=>e([...r,{label:"",value:""}]),sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,px:1,py:.5,borderRadius:"6px",color:"#6366f1",width:"100%","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:[n.jsx(E.MdAdd,{size:13})," Add option"]})]})}const gt=[{value:"operator",label:"Operator (predefined)"},{value:"select",label:"Select"},{value:"text",label:"Text"}];function Tr({col:r,onChange:e,onDelete:t}){const s=r.type==="select",i=r.type==="operator";return n.jsxs(o.Box,{sx:{border:"1px solid #e2e8f0",borderRadius:"7px",p:1.25,bgcolor:"#fff",display:"flex",flexDirection:"column",gap:1},children:[n.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[n.jsx(o.Box,{sx:{fontSize:10,fontWeight:700,px:.75,py:.2,borderRadius:"4px",bgcolor:i?"#fef9c3":"#eef2ff",color:i?"#92400e":"#6366f1",flexShrink:0},children:i?"OPERATOR":r.type.toUpperCase()}),n.jsx(o.Box,{sx:{fontSize:12,fontWeight:600,color:"#0f172a",flex:1},children:r.label||r.id||"Unnamed"}),n.jsx(o.Box,{component:"button",onClick:t,sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:n.jsx(E.MdClose,{size:13})})]}),n.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Column type"}),n.jsx("select",{value:r.type,onChange:l=>e({...r,type:l.target.value,options:void 0}),className:k,style:{cursor:"pointer"},children:gt.map(l=>n.jsx("option",{value:l.value,children:l.label},l.value))})]}),n.jsxs(o.Box,{children:[n.jsxs("label",{className:w,children:["Column key ",n.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),n.jsx("input",{className:`${k} ${r.id?"":"border-danger"}`,value:r.id,onChange:l=>e({...r,id:l.target.value}),placeholder:"e.g. field, operator, value"}),!r.id&&n.jsx("span",{style:{fontSize:10,color:"#dc3545"},children:"Required — used as data key"})]})]}),!i&&n.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Label"}),n.jsx("input",{className:k,value:r.label??"",onChange:l=>e({...r,label:l.target.value||void 0}),placeholder:"Column label"})]}),n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Placeholder"}),n.jsx("input",{className:k,value:r.placeholder??"",onChange:l=>e({...r,placeholder:l.target.value||void 0}),placeholder:"Hint…"})]})]}),s&&n.jsx(bt,{options:r.options??[],onChange:l=>e({...r,options:l})}),i&&n.jsx(o.Box,{sx:{bgcolor:"#fefce8",border:"1px solid #fef08a",borderRadius:"6px",px:1.25,py:.75},children:n.jsx(o.Box,{sx:{fontSize:11,color:"#78350f"},children:"Predefined: equals, not equals, contains, starts with, ends with, is present, is not present, greater than, less than…"})}),!i&&n.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[n.jsx("input",{type:"checkbox",id:`formula-${r.id}`,checked:!!r.formula,onChange:l=>e({...r,formula:l.target.checked||void 0}),style:{cursor:"pointer",width:14,height:14}}),n.jsx("label",{htmlFor:`formula-${r.id}`,className:w,style:{margin:0,cursor:"pointer"},children:"Formula input (chip editor)"})]})]})}function Cr({condition:r,onChange:e}){const t=!!r;function s(){e(t?void 0:{fields:[]})}function i(c){if(!r)return;const u=c==="operator"?"operator":r.fields.filter(f=>f.type!=="operator").length===0?"field":"value";e({...r,fields:[...r.fields,{id:u,type:c}]})}function l(c,u){if(!r)return;const f=[...r.fields];f[c]=u,e({...r,fields:f})}function a(c){r&&e({...r,fields:r.fields.filter((u,f)=>f!==c)})}return n.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[n.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75,mb:t?1.25:0},children:[n.jsx("input",{type:"checkbox",id:"enable-condition",checked:t,onChange:s,style:{cursor:"pointer",width:14,height:14}}),n.jsx("span",{style:{...H,margin:0,color:t?"#6366f1":"#94a3b8"},children:"Condition row"})]}),t&&r&&n.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:[r.fields.map((c,u)=>n.jsx(Tr,{col:c,onChange:f=>l(u,f),onDelete:()=>a(u)},u)),n.jsx(o.Box,{sx:{display:"flex",gap:.5},children:gt.map(c=>n.jsxs(o.Box,{component:"button",onClick:()=>i(c.value),sx:{flex:1,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,py:.5,borderRadius:"6px",color:c.value==="operator"?"#92400e":"#6366f1","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:["+ ",c.value==="operator"?"Operator":c.label.split(" ")[0]]},c.value))}),n.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:2,flexWrap:"wrap"},children:[n.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[n.jsx("input",{type:"checkbox",id:"allow-groups",checked:!!r.allowGroups,onChange:c=>e({...r,allowGroups:c.target.checked||void 0}),style:{cursor:"pointer",width:14,height:14}}),n.jsx("label",{htmlFor:"allow-groups",className:w,style:{margin:0,cursor:"pointer"},children:"Allow nested groups"})]}),r.allowGroups&&n.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[n.jsx("label",{className:w,style:{margin:0},children:"Max depth"}),n.jsx("input",{type:"number",min:1,max:5,className:k,style:{width:60,textAlign:"center"},value:r.maxGroupDepth??"",onChange:c=>e({...r,maxGroupDepth:c.target.value?Number(c.target.value):void 0}),placeholder:"∞"})]})]})]})]})}function le({id:r,label:e,checked:t,onChange:s}){return n.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[n.jsx("input",{type:"checkbox",id:r,checked:t,onChange:i=>s(i.target.checked),style:{cursor:"pointer",width:14,height:14,flexShrink:0}}),n.jsx("label",{htmlFor:r,className:w,style:{margin:0,cursor:"pointer"},children:e})]})}function Fr({views:r=[],onChange:e}){function t(i,l,a){e(r.map((c,u)=>u===i?{...c,[l]:a}:c))}function s(){const i=`tab${r.length+1}`;e([...r,{id:i,label:`Tab ${r.length+1}`}])}return n.jsxs(o.Box,{children:[n.jsx("span",{className:w,children:"Views"}),n.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,mb:.75},children:r.map((i,l)=>n.jsxs(o.Box,{sx:{display:"flex",gap:.5,alignItems:"center"},children:[n.jsx("input",{className:k,style:{flex:1},placeholder:"Label",value:i.label,onChange:a=>t(l,"label",a.target.value)}),n.jsx("input",{className:k,style:{flex:1},placeholder:"ID (no spaces)",value:i.id,onChange:a=>t(l,"id",a.target.value.replace(/\s/g,"_"))}),n.jsx(o.Box,{component:"button",onClick:()=>e(r.filter((a,c)=>c!==l)),sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:n.jsx(E.MdClose,{size:13})})]},l))}),n.jsxs(o.Box,{component:"button",onClick:s,sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,px:1,py:.5,borderRadius:"6px",color:"#6366f1",width:"100%","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:[n.jsx(E.MdAdd,{size:13})," Add view"]})]})}function pe({label:r,value:e,options:t,onChange:s}){return n.jsxs(o.Box,{children:[n.jsx("span",{className:w,children:r}),n.jsx(o.Box,{sx:{display:"flex",border:"1px solid #dee2e6",borderRadius:"7px",overflow:"hidden"},children:t.map(i=>n.jsx(o.Box,{component:"button",onClick:()=>s(i.value),sx:{flex:1,border:"none",borderRight:"1px solid #dee2e6",cursor:"pointer",fontSize:12,fontWeight:600,py:.6,bgcolor:e===i.value?"#eef2ff":"#fff",color:e===i.value?"#6366f1":"#6c757d","&:last-child":{borderRight:"none"},"&:hover":{bgcolor:"#f5f3ff"}},children:i.label},i.value))})]})}function yt({field:r,onChange:e,onSave:t,onCancel:s,noFooter:i}){const[l,a]=b.useState(!1),c=r.id??r.name??"",u=r,f=r.type==="select"||r.type==="descriptive-select"||r.type==="radio-group",h=Se.get(r.type),x=h==null?void 0:h.configSchema;function p(d,g){e({...r,[d]:g})}return n.jsxs(n.Fragment,{children:[n.jsxs(o.Box,{sx:{flex:1,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.75},children:[n.jsxs(o.Box,{children:[n.jsx("span",{style:H,children:"Required"}),n.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:[n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Type"}),n.jsx("select",{value:r.type,onChange:d=>p("type",d.target.value),className:k,style:{cursor:"pointer"},children:mt.map(d=>n.jsx("option",{value:d.value,children:d.label},d.value))})]}),n.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:r.type==="tabs"?"1fr":"1fr 1fr",gap:1},children:[n.jsxs(o.Box,{children:[n.jsxs("label",{className:w,children:["Field ID ",n.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),n.jsx("input",{className:k,value:r.id??r.name??"",onChange:d=>p("id",d.target.value),placeholder:"e.g. email"})]}),r.type!=="tabs"&&n.jsxs(o.Box,{children:[n.jsxs("label",{className:w,children:["Label ",n.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),n.jsx("input",{className:k,value:r.label??"",onChange:d=>p("label",d.target.value),placeholder:"Display label"})]})]}),r.type!=="tabs"&&n.jsx(kr,{value:r.colSpan,onChange:d=>p("colSpan",d===12?void 0:d)})]})]}),x&&n.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[n.jsx("span",{style:H,children:"Specific Settings"}),n.jsx(B.FlowForm,{schema:{layout:"flat",compact:!0,fields:x.fields},initialValues:r,onValuesChange:d=>e({...r,...d}),onSubmit:()=>{}})]}),r.type==="tabs"&&n.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5,display:"flex",flexDirection:"column",gap:1.5},children:[n.jsx("span",{style:H,children:"Content"}),n.jsx(Fr,{views:(u.tabs??[]).map(d=>({id:d.id,label:d.label})),onChange:d=>{const g=u.tabs??[],m=d.map(v=>{const j=g.find(C=>C.id===v.id);return j?{...j,...v}:{...v,fields:[]}});e({...r,tabs:m})}}),n.jsx("span",{style:{...H,marginTop:4},children:"Interaction"}),n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Disabled"}),n.jsx("input",{className:k,value:u.disabledExpr??"",onChange:d=>e({...r,disabledExpr:d.target.value||void 0}),placeholder:"false"})]}),n.jsx("span",{style:{...H,marginTop:4},children:"Appearance"}),n.jsx(pe,{label:"Alignment",value:u.alignment??"left",options:[{value:"left",label:"|←"},{value:"center-left",label:"←|"},{value:"center",label:"|·|"},{value:"center-right",label:"|→"},{value:"right",label:"→|"}],onChange:d=>e({...r,alignment:d})}),n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Hidden"}),n.jsx("input",{className:k,value:u.hiddenExpr??"",onChange:d=>e({...r,hiddenExpr:d.target.value||void 0}),placeholder:"false"})]}),n.jsx(pe,{label:"Variant",value:u.variant??"line",options:[{value:"pill",label:"Pill"},{value:"line",label:"Line"}],onChange:d=>e({...r,variant:d})}),n.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:1},children:[n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Active color"}),n.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[n.jsx("input",{type:"color",value:u.activeColor??"#6366f1",onChange:d=>e({...r,activeColor:d.target.value}),style:{width:28,height:28,border:"1px solid #dee2e6",borderRadius:6,cursor:"pointer",padding:2,background:"#fff"}}),n.jsx("input",{className:k,value:u.activeColor??"",onChange:d=>e({...r,activeColor:d.target.value||void 0}),placeholder:"#6366f1",style:{flex:1}})]})]}),n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Active text"}),n.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[n.jsx("input",{type:"color",value:u.activeTextColor??"#ffffff",onChange:d=>e({...r,activeTextColor:d.target.value}),style:{width:28,height:28,border:"1px solid #dee2e6",borderRadius:6,cursor:"pointer",padding:2,background:"#fff"}}),n.jsx("input",{className:k,value:u.activeTextColor??"",onChange:d=>e({...r,activeTextColor:d.target.value||void 0}),placeholder:"auto",style:{flex:1}})]})]}),n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Inactive text"}),n.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[n.jsx("input",{type:"color",value:u.inactiveTextColor??"#64748b",onChange:d=>e({...r,inactiveTextColor:d.target.value}),style:{width:28,height:28,border:"1px solid #dee2e6",borderRadius:6,cursor:"pointer",padding:2,background:"#fff"}}),n.jsx("input",{className:k,value:u.inactiveTextColor??"",onChange:d=>e({...r,inactiveTextColor:d.target.value||void 0}),placeholder:"#64748b",style:{flex:1}})]})]})]}),n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Styles"}),n.jsx("input",{className:k,value:u.styles??"",onChange:d=>e({...r,styles:d.target.value||void 0}),placeholder:"None"})]}),n.jsx("span",{style:{...H,marginTop:4},children:"Spacing"}),n.jsx(pe,{label:"Height",value:u.height??"auto",options:[{value:"auto",label:"Auto"},{value:"fixed",label:"Fixed"}],onChange:d=>e({...r,height:d})}),n.jsx(pe,{label:"Margin",value:u.margin??"normal",options:[{value:"normal",label:"Normal"},{value:"none",label:"None"}],onChange:d=>e({...r,margin:d})})]}),f&&n.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[n.jsx("span",{style:H,children:"Options"}),n.jsx(bt,{options:u.options??[],onChange:d=>e({...r,options:d})})]}),r.type==="array"&&n.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5,display:"flex",flexDirection:"column",gap:1},children:[n.jsx("span",{style:H,children:"Array settings"}),n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Item type"}),n.jsx("select",{className:k,style:{cursor:"pointer"},value:u.itemType??"text",onChange:d=>e({...r,itemType:d.target.value}),children:Sr.map(d=>n.jsx("option",{value:d.value,children:d.label},d.value))})]}),n.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Item label"}),n.jsx("input",{className:k,value:u.itemLabel??"",onChange:d=>e({...r,itemLabel:d.target.value||void 0}),placeholder:'e.g. "Member"'})]}),n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Add button label"}),n.jsx("input",{className:k,value:u.addLabel??"",onChange:d=>e({...r,addLabel:d.target.value||void 0}),placeholder:"Add item"})]})]}),n.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Min items"}),n.jsx("input",{type:"number",min:0,className:k,value:u.minItems??"",onChange:d=>e({...r,minItems:d.target.value?Number(d.target.value):void 0}),placeholder:"0"})]}),n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Max items"}),n.jsx("input",{type:"number",min:1,className:k,value:u.maxItems??"",onChange:d=>e({...r,maxItems:d.target.value?Number(d.target.value):void 0}),placeholder:"∞"})]})]}),!["object","array","select"].includes(u.itemType??"text")&&n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Item placeholder"}),n.jsx("input",{className:k,value:u.itemPlaceholder??"",onChange:d=>e({...r,itemPlaceholder:d.target.value||void 0}),placeholder:"Enter value…"})]})]}),n.jsx(Cr,{condition:r.condition,onChange:d=>e({...r,condition:d})}),n.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[n.jsx(o.Box,{component:"button",onClick:()=>a(d=>!d),sx:{background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:.5,p:0,mb:l?1.25:0},children:n.jsxs("span",{style:{...H,margin:0,color:l?"#6366f1":"#94a3b8"},children:[l?"▾":"▸"," Optional settings"]})}),n.jsx(o.Collapse,{in:l,children:n.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[n.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Placeholder"}),n.jsx("input",{className:k,value:r.placeholder??"",onChange:d=>p("placeholder",d.target.value||void 0),placeholder:"Hint text…"})]}),n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Helper text"}),n.jsx("input",{className:k,value:r.helperText??"",onChange:d=>p("helperText",d.target.value||void 0),placeholder:"Description…"})]})]}),n.jsxs(o.Box,{children:[n.jsx("label",{className:w,children:"Info tooltip"}),n.jsx("input",{className:k,value:r.info??"",onChange:d=>p("info",d.target.value||void 0),placeholder:"Shown in ℹ tooltip"})]}),n.jsxs(o.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1.5},children:[n.jsx(le,{id:`${c}-req`,label:"Required",checked:!!r.required,onChange:d=>p("required",d||void 0)}),n.jsx(le,{id:`${c}-dis`,label:"Disabled",checked:!!r.disabled,onChange:d=>p("disabled",d||void 0)}),n.jsx(le,{id:`${c}-hid`,label:"Hidden",checked:!!r.hidden,onChange:d=>p("hidden",d||void 0)}),n.jsx(le,{id:`${c}-opt`,label:"Show optional",checked:!!r.showOptional,onChange:d=>p("showOptional",d||void 0)}),n.jsx(le,{id:`${c}-div`,label:"Divider after",checked:!!r.dividerAfter,onChange:d=>p("dividerAfter",d||void 0)}),n.jsx(le,{id:`${c}-frm`,label:"Formula input",checked:!!r.formula,onChange:d=>p("formula",d||void 0)})]})]})})]})]}),!i&&n.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",gap:1,justifyContent:"flex-end",bgcolor:"#f8fafc",flexShrink:0},children:[n.jsx(o.Box,{component:"button",onClick:s,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),n.jsxs(o.Box,{component:"button",onClick:t,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[n.jsx(E.MdCheck,{size:15})," Save"]})]})]})}const ge={text:"#0f172a",textMuted:"#64748b",borderInput:"rgba(0,0,0,0.23)",bg:"#ffffff"},Or={md:"6px"},vt={sm:11,md:13},Ce={width:"100%",fontSize:vt.md,fontFamily:"inherit",padding:"8px 12px",border:`1px solid ${ge.borderInput}`,borderRadius:Or.md,outline:"none",background:ge.bg,color:ge.text,boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s"};function He(){return{type:"text",id:"",label:"",colSpan:12}}function Er(r){return r.type==="object"||r.type==="array"||r.type==="schema"}function $r(r){if(r.type==="object")return"Child Fields";if(r.type==="schema")return"Schema Fields";const e=r.itemType??"text";return e==="object"?"Item Fields":e==="select"?"Item Options":"Item Config"}function _r({field:r,onChange:e}){var i;const t=r,s=t.itemType??"text";if(r.type==="object")return n.jsxs(o.Box,{sx:{p:2.5},children:[n.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Define the fields nested inside this object. Each child field can itself be an object or array."}),n.jsx(de,{value:r.children??[],onChange:l=>e({...r,children:l}),label:"Child fields"})]});if(r.type==="schema")return n.jsxs(o.Box,{sx:{p:2.5},children:[n.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Define the fields inside this schema. When the form is filled, their values are collected into a single object as this field's value."}),n.jsx(de,{value:r.children??[],onChange:l=>e({...r,children:l}),label:"Schema fields"})]});if(r.type==="array"){if(s==="object")return n.jsxs(o.Box,{sx:{p:2.5},children:[n.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Define the fields for each item in the array. Each item will be an object with these fields."}),n.jsx(de,{value:t.itemFields??[],onChange:l=>e({...r,itemFields:l}),label:"Item fields"})]});if(s==="select"){const l=t.itemOptions??[];return n.jsxs(o.Box,{sx:{p:2.5},children:[n.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Options available in each select item."}),n.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,mb:.75},children:l.map((a,c)=>n.jsxs(o.Box,{sx:{display:"flex",gap:.5,alignItems:"center"},children:[n.jsx("input",{style:{...Ce,flex:1,padding:"6px 10px"},placeholder:"Label",value:a.label,onChange:u=>{const f=l.map((h,x)=>x===c?{...h,label:u.target.value}:h);e({...r,itemOptions:f})}}),n.jsx("input",{style:{...Ce,flex:1,padding:"6px 10px"},placeholder:"Value",value:a.value,onChange:u=>{const f=l.map((h,x)=>x===c?{...h,value:u.target.value}:h);e({...r,itemOptions:f})}}),n.jsx(o.Box,{component:"button",onClick:()=>e({...r,itemOptions:l.filter((u,f)=>f!==c)}),sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:"✕"})]},c))}),n.jsx(o.Box,{component:"button",onClick:()=>e({...r,itemOptions:[...l,{label:"",value:""}]}),sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,px:1,py:.5,borderRadius:"6px",color:"#6366f1",width:"100%",justifyContent:"center","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:"+ Add option"})]})}if(s==="array"){const l=((i=t.itemSchema)==null?void 0:i.itemType)??"text",a=[{value:"text",label:"Text"},{value:"number",label:"Number"},{value:"email",label:"Email"},{value:"url",label:"URL"},{value:"password",label:"Password"},{value:"select",label:"Select"},{value:"object",label:"Object"}];return n.jsxs(o.Box,{sx:{p:2.5},children:[n.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Each item is itself an array. Configure the type of items inside the nested array."}),n.jsx("label",{style:{fontSize:vt.sm,fontWeight:600,color:ge.textMuted,display:"block",marginBottom:3},children:"Nested item type"}),n.jsx("select",{style:{...Ce,padding:"6px 10px",cursor:"pointer"},value:l,onChange:c=>e({...r,itemSchema:{...t.itemSchema??{},itemType:c.target.value}}),children:a.map(c=>n.jsx("option",{value:c.value,children:c.label},c.value))})]})}return n.jsx(o.Box,{sx:{p:2.5},children:n.jsxs(o.Box,{sx:{border:"1.5px dashed #e2e8f0",borderRadius:"8px",py:3,textAlign:"center"},children:[n.jsxs(o.Typography,{sx:{fontSize:13,color:"#94a3b8"},children:["No extra configuration needed for ",n.jsx("strong",{children:s})," items."]}),n.jsx(o.Typography,{sx:{fontSize:11,color:"#cbd5e1",mt:.5},children:"Item placeholder and labels are set in the previous step."})]})})}return null}function Br({field:r}){var a;const[e,t]=b.useState({}),s=r.id??r.name??"preview",i=[{value:3,label:"1/4"},{value:4,label:"1/3"},{value:6,label:"1/2"},{value:8,label:"2/3"},{value:12,label:"Full"}],l=r.colSpan&&r.colSpan<12?((a=i.find(c=>c.value===r.colSpan))==null?void 0:a.label)??r.colSpan:"Full";return n.jsxs(o.Box,{sx:{p:2.5},children:[n.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",mb:2,px:1.25,py:.75,bgcolor:"#f0fdf4",border:"1px solid #bbf7d0",borderRadius:"7px"},children:[n.jsx(o.Typography,{sx:{fontSize:11,color:"#15803d",fontWeight:500,flex:1},children:"Live preview — interact to test the field"}),n.jsxs(o.Typography,{sx:{fontSize:11,color:"#64748b"},children:["Width: ",l]})]}),n.jsx(B.FlowForm,{schema:{layout:"flat",fields:[r]},initialValues:{[s]:r.type==="array"?[]:r.type==="object"||r.type==="schema"?{}:""},onSubmit:()=>{},conditionConfig:e,onConditionConfigChange:t})]})}function Be({open:r,initial:e,onSave:t,onClose:s,editMode:i=!1}){const[l,a]=b.useState(1),[c,u]=b.useState(()=>e??He());function f(){u(e??He()),a(1)}const h=Er(c),x=h?3:2,p=h?["Configure",$r(c),"Preview"]:["Configure","Preview"],d=!!(c.id||c.name)&&!!c.type;function g(){a(F=>Math.min(F+1,x))}function m(){a(F=>Math.max(F-1,1))}function v(){t(c),s()}const j=l-1,C=l===x,_=h&&l===3||!h&&l===2;return n.jsxs(o.Dialog,{open:r,onClose:s,TransitionProps:{onEnter:f},maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"90vh"}},children:[n.jsxs(o.Box,{sx:{px:2.5,pt:1.75,pb:0,borderBottom:"1px solid #e2e8f0",flexShrink:0},children:[n.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",mb:1.5},children:[n.jsx(o.Typography,{sx:{fontSize:14,fontWeight:700,color:"#0f172a",flex:1},children:i?"Edit Field":"Add Field"}),n.jsx(o.IconButton,{size:"small",onClick:s,sx:{color:"#94a3b8"},children:n.jsx(E.MdClose,{size:17})})]}),n.jsx(o.Stepper,{activeStep:j,sx:{pb:1.5},children:p.map((F,z)=>n.jsx(o.Step,{completed:j>z,children:n.jsx(o.StepLabel,{children:F})},F))})]}),n.jsxs(o.Box,{sx:{flex:1,overflowY:"auto"},children:[l===1&&n.jsx(yt,{field:c,onChange:u,onSave:g,onCancel:s,noFooter:!0}),l===2&&h&&n.jsx(_r,{field:c,onChange:u}),_&&n.jsx(Br,{field:c})]}),n.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",alignItems:"center",gap:1,flexShrink:0,bgcolor:"#f8fafc"},children:[l>1&&n.jsxs(o.Box,{component:"button",onClick:m,sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"none",cursor:"pointer",fontSize:13,fontWeight:500,color:"#6c757d",px:0,"&:hover":{color:"#0f172a"}},children:[n.jsx(E.MdArrowBack,{size:14})," Back"]}),n.jsx(o.Box,{sx:{flex:1}}),n.jsx(o.Box,{component:"button",onClick:s,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),C?n.jsxs(o.Box,{component:"button",onClick:v,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[n.jsx(E.MdCheck,{size:15})," ",i?"Save changes":"Add field"]}):n.jsx(o.Box,{component:"button",onClick:g,disabled:!d,sx:{border:"none",cursor:d?"pointer":"not-allowed",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:d?"#6366f1":"#c7d2fe",color:"#fff","&:hover":{bgcolor:d?"#4f46e5":"#c7d2fe"}},children:"Next →"})]})]})}function Nr({field:r,index:e,total:t,onEdit:s,onDelete:i,onMoveUp:l,onMoveDown:a}){const c=r.label||r.id||r.name||"Untitled",u=r.id??r.name??"";return n.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1,border:"1px solid #e2e8f0",borderRadius:"8px",bgcolor:"#fff"},children:[n.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.25,color:"#cbd5e1"},children:[n.jsx(o.Box,{component:"button",onClick:l,disabled:e===0,sx:{background:"none",border:"none",p:0,cursor:e===0?"default":"pointer",color:e===0?"#e2e8f0":"#94a3b8",lineHeight:1,fontSize:10,"&:hover":{color:e===0?"#e2e8f0":"#475569"}},children:"▲"}),n.jsx(o.Box,{component:"button",onClick:a,disabled:e===t-1,sx:{background:"none",border:"none",p:0,cursor:e===t-1?"default":"pointer",color:e===t-1?"#e2e8f0":"#94a3b8",lineHeight:1,fontSize:10,"&:hover":{color:e===t-1?"#e2e8f0":"#475569"}},children:"▼"})]}),n.jsx(o.Box,{sx:{fontSize:10,fontWeight:700,px:.75,py:.2,borderRadius:"4px",bgcolor:"#eef2ff",color:"#6366f1",flexShrink:0},children:r.type}),n.jsxs(o.Box,{sx:{flex:1,minWidth:0},children:[n.jsxs(o.Typography,{sx:{fontSize:13,fontWeight:600,color:"#0f172a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[c,r.required&&n.jsx(o.Box,{component:"span",sx:{color:"#dc3545",ml:.25},children:"*"})]}),n.jsx(o.Typography,{sx:{fontSize:11,color:"#94a3b8",fontFamily:"monospace"},children:u})]}),n.jsx(o.Tooltip,{title:"Edit field",placement:"top",children:n.jsx(o.Box,{component:"button",onClick:s,sx:{background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:"6px",p:0,color:"#94a3b8","&:hover":{bgcolor:"#f1f5f9",color:"#475569"}},children:n.jsx(E.MdEdit,{size:14})})}),n.jsx(o.Tooltip,{title:"Remove field",placement:"top",children:n.jsx(o.Box,{component:"button",onClick:i,sx:{background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:"6px",p:0,color:"#94a3b8","&:hover":{bgcolor:"#fee2e2",color:"#dc2626"}},children:n.jsx(E.MdDeleteOutline,{size:16})})})]})}function Ar({open:r,value:e,onSave:t,onClose:s}){const[i,l]=b.useState(e),[a,c]=b.useState(null);function u(){l(e),c(null)}function f(g){l(m=>m.filter((v,j)=>j!==g))}function h(g,m){l(v=>{const j=[...v],C=g+m;return C<0||C>=j.length?v:([j[g],j[C]]=[j[C],j[g]],j)})}function x(g){a!==null&&(l(m=>{const v=[...m];return v[a]=g,v}),c(null))}function p(){t(i),s()}const d=JSON.stringify(i)!==JSON.stringify(e);return n.jsxs(n.Fragment,{children:[n.jsxs(o.Dialog,{open:r,onClose:s,TransitionProps:{onEnter:u},maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"85vh"}},children:[n.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",px:2.5,py:1.75,borderBottom:"1px solid #e2e8f0",flexShrink:0},children:[n.jsxs(o.Box,{sx:{flex:1},children:[n.jsx(o.Typography,{sx:{fontSize:14,fontWeight:700,color:"#0f172a"},children:"Edit Schema"}),n.jsxs(o.Typography,{sx:{fontSize:11,color:"#94a3b8"},children:[i.length," field",i.length!==1?"s":""," defined"]})]}),n.jsx(o.IconButton,{size:"small",onClick:s,sx:{color:"#94a3b8"},children:n.jsx(E.MdClose,{size:17})})]}),n.jsx(o.Box,{sx:{flex:1,overflowY:"auto",p:2.5},children:i.length===0?n.jsx(o.Box,{sx:{border:"1.5px dashed rgba(0,0,0,0.12)",borderRadius:"8px",py:4,textAlign:"center"},children:n.jsx(o.Typography,{sx:{fontSize:13,color:"#94a3b8"},children:"No fields defined yet"})}):n.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.75},children:i.map((g,m)=>n.jsx(Nr,{field:g,index:m,total:i.length,onEdit:()=>c(m),onDelete:()=>f(m),onMoveUp:()=>h(m,-1),onMoveDown:()=>h(m,1)},`${g.id??g.name}-${m}`))})}),n.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",alignItems:"center",gap:1,flexShrink:0,bgcolor:"#f8fafc"},children:[d?n.jsx(o.Typography,{sx:{fontSize:11,color:"#f59e0b",fontWeight:500,flex:1},children:"Unsaved changes"}):n.jsx(o.Box,{sx:{flex:1}}),n.jsx(o.Box,{component:"button",onClick:s,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),n.jsxs(o.Box,{component:"button",onClick:p,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[n.jsx(E.MdCheck,{size:15})," Done"]})]})]}),a!==null&&n.jsx(Be,{open:a!==null,initial:i[a],onSave:x,onClose:()=>c(null),editMode:!0})]})}function jt(r){const e={};for(const t of r){const s=t.id??t.name??"";s&&(t.type==="array"?e[s]=[]:t.type==="object"||t.type==="schema"?e[s]=jt(t.children??[]):e[s]="")}return e}function de({value:r,onChange:e,suggestions:t,label:s="Fields",onPayload:i,validate:l=!0,onValidityChange:a,variableGroups:c,initialValues:u,initialFormulaConfig:f,initialConditionConfig:h}){const[x,p]=b.useState(!1),[d,g]=b.useState(!1),[m,v]=b.useState(null),[j,C]=b.useState(f??{}),[_,F]=b.useState(h??{}),z=b.useRef(u??{}),q=b.useMemo(()=>jt(r),[r]),K=b.useMemo(()=>u&&Object.keys(u).length>0?{...q,...u}:q,[q,u]),U=b.useMemo(()=>l?we(r):void 0,[l,r]);b.useEffect(()=>{i&&i({schema:r,formulaConfig:j,conditionConfig:_,conditionExpressions:B.serializeConditionExpressions(_),values:z.current,evaluationPayload:B.buildEvaluationPayload({values:z.current,conditionConfig:_})})},[_,j,r]);const D=b.useCallback(R=>{z.current=R,i&&i({schema:r,formulaConfig:j,conditionConfig:_,conditionExpressions:B.serializeConditionExpressions(_),values:R,evaluationPayload:B.buildEvaluationPayload({values:R,conditionConfig:_})})},[r,j,_,i]);function V(R){e([...r,R])}function O(R){if(!m)return;const{containerFieldId:ee,tabId:te}=m,ue=r.map(P=>{if((P.id??P.name)!==ee)return P;const ne=P.tabs??[];return{...P,tabs:ne.map(W=>W.id===te?{...W,fields:[...W.fields??[],R]}:W)}});e(ue),v(null)}function S(R,ee,te){const ue=r.map(P=>{if((P.id??P.name)!==R)return P;const ne=P.tabs??[];return{...P,tabs:ne.map(W=>W.id===ee?{...W,fields:(W.fields??[]).filter((Ie,ke)=>ke!==te)}:W)}});e(ue)}const X=b.useMemo(()=>({openAddFieldDialog:(R,ee)=>v({containerFieldId:R,tabId:ee}),removeFieldFromTab:S}),[r,e]),ce=n.jsxs("div",{className:"schema-builder-root",children:[r.length>0&&n.jsx("div",{className:"schema-builder-header",children:n.jsxs("div",{className:"schema-builder-actions",children:[n.jsx(o.Tooltip,{title:"Edit schema",placement:"top",children:n.jsxs("button",{className:"sb-btn sb-btn-outline",onClick:()=>g(!0),children:[n.jsx(E.MdSettings,{size:13})," Edit Schema"]})}),n.jsx(o.Tooltip,{title:"Add a new field",placement:"top",children:n.jsxs("button",{className:"sb-btn sb-btn-primary",onClick:()=>p(!0),children:[n.jsx(E.MdAdd,{size:14})," Add Field"]})})]})}),r.length>0?n.jsx(B.TabsEditContext.Provider,{value:X,children:n.jsx(B.FlowForm,{schema:{layout:"flat",fields:r},initialValues:K,onSubmit:()=>{},validationSchema:U,onValidityChange:a,onValuesChange:i?D:void 0,formulaConfig:j,onFormulaConfigChange:C,conditionConfig:_,onConditionConfigChange:F})}):n.jsxs("div",{className:"schema-builder-empty-state",children:[n.jsx(kt.FaWpforms,{size:40,className:"schema-builder-empty-icon"}),n.jsx("p",{className:"schema-builder-empty-title",children:"Tell us what fields should be in the list, and assign values to them."}),n.jsx("div",{className:"schema-builder-empty-actions",children:n.jsx("button",{className:"btn",onClick:()=>p(!0),children:"Add field"})})]}),n.jsx(Be,{open:x,onSave:V,onClose:()=>p(!1)}),n.jsx(Ar,{open:d,value:r,onSave:e,onClose:()=>g(!1)}),n.jsx(Be,{open:!!m,onSave:O,onClose:()=>v(null)})]});return c?n.jsxs(B.VariablePickerProvider,{groups:c,children:[n.jsx(B.VariablePicker,{width:260,mode:"popover"}),ce]}):ce}function Rr({fields:r,onOpen:e}){return n.jsxs(o.Box,{sx:{border:"1px solid #e2e8f0",borderRadius:"8px",bgcolor:"#fff",overflow:"hidden"},children:[r.length>0?n.jsx(o.Box,{sx:{px:1.5,py:1.25,display:"flex",flexWrap:"wrap",gap:.5},children:r.map((t,s)=>{const i=t.id??t.name??"";return n.jsx(o.Tooltip,{title:`${t.type} · ${i}`,placement:"top",children:n.jsx(o.Chip,{label:t.label||i,size:"small",sx:{fontSize:11,fontWeight:500,height:22,bgcolor:"#f1f5f9",color:"#334155",border:"1px solid #e2e8f0","& .MuiChip-label":{px:1}}})},s)})}):n.jsx(o.Box,{sx:{px:1.5,py:1.5},children:n.jsx(o.Typography,{sx:{fontSize:12,color:"#94a3b8"},children:"No fields defined yet"})}),n.jsx(o.Divider,{sx:{borderColor:"#f1f5f9"}}),n.jsxs(o.Box,{onClick:e,sx:{display:"flex",alignItems:"center",gap:.75,px:1.5,py:1,cursor:"pointer","&:hover":{bgcolor:"#f8fafc"},transition:"background 0.12s"},children:[r.length===0?n.jsx(E.MdAdd,{size:14,color:"#6366f1"}):n.jsx(E.MdSettings,{size:13,color:"#6366f1"}),n.jsx(o.Typography,{sx:{fontSize:12,fontWeight:600,color:"#6366f1",flex:1},children:r.length===0?"Add fields":"Configure fields"}),n.jsx(E.MdArrowForward,{size:13,color:"#94a3b8"})]})]})}function zr({value:r,onChange:e,suggestions:t,onPayload:s,onDone:i,validate:l,onValidityChange:a,label:c="Fields",drawerTitle:u="Configure Fields",drawerWidth:f=580}){const[h,x]=b.useState(!1),[p,d]=b.useState({type:"list"}),[g,m]=b.useState(r),v=b.useRef(null),j=b.useRef(void 0),C=b.useRef(void 0),_=b.useRef(void 0),[F,z]=b.useState(null);function q(){m(r),d({type:"list"}),x(!0)}function K(){const S=v.current;S&&(j.current=S.values,C.current=S.formulaConfig,_.current=S.conditionConfig),e(g),x(!1),i==null||i(g,S)}function U(){const S=v.current;S&&(j.current=S.values,C.current=S.formulaConfig,_.current=S.conditionConfig),m(r),x(!1)}function D(){if(p.type!=="edit"||!F)return;const S=[...g];S[p.index]=F,m(S),d({type:"list"}),z(null)}function V(){d({type:"list"}),z(null)}const O=JSON.stringify(g)!==JSON.stringify(r);return p.type==="edit"&&g[p.index],n.jsxs(n.Fragment,{children:[n.jsxs(o.Box,{children:[n.jsx(o.Typography,{sx:{fontSize:12,fontWeight:700,color:"#64748b",textTransform:"uppercase",letterSpacing:.5,mb:.75},children:c}),n.jsx(Rr,{fields:r,onOpen:q})]}),n.jsxs(o.Drawer,{anchor:"right",open:h,onClose:U,PaperProps:{sx:{width:f,display:"flex",flexDirection:"column",boxShadow:"-4px 0 24px rgba(0,0,0,0.12)",overflow:"hidden"}},children:[n.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",px:2,py:1.5,borderBottom:"1px solid #e2e8f0",flexShrink:0,gap:1},children:[p.type==="edit"&&n.jsx(o.Tooltip,{title:"Back to fields",placement:"bottom",children:n.jsx(o.IconButton,{size:"small",onClick:V,sx:{color:"#64748b"},children:n.jsx(E.MdArrowBack,{size:17})})}),n.jsxs(o.Box,{sx:{flex:1},children:[n.jsx(o.Typography,{sx:{fontSize:14,fontWeight:700,color:"#0f172a"},children:p.type==="edit"?(F==null?void 0:F.label)||(F==null?void 0:F.id)||"Edit field":u}),n.jsx(o.Typography,{sx:{fontSize:11,color:"#94a3b8"},children:p.type==="edit"?"Configure field properties":`${g.length} field${g.length!==1?"s":""} defined`})]}),p.type==="list"&&n.jsx(o.Tooltip,{title:"Close",placement:"bottom",children:n.jsx(o.IconButton,{size:"small",onClick:U,sx:{color:"#94a3b8"},children:n.jsx(E.MdClose,{size:17})})})]}),p.type==="list"&&n.jsxs(n.Fragment,{children:[n.jsx(o.Box,{sx:{flex:1,overflowY:"auto",p:2.5},children:n.jsx(de,{value:g,onChange:m,suggestions:t,onPayload:S=>{v.current=S,j.current=S.values,C.current=S.formulaConfig,_.current=S.conditionConfig,s==null||s(S)},validate:l,onValidityChange:a,label:c,initialValues:j.current,initialFormulaConfig:C.current,initialConditionConfig:_.current})}),n.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",alignItems:"center",gap:1,flexShrink:0,bgcolor:"#f8fafc"},children:[O?n.jsx(o.Typography,{sx:{fontSize:11,color:"#f59e0b",fontWeight:500,flex:1},children:"Unsaved changes"}):n.jsx(o.Box,{sx:{flex:1}}),n.jsx(o.Box,{component:"button",onClick:U,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),n.jsxs(o.Box,{component:"button",onClick:K,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[n.jsx(E.MdCheck,{size:15})," Done"]})]})]}),p.type==="edit"&&F&&n.jsx(yt,{field:F,onChange:z,onSave:D,onCancel:V})]})]})}exports.FIELD_TYPE_OPTIONS=mt;exports.FlowForgeRegistry=Se;exports.SchemaBuilder=de;exports.SchemaBuilderDrawer=zr;exports.TablePickerField=xt;exports.buildValidationSchema=we;exports.dataSourceRegistry=ht;exports.useFlowForm=jr;
package/dist/canvas.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./templateSkeletons-Vr97QWjf.js"),t=require("./messages-O9Tw_XXR.js"),r=require("./bpmn-CcuE2X_Q.js"),e=require("./GatewayBranchEdge-DJql3GUT.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-C7mMpUns.js"),t=require("./messages-O9Tw_XXR.js"),r=require("./bpmn-CcuE2X_Q.js"),e=require("./GatewayBranchEdge-Cnl2Hj5T.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-BT6obP5g.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-CZ7m_Cjb.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-C9tybnDE.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-D6o2Dnkd.js";
5
5
  export {
6
6
  F as ActionNode,
7
7
  N as ApprovalNode,