Files
skybridge/kms/web/dist/665.js
2025-09-01 17:17:27 -04:00

1 line
59 KiB
JavaScript

"use strict";(self.webpackChunkkms=self.webpackChunkkms||[]).push([[665],{665:(e,t,n)=>{n.r(t),n.d(t,{default:()=>p});var a=n(4914),r=n.n(a),l=n(7435),i=n(5101),o=n(5742),s=n(4133),c=n(3065),d=n(5302),m=n(1283);const p=()=>{const e=()=>{const e=window.location.pathname;return e.includes("/applications")?"applications":e.includes("/tokens")?"tokens":e.includes("/token-tester")?"token-tester":e.includes("/audit")?"audit":"dashboard"},[t,n]=r().useState(e()),[a,p]=r().useState(!1),[u,E]=r().useState("");return r().useEffect(()=>{const t=()=>{n(e())};return window.addEventListener("popstate",t),()=>window.removeEventListener("popstate",t)},[]),r().createElement(l.Box,{w:"100%",pos:"relative"},r().createElement(l.Stack,{gap:"lg"},r().createElement("div",null,r().createElement(l.Group,{justify:"space-between",align:"flex-start"},r().createElement("div",null,r().createElement(l.Group,{align:"center",gap:"sm",mb:"xs"},r().createElement(l.Title,{order:1,size:"h2"},"Key Management System"),r().createElement(l.ActionIcon,{variant:"subtle",size:"lg",onClick:()=>{p(e=>!e)},"aria-label":a?"Remove from favorites":"Add to favorites"},a?r().createElement(i.IconStarFilled,{size:20,color:"gold"}):r().createElement(i.IconStar,{size:20})))),r().createElement(l.Group,{align:"flex-start",gap:"lg"},r().createElement("div",null,r().createElement(l.Select,{placeholder:"Choose a color",data:[{value:"red",label:"Red"},{value:"blue",label:"Blue"},{value:"green",label:"Green"},{value:"purple",label:"Purple"},{value:"orange",label:"Orange"},{value:"pink",label:"Pink"},{value:"teal",label:"Teal"}],value:u,onChange:e=>E(e||""),size:"sm",w:150}))))),r().createElement(l.Tabs,{value:t,onChange:e=>{if(e){const t="/app/kms",a="dashboard"===e?t:`${t}/${e}`;window.history.pushState(null,"",a),n(e),window.dispatchEvent(new PopStateEvent("popstate",{state:null}))}}},r().createElement(l.Tabs.List,null,r().createElement(l.Tabs.Tab,{value:"dashboard",leftSection:r().createElement(i.IconDashboard,{size:16})},"Dashboard"),r().createElement(l.Tabs.Tab,{value:"applications",leftSection:r().createElement(i.IconApps,{size:16})},"Applications"),r().createElement(l.Tabs.Tab,{value:"tokens",leftSection:r().createElement(i.IconKey,{size:16})},"Tokens"),r().createElement(l.Tabs.Tab,{value:"token-tester",leftSection:r().createElement(i.IconTestPipe,{size:16})},"Token Tester"),r().createElement(l.Tabs.Tab,{value:"audit",leftSection:r().createElement(i.IconFileText,{size:16})},"Audit Log")),r().createElement(l.Box,{pt:"md"},(()=>{switch(t){case"applications":return r().createElement(o.A,null);case"tokens":return r().createElement(s.A,null);case"token-tester":return r().createElement(c.A,null);case"audit":return r().createElement(d.A,null);default:return r().createElement(m.A,null)}})()))))}},1283:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(4914),r=n.n(a),l=n(7435),i=n(5101),o=n(7246);const s=()=>{const[e,t]=(0,a.useState)(null),[n,s]=(0,a.useState)(!0);(0,a.useEffect)(()=>{c()},[]);const c=async()=>{try{s(!0);const e=await o.K.getApplications(100,0);let n=0;for(const t of e.data)try{n+=(await o.K.getTokensForApplication(t.app_id,100,0)).count}catch(e){console.debug(`No tokens found for app ${t.app_id}`)}const a={totalApplications:e.count,totalTokens:n,recentActivity:0,systemHealth:"healthy"};t(a)}catch(e){console.error("Failed to load dashboard data:",e),t({totalApplications:0,totalTokens:0,recentActivity:0,systemHealth:"error"})}finally{s(!1)}};if(n)return r().createElement(l.Stack,{align:"center",justify:"center",h:400},r().createElement(l.Loader,{size:"lg"}),r().createElement(l.Text,null,"Loading dashboard..."));const d=[{title:"Applications",value:e?.totalApplications||0,icon:i.IconApps,color:"blue",description:"Active applications"},{title:"API Tokens",value:e?.totalTokens||0,icon:i.IconKey,color:"green",description:"Generated tokens"},{title:"Recent Activity",value:e?.recentActivity||0,icon:i.IconActivity,color:"orange",description:"Events today"},{title:"System Health",value:"healthy"===e?.systemHealth?"100%":"85%",icon:"healthy"===e?.systemHealth?i.IconTrendingUp:i.IconAlertTriangle,color:"healthy"===e?.systemHealth?"green":"yellow",description:"System status"}];return r().createElement(l.Stack,{gap:"lg"},r().createElement(l.SimpleGrid,{cols:{base:1,sm:2,lg:4},spacing:"lg"},d.map(e=>r().createElement(l.Card,{key:e.title,shadow:"sm",radius:"md",withBorder:!0,p:"lg"},r().createElement(l.Group,{justify:"space-between",mb:"xs"},r().createElement(l.Text,{size:"sm",c:"dimmed",fw:500},e.title),r().createElement(l.ThemeIcon,{color:e.color,variant:"light",size:"lg"},r().createElement(e.icon,{size:20}))),r().createElement(l.Text,{size:"xl",fw:700,mb:"xs"},e.value),r().createElement(l.Text,{size:"xs",c:"dimmed"},e.description)))),r().createElement(l.Grid,null,r().createElement(l.Grid.Col,{span:{base:12,md:8}},r().createElement(l.Card,{shadow:"sm",radius:"md",withBorder:!0,p:"lg",h:300},r().createElement(l.Title,{order:3,mb:"md"},"Activity Timeline"),r().createElement(l.Stack,{justify:"center",align:"center",h:200},r().createElement(l.Text,{c:"dimmed",ta:"center"},"Activity timeline will be displayed here",r().createElement("br",null),r().createElement(l.Text,{size:"xs",c:"dimmed"},"Integration with audit events coming soon"))))),r().createElement(l.Grid.Col,{span:{base:12,md:4}},r().createElement(l.Card,{shadow:"sm",radius:"md",withBorder:!0,p:"lg",h:300},r().createElement(l.Title,{order:3,mb:"md"},"System Status"),r().createElement(l.Stack,{gap:"md",align:"center"},r().createElement(l.RingProgress,{size:120,thickness:12,sections:[{value:"healthy"===e?.systemHealth?100:85,color:"healthy"===e?.systemHealth?"green":"yellow"}],label:r().createElement(l.Text,{ta:"center",fw:700,size:"lg"},"healthy"===e?.systemHealth?"100%":"85%")}),r().createElement(l.Badge,{color:"healthy"===e?.systemHealth?"green":"yellow",variant:"light",size:"lg"},"healthy"===e?.systemHealth?"Healthy":"Warning"),r().createElement(l.Text,{size:"sm",c:"dimmed",ta:"center"},"All systems operational"))))))}},2501:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(4914),r=n.n(a),l=n(4273),i=n(7246);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},o.apply(null,arguments)}const s=({opened:e,onClose:t,onSuccess:n,editingApp:a})=>{const s=(0,l.mN)({initialValues:{app_id:a?.app_id||"",app_link:a?.app_link||"",type:a?.type||[],callback_url:a?.callback_url||"",token_prefix:a?.token_prefix||"",token_renewal_duration:"24h",max_token_duration:"168h"},validate:{app_id:e=>e.length<1?"Application ID is required":null,app_link:e=>e.length<1?"Application Link is required":null,type:e=>e.length<1?"Application Type is required":null,callback_url:e=>e.length<1?"Callback URL is required":null}}),c=e=>{const t=e.match(/^(\d+)([hmd]?)$/);if(!t)return 86400;const n=parseInt(t[1]);switch(t[2]||"h"){case"m":return 60*n;case"h":default:return 3600*n;case"d":return 86400*n}},d=async e=>{try{const r={...e,token_renewal_duration_seconds:c(e.token_renewal_duration||"24h"),max_token_duration_seconds:c(e.max_token_duration||"168h"),owner:{type:"individual",name:"Admin User",owner:"admin@example.com"}};a?await i.K.updateApplication(a.app_id,r):await i.K.createApplication(r),l.$e.show({title:"Success",message:`Application ${a?"updated":"created"} successfully`,color:"green"}),n(),t()}catch(e){l.$e.show({title:"Error",message:`Failed to ${a?"update":"create"} application`,color:"red"})}},m=r().createElement(l.YJ,{justify:"flex-end",gap:"sm"},r().createElement(l.$n,{variant:"light",onClick:t},"Cancel"),r().createElement(l.$n,{onClick:s.onSubmit(d)},a?"Update":"Create"," Application"));return r().createElement(l.Bx,{opened:e,onClose:t,title:a?"Edit Application":"Create Application",layoutMode:!0,footer:m},r().createElement("form",{onSubmit:s.onSubmit(d)},r().createElement(l.BJ,{gap:"md"},r().createElement(l.ks,o({label:"Application ID",placeholder:"my-app-id",required:!0,disabled:!!a},s.getInputProps("app_id"))),r().createElement(l.ks,o({label:"Application Link",placeholder:"https://myapp.example.com",required:!0},s.getInputProps("app_link"))),r().createElement(l.KF,o({label:"Application Type",placeholder:"Select application types",required:!0,data:[{value:"static",label:"Static Token App"},{value:"user",label:"User Token App"}]},s.getInputProps("type"))),r().createElement(l.ks,o({label:"Callback URL",placeholder:"https://myapp.example.com/callback",required:!0},s.getInputProps("callback_url"))),r().createElement(l.ks,o({label:"Token Prefix (Optional)",placeholder:"myapp_"},s.getInputProps("token_prefix"))),r().createElement(l.ks,o({label:"Token Renewal Duration",placeholder:"24h"},s.getInputProps("token_renewal_duration"))),r().createElement(l.ks,o({label:"Max Token Duration",placeholder:"168h"},s.getInputProps("max_token_duration"))))))}},3065:(e,t,n)=>{n.d(t,{A:()=>E});var a=n(4914),r=n.n(a),l=n(7435),i=n(6658),o=n(5101),s=n(972),c=n(7373),d=n(7246),m=n(4353),p=n.n(m);function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},u.apply(null,arguments)}const E=()=>{const[e,t]=(0,a.useState)([]),[n,m]=(0,a.useState)(!1),[E,h]=(0,a.useState)(null),b=(0,s.m)({initialValues:{app_id:"",user_id:"",token:"",permissions:[]},validate:{app_id:e=>e.length<1?"Application is required":null,token:e=>e.length<1?"Token is required":null}});(0,a.useEffect)(()=>{g()},[]);const g=async()=>{try{const e=await d.K.getApplications(100,0);t(e.data)}catch(e){console.error("Failed to load applications:",e)}};return r().createElement(l.Stack,{gap:"lg"},r().createElement(l.Grid,null,r().createElement(l.Grid.Col,{span:{base:12,md:6}},r().createElement(l.Card,{shadow:"sm",radius:"md",withBorder:!0,p:"lg"},r().createElement(l.Title,{order:3,mb:"md"},"Test Configuration"),r().createElement("form",{onSubmit:b.onSubmit(async e=>{try{m(!0),h(null);const t={...e,user_id:e.user_id||void 0,permissions:e.permissions&&e.permissions.length>0?e.permissions:void 0},n=await d.K.verifyToken(t);h(n),n.valid?c.notifications.show({title:"Token Verified",message:"Token is "+(n.permitted?"valid and permitted":"valid but not permitted"),color:n.permitted?"green":"orange"}):c.notifications.show({title:"Token Invalid",message:n.error||"Token verification failed",color:"red"})}catch(e){console.error("Failed to verify token:",e),c.notifications.show({title:"Error",message:"Failed to verify token",color:"red"})}finally{m(!1)}})},r().createElement(l.Stack,{gap:"md"},r().createElement(l.Select,u({label:"Application",placeholder:"Select an application to test against",required:!0,data:e.map(e=>({value:e.app_id,label:`${e.app_id} (${e.type.join(", ")})`}))},b.getInputProps("app_id"))),r().createElement(l.TextInput,u({label:"User ID (Optional)",placeholder:"user@example.com",description:"Leave empty for token-only verification"},b.getInputProps("user_id"))),r().createElement(l.Textarea,u({label:"Token",placeholder:"Paste your token here...",required:!0,minRows:3},b.getInputProps("token"))),r().createElement("div",null,r().createElement(l.Text,{size:"sm",fw:500,mb:"xs"},"Required Permissions (Optional)"),r().createElement(l.Text,{size:"xs",c:"dimmed",mb:"md"},"Leave empty to skip permission checks"),r().createElement(i.A,{permissions:b.values.permissions,onChange:e=>b.setFieldValue("permissions",e)})),r().createElement(l.Group,{justify:"flex-end"},r().createElement(l.Button,{type:"submit",loading:n,leftSection:n?r().createElement(l.Loader,{size:16}):r().createElement(o.IconTestPipe,{size:16}),disabled:0===e.length},n?"Testing...":"Test Token")))))),r().createElement(l.Grid.Col,{span:{base:12,md:6}},r().createElement(l.Card,{shadow:"sm",radius:"md",withBorder:!0,p:"lg",h:"100%"},r().createElement(l.Title,{order:3,mb:"md"},"Test Results"),!E&&!n&&r().createElement(l.Stack,{align:"center",justify:"center",h:300},r().createElement(o.IconTestPipe,{size:48,color:"gray"}),r().createElement(l.Text,{c:"dimmed",ta:"center"},'Configure your test parameters and click "Test Token" to see results')),n&&r().createElement(l.Stack,{align:"center",justify:"center",h:300},r().createElement(l.Loader,{size:"lg"}),r().createElement(l.Text,null,"Verifying token...")),E&&r().createElement(l.Stack,{gap:"md"},r().createElement(l.Alert,{icon:r().createElement((e=>e.valid?e.valid&&e.permitted?o.IconCheck:o.IconAlertCircle:o.IconX)(E),{size:16}),title:E.valid?E.permitted?"Token Valid & Permitted":"Token Valid but Not Permitted":"Token Invalid",color:(e=>e.valid?e.valid&&e.permitted?"green":"orange":"red")(E)},E.error||(E.valid&&E.permitted?"Token is valid and has the required permissions":E.valid?"Token is valid but lacks some required permissions":"Token verification failed")),r().createElement(l.Divider,null),r().createElement(l.Stack,{gap:"xs"},r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"Valid:"),r().createElement(l.Badge,{color:E.valid?"green":"red",variant:"light"},E.valid?"Yes":"No")),r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"Permitted:"),r().createElement(l.Badge,{color:E.permitted?"green":"red",variant:"light"},E.permitted?"Yes":"No")),r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"Token Type:"),r().createElement(l.Badge,{variant:"light"},E.token_type)),E.user_id&&r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"User ID:"),r().createElement(l.Text,{size:"sm",style:{fontFamily:"monospace"}},E.user_id)),E.expires_at&&r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"Expires At:"),r().createElement(l.Text,{size:"sm"},p()(E.expires_at).format("MMM DD, YYYY HH:mm"))),E.max_valid_at&&r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"Max Valid Until:"),r().createElement(l.Text,{size:"sm"},p()(E.max_valid_at).format("MMM DD, YYYY HH:mm")))),E.permissions&&E.permissions.length>0&&r().createElement(r().Fragment,null,r().createElement(l.Divider,null),r().createElement("div",null,r().createElement(l.Text,{fw:500,mb:"xs"},"Token Permissions:"),r().createElement(l.Group,{gap:"xs"},E.permissions.map(e=>r().createElement(l.Badge,{key:e,variant:"light",size:"sm",color:"blue"},e))))),E.permission_results&&Object.keys(E.permission_results).length>0&&r().createElement(r().Fragment,null,r().createElement(l.Divider,null),r().createElement("div",null,r().createElement(l.Text,{fw:500,mb:"xs"},"Permission Check Results:"),r().createElement(l.Stack,{gap:"xs"},Object.entries(E.permission_results).map(([e,t])=>r().createElement(l.Group,{key:e,justify:"space-between"},r().createElement(l.Text,{size:"sm",style:{fontFamily:"monospace"}},e),r().createElement(l.Badge,{color:t?"green":"red",variant:"light",size:"sm"},t?"Granted":"Denied")))))),E.claims&&Object.keys(E.claims).length>0&&r().createElement(r().Fragment,null,r().createElement(l.Divider,null),r().createElement("div",null,r().createElement(l.Text,{fw:500,mb:"xs"},"Token Claims:"),r().createElement(l.Code,{block:!0},JSON.stringify(E.claims,null,2)))))))),0===e.length&&r().createElement(l.Alert,{icon:r().createElement(o.IconAlertCircle,{size:16}),title:"No Applications Found",color:"yellow"},"You need to create at least one application before you can test tokens."))}},4133:(e,t,n)=>{n.d(t,{A:()=>u});var a=n(4914),r=n.n(a),l=n(7435),i=n(5101),o=n(972),s=n(7373),c=n(7246),d=n(7918),m=n(4353),p=n.n(m);const u=()=>{const[e,t]=(0,a.useState)([]),[n,m]=(0,a.useState)([]),[u,E]=(0,a.useState)(!1),[h,b]=(0,a.useState)(!1),[g,f]=(0,a.useState)(!1),[y,v]=(0,a.useState)(null),x=(0,o.m)({initialValues:{app_id:"",owner:{type:"individual",name:"Admin User",owner:"admin@example.com"},permissions:[]},validate:{app_id:e=>e.length<1?"Application is required":null,permissions:e=>e.length<1?"At least one permission is required":null}});(0,a.useEffect)(()=>{T(),k()},[]);const T=async()=>{try{const e=await c.K.getApplications(100,0);t(e.data)}catch(e){console.error("Failed to load applications:",e)}},k=async()=>{try{E(!0);const e=await c.K.getApplications(100,0),t=[];for(const n of e.data)try{const e=(await c.K.getTokensForApplication(n.app_id,100,0)).data.map(e=>({...e,app:n}));t.push(...e)}catch(e){}m(t)}catch(e){console.error("Failed to load tokens:",e),s.notifications.show({title:"Error",message:"Failed to load tokens",color:"red"})}finally{E(!1)}},w=e=>{navigator.clipboard.writeText(e),s.notifications.show({title:"Copied",message:"Copied to clipboard",color:"blue"})},_=n.map(e=>r().createElement(l.Table.Tr,{key:e.id},r().createElement(l.Table.Td,null,r().createElement(l.Group,{gap:"xs"},r().createElement(i.IconKey,{size:16,color:"blue"}),r().createElement(l.Text,{size:"sm",style:{fontFamily:"monospace"}},e.id.substring(0,8),"..."))),r().createElement(l.Table.Td,null,r().createElement(l.Badge,{variant:"light",color:"blue"},e.app?.app_id||"Unknown")),r().createElement(l.Table.Td,null,r().createElement(l.Text,{size:"sm",c:"dimmed"},e.owner.name," (",e.owner.owner,")")),r().createElement(l.Table.Td,null,r().createElement(l.Badge,{variant:"light",color:"green"},e.type)),r().createElement(l.Table.Td,null,r().createElement(l.Text,{size:"sm"},p()(e.created_at).format("MMM DD, YYYY"))),r().createElement(l.Table.Td,null,r().createElement(l.Group,{gap:"xs"},r().createElement(l.ActionIcon,{variant:"subtle",color:"blue",onClick:()=>w(e.id),title:"Copy Token ID"},r().createElement(i.IconCopy,{size:16})),r().createElement(l.ActionIcon,{variant:"subtle",color:"red",onClick:()=>(async e=>{if(window.confirm("Are you sure you want to delete this token? This action cannot be undone."))try{await c.K.deleteToken(e),s.notifications.show({title:"Success",message:"Token deleted successfully",color:"green"}),k()}catch(e){console.error("Failed to delete token:",e),s.notifications.show({title:"Error",message:"Failed to delete token",color:"red"})}})(e.id),title:"Delete Token"},r().createElement(i.IconTrash,{size:16}))))));return r().createElement(l.Stack,{gap:"lg",style:{transition:"margin-right 0.3s ease",marginRight:h?"450px":"0"}},r().createElement(l.Group,{justify:"space-between"},r().createElement("div",null,r().createElement(l.Title,{order:2,mb:"xs"},"API Tokens")),r().createElement(l.Button,{leftSection:r().createElement(i.IconPlus,{size:16}),onClick:()=>{x.reset(),b(!0)},disabled:0===e.length},"Create Token")),0===e.length&&r().createElement(l.Alert,{icon:r().createElement(i.IconAlertCircle,{size:16}),title:"No Applications Found",color:"yellow"},"You need to create at least one application before you can create tokens."),u?r().createElement(l.Stack,{align:"center",justify:"center",h:200},r().createElement(l.Loader,{size:"lg"}),r().createElement(l.Text,null,"Loading tokens...")):0===n.length?r().createElement(l.Card,{shadow:"sm",radius:"md",withBorder:!0,p:"xl"},r().createElement(l.Stack,{align:"center",gap:"md"},r().createElement(i.IconKey,{size:48,color:"gray"}),r().createElement("div",{style:{textAlign:"center"}},r().createElement(l.Text,{fw:500,mb:"xs"},"No tokens found"),r().createElement(l.Text,{size:"sm",c:"dimmed"},"Create your first API token to start using the key management system")),e.length>0&&r().createElement(l.Button,{leftSection:r().createElement(i.IconPlus,{size:16}),onClick:()=>{x.reset(),b(!0)}},"Create Token"))):r().createElement(l.Card,{shadow:"sm",radius:"md",withBorder:!0},r().createElement(l.Table,null,r().createElement(l.Table.Thead,null,r().createElement(l.Table.Tr,null,r().createElement(l.Table.Th,null,"Token ID"),r().createElement(l.Table.Th,null,"Application"),r().createElement(l.Table.Th,null,"Owner"),r().createElement(l.Table.Th,null,"Type"),r().createElement(l.Table.Th,null,"Created"),r().createElement(l.Table.Th,null,"Actions"))),r().createElement(l.Table.Tbody,null,_))),r().createElement(d.A,{opened:h,onClose:()=>{b(!1),x.reset()},onSuccess:()=>{k()},applications:e}),r().createElement(l.Modal,{opened:g,onClose:()=>{f(!1),v(null)},title:"Token Created Successfully",size:"lg"},y&&r().createElement(l.Stack,{gap:"md"},r().createElement(l.Alert,{icon:r().createElement(i.IconCheck,{size:16}),title:"Important",color:"green"},"This is the only time you will see the full token. Make sure to copy and store it securely."),r().createElement("div",null,r().createElement(l.Text,{fw:500,mb:"xs"},"Token:"),r().createElement(l.Group,{gap:"xs"},r().createElement(l.Code,{block:!0,style:{fontSize:"12px",wordBreak:"break-all",flex:1}},y.token),r().createElement(l.ActionIcon,{variant:"subtle",color:"blue",onClick:()=>w(y.token),title:"Copy Token"},r().createElement(i.IconCopy,{size:16})))),r().createElement(l.Divider,null),r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"Token ID:"),r().createElement(l.Group,{gap:"xs"},r().createElement(l.Text,{size:"sm",style:{fontFamily:"monospace"}},y.id),r().createElement(l.ActionIcon,{size:"sm",variant:"subtle",onClick:()=>w(y.id)},r().createElement(i.IconCopy,{size:12})))),r().createElement(l.Group,{justify:"space-between",align:"flex-start"},r().createElement(l.Text,{fw:500},"Permissions:"),r().createElement(l.Stack,{gap:"xs",align:"flex-end"},y.permissions.map(e=>r().createElement(l.Badge,{key:e,variant:"light",size:"sm"},e)))),r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"Created:"),r().createElement(l.Text,{size:"sm"},p()(y.created_at).format("MMM DD, YYYY HH:mm"))),r().createElement(l.Group,{justify:"flex-end",mt:"lg"},r().createElement(l.Button,{onClick:()=>{f(!1),v(null)}},"Close")))))}},4273:(e,t,n)=>{n.d(t,{$e:()=>s.notifications,$n:()=>l.Button,B6:()=>g,BJ:()=>l.Stack,Bx:()=>b,EY:()=>l.Text,Ex:()=>l.Badge,KF:()=>l.MultiSelect,Wh:()=>E,YJ:()=>l.Group,bQ:()=>m,ks:()=>l.TextInput,mN:()=>o.m});var a=n(1085),r=n(5641),l=n(8002),i=n(7114),o=n(8317),s=n(3970),c=n(2678),d=(n(2170),function(){return d=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},d.apply(this,arguments)});"function"==typeof SuppressedError&&SuppressedError;var m=function(e){var t=e.data,n=e.columns,o=e.loading,m=void 0!==o&&o,p=e.error,u=void 0===p?null:p,E=e.title,h=e.total,b=void 0===h?0:h,g=e.page,f=void 0===g?1:g,y=e.pageSize,v=void 0===y?10:y,x=e.onPageChange,T=e.onAdd,k=e.onEdit,w=e.onDelete,_=e.onRefresh,S=e.customActions,z=void 0===S?[]:S,A=e.searchable,C=void 0===A||A,I=e.filterable,j=void 0!==I&&I,D=e.filters,O=void 0===D?{}:D,P=e.onFiltersChange,R=e.withBorder,G=void 0===R||R,M=e.withColumnBorders,L=void 0!==M&&M,B=e.striped,N=void 0===B||B,F=e.highlightOnHover,Y=void 0===F||F,U=e.emptyMessage,H=void 0===U?"No data available":U,K=(0,r.useState)(O),W=K[0],$=K[1];(0,r.useEffect)(function(){$(O)},[O]);var q=function(e,t){var n=t[e.key];return e.render?e.render(n,t):null==n?(0,a.jsx)(l.Text,{c:"dimmed",children:"-"}):"boolean"==typeof n?(0,a.jsx)(l.Badge,{color:n?"green":"gray",size:"sm",children:n?"Yes":"No"}):"status"===e.key?(0,a.jsx)(l.Badge,{color:{active:"green",inactive:"gray",pending:"yellow",suspended:"red",success:"green",error:"red",warning:"yellow"}[n]||"blue",size:"sm",children:n}):(0,a.jsx)(l.Text,{children:n.toString()})},V=function(e){var t=[];k&&t.push({key:"edit",label:"Edit",icon:(0,a.jsx)(i.IconEdit,{size:14}),onClick:k}),w&&t.push({key:"delete",label:"Delete",icon:(0,a.jsx)(i.IconTrash,{size:14}),color:"red",onClick:function(){return t=e,void c.jQ.openConfirmModal({title:"Confirm Delete",children:(0,a.jsx)(l.Text,{size:"sm",children:"Are you sure you want to delete this item? This action cannot be undone."}),labels:{confirm:"Delete",cancel:"Cancel"},confirmProps:{color:"red"},onConfirm:function(){return function(e,t,n,a){return new(n||(n=Promise))(function(r,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function o(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,o)}s((a=a.apply(e,t||[])).next())})}(void 0,void 0,void 0,function(){var e;return function(e,t){var n,a,r,l={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(l=0)),l;)try{if(n=1,a&&(r=2&o[0]?a.return:o[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,o[1])).done)return r;switch(a=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return l.label++,{value:o[1],done:!1};case 5:l.label++,a=o[1],o=[0];continue;case 7:o=l.ops.pop(),l.trys.pop();continue;default:if(!((r=(r=l.trys).length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){l=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){l.label=o[1];break}if(6===o[0]&&l.label<r[1]){l.label=r[1],r=o;break}if(r&&l.label<r[2]){l.label=r[2],l.ops.push(o);break}r[2]&&l.ops.pop(),l.trys.pop();continue}o=t.call(e,l)}catch(e){o=[6,e],a=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),w?[4,w(t)]:[3,2];case 1:n.sent(),s.notifications.show({title:"Success",message:"Item deleted successfully",color:"green"}),n.label=2;case 2:return[3,4];case 3:return e=n.sent(),s.notifications.show({title:"Error",message:e.message||"Failed to delete item",color:"red"}),[3,4];case 4:return[2]}})})}});var t}}),t.push.apply(t,z);var n=t.filter(function(t){return!t.show||t.show(e)});return 0===n.length?null:(0,a.jsxs)(l.Menu,{position:"bottom-end",children:[(0,a.jsx)(l.Menu.Target,{children:(0,a.jsx)(l.ActionIcon,{variant:"subtle",color:"gray",children:(0,a.jsx)(i.IconDots,{size:16})})}),(0,a.jsx)(l.Menu.Dropdown,{children:n.map(function(t){return(0,a.jsx)(l.Menu.Item,{leftSection:t.icon,color:t.color,onClick:function(){return t.onClick(e)},children:t.label},t.key)})})]})},X=Math.ceil(b/v);return(0,a.jsxs)(l.Stack,{gap:"md",children:[(0,a.jsxs)(l.Group,{justify:"space-between",children:[(0,a.jsx)(l.Group,{children:E&&(0,a.jsx)(l.Text,{size:"xl",fw:600,children:E})}),(0,a.jsxs)(l.Group,{children:[_&&(0,a.jsx)(l.ActionIcon,{variant:"light",onClick:_,children:(0,a.jsx)(i.IconRefresh,{size:16})}),T&&(0,a.jsx)(l.Button,{leftSection:(0,a.jsx)(i.IconPlus,{size:16}),onClick:T,children:"Add New"})]})]}),(C||j)&&(0,a.jsxs)(l.Group,{children:[C&&(0,a.jsx)(l.TextInput,{placeholder:"Search...",leftSection:(0,a.jsx)(i.IconSearch,{size:16}),value:W.search||"",onChange:function(e){return function(e){!function(e,t){var n,a=d(d({},W),((n={}).search=t,n));$(a),null==P||P(a)}(0,e)}(e.currentTarget.value)},style:{flex:1}}),j&&(0,a.jsx)(l.Group,{children:(0,a.jsx)(l.ActionIcon,{variant:"light",children:(0,a.jsx)(i.IconFilter,{size:16})})})]}),(0,a.jsxs)(l.Paper,{withBorder:G,pos:"relative",children:[(0,a.jsx)(l.LoadingOverlay,{visible:m}),u?(0,a.jsx)(l.Center,{p:"xl",children:(0,a.jsxs)(l.Stack,{align:"center",gap:"xs",children:[(0,a.jsx)(l.Text,{c:"red",fw:500,children:"Error loading data"}),(0,a.jsx)(l.Text,{c:"dimmed",size:"sm",children:u}),_&&(0,a.jsx)(l.Button,{variant:"light",size:"sm",onClick:_,children:"Try Again"})]})}):0===t.length?(0,a.jsx)(l.Center,{p:"xl",children:(0,a.jsxs)(l.Stack,{align:"center",gap:"xs",children:[(0,a.jsx)(l.Text,{c:"dimmed",children:H}),T&&(0,a.jsx)(l.Button,{variant:"light",size:"sm",onClick:T,children:"Add First Item"})]})}):(0,a.jsxs)(l.Table,{striped:N,highlightOnHover:Y,withColumnBorders:L,children:[(0,a.jsx)(l.Table.Thead,{children:(0,a.jsxs)(l.Table.Tr,{children:[n.map(function(e){return(0,a.jsx)(l.Table.Th,{style:{width:e.width},children:e.label},e.key)}),(k||w||z.length>0)&&(0,a.jsx)(l.Table.Th,{style:{width:50},children:"Actions"})]})}),(0,a.jsx)(l.Table.Tbody,{children:t.map(function(e){return(0,a.jsxs)(l.Table.Tr,{children:[n.map(function(t){return(0,a.jsx)(l.Table.Td,{children:q(t,e)},"".concat(e.id,"-").concat(t.key))}),(k||w||z.length>0)&&(0,a.jsx)(l.Table.Td,{children:V(e)})]},e.id)})})]})]}),X>1&&(0,a.jsx)(l.Group,{justify:"center",children:(0,a.jsx)(l.Pagination,{total:X,value:f,onChange:x,size:"sm"})})]})},p={status:{active:"green",inactive:"gray",pending:"yellow",suspended:"red",enabled:"green",disabled:"gray",online:"green",offline:"gray",running:"green",stopped:"gray",paused:"yellow",failed:"red",success:"green",completed:"green",error:"red",warning:"yellow",info:"blue"},role:{admin:"red",moderator:"orange",user:"blue",viewer:"gray",owner:"purple",editor:"cyan",contributor:"teal",guest:"gray"},type:{static:"blue",user:"cyan",service:"green",application:"purple",api:"orange",web:"teal",mobile:"pink",desktop:"indigo"},runtime:{nodejs18:"green",nodejs20:"lime","python3.9":"blue","python3.11":"indigo","go1.20":"cyan","go1.21":"teal",java11:"orange",java17:"red",dotnet6:"purple",dotnet7:"violet",rust:"dark",php8:"grape"},severity:{critical:"red",high:"orange",medium:"yellow",low:"blue",info:"gray",debug:"dark"},execution:{queued:"gray",running:"blue",succeeded:"green",failed:"red",timeout:"orange",cancelled:"yellow",retrying:"cyan"}},u={status:"gray",role:"blue",runtime:"blue",type:"blue",severity:"gray",execution:"gray"},E=function(e){var t=e.value,n=e.variant,r=void 0===n?"status":n,i=e.customColorMap,o=e.size,s=void 0===o?"sm":o,c=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}(e,["value","variant","customColorMap","size"]);if(!t)return(0,a.jsx)(l.Badge,d({color:"gray",size:s},c,{children:"-"}));var m=(i||p[r]||p.status)[t.toLowerCase()]||u[r],E=h(t,r);return(0,a.jsx)(l.Badge,d({color:m,size:s,variant:"filled"},c,{children:E}))},h=function(e,t){switch(t){case"runtime":if(e.startsWith("nodejs"))return"Node.js ".concat(e.replace("nodejs",""));if(e.startsWith("python"))return"Python ".concat(e.replace("python",""));if(e.startsWith("go"))return"Go ".concat(e.replace("go",""));if(e.startsWith("java"))return"Java ".concat(e.replace("java",""));if(e.startsWith("dotnet"))return".NET ".concat(e.replace("dotnet",""));break;case"type":if("api"===e)return"API";if("web"===e)return"Web App";if("mobile"===e)return"Mobile App"}return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()},b=(i.IconUsers,i.IconApps,i.IconFunction,i.IconKey,i.IconFunction,i.IconKey,i.IconDatabase,i.IconDatabase,function(e){var t=e.opened,n=e.onClose,r=e.title,o=e.width,s=void 0===o?450:o,c=e.position,m=void 0===c?"right":c,p=e.headerActions,u=e.footer,E=e.children,h=e.layoutMode,b=void 0!==h&&h,g=e.zIndex,f=void 0===g?1e3:g,y=e.offsetTop,v=void 0===y?60:y,x=e.backgroundColor,T=void 0===x?"var(--mantine-color-body)":x,k=e.borderColor,w=void 0===k?"var(--mantine-color-gray-3)":k,_=e.animationDuration,S=void 0===_?"0.3s":_,z=e["aria-label"];return(0,a.jsxs)(l.Paper,{style:function(){var e={width:"".concat(s,"px"),borderRadius:0,display:"flex",flexDirection:"column",backgroundColor:T,height:"100%"};if(b)return d(d({},e),{position:"relative",borderLeft:"right"===m?"1px solid ".concat(w):void 0,borderRight:"left"===m?"1px solid ".concat(w):void 0});var n=d(d({},e),{position:"fixed",top:v,bottom:0,zIndex:f,transition:"".concat(m," ").concat(S," ease")});return d(d({},n),"right"===m?{right:t?0:"-".concat(s,"px"),borderLeft:"1px solid ".concat(w)}:{left:t?0:"-".concat(s,"px"),borderRight:"1px solid ".concat(w)})}(),role:"dialog","aria-modal":"true","aria-label":z||r,"aria-hidden":!t,children:[(0,a.jsxs)(l.Group,{justify:"space-between",p:"md",style:{borderBottom:"1px solid ".concat(w)},children:[(0,a.jsx)(l.Title,{order:4,style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),p&&(0,a.jsx)(l.Group,{gap:"xs",children:p}),(0,a.jsx)(l.ActionIcon,{variant:"subtle",color:"gray",onClick:n,"aria-label":"Close sidebar",ml:"xs",children:(0,a.jsx)(i.IconX,{size:18})})]}),(0,a.jsx)(l.ScrollArea,{style:{flex:1},scrollbarSize:6,children:(0,a.jsx)(l.Box,{p:"md",children:E})}),u&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.Divider,{}),(0,a.jsx)(l.Box,{p:"md",style:{borderTop:"1px solid ".concat(w)},children:u})]})]})}),g=function(e){var t,n=e.children,r=e.sidebar,i=e.sidebarOpened,o=void 0!==i&&i,s=e.sidebarWidth,c=void 0===s?450:s,d=e.sidebarPosition,m=void 0===d?"right":d,p=e.offsetTop,u=void 0===p?60:p,E=e.transitionDuration,h=void 0===E?"0.3s":E,b=e.className;return(0,a.jsxs)(l.Box,{className:b,style:{position:"relative",minHeight:"100%"},children:[(0,a.jsx)(l.Box,{style:o?{marginLeft:"left"===m?"".concat(c,"px"):0,marginRight:"right"===m?"".concat(c,"px"):0,transition:"margin ".concat(h," ease")}:{marginLeft:0,marginRight:0,transition:"margin ".concat(h," ease")},children:n}),r&&(0,a.jsx)(l.Box,{style:((t={position:"fixed",top:u,bottom:0,width:"".concat(c,"px"),zIndex:1e3})[m]=o?0:"-".concat(c,"px"),t.transition="".concat(m," ").concat(h," ease"),t.pointerEvents=o?"auto":"none",t),children:r})]})}},5302:(e,t,n)=>{n.d(t,{A:()=>m});var a=n(4914),r=n.n(a),l=n(7435),i=n(5101),o=n(4273),s=n(7246),c=n(4353),d=n.n(c);const m=()=>{const[e,t]=(0,a.useState)([]),[n,c]=(0,a.useState)(!1),[m,p]=(0,a.useState)(0),[u,E]=(0,a.useState)(1),[h]=(0,a.useState)(20),[b,g]=(0,a.useState)(!1),[f,y]=(0,a.useState)(null),[v,x]=(0,a.useState)({limit:h,offset:0,order_by:"timestamp",order_desc:!0});(0,a.useEffect)(()=>{T()},[v]);const T=async()=>{try{c(!0);const e=await s.K.getAuditEvents(v);t(e.events),p(e.total)}catch(e){console.error("Failed to load audit events:",e),o.$e.show({title:"Error",message:"Failed to load audit events",color:"red"})}finally{c(!1)}},k=(e,t)=>{E(1),x(n=>({...n,[e]:t,offset:0}))},w=e=>e.startsWith("auth.")?"blue":e.startsWith("app.")?"purple":e.startsWith("token.")?"green":e.startsWith("permission.")?"orange":"gray",_=Math.ceil(m/h),S=e.map(e=>r().createElement(l.Table.Tr,{key:e.id},r().createElement(l.Table.Td,null,r().createElement(l.Text,{size:"sm"},d()(e.timestamp).format("MMM DD, HH:mm:ss"))),r().createElement(l.Table.Td,null,r().createElement(l.Badge,{color:w(e.type),variant:"light",size:"sm"},e.type)),r().createElement(l.Table.Td,null,r().createElement(o.Wh,{value:e.status,size:"sm"})),r().createElement(l.Table.Td,null,r().createElement(l.Text,{size:"sm",c:"dimmed"},e.actor_id||"System")),r().createElement(l.Table.Td,null,r().createElement(l.Text,{size:"sm",lineClamp:2},e.description)),r().createElement(l.Table.Td,null,r().createElement(l.Group,{gap:"xs"},r().createElement(l.Button,{variant:"subtle",size:"xs",leftSection:r().createElement(i.IconEye,{size:14}),onClick:()=>(e=>{y(e),g(!0)})(e)},"Details")))));return r().createElement(l.Stack,{gap:"lg"},r().createElement(l.Group,{justify:"space-between"},r().createElement("div",null,r().createElement(l.Title,{order:2,mb:"xs"},"Audit Log")),r().createElement(l.Button,{leftSection:r().createElement(i.IconRefresh,{size:16}),variant:"light",onClick:T,loading:n},"Refresh")),r().createElement(l.Card,{shadow:"sm",radius:"md",withBorder:!0,p:"md"},r().createElement(l.Stack,{gap:"md"},r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500,size:"sm"},"Filters"),r().createElement(l.Button,{variant:"subtle",size:"xs",onClick:()=>{E(1),x({limit:h,offset:0,order_by:"timestamp",order_desc:!0})}},"Clear All")),r().createElement(l.Grid,null,r().createElement(l.Grid.Col,{span:{base:12,sm:6,md:3}},r().createElement(l.MultiSelect,{label:"Event Types",placeholder:"All types",data:[{value:"auth.login",label:"Authentication - Login"},{value:"auth.logout",label:"Authentication - Logout"},{value:"auth.token_verified",label:"Authentication - Token Verified"},{value:"app.created",label:"Application - Created"},{value:"app.updated",label:"Application - Updated"},{value:"app.deleted",label:"Application - Deleted"},{value:"token.created",label:"Token - Created"},{value:"token.revoked",label:"Token - Revoked"},{value:"token.validated",label:"Token - Validated"},{value:"permission.granted",label:"Permission - Granted"},{value:"permission.denied",label:"Permission - Denied"}],value:v.event_types||[],onChange:e=>k("event_types",e.length?e:void 0),clearable:!0,searchable:!0,size:"sm"})),r().createElement(l.Grid.Col,{span:{base:12,sm:6,md:3}},r().createElement(l.MultiSelect,{label:"Status",placeholder:"All statuses",data:[{value:"success",label:"Success"},{value:"failure",label:"Failure"},{value:"error",label:"Error"},{value:"warning",label:"Warning"}],value:v.statuses||[],onChange:e=>k("statuses",e.length?e:void 0),clearable:!0,size:"sm"})),r().createElement(l.Grid.Col,{span:{base:12,sm:6,md:3}},r().createElement(l.TextInput,{label:"Actor ID",placeholder:"user@example.com",value:v.actor_id||"",onChange:e=>k("actor_id",e.target.value||void 0),size:"sm",leftSection:r().createElement(i.IconSearch,{size:16})})),r().createElement(l.Grid.Col,{span:{base:12,sm:6,md:3}},r().createElement(l.TextInput,{label:"Resource ID",placeholder:"Resource identifier",value:v.resource_id||"",onChange:e=>k("resource_id",e.target.value||void 0),size:"sm",leftSection:r().createElement(i.IconSearch,{size:16})}))))),r().createElement(l.Card,{shadow:"sm",radius:"md",withBorder:!0},n?r().createElement(l.Stack,{align:"center",justify:"center",h:300},r().createElement(l.Loader,{size:"lg"}),r().createElement(l.Text,null,"Loading audit events...")):0===e.length?r().createElement(l.Stack,{align:"center",justify:"center",h:300},r().createElement(i.IconActivity,{size:48,color:"gray"}),r().createElement("div",{style:{textAlign:"center"}},r().createElement(l.Text,{fw:500,mb:"xs"},"No audit events found"),r().createElement(l.Text,{size:"sm",c:"dimmed"},Object.keys(v).filter(e=>"limit"!==e&&"offset"!==e&&"order_by"!==e&&"order_desc"!==e).some(e=>v[e])?"Try adjusting your filters or clearing them to see more results":"Audit events will appear here as system activities occur"))):r().createElement(r().Fragment,null,r().createElement(l.Table,null,r().createElement(l.Table.Thead,null,r().createElement(l.Table.Tr,null,r().createElement(l.Table.Th,null,"Timestamp"),r().createElement(l.Table.Th,null,"Event Type"),r().createElement(l.Table.Th,null,"Status"),r().createElement(l.Table.Th,null,"Actor"),r().createElement(l.Table.Th,null,"Description"),r().createElement(l.Table.Th,null,"Actions"))),r().createElement(l.Table.Tbody,null,S)),_>1&&r().createElement(l.Group,{justify:"space-between",mt:"md",px:"md",pb:"md"},r().createElement(l.Text,{size:"sm",c:"dimmed"},"Showing ",(u-1)*h+1," to ",Math.min(u*h,m)," of ",m," events"),r().createElement(l.Pagination,{total:_,value:u,onChange:e=>{E(e),x(t=>({...t,offset:(e-1)*h}))},size:"sm"})))),r().createElement(l.Modal,{opened:b,onClose:()=>g(!1),title:"Audit Event Details",size:"lg"},f&&r().createElement(l.Stack,{gap:"md"},r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"Event ID:"),r().createElement(l.Text,{size:"sm",style:{fontFamily:"monospace"}},f.id)),r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"Timestamp:"),r().createElement(l.Text,{size:"sm"},d()(f.timestamp).format("MMMM DD, YYYY HH:mm:ss"))),r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"Event Type:"),r().createElement(l.Badge,{color:w(f.type),variant:"light"},f.type)),r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"Status:"),r().createElement(o.Wh,{value:f.status})),r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"Action:"),r().createElement(l.Text,{size:"sm"},f.action)),r().createElement(l.Divider,null),r().createElement("div",null,r().createElement(l.Text,{fw:500,mb:"xs"},"Description:"),r().createElement(l.Text,{size:"sm"},f.description)),f.actor_id&&r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"Actor ID:"),r().createElement(l.Text,{size:"sm"},f.actor_id)),f.actor_ip&&r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"IP Address:"),r().createElement(l.Text,{size:"sm",style:{fontFamily:"monospace"}},f.actor_ip)),f.resource_id&&r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"Resource ID:"),r().createElement(l.Text,{size:"sm"},f.resource_id)),f.resource_type&&r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"Resource Type:"),r().createElement(l.Badge,{variant:"outline",size:"sm"},f.resource_type)),f.request_id&&r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"Request ID:"),r().createElement(l.Text,{size:"sm",style:{fontFamily:"monospace"}},f.request_id)),f.session_id&&r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{fw:500},"Session ID:"),r().createElement(l.Text,{size:"sm",style:{fontFamily:"monospace"}},f.session_id)),f.user_agent&&r().createElement("div",null,r().createElement(l.Text,{fw:500,mb:"xs"},"User Agent:"),r().createElement(l.Text,{size:"xs",c:"dimmed",style:{fontFamily:"monospace"}},f.user_agent)),f.details&&Object.keys(f.details).length>0&&r().createElement(r().Fragment,null,r().createElement(l.Divider,null),r().createElement("div",null,r().createElement(l.Text,{fw:500,mb:"xs"},"Additional Details:"),r().createElement(l.Code,{block:!0},JSON.stringify(f.details,null,2)))))))}},5742:(e,t,n)=>{n.d(t,{A:()=>p});var a=n(4914),r=n.n(a),l=n(4273),i=n(5101),o=n(7373),s=n(7246),c=n(2501),d=n(4353),m=n.n(d);const p=()=>{const[e,t]=(0,a.useState)([]),[n,d]=(0,a.useState)(!1),[p,u]=(0,a.useState)(!1),[E,h]=(0,a.useState)(null);(0,a.useEffect)(()=>{b()},[]);const b=async()=>{try{d(!0);const e=await s.K.getApplications(100,0);t(e.data)}catch(e){console.error("Failed to load applications:",e)}finally{d(!1)}},g=[{key:"app_id",label:"Application ID",render:e=>r().createElement(l.EY,{fw:500},e)},{key:"type",label:"Type",render:e=>r().createElement(l.YJ,{gap:"xs"},e.map(e=>r().createElement(l.Ex,{key:e,variant:"light",size:"sm"},e)))},{key:"owner",label:"Owner",render:e=>r().createElement(l.EY,{size:"sm",c:"dimmed"},e.name," (",e.owner,")")},{key:"created_at",label:"Created",render:e=>r().createElement(l.EY,{size:"sm"},m()(e).format("MMM DD, YYYY"))}],f=[{key:"view",label:"View Details",icon:r().createElement(i.IconEye,{size:14}),onClick:e=>{console.log("View details for:",e.app_id)}},{key:"copy",label:"Copy App ID",icon:r().createElement(i.IconCopy,{size:14}),onClick:e=>{return t=e.app_id,navigator.clipboard.writeText(t),void o.notifications.show({title:"Copied",message:"Copied to clipboard",color:"blue"});var t}}];return r().createElement(l.B6,{sidebarOpened:p,sidebarWidth:450,sidebar:r().createElement(c.A,{opened:p,onClose:()=>u(!1),onSuccess:()=>{u(!1),h(null),b()},editingApp:E})},r().createElement(l.bQ,{data:e,columns:g,loading:n,title:"Applications",searchable:!0,onAdd:()=>{h(null),u(!0)},onEdit:e=>{h(e),u(!0)},onDelete:async e=>{await s.K.deleteApplication(e.app_id),b()},onRefresh:b,customActions:f,emptyMessage:"No applications found"}))}},6658:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(4914),r=n.n(a),l=n(7435),i=n(5101);const o=[{id:"app",label:"Application",description:"Access to application management",children:[{id:"app.read",label:"Read",description:"Read application information"},{id:"app.write",label:"Write",description:"Create and update applications"},{id:"app.delete",label:"Delete",description:"Delete applications"}]},{id:"token",label:"Token",description:"Access to token management",children:[{id:"token.read",label:"Read",description:"Read token information"},{id:"token.create",label:"Create",description:"Create new tokens"},{id:"token.revoke",label:"Revoke",description:"Revoke existing tokens"}]},{id:"repo",label:"Repository",description:"Access to repository operations",children:[{id:"repo.read",label:"Read",description:"Read repository data"},{id:"repo.write",label:"Write",description:"Write to repositories"},{id:"repo.admin",label:"Admin",description:"Administrative access to repositories"}]},{id:"permission",label:"Permission",description:"Access to permission management",children:[{id:"permission.read",label:"Read",description:"Read permission information"},{id:"permission.write",label:"Write",description:"Create and update permissions"},{id:"permission.grant",label:"Grant",description:"Grant permissions to tokens"},{id:"permission.revoke",label:"Revoke",description:"Revoke permissions from tokens"}]}],s=({permissions:e,onChange:t})=>{const[n,s]=(0,a.useState)(new Set);(0,a.useEffect)(()=>{const e=o.map(e=>e.id);s(new Set(e))},[]);const c=(a,o=0)=>{const d=(t=>{if(!t.children)return e.includes(t.id)?"checked":"unchecked";const n=t.children.filter(t=>e.includes(t.id));return 0===n.length?"unchecked":n.length===t.children.length?"checked":"indeterminate"})(a),m=n.has(a.id),p=a.children&&a.children.length>0;return r().createElement(l.Box,{key:a.id},r().createElement(l.Paper,{p:"xs",radius:"sm",style:{border:"1px solid var(--mantine-color-gray-3)",marginBottom:"2px"}},r().createElement(l.Group,{gap:"xs",wrap:"nowrap",align:"flex-start"},p?r().createElement(l.ActionIcon,{variant:"subtle",size:"sm",onClick:()=>{return e=a.id,void s(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});var e},style:{marginTop:"1px"}},m?r().createElement(i.IconChevronDown,{size:14}):r().createElement(i.IconChevronRight,{size:14})):r().createElement(l.Box,{w:28}),r().createElement(l.Checkbox,{checked:"checked"===d,indeterminate:"indeterminate"===d,onChange:n=>((n,a)=>{let r=[...e];n.children?a?n.children.forEach(e=>{r.includes(e.id)||r.push(e.id)}):n.children.forEach(e=>{r=r.filter(t=>t!==e.id)}):a?r.includes(n.id)||r.push(n.id):r=r.filter(e=>e!==n.id),t(r)})(a,n.currentTarget.checked),size:"sm",style:{marginTop:"1px"}}),r().createElement(l.Box,{style:{flex:1}},r().createElement(l.Group,{gap:"xs",wrap:"nowrap"},r().createElement(l.Text,{size:"sm",fw:p?600:500},a.label,p&&" (all)"),a.description&&r().createElement(l.Text,{size:"xs",c:"dimmed",style:{whiteSpace:"nowrap"}},"- ",a.description))))),p&&r().createElement(l.Collapse,{in:m},r().createElement(l.Box,{pl:"lg",mt:"2px"},r().createElement(l.Stack,{gap:"2px"},a.children.map(e=>c(e,o+1))))))};return r().createElement(l.Stack,{gap:"xs"},r().createElement(l.Text,{size:"sm",fw:500,mb:"xs"},"Select permissions for this token"),o.map(e=>c(e)))}},7246:(e,t,n)=>{n.d(t,{K:()=>r});var a=n(7536);const r=new class{constructor(){this.baseURL={SHELL:"/bin/bash",npm_command:"run",SESSION_MANAGER:"local/unix:@/tmp/.ICE-unix/2780,unix/unix:/tmp/.ICE-unix/2780",COREPACK_ENABLE_AUTO_PIN:"0",npm_config_userconfig:"/home/bazzite/.npmrc",COLORTERM:"truecolor",XDG_CONFIG_DIRS:"/home/bazzite/.config/kdedefaults:/etc/xdg:/usr/share/kde-settings/kde-profile/default/xdg",npm_config_cache:"/home/bazzite/.npm",XDG_SESSION_PATH:"/org/freedesktop/DisplayManager/Session1",HISTCONTROL:"ignoredups",XDG_MENU_PREFIX:"plasma-",PTYXIS_PROFILE:"2871e8027773ae74d6c87a5f659bbc74",HOSTNAME:"bazzite",HISTSIZE:"1000",ICEAUTHORITY:"/run/user/1000/iceauth_gsimwA",NODE:"/var/home/linuxbrew/.linuxbrew/Cellar/node/24.7.0/bin/node",SSH_AUTH_SOCK:"/run/user/1000/ssh-agent.socket",MEMORY_PRESSURE_WRITE:"c29tZSAyMDAwMDAgMjAwMDAwMAA=",COLOR:"0",npm_config_local_prefix:"/var/home/bazzite/Projects/skybridge",HOMEBREW_PREFIX:"/home/linuxbrew/.linuxbrew",DESKTOP_SESSION:"plasma",GTK_RC_FILES:"/etc/gtk/gtkrc:/home/bazzite/.gtkrc:/home/bazzite/.config/gtkrc",GDK_CORE_DEVICE_EVENTS:"1",npm_config_globalconfig:"/home/bazzite/.npm-global/etc/npmrc",GPG_TTY:"not a tty",EDITOR:"/usr/bin/nano",XDG_SEAT:"seat0",PWD:"/var/home/bazzite/Projects/skybridge/kms/web",XDG_SESSION_DESKTOP:"KDE",LOGNAME:"bazzite",XDG_SESSION_TYPE:"wayland",npm_config_init_module:"/home/bazzite/.npm-init.js",SYSTEMD_EXEC_PID:"1044088",_:"/var/home/bazzite/Projects/skybridge/kms/web/node_modules/.bin/webpack",XAUTHORITY:"/run/user/1000/xauth_PJACoS",SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS:"0",CLAUDECODE:"1",XKB_DEFAULT_MODEL:"pc105",GTK2_RC_FILES:"/home/bazzite/.gtkrc-2.0-kde4",HOME:"/home/bazzite",SSH_ASKPASS:"/usr/bin/ksshaskpass",LANG:"en_US.UTF-8",LS_COLORS:"rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;37;41:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.7z=01;31:*.ace=01;31:*.alz=01;31:*.apk=01;31:*.arc=01;31:*.arj=01;31:*.bz=01;31:*.bz2=01;31:*.cab=01;31:*.cpio=01;31:*.crate=01;31:*.deb=01;31:*.drpm=01;31:*.dwm=01;31:*.dz=01;31:*.ear=01;31:*.egg=01;31:*.esd=01;31:*.gz=01;31:*.jar=01;31:*.lha=01;31:*.lrz=01;31:*.lz=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.lzo=01;31:*.pyz=01;31:*.rar=01;31:*.rpm=01;31:*.rz=01;31:*.sar=01;31:*.swm=01;31:*.t7z=01;31:*.tar=01;31:*.taz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tgz=01;31:*.tlz=01;31:*.txz=01;31:*.tz=01;31:*.tzo=01;31:*.tzst=01;31:*.udeb=01;31:*.war=01;31:*.whl=01;31:*.wim=01;31:*.xz=01;31:*.z=01;31:*.zip=01;31:*.zoo=01;31:*.zst=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.m4a=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.oga=01;36:*.opus=01;36:*.spx=01;36:*.xspf=01;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:",XDG_CURRENT_DESKTOP:"KDE",npm_package_version:"1.0.0",MEMORY_PRESSURE_WATCH:"/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/dbus-:1.3-org.gnome.Ptyxis@1.service/memory.pressure",VTE_VERSION:"8003",WAYLAND_DISPLAY:"wayland-0",XDG_SEAT_PATH:"/org/freedesktop/DisplayManager/Seat0",INVOCATION_ID:"78212c42052f4de8b5a44d4a1cd26583",MANAGERPID:"2409",INIT_CWD:"/var/home/bazzite/Projects/skybridge/kms/web",STEAM_FRAME_FORCE_CLOSE:"1",KDE_SESSION_UID:"1000",INFOPATH:"/home/linuxbrew/.linuxbrew/share/info:",npm_lifecycle_script:"webpack --mode production",XKB_DEFAULT_LAYOUT:"us",npm_config_npm_version:"11.5.1",XDG_SESSION_CLASS:"user",TERM:"xterm-256color",npm_package_name:"kms",npm_config_prefix:"/home/bazzite/.npm-global",LESSOPEN:"||/usr/bin/lesspipe.sh %s",USER:"bazzite",HOMEBREW_CELLAR:"/home/linuxbrew/.linuxbrew/Cellar",QT_WAYLAND_RECONNECT:"1",KDE_SESSION_VERSION:"6",PAM_KWALLET5_LOGIN:"/run/user/1000/kwallet5.socket",SUDO_ASKPASS:"/usr/bin/ksshaskpass",DISPLAY:":0",npm_lifecycle_event:"build",SHLVL:"2",GIT_EDITOR:"true",HOMEBREW_REPOSITORY:"/home/linuxbrew/.linuxbrew/Homebrew",XDG_VTNR:"2",XDG_SESSION_ID:"2",npm_config_user_agent:"npm/11.5.1 node/v24.7.0 linux x64 workspaces/true",OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE:"delta",npm_execpath:"/var/home/linuxbrew/.linuxbrew/lib/node_modules/npm/bin/npm-cli.js",XDG_RUNTIME_DIR:"/run/user/1000",CLAUDE_CODE_ENTRYPOINT:"cli",DEBUGINFOD_URLS:"https://debuginfod.fedoraproject.org/ ",npm_package_json:"/var/home/bazzite/Projects/skybridge/kms/web/package.json",DEBUGINFOD_IMA_CERT_PATH:"/etc/keys/ima:",KDEDIRS:"/usr",JOURNAL_STREAM:"9:2817901",XDG_DATA_DIRS:"/home/bazzite/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share",KDE_FULL_SESSION:"true",npm_config_noproxy:"",PATH:"/var/home/bazzite/Projects/skybridge/kms/web/node_modules/.bin:/var/home/bazzite/Projects/skybridge/kms/node_modules/.bin:/var/home/bazzite/Projects/skybridge/node_modules/.bin:/var/home/bazzite/Projects/node_modules/.bin:/var/home/bazzite/node_modules/.bin:/var/home/node_modules/.bin:/var/node_modules/.bin:/node_modules/.bin:/var/home/linuxbrew/.linuxbrew/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/home/bazzite/.npm-global/bin:/home/bazzite/.npm-global/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/home/bazzite/.npm-global/bin:/home/bazzite/.npm-global/bin:/home/bazzite/.local/bin:/home/bazzite/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin",npm_config_node_gyp:"/var/home/linuxbrew/.linuxbrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",DBUS_SESSION_BUS_ADDRESS:"unix:path=/run/user/1000/bus",npm_config_global_prefix:"/home/bazzite/.npm-global",KDE_APPLICATIONS_AS_SCOPE:"1",MAIL:"/var/spool/mail/bazzite",PTYXIS_VERSION:"48.5",BREW_BASH_COMPLETION:"1",npm_node_execpath:"/var/home/linuxbrew/.linuxbrew/Cellar/node/24.7.0/bin/node",FLATPAK_TTY_PROGRESS:"1",OLDPWD:"/var/home/bazzite/Projects/skybridge/web-components"}.REACT_APP_API_URL||"http://localhost:8080",this.api=a.A.create({baseURL:this.baseURL,headers:{"Content-Type":"application/json"}}),this.api.interceptors.request.use(e=>(e.headers["X-User-Email"]="admin@example.com",e)),this.api.interceptors.response.use(e=>e,e=>(console.error("API Error:",e),Promise.reject(e)))}async getApplications(e=50,t=0){return(await this.api.get(`/api/applications?limit=${e}&offset=${t}`)).data}async getApplication(e){return(await this.api.get(`/api/applications/${e}`)).data}async createApplication(e){return(await this.api.post("/api/applications",e)).data}async updateApplication(e,t){return(await this.api.put(`/api/applications/${e}`,t)).data}async deleteApplication(e){await this.api.delete(`/api/applications/${e}`)}async getTokensForApplication(e,t=50,n=0){return(await this.api.get(`/api/applications/${e}/tokens?limit=${t}&offset=${n}`)).data}async createToken(e,t){return(await this.api.post(`/api/applications/${e}/tokens`,t)).data}async deleteToken(e){await this.api.delete(`/api/tokens/${e}`)}async verifyToken(e){return(await this.api.post("/api/verify",e)).data}async getAuditEvents(e){const t=new URLSearchParams;e&&(e.event_types?.length&&e.event_types.forEach(e=>t.append("event_types",e)),e.statuses?.length&&e.statuses.forEach(e=>t.append("statuses",e)),e.actor_id&&t.set("actor_id",e.actor_id),e.resource_id&&t.set("resource_id",e.resource_id),e.resource_type&&t.set("resource_type",e.resource_type),e.start_time&&t.set("start_time",e.start_time),e.end_time&&t.set("end_time",e.end_time),e.limit&&t.set("limit",e.limit.toString()),e.offset&&t.set("offset",e.offset.toString()),e.order_by&&t.set("order_by",e.order_by),void 0!==e.order_desc&&t.set("order_desc",e.order_desc.toString()));const n="/api/audit/events"+(t.toString()?"?"+t.toString():"");return(await this.api.get(n)).data}async getAuditEvent(e){return(await this.api.get(`/api/audit/events/${e}`)).data}async getAuditStats(e){const t=new URLSearchParams;e&&(e.event_types?.length&&e.event_types.forEach(e=>t.append("event_types",e)),e.start_time&&t.set("start_time",e.start_time),e.end_time&&t.set("end_time",e.end_time),e.group_by&&t.set("group_by",e.group_by));const n="/api/audit/stats"+(t.toString()?"?"+t.toString():"");return(await this.api.get(n)).data}}},7918:(e,t,n)=>{n.d(t,{A:()=>p});var a=n(4914),r=n.n(a),l=n(7435),i=n(5101),o=n(972),s=n(7373),c=n(6658),d=n(7246);function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},m.apply(null,arguments)}const p=({opened:e,onClose:t,onSuccess:n,applications:p})=>{const[u,E]=(0,a.useState)(!1),[h,b]=(0,a.useState)(null),g=(0,o.m)({initialValues:{app_id:"",owner:{type:"individual",name:"Admin User",owner:"admin@example.com"},permissions:[]},validate:{app_id:e=>e.length<1?"Application is required":null,permissions:e=>e.length<1?"At least one permission is required":null}});(0,a.useEffect)(()=>{e&&g.reset()},[e]);const f=()=>{E(!1),b(null),t()};return r().createElement(r().Fragment,null,r().createElement(l.Paper,{style:{position:"fixed",top:60,right:e?0:"-450px",bottom:0,width:"450px",zIndex:1e3,borderRadius:0,display:"flex",flexDirection:"column",borderLeft:"1px solid var(--mantine-color-gray-3)",backgroundColor:"var(--mantine-color-body)",transition:"right 0.3s ease"}},r().createElement(l.Group,{justify:"space-between",p:"md",style:{borderBottom:"1px solid var(--mantine-color-gray-3)"}},r().createElement(l.Title,{order:4},"Create New Token"),r().createElement(l.ActionIcon,{variant:"subtle",color:"gray",onClick:t},r().createElement(i.IconX,{size:18}))),r().createElement(l.ScrollArea,{style:{flex:1}},r().createElement(l.Box,{p:"md"},r().createElement("form",{onSubmit:g.onSubmit(async e=>{try{const{app_id:t,...a}=e,r=await d.K.createToken(t,a);b(r),E(!0),g.reset(),n(),s.notifications.show({title:"Success",message:"Token created successfully",color:"green"})}catch(e){console.error("Failed to create token:",e),s.notifications.show({title:"Error",message:"Failed to create token",color:"red"})}})},r().createElement(l.Stack,{gap:"md"},r().createElement(l.Select,m({label:"Application",placeholder:"Select an application",required:!0,data:p.map(e=>({value:e.app_id,label:`${e.app_id} (${e.type.join(", ")})`}))},g.getInputProps("app_id"))),r().createElement("div",null,r().createElement(l.Text,{size:"sm",fw:500,mb:"xs"},"Required Permissions"),r().createElement(l.Text,{size:"xs",c:"dimmed",mb:"md"},"Select the permissions this token should have"),r().createElement(c.A,{permissions:g.values.permissions,onChange:e=>g.setFieldValue("permissions",e)})),r().createElement(l.TextInput,m({label:"Owner Name",placeholder:"Token owner name"},g.getInputProps("owner.name"))),r().createElement(l.TextInput,m({label:"Owner Email",placeholder:"owner@example.com"},g.getInputProps("owner.owner"))),r().createElement(l.Group,{justify:"flex-end",mt:"md"},r().createElement(l.Button,{variant:"light",onClick:t},"Cancel"),r().createElement(l.Button,{type:"submit",disabled:0===p.length},"Create Token"))))))),r().createElement(l.Modal,{opened:u,onClose:f,title:"Token Created Successfully",size:"lg",closeOnEscape:!1,closeOnClickOutside:!1},r().createElement(l.Stack,{gap:"md"},r().createElement(l.Alert,{icon:r().createElement(i.IconCheck,{size:16}),title:"Success!",color:"green"},"Your token has been created successfully. Please copy and store it securely as you won't be able to see it again."),r().createElement("div",null,r().createElement(l.Text,{size:"sm",fw:500,mb:"xs"},"Token:"),r().createElement(l.Group,{gap:"xs"},r().createElement(l.Code,{block:!0,style:{flex:1,wordBreak:"break-all",whiteSpace:"pre-wrap"}},h?.token),r().createElement(l.ActionIcon,{variant:"light",onClick:()=>{return h?.token&&(e=h.token,navigator.clipboard.writeText(e),void s.notifications.show({title:"Copied",message:"Copied to clipboard",color:"blue"}));var e},title:"Copy Token"},r().createElement(i.IconCopy,{size:16})))),h?.prefix&&r().createElement("div",null,r().createElement(l.Text,{size:"sm",fw:500,mb:"xs"},"Token Prefix:"),r().createElement(l.Code,null,h.prefix)),r().createElement(l.Divider,null),r().createElement("div",null,r().createElement(l.Text,{size:"sm",fw:500,mb:"xs"},"Token Details:"),r().createElement(l.Stack,{gap:"xs"},r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{size:"sm"},"Token ID:"),r().createElement(l.Code,null,h?.id)),r().createElement(l.Group,{justify:"space-between"},r().createElement(l.Text,{size:"sm"},"Type:"),r().createElement(l.Code,null,h?.type)),h?.permissions&&r().createElement("div",null,r().createElement(l.Text,{size:"sm",mb:"xs"},"Permissions:"),r().createElement(l.Group,{gap:"xs"},h.permissions.map(e=>r().createElement(l.Code,{key:e,size:"xs"},e)))))),r().createElement(l.Group,{justify:"flex-end",mt:"md"},r().createElement(l.Button,{onClick:f},"Done")))))}}}]);