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.8.10.js";import{u as C,b as c}from"./react-router.DMwpH23k.js";import{S}from"./SnackMsg.7BjcJK1j.js";import{S as j,I as F,s as R}from"./Integrations.BFhED4ck.js";import{W as w}from"./WPForoIntegLayout.CIzT0COb.js";import{h as m,T as r,c as p}from"./WPForoCommonFunc.DC3wfkgi.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./CopyIcn.BnhKHfEP.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TagifyInput.C4ilRm4k.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};
