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