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