var m=Object.defineProperty,y=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var f=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var o=(i,t,e)=>t in i?m(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,a=(i,t)=>{for(var e in t||(t={}))k.call(t,e)&&o(i,e,t[e]);if(f)for(var e of f(t))b.call(t,e)&&o(i,e,t[e]);return i},l=(i,t)=>y(i,P(t));import{_ as c,b as _,c as u}from"./bi.394.85.js";const w=(i,t,e)=>{const r=a({},t),{name:s}=i.target;i.target.value!==""?r[s]=i.target.value:delete r[s],e(a({},r))},M=i=>{let t=[];i.actionName==="company"?t=i==null?void 0:i.companyFields:i.actionName==="person"?t=i==null?void 0:i.personFields:i.actionName==="opportunity"?t=i==null?void 0:i.opportunityFields:i.actionName==="task"&&(t=i==null?void 0:i.taskFields);const e=t==null?void 0:t.filter(r=>r.required===!0);return e.length>0?e.map(r=>({formField:"",coppercrmFormField:r.key})):[{formField:"",coppercrmFormField:""}]},A=i=>!((i!=null&&i.field_map?i.field_map.filter(e=>!e.formField||!e.coppercrmFormField||e.formField==="custom"&&!e.customValue||e.coppercrmFormField==="customFieldKey"&&!e.customFieldKey):[]).length>0),R=(i,t,e,r,s,n)=>{if(!i.api_email||!i.api_key){e({api_email:i.api_email?"":c("API Email can't be empty","bit-integrations"),api_key:i.api_key?"":c("Api Key can't be empty","bit-integrations")});return}e({}),n(l(a({},s),{auth:!0}));const h={api_key:i.api_key,api_email:i.api_email};_(h,"coppercrm_authentication").then(p=>{if(p&&p.success){r(!0),n(l(a({},s),{auth:!1})),u.success(c("Authorized successfully","bit-integrations"));return}n(l(a({},s),{auth:!1})),u.error(c("Authorized failed, Please enter valid api_email name & API key","bit-integrations"))})},g=(i,t,e)=>{e(l(a({},e),{customFields:!0}));const r={api_key:i.api_key,api_email:i.api_email,action:i.actionName};_(r,"coppercrm_fetch_custom_fields").then(s=>{if(s&&s.success){const n=a({},i);s.data&&(n.customFields=s.data),t(n),e(l(a({},e),{customFields:!1})),s.data?u.success(c("Custom fields also fetched successfully","bit-integrations")):u.error(c("No custom fields found","bit-integrations"));return}e(l(a({},e),{customFields:!1})),u.error(c("Custom fields fetching failed","bit-integrations"))})},q=(i,t,e)=>{e(l(a({},e),{opportunities:!0}));const r={api_key:i.api_key,api_email:i.api_email};_(r,"coppercrm_fetch_all_opportunities").then(s=>{if(s&&s.success){const n=a({},i);s.data&&(n.opportunities=s.data),t(n),e(l(a({},e),{opportunities:!1})),u.success(c("Opportunities fetched successfully","bit-integrations"));return}e(l(a({},e),{opportunities:!1})),u.error(c("Opportunities fetching failed","bit-integrations"))})},N=(i,t,e)=>{e(l(a({},e),{owners:!0}));const r={api_key:i.api_key,api_email:i.api_email};_(r,"coppercrm_fetch_all_owners").then(s=>{if(s&&s.success){const n=a({},i);s.data&&(n.owners=s.data),t(n),e(l(a({},e),{owners:!1})),u.success(c("Owners fetched successfully","bit-integrations"));return}e(l(a({},e),{owners:!1})),u.error(c("Owners fetching failed","bit-integrations"))})},S=(i,t,e)=>{e(l(a({},e),{companies:!0}));const r={api_key:i.api_key,api_email:i.api_email};_(r,"coppercrm_fetch_all_companies").then(s=>{if(s&&s.success){const n=a({},i);s.data&&(n.companies=s.data),t(n),e(l(a({},e),{companies:!1})),u.success(c("Companies fetched successfully","bit-integrations"));return}e(l(a({},e),{companies:!1})),u.error(c("Companies fetching failed","bit-integrations"))})},O=(i,t,e)=>{e(l(a({},e),{pipelineStages:!0}));const r={api_key:i.api_key,api_email:i.api_email,action_name:i.actionName};_(r,"coppercrm_fetch_all_pipelineStages").then(s=>{if(s&&s.success){const n=a({},i);s.data&&(n.pipelineStages=s.data),t(n),e(l(a({},e),{pipelineStages:!1})),u.success(c("PipelineStages fetched successfully","bit-integrations"));return}e(l(a({},e),{pipelineStages:!1})),u.error(c("PipelineStages fetching failed","bit-integrations"))})},v=(i,t,e)=>{e(l(a({},e),{CRMPeoples:!0}));const r={api_key:i.api_key,api_email:i.api_email,action_name:i.actionName};_(r,"coppercrm_fetch_all_CRMPeoples").then(s=>{if(s&&s.success){const n=a({},i);s.data&&(n.CRMPeoples=s.data),t(n),e(l(a({},e),{CRMPeoples:!1})),u.success(c("Peoples fetched successfully","bit-integrations"));return}e(l(a({},e),{CRMPeoples:!1})),u.error(c("Peoples fetching failed","bit-integrations"))})},I=(i,t,e)=>{e(l(a({},e),{CRMPipelines:!0}));const r={api_key:i.api_key,api_email:i.api_email};_(r,"coppercrm_fetch_all_CRMPipelines").then(s=>{if(s&&s.success){const n=a({},i);s.data&&(n.CRMPipelines=s.data),t(n),e(l(a({},e),{CRMPipelines:!1})),u.success(c("Pipelines fetched successfully","bit-integrations"));return}e(l(a({},e),{CRMPipelines:!1})),u.error(c("Pipelines fetching failed","bit-integrations"))})};export{N as a,S as b,A as c,O as d,M as e,v as f,q as g,w as h,I as i,g as j,R as k};
