selftune 0.2.26 → 0.2.27
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/apps/local-dashboard/dist/assets/{index-BIZDNtRp.js → index-bvHYAGBm.js} +8 -8
- package/apps/local-dashboard/dist/index.html +1 -1
- package/cli/selftune/dashboard-server.ts +46 -14
- package/package.json +1 -1
- package/packages/dashboard-core/src/screens/overview/OverviewCompositionSurface.test.tsx +1 -0
- package/packages/dashboard-core/src/screens/overview/OverviewCompositionSurface.tsx +1 -1
- package/packages/dashboard-core/src/screens/skill-report/SkillReportScaffold.tsx +5 -1
- package/skill/SKILL.md +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./rolldown-runtime-Dw2cE7zH.js";import{a as r,c as i,d as a,i as o,l as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./vendor-react-C5oyHiV1.js";import{$ as h,A as g,At as _,B as v,C as y,Ct as b,D as x,Dt as S,E as C,Et as w,F as T,G as E,H as D,I as O,J as ee,K as te,L as ne,M as k,Mt as re,N as ie,Nt as ae,O as oe,Ot as se,P as ce,Q as le,R as ue,S as de,St as fe,T as pe,Tt as me,U as he,V as ge,W as _e,X as ve,Y as ye,Z as be,_ as xe,_t as Se,a as Ce,at as we,b as Te,bt as Ee,c as De,ct as Oe,d as ke,dt as Ae,et as je,ft as Me,g as Ne,gt as Pe,ht as Fe,i as Ie,it as Le,j as Re,jt as ze,k as Be,kt as Ve,l as He,lt as Ue,mt as We,n as Ge,nt as Ke,o as qe,ot as Je,pt as Ye,q as Xe,r as Ze,rt as Qe,s as $e,st as et,t as tt,tt as nt,u as rt,ut as it,v as at,vt as ot,w as st,wt as ct,x as lt,xt as ut,y as dt,yt as ft,z as pt}from"./vendor-ui-B3BPIYy7.js";import"./vendor-table-Bc_bbKd8.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var A=t(u(),1),mt=a();function j(...e){return je(Ke(e))}var ht=nt(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function M({className:e,variant:t=`default`,render:n,...r}){return Qe({defaultTagName:`span`,props:Le({className:j(ht({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}var N=m(),gt=nt(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function P({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,N.jsx)(h,{"data-slot":`button`,className:j(gt({variant:t,size:n,className:e})),...r})}function F({className:e,size:t=`default`,...n}){return(0,N.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:j(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-muted py-4 text-sm text-card-foreground border border-border/15 shadow-none has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function I({className:e,...t}){return(0,N.jsx)(`div`,{"data-slot":`card-header`,className:j(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3`,e),...t})}function L({className:e,...t}){return(0,N.jsx)(`div`,{"data-slot":`card-title`,className:j(`text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function R({className:e,...t}){return(0,N.jsx)(`div`,{"data-slot":`card-description`,className:j(`text-sm text-muted-foreground`,e),...t})}function _t({className:e,...t}){return(0,N.jsx)(`div`,{"data-slot":`card-action`,className:j(`col-start-2 row-span-2 row-start-1 self-start justify-self-end`,e),...t})}function z({className:e,...t}){return(0,N.jsx)(`div`,{"data-slot":`card-content`,className:j(`px-4 group-data-[size=sm]/card:px-3`,e),...t})}function vt({className:e,...t}){return(0,N.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,N.jsx)(`table`,{"data-slot":`table`,className:j(`w-full caption-bottom text-sm`,e),...t})})}function yt({className:e,...t}){return(0,N.jsx)(`thead`,{"data-slot":`table-header`,className:j(`[&_tr]:border-b`,e),...t})}function bt({className:e,...t}){return(0,N.jsx)(`tbody`,{"data-slot":`table-body`,className:j(`[&_tr:last-child]:border-0`,e),...t})}function xt({className:e,...t}){return(0,N.jsx)(`tr`,{"data-slot":`table-row`,className:j(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function B({className:e,...t}){return(0,N.jsx)(`th`,{"data-slot":`table-head`,className:j(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function V({className:e,...t}){return(0,N.jsx)(`td`,{"data-slot":`table-cell`,className:j(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}function St({className:e,orientation:t=`horizontal`,...n}){return(0,N.jsx)(ke,{"data-slot":`tabs`,"data-orientation":t,className:j(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Ct=nt(`group/tabs-list inline-flex w-fit items-center justify-center text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col`,{variants:{variant:{default:`rounded-lg bg-muted p-[3px]`,line:`gap-1 bg-transparent p-0 data-[variant=line]:h-auto`}},defaultVariants:{variant:`default`}});function wt({className:e,variant:t=`default`,...n}){return(0,N.jsx)(De,{"data-slot":`tabs-list`,"data-variant":t,className:j(Ct({variant:t}),e),...n})}function Tt({className:e,...t}){return(0,N.jsx)(rt,{"data-slot":`tabs-trigger`,className:j(`relative inline-flex flex-1 items-center justify-center gap-1.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-horizontal/tabs:h-[calc(100%-1px)] group-data-horizontal/tabs:px-1.5 group-data-horizontal/tabs:py-0.5 group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:px-1.5 group-data-vertical/tabs:py-0.5 hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:rounded-md group-data-[variant=default]/tabs-list:border group-data-[variant=default]/tabs-list:border-transparent group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:h-auto group-data-[variant=line]/tabs-list:flex-none group-data-[variant=line]/tabs-list:rounded-none group-data-[variant=line]/tabs-list:border-0 group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:px-2 group-data-[variant=line]/tabs-list:py-1 group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`group-data-[variant=default]/tabs-list:data-active:bg-background group-data-[variant=default]/tabs-list:data-active:text-foreground dark:group-data-[variant=default]/tabs-list:data-active:border-input dark:group-data-[variant=default]/tabs-list:data-active:bg-input/30`,`group-data-[variant=line]/tabs-list:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function Et({className:e,...t}){return(0,N.jsx)(He,{"data-slot":`tabs-content`,className:j(`flex-1 text-sm outline-none`,e),...t})}function Dt({delay:e=0,...t}){return(0,N.jsx)(tt,{"data-slot":`tooltip-provider`,delay:e,...t})}function Ot({...e}){return(0,N.jsx)($e,{"data-slot":`tooltip`,...e})}function kt({...e}){return(0,N.jsx)(qe,{"data-slot":`tooltip-trigger`,...e})}function At({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,N.jsx)(Ce,{children:(0,N.jsx)(Ie,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,N.jsxs)(Ze,{"data-slot":`tooltip-content`,className:j(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o,children:[a,(0,N.jsx)(Ge,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}function jt(...e){return e.filter(Boolean).join(` `)}function Mt(e){return e.trim().split(/\s+/).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join(``)||`?`}function Nt(e){return e.trim().toLowerCase()}function Pt(e,t){let n=Nt(t);return n?[e.label,e.meta??``,...e.keywords??[]].map(Nt).join(` `).includes(n):!0}function Ft({renderLink:e,headerMeta:t,searchItems:n,headerUser:r,onToggleSidebar:i}){let[a,o]=(0,A.useState)(``),[s,c]=(0,A.useState)(!1),l=(0,A.useRef)(!1),u=(0,A.useDeferredValue)(a),d=n.filter(e=>Pt(e,u)).slice(0,u.trim()?12:8),f=new Map;for(let e of d){let t=f.get(e.group)??[];t.push(e),f.set(e.group,t)}return(0,N.jsx)(`header`,{className:`sticky top-0 z-40 border-b border-border/10 bg-background/80 backdrop-blur-xl`,children:(0,N.jsxs)(`div`,{className:`flex h-16 items-center justify-between gap-4 px-4 lg:px-8`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3 lg:gap-4`,children:[(0,N.jsx)(`button`,{type:`button`,className:`rounded-lg bg-card p-2 text-foreground lg:hidden`,onClick:i,"aria-label":`Toggle sidebar`,children:(0,N.jsx)(Se,{className:`size-5`})}),t.backHref&&t.backLabel?e({href:t.backHref,className:`inline-flex items-center gap-1 font-headline text-[10px] uppercase tracking-[0.2em] text-slate-500 transition-colors hover:text-primary`,children:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(ae,{className:`size-3`}),t.backLabel]})}):null,(0,N.jsxs)(`div`,{className:`hidden xl:flex items-center gap-3 rounded-full border border-border/15 bg-card/60 px-3 py-1.5 text-sm shadow-[0_10px_40px_rgba(0,0,0,0.12)]`,children:[t.icon?(0,N.jsx)(`span`,{className:`shrink-0 text-primary`,children:t.icon}):null,(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`font-headline text-[10px] uppercase tracking-[0.18em] text-slate-500`,children:t.badge??`View`}),(0,N.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:t.title})]})]}),(0,N.jsxs)(`div`,{className:`relative w-full max-w-xl`,children:[(0,N.jsx)(Me,{className:`pointer-events-none absolute left-3 top-1/2 z-10 size-4 -translate-y-1/2 text-slate-400`}),(0,N.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),onFocus:()=>c(!0),onBlur:()=>{if(l.current){l.current=!1;return}c(!1)},placeholder:`Search skills or pages...`,className:`h-9 w-full rounded-full border border-border/10 bg-input/50 pl-10 pr-4 text-sm text-foreground outline-none transition focus:border-primary/30 focus:ring-1 focus:ring-primary/40 placeholder:text-slate-500`}),s?(0,N.jsx)(`div`,{className:`absolute left-0 right-0 top-full z-50 mt-2 max-h-80 overflow-y-auto rounded-2xl border border-border/15 bg-card shadow-[0_20px_60px_rgba(0,0,0,0.35)] backdrop-blur-xl`,children:d.length===0?(0,N.jsx)(`div`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:`No results found.`}):Array.from(f.entries()).map(([e,t])=>(0,N.jsxs)(`div`,{className:`border-b border-border/10 last:border-b-0`,children:[(0,N.jsx)(`div`,{className:`px-4 pt-3 text-[10px] uppercase tracking-[0.18em] text-slate-500`,children:e}),(0,N.jsx)(`div`,{className:`p-2`,children:t.map(e=>(0,N.jsxs)(`button`,{type:`button`,onMouseDown:e=>{e.preventDefault(),l.current=!0},onClick:()=>{e.onSelect(),c(!1),o(``)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`,children:[e.leading?(0,N.jsx)(`span`,{className:`shrink-0`,children:e.leading}):(0,N.jsx)(`span`,{className:`shrink-0 text-slate-400`,children:e.meta?`•`:``}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(`div`,{className:`truncate text-foreground`,children:e.label}),e.meta?(0,N.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.meta}):null]}),e.trailing?(0,N.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.trailing}):null]},e.id))})]},e))}):null]})]}),(0,N.jsxs)(`div`,{className:`hidden items-center gap-4 sm:flex lg:gap-6`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-4 text-slate-400`,children:[(0,N.jsxs)(`span`,{className:`relative`,"aria-hidden":`true`,children:[(0,N.jsx)(ze,{className:`size-4`}),(0,N.jsx)(`span`,{className:`absolute -right-0.5 -top-0.5 size-2 rounded-full border-2 border-background bg-primary shadow-[0_0_6px_color-mix(in_srgb,var(--primary)_50%,transparent)]`})]}),(0,N.jsx)(_,{className:`size-4`,"aria-hidden":`true`})]}),r?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:`h-8 w-px bg-border/20`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,N.jsxs)(`div`,{className:`hidden text-right md:block`,children:[(0,N.jsx)(`div`,{className:`font-headline text-[10px] uppercase tracking-widest text-slate-400`,children:r.name}),(0,N.jsx)(`div`,{className:`text-[10px] uppercase tracking-widest text-primary`,children:r.subtitle??r.email??`Active`})]}),r.image?(0,N.jsx)(`img`,{src:r.image,alt:r.name,className:`size-8 rounded-full`}):(0,N.jsx)(`div`,{className:`flex size-8 items-center justify-center rounded-full border border-primary/20 bg-card text-primary`,children:r.name?(0,N.jsx)(`span`,{className:`text-xs font-medium`,children:Mt(r.name)}):(0,N.jsx)(Je,{className:`size-4`})})]})]}):null]})]})})}function It({brand:e,navItems:t,renderLink:n,sidebarAction:r,sidebarUser:i,onSignOut:a,mobileOpen:o,onMobileOpenChange:s}){let[c,l]=(0,A.useState)(!1);return(0,N.jsxs)(N.Fragment,{children:[o?(0,N.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-40 bg-black/50 lg:hidden`,onClick:()=>s(!1),"aria-label":`Close sidebar overlay`}):null,(0,N.jsxs)(`aside`,{className:jt(`fixed inset-y-0 left-0 z-50 flex w-64 flex-col border-r border-sidebar-border bg-sidebar`,`transition-transform duration-200 lg:translate-x-0`,o?`translate-x-0`:`-translate-x-full`),children:[(0,N.jsx)(`div`,{className:`px-4 pb-8 pt-6`,children:n({href:e.href,className:`flex items-center gap-3`,onClick:()=>s(!1),children:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:`size-8 shrink-0 bg-primary shadow-[0_0_12px_rgba(79,242,255,0.3)]`,role:`img`,"aria-label":e.name,style:{WebkitMaskImage:`url(/logo.svg)`,WebkitMaskSize:`contain`,WebkitMaskRepeat:`no-repeat`,WebkitMaskPosition:`center`,maskImage:`url(/logo.svg)`,maskSize:`contain`,maskRepeat:`no-repeat`,maskPosition:`center`}}),(0,N.jsxs)(`div`,{className:`flex flex-col`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`font-headline text-2xl font-bold tracking-tighter text-primary text-glow`,children:e.name}),e.badge?(0,N.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-xs font-medium text-primary`,children:e.badge}):null]}),e.caption?(0,N.jsx)(`span`,{className:`font-headline text-[10px] uppercase tracking-[0.2em] text-slate-500`,children:e.caption}):null]})]})})}),(0,N.jsx)(`nav`,{className:`flex-1 space-y-1 px-2`,children:t.map(e=>(0,N.jsxs)(Ot,{children:[(0,N.jsx)(kt,{render:n({href:e.href,onClick:()=>s(!1),className:jt(`flex items-center gap-3 rounded-lg px-4 py-2.5 font-headline text-sm tracking-tight transition-all duration-200`,e.isActive?`bg-card font-bold text-primary shadow-[inset_0_0_0_1px_rgba(79,242,255,0.08)]`:`text-slate-400 hover:bg-muted/50 hover:text-slate-200`),children:(0,N.jsxs)(N.Fragment,{children:[e.icon,(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(`span`,{children:e.label}),e.isLocked?(0,N.jsx)(ft,{className:`size-3.5 opacity-70`}):null]})]})})}),(0,N.jsx)(At,{side:`right`,children:e.tooltip})]},e.href))}),(0,N.jsxs)(`div`,{className:`px-4 pb-4`,children:[r?(0,N.jsxs)(Ot,{children:[(0,N.jsx)(kt,{render:(0,N.jsxs)(`button`,{type:`button`,disabled:r.disabled,"aria-disabled":r.disabled,tabIndex:r.disabled?-1:0,title:r.tooltip,onClick:r.onClick,className:jt(`flex w-full items-center justify-center gap-2 rounded-xl border py-2.5 font-headline text-xs uppercase tracking-wider transition-colors`,r.disabled?`cursor-not-allowed border-primary/15 bg-gradient-to-r from-primary/10 to-primary/5 text-primary/50 opacity-70`:`border-primary/30 bg-gradient-to-r from-primary/12 to-primary/6 text-primary hover:border-primary/50 hover:bg-primary/10`),children:[r.icon,(0,N.jsx)(`span`,{children:r.label})]})}),(0,N.jsx)(At,{side:`right`,children:r.tooltip})]}):null,e.footerLabel?(0,N.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 px-4 py-1.5 font-headline text-[10px] uppercase tracking-widest text-slate-600`,children:[(0,N.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-primary shadow-[0_0_8px_rgba(79,242,255,0.4)]`}),(0,N.jsx)(`span`,{children:e.footerLabel})]}):null]}),i?(0,N.jsx)(`div`,{className:`border-t border-sidebar-border p-3`,children:(0,N.jsxs)(`div`,{className:`relative`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>l(e=>!e),className:`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm text-muted-foreground transition-colors hover:bg-sidebar-accent/50`,children:[i.image?(0,N.jsx)(`img`,{src:i.image,alt:i.name,className:`size-9 rounded-full`}):(0,N.jsx)(`div`,{className:`flex size-9 items-center justify-center rounded-full bg-primary text-xs font-medium text-primary-foreground`,children:Mt(i.name)}),(0,N.jsxs)(`span`,{className:`min-w-0 flex-1 text-left`,children:[(0,N.jsx)(`span`,{className:`block truncate font-medium text-sidebar-foreground`,children:i.name}),(0,N.jsx)(`span`,{className:`block truncate text-xs text-slate-500`,children:i.subtitle??i.email??`Signed in`})]}),a?(0,N.jsx)(w,{className:`size-4`}):null]}),c&&a?(0,N.jsx)(`div`,{className:`absolute bottom-full left-0 mb-2 w-full rounded-lg border border-border bg-popover py-1 shadow-lg`,children:(0,N.jsxs)(`button`,{type:`button`,onClick:async()=>{l(!1),await a()},className:`flex w-full items-center gap-2 px-4 py-2 text-sm text-muted-foreground hover:bg-sidebar-accent/50`,children:[(0,N.jsx)(ot,{className:`size-4`}),(0,N.jsx)(`span`,{children:`Sign out`})]})}):null]})}):null]})]})}var Lt=`@container/main mx-auto max-w-7xl px-4 py-8 sm:px-6 lg:px-8`;function Rt({brand:e,navItems:t,renderLink:n,headerMeta:r,searchItems:i=[],headerUser:a,sidebarUser:o,sidebarAction:s,onSignOut:c,overlay:l,contentClassName:u,children:d}){let[f,p]=(0,A.useState)(!1),m=u===null?d:(0,N.jsx)(`div`,{className:jt(u??Lt),children:d});return(0,N.jsx)(Dt,{children:(0,N.jsxs)(`div`,{className:`min-h-screen bg-background`,children:[(0,N.jsx)(It,{brand:e,navItems:t,renderLink:n,sidebarAction:s??{label:`Run Evolution`,tooltip:`Dashboard-triggered evolution is not available yet.`,icon:(0,N.jsx)(Fe,{className:`size-4`}),disabled:!0},sidebarUser:o,onSignOut:c,mobileOpen:f,onMobileOpenChange:p}),(0,N.jsxs)(`div`,{className:`min-h-screen lg:pl-64`,children:[(0,N.jsx)(Ft,{renderLink:n,headerMeta:r,searchItems:i,headerUser:a,onToggleSidebar:()=>p(e=>!e)}),(0,N.jsx)(`main`,{className:`min-h-[calc(100vh-4rem)]`,children:m})]}),l]})})}function zt({href:e,label:t,detail:n,tone:r=`healthy`,renderLink:i}){let a=r===`warning`?`text-amber-400 ring-amber-400/20 hover:bg-amber-400/8`:r===`critical`?`text-destructive ring-destructive/20 hover:bg-destructive/8`:`text-primary ring-primary/20 hover:bg-primary/8`,o=r===`warning`?`bg-amber-400`:r===`critical`?`bg-destructive`:`animate-pulse bg-primary shadow-[0_0_8px_color-mix(in_srgb,var(--primary)_60%,transparent)]`;return(0,N.jsx)(`footer`,{className:`pointer-events-none fixed bottom-4 right-4 z-20`,children:i({href:e,className:jt(`glass-panel pointer-events-auto flex items-center gap-2 rounded-full border border-foreground/5 px-3 py-2 font-headline text-[10px] uppercase tracking-[0.18em] text-slate-300 shadow-lg transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40`,a),children:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:jt(`size-1.5 rounded-full`,o)}),(0,N.jsx)(`span`,{children:t}),(0,N.jsx)(`span`,{className:`text-foreground/25`,children:`/`}),(0,N.jsx)(`span`,{className:`text-slate-400`,children:n})]})})})}function Bt({eyebrow:e,title:t,description:n,highlights:r=[],primaryAction:i,secondaryAction:a,note:o}){return(0,N.jsx)(`section`,{className:`overflow-hidden rounded-[28px] border border-primary/15 bg-[radial-gradient(circle_at_top_left,rgba(79,242,255,0.18),transparent_32%),linear-gradient(180deg,rgba(8,16,27,0.98),rgba(7,12,22,0.96))] shadow-[0_24px_80px_rgba(0,0,0,0.35)]`,children:(0,N.jsxs)(`div`,{className:`grid gap-10 p-8 lg:grid-cols-[minmax(0,1.1fr)_minmax(300px,0.9fr)] lg:p-10`,children:[(0,N.jsxs)(`div`,{className:`space-y-6`,children:[(0,N.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-[10px] font-semibold uppercase tracking-[0.22em] text-primary`,children:[(0,N.jsx)(ft,{className:`size-3`}),(0,N.jsx)(`span`,{children:e})]}),(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsx)(`h1`,{className:`max-w-2xl font-headline text-3xl font-semibold tracking-tight text-foreground sm:text-4xl`,children:t}),(0,N.jsx)(`p`,{className:`max-w-2xl text-base leading-7 text-slate-300`,children:n})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,N.jsxs)(`a`,{href:i.href,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-2 rounded-full bg-primary px-5 py-2.5 text-sm font-medium text-primary-foreground transition hover:bg-primary/90`,children:[(0,N.jsx)(`span`,{children:i.label}),(0,N.jsx)(re,{className:`size-4`})]}),a?(0,N.jsxs)(`a`,{href:a.href,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-2 rounded-full border border-border/60 bg-background/40 px-5 py-2.5 text-sm font-medium text-slate-200 transition hover:border-primary/30 hover:text-primary`,children:[(0,N.jsx)(`span`,{children:a.label}),(0,N.jsx)(re,{className:`size-4`})]}):null]}),o?(0,N.jsx)(`p`,{className:`text-sm text-slate-500`,children:o}):null]}),(0,N.jsxs)(`div`,{className:`rounded-[24px] border border-white/8 bg-white/4 p-6 backdrop-blur-sm`,children:[(0,N.jsx)(`div`,{className:`mb-4 text-[10px] font-semibold uppercase tracking-[0.22em] text-slate-500`,children:`What unlocks`}),(0,N.jsx)(`div`,{className:`space-y-3`,children:r.map(e=>(0,N.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-white/6 bg-background/40 px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`mt-0.5 flex size-5 items-center justify-center rounded-full bg-primary/12 text-primary`,children:(0,N.jsx)(S,{className:`size-3.5`})}),(0,N.jsx)(`p`,{className:`text-sm leading-6 text-slate-200`,children:e})]},e))})]})]})})}function Vt(e){return(0,N.jsx)(`div`,{className:`@container/main flex flex-1 flex-col py-6`,children:(0,N.jsx)(`div`,{className:`grid grid-cols-12 gap-6 px-4 lg:px-6`,children:(0,N.jsx)(`div`,{className:`col-span-12`,children:(0,N.jsx)(Bt,{...e})})})})}function Ht(e,t){return e.features[t]}function Ut(e,t){return e.discoverable[t]||e.features[t]}var Wt=(0,A.createContext)(null);function Gt({adapter:e,capabilities:t,children:n}){let r=(0,A.useMemo)(()=>({adapter:e,capabilities:t}),[e,t]);return(0,N.jsx)(Wt.Provider,{value:r,children:n})}function Kt(){return(0,A.useContext)(Wt)}function qt(){return Kt()?.adapter??null}function Jt(e,t){return t.mode===`exact`?e===t.value:e.startsWith(t.value)}function Yt(e,t){return!e.feature||Ht(t,e.feature)?`enabled`:e.discoverableFeature&&Ut(t,e.discoverableFeature)?`locked`:`hidden`}var Xt=[{id:`overview`,label:`Overview`,tooltip:`Dashboard overview`,icon:Ee,hosts:{cloud:{path:`/`,title:`Dashboard`,badge:`Overview`,activePatterns:[{mode:`exact`,value:`/`}]},local:{path:`/`,title:`Dashboard`,badge:`Overview`,activePatterns:[{mode:`exact`,value:`/`}]}}},{id:`skills`,label:`Skills`,tooltip:`Skills Library`,icon:Ve,hosts:{cloud:{path:`/skills`,title:`Skills`,badge:`Library`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/skills`},{mode:`prefix`,value:`/skills/`}],detailPrefixes:[`/skills/`],detailBadge:`Skill Report`,detailBackHref:`/skills`,detailBackLabel:`Skills`},local:{path:`/skills`,title:`Skills`,badge:`Library`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/skills`},{mode:`prefix`,value:`/skills/`}],detailPrefixes:[`/skills/`],detailBadge:`Skill Report`,detailBackHref:`/skills`,detailBackLabel:`Skills`}}},{id:`analytics`,label:`Analytics`,tooltip:`Performance analytics`,icon:se,feature:`analytics`,hosts:{cloud:{path:`/analytics`,title:`Analytics`,badge:`Performance`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/analytics`}]},local:{path:`/analytics`,title:`Analytics`,badge:`Performance`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/analytics`}]}}},{id:`registry`,label:`Registry`,tooltip:`Team skill registry`,icon:Pe,feature:`registry`,discoverableFeature:`registry`,lockedTitle:`Team Registry lives in Selftune Cloud`,lockedBody:`Publish versioned skills, watch installations across projects, and roll back bad versions from a single cloud workspace.`,lockedHighlights:[`Version timeline with rollback controls`,`Installation map across your team`,`Managed publish flow for shared skills`],lockedPrimaryCtaLabel:`Upgrade to Team`,lockedPrimaryCtaHref:`https://selftune.dev/pricing`,lockedSecondaryCtaLabel:`Read registry docs`,lockedSecondaryCtaHref:`https://docs.selftune.dev/cloud/registry`,hosts:{cloud:{path:`/registry`,title:`Registry`,badge:`Team`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/registry`}]},local:{path:`/registry`,title:`Registry`,badge:`Locked`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/registry`}]}}},{id:`signals`,label:`Signals`,tooltip:`Contributor signals`,icon:we,feature:`signals`,discoverableFeature:`signals`,lockedTitle:`Contributor signals run through Selftune Cloud`,lockedBody:`See anonymized contributor signals, compare bundle submissions, and turn real-world usage into proposals without leaving the shared dashboard.`,lockedHighlights:[`Cross-skill contributor signal overview`,`Bundle submission trends and cohorts`,`Proposal generation from contributor evidence`],lockedPrimaryCtaLabel:`View cloud plans`,lockedPrimaryCtaHref:`https://selftune.dev/pricing`,lockedSecondaryCtaLabel:`Read signals docs`,lockedSecondaryCtaHref:`https://docs.selftune.dev/cloud/signals`,hosts:{cloud:{path:`/signals`,title:`Signals`,badge:`Signals`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/signals`}]},local:{path:`/signals`,title:`Signals`,badge:`Locked`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/signals`}]}}},{id:`proposals`,label:`Proposals`,tooltip:`Evolution proposals`,icon:fe,feature:`proposals`,discoverableFeature:`proposals`,lockedTitle:`Proposal review is unlocked in Cloud`,lockedBody:`Keep a shared review queue for contributor-driven improvements, approve the right changes, and coordinate deployment across your team.`,lockedHighlights:[`Shared approval and rejection queue`,`Proposal detail with rationale and evidence`,`Tighter loop from contributor signals to deployment`],lockedPrimaryCtaLabel:`Upgrade for review workflows`,lockedPrimaryCtaHref:`https://selftune.dev/pricing`,lockedSecondaryCtaLabel:`See dashboard docs`,lockedSecondaryCtaHref:`https://docs.selftune.dev/cloud/dashboard`,hosts:{cloud:{path:`/proposals`,title:`Proposals`,badge:`Review Queue`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/proposals`}]},local:{path:`/proposals`,title:`Proposals`,badge:`Locked`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/proposals`}]}}},{id:`unmatched`,label:`Unmatched`,tooltip:`Unmatched queries`,icon:ct,hosts:{cloud:{path:`/unmatched`,title:`Unmatched`,badge:`Attention`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/unmatched`}]}}},{id:`settings`,label:`Settings`,tooltip:`Settings and API keys`,icon:Ae,hosts:{cloud:{path:`/settings`,title:`Settings`,badge:`Workspace`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/settings`}]}}},{id:`status`,label:`System Status`,tooltip:`System health diagnostics`,icon:ut,feature:`runtimeStatus`,hosts:{local:{path:`/status`,title:`System Status`,badge:`Diagnostics`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/status`}]}}}];function Zt(e,t){return Xt.flatMap(n=>{let r=n.hosts[e];if(!r)return[];let i=Yt(n,t);return i===`hidden`?[]:[{id:n.id,label:n.label,tooltip:n.tooltip,icon:n.icon,host:e,path:r.path,title:r.title??n.label,badge:r.badge??n.label,backHref:r.backHref??null,backLabel:r.backLabel??null,activePatterns:r.activePatterns??[{mode:`exact`,value:r.path}],detailPrefixes:r.detailPrefixes??[],detailBadge:r.detailBadge??r.badge??n.label,detailBackHref:r.detailBackHref??r.backHref??null,detailBackLabel:r.detailBackLabel??r.backLabel??null,access:i,lockedTitle:n.lockedTitle,lockedBody:n.lockedBody,lockedHighlights:n.lockedHighlights,lockedPrimaryCtaLabel:n.lockedPrimaryCtaLabel,lockedPrimaryCtaHref:n.lockedPrimaryCtaHref,lockedSecondaryCtaLabel:n.lockedSecondaryCtaLabel,lockedSecondaryCtaHref:n.lockedSecondaryCtaHref}]})}function Qt(e,t){return!!$t(e,[t])}function $t(e,t){for(let n of t){if(n.detailPrefixes.some(t=>e.startsWith(t)))return{...n,matchKind:`detail`,badge:n.detailBadge,backHref:n.detailBackHref,backLabel:n.detailBackLabel};if(n.activePatterns.some(t=>Jt(e,t)))return{...n,matchKind:`route`}}return null}var en=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},tn=new class extends en{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},nn={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},rn=new class{#e=nn;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function an(e){setTimeout(e,0)}var on=typeof window>`u`||`Deno`in globalThis;function H(){}function sn(e,t){return typeof e==`function`?e(t):e}function cn(e){return typeof e==`number`&&e>=0&&e!==1/0}function ln(e,t){return Math.max(e+(t||0)-Date.now(),0)}function un(e,t){return typeof e==`function`?e(t):e}function dn(e,t){return typeof e==`function`?e(t):e}function fn(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==mn(o,t.options))return!1}else if(!gn(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function pn(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(hn(t.options.mutationKey)!==hn(a))return!1}else if(!gn(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function mn(e,t){return(t?.queryKeyHashFn||hn)(e)}function hn(e){return JSON.stringify(e,(e,t)=>xn(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function gn(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>gn(e[n],t[n])):!1}var _n=Object.prototype.hasOwnProperty;function vn(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=bn(e)&&bn(t);if(!r&&!(xn(e)&&xn(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:_n.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=vn(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function yn(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function bn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function xn(e){if(!Sn(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Sn(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Sn(e){return Object.prototype.toString.call(e)===`[object Object]`}function Cn(e){return new Promise(t=>{rn.setTimeout(t,e)})}function wn(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:vn(e,t)}function Tn(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function En(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Dn=Symbol();function On(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Dn?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function kn(e,t){return typeof e==`function`?e(...t):!!e}function An(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var jn=(()=>{let e=()=>on;return{isServer(){return e()},setIsServer(t){e=t}}})();function Mn(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Nn=an;function Pn(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Nn,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var U=Pn(),Fn=new class extends en{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function In(e){return Math.min(1e3*2**e,3e4)}function Ln(e){return(e??`online`)===`online`?Fn.isOnline():!0}var Rn=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function zn(e){let t=!1,n=0,r,i=Mn(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Rn(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>tn.isFocused()&&(e.networkMode===`always`||Fn.isOnline())&&e.canRun(),u=()=>Ln(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(jn.isServer()?0:3),o=e.retryDelay??In,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),Cn(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Bn=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),cn(this.gcTime)&&(this.#e=rn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(jn.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(rn.clearTimeout(this.#e),void 0)}},Vn=class extends Bn{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Wn(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Wn(this.options);e.data!==void 0&&(this.setState(Un(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=wn(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#c({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(H).catch(H):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>dn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Dn||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>un(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!ln(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o||this.#s()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#s(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=On(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=zn({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Rn&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Rn){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#c(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Hn(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Un(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),U.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function Hn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ln(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Un(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Wn(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Gn=class extends en{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Mn(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),qn(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Jn(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Jn(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof dn(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!yn(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Yn(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||dn(this.options.enabled,this.#t)!==dn(t.enabled,this.#t)||un(this.options.staleTime,this.#t)!==un(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||dn(this.options.enabled,this.#t)!==dn(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Zn(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(H)),t}#g(){this.#b();let e=un(this.options.staleTime,this.#t);if(jn.isServer()||this.#r.isStale||!cn(e))return;let t=ln(this.#r.dataUpdatedAt,e)+1;this.#d=rn.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(jn.isServer()||dn(this.options.enabled,this.#t)===!1||!cn(this.#p)||this.#p===0)&&(this.#f=rn.setInterval(()=>{(this.options.refetchIntervalInBackground||tn.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(rn.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(rn.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&qn(e,t),o=i&&Yn(e,n,t,r);(a||o)&&(l={...l,...Hn(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=wn(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=wn(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Xn(e,t),refetch:this.refetch,promise:this.#o,isEnabled:dn(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=Mn())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!yn(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){U.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Kn(e,t){return dn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function qn(e,t){return Kn(e,t)||e.state.data!==void 0&&Jn(e,t,t.refetchOnMount)}function Jn(e,t,n){if(dn(t.enabled,e)!==!1&&un(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Xn(e,t)}return!1}function Yn(e,t,n,r){return(e!==t||dn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Xn(e,n)}function Xn(e,t){return dn(t.enabled,e)!==!1&&e.isStaleByTime(un(t.staleTime,e))}function Zn(e,t){return!yn(e.getCurrentResult(),t)}function Qn(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{An(e,()=>t.signal,()=>n=!0)},u=On(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?En:Tn;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?er:$n,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:$n(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function $n(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function er(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var tr=class extends Bn{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||nr(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=zn({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),U.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function nr(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var rr=class extends en{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new tr({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ir(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ir(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ir(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=ir(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){U.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>pn(t,e))}findAll(e={}){return this.getAll().filter(t=>pn(e,t))}notify(e){U.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return U.batch(()=>Promise.all(e.map(e=>e.continue().catch(H))))}};function ir(e){return e.options.scope?.id}var ar=class extends en{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??mn(r,t),a=this.get(i);return a||(a=new Vn({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){U.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>fn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>fn(e,t)):t}notify(e){U.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){U.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){U.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},or=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ar,this.#t=e.mutationCache||new rr,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=tn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Fn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(un(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=sn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return U.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;U.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return U.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=U.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(H).catch(H)}invalidateQueries(e,t={}){return U.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=U.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(H)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(H)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(un(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(H).catch(H)}fetchInfiniteQuery(e){return e.behavior=Qn(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(H).catch(H)}ensureInfiniteQueryData(e){return e.behavior=Qn(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Fn.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(hn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{gn(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(hn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{gn(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=mn(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Dn&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},sr=A.createContext(void 0),cr=e=>{let t=A.useContext(sr);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},lr=({client:e,children:t})=>(A.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,N.jsx)(sr.Provider,{value:e,children:t})),ur=A.createContext(!1),dr=()=>A.useContext(ur);ur.Provider;function fr(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var pr=A.createContext(fr()),mr=()=>A.useContext(pr),hr=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?kn(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},gr=e=>{A.useEffect(()=>{e.clearReset()},[e])},_r=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||kn(n,[e.error,r])),vr=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},yr=(e,t)=>e.isLoading&&e.isFetching&&!t,br=(e,t)=>e?.suspense&&t.isPending,xr=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Sr(e,t,n){let r=dr(),i=mr(),a=cr(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,vr(o),hr(o,i,s),gr(i);let c=!a.getQueryCache().get(o.queryHash),[l]=A.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(A.useSyncExternalStore(A.useCallback(e=>{let t=d?l.subscribe(U.batchCalls(e)):H;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),A.useEffect(()=>{l.setOptions(o)},[o,l]),br(o,u))throw xr(o,l,i);if(_r({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!jn.isServer()&&yr(u,r)&&(c?xr(o,l,i):s?.promise)?.catch(H).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function Cr(e,t){return Sr(e,Gn,t)}function wr(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.workspace_root==`string`&&typeof t.git_sha==`string`&&typeof t.db_path==`string`&&typeof t.process_mode==`string`&&(t.watcher_mode===`wal`||t.watcher_mode===`jsonl`||t.watcher_mode===`none`)}function Tr({href:e,className:t,children:n,onClick:r}){return(0,N.jsx)(c,{to:e,className:t,onClick:r,children:n})}function Er(){let[e,t]=(0,A.useState)(null);if((0,A.useEffect)(()=>{fetch(`/api/health`).then(e=>e.json()).then(e=>{wr(e)&&t(e)}).catch(()=>{})},[]),!e)return null;let n=e.watcher_mode===`jsonl`,r=e.watcher_mode===`none`,i=e.spa_mode===`proxy`?`proxy`:e.spa_mode===`dist`?`dist`:`missing`,a=n?`Legacy watcher`:r?`Watcher disabled`:`Runtime healthy`,o=n?`warning`:r?`critical`:`healthy`;return(0,N.jsx)(zt,{href:`/status`,label:a,detail:`${e.process_mode} · ${i}`,tone:o,renderLink:Tr})}function Dr(e,t){if(!e.ok||e.service!==`selftune-dashboard`)return null;let n=e.version??`unknown`,r=e.spa_build_id??n,i=t.buildId||t.version;return n===t.version&&r===i?null:{serverVersion:n,serverBuildId:r}}var Or={version:`0.2.26`,buildId:`0.2.26`},kr=3e4;function Ar(){let[e,t]=(0,A.useState)(null);return(0,A.useEffect)(()=>{let e=!0;async function n(){try{let n=await fetch(`/api/health`,{cache:`no-store`});if(!n.ok)return;let r=await n.json();if(!e)return;t(Dr(r,Or))}catch{}}n();let r=window.setInterval(()=>{n()},kr);return()=>{e=!1,window.clearInterval(r)}},[]),e?(0,N.jsxs)(`div`,{className:`fixed right-4 bottom-4 z-[90] max-w-sm rounded-xl border border-amber-500/40 bg-background/95 p-4 shadow-2xl backdrop-blur`,children:[(0,N.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:`Dashboard update available`}),(0,N.jsxs)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:[`The running dashboard is on v`,e.serverVersion,`. Reload to use the newer UI.`]}),(0,N.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90`,children:`Reload now`}),(0,N.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Current build: `,Or.buildId]})]})]}):null}var jr=(0,A.createContext)(void 0),Mr=`selftune-theme`;function Nr({children:e,defaultTheme:t=`dark`}){let[n,r]=(0,A.useState)(`dark`);return(0,A.useEffect)(()=>{let e=window.document.documentElement;e.classList.remove(`light`),e.classList.add(`dark`),localStorage.setItem(Mr,`dark`)},[]),(0,N.jsx)(jr.Provider,{value:{theme:n,setTheme:e=>{localStorage.setItem(Mr,e),r(e)}},children:e})}var Pr=``;async function Fr(){let e=await fetch(`${Pr}/api/v2/overview`);if(!e.ok)throw Error(`API error: ${e.status} ${e.statusText}`);return e.json()}async function Ir(e){let t=await fetch(`${Pr}/api/v2/skills/${encodeURIComponent(e)}`);if(!t.ok)throw t.status===404?new Br(e):Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function Lr(e=20){let t=await fetch(`${Pr}/api/v2/orchestrate-runs?limit=${e}`);if(!t.ok)throw Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function Rr(){let e=await fetch(`${Pr}/api/v2/analytics`);if(!e.ok)throw Error(`API error: ${e.status} ${e.statusText}`);return e.json()}async function zr(){let e=await fetch(`${Pr}/api/v2/doctor`);if(!e.ok)throw Error(`API error: ${e.status} ${e.statusText}`);return e.json()}var Br=class extends Error{constructor(e){super(`Skill "${e}" not found`),this.name=`NotFoundError`}},Vr=6e4;function Hr(){return Cr({queryKey:[`overview`],queryFn:Fr,staleTime:5e3,refetchInterval:Vr})}function Ur(){let e=cr();(0,A.useEffect)(()=>{let t=new EventSource(`/api/v2/events`);return t.addEventListener(`update`,()=>{e.invalidateQueries()}),t.onerror=()=>{},()=>{t.close()}},[e])}function Wr(e,t){return t<5?`UNGRADED`:e>=.8?`HEALTHY`:e>=.5?`WARNING`:`CRITICAL`}function Gr(e){return e==null||!Number.isFinite(e)?`--`:`${Math.round(e*100)}%`}function Kr(e){return[...e].sort((e,t)=>{let n=e.passRate??1,r=t.passRate??1;return n===r?t.checks-e.checks:n-r})}function W(e){let t=new Date(e).getTime();if(Number.isNaN(t))return`--`;let n=Math.max(0,Date.now()-t),r=Math.floor(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function qr(e){let t=e.split(`-`),n=t[1],r=t[2];return!n||!r?e:`${Number(n)}/${Number(r)}`}function Jr({data:e,mode:t}){let n=e.map(e=>t===`pass_rate`?e.pass_rate*100:e.total_checks),r=Math.max(...n,t===`pass_rate`?100:1),i=n.map((e,t)=>({x:48+t/Math.max(1,n.length-1)*624,y:232-(e-0)/Math.max(1,r-0)*200})),a=i.map((e,t)=>`${t===0?`M`:`L`}${e.x},${e.y}`).join(` `),o=`${a} L${i[i.length-1]?.x??48},232 L48,232 Z`,s=t===`pass_rate`?[0,25,50,75,100]:Array.from({length:5},(e,t)=>Math.round(r/4*t)),c=[],l=Math.max(1,Math.floor(e.length/6));for(let t=0;t<e.length;t+=l){let n=e[t],r=i[t];n&&r&&c.push({label:qr(n.date),x:r.x})}return e.length===0?(0,N.jsx)(`div`,{className:`flex items-center justify-center h-[260px] text-muted-foreground text-sm`,children:`No trend data available yet`}):(0,N.jsxs)(`svg`,{viewBox:`0 0 720 260`,className:`w-full h-auto`,preserveAspectRatio:`xMidYMid meet`,children:[(0,N.jsx)(`defs`,{children:(0,N.jsxs)(`linearGradient`,{id:`analytics-chart-fill`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,N.jsx)(`stop`,{offset:`0%`,stopColor:`var(--primary)`,stopOpacity:`0.3`}),(0,N.jsx)(`stop`,{offset:`100%`,stopColor:`var(--primary)`,stopOpacity:`0.02`})]})}),s.map(e=>{let n=232-(e-0)/Math.max(1,r-0)*200;return(0,N.jsxs)(`g`,{children:[(0,N.jsx)(`line`,{x1:48,y1:n,x2:672,y2:n,stroke:`var(--border)`,strokeWidth:`0.5`,strokeDasharray:`4 4`}),(0,N.jsx)(`text`,{x:40,y:n+3,textAnchor:`end`,fill:`var(--muted-foreground)`,fontSize:`9`,fontFamily:`var(--font-headline)`,children:t===`pass_rate`?`${e}%`:e})]},e)}),c.map(e=>(0,N.jsx)(`text`,{x:e.x,y:256,textAnchor:`middle`,fill:`var(--muted-foreground)`,fontSize:`9`,fontFamily:`var(--font-headline)`,children:e.label},e.label)),i.length>1&&(0,N.jsx)(`path`,{d:o,fill:`url(#analytics-chart-fill)`}),i.length>1&&(0,N.jsx)(`path`,{d:a,fill:`none`,stroke:`var(--primary)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{filter:`drop-shadow(0 0 4px rgba(79,242,255,0.5))`}}),i.map((e,t)=>(0,N.jsx)(`circle`,{cx:e.x,cy:e.y,r:`3`,fill:`var(--primary)`,stroke:`var(--muted)`,strokeWidth:`1.5`},t))]})}function Yr({skills:e}){return e.length===0?(0,N.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No skills graded yet`})}):(0,N.jsx)(`div`,{className:`flex-1 flex flex-col gap-4`,children:e.map(e=>(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,N.jsx)(`span`,{className:`font-headline text-[11px] uppercase tracking-wider text-foreground truncate max-w-[65%]`,children:e.skill_name}),(0,N.jsxs)(`span`,{className:`font-headline text-xs font-semibold text-primary`,children:[Math.round(e.pass_rate*100),`%`]})]}),(0,N.jsx)(`div`,{className:`h-[1.5px] rounded-full bg-border/30 overflow-hidden`,children:(0,N.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-all duration-500`,style:{width:`${Math.round(e.pass_rate*100)}%`,boxShadow:`0 0 6px rgba(79,242,255,0.4)`}})}),(0,N.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-1`,children:[e.total_checks,` checks · `,e.triggered_count,` triggered`]})]},e.skill_name))})}function Xr({data:e}){let t=e.slice(-84),n=Math.max(...t.map(e=>e.checks),1);return t.length===0?(0,N.jsx)(`div`,{className:`flex items-center justify-center h-32 text-muted-foreground text-sm`,children:`No grading activity recorded yet`}):(0,N.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,N.jsx)(`div`,{className:`flex flex-wrap gap-1.5 flex-1 content-start`,children:t.map(e=>{let t=e.checks/n;return(0,N.jsx)(`div`,{className:`size-5 rounded-sm transition-colors`,style:{backgroundColor:`color-mix(in srgb, var(--primary) ${Math.round(Math.max(.08,t)*100)}%, transparent)`},title:`${e.date}: ${e.checks} checks`},e.date)})}),(0,N.jsxs)(`div`,{className:`flex items-center justify-end gap-2 mt-auto pt-3`,children:[(0,N.jsx)(`span`,{className:`text-[10px] font-headline uppercase tracking-widest text-muted-foreground`,children:`Quiet`}),[8,25,50,75,100].map(e=>(0,N.jsx)(`div`,{className:`size-3 rounded-sm`,style:{backgroundColor:`color-mix(in srgb, var(--primary) ${e}%, transparent)`}},e)),(0,N.jsx)(`span`,{className:`text-[10px] font-headline uppercase tracking-widest text-muted-foreground`,children:`Active`})]})]})}function Zr({impacts:e}){return e.length===0?(0,N.jsx)(`div`,{className:`flex items-center justify-center h-32`,children:(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No evolution deployments yet`})}):(0,N.jsx)(`div`,{className:`flex flex-col gap-3 max-h-[260px] overflow-y-auto`,children:e.map(e=>{let t=(e.pass_rate_after-e.pass_rate_before)*100,n=t>0;return(0,N.jsxs)(`div`,{className:`flex items-center justify-between bg-muted/50 rounded-lg px-4 py-3`,children:[(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsx)(`p`,{className:`font-headline text-[11px] uppercase tracking-wider text-foreground truncate`,children:e.skill_name}),(0,N.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:[Math.round(e.pass_rate_before*100),`% →`,` `,Math.round(e.pass_rate_after*100),`%`]})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,N.jsxs)(`svg`,{className:`size-3.5 ${n?`text-primary`:`text-destructive rotate-90`}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,N.jsx)(`line`,{x1:`7`,y1:`17`,x2:`17`,y2:`7`}),(0,N.jsx)(`polyline`,{points:`7 7 17 7 17 17`})]}),(0,N.jsxs)(`span`,{className:`font-headline text-sm font-semibold ${n?`text-primary`:`text-destructive`}`,children:[n?`+`:``,Math.round(t),`%`]})]})]},e.proposal_id)})})}function Qr(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var $r=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ei=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ti={};function ni(e,t){return((t||ti).jsx?ei:$r).test(e)}var ri=/[ \t\n\f\r]/g;function ii(e){return typeof e==`object`?e.type===`text`?ai(e.value):!1:ai(e)}function ai(e){return e.replace(ri,``)===``}var oi=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};oi.prototype.normal={},oi.prototype.property={},oi.prototype.space=void 0;function si(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new oi(n,r,t)}function ci(e){return e.toLowerCase()}var G=class{constructor(e,t){this.attribute=t,this.property=e}};G.prototype.attribute=``,G.prototype.booleanish=!1,G.prototype.boolean=!1,G.prototype.commaOrSpaceSeparated=!1,G.prototype.commaSeparated=!1,G.prototype.defined=!1,G.prototype.mustUseProperty=!1,G.prototype.number=!1,G.prototype.overloadedBoolean=!1,G.prototype.property=``,G.prototype.spaceSeparated=!1,G.prototype.space=void 0;var li=e({boolean:()=>K,booleanish:()=>q,commaOrSpaceSeparated:()=>pi,commaSeparated:()=>fi,number:()=>J,overloadedBoolean:()=>di,spaceSeparated:()=>Y}),ui=0,K=mi(),q=mi(),di=mi(),J=mi(),Y=mi(),fi=mi(),pi=mi();function mi(){return 2**++ui}var hi=Object.keys(li),gi=class extends G{constructor(e,t,n,r){let i=-1;if(super(e,t),_i(this,`space`,r),typeof n==`number`)for(;++i<hi.length;){let e=hi[i];_i(this,hi[i],(n&li[e])===li[e])}}};gi.prototype.defined=!0;function _i(e,t,n){n&&(e[t]=n)}function vi(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new gi(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[ci(r)]=r,n[ci(a.attribute)]=r}return new oi(t,n,e.space)}var yi=vi({properties:{ariaActiveDescendant:null,ariaAtomic:q,ariaAutoComplete:null,ariaBusy:q,ariaChecked:q,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:Y,ariaCurrent:null,ariaDescribedBy:Y,ariaDetails:null,ariaDisabled:q,ariaDropEffect:Y,ariaErrorMessage:null,ariaExpanded:q,ariaFlowTo:Y,ariaGrabbed:q,ariaHasPopup:null,ariaHidden:q,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Y,ariaLevel:J,ariaLive:null,ariaModal:q,ariaMultiLine:q,ariaMultiSelectable:q,ariaOrientation:null,ariaOwns:Y,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:q,ariaReadOnly:q,ariaRelevant:null,ariaRequired:q,ariaRoleDescription:Y,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:q,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function bi(e,t){return t in e?e[t]:t}function xi(e,t){return bi(e,t.toLowerCase())}var Si=vi({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:fi,acceptCharset:Y,accessKey:Y,action:null,allow:null,allowFullScreen:K,allowPaymentRequest:K,allowUserMedia:K,alt:null,as:null,async:K,autoCapitalize:null,autoComplete:Y,autoFocus:K,autoPlay:K,blocking:Y,capture:null,charSet:null,checked:K,cite:null,className:Y,cols:J,colSpan:null,content:null,contentEditable:q,controls:K,controlsList:Y,coords:J|fi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:K,defer:K,dir:null,dirName:null,disabled:K,download:di,draggable:q,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:K,formTarget:null,headers:Y,height:J,hidden:di,high:J,href:null,hrefLang:null,htmlFor:Y,httpEquiv:Y,id:null,imageSizes:null,imageSrcSet:null,inert:K,inputMode:null,integrity:null,is:null,isMap:K,itemId:null,itemProp:Y,itemRef:Y,itemScope:K,itemType:Y,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:K,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:K,muted:K,name:null,nonce:null,noModule:K,noValidate:K,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:K,optimum:J,pattern:null,ping:Y,placeholder:null,playsInline:K,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:K,referrerPolicy:null,rel:Y,required:K,reversed:K,rows:J,rowSpan:J,sandbox:Y,scope:null,scoped:K,seamless:K,selected:K,shadowRootClonable:K,shadowRootDelegatesFocus:K,shadowRootMode:null,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:q,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:K,useMap:null,value:q,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Y,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:K,declare:K,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:K,noHref:K,noShade:K,noWrap:K,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:q,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:K,disableRemotePlayback:K,prefix:null,property:null,results:J,security:null,unselectable:null},space:`html`,transform:xi}),Ci=vi({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:pi,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:Y,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:K,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:fi,g2:fi,glyphName:fi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:pi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:J,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Y,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:pi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:pi,rev:pi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:pi,requiredFeatures:pi,requiredFonts:pi,requiredFormats:pi,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:pi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:pi,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:pi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:bi}),wi=vi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Ti=vi({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:xi}),Ei=vi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Di={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Oi=/[A-Z]/g,ki=/-[a-z]/g,Ai=/^data[-\w.:]+$/i;function ji(e,t){let n=ci(t),r=t,i=G;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Ai.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(ki,Ni);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!ki.test(e)){let n=e.replace(Oi,Mi);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=gi}return new i(r,t)}function Mi(e){return`-`+e.toLowerCase()}function Ni(e){return e.charAt(1).toUpperCase()}var Pi=si([yi,Si,wi,Ti,Ei],`html`),Fi=si([yi,Ci,wi,Ti,Ei],`svg`);function Ii(e){return e.join(` `).trim()}var Li=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
2
|
-
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),Ri=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(Li());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),zi=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Bi=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Ri()),r=zi();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Vi=Ui(`end`),Hi=Ui(`start`);function Ui(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Wi(e){let t=Hi(e),n=Vi(e);if(t&&n)return{start:t,end:n}}function Gi(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?qi(e.position):`start`in e||`end`in e?qi(e):`line`in e||`column`in e?Ki(e):``}function Ki(e){return Ji(e&&e.line)+`:`+Ji(e&&e.column)}function qi(e){return Ki(e&&e.start)+`-`+Ki(e&&e.end)}function Ji(e){return e&&typeof e==`number`?e:1}var X=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Gi(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};X.prototype.file=``,X.prototype.name=``,X.prototype.reason=``,X.prototype.message=``,X.prototype.stack=``,X.prototype.column=void 0,X.prototype.line=void 0,X.prototype.ancestors=void 0,X.prototype.cause=void 0,X.prototype.fatal=void 0,X.prototype.place=void 0,X.prototype.ruleId=void 0,X.prototype.source=void 0;var Yi=t(Bi(),1),Xi={}.hasOwnProperty,Zi=new Map,Qi=/[A-Z]/g,$i=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),ea=new Set([`td`,`th`]),ta=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function na(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=pa(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=fa(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Fi:Pi,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=ra(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function ra(e,t,n){if(t.type===`element`)return ia(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return aa(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return sa(e,t,n);if(t.type===`mdxjsEsm`)return oa(e,t);if(t.type===`root`)return ca(e,t,n);if(t.type===`text`)return la(e,t)}function ia(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Fi,e.schema=i),e.ancestors.push(t);let a=ya(e,t.tagName,!1),o=ma(e,t),s=ga(e,t);return $i.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!ii(e):!0})),ua(e,o,a,t),da(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function aa(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}ba(e,t.position)}function oa(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ba(e,t.position)}function sa(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Fi,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:ya(e,t.name,!0),o=ha(e,t),s=ga(e,t);return ua(e,o,a,t),da(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ca(e,t,n){let r={};return da(r,ga(e,t)),e.create(t,e.Fragment,r,n)}function la(e,t){return t.value}function ua(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function da(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function fa(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function pa(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Hi(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function ma(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Xi.call(t.properties,i)){let a=_a(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&ea.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function ha(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else ba(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else ba(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function ga(e,t){let n=[],r=-1,i=e.passKeys?new Map:Zi;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=ra(e,a,o);s!==void 0&&n.push(s)}return n}function _a(e,t,n){let r=ji(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Qr(n):Ii(n)),r.property===`style`){let t=typeof n==`object`?n:va(e,String(n));return e.stylePropertyNameCase===`css`&&(t=xa(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Di[r.property]||r.property:r.attribute,n]}}function va(e,t){try{return(0,Yi.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new X("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=ta+`#cannot-parse-style-attribute`,r}}function ya(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=ni(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=ni(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Xi.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);ba(e)}function ba(e,t){let n=new X("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=ta+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function xa(e){let t={},n;for(n in e)Xi.call(e,n)&&(t[Sa(n)]=e[n]);return t}function Sa(e){let t=e.replace(Qi,Ca);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Ca(e){return`-`+e.toLowerCase()}var wa={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},Ta={};function Ea(e,t){let n=t||Ta;return Da(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Da(e,t,n){if(ka(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return Oa(e.children,t,n)}return Array.isArray(e)?Oa(e,t,n):``}function Oa(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Da(e[i],t,n);return r.join(``)}function ka(e){return!!(e&&typeof e==`object`)}var Aa=document.createElement(`i`);function ja(e){let t=`&`+e+`;`;Aa.innerHTML=t;let n=Aa.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function Ma(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Na(e,t){return e.length>0?(Ma(e,e.length,0,t),e):t}var Pa={}.hasOwnProperty;function Fa(e){let t={},n=-1;for(;++n<e.length;)Ia(t,e[n]);return t}function Ia(e,t){let n;for(n in t){let r=(Pa.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Pa.call(r,a)||(r[a]=[]);let e=i[a];La(r[a],Array.isArray(e)?e:e?[e]:[])}}}function La(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Ma(e,0,0,r)}function Ra(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function za(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Ba=Xa(/[A-Za-z]/),Va=Xa(/[\dA-Za-z]/),Ha=Xa(/[#-'*+\--9=?A-Z^-~]/);function Ua(e){return e!==null&&(e<32||e===127)}var Wa=Xa(/\d/),Ga=Xa(/[\dA-Fa-f]/),Ka=Xa(/[!-/:-@[-`{-~]/);function Z(e){return e!==null&&e<-2}function qa(e){return e!==null&&(e<0||e===32)}function Q(e){return e===-2||e===-1||e===32}var Ja=Xa(/\p{P}|\p{S}/u),Ya=Xa(/\s/);function Xa(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Za(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Va(e.charCodeAt(n+1))&&Va(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function $(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Q(r)?(e.enter(n),s(r)):t(r)}function s(r){return Q(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Qa={tokenize:$a};function $a(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),$(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return Z(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var eo={tokenize:no},to={tokenize:ro};function no(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return Ma(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(to,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(to,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return Z(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;Ma(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function ro(e,t,n){return $(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function io(e){if(e===null||qa(e)||Ya(e))return 1;if(Ja(e))return 2}function ao(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var oo={name:`attention`,resolveAll:so,tokenize:co};function so(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};lo(d,-c),lo(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Na(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Na(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Na(l,ao(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Na(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Na(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Ma(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function co(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=io(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=io(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function lo(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var uo={name:`autolink`,tokenize:fo};function fo(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return Ba(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Va(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||Va(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Ua(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Ha(t)?(e.consume(t),l):n(t)}function u(e){return Va(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||Va(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var po={partial:!0,tokenize:mo};function mo(e,t,n){return r;function r(t){return Q(t)?$(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Z(e)?t(e):n(e)}}var ho={continuation:{tokenize:_o},exit:vo,name:`blockQuote`,tokenize:go};function go(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Q(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function _o(e,t,n){let r=this;return i;function i(t){return Q(t)?$(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(ho,t,n)(r)}}function vo(e){e.exit(`blockQuote`)}var yo={name:`characterEscape`,tokenize:bo};function bo(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Ka(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var xo={name:`characterReference`,tokenize:So};function So(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=Va,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Ga,u):(e.enter(`characterReferenceValue`),a=7,o=Wa,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Va&&!ja(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var Co={partial:!0,tokenize:Eo},wo={concrete:!0,name:`codeFenced`,tokenize:To};function To(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Q(t)?$(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Z(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(Co,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Z(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),$(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Z(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Z(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Q(t)?$(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Z(t)?e.check(Co,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Z(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Q(t)?$(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Q(t)?$(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Z(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Eo(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Do={name:`codeIndented`,tokenize:ko},Oo={partial:!0,tokenize:Ao};function ko(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),$(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Z(t)?e.attempt(Oo,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Z(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Ao(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Z(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):$(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Z(e)?i(e):n(e)}}var jo={name:`codeText`,previous:No,resolve:Mo,tokenize:Po};function Mo(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function No(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Po(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Z(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Z(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var Fo=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&Io(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),Io(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Io(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);Io(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);Io(this.left,t.reverse())}}};function Io(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Lo(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Fo(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,Ro(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return Ma(e,0,1/0,u.slice(0)),!l}function Ro(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var zo={resolve:Vo,tokenize:Ho},Bo={partial:!0,tokenize:Uo};function Vo(e){return Lo(e),e}function Ho(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Z(t)?e.check(Bo,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Uo(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$(e,a,`linePrefix`)}function a(i){if(i===null||Z(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Wo(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Ua(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Z(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||qa(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Ua(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Go(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Z(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Z(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Q(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Ko(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Z(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Z(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function qo(e,t){let n;return r;function r(i){return Z(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Q(i)?$(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Jo={name:`definition`,tokenize:Xo},Yo={partial:!0,tokenize:Zo};function Xo(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Go.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=za(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return qa(t)?qo(e,l)(t):l(t)}function l(t){return Wo(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Yo,d,d)(t)}function d(t){return Q(t)?$(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Z(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Zo(e,t,n){return r;function r(t){return qa(t)?qo(e,i)(t):n(t)}function i(t){return Ko(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Q(t)?$(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Z(e)?t(e):n(e)}}var Qo={name:`hardBreakEscape`,tokenize:$o};function $o(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Z(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var es={name:`headingAtx`,resolve:ts,tokenize:ns};function ts(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},Ma(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function ns(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||qa(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Z(n)?(e.exit(`atxHeading`),t(n)):Q(n)?$(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||qa(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var rs=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),is=[`pre`,`script`,`style`,`textarea`],as={concrete:!0,name:`htmlFlow`,resolveTo:cs,tokenize:ls},os={partial:!0,tokenize:ds},ss={partial:!0,tokenize:us};function cs(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function ls(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:oe):Ba(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):Ba(a)?(e.consume(a),i=4,r.interrupt?t:oe):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:oe):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return Ba(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||qa(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&is.includes(l)?(i=1,r.interrupt?t(s):O(s)):rs.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Va(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Q(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Ba(t)?(e.consume(t),b):Q(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Va(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Q(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Q(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Z(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||qa(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Q(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Z(t)?O(t):Q(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),k):t===60&&i===1?(e.consume(t),re):t===62&&i===4?(e.consume(t),se):t===63&&i===3?(e.consume(t),oe):t===93&&i===5?(e.consume(t),ae):Z(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(os,ce,ee)(t)):t===null||Z(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),O)}function ee(t){return e.check(ss,te,ce)(t)}function te(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ne}function ne(t){return t===null||Z(t)?ee(t):(e.enter(`htmlFlowData`),O(t))}function k(t){return t===45?(e.consume(t),oe):O(t)}function re(t){return t===47?(e.consume(t),o=``,ie):O(t)}function ie(t){if(t===62){let n=o.toLowerCase();return is.includes(n)?(e.consume(t),se):O(t)}return Ba(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ie):O(t)}function ae(t){return t===93?(e.consume(t),oe):O(t)}function oe(t){return t===62?(e.consume(t),se):t===45&&i===2?(e.consume(t),oe):O(t)}function se(t){return t===null||Z(t)?(e.exit(`htmlFlowData`),ce(t)):(e.consume(t),se)}function ce(n){return e.exit(`htmlFlow`),t(n)}}function us(e,t,n){let r=this;return i;function i(t){return Z(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function ds(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(po,t,n)}}var fs={name:`htmlText`,tokenize:ps};function ps(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):Ba(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):Ba(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Z(t)?(o=d,re(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?k(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Z(t)?(o=h,re(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?k(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?k(t):Z(t)?(o=v,re(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Z(t)?(o=y,re(t)):(e.consume(t),y)}function b(e){return e===62?k(e):y(e)}function x(t){return Ba(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Va(t)?(e.consume(t),S):C(t)}function C(t){return Z(t)?(o=C,re(t)):Q(t)?(e.consume(t),C):k(t)}function w(t){return t===45||Va(t)?(e.consume(t),w):t===47||t===62||qa(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),k):t===58||t===95||Ba(t)?(e.consume(t),E):Z(t)?(o=T,re(t)):Q(t)?(e.consume(t),T):k(t)}function E(t){return t===45||t===46||t===58||t===95||Va(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Z(t)?(o=D,re(t)):Q(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,ee):Z(t)?(o=O,re(t)):Q(t)?(e.consume(t),O):(e.consume(t),te)}function ee(t){return t===i?(e.consume(t),i=void 0,ne):t===null?n(t):Z(t)?(o=ee,re(t)):(e.consume(t),ee)}function te(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||qa(t)?T(t):(e.consume(t),te)}function ne(e){return e===47||e===62||qa(e)?T(e):n(e)}function k(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function re(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ie}function ie(t){return Q(t)?$(e,ae,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ae(t)}function ae(t){return e.enter(`htmlTextData`),o(t)}}var ms={name:`labelEnd`,resolveAll:vs,resolveTo:ys,tokenize:bs},hs={tokenize:xs},gs={tokenize:Ss},_s={tokenize:Cs};function vs(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&Ma(e,0,e.length,n),e}function ys(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=Na(s,e.slice(a+1,a+r+3)),s=Na(s,[[`enter`,u,t]]),s=Na(s,ao(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Na(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Na(s,e.slice(o+1)),s=Na(s,[[`exit`,c,t]]),Ma(e,a,e.length,s),e}function bs(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(za(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(hs,u,o?u:d)(t):t===91?e.attempt(gs,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(_s,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function xs(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return qa(t)?qo(e,a)(t):a(t)}function a(t){return t===41?u(t):Wo(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return qa(t)?qo(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Ko(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return qa(t)?qo(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function Ss(e,t,n){let r=this;return i;function i(t){return Go.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(za(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Cs(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var ws={name:`labelStartImage`,resolveAll:ms.resolveAll,tokenize:Ts};function Ts(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Es={name:`labelStartLink`,resolveAll:ms.resolveAll,tokenize:Ds};function Ds(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Os={name:`lineEnding`,tokenize:ks};function ks(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),$(e,t,`linePrefix`)}}var As={name:`thematicBreak`,tokenize:js};function js(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Z(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Q(t)?$(e,s,`whitespace`)(t):s(t))}}var Ms={continuation:{tokenize:Is},exit:Rs,name:`list`,tokenize:Fs},Ns={partial:!0,tokenize:zs},Ps={partial:!0,tokenize:Ls};function Fs(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Wa(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(As,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Wa(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(po,r.interrupt?n:u,e.attempt(Ns,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Q(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Is(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(po,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,$(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Q(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Ps,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,$(e,e.attempt(Ms,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Ls(e,t,n){let r=this;return $(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Rs(e){e.exit(this.containerState.type)}function zs(e,t,n){let r=this;return $(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Q(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Bs={name:`setextUnderline`,resolveTo:Vs,tokenize:Hs};function Vs(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Hs(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Q(t)?$(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Z(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Us={tokenize:Ws};function Ws(e){let t=this,n=e.attempt(po,r,e.attempt(this.parser.constructs.flowInitial,i,$(e,e.attempt(this.parser.constructs.flow,i,e.attempt(zo,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Gs={resolveAll:Ys()},Ks=Js(`string`),qs=Js(`text`);function Js(e){return{resolveAll:Ys(e===`text`?Xs:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Ys(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Xs(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Zs=e({attentionMarkers:()=>ac,contentInitial:()=>$s,disable:()=>oc,document:()=>Qs,flow:()=>tc,flowInitial:()=>ec,insideSpan:()=>ic,string:()=>nc,text:()=>rc}),Qs={42:Ms,43:Ms,45:Ms,48:Ms,49:Ms,50:Ms,51:Ms,52:Ms,53:Ms,54:Ms,55:Ms,56:Ms,57:Ms,62:ho},$s={91:Jo},ec={[-2]:Do,[-1]:Do,32:Do},tc={35:es,42:As,45:[Bs,As],60:as,61:Bs,95:As,96:wo,126:wo},nc={38:xo,92:yo},rc={[-5]:Os,[-4]:Os,[-3]:Os,33:ws,38:xo,42:oo,60:[uo,fs],91:Es,92:[Qo,yo],93:ms,95:oo,96:jo},ic={null:[oo,Gs]},ac={null:[42,95]},oc={null:[]};function sc(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Na(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=ao(a,l.events,l),l.events):[]}function f(e,t){return lc(p(e),t)}function p(e){return cc(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){Z(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&Ma(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function cc(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function lc(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
1
|
+
import{n as e,r as t,t as n}from"./rolldown-runtime-Dw2cE7zH.js";import{a as r,c as i,d as a,i as o,l as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./vendor-react-C5oyHiV1.js";import{$ as h,A as g,At as _,B as v,C as y,Ct as b,D as x,Dt as S,E as C,Et as w,F as T,G as E,H as D,I as O,J as ee,K as te,L as ne,M as re,Mt as k,N as ie,Nt as ae,O as oe,Ot as se,P as ce,Q as le,R as ue,S as de,St as fe,T as pe,Tt as me,U as he,V as ge,W as _e,X as ve,Y as ye,Z as be,_ as xe,_t as Se,a as Ce,at as we,b as Te,bt as Ee,c as De,ct as Oe,d as ke,dt as Ae,et as je,ft as Me,g as Ne,gt as Pe,ht as Fe,i as Ie,it as Le,j as Re,jt as ze,k as Be,kt as Ve,l as He,lt as Ue,mt as We,n as Ge,nt as Ke,o as qe,ot as Je,pt as Ye,q as Xe,r as Ze,rt as Qe,s as $e,st as et,t as tt,tt as nt,u as rt,ut as it,v as at,vt as ot,w as st,wt as ct,x as lt,xt as ut,y as dt,yt as ft,z as pt}from"./vendor-ui-B3BPIYy7.js";import"./vendor-table-Bc_bbKd8.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var A=t(u(),1),mt=a();function j(...e){return je(Ke(e))}var ht=nt(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function M({className:e,variant:t=`default`,render:n,...r}){return Qe({defaultTagName:`span`,props:Le({className:j(ht({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}var N=m(),gt=nt(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function P({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,N.jsx)(h,{"data-slot":`button`,className:j(gt({variant:t,size:n,className:e})),...r})}function F({className:e,size:t=`default`,...n}){return(0,N.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:j(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-muted py-4 text-sm text-card-foreground border border-border/15 shadow-none has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function I({className:e,...t}){return(0,N.jsx)(`div`,{"data-slot":`card-header`,className:j(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3`,e),...t})}function L({className:e,...t}){return(0,N.jsx)(`div`,{"data-slot":`card-title`,className:j(`text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function R({className:e,...t}){return(0,N.jsx)(`div`,{"data-slot":`card-description`,className:j(`text-sm text-muted-foreground`,e),...t})}function _t({className:e,...t}){return(0,N.jsx)(`div`,{"data-slot":`card-action`,className:j(`col-start-2 row-span-2 row-start-1 self-start justify-self-end`,e),...t})}function z({className:e,...t}){return(0,N.jsx)(`div`,{"data-slot":`card-content`,className:j(`px-4 group-data-[size=sm]/card:px-3`,e),...t})}function vt({className:e,...t}){return(0,N.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,N.jsx)(`table`,{"data-slot":`table`,className:j(`w-full caption-bottom text-sm`,e),...t})})}function yt({className:e,...t}){return(0,N.jsx)(`thead`,{"data-slot":`table-header`,className:j(`[&_tr]:border-b`,e),...t})}function bt({className:e,...t}){return(0,N.jsx)(`tbody`,{"data-slot":`table-body`,className:j(`[&_tr:last-child]:border-0`,e),...t})}function xt({className:e,...t}){return(0,N.jsx)(`tr`,{"data-slot":`table-row`,className:j(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function B({className:e,...t}){return(0,N.jsx)(`th`,{"data-slot":`table-head`,className:j(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function V({className:e,...t}){return(0,N.jsx)(`td`,{"data-slot":`table-cell`,className:j(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}function St({className:e,orientation:t=`horizontal`,...n}){return(0,N.jsx)(ke,{"data-slot":`tabs`,"data-orientation":t,className:j(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Ct=nt(`group/tabs-list inline-flex w-fit items-center justify-center text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col`,{variants:{variant:{default:`rounded-lg bg-muted p-[3px]`,line:`gap-1 bg-transparent p-0 data-[variant=line]:h-auto`}},defaultVariants:{variant:`default`}});function wt({className:e,variant:t=`default`,...n}){return(0,N.jsx)(De,{"data-slot":`tabs-list`,"data-variant":t,className:j(Ct({variant:t}),e),...n})}function Tt({className:e,...t}){return(0,N.jsx)(rt,{"data-slot":`tabs-trigger`,className:j(`relative inline-flex flex-1 items-center justify-center gap-1.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-horizontal/tabs:h-[calc(100%-1px)] group-data-horizontal/tabs:px-1.5 group-data-horizontal/tabs:py-0.5 group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:px-1.5 group-data-vertical/tabs:py-0.5 hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:rounded-md group-data-[variant=default]/tabs-list:border group-data-[variant=default]/tabs-list:border-transparent group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:h-auto group-data-[variant=line]/tabs-list:flex-none group-data-[variant=line]/tabs-list:rounded-none group-data-[variant=line]/tabs-list:border-0 group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:px-2 group-data-[variant=line]/tabs-list:py-1 group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`group-data-[variant=default]/tabs-list:data-active:bg-background group-data-[variant=default]/tabs-list:data-active:text-foreground dark:group-data-[variant=default]/tabs-list:data-active:border-input dark:group-data-[variant=default]/tabs-list:data-active:bg-input/30`,`group-data-[variant=line]/tabs-list:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function Et({className:e,...t}){return(0,N.jsx)(He,{"data-slot":`tabs-content`,className:j(`flex-1 text-sm outline-none`,e),...t})}function Dt({delay:e=0,...t}){return(0,N.jsx)(tt,{"data-slot":`tooltip-provider`,delay:e,...t})}function Ot({...e}){return(0,N.jsx)($e,{"data-slot":`tooltip`,...e})}function kt({...e}){return(0,N.jsx)(qe,{"data-slot":`tooltip-trigger`,...e})}function At({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,N.jsx)(Ce,{children:(0,N.jsx)(Ie,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,N.jsxs)(Ze,{"data-slot":`tooltip-content`,className:j(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o,children:[a,(0,N.jsx)(Ge,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}function jt(...e){return e.filter(Boolean).join(` `)}function Mt(e){return e.trim().split(/\s+/).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join(``)||`?`}function Nt(e){return e.trim().toLowerCase()}function Pt(e,t){let n=Nt(t);return n?[e.label,e.meta??``,...e.keywords??[]].map(Nt).join(` `).includes(n):!0}function Ft({renderLink:e,headerMeta:t,searchItems:n,headerUser:r,onToggleSidebar:i}){let[a,o]=(0,A.useState)(``),[s,c]=(0,A.useState)(!1),l=(0,A.useRef)(!1),u=(0,A.useDeferredValue)(a),d=n.filter(e=>Pt(e,u)).slice(0,u.trim()?12:8),f=new Map;for(let e of d){let t=f.get(e.group)??[];t.push(e),f.set(e.group,t)}return(0,N.jsx)(`header`,{className:`sticky top-0 z-40 border-b border-border/10 bg-background/80 backdrop-blur-xl`,children:(0,N.jsxs)(`div`,{className:`flex h-16 items-center justify-between gap-4 px-4 lg:px-8`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3 lg:gap-4`,children:[(0,N.jsx)(`button`,{type:`button`,className:`rounded-lg bg-card p-2 text-foreground lg:hidden`,onClick:i,"aria-label":`Toggle sidebar`,children:(0,N.jsx)(Se,{className:`size-5`})}),t.backHref&&t.backLabel?e({href:t.backHref,className:`inline-flex items-center gap-1 font-headline text-[10px] uppercase tracking-[0.2em] text-slate-500 transition-colors hover:text-primary`,children:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(ae,{className:`size-3`}),t.backLabel]})}):null,(0,N.jsxs)(`div`,{className:`hidden xl:flex items-center gap-3 rounded-full border border-border/15 bg-card/60 px-3 py-1.5 text-sm shadow-[0_10px_40px_rgba(0,0,0,0.12)]`,children:[t.icon?(0,N.jsx)(`span`,{className:`shrink-0 text-primary`,children:t.icon}):null,(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`font-headline text-[10px] uppercase tracking-[0.18em] text-slate-500`,children:t.badge??`View`}),(0,N.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:t.title})]})]}),(0,N.jsxs)(`div`,{className:`relative w-full max-w-xl`,children:[(0,N.jsx)(Me,{className:`pointer-events-none absolute left-3 top-1/2 z-10 size-4 -translate-y-1/2 text-slate-400`}),(0,N.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),onFocus:()=>c(!0),onBlur:()=>{if(l.current){l.current=!1;return}c(!1)},placeholder:`Search skills or pages...`,className:`h-9 w-full rounded-full border border-border/10 bg-input/50 pl-10 pr-4 text-sm text-foreground outline-none transition focus:border-primary/30 focus:ring-1 focus:ring-primary/40 placeholder:text-slate-500`}),s?(0,N.jsx)(`div`,{className:`absolute left-0 right-0 top-full z-50 mt-2 max-h-80 overflow-y-auto rounded-2xl border border-border/15 bg-card shadow-[0_20px_60px_rgba(0,0,0,0.35)] backdrop-blur-xl`,children:d.length===0?(0,N.jsx)(`div`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:`No results found.`}):Array.from(f.entries()).map(([e,t])=>(0,N.jsxs)(`div`,{className:`border-b border-border/10 last:border-b-0`,children:[(0,N.jsx)(`div`,{className:`px-4 pt-3 text-[10px] uppercase tracking-[0.18em] text-slate-500`,children:e}),(0,N.jsx)(`div`,{className:`p-2`,children:t.map(e=>(0,N.jsxs)(`button`,{type:`button`,onMouseDown:e=>{e.preventDefault(),l.current=!0},onClick:()=>{e.onSelect(),c(!1),o(``)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`,children:[e.leading?(0,N.jsx)(`span`,{className:`shrink-0`,children:e.leading}):(0,N.jsx)(`span`,{className:`shrink-0 text-slate-400`,children:e.meta?`•`:``}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(`div`,{className:`truncate text-foreground`,children:e.label}),e.meta?(0,N.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.meta}):null]}),e.trailing?(0,N.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.trailing}):null]},e.id))})]},e))}):null]})]}),(0,N.jsxs)(`div`,{className:`hidden items-center gap-4 sm:flex lg:gap-6`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-4 text-slate-400`,children:[(0,N.jsxs)(`span`,{className:`relative`,"aria-hidden":`true`,children:[(0,N.jsx)(ze,{className:`size-4`}),(0,N.jsx)(`span`,{className:`absolute -right-0.5 -top-0.5 size-2 rounded-full border-2 border-background bg-primary shadow-[0_0_6px_color-mix(in_srgb,var(--primary)_50%,transparent)]`})]}),(0,N.jsx)(_,{className:`size-4`,"aria-hidden":`true`})]}),r?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:`h-8 w-px bg-border/20`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,N.jsxs)(`div`,{className:`hidden text-right md:block`,children:[(0,N.jsx)(`div`,{className:`font-headline text-[10px] uppercase tracking-widest text-slate-400`,children:r.name}),(0,N.jsx)(`div`,{className:`text-[10px] uppercase tracking-widest text-primary`,children:r.subtitle??r.email??`Active`})]}),r.image?(0,N.jsx)(`img`,{src:r.image,alt:r.name,className:`size-8 rounded-full`}):(0,N.jsx)(`div`,{className:`flex size-8 items-center justify-center rounded-full border border-primary/20 bg-card text-primary`,children:r.name?(0,N.jsx)(`span`,{className:`text-xs font-medium`,children:Mt(r.name)}):(0,N.jsx)(Je,{className:`size-4`})})]})]}):null]})]})})}function It({brand:e,navItems:t,renderLink:n,sidebarAction:r,sidebarUser:i,onSignOut:a,mobileOpen:o,onMobileOpenChange:s}){let[c,l]=(0,A.useState)(!1);return(0,N.jsxs)(N.Fragment,{children:[o?(0,N.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-40 bg-black/50 lg:hidden`,onClick:()=>s(!1),"aria-label":`Close sidebar overlay`}):null,(0,N.jsxs)(`aside`,{className:jt(`fixed inset-y-0 left-0 z-50 flex w-64 flex-col border-r border-sidebar-border bg-sidebar`,`transition-transform duration-200 lg:translate-x-0`,o?`translate-x-0`:`-translate-x-full`),children:[(0,N.jsx)(`div`,{className:`px-4 pb-8 pt-6`,children:n({href:e.href,className:`flex items-center gap-3`,onClick:()=>s(!1),children:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:`size-8 shrink-0 bg-primary shadow-[0_0_12px_rgba(79,242,255,0.3)]`,role:`img`,"aria-label":e.name,style:{WebkitMaskImage:`url(/logo.svg)`,WebkitMaskSize:`contain`,WebkitMaskRepeat:`no-repeat`,WebkitMaskPosition:`center`,maskImage:`url(/logo.svg)`,maskSize:`contain`,maskRepeat:`no-repeat`,maskPosition:`center`}}),(0,N.jsxs)(`div`,{className:`flex flex-col`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`font-headline text-2xl font-bold tracking-tighter text-primary text-glow`,children:e.name}),e.badge?(0,N.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-xs font-medium text-primary`,children:e.badge}):null]}),e.caption?(0,N.jsx)(`span`,{className:`font-headline text-[10px] uppercase tracking-[0.2em] text-slate-500`,children:e.caption}):null]})]})})}),(0,N.jsx)(`nav`,{className:`flex-1 space-y-1 px-2`,children:t.map(e=>(0,N.jsxs)(Ot,{children:[(0,N.jsx)(kt,{render:n({href:e.href,onClick:()=>s(!1),className:jt(`flex items-center gap-3 rounded-lg px-4 py-2.5 font-headline text-sm tracking-tight transition-all duration-200`,e.isActive?`bg-card font-bold text-primary shadow-[inset_0_0_0_1px_rgba(79,242,255,0.08)]`:`text-slate-400 hover:bg-muted/50 hover:text-slate-200`),children:(0,N.jsxs)(N.Fragment,{children:[e.icon,(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(`span`,{children:e.label}),e.isLocked?(0,N.jsx)(ft,{className:`size-3.5 opacity-70`}):null]})]})})}),(0,N.jsx)(At,{side:`right`,children:e.tooltip})]},e.href))}),(0,N.jsxs)(`div`,{className:`px-4 pb-4`,children:[r?(0,N.jsxs)(Ot,{children:[(0,N.jsx)(kt,{render:(0,N.jsxs)(`button`,{type:`button`,disabled:r.disabled,"aria-disabled":r.disabled,tabIndex:r.disabled?-1:0,title:r.tooltip,onClick:r.onClick,className:jt(`flex w-full items-center justify-center gap-2 rounded-xl border py-2.5 font-headline text-xs uppercase tracking-wider transition-colors`,r.disabled?`cursor-not-allowed border-primary/15 bg-gradient-to-r from-primary/10 to-primary/5 text-primary/50 opacity-70`:`border-primary/30 bg-gradient-to-r from-primary/12 to-primary/6 text-primary hover:border-primary/50 hover:bg-primary/10`),children:[r.icon,(0,N.jsx)(`span`,{children:r.label})]})}),(0,N.jsx)(At,{side:`right`,children:r.tooltip})]}):null,e.footerLabel?(0,N.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 px-4 py-1.5 font-headline text-[10px] uppercase tracking-widest text-slate-600`,children:[(0,N.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-primary shadow-[0_0_8px_rgba(79,242,255,0.4)]`}),(0,N.jsx)(`span`,{children:e.footerLabel})]}):null]}),i?(0,N.jsx)(`div`,{className:`border-t border-sidebar-border p-3`,children:(0,N.jsxs)(`div`,{className:`relative`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>l(e=>!e),className:`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm text-muted-foreground transition-colors hover:bg-sidebar-accent/50`,children:[i.image?(0,N.jsx)(`img`,{src:i.image,alt:i.name,className:`size-9 rounded-full`}):(0,N.jsx)(`div`,{className:`flex size-9 items-center justify-center rounded-full bg-primary text-xs font-medium text-primary-foreground`,children:Mt(i.name)}),(0,N.jsxs)(`span`,{className:`min-w-0 flex-1 text-left`,children:[(0,N.jsx)(`span`,{className:`block truncate font-medium text-sidebar-foreground`,children:i.name}),(0,N.jsx)(`span`,{className:`block truncate text-xs text-slate-500`,children:i.subtitle??i.email??`Signed in`})]}),a?(0,N.jsx)(w,{className:`size-4`}):null]}),c&&a?(0,N.jsx)(`div`,{className:`absolute bottom-full left-0 mb-2 w-full rounded-lg border border-border bg-popover py-1 shadow-lg`,children:(0,N.jsxs)(`button`,{type:`button`,onClick:async()=>{l(!1),await a()},className:`flex w-full items-center gap-2 px-4 py-2 text-sm text-muted-foreground hover:bg-sidebar-accent/50`,children:[(0,N.jsx)(ot,{className:`size-4`}),(0,N.jsx)(`span`,{children:`Sign out`})]})}):null]})}):null]})]})}var Lt=`@container/main mx-auto max-w-7xl px-4 py-8 sm:px-6 lg:px-8`;function Rt({brand:e,navItems:t,renderLink:n,headerMeta:r,searchItems:i=[],headerUser:a,sidebarUser:o,sidebarAction:s,onSignOut:c,overlay:l,contentClassName:u,children:d}){let[f,p]=(0,A.useState)(!1),m=u===null?d:(0,N.jsx)(`div`,{className:jt(u??Lt),children:d});return(0,N.jsx)(Dt,{children:(0,N.jsxs)(`div`,{className:`min-h-screen bg-background`,children:[(0,N.jsx)(It,{brand:e,navItems:t,renderLink:n,sidebarAction:s??{label:`Run Evolution`,tooltip:`Dashboard-triggered evolution is not available yet.`,icon:(0,N.jsx)(Fe,{className:`size-4`}),disabled:!0},sidebarUser:o,onSignOut:c,mobileOpen:f,onMobileOpenChange:p}),(0,N.jsxs)(`div`,{className:`min-h-screen lg:pl-64`,children:[(0,N.jsx)(Ft,{renderLink:n,headerMeta:r,searchItems:i,headerUser:a,onToggleSidebar:()=>p(e=>!e)}),(0,N.jsx)(`main`,{className:`min-h-[calc(100vh-4rem)]`,children:m})]}),l]})})}function zt({href:e,label:t,detail:n,tone:r=`healthy`,renderLink:i}){let a=r===`warning`?`text-amber-400 ring-amber-400/20 hover:bg-amber-400/8`:r===`critical`?`text-destructive ring-destructive/20 hover:bg-destructive/8`:`text-primary ring-primary/20 hover:bg-primary/8`,o=r===`warning`?`bg-amber-400`:r===`critical`?`bg-destructive`:`animate-pulse bg-primary shadow-[0_0_8px_color-mix(in_srgb,var(--primary)_60%,transparent)]`;return(0,N.jsx)(`footer`,{className:`pointer-events-none fixed bottom-4 right-4 z-20`,children:i({href:e,className:jt(`glass-panel pointer-events-auto flex items-center gap-2 rounded-full border border-foreground/5 px-3 py-2 font-headline text-[10px] uppercase tracking-[0.18em] text-slate-300 shadow-lg transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40`,a),children:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:jt(`size-1.5 rounded-full`,o)}),(0,N.jsx)(`span`,{children:t}),(0,N.jsx)(`span`,{className:`text-foreground/25`,children:`/`}),(0,N.jsx)(`span`,{className:`text-slate-400`,children:n})]})})})}function Bt({eyebrow:e,title:t,description:n,highlights:r=[],primaryAction:i,secondaryAction:a,note:o}){return(0,N.jsx)(`section`,{className:`overflow-hidden rounded-[28px] border border-primary/15 bg-[radial-gradient(circle_at_top_left,rgba(79,242,255,0.18),transparent_32%),linear-gradient(180deg,rgba(8,16,27,0.98),rgba(7,12,22,0.96))] shadow-[0_24px_80px_rgba(0,0,0,0.35)]`,children:(0,N.jsxs)(`div`,{className:`grid gap-10 p-8 lg:grid-cols-[minmax(0,1.1fr)_minmax(300px,0.9fr)] lg:p-10`,children:[(0,N.jsxs)(`div`,{className:`space-y-6`,children:[(0,N.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-[10px] font-semibold uppercase tracking-[0.22em] text-primary`,children:[(0,N.jsx)(ft,{className:`size-3`}),(0,N.jsx)(`span`,{children:e})]}),(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsx)(`h1`,{className:`max-w-2xl font-headline text-3xl font-semibold tracking-tight text-foreground sm:text-4xl`,children:t}),(0,N.jsx)(`p`,{className:`max-w-2xl text-base leading-7 text-slate-300`,children:n})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,N.jsxs)(`a`,{href:i.href,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-2 rounded-full bg-primary px-5 py-2.5 text-sm font-medium text-primary-foreground transition hover:bg-primary/90`,children:[(0,N.jsx)(`span`,{children:i.label}),(0,N.jsx)(k,{className:`size-4`})]}),a?(0,N.jsxs)(`a`,{href:a.href,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-2 rounded-full border border-border/60 bg-background/40 px-5 py-2.5 text-sm font-medium text-slate-200 transition hover:border-primary/30 hover:text-primary`,children:[(0,N.jsx)(`span`,{children:a.label}),(0,N.jsx)(k,{className:`size-4`})]}):null]}),o?(0,N.jsx)(`p`,{className:`text-sm text-slate-500`,children:o}):null]}),(0,N.jsxs)(`div`,{className:`rounded-[24px] border border-white/8 bg-white/4 p-6 backdrop-blur-sm`,children:[(0,N.jsx)(`div`,{className:`mb-4 text-[10px] font-semibold uppercase tracking-[0.22em] text-slate-500`,children:`What unlocks`}),(0,N.jsx)(`div`,{className:`space-y-3`,children:r.map(e=>(0,N.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-white/6 bg-background/40 px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`mt-0.5 flex size-5 items-center justify-center rounded-full bg-primary/12 text-primary`,children:(0,N.jsx)(S,{className:`size-3.5`})}),(0,N.jsx)(`p`,{className:`text-sm leading-6 text-slate-200`,children:e})]},e))})]})]})})}function Vt(e){return(0,N.jsx)(`div`,{className:`@container/main flex flex-1 flex-col py-6`,children:(0,N.jsx)(`div`,{className:`grid grid-cols-12 gap-6 px-4 lg:px-6`,children:(0,N.jsx)(`div`,{className:`col-span-12`,children:(0,N.jsx)(Bt,{...e})})})})}function Ht(e,t){return e.features[t]}function Ut(e,t){return e.discoverable[t]||e.features[t]}var Wt=(0,A.createContext)(null);function Gt({adapter:e,capabilities:t,children:n}){let r=(0,A.useMemo)(()=>({adapter:e,capabilities:t}),[e,t]);return(0,N.jsx)(Wt.Provider,{value:r,children:n})}function Kt(){return(0,A.useContext)(Wt)}function qt(){return Kt()?.adapter??null}function Jt(e,t){return t.mode===`exact`?e===t.value:e.startsWith(t.value)}function Yt(e,t){return!e.feature||Ht(t,e.feature)?`enabled`:e.discoverableFeature&&Ut(t,e.discoverableFeature)?`locked`:`hidden`}var Xt=[{id:`overview`,label:`Overview`,tooltip:`Dashboard overview`,icon:Ee,hosts:{cloud:{path:`/`,title:`Dashboard`,badge:`Overview`,activePatterns:[{mode:`exact`,value:`/`}]},local:{path:`/`,title:`Dashboard`,badge:`Overview`,activePatterns:[{mode:`exact`,value:`/`}]}}},{id:`skills`,label:`Skills`,tooltip:`Skills Library`,icon:Ve,hosts:{cloud:{path:`/skills`,title:`Skills`,badge:`Library`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/skills`},{mode:`prefix`,value:`/skills/`}],detailPrefixes:[`/skills/`],detailBadge:`Skill Report`,detailBackHref:`/skills`,detailBackLabel:`Skills`},local:{path:`/skills`,title:`Skills`,badge:`Library`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/skills`},{mode:`prefix`,value:`/skills/`}],detailPrefixes:[`/skills/`],detailBadge:`Skill Report`,detailBackHref:`/skills`,detailBackLabel:`Skills`}}},{id:`analytics`,label:`Analytics`,tooltip:`Performance analytics`,icon:se,feature:`analytics`,hosts:{cloud:{path:`/analytics`,title:`Analytics`,badge:`Performance`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/analytics`}]},local:{path:`/analytics`,title:`Analytics`,badge:`Performance`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/analytics`}]}}},{id:`registry`,label:`Registry`,tooltip:`Team skill registry`,icon:Pe,feature:`registry`,discoverableFeature:`registry`,lockedTitle:`Team Registry lives in Selftune Cloud`,lockedBody:`Publish versioned skills, watch installations across projects, and roll back bad versions from a single cloud workspace.`,lockedHighlights:[`Version timeline with rollback controls`,`Installation map across your team`,`Managed publish flow for shared skills`],lockedPrimaryCtaLabel:`Upgrade to Team`,lockedPrimaryCtaHref:`https://selftune.dev/pricing`,lockedSecondaryCtaLabel:`Read registry docs`,lockedSecondaryCtaHref:`https://docs.selftune.dev/cloud/registry`,hosts:{cloud:{path:`/registry`,title:`Registry`,badge:`Team`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/registry`}]},local:{path:`/registry`,title:`Registry`,badge:`Locked`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/registry`}]}}},{id:`signals`,label:`Signals`,tooltip:`Contributor signals`,icon:we,feature:`signals`,discoverableFeature:`signals`,lockedTitle:`Contributor signals run through Selftune Cloud`,lockedBody:`See anonymized contributor signals, compare bundle submissions, and turn real-world usage into proposals without leaving the shared dashboard.`,lockedHighlights:[`Cross-skill contributor signal overview`,`Bundle submission trends and cohorts`,`Proposal generation from contributor evidence`],lockedPrimaryCtaLabel:`View cloud plans`,lockedPrimaryCtaHref:`https://selftune.dev/pricing`,lockedSecondaryCtaLabel:`Read signals docs`,lockedSecondaryCtaHref:`https://docs.selftune.dev/cloud/signals`,hosts:{cloud:{path:`/signals`,title:`Signals`,badge:`Signals`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/signals`}]},local:{path:`/signals`,title:`Signals`,badge:`Locked`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/signals`}]}}},{id:`proposals`,label:`Proposals`,tooltip:`Evolution proposals`,icon:fe,feature:`proposals`,discoverableFeature:`proposals`,lockedTitle:`Proposal review is unlocked in Cloud`,lockedBody:`Keep a shared review queue for contributor-driven improvements, approve the right changes, and coordinate deployment across your team.`,lockedHighlights:[`Shared approval and rejection queue`,`Proposal detail with rationale and evidence`,`Tighter loop from contributor signals to deployment`],lockedPrimaryCtaLabel:`Upgrade for review workflows`,lockedPrimaryCtaHref:`https://selftune.dev/pricing`,lockedSecondaryCtaLabel:`See dashboard docs`,lockedSecondaryCtaHref:`https://docs.selftune.dev/cloud/dashboard`,hosts:{cloud:{path:`/proposals`,title:`Proposals`,badge:`Review Queue`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/proposals`}]},local:{path:`/proposals`,title:`Proposals`,badge:`Locked`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/proposals`}]}}},{id:`unmatched`,label:`Unmatched`,tooltip:`Unmatched queries`,icon:ct,hosts:{cloud:{path:`/unmatched`,title:`Unmatched`,badge:`Attention`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/unmatched`}]}}},{id:`settings`,label:`Settings`,tooltip:`Settings and API keys`,icon:Ae,hosts:{cloud:{path:`/settings`,title:`Settings`,badge:`Workspace`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/settings`}]}}},{id:`status`,label:`System Status`,tooltip:`System health diagnostics`,icon:ut,feature:`runtimeStatus`,hosts:{local:{path:`/status`,title:`System Status`,badge:`Diagnostics`,backHref:`/`,backLabel:`Dashboard`,activePatterns:[{mode:`exact`,value:`/status`}]}}}];function Zt(e,t){return Xt.flatMap(n=>{let r=n.hosts[e];if(!r)return[];let i=Yt(n,t);return i===`hidden`?[]:[{id:n.id,label:n.label,tooltip:n.tooltip,icon:n.icon,host:e,path:r.path,title:r.title??n.label,badge:r.badge??n.label,backHref:r.backHref??null,backLabel:r.backLabel??null,activePatterns:r.activePatterns??[{mode:`exact`,value:r.path}],detailPrefixes:r.detailPrefixes??[],detailBadge:r.detailBadge??r.badge??n.label,detailBackHref:r.detailBackHref??r.backHref??null,detailBackLabel:r.detailBackLabel??r.backLabel??null,access:i,lockedTitle:n.lockedTitle,lockedBody:n.lockedBody,lockedHighlights:n.lockedHighlights,lockedPrimaryCtaLabel:n.lockedPrimaryCtaLabel,lockedPrimaryCtaHref:n.lockedPrimaryCtaHref,lockedSecondaryCtaLabel:n.lockedSecondaryCtaLabel,lockedSecondaryCtaHref:n.lockedSecondaryCtaHref}]})}function Qt(e,t){return!!$t(e,[t])}function $t(e,t){for(let n of t){if(n.detailPrefixes.some(t=>e.startsWith(t)))return{...n,matchKind:`detail`,badge:n.detailBadge,backHref:n.detailBackHref,backLabel:n.detailBackLabel};if(n.activePatterns.some(t=>Jt(e,t)))return{...n,matchKind:`route`}}return null}var en=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},tn=new class extends en{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},nn={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},rn=new class{#e=nn;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function an(e){setTimeout(e,0)}var on=typeof window>`u`||`Deno`in globalThis;function H(){}function sn(e,t){return typeof e==`function`?e(t):e}function cn(e){return typeof e==`number`&&e>=0&&e!==1/0}function ln(e,t){return Math.max(e+(t||0)-Date.now(),0)}function un(e,t){return typeof e==`function`?e(t):e}function dn(e,t){return typeof e==`function`?e(t):e}function fn(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==mn(o,t.options))return!1}else if(!gn(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function pn(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(hn(t.options.mutationKey)!==hn(a))return!1}else if(!gn(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function mn(e,t){return(t?.queryKeyHashFn||hn)(e)}function hn(e){return JSON.stringify(e,(e,t)=>xn(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function gn(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>gn(e[n],t[n])):!1}var _n=Object.prototype.hasOwnProperty;function vn(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=bn(e)&&bn(t);if(!r&&!(xn(e)&&xn(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:_n.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=vn(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function yn(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function bn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function xn(e){if(!Sn(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Sn(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Sn(e){return Object.prototype.toString.call(e)===`[object Object]`}function Cn(e){return new Promise(t=>{rn.setTimeout(t,e)})}function wn(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:vn(e,t)}function Tn(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function En(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Dn=Symbol();function On(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Dn?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function kn(e,t){return typeof e==`function`?e(...t):!!e}function An(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var jn=(()=>{let e=()=>on;return{isServer(){return e()},setIsServer(t){e=t}}})();function Mn(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Nn=an;function Pn(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Nn,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var U=Pn(),Fn=new class extends en{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function In(e){return Math.min(1e3*2**e,3e4)}function Ln(e){return(e??`online`)===`online`?Fn.isOnline():!0}var Rn=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function zn(e){let t=!1,n=0,r,i=Mn(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Rn(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>tn.isFocused()&&(e.networkMode===`always`||Fn.isOnline())&&e.canRun(),u=()=>Ln(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(jn.isServer()?0:3),o=e.retryDelay??In,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),Cn(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Bn=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),cn(this.gcTime)&&(this.#e=rn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(jn.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(rn.clearTimeout(this.#e),void 0)}},Vn=class extends Bn{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Wn(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Wn(this.options);e.data!==void 0&&(this.setState(Un(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=wn(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#c({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(H).catch(H):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>dn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Dn||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>un(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!ln(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o||this.#s()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#s(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=On(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=zn({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Rn&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Rn){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#c(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Hn(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Un(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),U.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function Hn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ln(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Un(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Wn(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Gn=class extends en{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Mn(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),qn(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Jn(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Jn(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof dn(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!yn(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Yn(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||dn(this.options.enabled,this.#t)!==dn(t.enabled,this.#t)||un(this.options.staleTime,this.#t)!==un(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||dn(this.options.enabled,this.#t)!==dn(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Zn(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(H)),t}#g(){this.#b();let e=un(this.options.staleTime,this.#t);if(jn.isServer()||this.#r.isStale||!cn(e))return;let t=ln(this.#r.dataUpdatedAt,e)+1;this.#d=rn.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(jn.isServer()||dn(this.options.enabled,this.#t)===!1||!cn(this.#p)||this.#p===0)&&(this.#f=rn.setInterval(()=>{(this.options.refetchIntervalInBackground||tn.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(rn.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(rn.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&qn(e,t),o=i&&Yn(e,n,t,r);(a||o)&&(l={...l,...Hn(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=wn(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=wn(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Xn(e,t),refetch:this.refetch,promise:this.#o,isEnabled:dn(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=Mn())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!yn(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){U.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Kn(e,t){return dn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function qn(e,t){return Kn(e,t)||e.state.data!==void 0&&Jn(e,t,t.refetchOnMount)}function Jn(e,t,n){if(dn(t.enabled,e)!==!1&&un(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Xn(e,t)}return!1}function Yn(e,t,n,r){return(e!==t||dn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Xn(e,n)}function Xn(e,t){return dn(t.enabled,e)!==!1&&e.isStaleByTime(un(t.staleTime,e))}function Zn(e,t){return!yn(e.getCurrentResult(),t)}function Qn(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{An(e,()=>t.signal,()=>n=!0)},u=On(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?En:Tn;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?er:$n,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:$n(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function $n(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function er(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var tr=class extends Bn{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||nr(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=zn({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),U.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function nr(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var rr=class extends en{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new tr({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ir(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ir(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ir(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=ir(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){U.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>pn(t,e))}findAll(e={}){return this.getAll().filter(t=>pn(e,t))}notify(e){U.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return U.batch(()=>Promise.all(e.map(e=>e.continue().catch(H))))}};function ir(e){return e.options.scope?.id}var ar=class extends en{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??mn(r,t),a=this.get(i);return a||(a=new Vn({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){U.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>fn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>fn(e,t)):t}notify(e){U.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){U.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){U.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},or=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ar,this.#t=e.mutationCache||new rr,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=tn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Fn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(un(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=sn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return U.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;U.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return U.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=U.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(H).catch(H)}invalidateQueries(e,t={}){return U.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=U.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(H)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(H)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(un(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(H).catch(H)}fetchInfiniteQuery(e){return e.behavior=Qn(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(H).catch(H)}ensureInfiniteQueryData(e){return e.behavior=Qn(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Fn.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(hn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{gn(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(hn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{gn(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=mn(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Dn&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},sr=A.createContext(void 0),cr=e=>{let t=A.useContext(sr);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},lr=({client:e,children:t})=>(A.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,N.jsx)(sr.Provider,{value:e,children:t})),ur=A.createContext(!1),dr=()=>A.useContext(ur);ur.Provider;function fr(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var pr=A.createContext(fr()),mr=()=>A.useContext(pr),hr=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?kn(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},gr=e=>{A.useEffect(()=>{e.clearReset()},[e])},_r=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||kn(n,[e.error,r])),vr=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},yr=(e,t)=>e.isLoading&&e.isFetching&&!t,br=(e,t)=>e?.suspense&&t.isPending,xr=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Sr(e,t,n){let r=dr(),i=mr(),a=cr(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,vr(o),hr(o,i,s),gr(i);let c=!a.getQueryCache().get(o.queryHash),[l]=A.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(A.useSyncExternalStore(A.useCallback(e=>{let t=d?l.subscribe(U.batchCalls(e)):H;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),A.useEffect(()=>{l.setOptions(o)},[o,l]),br(o,u))throw xr(o,l,i);if(_r({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!jn.isServer()&&yr(u,r)&&(c?xr(o,l,i):s?.promise)?.catch(H).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function Cr(e,t){return Sr(e,Gn,t)}function wr(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.workspace_root==`string`&&typeof t.git_sha==`string`&&typeof t.db_path==`string`&&typeof t.process_mode==`string`&&(t.watcher_mode===`wal`||t.watcher_mode===`jsonl`||t.watcher_mode===`none`)}function Tr({href:e,className:t,children:n,onClick:r}){return(0,N.jsx)(c,{to:e,className:t,onClick:r,children:n})}function Er(){let[e,t]=(0,A.useState)(null);if((0,A.useEffect)(()=>{fetch(`/api/health`).then(e=>e.json()).then(e=>{wr(e)&&t(e)}).catch(()=>{})},[]),!e)return null;let n=e.watcher_mode===`jsonl`,r=e.watcher_mode===`none`,i=e.spa_mode===`proxy`?`proxy`:e.spa_mode===`dist`?`dist`:`missing`,a=n?`Legacy watcher`:r?`Watcher disabled`:`Runtime healthy`,o=n?`warning`:r?`critical`:`healthy`;return(0,N.jsx)(zt,{href:`/status`,label:a,detail:`${e.process_mode} · ${i}`,tone:o,renderLink:Tr})}function Dr(e,t){if(!e.ok||e.service!==`selftune-dashboard`)return null;let n=e.version??`unknown`,r=e.spa_build_id??n,i=t.buildId||t.version;return n===t.version&&r===i?null:{serverVersion:n,serverBuildId:r}}var Or={version:`0.2.27`,buildId:`0.2.27`},kr=3e4;function Ar(){let[e,t]=(0,A.useState)(null);return(0,A.useEffect)(()=>{let e=!0;async function n(){try{let n=await fetch(`/api/health`,{cache:`no-store`});if(!n.ok)return;let r=await n.json();if(!e)return;t(Dr(r,Or))}catch{}}n();let r=window.setInterval(()=>{n()},kr);return()=>{e=!1,window.clearInterval(r)}},[]),e?(0,N.jsxs)(`div`,{className:`fixed right-4 bottom-4 z-[90] max-w-sm rounded-xl border border-amber-500/40 bg-background/95 p-4 shadow-2xl backdrop-blur`,children:[(0,N.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:`Dashboard update available`}),(0,N.jsxs)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:[`The running dashboard is on v`,e.serverVersion,`. Reload to use the newer UI.`]}),(0,N.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90`,children:`Reload now`}),(0,N.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Current build: `,Or.buildId]})]})]}):null}var jr=(0,A.createContext)(void 0),Mr=`selftune-theme`;function Nr({children:e,defaultTheme:t=`dark`}){let[n,r]=(0,A.useState)(`dark`);return(0,A.useEffect)(()=>{let e=window.document.documentElement;e.classList.remove(`light`),e.classList.add(`dark`),localStorage.setItem(Mr,`dark`)},[]),(0,N.jsx)(jr.Provider,{value:{theme:n,setTheme:e=>{localStorage.setItem(Mr,e),r(e)}},children:e})}var Pr=``;async function Fr(){let e=await fetch(`${Pr}/api/v2/overview`);if(!e.ok)throw Error(`API error: ${e.status} ${e.statusText}`);return e.json()}async function Ir(e){let t=await fetch(`${Pr}/api/v2/skills/${encodeURIComponent(e)}`);if(!t.ok)throw t.status===404?new Br(e):Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function Lr(e=20){let t=await fetch(`${Pr}/api/v2/orchestrate-runs?limit=${e}`);if(!t.ok)throw Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function Rr(){let e=await fetch(`${Pr}/api/v2/analytics`);if(!e.ok)throw Error(`API error: ${e.status} ${e.statusText}`);return e.json()}async function zr(){let e=await fetch(`${Pr}/api/v2/doctor`);if(!e.ok)throw Error(`API error: ${e.status} ${e.statusText}`);return e.json()}var Br=class extends Error{constructor(e){super(`Skill "${e}" not found`),this.name=`NotFoundError`}},Vr=6e4;function Hr(){return Cr({queryKey:[`overview`],queryFn:Fr,staleTime:5e3,refetchInterval:Vr})}function Ur(){let e=cr();(0,A.useEffect)(()=>{let t=new EventSource(`/api/v2/events`);return t.addEventListener(`update`,()=>{e.invalidateQueries()}),t.onerror=()=>{},()=>{t.close()}},[e])}function Wr(e,t){return t<5?`UNGRADED`:e>=.8?`HEALTHY`:e>=.5?`WARNING`:`CRITICAL`}function Gr(e){return e==null||!Number.isFinite(e)?`--`:`${Math.round(e*100)}%`}function Kr(e){return[...e].sort((e,t)=>{let n=e.passRate??1,r=t.passRate??1;return n===r?t.checks-e.checks:n-r})}function W(e){let t=new Date(e).getTime();if(Number.isNaN(t))return`--`;let n=Math.max(0,Date.now()-t),r=Math.floor(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function qr(e){let t=e.split(`-`),n=t[1],r=t[2];return!n||!r?e:`${Number(n)}/${Number(r)}`}function Jr({data:e,mode:t}){let n=e.map(e=>t===`pass_rate`?e.pass_rate*100:e.total_checks),r=Math.max(...n,t===`pass_rate`?100:1),i=n.map((e,t)=>({x:48+t/Math.max(1,n.length-1)*624,y:232-(e-0)/Math.max(1,r-0)*200})),a=i.map((e,t)=>`${t===0?`M`:`L`}${e.x},${e.y}`).join(` `),o=`${a} L${i[i.length-1]?.x??48},232 L48,232 Z`,s=t===`pass_rate`?[0,25,50,75,100]:Array.from({length:5},(e,t)=>Math.round(r/4*t)),c=[],l=Math.max(1,Math.floor(e.length/6));for(let t=0;t<e.length;t+=l){let n=e[t],r=i[t];n&&r&&c.push({label:qr(n.date),x:r.x})}return e.length===0?(0,N.jsx)(`div`,{className:`flex items-center justify-center h-[260px] text-muted-foreground text-sm`,children:`No trend data available yet`}):(0,N.jsxs)(`svg`,{viewBox:`0 0 720 260`,className:`w-full h-auto`,preserveAspectRatio:`xMidYMid meet`,children:[(0,N.jsx)(`defs`,{children:(0,N.jsxs)(`linearGradient`,{id:`analytics-chart-fill`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,N.jsx)(`stop`,{offset:`0%`,stopColor:`var(--primary)`,stopOpacity:`0.3`}),(0,N.jsx)(`stop`,{offset:`100%`,stopColor:`var(--primary)`,stopOpacity:`0.02`})]})}),s.map(e=>{let n=232-(e-0)/Math.max(1,r-0)*200;return(0,N.jsxs)(`g`,{children:[(0,N.jsx)(`line`,{x1:48,y1:n,x2:672,y2:n,stroke:`var(--border)`,strokeWidth:`0.5`,strokeDasharray:`4 4`}),(0,N.jsx)(`text`,{x:40,y:n+3,textAnchor:`end`,fill:`var(--muted-foreground)`,fontSize:`9`,fontFamily:`var(--font-headline)`,children:t===`pass_rate`?`${e}%`:e})]},e)}),c.map(e=>(0,N.jsx)(`text`,{x:e.x,y:256,textAnchor:`middle`,fill:`var(--muted-foreground)`,fontSize:`9`,fontFamily:`var(--font-headline)`,children:e.label},e.label)),i.length>1&&(0,N.jsx)(`path`,{d:o,fill:`url(#analytics-chart-fill)`}),i.length>1&&(0,N.jsx)(`path`,{d:a,fill:`none`,stroke:`var(--primary)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{filter:`drop-shadow(0 0 4px rgba(79,242,255,0.5))`}}),i.map((e,t)=>(0,N.jsx)(`circle`,{cx:e.x,cy:e.y,r:`3`,fill:`var(--primary)`,stroke:`var(--muted)`,strokeWidth:`1.5`},t))]})}function Yr({skills:e}){return e.length===0?(0,N.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No skills graded yet`})}):(0,N.jsx)(`div`,{className:`flex-1 flex flex-col gap-4`,children:e.map(e=>(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,N.jsx)(`span`,{className:`font-headline text-[11px] uppercase tracking-wider text-foreground truncate max-w-[65%]`,children:e.skill_name}),(0,N.jsxs)(`span`,{className:`font-headline text-xs font-semibold text-primary`,children:[Math.round(e.pass_rate*100),`%`]})]}),(0,N.jsx)(`div`,{className:`h-[1.5px] rounded-full bg-border/30 overflow-hidden`,children:(0,N.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-all duration-500`,style:{width:`${Math.round(e.pass_rate*100)}%`,boxShadow:`0 0 6px rgba(79,242,255,0.4)`}})}),(0,N.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-1`,children:[e.total_checks,` checks · `,e.triggered_count,` triggered`]})]},e.skill_name))})}function Xr({data:e}){let t=e.slice(-84),n=Math.max(...t.map(e=>e.checks),1);return t.length===0?(0,N.jsx)(`div`,{className:`flex items-center justify-center h-32 text-muted-foreground text-sm`,children:`No grading activity recorded yet`}):(0,N.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,N.jsx)(`div`,{className:`flex flex-wrap gap-1.5 flex-1 content-start`,children:t.map(e=>{let t=e.checks/n;return(0,N.jsx)(`div`,{className:`size-5 rounded-sm transition-colors`,style:{backgroundColor:`color-mix(in srgb, var(--primary) ${Math.round(Math.max(.08,t)*100)}%, transparent)`},title:`${e.date}: ${e.checks} checks`},e.date)})}),(0,N.jsxs)(`div`,{className:`flex items-center justify-end gap-2 mt-auto pt-3`,children:[(0,N.jsx)(`span`,{className:`text-[10px] font-headline uppercase tracking-widest text-muted-foreground`,children:`Quiet`}),[8,25,50,75,100].map(e=>(0,N.jsx)(`div`,{className:`size-3 rounded-sm`,style:{backgroundColor:`color-mix(in srgb, var(--primary) ${e}%, transparent)`}},e)),(0,N.jsx)(`span`,{className:`text-[10px] font-headline uppercase tracking-widest text-muted-foreground`,children:`Active`})]})]})}function Zr({impacts:e}){return e.length===0?(0,N.jsx)(`div`,{className:`flex items-center justify-center h-32`,children:(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No evolution deployments yet`})}):(0,N.jsx)(`div`,{className:`flex flex-col gap-3 max-h-[260px] overflow-y-auto`,children:e.map(e=>{let t=(e.pass_rate_after-e.pass_rate_before)*100,n=t>0;return(0,N.jsxs)(`div`,{className:`flex items-center justify-between bg-muted/50 rounded-lg px-4 py-3`,children:[(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsx)(`p`,{className:`font-headline text-[11px] uppercase tracking-wider text-foreground truncate`,children:e.skill_name}),(0,N.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:[Math.round(e.pass_rate_before*100),`% →`,` `,Math.round(e.pass_rate_after*100),`%`]})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,N.jsxs)(`svg`,{className:`size-3.5 ${n?`text-primary`:`text-destructive rotate-90`}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,N.jsx)(`line`,{x1:`7`,y1:`17`,x2:`17`,y2:`7`}),(0,N.jsx)(`polyline`,{points:`7 7 17 7 17 17`})]}),(0,N.jsxs)(`span`,{className:`font-headline text-sm font-semibold ${n?`text-primary`:`text-destructive`}`,children:[n?`+`:``,Math.round(t),`%`]})]})]},e.proposal_id)})})}function Qr(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var $r=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ei=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ti={};function ni(e,t){return((t||ti).jsx?ei:$r).test(e)}var ri=/[ \t\n\f\r]/g;function ii(e){return typeof e==`object`?e.type===`text`?ai(e.value):!1:ai(e)}function ai(e){return e.replace(ri,``)===``}var oi=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};oi.prototype.normal={},oi.prototype.property={},oi.prototype.space=void 0;function si(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new oi(n,r,t)}function ci(e){return e.toLowerCase()}var li=class{constructor(e,t){this.attribute=t,this.property=e}};li.prototype.attribute=``,li.prototype.booleanish=!1,li.prototype.boolean=!1,li.prototype.commaOrSpaceSeparated=!1,li.prototype.commaSeparated=!1,li.prototype.defined=!1,li.prototype.mustUseProperty=!1,li.prototype.number=!1,li.prototype.overloadedBoolean=!1,li.prototype.property=``,li.prototype.spaceSeparated=!1,li.prototype.space=void 0;var ui=e({boolean:()=>G,booleanish:()=>K,commaOrSpaceSeparated:()=>mi,commaSeparated:()=>pi,number:()=>q,overloadedBoolean:()=>fi,spaceSeparated:()=>J}),di=0,G=hi(),K=hi(),fi=hi(),q=hi(),J=hi(),pi=hi(),mi=hi();function hi(){return 2**++di}var gi=Object.keys(ui),_i=class extends li{constructor(e,t,n,r){let i=-1;if(super(e,t),vi(this,`space`,r),typeof n==`number`)for(;++i<gi.length;){let e=gi[i];vi(this,gi[i],(n&ui[e])===ui[e])}}};_i.prototype.defined=!0;function vi(e,t,n){n&&(e[t]=n)}function yi(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new _i(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[ci(r)]=r,n[ci(a.attribute)]=r}return new oi(t,n,e.space)}var bi=yi({properties:{ariaActiveDescendant:null,ariaAtomic:K,ariaAutoComplete:null,ariaBusy:K,ariaChecked:K,ariaColCount:q,ariaColIndex:q,ariaColSpan:q,ariaControls:J,ariaCurrent:null,ariaDescribedBy:J,ariaDetails:null,ariaDisabled:K,ariaDropEffect:J,ariaErrorMessage:null,ariaExpanded:K,ariaFlowTo:J,ariaGrabbed:K,ariaHasPopup:null,ariaHidden:K,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:J,ariaLevel:q,ariaLive:null,ariaModal:K,ariaMultiLine:K,ariaMultiSelectable:K,ariaOrientation:null,ariaOwns:J,ariaPlaceholder:null,ariaPosInSet:q,ariaPressed:K,ariaReadOnly:K,ariaRelevant:null,ariaRequired:K,ariaRoleDescription:J,ariaRowCount:q,ariaRowIndex:q,ariaRowSpan:q,ariaSelected:K,ariaSetSize:q,ariaSort:null,ariaValueMax:q,ariaValueMin:q,ariaValueNow:q,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function xi(e,t){return t in e?e[t]:t}function Si(e,t){return xi(e,t.toLowerCase())}var Ci=yi({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:pi,acceptCharset:J,accessKey:J,action:null,allow:null,allowFullScreen:G,allowPaymentRequest:G,allowUserMedia:G,alt:null,as:null,async:G,autoCapitalize:null,autoComplete:J,autoFocus:G,autoPlay:G,blocking:J,capture:null,charSet:null,checked:G,cite:null,className:J,cols:q,colSpan:null,content:null,contentEditable:K,controls:G,controlsList:J,coords:q|pi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:G,defer:G,dir:null,dirName:null,disabled:G,download:fi,draggable:K,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:G,formTarget:null,headers:J,height:q,hidden:fi,high:q,href:null,hrefLang:null,htmlFor:J,httpEquiv:J,id:null,imageSizes:null,imageSrcSet:null,inert:G,inputMode:null,integrity:null,is:null,isMap:G,itemId:null,itemProp:J,itemRef:J,itemScope:G,itemType:J,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:G,low:q,manifest:null,max:null,maxLength:q,media:null,method:null,min:null,minLength:q,multiple:G,muted:G,name:null,nonce:null,noModule:G,noValidate:G,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:G,optimum:q,pattern:null,ping:J,placeholder:null,playsInline:G,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:G,referrerPolicy:null,rel:J,required:G,reversed:G,rows:q,rowSpan:q,sandbox:J,scope:null,scoped:G,seamless:G,selected:G,shadowRootClonable:G,shadowRootDelegatesFocus:G,shadowRootMode:null,shape:null,size:q,sizes:null,slot:null,span:q,spellCheck:K,src:null,srcDoc:null,srcLang:null,srcSet:null,start:q,step:null,style:null,tabIndex:q,target:null,title:null,translate:null,type:null,typeMustMatch:G,useMap:null,value:K,width:q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:J,axis:null,background:null,bgColor:null,border:q,borderColor:null,bottomMargin:q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:G,declare:G,event:null,face:null,frame:null,frameBorder:null,hSpace:q,leftMargin:q,link:null,longDesc:null,lowSrc:null,marginHeight:q,marginWidth:q,noResize:G,noHref:G,noShade:G,noWrap:G,object:null,profile:null,prompt:null,rev:null,rightMargin:q,rules:null,scheme:null,scrolling:K,standby:null,summary:null,text:null,topMargin:q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:q,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:G,disableRemotePlayback:G,prefix:null,property:null,results:q,security:null,unselectable:null},space:`html`,transform:Si}),wi=yi({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:mi,accentHeight:q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:q,amplitude:q,arabicForm:null,ascent:q,attributeName:null,attributeType:null,azimuth:q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:q,by:null,calcMode:null,capHeight:q,className:J,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:q,diffuseConstant:q,direction:null,display:null,dur:null,divisor:q,dominantBaseline:null,download:G,dx:null,dy:null,edgeMode:null,editable:null,elevation:q,enableBackground:null,end:null,event:null,exponent:q,externalResourcesRequired:null,fill:null,fillOpacity:q,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:pi,g2:pi,glyphName:pi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:q,horizOriginX:q,horizOriginY:q,id:null,ideographic:q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:q,k:q,k1:q,k2:q,k3:q,k4:q,kernelMatrix:mi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:q,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:q,overlineThickness:q,paintOrder:null,panose1:null,path:null,pathLength:q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:J,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:q,pointsAtY:q,pointsAtZ:q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:mi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:mi,rev:mi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:mi,requiredFeatures:mi,requiredFonts:mi,requiredFormats:mi,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:q,specularExponent:q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:q,strikethroughThickness:q,string:null,stroke:null,strokeDashArray:mi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:q,strokeOpacity:q,strokeWidth:null,style:null,surfaceScale:q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:mi,tabIndex:q,tableValues:null,target:null,targetX:q,targetY:q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:mi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:q,underlineThickness:q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:q,values:null,vAlphabetic:q,vMathematical:q,vectorEffect:null,vHanging:q,vIdeographic:q,version:null,vertAdvY:q,vertOriginX:q,vertOriginY:q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:xi}),Ti=yi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Ei=yi({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Si}),Di=yi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Oi={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},ki=/[A-Z]/g,Ai=/-[a-z]/g,ji=/^data[-\w.:]+$/i;function Mi(e,t){let n=ci(t),r=t,i=li;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&ji.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Ai,Pi);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Ai.test(e)){let n=e.replace(ki,Ni);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=_i}return new i(r,t)}function Ni(e){return`-`+e.toLowerCase()}function Pi(e){return e.charAt(1).toUpperCase()}var Fi=si([bi,Ci,Ti,Ei,Di],`html`),Ii=si([bi,wi,Ti,Ei,Di],`svg`);function Li(e){return e.join(` `).trim()}var Ri=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
2
|
+
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),zi=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(Ri());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Bi=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Vi=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(zi()),r=Bi();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Hi=Wi(`end`),Ui=Wi(`start`);function Wi(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Gi(e){let t=Ui(e),n=Hi(e);if(t&&n)return{start:t,end:n}}function Ki(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Ji(e.position):`start`in e||`end`in e?Ji(e):`line`in e||`column`in e?qi(e):``}function qi(e){return Yi(e&&e.line)+`:`+Yi(e&&e.column)}function Ji(e){return qi(e&&e.start)+`-`+qi(e&&e.end)}function Yi(e){return e&&typeof e==`number`?e:1}var Y=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Ki(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Y.prototype.file=``,Y.prototype.name=``,Y.prototype.reason=``,Y.prototype.message=``,Y.prototype.stack=``,Y.prototype.column=void 0,Y.prototype.line=void 0,Y.prototype.ancestors=void 0,Y.prototype.cause=void 0,Y.prototype.fatal=void 0,Y.prototype.place=void 0,Y.prototype.ruleId=void 0,Y.prototype.source=void 0;var Xi=t(Vi(),1),Zi={}.hasOwnProperty,Qi=new Map,$i=/[A-Z]/g,ea=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),ta=new Set([`td`,`th`]),na=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function ra(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=ma(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=pa(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Ii:Fi,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=ia(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function ia(e,t,n){if(t.type===`element`)return aa(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return oa(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return ca(e,t,n);if(t.type===`mdxjsEsm`)return sa(e,t);if(t.type===`root`)return la(e,t,n);if(t.type===`text`)return ua(e,t)}function aa(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Ii,e.schema=i),e.ancestors.push(t);let a=ba(e,t.tagName,!1),o=ha(e,t),s=_a(e,t);return ea.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!ii(e):!0})),da(e,o,a,t),fa(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function oa(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}xa(e,t.position)}function sa(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);xa(e,t.position)}function ca(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Ii,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:ba(e,t.name,!0),o=ga(e,t),s=_a(e,t);return da(e,o,a,t),fa(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function la(e,t,n){let r={};return fa(r,_a(e,t)),e.create(t,e.Fragment,r,n)}function ua(e,t){return t.value}function da(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function fa(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function pa(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function ma(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Ui(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function ha(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Zi.call(t.properties,i)){let a=va(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&ta.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function ga(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else xa(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else xa(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function _a(e,t){let n=[],r=-1,i=e.passKeys?new Map:Qi;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=ia(e,a,o);s!==void 0&&n.push(s)}return n}function va(e,t,n){let r=Mi(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Qr(n):Li(n)),r.property===`style`){let t=typeof n==`object`?n:ya(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Sa(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Oi[r.property]||r.property:r.attribute,n]}}function ya(e,t){try{return(0,Xi.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Y("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=na+`#cannot-parse-style-attribute`,r}}function ba(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=ni(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=ni(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Zi.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);xa(e)}function xa(e,t){let n=new Y("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=na+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Sa(e){let t={},n;for(n in e)Zi.call(e,n)&&(t[Ca(n)]=e[n]);return t}function Ca(e){let t=e.replace($i,wa);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function wa(e){return`-`+e.toLowerCase()}var Ta={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},Ea={};function Da(e,t){let n=t||Ea;return Oa(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Oa(e,t,n){if(Aa(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return ka(e.children,t,n)}return Array.isArray(e)?ka(e,t,n):``}function ka(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Oa(e[i],t,n);return r.join(``)}function Aa(e){return!!(e&&typeof e==`object`)}var ja=document.createElement(`i`);function Ma(e){let t=`&`+e+`;`;ja.innerHTML=t;let n=ja.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function Na(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Pa(e,t){return e.length>0?(Na(e,e.length,0,t),e):t}var Fa={}.hasOwnProperty;function Ia(e){let t={},n=-1;for(;++n<e.length;)La(t,e[n]);return t}function La(e,t){let n;for(n in t){let r=(Fa.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Fa.call(r,a)||(r[a]=[]);let e=i[a];Ra(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Ra(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Na(e,0,0,r)}function za(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function Ba(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Va=Za(/[A-Za-z]/),Ha=Za(/[\dA-Za-z]/),Ua=Za(/[#-'*+\--9=?A-Z^-~]/);function Wa(e){return e!==null&&(e<32||e===127)}var Ga=Za(/\d/),Ka=Za(/[\dA-Fa-f]/),qa=Za(/[!-/:-@[-`{-~]/);function X(e){return e!==null&&e<-2}function Ja(e){return e!==null&&(e<0||e===32)}function Z(e){return e===-2||e===-1||e===32}var Ya=Za(/\p{P}|\p{S}/u),Xa=Za(/\s/);function Za(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Qa(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Ha(e.charCodeAt(n+1))&&Ha(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Q(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Z(r)?(e.enter(n),s(r)):t(r)}function s(r){return Z(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var $a={tokenize:eo};function eo(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Q(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return X(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var to={tokenize:ro},no={tokenize:io};function ro(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return Na(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(no,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(no,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return X(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;Na(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function io(e,t,n){return Q(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function ao(e){if(e===null||Ja(e)||Xa(e))return 1;if(Ya(e))return 2}function oo(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var so={name:`attention`,resolveAll:co,tokenize:lo};function co(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};uo(d,-c),uo(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Pa(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Pa(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Pa(l,oo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Pa(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Pa(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Na(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function lo(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=ao(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=ao(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function uo(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var fo={name:`autolink`,tokenize:po};function po(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return Va(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Ha(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||Ha(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Wa(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Ua(t)?(e.consume(t),l):n(t)}function u(e){return Ha(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||Ha(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var mo={partial:!0,tokenize:ho};function ho(e,t,n){return r;function r(t){return Z(t)?Q(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||X(e)?t(e):n(e)}}var go={continuation:{tokenize:vo},exit:yo,name:`blockQuote`,tokenize:_o};function _o(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Z(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function vo(e,t,n){let r=this;return i;function i(t){return Z(t)?Q(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(go,t,n)(r)}}function yo(e){e.exit(`blockQuote`)}var bo={name:`characterEscape`,tokenize:xo};function xo(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return qa(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var So={name:`characterReference`,tokenize:Co};function Co(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=Ha,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Ka,u):(e.enter(`characterReferenceValue`),a=7,o=Ga,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Ha&&!Ma(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var wo={partial:!0,tokenize:Do},To={concrete:!0,name:`codeFenced`,tokenize:Eo};function Eo(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Z(t)?Q(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||X(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(wo,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||X(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Z(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Q(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||X(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||X(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Z(t)?Q(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||X(t)?e.check(wo,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||X(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Z(t)?Q(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Z(t)?Q(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||X(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Do(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Oo={name:`codeIndented`,tokenize:Ao},ko={partial:!0,tokenize:jo};function Ao(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Q(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):X(t)?e.attempt(ko,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||X(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function jo(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):X(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Q(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):X(e)?i(e):n(e)}}var Mo={name:`codeText`,previous:Po,resolve:No,tokenize:Fo};function No(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Po(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Fo(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):X(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||X(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var Io=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&Lo(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),Lo(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Lo(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);Lo(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);Lo(this.left,t.reverse())}}};function Lo(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Ro(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Io(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,zo(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return Na(e,0,1/0,u.slice(0)),!l}function zo(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Bo={resolve:Ho,tokenize:Uo},Vo={partial:!0,tokenize:Wo};function Ho(e){return Ro(e),e}function Uo(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):X(t)?e.check(Vo,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Wo(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Q(e,a,`linePrefix`)}function a(i){if(i===null||X(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Go(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Wa(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||X(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Ja(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Wa(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Ko(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):X(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||X(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Z(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function qo(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):X(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Q(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||X(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Jo(e,t){let n;return r;function r(i){return X(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Z(i)?Q(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Yo={name:`definition`,tokenize:Zo},Xo={partial:!0,tokenize:Qo};function Zo(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Ko.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Ba(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Ja(t)?Jo(e,l)(t):l(t)}function l(t){return Go(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Xo,d,d)(t)}function d(t){return Z(t)?Q(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||X(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Qo(e,t,n){return r;function r(t){return Ja(t)?Jo(e,i)(t):n(t)}function i(t){return qo(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Z(t)?Q(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||X(e)?t(e):n(e)}}var $o={name:`hardBreakEscape`,tokenize:es};function es(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return X(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var ts={name:`headingAtx`,resolve:ns,tokenize:rs};function ns(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},Na(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function rs(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Ja(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||X(n)?(e.exit(`atxHeading`),t(n)):Z(n)?Q(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Ja(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var is=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),as=[`pre`,`script`,`style`,`textarea`],os={concrete:!0,name:`htmlFlow`,resolveTo:ls,tokenize:us},ss={partial:!0,tokenize:fs},cs={partial:!0,tokenize:ds};function ls(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function us(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:oe):Va(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):Va(a)?(e.consume(a),i=4,r.interrupt?t:oe):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:oe):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return Va(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Ja(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&as.includes(l)?(i=1,r.interrupt?t(s):O(s)):is.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Ha(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Z(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Va(t)?(e.consume(t),b):Z(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Ha(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Z(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Z(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||X(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Ja(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Z(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||X(t)?O(t):Z(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),re):t===60&&i===1?(e.consume(t),k):t===62&&i===4?(e.consume(t),se):t===63&&i===3?(e.consume(t),oe):t===93&&i===5?(e.consume(t),ae):X(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(ss,ce,ee)(t)):t===null||X(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),O)}function ee(t){return e.check(cs,te,ce)(t)}function te(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ne}function ne(t){return t===null||X(t)?ee(t):(e.enter(`htmlFlowData`),O(t))}function re(t){return t===45?(e.consume(t),oe):O(t)}function k(t){return t===47?(e.consume(t),o=``,ie):O(t)}function ie(t){if(t===62){let n=o.toLowerCase();return as.includes(n)?(e.consume(t),se):O(t)}return Va(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ie):O(t)}function ae(t){return t===93?(e.consume(t),oe):O(t)}function oe(t){return t===62?(e.consume(t),se):t===45&&i===2?(e.consume(t),oe):O(t)}function se(t){return t===null||X(t)?(e.exit(`htmlFlowData`),ce(t)):(e.consume(t),se)}function ce(n){return e.exit(`htmlFlow`),t(n)}}function ds(e,t,n){let r=this;return i;function i(t){return X(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function fs(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(mo,t,n)}}var ps={name:`htmlText`,tokenize:ms};function ms(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):Va(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):Va(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):X(t)?(o=d,k(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?re(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):X(t)?(o=h,k(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?re(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?re(t):X(t)?(o=v,k(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):X(t)?(o=y,k(t)):(e.consume(t),y)}function b(e){return e===62?re(e):y(e)}function x(t){return Va(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Ha(t)?(e.consume(t),S):C(t)}function C(t){return X(t)?(o=C,k(t)):Z(t)?(e.consume(t),C):re(t)}function w(t){return t===45||Ha(t)?(e.consume(t),w):t===47||t===62||Ja(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),re):t===58||t===95||Va(t)?(e.consume(t),E):X(t)?(o=T,k(t)):Z(t)?(e.consume(t),T):re(t)}function E(t){return t===45||t===46||t===58||t===95||Ha(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):X(t)?(o=D,k(t)):Z(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,ee):X(t)?(o=O,k(t)):Z(t)?(e.consume(t),O):(e.consume(t),te)}function ee(t){return t===i?(e.consume(t),i=void 0,ne):t===null?n(t):X(t)?(o=ee,k(t)):(e.consume(t),ee)}function te(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Ja(t)?T(t):(e.consume(t),te)}function ne(e){return e===47||e===62||Ja(e)?T(e):n(e)}function re(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function k(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ie}function ie(t){return Z(t)?Q(e,ae,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ae(t)}function ae(t){return e.enter(`htmlTextData`),o(t)}}var hs={name:`labelEnd`,resolveAll:ys,resolveTo:bs,tokenize:xs},gs={tokenize:Ss},_s={tokenize:Cs},vs={tokenize:ws};function ys(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&Na(e,0,e.length,n),e}function bs(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=Pa(s,e.slice(a+1,a+r+3)),s=Pa(s,[[`enter`,u,t]]),s=Pa(s,oo(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Pa(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Pa(s,e.slice(o+1)),s=Pa(s,[[`exit`,c,t]]),Na(e,a,e.length,s),e}function xs(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(Ba(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(gs,u,o?u:d)(t):t===91?e.attempt(_s,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(vs,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Ss(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Ja(t)?Jo(e,a)(t):a(t)}function a(t){return t===41?u(t):Go(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Ja(t)?Jo(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?qo(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Ja(t)?Jo(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function Cs(e,t,n){let r=this;return i;function i(t){return Ko.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Ba(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function ws(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Ts={name:`labelStartImage`,resolveAll:hs.resolveAll,tokenize:Es};function Es(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Ds={name:`labelStartLink`,resolveAll:hs.resolveAll,tokenize:Os};function Os(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var ks={name:`lineEnding`,tokenize:As};function As(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Q(e,t,`linePrefix`)}}var js={name:`thematicBreak`,tokenize:Ms};function Ms(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||X(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Z(t)?Q(e,s,`whitespace`)(t):s(t))}}var $={continuation:{tokenize:Is},exit:Rs,name:`list`,tokenize:Fs},Ns={partial:!0,tokenize:zs},Ps={partial:!0,tokenize:Ls};function Fs(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Ga(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(js,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Ga(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(mo,r.interrupt?n:u,e.attempt(Ns,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Z(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Is(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(mo,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Q(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Z(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Ps,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Q(e,e.attempt($,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Ls(e,t,n){let r=this;return Q(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Rs(e){e.exit(this.containerState.type)}function zs(e,t,n){let r=this;return Q(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Z(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Bs={name:`setextUnderline`,resolveTo:Vs,tokenize:Hs};function Vs(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Hs(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Z(t)?Q(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||X(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Us={tokenize:Ws};function Ws(e){let t=this,n=e.attempt(mo,r,e.attempt(this.parser.constructs.flowInitial,i,Q(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Bo,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Gs={resolveAll:Ys()},Ks=Js(`string`),qs=Js(`text`);function Js(e){return{resolveAll:Ys(e===`text`?Xs:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Ys(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Xs(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Zs=e({attentionMarkers:()=>ac,contentInitial:()=>$s,disable:()=>oc,document:()=>Qs,flow:()=>tc,flowInitial:()=>ec,insideSpan:()=>ic,string:()=>nc,text:()=>rc}),Qs={42:$,43:$,45:$,48:$,49:$,50:$,51:$,52:$,53:$,54:$,55:$,56:$,57:$,62:go},$s={91:Yo},ec={[-2]:Oo,[-1]:Oo,32:Oo},tc={35:ts,42:js,45:[Bs,js],60:os,61:Bs,95:js,96:To,126:To},nc={38:So,92:bo},rc={[-5]:ks,[-4]:ks,[-3]:ks,33:Ts,38:So,42:so,60:[fo,ps],91:Ds,92:[$o,bo],93:hs,95:so,96:Mo},ic={null:[so,Gs]},ac={null:[42,95]},oc={null:[]};function sc(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Pa(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=oo(a,l.events,l),l.events):[]}function f(e,t){return lc(p(e),t)}function p(e){return cc(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){X(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&Na(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function cc(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function lc(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
3
3
|
`;break;case-3:o=`\r
|
|
4
|
-
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function uc(e){let t={constructs:Fa([Zs,...(e||{}).extensions||[]]),content:n(Qa),defined:[],document:n(eo),flow:n(Us),lazy:{},string:n(Ks),text:n(qs)};return t;function n(e){return n;function n(n){return sc(t,e,n)}}}function dc(e){for(;!Lo(e););return e}var fc=/[\0\t\n\r]/g;function pc(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(fc.lastIndex=u,c=fc.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var mc=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function hc(e){return e.replace(mc,gc)}function gc(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Ra(n.slice(t?2:1),t?16:10)}return ja(n)||e}var _c={}.hasOwnProperty;function vc(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),yc(n)(dc(uc(n).document().write(pc()(e,t,!0))))}function yc(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(Te),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(xe),blockQuote:a(ge),characterEscape:T,characterReference:T,codeFenced:a(_e),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(_e,o),codeText:a(ve,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ye),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(be),hardBreakEscape:a(Se),hardBreakTrailing:a(Se),htmlFlow:a(Ce,o),htmlFlowData:T,htmlText:a(Ce,o),htmlTextData:T,image:a(we),label:o,link:a(Te),listItem:a(De),listItemValue:f,listOrdered:a(Ee,d),listUnordered:a(Ee),paragraph:a(Oe),reference:le,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(xe),strong:a(ke),thematicBreak:a(je)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:he,autolinkProtocol:me,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:de,characterReferenceMarkerNumeric:de,characterReferenceValue:fe,characterReference:pe,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(ne),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(ee),htmlFlowData:E,htmlText:c(te),htmlTextData:E,image:c(re),label:ae,labelText:ie,lineEnding:D,link:c(k),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ue,resourceDestinationString:oe,resourceTitleString:se,resource:ce,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};xc(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];_c.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||Cc).call(a,void 0,e[0])}for(r.position={start:bc(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:bc(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:bc(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||Cc).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Gi({start:e.start,end:e.end})+`): it’s not open`);n.position.end=bc(e.end)}function u(){return Ea(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=za(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ae(),n.position={start:bc(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=bc(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=bc(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function k(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function re(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ie(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=hc(t),n.identifier=za(t).toLowerCase()}function ae(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function oe(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function se(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ce(){this.data.inReference=void 0}function le(){this.data.referenceType=`collapsed`}function ue(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=za(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function de(e){this.data.characterReferenceType=e.type}function fe(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Ra(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=ja(t);let i=this.stack[this.stack.length-1];i.value+=r}function pe(e){let t=this.stack.pop();t.position.end=bc(e.end)}function me(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function he(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ge(){return{type:`blockquote`,children:[]}}function _e(){return{type:`code`,lang:null,meta:null,value:``}}function ve(){return{type:`inlineCode`,value:``}}function ye(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function be(){return{type:`emphasis`,children:[]}}function xe(){return{type:`heading`,depth:0,children:[]}}function Se(){return{type:`break`}}function Ce(){return{type:`html`,value:``}}function we(){return{type:`image`,title:null,url:``,alt:null}}function Te(){return{type:`link`,title:null,url:``,children:[]}}function Ee(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function De(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Oe(){return{type:`paragraph`,children:[]}}function ke(){return{type:`strong`,children:[]}}function Ae(){return{type:`text`,value:``}}function je(){return{type:`thematicBreak`}}}function bc(e){return{line:e.line,column:e.column,offset:e.offset}}function xc(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?xc(e,r):Sc(e,r)}}function Sc(e,t){let n;for(n in t)if(_c.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function Cc(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Gi({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Gi({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Gi({start:t.start,end:t.end})+`) is still open`)}function wc(e){let t=this;t.parser=n;function n(n){return vc(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Tc(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Ec(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
4
|
+
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function uc(e){let t={constructs:Ia([Zs,...(e||{}).extensions||[]]),content:n($a),defined:[],document:n(to),flow:n(Us),lazy:{},string:n(Ks),text:n(qs)};return t;function n(e){return n;function n(n){return sc(t,e,n)}}}function dc(e){for(;!Ro(e););return e}var fc=/[\0\t\n\r]/g;function pc(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(fc.lastIndex=u,c=fc.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var mc=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function hc(e){return e.replace(mc,gc)}function gc(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return za(n.slice(t?2:1),t?16:10)}return Ma(n)||e}var _c={}.hasOwnProperty;function vc(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),yc(n)(dc(uc(n).document().write(pc()(e,t,!0))))}function yc(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(Te),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(xe),blockQuote:a(ge),characterEscape:T,characterReference:T,codeFenced:a(_e),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(_e,o),codeText:a(ve,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ye),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(be),hardBreakEscape:a(Se),hardBreakTrailing:a(Se),htmlFlow:a(Ce,o),htmlFlowData:T,htmlText:a(Ce,o),htmlTextData:T,image:a(we),label:o,link:a(Te),listItem:a(De),listItemValue:f,listOrdered:a(Ee,d),listUnordered:a(Ee),paragraph:a(Oe),reference:le,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(xe),strong:a(ke),thematicBreak:a(je)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:he,autolinkProtocol:me,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:de,characterReferenceMarkerNumeric:de,characterReferenceValue:fe,characterReference:pe,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(ne),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(ee),htmlFlowData:E,htmlText:c(te),htmlTextData:E,image:c(k),label:ae,labelText:ie,lineEnding:D,link:c(re),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ue,resourceDestinationString:oe,resourceTitleString:se,resource:ce,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};xc(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];_c.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||Cc).call(a,void 0,e[0])}for(r.position={start:bc(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:bc(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:bc(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||Cc).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Ki({start:e.start,end:e.end})+`): it’s not open`);n.position.end=bc(e.end)}function u(){return Da(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Ba(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ae(),n.position={start:bc(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=bc(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=bc(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function re(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function k(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ie(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=hc(t),n.identifier=Ba(t).toLowerCase()}function ae(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function oe(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function se(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ce(){this.data.inReference=void 0}function le(){this.data.referenceType=`collapsed`}function ue(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Ba(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function de(e){this.data.characterReferenceType=e.type}function fe(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=za(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Ma(t);let i=this.stack[this.stack.length-1];i.value+=r}function pe(e){let t=this.stack.pop();t.position.end=bc(e.end)}function me(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function he(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ge(){return{type:`blockquote`,children:[]}}function _e(){return{type:`code`,lang:null,meta:null,value:``}}function ve(){return{type:`inlineCode`,value:``}}function ye(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function be(){return{type:`emphasis`,children:[]}}function xe(){return{type:`heading`,depth:0,children:[]}}function Se(){return{type:`break`}}function Ce(){return{type:`html`,value:``}}function we(){return{type:`image`,title:null,url:``,alt:null}}function Te(){return{type:`link`,title:null,url:``,children:[]}}function Ee(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function De(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Oe(){return{type:`paragraph`,children:[]}}function ke(){return{type:`strong`,children:[]}}function Ae(){return{type:`text`,value:``}}function je(){return{type:`thematicBreak`}}}function bc(e){return{line:e.line,column:e.column,offset:e.offset}}function xc(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?xc(e,r):Sc(e,r)}}function Sc(e,t){let n;for(n in t)if(_c.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function Cc(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Ki({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ki({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Ki({start:t.start,end:t.end})+`) is still open`)}function wc(e){let t=this;t.parser=n;function n(n){return vc(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Tc(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Ec(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
5
5
|
`}]}function Dc(e,t){let n=t.value?t.value+`
|
|
6
|
-
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function Oc(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function kc(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ac(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=
|
|
6
|
+
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function Oc(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function kc(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ac(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Qa(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function jc(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Mc(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Nc(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function Pc(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Nc(e,t);let i={src:Qa(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function Fc(e,t){let n={src:Qa(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Ic(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Lc(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Nc(e,t);let i={href:Qa(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Rc(e,t){let n={href:Qa(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function zc(e,t,n){let r=e.all(t),i=n?Bc(n):Vc(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
7
7
|
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
8
|
-
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function Bc(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=Vc(n[r])}return t}function Vc(e){return e.spread??e.children.length>1}function Hc(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function Uc(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Wc(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Gc(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Kc(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=
|
|
8
|
+
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function Bc(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=Vc(n[r])}return t}function Vc(e){return e.spread??e.children.length>1}function Hc(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function Uc(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Wc(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Gc(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Kc(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=Ui(t.children[1]),o=Hi(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function qc(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function Jc(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var Yc=9,Xc=32;function Zc(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(Qc(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Qc(t.slice(i),i>0,!1)),a.join(``)}function Qc(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===Yc||t===Xc;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===Yc||t===Xc;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function $c(e,t){let n={type:`text`,value:Zc(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function el(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var tl={blockquote:Tc,break:Ec,code:Dc,delete:Oc,emphasis:kc,footnoteReference:Ac,heading:jc,html:Mc,imageReference:Pc,image:Fc,inlineCode:Ic,linkReference:Lc,link:Rc,listItem:zc,list:Hc,paragraph:Uc,root:Wc,strong:Gc,table:Kc,tableCell:Jc,tableRow:qc,text:$c,thematicBreak:el,toml:nl,yaml:nl,definition:nl,footnoteDefinition:nl};function nl(){}var rl=typeof self==`object`?self:globalThis,il=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new rl[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new rl[a](o),i)};return r},al=e=>il(new Map,e)(0),ol=``,{toString:sl}={},{keys:cl}=Object,ll=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=sl.call(e).slice(8,-1);switch(n){case`Array`:return[1,ol];case`Object`:return[2,ol];case`Date`:return[3,ol];case`RegExp`:return[4,ol];case`Map`:return[5,ol];case`Set`:return[6,ol];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},ul=([e,t])=>e===0&&(t===`function`||t===`symbol`),dl=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=ll(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of cl(r))(e||!ul(ll(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(ul(ll(n))||ul(ll(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!ul(ll(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},fl=(e,{json:t,lossy:n}={})=>{let r=[];return dl(!(t||n),!!t,new Map,r)(e),r},pl=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?al(fl(e,t)):structuredClone(e):(e,t)=>al(fl(e,t));function ml(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function hl(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function gl(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||ml,r=e.options.footnoteBackLabel||hl,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=Qa(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...pl(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
9
9
|
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
10
|
-
`}]}}var _l=(function(e){if(e==null)return Sl;if(typeof e==`function`)return xl(e);if(typeof e==`object`)return Array.isArray(e)?vl(e):yl(e);if(typeof e==`string`)return bl(e);throw Error(`Expected function, string, or object as test`)});function vl(e){let t=[],n=-1;for(;++n<e.length;)t[n]=_l(e[n]);return xl(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function yl(e){let t=e;return xl(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function bl(e){return xl(t);function t(t){return t&&t.type===e}}function xl(e){return t;function t(t,n,r){return!!(Cl(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Sl(){return!0}function Cl(e){return typeof e==`object`&&!!e&&`type`in e}function wl(e){return e}var Tl=[];function El(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=_l(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,`name`,{value:`node (`+wl(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Tl,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Dl(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function Dl(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Tl:[e]}function Ol(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),El(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var kl={}.hasOwnProperty,Al={};function jl(e,t){let n=t||Al,r=new Map,i=new Map,a={all:s,applyData:Nl,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...tl,...n.handlers},one:o,options:n,patch:Ml,wrap:Fl};return Ol(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(kl.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=pl(n);return r.children=a.all(e),r}return pl(e)}return(a.options.unknownHandler||Pl)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=Il(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=Il(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function Ml(e,t){e.position&&(t.position=
|
|
10
|
+
`}]}}var _l=(function(e){if(e==null)return Sl;if(typeof e==`function`)return xl(e);if(typeof e==`object`)return Array.isArray(e)?vl(e):yl(e);if(typeof e==`string`)return bl(e);throw Error(`Expected function, string, or object as test`)});function vl(e){let t=[],n=-1;for(;++n<e.length;)t[n]=_l(e[n]);return xl(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function yl(e){let t=e;return xl(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function bl(e){return xl(t);function t(t){return t&&t.type===e}}function xl(e){return t;function t(t,n,r){return!!(Cl(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Sl(){return!0}function Cl(e){return typeof e==`object`&&!!e&&`type`in e}function wl(e){return e}var Tl=[];function El(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=_l(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,`name`,{value:`node (`+wl(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Tl,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Dl(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function Dl(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Tl:[e]}function Ol(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),El(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var kl={}.hasOwnProperty,Al={};function jl(e,t){let n=t||Al,r=new Map,i=new Map,a={all:s,applyData:Nl,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...tl,...n.handlers},one:o,options:n,patch:Ml,wrap:Fl};return Ol(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(kl.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=pl(n);return r.children=a.all(e),r}return pl(e)}return(a.options.unknownHandler||Pl)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=Il(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=Il(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function Ml(e,t){e.position&&(t.position=Gi(e))}function Nl(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,pl(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function Pl(e,t){let n=t.data||{},r=`value`in t&&!(kl.call(n,`hProperties`)||kl.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Fl(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
11
11
|
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
12
12
|
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
13
13
|
`}),n}function Il(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Ll(e,t){let n=jl(e,t),r=n.one(e,void 0),i=gl(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
14
|
-
`},i)),a}function Rl(e,t){return e&&`run`in e?async function(n,r){let i=Ll(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Ll(n,{file:r,...e||t})}}function zl(e){if(e)throw e}var Bl=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function Vl(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Hl(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?Ul(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function Ul(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var Wl={basename:Gl,dirname:Kl,extname:ql,join:Jl,sep:`/`};function Gl(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Zl(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Kl(e){if(Zl(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function ql(e){Zl(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Jl(...e){let t=-1,n;for(;++t<e.length;)Zl(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Yl(n)}function Yl(e){Zl(e);let t=e.codePointAt(0)===47,n=Xl(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Xl(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Zl(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Ql={cwd:$l};function $l(){return`/`}function eu(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function tu(e){if(typeof e==`string`)e=new URL(e);else if(!eu(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return nu(e)}function nu(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var ru=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],iu=class{constructor(e){let t;t=e?eu(e)?{path:e}:typeof e==`string`||cu(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Ql.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<ru.length;){let e=ru[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)ru.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?Wl.basename(this.path):void 0}set basename(e){ou(e,`basename`),au(e,`basename`),this.path=Wl.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?Wl.dirname(this.path):void 0}set dirname(e){su(this.basename,`dirname`),this.path=Wl.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?Wl.extname(this.path):void 0}set extname(e){if(au(e,`extname`),su(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=Wl.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){eu(e)&&(e=tu(e)),ou(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?Wl.basename(this.path,this.extname):void 0}set stem(e){ou(e,`stem`),au(e,`stem`),this.path=Wl.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new X(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function au(e,t){if(e&&e.includes(Wl.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+Wl.sep+"`")}function ou(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function su(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function cu(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var lu=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),uu=t(Bl(),1),du={}.hasOwnProperty,fu=new class e extends lu{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Hl()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,uu.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(hu(`data`,this.frozen),this.namespace[e]=t,this):du.call(this.namespace,e)&&this.namespace[e]||void 0:e?(hu(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=vu(e),n=this.parser||this.Parser;return pu(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),pu(`process`,this.parser||this.Parser),mu(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=vu(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);bu(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),pu(`processSync`,this.parser||this.Parser),mu(`processSync`,this.compiler||this.Compiler),this.process(e,r),_u(`processSync`,`process`,t),n;function r(e,r){t=!0,zl(e),n=r}}run(e,t,n){gu(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=vu(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),_u(`runSync`,`run`,n),r;function i(e,t){zl(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=vu(t),r=this.compiler||this.Compiler;return mu(`stringify`,r),gu(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(hu(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,uu.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];Vl(o)&&Vl(r)&&(r=(0,uu.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function pu(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function mu(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function hu(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function gu(e){if(!Vl(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function _u(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function vu(e){return yu(e)?e:new iu(e)}function yu(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function bu(e){return typeof e==`string`||xu(e)}function xu(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Su=[],Cu={allowDangerousHtml:!0},wu=/^(https?|ircs?|mailto|xmpp)$/i,Tu=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function Eu(e){let t=Du(e),n=Ou(e);return ku(t.runSync(t.parse(n),n),e)}function Du(e){let t=e.rehypePlugins||Su,n=e.remarkPlugins||Su,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Cu}:Cu;return fu().use(wc).use(n).use(Rl,r).use(t)}function Ou(e){let t=e.children||``,n=new iu;return typeof t==`string`?n.value=t:``+t,n}function ku(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Au;for(let e of Tu)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return Ol(e,l),na(e,{Fragment:N.Fragment,components:i,ignoreInvalidStyle:!0,jsx:N.jsx,jsxs:N.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in wa)if(Object.hasOwn(wa,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=wa[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function Au(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||wu.test(e.slice(0,t))?e:``}var ju={created:(0,N.jsx)(D,{className:`size-3.5`}),validated:(0,N.jsx)(y,{className:`size-3.5`}),deployed:(0,N.jsx)(x,{className:`size-3.5`}),rejected:(0,N.jsx)(ge,{className:`size-3.5`}),rolled_back:(0,N.jsx)(at,{className:`size-3.5`})},Mu={created:`outline`,validated:`secondary`,deployed:`default`,rejected:`destructive`,rolled_back:`destructive`};function Nu(e){let t=e.match(/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/);if(!t)return{meta:{},body:e};let n={};for(let e of t[1].split(`
|
|
15
|
-
`)){let t=e.indexOf(`:`);if(t>0){let r=e.slice(0,t).trim(),i=e.slice(t+1).trim();r&&i&&(n[r]=i)}}return{meta:n,body:t[2]}}function Pu({meta:e}){let t=Object.entries(e);return t.length===0?null:(0,N.jsx)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:t.map(([e,t])=>(0,N.jsxs)(`div`,{className:`contents`,children:[(0,N.jsx)(`span`,{className:`font-medium text-muted-foreground capitalize`,children:e}),(0,N.jsx)(`span`,{className:`text-foreground truncate`,children:t})]},e))})}function Fu({label:e,text:t,variant:n}){let{meta:r,body:i}=Nu(t),a=Object.keys(r).length>0;return(0,N.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(ne,{className:`size-3.5 text-muted-foreground`}),(0,N.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:e}),n===`proposed`&&(0,N.jsx)(M,{variant:`secondary`,className:`text-[10px]`,children:`New`})]}),a&&(0,N.jsx)(`div`,{className:`rounded-md border bg-muted/30 p-3`,children:(0,N.jsx)(Pu,{meta:r})}),(0,N.jsx)(`div`,{className:`skill-markdown rounded-md border bg-card p-4`,children:(0,N.jsx)(Eu,{children:i})})]})}function Iu(e,t){if(typeof t==`boolean`)return t?(0,N.jsx)(he,{className:`size-3.5 text-emerald-500 inline`}):(0,N.jsx)(ge,{className:`size-3.5 text-red-500 inline`});if(typeof t==`number`){if(e.includes(`rate`)||e.includes(`change`)||t>=-1&&t<=1&&e!==`count`){let n=(t*100).toFixed(1);return(0,N.jsxs)(`span`,{className:`font-mono`,children:[t>0&&e.includes(`change`)?`+`:``,n,`%`]})}return(0,N.jsx)(`span`,{className:`font-mono`,children:t})}return t==null?(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:`--`}):typeof t==`string`?(0,N.jsx)(`span`,{children:t}):Array.isArray(t)?t.length===0?(0,N.jsx)(`span`,{className:`text-muted-foreground italic`,children:`none`}):(0,N.jsxs)(`span`,{className:`font-mono`,children:[t.length,` entries`]}):typeof t==`object`?(0,N.jsx)(`span`,{className:`font-mono`,children:`1 entry`}):(0,N.jsx)(`span`,{children:String(t)})}function Lu(e){if(typeof e!=`object`||!e)return null;let t=e,n=t.after_pass??t.after??t.triggered??t.result,r=t.passed??t.matched;return typeof n==`boolean`?n:typeof r==`boolean`?r:null}function Ru(e,t){if(typeof t!=`object`||!t)return`${e}:${JSON.stringify(t)}`;let n=t,r=typeof n.entry==`object`&&n.entry!==null?n.entry:null,i=typeof r?.query==`string`?r.query:typeof n.query==`string`?n.query:typeof n.prompt==`string`?n.prompt:typeof n.input==`string`?n.input:null;if(i)return`${e}:${i}`;let a=typeof n.action==`string`?n.action:null,o=typeof n.timestamp==`string`?n.timestamp:null;return a&&o?`${e}:${a}:${o}`:`${e}:${JSON.stringify(n)}`}function zu({entry:e}){let t=e.entry,n=t?.query??e.query??e.prompt??e.input??e.text,r=t?.should_trigger??e.should_trigger,i=t?.invocation_type??e.invocation_type,a=e.before_pass??e.before??e.original_triggered??e.baseline,o=e.after_pass??e.after??e.triggered??e.result,s=Lu(e);return(0,N.jsxs)(`div`,{className:`flex items-start gap-2 text-xs py-1.5 border-b border-border/50 last:border-0`,children:[s===null?(0,N.jsx)(D,{className:`size-3.5 text-muted-foreground shrink-0 mt-0.5`}):s?(0,N.jsx)(he,{className:`size-3.5 text-emerald-500 shrink-0 mt-0.5`}):(0,N.jsx)(ge,{className:`size-3.5 text-red-500 shrink-0 mt-0.5`}),(0,N.jsx)(`span`,{className:`flex-1 min-w-0 line-clamp-2`,children:n?String(n):JSON.stringify(e)}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[typeof a==`boolean`&&typeof o==`boolean`&&(0,N.jsxs)(`span`,{className:`text-[10px] text-muted-foreground font-mono`,children:[a?`pass`:`fail`,` → `,o?`pass`:`fail`]}),r!==void 0&&(0,N.jsxs)(M,{variant:`secondary`,className:`text-[9px]`,children:[`expect: `,String(r)]}),i!=null&&(0,N.jsx)(M,{variant:`secondary`,className:`text-[9px]`,children:String(i)})]})]})}function Bu({validation:e}){let{improved:t,before_pass_rate:n,after_pass_rate:r,net_change:i,regressions:a,new_passes:o,per_entry_results:s,validation_mode:c,validation_agent:l,validation_fixture_id:u,validation_fallback_reason:d,...f}=e,p=Array.isArray(a)?a:[],m=Array.isArray(o)?o:[],h=Array.isArray(s)?s:[],g=typeof c==`string`?c:null,_=typeof l==`string`?l:null,v=typeof u==`string`?u:null,y=typeof d==`string`?d:null;return(0,N.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-3 space-y-3`,children:[(0,N.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[`Validation Results`,(0,N.jsx)(`span`,{className:`font-normal text-muted-foreground/60 ml-1.5`,children:`— Before/after comparison from eval tests`})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[t!==void 0&&(0,N.jsx)(M,{variant:t?`default`:`destructive`,className:`text-[10px]`,children:t?`Improved`:`Regressed`}),g&&(0,N.jsx)(M,{variant:`outline`,className:`text-[10px] capitalize`,children:g.replace(/_/g,` `)}),_&&(0,N.jsx)(M,{variant:`secondary`,className:`text-[10px]`,children:_}),v&&(0,N.jsxs)(M,{variant:`secondary`,className:`text-[10px] font-mono`,title:v,children:[`fixture #`,v.slice(0,8)]}),typeof n==`number`&&typeof r==`number`&&(0,N.jsxs)(`span`,{className:`text-xs font-mono text-muted-foreground`,children:[(n*100).toFixed(1),`% → `,(r*100).toFixed(1),`%`]}),typeof i==`number`&&(0,N.jsxs)(`span`,{className:`text-xs font-mono font-semibold ${i>0?`text-emerald-600 dark:text-emerald-400`:`text-red-500`}`,children:[i>0?`+`:``,(i*100).toFixed(1),`%`]})]}),y&&(0,N.jsxs)(`div`,{className:`rounded border border-amber-300/60 bg-amber-50 px-2.5 py-2 text-[11px] text-amber-900 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-200`,children:[`Replay fallback: `,y]}),m.length>0&&(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`p`,{className:`text-[11px] font-medium text-emerald-600 dark:text-emerald-400 mb-1`,children:[`New Passes (`,m.length,`)`]}),(0,N.jsx)(`div`,{className:`rounded border bg-card p-2`,children:m.map(e=>(0,N.jsx)(zu,{entry:typeof e==`object`&&e?e:{value:e}},Ru(`new-pass`,e)))})]}),p.length>0&&(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`p`,{className:`text-[11px] font-medium text-red-500 mb-1`,children:[`Regressions (`,p.length,`)`]}),(0,N.jsx)(`div`,{className:`rounded border border-red-200 dark:border-red-900/50 bg-card p-2`,children:p.map(e=>(0,N.jsx)(zu,{entry:typeof e==`object`&&e?e:{value:e}},Ru(`regression`,e)))})]}),h.length>0&&(0,N.jsx)(Vu,{entries:h}),Object.keys(f).length>0&&(0,N.jsx)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:Object.entries(f).map(([e,t])=>(0,N.jsxs)(`div`,{className:`contents`,children:[(0,N.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:e}),(0,N.jsx)(`span`,{className:`text-foreground`,children:Iu(e,t)})]},e))})]})}function Vu({entries:e}){let[t,n]=(0,A.useState)(!1),r=e.filter(e=>Lu(e)===!0).length,i=t?e:e.slice(0,5);return(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,N.jsxs)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:[`Individual Test Cases (`,r,`/`,e.length,` passed)`]}),e.length>5&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>n(!t),className:`text-[10px] text-primary hover:underline`,children:t?`Show less`:`Show all ${e.length}`})]}),(0,N.jsx)(`div`,{className:`h-1.5 rounded-full bg-muted overflow-hidden mb-2`,children:(0,N.jsx)(`div`,{className:`h-full rounded-full bg-emerald-500 transition-all`,style:{width:`${e.length>0?r/e.length*100:0}%`}})}),(0,N.jsx)(`div`,{className:`rounded border bg-card p-2 max-h-[300px] overflow-y-auto`,children:i.map(e=>(0,N.jsx)(zu,{entry:typeof e==`object`&&e?e:{value:e}},Ru(`per-entry`,e)))})]})}function Hu(e){if(!e.validation)return null;let t=e.validation.after_pass_rate;return typeof t==`number`?t:null}function Uu({prev:e,curr:t}){if(e===null||t===null)return null;let n=t-e;if(n===0)return null;let r=(n*100).toFixed(1),i=n>0;return(0,N.jsxs)(`span`,{className:`text-[10px] font-mono font-semibold ${i?`text-emerald-600 dark:text-emerald-400`:`text-red-500`}`,children:[i?`+`:``,r,`% vs previous`]})}function Wu({evalSet:e}){let[t,n]=(0,A.useState)(!1),r=e.filter(e=>(e.passed??e.result)===!0).length;return(0,N.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-3 space-y-2`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`flex items-center gap-1.5 w-full text-left`,children:[t?(0,N.jsx)(te,{className:`size-3.5 text-muted-foreground shrink-0`}):(0,N.jsx)(E,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,N.jsx)(g,{className:`size-3.5 text-muted-foreground`}),(0,N.jsxs)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:[`Eval Set (`,r,`/`,e.length,` passed)`]})]}),t&&(0,N.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>{let t=e.query??e.prompt??e.input,n=e.expected??e.should_trigger,r=e.passed??e.result;return(0,N.jsxs)(`div`,{className:`flex items-start gap-2 text-xs py-1 border-b border-border/50 last:border-0`,children:[typeof r==`boolean`?r?(0,N.jsx)(he,{className:`size-3.5 text-emerald-500 shrink-0 mt-0.5`}):(0,N.jsx)(ge,{className:`size-3.5 text-red-500 shrink-0 mt-0.5`}):(0,N.jsx)(D,{className:`size-3.5 text-muted-foreground shrink-0 mt-0.5`}),(0,N.jsx)(`span`,{className:`flex-1 min-w-0 line-clamp-2`,children:String(t??JSON.stringify(e))}),n!==void 0&&(0,N.jsxs)(M,{variant:`secondary`,className:`text-[9px] shrink-0`,children:[`expect: `,String(n)]})]},Ru(`eval-set`,e))})})]})}function Gu({entry:e,roundLabel:t,roundStatus:n,prevPassRate:r,currPassRate:i}){let a=n!==`single`;return(0,N.jsxs)(F,{className:n===`final`?`border-primary/50 shadow-sm`:void 0,children:[(0,N.jsx)(I,{className:`pb-3`,children:(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsxs)(L,{className:`text-sm flex items-center gap-2`,children:[(0,N.jsx)(st,{className:`size-4 text-muted-foreground`}),`Evidence: `,e.target,a&&t&&(0,N.jsx)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:t}),n===`final`&&(0,N.jsx)(M,{variant:`default`,className:`text-[10px]`,children:`Final`})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a&&(0,N.jsx)(Uu,{prev:r,curr:i}),(0,N.jsx)(M,{variant:`secondary`,className:`text-[10px]`,children:e.stage}),e.confidence!==null&&(0,N.jsxs)(M,{variant:e.confidence>=.8?`default`:e.confidence>=.5?`secondary`:`destructive`,className:`text-[10px] font-mono`,children:[Gr(e.confidence),` confidence`]}),(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:W(e.timestamp)})]})]})}),(0,N.jsxs)(z,{className:`space-y-4`,children:[e.rationale&&(0,N.jsxs)(`div`,{className:`rounded-md border-l-2 border-primary/40 bg-primary/5 px-3 py-2`,children:[(0,N.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground mb-1`,children:`Rationale`}),(0,N.jsx)(`p`,{className:`text-sm leading-relaxed`,children:e.rationale})]}),e.details&&(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:e.details}),(e.original_text||e.proposed_text)&&(0,N.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[e.original_text&&(0,N.jsx)(Fu,{label:`Original`,text:e.original_text,variant:`original`}),e.proposed_text&&(0,N.jsx)(Fu,{label:`Proposed`,text:e.proposed_text,variant:`proposed`})]}),e.eval_set&&e.eval_set.length>0&&(0,N.jsx)(Wu,{evalSet:e.eval_set}),e.validation&&Object.keys(e.validation).length>0&&(0,N.jsx)(Bu,{validation:e.validation})]})]})}function Ku({entry:e,roundLabel:t,onExpand:n}){let r=Hu(e),i=e.validation?.improved;return(0,N.jsxs)(`button`,{type:`button`,onClick:n,className:`flex items-center gap-3 w-full rounded-lg border border-dashed px-4 py-3 text-left hover:bg-accent/50 transition-colors`,children:[(0,N.jsx)(E,{className:`size-4 text-muted-foreground shrink-0`}),(0,N.jsx)(st,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,N.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.target}),(0,N.jsx)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:t}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto shrink-0`,children:[r!==null&&(0,N.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:[(r*100).toFixed(1),`% pass rate`]}),typeof i==`boolean`&&(0,N.jsx)(M,{variant:i?`default`:`destructive`,className:`text-[9px]`,children:i?`Improved`:`Regressed`}),(0,N.jsx)(M,{variant:`secondary`,className:`text-[10px]`,children:e.stage}),(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:W(e.timestamp)})]})]})}function qu({proposalId:e,evolution:t,evidence:n}){let r=(0,A.useMemo)(()=>t.filter(t=>t.proposal_id===e).sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime()),[t,e]),i=(0,A.useMemo)(()=>n.filter(t=>t.proposal_id===e).sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime()),[n,e]),[a,o]=(0,A.useState)(new Set),s=e=>{o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},c=(0,A.useMemo)(()=>{for(let e=r.length-1;e>=0;e--)if(r[e].eval_snapshot)return r[e].eval_snapshot;return null},[r]),{proposalEntries:l,validationsByTarget:u}=(0,A.useMemo)(()=>{let e=[],t=new Map;for(let n of i)if(n.stage!==`validated`)e.push(n);else{let e=n.target;t.has(e)||t.set(e,[]),t.get(e).push(n)}return{proposalEntries:e,validationsByTarget:t}},[i]);return(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg border border-primary/20 bg-primary/5 px-3.5 py-2.5`,children:[(0,N.jsx)(Re,{className:`size-4 text-primary/60 shrink-0 mt-0.5`}),(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:`This view shows the complete evidence trail for a skill evolution proposal — how the skill was changed, the eval test results before and after, and whether the change improved performance.`})]}),(0,N.jsxs)(F,{children:[(0,N.jsx)(I,{className:`pb-3`,children:(0,N.jsxs)(L,{className:`text-sm flex items-center gap-2`,children:[(0,N.jsx)(`span`,{children:`Proposal Journey`}),(0,N.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[`#`,e.slice(0,12)]})]})}),(0,N.jsxs)(z,{className:`space-y-3`,children:[(0,N.jsx)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:r.map((e,t)=>(0,N.jsxs)(`div`,{className:`contents`,children:[t>0&&(0,N.jsx)(ve,{className:`size-3 text-muted-foreground/50 shrink-0`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 bg-card`,children:[ju[e.action],(0,N.jsx)(M,{variant:Mu[e.action]??`secondary`,className:`text-[10px] capitalize`,children:e.action.replace(`_`,` `)}),(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:W(e.timestamp)})]})]},`${e.action}-${e.timestamp}`))}),c&&(0,N.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border bg-muted/20 px-3 py-2`,children:[typeof c.net_change==`number`&&(0,N.jsxs)(`div`,{className:`flex items-center gap-1`,children:[c.net_change>0?(0,N.jsx)(Te,{className:`size-3.5 text-emerald-500`}):(0,N.jsx)(lt,{className:`size-3.5 text-red-500`}),(0,N.jsxs)(`span`,{className:`text-sm font-semibold font-mono ${c.net_change>0?`text-emerald-600 dark:text-emerald-400`:`text-red-500`}`,children:[c.net_change>0?`+`:``,Math.round(c.net_change*100),`%`]})]}),typeof c.before_pass_rate==`number`&&typeof c.after_pass_rate==`number`&&(0,N.jsxs)(`span`,{className:`text-xs text-muted-foreground font-mono`,children:[Math.round(c.before_pass_rate*100),`% →`,` `,Math.round(c.after_pass_rate*100),`%`]}),c.improved!==void 0&&(0,N.jsx)(M,{variant:c.improved?`default`:`destructive`,className:`text-[10px]`,children:c.improved?`Improved`:`Regressed`})]}),r.length>0&&r[r.length-1].details&&(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:r[r.length-1].details})]})]}),l.map(e=>(0,N.jsx)(Gu,{entry:e,roundLabel:null,roundStatus:`single`,prevPassRate:null,currPassRate:null},`proposal-${e.target}-${e.timestamp}`)),Array.from(u.entries()).map(([e,t])=>{let n=t.length>1;return(0,N.jsx)(`div`,{className:`space-y-2`,children:t.map((r,i)=>{let o=i===t.length-1,c=n?`Round ${i+1} of ${t.length}`:null,l=i>0?Hu(t[i-1]):null,u=Hu(r),d=`${e}-${r.timestamp}`,f=n?o?`final`:`intermediate`:`single`;return f===`intermediate`&&!a.has(d)?(0,N.jsx)(Ku,{entry:r,roundLabel:c,onExpand:()=>s(d)},d):f===`intermediate`&&a.has(d)?(0,N.jsxs)(`div`,{className:`space-y-1`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>s(d),className:`flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors px-1`,children:[(0,N.jsx)(te,{className:`size-3`}),`Collapse `,c]}),(0,N.jsx)(Gu,{entry:r,roundLabel:c,roundStatus:f,prevPassRate:l,currPassRate:u})]},d):(0,N.jsx)(Gu,{entry:r,roundLabel:c,roundStatus:f,prevPassRate:l,currPassRate:u},d)})},e)}),i.length===0&&(0,N.jsx)(`div`,{className:`flex items-center justify-center rounded-lg border border-dashed py-8`,children:(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No evidence entries for this proposal`})})]})}var Ju={created:(0,N.jsx)(D,{className:`size-3.5`}),validated:(0,N.jsx)(y,{className:`size-3.5`}),deployed:(0,N.jsx)(x,{className:`size-3.5`}),rejected:(0,N.jsx)(ge,{className:`size-3.5`}),rolled_back:(0,N.jsx)(at,{className:`size-3.5`})},Yu={created:`bg-blue-500`,validated:`bg-amber-500`,deployed:`bg-emerald-500`,rejected:`bg-red-500`,rolled_back:`bg-red-400`},Xu={created:`ring-blue-500/30`,validated:`ring-amber-500/30`,deployed:`ring-emerald-500/30`,rejected:`ring-red-500/30`,rolled_back:`ring-red-400/30`},Zu={created:`bg-blue-500/30`,validated:`bg-amber-500/30`,deployed:`bg-emerald-500/30`,rejected:`bg-red-500/30`,rolled_back:`bg-red-400/30`};function Qu(e){let t=new Map;for(let n of e){let e=t.get(n.proposal_id)??[];e.push(n),t.set(n.proposal_id,e)}for(let e of t.values())e.sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime());return Array.from(t.entries()).sort((e,t)=>{let n=e[1][e[1].length-1],r=t[1][t[1].length-1];return new Date(r.timestamp).getTime()-new Date(n.timestamp).getTime()})}function $u(e){return e[e.length-1].action}function ed(e){for(let t=e.length-1;t>=0;t--)if(e[t].eval_snapshot)return e[t].eval_snapshot;return null}function td({snapshot:e}){let t=e.net_change;if(t==null)return null;let n=Math.round(t*100),r=n>0;return(0,N.jsxs)(`span`,{className:j(`inline-flex items-center gap-0.5 text-[10px] font-mono font-medium`,r?`text-emerald-600 dark:text-emerald-400`:`text-red-500`),children:[r?(0,N.jsx)(Te,{className:`size-2.5`}):(0,N.jsx)(lt,{className:`size-2.5`}),r?`+`:``,n,`%`]})}var nd=[{action:`created`,label:`Created`,desc:`Proposal generated from session data`},{action:`validated`,label:`Validated`,desc:`Eval tests run, awaiting deployment`},{action:`deployed`,label:`Deployed`,desc:`Accepted and applied to skill file`},{action:`rejected`,label:`Rejected`,desc:`Failed validation criteria`},{action:`rolled_back`,label:`Rolled Back`,desc:`Reverted after deployment`}];function rd(){let[e,t]=(0,A.useState)(!1);return(0,N.jsxs)(`div`,{className:`px-2 pb-2`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>t(!e),className:`flex items-center gap-1 text-[10px] text-muted-foreground/70 hover:text-muted-foreground transition-colors w-full`,children:[e?(0,N.jsx)(te,{className:`size-3`}):(0,N.jsx)(E,{className:`size-3`}),`Lifecycle stages`]}),e&&(0,N.jsx)(`div`,{className:`mt-1.5 space-y-1.5 rounded-md border bg-muted/30 p-2`,children:nd.map(e=>(0,N.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,N.jsx)(`div`,{className:j(`size-2 rounded-full mt-1 shrink-0`,Yu[e.action])}),(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsx)(`span`,{className:`text-[10px] font-medium`,children:e.label}),(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground/70 leading-tight`,children:e.desc})]})]},e.action))})]})}function id({entries:e,selectedProposalId:t,onSelect:n}){let r=Qu(e);return r.length===0?(0,N.jsx)(`div`,{className:`flex items-center justify-center rounded-lg border border-dashed py-6 px-3`,children:(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No evolution history yet`})}):(0,N.jsxs)(`div`,{className:`flex flex-col gap-0`,children:[(0,N.jsx)(`h2`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider px-2 pb-2 sticky top-0 z-10 bg-background`,children:`Evolution`}),(0,N.jsx)(rd,{}),(0,N.jsx)(`nav`,{className:`flex flex-col`,children:r.map(([e,i],a)=>{let o=$u(i),s=t===e,c=i[i.length-1],l=Yu[o]??`bg-muted-foreground`,u=Xu[o]??`ring-muted-foreground/30`,d=Zu[o]??`bg-border`,f=a===r.length-1,p=ed(i);return(0,N.jsxs)(`div`,{className:`relative flex gap-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,N.jsx)(`div`,{className:j(`flex items-center justify-center size-7 rounded-full ring-2 text-white shrink-0 z-10`,l,u),children:Ju[o]??(0,N.jsx)(D,{className:`size-3.5`})}),!f&&(0,N.jsx)(`div`,{className:j(`w-0.5 flex-1 min-h-[16px]`,d)})]}),(0,N.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:j(`flex-1 min-w-0 rounded-md px-2.5 py-2 text-left transition-all mb-1`,`hover:bg-accent/50`,s?`bg-primary/5 ring-1 ring-primary/20`:``),children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(M,{variant:o===`deployed`?`default`:o===`rejected`||o===`rolled_back`?`destructive`:`secondary`,className:`text-[10px] capitalize`,children:o.replace(`_`,` `)}),(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:W(c.timestamp)})]}),p&&(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1`,children:[(0,N.jsx)(td,{snapshot:p}),p.before_pass_rate!==void 0&&p.after_pass_rate!==void 0&&(0,N.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/60 font-mono`,children:[Math.round(p.before_pass_rate*100),`→`,Math.round(p.after_pass_rate*100),`%`]})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1`,children:[(0,N.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground/70`,children:[`#`,e.slice(0,8)]}),i.length>1&&(0,N.jsx)(`div`,{className:`flex gap-0.5 ml-auto`,children:i.map((e,t)=>(0,N.jsx)(`div`,{className:j(`size-1.5 rounded-full`,Yu[e.action]??`bg-muted-foreground`)},`${e.action}-${t}`))})]}),c.details&&(0,N.jsx)(`p`,{className:`text-[11px] text-muted-foreground/80 line-clamp-2 mt-1 leading-snug`,children:c.details})]})]},e)})})]})}function ad({text:e}){return(0,N.jsxs)(Ot,{children:[(0,N.jsx)(kt,{className:`inline-flex items-center text-muted-foreground/50 hover:text-muted-foreground transition-colors cursor-help`,onClick:e=>e.preventDefault(),children:(0,N.jsx)(Re,{className:`size-3`})}),(0,N.jsx)(At,{side:`top`,className:`max-w-[220px]`,children:e})]})}function od(e){switch(e){case`repaired_contextual_miss`:return{label:`repaired miss`,variant:`destructive`};case`repaired_trigger`:return{label:`repaired trigger`,variant:`secondary`};case`legacy_materialized`:return{label:`legacy row`,variant:`outline`};default:return null}}function sd(e){switch(e){case`previously_missed`:return{label:`previously missed`,variant:`secondary`};default:return null}}function cd({row:e}){let t=e.workspace_path?e.workspace_path.split(`/`).slice(-2).join(`/`):null,n=od(e.observation_kind),r=sd(e.historical_context);return(0,N.jsxs)(xt,{className:e.triggered?``:`bg-destructive/5`,children:[(0,N.jsx)(V,{className:`max-w-[420px] truncate py-2 text-[12px]`,title:e.query_text||void 0,children:e.query_text||(0,N.jsx)(`span`,{className:`italic text-muted-foreground/40`,children:`No prompt recorded`})}),(0,N.jsx)(V,{className:`py-2`,children:(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e.triggered?(0,N.jsx)(M,{variant:`outline`,className:`border-green-600/30 text-[10px] font-normal text-green-600`,children:`triggered`}):(0,N.jsx)(M,{variant:`destructive`,className:`text-[10px] font-normal`,children:`missed`}),n&&(0,N.jsx)(M,{variant:n.variant,className:`text-[10px] font-normal`,children:n.label}),r&&(0,N.jsx)(M,{variant:r.variant,className:`text-[10px] font-normal`,children:r.label})]})}),(0,N.jsx)(V,{className:`py-2 font-mono text-[11px] tabular-nums text-muted-foreground`,children:e.confidence==null?`Not recorded`:`${Math.round(e.confidence*100)}%`}),(0,N.jsx)(V,{className:`py-2`,children:e.invocation_mode?(0,N.jsx)(M,{variant:`secondary`,className:`text-[10px] font-normal`,children:e.invocation_mode}):(0,N.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Unknown mode`})}),(0,N.jsx)(V,{className:`py-2 text-[11px] text-muted-foreground`,children:e.prompt_kind??`Unclassified`}),(0,N.jsx)(V,{className:`py-2 text-[11px] text-muted-foreground`,children:e.source??`No data`}),(0,N.jsx)(V,{className:`py-2 text-[11px] text-muted-foreground`,children:e.platform??`No data`}),(0,N.jsx)(V,{className:`py-2 font-mono text-[11px] text-muted-foreground`,title:e.workspace_path??void 0,children:t??`No data`}),(0,N.jsx)(V,{className:`py-2`,children:(0,N.jsx)(M,{variant:e.query_origin===`inline_query`?`outline`:e.query_origin===`matched_prompt`?`secondary`:`destructive`,className:`text-[10px] font-normal`,children:e.query_origin})})]})}function ld({rows:e,emptyMessage:t}){return e.length===0?(0,N.jsx)(`div`,{className:`flex items-center justify-center py-12 text-sm text-muted-foreground`,children:t}):(0,N.jsx)(`div`,{className:`themed-scroll max-h-[340px] overflow-auto`,children:(0,N.jsxs)(vt,{children:[(0,N.jsx)(yt,{children:(0,N.jsxs)(xt,{className:`sticky top-0 z-10 bg-muted/70 backdrop-blur hover:bg-muted/70`,children:[(0,N.jsx)(B,{className:`h-8 font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Prompt`}),(0,N.jsx)(B,{className:`h-8 w-[80px] font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Status`}),(0,N.jsx)(B,{className:`h-8 w-[70px] font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Confidence`}),(0,N.jsx)(B,{className:`h-8 w-[80px] font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Mode`}),(0,N.jsx)(B,{className:`h-8 w-[80px] font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Kind`}),(0,N.jsx)(B,{className:`h-8 w-[70px] font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Source`}),(0,N.jsx)(B,{className:`h-8 w-[70px] font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Platform`}),(0,N.jsx)(B,{className:`h-8 w-[100px] font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Workspace`}),(0,N.jsx)(B,{className:`h-8 w-[100px] font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Origin`})]})}),(0,N.jsx)(bt,{children:e.map((e,t)=>(0,N.jsx)(cd,{row:e},`${e.session_id}-${t}`))})]})})}function ud({label:e,value:t,warn:n}){let r=t==null?null:Math.round(t*100);return(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,N.jsx)(`span`,{className:`w-40 shrink-0 font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:e}),(0,N.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-muted`,children:r!=null&&(0,N.jsx)(`div`,{className:`h-full rounded-full transition-all ${n?`bg-destructive`:`bg-primary`}`,style:{width:`${Math.min(r,100)}%`}})}),(0,N.jsx)(`span`,{className:`w-10 text-right font-mono text-xs tabular-nums ${n?`text-destructive`:`text-muted-foreground`}`,children:r==null?`No data`:`${r}%`})]})}function dd({title:e,data:t}){if(!t||t.length===0)return null;let n=e=>{switch(e){case`repaired_contextual_miss`:return`repaired contextual miss`;case`repaired_trigger`:return`repaired trigger`;case`legacy_materialized`:return`legacy materialized`;default:return e}},r=t.map(e=>[n(e.source??e.kind??`(unknown)`),e.count]).sort(([,e],[,t])=>t-e),i=r.reduce((e,[,t])=>e+t,0);return(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h4`,{className:`mb-2 font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:e}),(0,N.jsxs)(vt,{children:[(0,N.jsx)(yt,{children:(0,N.jsxs)(xt,{className:`hover:bg-transparent`,children:[(0,N.jsx)(B,{className:`h-7 font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Value`}),(0,N.jsx)(B,{className:`h-7 w-[80px] text-right font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Count`}),(0,N.jsx)(B,{className:`h-7 w-[80px] text-right font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Rate`})]})}),(0,N.jsx)(bt,{children:r.map(([e,t])=>(0,N.jsxs)(xt,{children:[(0,N.jsx)(V,{className:`py-2 text-[11px]`,children:e}),(0,N.jsx)(V,{className:`py-2 text-right font-mono text-[11px]`,children:t}),(0,N.jsx)(V,{className:`py-2 text-right font-mono text-[11px] text-muted-foreground`,children:i>0?`${Math.round(t/i*100)}%`:`0%`})]},e))})]})]})}function fd({nextAction:e,latestDecision:t}){let n=e.variant===`destructive`?`border-destructive/25`:e.variant===`default`?`border-primary/20`:`border-border/15`;return(0,N.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 @4xl/main:grid-cols-12`,children:[(0,N.jsx)(F,{className:`rounded-xl border bg-muted/35 shadow-none ${t?`@4xl/main:col-span-8`:`@4xl/main:col-span-12`} ${n}`,children:(0,N.jsxs)(z,{className:`flex items-start gap-3 px-4 py-4`,children:[(0,N.jsx)(`div`,{className:`shrink-0 pt-0.5`,children:e.icon}),(0,N.jsxs)(`div`,{className:`flex-1`,children:[(0,N.jsx)(`h3`,{className:`mb-1 font-headline text-[10px] uppercase tracking-[0.18em] text-muted-foreground`,children:`Next Best Action`}),(0,N.jsx)(`p`,{className:`text-[15px] font-medium leading-6 text-foreground`,children:e.text})]}),(0,N.jsx)(M,{variant:e.variant,className:`shrink-0 self-start text-[10px]`,children:e.actionLabel})]})}),t&&(0,N.jsx)(F,{className:`rounded-xl border border-border/10 bg-muted/20 @4xl/main:col-span-4`,children:(0,N.jsxs)(z,{className:`flex h-full items-start gap-3 px-4 py-4`,children:[(0,N.jsx)(ce,{className:`mt-0.5 size-4 shrink-0 text-primary/80`}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(`h3`,{className:`mb-1 font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Latest Decision`}),(0,N.jsx)(`p`,{className:`truncate text-sm font-medium leading-6`,children:t.action}),t.timestamp&&(0,N.jsx)(`p`,{className:`mt-0.5 font-mono text-[10px] text-muted-foreground`,children:W(t.timestamp)})]}),(0,N.jsxs)(M,{variant:`outline`,className:`shrink-0 self-start text-[9px]`,children:[t.evolutionCount,` evolution`,t.evolutionCount===1?``:`s`]})]})})]})}function pd({checks:e,sessions:t,promptLinkRate:n}){return`Selftune watched ${e} skill checks across ${t} sessions.${n==null?``:` It could link ${Gr(n)} of those checks back to prompts.`}`}function md({missRate:e,missedTriggers:t,systemLikeRate:n}){return(t??0)>0&&e!=null?`It found ${t} likely misses (${Gr(e)} miss rate), which means people asked for this skill and it probably should have triggered.`:(n??0)>.05?`Routing looks mostly stable, but some records appear system-generated, so selftune is being cautious about making strong claims.`:`Routing looks consistent in the current sample, with no strong signs that this skill is missing obvious requests.`}function hd({trustState:e,latestAction:t,nextActionText:n}){switch(e){case`validated`:return`Selftune found a candidate that looks promising, but it has not been deployed yet. ${n}`;case`deployed`:return`A change has already been deployed for this skill. Selftune is now watching for regressions in real use.`;case`rolled_back`:return`A previous change was rolled back, so the live skill is back on the safer version while selftune keeps observing.`;case`watch`:return`Selftune sees enough signal to keep a close eye on this skill, but not enough to blindly change it. ${n}`;case`observed`:return`Selftune is still learning how people use this skill before making stronger recommendations.`;case`low_sample`:return`There is not enough evidence yet to trust a big change here. Selftune is still collecting examples.`;default:return t?`The latest automated decision for this skill was ${t}. ${n}`:n}}function gd({title:e,icon:t,body:n}){return(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 p-4`,children:[(0,N.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,N.jsx)(`div`,{className:`text-primary/80`,children:t}),(0,N.jsx)(`h3`,{className:`font-headline text-[10px] uppercase tracking-[0.18em] text-muted-foreground`,children:e})]}),(0,N.jsx)(`p`,{className:`text-sm leading-6 text-foreground/90`,children:n})]})}function _d({trustState:e,coverage:t,evidenceQuality:n,routingQuality:r,evolutionState:i,dataHygiene:a,fallbackChecks:o,fallbackSessions:s,nextActionText:c,onOpenGuide:l}){let u=t?.checks??o,d=t?.sessions??s,f=a?.raw_checks??u,p=a?.internal_prompt_rows??0,m=a?.legacy_rows??0,h=a?.repaired_rows??0,g=Math.max(f-u,0)>0||m>0||h>0;return(0,N.jsxs)(F,{className:`rounded-xl border border-border/10 bg-card/95`,children:[(0,N.jsx)(I,{className:`gap-2 px-4 py-4`,children:(0,N.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,N.jsxs)(`div`,{className:`space-y-1`,children:[(0,N.jsx)(L,{className:`text-base`,children:`How selftune is improving this skill`}),(0,N.jsx)(R,{children:`Read this first if you want the plain-English version before diving into the evidence below.`})]}),l&&(0,N.jsx)(P,{variant:`outline`,size:`sm`,onClick:l,children:`How to read this page`})]})}),(0,N.jsxs)(z,{className:`space-y-4 px-4 pb-4 pt-0`,children:[g&&(0,N.jsxs)(`div`,{className:`rounded-xl border border-primary/10 bg-primary/5 px-4 py-3 text-sm text-muted-foreground`,children:[(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:`Trust note:`}),` This summary is based on `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:u}),` operational checks from real usage.`,p>0&&(0,N.jsxs)(N.Fragment,{children:[` `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:p}),` internal selftune eval or optimizer prompts are excluded from trust scoring.`]}),m>0&&(0,N.jsxs)(N.Fragment,{children:[` `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:m}),` legacy rows stay in history only.`]}),h>0&&(0,N.jsxs)(N.Fragment,{children:[` `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:h}),` repaired misses come from transcript replay rather than first-party trigger events.`]})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 @4xl/main:grid-cols-3`,children:[(0,N.jsx)(gd,{title:`What selftune saw`,icon:(0,N.jsx)(le,{className:`size-4`}),body:pd({checks:u,sessions:d,promptLinkRate:n?.prompt_link_rate})}),(0,N.jsx)(gd,{title:`Why it acted`,icon:(0,N.jsx)(C,{className:`size-4`}),body:md({missRate:r?.miss_rate,missedTriggers:r?.missed_triggers,systemLikeRate:n?.system_like_rate})}),(0,N.jsx)(gd,{title:`What happened next`,icon:(0,N.jsx)(ce,{className:`size-4`}),body:hd({trustState:e,latestAction:i?.latest_action,nextActionText:c})})]}),(0,N.jsx)(`div`,{className:`rounded-xl border border-border/10 bg-muted/15 px-4 py-3 text-sm text-muted-foreground`,children:`If a proposal is rejected or still pending, your live skill has not changed yet. Selftune only earns trust by testing changes before deployment.`})]})]})}function vd({coverage:e,evidenceQuality:t,routingQuality:n,evolutionState:r,fallbackChecks:i,fallbackSessions:a,fallbackEvidenceRows:o,fallbackEvolutionRows:s,fallbackLatestAction:c}){let l=(r?.evolution_rows??s)>0;return(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`mb-2 font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Trust Signals`}),(0,N.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 @xl/main:grid-cols-2 @5xl/main:grid-cols-4`,children:[(0,N.jsx)(F,{className:`rounded-xl border border-border/10 bg-muted/20 transition-colors hover:border-border/20 @container/card`,children:(0,N.jsxs)(I,{className:`gap-2 px-4 py-3`,children:[(0,N.jsxs)(R,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(le,{className:`size-3.5`}),(0,N.jsx)(`span`,{className:`font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Coverage`})]}),(0,N.jsx)(L,{className:`text-[32px] font-semibold leading-none tabular-nums text-foreground`,children:e?.checks??i}),(0,N.jsx)(_t,{children:(0,N.jsxs)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:[e?.sessions??a,` sessions /`,` `,e?.workspaces??`No data`,` dirs`]})})]})}),(0,N.jsx)(F,{className:`rounded-xl border border-border/10 bg-muted/20 transition-colors hover:border-border/20 @container/card`,children:(0,N.jsxs)(I,{className:`gap-2 px-4 py-3`,children:[(0,N.jsxs)(R,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(C,{className:`size-3.5`}),(0,N.jsx)(`span`,{className:`font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Evidence Quality`}),(0,N.jsx)(ad,{text:`How well prompts are linked to invocations. Higher prompt-link rate = more trustworthy data.`})]}),(0,N.jsx)(L,{className:`text-[32px] font-semibold leading-none tabular-nums text-foreground`,children:t?.prompt_link_rate==null?`No data`:Gr(t.prompt_link_rate)}),(0,N.jsx)(_t,{children:(0,N.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5`,children:[(0,N.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`inline:`,` `,t?.inline_query_rate==null?`No data`:Gr(t.inline_query_rate)]}),(t?.system_like_rate??0)>.05&&(0,N.jsxs)(M,{variant:`destructive`,className:`text-[9px]`,children:[Gr(t?.system_like_rate??0),` system-like`]})]})})]})}),(0,N.jsx)(F,{className:`rounded-xl border border-border/10 bg-muted/20 transition-colors hover:border-border/20 @container/card`,children:(0,N.jsxs)(I,{className:`gap-2 px-4 py-3`,children:[(0,N.jsxs)(R,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(de,{className:`size-3.5`}),(0,N.jsx)(`span`,{className:`font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Routing`}),(0,N.jsx)(ad,{text:`Routing accuracy: average confidence when triggering, and miss rate`})]}),(0,N.jsx)(L,{className:`text-[32px] font-semibold leading-none tabular-nums text-foreground`,children:n?.avg_confidence==null?`No data`:Gr(n.avg_confidence)}),(0,N.jsx)(_t,{children:(0,N.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5`,children:[(0,N.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`miss:`,` `,n?.miss_rate==null?`No data`:Gr(n.miss_rate)]}),(0,N.jsxs)(`span`,{className:`text-[10px] tabular-nums text-muted-foreground`,children:[n?.missed_triggers??`No data`,` missed`]})]})})]})}),(0,N.jsx)(F,{className:`rounded-xl border border-border/10 bg-muted/20 transition-colors hover:border-border/20 @container/card`,children:(0,N.jsxs)(I,{className:`gap-2 px-4 py-3`,children:[(0,N.jsxs)(R,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(ce,{className:`size-3.5`}),(0,N.jsx)(`span`,{className:`font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Evolution`})]}),l?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(L,{className:`text-sm font-medium leading-6`,children:r?.latest_action??c??`No data`}),(0,N.jsx)(_t,{children:(0,N.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5`,children:[(0,N.jsxs)(`span`,{className:`text-[10px] tabular-nums text-muted-foreground`,children:[r?.evidence_rows??o,` evidence`]}),(0,N.jsxs)(`span`,{className:`text-[10px] tabular-nums text-muted-foreground`,children:[r?.evolution_rows??s,` evolution`]}),r?.latest_timestamp&&(0,N.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:W(r.latest_timestamp)})]})})]}):(0,N.jsx)(L,{className:`text-sm font-normal text-muted-foreground`,children:`No evolution yet`})]})})]})]})}function yd({examples:e}){return!e||e.good.length===0&&e.missed.length===0&&e.noisy.length===0?null:(0,N.jsxs)(F,{className:`rounded-xl border border-border/10 bg-card/90`,children:[(0,N.jsx)(I,{className:`px-4 pb-2 pt-4`,children:(0,N.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(L,{className:`font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Prompt Evidence`}),(0,N.jsx)(R,{children:`Representative real usage first. Internal selftune traffic is separated so it does not masquerade as normal skill use.`})]}),(0,N.jsxs)(`div`,{className:`hidden items-center gap-2 text-[10px] text-muted-foreground @3xl/main:flex`,children:[(0,N.jsxs)(`span`,{children:[e.good.length,` successful`]}),(0,N.jsx)(`span`,{className:`text-border`,children:`|`}),(0,N.jsxs)(`span`,{children:[e.missed.length,` missed`]}),(0,N.jsx)(`span`,{className:`text-border`,children:`|`}),(0,N.jsxs)(`span`,{children:[e.noisy.length,` internal/polluted`]})]})]})}),(0,N.jsx)(z,{className:`px-4 pb-4 pt-0`,children:(0,N.jsxs)(St,{defaultValue:`good`,children:[(0,N.jsxs)(wt,{variant:`line`,className:`min-h-0 rounded-xl border border-border/10 bg-muted/20 px-1.5 py-1`,children:[(0,N.jsxs)(Tt,{value:`good`,className:`rounded-lg px-3 data-active:bg-background/70 data-active:text-foreground`,children:[`Successful Triggers`,(0,N.jsx)(M,{variant:`outline`,className:`ml-1.5 text-[10px]`,children:e.good.length})]}),(0,N.jsxs)(Tt,{value:`missed`,className:`rounded-lg px-3 data-active:bg-background/70 data-active:text-foreground`,children:[`Missed Real Usage`,(0,N.jsx)(M,{variant:e.missed.length>0?`destructive`:`outline`,className:`ml-1.5 text-[10px]`,children:e.missed.length})]}),(0,N.jsxs)(Tt,{value:`noisy`,className:`rounded-lg px-3 data-active:bg-background/70 data-active:text-foreground`,children:[`Internal / Polluted`,(0,N.jsx)(M,{variant:e.noisy.length>0?`destructive`:`outline`,className:`ml-1.5 text-[10px]`,children:e.noisy.length})]})]}),(0,N.jsx)(Et,{value:`good`,className:`mt-2`,children:(0,N.jsx)(ld,{rows:e.good,emptyMessage:`No successful trigger samples yet.`})}),(0,N.jsx)(Et,{value:`missed`,className:`mt-2`,children:(0,N.jsx)(ld,{rows:e.missed,emptyMessage:`No missed real-usage samples detected.`})}),(0,N.jsx)(Et,{value:`noisy`,className:`mt-2`,children:(0,N.jsx)(ld,{rows:e.noisy,emptyMessage:`No internal or polluted samples detected.`})})]})})]})}function bd({evidenceQuality:e,dataHygiene:t}){return(0,N.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 @5xl/main:grid-cols-2 @5xl/main:items-start`,children:[(0,N.jsxs)(F,{className:`rounded-2xl border border-border/15 bg-card`,children:[(0,N.jsx)(I,{children:(0,N.jsxs)(L,{className:`flex items-center gap-2 font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:[(0,N.jsx)(Xe,{className:`size-4`}),`Evidence Quality Rates`]})}),(0,N.jsxs)(z,{className:`space-y-3 p-4`,children:[(0,N.jsx)(ud,{label:`Prompt-linked`,value:e?.prompt_link_rate}),(0,N.jsx)(ud,{label:`Inline query`,value:e?.inline_query_rate}),(0,N.jsx)(ud,{label:`User prompt`,value:e?.user_prompt_rate}),(0,N.jsx)(ud,{label:`Meta prompt`,value:e?.meta_prompt_rate}),(0,N.jsx)(ud,{label:`No prompt`,value:e?.no_prompt_rate}),(0,N.jsx)(ud,{label:`System-like`,value:e?.system_like_rate,warn:(e?.system_like_rate??0)>.05}),(0,N.jsx)(`div`,{className:`mt-3 border-t border-border/40 pt-3`}),(0,N.jsx)(ud,{label:`Invocation mode`,value:e?.invocation_mode_coverage}),(0,N.jsx)(ud,{label:`Confidence`,value:e?.confidence_coverage}),(0,N.jsx)(ud,{label:`Source`,value:e?.source_coverage}),(0,N.jsx)(ud,{label:`Scope`,value:e?.scope_coverage})]})]}),t&&(0,N.jsxs)(F,{className:`rounded-2xl border border-border/15 bg-card`,children:[(0,N.jsx)(I,{children:(0,N.jsxs)(L,{className:`flex items-center gap-2 font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:[(0,N.jsx)(v,{className:`size-4`}),`Data Hygiene`]})}),(0,N.jsxs)(z,{className:`space-y-6 p-4`,children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/15 bg-muted/30 p-3`,children:[(0,N.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Raw vs Operational`}),(0,N.jsxs)(`div`,{className:`mt-2 flex items-end gap-2`,children:[(0,N.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-foreground`,children:t.operational_checks}),(0,N.jsxs)(`div`,{className:`pb-0.5 text-xs text-muted-foreground`,children:[`of `,t.raw_checks,` checks`]})]}),(0,N.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:`Operational checks exclude internal selftune eval and optimizer traffic.`})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/15 bg-muted/30 p-3`,children:[(0,N.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Historical Residue`}),(0,N.jsxs)(`div`,{className:`mt-2 flex items-end gap-2`,children:[(0,N.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-foreground`,children:t.legacy_rows}),(0,N.jsxs)(`div`,{className:`pb-0.5 text-xs text-muted-foreground`,children:[`legacy / `,t.repaired_rows,` repaired`]})]}),(0,N.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:`Legacy rows are older materialized history. Repaired rows are transcript-based reconstructions.`})]})]}),t.naming_variants&&t.naming_variants.length>1&&(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h4`,{className:`mb-2 font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Naming Variants`}),(0,N.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.naming_variants.map(e=>(0,N.jsx)(M,{variant:`outline`,className:`font-mono text-[10px]`,children:e},e))}),(0,N.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:`Multiple naming variants may indicate inconsistent skill registration.`})]}),(0,N.jsx)(dd,{title:`Source Breakdown`,data:t.source_breakdown}),(0,N.jsx)(dd,{title:`Prompt Kind Breakdown`,data:t.prompt_kind_breakdown}),(0,N.jsx)(dd,{title:`Observation Breakdown`,data:t.observation_breakdown})]})]})]})}function xd({sessionId:e,meta:t,invocations:n,defaultExpanded:r}){let[i,a]=(0,A.useState)(r),o=t?.started_at??n[0]?.timestamp,s=n.reduce((e,t)=>{let n=t.invocation_mode??`unknown`;return e[n]=(e[n]??0)+1,e},{}),c=e=>{let n=t?.agent_cli?.replace(/_/g,` `),r=t?.platform?.replace(/_/g,` `);return e.agent_type&&e.agent_type!==`main`?{label:e.agent_type,hint:n?`${n} subagent`:`subagent invocation`}:n?{label:n,hint:e.agent_type===`main`?`main agent invocation`:`session agent that invoked the skill`}:r?{label:r,hint:e.agent_type===`main`?`main agent invocation`:`session platform`}:e.agent_type?{label:e.agent_type,hint:`recorded subagent type`}:{label:`No data`,hint:`invoker was not captured in this record`}};return(0,N.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-slate-200 transition-colors dark:border-slate-800`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-slate-50 active:bg-slate-100 dark:hover:bg-slate-800/40 dark:active:bg-slate-800/60`,onClick:()=>a(!i),children:[(0,N.jsx)(E,{className:`size-3.5 shrink-0 text-slate-400 transition-transform duration-150 dark:text-slate-500 ${i?`rotate-90`:``}`}),(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsxs)(`span`,{className:`text-sm font-medium text-slate-900 dark:text-white`,children:[n.length,` invocation`,n.length===1?``:`s`]}),(0,N.jsx)(`span`,{className:`text-xs text-slate-500 dark:text-slate-400`,children:o?W(o):``})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[t?.model&&(0,N.jsx)(M,{variant:`secondary`,className:`text-[10px] font-normal`,children:t.model}),t?.workspace_path&&(0,N.jsx)(`span`,{className:`font-mono text-[11px] text-slate-500 dark:text-slate-400`,title:t.workspace_path,children:t.workspace_path.split(`/`).slice(-2).join(`/`)})]})]}),!i&&(0,N.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:Object.entries(s).map(([e,t])=>(0,N.jsxs)(M,{variant:`outline`,className:`gap-1 text-[10px] font-normal`,children:[e,` `,(0,N.jsx)(`span`,{className:`text-slate-400 dark:text-slate-500`,children:t})]},e))}),(0,N.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-slate-300 dark:text-slate-600`,children:e.substring(0,8)})]}),i&&(0,N.jsx)(`div`,{className:`overflow-x-auto border-t border-slate-200 dark:border-slate-800`,children:(0,N.jsxs)(vt,{children:[(0,N.jsx)(yt,{children:(0,N.jsxs)(xt,{className:`bg-slate-50 hover:bg-slate-50 dark:bg-slate-800/40 dark:hover:bg-slate-800/40`,children:[(0,N.jsxs)(B,{className:`h-8 text-[10px] font-semibold uppercase tracking-[0.15em]`,children:[`Prompt `,(0,N.jsx)(ad,{text:`The user prompt that led to this skill being invoked`})]}),(0,N.jsxs)(B,{className:`h-8 w-[90px] text-[10px] font-semibold uppercase tracking-[0.15em]`,children:[`Mode`,` `,(0,N.jsx)(ad,{text:`explicit = user typed /skillname; implicit = user mentioned skill by name; inferred = agent chose skill autonomously`})]}),(0,N.jsxs)(B,{className:`h-8 w-[70px] text-[10px] font-semibold uppercase tracking-[0.15em]`,children:[`Confidence`,` `,(0,N.jsx)(ad,{text:`Model's confidence score (0-100%) when routing this prompt to the skill`})]}),(0,N.jsxs)(B,{className:`h-8 w-[110px] text-[10px] font-semibold uppercase tracking-[0.15em]`,children:[`Invoker`,` `,(0,N.jsx)(ad,{text:`Who invoked the skill. Prefers subagent type when present, otherwise falls back to the session agent or platform.`})]}),(0,N.jsx)(B,{className:`h-8 w-[120px] text-[10px] font-semibold uppercase tracking-[0.15em]`,children:`Evidence`}),(0,N.jsx)(B,{className:`h-8 w-[70px] text-right text-[10px] font-semibold uppercase tracking-[0.15em]`,children:`Time`})]})}),(0,N.jsx)(bt,{children:n.map((e,t)=>(0,N.jsxs)(xt,{className:e.triggered?``:`bg-red-50/50 dark:bg-red-950/10`,children:[(0,N.jsxs)(V,{className:`max-w-[500px] truncate py-2 text-sm`,title:e.query||void 0,children:[e.query||(0,N.jsx)(`span`,{className:`italic text-slate-300 dark:text-slate-600`,children:`No prompt recorded`}),!e.triggered&&(0,N.jsx)(M,{variant:`destructive`,className:`ml-2 text-[10px] font-normal`,children:`missed`})]}),(0,N.jsx)(V,{className:`py-2`,children:e.invocation_mode?(0,N.jsx)(M,{variant:`secondary`,className:`text-[10px] font-normal`,children:e.invocation_mode}):(0,N.jsx)(`span`,{className:`text-[11px] text-slate-400 dark:text-slate-500`,children:`Unknown mode`})}),(0,N.jsx)(V,{className:`py-2 font-mono text-xs tabular-nums text-slate-600 dark:text-slate-300`,children:e.confidence===null?`Not recorded`:`${Math.round(e.confidence*100)}%`}),(0,N.jsx)(V,{className:`py-2`,children:(()=>{let t=c(e);return t.label===`No data`?(0,N.jsx)(`span`,{className:`text-[11px] text-slate-400 dark:text-slate-500`,title:t.hint,children:t.label}):(0,N.jsx)(M,{variant:e.agent_type&&e.agent_type!==`main`?`outline`:`secondary`,className:`text-[10px] font-normal capitalize`,title:t.hint,children:t.label})})()}),(0,N.jsx)(V,{className:`py-2`,children:(()=>{let t=od(e.observation_kind),n=sd(e.historical_context);return t?(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,N.jsx)(M,{variant:t.variant,className:`text-[10px] font-normal`,children:t.label}),n&&(0,N.jsx)(M,{variant:n.variant,className:`text-[10px] font-normal`,children:n.label})]}):(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`text-[11px] text-slate-400 dark:text-slate-500`,children:`canonical`}),n&&(0,N.jsx)(M,{variant:n.variant,className:`text-[10px] font-normal`,children:n.label})]})})()}),(0,N.jsx)(V,{className:`whitespace-nowrap py-2 text-right font-mono text-[11px] text-slate-400 dark:text-slate-500`,children:e.timestamp?W(e.timestamp):``})]},t))})]})})]})}function Sd({invocations:e,sessionMetadata:t=[]}){let[n,r]=(0,A.useState)(`all`),i=(0,A.useMemo)(()=>new Map(t.map(e=>[e.session_id,e])),[t]),a=(0,A.useMemo)(()=>{switch(n){case`misses`:return e.filter(e=>!e.triggered);case`low_confidence`:return e.filter(e=>e.confidence!==null&&e.confidence<.5);default:return e}},[e,n]),o=(0,A.useMemo)(()=>{let e=new Map;for(let t of a){let n=t.session_id??`unknown`,r=e.get(n);r?r.push(t):e.set(n,[t])}return[...e.entries()].sort(([,e],[,t])=>(t[0]?.timestamp??``).localeCompare(e[0]?.timestamp??``))},[a]);return e.length===0?(0,N.jsx)(`div`,{className:`flex items-center justify-center rounded-lg border border-dashed border-slate-300 py-12 dark:border-slate-700`,children:(0,N.jsx)(`p`,{className:`text-sm text-slate-500 dark:text-slate-400`,children:`No invocation records yet. Invocations appear when skills are triggered during real sessions.`})}):(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(T,{className:`size-3.5 text-slate-400 dark:text-slate-500`}),[[`all`,`All`],[`misses`,`Misses`],[`low_confidence`,`Low confidence`]].map(([e,t])=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`inline-block`,children:(0,N.jsx)(M,{variant:n===e?`default`:`outline`,className:`cursor-pointer text-[10px]`,children:t})},e))]}),(0,N.jsxs)(`span`,{className:`text-xs text-slate-500 dark:text-slate-400`,children:[a.length,` invocations across `,o.length,` sessions`]})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-[11px] text-slate-500 dark:text-slate-400`,children:[(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`size-1.5 rounded-full bg-slate-400`}),`explicit = user typed /skill`]}),(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`size-1.5 rounded-full bg-slate-400`}),`implicit = mentioned by name`]}),(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`size-1.5 rounded-full bg-slate-400`}),`inferred = agent chose autonomously`]}),(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`size-1.5 rounded-full bg-red-400`}),`missed = skill should have triggered`]})]}),o.length===0?(0,N.jsx)(`div`,{className:`flex items-center justify-center py-8 text-sm text-slate-500 dark:text-slate-400`,children:`No invocations match this filter.`}):o.map(([e,t],n)=>(0,N.jsx)(xd,{sessionId:e,meta:i.get(e),invocations:t,defaultExpanded:n<3},e))]})}var Cd={healthy:{color:`bg-emerald-400`,glow:`shadow-[0_0_12px_rgba(52,211,153,0.6)]`},watching:{color:`bg-cyan-400`,glow:`shadow-[0_0_12px_rgba(79,242,255,0.6)]`},needs_review:{color:`bg-amber-400`,glow:`shadow-[0_0_12px_rgba(251,191,36,0.6)]`},blocked:{color:`bg-red-400`,glow:`shadow-[0_0_12px_rgba(248,113,113,0.6)]`}},wd={healthy:`Healthy`,watching:`Watching`,needs_review:`Needs Review`,blocked:`Blocked`},Td={critical:{dot:`bg-red-400`,text:`text-red-400`,bg:`bg-red-500/10`},warning:{dot:`bg-amber-400`,text:`text-amber-400`,bg:`bg-amber-500/10`},info:{dot:`bg-cyan-400`,text:`text-primary`,bg:`bg-cyan-400/10`}},Ed={proposal_created:`bg-cyan-400`,proposal_rejected:`bg-red-400`,validation_failed:`bg-amber-400`,proposal_deployed:`bg-emerald-400`,rollback_triggered:`bg-red-400`,regression_found:`bg-amber-400`},Dd={at_risk:{label:`At Risk`,accent:`text-red-400`,dot:`bg-red-400`},improving:{label:`Improving`,accent:`text-primary`,dot:`bg-cyan-400`},uncertain:{label:`Uncertain`,accent:`text-amber-400`,dot:`bg-amber-400`},stable:{label:`Stable`,accent:`text-muted-foreground`,dot:`bg-muted-foreground/60`}},Od=[{id:`autonomy-bar-1`,height:35},{id:`autonomy-bar-2`,height:55},{id:`autonomy-bar-3`,height:40},{id:`autonomy-bar-4`,height:70},{id:`autonomy-bar-5`,height:45},{id:`autonomy-bar-6`,height:80},{id:`autonomy-bar-7`,height:30},{id:`autonomy-bar-8`,height:65},{id:`autonomy-bar-9`,height:50},{id:`autonomy-bar-10`,height:75},{id:`autonomy-bar-11`,height:38},{id:`autonomy-bar-12`,height:60},{id:`autonomy-bar-13`,height:42},{id:`autonomy-bar-14`,height:72}];function kd({status:e,lastRun:t,actions:n}){let r=Cd[e.level],i=e.attention_required>0?{value:e.attention_required,label:`Attention Required`}:{value:e.skills_observed,label:`Skills Observed`};return(0,N.jsxs)(F,{className:`relative min-h-[332px] border-none bg-gradient-to-br from-muted via-muted to-primary/5 shadow-none py-0 ring-0`,children:[(0,N.jsx)(`div`,{className:`absolute inset-0 flex items-end justify-around px-8 pb-24 pt-20 opacity-[0.08] pointer-events-none`,children:Od.map(e=>(0,N.jsx)(`div`,{className:`flex-1 rounded-t-sm min-w-[12px]`,style:{height:`${e.height}%`,backgroundColor:`rgba(79, 242, 255, ${.15+e.height/100*.3})`}},e.id))}),(0,N.jsxs)(I,{className:`relative z-10 px-8 pt-8 pb-0`,children:[(0,N.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,N.jsx)(`span`,{className:`mt-2 size-3.5 shrink-0 rounded-full animate-pulse ${r.color} ${r.glow}`}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Autonomy Status`}),(0,N.jsx)(L,{className:`text-2xl font-extrabold tracking-tight text-foreground`,children:wd[e.level]}),(0,N.jsx)(R,{className:`mt-1.5 max-w-xl text-[13px] leading-relaxed text-muted-foreground`,children:e.summary})]})]}),(0,N.jsx)(_t,{children:(0,N.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,N.jsx)(`p`,{className:`text-5xl font-extrabold text-primary leading-none`,style:{filter:`drop-shadow(0 0 8px rgba(79,242,255,0.3))`},children:i.value}),(0,N.jsx)(`p`,{className:`text-[10px] uppercase tracking-[0.2em] text-muted-foreground mt-1.5`,children:i.label})]})})]}),(0,N.jsx)(`div`,{className:`flex-1 min-h-6`}),(0,N.jsxs)(z,{className:`relative z-10 flex flex-col gap-5 px-8 pb-8 pt-0`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5 text-xs`,children:[(0,N.jsxs)(`div`,{className:`rounded-full border border-border/40 bg-background/60 px-3 py-1.5 backdrop-blur-sm shadow-[inset_0_1px_0_rgba(255,255,255,0.02)]`,children:[(0,N.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.18em] text-muted-foreground/70`,children:`Last Run`}),(0,N.jsx)(`span`,{className:`ml-2 font-medium text-foreground`,children:t?W(t):`Never`})]}),(0,N.jsxs)(`div`,{className:`rounded-full border border-border/40 bg-background/60 px-3 py-1.5 backdrop-blur-sm shadow-[inset_0_1px_0_rgba(255,255,255,0.02)]`,children:[(0,N.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.18em] text-muted-foreground/70`,children:`Skills`}),(0,N.jsx)(`span`,{className:`ml-2 font-medium text-foreground`,children:e.skills_observed})]}),(0,N.jsxs)(`div`,{className:`rounded-full border border-primary/20 bg-primary/10 px-3 py-1.5 backdrop-blur-sm`,children:[(0,N.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.18em] text-primary/80`,children:`Pending`}),(0,N.jsx)(`span`,{className:`ml-2 font-semibold text-primary`,children:e.pending_reviews})]})]}),n??(e.attention_required>0?(0,N.jsx)(`a`,{href:`#supervision-feed`,className:`inline-flex w-fit items-center justify-center rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/80`,children:`Review Attention Queue`}):(0,N.jsx)(`span`,{className:`text-sm text-muted-foreground/70`,children:`No action needed`}))]})]})}function Ad({entries:e,renderSkillLink:t,footer:n}){let r=(0,A.useMemo)(()=>{let t=[`at_risk`,`improving`,`uncertain`,`stable`],n={at_risk:[],improving:[],uncertain:[],stable:[]};for(let t of e)n[t.bucket].push(t);return t.filter(e=>n[e].length>0).map(e=>({bucket:e,items:n[e]}))},[e]);return(0,N.jsxs)(F,{"data-parity-root":`overview-trust-watchlist`,className:`border-none bg-muted shadow-none py-0 max-h-[360px] ring-0`,children:[(0,N.jsxs)(I,{className:`px-5 pt-5 pb-0`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Trust Watchlist`}),(0,N.jsx)(R,{className:`mt-1 text-[11px] text-muted-foreground/70`,children:`Highest-risk skills worth checking next.`})]}),(0,N.jsx)(_t,{children:(0,N.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/70 shrink-0`,children:[e.length,` skills`]})})]}),r.length===0?(0,N.jsx)(z,{className:`flex flex-1 items-center justify-center px-5 py-4`,children:(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:`No skills tracked yet.`})}):(0,N.jsx)(z,{className:`space-y-3 overflow-y-auto min-h-0 flex-1 px-5 py-4`,children:r.map(({bucket:e,items:n})=>(0,N.jsx)(jd,{bucket:e,items:n,renderSkillLink:t},e))}),n?(0,N.jsx)(z,{className:`mt-auto px-5 pb-5 pt-1 shrink-0`,children:n}):null]})}function jd({bucket:e,items:t,renderSkillLink:n}){let r=Dd[e],[i,a]=(0,A.useState)(!1),[o,s]=(0,A.useState)(!1),c=i?o?t:t.slice(0,5):[];return(0,N.jsxs)(`div`,{className:`rounded-xl bg-background/40 px-3 py-2.5`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>a(!i),className:`flex w-full items-center gap-1.5 text-left`,children:[(0,N.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full ${r.dot}`}),(0,N.jsx)(te,{className:`size-3 text-muted-foreground transition-transform ${i?``:`-rotate-90`}`}),(0,N.jsx)(`span`,{className:`text-xs font-medium ${r.accent}`,children:r.label}),(0,N.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/70`,children:[`(`,t.length,`)`]})]}),i&&(0,N.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[c.map(e=>(0,N.jsxs)(`div`,{className:`rounded-lg px-2 py-1.5 transition-colors hover:bg-background/55`,children:[(0,N.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[n?n(e.skill_name):(0,N.jsx)(`span`,{className:`text-[11px] font-medium text-foreground truncate`,children:e.skill_name}),e.pass_rate!=null&&(0,N.jsxs)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:[Math.round(e.pass_rate*100),`%`]})]}),(0,N.jsx)(`p`,{className:`mt-0.5 line-clamp-1 text-[10px] text-muted-foreground/70`,children:e.reason})]},e.skill_name)),t.length>5&&!o&&(0,N.jsxs)(`button`,{type:`button`,onClick:()=>s(!0),className:`pl-2 text-[10px] text-primary hover:underline`,children:[`+`,t.length-5,` more`]})]})]})}function Md({attention:e,decisions:t,renderSkillLink:n}){return(0,N.jsxs)(F,{id:`supervision-feed`,"data-parity-root":`overview-supervision-feed`,className:`relative overflow-hidden border-none bg-muted shadow-none py-0 scroll-mt-6 ring-0`,children:[(0,N.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 h-20 bg-gradient-to-b from-primary/5 via-transparent to-transparent`}),(0,N.jsxs)(St,{defaultValue:`attention`,className:`gap-0`,children:[(0,N.jsxs)(I,{className:`relative px-5 pt-4 pb-0`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Supervision Feed`}),(0,N.jsx)(R,{className:`mt-1 text-[13px] text-muted-foreground/70`,children:`What needs review and what selftune just decided.`})]}),(0,N.jsxs)(wt,{variant:`line`,className:`mt-3`,children:[(0,N.jsxs)(Tt,{value:`attention`,className:`text-xs uppercase tracking-[0.15em]`,children:[`Attention Required`,e.length>0&&(0,N.jsx)(M,{variant:`secondary`,className:`ml-1.5 text-[10px] py-0 px-1.5`,children:e.length})]}),(0,N.jsxs)(Tt,{value:`decisions`,className:`text-xs uppercase tracking-[0.15em]`,children:[`Recent Decisions`,t.length>0&&(0,N.jsx)(`span`,{className:`ml-1.5 text-[10px] text-muted-foreground`,children:t.length})]})]})]}),(0,N.jsxs)(z,{className:`max-h-[440px] overflow-y-auto px-5 py-5`,children:[(0,N.jsx)(Et,{value:`attention`,children:(0,N.jsx)(Nd,{attention:e,renderSkillLink:n})}),(0,N.jsx)(Et,{value:`decisions`,children:(0,N.jsx)(Pd,{decisions:t,renderSkillLink:n})})]})]})]})}function Nd({attention:e,renderSkillLink:t}){let[n,r]=(0,A.useState)(!1);return e.length===0?(0,N.jsxs)(`div`,{className:`flex items-center gap-3 py-4`,children:[(0,N.jsx)(he,{className:`size-5 text-emerald-400`}),(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing needs your attention`})]}):(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(n?e:e.slice(0,6)).map(e=>{let n=Td[e.severity];return(0,N.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-background/40 px-3 py-3 transition-colors hover:bg-background/55`,children:[(0,N.jsx)(`span`,{className:`mt-1.5 size-2 shrink-0 rounded-full ${n.dot}`}),(0,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[t?t(e.skill_name):(0,N.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e.skill_name}),(0,N.jsx)(M,{variant:`outline`,className:`text-[10px] font-normal ${n.text} ${n.bg} border-transparent`,children:e.category.replace(/_/g,` `)})]}),(0,N.jsx)(`p`,{className:`mt-0.5 line-clamp-1 text-sm text-muted-foreground`,children:e.reason}),(0,N.jsx)(`p`,{className:`mt-0.5 line-clamp-1 text-xs text-muted-foreground/70`,children:e.recommended_action})]}),(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground/70 shrink-0 mt-0.5`,children:e.timestamp?W(e.timestamp):``})]},`${e.skill_name}-${e.category}`)}),e.length>6&&!n&&(0,N.jsx)(`div`,{className:`pt-3`,children:(0,N.jsxs)(`button`,{type:`button`,onClick:()=>r(!0),className:`text-xs text-primary hover:underline`,children:[`Show all `,e.length,` attention items`]})})]})}function Pd({decisions:e,renderSkillLink:t}){let[n,r]=(0,A.useState)(!1),i=n?e:e.slice(0,10),a=(0,A.useMemo)(()=>{let e=new Map;return i.map(t=>{let n=`${t.timestamp}-${t.skill_name}-${t.kind}`,r=e.get(n)??0;return e.set(n,r+1),{decision:t,key:`${n}-${r}`}})},[i]);return e.length===0?(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground/70 py-4`,children:`No autonomous decisions yet.`}):(0,N.jsxs)(`div`,{className:`space-y-1`,children:[a.map(({decision:e,key:n})=>{let r=Ed[e.kind];return(0,N.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-xl bg-background/30 px-3 py-2 transition-colors hover:bg-background/45`,children:[(0,N.jsx)(`span`,{className:`mt-1.5 size-2 shrink-0 rounded-full ${r}`}),(0,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[t?t(e.skill_name):(0,N.jsx)(`span`,{className:`text-xs font-medium text-foreground truncate block`,children:e.skill_name}),(0,N.jsx)(`p`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:e.summary})]}),(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground/70 shrink-0 mt-0.5`,children:W(e.timestamp)})]},n)}),e.length>10&&!n&&(0,N.jsxs)(`button`,{type:`button`,onClick:()=>r(!0),className:`text-xs text-primary hover:underline mt-1 pl-2`,children:[`Show all (`,e.length,`)`]})]})}A.createContext(null);var Fd=`selftune.skill-report-onboarding-dismissed`;function Id({open:e,onOpenChange:t}){let n=(0,A.useRef)(null);return(0,A.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t(!1)};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]),e?(0,N.jsxs)(`div`,{className:`fixed inset-0 z-50 flex justify-end`,children:[(0,N.jsx)(`div`,{className:`absolute inset-0 bg-black/40 backdrop-blur-[2px] transition-opacity`,onClick:()=>t(!1)}),(0,N.jsxs)(`div`,{ref:n,className:`relative z-10 w-full max-w-lg overflow-y-auto bg-white shadow-xl dark:bg-slate-900 animate-in slide-in-from-right duration-200`,children:[(0,N.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center justify-between border-b border-slate-200 bg-white px-6 py-4 dark:border-slate-800 dark:bg-slate-900`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-lg font-semibold text-slate-900 dark:text-white`,children:`How to read this page`}),(0,N.jsx)(`p`,{className:`mt-0.5 text-sm text-slate-500 dark:text-slate-400`,children:`selftune earns trust by showing what it observed, what it proposed, how it tested the change, and what happened next.`})]}),(0,N.jsx)(P,{variant:`ghost`,className:`shrink-0 rounded-full p-1.5`,onClick:()=>t(!1),children:(0,N.jsx)(Ne,{className:`size-4`})})]}),(0,N.jsxs)(`div`,{className:`space-y-8 px-6 py-6`,children:[(0,N.jsxs)(`section`,{className:`space-y-3`,children:[(0,N.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-[0.18em] text-slate-400 dark:text-slate-500`,children:`The improvement loop`}),(0,N.jsxs)(`div`,{className:`space-y-3 text-sm text-slate-600 dark:text-slate-400`,children:[(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`1. Observe.`}),` selftune watches real sessions and notes when a skill triggered, missed, or looked noisy.`]}),(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`2. Propose.`}),` When the signal is strong enough, it suggests a wording change to the skill.`]}),(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`3. Validate.`}),` It checks whether the new wording improves routing without breaking important cases.`]}),(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`4. Decide.`}),` Only validated winners should be deployed. Rejected or pending proposals do not change the live skill.`]})]})]}),(0,N.jsxs)(`section`,{className:`space-y-3`,children:[(0,N.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-[0.18em] text-slate-400 dark:text-slate-500`,children:`What each section means`}),(0,N.jsxs)(`div`,{className:`space-y-3 text-sm text-slate-600 dark:text-slate-400`,children:[(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`Next Best Action`}),` tells you whether you should review, deploy, or simply keep observing.`]}),(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`How selftune is improving this skill`}),` `,`explains the current state in plain language.`]}),(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`Trust Signals`}),` are the condensed metrics behind that story: coverage, evidence quality, routing quality, and evolution state.`]}),(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`Evidence`}),` shows what changed and why a proposal was accepted, rejected, or left pending.`]}),(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`Invocations`}),` shows real prompts where this skill triggered or likely should have triggered.`]}),(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`Community`}),` surfaces aggregated contributor signals and usage patterns from the broader selftune community.`]})]})]}),(0,N.jsxs)(`section`,{className:`space-y-3`,children:[(0,N.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-[0.18em] text-slate-400 dark:text-slate-500`,children:`FAQ`}),(0,N.jsxs)(`div`,{className:`space-y-4 text-sm text-slate-600 dark:text-slate-400`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`font-medium text-slate-900 dark:text-white`,children:`What is a missed trigger?`}),(0,N.jsx)(`p`,{children:`A case where selftune believes the skill should have been used, but the agent did not invoke it.`})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`font-medium text-slate-900 dark:text-white`,children:`Why was a proposal rejected?`}),(0,N.jsx)(`p`,{children:`Usually because validation showed the new wording would regress existing behavior, or because it violated a hard rule like dropping an important anchor phrase.`})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`font-medium text-slate-900 dark:text-white`,children:`When should I trust a recommendation?`}),(0,N.jsx)(`p`,{children:`Trust it more when the page shows broad coverage, prompt-linked evidence, and a validated result. Trust it less when the sample is tiny or the data is noisy.`})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`font-medium text-slate-900 dark:text-white`,children:`Do I need to understand every metric?`}),(0,N.jsx)(`p`,{children:`No. Start with the plain-English summary and next best action. Use the deeper tabs only when you want to inspect the evidence yourself.`})]})]})]})]})]})]}):null}function Ld({onOpenGuide:e}){let[t,n]=(0,A.useState)(()=>typeof window<`u`?window.localStorage.getItem(Fd)===`1`:!1);return t?null:(0,N.jsx)(`div`,{className:`rounded-lg border border-blue-200/40 bg-blue-50/50 px-4 py-3 dark:border-blue-900/40 dark:bg-blue-950/20`,children:(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,N.jsxs)(`div`,{className:`text-sm text-slate-600 dark:text-slate-400`,children:[(0,N.jsx)(`span`,{className:`font-medium text-slate-900 dark:text-white`,children:`New to selftune?`}),` Start with the summary below, then open the guide if you want the full improvement loop explained step by step.`]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(P,{variant:`outline`,onClick:e,children:`Open guide`}),(0,N.jsx)(P,{variant:`ghost`,onClick:()=>{typeof window<`u`&&window.localStorage.setItem(Fd,`1`),n(!0)},children:`Hide`})]})]})})}var Rd=[{key:`ALL`,label:`All Skills`},{key:`HEALTHY`,label:`Healthy`},{key:`WARNING`,label:`Warning`},{key:`CRITICAL`,label:`Critical`},{key:`UNGRADED`,label:`Ungraded`}],zd={HEALTHY:{text:`text-primary`,bg:`bg-primary`,label:`Deployed`},WARNING:{text:`text-primary-accent`,bg:`bg-primary-accent`,label:`Needs Attention`},CRITICAL:{text:`text-destructive`,bg:`bg-destructive`,label:`Critical`},UNGRADED:{text:`text-muted-foreground`,bg:`bg-muted-foreground`,label:`Ungraded`},UNKNOWN:{text:`text-muted-foreground`,bg:`bg-muted-foreground`,label:`Unknown`}};function Bd(e){return e===null?0:Math.round(e*100)}function Vd(){return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col gap-8 p-6 md:p-10 animate-in fade-in duration-500`,children:[(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(`div`,{className:`h-12 w-64 rounded-lg bg-muted animate-pulse`}),(0,N.jsx)(`div`,{className:`h-5 w-96 rounded-lg bg-muted animate-pulse`})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-12 gap-6`,children:[(0,N.jsx)(`div`,{className:`col-span-12 lg:col-span-8 h-72 rounded-xl bg-muted animate-pulse`}),(0,N.jsxs)(`div`,{className:`col-span-12 lg:col-span-4 flex flex-col gap-6`,children:[(0,N.jsx)(`div`,{className:`h-32 rounded-xl bg-muted animate-pulse`}),(0,N.jsx)(`div`,{className:`h-32 rounded-xl bg-muted animate-pulse`})]})]}),(0,N.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6`,children:Array.from({length:6}).map((e,t)=>(0,N.jsx)(`div`,{className:`h-52 rounded-xl bg-muted animate-pulse`},`skel-${t}`))})]})}function Hd({skillName:e,skillScope:t,platforms:n,passRate:r,totalChecks:i,uniqueSessions:a,status:o,latestEvolutionTimestamp:s,renderActions:c}){let l=Bd(i>0?r:null),u=zd[o];return(0,N.jsxs)(F,{className:`col-span-12 lg:col-span-8 rounded-3xl border border-border/15 p-8 relative overflow-hidden flex flex-col`,children:[(0,N.jsx)(`div`,{className:`absolute top-0 left-0 w-full h-1 bg-input`,children:(0,N.jsx)(`div`,{className:`h-full bg-primary shadow-[0_0_15px_rgba(79,242,255,0.6)] transition-all duration-700`,style:{width:`${l}%`}})}),(0,N.jsxs)(`div`,{className:`flex justify-between items-start mb-6`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,N.jsx)(`span`,{className:`px-2 py-0.5 rounded text-[10px] font-bold bg-primary/10 text-primary uppercase tracking-widest`,children:o===`HEALTHY`?`Deployed`:`Evolving`}),n&&n.length>0?(0,N.jsx)(`span`,{className:`flex items-center gap-1`,children:n.map(e=>(0,N.jsx)(`span`,{className:`px-1.5 py-0.5 rounded bg-muted text-muted-foreground font-mono text-[10px]`,children:e},e))}):(0,N.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:[t??`global`,` scope`]})]}),(0,N.jsx)(`h2`,{className:`font-headline text-3xl font-bold text-foreground`,children:e})]}),(0,N.jsxs)(`div`,{className:`text-right`,children:[(0,N.jsx)(`span`,{className:`text-4xl font-headline font-light text-primary`,children:Gr(i>0?r:null)}),(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest mt-1`,children:s?`Evolved ${W(s)}`:`Pass Rate`})]})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-3 gap-8 mb-8`,children:[(0,N.jsxs)(`div`,{className:`bg-muted p-4 rounded-2xl border border-border/15`,children:[(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest mb-1`,children:`Total Checks`}),(0,N.jsx)(`p`,{className:`text-xl font-bold font-headline tabular-nums`,children:i.toLocaleString()})]}),(0,N.jsxs)(`div`,{className:`bg-muted p-4 rounded-2xl border border-border/15`,children:[(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest mb-1`,children:`Pass Rate`}),(0,N.jsx)(`p`,{className:`text-xl font-bold font-headline tabular-nums ${u.text}`,children:Gr(i>0?r:null)})]}),(0,N.jsxs)(`div`,{className:`bg-muted p-4 rounded-2xl border border-border/15`,children:[(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest mb-1`,children:`Unique Sessions`}),(0,N.jsx)(`p`,{className:`text-xl font-bold font-headline tabular-nums`,children:a.toLocaleString()})]})]}),(0,N.jsx)(`div`,{className:`flex justify-end gap-4`,children:c?.(e)})]})}function Ud({aggregatePassRate:e,gradedCount:t}){return(0,N.jsxs)(F,{className:`rounded-3xl border border-border/15 p-6 flex flex-col justify-center`,children:[(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest mb-4`,children:`Library Health`}),(0,N.jsx)(`div`,{className:`flex items-end gap-2 mb-2`,children:(0,N.jsx)(`span`,{className:`text-5xl font-headline font-bold tabular-nums`,children:e===null?`--`:`${Math.round(e*100)}%`})}),(0,N.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Aggregate pass rate across `,t,` graded skill`,t===1?``:`s`,`.`]})]})}function Wd({proposals:e}){return e.length===0?(0,N.jsxs)(F,{className:`rounded-3xl p-6 flex flex-col gap-3 border border-border/15 border-l-4 border-l-primary/40`,children:[(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest mb-2`,children:`Pending Proposals`}),(0,N.jsx)(`h3`,{className:`font-headline font-bold text-lg`,children:`No proposals pending`})]}):(0,N.jsxs)(F,{className:`rounded-3xl p-6 flex flex-col gap-3 border border-border/15 border-l-4 border-l-primary/40`,children:[(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest mb-2`,children:`Pending Proposals`}),(0,N.jsxs)(`h3`,{className:`font-headline font-bold text-lg mb-4`,children:[`Awaiting Review`,(0,N.jsx)(M,{variant:`secondary`,className:`ml-2 h-5 px-2 text-[10px] bg-primary/15 text-primary border-none align-middle`,children:e.length})]}),(0,N.jsx)(`div`,{className:`space-y-3 max-h-32 overflow-y-auto themed-scroll`,children:e.map(e=>(0,N.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-muted rounded-xl`,children:[(0,N.jsx)(`span`,{className:`text-sm truncate`,children:e.skillName??`Unknown`}),(0,N.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:e.action})]},e.id))})]})}function Gd({skill:e,renderActions:t}){let n=Bd(e.passRate),r=zd[e.status];return(0,N.jsxs)(F,{className:`border border-border/15 p-6 hover:border-border/30 transition-all duration-300 flex flex-col`,children:[(0,N.jsxs)(`div`,{className:`flex justify-between items-start mb-4`,children:[(0,N.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-muted flex items-center justify-center`,children:(0,N.jsx)(`span`,{className:`size-3 rounded-full ${r.bg}`})}),(0,N.jsxs)(`div`,{className:`text-right`,children:[(0,N.jsx)(`div`,{className:`flex flex-wrap justify-end gap-1`,children:e.platforms&&e.platforms.length>0?e.platforms.map(e=>(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest`,children:e},e)):(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest`,children:e.scope??`unknown`})}),(0,N.jsx)(`p`,{className:`text-sm font-bold tabular-nums`,children:e.checks.toLocaleString()})]})]}),(0,N.jsx)(`h3`,{className:`font-headline font-bold text-xl tracking-tight text-foreground truncate mb-1`,children:e.name}),(0,N.jsxs)(`p`,{className:`text-sm text-muted-foreground mb-6`,children:[e.uniqueSessions,` sessions · Last seen`,` `,e.lastSeen?W(e.lastSeen):`never`]}),(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex justify-between items-end text-xs uppercase tracking-tighter`,children:[(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:`Pass Rate`}),(0,N.jsx)(`span`,{className:`font-bold ${r.text}`,children:r.label})]}),(0,N.jsx)(`div`,{className:`w-full h-1 bg-input rounded-full overflow-hidden`,children:(0,N.jsx)(`div`,{className:`h-full rounded-full transition-all duration-500 ${r.bg}`,style:{width:`${n}%`}})}),(0,N.jsx)(`div`,{className:`pt-4 flex gap-3`,children:t?.(e.name)})]})]})}function Kd({filter:e,onFilterChange:t,counts:n,sortDesc:r,onSortToggle:i}){return(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-4 flex-wrap`,children:[(0,N.jsx)(`div`,{className:`flex gap-1 bg-muted rounded-xl p-1`,children:Rd.map(r=>(0,N.jsxs)(`button`,{type:`button`,onClick:()=>t(r.key),className:`px-4 py-2 rounded-lg text-sm font-headline font-semibold transition-all duration-200 ${e===r.key?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`}`,children:[r.label,(0,N.jsx)(`span`,{className:`ml-1.5 text-xs opacity-60`,children:n[r.key]})]},r.key))}),(0,N.jsxs)(`button`,{type:`button`,onClick:i,className:`flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground hover:text-foreground transition-colors font-headline`,title:r?`Highest pass rate first`:`Lowest pass rate first`,children:[(0,N.jsx)(ye,{className:`size-4`}),(0,N.jsx)(`span`,{children:`Sort by Performance`})]})]})}function qd(){return(0,N.jsx)(F,{className:`col-span-12 lg:col-span-8 border border-border/15 p-8 flex items-center justify-center`,children:(0,N.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,N.jsx)(ee,{className:`size-10 text-muted-foreground mx-auto`}),(0,N.jsx)(`p`,{className:`text-muted-foreground`,children:`No evolution activity yet. Run an evolution cycle to see your most active skill.`})]})})}function Jd(){return(0,N.jsxs)(F,{className:`border border-border/15 p-12 text-center`,children:[(0,N.jsx)(D,{className:`size-8 text-muted-foreground mx-auto mb-3`}),(0,N.jsx)(`p`,{className:`text-muted-foreground font-headline`,children:`No skills match the current filter`})]})}function Yd({message:e,onRetry:t}){return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 py-16`,children:[(0,N.jsx)(_e,{className:`size-10 text-destructive`}),(0,N.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:e}),t&&(0,N.jsxs)(`button`,{type:`button`,onClick:t,className:`inline-flex items-center gap-2 rounded-md border border-border px-3 py-1.5 text-sm font-medium hover:bg-muted transition-colors`,children:[(0,N.jsx)(oe,{className:`size-3.5`}),`Retry`]})]})}function Xd({autonomyStatus:e,lastRun:t,trustWatchlist:n,attentionItems:r,autonomousDecisions:i,renderSkillLink:a,heroActions:o,trustRailFooter:s,beforeHero:c,betweenHeroAndFeed:l,afterFeed:u}){return(0,N.jsx)(`div`,{className:`@container/main flex flex-1 flex-col py-6`,children:(0,N.jsxs)(`div`,{className:`grid grid-cols-12 gap-6 px-4 lg:px-6`,children:[c,(0,N.jsx)(`div`,{className:`col-span-12 @4xl/main:col-span-8`,children:(0,N.jsx)(kd,{status:e,lastRun:t,actions:o})}),(0,N.jsx)(`div`,{className:`col-span-12 @4xl/main:col-span-4 self-start`,children:(0,N.jsx)(Ad,{entries:n,renderSkillLink:a,footer:s})}),l,(0,N.jsx)(`div`,{className:`col-span-12`,children:(0,N.jsx)(Md,{attention:r,decisions:i,renderSkillLink:a})}),u]})})}var Zd=[`at_risk`,`improving`,`uncertain`,`stable`],Qd={at_risk:{label:`At Risk`,accent:`text-red-400`,dot:`bg-red-400`},improving:{label:`Improving`,accent:`text-primary`,dot:`bg-primary`},uncertain:{label:`Uncertain`,accent:`text-amber-400`,dot:`bg-amber-400`},stable:{label:`Stable`,accent:`text-muted-foreground`,dot:`bg-muted-foreground/60`}};function $d(e,t){return e?.onChange??t?.actions.updateOverviewWatchlist}function ef(e){return e?.actions.getOverviewWatchlist}function tf(e){return JSON.stringify(e??[])}function nf(e){return JSON.parse(e)}function rf(e){switch(e){case`created`:return`Proposal created`;case`validated`:return`Validated`;case`deployed`:return`Deployed`;case`rolled_back`:return`Rolled back`;case`watch`:return`Watching`;case`rejected`:return`Rejected`;default:return e.replace(/_/g,` `)}}function af(e,t=10){return e.toSorted((e,t)=>{let n=Zd.indexOf(e.bucket),r=Zd.indexOf(t.bucket);return n===r?(t.sortTimestamp??``).localeCompare(e.sortTimestamp??``):n-r}).slice(0,t).map(e=>e.skillName)}function of({rows:e,renderSkillLink:t,libraryAction:n,watchlist:r}){let i=qt(),a=!!r,o=r?.initialSkills??[],s=tf(o),[c,l]=(0,A.useState)(a?`watched`:`all`),[u,d]=(0,A.useState)(()=>nf(s)),f=(0,A.useRef)(0),p=(0,A.useRef)(0),m=ef(i),h=$d(r,i);(0,A.useEffect)(()=>{a&&d(nf(s))},[a,s]),(0,A.useEffect)(()=>{if(!a||!m||o.length>0)return;let e=p.current+1;p.current=e;let t=!1;return Promise.resolve(m()).then(n=>{t||p.current!==e||Array.isArray(n)&&n.every(e=>typeof e==`string`)&&d(n)}).catch(()=>{}),()=>{t=!0}},[a,m,o.length]);let g=(0,A.useMemo)(()=>e.toSorted((e,t)=>{let n=Zd.indexOf(e.bucket),r=Zd.indexOf(t.bucket);return n===r?(t.sortTimestamp??``).localeCompare(e.sortTimestamp??``):n-r}),[e]),_=(0,A.useMemo)(()=>{if(!r)return[];let t=new Set(e.map(e=>e.skillName)),n=u.filter(e=>t.has(e));return n.length>0?n:af(e)},[e,u,r]),v=(0,A.useMemo)(()=>{if(!r||c===`all`)return g;let e=new Set(_);return g.filter(t=>e.has(t.skillName))},[_,g,c,r]),y=async e=>{if(!r)return;let t=_.includes(e)?_.filter(t=>t!==e):[..._,e];if(!h){d(t);return}let n=_,i=f.current+1;f.current=i,d(t);try{let e=await h(t);f.current===i&&Array.isArray(e)&&e.every(e=>typeof e==`string`)&&d(e)}catch{f.current===i&&d(n)}};return(0,N.jsxs)(F,{className:`col-span-12 border-none bg-muted shadow-none py-0`,children:[(0,N.jsxs)(I,{className:`px-5 pt-5 pb-0`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Skill Comparison`}),(0,N.jsx)(R,{className:`mt-1 text-[13px]`,children:`Compare skill performance before drilling into the details.`})]}),(a||n)&&(0,N.jsx)(_t,{children:(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[a?(0,N.jsx)(St,{value:c,onValueChange:e=>l(e),children:(0,N.jsxs)(wt,{variant:`line`,className:`h-auto gap-2`,children:[(0,N.jsxs)(Tt,{value:`watched`,className:`font-headline text-[10px] uppercase tracking-[0.18em]`,children:[`Watched`,(0,N.jsx)(`span`,{className:`ml-1.5 text-muted-foreground`,children:_.length})]}),(0,N.jsxs)(Tt,{value:`all`,className:`font-headline text-[10px] uppercase tracking-[0.18em]`,children:[`All Skills`,(0,N.jsx)(`span`,{className:`ml-1.5 text-muted-foreground`,children:e.length})]})]})}):null,n]})})]}),(0,N.jsx)(z,{className:`themed-scroll overflow-x-auto px-5 py-5`,children:(0,N.jsxs)(`div`,{"data-parity-root":`overview-comparison-grid`,className:a?`min-w-[780px]`:`min-w-[680px]`,children:[a?(0,N.jsx)(`div`,{className:`mb-3 rounded-xl bg-background/35 px-3 py-2 text-xs text-muted-foreground`,children:c===`watched`?`Your watched skills stay pinned here. Add or remove them directly from the grid.`:`All installed skills, sorted by current trust priority.`}):null,(0,N.jsxs)(`div`,{className:`grid gap-3 px-3 pb-2 text-[10px] uppercase tracking-[0.18em] text-muted-foreground ${a?`grid-cols-[minmax(220px,2.3fr)_0.95fr_1.1fr_0.9fr_1.3fr_1fr_0.9fr]`:`grid-cols-[minmax(220px,2.3fr)_0.95fr_1.1fr_0.9fr_1.3fr_1fr]`}`,children:[(0,N.jsx)(`span`,{children:`Skill`}),(0,N.jsx)(`span`,{children:`Trigger Rate`}),(0,N.jsx)(`span`,{children:`Routing Conf.`}),(0,N.jsx)(`span`,{children:`Sessions`}),(0,N.jsx)(`span`,{children:`Last Evolution`}),(0,N.jsx)(`span`,{children:`Status`}),a?(0,N.jsx)(`span`,{className:`text-right`,children:`Watch`}):null]}),(0,N.jsxs)(`div`,{className:`space-y-1.5`,children:[v.map(e=>{let n=Qd[e.bucket],r=_.includes(e.skillName);return(0,N.jsxs)(`div`,{className:`grid items-center gap-3 rounded-xl bg-background/35 px-3 py-3 text-sm transition-colors hover:bg-background/50 ${a?`grid-cols-[minmax(220px,2.3fr)_0.95fr_1.1fr_0.9fr_1.3fr_1fr_0.9fr]`:`grid-cols-[minmax(220px,2.3fr)_0.95fr_1.1fr_0.9fr_1.3fr_1fr]`}`,children:[(0,N.jsxs)(`div`,{className:`min-w-0`,children:[t?t(e.skillName):(0,N.jsx)(`p`,{className:`truncate font-medium`,children:e.skillName}),e.subtext?(0,N.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.subtext}):null]}),(0,N.jsx)(`div`,{className:`font-medium`,children:e.triggerRate==null?`—`:`${Math.round(e.triggerRate*100)}%`}),(0,N.jsx)(`div`,{className:`min-w-0`,children:e.routingConfidence!=null&&e.confidenceCoverage>=.5?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`p`,{className:`text-sm font-medium`,children:[Math.round(e.routingConfidence*100),`%`]}),(0,N.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[Math.round(e.confidenceCoverage*100),`% coverage`]})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`p`,{className:`text-sm font-medium`,children:`—`}),(0,N.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:`Low coverage`})]})}),(0,N.jsx)(`div`,{className:`text-muted-foreground`,children:e.sessions}),(0,N.jsx)(`div`,{className:`min-w-0`,children:e.lastEvolution?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`p`,{className:`truncate text-sm`,children:rf(e.lastEvolution.action)}),(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:W(e.lastEvolution.timestamp)})]}):(0,N.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`No evolutions yet`})}),(0,N.jsx)(`div`,{children:(0,N.jsxs)(M,{variant:`outline`,className:`border-transparent ${n.accent} bg-background/55`,children:[(0,N.jsx)(`span`,{className:`mr-1.5 inline-block size-1.5 rounded-full ${n.dot}`}),n.label]})}),a?(0,N.jsx)(`div`,{className:`flex justify-end`,children:(0,N.jsxs)(P,{type:`button`,variant:r?`secondary`:`ghost`,size:`sm`,className:`h-8 gap-1.5 px-2 text-xs`,onClick:()=>void y(e.skillName),children:[(0,N.jsx)(b,{className:`size-3.5`}),r?`Watching`:`Watch`]})}):null]},e.skillName)}),v.length===0?(0,N.jsx)(`div`,{className:`rounded-xl bg-background/30 px-3 py-6 text-sm text-muted-foreground`,children:a?r?.emptyMessage??(0,N.jsxs)(N.Fragment,{children:[`No watched skills yet. Switch to`,` `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:`All Skills`}),` and add the ones you want to track closely.`]}):`No skills available.`}):null]})]})})]})}function sf({skillCount:e,storageKey:t=`selftune-onboarding-dismissed`}){let[n,r]=(0,A.useState)(()=>{try{return localStorage.getItem(t)===`true`}catch{return!1}});return e>0||n?null:(0,N.jsx)(`div`,{className:`col-span-12 rounded-xl border-2 border-dashed border-primary/30 bg-primary/5 p-8`,children:(0,N.jsxs)(`div`,{className:`mx-auto flex max-w-md flex-col items-center gap-4 text-center`,children:[(0,N.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full bg-primary/10`,children:(0,N.jsx)(Ye,{className:`size-6 text-primary`})}),(0,N.jsx)(`h2`,{className:`font-headline text-lg font-semibold`,children:`Welcome to selftune`}),(0,N.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:`No skills detected yet. Once you start using selftune in your project, skills will appear here automatically.`}),(0,N.jsxs)(`div`,{className:`grid w-full grid-cols-1 gap-3 text-left sm:grid-cols-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg border bg-card p-3`,children:[(0,N.jsx)(`div`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full bg-blue-500/10 text-xs font-bold text-blue-500`,children:`1`}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-xs font-medium`,children:`Run selftune`}),(0,N.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Enable selftune in your project to start tracking skills`})]})]}),(0,N.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg border bg-card p-3`,children:[(0,N.jsx)(`div`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full bg-amber-500/10 text-xs font-bold text-amber-500`,children:`2`}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-xs font-medium`,children:`Skills appear`}),(0,N.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Skills are detected and monitored automatically`})]})]}),(0,N.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg border bg-card p-3`,children:[(0,N.jsx)(`div`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full bg-emerald-500/10 text-xs font-bold text-emerald-500`,children:`3`}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-xs font-medium`,children:`Watch evolution`}),(0,N.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Proposals flow in with validated improvements`})]})]})]}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>{r(!0);try{localStorage.setItem(t,`true`)}catch{}},className:`text-xs text-muted-foreground hover:text-foreground`,children:`Dismiss`})]})})}function cf({lastRun:e,deployed:t,evolved:n,watched:r,runCount:i,historyAction:a}){return i===0?null:(0,N.jsxs)(`div`,{className:`col-span-12 flex items-center gap-6 rounded-xl border border-border/10 bg-card/50 px-5 py-3 text-xs text-muted-foreground`,children:[(0,N.jsx)(`span`,{className:`font-headline text-[10px] uppercase tracking-[0.2em]`,children:`Last Cycle`}),(0,N.jsx)(`span`,{children:e?W(e):`Never`}),(0,N.jsx)(`span`,{className:`text-muted-foreground/30`,children:`|`}),(0,N.jsxs)(`span`,{children:[t,` deployed`]}),(0,N.jsxs)(`span`,{children:[n,` evolved`]}),(0,N.jsxs)(`span`,{children:[r,` watched`]}),a?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:`text-muted-foreground/30`,children:`|`}),(0,N.jsx)(`span`,{className:`ml-auto`,children:a})]}):null]})}function lf({onboarding:e,comparison:t,sectionsBeforeFeed:n,runSummary:r,sectionsAfterFeed:i,renderSkillLink:a,...o}){let s=e?(0,N.jsx)(sf,{skillCount:e.skillCount,storageKey:e.storageKey}):null,c=t||n?(0,N.jsxs)(N.Fragment,{children:[t&&t.rows.length>0?(0,N.jsx)(`div`,{className:`col-span-12`,children:(0,N.jsx)(of,{...t,renderSkillLink:a})}):null,n]}):null,l=r||i?(0,N.jsxs)(N.Fragment,{children:[r?(0,N.jsx)(cf,{...r}):null,i]}):null;return(0,N.jsx)(Xd,{...o,renderSkillLink:a,beforeHero:s,betweenHeroAndFeed:c,afterFeed:l})}function uf({className:e,...t}){return(0,N.jsx)(`div`,{"data-slot":`skeleton`,className:j(`animate-pulse rounded-md bg-muted`,e),...t})}var df=6e4;function ff(){return Cr({queryKey:[`orchestrate-runs`],queryFn:()=>Lr(20),staleTime:5e3,refetchInterval:df})}function pf(e){switch(e){case`generate_evals`:return`Generate evals`;case`run_unit_tests`:return`Run unit tests`;case`run_replay_dry_run`:return`Replay dry-run`;case`measure_baseline`:return`Measure baseline`;case`deploy_candidate`:return`Deploy candidate`;case`watch_deployment`:return`Watch deployment`}}function mf({data:e}){return e?(0,N.jsxs)(F,{className:`rounded-2xl border-border/15`,children:[(0,N.jsxs)(I,{className:`gap-2`,children:[(0,N.jsx)(L,{className:`text-base`,children:`Creator test loop`}),(0,N.jsx)(R,{children:`Generate evals, add unit tests, replay a dry-run, measure baseline, then deploy a watched candidate. This surface tracks whether each skill is still blocked on testing, ready to ship, or already under watch.`})]}),(0,N.jsxs)(z,{className:`space-y-5`,children:[(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.summary}),(0,N.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-6`,children:[[`Generate evals`,e.counts.generate_evals],[`Run unit tests`,e.counts.run_unit_tests],[`Replay dry-run`,e.counts.run_replay_dry_run],[`Measure baseline`,e.counts.measure_baseline],[`Deploy candidate`,e.counts.deploy_candidate],[`Watching`,e.counts.watch_deployment]].map(([e,t])=>(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:e}),(0,N.jsx)(`div`,{className:`mt-2 text-2xl font-semibold`,children:t})]},e))}),e.priorities.length>0?(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-[0.12em] text-muted-foreground`,children:`Next priorities`}),(0,N.jsx)(`div`,{className:`space-y-3`,children:e.priorities.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-background px-4 py-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(c,{to:`/skills/${encodeURIComponent(e.skill_name)}`,className:`text-sm font-medium hover:underline`,children:e.skill_name}),(0,N.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[11px] text-muted-foreground`,children:pf(e.next_step)})]}),(0,N.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e.summary}),(0,N.jsx)(`code`,{className:`mt-2 block overflow-x-auto rounded-md bg-muted/60 px-3 py-2 text-[11px] text-foreground`,children:e.recommended_command})]},e.skill_name))})]}):null]})]}):null}function hf({search:e,statusFilter:t,onStatusFilterChange:n,overviewQuery:r}){let{data:i,isPending:a,isError:o,error:s,refetch:l}=r,u=ff();if(a)return(0,N.jsxs)(`div`,{className:`@container/main flex flex-1 flex-col gap-6 py-6 px-4 lg:px-6`,children:[(0,N.jsx)(uf,{className:`h-[340px] rounded-xl`}),(0,N.jsxs)(`div`,{className:`grid grid-cols-12 gap-6`,children:[(0,N.jsx)(uf,{className:`col-span-12 @4xl/main:col-span-8 h-64 rounded-xl`}),(0,N.jsx)(uf,{className:`col-span-12 @4xl/main:col-span-4 h-64 rounded-xl`})]})]});if(o)return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 py-16`,children:[(0,N.jsx)(_e,{className:`size-10 text-destructive`}),(0,N.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:s instanceof Error?s.message:`Unknown error`}),(0,N.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>l(),children:[(0,N.jsx)(oe,{className:`mr-2 size-3.5`}),`Retry`]})]});if(!i)return(0,N.jsx)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 py-16`,children:(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No telemetry data found. Run some sessions first.`})});let{skills:d,autonomy_status:f,attention_queue:p,trust_watchlist:m,recent_decisions:h,overview:g,creator_testing:_}=i,v=u.data?.runs??[],y=v[0],b=v.reduce((e,t)=>e+t.deployed,0),x=v.reduce((e,t)=>e+t.evolved,0),S=v.reduce((e,t)=>e+t.watched,0),C=new Map;for(let e of g.evolution)!e.skill_name||C.has(e.skill_name)||C.set(e.skill_name,e);let w=d.map(e=>{let t=m.find(t=>t.skill_name===e.skill_name),n=e.testing_readiness?.next_step;return{skillName:e.skill_name,subtext:`${e.skill_scope??`Unscoped`} · ${e.total_checks} checks${n&&n!==`watch_deployment`?` · ${pf(n)}`:``}`,triggerRate:t?.pass_rate??e.pass_rate,routingConfidence:e.routing_confidence,confidenceCoverage:e.confidence_coverage,sessions:e.unique_sessions,lastEvolution:C.get(e.skill_name)??null,bucket:t?.bucket??`uncertain`,sortTimestamp:e.last_seen??null}});return(0,N.jsx)(lf,{autonomyStatus:f,lastRun:y?.timestamp??null,trustWatchlist:m,attentionItems:p,autonomousDecisions:h,renderSkillLink:e=>(0,N.jsx)(c,{to:`/skills/${encodeURIComponent(e)}`,className:`text-sm font-medium hover:underline`,children:e}),onboarding:{skillCount:d.length},heroActions:(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[f.attention_required>0?(0,N.jsx)(P,{size:`sm`,nativeButton:!1,render:(0,N.jsx)(`a`,{href:`#supervision-feed`}),children:`Review Attention Queue`}):(0,N.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`No action needed`}),(0,N.jsx)(P,{variant:`outline`,size:`sm`,nativeButton:!1,render:(0,N.jsx)(c,{to:`?action=evolve`}),children:`Run Evolution`})]}),trustRailFooter:(0,N.jsx)(c,{to:`/skills`,className:`text-xs font-medium text-primary hover:underline`,children:`View All Skills`}),comparison:{rows:w,libraryAction:(0,N.jsx)(c,{to:`/skills`,className:`text-xs font-medium text-primary hover:underline`,children:`View library`}),watchlist:{initialSkills:i.watched_skills}},sectionsBeforeFeed:(0,N.jsx)(mf,{data:_}),runSummary:{lastRun:y?.timestamp??null,deployed:b,evolved:x,watched:S,runCount:v.length,historyAction:(0,N.jsx)(c,{to:`/analytics`,className:`text-primary hover:underline`,children:`View full history`})}})}function gf(e){let[t,n,r]=e.split(`-`).map(Number);return!t||!n||!r?null:new Date(t,n-1,r)}function _f(){return(0,N.jsxs)(`div`,{className:`@container/main flex flex-1 flex-col gap-6 px-4 py-6 lg:px-6`,children:[(0,N.jsx)(`div`,{className:`h-12 w-80 animate-pulse rounded-xl bg-card`}),(0,N.jsxs)(`div`,{className:`grid grid-cols-12 gap-6`,children:[(0,N.jsx)(`div`,{className:`col-span-12 h-[380px] animate-pulse rounded-xl bg-card @4xl/main:col-span-8`}),(0,N.jsx)(`div`,{className:`col-span-12 h-[380px] animate-pulse rounded-xl bg-card @4xl/main:col-span-4`}),(0,N.jsx)(`div`,{className:`col-span-12 h-[320px] animate-pulse rounded-xl bg-card @4xl/main:col-span-7`}),(0,N.jsx)(`div`,{className:`col-span-12 h-[320px] animate-pulse rounded-xl bg-card @4xl/main:col-span-5`}),(0,N.jsx)(`div`,{className:`col-span-12 h-[140px] animate-pulse rounded-xl bg-card`})]})]})}function vf({data:e,isLoading:t,error:n,onRefresh:r,onRetry:i,headerActions:a,insightActions:o}){let[s,c]=(0,A.useState)(`pass_rate`),l=(0,A.useMemo)(()=>{if(!e?.pass_rate_trend.length)return null;let t=e.pass_rate_trend[e.pass_rate_trend.length-1];if(!t)return null;let n=gf(t.date);if(!n)return null;let r=new Date;r.setHours(0,0,0,0);let i=Math.max(0,Math.floor((r.getTime()-n.getTime())/864e5));return i===0?`today`:i===1?`1d ago`:`${i}d ago`},[e]),u=(0,A.useMemo)(()=>e?.skill_rankings?e.skill_rankings.toSorted((e,t)=>t.pass_rate-e.pass_rate).slice(0,5):[],[e]),d=(0,A.useMemo)(()=>u.length?u.reduce((e,t)=>e+t.pass_rate,0)/u.length:0,[u]),f=(0,A.useMemo)(()=>e?.evolution_impact?e.evolution_impact.filter(e=>e.pass_rate_after>e.pass_rate_before):[],[e]);if(t&&!e)return(0,N.jsx)(_f,{});if(n&&!e)return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 py-16`,children:[(0,N.jsx)(me,{className:`size-10 text-destructive`}),(0,N.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:n}),(0,N.jsxs)(P,{variant:`outline`,size:`sm`,onClick:i,children:[(0,N.jsx)(We,{className:`mr-2 size-3.5`}),`Retry`]})]});if(!e)return(0,N.jsx)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 py-16`,children:(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No analytics data available yet. Run some sessions and grading first.`})});let{summary:p}=e;return(0,N.jsxs)(`div`,{className:`@container/main flex flex-1 flex-col gap-8 px-4 py-8 lg:px-6`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,N.jsx)(`h1`,{className:`font-headline text-4xl font-bold tracking-tight text-foreground`,children:`Performance Analytics`}),(0,N.jsxs)(M,{variant:`outline`,className:`gap-1.5 border-primary/20 bg-primary/10 font-headline text-[10px] uppercase tracking-widest text-primary`,children:[(0,N.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-primary`}),`Live`]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:[l?`Last graded: ${l}`:`Awaiting first grading run`,p.active_skills>0&&` · ${p.active_skills} active skills`]})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsxs)(P,{variant:`secondary`,size:`sm`,onClick:r,className:`gap-1.5 font-headline text-[10px] uppercase tracking-widest`,children:[(0,N.jsx)(We,{className:`size-3`}),`Refresh`]}),a]})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-12 gap-6`,children:[(0,N.jsxs)(F,{className:`col-span-12 border-none bg-muted shadow-none @4xl/main:col-span-8`,children:[(0,N.jsxs)(I,{className:`pb-2`,children:[(0,N.jsx)(R,{className:`font-headline text-[10px] uppercase tracking-widest`,children:`Evolution Trajectory`}),(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsx)(L,{className:`font-headline text-lg`,children:`Evolution Impact Curve`}),(0,N.jsx)(`div`,{className:`flex items-center gap-1 rounded-lg bg-background p-0.5`,children:[{key:`pass_rate`,label:`Pass Rate`},{key:`volume`,label:`Check Volume`}].map(e=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>c(e.key),className:`rounded-md px-3 py-1 text-[10px] font-headline uppercase tracking-widest transition-colors ${s===e.key?`bg-secondary text-primary`:`text-muted-foreground hover:text-foreground`}`,children:e.label},e.key))})]})]}),(0,N.jsx)(z,{children:(0,N.jsx)(Jr,{data:e.pass_rate_trend,mode:s})})]}),(0,N.jsxs)(F,{className:`col-span-12 flex flex-col border-none bg-muted shadow-none @4xl/main:col-span-4`,children:[(0,N.jsxs)(I,{className:`pb-2`,children:[(0,N.jsx)(R,{className:`font-headline text-[10px] uppercase tracking-widest`,children:`Skill Rankings`}),(0,N.jsx)(L,{className:`font-headline text-lg`,children:`Skill Performance`})]}),(0,N.jsxs)(z,{className:`flex flex-1 flex-col`,children:[(0,N.jsx)(Yr,{skills:u}),(0,N.jsx)(`div`,{className:`mt-5 border-t border-border/20 pt-4`,children:(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsx)(`span`,{className:`font-headline text-[10px] uppercase tracking-widest text-muted-foreground`,children:`Avg Pass Rate`}),(0,N.jsx)(`span`,{className:`font-headline text-2xl font-bold text-primary`,children:u.length>0?`${Math.round(d*100)}%`:`--`})]})})]})]}),(0,N.jsxs)(F,{className:`col-span-12 border-none bg-muted shadow-none @4xl/main:col-span-7`,children:[(0,N.jsxs)(I,{className:`pb-2`,children:[(0,N.jsx)(R,{className:`font-headline text-[10px] uppercase tracking-widest`,children:`Grading Activity`}),(0,N.jsx)(L,{className:`font-headline text-lg`,children:`Check Activity Over Time`})]}),(0,N.jsx)(z,{className:`flex flex-1 flex-col`,children:(0,N.jsx)(Xr,{data:e.daily_activity})})]}),(0,N.jsxs)(F,{className:`col-span-12 border-none bg-muted shadow-none @4xl/main:col-span-5`,children:[(0,N.jsxs)(I,{className:`pb-2`,children:[(0,N.jsx)(R,{className:`font-headline text-[10px] uppercase tracking-widest`,children:`Evolution Outcomes`}),(0,N.jsx)(L,{className:`font-headline text-lg`,children:`Evolution ROI`})]}),(0,N.jsx)(z,{children:(0,N.jsx)(Zr,{impacts:e.evolution_impact})})]}),(0,N.jsx)(F,{className:`col-span-12 border-none bg-muted/60 shadow-none backdrop-blur-md`,children:(0,N.jsx)(z,{className:`pt-6`,children:(0,N.jsxs)(`div`,{className:`flex flex-col items-start justify-between gap-4 @3xl/main:flex-row @3xl/main:items-center`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`mb-2 font-headline text-[10px] uppercase tracking-widest text-muted-foreground`,children:`Data-Driven Insight`}),(0,N.jsx)(`p`,{className:`max-w-2xl text-[15px] leading-relaxed text-foreground`,children:f.length>0?`${f.length} skill${f.length===1?``:`s`} improved after evolution, averaging ${Math.round(p.avg_improvement*100)}% improvement. ${p.total_checks_30d} checks processed in the last 30 days across ${p.active_skills} active skills.`:p.total_checks_30d>0?`${p.total_checks_30d} checks processed in the last 30 days across ${p.active_skills} active skills. Run an evolution cycle to start improving skill pass rates.`:`Start grading sessions to generate performance insights. Run selftune orchestrate to begin the autonomous improvement loop.`})]}),o?(0,N.jsx)(`div`,{className:`flex shrink-0 items-center gap-3`,children:o}):null]})})})]}),(0,N.jsxs)(`div`,{className:`flex items-center justify-between px-1 font-headline text-[10px] uppercase tracking-widest text-muted-foreground`,children:[(0,N.jsxs)(`span`,{children:[p.total_evolutions,` evolution`,p.total_evolutions===1?``:`s`,` deployed`]}),(0,N.jsxs)(`span`,{children:[p.total_checks_30d,` checks (30d)`]}),(0,N.jsxs)(`span`,{children:[p.active_skills,` active skill`,p.active_skills===1?``:`s`]})]})]})}async function yf(){let e=await fetch(`/api/v2/analytics`);if(!e.ok)throw Error(`Failed to load analytics (${e.status})`);return await e.json()}function bf(){let{data:e,isPending:t,isError:n,error:r,refetch:i}=Cr({queryKey:[`analytics`],queryFn:yf,refetchInterval:3e4});return(0,N.jsx)(vf,{data:e??null,isLoading:t,error:n?r instanceof Error?r.message:`Failed to load analytics`:null,onRefresh:()=>{i()},onRetry:()=>{i()},headerActions:(0,N.jsxs)(P,{variant:`secondary`,size:`sm`,className:`gap-1.5 font-headline text-[10px] uppercase tracking-widest`,disabled:!0,"aria-disabled":`true`,title:`Export is not available yet.`,children:[(0,N.jsx)(pt,{className:`size-3`}),`Export`]}),insightActions:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(P,{size:`sm`,className:`font-headline text-[10px] uppercase tracking-widest`,disabled:!0,"aria-disabled":`true`,title:`Dashboard-triggered evolution is not available yet.`,children:`Run Evolution`}),(0,N.jsx)(P,{variant:`outline`,size:`sm`,className:`border-primary/20 font-headline text-[10px] uppercase tracking-widest text-primary hover:border-primary/40`,disabled:!0,"aria-disabled":`true`,title:`Detailed analytics drill-down is not available yet.`,children:`View Details`})]})})}function xf({evolution:e,activeProposal:t,onSelect:n,collapsedProposalCount:r=6}){let i=(0,A.useMemo)(()=>new Set(e.map(e=>e.proposal_id)).size,[e]),a=i>r,[o,s]=(0,A.useState)(!a),c=(0,A.useMemo)(()=>{if(o)return e;let t=new Set,n=[];for(let i of e){if(!t.has(i.proposal_id)){if(t.size>=r)continue;t.add(i.proposal_id)}n.push(i)}return n},[r,e,o]);return(0,N.jsx)(`aside`,{className:`w-full px-4 py-4 @5xl/main:w-[252px] @5xl/main:self-start @5xl/main:pr-0`,children:(0,N.jsx)(`div`,{className:`@5xl/main:sticky @5xl/main:top-16`,children:(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 px-3 py-3 text-xs ${o?`themed-scroll max-h-[26rem] overflow-y-auto @5xl/main:max-h-[calc(100svh-6rem)]`:`overflow-visible`}`,children:[(0,N.jsx)(id,{entries:c,selectedProposalId:t,onSelect:n}),a?(0,N.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`mt-2 flex w-full items-center justify-center gap-1.5 py-2 text-[11px] text-muted-foreground transition-colors hover:text-foreground`,children:[(0,N.jsx)(w,{className:`size-3 transition-transform duration-150 ${o?`rotate-180`:``}`}),o?`Collapse timeline`:`Show full timeline (${i} proposals)`]}):null]})})})}function Sf({evolution:e,activeProposal:t,onSelect:n,evidence:r,viewerProposalId:i,showViewer:a,emptyState:o}){return(0,N.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border/15 bg-card`,children:(0,N.jsxs)(`div`,{className:`flex flex-col @5xl/main:grid @5xl/main:grid-cols-[252px_minmax(0,1fr)] @5xl/main:items-start`,children:[e.length>0?(0,N.jsx)(xf,{evolution:e,activeProposal:t,onSelect:n}):null,(0,N.jsx)(`div`,{className:`min-w-0 p-4 @xl/main:p-5`,children:a?(0,N.jsx)(qu,{proposalId:i,evolution:e,evidence:r}):o??(0,N.jsx)(F,{className:`rounded-2xl`,children:(0,N.jsx)(z,{className:`py-12`,children:(0,N.jsx)(`div`,{className:`flex items-center justify-center text-sm text-muted-foreground`,children:`No recent evaluation evidence available`})})})})]})})}function Cf({invocations:e,sessionMetadata:t,callout:n}){return(0,N.jsxs)(`div`,{className:`space-y-2`,children:[n,(0,N.jsx)(Sd,{invocations:e,sessionMetadata:t})]})}function wf({examples:e,...t}){return(0,N.jsxs)(`div`,{"data-parity-root":`skill-report-evidence`,className:`space-y-6`,children:[e?(0,N.jsx)(yd,{examples:e}):null,(0,N.jsx)(Sf,{...t})]})}function Tf({evidenceQuality:e,dataHygiene:t,emptyState:n}){return!e&&!t?n??(0,N.jsx)(F,{className:`rounded-2xl border border-border/15 bg-card`,children:(0,N.jsx)(z,{className:`py-12`,children:(0,N.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:`Detailed data-quality metrics are not available for this skill yet.`})})}):(0,N.jsx)(bd,{evidenceQuality:e,dataHygiene:t})}function Ef(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);if(i<30)return`${i}d ago`;let a=new Date(e);return Number.isNaN(a.getTime())?e:a.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}function Df({rows:e,emptyState:t}){return e.length===0?t??(0,N.jsx)(`div`,{className:`rounded-lg border border-dashed border-border p-8 text-center text-sm text-muted-foreground`,children:`No missed queries detected.`}):(0,N.jsx)(`div`,{"data-parity-root":`skill-report-missed-queries`,className:`space-y-3`,children:e.map(e=>(0,N.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border border-border p-3`,children:[(0,N.jsx)(`div`,{className:`mt-0.5 h-2 w-2 shrink-0 rounded-full bg-orange-500`}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(`p`,{className:`truncate text-sm text-foreground`,children:e.query}),(0,N.jsxs)(`div`,{className:`mt-1 flex items-center gap-3 text-xs text-muted-foreground`,children:[e.confidence!==null&&(0,N.jsxs)(`span`,{className:`font-medium text-orange-600 dark:text-orange-400`,children:[(e.confidence*100).toFixed(0),`% confidence`]}),e.source?(0,N.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:e.source}):null,(0,N.jsx)(`span`,{children:Ef(e.createdAt)})]})]})]},e.id))})}var Of=`rounded-lg px-3 font-headline text-xs uppercase tracking-wider data-active:bg-background/70 data-active:text-foreground`;function kf({tabs:e,value:t,defaultValue:n,onValueChange:r}){let i=e.filter(e=>!e.hidden);if(i.length===0)return null;let a=i[0]?.value;return(0,N.jsxs)(St,{...t===void 0?{defaultValue:n??a,onValueChange:r}:{value:t,onValueChange:r},children:[(0,N.jsx)(wt,{variant:`line`,className:`rounded-xl border border-border/10 bg-muted/20 px-1.5 py-1`,children:i.map(e=>{let t=(0,N.jsxs)(N.Fragment,{children:[e.label,e.badge]});return e.tooltip?(0,N.jsxs)(Ot,{children:[(0,N.jsx)(kt,{render:(0,N.jsx)(Tt,{value:e.value,className:Of}),children:t}),(0,N.jsx)(At,{children:e.tooltip})]},e.value):(0,N.jsx)(Tt,{value:e.value,className:Of,children:t},e.value)})}),i.map(e=>(0,N.jsx)(Et,{value:e.value,className:e.contentClassName,children:e.content},e.value))]})}function Af({backLink:e,title:t,statusBadge:n,toolbarMeta:r,summary:i,showOnboardingBanner:a=!1,guideButtonLabel:o=`How to read this page`,nextAction:s,trustState:c,coverage:l,evidenceQuality:u,routingQuality:d,evolutionState:f,dataHygiene:p,fallbackChecks:m,fallbackSessions:h,fallbackEvidenceRows:g,fallbackEvolutionRows:_,fallbackLatestAction:v,nextActionText:y,children:b}){let[x,S]=(0,A.useState)(!1);return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(Id,{open:x,onOpenChange:S}),(0,N.jsxs)(`div`,{className:`@container/main flex flex-1 flex-col gap-5 p-4 lg:px-6 lg:pb-6 lg:pt-0`,children:[(0,N.jsxs)(`div`,{className:`sticky top-0 z-30 space-y-2 border-b border-border/15 bg-background/95 py-2.5 backdrop-blur supports-[backdrop-filter]:bg-background/85`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[e,(0,N.jsx)(`h1`,{className:`shrink-0 font-headline text-base font-semibold tracking-tight lg:text-lg`,children:t}),n,(0,N.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-4`,children:[(0,N.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>S(!0),children:o}),r]})]}),i?(0,N.jsx)(`div`,{className:`space-y-1.5 text-sm leading-relaxed text-muted-foreground`,children:i}):null]}),a?(0,N.jsx)(Ld,{onOpenGuide:()=>S(!0)}):null,(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsx)(fd,{nextAction:s,latestDecision:(f?.evolution_rows??_)>0&&(f?.latest_action??v)?{action:f?.latest_action??v??`No data`,timestamp:f?.latest_timestamp??null,evolutionCount:f?.evolution_rows??_}:void 0}),(0,N.jsx)(_d,{trustState:c,coverage:l,evidenceQuality:u,routingQuality:d,evolutionState:f,dataHygiene:p,fallbackChecks:m,fallbackSessions:h,nextActionText:y,onOpenGuide:()=>S(!0)}),(0,N.jsx)(vd,{coverage:l,evidenceQuality:u,routingQuality:d,evolutionState:f,fallbackChecks:m,fallbackSessions:h,fallbackEvidenceRows:g,fallbackEvolutionRows:_,fallbackLatestAction:v})]}),b?(0,N.jsx)(`div`,{className:`space-y-4 border-t border-border/10 pt-4`,children:b}):null]})]})}function jf({state:e}){let t=Mf(e);return(0,N.jsxs)(M,{variant:t.variant,className:`gap-1 shrink-0 text-[10px]`,children:[t.icon,t.label]})}function Mf(e){switch(e){case`low_sample`:return{label:`Low Sample`,variant:`secondary`,icon:(0,N.jsx)(Oe,{className:`size-3`})};case`observed`:return{label:`Observed`,variant:`outline`,icon:(0,N.jsx)(b,{className:`size-3`})};case`watch`:return{label:`Watch`,variant:`secondary`,icon:(0,N.jsx)(it,{className:`size-3`})};case`validated`:return{label:`Validated`,variant:`default`,icon:(0,N.jsx)(Ue,{className:`size-3`})};case`deployed`:return{label:`Deployed`,variant:`default`,icon:(0,N.jsx)(Ue,{className:`size-3`})};case`rolled_back`:return{label:`Rolled Back`,variant:`destructive`,icon:(0,N.jsx)(et,{className:`size-3`})}}}var Nf=6e4;function Pf(e){return Cr({queryKey:[`skill-report`,e],queryFn:()=>Ir(e),enabled:!!e,staleTime:5e3,refetchInterval:Nf,retry:(e,t)=>t instanceof Br?!1:e<2})}function Ff(e){switch(e){case`generate_evals`:return`Generate evals`;case`run_unit_tests`:return`Run unit tests`;case`run_replay_dry_run`:return`Replay dry-run`;case`measure_baseline`:return`Measure baseline`;case`deploy_candidate`:return`Deploy candidate`;case`watch_deployment`:return`Watch deployment`}}function If(e){switch(e.next_step){case`generate_evals`:return{icon:(0,N.jsx)(O,{className:`size-5 text-primary`}),text:e.summary,actionLabel:`Generate evals`,variant:`default`};case`run_unit_tests`:return{icon:(0,N.jsx)(he,{className:`size-5 text-primary`}),text:e.summary,actionLabel:`Generate unit tests`,variant:`default`};case`run_replay_dry_run`:return{icon:(0,N.jsx)(oe,{className:`size-5 text-primary`}),text:e.summary,actionLabel:`Run replay dry-run`,variant:`secondary`};case`measure_baseline`:return{icon:(0,N.jsx)(Xe,{className:`size-5 text-primary`}),text:e.summary,actionLabel:`Measure baseline`,variant:`secondary`};case`deploy_candidate`:return{icon:(0,N.jsx)(x,{className:`size-5 text-primary`}),text:e.summary,actionLabel:`Deploy candidate`,variant:`outline`};case`watch_deployment`:return{icon:(0,N.jsx)(ue,{className:`size-5 text-primary`}),text:e.summary,actionLabel:`Watch deployment`,variant:`outline`}}}function Lf({readiness:e}){return e?(0,N.jsxs)(F,{className:`rounded-2xl border-border/15`,children:[(0,N.jsxs)(I,{className:`gap-2`,children:[(0,N.jsx)(L,{className:`text-base`,children:`Creator test loop`}),(0,N.jsx)(R,{children:`Use this loop before trusting an evolution: generate evals, add unit tests, replay a dry-run, measure baseline, then deploy and watch.`})]}),(0,N.jsxs)(z,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(M,{variant:`secondary`,children:Ff(e.next_step)}),(0,N.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.summary})]}),(0,N.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-5`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:`Eval readiness`}),(0,N.jsx)(`div`,{className:`mt-2 text-sm font-medium`,children:e.eval_readiness===`log_ready`?`Log-ready`:e.eval_readiness===`cold_start_ready`?`Cold-start ready`:`Telemetry only`}),(0,N.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.eval_set_entries>0?`${e.eval_set_entries} canonical eval entries`:`${e.trusted_session_count} trusted sessions`})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:`Unit tests`}),(0,N.jsx)(`div`,{className:`mt-2 text-sm font-medium`,children:e.unit_test_cases>0?`${e.unit_test_cases} cases`:`Not generated`}),(0,N.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.unit_test_pass_rate==null?`No stored test run`:`Last run ${Math.round(e.unit_test_pass_rate*100)}%`})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:`Replay validation`}),(0,N.jsx)(`div`,{className:`mt-2 text-sm font-medium`,children:e.replay_check_count>0?`${e.replay_check_count} checks`:`Not recorded`}),(0,N.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.latest_validation_mode?`Latest mode: ${e.latest_validation_mode}`:`Use --validation-mode replay`})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:`Baseline`}),(0,N.jsx)(`div`,{className:`mt-2 text-sm font-medium`,children:e.baseline_sample_size>0?`${e.baseline_sample_size} samples`:`Not stored`}),(0,N.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.baseline_pass_rate==null?`Run grade baseline`:`Pass rate ${Math.round(e.baseline_pass_rate*100)}%`})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:`Deployment`}),(0,N.jsx)(`div`,{className:`mt-2 text-sm font-medium`,children:e.deployment_readiness===`ready_to_deploy`?`Ready to deploy`:e.deployment_readiness===`watching`?`Watching live`:e.deployment_readiness===`rolled_back`?`Rolled back`:`Blocked`}),(0,N.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.deployment_summary})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/30 bg-background px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:`Recommended command`}),(0,N.jsx)(`code`,{className:`mt-2 block overflow-x-auto text-[11px] text-foreground`,children:e.recommended_command})]}),e.deployment_command?(0,N.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/30 bg-background px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:`Deploy / watch command`}),(0,N.jsx)(`code`,{className:`mt-2 block overflow-x-auto text-[11px] text-foreground`,children:e.deployment_command})]}):null]})]}):null}function Rf(e,t,n,r,i){return e===`low_sample`?{icon:(0,N.jsx)(ue,{className:`size-5`}),text:`Keep observing. This skill needs more sessions before trust can be assessed.`,actionLabel:`Keep observing`,variant:`secondary`}:e===`rolled_back`?{icon:(0,N.jsx)(dt,{className:`size-5 text-destructive`}),text:`Inspect rollback evidence before re-deploying.`,actionLabel:`Inspect rollback`,variant:`destructive`}:e===`watch`&&(n??0)>.05?{icon:(0,N.jsx)(dt,{className:`size-5 text-amber-500`}),text:`Clean source-truth data or routing data before trusting this report.`,actionLabel:`Clean data`,variant:`secondary`}:e===`watch`&&(t??0)>0?{icon:(0,N.jsx)(C,{className:`size-5 text-amber-500`}),text:`Generate evals to investigate missed triggers.`,actionLabel:`Generate evals`,variant:`secondary`}:e===`watch`?{icon:(0,N.jsx)(ue,{className:`size-5 text-amber-500`}),text:`This skill is under active observation. Review recent invocations to verify routing accuracy.`,actionLabel:`Review invocations`,variant:`secondary`}:r?{icon:(0,N.jsx)(ce,{className:`size-5 text-primary`}),text:`Review pending proposal.`,actionLabel:`Review proposal`,variant:`default`}:e===`validated`?{icon:(0,N.jsx)(ve,{className:`size-5 text-primary`}),text:`Deploy the validated candidate.`,actionLabel:`Deploy candidate`,variant:`default`}:e===`deployed`?{icon:(0,N.jsx)(he,{className:`size-5 text-green-500`}),text:`No action needed. Skill is healthy and being monitored.`,actionLabel:`Healthy`,variant:`outline`}:e===`observed`?{icon:(0,N.jsx)(ue,{className:`size-5 text-muted-foreground`}),text:`No action needed. Selftune is still observing this skill and building confidence from real usage.`,actionLabel:`Observed`,variant:`outline`}:{icon:(0,N.jsx)(ue,{className:`size-5`}),text:`Continue monitoring this skill.`,actionLabel:`Monitor`,variant:`outline`}}function zf(){let{name:e}=i(),[t,n]=s(),{data:r,isPending:a,isError:o,error:l,refetch:u}=Pf(e),[d,f]=(0,A.useState)(`invocations`),p=r?.evolution??[],m=new Set(p.map(e=>e.proposal_id)),h=t.get(`proposal`),g=h&&m.has(h)?h:p.length>0?p[0].proposal_id:null;(0,A.useEffect)(()=>{let e=t.get(`proposal`);if(g&&e!==g){let e=new URLSearchParams(t);e.set(`proposal`,g),n(e,{replace:!0});return}if(!g&&e){let e=new URLSearchParams(t);e.delete(`proposal`),n(e,{replace:!0})}},[g,t,n]);let _=e=>{let r=new URLSearchParams(t);r.set(`proposal`,e),n(r,{replace:!0})},v=r?.trust,y=r?.coverage,b=r?.evidence_quality,x=r?.routing_quality,S=r?.evolution_state,C=r?.data_hygiene,w=r?.examples,T=C?.raw_checks??y?.checks??r?.usage.total_checks??0,E=C?.operational_checks??y?.checks??r?.usage.total_checks??0,D=Math.max(T-E,0),O=(S?.evolution_rows??p.length)>0,ee=r?.testing_readiness??null,te=O?`evidence`:`invocations`;(0,A.useEffect)(()=>{f(te)},[te]);let ne=(0,A.useMemo)(()=>{let e=(r?.canonical_invocations??[]).map(e=>({timestamp:e.timestamp||e.occurred_at||null,session_id:e.session_id,triggered:e.triggered,query:e.query??``,source:e.source??``,invocation_mode:e.invocation_mode??null,confidence:e.confidence??null,tool_name:e.tool_name??null,agent_type:e.agent_type??null,observation_kind:e.observation_kind??`canonical`,historical_context:e.historical_context??null}));return e.sort((e,t)=>(t.timestamp??``).localeCompare(e.timestamp??``)),e},[r?.canonical_invocations]);if(!e)return(0,N.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-16`,children:(0,N.jsx)(`p`,{className:`text-sm text-destructive`,children:`No skill name provided`})});if(a)return(0,N.jsxs)(`div`,{className:`@container/main flex flex-1 flex-col gap-6 p-4 lg:p-6`,children:[(0,N.jsx)(uf,{className:`h-10 w-64`}),(0,N.jsx)(`div`,{className:`grid grid-cols-1 gap-4 @xl/main:grid-cols-2 @5xl/main:grid-cols-4`,children:Array.from({length:4}).map((e,t)=>(0,N.jsx)(uf,{className:`h-28 rounded-2xl`},t))}),(0,N.jsx)(uf,{className:`h-20 rounded-2xl`}),(0,N.jsx)(uf,{className:`h-64 rounded-2xl`})]});if(o)return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 py-16`,children:[(0,N.jsx)(_e,{className:`size-10 text-destructive`}),(0,N.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:l instanceof Error?l.message:`Unknown error`}),(0,N.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>u(),children:[(0,N.jsx)(oe,{className:`mr-2 size-3.5`}),`Retry`]})]});if(!r)return(0,N.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-16`,children:(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No data yet`})});if((y?.checks??r.usage.total_checks)===0&&r.evidence.length===0&&r.evolution.length===0&&(r.canonical_invocations?.length??0)===0)return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 py-16`,children:[(0,N.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No data found for skill "`,e,`".`]}),(0,N.jsxs)(P,{variant:`outline`,size:`sm`,nativeButton:!1,render:(0,N.jsx)(c,{to:`/`}),children:[(0,N.jsx)(be,{className:`mr-2 size-3.5`}),`Back to Overview`]})]});let k=v?.state??`low_sample`,re=Rf(k,x?.miss_rate,b?.system_like_rate,S?.has_pending_proposals??r.pending_proposals.length>0,O),ie=k===`rolled_back`||!ee||ee.next_step===`watch_deployment`?re:If(ee);return(0,N.jsxs)(Af,{backLink:(0,N.jsx)(P,{variant:`outline`,size:`sm`,nativeButton:!1,render:(0,N.jsx)(c,{to:`/`}),className:`shrink-0`,children:(0,N.jsx)(be,{className:`size-3.5`})}),title:r.skill_name,statusBadge:(0,N.jsx)(jf,{state:k}),toolbarMeta:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`div`,{className:`hidden @xl/main:flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,N.jsxs)(`span`,{className:`tabular-nums`,children:[(0,N.jsx)(`strong`,{className:`text-foreground`,children:y?.checks??r.usage.total_checks}),` `,`checks`]}),(0,N.jsx)(`span`,{className:`text-border`,children:`|`}),(0,N.jsxs)(`span`,{className:`tabular-nums`,children:[(0,N.jsx)(`strong`,{className:`text-foreground`,children:y?.sessions??r.sessions_with_skill}),` `,`sessions`]}),(0,N.jsx)(`span`,{className:`text-border`,children:`|`}),(0,N.jsxs)(`span`,{className:`tabular-nums`,children:[(0,N.jsx)(`strong`,{className:`text-foreground`,children:y?.workspaces??`No data`}),` `,`workspaces`]})]}),y?.first_seen||y?.last_seen?(0,N.jsxs)(`div`,{className:`hidden @3xl/main:flex items-center gap-2 font-mono text-[10px] text-muted-foreground`,children:[y?.first_seen?(0,N.jsx)(`span`,{title:`First seen`,children:W(y.first_seen)}):null,y?.first_seen&&y?.last_seen?(0,N.jsx)(`span`,{children:`-`}):null,y?.last_seen?(0,N.jsx)(`span`,{title:`Last seen`,children:W(y.last_seen)}):null]}):null]}),summary:v?.summary?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,N.jsx)(`span`,{children:v.summary}),S?.latest_action&&S?.latest_timestamp?(0,N.jsxs)(`span`,{className:`font-mono text-[11px] text-muted-foreground/70`,children:[`Latest: `,S.latest_action,` (`,W(S.latest_timestamp),`)`]}):null]}),D>0?(0,N.jsxs)(`div`,{className:`text-[12px] text-muted-foreground/80`,children:[`Based on `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:E}),` `,`real checks. `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:D}),` `,`internal or legacy rows are excluded from trust scoring.`]}):null]}):void 0,showOnboardingBanner:!0,guideButtonLabel:`How this works`,nextAction:ie,trustState:k,coverage:y,evidenceQuality:b,routingQuality:x,evolutionState:S,dataHygiene:C,fallbackChecks:r.usage.total_checks,fallbackSessions:r.sessions_with_skill,fallbackEvidenceRows:r.evidence.length,fallbackEvolutionRows:p.length,fallbackLatestAction:p[0]?.action,nextActionText:ie.text,children:[(0,N.jsx)(Lf,{readiness:ee}),(0,N.jsx)(kf,{value:d,onValueChange:e=>f(e),tabs:[{value:`evidence`,label:`Evidence`,tooltip:`Change history and validation results`,hidden:!O,contentClassName:`space-y-6`,content:(0,N.jsx)(N.Fragment,{children:(0,N.jsx)(wf,{examples:w,evolution:p,activeProposal:g,onSelect:_,evidence:r.evidence,viewerProposalId:g??``,showViewer:!!g,emptyState:(0,N.jsx)(F,{className:`rounded-2xl`,children:(0,N.jsx)(z,{className:`py-12`,children:(0,N.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3 text-center`,children:[(0,N.jsx)(ue,{className:`size-8 text-muted-foreground/40`}),(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This skill is being observed but has no reviewable evolution evidence yet.`})]})})})})})},{value:`invocations`,label:`Invocations`,tooltip:`Real usage and repaired misses only. Internal selftune traffic and legacy residue are excluded from this working set.`,badge:(0,N.jsx)(M,{variant:`secondary`,className:`ml-1.5 text-[10px]`,children:ne.length}),content:(0,N.jsx)(Cf,{invocations:ne,sessionMetadata:r?.session_metadata??[],callout:D>0?(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 px-4 py-3 text-sm text-muted-foreground`,children:[`Showing`,` `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:ne.length}),` `,`operational invocations.`,` `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:D}),` internal or legacy rows are tracked in Data Quality instead of being mixed into this working set.`]}):void 0})},{value:`missed`,label:`Missed Queries`,hidden:(w?.missed.length??0)===0,tooltip:`Queries that look like missed triggers from real usage.`,badge:(w?.missed.length??0)>0?(0,N.jsx)(M,{variant:`secondary`,className:`ml-1.5 text-[10px]`,children:w?.missed.length??0}):void 0,contentClassName:`pt-2`,content:(0,N.jsx)(Df,{rows:(w?.missed??[]).map((e,t)=>({id:`${e.session_id}:${e.timestamp??t}`,query:e.query_text,confidence:e.confidence,source:e.source??e.platform??null,createdAt:e.timestamp??``}))})},{value:`data-quality`,label:`Data Quality`,tooltip:`Evidence quality metrics and data hygiene`,content:(0,N.jsx)(Tf,{evidenceQuality:b,dataHygiene:C})}]})]})}function Bf({skills:e,heroSkill:t,aggregatePassRate:n,gradedCount:r,pendingProposals:i,isLoading:a,error:o,onRetry:s,renderHeroActions:c,renderCardActions:l}){let[u,d]=(0,A.useState)(`ALL`),[f,p]=(0,A.useState)(!0),m=(0,A.useMemo)(()=>{let t=e;return u!==`ALL`&&(t=t.filter(e=>e.status===u)),f?t.reduceRight((e,t)=>(e.push(t),e),[]):t},[u,e,f]),h=(0,A.useMemo)(()=>{let t={ALL:e.length,HEALTHY:0,WARNING:0,CRITICAL:0,UNGRADED:0};for(let n of e)n.status in t&&t[n.status]++;return t},[e]);return a?(0,N.jsx)(Vd,{}):o?(0,N.jsx)(Yd,{message:o,onRetry:s}):(0,N.jsxs)(`div`,{"data-parity-root":`skills-library`,className:`@container/main flex flex-1 animate-in fade-in flex-col gap-8 px-4 py-8 duration-500 lg:px-6`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h1`,{className:`font-headline text-4xl font-bold tracking-tight text-foreground`,children:`Skills Library`}),(0,N.jsx)(`p`,{className:`mt-2 max-w-2xl text-sm text-muted-foreground`,children:`Monitor and manage your evolving skill definitions across all scopes.`})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-12 gap-6`,children:[t?(0,N.jsx)(Hd,{skillName:t.skillName,skillScope:t.skillScope??null,platforms:t.platforms,passRate:t.passRate,totalChecks:t.totalChecks,uniqueSessions:t.uniqueSessions,status:t.status,latestEvolutionTimestamp:t.latestEvolutionTimestamp??null,renderActions:c}):(0,N.jsx)(qd,{}),(0,N.jsxs)(`div`,{className:`col-span-12 flex flex-col gap-6 lg:col-span-4`,children:[(0,N.jsx)(Ud,{aggregatePassRate:n,gradedCount:r}),(0,N.jsx)(Wd,{proposals:i})]})]}),(0,N.jsxs)(`div`,{className:`space-y-6`,children:[(0,N.jsx)(Kd,{filter:u,onFilterChange:d,counts:h,sortDesc:f,onSortToggle:()=>p(e=>!e)}),m.length>0?(0,N.jsx)(`div`,{className:`grid grid-cols-1 gap-6 md:grid-cols-2 xl:grid-cols-3`,children:m.map(e=>(0,N.jsx)(Gd,{skill:e,renderActions:l},e.name))}):(0,N.jsx)(Jd,{})]})]})}function Vf(e){return Kr(e.map(e=>({name:e.skill_name,scope:e.skill_scope,platforms:[],passRate:e.total_checks>0?e.pass_rate:null,checks:e.total_checks,status:Wr(e.pass_rate,e.total_checks),uniqueSessions:e.unique_sessions,triggeredCount:e.triggered_count,lastSeen:e.last_seen})))}function Hf(e){let t=e.filter(e=>e.total_checks>=5);if(t.length===0)return null;let n=t.reduce((e,t)=>e+t.total_checks,0),r=t.reduce((e,t)=>e+Math.round(t.pass_rate*t.total_checks),0);return n>0?r/n:null}function Uf(e,t){let n=[...t].filter(e=>e.skill_name).sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime());for(let t of n){let n=e.find(e=>e.skill_name===t.skill_name);if(n)return{skill:n,latestEvolution:t}}return e.length>0?{skill:[...e].sort((e,t)=>t.total_checks-e.total_checks)[0],latestEvolution:n[0]??null}:null}function Wf(e){let t=encodeURIComponent(e);return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(c,{to:`/skills/${t}`,className:`px-6 py-2 rounded-xl text-muted-foreground font-bold hover:bg-input transition-colors`,children:`Configure`}),(0,N.jsx)(c,{to:`/skills/${t}`,className:`px-8 py-2 bg-primary text-primary-foreground font-bold rounded-xl shadow-[0_4px_20px_rgba(79,242,255,0.2)] hover:shadow-[0_4px_25px_rgba(79,242,255,0.4)] transition-all`,children:`View Report`})]})}function Gf(e){let t=encodeURIComponent(e);return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(c,{to:`/skills/${t}`,className:`flex-1 py-2 text-xs font-bold text-muted-foreground bg-muted rounded-lg text-center hover:bg-input transition-colors`,children:`Configure`}),(0,N.jsx)(c,{to:`/skills/${t}`,className:`flex-1 py-2 text-xs font-bold text-muted-foreground bg-secondary rounded-lg text-center hover:bg-input hover:text-foreground transition-all`,children:`View Report`})]})}function Kf({overviewQuery:e}){let{data:t,isLoading:n,isError:r,error:i,refetch:a}=e,o=(0,A.useMemo)(()=>t?Vf(t.skills):[],[t]),s=(0,A.useMemo)(()=>t?Uf(t.skills,t.overview.evolution):null,[t]),c=(0,A.useMemo)(()=>s?{skillName:s.skill.skill_name,skillScope:s.skill.skill_scope,passRate:s.skill.total_checks>0?s.skill.pass_rate:null,totalChecks:s.skill.total_checks,uniqueSessions:s.skill.unique_sessions,status:Wr(s.skill.pass_rate,s.skill.total_checks),latestEvolutionTimestamp:s.latestEvolution?.timestamp??null}:null,[s]),l=(0,A.useMemo)(()=>t?t.overview.pending_proposals.map(e=>({id:e.proposal_id,skillName:e.skill_name??null,action:e.action})):[],[t]);return(0,N.jsx)(Bf,{skills:o,heroSkill:c,aggregatePassRate:t?Hf(t.skills):null,gradedCount:t?t.skills.filter(e=>e.total_checks>=5).length:0,pendingProposals:l,isLoading:n,error:r?i instanceof Error?i.message:`Failed to load skills library.`:null,onRetry:()=>{a()},renderHeroActions:Wf,renderCardActions:Gf})}var qf=6e4;function Jf(){return Cr({queryKey:[`doctor`],queryFn:zr,staleTime:5e3,refetchInterval:qf})}var Yf={pass:{color:`text-primary`,label:`Pass`,dotColor:`bg-primary`,dotGlow:`shadow-[0_0_8px_rgba(79,242,255,0.6)]`,animate:!0},warn:{color:`text-amber-400`,label:`Warn`,dotColor:`bg-amber-400`,dotGlow:``,animate:!1},fail:{color:`text-destructive`,label:`Fail`,dotColor:`bg-destructive`,dotGlow:`shadow-[0_0_8px_rgba(255,180,171,0.6)]`,animate:!1}},Xf={config:{label:`Configuration`,description:`selftune.json exists and contains valid agent_type and llm_mode`,icon:(0,N.jsx)(pe,{className:`size-4`})},log_session_telemetry:{label:`Session Telemetry Log`,description:`session_telemetry_log.jsonl exists and records parse correctly`,icon:(0,N.jsx)(ne,{className:`size-4`})},log_skill_usage:{label:`Skill Usage Log`,description:`skill_usage_log.jsonl exists and records parse correctly`,icon:(0,N.jsx)(ne,{className:`size-4`})},log_all_queries:{label:`Query Log`,description:`all_queries_log.jsonl exists and records parse correctly`,icon:(0,N.jsx)(ne,{className:`size-4`})},log_evolution_audit:{label:`Evolution Audit Log`,description:`evolution_audit_log.jsonl exists and records parse correctly`,icon:(0,N.jsx)(ne,{className:`size-4`})},hook_settings:{label:`Hook Installation`,description:`Claude Code settings.json has all required selftune hooks configured`,icon:(0,N.jsx)(Be,{className:`size-4`})},evolution_audit:{label:`Evolution Health`,description:`Evolution audit log is intact and records are well-formed`,icon:(0,N.jsx)(y,{className:`size-4`})},dashboard_freshness_mode:{label:`Dashboard Freshness`,description:`The current dashboard still invalidates live updates from JSONL log watchers. SQLite WAL live invalidation has not been cut over yet.`,icon:(0,N.jsx)(ie,{className:`size-4`})}};function Zf(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.workspace_root==`string`&&typeof t.git_sha==`string`&&typeof t.db_path==`string`&&typeof t.process_mode==`string`&&(t.watcher_mode===`wal`||t.watcher_mode===`jsonl`||t.watcher_mode===`none`)}function Qf({refreshKey:e}){let[t,n]=(0,A.useState)(null);if((0,A.useEffect)(()=>{fetch(`/api/health`).then(e=>e.json()).then(e=>{Zf(e)&&n(e)}).catch(()=>{})},[e]),!t)return null;let r=t.watcher_mode===`jsonl`?{className:`border-amber-400/25 bg-amber-400/10 text-amber-400`,label:`Legacy watcher path active`}:t.watcher_mode===`none`?{className:`border-muted-foreground/20 bg-muted/40 text-muted-foreground`,label:`Watcher inactive`}:{className:`border-primary/25 bg-primary/10 text-primary`,label:`Live invalidation active`};return(0,N.jsxs)(`section`,{className:`glass-panel rounded-2xl border border-border/15 p-6`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 md:flex-row md:items-end md:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-[10px] font-headline uppercase tracking-[0.2em] text-muted-foreground`,children:`Runtime Environment`}),(0,N.jsx)(`h2`,{className:`mt-1 font-headline text-xl font-semibold text-foreground`,children:`Active dashboard runtime`})]}),(0,N.jsx)(M,{variant:`outline`,className:r.className,children:r.label})]}),(0,N.jsxs)(`div`,{className:`mt-5 grid gap-3 md:grid-cols-2 xl:grid-cols-4`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-background/35 p-4`,children:[(0,N.jsx)(`p`,{className:`text-[10px] font-headline uppercase tracking-[0.18em] text-muted-foreground`,children:`Process mode`}),(0,N.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-foreground`,children:t.process_mode})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-background/35 p-4`,children:[(0,N.jsx)(`p`,{className:`text-[10px] font-headline uppercase tracking-[0.18em] text-muted-foreground`,children:`Watcher mode`}),(0,N.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-foreground`,children:t.watcher_mode})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-background/35 p-4`,children:[(0,N.jsx)(`p`,{className:`text-[10px] font-headline uppercase tracking-[0.18em] text-muted-foreground`,children:`SPA mode`}),(0,N.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-foreground`,children:t.spa_mode??`dist`})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-background/35 p-4`,children:[(0,N.jsx)(`p`,{className:`text-[10px] font-headline uppercase tracking-[0.18em] text-muted-foreground`,children:`Git SHA`}),(0,N.jsx)(`p`,{className:`mt-2 truncate font-mono text-sm text-foreground`,children:t.git_sha})]})]}),(0,N.jsxs)(`div`,{className:`mt-3 grid gap-3 md:grid-cols-2`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-background/35 p-4`,children:[(0,N.jsx)(`p`,{className:`text-[10px] font-headline uppercase tracking-[0.18em] text-muted-foreground`,children:`SPA build`}),(0,N.jsx)(`p`,{className:`mt-2 truncate font-mono text-sm text-foreground`,children:t.spa_build_id??t.version}),t.spa_proxy_url?(0,N.jsx)(`p`,{className:`mt-1 truncate text-xs text-muted-foreground`,children:t.spa_proxy_url}):null]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-background/35 p-4`,children:[(0,N.jsx)(`p`,{className:`text-[10px] font-headline uppercase tracking-[0.18em] text-muted-foreground`,children:`Database path`}),(0,N.jsx)(`p`,{className:`mt-2 truncate font-mono text-sm text-foreground`,children:t.db_path})]})]}),(0,N.jsxs)(`div`,{className:`mt-3 rounded-xl border border-border/10 bg-background/35 p-4`,children:[(0,N.jsx)(`p`,{className:`text-[10px] font-headline uppercase tracking-[0.18em] text-muted-foreground`,children:`Workspace root`}),(0,N.jsx)(`p`,{className:`mt-2 break-all font-mono text-sm text-foreground`,children:t.workspace_root})]})]})}function $f({check:e}){let t=Xf[e.name]??{label:e.name,description:``,icon:(0,N.jsx)(ie,{className:`size-4`})},n=Yf[e.status]??{color:`text-muted-foreground`,label:e.status,dotColor:`bg-muted-foreground`,dotGlow:``,animate:!1};return(0,N.jsxs)(`div`,{className:`group flex items-start gap-4 px-6 py-4 border-b border-border/10 last:border-b-0 hover:bg-secondary/40 transition-colors`,children:[(0,N.jsx)(`div`,{className:`mt-1.5 flex-shrink-0`,children:(0,N.jsx)(`span`,{className:`block size-1.5 rounded-full ${n.dotColor} ${n.dotGlow} ${n.animate?`animate-pulse`:``}`})}),(0,N.jsx)(`div`,{className:`flex-shrink-0 mt-0.5 text-muted-foreground`,children:t.icon}),(0,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`text-sm font-semibold text-foreground`,children:t.label}),t.description&&(0,N.jsx)(ad,{text:t.description})]}),(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5 leading-relaxed`,children:e.message||`No details`}),e.path&&(0,N.jsx)(`p`,{className:`text-[11px] text-muted-foreground/60 font-mono mt-1 truncate`,children:e.path})]}),(0,N.jsx)(`div`,{className:`flex-shrink-0`,children:(0,N.jsxs)(`div`,{className:`inline-flex items-center gap-2 px-2 py-1 rounded-md ${e.status===`pass`?`bg-primary/10`:e.status===`fail`?`bg-destructive/10`:`bg-amber-400/10`}`,children:[(0,N.jsx)(`span`,{className:`size-1.5 rounded-full ${n.dotColor} ${n.animate?`animate-pulse`:``}`}),(0,N.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-tighter font-headline ${n.color}`,children:n.label})]})})]})}function ep(){let{data:e,isPending:t,isError:n,error:r,refetch:i}=Jf(),[a,o]=(0,A.useState)(0);if(t)return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col gap-8 p-8`,children:[(0,N.jsx)(uf,{className:`h-12 w-64`}),(0,N.jsx)(uf,{className:`h-24 rounded-xl`}),(0,N.jsx)(uf,{className:`h-[400px] rounded-xl`})]});if(n)return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 py-16`,children:[(0,N.jsx)(_e,{className:`size-10 text-destructive`}),(0,N.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:r instanceof Error?r.message:`Unknown error`}),(0,N.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>i(),children:[(0,N.jsx)(oe,{className:`mr-2 size-3.5`}),`Retry`]})]});if(!e)return(0,N.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-16`,children:(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No diagnostics data available.`})});let{checks:s,summary:c,healthy:l=!1,timestamp:u}=e,d=s??[],f=c??{pass:0,warn:0,fail:0},p=f.pass+f.warn+f.fail,m=d.filter(e=>e.name===`config`),h=d.filter(e=>e.name.startsWith(`log_`)),g=d.filter(e=>e.name===`hook_settings`),_=d.filter(e=>e.name===`evolution_audit`),v=d.filter(e=>e.name===`dashboard_freshness_mode`),y=new Set([`config`,...h.map(e=>e.name),`hook_settings`,`evolution_audit`,`dashboard_freshness_mode`]),b=d.filter(e=>!y.has(e.name)),x=[{title:`Configuration`,checks:m},{title:`Log Files`,checks:h},{title:`Hooks`,checks:g},{title:`Evolution`,checks:_},{title:`Integrity`,checks:v},{title:`Other`,checks:b}].filter(e=>e.checks.length>0);return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col gap-8 p-8 max-w-5xl mx-auto w-full`,children:[(0,N.jsxs)(`section`,{className:`flex flex-col md:flex-row md:items-end justify-between gap-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h1`,{className:`font-headline text-4xl font-bold tracking-tight text-foreground`,children:`System Status`}),(0,N.jsx)(`p`,{className:`text-muted-foreground max-w-md mt-1`,children:`Diagnostics and health checks for selftune infrastructure.`})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,N.jsxs)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest font-headline`,children:[`Last checked `,u?W(u):`—`]}),(0,N.jsx)(P,{"aria-label":`Refresh status`,variant:`ghost`,size:`sm`,onClick:()=>{o(e=>e+1),i()},className:`shrink-0`,children:(0,N.jsx)(oe,{className:`size-3.5`})})]})]}),(0,N.jsxs)(`div`,{className:`glass-panel rounded-2xl border border-border/15 p-6 flex items-center justify-between overflow-hidden relative`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-8`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col`,children:[(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-[0.2em] font-headline mb-1`,children:`Overall`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l?(0,N.jsx)(`span`,{className:`size-3 rounded-full bg-primary animate-pulse shadow-[0_0_12px_rgba(79,242,255,0.6)]`}):(0,N.jsx)(`span`,{className:`size-3 rounded-full bg-destructive shadow-[0_0_12px_rgba(255,180,171,0.6)]`}),(0,N.jsx)(`span`,{className:`font-headline text-2xl font-bold text-foreground`,children:l?`Healthy`:`Unhealthy`})]})]}),(0,N.jsx)(`div`,{className:`h-10 w-px bg-border/20`}),(0,N.jsxs)(`div`,{className:`flex flex-col`,children:[(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-[0.2em] font-headline mb-1`,children:`Passed`}),(0,N.jsx)(`span`,{className:`font-headline text-2xl font-bold text-primary`,children:f.pass})]}),(0,N.jsxs)(`div`,{className:`flex flex-col`,children:[(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-[0.2em] font-headline mb-1`,children:`Warnings`}),(0,N.jsx)(`span`,{className:`font-headline text-2xl font-bold ${f.warn>0?`text-amber-400`:`text-foreground`}`,children:f.warn})]}),(0,N.jsxs)(`div`,{className:`flex flex-col`,children:[(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-[0.2em] font-headline mb-1`,children:`Failed`}),(0,N.jsx)(`span`,{className:`font-headline text-2xl font-bold ${f.fail>0?`text-destructive`:`text-foreground`}`,children:f.fail})]})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,N.jsxs)(`div`,{className:`text-right`,children:[(0,N.jsxs)(`p`,{className:`text-xs font-bold text-foreground font-headline`,children:[p,` Checks`]}),(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:f.pass===p?`All checks passing`:`${f.fail+f.warn} issue${f.fail+f.warn===1?``:`s`} detected`})]}),(0,N.jsx)(`div`,{className:`size-12 rounded-full flex items-center justify-center border-4 border-primary/20 border-t-primary`,children:(0,N.jsx)(k,{className:`size-5 text-primary`})})]}),(0,N.jsx)(`div`,{className:`absolute -right-20 -bottom-20 w-64 h-64 bg-primary/5 blur-3xl rounded-full pointer-events-none`})]}),(0,N.jsx)(Qf,{refreshKey:a}),(0,N.jsx)(`div`,{className:`bg-muted rounded-2xl border border-border/15 overflow-hidden`,children:x.map((e,t)=>(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`px-6 py-3 bg-secondary/60 border-b border-border/15`,children:[(0,N.jsx)(`span`,{className:`text-[10px] font-bold text-muted-foreground uppercase tracking-[0.2em] font-headline`,children:e.title}),(0,N.jsx)(M,{variant:`outline`,className:`ml-3 text-[10px] px-1.5 py-0 border-border/40 text-muted-foreground`,children:e.checks.length})]}),e.checks.map((e,t)=>(0,N.jsx)($f,{check:e},`${e.name}-${t}`)),t<x.length-1&&(0,N.jsx)(`div`,{className:`border-b border-border/25`})]},e.title))})]})}var tp={host:`local`,plan:`oss`,features:{analytics:!0,registry:!1,signals:!1,proposals:!1,billing:!1,teamAdmin:!1,runtimeStatus:!0},discoverable:{registry:!0,signals:!0,proposals:!0,billing:!1}};function np(e){return{version:e.version,summary:{totalSkills:e.skills.length,avgPassRate30d:e.skills.length?e.skills.reduce((e,t)=>e+t.pass_rate,0)/e.skills.length:null,unmatchedCount30d:e.overview.unmatched_queries.length,sessionsCount30d:e.overview.counts.sessions,pendingCount:e.overview.pending_proposals.length,evidenceCount:e.overview.counts.evidence},autonomy:{level:e.autonomy_status.level,summary:e.autonomy_status.summary,attentionRequired:e.autonomy_status.attention_required,skillsObserved:e.autonomy_status.skills_observed,pendingReviews:e.autonomy_status.pending_reviews,lastRunAt:e.autonomy_status.last_run},skillCards:e.skills.map(e=>({name:e.skill_name,scope:e.skill_scope,platforms:e.skill_scope?[e.skill_scope]:[],passRate:e.pass_rate,checks:e.total_checks,status:e.pass_rate>=.8?`HEALTHY`:e.pass_rate>=.6?`WARNING`:e.total_checks>0?`CRITICAL`:`UNKNOWN`,hasEvidence:e.has_evidence,uniqueSessions:e.unique_sessions,lastSeen:e.last_seen})),watchlist:e.trust_watchlist.map(e=>({skillName:e.skill_name,bucket:e.bucket,lastSeen:e.last_seen,passRate:e.pass_rate,checks:e.checks})),attention:e.attention_queue.map(e=>({skillName:e.skill_name,severity:e.severity,title:e.category.replace(/_/g,` `),body:e.reason})),decisions:e.recent_decisions.map(e=>({skillName:e.skill_name,kind:e.kind,timestamp:e.timestamp,summary:e.summary})),activity:e.overview.recent_activity.map(e=>({id:`${e.session_id}:${e.timestamp}`,type:e.triggered?`evolution`:`unmatched`,skillName:e.skill_name,timestamp:e.timestamp,title:e.skill_name,summary:e.query})),jobs:[],signals:null}}function rp(e){return{items:e.skills.map(e=>({name:e.skill_name,platforms:e.skill_scope?[e.skill_scope]:[],status:e.pass_rate>=.8?`HEALTHY`:e.pass_rate>=.6?`WARNING`:e.total_checks>0?`CRITICAL`:`UNKNOWN`,passRate:e.pass_rate,totalChecks:e.total_checks,uniqueSessions:e.unique_sessions,evidenceCount:e.has_evidence?1:0,lastSeen:e.last_seen}))}}function ip(e){return{summary:{activeSkills:e.summary.active_skills,totalChecks30d:e.summary.total_checks_30d,totalEvolutions:e.summary.total_evolutions,avgImprovement:e.summary.avg_improvement},passRateTrend:e.pass_rate_trend.map(e=>({date:e.date,passRate:e.pass_rate,checkVolume:e.total_checks})),skillRankings:e.skill_rankings.map((e,t)=>({skillName:e.skill_name,passRate:e.pass_rate,totalChecks:e.total_checks,rank:t+1})),dailyActivity:e.daily_activity.map(e=>({date:e.date,checks:e.checks})),evolutionImpact:e.evolution_impact.map(e=>({skillName:e.skill_name,passRateBefore:e.pass_rate_before,passRateAfter:e.pass_rate_after,improvement:e.pass_rate_after-e.pass_rate_before}))}}async function ap(){let e=await fetch(`/api/health`);if(!e.ok)throw Error(`API error: ${e.status} ${e.statusText}`);let t=await e.json();return{workspaceRoot:t.workspace_root,gitSha:t.git_sha,dbPath:t.db_path,processMode:t.process_mode,watcherMode:t.watcher_mode}}async function op(e){let t=await fetch(`/api/actions/watchlist`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({skills:e})});if(!t.ok)throw Error(`API error: ${t.status} ${t.statusText}`);let n=await t.json();return Array.isArray(n.watched_skills)?n.watched_skills:e}var sp={useSession(){return{status:`authenticated`,user:{name:`Admin Node`,subtitle:`Active`}}},api:{async fetchOverview(){return np(await Fr())},async fetchSkills(){return rp(await Fr())},async fetchAnalytics(){return ip(await Rr())},fetchRuntimeHealth:ap},links:{upgrade:`https://selftune.dev/pricing`,docs:`https://docs.selftune.dev`,cloudDashboard:`https://selftune.dev`},actions:{openUpgrade(){typeof window<`u`&&window.open(`https://selftune.dev/pricing`,`_blank`,`noopener,noreferrer`)},updateOverviewWatchlist:op}},cp=new or({defaultOptions:{queries:{refetchOnWindowFocus:!0,gcTime:300*1e3}}});function lp({href:e,className:t,children:n,onClick:r}){return(0,N.jsx)(c,{to:e,className:t,onClick:r,children:n})}function up({routeId:e}){let t=Zt(`local`,tp).find(t=>t.id===e);return!t||t.access!==`locked`||!t.lockedTitle||!t.lockedBody?null:(0,N.jsx)(Vt,{eyebrow:`Cloud feature`,title:t.lockedTitle,description:t.lockedBody,highlights:t.lockedHighlights,primaryAction:{href:t.lockedPrimaryCtaHref??`https://selftune.dev/pricing`,label:t.lockedPrimaryCtaLabel??`View cloud plans`},secondaryAction:t.lockedSecondaryCtaHref&&t.lockedSecondaryCtaLabel?{href:t.lockedSecondaryCtaHref,label:t.lockedSecondaryCtaLabel}:void 0,note:`Keep using the local dashboard for offline diagnostics and day-to-day health checks. Cloud adds the shared coordination layer.`})}function dp(e,t){let n=$t(e,t);if(n?.id===`skills`&&n.matchKind===`detail`)return{title:decodeURIComponent(e.slice(8)),icon:(0,N.jsx)(xe,{className:`size-4 text-primary`}),badge:n.badge,backHref:n.backHref,backLabel:n.backLabel};if(n){let e=n.icon;return{title:n.title,icon:(0,N.jsx)(e,{className:`size-4 text-primary`}),badge:n.badge,backHref:n.backHref,backLabel:n.backLabel}}return{title:`Dashboard`,icon:void 0,badge:`Overview`,backHref:null,backLabel:null}}function fp(){Ur();let[e,t]=(0,A.useState)(`ALL`),n=Hr(),{data:i}=n,a=l(),s=f(),c=Zt(`local`,tp),u=c.map(e=>{let t=e.icon;return{href:e.path,label:e.label,icon:(0,N.jsx)(t,{className:`size-4`}),tooltip:e.tooltip,isActive:Qt(a.pathname,e),isLocked:e.access===`locked`}}),p=[...c.map(e=>{let t=e.icon;return{id:`page:${e.id}`,group:`Pages`,label:e.label,meta:e.tooltip,leading:(0,N.jsx)(t,{className:`size-4`}),trailing:e.access===`locked`?`Locked`:void 0,onSelect:()=>s(e.path)}}),...(i?.skills??[]).map(e=>{let t=Wr(e.pass_rate,e.total_checks),n=t===`HEALTHY`?`bg-primary`:t===`WARNING`?`bg-primary-accent`:t===`CRITICAL`?`bg-destructive`:`bg-muted-foreground`;return{id:`skill:${e.skill_name}`,group:`Skills`,label:e.skill_name,meta:`Skill report`,keywords:[e.skill_scope??``,t],leading:(0,N.jsx)(`span`,{className:`size-2 rounded-full ${n}`}),trailing:Gr(e.total_checks>0?e.pass_rate:null),onSelect:()=>s(`/skills/${encodeURIComponent(e.skill_name)}`)}})];return(0,N.jsx)(Rt,{brand:{href:`/`,name:`Selftune`,caption:`Skill Evolution Engine`,footerLabel:i?.version?`selftune v${i.version}`:`selftune`},navItems:u,renderLink:lp,headerMeta:dp(a.pathname,c),searchItems:p,headerUser:{name:`Admin Node`,subtitle:`Active`},contentClassName:null,overlay:(0,N.jsx)(Er,{}),children:(0,N.jsxs)(r,{children:[(0,N.jsx)(o,{path:`/`,element:(0,N.jsx)(hf,{search:``,statusFilter:e,onStatusFilterChange:t,overviewQuery:n})}),(0,N.jsx)(o,{path:`/skills`,element:(0,N.jsx)(Kf,{overviewQuery:n})}),(0,N.jsx)(o,{path:`/skills-library`,element:(0,N.jsx)(d,{replace:!0,to:`/skills`})}),(0,N.jsx)(o,{path:`/analytics`,element:(0,N.jsx)(bf,{})}),(0,N.jsx)(o,{path:`/skills/:name`,element:(0,N.jsx)(zf,{})}),(0,N.jsx)(o,{path:`/registry`,element:(0,N.jsx)(up,{routeId:`registry`})}),(0,N.jsx)(o,{path:`/signals`,element:(0,N.jsx)(up,{routeId:`signals`})}),(0,N.jsx)(o,{path:`/community`,element:(0,N.jsx)(d,{replace:!0,to:`/signals`})}),(0,N.jsx)(o,{path:`/proposals`,element:(0,N.jsx)(up,{routeId:`proposals`})}),(0,N.jsx)(o,{path:`/status`,element:(0,N.jsx)(ep,{})})]})})}function pp(){return(0,N.jsx)(lr,{client:cp,children:(0,N.jsx)(p,{children:(0,N.jsxs)(Nr,{defaultTheme:`dark`,children:[(0,N.jsxs)(Gt,{adapter:sp,capabilities:tp,children:[(0,N.jsx)(fp,{}),(0,N.jsx)(Ar,{})]}),!1]})})})}(0,mt.createRoot)(document.getElementById(`root`)).render((0,N.jsx)(A.StrictMode,{children:(0,N.jsx)(pp,{})}));
|
|
14
|
+
`},i)),a}function Rl(e,t){return e&&`run`in e?async function(n,r){let i=Ll(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Ll(n,{file:r,...e||t})}}function zl(e){if(e)throw e}var Bl=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function Vl(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Hl(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?Ul(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function Ul(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var Wl={basename:Gl,dirname:Kl,extname:ql,join:Jl,sep:`/`};function Gl(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Zl(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Kl(e){if(Zl(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function ql(e){Zl(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Jl(...e){let t=-1,n;for(;++t<e.length;)Zl(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Yl(n)}function Yl(e){Zl(e);let t=e.codePointAt(0)===47,n=Xl(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Xl(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Zl(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Ql={cwd:$l};function $l(){return`/`}function eu(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function tu(e){if(typeof e==`string`)e=new URL(e);else if(!eu(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return nu(e)}function nu(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var ru=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],iu=class{constructor(e){let t;t=e?eu(e)?{path:e}:typeof e==`string`||cu(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Ql.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<ru.length;){let e=ru[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)ru.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?Wl.basename(this.path):void 0}set basename(e){ou(e,`basename`),au(e,`basename`),this.path=Wl.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?Wl.dirname(this.path):void 0}set dirname(e){su(this.basename,`dirname`),this.path=Wl.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?Wl.extname(this.path):void 0}set extname(e){if(au(e,`extname`),su(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=Wl.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){eu(e)&&(e=tu(e)),ou(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?Wl.basename(this.path,this.extname):void 0}set stem(e){ou(e,`stem`),au(e,`stem`),this.path=Wl.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new Y(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function au(e,t){if(e&&e.includes(Wl.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+Wl.sep+"`")}function ou(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function su(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function cu(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var lu=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),uu=t(Bl(),1),du={}.hasOwnProperty,fu=new class e extends lu{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Hl()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,uu.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(hu(`data`,this.frozen),this.namespace[e]=t,this):du.call(this.namespace,e)&&this.namespace[e]||void 0:e?(hu(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=vu(e),n=this.parser||this.Parser;return pu(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),pu(`process`,this.parser||this.Parser),mu(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=vu(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);bu(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),pu(`processSync`,this.parser||this.Parser),mu(`processSync`,this.compiler||this.Compiler),this.process(e,r),_u(`processSync`,`process`,t),n;function r(e,r){t=!0,zl(e),n=r}}run(e,t,n){gu(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=vu(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),_u(`runSync`,`run`,n),r;function i(e,t){zl(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=vu(t),r=this.compiler||this.Compiler;return mu(`stringify`,r),gu(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(hu(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,uu.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];Vl(o)&&Vl(r)&&(r=(0,uu.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function pu(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function mu(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function hu(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function gu(e){if(!Vl(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function _u(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function vu(e){return yu(e)?e:new iu(e)}function yu(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function bu(e){return typeof e==`string`||xu(e)}function xu(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Su=[],Cu={allowDangerousHtml:!0},wu=/^(https?|ircs?|mailto|xmpp)$/i,Tu=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function Eu(e){let t=Du(e),n=Ou(e);return ku(t.runSync(t.parse(n),n),e)}function Du(e){let t=e.rehypePlugins||Su,n=e.remarkPlugins||Su,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Cu}:Cu;return fu().use(wc).use(n).use(Rl,r).use(t)}function Ou(e){let t=e.children||``,n=new iu;return typeof t==`string`?n.value=t:``+t,n}function ku(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Au;for(let e of Tu)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return Ol(e,l),ra(e,{Fragment:N.Fragment,components:i,ignoreInvalidStyle:!0,jsx:N.jsx,jsxs:N.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in Ta)if(Object.hasOwn(Ta,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Ta[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function Au(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||wu.test(e.slice(0,t))?e:``}var ju={created:(0,N.jsx)(D,{className:`size-3.5`}),validated:(0,N.jsx)(y,{className:`size-3.5`}),deployed:(0,N.jsx)(x,{className:`size-3.5`}),rejected:(0,N.jsx)(ge,{className:`size-3.5`}),rolled_back:(0,N.jsx)(at,{className:`size-3.5`})},Mu={created:`outline`,validated:`secondary`,deployed:`default`,rejected:`destructive`,rolled_back:`destructive`};function Nu(e){let t=e.match(/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/);if(!t)return{meta:{},body:e};let n={};for(let e of t[1].split(`
|
|
15
|
+
`)){let t=e.indexOf(`:`);if(t>0){let r=e.slice(0,t).trim(),i=e.slice(t+1).trim();r&&i&&(n[r]=i)}}return{meta:n,body:t[2]}}function Pu({meta:e}){let t=Object.entries(e);return t.length===0?null:(0,N.jsx)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:t.map(([e,t])=>(0,N.jsxs)(`div`,{className:`contents`,children:[(0,N.jsx)(`span`,{className:`font-medium text-muted-foreground capitalize`,children:e}),(0,N.jsx)(`span`,{className:`text-foreground truncate`,children:t})]},e))})}function Fu({label:e,text:t,variant:n}){let{meta:r,body:i}=Nu(t),a=Object.keys(r).length>0;return(0,N.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(ne,{className:`size-3.5 text-muted-foreground`}),(0,N.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:e}),n===`proposed`&&(0,N.jsx)(M,{variant:`secondary`,className:`text-[10px]`,children:`New`})]}),a&&(0,N.jsx)(`div`,{className:`rounded-md border bg-muted/30 p-3`,children:(0,N.jsx)(Pu,{meta:r})}),(0,N.jsx)(`div`,{className:`skill-markdown rounded-md border bg-card p-4`,children:(0,N.jsx)(Eu,{children:i})})]})}function Iu(e,t){if(typeof t==`boolean`)return t?(0,N.jsx)(he,{className:`size-3.5 text-emerald-500 inline`}):(0,N.jsx)(ge,{className:`size-3.5 text-red-500 inline`});if(typeof t==`number`){if(e.includes(`rate`)||e.includes(`change`)||t>=-1&&t<=1&&e!==`count`){let n=(t*100).toFixed(1);return(0,N.jsxs)(`span`,{className:`font-mono`,children:[t>0&&e.includes(`change`)?`+`:``,n,`%`]})}return(0,N.jsx)(`span`,{className:`font-mono`,children:t})}return t==null?(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:`--`}):typeof t==`string`?(0,N.jsx)(`span`,{children:t}):Array.isArray(t)?t.length===0?(0,N.jsx)(`span`,{className:`text-muted-foreground italic`,children:`none`}):(0,N.jsxs)(`span`,{className:`font-mono`,children:[t.length,` entries`]}):typeof t==`object`?(0,N.jsx)(`span`,{className:`font-mono`,children:`1 entry`}):(0,N.jsx)(`span`,{children:String(t)})}function Lu(e){if(typeof e!=`object`||!e)return null;let t=e,n=t.after_pass??t.after??t.triggered??t.result,r=t.passed??t.matched;return typeof n==`boolean`?n:typeof r==`boolean`?r:null}function Ru(e,t){if(typeof t!=`object`||!t)return`${e}:${JSON.stringify(t)}`;let n=t,r=typeof n.entry==`object`&&n.entry!==null?n.entry:null,i=typeof r?.query==`string`?r.query:typeof n.query==`string`?n.query:typeof n.prompt==`string`?n.prompt:typeof n.input==`string`?n.input:null;if(i)return`${e}:${i}`;let a=typeof n.action==`string`?n.action:null,o=typeof n.timestamp==`string`?n.timestamp:null;return a&&o?`${e}:${a}:${o}`:`${e}:${JSON.stringify(n)}`}function zu({entry:e}){let t=e.entry,n=t?.query??e.query??e.prompt??e.input??e.text,r=t?.should_trigger??e.should_trigger,i=t?.invocation_type??e.invocation_type,a=e.before_pass??e.before??e.original_triggered??e.baseline,o=e.after_pass??e.after??e.triggered??e.result,s=Lu(e);return(0,N.jsxs)(`div`,{className:`flex items-start gap-2 text-xs py-1.5 border-b border-border/50 last:border-0`,children:[s===null?(0,N.jsx)(D,{className:`size-3.5 text-muted-foreground shrink-0 mt-0.5`}):s?(0,N.jsx)(he,{className:`size-3.5 text-emerald-500 shrink-0 mt-0.5`}):(0,N.jsx)(ge,{className:`size-3.5 text-red-500 shrink-0 mt-0.5`}),(0,N.jsx)(`span`,{className:`flex-1 min-w-0 line-clamp-2`,children:n?String(n):JSON.stringify(e)}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[typeof a==`boolean`&&typeof o==`boolean`&&(0,N.jsxs)(`span`,{className:`text-[10px] text-muted-foreground font-mono`,children:[a?`pass`:`fail`,` → `,o?`pass`:`fail`]}),r!==void 0&&(0,N.jsxs)(M,{variant:`secondary`,className:`text-[9px]`,children:[`expect: `,String(r)]}),i!=null&&(0,N.jsx)(M,{variant:`secondary`,className:`text-[9px]`,children:String(i)})]})]})}function Bu({validation:e}){let{improved:t,before_pass_rate:n,after_pass_rate:r,net_change:i,regressions:a,new_passes:o,per_entry_results:s,validation_mode:c,validation_agent:l,validation_fixture_id:u,validation_fallback_reason:d,...f}=e,p=Array.isArray(a)?a:[],m=Array.isArray(o)?o:[],h=Array.isArray(s)?s:[],g=typeof c==`string`?c:null,_=typeof l==`string`?l:null,v=typeof u==`string`?u:null,y=typeof d==`string`?d:null;return(0,N.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-3 space-y-3`,children:[(0,N.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[`Validation Results`,(0,N.jsx)(`span`,{className:`font-normal text-muted-foreground/60 ml-1.5`,children:`— Before/after comparison from eval tests`})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[t!==void 0&&(0,N.jsx)(M,{variant:t?`default`:`destructive`,className:`text-[10px]`,children:t?`Improved`:`Regressed`}),g&&(0,N.jsx)(M,{variant:`outline`,className:`text-[10px] capitalize`,children:g.replace(/_/g,` `)}),_&&(0,N.jsx)(M,{variant:`secondary`,className:`text-[10px]`,children:_}),v&&(0,N.jsxs)(M,{variant:`secondary`,className:`text-[10px] font-mono`,title:v,children:[`fixture #`,v.slice(0,8)]}),typeof n==`number`&&typeof r==`number`&&(0,N.jsxs)(`span`,{className:`text-xs font-mono text-muted-foreground`,children:[(n*100).toFixed(1),`% → `,(r*100).toFixed(1),`%`]}),typeof i==`number`&&(0,N.jsxs)(`span`,{className:`text-xs font-mono font-semibold ${i>0?`text-emerald-600 dark:text-emerald-400`:`text-red-500`}`,children:[i>0?`+`:``,(i*100).toFixed(1),`%`]})]}),y&&(0,N.jsxs)(`div`,{className:`rounded border border-amber-300/60 bg-amber-50 px-2.5 py-2 text-[11px] text-amber-900 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-200`,children:[`Replay fallback: `,y]}),m.length>0&&(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`p`,{className:`text-[11px] font-medium text-emerald-600 dark:text-emerald-400 mb-1`,children:[`New Passes (`,m.length,`)`]}),(0,N.jsx)(`div`,{className:`rounded border bg-card p-2`,children:m.map(e=>(0,N.jsx)(zu,{entry:typeof e==`object`&&e?e:{value:e}},Ru(`new-pass`,e)))})]}),p.length>0&&(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`p`,{className:`text-[11px] font-medium text-red-500 mb-1`,children:[`Regressions (`,p.length,`)`]}),(0,N.jsx)(`div`,{className:`rounded border border-red-200 dark:border-red-900/50 bg-card p-2`,children:p.map(e=>(0,N.jsx)(zu,{entry:typeof e==`object`&&e?e:{value:e}},Ru(`regression`,e)))})]}),h.length>0&&(0,N.jsx)(Vu,{entries:h}),Object.keys(f).length>0&&(0,N.jsx)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:Object.entries(f).map(([e,t])=>(0,N.jsxs)(`div`,{className:`contents`,children:[(0,N.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:e}),(0,N.jsx)(`span`,{className:`text-foreground`,children:Iu(e,t)})]},e))})]})}function Vu({entries:e}){let[t,n]=(0,A.useState)(!1),r=e.filter(e=>Lu(e)===!0).length,i=t?e:e.slice(0,5);return(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,N.jsxs)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:[`Individual Test Cases (`,r,`/`,e.length,` passed)`]}),e.length>5&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>n(!t),className:`text-[10px] text-primary hover:underline`,children:t?`Show less`:`Show all ${e.length}`})]}),(0,N.jsx)(`div`,{className:`h-1.5 rounded-full bg-muted overflow-hidden mb-2`,children:(0,N.jsx)(`div`,{className:`h-full rounded-full bg-emerald-500 transition-all`,style:{width:`${e.length>0?r/e.length*100:0}%`}})}),(0,N.jsx)(`div`,{className:`rounded border bg-card p-2 max-h-[300px] overflow-y-auto`,children:i.map(e=>(0,N.jsx)(zu,{entry:typeof e==`object`&&e?e:{value:e}},Ru(`per-entry`,e)))})]})}function Hu(e){if(!e.validation)return null;let t=e.validation.after_pass_rate;return typeof t==`number`?t:null}function Uu({prev:e,curr:t}){if(e===null||t===null)return null;let n=t-e;if(n===0)return null;let r=(n*100).toFixed(1),i=n>0;return(0,N.jsxs)(`span`,{className:`text-[10px] font-mono font-semibold ${i?`text-emerald-600 dark:text-emerald-400`:`text-red-500`}`,children:[i?`+`:``,r,`% vs previous`]})}function Wu({evalSet:e}){let[t,n]=(0,A.useState)(!1),r=e.filter(e=>(e.passed??e.result)===!0).length;return(0,N.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-3 space-y-2`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`flex items-center gap-1.5 w-full text-left`,children:[t?(0,N.jsx)(te,{className:`size-3.5 text-muted-foreground shrink-0`}):(0,N.jsx)(E,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,N.jsx)(g,{className:`size-3.5 text-muted-foreground`}),(0,N.jsxs)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:[`Eval Set (`,r,`/`,e.length,` passed)`]})]}),t&&(0,N.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>{let t=e.query??e.prompt??e.input,n=e.expected??e.should_trigger,r=e.passed??e.result;return(0,N.jsxs)(`div`,{className:`flex items-start gap-2 text-xs py-1 border-b border-border/50 last:border-0`,children:[typeof r==`boolean`?r?(0,N.jsx)(he,{className:`size-3.5 text-emerald-500 shrink-0 mt-0.5`}):(0,N.jsx)(ge,{className:`size-3.5 text-red-500 shrink-0 mt-0.5`}):(0,N.jsx)(D,{className:`size-3.5 text-muted-foreground shrink-0 mt-0.5`}),(0,N.jsx)(`span`,{className:`flex-1 min-w-0 line-clamp-2`,children:String(t??JSON.stringify(e))}),n!==void 0&&(0,N.jsxs)(M,{variant:`secondary`,className:`text-[9px] shrink-0`,children:[`expect: `,String(n)]})]},Ru(`eval-set`,e))})})]})}function Gu({entry:e,roundLabel:t,roundStatus:n,prevPassRate:r,currPassRate:i}){let a=n!==`single`;return(0,N.jsxs)(F,{className:n===`final`?`border-primary/50 shadow-sm`:void 0,children:[(0,N.jsx)(I,{className:`pb-3`,children:(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsxs)(L,{className:`text-sm flex items-center gap-2`,children:[(0,N.jsx)(st,{className:`size-4 text-muted-foreground`}),`Evidence: `,e.target,a&&t&&(0,N.jsx)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:t}),n===`final`&&(0,N.jsx)(M,{variant:`default`,className:`text-[10px]`,children:`Final`})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a&&(0,N.jsx)(Uu,{prev:r,curr:i}),(0,N.jsx)(M,{variant:`secondary`,className:`text-[10px]`,children:e.stage}),e.confidence!==null&&(0,N.jsxs)(M,{variant:e.confidence>=.8?`default`:e.confidence>=.5?`secondary`:`destructive`,className:`text-[10px] font-mono`,children:[Gr(e.confidence),` confidence`]}),(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:W(e.timestamp)})]})]})}),(0,N.jsxs)(z,{className:`space-y-4`,children:[e.rationale&&(0,N.jsxs)(`div`,{className:`rounded-md border-l-2 border-primary/40 bg-primary/5 px-3 py-2`,children:[(0,N.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground mb-1`,children:`Rationale`}),(0,N.jsx)(`p`,{className:`text-sm leading-relaxed`,children:e.rationale})]}),e.details&&(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:e.details}),(e.original_text||e.proposed_text)&&(0,N.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[e.original_text&&(0,N.jsx)(Fu,{label:`Original`,text:e.original_text,variant:`original`}),e.proposed_text&&(0,N.jsx)(Fu,{label:`Proposed`,text:e.proposed_text,variant:`proposed`})]}),e.eval_set&&e.eval_set.length>0&&(0,N.jsx)(Wu,{evalSet:e.eval_set}),e.validation&&Object.keys(e.validation).length>0&&(0,N.jsx)(Bu,{validation:e.validation})]})]})}function Ku({entry:e,roundLabel:t,onExpand:n}){let r=Hu(e),i=e.validation?.improved;return(0,N.jsxs)(`button`,{type:`button`,onClick:n,className:`flex items-center gap-3 w-full rounded-lg border border-dashed px-4 py-3 text-left hover:bg-accent/50 transition-colors`,children:[(0,N.jsx)(E,{className:`size-4 text-muted-foreground shrink-0`}),(0,N.jsx)(st,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,N.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.target}),(0,N.jsx)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:t}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto shrink-0`,children:[r!==null&&(0,N.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:[(r*100).toFixed(1),`% pass rate`]}),typeof i==`boolean`&&(0,N.jsx)(M,{variant:i?`default`:`destructive`,className:`text-[9px]`,children:i?`Improved`:`Regressed`}),(0,N.jsx)(M,{variant:`secondary`,className:`text-[10px]`,children:e.stage}),(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:W(e.timestamp)})]})]})}function qu({proposalId:e,evolution:t,evidence:n}){let r=(0,A.useMemo)(()=>t.filter(t=>t.proposal_id===e).sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime()),[t,e]),i=(0,A.useMemo)(()=>n.filter(t=>t.proposal_id===e).sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime()),[n,e]),[a,o]=(0,A.useState)(new Set),s=e=>{o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},c=(0,A.useMemo)(()=>{for(let e=r.length-1;e>=0;e--)if(r[e].eval_snapshot)return r[e].eval_snapshot;return null},[r]),{proposalEntries:l,validationsByTarget:u}=(0,A.useMemo)(()=>{let e=[],t=new Map;for(let n of i)if(n.stage!==`validated`)e.push(n);else{let e=n.target;t.has(e)||t.set(e,[]),t.get(e).push(n)}return{proposalEntries:e,validationsByTarget:t}},[i]);return(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg border border-primary/20 bg-primary/5 px-3.5 py-2.5`,children:[(0,N.jsx)(Re,{className:`size-4 text-primary/60 shrink-0 mt-0.5`}),(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:`This view shows the complete evidence trail for a skill evolution proposal — how the skill was changed, the eval test results before and after, and whether the change improved performance.`})]}),(0,N.jsxs)(F,{children:[(0,N.jsx)(I,{className:`pb-3`,children:(0,N.jsxs)(L,{className:`text-sm flex items-center gap-2`,children:[(0,N.jsx)(`span`,{children:`Proposal Journey`}),(0,N.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[`#`,e.slice(0,12)]})]})}),(0,N.jsxs)(z,{className:`space-y-3`,children:[(0,N.jsx)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:r.map((e,t)=>(0,N.jsxs)(`div`,{className:`contents`,children:[t>0&&(0,N.jsx)(ve,{className:`size-3 text-muted-foreground/50 shrink-0`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 bg-card`,children:[ju[e.action],(0,N.jsx)(M,{variant:Mu[e.action]??`secondary`,className:`text-[10px] capitalize`,children:e.action.replace(`_`,` `)}),(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:W(e.timestamp)})]})]},`${e.action}-${e.timestamp}`))}),c&&(0,N.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border bg-muted/20 px-3 py-2`,children:[typeof c.net_change==`number`&&(0,N.jsxs)(`div`,{className:`flex items-center gap-1`,children:[c.net_change>0?(0,N.jsx)(Te,{className:`size-3.5 text-emerald-500`}):(0,N.jsx)(lt,{className:`size-3.5 text-red-500`}),(0,N.jsxs)(`span`,{className:`text-sm font-semibold font-mono ${c.net_change>0?`text-emerald-600 dark:text-emerald-400`:`text-red-500`}`,children:[c.net_change>0?`+`:``,Math.round(c.net_change*100),`%`]})]}),typeof c.before_pass_rate==`number`&&typeof c.after_pass_rate==`number`&&(0,N.jsxs)(`span`,{className:`text-xs text-muted-foreground font-mono`,children:[Math.round(c.before_pass_rate*100),`% →`,` `,Math.round(c.after_pass_rate*100),`%`]}),c.improved!==void 0&&(0,N.jsx)(M,{variant:c.improved?`default`:`destructive`,className:`text-[10px]`,children:c.improved?`Improved`:`Regressed`})]}),r.length>0&&r[r.length-1].details&&(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:r[r.length-1].details})]})]}),l.map(e=>(0,N.jsx)(Gu,{entry:e,roundLabel:null,roundStatus:`single`,prevPassRate:null,currPassRate:null},`proposal-${e.target}-${e.timestamp}`)),Array.from(u.entries()).map(([e,t])=>{let n=t.length>1;return(0,N.jsx)(`div`,{className:`space-y-2`,children:t.map((r,i)=>{let o=i===t.length-1,c=n?`Round ${i+1} of ${t.length}`:null,l=i>0?Hu(t[i-1]):null,u=Hu(r),d=`${e}-${r.timestamp}`,f=n?o?`final`:`intermediate`:`single`;return f===`intermediate`&&!a.has(d)?(0,N.jsx)(Ku,{entry:r,roundLabel:c,onExpand:()=>s(d)},d):f===`intermediate`&&a.has(d)?(0,N.jsxs)(`div`,{className:`space-y-1`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>s(d),className:`flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors px-1`,children:[(0,N.jsx)(te,{className:`size-3`}),`Collapse `,c]}),(0,N.jsx)(Gu,{entry:r,roundLabel:c,roundStatus:f,prevPassRate:l,currPassRate:u})]},d):(0,N.jsx)(Gu,{entry:r,roundLabel:c,roundStatus:f,prevPassRate:l,currPassRate:u},d)})},e)}),i.length===0&&(0,N.jsx)(`div`,{className:`flex items-center justify-center rounded-lg border border-dashed py-8`,children:(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No evidence entries for this proposal`})})]})}var Ju={created:(0,N.jsx)(D,{className:`size-3.5`}),validated:(0,N.jsx)(y,{className:`size-3.5`}),deployed:(0,N.jsx)(x,{className:`size-3.5`}),rejected:(0,N.jsx)(ge,{className:`size-3.5`}),rolled_back:(0,N.jsx)(at,{className:`size-3.5`})},Yu={created:`bg-blue-500`,validated:`bg-amber-500`,deployed:`bg-emerald-500`,rejected:`bg-red-500`,rolled_back:`bg-red-400`},Xu={created:`ring-blue-500/30`,validated:`ring-amber-500/30`,deployed:`ring-emerald-500/30`,rejected:`ring-red-500/30`,rolled_back:`ring-red-400/30`},Zu={created:`bg-blue-500/30`,validated:`bg-amber-500/30`,deployed:`bg-emerald-500/30`,rejected:`bg-red-500/30`,rolled_back:`bg-red-400/30`};function Qu(e){let t=new Map;for(let n of e){let e=t.get(n.proposal_id)??[];e.push(n),t.set(n.proposal_id,e)}for(let e of t.values())e.sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime());return Array.from(t.entries()).sort((e,t)=>{let n=e[1][e[1].length-1],r=t[1][t[1].length-1];return new Date(r.timestamp).getTime()-new Date(n.timestamp).getTime()})}function $u(e){return e[e.length-1].action}function ed(e){for(let t=e.length-1;t>=0;t--)if(e[t].eval_snapshot)return e[t].eval_snapshot;return null}function td({snapshot:e}){let t=e.net_change;if(t==null)return null;let n=Math.round(t*100),r=n>0;return(0,N.jsxs)(`span`,{className:j(`inline-flex items-center gap-0.5 text-[10px] font-mono font-medium`,r?`text-emerald-600 dark:text-emerald-400`:`text-red-500`),children:[r?(0,N.jsx)(Te,{className:`size-2.5`}):(0,N.jsx)(lt,{className:`size-2.5`}),r?`+`:``,n,`%`]})}var nd=[{action:`created`,label:`Created`,desc:`Proposal generated from session data`},{action:`validated`,label:`Validated`,desc:`Eval tests run, awaiting deployment`},{action:`deployed`,label:`Deployed`,desc:`Accepted and applied to skill file`},{action:`rejected`,label:`Rejected`,desc:`Failed validation criteria`},{action:`rolled_back`,label:`Rolled Back`,desc:`Reverted after deployment`}];function rd(){let[e,t]=(0,A.useState)(!1);return(0,N.jsxs)(`div`,{className:`px-2 pb-2`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>t(!e),className:`flex items-center gap-1 text-[10px] text-muted-foreground/70 hover:text-muted-foreground transition-colors w-full`,children:[e?(0,N.jsx)(te,{className:`size-3`}):(0,N.jsx)(E,{className:`size-3`}),`Lifecycle stages`]}),e&&(0,N.jsx)(`div`,{className:`mt-1.5 space-y-1.5 rounded-md border bg-muted/30 p-2`,children:nd.map(e=>(0,N.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,N.jsx)(`div`,{className:j(`size-2 rounded-full mt-1 shrink-0`,Yu[e.action])}),(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsx)(`span`,{className:`text-[10px] font-medium`,children:e.label}),(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground/70 leading-tight`,children:e.desc})]})]},e.action))})]})}function id({entries:e,selectedProposalId:t,onSelect:n}){let r=Qu(e);return r.length===0?(0,N.jsx)(`div`,{className:`flex items-center justify-center rounded-lg border border-dashed py-6 px-3`,children:(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No evolution history yet`})}):(0,N.jsxs)(`div`,{className:`flex flex-col gap-0`,children:[(0,N.jsx)(`h2`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider px-2 pb-2 sticky top-0 z-10 bg-background`,children:`Evolution`}),(0,N.jsx)(rd,{}),(0,N.jsx)(`nav`,{className:`flex flex-col`,children:r.map(([e,i],a)=>{let o=$u(i),s=t===e,c=i[i.length-1],l=Yu[o]??`bg-muted-foreground`,u=Xu[o]??`ring-muted-foreground/30`,d=Zu[o]??`bg-border`,f=a===r.length-1,p=ed(i);return(0,N.jsxs)(`div`,{className:`relative flex gap-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,N.jsx)(`div`,{className:j(`flex items-center justify-center size-7 rounded-full ring-2 text-white shrink-0 z-10`,l,u),children:Ju[o]??(0,N.jsx)(D,{className:`size-3.5`})}),!f&&(0,N.jsx)(`div`,{className:j(`w-0.5 flex-1 min-h-[16px]`,d)})]}),(0,N.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:j(`flex-1 min-w-0 rounded-md px-2.5 py-2 text-left transition-all mb-1`,`hover:bg-accent/50`,s?`bg-primary/5 ring-1 ring-primary/20`:``),children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(M,{variant:o===`deployed`?`default`:o===`rejected`||o===`rolled_back`?`destructive`:`secondary`,className:`text-[10px] capitalize`,children:o.replace(`_`,` `)}),(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:W(c.timestamp)})]}),p&&(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1`,children:[(0,N.jsx)(td,{snapshot:p}),p.before_pass_rate!==void 0&&p.after_pass_rate!==void 0&&(0,N.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/60 font-mono`,children:[Math.round(p.before_pass_rate*100),`→`,Math.round(p.after_pass_rate*100),`%`]})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1`,children:[(0,N.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground/70`,children:[`#`,e.slice(0,8)]}),i.length>1&&(0,N.jsx)(`div`,{className:`flex gap-0.5 ml-auto`,children:i.map((e,t)=>(0,N.jsx)(`div`,{className:j(`size-1.5 rounded-full`,Yu[e.action]??`bg-muted-foreground`)},`${e.action}-${t}`))})]}),c.details&&(0,N.jsx)(`p`,{className:`text-[11px] text-muted-foreground/80 line-clamp-2 mt-1 leading-snug`,children:c.details})]})]},e)})})]})}function ad({text:e}){return(0,N.jsxs)(Ot,{children:[(0,N.jsx)(kt,{className:`inline-flex items-center text-muted-foreground/50 hover:text-muted-foreground transition-colors cursor-help`,onClick:e=>e.preventDefault(),children:(0,N.jsx)(Re,{className:`size-3`})}),(0,N.jsx)(At,{side:`top`,className:`max-w-[220px]`,children:e})]})}function od(e){switch(e){case`repaired_contextual_miss`:return{label:`repaired miss`,variant:`destructive`};case`repaired_trigger`:return{label:`repaired trigger`,variant:`secondary`};case`legacy_materialized`:return{label:`legacy row`,variant:`outline`};default:return null}}function sd(e){switch(e){case`previously_missed`:return{label:`previously missed`,variant:`secondary`};default:return null}}function cd({row:e}){let t=e.workspace_path?e.workspace_path.split(`/`).slice(-2).join(`/`):null,n=od(e.observation_kind),r=sd(e.historical_context);return(0,N.jsxs)(xt,{className:e.triggered?``:`bg-destructive/5`,children:[(0,N.jsx)(V,{className:`max-w-[420px] truncate py-2 text-[12px]`,title:e.query_text||void 0,children:e.query_text||(0,N.jsx)(`span`,{className:`italic text-muted-foreground/40`,children:`No prompt recorded`})}),(0,N.jsx)(V,{className:`py-2`,children:(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e.triggered?(0,N.jsx)(M,{variant:`outline`,className:`border-green-600/30 text-[10px] font-normal text-green-600`,children:`triggered`}):(0,N.jsx)(M,{variant:`destructive`,className:`text-[10px] font-normal`,children:`missed`}),n&&(0,N.jsx)(M,{variant:n.variant,className:`text-[10px] font-normal`,children:n.label}),r&&(0,N.jsx)(M,{variant:r.variant,className:`text-[10px] font-normal`,children:r.label})]})}),(0,N.jsx)(V,{className:`py-2 font-mono text-[11px] tabular-nums text-muted-foreground`,children:e.confidence==null?`Not recorded`:`${Math.round(e.confidence*100)}%`}),(0,N.jsx)(V,{className:`py-2`,children:e.invocation_mode?(0,N.jsx)(M,{variant:`secondary`,className:`text-[10px] font-normal`,children:e.invocation_mode}):(0,N.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Unknown mode`})}),(0,N.jsx)(V,{className:`py-2 text-[11px] text-muted-foreground`,children:e.prompt_kind??`Unclassified`}),(0,N.jsx)(V,{className:`py-2 text-[11px] text-muted-foreground`,children:e.source??`No data`}),(0,N.jsx)(V,{className:`py-2 text-[11px] text-muted-foreground`,children:e.platform??`No data`}),(0,N.jsx)(V,{className:`py-2 font-mono text-[11px] text-muted-foreground`,title:e.workspace_path??void 0,children:t??`No data`}),(0,N.jsx)(V,{className:`py-2`,children:(0,N.jsx)(M,{variant:e.query_origin===`inline_query`?`outline`:e.query_origin===`matched_prompt`?`secondary`:`destructive`,className:`text-[10px] font-normal`,children:e.query_origin})})]})}function ld({rows:e,emptyMessage:t}){return e.length===0?(0,N.jsx)(`div`,{className:`flex items-center justify-center py-12 text-sm text-muted-foreground`,children:t}):(0,N.jsx)(`div`,{className:`themed-scroll max-h-[340px] overflow-auto`,children:(0,N.jsxs)(vt,{children:[(0,N.jsx)(yt,{children:(0,N.jsxs)(xt,{className:`sticky top-0 z-10 bg-muted/70 backdrop-blur hover:bg-muted/70`,children:[(0,N.jsx)(B,{className:`h-8 font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Prompt`}),(0,N.jsx)(B,{className:`h-8 w-[80px] font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Status`}),(0,N.jsx)(B,{className:`h-8 w-[70px] font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Confidence`}),(0,N.jsx)(B,{className:`h-8 w-[80px] font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Mode`}),(0,N.jsx)(B,{className:`h-8 w-[80px] font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Kind`}),(0,N.jsx)(B,{className:`h-8 w-[70px] font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Source`}),(0,N.jsx)(B,{className:`h-8 w-[70px] font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Platform`}),(0,N.jsx)(B,{className:`h-8 w-[100px] font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Workspace`}),(0,N.jsx)(B,{className:`h-8 w-[100px] font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Origin`})]})}),(0,N.jsx)(bt,{children:e.map((e,t)=>(0,N.jsx)(cd,{row:e},`${e.session_id}-${t}`))})]})})}function ud({label:e,value:t,warn:n}){let r=t==null?null:Math.round(t*100);return(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,N.jsx)(`span`,{className:`w-40 shrink-0 font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:e}),(0,N.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-muted`,children:r!=null&&(0,N.jsx)(`div`,{className:`h-full rounded-full transition-all ${n?`bg-destructive`:`bg-primary`}`,style:{width:`${Math.min(r,100)}%`}})}),(0,N.jsx)(`span`,{className:`w-10 text-right font-mono text-xs tabular-nums ${n?`text-destructive`:`text-muted-foreground`}`,children:r==null?`No data`:`${r}%`})]})}function dd({title:e,data:t}){if(!t||t.length===0)return null;let n=e=>{switch(e){case`repaired_contextual_miss`:return`repaired contextual miss`;case`repaired_trigger`:return`repaired trigger`;case`legacy_materialized`:return`legacy materialized`;default:return e}},r=t.map(e=>[n(e.source??e.kind??`(unknown)`),e.count]).sort(([,e],[,t])=>t-e),i=r.reduce((e,[,t])=>e+t,0);return(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h4`,{className:`mb-2 font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:e}),(0,N.jsxs)(vt,{children:[(0,N.jsx)(yt,{children:(0,N.jsxs)(xt,{className:`hover:bg-transparent`,children:[(0,N.jsx)(B,{className:`h-7 font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Value`}),(0,N.jsx)(B,{className:`h-7 w-[80px] text-right font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Count`}),(0,N.jsx)(B,{className:`h-7 w-[80px] text-right font-headline text-[10px] uppercase tracking-[0.15em]`,children:`Rate`})]})}),(0,N.jsx)(bt,{children:r.map(([e,t])=>(0,N.jsxs)(xt,{children:[(0,N.jsx)(V,{className:`py-2 text-[11px]`,children:e}),(0,N.jsx)(V,{className:`py-2 text-right font-mono text-[11px]`,children:t}),(0,N.jsx)(V,{className:`py-2 text-right font-mono text-[11px] text-muted-foreground`,children:i>0?`${Math.round(t/i*100)}%`:`0%`})]},e))})]})]})}function fd({nextAction:e,latestDecision:t}){let n=e.variant===`destructive`?`border-destructive/25`:e.variant===`default`?`border-primary/20`:`border-border/15`;return(0,N.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 @4xl/main:grid-cols-12`,children:[(0,N.jsx)(F,{className:`rounded-xl border bg-muted/35 shadow-none ${t?`@4xl/main:col-span-8`:`@4xl/main:col-span-12`} ${n}`,children:(0,N.jsxs)(z,{className:`flex items-start gap-3 px-4 py-4`,children:[(0,N.jsx)(`div`,{className:`shrink-0 pt-0.5`,children:e.icon}),(0,N.jsxs)(`div`,{className:`flex-1`,children:[(0,N.jsx)(`h3`,{className:`mb-1 font-headline text-[10px] uppercase tracking-[0.18em] text-muted-foreground`,children:`Next Best Action`}),(0,N.jsx)(`p`,{className:`text-[15px] font-medium leading-6 text-foreground`,children:e.text})]}),(0,N.jsx)(M,{variant:e.variant,className:`shrink-0 self-start text-[10px]`,children:e.actionLabel})]})}),t&&(0,N.jsx)(F,{className:`rounded-xl border border-border/10 bg-muted/20 @4xl/main:col-span-4`,children:(0,N.jsxs)(z,{className:`flex h-full items-start gap-3 px-4 py-4`,children:[(0,N.jsx)(ce,{className:`mt-0.5 size-4 shrink-0 text-primary/80`}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(`h3`,{className:`mb-1 font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Latest Decision`}),(0,N.jsx)(`p`,{className:`truncate text-sm font-medium leading-6`,children:t.action}),t.timestamp&&(0,N.jsx)(`p`,{className:`mt-0.5 font-mono text-[10px] text-muted-foreground`,children:W(t.timestamp)})]}),(0,N.jsxs)(M,{variant:`outline`,className:`shrink-0 self-start text-[9px]`,children:[t.evolutionCount,` evolution`,t.evolutionCount===1?``:`s`]})]})})]})}function pd({checks:e,sessions:t,promptLinkRate:n}){return`Selftune watched ${e} skill checks across ${t} sessions.${n==null?``:` It could link ${Gr(n)} of those checks back to prompts.`}`}function md({missRate:e,missedTriggers:t,systemLikeRate:n}){return(t??0)>0&&e!=null?`It found ${t} likely misses (${Gr(e)} miss rate), which means people asked for this skill and it probably should have triggered.`:(n??0)>.05?`Routing looks mostly stable, but some records appear system-generated, so selftune is being cautious about making strong claims.`:`Routing looks consistent in the current sample, with no strong signs that this skill is missing obvious requests.`}function hd({trustState:e,latestAction:t,nextActionText:n}){switch(e){case`validated`:return`Selftune found a candidate that looks promising, but it has not been deployed yet. ${n}`;case`deployed`:return`A change has already been deployed for this skill. Selftune is now watching for regressions in real use.`;case`rolled_back`:return`A previous change was rolled back, so the live skill is back on the safer version while selftune keeps observing.`;case`watch`:return`Selftune sees enough signal to keep a close eye on this skill, but not enough to blindly change it. ${n}`;case`observed`:return`Selftune is still learning how people use this skill before making stronger recommendations.`;case`low_sample`:return`There is not enough evidence yet to trust a big change here. Selftune is still collecting examples.`;default:return t?`The latest automated decision for this skill was ${t}. ${n}`:n}}function gd({title:e,icon:t,body:n}){return(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 p-4`,children:[(0,N.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,N.jsx)(`div`,{className:`text-primary/80`,children:t}),(0,N.jsx)(`h3`,{className:`font-headline text-[10px] uppercase tracking-[0.18em] text-muted-foreground`,children:e})]}),(0,N.jsx)(`p`,{className:`text-sm leading-6 text-foreground/90`,children:n})]})}function _d({trustState:e,coverage:t,evidenceQuality:n,routingQuality:r,evolutionState:i,dataHygiene:a,fallbackChecks:o,fallbackSessions:s,nextActionText:c,onOpenGuide:l}){let u=t?.checks??o,d=t?.sessions??s,f=a?.raw_checks??u,p=a?.internal_prompt_rows??0,m=a?.legacy_rows??0,h=a?.repaired_rows??0,g=Math.max(f-u,0)>0||m>0||h>0;return(0,N.jsxs)(F,{className:`rounded-xl border border-border/10 bg-card/95`,children:[(0,N.jsx)(I,{className:`gap-2 px-4 py-4`,children:(0,N.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,N.jsxs)(`div`,{className:`space-y-1`,children:[(0,N.jsx)(L,{className:`text-base`,children:`How selftune is improving this skill`}),(0,N.jsx)(R,{children:`Read this first if you want the plain-English version before diving into the evidence below.`})]}),l&&(0,N.jsx)(P,{variant:`outline`,size:`sm`,onClick:l,children:`How to read this page`})]})}),(0,N.jsxs)(z,{className:`space-y-4 px-4 pb-4 pt-0`,children:[g&&(0,N.jsxs)(`div`,{className:`rounded-xl border border-primary/10 bg-primary/5 px-4 py-3 text-sm text-muted-foreground`,children:[(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:`Trust note:`}),` This summary is based on `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:u}),` operational checks from real usage.`,p>0&&(0,N.jsxs)(N.Fragment,{children:[` `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:p}),` internal selftune eval or optimizer prompts are excluded from trust scoring.`]}),m>0&&(0,N.jsxs)(N.Fragment,{children:[` `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:m}),` legacy rows stay in history only.`]}),h>0&&(0,N.jsxs)(N.Fragment,{children:[` `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:h}),` repaired misses come from transcript replay rather than first-party trigger events.`]})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 @4xl/main:grid-cols-3`,children:[(0,N.jsx)(gd,{title:`What selftune saw`,icon:(0,N.jsx)(le,{className:`size-4`}),body:pd({checks:u,sessions:d,promptLinkRate:n?.prompt_link_rate})}),(0,N.jsx)(gd,{title:`Why it acted`,icon:(0,N.jsx)(C,{className:`size-4`}),body:md({missRate:r?.miss_rate,missedTriggers:r?.missed_triggers,systemLikeRate:n?.system_like_rate})}),(0,N.jsx)(gd,{title:`What happened next`,icon:(0,N.jsx)(ce,{className:`size-4`}),body:hd({trustState:e,latestAction:i?.latest_action,nextActionText:c})})]}),(0,N.jsx)(`div`,{className:`rounded-xl border border-border/10 bg-muted/15 px-4 py-3 text-sm text-muted-foreground`,children:`If a proposal is rejected or still pending, your live skill has not changed yet. Selftune only earns trust by testing changes before deployment.`})]})]})}function vd({coverage:e,evidenceQuality:t,routingQuality:n,evolutionState:r,fallbackChecks:i,fallbackSessions:a,fallbackEvidenceRows:o,fallbackEvolutionRows:s,fallbackLatestAction:c}){let l=(r?.evolution_rows??s)>0;return(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`mb-2 font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Trust Signals`}),(0,N.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 @xl/main:grid-cols-2 @5xl/main:grid-cols-4`,children:[(0,N.jsx)(F,{className:`rounded-xl border border-border/10 bg-muted/20 transition-colors hover:border-border/20 @container/card`,children:(0,N.jsxs)(I,{className:`gap-2 px-4 py-3`,children:[(0,N.jsxs)(R,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(le,{className:`size-3.5`}),(0,N.jsx)(`span`,{className:`font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Coverage`})]}),(0,N.jsx)(L,{className:`text-[32px] font-semibold leading-none tabular-nums text-foreground`,children:e?.checks??i}),(0,N.jsx)(_t,{children:(0,N.jsxs)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:[e?.sessions??a,` sessions /`,` `,e?.workspaces??`No data`,` dirs`]})})]})}),(0,N.jsx)(F,{className:`rounded-xl border border-border/10 bg-muted/20 transition-colors hover:border-border/20 @container/card`,children:(0,N.jsxs)(I,{className:`gap-2 px-4 py-3`,children:[(0,N.jsxs)(R,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(C,{className:`size-3.5`}),(0,N.jsx)(`span`,{className:`font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Evidence Quality`}),(0,N.jsx)(ad,{text:`How well prompts are linked to invocations. Higher prompt-link rate = more trustworthy data.`})]}),(0,N.jsx)(L,{className:`text-[32px] font-semibold leading-none tabular-nums text-foreground`,children:t?.prompt_link_rate==null?`No data`:Gr(t.prompt_link_rate)}),(0,N.jsx)(_t,{children:(0,N.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5`,children:[(0,N.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`inline:`,` `,t?.inline_query_rate==null?`No data`:Gr(t.inline_query_rate)]}),(t?.system_like_rate??0)>.05&&(0,N.jsxs)(M,{variant:`destructive`,className:`text-[9px]`,children:[Gr(t?.system_like_rate??0),` system-like`]})]})})]})}),(0,N.jsx)(F,{className:`rounded-xl border border-border/10 bg-muted/20 transition-colors hover:border-border/20 @container/card`,children:(0,N.jsxs)(I,{className:`gap-2 px-4 py-3`,children:[(0,N.jsxs)(R,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(de,{className:`size-3.5`}),(0,N.jsx)(`span`,{className:`font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Routing`}),(0,N.jsx)(ad,{text:`Routing accuracy: average confidence when triggering, and miss rate`})]}),(0,N.jsx)(L,{className:`text-[32px] font-semibold leading-none tabular-nums text-foreground`,children:n?.avg_confidence==null?`No data`:Gr(n.avg_confidence)}),(0,N.jsx)(_t,{children:(0,N.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5`,children:[(0,N.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`miss:`,` `,n?.miss_rate==null?`No data`:Gr(n.miss_rate)]}),(0,N.jsxs)(`span`,{className:`text-[10px] tabular-nums text-muted-foreground`,children:[n?.missed_triggers??`No data`,` missed`]})]})})]})}),(0,N.jsx)(F,{className:`rounded-xl border border-border/10 bg-muted/20 transition-colors hover:border-border/20 @container/card`,children:(0,N.jsxs)(I,{className:`gap-2 px-4 py-3`,children:[(0,N.jsxs)(R,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(ce,{className:`size-3.5`}),(0,N.jsx)(`span`,{className:`font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Evolution`})]}),l?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(L,{className:`text-sm font-medium leading-6`,children:r?.latest_action??c??`No data`}),(0,N.jsx)(_t,{children:(0,N.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5`,children:[(0,N.jsxs)(`span`,{className:`text-[10px] tabular-nums text-muted-foreground`,children:[r?.evidence_rows??o,` evidence`]}),(0,N.jsxs)(`span`,{className:`text-[10px] tabular-nums text-muted-foreground`,children:[r?.evolution_rows??s,` evolution`]}),r?.latest_timestamp&&(0,N.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:W(r.latest_timestamp)})]})})]}):(0,N.jsx)(L,{className:`text-sm font-normal text-muted-foreground`,children:`No evolution yet`})]})})]})]})}function yd({examples:e}){return!e||e.good.length===0&&e.missed.length===0&&e.noisy.length===0?null:(0,N.jsxs)(F,{className:`rounded-xl border border-border/10 bg-card/90`,children:[(0,N.jsx)(I,{className:`px-4 pb-2 pt-4`,children:(0,N.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(L,{className:`font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Prompt Evidence`}),(0,N.jsx)(R,{children:`Representative real usage first. Internal selftune traffic is separated so it does not masquerade as normal skill use.`})]}),(0,N.jsxs)(`div`,{className:`hidden items-center gap-2 text-[10px] text-muted-foreground @3xl/main:flex`,children:[(0,N.jsxs)(`span`,{children:[e.good.length,` successful`]}),(0,N.jsx)(`span`,{className:`text-border`,children:`|`}),(0,N.jsxs)(`span`,{children:[e.missed.length,` missed`]}),(0,N.jsx)(`span`,{className:`text-border`,children:`|`}),(0,N.jsxs)(`span`,{children:[e.noisy.length,` internal/polluted`]})]})]})}),(0,N.jsx)(z,{className:`px-4 pb-4 pt-0`,children:(0,N.jsxs)(St,{defaultValue:`good`,children:[(0,N.jsxs)(wt,{variant:`line`,className:`min-h-0 rounded-xl border border-border/10 bg-muted/20 px-1.5 py-1`,children:[(0,N.jsxs)(Tt,{value:`good`,className:`rounded-lg px-3 data-active:bg-background/70 data-active:text-foreground`,children:[`Successful Triggers`,(0,N.jsx)(M,{variant:`outline`,className:`ml-1.5 text-[10px]`,children:e.good.length})]}),(0,N.jsxs)(Tt,{value:`missed`,className:`rounded-lg px-3 data-active:bg-background/70 data-active:text-foreground`,children:[`Missed Real Usage`,(0,N.jsx)(M,{variant:e.missed.length>0?`destructive`:`outline`,className:`ml-1.5 text-[10px]`,children:e.missed.length})]}),(0,N.jsxs)(Tt,{value:`noisy`,className:`rounded-lg px-3 data-active:bg-background/70 data-active:text-foreground`,children:[`Internal / Polluted`,(0,N.jsx)(M,{variant:e.noisy.length>0?`destructive`:`outline`,className:`ml-1.5 text-[10px]`,children:e.noisy.length})]})]}),(0,N.jsx)(Et,{value:`good`,className:`mt-2`,children:(0,N.jsx)(ld,{rows:e.good,emptyMessage:`No successful trigger samples yet.`})}),(0,N.jsx)(Et,{value:`missed`,className:`mt-2`,children:(0,N.jsx)(ld,{rows:e.missed,emptyMessage:`No missed real-usage samples detected.`})}),(0,N.jsx)(Et,{value:`noisy`,className:`mt-2`,children:(0,N.jsx)(ld,{rows:e.noisy,emptyMessage:`No internal or polluted samples detected.`})})]})})]})}function bd({evidenceQuality:e,dataHygiene:t}){return(0,N.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 @5xl/main:grid-cols-2 @5xl/main:items-start`,children:[(0,N.jsxs)(F,{className:`rounded-2xl border border-border/15 bg-card`,children:[(0,N.jsx)(I,{children:(0,N.jsxs)(L,{className:`flex items-center gap-2 font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:[(0,N.jsx)(Xe,{className:`size-4`}),`Evidence Quality Rates`]})}),(0,N.jsxs)(z,{className:`space-y-3 p-4`,children:[(0,N.jsx)(ud,{label:`Prompt-linked`,value:e?.prompt_link_rate}),(0,N.jsx)(ud,{label:`Inline query`,value:e?.inline_query_rate}),(0,N.jsx)(ud,{label:`User prompt`,value:e?.user_prompt_rate}),(0,N.jsx)(ud,{label:`Meta prompt`,value:e?.meta_prompt_rate}),(0,N.jsx)(ud,{label:`No prompt`,value:e?.no_prompt_rate}),(0,N.jsx)(ud,{label:`System-like`,value:e?.system_like_rate,warn:(e?.system_like_rate??0)>.05}),(0,N.jsx)(`div`,{className:`mt-3 border-t border-border/40 pt-3`}),(0,N.jsx)(ud,{label:`Invocation mode`,value:e?.invocation_mode_coverage}),(0,N.jsx)(ud,{label:`Confidence`,value:e?.confidence_coverage}),(0,N.jsx)(ud,{label:`Source`,value:e?.source_coverage}),(0,N.jsx)(ud,{label:`Scope`,value:e?.scope_coverage})]})]}),t&&(0,N.jsxs)(F,{className:`rounded-2xl border border-border/15 bg-card`,children:[(0,N.jsx)(I,{children:(0,N.jsxs)(L,{className:`flex items-center gap-2 font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:[(0,N.jsx)(v,{className:`size-4`}),`Data Hygiene`]})}),(0,N.jsxs)(z,{className:`space-y-6 p-4`,children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/15 bg-muted/30 p-3`,children:[(0,N.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Raw vs Operational`}),(0,N.jsxs)(`div`,{className:`mt-2 flex items-end gap-2`,children:[(0,N.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-foreground`,children:t.operational_checks}),(0,N.jsxs)(`div`,{className:`pb-0.5 text-xs text-muted-foreground`,children:[`of `,t.raw_checks,` checks`]})]}),(0,N.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:`Operational checks exclude internal selftune eval and optimizer traffic.`})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/15 bg-muted/30 p-3`,children:[(0,N.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Historical Residue`}),(0,N.jsxs)(`div`,{className:`mt-2 flex items-end gap-2`,children:[(0,N.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-foreground`,children:t.legacy_rows}),(0,N.jsxs)(`div`,{className:`pb-0.5 text-xs text-muted-foreground`,children:[`legacy / `,t.repaired_rows,` repaired`]})]}),(0,N.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:`Legacy rows are older materialized history. Repaired rows are transcript-based reconstructions.`})]})]}),t.naming_variants&&t.naming_variants.length>1&&(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h4`,{className:`mb-2 font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Naming Variants`}),(0,N.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.naming_variants.map(e=>(0,N.jsx)(M,{variant:`outline`,className:`font-mono text-[10px]`,children:e},e))}),(0,N.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:`Multiple naming variants may indicate inconsistent skill registration.`})]}),(0,N.jsx)(dd,{title:`Source Breakdown`,data:t.source_breakdown}),(0,N.jsx)(dd,{title:`Prompt Kind Breakdown`,data:t.prompt_kind_breakdown}),(0,N.jsx)(dd,{title:`Observation Breakdown`,data:t.observation_breakdown})]})]})]})}function xd({sessionId:e,meta:t,invocations:n,defaultExpanded:r}){let[i,a]=(0,A.useState)(r),o=t?.started_at??n[0]?.timestamp,s=n.reduce((e,t)=>{let n=t.invocation_mode??`unknown`;return e[n]=(e[n]??0)+1,e},{}),c=e=>{let n=t?.agent_cli?.replace(/_/g,` `),r=t?.platform?.replace(/_/g,` `);return e.agent_type&&e.agent_type!==`main`?{label:e.agent_type,hint:n?`${n} subagent`:`subagent invocation`}:n?{label:n,hint:e.agent_type===`main`?`main agent invocation`:`session agent that invoked the skill`}:r?{label:r,hint:e.agent_type===`main`?`main agent invocation`:`session platform`}:e.agent_type?{label:e.agent_type,hint:`recorded subagent type`}:{label:`No data`,hint:`invoker was not captured in this record`}};return(0,N.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-slate-200 transition-colors dark:border-slate-800`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-slate-50 active:bg-slate-100 dark:hover:bg-slate-800/40 dark:active:bg-slate-800/60`,onClick:()=>a(!i),children:[(0,N.jsx)(E,{className:`size-3.5 shrink-0 text-slate-400 transition-transform duration-150 dark:text-slate-500 ${i?`rotate-90`:``}`}),(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsxs)(`span`,{className:`text-sm font-medium text-slate-900 dark:text-white`,children:[n.length,` invocation`,n.length===1?``:`s`]}),(0,N.jsx)(`span`,{className:`text-xs text-slate-500 dark:text-slate-400`,children:o?W(o):``})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[t?.model&&(0,N.jsx)(M,{variant:`secondary`,className:`text-[10px] font-normal`,children:t.model}),t?.workspace_path&&(0,N.jsx)(`span`,{className:`font-mono text-[11px] text-slate-500 dark:text-slate-400`,title:t.workspace_path,children:t.workspace_path.split(`/`).slice(-2).join(`/`)})]})]}),!i&&(0,N.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:Object.entries(s).map(([e,t])=>(0,N.jsxs)(M,{variant:`outline`,className:`gap-1 text-[10px] font-normal`,children:[e,` `,(0,N.jsx)(`span`,{className:`text-slate-400 dark:text-slate-500`,children:t})]},e))}),(0,N.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-slate-300 dark:text-slate-600`,children:e.substring(0,8)})]}),i&&(0,N.jsx)(`div`,{className:`overflow-x-auto border-t border-slate-200 dark:border-slate-800`,children:(0,N.jsxs)(vt,{children:[(0,N.jsx)(yt,{children:(0,N.jsxs)(xt,{className:`bg-slate-50 hover:bg-slate-50 dark:bg-slate-800/40 dark:hover:bg-slate-800/40`,children:[(0,N.jsxs)(B,{className:`h-8 text-[10px] font-semibold uppercase tracking-[0.15em]`,children:[`Prompt `,(0,N.jsx)(ad,{text:`The user prompt that led to this skill being invoked`})]}),(0,N.jsxs)(B,{className:`h-8 w-[90px] text-[10px] font-semibold uppercase tracking-[0.15em]`,children:[`Mode`,` `,(0,N.jsx)(ad,{text:`explicit = user typed /skillname; implicit = user mentioned skill by name; inferred = agent chose skill autonomously`})]}),(0,N.jsxs)(B,{className:`h-8 w-[70px] text-[10px] font-semibold uppercase tracking-[0.15em]`,children:[`Confidence`,` `,(0,N.jsx)(ad,{text:`Model's confidence score (0-100%) when routing this prompt to the skill`})]}),(0,N.jsxs)(B,{className:`h-8 w-[110px] text-[10px] font-semibold uppercase tracking-[0.15em]`,children:[`Invoker`,` `,(0,N.jsx)(ad,{text:`Who invoked the skill. Prefers subagent type when present, otherwise falls back to the session agent or platform.`})]}),(0,N.jsx)(B,{className:`h-8 w-[120px] text-[10px] font-semibold uppercase tracking-[0.15em]`,children:`Evidence`}),(0,N.jsx)(B,{className:`h-8 w-[70px] text-right text-[10px] font-semibold uppercase tracking-[0.15em]`,children:`Time`})]})}),(0,N.jsx)(bt,{children:n.map((e,t)=>(0,N.jsxs)(xt,{className:e.triggered?``:`bg-red-50/50 dark:bg-red-950/10`,children:[(0,N.jsxs)(V,{className:`max-w-[500px] truncate py-2 text-sm`,title:e.query||void 0,children:[e.query||(0,N.jsx)(`span`,{className:`italic text-slate-300 dark:text-slate-600`,children:`No prompt recorded`}),!e.triggered&&(0,N.jsx)(M,{variant:`destructive`,className:`ml-2 text-[10px] font-normal`,children:`missed`})]}),(0,N.jsx)(V,{className:`py-2`,children:e.invocation_mode?(0,N.jsx)(M,{variant:`secondary`,className:`text-[10px] font-normal`,children:e.invocation_mode}):(0,N.jsx)(`span`,{className:`text-[11px] text-slate-400 dark:text-slate-500`,children:`Unknown mode`})}),(0,N.jsx)(V,{className:`py-2 font-mono text-xs tabular-nums text-slate-600 dark:text-slate-300`,children:e.confidence===null?`Not recorded`:`${Math.round(e.confidence*100)}%`}),(0,N.jsx)(V,{className:`py-2`,children:(()=>{let t=c(e);return t.label===`No data`?(0,N.jsx)(`span`,{className:`text-[11px] text-slate-400 dark:text-slate-500`,title:t.hint,children:t.label}):(0,N.jsx)(M,{variant:e.agent_type&&e.agent_type!==`main`?`outline`:`secondary`,className:`text-[10px] font-normal capitalize`,title:t.hint,children:t.label})})()}),(0,N.jsx)(V,{className:`py-2`,children:(()=>{let t=od(e.observation_kind),n=sd(e.historical_context);return t?(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,N.jsx)(M,{variant:t.variant,className:`text-[10px] font-normal`,children:t.label}),n&&(0,N.jsx)(M,{variant:n.variant,className:`text-[10px] font-normal`,children:n.label})]}):(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`text-[11px] text-slate-400 dark:text-slate-500`,children:`canonical`}),n&&(0,N.jsx)(M,{variant:n.variant,className:`text-[10px] font-normal`,children:n.label})]})})()}),(0,N.jsx)(V,{className:`whitespace-nowrap py-2 text-right font-mono text-[11px] text-slate-400 dark:text-slate-500`,children:e.timestamp?W(e.timestamp):``})]},t))})]})})]})}function Sd({invocations:e,sessionMetadata:t=[]}){let[n,r]=(0,A.useState)(`all`),i=(0,A.useMemo)(()=>new Map(t.map(e=>[e.session_id,e])),[t]),a=(0,A.useMemo)(()=>{switch(n){case`misses`:return e.filter(e=>!e.triggered);case`low_confidence`:return e.filter(e=>e.confidence!==null&&e.confidence<.5);default:return e}},[e,n]),o=(0,A.useMemo)(()=>{let e=new Map;for(let t of a){let n=t.session_id??`unknown`,r=e.get(n);r?r.push(t):e.set(n,[t])}return[...e.entries()].sort(([,e],[,t])=>(t[0]?.timestamp??``).localeCompare(e[0]?.timestamp??``))},[a]);return e.length===0?(0,N.jsx)(`div`,{className:`flex items-center justify-center rounded-lg border border-dashed border-slate-300 py-12 dark:border-slate-700`,children:(0,N.jsx)(`p`,{className:`text-sm text-slate-500 dark:text-slate-400`,children:`No invocation records yet. Invocations appear when skills are triggered during real sessions.`})}):(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(T,{className:`size-3.5 text-slate-400 dark:text-slate-500`}),[[`all`,`All`],[`misses`,`Misses`],[`low_confidence`,`Low confidence`]].map(([e,t])=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`inline-block`,children:(0,N.jsx)(M,{variant:n===e?`default`:`outline`,className:`cursor-pointer text-[10px]`,children:t})},e))]}),(0,N.jsxs)(`span`,{className:`text-xs text-slate-500 dark:text-slate-400`,children:[a.length,` invocations across `,o.length,` sessions`]})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-[11px] text-slate-500 dark:text-slate-400`,children:[(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`size-1.5 rounded-full bg-slate-400`}),`explicit = user typed /skill`]}),(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`size-1.5 rounded-full bg-slate-400`}),`implicit = mentioned by name`]}),(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`size-1.5 rounded-full bg-slate-400`}),`inferred = agent chose autonomously`]}),(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`size-1.5 rounded-full bg-red-400`}),`missed = skill should have triggered`]})]}),o.length===0?(0,N.jsx)(`div`,{className:`flex items-center justify-center py-8 text-sm text-slate-500 dark:text-slate-400`,children:`No invocations match this filter.`}):o.map(([e,t],n)=>(0,N.jsx)(xd,{sessionId:e,meta:i.get(e),invocations:t,defaultExpanded:n<3},e))]})}var Cd={healthy:{color:`bg-emerald-400`,glow:`shadow-[0_0_12px_rgba(52,211,153,0.6)]`},watching:{color:`bg-cyan-400`,glow:`shadow-[0_0_12px_rgba(79,242,255,0.6)]`},needs_review:{color:`bg-amber-400`,glow:`shadow-[0_0_12px_rgba(251,191,36,0.6)]`},blocked:{color:`bg-red-400`,glow:`shadow-[0_0_12px_rgba(248,113,113,0.6)]`}},wd={healthy:`Healthy`,watching:`Watching`,needs_review:`Needs Review`,blocked:`Blocked`},Td={critical:{dot:`bg-red-400`,text:`text-red-400`,bg:`bg-red-500/10`},warning:{dot:`bg-amber-400`,text:`text-amber-400`,bg:`bg-amber-500/10`},info:{dot:`bg-cyan-400`,text:`text-primary`,bg:`bg-cyan-400/10`}},Ed={proposal_created:`bg-cyan-400`,proposal_rejected:`bg-red-400`,validation_failed:`bg-amber-400`,proposal_deployed:`bg-emerald-400`,rollback_triggered:`bg-red-400`,regression_found:`bg-amber-400`},Dd={at_risk:{label:`At Risk`,accent:`text-red-400`,dot:`bg-red-400`},improving:{label:`Improving`,accent:`text-primary`,dot:`bg-cyan-400`},uncertain:{label:`Uncertain`,accent:`text-amber-400`,dot:`bg-amber-400`},stable:{label:`Stable`,accent:`text-muted-foreground`,dot:`bg-muted-foreground/60`}},Od=[{id:`autonomy-bar-1`,height:35},{id:`autonomy-bar-2`,height:55},{id:`autonomy-bar-3`,height:40},{id:`autonomy-bar-4`,height:70},{id:`autonomy-bar-5`,height:45},{id:`autonomy-bar-6`,height:80},{id:`autonomy-bar-7`,height:30},{id:`autonomy-bar-8`,height:65},{id:`autonomy-bar-9`,height:50},{id:`autonomy-bar-10`,height:75},{id:`autonomy-bar-11`,height:38},{id:`autonomy-bar-12`,height:60},{id:`autonomy-bar-13`,height:42},{id:`autonomy-bar-14`,height:72}];function kd({status:e,lastRun:t,actions:n}){let r=Cd[e.level],i=e.attention_required>0?{value:e.attention_required,label:`Attention Required`}:{value:e.skills_observed,label:`Skills Observed`};return(0,N.jsxs)(F,{className:`relative min-h-[332px] border-none bg-gradient-to-br from-muted via-muted to-primary/5 shadow-none py-0 ring-0`,children:[(0,N.jsx)(`div`,{className:`absolute inset-0 flex items-end justify-around px-8 pb-24 pt-20 opacity-[0.08] pointer-events-none`,children:Od.map(e=>(0,N.jsx)(`div`,{className:`flex-1 rounded-t-sm min-w-[12px]`,style:{height:`${e.height}%`,backgroundColor:`rgba(79, 242, 255, ${.15+e.height/100*.3})`}},e.id))}),(0,N.jsxs)(I,{className:`relative z-10 px-8 pt-8 pb-0`,children:[(0,N.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,N.jsx)(`span`,{className:`mt-2 size-3.5 shrink-0 rounded-full animate-pulse ${r.color} ${r.glow}`}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Autonomy Status`}),(0,N.jsx)(L,{className:`text-2xl font-extrabold tracking-tight text-foreground`,children:wd[e.level]}),(0,N.jsx)(R,{className:`mt-1.5 max-w-xl text-[13px] leading-relaxed text-muted-foreground`,children:e.summary})]})]}),(0,N.jsx)(_t,{children:(0,N.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,N.jsx)(`p`,{className:`text-5xl font-extrabold text-primary leading-none`,style:{filter:`drop-shadow(0 0 8px rgba(79,242,255,0.3))`},children:i.value}),(0,N.jsx)(`p`,{className:`text-[10px] uppercase tracking-[0.2em] text-muted-foreground mt-1.5`,children:i.label})]})})]}),(0,N.jsx)(`div`,{className:`flex-1 min-h-6`}),(0,N.jsxs)(z,{className:`relative z-10 flex flex-col gap-5 px-8 pb-8 pt-0`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5 text-xs`,children:[(0,N.jsxs)(`div`,{className:`rounded-full border border-border/40 bg-background/60 px-3 py-1.5 backdrop-blur-sm shadow-[inset_0_1px_0_rgba(255,255,255,0.02)]`,children:[(0,N.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.18em] text-muted-foreground/70`,children:`Last Run`}),(0,N.jsx)(`span`,{className:`ml-2 font-medium text-foreground`,children:t?W(t):`Never`})]}),(0,N.jsxs)(`div`,{className:`rounded-full border border-border/40 bg-background/60 px-3 py-1.5 backdrop-blur-sm shadow-[inset_0_1px_0_rgba(255,255,255,0.02)]`,children:[(0,N.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.18em] text-muted-foreground/70`,children:`Skills`}),(0,N.jsx)(`span`,{className:`ml-2 font-medium text-foreground`,children:e.skills_observed})]}),(0,N.jsxs)(`div`,{className:`rounded-full border border-primary/20 bg-primary/10 px-3 py-1.5 backdrop-blur-sm`,children:[(0,N.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.18em] text-primary/80`,children:`Pending`}),(0,N.jsx)(`span`,{className:`ml-2 font-semibold text-primary`,children:e.pending_reviews})]})]}),n??(e.attention_required>0?(0,N.jsx)(`a`,{href:`#supervision-feed`,className:`inline-flex w-fit items-center justify-center rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/80`,children:`Review Attention Queue`}):(0,N.jsx)(`span`,{className:`text-sm text-muted-foreground/70`,children:`No action needed`}))]})]})}function Ad({entries:e,renderSkillLink:t,footer:n}){let r=(0,A.useMemo)(()=>{let t=[`at_risk`,`improving`,`uncertain`,`stable`],n={at_risk:[],improving:[],uncertain:[],stable:[]};for(let t of e)n[t.bucket].push(t);return t.filter(e=>n[e].length>0).map(e=>({bucket:e,items:n[e]}))},[e]);return(0,N.jsxs)(F,{"data-parity-root":`overview-trust-watchlist`,className:`border-none bg-muted shadow-none py-0 max-h-[360px] ring-0`,children:[(0,N.jsxs)(I,{className:`px-5 pt-5 pb-0`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Trust Watchlist`}),(0,N.jsx)(R,{className:`mt-1 text-[11px] text-muted-foreground/70`,children:`Highest-risk skills worth checking next.`})]}),(0,N.jsx)(_t,{children:(0,N.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/70 shrink-0`,children:[e.length,` skills`]})})]}),r.length===0?(0,N.jsx)(z,{className:`flex flex-1 items-center justify-center px-5 py-4`,children:(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:`No skills tracked yet.`})}):(0,N.jsx)(z,{className:`space-y-3 overflow-y-auto min-h-0 flex-1 px-5 py-4`,children:r.map(({bucket:e,items:n})=>(0,N.jsx)(jd,{bucket:e,items:n,renderSkillLink:t},e))}),n?(0,N.jsx)(z,{className:`mt-auto px-5 pb-5 pt-1 shrink-0`,children:n}):null]})}function jd({bucket:e,items:t,renderSkillLink:n}){let r=Dd[e],[i,a]=(0,A.useState)(!1),[o,s]=(0,A.useState)(!1),c=i?o?t:t.slice(0,5):[];return(0,N.jsxs)(`div`,{className:`rounded-xl bg-background/40 px-3 py-2.5`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>a(!i),className:`flex w-full items-center gap-1.5 text-left`,children:[(0,N.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full ${r.dot}`}),(0,N.jsx)(te,{className:`size-3 text-muted-foreground transition-transform ${i?``:`-rotate-90`}`}),(0,N.jsx)(`span`,{className:`text-xs font-medium ${r.accent}`,children:r.label}),(0,N.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/70`,children:[`(`,t.length,`)`]})]}),i&&(0,N.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[c.map(e=>(0,N.jsxs)(`div`,{className:`rounded-lg px-2 py-1.5 transition-colors hover:bg-background/55`,children:[(0,N.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[n?n(e.skill_name):(0,N.jsx)(`span`,{className:`text-[11px] font-medium text-foreground truncate`,children:e.skill_name}),e.pass_rate!=null&&(0,N.jsxs)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:[Math.round(e.pass_rate*100),`%`]})]}),(0,N.jsx)(`p`,{className:`mt-0.5 line-clamp-1 text-[10px] text-muted-foreground/70`,children:e.reason})]},e.skill_name)),t.length>5&&!o&&(0,N.jsxs)(`button`,{type:`button`,onClick:()=>s(!0),className:`pl-2 text-[10px] text-primary hover:underline`,children:[`+`,t.length-5,` more`]})]})]})}function Md({attention:e,decisions:t,renderSkillLink:n}){return(0,N.jsxs)(F,{id:`supervision-feed`,"data-parity-root":`overview-supervision-feed`,className:`relative overflow-hidden border-none bg-muted shadow-none py-0 scroll-mt-6 ring-0`,children:[(0,N.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 h-20 bg-gradient-to-b from-primary/5 via-transparent to-transparent`}),(0,N.jsxs)(St,{defaultValue:`attention`,className:`gap-0`,children:[(0,N.jsxs)(I,{className:`relative px-5 pt-4 pb-0`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Supervision Feed`}),(0,N.jsx)(R,{className:`mt-1 text-[13px] text-muted-foreground/70`,children:`What needs review and what selftune just decided.`})]}),(0,N.jsxs)(wt,{variant:`line`,className:`mt-3`,children:[(0,N.jsxs)(Tt,{value:`attention`,className:`text-xs uppercase tracking-[0.15em]`,children:[`Attention Required`,e.length>0&&(0,N.jsx)(M,{variant:`secondary`,className:`ml-1.5 text-[10px] py-0 px-1.5`,children:e.length})]}),(0,N.jsxs)(Tt,{value:`decisions`,className:`text-xs uppercase tracking-[0.15em]`,children:[`Recent Decisions`,t.length>0&&(0,N.jsx)(`span`,{className:`ml-1.5 text-[10px] text-muted-foreground`,children:t.length})]})]})]}),(0,N.jsxs)(z,{className:`max-h-[440px] overflow-y-auto px-5 py-5`,children:[(0,N.jsx)(Et,{value:`attention`,children:(0,N.jsx)(Nd,{attention:e,renderSkillLink:n})}),(0,N.jsx)(Et,{value:`decisions`,children:(0,N.jsx)(Pd,{decisions:t,renderSkillLink:n})})]})]})]})}function Nd({attention:e,renderSkillLink:t}){let[n,r]=(0,A.useState)(!1);return e.length===0?(0,N.jsxs)(`div`,{className:`flex items-center gap-3 py-4`,children:[(0,N.jsx)(he,{className:`size-5 text-emerald-400`}),(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing needs your attention`})]}):(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(n?e:e.slice(0,6)).map(e=>{let n=Td[e.severity];return(0,N.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-background/40 px-3 py-3 transition-colors hover:bg-background/55`,children:[(0,N.jsx)(`span`,{className:`mt-1.5 size-2 shrink-0 rounded-full ${n.dot}`}),(0,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[t?t(e.skill_name):(0,N.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e.skill_name}),(0,N.jsx)(M,{variant:`outline`,className:`text-[10px] font-normal ${n.text} ${n.bg} border-transparent`,children:e.category.replace(/_/g,` `)})]}),(0,N.jsx)(`p`,{className:`mt-0.5 line-clamp-1 text-sm text-muted-foreground`,children:e.reason}),(0,N.jsx)(`p`,{className:`mt-0.5 line-clamp-1 text-xs text-muted-foreground/70`,children:e.recommended_action})]}),(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground/70 shrink-0 mt-0.5`,children:e.timestamp?W(e.timestamp):``})]},`${e.skill_name}-${e.category}`)}),e.length>6&&!n&&(0,N.jsx)(`div`,{className:`pt-3`,children:(0,N.jsxs)(`button`,{type:`button`,onClick:()=>r(!0),className:`text-xs text-primary hover:underline`,children:[`Show all `,e.length,` attention items`]})})]})}function Pd({decisions:e,renderSkillLink:t}){let[n,r]=(0,A.useState)(!1),i=n?e:e.slice(0,10),a=(0,A.useMemo)(()=>{let e=new Map;return i.map(t=>{let n=`${t.timestamp}-${t.skill_name}-${t.kind}`,r=e.get(n)??0;return e.set(n,r+1),{decision:t,key:`${n}-${r}`}})},[i]);return e.length===0?(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground/70 py-4`,children:`No autonomous decisions yet.`}):(0,N.jsxs)(`div`,{className:`space-y-1`,children:[a.map(({decision:e,key:n})=>{let r=Ed[e.kind];return(0,N.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-xl bg-background/30 px-3 py-2 transition-colors hover:bg-background/45`,children:[(0,N.jsx)(`span`,{className:`mt-1.5 size-2 shrink-0 rounded-full ${r}`}),(0,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[t?t(e.skill_name):(0,N.jsx)(`span`,{className:`text-xs font-medium text-foreground truncate block`,children:e.skill_name}),(0,N.jsx)(`p`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:e.summary})]}),(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground/70 shrink-0 mt-0.5`,children:W(e.timestamp)})]},n)}),e.length>10&&!n&&(0,N.jsxs)(`button`,{type:`button`,onClick:()=>r(!0),className:`text-xs text-primary hover:underline mt-1 pl-2`,children:[`Show all (`,e.length,`)`]})]})}A.createContext(null);var Fd=`selftune.skill-report-onboarding-dismissed`;function Id({open:e,onOpenChange:t}){let n=(0,A.useRef)(null);return(0,A.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t(!1)};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]),e?(0,N.jsxs)(`div`,{className:`fixed inset-0 z-50 flex justify-end`,children:[(0,N.jsx)(`div`,{className:`absolute inset-0 bg-black/40 backdrop-blur-[2px] transition-opacity`,onClick:()=>t(!1)}),(0,N.jsxs)(`div`,{ref:n,className:`relative z-10 w-full max-w-lg overflow-y-auto bg-white shadow-xl dark:bg-slate-900 animate-in slide-in-from-right duration-200`,children:[(0,N.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center justify-between border-b border-slate-200 bg-white px-6 py-4 dark:border-slate-800 dark:bg-slate-900`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-lg font-semibold text-slate-900 dark:text-white`,children:`How to read this page`}),(0,N.jsx)(`p`,{className:`mt-0.5 text-sm text-slate-500 dark:text-slate-400`,children:`selftune earns trust by showing what it observed, what it proposed, how it tested the change, and what happened next.`})]}),(0,N.jsx)(P,{variant:`ghost`,className:`shrink-0 rounded-full p-1.5`,onClick:()=>t(!1),children:(0,N.jsx)(Ne,{className:`size-4`})})]}),(0,N.jsxs)(`div`,{className:`space-y-8 px-6 py-6`,children:[(0,N.jsxs)(`section`,{className:`space-y-3`,children:[(0,N.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-[0.18em] text-slate-400 dark:text-slate-500`,children:`The improvement loop`}),(0,N.jsxs)(`div`,{className:`space-y-3 text-sm text-slate-600 dark:text-slate-400`,children:[(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`1. Observe.`}),` selftune watches real sessions and notes when a skill triggered, missed, or looked noisy.`]}),(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`2. Propose.`}),` When the signal is strong enough, it suggests a wording change to the skill.`]}),(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`3. Validate.`}),` It checks whether the new wording improves routing without breaking important cases.`]}),(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`4. Decide.`}),` Only validated winners should be deployed. Rejected or pending proposals do not change the live skill.`]})]})]}),(0,N.jsxs)(`section`,{className:`space-y-3`,children:[(0,N.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-[0.18em] text-slate-400 dark:text-slate-500`,children:`What each section means`}),(0,N.jsxs)(`div`,{className:`space-y-3 text-sm text-slate-600 dark:text-slate-400`,children:[(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`Next Best Action`}),` tells you whether you should review, deploy, or simply keep observing.`]}),(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`How selftune is improving this skill`}),` `,`explains the current state in plain language.`]}),(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`Trust Signals`}),` are the condensed metrics behind that story: coverage, evidence quality, routing quality, and evolution state.`]}),(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`Evidence`}),` shows what changed and why a proposal was accepted, rejected, or left pending.`]}),(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`Invocations`}),` shows real prompts where this skill triggered or likely should have triggered.`]}),(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`strong`,{className:`text-slate-900 dark:text-white`,children:`Community`}),` surfaces aggregated contributor signals and usage patterns from the broader selftune community.`]})]})]}),(0,N.jsxs)(`section`,{className:`space-y-3`,children:[(0,N.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-[0.18em] text-slate-400 dark:text-slate-500`,children:`FAQ`}),(0,N.jsxs)(`div`,{className:`space-y-4 text-sm text-slate-600 dark:text-slate-400`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`font-medium text-slate-900 dark:text-white`,children:`What is a missed trigger?`}),(0,N.jsx)(`p`,{children:`A case where selftune believes the skill should have been used, but the agent did not invoke it.`})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`font-medium text-slate-900 dark:text-white`,children:`Why was a proposal rejected?`}),(0,N.jsx)(`p`,{children:`Usually because validation showed the new wording would regress existing behavior, or because it violated a hard rule like dropping an important anchor phrase.`})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`font-medium text-slate-900 dark:text-white`,children:`When should I trust a recommendation?`}),(0,N.jsx)(`p`,{children:`Trust it more when the page shows broad coverage, prompt-linked evidence, and a validated result. Trust it less when the sample is tiny or the data is noisy.`})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`font-medium text-slate-900 dark:text-white`,children:`Do I need to understand every metric?`}),(0,N.jsx)(`p`,{children:`No. Start with the plain-English summary and next best action. Use the deeper tabs only when you want to inspect the evidence yourself.`})]})]})]})]})]})]}):null}function Ld({onOpenGuide:e}){let[t,n]=(0,A.useState)(()=>typeof window<`u`?window.localStorage.getItem(Fd)===`1`:!1);return t?null:(0,N.jsx)(`div`,{className:`rounded-lg border border-blue-200/40 bg-blue-50/50 px-4 py-3 dark:border-blue-900/40 dark:bg-blue-950/20`,children:(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,N.jsxs)(`div`,{className:`text-sm text-slate-600 dark:text-slate-400`,children:[(0,N.jsx)(`span`,{className:`font-medium text-slate-900 dark:text-white`,children:`New to selftune?`}),` Start with the summary below, then open the guide if you want the full improvement loop explained step by step.`]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(P,{variant:`outline`,onClick:e,children:`Open guide`}),(0,N.jsx)(P,{variant:`ghost`,onClick:()=>{typeof window<`u`&&window.localStorage.setItem(Fd,`1`),n(!0)},children:`Hide`})]})]})})}var Rd=[{key:`ALL`,label:`All Skills`},{key:`HEALTHY`,label:`Healthy`},{key:`WARNING`,label:`Warning`},{key:`CRITICAL`,label:`Critical`},{key:`UNGRADED`,label:`Ungraded`}],zd={HEALTHY:{text:`text-primary`,bg:`bg-primary`,label:`Deployed`},WARNING:{text:`text-primary-accent`,bg:`bg-primary-accent`,label:`Needs Attention`},CRITICAL:{text:`text-destructive`,bg:`bg-destructive`,label:`Critical`},UNGRADED:{text:`text-muted-foreground`,bg:`bg-muted-foreground`,label:`Ungraded`},UNKNOWN:{text:`text-muted-foreground`,bg:`bg-muted-foreground`,label:`Unknown`}};function Bd(e){return e===null?0:Math.round(e*100)}function Vd(){return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col gap-8 p-6 md:p-10 animate-in fade-in duration-500`,children:[(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(`div`,{className:`h-12 w-64 rounded-lg bg-muted animate-pulse`}),(0,N.jsx)(`div`,{className:`h-5 w-96 rounded-lg bg-muted animate-pulse`})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-12 gap-6`,children:[(0,N.jsx)(`div`,{className:`col-span-12 lg:col-span-8 h-72 rounded-xl bg-muted animate-pulse`}),(0,N.jsxs)(`div`,{className:`col-span-12 lg:col-span-4 flex flex-col gap-6`,children:[(0,N.jsx)(`div`,{className:`h-32 rounded-xl bg-muted animate-pulse`}),(0,N.jsx)(`div`,{className:`h-32 rounded-xl bg-muted animate-pulse`})]})]}),(0,N.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6`,children:Array.from({length:6}).map((e,t)=>(0,N.jsx)(`div`,{className:`h-52 rounded-xl bg-muted animate-pulse`},`skel-${t}`))})]})}function Hd({skillName:e,skillScope:t,platforms:n,passRate:r,totalChecks:i,uniqueSessions:a,status:o,latestEvolutionTimestamp:s,renderActions:c}){let l=Bd(i>0?r:null),u=zd[o];return(0,N.jsxs)(F,{className:`col-span-12 lg:col-span-8 rounded-3xl border border-border/15 p-8 relative overflow-hidden flex flex-col`,children:[(0,N.jsx)(`div`,{className:`absolute top-0 left-0 w-full h-1 bg-input`,children:(0,N.jsx)(`div`,{className:`h-full bg-primary shadow-[0_0_15px_rgba(79,242,255,0.6)] transition-all duration-700`,style:{width:`${l}%`}})}),(0,N.jsxs)(`div`,{className:`flex justify-between items-start mb-6`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,N.jsx)(`span`,{className:`px-2 py-0.5 rounded text-[10px] font-bold bg-primary/10 text-primary uppercase tracking-widest`,children:o===`HEALTHY`?`Deployed`:`Evolving`}),n&&n.length>0?(0,N.jsx)(`span`,{className:`flex items-center gap-1`,children:n.map(e=>(0,N.jsx)(`span`,{className:`px-1.5 py-0.5 rounded bg-muted text-muted-foreground font-mono text-[10px]`,children:e},e))}):(0,N.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:[t??`global`,` scope`]})]}),(0,N.jsx)(`h2`,{className:`font-headline text-3xl font-bold text-foreground`,children:e})]}),(0,N.jsxs)(`div`,{className:`text-right`,children:[(0,N.jsx)(`span`,{className:`text-4xl font-headline font-light text-primary`,children:Gr(i>0?r:null)}),(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest mt-1`,children:s?`Evolved ${W(s)}`:`Pass Rate`})]})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-3 gap-8 mb-8`,children:[(0,N.jsxs)(`div`,{className:`bg-muted p-4 rounded-2xl border border-border/15`,children:[(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest mb-1`,children:`Total Checks`}),(0,N.jsx)(`p`,{className:`text-xl font-bold font-headline tabular-nums`,children:i.toLocaleString()})]}),(0,N.jsxs)(`div`,{className:`bg-muted p-4 rounded-2xl border border-border/15`,children:[(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest mb-1`,children:`Pass Rate`}),(0,N.jsx)(`p`,{className:`text-xl font-bold font-headline tabular-nums ${u.text}`,children:Gr(i>0?r:null)})]}),(0,N.jsxs)(`div`,{className:`bg-muted p-4 rounded-2xl border border-border/15`,children:[(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest mb-1`,children:`Unique Sessions`}),(0,N.jsx)(`p`,{className:`text-xl font-bold font-headline tabular-nums`,children:a.toLocaleString()})]})]}),(0,N.jsx)(`div`,{className:`flex justify-end gap-4`,children:c?.(e)})]})}function Ud({aggregatePassRate:e,gradedCount:t}){return(0,N.jsxs)(F,{className:`rounded-3xl border border-border/15 p-6 flex flex-col justify-center`,children:[(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest mb-4`,children:`Library Health`}),(0,N.jsx)(`div`,{className:`flex items-end gap-2 mb-2`,children:(0,N.jsx)(`span`,{className:`text-5xl font-headline font-bold tabular-nums`,children:e===null?`--`:`${Math.round(e*100)}%`})}),(0,N.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Aggregate pass rate across `,t,` graded skill`,t===1?``:`s`,`.`]})]})}function Wd({proposals:e}){return e.length===0?(0,N.jsxs)(F,{className:`rounded-3xl p-6 flex flex-col gap-3 border border-border/15 border-l-4 border-l-primary/40`,children:[(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest mb-2`,children:`Pending Proposals`}),(0,N.jsx)(`h3`,{className:`font-headline font-bold text-lg`,children:`No proposals pending`})]}):(0,N.jsxs)(F,{className:`rounded-3xl p-6 flex flex-col gap-3 border border-border/15 border-l-4 border-l-primary/40`,children:[(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest mb-2`,children:`Pending Proposals`}),(0,N.jsxs)(`h3`,{className:`font-headline font-bold text-lg mb-4`,children:[`Awaiting Review`,(0,N.jsx)(M,{variant:`secondary`,className:`ml-2 h-5 px-2 text-[10px] bg-primary/15 text-primary border-none align-middle`,children:e.length})]}),(0,N.jsx)(`div`,{className:`space-y-3 max-h-32 overflow-y-auto themed-scroll`,children:e.map(e=>(0,N.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-muted rounded-xl`,children:[(0,N.jsx)(`span`,{className:`text-sm truncate`,children:e.skillName??`Unknown`}),(0,N.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:e.action})]},e.id))})]})}function Gd({skill:e,renderActions:t}){let n=Bd(e.passRate),r=zd[e.status];return(0,N.jsxs)(F,{className:`border border-border/15 p-6 hover:border-border/30 transition-all duration-300 flex flex-col`,children:[(0,N.jsxs)(`div`,{className:`flex justify-between items-start mb-4`,children:[(0,N.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-muted flex items-center justify-center`,children:(0,N.jsx)(`span`,{className:`size-3 rounded-full ${r.bg}`})}),(0,N.jsxs)(`div`,{className:`text-right`,children:[(0,N.jsx)(`div`,{className:`flex flex-wrap justify-end gap-1`,children:e.platforms&&e.platforms.length>0?e.platforms.map(e=>(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest`,children:e},e)):(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest`,children:e.scope??`unknown`})}),(0,N.jsx)(`p`,{className:`text-sm font-bold tabular-nums`,children:e.checks.toLocaleString()})]})]}),(0,N.jsx)(`h3`,{className:`font-headline font-bold text-xl tracking-tight text-foreground truncate mb-1`,children:e.name}),(0,N.jsxs)(`p`,{className:`text-sm text-muted-foreground mb-6`,children:[e.uniqueSessions,` sessions · Last seen`,` `,e.lastSeen?W(e.lastSeen):`never`]}),(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex justify-between items-end text-xs uppercase tracking-tighter`,children:[(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:`Pass Rate`}),(0,N.jsx)(`span`,{className:`font-bold ${r.text}`,children:r.label})]}),(0,N.jsx)(`div`,{className:`w-full h-1 bg-input rounded-full overflow-hidden`,children:(0,N.jsx)(`div`,{className:`h-full rounded-full transition-all duration-500 ${r.bg}`,style:{width:`${n}%`}})}),(0,N.jsx)(`div`,{className:`pt-4 flex gap-3`,children:t?.(e.name)})]})]})}function Kd({filter:e,onFilterChange:t,counts:n,sortDesc:r,onSortToggle:i}){return(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-4 flex-wrap`,children:[(0,N.jsx)(`div`,{className:`flex gap-1 bg-muted rounded-xl p-1`,children:Rd.map(r=>(0,N.jsxs)(`button`,{type:`button`,onClick:()=>t(r.key),className:`px-4 py-2 rounded-lg text-sm font-headline font-semibold transition-all duration-200 ${e===r.key?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`}`,children:[r.label,(0,N.jsx)(`span`,{className:`ml-1.5 text-xs opacity-60`,children:n[r.key]})]},r.key))}),(0,N.jsxs)(`button`,{type:`button`,onClick:i,className:`flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground hover:text-foreground transition-colors font-headline`,title:r?`Highest pass rate first`:`Lowest pass rate first`,children:[(0,N.jsx)(ye,{className:`size-4`}),(0,N.jsx)(`span`,{children:`Sort by Performance`})]})]})}function qd(){return(0,N.jsx)(F,{className:`col-span-12 lg:col-span-8 border border-border/15 p-8 flex items-center justify-center`,children:(0,N.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,N.jsx)(ee,{className:`size-10 text-muted-foreground mx-auto`}),(0,N.jsx)(`p`,{className:`text-muted-foreground`,children:`No evolution activity yet. Run an evolution cycle to see your most active skill.`})]})})}function Jd(){return(0,N.jsxs)(F,{className:`border border-border/15 p-12 text-center`,children:[(0,N.jsx)(D,{className:`size-8 text-muted-foreground mx-auto mb-3`}),(0,N.jsx)(`p`,{className:`text-muted-foreground font-headline`,children:`No skills match the current filter`})]})}function Yd({message:e,onRetry:t}){return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 py-16`,children:[(0,N.jsx)(_e,{className:`size-10 text-destructive`}),(0,N.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:e}),t&&(0,N.jsxs)(`button`,{type:`button`,onClick:t,className:`inline-flex items-center gap-2 rounded-md border border-border px-3 py-1.5 text-sm font-medium hover:bg-muted transition-colors`,children:[(0,N.jsx)(oe,{className:`size-3.5`}),`Retry`]})]})}function Xd({autonomyStatus:e,lastRun:t,trustWatchlist:n,attentionItems:r,autonomousDecisions:i,renderSkillLink:a,heroActions:o,trustRailFooter:s,beforeHero:c,betweenHeroAndFeed:l,afterFeed:u}){return(0,N.jsx)(`div`,{className:`@container/main flex flex-1 flex-col py-6`,children:(0,N.jsxs)(`div`,{className:`grid grid-cols-12 gap-6 px-4 lg:px-6`,children:[c,(0,N.jsx)(`div`,{className:`col-span-12 @4xl/main:col-span-8`,children:(0,N.jsx)(kd,{status:e,lastRun:t,actions:o})}),(0,N.jsx)(`div`,{className:`col-span-12 @4xl/main:col-span-4 self-start`,children:(0,N.jsx)(Ad,{entries:n,renderSkillLink:a,footer:s})}),l,(0,N.jsx)(`div`,{className:`col-span-12`,children:(0,N.jsx)(Md,{attention:r,decisions:i,renderSkillLink:a})}),u]})})}var Zd=[`at_risk`,`improving`,`uncertain`,`stable`],Qd={at_risk:{label:`At Risk`,accent:`text-red-400`,dot:`bg-red-400`},improving:{label:`Improving`,accent:`text-primary`,dot:`bg-primary`},uncertain:{label:`Uncertain`,accent:`text-amber-400`,dot:`bg-amber-400`},stable:{label:`Stable`,accent:`text-muted-foreground`,dot:`bg-muted-foreground/60`}};function $d(e,t){return e?.onChange??t?.actions.updateOverviewWatchlist}function ef(e){return e?.actions.getOverviewWatchlist}function tf(e){return JSON.stringify(e??[])}function nf(e){return JSON.parse(e)}function rf(e){switch(e){case`created`:return`Proposal created`;case`validated`:return`Validated`;case`deployed`:return`Deployed`;case`rolled_back`:return`Rolled back`;case`watch`:return`Watching`;case`rejected`:return`Rejected`;default:return e.replace(/_/g,` `)}}function af(e,t=10){return e.toSorted((e,t)=>{let n=Zd.indexOf(e.bucket),r=Zd.indexOf(t.bucket);return n===r?(t.sortTimestamp??``).localeCompare(e.sortTimestamp??``):n-r}).slice(0,t).map(e=>e.skillName)}function of({rows:e,renderSkillLink:t,libraryAction:n,watchlist:r}){let i=qt(),a=!!r,o=r?.initialSkills??[],s=tf(o),[c,l]=(0,A.useState)(a?`watched`:`all`),[u,d]=(0,A.useState)(()=>nf(s)),f=(0,A.useRef)(0),p=(0,A.useRef)(0),m=ef(i),h=$d(r,i);(0,A.useEffect)(()=>{a&&d(nf(s))},[a,s]),(0,A.useEffect)(()=>{if(!a||!m||o.length>0)return;let e=p.current+1;p.current=e;let t=!1;return Promise.resolve(m()).then(n=>{t||p.current!==e||Array.isArray(n)&&n.every(e=>typeof e==`string`)&&d(n)}).catch(()=>{}),()=>{t=!0}},[a,m,o.length]);let g=(0,A.useMemo)(()=>e.toSorted((e,t)=>{let n=Zd.indexOf(e.bucket),r=Zd.indexOf(t.bucket);return n===r?(t.sortTimestamp??``).localeCompare(e.sortTimestamp??``):n-r}),[e]),_=(0,A.useMemo)(()=>{if(!r)return[];let t=new Set(e.map(e=>e.skillName)),n=u.filter(e=>t.has(e));return n.length>0?n:af(e)},[e,u,r]),v=(0,A.useMemo)(()=>{if(!r||c===`all`)return g;let e=new Set(_);return g.filter(t=>e.has(t.skillName))},[_,g,c,r]),y=async e=>{if(!r)return;let t=_.includes(e)?_.filter(t=>t!==e):[..._,e];if(!h){d(t);return}let n=_,i=f.current+1;f.current=i,d(t);try{let e=await h(t);f.current===i&&Array.isArray(e)&&e.every(e=>typeof e==`string`)&&d(e)}catch{f.current===i&&d(n)}};return(0,N.jsxs)(F,{className:`col-span-12 border-none bg-muted shadow-none py-0`,children:[(0,N.jsxs)(I,{className:`px-5 pt-5 pb-0`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`font-headline text-[10px] uppercase tracking-[0.2em] text-muted-foreground`,children:`Skill Comparison`}),(0,N.jsx)(R,{className:`mt-1 text-[13px]`,children:`Compare skill performance before drilling into the details.`})]}),(a||n)&&(0,N.jsx)(_t,{children:(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[a?(0,N.jsx)(St,{value:c,onValueChange:e=>l(e),children:(0,N.jsxs)(wt,{variant:`line`,className:`h-auto gap-2`,children:[(0,N.jsxs)(Tt,{value:`watched`,className:`font-headline text-[10px] uppercase tracking-[0.18em]`,children:[`Watched`,(0,N.jsx)(`span`,{className:`ml-1.5 text-muted-foreground`,children:_.length})]}),(0,N.jsxs)(Tt,{value:`all`,className:`font-headline text-[10px] uppercase tracking-[0.18em]`,children:[`All Skills`,(0,N.jsx)(`span`,{className:`ml-1.5 text-muted-foreground`,children:e.length})]})]})}):null,n]})})]}),(0,N.jsx)(z,{className:`themed-scroll overflow-x-auto px-5 py-5`,children:(0,N.jsxs)(`div`,{"data-parity-root":`overview-comparison-grid`,className:a?`min-w-[780px]`:`min-w-[680px]`,children:[a?(0,N.jsx)(`div`,{className:`mb-3 rounded-xl bg-background/35 px-3 py-2 text-xs text-muted-foreground`,children:c===`watched`?`Your watched skills stay pinned here. Add or remove them directly from the grid.`:`All installed skills, sorted by current trust priority.`}):null,(0,N.jsxs)(`div`,{className:`grid gap-3 px-3 pb-2 text-[10px] uppercase tracking-[0.18em] text-muted-foreground ${a?`grid-cols-[minmax(220px,2.3fr)_0.95fr_1.1fr_0.9fr_1.3fr_1fr_0.9fr]`:`grid-cols-[minmax(220px,2.3fr)_0.95fr_1.1fr_0.9fr_1.3fr_1fr]`}`,children:[(0,N.jsx)(`span`,{children:`Skill`}),(0,N.jsx)(`span`,{children:`Trigger Rate`}),(0,N.jsx)(`span`,{children:`Routing Conf.`}),(0,N.jsx)(`span`,{children:`Sessions`}),(0,N.jsx)(`span`,{children:`Last Evolution`}),(0,N.jsx)(`span`,{children:`Status`}),a?(0,N.jsx)(`span`,{className:`text-right`,children:`Watch`}):null]}),(0,N.jsxs)(`div`,{className:`space-y-1.5`,children:[v.map(e=>{let n=Qd[e.bucket],r=_.includes(e.skillName);return(0,N.jsxs)(`div`,{className:`grid items-center gap-3 rounded-xl bg-background/35 px-3 py-3 text-sm transition-colors hover:bg-background/50 ${a?`grid-cols-[minmax(220px,2.3fr)_0.95fr_1.1fr_0.9fr_1.3fr_1fr_0.9fr]`:`grid-cols-[minmax(220px,2.3fr)_0.95fr_1.1fr_0.9fr_1.3fr_1fr]`}`,children:[(0,N.jsxs)(`div`,{className:`min-w-0`,children:[t?t(e.skillName):(0,N.jsx)(`p`,{className:`truncate font-medium`,children:e.skillName}),e.subtext?(0,N.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.subtext}):null]}),(0,N.jsx)(`div`,{className:`font-medium`,children:e.triggerRate==null?`—`:`${Math.round(e.triggerRate*100)}%`}),(0,N.jsx)(`div`,{className:`min-w-0`,children:e.routingConfidence!=null&&e.confidenceCoverage>=.5?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`p`,{className:`text-sm font-medium`,children:[Math.round(e.routingConfidence*100),`%`]}),(0,N.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[Math.round(e.confidenceCoverage*100),`% coverage`]})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`p`,{className:`text-sm font-medium`,children:`—`}),(0,N.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:`Low coverage`})]})}),(0,N.jsx)(`div`,{className:`text-muted-foreground`,children:e.sessions}),(0,N.jsx)(`div`,{className:`min-w-0`,children:e.lastEvolution?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`p`,{className:`truncate text-sm`,children:rf(e.lastEvolution.action)}),(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:W(e.lastEvolution.timestamp)})]}):(0,N.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`No evolutions yet`})}),(0,N.jsx)(`div`,{children:(0,N.jsxs)(M,{variant:`outline`,className:`border-transparent ${n.accent} bg-background/55`,children:[(0,N.jsx)(`span`,{className:`mr-1.5 inline-block size-1.5 rounded-full ${n.dot}`}),n.label]})}),a?(0,N.jsx)(`div`,{className:`flex justify-end`,children:(0,N.jsxs)(P,{type:`button`,variant:r?`secondary`:`ghost`,size:`sm`,className:`h-8 gap-1.5 px-2 text-xs`,onClick:()=>void y(e.skillName),children:[(0,N.jsx)(b,{className:`size-3.5`}),r?`Watching`:`Watch`]})}):null]},e.skillName)}),v.length===0?(0,N.jsx)(`div`,{className:`rounded-xl bg-background/30 px-3 py-6 text-sm text-muted-foreground`,children:a?r?.emptyMessage??(0,N.jsxs)(N.Fragment,{children:[`No watched skills yet. Switch to`,` `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:`All Skills`}),` and add the ones you want to track closely.`]}):`No skills available.`}):null]})]})})]})}function sf({skillCount:e,storageKey:t=`selftune-onboarding-dismissed`}){let[n,r]=(0,A.useState)(()=>{try{return localStorage.getItem(t)===`true`}catch{return!1}});return e>0||n?null:(0,N.jsx)(`div`,{className:`col-span-12 rounded-xl border-2 border-dashed border-primary/30 bg-primary/5 p-8`,children:(0,N.jsxs)(`div`,{className:`mx-auto flex max-w-md flex-col items-center gap-4 text-center`,children:[(0,N.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full bg-primary/10`,children:(0,N.jsx)(Ye,{className:`size-6 text-primary`})}),(0,N.jsx)(`h2`,{className:`font-headline text-lg font-semibold`,children:`Welcome to selftune`}),(0,N.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:`No skills detected yet. Once you start using selftune in your project, skills will appear here automatically.`}),(0,N.jsxs)(`div`,{className:`grid w-full grid-cols-1 gap-3 text-left sm:grid-cols-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg border bg-card p-3`,children:[(0,N.jsx)(`div`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full bg-blue-500/10 text-xs font-bold text-blue-500`,children:`1`}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-xs font-medium`,children:`Run selftune`}),(0,N.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Enable selftune in your project to start tracking skills`})]})]}),(0,N.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg border bg-card p-3`,children:[(0,N.jsx)(`div`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full bg-amber-500/10 text-xs font-bold text-amber-500`,children:`2`}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-xs font-medium`,children:`Skills appear`}),(0,N.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Skills are detected and monitored automatically`})]})]}),(0,N.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg border bg-card p-3`,children:[(0,N.jsx)(`div`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full bg-emerald-500/10 text-xs font-bold text-emerald-500`,children:`3`}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-xs font-medium`,children:`Watch evolution`}),(0,N.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Proposals flow in with validated improvements`})]})]})]}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>{r(!0);try{localStorage.setItem(t,`true`)}catch{}},className:`text-xs text-muted-foreground hover:text-foreground`,children:`Dismiss`})]})})}function cf({lastRun:e,deployed:t,evolved:n,watched:r,runCount:i,historyAction:a}){return i===0?null:(0,N.jsxs)(`div`,{className:`col-span-12 flex items-center gap-6 rounded-xl border border-border/10 bg-card/50 px-5 py-3 text-xs text-muted-foreground`,children:[(0,N.jsx)(`span`,{className:`font-headline text-[10px] uppercase tracking-[0.2em]`,children:`Last Cycle`}),(0,N.jsx)(`span`,{children:e?W(e):`Never`}),(0,N.jsx)(`span`,{className:`text-muted-foreground/30`,children:`|`}),(0,N.jsxs)(`span`,{children:[t,` deployed`]}),(0,N.jsxs)(`span`,{children:[n,` evolved`]}),(0,N.jsxs)(`span`,{children:[r,` watched`]}),a?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:`text-muted-foreground/30`,children:`|`}),(0,N.jsx)(`span`,{className:`ml-auto`,children:a})]}):null]})}function lf({onboarding:e,comparison:t,sectionsBeforeFeed:n,runSummary:r,sectionsAfterFeed:i,renderSkillLink:a,...o}){let s=e?(0,N.jsx)(sf,{skillCount:e.skillCount,storageKey:e.storageKey}):null,c=t||n?(0,N.jsxs)(N.Fragment,{children:[t&&t.rows.length>0?(0,N.jsx)(`div`,{className:`col-span-12`,children:(0,N.jsx)(of,{...t,renderSkillLink:a})}):null,n?(0,N.jsx)(`div`,{className:`col-span-12`,children:n}):null]}):null,l=r||i?(0,N.jsxs)(N.Fragment,{children:[r?(0,N.jsx)(cf,{...r}):null,i]}):null;return(0,N.jsx)(Xd,{...o,renderSkillLink:a,beforeHero:s,betweenHeroAndFeed:c,afterFeed:l})}function uf({className:e,...t}){return(0,N.jsx)(`div`,{"data-slot":`skeleton`,className:j(`animate-pulse rounded-md bg-muted`,e),...t})}var df=6e4;function ff(){return Cr({queryKey:[`orchestrate-runs`],queryFn:()=>Lr(20),staleTime:5e3,refetchInterval:df})}function pf(e){switch(e){case`generate_evals`:return`Generate evals`;case`run_unit_tests`:return`Run unit tests`;case`run_replay_dry_run`:return`Replay dry-run`;case`measure_baseline`:return`Measure baseline`;case`deploy_candidate`:return`Deploy candidate`;case`watch_deployment`:return`Watch deployment`}}function mf({data:e}){return e?(0,N.jsxs)(F,{className:`rounded-2xl border-border/15`,children:[(0,N.jsxs)(I,{className:`gap-2`,children:[(0,N.jsx)(L,{className:`text-base`,children:`Creator test loop`}),(0,N.jsx)(R,{children:`Generate evals, add unit tests, replay a dry-run, measure baseline, then deploy a watched candidate. This surface tracks whether each skill is still blocked on testing, ready to ship, or already under watch.`})]}),(0,N.jsxs)(z,{className:`space-y-5`,children:[(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.summary}),(0,N.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-6`,children:[[`Generate evals`,e.counts.generate_evals],[`Run unit tests`,e.counts.run_unit_tests],[`Replay dry-run`,e.counts.run_replay_dry_run],[`Measure baseline`,e.counts.measure_baseline],[`Deploy candidate`,e.counts.deploy_candidate],[`Watching`,e.counts.watch_deployment]].map(([e,t])=>(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:e}),(0,N.jsx)(`div`,{className:`mt-2 text-2xl font-semibold`,children:t})]},e))}),e.priorities.length>0?(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-[0.12em] text-muted-foreground`,children:`Next priorities`}),(0,N.jsx)(`div`,{className:`space-y-3`,children:e.priorities.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-background px-4 py-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(c,{to:`/skills/${encodeURIComponent(e.skill_name)}`,className:`text-sm font-medium hover:underline`,children:e.skill_name}),(0,N.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[11px] text-muted-foreground`,children:pf(e.next_step)})]}),(0,N.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e.summary}),(0,N.jsx)(`code`,{className:`mt-2 block overflow-x-auto rounded-md bg-muted/60 px-3 py-2 text-[11px] text-foreground`,children:e.recommended_command})]},e.skill_name))})]}):null]})]}):null}function hf({search:e,statusFilter:t,onStatusFilterChange:n,overviewQuery:r}){let{data:i,isPending:a,isError:o,error:s,refetch:l}=r,u=ff();if(a)return(0,N.jsxs)(`div`,{className:`@container/main flex flex-1 flex-col gap-6 py-6 px-4 lg:px-6`,children:[(0,N.jsx)(uf,{className:`h-[340px] rounded-xl`}),(0,N.jsxs)(`div`,{className:`grid grid-cols-12 gap-6`,children:[(0,N.jsx)(uf,{className:`col-span-12 @4xl/main:col-span-8 h-64 rounded-xl`}),(0,N.jsx)(uf,{className:`col-span-12 @4xl/main:col-span-4 h-64 rounded-xl`})]})]});if(o)return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 py-16`,children:[(0,N.jsx)(_e,{className:`size-10 text-destructive`}),(0,N.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:s instanceof Error?s.message:`Unknown error`}),(0,N.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>l(),children:[(0,N.jsx)(oe,{className:`mr-2 size-3.5`}),`Retry`]})]});if(!i)return(0,N.jsx)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 py-16`,children:(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No telemetry data found. Run some sessions first.`})});let{skills:d,autonomy_status:f,attention_queue:p,trust_watchlist:m,recent_decisions:h,overview:g,creator_testing:_}=i,v=u.data?.runs??[],y=v[0],b=v.reduce((e,t)=>e+t.deployed,0),x=v.reduce((e,t)=>e+t.evolved,0),S=v.reduce((e,t)=>e+t.watched,0),C=new Map;for(let e of g.evolution)!e.skill_name||C.has(e.skill_name)||C.set(e.skill_name,e);let w=d.map(e=>{let t=m.find(t=>t.skill_name===e.skill_name),n=e.testing_readiness?.next_step;return{skillName:e.skill_name,subtext:`${e.skill_scope??`Unscoped`} · ${e.total_checks} checks${n&&n!==`watch_deployment`?` · ${pf(n)}`:``}`,triggerRate:t?.pass_rate??e.pass_rate,routingConfidence:e.routing_confidence,confidenceCoverage:e.confidence_coverage,sessions:e.unique_sessions,lastEvolution:C.get(e.skill_name)??null,bucket:t?.bucket??`uncertain`,sortTimestamp:e.last_seen??null}});return(0,N.jsx)(lf,{autonomyStatus:f,lastRun:y?.timestamp??null,trustWatchlist:m,attentionItems:p,autonomousDecisions:h,renderSkillLink:e=>(0,N.jsx)(c,{to:`/skills/${encodeURIComponent(e)}`,className:`text-sm font-medium hover:underline`,children:e}),onboarding:{skillCount:d.length},heroActions:(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[f.attention_required>0?(0,N.jsx)(P,{size:`sm`,nativeButton:!1,render:(0,N.jsx)(`a`,{href:`#supervision-feed`}),children:`Review Attention Queue`}):(0,N.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`No action needed`}),(0,N.jsx)(P,{variant:`outline`,size:`sm`,nativeButton:!1,render:(0,N.jsx)(c,{to:`?action=evolve`}),children:`Run Evolution`})]}),trustRailFooter:(0,N.jsx)(c,{to:`/skills`,className:`text-xs font-medium text-primary hover:underline`,children:`View All Skills`}),comparison:{rows:w,libraryAction:(0,N.jsx)(c,{to:`/skills`,className:`text-xs font-medium text-primary hover:underline`,children:`View library`}),watchlist:{initialSkills:i.watched_skills}},sectionsBeforeFeed:(0,N.jsx)(mf,{data:_}),runSummary:{lastRun:y?.timestamp??null,deployed:b,evolved:x,watched:S,runCount:v.length,historyAction:(0,N.jsx)(c,{to:`/analytics`,className:`text-primary hover:underline`,children:`View full history`})}})}function gf(e){let[t,n,r]=e.split(`-`).map(Number);return!t||!n||!r?null:new Date(t,n-1,r)}function _f(){return(0,N.jsxs)(`div`,{className:`@container/main flex flex-1 flex-col gap-6 px-4 py-6 lg:px-6`,children:[(0,N.jsx)(`div`,{className:`h-12 w-80 animate-pulse rounded-xl bg-card`}),(0,N.jsxs)(`div`,{className:`grid grid-cols-12 gap-6`,children:[(0,N.jsx)(`div`,{className:`col-span-12 h-[380px] animate-pulse rounded-xl bg-card @4xl/main:col-span-8`}),(0,N.jsx)(`div`,{className:`col-span-12 h-[380px] animate-pulse rounded-xl bg-card @4xl/main:col-span-4`}),(0,N.jsx)(`div`,{className:`col-span-12 h-[320px] animate-pulse rounded-xl bg-card @4xl/main:col-span-7`}),(0,N.jsx)(`div`,{className:`col-span-12 h-[320px] animate-pulse rounded-xl bg-card @4xl/main:col-span-5`}),(0,N.jsx)(`div`,{className:`col-span-12 h-[140px] animate-pulse rounded-xl bg-card`})]})]})}function vf({data:e,isLoading:t,error:n,onRefresh:r,onRetry:i,headerActions:a,insightActions:o}){let[s,c]=(0,A.useState)(`pass_rate`),l=(0,A.useMemo)(()=>{if(!e?.pass_rate_trend.length)return null;let t=e.pass_rate_trend[e.pass_rate_trend.length-1];if(!t)return null;let n=gf(t.date);if(!n)return null;let r=new Date;r.setHours(0,0,0,0);let i=Math.max(0,Math.floor((r.getTime()-n.getTime())/864e5));return i===0?`today`:i===1?`1d ago`:`${i}d ago`},[e]),u=(0,A.useMemo)(()=>e?.skill_rankings?e.skill_rankings.toSorted((e,t)=>t.pass_rate-e.pass_rate).slice(0,5):[],[e]),d=(0,A.useMemo)(()=>u.length?u.reduce((e,t)=>e+t.pass_rate,0)/u.length:0,[u]),f=(0,A.useMemo)(()=>e?.evolution_impact?e.evolution_impact.filter(e=>e.pass_rate_after>e.pass_rate_before):[],[e]);if(t&&!e)return(0,N.jsx)(_f,{});if(n&&!e)return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 py-16`,children:[(0,N.jsx)(me,{className:`size-10 text-destructive`}),(0,N.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:n}),(0,N.jsxs)(P,{variant:`outline`,size:`sm`,onClick:i,children:[(0,N.jsx)(We,{className:`mr-2 size-3.5`}),`Retry`]})]});if(!e)return(0,N.jsx)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 py-16`,children:(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No analytics data available yet. Run some sessions and grading first.`})});let{summary:p}=e;return(0,N.jsxs)(`div`,{className:`@container/main flex flex-1 flex-col gap-8 px-4 py-8 lg:px-6`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,N.jsx)(`h1`,{className:`font-headline text-4xl font-bold tracking-tight text-foreground`,children:`Performance Analytics`}),(0,N.jsxs)(M,{variant:`outline`,className:`gap-1.5 border-primary/20 bg-primary/10 font-headline text-[10px] uppercase tracking-widest text-primary`,children:[(0,N.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-primary`}),`Live`]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:[l?`Last graded: ${l}`:`Awaiting first grading run`,p.active_skills>0&&` · ${p.active_skills} active skills`]})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsxs)(P,{variant:`secondary`,size:`sm`,onClick:r,className:`gap-1.5 font-headline text-[10px] uppercase tracking-widest`,children:[(0,N.jsx)(We,{className:`size-3`}),`Refresh`]}),a]})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-12 gap-6`,children:[(0,N.jsxs)(F,{className:`col-span-12 border-none bg-muted shadow-none @4xl/main:col-span-8`,children:[(0,N.jsxs)(I,{className:`pb-2`,children:[(0,N.jsx)(R,{className:`font-headline text-[10px] uppercase tracking-widest`,children:`Evolution Trajectory`}),(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsx)(L,{className:`font-headline text-lg`,children:`Evolution Impact Curve`}),(0,N.jsx)(`div`,{className:`flex items-center gap-1 rounded-lg bg-background p-0.5`,children:[{key:`pass_rate`,label:`Pass Rate`},{key:`volume`,label:`Check Volume`}].map(e=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>c(e.key),className:`rounded-md px-3 py-1 text-[10px] font-headline uppercase tracking-widest transition-colors ${s===e.key?`bg-secondary text-primary`:`text-muted-foreground hover:text-foreground`}`,children:e.label},e.key))})]})]}),(0,N.jsx)(z,{children:(0,N.jsx)(Jr,{data:e.pass_rate_trend,mode:s})})]}),(0,N.jsxs)(F,{className:`col-span-12 flex flex-col border-none bg-muted shadow-none @4xl/main:col-span-4`,children:[(0,N.jsxs)(I,{className:`pb-2`,children:[(0,N.jsx)(R,{className:`font-headline text-[10px] uppercase tracking-widest`,children:`Skill Rankings`}),(0,N.jsx)(L,{className:`font-headline text-lg`,children:`Skill Performance`})]}),(0,N.jsxs)(z,{className:`flex flex-1 flex-col`,children:[(0,N.jsx)(Yr,{skills:u}),(0,N.jsx)(`div`,{className:`mt-5 border-t border-border/20 pt-4`,children:(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsx)(`span`,{className:`font-headline text-[10px] uppercase tracking-widest text-muted-foreground`,children:`Avg Pass Rate`}),(0,N.jsx)(`span`,{className:`font-headline text-2xl font-bold text-primary`,children:u.length>0?`${Math.round(d*100)}%`:`--`})]})})]})]}),(0,N.jsxs)(F,{className:`col-span-12 border-none bg-muted shadow-none @4xl/main:col-span-7`,children:[(0,N.jsxs)(I,{className:`pb-2`,children:[(0,N.jsx)(R,{className:`font-headline text-[10px] uppercase tracking-widest`,children:`Grading Activity`}),(0,N.jsx)(L,{className:`font-headline text-lg`,children:`Check Activity Over Time`})]}),(0,N.jsx)(z,{className:`flex flex-1 flex-col`,children:(0,N.jsx)(Xr,{data:e.daily_activity})})]}),(0,N.jsxs)(F,{className:`col-span-12 border-none bg-muted shadow-none @4xl/main:col-span-5`,children:[(0,N.jsxs)(I,{className:`pb-2`,children:[(0,N.jsx)(R,{className:`font-headline text-[10px] uppercase tracking-widest`,children:`Evolution Outcomes`}),(0,N.jsx)(L,{className:`font-headline text-lg`,children:`Evolution ROI`})]}),(0,N.jsx)(z,{children:(0,N.jsx)(Zr,{impacts:e.evolution_impact})})]}),(0,N.jsx)(F,{className:`col-span-12 border-none bg-muted/60 shadow-none backdrop-blur-md`,children:(0,N.jsx)(z,{className:`pt-6`,children:(0,N.jsxs)(`div`,{className:`flex flex-col items-start justify-between gap-4 @3xl/main:flex-row @3xl/main:items-center`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`mb-2 font-headline text-[10px] uppercase tracking-widest text-muted-foreground`,children:`Data-Driven Insight`}),(0,N.jsx)(`p`,{className:`max-w-2xl text-[15px] leading-relaxed text-foreground`,children:f.length>0?`${f.length} skill${f.length===1?``:`s`} improved after evolution, averaging ${Math.round(p.avg_improvement*100)}% improvement. ${p.total_checks_30d} checks processed in the last 30 days across ${p.active_skills} active skills.`:p.total_checks_30d>0?`${p.total_checks_30d} checks processed in the last 30 days across ${p.active_skills} active skills. Run an evolution cycle to start improving skill pass rates.`:`Start grading sessions to generate performance insights. Run selftune orchestrate to begin the autonomous improvement loop.`})]}),o?(0,N.jsx)(`div`,{className:`flex shrink-0 items-center gap-3`,children:o}):null]})})})]}),(0,N.jsxs)(`div`,{className:`flex items-center justify-between px-1 font-headline text-[10px] uppercase tracking-widest text-muted-foreground`,children:[(0,N.jsxs)(`span`,{children:[p.total_evolutions,` evolution`,p.total_evolutions===1?``:`s`,` deployed`]}),(0,N.jsxs)(`span`,{children:[p.total_checks_30d,` checks (30d)`]}),(0,N.jsxs)(`span`,{children:[p.active_skills,` active skill`,p.active_skills===1?``:`s`]})]})]})}async function yf(){let e=await fetch(`/api/v2/analytics`);if(!e.ok)throw Error(`Failed to load analytics (${e.status})`);return await e.json()}function bf(){let{data:e,isPending:t,isError:n,error:r,refetch:i}=Cr({queryKey:[`analytics`],queryFn:yf,refetchInterval:3e4});return(0,N.jsx)(vf,{data:e??null,isLoading:t,error:n?r instanceof Error?r.message:`Failed to load analytics`:null,onRefresh:()=>{i()},onRetry:()=>{i()},headerActions:(0,N.jsxs)(P,{variant:`secondary`,size:`sm`,className:`gap-1.5 font-headline text-[10px] uppercase tracking-widest`,disabled:!0,"aria-disabled":`true`,title:`Export is not available yet.`,children:[(0,N.jsx)(pt,{className:`size-3`}),`Export`]}),insightActions:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(P,{size:`sm`,className:`font-headline text-[10px] uppercase tracking-widest`,disabled:!0,"aria-disabled":`true`,title:`Dashboard-triggered evolution is not available yet.`,children:`Run Evolution`}),(0,N.jsx)(P,{variant:`outline`,size:`sm`,className:`border-primary/20 font-headline text-[10px] uppercase tracking-widest text-primary hover:border-primary/40`,disabled:!0,"aria-disabled":`true`,title:`Detailed analytics drill-down is not available yet.`,children:`View Details`})]})})}function xf({evolution:e,activeProposal:t,onSelect:n,collapsedProposalCount:r=6}){let i=(0,A.useMemo)(()=>new Set(e.map(e=>e.proposal_id)).size,[e]),a=i>r,[o,s]=(0,A.useState)(!a),c=(0,A.useMemo)(()=>{if(o)return e;let t=new Set,n=[];for(let i of e){if(!t.has(i.proposal_id)){if(t.size>=r)continue;t.add(i.proposal_id)}n.push(i)}return n},[r,e,o]);return(0,N.jsx)(`aside`,{className:`w-full px-4 py-4 @5xl/main:w-[252px] @5xl/main:self-start @5xl/main:pr-0`,children:(0,N.jsx)(`div`,{className:`@5xl/main:sticky @5xl/main:top-16`,children:(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 px-3 py-3 text-xs ${o?`themed-scroll max-h-[26rem] overflow-y-auto @5xl/main:max-h-[calc(100svh-6rem)]`:`overflow-visible`}`,children:[(0,N.jsx)(id,{entries:c,selectedProposalId:t,onSelect:n}),a?(0,N.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`mt-2 flex w-full items-center justify-center gap-1.5 py-2 text-[11px] text-muted-foreground transition-colors hover:text-foreground`,children:[(0,N.jsx)(w,{className:`size-3 transition-transform duration-150 ${o?`rotate-180`:``}`}),o?`Collapse timeline`:`Show full timeline (${i} proposals)`]}):null]})})})}function Sf({evolution:e,activeProposal:t,onSelect:n,evidence:r,viewerProposalId:i,showViewer:a,emptyState:o}){return(0,N.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border/15 bg-card`,children:(0,N.jsxs)(`div`,{className:`flex flex-col @5xl/main:grid @5xl/main:grid-cols-[252px_minmax(0,1fr)] @5xl/main:items-start`,children:[e.length>0?(0,N.jsx)(xf,{evolution:e,activeProposal:t,onSelect:n}):null,(0,N.jsx)(`div`,{className:`min-w-0 p-4 @xl/main:p-5`,children:a?(0,N.jsx)(qu,{proposalId:i,evolution:e,evidence:r}):o??(0,N.jsx)(F,{className:`rounded-2xl`,children:(0,N.jsx)(z,{className:`py-12`,children:(0,N.jsx)(`div`,{className:`flex items-center justify-center text-sm text-muted-foreground`,children:`No recent evaluation evidence available`})})})})]})})}function Cf({invocations:e,sessionMetadata:t,callout:n}){return(0,N.jsxs)(`div`,{className:`space-y-2`,children:[n,(0,N.jsx)(Sd,{invocations:e,sessionMetadata:t})]})}function wf({examples:e,...t}){return(0,N.jsxs)(`div`,{"data-parity-root":`skill-report-evidence`,className:`space-y-6`,children:[e?(0,N.jsx)(yd,{examples:e}):null,(0,N.jsx)(Sf,{...t})]})}function Tf({evidenceQuality:e,dataHygiene:t,emptyState:n}){return!e&&!t?n??(0,N.jsx)(F,{className:`rounded-2xl border border-border/15 bg-card`,children:(0,N.jsx)(z,{className:`py-12`,children:(0,N.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:`Detailed data-quality metrics are not available for this skill yet.`})})}):(0,N.jsx)(bd,{evidenceQuality:e,dataHygiene:t})}function Ef(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);if(i<30)return`${i}d ago`;let a=new Date(e);return Number.isNaN(a.getTime())?e:a.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}function Df({rows:e,emptyState:t}){return e.length===0?t??(0,N.jsx)(`div`,{className:`rounded-lg border border-dashed border-border p-8 text-center text-sm text-muted-foreground`,children:`No missed queries detected.`}):(0,N.jsx)(`div`,{"data-parity-root":`skill-report-missed-queries`,className:`space-y-3`,children:e.map(e=>(0,N.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border border-border p-3`,children:[(0,N.jsx)(`div`,{className:`mt-0.5 h-2 w-2 shrink-0 rounded-full bg-orange-500`}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(`p`,{className:`truncate text-sm text-foreground`,children:e.query}),(0,N.jsxs)(`div`,{className:`mt-1 flex items-center gap-3 text-xs text-muted-foreground`,children:[e.confidence!==null&&(0,N.jsxs)(`span`,{className:`font-medium text-orange-600 dark:text-orange-400`,children:[(e.confidence*100).toFixed(0),`% confidence`]}),e.source?(0,N.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:e.source}):null,(0,N.jsx)(`span`,{children:Ef(e.createdAt)})]})]})]},e.id))})}var Of=`rounded-lg px-3 font-headline text-xs uppercase tracking-wider data-active:bg-background/70 data-active:text-foreground`;function kf({tabs:e,value:t,defaultValue:n,onValueChange:r}){let i=e.filter(e=>!e.hidden);if(i.length===0)return null;let a=i[0]?.value;return(0,N.jsxs)(St,{...t===void 0?{defaultValue:n??a,onValueChange:r}:{value:t,onValueChange:r},children:[(0,N.jsx)(wt,{variant:`line`,className:`rounded-xl border border-border/10 bg-muted/20 px-1.5 py-1`,children:i.map(e=>{let t=(0,N.jsxs)(N.Fragment,{children:[e.label,e.badge]});return e.tooltip?(0,N.jsxs)(Ot,{children:[(0,N.jsx)(kt,{render:(0,N.jsx)(Tt,{value:e.value,className:Of}),children:t}),(0,N.jsx)(At,{children:e.tooltip})]},e.value):(0,N.jsx)(Tt,{value:e.value,className:Of,children:t},e.value)})}),i.map(e=>(0,N.jsx)(Et,{value:e.value,className:e.contentClassName,children:e.content},e.value))]})}function Af({backLink:e,title:t,statusBadge:n,toolbarMeta:r,summary:i,showOnboardingBanner:a=!1,guideButtonLabel:o=`How to read this page`,prioritizeChildren:s=!1,nextAction:c,trustState:l,coverage:u,evidenceQuality:d,routingQuality:f,evolutionState:p,dataHygiene:m,fallbackChecks:h,fallbackSessions:g,fallbackEvidenceRows:_,fallbackEvolutionRows:v,fallbackLatestAction:y,nextActionText:b,children:x}){let[S,C]=(0,A.useState)(!1);return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(Id,{open:S,onOpenChange:C}),(0,N.jsxs)(`div`,{className:`@container/main flex flex-1 flex-col gap-5 p-4 lg:px-6 lg:pb-6 lg:pt-0`,children:[(0,N.jsxs)(`div`,{className:`sticky top-0 z-30 space-y-2 border-b border-border/15 bg-background/95 py-2.5 backdrop-blur supports-[backdrop-filter]:bg-background/85`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[e,(0,N.jsx)(`h1`,{className:`shrink-0 font-headline text-base font-semibold tracking-tight lg:text-lg`,children:t}),n,(0,N.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-4`,children:[(0,N.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>C(!0),children:o}),r]})]}),i?(0,N.jsx)(`div`,{className:`space-y-1.5 text-sm leading-relaxed text-muted-foreground`,children:i}):null]}),a?(0,N.jsx)(Ld,{onOpenGuide:()=>C(!0)}):null,(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsx)(fd,{nextAction:c,latestDecision:(p?.evolution_rows??v)>0&&(p?.latest_action??y)?{action:p?.latest_action??y??`No data`,timestamp:p?.latest_timestamp??null,evolutionCount:p?.evolution_rows??v}:void 0}),s&&x?(0,N.jsx)(`div`,{className:`space-y-4`,children:x}):null,(0,N.jsx)(_d,{trustState:l,coverage:u,evidenceQuality:d,routingQuality:f,evolutionState:p,dataHygiene:m,fallbackChecks:h,fallbackSessions:g,nextActionText:b,onOpenGuide:()=>C(!0)}),(0,N.jsx)(vd,{coverage:u,evidenceQuality:d,routingQuality:f,evolutionState:p,fallbackChecks:h,fallbackSessions:g,fallbackEvidenceRows:_,fallbackEvolutionRows:v,fallbackLatestAction:y})]}),x&&!s?(0,N.jsx)(`div`,{className:`space-y-4 border-t border-border/10 pt-4`,children:x}):null]})]})}function jf({state:e}){let t=Mf(e);return(0,N.jsxs)(M,{variant:t.variant,className:`gap-1 shrink-0 text-[10px]`,children:[t.icon,t.label]})}function Mf(e){switch(e){case`low_sample`:return{label:`Low Sample`,variant:`secondary`,icon:(0,N.jsx)(Oe,{className:`size-3`})};case`observed`:return{label:`Observed`,variant:`outline`,icon:(0,N.jsx)(b,{className:`size-3`})};case`watch`:return{label:`Watch`,variant:`secondary`,icon:(0,N.jsx)(it,{className:`size-3`})};case`validated`:return{label:`Validated`,variant:`default`,icon:(0,N.jsx)(Ue,{className:`size-3`})};case`deployed`:return{label:`Deployed`,variant:`default`,icon:(0,N.jsx)(Ue,{className:`size-3`})};case`rolled_back`:return{label:`Rolled Back`,variant:`destructive`,icon:(0,N.jsx)(et,{className:`size-3`})}}}var Nf=6e4;function Pf(e){return Cr({queryKey:[`skill-report`,e],queryFn:()=>Ir(e),enabled:!!e,staleTime:5e3,refetchInterval:Nf,retry:(e,t)=>t instanceof Br?!1:e<2})}function Ff(e){switch(e){case`generate_evals`:return`Generate evals`;case`run_unit_tests`:return`Run unit tests`;case`run_replay_dry_run`:return`Replay dry-run`;case`measure_baseline`:return`Measure baseline`;case`deploy_candidate`:return`Deploy candidate`;case`watch_deployment`:return`Watch deployment`}}function If(e){switch(e.next_step){case`generate_evals`:return{icon:(0,N.jsx)(O,{className:`size-5 text-primary`}),text:e.summary,actionLabel:`Generate evals`,variant:`default`};case`run_unit_tests`:return{icon:(0,N.jsx)(he,{className:`size-5 text-primary`}),text:e.summary,actionLabel:`Generate unit tests`,variant:`default`};case`run_replay_dry_run`:return{icon:(0,N.jsx)(oe,{className:`size-5 text-primary`}),text:e.summary,actionLabel:`Run replay dry-run`,variant:`secondary`};case`measure_baseline`:return{icon:(0,N.jsx)(Xe,{className:`size-5 text-primary`}),text:e.summary,actionLabel:`Measure baseline`,variant:`secondary`};case`deploy_candidate`:return{icon:(0,N.jsx)(x,{className:`size-5 text-primary`}),text:e.summary,actionLabel:`Deploy candidate`,variant:`outline`};case`watch_deployment`:return{icon:(0,N.jsx)(ue,{className:`size-5 text-primary`}),text:e.summary,actionLabel:`Watch deployment`,variant:`outline`}}}function Lf(e,t){switch(e.filter(e=>e.proposal_id===t).sort((e,t)=>(e.timestamp??``).localeCompare(t.timestamp??``)).at(-1)?.action){case`validated`:return{icon:(0,N.jsx)(ve,{className:`size-5 text-primary`}),text:`This proposal validated successfully. Review the evidence and deploy if it still looks right.`,actionLabel:`Deploy candidate`,variant:`default`};case`created`:return{icon:(0,N.jsx)(ce,{className:`size-5 text-primary`}),text:`This proposal has been generated and is ready for review. Inspect the evidence before deploying anything.`,actionLabel:`Review proposal`,variant:`default`};case`deployed`:return{icon:(0,N.jsx)(ue,{className:`size-5 text-primary`}),text:`This proposal has already been deployed. Review the evidence trail and keep watching live behavior.`,actionLabel:`Watch deployment`,variant:`outline`};case`rolled_back`:return{icon:(0,N.jsx)(dt,{className:`size-5 text-destructive`}),text:`This proposal was rolled back. Review the evidence trail before trying another change.`,actionLabel:`Inspect rollback`,variant:`destructive`};case`rejected`:return{icon:(0,N.jsx)(dt,{className:`size-5 text-destructive`}),text:`This proposal was rejected by validation. Review the failure evidence before retrying.`,actionLabel:`Review rejection`,variant:`destructive`};default:return{icon:(0,N.jsx)(ce,{className:`size-5 text-primary`}),text:`Review the selected proposal and its evidence trail.`,actionLabel:`Review proposal`,variant:`default`}}}function Rf({readiness:e}){return e?(0,N.jsxs)(F,{className:`rounded-2xl border-border/15`,children:[(0,N.jsxs)(I,{className:`gap-2`,children:[(0,N.jsx)(L,{className:`text-base`,children:`Creator test loop`}),(0,N.jsx)(R,{children:`Use this loop before trusting an evolution: generate evals, add unit tests, replay a dry-run, measure baseline, then deploy and watch.`})]}),(0,N.jsxs)(z,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(M,{variant:`secondary`,children:Ff(e.next_step)}),(0,N.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.summary})]}),(0,N.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-5`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:`Eval readiness`}),(0,N.jsx)(`div`,{className:`mt-2 text-sm font-medium`,children:e.eval_readiness===`log_ready`?`Log-ready`:e.eval_readiness===`cold_start_ready`?`Cold-start ready`:`Telemetry only`}),(0,N.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.eval_set_entries>0?`${e.eval_set_entries} canonical eval entries`:`${e.trusted_session_count} trusted sessions`})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:`Unit tests`}),(0,N.jsx)(`div`,{className:`mt-2 text-sm font-medium`,children:e.unit_test_cases>0?`${e.unit_test_cases} cases`:`Not generated`}),(0,N.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.unit_test_pass_rate==null?`No stored test run`:`Last run ${Math.round(e.unit_test_pass_rate*100)}%`})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:`Replay validation`}),(0,N.jsx)(`div`,{className:`mt-2 text-sm font-medium`,children:e.replay_check_count>0?`${e.replay_check_count} checks`:`Not recorded`}),(0,N.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.latest_validation_mode?`Latest mode: ${e.latest_validation_mode}`:`Use --validation-mode replay`})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:`Baseline`}),(0,N.jsx)(`div`,{className:`mt-2 text-sm font-medium`,children:e.baseline_sample_size>0?`${e.baseline_sample_size} samples`:`Not stored`}),(0,N.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.baseline_pass_rate==null?`Run grade baseline`:`Pass rate ${Math.round(e.baseline_pass_rate*100)}%`})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:`Deployment`}),(0,N.jsx)(`div`,{className:`mt-2 text-sm font-medium`,children:e.deployment_readiness===`ready_to_deploy`?`Ready to deploy`:e.deployment_readiness===`watching`?`Watching live`:e.deployment_readiness===`rolled_back`?`Rolled back`:`Blocked`}),(0,N.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.deployment_summary})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/30 bg-background px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:`Recommended command`}),(0,N.jsx)(`code`,{className:`mt-2 block overflow-x-auto text-[11px] text-foreground`,children:e.recommended_command})]}),e.deployment_command?(0,N.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/30 bg-background px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:`Deploy / watch command`}),(0,N.jsx)(`code`,{className:`mt-2 block overflow-x-auto text-[11px] text-foreground`,children:e.deployment_command})]}):null]})]}):null}function zf(e,t,n,r,i){return e===`low_sample`?{icon:(0,N.jsx)(ue,{className:`size-5`}),text:`Keep observing. This skill needs more sessions before trust can be assessed.`,actionLabel:`Keep observing`,variant:`secondary`}:e===`rolled_back`?{icon:(0,N.jsx)(dt,{className:`size-5 text-destructive`}),text:`Inspect rollback evidence before re-deploying.`,actionLabel:`Inspect rollback`,variant:`destructive`}:e===`watch`&&(n??0)>.05?{icon:(0,N.jsx)(dt,{className:`size-5 text-amber-500`}),text:`Clean source-truth data or routing data before trusting this report.`,actionLabel:`Clean data`,variant:`secondary`}:e===`watch`&&(t??0)>0?{icon:(0,N.jsx)(C,{className:`size-5 text-amber-500`}),text:`Generate evals to investigate missed triggers.`,actionLabel:`Generate evals`,variant:`secondary`}:e===`watch`?{icon:(0,N.jsx)(ue,{className:`size-5 text-amber-500`}),text:`This skill is under active observation. Review recent invocations to verify routing accuracy.`,actionLabel:`Review invocations`,variant:`secondary`}:r?{icon:(0,N.jsx)(ce,{className:`size-5 text-primary`}),text:`Review pending proposal.`,actionLabel:`Review proposal`,variant:`default`}:e===`validated`?{icon:(0,N.jsx)(ve,{className:`size-5 text-primary`}),text:`Deploy the validated candidate.`,actionLabel:`Deploy candidate`,variant:`default`}:e===`deployed`?{icon:(0,N.jsx)(he,{className:`size-5 text-green-500`}),text:`No action needed. Skill is healthy and being monitored.`,actionLabel:`Healthy`,variant:`outline`}:e===`observed`?{icon:(0,N.jsx)(ue,{className:`size-5 text-muted-foreground`}),text:`No action needed. Selftune is still observing this skill and building confidence from real usage.`,actionLabel:`Observed`,variant:`outline`}:{icon:(0,N.jsx)(ue,{className:`size-5`}),text:`Continue monitoring this skill.`,actionLabel:`Monitor`,variant:`outline`}}function Bf(){let{name:e}=i(),[t,n]=s(),{data:r,isPending:a,isError:o,error:l,refetch:u}=Pf(e),[d,f]=(0,A.useState)(`invocations`),p=r?.evolution??[],m=new Set(p.map(e=>e.proposal_id)),h=t.get(`proposal`),g=h&&m.has(h)?h:p.length>0?p[0].proposal_id:null,_=!!(h&&g);(0,A.useEffect)(()=>{if(!r)return;let e=t.get(`proposal`);if(g&&e!==g){let e=new URLSearchParams(t);e.set(`proposal`,g),n(e,{replace:!0});return}if(!g&&e){let e=new URLSearchParams(t);e.delete(`proposal`),n(e,{replace:!0})}},[r,g,t,n]);let v=e=>{let r=new URLSearchParams(t);r.set(`proposal`,e),n(r,{replace:!0})},y=r?.trust,b=r?.coverage,x=r?.evidence_quality,S=r?.routing_quality,C=r?.evolution_state,w=r?.data_hygiene,T=r?.examples,E=w?.raw_checks??b?.checks??r?.usage.total_checks??0,D=w?.operational_checks??b?.checks??r?.usage.total_checks??0,O=Math.max(E-D,0),ee=(C?.evolution_rows??p.length)>0,te=r?.testing_readiness??null,ne=ee?`evidence`:`invocations`;(0,A.useEffect)(()=>{f(ne)},[ne]);let re=(0,A.useMemo)(()=>{let e=(r?.canonical_invocations??[]).map(e=>({timestamp:e.timestamp||e.occurred_at||null,session_id:e.session_id,triggered:e.triggered,query:e.query??``,source:e.source??``,invocation_mode:e.invocation_mode??null,confidence:e.confidence??null,tool_name:e.tool_name??null,agent_type:e.agent_type??null,observation_kind:e.observation_kind??`canonical`,historical_context:e.historical_context??null}));return e.sort((e,t)=>(t.timestamp??``).localeCompare(e.timestamp??``)),e},[r?.canonical_invocations]);if(!e)return(0,N.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-16`,children:(0,N.jsx)(`p`,{className:`text-sm text-destructive`,children:`No skill name provided`})});if(a)return(0,N.jsxs)(`div`,{className:`@container/main flex flex-1 flex-col gap-6 p-4 lg:p-6`,children:[(0,N.jsx)(uf,{className:`h-10 w-64`}),(0,N.jsx)(`div`,{className:`grid grid-cols-1 gap-4 @xl/main:grid-cols-2 @5xl/main:grid-cols-4`,children:Array.from({length:4}).map((e,t)=>(0,N.jsx)(uf,{className:`h-28 rounded-2xl`},t))}),(0,N.jsx)(uf,{className:`h-20 rounded-2xl`}),(0,N.jsx)(uf,{className:`h-64 rounded-2xl`})]});if(o)return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 py-16`,children:[(0,N.jsx)(_e,{className:`size-10 text-destructive`}),(0,N.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:l instanceof Error?l.message:`Unknown error`}),(0,N.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>u(),children:[(0,N.jsx)(oe,{className:`mr-2 size-3.5`}),`Retry`]})]});if(!r)return(0,N.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-16`,children:(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No data yet`})});if((b?.checks??r.usage.total_checks)===0&&r.evidence.length===0&&r.evolution.length===0&&(r.canonical_invocations?.length??0)===0)return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 py-16`,children:[(0,N.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No data found for skill "`,e,`".`]}),(0,N.jsxs)(P,{variant:`outline`,size:`sm`,nativeButton:!1,render:(0,N.jsx)(c,{to:`/`}),children:[(0,N.jsx)(be,{className:`mr-2 size-3.5`}),`Back to Overview`]})]});let k=y?.state??`low_sample`,ie=zf(k,S?.miss_rate,x?.system_like_rate,C?.has_pending_proposals??r.pending_proposals.length>0,ee),ae=(_&&g?Lf(p,g):null)??(_||k===`rolled_back`||!te||te.next_step===`watch_deployment`?ie:If(te));return(0,N.jsxs)(Af,{backLink:(0,N.jsx)(P,{variant:`outline`,size:`sm`,nativeButton:!1,render:(0,N.jsx)(c,{to:`/`}),className:`shrink-0`,children:(0,N.jsx)(be,{className:`size-3.5`})}),title:r.skill_name,statusBadge:(0,N.jsx)(jf,{state:k}),toolbarMeta:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`div`,{className:`hidden @xl/main:flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,N.jsxs)(`span`,{className:`tabular-nums`,children:[(0,N.jsx)(`strong`,{className:`text-foreground`,children:b?.checks??r.usage.total_checks}),` `,`checks`]}),(0,N.jsx)(`span`,{className:`text-border`,children:`|`}),(0,N.jsxs)(`span`,{className:`tabular-nums`,children:[(0,N.jsx)(`strong`,{className:`text-foreground`,children:b?.sessions??r.sessions_with_skill}),` `,`sessions`]}),(0,N.jsx)(`span`,{className:`text-border`,children:`|`}),(0,N.jsxs)(`span`,{className:`tabular-nums`,children:[(0,N.jsx)(`strong`,{className:`text-foreground`,children:b?.workspaces??`No data`}),` `,`workspaces`]})]}),b?.first_seen||b?.last_seen?(0,N.jsxs)(`div`,{className:`hidden @3xl/main:flex items-center gap-2 font-mono text-[10px] text-muted-foreground`,children:[b?.first_seen?(0,N.jsx)(`span`,{title:`First seen`,children:W(b.first_seen)}):null,b?.first_seen&&b?.last_seen?(0,N.jsx)(`span`,{children:`-`}):null,b?.last_seen?(0,N.jsx)(`span`,{title:`Last seen`,children:W(b.last_seen)}):null]}):null]}),summary:y?.summary?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,N.jsx)(`span`,{children:y.summary}),C?.latest_action&&C?.latest_timestamp?(0,N.jsxs)(`span`,{className:`font-mono text-[11px] text-muted-foreground/70`,children:[`Latest: `,C.latest_action,` (`,W(C.latest_timestamp),`)`]}):null]}),O>0?(0,N.jsxs)(`div`,{className:`text-[12px] text-muted-foreground/80`,children:[`Based on `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:D}),` `,`real checks. `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:O}),` `,`internal or legacy rows are excluded from trust scoring.`]}):null]}):void 0,showOnboardingBanner:!_,guideButtonLabel:`How this works`,prioritizeChildren:_,nextAction:ae,trustState:k,coverage:b,evidenceQuality:x,routingQuality:S,evolutionState:C,dataHygiene:w,fallbackChecks:r.usage.total_checks,fallbackSessions:r.sessions_with_skill,fallbackEvidenceRows:r.evidence.length,fallbackEvolutionRows:p.length,fallbackLatestAction:p[0]?.action,nextActionText:ae.text,children:[_?null:(0,N.jsx)(Rf,{readiness:te}),(0,N.jsx)(kf,{value:d,onValueChange:e=>f(e),tabs:[{value:`evidence`,label:`Evidence`,tooltip:`Change history and validation results`,hidden:!ee,contentClassName:`space-y-6`,content:(0,N.jsx)(N.Fragment,{children:(0,N.jsx)(wf,{examples:T,evolution:p,activeProposal:g,onSelect:v,evidence:r.evidence,viewerProposalId:g??``,showViewer:!!g,emptyState:(0,N.jsx)(F,{className:`rounded-2xl`,children:(0,N.jsx)(z,{className:`py-12`,children:(0,N.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3 text-center`,children:[(0,N.jsx)(ue,{className:`size-8 text-muted-foreground/40`}),(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This skill is being observed but has no reviewable evolution evidence yet.`})]})})})})})},{value:`invocations`,label:`Invocations`,tooltip:`Real usage and repaired misses only. Internal selftune traffic and legacy residue are excluded from this working set.`,badge:(0,N.jsx)(M,{variant:`secondary`,className:`ml-1.5 text-[10px]`,children:re.length}),content:(0,N.jsx)(Cf,{invocations:re,sessionMetadata:r?.session_metadata??[],callout:O>0?(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-muted/20 px-4 py-3 text-sm text-muted-foreground`,children:[`Showing`,` `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:re.length}),` `,`operational invocations.`,` `,(0,N.jsx)(`span`,{className:`font-medium text-foreground`,children:O}),` internal or legacy rows are tracked in Data Quality instead of being mixed into this working set.`]}):void 0})},{value:`missed`,label:`Missed Queries`,hidden:(T?.missed.length??0)===0,tooltip:`Queries that look like missed triggers from real usage.`,badge:(T?.missed.length??0)>0?(0,N.jsx)(M,{variant:`secondary`,className:`ml-1.5 text-[10px]`,children:T?.missed.length??0}):void 0,contentClassName:`pt-2`,content:(0,N.jsx)(Df,{rows:(T?.missed??[]).map((e,t)=>({id:`${e.session_id}:${e.timestamp??t}`,query:e.query_text,confidence:e.confidence,source:e.source??e.platform??null,createdAt:e.timestamp??``}))})},{value:`data-quality`,label:`Data Quality`,tooltip:`Evidence quality metrics and data hygiene`,content:(0,N.jsx)(Tf,{evidenceQuality:x,dataHygiene:w})}]})]})}function Vf({skills:e,heroSkill:t,aggregatePassRate:n,gradedCount:r,pendingProposals:i,isLoading:a,error:o,onRetry:s,renderHeroActions:c,renderCardActions:l}){let[u,d]=(0,A.useState)(`ALL`),[f,p]=(0,A.useState)(!0),m=(0,A.useMemo)(()=>{let t=e;return u!==`ALL`&&(t=t.filter(e=>e.status===u)),f?t.reduceRight((e,t)=>(e.push(t),e),[]):t},[u,e,f]),h=(0,A.useMemo)(()=>{let t={ALL:e.length,HEALTHY:0,WARNING:0,CRITICAL:0,UNGRADED:0};for(let n of e)n.status in t&&t[n.status]++;return t},[e]);return a?(0,N.jsx)(Vd,{}):o?(0,N.jsx)(Yd,{message:o,onRetry:s}):(0,N.jsxs)(`div`,{"data-parity-root":`skills-library`,className:`@container/main flex flex-1 animate-in fade-in flex-col gap-8 px-4 py-8 duration-500 lg:px-6`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h1`,{className:`font-headline text-4xl font-bold tracking-tight text-foreground`,children:`Skills Library`}),(0,N.jsx)(`p`,{className:`mt-2 max-w-2xl text-sm text-muted-foreground`,children:`Monitor and manage your evolving skill definitions across all scopes.`})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-12 gap-6`,children:[t?(0,N.jsx)(Hd,{skillName:t.skillName,skillScope:t.skillScope??null,platforms:t.platforms,passRate:t.passRate,totalChecks:t.totalChecks,uniqueSessions:t.uniqueSessions,status:t.status,latestEvolutionTimestamp:t.latestEvolutionTimestamp??null,renderActions:c}):(0,N.jsx)(qd,{}),(0,N.jsxs)(`div`,{className:`col-span-12 flex flex-col gap-6 lg:col-span-4`,children:[(0,N.jsx)(Ud,{aggregatePassRate:n,gradedCount:r}),(0,N.jsx)(Wd,{proposals:i})]})]}),(0,N.jsxs)(`div`,{className:`space-y-6`,children:[(0,N.jsx)(Kd,{filter:u,onFilterChange:d,counts:h,sortDesc:f,onSortToggle:()=>p(e=>!e)}),m.length>0?(0,N.jsx)(`div`,{className:`grid grid-cols-1 gap-6 md:grid-cols-2 xl:grid-cols-3`,children:m.map(e=>(0,N.jsx)(Gd,{skill:e,renderActions:l},e.name))}):(0,N.jsx)(Jd,{})]})]})}function Hf(e){return Kr(e.map(e=>({name:e.skill_name,scope:e.skill_scope,platforms:[],passRate:e.total_checks>0?e.pass_rate:null,checks:e.total_checks,status:Wr(e.pass_rate,e.total_checks),uniqueSessions:e.unique_sessions,triggeredCount:e.triggered_count,lastSeen:e.last_seen})))}function Uf(e){let t=e.filter(e=>e.total_checks>=5);if(t.length===0)return null;let n=t.reduce((e,t)=>e+t.total_checks,0),r=t.reduce((e,t)=>e+Math.round(t.pass_rate*t.total_checks),0);return n>0?r/n:null}function Wf(e,t){let n=[...t].filter(e=>e.skill_name).sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime());for(let t of n){let n=e.find(e=>e.skill_name===t.skill_name);if(n)return{skill:n,latestEvolution:t}}return e.length>0?{skill:[...e].sort((e,t)=>t.total_checks-e.total_checks)[0],latestEvolution:n[0]??null}:null}function Gf(e){let t=encodeURIComponent(e);return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(c,{to:`/skills/${t}`,className:`px-6 py-2 rounded-xl text-muted-foreground font-bold hover:bg-input transition-colors`,children:`Configure`}),(0,N.jsx)(c,{to:`/skills/${t}`,className:`px-8 py-2 bg-primary text-primary-foreground font-bold rounded-xl shadow-[0_4px_20px_rgba(79,242,255,0.2)] hover:shadow-[0_4px_25px_rgba(79,242,255,0.4)] transition-all`,children:`View Report`})]})}function Kf(e){let t=encodeURIComponent(e);return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(c,{to:`/skills/${t}`,className:`flex-1 py-2 text-xs font-bold text-muted-foreground bg-muted rounded-lg text-center hover:bg-input transition-colors`,children:`Configure`}),(0,N.jsx)(c,{to:`/skills/${t}`,className:`flex-1 py-2 text-xs font-bold text-muted-foreground bg-secondary rounded-lg text-center hover:bg-input hover:text-foreground transition-all`,children:`View Report`})]})}function qf({overviewQuery:e}){let{data:t,isLoading:n,isError:r,error:i,refetch:a}=e,o=(0,A.useMemo)(()=>t?Hf(t.skills):[],[t]),s=(0,A.useMemo)(()=>t?Wf(t.skills,t.overview.evolution):null,[t]),c=(0,A.useMemo)(()=>s?{skillName:s.skill.skill_name,skillScope:s.skill.skill_scope,passRate:s.skill.total_checks>0?s.skill.pass_rate:null,totalChecks:s.skill.total_checks,uniqueSessions:s.skill.unique_sessions,status:Wr(s.skill.pass_rate,s.skill.total_checks),latestEvolutionTimestamp:s.latestEvolution?.timestamp??null}:null,[s]),l=(0,A.useMemo)(()=>t?t.overview.pending_proposals.map(e=>({id:e.proposal_id,skillName:e.skill_name??null,action:e.action})):[],[t]);return(0,N.jsx)(Vf,{skills:o,heroSkill:c,aggregatePassRate:t?Uf(t.skills):null,gradedCount:t?t.skills.filter(e=>e.total_checks>=5).length:0,pendingProposals:l,isLoading:n,error:r?i instanceof Error?i.message:`Failed to load skills library.`:null,onRetry:()=>{a()},renderHeroActions:Gf,renderCardActions:Kf})}var Jf=6e4;function Yf(){return Cr({queryKey:[`doctor`],queryFn:zr,staleTime:5e3,refetchInterval:Jf})}var Xf={pass:{color:`text-primary`,label:`Pass`,dotColor:`bg-primary`,dotGlow:`shadow-[0_0_8px_rgba(79,242,255,0.6)]`,animate:!0},warn:{color:`text-amber-400`,label:`Warn`,dotColor:`bg-amber-400`,dotGlow:``,animate:!1},fail:{color:`text-destructive`,label:`Fail`,dotColor:`bg-destructive`,dotGlow:`shadow-[0_0_8px_rgba(255,180,171,0.6)]`,animate:!1}},Zf={config:{label:`Configuration`,description:`selftune.json exists and contains valid agent_type and llm_mode`,icon:(0,N.jsx)(pe,{className:`size-4`})},log_session_telemetry:{label:`Session Telemetry Log`,description:`session_telemetry_log.jsonl exists and records parse correctly`,icon:(0,N.jsx)(ne,{className:`size-4`})},log_skill_usage:{label:`Skill Usage Log`,description:`skill_usage_log.jsonl exists and records parse correctly`,icon:(0,N.jsx)(ne,{className:`size-4`})},log_all_queries:{label:`Query Log`,description:`all_queries_log.jsonl exists and records parse correctly`,icon:(0,N.jsx)(ne,{className:`size-4`})},log_evolution_audit:{label:`Evolution Audit Log`,description:`evolution_audit_log.jsonl exists and records parse correctly`,icon:(0,N.jsx)(ne,{className:`size-4`})},hook_settings:{label:`Hook Installation`,description:`Claude Code settings.json has all required selftune hooks configured`,icon:(0,N.jsx)(Be,{className:`size-4`})},evolution_audit:{label:`Evolution Health`,description:`Evolution audit log is intact and records are well-formed`,icon:(0,N.jsx)(y,{className:`size-4`})},dashboard_freshness_mode:{label:`Dashboard Freshness`,description:`The current dashboard still invalidates live updates from JSONL log watchers. SQLite WAL live invalidation has not been cut over yet.`,icon:(0,N.jsx)(ie,{className:`size-4`})}};function Qf(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.workspace_root==`string`&&typeof t.git_sha==`string`&&typeof t.db_path==`string`&&typeof t.process_mode==`string`&&(t.watcher_mode===`wal`||t.watcher_mode===`jsonl`||t.watcher_mode===`none`)}function $f({refreshKey:e}){let[t,n]=(0,A.useState)(null);if((0,A.useEffect)(()=>{fetch(`/api/health`).then(e=>e.json()).then(e=>{Qf(e)&&n(e)}).catch(()=>{})},[e]),!t)return null;let r=t.watcher_mode===`jsonl`?{className:`border-amber-400/25 bg-amber-400/10 text-amber-400`,label:`Legacy watcher path active`}:t.watcher_mode===`none`?{className:`border-muted-foreground/20 bg-muted/40 text-muted-foreground`,label:`Watcher inactive`}:{className:`border-primary/25 bg-primary/10 text-primary`,label:`Live invalidation active`};return(0,N.jsxs)(`section`,{className:`glass-panel rounded-2xl border border-border/15 p-6`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 md:flex-row md:items-end md:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-[10px] font-headline uppercase tracking-[0.2em] text-muted-foreground`,children:`Runtime Environment`}),(0,N.jsx)(`h2`,{className:`mt-1 font-headline text-xl font-semibold text-foreground`,children:`Active dashboard runtime`})]}),(0,N.jsx)(M,{variant:`outline`,className:r.className,children:r.label})]}),(0,N.jsxs)(`div`,{className:`mt-5 grid gap-3 md:grid-cols-2 xl:grid-cols-4`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-background/35 p-4`,children:[(0,N.jsx)(`p`,{className:`text-[10px] font-headline uppercase tracking-[0.18em] text-muted-foreground`,children:`Process mode`}),(0,N.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-foreground`,children:t.process_mode})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-background/35 p-4`,children:[(0,N.jsx)(`p`,{className:`text-[10px] font-headline uppercase tracking-[0.18em] text-muted-foreground`,children:`Watcher mode`}),(0,N.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-foreground`,children:t.watcher_mode})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-background/35 p-4`,children:[(0,N.jsx)(`p`,{className:`text-[10px] font-headline uppercase tracking-[0.18em] text-muted-foreground`,children:`SPA mode`}),(0,N.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-foreground`,children:t.spa_mode??`dist`})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-background/35 p-4`,children:[(0,N.jsx)(`p`,{className:`text-[10px] font-headline uppercase tracking-[0.18em] text-muted-foreground`,children:`Git SHA`}),(0,N.jsx)(`p`,{className:`mt-2 truncate font-mono text-sm text-foreground`,children:t.git_sha})]})]}),(0,N.jsxs)(`div`,{className:`mt-3 grid gap-3 md:grid-cols-2`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-background/35 p-4`,children:[(0,N.jsx)(`p`,{className:`text-[10px] font-headline uppercase tracking-[0.18em] text-muted-foreground`,children:`SPA build`}),(0,N.jsx)(`p`,{className:`mt-2 truncate font-mono text-sm text-foreground`,children:t.spa_build_id??t.version}),t.spa_proxy_url?(0,N.jsx)(`p`,{className:`mt-1 truncate text-xs text-muted-foreground`,children:t.spa_proxy_url}):null]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-border/10 bg-background/35 p-4`,children:[(0,N.jsx)(`p`,{className:`text-[10px] font-headline uppercase tracking-[0.18em] text-muted-foreground`,children:`Database path`}),(0,N.jsx)(`p`,{className:`mt-2 truncate font-mono text-sm text-foreground`,children:t.db_path})]})]}),(0,N.jsxs)(`div`,{className:`mt-3 rounded-xl border border-border/10 bg-background/35 p-4`,children:[(0,N.jsx)(`p`,{className:`text-[10px] font-headline uppercase tracking-[0.18em] text-muted-foreground`,children:`Workspace root`}),(0,N.jsx)(`p`,{className:`mt-2 break-all font-mono text-sm text-foreground`,children:t.workspace_root})]})]})}function ep({check:e}){let t=Zf[e.name]??{label:e.name,description:``,icon:(0,N.jsx)(ie,{className:`size-4`})},n=Xf[e.status]??{color:`text-muted-foreground`,label:e.status,dotColor:`bg-muted-foreground`,dotGlow:``,animate:!1};return(0,N.jsxs)(`div`,{className:`group flex items-start gap-4 px-6 py-4 border-b border-border/10 last:border-b-0 hover:bg-secondary/40 transition-colors`,children:[(0,N.jsx)(`div`,{className:`mt-1.5 flex-shrink-0`,children:(0,N.jsx)(`span`,{className:`block size-1.5 rounded-full ${n.dotColor} ${n.dotGlow} ${n.animate?`animate-pulse`:``}`})}),(0,N.jsx)(`div`,{className:`flex-shrink-0 mt-0.5 text-muted-foreground`,children:t.icon}),(0,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`text-sm font-semibold text-foreground`,children:t.label}),t.description&&(0,N.jsx)(ad,{text:t.description})]}),(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5 leading-relaxed`,children:e.message||`No details`}),e.path&&(0,N.jsx)(`p`,{className:`text-[11px] text-muted-foreground/60 font-mono mt-1 truncate`,children:e.path})]}),(0,N.jsx)(`div`,{className:`flex-shrink-0`,children:(0,N.jsxs)(`div`,{className:`inline-flex items-center gap-2 px-2 py-1 rounded-md ${e.status===`pass`?`bg-primary/10`:e.status===`fail`?`bg-destructive/10`:`bg-amber-400/10`}`,children:[(0,N.jsx)(`span`,{className:`size-1.5 rounded-full ${n.dotColor} ${n.animate?`animate-pulse`:``}`}),(0,N.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-tighter font-headline ${n.color}`,children:n.label})]})})]})}function tp(){let{data:e,isPending:t,isError:n,error:r,refetch:i}=Yf(),[a,o]=(0,A.useState)(0);if(t)return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col gap-8 p-8`,children:[(0,N.jsx)(uf,{className:`h-12 w-64`}),(0,N.jsx)(uf,{className:`h-24 rounded-xl`}),(0,N.jsx)(uf,{className:`h-[400px] rounded-xl`})]});if(n)return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 py-16`,children:[(0,N.jsx)(_e,{className:`size-10 text-destructive`}),(0,N.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:r instanceof Error?r.message:`Unknown error`}),(0,N.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>i(),children:[(0,N.jsx)(oe,{className:`mr-2 size-3.5`}),`Retry`]})]});if(!e)return(0,N.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-16`,children:(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No diagnostics data available.`})});let{checks:s,summary:c,healthy:l=!1,timestamp:u}=e,d=s??[],f=c??{pass:0,warn:0,fail:0},p=f.pass+f.warn+f.fail,m=d.filter(e=>e.name===`config`),h=d.filter(e=>e.name.startsWith(`log_`)),g=d.filter(e=>e.name===`hook_settings`),_=d.filter(e=>e.name===`evolution_audit`),v=d.filter(e=>e.name===`dashboard_freshness_mode`),y=new Set([`config`,...h.map(e=>e.name),`hook_settings`,`evolution_audit`,`dashboard_freshness_mode`]),b=d.filter(e=>!y.has(e.name)),x=[{title:`Configuration`,checks:m},{title:`Log Files`,checks:h},{title:`Hooks`,checks:g},{title:`Evolution`,checks:_},{title:`Integrity`,checks:v},{title:`Other`,checks:b}].filter(e=>e.checks.length>0);return(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col gap-8 p-8 max-w-5xl mx-auto w-full`,children:[(0,N.jsxs)(`section`,{className:`flex flex-col md:flex-row md:items-end justify-between gap-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h1`,{className:`font-headline text-4xl font-bold tracking-tight text-foreground`,children:`System Status`}),(0,N.jsx)(`p`,{className:`text-muted-foreground max-w-md mt-1`,children:`Diagnostics and health checks for selftune infrastructure.`})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,N.jsxs)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-widest font-headline`,children:[`Last checked `,u?W(u):`—`]}),(0,N.jsx)(P,{"aria-label":`Refresh status`,variant:`ghost`,size:`sm`,onClick:()=>{o(e=>e+1),i()},className:`shrink-0`,children:(0,N.jsx)(oe,{className:`size-3.5`})})]})]}),(0,N.jsxs)(`div`,{className:`glass-panel rounded-2xl border border-border/15 p-6 flex items-center justify-between overflow-hidden relative`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-8`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col`,children:[(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-[0.2em] font-headline mb-1`,children:`Overall`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l?(0,N.jsx)(`span`,{className:`size-3 rounded-full bg-primary animate-pulse shadow-[0_0_12px_rgba(79,242,255,0.6)]`}):(0,N.jsx)(`span`,{className:`size-3 rounded-full bg-destructive shadow-[0_0_12px_rgba(255,180,171,0.6)]`}),(0,N.jsx)(`span`,{className:`font-headline text-2xl font-bold text-foreground`,children:l?`Healthy`:`Unhealthy`})]})]}),(0,N.jsx)(`div`,{className:`h-10 w-px bg-border/20`}),(0,N.jsxs)(`div`,{className:`flex flex-col`,children:[(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-[0.2em] font-headline mb-1`,children:`Passed`}),(0,N.jsx)(`span`,{className:`font-headline text-2xl font-bold text-primary`,children:f.pass})]}),(0,N.jsxs)(`div`,{className:`flex flex-col`,children:[(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-[0.2em] font-headline mb-1`,children:`Warnings`}),(0,N.jsx)(`span`,{className:`font-headline text-2xl font-bold ${f.warn>0?`text-amber-400`:`text-foreground`}`,children:f.warn})]}),(0,N.jsxs)(`div`,{className:`flex flex-col`,children:[(0,N.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-[0.2em] font-headline mb-1`,children:`Failed`}),(0,N.jsx)(`span`,{className:`font-headline text-2xl font-bold ${f.fail>0?`text-destructive`:`text-foreground`}`,children:f.fail})]})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,N.jsxs)(`div`,{className:`text-right`,children:[(0,N.jsxs)(`p`,{className:`text-xs font-bold text-foreground font-headline`,children:[p,` Checks`]}),(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:f.pass===p?`All checks passing`:`${f.fail+f.warn} issue${f.fail+f.warn===1?``:`s`} detected`})]}),(0,N.jsx)(`div`,{className:`size-12 rounded-full flex items-center justify-center border-4 border-primary/20 border-t-primary`,children:(0,N.jsx)(re,{className:`size-5 text-primary`})})]}),(0,N.jsx)(`div`,{className:`absolute -right-20 -bottom-20 w-64 h-64 bg-primary/5 blur-3xl rounded-full pointer-events-none`})]}),(0,N.jsx)($f,{refreshKey:a}),(0,N.jsx)(`div`,{className:`bg-muted rounded-2xl border border-border/15 overflow-hidden`,children:x.map((e,t)=>(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`px-6 py-3 bg-secondary/60 border-b border-border/15`,children:[(0,N.jsx)(`span`,{className:`text-[10px] font-bold text-muted-foreground uppercase tracking-[0.2em] font-headline`,children:e.title}),(0,N.jsx)(M,{variant:`outline`,className:`ml-3 text-[10px] px-1.5 py-0 border-border/40 text-muted-foreground`,children:e.checks.length})]}),e.checks.map((e,t)=>(0,N.jsx)(ep,{check:e},`${e.name}-${t}`)),t<x.length-1&&(0,N.jsx)(`div`,{className:`border-b border-border/25`})]},e.title))})]})}var np={host:`local`,plan:`oss`,features:{analytics:!0,registry:!1,signals:!1,proposals:!1,billing:!1,teamAdmin:!1,runtimeStatus:!0},discoverable:{registry:!0,signals:!0,proposals:!0,billing:!1}};function rp(e){return{version:e.version,summary:{totalSkills:e.skills.length,avgPassRate30d:e.skills.length?e.skills.reduce((e,t)=>e+t.pass_rate,0)/e.skills.length:null,unmatchedCount30d:e.overview.unmatched_queries.length,sessionsCount30d:e.overview.counts.sessions,pendingCount:e.overview.pending_proposals.length,evidenceCount:e.overview.counts.evidence},autonomy:{level:e.autonomy_status.level,summary:e.autonomy_status.summary,attentionRequired:e.autonomy_status.attention_required,skillsObserved:e.autonomy_status.skills_observed,pendingReviews:e.autonomy_status.pending_reviews,lastRunAt:e.autonomy_status.last_run},skillCards:e.skills.map(e=>({name:e.skill_name,scope:e.skill_scope,platforms:e.skill_scope?[e.skill_scope]:[],passRate:e.pass_rate,checks:e.total_checks,status:e.pass_rate>=.8?`HEALTHY`:e.pass_rate>=.6?`WARNING`:e.total_checks>0?`CRITICAL`:`UNKNOWN`,hasEvidence:e.has_evidence,uniqueSessions:e.unique_sessions,lastSeen:e.last_seen})),watchlist:e.trust_watchlist.map(e=>({skillName:e.skill_name,bucket:e.bucket,lastSeen:e.last_seen,passRate:e.pass_rate,checks:e.checks})),attention:e.attention_queue.map(e=>({skillName:e.skill_name,severity:e.severity,title:e.category.replace(/_/g,` `),body:e.reason})),decisions:e.recent_decisions.map(e=>({skillName:e.skill_name,kind:e.kind,timestamp:e.timestamp,summary:e.summary})),activity:e.overview.recent_activity.map(e=>({id:`${e.session_id}:${e.timestamp}`,type:e.triggered?`evolution`:`unmatched`,skillName:e.skill_name,timestamp:e.timestamp,title:e.skill_name,summary:e.query})),jobs:[],signals:null}}function ip(e){return{items:e.skills.map(e=>({name:e.skill_name,platforms:e.skill_scope?[e.skill_scope]:[],status:e.pass_rate>=.8?`HEALTHY`:e.pass_rate>=.6?`WARNING`:e.total_checks>0?`CRITICAL`:`UNKNOWN`,passRate:e.pass_rate,totalChecks:e.total_checks,uniqueSessions:e.unique_sessions,evidenceCount:e.has_evidence?1:0,lastSeen:e.last_seen}))}}function ap(e){return{summary:{activeSkills:e.summary.active_skills,totalChecks30d:e.summary.total_checks_30d,totalEvolutions:e.summary.total_evolutions,avgImprovement:e.summary.avg_improvement},passRateTrend:e.pass_rate_trend.map(e=>({date:e.date,passRate:e.pass_rate,checkVolume:e.total_checks})),skillRankings:e.skill_rankings.map((e,t)=>({skillName:e.skill_name,passRate:e.pass_rate,totalChecks:e.total_checks,rank:t+1})),dailyActivity:e.daily_activity.map(e=>({date:e.date,checks:e.checks})),evolutionImpact:e.evolution_impact.map(e=>({skillName:e.skill_name,passRateBefore:e.pass_rate_before,passRateAfter:e.pass_rate_after,improvement:e.pass_rate_after-e.pass_rate_before}))}}async function op(){let e=await fetch(`/api/health`);if(!e.ok)throw Error(`API error: ${e.status} ${e.statusText}`);let t=await e.json();return{workspaceRoot:t.workspace_root,gitSha:t.git_sha,dbPath:t.db_path,processMode:t.process_mode,watcherMode:t.watcher_mode}}async function sp(e){let t=await fetch(`/api/actions/watchlist`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({skills:e})});if(!t.ok)throw Error(`API error: ${t.status} ${t.statusText}`);let n=await t.json();return Array.isArray(n.watched_skills)?n.watched_skills:e}var cp={useSession(){return{status:`authenticated`,user:{name:`Admin Node`,subtitle:`Active`}}},api:{async fetchOverview(){return rp(await Fr())},async fetchSkills(){return ip(await Fr())},async fetchAnalytics(){return ap(await Rr())},fetchRuntimeHealth:op},links:{upgrade:`https://selftune.dev/pricing`,docs:`https://docs.selftune.dev`,cloudDashboard:`https://selftune.dev`},actions:{openUpgrade(){typeof window<`u`&&window.open(`https://selftune.dev/pricing`,`_blank`,`noopener,noreferrer`)},updateOverviewWatchlist:sp}},lp=new or({defaultOptions:{queries:{refetchOnWindowFocus:!0,gcTime:300*1e3}}});function up({href:e,className:t,children:n,onClick:r}){return(0,N.jsx)(c,{to:e,className:t,onClick:r,children:n})}function dp({routeId:e}){let t=Zt(`local`,np).find(t=>t.id===e);return!t||t.access!==`locked`||!t.lockedTitle||!t.lockedBody?null:(0,N.jsx)(Vt,{eyebrow:`Cloud feature`,title:t.lockedTitle,description:t.lockedBody,highlights:t.lockedHighlights,primaryAction:{href:t.lockedPrimaryCtaHref??`https://selftune.dev/pricing`,label:t.lockedPrimaryCtaLabel??`View cloud plans`},secondaryAction:t.lockedSecondaryCtaHref&&t.lockedSecondaryCtaLabel?{href:t.lockedSecondaryCtaHref,label:t.lockedSecondaryCtaLabel}:void 0,note:`Keep using the local dashboard for offline diagnostics and day-to-day health checks. Cloud adds the shared coordination layer.`})}function fp(e,t){let n=$t(e,t);if(n?.id===`skills`&&n.matchKind===`detail`)return{title:decodeURIComponent(e.slice(8)),icon:(0,N.jsx)(xe,{className:`size-4 text-primary`}),badge:n.badge,backHref:n.backHref,backLabel:n.backLabel};if(n){let e=n.icon;return{title:n.title,icon:(0,N.jsx)(e,{className:`size-4 text-primary`}),badge:n.badge,backHref:n.backHref,backLabel:n.backLabel}}return{title:`Dashboard`,icon:void 0,badge:`Overview`,backHref:null,backLabel:null}}function pp(){Ur();let[e,t]=(0,A.useState)(`ALL`),n=Hr(),{data:i}=n,a=l(),s=f(),c=Zt(`local`,np),u=c.map(e=>{let t=e.icon;return{href:e.path,label:e.label,icon:(0,N.jsx)(t,{className:`size-4`}),tooltip:e.tooltip,isActive:Qt(a.pathname,e),isLocked:e.access===`locked`}}),p=[...c.map(e=>{let t=e.icon;return{id:`page:${e.id}`,group:`Pages`,label:e.label,meta:e.tooltip,leading:(0,N.jsx)(t,{className:`size-4`}),trailing:e.access===`locked`?`Locked`:void 0,onSelect:()=>s(e.path)}}),...(i?.skills??[]).map(e=>{let t=Wr(e.pass_rate,e.total_checks),n=t===`HEALTHY`?`bg-primary`:t===`WARNING`?`bg-primary-accent`:t===`CRITICAL`?`bg-destructive`:`bg-muted-foreground`;return{id:`skill:${e.skill_name}`,group:`Skills`,label:e.skill_name,meta:`Skill report`,keywords:[e.skill_scope??``,t],leading:(0,N.jsx)(`span`,{className:`size-2 rounded-full ${n}`}),trailing:Gr(e.total_checks>0?e.pass_rate:null),onSelect:()=>s(`/skills/${encodeURIComponent(e.skill_name)}`)}})];return(0,N.jsx)(Rt,{brand:{href:`/`,name:`Selftune`,caption:`Skill Evolution Engine`,footerLabel:i?.version?`selftune v${i.version}`:`selftune`},navItems:u,renderLink:up,headerMeta:fp(a.pathname,c),searchItems:p,headerUser:{name:`Admin Node`,subtitle:`Active`},contentClassName:null,overlay:(0,N.jsx)(Er,{}),children:(0,N.jsxs)(r,{children:[(0,N.jsx)(o,{path:`/`,element:(0,N.jsx)(hf,{search:``,statusFilter:e,onStatusFilterChange:t,overviewQuery:n})}),(0,N.jsx)(o,{path:`/skills`,element:(0,N.jsx)(qf,{overviewQuery:n})}),(0,N.jsx)(o,{path:`/skills-library`,element:(0,N.jsx)(d,{replace:!0,to:`/skills`})}),(0,N.jsx)(o,{path:`/analytics`,element:(0,N.jsx)(bf,{})}),(0,N.jsx)(o,{path:`/skills/:name`,element:(0,N.jsx)(Bf,{})}),(0,N.jsx)(o,{path:`/registry`,element:(0,N.jsx)(dp,{routeId:`registry`})}),(0,N.jsx)(o,{path:`/signals`,element:(0,N.jsx)(dp,{routeId:`signals`})}),(0,N.jsx)(o,{path:`/community`,element:(0,N.jsx)(d,{replace:!0,to:`/signals`})}),(0,N.jsx)(o,{path:`/proposals`,element:(0,N.jsx)(dp,{routeId:`proposals`})}),(0,N.jsx)(o,{path:`/status`,element:(0,N.jsx)(tp,{})})]})})}function mp(){return(0,N.jsx)(lr,{client:lp,children:(0,N.jsx)(p,{children:(0,N.jsxs)(Nr,{defaultTheme:`dark`,children:[(0,N.jsxs)(Gt,{adapter:cp,capabilities:np,children:[(0,N.jsx)(pp,{}),(0,N.jsx)(Ar,{})]}),!1]})})})}(0,mt.createRoot)(document.getElementById(`root`)).render((0,N.jsx)(A.StrictMode,{children:(0,N.jsx)(mp,{})}));
|