var p=Object.defineProperty,_=Object.defineProperties;var y=Object.getOwnPropertyDescriptors;var m=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var F=(e,r,t)=>r in e?p(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,s=(e,r)=>{for(var t in r||(r={}))k.call(r,t)&&F(e,t,r[t]);if(m)for(var t of m(r))b.call(r,t)&&F(e,t,r[t]);return e},l=(e,r)=>_(e,y(r));import{_ as c,b as g,z as f}from"./main.2.8.10.js";const q=(e,r,t,o,i,u,d,n)=>{const a=s({},r),{name:h}=e.target;e.target.value!==""?a[h]=e.target.value:delete a[h],t(s({},a))},w=(e=[])=>{const r=e.filter(t=>t.required===!0);return r.length>0?r.map(t=>({formField:"",omniSendFormField:t.key})):[{formField:"",omniSendFormField:""}]},v=e=>!((e!=null&&e.field_map?e.field_map.filter(t=>!t.formField||!t.omniSendFormField||!t.formField==="custom"&&!t.customValue):[]).length>0),I=(e,r,t,o,i,u)=>{if(!e.api_key){t({api_key:e.api_key?"":c("API Key can't be empty","bit-integrations")});return}t({}),u(l(s({},i),{auth:!0}));const d={api_key:e.api_key};g(d,"Omnisend_authorization").then(n=>{if(n&&n.success){const a=s({},e);r(a),o(!0),u(l(s({},i),{auth:!1})),f.success(c("Authorized Successfully","bit-integrations"));return}u(l(s({},i),{auth:!1})),f.error(c("Authorized failed","bit-integrations"))})};export{I as a,v as c,w as g,q as h};
