import{b as f,$ as P,h as I,k as h,i as k,j as t,_ as s,z as a}from"./main.2.8.1.js";import{u as C,d as c}from"./react-router-dom.9mCuUg3q.js";import{S}from"./SnackMsg.S8DrwLlT.js";import{S as j,I as F,s as R}from"./Integrations.D2bgBas2.js";import{W as w}from"./WPForoIntegLayout.qBDz-lvD.js";import{h as m,T as r,c as p}from"./WPForoCommonFunc.JqO37tk0.js";import"./Note.BeM7sN-p.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";function K({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{K as default};
