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