@runtimescope/collector 0.10.11 → 0.10.13

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 (63) hide show
  1. package/dist/dashboard-assets/assets/{api-map-page-DHlcR_sh.js → api-map-page-Btbazs5z.js} +1 -1
  2. package/dist/dashboard-assets/assets/{badge-BGgXl2qy.js → badge-BOfEUuSW.js} +1 -1
  3. package/dist/dashboard-assets/assets/{breadcrumbs-page-BK-FB2nG.js → breadcrumbs-page-ahYuYyrd.js} +1 -1
  4. package/dist/dashboard-assets/assets/{capex-page-BVJ3T1W4.js → capex-page-H_aV7VU6.js} +1 -1
  5. package/dist/dashboard-assets/assets/{chevron-right-D0z93_PM.js → chevron-right-Df1qu9CE.js} +1 -1
  6. package/dist/dashboard-assets/assets/{circle-check-big-DMEGTtSI.js → circle-check-big-Dd6W5_do.js} +1 -1
  7. package/dist/dashboard-assets/assets/{clock-BZReVxQC.js → clock-CmDPWLyG.js} +1 -1
  8. package/dist/dashboard-assets/assets/{code-block-BfLeZt-6.js → code-block-D47Pz1qB.js} +1 -1
  9. package/dist/dashboard-assets/assets/{console-page-DMgLtlCk.js → console-page-B3sYOQK9.js} +1 -1
  10. package/dist/dashboard-assets/assets/{data-table-CxVXG3zy.js → data-table-A2Iq_hk5.js} +1 -1
  11. package/dist/dashboard-assets/assets/{database-page-BmpNk_GJ.js → database-page-DYOGNtgK.js} +1 -1
  12. package/dist/dashboard-assets/assets/{detail-panel-CxidKK1j.js → detail-panel-YWSVnqP_.js} +1 -1
  13. package/dist/dashboard-assets/assets/{dollar-sign-DqZoTS1i.js → dollar-sign-BDj484XE.js} +1 -1
  14. package/dist/dashboard-assets/assets/{download-OeUZzFM9.js → download-CwvkYJyJ.js} +1 -1
  15. package/dist/dashboard-assets/assets/{empty-config-state-BRw-Dnk-.js → empty-config-state-ReVUjdJ_.js} +1 -1
  16. package/dist/dashboard-assets/assets/{events-page-Bhde5vnj.js → events-page-d6_fhDSn.js} +1 -1
  17. package/dist/dashboard-assets/assets/{export-button-BioZ3ot5.js → export-button-D7y2ugNf.js} +1 -1
  18. package/dist/dashboard-assets/assets/{file-text-CTqS_5sj.js → file-text-h8kcLd2l.js} +1 -1
  19. package/dist/dashboard-assets/assets/{filter-bar-CCwrTxz_.js → filter-bar-CP39inkf.js} +1 -1
  20. package/dist/dashboard-assets/assets/{folder-open-g1ZHHoW-.js → folder-open-D-HQTMMw.js} +1 -1
  21. package/dist/dashboard-assets/assets/{git-page-drqH-ymG.js → git-page-5wVisusM.js} +1 -1
  22. package/dist/dashboard-assets/assets/{hard-drive-DVtZVR9y.js → hard-drive-D8jrlixH.js} +1 -1
  23. package/dist/dashboard-assets/assets/{home-page-Bro6iPXa.js → home-page-lMWZHIMB.js} +1 -1
  24. package/dist/dashboard-assets/assets/{index-DgQg-mjd.js → index-CUDottTv.js} +3 -3
  25. package/dist/dashboard-assets/assets/{info-aicvFsRA.js → info-C0v7mgTM.js} +1 -1
  26. package/dist/dashboard-assets/assets/{infra-page-CXFCwaut.js → infra-page-Cwb8--Fc.js} +1 -1
  27. package/dist/dashboard-assets/assets/{issues-page-207U1dk-.js → issues-page-8abUxnvT.js} +1 -1
  28. package/dist/dashboard-assets/assets/{json-viewer-CtsL_JTK.js → json-viewer-Dup5M0px.js} +1 -1
  29. package/dist/dashboard-assets/assets/{kitchen-sink-BN8WXBVu.js → kitchen-sink-DmOR6KnI.js} +1 -1
  30. package/dist/dashboard-assets/assets/{memory-page-xoARxvSA.js → memory-page-CnpiwsEL.js} +1 -1
  31. package/dist/dashboard-assets/assets/{message-square-DY6473o6.js → message-square-Dwj0jRjI.js} +1 -1
  32. package/dist/dashboard-assets/assets/{metric-card-BDGLEpmZ.js → metric-card-DE3zVnFg.js} +1 -1
  33. package/dist/dashboard-assets/assets/{minus-CepSrXzu.js → minus-BzY257S7.js} +1 -1
  34. package/dist/dashboard-assets/assets/{network-page-CCASVWTx.js → network-page-CiQu5Dem.js} +1 -1
  35. package/dist/dashboard-assets/assets/{notes-page-Bw8s5HXO.js → notes-page-XazIKqZP.js} +1 -1
  36. package/dist/dashboard-assets/assets/{overview-page-If7s1dBy.js → overview-page-j5X9SBqW.js} +1 -1
  37. package/dist/dashboard-assets/assets/{performance-page-Ch3umaz-.js → performance-page-ImE9xvEt.js} +1 -1
  38. package/dist/dashboard-assets/assets/{play-DSlXvNRl.js → play-Cx2BEZVZ.js} +1 -1
  39. package/dist/dashboard-assets/assets/{processes-page-C2RwU22t.js → processes-page-BIMoApg0.js} +1 -1
  40. package/dist/dashboard-assets/assets/{project-view-CFMjSV9u.js → project-view-DnnhNMhS.js} +3 -3
  41. package/dist/dashboard-assets/assets/{renders-page-Ca4xJRtx.js → renders-page-C9THhZZ3.js} +1 -1
  42. package/dist/dashboard-assets/assets/{rules-page-Iam5wymd.js → rules-page-CBgSauuM.js} +1 -1
  43. package/dist/dashboard-assets/assets/{runtime-page-DEbhzxha.js → runtime-page-B7b2m1KH.js} +1 -1
  44. package/dist/dashboard-assets/assets/{save-CCeVXlI4.js → save-BGeL2PJM.js} +1 -1
  45. package/dist/dashboard-assets/assets/{sdk-page-BoPzW-t_.js → sdk-page-C2D4FU-Y.js} +1 -1
  46. package/dist/dashboard-assets/assets/{sessions-page-DSve7fIB.js → sessions-page-BYNnSmUH.js} +1 -1
  47. package/dist/dashboard-assets/assets/{sessions-page-CIPs23pt.js → sessions-page-VWQ2b-LR.js} +1 -1
  48. package/dist/dashboard-assets/assets/{settings-page-DuzVTOPn.js → settings-page-B2geIpMf.js} +1 -1
  49. package/dist/dashboard-assets/assets/{sparkline-DoDs4Mh8.js → sparkline-BYGr_Iny.js} +1 -1
  50. package/dist/dashboard-assets/assets/{square-DiX9jH4C.js → square-C1plLKPb.js} +1 -1
  51. package/dist/dashboard-assets/assets/{state-page-CqiOtZuw.js → state-page-CQDLPZ5t.js} +1 -1
  52. package/dist/dashboard-assets/assets/{status-dot-C-xjt4D6.js → status-dot-C1nxHZIG.js} +1 -1
  53. package/dist/dashboard-assets/assets/{tabs-yqhh6iCp.js → tabs-BoJRkfaU.js} +1 -1
  54. package/dist/dashboard-assets/assets/{tag-4Cn073OD.js → tag-Czqgl1tA.js} +1 -1
  55. package/dist/dashboard-assets/assets/{tasks-page-erlKdBtX.js → tasks-page-sjVxAPDG.js} +1 -1
  56. package/dist/dashboard-assets/assets/{textarea-BROdxV-a.js → textarea-DAwdLdON.js} +1 -1
  57. package/dist/dashboard-assets/assets/{topbar-DJt5eMx5.js → topbar-892TvyNb.js} +1 -1
  58. package/dist/dashboard-assets/assets/{trash-2-rsBJ0FiG.js → trash-2-C4Tvwfqn.js} +1 -1
  59. package/dist/dashboard-assets/assets/{use-connected-c8-oDf2s.js → use-connected-3Ljk-Uwv.js} +1 -1
  60. package/dist/dashboard-assets/assets/{wifi-omZdmnyZ.js → wifi-B9CHDUUG.js} +1 -1
  61. package/dist/dashboard-assets/assets/{zap-BaSm59wW.js → zap-D8s7B8fi.js} +1 -1
  62. package/dist/dashboard-assets/index.html +1 -1
  63. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/kitchen-sink-BN8WXBVu.js","assets/badge-BGgXl2qy.js","assets/textarea-BROdxV-a.js","assets/code-block-BfLeZt-6.js","assets/data-table-CxVXG3zy.js","assets/metric-card-BDGLEpmZ.js","assets/sparkline-DoDs4Mh8.js","assets/minus-CepSrXzu.js","assets/status-dot-C-xjt4D6.js","assets/topbar-DJt5eMx5.js","assets/clock-BZReVxQC.js","assets/zap-BaSm59wW.js","assets/project-view-CFMjSV9u.js","assets/tag-4Cn073OD.js","assets/square-DiX9jH4C.js","assets/play-DSlXvNRl.js","assets/home-page-Bro6iPXa.js","assets/download-OeUZzFM9.js","assets/message-square-DY6473o6.js","assets/dollar-sign-DqZoTS1i.js","assets/settings-page-DuzVTOPn.js","assets/chevron-right-D0z93_PM.js","assets/trash-2-rsBJ0FiG.js","assets/overview-page-If7s1dBy.js","assets/wifi-omZdmnyZ.js","assets/hard-drive-DVtZVR9y.js","assets/use-connected-c8-oDf2s.js","assets/issue-detector-CH2FjMfV.js","assets/network-page-CCASVWTx.js","assets/detail-panel-CxidKK1j.js","assets/filter-bar-CCwrTxz_.js","assets/tabs-yqhh6iCp.js","assets/export-button-BioZ3ot5.js","assets/format-CF_gowqw.js","assets/console-page-DMgLtlCk.js","assets/json-viewer-CtsL_JTK.js","assets/info-aicvFsRA.js","assets/renders-page-Ca4xJRtx.js","assets/empty-config-state-BRw-Dnk-.js","assets/state-page-CqiOtZuw.js","assets/performance-page-Ch3umaz-.js","assets/issues-page-207U1dk-.js","assets/api-map-page-DHlcR_sh.js","assets/database-page-BmpNk_GJ.js","assets/processes-page-C2RwU22t.js","assets/infra-page-CXFCwaut.js","assets/sessions-page-DSve7fIB.js","assets/breadcrumbs-page-BK-FB2nG.js","assets/events-page-Bhde5vnj.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/kitchen-sink-DmOR6KnI.js","assets/badge-BOfEUuSW.js","assets/textarea-DAwdLdON.js","assets/code-block-D47Pz1qB.js","assets/data-table-A2Iq_hk5.js","assets/metric-card-DE3zVnFg.js","assets/sparkline-BYGr_Iny.js","assets/minus-BzY257S7.js","assets/status-dot-C1nxHZIG.js","assets/topbar-892TvyNb.js","assets/clock-CmDPWLyG.js","assets/zap-D8s7B8fi.js","assets/project-view-DnnhNMhS.js","assets/tag-Czqgl1tA.js","assets/square-C1plLKPb.js","assets/play-Cx2BEZVZ.js","assets/home-page-lMWZHIMB.js","assets/download-CwvkYJyJ.js","assets/message-square-Dwj0jRjI.js","assets/dollar-sign-BDj484XE.js","assets/settings-page-B2geIpMf.js","assets/chevron-right-Df1qu9CE.js","assets/trash-2-C4Tvwfqn.js","assets/overview-page-j5X9SBqW.js","assets/wifi-B9CHDUUG.js","assets/hard-drive-D8jrlixH.js","assets/use-connected-3Ljk-Uwv.js","assets/issue-detector-CH2FjMfV.js","assets/network-page-CiQu5Dem.js","assets/detail-panel-YWSVnqP_.js","assets/filter-bar-CP39inkf.js","assets/tabs-BoJRkfaU.js","assets/export-button-D7y2ugNf.js","assets/format-CF_gowqw.js","assets/console-page-B3sYOQK9.js","assets/json-viewer-Dup5M0px.js","assets/info-C0v7mgTM.js","assets/renders-page-C9THhZZ3.js","assets/empty-config-state-ReVUjdJ_.js","assets/state-page-CQDLPZ5t.js","assets/performance-page-ImE9xvEt.js","assets/issues-page-8abUxnvT.js","assets/api-map-page-Btbazs5z.js","assets/database-page-DYOGNtgK.js","assets/processes-page-BIMoApg0.js","assets/infra-page-Cwb8--Fc.js","assets/sessions-page-BYNnSmUH.js","assets/breadcrumbs-page-ahYuYyrd.js","assets/events-page-d6_fhDSn.js"])))=>i.map(i=>d[i]);
