var h=Object.defineProperty;var m=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable;var _=(e,i,t)=>i in e?h(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t,c=(e,i)=>{for(var t in i||(i={}))k.call(i,t)&&_(e,t,i[t]);if(m)for(var t of m(i))f.call(i,t)&&_(e,t,i[t]);return e};import{_ as u,c as b,z as d}from"./main-343.js";const M=(e,i,t,l,a)=>{const r=c({},i),{name:s}=e.target;e.target.value!==""?r[s]=e.target.value:delete r[s],r.mainAction==="2"&&q(r,t,l),t(c({},r))},q=(e,i,t)=>{t(!0);const l={access_token:e.access_token};b(l,"bitforms_sendfox_fetch_all_list").then(a=>{if(a&&a.success){const r=c({},e);r.default||(r.default={}),a.data&&(r.default.allLists=a.data.data),i(c({},r)),t(!1),d.success(u("Lists fetched successfully"));return}t(!1),d.error(u("Lists fetch failed. please try again"))}).catch(()=>t(!1))},L=(e,i,t,l,a)=>{if(!e.access_token){t({access_token:e.access_token?"":u("Access Token can't be empty")});return}t({}),a(!0);const r={access_token:e.access_token};b(r,"bitforms_sendFox_authorize").then(s=>{if(s&&s.success){const p=c({},e);i(p),l(!0),a(!1),d.success(u("Authorized successfully"));return}a(!1),d.error(u("Authorized failed"))})},v=e=>{const i=e==null?void 0:e.contactFields.filter(t=>t.required===!0);return i.length>0?i.map(t=>({formField:"",sendFoxFormField:t.key})):[{formField:"",sendFoxFormField:""}]},F=e=>!((e.field_map?e.field_map.find(l=>!l.formField||!l.sendFoxFormField):!1)||(e!=null&&e.field_map?e.field_map.filter(l=>{var a,r,s;return!l.formField&&l.sendFoxFormField&&((s=(r=(a=e==null?void 0:e.default)==null?void 0:a.allFields)==null?void 0:r[e.listId])==null?void 0:s.required.indexOf(l.sendFoxFormField))!==-1}):[]).length>0),U=e=>{const i=e==null?void 0:e.listFields.filter(t=>t.required===!0);return i.length>0?i.map(t=>({formField:"",sendFoxListFormField:t.key})):[{formField:"",sendFoxListFormField:""}]},g=e=>!((e!=null&&e.field_map_list?e.field_map_list.filter(t=>{var l,a,r;return!t.formField&&t.sendFoxListFormField&&((r=(a=(l=e==null?void 0:e.default)==null?void 0:l.allFields)==null?void 0:a[e.listId])==null?void 0:r.required.indexOf(t.sendFoxListFormField))!==-1}):[]).length>0),w=e=>{const i=e==null?void 0:e.unsubscribeFields.filter(t=>t.required===!0);return i.length>0?i.map(t=>({formField:"",sendFoxUnsubscribeFormField:t.key})):[{formField:"",sendFoxUnsubscribeFormField:""}]},A=e=>!((e!=null&&e.field_map_unsubscribe?e.field_map_unsubscribe.filter(t=>{var l,a,r;return!t.formField&&t.sendFoxUnsubscribeFormField&&((r=(a=(l=e==null?void 0:e.default)==null?void 0:l.allFields)==null?void 0:a[e.listId])==null?void 0:r.required.indexOf(t.sendFoxUnsubscribeFormField))!==-1}):[]).length>0),O=e=>e.mainAction==="1"?!g(e):e.mainAction==="2"?!F(e)||e.listId===void 0||e.listId==="":!A(e);export{M as a,U as b,w as c,q as f,v as g,L as h,O as i};
