work-workflow-test 0.0.8 → 0.0.11
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.
- package/dist/workflow.es.js +6 -3
- package/dist/workflow.umd.js +1 -1
- package/package.json +1 -1
package/dist/workflow.es.js
CHANGED
|
@@ -20377,8 +20377,11 @@ const O2 = ({
|
|
|
20377
20377
|
}, children: /* @__PURE__ */ w.jsx("div", { className: "w-100 d-flex align-center mt-8", children: /* @__PURE__ */ w.jsxs("div", { className: "w-358px border-solid-lightblue1 radius-8 bg-white h-367px", children: [
|
|
20378
20378
|
/* @__PURE__ */ w.jsx("div", { className: "border-b-solid-lightblue1 d-flex align-center px-10 txt-black2 h-46px", children: "Map Source to Destination" }),
|
|
20379
20379
|
/* @__PURE__ */ w.jsx("div", { className: "overflow-auto flex-1 h-264px", children: g?.getField?.filter(
|
|
20380
|
-
(b) =>
|
|
20381
|
-
|
|
20380
|
+
(b) => (
|
|
20381
|
+
// !field.isAssociatedField &&
|
|
20382
|
+
!["created_on", "updated_on"].includes(
|
|
20383
|
+
b.fieldInternalName
|
|
20384
|
+
)
|
|
20382
20385
|
)
|
|
20383
20386
|
)?.map((b) => {
|
|
20384
20387
|
const E = y?.getField?.filter(
|
|
@@ -20386,7 +20389,7 @@ const O2 = ({
|
|
|
20386
20389
|
_.fieldInternalName
|
|
20387
20390
|
) && !["created_on", "updated_on"].includes(
|
|
20388
20391
|
b.fieldInternalName
|
|
20389
|
-
)
|
|
20392
|
+
) && b.isAssociatedField === _.isAssociatedField
|
|
20390
20393
|
) || [], v = y?.getField?.find(
|
|
20391
20394
|
(_) => _.fieldInternalName === d[b.fieldInternalName]
|
|
20392
20395
|
), N = v ? [...E, v] : E;
|
package/dist/workflow.umd.js
CHANGED
|
@@ -184,4 +184,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
184
184
|
name
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
`,b9=(r,o,e=void 0)=>{const d=o?.split(".");let t=r;for(const l of d)if(t&&typeof t=="object"&&l in t)t=t[l];else return e;return t},Rm=r=>r==null?!0:typeof r=="string"||Array.isArray(r)?r.length===0:typeof r=="object"?Object.keys(r).length===0:!1,n9=r=>{const o=typeof r=="string"?r:b9(r,"props.children","");let e=RegExp(/\b\w/g).exec(o);return Rm(e)||(e=((e.shift()||"")+(e.pop()||"")).toUpperCase()),e},s9=r=>r?.toLowerCase()?.split(/[\s\-_]+/).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "),p9=({data:r,value:o})=>F.jsxs("div",{className:"d-flex align-center justify-between flex-1 text-truncate",id:"selection-ownerList",children:[F.jsx("div",{className:"user-oval-32 rounded-circle mr-2 bg-blue-lighten1",children:r.picture?F.jsx(tr.Avatar,{className:"w-100 h-100 rounded-circle",sx:{width:32,height:32},src:r.picture,alt:"profile"}):F.jsx("div",{className:"user-oval-32 rounded-circle align-center d-flex justify-around",children:F.jsx("p",{className:"f-11 f-w-500 txt-secondary-color font-600 align-center d-flex",children:n9(r.name)})})}),F.jsxs("div",{className:"flex-1 text-truncate ml-4 l-h-18",children:[F.jsx("p",{className:"f-14 f-w-400 text-truncate m-0",children:s9(r.name)}),F.jsx("p",{className:"f-12 f-w-400 txt-darken1 text-truncate m-0",children:r.roleName||"--"})]}),o===r.id?F.jsx("div",{className:"f-20 txt-bllue-darken8",children:F.jsx(bb.CheckOutlined,{className:"f-20 txt-bllue-darken8"})}):F.jsx(F.Fragment,{})]}),Mm=({selectedAssignees:r,setValue:o,datasetId:e,isForNotification:d=!1,acceptedUser:t,validateUser:l,workspaceId:i})=>{const[a,w]=y.useState([]),[b,n]=y.useState(""),[s,p]=y.useState(!1);console.log("acceptedUser",t);const{data:m}=Jr.useQuery(i9,{variables:{input:{datasetId:e,searchKey:b,workspaceId:Number(i),userId:l.id}},fetchPolicy:"network-only",client:Pm});console.log("filteredOptions",m);const h=k=>{let x;a.some(c=>c.id===k.id)?x=a.filter(c=>c.id!==k.id):x=[...a,k],w(x),o(x.map(c=>c.id))},f=k=>{const x=a.filter(c=>c.id!==k);w(x),o(x.map(c=>c.id))};return s?F.jsx(tr.ClickAwayListener,{onClickAway:()=>p(!1),children:F.jsxs("div",{className:"h-34px w-380px position-relative bg-white",children:[a.length?F.jsx("div",{className:"d-flex align-center flex-wrap bg-white z-index-100",children:a?.map(k=>F.jsxs("div",{className:"h-34px d-flex align-center justify-between px-8 cursor-pointer radius-4 hover-show-container border-solid-popper-border ml-4 mt-4",onClick:()=>{f(k.id)},children:[F.jsx("div",{className:"f-14 f-w-500 txt-blue-darken10 ",children:k.name}),F.jsx(UA,{className:"f-20 ml-6"})]},k.id))}):F.jsx("div",{className:"h-34px w-380px d-flex align-center justify-between px-8 cursor-pointer radius-4 hover-show-container",onClick:()=>{},children:"--"}),F.jsx("div",{className:"position-relative",children:F.jsx("div",{className:`position-absolute ${a.length?"top-10px":"top--25px"} radius-8 search-mapdataset z-index-1000 bg-white`,children:F.jsxs("div",{className:"w-380px minh-46px radius-8 popper-border-solid-popper-border",children:[F.jsx("div",{className:"h-46px bg-grey-lighten4 boder-b-solid-popper-border tl-radius-8 tr-radius-8 p-10 d-flex align-center",children:F.jsx(tr.TextField,{sx:{input:{"&::placeholder":{color:Ni["success-disabled"],opacity:100}}},fullWidth:!0,className:"mapdataset-dropdown",id:"single-line",variant:"standard",placeholder:"Search",value:b,onChange:k=>n(k.target.value),autoComplete:"off",autoFocus:!0})}),!m?.getAccessUserList?.length&&b?F.jsx("div",{className:"p-10",children:F.jsx("div",{className:"d-flex align-center multi-select",children:F.jsxs("div",{className:"h-36px d-flex align-center f-w-400 f-14 txt-brown-dark1 pl-8 cursor-pointer",children:[F.jsx("p",{className:" f-w-600 txt-text-grey-primary mr-4",children:"user not found"})," ",` "${b}"`]})},"new-associate")}):F.jsx("div",{className:"bg-white maxh-202px overflow-auto p-8 px-6 bl-radius-8 br-radius-8",children:m?.getAccessUserList?.map((k,x)=>F.jsx("div",{className:` radius-4 px-10 py-8 ${m?.getAccessUserList?.length!==x+1?"mb-4":""} bg-hover-grey-lighten4 cursor-pointer d-flex align-center justify-between hover-show-container ${a?.some(c=>c.id===k.id)?"bg-blue-lighten9":""}`,onClick:()=>{h(k)},children:F.jsxs("div",{className:"d-flex align-center",children:[F.jsx(tr.Checkbox,{checked:a?.some(c=>c.id===k.id),size:"small"},k.id),F.jsx(p9,{data:k,value:""})]})},k.id))})]})})})]})}):F.jsx(F.Fragment,{children:d?F.jsx("div",{style:{textDecoration:"underline",textUnderlineOffset:"2px"},className:"pl-4",onClick:()=>p(!0),children:r.length?r?.map((k,x)=>{const c=t.find(A=>A.id===k);return F.jsx("span",{children:c?.name+`${r.length-1===x?"":","}`})}):F.jsx("div",{className:"",children:" select user"})}):F.jsxs("div",{className:"d-flex h-40px maxh-40px radius-8 border-solid-border px-12 align-center justify-between",onClick:()=>p(!0),children:[F.jsx(f9,{assignTo:r,acceptedUserData:t}),F.jsx(ef,{})]})})},f9=({assignTo:r,acceptedUserData:o})=>{const e=r?.map(t=>o?.find(l=>l.id===t));console.log("acceptedUserData",o),console.log("assignTo",r);const d=e?.length>4?e.slice(0,4):e;return d?.length?(console.log("getUserData",e),console.log("showUserData",d),F.jsxs("div",{className:"d-flex align-center",id:"dataCollab-view",children:[d?.map(t=>t?.picture?F.jsx(tr.Avatar,{className:"w-100 h-100 rounded-circle mr-4",sx:{width:32,height:32},src:t.picture,alt:"profile"},t?.id):F.jsx("div",{className:"w-32px h-32px radius-360 bg-orange-lighten5 d-flex align-center justify-center f-10 f-w-500 txt-primary mr-4",children:`${t?.firstName?Jp(t?.firstName[0]):""}${t?.lastName?Jp(t?.lastName[0]):""}`},t?.id)),e?.length>4&&F.jsxs("div",{className:"w-24px h-24px p-2 radius-360 bg-avatarColor txt-blue-darken10 d-flex align-center justify-center avatar",children:["+",e.length-4]})]})):"--"},h9=({options:r,defaultValue:o=[],setValue:e})=>{const[d,t]=y.useState(""),[l,i]=y.useState(o),[a,w]=y.useState(0),b=y.useRef(null),[n,s]=y.useState(!1);y.useEffect(()=>{b.current&&w(b.current.offsetHeight)},[l]);const p=m=>{let h;l.some(f=>f.id===m.id)?h=l.filter(f=>f.id!==m.id):h=[...l,m],i(h),e(h)};return n?F.jsx("div",{className:" bg-white w-380px h-46px border-solid-input-border radius-8 ",children:F.jsx(tr.ClickAwayListener,{onClickAway:()=>{s(!1)},children:F.jsxs("div",{className:"position-relative",children:[F.jsx("div",{ref:b,className:" w-100 res-chip-min-height h-100 radius-4 bg-white d-flex align-center d-flex flex-wrap py-4 gap-8 px-12",children:l.length?F.jsx(F.Fragment,{children:l?.map((m,h)=>F.jsx(tr.Chip,{label:m.displayName,onDelete:()=>p(m),sx:{bgcolor:Ni["popper-border"],border:0,borderRadius:2,margin:"0 !important",padding:"6px 8px 6px 8px",gap:1,".MuiChip-label":{fontSize:14,fontFamily:"Inter, sans-serif !important"}},deleteIcon:F.jsx(bb.CloseOutlined,{sx:{fontSize:"16px",color:m.statusColor?"#fff":"grey"},className:"cursor-pointer icon-close"}),variant:"outlined"},h))}):F.jsx("div",{className:"ml-10 d-flex align-center f-14 txt-text-grey-hint",children:"No fields"})}),F.jsx("div",{className:"position-absolute radius-8 search-mapdataset z-index-1000",style:{top:`${a+4}px`},children:F.jsxs("div",{className:"w-380px minh-46px radius-8 popper-border-solid-popper-border",children:[F.jsx("div",{className:"h-46px bg-grey-lighten4 boder-b-solid-popper-border tl-radius-4 tr-radius-8 p-10",children:F.jsx(tr.TextField,{sx:{input:{"&::placeholder":{color:Ni["success-disabled"],opacity:100}}},fullWidth:!0,className:"mapdataset-dropdown",variant:"standard",placeholder:"Search",value:d,onChange:m=>t(m.target.value),autoFocus:!0})}),F.jsx("div",{className:"bg-white maxh-200px overflow-auto w-100 py-8 px-6 bl-radius-8 br-radius-8",children:F.jsx(F.Fragment,{children:r?.filter(m=>m.displayName.toLowerCase().includes(d.toLowerCase()))?.map(m=>F.jsxs("div",{className:` h-36px radius-4 px-10 py-8 mb-2 bg-hover-grey-lighten4 cursor-pointer d-flex justify-start hover-show-container align-center ${l.some(h=>h.id===m.id)?"bg-blue-lighten9 txt-blue-darken10 radius-4 p-4":""}`,onClick:()=>{p(m)},children:[F.jsx(tr.Checkbox,{className:"mx-10 p-0",size:"small",color:"primary",checked:l.some(h=>h.id===m.id)}),F.jsx("div",{className:"f-14 f-w-400 txt-text-grey-primary",children:m.displayName})]},m.id))})})]})})]})})}):F.jsx(F.Fragment,{children:F.jsxs("div",{className:"d-flex align-center h-46px border-solid-input-border radius-8 p-12 justify-between",onClick:()=>s(!0),children:[F.jsxs("div",{className:"d-flex",children:[Array.isArray(o)&&o?.length?(o?.length>3?o.slice(0,3):o)?.map((m,h)=>F.jsx(tr.Chip,{label:m.displayName,sx:{bgcolor:Ni["popper-border"],border:0,borderRadius:2,margin:"0 !important",padding:"6px 8px 6px 8px",gap:1,".MuiChip-label":{fontSize:14,fontFamily:"Inter, sans-serif !important"}},variant:"outlined"},h)):F.jsx(F.Fragment,{children:"-"}),o?.length>3&&F.jsxs("div",{className:"w-24px h-24px p-2 radius-360 bg-avatarColor txt-blue-darken10 d-flex align-center justify-center avatar h-26px px-6 py-8 bg-lightblue1 radius-4 border-solid-popper-border ml-4",children:["+",o.length-3]})]}),F.jsx(ef,{})]})})},m9=[{field:{id:"256f35efc157446dba47e0922057ff61",isActive:!0,isDeleted:!1,createdAt:"2025-08-21T08:44:05.608Z",updatedAt:"2025-08-21T08:44:05.608Z",fieldDisplayName:"Name",fieldInternalName:"work_4_name",datasetName:"work_4",sensitive:!1,hidden:!1,isHideField:!1,dataType:"single-line",isRequired:!0,isUnique:!1,isAssociatedField:!1,isSystemDefined:!1,isImmutable:!1,isPrimaryField:!0,isSelected:!0,isSortable:!0,sortOrder:"1",createdBy:"7fda40cd83dc4391a7b751a67c0dfaa6",updatedBy:null,deletedBy:null,CreatedById:"7fda40cd83dc4391a7b751a67c0dfaa6",deletedAt:null,prefix:"",postfix:"",value:[],columnWidth:null,toggleState:null,workflow:null,name:"Name",internalName:"work_4_name",isAssociated:!1,type:"work_4"},group:{id:"fc4a57aec9094c47bbdf55a4f028072c",datasetName:"work_4",groupName:"Work 4 Information"},position:1,isSelected:!0,isPrimaryField:!0,isDeleted:!1,isAssociated:!1,datasetName:"work_4",datasetId:"557465b7fd9244849f00076491369c84",isRequired:!0,isImmutable:!1},{field:{id:"d397ae5f3e2f48a280dc6f7644325b00",isActive:!0,isDeleted:!1,createdAt:"2025-08-21T08:44:05.608Z",updatedAt:"2025-08-21T08:44:05.608Z",fieldDisplayName:"Status",fieldInternalName:"stage",datasetName:"work_4",sensitive:!1,hidden:!1,isHideField:!1,dataType:"drop-down",isRequired:!0,isUnique:!1,isAssociatedField:!1,isSystemDefined:!1,isImmutable:!1,isPrimaryField:!1,isSelected:!0,isSortable:!1,sortOrder:"2",createdBy:"7fda40cd83dc4391a7b751a67c0dfaa6",updatedBy:null,deletedBy:null,CreatedById:"7fda40cd83dc4391a7b751a67c0dfaa6",deletedAt:null,prefix:"",postfix:"",value:[{key:"New",value:"New"},{key:"Open",value:"Open"},{key:"In Progress",value:"In Progress"},{key:"Qualified",value:"Qualified"},{key:"Unqualified",value:"Unqualified"},{key:"Attempted To Contact",value:"Attempted To Contact"},{key:"Connected",value:"Connected"},{key:"Bad Timing",value:"Bad Timing"},{key:"Hot Lead",value:"Hot Lead"}],columnWidth:null,toggleState:null,workflow:null,name:"Status",internalName:"stage",isAssociated:!1,type:"work_4"},group:{id:"fc4a57aec9094c47bbdf55a4f028072c",datasetName:"work_4",groupName:"Work 4 Information"},position:2,isSelected:!0,isPrimaryField:!1,isDeleted:!1,isAssociated:!1,datasetName:"work_4",datasetId:"557465b7fd9244849f00076491369c84",isRequired:!0,isImmutable:!1},{field:{id:"bfb6fa887f67486d93ab3c5516f93f4c",isActive:!0,isDeleted:!1,createdAt:"2025-08-21T08:44:05.608Z",updatedAt:"2025-08-21T08:44:05.608Z",fieldDisplayName:"Owner",fieldInternalName:"owner",datasetName:"work_4",sensitive:!1,hidden:!1,isHideField:!1,dataType:"user",isRequired:!0,isUnique:!1,isAssociatedField:!1,isSystemDefined:!1,isImmutable:!1,isPrimaryField:!1,isSelected:!0,isSortable:!0,sortOrder:"3",createdBy:"7fda40cd83dc4391a7b751a67c0dfaa6",updatedBy:null,deletedBy:null,CreatedById:"7fda40cd83dc4391a7b751a67c0dfaa6",deletedAt:null,prefix:"",postfix:"",value:[],columnWidth:null,toggleState:null,workflow:null,name:"Owner",internalName:"owner",isAssociated:!1,type:"work_4"},group:{id:"fc4a57aec9094c47bbdf55a4f028072c",datasetName:"work_4",groupName:"Work 4 Information"},position:3,isSelected:!0,isPrimaryField:!1,isDeleted:!1,isAssociated:!1,datasetName:"work_4",datasetId:"557465b7fd9244849f00076491369c84",isRequired:!0,isImmutable:!1},{field:{id:"643e3725963e47fb96fc192ddd8680f4",isActive:!0,isDeleted:!1,createdAt:"2025-08-21T08:44:05.608Z",updatedAt:"2025-08-21T08:44:05.608Z",fieldDisplayName:"Priority",fieldInternalName:"priority",datasetName:"work_4",sensitive:!1,hidden:!1,isHideField:!1,dataType:"priority",isRequired:!0,isUnique:!1,isAssociatedField:!1,isSystemDefined:!1,isImmutable:!1,isPrimaryField:!1,isSelected:!0,isSortable:!1,sortOrder:"4",createdBy:"7fda40cd83dc4391a7b751a67c0dfaa6",updatedBy:null,deletedBy:null,CreatedById:"7fda40cd83dc4391a7b751a67c0dfaa6",deletedAt:null,prefix:"",postfix:"",value:[{key:"Low",value:"Low",statusColor:null},{key:"Moderate",value:"Moderate",statusColor:null},{key:"High",value:"High",statusColor:null}],columnWidth:null,toggleState:null,workflow:null,name:"Priority",internalName:"priority",isAssociated:!1,type:"work_4"},group:{id:"fc4a57aec9094c47bbdf55a4f028072c",datasetName:"work_4",groupName:"Work 4 Information"},position:4,isSelected:!0,isPrimaryField:!1,isDeleted:!1,isAssociated:!1,datasetName:"work_4",datasetId:"557465b7fd9244849f00076491369c84",isRequired:!0,isImmutable:!1},{field:{id:"e6077294af434793aa036c73337f0163",isActive:!0,isDeleted:!1,createdAt:"2025-08-21T09:33:51.860Z",updatedAt:"2025-08-21T09:33:52.122Z",fieldDisplayName:"interview",fieldInternalName:"interview",datasetName:"work_4",sensitive:!1,hidden:!1,isHideField:!1,dataType:"drop-down",isRequired:!1,isUnique:!1,isAssociatedField:!1,isSystemDefined:!1,isImmutable:!1,isPrimaryField:!1,isSelected:!0,isSortable:!1,sortOrder:"5",createdBy:"7fda40cd83dc4391a7b751a67c0dfaa6",updatedBy:null,deletedBy:null,CreatedById:"7fda40cd83dc4391a7b751a67c0dfaa6",deletedAt:null,prefix:null,postfix:null,value:[{key:"stage 1",value:"stage 1",statusColor:"#397E4E"},{key:"stage 2",value:"stage 2",statusColor:"#5DC975"},{key:"stage 3",value:"stage 3",statusColor:"#9DD32D"},{key:"stage 4",value:"stage 4",statusColor:"#CAB642"},{key:"stage 5",value:"stage 5",statusColor:"#E0CC33"}],columnWidth:null,toggleState:!0,workflow:null,name:"interview",internalName:"interview",isAssociated:!1,type:"work_4"},group:{id:"fc4a57aec9094c47bbdf55a4f028072c",datasetName:"work_4",groupName:"Work 4 Information"},position:6,isSelected:!0,isPrimaryField:!1,isDeleted:!1,isAssociated:!1,datasetName:"work_4",datasetId:"557465b7fd9244849f00076491369c84",isRequired:!1,isImmutable:!1},{field:{id:"c6104a0ccd7e4636a72bf13380c6491e",isActive:!0,isDeleted:!1,createdAt:"2025-08-22T09:26:10.456Z",updatedAt:"2025-08-22T09:26:10.733Z",fieldDisplayName:"coll",fieldInternalName:"coll",datasetName:"work_4",sensitive:!1,hidden:!1,isHideField:!1,dataType:"collaborators",isRequired:!1,isUnique:!1,isAssociatedField:!1,isSystemDefined:!1,isImmutable:!1,isPrimaryField:!1,isSelected:!0,isSortable:!1,sortOrder:"6",createdBy:"7fda40cd83dc4391a7b751a67c0dfaa6",updatedBy:null,deletedBy:null,CreatedById:"7fda40cd83dc4391a7b751a67c0dfaa6",deletedAt:null,prefix:null,postfix:null,value:[],columnWidth:null,toggleState:null,workflow:null,name:"coll",internalName:"coll",isAssociated:!1,type:"work_4"},group:{id:"fc4a57aec9094c47bbdf55a4f028072c",datasetName:"work_4",groupName:"Work 4 Information"},position:7,isSelected:!0,isPrimaryField:!1,isDeleted:!1,isAssociated:!1,datasetName:"work_4",datasetId:"557465b7fd9244849f00076491369c84",isRequired:!1,isImmutable:!1}],G4={status_changes:{type:"condition",segments:[{segmentsId:0,type:"dropdown",valueType:"field",optionType:["priority","drop-down"],value:"",childSegments:[2]},{segmentsId:1,type:"text",value:"is value of"},{segmentsId:2,type:"dropdown",valueType:"field-options",mapSegmentsId:0,value:""}]},number_lessthan:{type:"condition",segments:[{segmentsId:0,type:"dropdown",valueType:"field",optionType:["number","currency"],value:"",childSegments:[2]},{segmentsId:1,type:"text",value:"is less than"},{segmentsId:2,type:"input",valueType:"number",value:"",mapSegmentsId:0}]},number_greaterthan:{type:"condition",segments:[{segmentsId:0,type:"dropdown",valueType:"field",optionType:["number","currency"],value:"",childSegments:[2]},{segmentsId:1,type:"text",value:"is greater than"},{segmentsId:2,type:"input",valueType:"number",value:"",mapSegmentsId:0}]}},$m=[{key:"status_changes",displayContent:"status is value of",conditionAuto:G4.status_changes,types:["dropdown"]},{key:"number_lessthan",displayContent:"Number is less than",conditionAuto:G4.number_lessthan,types:["number"]},{key:"number_greaterthan",displayContent:"Number is greater than",conditionAuto:G4.number_greaterthan,types:["number"]}],nl={changes_field_value:{key:"changes_field_value",segments:[{segmentsId:0,type:"text",value:"set"},{segmentsId:1,type:"dropdown",valueType:"field",optionType:"",fieldType:"",value:"",childSegments:[3]},{segmentsId:2,type:"text",value:"to"},{segmentsId:3,type:"input",valueType:"number",value:"",mapSegmentsId:1}]},send_notification:{key:"send_notification",segments:[{segmentsId:0,type:"text",value:"Notify the"},{segmentsId:1,type:"user",valueType:"user-notification",optionType:"",fieldType:"",value:[],childSegments:[3]},{segmentsId:2,type:"text",value:"as"},{segmentsId:3,type:"notification",valueType:"",value:"",mapSegmentsId:1}]},move_to_other_work:{key:"move_to_other_work",segments:[{segmentsId:0,type:"text",value:"Move to"},{segmentsId:1,type:"moveRecordToOtherWork",valueType:"moveRecordToOtherWork",optionType:"",fieldType:"",value:[]}]},copy_to_other_workspace_work:{key:"copy_to_other_workspace_work",segments:[{segmentsId:0,type:"text",value:"Move to"},{segmentsId:1,type:"workspace",valueType:"workspace",optionType:"",fieldType:"",value:[],childSegments:[2]},{segmentsId:2,type:"moveRecordToOtherWork",valueType:"moveRecordToOtherWork",optionType:"",fieldType:"",value:[],mapSegmentsId:1}]},send_notification_to_field:{key:"send_notification_to_field",segments:[{segmentsId:0,type:"text",value:"Notify the"},{segmentsId:1,type:"dropdown",valueType:"users",optionType:"",fieldType:"",value:[],childSegments:[3]},{segmentsId:2,type:"text",value:"as"},{segmentsId:3,type:"notification",valueType:"",value:"",mapSegmentsId:1}]}},k9=[{key:"changes_field_value",displayAutomation:"change Field Value",automation:nl.changes_field_value},{key:"send_notification",displayAutomation:"send Notification",automation:nl.send_notification},{key:"move_to_other_work",displayAutomation:"move to other work",automation:nl.move_to_other_work},{key:"copy_to_other_workspace_work",displayAutomation:"move to other workspace work",automation:nl.copy_to_other_workspace_work},{key:"send_notification_to_field",displayAutomation:"send Notification by field",automation:nl.send_notification_to_field}];var sl={},Um;function x9(){if(Um)return sl;Um=1;var r=Yo();Object.defineProperty(sl,"__esModule",{value:!0}),sl.default=void 0;var o=r(ue()),e=Jo();return sl.default=(0,o.default)((0,e.jsx)("path",{d:"M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1"}),"AddRounded"),sl}var g9=x9();const jm=Io(g9),X4=({defaultValue:r,setValue:o,isDisable:e=!1,col:d,isAutomation:t,filedId:l,islistpage:i=!1})=>{const[a,w]=y.useState(r),[b,n]=y.useState(!0);y.useEffect(()=>{r?.blocks?.length&&w(r)},[JSON.stringify(r),t]);const s=()=>{const k=$m.filter(x=>x.types.includes("dropdown"));m(k[0].conditionAuto,k[0].key,!0)};y.useEffect(()=>{t&&!r?.blocks?.length&&s()},[t,JSON.stringify(r)]);const p=(k,x,c)=>{const A=a.blocks.map((u,g)=>g!==k?u:{...u,segments:u.segments.map((B,D)=>D!==x?B:{...B,value:c})});w(u=>({...u,blocks:A})),o({...a,blocks:A})},m=(k,x,c=!1)=>{const A={...a};if(A.blocks=[...A.blocks,{...k,key:x}],t&&c){console.log("i am in ");const u=A.blocks.map((g,B)=>B!==0?g:{...g,segments:g.segments.map((D,v)=>v!==0?D:{...D,value:l})});w(()=>({...A,blocks:u})),o({...A,blocks:u}),n(!1)}else w(()=>A),n(!1)},h=({optionType:k,valueType:x,fieldId:c})=>{const A=d?.map(u=>u.field);if(x==="field")return A?.filter(u=>k?.includes(u.dataType)&&!u.isAssociated).map(u=>({id:u.id,displayName:u.name,internalName:u.internalName}));if(x==="field-options")return A.find(g=>g.id===c)?.value?.map(g=>({id:g.key,displayName:g.value}))},f=k=>{let x={...a,blocks:a.blocks.filter((c,A)=>A!==k)};x.blocks.length||n(!0),w(x),o(x)};return F.jsxs(F.Fragment,{children:[F.jsx("div",{children:a?.blocks?.map((k,x)=>F.jsxs("div",{className:"d-flex hide-icon mb-12",children:[F.jsxs("div",{className:"f-w-400 f-14 txt-black2 d-flex flex-wrap flex-1 align-center",children:[x?F.jsx("span",{children:"And only if"}):F.jsx("span",{children:"When a"}),k.segments.map((c,A)=>c.type==="text"?F.jsxs("span",{children:[" ",c.value," "]},A):c.type==="input"?F.jsx(tr.TextField,{id:"standard-basic",variant:"standard",className:"mx-8",disabled:e,defaultValue:c.value,type:c.valueType,onChange:u=>p(x,A,u.target.value),sx:{margin:0,maxWidth:100,padding:0,"& .MuiInputBase-input":{padding:"0 !important",paddingRight:"0 !important"},"& .MuiInputBase-root":{margin:0}}}):c.type==="dropdown"?F.jsx(tr.FormControl,{variant:"standard",sx:{width:"auto"},className:"mx-8",children:F.jsx(tr.Select,{IconComponent:()=>null,value:c.value,disabled:e,sx:{minWidth:30,padding:0,"& .MuiSelect-select":{padding:"0 !important",paddingRight:"0 !important"},"& .MuiInputBase-input":{padding:"0 !important",paddingRight:"0 !important"}},onChange:u=>p(x,A,u.target.value),children:h({optionType:c.optionType,valueType:c.valueType,fieldId:k?.segments?.[c.mapSegmentsId]?.value})?.map(u=>F.jsx(tr.MenuItem,{value:u.id,children:u.displayName},u.id))},`${x}_${A}`)}):null)]}),a.blocks.length>0&&!i?F.jsx("img",{src:"/delete.svg",className:"hide cursor-pointer",onClick:()=>{f(x)}}):F.jsx(F.Fragment,{}),F.jsx("div",{children:!e&&a.blocks.length-1===x&&!t?F.jsx(F.Fragment,{children:F.jsx(jm,{className:"f-w-400 f-14 txt-black2 cursor-pointer",onClick:()=>{n(!0)}})}):F.jsx(F.Fragment,{})})]},x))}),!e&&b?F.jsx(F.Fragment,{children:F.jsx(tr.FormControl,{variant:"standard",sx:{width:"auto"},className:"mx-8",children:F.jsx(tr.Select,{labelId:"demo-simple-select-standard-label",id:"demo-simple-select-standard",IconComponent:()=>null,sx:{minWidth:30,padding:0,"& .MuiSelect-select":{padding:"0 !important",paddingRight:"0 !important"},"& .MuiInputBase-input":{padding:"0 !important",paddingRight:"0 !important"}},displayEmpty:!0,renderValue:()=>F.jsx("div",{className:"f-w-400 f-14 txt-lightblack2",children:"When something starts"}),children:$m?.map(k=>F.jsx(tr.MenuItem,{onClick:()=>m(k.conditionAuto,k.key),children:k.displayContent},k.key))})})}):F.jsx(F.Fragment,{})]})},c9=({edgeData:r,updateEdgeData:o,setSelectedId:e,validateUser:d,workspaceId:t,acceptedUser:l})=>{const{setValue:i,watch:a}=nb.useForm({defaultValues:{permission:r?.data?.permission||[],requiredColumns:r?.data?.requiredColumns||[],condition:r?.data?.condition||{id:"",blocks:[]}}}),w=m9?.map(b=>({id:b.field.id,displayName:b?.field?.name,internalName:b?.field?.internalName}));return F.jsx("div",{style:{position:"absolute",top:0,right:0,height:"100%",width:"420px",background:"#fff",borderLeft:"1px solid #ccc",zIndex:1e3},children:F.jsxs("div",{className:"px-16 py-12 d-flex flex-column edge-container",children:[F.jsxs("div",{children:[F.jsx("div",{className:"h-36px d-flex align-center f-w-600 f-14 txt-darkblue px-8",children:"Configuration"}),F.jsx("div",{className:"border-solid-border1 my-12"})]}),F.jsx("div",{className:"flex-1",children:F.jsxs("div",{className:"p-10",children:[F.jsxs("div",{className:"h-44px flex-1 radius-8 px-12 py-6 d-flex justify-between align-center cursor-pointer",style:{backgroundColor:r4(r?.data?.sourceColor),border:`1px solid ${Ve(r?.data?.sourceColor)}`},children:[F.jsx("div",{className:"f-w-600 f-14 txt-black mr-20 ",style:{color:Ve(r?.data?.sourceColor)},children:r?.data?.sourceLabel}),F.jsx("img",{src:"/arrow.svg",alt:"arrow",className:"mr-20"}),F.jsx("div",{className:"f-w-600 f-14 txt-black mr-20 ",style:{color:Ve(r.data?.targetColor)},children:r?.data?.targetLabel})]}),F.jsx("div",{className:"border-solid-border1 my-16"}),F.jsxs("div",{className:"mb-16",children:[F.jsx("p",{className:"f-w-600 f-14 txt-black2 mb-6",children:"Permissions"}),F.jsx(Mm,{selectedAssignees:a("permission"),datasetId:"460e5046a84043f7b8193feb2ece19d0",setValue:b=>{i("permission",b)},acceptedUser:l,validateUser:d,workspaceId:t})]}),F.jsxs("div",{className:"mb-16",children:[F.jsx("p",{className:"f-w-600 f-14 txt-black2 mb-6",children:"Required Columns"}),F.jsx(h9,{defaultValue:a("requiredColumns"),options:w,setValue:b=>{i("requiredColumns",b)}})]}),F.jsxs("div",{children:[F.jsx("div",{className:"d-flex align-center justify-between",children:F.jsx("p",{className:"f-w-600 f-14 txt-black2",children:"Condition"})}),F.jsx(X4,{defaultValue:a("condition"),setValue:b=>{i("condition",b)}})]})]})}),F.jsxs("div",{className:"d-flex justify-end",children:[F.jsx(tr.Button,{variant:"outlined",color:"inherit",className:"mr-10",onClick:()=>e({id:"",type:"config"}),children:"Cancel"}),F.jsx(tr.Button,{variant:"outlined",color:"primary",onClick:()=>{o({id:r.id,data:{...r.data,...a()}}),e({id:"",type:"config"})},children:"Update"})]})]})})};var pl={},Lm;function u9(){if(Lm)return pl;Lm=1;var r=Yo();Object.defineProperty(pl,"__esModule",{value:!0}),pl.default=void 0;var o=r(ue()),e=Jo();return pl.default=(0,o.default)((0,e.jsx)("path",{d:"m19 15-1.41-1.41L13 18.17V2h-2v16.17l-4.59-4.59L5 15l7 7z"}),"South"),pl}var F9=u9();const zm=Io(F9);var fl={},Vm;function A9(){if(Vm)return fl;Vm=1;var r=Yo();Object.defineProperty(fl,"__esModule",{value:!0}),fl.default=void 0;var o=r(ue()),e=Jo();return fl.default=(0,o.default)((0,e.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),fl}var y9=A9();const E9=Io(y9);var hl={},Hm;function D9(){if(Hm)return hl;Hm=1;var r=Yo();Object.defineProperty(hl,"__esModule",{value:!0}),hl.default=void 0;var o=r(ue()),e=Jo();return hl.default=(0,o.default)((0,e.jsx)("path",{d:"M17.77 3.77 16 2 6 12l10 10 1.77-1.77L9.54 12z"}),"ArrowBackIosNew"),hl}var v9=D9();const qm=Io(v9);var ml={},Wm;function S9(){if(Wm)return ml;Wm=1;var r=Yo();Object.defineProperty(ml,"__esModule",{value:!0}),ml.default=void 0;var o=r(ue()),e=Jo();return ml.default=(0,o.default)((0,e.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),ml}var _9=S9();const C9=Io(_9);var kl={},Km;function B9(){if(Km)return kl;Km=1;var r=Yo();Object.defineProperty(kl,"__esModule",{value:!0}),kl.default=void 0;var o=r(ue()),e=Jo();return kl.default=(0,o.default)((0,e.jsx)("path",{d:"M12 6c3.79 0 7.17 2.13 8.82 5.5C19.17 14.87 15.79 17 12 17s-7.17-2.13-8.82-5.5C4.83 8.13 8.21 6 12 6m0-2C7 4 2.73 7.11 1 11.5 2.73 15.89 7 19 12 19s9.27-3.11 11-7.5C21.27 7.11 17 4 12 4m0 5c1.38 0 2.5 1.12 2.5 2.5S13.38 14 12 14s-2.5-1.12-2.5-2.5S10.62 9 12 9m0-2c-2.48 0-4.5 2.02-4.5 4.5S9.52 16 12 16s4.5-2.02 4.5-4.5S14.48 7 12 7"}),"VisibilityOutlined"),kl}var I9=B9();const T9=Io(I9),N9=({defaultValue:r,setValue:o,acceptedUser:e,col:d,exampleData:t})=>{const[l,i]=y.useState(r),[a,w]=y.useState(!1),b=d?.map(s=>s.field),n=y.useMemo(()=>{const s=new Map;return b?.forEach(p=>{if(p.dataType==="user"){const m=t[p.internalName],h=e.find(f=>f.id===m);s.set(p.internalName,h?.name??"")}else if(p.dataType==="collaborators"){const m=t[p.internalName]?.split(",");let h=[];m?.forEach(f=>{const k=e.find(x=>x.id===f);h=[...h,k?.name||""]}),s.set(p.internalName,h.join(","))}else s.set(p.internalName,t[p.internalName])}),s},[b,e]);return F.jsxs("div",{children:[F.jsx("div",{style:{textDecoration:"underline",textUnderlineOffset:"2px"},onClick:()=>{w(!0)},children:"Template"}),a?F.jsx(tr.ClickAwayListener,{onClickAway:()=>w(!1),children:F.jsx("div",{className:"w-100 d-flex align-center txt-black2 f-12 mb-8",children:F.jsxs("div",{className:"w-358px border-solid-lightblue1 radius-12 bg-white",children:[F.jsx("div",{className:"h-46px border-b-solid-popper-border tl-radius-10 tr-radius-10 px-10 d-flex align-center f-14 f-w-400",children:"Send Notification"}),F.jsxs("div",{className:"my-8 h-31px d-flex align-center px-6 f-12",children:[F.jsx("div",{className:"w-82px d-flex align-center justify-center ",children:"Templates :"}),F.jsx("div",{className:"radius-100 p-8 maxh-28px h-28px w-auto border-solid-popper-border ml-4",children:"Reminder"}),F.jsx("div",{className:"radius-100 p-8 maxh-28px h-28px w-auto border-solid-popper-border ml-4",children:"Status Update"}),F.jsx("div",{className:"radius-100 p-8 maxh-28px h-28px w-auto border-solid-popper-border ml-4",children:"Deadline Alert"})]}),F.jsxs("div",{className:"h-151px px-12 mb-8",children:[F.jsx("div",{className:"h-31px f-w-600 f-12 d-flex align-center",children:"Message"}),F.jsx(tr.TextField,{placeholder:"Type your message here...",className:"f-12",multiline:!0,rows:4,fullWidth:!0,variant:"outlined",value:l,onChange:s=>{i(s.target.value)}})]}),F.jsx("div",{style:{gap:"4px"},className:"px-12 py-8 d-flex flex-wrap mb-8",children:b?.map(s=>F.jsx("div",{className:"radius-100 p-8 maxh-28px h-28px w-auto border-solid-popper-border ml-4 f-12",onClick:()=>{i(p=>p+`{${s.internalName}}`)},children:s.name}))}),F.jsx("div",{className:"p-12 mb-8",children:F.jsxs("div",{className:"h-160px radius-8 border-solid-lightblue1 bg-lightblue3 px-8 d-flex flex-column pb-8",children:[F.jsxs("div",{className:"h-31px d-flex align-center",children:[F.jsx(T9,{className:"f-12"}),F.jsx("p",{className:"ml-4 f-12 ",children:"Preview"})]}),F.jsx("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},className:"border-solid-lightblue1 h-100 flex-1 bg-white radius-4 p-8",children:l?.replace(/\{(\w+)\}/g,(s,p)=>n.get(p))})]})}),F.jsxs("div",{className:"bl-radius-10 br-radius-10 h-56px border-t-solid-popper-border d-flex justify-end px-12 align-center",children:[F.jsx(tr.Button,{variant:"outlined",color:"inherit",className:"mr-10 h-31px radius-8",onClick:()=>{w(!1)},children:"Cancel"}),F.jsx(tr.Button,{variant:"outlined",color:"primary",className:"h-31px radius-8",onClick:()=>{o(l),w(!1)},children:"Done"})]})]})})}):F.jsx(F.Fragment,{})]})},P9={};function O9(r,o){switch(o.type){case"ADD_OR_UPDATE":return{...r,[o.key]:o.value};case"DELETE":const e={...r};return delete e[o.key],e;default:return r}}const R9=({datasetId:r,workspaceId:o,targetWorkspaceId:e,autoIndex:d,segmentIndex:t,setValue:l,defaultValue:i})=>{const{mappingField:a,targetWork:w}=i,[b,n]=y.useState(null),[s,p]=y.useReducer(O9,a??P9),[m,h]=y.useState(!1);y.useEffect(()=>{n(w)},[a,w]);const{data:f}=Jr.useQuery(a9,{variables:{input:{workspaceId:Number(e)}},fetchPolicy:"network-only",client:Y4}),{data:k}=Jr.useQuery(Om,{variables:{input:{workspaceId:Number(o),datasetId:r}},fetchPolicy:"network-only",client:Y4}),{data:x}=Jr.useQuery(Om,{variables:{input:{workspaceId:Number(e),datasetId:b}},fetchPolicy:"network-only",client:Y4,skip:!b}),c=f?.getDataset?.filter(A=>A.id!==r)??[];return F.jsxs("div",{children:[F.jsx(tr.FormControl,{variant:"standard",sx:{width:"auto"},className:"mx-8",children:F.jsx(tr.Select,{value:b,IconComponent:()=>null,sx:{minWidth:30,padding:0,"& .MuiSelect-select":{padding:"0 !important",paddingRight:"0 !important"},"& .MuiInputBase-input":{padding:"0 !important",paddingRight:"0 !important"}},children:c?.map(A=>F.jsx(tr.MenuItem,{value:A.id,onClick:()=>{n(A.id),h(!0)},children:A.name},A.id))},`${d}_${t}`)}),m?F.jsx(F.Fragment,{children:F.jsx(tr.ClickAwayListener,{onClickAway:()=>{},children:F.jsx("div",{className:"w-100 d-flex align-center mt-8",children:F.jsxs("div",{className:"w-358px border-solid-lightblue1 radius-8 bg-white h-367px",children:[F.jsx("div",{className:"border-b-solid-lightblue1 d-flex align-center px-10 txt-black2 h-46px",children:"Map Source to Destination"}),F.jsx("div",{className:"overflow-auto flex-1 h-264px",children:k?.getField?.filter(A=>!A.isAssociatedField&&!["created_on","updated_on"].includes(A.fieldInternalName))?.map(A=>{const u=x?.getField?.filter(D=>A.dataType===D.dataType&&!Object.values(s).includes(D.fieldInternalName)&&!["created_on","updated_on"].includes(A.fieldInternalName))||[],g=x?.getField?.find(D=>D.fieldInternalName===s[A.fieldInternalName]),B=g?[...u,g]:u;return F.jsxs("div",{className:"d-flex align-center h-52px",children:[F.jsx("div",{className:"txt-brown-dark1 f-12 f-w-600 text-truncate pl-16 w-200px",children:A.fieldDisplayName}),F.jsx("div",{className:"flex-1 d-flex align-center",children:B?.length||A.fieldInternalName in s?F.jsx(tr.Select,{className:"w-115px h-40px radius-8 f-10 p-0",defaultValue:s[A?.fieldInternalName]??null,children:B?.map(D=>F.jsx(tr.MenuItem,{value:D.fieldInternalName,onClick:()=>{p({type:"ADD_OR_UPDATE",key:A.fieldInternalName,value:D.fieldInternalName})},children:D.fieldDisplayName},D.id))}):F.jsx("div",{className:"w-115px h-40px radius-8 border-solid-red1 bg-lightred txt-red1 d-flex align-center justify-center f-10 f-w-400",children:"No field to show"})})]})})}),F.jsxs("div",{className:"bl-radius-10 br-radius-10 h-56px border-t-solid-popper-border d-flex justify-end px-12 align-center",children:[F.jsx(tr.Button,{variant:"outlined",color:"inherit",className:"mr-10 h-31px radius-8",onClick:()=>{h(!1)},children:"Cancel"}),F.jsx(tr.Button,{variant:"outlined",color:"primary",className:"h-31px radius-8",onClick:()=>{l({sourceWork:r,targetWork:b,mappingField:s}),h(!1)},children:"Done"})]})]})})})}):F.jsx(F.Fragment,{})]})},Z4=y.createContext(null),M9=({defaultValue:r,setValue:o})=>{const{validateUser:e}=y.useContext(Z4),{data:d}=Jr.useQuery(w9,{variables:{input:{userId:e.id,orgId:e?.organisation?.id}},fetchPolicy:"network-only",client:Pm}),t=d?.getWorkspaceList;return F.jsx("div",{children:F.jsx(tr.Select,{className:"w-115px h-40px radius-8 f-10 p-0",defaultValue:r,children:t?.map(l=>F.jsx(tr.MenuItem,{value:l.id,onClick:()=>{o(l.id)},children:l.name},l.id))})})},Ym=({defaultValue:r,setValue:o,isDisable:e=!1,col:d,datasetId:t,workspaceId:l,acceptedUser:i,validateUser:a,exampleData:w})=>{const[b,n]=y.useState([]),[s,p]=y.useState(!0);y.useEffect(()=>{n(r)},[r]);const m=(x,c)=>{p(!1),n(A=>[...A,x])},h=x=>{const c=b.filter((A,u)=>u!==x);n(c),o(c)},f=(x,c,A)=>{const u=b.map((g,B)=>{if(B!==x)return g;const D=g.segments[c],v=D.valueType==="field",_=v?D.childSegments||[]:[],T=g.segments.map($=>{if($.segmentsId===D.segmentsId)if(v){const H=d.find(R=>R.field.id===A);return{...$,datasetId:H?.datasetId,datasetName:H?.datasetName,fieldType:H?.field.dataType,property:H?.field?.internalName,isAssociate:H?.field?.isAssociated,value:A}}else return{...$,value:A};if(v&&_.includes($.segmentsId)){const H=d.find(R=>R.field.id===A);return{...$,type:["drop-down"].includes(H?.field?.dataType)?"dropdown":"input",value:"",valueType:"field-options"}}return $});return{...g,segments:T}});o(u),n(u)},k=({optionType:x,valueType:c,fieldId:A})=>{const u=d?.map(g=>g.field);if(c==="field")return u.map(g=>({id:g.id,displayName:g.name,internalName:g.internalName}));if(c==="field-options")return u.find(B=>B.id===A)?.value?.map(B=>({id:B.key,displayName:B.value}));if(c==="users")return u.filter(g=>["user","collaborators"].includes(g.dataType)).map(g=>({id:g.internalName,displayName:g.name,internalName:g.internalName}))};return F.jsxs(F.Fragment,{children:[F.jsx("div",{children:b?.map((x,c)=>F.jsxs("div",{className:"d-flex hide-icon",children:[F.jsxs("div",{className:"f-w-400 f-14 txt-black2 d-flex flex-wrap flex-1 align-center",children:[c?F.jsx("span",{children:"And "}):F.jsx("span",{children:"Then "}),x.segments.map((A,u)=>{if(A.type==="text")return F.jsxs("span",{className:"ml-2",children:[" ",A.value," "]},u);if(A.type==="input")return F.jsx(tr.TextField,{id:"standard-basic",variant:"standard",className:"mx-8",disabled:e,defaultValue:A.value,type:A.valueType,onChange:g=>f(c,u,g.target.value),sx:{margin:0,maxWidth:100,padding:0,"& .MuiInputBase-input":{padding:"0 !important",paddingRight:"0 !important"},"& .MuiInputBase-root":{margin:0}}});if(A.type==="dropdown")return F.jsx(tr.FormControl,{variant:"standard",sx:{width:"auto"},className:"mx-8",children:F.jsx(tr.Select,{IconComponent:()=>null,value:A.value,disabled:e,sx:{minWidth:30,padding:0,"& .MuiSelect-select":{padding:"0 !important",paddingRight:"0 !important"},"& .MuiInputBase-input":{padding:"0 !important",paddingRight:"0 !important"}},onChange:g=>f(c,u,g.target.value),children:k({optionType:A.optionType,valueType:A.valueType,fieldId:x?.segments?.[A.mapSegmentsId]?.value})?.map(g=>F.jsx(tr.MenuItem,{value:g.id,children:g.displayName},g.id))},`${c}_${u}`)});if(A.type==="user")return F.jsx(Mm,{selectedAssignees:A.value,setValue:g=>{f(c,u,g)},datasetId:t,isForNotification:!0,acceptedUser:i,validateUser:a,workspaceId:l});if(A.type==="notification")return F.jsx(N9,{defaultValue:A.value,setValue:g=>{f(c,u,g)},acceptedUser:i,col:d,exampleData:w});if(A.type==="workspace")return F.jsx("div",{children:F.jsx(M9,{defaultValue:A.value,setValue:g=>{f(c,u,g)}})});if(A.type==="moveRecordToOtherWork"){let g=b[c]?.segments[A.mapSegmentsId]?.value;return F.jsx(R9,{defaultValue:A.value,datasetId:t,workspaceId:l,targetWorkspaceId:g??l,autoIndex:c,segmentIndex:u,setValue:B=>{f(c,u,B)}})}return null})]}),b.length>1?F.jsx("img",{src:"/delete.svg",className:"hide cursor-pointer",onClick:()=>{h(c)}}):F.jsx(F.Fragment,{}),F.jsx("div",{children:!e&&b.length-1===c?F.jsx(F.Fragment,{children:F.jsx(jm,{className:"f-w-400 f-14 txt-black2 cursor-pointer",onClick:()=>{p(!0)}})}):F.jsx(F.Fragment,{})})]},c))}),!e&&s?F.jsx(F.Fragment,{children:F.jsx(tr.FormControl,{variant:"standard",sx:{width:"auto"},className:"mx-8",children:F.jsx(tr.Select,{labelId:"demo-simple-select-standard-label",id:"demo-simple-select-standard",IconComponent:()=>null,sx:{minWidth:30,padding:0,"& .MuiSelect-select":{padding:"0 !important",paddingRight:"0 !important"},"& .MuiInputBase-input":{padding:"0 !important",paddingRight:"0 !important"}},displayEmpty:!0,renderValue:()=>F.jsx("div",{className:"f-w-400 f-14 txt-lightblack2",children:"Then make this happen"}),children:k9?.map(x=>F.jsx(tr.MenuItem,{onClick:()=>m(x.automation,x.key),children:x.displayAutomation},x.key))})})}):F.jsx(F.Fragment,{})]})},$9=({selectedId:r,setSelectedId:o,setSelectAutomation:e,setisCreateNewAutomation:d,workspaceId:t,isAutomation:l,selectFieldId:i,col:a,datasetId:w,validateUser:b,acceptedUser:n,exampleData:s,onClose:p})=>{const[m,h]=y.useState([]);y.useEffect(()=>{const c=async A=>{try{const u=await yA(A,t);h(u)}catch(u){console.error("Error fetching automation:",u)}};r?.id&&c(l?i:r?.id)},[r?.id,l,i]);const f=async({id:c,isActive:A})=>{await EA({id:c,isActive:A,workspaceId:t})},k=async({id:c})=>{await DA({id:c,workspaceId:t})},x={inputProps:{"aria-label":"Size switch demo"}};return F.jsx("div",{style:{top:0,right:0,height:"100%",width:"422px",background:"#fff",borderLeft:"1px solid #ccc"},children:F.jsxs("div",{className:"px-16 py-12 d-flex flex-column edge-container",children:[F.jsxs("div",{children:[F.jsxs("div",{className:"h-36px d-flex align-center f-w-600 f-14 txt-darkblue px-8 justify-between",children:[F.jsxs(F.Fragment,{children:[l?F.jsx(F.Fragment,{}):F.jsx(qm,{className:"mr-8 f-14 cursor-pointer",onClick:()=>o({id:"",type:"auto"})}),"Automation"]}),l?F.jsx(C9,{onClick:()=>p(),className:"cursor-pointer"}):F.jsx(F.Fragment,{})]}),F.jsx("div",{className:"border-solid-border1 my-12"})]}),F.jsxs("div",{className:"p-10 flex-1 overflow-auto",children:[F.jsx("div",{className:"mb-12 border-dashed-newborder h-48px radius-8 bg-blue-lighten9 d-flex align-center txt-darkblue cursor-pointer",onClick:()=>{d(!0)},children:F.jsxs("div",{className:"p-14 d-flex align-center",children:[F.jsx(E9,{}),F.jsx("p",{className:"f-w-600 f-14 ml-8",children:"New"})]})}),m?.data?.map(c=>F.jsxs("div",{className:"border-solid-input-border radius-12 px-12 py-10 d-flex mb-12 align-start",children:[F.jsxs("div",{className:"flex-1",onClick:()=>{e(c)},children:[F.jsx(X4,{defaultValue:c.condition,setValue:A=>{},isDisable:!0,col:a,isAutomation:!1,filedId:i,islistpage:!0}),F.jsx("div",{children:F.jsx(zm,{className:"my-8"})}),F.jsx(Ym,{defaultValue:c.automation,setValue:A=>{},isDisable:!0,col:a,datasetId:w,workspaceId:t,acceptedUser:n,validateUser:b,exampleData:s})]}),F.jsx(tr.Switch,{...x,defaultChecked:c.isActive,onChange:A=>{f({id:c.id,isActive:A.target.checked})}}),F.jsx("img",{src:"/delete.svg",onClick:()=>{k({id:c.id})}})]}))]})]})})},U9=({editEdgeData:r,setSelectedId:o,selectAutomation:e,isCreateNewAutomation:d,backTolistAutomaion:t,acceptedUser:l,selectFieldId:i,validateUser:a,workspaceId:w,col:b,datasetId:n,isAutomation:s,exampleData:p})=>{const{setValue:m,watch:h,getValues:f}=nb.useForm({defaultValues:{condition:{id:"",blocks:[]},automation:[]}});y.useEffect(()=>{m("automation",e.automation??[]),m("condition",e.condition??{id:"",blocks:[]})},[e.id]),console.log("condition",h("condition"));const k=async()=>{const x=h(),c=x.automation?.map(A=>{switch(A.key){case"changes_field_value":const u=A.segments?.find(E=>E.valueType==="field"),g=A.segments[u?.childSegments?.[0]];return{targetWorkspaceId:w,targetFieldId:u.value,actionType:Gt.UPDATE_FIELD,content:{propertyData:[{datasetId:u.datasetId,datasetName:u.datasetName,isAssociate:u.isAssociate,property:u.property,fieldType:u.fieldType,value:g.value,setValue:g.value}],datasetId:u.datasetId,datasetName:u.datasetName}};case"send_notification":const B=A.segments?.find(E=>E.valueType==="user-notification"),D=A.segments[B?.childSegments?.[0]],v=E=>E.map(C=>{const U=l.find(V=>V.id===C);return{id:U?.id,email:U?.email}});return{targetWorkspaceId:w,targetFieldId:"",actionType:Gt.NOTIFY,content:{isDeleted:!1,isActive:!0,workspaceId:w,senderEmail:a.email,senderId:a.id,notificationType:"push",notificationTitle:"Automation",notificationDescription:D.value,notificationMetadata:{},isRead:!1,receiverDetails:v(B.value)}};case"move_to_other_work":let _=A.segments?.find(E=>E.valueType==="moveRecordToOtherWork");return{targetWorkspaceId:w,targetFieldId:"",actionType:Gt.MOVE_RECORD,content:{..._?.value}};case"copy_to_other_workspace_work":let T=A.segments?.find(E=>E.valueType==="workspace"),$=A.segments?.find(E=>E.valueType==="moveRecordToOtherWork");return{targetWorkspaceId:T?.value??w,targetFieldId:"",actionType:Gt.COPY_RECORD_TO_OTHER_WORKSPACE,content:{...$?.value}};case"send_notification_to_field":const H=A.segments?.find(E=>E.valueType==="users"),R=A.segments[H?.childSegments?.[0]];return{targetWorkspaceId:w,targetFieldId:"",actionType:Gt.NOTIFY,content:{isDeleted:!1,isActive:!0,workspaceId:w,senderEmail:a.email,senderId:a.id,notificationType:"push",notificationTitle:"Automation",notificationDescription:R.value,notificationMetadata:{},isRead:!1,receiverDetails:[],selectField:H.value}}}});d?await FA({workspaceId:w+"",fieldId:i,from:s?"":r?.source,to:r?.target,workflowSegId:s?i:r?.id,condition:x.condition,automation:x.automation,automationAction:c,isAutomation:s}):await AA({id:e.id,condition:x.condition,automation:x.automation,automationAction:c,workspaceId:w+"",isAutomation:s})};return F.jsx("div",{style:{position:s?"relative":"absolute",top:s?0:56,right:0,height:"644px",maxHeight:"704px",width:"420px",background:"#fff",borderLeft:"1px solid #ccc",zIndex:1e3},children:F.jsxs("div",{className:"px-16 py-12 d-flex flex-column edge-container-properties maxh-703px",children:[F.jsxs("div",{children:[F.jsxs("div",{className:"h-36px d-flex align-center f-w-600 f-14 txt-darkblue px-8",children:[F.jsx(qm,{className:"mr-8 f-14 cursor-pointer",onClick:()=>t()}),"Properties"]}),F.jsx("div",{className:"border-solid-border1 my-12"})]}),F.jsxs("div",{className:"flex-1 overflow-auto hide-scroll mb-",children:[F.jsx(X4,{defaultValue:h("condition"),setValue:x=>{m("condition",x)},col:b,isAutomation:s,filedId:i}),F.jsx("div",{children:F.jsx(zm,{className:"my-8"})}),F.jsx(Ym,{defaultValue:h("automation"),setValue:x=>{m("automation",x)},col:b,datasetId:n,workspaceId:w,validateUser:a,acceptedUser:l,exampleData:p})]}),F.jsxs("div",{className:"d-flex justify-end",children:[F.jsx(tr.Button,{variant:"outlined",color:"inherit",className:"mr-10",onClick:()=>t(),children:"Cancel"}),F.jsx(tr.Button,{variant:"outlined",color:"primary",onClick:()=>{t(),k()},children:"Update"})]})]})})},Gm=({editEdgeData:r,selectedId:o,setSelectedId:e,acceptedUser:d,selectFieldId:t,validateUser:l,workspaceId:i,col:a,datasetId:w,isAutomation:b,exampleData:n,onClose:s})=>{const[p,m]=y.useState({}),[h,f]=y.useState(!1),k=()=>{m({}),f(!1)};return Rm(p)&&!h?F.jsx($9,{selectedId:o,setSelectedId:e,setSelectAutomation:m,setisCreateNewAutomation:f,workspaceId:i,isAutomation:b,selectFieldId:t,col:a,datasetId:w,acceptedUser:d,validateUser:l,exampleData:n,onClose:s}):F.jsx(U9,{editEdgeData:r,selectAutomation:p,setSelectedId:e,isCreateNewAutomation:h,backTolistAutomaion:k,acceptedUser:d,selectFieldId:t,validateUser:l,workspaceId:i,col:a,datasetId:w,isAutomation:b,exampleData:n})},j9=({selectedId:r,editEdgeData:o,updateEdgeData:e,setSelectedId:d})=>{const{acceptedUser:t,selectFieldId:l,validateUser:i,workspaceId:a,col:w,datasetId:b,exampleData:n}=y.useContext(Z4);return r.type===Df.Auto?F.jsx(Gm,{editEdgeData:o,selectedId:r,setSelectedId:d,acceptedUser:t,selectFieldId:l,validateUser:i,workspaceId:a,col:w,datasetId:b,isAutomation:!1,exampleData:n}):F.jsx(c9,{edgeData:o,updateEdgeData:e,setSelectedId:d,validateUser:i,workspaceId:a,acceptedUser:t})},L9=({edges:r,updateEdgeData:o,saveToBackend:e})=>{const[d,t]=y.useState({id:"",type:Df.Config});return F.jsx("div",{children:d.id?F.jsx(j9,{selectedId:d,updateEdgeData:o,editEdgeData:r?.find(l=>l.id===d.id),setSelectedId:t}):F.jsx(PA,{edges:r,setSelectedId:t,saveToBackend:e})})},z9=({children:r,col:o,selectFieldId:e,validateUser:d,workspaceId:t,exampleData:l,acceptedUser:i,datasetId:a})=>F.jsx(Z4.Provider,{value:{col:o,selectFieldId:e,validateUser:d,workspaceId:t,exampleData:l,acceptedUser:i,datasetId:a},children:r}),V9={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:400,bgcolor:"background.paper",borderRadius:2,boxShadow:"24",p:4,background:"linear-gradient(101.49deg, #F8FDFF 11.98%, #FBF2FB 119.18%)",border:"1px solid #EAEFF4",outline:"none"},H9=({fieldId:r,col:o,validateUser:e,workspaceId:d,exampleData:t,acceptedUser:l,datasetId:i,onClose:a})=>{const w=o?.find(c=>c.field.id===r),b=sp(w.field.value),[n,s,p]=Bg(b),[m,h,f]=Ig([]);y.useEffect(()=>{(async A=>{try{const u=await vA({fieldId:A,workspaceId:d}),g=u.data.workflowDefinition.nodes,B=u.data.workflowDefinition.edges,{onlyInNode:D,onlyInOption:v}=q5(u.data.workflowDefinition.nodes,w.field.value);let _=g.filter($=>!D.includes($.id));const T=B.filter($=>!(D.includes($.source)||D.includes($.target)));if(v.length){const $=sp(v,v.length+2);_=[..._,...$]}s(_),h(T)}catch(u){console.error("Error fetching automation:",u)}})(r)},[r,JSON.stringify(w)]);const k=({id:c,data:A})=>{h(u=>u?.map(g=>(g.id===c&&(g.data=A),g)))},x=async()=>{const c=H5(m);await uA({workspaceId:d,workflow:{nodes:n,edges:m,workflow:c},fieldId:r})};return F.jsx(tr.Modal,{open:!0,onClose:()=>a,children:F.jsx(z9,{col:o,selectFieldId:r,validateUser:e,workspaceId:d,exampleData:t,acceptedUser:l,datasetId:i,children:F.jsx("div",{className:"workflow-we3434",children:F.jsxs("div",{className:"w-1225px h-703px border-solid-lightblue1 d-flex flex-column",style:V9,children:[F.jsxs("div",{className:"h-56px border-b-solid-border d-flex align-center justify-between px-20",children:[F.jsx("div",{className:"f-w-600 f-18 px-12",children:"Workflow"}),F.jsxs("div",{className:"d-flex align-center px-12",children:[F.jsx("div",{className:"border-solid-ligntbrown h-14px mr-8"}),F.jsx(V5,{className:"h-24px w-24px txt-lightblack3",onClick:()=>a()})]})]}),F.jsxs("div",{className:"flex-1 d-flex",children:[F.jsx(lw,{children:F.jsx(TA,{nodes:n,edges:m,setEdges:h,onNodesChange:p,onEdgesChange:f})}),F.jsx(L9,{edges:m,updateEdgeData:k,saveToBackend:x})]})]})})})})},q9=({acceptedUser:r,col:o,datasetId:e,exampleData:d,fieldId:t,onClose:l,validateUser:i,workspaceId:a})=>F.jsx("div",{className:"h-560px workflow-we3434",children:F.jsx(Gm,{editEdgeData:null,selectedId:{id:t,type:"auto"},setSelectedId:()=>{},acceptedUser:r,workspaceId:a,validateUser:i,selectFieldId:t,col:o,datasetId:e,isAutomation:!0,exampleData:d,onClose:l})});uo.FieldAutomationModal=q9,uo.ReactFlowModal=H9,Object.defineProperty(uo,Symbol.toStringTag,{value:"Module"})});
|
|
187
|
+
`,b9=(r,o,e=void 0)=>{const d=o?.split(".");let t=r;for(const l of d)if(t&&typeof t=="object"&&l in t)t=t[l];else return e;return t},Rm=r=>r==null?!0:typeof r=="string"||Array.isArray(r)?r.length===0:typeof r=="object"?Object.keys(r).length===0:!1,n9=r=>{const o=typeof r=="string"?r:b9(r,"props.children","");let e=RegExp(/\b\w/g).exec(o);return Rm(e)||(e=((e.shift()||"")+(e.pop()||"")).toUpperCase()),e},s9=r=>r?.toLowerCase()?.split(/[\s\-_]+/).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "),p9=({data:r,value:o})=>F.jsxs("div",{className:"d-flex align-center justify-between flex-1 text-truncate",id:"selection-ownerList",children:[F.jsx("div",{className:"user-oval-32 rounded-circle mr-2 bg-blue-lighten1",children:r.picture?F.jsx(tr.Avatar,{className:"w-100 h-100 rounded-circle",sx:{width:32,height:32},src:r.picture,alt:"profile"}):F.jsx("div",{className:"user-oval-32 rounded-circle align-center d-flex justify-around",children:F.jsx("p",{className:"f-11 f-w-500 txt-secondary-color font-600 align-center d-flex",children:n9(r.name)})})}),F.jsxs("div",{className:"flex-1 text-truncate ml-4 l-h-18",children:[F.jsx("p",{className:"f-14 f-w-400 text-truncate m-0",children:s9(r.name)}),F.jsx("p",{className:"f-12 f-w-400 txt-darken1 text-truncate m-0",children:r.roleName||"--"})]}),o===r.id?F.jsx("div",{className:"f-20 txt-bllue-darken8",children:F.jsx(bb.CheckOutlined,{className:"f-20 txt-bllue-darken8"})}):F.jsx(F.Fragment,{})]}),Mm=({selectedAssignees:r,setValue:o,datasetId:e,isForNotification:d=!1,acceptedUser:t,validateUser:l,workspaceId:i})=>{const[a,w]=y.useState([]),[b,n]=y.useState(""),[s,p]=y.useState(!1);console.log("acceptedUser",t);const{data:m}=Jr.useQuery(i9,{variables:{input:{datasetId:e,searchKey:b,workspaceId:Number(i),userId:l.id}},fetchPolicy:"network-only",client:Pm});console.log("filteredOptions",m);const h=k=>{let x;a.some(c=>c.id===k.id)?x=a.filter(c=>c.id!==k.id):x=[...a,k],w(x),o(x.map(c=>c.id))},f=k=>{const x=a.filter(c=>c.id!==k);w(x),o(x.map(c=>c.id))};return s?F.jsx(tr.ClickAwayListener,{onClickAway:()=>p(!1),children:F.jsxs("div",{className:"h-34px w-380px position-relative bg-white",children:[a.length?F.jsx("div",{className:"d-flex align-center flex-wrap bg-white z-index-100",children:a?.map(k=>F.jsxs("div",{className:"h-34px d-flex align-center justify-between px-8 cursor-pointer radius-4 hover-show-container border-solid-popper-border ml-4 mt-4",onClick:()=>{f(k.id)},children:[F.jsx("div",{className:"f-14 f-w-500 txt-blue-darken10 ",children:k.name}),F.jsx(UA,{className:"f-20 ml-6"})]},k.id))}):F.jsx("div",{className:"h-34px w-380px d-flex align-center justify-between px-8 cursor-pointer radius-4 hover-show-container",onClick:()=>{},children:"--"}),F.jsx("div",{className:"position-relative",children:F.jsx("div",{className:`position-absolute ${a.length?"top-10px":"top--25px"} radius-8 search-mapdataset z-index-1000 bg-white`,children:F.jsxs("div",{className:"w-380px minh-46px radius-8 popper-border-solid-popper-border",children:[F.jsx("div",{className:"h-46px bg-grey-lighten4 boder-b-solid-popper-border tl-radius-8 tr-radius-8 p-10 d-flex align-center",children:F.jsx(tr.TextField,{sx:{input:{"&::placeholder":{color:Ni["success-disabled"],opacity:100}}},fullWidth:!0,className:"mapdataset-dropdown",id:"single-line",variant:"standard",placeholder:"Search",value:b,onChange:k=>n(k.target.value),autoComplete:"off",autoFocus:!0})}),!m?.getAccessUserList?.length&&b?F.jsx("div",{className:"p-10",children:F.jsx("div",{className:"d-flex align-center multi-select",children:F.jsxs("div",{className:"h-36px d-flex align-center f-w-400 f-14 txt-brown-dark1 pl-8 cursor-pointer",children:[F.jsx("p",{className:" f-w-600 txt-text-grey-primary mr-4",children:"user not found"})," ",` "${b}"`]})},"new-associate")}):F.jsx("div",{className:"bg-white maxh-202px overflow-auto p-8 px-6 bl-radius-8 br-radius-8",children:m?.getAccessUserList?.map((k,x)=>F.jsx("div",{className:` radius-4 px-10 py-8 ${m?.getAccessUserList?.length!==x+1?"mb-4":""} bg-hover-grey-lighten4 cursor-pointer d-flex align-center justify-between hover-show-container ${a?.some(c=>c.id===k.id)?"bg-blue-lighten9":""}`,onClick:()=>{h(k)},children:F.jsxs("div",{className:"d-flex align-center",children:[F.jsx(tr.Checkbox,{checked:a?.some(c=>c.id===k.id),size:"small"},k.id),F.jsx(p9,{data:k,value:""})]})},k.id))})]})})})]})}):F.jsx(F.Fragment,{children:d?F.jsx("div",{style:{textDecoration:"underline",textUnderlineOffset:"2px"},className:"pl-4",onClick:()=>p(!0),children:r.length?r?.map((k,x)=>{const c=t.find(A=>A.id===k);return F.jsx("span",{children:c?.name+`${r.length-1===x?"":","}`})}):F.jsx("div",{className:"",children:" select user"})}):F.jsxs("div",{className:"d-flex h-40px maxh-40px radius-8 border-solid-border px-12 align-center justify-between",onClick:()=>p(!0),children:[F.jsx(f9,{assignTo:r,acceptedUserData:t}),F.jsx(ef,{})]})})},f9=({assignTo:r,acceptedUserData:o})=>{const e=r?.map(t=>o?.find(l=>l.id===t));console.log("acceptedUserData",o),console.log("assignTo",r);const d=e?.length>4?e.slice(0,4):e;return d?.length?(console.log("getUserData",e),console.log("showUserData",d),F.jsxs("div",{className:"d-flex align-center",id:"dataCollab-view",children:[d?.map(t=>t?.picture?F.jsx(tr.Avatar,{className:"w-100 h-100 rounded-circle mr-4",sx:{width:32,height:32},src:t.picture,alt:"profile"},t?.id):F.jsx("div",{className:"w-32px h-32px radius-360 bg-orange-lighten5 d-flex align-center justify-center f-10 f-w-500 txt-primary mr-4",children:`${t?.firstName?Jp(t?.firstName[0]):""}${t?.lastName?Jp(t?.lastName[0]):""}`},t?.id)),e?.length>4&&F.jsxs("div",{className:"w-24px h-24px p-2 radius-360 bg-avatarColor txt-blue-darken10 d-flex align-center justify-center avatar",children:["+",e.length-4]})]})):"--"},h9=({options:r,defaultValue:o=[],setValue:e})=>{const[d,t]=y.useState(""),[l,i]=y.useState(o),[a,w]=y.useState(0),b=y.useRef(null),[n,s]=y.useState(!1);y.useEffect(()=>{b.current&&w(b.current.offsetHeight)},[l]);const p=m=>{let h;l.some(f=>f.id===m.id)?h=l.filter(f=>f.id!==m.id):h=[...l,m],i(h),e(h)};return n?F.jsx("div",{className:" bg-white w-380px h-46px border-solid-input-border radius-8 ",children:F.jsx(tr.ClickAwayListener,{onClickAway:()=>{s(!1)},children:F.jsxs("div",{className:"position-relative",children:[F.jsx("div",{ref:b,className:" w-100 res-chip-min-height h-100 radius-4 bg-white d-flex align-center d-flex flex-wrap py-4 gap-8 px-12",children:l.length?F.jsx(F.Fragment,{children:l?.map((m,h)=>F.jsx(tr.Chip,{label:m.displayName,onDelete:()=>p(m),sx:{bgcolor:Ni["popper-border"],border:0,borderRadius:2,margin:"0 !important",padding:"6px 8px 6px 8px",gap:1,".MuiChip-label":{fontSize:14,fontFamily:"Inter, sans-serif !important"}},deleteIcon:F.jsx(bb.CloseOutlined,{sx:{fontSize:"16px",color:m.statusColor?"#fff":"grey"},className:"cursor-pointer icon-close"}),variant:"outlined"},h))}):F.jsx("div",{className:"ml-10 d-flex align-center f-14 txt-text-grey-hint",children:"No fields"})}),F.jsx("div",{className:"position-absolute radius-8 search-mapdataset z-index-1000",style:{top:`${a+4}px`},children:F.jsxs("div",{className:"w-380px minh-46px radius-8 popper-border-solid-popper-border",children:[F.jsx("div",{className:"h-46px bg-grey-lighten4 boder-b-solid-popper-border tl-radius-4 tr-radius-8 p-10",children:F.jsx(tr.TextField,{sx:{input:{"&::placeholder":{color:Ni["success-disabled"],opacity:100}}},fullWidth:!0,className:"mapdataset-dropdown",variant:"standard",placeholder:"Search",value:d,onChange:m=>t(m.target.value),autoFocus:!0})}),F.jsx("div",{className:"bg-white maxh-200px overflow-auto w-100 py-8 px-6 bl-radius-8 br-radius-8",children:F.jsx(F.Fragment,{children:r?.filter(m=>m.displayName.toLowerCase().includes(d.toLowerCase()))?.map(m=>F.jsxs("div",{className:` h-36px radius-4 px-10 py-8 mb-2 bg-hover-grey-lighten4 cursor-pointer d-flex justify-start hover-show-container align-center ${l.some(h=>h.id===m.id)?"bg-blue-lighten9 txt-blue-darken10 radius-4 p-4":""}`,onClick:()=>{p(m)},children:[F.jsx(tr.Checkbox,{className:"mx-10 p-0",size:"small",color:"primary",checked:l.some(h=>h.id===m.id)}),F.jsx("div",{className:"f-14 f-w-400 txt-text-grey-primary",children:m.displayName})]},m.id))})})]})})]})})}):F.jsx(F.Fragment,{children:F.jsxs("div",{className:"d-flex align-center h-46px border-solid-input-border radius-8 p-12 justify-between",onClick:()=>s(!0),children:[F.jsxs("div",{className:"d-flex",children:[Array.isArray(o)&&o?.length?(o?.length>3?o.slice(0,3):o)?.map((m,h)=>F.jsx(tr.Chip,{label:m.displayName,sx:{bgcolor:Ni["popper-border"],border:0,borderRadius:2,margin:"0 !important",padding:"6px 8px 6px 8px",gap:1,".MuiChip-label":{fontSize:14,fontFamily:"Inter, sans-serif !important"}},variant:"outlined"},h)):F.jsx(F.Fragment,{children:"-"}),o?.length>3&&F.jsxs("div",{className:"w-24px h-24px p-2 radius-360 bg-avatarColor txt-blue-darken10 d-flex align-center justify-center avatar h-26px px-6 py-8 bg-lightblue1 radius-4 border-solid-popper-border ml-4",children:["+",o.length-3]})]}),F.jsx(ef,{})]})})},m9=[{field:{id:"256f35efc157446dba47e0922057ff61",isActive:!0,isDeleted:!1,createdAt:"2025-08-21T08:44:05.608Z",updatedAt:"2025-08-21T08:44:05.608Z",fieldDisplayName:"Name",fieldInternalName:"work_4_name",datasetName:"work_4",sensitive:!1,hidden:!1,isHideField:!1,dataType:"single-line",isRequired:!0,isUnique:!1,isAssociatedField:!1,isSystemDefined:!1,isImmutable:!1,isPrimaryField:!0,isSelected:!0,isSortable:!0,sortOrder:"1",createdBy:"7fda40cd83dc4391a7b751a67c0dfaa6",updatedBy:null,deletedBy:null,CreatedById:"7fda40cd83dc4391a7b751a67c0dfaa6",deletedAt:null,prefix:"",postfix:"",value:[],columnWidth:null,toggleState:null,workflow:null,name:"Name",internalName:"work_4_name",isAssociated:!1,type:"work_4"},group:{id:"fc4a57aec9094c47bbdf55a4f028072c",datasetName:"work_4",groupName:"Work 4 Information"},position:1,isSelected:!0,isPrimaryField:!0,isDeleted:!1,isAssociated:!1,datasetName:"work_4",datasetId:"557465b7fd9244849f00076491369c84",isRequired:!0,isImmutable:!1},{field:{id:"d397ae5f3e2f48a280dc6f7644325b00",isActive:!0,isDeleted:!1,createdAt:"2025-08-21T08:44:05.608Z",updatedAt:"2025-08-21T08:44:05.608Z",fieldDisplayName:"Status",fieldInternalName:"stage",datasetName:"work_4",sensitive:!1,hidden:!1,isHideField:!1,dataType:"drop-down",isRequired:!0,isUnique:!1,isAssociatedField:!1,isSystemDefined:!1,isImmutable:!1,isPrimaryField:!1,isSelected:!0,isSortable:!1,sortOrder:"2",createdBy:"7fda40cd83dc4391a7b751a67c0dfaa6",updatedBy:null,deletedBy:null,CreatedById:"7fda40cd83dc4391a7b751a67c0dfaa6",deletedAt:null,prefix:"",postfix:"",value:[{key:"New",value:"New"},{key:"Open",value:"Open"},{key:"In Progress",value:"In Progress"},{key:"Qualified",value:"Qualified"},{key:"Unqualified",value:"Unqualified"},{key:"Attempted To Contact",value:"Attempted To Contact"},{key:"Connected",value:"Connected"},{key:"Bad Timing",value:"Bad Timing"},{key:"Hot Lead",value:"Hot Lead"}],columnWidth:null,toggleState:null,workflow:null,name:"Status",internalName:"stage",isAssociated:!1,type:"work_4"},group:{id:"fc4a57aec9094c47bbdf55a4f028072c",datasetName:"work_4",groupName:"Work 4 Information"},position:2,isSelected:!0,isPrimaryField:!1,isDeleted:!1,isAssociated:!1,datasetName:"work_4",datasetId:"557465b7fd9244849f00076491369c84",isRequired:!0,isImmutable:!1},{field:{id:"bfb6fa887f67486d93ab3c5516f93f4c",isActive:!0,isDeleted:!1,createdAt:"2025-08-21T08:44:05.608Z",updatedAt:"2025-08-21T08:44:05.608Z",fieldDisplayName:"Owner",fieldInternalName:"owner",datasetName:"work_4",sensitive:!1,hidden:!1,isHideField:!1,dataType:"user",isRequired:!0,isUnique:!1,isAssociatedField:!1,isSystemDefined:!1,isImmutable:!1,isPrimaryField:!1,isSelected:!0,isSortable:!0,sortOrder:"3",createdBy:"7fda40cd83dc4391a7b751a67c0dfaa6",updatedBy:null,deletedBy:null,CreatedById:"7fda40cd83dc4391a7b751a67c0dfaa6",deletedAt:null,prefix:"",postfix:"",value:[],columnWidth:null,toggleState:null,workflow:null,name:"Owner",internalName:"owner",isAssociated:!1,type:"work_4"},group:{id:"fc4a57aec9094c47bbdf55a4f028072c",datasetName:"work_4",groupName:"Work 4 Information"},position:3,isSelected:!0,isPrimaryField:!1,isDeleted:!1,isAssociated:!1,datasetName:"work_4",datasetId:"557465b7fd9244849f00076491369c84",isRequired:!0,isImmutable:!1},{field:{id:"643e3725963e47fb96fc192ddd8680f4",isActive:!0,isDeleted:!1,createdAt:"2025-08-21T08:44:05.608Z",updatedAt:"2025-08-21T08:44:05.608Z",fieldDisplayName:"Priority",fieldInternalName:"priority",datasetName:"work_4",sensitive:!1,hidden:!1,isHideField:!1,dataType:"priority",isRequired:!0,isUnique:!1,isAssociatedField:!1,isSystemDefined:!1,isImmutable:!1,isPrimaryField:!1,isSelected:!0,isSortable:!1,sortOrder:"4",createdBy:"7fda40cd83dc4391a7b751a67c0dfaa6",updatedBy:null,deletedBy:null,CreatedById:"7fda40cd83dc4391a7b751a67c0dfaa6",deletedAt:null,prefix:"",postfix:"",value:[{key:"Low",value:"Low",statusColor:null},{key:"Moderate",value:"Moderate",statusColor:null},{key:"High",value:"High",statusColor:null}],columnWidth:null,toggleState:null,workflow:null,name:"Priority",internalName:"priority",isAssociated:!1,type:"work_4"},group:{id:"fc4a57aec9094c47bbdf55a4f028072c",datasetName:"work_4",groupName:"Work 4 Information"},position:4,isSelected:!0,isPrimaryField:!1,isDeleted:!1,isAssociated:!1,datasetName:"work_4",datasetId:"557465b7fd9244849f00076491369c84",isRequired:!0,isImmutable:!1},{field:{id:"e6077294af434793aa036c73337f0163",isActive:!0,isDeleted:!1,createdAt:"2025-08-21T09:33:51.860Z",updatedAt:"2025-08-21T09:33:52.122Z",fieldDisplayName:"interview",fieldInternalName:"interview",datasetName:"work_4",sensitive:!1,hidden:!1,isHideField:!1,dataType:"drop-down",isRequired:!1,isUnique:!1,isAssociatedField:!1,isSystemDefined:!1,isImmutable:!1,isPrimaryField:!1,isSelected:!0,isSortable:!1,sortOrder:"5",createdBy:"7fda40cd83dc4391a7b751a67c0dfaa6",updatedBy:null,deletedBy:null,CreatedById:"7fda40cd83dc4391a7b751a67c0dfaa6",deletedAt:null,prefix:null,postfix:null,value:[{key:"stage 1",value:"stage 1",statusColor:"#397E4E"},{key:"stage 2",value:"stage 2",statusColor:"#5DC975"},{key:"stage 3",value:"stage 3",statusColor:"#9DD32D"},{key:"stage 4",value:"stage 4",statusColor:"#CAB642"},{key:"stage 5",value:"stage 5",statusColor:"#E0CC33"}],columnWidth:null,toggleState:!0,workflow:null,name:"interview",internalName:"interview",isAssociated:!1,type:"work_4"},group:{id:"fc4a57aec9094c47bbdf55a4f028072c",datasetName:"work_4",groupName:"Work 4 Information"},position:6,isSelected:!0,isPrimaryField:!1,isDeleted:!1,isAssociated:!1,datasetName:"work_4",datasetId:"557465b7fd9244849f00076491369c84",isRequired:!1,isImmutable:!1},{field:{id:"c6104a0ccd7e4636a72bf13380c6491e",isActive:!0,isDeleted:!1,createdAt:"2025-08-22T09:26:10.456Z",updatedAt:"2025-08-22T09:26:10.733Z",fieldDisplayName:"coll",fieldInternalName:"coll",datasetName:"work_4",sensitive:!1,hidden:!1,isHideField:!1,dataType:"collaborators",isRequired:!1,isUnique:!1,isAssociatedField:!1,isSystemDefined:!1,isImmutable:!1,isPrimaryField:!1,isSelected:!0,isSortable:!1,sortOrder:"6",createdBy:"7fda40cd83dc4391a7b751a67c0dfaa6",updatedBy:null,deletedBy:null,CreatedById:"7fda40cd83dc4391a7b751a67c0dfaa6",deletedAt:null,prefix:null,postfix:null,value:[],columnWidth:null,toggleState:null,workflow:null,name:"coll",internalName:"coll",isAssociated:!1,type:"work_4"},group:{id:"fc4a57aec9094c47bbdf55a4f028072c",datasetName:"work_4",groupName:"Work 4 Information"},position:7,isSelected:!0,isPrimaryField:!1,isDeleted:!1,isAssociated:!1,datasetName:"work_4",datasetId:"557465b7fd9244849f00076491369c84",isRequired:!1,isImmutable:!1}],G4={status_changes:{type:"condition",segments:[{segmentsId:0,type:"dropdown",valueType:"field",optionType:["priority","drop-down"],value:"",childSegments:[2]},{segmentsId:1,type:"text",value:"is value of"},{segmentsId:2,type:"dropdown",valueType:"field-options",mapSegmentsId:0,value:""}]},number_lessthan:{type:"condition",segments:[{segmentsId:0,type:"dropdown",valueType:"field",optionType:["number","currency"],value:"",childSegments:[2]},{segmentsId:1,type:"text",value:"is less than"},{segmentsId:2,type:"input",valueType:"number",value:"",mapSegmentsId:0}]},number_greaterthan:{type:"condition",segments:[{segmentsId:0,type:"dropdown",valueType:"field",optionType:["number","currency"],value:"",childSegments:[2]},{segmentsId:1,type:"text",value:"is greater than"},{segmentsId:2,type:"input",valueType:"number",value:"",mapSegmentsId:0}]}},$m=[{key:"status_changes",displayContent:"status is value of",conditionAuto:G4.status_changes,types:["dropdown"]},{key:"number_lessthan",displayContent:"Number is less than",conditionAuto:G4.number_lessthan,types:["number"]},{key:"number_greaterthan",displayContent:"Number is greater than",conditionAuto:G4.number_greaterthan,types:["number"]}],nl={changes_field_value:{key:"changes_field_value",segments:[{segmentsId:0,type:"text",value:"set"},{segmentsId:1,type:"dropdown",valueType:"field",optionType:"",fieldType:"",value:"",childSegments:[3]},{segmentsId:2,type:"text",value:"to"},{segmentsId:3,type:"input",valueType:"number",value:"",mapSegmentsId:1}]},send_notification:{key:"send_notification",segments:[{segmentsId:0,type:"text",value:"Notify the"},{segmentsId:1,type:"user",valueType:"user-notification",optionType:"",fieldType:"",value:[],childSegments:[3]},{segmentsId:2,type:"text",value:"as"},{segmentsId:3,type:"notification",valueType:"",value:"",mapSegmentsId:1}]},move_to_other_work:{key:"move_to_other_work",segments:[{segmentsId:0,type:"text",value:"Move to"},{segmentsId:1,type:"moveRecordToOtherWork",valueType:"moveRecordToOtherWork",optionType:"",fieldType:"",value:[]}]},copy_to_other_workspace_work:{key:"copy_to_other_workspace_work",segments:[{segmentsId:0,type:"text",value:"Move to"},{segmentsId:1,type:"workspace",valueType:"workspace",optionType:"",fieldType:"",value:[],childSegments:[2]},{segmentsId:2,type:"moveRecordToOtherWork",valueType:"moveRecordToOtherWork",optionType:"",fieldType:"",value:[],mapSegmentsId:1}]},send_notification_to_field:{key:"send_notification_to_field",segments:[{segmentsId:0,type:"text",value:"Notify the"},{segmentsId:1,type:"dropdown",valueType:"users",optionType:"",fieldType:"",value:[],childSegments:[3]},{segmentsId:2,type:"text",value:"as"},{segmentsId:3,type:"notification",valueType:"",value:"",mapSegmentsId:1}]}},k9=[{key:"changes_field_value",displayAutomation:"change Field Value",automation:nl.changes_field_value},{key:"send_notification",displayAutomation:"send Notification",automation:nl.send_notification},{key:"move_to_other_work",displayAutomation:"move to other work",automation:nl.move_to_other_work},{key:"copy_to_other_workspace_work",displayAutomation:"move to other workspace work",automation:nl.copy_to_other_workspace_work},{key:"send_notification_to_field",displayAutomation:"send Notification by field",automation:nl.send_notification_to_field}];var sl={},Um;function x9(){if(Um)return sl;Um=1;var r=Yo();Object.defineProperty(sl,"__esModule",{value:!0}),sl.default=void 0;var o=r(ue()),e=Jo();return sl.default=(0,o.default)((0,e.jsx)("path",{d:"M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1"}),"AddRounded"),sl}var g9=x9();const jm=Io(g9),X4=({defaultValue:r,setValue:o,isDisable:e=!1,col:d,isAutomation:t,filedId:l,islistpage:i=!1})=>{const[a,w]=y.useState(r),[b,n]=y.useState(!0);y.useEffect(()=>{r?.blocks?.length&&w(r)},[JSON.stringify(r),t]);const s=()=>{const k=$m.filter(x=>x.types.includes("dropdown"));m(k[0].conditionAuto,k[0].key,!0)};y.useEffect(()=>{t&&!r?.blocks?.length&&s()},[t,JSON.stringify(r)]);const p=(k,x,c)=>{const A=a.blocks.map((u,g)=>g!==k?u:{...u,segments:u.segments.map((B,D)=>D!==x?B:{...B,value:c})});w(u=>({...u,blocks:A})),o({...a,blocks:A})},m=(k,x,c=!1)=>{const A={...a};if(A.blocks=[...A.blocks,{...k,key:x}],t&&c){console.log("i am in ");const u=A.blocks.map((g,B)=>B!==0?g:{...g,segments:g.segments.map((D,v)=>v!==0?D:{...D,value:l})});w(()=>({...A,blocks:u})),o({...A,blocks:u}),n(!1)}else w(()=>A),n(!1)},h=({optionType:k,valueType:x,fieldId:c})=>{const A=d?.map(u=>u.field);if(x==="field")return A?.filter(u=>k?.includes(u.dataType)&&!u.isAssociated).map(u=>({id:u.id,displayName:u.name,internalName:u.internalName}));if(x==="field-options")return A.find(g=>g.id===c)?.value?.map(g=>({id:g.key,displayName:g.value}))},f=k=>{let x={...a,blocks:a.blocks.filter((c,A)=>A!==k)};x.blocks.length||n(!0),w(x),o(x)};return F.jsxs(F.Fragment,{children:[F.jsx("div",{children:a?.blocks?.map((k,x)=>F.jsxs("div",{className:"d-flex hide-icon mb-12",children:[F.jsxs("div",{className:"f-w-400 f-14 txt-black2 d-flex flex-wrap flex-1 align-center",children:[x?F.jsx("span",{children:"And only if"}):F.jsx("span",{children:"When a"}),k.segments.map((c,A)=>c.type==="text"?F.jsxs("span",{children:[" ",c.value," "]},A):c.type==="input"?F.jsx(tr.TextField,{id:"standard-basic",variant:"standard",className:"mx-8",disabled:e,defaultValue:c.value,type:c.valueType,onChange:u=>p(x,A,u.target.value),sx:{margin:0,maxWidth:100,padding:0,"& .MuiInputBase-input":{padding:"0 !important",paddingRight:"0 !important"},"& .MuiInputBase-root":{margin:0}}}):c.type==="dropdown"?F.jsx(tr.FormControl,{variant:"standard",sx:{width:"auto"},className:"mx-8",children:F.jsx(tr.Select,{IconComponent:()=>null,value:c.value,disabled:e,sx:{minWidth:30,padding:0,"& .MuiSelect-select":{padding:"0 !important",paddingRight:"0 !important"},"& .MuiInputBase-input":{padding:"0 !important",paddingRight:"0 !important"}},onChange:u=>p(x,A,u.target.value),children:h({optionType:c.optionType,valueType:c.valueType,fieldId:k?.segments?.[c.mapSegmentsId]?.value})?.map(u=>F.jsx(tr.MenuItem,{value:u.id,children:u.displayName},u.id))},`${x}_${A}`)}):null)]}),a.blocks.length>0&&!i?F.jsx("img",{src:"/delete.svg",className:"hide cursor-pointer",onClick:()=>{f(x)}}):F.jsx(F.Fragment,{}),F.jsx("div",{children:!e&&a.blocks.length-1===x&&!t?F.jsx(F.Fragment,{children:F.jsx(jm,{className:"f-w-400 f-14 txt-black2 cursor-pointer",onClick:()=>{n(!0)}})}):F.jsx(F.Fragment,{})})]},x))}),!e&&b?F.jsx(F.Fragment,{children:F.jsx(tr.FormControl,{variant:"standard",sx:{width:"auto"},className:"mx-8",children:F.jsx(tr.Select,{labelId:"demo-simple-select-standard-label",id:"demo-simple-select-standard",IconComponent:()=>null,sx:{minWidth:30,padding:0,"& .MuiSelect-select":{padding:"0 !important",paddingRight:"0 !important"},"& .MuiInputBase-input":{padding:"0 !important",paddingRight:"0 !important"}},displayEmpty:!0,renderValue:()=>F.jsx("div",{className:"f-w-400 f-14 txt-lightblack2",children:"When something starts"}),children:$m?.map(k=>F.jsx(tr.MenuItem,{onClick:()=>m(k.conditionAuto,k.key),children:k.displayContent},k.key))})})}):F.jsx(F.Fragment,{})]})},c9=({edgeData:r,updateEdgeData:o,setSelectedId:e,validateUser:d,workspaceId:t,acceptedUser:l})=>{const{setValue:i,watch:a}=nb.useForm({defaultValues:{permission:r?.data?.permission||[],requiredColumns:r?.data?.requiredColumns||[],condition:r?.data?.condition||{id:"",blocks:[]}}}),w=m9?.map(b=>({id:b.field.id,displayName:b?.field?.name,internalName:b?.field?.internalName}));return F.jsx("div",{style:{position:"absolute",top:0,right:0,height:"100%",width:"420px",background:"#fff",borderLeft:"1px solid #ccc",zIndex:1e3},children:F.jsxs("div",{className:"px-16 py-12 d-flex flex-column edge-container",children:[F.jsxs("div",{children:[F.jsx("div",{className:"h-36px d-flex align-center f-w-600 f-14 txt-darkblue px-8",children:"Configuration"}),F.jsx("div",{className:"border-solid-border1 my-12"})]}),F.jsx("div",{className:"flex-1",children:F.jsxs("div",{className:"p-10",children:[F.jsxs("div",{className:"h-44px flex-1 radius-8 px-12 py-6 d-flex justify-between align-center cursor-pointer",style:{backgroundColor:r4(r?.data?.sourceColor),border:`1px solid ${Ve(r?.data?.sourceColor)}`},children:[F.jsx("div",{className:"f-w-600 f-14 txt-black mr-20 ",style:{color:Ve(r?.data?.sourceColor)},children:r?.data?.sourceLabel}),F.jsx("img",{src:"/arrow.svg",alt:"arrow",className:"mr-20"}),F.jsx("div",{className:"f-w-600 f-14 txt-black mr-20 ",style:{color:Ve(r.data?.targetColor)},children:r?.data?.targetLabel})]}),F.jsx("div",{className:"border-solid-border1 my-16"}),F.jsxs("div",{className:"mb-16",children:[F.jsx("p",{className:"f-w-600 f-14 txt-black2 mb-6",children:"Permissions"}),F.jsx(Mm,{selectedAssignees:a("permission"),datasetId:"460e5046a84043f7b8193feb2ece19d0",setValue:b=>{i("permission",b)},acceptedUser:l,validateUser:d,workspaceId:t})]}),F.jsxs("div",{className:"mb-16",children:[F.jsx("p",{className:"f-w-600 f-14 txt-black2 mb-6",children:"Required Columns"}),F.jsx(h9,{defaultValue:a("requiredColumns"),options:w,setValue:b=>{i("requiredColumns",b)}})]}),F.jsxs("div",{children:[F.jsx("div",{className:"d-flex align-center justify-between",children:F.jsx("p",{className:"f-w-600 f-14 txt-black2",children:"Condition"})}),F.jsx(X4,{defaultValue:a("condition"),setValue:b=>{i("condition",b)}})]})]})}),F.jsxs("div",{className:"d-flex justify-end",children:[F.jsx(tr.Button,{variant:"outlined",color:"inherit",className:"mr-10",onClick:()=>e({id:"",type:"config"}),children:"Cancel"}),F.jsx(tr.Button,{variant:"outlined",color:"primary",onClick:()=>{o({id:r.id,data:{...r.data,...a()}}),e({id:"",type:"config"})},children:"Update"})]})]})})};var pl={},Lm;function u9(){if(Lm)return pl;Lm=1;var r=Yo();Object.defineProperty(pl,"__esModule",{value:!0}),pl.default=void 0;var o=r(ue()),e=Jo();return pl.default=(0,o.default)((0,e.jsx)("path",{d:"m19 15-1.41-1.41L13 18.17V2h-2v16.17l-4.59-4.59L5 15l7 7z"}),"South"),pl}var F9=u9();const zm=Io(F9);var fl={},Vm;function A9(){if(Vm)return fl;Vm=1;var r=Yo();Object.defineProperty(fl,"__esModule",{value:!0}),fl.default=void 0;var o=r(ue()),e=Jo();return fl.default=(0,o.default)((0,e.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),fl}var y9=A9();const E9=Io(y9);var hl={},Hm;function D9(){if(Hm)return hl;Hm=1;var r=Yo();Object.defineProperty(hl,"__esModule",{value:!0}),hl.default=void 0;var o=r(ue()),e=Jo();return hl.default=(0,o.default)((0,e.jsx)("path",{d:"M17.77 3.77 16 2 6 12l10 10 1.77-1.77L9.54 12z"}),"ArrowBackIosNew"),hl}var v9=D9();const qm=Io(v9);var ml={},Wm;function S9(){if(Wm)return ml;Wm=1;var r=Yo();Object.defineProperty(ml,"__esModule",{value:!0}),ml.default=void 0;var o=r(ue()),e=Jo();return ml.default=(0,o.default)((0,e.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),ml}var _9=S9();const C9=Io(_9);var kl={},Km;function B9(){if(Km)return kl;Km=1;var r=Yo();Object.defineProperty(kl,"__esModule",{value:!0}),kl.default=void 0;var o=r(ue()),e=Jo();return kl.default=(0,o.default)((0,e.jsx)("path",{d:"M12 6c3.79 0 7.17 2.13 8.82 5.5C19.17 14.87 15.79 17 12 17s-7.17-2.13-8.82-5.5C4.83 8.13 8.21 6 12 6m0-2C7 4 2.73 7.11 1 11.5 2.73 15.89 7 19 12 19s9.27-3.11 11-7.5C21.27 7.11 17 4 12 4m0 5c1.38 0 2.5 1.12 2.5 2.5S13.38 14 12 14s-2.5-1.12-2.5-2.5S10.62 9 12 9m0-2c-2.48 0-4.5 2.02-4.5 4.5S9.52 16 12 16s4.5-2.02 4.5-4.5S14.48 7 12 7"}),"VisibilityOutlined"),kl}var I9=B9();const T9=Io(I9),N9=({defaultValue:r,setValue:o,acceptedUser:e,col:d,exampleData:t})=>{const[l,i]=y.useState(r),[a,w]=y.useState(!1),b=d?.map(s=>s.field),n=y.useMemo(()=>{const s=new Map;return b?.forEach(p=>{if(p.dataType==="user"){const m=t[p.internalName],h=e.find(f=>f.id===m);s.set(p.internalName,h?.name??"")}else if(p.dataType==="collaborators"){const m=t[p.internalName]?.split(",");let h=[];m?.forEach(f=>{const k=e.find(x=>x.id===f);h=[...h,k?.name||""]}),s.set(p.internalName,h.join(","))}else s.set(p.internalName,t[p.internalName])}),s},[b,e]);return F.jsxs("div",{children:[F.jsx("div",{style:{textDecoration:"underline",textUnderlineOffset:"2px"},onClick:()=>{w(!0)},children:"Template"}),a?F.jsx(tr.ClickAwayListener,{onClickAway:()=>w(!1),children:F.jsx("div",{className:"w-100 d-flex align-center txt-black2 f-12 mb-8",children:F.jsxs("div",{className:"w-358px border-solid-lightblue1 radius-12 bg-white",children:[F.jsx("div",{className:"h-46px border-b-solid-popper-border tl-radius-10 tr-radius-10 px-10 d-flex align-center f-14 f-w-400",children:"Send Notification"}),F.jsxs("div",{className:"my-8 h-31px d-flex align-center px-6 f-12",children:[F.jsx("div",{className:"w-82px d-flex align-center justify-center ",children:"Templates :"}),F.jsx("div",{className:"radius-100 p-8 maxh-28px h-28px w-auto border-solid-popper-border ml-4",children:"Reminder"}),F.jsx("div",{className:"radius-100 p-8 maxh-28px h-28px w-auto border-solid-popper-border ml-4",children:"Status Update"}),F.jsx("div",{className:"radius-100 p-8 maxh-28px h-28px w-auto border-solid-popper-border ml-4",children:"Deadline Alert"})]}),F.jsxs("div",{className:"h-151px px-12 mb-8",children:[F.jsx("div",{className:"h-31px f-w-600 f-12 d-flex align-center",children:"Message"}),F.jsx(tr.TextField,{placeholder:"Type your message here...",className:"f-12",multiline:!0,rows:4,fullWidth:!0,variant:"outlined",value:l,onChange:s=>{i(s.target.value)}})]}),F.jsx("div",{style:{gap:"4px"},className:"px-12 py-8 d-flex flex-wrap mb-8",children:b?.map(s=>F.jsx("div",{className:"radius-100 p-8 maxh-28px h-28px w-auto border-solid-popper-border ml-4 f-12",onClick:()=>{i(p=>p+`{${s.internalName}}`)},children:s.name}))}),F.jsx("div",{className:"p-12 mb-8",children:F.jsxs("div",{className:"h-160px radius-8 border-solid-lightblue1 bg-lightblue3 px-8 d-flex flex-column pb-8",children:[F.jsxs("div",{className:"h-31px d-flex align-center",children:[F.jsx(T9,{className:"f-12"}),F.jsx("p",{className:"ml-4 f-12 ",children:"Preview"})]}),F.jsx("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},className:"border-solid-lightblue1 h-100 flex-1 bg-white radius-4 p-8",children:l?.replace(/\{(\w+)\}/g,(s,p)=>n.get(p))})]})}),F.jsxs("div",{className:"bl-radius-10 br-radius-10 h-56px border-t-solid-popper-border d-flex justify-end px-12 align-center",children:[F.jsx(tr.Button,{variant:"outlined",color:"inherit",className:"mr-10 h-31px radius-8",onClick:()=>{w(!1)},children:"Cancel"}),F.jsx(tr.Button,{variant:"outlined",color:"primary",className:"h-31px radius-8",onClick:()=>{o(l),w(!1)},children:"Done"})]})]})})}):F.jsx(F.Fragment,{})]})},P9={};function O9(r,o){switch(o.type){case"ADD_OR_UPDATE":return{...r,[o.key]:o.value};case"DELETE":const e={...r};return delete e[o.key],e;default:return r}}const R9=({datasetId:r,workspaceId:o,targetWorkspaceId:e,autoIndex:d,segmentIndex:t,setValue:l,defaultValue:i})=>{const{mappingField:a,targetWork:w}=i,[b,n]=y.useState(null),[s,p]=y.useReducer(O9,a??P9),[m,h]=y.useState(!1);y.useEffect(()=>{n(w)},[a,w]);const{data:f}=Jr.useQuery(a9,{variables:{input:{workspaceId:Number(e)}},fetchPolicy:"network-only",client:Y4}),{data:k}=Jr.useQuery(Om,{variables:{input:{workspaceId:Number(o),datasetId:r}},fetchPolicy:"network-only",client:Y4}),{data:x}=Jr.useQuery(Om,{variables:{input:{workspaceId:Number(e),datasetId:b}},fetchPolicy:"network-only",client:Y4,skip:!b}),c=f?.getDataset?.filter(A=>A.id!==r)??[];return F.jsxs("div",{children:[F.jsx(tr.FormControl,{variant:"standard",sx:{width:"auto"},className:"mx-8",children:F.jsx(tr.Select,{value:b,IconComponent:()=>null,sx:{minWidth:30,padding:0,"& .MuiSelect-select":{padding:"0 !important",paddingRight:"0 !important"},"& .MuiInputBase-input":{padding:"0 !important",paddingRight:"0 !important"}},children:c?.map(A=>F.jsx(tr.MenuItem,{value:A.id,onClick:()=>{n(A.id),h(!0)},children:A.name},A.id))},`${d}_${t}`)}),m?F.jsx(F.Fragment,{children:F.jsx(tr.ClickAwayListener,{onClickAway:()=>{},children:F.jsx("div",{className:"w-100 d-flex align-center mt-8",children:F.jsxs("div",{className:"w-358px border-solid-lightblue1 radius-8 bg-white h-367px",children:[F.jsx("div",{className:"border-b-solid-lightblue1 d-flex align-center px-10 txt-black2 h-46px",children:"Map Source to Destination"}),F.jsx("div",{className:"overflow-auto flex-1 h-264px",children:k?.getField?.filter(A=>!["created_on","updated_on"].includes(A.fieldInternalName))?.map(A=>{const u=x?.getField?.filter(D=>A.dataType===D.dataType&&!Object.values(s).includes(D.fieldInternalName)&&!["created_on","updated_on"].includes(A.fieldInternalName)&&A.isAssociatedField===D.isAssociatedField)||[],g=x?.getField?.find(D=>D.fieldInternalName===s[A.fieldInternalName]),B=g?[...u,g]:u;return F.jsxs("div",{className:"d-flex align-center h-52px",children:[F.jsx("div",{className:"txt-brown-dark1 f-12 f-w-600 text-truncate pl-16 w-200px",children:A.fieldDisplayName}),F.jsx("div",{className:"flex-1 d-flex align-center",children:B?.length||A.fieldInternalName in s?F.jsx(tr.Select,{className:"w-115px h-40px radius-8 f-10 p-0",defaultValue:s[A?.fieldInternalName]??null,children:B?.map(D=>F.jsx(tr.MenuItem,{value:D.fieldInternalName,onClick:()=>{p({type:"ADD_OR_UPDATE",key:A.fieldInternalName,value:D.fieldInternalName})},children:D.fieldDisplayName},D.id))}):F.jsx("div",{className:"w-115px h-40px radius-8 border-solid-red1 bg-lightred txt-red1 d-flex align-center justify-center f-10 f-w-400",children:"No field to show"})})]})})}),F.jsxs("div",{className:"bl-radius-10 br-radius-10 h-56px border-t-solid-popper-border d-flex justify-end px-12 align-center",children:[F.jsx(tr.Button,{variant:"outlined",color:"inherit",className:"mr-10 h-31px radius-8",onClick:()=>{h(!1)},children:"Cancel"}),F.jsx(tr.Button,{variant:"outlined",color:"primary",className:"h-31px radius-8",onClick:()=>{l({sourceWork:r,targetWork:b,mappingField:s}),h(!1)},children:"Done"})]})]})})})}):F.jsx(F.Fragment,{})]})},Z4=y.createContext(null),M9=({defaultValue:r,setValue:o})=>{const{validateUser:e}=y.useContext(Z4),{data:d}=Jr.useQuery(w9,{variables:{input:{userId:e.id,orgId:e?.organisation?.id}},fetchPolicy:"network-only",client:Pm}),t=d?.getWorkspaceList;return F.jsx("div",{children:F.jsx(tr.Select,{className:"w-115px h-40px radius-8 f-10 p-0",defaultValue:r,children:t?.map(l=>F.jsx(tr.MenuItem,{value:l.id,onClick:()=>{o(l.id)},children:l.name},l.id))})})},Ym=({defaultValue:r,setValue:o,isDisable:e=!1,col:d,datasetId:t,workspaceId:l,acceptedUser:i,validateUser:a,exampleData:w})=>{const[b,n]=y.useState([]),[s,p]=y.useState(!0);y.useEffect(()=>{n(r)},[r]);const m=(x,c)=>{p(!1),n(A=>[...A,x])},h=x=>{const c=b.filter((A,u)=>u!==x);n(c),o(c)},f=(x,c,A)=>{const u=b.map((g,B)=>{if(B!==x)return g;const D=g.segments[c],v=D.valueType==="field",_=v?D.childSegments||[]:[],T=g.segments.map($=>{if($.segmentsId===D.segmentsId)if(v){const H=d.find(R=>R.field.id===A);return{...$,datasetId:H?.datasetId,datasetName:H?.datasetName,fieldType:H?.field.dataType,property:H?.field?.internalName,isAssociate:H?.field?.isAssociated,value:A}}else return{...$,value:A};if(v&&_.includes($.segmentsId)){const H=d.find(R=>R.field.id===A);return{...$,type:["drop-down"].includes(H?.field?.dataType)?"dropdown":"input",value:"",valueType:"field-options"}}return $});return{...g,segments:T}});o(u),n(u)},k=({optionType:x,valueType:c,fieldId:A})=>{const u=d?.map(g=>g.field);if(c==="field")return u.map(g=>({id:g.id,displayName:g.name,internalName:g.internalName}));if(c==="field-options")return u.find(B=>B.id===A)?.value?.map(B=>({id:B.key,displayName:B.value}));if(c==="users")return u.filter(g=>["user","collaborators"].includes(g.dataType)).map(g=>({id:g.internalName,displayName:g.name,internalName:g.internalName}))};return F.jsxs(F.Fragment,{children:[F.jsx("div",{children:b?.map((x,c)=>F.jsxs("div",{className:"d-flex hide-icon",children:[F.jsxs("div",{className:"f-w-400 f-14 txt-black2 d-flex flex-wrap flex-1 align-center",children:[c?F.jsx("span",{children:"And "}):F.jsx("span",{children:"Then "}),x.segments.map((A,u)=>{if(A.type==="text")return F.jsxs("span",{className:"ml-2",children:[" ",A.value," "]},u);if(A.type==="input")return F.jsx(tr.TextField,{id:"standard-basic",variant:"standard",className:"mx-8",disabled:e,defaultValue:A.value,type:A.valueType,onChange:g=>f(c,u,g.target.value),sx:{margin:0,maxWidth:100,padding:0,"& .MuiInputBase-input":{padding:"0 !important",paddingRight:"0 !important"},"& .MuiInputBase-root":{margin:0}}});if(A.type==="dropdown")return F.jsx(tr.FormControl,{variant:"standard",sx:{width:"auto"},className:"mx-8",children:F.jsx(tr.Select,{IconComponent:()=>null,value:A.value,disabled:e,sx:{minWidth:30,padding:0,"& .MuiSelect-select":{padding:"0 !important",paddingRight:"0 !important"},"& .MuiInputBase-input":{padding:"0 !important",paddingRight:"0 !important"}},onChange:g=>f(c,u,g.target.value),children:k({optionType:A.optionType,valueType:A.valueType,fieldId:x?.segments?.[A.mapSegmentsId]?.value})?.map(g=>F.jsx(tr.MenuItem,{value:g.id,children:g.displayName},g.id))},`${c}_${u}`)});if(A.type==="user")return F.jsx(Mm,{selectedAssignees:A.value,setValue:g=>{f(c,u,g)},datasetId:t,isForNotification:!0,acceptedUser:i,validateUser:a,workspaceId:l});if(A.type==="notification")return F.jsx(N9,{defaultValue:A.value,setValue:g=>{f(c,u,g)},acceptedUser:i,col:d,exampleData:w});if(A.type==="workspace")return F.jsx("div",{children:F.jsx(M9,{defaultValue:A.value,setValue:g=>{f(c,u,g)}})});if(A.type==="moveRecordToOtherWork"){let g=b[c]?.segments[A.mapSegmentsId]?.value;return F.jsx(R9,{defaultValue:A.value,datasetId:t,workspaceId:l,targetWorkspaceId:g??l,autoIndex:c,segmentIndex:u,setValue:B=>{f(c,u,B)}})}return null})]}),b.length>1?F.jsx("img",{src:"/delete.svg",className:"hide cursor-pointer",onClick:()=>{h(c)}}):F.jsx(F.Fragment,{}),F.jsx("div",{children:!e&&b.length-1===c?F.jsx(F.Fragment,{children:F.jsx(jm,{className:"f-w-400 f-14 txt-black2 cursor-pointer",onClick:()=>{p(!0)}})}):F.jsx(F.Fragment,{})})]},c))}),!e&&s?F.jsx(F.Fragment,{children:F.jsx(tr.FormControl,{variant:"standard",sx:{width:"auto"},className:"mx-8",children:F.jsx(tr.Select,{labelId:"demo-simple-select-standard-label",id:"demo-simple-select-standard",IconComponent:()=>null,sx:{minWidth:30,padding:0,"& .MuiSelect-select":{padding:"0 !important",paddingRight:"0 !important"},"& .MuiInputBase-input":{padding:"0 !important",paddingRight:"0 !important"}},displayEmpty:!0,renderValue:()=>F.jsx("div",{className:"f-w-400 f-14 txt-lightblack2",children:"Then make this happen"}),children:k9?.map(x=>F.jsx(tr.MenuItem,{onClick:()=>m(x.automation,x.key),children:x.displayAutomation},x.key))})})}):F.jsx(F.Fragment,{})]})},$9=({selectedId:r,setSelectedId:o,setSelectAutomation:e,setisCreateNewAutomation:d,workspaceId:t,isAutomation:l,selectFieldId:i,col:a,datasetId:w,validateUser:b,acceptedUser:n,exampleData:s,onClose:p})=>{const[m,h]=y.useState([]);y.useEffect(()=>{const c=async A=>{try{const u=await yA(A,t);h(u)}catch(u){console.error("Error fetching automation:",u)}};r?.id&&c(l?i:r?.id)},[r?.id,l,i]);const f=async({id:c,isActive:A})=>{await EA({id:c,isActive:A,workspaceId:t})},k=async({id:c})=>{await DA({id:c,workspaceId:t})},x={inputProps:{"aria-label":"Size switch demo"}};return F.jsx("div",{style:{top:0,right:0,height:"100%",width:"422px",background:"#fff",borderLeft:"1px solid #ccc"},children:F.jsxs("div",{className:"px-16 py-12 d-flex flex-column edge-container",children:[F.jsxs("div",{children:[F.jsxs("div",{className:"h-36px d-flex align-center f-w-600 f-14 txt-darkblue px-8 justify-between",children:[F.jsxs(F.Fragment,{children:[l?F.jsx(F.Fragment,{}):F.jsx(qm,{className:"mr-8 f-14 cursor-pointer",onClick:()=>o({id:"",type:"auto"})}),"Automation"]}),l?F.jsx(C9,{onClick:()=>p(),className:"cursor-pointer"}):F.jsx(F.Fragment,{})]}),F.jsx("div",{className:"border-solid-border1 my-12"})]}),F.jsxs("div",{className:"p-10 flex-1 overflow-auto",children:[F.jsx("div",{className:"mb-12 border-dashed-newborder h-48px radius-8 bg-blue-lighten9 d-flex align-center txt-darkblue cursor-pointer",onClick:()=>{d(!0)},children:F.jsxs("div",{className:"p-14 d-flex align-center",children:[F.jsx(E9,{}),F.jsx("p",{className:"f-w-600 f-14 ml-8",children:"New"})]})}),m?.data?.map(c=>F.jsxs("div",{className:"border-solid-input-border radius-12 px-12 py-10 d-flex mb-12 align-start",children:[F.jsxs("div",{className:"flex-1",onClick:()=>{e(c)},children:[F.jsx(X4,{defaultValue:c.condition,setValue:A=>{},isDisable:!0,col:a,isAutomation:!1,filedId:i,islistpage:!0}),F.jsx("div",{children:F.jsx(zm,{className:"my-8"})}),F.jsx(Ym,{defaultValue:c.automation,setValue:A=>{},isDisable:!0,col:a,datasetId:w,workspaceId:t,acceptedUser:n,validateUser:b,exampleData:s})]}),F.jsx(tr.Switch,{...x,defaultChecked:c.isActive,onChange:A=>{f({id:c.id,isActive:A.target.checked})}}),F.jsx("img",{src:"/delete.svg",onClick:()=>{k({id:c.id})}})]}))]})]})})},U9=({editEdgeData:r,setSelectedId:o,selectAutomation:e,isCreateNewAutomation:d,backTolistAutomaion:t,acceptedUser:l,selectFieldId:i,validateUser:a,workspaceId:w,col:b,datasetId:n,isAutomation:s,exampleData:p})=>{const{setValue:m,watch:h,getValues:f}=nb.useForm({defaultValues:{condition:{id:"",blocks:[]},automation:[]}});y.useEffect(()=>{m("automation",e.automation??[]),m("condition",e.condition??{id:"",blocks:[]})},[e.id]),console.log("condition",h("condition"));const k=async()=>{const x=h(),c=x.automation?.map(A=>{switch(A.key){case"changes_field_value":const u=A.segments?.find(E=>E.valueType==="field"),g=A.segments[u?.childSegments?.[0]];return{targetWorkspaceId:w,targetFieldId:u.value,actionType:Gt.UPDATE_FIELD,content:{propertyData:[{datasetId:u.datasetId,datasetName:u.datasetName,isAssociate:u.isAssociate,property:u.property,fieldType:u.fieldType,value:g.value,setValue:g.value}],datasetId:u.datasetId,datasetName:u.datasetName}};case"send_notification":const B=A.segments?.find(E=>E.valueType==="user-notification"),D=A.segments[B?.childSegments?.[0]],v=E=>E.map(C=>{const U=l.find(V=>V.id===C);return{id:U?.id,email:U?.email}});return{targetWorkspaceId:w,targetFieldId:"",actionType:Gt.NOTIFY,content:{isDeleted:!1,isActive:!0,workspaceId:w,senderEmail:a.email,senderId:a.id,notificationType:"push",notificationTitle:"Automation",notificationDescription:D.value,notificationMetadata:{},isRead:!1,receiverDetails:v(B.value)}};case"move_to_other_work":let _=A.segments?.find(E=>E.valueType==="moveRecordToOtherWork");return{targetWorkspaceId:w,targetFieldId:"",actionType:Gt.MOVE_RECORD,content:{..._?.value}};case"copy_to_other_workspace_work":let T=A.segments?.find(E=>E.valueType==="workspace"),$=A.segments?.find(E=>E.valueType==="moveRecordToOtherWork");return{targetWorkspaceId:T?.value??w,targetFieldId:"",actionType:Gt.COPY_RECORD_TO_OTHER_WORKSPACE,content:{...$?.value}};case"send_notification_to_field":const H=A.segments?.find(E=>E.valueType==="users"),R=A.segments[H?.childSegments?.[0]];return{targetWorkspaceId:w,targetFieldId:"",actionType:Gt.NOTIFY,content:{isDeleted:!1,isActive:!0,workspaceId:w,senderEmail:a.email,senderId:a.id,notificationType:"push",notificationTitle:"Automation",notificationDescription:R.value,notificationMetadata:{},isRead:!1,receiverDetails:[],selectField:H.value}}}});d?await FA({workspaceId:w+"",fieldId:i,from:s?"":r?.source,to:r?.target,workflowSegId:s?i:r?.id,condition:x.condition,automation:x.automation,automationAction:c,isAutomation:s}):await AA({id:e.id,condition:x.condition,automation:x.automation,automationAction:c,workspaceId:w+"",isAutomation:s})};return F.jsx("div",{style:{position:s?"relative":"absolute",top:s?0:56,right:0,height:"644px",maxHeight:"704px",width:"420px",background:"#fff",borderLeft:"1px solid #ccc",zIndex:1e3},children:F.jsxs("div",{className:"px-16 py-12 d-flex flex-column edge-container-properties maxh-703px",children:[F.jsxs("div",{children:[F.jsxs("div",{className:"h-36px d-flex align-center f-w-600 f-14 txt-darkblue px-8",children:[F.jsx(qm,{className:"mr-8 f-14 cursor-pointer",onClick:()=>t()}),"Properties"]}),F.jsx("div",{className:"border-solid-border1 my-12"})]}),F.jsxs("div",{className:"flex-1 overflow-auto hide-scroll mb-",children:[F.jsx(X4,{defaultValue:h("condition"),setValue:x=>{m("condition",x)},col:b,isAutomation:s,filedId:i}),F.jsx("div",{children:F.jsx(zm,{className:"my-8"})}),F.jsx(Ym,{defaultValue:h("automation"),setValue:x=>{m("automation",x)},col:b,datasetId:n,workspaceId:w,validateUser:a,acceptedUser:l,exampleData:p})]}),F.jsxs("div",{className:"d-flex justify-end",children:[F.jsx(tr.Button,{variant:"outlined",color:"inherit",className:"mr-10",onClick:()=>t(),children:"Cancel"}),F.jsx(tr.Button,{variant:"outlined",color:"primary",onClick:()=>{t(),k()},children:"Update"})]})]})})},Gm=({editEdgeData:r,selectedId:o,setSelectedId:e,acceptedUser:d,selectFieldId:t,validateUser:l,workspaceId:i,col:a,datasetId:w,isAutomation:b,exampleData:n,onClose:s})=>{const[p,m]=y.useState({}),[h,f]=y.useState(!1),k=()=>{m({}),f(!1)};return Rm(p)&&!h?F.jsx($9,{selectedId:o,setSelectedId:e,setSelectAutomation:m,setisCreateNewAutomation:f,workspaceId:i,isAutomation:b,selectFieldId:t,col:a,datasetId:w,acceptedUser:d,validateUser:l,exampleData:n,onClose:s}):F.jsx(U9,{editEdgeData:r,selectAutomation:p,setSelectedId:e,isCreateNewAutomation:h,backTolistAutomaion:k,acceptedUser:d,selectFieldId:t,validateUser:l,workspaceId:i,col:a,datasetId:w,isAutomation:b,exampleData:n})},j9=({selectedId:r,editEdgeData:o,updateEdgeData:e,setSelectedId:d})=>{const{acceptedUser:t,selectFieldId:l,validateUser:i,workspaceId:a,col:w,datasetId:b,exampleData:n}=y.useContext(Z4);return r.type===Df.Auto?F.jsx(Gm,{editEdgeData:o,selectedId:r,setSelectedId:d,acceptedUser:t,selectFieldId:l,validateUser:i,workspaceId:a,col:w,datasetId:b,isAutomation:!1,exampleData:n}):F.jsx(c9,{edgeData:o,updateEdgeData:e,setSelectedId:d,validateUser:i,workspaceId:a,acceptedUser:t})},L9=({edges:r,updateEdgeData:o,saveToBackend:e})=>{const[d,t]=y.useState({id:"",type:Df.Config});return F.jsx("div",{children:d.id?F.jsx(j9,{selectedId:d,updateEdgeData:o,editEdgeData:r?.find(l=>l.id===d.id),setSelectedId:t}):F.jsx(PA,{edges:r,setSelectedId:t,saveToBackend:e})})},z9=({children:r,col:o,selectFieldId:e,validateUser:d,workspaceId:t,exampleData:l,acceptedUser:i,datasetId:a})=>F.jsx(Z4.Provider,{value:{col:o,selectFieldId:e,validateUser:d,workspaceId:t,exampleData:l,acceptedUser:i,datasetId:a},children:r}),V9={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:400,bgcolor:"background.paper",borderRadius:2,boxShadow:"24",p:4,background:"linear-gradient(101.49deg, #F8FDFF 11.98%, #FBF2FB 119.18%)",border:"1px solid #EAEFF4",outline:"none"},H9=({fieldId:r,col:o,validateUser:e,workspaceId:d,exampleData:t,acceptedUser:l,datasetId:i,onClose:a})=>{const w=o?.find(c=>c.field.id===r),b=sp(w.field.value),[n,s,p]=Bg(b),[m,h,f]=Ig([]);y.useEffect(()=>{(async A=>{try{const u=await vA({fieldId:A,workspaceId:d}),g=u.data.workflowDefinition.nodes,B=u.data.workflowDefinition.edges,{onlyInNode:D,onlyInOption:v}=q5(u.data.workflowDefinition.nodes,w.field.value);let _=g.filter($=>!D.includes($.id));const T=B.filter($=>!(D.includes($.source)||D.includes($.target)));if(v.length){const $=sp(v,v.length+2);_=[..._,...$]}s(_),h(T)}catch(u){console.error("Error fetching automation:",u)}})(r)},[r,JSON.stringify(w)]);const k=({id:c,data:A})=>{h(u=>u?.map(g=>(g.id===c&&(g.data=A),g)))},x=async()=>{const c=H5(m);await uA({workspaceId:d,workflow:{nodes:n,edges:m,workflow:c},fieldId:r})};return F.jsx(tr.Modal,{open:!0,onClose:()=>a,children:F.jsx(z9,{col:o,selectFieldId:r,validateUser:e,workspaceId:d,exampleData:t,acceptedUser:l,datasetId:i,children:F.jsx("div",{className:"workflow-we3434",children:F.jsxs("div",{className:"w-1225px h-703px border-solid-lightblue1 d-flex flex-column",style:V9,children:[F.jsxs("div",{className:"h-56px border-b-solid-border d-flex align-center justify-between px-20",children:[F.jsx("div",{className:"f-w-600 f-18 px-12",children:"Workflow"}),F.jsxs("div",{className:"d-flex align-center px-12",children:[F.jsx("div",{className:"border-solid-ligntbrown h-14px mr-8"}),F.jsx(V5,{className:"h-24px w-24px txt-lightblack3",onClick:()=>a()})]})]}),F.jsxs("div",{className:"flex-1 d-flex",children:[F.jsx(lw,{children:F.jsx(TA,{nodes:n,edges:m,setEdges:h,onNodesChange:p,onEdgesChange:f})}),F.jsx(L9,{edges:m,updateEdgeData:k,saveToBackend:x})]})]})})})})},q9=({acceptedUser:r,col:o,datasetId:e,exampleData:d,fieldId:t,onClose:l,validateUser:i,workspaceId:a})=>F.jsx("div",{className:"h-560px workflow-we3434",children:F.jsx(Gm,{editEdgeData:null,selectedId:{id:t,type:"auto"},setSelectedId:()=>{},acceptedUser:r,workspaceId:a,validateUser:i,selectFieldId:t,col:o,datasetId:e,isAutomation:!0,exampleData:d,onClose:l})});uo.FieldAutomationModal=q9,uo.ReactFlowModal=H9,Object.defineProperty(uo,Symbol.toStringTag,{value:"Module"})});
|