var v=Object.defineProperty;var j=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable;var h=(l,r,t)=>r in l?v(l,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[r]=t,b=(l,r)=>{for(var t in r||(r={}))_.call(r,t)&&h(l,t,r[t]);if(j)for(var t of j(r))L.call(r,t)&&h(l,t,r[t]);return l};import{j as i,_ as a,L as A}from"./main.2.8.10.js";import{u as M}from"./Note.DalStCGz.js";import{u as w}from"./CopyIcn.BnhKHfEP.js";import{b as o}from"./Integrations.BFhED4ck.js";import{S as y,f as I,a as k,b as $,g as U,c as S,d as R}from"./SendFoxCommonFunc.B3DCRLZz.js";function G({formFields:l,handleInput:r,sendFoxConf:t,setSendFoxConf:c,isLoading:n,setIsLoading:u,setSnackbar:d}){var p;const x=(((p=t==null?void 0:t.default)==null?void 0:p.allLists)||[]).map(({id:e,name:s})=>({label:s,value:`${e}`})),g=e=>{const s=b({},t);e?s.listId=e:s.listId="",c(b({},s))},N=e=>{c(s=>M(s,m=>{switch(m.mainAction=e,e){case"1":m.field_map_list=R();break;case"2":m.field_map=S();break;case"3":m.field_map_unsubscribe=U();break;default:m.field_map=[{formField:"",sendFoxFormField:""}],m.field_map_list=[{formField:"",sendFoxListFormField:""}],m.field_map_unsubscribe=[{formField:"",sendFoxUnsubscribeFormField:""}]}}))};return i.jsxs(i.Fragment,{children:[i.jsx("br",{}),i.jsx("br",{}),i.jsx("b",{className:"wdt-200 d-in-b",children:a("Actions:","bit-integrations")}),i.jsxs("select",{onChange:e=>N(e.target.value),name:"mainAction",value:t.mainAction,className:"btcd-paper-inp w-5",children:[i.jsx("option",{value:"",children:a("Select Actions","bit-integrations")}),V.map(({key:e,label:s})=>i.jsx("option",{value:e,children:s},e))]}),i.jsx("br",{}),i.jsx("br",{}),n&&i.jsx(A,{style:{display:"flex",justifyContent:"center",alignItems:"center",height:100,transform:"scale(0.7)"}}),t.mainAction==="1"&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"mt-5",children:i.jsx("b",{className:"wdt-100",children:a("Field Map","bit-integrations")})}),i.jsx("div",{className:"btcd-hr mt-1"}),i.jsxs("div",{className:"flx flx-around mt-2 mb-2 btcbi-field-map-label",children:[i.jsx("div",{className:"txt-dp",children:i.jsx("b",{children:a("Form Fields","bit-integrations")})}),i.jsx("div",{className:"txt-dp",children:i.jsx("b",{children:a("SendFox List Fields","bit-integrations")})})]}),t==null?void 0:t.field_map_list.map((e,s)=>i.jsx(y,{i:s,field:e,sendFoxConf:t,formFields:l,setSendFoxConf:c,setSnackbar:d},`rp-m-${s+9}`))]}),t.mainAction==="2"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"d-flx",children:[i.jsx("b",{className:"wdt-200 d-in-b mt-3 mt-i-3",children:a("All List:","bit-integrations")}),i.jsx(w,{options:x,className:"btcd-paper-drpdwn w-5",defaultValue:t.listId,onChange:e=>g(e),customValue:!0}),i.jsx("button",{onClick:()=>I(t,c,u),className:"icn-btn sh-sm ml-2 mr-2 tooltip",style:{"--tooltip-txt":`'${a("Refresh SendFox List","bit-integrations")}'`},type:"button",disabled:n,children:"↻"})]}),i.jsx("br",{}),i.jsx("div",{className:"mt-5",children:i.jsx("b",{className:"wdt-100",children:a("Field Map","bit-integrations")})}),i.jsx("div",{className:"btcd-hr mt-1"}),i.jsxs("div",{className:"flx flx-around mt-2 mb-2 btcbi-field-map-label",children:[i.jsx("div",{className:"txt-dp",children:i.jsx("b",{children:a("Form Fields","bit-integrations")})}),i.jsx("div",{className:"txt-dp",children:i.jsx("b",{children:a("SendFox Fields","bit-integrations")})})]}),(t==null?void 0:t.listId)&&(t==null?void 0:t.field_map.map((e,s)=>i.jsx(k,{i:s,field:e,sendFoxConf:t,formFields:l,setSendFoxConf:c,setSnackbar:d},`rp-m-${s+9}`))),i.jsx("div",{className:"txt-center btcbi-field-map-button mt-2",children:i.jsx("button",{onClick:()=>o(t.field_map.length,t,c,!1),className:"icn-btn sh-sm",type:"button",children:"+"})})]}),t.mainAction==="3"&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"mt-5",children:i.jsx("b",{className:"wdt-100",children:a("Field Map","bit-integrations")})}),i.jsx("div",{className:"btcd-hr mt-1"}),i.jsxs("div",{className:"flx flx-around mt-2 mb-2 btcbi-field-map-label",children:[i.jsx("div",{className:"txt-dp",children:i.jsx("b",{children:a("Form Fields","bit-integrations")})}),i.jsx("div",{className:"txt-dp",children:i.jsx("b",{children:a("SendFox Unsubscribe Fields","bit-integrations")})})]}),t==null?void 0:t.field_map_unsubscribe.map((e,s)=>i.jsx($,{i:s,field:e,sendFoxConf:t,formFields:l,setSendFoxConf:c,setSnackbar:d},`rp-m-${s+9}`))]}),i.jsx("br",{})]})}const V=[{key:"1",label:a("Create List","bit-integrations")},{key:"2",label:a("Create Contact","bit-integrations")},{key:"3",label:a("Unsubscribe Contact","bit-integrations")}];export{G as S};
