(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[807],{3652:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/actions",function(){return t(4937)}])},490:function(e,n,t){"use strict";var s=t(1503),i=t(208);n.Z=function(){return(0,s.a)(["userInfo"],async()=>{let e=await i.L.get("/user/manage/");return e.data})}},4937:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return E}});var s=t(5893),i=t(9876),r=t(1017),a=t(9236),l=t(7841),o=t(50),d=t(4777),c=t(4523),u=t(8090),x=t(9008),j=t.n(x),h=t(7294),f=t(4761),m=t(6222),p=t(7564),_=t(3991),g=t(1503),w=t(5945),y=t(8228),k=t(208);function v(e){let{name:n}=e,t=(0,w.NL)(),{mutate:i,isLoading:r}=(0,y.D)({mutationKey:["unloadModule"],mutationFn(e){let{name:n}=e;return k.L.post("/js_admin/actions_unload_module",{name:n}).then(e=>e.data)},onSuccess:()=>t.invalidateQueries(["loadedActions"])});return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(l.z,{size:"xs",loading:r,onClick:()=>i({name:n}),sx:{marginLeft:"12px"},variant:"light",leftIcon:(0,s.jsx)(_._kJ,{size:12}),children:"Unload"})})}var C=function(){let{data:e}=(0,g.a)({queryKey:["loadedActions"],queryFn:()=>k.L.post("/js_admin/actions_module_list",{detailed:!0}).then(e=>e.data).then(e=>({loadedActions:e}))});return(0,f.rZ)(),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(m.U,{chevronPosition:"left",variant:"separated",radius:"md",defaultValue:"customization",children:e&&Object.keys((null==e?void 0:e.loadedActions)||{}).map(e=>(0,s.jsxs)(m.U.Item,{value:e,sx:{background:"#fafafa",width:"100%",padding:"12px 24px",justifyContent:"space-between"},children:[(0,s.jsxs)(c.x,{sx:{display:"flex",alignItems:"center"},children:[(0,s.jsx)(m.U.Control,{children:e}),(0,s.jsx)(v,{name:e})]}),(0,s.jsx)(m.U.Panel,{})]},e))}),(0,s.jsx)(p.K,{spacing:"xs",my:24})]})},b=t(490),A=function(e){let{roles:n}=e,{data:t,refetch:s}=(0,b.Z)(),[i,r]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{r(!0)},[t,n]),{user:t,granted:i,recheck:s}},E=function(){let{granted:e}=A({roles:["superuser"]}),[n,t]=(0,h.useState)(!1);return(0,s.jsx)(s.Fragment,{children:e?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(j(),{children:(0,s.jsx)("title",{children:"Logs"})}),(0,s.jsxs)(i.k,{justify:"center",align:"center",children:[(0,s.jsxs)(r.Z,{w:"90%",withBorder:!0,shadow:"md",radius:"md",sx:{margin:"0 auto"},p:30,children:[(0,s.jsxs)(i.k,{justify:"space-between",children:[(0,s.jsx)(a.D,{order:3,mb:"xl",children:"Manage Actions"}),(0,s.jsx)(l.z,{onClick:()=>t(!0),children:"Import Action"})]}),(0,s.jsx)(o.r,{children:(0,s.jsxs)(o.r.Col,{span:12,children:[(0,s.jsx)(a.D,{order:4,children:"Available Modules"}),(0,s.jsx)(d.i,{}),(0,s.jsx)(c.x,{sx:{display:"flex",justifyContent:"center"},children:(0,s.jsx)(C,{})})]})})]}),(0,s.jsx)(u.u,{opened:n,onClose:()=>t(!1),title:"Import Action"})]})]}):null})}}},function(e){e.O(0,[289,76,3,774,888,179],function(){return e(e.s=3652)}),_N_E=e.O()}]);