var F=Object.defineProperty;var j=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var b=(l,i,e)=>i in l?F(l,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[i]=e,h=(l,i)=>{for(var e in i||(i={}))N.call(i,e)&&b(l,e,i[e]);if(j)for(var e of j(i))_.call(i,e)&&b(l,e,i[e]);return l};import{k as y,f as w,j as t,_ as c,s as A}from"./main.2.8.10.js";import{a as M,h as $,b as k}from"./Integrations.BFhED4ck.js";import{g as S,z as R}from"./ZoomCommonFunc.DA-mU_Ge.js";import{T as V}from"./TagifyInput.C4ilRm4k.js";const q=(l,i,e)=>{const s=h({},i);s.field_map.splice(l,0,{}),e(h({},s))},T=(l,i,e)=>{const s=h({},i);s.field_map.length>1&&s.field_map.splice(l,1),e(h({},s))},v=(l,i,e,s)=>{const d=h({},e);d.field_map[i][l.target.name]=l.target.value,l.target.value==="custom"&&(d.field_map[i].customValue=""),s(h({},d))};function P({i:l,formFields:i,field:e,zoomWebinarConf:s,setZoomWebinarConf:d}){var p,g;if(((p=s==null?void 0:s.field_map)==null?void 0:p.length)===1&&e.zoomField===""){const a=h({},s),m=S(a);a.field_map=m,d(a)}const n=(s==null?void 0:s.zoomWebinarFields.filter(a=>a.required===!0))||[],x=(s==null?void 0:s.zoomWebinarFields.filter(a=>a.required===!1))||[],u=y(w),{isPro:r}=u;return t.jsx("div",{className:"flx mt-2 mr-1",children:t.jsxs("div",{className:"pos-rel flx",children:[t.jsxs("div",{className:"flx integ-fld-wrp",children:[t.jsxs("select",{className:"btcd-paper-inp mr-2",name:"formField",value:e.formField||"",onChange:a=>v(a,l,s,d),children:[t.jsx("option",{value:"",children:c("Select Field","bit-integrations")}),t.jsx("optgroup",{label:c("Form Fields","bit-integrations"),children:i==null?void 0:i.map(a=>t.jsx("option",{value:a.name,children:a.label},`ff-rm-${a.name}`))}),t.jsx("option",{value:"custom",children:c("Custom...","bit-integrations")}),t.jsx("optgroup",{label:A(c("General Smart Codes %s","bit-integrations"),r?"":`(${c("Pro","bit-integrations")})`),children:r&&((g=M)==null?void 0:g.map(a=>t.jsx("option",{value:a.name,children:a.label},`ff-rm-${a.name}`)))})]}),e.formField==="custom"&&t.jsx(V,{onChange:a=>$(a,l,biginConf,setBiginConf),label:c("Custom Value","bit-integrations"),className:"mr-2",type:"text",value:e.customValue,placeholder:c("Custom Value","bit-integrations"),formFields:i}),t.jsxs("select",{className:"btcd-paper-inp",disabled:l<n.length,name:"zoomField",value:l<n.length?n[l].key||"":e.zoomField||"",onChange:a=>v(a,l,s,d),children:[t.jsx("option",{value:"",children:c("Select Field","bit-integrations")}),l<n.length?t.jsx("option",{value:n[l].key,children:n[l].label},n[l].key):x.map(({key:a,label:m})=>t.jsx("option",{value:a,children:m},a))]})]}),l>=n.length&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>q(l,s,d),className:"icn-btn sh-sm ml-2 mr-1",type:"button",children:"+"}),t.jsx("button",{onClick:()=>T(l,s,d),className:"icn-btn sh-sm ml-1",type:"button","aria-label":"btn",children:t.jsx("span",{className:"btcd-icn icn-trash-2"})})]})]})})}function D({formFields:l,handleInput:i,zoomWebinarConf:e,setZoomWebinarConf:s,isLoading:d,setIsLoading:n,setSnackbar:x}){var u;return t.jsxs(t.Fragment,{children:[t.jsx("br",{}),t.jsx("b",{className:"wdt-200 d-in-b",children:c("All Webinars:","bit-integrations")}),t.jsxs("select",{onChange:i,name:"id",value:e.id,className:"btcd-paper-inp w-5",children:[t.jsx("option",{value:"",children:c("Select Webinar","bit-integrations")}),((u=e==null?void 0:e.default)==null?void 0:u.allWebinar)&&e.default.allWebinar.map(({id:r,topic:p})=>t.jsx("option",{value:r,children:p},r))]}),t.jsx("button",{onClick:()=>R(null,e,s,n,x),className:"icn-btn sh-sm ml-2 mr-2 tooltip",style:{"--tooltip-txt":`'${c("Fetch All Recipients","bit-integrations")}'`},type:"button",disabled:d,children:"↻"}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("b",{className:"wdt-200 d-in-b",children:c("Action:","bit-integrations")}),t.jsxs("select",{onChange:i,name:"selectedActions",value:e.selectedActions,className:"btcd-paper-inp w-5",children:[t.jsx("option",{value:"",children:c("Select Action","bit-integrations")}),(e==null?void 0:e.allActions)&&e.allActions.map(({key:r,value:p})=>t.jsx("option",{value:p,children:p},r))]}),t.jsx("div",{className:"mt-5",children:t.jsx("b",{className:"wdt-100",children:c("Field Map","bit-integrations")})}),t.jsx("div",{className:"btcd-hr mt-1"}),t.jsxs("div",{className:"flx flx-around mt-2 mb-1",children:[t.jsx("div",{className:"txt-dp",children:t.jsx("b",{children:c("Form Fields","bit-integrations")})}),t.jsx("div",{className:"txt-dp",children:t.jsx("b",{children:c("ZoomWebinar Fields","bit-integrations")})})]}),e==null?void 0:e.field_map.map((r,p)=>t.jsx(P,{i:p,field:r,zoomWebinarConf:e,formFields:l,setZoomWebinarConf:s,setSnackbar:x},`rp-m-${p+9}`)),t.jsx("div",{className:"txt-center  mt-2",style:{marginRight:85},children:t.jsx("button",{onClick:()=>k(e.field_map.length,e,s,!1),className:"icn-btn sh-sm",type:"button",children:"+"})}),t.jsx("br",{}),t.jsx("br",{})]})}export{D as Z};
