var o=Object.defineProperty,F=Object.defineProperties;var b=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var g=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var m=(s,t,e)=>t in s?o(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,r=(s,t)=>{for(var e in t||(t={}))g.call(t,e)&&m(s,e,t[e]);if(d)for(var e of d(t))_.call(t,e)&&m(s,e,t[e]);return s},l=(s,t)=>F(s,b(t));import{_ as n,b as f,c as u,A as p}from"./bi.636.93.js";const M=(s,t,e)=>{const c=p(t,i=>{const{name:a}=s.target;s.target.value!==""?i[a]=s.target.value:delete i[a]});e(c)},k=s=>{const t=s==null?void 0:s.mailsterFields.filter(e=>e.required===!0);return t.length>0?t.map(e=>({formField:"",mailsterFormField:e.key})):[{formField:"",mailsterFormField:""}]},q=s=>!((s!=null&&s.field_map?s.field_map.filter(e=>!e.formField||!e.mailsterFormField||!e.formField==="custom"&&!e.customValue):[]).length>0),A=(s,t,e,c,i,a)=>{if(!s.name){e({name:s.name?"":n("Name can't be empty","bit-integrations")});return}a(l(r({},i),{auth:!0})),f({},"mailster_authentication").then(h=>{if(h.success){c(!0),u.success(n("Connected Successfully","bit-integrations")),a(l(r({},i),{auth:!1})),y(s,t,i,a);return}a(l(r({},i),{auth:!1})),u.error(n("Connection failed: install and active Mailster plugin first!","bit-integrations"))})},y=(s,t,e,c)=>{c(l(r({},e),{fields:!0})),f({},"mailster_fields").then(i=>{if(i.success&&i.data){const a=r({},s);a.mailsterFields=i.data,t(a),u.success(n("Fields fetched successfully.","bit-integrations")),c(l(r({},e),{fields:!1}));return}c(l(r({},e),{fields:!1})),u.error(n("Fields fetching failed!","bit-integrations"))})},x=(s,t,e,c)=>{c(l(r({},e),{lists:!0})),f({},"mailster_lists").then(i=>{if(i.success&&i.data){const a=r({},s);a.lists=i.data,t(a),u.success(n("Lists fetched successfully.","bit-integrations")),c(l(r({},e),{lists:!1}));return}c(l(r({},e),{lists:!1})),u.error(n("Lists fetching failed!","bit-integrations"))})},I=(s,t,e,c)=>{c(l(r({},e),{tags:!0})),f({},"mailster_tags").then(i=>{if(i.success&&i.data){const a=r({},s);a.tags=i.data,t(a),u.success(n("Tags fetched successfully.","bit-integrations")),c(l(r({},e),{tags:!1}));return}c(l(r({},e),{tags:!1})),u.error(n("Tags fetching failed!","bit-integrations"))})};export{I as a,y as b,q as c,A as d,k as g,M as h,x as m};
