var p=Object.defineProperty;var f=Object.getOwnPropertySymbols;var g=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var h=(e,t,s)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,d=(e,t)=>{for(var s in t||(t={}))g.call(t,s)&&h(e,s,t[s]);if(f)for(var s of f(t))w.call(t,s)&&h(e,s,t[s]);return e};import{_ as i,c as m,d as F}from"./main-40.js";const b=(e,t,s,l,c,n,r,a)=>{const o=d({},t),{name:u}=e.target;e.target.value!==""?o[u]=e.target.value:delete o[u],s(d({},o))},z=(e,t,s,l)=>{s(!0);const c={username:e.username,password:e.password},n=m(c,"bitforms_rapidmail_get_all_recipients").then(r=>{if(r&&r.success){const a=d({},e);return a.default||(a.default={}),r.data.recipientlists&&(a.default.recipientlists=r.data.recipientlists),t(d({},a)),s(!1),"Recipientlist refreshed successfully"}else return s(!1),"Recipientlist refresh failed. please try again"});F.promise(n,{success:r=>r,error:i("Error Occurred"),loading:i("Loading Recipientslist...")})},A=e=>{const t=e==null?void 0:e.recipientsFields.filter(s=>s.required===!0);return t.length>0?t.map(s=>({formField:"",rapidmailFormField:s.key})):[{formField:"",rapidmailFormField:""}]},R=e=>!((e!=null&&e.field_map?e.field_map.filter(s=>!s.formField||!s.rapidmailFormField||!s.formField==="custom"&&!s.customValue):[]).length>0),k=(e,t,s,l,c,n)=>{if(!e.username||!e.password){s({username:e.username?"":i("Username can't be empty"),password:e.password?"":i("Password can't be empty")});return}s({}),c(!0);const r={username:e.username,password:e.password};m(r,"bitforms_rapidmail_authorization").then(a=>a).then(a=>{if(a&&a.success){const o=d({},e);o.tokenDetails=a.data,t(o),l(!0),n({show:!0,msg:i("Authorized Successfully")})}else a&&a.data&&a.data.data||!a.success&&typeof a.data=="string"?n({show:!0,msg:`${i("Authorization failed Cause:")}${a.data.data||a.data}. ${i("please try again")}`}):n({show:!0,msg:i("Authorization failed. please try again")});c(!1)})};export{z as a,k as b,R as c,A as g,b as h};
