var p=Object.defineProperty;var c=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var n=(e,t,s)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,g=(e,t)=>{for(var s in t||(t={}))F.call(t,s)&&n(e,s,t[s]);if(c)for(var s of c(t))K.call(t,s)&&n(e,s,t[s]);return e};import{b as f,_ as l,s as d}from"./main.2.9.0.js";import{u as h}from"./Note.NSUdvR3c.js";const q=(e,t,s)=>{const r=g({},t);r.name=e.target.value,s(g({},r))},T=(e,t,s,r)=>{const m={api_secret:e.api_secret};f(m,"convertKit_forms").then(i=>{i&&i.success?i.data.convertKitForms?(t(u=>h(u,a=>{a.default||(a.default={}),a.default.convertKitForms=i.data.convertKitForms})),w(e,t,s,r),r({show:!0,msg:l("Convert Kit forms refreshed","bit-integrations")})):r({show:!0,msg:l("No Convert Kit forms found. Try changing the header row number or try again","bit-integrations")}):r({show:!0,msg:d(l("%s forms refresh failed. please try again","bit-integrations"),"Kit(ConvertKit)")}),s(!1)}).catch(()=>s(!1))},w=(e,t,s,r)=>{const m={api_secret:e.api_secret};f(m,"convertKit_tags").then(i=>{i&&i.success?i.data.convertKitTags?(t(u=>h(u,a=>{a.default||(a.default={}),a.default.convertKitTags=i.data.convertKitTags})),r({show:!0,msg:d(l("%s tags refreshed","bit-integrations"),"Kit(ConvertKit)")})):r({show:!0,msg:d(l("No %s tags found. Try changing the header row number or try again","bit-integrations"),"Kit(ConvertKit)")}):r({show:!0,msg:d(l("%s tags refresh failed. please try again","bit-integrations"),"Kit(ConvertKit)")}),s(!1)}).catch(()=>s(!1))},N=(e,t,s,r)=>{if((e==null?void 0:e.module)==="add_tags_to_a_subscriber"||(e==null?void 0:e.module)==="remove_tags_to_a_subscriber")t(m=>h(m,i=>{i.default||(i.default={}),i.default.fields={Email:{fieldId:"email",fieldName:"Email",required:!0}},i.field_map=[{formField:"",convertKitField:"email",required:!0}]})),r({show:!0,msg:d(l("%s fields refreshed","bit-integrations"),"Kit(ConvertKit)")});else{const m={api_secret:e.api_secret};f(m,"convertKit_headers").then(i=>{i&&i.success?i.data.convertKitField?(t(u=>h(u,a=>{a.default||(a.default={}),a.default.fields=i.data.convertKitField;const{fields:_}=a.default;a.field_map=Object.values(_).filter(o=>o.required).map(o=>({formField:"",convertKitField:o.fieldId,required:!0}))})),r({show:!0,msg:d(l("%s fields refreshed","bit-integrations"),"Kit(ConvertKit)")})):r({show:!0,msg:d(l("No %s fields found. Try changing the header row number or try again","bit-integrations"),"Kit(ConvertKit)")}):r({show:!0,msg:d(l("%s fields refresh failed. please try again","bit-integrations"),"Kit(ConvertKit)")}),s(!1)}).catch(()=>s(!1))}},P=e=>!((e!=null&&e.field_map?e.field_map.filter(s=>!s.formField&&s.convertKitField&&s.required):[]).length>0);export{w as a,N as b,P as c,q as h,T as r};
