selftune 0.2.14 → 0.2.15
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-DOu3iLD9.js +16 -0
- package/apps/local-dashboard/dist/assets/vendor-ui-DIwlrGlb.js +12 -0
- package/apps/local-dashboard/dist/index.html +2 -2
- package/cli/selftune/analytics.ts +13 -11
- package/cli/selftune/badge/badge.ts +13 -9
- package/cli/selftune/canonical-export.ts +6 -6
- package/cli/selftune/contribute/contribute.ts +2 -1
- package/cli/selftune/cron/setup.ts +3 -1
- package/cli/selftune/dashboard-contract.ts +10 -0
- package/cli/selftune/dashboard.ts +10 -5
- package/cli/selftune/eval/baseline.ts +20 -30
- package/cli/selftune/eval/hooks-to-evals.ts +22 -12
- package/cli/selftune/eval/import-skillsbench.ts +21 -8
- package/cli/selftune/eval/unit-test-cli.ts +22 -11
- package/cli/selftune/evolution/description-quality.ts +224 -0
- package/cli/selftune/evolution/evolve-body.ts +17 -10
- package/cli/selftune/evolution/evolve.ts +70 -57
- package/cli/selftune/evolution/rollback.ts +7 -6
- package/cli/selftune/grading/auto-grade.ts +24 -22
- package/cli/selftune/grading/grade-session.ts +21 -17
- package/cli/selftune/hooks/auto-activate.ts +12 -3
- package/cli/selftune/hooks/prompt-log.ts +7 -1
- package/cli/selftune/index.ts +66 -69
- package/cli/selftune/ingestors/claude-replay.ts +29 -14
- package/cli/selftune/ingestors/codex-rollout.ts +6 -1
- package/cli/selftune/init.ts +14 -9
- package/cli/selftune/monitoring/watch.ts +32 -16
- package/cli/selftune/orchestrate.ts +18 -17
- package/cli/selftune/routes/skill-report.ts +17 -0
- package/cli/selftune/schedule.ts +23 -9
- package/cli/selftune/sync.ts +7 -3
- package/cli/selftune/types.ts +44 -10
- package/cli/selftune/utils/cli-error.ts +102 -0
- package/cli/selftune/workflows/workflows.ts +23 -17
- package/package.json +1 -1
- package/skill/SKILL.md +1 -1
- package/skill/Workflows/Evolve.md +4 -0
- package/skill/Workflows/Initialize.md +8 -8
- package/skill/settings_snippet.json +29 -6
- package/apps/local-dashboard/dist/assets/index-DIrdlu2_.js +0 -16
- package/apps/local-dashboard/dist/assets/vendor-ui-7xD7fNEU.js +0 -12
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./rolldown-runtime-Dw2cE7zH.js";import{a as r,c as i,f as a,i as o,l as s,n as c,o as l,r as u,s as d,t as f,u as p}from"./vendor-react-CKkiCskZ.js";import{$ as m,$t as h,A as g,At as _,B as v,Bt as y,C as b,Ct as x,D as S,Dt as C,E as w,Et as T,F as E,Ft as ee,G as D,Gt as te,H as ne,Ht as re,I as O,It as k,J as ie,Jt as ae,K as oe,Kt as se,L as ce,Lt as le,M as ue,Mt as de,N as fe,Nt as pe,O as me,Ot as he,P as ge,Pt as _e,Q as ve,Qt as ye,R as be,Rt as xe,S as Se,St as Ce,T as we,Tt as Te,U as Ee,Ut as De,V as Oe,Vt as ke,W as Ae,Wt as je,X as Me,Xt as Ne,Y as Pe,Yt as Fe,Z as Ie,Zt as Le,_ as Re,_t as ze,a as Be,at as Ve,b as He,bt as Ue,c as We,ct as Ge,d as Ke,dt as qe,en as Je,et as Ye,f as Xe,ft as Ze,g as Qe,gt as $e,h as et,ht as tt,i as nt,it as rt,j as it,jt as at,k as ot,kt as st,l as ct,lt,m as ut,mt as dt,n as ft,nn as pt,nt as mt,o as ht,ot as gt,p as _t,pt as vt,q as yt,qt as bt,r as xt,rt as St,s as Ct,st as wt,t as Tt,tn as Et,tt as Dt,u as Ot,ut as kt,v as At,vt as jt,w as Mt,wt as Nt,x as Pt,xt as Ft,y as It,yt as Lt,z as Rt,zt}from"./vendor-ui-DIwlrGlb.js";import{S as Bt,_ as Vt,a as Ht,b as Ut,c as Wt,d as Gt,f as Kt,g as qt,h as Jt,i as Yt,l as Xt,m as Zt,n as Qt,o as $t,p as en,r as tn,s as nn,t as rn,u as an,v as on,x as sn,y as cn}from"./vendor-table-pHbDxq36.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(a(),1),ln=p(),j=s(),un={HEALTHY:{icon:(0,j.jsx)(je,{className:`size-4 text-emerald-600`}),variant:`outline`,label:`Healthy`},WARNING:{icon:(0,j.jsx)(Ve,{className:`size-4 text-amber-500`}),variant:`secondary`,label:`Warning`},CRITICAL:{icon:(0,j.jsx)(ke,{className:`size-4 text-red-500`}),variant:`destructive`,label:`Critical`},UNGRADED:{icon:(0,j.jsx)(De,{className:`size-4 text-muted-foreground`}),variant:`secondary`,label:`Ungraded`},UNKNOWN:{icon:(0,j.jsx)(re,{className:`size-4 text-muted-foreground/60`}),variant:`secondary`,label:`Unknown`}};function dn(e,t){return t<5?`UNGRADED`:e>=.8?`HEALTHY`:e>=.5?`WARNING`:`CRITICAL`}function fn(e){return e==null||!Number.isFinite(e)?`--`:`${Math.round(e*100)}%`}function pn(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 M(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 N(...e){return Ye(Dt(e))}var mn=Ie(`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 P({className:e,variant:t=`default`,render:n,...r}){return ve({defaultTagName:`span`,props:m({className:N(mn({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}var hn=Ie(`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 F({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,j.jsx)(Me,{"data-slot":`button`,className:N(hn({variant:t,size:n,className:e})),...r})}function I({className:e,size:t=`default`,...n}){return(0,j.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:N(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 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 L({className:e,...t}){return(0,j.jsx)(`div`,{"data-slot":`card-header`,className:N(`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 R({className:e,...t}){return(0,j.jsx)(`div`,{"data-slot":`card-title`,className:N(`text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function z({className:e,...t}){return(0,j.jsx)(`div`,{"data-slot":`card-description`,className:N(`text-sm text-muted-foreground`,e),...t})}function gn({className:e,...t}){return(0,j.jsx)(`div`,{"data-slot":`card-action`,className:N(`col-start-2 row-span-2 row-start-1 self-start justify-self-end`,e),...t})}function _n({className:e,...t}){return(0,j.jsx)(`div`,{"data-slot":`card-content`,className:N(`px-4 group-data-[size=sm]/card:px-3`,e),...t})}function vn({className:e,...t}){return(0,j.jsx)(Pe,{"data-slot":`checkbox`,className:N(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,e),...t,children:(0,j.jsx)(ie,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,j.jsx)(ye,{})})})}var yn=yt,bn=oe,xn=D;function Sn({...e}){return(0,j.jsx)(O,{"data-slot":`dropdown-menu`,...e})}function Cn({...e}){return(0,j.jsx)(E,{"data-slot":`dropdown-menu-trigger`,...e})}function wn({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,j.jsx)(Oe,{children:(0,j.jsx)(v,{className:`isolate z-50 outline-hidden`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,j.jsx)(ne,{"data-slot":`dropdown-menu-content`,className:N(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-hidden 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-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,i),...a})})})}function Tn({className:e,children:t,checked:n,inset:r,...i}){return(0,j.jsxs)(Ae,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":r,className:N(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),checked:n,...i,children:[(0,j.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,j.jsx)(Ee,{children:(0,j.jsx)(ye,{})})}),t]})}function En({...e}){return(0,j.jsx)(Rt,{"data-slot":`dropdown-menu-radio-group`,...e})}function Dn({className:e,children:t,inset:n,...r}){return(0,j.jsxs)(be,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:N(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[(0,j.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,j.jsx)(ce,{children:(0,j.jsx)(ye,{})})}),t]})}function On({className:e,...t}){return(0,j.jsx)(`label`,{"data-slot":`label`,className:N(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var kn=fe;function An({className:e,...t}){return(0,j.jsx)(He,{"data-slot":`select-group`,className:N(`scroll-my-1 p-1`,e),...t})}function jn({className:e,...t}){return(0,j.jsx)(it,{"data-slot":`select-value`,className:N(`flex flex-1 text-left`,e),...t})}function Mn({className:e,size:t=`default`,children:n,...r}){return(0,j.jsxs)(ue,{"data-slot":`select-trigger`,"data-size":t,className:N(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 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`,e),...r,children:[n,(0,j.jsx)(g,{render:(0,j.jsx)(Le,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function Nn({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,j.jsx)(ot,{children:(0,j.jsx)(me,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,j.jsxs)(S,{"data-slot":`select-content`,"data-align-trigger":o,className:N(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none 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-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),...s,children:[(0,j.jsx)(Fn,{}),(0,j.jsx)(w,{children:t}),(0,j.jsx)(In,{})]})})})}function Pn({className:e,children:t,...n}){return(0,j.jsxs)(we,{"data-slot":`select-item`,className:N(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,j.jsx)(b,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,j.jsx)(Mt,{render:(0,j.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,j.jsx)(ye,{className:`pointer-events-none`})})]})}function Fn({className:e,...t}){return(0,j.jsx)(Pt,{"data-slot":`select-scroll-up-button`,className:N(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,j.jsx)(ae,{})})}function In({className:e,...t}){return(0,j.jsx)(Se,{"data-slot":`select-scroll-down-button`,className:N(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,j.jsx)(Le,{})})}function Ln({className:e,...t}){return(0,j.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,j.jsx)(`table`,{"data-slot":`table`,className:N(`w-full caption-bottom text-sm`,e),...t})})}function Rn({className:e,...t}){return(0,j.jsx)(`thead`,{"data-slot":`table-header`,className:N(`[&_tr]:border-b`,e),...t})}function zn({className:e,...t}){return(0,j.jsx)(`tbody`,{"data-slot":`table-body`,className:N(`[&_tr:last-child]:border-0`,e),...t})}function Bn({className:e,...t}){return(0,j.jsx)(`tr`,{"data-slot":`table-row`,className:N(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function Vn({className:e,...t}){return(0,j.jsx)(`th`,{"data-slot":`table-head`,className:N(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function Hn({className:e,...t}){return(0,j.jsx)(`td`,{"data-slot":`table-cell`,className:N(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}function Un({className:e,orientation:t=`horizontal`,...n}){return(0,j.jsx)(It,{"data-slot":`tabs`,"data-orientation":t,className:N(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Wn=Ie(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function Gn({className:e,variant:t=`default`,...n}){return(0,j.jsx)(Qe,{"data-slot":`tabs-list`,"data-variant":t,className:N(Wn({variant:t}),e),...n})}function Kn({className:e,...t}){return(0,j.jsx)(At,{"data-slot":`tabs-trigger`,className:N(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start 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: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:bg-transparent 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`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark: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 qn({className:e,...t}){return(0,j.jsx)(Re,{"data-slot":`tabs-content`,className:N(`flex-1 text-sm outline-none`,e),...t})}function Jn({delay:e=0,...t}){return(0,j.jsx)(ct,{"data-slot":`tooltip-provider`,delay:e,...t})}function Yn({...e}){return(0,j.jsx)(et,{"data-slot":`tooltip`,...e})}function Xn({...e}){return(0,j.jsx)(ut,{"data-slot":`tooltip-trigger`,...e})}function Zn({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,j.jsx)(_t,{children:(0,j.jsx)(Xe,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,j.jsxs)(Ke,{"data-slot":`tooltip-content`,className:N(`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,j.jsx)(Ot,{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`})]})})})}var Qn=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(){}},$n=new class extends Qn{#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`}},er={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},tr=new class{#e=er;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 nr(e){setTimeout(e,0)}var rr=typeof window>`u`||`Deno`in globalThis;function B(){}function ir(e,t){return typeof e==`function`?e(t):e}function ar(e){return typeof e==`number`&&e>=0&&e!==1/0}function or(e,t){return Math.max(e+(t||0)-Date.now(),0)}function sr(e,t){return typeof e==`function`?e(t):e}function cr(e,t){return typeof e==`function`?e(t):e}function lr(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==dr(o,t.options))return!1}else if(!pr(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 ur(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(fr(t.options.mutationKey)!==fr(a))return!1}else if(!pr(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function dr(e,t){return(t?.queryKeyHashFn||fr)(e)}function fr(e){return JSON.stringify(e,(e,t)=>vr(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function pr(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>pr(e[n],t[n])):!1}var mr=Object.prototype.hasOwnProperty;function hr(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=_r(e)&&_r(t);if(!r&&!(vr(e)&&vr(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:mr.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=hr(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function gr(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 _r(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function vr(e){if(!yr(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!yr(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function yr(e){return Object.prototype.toString.call(e)===`[object Object]`}function br(e){return new Promise(t=>{tr.setTimeout(t,e)})}function xr(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:hr(e,t)}function Sr(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Cr(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var wr=Symbol();function Tr(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===wr?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Er(e,t){return typeof e==`function`?e(...t):!!e}function Dr(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 Or=(()=>{let e=()=>rr;return{isServer(){return e()},setIsServer(t){e=t}}})();function kr(){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 Ar=nr;function jr(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Ar,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 V=jr(),Mr=new class extends Qn{#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 Nr(e){return Math.min(1e3*2**e,3e4)}function Pr(e){return(e??`online`)===`online`?Mr.isOnline():!0}var Fr=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ir(e){let t=!1,n=0,r,i=kr(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Fr(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>$n.isFocused()&&(e.networkMode===`always`||Mr.isOnline())&&e.canRun(),u=()=>Pr(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??(Or.isServer()?0:3),o=e.retryDelay??Nr,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),br(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 Lr=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ar(this.gcTime)&&(this.#e=tr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Or.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(tr.clearTimeout(this.#e),void 0)}},Rr=class extends Lr{#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=Vr(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=Vr(this.options);e.data!==void 0&&(this.setState(Br(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=xr(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(B).catch(B):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=>cr(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===wr||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>sr(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:!or(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=Tr(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=Ir({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Fr&&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 Fr){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,...zr(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Br(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),V.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function zr(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Pr(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Br(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Vr(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 Hr=class extends Qn{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=kr(),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),Wr(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Gr(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Gr(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 cr(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&&!gr(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Kr(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||cr(this.options.enabled,this.#t)!==cr(t.enabled,this.#t)||sr(this.options.staleTime,this.#t)!==sr(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||cr(this.options.enabled,this.#t)!==cr(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 Jr(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(B)),t}#g(){this.#b();let e=sr(this.options.staleTime,this.#t);if(Or.isServer()||this.#r.isStale||!ar(e))return;let t=or(this.#r.dataUpdatedAt,e)+1;this.#d=tr.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,!(Or.isServer()||cr(this.options.enabled,this.#t)===!1||!ar(this.#p)||this.#p===0)&&(this.#f=tr.setInterval(()=>{(this.options.refetchIntervalInBackground||$n.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(tr.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(tr.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&&Wr(e,t),o=i&&Kr(e,n,t,r);(a||o)&&(l={...l,...zr(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=xr(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=xr(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:qr(e,t),refetch:this.refetch,promise:this.#o,isEnabled:cr(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=kr())},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),!gr(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){V.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Ur(e,t){return cr(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function Wr(e,t){return Ur(e,t)||e.state.data!==void 0&&Gr(e,t,t.refetchOnMount)}function Gr(e,t,n){if(cr(t.enabled,e)!==!1&&sr(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&qr(e,t)}return!1}function Kr(e,t,n,r){return(e!==t||cr(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&qr(e,n)}function qr(e,t){return cr(t.enabled,e)!==!1&&e.isStaleByTime(sr(t.staleTime,e))}function Jr(e,t){return!gr(e.getCurrentResult(),t)}function Yr(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=>{Dr(e,()=>t.signal,()=>n=!0)},u=Tr(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?Cr:Sr;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Zr:Xr,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:Xr(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 Xr(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 Zr(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Qr=class extends Lr{#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||$r(),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=Ir({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),V.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function $r(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ei=class extends Qn{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 Qr({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=ti(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=ti(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=ti(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=ti(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){V.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=>ur(t,e))}findAll(e={}){return this.getAll().filter(t=>ur(e,t))}notify(e){V.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return V.batch(()=>Promise.all(e.map(e=>e.continue().catch(B))))}};function ti(e){return e.options.scope?.id}var ni=class extends Qn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??dr(r,t),a=this.get(i);return a||(a=new Rr({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(){V.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=>lr(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>lr(e,t)):t}notify(e){V.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){V.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){V.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ri=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ni,this.#t=e.mutationCache||new ei,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=$n.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Mr.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(sr(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=ir(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return V.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;V.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return V.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=V.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(B).catch(B)}invalidateQueries(e,t={}){return V.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=V.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(B)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(B)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(sr(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(B).catch(B)}fetchInfiniteQuery(e){return e.behavior=Yr(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(B).catch(B)}ensureInfiniteQueryData(e){return e.behavior=Yr(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Mr.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(fr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{pr(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(fr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{pr(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||=dr(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===wr&&(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()}},ii=A.createContext(void 0),ai=e=>{let t=A.useContext(ii);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},oi=({client:e,children:t})=>(A.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,j.jsx)(ii.Provider,{value:e,children:t})),si=A.createContext(!1),ci=()=>A.useContext(si);si.Provider;function li(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ui=A.createContext(li()),di=()=>A.useContext(ui),fi=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Er(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},pi=e=>{A.useEffect(()=>{e.clearReset()},[e])},mi=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Er(n,[e.error,r])),hi=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))}},gi=(e,t)=>e.isLoading&&e.isFetching&&!t,_i=(e,t)=>e?.suspense&&t.isPending,vi=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function yi(e,t,n){let r=ci(),i=di(),a=ai(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,hi(o),fi(o,i,s),pi(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(V.batchCalls(e)):B;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),A.useEffect(()=>{l.setOptions(o)},[o,l]),_i(o,u))throw vi(o,l,i);if(mi({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&&!Or.isServer()&&gi(u,r)&&(c?vi(o,l,i):s?.promise)?.catch(B).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function bi(e,t){return yi(e,Hr,t)}function xi({className:e,type:t,...n}){return(0,j.jsx)(We,{type:t,"data-slot":`input`,className:N(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function Si({className:e,orientation:t=`horizontal`,...n}){return(0,j.jsx)(ge,{"data-slot":`separator`,orientation:t,className:N(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}function Ci({...e}){return(0,j.jsx)(ft,{"data-slot":`sheet`,...e})}function wi({...e}){return(0,j.jsx)(xt,{"data-slot":`sheet-portal`,...e})}function Ti({className:e,...t}){return(0,j.jsx)(Ct,{"data-slot":`sheet-overlay`,className:N(`fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),...t})}function Ei({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,j.jsxs)(wi,{children:[(0,j.jsx)(Ti,{}),(0,j.jsxs)(nt,{"data-slot":`sheet-content`,"data-side":n,className:N(`fixed z-50 flex flex-col gap-4 bg-background bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,e),...i,children:[t,r&&(0,j.jsxs)(ht,{"data-slot":`sheet-close`,render:(0,j.jsx)(F,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[(0,j.jsx)(St,{}),(0,j.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Di({className:e,...t}){return(0,j.jsx)(`div`,{"data-slot":`sheet-header`,className:N(`flex flex-col gap-0.5 p-4`,e),...t})}function Oi({className:e,...t}){return(0,j.jsx)(Tt,{"data-slot":`sheet-title`,className:N(`text-base font-medium text-foreground`,e),...t})}function ki({className:e,...t}){return(0,j.jsx)(Be,{"data-slot":`sheet-description`,className:N(`text-sm text-muted-foreground`,e),...t})}function Ai({className:e,...t}){return(0,j.jsx)(`div`,{"data-slot":`skeleton`,className:N(`animate-pulse rounded-md bg-muted`,e),...t})}var ji=768;function Mi(){let[e,t]=A.useState(void 0);return A.useEffect(()=>{let e=window.matchMedia(`(max-width: ${ji-1}px)`),n=()=>{t(window.innerWidth<ji)};return e.addEventListener(`change`,n),t(window.innerWidth<ji),()=>e.removeEventListener(`change`,n)},[]),!!e}var Ni=`sidebar_state`,Pi=3600*24*7,Fi=`16rem`,Ii=`18rem`,Li=`3rem`,Ri=`b`,zi=A.createContext(null);function Bi(){let e=A.useContext(zi);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Vi({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=Mi(),[c,l]=A.useState(!1),[u,d]=A.useState(e),f=t??u,p=A.useCallback(e=>{let t=typeof e==`function`?e(f):e;n?n(t):d(t),document.cookie=`${Ni}=${t}; path=/; max-age=${Pi}`},[n,f]),m=A.useCallback(()=>s?l(e=>!e):p(e=>!e),[s,p,l]);A.useEffect(()=>{let e=e=>{e.key===Ri&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m]);let h=f?`expanded`:`collapsed`,g=A.useMemo(()=>({state:h,open:f,setOpen:p,isMobile:s,openMobile:c,setOpenMobile:l,toggleSidebar:m}),[h,f,p,s,c,l,m]);return(0,j.jsx)(zi.Provider,{value:g,children:(0,j.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":Fi,"--sidebar-width-icon":Li,...i},className:N(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function Hi({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,dir:a,...o}){let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=Bi();return n===`none`?(0,j.jsx)(`div`,{"data-slot":`sidebar`,className:N(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),...o,children:i}):s?(0,j.jsx)(Ci,{open:l,onOpenChange:u,...o,children:(0,j.jsxs)(Ei,{dir:a,"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:{"--sidebar-width":Ii},side:e,children:[(0,j.jsxs)(Di,{className:`sr-only`,children:[(0,j.jsx)(Oi,{children:`Sidebar`}),(0,j.jsx)(ki,{children:`Displays the mobile sidebar.`})]}),(0,j.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,j.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,j.jsx)(`div`,{"data-slot":`sidebar-gap`,className:N(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,j.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":e,className:N(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...o,children:(0,j.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:i})})]})}function Ui({className:e,onClick:t,...n}){let{toggleSidebar:r}=Bi();return(0,j.jsxs)(F,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,className:N(e),onClick:e=>{t?.(e),r()},...n,children:[(0,j.jsx)(Ue,{}),(0,j.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})}function Wi({className:e,...t}){return(0,j.jsx)(`main`,{"data-slot":`sidebar-inset`,className:N(`relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,e),...t})}function Gi({className:e,...t}){return(0,j.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:N(`flex flex-col gap-2 p-2`,e),...t})}function Ki({className:e,...t}){return(0,j.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:N(`flex flex-col gap-2 p-2`,e),...t})}function qi({className:e,...t}){return(0,j.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:N(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function Ji({className:e,...t}){return(0,j.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:N(`relative flex w-full min-w-0 flex-col p-2`,e),...t})}function Yi({className:e,render:t,...n}){return ve({defaultTagName:`div`,props:m({className:N(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,e)},n),render:t,state:{slot:`sidebar-group-label`,sidebar:`group-label`}})}function Xi({className:e,...t}){return(0,j.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:N(`w-full text-sm`,e),...t})}function Zi({className:e,...t}){return(0,j.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:N(`flex w-full min-w-0 flex-col gap-0`,e),...t})}function Qi({className:e,...t}){return(0,j.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:N(`group/menu-item relative`,e),...t})}var $i=Ie(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground border-l-2 border-transparent data-active:border-primary data-active:rounded-l-none [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function ea({render:e,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o}){let{isMobile:s,state:c}=Bi(),l=ve({defaultTagName:`button`,props:m({className:N($i({variant:n,size:r}),a)},o),render:i?(0,j.jsx)(Xn,{render:e}):e,state:{slot:`sidebar-menu-button`,sidebar:`menu-button`,size:r,active:t}});return i?(typeof i==`string`&&(i={children:i}),(0,j.jsxs)(Yn,{children:[l,(0,j.jsx)(Zn,{side:`right`,align:`center`,hidden:c!==`collapsed`||s,...i})]})):l}function ta({className:e,...t}){return(0,j.jsx)(`ul`,{"data-slot":`sidebar-menu-sub`,"data-sidebar":`menu-sub`,className:N(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden`,e),...t})}function na({className:e,...t}){return(0,j.jsx)(`li`,{"data-slot":`sidebar-menu-sub-item`,"data-sidebar":`menu-sub-item`,className:N(`group/menu-sub-item relative`,e),...t})}function ra({render:e,size:t=`md`,isActive:n=!1,className:r,...i}){return ve({defaultTagName:`a`,props:m({className:N(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground border-l-2 border-transparent data-active:border-primary data-active:rounded-l-none [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,r)},i),render:e,state:{slot:`sidebar-menu-sub-button`,sidebar:`menu-sub-button`,size:t,active:n}})}var ia={HEALTHY:(0,j.jsx)(je,{className:`size-3.5 text-emerald-600`}),WARNING:(0,j.jsx)(Ve,{className:`size-3.5 text-amber-500`}),CRITICAL:(0,j.jsx)(ke,{className:`size-3.5 text-red-500`}),UNGRADED:(0,j.jsx)(De,{className:`size-3.5 text-muted-foreground`}),UNKNOWN:(0,j.jsx)(re,{className:`size-3.5 text-muted-foreground/60`})},aa={project:{label:`Project`,icon:(0,j.jsx)(_e,{className:`size-4`})},global:{label:`Global`,icon:(0,j.jsx)(_,{className:`size-4`})},system:{label:`System`,icon:(0,j.jsx)(dt,{className:`size-4`})},admin:{label:`Admin`,icon:(0,j.jsx)(_,{className:`size-4`})},unknown:{label:`Unknown`,icon:(0,j.jsx)(re,{className:`size-4`})}};function oa({scope:e,skills:t,pathname:n,defaultOpen:r}){let i=aa[e]??{label:e,icon:(0,j.jsx)(_,{className:`size-4`})},a=t.some(e=>n===`/skills/${encodeURIComponent(e.name)}`),[o,s]=(0,A.useState)(r||a);return(0,A.useEffect)(()=>{a&&s(!0)},[a]),(0,j.jsx)(yn,{open:o,onOpenChange:s,className:`group/collapsible`,children:(0,j.jsxs)(Qi,{children:[(0,j.jsxs)(bn,{render:(0,j.jsx)(ea,{tooltip:i.label}),children:[i.icon,(0,j.jsx)(`span`,{children:i.label}),(0,j.jsx)(P,{variant:`secondary`,className:`ml-auto h-4 px-1.5 text-[10px]`,children:t.length}),(0,j.jsx)(Fe,{className:`ml-1 size-4 shrink-0 transition-transform duration-200 group-data-[open]/collapsible:rotate-90`})]}),(0,j.jsx)(xn,{children:(0,j.jsx)(ta,{children:t.map(e=>(0,j.jsx)(na,{children:(0,j.jsxs)(ra,{isActive:n===`/skills/${encodeURIComponent(e.name)}`,render:(0,j.jsx)(c,{to:`/skills/${encodeURIComponent(e.name)}`}),children:[ia[e.status],(0,j.jsx)(`span`,{className:`truncate`,children:e.name}),(0,j.jsx)(P,{variant:e.status===`CRITICAL`?`destructive`:e.status===`HEALTHY`?`outline`:`secondary`,className:`ml-auto h-4 text-[10px] px-1.5 shrink-0`,children:fn(e.passRate)})]})},e.name))})})]})})}function sa({skills:e,search:t,onSearchChange:n,version:i,...a}){let o=r(),s=(0,A.useMemo)(()=>{let t={};for(let n of e){let e=n.scope??`unknown`;t[e]||(t[e]=[]),t[e].push(n)}let n=[`global`,`project`,`system`,`admin`,`unknown`],r=n.filter(e=>t[e]?.length).map(e=>({scope:e,skills:t[e]})),i=Object.keys(t).filter(e=>!n.includes(e)).sort().map(e=>({scope:e,skills:t[e]}));return[...r,...i]},[e]),l=s.length>1;return(0,j.jsxs)(Hi,{collapsible:`offcanvas`,...a,children:[(0,j.jsx)(Gi,{children:(0,j.jsx)(Zi,{children:(0,j.jsx)(Qi,{children:(0,j.jsxs)(ea,{className:`data-[slot=sidebar-menu-button]:!p-1.5`,render:(0,j.jsx)(c,{to:`/`}),children:[(0,j.jsx)(`div`,{className:`size-5 bg-current`,style:{mask:`url(/logo.svg) center/contain no-repeat`,WebkitMask:`url(/logo.svg) center/contain no-repeat`},"aria-hidden":`true`}),(0,j.jsxs)(`span`,{className:`text-base font-semibold`,children:[`self`,(0,j.jsx)(`span`,{className:`text-primary-accent`,children:`tune`})]})]})})})}),(0,j.jsxs)(qi,{children:[(0,j.jsx)(Ji,{children:(0,j.jsx)(Xi,{children:(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(tt,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`}),(0,j.jsx)(xi,{"aria-label":`Filter skills`,placeholder:`Filter skills...`,value:t,onChange:e=>n(e.target.value),className:`h-8 pl-8 text-sm`})]})})}),(0,j.jsx)(Ji,{children:(0,j.jsx)(Xi,{children:(0,j.jsx)(Zi,{children:(0,j.jsx)(Qi,{children:(0,j.jsxs)(ea,{isActive:o.pathname===`/`,tooltip:`Dashboard`,render:(0,j.jsx)(c,{to:`/`}),children:[(0,j.jsx)(Nt,{className:`size-4`}),(0,j.jsx)(`span`,{children:`Dashboard`})]})})})})}),(0,j.jsxs)(Ji,{className:`flex-1`,children:[(0,j.jsx)(Yi,{children:`Skills`}),(0,j.jsx)(Xi,{children:(0,j.jsxs)(Zi,{children:[l?s.map(({scope:e,skills:t})=>(0,j.jsx)(oa,{scope:e,skills:t,pathname:o.pathname,defaultOpen:e===`global`||e===`project`},e)):e.map(e=>(0,j.jsx)(Qi,{children:(0,j.jsxs)(ea,{isActive:o.pathname===`/skills/${encodeURIComponent(e.name)}`,tooltip:`${e.name} — ${fn(e.passRate)}`,render:(0,j.jsx)(c,{to:`/skills/${encodeURIComponent(e.name)}`}),children:[ia[e.status],(0,j.jsx)(`span`,{className:`truncate`,children:e.name}),(0,j.jsx)(P,{variant:e.status===`CRITICAL`?`destructive`:e.status===`HEALTHY`?`outline`:`secondary`,className:`ml-auto h-4 text-[10px] px-1.5 shrink-0`,children:fn(e.passRate)})]})},e.name)),e.length===0&&(0,j.jsx)(`div`,{className:`px-3 py-6 text-center text-xs text-muted-foreground`,children:`No skills match`})]})})]})]}),(0,j.jsxs)(Ki,{children:[(0,j.jsx)(Zi,{children:(0,j.jsx)(Qi,{children:(0,j.jsxs)(ea,{isActive:o.pathname===`/status`,tooltip:`System Status`,render:(0,j.jsx)(c,{to:`/status`}),children:[(0,j.jsx)(C,{className:`size-4`}),(0,j.jsx)(`span`,{children:`System Status`})]})})}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 text-xs text-muted-foreground`,children:[(0,j.jsx)(pt,{className:`size-3`}),(0,j.jsxs)(`span`,{children:[`selftune`,i?` v${i}`:``]})]})]})]})}function ca(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 la(){let[e,t]=(0,A.useState)(null);if((0,A.useEffect)(()=>{fetch(`/api/health`).then(e=>e.json()).then(e=>{ca(e)&&t(e)}).catch(()=>{})},[]),!e)return null;let n=e.watcher_mode===`jsonl`;return(0,j.jsx)(`footer`,{className:`fixed bottom-0 left-0 right-0 z-10 border-t border-border/40 bg-background/80 backdrop-blur-sm px-4 py-1.5`,children:(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 text-[11px] font-mono text-muted-foreground`,children:[(0,j.jsx)(`span`,{title:`Workspace root`,children:e.workspace_root}),(0,j.jsx)(`span`,{title:`Git SHA`,children:e.git_sha}),(0,j.jsx)(`span`,{title:`Database path`,children:e.db_path}),(0,j.jsxs)(`span`,{title:`Process mode`,children:[`mode: `,e.process_mode]}),(0,j.jsxs)(`span`,{title:`Watcher mode`,className:n?`text-amber-700 dark:text-amber-300`:void 0,children:[`watcher: `,e.watcher_mode]}),n&&(0,j.jsx)(`span`,{className:`rounded border border-amber-300/70 bg-amber-500/10 px-2 py-0.5 text-amber-800 dark:border-amber-800 dark:text-amber-300`,title:`Dashboard reads SQLite, but live invalidation still comes from JSONL log watchers.`,children:`warning: legacy JSONL watcher invalidation`})]})})}var ua=(0,A.createContext)(void 0),da=`selftune-theme`,fa=[`dark`,`light`,`system`];function pa(e){let t=localStorage.getItem(da);return fa.includes(t)?t:e}function ma({children:e,defaultTheme:t=`dark`}){let[n,r]=(0,A.useState)(()=>pa(t));return(0,A.useEffect)(()=>{let e=window.document.documentElement,t=window.matchMedia(`(prefers-color-scheme: dark)`),r=t=>{e.classList.remove(`light`,`dark`),e.classList.add(t)};if(n===`system`){let e=()=>r(t.matches?`dark`:`light`);return e(),t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}r(n)},[n]),(0,j.jsx)(ua.Provider,{value:{theme:n,setTheme:e=>{localStorage.setItem(da,e),r(e)}},children:e})}function ha(){let e=(0,A.useContext)(ua);if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e}function ga(){let{theme:e,setTheme:t}=ha();return(0,j.jsxs)(F,{variant:`ghost`,size:`icon`,className:`relative size-8`,onClick:()=>t(e===`dark`?`light`:`dark`),children:[(0,j.jsx)(lt,{className:`size-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,j.jsx)(Ce,{className:`absolute size-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`}),(0,j.jsx)(`span`,{className:`sr-only`,children:`Toggle theme`})]})}function _a(){return(0,j.jsx)(`header`,{className:`flex h-10 shrink-0 items-center gap-2 bg-background transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-10`,children:(0,j.jsxs)(`div`,{className:`flex w-full items-center gap-1 px-4 lg:px-6`,children:[(0,j.jsx)(Ui,{className:`-ml-1`}),(0,j.jsx)(Si,{orientation:`vertical`,className:`mx-2 data-[orientation=vertical]:h-4`}),(0,j.jsx)(`div`,{className:`ml-auto`,children:(0,j.jsx)(ga,{})})]})})}var va=``;async function ya(){let e=await fetch(`${va}/api/v2/overview`);if(!e.ok)throw Error(`API error: ${e.status} ${e.statusText}`);return e.json()}async function ba(e){let t=await fetch(`${va}/api/v2/skills/${encodeURIComponent(e)}`);if(!t.ok)throw t.status===404?new Ca(e):Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function xa(e=20){let t=await fetch(`${va}/api/v2/orchestrate-runs?limit=${e}`);if(!t.ok)throw Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function Sa(){let e=await fetch(`${va}/api/v2/doctor`);if(!e.ok)throw Error(`API error: ${e.status} ${e.statusText}`);return e.json()}var Ca=class extends Error{constructor(e){super(`Skill "${e}" not found`),this.name=`NotFoundError`}},wa=6e4;function Ta(){return bi({queryKey:[`overview`],queryFn:ya,staleTime:5e3,refetchInterval:wa})}function Ea(){let e=ai();(0,A.useEffect)(()=>{let t=new EventSource(`/api/v2/events`);return t.addEventListener(`update`,()=>{e.invalidateQueries()}),t.onerror=()=>{},()=>{t.close()}},[e])}var Da={created:`outline`,validated:`secondary`,deployed:`default`,rejected:`destructive`,rolled_back:`destructive`,pending:`secondary`};function Oa({evolution:e,pendingProposals:t,unmatchedQueries:n,onSelectProposal:r}){return e.length>0||t.length>0||n.length>0?(0,j.jsxs)(I,{children:[(0,j.jsxs)(L,{children:[(0,j.jsxs)(R,{className:`flex items-center gap-2 text-sm`,children:[(0,j.jsx)(pt,{className:`size-4`}),`Activity`]}),(0,j.jsx)(z,{children:`Recent evolution events and queries`})]}),(0,j.jsx)(_n,{children:(0,j.jsxs)(Un,{defaultValue:t.length>0?`pending`:e.length>0?`timeline`:`unmatched`,children:[(0,j.jsx)(Jn,{children:(0,j.jsxs)(Gn,{className:`w-full`,children:[t.length>0&&(0,j.jsxs)(Yn,{children:[(0,j.jsxs)(Xn,{render:(0,j.jsx)(Kn,{value:`pending`,className:`flex-1 gap-1.5`}),children:[(0,j.jsx)(at,{className:`size-3.5`}),(0,j.jsx)(P,{variant:`secondary`,className:`h-4 px-1 text-[10px]`,children:t.length})]}),(0,j.jsx)(Zn,{children:`Undeployed proposals`})]}),(0,j.jsxs)(Yn,{children:[(0,j.jsx)(Xn,{render:(0,j.jsx)(Kn,{value:`timeline`,className:`flex-1`}),children:(0,j.jsx)(y,{className:`size-3.5`})}),(0,j.jsx)(Zn,{children:`Timeline`})]}),n.length>0&&(0,j.jsxs)(Yn,{children:[(0,j.jsxs)(Xn,{render:(0,j.jsx)(Kn,{value:`unmatched`,className:`flex-1 gap-1.5`}),children:[(0,j.jsx)($e,{className:`size-3.5`}),(0,j.jsx)(P,{variant:`destructive`,className:`h-4 px-1 text-[10px]`,children:n.length})]}),(0,j.jsx)(Zn,{children:`Unmatched queries`})]})]})}),t.length>0&&(0,j.jsx)(qn,{value:`pending`,className:`mt-4 space-y-3`,children:t.slice(0,10).map(e=>(0,j.jsxs)(`button`,{type:`button`,onClick:()=>{e.skill_name&&r&&r(e.skill_name,e.proposal_id)},disabled:!e.skill_name||!r,className:`flex w-full gap-3 rounded-md p-1.5 text-left transition-colors enabled:hover:bg-accent/40 disabled:cursor-default`,children:[(0,j.jsx)(`div`,{className:`mt-1 size-2 shrink-0 rounded-full bg-amber-400`}),(0,j.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(P,{variant:Da[e.action]??`secondary`,className:`text-[10px]`,children:e.action}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground font-mono`,children:M(e.timestamp)})]}),(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.details}),e.skill_name&&(0,j.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/60 font-mono`,children:[e.skill_name,` · #`,e.proposal_id.slice(0,8)]})]})]},e.proposal_id))}),(0,j.jsxs)(qn,{value:`timeline`,className:`mt-4 space-y-3`,children:[e.slice(0,30).map((e,t)=>(0,j.jsxs)(`button`,{type:`button`,onClick:()=>{e.skill_name&&r&&r(e.skill_name,e.proposal_id)},disabled:!e.skill_name||!r,className:`flex w-full gap-3 rounded-md p-1.5 text-left transition-colors enabled:hover:bg-accent/40 disabled:cursor-default`,children:[(0,j.jsx)(`div`,{className:`mt-1 size-2 shrink-0 rounded-full ${e.action===`deployed`?`bg-emerald-500`:e.action===`rejected`||e.action===`rolled_back`?`bg-red-500`:e.action===`validated`?`bg-amber-400`:`bg-primary-accent`}`}),(0,j.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(P,{variant:Da[e.action]??`secondary`,className:`text-[10px]`,children:e.action}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground font-mono`,children:M(e.timestamp)})]}),(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.details}),(0,j.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/60 font-mono`,children:[e.skill_name?`${e.skill_name} · `:``,`#`,e.proposal_id.slice(0,8)]})]})]},`${e.proposal_id}-${t}`)),e.length===0&&(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-4`,children:`No timeline events`})]}),n.length>0&&(0,j.jsx)(qn,{value:`unmatched`,className:`mt-4 space-y-2`,children:n.slice(0,15).map((e,t)=>(0,j.jsxs)(`div`,{className:`flex gap-3`,children:[(0,j.jsx)(`div`,{className:`mt-1 size-2 shrink-0 rounded-full bg-muted-foreground/40`}),(0,j.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-0.5`,children:[(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground font-mono`,children:M(e.timestamp)}),(0,j.jsx)(`p`,{className:`text-xs font-mono text-foreground/80 line-clamp-2`,children:e.query})]})]},`${e.session_id}-${t}`))})]})})]}):(0,j.jsxs)(I,{children:[(0,j.jsx)(L,{children:(0,j.jsxs)(R,{className:`flex items-center gap-2 text-sm`,children:[(0,j.jsx)(pt,{className:`size-4`}),`Activity`]})}),(0,j.jsx)(_n,{children:(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-8`,children:`No recent activity`})})]})}function ka(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Aa=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ja=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ma={};function Na(e,t){return((t||Ma).jsx?ja:Aa).test(e)}var Pa=/[ \t\n\f\r]/g;function Fa(e){return typeof e==`object`?e.type===`text`?Ia(e.value):!1:Ia(e)}function Ia(e){return e.replace(Pa,``)===``}var La=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};La.prototype.normal={},La.prototype.property={},La.prototype.space=void 0;function Ra(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new La(n,r,t)}function za(e){return e.toLowerCase()}var H=class{constructor(e,t){this.attribute=t,this.property=e}};H.prototype.attribute=``,H.prototype.booleanish=!1,H.prototype.boolean=!1,H.prototype.commaOrSpaceSeparated=!1,H.prototype.commaSeparated=!1,H.prototype.defined=!1,H.prototype.mustUseProperty=!1,H.prototype.number=!1,H.prototype.overloadedBoolean=!1,H.prototype.property=``,H.prototype.spaceSeparated=!1,H.prototype.space=void 0;var Ba=e({boolean:()=>U,booleanish:()=>W,commaOrSpaceSeparated:()=>Wa,commaSeparated:()=>Ua,number:()=>G,overloadedBoolean:()=>Ha,spaceSeparated:()=>K}),Va=0,U=Ga(),W=Ga(),Ha=Ga(),G=Ga(),K=Ga(),Ua=Ga(),Wa=Ga();function Ga(){return 2**++Va}var Ka=Object.keys(Ba),qa=class extends H{constructor(e,t,n,r){let i=-1;if(super(e,t),Ja(this,`space`,r),typeof n==`number`)for(;++i<Ka.length;){let e=Ka[i];Ja(this,Ka[i],(n&Ba[e])===Ba[e])}}};qa.prototype.defined=!0;function Ja(e,t,n){n&&(e[t]=n)}function Ya(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new qa(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[za(r)]=r,n[za(a.attribute)]=r}return new La(t,n,e.space)}var Xa=Ya({properties:{ariaActiveDescendant:null,ariaAtomic:W,ariaAutoComplete:null,ariaBusy:W,ariaChecked:W,ariaColCount:G,ariaColIndex:G,ariaColSpan:G,ariaControls:K,ariaCurrent:null,ariaDescribedBy:K,ariaDetails:null,ariaDisabled:W,ariaDropEffect:K,ariaErrorMessage:null,ariaExpanded:W,ariaFlowTo:K,ariaGrabbed:W,ariaHasPopup:null,ariaHidden:W,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:K,ariaLevel:G,ariaLive:null,ariaModal:W,ariaMultiLine:W,ariaMultiSelectable:W,ariaOrientation:null,ariaOwns:K,ariaPlaceholder:null,ariaPosInSet:G,ariaPressed:W,ariaReadOnly:W,ariaRelevant:null,ariaRequired:W,ariaRoleDescription:K,ariaRowCount:G,ariaRowIndex:G,ariaRowSpan:G,ariaSelected:W,ariaSetSize:G,ariaSort:null,ariaValueMax:G,ariaValueMin:G,ariaValueNow:G,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Za(e,t){return t in e?e[t]:t}function Qa(e,t){return Za(e,t.toLowerCase())}var $a=Ya({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Ua,acceptCharset:K,accessKey:K,action:null,allow:null,allowFullScreen:U,allowPaymentRequest:U,allowUserMedia:U,alt:null,as:null,async:U,autoCapitalize:null,autoComplete:K,autoFocus:U,autoPlay:U,blocking:K,capture:null,charSet:null,checked:U,cite:null,className:K,cols:G,colSpan:null,content:null,contentEditable:W,controls:U,controlsList:K,coords:G|Ua,crossOrigin:null,data:null,dateTime:null,decoding:null,default:U,defer:U,dir:null,dirName:null,disabled:U,download:Ha,draggable:W,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:U,formTarget:null,headers:K,height:G,hidden:Ha,high:G,href:null,hrefLang:null,htmlFor:K,httpEquiv:K,id:null,imageSizes:null,imageSrcSet:null,inert:U,inputMode:null,integrity:null,is:null,isMap:U,itemId:null,itemProp:K,itemRef:K,itemScope:U,itemType:K,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:U,low:G,manifest:null,max:null,maxLength:G,media:null,method:null,min:null,minLength:G,multiple:U,muted:U,name:null,nonce:null,noModule:U,noValidate:U,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:U,optimum:G,pattern:null,ping:K,placeholder:null,playsInline:U,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:U,referrerPolicy:null,rel:K,required:U,reversed:U,rows:G,rowSpan:G,sandbox:K,scope:null,scoped:U,seamless:U,selected:U,shadowRootClonable:U,shadowRootDelegatesFocus:U,shadowRootMode:null,shape:null,size:G,sizes:null,slot:null,span:G,spellCheck:W,src:null,srcDoc:null,srcLang:null,srcSet:null,start:G,step:null,style:null,tabIndex:G,target:null,title:null,translate:null,type:null,typeMustMatch:U,useMap:null,value:W,width:G,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:K,axis:null,background:null,bgColor:null,border:G,borderColor:null,bottomMargin:G,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:U,declare:U,event:null,face:null,frame:null,frameBorder:null,hSpace:G,leftMargin:G,link:null,longDesc:null,lowSrc:null,marginHeight:G,marginWidth:G,noResize:U,noHref:U,noShade:U,noWrap:U,object:null,profile:null,prompt:null,rev:null,rightMargin:G,rules:null,scheme:null,scrolling:W,standby:null,summary:null,text:null,topMargin:G,valueType:null,version:null,vAlign:null,vLink:null,vSpace:G,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:U,disableRemotePlayback:U,prefix:null,property:null,results:G,security:null,unselectable:null},space:`html`,transform:Qa}),eo=Ya({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:Wa,accentHeight:G,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:G,amplitude:G,arabicForm:null,ascent:G,attributeName:null,attributeType:null,azimuth:G,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:G,by:null,calcMode:null,capHeight:G,className:K,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:G,diffuseConstant:G,direction:null,display:null,dur:null,divisor:G,dominantBaseline:null,download:U,dx:null,dy:null,edgeMode:null,editable:null,elevation:G,enableBackground:null,end:null,event:null,exponent:G,externalResourcesRequired:null,fill:null,fillOpacity:G,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:Ua,g2:Ua,glyphName:Ua,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:G,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:G,horizOriginX:G,horizOriginY:G,id:null,ideographic:G,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:G,k:G,k1:G,k2:G,k3:G,k4:G,kernelMatrix:Wa,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:G,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:G,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:G,overlineThickness:G,paintOrder:null,panose1:null,path:null,pathLength:G,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:K,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:G,pointsAtY:G,pointsAtZ:G,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Wa,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Wa,rev:Wa,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Wa,requiredFeatures:Wa,requiredFonts:Wa,requiredFormats:Wa,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:G,specularExponent:G,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:G,strikethroughThickness:G,string:null,stroke:null,strokeDashArray:Wa,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:G,strokeOpacity:G,strokeWidth:null,style:null,surfaceScale:G,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Wa,tabIndex:G,tableValues:null,target:null,targetX:G,targetY:G,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Wa,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:G,underlineThickness:G,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:G,values:null,vAlphabetic:G,vMathematical:G,vectorEffect:null,vHanging:G,vIdeographic:G,version:null,vertAdvY:G,vertOriginX:G,vertOriginY:G,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:G,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Za}),to=Ya({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()}}),no=Ya({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Qa}),ro=Ya({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),io={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`},ao=/[A-Z]/g,oo=/-[a-z]/g,so=/^data[-\w.:]+$/i;function co(e,t){let n=za(t),r=t,i=H;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&so.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(oo,uo);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!oo.test(e)){let n=e.replace(ao,lo);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=qa}return new i(r,t)}function lo(e){return`-`+e.toLowerCase()}function uo(e){return e.charAt(1).toUpperCase()}var fo=Ra([Xa,$a,to,no,ro],`html`),po=Ra([Xa,eo,to,no,ro],`svg`);function mo(e){return e.join(` `).trim()}var ho=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 ee(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),ee()}function _(e){return e?e.replace(l,p):p}t.exports=g})),go=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(ho());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}})),_o=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))}})),vo=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(go()),r=_o();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})),yo=xo(`end`),bo=xo(`start`);function xo(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 So(e){let t=bo(e),n=yo(e);if(t&&n)return{start:t,end:n}}function Co(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?To(e.position):`start`in e||`end`in e?To(e):`line`in e||`column`in e?wo(e):``}function wo(e){return Eo(e&&e.line)+`:`+Eo(e&&e.column)}function To(e){return wo(e&&e.start)+`-`+wo(e&&e.end)}function Eo(e){return e&&typeof e==`number`?e:1}var q=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=Co(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}};q.prototype.file=``,q.prototype.name=``,q.prototype.reason=``,q.prototype.message=``,q.prototype.stack=``,q.prototype.column=void 0,q.prototype.line=void 0,q.prototype.ancestors=void 0,q.prototype.cause=void 0,q.prototype.fatal=void 0,q.prototype.place=void 0,q.prototype.ruleId=void 0,q.prototype.source=void 0;var Do=t(vo(),1),Oo={}.hasOwnProperty,ko=new Map,Ao=/[A-Z]/g,jo=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Mo=new Set([`td`,`th`]),No=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Po(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=Go(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=Wo(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`?po:fo,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Fo(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Fo(e,t,n){if(t.type===`element`)return Io(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Lo(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return zo(e,t,n);if(t.type===`mdxjsEsm`)return Ro(e,t);if(t.type===`root`)return Bo(e,t,n);if(t.type===`text`)return Vo(e,t)}function Io(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=po,e.schema=i),e.ancestors.push(t);let a=Zo(e,t.tagName,!1),o=Ko(e,t),s=Jo(e,t);return jo.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Fa(e):!0})),Ho(e,o,a,t),Uo(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Lo(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)}Qo(e,t.position)}function Ro(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Qo(e,t.position)}function zo(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=po,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Zo(e,t.name,!0),o=qo(e,t),s=Jo(e,t);return Ho(e,o,a,t),Uo(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Bo(e,t,n){let r={};return Uo(r,Jo(e,t)),e.create(t,e.Fragment,r,n)}function Vo(e,t){return t.value}function Ho(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Uo(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Wo(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 Go(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=bo(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 Ko(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Oo.call(t.properties,i)){let a=Yo(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Mo.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 qo(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 Qo(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 Qo(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Jo(e,t){let n=[],r=-1,i=e.passKeys?new Map:ko;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=Fo(e,a,o);s!==void 0&&n.push(s)}return n}function Yo(e,t,n){let r=co(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?ka(n):mo(n)),r.property===`style`){let t=typeof n==`object`?n:Xo(e,String(n));return e.stylePropertyNameCase===`css`&&(t=$o(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?io[r.property]||r.property:r.attribute,n]}}function Xo(e,t){try{return(0,Do.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new q("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=No+`#cannot-parse-style-attribute`,r}}function Zo(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=Na(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=Na(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Oo.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Qo(e)}function Qo(e,t){let n=new q("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=No+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function $o(e){let t={},n;for(n in e)Oo.call(e,n)&&(t[es(n)]=e[n]);return t}function es(e){let t=e.replace(Ao,ts);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function ts(e){return`-`+e.toLowerCase()}var ns={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`]},rs={};function is(e,t){let n=t||rs;return as(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function as(e,t,n){if(ss(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 os(e.children,t,n)}return Array.isArray(e)?os(e,t,n):``}function os(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=as(e[i],t,n);return r.join(``)}function ss(e){return!!(e&&typeof e==`object`)}var cs=document.createElement(`i`);function ls(e){let t=`&`+e+`;`;cs.innerHTML=t;let n=cs.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function us(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 ds(e,t){return e.length>0?(us(e,e.length,0,t),e):t}var fs={}.hasOwnProperty;function ps(e){let t={},n=-1;for(;++n<e.length;)ms(t,e[n]);return t}function ms(e,t){let n;for(n in t){let r=(fs.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){fs.call(r,a)||(r[a]=[]);let e=i[a];hs(r[a],Array.isArray(e)?e:e?[e]:[])}}}function hs(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);us(e,0,0,r)}function gs(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 _s(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var vs=Ds(/[A-Za-z]/),ys=Ds(/[\dA-Za-z]/),bs=Ds(/[#-'*+\--9=?A-Z^-~]/);function xs(e){return e!==null&&(e<32||e===127)}var Ss=Ds(/\d/),Cs=Ds(/[\dA-Fa-f]/),ws=Ds(/[!-/:-@[-`{-~]/);function J(e){return e!==null&&e<-2}function Y(e){return e!==null&&(e<0||e===32)}function X(e){return e===-2||e===-1||e===32}var Ts=Ds(/\p{P}|\p{S}/u),Es=Ds(/\s/);function Ds(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Os(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&ys(e.charCodeAt(n+1))&&ys(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 Z(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return X(r)?(e.enter(n),s(r)):t(r)}function s(r){return X(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var ks={tokenize:As};function As(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`),Z(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 J(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var js={tokenize:Ns},Ms={tokenize:Ps};function Ns(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 us(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(Ms,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(Ms,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 J(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++;us(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 Ps(e,t,n){return Z(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Fs(e){if(e===null||Y(e)||Es(e))return 1;if(Ts(e))return 2}function Is(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 Ls={name:`attention`,resolveAll:Rs,tokenize:zs};function Rs(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};Bs(d,-c),Bs(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=ds(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=ds(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=ds(l,Is(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=ds(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=ds(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,us(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 zs(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Fs(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=Fs(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 Bs(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Vs={name:`autolink`,tokenize:Hs};function Hs(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 vs(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||ys(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||ys(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||xs(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):bs(t)?(e.consume(t),l):n(t)}function u(e){return ys(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||ys(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Us={partial:!0,tokenize:Ws};function Ws(e,t,n){return r;function r(t){return X(t)?Z(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||J(e)?t(e):n(e)}}var Gs={continuation:{tokenize:qs},exit:Js,name:`blockQuote`,tokenize:Ks};function Ks(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 X(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function qs(e,t,n){let r=this;return i;function i(t){return X(t)?Z(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Gs,t,n)(r)}}function Js(e){e.exit(`blockQuote`)}var Ys={name:`characterEscape`,tokenize:Xs};function Xs(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 ws(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Zs={name:`characterReference`,tokenize:Qs};function Qs(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=ys,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=Cs,u):(e.enter(`characterReferenceValue`),a=7,o=Ss,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===ys&&!ls(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 $s={partial:!0,tokenize:nc},ec={concrete:!0,name:`codeFenced`,tokenize:tc};function tc(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`),X(t)?Z(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||J(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check($s,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||J(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):X(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Z(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||J(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||J(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&&X(t)?Z(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||J(t)?e.check($s,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||J(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`),X(t)?Z(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`),X(t)?Z(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||J(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function nc(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 rc={name:`codeIndented`,tokenize:ac},ic={partial:!0,tokenize:oc};function ac(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Z(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):J(t)?e.attempt(ic,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||J(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function oc(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):J(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Z(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):J(e)?i(e):n(e)}}var sc={name:`codeText`,previous:lc,resolve:cc,tokenize:uc};function cc(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 lc(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function uc(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)):J(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||J(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 dc=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&&fc(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),fc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),fc(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);fc(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);fc(this.left,t.reverse())}}};function fc(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 pc(e){let t={},n=-1,r,i,a,o,s,c,l,u=new dc(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,mc(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 us(e,0,1/0,u.slice(0)),!l}function mc(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 hc={resolve:_c,tokenize:vc},gc={partial:!0,tokenize:yc};function _c(e){return pc(e),e}function vc(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):J(t)?e.check(gc,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 yc(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Z(e,a,`linePrefix`)}function a(i){if(i===null||J(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 bc(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||xs(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||J(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||Y(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||xs(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 xc(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):J(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||J(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!X(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Sc(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):J(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Z(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||J(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 Cc(e,t){let n;return r;function r(i){return J(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):X(i)?Z(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var wc={name:`definition`,tokenize:Ec},Tc={partial:!0,tokenize:Dc};function Ec(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return xc.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=_s(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 Y(t)?Cc(e,l)(t):l(t)}function l(t){return bc(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Tc,d,d)(t)}function d(t){return X(t)?Z(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||J(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Dc(e,t,n){return r;function r(t){return Y(t)?Cc(e,i)(t):n(t)}function i(t){return Sc(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return X(t)?Z(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||J(e)?t(e):n(e)}}var Oc={name:`hardBreakEscape`,tokenize:kc};function kc(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return J(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Ac={name:`headingAtx`,resolve:jc,tokenize:Mc};function jc(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`},us(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Mc(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||Y(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||J(n)?(e.exit(`atxHeading`),t(n)):X(n)?Z(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||Y(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Nc=`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(`.`),Pc=[`pre`,`script`,`style`,`textarea`],Fc={concrete:!0,name:`htmlFlow`,resolveTo:Rc,tokenize:zc},Ic={partial:!0,tokenize:Vc},Lc={partial:!0,tokenize:Bc};function Rc(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 zc(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):vs(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):vs(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:D:m):n(i)}function h(t){return vs(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Y(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Pc.includes(l)?(i=1,r.interrupt?t(s):D(s)):Nc.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):D(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||ys(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:D):n(i)}function v(t){return X(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||vs(t)?(e.consume(t),b):X(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||ys(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):X(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):X(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||J(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||Y(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||X(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),ee):n(t)}function ee(t){return t===null||J(t)?D(t):X(t)?(e.consume(t),ee):n(t)}function D(t){return t===45&&i===2?(e.consume(t),O):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):J(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Ic,ce,te)(t)):t===null||J(t)?(e.exit(`htmlFlowData`),te(t)):(e.consume(t),D)}function te(t){return e.check(Lc,ne,ce)(t)}function ne(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return t===null||J(t)?te(t):(e.enter(`htmlFlowData`),D(t))}function O(t){return t===45?(e.consume(t),oe):D(t)}function k(t){return t===47?(e.consume(t),o=``,ie):D(t)}function ie(t){if(t===62){let n=o.toLowerCase();return Pc.includes(n)?(e.consume(t),se):D(t)}return vs(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ie):D(t)}function ae(t){return t===93?(e.consume(t),oe):D(t)}function oe(t){return t===62?(e.consume(t),se):t===45&&i===2?(e.consume(t),oe):D(t)}function se(t){return t===null||J(t)?(e.exit(`htmlFlowData`),ce(t)):(e.consume(t),se)}function ce(n){return e.exit(`htmlFlow`),t(n)}}function Bc(e,t,n){let r=this;return i;function i(t){return J(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 Vc(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Us,t,n)}}var Hc={name:`htmlText`,tokenize:Uc};function Uc(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):vs(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):vs(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):J(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?O(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):J(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?O(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?O(t):J(t)?(o=v,k(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):J(t)?(o=y,k(t)):(e.consume(t),y)}function b(e){return e===62?O(e):y(e)}function x(t){return vs(t)?(e.consume(t),S):n(t)}function S(t){return t===45||ys(t)?(e.consume(t),S):C(t)}function C(t){return J(t)?(o=C,k(t)):X(t)?(e.consume(t),C):O(t)}function w(t){return t===45||ys(t)?(e.consume(t),w):t===47||t===62||Y(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),O):t===58||t===95||vs(t)?(e.consume(t),E):J(t)?(o=T,k(t)):X(t)?(e.consume(t),T):O(t)}function E(t){return t===45||t===46||t===58||t===95||ys(t)?(e.consume(t),E):ee(t)}function ee(t){return t===61?(e.consume(t),D):J(t)?(o=ee,k(t)):X(t)?(e.consume(t),ee):T(t)}function D(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,te):J(t)?(o=D,k(t)):X(t)?(e.consume(t),D):(e.consume(t),ne)}function te(t){return t===i?(e.consume(t),i=void 0,re):t===null?n(t):J(t)?(o=te,k(t)):(e.consume(t),te)}function ne(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Y(t)?T(t):(e.consume(t),ne)}function re(e){return e===47||e===62||Y(e)?T(e):n(e)}function O(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 X(t)?Z(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 Wc={name:`labelEnd`,resolveAll:Jc,resolveTo:Yc,tokenize:Xc},Gc={tokenize:Zc},Kc={tokenize:Qc},qc={tokenize:$c};function Jc(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&&us(e,0,e.length,n),e}function Yc(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=ds(s,e.slice(a+1,a+r+3)),s=ds(s,[[`enter`,u,t]]),s=ds(s,Is(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=ds(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=ds(s,e.slice(o+1)),s=ds(s,[[`exit`,c,t]]),us(e,a,e.length,s),e}function Xc(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(_s(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(Gc,u,o?u:d)(t):t===91?e.attempt(Kc,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(qc,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Zc(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 Y(t)?Cc(e,a)(t):a(t)}function a(t){return t===41?u(t):bc(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Y(t)?Cc(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Sc(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Y(t)?Cc(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 Qc(e,t,n){let r=this;return i;function i(t){return xc.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(_s(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function $c(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 el={name:`labelStartImage`,resolveAll:Wc.resolveAll,tokenize:tl};function tl(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 nl={name:`labelStartLink`,resolveAll:Wc.resolveAll,tokenize:rl};function rl(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 il={name:`lineEnding`,tokenize:al};function al(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Z(e,t,`linePrefix`)}}var ol={name:`thematicBreak`,tokenize:sl};function sl(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||J(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),X(t)?Z(e,s,`whitespace`)(t):s(t))}}var Q={continuation:{tokenize:dl},exit:pl,name:`list`,tokenize:ul},cl={partial:!0,tokenize:ml},ll={partial:!0,tokenize:fl};function ul(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:Ss(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(ol,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 Ss(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(Us,r.interrupt?n:u,e.attempt(cl,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return X(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 dl(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Us,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Z(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!X(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(ll,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Z(e,e.attempt(Q,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function fl(e,t,n){let r=this;return Z(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 pl(e){e.exit(this.containerState.type)}function ml(e,t,n){let r=this;return Z(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!X(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var hl={name:`setextUnderline`,resolveTo:gl,tokenize:_l};function gl(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 _l(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`),X(t)?Z(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||J(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var vl={tokenize:yl};function yl(e){let t=this,n=e.attempt(Us,r,e.attempt(this.parser.constructs.flowInitial,i,Z(e,e.attempt(this.parser.constructs.flow,i,e.attempt(hc,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 bl={resolveAll:wl()},xl=Cl(`string`),Sl=Cl(`text`);function Cl(e){return{resolveAll:wl(e===`text`?Tl: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 wl(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 Tl(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 El=e({attentionMarkers:()=>Pl,contentInitial:()=>Ol,disable:()=>Fl,document:()=>Dl,flow:()=>Al,flowInitial:()=>kl,insideSpan:()=>Nl,string:()=>jl,text:()=>Ml}),Dl={42:Q,43:Q,45:Q,48:Q,49:Q,50:Q,51:Q,52:Q,53:Q,54:Q,55:Q,56:Q,57:Q,62:Gs},Ol={91:wc},kl={[-2]:rc,[-1]:rc,32:rc},Al={35:Ac,42:ol,45:[hl,ol],60:Fc,61:hl,95:ol,96:ec,126:ec},jl={38:Zs,92:Ys},Ml={[-5]:il,[-4]:il,[-3]:il,33:el,38:Zs,42:Ls,60:[Vs,Hc],91:nl,92:[Oc,Ys],93:Wc,95:Ls,96:sc},Nl={null:[Ls,bl]},Pl={null:[42,95]},Fl={null:[]};function Il(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=ds(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Is(a,l.events,l),l.events):[]}function f(e,t){return Rl(p(e),t)}function p(e){return Ll(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){J(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&&us(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 Ll(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 Rl(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
|
+
`;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 zl(e){let t={constructs:ps([El,...(e||{}).extensions||[]]),content:n(ks),defined:[],document:n(js),flow:n(vl),lazy:{},string:n(xl),text:n(Sl)};return t;function n(e){return n;function n(n){return Il(t,e,n)}}}function Bl(e){for(;!pc(e););return e}var Vl=/[\0\t\n\r]/g;function Hl(){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(Vl.lastIndex=u,c=Vl.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 Ul=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Wl(e){return e.replace(Ul,Gl)}function Gl(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return gs(n.slice(t?2:1),t?16:10)}return ls(n)||e}var Kl={}.hasOwnProperty;function ql(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Jl(n)(Bl(zl(n).document().write(Hl()(e,t,!0))))}function Jl(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(re),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(D),hardBreakTrailing:c(D),htmlFlow:c(te),htmlFlowData:E,htmlText:c(ne),htmlTextData:E,image:c(k),label:ae,labelText:ie,lineEnding:ee,link:c(O),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()}};Xl(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]];Kl.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]||Ql).call(a,void 0,e[0])}for(r.position={start:Yl(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Yl(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:Yl(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]||Ql).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Co({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Yl(e.end)}function u(){return is(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=_s(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:Yl(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=Yl(e.end)}function ee(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Yl(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 D(){this.data.atHardBreak=!0}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.resume(),t=this.stack[this.stack.length-1];t.value=e}function O(){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=Wl(t),n.identifier=_s(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=_s(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=gs(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=ls(t);let i=this.stack[this.stack.length-1];i.value+=r}function pe(e){let t=this.stack.pop();t.position.end=Yl(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 Yl(e){return{line:e.line,column:e.column,offset:e.offset}}function Xl(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Xl(e,r):Zl(e,r)}}function Zl(e,t){let n;for(n in t)if(Kl.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 Ql(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Co({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Co({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Co({start:t.start,end:t.end})+`) is still open`)}function $l(e){let t=this;t.parser=n;function n(n){return ql(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function eu(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 tu(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
5
|
+
`}]}function nu(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 ru(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function iu(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function au(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Os(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 ou(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 su(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function cu(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 lu(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return cu(e,t);let i={src:Os(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 uu(e,t){let n={src:Os(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 du(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 fu(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return cu(e,t);let i={href:Os(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 pu(e,t){let n={href:Os(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 mu(e,t,n){let r=e.all(t),i=n?hu(n):gu(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
|
+
`}),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 hu(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=gu(n[r])}return t}function gu(e){return e.spread??e.children.length>1}function _u(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 vu(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function yu(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function bu(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function xu(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=bo(t.children[1]),o=yo(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 Su(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 Cu(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var wu=9,Tu=32;function Eu(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(Du(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Du(t.slice(i),i>0,!1)),a.join(``)}function Du(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===wu||t===Tu;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===wu||t===Tu;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Ou(e,t){let n={type:`text`,value:Eu(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function ku(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Au={blockquote:eu,break:tu,code:nu,delete:ru,emphasis:iu,footnoteReference:au,heading:ou,html:su,imageReference:lu,image:uu,inlineCode:du,linkReference:fu,link:pu,listItem:mu,list:_u,paragraph:vu,root:yu,strong:bu,table:xu,tableCell:Cu,tableRow:Su,text:Ou,thematicBreak:ku,toml:ju,yaml:ju,definition:ju,footnoteDefinition:ju};function ju(){}var Mu=typeof self==`object`?self:globalThis,Nu=(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 Mu[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 Mu[a](o),i)};return r},Pu=e=>Nu(new Map,e)(0),Fu=``,{toString:Iu}={},{keys:Lu}=Object,Ru=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Iu.call(e).slice(8,-1);switch(n){case`Array`:return[1,Fu];case`Object`:return[2,Fu];case`Date`:return[3,Fu];case`RegExp`:return[4,Fu];case`Map`:return[5,Fu];case`Set`:return[6,Fu];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},zu=([e,t])=>e===0&&(t===`function`||t===`symbol`),Bu=(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]=Ru(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 Lu(r))(e||!zu(Ru(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||!(zu(Ru(n))||zu(Ru(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!zu(Ru(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},Vu=(e,{json:t,lossy:n}={})=>{let r=[];return Bu(!(t||n),!!t,new Map,r)(e),r},Hu=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?Pu(Vu(e,t)):structuredClone(e):(e,t)=>Pu(Vu(e,t));function Uu(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 Wu(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function Gu(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||Uu,r=e.options.footnoteBackLabel||Wu,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=Os(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:{...Hu(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
9
|
+
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
10
|
+
`}]}}var Ku=(function(e){if(e==null)return Zu;if(typeof e==`function`)return Xu(e);if(typeof e==`object`)return Array.isArray(e)?qu(e):Ju(e);if(typeof e==`string`)return Yu(e);throw Error(`Expected function, string, or object as test`)});function qu(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Ku(e[n]);return Xu(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function Ju(e){let t=e;return Xu(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Yu(e){return Xu(t);function t(t){return t&&t.type===e}}function Xu(e){return t;function t(t,n,r){return!!(Qu(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Zu(){return!0}function Qu(e){return typeof e==`object`&&!!e&&`type`in e}function $u(e){return e}var ed=[];function td(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=Ku(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 (`+$u(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=ed,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=nd(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 nd(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?ed:[e]}function rd(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),td(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 id={}.hasOwnProperty,ad={};function od(e,t){let n=t||ad,r=new Map,i=new Map,a={all:s,applyData:cd,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Au,...n.handlers},one:o,options:n,patch:sd,wrap:ud};return rd(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(id.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=Hu(n);return r.children=a.all(e),r}return Hu(e)}return(a.options.unknownHandler||ld)(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=dd(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=dd(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function sd(e,t){e.position&&(t.position=So(e))}function cd(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,Hu(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function ld(e,t){let n=t.data||{},r=`value`in t&&!(id.call(n,`hProperties`)||id.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 ud(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
11
|
+
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
12
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
13
|
+
`}),n}function dd(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function fd(e,t){let n=od(e,t),r=n.one(e,void 0),i=Gu(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 pd(e,t){return e&&`run`in e?async function(n,r){let i=fd(n,{file:r,...t});await e.run(i,r)}:function(n,r){return fd(n,{file:r,...e||t})}}function md(e){if(e)throw e}var hd=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 gd(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 _d(){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?vd(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 vd(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 yd={basename:bd,dirname:xd,extname:Sd,join:Cd,sep:`/`};function bd(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Ed(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 xd(e){if(Ed(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 Sd(e){Ed(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 Cd(...e){let t=-1,n;for(;++t<e.length;)Ed(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:wd(n)}function wd(e){Ed(e);let t=e.codePointAt(0)===47,n=Td(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Td(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 Ed(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Dd={cwd:Od};function Od(){return`/`}function kd(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Ad(e){if(typeof e==`string`)e=new URL(e);else if(!kd(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 jd(e)}function jd(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 Md=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],Nd=class{constructor(e){let t;t=e?kd(e)?{path:e}:typeof e==`string`||Ld(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Dd.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Md.length;){let e=Md[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)Md.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?yd.basename(this.path):void 0}set basename(e){Fd(e,`basename`),Pd(e,`basename`),this.path=yd.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?yd.dirname(this.path):void 0}set dirname(e){Id(this.basename,`dirname`),this.path=yd.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?yd.extname(this.path):void 0}set extname(e){if(Pd(e,`extname`),Id(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=yd.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){kd(e)&&(e=Ad(e)),Fd(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?yd.basename(this.path,this.extname):void 0}set stem(e){Fd(e,`stem`),Pd(e,`stem`),this.path=yd.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 q(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 Pd(e,t){if(e&&e.includes(yd.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+yd.sep+"`")}function Fd(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Id(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Ld(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Rd=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),zd=t(hd(),1),Bd={}.hasOwnProperty,Vd=new class e extends Rd{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=_d()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,zd.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Wd(`data`,this.frozen),this.namespace[e]=t,this):Bd.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Wd(`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=qd(e),n=this.parser||this.Parser;return Hd(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Hd(`process`,this.parser||this.Parser),Ud(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=qd(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);Yd(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(),Hd(`processSync`,this.parser||this.Parser),Ud(`processSync`,this.compiler||this.Compiler),this.process(e,r),Kd(`processSync`,`process`,t),n;function r(e,r){t=!0,md(e),n=r}}run(e,t,n){Gd(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=qd(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),Kd(`runSync`,`run`,n),r;function i(e,t){md(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=qd(t),r=this.compiler||this.Compiler;return Ud(`stringify`,r),Gd(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Wd(`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,zd.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];gd(o)&&gd(r)&&(r=(0,zd.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Hd(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Ud(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Wd(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 Gd(e){if(!gd(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Kd(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function qd(e){return Jd(e)?e:new Nd(e)}function Jd(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Yd(e){return typeof e==`string`||Xd(e)}function Xd(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Zd=[],Qd={allowDangerousHtml:!0},$d=/^(https?|ircs?|mailto|xmpp)$/i,ef=[{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 tf(e){let t=nf(e),n=rf(e);return af(t.runSync(t.parse(n),n),e)}function nf(e){let t=e.rehypePlugins||Zd,n=e.remarkPlugins||Zd,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Qd}:Qd;return Vd().use($l).use(n).use(pd,r).use(t)}function rf(e){let t=e.children||``,n=new Nd;return typeof t==`string`?n.value=t:``+t,n}function af(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||of;for(let e of ef)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return rd(e,l),Po(e,{Fragment:j.Fragment,components:i,ignoreInvalidStyle:!0,jsx:j.jsx,jsxs:j.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 ns)if(Object.hasOwn(ns,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=ns[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 of(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||$d.test(e.slice(0,t))?e:``}var sf={created:(0,j.jsx)(De,{className:`size-3.5`}),validated:(0,j.jsx)(qe,{className:`size-3.5`}),deployed:(0,j.jsx)(ze,{className:`size-3.5`}),rejected:(0,j.jsx)(ke,{className:`size-3.5`}),rolled_back:(0,j.jsx)(rt,{className:`size-3.5`})},cf={created:`outline`,validated:`secondary`,deployed:`default`,rejected:`destructive`,rolled_back:`destructive`};function lf(e){let t=e.split(`
|
|
15
|
+
`);if(t.length<3||t[0].trim()!==`---`)return{meta:{},body:e};let n=-1;for(let e=1;e<t.length;e++)if(t[e].trim()===`---`){n=e;break}if(n===-1)return{meta:{},body:e};let r={};for(let e of t.slice(1,n)){let t=e.indexOf(`:`);if(t>0){let n=e.slice(0,t).trim(),i=e.slice(t+1).trim();n&&i&&(r[n]=i)}}return{meta:r,body:t.slice(n+1).join(`
|
|
16
|
+
`)}}function uf({meta:e}){let t=Object.entries(e);return t.length===0?null:(0,j.jsx)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:t.map(([e,t])=>(0,j.jsxs)(`div`,{className:`contents`,children:[(0,j.jsx)(`span`,{className:`font-medium text-muted-foreground capitalize`,children:e}),(0,j.jsx)(`span`,{className:`text-foreground truncate`,children:t})]},e))})}function df({label:e,text:t,variant:n}){let{meta:r,body:i}=lf(t),a=Object.keys(r).length>0;return(0,j.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(k,{className:`size-3.5 text-muted-foreground`}),(0,j.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:e}),n===`proposed`&&(0,j.jsx)(P,{variant:`secondary`,className:`text-[10px]`,children:`New`})]}),a&&(0,j.jsx)(`div`,{className:`rounded-md border bg-muted/30 p-3`,children:(0,j.jsx)(uf,{meta:r})}),(0,j.jsx)(`div`,{className:`skill-markdown rounded-md border bg-card p-4`,children:(0,j.jsx)(tf,{children:i})})]})}function ff(e,t){if(typeof t==`boolean`)return t?(0,j.jsx)(je,{className:`size-3.5 text-emerald-500 inline`}):(0,j.jsx)(ke,{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,j.jsxs)(`span`,{className:`font-mono`,children:[t>0&&e.includes(`change`)?`+`:``,n,`%`]})}return(0,j.jsx)(`span`,{className:`font-mono`,children:t})}return t==null?(0,j.jsx)(`span`,{className:`text-muted-foreground`,children:`--`}):typeof t==`string`?(0,j.jsx)(`span`,{children:t}):Array.isArray(t)?t.length===0?(0,j.jsx)(`span`,{className:`text-muted-foreground italic`,children:`none`}):(0,j.jsxs)(`span`,{className:`font-mono`,children:[t.length,` entries`]}):typeof t==`object`?(0,j.jsx)(`span`,{className:`font-mono`,children:`1 entry`}):(0,j.jsx)(`span`,{children:String(t)})}function pf({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=e.passed??e.matched,c=typeof o==`boolean`?o:typeof s==`boolean`?s:null;return(0,j.jsxs)(`div`,{className:`flex items-start gap-2 text-xs py-1.5 border-b border-border/50 last:border-0`,children:[c===null?(0,j.jsx)(De,{className:`size-3.5 text-muted-foreground shrink-0 mt-0.5`}):c?(0,j.jsx)(je,{className:`size-3.5 text-emerald-500 shrink-0 mt-0.5`}):(0,j.jsx)(ke,{className:`size-3.5 text-red-500 shrink-0 mt-0.5`}),(0,j.jsx)(`span`,{className:`flex-1 min-w-0 line-clamp-2`,children:n?String(n):JSON.stringify(e)}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[typeof a==`boolean`&&typeof o==`boolean`&&(0,j.jsxs)(`span`,{className:`text-[10px] text-muted-foreground font-mono`,children:[a?`pass`:`fail`,` → `,o?`pass`:`fail`]}),r!==void 0&&(0,j.jsxs)(P,{variant:`secondary`,className:`text-[9px]`,children:[`expect: `,String(r)]}),i!=null&&(0,j.jsx)(P,{variant:`secondary`,className:`text-[9px]`,children:String(i)})]})]})}function mf({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,...c}=e,l=Array.isArray(a)?a:[],u=Array.isArray(o)?o:[],d=Array.isArray(s)?s:[];return(0,j.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-3 space-y-3`,children:[(0,j.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[`Validation Results`,(0,j.jsx)(`span`,{className:`font-normal text-muted-foreground/60 ml-1.5`,children:`— Before/after comparison from eval tests`})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[t!==void 0&&(0,j.jsx)(P,{variant:t?`default`:`destructive`,className:`text-[10px]`,children:t?`Improved`:`Regressed`}),typeof n==`number`&&typeof r==`number`&&(0,j.jsxs)(`span`,{className:`text-xs font-mono text-muted-foreground`,children:[(n*100).toFixed(1),`% → `,(r*100).toFixed(1),`%`]}),typeof i==`number`&&(0,j.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),`%`]})]}),u.length>0&&(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`p`,{className:`text-[11px] font-medium text-emerald-600 dark:text-emerald-400 mb-1`,children:[`New Passes (`,u.length,`)`]}),(0,j.jsx)(`div`,{className:`rounded border bg-card p-2`,children:u.map((e,t)=>(0,j.jsx)(pf,{entry:typeof e==`object`&&e?e:{value:e}},t))})]}),l.length>0&&(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`p`,{className:`text-[11px] font-medium text-red-500 mb-1`,children:[`Regressions (`,l.length,`)`]}),(0,j.jsx)(`div`,{className:`rounded border border-red-200 dark:border-red-900/50 bg-card p-2`,children:l.map((e,t)=>(0,j.jsx)(pf,{entry:typeof e==`object`&&e?e:{value:e}},t))})]}),d.length>0&&(0,j.jsx)(hf,{entries:d}),Object.keys(c).length>0&&(0,j.jsx)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:Object.entries(c).map(([e,t])=>(0,j.jsxs)(`div`,{className:`contents`,children:[(0,j.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:e}),(0,j.jsx)(`span`,{className:`text-foreground`,children:ff(e,t)})]},e))})]})}function hf({entries:e}){let[t,n]=(0,A.useState)(!1),r=e.filter(e=>{if(typeof e!=`object`||!e)return!1;let t=e;return t.passed===!0||t.matched===!0||t.triggered===!0||t.after===!0||t.result===!0}).length,i=t?e:e.slice(0,5);return(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,j.jsxs)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:[`Individual Test Cases (`,r,`/`,e.length,` passed)`]}),e.length>5&&(0,j.jsx)(`button`,{type:`button`,onClick:()=>n(!t),className:`text-[10px] text-primary hover:underline`,children:t?`Show less`:`Show all ${e.length}`})]}),(0,j.jsx)(`div`,{className:`h-1.5 rounded-full bg-muted overflow-hidden mb-2`,children:(0,j.jsx)(`div`,{className:`h-full rounded-full bg-emerald-500 transition-all`,style:{width:`${e.length>0?r/e.length*100:0}%`}})}),(0,j.jsx)(`div`,{className:`rounded border bg-card p-2 max-h-[300px] overflow-y-auto`,children:i.map((e,t)=>(0,j.jsx)(pf,{entry:typeof e==`object`&&e?e:{value:e}},t))})]})}function gf(e){if(!e.validation)return null;let t=e.validation.after_pass_rate;return typeof t==`number`?t:null}function _f({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,j.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 vf({evalSet:e}){let[t,n]=(0,A.useState)(!1),r=e.filter(e=>(e.passed??e.result)===!0).length;return(0,j.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-3 space-y-2`,children:[(0,j.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`flex items-center gap-1.5 w-full text-left`,children:[t?(0,j.jsx)(Le,{className:`size-3.5 text-muted-foreground shrink-0`}):(0,j.jsx)(Fe,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,j.jsx)(x,{className:`size-3.5 text-muted-foreground`}),(0,j.jsxs)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:[`Eval Set (`,r,`/`,e.length,` passed)`]})]}),t&&(0,j.jsx)(`div`,{className:`space-y-1`,children:e.map((e,t)=>{let n=e.query??e.prompt??e.input,r=e.expected??e.should_trigger,i=e.passed??e.result;return(0,j.jsxs)(`div`,{className:`flex items-start gap-2 text-xs py-1 border-b border-border/50 last:border-0`,children:[typeof i==`boolean`?i?(0,j.jsx)(je,{className:`size-3.5 text-emerald-500 shrink-0 mt-0.5`}):(0,j.jsx)(ke,{className:`size-3.5 text-red-500 shrink-0 mt-0.5`}):(0,j.jsx)(De,{className:`size-3.5 text-muted-foreground shrink-0 mt-0.5`}),(0,j.jsx)(`span`,{className:`flex-1 min-w-0 line-clamp-2`,children:String(n??JSON.stringify(e))}),r!==void 0&&(0,j.jsxs)(P,{variant:`secondary`,className:`text-[9px] shrink-0`,children:[`expect: `,String(r)]})]},t)})})]})}function yf({entry:e,roundLabel:t,roundStatus:n,prevPassRate:r,currPassRate:i}){let a=n!==`single`;return(0,j.jsxs)(I,{className:n===`final`?`border-primary/50 shadow-sm`:void 0,children:[(0,j.jsx)(L,{className:`pb-3`,children:(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsxs)(R,{className:`text-sm flex items-center gap-2`,children:[(0,j.jsx)(Ze,{className:`size-4 text-muted-foreground`}),`Evidence: `,e.target,a&&t&&(0,j.jsx)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:t}),n===`final`&&(0,j.jsx)(P,{variant:`default`,className:`text-[10px]`,children:`Final`})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a&&(0,j.jsx)(_f,{prev:r,curr:i}),(0,j.jsx)(P,{variant:`secondary`,className:`text-[10px]`,children:e.stage}),e.confidence!==null&&(0,j.jsxs)(P,{variant:e.confidence>=.8?`default`:e.confidence>=.5?`secondary`:`destructive`,className:`text-[10px] font-mono`,children:[fn(e.confidence),` confidence`]}),(0,j.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:M(e.timestamp)})]})]})}),(0,j.jsxs)(_n,{className:`space-y-4`,children:[e.rationale&&(0,j.jsxs)(`div`,{className:`rounded-md border-l-2 border-primary/40 bg-primary/5 px-3 py-2`,children:[(0,j.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground mb-1`,children:`Rationale`}),(0,j.jsx)(`p`,{className:`text-sm leading-relaxed`,children:e.rationale})]}),e.details&&(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:e.details}),(e.original_text||e.proposed_text)&&(0,j.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[e.original_text&&(0,j.jsx)(df,{label:`Original`,text:e.original_text,variant:`original`}),e.proposed_text&&(0,j.jsx)(df,{label:`Proposed`,text:e.proposed_text,variant:`proposed`})]}),e.eval_set&&e.eval_set.length>0&&(0,j.jsx)(vf,{evalSet:e.eval_set}),e.validation&&Object.keys(e.validation).length>0&&(0,j.jsx)(mf,{validation:e.validation})]})]})}function bf({entry:e,roundLabel:t,onExpand:n}){let r=gf(e),i=e.validation?.improved;return(0,j.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,j.jsx)(Fe,{className:`size-4 text-muted-foreground shrink-0`}),(0,j.jsx)(Ze,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.target}),(0,j.jsx)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:t}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto shrink-0`,children:[r!==null&&(0,j.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:[(r*100).toFixed(1),`% pass rate`]}),typeof i==`boolean`&&(0,j.jsx)(P,{variant:i?`default`:`destructive`,className:`text-[9px]`,children:i?`Improved`:`Regressed`}),(0,j.jsx)(P,{variant:`secondary`,className:`text-[10px]`,children:e.stage}),(0,j.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:M(e.timestamp)})]})]})}function xf({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,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.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,j.jsx)(T,{className:`size-4 text-primary/60 shrink-0 mt-0.5`}),(0,j.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,j.jsxs)(I,{children:[(0,j.jsx)(L,{className:`pb-3`,children:(0,j.jsxs)(R,{className:`text-sm flex items-center gap-2`,children:[(0,j.jsx)(`span`,{children:`Proposal Journey`}),(0,j.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[`#`,e.slice(0,12)]})]})}),(0,j.jsxs)(_n,{className:`space-y-3`,children:[(0,j.jsx)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:r.map((e,t)=>(0,j.jsxs)(`div`,{className:`contents`,children:[t>0&&(0,j.jsx)(Je,{className:`size-3 text-muted-foreground/50 shrink-0`}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 bg-card`,children:[sf[e.action],(0,j.jsx)(P,{variant:cf[e.action]??`secondary`,className:`text-[10px] capitalize`,children:e.action.replace(`_`,` `)}),(0,j.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:M(e.timestamp)})]})]},`${e.action}-${t}`))}),c&&(0,j.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,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[c.net_change>0?(0,j.jsx)(gt,{className:`size-3.5 text-emerald-500`}):(0,j.jsx)(wt,{className:`size-3.5 text-red-500`}),(0,j.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,j.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,j.jsx)(P,{variant:c.improved?`default`:`destructive`,className:`text-[10px]`,children:c.improved?`Improved`:`Regressed`})]}),r.length>0&&r[r.length-1].details&&(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:r[r.length-1].details})]})]}),l.map(e=>(0,j.jsx)(yf,{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,j.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?gf(t[i-1]):null,u=gf(r),d=`${e}-${r.timestamp}`,f=n?o?`final`:`intermediate`:`single`;return f===`intermediate`&&!a.has(d)?(0,j.jsx)(bf,{entry:r,roundLabel:c,onExpand:()=>s(d)},d):f===`intermediate`&&a.has(d)?(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.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,j.jsx)(Le,{className:`size-3`}),`Collapse `,c]}),(0,j.jsx)(yf,{entry:r,roundLabel:c,roundStatus:f,prevPassRate:l,currPassRate:u})]},d):(0,j.jsx)(yf,{entry:r,roundLabel:c,roundStatus:f,prevPassRate:l,currPassRate:u},d)})},e)}),i.length===0&&(0,j.jsx)(`div`,{className:`flex items-center justify-center rounded-lg border border-dashed py-8`,children:(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No evidence entries for this proposal`})})]})}var Sf={created:(0,j.jsx)(De,{className:`size-3.5`}),validated:(0,j.jsx)(qe,{className:`size-3.5`}),deployed:(0,j.jsx)(ze,{className:`size-3.5`}),rejected:(0,j.jsx)(ke,{className:`size-3.5`}),rolled_back:(0,j.jsx)(rt,{className:`size-3.5`})},Cf={created:`bg-blue-500`,validated:`bg-amber-500`,deployed:`bg-emerald-500`,rejected:`bg-red-500`,rolled_back:`bg-red-400`},wf={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`},Tf={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 Ef(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 Df(e){return e[e.length-1].action}function Of(e){for(let t=e.length-1;t>=0;t--)if(e[t].eval_snapshot)return e[t].eval_snapshot;return null}function kf({snapshot:e}){let t=e.net_change;if(t==null)return null;let n=Math.round(t*100),r=n>0;return(0,j.jsxs)(`span`,{className:N(`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,j.jsx)(gt,{className:`size-2.5`}):(0,j.jsx)(wt,{className:`size-2.5`}),r?`+`:``,n,`%`]})}var Af=[{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 jf(){let[e,t]=(0,A.useState)(!1);return(0,j.jsxs)(`div`,{className:`px-2 pb-2`,children:[(0,j.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,j.jsx)(Le,{className:`size-3`}):(0,j.jsx)(Fe,{className:`size-3`}),`Lifecycle stages`]}),e&&(0,j.jsx)(`div`,{className:`mt-1.5 space-y-1.5 rounded-md border bg-muted/30 p-2`,children:Af.map(e=>(0,j.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,j.jsx)(`div`,{className:N(`size-2 rounded-full mt-1 shrink-0`,Cf[e.action])}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-medium`,children:e.label}),(0,j.jsx)(`p`,{className:`text-[10px] text-muted-foreground/70 leading-tight`,children:e.desc})]})]},e.action))})]})}function Mf({entries:e,selectedProposalId:t,onSelect:n}){let r=Ef(e);return r.length===0?(0,j.jsx)(`div`,{className:`flex items-center justify-center rounded-lg border border-dashed py-6 px-3`,children:(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No evolution history yet`})}):(0,j.jsxs)(`div`,{className:`flex flex-col gap-0`,children:[(0,j.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,j.jsx)(jf,{}),(0,j.jsx)(`nav`,{className:`flex flex-col`,children:r.map(([e,i],a)=>{let o=Df(i),s=t===e,c=i[i.length-1],l=Cf[o]??`bg-muted-foreground`,u=wf[o]??`ring-muted-foreground/30`,d=Tf[o]??`bg-border`,f=a===r.length-1,p=Of(i);return(0,j.jsxs)(`div`,{className:`relative flex gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,j.jsx)(`div`,{className:N(`flex items-center justify-center size-7 rounded-full ring-2 text-white shrink-0 z-10`,l,u),children:Sf[o]??(0,j.jsx)(De,{className:`size-3.5`})}),!f&&(0,j.jsx)(`div`,{className:N(`w-0.5 flex-1 min-h-[16px]`,d)})]}),(0,j.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:N(`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,j.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(P,{variant:o===`deployed`?`default`:o===`rejected`||o===`rolled_back`?`destructive`:`secondary`,className:`text-[10px] capitalize`,children:o.replace(`_`,` `)}),(0,j.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:M(c.timestamp)})]}),p&&(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1`,children:[(0,j.jsx)(kf,{snapshot:p}),p.before_pass_rate!==void 0&&p.after_pass_rate!==void 0&&(0,j.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,j.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1`,children:[(0,j.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground/70`,children:[`#`,e.slice(0,8)]}),i.length>1&&(0,j.jsx)(`div`,{className:`flex gap-0.5 ml-auto`,children:i.map((e,t)=>(0,j.jsx)(`div`,{className:N(`size-1.5 rounded-full`,Cf[e.action]??`bg-muted-foreground`)},`${e.action}-${t}`))})]}),c.details&&(0,j.jsx)(`p`,{className:`text-[11px] text-muted-foreground/80 line-clamp-2 mt-1 leading-snug`,children:c.details})]})]},e)})})]})}function $({text:e}){return(0,j.jsxs)(Yn,{children:[(0,j.jsx)(Xn,{className:`inline-flex items-center text-muted-foreground/50 hover:text-muted-foreground transition-colors cursor-help`,onClick:e=>e.preventDefault(),children:(0,j.jsx)(T,{className:`size-3`})}),(0,j.jsx)(Zn,{side:`top`,className:`max-w-[220px]`,children:e})]})}var Nf={evolve:(0,j.jsx)(mt,{className:`size-3 text-amber-500`}),watch:(0,j.jsx)(le,{className:`size-3 text-blue-500`}),skip:(0,j.jsx)(kt,{className:`size-3 text-muted-foreground`})};function Pf({action:e}){return(0,j.jsxs)(`div`,{className:`flex items-start gap-2 py-1`,children:[(0,j.jsx)(`div`,{className:`mt-0.5 shrink-0`,children:Nf[e.action]??null}),(0,j.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(`span`,{className:`text-xs font-medium truncate`,children:e.skill}),(0,j.jsx)(P,{variant:e.rolledBack?`destructive`:e.action===`evolve`&&e.deployed?`default`:e.action===`evolve`?`secondary`:e.action===`watch`?`outline`:`secondary`,className:`text-[10px] h-4 px-1.5 shrink-0`,children:e.rolledBack?`rolled back`:e.action===`evolve`&&e.deployed?`deployed`:e.action===`evolve`?`evolved`:e.action}),e.alert&&(0,j.jsx)(P,{variant:`destructive`,className:`text-[10px] h-4 px-1.5 shrink-0`,children:`alert`})]}),(0,j.jsx)(`p`,{className:`text-[11px] text-muted-foreground line-clamp-1`,children:e.reason})]})]})}function Ff({run:e}){let[t,n]=(0,A.useState)(!1),r=e.skill_actions.filter(e=>e.action!==`skip`),i=e.skill_actions.filter(e=>e.action===`skip`);return(0,j.jsxs)(yn,{open:t,onOpenChange:n,children:[(0,j.jsx)(bn,{className:`w-full text-left`,children:(0,j.jsxs)(`div`,{className:`flex items-start gap-3 py-2 hover:bg-muted/50 rounded-md px-2 -mx-2 transition-colors`,children:[(0,j.jsx)(`div`,{className:`mt-1.5 size-2 shrink-0 rounded-full ${e.deployed>0?`bg-emerald-500`:e.evolved>0?`bg-amber-400`:`bg-muted-foreground/40`}`}),(0,j.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-xs font-mono text-muted-foreground`,children:M(e.timestamp)}),e.dry_run&&(0,j.jsx)(P,{variant:`outline`,className:`text-[10px] h-4 px-1.5`,children:`dry-run`}),e.approval_mode===`review`&&(0,j.jsx)(P,{variant:`outline`,className:`text-[10px] h-4 px-1.5`,children:`review`})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-3 mt-1 text-xs text-muted-foreground`,children:[e.deployed>0&&(0,j.jsxs)(`span`,{className:`text-emerald-600 font-medium`,children:[e.deployed,` deployed`]}),e.evolved>0&&(0,j.jsxs)(`span`,{children:[e.evolved,` evolved`]}),e.watched>0&&(0,j.jsxs)(`span`,{children:[e.watched,` watched`]}),e.skipped>0&&(0,j.jsxs)(`span`,{children:[e.skipped,` skipped`]}),(0,j.jsxs)(`span`,{children:[(e.elapsed_ms/1e3).toFixed(1),`s`]})]})]}),(0,j.jsx)(Fe,{className:`size-4 text-muted-foreground shrink-0 mt-1 transition-transform duration-200 ${t?`rotate-90`:``}`})]})}),(0,j.jsx)(xn,{children:(0,j.jsxs)(`div`,{className:`ml-5 pl-3 border-l border-border space-y-0.5 pb-2`,children:[r.map((e,t)=>(0,j.jsx)(Pf,{action:e},`${e.skill}-${t}`)),i.length>0&&(0,j.jsxs)(`details`,{className:`group`,children:[(0,j.jsxs)(`summary`,{className:`text-[11px] text-muted-foreground cursor-pointer hover:text-foreground py-1`,children:[i.length,` skipped`]}),(0,j.jsx)(`div`,{className:`space-y-0.5`,children:i.map((e,t)=>(0,j.jsx)(Pf,{action:e},`${e.skill}-skip-${t}`))})]})]})})]})}function If({runs:e}){if(e.length===0)return(0,j.jsxs)(I,{children:[(0,j.jsx)(L,{children:(0,j.jsxs)(R,{className:`flex items-center gap-2 text-sm`,children:[(0,j.jsx)(h,{className:`size-4`}),`Orchestrate Runs`]})}),(0,j.jsx)(_n,{children:(0,j.jsxs)(`p`,{className:`text-sm text-muted-foreground text-center py-4`,children:[`No orchestrate runs yet. Run`,` `,(0,j.jsx)(`code`,{className:`text-xs bg-muted px-1 py-0.5 rounded`,children:`selftune orchestrate`}),` to start.`]})})]});let t=e.reduce((e,t)=>e+t.deployed,0);return(0,j.jsxs)(I,{children:[(0,j.jsxs)(L,{children:[(0,j.jsxs)(R,{className:`flex items-center gap-2 text-sm`,children:[(0,j.jsx)(h,{className:`size-4`}),`Orchestrate Runs`]}),(0,j.jsxs)(z,{children:[e.length,` recent run`,e.length===1?``:`s`,t>0&&(0,j.jsxs)(j.Fragment,{children:[` · `,t,` total deployments`]})]})]}),(0,j.jsx)(_n,{className:`space-y-0`,children:e.slice(0,10).map(e=>(0,j.jsx)(Ff,{run:e},e.run_id))})]})}function Lf({items:e}){return e.length===0?(0,j.jsxs)(I,{children:[(0,j.jsx)(L,{children:(0,j.jsxs)(R,{className:`flex items-center gap-2 text-sm`,children:[(0,j.jsx)(mt,{className:`size-4`}),`Recent Activity`]})}),(0,j.jsx)(_n,{children:(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-8`,children:`No recent skill invocations`})})]}):(0,j.jsxs)(I,{children:[(0,j.jsxs)(L,{children:[(0,j.jsxs)(R,{className:`flex items-center gap-2 text-sm`,children:[(0,j.jsx)(mt,{className:`size-4`}),`Recent Activity`]}),(0,j.jsx)(z,{children:`Latest skill invocations across sessions`})]}),(0,j.jsx)(_n,{className:`space-y-2.5`,children:e.slice(0,20).map((e,t)=>(0,j.jsxs)(`div`,{className:`flex gap-3 rounded-md p-1.5`,children:[(0,j.jsx)(`div`,{className:`mt-1 size-2 shrink-0 rounded-full ${e.triggered?`bg-emerald-500`:`bg-muted-foreground/40`}`}),(0,j.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-0.5`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,j.jsx)(`span`,{className:`text-xs font-medium truncate`,children:e.skill_name}),e.is_live&&(0,j.jsxs)(P,{variant:`outline`,className:`h-4 px-1 text-[10px] gap-1`,children:[(0,j.jsx)(De,{className:`size-2.5 text-emerald-500`}),`live`]}),e.triggered?(0,j.jsx)(P,{variant:`default`,className:`h-4 px-1 text-[10px]`,children:`triggered`}):(0,j.jsx)(P,{variant:`secondary`,className:`h-4 px-1 text-[10px]`,children:`checked`}),(0,j.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-mono ml-auto shrink-0`,children:M(e.timestamp)})]}),e.query&&(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-1 font-mono`,children:e.query})]})]},`${e.session_id}-${e.skill_name}-${t}`))})]})}function Rf({skillsCount:e,avgPassRate:t,unmatchedCount:n,sessionsCount:r,pendingCount:i,evidenceCount:a,hasEvolution:o=!0,activeSessionsCount:s=0}){let c=t===null?`--`:`${Math.round(t*100)}%`,l=t!==null&&t>=.7;return(0,j.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 px-4 *:data-[slot=card]:shadow-xs lg:px-6 @xl/main:grid-cols-2 @5xl/main:grid-cols-3`,children:[(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(Te,{className:`size-3.5`}),`Skills Monitored`,(0,j.jsx)($,{text:`Total number of skills detected and being tracked by selftune`})]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl`,children:e}),(0,j.jsx)(gn,{children:(0,j.jsxs)(P,{variant:`outline`,children:[(0,j.jsx)(pt,{className:`size-3`}),`live`]})})]})}),(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(ee,{className:`size-3.5`}),`Avg Trigger Rate`,(0,j.jsx)($,{text:`Average percentage of skill checks that resulted in a trigger across all graded skills (5+ checks). Run selftune evolve to improve this.`})]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl ${!l&&t!==null?`text-red-600`:``}`,children:c}),(0,j.jsx)(gn,{children:t===null?(0,j.jsx)(P,{variant:`secondary`,className:`text-[10px]`,children:`needs 5+ checks`}):(0,j.jsxs)(P,{variant:l?`outline`:`destructive`,children:[l?(0,j.jsx)(gt,{className:`size-3`}):(0,j.jsx)(wt,{className:`size-3`}),c]})})]})}),(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)($e,{className:`size-3.5`}),`Unmatched Queries`,(0,j.jsx)($,{text:`User prompts that didn't match any skill's trigger criteria — potential gaps in coverage`})]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl`,children:n}),n>0&&(0,j.jsx)(gn,{children:(0,j.jsxs)(P,{variant:`destructive`,children:[(0,j.jsx)(Ve,{className:`size-3`}),`needs attention`]})})]})}),(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(pt,{className:`size-3.5`}),`Sessions`,(0,j.jsx)($,{text:`Total agent sessions that have been recorded and analyzed`})]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl`,children:r}),s>0&&(0,j.jsx)(gn,{children:(0,j.jsxs)(P,{variant:`outline`,className:`gap-1.5`,children:[(0,j.jsxs)(`span`,{className:`relative flex size-2`,children:[(0,j.jsx)(`span`,{className:`absolute inline-flex size-full animate-ping rounded-full bg-emerald-400 opacity-75`}),(0,j.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-emerald-500`})]}),s,` in progress`]})})]})}),(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(Ve,{className:`size-3.5`}),`Undeployed Proposals`,(0,j.jsx)($,{text:`Evolution proposals that have been generated but not yet validated or deployed. Requires running selftune evolve.`})]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl`,children:o?i:`--`}),(0,j.jsx)(gn,{children:o?i>0?(0,j.jsx)(P,{variant:`secondary`,children:`not yet deployed`}):null:(0,j.jsx)(P,{variant:`secondary`,className:`text-[10px]`,children:`no evolution runs yet`})})]})}),(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(le,{className:`size-3.5`}),`Total Evidence`,(0,j.jsx)($,{text:`Number of evidence entries documenting skill changes with before/after validation results. Requires running selftune evolve.`})]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl`,children:o?a:`--`}),!o&&(0,j.jsx)(gn,{children:(0,j.jsx)(P,{variant:`secondary`,className:`text-[10px]`,children:`no evolution runs yet`})})]})})]})}var zf=A.createContext(null);function Bf(){let e=A.useContext(zf);return e?(0,j.jsxs)(F,{ref:e.setActivatorNodeRef,...e.attributes,...e.listeners,variant:`ghost`,size:`icon`,className:`size-7 text-muted-foreground hover:bg-transparent`,children:[(0,j.jsx)(st,{className:`size-3 text-muted-foreground`}),(0,j.jsx)(`span`,{className:`sr-only`,children:`Drag to reorder`})]}):null}function Vf(e){return[{id:`drag`,header:()=>null,cell:()=>(0,j.jsx)(Bf,{})},{id:`select`,header:({table:e})=>(0,j.jsx)(`div`,{className:`flex items-center justify-center`,children:(0,j.jsx)(vn,{checked:e.getIsAllPageRowsSelected(),indeterminate:e.getIsSomePageRowsSelected()&&!e.getIsAllPageRowsSelected(),onCheckedChange:t=>e.toggleAllPageRowsSelected(!!t),"aria-label":`Select all`})}),cell:({row:e})=>(0,j.jsx)(`div`,{className:`flex items-center justify-center`,children:(0,j.jsx)(vn,{checked:e.getIsSelected(),onCheckedChange:t=>e.toggleSelected(!!t),"aria-label":`Select row`})}),enableSorting:!1,enableHiding:!1},{accessorKey:`name`,header:`Skill`,cell:({row:t})=>e?e(t.original):(0,j.jsx)(`span`,{className:`text-sm font-medium`,children:t.original.name}),enableHiding:!1},{accessorKey:`scope`,header:`Scope`,cell:({row:e})=>{let t=e.original.scope;return t?(0,j.jsx)(P,{variant:`secondary`,className:`text-[10px]`,children:t}):(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`--`})}},{accessorKey:`status`,header:`Status`,cell:({row:e})=>{let t=un[e.original.status];return(0,j.jsxs)(P,{variant:t.variant,className:`gap-1 px-1.5 text-muted-foreground`,children:[t.icon,t.label]})},sortingFn:(e,t)=>{let n={CRITICAL:0,WARNING:1,UNGRADED:2,UNKNOWN:3,HEALTHY:4};return n[e.original.status]-n[t.original.status]}},{accessorKey:`passRate`,header:()=>(0,j.jsx)(`div`,{className:`w-full text-right`,children:`Pass Rate`}),cell:({row:e})=>{let t=e.original.passRate;return(0,j.jsx)(`div`,{className:`text-right font-mono tabular-nums ${t!==null&&t<.5?`text-red-600 font-semibold`:``}`,children:fn(t)})},sortingFn:(e,t)=>(e.original.passRate??-1)-(t.original.passRate??-1)},{accessorKey:`checks`,header:()=>(0,j.jsx)(`div`,{className:`w-full text-right`,children:`Checks`}),cell:({row:e})=>(0,j.jsx)(`div`,{className:`text-right font-mono tabular-nums`,children:e.original.checks})},{accessorKey:`uniqueSessions`,header:()=>(0,j.jsx)(`div`,{className:`w-full text-right`,children:`Sessions`}),cell:({row:e})=>(0,j.jsx)(`div`,{className:`text-right font-mono tabular-nums`,children:e.original.uniqueSessions})},{accessorKey:`lastSeen`,header:`Last Seen`,cell:({row:e})=>(0,j.jsx)(`div`,{className:`flex items-center gap-1 text-muted-foreground`,children:e.original.lastSeen?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(y,{className:`size-3`}),(0,j.jsx)(`span`,{className:`font-mono text-xs`,children:M(e.original.lastSeen)})]}):(0,j.jsx)(`span`,{className:`text-xs`,children:`--`})}),sortingFn:(e,t)=>{let n=e=>{if(!e)return 0;let t=new Date(e).getTime();return Number.isNaN(t)?0:t};return n(e.original.lastSeen)-n(t.original.lastSeen)}},{accessorKey:`hasEvidence`,header:`Evidence`,cell:({row:e})=>(0,j.jsx)(P,{variant:e.original.hasEvidence?`outline`:`secondary`,className:`px-1.5 text-[10px] text-muted-foreground`,children:e.original.hasEvidence?`Yes`:`No`})}]}function Hf({row:e}){let{transform:t,transition:n,setNodeRef:r,setActivatorNodeRef:i,isDragging:a,attributes:o,listeners:s}=Kt({id:e.original.name}),c=A.useMemo(()=>({attributes:o,listeners:s,setActivatorNodeRef:i}),[o,s,i]);return(0,j.jsx)(zf.Provider,{value:c,children:(0,j.jsx)(Bn,{"data-state":e.getIsSelected()&&`selected`,"data-dragging":a,ref:r,className:`relative z-0 data-[dragging=true]:z-10 data-[dragging=true]:opacity-80`,style:{transform:Bt.Transform.toString(t),transition:n},children:e.getVisibleCells().map(e=>(0,j.jsx)(Hn,{children:rn(e.column.columnDef.cell,e.getContext())},e.id))})})}function Uf({cards:e,totalCount:t,statusFilter:n,onStatusFilterChange:r,renderSkillName:i}){let[a,o]=A.useState(`all`),[s,c]=A.useState([]),[l,u]=A.useState({}),[d,f]=A.useState({}),[p,m]=A.useState([]),[h,g]=A.useState([]),[_,v]=A.useState({pageIndex:0,pageSize:20}),y=A.useMemo(()=>Vf(i),[i]),b=A.useMemo(()=>({all:e.length,attention:e.filter(e=>e.status===`CRITICAL`||e.status===`WARNING`).length,recent:e.filter(e=>e.lastSeen!==null).length,ungraded:e.filter(e=>e.status===`UNGRADED`||e.status===`UNKNOWN`).length}),[e]);A.useEffect(()=>{let t=e;a===`attention`?t=e.filter(e=>e.status===`CRITICAL`||e.status===`WARNING`):a===`recent`?t=e.filter(e=>e.lastSeen!==null).sort((e,t)=>{let n=e.lastSeen?new Date(e.lastSeen).getTime():0;return(t.lastSeen?new Date(t.lastSeen).getTime():0)-n}):a===`ungraded`&&(t=e.filter(e=>e.status===`UNGRADED`||e.status===`UNKNOWN`)),c(t),v(e=>({...e,pageIndex:0}))},[e,a]);let x=A.useId(),S=sn(Ut(Vt,{}),Ut(on,{}),Ut(qt,{coordinateGetter:Gt})),C=Qt({data:s,columns:y,state:{sorting:h,columnVisibility:d,rowSelection:l,columnFilters:p,pagination:_},getRowId:e=>e.name,enableRowSelection:!0,onRowSelectionChange:u,onSortingChange:g,onColumnFiltersChange:m,onColumnVisibilityChange:f,onPaginationChange:v,getCoreRowModel:tn(),getFilteredRowModel:$t(),getPaginationRowModel:nn(),getSortedRowModel:Wt(),getFacetedRowModel:Yt(),getFacetedUniqueValues:Ht()}),w=A.useMemo(()=>C.getRowModel().rows.map(e=>e.id),[C.getRowModel().rows]),T=h.length>0;function E(e){if(T)return;let{active:t,over:n}=e;t&&n&&t.id!==n.id&&c(e=>{let r=e.map(e=>e.name),i=r.indexOf(t.id),a=r.indexOf(n.id);return i===-1||a===-1?e:an(e,i,a)})}return(0,j.jsxs)(Un,{value:a,onValueChange:o,className:`flex w-full flex-col justify-start gap-6`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between px-4 lg:px-6`,children:[(0,j.jsx)(On,{htmlFor:`view-selector`,className:`sr-only`,children:`View`}),(0,j.jsxs)(kn,{value:a,onValueChange:e=>e&&o(e),children:[(0,j.jsx)(Mn,{className:`flex w-fit @4xl/main:hidden`,size:`sm`,id:`view-selector`,children:(0,j.jsx)(jn,{placeholder:`Select a view`})}),(0,j.jsx)(Nn,{children:(0,j.jsxs)(An,{children:[(0,j.jsx)(Pn,{value:`all`,children:`All Skills`}),(0,j.jsx)(Pn,{value:`attention`,children:`Needs Attention`}),(0,j.jsx)(Pn,{value:`recent`,children:`Recently Active`}),(0,j.jsx)(Pn,{value:`ungraded`,children:`Ungraded`})]})})]}),(0,j.jsxs)(Gn,{className:`hidden **:data-[slot=badge]:size-5 **:data-[slot=badge]:rounded-full **:data-[slot=badge]:bg-muted-foreground/30 **:data-[slot=badge]:px-1 @4xl/main:flex`,children:[(0,j.jsxs)(Kn,{value:`all`,children:[`All Skills `,(0,j.jsx)(P,{variant:`secondary`,children:b.all})]}),(0,j.jsxs)(Kn,{value:`attention`,children:[`Needs Attention`,` `,b.attention>0&&(0,j.jsx)(P,{variant:`secondary`,children:b.attention})]}),(0,j.jsxs)(Kn,{value:`recent`,children:[`Recently Active`,` `,b.recent>0&&(0,j.jsx)(P,{variant:`secondary`,children:b.recent})]}),(0,j.jsxs)(Kn,{value:`ungraded`,children:[`Ungraded`,` `,b.ungraded>0&&(0,j.jsx)(P,{variant:`secondary`,children:b.ungraded})]})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r&&(0,j.jsxs)(Sn,{children:[(0,j.jsxs)(Cn,{render:(0,j.jsx)(F,{variant:`outline`,size:`sm`}),children:[(0,j.jsx)(pe,{"data-icon":`inline-start`,className:`size-3.5`}),n&&n!==`ALL`?n.charAt(0)+n.slice(1).toLowerCase():`Status`,(0,j.jsx)(Le,{"data-icon":`inline-end`})]}),(0,j.jsx)(wn,{align:`end`,className:`w-40`,children:(0,j.jsx)(En,{value:n??`ALL`,onValueChange:e=>r(e),children:[{label:`All`,value:`ALL`,icon:(0,j.jsx)(Te,{className:`size-3.5`})},{label:`Healthy`,value:`HEALTHY`,icon:(0,j.jsx)(je,{className:`size-3.5 text-emerald-600`})},{label:`Warning`,value:`WARNING`,icon:(0,j.jsx)(Ve,{className:`size-3.5 text-amber-500`})},{label:`Critical`,value:`CRITICAL`,icon:(0,j.jsx)(ke,{className:`size-3.5 text-red-500`})},{label:`Ungraded`,value:`UNGRADED`,icon:(0,j.jsx)(De,{className:`size-3.5 text-muted-foreground`})},{label:`Unknown`,value:`UNKNOWN`,icon:(0,j.jsx)(re,{className:`size-3.5 text-muted-foreground/60`})}].map(e=>(0,j.jsx)(Dn,{value:e.value,children:(0,j.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.icon,e.label]})},e.value))})})]}),(0,j.jsxs)(Sn,{children:[(0,j.jsxs)(Cn,{render:(0,j.jsx)(F,{variant:`outline`,size:`sm`}),children:[(0,j.jsx)(xe,{"data-icon":`inline-start`}),`Columns`,(0,j.jsx)(Le,{"data-icon":`inline-end`})]}),(0,j.jsx)(wn,{align:`end`,className:`w-40`,children:C.getAllColumns().filter(e=>e.accessorFn!==void 0&&e.getCanHide()).map(e=>(0,j.jsx)(Tn,{className:`capitalize`,checked:e.getIsVisible(),onCheckedChange:t=>e.toggleVisibility(!!t),children:e.id===`scope`?`Scope`:e.id===`passRate`?`Pass Rate`:e.id===`uniqueSessions`?`Sessions`:e.id===`lastSeen`?`Last Seen`:e.id===`hasEvidence`?`Evidence`:e.id},e.id))})]})]})]}),(0,j.jsxs)(qn,{value:a,className:`relative flex flex-col gap-4 overflow-auto px-4 lg:px-6`,children:[(0,j.jsx)(`div`,{className:`overflow-hidden rounded-lg border`,children:(0,j.jsx)(Jt,{collisionDetection:cn,modifiers:[Zt],onDragEnd:E,sensors:S,id:x,children:(0,j.jsxs)(Ln,{children:[(0,j.jsx)(Rn,{className:`sticky top-0 z-10 bg-muted`,children:C.getHeaderGroups().map(e=>(0,j.jsx)(Bn,{children:e.headers.map(e=>(0,j.jsx)(Vn,{colSpan:e.colSpan,className:e.column.getCanSort()?`cursor-pointer select-none`:``,onClick:e.column.getToggleSortingHandler(),children:(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.isPlaceholder?null:rn(e.column.columnDef.header,e.getContext()),e.column.getIsSorted()===`asc`?` ↑`:e.column.getIsSorted()===`desc`?` ↓`:null]})},e.id))},e.id))}),(0,j.jsx)(zn,{className:`**:data-[slot=table-cell]:first:w-8`,children:C.getRowModel().rows?.length?(0,j.jsx)(Xt,{items:w,strategy:en,children:C.getRowModel().rows.map(e=>(0,j.jsx)(Hf,{row:e},e.id))}):(0,j.jsx)(Bn,{children:(0,j.jsx)(Hn,{colSpan:y.length,className:`h-24 text-center text-muted-foreground`,children:t===0?`No skills detected yet. Trigger some skills to see data.`:`No skills match your filters.`})})})]})})}),(0,j.jsxs)(`div`,{className:`flex items-center justify-between px-4`,children:[(0,j.jsxs)(`div`,{className:`hidden flex-1 text-sm text-muted-foreground lg:flex`,children:[C.getFilteredSelectedRowModel().rows.length,` of`,` `,C.getFilteredRowModel().rows.length,` skill(s) selected.`]}),(0,j.jsxs)(`div`,{className:`flex w-full items-center gap-8 lg:w-fit`,children:[(0,j.jsxs)(`div`,{className:`hidden items-center gap-2 lg:flex`,children:[(0,j.jsx)(On,{htmlFor:`rows-per-page`,className:`text-sm font-medium`,children:`Rows per page`}),(0,j.jsxs)(kn,{value:`${C.getState().pagination.pageSize}`,onValueChange:e=>{C.setPageSize(Number(e))},items:[10,20,50,100].map(e=>({label:`${e}`,value:`${e}`})),children:[(0,j.jsx)(Mn,{size:`sm`,className:`w-20`,id:`rows-per-page`,children:(0,j.jsx)(jn,{placeholder:C.getState().pagination.pageSize})}),(0,j.jsx)(Nn,{side:`top`,children:(0,j.jsx)(An,{children:[10,20,50,100].map(e=>(0,j.jsx)(Pn,{value:`${e}`,children:e},e))})})]})]}),C.getRowModel().rows.length>0&&(0,j.jsxs)(`div`,{className:`flex w-fit items-center justify-center text-sm font-medium`,children:[`Page `,C.getState().pagination.pageIndex+1,` of `,C.getPageCount()]}),(0,j.jsxs)(`div`,{className:`ml-auto flex items-center gap-2 lg:ml-0`,children:[(0,j.jsxs)(F,{variant:`outline`,className:`hidden h-8 w-8 p-0 lg:flex`,onClick:()=>C.setPageIndex(0),disabled:!C.getCanPreviousPage(),children:[(0,j.jsx)(`span`,{className:`sr-only`,children:`Go to first page`}),(0,j.jsx)(bt,{})]}),(0,j.jsxs)(F,{variant:`outline`,className:`size-8`,size:`icon`,onClick:()=>C.previousPage(),disabled:!C.getCanPreviousPage(),children:[(0,j.jsx)(`span`,{className:`sr-only`,children:`Go to previous page`}),(0,j.jsx)(Ne,{})]}),(0,j.jsxs)(F,{variant:`outline`,className:`size-8`,size:`icon`,onClick:()=>C.nextPage(),disabled:!C.getCanNextPage(),children:[(0,j.jsx)(`span`,{className:`sr-only`,children:`Go to next page`}),(0,j.jsx)(Fe,{})]}),(0,j.jsxs)(F,{variant:`outline`,className:`hidden size-8 lg:flex`,size:`icon`,onClick:()=>C.setPageIndex(C.getPageCount()-1),disabled:!C.getCanNextPage(),children:[(0,j.jsx)(`span`,{className:`sr-only`,children:`Go to last page`}),(0,j.jsx)(se,{})]})]})]})]})]})]})}var Wf=6e4;function Gf(){return bi({queryKey:[`orchestrate-runs`],queryFn:()=>xa(20),staleTime:5e3,refetchInterval:Wf})}function Kf(e){return pn(e.map(e=>({name:e.skill_name,scope:e.skill_scope,passRate:e.total_checks>0?e.pass_rate:null,checks:e.total_checks,status:dn(e.pass_rate,e.total_checks),hasEvidence:e.has_evidence,uniqueSessions:e.unique_sessions,lastSeen:e.last_seen})))}function qf({skillCount:e}){let[t,n]=(0,A.useState)(()=>{try{return localStorage.getItem(`selftune-onboarding-dismissed`)===`true`}catch{return!1}});return!t||e===0?e===0?(0,j.jsx)(`div`,{className:`mx-4 lg:mx-6 rounded-xl border-2 border-dashed border-primary/30 bg-primary/5 p-8`,children:(0,j.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-4 max-w-md mx-auto`,children:[(0,j.jsx)(`div`,{className:`flex items-center justify-center size-12 rounded-full bg-primary/10`,children:(0,j.jsx)(ze,{className:`size-6 text-primary`})}),(0,j.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Welcome to selftune`}),(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:`No skills detected yet. Once you start using selftune in your project, skills will appear here automatically.`}),(0,j.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 w-full text-left sm:grid-cols-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg border bg-card p-3`,children:[(0,j.jsx)(`div`,{className:`flex items-center justify-center size-6 rounded-full bg-blue-500/10 text-blue-500 shrink-0 text-xs font-bold`,children:`1`}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-xs font-medium`,children:`Run selftune`}),(0,j.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Enable selftune in your project to start tracking skills`})]})]}),(0,j.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg border bg-card p-3`,children:[(0,j.jsx)(`div`,{className:`flex items-center justify-center size-6 rounded-full bg-amber-500/10 text-amber-500 shrink-0 text-xs font-bold`,children:`2`}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-xs font-medium`,children:`Skills appear`}),(0,j.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Skills are detected and monitored automatically`})]})]}),(0,j.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg border bg-card p-3`,children:[(0,j.jsx)(`div`,{className:`flex items-center justify-center size-6 rounded-full bg-emerald-500/10 text-emerald-500 shrink-0 text-xs font-bold`,children:`3`}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-xs font-medium`,children:`Watch evolution`}),(0,j.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Proposals flow in with validated improvements`})]})]})]})]})}):(0,j.jsxs)(`div`,{className:`mx-4 lg:mx-6 flex items-center gap-3 rounded-lg border border-primary/20 bg-primary/5 px-4 py-3`,children:[(0,j.jsx)(ze,{className:`size-4 text-primary/60 shrink-0`}),(0,j.jsxs)(`p`,{className:`flex-1 text-xs text-muted-foreground`,children:[(0,j.jsx)(`span`,{className:`font-medium text-foreground`,children:`Welcome to selftune dashboard.`}),` Hover over any metric label's`,` `,(0,j.jsx)(`span`,{className:`inline-flex items-center text-muted-foreground/50`,children:(0,j.jsx)(Te,{className:`size-2.5 mx-0.5`})}),` `,`icon for an explanation. Click proposals in the Evolution timeline to see detailed evidence.`]}),(0,j.jsxs)(`button`,{type:`button`,onClick:()=>{n(!0);try{localStorage.setItem(`selftune-onboarding-dismissed`,`true`)}catch{}},className:`text-muted-foreground/50 hover:text-muted-foreground transition-colors shrink-0`,children:[(0,j.jsx)(St,{className:`size-4`}),(0,j.jsx)(`span`,{className:`sr-only`,children:`Dismiss`})]})]}):null}function Jf({search:e,statusFilter:t,onStatusFilterChange:n,overviewQuery:r}){let i=l(),{data:a,isPending:o,isError:s,error:u,refetch:d}=r,f=Gf(),p=(0,A.useMemo)(()=>a?Kf(a.skills):[],[a]),m=(0,A.useMemo)(()=>{let n=p;if(e){let t=e.toLowerCase();n=n.filter(e=>e.name.toLowerCase().includes(t))}return t!==`ALL`&&(n=n.filter(e=>e.status===t)),n},[p,e,t]);if(o)return(0,j.jsxs)(`div`,{className:`@container/main flex flex-1 flex-col gap-6 py-6`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-1 gap-4 px-4 lg:px-6 @xl/main:grid-cols-2 @5xl/main:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,j.jsx)(Ai,{className:`h-24 rounded-xl`},t))}),(0,j.jsxs)(`div`,{className:`px-4 lg:px-6`,children:[(0,j.jsx)(Ai,{className:`h-8 w-32 mb-4`}),(0,j.jsx)(`div`,{className:`grid grid-cols-1 gap-3 @xl/main:grid-cols-2 @5xl/main:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,j.jsx)(Ai,{className:`h-28 rounded-xl`},t))})]})]});if(s)return(0,j.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 py-16`,children:[(0,j.jsx)(te,{className:`size-10 text-destructive`}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:u instanceof Error?u.message:`Unknown error`}),(0,j.jsxs)(F,{variant:`outline`,size:`sm`,onClick:()=>d(),children:[(0,j.jsx)(jt,{className:`mr-2 size-3.5`}),`Retry`]})]});if(!a)return(0,j.jsx)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 py-16`,children:(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No telemetry data found. Run some sessions first.`})});let{overview:h,skills:g}=a,_=g.filter(e=>e.total_checks>=5),v=_.length>0?_.reduce((e,t)=>e+t.pass_rate,0)/_.length:null;return(0,j.jsxs)(`div`,{className:`@container/main flex flex-1 flex-col gap-6 py-6`,children:[(0,j.jsx)(qf,{skillCount:g.length}),(0,j.jsx)(Rf,{skillsCount:g.length,avgPassRate:v,unmatchedCount:h.unmatched_queries.length,sessionsCount:h.counts.sessions,pendingCount:h.pending_proposals.length,evidenceCount:h.counts.evidence,hasEvolution:h.counts.evolution>0,activeSessionsCount:h.active_sessions}),(0,j.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 @5xl/main:grid-cols-[1fr_320px]`,children:[(0,j.jsx)(Uf,{cards:m,totalCount:p.length,statusFilter:t,onStatusFilterChange:n,renderSkillName:e=>(0,j.jsx)(c,{to:`/skills/${encodeURIComponent(e.name)}`,className:`text-sm font-medium hover:underline`,children:e.name})}),(0,j.jsx)(`div`,{className:`px-4 lg:px-6 @5xl/main:px-0 @5xl/main:pr-4 lg:@5xl/main:pr-6`,children:(0,j.jsxs)(`div`,{className:`sticky top-4 space-y-4`,children:[(0,j.jsx)(Oa,{evolution:h.evolution,pendingProposals:h.pending_proposals,unmatchedQueries:h.unmatched_queries,onSelectProposal:(e,t)=>{i(`/skills/${encodeURIComponent(e)}?proposal=${encodeURIComponent(t)}`)}}),(0,j.jsx)(Lf,{items:h.recent_activity}),f.isPending?(0,j.jsx)(Ai,{className:`h-32 rounded-xl`}):f.isError?(0,j.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-3 text-xs text-destructive`,children:`Failed to load orchestrate runs.`}):(0,j.jsx)(If,{runs:f.data.runs})]})})]})]})}var Yf=6e4;function Xf(e){return bi({queryKey:[`skill-report`,e],queryFn:()=>ba(e),enabled:!!e,staleTime:5e3,refetchInterval:Yf,retry:(e,t)=>t instanceof Ca?!1:e<2})}function Zf(e){if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;let n=t/60;return n<60?`${n.toFixed(1)}m`:`${(n/60).toFixed(1)}h`}var Qf={created:`outline`,validated:`secondary`,deployed:`default`,rejected:`destructive`,rolled_back:`destructive`};function $f({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},{});return(0,j.jsxs)(`div`,{className:`rounded-lg border border-border/60 overflow-hidden transition-colors`,children:[(0,j.jsxs)(`button`,{type:`button`,className:`w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-muted/40 active:bg-muted/60 transition-colors`,onClick:()=>a(!i),children:[(0,j.jsx)(Fe,{className:`size-3.5 text-muted-foreground shrink-0 transition-transform duration-150 ${i?`rotate-90`:``}`}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0 flex-1`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(`span`,{className:`text-sm font-medium`,children:[n.length,` invocation`,n.length===1?``:`s`]}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o?M(o):``})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[t?.model&&(0,j.jsx)(P,{variant:`secondary`,className:`text-[10px] font-normal`,children:t.model}),t?.workspace_path&&(0,j.jsx)(`span`,{className:`text-[11px] text-muted-foreground font-mono`,title:t.workspace_path,children:t.workspace_path.split(`/`).slice(-2).join(`/`)})]})]}),!i&&(0,j.jsx)(`div`,{className:`flex items-center gap-1 shrink-0`,children:Object.entries(s).map(([e,t])=>(0,j.jsxs)(P,{variant:`outline`,className:`text-[10px] font-normal gap-1`,children:[e,` `,(0,j.jsx)(`span`,{className:`text-muted-foreground`,children:t})]},e))}),(0,j.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 font-mono shrink-0`,children:e.substring(0,8)})]}),i&&(0,j.jsx)(`div`,{className:`border-t border-border/40 overflow-x-auto`,children:(0,j.jsxs)(Ln,{children:[(0,j.jsx)(Rn,{children:(0,j.jsxs)(Bn,{className:`hover:bg-transparent bg-muted/40`,children:[(0,j.jsxs)(Vn,{className:`text-[11px] h-8`,children:[`Prompt `,(0,j.jsx)($,{text:`The user prompt that led to this skill being invoked`})]}),(0,j.jsxs)(Vn,{className:`text-[11px] h-8 w-[90px]`,children:[`Mode`,` `,(0,j.jsx)($,{text:`explicit = user typed /skillname · implicit = user mentioned skill by name · inferred = agent chose skill autonomously`})]}),(0,j.jsxs)(Vn,{className:`text-[11px] h-8 w-[70px]`,children:[`Confidence`,` `,(0,j.jsx)($,{text:`Model's confidence score (0–100%) when routing this prompt to the skill`})]}),(0,j.jsxs)(Vn,{className:`text-[11px] h-8 w-[90px]`,children:[`Agent`,` `,(0,j.jsx)($,{text:`Which agent invoked the skill — main agent or a subagent type (e.g. Explore, Engineer)`})]}),(0,j.jsx)(Vn,{className:`text-[11px] h-8 w-[70px] text-right`,children:`Time`})]})}),(0,j.jsx)(zn,{children:n.map((e,t)=>(0,j.jsxs)(Bn,{className:e.triggered?``:`bg-destructive/5`,children:[(0,j.jsxs)(Hn,{className:`max-w-[500px] truncate text-sm py-2`,title:e.query||void 0,children:[e.query||(0,j.jsx)(`span`,{className:`text-muted-foreground/40 italic`,children:`No prompt recorded`}),!e.triggered&&(0,j.jsx)(P,{variant:`destructive`,className:`text-[10px] font-normal ml-2`,children:`missed`})]}),(0,j.jsx)(Hn,{className:`py-2`,children:e.invocation_mode?(0,j.jsx)(P,{variant:`secondary`,className:`text-[10px] font-normal`,children:e.invocation_mode}):(0,j.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`—`})}),(0,j.jsx)(Hn,{className:`py-2 font-mono text-xs text-muted-foreground tabular-nums`,children:e.confidence===null?`—`:`${Math.round(e.confidence*100)}%`}),(0,j.jsx)(Hn,{className:`py-2`,children:e.agent_type?(0,j.jsx)(P,{variant:`outline`,className:`text-[10px] font-normal`,children:e.agent_type}):(0,j.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`—`})}),(0,j.jsx)(Hn,{className:`py-2 font-mono text-[11px] text-muted-foreground text-right whitespace-nowrap`,children:e.timestamp?M(e.timestamp):``})]},t))})]})})]})}function ep(){let{name:e}=d(),[t,n]=i(),{data:r,isPending:a,isError:o,error:s,refetch:l}=Xf(e),u=r?.evolution??[],f=new Set(u.map(e=>e.proposal_id)),p=t.get(`proposal`),m=p&&f.has(p)?p:u.length>0?u[0].proposal_id:null;(0,A.useEffect)(()=>{let e=t.get(`proposal`);if(m&&e!==m){let e=new URLSearchParams(t);e.set(`proposal`,m),n(e,{replace:!0});return}if(!m&&e){let e=new URLSearchParams(t);e.delete(`proposal`),n(e,{replace:!0})}},[m,t,n]);let h=e=>{let r=new URLSearchParams(t);r.set(`proposal`,e),n(r,{replace:!0})};if(!e)return(0,j.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-16`,children:(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:`No skill name provided`})});if(a)return(0,j.jsxs)(`div`,{className:`@container/main flex flex-1 flex-col gap-6 p-4 lg:p-6`,children:[(0,j.jsx)(Ai,{className:`h-10 w-64`}),(0,j.jsx)(`div`,{className:`grid grid-cols-1 gap-4 @xl/main:grid-cols-2 @5xl/main:grid-cols-4`,children:Array.from({length:8}).map((e,t)=>(0,j.jsx)(Ai,{className:`h-24 rounded-xl`},t))}),(0,j.jsx)(Ai,{className:`h-20 rounded-xl`}),(0,j.jsx)(Ai,{className:`h-64 rounded-xl`})]});if(o)return(0,j.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 py-16`,children:[(0,j.jsx)(te,{className:`size-10 text-destructive`}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:s instanceof Error?s.message:`Unknown error`}),(0,j.jsxs)(F,{variant:`outline`,size:`sm`,onClick:()=>l(),children:[(0,j.jsx)(jt,{className:`mr-2 size-3.5`}),`Retry`]})]});if(!r)return(0,j.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-16`,children:(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No data yet`})});if(r.usage.total_checks===0&&r.usage.triggered_count===0&&r.evidence.length===0&&r.evolution.length===0&&r.pending_proposals.length===0&&(r.canonical_invocations?.length??0)===0&&(r.prompt_samples?.length??0)===0&&(r.session_metadata?.length??0)===0)return(0,j.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 py-16`,children:[(0,j.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No data found for skill "`,e,`".`]}),(0,j.jsxs)(F,{variant:`outline`,size:`sm`,render:(0,j.jsx)(c,{to:`/`}),children:[(0,j.jsx)(Et,{className:`mr-2 size-3.5`}),`Back to Overview`]})]});let{usage:g,evidence:_,pending_proposals:v,canonical_invocations:b,duration_stats:x,selftune_stats:S,prompt_samples:C,session_metadata:w}=r,T=dn(g.pass_rate,g.total_checks),E=un[T]??un.UNKNOWN,D=T===`HEALTHY`,ne=(S?.run_count??0)>0,re=x?.missed_triggers??0;[...new Set((w??[]).map(e=>e.model).filter(Boolean))],[...new Set((w??[]).map(e=>e.platform).filter(Boolean))],[...new Set((w??[]).map(e=>e.workspace_path).filter(Boolean))];let O=(b??[]).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}));O.sort((e,t)=>(t.timestamp??``).localeCompare(e.timestamp??``));let k=new Map;for(let e of O){let t=e.session_id??`unknown`,n=k.get(t);n?n.push(e):k.set(t,[e])}let ie=new Map((w??[]).map(e=>[e.session_id,e])),ae=[...k.entries()].sort(([,e],[,t])=>(t[0]?.timestamp??``).localeCompare(e[0]?.timestamp??``));return(0,j.jsx)(Un,{defaultValue:u.length>0?`evidence`:`invocations`,children:(0,j.jsxs)(`div`,{className:`@container/main flex flex-1 flex-col gap-4 p-4 lg:px-6 lg:pb-6 lg:pt-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3 sticky top-0 z-30 bg-background py-1.5 border-b border-border/50`,children:[(0,j.jsx)(`h1`,{className:`text-base font-semibold tracking-tight lg:text-lg shrink-0`,children:r.skill_name}),(0,j.jsxs)(P,{variant:E.variant,className:`gap-1 shrink-0 text-[10px]`,children:[E.icon,E.label]}),(0,j.jsxs)(Gn,{variant:`line`,className:`ml-auto`,children:[u.length>0&&(0,j.jsxs)(Yn,{children:[(0,j.jsxs)(Xn,{render:(0,j.jsx)(Kn,{value:`evidence`}),children:[`Evidence`,m&&(0,j.jsxs)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:[`#`,m.slice(0,8)]})]}),(0,j.jsx)(Zn,{children:`Change history and validation results`})]}),(0,j.jsxs)(Yn,{children:[(0,j.jsxs)(Xn,{render:(0,j.jsx)(Kn,{value:`invocations`}),children:[`Invocations`,(0,j.jsx)(P,{variant:`secondary`,className:`text-[10px]`,children:O.length})]}),(0,j.jsx)(Zn,{children:`Recent skill triggers and their outcomes`})]}),v.length>0&&(0,j.jsxs)(Yn,{children:[(0,j.jsxs)(Xn,{render:(0,j.jsx)(Kn,{value:`pending`}),children:[`Pending`,(0,j.jsx)(P,{variant:`destructive`,className:`text-[10px]`,children:v.length})]}),(0,j.jsx)(Zn,{children:`Proposals not yet deployed`})]})]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 @xl/main:grid-cols-2 @5xl/main:grid-cols-4`,children:[(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(ee,{className:`size-3.5`}),`Trigger Rate`,(0,j.jsx)($,{text:`Percentage of skill checks that resulted in this skill being triggered`})]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl ${g.total_checks>0&&!D?`text-red-600`:``}`,children:g.total_checks>0?fn(g.pass_rate):`--`}),(0,j.jsx)(gn,{children:g.total_checks>0?(0,j.jsxs)(P,{variant:D?`outline`:`destructive`,children:[D?(0,j.jsx)(gt,{className:`size-3`}):(0,j.jsx)(wt,{className:`size-3`}),fn(g.pass_rate)]}):(0,j.jsx)(P,{variant:`secondary`,className:`text-[10px]`,children:`no checks yet`})})]})}),(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(Te,{className:`size-3.5`}),`Total Checks`,(0,j.jsx)($,{text:`Total evaluation checks run across all sessions for this skill`})]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl`,children:g.total_checks})]})}),(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(pt,{className:`size-3.5`}),`Triggered`,(0,j.jsx)($,{text:`Number of times this skill was invoked by the agent during sessions`})]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl`,children:g.triggered_count})]})}),(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(le,{className:`size-3.5`}),`Sessions`,(0,j.jsx)($,{text:`Number of unique agent sessions where this skill was present`})]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl`,children:r.sessions_with_skill})]})}),(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(zt,{className:`size-3.5`}),`LLM Calls`,(0,j.jsx)($,{text:`Total LLM calls made by selftune when evolving this skill`})]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl`,children:ne?S?.total_llm_calls??0:`--`}),(0,j.jsx)(gn,{children:ne?(0,j.jsxs)(`span`,{className:`text-[10px] text-muted-foreground font-mono`,children:[S?.run_count??0,` evolution runs`]}):(0,j.jsx)(P,{variant:`secondary`,className:`text-[10px]`,children:`no evolution runs yet`})})]})}),(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(y,{className:`size-3.5`}),`Avg Duration`,(0,j.jsx)($,{text:`Average time selftune spent evolving this skill per run`})]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl`,children:ne?Zf(S?.avg_elapsed_ms??0):`--`}),(0,j.jsx)(gn,{children:ne?(0,j.jsxs)(`span`,{className:`text-[10px] text-muted-foreground font-mono`,children:[Zf(S?.total_elapsed_ms??0),` total`]}):(0,j.jsx)(P,{variant:`secondary`,className:`text-[10px]`,children:`no evolution runs yet`})})]})}),(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(Ft,{className:`size-3.5`}),`Missed Triggers`,(0,j.jsx)($,{text:`Number of times this skill was evaluated but did not trigger. High counts may indicate the skill description needs evolution.`})]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl ${re>0?`text-amber-600`:``}`,children:re})]})}),(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(Ge,{className:`size-3.5`}),`Avg Confidence`,(0,j.jsx)($,{text:`Average model confidence score when routing user prompts to this skill`})]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl`,children:(()=>{let e=O.filter(e=>e.confidence!==null);return e.length>0?fn(e.reduce((e,t)=>e+(t.confidence??0),0)/e.length):`--`})()})]})}),r.description_quality&&(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(de,{className:`size-3.5`}),`Description Quality`,(0,j.jsx)($,{text:`Heuristic score assessing description routing precision: trigger context, specificity, conciseness, and vagueness. Higher = better agent routing.`})]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl ${r.description_quality.composite<.5?`text-amber-600`:``}`,children:`${Math.round(r.description_quality.composite*100)}%`}),(0,j.jsx)(gn,{children:(0,j.jsxs)(Yn,{children:[(0,j.jsx)(Xn,{children:(0,j.jsx)(P,{variant:r.description_quality.composite>=.7?`outline`:`secondary`,className:`text-[10px] font-normal cursor-help`,children:r.description_quality.composite>=.7?`good`:r.description_quality.composite>=.5?`fair`:`needs work`})}),(0,j.jsxs)(Zn,{side:`bottom`,className:`font-mono text-[10px] space-y-0.5`,children:[(0,j.jsxs)(`div`,{children:[`trigger context:`,` `,Math.round(r.description_quality.criteria.trigger_context*100),`%`]}),(0,j.jsxs)(`div`,{children:[`specificity:`,` `,Math.round(r.description_quality.criteria.specificity*100),`%`]}),(0,j.jsxs)(`div`,{children:[`vagueness: `,Math.round(r.description_quality.criteria.vagueness*100),`%`]}),(0,j.jsxs)(`div`,{children:[`length: `,Math.round(r.description_quality.criteria.length*100),`%`]}),(0,j.jsxs)(`div`,{children:[`not just name:`,` `,Math.round(r.description_quality.criteria.not_just_name*100),`%`]})]})]})})]})})]}),(0,j.jsxs)(`div`,{className:`flex gap-6`,children:[u.length>0&&(0,j.jsx)(`aside`,{className:`w-[220px] shrink-0 border-r pr-4 sticky top-12 self-start max-h-[calc(100svh-3rem)] overflow-y-auto`,children:(0,j.jsx)(Mf,{entries:u,selectedProposalId:m,onSelect:h})}),(0,j.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[u.length>0&&(0,j.jsx)(qn,{value:`evidence`,children:m?(0,j.jsx)(xf,{proposalId:m,evolution:u,evidence:_}):(0,j.jsx)(`div`,{className:`flex items-center justify-center rounded-lg border border-dashed py-12`,children:(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select a proposal from the timeline`})})}),(0,j.jsx)(qn,{value:`invocations`,children:O.length===0?(0,j.jsx)(I,{children:(0,j.jsx)(_n,{className:`py-12`,children:(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground text-center`,children:`No invocation records yet.`})})}):(0,j.jsxs)(`div`,{className:`space-y-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,j.jsxs)(`span`,{children:[O.length,` invocations across `,ae.length,` `,`sessions`]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(P,{variant:`secondary`,className:`text-[9px] font-normal`,children:`explicit`}),` `,`user typed /skill`]}),(0,j.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(P,{variant:`secondary`,className:`text-[9px] font-normal`,children:`implicit`}),` `,`mentioned by name`]}),(0,j.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(P,{variant:`secondary`,className:`text-[9px] font-normal`,children:`inferred`}),` `,`agent chose autonomously`]})]})]}),ae.map(([e,t],n)=>(0,j.jsx)($f,{sessionId:e,meta:ie.get(e),invocations:t,defaultExpanded:n<3},e))]})}),v.length>0&&(0,j.jsx)(qn,{value:`pending`,children:(0,j.jsxs)(I,{children:[(0,j.jsxs)(L,{children:[(0,j.jsx)(R,{className:`text-sm`,children:`Undeployed Proposals`}),(0,j.jsxs)(z,{children:[v.length,` not yet deployed`]})]}),(0,j.jsx)(_n,{className:`space-y-3`,children:v.map(e=>(0,j.jsxs)(`button`,{type:`button`,onClick:()=>h(e.proposal_id),className:`flex gap-3 rounded-lg border p-3 w-full text-left hover:bg-accent/50 transition-colors`,children:[(0,j.jsx)(`div`,{className:`mt-0.5 size-2 shrink-0 rounded-full bg-amber-400`}),(0,j.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(P,{variant:Qf[e.action]??`secondary`,className:`text-[10px]`,children:e.action}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground font-mono`,children:M(e.timestamp)}),(0,j.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/60 font-mono ml-auto`,children:[`#`,e.proposal_id.slice(0,8)]})]}),(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.details})]})]},e.proposal_id))})]})})]})]})]})})}var tp=6e4;function np(){return bi({queryKey:[`doctor`],queryFn:Sa,staleTime:5e3,refetchInterval:tp})}var rp={pass:{icon:(0,j.jsx)(je,{className:`size-4 text-emerald-600`}),variant:`outline`,label:`Pass`},warn:{icon:(0,j.jsx)(Ve,{className:`size-4 text-amber-500`}),variant:`secondary`,label:`Warning`},fail:{icon:(0,j.jsx)(ke,{className:`size-4 text-red-500`}),variant:`destructive`,label:`Fail`}},ip={config:{label:`Configuration`,description:`selftune.json exists and contains valid agent_type and llm_mode`,icon:(0,j.jsx)(vt,{className:`size-4 text-muted-foreground`})},log_session_telemetry:{label:`Session Telemetry Log`,description:`session_telemetry_log.jsonl exists and records parse correctly`,icon:(0,j.jsx)(k,{className:`size-4 text-muted-foreground`})},log_skill_usage:{label:`Skill Usage Log`,description:`skill_usage_log.jsonl exists and records parse correctly`,icon:(0,j.jsx)(k,{className:`size-4 text-muted-foreground`})},log_all_queries:{label:`Query Log`,description:`all_queries_log.jsonl exists and records parse correctly`,icon:(0,j.jsx)(k,{className:`size-4 text-muted-foreground`})},log_evolution_audit:{label:`Evolution Audit Log`,description:`evolution_audit_log.jsonl exists and records parse correctly`,icon:(0,j.jsx)(k,{className:`size-4 text-muted-foreground`})},hook_settings:{label:`Hook Installation`,description:`Claude Code settings.json has all required selftune hooks configured`,icon:(0,j.jsx)(Lt,{className:`size-4 text-muted-foreground`})},evolution_audit:{label:`Evolution Health`,description:`Evolution audit log is intact and records are well-formed`,icon:(0,j.jsx)(qe,{className:`size-4 text-muted-foreground`})},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,j.jsx)(he,{className:`size-4 text-muted-foreground`})}};function ap({check:e}){let t=ip[e.name]??{label:e.name,description:``,icon:(0,j.jsx)(he,{className:`size-4 text-muted-foreground`})},n=rp[e.status]??{icon:(0,j.jsx)(te,{className:`size-4 text-muted-foreground`}),variant:`outline`,label:e.status};return(0,j.jsxs)(I,{children:[(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[t.icon,t.label,t.description&&(0,j.jsx)($,{text:t.description})]}),(0,j.jsx)(R,{className:`text-sm font-medium`,children:e.message||`No details`}),(0,j.jsx)(gn,{children:(0,j.jsxs)(P,{variant:n.variant,className:`gap-1`,children:[n.icon,n.label]})})]}),e.path&&(0,j.jsx)(_n,{className:`pt-0`,children:(0,j.jsx)(`p`,{className:`text-[11px] text-muted-foreground font-mono truncate`,children:e.path})})]})}function op(){let{data:e,isPending:t,isError:n,error:r,refetch:i}=np();if(t)return(0,j.jsxs)(`div`,{className:`@container/main flex flex-1 flex-col gap-6 p-4 lg:p-6`,children:[(0,j.jsx)(Ai,{className:`h-8 w-48`}),(0,j.jsx)(`div`,{className:`grid grid-cols-1 gap-4 @xl/main:grid-cols-2`,children:Array.from({length:7}).map((e,t)=>(0,j.jsx)(Ai,{className:`h-24 rounded-xl`},t))})]});if(n)return(0,j.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4 py-16`,children:[(0,j.jsx)(te,{className:`size-10 text-destructive`}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:r instanceof Error?r.message:`Unknown error`}),(0,j.jsxs)(F,{variant:`outline`,size:`sm`,onClick:()=>i(),children:[(0,j.jsx)(jt,{className:`mr-2 size-3.5`}),`Retry`]})]});if(!e)return(0,j.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-16`,children:(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No diagnostics data available.`})});let{checks:a,summary:o,healthy:s=!1,timestamp:c}=e,l=a??[],u=o??{pass:0,warn:0,fail:0},d=l.find(e=>e.name===`dashboard_freshness_mode`),f=l.filter(e=>e.name===`config`),p=l.filter(e=>e.name.startsWith(`log_`)),m=l.filter(e=>e.name===`hook_settings`),h=l.filter(e=>e.name===`evolution_audit`),g=l.filter(e=>e.name===`dashboard_freshness_mode`),_=new Set([`config`,...p.map(e=>e.name),`hook_settings`,`evolution_audit`,`dashboard_freshness_mode`]),v=l.filter(e=>!_.has(e.name)),y=[{title:`Configuration`,checks:f},{title:`Log Files`,checks:p},{title:`Hooks`,checks:m},{title:`Evolution`,checks:h},{title:`Integrity`,checks:g},{title:`Other`,checks:v}].filter(e=>e.checks.length>0);return(0,j.jsxs)(`div`,{className:`@container/main flex flex-1 flex-col gap-6 p-4 lg:p-6`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(C,{className:`size-5 text-muted-foreground`}),(0,j.jsx)(`h1`,{className:`text-base font-semibold tracking-tight lg:text-lg`,children:`System Status`}),(0,j.jsxs)(P,{variant:s?`outline`:`destructive`,className:`gap-1`,children:[s?(0,j.jsx)(je,{className:`size-3 text-emerald-600`}):(0,j.jsx)(ke,{className:`size-3`}),s?`Healthy`:`Unhealthy`]}),(0,j.jsxs)(`span`,{className:`text-xs text-muted-foreground ml-auto`,children:[`Last checked `,c?M(c):`—`]}),(0,j.jsx)(F,{"aria-label":`Refresh status`,title:`Refresh status`,variant:`ghost`,size:`sm`,onClick:()=>i(),className:`shrink-0`,children:(0,j.jsx)(jt,{className:`size-3.5`})})]}),d?.status===`warn`&&(0,j.jsx)(I,{className:`border-amber-200 bg-amber-50/60 dark:border-amber-900/50 dark:bg-amber-950/20`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5 text-amber-800 dark:text-amber-300`,children:[(0,j.jsx)(Ve,{className:`size-4`}),`Legacy freshness mode active`]}),(0,j.jsx)(R,{className:`text-sm font-medium text-amber-950 dark:text-amber-100`,children:d.message})]})}),(0,j.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 px-0`,children:[(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(je,{className:`size-3.5 text-emerald-600`}),`Passed`]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl`,children:u.pass})]})}),(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(Ve,{className:`size-3.5 text-amber-500`}),`Warnings`]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl ${u.warn>0?`text-amber-500`:``}`,children:u.warn})]})}),(0,j.jsx)(I,{className:`@container/card`,children:(0,j.jsxs)(L,{children:[(0,j.jsxs)(z,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(ke,{className:`size-3.5 text-red-500`}),`Failed`]}),(0,j.jsx)(R,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl ${u.fail>0?`text-red-600`:``}`,children:u.fail})]})})]}),y.map(e=>(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground mb-3`,children:e.title}),(0,j.jsx)(`div`,{className:`grid grid-cols-1 gap-3 @xl/main:grid-cols-2`,children:e.checks.map((e,t)=>(0,j.jsx)(ap,{check:e},`${e.name}-${t}`))})]},e.title))]})}var sp=new ri({defaultOptions:{queries:{refetchOnWindowFocus:!0,gcTime:300*1e3}}});function cp(){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(_a,{}),(0,j.jsx)(ep,{})]})}function lp(){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(_a,{}),(0,j.jsx)(op,{})]})}function up(){Ea();let[e,t]=(0,A.useState)(``),[n,r]=(0,A.useState)(`ALL`),i=Ta(),{data:a}=i,s=(0,A.useMemo)(()=>a?pn(a.skills.map(e=>({name:e.skill_name,scope:e.skill_scope,status:dn(e.pass_rate,e.total_checks),passRate:e.total_checks>0?e.pass_rate:null,checks:e.total_checks}))):[],[a]);return(0,j.jsxs)(Vi,{children:[(0,j.jsx)(sa,{skills:(0,A.useMemo)(()=>{if(!e)return s;let t=e.toLowerCase();return s.filter(e=>e.name.toLowerCase().includes(t))},[s,e]),search:e,onSearchChange:t,version:a?.version}),(0,j.jsx)(Wi,{children:(0,j.jsxs)(o,{children:[(0,j.jsx)(u,{path:`/`,element:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(_a,{}),(0,j.jsx)(Jf,{search:e,statusFilter:n,onStatusFilterChange:r,overviewQuery:i})]})}),(0,j.jsx)(u,{path:`/skills/:name`,element:(0,j.jsx)(cp,{})}),(0,j.jsx)(u,{path:`/status`,element:(0,j.jsx)(lp,{})})]})}),(0,j.jsx)(la,{})]})}function dp(){return(0,j.jsx)(oi,{client:sp,children:(0,j.jsx)(f,{children:(0,j.jsx)(ma,{defaultTheme:`dark`,children:(0,j.jsx)(Jn,{children:(0,j.jsx)(up,{})})})})})}(0,ln.createRoot)(document.getElementById(`root`)).render((0,j.jsx)(A.StrictMode,{children:(0,j.jsx)(dp,{})}));
|