pi-mega-compact 0.15.2 → 0.15.3
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.
- package/extensions/dashboard-client/dist/assets/{AreaChart-D0hDLKC1.js → AreaChart-CMri0vM1.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{AreaChart-D0hDLKC1.js.map → AreaChart-CMri0vM1.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{BarChart-DSbTWZTQ.js → BarChart-BbkxxSkM.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{BarChart-DSbTWZTQ.js.map → BarChart-BbkxxSkM.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{CacheTab-Bgt2Wuar.js → CacheTab-CiHS6tod.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{CacheTab-Bgt2Wuar.js.map → CacheTab-CiHS6tod.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{EventsTab-CBb7O-6M.js → EventsTab-NnD7EpRm.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{EventsTab-CBb7O-6M.js.map → EventsTab-NnD7EpRm.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{HealthTab-BFMHwnlg.js → HealthTab-Dlt7WTh7.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{HealthTab-BFMHwnlg.js.map → HealthTab-Dlt7WTh7.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-DxIQyeh-.js → MaintenanceTab-DgKBZmdD.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-DxIQyeh-.js.map → MaintenanceTab-DgKBZmdD.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-C576-nmM.js → MemoryMapTab-SwTOzuZW.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-C576-nmM.js.map → MemoryMapTab-SwTOzuZW.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MetricsTab-vk8Nqg7k.js → MetricsTab-CWEgBTx0.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MetricsTab-vk8Nqg7k.js.map → MetricsTab-CWEgBTx0.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{OverviewTab-BVaddBS4.js → OverviewTab-B0YDSSMH.js} +4 -4
- package/extensions/dashboard-client/dist/assets/{OverviewTab-BVaddBS4.js.map → OverviewTab-B0YDSSMH.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{ReposTab-CLCd-Gfd.js → ReposTab-CMKZ_a4B.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ReposTab-CLCd-Gfd.js.map → ReposTab-CMKZ_a4B.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SessionsTab-CV_qDKZB.js → SessionsTab-D2cCDKB3.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SessionsTab-CV_qDKZB.js.map → SessionsTab-D2cCDKB3.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SetupTab-BuIwk7LZ.js → SetupTab-HUAG7xDf.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SetupTab-BuIwk7LZ.js.map → SetupTab-HUAG7xDf.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-BS5-w4mP.js → TimeSavedCard-NFCsyJhB.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-BS5-w4mP.js.map → TimeSavedCard-NFCsyJhB.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TurnsTab-DhgjZmEQ.js → TurnsTab-BY7_AZaG.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TurnsTab-DhgjZmEQ.js.map → TurnsTab-BY7_AZaG.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{WikiTab-CmOAaPnM.js → WikiTab-MbmjqKVQ.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{WikiTab-CmOAaPnM.js.map → WikiTab-MbmjqKVQ.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{button-DyV48WDX.js → button-CoVmU9Vr.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{button-DyV48WDX.js.map → button-CoVmU9Vr.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{card-CfCQ36pG.js → card-Cp9Hpdoo.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{card-CfCQ36pG.js.map → card-Cp9Hpdoo.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-CGlLggNu.js → generateCategoricalChart-CMM8OUO5.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-CGlLggNu.js.map → generateCategoricalChart-CMM8OUO5.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{index-tPP7N38D.js → index-CRHmWnRi.js} +3 -3
- package/extensions/dashboard-client/dist/assets/{index-tPP7N38D.js.map → index-CRHmWnRi.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{switch-7461qYip.js → switch-jrYrJJYy.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{switch-7461qYip.js.map → switch-jrYrJJYy.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{toggle-CHyUS1MH.js → toggle-DT1AN5wS.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{toggle-CHyUS1MH.js.map → toggle-DT1AN5wS.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{useSSE-CPIU9hax.js → useSSE-rJH_Rx6K.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{useSSE-CPIU9hax.js.map → useSSE-rJH_Rx6K.js.map} +1 -1
- package/extensions/dashboard-client/dist/index.html +1 -1
- package/extensions/dashboard-client/src/tabs/OverviewTab.tsx +20 -11
- package/package.json +1 -1
package/extensions/dashboard-client/dist/assets/{OverviewTab-BVaddBS4.js → OverviewTab-B0YDSSMH.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as cn,j as r,u as dn,r as l,f as Gn,R as U,a as _e,b as Yn,d as Vn,B as qn,N as Jn}from"./index-
|
|
1
|
+
import{c as cn,j as r,u as dn,r as l,f as Gn,R as U,a as _e,b as Yn,d as Vn,B as qn,N as Jn}from"./index-CRHmWnRi.js";import{u as Qn}from"./useSSE-rJH_Rx6K.js";import{C as we,a as Ae,b as Le,c as ye}from"./card-Cp9Hpdoo.js";import{f as De,a as Gt}from"./format-COjDIVGj.js";import{T as Zn,C as er}from"./TimeSavedCard-NFCsyJhB.js";import{R as un,C as fn,X as hn,Y as gn,T as pn,L as tr,B as nr}from"./generateCategoricalChart-CMM8OUO5.js";import{L as rr,B as sr}from"./BarChart-BbkxxSkM.js";/**
|
|
2
2
|
* @license lucide-react v0.400.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -8,9 +8,9 @@ import{c as cn,j as r,u as dn,r as l,f as Gn,R as U,a as _e,b as Yn,d as Vn,B as
|
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const ir=cn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),xt=["#58a6ff","#3fb950","#d29922","#f85149","#bc8cff","#ff7b72","#79c0ff","#56d4dd","#e3b341","#a5d6ff","#7ee787","#ffa657"];function ar(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)>>>0;return t}function lr(e){return e?xt[ar(e)%xt.length]:xt[0]}function cr(e){if(!e)return"(unknown)";const t=e.replace(/[\\/]+$/,"");if(!t)return"(unknown)";const n=t.split(/[\\/]/);return n[n.length-1]||t}function dr(e){const t=new Map;for(const i of e){const a=i.repoRoot??"__null__",c=i.tokens??0,d=t.get(a);if(d)d.tokens+=c;else{const u=cr(i.repoRoot);t.set(a,{repoRoot:i.repoRoot,basename:u,tokens:c,color:lr(u)})}}const n=[...t.values()],s=n.reduce((i,a)=>i+a.tokens,0),o=e.reduce((i,a)=>Math.max(i,a.ctxWindow),0);return{repos:n,totalTokens:s,maxWindow:o,sessionCount:e.length}}function bt(e){return e>=1e5?`${(e/1e3).toFixed(0)}k`:e.toLocaleString()}function rt({children:e}){return r.jsxs(we,{className:"electric-hover",children:[r.jsx(Ae,{children:r.jsx(Le,{children:"Context per Repo (live)"})}),r.jsx(ye,{children:e})]})}function ur({sessions:e,loading:t,error:n}){if(n)return r.jsx(rt,{children:r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Error loading sessions: ",n.message]})});if(t&&!e)return r.jsx(rt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading sessions…"})});const s=e?.sessions??[],{repos:o,totalTokens:i,maxWindow:a,sessionCount:c}=dr(s);if(o.length===0)return r.jsx(rt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:"No active sessions."})});const d=a>0?Math.round(i/a*100):0;return r.jsxs(rt,{children:[r.jsx("div",{className:"repo-stack-bar",role:"group","aria-label":"Per-repo context usage",children:o.map(u=>{const f=i>0?u.tokens/i*100:0,h=i>0?f:0,g=`${u.basename}: ${bt(u.tokens)} tokens (${f.toFixed(1)}% of total)`;return r.jsx("div",{className:"repo-stack-segment",style:{width:`${Math.max(h,.5)}%`,backgroundColor:u.color},title:g,"aria-label":g},u.repoRoot??"__null__")})}),r.jsxs("p",{className:"repo-stack-total",children:[bt(i)," tokens across ",o.length," ",o.length===1?"repo":"repos"," /"," ",c," ",c===1?"session":"sessions"," ",r.jsxs("span",{className:"pct",children:["— ",d,"% of combined max window"]})]}),r.jsx("div",{className:"repo-stack-legend",children:o.map(u=>{const f=i>0?u.tokens/i*100:0;return r.jsxs("div",{className:"repo-stack-legend-item",children:[r.jsx("span",{className:"repo-stack-legend-swatch",style:{backgroundColor:u.color}}),r.jsx("span",{className:"repo-stack-legend-name",children:u.basename}),r.jsxs("span",{children:[bt(u.tokens)," (",f.toFixed(0),"%)"]})]},u.repoRoot??"__null__")})})]})}function fr(e){return e>=90?"gauge-red":e>=70?"gauge-yellow":"gauge-green"}function hr(e){return e==null?"?":e>=1e5?`${(e/1e3).toFixed(0)}k`:e.toLocaleString()}function gr(e){if(!e)return"(unknown)";const t=e.replace(/[\\/]+$/,"");if(!t)return"(unknown)";const n=t.split(/[\\/]/);return n[n.length-1]||t}function pr(e){const t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s ago`;const n=Math.floor(t/60);return n<60?`${n}m ago`:`${Math.floor(n/60)}h ${n%60}m ago`}function mr({data:e}){const t=e.percent??0,n=Math.max(t,1),s=fr(t),o=hr(e.tokens),i=e.contextWindow.toLocaleString(),a=`${o} / ${i} tokens`;return r.jsxs("div",{className:`session-gauge ${e.isSelf?"session-gauge-self":""}`,children:[r.jsxs("div",{className:"session-gauge-head",children:[r.jsx("span",{className:"session-gauge-label truncate",title:e.label,children:e.label}),r.jsxs("span",{className:"session-gauge-pct",children:[t,"%"]})]}),r.jsx("div",{className:`gauge-bar ${s}`,role:"meter","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,"aria-label":`${e.label}: ${t}%`,children:r.jsx("div",{className:"gauge-fill",style:{width:`${n}%`}})}),r.jsx("p",{className:"gauge-label session-gauge-sub",children:a}),e.sublabel&&r.jsx("p",{className:"session-gauge-meta truncate",title:e.sublabel,children:e.sublabel})]})}function vr({sessions:e,loading:t,error:n,launcherSessionId:s,launcher:o}){const i=Date.now(),a=[{key:"self",label:"this session",sublabel:"",tokens:o.tokens,percent:o.percent,contextWindow:o.contextWindow,isSelf:!0}],c=(e?.sessions??[]).filter(g=>g.sessionId!==s);c.sort((g,p)=>p.lastSeen-g.lastSeen);const d=new Set,u=c.filter(g=>g.tokens==null&&g.percent==null||d.has(g.pid)?!1:(d.add(g.pid),!0));for(const g of u)a.push({key:g.sessionId,label:gr(g.repoRoot),sublabel:`pid ${g.pid} · ${pr(i-g.lastSeen)}${g.model?` · ${g.model}`:""}`,tokens:g.tokens,percent:g.percent,contextWindow:g.ctxWindow||0,isSelf:!1});const f=n&&!e,h=t&&!e;return r.jsxs(we,{className:"electric-hover session-gauges-card w-full",children:[r.jsx(Ae,{children:r.jsx(Le,{children:"Context per Session (live)"})}),r.jsx(ye,{children:f?r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Error loading sessions: ",n.message]}):h?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading sessions…"}):r.jsx("div",{className:"session-gauges-scroll",children:r.jsx("div",{className:"session-gauges-grid",children:a.map(g=>r.jsx(mr,{data:g},g.key))})})})]})}function Yt({state:e,label:t}){const n=e==="on"?"bullet-on":e==="na"?"bullet-na":"bullet-off";return r.jsxs("div",{className:`bullet ${n}`,children:[r.jsx("span",{className:"bullet-dot","aria-hidden":"true"}),r.jsx("span",{className:"bullet-label",children:t})]})}function xr({armed:e,ready:t}){const n=e?"on":"off",s=t?"on":e?"off":"na",o=t?"THRESHOLD EXCEEDED — compacting next event":e?"past fast gate — monitoring token count":"idle — below fast gate";return r.jsxs("div",{className:"card trigger-status",children:[r.jsx("h3",{children:"Trigger Status"}),r.jsxs("div",{className:"bullet-row",children:[r.jsx(Yt,{state:n,label:"Armed"}),r.jsx(Yt,{state:s,label:"Ready"})]}),r.jsx("p",{className:"trigger-state-text",children:o})]})}function br(e){return e>=.9?"meter-green":e>=.6?"meter-yellow":"meter-red"}function fe({label:e,value:t,title:n}){return r.jsxs("div",{className:"ov-stat-row",children:[r.jsx("span",{className:"ov-stat-label",title:n,children:e}),r.jsx("span",{className:"ov-stat-value",children:t})]})}function wr(e){const t=e.compressionPct,n=br(t),s=Math.max(t*100,.5),o=`${Ce(t)} tokens saved · dedup: ${Ce(e.dedupPct)}`;return r.jsxs("div",{className:"card vector-store-card",children:[r.jsx("h3",{children:"Vector Store (session)"}),r.jsx(fe,{label:"Checkpoints",value:e.checkpointCount.toLocaleString(),title:"A saved summary of a chunk of your conversation that was compacted to free up space."}),r.jsx(fe,{label:"Original (dropped)",value:e.tokensIn.toLocaleString(),title:"Total size of the original conversation text dropped into compaction this session, including redundant regions skipped by dedup. This is the 'in'."}),r.jsx(fe,{label:"Kept (summaries)",value:e.tokensOut.toLocaleString(),title:"Compact summaries we are currently holding as 'memory' for this session (the 'out'). Smaller is better."}),r.jsx(fe,{label:"Freed",value:e.tokensFreed.toLocaleString(),title:"Conversation space freed = dropped − kept (the 'saved')."}),r.jsx(fe,{label:"Injected",value:e.injectedCount,title:"How many times old context was automatically brought back into the conversation because it was relevant to what you were doing."}),r.jsx(fe,{label:"Recall Relevance",value:Ce(e.dedupHitRate),title:"Of the times we recalled old context, how often it was actually on-topic."}),r.jsx(fe,{label:"Storage Dedup",value:Ce(e.storageDedupRate),title:"How often new content matched something we already had, so we skipped storing a duplicate copy. Higher = less wasted space."}),r.jsx(fe,{label:"Collapsed",value:e.dedupCollapsed,title:"How many duplicate chunks we collapsed into one instead of storing separately."}),r.jsx(fe,{label:"Last ID",value:e.lastCheckpointId??"—",title:"The ID of the most recent saved checkpoint."}),r.jsxs("div",{className:"ov-compression-meter",children:[r.jsx("div",{className:"meter-track",children:r.jsx("div",{className:`meter-fill ${n}`,style:{width:`${s}%`}})}),r.jsx("span",{className:"meter-sub",children:o})]})]})}function yr(e){return e>=.9?"meter-green":e>=.6?"meter-yellow":"meter-red"}function je({label:e,value:t}){return r.jsxs("div",{className:"flex items-baseline justify-between border-b border-border py-1 text-sm",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:e}),r.jsx("span",{className:"font-semibold",children:t})]})}function jr(e){const t=e.compressionPct,n=yr(t),s=Math.max(t*100,.5),o=`${Ce(t)} tokens saved · dedup: ${Ce(e.dedupPct)}`;return r.jsxs(we,{className:"electric-hover",children:[r.jsx(Ae,{children:r.jsx(Le,{children:"Repo (all sessions)"})}),r.jsxs(ye,{children:[r.jsx(je,{label:"Checkpoints",value:e.checkpointCount.toLocaleString()}),r.jsx(je,{label:"Original",value:e.tokensIn.toLocaleString()}),r.jsx(je,{label:"Kept",value:e.tokensOut.toLocaleString()}),r.jsx(je,{label:"Freed",value:e.tokensFreed.toLocaleString()}),r.jsx(je,{label:"Sessions",value:e.sessionCount.toLocaleString()}),r.jsx(je,{label:"Collapsed",value:e.dedupCollapsed}),r.jsx(je,{label:"Storage Dedup",value:Ce(e.storageDedupRate)}),r.jsxs("div",{children:[r.jsx("div",{className:"mt-2 h-2 w-full overflow-hidden rounded-full bg-bg-elevated",children:r.jsx("div",{className:`meter-fill h-full ${n}`,style:{width:`${s}%`}})}),r.jsx("span",{className:"mt-1 block text-xs text-muted-foreground",children:o})]})]})]})}function Sr(e){return r.jsxs("div",{className:"card data-safety-card",children:[r.jsx("h3",{children:"🛡 Data Safety"}),r.jsxs("div",{className:"ov-stat-row",children:[r.jsx("span",{className:"ov-stat-label",children:"Regions Retained"}),r.jsx("span",{className:"ov-stat-value",children:e.regionsRetained.toLocaleString()})]}),r.jsxs("div",{className:"ov-stat-row",children:[r.jsx("span",{className:"ov-stat-label",children:"Compressed-Original"}),r.jsx("span",{className:"ov-stat-value",children:Gt(e.compressedOriginalBytes)})]}),r.jsxs("div",{className:"ov-stat-row",children:[r.jsx("span",{className:"ov-stat-label",children:"Dedup Duplicates"}),r.jsx("span",{className:"ov-stat-value",children:e.duplicatesCollapsed.toLocaleString()})]}),r.jsxs("div",{className:"ov-stat-row",children:[r.jsx("span",{className:"ov-stat-label",children:"Permanently Deleted"}),r.jsx("span",{className:"ov-stat-value ov-value-ok",children:Gt(e.bytesPermanentlyDeleted)})]}),r.jsx("p",{className:"safe-note",children:'Every compacted region is kept verbatim (compressed). "Drop" = removed from the live window only. We never delete your data.'})]})}function Se({label:e,value:t,title:n}){return r.jsxs("div",{className:"ov-stat-row",children:[r.jsx("span",{className:"ov-stat-label",title:n,children:e}),r.jsx("span",{className:"ov-stat-value",children:t})]})}function Cr(e){const t=`${Math.round((e.pressure??0)*100)}%`;let n=e.thresholdTokens.toLocaleString();return e.tierPct!=null&&e.contextWindow>0&&(n+=` (${Math.round(e.tierPct*100)}% of ${e.contextWindow.toLocaleString()})`),r.jsxs("div",{className:"card config-summary-card",children:[r.jsx("h3",{children:"Configuration"}),r.jsx(Se,{label:"Tier",value:`${e.tier} (live)`,title:"Live pressure band — climbs low→mega as context fills the window."}),r.jsx(Se,{label:"Preset",value:e.presetTier,title:"The env-resolved base compaction preset (low/medium/high/ultra/mega) that set the token threshold."}),r.jsx(Se,{label:"Pressure",value:t,title:"Live pressure = currentTokens / threshold — % of the model context window (threshold fires at the tier's % of window)."}),r.jsx(Se,{label:"Threshold",value:n,title:"Compaction threshold = tierPct × model context window — mega-compact trims BELOW pi's native ~80% auto-compact for any model size."}),r.jsx(Se,{label:"Fast Gate",value:`${e.fastGatePct}%`,title:"Fast-gate arming floor — the live trim arms once context passes this % of the window."}),r.jsx(Se,{label:"Auto",value:e.auto?"enabled":"disabled"}),r.jsx(Se,{label:"Anchor",value:String(e.anchorUserMessages)})]})}function st({label:e,value:t,title:n}){return r.jsxs("div",{className:"flex items-baseline justify-between border-b border-border py-1 text-sm",children:[r.jsx("span",{className:"text-xs text-muted-foreground",title:n,children:e}),r.jsx("span",{className:"font-semibold",children:t})]})}function Dr(e){const t=e.repoTokensFreed||0;let n=0,s="0";if(e.inputRate&&t>0){n=t*e.inputRate;const a=e.contextWindow||0;s=a>0?(t/a).toFixed(1):"0"}const o=`≈ $${n.toFixed(4)} saved`,i=`${s} context-windows extended`;return r.jsxs(we,{className:"electric-hover",children:[r.jsx(Ae,{children:r.jsx(Le,{children:"💰 Model & Cost Savings"})}),r.jsxs(ye,{children:[r.jsx("div",{className:"text-neon text-xl font-semibold",children:o}),r.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:i}),r.jsx(st,{label:"Model",value:e.name,title:"The model pi is currently using — its pricing drives the cost figure."}),r.jsx(st,{label:"Provider",value:e.provider,title:"The provider serving the model."}),r.jsx(st,{label:"Input Rate",value:`$${e.inputRate.toFixed(6)}`,title:"USD per input token, from the model's pricing."}),r.jsx(st,{label:"Output Rate",value:`$${e.outputRate.toFixed(6)}`,title:"USD per output token, from the model's pricing."})]})]})}function Rr(e){const{activeAgents:t,currentTurn:n}=e,s=t>0?`▶ ${t} running`:"idle";return r.jsxs(we,{className:"electric-hover",children:[r.jsx(Ae,{children:r.jsx(Le,{children:"Crew / Agents"})}),r.jsxs(ye,{children:[r.jsxs("div",{className:"flex items-baseline justify-between border-b border-border py-1 text-sm",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Active Agents"}),r.jsx("span",{className:"font-semibold",children:t})]}),r.jsxs("div",{className:"flex items-baseline justify-between border-b border-border py-1 text-sm",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Current Turn"}),r.jsx("span",{className:"font-semibold",children:n})]}),r.jsxs("div",{className:"flex items-baseline justify-between py-1 text-sm",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Status"}),r.jsx("span",{className:"font-semibold",children:s})]})]})]})}const kr=[r.jsxs("li",{children:[r.jsx("b",{children:"Original (dropped)"}),' — everything compacted away (including duplicates caught by dedup). The "in."']},"1"),r.jsxs("li",{children:[r.jsx("b",{children:"Kept (summaries)"}),' — compact summaries still held as "memory" (the "out").']},"2"),r.jsxs("li",{children:[r.jsx("b",{children:"Freed"})," = dropped − kept — tokens saved so far (higher = better)."]},"3"),r.jsxs("li",{children:[r.jsx("b",{children:"Compression %"})," — Freed ÷ Dropped — the headline efficiency number. Higher = more space reclaimed."]},"4"),r.jsxs("li",{children:[r.jsx("b",{children:"Storage dedup %"})," — how often new content matched something already saved, so no duplicate copy was written."]},"5"),r.jsxs("li",{children:[r.jsx("b",{children:"Data safety"})," — every compacted region is kept verbatim (compressed). Nothing is permanently deleted; you can restore any of it."]},"6")];function Nr(){return r.jsx(we,{children:r.jsx(ye,{children:r.jsxs("details",{children:[r.jsx("summary",{className:"cursor-pointer text-sm font-semibold",children:"What these numbers mean"}),r.jsx("ol",{className:"mt-2 list-decimal space-y-1 pl-5 text-sm",children:kr}),r.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Hover any label above for a quick explanation."})]})})})}const Er=()=>{const{data:e}=dn(l.useMemo(()=>()=>Gn(),[]),{pollInterval:3e4});if(!e)return r.jsx(we,{children:r.jsx(ye,{className:"text-sm text-muted-foreground",children:"Loading RAG health…"})});const{totals:t,flags:n}=e,s=n.hydeEnabled||n.recallMetricsEnabled;return r.jsxs(we,{children:[r.jsx(Ae,{children:r.jsxs(Le,{className:"flex items-center gap-2",children:[r.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${s?"bg-success":"bg-muted-foreground"}`,"aria-hidden":"true"}),"RAG Health"]})}),r.jsx(ye,{children:s?r.jsxs("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs text-muted-foreground",children:"Pass rate"}),r.jsxs("dd",{className:"font-semibold text-foreground",children:[Math.round(t.recentPassRate*100),"%"]})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs text-muted-foreground",children:"Avg lift"}),r.jsxs("dd",{className:"font-semibold text-foreground",children:[t.avgLift.toFixed(2),"×"]})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs text-muted-foreground",children:"Telemetry turns"}),r.jsx("dd",{className:"font-semibold text-foreground",children:t.telemetryTurns})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs text-muted-foreground",children:"HyDE ran"}),r.jsx("dd",{className:"font-semibold text-foreground",children:t.hydeRanTurns})]})]}):r.jsx("div",{className:"text-sm text-muted-foreground",children:"All RAG recall feature flags are off."})})]})};function ot({title:e,open:t,onClose:n,children:s}){return l.useEffect(()=>{if(!t)return;const o=i=>{i.key==="Escape"&&n()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t,n]),t?r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:n,role:"dialog","aria-modal":"true","aria-label":e,children:r.jsxs("div",{className:"max-h-[80vh] w-full max-w-3xl overflow-y-auto rounded-lg border border-border bg-bg-card p-5",onClick:o=>o.stopPropagation(),children:[r.jsxs("header",{className:"mb-4 flex items-center justify-between gap-4",children:[r.jsx("h2",{className:"font-heading text-lg font-semibold",children:e}),r.jsx("button",{type:"button",className:"text-muted-foreground transition-colors hover:text-foreground",onClick:n,"aria-label":"Close",children:r.jsx(ir,{size:22,strokeWidth:2})})]}),s]})}):r.jsx(r.Fragment,{})}const wt="#8b949e",Tr="#30363d",Mr={background:"#161b22",border:"1px solid #30363d",borderRadius:"6px",color:"#e6edf3"};function Vt(e){return new Date(e).toLocaleTimeString()}function qt(e){return Number.isFinite(e),String(e)}function yt({data:e,label:t="value",color:n="#58a6ff",height:s=280}){if(!e||e.length===0)return r.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No data available"});const o=`perf-line-${n.replace(/[^a-zA-Z0-9]/g,"")}`;return r.jsx(un,{width:"100%",height:s,children:r.jsxs(rr,{data:e,margin:{top:8,right:16,left:0,bottom:0},children:[r.jsx("defs",{children:r.jsxs("linearGradient",{id:o,x1:"0",y1:"0",x2:"0",y2:"1",children:[r.jsx("stop",{offset:"5%",stopColor:n,stopOpacity:.7}),r.jsx("stop",{offset:"95%",stopColor:n,stopOpacity:.15})]})}),r.jsx(fn,{strokeDasharray:"3 3",stroke:Tr}),r.jsx(hn,{dataKey:"ts",type:"number",domain:["dataMin","dataMax"],scale:"time",tickFormatter:i=>Vt(i),stroke:wt,tick:{fontSize:11}}),r.jsx(gn,{dataKey:"value",stroke:wt,tick:{fontSize:11},width:56,tickFormatter:i=>qt(i)}),r.jsx(pn,{labelFormatter:i=>Vt(i),formatter:i=>[qt(i),t],contentStyle:Mr,labelStyle:{color:wt,fontSize:12}}),r.jsx(tr,{type:"monotone",dataKey:"value",name:t,stroke:n,strokeWidth:2,dot:!1,fill:`url(#${o})`,isAnimationActive:!1})]})})}const jt="#8b949e",Or="#30363d",Ar={background:"#161b22",border:"1px solid #30363d",borderRadius:"6px",color:"#e6edf3"};function Lr({data:e,color:t="#3fb950",height:n=280,valueFormatter:s}){const o=s??(i=>String(i));return!e||e.length===0?r.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No data available"}):r.jsx(un,{width:"100%",height:n,children:r.jsxs(sr,{data:e,margin:{top:8,right:16,left:0,bottom:0},children:[r.jsx(fn,{strokeDasharray:"3 3",stroke:Or}),r.jsx(hn,{dataKey:"label",stroke:jt,tick:{fontSize:11},interval:0,angle:-20,textAnchor:"end",height:56}),r.jsx(gn,{dataKey:"value",stroke:jt,tick:{fontSize:11},width:56,tickFormatter:i=>o(i)}),r.jsx(pn,{formatter:i=>[o(i),"value"],contentStyle:Ar,labelStyle:{color:jt,fontSize:12}}),r.jsx(nr,{dataKey:"value",fill:t,radius:[4,4,0,0],isAnimationActive:!1})]})})}function Ir(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return l.useMemo(()=>s=>{t.forEach(o=>o(s))},t)}const ft=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ie(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ot(e){return"nodeType"in e}function K(e){var t,n;return e?Ie(e)?e:Ot(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function At(e){const{Document:t}=K(e);return e instanceof t}function Je(e){return Ie(e)?!1:e instanceof K(e).HTMLElement}function mn(e){return e instanceof K(e).SVGElement}function Pe(e){return e?Ie(e)?e.document:Ot(e)?At(e)?e:Je(e)||mn(e)?e.ownerDocument:document:document:document}const ie=ft?l.useLayoutEffect:l.useEffect;function Lt(e){const t=l.useRef(e);return ie(()=>{t.current=e}),l.useCallback(function(){for(var n=arguments.length,s=new Array(n),o=0;o<n;o++)s[o]=arguments[o];return t.current==null?void 0:t.current(...s)},[])}function Pr(){const e=l.useRef(null),t=l.useCallback((s,o)=>{e.current=setInterval(s,o)},[]),n=l.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ye(e,t){t===void 0&&(t=[e]);const n=l.useRef(e);return ie(()=>{n.current!==e&&(n.current=e)},t),n}function Qe(e,t){const n=l.useRef();return l.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function lt(e){const t=Lt(e),n=l.useRef(null),s=l.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,s]}function kt(e){const t=l.useRef();return l.useEffect(()=>{t.current=e},[e]),t.current}let St={};function Ze(e,t){return l.useMemo(()=>{if(t)return t;const n=St[e]==null?0:St[e]+1;return St[e]=n,e+"-"+n},[e,t])}function vn(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];return s.reduce((i,a)=>{const c=Object.entries(a);for(const[d,u]of c){const f=i[d];f!=null&&(i[d]=f+e*u)}return i},{...t})}}const Oe=vn(1),ct=vn(-1);function $r(e){return"clientX"in e&&"clientY"in e}function It(e){if(!e)return!1;const{KeyboardEvent:t}=K(e.target);return t&&e instanceof t}function Fr(e){if(!e)return!1;const{TouchEvent:t}=K(e.target);return t&&e instanceof t}function Nt(e){if(Fr(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return $r(e)?{x:e.clientX,y:e.clientY}:null}const Ve=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Ve.Translate.toString(e),Ve.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),Jt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function zr(e){return e.matches(Jt)?e:e.querySelector(Jt)}const Br={display:"none"};function Wr(e){let{id:t,value:n}=e;return U.createElement("div",{id:t,style:Br},n)}function Hr(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return U.createElement("div",{id:t,style:o,role:"status","aria-live":s,"aria-atomic":!0},n)}function _r(){const[e,t]=l.useState("");return{announce:l.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const xn=l.createContext(null);function Xr(e){const t=l.useContext(xn);l.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Ur(){const[e]=l.useState(()=>new Set),t=l.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[l.useCallback(s=>{let{type:o,event:i}=s;e.forEach(a=>{var c;return(c=a[o])==null?void 0:c.call(a,i)})},[e]),t]}const Kr={draggable:`
|
|
11
|
+
*/const ir=cn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),xt=["#58a6ff","#3fb950","#d29922","#f85149","#bc8cff","#ff7b72","#79c0ff","#56d4dd","#e3b341","#a5d6ff","#7ee787","#ffa657"];function ar(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)>>>0;return t}function lr(e){return e?xt[ar(e)%xt.length]:xt[0]}function cr(e){if(!e)return"(unknown)";const t=e.replace(/[\\/]+$/,"");if(!t)return"(unknown)";const n=t.split(/[\\/]/);return n[n.length-1]||t}function dr(e){const t=new Map;for(const i of e){const a=i.repoRoot??"__null__",c=i.tokens??0,d=t.get(a);if(d)d.tokens+=c;else{const u=cr(i.repoRoot);t.set(a,{repoRoot:i.repoRoot,basename:u,tokens:c,color:lr(u)})}}const n=[...t.values()],s=n.reduce((i,a)=>i+a.tokens,0),o=e.reduce((i,a)=>Math.max(i,a.ctxWindow),0);return{repos:n,totalTokens:s,maxWindow:o,sessionCount:e.length}}function bt(e){return e>=1e5?`${(e/1e3).toFixed(0)}k`:e.toLocaleString()}function rt({children:e}){return r.jsxs(we,{className:"electric-hover",children:[r.jsx(Ae,{children:r.jsx(Le,{children:"Context per Repo (live)"})}),r.jsx(ye,{children:e})]})}function ur({sessions:e,loading:t,error:n}){if(n)return r.jsx(rt,{children:r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Error loading sessions: ",n.message]})});if(t&&!e)return r.jsx(rt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading sessions…"})});const s=e?.sessions??[],{repos:o,totalTokens:i,maxWindow:a,sessionCount:c}=dr(s);if(o.length===0)return r.jsx(rt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:"No active sessions."})});const d=a>0?Math.round(i/a*100):0;return r.jsxs(rt,{children:[r.jsx("div",{className:"repo-stack-bar",role:"group","aria-label":"Per-repo context usage",children:o.map(u=>{const f=i>0?u.tokens/i*100:0,h=i>0?f:0,g=`${u.basename}: ${bt(u.tokens)} tokens (${f.toFixed(1)}% of total)`;return r.jsx("div",{className:"repo-stack-segment",style:{width:`${Math.max(h,.5)}%`,backgroundColor:u.color},title:g,"aria-label":g},u.repoRoot??"__null__")})}),r.jsxs("p",{className:"repo-stack-total",children:[bt(i)," tokens across ",o.length," ",o.length===1?"repo":"repos"," /"," ",c," ",c===1?"session":"sessions"," ",r.jsxs("span",{className:"pct",children:["— ",d,"% of combined max window"]})]}),r.jsx("div",{className:"repo-stack-legend",children:o.map(u=>{const f=i>0?u.tokens/i*100:0;return r.jsxs("div",{className:"repo-stack-legend-item",children:[r.jsx("span",{className:"repo-stack-legend-swatch",style:{backgroundColor:u.color}}),r.jsx("span",{className:"repo-stack-legend-name",children:u.basename}),r.jsxs("span",{children:[bt(u.tokens)," (",f.toFixed(0),"%)"]})]},u.repoRoot??"__null__")})})]})}function fr(e){return e>=90?"gauge-red":e>=70?"gauge-yellow":"gauge-green"}function hr(e){return e==null?"?":e>=1e5?`${(e/1e3).toFixed(0)}k`:e.toLocaleString()}function gr(e){if(!e)return"(unknown)";const t=e.replace(/[\\/]+$/,"");if(!t)return"(unknown)";const n=t.split(/[\\/]/);return n[n.length-1]||t}function pr(e){const t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s ago`;const n=Math.floor(t/60);return n<60?`${n}m ago`:`${Math.floor(n/60)}h ${n%60}m ago`}function mr({data:e}){const t=e.percent??0,n=Math.max(t,1),s=fr(t),o=hr(e.tokens),i=e.contextWindow.toLocaleString(),a=`${o} / ${i} tokens`;return r.jsxs("div",{className:`session-gauge ${e.isSelf?"session-gauge-self":""}`,children:[r.jsxs("div",{className:"session-gauge-head",children:[r.jsx("span",{className:"session-gauge-label truncate",title:e.label,children:e.label}),r.jsxs("span",{className:"session-gauge-pct",children:[t,"%"]})]}),r.jsx("div",{className:`gauge-bar ${s}`,role:"meter","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,"aria-label":`${e.label}: ${t}%`,children:r.jsx("div",{className:"gauge-fill",style:{width:`${n}%`}})}),r.jsx("p",{className:"gauge-label session-gauge-sub",children:a}),e.sublabel&&r.jsx("p",{className:"session-gauge-meta truncate",title:e.sublabel,children:e.sublabel})]})}function vr({sessions:e,loading:t,error:n,launcherSessionId:s,launcher:o}){const i=Date.now(),a=[{key:"self",label:"this session",sublabel:"",tokens:o.tokens,percent:o.percent,contextWindow:o.contextWindow,isSelf:!0}],c=(e?.sessions??[]).filter(g=>g.sessionId!==s);c.sort((g,p)=>p.lastSeen-g.lastSeen);const d=new Set,u=c.filter(g=>g.tokens==null&&g.percent==null||d.has(g.pid)?!1:(d.add(g.pid),!0));for(const g of u)a.push({key:g.sessionId,label:gr(g.repoRoot),sublabel:`pid ${g.pid} · ${pr(i-g.lastSeen)}${g.model?` · ${g.model}`:""}`,tokens:g.tokens,percent:g.percent,contextWindow:g.ctxWindow||0,isSelf:!1});const f=n&&!e,h=t&&!e;return r.jsxs(we,{className:"electric-hover session-gauges-card w-full",children:[r.jsx(Ae,{children:r.jsx(Le,{children:"Context per Session (live)"})}),r.jsx(ye,{children:f?r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Error loading sessions: ",n.message]}):h?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading sessions…"}):r.jsx("div",{className:"session-gauges-scroll",children:r.jsx("div",{className:"session-gauges-grid",children:a.map(g=>r.jsx(mr,{data:g},g.key))})})})]})}function Yt({state:e,label:t}){const n=e==="on"?"bullet-on":e==="na"?"bullet-na":"bullet-off";return r.jsxs("div",{className:`bullet ${n}`,children:[r.jsx("span",{className:"bullet-dot","aria-hidden":"true"}),r.jsx("span",{className:"bullet-label",children:t})]})}function xr({armed:e,ready:t}){const n=e?"on":"off",s=t?"on":e?"off":"na",o=t?"THRESHOLD EXCEEDED — compacting next event":e?"past fast gate — monitoring token count":"idle — below fast gate";return r.jsxs("div",{className:"card trigger-status",children:[r.jsx("h3",{children:"Trigger Status"}),r.jsxs("div",{className:"bullet-row",children:[r.jsx(Yt,{state:n,label:"Armed"}),r.jsx(Yt,{state:s,label:"Ready"})]}),r.jsx("p",{className:"trigger-state-text",children:o})]})}function br(e){return e>=.9?"meter-green":e>=.6?"meter-yellow":"meter-red"}function ue({label:e,value:t,title:n}){return r.jsxs("div",{className:"ov-stat-row",children:[r.jsx("span",{className:"ov-stat-label",title:n,children:e}),r.jsx("span",{className:"ov-stat-value",children:t})]})}function wr(e){const t=e.compressionPct,n=br(t),s=Math.max(t*100,.5),o=`${De(t)} tokens saved · dedup: ${De(e.dedupPct)}`;return r.jsxs("div",{className:"card vector-store-card",children:[r.jsx("h3",{children:"Vector Store (session)"}),r.jsx(ue,{label:"Checkpoints",value:e.checkpointCount.toLocaleString(),title:"A saved summary of a chunk of your conversation that was compacted to free up space."}),r.jsx(ue,{label:"Original (dropped)",value:e.tokensIn.toLocaleString(),title:"Total size of the original conversation text dropped into compaction this session, including redundant regions skipped by dedup. This is the 'in'."}),r.jsx(ue,{label:"Kept (summaries)",value:e.tokensOut.toLocaleString(),title:"Compact summaries we are currently holding as 'memory' for this session (the 'out'). Smaller is better."}),r.jsx(ue,{label:"Freed",value:e.tokensFreed.toLocaleString(),title:"Conversation space freed = dropped − kept (the 'saved')."}),r.jsx(ue,{label:"Injected",value:e.injectedCount,title:"How many times old context was automatically brought back into the conversation because it was relevant to what you were doing."}),r.jsx(ue,{label:"Recall Relevance",value:De(e.dedupHitRate),title:"Of the times we recalled old context, how often it was actually on-topic."}),r.jsx(ue,{label:"Storage Dedup",value:De(e.storageDedupRate),title:"How often new content matched something we already had, so we skipped storing a duplicate copy. Higher = less wasted space."}),r.jsx(ue,{label:"Collapsed",value:e.dedupCollapsed,title:"How many duplicate chunks we collapsed into one instead of storing separately."}),r.jsx(ue,{label:"Last ID",value:e.lastCheckpointId??"—",title:"The ID of the most recent saved checkpoint."}),r.jsxs("div",{className:"ov-compression-meter",children:[r.jsx("div",{className:"meter-track",children:r.jsx("div",{className:`meter-fill ${n}`,style:{width:`${s}%`}})}),r.jsx("span",{className:"meter-sub",children:o})]})]})}function yr(e){return e>=.9?"meter-green":e>=.6?"meter-yellow":"meter-red"}function Se({label:e,value:t}){return r.jsxs("div",{className:"flex items-baseline justify-between border-b border-border py-1 text-sm",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:e}),r.jsx("span",{className:"font-semibold",children:t})]})}function jr(e){const t=e.compressionPct,n=yr(t),s=Math.max(t*100,.5),o=`${De(t)} tokens saved · dedup: ${De(e.dedupPct)}`;return r.jsxs(we,{className:"electric-hover",children:[r.jsx(Ae,{children:r.jsx(Le,{children:"Repo (all sessions)"})}),r.jsxs(ye,{children:[r.jsx(Se,{label:"Checkpoints",value:e.checkpointCount.toLocaleString()}),r.jsx(Se,{label:"Original",value:e.tokensIn.toLocaleString()}),r.jsx(Se,{label:"Kept",value:e.tokensOut.toLocaleString()}),r.jsx(Se,{label:"Freed",value:e.tokensFreed.toLocaleString()}),r.jsx(Se,{label:"Sessions",value:e.sessionCount.toLocaleString()}),r.jsx(Se,{label:"Collapsed",value:e.dedupCollapsed}),r.jsx(Se,{label:"Storage Dedup",value:De(e.storageDedupRate)}),r.jsxs("div",{children:[r.jsx("div",{className:"mt-2 h-2 w-full overflow-hidden rounded-full bg-bg-elevated",children:r.jsx("div",{className:`meter-fill h-full ${n}`,style:{width:`${s}%`}})}),r.jsx("span",{className:"mt-1 block text-xs text-muted-foreground",children:o})]})]})]})}function Sr(e){return r.jsxs("div",{className:"card data-safety-card",children:[r.jsx("h3",{children:"🛡 Data Safety"}),r.jsxs("div",{className:"ov-stat-row",children:[r.jsx("span",{className:"ov-stat-label",children:"Regions Retained"}),r.jsx("span",{className:"ov-stat-value",children:e.regionsRetained.toLocaleString()})]}),r.jsxs("div",{className:"ov-stat-row",children:[r.jsx("span",{className:"ov-stat-label",children:"Compressed-Original"}),r.jsx("span",{className:"ov-stat-value",children:Gt(e.compressedOriginalBytes)})]}),r.jsxs("div",{className:"ov-stat-row",children:[r.jsx("span",{className:"ov-stat-label",children:"Dedup Duplicates"}),r.jsx("span",{className:"ov-stat-value",children:e.duplicatesCollapsed.toLocaleString()})]}),r.jsxs("div",{className:"ov-stat-row",children:[r.jsx("span",{className:"ov-stat-label",children:"Permanently Deleted"}),r.jsx("span",{className:"ov-stat-value ov-value-ok",children:Gt(e.bytesPermanentlyDeleted)})]}),r.jsx("p",{className:"safe-note",children:'Every compacted region is kept verbatim (compressed). "Drop" = removed from the live window only. We never delete your data.'})]})}function Ce({label:e,value:t,title:n}){return r.jsxs("div",{className:"ov-stat-row",children:[r.jsx("span",{className:"ov-stat-label",title:n,children:e}),r.jsx("span",{className:"ov-stat-value",children:t})]})}function Cr(e){const t=`${Math.round((e.pressure??0)*100)}%`;let n=e.thresholdTokens.toLocaleString();return e.tierPct!=null&&e.contextWindow>0&&(n+=` (${Math.round(e.tierPct*100)}% of ${e.contextWindow.toLocaleString()})`),r.jsxs("div",{className:"card config-summary-card",children:[r.jsx("h3",{children:"Configuration"}),r.jsx(Ce,{label:"Tier",value:`${e.tier} (live)`,title:"Live pressure band — climbs low→mega as context fills the window."}),r.jsx(Ce,{label:"Preset",value:e.presetTier,title:"The env-resolved base compaction preset (low/medium/high/ultra/mega) that set the token threshold."}),r.jsx(Ce,{label:"Pressure",value:t,title:"Live pressure = currentTokens / threshold — % of the model context window (threshold fires at the tier's % of window)."}),r.jsx(Ce,{label:"Threshold",value:n,title:"Compaction threshold = tierPct × model context window — mega-compact trims BELOW pi's native ~80% auto-compact for any model size."}),r.jsx(Ce,{label:"Fast Gate",value:`${e.fastGatePct}%`,title:"Fast-gate arming floor — the live trim arms once context passes this % of the window."}),r.jsx(Ce,{label:"Auto",value:e.auto?"enabled":"disabled"}),r.jsx(Ce,{label:"Anchor",value:String(e.anchorUserMessages)})]})}function st({label:e,value:t,title:n}){return r.jsxs("div",{className:"flex items-baseline justify-between border-b border-border py-1 text-sm",children:[r.jsx("span",{className:"text-xs text-muted-foreground",title:n,children:e}),r.jsx("span",{className:"font-semibold",children:t})]})}function Dr(e){const t=e.repoTokensFreed||0;let n=0,s="0";if(e.inputRate&&t>0){n=t*e.inputRate;const a=e.contextWindow||0;s=a>0?(t/a).toFixed(1):"0"}const o=`≈ $${n.toFixed(4)} saved`,i=`${s} context-windows extended`;return r.jsxs(we,{className:"electric-hover",children:[r.jsx(Ae,{children:r.jsx(Le,{children:"💰 Model & Cost Savings"})}),r.jsxs(ye,{children:[r.jsx("div",{className:"text-neon text-xl font-semibold",children:o}),r.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:i}),r.jsx(st,{label:"Model",value:e.name,title:"The model pi is currently using — its pricing drives the cost figure."}),r.jsx(st,{label:"Provider",value:e.provider,title:"The provider serving the model."}),r.jsx(st,{label:"Input Rate",value:`$${e.inputRate.toFixed(6)}`,title:"USD per input token, from the model's pricing."}),r.jsx(st,{label:"Output Rate",value:`$${e.outputRate.toFixed(6)}`,title:"USD per output token, from the model's pricing."})]})]})}function Rr(e){const{activeAgents:t,currentTurn:n}=e,s=t>0?`▶ ${t} running`:"idle";return r.jsxs(we,{className:"electric-hover",children:[r.jsx(Ae,{children:r.jsx(Le,{children:"Crew / Agents"})}),r.jsxs(ye,{children:[r.jsxs("div",{className:"flex items-baseline justify-between border-b border-border py-1 text-sm",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Active Agents"}),r.jsx("span",{className:"font-semibold",children:t})]}),r.jsxs("div",{className:"flex items-baseline justify-between border-b border-border py-1 text-sm",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Current Turn"}),r.jsx("span",{className:"font-semibold",children:n})]}),r.jsxs("div",{className:"flex items-baseline justify-between py-1 text-sm",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Status"}),r.jsx("span",{className:"font-semibold",children:s})]})]})]})}const kr=[r.jsxs("li",{children:[r.jsx("b",{children:"Original (dropped)"}),' — everything compacted away (including duplicates caught by dedup). The "in."']},"1"),r.jsxs("li",{children:[r.jsx("b",{children:"Kept (summaries)"}),' — compact summaries still held as "memory" (the "out").']},"2"),r.jsxs("li",{children:[r.jsx("b",{children:"Freed"})," = dropped − kept — tokens saved so far (higher = better)."]},"3"),r.jsxs("li",{children:[r.jsx("b",{children:"Compression %"})," — Freed ÷ Dropped — the headline efficiency number. Higher = more space reclaimed."]},"4"),r.jsxs("li",{children:[r.jsx("b",{children:"Storage dedup %"})," — how often new content matched something already saved, so no duplicate copy was written."]},"5"),r.jsxs("li",{children:[r.jsx("b",{children:"Data safety"})," — every compacted region is kept verbatim (compressed). Nothing is permanently deleted; you can restore any of it."]},"6")];function Nr(){return r.jsx(we,{children:r.jsx(ye,{children:r.jsxs("details",{children:[r.jsx("summary",{className:"cursor-pointer text-sm font-semibold",children:"What these numbers mean"}),r.jsx("ol",{className:"mt-2 list-decimal space-y-1 pl-5 text-sm",children:kr}),r.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Hover any label above for a quick explanation."})]})})})}const Er=()=>{const{data:e}=dn(l.useMemo(()=>()=>Gn(),[]),{pollInterval:3e4});if(!e)return r.jsx(we,{children:r.jsx(ye,{className:"text-sm text-muted-foreground",children:"Loading RAG health…"})});const{totals:t,flags:n}=e,s=n.hydeEnabled||n.recallMetricsEnabled;return r.jsxs(we,{children:[r.jsx(Ae,{children:r.jsxs(Le,{className:"flex items-center gap-2",children:[r.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${s?"bg-success":"bg-muted-foreground"}`,"aria-hidden":"true"}),"RAG Health"]})}),r.jsx(ye,{children:s?r.jsxs("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs text-muted-foreground",children:"Pass rate"}),r.jsxs("dd",{className:"font-semibold text-foreground",children:[Math.round(t.recentPassRate*100),"%"]})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs text-muted-foreground",children:"Avg lift"}),r.jsxs("dd",{className:"font-semibold text-foreground",children:[t.avgLift.toFixed(2),"×"]})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs text-muted-foreground",children:"Telemetry turns"}),r.jsx("dd",{className:"font-semibold text-foreground",children:t.telemetryTurns})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs text-muted-foreground",children:"HyDE ran"}),r.jsx("dd",{className:"font-semibold text-foreground",children:t.hydeRanTurns})]})]}):r.jsx("div",{className:"text-sm text-muted-foreground",children:"All RAG recall feature flags are off."})})]})};function ot({title:e,open:t,onClose:n,children:s}){return l.useEffect(()=>{if(!t)return;const o=i=>{i.key==="Escape"&&n()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t,n]),t?r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:n,role:"dialog","aria-modal":"true","aria-label":e,children:r.jsxs("div",{className:"max-h-[80vh] w-full max-w-3xl overflow-y-auto rounded-lg border border-border bg-bg-card p-5",onClick:o=>o.stopPropagation(),children:[r.jsxs("header",{className:"mb-4 flex items-center justify-between gap-4",children:[r.jsx("h2",{className:"font-heading text-lg font-semibold",children:e}),r.jsx("button",{type:"button",className:"text-muted-foreground transition-colors hover:text-foreground",onClick:n,"aria-label":"Close",children:r.jsx(ir,{size:22,strokeWidth:2})})]}),s]})}):r.jsx(r.Fragment,{})}const wt="#8b949e",Tr="#30363d",Mr={background:"#161b22",border:"1px solid #30363d",borderRadius:"6px",color:"#e6edf3"};function Vt(e){return new Date(e).toLocaleTimeString()}function qt(e){return Number.isFinite(e),String(e)}function yt({data:e,label:t="value",color:n="#58a6ff",height:s=280}){if(!e||e.length===0)return r.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No data available"});const o=`perf-line-${n.replace(/[^a-zA-Z0-9]/g,"")}`;return r.jsx(un,{width:"100%",height:s,children:r.jsxs(rr,{data:e,margin:{top:8,right:16,left:0,bottom:0},children:[r.jsx("defs",{children:r.jsxs("linearGradient",{id:o,x1:"0",y1:"0",x2:"0",y2:"1",children:[r.jsx("stop",{offset:"5%",stopColor:n,stopOpacity:.7}),r.jsx("stop",{offset:"95%",stopColor:n,stopOpacity:.15})]})}),r.jsx(fn,{strokeDasharray:"3 3",stroke:Tr}),r.jsx(hn,{dataKey:"ts",type:"number",domain:["dataMin","dataMax"],scale:"time",tickFormatter:i=>Vt(i),stroke:wt,tick:{fontSize:11}}),r.jsx(gn,{dataKey:"value",stroke:wt,tick:{fontSize:11},width:56,tickFormatter:i=>qt(i)}),r.jsx(pn,{labelFormatter:i=>Vt(i),formatter:i=>[qt(i),t],contentStyle:Mr,labelStyle:{color:wt,fontSize:12}}),r.jsx(tr,{type:"monotone",dataKey:"value",name:t,stroke:n,strokeWidth:2,dot:!1,fill:`url(#${o})`,isAnimationActive:!1})]})})}const jt="#8b949e",Or="#30363d",Ar={background:"#161b22",border:"1px solid #30363d",borderRadius:"6px",color:"#e6edf3"};function Lr({data:e,color:t="#3fb950",height:n=280,valueFormatter:s}){const o=s??(i=>String(i));return!e||e.length===0?r.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No data available"}):r.jsx(un,{width:"100%",height:n,children:r.jsxs(sr,{data:e,margin:{top:8,right:16,left:0,bottom:0},children:[r.jsx(fn,{strokeDasharray:"3 3",stroke:Or}),r.jsx(hn,{dataKey:"label",stroke:jt,tick:{fontSize:11},interval:0,angle:-20,textAnchor:"end",height:56}),r.jsx(gn,{dataKey:"value",stroke:jt,tick:{fontSize:11},width:56,tickFormatter:i=>o(i)}),r.jsx(pn,{formatter:i=>[o(i),"value"],contentStyle:Ar,labelStyle:{color:jt,fontSize:12}}),r.jsx(nr,{dataKey:"value",fill:t,radius:[4,4,0,0],isAnimationActive:!1})]})})}function Ir(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return l.useMemo(()=>s=>{t.forEach(o=>o(s))},t)}const ft=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ie(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ot(e){return"nodeType"in e}function K(e){var t,n;return e?Ie(e)?e:Ot(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function At(e){const{Document:t}=K(e);return e instanceof t}function Je(e){return Ie(e)?!1:e instanceof K(e).HTMLElement}function mn(e){return e instanceof K(e).SVGElement}function Pe(e){return e?Ie(e)?e.document:Ot(e)?At(e)?e:Je(e)||mn(e)?e.ownerDocument:document:document:document}const ie=ft?l.useLayoutEffect:l.useEffect;function Lt(e){const t=l.useRef(e);return ie(()=>{t.current=e}),l.useCallback(function(){for(var n=arguments.length,s=new Array(n),o=0;o<n;o++)s[o]=arguments[o];return t.current==null?void 0:t.current(...s)},[])}function Pr(){const e=l.useRef(null),t=l.useCallback((s,o)=>{e.current=setInterval(s,o)},[]),n=l.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ye(e,t){t===void 0&&(t=[e]);const n=l.useRef(e);return ie(()=>{n.current!==e&&(n.current=e)},t),n}function Qe(e,t){const n=l.useRef();return l.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function lt(e){const t=Lt(e),n=l.useRef(null),s=l.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,s]}function kt(e){const t=l.useRef();return l.useEffect(()=>{t.current=e},[e]),t.current}let St={};function Ze(e,t){return l.useMemo(()=>{if(t)return t;const n=St[e]==null?0:St[e]+1;return St[e]=n,e+"-"+n},[e,t])}function vn(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];return s.reduce((i,a)=>{const c=Object.entries(a);for(const[d,u]of c){const f=i[d];f!=null&&(i[d]=f+e*u)}return i},{...t})}}const Oe=vn(1),ct=vn(-1);function $r(e){return"clientX"in e&&"clientY"in e}function It(e){if(!e)return!1;const{KeyboardEvent:t}=K(e.target);return t&&e instanceof t}function Fr(e){if(!e)return!1;const{TouchEvent:t}=K(e.target);return t&&e instanceof t}function Nt(e){if(Fr(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return $r(e)?{x:e.clientX,y:e.clientY}:null}const Ve=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Ve.Translate.toString(e),Ve.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),Jt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function zr(e){return e.matches(Jt)?e:e.querySelector(Jt)}const Br={display:"none"};function Wr(e){let{id:t,value:n}=e;return U.createElement("div",{id:t,style:Br},n)}function Hr(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return U.createElement("div",{id:t,style:o,role:"status","aria-live":s,"aria-atomic":!0},n)}function _r(){const[e,t]=l.useState("");return{announce:l.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const xn=l.createContext(null);function Xr(e){const t=l.useContext(xn);l.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Ur(){const[e]=l.useState(()=>new Set),t=l.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[l.useCallback(s=>{let{type:o,event:i}=s;e.forEach(a=>{var c;return(c=a[o])==null?void 0:c.call(a,i)})},[e]),t]}const Kr={draggable:`
|
|
12
12
|
To pick up a draggable item, press the space bar.
|
|
13
13
|
While dragging, use the arrow keys to move the item.
|
|
14
14
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
15
|
-
`},Gr={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Yr(e){let{announcements:t=Gr,container:n,hiddenTextDescribedById:s,screenReaderInstructions:o=Kr}=e;const{announce:i,announcement:a}=_r(),c=Ze("DndLiveRegion"),[d,u]=l.useState(!1);if(l.useEffect(()=>{u(!0)},[]),Xr(l.useMemo(()=>({onDragStart(h){let{active:g}=h;i(t.onDragStart({active:g}))},onDragMove(h){let{active:g,over:p}=h;t.onDragMove&&i(t.onDragMove({active:g,over:p}))},onDragOver(h){let{active:g,over:p}=h;i(t.onDragOver({active:g,over:p}))},onDragEnd(h){let{active:g,over:p}=h;i(t.onDragEnd({active:g,over:p}))},onDragCancel(h){let{active:g,over:p}=h;i(t.onDragCancel({active:g,over:p}))}}),[i,t])),!d)return null;const f=U.createElement(U.Fragment,null,U.createElement(Wr,{id:s,value:o.draggable}),U.createElement(Hr,{id:c,announcement:a}));return n?_e.createPortal(f,n):f}var A;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(A||(A={}));function dt(){}const te=Object.freeze({x:0,y:0});function Vr(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function qr(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Jr(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-s,c=i-n;if(s<o&&n<i){const d=t.width*t.height,u=e.width*e.height,f=a*c,h=f/(d+u-f);return Number(h.toFixed(4))}return 0}const Qr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const o=[];for(const i of s){const{id:a}=i,c=n.get(a);if(c){const d=Jr(c,t);d>0&&o.push({id:a,data:{droppableContainer:i,value:d}})}}return o.sort(Vr)};function Zr(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function bn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:te}function es(e){return function(n){for(var s=arguments.length,o=new Array(s>1?s-1:0),i=1;i<s;i++)o[i-1]=arguments[i];return o.reduce((a,c)=>({...a,top:a.top+e*c.y,bottom:a.bottom+e*c.y,left:a.left+e*c.x,right:a.right+e*c.x}),{...n})}}const ts=es(1);function ns(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function rs(e,t,n){const s=ns(t);if(!s)return e;const{scaleX:o,scaleY:i,x:a,y:c}=s,d=e.left-a-(1-o)*parseFloat(n),u=e.top-c-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,h=i?e.height/i:e.height;return{width:f,height:h,top:u,right:d+f,bottom:u+h,left:d}}const ss={ignoreTransform:!1};function $e(e,t){t===void 0&&(t=ss);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=K(e).getComputedStyle(e);u&&(n=rs(n,u,f))}const{top:s,left:o,width:i,height:a,bottom:c,right:d}=n;return{top:s,left:o,width:i,height:a,bottom:c,right:d}}function Qt(e){return $e(e,{ignoreTransform:!0})}function os(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function is(e,t){return t===void 0&&(t=K(e).getComputedStyle(e)),t.position==="fixed"}function as(e,t){t===void 0&&(t=K(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function Pt(e,t){const n=[];function s(o){if(t!=null&&n.length>=t||!o)return n;if(At(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Je(o)||mn(o)||n.includes(o))return n;const i=K(e).getComputedStyle(o);return o!==e&&as(o,i)&&n.push(o),is(o,i)?n:s(o.parentNode)}return e?s(e):n}function wn(e){const[t]=Pt(e,1);return t??null}function Ct(e){return!ft||!e?null:Ie(e)?e:Ot(e)?At(e)||e===Pe(e).scrollingElement?window:Je(e)?e:null:null}function yn(e){return Ie(e)?e.scrollX:e.scrollLeft}function jn(e){return Ie(e)?e.scrollY:e.scrollTop}function Et(e){return{x:yn(e),y:jn(e)}}var L;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(L||(L={}));function Sn(e){return!ft||!e?!1:e===document.scrollingElement}function Cn(e){const t={x:0,y:0},n=Sn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,a=e.scrollTop>=s.y,c=e.scrollLeft>=s.x;return{isTop:o,isLeft:i,isBottom:a,isRight:c,maxScroll:s,minScroll:t}}const ls={x:.2,y:.2};function cs(e,t,n,s,o){let{top:i,left:a,right:c,bottom:d}=n;s===void 0&&(s=10),o===void 0&&(o=ls);const{isTop:u,isBottom:f,isLeft:h,isRight:g}=Cn(e),p={x:0,y:0},R={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!u&&i<=t.top+m.height?(p.y=L.Backward,R.y=s*Math.abs((t.top+m.height-i)/m.height)):!f&&d>=t.bottom-m.height&&(p.y=L.Forward,R.y=s*Math.abs((t.bottom-m.height-d)/m.height)),!g&&c>=t.right-m.width?(p.x=L.Forward,R.x=s*Math.abs((t.right-m.width-c)/m.width)):!h&&a<=t.left+m.width&&(p.x=L.Backward,R.x=s*Math.abs((t.left+m.width-a)/m.width)),{direction:p,speed:R}}function ds(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:t,left:n,right:s,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Dn(e){return e.reduce((t,n)=>Oe(t,Et(n)),te)}function us(e){return e.reduce((t,n)=>t+yn(n),0)}function fs(e){return e.reduce((t,n)=>t+jn(n),0)}function hs(e,t){if(t===void 0&&(t=$e),!e)return;const{top:n,left:s,bottom:o,right:i}=t(e);wn(e)&&(o<=0||i<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const gs=[["x",["left","right"],us],["y",["top","bottom"],fs]];class $t{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=Pt(n),o=Dn(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,a,c]of gs)for(const d of a)Object.defineProperty(this,d,{get:()=>{const u=c(s),f=o[i]-u;return this.rect[d]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Xe{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=t}add(t,n,s){var o;(o=this.target)==null||o.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function ps(e){const{EventTarget:t}=K(e);return e instanceof t?e:Pe(e)}function Dt(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var Z;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Z||(Z={}));function Zt(e){e.preventDefault()}function ms(e){e.stopPropagation()}var N;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(N||(N={}));const Rn={start:[N.Space,N.Enter],cancel:[N.Esc],end:[N.Space,N.Enter,N.Tab]},vs=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case N.Right:return{...n,x:n.x+25};case N.Left:return{...n,x:n.x-25};case N.Down:return{...n,y:n.y+25};case N.Up:return{...n,y:n.y-25}}};class kn{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Xe(Pe(n)),this.windowListeners=new Xe(K(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Z.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&hs(s),n(te)}handleKeyDown(t){if(It(t)){const{active:n,context:s,options:o}=this.props,{keyboardCodes:i=Rn,coordinateGetter:a=vs,scrollBehavior:c="smooth"}=o,{code:d}=t;if(i.end.includes(d)){this.handleEnd(t);return}if(i.cancel.includes(d)){this.handleCancel(t);return}const{collisionRect:u}=s.current,f=u?{x:u.left,y:u.top}:te;this.referenceCoordinates||(this.referenceCoordinates=f);const h=a(t,{active:n,context:s.current,currentCoordinates:f});if(h){const g=ct(h,f),p={x:0,y:0},{scrollableAncestors:R}=s.current;for(const m of R){const v=t.code,{isTop:S,isRight:C,isLeft:y,isBottom:k,maxScroll:b,minScroll:D}=Cn(m),x=ds(m),w={x:Math.min(v===N.Right?x.right-x.width/2:x.right,Math.max(v===N.Right?x.left:x.left+x.width/2,h.x)),y:Math.min(v===N.Down?x.bottom-x.height/2:x.bottom,Math.max(v===N.Down?x.top:x.top+x.height/2,h.y))},O=v===N.Right&&!C||v===N.Left&&!y,M=v===N.Down&&!k||v===N.Up&&!S;if(O&&w.x!==h.x){const T=m.scrollLeft+g.x,G=v===N.Right&&T<=b.x||v===N.Left&&T>=D.x;if(G&&!g.y){m.scrollTo({left:T,behavior:c});return}G?p.x=m.scrollLeft-T:p.x=v===N.Right?m.scrollLeft-b.x:m.scrollLeft-D.x,p.x&&m.scrollBy({left:-p.x,behavior:c});break}else if(M&&w.y!==h.y){const T=m.scrollTop+g.y,G=v===N.Down&&T<=b.y||v===N.Up&&T>=D.y;if(G&&!g.x){m.scrollTo({top:T,behavior:c});return}G?p.y=m.scrollTop-T:p.y=v===N.Down?m.scrollTop-b.y:m.scrollTop-D.y,p.y&&m.scrollBy({top:-p.y,behavior:c});break}}this.handleMove(t,Oe(ct(h,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}kn.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=Rn,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(s.start.includes(a)){const c=i.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function en(e){return!!(e&&"distance"in e)}function tn(e){return!!(e&&"delay"in e)}class Ft{constructor(t,n,s){var o;s===void 0&&(s=ps(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:a}=i;this.props=t,this.events=n,this.document=Pe(a),this.documentListeners=new Xe(this.document),this.listeners=new Xe(s),this.windowListeners=new Xe(K(a)),this.initialCoordinates=(o=Nt(i))!=null?o:te,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:s}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.DragStart,Zt),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),this.windowListeners.add(Z.ContextMenu,Zt),this.documentListeners.add(Z.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(tn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(en(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:s,onPending:o}=this.props;o(s,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Z.Click,ms,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Z.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:o,props:i}=this,{onMove:a,options:{activationConstraint:c}}=i;if(!o)return;const d=(n=Nt(t))!=null?n:te,u=ct(o,d);if(!s&&c){if(en(c)){if(c.tolerance!=null&&Dt(u,c.tolerance))return this.handleCancel();if(Dt(u,c.distance))return this.handleStart()}if(tn(c)&&Dt(u,c.tolerance))return this.handleCancel();this.handlePending(c,u);return}t.cancelable&&t.preventDefault(),a(d)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===N.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const xs={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Nn extends Ft{constructor(t){const{event:n}=t,s=Pe(n.target);super(t,xs,s)}}Nn.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return!n.isPrimary||n.button!==0?!1:(s?.({event:n}),!0)}}];const bs={move:{name:"mousemove"},end:{name:"mouseup"}};var Tt;(function(e){e[e.RightClick=2]="RightClick"})(Tt||(Tt={}));class ws extends Ft{constructor(t){super(t,bs,Pe(t.event.target))}}ws.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===Tt.RightClick?!1:(s?.({event:n}),!0)}}];const Rt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class ys extends Ft{constructor(t){super(t,Rt)}static setup(){return window.addEventListener(Rt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Rt.move.name,t)};function t(){}}}ys.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;const{touches:o}=n;return o.length>1?!1:(s?.({event:n}),!0)}}];var Ue;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ue||(Ue={}));var ut;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ut||(ut={}));function js(e){let{acceleration:t,activator:n=Ue.Pointer,canScroll:s,draggingRect:o,enabled:i,interval:a=5,order:c=ut.TreeOrder,pointerCoordinates:d,scrollableAncestors:u,scrollableAncestorRects:f,delta:h,threshold:g}=e;const p=Cs({delta:h,disabled:!i}),[R,m]=Pr(),v=l.useRef({x:0,y:0}),S=l.useRef({x:0,y:0}),C=l.useMemo(()=>{switch(n){case Ue.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case Ue.DraggableRect:return o}},[n,o,d]),y=l.useRef(null),k=l.useCallback(()=>{const D=y.current;if(!D)return;const x=v.current.x*S.current.x,w=v.current.y*S.current.y;D.scrollBy(x,w)},[]),b=l.useMemo(()=>c===ut.TreeOrder?[...u].reverse():u,[c,u]);l.useEffect(()=>{if(!i||!u.length||!C){m();return}for(const D of b){if(s?.(D)===!1)continue;const x=u.indexOf(D),w=f[x];if(!w)continue;const{direction:O,speed:M}=cs(D,w,C,t,g);for(const T of["x","y"])p[T][O[T]]||(M[T]=0,O[T]=0);if(M.x>0||M.y>0){m(),y.current=D,R(k,a),v.current=M,S.current=O;return}}v.current={x:0,y:0},S.current={x:0,y:0},m()},[t,k,s,m,i,a,JSON.stringify(C),JSON.stringify(p),R,u,b,f,JSON.stringify(g)])}const Ss={x:{[L.Backward]:!1,[L.Forward]:!1},y:{[L.Backward]:!1,[L.Forward]:!1}};function Cs(e){let{delta:t,disabled:n}=e;const s=kt(t);return Qe(o=>{if(n||!s||!o)return Ss;const i={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[L.Backward]:o.x[L.Backward]||i.x===-1,[L.Forward]:o.x[L.Forward]||i.x===1},y:{[L.Backward]:o.y[L.Backward]||i.y===-1,[L.Forward]:o.y[L.Forward]||i.y===1}}},[n,t,s])}function Ds(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return Qe(o=>{var i;return t==null?null:(i=s??o)!=null?i:null},[s,t])}function Rs(e,t){return l.useMemo(()=>e.reduce((n,s)=>{const{sensor:o}=s,i=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,s)}));return[...n,...i]},[]),[e,t])}var qe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(qe||(qe={}));var Mt;(function(e){e.Optimized="optimized"})(Mt||(Mt={}));const nn=new Map;function ks(e,t){let{dragging:n,dependencies:s,config:o}=t;const[i,a]=l.useState(null),{frequency:c,measure:d,strategy:u}=o,f=l.useRef(e),h=v(),g=Ye(h),p=l.useCallback(function(S){S===void 0&&(S=[]),!g.current&&a(C=>C===null?S:C.concat(S.filter(y=>!C.includes(y))))},[g]),R=l.useRef(null),m=Qe(S=>{if(h&&!n)return nn;if(!S||S===nn||f.current!==e||i!=null){const C=new Map;for(let y of e){if(!y)continue;if(i&&i.length>0&&!i.includes(y.id)&&y.rect.current){C.set(y.id,y.rect.current);continue}const k=y.node.current,b=k?new $t(d(k),k):null;y.rect.current=b,b&&C.set(y.id,b)}return C}return S},[e,i,n,h,d]);return l.useEffect(()=>{f.current=e},[e]),l.useEffect(()=>{h||p()},[n,h]),l.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),l.useEffect(()=>{h||typeof c!="number"||R.current!==null||(R.current=setTimeout(()=>{p(),R.current=null},c))},[c,h,p,...s]),{droppableRects:m,measureDroppableContainers:p,measuringScheduled:i!=null};function v(){switch(u){case qe.Always:return!1;case qe.BeforeDragging:return n;default:return!n}}}function En(e,t){return Qe(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Ns(e,t){return En(e,t)}function Es(e){let{callback:t,disabled:n}=e;const s=Lt(t),o=l.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(s)},[s,n]);return l.useEffect(()=>()=>o?.disconnect(),[o]),o}function ht(e){let{callback:t,disabled:n}=e;const s=Lt(t),o=l.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(s)},[n]);return l.useEffect(()=>()=>o?.disconnect(),[o]),o}function Ts(e){return new $t($e(e),e)}function rn(e,t,n){t===void 0&&(t=Ts);const[s,o]=l.useState(null);function i(){o(d=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=d??n)!=null?u:null}const f=t(e);return JSON.stringify(d)===JSON.stringify(f)?d:f})}const a=Es({callback(d){if(e)for(const u of d){const{type:f,target:h}=u;if(f==="childList"&&h instanceof HTMLElement&&h.contains(e)){i();break}}}}),c=ht({callback:i});return ie(()=>{i(),e?(c?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),a?.disconnect())},[e]),s}function Ms(e){const t=En(e);return bn(e,t)}const sn=[];function Os(e){const t=l.useRef(e),n=Qe(s=>e?s&&s!==sn&&e&&t.current&&e.parentNode===t.current.parentNode?s:Pt(e):sn,[e]);return l.useEffect(()=>{t.current=e},[e]),n}function As(e){const[t,n]=l.useState(null),s=l.useRef(e),o=l.useCallback(i=>{const a=Ct(i.target);a&&n(c=>c?(c.set(a,Et(a)),new Map(c)):null)},[]);return l.useEffect(()=>{const i=s.current;if(e!==i){a(i);const c=e.map(d=>{const u=Ct(d);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,Et(u)]):null}).filter(d=>d!=null);n(c.length?new Map(c):null),s.current=e}return()=>{a(e),a(i)};function a(c){c.forEach(d=>{const u=Ct(d);u?.removeEventListener("scroll",o)})}},[o,e]),l.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>Oe(i,a),te):Dn(e):te,[e,t])}function on(e,t){t===void 0&&(t=[]);const n=l.useRef(null);return l.useEffect(()=>{n.current=null},t),l.useEffect(()=>{const s=e!==te;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?ct(e,n.current):te}function Ls(e){l.useEffect(()=>{if(!ft)return;const t=e.map(n=>{let{sensor:s}=n;return s.setup==null?void 0:s.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Is(e,t){return l.useMemo(()=>e.reduce((n,s)=>{let{eventName:o,handler:i}=s;return n[o]=a=>{i(a,t)},n},{}),[e,t])}function Tn(e){return l.useMemo(()=>e?os(e):null,[e])}const an=[];function Ps(e,t){t===void 0&&(t=$e);const[n]=e,s=Tn(n?K(n):null),[o,i]=l.useState(an);function a(){i(()=>e.length?e.map(d=>Sn(d)?s:new $t(t(d),d)):an)}const c=ht({callback:a});return ie(()=>{c?.disconnect(),a(),e.forEach(d=>c?.observe(d))},[e]),o}function $s(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Je(t)?t:e}function Fs(e){let{measure:t}=e;const[n,s]=l.useState(null),o=l.useCallback(u=>{for(const{target:f}of u)if(Je(f)){s(h=>{const g=t(f);return h?{...h,width:g.width,height:g.height}:g});break}},[t]),i=ht({callback:o}),a=l.useCallback(u=>{const f=$s(u);i?.disconnect(),f&&i?.observe(f),s(f?t(f):null)},[t,i]),[c,d]=lt(a);return l.useMemo(()=>({nodeRef:c,rect:n,setRef:d}),[n,c,d])}const zs=[{sensor:Nn,options:{}},{sensor:kn,options:{}}],Bs={current:{}},at={draggable:{measure:Qt},droppable:{measure:Qt,strategy:qe.WhileDragging,frequency:Mt.Optimized},dragOverlay:{measure:$e}};class Ke extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,s;return(n=(s=this.get(t))==null?void 0:s.node.current)!=null?n:void 0}}const Ws={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ke,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:dt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:at,measureDroppableContainers:dt,windowRect:null,measuringScheduled:!1},Hs={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:dt,draggableNodes:new Map,over:null,measureDroppableContainers:dt},gt=l.createContext(Hs),Mn=l.createContext(Ws);function _s(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ke}}}function Xs(e,t){switch(t.type){case A.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case A.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case A.DragEnd:case A.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case A.RegisterDroppable:{const{element:n}=t,{id:s}=n,o=new Ke(e.droppable.containers);return o.set(s,n),{...e,droppable:{...e.droppable,containers:o}}}case A.SetDroppableDisabled:{const{id:n,key:s,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||s!==i.key)return e;const a=new Ke(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case A.UnregisterDroppable:{const{id:n,key:s}=t,o=e.droppable.containers.get(n);if(!o||s!==o.key)return e;const i=new Ke(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Us(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:o}=l.useContext(gt),i=kt(s),a=kt(n?.id);return l.useEffect(()=>{if(!t&&!s&&i&&a!=null){if(!It(i)||document.activeElement===i.target)return;const c=o.get(a);if(!c)return;const{activatorNode:d,node:u}=c;if(!d.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[d.current,u.current]){if(!f)continue;const h=zr(f);if(h){h.focus();break}}})}},[s,t,o,a,i]),null}function Ks(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...s}),n):n}function Gs(e){return l.useMemo(()=>({draggable:{...at.draggable,...e?.draggable},droppable:{...at.droppable,...e?.droppable},dragOverlay:{...at.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ys(e){let{activeNode:t,measure:n,initialRect:s,config:o=!0}=e;const i=l.useRef(!1),{x:a,y:c}=typeof o=="boolean"?{x:o,y:o}:o;ie(()=>{if(!a&&!c||!t){i.current=!1;return}if(i.current||!s)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const f=n(u),h=bn(f,s);if(a||(h.x=0),c||(h.y=0),i.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const g=wn(u);g&&g.scrollBy({top:h.y,left:h.x})}},[t,a,c,s,n])}const On=l.createContext({...te,scaleX:1,scaleY:1});var be;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(be||(be={}));const Vs=l.memo(function(t){var n,s,o,i;let{id:a,accessibility:c,autoScroll:d=!0,children:u,sensors:f=zs,collisionDetection:h=Qr,measuring:g,modifiers:p,...R}=t;const m=l.useReducer(Xs,void 0,_s),[v,S]=m,[C,y]=Ur(),[k,b]=l.useState(be.Uninitialized),D=k===be.Initialized,{draggable:{active:x,nodes:w,translate:O},droppable:{containers:M}}=v,T=x!=null?w.get(x):null,G=l.useRef({initial:null,translated:null}),I=l.useMemo(()=>{var W;return x!=null?{id:x,data:(W=T?.data)!=null?W:Bs,rect:G}:null},[x,T]),Y=l.useRef(null),[ne,ae]=l.useState(null),[z,le]=l.useState(null),X=Ye(R,Object.values(R)),P=Ze("DndDescribedBy",a),De=l.useMemo(()=>M.getEnabled(),[M]),B=Gs(g),{droppableRects:j,measureDroppableContainers:$,measuringScheduled:H}=ks(De,{dragging:D,dependencies:[O.x,O.y],config:B.droppable}),_=Ds(w,x),et=l.useMemo(()=>z?Nt(z):null,[z]),he=Kn(),ce=Ns(_,B.draggable.measure);Ys({activeNode:x!=null?w.get(x):null,config:he.layoutShiftCompensation,initialRect:ce,measure:B.draggable.measure});const E=rn(_,B.draggable.measure,ce),Fe=rn(_?_.parentElement:null),re=l.useRef({activatorEvent:null,active:null,activeNode:_,collisionRect:null,collisions:null,droppableRects:j,draggableNodes:w,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Re=M.getNodeFor((n=re.current.over)==null?void 0:n.id),de=Fs({measure:B.dragOverlay.measure}),ke=(s=de.nodeRef.current)!=null?s:_,Ne=D?(o=de.rect)!=null?o:E:null,zt=!!(de.nodeRef.current&&de.rect),Bt=Ms(zt?null:E),pt=Tn(ke?K(ke):null),ge=Os(D?Re??_:null),tt=Ps(ge),nt=Ks(p,{transform:{x:O.x-Bt.x,y:O.y-Bt.y,scaleX:1,scaleY:1},activatorEvent:z,active:I,activeNodeRect:E,containerNodeRect:Fe,draggingNodeRect:Ne,over:re.current.over,overlayNodeRect:de.rect,scrollableAncestors:ge,scrollableAncestorRects:tt,windowRect:pt}),Wt=et?Oe(et,O):null,Ht=As(ge),zn=on(Ht),Bn=on(Ht,[E]),Ee=Oe(nt,zn),Te=Ne?ts(Ne,nt):null,ze=I&&Te?h({active:I,collisionRect:Te,droppableRects:j,droppableContainers:De,pointerCoordinates:Wt}):null,_t=qr(ze,"id"),[pe,Xt]=l.useState(null),Wn=zt?nt:Oe(nt,Bn),Hn=Zr(Wn,(i=pe?.rect)!=null?i:null,E),mt=l.useRef(null),Ut=l.useCallback((W,V)=>{let{sensor:q,options:me}=V;if(Y.current==null)return;const Q=w.get(Y.current);if(!Q)return;const J=W.nativeEvent,se=new q({active:Y.current,activeNode:Q,event:J,options:me,context:re,onAbort(F){if(!w.get(F))return;const{onDragAbort:oe}=X.current,ue={id:F};oe?.(ue),C({type:"onDragAbort",event:ue})},onPending(F,ve,oe,ue){if(!w.get(F))return;const{onDragPending:We}=X.current,xe={id:F,constraint:ve,initialCoordinates:oe,offset:ue};We?.(xe),C({type:"onDragPending",event:xe})},onStart(F){const ve=Y.current;if(ve==null)return;const oe=w.get(ve);if(!oe)return;const{onDragStart:ue}=X.current,Be={activatorEvent:J,active:{id:ve,data:oe.data,rect:G}};_e.unstable_batchedUpdates(()=>{ue?.(Be),b(be.Initializing),S({type:A.DragStart,initialCoordinates:F,active:ve}),C({type:"onDragStart",event:Be}),ae(mt.current),le(J)})},onMove(F){S({type:A.DragMove,coordinates:F})},onEnd:Me(A.DragEnd),onCancel:Me(A.DragCancel)});mt.current=se;function Me(F){return async function(){const{active:oe,collisions:ue,over:Be,scrollAdjustedTranslate:We}=re.current;let xe=null;if(oe&&We){const{cancelDrop:He}=X.current;xe={activatorEvent:J,active:oe,collisions:ue,delta:We,over:Be},F===A.DragEnd&&typeof He=="function"&&await Promise.resolve(He(xe))&&(F=A.DragCancel)}Y.current=null,_e.unstable_batchedUpdates(()=>{S({type:F}),b(be.Uninitialized),Xt(null),ae(null),le(null),mt.current=null;const He=F===A.DragEnd?"onDragEnd":"onDragCancel";if(xe){const vt=X.current[He];vt?.(xe),C({type:He,event:xe})}})}}},[w]),_n=l.useCallback((W,V)=>(q,me)=>{const Q=q.nativeEvent,J=w.get(me);if(Y.current!==null||!J||Q.dndKit||Q.defaultPrevented)return;const se={active:J};W(q,V.options,se)===!0&&(Q.dndKit={capturedBy:V.sensor},Y.current=me,Ut(q,V))},[w,Ut]),Kt=Rs(f,_n);Ls(f),ie(()=>{E&&k===be.Initializing&&b(be.Initialized)},[E,k]),l.useEffect(()=>{const{onDragMove:W}=X.current,{active:V,activatorEvent:q,collisions:me,over:Q}=re.current;if(!V||!q)return;const J={active:V,activatorEvent:q,collisions:me,delta:{x:Ee.x,y:Ee.y},over:Q};_e.unstable_batchedUpdates(()=>{W?.(J),C({type:"onDragMove",event:J})})},[Ee.x,Ee.y]),l.useEffect(()=>{const{active:W,activatorEvent:V,collisions:q,droppableContainers:me,scrollAdjustedTranslate:Q}=re.current;if(!W||Y.current==null||!V||!Q)return;const{onDragOver:J}=X.current,se=me.get(_t),Me=se&&se.rect.current?{id:se.id,rect:se.rect.current,data:se.data,disabled:se.disabled}:null,F={active:W,activatorEvent:V,collisions:q,delta:{x:Q.x,y:Q.y},over:Me};_e.unstable_batchedUpdates(()=>{Xt(Me),J?.(F),C({type:"onDragOver",event:F})})},[_t]),ie(()=>{re.current={activatorEvent:z,active:I,activeNode:_,collisionRect:Te,collisions:ze,droppableRects:j,draggableNodes:w,draggingNode:ke,draggingNodeRect:Ne,droppableContainers:M,over:pe,scrollableAncestors:ge,scrollAdjustedTranslate:Ee},G.current={initial:Ne,translated:Te}},[I,_,ze,Te,w,ke,Ne,j,M,pe,ge,Ee]),js({...he,delta:O,draggingRect:Te,pointerCoordinates:Wt,scrollableAncestors:ge,scrollableAncestorRects:tt});const Xn=l.useMemo(()=>({active:I,activeNode:_,activeNodeRect:E,activatorEvent:z,collisions:ze,containerNodeRect:Fe,dragOverlay:de,draggableNodes:w,droppableContainers:M,droppableRects:j,over:pe,measureDroppableContainers:$,scrollableAncestors:ge,scrollableAncestorRects:tt,measuringConfiguration:B,measuringScheduled:H,windowRect:pt}),[I,_,E,z,ze,Fe,de,w,M,j,pe,$,ge,tt,B,H,pt]),Un=l.useMemo(()=>({activatorEvent:z,activators:Kt,active:I,activeNodeRect:E,ariaDescribedById:{draggable:P},dispatch:S,draggableNodes:w,over:pe,measureDroppableContainers:$}),[z,Kt,I,E,S,P,w,pe,$]);return U.createElement(xn.Provider,{value:y},U.createElement(gt.Provider,{value:Un},U.createElement(Mn.Provider,{value:Xn},U.createElement(On.Provider,{value:Hn},u)),U.createElement(Us,{disabled:c?.restoreFocus===!1})),U.createElement(Yr,{...c,hiddenTextDescribedById:P}));function Kn(){const W=ne?.autoScrollEnabled===!1,V=typeof d=="object"?d.enabled===!1:d===!1,q=D&&!W&&!V;return typeof d=="object"?{...d,enabled:q}:{enabled:q}}}),qs=l.createContext(null),ln="button",Js="Draggable";function Qs(e){let{id:t,data:n,disabled:s=!1,attributes:o}=e;const i=Ze(Js),{activators:a,activatorEvent:c,active:d,activeNodeRect:u,ariaDescribedById:f,draggableNodes:h,over:g}=l.useContext(gt),{role:p=ln,roleDescription:R="draggable",tabIndex:m=0}=o??{},v=d?.id===t,S=l.useContext(v?On:qs),[C,y]=lt(),[k,b]=lt(),D=Is(a,t),x=Ye(n);ie(()=>(h.set(t,{id:t,key:i,node:C,activatorNode:k,data:x}),()=>{const O=h.get(t);O&&O.key===i&&h.delete(t)}),[h,t]);const w=l.useMemo(()=>({role:p,tabIndex:m,"aria-disabled":s,"aria-pressed":v&&p===ln?!0:void 0,"aria-roledescription":R,"aria-describedby":f.draggable}),[s,p,m,v,R,f.draggable]);return{active:d,activatorEvent:c,activeNodeRect:u,attributes:w,isDragging:v,listeners:s?void 0:D,node:C,over:g,setNodeRef:y,setActivatorNodeRef:b,transform:S}}function Zs(){return l.useContext(Mn)}const eo="Droppable",to={timeout:25};function no(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:o}=e;const i=Ze(eo),{active:a,dispatch:c,over:d,measureDroppableContainers:u}=l.useContext(gt),f=l.useRef({disabled:n}),h=l.useRef(!1),g=l.useRef(null),p=l.useRef(null),{disabled:R,updateMeasurementsFor:m,timeout:v}={...to,...o},S=Ye(m??s),C=l.useCallback(()=>{if(!h.current){h.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(S.current)?S.current:[S.current]),p.current=null},v)},[v]),y=ht({callback:C,disabled:R||!a}),k=l.useCallback((w,O)=>{y&&(O&&(y.unobserve(O),h.current=!1),w&&y.observe(w))},[y]),[b,D]=lt(k),x=Ye(t);return l.useEffect(()=>{!y||!b.current||(y.disconnect(),h.current=!1,y.observe(b.current))},[b,y]),l.useEffect(()=>(c({type:A.RegisterDroppable,element:{id:s,key:i,disabled:n,node:b,rect:g,data:x}}),()=>c({type:A.UnregisterDroppable,key:i,id:s})),[s]),l.useEffect(()=>{n!==f.current.disabled&&(c({type:A.SetDroppableDisabled,id:s,key:i,disabled:n}),f.current.disabled=n)},[s,i,n,c]),{active:a,rect:g,isOver:d?.id===s,node:b,over:d,setNodeRef:D}}function An(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function ro(e,t){return e.reduce((n,s,o)=>{const i=t.get(s);return i&&(n[o]=i),n},Array(e.length))}function it(e){return e!==null&&e>=0}function so(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function oo(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Ln=e=>{let{rects:t,activeIndex:n,overIndex:s,index:o}=e;const i=An(t,s,n),a=t[o],c=i[o];return!c||!a?null:{x:c.left-a.left,y:c.top-a.top,scaleX:c.width/a.width,scaleY:c.height/a.height}},In="Sortable",Pn=U.createContext({activeIndex:-1,containerId:In,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ln,disabled:{draggable:!1,droppable:!1}});function io(e){let{children:t,id:n,items:s,strategy:o=Ln,disabled:i=!1}=e;const{active:a,dragOverlay:c,droppableRects:d,over:u,measureDroppableContainers:f}=Zs(),h=Ze(In,n),g=c.rect!==null,p=l.useMemo(()=>s.map(D=>typeof D=="object"&&"id"in D?D.id:D),[s]),R=a!=null,m=a?p.indexOf(a.id):-1,v=u?p.indexOf(u.id):-1,S=l.useRef(p),C=!so(p,S.current),y=v!==-1&&m===-1||C,k=oo(i);ie(()=>{C&&R&&f(p)},[C,p,R,f]),l.useEffect(()=>{S.current=p},[p]);const b=l.useMemo(()=>({activeIndex:m,containerId:h,disabled:k,disableTransforms:y,items:p,overIndex:v,useDragOverlay:g,sortedRects:ro(p,d),strategy:o}),[m,h,k.draggable,k.droppable,y,p,v,d,g,o]);return U.createElement(Pn.Provider,{value:b},t)}const ao=e=>{let{id:t,items:n,activeIndex:s,overIndex:o}=e;return An(n,s,o).indexOf(t)},lo=e=>{let{containerId:t,isSorting:n,wasDragging:s,index:o,items:i,newIndex:a,previousItems:c,previousContainerId:d,transition:u}=e;return!u||!s||c!==i&&o===a?!1:n?!0:a!==o&&t===d},co={duration:200,easing:"ease"},$n="transform",uo=Ve.Transition.toString({property:$n,duration:0,easing:"linear"}),fo={roleDescription:"sortable"};function ho(e){let{disabled:t,index:n,node:s,rect:o}=e;const[i,a]=l.useState(null),c=l.useRef(n);return ie(()=>{if(!t&&n!==c.current&&s.current){const d=o.current;if(d){const u=$e(s.current,{ignoreTransform:!0}),f={x:d.left-u.left,y:d.top-u.top,scaleX:d.width/u.width,scaleY:d.height/u.height};(f.x||f.y)&&a(f)}}n!==c.current&&(c.current=n)},[t,n,s,o]),l.useEffect(()=>{i&&a(null)},[i]),i}function go(e){let{animateLayoutChanges:t=lo,attributes:n,disabled:s,data:o,getNewIndex:i=ao,id:a,strategy:c,resizeObserverConfig:d,transition:u=co}=e;const{items:f,containerId:h,activeIndex:g,disabled:p,disableTransforms:R,sortedRects:m,overIndex:v,useDragOverlay:S,strategy:C}=l.useContext(Pn),y=po(s,p),k=f.indexOf(a),b=l.useMemo(()=>({sortable:{containerId:h,index:k,items:f},...o}),[h,o,k,f]),D=l.useMemo(()=>f.slice(f.indexOf(a)),[f,a]),{rect:x,node:w,isOver:O,setNodeRef:M}=no({id:a,data:b,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...d}}),{active:T,activatorEvent:G,activeNodeRect:I,attributes:Y,setNodeRef:ne,listeners:ae,isDragging:z,over:le,setActivatorNodeRef:X,transform:P}=Qs({id:a,data:b,attributes:{...fo,...n},disabled:y.draggable}),De=Ir(M,ne),B=!!T,j=B&&!R&&it(g)&&it(v),$=!S&&z,H=$&&j?P:null,et=j?H??(c??C)({rects:m,activeNodeRect:I,activeIndex:g,overIndex:v,index:k}):null,he=it(g)&&it(v)?i({id:a,items:f,activeIndex:g,overIndex:v}):k,ce=T?.id,E=l.useRef({activeId:ce,items:f,newIndex:he,containerId:h}),Fe=f!==E.current.items,re=t({active:T,containerId:h,isDragging:z,isSorting:B,id:a,index:k,items:f,newIndex:E.current.newIndex,previousItems:E.current.items,previousContainerId:E.current.containerId,transition:u,wasDragging:E.current.activeId!=null}),Re=ho({disabled:!re,index:k,node:w,rect:x});return l.useEffect(()=>{B&&E.current.newIndex!==he&&(E.current.newIndex=he),h!==E.current.containerId&&(E.current.containerId=h),f!==E.current.items&&(E.current.items=f)},[B,he,h,f]),l.useEffect(()=>{if(ce===E.current.activeId)return;if(ce!=null&&E.current.activeId==null){E.current.activeId=ce;return}const ke=setTimeout(()=>{E.current.activeId=ce},50);return()=>clearTimeout(ke)},[ce]),{active:T,activeIndex:g,attributes:Y,data:b,rect:x,index:k,newIndex:he,items:f,isOver:O,isSorting:B,isDragging:z,listeners:ae,node:w,overIndex:v,over:le,setNodeRef:De,setActivatorNodeRef:X,setDroppableNodeRef:M,setDraggableNodeRef:ne,transform:Re??et,transition:de()};function de(){if(Re||Fe&&E.current.newIndex===k)return uo;if(!($&&!It(G)||!u)&&(B||re))return Ve.Transition.toString({...u,property:$n})}}function po(e,t){var n,s;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(s=e?.droppable)!=null?s:t.droppable}}N.Down,N.Right,N.Up,N.Left;const Ge=["trigger","vector","repo-all","data-safety","config","model","crew","cache-hits","time-saved","rag-health","legend"],Fn="mega-compact-card-order";function mo(e){if(!Array.isArray(e)||e.length!==Ge.length)return!1;const t=new Set(Ge),n=new Set;for(const s of e){if(typeof s!="string"||!t.has(s)||n.has(s))return!1;n.add(s)}return!0}function vo(){try{const e=window.localStorage.getItem(Fn);if(e==null)return Ge;const t=JSON.parse(e);return mo(t)?t:Ge}catch{return Ge}}function xo(){const[e,t]=l.useState(vo),n=l.useCallback((s,o)=>{t(i=>{const a=i.indexOf(s),c=i.indexOf(o);if(a===-1||c===-1||a===c)return i;const d=[...i];d.splice(a,1),d.splice(c,0,s);try{window.localStorage.setItem(Fn,JSON.stringify(d))}catch{}return d})},[]);return{order:e,moveCard:n}}function ee({id:e,children:t,onClick:n}){const{attributes:s,listeners:o,setNodeRef:i,transform:a,transition:c,isDragging:d}=go({id:e}),u={transform:Ve.Transform.toString(a),transition:c,opacity:d?.5:1,zIndex:d?10:void 0},f=h=>{n&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),n())};return r.jsxs("div",{ref:i,style:u,className:"relative",children:[r.jsx("button",{type:"button","aria-label":`Reorder ${e} card`,className:"absolute right-2 top-2 z-10 cursor-grab rounded p-1 text-muted-foreground/50 hover:bg-foreground/5 hover:text-muted-foreground active:cursor-grabbing",...s,...o,children:r.jsx(or,{size:16})}),n?r.jsx("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:f,className:"cursor-pointer rounded-lg outline-none transition-all duration-200 hover:ring-1 hover:ring-primary/60 focus-visible:ring-1 focus-visible:ring-primary/60",children:t}):r.jsx("div",{children:t})]})}function bo(e){return e.type==="session_sample"}function wo(e){switch(e){case"cache":return"cache_hit_pct";case"vector":return"turn_latency_ms";case"time":return"disk_write_ms";default:return null}}function yo(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function Eo({snapshot:e,loading:t,error:n}){const{data:s,error:o,loading:i,refetch:a}=dn(l.useCallback(()=>Yn(),[]),{pollInterval:2e3}),{events:c}=Qn(),d=l.useMemo(()=>c.filter(bo),[c]),u=l.useMemo(()=>d.length===0?null:d[d.length-1].ts,[d]);l.useEffect(()=>{u!=null&&a()},[u,a]);const[f,h]=l.useState(null),[g,p]=l.useState([]),[R,m]=l.useState(!1),[v,S]=l.useState(null);l.useEffect(()=>{p([]),S(null);const j=f?wo(f):null;if(j===null){m(!1);return}let $=!1;return m(!0),Vn(j,60).then(H=>{$||p(H.samples.map(_=>({ts:_.ts,value:_.value})))}).catch(H=>{$||S(H instanceof Error?H:new Error(String(H)))}).finally(()=>{$||m(!1)}),()=>{$=!0}},[f]);const{order:C,moveCard:y}=xo(),k=l.useCallback(j=>{const{active:$,over:H}=j;H&&$.id!==H.id&&y($.id,H.id)},[y]);if(t&&!e)return r.jsx("div",{className:"tab-stub",children:"Loading snapshot…"});if(n&&!e)return r.jsxs("div",{className:"tab-stub",children:[r.jsxs("p",{children:["Error loading snapshot: ",n.message]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Auto-retried with backoff and will re-poll every 5s — no action needed."})]});if(!e)return r.jsx("div",{className:"tab-stub",children:"No snapshot data."});const b=e,{context:D,compression:x,trigger:w,session:O,store:M,tier:T,updatedAt:G}=b,I=b.config,Y=b.crew,ne=b.integrity,ae=b.cacheHits,z=b.compacts,le=b.timeSaved,X=b.repo,P=b.model,De=l.useMemo(()=>[{label:"Tokens freed",value:x.repo.tokensFreed},{label:"Input rate",value:P?P.inputRate:0},{label:"Output rate",value:P?P.outputRate:0}],[x,P]),B=j=>{switch(j){case"trigger":return r.jsx(ee,{id:j,onClick:()=>h("cache"),children:r.jsx(xr,{armed:w.armed,ready:w.ready,currentTokens:w.currentTokens,thresholdTokens:w.thresholdTokens,fastGatePct:w.fastGatePct})});case"vector":return r.jsx(ee,{id:j,onClick:()=>h("vector"),children:r.jsx(wr,{checkpointCount:M.checkpointCount,tokensIn:x.session.tokensIn,tokensOut:x.session.tokensOut,tokensFreed:x.session.tokensFreed,injectedCount:M.injectedCount,dedupHitRate:M.dedupHitRate,storageDedupRate:M.storageDedupRate,dedupCollapsed:M.dedupCollapsed,lastCheckpointId:O.lastCheckpointId,compressionPct:x.session.compressionPct,dedupPct:x.session.dedupPct})});case"repo-all":return r.jsx(ee,{id:j,children:r.jsx(jr,{checkpointCount:X.checkpointCount,tokensIn:x.repo.tokensIn,tokensOut:x.repo.tokensOut,tokensFreed:x.repo.tokensFreed,sessionCount:X.sessionCount,dedupCollapsed:X.dedupCollapsed,storageDedupRate:X.storageDedupRate,compressionPct:x.repo.compressionPct,dedupPct:x.repo.dedupPct})});case"data-safety":return r.jsx(ee,{id:j,children:r.jsx(Sr,{regionsRetained:ne.regionsRetained,compressedOriginalBytes:ne.compressedOriginalBytes,duplicatesCollapsed:ne.duplicatesCollapsed,bytesPermanentlyDeleted:ne.bytesPermanentlyDeleted})});case"config":return r.jsx(ee,{id:j,children:r.jsx(Cr,{tier:T,presetTier:b.presetTier,pressure:b.pressure,thresholdTokens:I.thresholdTokens,tierPct:I.tierPct,contextWindow:D.contextWindow,fastGatePct:I.fastGatePct,auto:I.auto,anchorUserMessages:I.anchorUserMessages})});case"model":return P?r.jsx(ee,{id:j,onClick:()=>h("model"),children:r.jsx(Dr,{name:P.name,provider:P.providerName||P.provider,inputRate:P.inputRate,outputRate:P.outputRate,repoTokensFreed:x.repo.tokensFreed,contextWindow:D.contextWindow})}):null;case"crew":return r.jsx(ee,{id:j,children:r.jsx(Rr,{activeAgents:Y.activeAgents,currentTurn:Y.currentTurn})});case"cache-hits":return r.jsx(ee,{id:j,onClick:()=>h("cache"),children:r.jsx(er,{cacheHitsSession:ae.session,cacheHitsTotal:ae.total,tokensSavedSession:ae.sessionTokensSaved,tokensSavedTotal:ae.totalTokensSaved,compactionsSession:z.session,compactionsTotal:z.total})});case"time-saved":return r.jsx(ee,{id:j,onClick:()=>h("time"),children:r.jsx(Zn,{compactSessionSec:le.compact.sessionSec,compactTotalSec:le.compact.totalSec,cacheHitSessionSec:le.cacheHit.sessionSec,cacheHitTotalSec:le.cacheHit.totalSec})});case"rag-health":return Jn()?r.jsx(ee,{id:j,children:r.jsx(Er,{})}):null;case"legend":return r.jsx(ee,{id:j,children:r.jsx(Nr,{})})}};return r.jsxs("div",{className:"flex flex-col gap-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(qn,{variant:"accent",children:T}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["updated ",yo(G)]})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[r.jsx(vr,{sessions:s,loading:i,error:o,launcherSessionId:O.id,launcher:{tokens:D.tokens,percent:D.percent,contextWindow:D.contextWindow}}),r.jsx(ur,{sessions:s,loading:i,error:o})]}),r.jsx(Vs,{onDragEnd:k,children:r.jsx(io,{items:C,children:r.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:C.map(j=>({cardId:j,node:B(j)})).filter(({node:j})=>j!=null).map(({cardId:j,node:$})=>r.jsx("div",{children:$},j))})})}),r.jsx(ot,{title:"Cache Hits Trend",open:f==="cache",onClose:()=>h(null),children:R?r.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"Loading…"}):v?r.jsx("p",{className:"py-8 text-center text-sm text-red-400",children:v.message}):r.jsx(yt,{data:g,label:"Cache hit %",color:"#58a6ff"})}),r.jsx(ot,{title:"Turn Latency",open:f==="vector",onClose:()=>h(null),children:R?r.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"Loading…"}):v?r.jsx("p",{className:"py-8 text-center text-sm text-red-400",children:v.message}):r.jsx(yt,{data:g,label:"Turn latency (ms)",color:"#58a6ff"})}),r.jsx(ot,{title:"Disk Write Time",open:f==="time",onClose:()=>h(null),children:R?r.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"Loading…"}):v?r.jsx("p",{className:"py-8 text-center text-sm text-red-400",children:v.message}):r.jsx(yt,{data:g,label:"Disk write (ms)",color:"#58a6ff"})}),r.jsx(ot,{title:"Model & Cost",open:f==="model",onClose:()=>h(null),children:r.jsx(Lr,{data:De,color:"#3fb950",valueFormatter:j=>j.toLocaleString()})})]})}export{Eo as default};
|
|
16
|
-
//# sourceMappingURL=OverviewTab-
|
|
15
|
+
`},Gr={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Yr(e){let{announcements:t=Gr,container:n,hiddenTextDescribedById:s,screenReaderInstructions:o=Kr}=e;const{announce:i,announcement:a}=_r(),c=Ze("DndLiveRegion"),[d,u]=l.useState(!1);if(l.useEffect(()=>{u(!0)},[]),Xr(l.useMemo(()=>({onDragStart(h){let{active:g}=h;i(t.onDragStart({active:g}))},onDragMove(h){let{active:g,over:p}=h;t.onDragMove&&i(t.onDragMove({active:g,over:p}))},onDragOver(h){let{active:g,over:p}=h;i(t.onDragOver({active:g,over:p}))},onDragEnd(h){let{active:g,over:p}=h;i(t.onDragEnd({active:g,over:p}))},onDragCancel(h){let{active:g,over:p}=h;i(t.onDragCancel({active:g,over:p}))}}),[i,t])),!d)return null;const f=U.createElement(U.Fragment,null,U.createElement(Wr,{id:s,value:o.draggable}),U.createElement(Hr,{id:c,announcement:a}));return n?_e.createPortal(f,n):f}var I;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(I||(I={}));function dt(){}const te=Object.freeze({x:0,y:0});function Vr(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function qr(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Jr(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-s,c=i-n;if(s<o&&n<i){const d=t.width*t.height,u=e.width*e.height,f=a*c,h=f/(d+u-f);return Number(h.toFixed(4))}return 0}const Qr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const o=[];for(const i of s){const{id:a}=i,c=n.get(a);if(c){const d=Jr(c,t);d>0&&o.push({id:a,data:{droppableContainer:i,value:d}})}}return o.sort(Vr)};function Zr(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function bn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:te}function es(e){return function(n){for(var s=arguments.length,o=new Array(s>1?s-1:0),i=1;i<s;i++)o[i-1]=arguments[i];return o.reduce((a,c)=>({...a,top:a.top+e*c.y,bottom:a.bottom+e*c.y,left:a.left+e*c.x,right:a.right+e*c.x}),{...n})}}const ts=es(1);function ns(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function rs(e,t,n){const s=ns(t);if(!s)return e;const{scaleX:o,scaleY:i,x:a,y:c}=s,d=e.left-a-(1-o)*parseFloat(n),u=e.top-c-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,h=i?e.height/i:e.height;return{width:f,height:h,top:u,right:d+f,bottom:u+h,left:d}}const ss={ignoreTransform:!1};function $e(e,t){t===void 0&&(t=ss);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=K(e).getComputedStyle(e);u&&(n=rs(n,u,f))}const{top:s,left:o,width:i,height:a,bottom:c,right:d}=n;return{top:s,left:o,width:i,height:a,bottom:c,right:d}}function Qt(e){return $e(e,{ignoreTransform:!0})}function os(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function is(e,t){return t===void 0&&(t=K(e).getComputedStyle(e)),t.position==="fixed"}function as(e,t){t===void 0&&(t=K(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function Pt(e,t){const n=[];function s(o){if(t!=null&&n.length>=t||!o)return n;if(At(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Je(o)||mn(o)||n.includes(o))return n;const i=K(e).getComputedStyle(o);return o!==e&&as(o,i)&&n.push(o),is(o,i)?n:s(o.parentNode)}return e?s(e):n}function wn(e){const[t]=Pt(e,1);return t??null}function Ct(e){return!ft||!e?null:Ie(e)?e:Ot(e)?At(e)||e===Pe(e).scrollingElement?window:Je(e)?e:null:null}function yn(e){return Ie(e)?e.scrollX:e.scrollLeft}function jn(e){return Ie(e)?e.scrollY:e.scrollTop}function Et(e){return{x:yn(e),y:jn(e)}}var $;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})($||($={}));function Sn(e){return!ft||!e?!1:e===document.scrollingElement}function Cn(e){const t={x:0,y:0},n=Sn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,a=e.scrollTop>=s.y,c=e.scrollLeft>=s.x;return{isTop:o,isLeft:i,isBottom:a,isRight:c,maxScroll:s,minScroll:t}}const ls={x:.2,y:.2};function cs(e,t,n,s,o){let{top:i,left:a,right:c,bottom:d}=n;s===void 0&&(s=10),o===void 0&&(o=ls);const{isTop:u,isBottom:f,isLeft:h,isRight:g}=Cn(e),p={x:0,y:0},D={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!u&&i<=t.top+m.height?(p.y=$.Backward,D.y=s*Math.abs((t.top+m.height-i)/m.height)):!f&&d>=t.bottom-m.height&&(p.y=$.Forward,D.y=s*Math.abs((t.bottom-m.height-d)/m.height)),!g&&c>=t.right-m.width?(p.x=$.Forward,D.x=s*Math.abs((t.right-m.width-c)/m.width)):!h&&a<=t.left+m.width&&(p.x=$.Backward,D.x=s*Math.abs((t.left+m.width-a)/m.width)),{direction:p,speed:D}}function ds(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:t,left:n,right:s,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Dn(e){return e.reduce((t,n)=>Oe(t,Et(n)),te)}function us(e){return e.reduce((t,n)=>t+yn(n),0)}function fs(e){return e.reduce((t,n)=>t+jn(n),0)}function hs(e,t){if(t===void 0&&(t=$e),!e)return;const{top:n,left:s,bottom:o,right:i}=t(e);wn(e)&&(o<=0||i<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const gs=[["x",["left","right"],us],["y",["top","bottom"],fs]];class $t{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=Pt(n),o=Dn(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,a,c]of gs)for(const d of a)Object.defineProperty(this,d,{get:()=>{const u=c(s),f=o[i]-u;return this.rect[d]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Xe{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=t}add(t,n,s){var o;(o=this.target)==null||o.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function ps(e){const{EventTarget:t}=K(e);return e instanceof t?e:Pe(e)}function Dt(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var Q;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Q||(Q={}));function Zt(e){e.preventDefault()}function ms(e){e.stopPropagation()}var N;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(N||(N={}));const Rn={start:[N.Space,N.Enter],cancel:[N.Esc],end:[N.Space,N.Enter,N.Tab]},vs=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case N.Right:return{...n,x:n.x+25};case N.Left:return{...n,x:n.x-25};case N.Down:return{...n,y:n.y+25};case N.Up:return{...n,y:n.y-25}}};class kn{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Xe(Pe(n)),this.windowListeners=new Xe(K(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Q.Resize,this.handleCancel),this.windowListeners.add(Q.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Q.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&hs(s),n(te)}handleKeyDown(t){if(It(t)){const{active:n,context:s,options:o}=this.props,{keyboardCodes:i=Rn,coordinateGetter:a=vs,scrollBehavior:c="smooth"}=o,{code:d}=t;if(i.end.includes(d)){this.handleEnd(t);return}if(i.cancel.includes(d)){this.handleCancel(t);return}const{collisionRect:u}=s.current,f=u?{x:u.left,y:u.top}:te;this.referenceCoordinates||(this.referenceCoordinates=f);const h=a(t,{active:n,context:s.current,currentCoordinates:f});if(h){const g=ct(h,f),p={x:0,y:0},{scrollableAncestors:D}=s.current;for(const m of D){const v=t.code,{isTop:S,isRight:C,isLeft:j,isBottom:R,maxScroll:k,minScroll:b}=Cn(m),y=ds(m),x={x:Math.min(v===N.Right?y.right-y.width/2:y.right,Math.max(v===N.Right?y.left:y.left+y.width/2,h.x)),y:Math.min(v===N.Down?y.bottom-y.height/2:y.bottom,Math.max(v===N.Down?y.top:y.top+y.height/2,h.y))},M=v===N.Right&&!C||v===N.Left&&!j,O=v===N.Down&&!R||v===N.Up&&!S;if(M&&x.x!==h.x){const E=m.scrollLeft+g.x,_=v===N.Right&&E<=k.x||v===N.Left&&E>=b.x;if(_&&!g.y){m.scrollTo({left:E,behavior:c});return}_?p.x=m.scrollLeft-E:p.x=v===N.Right?m.scrollLeft-k.x:m.scrollLeft-b.x,p.x&&m.scrollBy({left:-p.x,behavior:c});break}else if(O&&x.y!==h.y){const E=m.scrollTop+g.y,_=v===N.Down&&E<=k.y||v===N.Up&&E>=b.y;if(_&&!g.x){m.scrollTo({top:E,behavior:c});return}_?p.y=m.scrollTop-E:p.y=v===N.Down?m.scrollTop-k.y:m.scrollTop-b.y,p.y&&m.scrollBy({top:-p.y,behavior:c});break}}this.handleMove(t,Oe(ct(h,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}kn.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=Rn,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(s.start.includes(a)){const c=i.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function en(e){return!!(e&&"distance"in e)}function tn(e){return!!(e&&"delay"in e)}class Ft{constructor(t,n,s){var o;s===void 0&&(s=ps(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:a}=i;this.props=t,this.events=n,this.document=Pe(a),this.documentListeners=new Xe(this.document),this.listeners=new Xe(s),this.windowListeners=new Xe(K(a)),this.initialCoordinates=(o=Nt(i))!=null?o:te,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:s}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Q.Resize,this.handleCancel),this.windowListeners.add(Q.DragStart,Zt),this.windowListeners.add(Q.VisibilityChange,this.handleCancel),this.windowListeners.add(Q.ContextMenu,Zt),this.documentListeners.add(Q.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(tn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(en(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:s,onPending:o}=this.props;o(s,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Q.Click,ms,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Q.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:o,props:i}=this,{onMove:a,options:{activationConstraint:c}}=i;if(!o)return;const d=(n=Nt(t))!=null?n:te,u=ct(o,d);if(!s&&c){if(en(c)){if(c.tolerance!=null&&Dt(u,c.tolerance))return this.handleCancel();if(Dt(u,c.distance))return this.handleStart()}if(tn(c)&&Dt(u,c.tolerance))return this.handleCancel();this.handlePending(c,u);return}t.cancelable&&t.preventDefault(),a(d)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===N.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const xs={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Nn extends Ft{constructor(t){const{event:n}=t,s=Pe(n.target);super(t,xs,s)}}Nn.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return!n.isPrimary||n.button!==0?!1:(s?.({event:n}),!0)}}];const bs={move:{name:"mousemove"},end:{name:"mouseup"}};var Tt;(function(e){e[e.RightClick=2]="RightClick"})(Tt||(Tt={}));class ws extends Ft{constructor(t){super(t,bs,Pe(t.event.target))}}ws.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===Tt.RightClick?!1:(s?.({event:n}),!0)}}];const Rt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class ys extends Ft{constructor(t){super(t,Rt)}static setup(){return window.addEventListener(Rt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Rt.move.name,t)};function t(){}}}ys.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;const{touches:o}=n;return o.length>1?!1:(s?.({event:n}),!0)}}];var Ue;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ue||(Ue={}));var ut;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ut||(ut={}));function js(e){let{acceleration:t,activator:n=Ue.Pointer,canScroll:s,draggingRect:o,enabled:i,interval:a=5,order:c=ut.TreeOrder,pointerCoordinates:d,scrollableAncestors:u,scrollableAncestorRects:f,delta:h,threshold:g}=e;const p=Cs({delta:h,disabled:!i}),[D,m]=Pr(),v=l.useRef({x:0,y:0}),S=l.useRef({x:0,y:0}),C=l.useMemo(()=>{switch(n){case Ue.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case Ue.DraggableRect:return o}},[n,o,d]),j=l.useRef(null),R=l.useCallback(()=>{const b=j.current;if(!b)return;const y=v.current.x*S.current.x,x=v.current.y*S.current.y;b.scrollBy(y,x)},[]),k=l.useMemo(()=>c===ut.TreeOrder?[...u].reverse():u,[c,u]);l.useEffect(()=>{if(!i||!u.length||!C){m();return}for(const b of k){if(s?.(b)===!1)continue;const y=u.indexOf(b),x=f[y];if(!x)continue;const{direction:M,speed:O}=cs(b,x,C,t,g);for(const E of["x","y"])p[E][M[E]]||(O[E]=0,M[E]=0);if(O.x>0||O.y>0){m(),j.current=b,D(R,a),v.current=O,S.current=M;return}}v.current={x:0,y:0},S.current={x:0,y:0},m()},[t,R,s,m,i,a,JSON.stringify(C),JSON.stringify(p),D,u,k,f,JSON.stringify(g)])}const Ss={x:{[$.Backward]:!1,[$.Forward]:!1},y:{[$.Backward]:!1,[$.Forward]:!1}};function Cs(e){let{delta:t,disabled:n}=e;const s=kt(t);return Qe(o=>{if(n||!s||!o)return Ss;const i={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[$.Backward]:o.x[$.Backward]||i.x===-1,[$.Forward]:o.x[$.Forward]||i.x===1},y:{[$.Backward]:o.y[$.Backward]||i.y===-1,[$.Forward]:o.y[$.Forward]||i.y===1}}},[n,t,s])}function Ds(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return Qe(o=>{var i;return t==null?null:(i=s??o)!=null?i:null},[s,t])}function Rs(e,t){return l.useMemo(()=>e.reduce((n,s)=>{const{sensor:o}=s,i=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,s)}));return[...n,...i]},[]),[e,t])}var qe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(qe||(qe={}));var Mt;(function(e){e.Optimized="optimized"})(Mt||(Mt={}));const nn=new Map;function ks(e,t){let{dragging:n,dependencies:s,config:o}=t;const[i,a]=l.useState(null),{frequency:c,measure:d,strategy:u}=o,f=l.useRef(e),h=v(),g=Ye(h),p=l.useCallback(function(S){S===void 0&&(S=[]),!g.current&&a(C=>C===null?S:C.concat(S.filter(j=>!C.includes(j))))},[g]),D=l.useRef(null),m=Qe(S=>{if(h&&!n)return nn;if(!S||S===nn||f.current!==e||i!=null){const C=new Map;for(let j of e){if(!j)continue;if(i&&i.length>0&&!i.includes(j.id)&&j.rect.current){C.set(j.id,j.rect.current);continue}const R=j.node.current,k=R?new $t(d(R),R):null;j.rect.current=k,k&&C.set(j.id,k)}return C}return S},[e,i,n,h,d]);return l.useEffect(()=>{f.current=e},[e]),l.useEffect(()=>{h||p()},[n,h]),l.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),l.useEffect(()=>{h||typeof c!="number"||D.current!==null||(D.current=setTimeout(()=>{p(),D.current=null},c))},[c,h,p,...s]),{droppableRects:m,measureDroppableContainers:p,measuringScheduled:i!=null};function v(){switch(u){case qe.Always:return!1;case qe.BeforeDragging:return n;default:return!n}}}function En(e,t){return Qe(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Ns(e,t){return En(e,t)}function Es(e){let{callback:t,disabled:n}=e;const s=Lt(t),o=l.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(s)},[s,n]);return l.useEffect(()=>()=>o?.disconnect(),[o]),o}function ht(e){let{callback:t,disabled:n}=e;const s=Lt(t),o=l.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(s)},[n]);return l.useEffect(()=>()=>o?.disconnect(),[o]),o}function Ts(e){return new $t($e(e),e)}function rn(e,t,n){t===void 0&&(t=Ts);const[s,o]=l.useState(null);function i(){o(d=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=d??n)!=null?u:null}const f=t(e);return JSON.stringify(d)===JSON.stringify(f)?d:f})}const a=Es({callback(d){if(e)for(const u of d){const{type:f,target:h}=u;if(f==="childList"&&h instanceof HTMLElement&&h.contains(e)){i();break}}}}),c=ht({callback:i});return ie(()=>{i(),e?(c?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),a?.disconnect())},[e]),s}function Ms(e){const t=En(e);return bn(e,t)}const sn=[];function Os(e){const t=l.useRef(e),n=Qe(s=>e?s&&s!==sn&&e&&t.current&&e.parentNode===t.current.parentNode?s:Pt(e):sn,[e]);return l.useEffect(()=>{t.current=e},[e]),n}function As(e){const[t,n]=l.useState(null),s=l.useRef(e),o=l.useCallback(i=>{const a=Ct(i.target);a&&n(c=>c?(c.set(a,Et(a)),new Map(c)):null)},[]);return l.useEffect(()=>{const i=s.current;if(e!==i){a(i);const c=e.map(d=>{const u=Ct(d);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,Et(u)]):null}).filter(d=>d!=null);n(c.length?new Map(c):null),s.current=e}return()=>{a(e),a(i)};function a(c){c.forEach(d=>{const u=Ct(d);u?.removeEventListener("scroll",o)})}},[o,e]),l.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>Oe(i,a),te):Dn(e):te,[e,t])}function on(e,t){t===void 0&&(t=[]);const n=l.useRef(null);return l.useEffect(()=>{n.current=null},t),l.useEffect(()=>{const s=e!==te;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?ct(e,n.current):te}function Ls(e){l.useEffect(()=>{if(!ft)return;const t=e.map(n=>{let{sensor:s}=n;return s.setup==null?void 0:s.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Is(e,t){return l.useMemo(()=>e.reduce((n,s)=>{let{eventName:o,handler:i}=s;return n[o]=a=>{i(a,t)},n},{}),[e,t])}function Tn(e){return l.useMemo(()=>e?os(e):null,[e])}const an=[];function Ps(e,t){t===void 0&&(t=$e);const[n]=e,s=Tn(n?K(n):null),[o,i]=l.useState(an);function a(){i(()=>e.length?e.map(d=>Sn(d)?s:new $t(t(d),d)):an)}const c=ht({callback:a});return ie(()=>{c?.disconnect(),a(),e.forEach(d=>c?.observe(d))},[e]),o}function $s(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Je(t)?t:e}function Fs(e){let{measure:t}=e;const[n,s]=l.useState(null),o=l.useCallback(u=>{for(const{target:f}of u)if(Je(f)){s(h=>{const g=t(f);return h?{...h,width:g.width,height:g.height}:g});break}},[t]),i=ht({callback:o}),a=l.useCallback(u=>{const f=$s(u);i?.disconnect(),f&&i?.observe(f),s(f?t(f):null)},[t,i]),[c,d]=lt(a);return l.useMemo(()=>({nodeRef:c,rect:n,setRef:d}),[n,c,d])}const zs=[{sensor:Nn,options:{}},{sensor:kn,options:{}}],Bs={current:{}},at={draggable:{measure:Qt},droppable:{measure:Qt,strategy:qe.WhileDragging,frequency:Mt.Optimized},dragOverlay:{measure:$e}};class Ke extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,s;return(n=(s=this.get(t))==null?void 0:s.node.current)!=null?n:void 0}}const Ws={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ke,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:dt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:at,measureDroppableContainers:dt,windowRect:null,measuringScheduled:!1},Hs={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:dt,draggableNodes:new Map,over:null,measureDroppableContainers:dt},gt=l.createContext(Hs),Mn=l.createContext(Ws);function _s(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ke}}}function Xs(e,t){switch(t.type){case I.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case I.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case I.DragEnd:case I.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case I.RegisterDroppable:{const{element:n}=t,{id:s}=n,o=new Ke(e.droppable.containers);return o.set(s,n),{...e,droppable:{...e.droppable,containers:o}}}case I.SetDroppableDisabled:{const{id:n,key:s,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||s!==i.key)return e;const a=new Ke(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case I.UnregisterDroppable:{const{id:n,key:s}=t,o=e.droppable.containers.get(n);if(!o||s!==o.key)return e;const i=new Ke(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Us(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:o}=l.useContext(gt),i=kt(s),a=kt(n?.id);return l.useEffect(()=>{if(!t&&!s&&i&&a!=null){if(!It(i)||document.activeElement===i.target)return;const c=o.get(a);if(!c)return;const{activatorNode:d,node:u}=c;if(!d.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[d.current,u.current]){if(!f)continue;const h=zr(f);if(h){h.focus();break}}})}},[s,t,o,a,i]),null}function Ks(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...s}),n):n}function Gs(e){return l.useMemo(()=>({draggable:{...at.draggable,...e?.draggable},droppable:{...at.droppable,...e?.droppable},dragOverlay:{...at.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ys(e){let{activeNode:t,measure:n,initialRect:s,config:o=!0}=e;const i=l.useRef(!1),{x:a,y:c}=typeof o=="boolean"?{x:o,y:o}:o;ie(()=>{if(!a&&!c||!t){i.current=!1;return}if(i.current||!s)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const f=n(u),h=bn(f,s);if(a||(h.x=0),c||(h.y=0),i.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const g=wn(u);g&&g.scrollBy({top:h.y,left:h.x})}},[t,a,c,s,n])}const On=l.createContext({...te,scaleX:1,scaleY:1});var be;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(be||(be={}));const Vs=l.memo(function(t){var n,s,o,i;let{id:a,accessibility:c,autoScroll:d=!0,children:u,sensors:f=zs,collisionDetection:h=Qr,measuring:g,modifiers:p,...D}=t;const m=l.useReducer(Xs,void 0,_s),[v,S]=m,[C,j]=Ur(),[R,k]=l.useState(be.Uninitialized),b=R===be.Initialized,{draggable:{active:y,nodes:x,translate:M},droppable:{containers:O}}=v,E=y!=null?x.get(y):null,_=l.useRef({initial:null,translated:null}),G=l.useMemo(()=>{var W;return y!=null?{id:y,data:(W=E?.data)!=null?W:Bs,rect:_}:null},[y,E]),z=l.useRef(null),[fe,ae]=l.useState(null),[P,je]=l.useState(null),X=Ye(D,Object.values(D)),ne=Ze("DndDescribedBy",a),Z=l.useMemo(()=>O.getEnabled(),[O]),B=Gs(g),{droppableRects:w,measureDroppableContainers:L,measuringScheduled:A}=ks(Z,{dragging:b,dependencies:[M.x,M.y],config:B.droppable}),H=Ds(x,y),et=l.useMemo(()=>P?Nt(P):null,[P]),he=Kn(),le=Ns(H,B.draggable.measure);Ys({activeNode:y!=null?x.get(y):null,config:he.layoutShiftCompensation,initialRect:le,measure:B.draggable.measure});const T=rn(H,B.draggable.measure,le),Fe=rn(H?H.parentElement:null),re=l.useRef({activatorEvent:null,active:null,activeNode:H,collisionRect:null,collisions:null,droppableRects:w,draggableNodes:x,draggingNode:null,draggingNodeRect:null,droppableContainers:O,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Re=O.getNodeFor((n=re.current.over)==null?void 0:n.id),ce=Fs({measure:B.dragOverlay.measure}),ke=(s=ce.nodeRef.current)!=null?s:H,Ne=b?(o=ce.rect)!=null?o:T:null,zt=!!(ce.nodeRef.current&&ce.rect),Bt=Ms(zt?null:T),pt=Tn(ke?K(ke):null),ge=Os(b?Re??H:null),tt=Ps(ge),nt=Ks(p,{transform:{x:M.x-Bt.x,y:M.y-Bt.y,scaleX:1,scaleY:1},activatorEvent:P,active:G,activeNodeRect:T,containerNodeRect:Fe,draggingNodeRect:Ne,over:re.current.over,overlayNodeRect:ce.rect,scrollableAncestors:ge,scrollableAncestorRects:tt,windowRect:pt}),Wt=et?Oe(et,M):null,Ht=As(ge),zn=on(Ht),Bn=on(Ht,[T]),Ee=Oe(nt,zn),Te=Ne?ts(Ne,nt):null,ze=G&&Te?h({active:G,collisionRect:Te,droppableRects:w,droppableContainers:Z,pointerCoordinates:Wt}):null,_t=qr(ze,"id"),[pe,Xt]=l.useState(null),Wn=zt?nt:Oe(nt,Bn),Hn=Zr(Wn,(i=pe?.rect)!=null?i:null,T),mt=l.useRef(null),Ut=l.useCallback((W,Y)=>{let{sensor:V,options:me}=Y;if(z.current==null)return;const J=x.get(z.current);if(!J)return;const q=W.nativeEvent,se=new V({active:z.current,activeNode:J,event:q,options:me,context:re,onAbort(F){if(!x.get(F))return;const{onDragAbort:oe}=X.current,de={id:F};oe?.(de),C({type:"onDragAbort",event:de})},onPending(F,ve,oe,de){if(!x.get(F))return;const{onDragPending:We}=X.current,xe={id:F,constraint:ve,initialCoordinates:oe,offset:de};We?.(xe),C({type:"onDragPending",event:xe})},onStart(F){const ve=z.current;if(ve==null)return;const oe=x.get(ve);if(!oe)return;const{onDragStart:de}=X.current,Be={activatorEvent:q,active:{id:ve,data:oe.data,rect:_}};_e.unstable_batchedUpdates(()=>{de?.(Be),k(be.Initializing),S({type:I.DragStart,initialCoordinates:F,active:ve}),C({type:"onDragStart",event:Be}),ae(mt.current),je(q)})},onMove(F){S({type:I.DragMove,coordinates:F})},onEnd:Me(I.DragEnd),onCancel:Me(I.DragCancel)});mt.current=se;function Me(F){return async function(){const{active:oe,collisions:de,over:Be,scrollAdjustedTranslate:We}=re.current;let xe=null;if(oe&&We){const{cancelDrop:He}=X.current;xe={activatorEvent:q,active:oe,collisions:de,delta:We,over:Be},F===I.DragEnd&&typeof He=="function"&&await Promise.resolve(He(xe))&&(F=I.DragCancel)}z.current=null,_e.unstable_batchedUpdates(()=>{S({type:F}),k(be.Uninitialized),Xt(null),ae(null),je(null),mt.current=null;const He=F===I.DragEnd?"onDragEnd":"onDragCancel";if(xe){const vt=X.current[He];vt?.(xe),C({type:He,event:xe})}})}}},[x]),_n=l.useCallback((W,Y)=>(V,me)=>{const J=V.nativeEvent,q=x.get(me);if(z.current!==null||!q||J.dndKit||J.defaultPrevented)return;const se={active:q};W(V,Y.options,se)===!0&&(J.dndKit={capturedBy:Y.sensor},z.current=me,Ut(V,Y))},[x,Ut]),Kt=Rs(f,_n);Ls(f),ie(()=>{T&&R===be.Initializing&&k(be.Initialized)},[T,R]),l.useEffect(()=>{const{onDragMove:W}=X.current,{active:Y,activatorEvent:V,collisions:me,over:J}=re.current;if(!Y||!V)return;const q={active:Y,activatorEvent:V,collisions:me,delta:{x:Ee.x,y:Ee.y},over:J};_e.unstable_batchedUpdates(()=>{W?.(q),C({type:"onDragMove",event:q})})},[Ee.x,Ee.y]),l.useEffect(()=>{const{active:W,activatorEvent:Y,collisions:V,droppableContainers:me,scrollAdjustedTranslate:J}=re.current;if(!W||z.current==null||!Y||!J)return;const{onDragOver:q}=X.current,se=me.get(_t),Me=se&&se.rect.current?{id:se.id,rect:se.rect.current,data:se.data,disabled:se.disabled}:null,F={active:W,activatorEvent:Y,collisions:V,delta:{x:J.x,y:J.y},over:Me};_e.unstable_batchedUpdates(()=>{Xt(Me),q?.(F),C({type:"onDragOver",event:F})})},[_t]),ie(()=>{re.current={activatorEvent:P,active:G,activeNode:H,collisionRect:Te,collisions:ze,droppableRects:w,draggableNodes:x,draggingNode:ke,draggingNodeRect:Ne,droppableContainers:O,over:pe,scrollableAncestors:ge,scrollAdjustedTranslate:Ee},_.current={initial:Ne,translated:Te}},[G,H,ze,Te,x,ke,Ne,w,O,pe,ge,Ee]),js({...he,delta:M,draggingRect:Te,pointerCoordinates:Wt,scrollableAncestors:ge,scrollableAncestorRects:tt});const Xn=l.useMemo(()=>({active:G,activeNode:H,activeNodeRect:T,activatorEvent:P,collisions:ze,containerNodeRect:Fe,dragOverlay:ce,draggableNodes:x,droppableContainers:O,droppableRects:w,over:pe,measureDroppableContainers:L,scrollableAncestors:ge,scrollableAncestorRects:tt,measuringConfiguration:B,measuringScheduled:A,windowRect:pt}),[G,H,T,P,ze,Fe,ce,x,O,w,pe,L,ge,tt,B,A,pt]),Un=l.useMemo(()=>({activatorEvent:P,activators:Kt,active:G,activeNodeRect:T,ariaDescribedById:{draggable:ne},dispatch:S,draggableNodes:x,over:pe,measureDroppableContainers:L}),[P,Kt,G,T,S,ne,x,pe,L]);return U.createElement(xn.Provider,{value:j},U.createElement(gt.Provider,{value:Un},U.createElement(Mn.Provider,{value:Xn},U.createElement(On.Provider,{value:Hn},u)),U.createElement(Us,{disabled:c?.restoreFocus===!1})),U.createElement(Yr,{...c,hiddenTextDescribedById:ne}));function Kn(){const W=fe?.autoScrollEnabled===!1,Y=typeof d=="object"?d.enabled===!1:d===!1,V=b&&!W&&!Y;return typeof d=="object"?{...d,enabled:V}:{enabled:V}}}),qs=l.createContext(null),ln="button",Js="Draggable";function Qs(e){let{id:t,data:n,disabled:s=!1,attributes:o}=e;const i=Ze(Js),{activators:a,activatorEvent:c,active:d,activeNodeRect:u,ariaDescribedById:f,draggableNodes:h,over:g}=l.useContext(gt),{role:p=ln,roleDescription:D="draggable",tabIndex:m=0}=o??{},v=d?.id===t,S=l.useContext(v?On:qs),[C,j]=lt(),[R,k]=lt(),b=Is(a,t),y=Ye(n);ie(()=>(h.set(t,{id:t,key:i,node:C,activatorNode:R,data:y}),()=>{const M=h.get(t);M&&M.key===i&&h.delete(t)}),[h,t]);const x=l.useMemo(()=>({role:p,tabIndex:m,"aria-disabled":s,"aria-pressed":v&&p===ln?!0:void 0,"aria-roledescription":D,"aria-describedby":f.draggable}),[s,p,m,v,D,f.draggable]);return{active:d,activatorEvent:c,activeNodeRect:u,attributes:x,isDragging:v,listeners:s?void 0:b,node:C,over:g,setNodeRef:j,setActivatorNodeRef:k,transform:S}}function Zs(){return l.useContext(Mn)}const eo="Droppable",to={timeout:25};function no(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:o}=e;const i=Ze(eo),{active:a,dispatch:c,over:d,measureDroppableContainers:u}=l.useContext(gt),f=l.useRef({disabled:n}),h=l.useRef(!1),g=l.useRef(null),p=l.useRef(null),{disabled:D,updateMeasurementsFor:m,timeout:v}={...to,...o},S=Ye(m??s),C=l.useCallback(()=>{if(!h.current){h.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(S.current)?S.current:[S.current]),p.current=null},v)},[v]),j=ht({callback:C,disabled:D||!a}),R=l.useCallback((x,M)=>{j&&(M&&(j.unobserve(M),h.current=!1),x&&j.observe(x))},[j]),[k,b]=lt(R),y=Ye(t);return l.useEffect(()=>{!j||!k.current||(j.disconnect(),h.current=!1,j.observe(k.current))},[k,j]),l.useEffect(()=>(c({type:I.RegisterDroppable,element:{id:s,key:i,disabled:n,node:k,rect:g,data:y}}),()=>c({type:I.UnregisterDroppable,key:i,id:s})),[s]),l.useEffect(()=>{n!==f.current.disabled&&(c({type:I.SetDroppableDisabled,id:s,key:i,disabled:n}),f.current.disabled=n)},[s,i,n,c]),{active:a,rect:g,isOver:d?.id===s,node:k,over:d,setNodeRef:b}}function An(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function ro(e,t){return e.reduce((n,s,o)=>{const i=t.get(s);return i&&(n[o]=i),n},Array(e.length))}function it(e){return e!==null&&e>=0}function so(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function oo(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Ln=e=>{let{rects:t,activeIndex:n,overIndex:s,index:o}=e;const i=An(t,s,n),a=t[o],c=i[o];return!c||!a?null:{x:c.left-a.left,y:c.top-a.top,scaleX:c.width/a.width,scaleY:c.height/a.height}},In="Sortable",Pn=U.createContext({activeIndex:-1,containerId:In,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ln,disabled:{draggable:!1,droppable:!1}});function io(e){let{children:t,id:n,items:s,strategy:o=Ln,disabled:i=!1}=e;const{active:a,dragOverlay:c,droppableRects:d,over:u,measureDroppableContainers:f}=Zs(),h=Ze(In,n),g=c.rect!==null,p=l.useMemo(()=>s.map(b=>typeof b=="object"&&"id"in b?b.id:b),[s]),D=a!=null,m=a?p.indexOf(a.id):-1,v=u?p.indexOf(u.id):-1,S=l.useRef(p),C=!so(p,S.current),j=v!==-1&&m===-1||C,R=oo(i);ie(()=>{C&&D&&f(p)},[C,p,D,f]),l.useEffect(()=>{S.current=p},[p]);const k=l.useMemo(()=>({activeIndex:m,containerId:h,disabled:R,disableTransforms:j,items:p,overIndex:v,useDragOverlay:g,sortedRects:ro(p,d),strategy:o}),[m,h,R.draggable,R.droppable,j,p,v,d,g,o]);return U.createElement(Pn.Provider,{value:k},t)}const ao=e=>{let{id:t,items:n,activeIndex:s,overIndex:o}=e;return An(n,s,o).indexOf(t)},lo=e=>{let{containerId:t,isSorting:n,wasDragging:s,index:o,items:i,newIndex:a,previousItems:c,previousContainerId:d,transition:u}=e;return!u||!s||c!==i&&o===a?!1:n?!0:a!==o&&t===d},co={duration:200,easing:"ease"},$n="transform",uo=Ve.Transition.toString({property:$n,duration:0,easing:"linear"}),fo={roleDescription:"sortable"};function ho(e){let{disabled:t,index:n,node:s,rect:o}=e;const[i,a]=l.useState(null),c=l.useRef(n);return ie(()=>{if(!t&&n!==c.current&&s.current){const d=o.current;if(d){const u=$e(s.current,{ignoreTransform:!0}),f={x:d.left-u.left,y:d.top-u.top,scaleX:d.width/u.width,scaleY:d.height/u.height};(f.x||f.y)&&a(f)}}n!==c.current&&(c.current=n)},[t,n,s,o]),l.useEffect(()=>{i&&a(null)},[i]),i}function go(e){let{animateLayoutChanges:t=lo,attributes:n,disabled:s,data:o,getNewIndex:i=ao,id:a,strategy:c,resizeObserverConfig:d,transition:u=co}=e;const{items:f,containerId:h,activeIndex:g,disabled:p,disableTransforms:D,sortedRects:m,overIndex:v,useDragOverlay:S,strategy:C}=l.useContext(Pn),j=po(s,p),R=f.indexOf(a),k=l.useMemo(()=>({sortable:{containerId:h,index:R,items:f},...o}),[h,o,R,f]),b=l.useMemo(()=>f.slice(f.indexOf(a)),[f,a]),{rect:y,node:x,isOver:M,setNodeRef:O}=no({id:a,data:k,disabled:j.droppable,resizeObserverConfig:{updateMeasurementsFor:b,...d}}),{active:E,activatorEvent:_,activeNodeRect:G,attributes:z,setNodeRef:fe,listeners:ae,isDragging:P,over:je,setActivatorNodeRef:X,transform:ne}=Qs({id:a,data:k,attributes:{...fo,...n},disabled:j.draggable}),Z=Ir(O,fe),B=!!E,w=B&&!D&&it(g)&&it(v),L=!S&&P,A=L&&w?ne:null,et=w?A??(c??C)({rects:m,activeNodeRect:G,activeIndex:g,overIndex:v,index:R}):null,he=it(g)&&it(v)?i({id:a,items:f,activeIndex:g,overIndex:v}):R,le=E?.id,T=l.useRef({activeId:le,items:f,newIndex:he,containerId:h}),Fe=f!==T.current.items,re=t({active:E,containerId:h,isDragging:P,isSorting:B,id:a,index:R,items:f,newIndex:T.current.newIndex,previousItems:T.current.items,previousContainerId:T.current.containerId,transition:u,wasDragging:T.current.activeId!=null}),Re=ho({disabled:!re,index:R,node:x,rect:y});return l.useEffect(()=>{B&&T.current.newIndex!==he&&(T.current.newIndex=he),h!==T.current.containerId&&(T.current.containerId=h),f!==T.current.items&&(T.current.items=f)},[B,he,h,f]),l.useEffect(()=>{if(le===T.current.activeId)return;if(le!=null&&T.current.activeId==null){T.current.activeId=le;return}const ke=setTimeout(()=>{T.current.activeId=le},50);return()=>clearTimeout(ke)},[le]),{active:E,activeIndex:g,attributes:z,data:k,rect:y,index:R,newIndex:he,items:f,isOver:M,isSorting:B,isDragging:P,listeners:ae,node:x,overIndex:v,over:je,setNodeRef:Z,setActivatorNodeRef:X,setDroppableNodeRef:O,setDraggableNodeRef:fe,transform:Re??et,transition:ce()};function ce(){if(Re||Fe&&T.current.newIndex===R)return uo;if(!(L&&!It(_)||!u)&&(B||re))return Ve.Transition.toString({...u,property:$n})}}function po(e,t){var n,s;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(s=e?.droppable)!=null?s:t.droppable}}N.Down,N.Right,N.Up,N.Left;const Ge=["trigger","vector","repo-all","data-safety","config","model","crew","cache-hits","time-saved","rag-health","legend"],Fn="mega-compact-card-order";function mo(e){if(!Array.isArray(e)||e.length!==Ge.length)return!1;const t=new Set(Ge),n=new Set;for(const s of e){if(typeof s!="string"||!t.has(s)||n.has(s))return!1;n.add(s)}return!0}function vo(){try{const e=window.localStorage.getItem(Fn);if(e==null)return Ge;const t=JSON.parse(e);return mo(t)?t:Ge}catch{return Ge}}function xo(){const[e,t]=l.useState(vo),n=l.useCallback((s,o)=>{t(i=>{const a=i.indexOf(s),c=i.indexOf(o);if(a===-1||c===-1||a===c)return i;const d=[...i];d.splice(a,1),d.splice(c,0,s);try{window.localStorage.setItem(Fn,JSON.stringify(d))}catch{}return d})},[]);return{order:e,moveCard:n}}function ee({id:e,children:t,onClick:n}){const{attributes:s,listeners:o,setNodeRef:i,transform:a,transition:c,isDragging:d}=go({id:e}),u={transform:Ve.Transform.toString(a),transition:c,opacity:d?.5:1,zIndex:d?10:void 0},f=h=>{n&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),n())};return r.jsxs("div",{ref:i,style:u,className:"relative",children:[r.jsx("button",{type:"button","aria-label":`Reorder ${e} card`,className:"absolute right-2 top-2 z-10 cursor-grab rounded p-1 text-muted-foreground/50 hover:bg-foreground/5 hover:text-muted-foreground active:cursor-grabbing",...s,...o,children:r.jsx(or,{size:16})}),n?r.jsx("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:f,className:"cursor-pointer rounded-lg outline-none transition-all duration-200 hover:ring-1 hover:ring-primary/60 focus-visible:ring-1 focus-visible:ring-primary/60",children:t}):r.jsx("div",{children:t})]})}function bo(e){return e.type==="session_sample"}function wo(e){switch(e){case"cache":return"cache_hit_pct";case"vector":return"turn_latency_ms";case"time":return"disk_write_ms";default:return null}}function yo(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function Eo({snapshot:e,loading:t,error:n}){const{data:s,error:o,loading:i,refetch:a}=dn(l.useCallback(()=>Yn(),[]),{pollInterval:2e3}),{events:c}=Qn(),d=l.useMemo(()=>c.filter(bo),[c]),u=l.useMemo(()=>d.length===0?null:d[d.length-1].ts,[d]);l.useEffect(()=>{u!=null&&a()},[u,a]);const[f,h]=l.useState(null),[g,p]=l.useState([]),[D,m]=l.useState(!1),[v,S]=l.useState(null);l.useEffect(()=>{p([]),S(null);const w=f?wo(f):null;if(w===null){m(!1);return}let L=!1;return m(!0),Vn(w,60).then(A=>{L||p(A.samples.map(H=>({ts:H.ts,value:H.value})))}).catch(A=>{L||S(A instanceof Error?A:new Error(String(A)))}).finally(()=>{L||m(!1)}),()=>{L=!0}},[f]);const{order:C,moveCard:j}=xo(),R=l.useCallback(w=>{const{active:L,over:A}=w;A&&L.id!==A.id&&j(L.id,A.id)},[j]),k=l.useMemo(()=>{const w=e,L=w?.compression,A=w?.model;return[{label:"Tokens freed",value:L?.repo.tokensFreed??0},{label:"Input rate",value:A?A.inputRate:0},{label:"Output rate",value:A?A.outputRate:0}]},[e]);if(t&&!e)return r.jsx("div",{className:"tab-stub",children:"Loading snapshot…"});if(n&&!e)return r.jsxs("div",{className:"tab-stub",children:[r.jsxs("p",{children:["Error loading snapshot: ",n.message]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Auto-retried with backoff and will re-poll every 5s — no action needed."})]});if(!e)return r.jsx("div",{className:"tab-stub",children:"No snapshot data."});const b=e,{context:y,compression:x,trigger:M,session:O,store:E,tier:_,updatedAt:G}=b,z=b.config,fe=b.crew,ae=b.integrity,P=b.cacheHits,je=b.compacts,X=b.timeSaved,ne=b.repo,Z=b.model,B=w=>{switch(w){case"trigger":return r.jsx(ee,{id:w,onClick:()=>h("cache"),children:r.jsx(xr,{armed:M.armed,ready:M.ready,currentTokens:M.currentTokens,thresholdTokens:M.thresholdTokens,fastGatePct:M.fastGatePct})});case"vector":return r.jsx(ee,{id:w,onClick:()=>h("vector"),children:r.jsx(wr,{checkpointCount:E.checkpointCount,tokensIn:x.session.tokensIn,tokensOut:x.session.tokensOut,tokensFreed:x.session.tokensFreed,injectedCount:E.injectedCount,dedupHitRate:E.dedupHitRate,storageDedupRate:E.storageDedupRate,dedupCollapsed:E.dedupCollapsed,lastCheckpointId:O.lastCheckpointId,compressionPct:x.session.compressionPct,dedupPct:x.session.dedupPct})});case"repo-all":return r.jsx(ee,{id:w,children:r.jsx(jr,{checkpointCount:ne.checkpointCount,tokensIn:x.repo.tokensIn,tokensOut:x.repo.tokensOut,tokensFreed:x.repo.tokensFreed,sessionCount:ne.sessionCount,dedupCollapsed:ne.dedupCollapsed,storageDedupRate:ne.storageDedupRate,compressionPct:x.repo.compressionPct,dedupPct:x.repo.dedupPct})});case"data-safety":return r.jsx(ee,{id:w,children:r.jsx(Sr,{regionsRetained:ae.regionsRetained,compressedOriginalBytes:ae.compressedOriginalBytes,duplicatesCollapsed:ae.duplicatesCollapsed,bytesPermanentlyDeleted:ae.bytesPermanentlyDeleted})});case"config":return r.jsx(ee,{id:w,children:r.jsx(Cr,{tier:_,presetTier:b.presetTier,pressure:b.pressure,thresholdTokens:z.thresholdTokens,tierPct:z.tierPct,contextWindow:y.contextWindow,fastGatePct:z.fastGatePct,auto:z.auto,anchorUserMessages:z.anchorUserMessages})});case"model":return Z?r.jsx(ee,{id:w,onClick:()=>h("model"),children:r.jsx(Dr,{name:Z.name,provider:Z.providerName||Z.provider,inputRate:Z.inputRate,outputRate:Z.outputRate,repoTokensFreed:x.repo.tokensFreed,contextWindow:y.contextWindow})}):null;case"crew":return r.jsx(ee,{id:w,children:r.jsx(Rr,{activeAgents:fe.activeAgents,currentTurn:fe.currentTurn})});case"cache-hits":return r.jsx(ee,{id:w,onClick:()=>h("cache"),children:r.jsx(er,{cacheHitsSession:P.session,cacheHitsTotal:P.total,tokensSavedSession:P.sessionTokensSaved,tokensSavedTotal:P.totalTokensSaved,compactionsSession:je.session,compactionsTotal:je.total})});case"time-saved":return r.jsx(ee,{id:w,onClick:()=>h("time"),children:r.jsx(Zn,{compactSessionSec:X.compact.sessionSec,compactTotalSec:X.compact.totalSec,cacheHitSessionSec:X.cacheHit.sessionSec,cacheHitTotalSec:X.cacheHit.totalSec})});case"rag-health":return Jn()?r.jsx(ee,{id:w,children:r.jsx(Er,{})}):null;case"legend":return r.jsx(ee,{id:w,children:r.jsx(Nr,{})})}};return r.jsxs("div",{className:"flex flex-col gap-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(qn,{variant:"accent",children:_}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["updated ",yo(G)]})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[r.jsx(vr,{sessions:s,loading:i,error:o,launcherSessionId:O.id,launcher:{tokens:y.tokens,percent:y.percent,contextWindow:y.contextWindow}}),r.jsx(ur,{sessions:s,loading:i,error:o})]}),r.jsx(Vs,{onDragEnd:R,children:r.jsx(io,{items:C,children:r.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:C.map(w=>({cardId:w,node:B(w)})).filter(({node:w})=>w!=null).map(({cardId:w,node:L})=>r.jsx("div",{children:L},w))})})}),r.jsx(ot,{title:"Cache Hits Trend",open:f==="cache",onClose:()=>h(null),children:D?r.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"Loading…"}):v?r.jsx("p",{className:"py-8 text-center text-sm text-red-400",children:v.message}):r.jsx(yt,{data:g,label:"Cache hit %",color:"#58a6ff"})}),r.jsx(ot,{title:"Turn Latency",open:f==="vector",onClose:()=>h(null),children:D?r.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"Loading…"}):v?r.jsx("p",{className:"py-8 text-center text-sm text-red-400",children:v.message}):r.jsx(yt,{data:g,label:"Turn latency (ms)",color:"#58a6ff"})}),r.jsx(ot,{title:"Disk Write Time",open:f==="time",onClose:()=>h(null),children:D?r.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"Loading…"}):v?r.jsx("p",{className:"py-8 text-center text-sm text-red-400",children:v.message}):r.jsx(yt,{data:g,label:"Disk write (ms)",color:"#58a6ff"})}),r.jsx(ot,{title:"Model & Cost",open:f==="model",onClose:()=>h(null),children:r.jsx(Lr,{data:k,color:"#3fb950",valueFormatter:w=>w.toLocaleString()})})]})}export{Eo as default};
|
|
16
|
+
//# sourceMappingURL=OverviewTab-B0YDSSMH.js.map
|