import{aa as s,ab as c}from"./_applist-tangy-colts-beg-36.js";import{_ as o}from"./main-tangy-colts-beg.js";import{s as m}from"./machine.-tangy-colts-beg-869.js";import{h as d,c as r}from"./suitedas-tangy-colts-beg-185.js";import{s as u}from"./suitedas-tangy-colts-beg-927.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(n,e){return this.cache.has(n)?this.cache.get(n):(this.cache.set(n,e),e)}};const C=["name","primaryContact:first_name","primaryContact:last_name","primaryContact:email"],b=s(({helpers:n})=>({states:{components:[r(n),{componentName:n.componentName.select,fieldType:"config",id:"role-id",label:o("Select Role"),onChange:"SET_ROLE_NAME",optionFilterProp:"label",options:[{label:o("Lead"),value:"Lead"},{label:o("Client"),value:"Client"},{label:o("Prospect"),value:"Prospect"}],placeholder:o("Select a Role"),render:"IF_CONNECTION_SELECTED",required:!0,showSearch:!0,value:"Lead"},{componentName:n.componentName.select,fieldType:"config",id:"check-contact",label:o("Select To Create Contact if not Exists"),onChange:"SET_EXIST_CONTACT",options:[{label:o("Yes"),value:"true"},{label:o("No"),value:"false"}],placeholder:o("Select To Create Contact if not Exists"),render:"IF_CONNECTION_SELECTED",required:!0,value:"true"},{addItemButtonLabel:"Add Field",componentName:n.componentName.repeaterField,fieldsMetaData:[{componentName:n.componentName.select,label:o("Field"),name:"suiteDashField",options:u,showSearch:!0,style:{width:150},value:""},{componentName:n.componentName.mixInput,label:o("Value"),name:"value",value:[],wrapperClassName:"w-100"}],id:"companies-list",label:o("Contact Field Map"),nonRemovableRows:[0],onChange:"ON_FIELD_MAP_CHANGE",path:"companies",render:"IF_CONNECTION_SELECTED",value:[[{disabled:!0,name:"suiteDashField",value:"name"},{name:"value",value:[]}]]}]},actions:{SET_CONNECTION:async({$:e,e:t})=>{e.setThisComponent(a=>{a.value=t}),e.setDb(a=>{a.connectionId=t})},IF_CONNECTION_SELECTED:({$:e})=>{var t;return c((t=e.getComponent("connection-id"))==null?void 0:t.value)},ON_FIELD_MAP_CHANGE:async({$:e,e:t})=>{e.setThisComponent(a=>{a.value=t}),e.setDb(a=>{a.companies=t})},SET_ROLE_NAME:async({$:e,e:t})=>{e.setThisComponent(a=>{a.value=t}),e.setDb(a=>{a.roleId=t}),e.setComponent("companies-list",a=>{if(!e.util.isRepeaterFieldComponent(a))return;let l=C.map(i=>[{disabled:!0,name:"suiteDashField",value:i},{name:"value",value:[]}]);t==="Lead"&&(l=[[{disabled:!0,name:"suiteDashField",value:"name"},{name:"value",value:[]}]]),a.nonRemovableRows=t==="Lead"?[0]:[0,1,2,3],a.value=l})},SET_EXIST_CONTACT:async({$:e,e:t})=>{e.setThisComponent(a=>{a.value=t}),e.setDb(a=>{a.checkContact=t})},CONNECTION_ADD_CHANGE:d,ON_MACHINE_LOAD:async({$:e})=>{m(e,[{db:"connectionId",id:"connection-id"},{db:"companies",id:"companies-list"},{db:"roleId",id:"role-id"},{db:"checkContact",id:"check-contact"}])}}}));export{b as default};
