import{aa as p,ab as s}from"./_applist-tangy-colts-beg-36.js";import{_ as o}from"./main-tangy-colts-beg.js";import{s as d}from"./machine.-tangy-colts-beg-869.js";import{l as m,a as r,c as C}from"./hubspotc-tangy-colts-beg-518.js";import{a as l,h as E,c as u,b as c,d as i}from"./machineh-tangy-colts-beg-396.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};const O=p(({helpers:t})=>({states:{components:[u(t),{componentName:t.componentName.switch,fieldType:"config",helperText:o("Enable to update a company if it exists, or add a new one if it does not."),id:"update-company",label:o("Update Company If Exists"),onChange:"SET_UPDATE_COMPANY",render:"IF_CONNECTION_SELECTED",size:"small",value:!1},{allowClear:!0,componentName:t.componentName.select,fieldType:"config",id:"company-id",isLoadable:!0,label:o("Companies"),onChange:"SET_COMPANY",onLoadData:"ON_LOAD_COMPANY_DATA",onRefetch:"REFETCH_LIST",optionFilterProp:"label",options:[],placeholder:o("Select a Company"),render:"IF_UPDATE_SELECTED",required:!0,showSearch:!0,value:void 0},{allowClear:!0,componentName:t.componentName.select,id:"lead-status",label:o("Lead Status"),onChange:"SET_LEAD",optionFilterProp:"label",options:m,path:"hs_lead_status",placeholder:o("Select a Lead Status"),render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0},{allowClear:!0,componentName:t.componentName.select,id:"lifecycle-stage",label:o("Lifecycle Stage"),onChange:"SET_LIFECYCLE",optionFilterProp:"label",options:r,path:"lifecyclestage",placeholder:o("Select a Lifecycle Stage"),render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0},{allowClear:!0,componentName:t.componentName.select,id:"types-id",label:o("Types"),onChange:"SET_TYPES",optionFilterProp:"label",options:C,path:"type",placeholder:o("Select a Type"),render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0},{addItemButtonLabel:o("Add Company Fields"),componentName:t.componentName.repeaterField,direction:"horizontal",fieldsMetaData:[{componentName:t.componentName.select,label:o("Field"),name:"companyFields",optionFilterProp:"label",options:[],required:!0,showSearch:!0,style:{width:180},value:""},{componentName:t.componentName.mixInput,label:o("Value"),name:"value",required:!0,value:[],wrapperClassName:"w-100"}],id:"company-field-list",inputGroupProps:{label:o("Field #{COUNT}")},label:o("Company Fields"),onChange:"ON_COMPANY_FIELD_MAP",render:"IF_CONNECTION_SELECTED",value:[[{disabled:!0,name:"companyFields",value:"name"},{name:"value",value:[]}]]}]},actions:{CONNECTION_ADD_CHANGE:E,IF_CONNECTION_SELECTED:({$:e})=>{var a;return s((a=e.getComponent("connection-id"))==null?void 0:a.value)},IF_UPDATE_SELECTED:({$:e})=>{var a,n;if(((a=e.getComponent("update-company"))==null?void 0:a.value)===!0&&s((n=e.getComponent("connection-id"))==null?void 0:n.value))return!0},REFETCH_LIST:async({$:e})=>{await i(e)},ON_LOAD_COMPANY_DATA:async({$:e,e:a})=>{await i(e,a.count)},SET_CONNECTION:async({$:e,e:a})=>{e.setThisComponent(n=>{n.value=a}),e.setDb(n=>{n.connectionId=a}),await Promise.all([c(e),i(e)])},ON_COMPANY_FIELD_MAP:async({$:e,e:a})=>{e.setThisComponent(n=>{n.value=a}),e.setDb(n=>{n.otherFields=a}),await c(e)},SET_COMPANY:l("company"),SET_LEAD:l("leadStatus"),SET_LIFECYCLE:l("lifecycleStage"),SET_TYPES:l("types"),SET_UPDATE_COMPANY:l("updateCompany"),ON_MACHINE_LOAD:async({$:e})=>{var a;d(e,[{db:"connectionId",id:"connection-id"},{db:"companyFields",id:"company-field-list"},{db:"updateCompany",id:"update-company"},{db:"company",id:"company-id"},{db:"leadStatus",id:"lead-status"},{db:"lifecycleStage",id:"lifecycle-stage"},{db:"types",id:"types-id"}]),(a=e.db)!=null&&a.connectionId&&await Promise.all([c(e),i(e)])}}}));export{O as default};
