var g=Object.defineProperty;var x=Object.getOwnPropertySymbols;var f=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;var h=(s,i,t)=>i in s?g(s,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[i]=t,c=(s,i)=>{for(var t in i||(i={}))f.call(i,t)&&h(s,t,i[t]);if(x)for(var t of x(i))u.call(i,t)&&h(s,t,i[t]);return s};import{k as F,f as N,j as e,_ as n,s as v}from"./main.2.8.10.js";import{aa as _}from"./Note.DalStCGz.js";import{a as w}from"./Integrations.BFhED4ck.js";import{b as y}from"./Table.DSsAy4VI.js";import{g as k}from"./PCloudCommonFunc.CgTQgi5q.js";const j=(s,i,t)=>{const a=c({},i);a.field_map.splice(s,0,{}),t(c({},a))},$=(s,i,t)=>{const a=c({},i);a.field_map.length>1&&a.field_map.splice(s,1),t(c({},a))};function M({i:s,formFields:i,field:t,pCloudConf:a,setPCloudConf:r}){var p;const{isPro:m}=F(N),o=(l,d)=>{const b=c({},a);b.field_map[d][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=>o(l,s),children:[e.jsx("option",{value:"",children:n("Select Field","bit-integrations")}),e.jsx("optgroup",{label:n("Form Fields","bit-integrations"),children:i==null?void 0:i.filter(l=>l.type==="file").map(l=>e.jsx("option",{value:l.name,children:l.label},`ff-rm-${l.name}`))}),e.jsx("optgroup",{label:v(n("General Smart Codes %s","bit-integrations"),m?"":`(${n("Pro","bit-integrations")})`),children:m&&((p=w)==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:"pCloudFormField",value:t.pCloudFormField,onChange:l=>o(l,s),children:[e.jsx("option",{value:"",children:n("Select Folder","bit-integrations")}),e.jsx("option",{value:"0",children:n("Root Folder","bit-integrations")}),_(a.foldersList,"name").map(({name:l,id:d})=>e.jsx("option",{value:d,children:l},d))]})]}),e.jsx("button",{onClick:()=>j(s,a,r),className:"icn-btn sh-sm ml-2 mr-1",type:"button",children:"+"}),e.jsx("button",{onClick:()=>$(s,a,r),className:"icn-btn sh-sm ml-1",type:"button","aria-label":"btn",children:e.jsx("span",{className:"btcd-icn icn-trash-2"})})]})})}function P({pCloudConf:s,setPCloudConf:i}){var a;const t=(r,m)=>{const o=c({},s);r.target.checked?o.actions.delete_from_wp=!0:delete o.actions.delete_from_wp,i(c({},o))};return e.jsx("div",{className:"pos-rel d-flx w-8",children:e.jsx(y,{checked:((a=s.actions)==null?void 0:a.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 PCloud","bit-integrations")})})}function B({flowID:s,formFields:i,pCloudConf:t,setPCloudConf:a}){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(t,a,"refresh"),className:"icn-btn sh-sm ml-2 mr-2 tooltip",style:{"--tooltip-txt":`'${n("Fetch All PCloud 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("PCloud Folder","bit-integrations")})})]}),t==null?void 0:t.field_map.map((r,m)=>e.jsx(M,{i:m,field:r,formFields:i,pCloudConf:t,setPCloudConf:a},`rp-m-${m+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:n("Utilities","bit-integrations")})}),e.jsx("div",{className:"btcd-hr mt-1"}),e.jsx(P,{pCloudConf:t,setPCloudConf:a})]})}export{B as P};
