import{h as f,$ as P,g as I,k as h,i as k,j as t,_ as s,z as a}from"./main.2.9.0.js";import{u as C,b as c}from"./react-router.DMwpH23k.js";import{S}from"./SnackMsg.DYSD96P4.js";import{S as j,I as F,s as R}from"./Integrations.DL8wqGct.js";import{W as w}from"./WPForoIntegLayout.y4cdJvkO.js";import{h as m,T as r,c as p}from"./WPForoCommonFunc.BUxilujs.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./CopyIcn.CEA_lFLo.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";function q({allIntegURL:u}){const g=C(),[n,O]=f(P),[e,o]=f(I),[T,L]=c.useState(!1),[_,x]=c.useState({auth:!1,reputation:!1,forums:!1,topics:!1}),[E,i]=c.useState({show:!1}),d=h(k),b=()=>{if(!e.selectedTask){a.error(s("Please select a task!","bit-integrations"));return}if(e.selectedTask!==r.DELETE_TOPIC&&!p(e)){a.error(s("Please map mandatory fields!","bit-integrations"));return}if(e.selectedTask===r.USER_REPUTATION&&!e.selectedReputation){a.error(s("Please select a reputation!","bit-integrations"));return}if(e.selectedTask===r.ADD_TO_GROUP&&!e.selectedGroup){a.error(s("Please select a group!","bit-integrations"));return}if(e.selectedTask===r.REMOVE_FROM_GROUP&&!e.selectedGroup){a.error(s("Please select a group!","bit-integrations"));return}if(e.selectedTask===r.CREATE_TOPIC&&!e.selectedForum){a.error(s("Please select a forum!","bit-integrations"));return}if(e.selectedTask===r.DELETE_TOPIC&&!e.selectedTopic&&!p(e)){a.error(s("Please select a topic or map fields!","bit-integrations"));return}R({flow:n,allIntegURL:u,conf:e,navigate:g,edit:1,setSnackbar:i})};return t.jsxs("div",{style:{width:900},children:[t.jsx(S,{snack:E,setSnackbar:i}),t.jsxs("div",{className:"flx mt-3",children:[t.jsx("b",{className:"wdt-200 d-in-b",children:s("Integration Name:","bit-integrations")}),t.jsx("input",{className:"btcd-paper-inp w-5",onChange:l=>m(l,e,o),name:"name",defaultValue:e.name||"",type:"text",placeholder:s("Integration Name...","bit-integrations")})]}),t.jsx("br",{}),t.jsx(j,{entity:n.triggered_entity,setSnackbar:i}),t.jsx(w,{formID:n.triggered_entity_id,formFields:d,handleInput:l=>m(l,e,o),wpforoConf:e,setWPForoConf:o,loading:_,setLoading:x,setSnackbar:i}),t.jsx(F,{edit:!0,saveConfig:b,isLoading:T,dataConf:e,setDataConf:o,formFields:d}),t.jsx("br",{})]})}export{q as default};
