9remote 3.0.6 → 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/dist/cli.cjs +35 -35
  2. package/dist/server.cjs +223 -205
  3. package/dist/ui/assets/index-BjdVz7mh.js +8 -0
  4. package/dist/ui/index.html +1 -1
  5. package/dist/web/404.html +1 -1
  6. package/dist/web/__next.__PAGE__.txt +2 -2
  7. package/dist/web/__next._full.txt +2 -2
  8. package/dist/web/__next._head.txt +1 -1
  9. package/dist/web/__next._index.txt +1 -1
  10. package/dist/web/__next._tree.txt +1 -1
  11. package/dist/web/_next/static/chunks/161-ccde05f90997adf7.js +1 -0
  12. package/dist/web/_next/static/chunks/{6552-5bb346448e83e0a2.js → 6552-09e2e0d864ebbc44.js} +1 -1
  13. package/dist/web/_next/static/chunks/9958-ccfdf26ae6776021.js +1 -0
  14. package/dist/web/_next/static/chunks/app/admin/admins/{page-4dd3a5a797a983ab.js → page-a83d0b3b92891389.js} +1 -1
  15. package/dist/web/_next/static/chunks/app/admin/login/{page-854bcdcb805c63c8.js → page-944e8499d7b8bc17.js} +1 -1
  16. package/dist/web/_next/static/chunks/app/admin/modes/{page-b0675a3cdae87688.js → page-567e8f7d4213406b.js} +1 -1
  17. package/dist/web/_next/static/chunks/app/admin/ota/{page-6de419e03b4822ef.js → page-8d387fa8da56b013.js} +1 -1
  18. package/dist/web/_next/static/chunks/app/admin/{page-ae83026dc795c35b.js → page-c008b84f3d009af1.js} +1 -1
  19. package/dist/web/_next/static/chunks/app/admin/turn/{page-8eb4a8792fca9bd9.js → page-4410571db9d99337.js} +1 -1
  20. package/dist/web/_next/static/chunks/app/dev/question/page-344ec1e850f0d8a2.js +1 -0
  21. package/dist/web/_next/static/chunks/app/login/{page-d42b178c6f11f6d3.js → page-c9eba50fbf9af8b9.js} +1 -1
  22. package/dist/web/_next/static/chunks/app/{page-10772fa3d9560889.js → page-863e9695cfd65f93.js} +2 -2
  23. package/dist/web/_next/static/chunks/app/workspace/layout-08b1abf6c42c1416.js +14 -0
  24. package/dist/web/_not-found/__next._full.txt +1 -1
  25. package/dist/web/_not-found/__next._head.txt +1 -1
  26. package/dist/web/_not-found/__next._index.txt +1 -1
  27. package/dist/web/_not-found/__next._not-found.__PAGE__.txt +1 -1
  28. package/dist/web/_not-found/__next._not-found.txt +1 -1
  29. package/dist/web/_not-found/__next._tree.txt +1 -1
  30. package/dist/web/_not-found.html +1 -1
  31. package/dist/web/_not-found.txt +1 -1
  32. package/dist/web/admin/__next._full.txt +2 -2
  33. package/dist/web/admin/__next._head.txt +1 -1
  34. package/dist/web/admin/__next._index.txt +1 -1
  35. package/dist/web/admin/__next._tree.txt +1 -1
  36. package/dist/web/admin/__next.admin.__PAGE__.txt +2 -2
  37. package/dist/web/admin/__next.admin.txt +1 -1
  38. package/dist/web/admin/admins/__next._full.txt +2 -2
  39. package/dist/web/admin/admins/__next._head.txt +1 -1
  40. package/dist/web/admin/admins/__next._index.txt +1 -1
  41. package/dist/web/admin/admins/__next._tree.txt +1 -1
  42. package/dist/web/admin/admins/__next.admin.admins.__PAGE__.txt +2 -2
  43. package/dist/web/admin/admins/__next.admin.admins.txt +1 -1
  44. package/dist/web/admin/admins/__next.admin.txt +1 -1
  45. package/dist/web/admin/admins.html +1 -1
  46. package/dist/web/admin/admins.txt +2 -2
  47. package/dist/web/admin/login/__next._full.txt +2 -2
  48. package/dist/web/admin/login/__next._head.txt +1 -1
  49. package/dist/web/admin/login/__next._index.txt +1 -1
  50. package/dist/web/admin/login/__next._tree.txt +1 -1
  51. package/dist/web/admin/login/__next.admin.login.__PAGE__.txt +2 -2
  52. package/dist/web/admin/login/__next.admin.login.txt +1 -1
  53. package/dist/web/admin/login/__next.admin.txt +1 -1
  54. package/dist/web/admin/login.html +1 -1
  55. package/dist/web/admin/login.txt +2 -2
  56. package/dist/web/admin/modes/__next._full.txt +2 -2
  57. package/dist/web/admin/modes/__next._head.txt +1 -1
  58. package/dist/web/admin/modes/__next._index.txt +1 -1
  59. package/dist/web/admin/modes/__next._tree.txt +1 -1
  60. package/dist/web/admin/modes/__next.admin.modes.__PAGE__.txt +2 -2
  61. package/dist/web/admin/modes/__next.admin.modes.txt +1 -1
  62. package/dist/web/admin/modes/__next.admin.txt +1 -1
  63. package/dist/web/admin/modes.html +1 -1
  64. package/dist/web/admin/modes.txt +2 -2
  65. package/dist/web/admin/ota/__next._full.txt +2 -2
  66. package/dist/web/admin/ota/__next._head.txt +1 -1
  67. package/dist/web/admin/ota/__next._index.txt +1 -1
  68. package/dist/web/admin/ota/__next._tree.txt +1 -1
  69. package/dist/web/admin/ota/__next.admin.ota.__PAGE__.txt +2 -2
  70. package/dist/web/admin/ota/__next.admin.ota.txt +1 -1
  71. package/dist/web/admin/ota/__next.admin.txt +1 -1
  72. package/dist/web/admin/ota.html +1 -1
  73. package/dist/web/admin/ota.txt +2 -2
  74. package/dist/web/admin/turn/__next._full.txt +2 -2
  75. package/dist/web/admin/turn/__next._head.txt +1 -1
  76. package/dist/web/admin/turn/__next._index.txt +1 -1
  77. package/dist/web/admin/turn/__next._tree.txt +1 -1
  78. package/dist/web/admin/turn/__next.admin.turn.__PAGE__.txt +2 -2
  79. package/dist/web/admin/turn/__next.admin.turn.txt +1 -1
  80. package/dist/web/admin/turn/__next.admin.txt +1 -1
  81. package/dist/web/admin/turn.html +1 -1
  82. package/dist/web/admin/turn.txt +2 -2
  83. package/dist/web/admin.html +1 -1
  84. package/dist/web/admin.txt +2 -2
  85. package/dist/web/agent-icons/claude.png +0 -0
  86. package/dist/web/dev/question/__next._full.txt +2 -2
  87. package/dist/web/dev/question/__next._head.txt +1 -1
  88. package/dist/web/dev/question/__next._index.txt +1 -1
  89. package/dist/web/dev/question/__next._tree.txt +1 -1
  90. package/dist/web/dev/question/__next.dev.question.__PAGE__.txt +2 -2
  91. package/dist/web/dev/question/__next.dev.question.txt +1 -1
  92. package/dist/web/dev/question/__next.dev.txt +1 -1
  93. package/dist/web/dev/question.html +1 -1
  94. package/dist/web/dev/question.txt +2 -2
  95. package/dist/web/index.html +1 -1
  96. package/dist/web/index.txt +2 -2
  97. package/dist/web/login/__next._full.txt +2 -2
  98. package/dist/web/login/__next._head.txt +1 -1
  99. package/dist/web/login/__next._index.txt +1 -1
  100. package/dist/web/login/__next._tree.txt +1 -1
  101. package/dist/web/login/__next.login.__PAGE__.txt +2 -2
  102. package/dist/web/login/__next.login.txt +1 -1
  103. package/dist/web/login.html +1 -1
  104. package/dist/web/login.txt +2 -2
  105. package/dist/web/workspace/__next._full.txt +2 -2
  106. package/dist/web/workspace/__next._head.txt +1 -1
  107. package/dist/web/workspace/__next._index.txt +1 -1
  108. package/dist/web/workspace/__next._tree.txt +1 -1
  109. package/dist/web/workspace/__next.workspace.__PAGE__.txt +1 -1
  110. package/dist/web/workspace/__next.workspace.txt +2 -2
  111. package/dist/web/workspace/browse/__next._full.txt +2 -2
  112. package/dist/web/workspace/browse/__next._head.txt +1 -1
  113. package/dist/web/workspace/browse/__next._index.txt +1 -1
  114. package/dist/web/workspace/browse/__next._tree.txt +1 -1
  115. package/dist/web/workspace/browse/__next.workspace.browse.__PAGE__.txt +1 -1
  116. package/dist/web/workspace/browse/__next.workspace.browse.txt +1 -1
  117. package/dist/web/workspace/browse/__next.workspace.txt +2 -2
  118. package/dist/web/workspace/browse.html +1 -1
  119. package/dist/web/workspace/browse.txt +2 -2
  120. package/dist/web/workspace/editor/__next._full.txt +2 -2
  121. package/dist/web/workspace/editor/__next._head.txt +1 -1
  122. package/dist/web/workspace/editor/__next._index.txt +1 -1
  123. package/dist/web/workspace/editor/__next._tree.txt +1 -1
  124. package/dist/web/workspace/editor/__next.workspace.editor.__PAGE__.txt +1 -1
  125. package/dist/web/workspace/editor/__next.workspace.editor.txt +1 -1
  126. package/dist/web/workspace/editor/__next.workspace.txt +2 -2
  127. package/dist/web/workspace/editor.html +1 -1
  128. package/dist/web/workspace/editor.txt +2 -2
  129. package/dist/web/workspace/files/__next._full.txt +2 -2
  130. package/dist/web/workspace/files/__next._head.txt +1 -1
  131. package/dist/web/workspace/files/__next._index.txt +1 -1
  132. package/dist/web/workspace/files/__next._tree.txt +1 -1
  133. package/dist/web/workspace/files/__next.workspace.files.__PAGE__.txt +1 -1
  134. package/dist/web/workspace/files/__next.workspace.files.txt +1 -1
  135. package/dist/web/workspace/files/__next.workspace.txt +2 -2
  136. package/dist/web/workspace/files.html +1 -1
  137. package/dist/web/workspace/files.txt +2 -2
  138. package/dist/web/workspace/git/__next._full.txt +2 -2
  139. package/dist/web/workspace/git/__next._head.txt +1 -1
  140. package/dist/web/workspace/git/__next._index.txt +1 -1
  141. package/dist/web/workspace/git/__next._tree.txt +1 -1
  142. package/dist/web/workspace/git/__next.workspace.git.__PAGE__.txt +1 -1
  143. package/dist/web/workspace/git/__next.workspace.git.txt +1 -1
  144. package/dist/web/workspace/git/__next.workspace.txt +2 -2
  145. package/dist/web/workspace/git.html +1 -1
  146. package/dist/web/workspace/git.txt +2 -2
  147. package/dist/web/workspace/mobile/__next._full.txt +2 -2
  148. package/dist/web/workspace/mobile/__next._head.txt +1 -1
  149. package/dist/web/workspace/mobile/__next._index.txt +1 -1
  150. package/dist/web/workspace/mobile/__next._tree.txt +1 -1
  151. package/dist/web/workspace/mobile/__next.workspace.mobile.__PAGE__.txt +1 -1
  152. package/dist/web/workspace/mobile/__next.workspace.mobile.txt +1 -1
  153. package/dist/web/workspace/mobile/__next.workspace.txt +2 -2
  154. package/dist/web/workspace/mobile.html +1 -1
  155. package/dist/web/workspace/mobile.txt +2 -2
  156. package/dist/web/workspace/remote/__next._full.txt +2 -2
  157. package/dist/web/workspace/remote/__next._head.txt +1 -1
  158. package/dist/web/workspace/remote/__next._index.txt +1 -1
  159. package/dist/web/workspace/remote/__next._tree.txt +1 -1
  160. package/dist/web/workspace/remote/__next.workspace.remote.__PAGE__.txt +1 -1
  161. package/dist/web/workspace/remote/__next.workspace.remote.txt +1 -1
  162. package/dist/web/workspace/remote/__next.workspace.txt +2 -2
  163. package/dist/web/workspace/remote.html +1 -1
  164. package/dist/web/workspace/remote.txt +2 -2
  165. package/dist/web/workspace/terminal/default/__next._full.txt +2 -2
  166. package/dist/web/workspace/terminal/default/__next._head.txt +1 -1
  167. package/dist/web/workspace/terminal/default/__next._index.txt +1 -1
  168. package/dist/web/workspace/terminal/default/__next._tree.txt +1 -1
  169. package/dist/web/workspace/terminal/default/__next.workspace.terminal.$d$sessionId.__PAGE__.txt +1 -1
  170. package/dist/web/workspace/terminal/default/__next.workspace.terminal.$d$sessionId.txt +1 -1
  171. package/dist/web/workspace/terminal/default/__next.workspace.terminal.txt +1 -1
  172. package/dist/web/workspace/terminal/default/__next.workspace.txt +2 -2
  173. package/dist/web/workspace/terminal/default.html +1 -1
  174. package/dist/web/workspace/terminal/default.txt +2 -2
  175. package/dist/web/workspace/workspaces/__next._full.txt +2 -2
  176. package/dist/web/workspace/workspaces/__next._head.txt +1 -1
  177. package/dist/web/workspace/workspaces/__next._index.txt +1 -1
  178. package/dist/web/workspace/workspaces/__next._tree.txt +1 -1
  179. package/dist/web/workspace/workspaces/__next.workspace.txt +2 -2
  180. package/dist/web/workspace/workspaces/__next.workspace.workspaces.__PAGE__.txt +1 -1
  181. package/dist/web/workspace/workspaces/__next.workspace.workspaces.txt +1 -1
  182. package/dist/web/workspace/workspaces.html +1 -1
  183. package/dist/web/workspace/workspaces.txt +2 -2
  184. package/dist/web/workspace.html +1 -1
  185. package/dist/web/workspace.txt +2 -2
  186. package/package.json +1 -1
  187. package/dist/ui/assets/index-CMq_mLzM.js +0 -8
  188. package/dist/web/_next/static/chunks/7738-2439d4a20b745ce1.js +0 -1
  189. package/dist/web/_next/static/chunks/9958-9952a61eb6e17812.js +0 -1
  190. package/dist/web/_next/static/chunks/app/dev/question/page-a58ae088ccc40553.js +0 -1
  191. package/dist/web/_next/static/chunks/app/workspace/layout-475b254e83019cb1.js +0 -14
  192. package/dist/web/agent-icons/claude.svg +0 -1
  193. /package/dist/web/_next/static/{1Tr76v17cPEsysWpe5buJ → YOawNeLZwNQHJ4nLya6K3}/_buildManifest.js +0 -0
  194. /package/dist/web/_next/static/{1Tr76v17cPEsysWpe5buJ → YOawNeLZwNQHJ4nLya6K3}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2116],{29717:(e,t,s)=>{"use strict";var r=s(21505);s.o(r,"usePathname")&&s.d(t,{usePathname:function(){return r.usePathname}}),s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(t,{useSearchParams:function(){return r.useSearchParams}})},57042:(e,t,s)=>{"use strict";s.d(t,{GS:()=>d,Jj:()=>r,Qh:()=>a,Wm:()=>i,lb:()=>c,r6:()=>n,rK:()=>o,xp:()=>l});let r={sessionView:"session.view",sessionDelete:"session.delete",modeView:"mode.view",modeManage:"mode.manage",adminView:"admin.view",adminManage:"admin.manage",otaView:"ota.view",otaManage:"ota.manage",turnView:"turn.view",turnManage:"turn.manage",logView:"log.view"},n=Object.values(r),a=18e5,i=20,l=[10,20,50,100],d=["createdAt","lastAccessAt","expiresAt","machineId"],o=[{key:"loyal",label:"Loyal",minMs:6048e5,color:"text-success"},{key:"returning",label:"Returning",minMs:864e5,color:"text-brand-500"},{key:"active",label:"Active",minMs:3e5,color:"text-brand-400"},{key:"new",label:"New",minMs:0,color:"text-text-muted"}],c={login:"/api/admin/login",logout:"/api/admin/logout",me:"/api/admin/me",sessions:"/api/admin/sessions",stats:"/api/admin/stats",modes:"/api/admin/modes",admins:"/api/admin/admins",ota:"/api/admin/ota",turn:"/api/admin/turn",logins:"/api/admin/logins",turnstile:"/api/admin/turnstile"}},59893:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var r=s(73365);function n({children:e,centered:t=!0,className:s=""}){return(0,r.jsx)("div",{className:`min-h-screen ${t?"flex items-center justify-center p-4":""} ${s}`,children:e})}},73249:(e,t,s)=>{Promise.resolve().then(s.bind(s,79365))},79365:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>b});var r=s(73365),n=s(1521),a=s(29717),i=s(99568),l=s(59893),d=s(80186),o=s(96042),c=s(90753),u=s(30240);function x({siteKey:e,onToken:t}){let s=(0,n.useRef)(null),a=(0,n.useRef)(t);return((0,n.useEffect)(()=>{a.current=t},[t]),(0,n.useEffect)(()=>{if(!e||!s.current)return;let t=null,r=()=>{window.turnstile?.render&&s.current&&(t=window.turnstile.render(s.current,{sitekey:e,callback:e=>a.current(e),"expired-callback":()=>a.current(""),"error-callback":()=>a.current("")}))};if(window.turnstile?.render)r();else{let e=document.createElement("script");e.src="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",e.async=!0,e.onload=r,document.head.appendChild(e)}return()=>{null!=t&&window.turnstile?.remove?.(t)}},[e]),e)?(0,r.jsx)("div",{ref:s,className:"flex justify-center min-h-[33px]","aria-label":"Captcha"}):null}var m=s(64683),h=s(57042);function b(){let e=(0,a.useRouter)(),[t,s]=(0,n.useState)(""),[b,g]=(0,n.useState)(""),[p,f]=(0,n.useState)(""),[w,j]=(0,n.useState)(!1),[v,y]=(0,n.useState)(""),[k,N]=(0,n.useState)("");(0,n.useEffect)(()=>{fetch(h.lb.turnstile).then(e=>e.json()).then(e=>y(e?.siteKey||"")).catch(()=>y(""))},[]);let A=async()=>{if(t&&b){j(!0),f("");try{let s=await fetch(h.lb.login,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:b,turnstileToken:k}),credentials:"include"}),r=await s.json();if(!s.ok)throw Error(r?.error||"Login failed");e.replace("/admin")}catch(e){f(e.message),N(""),window.turnstile?.reset?.()}finally{j(!1)}}};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.A,{}),(0,r.jsx)(l.A,{children:(0,r.jsxs)("div",{className:"card-glass p-8 sm:p-10 max-w-md w-full relative overflow-hidden",children:[(0,r.jsx)("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-48 h-1 bg-brand-500/80 rounded-full blur-sm"}),(0,r.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center font-bold text-lg bg-brand-500 text-white shadow-[0_8px_24px_-6px_rgba(255,87,10,0.5)] ring-1 ring-white/20",children:"9"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-[11px] font-mono tracking-wider uppercase text-brand-500 font-semibold block",children:"Console"}),(0,r.jsx)("h1",{className:"text-xl font-bold tracking-tight text-text",children:"9Remote Admin"})]})]}),(0,r.jsx)(c.A,{className:"rounded-xl border border-border-subtle"})]}),(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold tracking-tight text-text login-hero-grad",children:"Welcome back"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Sign in with administrator credentials to manage node instances"})]}),p&&(0,r.jsxs)("div",{className:"mb-5 p-3 rounded-xl bg-red-500/10 border border-red-500/20 text-danger text-xs flex items-center gap-2",children:[(0,r.jsx)(m.RI,{size:15,className:"shrink-0"}),(0,r.jsx)("span",{children:p})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)(o.A,{label:"Admin Username",value:t,onChange:e=>s(e.target.value),placeholder:"e.g. root",autoFocus:!0,onKeyDown:e=>"Enter"===e.key&&A()}),(0,r.jsx)(o.A,{label:"Password",type:"password",value:b,onChange:e=>g(e.target.value),placeholder:"••••••••",onKeyDown:e=>"Enter"===e.key&&A()}),(0,r.jsx)(x,{siteKey:v,onToken:N}),(0,r.jsx)(d.A,{variant:"primary",onClick:A,disabled:!t||!b||v&&!k,loading:w,className:"w-full py-2.5 rounded-xl shadow-[0_8px_20px_-6px_rgba(255,87,10,0.45)] font-semibold",children:(0,r.jsxs)("span",{className:"inline-flex items-center justify-center gap-2",children:[(0,r.jsx)("span",{children:"Authenticate"}),(0,r.jsx)(m.Qp,{size:16})]})})]}),(0,r.jsxs)("div",{className:"mt-8 pt-5 border-t border-border-subtle flex items-center justify-between text-xs text-text-subtle",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)(m.ek,{size:13,className:"text-brand-500"}),(0,r.jsx)("span",{children:"Restricted access"})]}),(0,r.jsx)(i,{href:"/login",className:"hover:text-brand-500 transition-colors",children:"User Login →"})]})]})})]})}},80186:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var r=s(73365);function n({children:e,variant:t="primary",size:s="md",disabled:a=!1,loading:i=!1,onClick:l,className:d="",...o}){let c=`font-semibold rounded-brand transition-all duration-150 ease-out transform active:scale-[0.97] ${{primary:"bg-brand-500 hover:bg-brand-600 disabled:bg-surface-3 disabled:text-text-muted text-white shadow-sm",secondary:"bg-surface-2 hover:bg-surface-3 disabled:bg-surface disabled:text-text-muted text-text",danger:"bg-red-500 hover:bg-red-600 disabled:bg-surface-3 disabled:text-text-muted text-white",success:"bg-green-600 hover:bg-green-700 disabled:bg-surface-3 disabled:text-text-muted text-white"}[t]} ${{sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-base",lg:"px-6 py-3 text-lg"}[s]} ${a||i?"cursor-not-allowed":""} ${d}`;return(0,r.jsx)("button",{onClick:l,disabled:a||i,className:c,...o,children:i?(0,r.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)("span",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),e]}):e})}},90753:(e,t,s)=>{"use strict";s.d(t,{A:()=>d});var r=s(73365),n=s(44976),a=s(8910);let i=({size:e=18})=>(0,r.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,r.jsx)("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}),l=({size:e=18})=>(0,r.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})});function d({className:e="",size:t=18}){let{theme:s,toggleTheme:o}=(0,n.D)(),c="dark"===s;return(0,r.jsx)("button",{type:"button",onClick:()=>{(0,a.e)(),o()},"aria-label":c?"Switch to light theme":"Switch to dark theme",title:c?"Light mode":"Dark mode",className:`p-1.5 rounded-brand transition-colors text-[var(--color-text-muted)] hover:text-[var(--color-text)] hover:bg-[var(--color-surface-2)] ${e}`,children:c?(0,r.jsx)(i,{size:t}):(0,r.jsx)(l,{size:t})})}},96042:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var r=s(73365);function n({label:e,type:t="text",value:s,onChange:a,onKeyDown:i,placeholder:l,disabled:d=!1,error:o,className:c="",...u}){let x=o?"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500":"focus:ring-2 focus:ring-brand-500/40",m=`w-full px-4 py-3 bg-surface-2 rounded-brand text-text placeholder-text-muted focus:outline-none transition-all duration-150 ease-out ${x} ${d?"opacity-50 cursor-not-allowed":""} ${c}`;return(0,r.jsxs)("div",{className:"w-full",children:[e&&(0,r.jsx)("label",{className:"block text-sm font-medium text-text mb-2",children:e}),(0,r.jsx)("input",{type:t,value:s,onChange:a,onKeyDown:i,placeholder:l,disabled:d,className:m,...u}),o&&(0,r.jsx)("p",{className:"mt-1 text-sm text-red-400",children:o})]})}}},e=>{e.O(0,[7738,9568,9958,2347,5158,7358],()=>e(e.s=73249)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2116],{29717:(e,t,s)=>{"use strict";var r=s(21505);s.o(r,"usePathname")&&s.d(t,{usePathname:function(){return r.usePathname}}),s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(t,{useSearchParams:function(){return r.useSearchParams}})},57042:(e,t,s)=>{"use strict";s.d(t,{GS:()=>d,Jj:()=>r,Qh:()=>a,Wm:()=>i,lb:()=>c,r6:()=>n,rK:()=>o,xp:()=>l});let r={sessionView:"session.view",sessionDelete:"session.delete",modeView:"mode.view",modeManage:"mode.manage",adminView:"admin.view",adminManage:"admin.manage",otaView:"ota.view",otaManage:"ota.manage",turnView:"turn.view",turnManage:"turn.manage",logView:"log.view"},n=Object.values(r),a=18e5,i=20,l=[10,20,50,100],d=["createdAt","lastAccessAt","expiresAt","machineId"],o=[{key:"loyal",label:"Loyal",minMs:6048e5,color:"text-success"},{key:"returning",label:"Returning",minMs:864e5,color:"text-brand-500"},{key:"active",label:"Active",minMs:3e5,color:"text-brand-400"},{key:"new",label:"New",minMs:0,color:"text-text-muted"}],c={login:"/api/admin/login",logout:"/api/admin/logout",me:"/api/admin/me",sessions:"/api/admin/sessions",stats:"/api/admin/stats",modes:"/api/admin/modes",admins:"/api/admin/admins",ota:"/api/admin/ota",turn:"/api/admin/turn",logins:"/api/admin/logins",turnstile:"/api/admin/turnstile"}},59893:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var r=s(73365);function n({children:e,centered:t=!0,className:s=""}){return(0,r.jsx)("div",{className:`min-h-screen ${t?"flex items-center justify-center p-4":""} ${s}`,children:e})}},73249:(e,t,s)=>{Promise.resolve().then(s.bind(s,79365))},79365:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>b});var r=s(73365),n=s(1521),a=s(29717),i=s(99568),l=s(59893),d=s(80186),o=s(96042),c=s(90753),u=s(30240);function x({siteKey:e,onToken:t}){let s=(0,n.useRef)(null),a=(0,n.useRef)(t);return((0,n.useEffect)(()=>{a.current=t},[t]),(0,n.useEffect)(()=>{if(!e||!s.current)return;let t=null,r=()=>{window.turnstile?.render&&s.current&&(t=window.turnstile.render(s.current,{sitekey:e,callback:e=>a.current(e),"expired-callback":()=>a.current(""),"error-callback":()=>a.current("")}))};if(window.turnstile?.render)r();else{let e=document.createElement("script");e.src="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",e.async=!0,e.onload=r,document.head.appendChild(e)}return()=>{null!=t&&window.turnstile?.remove?.(t)}},[e]),e)?(0,r.jsx)("div",{ref:s,className:"flex justify-center min-h-[33px]","aria-label":"Captcha"}):null}var m=s(64683),h=s(57042);function b(){let e=(0,a.useRouter)(),[t,s]=(0,n.useState)(""),[b,g]=(0,n.useState)(""),[p,f]=(0,n.useState)(""),[w,j]=(0,n.useState)(!1),[v,y]=(0,n.useState)(""),[k,N]=(0,n.useState)("");(0,n.useEffect)(()=>{fetch(h.lb.turnstile).then(e=>e.json()).then(e=>y(e?.siteKey||"")).catch(()=>y(""))},[]);let A=async()=>{if(t&&b){j(!0),f("");try{let s=await fetch(h.lb.login,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:b,turnstileToken:k}),credentials:"include"}),r=await s.json();if(!s.ok)throw Error(r?.error||"Login failed");e.replace("/admin")}catch(e){f(e.message),N(""),window.turnstile?.reset?.()}finally{j(!1)}}};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.A,{}),(0,r.jsx)(l.A,{children:(0,r.jsxs)("div",{className:"card-glass p-8 sm:p-10 max-w-md w-full relative overflow-hidden",children:[(0,r.jsx)("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-48 h-1 bg-brand-500/80 rounded-full blur-sm"}),(0,r.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center font-bold text-lg bg-brand-500 text-white shadow-[0_8px_24px_-6px_rgba(255,87,10,0.5)] ring-1 ring-white/20",children:"9"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-[11px] font-mono tracking-wider uppercase text-brand-500 font-semibold block",children:"Console"}),(0,r.jsx)("h1",{className:"text-xl font-bold tracking-tight text-text",children:"9Remote Admin"})]})]}),(0,r.jsx)(c.A,{className:"rounded-xl border border-border-subtle"})]}),(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold tracking-tight text-text login-hero-grad",children:"Welcome back"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Sign in with administrator credentials to manage node instances"})]}),p&&(0,r.jsxs)("div",{className:"mb-5 p-3 rounded-xl bg-red-500/10 border border-red-500/20 text-danger text-xs flex items-center gap-2",children:[(0,r.jsx)(m.RI,{size:15,className:"shrink-0"}),(0,r.jsx)("span",{children:p})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)(o.A,{label:"Admin Username",value:t,onChange:e=>s(e.target.value),placeholder:"e.g. root",autoFocus:!0,onKeyDown:e=>"Enter"===e.key&&A()}),(0,r.jsx)(o.A,{label:"Password",type:"password",value:b,onChange:e=>g(e.target.value),placeholder:"••••••••",onKeyDown:e=>"Enter"===e.key&&A()}),(0,r.jsx)(x,{siteKey:v,onToken:N}),(0,r.jsx)(d.A,{variant:"primary",onClick:A,disabled:!t||!b||v&&!k,loading:w,className:"w-full py-2.5 rounded-xl shadow-[0_8px_20px_-6px_rgba(255,87,10,0.45)] font-semibold",children:(0,r.jsxs)("span",{className:"inline-flex items-center justify-center gap-2",children:[(0,r.jsx)("span",{children:"Authenticate"}),(0,r.jsx)(m.Qp,{size:16})]})})]}),(0,r.jsxs)("div",{className:"mt-8 pt-5 border-t border-border-subtle flex items-center justify-between text-xs text-text-subtle",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)(m.ek,{size:13,className:"text-brand-500"}),(0,r.jsx)("span",{children:"Restricted access"})]}),(0,r.jsx)(i,{href:"/login",className:"hover:text-brand-500 transition-colors",children:"User Login →"})]})]})})]})}},80186:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var r=s(73365);function n({children:e,variant:t="primary",size:s="md",disabled:a=!1,loading:i=!1,onClick:l,className:d="",...o}){let c=`font-semibold rounded-brand transition-all duration-150 ease-out transform active:scale-[0.97] ${{primary:"bg-brand-500 hover:bg-brand-600 disabled:bg-surface-3 disabled:text-text-muted text-white shadow-sm",secondary:"bg-surface-2 hover:bg-surface-3 disabled:bg-surface disabled:text-text-muted text-text",danger:"bg-red-500 hover:bg-red-600 disabled:bg-surface-3 disabled:text-text-muted text-white",success:"bg-green-600 hover:bg-green-700 disabled:bg-surface-3 disabled:text-text-muted text-white"}[t]} ${{sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-base",lg:"px-6 py-3 text-lg"}[s]} ${a||i?"cursor-not-allowed":""} ${d}`;return(0,r.jsx)("button",{onClick:l,disabled:a||i,className:c,...o,children:i?(0,r.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)("span",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),e]}):e})}},90753:(e,t,s)=>{"use strict";s.d(t,{A:()=>d});var r=s(73365),n=s(44976),a=s(8910);let i=({size:e=18})=>(0,r.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,r.jsx)("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}),l=({size:e=18})=>(0,r.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})});function d({className:e="",size:t=18}){let{theme:s,toggleTheme:o}=(0,n.D)(),c="dark"===s;return(0,r.jsx)("button",{type:"button",onClick:()=>{(0,a.e)(),o()},"aria-label":c?"Switch to light theme":"Switch to dark theme",title:c?"Light mode":"Dark mode",className:`p-1.5 rounded-brand transition-colors text-[var(--color-text-muted)] hover:text-[var(--color-text)] hover:bg-[var(--color-surface-2)] ${e}`,children:c?(0,r.jsx)(i,{size:t}):(0,r.jsx)(l,{size:t})})}},96042:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var r=s(73365);function n({label:e,type:t="text",value:s,onChange:a,onKeyDown:i,placeholder:l,disabled:d=!1,error:o,className:c="",...u}){let x=o?"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500":"focus:ring-2 focus:ring-brand-500/40",m=`w-full px-4 py-3 bg-surface-2 rounded-brand text-text placeholder-text-muted focus:outline-none transition-all duration-150 ease-out ${x} ${d?"opacity-50 cursor-not-allowed":""} ${c}`;return(0,r.jsxs)("div",{className:"w-full",children:[e&&(0,r.jsx)("label",{className:"block text-sm font-medium text-text mb-2",children:e}),(0,r.jsx)("input",{type:t,value:s,onChange:a,onKeyDown:i,placeholder:l,disabled:d,className:m,...u}),o&&(0,r.jsx)("p",{className:"mt-1 text-sm text-red-400",children:o})]})}}},e=>{e.O(0,[161,9568,9958,2347,5158,7358],()=>e(e.s=73249)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[589],{16064:(e,s,t)=>{Promise.resolve().then(t.bind(t,91758))},80186:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});var a=t(73365);function r({children:e,variant:s="primary",size:t="md",disabled:n=!1,loading:i=!1,onClick:d,className:l="",...c}){let x=`font-semibold rounded-brand transition-all duration-150 ease-out transform active:scale-[0.97] ${{primary:"bg-brand-500 hover:bg-brand-600 disabled:bg-surface-3 disabled:text-text-muted text-white shadow-sm",secondary:"bg-surface-2 hover:bg-surface-3 disabled:bg-surface disabled:text-text-muted text-text",danger:"bg-red-500 hover:bg-red-600 disabled:bg-surface-3 disabled:text-text-muted text-white",success:"bg-green-600 hover:bg-green-700 disabled:bg-surface-3 disabled:text-text-muted text-white"}[s]} ${{sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-base",lg:"px-6 py-3 text-lg"}[t]} ${n||i?"cursor-not-allowed":""} ${l}`;return(0,a.jsx)("button",{onClick:d,disabled:n||i,className:x,...c,children:i?(0,a.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,a.jsx)("span",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),e]}):e})}},91758:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>p});var a=t(73365),r=t(1521),n=t(38334),i=t(80186),d=t(96042),l=t(64683),c=t(39457),x=t(24945),o=t(57042);let m={id:"",name:"",permissions:[]};function p(){let{can:e}=(0,x.b)(),{get:s,post:t,patch:p,del:u}=(0,c.Z)(),[b,h]=(0,r.useState)([]),[g,f]=(0,r.useState)(m),[j,N]=(0,r.useState)(null),[y,v]=(0,r.useState)(""),w=e(o.Jj.modeManage),k=(0,r.useCallback)(async()=>{h((await s(o.lb.modes)).items||[])},[s]);(0,r.useEffect)(()=>{k()},[k]);let C=()=>{N(null),f(m),v("")},$=async()=>{v("");try{if(j)await p(`${o.lb.modes}/${j}`,{name:g.name,permissions:g.permissions});else{if(!g.id||!g.name)return void v("ID and name are required");await t(o.lb.modes,g)}C(),k()}catch(e){v(e.message)}},_=async e=>{if(confirm(`Delete mode ${e}?`))try{await u(`${o.lb.modes}/${e}`),k()}catch(e){alert(e.message)}};return(0,a.jsx)(n.A,{children:(0,a.jsxs)("div",{className:"space-y-8 max-w-5xl",children:[(0,a.jsx)("div",{className:"flex items-center justify-between",children:(0,a.jsxs)("div",{children:[(0,a.jsxs)("h1",{className:"text-2xl font-bold tracking-tight text-text login-hero-grad flex items-center gap-2.5",children:[(0,a.jsx)(l.ek,{size:24,className:"text-brand-500"}),(0,a.jsx)("span",{children:"Modes & Permissions"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Configure security roles and granular permission sets"})]})}),w&&(0,a.jsxs)("div",{className:"card-glass p-5 sm:p-6 space-y-4 relative overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between border-b border-border-subtle/60 pb-3",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-text flex items-center gap-2",children:j?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Edit role:"}),(0,a.jsx)("span",{className:"font-mono text-brand-500 font-bold",children:j})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.FW,{size:16,className:"text-brand-500"}),(0,a.jsx)("span",{children:"Create New Security Mode"})]})}),j&&(0,a.jsxs)("button",{onClick:C,className:"text-xs text-text-muted hover:text-text flex items-center gap-1",children:[(0,a.jsx)(l.X,{size:14})," Cancel"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,a.jsx)(d.A,{label:"Mode ID",value:g.id,onChange:e=>f({...g,id:e.target.value}),disabled:!!j,placeholder:"e.g. support-lead"}),(0,a.jsx)(d.A,{label:"Display Name",value:g.name,onChange:e=>f({...g,name:e.target.value}),placeholder:"e.g. Support Team Lead"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs font-mono uppercase tracking-wider text-text-muted mb-2.5",children:"Permissions Granted"}),(0,a.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:o.r6.map(e=>{let s=g.permissions.includes(e);return(0,a.jsxs)("button",{type:"button",onClick:()=>{f(s=>({...s,permissions:s.permissions.includes(e)?s.permissions.filter(s=>s!==e):[...s.permissions,e]}))},className:`flex items-center justify-between px-3 py-2 rounded-xl text-xs font-mono border transition-all text-left ${s?"bg-brand-500/12 text-brand-500 border-brand-500/30 shadow-[0_2px_8px_-2px_rgba(255,87,10,0.2)]":"bg-surface-2/60 text-text-muted border-border-subtle hover:bg-surface-2 hover:text-text"}`,children:[(0,a.jsx)("span",{className:"truncate",children:e}),s?(0,a.jsx)(l.aJ,{size:13,className:"text-brand-500 shrink-0 ml-1.5"}):null]},e)})})]}),y&&(0,a.jsx)("p",{className:"text-xs text-danger bg-red-500/10 p-2.5 rounded-lg border border-red-500/20",children:y}),(0,a.jsxs)("div",{className:"flex gap-2 pt-2",children:[(0,a.jsx)(i.A,{variant:"primary",onClick:$,className:"rounded-xl px-4 py-2",children:(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs font-semibold",children:[(0,a.jsx)(l.eM,{size:14}),(0,a.jsx)("span",{children:j?"Save Changes":"Create Mode"})]})}),j&&(0,a.jsx)(i.A,{variant:"secondary",onClick:C,className:"rounded-xl px-4 py-2 text-xs",children:"Cancel"})]})]}),(0,a.jsx)("div",{className:"card-glass overflow-hidden",children:(0,a.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,a.jsx)("thead",{className:"bg-surface-2/60 border-b border-border-subtle text-[11px] font-mono uppercase tracking-wider text-text-muted",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-4 py-3",children:"ID"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Role Name"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Assigned Permissions"}),w&&(0,a.jsx)("th",{className:"px-4 py-3 text-right",children:"Actions"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-border-subtle/50",children:b.map(e=>{let s=[];try{s="string"==typeof e.permissions?JSON.parse(e.permissions):e.permissions}catch{s=[]}return(0,a.jsxs)("tr",{className:"hover:bg-surface-2/40 transition-colors",children:[(0,a.jsx)("td",{className:"px-4 py-3.5 font-mono text-xs font-semibold text-text",children:e.id}),(0,a.jsx)("td",{className:"px-4 py-3.5 font-medium text-text",children:e.name}),(0,a.jsx)("td",{className:"px-4 py-3.5",children:(0,a.jsx)("div",{className:"flex flex-wrap gap-1 max-w-md",children:s.map(e=>(0,a.jsx)("span",{className:"px-2 py-0.5 rounded-md bg-surface-2 border border-border-subtle text-[10px] font-mono text-text-muted",children:e},e))})}),w&&(0,a.jsx)("td",{className:"px-4 py-3.5 text-right",children:(0,a.jsxs)("div",{className:"inline-flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:()=>(e=>{let s=[];try{s="string"==typeof e.permissions?JSON.parse(e.permissions):e.permissions}catch{s=[]}N(e.id),f({id:e.id,name:e.name,permissions:s})})(e),className:"text-xs text-brand-500 hover:text-brand-400 font-medium px-2 py-1 rounded hover:bg-brand-500/10 transition-colors",children:"Edit"}),(0,a.jsx)("button",{onClick:()=>_(e.id),className:"text-text-muted hover:text-danger p-1 rounded hover:bg-red-500/10 transition-colors",title:"Delete mode",children:(0,a.jsx)(l.TB,{size:15})})]})})]},e.id)})})]})})]})})}},96042:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});var a=t(73365);function r({label:e,type:s="text",value:t,onChange:n,onKeyDown:i,placeholder:d,disabled:l=!1,error:c,className:x="",...o}){let m=c?"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500":"focus:ring-2 focus:ring-brand-500/40",p=`w-full px-4 py-3 bg-surface-2 rounded-brand text-text placeholder-text-muted focus:outline-none transition-all duration-150 ease-out ${m} ${l?"opacity-50 cursor-not-allowed":""} ${x}`;return(0,a.jsxs)("div",{className:"w-full",children:[e&&(0,a.jsx)("label",{className:"block text-sm font-medium text-text mb-2",children:e}),(0,a.jsx)("input",{type:s,value:t,onChange:n,onKeyDown:i,placeholder:d,disabled:l,className:p,...o}),c&&(0,a.jsx)("p",{className:"mt-1 text-sm text-red-400",children:c})]})}}},e=>{e.O(0,[7738,9568,9958,8334,2347,5158,7358],()=>e(e.s=16064)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[589],{16064:(e,s,t)=>{Promise.resolve().then(t.bind(t,91758))},80186:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});var a=t(73365);function r({children:e,variant:s="primary",size:t="md",disabled:n=!1,loading:i=!1,onClick:d,className:l="",...c}){let x=`font-semibold rounded-brand transition-all duration-150 ease-out transform active:scale-[0.97] ${{primary:"bg-brand-500 hover:bg-brand-600 disabled:bg-surface-3 disabled:text-text-muted text-white shadow-sm",secondary:"bg-surface-2 hover:bg-surface-3 disabled:bg-surface disabled:text-text-muted text-text",danger:"bg-red-500 hover:bg-red-600 disabled:bg-surface-3 disabled:text-text-muted text-white",success:"bg-green-600 hover:bg-green-700 disabled:bg-surface-3 disabled:text-text-muted text-white"}[s]} ${{sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-base",lg:"px-6 py-3 text-lg"}[t]} ${n||i?"cursor-not-allowed":""} ${l}`;return(0,a.jsx)("button",{onClick:d,disabled:n||i,className:x,...c,children:i?(0,a.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,a.jsx)("span",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),e]}):e})}},91758:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>p});var a=t(73365),r=t(1521),n=t(38334),i=t(80186),d=t(96042),l=t(64683),c=t(39457),x=t(24945),o=t(57042);let m={id:"",name:"",permissions:[]};function p(){let{can:e}=(0,x.b)(),{get:s,post:t,patch:p,del:u}=(0,c.Z)(),[b,h]=(0,r.useState)([]),[g,f]=(0,r.useState)(m),[j,N]=(0,r.useState)(null),[y,v]=(0,r.useState)(""),w=e(o.Jj.modeManage),k=(0,r.useCallback)(async()=>{h((await s(o.lb.modes)).items||[])},[s]);(0,r.useEffect)(()=>{k()},[k]);let C=()=>{N(null),f(m),v("")},$=async()=>{v("");try{if(j)await p(`${o.lb.modes}/${j}`,{name:g.name,permissions:g.permissions});else{if(!g.id||!g.name)return void v("ID and name are required");await t(o.lb.modes,g)}C(),k()}catch(e){v(e.message)}},_=async e=>{if(confirm(`Delete mode ${e}?`))try{await u(`${o.lb.modes}/${e}`),k()}catch(e){alert(e.message)}};return(0,a.jsx)(n.A,{children:(0,a.jsxs)("div",{className:"space-y-8 max-w-5xl",children:[(0,a.jsx)("div",{className:"flex items-center justify-between",children:(0,a.jsxs)("div",{children:[(0,a.jsxs)("h1",{className:"text-2xl font-bold tracking-tight text-text login-hero-grad flex items-center gap-2.5",children:[(0,a.jsx)(l.ek,{size:24,className:"text-brand-500"}),(0,a.jsx)("span",{children:"Modes & Permissions"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Configure security roles and granular permission sets"})]})}),w&&(0,a.jsxs)("div",{className:"card-glass p-5 sm:p-6 space-y-4 relative overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between border-b border-border-subtle/60 pb-3",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-text flex items-center gap-2",children:j?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Edit role:"}),(0,a.jsx)("span",{className:"font-mono text-brand-500 font-bold",children:j})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.FW,{size:16,className:"text-brand-500"}),(0,a.jsx)("span",{children:"Create New Security Mode"})]})}),j&&(0,a.jsxs)("button",{onClick:C,className:"text-xs text-text-muted hover:text-text flex items-center gap-1",children:[(0,a.jsx)(l.X,{size:14})," Cancel"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,a.jsx)(d.A,{label:"Mode ID",value:g.id,onChange:e=>f({...g,id:e.target.value}),disabled:!!j,placeholder:"e.g. support-lead"}),(0,a.jsx)(d.A,{label:"Display Name",value:g.name,onChange:e=>f({...g,name:e.target.value}),placeholder:"e.g. Support Team Lead"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs font-mono uppercase tracking-wider text-text-muted mb-2.5",children:"Permissions Granted"}),(0,a.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:o.r6.map(e=>{let s=g.permissions.includes(e);return(0,a.jsxs)("button",{type:"button",onClick:()=>{f(s=>({...s,permissions:s.permissions.includes(e)?s.permissions.filter(s=>s!==e):[...s.permissions,e]}))},className:`flex items-center justify-between px-3 py-2 rounded-xl text-xs font-mono border transition-all text-left ${s?"bg-brand-500/12 text-brand-500 border-brand-500/30 shadow-[0_2px_8px_-2px_rgba(255,87,10,0.2)]":"bg-surface-2/60 text-text-muted border-border-subtle hover:bg-surface-2 hover:text-text"}`,children:[(0,a.jsx)("span",{className:"truncate",children:e}),s?(0,a.jsx)(l.aJ,{size:13,className:"text-brand-500 shrink-0 ml-1.5"}):null]},e)})})]}),y&&(0,a.jsx)("p",{className:"text-xs text-danger bg-red-500/10 p-2.5 rounded-lg border border-red-500/20",children:y}),(0,a.jsxs)("div",{className:"flex gap-2 pt-2",children:[(0,a.jsx)(i.A,{variant:"primary",onClick:$,className:"rounded-xl px-4 py-2",children:(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs font-semibold",children:[(0,a.jsx)(l.eM,{size:14}),(0,a.jsx)("span",{children:j?"Save Changes":"Create Mode"})]})}),j&&(0,a.jsx)(i.A,{variant:"secondary",onClick:C,className:"rounded-xl px-4 py-2 text-xs",children:"Cancel"})]})]}),(0,a.jsx)("div",{className:"card-glass overflow-hidden",children:(0,a.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,a.jsx)("thead",{className:"bg-surface-2/60 border-b border-border-subtle text-[11px] font-mono uppercase tracking-wider text-text-muted",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-4 py-3",children:"ID"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Role Name"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Assigned Permissions"}),w&&(0,a.jsx)("th",{className:"px-4 py-3 text-right",children:"Actions"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-border-subtle/50",children:b.map(e=>{let s=[];try{s="string"==typeof e.permissions?JSON.parse(e.permissions):e.permissions}catch{s=[]}return(0,a.jsxs)("tr",{className:"hover:bg-surface-2/40 transition-colors",children:[(0,a.jsx)("td",{className:"px-4 py-3.5 font-mono text-xs font-semibold text-text",children:e.id}),(0,a.jsx)("td",{className:"px-4 py-3.5 font-medium text-text",children:e.name}),(0,a.jsx)("td",{className:"px-4 py-3.5",children:(0,a.jsx)("div",{className:"flex flex-wrap gap-1 max-w-md",children:s.map(e=>(0,a.jsx)("span",{className:"px-2 py-0.5 rounded-md bg-surface-2 border border-border-subtle text-[10px] font-mono text-text-muted",children:e},e))})}),w&&(0,a.jsx)("td",{className:"px-4 py-3.5 text-right",children:(0,a.jsxs)("div",{className:"inline-flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:()=>(e=>{let s=[];try{s="string"==typeof e.permissions?JSON.parse(e.permissions):e.permissions}catch{s=[]}N(e.id),f({id:e.id,name:e.name,permissions:s})})(e),className:"text-xs text-brand-500 hover:text-brand-400 font-medium px-2 py-1 rounded hover:bg-brand-500/10 transition-colors",children:"Edit"}),(0,a.jsx)("button",{onClick:()=>_(e.id),className:"text-text-muted hover:text-danger p-1 rounded hover:bg-red-500/10 transition-colors",title:"Delete mode",children:(0,a.jsx)(l.TB,{size:15})})]})})]},e.id)})})]})})]})})}},96042:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});var a=t(73365);function r({label:e,type:s="text",value:t,onChange:n,onKeyDown:i,placeholder:d,disabled:l=!1,error:c,className:x="",...o}){let m=c?"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500":"focus:ring-2 focus:ring-brand-500/40",p=`w-full px-4 py-3 bg-surface-2 rounded-brand text-text placeholder-text-muted focus:outline-none transition-all duration-150 ease-out ${m} ${l?"opacity-50 cursor-not-allowed":""} ${x}`;return(0,a.jsxs)("div",{className:"w-full",children:[e&&(0,a.jsx)("label",{className:"block text-sm font-medium text-text mb-2",children:e}),(0,a.jsx)("input",{type:s,value:t,onChange:n,onKeyDown:i,placeholder:d,disabled:l,className:p,...o}),c&&(0,a.jsx)("p",{className:"mt-1 text-sm text-red-400",children:c})]})}}},e=>{e.O(0,[161,9568,9958,8334,2347,5158,7358],()=>e(e.s=16064)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8535],{52840:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>c});var a=s(73365),r=s(1521),n=s(38334),l=s(39457),d=s(24945),i=s(57042),o=s(64683);let x=["","ios","android"];function c(){let{can:e}=(0,d.b)(),{get:t,post:s}=(0,l.Z)(),[c,m]=(0,r.useState)([]),[u,p]=(0,r.useState)(!0),[h,b]=(0,r.useState)(""),[f,g]=(0,r.useState)({runtimeVersion:"",platform:"",channel:""}),[j,N]=(0,r.useState)(null),y=e(i.Jj.otaManage),v=(0,r.useCallback)(async()=>{p(!0),b("");try{let e=new URLSearchParams;f.runtimeVersion&&e.set("runtimeVersion",f.runtimeVersion),f.platform&&e.set("platform",f.platform),f.channel&&e.set("channel",f.channel);let s=await t(`${i.lb.ota}?${e}`);m(s.items||[])}catch(e){b(e.message)}finally{p(!1)}},[t,f.runtimeVersion,f.platform,f.channel]);(0,r.useEffect)(()=>{v()},[]);let w=async e=>{if(confirm(`Promote #${e.buildNumber} to serving for channel "${e.channel}" (${e.platform}, ${e.runtimeVersion})?`)){N(e.id);try{await s(`${i.lb.ota}/${e.id}/promote`),await v()}catch(e){b(e.message)}finally{N(null)}}};return(0,a.jsx)(n.A,{children:(0,a.jsxs)("div",{className:"space-y-8 max-w-5xl",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("h1",{className:"text-2xl font-bold tracking-tight text-text login-hero-grad flex items-center gap-2.5",children:[(0,a.jsx)(o.lP,{size:24,className:"text-brand-500"}),(0,a.jsx)("span",{children:"OTA Updates"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Publish, promote and rollback mobile application bundles"})]}),(0,a.jsxs)("button",{onClick:v,disabled:u,className:"inline-flex items-center gap-2 px-3.5 py-1.5 rounded-xl bg-surface-2 hover:bg-surface-3 border border-border-subtle text-xs font-medium text-text transition-colors disabled:opacity-50",children:[(0,a.jsx)(o.e9,{size:13,className:u?"animate-spin text-brand-500":""}),(0,a.jsx)("span",{children:"Refresh"})]})]}),(0,a.jsxs)("div",{className:"card-glass p-4 grid grid-cols-1 sm:grid-cols-4 gap-3",children:[(0,a.jsx)("input",{className:"px-3 py-2 text-xs border border-border-subtle rounded-xl bg-surface-2/80 text-text placeholder:text-text-subtle focus:outline-none focus:ring-2 focus:ring-brand-500/30 font-mono",placeholder:"Runtime (e.g. 0.1.7)",value:f.runtimeVersion,onChange:e=>g({...f,runtimeVersion:e.target.value})}),(0,a.jsx)("select",{className:"px-3 py-2 text-xs border border-border-subtle rounded-xl bg-surface-2/80 text-text focus:outline-none focus:ring-2 focus:ring-brand-500/30",value:f.platform,onChange:e=>g({...f,platform:e.target.value}),children:x.map(e=>(0,a.jsx)("option",{value:e,children:e?e.toUpperCase():"All platforms"},e))}),(0,a.jsx)("input",{className:"px-3 py-2 text-xs border border-border-subtle rounded-xl bg-surface-2/80 text-text placeholder:text-text-subtle focus:outline-none focus:ring-2 focus:ring-brand-500/30 font-mono",placeholder:"Channel (e.g. production)",value:f.channel,onChange:e=>g({...f,channel:e.target.value})}),(0,a.jsx)("button",{onClick:v,className:"px-4 py-2 text-xs font-semibold bg-brand-500 text-white rounded-xl hover:bg-brand-600 shadow-[0_4px_12px_-4px_rgba(255,87,10,0.5)] transition-all",children:"Filter Bundles"})]}),h&&(0,a.jsx)("p",{className:"text-xs text-danger bg-red-500/10 p-3 rounded-xl border border-red-500/20",children:h}),u?(0,a.jsxs)("div",{className:"card-glass p-12 text-center text-text-muted text-xs",children:[(0,a.jsx)(o.e9,{size:20,className:"mx-auto mb-2 animate-spin text-brand-500"}),"Loading updates catalog..."]}):0===c.length?(0,a.jsxs)("div",{className:"card-glass p-12 text-center",children:[(0,a.jsx)("div",{className:"w-12 h-12 rounded-2xl bg-surface-2 flex items-center justify-center mx-auto mb-3 text-text-subtle",children:(0,a.jsx)(o.lP,{size:24})}),(0,a.jsx)("h3",{className:"text-sm font-semibold text-text",children:"No updates published"}),(0,a.jsxs)("p",{className:"text-text-muted text-xs mt-1",children:["Publish an OTA update package with ",(0,a.jsx)("code",{className:"text-brand-500 font-mono px-1.5 py-0.5 rounded bg-surface-2",children:"npm run update"})]})]}):(0,a.jsx)("div",{className:"card-glass overflow-hidden",children:(0,a.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,a.jsx)("thead",{className:"bg-surface-2/60 border-b border-border-subtle text-[11px] font-mono uppercase tracking-wider text-text-muted",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-4 py-3",children:"Build"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Runtime"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Platform"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Channel"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Published"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Status"}),y&&(0,a.jsx)("th",{className:"px-4 py-3 text-right",children:"Actions"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-border-subtle/50",children:c.map(e=>(0,a.jsxs)("tr",{className:"hover:bg-surface-2/40 transition-colors",children:[(0,a.jsxs)("td",{className:"px-4 py-3.5",children:[(0,a.jsxs)("div",{className:"font-medium text-text",children:[(0,a.jsxs)("span",{className:"text-brand-500 font-mono font-bold mr-2",children:["#",e.buildNumber]}),(0,a.jsx)("span",{children:e.message||"(no message)"})]}),(0,a.jsx)("div",{className:"text-[10px] text-text-subtle font-mono mt-0.5",children:e.id.slice(0,8)})]}),(0,a.jsx)("td",{className:"px-4 py-3.5 text-xs font-mono text-text-muted",children:e.runtimeVersion}),(0,a.jsx)("td",{className:"px-4 py-3.5",children:(0,a.jsx)("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-mono font-bold uppercase tracking-wider border ${"ios"===e.platform?"bg-sky-500/10 text-sky-500 border-sky-500/20":"bg-emerald-500/10 text-emerald-500 border-emerald-500/20"}`,children:e.platform})}),(0,a.jsx)("td",{className:"px-4 py-3.5",children:(0,a.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-mono bg-surface-2 border border-border-subtle text-text",children:e.channel})}),(0,a.jsx)("td",{className:"px-4 py-3.5 text-xs text-text-muted font-mono",children:(e=>{if(!e)return"-";try{return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}})(e.publishedAt||e.createdAt)}),(0,a.jsx)("td",{className:"px-4 py-3.5",children:e.isServing?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-500 border border-emerald-500/20",children:[(0,a.jsx)(o.Jl,{size:13}),(0,a.jsx)("span",{children:"Serving"})]}):(0,a.jsx)("span",{className:"text-xs font-mono text-text-subtle px-2 py-0.5 rounded bg-surface-2",children:e.status})}),y&&(0,a.jsx)("td",{className:"px-4 py-3.5 text-right",children:!e.isServing&&(0,a.jsxs)("button",{onClick:()=>w(e),disabled:j===e.id,className:"inline-flex items-center gap-1 text-xs font-semibold text-brand-500 hover:text-brand-400 px-2.5 py-1 rounded-lg hover:bg-brand-500/10 transition-colors disabled:opacity-50",children:[(0,a.jsx)("span",{children:j===e.id?"Promoting...":"Promote"}),(0,a.jsx)(o.F1,{size:13})]})})]},e.id))})]})})]})})}},62554:(e,t,s)=>{Promise.resolve().then(s.bind(s,52840))}},e=>{e.O(0,[7738,9568,9958,8334,2347,5158,7358],()=>e(e.s=62554)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8535],{52840:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>c});var a=s(73365),r=s(1521),n=s(38334),l=s(39457),d=s(24945),i=s(57042),o=s(64683);let x=["","ios","android"];function c(){let{can:e}=(0,d.b)(),{get:t,post:s}=(0,l.Z)(),[c,m]=(0,r.useState)([]),[u,p]=(0,r.useState)(!0),[h,b]=(0,r.useState)(""),[f,g]=(0,r.useState)({runtimeVersion:"",platform:"",channel:""}),[j,N]=(0,r.useState)(null),y=e(i.Jj.otaManage),v=(0,r.useCallback)(async()=>{p(!0),b("");try{let e=new URLSearchParams;f.runtimeVersion&&e.set("runtimeVersion",f.runtimeVersion),f.platform&&e.set("platform",f.platform),f.channel&&e.set("channel",f.channel);let s=await t(`${i.lb.ota}?${e}`);m(s.items||[])}catch(e){b(e.message)}finally{p(!1)}},[t,f.runtimeVersion,f.platform,f.channel]);(0,r.useEffect)(()=>{v()},[]);let w=async e=>{if(confirm(`Promote #${e.buildNumber} to serving for channel "${e.channel}" (${e.platform}, ${e.runtimeVersion})?`)){N(e.id);try{await s(`${i.lb.ota}/${e.id}/promote`),await v()}catch(e){b(e.message)}finally{N(null)}}};return(0,a.jsx)(n.A,{children:(0,a.jsxs)("div",{className:"space-y-8 max-w-5xl",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("h1",{className:"text-2xl font-bold tracking-tight text-text login-hero-grad flex items-center gap-2.5",children:[(0,a.jsx)(o.lP,{size:24,className:"text-brand-500"}),(0,a.jsx)("span",{children:"OTA Updates"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Publish, promote and rollback mobile application bundles"})]}),(0,a.jsxs)("button",{onClick:v,disabled:u,className:"inline-flex items-center gap-2 px-3.5 py-1.5 rounded-xl bg-surface-2 hover:bg-surface-3 border border-border-subtle text-xs font-medium text-text transition-colors disabled:opacity-50",children:[(0,a.jsx)(o.e9,{size:13,className:u?"animate-spin text-brand-500":""}),(0,a.jsx)("span",{children:"Refresh"})]})]}),(0,a.jsxs)("div",{className:"card-glass p-4 grid grid-cols-1 sm:grid-cols-4 gap-3",children:[(0,a.jsx)("input",{className:"px-3 py-2 text-xs border border-border-subtle rounded-xl bg-surface-2/80 text-text placeholder:text-text-subtle focus:outline-none focus:ring-2 focus:ring-brand-500/30 font-mono",placeholder:"Runtime (e.g. 0.1.7)",value:f.runtimeVersion,onChange:e=>g({...f,runtimeVersion:e.target.value})}),(0,a.jsx)("select",{className:"px-3 py-2 text-xs border border-border-subtle rounded-xl bg-surface-2/80 text-text focus:outline-none focus:ring-2 focus:ring-brand-500/30",value:f.platform,onChange:e=>g({...f,platform:e.target.value}),children:x.map(e=>(0,a.jsx)("option",{value:e,children:e?e.toUpperCase():"All platforms"},e))}),(0,a.jsx)("input",{className:"px-3 py-2 text-xs border border-border-subtle rounded-xl bg-surface-2/80 text-text placeholder:text-text-subtle focus:outline-none focus:ring-2 focus:ring-brand-500/30 font-mono",placeholder:"Channel (e.g. production)",value:f.channel,onChange:e=>g({...f,channel:e.target.value})}),(0,a.jsx)("button",{onClick:v,className:"px-4 py-2 text-xs font-semibold bg-brand-500 text-white rounded-xl hover:bg-brand-600 shadow-[0_4px_12px_-4px_rgba(255,87,10,0.5)] transition-all",children:"Filter Bundles"})]}),h&&(0,a.jsx)("p",{className:"text-xs text-danger bg-red-500/10 p-3 rounded-xl border border-red-500/20",children:h}),u?(0,a.jsxs)("div",{className:"card-glass p-12 text-center text-text-muted text-xs",children:[(0,a.jsx)(o.e9,{size:20,className:"mx-auto mb-2 animate-spin text-brand-500"}),"Loading updates catalog..."]}):0===c.length?(0,a.jsxs)("div",{className:"card-glass p-12 text-center",children:[(0,a.jsx)("div",{className:"w-12 h-12 rounded-2xl bg-surface-2 flex items-center justify-center mx-auto mb-3 text-text-subtle",children:(0,a.jsx)(o.lP,{size:24})}),(0,a.jsx)("h3",{className:"text-sm font-semibold text-text",children:"No updates published"}),(0,a.jsxs)("p",{className:"text-text-muted text-xs mt-1",children:["Publish an OTA update package with ",(0,a.jsx)("code",{className:"text-brand-500 font-mono px-1.5 py-0.5 rounded bg-surface-2",children:"npm run update"})]})]}):(0,a.jsx)("div",{className:"card-glass overflow-hidden",children:(0,a.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,a.jsx)("thead",{className:"bg-surface-2/60 border-b border-border-subtle text-[11px] font-mono uppercase tracking-wider text-text-muted",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-4 py-3",children:"Build"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Runtime"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Platform"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Channel"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Published"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Status"}),y&&(0,a.jsx)("th",{className:"px-4 py-3 text-right",children:"Actions"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-border-subtle/50",children:c.map(e=>(0,a.jsxs)("tr",{className:"hover:bg-surface-2/40 transition-colors",children:[(0,a.jsxs)("td",{className:"px-4 py-3.5",children:[(0,a.jsxs)("div",{className:"font-medium text-text",children:[(0,a.jsxs)("span",{className:"text-brand-500 font-mono font-bold mr-2",children:["#",e.buildNumber]}),(0,a.jsx)("span",{children:e.message||"(no message)"})]}),(0,a.jsx)("div",{className:"text-[10px] text-text-subtle font-mono mt-0.5",children:e.id.slice(0,8)})]}),(0,a.jsx)("td",{className:"px-4 py-3.5 text-xs font-mono text-text-muted",children:e.runtimeVersion}),(0,a.jsx)("td",{className:"px-4 py-3.5",children:(0,a.jsx)("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-mono font-bold uppercase tracking-wider border ${"ios"===e.platform?"bg-sky-500/10 text-sky-500 border-sky-500/20":"bg-emerald-500/10 text-emerald-500 border-emerald-500/20"}`,children:e.platform})}),(0,a.jsx)("td",{className:"px-4 py-3.5",children:(0,a.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-mono bg-surface-2 border border-border-subtle text-text",children:e.channel})}),(0,a.jsx)("td",{className:"px-4 py-3.5 text-xs text-text-muted font-mono",children:(e=>{if(!e)return"-";try{return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}})(e.publishedAt||e.createdAt)}),(0,a.jsx)("td",{className:"px-4 py-3.5",children:e.isServing?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-500 border border-emerald-500/20",children:[(0,a.jsx)(o.Jl,{size:13}),(0,a.jsx)("span",{children:"Serving"})]}):(0,a.jsx)("span",{className:"text-xs font-mono text-text-subtle px-2 py-0.5 rounded bg-surface-2",children:e.status})}),y&&(0,a.jsx)("td",{className:"px-4 py-3.5 text-right",children:!e.isServing&&(0,a.jsxs)("button",{onClick:()=>w(e),disabled:j===e.id,className:"inline-flex items-center gap-1 text-xs font-semibold text-brand-500 hover:text-brand-400 px-2.5 py-1 rounded-lg hover:bg-brand-500/10 transition-colors disabled:opacity-50",children:[(0,a.jsx)("span",{children:j===e.id?"Promoting...":"Promote"}),(0,a.jsx)(o.F1,{size:13})]})})]},e.id))})]})})]})})}},62554:(e,t,s)=>{Promise.resolve().then(s.bind(s,52840))}},e=>{e.O(0,[161,9568,9958,8334,2347,5158,7358],()=>e(e.s=62554)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3698],{42761:(e,t,s)=>{Promise.resolve().then(s.bind(s,68577))},68577:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>y});var l=s(73365),a=s(1521),r=s(38334),n=s(64683);let i=[{key:"total",label:"Total",icon:n.BK,color:"text-text",iconColor:"text-text-muted bg-surface-2"},{key:"online",label:"Online (30m)",icon:n.Kq,color:"text-success",iconColor:"text-success bg-emerald-500/10",pulse:!0},{key:"newToday",label:"New (24h)",icon:n.sU,color:"text-brand-500",iconColor:"text-brand-500 bg-brand-500/10"},{key:"retention7d",label:"Retention 7d",icon:n.BZ,color:"text-text",iconColor:"text-text-muted bg-surface-2",suffix:"%"},{key:"stickiness",label:"Stickiness",icon:n.FE,color:"text-amber-500",iconColor:"text-amber-500 bg-amber-500/10",suffix:"%"},{key:"avgLifespanDays",label:"Avg Lifespan",icon:n.kt,color:"text-text",iconColor:"text-text-muted bg-surface-2",suffix:"d"}];function c({stats:e}){return(0,l.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3 sm:gap-4",children:i.map(t=>{let s=t.icon,a=e?.[t.key];return(0,l.jsxs)("div",{className:"card-glass p-4 relative overflow-hidden transition-all duration-200 hover:-translate-y-0.5 group",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,l.jsx)("span",{className:"text-[11px] font-mono tracking-wider uppercase text-text-muted truncate",children:t.label}),(0,l.jsx)("div",{className:`w-7 h-7 rounded-lg flex items-center justify-center ${t.iconColor} transition-transform group-hover:scale-110`,children:(0,l.jsx)(s,{size:14})})]}),(0,l.jsxs)("div",{className:"flex items-baseline gap-1.5 mt-1",children:[(0,l.jsx)("div",{className:`text-2xl sm:text-3xl font-bold tracking-tight font-mono ${t.color}`,children:a??"-"}),null!=a&&t.suffix&&(0,l.jsx)("span",{className:"text-xs font-mono text-text-subtle font-semibold",children:t.suffix})]}),t.pulse&&(0,l.jsxs)("div",{className:"absolute bottom-2 right-2 flex items-center gap-1.5",children:[(0,l.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,l.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),(0,l.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]}),(0,l.jsx)("span",{className:"text-[10px] font-mono text-emerald-500 font-medium",children:"live"})]})]},t.key)})})}var d=s(57042);let o=[{key:"machineId",label:"Machine ID",sortable:!0},{key:"publicIp",label:"Public IP",sortable:!1},{key:"localIp",label:"Local IP",sortable:!1},{key:"createdAt",label:"Created",sortable:!0},{key:"lastAccessAt",label:"Last Access",sortable:!0},{key:"expiresAt",label:"Expires",sortable:!0}],x=o.filter(e=>e.sortable);function m(e){let t=e?.lastAccessAt||e?.createdAt;return!!t&&Date.now()-new Date(t+"Z").getTime()<d.Qh}function u(e){if(!e)return"-";try{return new Date(e+"Z").toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}}function p({session:e}){let{tier:t,ageMs:s}=function(e){let t={tier:d.rK[d.rK.length-1],ageMs:null};if(!e?.createdAt||!e?.lastAccessAt)return t;let s=new Date(e.lastAccessAt+"Z").getTime()-new Date(e.createdAt+"Z").getTime();return{tier:d.rK.find(e=>s>=e.minMs)||t.tier,ageMs:s}}(e),a="loyal"===t.key?"bg-emerald-500/10 text-emerald-500 border-emerald-500/20":"returning"===t.key?"bg-brand-500/10 text-brand-500 border-brand-500/20":"active"===t.key?"bg-amber-500/10 text-amber-500 border-amber-500/20":"bg-surface-2 text-text-muted border-border-subtle";return(0,l.jsxs)("div",{className:"inline-flex items-center gap-1.5",children:[(0,l.jsx)("span",{className:`px-2 py-0.5 rounded-full text-[11px] font-medium border ${a}`,children:t.label}),null!=s&&(0,l.jsx)("span",{className:"text-text-subtle text-[11px] font-mono",children:function(e){if(null==e||e<0)return"-";let t=Math.floor(e/6e4);if(t<1)return"<1m";let s=Math.floor(t/1440),l=Math.floor(t%1440/60),a=t%60;return s>0?`${s}d ${l}h`:l>0?`${l}h ${a}m`:`${a}m`}(s)})]})}function b({items:e,sortBy:t,order:s,onSortChange:a,onDelete:r,canDelete:i}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"md:hidden flex items-center justify-between mb-3 text-xs",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"text-text-muted",children:"Sort by:"}),(0,l.jsx)("select",{value:t,onChange:e=>a(e.target.value,s),className:"bg-surface-2 border border-border-subtle rounded-lg px-2.5 py-1.5 text-text focus:outline-none",children:x.map(e=>(0,l.jsx)("option",{value:e.key,children:e.label},e.key))})]}),(0,l.jsxs)("button",{onClick:()=>a(t,"asc"===s?"desc":"asc"),className:"flex items-center gap-1 bg-surface-2 hover:bg-surface-3 border border-border-subtle rounded-lg px-2.5 py-1.5 text-text transition-colors","aria-label":"Toggle order",children:[(0,l.jsx)("span",{className:"font-mono uppercase",children:s}),"asc"===s?(0,l.jsx)(n.Do,{size:13}):(0,l.jsx)(n.yd,{size:13})]})]}),(0,l.jsxs)("div",{className:"md:hidden space-y-3",children:[0===e.length&&(0,l.jsxs)("div",{className:"card-glass p-8 text-center text-text-muted flex flex-col items-center justify-center",children:[(0,l.jsx)(n.BK,{size:24,className:"mb-2 text-text-subtle"}),(0,l.jsx)("p",{className:"text-sm",children:"No active sessions found"})]}),e.map(e=>{let t=m(e);return(0,l.jsxs)("div",{className:"card-glass overflow-hidden text-sm",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between px-3.5 py-2.5 bg-surface-2/60 border-b border-border-subtle",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,l.jsx)("span",{className:"relative flex h-2 w-2",children:t?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),(0,l.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]}):(0,l.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-neutral-500/40"})}),(0,l.jsx)("span",{className:"font-mono text-xs font-semibold tracking-tight text-text truncate",children:e.machineId})]}),i&&(0,l.jsx)("button",{onClick:()=>r(e.machineId),className:"text-text-muted hover:text-danger p-1 rounded hover:bg-red-500/10 transition-colors",title:"Delete session",children:(0,l.jsx)(n.TB,{size:15})})]}),(0,l.jsxs)("div",{className:"p-3.5 space-y-2 text-xs",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)("span",{className:"text-text-muted",children:"Loyalty"}),(0,l.jsx)(p,{session:e})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-2 pt-1 border-t border-border-subtle/40",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"text-[10px] uppercase font-mono text-text-subtle block",children:"Public IP"}),(0,l.jsx)("span",{className:"font-mono text-text truncate block",children:e.publicIp||"-"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"text-[10px] uppercase font-mono text-text-subtle block",children:"Local IP"}),(0,l.jsx)("span",{className:"font-mono text-text truncate block",children:e.localIp||"-"})]})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-2 pt-1 border-t border-border-subtle/40 text-[11px] text-text-muted",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"text-text-subtle block",children:"Created"}),(0,l.jsx)("span",{children:u(e.createdAt)})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"text-text-subtle block",children:"Last Access"}),(0,l.jsx)("span",{className:"text-text",children:u(e.lastAccessAt)})]})]})]})]},e.machineId)})]}),(0,l.jsx)("div",{className:"hidden md:block card-glass overflow-hidden",children:(0,l.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,l.jsx)("thead",{className:"bg-surface-2/60 border-b border-border-subtle text-[11px] font-mono uppercase tracking-wider text-text-muted",children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{className:"px-4 py-3 w-12 text-center",children:"Live"}),(0,l.jsx)("th",{className:"px-4 py-3",children:"Loyalty"}),o.map(e=>(0,l.jsx)("th",{onClick:()=>{var l;return e.sortable&&(l=e.key,void(d.GS.includes(l)&&(t===l?a(l,"asc"===s?"desc":"asc"):a(l,"desc"))))},className:`px-4 py-3 ${e.sortable?"cursor-pointer hover:text-text select-none group":""}`,children:(0,l.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[e.label,e.sortable&&(0,l.jsx)("span",{className:t===e.key?"text-brand-500":"text-text-subtle opacity-40 group-hover:opacity-100",children:t===e.key&&"asc"===s?(0,l.jsx)(n.Do,{size:12}):(0,l.jsx)(n.yd,{size:12})})]})},e.key)),i&&(0,l.jsx)("th",{className:"px-4 py-3 text-right",children:"Action"})]})}),(0,l.jsxs)("tbody",{className:"divide-y divide-border-subtle/50",children:[0===e.length&&(0,l.jsx)("tr",{children:(0,l.jsxs)("td",{colSpan:o.length+3,className:"px-4 py-12 text-center text-text-muted",children:[(0,l.jsx)(n.BK,{size:28,className:"mx-auto mb-2 text-text-subtle"}),(0,l.jsx)("p",{children:"No active sessions found"})]})}),e.map(e=>{let t=m(e);return(0,l.jsxs)("tr",{className:"hover:bg-surface-2/40 transition-colors",children:[(0,l.jsx)("td",{className:"px-4 py-3 text-center",children:(0,l.jsx)("span",{className:"relative inline-flex h-2 w-2",children:t?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),(0,l.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]}):(0,l.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-neutral-500/40"})})}),(0,l.jsx)("td",{className:"px-4 py-3",children:(0,l.jsx)(p,{session:e})}),(0,l.jsx)("td",{className:"px-4 py-3 font-mono text-xs font-medium text-text",children:e.machineId}),(0,l.jsx)("td",{className:"px-4 py-3 font-mono text-xs text-text-muted",children:e.publicIp||"-"}),(0,l.jsx)("td",{className:"px-4 py-3 font-mono text-xs text-text-muted",children:e.localIp||"-"}),(0,l.jsx)("td",{className:"px-4 py-3 text-xs text-text-muted",children:u(e.createdAt)}),(0,l.jsx)("td",{className:"px-4 py-3 text-xs text-text font-medium",children:u(e.lastAccessAt)}),(0,l.jsx)("td",{className:"px-4 py-3 text-xs text-text-muted",children:u(e.expiresAt)}),i&&(0,l.jsx)("td",{className:"px-4 py-3 text-right",children:(0,l.jsx)("button",{onClick:()=>r(e.machineId),className:"text-text-muted hover:text-danger p-1.5 rounded-lg hover:bg-red-500/10 transition-colors",title:"Delete session",children:(0,l.jsx)(n.TB,{size:15})})})]},e.machineId)})]})]})})]})}function h({page:e,pageSize:t,total:s,onPageChange:a,onPageSizeChange:r}){let i=Math.max(1,Math.ceil(s/t));return(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 mt-4 text-xs text-text-muted",children:[(0,l.jsxs)("div",{className:"flex items-center gap-1.5 font-mono",children:[(0,l.jsx)("span",{children:"Total:"}),(0,l.jsx)("span",{className:"text-text font-semibold px-1.5 py-0.5 rounded bg-surface-2 border border-border-subtle",children:s})]}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)("select",{value:t,onChange:e=>r(parseInt(e.target.value,10)),className:"bg-surface-2 border border-border-subtle rounded-lg px-2.5 py-1 text-text text-xs focus:outline-none",children:d.xp.map(e=>(0,l.jsxs)("option",{value:e,children:[e," / page"]},e))}),(0,l.jsxs)("div",{className:"flex items-center gap-1",children:[(0,l.jsx)("button",{onClick:()=>a(Math.max(1,e-1)),disabled:e<=1,className:"p-1.5 rounded-lg bg-surface-2 hover:bg-surface-3 border border-border-subtle text-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors","aria-label":"Previous page",children:(0,l.jsx)(n.JG,{size:14})}),(0,l.jsxs)("span",{className:"px-2.5 py-1 font-mono text-xs text-text",children:[e," / ",i]}),(0,l.jsx)("button",{onClick:()=>a(Math.min(i,e+1)),disabled:e>=i,className:"p-1.5 rounded-lg bg-surface-2 hover:bg-surface-3 border border-border-subtle text-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors","aria-label":"Next page",children:(0,l.jsx)(n.c_,{size:14})})]})]})]})}let f={ok:"Success",badPassword:"Wrong password",unknownUser:"Unknown user",turnstile:"Captcha failed",locked:"Locked out"};function j({items:e}){return(0,l.jsxs)("section",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(n.ek,{size:16,className:"text-brand-500"}),(0,l.jsx)("h2",{className:"text-base font-semibold tracking-tight text-text",children:"Login Activity"}),(0,l.jsxs)("span",{className:"text-xs text-text-subtle font-mono",children:["last ",e.length]})]}),(0,l.jsx)("div",{className:"card-glass overflow-hidden",children:(0,l.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,l.jsx)("thead",{className:"bg-surface-2/60 border-b border-border-subtle text-[11px] font-mono uppercase tracking-wider text-text-muted",children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{className:"px-4 py-2.5",children:"Time"}),(0,l.jsx)("th",{className:"px-4 py-2.5",children:"User"}),(0,l.jsx)("th",{className:"px-4 py-2.5",children:"IP"}),(0,l.jsx)("th",{className:"px-4 py-2.5 text-right",children:"Result"})]})}),(0,l.jsxs)("tbody",{className:"divide-y divide-border-subtle/50",children:[0===e.length&&(0,l.jsx)("tr",{children:(0,l.jsx)("td",{colSpan:4,className:"px-4 py-8 text-center text-text-muted",children:"No login attempts recorded yet"})}),e.map((e,t)=>(0,l.jsxs)("tr",{className:"hover:bg-surface-2/40 transition-colors",children:[(0,l.jsx)("td",{className:"px-4 py-2.5 text-xs text-text-muted whitespace-nowrap",children:function(e){try{return new Date(e+"Z").toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}}(e.createdAt)}),(0,l.jsx)("td",{className:"px-4 py-2.5 font-mono text-xs text-text",children:e.username}),(0,l.jsx)("td",{className:"px-4 py-2.5 font-mono text-xs text-text-muted",children:e.ip}),(0,l.jsx)("td",{className:"px-4 py-2.5 text-right",children:e.ok?(0,l.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-medium border bg-emerald-500/10 text-emerald-500 border-emerald-500/20",children:[(0,l.jsx)(n.ek,{size:11})," OK"]}):(0,l.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-medium border bg-red-500/10 text-danger border-red-500/20",children:[(0,l.jsx)(n.RI,{size:11})," ",f[e.reason]||e.reason]})})]},t))]})]})})]})}var g=s(39457),N=s(24945);function y(){let{can:e}=(0,N.b)(),{get:t,del:s}=(0,g.Z)(),[i,o]=(0,a.useState)(null),[x,m]=(0,a.useState)([]),[u,p]=(0,a.useState)([]),[f,y]=(0,a.useState)(0),[v,k]=(0,a.useState)(""),[w,A]=(0,a.useState)("lastAccessAt"),[S,C]=(0,a.useState)("desc"),[I,z]=(0,a.useState)(1),[D,P]=(0,a.useState)(d.Wm),[L,$]=(0,a.useState)(!1),M=(0,a.useCallback)(async()=>{$(!0);try{let s=new URLSearchParams({search:v,sortBy:w,order:S,page:String(I),pageSize:String(D)}),l=[t(`${d.lb.sessions}?${s.toString()}`),t(d.lb.stats)];e(d.Jj.logView)&&l.push(t(d.lb.logins));let[a,r,n]=await Promise.all(l);p(a.items||[]),y(a.total||0),o(r),n&&m(n.items||[])}catch(e){console.error(e)}finally{$(!1)}},[e,t,v,w,S,I,D]);(0,a.useEffect)(()=>{M()},[M]);let T=async e=>{confirm(`Delete session ${e}?`)&&(await s(`${d.lb.sessions}/${e}`),M())};return(0,l.jsx)(r.A,{children:(0,l.jsxs)("div",{className:"space-y-8",children:[(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"text-2xl font-bold tracking-tight text-text login-hero-grad",children:"System Overview"}),(0,l.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Real-time telemetry and active host instances"})]}),(0,l.jsxs)("button",{onClick:M,disabled:L,className:"self-start sm:self-auto inline-flex items-center gap-2 px-3.5 py-1.5 rounded-xl bg-surface-2 hover:bg-surface-3 border border-border-subtle text-xs font-medium text-text transition-colors disabled:opacity-50",children:[(0,l.jsx)(n.e9,{size:13,className:L?"animate-spin text-brand-500":""}),(0,l.jsx)("span",{children:"Refresh"})]})]}),(0,l.jsx)("section",{children:(0,l.jsx)(c,{stats:i})}),e(d.Jj.logView)&&(0,l.jsx)(j,{items:x}),(0,l.jsxs)("section",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-lg font-bold tracking-tight text-text",children:"Active Sessions"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Connected and registered client sessions"})]}),(0,l.jsxs)("div",{className:"relative w-full sm:w-80",children:[(0,l.jsx)(n.vj,{size:15,className:"absolute left-3.5 top-1/2 -translate-y-1/2 text-text-muted"}),(0,l.jsx)("input",{value:v,onChange:e=>{k(e.target.value),z(1)},placeholder:"Search machineId, IP address...",className:"w-full pl-9 pr-3.5 py-2 bg-surface-2/80 border border-border-subtle rounded-xl text-text text-xs placeholder:text-text-subtle focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40 transition-all font-mono"})]})]}),(0,l.jsx)(b,{items:u,sortBy:w,order:S,onSortChange:(e,t)=>{A(e),C(t),z(1)},onDelete:T,canDelete:e(d.Jj.sessionDelete)}),(0,l.jsx)(h,{page:I,pageSize:D,total:f,onPageChange:z,onPageSizeChange:e=>{P(e),z(1)}})]})]})})}}},e=>{e.O(0,[7738,9568,9958,8334,2347,5158,7358],()=>e(e.s=42761)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3698],{42761:(e,t,s)=>{Promise.resolve().then(s.bind(s,68577))},68577:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>y});var l=s(73365),a=s(1521),r=s(38334),n=s(64683);let i=[{key:"total",label:"Total",icon:n.BK,color:"text-text",iconColor:"text-text-muted bg-surface-2"},{key:"online",label:"Online (30m)",icon:n.Kq,color:"text-success",iconColor:"text-success bg-emerald-500/10",pulse:!0},{key:"newToday",label:"New (24h)",icon:n.sU,color:"text-brand-500",iconColor:"text-brand-500 bg-brand-500/10"},{key:"retention7d",label:"Retention 7d",icon:n.BZ,color:"text-text",iconColor:"text-text-muted bg-surface-2",suffix:"%"},{key:"stickiness",label:"Stickiness",icon:n.FE,color:"text-amber-500",iconColor:"text-amber-500 bg-amber-500/10",suffix:"%"},{key:"avgLifespanDays",label:"Avg Lifespan",icon:n.kt,color:"text-text",iconColor:"text-text-muted bg-surface-2",suffix:"d"}];function c({stats:e}){return(0,l.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3 sm:gap-4",children:i.map(t=>{let s=t.icon,a=e?.[t.key];return(0,l.jsxs)("div",{className:"card-glass p-4 relative overflow-hidden transition-all duration-200 hover:-translate-y-0.5 group",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,l.jsx)("span",{className:"text-[11px] font-mono tracking-wider uppercase text-text-muted truncate",children:t.label}),(0,l.jsx)("div",{className:`w-7 h-7 rounded-lg flex items-center justify-center ${t.iconColor} transition-transform group-hover:scale-110`,children:(0,l.jsx)(s,{size:14})})]}),(0,l.jsxs)("div",{className:"flex items-baseline gap-1.5 mt-1",children:[(0,l.jsx)("div",{className:`text-2xl sm:text-3xl font-bold tracking-tight font-mono ${t.color}`,children:a??"-"}),null!=a&&t.suffix&&(0,l.jsx)("span",{className:"text-xs font-mono text-text-subtle font-semibold",children:t.suffix})]}),t.pulse&&(0,l.jsxs)("div",{className:"absolute bottom-2 right-2 flex items-center gap-1.5",children:[(0,l.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,l.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),(0,l.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]}),(0,l.jsx)("span",{className:"text-[10px] font-mono text-emerald-500 font-medium",children:"live"})]})]},t.key)})})}var d=s(57042);let o=[{key:"machineId",label:"Machine ID",sortable:!0},{key:"publicIp",label:"Public IP",sortable:!1},{key:"localIp",label:"Local IP",sortable:!1},{key:"createdAt",label:"Created",sortable:!0},{key:"lastAccessAt",label:"Last Access",sortable:!0},{key:"expiresAt",label:"Expires",sortable:!0}],x=o.filter(e=>e.sortable);function m(e){let t=e?.lastAccessAt||e?.createdAt;return!!t&&Date.now()-new Date(t+"Z").getTime()<d.Qh}function u(e){if(!e)return"-";try{return new Date(e+"Z").toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}}function p({session:e}){let{tier:t,ageMs:s}=function(e){let t={tier:d.rK[d.rK.length-1],ageMs:null};if(!e?.createdAt||!e?.lastAccessAt)return t;let s=new Date(e.lastAccessAt+"Z").getTime()-new Date(e.createdAt+"Z").getTime();return{tier:d.rK.find(e=>s>=e.minMs)||t.tier,ageMs:s}}(e),a="loyal"===t.key?"bg-emerald-500/10 text-emerald-500 border-emerald-500/20":"returning"===t.key?"bg-brand-500/10 text-brand-500 border-brand-500/20":"active"===t.key?"bg-amber-500/10 text-amber-500 border-amber-500/20":"bg-surface-2 text-text-muted border-border-subtle";return(0,l.jsxs)("div",{className:"inline-flex items-center gap-1.5",children:[(0,l.jsx)("span",{className:`px-2 py-0.5 rounded-full text-[11px] font-medium border ${a}`,children:t.label}),null!=s&&(0,l.jsx)("span",{className:"text-text-subtle text-[11px] font-mono",children:function(e){if(null==e||e<0)return"-";let t=Math.floor(e/6e4);if(t<1)return"<1m";let s=Math.floor(t/1440),l=Math.floor(t%1440/60),a=t%60;return s>0?`${s}d ${l}h`:l>0?`${l}h ${a}m`:`${a}m`}(s)})]})}function b({items:e,sortBy:t,order:s,onSortChange:a,onDelete:r,canDelete:i}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"md:hidden flex items-center justify-between mb-3 text-xs",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"text-text-muted",children:"Sort by:"}),(0,l.jsx)("select",{value:t,onChange:e=>a(e.target.value,s),className:"bg-surface-2 border border-border-subtle rounded-lg px-2.5 py-1.5 text-text focus:outline-none",children:x.map(e=>(0,l.jsx)("option",{value:e.key,children:e.label},e.key))})]}),(0,l.jsxs)("button",{onClick:()=>a(t,"asc"===s?"desc":"asc"),className:"flex items-center gap-1 bg-surface-2 hover:bg-surface-3 border border-border-subtle rounded-lg px-2.5 py-1.5 text-text transition-colors","aria-label":"Toggle order",children:[(0,l.jsx)("span",{className:"font-mono uppercase",children:s}),"asc"===s?(0,l.jsx)(n.Do,{size:13}):(0,l.jsx)(n.yd,{size:13})]})]}),(0,l.jsxs)("div",{className:"md:hidden space-y-3",children:[0===e.length&&(0,l.jsxs)("div",{className:"card-glass p-8 text-center text-text-muted flex flex-col items-center justify-center",children:[(0,l.jsx)(n.BK,{size:24,className:"mb-2 text-text-subtle"}),(0,l.jsx)("p",{className:"text-sm",children:"No active sessions found"})]}),e.map(e=>{let t=m(e);return(0,l.jsxs)("div",{className:"card-glass overflow-hidden text-sm",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between px-3.5 py-2.5 bg-surface-2/60 border-b border-border-subtle",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,l.jsx)("span",{className:"relative flex h-2 w-2",children:t?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),(0,l.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]}):(0,l.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-neutral-500/40"})}),(0,l.jsx)("span",{className:"font-mono text-xs font-semibold tracking-tight text-text truncate",children:e.machineId})]}),i&&(0,l.jsx)("button",{onClick:()=>r(e.machineId),className:"text-text-muted hover:text-danger p-1 rounded hover:bg-red-500/10 transition-colors",title:"Delete session",children:(0,l.jsx)(n.TB,{size:15})})]}),(0,l.jsxs)("div",{className:"p-3.5 space-y-2 text-xs",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)("span",{className:"text-text-muted",children:"Loyalty"}),(0,l.jsx)(p,{session:e})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-2 pt-1 border-t border-border-subtle/40",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"text-[10px] uppercase font-mono text-text-subtle block",children:"Public IP"}),(0,l.jsx)("span",{className:"font-mono text-text truncate block",children:e.publicIp||"-"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"text-[10px] uppercase font-mono text-text-subtle block",children:"Local IP"}),(0,l.jsx)("span",{className:"font-mono text-text truncate block",children:e.localIp||"-"})]})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-2 pt-1 border-t border-border-subtle/40 text-[11px] text-text-muted",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"text-text-subtle block",children:"Created"}),(0,l.jsx)("span",{children:u(e.createdAt)})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"text-text-subtle block",children:"Last Access"}),(0,l.jsx)("span",{className:"text-text",children:u(e.lastAccessAt)})]})]})]})]},e.machineId)})]}),(0,l.jsx)("div",{className:"hidden md:block card-glass overflow-hidden",children:(0,l.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,l.jsx)("thead",{className:"bg-surface-2/60 border-b border-border-subtle text-[11px] font-mono uppercase tracking-wider text-text-muted",children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{className:"px-4 py-3 w-12 text-center",children:"Live"}),(0,l.jsx)("th",{className:"px-4 py-3",children:"Loyalty"}),o.map(e=>(0,l.jsx)("th",{onClick:()=>{var l;return e.sortable&&(l=e.key,void(d.GS.includes(l)&&(t===l?a(l,"asc"===s?"desc":"asc"):a(l,"desc"))))},className:`px-4 py-3 ${e.sortable?"cursor-pointer hover:text-text select-none group":""}`,children:(0,l.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[e.label,e.sortable&&(0,l.jsx)("span",{className:t===e.key?"text-brand-500":"text-text-subtle opacity-40 group-hover:opacity-100",children:t===e.key&&"asc"===s?(0,l.jsx)(n.Do,{size:12}):(0,l.jsx)(n.yd,{size:12})})]})},e.key)),i&&(0,l.jsx)("th",{className:"px-4 py-3 text-right",children:"Action"})]})}),(0,l.jsxs)("tbody",{className:"divide-y divide-border-subtle/50",children:[0===e.length&&(0,l.jsx)("tr",{children:(0,l.jsxs)("td",{colSpan:o.length+3,className:"px-4 py-12 text-center text-text-muted",children:[(0,l.jsx)(n.BK,{size:28,className:"mx-auto mb-2 text-text-subtle"}),(0,l.jsx)("p",{children:"No active sessions found"})]})}),e.map(e=>{let t=m(e);return(0,l.jsxs)("tr",{className:"hover:bg-surface-2/40 transition-colors",children:[(0,l.jsx)("td",{className:"px-4 py-3 text-center",children:(0,l.jsx)("span",{className:"relative inline-flex h-2 w-2",children:t?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),(0,l.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]}):(0,l.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-neutral-500/40"})})}),(0,l.jsx)("td",{className:"px-4 py-3",children:(0,l.jsx)(p,{session:e})}),(0,l.jsx)("td",{className:"px-4 py-3 font-mono text-xs font-medium text-text",children:e.machineId}),(0,l.jsx)("td",{className:"px-4 py-3 font-mono text-xs text-text-muted",children:e.publicIp||"-"}),(0,l.jsx)("td",{className:"px-4 py-3 font-mono text-xs text-text-muted",children:e.localIp||"-"}),(0,l.jsx)("td",{className:"px-4 py-3 text-xs text-text-muted",children:u(e.createdAt)}),(0,l.jsx)("td",{className:"px-4 py-3 text-xs text-text font-medium",children:u(e.lastAccessAt)}),(0,l.jsx)("td",{className:"px-4 py-3 text-xs text-text-muted",children:u(e.expiresAt)}),i&&(0,l.jsx)("td",{className:"px-4 py-3 text-right",children:(0,l.jsx)("button",{onClick:()=>r(e.machineId),className:"text-text-muted hover:text-danger p-1.5 rounded-lg hover:bg-red-500/10 transition-colors",title:"Delete session",children:(0,l.jsx)(n.TB,{size:15})})})]},e.machineId)})]})]})})]})}function h({page:e,pageSize:t,total:s,onPageChange:a,onPageSizeChange:r}){let i=Math.max(1,Math.ceil(s/t));return(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 mt-4 text-xs text-text-muted",children:[(0,l.jsxs)("div",{className:"flex items-center gap-1.5 font-mono",children:[(0,l.jsx)("span",{children:"Total:"}),(0,l.jsx)("span",{className:"text-text font-semibold px-1.5 py-0.5 rounded bg-surface-2 border border-border-subtle",children:s})]}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)("select",{value:t,onChange:e=>r(parseInt(e.target.value,10)),className:"bg-surface-2 border border-border-subtle rounded-lg px-2.5 py-1 text-text text-xs focus:outline-none",children:d.xp.map(e=>(0,l.jsxs)("option",{value:e,children:[e," / page"]},e))}),(0,l.jsxs)("div",{className:"flex items-center gap-1",children:[(0,l.jsx)("button",{onClick:()=>a(Math.max(1,e-1)),disabled:e<=1,className:"p-1.5 rounded-lg bg-surface-2 hover:bg-surface-3 border border-border-subtle text-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors","aria-label":"Previous page",children:(0,l.jsx)(n.JG,{size:14})}),(0,l.jsxs)("span",{className:"px-2.5 py-1 font-mono text-xs text-text",children:[e," / ",i]}),(0,l.jsx)("button",{onClick:()=>a(Math.min(i,e+1)),disabled:e>=i,className:"p-1.5 rounded-lg bg-surface-2 hover:bg-surface-3 border border-border-subtle text-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors","aria-label":"Next page",children:(0,l.jsx)(n.c_,{size:14})})]})]})]})}let f={ok:"Success",badPassword:"Wrong password",unknownUser:"Unknown user",turnstile:"Captcha failed",locked:"Locked out"};function j({items:e}){return(0,l.jsxs)("section",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(n.ek,{size:16,className:"text-brand-500"}),(0,l.jsx)("h2",{className:"text-base font-semibold tracking-tight text-text",children:"Login Activity"}),(0,l.jsxs)("span",{className:"text-xs text-text-subtle font-mono",children:["last ",e.length]})]}),(0,l.jsx)("div",{className:"card-glass overflow-hidden",children:(0,l.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,l.jsx)("thead",{className:"bg-surface-2/60 border-b border-border-subtle text-[11px] font-mono uppercase tracking-wider text-text-muted",children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{className:"px-4 py-2.5",children:"Time"}),(0,l.jsx)("th",{className:"px-4 py-2.5",children:"User"}),(0,l.jsx)("th",{className:"px-4 py-2.5",children:"IP"}),(0,l.jsx)("th",{className:"px-4 py-2.5 text-right",children:"Result"})]})}),(0,l.jsxs)("tbody",{className:"divide-y divide-border-subtle/50",children:[0===e.length&&(0,l.jsx)("tr",{children:(0,l.jsx)("td",{colSpan:4,className:"px-4 py-8 text-center text-text-muted",children:"No login attempts recorded yet"})}),e.map((e,t)=>(0,l.jsxs)("tr",{className:"hover:bg-surface-2/40 transition-colors",children:[(0,l.jsx)("td",{className:"px-4 py-2.5 text-xs text-text-muted whitespace-nowrap",children:function(e){try{return new Date(e+"Z").toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}}(e.createdAt)}),(0,l.jsx)("td",{className:"px-4 py-2.5 font-mono text-xs text-text",children:e.username}),(0,l.jsx)("td",{className:"px-4 py-2.5 font-mono text-xs text-text-muted",children:e.ip}),(0,l.jsx)("td",{className:"px-4 py-2.5 text-right",children:e.ok?(0,l.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-medium border bg-emerald-500/10 text-emerald-500 border-emerald-500/20",children:[(0,l.jsx)(n.ek,{size:11})," OK"]}):(0,l.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-medium border bg-red-500/10 text-danger border-red-500/20",children:[(0,l.jsx)(n.RI,{size:11})," ",f[e.reason]||e.reason]})})]},t))]})]})})]})}var g=s(39457),N=s(24945);function y(){let{can:e}=(0,N.b)(),{get:t,del:s}=(0,g.Z)(),[i,o]=(0,a.useState)(null),[x,m]=(0,a.useState)([]),[u,p]=(0,a.useState)([]),[f,y]=(0,a.useState)(0),[v,k]=(0,a.useState)(""),[w,A]=(0,a.useState)("lastAccessAt"),[S,C]=(0,a.useState)("desc"),[I,z]=(0,a.useState)(1),[D,P]=(0,a.useState)(d.Wm),[L,$]=(0,a.useState)(!1),M=(0,a.useCallback)(async()=>{$(!0);try{let s=new URLSearchParams({search:v,sortBy:w,order:S,page:String(I),pageSize:String(D)}),l=[t(`${d.lb.sessions}?${s.toString()}`),t(d.lb.stats)];e(d.Jj.logView)&&l.push(t(d.lb.logins));let[a,r,n]=await Promise.all(l);p(a.items||[]),y(a.total||0),o(r),n&&m(n.items||[])}catch(e){console.error(e)}finally{$(!1)}},[e,t,v,w,S,I,D]);(0,a.useEffect)(()=>{M()},[M]);let T=async e=>{confirm(`Delete session ${e}?`)&&(await s(`${d.lb.sessions}/${e}`),M())};return(0,l.jsx)(r.A,{children:(0,l.jsxs)("div",{className:"space-y-8",children:[(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"text-2xl font-bold tracking-tight text-text login-hero-grad",children:"System Overview"}),(0,l.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Real-time telemetry and active host instances"})]}),(0,l.jsxs)("button",{onClick:M,disabled:L,className:"self-start sm:self-auto inline-flex items-center gap-2 px-3.5 py-1.5 rounded-xl bg-surface-2 hover:bg-surface-3 border border-border-subtle text-xs font-medium text-text transition-colors disabled:opacity-50",children:[(0,l.jsx)(n.e9,{size:13,className:L?"animate-spin text-brand-500":""}),(0,l.jsx)("span",{children:"Refresh"})]})]}),(0,l.jsx)("section",{children:(0,l.jsx)(c,{stats:i})}),e(d.Jj.logView)&&(0,l.jsx)(j,{items:x}),(0,l.jsxs)("section",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-lg font-bold tracking-tight text-text",children:"Active Sessions"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Connected and registered client sessions"})]}),(0,l.jsxs)("div",{className:"relative w-full sm:w-80",children:[(0,l.jsx)(n.vj,{size:15,className:"absolute left-3.5 top-1/2 -translate-y-1/2 text-text-muted"}),(0,l.jsx)("input",{value:v,onChange:e=>{k(e.target.value),z(1)},placeholder:"Search machineId, IP address...",className:"w-full pl-9 pr-3.5 py-2 bg-surface-2/80 border border-border-subtle rounded-xl text-text text-xs placeholder:text-text-subtle focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40 transition-all font-mono"})]})]}),(0,l.jsx)(b,{items:u,sortBy:w,order:S,onSortChange:(e,t)=>{A(e),C(t),z(1)},onDelete:T,canDelete:e(d.Jj.sessionDelete)}),(0,l.jsx)(h,{page:I,pageSize:D,total:f,onPageChange:z,onPageSizeChange:e=>{P(e),z(1)}})]})]})})}}},e=>{e.O(0,[161,9568,9958,8334,2347,5158,7358],()=>e(e.s=42761)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[540],{7116:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>m});var a=s(73365),r=s(1521),l=s(38334),d=s(80186),n=s(96042),c=s(64683),o=s(39457),i=s(24945),x=s(57042);let u={keyId:"",secret:"",label:"",scope:"both"},b=["both","dev","prod"];function m(){let{can:e}=(0,i.b)(),{get:t,post:s,patch:m,del:h}=(0,o.Z)(),[p,g]=(0,r.useState)([]),[f,j]=(0,r.useState)(u),[y,N]=(0,r.useState)(!0),[v,w]=(0,r.useState)(!1),[k,C]=(0,r.useState)(""),[S,A]=(0,r.useState)(null),T=e(x.Jj.turnManage),$=(0,r.useCallback)(async()=>{N(!0);try{let e=await t(x.lb.turn);g(e.items||[])}catch(e){C(e.message)}finally{N(!1)}},[t]);(0,r.useEffect)(()=>{$()},[$]);let _=async()=>{C(""),w(!0),A(null);try{await s(x.lb.turn,f),A(f.secret),j(u),await $()}catch(e){C(e.message)}finally{w(!1)}},U=async e=>{try{await m(`${x.lb.turn}/${e.id}`,{enabled:!e.enabled}),$()}catch(e){C(e.message)}},z=async(e,t)=>{try{await m(`${x.lb.turn}/${e.id}`,{scope:t}),$()}catch(e){C(e.message)}},R=async e=>{if(confirm("Delete this TURN key? Clients using it fall back to STUN-only."))try{await h(`${x.lb.turn}/${e}`),$()}catch(e){C(e.message)}};return(0,a.jsx)(l.A,{children:(0,a.jsxs)("div",{className:"space-y-8 max-w-5xl",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("h1",{className:"text-2xl font-bold tracking-tight text-text login-hero-grad flex items-center gap-2.5",children:[(0,a.jsx)(c.kV,{size:24,className:"text-brand-500"}),(0,a.jsx)("span",{children:"TURN Keys"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Rotate Cloudflare TURN credentials for cross-network WebRTC relay"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("a",{href:"https://dash.cloudflare.com/?to=/:account/realtime/turn",target:"_blank",rel:"noreferrer noopener",className:"inline-flex items-center gap-2 px-3.5 py-1.5 rounded-xl bg-brand-500 hover:bg-brand-600 text-white text-xs font-semibold transition-colors shadow-[0_4px_12px_-4px_rgba(255,87,10,0.5)]",children:[(0,a.jsx)(c.Gr,{size:13}),(0,a.jsx)("span",{children:"Create on Cloudflare"})]}),(0,a.jsxs)("button",{onClick:$,disabled:y,className:"inline-flex items-center gap-2 px-3.5 py-1.5 rounded-xl bg-surface-2 hover:bg-surface-3 border border-border-subtle text-xs font-medium text-text transition-colors disabled:opacity-50",children:[(0,a.jsx)(c.e9,{size:13,className:y?"animate-spin text-brand-500":""}),(0,a.jsx)("span",{children:"Refresh"})]})]})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted bg-surface-2/60 border border-border-subtle rounded-xl p-3",children:"Up to 1,000 keys. 1,000 GB/month free per Cloudflare account (shared with SFU) — more keys do not add quota."}),k&&(0,a.jsx)("p",{className:"text-xs text-danger bg-red-500/10 p-3 rounded-xl border border-red-500/20",children:k}),S&&(0,a.jsxs)("div",{className:"card-glass p-4 space-y-2 border border-brand-500/30",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-xs font-semibold text-text",children:"Key added — secret stored. Copy it if you need it elsewhere:"}),(0,a.jsx)("button",{onClick:()=>A(null),className:"text-text-muted hover:text-text",children:(0,a.jsx)(c.X,{size:14})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("code",{className:"flex-1 text-[11px] font-mono text-text-muted bg-surface-2 rounded-lg px-3 py-2 break-all",children:S}),(0,a.jsx)("button",{onClick:()=>navigator.clipboard?.writeText(S),className:"p-2 rounded-lg bg-surface-2 hover:bg-surface-3 text-text-muted hover:text-text transition-colors","aria-label":"Copy secret",children:(0,a.jsx)(c.QR,{size:14})})]})]}),T&&(0,a.jsxs)("div",{className:"card-glass p-5 sm:p-6 space-y-4",children:[(0,a.jsxs)("h2",{className:"text-sm font-semibold tracking-tight text-text flex items-center gap-2 border-b border-border-subtle/60 pb-3",children:[(0,a.jsx)(c.FW,{size:16,className:"text-brand-500"}),(0,a.jsx)("span",{children:"Add TURN Key"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,a.jsx)(n.A,{label:"Key ID",value:f.keyId,onChange:e=>j({...f,keyId:e.target.value.trim()}),placeholder:"32-char hex from Cloudflare dashboard"}),(0,a.jsx)(n.A,{label:"API Token / Secret",type:"password",value:f.secret,onChange:e=>j({...f,secret:e.target.value.trim()}),placeholder:"Bearer secret"}),(0,a.jsx)(n.A,{label:"Label",value:f.label,onChange:e=>j({...f,label:e.target.value}),placeholder:"e.g. acc-1 (which Cloudflare account)"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs font-mono uppercase tracking-wider text-text-muted mb-1.5",children:"Scope"}),(0,a.jsx)("select",{className:"w-full px-3 py-2 text-xs border border-border-subtle rounded-xl bg-surface-2/80 text-text focus:outline-none focus:ring-2 focus:ring-brand-500/30",value:f.scope,onChange:e=>j({...f,scope:e.target.value}),children:b.map(e=>(0,a.jsx)("option",{value:e,children:e},e))})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(d.A,{onClick:_,disabled:v||!f.keyId||!f.secret,children:v?"Validating with Cloudflare...":"Add Key"}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Scope ",(0,a.jsx)("span",{className:"font-mono",children:"dev"})," = credentials for pages on dev.9remote.cc only."]})]})]}),y?(0,a.jsxs)("div",{className:"card-glass p-12 text-center text-text-muted text-xs",children:[(0,a.jsx)(c.e9,{size:20,className:"mx-auto mb-2 animate-spin text-brand-500"}),"Loading keys..."]}):0===p.length?(0,a.jsxs)("div",{className:"card-glass p-12 text-center",children:[(0,a.jsx)("div",{className:"w-12 h-12 rounded-2xl bg-surface-2 flex items-center justify-center mx-auto mb-3 text-text-subtle",children:(0,a.jsx)(c.kV,{size:24})}),(0,a.jsx)("h3",{className:"text-sm font-semibold text-text",children:"No TURN keys configured"}),(0,a.jsxs)("p",{className:"text-text-muted text-xs mt-1",children:["Clients fall back to the deployed ",(0,a.jsx)("code",{className:"font-mono text-brand-500",children:"TURN_KEY_ID"})," secret, or STUN-only if that is gone."]})]}):(0,a.jsx)("div",{className:"card-glass overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,a.jsx)("thead",{className:"bg-surface-2/60 border-b border-border-subtle text-[11px] font-mono uppercase tracking-wider text-text-muted",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-4 py-3",children:"Key"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Scope"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Last Used"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Status"}),T&&(0,a.jsx)("th",{className:"px-4 py-3 text-right",children:"Actions"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-border-subtle/50",children:p.map(e=>(0,a.jsxs)("tr",{className:"hover:bg-surface-2/40 transition-colors",children:[(0,a.jsxs)("td",{className:"px-4 py-3.5",children:[(0,a.jsxs)("div",{className:"font-mono text-xs text-text",children:[e.keyId.slice(0,12),"…"]}),(0,a.jsxs)("div",{className:"text-[10px] text-text-subtle font-mono mt-0.5",children:[e.label||"(no label)"," \xb7 secret ",e.secretTail]})]}),(0,a.jsx)("td",{className:"px-4 py-3.5",children:T?(0,a.jsx)("select",{className:"px-2 py-1 text-[11px] font-mono border border-border-subtle rounded-lg bg-surface-2/80 text-text focus:outline-none",value:e.scope,onChange:t=>z(e,t.target.value),children:b.map(e=>(0,a.jsx)("option",{value:e,children:e},e))}):(0,a.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-mono bg-surface-2 border border-border-subtle text-text",children:e.scope})}),(0,a.jsx)("td",{className:"px-4 py-3.5 text-xs text-text-muted font-mono",children:(e=>{if(!e)return"never";try{return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}})(e.lastUsedAt)}),(0,a.jsx)("td",{className:"px-4 py-3.5",children:e.enabled?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-500 border border-emerald-500/20",children:[(0,a.jsx)(c.aJ,{size:13}),(0,a.jsx)("span",{children:"Active"})]}):(0,a.jsx)("span",{className:"text-xs font-mono text-text-subtle px-2 py-0.5 rounded bg-surface-2",children:"Disabled"})}),T&&(0,a.jsxs)("td",{className:"px-4 py-3.5 text-right whitespace-nowrap",children:[(0,a.jsx)("button",{onClick:()=>U(e),className:"text-xs font-semibold text-brand-500 hover:text-brand-400 px-2.5 py-1 rounded-lg hover:bg-brand-500/10 transition-colors",children:e.enabled?"Disable":"Enable"}),(0,a.jsx)("button",{onClick:()=>R(e.id),className:"ml-1 p-1.5 rounded-lg text-text-muted hover:text-danger hover:bg-red-500/10 transition-colors","aria-label":"Delete key",children:(0,a.jsx)(c.TB,{size:14})})]})]},e.id))})]})})]})})}},56631:(e,t,s)=>{Promise.resolve().then(s.bind(s,7116))},80186:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});var a=s(73365);function r({children:e,variant:t="primary",size:s="md",disabled:l=!1,loading:d=!1,onClick:n,className:c="",...o}){let i=`font-semibold rounded-brand transition-all duration-150 ease-out transform active:scale-[0.97] ${{primary:"bg-brand-500 hover:bg-brand-600 disabled:bg-surface-3 disabled:text-text-muted text-white shadow-sm",secondary:"bg-surface-2 hover:bg-surface-3 disabled:bg-surface disabled:text-text-muted text-text",danger:"bg-red-500 hover:bg-red-600 disabled:bg-surface-3 disabled:text-text-muted text-white",success:"bg-green-600 hover:bg-green-700 disabled:bg-surface-3 disabled:text-text-muted text-white"}[t]} ${{sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-base",lg:"px-6 py-3 text-lg"}[s]} ${l||d?"cursor-not-allowed":""} ${c}`;return(0,a.jsx)("button",{onClick:n,disabled:l||d,className:i,...o,children:d?(0,a.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,a.jsx)("span",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),e]}):e})}},96042:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});var a=s(73365);function r({label:e,type:t="text",value:s,onChange:l,onKeyDown:d,placeholder:n,disabled:c=!1,error:o,className:i="",...x}){let u=o?"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500":"focus:ring-2 focus:ring-brand-500/40",b=`w-full px-4 py-3 bg-surface-2 rounded-brand text-text placeholder-text-muted focus:outline-none transition-all duration-150 ease-out ${u} ${c?"opacity-50 cursor-not-allowed":""} ${i}`;return(0,a.jsxs)("div",{className:"w-full",children:[e&&(0,a.jsx)("label",{className:"block text-sm font-medium text-text mb-2",children:e}),(0,a.jsx)("input",{type:t,value:s,onChange:l,onKeyDown:d,placeholder:n,disabled:c,className:b,...x}),o&&(0,a.jsx)("p",{className:"mt-1 text-sm text-red-400",children:o})]})}}},e=>{e.O(0,[7738,9568,9958,8334,2347,5158,7358],()=>e(e.s=56631)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[540],{7116:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>m});var a=s(73365),r=s(1521),l=s(38334),d=s(80186),n=s(96042),c=s(64683),o=s(39457),i=s(24945),x=s(57042);let u={keyId:"",secret:"",label:"",scope:"both"},b=["both","dev","prod"];function m(){let{can:e}=(0,i.b)(),{get:t,post:s,patch:m,del:h}=(0,o.Z)(),[p,g]=(0,r.useState)([]),[f,j]=(0,r.useState)(u),[y,N]=(0,r.useState)(!0),[v,w]=(0,r.useState)(!1),[k,C]=(0,r.useState)(""),[S,A]=(0,r.useState)(null),T=e(x.Jj.turnManage),$=(0,r.useCallback)(async()=>{N(!0);try{let e=await t(x.lb.turn);g(e.items||[])}catch(e){C(e.message)}finally{N(!1)}},[t]);(0,r.useEffect)(()=>{$()},[$]);let _=async()=>{C(""),w(!0),A(null);try{await s(x.lb.turn,f),A(f.secret),j(u),await $()}catch(e){C(e.message)}finally{w(!1)}},U=async e=>{try{await m(`${x.lb.turn}/${e.id}`,{enabled:!e.enabled}),$()}catch(e){C(e.message)}},z=async(e,t)=>{try{await m(`${x.lb.turn}/${e.id}`,{scope:t}),$()}catch(e){C(e.message)}},R=async e=>{if(confirm("Delete this TURN key? Clients using it fall back to STUN-only."))try{await h(`${x.lb.turn}/${e}`),$()}catch(e){C(e.message)}};return(0,a.jsx)(l.A,{children:(0,a.jsxs)("div",{className:"space-y-8 max-w-5xl",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("h1",{className:"text-2xl font-bold tracking-tight text-text login-hero-grad flex items-center gap-2.5",children:[(0,a.jsx)(c.kV,{size:24,className:"text-brand-500"}),(0,a.jsx)("span",{children:"TURN Keys"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Rotate Cloudflare TURN credentials for cross-network WebRTC relay"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("a",{href:"https://dash.cloudflare.com/?to=/:account/realtime/turn",target:"_blank",rel:"noreferrer noopener",className:"inline-flex items-center gap-2 px-3.5 py-1.5 rounded-xl bg-brand-500 hover:bg-brand-600 text-white text-xs font-semibold transition-colors shadow-[0_4px_12px_-4px_rgba(255,87,10,0.5)]",children:[(0,a.jsx)(c.Gr,{size:13}),(0,a.jsx)("span",{children:"Create on Cloudflare"})]}),(0,a.jsxs)("button",{onClick:$,disabled:y,className:"inline-flex items-center gap-2 px-3.5 py-1.5 rounded-xl bg-surface-2 hover:bg-surface-3 border border-border-subtle text-xs font-medium text-text transition-colors disabled:opacity-50",children:[(0,a.jsx)(c.e9,{size:13,className:y?"animate-spin text-brand-500":""}),(0,a.jsx)("span",{children:"Refresh"})]})]})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted bg-surface-2/60 border border-border-subtle rounded-xl p-3",children:"Up to 1,000 keys. 1,000 GB/month free per Cloudflare account (shared with SFU) — more keys do not add quota."}),k&&(0,a.jsx)("p",{className:"text-xs text-danger bg-red-500/10 p-3 rounded-xl border border-red-500/20",children:k}),S&&(0,a.jsxs)("div",{className:"card-glass p-4 space-y-2 border border-brand-500/30",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-xs font-semibold text-text",children:"Key added — secret stored. Copy it if you need it elsewhere:"}),(0,a.jsx)("button",{onClick:()=>A(null),className:"text-text-muted hover:text-text",children:(0,a.jsx)(c.X,{size:14})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("code",{className:"flex-1 text-[11px] font-mono text-text-muted bg-surface-2 rounded-lg px-3 py-2 break-all",children:S}),(0,a.jsx)("button",{onClick:()=>navigator.clipboard?.writeText(S),className:"p-2 rounded-lg bg-surface-2 hover:bg-surface-3 text-text-muted hover:text-text transition-colors","aria-label":"Copy secret",children:(0,a.jsx)(c.QR,{size:14})})]})]}),T&&(0,a.jsxs)("div",{className:"card-glass p-5 sm:p-6 space-y-4",children:[(0,a.jsxs)("h2",{className:"text-sm font-semibold tracking-tight text-text flex items-center gap-2 border-b border-border-subtle/60 pb-3",children:[(0,a.jsx)(c.FW,{size:16,className:"text-brand-500"}),(0,a.jsx)("span",{children:"Add TURN Key"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,a.jsx)(n.A,{label:"Key ID",value:f.keyId,onChange:e=>j({...f,keyId:e.target.value.trim()}),placeholder:"32-char hex from Cloudflare dashboard"}),(0,a.jsx)(n.A,{label:"API Token / Secret",type:"password",value:f.secret,onChange:e=>j({...f,secret:e.target.value.trim()}),placeholder:"Bearer secret"}),(0,a.jsx)(n.A,{label:"Label",value:f.label,onChange:e=>j({...f,label:e.target.value}),placeholder:"e.g. acc-1 (which Cloudflare account)"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs font-mono uppercase tracking-wider text-text-muted mb-1.5",children:"Scope"}),(0,a.jsx)("select",{className:"w-full px-3 py-2 text-xs border border-border-subtle rounded-xl bg-surface-2/80 text-text focus:outline-none focus:ring-2 focus:ring-brand-500/30",value:f.scope,onChange:e=>j({...f,scope:e.target.value}),children:b.map(e=>(0,a.jsx)("option",{value:e,children:e},e))})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(d.A,{onClick:_,disabled:v||!f.keyId||!f.secret,children:v?"Validating with Cloudflare...":"Add Key"}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Scope ",(0,a.jsx)("span",{className:"font-mono",children:"dev"})," = credentials for pages on dev.9remote.cc only."]})]})]}),y?(0,a.jsxs)("div",{className:"card-glass p-12 text-center text-text-muted text-xs",children:[(0,a.jsx)(c.e9,{size:20,className:"mx-auto mb-2 animate-spin text-brand-500"}),"Loading keys..."]}):0===p.length?(0,a.jsxs)("div",{className:"card-glass p-12 text-center",children:[(0,a.jsx)("div",{className:"w-12 h-12 rounded-2xl bg-surface-2 flex items-center justify-center mx-auto mb-3 text-text-subtle",children:(0,a.jsx)(c.kV,{size:24})}),(0,a.jsx)("h3",{className:"text-sm font-semibold text-text",children:"No TURN keys configured"}),(0,a.jsxs)("p",{className:"text-text-muted text-xs mt-1",children:["Clients fall back to the deployed ",(0,a.jsx)("code",{className:"font-mono text-brand-500",children:"TURN_KEY_ID"})," secret, or STUN-only if that is gone."]})]}):(0,a.jsx)("div",{className:"card-glass overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,a.jsx)("thead",{className:"bg-surface-2/60 border-b border-border-subtle text-[11px] font-mono uppercase tracking-wider text-text-muted",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-4 py-3",children:"Key"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Scope"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Last Used"}),(0,a.jsx)("th",{className:"px-4 py-3",children:"Status"}),T&&(0,a.jsx)("th",{className:"px-4 py-3 text-right",children:"Actions"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-border-subtle/50",children:p.map(e=>(0,a.jsxs)("tr",{className:"hover:bg-surface-2/40 transition-colors",children:[(0,a.jsxs)("td",{className:"px-4 py-3.5",children:[(0,a.jsxs)("div",{className:"font-mono text-xs text-text",children:[e.keyId.slice(0,12),"…"]}),(0,a.jsxs)("div",{className:"text-[10px] text-text-subtle font-mono mt-0.5",children:[e.label||"(no label)"," \xb7 secret ",e.secretTail]})]}),(0,a.jsx)("td",{className:"px-4 py-3.5",children:T?(0,a.jsx)("select",{className:"px-2 py-1 text-[11px] font-mono border border-border-subtle rounded-lg bg-surface-2/80 text-text focus:outline-none",value:e.scope,onChange:t=>z(e,t.target.value),children:b.map(e=>(0,a.jsx)("option",{value:e,children:e},e))}):(0,a.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-mono bg-surface-2 border border-border-subtle text-text",children:e.scope})}),(0,a.jsx)("td",{className:"px-4 py-3.5 text-xs text-text-muted font-mono",children:(e=>{if(!e)return"never";try{return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}})(e.lastUsedAt)}),(0,a.jsx)("td",{className:"px-4 py-3.5",children:e.enabled?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-500 border border-emerald-500/20",children:[(0,a.jsx)(c.aJ,{size:13}),(0,a.jsx)("span",{children:"Active"})]}):(0,a.jsx)("span",{className:"text-xs font-mono text-text-subtle px-2 py-0.5 rounded bg-surface-2",children:"Disabled"})}),T&&(0,a.jsxs)("td",{className:"px-4 py-3.5 text-right whitespace-nowrap",children:[(0,a.jsx)("button",{onClick:()=>U(e),className:"text-xs font-semibold text-brand-500 hover:text-brand-400 px-2.5 py-1 rounded-lg hover:bg-brand-500/10 transition-colors",children:e.enabled?"Disable":"Enable"}),(0,a.jsx)("button",{onClick:()=>R(e.id),className:"ml-1 p-1.5 rounded-lg text-text-muted hover:text-danger hover:bg-red-500/10 transition-colors","aria-label":"Delete key",children:(0,a.jsx)(c.TB,{size:14})})]})]},e.id))})]})})]})})}},56631:(e,t,s)=>{Promise.resolve().then(s.bind(s,7116))},80186:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});var a=s(73365);function r({children:e,variant:t="primary",size:s="md",disabled:l=!1,loading:d=!1,onClick:n,className:c="",...o}){let i=`font-semibold rounded-brand transition-all duration-150 ease-out transform active:scale-[0.97] ${{primary:"bg-brand-500 hover:bg-brand-600 disabled:bg-surface-3 disabled:text-text-muted text-white shadow-sm",secondary:"bg-surface-2 hover:bg-surface-3 disabled:bg-surface disabled:text-text-muted text-text",danger:"bg-red-500 hover:bg-red-600 disabled:bg-surface-3 disabled:text-text-muted text-white",success:"bg-green-600 hover:bg-green-700 disabled:bg-surface-3 disabled:text-text-muted text-white"}[t]} ${{sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-base",lg:"px-6 py-3 text-lg"}[s]} ${l||d?"cursor-not-allowed":""} ${c}`;return(0,a.jsx)("button",{onClick:n,disabled:l||d,className:i,...o,children:d?(0,a.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,a.jsx)("span",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),e]}):e})}},96042:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});var a=s(73365);function r({label:e,type:t="text",value:s,onChange:l,onKeyDown:d,placeholder:n,disabled:c=!1,error:o,className:i="",...x}){let u=o?"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500":"focus:ring-2 focus:ring-brand-500/40",b=`w-full px-4 py-3 bg-surface-2 rounded-brand text-text placeholder-text-muted focus:outline-none transition-all duration-150 ease-out ${u} ${c?"opacity-50 cursor-not-allowed":""} ${i}`;return(0,a.jsxs)("div",{className:"w-full",children:[e&&(0,a.jsx)("label",{className:"block text-sm font-medium text-text mb-2",children:e}),(0,a.jsx)("input",{type:t,value:s,onChange:l,onKeyDown:d,placeholder:n,disabled:c,className:b,...x}),o&&(0,a.jsx)("p",{className:"mt-1 text-sm text-red-400",children:o})]})}}},e=>{e.O(0,[161,9568,9958,8334,2347,5158,7358],()=>e(e.s=56631)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[967],{8910:(e,A,o)=>{"use strict";function t(e=10){if(navigator.vibrate)return void navigator.vibrate(e);if("u">typeof document){let e=document.createElement("div"),A=Math.random().toString(36).slice(2);e.innerHTML=`<input type="checkbox" id="${A}" switch /><label for="${A}"></label>`,e.setAttribute("style","display:none !important;opacity:0 !important;visibility:hidden !important;"),document.body.appendChild(e),e.querySelector("label").click(),setTimeout(()=>e.remove(),100)}}o.d(A,{e:()=>t})},58506:(e,A,o)=>{"use strict";o.r(A),o.d(A,{default:()=>l});var t=o(73365),n=o(6552);let i=[{question:"Which background should the pane use?",multiSelect:!1,options:[{label:"Keep the global pool",description:"Every pane follows the workspace setting."},{label:"Pin a wallpaper",description:"Only this session gets its own image."},{label:"Solid colour",description:"No image, just the theme surface."}]}],r=[{question:"Which panes should the new layout open?",multiSelect:!0,options:[{label:"Terminal",description:"A shell in the workspace root."},{label:"AI chat",description:"The agent pane for the active engine."},{label:"Files",description:"The explorer panel on the right."}]},{question:"Anything else to note?",options:[{label:"No",description:"Just open them."}]}];function l(){return(0,t.jsxs)("div",{className:"min-h-screen bg-bg p-6 flex flex-col gap-6 max-w-md",children:[(0,t.jsx)(n.J,{questions:i,onResolve:()=>{}}),(0,t.jsx)(n.J,{questions:r,onResolve:()=>{}}),(0,t.jsx)(n.J,{questions:i,answers:'User has answered your questions: "Which background should the pane use?"="Pin a wallpaper".'})]})}},61436:(e,A,o)=>{Promise.resolve().then(o.bind(o,58506))},64683:(e,A,o)=>{"use strict";o.d(A,{$o:()=>ej.A,AX:()=>ef.A,Ay:()=>An,BK:()=>e3.A,BZ:()=>Q.A,Bm:()=>D.A,Cp:()=>z.A,Do:()=>l.A,F1:()=>a.A,FE:()=>eQ.A,FW:()=>eq.A,GD:()=>j.A,GO:()=>eh.A,Gr:()=>M.A,Gv:()=>eg.A,Hx:()=>et.A,Ir:()=>s.A,J4:()=>eK.A,JG:()=>m.A,JU:()=>_.A,Jl:()=>h.A,Kq:()=>Ao.A,LM:()=>el.A,Lt:()=>S.A,M6:()=>eZ.A,P6:()=>ee.A,QR:()=>P.A,Qp:()=>r.A,RI:()=>n.A,TB:()=>e6.A,Ud:()=>X.A,VA:()=>em.A,Vn:()=>e_.A,W1:()=>ed.A,WE:()=>g.A,We:()=>e1.A,Wn:()=>k.A,X:()=>AA.A,X_:()=>O.A,ZH:()=>R.A,ZU:()=>e5.A,Ze:()=>eU.A,Zr:()=>B.A,_O:()=>e7.A,_V:()=>Y.A,a4:()=>eb.A,aJ:()=>d.A,ak:()=>Z.A,bE:()=>e0.A,bd:()=>eY.A,cC:()=>c.A,c_:()=>f.A,dJ:()=>H.A,de:()=>Ae.A,dx:()=>N.A,e6:()=>eC.A,e9:()=>eW.A,eM:()=>eH.A,ek:()=>eV.A,es:()=>ey.A,f2:()=>I.A,f5:()=>L.A,gH:()=>eL.A,h1:()=>ec.A,iU:()=>E.A,jG:()=>eO.A,jj:()=>eu.A,jl:()=>v.A,jz:()=>eS.A,kU:()=>U.A,kV:()=>eA.A,kr:()=>er.A,kt:()=>eG.A,lM:()=>e8.A,lP:()=>ew.A,m0:()=>w.A,mN:()=>K.A,nU:()=>es.A,qz:()=>V.A,rX:()=>b.A,s3:()=>eo.A,sU:()=>eX.A,sv:()=>G.A,ue:()=>ek.A,vR:()=>eF.A,vW:()=>eT.A,vd:()=>J.A,vj:()=>eD.A,vv:()=>en.A,wB:()=>eN.A,wO:()=>eI.A,ww:()=>$.A,xq:()=>ep.A,xv:()=>ex.A,y8:()=>ei.A,yQ:()=>u.A,yU:()=>eM.A,yd:()=>i.A,zW:()=>e9.A});var t=o(73365),n=o(87821),i=o(21878),r=o(79376),l=o(61659),a=o(6504),s=o(74739),c=o(29967),p=o(17836),d=o(67494),h=o(66687),u=o(95188),m=o(54453),f=o(34582),b=o(70453),g=o(10949),v=o(64570),w=o(31258),y=o(59907),C=o(13374),k=o(17406),P=o(46431),S=o(29260),x=o(88433),F=o(49553),L=o(20478),M=o(17568),U=o(87831),O=o(1916),q=o(29418),R=o(18272),j=o(10550),T=o(9271),W=o(14251),E=o(50068),G=o(98173),H=o(10194),J=o(70362),D=o(17909),_=o(59437),B=o(33109),N=o(48433),z=o(86877),V=o(34271),I=o(60919),X=o(35723),Z=o(41046),K=o(64629),Q=o(6534),$=o(5370),Y=o(59711),ee=o(39831),eA=o(9560),eo=o(44159),et=o(20021),en=o(14797),ei=o(15504),er=o(93292),el=o(92165),ea=o(94304),es=o(40789),ec=o(64871),ep=o(31805),ed=o(19621),eh=o(40081),eu=o(38781),em=o(88768),ef=o(68395),eb=o(88793),eg=o(25406),ev=o(10998),ew=o(64446),ey=o(12925),eC=o(93354),ek=o(73243),eP=o(89317),eS=o(12283),ex=o(1578),eF=o(90612),eL=o(43959),eM=o(76621),eU=o(59833),eO=o(67236),eq=o(97038),eR=o(72147),ej=o(68859),eT=o(93285),eW=o(20178),eE=o(65062),eG=o(87030),eH=o(67519),eJ=o(457),eD=o(58450),e_=o(48088),eB=o(56023),eN=o(59311),ez=o(38177),eV=o(60659),eI=o(1838),eX=o(34969),eZ=o(42685),eK=o(99707),eQ=o(6830),e$=o(20248),eY=o(11384),e1=o(50211),e3=o(64342),e6=o(60151),e8=o(81610),e5=o(11990),e0=o(52715),e7=o(49387),e9=o(894),e2=o(2031),e4=o(58573),Ae=o(51328),AA=o(3382),Ao=o(57717);let At={AlertCircle:n.A,ArrowDown:i.A,ArrowRight:r.A,ArrowUp:l.A,ArrowUpRight:a.A,Bell:s.A,Bot:c.A,Bug:p.A,Check:d.A,CheckCircle2:h.A,ChevronDown:u.A,ChevronLeft:m.A,ChevronRight:f.A,ChevronUp:b.A,ChevronsDownUp:g.A,Circle:v.A,ClipboardPaste:w.A,Command:y.A,Compass:C.A,Columns2:k.A,Copy:P.A,CornerDownLeft:S.A,Crown:x.A,Delete:F.A,Download:L.A,ExternalLink:M.A,Eye:U.A,EyeOff:O.A,Facebook:q.A,File:R.A,FileCode:j.A,FileJson:T.A,FilePlus:W.A,FileText:E.A,Files:G.A,Filter:H.A,Folder:J.A,FolderOpen:D.A,FolderPlus:_.A,GitBranch:B.A,GitFork:N.A,Github:z.A,Globe:V.A,GripVertical:I.A,Hand:X.A,HardDrive:Z.A,HelpCircle:K.A,History:Q.A,Home:$.A,Image:Y.A,ImageOff:ee.A,KeyRound:eA.A,Keyboard:eo.A,LayoutDashboard:et.A,Link2:en.A,ListChecks:ei.A,Loader2:er.A,Lock:el.A,LogIn:ea.A,LogOut:es.A,Maximize2:ec.A,Minimize2:ep.A,Menu:ed.A,Mic:eh.A,MicOff:eu.A,Monitor:em.A,Moon:ef.A,MoreHorizontal:eb.A,MoreVertical:eg.A,MousePointer2:ev.A,Package:ew.A,Palette:ey.A,PanelLeft:eC.A,PanelLeftClose:ek.A,PanelLeftOpen:eP.A,PanelRight:eS.A,Paperclip:ex.A,Pause:eF.A,Pencil:eL.A,Pin:eM.A,PinOff:eU.A,Play:eO.A,Plus:eq.A,Power:eR.A,PowerOff:ej.A,QrCode:eT.A,RefreshCw:eW.A,Replace:eE.A,RotateCw:eG.A,Save:eH.A,Scissors:eJ.A,Search:eD.A,Send:e_.A,SendHorizontal:eB.A,Settings:eN.A,Share:ez.A,Shield:eV.A,Smartphone:eI.A,Sparkles:eX.A,Square:eZ.A,SquarePen:eK.A,Star:eQ.A,StickyNote:e$.A,Sun:eY.A,Target:e1.A,Terminal:e3.A,Trash2:e6.A,Triangle:e8.A,Type:e5.A,Undo2:e0.A,Upload:e7.A,Users:e9.A,Volume2:e2.A,VolumeX:e4.A,Wallpaper:Ae.A,X:AA.A,Zap:Ao.A};function An({name:e,size:A=20,className:o="",...n}){let i=At[e];return i?(0,t.jsx)(i,{size:A,className:o,strokeWidth:2,...n}):(console.warn(`Icon "${e}" not found in the icon registry`),null)}}},e=>{e.O(0,[161,6552,2347,5158,7358],()=>e(e.s=61436)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4520],{45136:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>W});var a=s(73365),n=s(1521),r=s(29717),l=s(20464),i=s(4018),o=s(2163),c=s(59893),d=s(64683),x=s(80186),m=s(78762);function u({isOpen:e,onClose:t,onScan:r}){let{t:l}=(0,m.s)(),i=(0,n.useRef)(null),o=(0,n.useRef)(null),c=(0,n.useRef)(null),p=(0,n.useRef)(null),h=(0,n.useRef)(null),[g,b]=(0,n.useState)(""),[f,j]=(0,n.useState)(""),y=(0,n.useCallback)(async e=>{if(o.current)try{await o.current.stop()}catch(e){}j("detected"),await new Promise(e=>setTimeout(e,300)),j("authenticating"),await r(e)||(j(""),h.current?.())},[r]),v=(0,n.useCallback)(async()=>{if(!c.current){let e=await Promise.all([s.e(3446),s.e(6075)]).then(s.bind(s,16075)).catch(()=>null);if(!e)return void b(l("login.qrLibFail"));c.current=e.Html5Qrcode}let e=document.getElementById("qr-reader");if(!e)return void b(l("login.qrInitFail"));try{e.innerHTML="";let t=new c.current("qr-reader");o.current=t,await t.start({facingMode:"environment"},{fps:10,qrbox:{width:250,height:250}},e=>{p.current?.(e)},()=>{})}catch(t){let e=t.toString();e.includes("NotAllowedError")?b(l("login.qrCamDenied")):e.includes("NotFoundError")?b(l("login.qrNoCamera")):e.includes("NotReadableError")?b(l("login.qrCamBusy")):b(l("login.qrCamError"))}},[l]),w=(0,n.useCallback)(async()=>{if(o.current){try{await o.current.stop()}catch(e){}o.current=null}b(""),j(""),t()},[t]);return((0,n.useEffect)(()=>{p.current=y},[y]),(0,n.useEffect)(()=>{if(!e)return;let t=!1;h.current=async()=>{o.current=null,await new Promise(e=>setTimeout(e,400)),t||v()};let s=setTimeout(()=>{t||v()},200);return()=>{if(t=!0,clearTimeout(s),h.current=null,o.current){try{o.current.stop()}catch(e){}o.current=null}}},[e,v]),e)?(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",children:(0,a.jsxs)("div",{className:"relative card-elev max-w-md w-full mx-4 overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[(0,a.jsx)("h2",{className:"text-xl font-bold text-text",children:l("login.qrScanTitle")}),(0,a.jsx)("button",{onClick:w,className:"text-text-muted hover:text-text transition-colors p-1",children:(0,a.jsx)(d.X,{size:24})})]}),(0,a.jsx)("div",{className:"relative bg-black",children:(0,a.jsx)("div",{id:"qr-reader",ref:i,className:"w-full",style:{minHeight:"300px"}})}),(0,a.jsxs)("div",{className:"p-4",children:[g?(0,a.jsxs)("div",{className:"flex items-start gap-2 p-3 bg-red-500/10 rounded-brand text-red-400",children:[(0,a.jsx)(d.RI,{size:20,className:"flex-shrink-0 mt-0.5"}),(0,a.jsx)("p",{className:"text-sm",children:g})]}):"detected"===f?(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 p-3 bg-green-500/10 rounded-brand text-green-400",children:[(0,a.jsx)(d.vW,{size:22}),(0,a.jsx)("p",{className:"text-sm font-medium",children:l("login.qrDetected")})]}):"authenticating"===f?(0,a.jsx)("div",{className:"flex items-center justify-center gap-2 p-3 bg-brand-500/10 rounded-brand text-brand-400",children:(0,a.jsx)("p",{className:"text-sm font-medium",children:l("login.qrAuthenticating")})}):(0,a.jsx)("p",{className:"text-sm text-text-muted text-center",children:l("login.qrHint")}),(0,a.jsx)(x.A,{variant:"secondary",onClick:w,disabled:"authenticating"===f,className:"w-full mt-4",children:"authenticating"===f?l("login.qrPleaseWait"):l("common.cancel")})]})]})}):null}var p=s(45111),h=s(42174),g=s(30240),b=s(8910),f=s(52345),j=s(18057);function y({className:e="",showLabel:t=!0}){let{locale:s}=(0,m.s)(),[r,l]=(0,n.useState)(!1),i=f.dI.find(e=>e.code===s)||f.dI[0];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{onClick:()=>{(0,b.e)(),l(!0)},className:`flex items-center gap-1.5 bg-surface-2 hover:bg-surface-3 rounded-brand text-text text-sm px-2 py-1 transition-all duration-150 ease-out active:scale-[0.96] ${e}`,title:i.label,children:[(0,a.jsx)("img",{src:`https://flagcdn.com/w40/${i.country}.png`,alt:i.label,className:"w-[17px] h-[12px] object-cover rounded-[2px]",loading:"lazy"}),t&&(0,a.jsx)("span",{className:"hidden sm:inline",children:i.code.toUpperCase()})]}),(0,a.jsx)(j.A,{isOpen:r,onClose:()=>l(!1)})]})}var v=s(90753),w=s(38415),N=s(23346);let k=null;async function C(){k||(k=N.Ay.ready),await k}async function S(e,t){await C();let s=N.Ay.from_base64(e,N.Ay.base64_variants.ORIGINAL),a=N.Ay.from_string(t),n=N.Ay.crypto_box_seal(a,s);return N.Ay.to_base64(n,N.Ay.base64_variants.ORIGINAL)}function A(e=24){let t=new Uint8Array(e);return crypto.getRandomValues(t),Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}let _="9remote_github_token",L="9remote:githubTokenChange";async function z(e,t,s={}){let a=await fetch(`${w.pe}${t}`,{...s,headers:{...{Authorization:`Bearer ${e}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},...s.headers||{}}});if(!a.ok){let e=await a.text().catch(()=>"");throw Error(`GitHub ${a.status}: ${e||a.statusText}`)}return 204===a.status?null:a.json()}function K(){let[e,t]=(0,n.useState)(()=>localStorage.getItem(_)||""),[s,a]=(0,n.useState)(!1),[r,l]=(0,n.useState)(null);(0,n.useEffect)(()=>{let e=()=>{t(localStorage.getItem(_)||"")};return window.addEventListener(L,e),window.addEventListener("storage",e),()=>{window.removeEventListener(L,e),window.removeEventListener("storage",e)}},[!0]);let i=(0,n.useCallback)(e=>{t(e),e?localStorage.setItem(_,e):localStorage.removeItem(_),window.dispatchEvent(new Event(L))},[!0]),o=(0,n.useCallback)(()=>{i("")},[i]),c=(0,n.useCallback)(async(t=e)=>z(t,w.no.user),[e]),d=(0,n.useCallback)(async()=>{a(!0),l(null);try{return(await z(e,w.no.codespaces)).codespaces||[]}catch(e){return l(e.message),[]}finally{a(!1)}},[e]),x=(0,n.useCallback)(async t=>z(e,w.no.codespaceByName(t)),[e]),m=(0,n.useCallback)(async t=>z(e,w.no.startCodespace(t),{method:"POST"}),[e]),u=(0,n.useCallback)(async()=>z(e,w.no.userReposList),[e]),p=(0,n.useCallback)(async(t,s)=>z(e,w.no.createCodespaceForRepo(t,s),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),[e]),h=(0,n.useCallback)(async(t,s)=>{let a=await z(e,w.no.codespaceSecretsPublicKey),n=await S(a.key,s);await z(e,w.no.codespaceSecret(w.Gf),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({encrypted_value:n,key_id:a.key_id,selected_repository_ids:[t]})})},[e]),g=(0,n.useCallback)(async(t,s)=>{let a=w.no.repoContents(t,s,w.Hu),n=!1;try{await z(e,a),n=!0}catch{}if(n)return{existed:!0};let r=JSON.stringify(w.cu,null,2);return await z(e,a,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:"Add 9remote devcontainer",content:btoa(unescape(encodeURIComponent(r)))})}),{existed:!1}},[e]),b=(0,n.useCallback)(async(e,t)=>{for(let s=0;s<w.ij;s++){let s=await x(e);if(t?.(s.state),s.state===w.Gi.available)return s;await new Promise(e=>setTimeout(e,w.Nn))}throw Error("Codespace start timeout")},[x]);return{token:e,setToken:i,clearToken:o,loading:s,error:r,getUser:c,listCodespaces:d,getCodespace:x,startCodespace:m,waitUntilAvailable:b,listRepos:u,createCodespace:p,ensureDevcontainer:g,setApiKeySecret:h,generateApiKey:A}}function I({isOpen:e,onClose:t,onCreated:s}){let{listRepos:r,createCodespace:l,ensureDevcontainer:i,setApiKeySecret:o,generateApiKey:c,error:m}=K(),[u,h]=(0,n.useState)([]),[g,b]=(0,n.useState)(!1),[f,j]=(0,n.useState)(null),[y,v]=(0,n.useState)(""),[w,N]=(0,n.useState)(null),[k,C]=(0,n.useState)("");(0,n.useEffect)(()=>{e&&(N(null),b(!0),r().then(e=>h(Array.isArray(e)?e:[])).catch(e=>N(e.message)).finally(()=>b(!1)))},[e,r]),(0,n.useEffect)(()=>{if(!e||f)return;let s=e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),t?.())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[e,f,t]);let S=(0,n.useMemo)(()=>{let e=y.trim().toLowerCase();return e?u.filter(t=>t.full_name.toLowerCase().includes(e)):u},[u,y]),A=async e=>{j(e.full_name),N(null),C("Generating API key...");try{let t=c();C("Setting codespace secret..."),await o(e.id,t),C("Setting up devcontainer..."),await i(e.owner.login,e.name),C("Creating codespace...");let a=await l(e.owner.login,e.name);s({codespace:a,apiKey:t})}catch(e){N(e.message)}finally{j(null),C("")}};return e?(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:t,children:(0,a.jsxs)("div",{className:"card-elev p-6 max-w-md w-full max-h-[80dvh] flex flex-col border border-border",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-bold text-text",children:"Select repository"}),(0,a.jsx)("button",{onClick:t,className:"p-1 text-text-muted hover:text-text",children:(0,a.jsx)(d.X,{size:20})})]}),(0,a.jsxs)("div",{className:"relative mb-3",children:[(0,a.jsx)(d.vj,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-text-muted"}),(0,a.jsx)("input",{type:"text",value:y,onChange:e=>v(e.target.value),placeholder:"Search repos...",className:"w-full pl-9 pr-3 py-2 bg-surface-2 rounded-brand text-text placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-brand-500/40 text-sm"})]}),(w||m)&&(0,a.jsxs)("div",{className:"flex items-start gap-2 mb-3 p-2 bg-danger/10 rounded-brand text-xs text-danger",children:[(0,a.jsx)(d.RI,{size:14,className:"flex-shrink-0 mt-0.5"}),(0,a.jsx)("span",{className:"break-words",children:w||m})]}),(0,a.jsx)("div",{className:"flex-1 overflow-auto space-y-1",children:g?(0,a.jsx)(p.A,{text:"Loading repos..."}):0===S.length?(0,a.jsx)("div",{className:"text-center py-6 text-text-muted text-sm",children:"No repos"}):S.map(e=>{let t=f===e.full_name;return(0,a.jsxs)("div",{className:"p-2 bg-surface-2 hover:bg-surface-3 rounded-brand transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-sm text-text font-medium truncate",title:e.full_name,children:e.full_name}),e.private&&(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"private"})]}),(0,a.jsxs)(x.A,{variant:"primary",onClick:()=>A(e),disabled:!!f,loading:t,className:"!py-1 !px-2 text-xs",children:[(0,a.jsx)(d.FW,{size:12}),"Create"]})]}),t&&k&&(0,a.jsx)("div",{className:"mt-1 text-xs text-text-muted",children:k})]},e.id)})})]})}):null}let E="9remote_codespace_keys";function R(){try{return JSON.parse(localStorage.getItem(E)||"{}")}catch{return{}}}function P({onConnect:e,onLogout:t}){let{listCodespaces:s,startCodespace:r,waitUntilAvailable:l,loading:i,error:o,getUser:c}=K(),[m,u]=(0,n.useState)([]),[h,g]=(0,n.useState)(null),[b,f]=(0,n.useState)(null),[j,y]=(0,n.useState)(""),[v,N]=(0,n.useState)(!1),k=(0,n.useCallback)(async()=>{try{let e=await c();g(e)}catch{}u(await s())},[c,s]);(0,n.useEffect)(()=>{k()},[k]);let C=async t=>{var s;let a=(s=t.name,R()[s]||null);if(!a){y("No saved key for this codespace. Recreate it from web to enable auto-connect."),f(t.name),setTimeout(()=>{f(null),y("")},4e3);return}f(t.name),y("");try{let s=t;t.state!==w.Gi.available&&(y("Starting codespace..."),await r(t.name),s=await l(t.name,e=>{y(`State: ${e}`)})),e(s,a)}catch(e){y(`Error: ${e.message}`)}finally{f(null)}};return(0,a.jsxs)("div",{className:"card-elev p-8 max-w-md w-full border border-border",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)("div",{className:"p-2 bg-brand-500/10 rounded-brand",children:(0,a.jsx)(d.Cp,{className:"text-brand-500",size:24})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h2",{className:"text-xl font-bold text-text",children:"Codespaces"}),h&&(0,a.jsxs)("p",{className:"text-sm text-text-muted truncate",children:["@",h.login]})]}),(0,a.jsx)("button",{onClick:()=>N(!0),className:"p-2 text-text-muted hover:text-text hover:bg-surface-2 rounded-brand transition-colors",title:"New codespace",children:(0,a.jsx)(d.FW,{size:18})}),(0,a.jsx)("button",{onClick:k,disabled:i,className:"p-2 text-text-muted hover:text-text hover:bg-surface-2 rounded-brand transition-colors",title:"Refresh",children:(0,a.jsx)(d.e9,{size:18,className:i?"animate-spin":""})}),(0,a.jsx)("button",{onClick:t,className:"p-2 text-text-muted hover:text-text hover:bg-surface-2 rounded-brand transition-colors",title:"Logout",children:(0,a.jsx)(d.nU,{size:18})})]}),o&&(0,a.jsxs)("div",{className:"flex items-start gap-2 mb-4 p-3 bg-danger/10 rounded-brand text-sm text-danger",children:[(0,a.jsx)(d.RI,{size:16,className:"flex-shrink-0 mt-0.5"}),(0,a.jsx)("span",{className:"break-words",children:o})]}),i&&0===m.length?(0,a.jsx)(p.A,{text:"Loading codespaces..."}):0===m.length?(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)("p",{className:"text-text-muted text-sm mb-4",children:"No codespaces yet."}),(0,a.jsxs)(x.A,{variant:"primary",onClick:()=>N(!0),children:[(0,a.jsx)(d.FW,{size:16}),"Create new codespace"]})]}):(0,a.jsx)("div",{className:"space-y-2",children:m.map(e=>{let t=b===e.name,s=e.state===w.Gi.available;return(0,a.jsxs)("div",{className:"bg-surface-2 rounded-brand p-3 hover:bg-surface-3 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-text font-medium truncate",title:e.display_name||e.name,children:e.display_name||e.name}),(0,a.jsxs)("div",{className:"text-xs text-text-muted truncate",title:`${e.repository?.full_name} \xb7 ${e.state}`,children:[e.repository?.full_name," \xb7 ",e.state]})]}),(0,a.jsxs)(x.A,{variant:"primary",onClick:()=>C(e),disabled:t,loading:t,className:"!py-1.5 !px-3 text-sm",children:[(0,a.jsx)(d.jG,{size:14}),s?"Connect":"Start"]})]}),t&&j&&(0,a.jsx)("div",{className:"mt-2 text-xs text-text-muted",children:j})]},e.name)})}),(0,a.jsx)(I,{isOpen:v,onClose:()=>N(!1),onCreated:({codespace:e,apiKey:t})=>{var s;let a;s=e.name,(a=R())[s]=t,localStorage.setItem(E,JSON.stringify(a)),N(!1),k()}})]})}var T=s(97711),M=s(90084),F=s(86129),$=s(11155),O=s(2805),U=s(90076);function q(e){let t=String(e||"").trim(),s=e=>({tempKey:e.slice(0,6).toUpperCase(),tail:e.slice(6,8).toUpperCase()}),a=/#([A-NP-Z1-9]{6}-?[a-np-z1-9]{2})$/i.exec(t);if(a)return s(a[1].replace(/-/g,""));let n=/^([A-NP-Z1-9]{6}-?[a-np-z1-9]{2})$/i.exec(t);if(n)return s(n[1].replace(/-/g,""));let r=/[?&]k=([A-NP-Z1-9]{6})(?:[^A-NP-Z1-9]|$)/i.exec(t);return r?{tempKey:r[1].toUpperCase()}:/^[A-NP-Z1-9]{6}$/i.test(t)?{tempKey:t.toUpperCase()}:null}function D(){let{t:e}=(0,m.s)(),[t,s]=(0,n.useState)(""),[b,f]=(0,n.useState)(!0),[j,N]=(0,n.useState)([]),[k,C]=(0,n.useState)(!1),[S,A]=(0,n.useState)(!1),[_,L]=(0,n.useState)("local"),[z,I]=(0,n.useState)(null),[E,R]=(0,n.useState)(""),[D,G]=(0,n.useState)(null),[W,B]=(0,n.useState)(null),[H,J]=(0,n.useState)(null),Q="3.0.6",{token:X,clearToken:Z}=K(),{setAuth:V}=(0,T.F)(),Y=(0,r.useSearchParams)(),ee=(0,r.useRouter)(),{loading:et,error:es,authenticateWithToken:ea,authenticateWithApiKey:en}=(0,l.As)(),[er,el]=(0,n.useState)(!1),{loadKeys:ei,saveKey:eo,removeKey:ec,renameKey:ed,hasStoredKeys:ex,updateLastLogin:em}=(0,i.u)(),eu=(0,n.useMemo)(()=>j.some(e=>(0,$.PF)(e.key)),[j]),ep=(0,n.useMemo)(()=>Y.get("t"),[Y]),[eh]=(0,n.useState)(()=>{try{let e=sessionStorage.getItem("9remote_url_pairing");if(e)return e;let t=q(window.location.hash)||q(window.location.search);if(t?.tempKey)return sessionStorage.setItem("9remote_url_pairing",t.tempKey+(t.tail||"")),t.tempKey+(t.tail||"")}catch{}return null}),eg=!!ep||!!eh;(0,n.useEffect)(()=>{if(window.location.hash||window.location.search){let e=q(window.location.hash)||q(window.location.search);e?.tempKey&&window.history.replaceState(null,"",window.location.pathname)}f("false"!==localStorage.getItem("9remote_remember_key_preference")),N(ei()),C(!0),sessionStorage.getItem(F.Jd)&&(sessionStorage.removeItem(F.Jd),el(!0)),X&&L("github"),(0,O._r)()&&window.location.port===String(U._8)&&fetch("/api/ui/state").then(e=>e.ok?e.json():null).then(e=>{if(e?.permanentKey){J(e.permanentKey);let t="remote"===Y.get("mode");if(t)try{sessionStorage.setItem("9remote_manual_disconnect","1")}catch{}if(!(t||"1"===sessionStorage.getItem("9remote_manual_disconnect"))){let t=e.permanentKey,s=(0,$.Uo)(t),a=(0,$.Cj)(t);(0,M.LG)(s,{tail:a}),V({apiKey:s,tunnelUrl:window.location.origin,mode:"local",tempKey:null,localIp:null}),ee.push("/workspace/")}}}).catch(()=>{})},[ei,X,ee,V,Y]);let eb=(0,n.useCallback)(async e=>{let t=q(e),s=await ea(t?.tempKey||e,!0,t?.tail);try{sessionStorage.removeItem("9remote_url_pairing")}catch{}s.success&&(t?.tail&&(0,M.LG)(t.tempKey,{tail:t.tail}),"false"!==localStorage.getItem("9remote_remember_key_preference")&&sessionStorage.setItem(F.aS,"1"),ee.push("/workspace/"))},[ea,ee]),ef=(0,n.useRef)(!1);(0,n.useEffect)(()=>{(ep||eh)&&(ef.current||(ef.current=!0,ep?ea(ep):eb(eh)))},[ep,eh,ea,eb]);let ej=async()=>{let s=t.trim();if(!s)return;if((0,$.PF)(s))return void setError(e("login.legacyKeyError"));let a=q(s),n=!!a?.tempKey,r=n?a.tempKey:(0,$.Uo)(s),l=n?a.tail:(0,$.Cj)(s),i=n?await ea(a.tempKey,!0,a.tail):await en(s);if(!i.success)return;let o=n?i.apiKey:r,c=n?a.tempKey:o;l&&c&&(0,M.LG)(c,{tail:l}),b&&o&&(n?sessionStorage.setItem(F.aS,"1"):sessionStorage.setItem(F.El,s)),ee.push("/workspace/")},ey=async t=>{let s;if(!t)return;if((0,$.PF)(t))return void setError(e("login.legacyKeyError"));let a=(0,$.Cj)(t);a&&(0,M.LG)((0,$.Uo)(t),{tail:a});let n=a?t:(0,M.$4)(t);B(t);try{s=await en(n)}finally{B(null)}s?.success&&(n!==t&&eo(n),em(t),ee.push("/workspace/"))},ev=e=>{ed(e,E.trim()),N(ei()),I(null)},ew=()=>{I(null)},eN=async e=>{let t=q(e);return!!t?.tempKey&&!!(await ea(t.tempKey,!0,t.tail)).success&&(t.tail&&(0,M.LG)(t.tempKey,{tail:t.tail}),"false"!==localStorage.getItem("9remote_remember_key_preference")&&sessionStorage.setItem(F.aS,"1"),ee.push("/workspace/"),!0)};return eg&&et?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.A,{}),(0,a.jsx)(c.A,{children:(0,a.jsx)("div",{className:"card-elev p-8 max-w-md w-full border border-border",children:(0,a.jsx)(p.A,{size:"lg",text:e("login.authenticating")})})})]}):"github"===_&&X?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.A,{}),(0,a.jsx)(c.A,{children:(0,a.jsx)(P,{onConnect:(e,t)=>{let s=(0,w.xO)(e.name);V({apiKey:(0,$.Uo)(t),tunnelUrl:s,mode:"remote"}),ee.push("/workspace/")},onLogout:()=>{Z()}})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.A,{}),k&&(0,O._r)()&&(0,a.jsxs)("a",{href:"/",className:"fixed top-4 left-4 z-50 inline-flex items-center gap-2 px-3 py-1.5 text-xs font-medium text-text hover:text-white bg-surface-2/90 hover:bg-surface-3 border border-border-subtle rounded-brand-lg backdrop-blur-md transition-all shadow-sm active:scale-[0.97]",title:"Back to Host QR",children:[(0,a.jsx)(d.Ay,{name:"ChevronLeft",size:15,className:"opacity-70"}),(0,a.jsx)(d.Ay,{name:"QrCode",size:15,className:"text-brand-500"}),(0,a.jsx)("span",{children:"Host QR"})]}),(0,a.jsxs)("div",{className:"min-h-screen grid lg:grid-cols-2",children:[(0,a.jsxs)("section",{className:"hidden lg:flex flex-col justify-between px-12 xl:px-20 py-12 relative overflow-hidden",children:[(0,a.jsx)("div",{className:"login-hero-glow","aria-hidden":!0}),(0,a.jsxs)("div",{className:"my-auto max-w-xl relative z-10",children:[(0,a.jsxs)("div",{className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-full bg-surface-2/60 border border-border-subtle font-mono text-[11px] text-text-muted mb-7",children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-brand-500 animate-pulse-glow"}),e("login.termConnected")," \xb7 ",e("login.termTunnel")]}),(0,a.jsxs)("h1",{className:"text-6xl xl:text-7xl font-extrabold tracking-tight leading-[0.98] mb-6 text-text",children:[e("login.heroLine1"),(0,a.jsx)("br",{}),e("login.heroLine2"),(0,a.jsx)("br",{}),(0,a.jsx)("span",{className:"login-hero-grad",children:e("login.heroLine3")})]}),(0,a.jsx)("p",{className:"text-text-muted text-base lg:text-lg leading-relaxed max-w-md mb-8",children:e("login.tagline")}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2 mb-9",children:["Terminal","Desktop","Files","WebRTC low-latency","iOS \xb7 Android \xb7 Web"].map(e=>(0,a.jsx)("span",{className:"font-mono text-xs text-text-muted px-3 py-1.5 rounded-full border border-border-subtle",children:e},e))}),(0,a.jsxs)("div",{className:"rounded-xl border border-border-subtle bg-surface-2/60 overflow-hidden max-w-md shadow-lg",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b border-border-subtle",children:[(0,a.jsx)("span",{className:"w-2.5 h-2.5 rounded-full bg-[#ff5f57]"}),(0,a.jsx)("span",{className:"w-2.5 h-2.5 rounded-full bg-[#febc2e]"}),(0,a.jsx)("span",{className:"w-2.5 h-2.5 rounded-full bg-[#28c840]"}),(0,a.jsx)("span",{className:"ml-2 font-mono text-[10px] text-text-subtle",children:"dev@mac — zsh"})]}),(0,a.jsxs)("div",{className:"p-3.5 font-mono text-[12px] leading-relaxed",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-subtle",children:"➜"})," 9remote start"]}),(0,a.jsx)("div",{className:"text-text-subtle",children:"↳ tunnel up \xb7 pairing open"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-brand-500",children:"[ok]"})," ",(0,a.jsx)("span",{className:"text-text",children:"machine"})," ",(0,a.jsx)("span",{className:"text-text-subtle",children:"macbook-pro-m3"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-brand-500",children:"[ok]"})," ",(0,a.jsx)("span",{className:"text-text",children:"pty"})," ",(0,a.jsx)("span",{className:"text-text-subtle",children:"daemon v3.1 \xb7 12 warm"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[#6aab6a]",children:"●"})," ",(0,a.jsx)("span",{className:"text-text-subtle",children:"waiting for phone…"})," ",(0,a.jsx)("span",{className:"inline-block w-[7px] h-[13px] bg-brand-500 align-middle animate-cursor-blink"})]})]})]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-x-5 gap-y-1 font-mono text-[11px] text-text-subtle pt-8 relative z-10",children:[(0,a.jsx)("span",{children:"› PTY persistent"}),(0,a.jsx)("span",{children:"› end-to-end encrypted"}),(0,a.jsx)("span",{children:"› open source"})]})]}),(0,a.jsxs)("section",{className:"flex items-center justify-center p-6 sm:p-10 lg:border-l lg:border-border-subtle lg:bg-surface-1 relative",children:[(0,a.jsx)("div",{className:"login-mobile-glow lg:hidden","aria-hidden":!0}),(0,a.jsxs)("div",{className:"relative z-10 w-full max-w-sm space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)("img",{src:"/icon-192.png",alt:"9Remote Logo",className:"w-10 h-10 rounded-[11px] object-contain shadow-lg shadow-brand-500/20"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h1",{className:"text-[22px] font-bold tracking-tight text-text leading-none",children:"9Remote"}),Q&&(0,a.jsxs)("p",{className:"font-mono text-[11px] text-text-subtle mt-1",children:["v",Q]})]}),(0,a.jsx)(y,{}),(0,a.jsx)(v.A,{})]}),(0,a.jsx)("p",{className:"text-text-muted text-lg font-medium leading-snug pr-4 mb-6 lg:hidden",children:e("login.tagline")}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2.5",children:[(0,a.jsx)(d.Ay,{name:"KeyRound",className:"text-text-muted opacity-70",size:14}),(0,a.jsx)("span",{className:"text-[13px] font-semibold text-text",children:e("login.accessKey")})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{id:"accessKeyInput",type:"text",value:t,onChange:e=>{let t=e.target.value;s(t.length<=F.qM?t.toUpperCase():t.toLowerCase())},onKeyDown:e=>"Enter"===e.key&&t&&ej(),placeholder:e("login.placeholder"),className:"w-full pl-3.5 pr-20 py-3 bg-surface-2 border border-border-subtle rounded-[10px] font-mono text-sm text-text placeholder-text-subtle focus:outline-none focus:border-brand-500 focus:ring-2 focus:ring-brand-500/20 transition-all duration-150"}),(0,a.jsxs)("div",{className:"absolute right-2.5 top-1/2 -translate-y-1/2 flex items-center gap-1",children:[t&&(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>{s("")},className:"w-7 h-7 grid place-items-center rounded-[7px] text-text-subtle hover:bg-surface-3 hover:text-text transition-colors",type:"button",children:(0,a.jsx)(d.X,{size:16})})}),(0,a.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>A(!0),className:"w-7 h-7 grid place-items-center rounded-[7px] text-text-subtle hover:bg-surface-3 hover:text-brand-500 transition-colors",type:"button","aria-label":e("login.scanQr"),children:(0,a.jsx)(d.Ay,{name:"QrCode",size:16})})]})]}),(es||er)&&(0,a.jsx)("p",{className:"mt-2 text-xs font-mono text-danger",children:"agent-offline"===es?e("login.agentOffline"):es&&"wrong-key-tail"!==es?es:e("login.invalidKeyTail")}),(0,a.jsxs)("label",{className:"flex items-center gap-2.5 cursor-pointer mt-4 select-none",children:[(0,a.jsx)("input",{type:"checkbox",checked:b,onChange:e=>{var t;f(t=e.target.checked),localStorage.setItem("9remote_remember_key_preference",t)},className:"w-[15px] h-[15px] accent-brand-500"}),(0,a.jsx)("span",{className:"text-[13px] text-text-muted",children:e("login.rememberKey")})]}),(0,a.jsx)(x.A,{variant:"primary",onClick:ej,loading:et,className:"btn-cta w-full mt-4",children:(0,a.jsxs)("span",{className:"inline-flex items-center justify-center gap-2",children:[e("login.connect"),(0,a.jsx)(d.Ay,{name:"ArrowRight",size:16})]})}),k&&j.length>0&&(0,a.jsxs)("div",{className:"mt-5 pt-5 border-t border-border-subtle",children:[(0,a.jsx)("div",{className:"font-mono text-[11px] uppercase tracking-wider text-text-subtle mb-1 px-1",children:e("login.savedKeys")}),eu&&(0,a.jsxs)("div",{className:"my-2.5 px-3 py-2.5 bg-amber-500/10 border border-amber-500/30 rounded-brand-lg flex items-start gap-2.5",children:[(0,a.jsx)(d.Ay,{name:"AlertCircle",size:16,className:"text-amber-500 shrink-0 mt-0.5"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-text",children:e("login.legacyKeyUpdateRequired")}),(0,a.jsx)("div",{className:"text-xs text-text-muted mt-0.5",children:e("login.legacyKeyUpdateHint")}),(0,a.jsx)("code",{className:"inline-block mt-1.5 px-2 py-0.5 bg-surface-2 border border-border text-text text-xs rounded font-mono select-all",children:"npm i -g 9remote@latest"})]})]}),j.map(t=>{let s=z===t.id,n=W===t.key,r=(0,$.PF)(t.key);return(0,a.jsxs)("div",{className:`flex items-center gap-3 px-1 py-2 rounded-[10px] hover:bg-surface-2 transition-colors cursor-pointer ${r?"opacity-85":""}`,onClick:()=>!s&&!n&&ey(t.key),role:"button",tabIndex:0,children:[(0,a.jsx)("div",{className:`w-12 h-12 rounded-[12px] bg-surface-2 border ${r?"border-amber-500/40 text-amber-500":"border-border-subtle text-text-muted"} grid place-items-center flex-shrink-0`,children:(0,a.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",className:"w-[26px] h-[26px]",children:[(0,a.jsx)("rect",{x:"2",y:"4",width:"20",height:"13",rx:"2"}),(0,a.jsx)("line",{x1:"2",y1:"20",x2:"22",y2:"20"})]})}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:s?(0,a.jsxs)("div",{className:"flex items-center gap-1",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("input",{autoFocus:!0,value:E,onChange:e=>R(e.target.value),onKeyDown:e=>{"Enter"===e.key&&ev(t.id),"Escape"===e.key&&ew()},placeholder:e("login.namePlaceholder"),className:"flex-1 min-w-0 bg-surface-2 border border-brand-500 rounded-md text-text text-[13px] px-2 py-1 outline-none"}),(0,a.jsx)("button",{onClick:()=>ev(t.id),className:"w-6 h-6 grid place-items-center rounded-md bg-brand-500 text-white","aria-label":e("common.done"),children:(0,a.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",className:"w-3 h-3",children:(0,a.jsx)("polyline",{points:"20 6 9 17 4 12"})})}),(0,a.jsx)("button",{onClick:ew,className:"w-6 h-6 grid place-items-center rounded-md bg-surface-2 text-text-muted","aria-label":e("common.cancel"),children:(0,a.jsx)(d.X,{size:13})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-[13px] font-medium text-text truncate",title:t.label||e("agentSwitcher.unnamed"),children:t.label||e("agentSwitcher.unnamed")}),r&&(0,a.jsx)("span",{className:"shrink-0 px-1.5 py-0.5 text-[9px] font-semibold font-mono uppercase rounded bg-amber-500/15 text-amber-500 border border-amber-500/30",children:e("login.updateRequired")})]}),(0,a.jsx)("div",{className:"font-mono text-[11px] text-text-subtle mt-0.5 truncate",children:(0,o.o)(t.key)})]})}),!s&&(0,a.jsx)("span",{className:"font-mono text-[11px] text-text-subtle whitespace-nowrap",children:n?e("agentSwitcher.connecting"):(t=>{if(!t)return"";try{let s=new Date(t),a=new Date-s,n=Math.floor(a/6e4),r=Math.floor(a/36e5),l=Math.floor(a/864e5);if(n<1)return e("login.justNow");if(n<60)return e("login.minutesAgo",{n:n});if(r<24)return e("login.hoursAgo",{n:r});if(l<7)return e("login.daysAgo",{n:l});return s.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return""}})(t.lastLoginDate)}),!s&&(0,a.jsxs)("div",{className:"flex gap-0.5",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("button",{onClick:()=>{I(t.id),R(t.label||"")},title:e("common.edit"),className:"w-[26px] h-[26px] grid place-items-center rounded-[7px] text-text-subtle hover:bg-surface-3 hover:text-text transition-colors",children:(0,a.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"w-3.5 h-3.5",children:[(0,a.jsx)("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),(0,a.jsx)("path",{d:"M18.5 2.5a2.12 2.12 0 0 1 3 3L12 15l-4 1 1-4z"})]})}),(0,a.jsx)("button",{onClick:()=>G(t),title:e("common.delete"),className:"w-[26px] h-[26px] grid place-items-center rounded-[7px] text-text-subtle hover:bg-surface-3 hover:text-danger transition-colors",children:(0,a.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"w-3.5 h-3.5",children:[(0,a.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,a.jsx)("path",{d:"M19 6l-2 14a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L5 6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]},t.id)})]}),(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 pt-1 text-text-subtle",children:[(0,a.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"w-3.5 h-3.5",children:(0,a.jsx)("path",{d:"M12 2l9 4v6c0 5-3.8 9.7-9 11-5.2-1.3-9-6-9-11V6l9-4z"})}),(0,a.jsx)("span",{className:"font-mono text-[11px]",children:e("login.secureTitle")})]})]})]})]}),(0,a.jsx)(u,{isOpen:S,onClose:()=>A(!1),onScan:eN}),(0,a.jsx)(h.A,{isOpen:!!D,onClose:()=>G(null),onConfirm:()=>{D&&(ec(D.id),N(ei()))},title:e("login.deleteKeyTitle"),message:e("login.deleteKeyConfirm",{name:D?.label}),confirmText:e("common.delete")})]})}function G(){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.A,{}),(0,a.jsx)(c.A,{children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,a.jsx)(p.A,{text:"Loading..."}),(0,a.jsx)("a",{href:"/login",className:"text-sm text-text-muted hover:text-brand-500 underline underline-offset-4 transition-colors",children:"Reload"})]})})]})}function W(){return(0,a.jsx)(n.Suspense,{fallback:(0,a.jsx)(G,{}),children:(0,a.jsx)(D,{})})}},59893:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var a=s(73365);function n({children:e,centered:t=!0,className:s=""}){return(0,a.jsx)("div",{className:`min-h-screen ${t?"flex items-center justify-center p-4":""} ${s}`,children:e})}},66859:(e,t,s)=>{Promise.resolve().then(s.bind(s,45136))},90753:(e,t,s)=>{"use strict";s.d(t,{A:()=>o});var a=s(73365),n=s(44976),r=s(8910);let l=({size:e=18})=>(0,a.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,a.jsx)("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}),i=({size:e=18})=>(0,a.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})});function o({className:e="",size:t=18}){let{theme:s,toggleTheme:c}=(0,n.D)(),d="dark"===s;return(0,a.jsx)("button",{type:"button",onClick:()=>{(0,r.e)(),c()},"aria-label":d?"Switch to light theme":"Switch to dark theme",title:d?"Light mode":"Dark mode",className:`p-1.5 rounded-brand transition-colors text-[var(--color-text-muted)] hover:text-[var(--color-text)] hover:bg-[var(--color-surface-2)] ${e}`,children:d?(0,a.jsx)(l,{size:t}):(0,a.jsx)(i,{size:t})})}}},e=>{e.O(0,[1236,7738,635,9958,3973,2347,5158,7358],()=>e(e.s=66859)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4520],{45136:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>W});var a=s(73365),n=s(1521),r=s(29717),l=s(20464),i=s(4018),o=s(2163),c=s(59893),d=s(64683),x=s(80186),m=s(78762);function u({isOpen:e,onClose:t,onScan:r}){let{t:l}=(0,m.s)(),i=(0,n.useRef)(null),o=(0,n.useRef)(null),c=(0,n.useRef)(null),p=(0,n.useRef)(null),h=(0,n.useRef)(null),[g,b]=(0,n.useState)(""),[f,j]=(0,n.useState)(""),y=(0,n.useCallback)(async e=>{if(o.current)try{await o.current.stop()}catch(e){}j("detected"),await new Promise(e=>setTimeout(e,300)),j("authenticating"),await r(e)||(j(""),h.current?.())},[r]),v=(0,n.useCallback)(async()=>{if(!c.current){let e=await Promise.all([s.e(3446),s.e(6075)]).then(s.bind(s,16075)).catch(()=>null);if(!e)return void b(l("login.qrLibFail"));c.current=e.Html5Qrcode}let e=document.getElementById("qr-reader");if(!e)return void b(l("login.qrInitFail"));try{e.innerHTML="";let t=new c.current("qr-reader");o.current=t,await t.start({facingMode:"environment"},{fps:10,qrbox:{width:250,height:250}},e=>{p.current?.(e)},()=>{})}catch(t){let e=t.toString();e.includes("NotAllowedError")?b(l("login.qrCamDenied")):e.includes("NotFoundError")?b(l("login.qrNoCamera")):e.includes("NotReadableError")?b(l("login.qrCamBusy")):b(l("login.qrCamError"))}},[l]),w=(0,n.useCallback)(async()=>{if(o.current){try{await o.current.stop()}catch(e){}o.current=null}b(""),j(""),t()},[t]);return((0,n.useEffect)(()=>{p.current=y},[y]),(0,n.useEffect)(()=>{if(!e)return;let t=!1;h.current=async()=>{o.current=null,await new Promise(e=>setTimeout(e,400)),t||v()};let s=setTimeout(()=>{t||v()},200);return()=>{if(t=!0,clearTimeout(s),h.current=null,o.current){try{o.current.stop()}catch(e){}o.current=null}}},[e,v]),e)?(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",children:(0,a.jsxs)("div",{className:"relative card-elev max-w-md w-full mx-4 overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[(0,a.jsx)("h2",{className:"text-xl font-bold text-text",children:l("login.qrScanTitle")}),(0,a.jsx)("button",{onClick:w,className:"text-text-muted hover:text-text transition-colors p-1",children:(0,a.jsx)(d.X,{size:24})})]}),(0,a.jsx)("div",{className:"relative bg-black",children:(0,a.jsx)("div",{id:"qr-reader",ref:i,className:"w-full",style:{minHeight:"300px"}})}),(0,a.jsxs)("div",{className:"p-4",children:[g?(0,a.jsxs)("div",{className:"flex items-start gap-2 p-3 bg-red-500/10 rounded-brand text-red-400",children:[(0,a.jsx)(d.RI,{size:20,className:"flex-shrink-0 mt-0.5"}),(0,a.jsx)("p",{className:"text-sm",children:g})]}):"detected"===f?(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 p-3 bg-green-500/10 rounded-brand text-green-400",children:[(0,a.jsx)(d.vW,{size:22}),(0,a.jsx)("p",{className:"text-sm font-medium",children:l("login.qrDetected")})]}):"authenticating"===f?(0,a.jsx)("div",{className:"flex items-center justify-center gap-2 p-3 bg-brand-500/10 rounded-brand text-brand-400",children:(0,a.jsx)("p",{className:"text-sm font-medium",children:l("login.qrAuthenticating")})}):(0,a.jsx)("p",{className:"text-sm text-text-muted text-center",children:l("login.qrHint")}),(0,a.jsx)(x.A,{variant:"secondary",onClick:w,disabled:"authenticating"===f,className:"w-full mt-4",children:"authenticating"===f?l("login.qrPleaseWait"):l("common.cancel")})]})]})}):null}var p=s(45111),h=s(42174),g=s(30240),b=s(8910),f=s(52345),j=s(18057);function y({className:e="",showLabel:t=!0}){let{locale:s}=(0,m.s)(),[r,l]=(0,n.useState)(!1),i=f.dI.find(e=>e.code===s)||f.dI[0];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{onClick:()=>{(0,b.e)(),l(!0)},className:`flex items-center gap-1.5 bg-surface-2 hover:bg-surface-3 rounded-brand text-text text-sm px-2 py-1 transition-all duration-150 ease-out active:scale-[0.96] ${e}`,title:i.label,children:[(0,a.jsx)("img",{src:`https://flagcdn.com/w40/${i.country}.png`,alt:i.label,className:"w-[17px] h-[12px] object-cover rounded-[2px]",loading:"lazy"}),t&&(0,a.jsx)("span",{className:"hidden sm:inline",children:i.code.toUpperCase()})]}),(0,a.jsx)(j.A,{isOpen:r,onClose:()=>l(!1)})]})}var v=s(90753),w=s(38415),N=s(23346);let k=null;async function C(){k||(k=N.Ay.ready),await k}async function S(e,t){await C();let s=N.Ay.from_base64(e,N.Ay.base64_variants.ORIGINAL),a=N.Ay.from_string(t),n=N.Ay.crypto_box_seal(a,s);return N.Ay.to_base64(n,N.Ay.base64_variants.ORIGINAL)}function A(e=24){let t=new Uint8Array(e);return crypto.getRandomValues(t),Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}let _="9remote_github_token",L="9remote:githubTokenChange";async function z(e,t,s={}){let a=await fetch(`${w.pe}${t}`,{...s,headers:{...{Authorization:`Bearer ${e}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},...s.headers||{}}});if(!a.ok){let e=await a.text().catch(()=>"");throw Error(`GitHub ${a.status}: ${e||a.statusText}`)}return 204===a.status?null:a.json()}function K(){let[e,t]=(0,n.useState)(()=>localStorage.getItem(_)||""),[s,a]=(0,n.useState)(!1),[r,l]=(0,n.useState)(null);(0,n.useEffect)(()=>{let e=()=>{t(localStorage.getItem(_)||"")};return window.addEventListener(L,e),window.addEventListener("storage",e),()=>{window.removeEventListener(L,e),window.removeEventListener("storage",e)}},[!0]);let i=(0,n.useCallback)(e=>{t(e),e?localStorage.setItem(_,e):localStorage.removeItem(_),window.dispatchEvent(new Event(L))},[!0]),o=(0,n.useCallback)(()=>{i("")},[i]),c=(0,n.useCallback)(async(t=e)=>z(t,w.no.user),[e]),d=(0,n.useCallback)(async()=>{a(!0),l(null);try{return(await z(e,w.no.codespaces)).codespaces||[]}catch(e){return l(e.message),[]}finally{a(!1)}},[e]),x=(0,n.useCallback)(async t=>z(e,w.no.codespaceByName(t)),[e]),m=(0,n.useCallback)(async t=>z(e,w.no.startCodespace(t),{method:"POST"}),[e]),u=(0,n.useCallback)(async()=>z(e,w.no.userReposList),[e]),p=(0,n.useCallback)(async(t,s)=>z(e,w.no.createCodespaceForRepo(t,s),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),[e]),h=(0,n.useCallback)(async(t,s)=>{let a=await z(e,w.no.codespaceSecretsPublicKey),n=await S(a.key,s);await z(e,w.no.codespaceSecret(w.Gf),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({encrypted_value:n,key_id:a.key_id,selected_repository_ids:[t]})})},[e]),g=(0,n.useCallback)(async(t,s)=>{let a=w.no.repoContents(t,s,w.Hu),n=!1;try{await z(e,a),n=!0}catch{}if(n)return{existed:!0};let r=JSON.stringify(w.cu,null,2);return await z(e,a,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:"Add 9remote devcontainer",content:btoa(unescape(encodeURIComponent(r)))})}),{existed:!1}},[e]),b=(0,n.useCallback)(async(e,t)=>{for(let s=0;s<w.ij;s++){let s=await x(e);if(t?.(s.state),s.state===w.Gi.available)return s;await new Promise(e=>setTimeout(e,w.Nn))}throw Error("Codespace start timeout")},[x]);return{token:e,setToken:i,clearToken:o,loading:s,error:r,getUser:c,listCodespaces:d,getCodespace:x,startCodespace:m,waitUntilAvailable:b,listRepos:u,createCodespace:p,ensureDevcontainer:g,setApiKeySecret:h,generateApiKey:A}}function I({isOpen:e,onClose:t,onCreated:s}){let{listRepos:r,createCodespace:l,ensureDevcontainer:i,setApiKeySecret:o,generateApiKey:c,error:m}=K(),[u,h]=(0,n.useState)([]),[g,b]=(0,n.useState)(!1),[f,j]=(0,n.useState)(null),[y,v]=(0,n.useState)(""),[w,N]=(0,n.useState)(null),[k,C]=(0,n.useState)("");(0,n.useEffect)(()=>{e&&(N(null),b(!0),r().then(e=>h(Array.isArray(e)?e:[])).catch(e=>N(e.message)).finally(()=>b(!1)))},[e,r]),(0,n.useEffect)(()=>{if(!e||f)return;let s=e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),t?.())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[e,f,t]);let S=(0,n.useMemo)(()=>{let e=y.trim().toLowerCase();return e?u.filter(t=>t.full_name.toLowerCase().includes(e)):u},[u,y]),A=async e=>{j(e.full_name),N(null),C("Generating API key...");try{let t=c();C("Setting codespace secret..."),await o(e.id,t),C("Setting up devcontainer..."),await i(e.owner.login,e.name),C("Creating codespace...");let a=await l(e.owner.login,e.name);s({codespace:a,apiKey:t})}catch(e){N(e.message)}finally{j(null),C("")}};return e?(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:t,children:(0,a.jsxs)("div",{className:"card-elev p-6 max-w-md w-full max-h-[80dvh] flex flex-col border border-border",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-bold text-text",children:"Select repository"}),(0,a.jsx)("button",{onClick:t,className:"p-1 text-text-muted hover:text-text",children:(0,a.jsx)(d.X,{size:20})})]}),(0,a.jsxs)("div",{className:"relative mb-3",children:[(0,a.jsx)(d.vj,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-text-muted"}),(0,a.jsx)("input",{type:"text",value:y,onChange:e=>v(e.target.value),placeholder:"Search repos...",className:"w-full pl-9 pr-3 py-2 bg-surface-2 rounded-brand text-text placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-brand-500/40 text-sm"})]}),(w||m)&&(0,a.jsxs)("div",{className:"flex items-start gap-2 mb-3 p-2 bg-danger/10 rounded-brand text-xs text-danger",children:[(0,a.jsx)(d.RI,{size:14,className:"flex-shrink-0 mt-0.5"}),(0,a.jsx)("span",{className:"break-words",children:w||m})]}),(0,a.jsx)("div",{className:"flex-1 overflow-auto space-y-1",children:g?(0,a.jsx)(p.A,{text:"Loading repos..."}):0===S.length?(0,a.jsx)("div",{className:"text-center py-6 text-text-muted text-sm",children:"No repos"}):S.map(e=>{let t=f===e.full_name;return(0,a.jsxs)("div",{className:"p-2 bg-surface-2 hover:bg-surface-3 rounded-brand transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-sm text-text font-medium truncate",title:e.full_name,children:e.full_name}),e.private&&(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"private"})]}),(0,a.jsxs)(x.A,{variant:"primary",onClick:()=>A(e),disabled:!!f,loading:t,className:"!py-1 !px-2 text-xs",children:[(0,a.jsx)(d.FW,{size:12}),"Create"]})]}),t&&k&&(0,a.jsx)("div",{className:"mt-1 text-xs text-text-muted",children:k})]},e.id)})})]})}):null}let E="9remote_codespace_keys";function R(){try{return JSON.parse(localStorage.getItem(E)||"{}")}catch{return{}}}function P({onConnect:e,onLogout:t}){let{listCodespaces:s,startCodespace:r,waitUntilAvailable:l,loading:i,error:o,getUser:c}=K(),[m,u]=(0,n.useState)([]),[h,g]=(0,n.useState)(null),[b,f]=(0,n.useState)(null),[j,y]=(0,n.useState)(""),[v,N]=(0,n.useState)(!1),k=(0,n.useCallback)(async()=>{try{let e=await c();g(e)}catch{}u(await s())},[c,s]);(0,n.useEffect)(()=>{k()},[k]);let C=async t=>{var s;let a=(s=t.name,R()[s]||null);if(!a){y("No saved key for this codespace. Recreate it from web to enable auto-connect."),f(t.name),setTimeout(()=>{f(null),y("")},4e3);return}f(t.name),y("");try{let s=t;t.state!==w.Gi.available&&(y("Starting codespace..."),await r(t.name),s=await l(t.name,e=>{y(`State: ${e}`)})),e(s,a)}catch(e){y(`Error: ${e.message}`)}finally{f(null)}};return(0,a.jsxs)("div",{className:"card-elev p-8 max-w-md w-full border border-border",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)("div",{className:"p-2 bg-brand-500/10 rounded-brand",children:(0,a.jsx)(d.Cp,{className:"text-brand-500",size:24})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h2",{className:"text-xl font-bold text-text",children:"Codespaces"}),h&&(0,a.jsxs)("p",{className:"text-sm text-text-muted truncate",children:["@",h.login]})]}),(0,a.jsx)("button",{onClick:()=>N(!0),className:"p-2 text-text-muted hover:text-text hover:bg-surface-2 rounded-brand transition-colors",title:"New codespace",children:(0,a.jsx)(d.FW,{size:18})}),(0,a.jsx)("button",{onClick:k,disabled:i,className:"p-2 text-text-muted hover:text-text hover:bg-surface-2 rounded-brand transition-colors",title:"Refresh",children:(0,a.jsx)(d.e9,{size:18,className:i?"animate-spin":""})}),(0,a.jsx)("button",{onClick:t,className:"p-2 text-text-muted hover:text-text hover:bg-surface-2 rounded-brand transition-colors",title:"Logout",children:(0,a.jsx)(d.nU,{size:18})})]}),o&&(0,a.jsxs)("div",{className:"flex items-start gap-2 mb-4 p-3 bg-danger/10 rounded-brand text-sm text-danger",children:[(0,a.jsx)(d.RI,{size:16,className:"flex-shrink-0 mt-0.5"}),(0,a.jsx)("span",{className:"break-words",children:o})]}),i&&0===m.length?(0,a.jsx)(p.A,{text:"Loading codespaces..."}):0===m.length?(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)("p",{className:"text-text-muted text-sm mb-4",children:"No codespaces yet."}),(0,a.jsxs)(x.A,{variant:"primary",onClick:()=>N(!0),children:[(0,a.jsx)(d.FW,{size:16}),"Create new codespace"]})]}):(0,a.jsx)("div",{className:"space-y-2",children:m.map(e=>{let t=b===e.name,s=e.state===w.Gi.available;return(0,a.jsxs)("div",{className:"bg-surface-2 rounded-brand p-3 hover:bg-surface-3 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-text font-medium truncate",title:e.display_name||e.name,children:e.display_name||e.name}),(0,a.jsxs)("div",{className:"text-xs text-text-muted truncate",title:`${e.repository?.full_name} \xb7 ${e.state}`,children:[e.repository?.full_name," \xb7 ",e.state]})]}),(0,a.jsxs)(x.A,{variant:"primary",onClick:()=>C(e),disabled:t,loading:t,className:"!py-1.5 !px-3 text-sm",children:[(0,a.jsx)(d.jG,{size:14}),s?"Connect":"Start"]})]}),t&&j&&(0,a.jsx)("div",{className:"mt-2 text-xs text-text-muted",children:j})]},e.name)})}),(0,a.jsx)(I,{isOpen:v,onClose:()=>N(!1),onCreated:({codespace:e,apiKey:t})=>{var s;let a;s=e.name,(a=R())[s]=t,localStorage.setItem(E,JSON.stringify(a)),N(!1),k()}})]})}var T=s(97711),M=s(90084),F=s(86129),$=s(11155),O=s(2805),U=s(90076);function q(e){let t=String(e||"").trim(),s=e=>({tempKey:e.slice(0,6).toUpperCase(),tail:e.slice(6,8).toUpperCase()}),a=/#([A-NP-Z1-9]{6}-?[a-np-z1-9]{2})$/i.exec(t);if(a)return s(a[1].replace(/-/g,""));let n=/^([A-NP-Z1-9]{6}-?[a-np-z1-9]{2})$/i.exec(t);if(n)return s(n[1].replace(/-/g,""));let r=/[?&]k=([A-NP-Z1-9]{6})(?:[^A-NP-Z1-9]|$)/i.exec(t);return r?{tempKey:r[1].toUpperCase()}:/^[A-NP-Z1-9]{6}$/i.test(t)?{tempKey:t.toUpperCase()}:null}function D(){let{t:e}=(0,m.s)(),[t,s]=(0,n.useState)(""),[b,f]=(0,n.useState)(!0),[j,N]=(0,n.useState)([]),[k,C]=(0,n.useState)(!1),[S,A]=(0,n.useState)(!1),[_,L]=(0,n.useState)("local"),[z,I]=(0,n.useState)(null),[E,R]=(0,n.useState)(""),[D,G]=(0,n.useState)(null),[W,B]=(0,n.useState)(null),[H,J]=(0,n.useState)(null),Q="3.0.7",{token:X,clearToken:Z}=K(),{setAuth:V}=(0,T.F)(),Y=(0,r.useSearchParams)(),ee=(0,r.useRouter)(),{loading:et,error:es,authenticateWithToken:ea,authenticateWithApiKey:en}=(0,l.As)(),[er,el]=(0,n.useState)(!1),{loadKeys:ei,saveKey:eo,removeKey:ec,renameKey:ed,hasStoredKeys:ex,updateLastLogin:em}=(0,i.u)(),eu=(0,n.useMemo)(()=>j.some(e=>(0,$.PF)(e.key)),[j]),ep=(0,n.useMemo)(()=>Y.get("t"),[Y]),[eh]=(0,n.useState)(()=>{try{let e=sessionStorage.getItem("9remote_url_pairing");if(e)return e;let t=q(window.location.hash)||q(window.location.search);if(t?.tempKey)return sessionStorage.setItem("9remote_url_pairing",t.tempKey+(t.tail||"")),t.tempKey+(t.tail||"")}catch{}return null}),eg=!!ep||!!eh;(0,n.useEffect)(()=>{if(window.location.hash||window.location.search){let e=q(window.location.hash)||q(window.location.search);e?.tempKey&&window.history.replaceState(null,"",window.location.pathname)}f("false"!==localStorage.getItem("9remote_remember_key_preference")),N(ei()),C(!0),sessionStorage.getItem(F.Jd)&&(sessionStorage.removeItem(F.Jd),el(!0)),X&&L("github"),(0,O._r)()&&window.location.port===String(U._8)&&fetch("/api/ui/state").then(e=>e.ok?e.json():null).then(e=>{if(e?.permanentKey){J(e.permanentKey);let t="remote"===Y.get("mode");if(t)try{sessionStorage.setItem("9remote_manual_disconnect","1")}catch{}if(!(t||"1"===sessionStorage.getItem("9remote_manual_disconnect"))){let t=e.permanentKey,s=(0,$.Uo)(t),a=(0,$.Cj)(t);(0,M.LG)(s,{tail:a}),V({apiKey:s,tunnelUrl:window.location.origin,mode:"local",tempKey:null,localIp:null}),ee.push("/workspace/")}}}).catch(()=>{})},[ei,X,ee,V,Y]);let eb=(0,n.useCallback)(async e=>{let t=q(e),s=await ea(t?.tempKey||e,!0,t?.tail);try{sessionStorage.removeItem("9remote_url_pairing")}catch{}s.success&&(t?.tail&&(0,M.LG)(t.tempKey,{tail:t.tail}),"false"!==localStorage.getItem("9remote_remember_key_preference")&&sessionStorage.setItem(F.aS,"1"),ee.push("/workspace/"))},[ea,ee]),ef=(0,n.useRef)(!1);(0,n.useEffect)(()=>{(ep||eh)&&(ef.current||(ef.current=!0,ep?ea(ep):eb(eh)))},[ep,eh,ea,eb]);let ej=async()=>{let s=t.trim();if(!s)return;if((0,$.PF)(s))return void setError(e("login.legacyKeyError"));let a=q(s),n=!!a?.tempKey,r=n?a.tempKey:(0,$.Uo)(s),l=n?a.tail:(0,$.Cj)(s),i=n?await ea(a.tempKey,!0,a.tail):await en(s);if(!i.success)return;let o=n?i.apiKey:r,c=n?a.tempKey:o;l&&c&&(0,M.LG)(c,{tail:l}),b&&o&&(n?sessionStorage.setItem(F.aS,"1"):sessionStorage.setItem(F.El,s)),ee.push("/workspace/")},ey=async t=>{let s;if(!t)return;if((0,$.PF)(t))return void setError(e("login.legacyKeyError"));let a=(0,$.Cj)(t);a&&(0,M.LG)((0,$.Uo)(t),{tail:a});let n=a?t:(0,M.$4)(t);B(t);try{s=await en(n)}finally{B(null)}s?.success&&(n!==t&&eo(n),em(t),ee.push("/workspace/"))},ev=e=>{ed(e,E.trim()),N(ei()),I(null)},ew=()=>{I(null)},eN=async e=>{let t=q(e);return!!t?.tempKey&&!!(await ea(t.tempKey,!0,t.tail)).success&&(t.tail&&(0,M.LG)(t.tempKey,{tail:t.tail}),"false"!==localStorage.getItem("9remote_remember_key_preference")&&sessionStorage.setItem(F.aS,"1"),ee.push("/workspace/"),!0)};return eg&&et?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.A,{}),(0,a.jsx)(c.A,{children:(0,a.jsx)("div",{className:"card-elev p-8 max-w-md w-full border border-border",children:(0,a.jsx)(p.A,{size:"lg",text:e("login.authenticating")})})})]}):"github"===_&&X?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.A,{}),(0,a.jsx)(c.A,{children:(0,a.jsx)(P,{onConnect:(e,t)=>{let s=(0,w.xO)(e.name);V({apiKey:(0,$.Uo)(t),tunnelUrl:s,mode:"remote"}),ee.push("/workspace/")},onLogout:()=>{Z()}})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.A,{}),k&&(0,O._r)()&&(0,a.jsxs)("a",{href:"/",className:"fixed top-4 left-4 z-50 inline-flex items-center gap-2 px-3 py-1.5 text-xs font-medium text-text hover:text-white bg-surface-2/90 hover:bg-surface-3 border border-border-subtle rounded-brand-lg backdrop-blur-md transition-all shadow-sm active:scale-[0.97]",title:"Back to Host QR",children:[(0,a.jsx)(d.Ay,{name:"ChevronLeft",size:15,className:"opacity-70"}),(0,a.jsx)(d.Ay,{name:"QrCode",size:15,className:"text-brand-500"}),(0,a.jsx)("span",{children:"Host QR"})]}),(0,a.jsxs)("div",{className:"min-h-screen grid lg:grid-cols-2",children:[(0,a.jsxs)("section",{className:"hidden lg:flex flex-col justify-between px-12 xl:px-20 py-12 relative overflow-hidden",children:[(0,a.jsx)("div",{className:"login-hero-glow","aria-hidden":!0}),(0,a.jsxs)("div",{className:"my-auto max-w-xl relative z-10",children:[(0,a.jsxs)("div",{className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-full bg-surface-2/60 border border-border-subtle font-mono text-[11px] text-text-muted mb-7",children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-brand-500 animate-pulse-glow"}),e("login.termConnected")," \xb7 ",e("login.termTunnel")]}),(0,a.jsxs)("h1",{className:"text-6xl xl:text-7xl font-extrabold tracking-tight leading-[0.98] mb-6 text-text",children:[e("login.heroLine1"),(0,a.jsx)("br",{}),e("login.heroLine2"),(0,a.jsx)("br",{}),(0,a.jsx)("span",{className:"login-hero-grad",children:e("login.heroLine3")})]}),(0,a.jsx)("p",{className:"text-text-muted text-base lg:text-lg leading-relaxed max-w-md mb-8",children:e("login.tagline")}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2 mb-9",children:["Terminal","Desktop","Files","WebRTC low-latency","iOS \xb7 Android \xb7 Web"].map(e=>(0,a.jsx)("span",{className:"font-mono text-xs text-text-muted px-3 py-1.5 rounded-full border border-border-subtle",children:e},e))}),(0,a.jsxs)("div",{className:"rounded-xl border border-border-subtle bg-surface-2/60 overflow-hidden max-w-md shadow-lg",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b border-border-subtle",children:[(0,a.jsx)("span",{className:"w-2.5 h-2.5 rounded-full bg-[#ff5f57]"}),(0,a.jsx)("span",{className:"w-2.5 h-2.5 rounded-full bg-[#febc2e]"}),(0,a.jsx)("span",{className:"w-2.5 h-2.5 rounded-full bg-[#28c840]"}),(0,a.jsx)("span",{className:"ml-2 font-mono text-[10px] text-text-subtle",children:"dev@mac — zsh"})]}),(0,a.jsxs)("div",{className:"p-3.5 font-mono text-[12px] leading-relaxed",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-subtle",children:"➜"})," 9remote start"]}),(0,a.jsx)("div",{className:"text-text-subtle",children:"↳ tunnel up \xb7 pairing open"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-brand-500",children:"[ok]"})," ",(0,a.jsx)("span",{className:"text-text",children:"machine"})," ",(0,a.jsx)("span",{className:"text-text-subtle",children:"macbook-pro-m3"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-brand-500",children:"[ok]"})," ",(0,a.jsx)("span",{className:"text-text",children:"pty"})," ",(0,a.jsx)("span",{className:"text-text-subtle",children:"daemon v3.1 \xb7 12 warm"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[#6aab6a]",children:"●"})," ",(0,a.jsx)("span",{className:"text-text-subtle",children:"waiting for phone…"})," ",(0,a.jsx)("span",{className:"inline-block w-[7px] h-[13px] bg-brand-500 align-middle animate-cursor-blink"})]})]})]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-x-5 gap-y-1 font-mono text-[11px] text-text-subtle pt-8 relative z-10",children:[(0,a.jsx)("span",{children:"› PTY persistent"}),(0,a.jsx)("span",{children:"› end-to-end encrypted"}),(0,a.jsx)("span",{children:"› open source"})]})]}),(0,a.jsxs)("section",{className:"flex items-center justify-center p-6 sm:p-10 lg:border-l lg:border-border-subtle lg:bg-surface-1 relative",children:[(0,a.jsx)("div",{className:"login-mobile-glow lg:hidden","aria-hidden":!0}),(0,a.jsxs)("div",{className:"relative z-10 w-full max-w-sm space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)("img",{src:"/icon-192.png",alt:"9Remote Logo",className:"w-10 h-10 rounded-[11px] object-contain shadow-lg shadow-brand-500/20"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h1",{className:"text-[22px] font-bold tracking-tight text-text leading-none",children:"9Remote"}),Q&&(0,a.jsxs)("p",{className:"font-mono text-[11px] text-text-subtle mt-1",children:["v",Q]})]}),(0,a.jsx)(y,{}),(0,a.jsx)(v.A,{})]}),(0,a.jsx)("p",{className:"text-text-muted text-lg font-medium leading-snug pr-4 mb-6 lg:hidden",children:e("login.tagline")}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2.5",children:[(0,a.jsx)(d.Ay,{name:"KeyRound",className:"text-text-muted opacity-70",size:14}),(0,a.jsx)("span",{className:"text-[13px] font-semibold text-text",children:e("login.accessKey")})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{id:"accessKeyInput",type:"text",value:t,onChange:e=>{let t=e.target.value;s(t.length<=F.qM?t.toUpperCase():t.toLowerCase())},onKeyDown:e=>"Enter"===e.key&&t&&ej(),placeholder:e("login.placeholder"),className:"w-full pl-3.5 pr-20 py-3 bg-surface-2 border border-border-subtle rounded-[10px] font-mono text-sm text-text placeholder-text-subtle focus:outline-none focus:border-brand-500 focus:ring-2 focus:ring-brand-500/20 transition-all duration-150"}),(0,a.jsxs)("div",{className:"absolute right-2.5 top-1/2 -translate-y-1/2 flex items-center gap-1",children:[t&&(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>{s("")},className:"w-7 h-7 grid place-items-center rounded-[7px] text-text-subtle hover:bg-surface-3 hover:text-text transition-colors",type:"button",children:(0,a.jsx)(d.X,{size:16})})}),(0,a.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>A(!0),className:"w-7 h-7 grid place-items-center rounded-[7px] text-text-subtle hover:bg-surface-3 hover:text-brand-500 transition-colors",type:"button","aria-label":e("login.scanQr"),children:(0,a.jsx)(d.Ay,{name:"QrCode",size:16})})]})]}),(es||er)&&(0,a.jsx)("p",{className:"mt-2 text-xs font-mono text-danger",children:"agent-offline"===es?e("login.agentOffline"):es&&"wrong-key-tail"!==es?es:e("login.invalidKeyTail")}),(0,a.jsxs)("label",{className:"flex items-center gap-2.5 cursor-pointer mt-4 select-none",children:[(0,a.jsx)("input",{type:"checkbox",checked:b,onChange:e=>{var t;f(t=e.target.checked),localStorage.setItem("9remote_remember_key_preference",t)},className:"w-[15px] h-[15px] accent-brand-500"}),(0,a.jsx)("span",{className:"text-[13px] text-text-muted",children:e("login.rememberKey")})]}),(0,a.jsx)(x.A,{variant:"primary",onClick:ej,loading:et,className:"btn-cta w-full mt-4",children:(0,a.jsxs)("span",{className:"inline-flex items-center justify-center gap-2",children:[e("login.connect"),(0,a.jsx)(d.Ay,{name:"ArrowRight",size:16})]})}),k&&j.length>0&&(0,a.jsxs)("div",{className:"mt-5 pt-5 border-t border-border-subtle",children:[(0,a.jsx)("div",{className:"font-mono text-[11px] uppercase tracking-wider text-text-subtle mb-1 px-1",children:e("login.savedKeys")}),eu&&(0,a.jsxs)("div",{className:"my-2.5 px-3 py-2.5 bg-amber-500/10 border border-amber-500/30 rounded-brand-lg flex items-start gap-2.5",children:[(0,a.jsx)(d.Ay,{name:"AlertCircle",size:16,className:"text-amber-500 shrink-0 mt-0.5"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-text",children:e("login.legacyKeyUpdateRequired")}),(0,a.jsx)("div",{className:"text-xs text-text-muted mt-0.5",children:e("login.legacyKeyUpdateHint")}),(0,a.jsx)("code",{className:"inline-block mt-1.5 px-2 py-0.5 bg-surface-2 border border-border text-text text-xs rounded font-mono select-all",children:"npm i -g 9remote@latest"})]})]}),j.map(t=>{let s=z===t.id,n=W===t.key,r=(0,$.PF)(t.key);return(0,a.jsxs)("div",{className:`flex items-center gap-3 px-1 py-2 rounded-[10px] hover:bg-surface-2 transition-colors cursor-pointer ${r?"opacity-85":""}`,onClick:()=>!s&&!n&&ey(t.key),role:"button",tabIndex:0,children:[(0,a.jsx)("div",{className:`w-12 h-12 rounded-[12px] bg-surface-2 border ${r?"border-amber-500/40 text-amber-500":"border-border-subtle text-text-muted"} grid place-items-center flex-shrink-0`,children:(0,a.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",className:"w-[26px] h-[26px]",children:[(0,a.jsx)("rect",{x:"2",y:"4",width:"20",height:"13",rx:"2"}),(0,a.jsx)("line",{x1:"2",y1:"20",x2:"22",y2:"20"})]})}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:s?(0,a.jsxs)("div",{className:"flex items-center gap-1",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("input",{autoFocus:!0,value:E,onChange:e=>R(e.target.value),onKeyDown:e=>{"Enter"===e.key&&ev(t.id),"Escape"===e.key&&ew()},placeholder:e("login.namePlaceholder"),className:"flex-1 min-w-0 bg-surface-2 border border-brand-500 rounded-md text-text text-[13px] px-2 py-1 outline-none"}),(0,a.jsx)("button",{onClick:()=>ev(t.id),className:"w-6 h-6 grid place-items-center rounded-md bg-brand-500 text-white","aria-label":e("common.done"),children:(0,a.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",className:"w-3 h-3",children:(0,a.jsx)("polyline",{points:"20 6 9 17 4 12"})})}),(0,a.jsx)("button",{onClick:ew,className:"w-6 h-6 grid place-items-center rounded-md bg-surface-2 text-text-muted","aria-label":e("common.cancel"),children:(0,a.jsx)(d.X,{size:13})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-[13px] font-medium text-text truncate",title:t.label||e("agentSwitcher.unnamed"),children:t.label||e("agentSwitcher.unnamed")}),r&&(0,a.jsx)("span",{className:"shrink-0 px-1.5 py-0.5 text-[9px] font-semibold font-mono uppercase rounded bg-amber-500/15 text-amber-500 border border-amber-500/30",children:e("login.updateRequired")})]}),(0,a.jsx)("div",{className:"font-mono text-[11px] text-text-subtle mt-0.5 truncate",children:(0,o.o)(t.key)})]})}),!s&&(0,a.jsx)("span",{className:"font-mono text-[11px] text-text-subtle whitespace-nowrap",children:n?e("agentSwitcher.connecting"):(t=>{if(!t)return"";try{let s=new Date(t),a=new Date-s,n=Math.floor(a/6e4),r=Math.floor(a/36e5),l=Math.floor(a/864e5);if(n<1)return e("login.justNow");if(n<60)return e("login.minutesAgo",{n:n});if(r<24)return e("login.hoursAgo",{n:r});if(l<7)return e("login.daysAgo",{n:l});return s.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return""}})(t.lastLoginDate)}),!s&&(0,a.jsxs)("div",{className:"flex gap-0.5",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("button",{onClick:()=>{I(t.id),R(t.label||"")},title:e("common.edit"),className:"w-[26px] h-[26px] grid place-items-center rounded-[7px] text-text-subtle hover:bg-surface-3 hover:text-text transition-colors",children:(0,a.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"w-3.5 h-3.5",children:[(0,a.jsx)("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),(0,a.jsx)("path",{d:"M18.5 2.5a2.12 2.12 0 0 1 3 3L12 15l-4 1 1-4z"})]})}),(0,a.jsx)("button",{onClick:()=>G(t),title:e("common.delete"),className:"w-[26px] h-[26px] grid place-items-center rounded-[7px] text-text-subtle hover:bg-surface-3 hover:text-danger transition-colors",children:(0,a.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"w-3.5 h-3.5",children:[(0,a.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,a.jsx)("path",{d:"M19 6l-2 14a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L5 6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]},t.id)})]}),(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 pt-1 text-text-subtle",children:[(0,a.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"w-3.5 h-3.5",children:(0,a.jsx)("path",{d:"M12 2l9 4v6c0 5-3.8 9.7-9 11-5.2-1.3-9-6-9-11V6l9-4z"})}),(0,a.jsx)("span",{className:"font-mono text-[11px]",children:e("login.secureTitle")})]})]})]})]}),(0,a.jsx)(u,{isOpen:S,onClose:()=>A(!1),onScan:eN}),(0,a.jsx)(h.A,{isOpen:!!D,onClose:()=>G(null),onConfirm:()=>{D&&(ec(D.id),N(ei()))},title:e("login.deleteKeyTitle"),message:e("login.deleteKeyConfirm",{name:D?.label}),confirmText:e("common.delete")})]})}function G(){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.A,{}),(0,a.jsx)(c.A,{children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,a.jsx)(p.A,{text:"Loading..."}),(0,a.jsx)("a",{href:"/login",className:"text-sm text-text-muted hover:text-brand-500 underline underline-offset-4 transition-colors",children:"Reload"})]})})]})}function W(){return(0,a.jsx)(n.Suspense,{fallback:(0,a.jsx)(G,{}),children:(0,a.jsx)(D,{})})}},59893:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var a=s(73365);function n({children:e,centered:t=!0,className:s=""}){return(0,a.jsx)("div",{className:`min-h-screen ${t?"flex items-center justify-center p-4":""} ${s}`,children:e})}},66859:(e,t,s)=>{Promise.resolve().then(s.bind(s,45136))},90753:(e,t,s)=>{"use strict";s.d(t,{A:()=>o});var a=s(73365),n=s(44976),r=s(8910);let l=({size:e=18})=>(0,a.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,a.jsx)("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}),i=({size:e=18})=>(0,a.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})});function o({className:e="",size:t=18}){let{theme:s,toggleTheme:c}=(0,n.D)(),d="dark"===s;return(0,a.jsx)("button",{type:"button",onClick:()=>{(0,r.e)(),c()},"aria-label":d?"Switch to light theme":"Switch to dark theme",title:d?"Light mode":"Dark mode",className:`p-1.5 rounded-brand transition-colors text-[var(--color-text-muted)] hover:text-[var(--color-text)] hover:bg-[var(--color-surface-2)] ${e}`,children:d?(0,a.jsx)(l,{size:t}):(0,a.jsx)(i,{size:t})})}}},e=>{e.O(0,[1236,161,635,9958,3973,2347,5158,7358],()=>e(e.s=66859)),_N_E=e.O()}]);