var u=Object.defineProperty;var x=Object.getOwnPropertySymbols;var f=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var h=(a,s,t)=>s in a?u(a,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[s]=t,c=(a,s)=>{for(var t in s||(s={}))f.call(s,t)&&h(a,t,s[t]);if(x)for(var t of x(s))N.call(s,t)&&h(a,t,s[t]);return a};import{k as F,f as _,j as e,_ as n,s as w}from"./main.2.8.10.js";import{aa as v}from"./Note.DalStCGz.js";import{a as g}from"./Integrations.BFhED4ck.js";import{b as y}from"./Table.DSsAy4VI.js";import{g as k}from"./GoogleDriveCommonFunc.DEREYTo-.js";const j=(a,s,t)=>{const i=c({},s);i.field_map.splice(a,0,{}),t(c({},i))},$=(a,s,t)=>{const i=c({},s);i.field_map.length>1&&i.field_map.splice(a,1),t(c({},i))};function M({i:a,formFields:s,field:t,googleDriveConf:i,setGoogleDriveConf:r}){var p;const{isPro:d}=F(_),m=(l,o)=>{const b=c({},i);b.field_map[o][l.target.name]=l.target.value,r(c({},b))};return e.jsx("div",{className:"flx mt-2 mb-2 btcbi-field-map",children:e.jsxs("div",{className:"pos-rel flx",children:[e.jsxs("div",{className:"flx integ-fld-wrp",children:[e.jsxs("select",{className:"btcd-paper-inp mr-2",name:"formField",value:t.formField||"",onChange:l=>m(l,a),children:[e.jsx("option",{value:"",children:n("Select Field","bit-integrations")}),e.jsx("optgroup",{label:n("Form Fields","bit-integrations"),children:s==null?void 0:s.filter(l=>l.type==="file").map(l=>e.jsx("option",{value:l.name,children:l.label},`ff-rm-${l.name}`))}),e.jsx("optgroup",{label:w(n("General Smart Codes %s","bit-integrations"),d?"":`(${n("Pro","bit-integrations")})`),children:d&&((p=g)==null?void 0:p.map(l=>e.jsx("option",{value:l.name,children:l.label},`ff-rm-${l.name}`)))})]}),e.jsxs("select",{className:"btcd-paper-inp",name:"googleDriveFormField",value:t.googleDriveFormField,onChange:l=>m(l,a),children:[e.jsx("option",{value:"",children:n("Select Folder","bit-integrations")}),v(i.foldersList,"name").map(({name:l,id:o})=>e.jsx("option",{value:o,children:l},o))]})]}),e.jsx("button",{onClick:()=>j(a,i,r),className:"icn-btn sh-sm ml-2 mr-1",type:"button",children:"+"}),e.jsx("button",{onClick:()=>$(a,i,r),className:"icn-btn sh-sm ml-1",type:"button","aria-label":"btn",children:e.jsx("span",{className:"btcd-icn icn-trash-2"})})]})})}function S({googleDriveConf:a,setGoogleDriveConf:s}){var i;const t=(r,d)=>{const m=c({},a);r.target.checked?m.actions.delete_from_wp=!0:delete m.actions.delete_from_wp,s(c({},m))};return e.jsx("div",{className:"pos-rel d-flx w-8",children:e.jsx(y,{checked:((i=a.actions)==null?void 0:i.delete_from_wp)||!1,onChange:r=>t(r),className:"mt-4 mr-2",value:"delete_from_wp",title:n("Delete File From Wordpress","bit-integrations"),subTitle:n("Delete file from Wordpress after upload in GoogleDrive","bit-integrations")})})}function P({flowID:a,formFields:s,googleDriveConf:t,setGoogleDriveConf:i}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-5",children:[e.jsx("b",{className:"wdt-100",children:n("Field Map","bit-integrations")}),e.jsx("button",{onClick:()=>k(a,t,i),className:"icn-btn sh-sm ml-2 mr-2 tooltip",style:{"--tooltip-txt":`'${n("Fetch All GoogleDrive Folders","bit-integrations")}'`},type:"button",children:"↻"})]}),e.jsx("div",{className:"btcd-hr mt-1"}),e.jsxs("div",{className:"flx flx-around mt-2 mb-2 btcbi-field-map-label",children:[e.jsx("div",{className:"txt-dp",children:e.jsx("b",{children:n("File Input","bit-integrations")})}),e.jsx("div",{className:"txt-dp",children:e.jsx("b",{children:n("GoogleDrive Folder","bit-integrations")})})]}),t==null?void 0:t.field_map.map((r,d)=>e.jsx(M,{i:d,field:r,formFields:s,googleDriveConf:t,setGoogleDriveConf:i},`rp-m-${d+9}`)),e.jsx("div",{className:"txt-center btcbi-field-map-button mt-2",children:e.jsx("button",{onClick:()=>j(t.field_map.length,t,i),className:"icn-btn sh-sm",type:"button",children:"+"})}),e.jsx("br",{}),e.jsx("br",{}),e.jsx("div",{className:"mt-4",children:e.jsx("b",{className:"wdt-100",children:n("Utilities","bit-integrations")})}),e.jsx("div",{className:"btcd-hr mt-1"}),e.jsx(S,{googleDriveConf:t,setGoogleDriveConf:i})]})}export{P as G};
