var b=Object.defineProperty,k=Object.defineProperties;var p=Object.getOwnPropertyDescriptors;var f=Object.getOwnPropertySymbols;var g=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var m=(t,s,e)=>s in t?b(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e,i=(t,s)=>{for(var e in s||(s={}))g.call(s,e)&&m(t,e,s[e]);if(f)for(var e of f(s))A.call(s,e)&&m(t,e,s[e]);return t},r=(t,s)=>k(t,p(s));import{_ as o,b as F,z as d}from"./main.2.8.10.js";const P=(t,s,e)=>{const c=i({},s),{name:a}=t.target;t.target.value!==""?c[a]=t.target.value:delete c[a],e(i({},c))},v=t=>{const s=t==null?void 0:t.staticFields.filter(e=>e.required===!0);return s.length>0?s.map(e=>({formField:"",mailRelayFormField:e.key})):[{formField:"",mailRelayFormField:""}]},w=t=>!((t!=null&&t.field_map?t.field_map.filter(e=>!e.formField||!e.mailRelayFormField||!e.formField==="custom"&&!e.customValue):[]).length>0),G=(t,s,e,c,a,u,h)=>{if(!t.domain){e({domain:t.domain?"":o("Account Name can't be empty","bit-integrations")});return}if(!t.auth_token){e({auth_token:t.auth_token?"":o("Api Key can't be empty","bit-integrations")});return}e({}),h==="authentication"&&u(r(i({},a),{auth:!0})),h==="refreshCustomFields"&&u(r(i({},a),{customFields:!0}));const _={auth_token:t.auth_token,domain:t.domain};F(_,"mailRelay_authentication").then(n=>{if(n&&n.success){const l=i({},t);n.data&&(l.campaigns=n.data),s(l),c(!0),h==="authentication"?(n.data&&(l.customFields=n.data),u(r(i({},a),{auth:!1})),d.success(o("Authorized Successfully","bit-integrations"))):h==="refreshCustomFields"&&(n.data&&(l.customFields=n.data),u(r(i({},a),{customFields:!1})),d.success(o("Custom fields fectched successfully","bit-integrations")));return}u(r(i({},a),{auth:!1})),d.error(o("Authorized failed, Please enter valid domain name & API key","bit-integrations"))})},y=(t,s,e)=>{e(r(i({},e),{groups:!0}));const c={auth_token:t.auth_token,domain:t.domain};F(c,"mailRelay_fetch_all_groups").then(a=>{if(a&&a.success){const u=i({},t);a.data&&(u.groups=a.data),s(u),e(r(i({},e),{groups:!1})),d.success(o("Groups fetch successfully","bit-integrations"));return}e(r(i({},e),{groups:!1})),d.error(o("Groups fetch failed","bit-integrations"))})};export{v as a,w as c,y as g,P as h,G as m};