2
2
  var h0=Object.defineProperty;var y0=(i,o,s)=>o in i?h0(i,o,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[o]=s;var ro=(i,o,s)=>y0(i,typeof o!="symbol"?o+"":o,s);function v0(i,o){for(var s=0;s<o.length;s++){const c=o[s];if(typeof c!="string"&&!Array.isArray(c)){for(const f in c)if(f!=="default"&&!(f in i)){const m=Object.getOwnPropertyDescriptor(c,f);m&&Object.defineProperty(i,f,m.get?m:{enumerable:!0,get:()=>c[f]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))c(f);new MutationObserver(f=>{for(const m of f)if(m.type==="childList")for(const y of m.addedNodes)y.tagName==="LINK"&&y.rel==="modulepreload"&&c(y)}).observe(document,{childList:!0,subtree:!0});function s(f){const m={};return f.integrity&&(m.integrity=f.integrity),f.referrerPolicy&&(m.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?m.credentials="include":f.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function c(f){if(f.ep)return;f.ep=!0;const m=s(f);fetch(f.href,m)}})();function g0(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var fo={exports:{}},ai={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -52,7 +52,7 @@ Error generating stack: `+a.message+`
52
52
  `).slice(2).join(`
53
53
  `):void 0,sourceFile:Fm(F),source:"browser"};if(s){let Ue=s(Oe);Ue&&i(Ue)}else i(Oe);p&&!p.shouldPrint(U,Le)||f[U](...B)};let E=(I=console.assert)==null?void 0:I.bind(console);E&&(console.assert=(U,...B)=>{if(!U){let F=new Error().stack,Le=`Assertion failed: ${B.map(Oe=>typeof Oe=="string"?Oe:Im(Oe)).join(" ")}`;i({eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"console",level:"error",message:Le,args:B.map(Oe=>vt(Oe,3)),stackTrace:F==null?void 0:F.split(`
54
54
  `).slice(2).join(`
55
- `),sourceFile:Fm(F),source:"browser"})}E(U,...B)});let T=(ne=console.time)==null?void 0:ne.bind(console),w=(W=console.timeEnd)==null?void 0:W.bind(console);T&&(console.time=(U="default")=>{m.set(U,performance.now()),T(U)}),w&&(console.timeEnd=(U="default")=>{let B=m.get(U);if(B!==void 0){let F=performance.now()-B;m.delete(U),i({eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"console",level:"info",message:`${U}: ${F.toFixed(2)}ms`,args:[{label:U,duration:F}],source:"browser"})}w(U)});let q=(V=console.count)==null?void 0:V.bind(console),Q=(ye=console.countReset)==null?void 0:ye.bind(console);q&&(console.count=(U="default")=>{let B=(y.get(U)??0)+1;y.set(U,B),i({eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"console",level:"info",message:`${U}: ${B}`,args:[{label:U,count:B}],source:"browser"}),q(U)}),Q&&(console.countReset=(U="default")=>{y.delete(U),Q(U)});let K=(ge=console.table)==null?void 0:ge.bind(console);return K&&(console.table=(U,B)=>{i({eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"console",level:"info",message:`[table] ${Array.isArray(U)?`${U.length} rows`:typeof U}`,args:[vt(U,3)],source:"browser"}),K(U,B)}),()=>{for(let U of Wm)console[U]=f[U];E&&(console.assert=E),T&&(console.time=T),w&&(console.timeEnd=w),q&&(console.count=q),Q&&(console.countReset=Q),K&&(console.table=K),p==null||p.dispose()}}function Im(i){try{return JSON.stringify(i)}catch{return String(i)}}function W0(i,o,s,c){let f=new Set(s.map(T=>T.toLowerCase())),m=(c==null?void 0:c.captureBody)??!1,y=(c==null?void 0:c.maxBodySize)??65536,h=new AbortController,g=XMLHttpRequest.prototype.open,p=XMLHttpRequest.prototype.setRequestHeader,E=XMLHttpRequest.prototype.send;return XMLHttpRequest.prototype.open=function(T,w){return this.__rs_method=T.toUpperCase(),this.__rs_url=typeof w=="string"?w:w.href,this.__rs_headers={},g.apply(this,arguments)},XMLHttpRequest.prototype.setRequestHeader=function(T,w){return this.__rs_headers&&(this.__rs_headers[T.toLowerCase()]=f.has(T.toLowerCase())?"[REDACTED]":w),p.call(this,T,w)},XMLHttpRequest.prototype.send=function(T){let w=this.__rs_method??"GET",q=this.__rs_url??"",Q=`${w}:${q}`,K=!1;for(let U of ya.keys())if(U.startsWith(Q)){K=!0;break}if(K)return this.__rs_fetchIntercepted=!0,E.call(this,T);let I={...this.__rs_headers??{}},ne=performance.now(),W,V=0;if(T){if(typeof T=="string")V=new Blob([T]).size,m&&(W=T.length>y?T.slice(0,y):T);else if(T instanceof Blob)V=T.size,m&&(W=`[Blob ${T.size} bytes]`);else if(T instanceof ArrayBuffer)V=T.byteLength,m&&(W=`[ArrayBuffer ${T.byteLength} bytes]`);else if(T instanceof FormData)m&&(W="[FormData]");else if(T instanceof URLSearchParams){let U=T.toString();V=new Blob([U]).size,m&&(W=U.length>y?U.slice(0,y):U)}}let ye=I0(T),ge=U=>{let B={eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"network",url:q,method:w,status:0,requestHeaders:I,responseHeaders:{},requestBodySize:V,responseBodySize:0,duration:0,ttfb:0,graphqlOperation:ye,requestBody:W,source:"xhr",...U};if(c!=null&&c.beforeSend){let F=c.beforeSend(B);F&&i(F)}else i(B)};return this.addEventListener("loadend",()=>{let U=performance.now()-ne;if(this.status>0){let B=F0(this.getAllResponseHeaders(),f),F=parseInt(this.getResponseHeader("content-length")||"0",10),Le;if(m&&(this.responseType===""||this.responseType==="text"))try{let Oe=this.responseText;Le=Oe.length>y?Oe.slice(0,y):Oe}catch{}ge({status:this.status,responseHeaders:B,responseBodySize:F,responseBody:Le,duration:U,ttfb:U})}else{let B="error",F="Network error";this.readyState===0||this.status,this.timeout>0&&U>=this.timeout&&(B="timeout",F=`Request timed out after ${this.timeout}ms`),ge({duration:U,errorPhase:B,errorMessage:F})}},{once:!0,signal:h.signal}),E.call(this,T)},()=>{h.abort(),XMLHttpRequest.prototype.open=g,XMLHttpRequest.prototype.setRequestHeader=p,XMLHttpRequest.prototype.send=E}}function F0(i,o){let s={};if(!i)return s;for(let c of i.trim().split(/[\r\n]+/)){let f=c.indexOf(":");if(f===-1)continue;let m=c.slice(0,f).trim().toLowerCase(),y=c.slice(f+1).trim();s[m]=o.has(m)?"[REDACTED]":y}return s}function I0(i){if(!(!i||typeof i!="string"))try{let o=JSON.parse(i);if(typeof o.query=="string"){let s=o.query.trim(),c="query";s.startsWith("mutation")?c="mutation":s.startsWith("subscription")&&(c="subscription");let f=o.operationName||P0(s)||"anonymous";return{type:c,name:f}}}catch{}}function P0(i){var o;return(o=i.match(/^(?:query|mutation|subscription)\s+(\w+)/))==null?void 0:o[1]}function ev(i,o,s,c){let f=[],m=new Map;for(let[y,h]of Object.entries(s)){let g=tv(h);if(g==="zustand"){let p=h;Ou(i,o,c==null?void 0:c.beforeSend,{storeId:y,library:g,phase:"init",state:vt(p.getState(),4)});let E=p.subscribe((T,w)=>{let q=Pm(w,T);Ou(i,o,c==null?void 0:c.beforeSend,{storeId:y,library:g,phase:"update",state:vt(T,4),previousState:vt(w,4),diff:q?vt(q,3):void 0})});f.push(E)}else if(g==="redux"){let p=h;Ou(i,o,c==null?void 0:c.beforeSend,{storeId:y,library:g,phase:"init",state:vt(p.getState(),4)});let E,T=p.dispatch.bind(p);m.set(y,T),p.dispatch=Q=>(Q&&typeof Q=="object"&&"type"in Q&&(E={type:String(Q.type),payload:Q.payload}),T(Q));let w=p.getState(),q=p.subscribe(()=>{let Q=p.getState(),K=Pm(w,Q);Ou(i,o,c==null?void 0:c.beforeSend,{storeId:y,library:g,phase:"update",state:vt(Q,4),previousState:vt(w,4),diff:K?vt(K,3):void 0,action:E?vt(E,3):void 0}),w=Q,E=void 0});f.push(q)}}return()=>{for(let y of f)y();for(let[y,h]of m){let g=s[y];g&&(g.dispatch=h)}}}function tv(i){if(!i||typeof i!="object")return"unknown";let o=i;return typeof o.getState=="function"&&typeof o.setState=="function"&&typeof o.subscribe=="function"?"zustand":typeof o.dispatch=="function"&&typeof o.getState=="function"&&typeof o.subscribe=="function"?"redux":"unknown"}function Pm(i,o){if(!i||!o||typeof i!="object"||typeof o!="object")return null;let s={},c=i,f=o,m=new Set([...Object.keys(c),...Object.keys(f)]);for(let y of m)c[y]!==f[y]&&(s[y]={from:c[y],to:f[y]});return Object.keys(s).length>0?s:null}function Ou(i,o,s,c){let f={eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"state",...c};if(s){let m=s(f);m&&i(m)}else i(f)}var lv={LCP:[2500,4e3],FCP:[1800,3e3],CLS:[.1,.25],TTFB:[800,1800],FID:[100,300],INP:[200,500]};function av(i,o){let[s,c]=lv[i]??[1/0,1/0];return o<=s?"good":o<=c?"needs-improvement":"poor"}var ii=null;function nv(i,o,s){if(ii)for(let h of ii)try{h.disconnect()}catch{}let c=[];ii=c;let f=(h,g,p)=>{let E={eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"performance",metricName:h,value:Math.round(g*100)/100,rating:av(h,g),element:p};if(s!=null&&s.beforeSend){let T=s.beforeSend(E);T&&i(T)}else i(E)};tn(c,"largest-contentful-paint",h=>{var E;let g=h[h.length-1];if(!g)return;let p=g.element;f("LCP",g.startTime,(E=p==null?void 0:p.tagName)==null?void 0:E.toLowerCase())}),tn(c,"paint",h=>{for(let g of h)g.name==="first-contentful-paint"&&f("FCP",g.startTime)});let m=0;tn(c,"layout-shift",h=>{for(let g of h){let p=g;!p.hadRecentInput&&p.value&&(m+=p.value,f("CLS",m))}}),tn(c,"first-input",h=>{let g=h[0];if(!g)return;let p=g;p.processingStart&&f("FID",p.processingStart-g.startTime)}),tn(c,"navigation",h=>{let g=h[0];g&&f("TTFB",g.responseStart-g.requestStart)});let y=0;return tn(c,"event",h=>{for(let g of h)g.duration>y&&(y=g.duration,f("INP",y))},{durationThreshold:16}),()=>{for(let h of c)try{h.disconnect()}catch{}ii===c&&(ii=null)}}function tn(i,o,s,c){try{let f=new PerformanceObserver(m=>{s(m.getEntries())});f.observe({type:o,buffered:!0,...c}),i.push(f)}catch{}}var iv=0,uv=1,xp=1e4,ep=100,cv=6e4,tp=500;function sv(i,o,s){let c=new Map,f=(s==null?void 0:s.snapshotIntervalMs)??5e3,m=null,y=ov();if(!y)return()=>{};let h=y.onCommitFiberRoot;return y._runtimescope_original=h,y.onCommitFiberRoot=(g,p)=>{if(h)try{h(g,p)}catch{}p.current&&jo(p.current,c)},m=setInterval(()=>{pv(c,i,o,s==null?void 0:s.beforeSend)},f),()=>{m&&(clearInterval(m),m=null),y&&(y._runtimescope_original?y.onCommitFiberRoot=y._runtimescope_original:delete y.onCommitFiberRoot,delete y._runtimescope_original)}}function ov(){if(typeof window>"u")return null;let i=window;return i.__REACT_DEVTOOLS_GLOBAL_HOOK__||(i.__REACT_DEVTOOLS_GLOBAL_HOOK__={}),i.__REACT_DEVTOOLS_GLOBAL_HOOK__}function jo(i,o){rv(i,o),i.child&&jo(i.child,o),i.sibling&&jo(i.sibling,o)}function rv(i,o){if(i.tag!==iv&&i.tag!==uv)return;let s=fv(i);if(!s)return;let c=Date.now(),f=i.alternate===null,m=i.actualDuration??0,y=dv(i,f),h=o.get(s);h||(h={renderCount:0,totalDuration:0,lastRenderTime:0,lastRenderPhase:"mount",lastRenderCause:"unknown",renderTimestamps:[]},o.set(s,h)),h.renderCount++,h.totalDuration+=m,h.lastRenderTime=c,h.lastRenderPhase=f?"mount":"update",h.lastRenderCause=y??"unknown",h.renderTimestamps.push(c),h.renderTimestamps.length>ep&&(h.renderTimestamps=h.renderTimestamps.slice(-ep))}function fv(i){if(i.type&&typeof i.type!="string")return i.type.displayName||i.type.name||void 0}function dv(i,o){return o?"props":i.alternate?i.memoizedProps!==i.alternate.memoizedProps?"props":i.memoizedState!==i.alternate.memoizedState?"state":"parent":"unknown"}function mv(i){if(i.length<2)return 0;let o=Date.now(),s=o-xp,c=i.filter(m=>m>=s);if(c.length<2)return 0;let f=o-c[0];return f===0?0:c.length/(f/1e3)}function pv(i,o,s,c){if(i.size===0)return;let f=[],m=[],y=0;for(let[p,E]of i){let T=mv(E.renderTimestamps),w=T>4||E.renderCount>20;f.push({componentName:p,renderCount:E.renderCount,totalDuration:Math.round(E.totalDuration*100)/100,avgDuration:E.renderCount>0?Math.round(E.totalDuration/E.renderCount*100)/100:0,lastRenderPhase:E.lastRenderPhase,lastRenderCause:E.lastRenderCause,renderVelocity:Math.round(T*100)/100,suspicious:w}),w&&m.push(p),y+=E.renderCount}f.sort((p,E)=>E.renderCount-p.renderCount);let h={eventId:Ze(),sessionId:s,timestamp:Date.now(),eventType:"render",profiles:f,snapshotWindowMs:xp,totalRenders:y,suspiciousComponents:m};if(c){let p=c(h);p&&o(p)}else o(h);let g=Date.now();for(let[p,E]of i)g-E.lastRenderTime>cv?i.delete(p):(E.renderCount=0,E.totalDuration=0);if(i.size>tp){let p=[...i.entries()].sort((T,w)=>T[1].lastRenderTime-w[1].lastRenderTime),E=i.size-tp;for(let T=0;T<E;T++)i.delete(p[T][0])}}function hv(i,o,s){let c=m=>{var E,T;let y,h,g;if(m instanceof ErrorEvent)y=m.message||"Uncaught error",h=(E=m.error)==null?void 0:E.stack,g=m.filename?`${m.filename}:${m.lineno}:${m.colno}`:void 0;else{let w=m.target;if(w&&w!==window){let q=((T=w.tagName)==null?void 0:T.toLowerCase())??"unknown",Q=w.src??w.src??w.href??"unknown";y=`Failed to load resource: <${q}> ${Q}`}else return}let p={eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"console",level:"error",message:`[Uncaught] ${y}`,args:[vt(y,3)],stackTrace:h,sourceFile:g};if(s){let w=s(p);w&&i(w)}else i(p)},f=m=>{let y=m.reason,h,g;if(y instanceof Error)h=y.message,g=y.stack;else if(typeof y=="string")h=y;else try{h=JSON.stringify(y)}catch{h=String(y)}let p={eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"console",level:"error",message:`[Unhandled Rejection] ${h}`,args:[vt(y,3)],stackTrace:g,sourceFile:void 0};if(s){let E=s(p);E&&i(E)}else i(p)};return window.addEventListener("error",c,!0),window.addEventListener("unhandledrejection",f),()=>{window.removeEventListener("error",c,!0),window.removeEventListener("unhandledrejection",f)}}function yv(i,o){let s=window.location.href;function c(g,p){let E=s;E!==g&&(s=g,i({eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"navigation",from:E,to:g,trigger:p}))}let f=history.pushState.bind(history),m=history.replaceState.bind(history);history.pushState=function(...g){f(...g),c(window.location.href,"pushState")},history.replaceState=function(...g){m(...g),c(window.location.href,"replaceState")};let y=()=>c(window.location.href,"popstate");window.addEventListener("popstate",y);let h=()=>c(window.location.href,"hashchange");return window.addEventListener("hashchange",h),()=>{history.pushState=f,history.replaceState=m,window.removeEventListener("popstate",y),window.removeEventListener("hashchange",h)}}function vv(i,o){let s=c=>{let f=c.target;if(!(f instanceof Element)||f.closest("[data-runtimescope]"))return;let m=gv(f),y=bv(f),h={eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"ui",action:"click",target:m,...y&&{text:y}};i(h)};return document.addEventListener("click",s,!0),()=>{document.removeEventListener("click",s,!0)}}function gv(i){let o=i.tagName.toLowerCase();if(i.id)return`${o}#${i.id}`;let s=i.getAttribute("data-testid")??i.getAttribute("data-test-id");if(s)return`${o}[data-testid="${s}"]`;let c=i.getAttribute("role"),f=i.getAttribute("aria-label");if(c&&f)return`${o}[role="${c}"][aria-label="${f}"]`;let m=i.className;if(typeof m=="string"&&m.trim()){let h=m.split(/\s+/).find(g=>g.length>2&&!g.startsWith("_")&&!g.includes("__"));if(h)return`${o}.${h}`}let y=i.parentElement;if(y){let h=y.children,g=Array.from(h).filter(p=>p.tagName===i.tagName);if(g.length>1){let p=g.indexOf(i)+1;return`${o}:nth-child(${p})`}}return o}function bv(i){let o=i.getAttribute("aria-label");if(o)return o.slice(0,80);let s=i.innerText??i.textContent;if(!s)return;let c=s.trim().replace(/\s+/g," ");if(c.length!==0)return c.length>80?c.slice(0,77)+"...":c}function xv(i){let o=i.startsWith("runtimescopes://");if(!i.startsWith("runtimescope://")&&!o)throw new Error("Invalid RuntimeScope DSN: must start with runtimescope:// or runtimescopes://");let s=new URL(i.replace(/^runtimescopes?:\/\//,"http://")),c=s.username;if(!c||!c.startsWith("proj_"))throw new Error("Invalid RuntimeScope DSN: missing projectId (expected proj_xxx@host)");let f=s.password?decodeURIComponent(s.password):void 0,m=s.hostname,y=s.port?parseInt(s.port):6768,h=y-1,g=s.pathname.replace(/^\//,"")||void 0,p=o?"wss":"ws",E=o?"https":"http";return{projectId:c,authToken:f,wsEndpoint:`${p}://${m}:${h}`,httpEndpoint:`${E}://${m}:${y}`,appName:g,tls:o}}var Uu="0.10.11",Sv=console.debug.bind(console),Tv=console.warn.bind(console),Bu=!1;function ln(...i){Bu&&Sv(...i)}var lp=new Set;function _v(i,...o){lp.has(i)||(lp.add(i),Tv(i,...o))}var ku=Symbol.for("__runtimescope_originals__");function ap(){let i=globalThis;return i[ku]||(i[ku]={fetch:window.fetch,xhrOpen:XMLHttpRequest.prototype.open,xhrSend:XMLHttpRequest.prototype.send,xhrSetRequestHeader:XMLHttpRequest.prototype.setRequestHeader,consoleMethods:{log:console.log.bind(console),warn:console.warn.bind(console),error:console.error.bind(console),info:console.info.bind(console),debug:console.debug.bind(console),trace:console.trace.bind(console)}}),i[ku]}var Nt=class{static get sessionId(){return this._sessionId}static get isConnected(){return this._state==="started"}static shouldSample(){if(this._sampleRate<1&&Math.random()>this._sampleRate)return!1;if(this._maxEventsPerSecond!==void 0){let i=Date.now();if(i-this._windowStart>=1e3&&(this._windowCount=0,this._windowStart=i),this._windowCount>=this._maxEventsPerSecond)return!1;this._windowCount++}return!0}static connect(i={}){var E;if(i.enabled===!1)return;let o=!1;if(i.dsn)try{let T=xv(i.dsn);i={...i,serverUrl:T.wsEndpoint,projectId:T.projectId,...T.authToken?{authToken:T.authToken}:{},...T.appName&&!i.appName?{appName:T.appName}:{}},o=!0}catch(T){ln("[RuntimeScope] Invalid DSN:",T.message)}if(!(i.serverUrl||i.endpoint||o)&&typeof window<"u"){let T=(E=window.location)==null?void 0:E.hostname;if(T&&T!=="localhost"&&T!=="127.0.0.1"&&!T.startsWith("192.168.")&&!T.startsWith("10.")){ln("[RuntimeScope] No endpoint configured and not on localhost — SDK disabled for production");return}}if(i.verbose===!0)Bu=!0;else if(typeof localStorage<"u")try{localStorage.getItem("RUNTIMESCOPE_DEBUG")==="1"&&(Bu=!0)}catch{}R0(Bu);let s=`${i.appName??""}|${i.serverUrl??i.endpoint??""}|${i.dsn??""}|${i.projectId??""}`;if(this._state==="started"){if(this._initSignature===s)return;_v(`[RuntimeScope] init() called twice with different config — disconnecting and re-initializing.
55
+ `),sourceFile:Fm(F),source:"browser"})}E(U,...B)});let T=(ne=console.time)==null?void 0:ne.bind(console),w=(W=console.timeEnd)==null?void 0:W.bind(console);T&&(console.time=(U="default")=>{m.set(U,performance.now()),T(U)}),w&&(console.timeEnd=(U="default")=>{let B=m.get(U);if(B!==void 0){let F=performance.now()-B;m.delete(U),i({eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"console",level:"info",message:`${U}: ${F.toFixed(2)}ms`,args:[{label:U,duration:F}],source:"browser"})}w(U)});let q=(V=console.count)==null?void 0:V.bind(console),Q=(ye=console.countReset)==null?void 0:ye.bind(console);q&&(console.count=(U="default")=>{let B=(y.get(U)??0)+1;y.set(U,B),i({eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"console",level:"info",message:`${U}: ${B}`,args:[{label:U,count:B}],source:"browser"}),q(U)}),Q&&(console.countReset=(U="default")=>{y.delete(U),Q(U)});let K=(ge=console.table)==null?void 0:ge.bind(console);return K&&(console.table=(U,B)=>{i({eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"console",level:"info",message:`[table] ${Array.isArray(U)?`${U.length} rows`:typeof U}`,args:[vt(U,3)],source:"browser"}),K(U,B)}),()=>{for(let U of Wm)console[U]=f[U];E&&(console.assert=E),T&&(console.time=T),w&&(console.timeEnd=w),q&&(console.count=q),Q&&(console.countReset=Q),K&&(console.table=K),p==null||p.dispose()}}function Im(i){try{return JSON.stringify(i)}catch{return String(i)}}function W0(i,o,s,c){let f=new Set(s.map(T=>T.toLowerCase())),m=(c==null?void 0:c.captureBody)??!1,y=(c==null?void 0:c.maxBodySize)??65536,h=new AbortController,g=XMLHttpRequest.prototype.open,p=XMLHttpRequest.prototype.setRequestHeader,E=XMLHttpRequest.prototype.send;return XMLHttpRequest.prototype.open=function(T,w){return this.__rs_method=T.toUpperCase(),this.__rs_url=typeof w=="string"?w:w.href,this.__rs_headers={},g.apply(this,arguments)},XMLHttpRequest.prototype.setRequestHeader=function(T,w){return this.__rs_headers&&(this.__rs_headers[T.toLowerCase()]=f.has(T.toLowerCase())?"[REDACTED]":w),p.call(this,T,w)},XMLHttpRequest.prototype.send=function(T){let w=this.__rs_method??"GET",q=this.__rs_url??"",Q=`${w}:${q}`,K=!1;for(let U of ya.keys())if(U.startsWith(Q)){K=!0;break}if(K)return this.__rs_fetchIntercepted=!0,E.call(this,T);let I={...this.__rs_headers??{}},ne=performance.now(),W,V=0;if(T){if(typeof T=="string")V=new Blob([T]).size,m&&(W=T.length>y?T.slice(0,y):T);else if(T instanceof Blob)V=T.size,m&&(W=`[Blob ${T.size} bytes]`);else if(T instanceof ArrayBuffer)V=T.byteLength,m&&(W=`[ArrayBuffer ${T.byteLength} bytes]`);else if(T instanceof FormData)m&&(W="[FormData]");else if(T instanceof URLSearchParams){let U=T.toString();V=new Blob([U]).size,m&&(W=U.length>y?U.slice(0,y):U)}}let ye=I0(T),ge=U=>{let B={eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"network",url:q,method:w,status:0,requestHeaders:I,responseHeaders:{},requestBodySize:V,responseBodySize:0,duration:0,ttfb:0,graphqlOperation:ye,requestBody:W,source:"xhr",...U};if(c!=null&&c.beforeSend){let F=c.beforeSend(B);F&&i(F)}else i(B)};return this.addEventListener("loadend",()=>{let U=performance.now()-ne;if(this.status>0){let B=F0(this.getAllResponseHeaders(),f),F=parseInt(this.getResponseHeader("content-length")||"0",10),Le;if(m&&(this.responseType===""||this.responseType==="text"))try{let Oe=this.responseText;Le=Oe.length>y?Oe.slice(0,y):Oe}catch{}ge({status:this.status,responseHeaders:B,responseBodySize:F,responseBody:Le,duration:U,ttfb:U})}else{let B="error",F="Network error";this.readyState===0||this.status,this.timeout>0&&U>=this.timeout&&(B="timeout",F=`Request timed out after ${this.timeout}ms`),ge({duration:U,errorPhase:B,errorMessage:F})}},{once:!0,signal:h.signal}),E.call(this,T)},()=>{h.abort(),XMLHttpRequest.prototype.open=g,XMLHttpRequest.prototype.setRequestHeader=p,XMLHttpRequest.prototype.send=E}}function F0(i,o){let s={};if(!i)return s;for(let c of i.trim().split(/[\r\n]+/)){let f=c.indexOf(":");if(f===-1)continue;let m=c.slice(0,f).trim().toLowerCase(),y=c.slice(f+1).trim();s[m]=o.has(m)?"[REDACTED]":y}return s}function I0(i){if(!(!i||typeof i!="string"))try{let o=JSON.parse(i);if(typeof o.query=="string"){let s=o.query.trim(),c="query";s.startsWith("mutation")?c="mutation":s.startsWith("subscription")&&(c="subscription");let f=o.operationName||P0(s)||"anonymous";return{type:c,name:f}}}catch{}}function P0(i){var o;return(o=i.match(/^(?:query|mutation|subscription)\s+(\w+)/))==null?void 0:o[1]}function ev(i,o,s,c){let f=[],m=new Map;for(let[y,h]of Object.entries(s)){let g=tv(h);if(g==="zustand"){let p=h;Ou(i,o,c==null?void 0:c.beforeSend,{storeId:y,library:g,phase:"init",state:vt(p.getState(),4)});let E=p.subscribe((T,w)=>{let q=Pm(w,T);Ou(i,o,c==null?void 0:c.beforeSend,{storeId:y,library:g,phase:"update",state:vt(T,4),previousState:vt(w,4),diff:q?vt(q,3):void 0})});f.push(E)}else if(g==="redux"){let p=h;Ou(i,o,c==null?void 0:c.beforeSend,{storeId:y,library:g,phase:"init",state:vt(p.getState(),4)});let E,T=p.dispatch.bind(p);m.set(y,T),p.dispatch=Q=>(Q&&typeof Q=="object"&&"type"in Q&&(E={type:String(Q.type),payload:Q.payload}),T(Q));let w=p.getState(),q=p.subscribe(()=>{let Q=p.getState(),K=Pm(w,Q);Ou(i,o,c==null?void 0:c.beforeSend,{storeId:y,library:g,phase:"update",state:vt(Q,4),previousState:vt(w,4),diff:K?vt(K,3):void 0,action:E?vt(E,3):void 0}),w=Q,E=void 0});f.push(q)}}return()=>{for(let y of f)y();for(let[y,h]of m){let g=s[y];g&&(g.dispatch=h)}}}function tv(i){if(!i||typeof i!="object")return"unknown";let o=i;return typeof o.getState=="function"&&typeof o.setState=="function"&&typeof o.subscribe=="function"?"zustand":typeof o.dispatch=="function"&&typeof o.getState=="function"&&typeof o.subscribe=="function"?"redux":"unknown"}function Pm(i,o){if(!i||!o||typeof i!="object"||typeof o!="object")return null;let s={},c=i,f=o,m=new Set([...Object.keys(c),...Object.keys(f)]);for(let y of m)c[y]!==f[y]&&(s[y]={from:c[y],to:f[y]});return Object.keys(s).length>0?s:null}function Ou(i,o,s,c){let f={eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"state",...c};if(s){let m=s(f);m&&i(m)}else i(f)}var lv={LCP:[2500,4e3],FCP:[1800,3e3],CLS:[.1,.25],TTFB:[800,1800],FID:[100,300],INP:[200,500]};function av(i,o){let[s,c]=lv[i]??[1/0,1/0];return o<=s?"good":o<=c?"needs-improvement":"poor"}var ii=null;function nv(i,o,s){if(ii)for(let h of ii)try{h.disconnect()}catch{}let c=[];ii=c;let f=(h,g,p)=>{let E={eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"performance",metricName:h,value:Math.round(g*100)/100,rating:av(h,g),element:p};if(s!=null&&s.beforeSend){let T=s.beforeSend(E);T&&i(T)}else i(E)};tn(c,"largest-contentful-paint",h=>{var E;let g=h[h.length-1];if(!g)return;let p=g.element;f("LCP",g.startTime,(E=p==null?void 0:p.tagName)==null?void 0:E.toLowerCase())}),tn(c,"paint",h=>{for(let g of h)g.name==="first-contentful-paint"&&f("FCP",g.startTime)});let m=0;tn(c,"layout-shift",h=>{for(let g of h){let p=g;!p.hadRecentInput&&p.value&&(m+=p.value,f("CLS",m))}}),tn(c,"first-input",h=>{let g=h[0];if(!g)return;let p=g;p.processingStart&&f("FID",p.processingStart-g.startTime)}),tn(c,"navigation",h=>{let g=h[0];g&&f("TTFB",g.responseStart-g.requestStart)});let y=0;return tn(c,"event",h=>{for(let g of h)g.duration>y&&(y=g.duration,f("INP",y))},{durationThreshold:16}),()=>{for(let h of c)try{h.disconnect()}catch{}ii===c&&(ii=null)}}function tn(i,o,s,c){try{let f=new PerformanceObserver(m=>{s(m.getEntries())});f.observe({type:o,buffered:!0,...c}),i.push(f)}catch{}}var iv=0,uv=1,xp=1e4,ep=100,cv=6e4,tp=500;function sv(i,o,s){let c=new Map,f=(s==null?void 0:s.snapshotIntervalMs)??5e3,m=null,y=ov();if(!y)return()=>{};let h=y.onCommitFiberRoot;return y._runtimescope_original=h,y.onCommitFiberRoot=(g,p)=>{if(h)try{h(g,p)}catch{}p.current&&jo(p.current,c)},m=setInterval(()=>{pv(c,i,o,s==null?void 0:s.beforeSend)},f),()=>{m&&(clearInterval(m),m=null),y&&(y._runtimescope_original?y.onCommitFiberRoot=y._runtimescope_original:delete y.onCommitFiberRoot,delete y._runtimescope_original)}}function ov(){if(typeof window>"u")return null;let i=window;return i.__REACT_DEVTOOLS_GLOBAL_HOOK__||(i.__REACT_DEVTOOLS_GLOBAL_HOOK__={}),i.__REACT_DEVTOOLS_GLOBAL_HOOK__}function jo(i,o){rv(i,o),i.child&&jo(i.child,o),i.sibling&&jo(i.sibling,o)}function rv(i,o){if(i.tag!==iv&&i.tag!==uv)return;let s=fv(i);if(!s)return;let c=Date.now(),f=i.alternate===null,m=i.actualDuration??0,y=dv(i,f),h=o.get(s);h||(h={renderCount:0,totalDuration:0,lastRenderTime:0,lastRenderPhase:"mount",lastRenderCause:"unknown",renderTimestamps:[]},o.set(s,h)),h.renderCount++,h.totalDuration+=m,h.lastRenderTime=c,h.lastRenderPhase=f?"mount":"update",h.lastRenderCause=y??"unknown",h.renderTimestamps.push(c),h.renderTimestamps.length>ep&&(h.renderTimestamps=h.renderTimestamps.slice(-ep))}function fv(i){if(i.type&&typeof i.type!="string")return i.type.displayName||i.type.name||void 0}function dv(i,o){return o?"props":i.alternate?i.memoizedProps!==i.alternate.memoizedProps?"props":i.memoizedState!==i.alternate.memoizedState?"state":"parent":"unknown"}function mv(i){if(i.length<2)return 0;let o=Date.now(),s=o-xp,c=i.filter(m=>m>=s);if(c.length<2)return 0;let f=o-c[0];return f===0?0:c.length/(f/1e3)}function pv(i,o,s,c){if(i.size===0)return;let f=[],m=[],y=0;for(let[p,E]of i){let T=mv(E.renderTimestamps),w=T>4||E.renderCount>20;f.push({componentName:p,renderCount:E.renderCount,totalDuration:Math.round(E.totalDuration*100)/100,avgDuration:E.renderCount>0?Math.round(E.totalDuration/E.renderCount*100)/100:0,lastRenderPhase:E.lastRenderPhase,lastRenderCause:E.lastRenderCause,renderVelocity:Math.round(T*100)/100,suspicious:w}),w&&m.push(p),y+=E.renderCount}f.sort((p,E)=>E.renderCount-p.renderCount);let h={eventId:Ze(),sessionId:s,timestamp:Date.now(),eventType:"render",profiles:f,snapshotWindowMs:xp,totalRenders:y,suspiciousComponents:m};if(c){let p=c(h);p&&o(p)}else o(h);let g=Date.now();for(let[p,E]of i)g-E.lastRenderTime>cv?i.delete(p):(E.renderCount=0,E.totalDuration=0);if(i.size>tp){let p=[...i.entries()].sort((T,w)=>T[1].lastRenderTime-w[1].lastRenderTime),E=i.size-tp;for(let T=0;T<E;T++)i.delete(p[T][0])}}function hv(i,o,s){let c=m=>{var E,T;let y,h,g;if(m instanceof ErrorEvent)y=m.message||"Uncaught error",h=(E=m.error)==null?void 0:E.stack,g=m.filename?`${m.filename}:${m.lineno}:${m.colno}`:void 0;else{let w=m.target;if(w&&w!==window){let q=((T=w.tagName)==null?void 0:T.toLowerCase())??"unknown",Q=w.src??w.src??w.href??"unknown";y=`Failed to load resource: <${q}> ${Q}`}else return}let p={eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"console",level:"error",message:`[Uncaught] ${y}`,args:[vt(y,3)],stackTrace:h,sourceFile:g};if(s){let w=s(p);w&&i(w)}else i(p)},f=m=>{let y=m.reason,h,g;if(y instanceof Error)h=y.message,g=y.stack;else if(typeof y=="string")h=y;else try{h=JSON.stringify(y)}catch{h=String(y)}let p={eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"console",level:"error",message:`[Unhandled Rejection] ${h}`,args:[vt(y,3)],stackTrace:g,sourceFile:void 0};if(s){let E=s(p);E&&i(E)}else i(p)};return window.addEventListener("error",c,!0),window.addEventListener("unhandledrejection",f),()=>{window.removeEventListener("error",c,!0),window.removeEventListener("unhandledrejection",f)}}function yv(i,o){let s=window.location.href;function c(g,p){let E=s;E!==g&&(s=g,i({eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"navigation",from:E,to:g,trigger:p}))}let f=history.pushState.bind(history),m=history.replaceState.bind(history);history.pushState=function(...g){f(...g),c(window.location.href,"pushState")},history.replaceState=function(...g){m(...g),c(window.location.href,"replaceState")};let y=()=>c(window.location.href,"popstate");window.addEventListener("popstate",y);let h=()=>c(window.location.href,"hashchange");return window.addEventListener("hashchange",h),()=>{history.pushState=f,history.replaceState=m,window.removeEventListener("popstate",y),window.removeEventListener("hashchange",h)}}function vv(i,o){let s=c=>{let f=c.target;if(!(f instanceof Element)||f.closest("[data-runtimescope]"))return;let m=gv(f),y=bv(f),h={eventId:Ze(),sessionId:o,timestamp:Date.now(),eventType:"ui",action:"click",target:m,...y&&{text:y}};i(h)};return document.addEventListener("click",s,!0),()=>{document.removeEventListener("click",s,!0)}}function gv(i){let o=i.tagName.toLowerCase();if(i.id)return`${o}#${i.id}`;let s=i.getAttribute("data-testid")??i.getAttribute("data-test-id");if(s)return`${o}[data-testid="${s}"]`;let c=i.getAttribute("role"),f=i.getAttribute("aria-label");if(c&&f)return`${o}[role="${c}"][aria-label="${f}"]`;let m=i.className;if(typeof m=="string"&&m.trim()){let h=m.split(/\s+/).find(g=>g.length>2&&!g.startsWith("_")&&!g.includes("__"));if(h)return`${o}.${h}`}let y=i.parentElement;if(y){let h=y.children,g=Array.from(h).filter(p=>p.tagName===i.tagName);if(g.length>1){let p=g.indexOf(i)+1;return`${o}:nth-child(${p})`}}return o}function bv(i){let o=i.getAttribute("aria-label");if(o)return o.slice(0,80);let s=i.innerText??i.textContent;if(!s)return;let c=s.trim().replace(/\s+/g," ");if(c.length!==0)return c.length>80?c.slice(0,77)+"...":c}function xv(i){let o=i.startsWith("runtimescopes://");if(!i.startsWith("runtimescope://")&&!o)throw new Error("Invalid RuntimeScope DSN: must start with runtimescope:// or runtimescopes://");let s=new URL(i.replace(/^runtimescopes?:\/\//,"http://")),c=s.username;if(!c||!c.startsWith("proj_"))throw new Error("Invalid RuntimeScope DSN: missing projectId (expected proj_xxx@host)");let f=s.password?decodeURIComponent(s.password):void 0,m=s.hostname,y=s.port?parseInt(s.port):6768,h=y-1,g=s.pathname.replace(/^\//,"")||void 0,p=o?"wss":"ws",E=o?"https":"http";return{projectId:c,authToken:f,wsEndpoint:`${p}://${m}:${h}`,httpEndpoint:`${E}://${m}:${y}`,appName:g,tls:o}}var Uu="0.10.12",Sv=console.debug.bind(console),Tv=console.warn.bind(console),Bu=!1;function ln(...i){Bu&&Sv(...i)}var lp=new Set;function _v(i,...o){lp.has(i)||(lp.add(i),Tv(i,...o))}var ku=Symbol.for("__runtimescope_originals__");function ap(){let i=globalThis;return i[ku]||(i[ku]={fetch:window.fetch,xhrOpen:XMLHttpRequest.prototype.open,xhrSend:XMLHttpRequest.prototype.send,xhrSetRequestHeader:XMLHttpRequest.prototype.setRequestHeader,consoleMethods:{log:console.log.bind(console),warn:console.warn.bind(console),error:console.error.bind(console),info:console.info.bind(console),debug:console.debug.bind(console),trace:console.trace.bind(console)}}),i[ku]}var Nt=class{static get sessionId(){return this._sessionId}static get isConnected(){return this._state==="started"}static shouldSample(){if(this._sampleRate<1&&Math.random()>this._sampleRate)return!1;if(this._maxEventsPerSecond!==void 0){let i=Date.now();if(i-this._windowStart>=1e3&&(this._windowCount=0,this._windowStart=i),this._windowCount>=this._maxEventsPerSecond)return!1;this._windowCount++}return!0}static connect(i={}){var E;if(i.enabled===!1)return;let o=!1;if(i.dsn)try{let T=xv(i.dsn);i={...i,serverUrl:T.wsEndpoint,projectId:T.projectId,...T.authToken?{authToken:T.authToken}:{},...T.appName&&!i.appName?{appName:T.appName}:{}},o=!0}catch(T){ln("[RuntimeScope] Invalid DSN:",T.message)}if(!(i.serverUrl||i.endpoint||o)&&typeof window<"u"){let T=(E=window.location)==null?void 0:E.hostname;if(T&&T!=="localhost"&&T!=="127.0.0.1"&&!T.startsWith("192.168.")&&!T.startsWith("10.")){ln("[RuntimeScope] No endpoint configured and not on localhost — SDK disabled for production");return}}if(i.verbose===!0)Bu=!0;else if(typeof localStorage<"u")try{localStorage.getItem("RUNTIMESCOPE_DEBUG")==="1"&&(Bu=!0)}catch{}R0(Bu);let s=`${i.appName??""}|${i.serverUrl??i.endpoint??""}|${i.dsn??""}|${i.projectId??""}`;if(this._state==="started"){if(this._initSignature===s)return;_v(`[RuntimeScope] init() called twice with different config — disconnecting and re-initializing.
56
56
  previous: ${this._initSignature}
57
57
  next: ${s}
58
58
  If the SDK is loaded by @runtimescope/vite, drop your manual RuntimeScope.init() call — the plugin handles it.`),this.disconnect()}this._initSignature=s;let c={serverUrl:i.serverUrl??i.endpoint??"ws://localhost:6767",appName:i.appName??"unknown",captureNetwork:i.captureNetwork??!0,captureConsole:i.captureConsole??!0,captureXhr:i.captureXhr??!0,captureBody:i.captureBody??!1,maxBodySize:i.maxBodySize??65536,capturePerformance:i.capturePerformance??!0,captureRenders:i.captureRenders??!0,captureNavigation:i.captureNavigation??!0,captureClicks:i.captureClicks??!0,stores:i.stores??{},beforeSend:i.beforeSend,redactHeaders:i.redactHeaders??["authorization","cookie"],batchSize:i.batchSize??50,flushIntervalMs:i.flushIntervalMs??100,dedupeConsole:i.dedupeConsole??!1};ap(),this._sessionId=U0(),this._state="started",this.transport=new O0({serverUrl:c.serverUrl,appName:c.appName,sessionId:this._sessionId,sdkVersion:Uu,authToken:i.authToken,projectId:i.projectId,batchSize:c.batchSize,flushIntervalMs:c.flushIntervalMs}),this._sampleRate=i.sampleRate??1,this._maxEventsPerSecond=i.maxEventsPerSecond,this._windowCount=0,this._windowStart=Date.now(),this._user=i.user,this.transport.connect(),ln(`[RuntimeScope] SDK v${Uu} initializing — app: ${c.appName}, server: ${c.serverUrl}`);let f=ap().consoleMethods.warn,m=this.transport,y=c.serverUrl;setTimeout(()=>{var w;if(this.transport!==m||(w=m.isConnected)!=null&&w.call(m))return;let T=/localhost|127\.0\.0\.1/.test(y)?"Run `npx runtimescope start` in a terminal.":`Check that ${y} is reachable and the collector is running.`;f(`[RuntimeScope] Couldn't connect to ${y} after 10s. No events are being captured.`,`
@@ -266,4 +266,4 @@ If the SDK is loaded by @runtimescope/vite, drop your manual RuntimeScope.init()
266
266
  *
267
267
  * This source code is licensed under the ISC license.
268
268
  * See the LICENSE file in the root directory of this source tree.
269
- */const yg=ue("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),mp=[{id:"home",icon:Up,label:"Home"},{id:"sessions",icon:cg,label:"Sessions"},{id:"runtime",icon:K1,label:"Runtime",badge:!0},{id:"git",icon:ig,label:"Git"},{id:"tasks",icon:pg,label:"Tasks"},{id:"memory",icon:I1,label:"Memory"},{id:"rules",icon:mg,label:"Rules"}],pp=[{id:"capex",icon:fg,label:"CapEx"},{id:"processes",icon:Np,label:"Processes"},{id:"settings",icon:Lo,label:"Settings"}],vg=[{id:"overview",icon:Up,label:"Overview"},{id:"network",icon:wo,label:"Network"},{id:"console",icon:Hp,label:"Console"},{id:"issues",icon:hg,label:"Issues",badge:!0},{id:"renders",icon:Op,label:"Renders"},{id:"state",icon:F1,label:"State"},{id:"performance",icon:Dp,label:"Performance"},{id:"api-map",icon:ng,label:"API Map"},{id:"database",icon:Mp,label:"Database"},{id:"breadcrumbs",icon:Cp,label:"Breadcrumbs"},{id:"events",icon:rg,label:"Events"}],gg=[{id:"processes",icon:Np,label:"Processes"},{id:"settings",icon:Lo,label:"Settings"}];function bg({label:i,anchorRect:o}){return o?v.jsx("div",{className:"fixed z-[9999] pointer-events-none px-2.5 py-1 text-[12px] font-semibold text-accent bg-bg-elevated border border-accent-border rounded-md shadow-md whitespace-nowrap",style:{top:o.top+o.height/2,left:o.right+10,transform:"translateY(-50%)"},children:i}):null}function hp({item:i,isActive:o,disabled:s,onClick:c,onHover:f,onLeave:m}){const y=Y.useRef(null),h=i.icon;return v.jsxs("button",{ref:y,onClick:s?void 0:c,onMouseEnter:()=>{y.current&&f(y.current.getBoundingClientRect(),i.label)},onMouseLeave:m,className:Ie("relative w-11 h-11 rounded-xl flex items-center justify-center transition-all",s?"text-text-disabled/40 cursor-default":o?"text-text-primary bg-bg-overlay cursor-pointer":"text-text-disabled hover:text-text-secondary hover:bg-bg-hover cursor-pointer"),children:[o&&v.jsx("span",{className:"absolute -left-2.5 top-1/2 -translate-y-1/2 w-[3px] h-5 bg-accent rounded-r-sm"}),v.jsx(h,{size:20}),i.badge&&v.jsx("span",{className:"absolute top-2 right-2 w-[7px] h-[7px] rounded-full bg-green border-2 border-bg-base animate-pulse-dot"})]})}const xg=Y.memo(function({items:o,bottomItems:s,activeId:c,onSelect:f,isSubContext:m=!1,onBack:y,disabledIds:h}){const[g,p]=Y.useState(null),E=Y.useCallback((w,q)=>{p({rect:w,label:q})},[]),T=Y.useCallback(()=>{p(null)},[]);return v.jsxs("nav",{className:"w-[var(--rail-width)] shrink-0 bg-bg-base border-r border-border-muted flex flex-col items-center py-4 z-10",children:[m?v.jsx("button",{onClick:y,onMouseEnter:w=>E(w.currentTarget.getBoundingClientRect(),"Back to Home"),onMouseLeave:T,className:"w-8 h-8 rounded-md bg-accent-muted border border-accent-border flex items-center justify-center text-accent mb-6 cursor-pointer hover:bg-accent/25 hover:border-accent transition-all",children:v.jsx(J1,{size:18})}):v.jsx("div",{className:"w-8 h-8 rounded-md bg-gradient-to-br from-accent-dark to-accent-muted border border-accent-border flex items-center justify-center text-accent mb-6",children:v.jsx(Rp,{size:18})}),v.jsx("div",{className:"flex flex-col gap-1 flex-1",children:o.map(w=>v.jsx(hp,{item:w,isActive:c===w.id,disabled:h==null?void 0:h.has(w.id),onClick:()=>f(w.id),onHover:E,onLeave:T},w.id))}),v.jsxs("div",{className:"flex flex-col gap-1 mt-auto",children:[v.jsx("div",{className:"w-8 h-px bg-border-muted my-2"}),s.map(w=>v.jsx(hp,{item:w,isActive:c===w.id,disabled:h==null?void 0:h.has(w.id),onClick:()=>f(w.id),onHover:E,onLeave:T},w.id))]}),g&&v.jsx(bg,{label:g.label,anchorRect:g.rect})]})}),No="rs.activeWorkspaceId";function Sg(){try{return localStorage.getItem(No)}catch{return null}}function So(i){try{i?localStorage.setItem(No,i):localStorage.removeItem(No)}catch{}}const pi=cn((i,o)=>({workspaces:[],workspacesLoading:!1,activeWorkspaceId:Sg(),apiKeysByWorkspace:{},apiKeysLoading:{},newlyCreatedKey:null,fetchWorkspaces:async()=>{i({workspacesLoading:!0});const s=await t1();i({workspaces:s,workspacesLoading:!1});const{activeWorkspaceId:c}=o();c&&!s.find(f=>f.id===c)&&(So(null),i({activeWorkspaceId:null}))},setActiveWorkspace:s=>{So(s),i({activeWorkspaceId:s})},createWorkspace:async s=>{const c=await l1(s);return c?(i(f=>({workspaces:[...f.workspaces,c]})),Se.success(`Created workspace "${c.name}"`),c):(Se.error("Failed to create workspace"),null)},updateWorkspace:async(s,c)=>{const f=await a1(s,c);f?(i(m=>({workspaces:m.workspaces.map(y=>y.id===s?f:y)})),Se.success("Workspace updated")):Se.error("Failed to update workspace")},deleteWorkspace:async s=>{const c=o().workspaces.find(m=>m.id===s);if(!c)return;if(c.isDefault){Se.error("Cannot delete the default workspace");return}await n1(s)?(i(m=>({workspaces:m.workspaces.filter(y=>y.id!==s),activeWorkspaceId:m.activeWorkspaceId===s?null:m.activeWorkspaceId})),o().activeWorkspaceId===null&&So(null),Se.success(`Deleted workspace "${c.name}". Its projects moved to the default workspace.`)):Se.error("Failed to delete workspace")},moveProjectToWorkspace:async(s,c)=>{await i1(s,c)?Se.success("Project moved"):Se.error("Failed to move project")},fetchApiKeys:async s=>{i(f=>({apiKeysLoading:{...f.apiKeysLoading,[s]:!0}}));const c=await u1(s);i(f=>({apiKeysByWorkspace:{...f.apiKeysByWorkspace,[s]:c},apiKeysLoading:{...f.apiKeysLoading,[s]:!1}}))},createApiKey:async(s,c)=>{const f=await c1(s,c);return f?(i(m=>({apiKeysByWorkspace:{...m.apiKeysByWorkspace,[s]:[f,...m.apiKeysByWorkspace[s]??[]]},newlyCreatedKey:f})),f):(Se.error("Failed to create API key"),null)},revokeApiKey:async(s,c)=>{await s1(s)?(i(m=>({apiKeysByWorkspace:{...m.apiKeysByWorkspace,[c]:(m.apiKeysByWorkspace[c]??[]).filter(y=>y.keyPrefix!==s)}})),Se.success("API key revoked")):Se.error("Failed to revoke API key")},clearNewlyCreatedKey:()=>i({newlyCreatedKey:null})})),Tg=Object.freeze(Object.defineProperty({__proto__:null,useWorkspaceStore:pi},Symbol.toStringTag,{value:"Module"})),gt="";async function qt(i,o){const s=new URL(i,window.location.origin);if(o)for(const[c,f]of Object.entries(o))f!==void 0&&s.searchParams.set(c,String(f));try{const c=await fetch(s.toString());return c.ok?(await c.json()).data:null}catch{return null}}async function Mo(){try{const i=await fetch(`${gt}/api/health`);return i.ok?(await i.json()).status==="ok":!1}catch{return!1}}function Ho(i,o){var s;if(!i.length)return[];if((s=o.runtimeApps)!=null&&s.length){const c=new Set(o.runtimeApps.map(f=>f.toLowerCase()));return i.filter(f=>c.has(f.appName.toLowerCase()))}if(o.runtimescopeProject){const c=i.find(y=>y.appName===o.runtimescopeProject);if(c)return[c];const f=o.runtimescopeProject.toLowerCase(),m=i.find(y=>y.appName.toLowerCase()===f);if(m)return[m]}if(o.name){const c=o.name.toLowerCase(),f=i.find(m=>m.appName.toLowerCase()===c);if(f)return[f]}return[]}function Eb(i,o){return Ho(i,o)[0]}async function Co(i){return qt(`${gt}/api/events/network`,i)}async function kp(i){return qt(`${gt}/api/events/console`,i)}async function qp(i){return qt(`${gt}/api/events/state`,i)}async function Gp(i){return qt(`${gt}/api/events/renders`,i)}async function Yp(i){return qt(`${gt}/api/events/performance`,i)}async function Xp(i){return qt(`${gt}/api/events/database`,i)}async function jb(i){return qt(`${gt}/api/events/custom`,i)}async function _g(i){return qt(`${gt}/api/events/ui`,i)}async function zb(){return qt(`${gt}/api/sessions`)}async function Vp(){return qt(`${gt}/api/projects`)}async function Eg(i){return qt(`${gt}/api/processes`,i)}async function jg(i){return qt(`${gt}/api/ports`,i)}async function Ab(i,o="SIGTERM"){try{const s=await fetch(`${gt}/api/processes`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({pid:i,signal:o})});if(!s.ok)return null;const c=await s.json();return(c==null?void 0:c.data)??null}catch{return null}}const zg={critical:{bg:"bg-red-muted",text:"text-red",dot:"bg-red"},warning:{bg:"bg-amber-muted",text:"text-amber",dot:"bg-amber"},info:{bg:"bg-blue-muted",text:"text-blue",dot:"bg-blue"}},Ag=[{id:1,severity:"critical",icon:tg,title:"TypeError in worker.ts:142",desc:"Cannot read properties of undefined (reading 'status')",project:"runtime-profiler",source:"Console",time:"2m ago",unread:!0},{id:2,severity:"critical",icon:wo,title:"503 on POST /api/deploy/rollback",desc:"Service Unavailable — deployment lock active (4,200ms)",project:"flowAI",source:"Network",time:"5m ago",unread:!0},{id:3,severity:"warning",icon:Op,title:"Excessive re-renders: Dashboard",desc:"847 renders detected — flagged as suspicious component",project:"runtime-profiler",source:"Renders",time:"8m ago",unread:!0},{id:4,severity:"warning",icon:Mp,title:"Slow query: SELECT * FROM pm_sessions",desc:"520ms execution time exceeds 500ms threshold",project:"gtm-helper",source:"Database",time:"12m ago",unread:!0},{id:5,severity:"warning",icon:Dp,title:"LCP degraded to 3.2s",desc:"Largest Contentful Paint regressed from 1.8s — poor",project:"personal-site",source:"Performance",time:"18m ago",unread:!1},{id:6,severity:"info",icon:wo,title:"N+1 request pattern detected",desc:"GET /api/users called 8x in 2s window",project:"runtime-profiler",source:"Network",time:"32m ago",unread:!1},{id:7,severity:"info",icon:Cp,title:"deploy:failed breadcrumb recorded",desc:"Rollback unsuccessful — manual intervention required",project:"flowAI",source:"Breadcrumbs",time:"45m ago",unread:!1}],wg=Y.memo(function(){const[o,s]=Y.useState(!1),[c,f]=Y.useState(Ag),m=Y.useRef(null),y=c.filter(p=>p.unread).length;Y.useEffect(()=>{if(!o)return;const p=E=>{m.current&&!m.current.contains(E.target)&&s(!1)};return document.addEventListener("click",p),()=>document.removeEventListener("click",p)},[o]);const h=()=>{f(p=>p.map(E=>({...E,unread:!1})))},g=p=>{f(E=>E.map(T=>T.id===p?{...T,unread:!1}:T))};return v.jsxs("div",{className:"relative",ref:m,children:[v.jsxs("button",{onClick:p=>{p.stopPropagation(),s(!o)},className:"w-9 h-9 rounded-lg flex items-center justify-center bg-bg-surface border border-border-default text-text-tertiary hover:border-border-hover hover:text-text-primary transition-all relative cursor-pointer",children:[v.jsx(W1,{size:16}),y>0&&v.jsx("span",{className:"absolute top-[7px] right-[7px] w-[7px] h-[7px] rounded-full bg-red"})]}),o&&v.jsxs("div",{className:"absolute top-[calc(100%+8px)] right-0 w-[420px] bg-bg-surface border border-border-strong rounded-lg shadow-lg z-[100] overflow-hidden",children:[v.jsxs("div",{className:"flex items-center justify-between px-3.5 py-3 border-b border-border-muted",children:[v.jsxs("span",{className:"text-sm font-bold text-text-primary flex items-center gap-2",children:["Notifications",y>0&&v.jsx("span",{className:"text-[10px] font-bold text-white bg-red px-[7px] py-px rounded-full",children:y})]}),v.jsxs("button",{onClick:p=>{p.stopPropagation(),h()},className:"text-[11px] font-medium text-text-muted flex items-center gap-1.5 px-2 py-1 rounded hover:text-text-primary hover:bg-bg-hover transition-colors cursor-pointer",children:[v.jsx(eg,{size:13}),"Mark all read"]})]}),v.jsx("div",{className:"max-h-[380px] overflow-y-auto",children:c.map(p=>{const E=p.icon,T=zg[p.severity];return v.jsxs("div",{onClick:()=>g(p.id),className:Ie("flex items-start gap-2.5 px-3.5 py-2.5 border-b border-border-muted cursor-pointer transition-colors hover:bg-bg-hover",!p.unread&&"opacity-55"),children:[v.jsx("div",{className:Ie("w-8 h-8 rounded-md flex items-center justify-center shrink-0 mt-px",T.bg),children:v.jsx(E,{size:15,className:T.text})}),v.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-[3px]",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsx("span",{className:"text-[12px] font-semibold text-text-primary truncate flex-1",children:p.title}),v.jsx("span",{className:"text-[10px] text-text-disabled shrink-0",children:p.time})]}),v.jsx("span",{className:"text-[11px] text-text-tertiary truncate",children:p.desc}),v.jsxs("div",{className:"flex items-center gap-[5px] mt-px",children:[v.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-px rounded bg-bg-overlay text-text-secondary",children:p.project}),v.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-px rounded bg-bg-overlay text-text-muted",children:p.source})]})]}),p.unread&&v.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-accent shrink-0 mt-3"})]},p.id)})}),v.jsx("div",{className:"flex items-center justify-center px-3.5 py-2 border-t border-border-muted",children:v.jsx("button",{className:"text-[12px] font-semibold text-accent px-3 py-1 rounded-md hover:bg-accent-muted transition-colors cursor-pointer",children:"View All Notifications"})})]})]})}),Ng=Y.memo(function(){const o=pi(E=>E.workspaces),s=pi(E=>E.activeWorkspaceId),c=pi(E=>E.setActiveWorkspace),f=De(E=>E.setActiveView),[m,y]=Y.useState(!1),h=Y.useRef(null);Y.useEffect(()=>{if(!m)return;const E=T=>{h.current&&!h.current.contains(T.target)&&y(!1)};return document.addEventListener("click",E),()=>document.removeEventListener("click",E)},[m]);const g=o.find(E=>E.id===s),p=(g==null?void 0:g.name)??"All workspaces";return o.length<=1?null:v.jsxs("div",{className:"relative",ref:h,children:[v.jsxs("button",{type:"button",onClick:E=>{E.stopPropagation(),y(!m)},className:"flex items-center gap-1.5 h-8 px-2.5 rounded-md hover:bg-bg-hover transition-colors cursor-pointer",children:[v.jsx("span",{className:"text-[11px] text-text-muted uppercase tracking-wide",children:"Workspace"}),v.jsx("span",{className:"text-[13px] font-medium text-text-primary",children:p}),v.jsx(wp,{size:12,className:"text-text-muted"})]}),m&&v.jsxs("div",{className:"absolute top-[calc(100%+4px)] left-0 w-[280px] bg-bg-surface border border-border-strong rounded-lg shadow-lg z-[100] overflow-hidden",children:[v.jsxs("div",{className:"p-1",children:[v.jsxs("button",{onClick:()=>{c(null),y(!1)},className:Ie("w-full flex items-center justify-between gap-2 px-2.5 py-2 rounded-md text-[13px] text-left transition-colors cursor-pointer",s===null?"bg-accent-muted text-text-primary":"hover:bg-bg-hover text-text-secondary"),children:[v.jsx("span",{children:"All workspaces"}),s===null&&v.jsx(Ao,{size:14,className:"text-accent"})]}),v.jsx("div",{className:"h-px bg-border-muted my-1"}),o.map(E=>v.jsxs("button",{onClick:()=>{c(E.id),y(!1)},className:Ie("w-full flex items-center justify-between gap-2 px-2.5 py-2 rounded-md text-[13px] text-left transition-colors cursor-pointer",s===E.id?"bg-accent-muted text-text-primary":"hover:bg-bg-hover text-text-secondary"),children:[v.jsxs("span",{className:"flex items-center gap-2 truncate",children:[v.jsx("span",{className:"truncate",children:E.name}),E.isDefault&&v.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wide shrink-0",children:"default"})]}),s===E.id&&v.jsx(Ao,{size:14,className:"text-accent"})]},E.id))]}),v.jsxs("div",{className:"flex items-center gap-1 p-1 border-t border-border-muted",children:[v.jsxs("button",{onClick:()=>{f("settings"),y(!1)},className:"flex-1 flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[12px] text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors cursor-pointer",children:[v.jsx(og,{size:12}),"New workspace"]}),v.jsx("button",{onClick:()=>{f("settings"),y(!1)},className:"flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[12px] text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors cursor-pointer",title:"Workspace settings",children:v.jsx(Lo,{size:12})})]})]})]})});function Mg({open:i,onClose:o}){const s=Qu(w=>w.projects),c=De(w=>w.projects),f=De(w=>w.selectedPmProject),m=De(w=>w.selectPmProject),y=pi(w=>w.activeWorkspaceId),[h,g]=Y.useState(""),p=Y.useRef(null);if(Y.useEffect(()=>{if(!i)return;const w=q=>{p.current&&!p.current.contains(q.target)&&o()};return document.addEventListener("click",w),()=>document.removeEventListener("click",w)},[i,o]),!i)return null;const E=y?s.filter(w=>w.workspaceId===y):s,T=h.trim()?E.filter(w=>w.name.toLowerCase().includes(h.trim().toLowerCase())):E;return v.jsxs("div",{ref:p,className:"absolute top-[calc(100%+4px)] left-0 w-[380px] bg-bg-surface border border-border-strong rounded-lg shadow-lg z-[100] overflow-hidden",children:[v.jsxs("div",{className:"relative p-2.5 border-b border-border-muted",children:[v.jsx(Lp,{size:13,className:"absolute left-5 top-1/2 -translate-y-1/2 text-text-muted"}),v.jsx("input",{type:"text",value:h,onChange:w=>g(w.target.value),placeholder:"Search projects...",className:"w-full h-8 bg-bg-input border border-border-strong rounded-md pl-8 pr-2.5 text-[12px] text-text-primary outline-none focus:border-accent-border",onClick:w=>w.stopPropagation()})]}),v.jsx("div",{className:"max-h-60 overflow-y-auto p-1",children:T.map(w=>{const q=w.id===f;return v.jsx("button",{onClick:Q=>{Q.stopPropagation(),m(w.id),o()},className:Ie("w-full flex items-center gap-2.5 px-2.5 py-2 rounded-md text-left transition-colors cursor-pointer",q?"bg-accent-muted":"hover:bg-bg-hover"),children:(()=>{const K=Ho(c,{runtimescopeProject:w.runtimescopeProject,runtimeApps:w.runtimeApps,name:w.name}).some(I=>I.isConnected);return v.jsxs(v.Fragment,{children:[v.jsx("span",{className:Ie("w-1.5 h-1.5 rounded-full shrink-0",K?"bg-green animate-pulse-dot":"bg-text-muted")}),v.jsx("span",{className:"flex-1 text-[13px] font-medium text-text-primary truncate",children:w.name}),v.jsx("span",{className:"text-[11px] text-text-muted font-mono",children:K?"live":"offline"})]})})()},w.id)})}),v.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-t border-border-muted",children:[v.jsxs("button",{className:"text-[11px] text-text-tertiary hover:text-text-primary hover:bg-bg-hover px-2 py-1 rounded-sm flex items-center gap-1 cursor-pointer",children:[v.jsx(ag,{size:12})," Show hidden"]}),v.jsxs("button",{className:"text-[11px] text-text-tertiary hover:text-text-primary hover:bg-bg-hover px-2 py-1 rounded-sm flex items-center gap-1 cursor-pointer",children:[v.jsx(ug,{size:12})," Full view"]})]})]})}const Cg=Y.memo(function({title:o,breadcrumb:s,onToggleSidebar:c,sidebarOpen:f}){const[m,y]=Y.useState(!1),h=De(q=>q.selectedPmProject),p=Qu(q=>q.projects).find(q=>q.id===h),E=(p==null?void 0:p.name)??"Select project",T=De(q=>q.projects),w=p?Ho(T,{runtimescopeProject:p.runtimescopeProject,runtimeApps:p.runtimeApps,name:p.name}).some(q=>q.isConnected):!1;return v.jsxs("header",{className:"h-[var(--header-height)] border-b border-border-muted flex items-center px-6 gap-4 shrink-0 bg-bg-base",children:[v.jsx("button",{onClick:c,className:Ie("w-8 h-8 rounded-md flex items-center justify-center shrink-0 mr-1 transition-all cursor-pointer",f?"text-accent bg-accent-muted":"text-text-muted hover:text-text-primary hover:bg-bg-hover"),children:v.jsx(sg,{size:16})}),v.jsx(Ng,{}),v.jsxs("div",{className:"relative",children:[v.jsxs("div",{onClick:q=>{q.stopPropagation(),y(!m)},className:"flex items-center gap-2 px-2.5 py-1.5 rounded-md cursor-pointer hover:bg-bg-hover transition-colors",children:[v.jsx("span",{className:Ie("w-[7px] h-[7px] rounded-full shrink-0",w?"bg-green":"bg-text-muted")}),v.jsx("span",{className:"text-[15px] font-bold text-text-primary whitespace-nowrap",children:E}),v.jsx(wp,{size:14,className:"text-text-muted"})]}),v.jsx(Mg,{open:m,onClose:()=>y(!1)})]}),v.jsx("span",{className:"text-text-muted text-sm",children:"/"}),v.jsx("span",{className:"text-[13px] font-medium text-text-secondary",children:o}),s&&v.jsxs(v.Fragment,{children:[v.jsx("span",{className:"text-text-muted text-sm",children:"/"}),v.jsx("span",{className:"text-[13px] font-medium text-text-secondary",children:s})]}),v.jsxs("div",{className:"ml-auto flex items-center gap-2 h-9 w-[280px] px-3 bg-bg-surface border border-border-default rounded-lg text-text-muted text-[12px] cursor-pointer hover:border-border-hover transition-colors",children:[v.jsx(Lp,{size:14}),v.jsx("span",{className:"flex-1",children:"Search events, errors, routes..."}),v.jsx("kbd",{className:"font-mono text-[11px] px-1.5 py-0.5 bg-bg-elevated border border-accent-border rounded text-text-tertiary",children:"⌘K"})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsxs("div",{className:"flex items-center gap-1.5 h-9 px-3 bg-bg-surface border border-border-default rounded-lg text-[12px] font-medium text-text-primary cursor-pointer",children:[v.jsx(P1,{size:14,className:"text-text-tertiary"}),"Today, Apr 6"]}),v.jsx(wg,{}),v.jsxs("div",{className:"flex items-center gap-2 cursor-pointer px-2 py-1 rounded-md hover:bg-bg-hover transition-colors",children:[v.jsx("div",{className:"w-8 h-8 rounded-full bg-border-strong"}),v.jsxs("div",{className:"flex flex-col leading-tight",children:[v.jsx("span",{className:"text-[12px] font-semibold",children:"Edwin L."}),v.jsx("span",{className:"text-[10px] text-text-muted",children:"Admin"})]})]})]})]})});function an({item:i,isActive:o,onClick:s}){const c=i.icon;return v.jsxs("button",{onClick:s,className:Ie("w-full flex items-center gap-2.5 h-[34px] px-2.5 rounded-md text-[13px] font-medium whitespace-nowrap transition-all cursor-pointer",o?"text-text-primary bg-bg-overlay":"text-text-secondary hover:text-text-primary hover:bg-bg-hover"),children:[v.jsx(c,{size:16,className:"shrink-0"}),v.jsx("span",{className:"flex-1 text-left overflow-hidden text-ellipsis",children:i.label}),i.badge&&v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green shrink-0"})]})}function To({children:i,visible:o}){return v.jsx("div",{className:Ie("text-[10px] font-semibold text-text-muted uppercase tracking-[0.06em] px-4 py-1 pb-2 whitespace-nowrap transition-opacity",o?"opacity-100":"opacity-0"),children:i})}const Dg=Y.memo(function({open:o,isSubContext:s,mainItems:c,mainBottomItems:f,parentItems:m,parentBottomItems:y,activeId:h,onSelect:g}){return s&&m&&y?v.jsxs("aside",{className:Ie("shrink-0 bg-bg-app border-r border-border-muted flex flex-col overflow-hidden transition-all duration-200 ease-in-out z-[9]",o?"w-[var(--sidebar-width)] py-4 overflow-y-auto":"w-0"),children:[v.jsx(To,{visible:o,children:"Runtime"}),v.jsx("div",{className:"flex flex-col gap-px px-2",children:c.map(p=>v.jsx(an,{item:p,isActive:h===p.id,onClick:()=>g(p.id)},p.id))}),v.jsx("div",{className:"h-px bg-border-muted mx-4 my-2"}),v.jsx("div",{className:"flex flex-col gap-px px-2",children:f.map(p=>v.jsx(an,{item:p,isActive:h===p.id,onClick:()=>g(p.id)},p.id))}),v.jsx("div",{className:"h-px bg-border-muted mx-4 my-2"}),v.jsx(To,{visible:o,children:"Project"}),v.jsx("div",{className:"flex flex-col gap-px px-2",children:m.map(p=>v.jsx(an,{item:p,onClick:()=>g(p.id)},p.id))}),v.jsx("div",{className:"h-px bg-border-muted mx-4 my-2"}),v.jsx("div",{className:"flex flex-col gap-px px-2",children:y.map(p=>v.jsx(an,{item:p,onClick:()=>g(p.id)},p.id))})]}):v.jsxs("aside",{className:Ie("shrink-0 bg-bg-app border-r border-border-muted flex flex-col overflow-hidden transition-all duration-200 ease-in-out z-[9]",o?"w-[var(--sidebar-width)] py-4 overflow-y-auto":"w-0"),children:[v.jsx(To,{visible:o,children:"Navigation"}),v.jsx("div",{className:"flex flex-col gap-px px-2",children:c.map(p=>v.jsx(an,{item:p,isActive:h===p.id,onClick:()=>g(p.id)},p.id))}),v.jsx("div",{className:"h-px bg-border-muted mx-4 my-2"}),v.jsx("div",{className:"flex flex-col gap-px px-2",children:f.map(p=>v.jsx(an,{item:p,isActive:h===p.id,onClick:()=>g(p.id)},p.id))})]})});function Rg({icon:i,title:o,description:s,action:c,className:f}){return v.jsx("div",{className:Ie("flex-1 flex items-center justify-center p-8",f),children:v.jsxs("div",{className:"flex flex-col items-center gap-3 text-center max-w-sm",children:[i&&v.jsx("div",{className:"text-text-muted",children:i}),v.jsx("h2",{className:"text-[15px] font-semibold text-text-primary",children:o}),s&&v.jsx("p",{className:"text-sm text-text-tertiary",children:s}),c&&v.jsx("div",{className:"mt-2",children:c})]})})}const Og=[{label:"Install",command:"npm install @runtimescope/sdk",description:"Add the SDK to your project"},{label:"Start collector",command:"npx runtimescope",description:"Start the collector server on port 6767"},{label:"Initialize",command:"RuntimeScope.init({ appName: 'my-app' })",description:"Add to your app entry point"}];function Ug({text:i}){const[o,s]=Y.useState(!1),c=()=>{navigator.clipboard.writeText(i),s(!0),setTimeout(()=>s(!1),2e3)};return v.jsx("button",{onClick:c,className:"shrink-0 p-1 rounded hover:bg-bg-hover text-text-disabled hover:text-text-secondary transition-colors cursor-pointer",title:"Copy to clipboard",children:o?v.jsx(Ao,{size:12,className:"text-green"}):v.jsx(lg,{size:12})})}function Lg({onRetry:i}){const[o,s]=Y.useState(!1),c=async()=>{s(!0);const f=await Mo();s(!1),f&&i&&i(),f&&window.location.reload()};return Y.useEffect(()=>{const f=setInterval(async()=>{await Mo()&&window.location.reload()},1e4);return()=>clearInterval(f)},[]),v.jsx("div",{className:"flex-1 flex items-center justify-center bg-bg-base",children:v.jsxs("div",{className:"max-w-lg w-full px-8",children:[v.jsxs("div",{className:"flex flex-col items-center text-center mb-10",children:[v.jsxs("div",{className:"relative mb-6",children:[v.jsx("div",{className:"w-16 h-16 rounded-2xl bg-bg-surface border border-border-strong flex items-center justify-center",children:v.jsx(Rp,{size:28,className:"text-accent"})}),v.jsx("div",{className:"absolute -bottom-1 -right-1 w-6 h-6 rounded-full bg-bg-base border-2 border-bg-base flex items-center justify-center",children:v.jsx(Bp,{size:12,className:"text-amber"})})]}),v.jsx("h1",{className:"text-xl font-bold text-text-primary mb-2",children:"Collector Offline"}),v.jsx("p",{className:"text-[13px] text-text-tertiary leading-relaxed max-w-sm",children:"The RuntimeScope collector isn't running. Start it to begin capturing events from your application."})]}),v.jsx("div",{className:"space-y-3 mb-8",children:Og.map((f,m)=>v.jsxs("div",{className:"flex items-start gap-3",children:[v.jsx("div",{className:"w-6 h-6 rounded-full bg-accent-muted border border-accent-border flex items-center justify-center shrink-0 mt-0.5",children:v.jsx("span",{className:"text-[11px] font-bold text-accent",children:m+1})}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[v.jsx("span",{className:"text-[12px] font-semibold text-text-primary",children:f.label}),v.jsx("span",{className:"text-[11px] text-text-muted",children:f.description})]}),v.jsxs("div",{className:"flex items-center gap-2 bg-bg-surface border border-border-default rounded-md px-3 py-2",children:[v.jsx(Hp,{size:12,className:"text-text-muted shrink-0"}),v.jsx("code",{className:"flex-1 text-[12px] font-mono text-accent truncate",children:f.command}),v.jsx(Ug,{text:f.command})]})]})]},m))}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("button",{onClick:c,disabled:o,className:Ie("flex-1 flex items-center justify-center gap-2 h-10 rounded-md text-[13px] font-semibold transition-all cursor-pointer","bg-accent text-text-inverse hover:brightness-110",o&&"opacity-70"),children:[v.jsx(dg,{size:14,className:o?"animate-spin":""}),o?"Checking...":"Retry Connection"]}),v.jsxs("a",{href:"https://github.com/anthropics/runtimescope",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 h-10 px-4 rounded-md text-[13px] font-medium text-text-tertiary bg-bg-surface border border-border-default hover:border-border-hover hover:text-text-primary transition-colors",children:["Docs ",v.jsx($1,{size:12})]})]}),v.jsx("p",{className:"text-center text-[11px] text-text-disabled mt-4",children:"Auto-retrying every 10 seconds • Listening on ws://localhost:6767"})]})})}function it({className:i}){return v.jsx("div",{className:Ie("bg-bg-elevated rounded animate-pulse",i)})}function Hg({rows:i=8}){return v.jsxs("div",{className:"w-full",children:[v.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border-default",children:[v.jsx(it,{className:"h-3 w-[15%]"}),v.jsx(it,{className:"h-3 w-[8%]"}),v.jsx(it,{className:"h-3 w-[10%]"}),v.jsx(it,{className:"h-3 w-[35%]"}),v.jsx(it,{className:"h-3 w-[10%]"}),v.jsx(it,{className:"h-3 w-[8%]"})]}),Array.from({length:i},(o,s)=>v.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border-muted",style:{opacity:1-s*.08},children:[v.jsx(it,{className:"h-3.5 w-[15%]"}),v.jsx(it,{className:"h-3.5 w-[8%]"}),v.jsx(it,{className:"h-3.5 w-[10%]"}),v.jsx(it,{className:Ie("h-3.5",s%3===0?"w-[30%]":s%3===1?"w-[25%]":"w-[35%]")}),v.jsx(it,{className:"h-3.5 w-[10%]"}),v.jsx(it,{className:"h-3.5 w-[8%]"})]},s))]})}function wb({rows:i=6}){return v.jsx("div",{className:"w-full",children:Array.from({length:i},(o,s)=>v.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border-muted",style:{opacity:1-s*.08},children:[v.jsx(it,{className:"h-2.5 w-2.5 rounded-full shrink-0"}),v.jsx(it,{className:"h-3 w-[60px] shrink-0"}),v.jsx(it,{className:Ie("h-3.5 flex-1",s%3===0?"max-w-[60%]":s%3===1?"max-w-[45%]":"max-w-[70%]")}),v.jsx(it,{className:"h-3 w-[80px] shrink-0 ml-auto"})]},s))})}const Bg=Y.lazy(()=>$e(()=>import("./kitchen-sink-BN8WXBVu.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(i=>({default:i.KitchenSink}))),kg=Y.lazy(()=>$e(()=>import("./project-view-CFMjSV9u.js").then(i=>i.p),__vite__mapDeps([12,1,2,8,13,14,15])).then(i=>({default:i.ProjectView}))),qg=Y.lazy(()=>$e(()=>import("./home-page-Bro6iPXa.js"),__vite__mapDeps([16,1,2,4,5,6,7,8,17,18,19,10,14,15])).then(i=>({default:i.HomePage}))),Gg=Y.lazy(()=>$e(()=>import("./settings-page-DuzVTOPn.js"),__vite__mapDeps([20,21,22])).then(i=>({default:i.SettingsPage}))),Yg=Y.lazy(()=>$e(()=>import("./overview-page-If7s1dBy.js").then(i=>i.o),__vite__mapDeps([23,11,2,5,6,7,24,10,25,26,27])).then(i=>({default:i.OverviewPage}))),Xg=Y.lazy(()=>$e(()=>import("./network-page-CCASVWTx.js"),__vite__mapDeps([28,9,2,1,4,29,30,8,31,17,32,26,33])).then(i=>({default:i.NetworkPage}))),Vg=Y.lazy(()=>$e(()=>import("./console-page-DMgLtlCk.js"),__vite__mapDeps([34,2,35,21,32,17,26,33,36])).then(i=>({default:i.ConsolePage}))),Qg=Y.lazy(()=>$e(()=>import("./renders-page-Ca4xJRtx.js"),__vite__mapDeps([37,1,2,4,29,6,8,38])).then(i=>({default:i.RendersPage}))),Zg=Y.lazy(()=>$e(()=>import("./state-page-CqiOtZuw.js"),__vite__mapDeps([39,9,2,1,29,35,21,38,26,33])).then(i=>({default:i.StatePage}))),Kg=Y.lazy(()=>$e(()=>import("./performance-page-Ch3umaz-.js"),__vite__mapDeps([40,1,2,6,38])).then(i=>({default:i.PerformancePage}))),Jg=Y.lazy(()=>$e(()=>import("./issues-page-207U1dk-.js"),__vite__mapDeps([41,9,2,1,29,26,27,36])).then(i=>({default:i.IssuesPage}))),yp=Y.lazy(()=>$e(()=>import("./api-map-page-DHlcR_sh.js"),__vite__mapDeps([42,9,2,1,4,29,8,26,33])).then(i=>({default:i.ApiMapPage}))),$g=Y.lazy(()=>$e(()=>import("./database-page-BmpNk_GJ.js"),__vite__mapDeps([43,9,2,1,3,4,29,30,38,32,17,26,33])).then(i=>({default:i.DatabasePage}))),Wg=Y.lazy(()=>$e(()=>import("./processes-page-C2RwU22t.js"),__vite__mapDeps([44,9,2,1,4,5,6,7,8,26,25,14])).then(i=>({default:i.ProcessesPage}))),Fg=Y.lazy(()=>$e(()=>import("./infra-page-CXFCwaut.js"),__vite__mapDeps([45,9,2,1,26])).then(i=>({default:i.InfraPage}))),Ig=Y.lazy(()=>$e(()=>import("./sessions-page-DSve7fIB.js"),__vite__mapDeps([46,9,2,1,4,29,30,8,26,33])).then(i=>({default:i.SessionsPage}))),Pg=Y.lazy(()=>$e(()=>import("./breadcrumbs-page-BK-FB2nG.js"),__vite__mapDeps([47,1,2,35,21,38,32,17,33,13])).then(i=>({default:i.BreadcrumbsPage}))),eb=Y.lazy(()=>$e(()=>import("./events-page-Bhde5vnj.js"),__vite__mapDeps([48,1,2,4,29,11,21])).then(i=>({default:i.EventsPage}))),tb={overview:Yg,network:Xg,console:Vg,renders:Qg,state:Zg,performance:Kg,issues:Jg,api:yp,"api-map":yp,database:$g,processes:Wg,infra:Fg,sessions:Ig,breadcrumbs:Pg,events:eb};function si(){return v.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:v.jsx(Hg,{rows:10})})}function lb(){const i=De(f=>f.activeTab),o=De(f=>f.activeView),s=Je(f=>f.source);if(o==="runtime"&&s==="mock")return v.jsx(Lg,{});if(i==="showcase")return v.jsx(Y.Suspense,{fallback:v.jsx(si,{}),children:v.jsx(Bg,{})});if(o==="home")return v.jsx(Y.Suspense,{fallback:v.jsx(si,{}),children:v.jsx(qg,{})});if(o==="project")return v.jsx(Y.Suspense,{fallback:v.jsx(si,{}),children:v.jsx(kg,{})});if(o==="settings")return v.jsx(Y.Suspense,{fallback:v.jsx(si,{}),children:v.jsx(Gg,{})});const c=tb[i];return c?v.jsx(Y.Suspense,{fallback:v.jsx(si,{}),children:v.jsx(c,{})}):v.jsx(Rg,{title:"Not Found",description:"This page doesn't exist."})}function ab(){return Je(o=>o.connected)?null:v.jsxs("div",{className:"bg-amber-muted border-b border-amber-border px-4 py-2 flex items-center justify-center gap-2 text-amber text-xs font-medium",children:[v.jsx(Bp,{className:"w-3.5 h-3.5"}),v.jsx("span",{children:"Connection lost — reconnecting. Data may be stale."}),v.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-amber animate-pulse-dot"})]})}const nb={success:"bg-green-900/90 border-green-700 text-green-100",error:"bg-red-900/90 border-red-700 text-red-100",info:"bg-blue-900/90 border-blue-700 text-blue-100"};function ib(){const i=mi(s=>s.toasts),o=mi(s=>s.remove);return i.length===0?null:v.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-sm",children:i.map(s=>v.jsxs("div",{className:`flex items-center gap-2 px-4 py-2.5 rounded-lg border text-sm shadow-lg animate-in slide-in-from-right-5 fade-in duration-200 ${nb[s.variant]}`,children:[v.jsx("span",{className:"flex-1",children:s.message}),v.jsx("button",{type:"button",onClick:()=>o(s.id),className:"opacity-60 hover:opacity-100 transition-opacity cursor-pointer",children:v.jsx(yg,{className:"w-3.5 h-3.5"})})]},s.id))})}function ub(i,o,s){return i==="home"?{title:"Home"}:i==="project"?{title:{sessions:"Sessions",tasks:"Tasks",notes:"Notes",memory:"Memory",git:"Git",capex:"CapEx",sdk:"SDK",rules:"Rules"}[s]??"Project"}:{title:"Runtime",breadcrumb:{overview:"Overview",network:"Network",console:"Console",issues:"Issues",renders:"Renders",state:"State",performance:"Performance","api-map":"API Map",database:"Database",breadcrumbs:"Breadcrumbs",events:"Events",processes:"Processes",settings:"Settings"}[o]??o}}function cb(){const i=De(V=>V.activeView),o=De(V=>V.activeTab),s=De(V=>V.activeProjectTab),c=De(V=>V.setActiveView),f=De(V=>V.setActiveTab),m=De(V=>V.setActiveProjectTab),[y,h]=Y.useState(!1),g=i==="runtime",p=g?vg:mp,E=g?gg:pp,T=g?o:i==="home"?"home":s,w=De(V=>V.selectedPmProject),Q=!g&&!w?new Set(["sessions","git","tasks","memory","rules","capex"]):void 0,K=Y.useCallback(V=>{if(g){if(V==="settings"){c("settings");return}f(V)}else if(V==="home")c("home");else if(V==="runtime")c("runtime"),f("overview");else if(V==="settings")c("settings");else if(V==="processes")c("home");else{const ge={sessions:"sessions",git:"git",tasks:"tasks",memory:"memory",rules:"rules",capex:"capex"}[V];ge&&(w?(c("project"),m(ge)):c("home"))}},[g,w,c,f,m]),I=Y.useCallback(()=>{c("home")},[c]),{title:ne,breadcrumb:W}=ub(i,o,s);return v.jsxs("div",{className:"h-screen w-screen flex overflow-hidden bg-bg-base",children:[v.jsx(xg,{items:p,bottomItems:E,activeId:T,onSelect:K,isSubContext:g,onBack:I,disabledIds:Q}),v.jsx(Dg,{open:y,isSubContext:g,mainItems:p,mainBottomItems:E,parentItems:g?mp:void 0,parentBottomItems:g?pp:void 0,activeId:T,onSelect:K}),v.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[v.jsx(Cg,{title:ne,breadcrumb:W,onToggleSidebar:()=>h(!y),sidebarOpen:y}),v.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[v.jsx(ab,{}),v.jsx(lb,{}),v.jsx(ib,{})]})]})]})}const vp=3e4;let Do=null;function sb(i){Do=i}let _o=null;function ob(){_o||(_o=setTimeout(async()=>{_o=null;const i=await Vp();if(i){const o=De.getState();if(o.setProjects(i),!o.selectedProject){const s=i.filter(c=>c.isConnected);s.length===1&&o.setSelectedProject(s[0].appName)}}},300))}let oi=null,Eo=null,fi=1e3,Yu=!1;function rb(){return`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/api/ws/events`}function Qp(){if(!Yu){try{oi=new WebSocket(rb())}catch{gp();return}oi.onopen=()=>{fi=1e3,Je.getState().setConnected(!0)},oi.onmessage=i=>{try{const o=JSON.parse(i.data);if((o.type==="dev_server_status"||o.type==="dev_server_log")&&Do){Do(o);return}if(o.type==="session_connected"||o.type==="session_disconnected"){ob();return}if(o.type==="event"&&o.data){const{selectedProject:s,projects:c}=De.getState();if(s){const f=c.find(y=>y.appName===s);if(!f)return;const m=o.data.projectId;if(f.projectId&&m){if(m!==f.projectId)return}else if(!f.sessions.includes(o.data.sessionId))return}Je.getState().appendEvent(o.data)}}catch{}},oi.onclose=()=>{Je.getState().setConnected(!1),Yu||gp()},oi.onerror=()=>{}}}function gp(){if(Yu||Eo)return;const i=fi*.25*(Math.random()*2-1),o=Math.min(fi+i,vp);Eo=setTimeout(()=>{Eo=null,fi=Math.min(fi*2,vp),Qp()},o)}function fb(){Yu=!1,Qp()}const bp=2e3;function hl(){const{selectedProject:i,selectedPmProject:o,projects:s}=De.getState();if(o){const m=Qu.getState().projects.find(y=>y.id===o);if(m){const y=m.runtimeApps??[m.runtimescopeProject,m.name].filter(Boolean),h=[],g=[];for(const E of y){const T=s.find(w=>w.appName.toLowerCase()===E.toLowerCase());T&&(h.push(...T.sessions),T.projectId&&g.push(T.projectId))}const p=[...new Set(g)];return p.length===1?{project_id:p[0]}:h.length>0?{session_id:h.join(",")}:{session_id:"__none__"}}}if(!i)return{};const c=s.find(f=>f.appName===i);return!c||c.sessions.length===0?{session_id:"__none__"}:c.projectId?{project_id:c.projectId}:{session_id:c.sessions[0]}}function db(){return{network:async()=>{const i=hl(),o=await Co(i);o&&Je.getState().setNetwork(o)},console:async()=>{const i=hl(),o=await kp(i);o&&Je.getState().setConsole(o)},state:async()=>{const i=hl(),o=await qp(i);o&&Je.getState().setState(o)},renders:async()=>{const i=hl(),o=await Gp(i);o&&Je.getState().setRenders(o)},performance:async()=>{const i=hl(),o=await Yp(i);o&&Je.getState().setPerformance(o)},database:async()=>{const i=hl(),o=await Xp(i);o&&Je.getState().setDatabase(o)},breadcrumbs:async()=>{const i=hl(),o=await _g(i);o&&Je.getState().setUI(o)},processes:async()=>{const[i,o]=await Promise.all([Eg(),jg()]),s=Je.getState();i&&s.setProcesses(i),o&&s.setPorts(o)},overview:Ro,issues:Ro,"api-map":async()=>{const i=hl(),o=await Co(i);o&&Je.getState().setNetwork(o)},sessions:async()=>{}}}async function Ro(){const i=hl(),[o,s,c,f,m,y]=await Promise.all([Co(i),kp(i),qp(i),Gp(i),Yp(i),Xp(i)]),h=Je.getState();o&&h.setNetwork(o),s&&h.setConsole(s),c&&h.setState(c),f&&h.setRenders(f),m&&h.setPerformance(m),y&&h.setDatabase(y)}function mb(){const i=De(g=>g.activeTab),o=De(g=>g.activeView),s=De(g=>g.activeProjectTab),c=De(g=>g.runtimeSubTab),f=De(g=>g.selectedProject),m=Je(g=>g.source),y=Je(g=>g.connected),h=Y.useRef(null);Y.useEffect(()=>{if(m!=="live"||o==="project"&&s!=="runtime")return;const g=o==="project"?c:i,E=db()[g]??Ro;if(E(),!y){h.current=setInterval(E,bp);const T=()=>{document.hidden?h.current&&(clearInterval(h.current),h.current=null):(E(),h.current=setInterval(E,bp))};return document.addEventListener("visibilitychange",T),()=>{h.current&&clearInterval(h.current),document.removeEventListener("visibilitychange",T)}}return()=>{h.current&&clearInterval(h.current)}},[i,o,s,c,m,f,y])}let Xu=null,ha=null,qu=null;function Nb(){ha||!qu||(qu(),ha=setInterval(qu,750),Xu=setTimeout(()=>{ha&&(clearInterval(ha),ha=null),Xu=null},15e3))}function pb(){const i=Y.useRef(null);return Y.useEffect(()=>(Qu.getState().fetchProjects(),$e(()=>Promise.resolve().then(()=>Tg),void 0).then(o=>o.useWorkspaceStore.getState().fetchWorkspaces()),Mo().then(o=>{if(o){Je.getState().setSource("live"),fb(),sb(c=>{const f=r1.getState();c.type==="dev_server_status"?f.setStatus(c.projectId,c.status,c.pid,c.port):c.type==="dev_server_log"&&f.appendLog(c.projectId,c.stream,c.line,c.ts)});const s=async()=>{const c=await Vp();if(c){const f=De.getState();if(f.setProjects(c),!f.selectedProject){const m=c.filter(y=>y.isConnected);m.length===1&&f.setSelectedProject(m[0].appName)}}};qu=s,s(),i.current=setInterval(s,5e3)}}),()=>{i.current&&clearInterval(i.current),ha&&clearInterval(ha),Xu&&clearTimeout(Xu)}),[]),mb(),v.jsx(cb,{})}class hb extends Y.Component{constructor(){super(...arguments);ro(this,"state",{hasError:!1,error:null});ro(this,"handleReset",()=>{this.setState({hasError:!1,error:null})})}static getDerivedStateFromError(s){return{hasError:!0,error:s}}render(){var s,c;return this.state.hasError?v.jsx("div",{className:"h-screen w-screen bg-bg-base flex items-center justify-center",children:v.jsxs("div",{className:"max-w-md text-center space-y-4",children:[v.jsx("h1",{className:"text-lg font-semibold text-text-primary",children:"Something went wrong"}),v.jsx("p",{className:"text-sm text-text-muted",children:((s=this.state.error)==null?void 0:s.message)||"An unexpected error occurred."}),v.jsx("pre",{className:"text-xs text-text-tertiary bg-bg-surface rounded p-3 max-h-40 overflow-auto text-left",children:(c=this.state.error)==null?void 0:c.stack}),v.jsx("button",{type:"button",onClick:this.handleReset,className:"px-4 py-2 rounded-md bg-accent text-white text-sm font-medium hover:opacity-90 transition-opacity cursor-pointer",children:"Try Again"})]})}):this.props.children}}Nt.connect({dsn:"runtimescope://proj_k34w06y5z8qp@localhost:6768/runtimescope-dashboard"});w0.createRoot(document.getElementById("root")).render(v.jsx(Y.StrictMode,{children:v.jsx(hb,{children:v.jsx(pb,{})})}));export{gb as $,K1 as A,Np as B,wp as C,Mp as D,Rg as E,Dp as F,wo as G,Ab as H,zb as I,Lo as J,jb as K,wb as L,ug as M,dg as N,$1 as O,og as P,pg as Q,rg as R,Lp as S,hg as T,j0 as U,g0 as V,Bp as W,yg as X,Oo as Y,vb as Z,$e as _,ue as a,bb as a0,ng as a1,Qu as b,Ie as c,r1 as d,Eb as e,Ho as f,Sb as g,Nb as h,_b as i,v as j,pi as k,ag as l,P1 as m,Ao as n,lg as o,f1 as p,Je as q,Y as r,Tb as s,xb as t,De as u,Nt as v,Hp as w,Op as x,Hg as y,tg as z};
269
+ */const yg=ue("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),mp=[{id:"home",icon:Up,label:"Home"},{id:"sessions",icon:cg,label:"Sessions"},{id:"runtime",icon:K1,label:"Runtime",badge:!0},{id:"git",icon:ig,label:"Git"},{id:"tasks",icon:pg,label:"Tasks"},{id:"memory",icon:I1,label:"Memory"},{id:"rules",icon:mg,label:"Rules"}],pp=[{id:"capex",icon:fg,label:"CapEx"},{id:"processes",icon:Np,label:"Processes"},{id:"settings",icon:Lo,label:"Settings"}],vg=[{id:"overview",icon:Up,label:"Overview"},{id:"network",icon:wo,label:"Network"},{id:"console",icon:Hp,label:"Console"},{id:"issues",icon:hg,label:"Issues",badge:!0},{id:"renders",icon:Op,label:"Renders"},{id:"state",icon:F1,label:"State"},{id:"performance",icon:Dp,label:"Performance"},{id:"api-map",icon:ng,label:"API Map"},{id:"database",icon:Mp,label:"Database"},{id:"breadcrumbs",icon:Cp,label:"Breadcrumbs"},{id:"events",icon:rg,label:"Events"}],gg=[{id:"processes",icon:Np,label:"Processes"},{id:"settings",icon:Lo,label:"Settings"}];function bg({label:i,anchorRect:o}){return o?v.jsx("div",{className:"fixed z-[9999] pointer-events-none px-2.5 py-1 text-[12px] font-semibold text-accent bg-bg-elevated border border-accent-border rounded-md shadow-md whitespace-nowrap",style:{top:o.top+o.height/2,left:o.right+10,transform:"translateY(-50%)"},children:i}):null}function hp({item:i,isActive:o,disabled:s,onClick:c,onHover:f,onLeave:m}){const y=Y.useRef(null),h=i.icon;return v.jsxs("button",{ref:y,onClick:s?void 0:c,onMouseEnter:()=>{y.current&&f(y.current.getBoundingClientRect(),i.label)},onMouseLeave:m,className:Ie("relative w-11 h-11 rounded-xl flex items-center justify-center transition-all",s?"text-text-disabled/40 cursor-default":o?"text-text-primary bg-bg-overlay cursor-pointer":"text-text-disabled hover:text-text-secondary hover:bg-bg-hover cursor-pointer"),children:[o&&v.jsx("span",{className:"absolute -left-2.5 top-1/2 -translate-y-1/2 w-[3px] h-5 bg-accent rounded-r-sm"}),v.jsx(h,{size:20}),i.badge&&v.jsx("span",{className:"absolute top-2 right-2 w-[7px] h-[7px] rounded-full bg-green border-2 border-bg-base animate-pulse-dot"})]})}const xg=Y.memo(function({items:o,bottomItems:s,activeId:c,onSelect:f,isSubContext:m=!1,onBack:y,disabledIds:h}){const[g,p]=Y.useState(null),E=Y.useCallback((w,q)=>{p({rect:w,label:q})},[]),T=Y.useCallback(()=>{p(null)},[]);return v.jsxs("nav",{className:"w-[var(--rail-width)] shrink-0 bg-bg-base border-r border-border-muted flex flex-col items-center py-4 z-10",children:[m?v.jsx("button",{onClick:y,onMouseEnter:w=>E(w.currentTarget.getBoundingClientRect(),"Back to Home"),onMouseLeave:T,className:"w-8 h-8 rounded-md bg-accent-muted border border-accent-border flex items-center justify-center text-accent mb-6 cursor-pointer hover:bg-accent/25 hover:border-accent transition-all",children:v.jsx(J1,{size:18})}):v.jsx("div",{className:"w-8 h-8 rounded-md bg-gradient-to-br from-accent-dark to-accent-muted border border-accent-border flex items-center justify-center text-accent mb-6",children:v.jsx(Rp,{size:18})}),v.jsx("div",{className:"flex flex-col gap-1 flex-1",children:o.map(w=>v.jsx(hp,{item:w,isActive:c===w.id,disabled:h==null?void 0:h.has(w.id),onClick:()=>f(w.id),onHover:E,onLeave:T},w.id))}),v.jsxs("div",{className:"flex flex-col gap-1 mt-auto",children:[v.jsx("div",{className:"w-8 h-px bg-border-muted my-2"}),s.map(w=>v.jsx(hp,{item:w,isActive:c===w.id,disabled:h==null?void 0:h.has(w.id),onClick:()=>f(w.id),onHover:E,onLeave:T},w.id))]}),g&&v.jsx(bg,{label:g.label,anchorRect:g.rect})]})}),No="rs.activeWorkspaceId";function Sg(){try{return localStorage.getItem(No)}catch{return null}}function So(i){try{i?localStorage.setItem(No,i):localStorage.removeItem(No)}catch{}}const pi=cn((i,o)=>({workspaces:[],workspacesLoading:!1,activeWorkspaceId:Sg(),apiKeysByWorkspace:{},apiKeysLoading:{},newlyCreatedKey:null,fetchWorkspaces:async()=>{i({workspacesLoading:!0});const s=await t1();i({workspaces:s,workspacesLoading:!1});const{activeWorkspaceId:c}=o();c&&!s.find(f=>f.id===c)&&(So(null),i({activeWorkspaceId:null}))},setActiveWorkspace:s=>{So(s),i({activeWorkspaceId:s})},createWorkspace:async s=>{const c=await l1(s);return c?(i(f=>({workspaces:[...f.workspaces,c]})),Se.success(`Created workspace "${c.name}"`),c):(Se.error("Failed to create workspace"),null)},updateWorkspace:async(s,c)=>{const f=await a1(s,c);f?(i(m=>({workspaces:m.workspaces.map(y=>y.id===s?f:y)})),Se.success("Workspace updated")):Se.error("Failed to update workspace")},deleteWorkspace:async s=>{const c=o().workspaces.find(m=>m.id===s);if(!c)return;if(c.isDefault){Se.error("Cannot delete the default workspace");return}await n1(s)?(i(m=>({workspaces:m.workspaces.filter(y=>y.id!==s),activeWorkspaceId:m.activeWorkspaceId===s?null:m.activeWorkspaceId})),o().activeWorkspaceId===null&&So(null),Se.success(`Deleted workspace "${c.name}". Its projects moved to the default workspace.`)):Se.error("Failed to delete workspace")},moveProjectToWorkspace:async(s,c)=>{await i1(s,c)?Se.success("Project moved"):Se.error("Failed to move project")},fetchApiKeys:async s=>{i(f=>({apiKeysLoading:{...f.apiKeysLoading,[s]:!0}}));const c=await u1(s);i(f=>({apiKeysByWorkspace:{...f.apiKeysByWorkspace,[s]:c},apiKeysLoading:{...f.apiKeysLoading,[s]:!1}}))},createApiKey:async(s,c)=>{const f=await c1(s,c);return f?(i(m=>({apiKeysByWorkspace:{...m.apiKeysByWorkspace,[s]:[f,...m.apiKeysByWorkspace[s]??[]]},newlyCreatedKey:f})),f):(Se.error("Failed to create API key"),null)},revokeApiKey:async(s,c)=>{await s1(s)?(i(m=>({apiKeysByWorkspace:{...m.apiKeysByWorkspace,[c]:(m.apiKeysByWorkspace[c]??[]).filter(y=>y.keyPrefix!==s)}})),Se.success("API key revoked")):Se.error("Failed to revoke API key")},clearNewlyCreatedKey:()=>i({newlyCreatedKey:null})})),Tg=Object.freeze(Object.defineProperty({__proto__:null,useWorkspaceStore:pi},Symbol.toStringTag,{value:"Module"})),gt="";async function qt(i,o){const s=new URL(i,window.location.origin);if(o)for(const[c,f]of Object.entries(o))f!==void 0&&s.searchParams.set(c,String(f));try{const c=await fetch(s.toString());return c.ok?(await c.json()).data:null}catch{return null}}async function Mo(){try{const i=await fetch(`${gt}/api/health`);return i.ok?(await i.json()).status==="ok":!1}catch{return!1}}function Ho(i,o){var s;if(!i.length)return[];if((s=o.runtimeApps)!=null&&s.length){const c=new Set(o.runtimeApps.map(f=>f.toLowerCase()));return i.filter(f=>c.has(f.appName.toLowerCase()))}if(o.runtimescopeProject){const c=i.find(y=>y.appName===o.runtimescopeProject);if(c)return[c];const f=o.runtimescopeProject.toLowerCase(),m=i.find(y=>y.appName.toLowerCase()===f);if(m)return[m]}if(o.name){const c=o.name.toLowerCase(),f=i.find(m=>m.appName.toLowerCase()===c);if(f)return[f]}return[]}function Eb(i,o){return Ho(i,o)[0]}async function Co(i){return qt(`${gt}/api/events/network`,i)}async function kp(i){return qt(`${gt}/api/events/console`,i)}async function qp(i){return qt(`${gt}/api/events/state`,i)}async function Gp(i){return qt(`${gt}/api/events/renders`,i)}async function Yp(i){return qt(`${gt}/api/events/performance`,i)}async function Xp(i){return qt(`${gt}/api/events/database`,i)}async function jb(i){return qt(`${gt}/api/events/custom`,i)}async function _g(i){return qt(`${gt}/api/events/ui`,i)}async function zb(){return qt(`${gt}/api/sessions`)}async function Vp(){return qt(`${gt}/api/projects`)}async function Eg(i){return qt(`${gt}/api/processes`,i)}async function jg(i){return qt(`${gt}/api/ports`,i)}async function Ab(i,o="SIGTERM"){try{const s=await fetch(`${gt}/api/processes`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({pid:i,signal:o})});if(!s.ok)return null;const c=await s.json();return(c==null?void 0:c.data)??null}catch{return null}}const zg={critical:{bg:"bg-red-muted",text:"text-red",dot:"bg-red"},warning:{bg:"bg-amber-muted",text:"text-amber",dot:"bg-amber"},info:{bg:"bg-blue-muted",text:"text-blue",dot:"bg-blue"}},Ag=[{id:1,severity:"critical",icon:tg,title:"TypeError in worker.ts:142",desc:"Cannot read properties of undefined (reading 'status')",project:"runtime-profiler",source:"Console",time:"2m ago",unread:!0},{id:2,severity:"critical",icon:wo,title:"503 on POST /api/deploy/rollback",desc:"Service Unavailable — deployment lock active (4,200ms)",project:"flowAI",source:"Network",time:"5m ago",unread:!0},{id:3,severity:"warning",icon:Op,title:"Excessive re-renders: Dashboard",desc:"847 renders detected — flagged as suspicious component",project:"runtime-profiler",source:"Renders",time:"8m ago",unread:!0},{id:4,severity:"warning",icon:Mp,title:"Slow query: SELECT * FROM pm_sessions",desc:"520ms execution time exceeds 500ms threshold",project:"gtm-helper",source:"Database",time:"12m ago",unread:!0},{id:5,severity:"warning",icon:Dp,title:"LCP degraded to 3.2s",desc:"Largest Contentful Paint regressed from 1.8s — poor",project:"personal-site",source:"Performance",time:"18m ago",unread:!1},{id:6,severity:"info",icon:wo,title:"N+1 request pattern detected",desc:"GET /api/users called 8x in 2s window",project:"runtime-profiler",source:"Network",time:"32m ago",unread:!1},{id:7,severity:"info",icon:Cp,title:"deploy:failed breadcrumb recorded",desc:"Rollback unsuccessful — manual intervention required",project:"flowAI",source:"Breadcrumbs",time:"45m ago",unread:!1}],wg=Y.memo(function(){const[o,s]=Y.useState(!1),[c,f]=Y.useState(Ag),m=Y.useRef(null),y=c.filter(p=>p.unread).length;Y.useEffect(()=>{if(!o)return;const p=E=>{m.current&&!m.current.contains(E.target)&&s(!1)};return document.addEventListener("click",p),()=>document.removeEventListener("click",p)},[o]);const h=()=>{f(p=>p.map(E=>({...E,unread:!1})))},g=p=>{f(E=>E.map(T=>T.id===p?{...T,unread:!1}:T))};return v.jsxs("div",{className:"relative",ref:m,children:[v.jsxs("button",{onClick:p=>{p.stopPropagation(),s(!o)},className:"w-9 h-9 rounded-lg flex items-center justify-center bg-bg-surface border border-border-default text-text-tertiary hover:border-border-hover hover:text-text-primary transition-all relative cursor-pointer",children:[v.jsx(W1,{size:16}),y>0&&v.jsx("span",{className:"absolute top-[7px] right-[7px] w-[7px] h-[7px] rounded-full bg-red"})]}),o&&v.jsxs("div",{className:"absolute top-[calc(100%+8px)] right-0 w-[420px] bg-bg-surface border border-border-strong rounded-lg shadow-lg z-[100] overflow-hidden",children:[v.jsxs("div",{className:"flex items-center justify-between px-3.5 py-3 border-b border-border-muted",children:[v.jsxs("span",{className:"text-sm font-bold text-text-primary flex items-center gap-2",children:["Notifications",y>0&&v.jsx("span",{className:"text-[10px] font-bold text-white bg-red px-[7px] py-px rounded-full",children:y})]}),v.jsxs("button",{onClick:p=>{p.stopPropagation(),h()},className:"text-[11px] font-medium text-text-muted flex items-center gap-1.5 px-2 py-1 rounded hover:text-text-primary hover:bg-bg-hover transition-colors cursor-pointer",children:[v.jsx(eg,{size:13}),"Mark all read"]})]}),v.jsx("div",{className:"max-h-[380px] overflow-y-auto",children:c.map(p=>{const E=p.icon,T=zg[p.severity];return v.jsxs("div",{onClick:()=>g(p.id),className:Ie("flex items-start gap-2.5 px-3.5 py-2.5 border-b border-border-muted cursor-pointer transition-colors hover:bg-bg-hover",!p.unread&&"opacity-55"),children:[v.jsx("div",{className:Ie("w-8 h-8 rounded-md flex items-center justify-center shrink-0 mt-px",T.bg),children:v.jsx(E,{size:15,className:T.text})}),v.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-[3px]",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsx("span",{className:"text-[12px] font-semibold text-text-primary truncate flex-1",children:p.title}),v.jsx("span",{className:"text-[10px] text-text-disabled shrink-0",children:p.time})]}),v.jsx("span",{className:"text-[11px] text-text-tertiary truncate",children:p.desc}),v.jsxs("div",{className:"flex items-center gap-[5px] mt-px",children:[v.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-px rounded bg-bg-overlay text-text-secondary",children:p.project}),v.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-px rounded bg-bg-overlay text-text-muted",children:p.source})]})]}),p.unread&&v.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-accent shrink-0 mt-3"})]},p.id)})}),v.jsx("div",{className:"flex items-center justify-center px-3.5 py-2 border-t border-border-muted",children:v.jsx("button",{className:"text-[12px] font-semibold text-accent px-3 py-1 rounded-md hover:bg-accent-muted transition-colors cursor-pointer",children:"View All Notifications"})})]})]})}),Ng=Y.memo(function(){const o=pi(E=>E.workspaces),s=pi(E=>E.activeWorkspaceId),c=pi(E=>E.setActiveWorkspace),f=De(E=>E.setActiveView),[m,y]=Y.useState(!1),h=Y.useRef(null);Y.useEffect(()=>{if(!m)return;const E=T=>{h.current&&!h.current.contains(T.target)&&y(!1)};return document.addEventListener("click",E),()=>document.removeEventListener("click",E)},[m]);const g=o.find(E=>E.id===s),p=(g==null?void 0:g.name)??"All workspaces";return o.length<=1?null:v.jsxs("div",{className:"relative",ref:h,children:[v.jsxs("button",{type:"button",onClick:E=>{E.stopPropagation(),y(!m)},className:"flex items-center gap-1.5 h-8 px-2.5 rounded-md hover:bg-bg-hover transition-colors cursor-pointer",children:[v.jsx("span",{className:"text-[11px] text-text-muted uppercase tracking-wide",children:"Workspace"}),v.jsx("span",{className:"text-[13px] font-medium text-text-primary",children:p}),v.jsx(wp,{size:12,className:"text-text-muted"})]}),m&&v.jsxs("div",{className:"absolute top-[calc(100%+4px)] left-0 w-[280px] bg-bg-surface border border-border-strong rounded-lg shadow-lg z-[100] overflow-hidden",children:[v.jsxs("div",{className:"p-1",children:[v.jsxs("button",{onClick:()=>{c(null),y(!1)},className:Ie("w-full flex items-center justify-between gap-2 px-2.5 py-2 rounded-md text-[13px] text-left transition-colors cursor-pointer",s===null?"bg-accent-muted text-text-primary":"hover:bg-bg-hover text-text-secondary"),children:[v.jsx("span",{children:"All workspaces"}),s===null&&v.jsx(Ao,{size:14,className:"text-accent"})]}),v.jsx("div",{className:"h-px bg-border-muted my-1"}),o.map(E=>v.jsxs("button",{onClick:()=>{c(E.id),y(!1)},className:Ie("w-full flex items-center justify-between gap-2 px-2.5 py-2 rounded-md text-[13px] text-left transition-colors cursor-pointer",s===E.id?"bg-accent-muted text-text-primary":"hover:bg-bg-hover text-text-secondary"),children:[v.jsxs("span",{className:"flex items-center gap-2 truncate",children:[v.jsx("span",{className:"truncate",children:E.name}),E.isDefault&&v.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wide shrink-0",children:"default"})]}),s===E.id&&v.jsx(Ao,{size:14,className:"text-accent"})]},E.id))]}),v.jsxs("div",{className:"flex items-center gap-1 p-1 border-t border-border-muted",children:[v.jsxs("button",{onClick:()=>{f("settings"),y(!1)},className:"flex-1 flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[12px] text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors cursor-pointer",children:[v.jsx(og,{size:12}),"New workspace"]}),v.jsx("button",{onClick:()=>{f("settings"),y(!1)},className:"flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[12px] text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors cursor-pointer",title:"Workspace settings",children:v.jsx(Lo,{size:12})})]})]})]})});function Mg({open:i,onClose:o}){const s=Qu(w=>w.projects),c=De(w=>w.projects),f=De(w=>w.selectedPmProject),m=De(w=>w.selectPmProject),y=pi(w=>w.activeWorkspaceId),[h,g]=Y.useState(""),p=Y.useRef(null);if(Y.useEffect(()=>{if(!i)return;const w=q=>{p.current&&!p.current.contains(q.target)&&o()};return document.addEventListener("click",w),()=>document.removeEventListener("click",w)},[i,o]),!i)return null;const E=y?s.filter(w=>w.workspaceId===y):s,T=h.trim()?E.filter(w=>w.name.toLowerCase().includes(h.trim().toLowerCase())):E;return v.jsxs("div",{ref:p,className:"absolute top-[calc(100%+4px)] left-0 w-[380px] bg-bg-surface border border-border-strong rounded-lg shadow-lg z-[100] overflow-hidden",children:[v.jsxs("div",{className:"relative p-2.5 border-b border-border-muted",children:[v.jsx(Lp,{size:13,className:"absolute left-5 top-1/2 -translate-y-1/2 text-text-muted"}),v.jsx("input",{type:"text",value:h,onChange:w=>g(w.target.value),placeholder:"Search projects...",className:"w-full h-8 bg-bg-input border border-border-strong rounded-md pl-8 pr-2.5 text-[12px] text-text-primary outline-none focus:border-accent-border",onClick:w=>w.stopPropagation()})]}),v.jsx("div",{className:"max-h-60 overflow-y-auto p-1",children:T.map(w=>{const q=w.id===f;return v.jsx("button",{onClick:Q=>{Q.stopPropagation(),m(w.id),o()},className:Ie("w-full flex items-center gap-2.5 px-2.5 py-2 rounded-md text-left transition-colors cursor-pointer",q?"bg-accent-muted":"hover:bg-bg-hover"),children:(()=>{const K=Ho(c,{runtimescopeProject:w.runtimescopeProject,runtimeApps:w.runtimeApps,name:w.name}).some(I=>I.isConnected);return v.jsxs(v.Fragment,{children:[v.jsx("span",{className:Ie("w-1.5 h-1.5 rounded-full shrink-0",K?"bg-green animate-pulse-dot":"bg-text-muted")}),v.jsx("span",{className:"flex-1 text-[13px] font-medium text-text-primary truncate",children:w.name}),v.jsx("span",{className:"text-[11px] text-text-muted font-mono",children:K?"live":"offline"})]})})()},w.id)})}),v.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-t border-border-muted",children:[v.jsxs("button",{className:"text-[11px] text-text-tertiary hover:text-text-primary hover:bg-bg-hover px-2 py-1 rounded-sm flex items-center gap-1 cursor-pointer",children:[v.jsx(ag,{size:12})," Show hidden"]}),v.jsxs("button",{className:"text-[11px] text-text-tertiary hover:text-text-primary hover:bg-bg-hover px-2 py-1 rounded-sm flex items-center gap-1 cursor-pointer",children:[v.jsx(ug,{size:12})," Full view"]})]})]})}const Cg=Y.memo(function({title:o,breadcrumb:s,onToggleSidebar:c,sidebarOpen:f}){const[m,y]=Y.useState(!1),h=De(q=>q.selectedPmProject),p=Qu(q=>q.projects).find(q=>q.id===h),E=(p==null?void 0:p.name)??"Select project",T=De(q=>q.projects),w=p?Ho(T,{runtimescopeProject:p.runtimescopeProject,runtimeApps:p.runtimeApps,name:p.name}).some(q=>q.isConnected):!1;return v.jsxs("header",{className:"h-[var(--header-height)] border-b border-border-muted flex items-center px-6 gap-4 shrink-0 bg-bg-base",children:[v.jsx("button",{onClick:c,className:Ie("w-8 h-8 rounded-md flex items-center justify-center shrink-0 mr-1 transition-all cursor-pointer",f?"text-accent bg-accent-muted":"text-text-muted hover:text-text-primary hover:bg-bg-hover"),children:v.jsx(sg,{size:16})}),v.jsx(Ng,{}),v.jsxs("div",{className:"relative",children:[v.jsxs("div",{onClick:q=>{q.stopPropagation(),y(!m)},className:"flex items-center gap-2 px-2.5 py-1.5 rounded-md cursor-pointer hover:bg-bg-hover transition-colors",children:[v.jsx("span",{className:Ie("w-[7px] h-[7px] rounded-full shrink-0",w?"bg-green":"bg-text-muted")}),v.jsx("span",{className:"text-[15px] font-bold text-text-primary whitespace-nowrap",children:E}),v.jsx(wp,{size:14,className:"text-text-muted"})]}),v.jsx(Mg,{open:m,onClose:()=>y(!1)})]}),v.jsx("span",{className:"text-text-muted text-sm",children:"/"}),v.jsx("span",{className:"text-[13px] font-medium text-text-secondary",children:o}),s&&v.jsxs(v.Fragment,{children:[v.jsx("span",{className:"text-text-muted text-sm",children:"/"}),v.jsx("span",{className:"text-[13px] font-medium text-text-secondary",children:s})]}),v.jsxs("div",{className:"ml-auto flex items-center gap-2 h-9 w-[280px] px-3 bg-bg-surface border border-border-default rounded-lg text-text-muted text-[12px] cursor-pointer hover:border-border-hover transition-colors",children:[v.jsx(Lp,{size:14}),v.jsx("span",{className:"flex-1",children:"Search events, errors, routes..."}),v.jsx("kbd",{className:"font-mono text-[11px] px-1.5 py-0.5 bg-bg-elevated border border-accent-border rounded text-text-tertiary",children:"⌘K"})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsxs("div",{className:"flex items-center gap-1.5 h-9 px-3 bg-bg-surface border border-border-default rounded-lg text-[12px] font-medium text-text-primary cursor-pointer",children:[v.jsx(P1,{size:14,className:"text-text-tertiary"}),"Today, Apr 6"]}),v.jsx(wg,{}),v.jsxs("div",{className:"flex items-center gap-2 cursor-pointer px-2 py-1 rounded-md hover:bg-bg-hover transition-colors",children:[v.jsx("div",{className:"w-8 h-8 rounded-full bg-border-strong"}),v.jsxs("div",{className:"flex flex-col leading-tight",children:[v.jsx("span",{className:"text-[12px] font-semibold",children:"Edwin L."}),v.jsx("span",{className:"text-[10px] text-text-muted",children:"Admin"})]})]})]})]})});function an({item:i,isActive:o,onClick:s}){const c=i.icon;return v.jsxs("button",{onClick:s,className:Ie("w-full flex items-center gap-2.5 h-[34px] px-2.5 rounded-md text-[13px] font-medium whitespace-nowrap transition-all cursor-pointer",o?"text-text-primary bg-bg-overlay":"text-text-secondary hover:text-text-primary hover:bg-bg-hover"),children:[v.jsx(c,{size:16,className:"shrink-0"}),v.jsx("span",{className:"flex-1 text-left overflow-hidden text-ellipsis",children:i.label}),i.badge&&v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green shrink-0"})]})}function To({children:i,visible:o}){return v.jsx("div",{className:Ie("text-[10px] font-semibold text-text-muted uppercase tracking-[0.06em] px-4 py-1 pb-2 whitespace-nowrap transition-opacity",o?"opacity-100":"opacity-0"),children:i})}const Dg=Y.memo(function({open:o,isSubContext:s,mainItems:c,mainBottomItems:f,parentItems:m,parentBottomItems:y,activeId:h,onSelect:g}){return s&&m&&y?v.jsxs("aside",{className:Ie("shrink-0 bg-bg-app border-r border-border-muted flex flex-col overflow-hidden transition-all duration-200 ease-in-out z-[9]",o?"w-[var(--sidebar-width)] py-4 overflow-y-auto":"w-0"),children:[v.jsx(To,{visible:o,children:"Runtime"}),v.jsx("div",{className:"flex flex-col gap-px px-2",children:c.map(p=>v.jsx(an,{item:p,isActive:h===p.id,onClick:()=>g(p.id)},p.id))}),v.jsx("div",{className:"h-px bg-border-muted mx-4 my-2"}),v.jsx("div",{className:"flex flex-col gap-px px-2",children:f.map(p=>v.jsx(an,{item:p,isActive:h===p.id,onClick:()=>g(p.id)},p.id))}),v.jsx("div",{className:"h-px bg-border-muted mx-4 my-2"}),v.jsx(To,{visible:o,children:"Project"}),v.jsx("div",{className:"flex flex-col gap-px px-2",children:m.map(p=>v.jsx(an,{item:p,onClick:()=>g(p.id)},p.id))}),v.jsx("div",{className:"h-px bg-border-muted mx-4 my-2"}),v.jsx("div",{className:"flex flex-col gap-px px-2",children:y.map(p=>v.jsx(an,{item:p,onClick:()=>g(p.id)},p.id))})]}):v.jsxs("aside",{className:Ie("shrink-0 bg-bg-app border-r border-border-muted flex flex-col overflow-hidden transition-all duration-200 ease-in-out z-[9]",o?"w-[var(--sidebar-width)] py-4 overflow-y-auto":"w-0"),children:[v.jsx(To,{visible:o,children:"Navigation"}),v.jsx("div",{className:"flex flex-col gap-px px-2",children:c.map(p=>v.jsx(an,{item:p,isActive:h===p.id,onClick:()=>g(p.id)},p.id))}),v.jsx("div",{className:"h-px bg-border-muted mx-4 my-2"}),v.jsx("div",{className:"flex flex-col gap-px px-2",children:f.map(p=>v.jsx(an,{item:p,isActive:h===p.id,onClick:()=>g(p.id)},p.id))})]})});function Rg({icon:i,title:o,description:s,action:c,className:f}){return v.jsx("div",{className:Ie("flex-1 flex items-center justify-center p-8",f),children:v.jsxs("div",{className:"flex flex-col items-center gap-3 text-center max-w-sm",children:[i&&v.jsx("div",{className:"text-text-muted",children:i}),v.jsx("h2",{className:"text-[15px] font-semibold text-text-primary",children:o}),s&&v.jsx("p",{className:"text-sm text-text-tertiary",children:s}),c&&v.jsx("div",{className:"mt-2",children:c})]})})}const Og=[{label:"Install",command:"npm install @runtimescope/sdk",description:"Add the SDK to your project"},{label:"Start collector",command:"npx runtimescope",description:"Start the collector server on port 6767"},{label:"Initialize",command:"RuntimeScope.init({ appName: 'my-app' })",description:"Add to your app entry point"}];function Ug({text:i}){const[o,s]=Y.useState(!1),c=()=>{navigator.clipboard.writeText(i),s(!0),setTimeout(()=>s(!1),2e3)};return v.jsx("button",{onClick:c,className:"shrink-0 p-1 rounded hover:bg-bg-hover text-text-disabled hover:text-text-secondary transition-colors cursor-pointer",title:"Copy to clipboard",children:o?v.jsx(Ao,{size:12,className:"text-green"}):v.jsx(lg,{size:12})})}function Lg({onRetry:i}){const[o,s]=Y.useState(!1),c=async()=>{s(!0);const f=await Mo();s(!1),f&&i&&i(),f&&window.location.reload()};return Y.useEffect(()=>{const f=setInterval(async()=>{await Mo()&&window.location.reload()},1e4);return()=>clearInterval(f)},[]),v.jsx("div",{className:"flex-1 flex items-center justify-center bg-bg-base",children:v.jsxs("div",{className:"max-w-lg w-full px-8",children:[v.jsxs("div",{className:"flex flex-col items-center text-center mb-10",children:[v.jsxs("div",{className:"relative mb-6",children:[v.jsx("div",{className:"w-16 h-16 rounded-2xl bg-bg-surface border border-border-strong flex items-center justify-center",children:v.jsx(Rp,{size:28,className:"text-accent"})}),v.jsx("div",{className:"absolute -bottom-1 -right-1 w-6 h-6 rounded-full bg-bg-base border-2 border-bg-base flex items-center justify-center",children:v.jsx(Bp,{size:12,className:"text-amber"})})]}),v.jsx("h1",{className:"text-xl font-bold text-text-primary mb-2",children:"Collector Offline"}),v.jsx("p",{className:"text-[13px] text-text-tertiary leading-relaxed max-w-sm",children:"The RuntimeScope collector isn't running. Start it to begin capturing events from your application."})]}),v.jsx("div",{className:"space-y-3 mb-8",children:Og.map((f,m)=>v.jsxs("div",{className:"flex items-start gap-3",children:[v.jsx("div",{className:"w-6 h-6 rounded-full bg-accent-muted border border-accent-border flex items-center justify-center shrink-0 mt-0.5",children:v.jsx("span",{className:"text-[11px] font-bold text-accent",children:m+1})}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[v.jsx("span",{className:"text-[12px] font-semibold text-text-primary",children:f.label}),v.jsx("span",{className:"text-[11px] text-text-muted",children:f.description})]}),v.jsxs("div",{className:"flex items-center gap-2 bg-bg-surface border border-border-default rounded-md px-3 py-2",children:[v.jsx(Hp,{size:12,className:"text-text-muted shrink-0"}),v.jsx("code",{className:"flex-1 text-[12px] font-mono text-accent truncate",children:f.command}),v.jsx(Ug,{text:f.command})]})]})]},m))}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("button",{onClick:c,disabled:o,className:Ie("flex-1 flex items-center justify-center gap-2 h-10 rounded-md text-[13px] font-semibold transition-all cursor-pointer","bg-accent text-text-inverse hover:brightness-110",o&&"opacity-70"),children:[v.jsx(dg,{size:14,className:o?"animate-spin":""}),o?"Checking...":"Retry Connection"]}),v.jsxs("a",{href:"https://github.com/anthropics/runtimescope",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 h-10 px-4 rounded-md text-[13px] font-medium text-text-tertiary bg-bg-surface border border-border-default hover:border-border-hover hover:text-text-primary transition-colors",children:["Docs ",v.jsx($1,{size:12})]})]}),v.jsx("p",{className:"text-center text-[11px] text-text-disabled mt-4",children:"Auto-retrying every 10 seconds • Listening on ws://localhost:6767"})]})})}function it({className:i}){return v.jsx("div",{className:Ie("bg-bg-elevated rounded animate-pulse",i)})}function Hg({rows:i=8}){return v.jsxs("div",{className:"w-full",children:[v.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border-default",children:[v.jsx(it,{className:"h-3 w-[15%]"}),v.jsx(it,{className:"h-3 w-[8%]"}),v.jsx(it,{className:"h-3 w-[10%]"}),v.jsx(it,{className:"h-3 w-[35%]"}),v.jsx(it,{className:"h-3 w-[10%]"}),v.jsx(it,{className:"h-3 w-[8%]"})]}),Array.from({length:i},(o,s)=>v.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border-muted",style:{opacity:1-s*.08},children:[v.jsx(it,{className:"h-3.5 w-[15%]"}),v.jsx(it,{className:"h-3.5 w-[8%]"}),v.jsx(it,{className:"h-3.5 w-[10%]"}),v.jsx(it,{className:Ie("h-3.5",s%3===0?"w-[30%]":s%3===1?"w-[25%]":"w-[35%]")}),v.jsx(it,{className:"h-3.5 w-[10%]"}),v.jsx(it,{className:"h-3.5 w-[8%]"})]},s))]})}function wb({rows:i=6}){return v.jsx("div",{className:"w-full",children:Array.from({length:i},(o,s)=>v.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border-muted",style:{opacity:1-s*.08},children:[v.jsx(it,{className:"h-2.5 w-2.5 rounded-full shrink-0"}),v.jsx(it,{className:"h-3 w-[60px] shrink-0"}),v.jsx(it,{className:Ie("h-3.5 flex-1",s%3===0?"max-w-[60%]":s%3===1?"max-w-[45%]":"max-w-[70%]")}),v.jsx(it,{className:"h-3 w-[80px] shrink-0 ml-auto"})]},s))})}const Bg=Y.lazy(()=>$e(()=>import("./kitchen-sink-DmOR6KnI.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(i=>({default:i.KitchenSink}))),kg=Y.lazy(()=>$e(()=>import("./project-view-DnnhNMhS.js").then(i=>i.p),__vite__mapDeps([12,1,2,8,13,14,15])).then(i=>({default:i.ProjectView}))),qg=Y.lazy(()=>$e(()=>import("./home-page-lMWZHIMB.js"),__vite__mapDeps([16,1,2,4,5,6,7,8,17,18,19,10,14,15])).then(i=>({default:i.HomePage}))),Gg=Y.lazy(()=>$e(()=>import("./settings-page-B2geIpMf.js"),__vite__mapDeps([20,21,22])).then(i=>({default:i.SettingsPage}))),Yg=Y.lazy(()=>$e(()=>import("./overview-page-j5X9SBqW.js").then(i=>i.o),__vite__mapDeps([23,11,2,5,6,7,24,10,25,26,27])).then(i=>({default:i.OverviewPage}))),Xg=Y.lazy(()=>$e(()=>import("./network-page-CiQu5Dem.js"),__vite__mapDeps([28,9,2,1,4,29,30,8,31,17,32,26,33])).then(i=>({default:i.NetworkPage}))),Vg=Y.lazy(()=>$e(()=>import("./console-page-B3sYOQK9.js"),__vite__mapDeps([34,2,35,21,32,17,26,33,36])).then(i=>({default:i.ConsolePage}))),Qg=Y.lazy(()=>$e(()=>import("./renders-page-C9THhZZ3.js"),__vite__mapDeps([37,1,2,4,29,6,8,38])).then(i=>({default:i.RendersPage}))),Zg=Y.lazy(()=>$e(()=>import("./state-page-CQDLPZ5t.js"),__vite__mapDeps([39,9,2,1,29,35,21,38,26,33])).then(i=>({default:i.StatePage}))),Kg=Y.lazy(()=>$e(()=>import("./performance-page-ImE9xvEt.js"),__vite__mapDeps([40,1,2,6,38])).then(i=>({default:i.PerformancePage}))),Jg=Y.lazy(()=>$e(()=>import("./issues-page-8abUxnvT.js"),__vite__mapDeps([41,9,2,1,29,26,27,36])).then(i=>({default:i.IssuesPage}))),yp=Y.lazy(()=>$e(()=>import("./api-map-page-Btbazs5z.js"),__vite__mapDeps([42,9,2,1,4,29,8,26,33])).then(i=>({default:i.ApiMapPage}))),$g=Y.lazy(()=>$e(()=>import("./database-page-DYOGNtgK.js"),__vite__mapDeps([43,9,2,1,3,4,29,30,38,32,17,26,33])).then(i=>({default:i.DatabasePage}))),Wg=Y.lazy(()=>$e(()=>import("./processes-page-BIMoApg0.js"),__vite__mapDeps([44,9,2,1,4,5,6,7,8,26,25,14])).then(i=>({default:i.ProcessesPage}))),Fg=Y.lazy(()=>$e(()=>import("./infra-page-Cwb8--Fc.js"),__vite__mapDeps([45,9,2,1,26])).then(i=>({default:i.InfraPage}))),Ig=Y.lazy(()=>$e(()=>import("./sessions-page-BYNnSmUH.js"),__vite__mapDeps([46,9,2,1,4,29,30,8,26,33])).then(i=>({default:i.SessionsPage}))),Pg=Y.lazy(()=>$e(()=>import("./breadcrumbs-page-ahYuYyrd.js"),__vite__mapDeps([47,1,2,35,21,38,32,17,33,13])).then(i=>({default:i.BreadcrumbsPage}))),eb=Y.lazy(()=>$e(()=>import("./events-page-d6_fhDSn.js"),__vite__mapDeps([48,1,2,4,29,11,21])).then(i=>({default:i.EventsPage}))),tb={overview:Yg,network:Xg,console:Vg,renders:Qg,state:Zg,performance:Kg,issues:Jg,api:yp,"api-map":yp,database:$g,processes:Wg,infra:Fg,sessions:Ig,breadcrumbs:Pg,events:eb};function si(){return v.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:v.jsx(Hg,{rows:10})})}function lb(){const i=De(f=>f.activeTab),o=De(f=>f.activeView),s=Je(f=>f.source);if(o==="runtime"&&s==="mock")return v.jsx(Lg,{});if(i==="showcase")return v.jsx(Y.Suspense,{fallback:v.jsx(si,{}),children:v.jsx(Bg,{})});if(o==="home")return v.jsx(Y.Suspense,{fallback:v.jsx(si,{}),children:v.jsx(qg,{})});if(o==="project")return v.jsx(Y.Suspense,{fallback:v.jsx(si,{}),children:v.jsx(kg,{})});if(o==="settings")return v.jsx(Y.Suspense,{fallback:v.jsx(si,{}),children:v.jsx(Gg,{})});const c=tb[i];return c?v.jsx(Y.Suspense,{fallback:v.jsx(si,{}),children:v.jsx(c,{})}):v.jsx(Rg,{title:"Not Found",description:"This page doesn't exist."})}function ab(){return Je(o=>o.connected)?null:v.jsxs("div",{className:"bg-amber-muted border-b border-amber-border px-4 py-2 flex items-center justify-center gap-2 text-amber text-xs font-medium",children:[v.jsx(Bp,{className:"w-3.5 h-3.5"}),v.jsx("span",{children:"Connection lost — reconnecting. Data may be stale."}),v.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-amber animate-pulse-dot"})]})}const nb={success:"bg-green-900/90 border-green-700 text-green-100",error:"bg-red-900/90 border-red-700 text-red-100",info:"bg-blue-900/90 border-blue-700 text-blue-100"};function ib(){const i=mi(s=>s.toasts),o=mi(s=>s.remove);return i.length===0?null:v.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-sm",children:i.map(s=>v.jsxs("div",{className:`flex items-center gap-2 px-4 py-2.5 rounded-lg border text-sm shadow-lg animate-in slide-in-from-right-5 fade-in duration-200 ${nb[s.variant]}`,children:[v.jsx("span",{className:"flex-1",children:s.message}),v.jsx("button",{type:"button",onClick:()=>o(s.id),className:"opacity-60 hover:opacity-100 transition-opacity cursor-pointer",children:v.jsx(yg,{className:"w-3.5 h-3.5"})})]},s.id))})}function ub(i,o,s){return i==="home"?{title:"Home"}:i==="project"?{title:{sessions:"Sessions",tasks:"Tasks",notes:"Notes",memory:"Memory",git:"Git",capex:"CapEx",sdk:"SDK",rules:"Rules"}[s]??"Project"}:{title:"Runtime",breadcrumb:{overview:"Overview",network:"Network",console:"Console",issues:"Issues",renders:"Renders",state:"State",performance:"Performance","api-map":"API Map",database:"Database",breadcrumbs:"Breadcrumbs",events:"Events",processes:"Processes",settings:"Settings"}[o]??o}}function cb(){const i=De(V=>V.activeView),o=De(V=>V.activeTab),s=De(V=>V.activeProjectTab),c=De(V=>V.setActiveView),f=De(V=>V.setActiveTab),m=De(V=>V.setActiveProjectTab),[y,h]=Y.useState(!1),g=i==="runtime",p=g?vg:mp,E=g?gg:pp,T=g?o:i==="home"?"home":s,w=De(V=>V.selectedPmProject),Q=!g&&!w?new Set(["sessions","git","tasks","memory","rules","capex"]):void 0,K=Y.useCallback(V=>{if(g){if(V==="settings"){c("settings");return}f(V)}else if(V==="home")c("home");else if(V==="runtime")c("runtime"),f("overview");else if(V==="settings")c("settings");else if(V==="processes")c("home");else{const ge={sessions:"sessions",git:"git",tasks:"tasks",memory:"memory",rules:"rules",capex:"capex"}[V];ge&&(w?(c("project"),m(ge)):c("home"))}},[g,w,c,f,m]),I=Y.useCallback(()=>{c("home")},[c]),{title:ne,breadcrumb:W}=ub(i,o,s);return v.jsxs("div",{className:"h-screen w-screen flex overflow-hidden bg-bg-base",children:[v.jsx(xg,{items:p,bottomItems:E,activeId:T,onSelect:K,isSubContext:g,onBack:I,disabledIds:Q}),v.jsx(Dg,{open:y,isSubContext:g,mainItems:p,mainBottomItems:E,parentItems:g?mp:void 0,parentBottomItems:g?pp:void 0,activeId:T,onSelect:K}),v.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[v.jsx(Cg,{title:ne,breadcrumb:W,onToggleSidebar:()=>h(!y),sidebarOpen:y}),v.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[v.jsx(ab,{}),v.jsx(lb,{}),v.jsx(ib,{})]})]})]})}const vp=3e4;let Do=null;function sb(i){Do=i}let _o=null;function ob(){_o||(_o=setTimeout(async()=>{_o=null;const i=await Vp();if(i){const o=De.getState();if(o.setProjects(i),!o.selectedProject){const s=i.filter(c=>c.isConnected);s.length===1&&o.setSelectedProject(s[0].appName)}}},300))}let oi=null,Eo=null,fi=1e3,Yu=!1;function rb(){return`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/api/ws/events`}function Qp(){if(!Yu){try{oi=new WebSocket(rb())}catch{gp();return}oi.onopen=()=>{fi=1e3,Je.getState().setConnected(!0)},oi.onmessage=i=>{try{const o=JSON.parse(i.data);if((o.type==="dev_server_status"||o.type==="dev_server_log")&&Do){Do(o);return}if(o.type==="session_connected"||o.type==="session_disconnected"){ob();return}if(o.type==="event"&&o.data){const{selectedProject:s,projects:c}=De.getState();if(s){const f=c.find(y=>y.appName===s);if(!f)return;const m=o.data.projectId;if(f.projectId&&m){if(m!==f.projectId)return}else if(!f.sessions.includes(o.data.sessionId))return}Je.getState().appendEvent(o.data)}}catch{}},oi.onclose=()=>{Je.getState().setConnected(!1),Yu||gp()},oi.onerror=()=>{}}}function gp(){if(Yu||Eo)return;const i=fi*.25*(Math.random()*2-1),o=Math.min(fi+i,vp);Eo=setTimeout(()=>{Eo=null,fi=Math.min(fi*2,vp),Qp()},o)}function fb(){Yu=!1,Qp()}const bp=2e3;function hl(){const{selectedProject:i,selectedPmProject:o,projects:s}=De.getState();if(o){const m=Qu.getState().projects.find(y=>y.id===o);if(m){const y=m.runtimeApps??[m.runtimescopeProject,m.name].filter(Boolean),h=[],g=[];for(const E of y){const T=s.find(w=>w.appName.toLowerCase()===E.toLowerCase());T&&(h.push(...T.sessions),T.projectId&&g.push(T.projectId))}const p=[...new Set(g)];return p.length===1?{project_id:p[0]}:h.length>0?{session_id:h.join(",")}:{session_id:"__none__"}}}if(!i)return{};const c=s.find(f=>f.appName===i);return!c||c.sessions.length===0?{session_id:"__none__"}:c.projectId?{project_id:c.projectId}:{session_id:c.sessions[0]}}function db(){return{network:async()=>{const i=hl(),o=await Co(i);o&&Je.getState().setNetwork(o)},console:async()=>{const i=hl(),o=await kp(i);o&&Je.getState().setConsole(o)},state:async()=>{const i=hl(),o=await qp(i);o&&Je.getState().setState(o)},renders:async()=>{const i=hl(),o=await Gp(i);o&&Je.getState().setRenders(o)},performance:async()=>{const i=hl(),o=await Yp(i);o&&Je.getState().setPerformance(o)},database:async()=>{const i=hl(),o=await Xp(i);o&&Je.getState().setDatabase(o)},breadcrumbs:async()=>{const i=hl(),o=await _g(i);o&&Je.getState().setUI(o)},processes:async()=>{const[i,o]=await Promise.all([Eg(),jg()]),s=Je.getState();i&&s.setProcesses(i),o&&s.setPorts(o)},overview:Ro,issues:Ro,"api-map":async()=>{const i=hl(),o=await Co(i);o&&Je.getState().setNetwork(o)},sessions:async()=>{}}}async function Ro(){const i=hl(),[o,s,c,f,m,y]=await Promise.all([Co(i),kp(i),qp(i),Gp(i),Yp(i),Xp(i)]),h=Je.getState();o&&h.setNetwork(o),s&&h.setConsole(s),c&&h.setState(c),f&&h.setRenders(f),m&&h.setPerformance(m),y&&h.setDatabase(y)}function mb(){const i=De(g=>g.activeTab),o=De(g=>g.activeView),s=De(g=>g.activeProjectTab),c=De(g=>g.runtimeSubTab),f=De(g=>g.selectedProject),m=Je(g=>g.source),y=Je(g=>g.connected),h=Y.useRef(null);Y.useEffect(()=>{if(m!=="live"||o==="project"&&s!=="runtime")return;const g=o==="project"?c:i,E=db()[g]??Ro;if(E(),!y){h.current=setInterval(E,bp);const T=()=>{document.hidden?h.current&&(clearInterval(h.current),h.current=null):(E(),h.current=setInterval(E,bp))};return document.addEventListener("visibilitychange",T),()=>{h.current&&clearInterval(h.current),document.removeEventListener("visibilitychange",T)}}return()=>{h.current&&clearInterval(h.current)}},[i,o,s,c,m,f,y])}let Xu=null,ha=null,qu=null;function Nb(){ha||!qu||(qu(),ha=setInterval(qu,750),Xu=setTimeout(()=>{ha&&(clearInterval(ha),ha=null),Xu=null},15e3))}function pb(){const i=Y.useRef(null);return Y.useEffect(()=>(Qu.getState().fetchProjects(),$e(()=>Promise.resolve().then(()=>Tg),void 0).then(o=>o.useWorkspaceStore.getState().fetchWorkspaces()),Mo().then(o=>{if(o){Je.getState().setSource("live"),fb(),sb(c=>{const f=r1.getState();c.type==="dev_server_status"?f.setStatus(c.projectId,c.status,c.pid,c.port):c.type==="dev_server_log"&&f.appendLog(c.projectId,c.stream,c.line,c.ts)});const s=async()=>{const c=await Vp();if(c){const f=De.getState();if(f.setProjects(c),!f.selectedProject){const m=c.filter(y=>y.isConnected);m.length===1&&f.setSelectedProject(m[0].appName)}}};qu=s,s(),i.current=setInterval(s,5e3)}}),()=>{i.current&&clearInterval(i.current),ha&&clearInterval(ha),Xu&&clearTimeout(Xu)}),[]),mb(),v.jsx(cb,{})}class hb extends Y.Component{constructor(){super(...arguments);ro(this,"state",{hasError:!1,error:null});ro(this,"handleReset",()=>{this.setState({hasError:!1,error:null})})}static getDerivedStateFromError(s){return{hasError:!0,error:s}}render(){var s,c;return this.state.hasError?v.jsx("div",{className:"h-screen w-screen bg-bg-base flex items-center justify-center",children:v.jsxs("div",{className:"max-w-md text-center space-y-4",children:[v.jsx("h1",{className:"text-lg font-semibold text-text-primary",children:"Something went wrong"}),v.jsx("p",{className:"text-sm text-text-muted",children:((s=this.state.error)==null?void 0:s.message)||"An unexpected error occurred."}),v.jsx("pre",{className:"text-xs text-text-tertiary bg-bg-surface rounded p-3 max-h-40 overflow-auto text-left",children:(c=this.state.error)==null?void 0:c.stack}),v.jsx("button",{type:"button",onClick:this.handleReset,className:"px-4 py-2 rounded-md bg-accent text-white text-sm font-medium hover:opacity-90 transition-opacity cursor-pointer",children:"Try Again"})]})}):this.props.children}}Nt.connect({dsn:"runtimescope://proj_k34w06y5z8qp@localhost:6768/runtimescope-dashboard"});w0.createRoot(document.getElementById("root")).render(v.jsx(Y.StrictMode,{children:v.jsx(hb,{children:v.jsx(pb,{})})}));export{gb as $,K1 as A,Np as B,wp as C,Mp as D,Rg as E,Dp as F,wo as G,Ab as H,zb as I,Lo as J,jb as K,wb as L,ug as M,dg as N,$1 as O,og as P,pg as Q,rg as R,Lp as S,hg as T,j0 as U,g0 as V,Bp as W,yg as X,Oo as Y,vb as Z,$e as _,ue as a,bb as a0,ng as a1,Qu as b,Ie as c,r1 as d,Eb as e,Ho as f,Sb as g,Nb as h,_b as i,v as j,pi as k,ag as l,P1 as m,Ao as n,lg as o,f1 as p,Je as q,Y as r,Tb as s,xb as t,De as u,Nt as v,Hp as w,Op as x,Hg as y,tg as z};
@@ -1,4 +1,4 @@
1
- import{a as e}from"./index-DgQg-mjd.js";/**
1
+ import{a as e}from"./index-CUDottTv.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{r as n,j as e,c}from"./index-DgQg-mjd.js";import{T as m}from"./topbar-DJt5eMx5.js";import{B as d}from"./badge-BGgXl2qy.js";import"./textarea-BROdxV-a.js";import{u as x}from"./use-connected-c8-oDf2s.js";const i=[{name:"Vercel",id:"vercel",configured:!1,envVar:"VERCEL_TOKEN + VERCEL_PROJECT_ID",docsUrl:"https://vercel.com/docs/rest-api",description:"Deploy logs, build status, and runtime errors from Vercel."},{name:"Cloudflare",id:"cloudflare",configured:!1,envVar:"CF_API_TOKEN + CF_ACCOUNT_ID",docsUrl:"https://developers.cloudflare.com/api/",description:"Worker deployments, analytics, and error logs."},{name:"Railway",id:"railway",configured:!1,envVar:"RAILWAY_TOKEN + RAILWAY_PROJECT_ID",docsUrl:"https://docs.railway.app/reference/public-api",description:"Service deployments, build logs, and runtime metrics."}];function v(){const[t,o]=n.useState("overview");x();const[r,l]=n.useState(i);n.useEffect(()=>{l(i)},[]);const a=r.filter(s=>s.configured).length;return e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[e.jsx(m,{tabs:[{id:"overview",label:"Overview"},{id:"setup",label:"Setup"}],activeTab:t,onTabChange:o}),e.jsxs("div",{className:"flex-1 overflow-auto",children:[t==="overview"&&e.jsxs("div",{className:"p-5 space-y-4 max-w-3xl mx-auto w-full",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("h2",{className:"text-sm font-medium text-text-primary",children:"Platform Connections"}),e.jsxs(d,{size:"sm",variant:a>0?"green":"default",children:[a,"/",r.length," connected"]})]}),e.jsx("div",{className:"grid gap-3",children:r.map(s=>e.jsx(u,{platform:s},s.id))}),a===0&&e.jsx("div",{className:"mt-6 p-4 rounded-lg border border-border-muted bg-bg-surface",children:e.jsxs("p",{className:"text-sm text-text-muted",children:["No platforms connected yet. Switch to the"," ",e.jsx("button",{className:"text-accent hover:underline",onClick:()=>o("setup"),children:"Setup"})," ","tab to configure your deployment platforms."]})})]}),t==="setup"&&e.jsxs("div",{className:"p-5 space-y-6 max-w-3xl mx-auto w-full",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-sm font-medium text-text-primary",children:"Infrastructure Setup"}),e.jsx("p",{className:"text-sm text-text-muted",children:"Connect your deployment platforms to see deploy logs, build status, and runtime errors directly in RuntimeScope."})]}),e.jsxs("div",{className:"p-4 rounded-lg border border-border-strong bg-bg-surface space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"How it works"}),e.jsxs("ol",{className:"text-sm text-text-secondary space-y-2 list-decimal list-inside",children:[e.jsx("li",{children:"Set the required environment variables for your platform"}),e.jsx("li",{children:"Configure the platform in your RuntimeScope config file"}),e.jsx("li",{children:"Restart the collector — deploy data will appear automatically"})]})]}),e.jsxs("div",{className:"p-4 rounded-lg border border-border-strong bg-bg-surface space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Configuration"}),e.jsxs("p",{className:"text-sm text-text-muted",children:["Add platforms to ",e.jsx("code",{className:"px-1.5 py-0.5 rounded bg-bg-elevated text-text-secondary font-mono text-xs",children:"~/.runtimescope/config.json"}),":"]}),e.jsx("pre",{className:"text-xs font-mono bg-bg-elevated p-3 rounded-lg overflow-x-auto text-text-secondary",children:`{
1
+ import{r as n,j as e,c}from"./index-CUDottTv.js";import{T as m}from"./topbar-892TvyNb.js";import{B as d}from"./badge-BOfEUuSW.js";import"./textarea-DAwdLdON.js";import{u as x}from"./use-connected-3Ljk-Uwv.js";const i=[{name:"Vercel",id:"vercel",configured:!1,envVar:"VERCEL_TOKEN + VERCEL_PROJECT_ID",docsUrl:"https://vercel.com/docs/rest-api",description:"Deploy logs, build status, and runtime errors from Vercel."},{name:"Cloudflare",id:"cloudflare",configured:!1,envVar:"CF_API_TOKEN + CF_ACCOUNT_ID",docsUrl:"https://developers.cloudflare.com/api/",description:"Worker deployments, analytics, and error logs."},{name:"Railway",id:"railway",configured:!1,envVar:"RAILWAY_TOKEN + RAILWAY_PROJECT_ID",docsUrl:"https://docs.railway.app/reference/public-api",description:"Service deployments, build logs, and runtime metrics."}];function v(){const[t,o]=n.useState("overview");x();const[r,l]=n.useState(i);n.useEffect(()=>{l(i)},[]);const a=r.filter(s=>s.configured).length;return e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[e.jsx(m,{tabs:[{id:"overview",label:"Overview"},{id:"setup",label:"Setup"}],activeTab:t,onTabChange:o}),e.jsxs("div",{className:"flex-1 overflow-auto",children:[t==="overview"&&e.jsxs("div",{className:"p-5 space-y-4 max-w-3xl mx-auto w-full",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("h2",{className:"text-sm font-medium text-text-primary",children:"Platform Connections"}),e.jsxs(d,{size:"sm",variant:a>0?"green":"default",children:[a,"/",r.length," connected"]})]}),e.jsx("div",{className:"grid gap-3",children:r.map(s=>e.jsx(u,{platform:s},s.id))}),a===0&&e.jsx("div",{className:"mt-6 p-4 rounded-lg border border-border-muted bg-bg-surface",children:e.jsxs("p",{className:"text-sm text-text-muted",children:["No platforms connected yet. Switch to the"," ",e.jsx("button",{className:"text-accent hover:underline",onClick:()=>o("setup"),children:"Setup"})," ","tab to configure your deployment platforms."]})})]}),t==="setup"&&e.jsxs("div",{className:"p-5 space-y-6 max-w-3xl mx-auto w-full",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-sm font-medium text-text-primary",children:"Infrastructure Setup"}),e.jsx("p",{className:"text-sm text-text-muted",children:"Connect your deployment platforms to see deploy logs, build status, and runtime errors directly in RuntimeScope."})]}),e.jsxs("div",{className:"p-4 rounded-lg border border-border-strong bg-bg-surface space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"How it works"}),e.jsxs("ol",{className:"text-sm text-text-secondary space-y-2 list-decimal list-inside",children:[e.jsx("li",{children:"Set the required environment variables for your platform"}),e.jsx("li",{children:"Configure the platform in your RuntimeScope config file"}),e.jsx("li",{children:"Restart the collector — deploy data will appear automatically"})]})]}),e.jsxs("div",{className:"p-4 rounded-lg border border-border-strong bg-bg-surface space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Configuration"}),e.jsxs("p",{className:"text-sm text-text-muted",children:["Add platforms to ",e.jsx("code",{className:"px-1.5 py-0.5 rounded bg-bg-elevated text-text-secondary font-mono text-xs",children:"~/.runtimescope/config.json"}),":"]}),e.jsx("pre",{className:"text-xs font-mono bg-bg-elevated p-3 rounded-lg overflow-x-auto text-text-secondary",children:`{
2
2
  "infra": {
3
3
  "vercel": {
4
4
  "projectId": "prj_...",
@@ -1 +1 @@
1
- import{r as l,q as r,j as t,T as N,z as y,c as b}from"./index-DgQg-mjd.js";import{T as w}from"./topbar-DJt5eMx5.js";import{B as v}from"./badge-BGgXl2qy.js";import"./textarea-BROdxV-a.js";import{D as E}from"./detail-panel-CxidKK1j.js";import{u as I}from"./use-connected-c8-oDf2s.js";import{d as T}from"./issue-detector-CH2FjMfV.js";import{I as k}from"./info-aicvFsRA.js";const C={high:{icon:y,color:"text-red",badge:"red"},medium:{icon:N,color:"text-amber",badge:"amber"},low:{icon:k,color:"text-blue",badge:"blue"}};function $(){const[i,g]=l.useState("all"),[o,d]=l.useState(null);I();const c=r(e=>e.network),m=r(e=>e.console),x=r(e=>e.state),p=r(e=>e.renders),u=r(e=>e.performance),h=r(e=>e.database),a=l.useMemo(()=>{const e=[...c,...m,...x,...p,...u,...h];return e.length===0?[]:T(e)},[c,m,x,p,u,h]),f=l.useMemo(()=>i==="all"?a:a.filter(e=>e.severity===i),[i,a]),s=o?a.find(e=>e.id===o):null;return t.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[t.jsx(w,{tabs:[{id:"all",label:"All"},{id:"high",label:"High"},{id:"medium",label:"Medium"},{id:"low",label:"Low"}],activeTab:i,onTabChange:g}),t.jsxs("div",{className:"flex-1 flex min-h-0 overflow-hidden",children:[t.jsx("div",{className:"flex-1 overflow-y-auto",children:t.jsx("div",{className:"divide-y divide-border-muted",children:f.map(e=>{const n=C[e.severity],j=n.icon;return t.jsxs("div",{onClick:()=>d(e.id),className:b("flex items-start gap-3 px-5 py-3 cursor-pointer transition-colors hover:bg-bg-hover",o===e.id&&"bg-bg-active"),children:[t.jsx(j,{size:16,className:b("mt-0.5 shrink-0",n.color)}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-[13px] font-medium text-text-primary",children:e.title}),t.jsx(v,{variant:n.badge,size:"sm",children:e.severity})]}),t.jsx("p",{className:"text-[12px] text-text-tertiary mt-0.5 truncate",children:e.description})]}),t.jsx(v,{size:"sm",children:e.pattern})]},e.id)})})}),t.jsx(E,{open:s!==null,onClose:()=>d(null),title:s==null?void 0:s.title,subtitle:s?`${s.severity} · ${s.pattern}`:"",children:s&&t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsx("div",{children:t.jsx("p",{className:"text-[13px] text-text-secondary",children:s.description})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-medium text-text-muted uppercase tracking-wider mb-2",children:"Evidence"}),t.jsx("div",{className:"space-y-1.5",children:s.evidence.map((e,n)=>t.jsx("div",{className:"bg-bg-elevated rounded-md px-3 py-2 border border-border-muted",children:t.jsx("p",{className:"text-[12px] font-mono text-text-secondary",children:e})},n))})]}),s.suggestion&&t.jsxs("div",{className:"bg-green-muted border border-green-border rounded-md p-3",children:[t.jsx("p",{className:"text-[11px] font-medium text-green uppercase tracking-wider mb-1",children:"Suggestion"}),t.jsx("p",{className:"text-[13px] text-text-secondary",children:s.suggestion})]})]})})]})]})}export{$ as IssuesPage};
1
+ import{r as l,q as r,j as t,T as N,z as y,c as b}from"./index-CUDottTv.js";import{T as w}from"./topbar-892TvyNb.js";import{B as v}from"./badge-BOfEUuSW.js";import"./textarea-DAwdLdON.js";import{D as E}from"./detail-panel-YWSVnqP_.js";import{u as I}from"./use-connected-3Ljk-Uwv.js";import{d as T}from"./issue-detector-CH2FjMfV.js";import{I as k}from"./info-C0v7mgTM.js";const C={high:{icon:y,color:"text-red",badge:"red"},medium:{icon:N,color:"text-amber",badge:"amber"},low:{icon:k,color:"text-blue",badge:"blue"}};function $(){const[i,g]=l.useState("all"),[o,d]=l.useState(null);I();const c=r(e=>e.network),m=r(e=>e.console),x=r(e=>e.state),p=r(e=>e.renders),u=r(e=>e.performance),h=r(e=>e.database),a=l.useMemo(()=>{const e=[...c,...m,...x,...p,...u,...h];return e.length===0?[]:T(e)},[c,m,x,p,u,h]),f=l.useMemo(()=>i==="all"?a:a.filter(e=>e.severity===i),[i,a]),s=o?a.find(e=>e.id===o):null;return t.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[t.jsx(w,{tabs:[{id:"all",label:"All"},{id:"high",label:"High"},{id:"medium",label:"Medium"},{id:"low",label:"Low"}],activeTab:i,onTabChange:g}),t.jsxs("div",{className:"flex-1 flex min-h-0 overflow-hidden",children:[t.jsx("div",{className:"flex-1 overflow-y-auto",children:t.jsx("div",{className:"divide-y divide-border-muted",children:f.map(e=>{const n=C[e.severity],j=n.icon;return t.jsxs("div",{onClick:()=>d(e.id),className:b("flex items-start gap-3 px-5 py-3 cursor-pointer transition-colors hover:bg-bg-hover",o===e.id&&"bg-bg-active"),children:[t.jsx(j,{size:16,className:b("mt-0.5 shrink-0",n.color)}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-[13px] font-medium text-text-primary",children:e.title}),t.jsx(v,{variant:n.badge,size:"sm",children:e.severity})]}),t.jsx("p",{className:"text-[12px] text-text-tertiary mt-0.5 truncate",children:e.description})]}),t.jsx(v,{size:"sm",children:e.pattern})]},e.id)})})}),t.jsx(E,{open:s!==null,onClose:()=>d(null),title:s==null?void 0:s.title,subtitle:s?`${s.severity} · ${s.pattern}`:"",children:s&&t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsx("div",{children:t.jsx("p",{className:"text-[13px] text-text-secondary",children:s.description})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-medium text-text-muted uppercase tracking-wider mb-2",children:"Evidence"}),t.jsx("div",{className:"space-y-1.5",children:s.evidence.map((e,n)=>t.jsx("div",{className:"bg-bg-elevated rounded-md px-3 py-2 border border-border-muted",children:t.jsx("p",{className:"text-[12px] font-mono text-text-secondary",children:e})},n))})]}),s.suggestion&&t.jsxs("div",{className:"bg-green-muted border border-green-border rounded-md p-3",children:[t.jsx("p",{className:"text-[11px] font-medium text-green uppercase tracking-wider mb-1",children:"Suggestion"}),t.jsx("p",{className:"text-[13px] text-text-secondary",children:s.suggestion})]})]})})]})]})}export{$ as IssuesPage};
@@ -1 +1 @@
1
- import{j as e,c as d,r as m}from"./index-DgQg-mjd.js";import{C as p}from"./chevron-right-D0z93_PM.js";function h({data:t,defaultExpanded:s=!0,className:n}){return e.jsx("div",{className:d("font-mono text-[13px] leading-relaxed",n),children:e.jsx(c,{value:t,depth:0,defaultExpanded:s})})}function c({value:t,depth:s,defaultExpanded:n}){if(t===null)return e.jsx("span",{className:"text-text-muted",children:"null"});if(t===void 0)return e.jsx("span",{className:"text-text-muted",children:"undefined"});if(typeof t=="boolean")return e.jsx("span",{className:"text-purple",children:String(t)});if(typeof t=="number")return e.jsx("span",{className:"text-cyan",children:t});if(typeof t=="string")return e.jsxs("span",{className:"text-green",children:['"',t,'"']});if(Array.isArray(t))return e.jsx(l,{label:`Array(${t.length})`,depth:s,defaultExpanded:n&&s<2,bracketOpen:"[",bracketClose:"]",children:t.map((a,r)=>e.jsxs("div",{className:"flex",style:{paddingLeft:(s+1)*16},children:[e.jsxs("span",{className:"text-text-muted mr-1",children:[r,":"]}),e.jsx(c,{value:a,depth:s+1,defaultExpanded:n})]},r))});if(typeof t=="object"){const a=Object.entries(t);return e.jsx(l,{label:`{${a.length}}`,depth:s,defaultExpanded:n&&s<2,bracketOpen:"{",bracketClose:"}",children:a.map(([r,x])=>e.jsxs("div",{className:"flex",style:{paddingLeft:(s+1)*16},children:[e.jsxs("span",{className:"text-accent mr-1",children:[r,":"]}),e.jsx(c,{value:x,depth:s+1,defaultExpanded:n})]},r))})}return e.jsx("span",{className:"text-text-primary",children:String(t)})}function l({label:t,depth:s,defaultExpanded:n,bracketOpen:a,bracketClose:r,children:x}){const[i,o]=m.useState(n);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>o(!i),className:"inline-flex items-center gap-0.5 cursor-pointer hover:bg-bg-hover rounded px-0.5",children:[e.jsx(p,{size:12,className:d("text-text-muted transition-transform",i&&"rotate-90")}),e.jsx("span",{className:"text-text-muted",children:i?a:`${a}${t}${r}`})]}),i&&e.jsxs(e.Fragment,{children:[x,e.jsx("div",{style:{paddingLeft:s*16},children:e.jsx("span",{className:"text-text-muted",children:r})})]})]})}export{h as J};
1
+ import{j as e,c as d,r as m}from"./index-CUDottTv.js";import{C as p}from"./chevron-right-Df1qu9CE.js";function h({data:t,defaultExpanded:s=!0,className:n}){return e.jsx("div",{className:d("font-mono text-[13px] leading-relaxed",n),children:e.jsx(c,{value:t,depth:0,defaultExpanded:s})})}function c({value:t,depth:s,defaultExpanded:n}){if(t===null)return e.jsx("span",{className:"text-text-muted",children:"null"});if(t===void 0)return e.jsx("span",{className:"text-text-muted",children:"undefined"});if(typeof t=="boolean")return e.jsx("span",{className:"text-purple",children:String(t)});if(typeof t=="number")return e.jsx("span",{className:"text-cyan",children:t});if(typeof t=="string")return e.jsxs("span",{className:"text-green",children:['"',t,'"']});if(Array.isArray(t))return e.jsx(l,{label:`Array(${t.length})`,depth:s,defaultExpanded:n&&s<2,bracketOpen:"[",bracketClose:"]",children:t.map((a,r)=>e.jsxs("div",{className:"flex",style:{paddingLeft:(s+1)*16},children:[e.jsxs("span",{className:"text-text-muted mr-1",children:[r,":"]}),e.jsx(c,{value:a,depth:s+1,defaultExpanded:n})]},r))});if(typeof t=="object"){const a=Object.entries(t);return e.jsx(l,{label:`{${a.length}}`,depth:s,defaultExpanded:n&&s<2,bracketOpen:"{",bracketClose:"}",children:a.map(([r,x])=>e.jsxs("div",{className:"flex",style:{paddingLeft:(s+1)*16},children:[e.jsxs("span",{className:"text-accent mr-1",children:[r,":"]}),e.jsx(c,{value:x,depth:s+1,defaultExpanded:n})]},r))})}return e.jsx("span",{className:"text-text-primary",children:String(t)})}function l({label:t,depth:s,defaultExpanded:n,bracketOpen:a,bracketClose:r,children:x}){const[i,o]=m.useState(n);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>o(!i),className:"inline-flex items-center gap-0.5 cursor-pointer hover:bg-bg-hover rounded px-0.5",children:[e.jsx(p,{size:12,className:d("text-text-muted transition-transform",i&&"rotate-90")}),e.jsx("span",{className:"text-text-muted",children:i?a:`${a}${t}${r}`})]}),i&&e.jsxs(e.Fragment,{children:[x,e.jsx("div",{style:{paddingLeft:s*16},children:e.jsx("span",{className:"text-text-muted",children:r})})]})]})}export{h as J};
@@ -1,4 +1,4 @@
1
- import{j as e,c as o,G as p,T as h,A as u}from"./index-DgQg-mjd.js";import{B as s}from"./badge-BGgXl2qy.js";import{B as t,S as x}from"./textarea-BROdxV-a.js";import{C as m}from"./code-block-BfLeZt-6.js";import{D as g}from"./data-table-CxVXG3zy.js";import{M as i}from"./metric-card-BDGLEpmZ.js";import{S as n}from"./status-dot-C-xjt4D6.js";import{T as j}from"./topbar-DJt5eMx5.js";import{C as b}from"./clock-BZReVxQC.js";import{Z as v}from"./zap-BaSm59wW.js";import"./sparkline-DoDs4Mh8.js";import"./minus-CepSrXzu.js";function l({className:a,children:r,...c}){return e.jsx("kbd",{className:o("inline-flex items-center justify-center h-5 min-w-5 px-1.5","rounded border border-border-default bg-bg-elevated","font-mono text-[10px] text-text-muted",a),...c,children:r})}const f=[{name:"GetCampaigns",status:200,method:"GET",url:"/api/campaigns",duration:"85ms",size:"4.2KB"},{name:"CreateCampaign",status:201,method:"POST",url:"/api/campaigns",duration:"210ms",size:"1.1KB"},{name:"GetCharacter",status:200,method:"POST",url:"/graphql",duration:"429ms",size:"2.8KB"},{name:"DeleteCampaign",status:200,method:"DELETE",url:"/api/campaigns/42",duration:"95ms",size:"0.1KB"},{name:"NotFound",status:404,method:"GET",url:"/api/invalid",duration:"12ms",size:"0.2KB"},{name:"ServerError",status:500,method:"POST",url:"/api/process",duration:"3.2s",size:"0.5KB"},{name:"Analytics",status:200,method:"POST",url:"/mp/collect",duration:"1.2s",size:"0.3KB"}],N={red:"text-red",amber:"text-amber",blue:"text-blue",cyan:"text-cyan",green:"text-green"};function y({status:a}){const r=a>=500?"red":a>=400?"amber":a>=300?"blue":"green";return e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(n,{color:r,size:"sm"}),e.jsx("span",{className:N[r],children:a})]})}function S({method:a}){const c={GET:"green",POST:"purple",PUT:"amber",DELETE:"red",PATCH:"orange"}[a]??"default";return e.jsx(s,{variant:c,children:a})}function K(){return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(j,{title:"Component Showcase",tabs:[{id:"all",label:"All Components"},{id:"layout",label:"Layout"},{id:"data",label:"Data"}],activeTab:"all",connected:!0,showSearch:!0}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsxs("div",{className:"p-6 space-y-10 max-w-5xl",children:[e.jsx(d,{title:"Metric Cards",children:e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsx(i,{label:"Network Requests",value:"1,247",change:{value:12,label:"from last session"},icon:e.jsx(p,{size:16})}),e.jsx(i,{label:"Avg Latency",value:"145",suffix:"ms",change:{value:-8,label:"faster"},icon:e.jsx(b,{size:16})}),e.jsx(i,{label:"Renders",value:"3,423",change:{value:565,label:"regression"},icon:e.jsx(v,{size:16})}),e.jsx(i,{label:"Issues",value:"7",change:{value:0},icon:e.jsx(h,{size:16})})]})}),e.jsxs(d,{title:"Badges",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(s,{children:"Default"}),e.jsx(s,{variant:"brand",children:"Brand"}),e.jsx(s,{variant:"green",children:"Connected"}),e.jsx(s,{variant:"blue",children:"Info"}),e.jsx(s,{variant:"purple",children:"GraphQL"}),e.jsx(s,{variant:"amber",children:"Warning"}),e.jsx(s,{variant:"red",children:"Error"}),e.jsx(s,{variant:"orange",children:"Force"}),e.jsx(s,{variant:"cyan",children:"200 OK"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 mt-3",children:[e.jsx(s,{size:"sm",variant:"green",children:"sm"}),e.jsx(s,{size:"md",variant:"blue",children:"md"}),e.jsx(s,{size:"lg",variant:"purple",children:"lg"})]})]}),e.jsxs(d,{title:"Status Dots",children:[e.jsx("div",{className:"flex items-center gap-4",children:["green","blue","purple","amber","red","orange","cyan","gray","brand"].map(a=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n,{color:a,size:"md"}),e.jsx("span",{className:"text-xs text-text-secondary",children:a})]},a))}),e.jsxs("div",{className:"flex items-center gap-4 mt-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n,{color:"green",size:"lg",pulse:!0}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Pulse"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n,{color:"red",size:"lg",pulse:!0}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Error Pulse"})]})]})]}),e.jsxs(d,{title:"Buttons",children:[e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(t,{variant:"primary",children:"Primary"}),e.jsx(t,{variant:"secondary",children:"Secondary"}),e.jsx(t,{variant:"ghost",children:"Ghost"}),e.jsx(t,{variant:"danger",children:"Danger"}),e.jsx(t,{variant:"success",children:"Success"})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 mt-3",children:[e.jsx(t,{size:"sm",variant:"primary",children:"Small"}),e.jsx(t,{size:"md",variant:"primary",children:"Medium"}),e.jsx(t,{size:"lg",variant:"primary",children:"Large"}),e.jsx(t,{size:"icon",variant:"secondary",children:e.jsx(u,{size:16})})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 mt-3",children:[e.jsx(t,{variant:"primary",disabled:!0,children:"Disabled"}),e.jsx(t,{variant:"secondary",disabled:!0,children:"Disabled"})]})]}),e.jsx(d,{title:"Inputs",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4 max-w-xl",children:[e.jsx(x,{placeholder:"Search requests..."}),e.jsx(x,{placeholder:"Filter components..."})]})}),e.jsx(d,{title:"Keyboard Shortcuts",children:e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(l,{children:"⌘"}),e.jsx(l,{children:"K"}),e.jsx("span",{className:"text-xs text-text-secondary ml-1",children:"Command Palette"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(l,{children:"J"}),"/",e.jsx(l,{children:"K"}),e.jsx("span",{className:"text-xs text-text-secondary ml-1",children:"Navigate Rows"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(l,{children:"Esc"}),e.jsx("span",{className:"text-xs text-text-secondary ml-1",children:"Close Panel"})]})]})}),e.jsx(d,{title:"Code Block",children:e.jsxs("div",{className:"max-w-2xl space-y-4",children:[e.jsx(m,{language:"json",children:`{
1
+ import{j as e,c as o,G as p,T as h,A as u}from"./index-CUDottTv.js";import{B as s}from"./badge-BOfEUuSW.js";import{B as t,S as x}from"./textarea-DAwdLdON.js";import{C as m}from"./code-block-D47Pz1qB.js";import{D as g}from"./data-table-A2Iq_hk5.js";import{M as i}from"./metric-card-DE3zVnFg.js";import{S as n}from"./status-dot-C1nxHZIG.js";import{T as j}from"./topbar-892TvyNb.js";import{C as b}from"./clock-CmDPWLyG.js";import{Z as v}from"./zap-D8s7B8fi.js";import"./sparkline-BYGr_Iny.js";import"./minus-BzY257S7.js";function l({className:a,children:r,...c}){return e.jsx("kbd",{className:o("inline-flex items-center justify-center h-5 min-w-5 px-1.5","rounded border border-border-default bg-bg-elevated","font-mono text-[10px] text-text-muted",a),...c,children:r})}const f=[{name:"GetCampaigns",status:200,method:"GET",url:"/api/campaigns",duration:"85ms",size:"4.2KB"},{name:"CreateCampaign",status:201,method:"POST",url:"/api/campaigns",duration:"210ms",size:"1.1KB"},{name:"GetCharacter",status:200,method:"POST",url:"/graphql",duration:"429ms",size:"2.8KB"},{name:"DeleteCampaign",status:200,method:"DELETE",url:"/api/campaigns/42",duration:"95ms",size:"0.1KB"},{name:"NotFound",status:404,method:"GET",url:"/api/invalid",duration:"12ms",size:"0.2KB"},{name:"ServerError",status:500,method:"POST",url:"/api/process",duration:"3.2s",size:"0.5KB"},{name:"Analytics",status:200,method:"POST",url:"/mp/collect",duration:"1.2s",size:"0.3KB"}],N={red:"text-red",amber:"text-amber",blue:"text-blue",cyan:"text-cyan",green:"text-green"};function y({status:a}){const r=a>=500?"red":a>=400?"amber":a>=300?"blue":"green";return e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(n,{color:r,size:"sm"}),e.jsx("span",{className:N[r],children:a})]})}function S({method:a}){const c={GET:"green",POST:"purple",PUT:"amber",DELETE:"red",PATCH:"orange"}[a]??"default";return e.jsx(s,{variant:c,children:a})}function K(){return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(j,{title:"Component Showcase",tabs:[{id:"all",label:"All Components"},{id:"layout",label:"Layout"},{id:"data",label:"Data"}],activeTab:"all",connected:!0,showSearch:!0}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsxs("div",{className:"p-6 space-y-10 max-w-5xl",children:[e.jsx(d,{title:"Metric Cards",children:e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsx(i,{label:"Network Requests",value:"1,247",change:{value:12,label:"from last session"},icon:e.jsx(p,{size:16})}),e.jsx(i,{label:"Avg Latency",value:"145",suffix:"ms",change:{value:-8,label:"faster"},icon:e.jsx(b,{size:16})}),e.jsx(i,{label:"Renders",value:"3,423",change:{value:565,label:"regression"},icon:e.jsx(v,{size:16})}),e.jsx(i,{label:"Issues",value:"7",change:{value:0},icon:e.jsx(h,{size:16})})]})}),e.jsxs(d,{title:"Badges",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(s,{children:"Default"}),e.jsx(s,{variant:"brand",children:"Brand"}),e.jsx(s,{variant:"green",children:"Connected"}),e.jsx(s,{variant:"blue",children:"Info"}),e.jsx(s,{variant:"purple",children:"GraphQL"}),e.jsx(s,{variant:"amber",children:"Warning"}),e.jsx(s,{variant:"red",children:"Error"}),e.jsx(s,{variant:"orange",children:"Force"}),e.jsx(s,{variant:"cyan",children:"200 OK"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 mt-3",children:[e.jsx(s,{size:"sm",variant:"green",children:"sm"}),e.jsx(s,{size:"md",variant:"blue",children:"md"}),e.jsx(s,{size:"lg",variant:"purple",children:"lg"})]})]}),e.jsxs(d,{title:"Status Dots",children:[e.jsx("div",{className:"flex items-center gap-4",children:["green","blue","purple","amber","red","orange","cyan","gray","brand"].map(a=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n,{color:a,size:"md"}),e.jsx("span",{className:"text-xs text-text-secondary",children:a})]},a))}),e.jsxs("div",{className:"flex items-center gap-4 mt-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n,{color:"green",size:"lg",pulse:!0}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Pulse"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n,{color:"red",size:"lg",pulse:!0}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Error Pulse"})]})]})]}),e.jsxs(d,{title:"Buttons",children:[e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(t,{variant:"primary",children:"Primary"}),e.jsx(t,{variant:"secondary",children:"Secondary"}),e.jsx(t,{variant:"ghost",children:"Ghost"}),e.jsx(t,{variant:"danger",children:"Danger"}),e.jsx(t,{variant:"success",children:"Success"})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 mt-3",children:[e.jsx(t,{size:"sm",variant:"primary",children:"Small"}),e.jsx(t,{size:"md",variant:"primary",children:"Medium"}),e.jsx(t,{size:"lg",variant:"primary",children:"Large"}),e.jsx(t,{size:"icon",variant:"secondary",children:e.jsx(u,{size:16})})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 mt-3",children:[e.jsx(t,{variant:"primary",disabled:!0,children:"Disabled"}),e.jsx(t,{variant:"secondary",disabled:!0,children:"Disabled"})]})]}),e.jsx(d,{title:"Inputs",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4 max-w-xl",children:[e.jsx(x,{placeholder:"Search requests..."}),e.jsx(x,{placeholder:"Filter components..."})]})}),e.jsx(d,{title:"Keyboard Shortcuts",children:e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(l,{children:"⌘"}),e.jsx(l,{children:"K"}),e.jsx("span",{className:"text-xs text-text-secondary ml-1",children:"Command Palette"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(l,{children:"J"}),"/",e.jsx(l,{children:"K"}),e.jsx("span",{className:"text-xs text-text-secondary ml-1",children:"Navigate Rows"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(l,{children:"Esc"}),e.jsx("span",{className:"text-xs text-text-secondary ml-1",children:"Close Panel"})]})]})}),e.jsx(d,{title:"Code Block",children:e.jsxs("div",{className:"max-w-2xl space-y-4",children:[e.jsx(m,{language:"json",children:`{
2
2
  "accept": "application/json",
3
3
  "authorization": "[REDACTED]",
4
4
  "content-type": "application/json",
@@ -1,4 +1,4 @@
1
- import{a as A,b as c,r as i,j as e,E as M,P as $,c as d}from"./index-DgQg-mjd.js";import{B as D}from"./textarea-BROdxV-a.js";import{F as b}from"./file-text-CTqS_5sj.js";import{D as O}from"./download-OeUZzFM9.js";import{T as L}from"./trash-2-rsBJ0FiG.js";import{S as Y}from"./save-CCeVXlI4.js";/**
1
+ import{a as A,b as c,r as i,j as e,E as M,P as $,c as d}from"./index-CUDottTv.js";import{B as D}from"./textarea-DAwdLdON.js";import{F as b}from"./file-text-h8kcLd2l.js";import{D as O}from"./download-CwvkYJyJ.js";import{T as L}from"./trash-2-C4Tvwfqn.js";import{S as Y}from"./save-BGeL2PJM.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{a}from"./index-DgQg-mjd.js";/**
1
+ import{a}from"./index-CUDottTv.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{a as m,j as e,c as d}from"./index-DgQg-mjd.js";import{S as u}from"./sparkline-DoDs4Mh8.js";import{M as j}from"./minus-CepSrXzu.js";/**
1
+ import{a as m,j as e,c as d}from"./index-CUDottTv.js";import{S as u}from"./sparkline-BYGr_Iny.js";import{M as j}from"./minus-BzY257S7.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{a}from"./index-DgQg-mjd.js";/**
1
+ import{a}from"./index-CUDottTv.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{j as e,c as k,r as p,n as J,o as H,C as G,X,M as K,q as L,y as V}from"./index-DgQg-mjd.js";import{T as _}from"./topbar-DJt5eMx5.js";import{B as Y}from"./badge-BGgXl2qy.js";import"./textarea-BROdxV-a.js";import{D as Q}from"./data-table-CxVXG3zy.js";import{D as Z}from"./detail-panel-CxidKK1j.js";import{F as ee}from"./filter-bar-CCwrTxz_.js";import{S as te}from"./status-dot-C-xjt4D6.js";import{T as se}from"./tabs-yqhh6iCp.js";import{D as A}from"./download-OeUZzFM9.js";import{E as re}from"./export-button-BioZ3ot5.js";import{u as ne}from"./use-connected-c8-oDf2s.js";import{f as R,g as ae,a as le}from"./format-CF_gowqw.js";function T(t){return t>=1e3?`${(t/1e3).toFixed(2)}s`:`${Math.round(t)}ms`}function oe({segments:t,total:r,className:a}){return e.jsxs("div",{className:k("space-y-2",a),children:[e.jsx("div",{className:"h-5 flex rounded-md overflow-hidden bg-bg-elevated",children:t.map(s=>{const n=r>0?s.value/r*100:0;return n<=0?null:e.jsx("div",{style:{width:`${n}%`,backgroundColor:s.color},className:"h-full relative group",title:`${s.label}: ${T(s.value)}`,children:n>15&&e.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-[10px] font-medium text-white/80",children:T(s.value)})},s.label)})}),e.jsx("div",{className:"flex items-center gap-4",children:t.map(s=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:s.color}}),e.jsx("span",{className:"text-[11px] text-text-tertiary",children:s.label}),e.jsx("span",{className:"text-[11px] text-text-secondary tabular-nums",children:T(s.value)})]},s.label))})]})}const ie=[["PK","ZIP/Office file","xlsx"],["%PDF","PDF document","pdf"],["‰PNG","PNG image","png"],["ÿØÿ","JPEG image","jpg"],["GIF8","GIF image","gif"],["RIFF","RIFF file","webp"]];function ce(t){for(const[s,n,l]of ie)if(t.startsWith(s))return{isBinary:!0,label:n,ext:l};const r=t.slice(0,200);let a=0;for(let s=0;s<r.length;s++){const n=r.charCodeAt(s);n<32&&n!==9&&n!==10&&n!==13&&a++}return r.length>0&&a/r.length>.1?{isBinary:!0,label:"Binary data",ext:"bin"}:{isBinary:!1}}function de(t){const r=t.trimStart();if(r.startsWith("{")||r.startsWith("["))try{return JSON.parse(t),"json"}catch{}return/^\w+:["\[{$DIN]/.test(r)||r.startsWith("0:")||/\n\w+:/.test(t.slice(0,200))?"rsc":r.startsWith("<!")||r.startsWith("<html")||r.startsWith("<div")?"html":"text"}function xe(t){const r=t.split(`
1
+ import{j as e,c as k,r as p,n as J,o as H,C as G,X,M as K,q as L,y as V}from"./index-CUDottTv.js";import{T as _}from"./topbar-892TvyNb.js";import{B as Y}from"./badge-BOfEUuSW.js";import"./textarea-DAwdLdON.js";import{D as Q}from"./data-table-A2Iq_hk5.js";import{D as Z}from"./detail-panel-YWSVnqP_.js";import{F as ee}from"./filter-bar-CP39inkf.js";import{S as te}from"./status-dot-C1nxHZIG.js";import{T as se}from"./tabs-BoJRkfaU.js";import{D as A}from"./download-CwvkYJyJ.js";import{E as re}from"./export-button-D7y2ugNf.js";import{u as ne}from"./use-connected-3Ljk-Uwv.js";import{f as R,g as ae,a as le}from"./format-CF_gowqw.js";function T(t){return t>=1e3?`${(t/1e3).toFixed(2)}s`:`${Math.round(t)}ms`}function oe({segments:t,total:r,className:a}){return e.jsxs("div",{className:k("space-y-2",a),children:[e.jsx("div",{className:"h-5 flex rounded-md overflow-hidden bg-bg-elevated",children:t.map(s=>{const n=r>0?s.value/r*100:0;return n<=0?null:e.jsx("div",{style:{width:`${n}%`,backgroundColor:s.color},className:"h-full relative group",title:`${s.label}: ${T(s.value)}`,children:n>15&&e.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-[10px] font-medium text-white/80",children:T(s.value)})},s.label)})}),e.jsx("div",{className:"flex items-center gap-4",children:t.map(s=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:s.color}}),e.jsx("span",{className:"text-[11px] text-text-tertiary",children:s.label}),e.jsx("span",{className:"text-[11px] text-text-secondary tabular-nums",children:T(s.value)})]},s.label))})]})}const ie=[["PK","ZIP/Office file","xlsx"],["%PDF","PDF document","pdf"],["‰PNG","PNG image","png"],["ÿØÿ","JPEG image","jpg"],["GIF8","GIF image","gif"],["RIFF","RIFF file","webp"]];function ce(t){for(const[s,n,l]of ie)if(t.startsWith(s))return{isBinary:!0,label:n,ext:l};const r=t.slice(0,200);let a=0;for(let s=0;s<r.length;s++){const n=r.charCodeAt(s);n<32&&n!==9&&n!==10&&n!==13&&a++}return r.length>0&&a/r.length>.1?{isBinary:!0,label:"Binary data",ext:"bin"}:{isBinary:!1}}function de(t){const r=t.trimStart();if(r.startsWith("{")||r.startsWith("["))try{return JSON.parse(t),"json"}catch{}return/^\w+:["\[{$DIN]/.test(r)||r.startsWith("0:")||/\n\w+:/.test(t.slice(0,200))?"rsc":r.startsWith("<!")||r.startsWith("<html")||r.startsWith("<div")?"html":"text"}function xe(t){const r=t.split(`
2
2
  `).filter(Boolean),a=[],s=[];for(const l of r){const x=l.indexOf(":");if(x<0||x>4){s.push(l);continue}const i=l.slice(0,x),o=l.slice(x+1);if(o.startsWith("I[")){const c=o.match(/"([^"]+\.(?:tsx?|jsx?))"/),h=o.match(/,"(\w+)"\]$/);if(c){const f=c[1].split("/").pop()??c[1],y=(h==null?void 0:h[1])??"default";a.push(` ${i}: ${y} from ${f}`)}continue}if(o.startsWith('["$"'))try{const c=JSON.parse(o);if(Array.isArray(c)&&c[0]==="$"&&typeof c[1]=="string"){s.push(` ${i}: <${c[1]}> element`);continue}}catch{}if(o.startsWith("{")&&o.includes('"name"'))try{const c=JSON.parse(o);if(c.name){const h=c.env?` [${c.env}]`:"",f=c.props&&typeof c.props=="object"?` props={${Object.keys(c.props).join(", ")}}`:"";s.push(` ${i}: <${c.name}${h}>${f}`);continue}}catch{}if(!(o.startsWith("D{")&&o.includes('"time"'))){if(o.startsWith("{")||o.startsWith("["))try{const c=JSON.parse(o);s.push(` ${i}: ${JSON.stringify(c,null,2).split(`
3
3
  `).join(`
4
4
  `)}`);continue}catch{}o.length>0&&o!=="null"&&s.push(` ${i}: ${o.slice(0,200)}${o.length>200?"...":""}`)}}const n=[];return a.length>0&&n.push(`Components (${a.length}):
@@ -1,4 +1,4 @@
1
- import{a as E,b as n,r as l,j as t,P,E as b,c as D}from"./index-DgQg-mjd.js";import{B as o}from"./textarea-BROdxV-a.js";import{T as A}from"./trash-2-rsBJ0FiG.js";/**
1
+ import{a as E,b as n,r as l,j as t,P,E as b,c as D}from"./index-CUDottTv.js";import{B as o}from"./textarea-DAwdLdON.js";import{T as A}from"./trash-2-C4Tvwfqn.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{a as M,j as n,T as j,D as A,A as q,x as k,w as D,G as w,c as p,q as u,r as f}from"./index-DgQg-mjd.js";import{Z as C}from"./zap-BaSm59wW.js";import"./textarea-BROdxV-a.js";import{K as g}from"./metric-card-BDGLEpmZ.js";import{W as $}from"./wifi-omZdmnyZ.js";import{C as x}from"./clock-BZReVxQC.js";import{H as N}from"./hard-drive-DVtZVR9y.js";import{u as I}from"./use-connected-c8-oDf2s.js";import{d as L}from"./issue-detector-CH2FjMfV.js";/**
1
+ import{a as M,j as n,T as j,D as A,A as q,x as k,w as D,G as w,c as p,q as u,r as f}from"./index-CUDottTv.js";import{Z as C}from"./zap-D8s7B8fi.js";import"./textarea-DAwdLdON.js";import{K as g}from"./metric-card-DE3zVnFg.js";import{W as $}from"./wifi-B9CHDUUG.js";import{C as x}from"./clock-CmDPWLyG.js";import{H as N}from"./hard-drive-D8jrlixH.js";import{u as I}from"./use-connected-3Ljk-Uwv.js";import{d as L}from"./issue-detector-CH2FjMfV.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{j as e,c as g,r as x,q as p}from"./index-DgQg-mjd.js";import{B as f}from"./badge-BGgXl2qy.js";import"./textarea-BROdxV-a.js";import{S as v}from"./sparkline-DoDs4Mh8.js";import{E as N}from"./empty-config-state-BRw-Dnk-.js";const b={good:"var(--color-green)","needs-improvement":"var(--color-amber)",poor:"var(--color-red)"};function y({value:n,max:l,rating:d,label:a,unit:o="ms",className:m}){const s=Math.min(n/l,1),t=40,r=2*Math.PI*t,c=r*(1-s*.75),h=b[d];return e.jsxs("div",{className:g("flex flex-col items-center gap-2",m),children:[e.jsxs("div",{className:"relative w-24 h-24",children:[e.jsxs("svg",{viewBox:"0 0 100 100",className:"w-full h-full -rotate-[135deg]",children:[e.jsx("circle",{cx:"50",cy:"50",r:t,fill:"none",stroke:"var(--color-border-default)",strokeWidth:"6",strokeDasharray:`${r*.75} ${r*.25}`,strokeLinecap:"round"}),e.jsx("circle",{cx:"50",cy:"50",r:t,fill:"none",stroke:h,strokeWidth:"6",strokeDasharray:r,strokeDashoffset:c,strokeLinecap:"round",className:"transition-all duration-500"})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsx("span",{className:"text-lg font-bold text-text-primary tabular-nums",children:n}),e.jsx("span",{className:"text-[10px] text-text-muted",children:o})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:h}}),e.jsx("span",{className:"text-[11px] font-medium text-text-secondary",children:a})]})]})}const j={LCP:4e3,FCP:3e3,TTFB:800,CLS:.5,FID:300,INP:500},u={LCP:"ms",FCP:"ms",TTFB:"ms",CLS:"",FID:"ms",INP:"ms"},i={LCP:{name:"Largest Contentful Paint",description:"Measures how long it takes for the largest visible element (image, heading, or text block) to render. This is the primary metric for perceived load speed.",causes:["Large unoptimized images","Render-blocking CSS or JavaScript","Slow server response time (TTFB)","Client-side rendering delays"],goodThreshold:"< 2500ms"},FCP:{name:"First Contentful Paint",description:"Measures how long it takes for the first piece of content (text, image, or SVG) to appear on screen. Indicates when the user first sees something happening.",causes:["Render-blocking resources (CSS, JS)","Large document size","Slow DNS or TLS negotiation","No server-side rendering or prerendering"],goodThreshold:"< 1800ms"},CLS:{name:"Cumulative Layout Shift",description:"Measures visual stability — how much the page layout shifts unexpectedly while loading. A low CLS means elements don't jump around as the page renders.",causes:["Images or ads without dimensions","Dynamically injected content above the fold","Web fonts causing text reflow (FOIT/FOUT)","Late-loading CSS changing layout"],goodThreshold:"< 0.1"},TTFB:{name:"Time to First Byte",description:"Measures the time from the request to when the first byte of the response arrives. Reflects server processing speed and network latency.",causes:["Slow database queries on the server","No CDN or edge caching","Server-side computation bottlenecks","Geographic distance to the server"],goodThreshold:"< 200ms"},FID:{name:"First Input Delay",description:"Measures the delay between a user's first interaction (click, tap, key press) and the browser's response. High FID means the main thread was busy when the user tried to interact.",causes:["Heavy JavaScript execution during page load","Long tasks blocking the main thread","Third-party scripts competing for CPU","Large bundle parsing and compilation"],goodThreshold:"< 100ms"},INP:{name:"Interaction to Next Paint",description:"Measures the latency of all user interactions throughout the page's lifecycle, not just the first one. The worst interaction latency is reported. This replaced FID as a Core Web Vital in 2024.",causes:["Expensive event handlers (click, input, keydown)","Synchronous layout/style recalculation (forced reflows)","Long-running JavaScript blocking the main thread","Excessive DOM size slowing updates"],goodThreshold:"< 200ms"}};function L(){const[n,l]=x.useState("LCP"),d=p(t=>t.initialLoadDone),a=p(t=>t.performance),o=x.useMemo(()=>{if(a.length===0)return[];const t=new Map;for(const r of a){const c=t.get(r.metricName);(!c||r.timestamp>c.timestamp)&&t.set(r.metricName,r)}return Array.from(t.values())},[a]),m=x.useMemo(()=>{if(a.length===0)return{};const t={};for(const r of a)t[r.metricName]||(t[r.metricName]=[]),t[r.metricName].push(r.value);return t},[a]),s=o.find(t=>t.metricName===n);return e.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:e.jsx("div",{className:"flex-1 overflow-y-auto",children:d&&a.length===0?e.jsx(N,{title:"No Performance Data",description:"Performance tracking captures Web Vitals (LCP, FCP, CLS, TTFB, INP) and server metrics (memory, CPU, event loop lag, GC pauses).",configHints:[{key:"capturePerformance",value:"true",description:"Enable Web Vitals and server metrics"}]}):e.jsxs("div",{className:"p-6 space-y-6 max-w-6xl mx-auto w-full",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold text-text-primary mb-4",children:"Core Web Vitals"}),e.jsx("div",{className:"grid grid-cols-6 gap-4",children:o.map(t=>e.jsx("button",{onClick:()=>l(t.metricName),className:g("bg-bg-elevated border rounded-lg p-4 flex flex-col items-center transition-all cursor-pointer",n===t.metricName?"border-accent-border ring-1 ring-brand-border":"border-border-default hover:border-border-hover"),children:e.jsx(y,{value:t.metricName==="CLS"?t.value:Math.round(t.value),max:j[t.metricName],rating:t.rating,label:t.metricName,unit:u[t.metricName]})},t.metricName))})]}),s&&e.jsxs("div",{className:"bg-bg-elevated border border-border-default rounded-lg p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-[15px] font-semibold text-text-primary",children:[s.metricName," History"]}),e.jsx("p",{className:"text-[13px] text-text-tertiary mt-0.5",children:"Last 20 measurements"})]}),e.jsx(f,{variant:s.rating==="good"?"green":s.rating==="needs-improvement"?"amber":"red",children:s.rating})]}),e.jsx(v,{data:m[s.metricName]||[],width:700,height:80,color:s.rating==="good"?"var(--color-green)":s.rating==="needs-improvement"?"var(--color-amber)":"var(--color-red)"}),e.jsxs("div",{className:"mt-4 flex items-center gap-6 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"Current: "}),e.jsxs("span",{className:"text-text-primary font-medium tabular-nums",children:[s.value,u[s.metricName]]})]}),s.element&&e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"Element: "}),e.jsx("span",{className:"text-text-secondary font-mono text-[13px]",children:s.element})]})]})]}),s&&i[s.metricName]&&e.jsxs("div",{className:"bg-bg-elevated border border-border-default rounded-lg p-5",children:[e.jsx("div",{className:"flex items-start justify-between gap-4 mb-3",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-[15px] font-semibold text-text-primary",children:i[s.metricName].name}),e.jsxs("span",{className:"text-[11px] text-text-tertiary",children:["Good: ",i[s.metricName].goodThreshold]})]})}),e.jsx("p",{className:"text-[13px] text-text-secondary leading-relaxed mb-4",children:i[s.metricName].description}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-text-muted uppercase tracking-wider mb-2",children:"Common causes of poor scores"}),e.jsx("ul",{className:"space-y-1.5",children:i[s.metricName].causes.map(t=>e.jsxs("li",{className:"flex items-start gap-2 text-[13px] text-text-secondary",children:[e.jsx("span",{className:"text-text-tertiary mt-0.5 shrink-0",children:"•"}),t]},t))})]})]})]})})})}export{L as PerformancePage};
1
+ import{j as e,c as g,r as x,q as p}from"./index-CUDottTv.js";import{B as f}from"./badge-BOfEUuSW.js";import"./textarea-DAwdLdON.js";import{S as v}from"./sparkline-BYGr_Iny.js";import{E as N}from"./empty-config-state-ReVUjdJ_.js";const b={good:"var(--color-green)","needs-improvement":"var(--color-amber)",poor:"var(--color-red)"};function y({value:n,max:l,rating:d,label:a,unit:o="ms",className:m}){const s=Math.min(n/l,1),t=40,r=2*Math.PI*t,c=r*(1-s*.75),h=b[d];return e.jsxs("div",{className:g("flex flex-col items-center gap-2",m),children:[e.jsxs("div",{className:"relative w-24 h-24",children:[e.jsxs("svg",{viewBox:"0 0 100 100",className:"w-full h-full -rotate-[135deg]",children:[e.jsx("circle",{cx:"50",cy:"50",r:t,fill:"none",stroke:"var(--color-border-default)",strokeWidth:"6",strokeDasharray:`${r*.75} ${r*.25}`,strokeLinecap:"round"}),e.jsx("circle",{cx:"50",cy:"50",r:t,fill:"none",stroke:h,strokeWidth:"6",strokeDasharray:r,strokeDashoffset:c,strokeLinecap:"round",className:"transition-all duration-500"})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsx("span",{className:"text-lg font-bold text-text-primary tabular-nums",children:n}),e.jsx("span",{className:"text-[10px] text-text-muted",children:o})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:h}}),e.jsx("span",{className:"text-[11px] font-medium text-text-secondary",children:a})]})]})}const j={LCP:4e3,FCP:3e3,TTFB:800,CLS:.5,FID:300,INP:500},u={LCP:"ms",FCP:"ms",TTFB:"ms",CLS:"",FID:"ms",INP:"ms"},i={LCP:{name:"Largest Contentful Paint",description:"Measures how long it takes for the largest visible element (image, heading, or text block) to render. This is the primary metric for perceived load speed.",causes:["Large unoptimized images","Render-blocking CSS or JavaScript","Slow server response time (TTFB)","Client-side rendering delays"],goodThreshold:"< 2500ms"},FCP:{name:"First Contentful Paint",description:"Measures how long it takes for the first piece of content (text, image, or SVG) to appear on screen. Indicates when the user first sees something happening.",causes:["Render-blocking resources (CSS, JS)","Large document size","Slow DNS or TLS negotiation","No server-side rendering or prerendering"],goodThreshold:"< 1800ms"},CLS:{name:"Cumulative Layout Shift",description:"Measures visual stability — how much the page layout shifts unexpectedly while loading. A low CLS means elements don't jump around as the page renders.",causes:["Images or ads without dimensions","Dynamically injected content above the fold","Web fonts causing text reflow (FOIT/FOUT)","Late-loading CSS changing layout"],goodThreshold:"< 0.1"},TTFB:{name:"Time to First Byte",description:"Measures the time from the request to when the first byte of the response arrives. Reflects server processing speed and network latency.",causes:["Slow database queries on the server","No CDN or edge caching","Server-side computation bottlenecks","Geographic distance to the server"],goodThreshold:"< 200ms"},FID:{name:"First Input Delay",description:"Measures the delay between a user's first interaction (click, tap, key press) and the browser's response. High FID means the main thread was busy when the user tried to interact.",causes:["Heavy JavaScript execution during page load","Long tasks blocking the main thread","Third-party scripts competing for CPU","Large bundle parsing and compilation"],goodThreshold:"< 100ms"},INP:{name:"Interaction to Next Paint",description:"Measures the latency of all user interactions throughout the page's lifecycle, not just the first one. The worst interaction latency is reported. This replaced FID as a Core Web Vital in 2024.",causes:["Expensive event handlers (click, input, keydown)","Synchronous layout/style recalculation (forced reflows)","Long-running JavaScript blocking the main thread","Excessive DOM size slowing updates"],goodThreshold:"< 200ms"}};function L(){const[n,l]=x.useState("LCP"),d=p(t=>t.initialLoadDone),a=p(t=>t.performance),o=x.useMemo(()=>{if(a.length===0)return[];const t=new Map;for(const r of a){const c=t.get(r.metricName);(!c||r.timestamp>c.timestamp)&&t.set(r.metricName,r)}return Array.from(t.values())},[a]),m=x.useMemo(()=>{if(a.length===0)return{};const t={};for(const r of a)t[r.metricName]||(t[r.metricName]=[]),t[r.metricName].push(r.value);return t},[a]),s=o.find(t=>t.metricName===n);return e.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:e.jsx("div",{className:"flex-1 overflow-y-auto",children:d&&a.length===0?e.jsx(N,{title:"No Performance Data",description:"Performance tracking captures Web Vitals (LCP, FCP, CLS, TTFB, INP) and server metrics (memory, CPU, event loop lag, GC pauses).",configHints:[{key:"capturePerformance",value:"true",description:"Enable Web Vitals and server metrics"}]}):e.jsxs("div",{className:"p-6 space-y-6 max-w-6xl mx-auto w-full",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold text-text-primary mb-4",children:"Core Web Vitals"}),e.jsx("div",{className:"grid grid-cols-6 gap-4",children:o.map(t=>e.jsx("button",{onClick:()=>l(t.metricName),className:g("bg-bg-elevated border rounded-lg p-4 flex flex-col items-center transition-all cursor-pointer",n===t.metricName?"border-accent-border ring-1 ring-brand-border":"border-border-default hover:border-border-hover"),children:e.jsx(y,{value:t.metricName==="CLS"?t.value:Math.round(t.value),max:j[t.metricName],rating:t.rating,label:t.metricName,unit:u[t.metricName]})},t.metricName))})]}),s&&e.jsxs("div",{className:"bg-bg-elevated border border-border-default rounded-lg p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-[15px] font-semibold text-text-primary",children:[s.metricName," History"]}),e.jsx("p",{className:"text-[13px] text-text-tertiary mt-0.5",children:"Last 20 measurements"})]}),e.jsx(f,{variant:s.rating==="good"?"green":s.rating==="needs-improvement"?"amber":"red",children:s.rating})]}),e.jsx(v,{data:m[s.metricName]||[],width:700,height:80,color:s.rating==="good"?"var(--color-green)":s.rating==="needs-improvement"?"var(--color-amber)":"var(--color-red)"}),e.jsxs("div",{className:"mt-4 flex items-center gap-6 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"Current: "}),e.jsxs("span",{className:"text-text-primary font-medium tabular-nums",children:[s.value,u[s.metricName]]})]}),s.element&&e.jsxs("div",{children:[e.jsx("span",{className:"text-text-muted",children:"Element: "}),e.jsx("span",{className:"text-text-secondary font-mono text-[13px]",children:s.element})]})]})]}),s&&i[s.metricName]&&e.jsxs("div",{className:"bg-bg-elevated border border-border-default rounded-lg p-5",children:[e.jsx("div",{className:"flex items-start justify-between gap-4 mb-3",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-[15px] font-semibold text-text-primary",children:i[s.metricName].name}),e.jsxs("span",{className:"text-[11px] text-text-tertiary",children:["Good: ",i[s.metricName].goodThreshold]})]})}),e.jsx("p",{className:"text-[13px] text-text-secondary leading-relaxed mb-4",children:i[s.metricName].description}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-text-muted uppercase tracking-wider mb-2",children:"Common causes of poor scores"}),e.jsx("ul",{className:"space-y-1.5",children:i[s.metricName].causes.map(t=>e.jsxs("li",{className:"flex items-start gap-2 text-[13px] text-text-secondary",children:[e.jsx("span",{className:"text-text-tertiary mt-0.5 shrink-0",children:"•"}),t]},t))})]})]})]})})})}export{L as PerformancePage};