selftune 0.2.6 → 0.2.8
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/README.md +1 -0
- package/apps/local-dashboard/dist/assets/index-Bk9vSHHd.js +15 -0
- package/apps/local-dashboard/dist/assets/index-CRtLkBTi.css +1 -0
- package/apps/local-dashboard/dist/assets/vendor-react-BQH_6WrG.js +60 -0
- package/apps/local-dashboard/dist/assets/{vendor-table-B7VF2Ipl.js → vendor-table-dK1QMLq9.js} +1 -1
- package/apps/local-dashboard/dist/assets/{vendor-ui-r2k_Ku_V.js → vendor-ui-CO2mrx6e.js} +60 -65
- package/apps/local-dashboard/dist/index.html +5 -5
- package/cli/selftune/activation-rules.ts +30 -9
- package/cli/selftune/agent-guidance.ts +96 -0
- package/cli/selftune/alpha-identity.ts +157 -0
- package/cli/selftune/alpha-upload/build-payloads.ts +151 -0
- package/cli/selftune/alpha-upload/client.ts +113 -0
- package/cli/selftune/alpha-upload/flush.ts +191 -0
- package/cli/selftune/alpha-upload/index.ts +194 -0
- package/cli/selftune/alpha-upload/queue.ts +252 -0
- package/cli/selftune/alpha-upload/stage-canonical.ts +242 -0
- package/cli/selftune/alpha-upload-contract.ts +52 -0
- package/cli/selftune/auth/device-code.ts +110 -0
- package/cli/selftune/auto-update.ts +130 -0
- package/cli/selftune/badge/badge.ts +19 -9
- package/cli/selftune/canonical-export.ts +16 -3
- package/cli/selftune/constants.ts +28 -8
- package/cli/selftune/contribute/bundle.ts +32 -5
- package/cli/selftune/dashboard-contract.ts +32 -1
- package/cli/selftune/dashboard-server.ts +256 -692
- package/cli/selftune/dashboard.ts +1 -1
- package/cli/selftune/eval/baseline.ts +11 -7
- package/cli/selftune/eval/hooks-to-evals.ts +27 -9
- package/cli/selftune/eval/synthetic-evals.ts +54 -1
- package/cli/selftune/evolution/audit.ts +24 -19
- package/cli/selftune/evolution/constitutional.ts +176 -0
- package/cli/selftune/evolution/evidence.ts +18 -13
- package/cli/selftune/evolution/evolve-body.ts +104 -7
- package/cli/selftune/evolution/evolve.ts +195 -22
- package/cli/selftune/evolution/propose-body.ts +18 -1
- package/cli/selftune/evolution/propose-description.ts +27 -2
- package/cli/selftune/evolution/rollback.ts +11 -15
- package/cli/selftune/export.ts +84 -0
- package/cli/selftune/grading/auto-grade.ts +13 -4
- package/cli/selftune/grading/grade-session.ts +16 -6
- package/cli/selftune/hooks/evolution-guard.ts +26 -9
- package/cli/selftune/hooks/prompt-log.ts +23 -9
- package/cli/selftune/hooks/session-stop.ts +78 -15
- package/cli/selftune/hooks/skill-eval.ts +189 -10
- package/cli/selftune/index.ts +274 -2
- package/cli/selftune/ingestors/claude-replay.ts +48 -21
- package/cli/selftune/init.ts +249 -47
- package/cli/selftune/last.ts +7 -7
- package/cli/selftune/localdb/db.ts +90 -10
- package/cli/selftune/localdb/direct-write.ts +531 -0
- package/cli/selftune/localdb/materialize.ts +296 -42
- package/cli/selftune/localdb/queries.ts +325 -32
- package/cli/selftune/localdb/schema.ts +109 -0
- package/cli/selftune/monitoring/watch.ts +26 -8
- package/cli/selftune/normalization.ts +85 -15
- package/cli/selftune/observability.ts +248 -2
- package/cli/selftune/orchestrate.ts +165 -20
- package/cli/selftune/quickstart.ts +34 -10
- package/cli/selftune/repair/skill-usage.ts +12 -2
- package/cli/selftune/routes/actions.ts +77 -0
- package/cli/selftune/routes/badge.ts +66 -0
- package/cli/selftune/routes/doctor.ts +12 -0
- package/cli/selftune/routes/index.ts +14 -0
- package/cli/selftune/routes/orchestrate-runs.ts +13 -0
- package/cli/selftune/routes/overview.ts +14 -0
- package/cli/selftune/routes/report.ts +293 -0
- package/cli/selftune/routes/skill-report.ts +230 -0
- package/cli/selftune/status.ts +203 -7
- package/cli/selftune/sync.ts +13 -1
- package/cli/selftune/types.ts +50 -0
- package/cli/selftune/utils/jsonl.ts +58 -1
- package/cli/selftune/utils/selftune-meta.ts +38 -0
- package/cli/selftune/utils/skill-log.ts +30 -4
- package/cli/selftune/utils/transcript.ts +15 -0
- package/cli/selftune/workflows/workflows.ts +7 -6
- package/package.json +10 -6
- package/packages/telemetry-contract/fixtures/complete-push.ts +184 -0
- package/packages/telemetry-contract/fixtures/evidence-only-push.ts +58 -0
- package/packages/telemetry-contract/fixtures/golden.json +1 -0
- package/packages/telemetry-contract/fixtures/index.ts +4 -0
- package/packages/telemetry-contract/fixtures/partial-push-no-sessions.ts +40 -0
- package/packages/telemetry-contract/fixtures/partial-push-unresolved-parents.ts +79 -0
- package/packages/telemetry-contract/package.json +6 -1
- package/packages/telemetry-contract/src/index.ts +1 -0
- package/packages/telemetry-contract/src/schemas.ts +215 -0
- package/packages/telemetry-contract/src/types.ts +3 -1
- package/packages/telemetry-contract/src/validators.ts +3 -1
- package/packages/telemetry-contract/tests/compatibility.test.ts +144 -0
- package/packages/ui/package.json +4 -0
- package/packages/ui/src/components/ActivityTimeline.tsx +61 -29
- package/packages/ui/src/components/section-cards.tsx +31 -14
- package/packages/ui/src/types.ts +1 -0
- package/skill/SKILL.md +214 -174
- package/skill/Workflows/AlphaUpload.md +45 -0
- package/skill/Workflows/Baseline.md +18 -12
- package/skill/Workflows/Composability.md +3 -3
- package/skill/Workflows/Dashboard.md +44 -91
- package/skill/Workflows/Doctor.md +93 -66
- package/skill/Workflows/Evals.md +49 -40
- package/skill/Workflows/Evolve.md +76 -28
- package/skill/Workflows/EvolveBody.md +37 -38
- package/skill/Workflows/Initialize.md +172 -26
- package/skill/Workflows/Orchestrate.md +11 -2
- package/skill/Workflows/Sync.md +23 -0
- package/skill/Workflows/Watch.md +2 -5
- package/skill/agents/diagnosis-analyst.md +163 -0
- package/skill/agents/evolution-reviewer.md +149 -0
- package/skill/agents/integration-guide.md +154 -0
- package/skill/agents/pattern-analyst.md +149 -0
- package/skill/assets/multi-skill-settings.json +1 -1
- package/skill/assets/single-skill-settings.json +1 -1
- package/skill/references/interactive-config.md +39 -0
- package/skill/references/invocation-taxonomy.md +34 -0
- package/skill/references/logs.md +9 -1
- package/skill/references/setup-patterns.md +3 -3
- package/skill/settings_snippet.json +1 -1
- package/apps/local-dashboard/dist/assets/index-C75H1Q3n.css +0 -1
- package/apps/local-dashboard/dist/assets/index-axE4kz3Q.js +0 -15
- package/apps/local-dashboard/dist/assets/vendor-react-U7zYD9Rg.js +0 -60
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var Os=e=>{throw TypeError(e)};var or=(e,t,n)=>t.has(e)||Os("Cannot "+n);var g=(e,t,n)=>(or(e,t,"read from private field"),n?n.call(e):t.get(e)),q=(e,t,n)=>t.has(e)?Os("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),P=(e,t,n,r)=>(or(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),X=(e,t,n)=>(or(e,t,"access private method"),n);var Mn=(e,t,n,r)=>({set _(i){P(e,t,i,n)},get _(){return g(e,t,r)}});import{r as O,j as s,u as Il,L as wt,g as na,d as _l,e as Tl,f as zl,B as Pl,h as Rl,i as cr,k as Al}from"./vendor-react-BQH_6WrG.js";import{t as Ol,c as Ml,u as Gn,m as Wn,a as Yn,B as Ll,C as Dl,b as Fl,d as Xn,e as Bl,f as Ul,g as Hl,M as ql,h as $l,i as Vl,j as Ql,k as Kl,l as Gl,n as Wl,o as Yl,p as Xl,q as Jl,S as Zl,r as eo,s as to,v as At,w as no,x as ro,y as so,z as io,A as ao,D as lo,E as oo,F as co,G as uo,H as ho,I as fo,J as po,T as mo,K as xo,L as go,N as bo,O as yo,P as vo,Q as jo,R as wo,U as ko,V as No,W as So,X as Jn,Y as gt,Z as Me,_ as xt,$ as Je,a0 as Co,a1 as Eo,a2 as Io,a3 as _o,a4 as To,a5 as ra,a6 as zo,a7 as Po,a8 as Ro,a9 as Ao,aa as Oo,ab as Mo,ac as Lo,ad as sa,ae as sn,af as Mt,ag as Ir,ah as Do,ai as Fo,aj as Bo,ak as Uo,al as Ho,am as ss,an as ia,ao as aa,ap as qo,aq as Zn,ar as er,as as la,at as qn,au as is,av as oa,aw as xn,ax as $o,ay as Ms,az as Vo,aA as as,aB as Qo,aC as tr,aD as ca,aE as Ko,aF as Go,aG as Wo,aH as Yo,aI as Xo,aJ as Jo,aK as nr,aL as $n,aM as Zo,aN as ec,aO as tc,aP as nc,aQ as ua,aR as rc,aS as sc}from"./vendor-ui-CO2mrx6e.js";import{u as ic,a as ur,b as ac,D as lc,r as oc,c as cc,f as da,S as uc,v as dc,g as hc,d as fc,e as pc,h as mc,i as xc,j as gc,s as bc,K as yc,T as vc,M as jc,k as wc,l as kc,C as Nc}from"./vendor-table-dK1QMLq9.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();var Pn=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(){}},Sc={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},rt,rs,Qi,Cc=(Qi=class{constructor(){q(this,rt,Sc);q(this,rs,!1)}setTimeoutProvider(e){P(this,rt,e)}setTimeout(e,t){return g(this,rt).setTimeout(e,t)}clearTimeout(e){g(this,rt).clearTimeout(e)}setInterval(e,t){return g(this,rt).setInterval(e,t)}clearInterval(e){g(this,rt).clearInterval(e)}},rt=new WeakMap,rs=new WeakMap,Qi),kt=new Cc;function Ec(e){setTimeout(e,0)}var Ot=typeof window>"u"||"Deno"in globalThis;function we(){}function Ic(e,t){return typeof e=="function"?e(t):e}function _r(e){return typeof e=="number"&&e>=0&&e!==1/0}function ha(e,t){return Math.max(e+(t||0)-Date.now(),0)}function dt(e,t){return typeof e=="function"?e(t):e}function Te(e,t){return typeof e=="function"?e(t):e}function Ls(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:a,queryKey:l,stale:o}=e;if(l){if(r){if(t.queryHash!==ls(l,t.options))return!1}else if(!Nn(t.queryKey,l))return!1}if(n!=="all"){const u=t.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||i&&i!==t.state.fetchStatus||a&&!a(t))}function Ds(e,t){const{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(kn(t.options.mutationKey)!==kn(a))return!1}else if(!Nn(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ls(e,t){return((t==null?void 0:t.queryKeyHashFn)||kn)(e)}function kn(e){return JSON.stringify(e,(t,n)=>zr(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Nn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Nn(e[n],t[n])):!1}var _c=Object.prototype.hasOwnProperty;function fa(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Fs(e)&&Fs(t);if(!r&&!(zr(e)&&zr(t)))return t;const a=(r?e:Object.keys(e)).length,l=r?t:Object.keys(t),o=l.length,u=r?new Array(o):{};let c=0;for(let d=0;d<o;d++){const h=r?d:l[d],p=e[h],f=t[h];if(p===f){u[h]=p,(r?d<a:_c.call(e,h))&&c++;continue}if(p===null||f===null||typeof p!="object"||typeof f!="object"){u[h]=f;continue}const v=fa(p,f,n+1);u[h]=v,v===p&&c++}return a===o&&c===a?e:u}function Tr(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Fs(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function zr(e){if(!Bs(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Bs(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Bs(e){return Object.prototype.toString.call(e)==="[object Object]"}function Tc(e){return new Promise(t=>{kt.setTimeout(t,e)})}function Pr(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?fa(e,t):t}function zc(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Pc(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var os=Symbol();function pa(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===os?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ma(e,t){return typeof e=="function"?e(...t):!!e}function Rc(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??(i=t()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),e}var Nt,st,Qt,Ki,Ac=(Ki=class extends Pn{constructor(){super();q(this,Nt);q(this,st);q(this,Qt);P(this,Qt,t=>{if(!Ot&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){g(this,st)||this.setEventListener(g(this,Qt))}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,st))==null||t.call(this),P(this,st,void 0))}setEventListener(t){var n;P(this,Qt,t),(n=g(this,st))==null||n.call(this),P(this,st,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){g(this,Nt)!==t&&(P(this,Nt,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof g(this,Nt)=="boolean"?g(this,Nt):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Nt=new WeakMap,st=new WeakMap,Qt=new WeakMap,Ki),cs=new Ac;function Rr(){let e,t;const n=new Promise((i,a)=>{e=i,t=a});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}var Oc=Ec;function Mc(){let e=[],t=0,n=o=>{o()},r=o=>{o()},i=Oc;const a=o=>{t?e.push(o):i(()=>{n(o)})},l=()=>{const o=e;e=[],o.length&&i(()=>{r(()=>{o.forEach(u=>{n(u)})})})};return{batch:o=>{let u;t++;try{u=o()}finally{t--,t||l()}return u},batchCalls:o=>(...u)=>{a(()=>{o(...u)})},schedule:a,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{i=o}}}var pe=Mc(),Kt,it,Gt,Gi,Lc=(Gi=class extends Pn{constructor(){super();q(this,Kt,!0);q(this,it);q(this,Gt);P(this,Gt,t=>{if(!Ot&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){g(this,it)||this.setEventListener(g(this,Gt))}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,it))==null||t.call(this),P(this,it,void 0))}setEventListener(t){var n;P(this,Gt,t),(n=g(this,it))==null||n.call(this),P(this,it,t(this.setOnline.bind(this)))}setOnline(t){g(this,Kt)!==t&&(P(this,Kt,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return g(this,Kt)}},Kt=new WeakMap,it=new WeakMap,Gt=new WeakMap,Gi),Vn=new Lc;function Dc(e){return Math.min(1e3*2**e,3e4)}function xa(e){return(e??"online")==="online"?Vn.isOnline():!0}var Ar=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ga(e){let t=!1,n=0,r;const i=Rr(),a=()=>i.status!=="pending",l=y=>{var C;if(!a()){const b=new Ar(y);p(b),(C=e.onCancel)==null||C.call(e,b)}},o=()=>{t=!0},u=()=>{t=!1},c=()=>cs.isFocused()&&(e.networkMode==="always"||Vn.isOnline())&&e.canRun(),d=()=>xa(e.networkMode)&&e.canRun(),h=y=>{a()||(r==null||r(),i.resolve(y))},p=y=>{a()||(r==null||r(),i.reject(y))},f=()=>new Promise(y=>{var C;r=b=>{(a()||c())&&y(b)},(C=e.onPause)==null||C.call(e)}).then(()=>{var y;r=void 0,a()||(y=e.onContinue)==null||y.call(e)}),v=()=>{if(a())return;let y;const C=n===0?e.initialPromise:void 0;try{y=C??e.fn()}catch(b){y=Promise.reject(b)}Promise.resolve(y).then(h).catch(b=>{var w;if(a())return;const E=e.retry??(Ot?0:3),S=e.retryDelay??Dc,j=typeof S=="function"?S(n,b):S,D=E===!0||typeof E=="number"&&n<E||typeof E=="function"&&E(n,b);if(t||!D){p(b);return}n++,(w=e.onFail)==null||w.call(e,n,b),Tc(j).then(()=>c()?void 0:f()).then(()=>{t?p(b):v()})})};return{promise:i,status:()=>i.status,cancel:l,continue:()=>(r==null||r(),i),cancelRetry:o,continueRetry:u,canStart:d,start:()=>(d()?v():f().then(v),i)}}var St,Wi,ba=(Wi=class{constructor(){q(this,St)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),_r(this.gcTime)&&P(this,St,kt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ot?1/0:300*1e3))}clearGcTimeout(){g(this,St)&&(kt.clearTimeout(g(this,St)),P(this,St,void 0))}},St=new WeakMap,Wi),Ct,Wt,_e,Et,he,En,It,Ae,Ge,Yi,Fc=(Yi=class extends ba{constructor(t){super();q(this,Ae);q(this,Ct);q(this,Wt);q(this,_e);q(this,Et);q(this,he);q(this,En);q(this,It);P(this,It,!1),P(this,En,t.defaultOptions),this.setOptions(t.options),this.observers=[],P(this,Et,t.client),P(this,_e,g(this,Et).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,P(this,Ct,Hs(this.options)),this.state=t.state??g(this,Ct),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=g(this,he))==null?void 0:t.promise}setOptions(t){if(this.options={...g(this,En),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Hs(this.options);n.data!==void 0&&(this.setState(Us(n.data,n.dataUpdatedAt)),P(this,Ct,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&g(this,_e).remove(this)}setData(t,n){const r=Pr(this.state.data,t,this.options);return X(this,Ae,Ge).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){X(this,Ae,Ge).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=g(this,he))==null?void 0:r.promise;return(i=g(this,he))==null||i.cancel(t),n?n.then(we).catch(we):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(g(this,Ct))}isActive(){return this.observers.some(t=>Te(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===os||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>dt(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!ha(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=g(this,he))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=g(this,he))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),g(this,_e).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(g(this,he)&&(g(this,It)?g(this,he).cancel({revert:!0}):g(this,he).cancelRetry()),this.scheduleGc()),g(this,_e).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||X(this,Ae,Ge).call(this,{type:"invalidate"})}async fetch(t,n){var u,c,d,h,p,f,v,y,C,b,E,S;if(this.state.fetchStatus!=="idle"&&((u=g(this,he))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(g(this,he))return g(this,he).continueRetry(),g(this,he).promise}if(t&&this.setOptions(t),!this.options.queryFn){const j=this.observers.find(D=>D.options.queryFn);j&&this.setOptions(j.options)}const r=new AbortController,i=j=>{Object.defineProperty(j,"signal",{enumerable:!0,get:()=>(P(this,It,!0),r.signal)})},a=()=>{const j=pa(this.options,n),w=(()=>{const R={client:g(this,Et),queryKey:this.queryKey,meta:this.meta};return i(R),R})();return P(this,It,!1),this.options.persister?this.options.persister(j,w,this):j(w)},o=(()=>{const j={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:g(this,Et),state:this.state,fetchFn:a};return i(j),j})();(c=this.options.behavior)==null||c.onFetch(o,this),P(this,Wt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=o.fetchOptions)==null?void 0:d.meta))&&X(this,Ae,Ge).call(this,{type:"fetch",meta:(h=o.fetchOptions)==null?void 0:h.meta}),P(this,he,ga({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,onCancel:j=>{j instanceof Ar&&j.revert&&this.setState({...g(this,Wt),fetchStatus:"idle"}),r.abort()},onFail:(j,D)=>{X(this,Ae,Ge).call(this,{type:"failed",failureCount:j,error:D})},onPause:()=>{X(this,Ae,Ge).call(this,{type:"pause"})},onContinue:()=>{X(this,Ae,Ge).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const j=await g(this,he).start();if(j===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(j),(f=(p=g(this,_e).config).onSuccess)==null||f.call(p,j,this),(y=(v=g(this,_e).config).onSettled)==null||y.call(v,j,this.state.error,this),j}catch(j){if(j instanceof Ar){if(j.silent)return g(this,he).promise;if(j.revert){if(this.state.data===void 0)throw j;return this.state.data}}throw X(this,Ae,Ge).call(this,{type:"error",error:j}),(b=(C=g(this,_e).config).onError)==null||b.call(C,j,this),(S=(E=g(this,_e).config).onSettled)==null||S.call(E,this.state.data,j,this),j}finally{this.scheduleGc()}}},Ct=new WeakMap,Wt=new WeakMap,_e=new WeakMap,Et=new WeakMap,he=new WeakMap,En=new WeakMap,It=new WeakMap,Ae=new WeakSet,Ge=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...ya(r.data,this.options),fetchMeta:t.meta??null};case"success":const i={...r,...Us(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return P(this,Wt,t.manual?i:void 0),i;case"error":const a=t.error;return{...r,error:a,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),pe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),g(this,_e).notify({query:this,type:"updated",action:t})})},Yi);function ya(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:xa(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Us(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Hs(e){const 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 je,J,In,be,_t,Yt,We,at,_n,Xt,Jt,Tt,zt,lt,Zt,ee,gn,Or,Mr,Lr,Dr,Fr,Br,Ur,va,Xi,Bc=(Xi=class extends Pn{constructor(t,n){super();q(this,ee);q(this,je);q(this,J);q(this,In);q(this,be);q(this,_t);q(this,Yt);q(this,We);q(this,at);q(this,_n);q(this,Xt);q(this,Jt);q(this,Tt);q(this,zt);q(this,lt);q(this,Zt,new Set);this.options=n,P(this,je,t),P(this,at,null),P(this,We,Rr()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(g(this,J).addObserver(this),qs(g(this,J),this.options)?X(this,ee,gn).call(this):this.updateResult(),X(this,ee,Dr).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Hr(g(this,J),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Hr(g(this,J),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,X(this,ee,Fr).call(this),X(this,ee,Br).call(this),g(this,J).removeObserver(this)}setOptions(t){const n=this.options,r=g(this,J);if(this.options=g(this,je).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Te(this.options.enabled,g(this,J))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");X(this,ee,Ur).call(this),g(this,J).setOptions(this.options),n._defaulted&&!Tr(this.options,n)&&g(this,je).getQueryCache().notify({type:"observerOptionsUpdated",query:g(this,J),observer:this});const i=this.hasListeners();i&&$s(g(this,J),r,this.options,n)&&X(this,ee,gn).call(this),this.updateResult(),i&&(g(this,J)!==r||Te(this.options.enabled,g(this,J))!==Te(n.enabled,g(this,J))||dt(this.options.staleTime,g(this,J))!==dt(n.staleTime,g(this,J)))&&X(this,ee,Or).call(this);const a=X(this,ee,Mr).call(this);i&&(g(this,J)!==r||Te(this.options.enabled,g(this,J))!==Te(n.enabled,g(this,J))||a!==g(this,lt))&&X(this,ee,Lr).call(this,a)}getOptimisticResult(t){const n=g(this,je).getQueryCache().build(g(this,je),t),r=this.createResult(n,t);return Hc(this,r)&&(P(this,be,r),P(this,Yt,this.options),P(this,_t,g(this,J).state)),r}getCurrentResult(){return g(this,be)}trackResult(t,n){return new Proxy(t,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&g(this,We).status==="pending"&&g(this,We).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(t){g(this,Zt).add(t)}getCurrentQuery(){return g(this,J)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=g(this,je).defaultQueryOptions(t),r=g(this,je).getQueryCache().build(g(this,je),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return X(this,ee,gn).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),g(this,be)))}createResult(t,n){var F;const r=g(this,J),i=this.options,a=g(this,be),l=g(this,_t),o=g(this,Yt),c=t!==r?t.state:g(this,In),{state:d}=t;let h={...d},p=!1,f;if(n._optimisticResults){const $=this.hasListeners(),z=!$&&qs(t,n),k=$&&$s(t,r,n,i);(z||k)&&(h={...h,...ya(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:v,errorUpdatedAt:y,status:C}=h;f=h.data;let b=!1;if(n.placeholderData!==void 0&&f===void 0&&C==="pending"){let $;a!=null&&a.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData)?($=a.data,b=!0):$=typeof n.placeholderData=="function"?n.placeholderData((F=g(this,Jt))==null?void 0:F.state.data,g(this,Jt)):n.placeholderData,$!==void 0&&(C="success",f=Pr(a==null?void 0:a.data,$,n),p=!0)}if(n.select&&f!==void 0&&!b)if(a&&f===(l==null?void 0:l.data)&&n.select===g(this,_n))f=g(this,Xt);else try{P(this,_n,n.select),f=n.select(f),f=Pr(a==null?void 0:a.data,f,n),P(this,Xt,f),P(this,at,null)}catch($){P(this,at,$)}g(this,at)&&(v=g(this,at),f=g(this,Xt),y=Date.now(),C="error");const E=h.fetchStatus==="fetching",S=C==="pending",j=C==="error",D=S&&E,w=f!==void 0,U={status:C,fetchStatus:h.fetchStatus,isPending:S,isSuccess:C==="success",isError:j,isInitialLoading:D,isLoading:D,data:f,dataUpdatedAt:h.dataUpdatedAt,error:v,errorUpdatedAt:y,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:E,isRefetching:E&&!S,isLoadingError:j&&!w,isPaused:h.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:j&&w,isStale:us(t,n),refetch:this.refetch,promise:g(this,We),isEnabled:Te(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const $=U.data!==void 0,z=U.status==="error"&&!$,k=_=>{z?_.reject(U.error):$&&_.resolve(U.data)},B=()=>{const _=P(this,We,U.promise=Rr());k(_)},M=g(this,We);switch(M.status){case"pending":t.queryHash===r.queryHash&&k(M);break;case"fulfilled":(z||U.data!==M.value)&&B();break;case"rejected":(!z||U.error!==M.reason)&&B();break}}return U}updateResult(){const t=g(this,be),n=this.createResult(g(this,J),this.options);if(P(this,_t,g(this,J).state),P(this,Yt,this.options),g(this,_t).data!==void 0&&P(this,Jt,g(this,J)),Tr(n,t))return;P(this,be,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,a=typeof i=="function"?i():i;if(a==="all"||!a&&!g(this,Zt).size)return!0;const l=new Set(a??g(this,Zt));return this.options.throwOnError&&l.add("error"),Object.keys(g(this,be)).some(o=>{const u=o;return g(this,be)[u]!==t[u]&&l.has(u)})};X(this,ee,va).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&X(this,ee,Dr).call(this)}},je=new WeakMap,J=new WeakMap,In=new WeakMap,be=new WeakMap,_t=new WeakMap,Yt=new WeakMap,We=new WeakMap,at=new WeakMap,_n=new WeakMap,Xt=new WeakMap,Jt=new WeakMap,Tt=new WeakMap,zt=new WeakMap,lt=new WeakMap,Zt=new WeakMap,ee=new WeakSet,gn=function(t){X(this,ee,Ur).call(this);let n=g(this,J).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(we)),n},Or=function(){X(this,ee,Fr).call(this);const t=dt(this.options.staleTime,g(this,J));if(Ot||g(this,be).isStale||!_r(t))return;const r=ha(g(this,be).dataUpdatedAt,t)+1;P(this,Tt,kt.setTimeout(()=>{g(this,be).isStale||this.updateResult()},r))},Mr=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(g(this,J)):this.options.refetchInterval)??!1},Lr=function(t){X(this,ee,Br).call(this),P(this,lt,t),!(Ot||Te(this.options.enabled,g(this,J))===!1||!_r(g(this,lt))||g(this,lt)===0)&&P(this,zt,kt.setInterval(()=>{(this.options.refetchIntervalInBackground||cs.isFocused())&&X(this,ee,gn).call(this)},g(this,lt)))},Dr=function(){X(this,ee,Or).call(this),X(this,ee,Lr).call(this,X(this,ee,Mr).call(this))},Fr=function(){g(this,Tt)&&(kt.clearTimeout(g(this,Tt)),P(this,Tt,void 0))},Br=function(){g(this,zt)&&(kt.clearInterval(g(this,zt)),P(this,zt,void 0))},Ur=function(){const t=g(this,je).getQueryCache().build(g(this,je),this.options);if(t===g(this,J))return;const n=g(this,J);P(this,J,t),P(this,In,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},va=function(t){pe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(g(this,be))}),g(this,je).getQueryCache().notify({query:g(this,J),type:"observerResultsUpdated"})})},Xi);function Uc(e,t){return Te(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function qs(e,t){return Uc(e,t)||e.state.data!==void 0&&Hr(e,t,t.refetchOnMount)}function Hr(e,t,n){if(Te(t.enabled,e)!==!1&&dt(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&us(e,t)}return!1}function $s(e,t,n,r){return(e!==t||Te(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&us(e,n)}function us(e,t){return Te(t.enabled,e)!==!1&&e.isStaleByTime(dt(t.staleTime,e))}function Hc(e,t){return!Tr(e.getCurrentResult(),t)}function Vs(e){return{onFetch:(t,n)=>{var d,h,p,f,v;const r=t.options,i=(p=(h=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:p.direction,a=((f=t.state.data)==null?void 0:f.pages)||[],l=((v=t.state.data)==null?void 0:v.pageParams)||[];let o={pages:[],pageParams:[]},u=0;const c=async()=>{let y=!1;const C=S=>{Rc(S,()=>t.signal,()=>y=!0)},b=pa(t.options,t.fetchOptions),E=async(S,j,D)=>{if(y)return Promise.reject();if(j==null&&S.pages.length)return Promise.resolve(S);const R=(()=>{const z={client:t.client,queryKey:t.queryKey,pageParam:j,direction:D?"backward":"forward",meta:t.options.meta};return C(z),z})(),U=await b(R),{maxPages:F}=t.options,$=D?Pc:zc;return{pages:$(S.pages,U,F),pageParams:$(S.pageParams,j,F)}};if(i&&a.length){const S=i==="backward",j=S?qc:Qs,D={pages:a,pageParams:l},w=j(r,D);o=await E(D,w,S)}else{const S=e??a.length;do{const j=u===0?l[0]??r.initialPageParam:Qs(r,o);if(u>0&&j==null)break;o=await E(o,j),u++}while(u<S)}return o};t.options.persister?t.fetchFn=()=>{var y,C;return(C=(y=t.options).persister)==null?void 0:C.call(y,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function Qs(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function qc(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Tn,De,xe,Pt,Fe,nt,Ji,$c=(Ji=class extends ba{constructor(t){super();q(this,Fe);q(this,Tn);q(this,De);q(this,xe);q(this,Pt);P(this,Tn,t.client),this.mutationId=t.mutationId,P(this,xe,t.mutationCache),P(this,De,[]),this.state=t.state||Vc(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){g(this,De).includes(t)||(g(this,De).push(t),this.clearGcTimeout(),g(this,xe).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){P(this,De,g(this,De).filter(n=>n!==t)),this.scheduleGc(),g(this,xe).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){g(this,De).length||(this.state.status==="pending"?this.scheduleGc():g(this,xe).remove(this))}continue(){var t;return((t=g(this,Pt))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,o,u,c,d,h,p,f,v,y,C,b,E,S,j,D,w,R;const n=()=>{X(this,Fe,nt).call(this,{type:"continue"})},r={client:g(this,Tn),meta:this.options.meta,mutationKey:this.options.mutationKey};P(this,Pt,ga({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(U,F)=>{X(this,Fe,nt).call(this,{type:"failed",failureCount:U,error:F})},onPause:()=>{X(this,Fe,nt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>g(this,xe).canRun(this)}));const i=this.state.status==="pending",a=!g(this,Pt).canStart();try{if(i)n();else{X(this,Fe,nt).call(this,{type:"pending",variables:t,isPaused:a}),g(this,xe).config.onMutate&&await g(this,xe).config.onMutate(t,this,r);const F=await((o=(l=this.options).onMutate)==null?void 0:o.call(l,t,r));F!==this.state.context&&X(this,Fe,nt).call(this,{type:"pending",context:F,variables:t,isPaused:a})}const U=await g(this,Pt).start();return await((c=(u=g(this,xe).config).onSuccess)==null?void 0:c.call(u,U,t,this.state.context,this,r)),await((h=(d=this.options).onSuccess)==null?void 0:h.call(d,U,t,this.state.context,r)),await((f=(p=g(this,xe).config).onSettled)==null?void 0:f.call(p,U,null,this.state.variables,this.state.context,this,r)),await((y=(v=this.options).onSettled)==null?void 0:y.call(v,U,null,t,this.state.context,r)),X(this,Fe,nt).call(this,{type:"success",data:U}),U}catch(U){try{await((b=(C=g(this,xe).config).onError)==null?void 0:b.call(C,U,t,this.state.context,this,r))}catch(F){Promise.reject(F)}try{await((S=(E=this.options).onError)==null?void 0:S.call(E,U,t,this.state.context,r))}catch(F){Promise.reject(F)}try{await((D=(j=g(this,xe).config).onSettled)==null?void 0:D.call(j,void 0,U,this.state.variables,this.state.context,this,r))}catch(F){Promise.reject(F)}try{await((R=(w=this.options).onSettled)==null?void 0:R.call(w,void 0,U,t,this.state.context,r))}catch(F){Promise.reject(F)}throw X(this,Fe,nt).call(this,{type:"error",error:U}),U}finally{g(this,xe).runNext(this)}}},Tn=new WeakMap,De=new WeakMap,xe=new WeakMap,Pt=new WeakMap,Fe=new WeakSet,nt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),pe.batch(()=>{g(this,De).forEach(r=>{r.onMutationUpdate(t)}),g(this,xe).notify({mutation:this,type:"updated",action:t})})},Ji);function Vc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ye,Oe,zn,Zi,Qc=(Zi=class extends Pn{constructor(t={}){super();q(this,Ye);q(this,Oe);q(this,zn);this.config=t,P(this,Ye,new Set),P(this,Oe,new Map),P(this,zn,0)}build(t,n,r){const i=new $c({client:t,mutationCache:this,mutationId:++Mn(this,zn)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){g(this,Ye).add(t);const n=Ln(t);if(typeof n=="string"){const r=g(this,Oe).get(n);r?r.push(t):g(this,Oe).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(g(this,Ye).delete(t)){const n=Ln(t);if(typeof n=="string"){const r=g(this,Oe).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&g(this,Oe).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ln(t);if(typeof n=="string"){const r=g(this,Oe).get(n),i=r==null?void 0:r.find(a=>a.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=Ln(t);if(typeof n=="string"){const i=(r=g(this,Oe).get(n))==null?void 0:r.find(a=>a!==t&&a.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){pe.batch(()=>{g(this,Ye).forEach(t=>{this.notify({type:"removed",mutation:t})}),g(this,Ye).clear(),g(this,Oe).clear()})}getAll(){return Array.from(g(this,Ye))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ds(n,r))}findAll(t={}){return this.getAll().filter(n=>Ds(t,n))}notify(t){pe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return pe.batch(()=>Promise.all(t.map(n=>n.continue().catch(we))))}},Ye=new WeakMap,Oe=new WeakMap,zn=new WeakMap,Zi);function Ln(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Be,ea,Kc=(ea=class extends Pn{constructor(t={}){super();q(this,Be);this.config=t,P(this,Be,new Map)}build(t,n,r){const i=n.queryKey,a=n.queryHash??ls(i,n);let l=this.get(a);return l||(l=new Fc({client:t,queryKey:i,queryHash:a,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(l)),l}add(t){g(this,Be).has(t.queryHash)||(g(this,Be).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=g(this,Be).get(t.queryHash);n&&(t.destroy(),n===t&&g(this,Be).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){pe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return g(this,Be).get(t)}getAll(){return[...g(this,Be).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ls(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Ls(t,r)):n}notify(t){pe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){pe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){pe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Be=new WeakMap,ea),oe,ot,ct,en,tn,ut,nn,rn,ta,Gc=(ta=class{constructor(e={}){q(this,oe);q(this,ot);q(this,ct);q(this,en);q(this,tn);q(this,ut);q(this,nn);q(this,rn);P(this,oe,e.queryCache||new Kc),P(this,ot,e.mutationCache||new Qc),P(this,ct,e.defaultOptions||{}),P(this,en,new Map),P(this,tn,new Map),P(this,ut,0)}mount(){Mn(this,ut)._++,g(this,ut)===1&&(P(this,nn,cs.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,oe).onFocus())})),P(this,rn,Vn.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,oe).onOnline())})))}unmount(){var e,t;Mn(this,ut)._--,g(this,ut)===0&&((e=g(this,nn))==null||e.call(this),P(this,nn,void 0),(t=g(this,rn))==null||t.call(this),P(this,rn,void 0))}isFetching(e){return g(this,oe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return g(this,ot).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=g(this,oe).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=g(this,oe).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(dt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return g(this,oe).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=g(this,oe).get(r.queryHash),a=i==null?void 0:i.state.data,l=Ic(t,a);if(l!==void 0)return g(this,oe).build(this,r).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return pe.batch(()=>g(this,oe).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=g(this,oe).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=g(this,oe);pe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=g(this,oe);return pe.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=pe.batch(()=>g(this,oe).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(we).catch(we)}invalidateQueries(e,t={}){return pe.batch(()=>(g(this,oe).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=pe.batch(()=>g(this,oe).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let a=i.fetch(void 0,n);return n.throwOnError||(a=a.catch(we)),i.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(we)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=g(this,oe).build(this,t);return n.isStaleByTime(dt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(we).catch(we)}fetchInfiniteQuery(e){return e.behavior=Vs(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(we).catch(we)}ensureInfiniteQueryData(e){return e.behavior=Vs(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Vn.isOnline()?g(this,ot).resumePausedMutations():Promise.resolve()}getQueryCache(){return g(this,oe)}getMutationCache(){return g(this,ot)}getDefaultOptions(){return g(this,ct)}setDefaultOptions(e){P(this,ct,e)}setQueryDefaults(e,t){g(this,en).set(kn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...g(this,en).values()],n={};return t.forEach(r=>{Nn(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){g(this,tn).set(kn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...g(this,tn).values()],n={};return t.forEach(r=>{Nn(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...g(this,ct).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ls(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===os&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...g(this,ct).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){g(this,oe).clear(),g(this,ot).clear()}},oe=new WeakMap,ot=new WeakMap,ct=new WeakMap,en=new WeakMap,tn=new WeakMap,ut=new WeakMap,nn=new WeakMap,rn=new WeakMap,ta),ja=O.createContext(void 0),wa=e=>{const t=O.useContext(ja);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Wc=({client:e,children:t})=>(O.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),s.jsx(ja.Provider,{value:e,children:t})),ka=O.createContext(!1),Yc=()=>O.useContext(ka);ka.Provider;function Xc(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Jc=O.createContext(Xc()),Zc=()=>O.useContext(Jc),eu=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?ma(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},tu=e=>{O.useEffect(()=>{e.clearReset()},[e])},nu=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ma(n,[e.error,r])),ru=e=>{if(e.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},su=(e,t)=>e.isLoading&&e.isFetching&&!t,iu=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ks=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function au(e,t,n){var p,f,v,y;const r=Yc(),i=Zc(),a=wa(),l=a.defaultQueryOptions(e);(f=(p=a.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||f.call(p,l);const o=a.getQueryCache().get(l.queryHash);l._optimisticResults=r?"isRestoring":"optimistic",ru(l),eu(l,i,o),tu(i);const u=!a.getQueryCache().get(l.queryHash),[c]=O.useState(()=>new t(a,l)),d=c.getOptimisticResult(l),h=!r&&e.subscribed!==!1;if(O.useSyncExternalStore(O.useCallback(C=>{const b=h?c.subscribe(pe.batchCalls(C)):we;return c.updateResult(),b},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),O.useEffect(()=>{c.setOptions(l)},[l,c]),iu(l,d))throw Ks(l,c,i);if(nu({result:d,errorResetBoundary:i,throwOnError:l.throwOnError,query:o,suspense:l.suspense}))throw d.error;if((y=(v=a.getDefaultOptions().queries)==null?void 0:v._experimental_afterQuery)==null||y.call(v,l,d),l.experimental_prefetchInRender&&!Ot&&su(d,r)){const C=u?Ks(l,c,i):o==null?void 0:o.promise;C==null||C.catch(we).finally(()=>{c.updateResult()})}return l.notifyOnChangeProps?d:c.trackResult(d)}function rr(e,t){return au(e,Bc)}function L(...e){return Ol(Ml(e))}const lu=Yn("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 H({className:e,variant:t="default",render:n,...r}){return Gn({defaultTagName:"span",props:Wn({className:L(lu({variant:t}),e)},r),render:n,state:{slot:"badge",variant:t}})}const ou=Yn("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 ye({className:e,variant:t="default",size:n="default",...r}){return s.jsx(Ll,{"data-slot":"button",className:L(ou({variant:t,size:n,className:e})),...r})}function ne({className:e,size:t="default",...n}){return s.jsx("div",{"data-slot":"card","data-size":t,className:L("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 se({className:e,...t}){return s.jsx("div",{"data-slot":"card-header",className:L("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 ie({className:e,...t}){return s.jsx("div",{"data-slot":"card-title",className:L("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",e),...t})}function ce({className:e,...t}){return s.jsx("div",{"data-slot":"card-description",className:L("text-sm text-muted-foreground",e),...t})}function Xe({className:e,...t}){return s.jsx("div",{"data-slot":"card-action",className:L("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...t})}function Ze({className:e,...t}){return s.jsx("div",{"data-slot":"card-content",className:L("px-4 group-data-[size=sm]/card:px-3",e),...t})}function Gs({className:e,...t}){return s.jsx(Dl,{"data-slot":"checkbox",className:L("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:s.jsx(Fl,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:s.jsx(Xn,{})})})}const Na=Bl,Sa=Ul,Ca=Hl;function Ws({...e}){return s.jsx(ql,{"data-slot":"dropdown-menu",...e})}function Ys({...e}){return s.jsx($l,{"data-slot":"dropdown-menu-trigger",...e})}function Xs({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:i,...a}){return s.jsx(Vl,{children:s.jsx(Ql,{className:"isolate z-50 outline-hidden",align:e,alignOffset:t,side:n,sideOffset:r,children:s.jsx(Kl,{"data-slot":"dropdown-menu-content",className:L("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 cu({className:e,children:t,checked:n,inset:r,...i}){return s.jsxs(Xl,{"data-slot":"dropdown-menu-checkbox-item","data-inset":r,className:L("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:[s.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:s.jsx(Jl,{children:s.jsx(Xn,{})})}),t]})}function uu({...e}){return s.jsx(Gl,{"data-slot":"dropdown-menu-radio-group",...e})}function du({className:e,children:t,inset:n,...r}){return s.jsxs(Wl,{"data-slot":"dropdown-menu-radio-item","data-inset":n,className:L("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:[s.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:s.jsx(Yl,{children:s.jsx(Xn,{})})}),t]})}function Js({className:e,...t}){return s.jsx("label",{"data-slot":"label",className:L("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})}const Zs=Zl;function ei({className:e,...t}){return s.jsx(lo,{"data-slot":"select-group",className:L("scroll-my-1 p-1",e),...t})}function ti({className:e,...t}){return s.jsx(no,{"data-slot":"select-value",className:L("flex flex-1 text-left",e),...t})}function ni({className:e,size:t="default",children:n,...r}){return s.jsxs(eo,{"data-slot":"select-trigger","data-size":t,className:L("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,s.jsx(to,{render:s.jsx(At,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function ri({className:e,children:t,side:n="bottom",sideOffset:r=4,align:i="center",alignOffset:a=0,alignItemWithTrigger:l=!0,...o}){return s.jsx(ro,{children:s.jsx(so,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:l,className:"isolate z-50",children:s.jsxs(io,{"data-slot":"select-content","data-align-trigger":l,className:L("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),...o,children:[s.jsx(hu,{}),s.jsx(ao,{children:t}),s.jsx(fu,{})]})})})}function dn({className:e,children:t,...n}){return s.jsxs(oo,{"data-slot":"select-item",className:L("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:[s.jsx(co,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),s.jsx(uo,{render:s.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:s.jsx(Xn,{className:"pointer-events-none"})})]})}function hu({className:e,...t}){return s.jsx(ho,{"data-slot":"select-scroll-up-button",className:L("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:s.jsx(fo,{})})}function fu({className:e,...t}){return s.jsx(po,{"data-slot":"select-scroll-down-button",className:L("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:s.jsx(At,{})})}function Ea({className:e,...t}){return s.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:s.jsx("table",{"data-slot":"table",className:L("w-full caption-bottom text-sm",e),...t})})}function Ia({className:e,...t}){return s.jsx("thead",{"data-slot":"table-header",className:L("[&_tr]:border-b",e),...t})}function _a({className:e,...t}){return s.jsx("tbody",{"data-slot":"table-body",className:L("[&_tr:last-child]:border-0",e),...t})}function Sn({className:e,...t}){return s.jsx("tr",{"data-slot":"table-row",className:L("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function qt({className:e,...t}){return s.jsx("th",{"data-slot":"table-head",className:L("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",e),...t})}function jt({className:e,...t}){return s.jsx("td",{"data-slot":"table-cell",className:L("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",e),...t})}function ds({className:e,orientation:t="horizontal",...n}){return s.jsx(mo,{"data-slot":"tabs","data-orientation":t,className:L("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const pu=Yn("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 hs({className:e,variant:t="default",...n}){return s.jsx(xo,{"data-slot":"tabs-list","data-variant":t,className:L(pu({variant:t}),e),...n})}function He({className:e,...t}){return s.jsx(go,{"data-slot":"tabs-trigger",className:L("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 Rt({className:e,...t}){return s.jsx(bo,{"data-slot":"tabs-content",className:L("flex-1 text-sm outline-none",e),...t})}function Ta({delay:e=0,...t}){return s.jsx(yo,{"data-slot":"tooltip-provider",delay:e,...t})}function ht({...e}){return s.jsx(vo,{"data-slot":"tooltip",...e})}function ft({...e}){return s.jsx(So,{"data-slot":"tooltip-trigger",...e})}function pt({className:e,side:t="top",sideOffset:n=4,align:r="center",alignOffset:i=0,children:a,...l}){return s.jsx(jo,{children:s.jsx(wo,{align:r,alignOffset:i,side:t,sideOffset:n,className:"isolate z-50",children:s.jsxs(ko,{"data-slot":"tooltip-content",className:L("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),...l,children:[a,s.jsx(No,{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"})]})})})}const qr={HEALTHY:{icon:s.jsx(Je,{className:"size-4 text-emerald-600"}),variant:"outline",label:"Healthy"},WARNING:{icon:s.jsx(xt,{className:"size-4 text-amber-500"}),variant:"secondary",label:"Warning"},CRITICAL:{icon:s.jsx(Me,{className:"size-4 text-red-500"}),variant:"destructive",label:"Critical"},UNGRADED:{icon:s.jsx(gt,{className:"size-4 text-muted-foreground"}),variant:"secondary",label:"Ungraded"},UNKNOWN:{icon:s.jsx(Jn,{className:"size-4 text-muted-foreground/60"}),variant:"secondary",label:"Unknown"}};function fs(e,t){return t<5?"UNGRADED":e>=.8?"HEALTHY":e>=.5?"WARNING":"CRITICAL"}function mt(e){return e==null||!Number.isFinite(e)?"--":`${Math.round(e*100)}%`}function za(e){return[...e].sort((t,n)=>{const r=t.passRate??1,i=n.passRate??1;return r!==i?r-i:n.checks-t.checks})}function Ie(e){const t=new Date(e).getTime();if(Number.isNaN(t))return"--";const 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`;const i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function mu({className:e,type:t,...n}){return s.jsx(Co,{type:t,"data-slot":"input",className:L("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})}const dr=768;function xu(){const[e,t]=O.useState(void 0);return O.useEffect(()=>{const n=window.matchMedia(`(max-width: ${dr-1}px)`),r=()=>{t(window.innerWidth<dr)};return n.addEventListener("change",r),t(window.innerWidth<dr),()=>n.removeEventListener("change",r)},[]),!!e}function gu({className:e,orientation:t="horizontal",...n}){return s.jsx(Eo,{"data-slot":"separator",orientation:t,className:L("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",e),...n})}function bu({...e}){return s.jsx(Io,{"data-slot":"sheet",...e})}function yu({...e}){return s.jsx(Ro,{"data-slot":"sheet-portal",...e})}function vu({className:e,...t}){return s.jsx(Ao,{"data-slot":"sheet-overlay",className:L("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 ju({className:e,children:t,side:n="right",showCloseButton:r=!0,...i}){return s.jsxs(yu,{children:[s.jsx(vu,{}),s.jsxs(_o,{"data-slot":"sheet-content","data-side":n,className:L("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&&s.jsxs(To,{"data-slot":"sheet-close",render:s.jsx(ye,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[s.jsx(ra,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function wu({className:e,...t}){return s.jsx("div",{"data-slot":"sheet-header",className:L("flex flex-col gap-0.5 p-4",e),...t})}function ku({className:e,...t}){return s.jsx(zo,{"data-slot":"sheet-title",className:L("text-base font-medium text-foreground",e),...t})}function Nu({className:e,...t}){return s.jsx(Po,{"data-slot":"sheet-description",className:L("text-sm text-muted-foreground",e),...t})}function qe({className:e,...t}){return s.jsx("div",{"data-slot":"skeleton",className:L("animate-pulse rounded-md bg-muted",e),...t})}const Su="sidebar_state",Cu=3600*24*7,Eu="16rem",Iu="18rem",_u="3rem",Tu="b",Pa=O.createContext(null);function ps(){const e=O.useContext(Pa);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function zu({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...l}){const o=xu(),[u,c]=O.useState(!1),[d,h]=O.useState(e),p=t??d,f=O.useCallback(b=>{const E=typeof b=="function"?b(p):b;n?n(E):h(E),document.cookie=`${Su}=${E}; path=/; max-age=${Cu}`},[n,p]),v=O.useCallback(()=>o?c(b=>!b):f(b=>!b),[o,f,c]);O.useEffect(()=>{const b=E=>{E.key===Tu&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),v())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[v]);const y=p?"expanded":"collapsed",C=O.useMemo(()=>({state:y,open:p,setOpen:f,isMobile:o,openMobile:u,setOpenMobile:c,toggleSidebar:v}),[y,p,f,o,u,c,v]);return s.jsx(Pa.Provider,{value:C,children:s.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Eu,"--sidebar-width-icon":_u,...i},className:L("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",r),...l,children:a})})}function Pu({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:i,dir:a,...l}){const{isMobile:o,state:u,openMobile:c,setOpenMobile:d}=ps();return n==="none"?s.jsx("div",{"data-slot":"sidebar",className:L("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",r),...l,children:i}):o?s.jsx(bu,{open:c,onOpenChange:d,...l,children:s.jsxs(ju,{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":Iu},side:e,children:[s.jsxs(wu,{className:"sr-only",children:[s.jsx(ku,{children:"Sidebar"}),s.jsx(Nu,{children:"Displays the mobile sidebar."})]}),s.jsx("div",{className:"flex h-full w-full flex-col",children:i})]})}):s.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":u,"data-collapsible":u==="collapsed"?n:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[s.jsx("div",{"data-slot":"sidebar-gap",className:L("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)")}),s.jsx("div",{"data-slot":"sidebar-container","data-side":e,className:L("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),...l,children:s.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 Ru({className:e,onClick:t,...n}){const{toggleSidebar:r}=ps();return s.jsxs(ye,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:L(e),onClick:i=>{t==null||t(i),r()},...n,children:[s.jsx(Oo,{}),s.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Au({className:e,...t}){return s.jsx("main",{"data-slot":"sidebar-inset",className:L("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 Ou({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:L("flex flex-col gap-2 p-2",e),...t})}function Mu({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:L("flex flex-col gap-2 p-2",e),...t})}function Lu({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:L("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function hr({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:L("relative flex w-full min-w-0 flex-col p-2",e),...t})}function Du({className:e,render:t,...n}){return Gn({defaultTagName:"div",props:Wn({className:L("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 fr({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:L("w-full text-sm",e),...t})}function Dn({className:e,...t}){return s.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:L("flex w-full min-w-0 flex-col gap-0",e),...t})}function bn({className:e,...t}){return s.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:L("group/menu-item relative",e),...t})}const Fu=Yn("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 yn({render:e,isActive:t=!1,variant:n="default",size:r="default",tooltip:i,className:a,...l}){const{isMobile:o,state:u}=ps(),c=Gn({defaultTagName:"button",props:Wn({className:L(Fu({variant:n,size:r}),a)},l),render:i?s.jsx(ft,{render:e}):e,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:r,active:t}});return i?(typeof i=="string"&&(i={children:i}),s.jsxs(ht,{children:[c,s.jsx(pt,{side:"right",align:"center",hidden:u!=="collapsed"||o,...i})]})):c}function Bu({className:e,...t}){return s.jsx("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:L("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 Uu({className:e,...t}){return s.jsx("li",{"data-slot":"sidebar-menu-sub-item","data-sidebar":"menu-sub-item",className:L("group/menu-sub-item relative",e),...t})}function Hu({render:e,size:t="md",isActive:n=!1,className:r,...i}){return Gn({defaultTagName:"a",props:Wn({className:L("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}})}const Ra={HEALTHY:s.jsx(Je,{className:"size-3.5 text-emerald-600"}),WARNING:s.jsx(xt,{className:"size-3.5 text-amber-500"}),CRITICAL:s.jsx(Me,{className:"size-3.5 text-red-500"}),UNGRADED:s.jsx(gt,{className:"size-3.5 text-muted-foreground"}),UNKNOWN:s.jsx(Jn,{className:"size-3.5 text-muted-foreground/60"})},qu={project:{label:"Project",icon:s.jsx(Fo,{className:"size-4"})},global:{label:"Global",icon:s.jsx(Ir,{className:"size-4"})},system:{label:"System",icon:s.jsx(Do,{className:"size-4"})},admin:{label:"Admin",icon:s.jsx(Ir,{className:"size-4"})},unknown:{label:"Unknown",icon:s.jsx(Jn,{className:"size-4"})}};function $u({scope:e,skills:t,pathname:n,defaultOpen:r}){const i=qu[e]??{label:e,icon:s.jsx(Ir,{className:"size-4"})},a=t.some(u=>n===`/skills/${encodeURIComponent(u.name)}`),[l,o]=O.useState(r||a);return O.useEffect(()=>{a&&o(!0)},[a]),s.jsx(Na,{open:l,onOpenChange:o,className:"group/collapsible",children:s.jsxs(bn,{children:[s.jsxs(Sa,{render:s.jsx(yn,{tooltip:i.label}),children:[i.icon,s.jsx("span",{children:i.label}),s.jsx(H,{variant:"secondary",className:"ml-auto h-4 px-1.5 text-[10px]",children:t.length}),s.jsx(Mt,{className:"ml-1 size-4 shrink-0 transition-transform duration-200 group-data-[open]/collapsible:rotate-90"})]}),s.jsx(Ca,{children:s.jsx(Bu,{children:t.map(u=>{const c=n===`/skills/${encodeURIComponent(u.name)}`;return s.jsx(Uu,{children:s.jsxs(Hu,{isActive:c,render:s.jsx(wt,{to:`/skills/${encodeURIComponent(u.name)}`}),children:[Ra[u.status],s.jsx("span",{className:"truncate",children:u.name}),s.jsx(H,{variant:u.status==="CRITICAL"?"destructive":u.status==="HEALTHY"?"outline":"secondary",className:"ml-auto h-4 text-[10px] px-1.5 shrink-0",children:mt(u.passRate)})]})},u.name)})})})]})})}function Vu({skills:e,search:t,onSearchChange:n,version:r,...i}){const a=Il(),l=O.useMemo(()=>{const u={};for(const p of e){const f=p.scope??"unknown";u[f]||(u[f]=[]),u[f].push(p)}const c=["global","project","system","admin","unknown"],d=c.filter(p=>{var f;return(f=u[p])==null?void 0:f.length}).map(p=>({scope:p,skills:u[p]})),h=Object.keys(u).filter(p=>!c.includes(p)).sort().map(p=>({scope:p,skills:u[p]}));return[...d,...h]},[e]),o=l.length>1;return s.jsxs(Pu,{collapsible:"offcanvas",...i,children:[s.jsx(Ou,{children:s.jsx(Dn,{children:s.jsx(bn,{children:s.jsxs(yn,{className:"data-[slot=sidebar-menu-button]:!p-1.5",render:s.jsx(wt,{to:"/"}),children:[s.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"}),s.jsxs("span",{className:"text-base font-semibold",children:["self",s.jsx("span",{className:"text-primary-accent",children:"tune"})]})]})})})}),s.jsxs(Lu,{children:[s.jsx(hr,{children:s.jsx(fr,{children:s.jsxs("div",{className:"relative",children:[s.jsx(Mo,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),s.jsx(mu,{"aria-label":"Filter skills",placeholder:"Filter skills...",value:t,onChange:u=>n(u.target.value),className:"h-8 pl-8 text-sm"})]})})}),s.jsx(hr,{children:s.jsx(fr,{children:s.jsx(Dn,{children:s.jsx(bn,{children:s.jsxs(yn,{isActive:a.pathname==="/",tooltip:"Dashboard",render:s.jsx(wt,{to:"/"}),children:[s.jsx(Lo,{className:"size-4"}),s.jsx("span",{children:"Dashboard"})]})})})})}),s.jsxs(hr,{className:"flex-1",children:[s.jsx(Du,{children:"Skills"}),s.jsx(fr,{children:s.jsxs(Dn,{children:[o?l.map(({scope:u,skills:c})=>s.jsx($u,{scope:u,skills:c,pathname:a.pathname,defaultOpen:u==="global"||u==="project"},u)):e.map(u=>{const c=a.pathname===`/skills/${encodeURIComponent(u.name)}`;return s.jsx(bn,{children:s.jsxs(yn,{isActive:c,tooltip:`${u.name} — ${mt(u.passRate)}`,render:s.jsx(wt,{to:`/skills/${encodeURIComponent(u.name)}`}),children:[Ra[u.status],s.jsx("span",{className:"truncate",children:u.name}),s.jsx(H,{variant:u.status==="CRITICAL"?"destructive":u.status==="HEALTHY"?"outline":"secondary",className:"ml-auto h-4 text-[10px] px-1.5 shrink-0",children:mt(u.passRate)})]})},u.name)}),e.length===0&&s.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No skills match"})]})})]})]}),s.jsxs(Mu,{children:[s.jsx(Dn,{children:s.jsx(bn,{children:s.jsxs(yn,{isActive:a.pathname==="/status",tooltip:"System Status",render:s.jsx(wt,{to:"/status"}),children:[s.jsx(sa,{className:"size-4"}),s.jsx("span",{children:"System Status"})]})})}),s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 text-xs text-muted-foreground",children:[s.jsx(sn,{className:"size-3"}),s.jsxs("span",{children:["selftune",r?` v${r}`:""]})]})]})]})}const Aa=O.createContext(void 0),Oa="selftune-theme",Qu=["dark","light","system"];function Ku(e){const t=localStorage.getItem(Oa);return Qu.includes(t)?t:e}function Gu({children:e,defaultTheme:t="dark"}){const[n,r]=O.useState(()=>Ku(t));return O.useEffect(()=>{const i=window.document.documentElement,a=window.matchMedia("(prefers-color-scheme: dark)"),l=o=>{i.classList.remove("light","dark"),i.classList.add(o)};if(n==="system"){const o=()=>l(a.matches?"dark":"light");return o(),a.addEventListener("change",o),()=>a.removeEventListener("change",o)}l(n)},[n]),s.jsx(Aa.Provider,{value:{theme:n,setTheme:i=>{localStorage.setItem(Oa,i),r(i)}},children:e})}function Wu(){const e=O.useContext(Aa);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e}function Yu(){const{theme:e,setTheme:t}=Wu();return s.jsxs(ye,{variant:"ghost",size:"icon",className:"relative size-8",onClick:()=>t(e==="dark"?"light":"dark"),children:[s.jsx(Bo,{className:"size-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),s.jsx(Uo,{className:"absolute size-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),s.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}function ms(){return s.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:s.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:px-6",children:[s.jsx(Ru,{className:"-ml-1"}),s.jsx(gu,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),s.jsx("div",{className:"ml-auto",children:s.jsx(Yu,{})})]})})}const si={created:"outline",validated:"secondary",deployed:"default",rejected:"destructive",rolled_back:"destructive",pending:"secondary"};function Xu({evolution:e,pendingProposals:t,unmatchedQueries:n,onSelectProposal:r}){return e.length>0||t.length>0||n.length>0?s.jsxs(ne,{children:[s.jsxs(se,{children:[s.jsxs(ie,{className:"flex items-center gap-2 text-sm",children:[s.jsx(sn,{className:"size-4"}),"Activity"]}),s.jsx(ce,{children:"Recent evolution events and queries"})]}),s.jsx(Ze,{children:s.jsxs(ds,{defaultValue:t.length>0?"pending":e.length>0?"timeline":"unmatched",children:[s.jsx(Ta,{children:s.jsxs(hs,{className:"w-full",children:[t.length>0&&s.jsxs(ht,{children:[s.jsxs(ft,{render:s.jsx(He,{value:"pending",className:"flex-1 gap-1.5"}),children:[s.jsx(Ho,{className:"size-3.5"}),s.jsx(H,{variant:"secondary",className:"h-4 px-1 text-[10px]",children:t.length})]}),s.jsx(pt,{children:"Pending proposals"})]}),s.jsxs(ht,{children:[s.jsx(ft,{render:s.jsx(He,{value:"timeline",className:"flex-1"}),children:s.jsx(ss,{className:"size-3.5"})}),s.jsx(pt,{children:"Timeline"})]}),n.length>0&&s.jsxs(ht,{children:[s.jsxs(ft,{render:s.jsx(He,{value:"unmatched",className:"flex-1 gap-1.5"}),children:[s.jsx(ia,{className:"size-3.5"}),s.jsx(H,{variant:"destructive",className:"h-4 px-1 text-[10px]",children:n.length})]}),s.jsx(pt,{children:"Unmatched queries"})]})]})}),t.length>0&&s.jsx(Rt,{value:"pending",className:"mt-4 space-y-3",children:t.slice(0,10).map(a=>s.jsxs("button",{type:"button",onClick:()=>{a.skill_name&&r&&r(a.skill_name,a.proposal_id)},disabled:!a.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:[s.jsx("div",{className:"mt-1 size-2 shrink-0 rounded-full bg-amber-400"}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(H,{variant:si[a.action]??"secondary",className:"text-[10px]",children:a.action}),s.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:Ie(a.timestamp)})]}),s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:a.details}),a.skill_name&&s.jsxs("span",{className:"text-[10px] text-muted-foreground/60 font-mono",children:[a.skill_name," · #",a.proposal_id.slice(0,8)]})]})]},a.proposal_id))}),s.jsxs(Rt,{value:"timeline",className:"mt-4 space-y-3",children:[e.slice(0,30).map((a,l)=>s.jsxs("button",{type:"button",onClick:()=>{a.skill_name&&r&&r(a.skill_name,a.proposal_id)},disabled:!a.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:[s.jsx("div",{className:`mt-1 size-2 shrink-0 rounded-full ${a.action==="deployed"?"bg-emerald-500":a.action==="rejected"||a.action==="rolled_back"?"bg-red-500":a.action==="validated"?"bg-amber-400":"bg-primary-accent"}`}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(H,{variant:si[a.action]??"secondary",className:"text-[10px]",children:a.action}),s.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:Ie(a.timestamp)})]}),s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:a.details}),s.jsxs("span",{className:"text-[10px] text-muted-foreground/60 font-mono",children:[a.skill_name?`${a.skill_name} · `:"","#",a.proposal_id.slice(0,8)]})]})]},`${a.proposal_id}-${l}`)),e.length===0&&s.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No timeline events"})]}),n.length>0&&s.jsx(Rt,{value:"unmatched",className:"mt-4 space-y-2",children:n.slice(0,15).map((a,l)=>s.jsxs("div",{className:"flex gap-3",children:[s.jsx("div",{className:"mt-1 size-2 shrink-0 rounded-full bg-muted-foreground/40"}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[s.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:Ie(a.timestamp)}),s.jsx("p",{className:"text-xs font-mono text-foreground/80 line-clamp-2",children:a.query})]})]},`${a.session_id}-${l}`))})]})})]}):s.jsxs(ne,{children:[s.jsx(se,{children:s.jsxs(ie,{className:"flex items-center gap-2 text-sm",children:[s.jsx(sn,{className:"size-4"}),"Activity"]})}),s.jsx(Ze,{children:s.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No recent activity"})})]})}function Ju(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Zu=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ed=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,td={};function ii(e,t){return(td.jsx?ed:Zu).test(e)}const nd=/[ \t\n\f\r]/g;function rd(e){return typeof e=="object"?e.type==="text"?ai(e.value):!1:ai(e)}function ai(e){return e.replace(nd,"")===""}class Rn{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Rn.prototype.normal={};Rn.prototype.property={};Rn.prototype.space=void 0;function Ma(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Rn(n,r,t)}function $r(e){return e.toLowerCase()}class Ne{constructor(t,n){this.attribute=n,this.property=t}}Ne.prototype.attribute="";Ne.prototype.booleanish=!1;Ne.prototype.boolean=!1;Ne.prototype.commaOrSpaceSeparated=!1;Ne.prototype.commaSeparated=!1;Ne.prototype.defined=!1;Ne.prototype.mustUseProperty=!1;Ne.prototype.number=!1;Ne.prototype.overloadedBoolean=!1;Ne.prototype.property="";Ne.prototype.spaceSeparated=!1;Ne.prototype.space=void 0;let sd=0;const K=Lt(),ue=Lt(),Vr=Lt(),I=Lt(),re=Lt(),$t=Lt(),Ce=Lt();function Lt(){return 2**++sd}const Qr=Object.freeze(Object.defineProperty({__proto__:null,boolean:K,booleanish:ue,commaOrSpaceSeparated:Ce,commaSeparated:$t,number:I,overloadedBoolean:Vr,spaceSeparated:re},Symbol.toStringTag,{value:"Module"})),pr=Object.keys(Qr);class xs extends Ne{constructor(t,n,r,i){let a=-1;if(super(t,n),li(this,"space",i),typeof r=="number")for(;++a<pr.length;){const l=pr[a];li(this,pr[a],(r&Qr[l])===Qr[l])}}}xs.prototype.defined=!0;function li(e,t,n){n&&(e[t]=n)}function an(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const a=new xs(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[$r(r)]=r,n[$r(a.attribute)]=r}return new Rn(t,n,e.space)}const La=an({properties:{ariaActiveDescendant:null,ariaAtomic:ue,ariaAutoComplete:null,ariaBusy:ue,ariaChecked:ue,ariaColCount:I,ariaColIndex:I,ariaColSpan:I,ariaControls:re,ariaCurrent:null,ariaDescribedBy:re,ariaDetails:null,ariaDisabled:ue,ariaDropEffect:re,ariaErrorMessage:null,ariaExpanded:ue,ariaFlowTo:re,ariaGrabbed:ue,ariaHasPopup:null,ariaHidden:ue,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:re,ariaLevel:I,ariaLive:null,ariaModal:ue,ariaMultiLine:ue,ariaMultiSelectable:ue,ariaOrientation:null,ariaOwns:re,ariaPlaceholder:null,ariaPosInSet:I,ariaPressed:ue,ariaReadOnly:ue,ariaRelevant:null,ariaRequired:ue,ariaRoleDescription:re,ariaRowCount:I,ariaRowIndex:I,ariaRowSpan:I,ariaSelected:ue,ariaSetSize:I,ariaSort:null,ariaValueMax:I,ariaValueMin:I,ariaValueNow:I,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Da(e,t){return t in e?e[t]:t}function Fa(e,t){return Da(e,t.toLowerCase())}const id=an({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:$t,acceptCharset:re,accessKey:re,action:null,allow:null,allowFullScreen:K,allowPaymentRequest:K,allowUserMedia:K,alt:null,as:null,async:K,autoCapitalize:null,autoComplete:re,autoFocus:K,autoPlay:K,blocking:re,capture:null,charSet:null,checked:K,cite:null,className:re,cols:I,colSpan:null,content:null,contentEditable:ue,controls:K,controlsList:re,coords:I|$t,crossOrigin:null,data:null,dateTime:null,decoding:null,default:K,defer:K,dir:null,dirName:null,disabled:K,download:Vr,draggable:ue,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:K,formTarget:null,headers:re,height:I,hidden:Vr,high:I,href:null,hrefLang:null,htmlFor:re,httpEquiv:re,id:null,imageSizes:null,imageSrcSet:null,inert:K,inputMode:null,integrity:null,is:null,isMap:K,itemId:null,itemProp:re,itemRef:re,itemScope:K,itemType:re,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:K,low:I,manifest:null,max:null,maxLength:I,media:null,method:null,min:null,minLength:I,multiple:K,muted:K,name:null,nonce:null,noModule:K,noValidate:K,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:K,optimum:I,pattern:null,ping:re,placeholder:null,playsInline:K,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:K,referrerPolicy:null,rel:re,required:K,reversed:K,rows:I,rowSpan:I,sandbox:re,scope:null,scoped:K,seamless:K,selected:K,shadowRootClonable:K,shadowRootDelegatesFocus:K,shadowRootMode:null,shape:null,size:I,sizes:null,slot:null,span:I,spellCheck:ue,src:null,srcDoc:null,srcLang:null,srcSet:null,start:I,step:null,style:null,tabIndex:I,target:null,title:null,translate:null,type:null,typeMustMatch:K,useMap:null,value:ue,width:I,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:re,axis:null,background:null,bgColor:null,border:I,borderColor:null,bottomMargin:I,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:K,declare:K,event:null,face:null,frame:null,frameBorder:null,hSpace:I,leftMargin:I,link:null,longDesc:null,lowSrc:null,marginHeight:I,marginWidth:I,noResize:K,noHref:K,noShade:K,noWrap:K,object:null,profile:null,prompt:null,rev:null,rightMargin:I,rules:null,scheme:null,scrolling:ue,standby:null,summary:null,text:null,topMargin:I,valueType:null,version:null,vAlign:null,vLink:null,vSpace:I,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:K,disableRemotePlayback:K,prefix:null,property:null,results:I,security:null,unselectable:null},space:"html",transform:Fa}),ad=an({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:Ce,accentHeight:I,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:I,amplitude:I,arabicForm:null,ascent:I,attributeName:null,attributeType:null,azimuth:I,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:I,by:null,calcMode:null,capHeight:I,className:re,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:I,diffuseConstant:I,direction:null,display:null,dur:null,divisor:I,dominantBaseline:null,download:K,dx:null,dy:null,edgeMode:null,editable:null,elevation:I,enableBackground:null,end:null,event:null,exponent:I,externalResourcesRequired:null,fill:null,fillOpacity:I,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:$t,g2:$t,glyphName:$t,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:I,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:I,horizOriginX:I,horizOriginY:I,id:null,ideographic:I,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:I,k:I,k1:I,k2:I,k3:I,k4:I,kernelMatrix:Ce,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:I,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:I,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:I,overlineThickness:I,paintOrder:null,panose1:null,path:null,pathLength:I,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:re,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:I,pointsAtY:I,pointsAtZ:I,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ce,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ce,rev:Ce,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ce,requiredFeatures:Ce,requiredFonts:Ce,requiredFormats:Ce,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:I,specularExponent:I,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:I,strikethroughThickness:I,string:null,stroke:null,strokeDashArray:Ce,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:I,strokeOpacity:I,strokeWidth:null,style:null,surfaceScale:I,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ce,tabIndex:I,tableValues:null,target:null,targetX:I,targetY:I,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ce,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:I,underlineThickness:I,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:I,values:null,vAlphabetic:I,vMathematical:I,vectorEffect:null,vHanging:I,vIdeographic:I,version:null,vertAdvY:I,vertOriginX:I,vertOriginY:I,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:I,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Da}),Ba=an({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()}}),Ua=an({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Fa}),Ha=an({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),ld={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"},od=/[A-Z]/g,oi=/-[a-z]/g,cd=/^data[-\w.:]+$/i;function ud(e,t){const n=$r(t);let r=t,i=Ne;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&cd.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(oi,hd);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!oi.test(a)){let l=a.replace(od,dd);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=xs}return new i(r,t)}function dd(e){return"-"+e.toLowerCase()}function hd(e){return e.charAt(1).toUpperCase()}const fd=Ma([La,id,Ba,Ua,Ha],"html"),gs=Ma([La,ad,Ba,Ua,Ha],"svg");function pd(e){return e.join(" ").trim()}var Ut={},mr,ci;function md(){if(ci)return mr;ci=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,o=/^\s+|\s+$/g,u=`
|
|
2
|
+
`,c="/",d="*",h="",p="comment",f="declaration";function v(C,b){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];b=b||{};var E=1,S=1;function j(M){var _=M.match(t);_&&(E+=_.length);var G=M.lastIndexOf(u);S=~G?M.length-G:S+M.length}function D(){var M={line:E,column:S};return function(_){return _.position=new w(M),F(),_}}function w(M){this.start=M,this.end={line:E,column:S},this.source=b.source}w.prototype.content=C;function R(M){var _=new Error(b.source+":"+E+":"+S+": "+M);if(_.reason=M,_.filename=b.source,_.line=E,_.column=S,_.source=C,!b.silent)throw _}function U(M){var _=M.exec(C);if(_){var G=_[0];return j(G),C=C.slice(G.length),_}}function F(){U(n)}function $(M){var _;for(M=M||[];_=z();)_!==!1&&M.push(_);return M}function z(){var M=D();if(!(c!=C.charAt(0)||d!=C.charAt(1))){for(var _=2;h!=C.charAt(_)&&(d!=C.charAt(_)||c!=C.charAt(_+1));)++_;if(_+=2,h===C.charAt(_-1))return R("End of comment missing");var G=C.slice(2,_-2);return S+=2,j(G),C=C.slice(_),S+=2,M({type:p,comment:G})}}function k(){var M=D(),_=U(r);if(_){if(z(),!U(i))return R("property missing ':'");var G=U(a),le=M({type:f,property:y(_[0].replace(e,h)),value:G?y(G[0].replace(e,h)):h});return U(l),le}}function B(){var M=[];$(M);for(var _;_=k();)_!==!1&&(M.push(_),$(M));return M}return F(),B()}function y(C){return C?C.replace(o,h):h}return mr=v,mr}var ui;function xd(){if(ui)return Ut;ui=1;var e=Ut&&Ut.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.default=n;const t=e(md());function n(r,i){let a=null;if(!r||typeof r!="string")return a;const l=(0,t.default)(r),o=typeof i=="function";return l.forEach(u=>{if(u.type!=="declaration")return;const{property:c,value:d}=u;o?i(c,d,u):d&&(a=a||{},a[c]=d)}),a}return Ut}var hn={},di;function gd(){if(di)return hn;di=1,Object.defineProperty(hn,"__esModule",{value:!0}),hn.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,a=function(c){return!c||n.test(c)||e.test(c)},l=function(c,d){return d.toUpperCase()},o=function(c,d){return"".concat(d,"-")},u=function(c,d){return d===void 0&&(d={}),a(c)?c:(c=c.toLowerCase(),d.reactCompat?c=c.replace(i,o):c=c.replace(r,o),c.replace(t,l))};return hn.camelCase=u,hn}var fn,hi;function bd(){if(hi)return fn;hi=1;var e=fn&&fn.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(xd()),n=gd();function r(i,a){var l={};return!i||typeof i!="string"||(0,t.default)(i,function(o,u){o&&u&&(l[(0,n.camelCase)(o,a)]=u)}),l}return r.default=r,fn=r,fn}var yd=bd();const vd=na(yd),qa=$a("end"),bs=$a("start");function $a(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function jd(e){const t=bs(e),n=qa(e);if(t&&n)return{start:t,end:n}}function vn(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?fi(e.position):"start"in e||"end"in e?fi(e):"line"in e||"column"in e?Kr(e):""}function Kr(e){return pi(e&&e.line)+":"+pi(e&&e.column)}function fi(e){return Kr(e&&e.start)+"-"+Kr(e&&e.end)}function pi(e){return e&&typeof e=="number"?e:1}class ge extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",a={},l=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?i=t:!a.cause&&t&&(l=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?a.ruleId=r:(a.source=r.slice(0,u),a.ruleId=r.slice(u+1))}if(!a.place&&a.ancestors&&a.ancestors){const u=a.ancestors[a.ancestors.length-1];u&&(a.place=u.position)}const o=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=vn(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=l&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ge.prototype.file="";ge.prototype.name="";ge.prototype.reason="";ge.prototype.message="";ge.prototype.stack="";ge.prototype.column=void 0;ge.prototype.line=void 0;ge.prototype.ancestors=void 0;ge.prototype.cause=void 0;ge.prototype.fatal=void 0;ge.prototype.place=void 0;ge.prototype.ruleId=void 0;ge.prototype.source=void 0;const ys={}.hasOwnProperty,wd=new Map,kd=/[A-Z]/g,Nd=new Set(["table","tbody","thead","tfoot","tr"]),Sd=new Set(["td","th"]),Va="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Cd(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Ad(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Rd(n,t.jsx,t.jsxs)}const 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"?gs:fd,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Qa(i,e,void 0);return a&&typeof a!="string"?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Qa(e,t,n){if(t.type==="element")return Ed(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Id(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Td(e,t,n);if(t.type==="mdxjsEsm")return _d(e,t);if(t.type==="root")return zd(e,t,n);if(t.type==="text")return Pd(e,t)}function Ed(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=gs,e.schema=i),e.ancestors.push(t);const a=Ga(e,t.tagName,!1),l=Od(e,t);let o=js(e,t);return Nd.has(t.tagName)&&(o=o.filter(function(u){return typeof u=="string"?!rd(u):!0})),Ka(e,l,a,t),vs(l,o),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function Id(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Cn(e,t.position)}function _d(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Cn(e,t.position)}function Td(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=gs,e.schema=i),e.ancestors.push(t);const a=t.name===null?e.Fragment:Ga(e,t.name,!0),l=Md(e,t),o=js(e,t);return Ka(e,l,a,t),vs(l,o),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function zd(e,t,n){const r={};return vs(r,js(e,t)),e.create(t,e.Fragment,r,n)}function Pd(e,t){return t.value}function Ka(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function vs(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Rd(e,t,n){return r;function r(i,a,l,o){const c=Array.isArray(l.children)?n:t;return o?c(a,l,o):c(a,l)}}function Ad(e,t){return n;function n(r,i,a,l){const o=Array.isArray(a.children),u=bs(r);return t(i,a,l,o,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function Od(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&ys.call(t.properties,i)){const a=Ld(e,i,t.properties[i]);if(a){const[l,o]=a;e.tableCellAlignToStyle&&l==="align"&&typeof o=="string"&&Sd.has(t.tagName)?r=o:n[l]=o}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Md(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const l=a.expression;l.type;const o=l.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else Cn(e,t.position);else{const i=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,a=e.evaluater.evaluateExpression(o.expression)}else Cn(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function js(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:wd;for(;++r<t.children.length;){const a=t.children[r];let l;if(e.passKeys){const u=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(u){const c=i.get(u)||0;l=u+"-"+c,i.set(u,c+1)}}const o=Qa(e,a,l);o!==void 0&&n.push(o)}return n}function Ld(e,t,n){const r=ud(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Ju(n):pd(n)),r.property==="style"){let i=typeof n=="object"?n:Dd(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Fd(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?ld[r.property]||r.property:r.attribute,n]}}function Dd(e,t){try{return vd(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new ge("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Va+"#cannot-parse-style-attribute",i}}function Ga(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let a=-1,l;for(;++a<i.length;){const o=ii(i[a])?{type:"Identifier",name:i[a]}:{type:"Literal",value:i[a]};l=l?{type:"MemberExpression",object:l,property:o,computed:!!(a&&o.type==="Literal"),optional:!1}:o}r=l}else r=ii(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return ys.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Cn(e)}function Cn(e,t){const n=new ge("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=Va+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Fd(e){const t={};let n;for(n in e)ys.call(e,n)&&(t[Bd(n)]=e[n]);return t}function Bd(e){let t=e.replace(kd,Ud);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Ud(e){return"-"+e.toLowerCase()}const xr={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"]},Hd={};function qd(e,t){const n=Hd,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Wa(e,r,i)}function Wa(e,t,n){if($d(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 mi(e.children,t,n)}return Array.isArray(e)?mi(e,t,n):""}function mi(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Wa(e[i],t,n);return r.join("")}function $d(e){return!!(e&&typeof e=="object")}const xi=document.createElement("i");function ws(e){const t="&"+e+";";xi.innerHTML=t;const n=xi.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function $e(e,t,n,r){const i=e.length;let a=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);a<r.length;)l=r.slice(a,a+1e4),l.unshift(t,0),e.splice(...l),a+=1e4,t+=1e4}function ze(e,t){return e.length>0?($e(e,e.length,0,t),e):t}const gi={}.hasOwnProperty;function Vd(e){const t={};let n=-1;for(;++n<e.length;)Qd(t,e[n]);return t}function Qd(e,t){let n;for(n in t){const i=(gi.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let l;if(a)for(l in a){gi.call(i,l)||(i[l]=[]);const o=a[l];Kd(i[l],Array.isArray(o)?o:o?[o]:[])}}}function Kd(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);$e(e,0,0,r)}function Ya(e,t){const 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 Vt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ue=bt(/[A-Za-z]/),Ee=bt(/[\dA-Za-z]/),Gd=bt(/[#-'*+\--9=?A-Z^-~]/);function Gr(e){return e!==null&&(e<32||e===127)}const Wr=bt(/\d/),Wd=bt(/[\dA-Fa-f]/),Yd=bt(/[!-/:-@[-`{-~]/);function V(e){return e!==null&&e<-2}function ke(e){return e!==null&&(e<0||e===32)}function Z(e){return e===-2||e===-1||e===32}const Xd=bt(new RegExp("\\p{P}|\\p{S}","u")),Jd=bt(/\s/);function bt(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ln(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const a=e.charCodeAt(n);let l="";if(a===37&&Ee(e.charCodeAt(n+1))&&Ee(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(l=String.fromCharCode(a));else if(a>55295&&a<57344){const o=e.charCodeAt(n+1);a<56320&&o>56319&&o<57344?(l=String.fromCharCode(a,o),i=1):l="�"}else l=String.fromCharCode(a);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ae(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(u){return Z(u)?(e.enter(n),o(u)):t(u)}function o(u){return Z(u)&&a++<i?(e.consume(u),o):(e.exit(n),t(u))}}const Zd={tokenize:eh};function eh(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ae(e,t,"linePrefix")}function i(o){return e.enter("paragraph"),a(o)}function a(o){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,l(o)}function l(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return V(o)?(e.consume(o),e.exit("chunkText"),a):(e.consume(o),l)}}const th={tokenize:nh},bi={tokenize:rh};function nh(e){const t=this,n=[];let r=0,i,a,l;return o;function o(S){if(r<n.length){const j=n[r];return t.containerState=j[1],e.attempt(j[0].continuation,u,c)(S)}return c(S)}function u(S){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&E();const j=t.events.length;let D=j,w;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){w=t.events[D][1].end;break}b(r);let R=j;for(;R<t.events.length;)t.events[R][1].end={...w},R++;return $e(t.events,D+1,0,t.events.slice(j)),t.events.length=R,c(S)}return o(S)}function c(S){if(r===n.length){if(!i)return p(S);if(i.currentConstruct&&i.currentConstruct.concrete)return v(S);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(bi,d,h)(S)}function d(S){return i&&E(),b(r),p(S)}function h(S){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,v(S)}function p(S){return t.containerState={},e.attempt(bi,f,v)(S)}function f(S){return r++,n.push([t.currentConstruct,t.containerState]),p(S)}function v(S){if(S===null){i&&E(),b(0),e.consume(S);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:a}),y(S)}function y(S){if(S===null){C(e.exit("chunkFlow"),!0),b(0),e.consume(S);return}return V(S)?(e.consume(S),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(S),y)}function C(S,j){const D=t.sliceStream(S);if(j&&D.push(null),S.previous=a,a&&(a.next=S),a=S,i.defineSkip(S.start),i.write(D),t.parser.lazy[S.start.line]){let w=i.events.length;for(;w--;)if(i.events[w][1].start.offset<l&&(!i.events[w][1].end||i.events[w][1].end.offset>l))return;const R=t.events.length;let U=R,F,$;for(;U--;)if(t.events[U][0]==="exit"&&t.events[U][1].type==="chunkFlow"){if(F){$=t.events[U][1].end;break}F=!0}for(b(r),w=R;w<t.events.length;)t.events[w][1].end={...$},w++;$e(t.events,U+1,0,t.events.slice(R)),t.events.length=w}}function b(S){let j=n.length;for(;j-- >S;){const D=n[j];t.containerState=D[1],D[0].exit.call(t,e)}n.length=S}function E(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function rh(e,t,n){return ae(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function yi(e){if(e===null||ke(e)||Jd(e))return 1;if(Xd(e))return 2}function ks(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const Yr={name:"attention",resolveAll:sh,tokenize:ih};function sh(e,t){let n=-1,r,i,a,l,o,u,c,d;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;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},p={...e[n][1].start};vi(h,-u),vi(p,u),l={type:u>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},o={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},a={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...l.start},end:{...o.end}},e[r][1].end={...l.start},e[n][1].start={...o.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=ze(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=ze(c,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",a,t]]),c=ze(c,ks(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=ze(c,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=ze(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,$e(e,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function ih(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=yi(r);let a;return l;function l(u){return a=u,e.enter("attentionSequence"),o(u)}function o(u){if(u===a)return e.consume(u),o;const c=e.exit("attentionSequence"),d=yi(u),h=!d||d===2&&i||n.includes(u),p=!i||i===2&&d||n.includes(r);return c._open=!!(a===42?h:h&&(i||!p)),c._close=!!(a===42?p:p&&(d||!h)),t(u)}}function vi(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const ah={name:"autolink",tokenize:lh};function lh(e,t,n){let r=0;return i;function i(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(f){return Ue(f)?(e.consume(f),l):f===64?n(f):c(f)}function l(f){return f===43||f===45||f===46||Ee(f)?(r=1,o(f)):c(f)}function o(f){return f===58?(e.consume(f),r=0,u):(f===43||f===45||f===46||Ee(f))&&r++<32?(e.consume(f),o):(r=0,c(f))}function u(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||Gr(f)?n(f):(e.consume(f),u)}function c(f){return f===64?(e.consume(f),d):Gd(f)?(e.consume(f),c):n(f)}function d(f){return Ee(f)?h(f):n(f)}function h(f){return f===46?(e.consume(f),r=0,d):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):p(f)}function p(f){if((f===45||Ee(f))&&r++<63){const v=f===45?p:h;return e.consume(f),v}return n(f)}}const sr={partial:!0,tokenize:oh};function oh(e,t,n){return r;function r(a){return Z(a)?ae(e,i,"linePrefix")(a):i(a)}function i(a){return a===null||V(a)?t(a):n(a)}}const Xa={continuation:{tokenize:uh},exit:dh,name:"blockQuote",tokenize:ch};function ch(e,t,n){const r=this;return i;function i(l){if(l===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),a}return n(l)}function a(l){return Z(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function uh(e,t,n){const r=this;return i;function i(l){return Z(l)?ae(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):a(l)}function a(l){return e.attempt(Xa,t,n)(l)}}function dh(e){e.exit("blockQuote")}const Ja={name:"characterEscape",tokenize:hh};function hh(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),i}function i(a){return Yd(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const Za={name:"characterReference",tokenize:fh};function fh(e,t,n){const r=this;let i=0,a,l;return o;function o(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),u}function u(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),a=31,l=Ee,d(h))}function c(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,l=Wd,d):(e.enter("characterReferenceValue"),a=7,l=Wr,d(h))}function d(h){if(h===59&&i){const p=e.exit("characterReferenceValue");return l===Ee&&!ws(r.sliceSerialize(p))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(h)&&i++<a?(e.consume(h),d):n(h)}}const ji={partial:!0,tokenize:mh},wi={concrete:!0,name:"codeFenced",tokenize:ph};function ph(e,t,n){const r=this,i={partial:!0,tokenize:D};let a=0,l=0,o;return u;function u(w){return c(w)}function c(w){const R=r.events[r.events.length-1];return a=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,o=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(w)}function d(w){return w===o?(l++,e.consume(w),d):l<3?n(w):(e.exit("codeFencedFenceSequence"),Z(w)?ae(e,h,"whitespace")(w):h(w))}function h(w){return w===null||V(w)?(e.exit("codeFencedFence"),r.interrupt?t(w):e.check(ji,y,j)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||V(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(w)):Z(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ae(e,f,"whitespace")(w)):w===96&&w===o?n(w):(e.consume(w),p)}function f(w){return w===null||V(w)?h(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(w))}function v(w){return w===null||V(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(w)):w===96&&w===o?n(w):(e.consume(w),v)}function y(w){return e.attempt(i,j,C)(w)}function C(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),b}function b(w){return a>0&&Z(w)?ae(e,E,"linePrefix",a+1)(w):E(w)}function E(w){return w===null||V(w)?e.check(ji,y,j)(w):(e.enter("codeFlowValue"),S(w))}function S(w){return w===null||V(w)?(e.exit("codeFlowValue"),E(w)):(e.consume(w),S)}function j(w){return e.exit("codeFenced"),t(w)}function D(w,R,U){let F=0;return $;function $(_){return w.enter("lineEnding"),w.consume(_),w.exit("lineEnding"),z}function z(_){return w.enter("codeFencedFence"),Z(_)?ae(w,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):k(_)}function k(_){return _===o?(w.enter("codeFencedFenceSequence"),B(_)):U(_)}function B(_){return _===o?(F++,w.consume(_),B):F>=l?(w.exit("codeFencedFenceSequence"),Z(_)?ae(w,M,"whitespace")(_):M(_)):U(_)}function M(_){return _===null||V(_)?(w.exit("codeFencedFence"),R(_)):U(_)}}}function mh(e,t,n){const r=this;return i;function i(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const gr={name:"codeIndented",tokenize:gh},xh={partial:!0,tokenize:bh};function gh(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),ae(e,a,"linePrefix",5)(c)}function a(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?l(c):n(c)}function l(c){return c===null?u(c):V(c)?e.attempt(xh,l,u)(c):(e.enter("codeFlowValue"),o(c))}function o(c){return c===null||V(c)?(e.exit("codeFlowValue"),l(c)):(e.consume(c),o)}function u(c){return e.exit("codeIndented"),t(c)}}function bh(e,t,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):V(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):ae(e,a,"linePrefix",5)(l)}function a(l){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(l):V(l)?i(l):n(l)}}const yh={name:"codeText",previous:jh,resolve:vh,tokenize:wh};function vh(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 jh(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function wh(e,t,n){let r=0,i,a;return l;function l(h){return e.enter("codeText"),e.enter("codeTextSequence"),o(h)}function o(h){return h===96?(e.consume(h),r++,o):(e.exit("codeTextSequence"),u(h))}function u(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),u):h===96?(a=e.enter("codeTextSequence"),i=0,d(h)):V(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),u):(e.enter("codeTextData"),c(h))}function c(h){return h===null||h===32||h===96||V(h)?(e.exit("codeTextData"),u(h)):(e.consume(h),c)}function d(h){return h===96?(e.consume(h),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(a.type="codeTextData",c(h))}}class kh{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&pn(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),pn(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),pn(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);pn(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);pn(this.left,n.reverse())}}}function pn(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 el(e){const t={};let n=-1,r,i,a,l,o,u,c;const d=new kh(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,a=0,a<u.length&&u[a][1].type==="lineEndingBlank"&&(a+=2),a<u.length&&u[a][1].type==="content"))for(;++a<u.length&&u[a][1].type!=="content";)u[a][1].type==="chunkText"&&(u[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Nh(d,n)),n=t[n],c=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(l=d.get(a),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=a);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},o=d.slice(i,n),o.unshift(r),d.splice(i,n-i+1,o))}}return $e(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function Nh(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const a=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const o=l.events,u=[],c={};let d,h,p=-1,f=n,v=0,y=0;const C=[y];for(;f;){for(;e.get(++i)[1]!==f;);a.push(i),f._tokenizer||(d=r.sliceStream(f),f.next||d.push(null),h&&l.defineSkip(f.start),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(d),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),h=f,f=f.next}for(f=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(y=p+1,C.push(y),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(l.events=[],f?(f._tokenizer=void 0,f.previous=void 0):C.pop(),p=C.length;p--;){const b=o.slice(C[p],C[p+1]),E=a.pop();u.push([E,E+b.length-1]),e.splice(E,2,b)}for(u.reverse(),p=-1;++p<u.length;)c[v+u[p][0]]=v+u[p][1],v+=u[p][1]-u[p][0]-1;return c}const Sh={resolve:Eh,tokenize:Ih},Ch={partial:!0,tokenize:_h};function Eh(e){return el(e),e}function Ih(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?a(o):V(o)?e.check(Ch,l,a)(o):(e.consume(o),i)}function a(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function l(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function _h(e,t,n){const r=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),ae(e,a,"linePrefix")}function a(l){if(l===null||V(l))return n(l);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function tl(e,t,n,r,i,a,l,o,u){const c=u||Number.POSITIVE_INFINITY;let d=0;return h;function h(b){return b===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(b),e.exit(a),p):b===null||b===32||b===41||Gr(b)?n(b):(e.enter(r),e.enter(l),e.enter(o),e.enter("chunkString",{contentType:"string"}),y(b))}function p(b){return b===62?(e.enter(a),e.consume(b),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===62?(e.exit("chunkString"),e.exit(o),p(b)):b===null||b===60||V(b)?n(b):(e.consume(b),b===92?v:f)}function v(b){return b===60||b===62||b===92?(e.consume(b),f):f(b)}function y(b){return!d&&(b===null||b===41||ke(b))?(e.exit("chunkString"),e.exit(o),e.exit(l),e.exit(r),t(b)):d<c&&b===40?(e.consume(b),d++,y):b===41?(e.consume(b),d--,y):b===null||b===32||b===40||Gr(b)?n(b):(e.consume(b),b===92?C:y)}function C(b){return b===40||b===41||b===92?(e.consume(b),y):y(b)}}function nl(e,t,n,r,i,a){const l=this;let o=0,u;return c;function c(f){return e.enter(r),e.enter(i),e.consume(f),e.exit(i),e.enter(a),d}function d(f){return o>999||f===null||f===91||f===93&&!u||f===94&&!o&&"_hiddenFootnoteSupport"in l.parser.constructs?n(f):f===93?(e.exit(a),e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):V(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===null||f===91||f===93||V(f)||o++>999?(e.exit("chunkString"),d(f)):(e.consume(f),u||(u=!Z(f)),f===92?p:h)}function p(f){return f===91||f===92||f===93?(e.consume(f),o++,h):h(f)}}function rl(e,t,n,r,i,a){let l;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),l=p===40?41:p,u):n(p)}function u(p){return p===l?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):(e.enter(a),c(p))}function c(p){return p===l?(e.exit(a),u(l)):p===null?n(p):V(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),ae(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===l||p===null||V(p)?(e.exit("chunkString"),c(p)):(e.consume(p),p===92?h:d)}function h(p){return p===l||p===92?(e.consume(p),d):d(p)}}function jn(e,t){let n;return r;function r(i){return V(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Z(i)?ae(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const Th={name:"definition",tokenize:Ph},zh={partial:!0,tokenize:Rh};function Ph(e,t,n){const r=this;let i;return a;function a(f){return e.enter("definition"),l(f)}function l(f){return nl.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function o(f){return i=Vt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),u):n(f)}function u(f){return ke(f)?jn(e,c)(f):c(f)}function c(f){return tl(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function d(f){return e.attempt(zh,h,h)(f)}function h(f){return Z(f)?ae(e,p,"whitespace")(f):p(f)}function p(f){return f===null||V(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function Rh(e,t,n){return r;function r(o){return ke(o)?jn(e,i)(o):n(o)}function i(o){return rl(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function a(o){return Z(o)?ae(e,l,"whitespace")(o):l(o)}function l(o){return o===null||V(o)?t(o):n(o)}}const Ah={name:"hardBreakEscape",tokenize:Oh};function Oh(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return V(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const Mh={name:"headingAtx",resolve:Lh,tokenize:Dh};function Lh(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"},$e(e,r,n-r+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function Dh(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),a(d)}function a(d){return e.enter("atxHeadingSequence"),l(d)}function l(d){return d===35&&r++<6?(e.consume(d),l):d===null||ke(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),u(d)):d===null||V(d)?(e.exit("atxHeading"),t(d)):Z(d)?ae(e,o,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function u(d){return d===35?(e.consume(d),u):(e.exit("atxHeadingSequence"),o(d))}function c(d){return d===null||d===35||ke(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),c)}}const Fh=["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"],ki=["pre","script","style","textarea"],Bh={concrete:!0,name:"htmlFlow",resolveTo:qh,tokenize:$h},Uh={partial:!0,tokenize:Qh},Hh={partial:!0,tokenize:Vh};function qh(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 $h(e,t,n){const r=this;let i,a,l,o,u;return c;function c(x){return d(x)}function d(x){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(x),h}function h(x){return x===33?(e.consume(x),p):x===47?(e.consume(x),a=!0,y):x===63?(e.consume(x),i=3,r.interrupt?t:m):Ue(x)?(e.consume(x),l=String.fromCharCode(x),C):n(x)}function p(x){return x===45?(e.consume(x),i=2,f):x===91?(e.consume(x),i=5,o=0,v):Ue(x)?(e.consume(x),i=4,r.interrupt?t:m):n(x)}function f(x){return x===45?(e.consume(x),r.interrupt?t:m):n(x)}function v(x){const Pe="CDATA[";return x===Pe.charCodeAt(o++)?(e.consume(x),o===Pe.length?r.interrupt?t:k:v):n(x)}function y(x){return Ue(x)?(e.consume(x),l=String.fromCharCode(x),C):n(x)}function C(x){if(x===null||x===47||x===62||ke(x)){const Pe=x===47,yt=l.toLowerCase();return!Pe&&!a&&ki.includes(yt)?(i=1,r.interrupt?t(x):k(x)):Fh.includes(l.toLowerCase())?(i=6,Pe?(e.consume(x),b):r.interrupt?t(x):k(x)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(x):a?E(x):S(x))}return x===45||Ee(x)?(e.consume(x),l+=String.fromCharCode(x),C):n(x)}function b(x){return x===62?(e.consume(x),r.interrupt?t:k):n(x)}function E(x){return Z(x)?(e.consume(x),E):$(x)}function S(x){return x===47?(e.consume(x),$):x===58||x===95||Ue(x)?(e.consume(x),j):Z(x)?(e.consume(x),S):$(x)}function j(x){return x===45||x===46||x===58||x===95||Ee(x)?(e.consume(x),j):D(x)}function D(x){return x===61?(e.consume(x),w):Z(x)?(e.consume(x),D):S(x)}function w(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),u=x,R):Z(x)?(e.consume(x),w):U(x)}function R(x){return x===u?(e.consume(x),u=null,F):x===null||V(x)?n(x):(e.consume(x),R)}function U(x){return x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||ke(x)?D(x):(e.consume(x),U)}function F(x){return x===47||x===62||Z(x)?S(x):n(x)}function $(x){return x===62?(e.consume(x),z):n(x)}function z(x){return x===null||V(x)?k(x):Z(x)?(e.consume(x),z):n(x)}function k(x){return x===45&&i===2?(e.consume(x),G):x===60&&i===1?(e.consume(x),le):x===62&&i===4?(e.consume(x),me):x===63&&i===3?(e.consume(x),m):x===93&&i===5?(e.consume(x),W):V(x)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Uh,Ve,B)(x)):x===null||V(x)?(e.exit("htmlFlowData"),B(x)):(e.consume(x),k)}function B(x){return e.check(Hh,M,Ve)(x)}function M(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),_}function _(x){return x===null||V(x)?B(x):(e.enter("htmlFlowData"),k(x))}function G(x){return x===45?(e.consume(x),m):k(x)}function le(x){return x===47?(e.consume(x),l="",A):k(x)}function A(x){if(x===62){const Pe=l.toLowerCase();return ki.includes(Pe)?(e.consume(x),me):k(x)}return Ue(x)&&l.length<8?(e.consume(x),l+=String.fromCharCode(x),A):k(x)}function W(x){return x===93?(e.consume(x),m):k(x)}function m(x){return x===62?(e.consume(x),me):x===45&&i===2?(e.consume(x),m):k(x)}function me(x){return x===null||V(x)?(e.exit("htmlFlowData"),Ve(x)):(e.consume(x),me)}function Ve(x){return e.exit("htmlFlow"),t(x)}}function Vh(e,t,n){const r=this;return i;function i(l){return V(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):n(l)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function Qh(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(sr,t,n)}}const Kh={name:"htmlText",tokenize:Gh};function Gh(e,t,n){const r=this;let i,a,l;return o;function o(m){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(m),u}function u(m){return m===33?(e.consume(m),c):m===47?(e.consume(m),D):m===63?(e.consume(m),S):Ue(m)?(e.consume(m),U):n(m)}function c(m){return m===45?(e.consume(m),d):m===91?(e.consume(m),a=0,v):Ue(m)?(e.consume(m),E):n(m)}function d(m){return m===45?(e.consume(m),f):n(m)}function h(m){return m===null?n(m):m===45?(e.consume(m),p):V(m)?(l=h,le(m)):(e.consume(m),h)}function p(m){return m===45?(e.consume(m),f):h(m)}function f(m){return m===62?G(m):m===45?p(m):h(m)}function v(m){const me="CDATA[";return m===me.charCodeAt(a++)?(e.consume(m),a===me.length?y:v):n(m)}function y(m){return m===null?n(m):m===93?(e.consume(m),C):V(m)?(l=y,le(m)):(e.consume(m),y)}function C(m){return m===93?(e.consume(m),b):y(m)}function b(m){return m===62?G(m):m===93?(e.consume(m),b):y(m)}function E(m){return m===null||m===62?G(m):V(m)?(l=E,le(m)):(e.consume(m),E)}function S(m){return m===null?n(m):m===63?(e.consume(m),j):V(m)?(l=S,le(m)):(e.consume(m),S)}function j(m){return m===62?G(m):S(m)}function D(m){return Ue(m)?(e.consume(m),w):n(m)}function w(m){return m===45||Ee(m)?(e.consume(m),w):R(m)}function R(m){return V(m)?(l=R,le(m)):Z(m)?(e.consume(m),R):G(m)}function U(m){return m===45||Ee(m)?(e.consume(m),U):m===47||m===62||ke(m)?F(m):n(m)}function F(m){return m===47?(e.consume(m),G):m===58||m===95||Ue(m)?(e.consume(m),$):V(m)?(l=F,le(m)):Z(m)?(e.consume(m),F):G(m)}function $(m){return m===45||m===46||m===58||m===95||Ee(m)?(e.consume(m),$):z(m)}function z(m){return m===61?(e.consume(m),k):V(m)?(l=z,le(m)):Z(m)?(e.consume(m),z):F(m)}function k(m){return m===null||m===60||m===61||m===62||m===96?n(m):m===34||m===39?(e.consume(m),i=m,B):V(m)?(l=k,le(m)):Z(m)?(e.consume(m),k):(e.consume(m),M)}function B(m){return m===i?(e.consume(m),i=void 0,_):m===null?n(m):V(m)?(l=B,le(m)):(e.consume(m),B)}function M(m){return m===null||m===34||m===39||m===60||m===61||m===96?n(m):m===47||m===62||ke(m)?F(m):(e.consume(m),M)}function _(m){return m===47||m===62||ke(m)?F(m):n(m)}function G(m){return m===62?(e.consume(m),e.exit("htmlTextData"),e.exit("htmlText"),t):n(m)}function le(m){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),A}function A(m){return Z(m)?ae(e,W,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):W(m)}function W(m){return e.enter("htmlTextData"),l(m)}}const Ns={name:"labelEnd",resolveAll:Jh,resolveTo:Zh,tokenize:ef},Wh={tokenize:tf},Yh={tokenize:nf},Xh={tokenize:rf};function Jh(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&$e(e,0,e.length,n),e}function Zh(e,t){let n=e.length,r=0,i,a,l,o;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(l){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"&&(l=n);const u={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[a][1].start},end:{...e[l][1].end}},d={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[l-2][1].start}};return o=[["enter",u,t],["enter",c,t]],o=ze(o,e.slice(a+1,a+r+3)),o=ze(o,[["enter",d,t]]),o=ze(o,ks(t.parser.constructs.insideSpan.null,e.slice(a+r+4,l-3),t)),o=ze(o,[["exit",d,t],e[l-2],e[l-1],["exit",c,t]]),o=ze(o,e.slice(l+1)),o=ze(o,[["exit",u,t]]),$e(e,a,e.length,o),e}function ef(e,t,n){const r=this;let i=r.events.length,a,l;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 o;function o(p){return a?a._inactive?h(p):(l=r.parser.defined.includes(Vt(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),u):n(p)}function u(p){return p===40?e.attempt(Wh,d,l?d:h)(p):p===91?e.attempt(Yh,d,l?c:h)(p):l?d(p):h(p)}function c(p){return e.attempt(Xh,d,h)(p)}function d(p){return t(p)}function h(p){return a._balanced=!0,n(p)}}function tf(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return ke(h)?jn(e,a)(h):a(h)}function a(h){return h===41?d(h):tl(e,l,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function l(h){return ke(h)?jn(e,u)(h):d(h)}function o(h){return n(h)}function u(h){return h===34||h===39||h===40?rl(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function c(h){return ke(h)?jn(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function nf(e,t,n){const r=this;return i;function i(o){return nl.call(r,e,a,l,"reference","referenceMarker","referenceString")(o)}function a(o){return r.parser.defined.includes(Vt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function l(o){return n(o)}}function rf(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),i}function i(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const sf={name:"labelStartImage",resolveAll:Ns.resolveAll,tokenize:af};function af(e,t,n){const r=this;return i;function i(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),a}function a(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),l):n(o)}function l(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const lf={name:"labelStartLink",resolveAll:Ns.resolveAll,tokenize:of};function of(e,t,n){const r=this;return i;function i(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),a}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const br={name:"lineEnding",tokenize:cf};function cf(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ae(e,t,"linePrefix")}}const Hn={name:"thematicBreak",tokenize:uf};function uf(e,t,n){let r=0,i;return a;function a(c){return e.enter("thematicBreak"),l(c)}function l(c){return i=c,o(c)}function o(c){return c===i?(e.enter("thematicBreakSequence"),u(c)):r>=3&&(c===null||V(c))?(e.exit("thematicBreak"),t(c)):n(c)}function u(c){return c===i?(e.consume(c),r++,u):(e.exit("thematicBreakSequence"),Z(c)?ae(e,o,"whitespace")(c):o(c))}}const ve={continuation:{tokenize:pf},exit:xf,name:"list",tokenize:ff},df={partial:!0,tokenize:gf},hf={partial:!0,tokenize:mf};function ff(e,t,n){const r=this,i=r.events[r.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return o;function o(f){const v=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:Wr(f)){if(r.containerState.type||(r.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Hn,n,c)(f):c(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(f)}return n(f)}function u(f){return Wr(f)&&++l<10?(e.consume(f),u):(!r.interrupt||l<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),c(f)):n(f)}function c(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(sr,r.interrupt?n:d,e.attempt(df,p,h))}function d(f){return r.containerState.initialBlankLine=!0,a++,p(f)}function h(f){return Z(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function pf(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(sr,i,a);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ae(e,t,"listItemIndent",r.containerState.size+1)(o)}function a(o){return r.containerState.furtherBlankLines||!Z(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(hf,t,l)(o))}function l(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,ae(e,e.attempt(ve,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function mf(e,t,n){const r=this;return ae(e,i,"listItemIndent",r.containerState.size+1);function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(a):n(a)}}function xf(e){e.exit(this.containerState.type)}function gf(e,t,n){const r=this;return ae(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){const l=r.events[r.events.length-1];return!Z(a)&&l&&l[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const Ni={name:"setextUnderline",resolveTo:bf,tokenize:yf};function bf(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);const l={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",l,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function yf(e,t,n){const r=this;let i;return a;function a(c){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),i=c,l(c)):n(c)}function l(c){return e.enter("setextHeadingLineSequence"),o(c)}function o(c){return c===i?(e.consume(c),o):(e.exit("setextHeadingLineSequence"),Z(c)?ae(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||V(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const vf={tokenize:jf};function jf(e){const t=this,n=e.attempt(sr,r,e.attempt(this.parser.constructs.flowInitial,i,ae(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Sh,i)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const wf={resolveAll:il()},kf=sl("string"),Nf=sl("text");function sl(e){return{resolveAll:il(e==="text"?Sf:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],a=n.attempt(i,l,o);return l;function l(d){return c(d)?a(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),u}function u(d){return c(d)?(n.exit("data"),a(d)):(n.consume(d),u)}function c(d){if(d===null)return!0;const h=i[d];let p=-1;if(h)for(;++p<h.length;){const f=h[p];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function il(e){return t;function t(n,r){let i=-1,a;for(;++i<=n.length;)a===void 0?n[i]&&n[i][1].type==="data"&&(a=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==a+2&&(n[a][1].end=n[i-1][1].end,n.splice(a+2,i-a-2),i=a+2),a=void 0);return e?e(n,r):n}}function Sf(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let a=i.length,l=-1,o=0,u;for(;a--;){const c=i[a];if(typeof c=="string"){for(l=c.length;c.charCodeAt(l-1)===32;)o++,l--;if(l)break;l=-1}else if(c===-2)u=!0,o++;else if(c!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const c={type:n===e.length||u||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?l:r.start._bufferIndex+l,_index:r.start._index+a,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const Cf={42:ve,43:ve,45:ve,48:ve,49:ve,50:ve,51:ve,52:ve,53:ve,54:ve,55:ve,56:ve,57:ve,62:Xa},Ef={91:Th},If={[-2]:gr,[-1]:gr,32:gr},_f={35:Mh,42:Hn,45:[Ni,Hn],60:Bh,61:Ni,95:Hn,96:wi,126:wi},Tf={38:Za,92:Ja},zf={[-5]:br,[-4]:br,[-3]:br,33:sf,38:Za,42:Yr,60:[ah,Kh],91:lf,92:[Ah,Ja],93:Ns,95:Yr,96:yh},Pf={null:[Yr,wf]},Rf={null:[42,95]},Af={null:[]},Of=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Rf,contentInitial:Ef,disable:Af,document:Cf,flow:_f,flowInitial:If,insideSpan:Pf,string:Tf,text:zf},Symbol.toStringTag,{value:"Module"}));function Mf(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},a=[];let l=[],o=[];const u={attempt:R(D),check:R(w),consume:E,enter:S,exit:j,interrupt:R(w,{interrupt:!0})},c={code:null,containerState:{},defineSkip:y,events:[],now:v,parser:e,previous:null,sliceSerialize:p,sliceStream:f,write:h};let d=t.tokenize.call(c,u);return t.resolveAll&&a.push(t),c;function h(z){return l=ze(l,z),C(),l[l.length-1]!==null?[]:(U(t,0),c.events=ks(a,c.events,c),c.events)}function p(z,k){return Df(f(z),k)}function f(z){return Lf(l,z)}function v(){const{_bufferIndex:z,_index:k,line:B,column:M,offset:_}=r;return{_bufferIndex:z,_index:k,line:B,column:M,offset:_}}function y(z){i[z.line]=z.column,$()}function C(){let z;for(;r._index<l.length;){const k=l[r._index];if(typeof k=="string")for(z=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===z&&r._bufferIndex<k.length;)b(k.charCodeAt(r._bufferIndex));else b(k)}}function b(z){d=d(z)}function E(z){V(z)?(r.line++,r.column=1,r.offset+=z===-3?2:1,$()):z!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=z}function S(z,k){const B=k||{};return B.type=z,B.start=v(),c.events.push(["enter",B,c]),o.push(B),B}function j(z){const k=o.pop();return k.end=v(),c.events.push(["exit",k,c]),k}function D(z,k){U(z,k.from)}function w(z,k){k.restore()}function R(z,k){return B;function B(M,_,G){let le,A,W,m;return Array.isArray(M)?Ve(M):"tokenize"in M?Ve([M]):me(M);function me(fe){return on;function on(et){const Dt=et!==null&&fe[et],Ft=et!==null&&fe.null,On=[...Array.isArray(Dt)?Dt:Dt?[Dt]:[],...Array.isArray(Ft)?Ft:Ft?[Ft]:[]];return Ve(On)(et)}}function Ve(fe){return le=fe,A=0,fe.length===0?G:x(fe[A])}function x(fe){return on;function on(et){return m=F(),W=fe,fe.partial||(c.currentConstruct=fe),fe.name&&c.parser.constructs.disable.null.includes(fe.name)?yt():fe.tokenize.call(k?Object.assign(Object.create(c),k):c,u,Pe,yt)(et)}}function Pe(fe){return z(W,m),_}function yt(fe){return m.restore(),++A<le.length?x(le[A]):G}}}function U(z,k){z.resolveAll&&!a.includes(z)&&a.push(z),z.resolve&&$e(c.events,k,c.events.length-k,z.resolve(c.events.slice(k),c)),z.resolveTo&&(c.events=z.resolveTo(c.events,c))}function F(){const z=v(),k=c.previous,B=c.currentConstruct,M=c.events.length,_=Array.from(o);return{from:M,restore:G};function G(){r=z,c.previous=k,c.currentConstruct=B,c.events.length=M,o=_,$()}}function $(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Lf(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex;let l;if(n===i)l=[e[n].slice(r,a)];else{if(l=e.slice(n,i),r>-1){const o=l[0];typeof o=="string"?l[0]=o.slice(r):l.shift()}a>0&&l.push(e[i].slice(0,a))}return l}function Df(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const a=e[n];let l;if(typeof a=="string")l=a;else switch(a){case-5:{l="\r";break}case-4:{l=`
|
|
3
|
+
`;break}case-3:{l=`\r
|
|
4
|
+
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&i)continue;l=" ";break}default:l=String.fromCharCode(a)}i=a===-2,r.push(l)}return r.join("")}function Ff(e){const r={constructs:Vd([Of,...(e||{}).extensions||[]]),content:i(Zd),defined:[],document:i(th),flow:i(vf),lazy:{},string:i(kf),text:i(Nf)};return r;function i(a){return l;function l(o){return Mf(r,a,o)}}}function Bf(e){for(;!el(e););return e}const Si=/[\0\t\n\r]/g;function Uf(){let e=1,t="",n=!0,r;return i;function i(a,l,o){const u=[];let c,d,h,p,f;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),h=0,t="",n&&(a.charCodeAt(0)===65279&&h++,n=void 0);h<a.length;){if(Si.lastIndex=h,c=Si.exec(a),p=c&&c.index!==void 0?c.index:a.length,f=a.charCodeAt(p),!c){t=a.slice(h);break}if(f===10&&h===p&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),h<p&&(u.push(a.slice(h,p)),e+=p-h),f){case 0:{u.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,u.push(-2);e++<d;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}h=p+1}return o&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const Hf=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function qf(e){return e.replace(Hf,$f)}function $f(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),a=i===120||i===88;return Ya(n.slice(a?2:1),a?16:10)}return ws(n)||e}const al={}.hasOwnProperty;function Vf(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),Qf(n)(Bf(Ff(n).document().write(Uf()(e,t,!0))))}function Qf(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Rs),autolinkProtocol:F,autolinkEmail:F,atxHeading:a(Ts),blockQuote:a(Ft),characterEscape:F,characterReference:F,codeFenced:a(On),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:a(On,l),codeText:a(yl,l),codeTextData:F,data:F,codeFlowValue:F,definition:a(vl),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:a(jl),hardBreakEscape:a(zs),hardBreakTrailing:a(zs),htmlFlow:a(Ps,l),htmlFlowData:F,htmlText:a(Ps,l),htmlTextData:F,image:a(wl),label:l,link:a(Rs),listItem:a(kl),listItemValue:p,listOrdered:a(As,h),listUnordered:a(As),paragraph:a(Nl),reference:x,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:a(Ts),strong:a(Sl),thematicBreak:a(El)},exit:{atxHeading:u(),atxHeadingSequence:D,autolink:u(),autolinkEmail:Dt,autolinkProtocol:et,blockQuote:u(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:yt,characterReferenceMarkerNumeric:yt,characterReferenceValue:fe,characterReference:on,codeFenced:u(C),codeFencedFence:y,codeFencedFenceInfo:f,codeFencedFenceMeta:v,codeFlowValue:$,codeIndented:u(b),codeText:u(_),codeTextData:$,data:$,definition:u(),definitionDestinationString:j,definitionLabelString:E,definitionTitleString:S,emphasis:u(),hardBreakEscape:u(k),hardBreakTrailing:u(k),htmlFlow:u(B),htmlFlowData:$,htmlText:u(M),htmlTextData:$,image:u(le),label:W,labelText:A,lineEnding:z,link:u(G),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:Pe,resourceDestinationString:m,resourceTitleString:me,resource:Ve,setextHeading:u(U),setextHeadingLineSequence:R,setextHeadingText:w,strong:u(),thematicBreak:u()}};ll(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(N){let T={type:"root",children:[]};const Q={stack:[T],tokenStack:[],config:t,enter:o,exit:c,buffer:l,resume:d,data:n},Y=[];let te=-1;for(;++te<N.length;)if(N[te][1].type==="listOrdered"||N[te][1].type==="listUnordered")if(N[te][0]==="enter")Y.push(te);else{const Re=Y.pop();te=i(N,Re,te)}for(te=-1;++te<N.length;){const Re=t[N[te][0]];al.call(Re,N[te][1].type)&&Re[N[te][1].type].call(Object.assign({sliceSerialize:N[te][2].sliceSerialize},Q),N[te][1])}if(Q.tokenStack.length>0){const Re=Q.tokenStack[Q.tokenStack.length-1];(Re[1]||Ci).call(Q,void 0,Re[0])}for(T.position={start:tt(N.length>0?N[0][1].start:{line:1,column:1,offset:0}),end:tt(N.length>0?N[N.length-2][1].end:{line:1,column:1,offset:0})},te=-1;++te<t.transforms.length;)T=t.transforms[te](T)||T;return T}function i(N,T,Q){let Y=T-1,te=-1,Re=!1,vt,Qe,cn,un;for(;++Y<=Q;){const Se=N[Y];switch(Se[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Se[0]==="enter"?te++:te--,un=void 0;break}case"lineEndingBlank":{Se[0]==="enter"&&(vt&&!un&&!te&&!cn&&(cn=Y),un=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:un=void 0}if(!te&&Se[0]==="enter"&&Se[1].type==="listItemPrefix"||te===-1&&Se[0]==="exit"&&(Se[1].type==="listUnordered"||Se[1].type==="listOrdered")){if(vt){let Bt=Y;for(Qe=void 0;Bt--;){const Ke=N[Bt];if(Ke[1].type==="lineEnding"||Ke[1].type==="lineEndingBlank"){if(Ke[0]==="exit")continue;Qe&&(N[Qe][1].type="lineEndingBlank",Re=!0),Ke[1].type="lineEnding",Qe=Bt}else if(!(Ke[1].type==="linePrefix"||Ke[1].type==="blockQuotePrefix"||Ke[1].type==="blockQuotePrefixWhitespace"||Ke[1].type==="blockQuoteMarker"||Ke[1].type==="listItemIndent"))break}cn&&(!Qe||cn<Qe)&&(vt._spread=!0),vt.end=Object.assign({},Qe?N[Qe][1].start:Se[1].end),N.splice(Qe||Y,0,["exit",vt,Se[2]]),Y++,Q++}if(Se[1].type==="listItemPrefix"){const Bt={type:"listItem",_spread:!1,start:Object.assign({},Se[1].start),end:void 0};vt=Bt,N.splice(Y,0,["enter",Bt,Se[2]]),Y++,Q++,cn=void 0,un=!0}}}return N[T][1]._spread=Re,Q}function a(N,T){return Q;function Q(Y){o.call(this,N(Y),Y),T&&T.call(this,Y)}}function l(){this.stack.push({type:"fragment",children:[]})}function o(N,T,Q){this.stack[this.stack.length-1].children.push(N),this.stack.push(N),this.tokenStack.push([T,Q||void 0]),N.position={start:tt(T.start),end:void 0}}function u(N){return T;function T(Q){N&&N.call(this,Q),c.call(this,Q)}}function c(N,T){const Q=this.stack.pop(),Y=this.tokenStack.pop();if(Y)Y[0].type!==N.type&&(T?T.call(this,N,Y[0]):(Y[1]||Ci).call(this,N,Y[0]));else throw new Error("Cannot close `"+N.type+"` ("+vn({start:N.start,end:N.end})+"): it’s not open");Q.position.end=tt(N.end)}function d(){return qd(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(N){if(this.data.expectingFirstListItemValue){const T=this.stack[this.stack.length-2];T.start=Number.parseInt(this.sliceSerialize(N),10),this.data.expectingFirstListItemValue=void 0}}function f(){const N=this.resume(),T=this.stack[this.stack.length-1];T.lang=N}function v(){const N=this.resume(),T=this.stack[this.stack.length-1];T.meta=N}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const N=this.resume(),T=this.stack[this.stack.length-1];T.value=N.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const N=this.resume(),T=this.stack[this.stack.length-1];T.value=N.replace(/(\r?\n|\r)$/g,"")}function E(N){const T=this.resume(),Q=this.stack[this.stack.length-1];Q.label=T,Q.identifier=Vt(this.sliceSerialize(N)).toLowerCase()}function S(){const N=this.resume(),T=this.stack[this.stack.length-1];T.title=N}function j(){const N=this.resume(),T=this.stack[this.stack.length-1];T.url=N}function D(N){const T=this.stack[this.stack.length-1];if(!T.depth){const Q=this.sliceSerialize(N).length;T.depth=Q}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function R(N){const T=this.stack[this.stack.length-1];T.depth=this.sliceSerialize(N).codePointAt(0)===61?1:2}function U(){this.data.setextHeadingSlurpLineEnding=void 0}function F(N){const Q=this.stack[this.stack.length-1].children;let Y=Q[Q.length-1];(!Y||Y.type!=="text")&&(Y=Cl(),Y.position={start:tt(N.start),end:void 0},Q.push(Y)),this.stack.push(Y)}function $(N){const T=this.stack.pop();T.value+=this.sliceSerialize(N),T.position.end=tt(N.end)}function z(N){const T=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Q=T.children[T.children.length-1];Q.position.end=tt(N.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(T.type)&&(F.call(this,N),$.call(this,N))}function k(){this.data.atHardBreak=!0}function B(){const N=this.resume(),T=this.stack[this.stack.length-1];T.value=N}function M(){const N=this.resume(),T=this.stack[this.stack.length-1];T.value=N}function _(){const N=this.resume(),T=this.stack[this.stack.length-1];T.value=N}function G(){const N=this.stack[this.stack.length-1];if(this.data.inReference){const T=this.data.referenceType||"shortcut";N.type+="Reference",N.referenceType=T,delete N.url,delete N.title}else delete N.identifier,delete N.label;this.data.referenceType=void 0}function le(){const N=this.stack[this.stack.length-1];if(this.data.inReference){const T=this.data.referenceType||"shortcut";N.type+="Reference",N.referenceType=T,delete N.url,delete N.title}else delete N.identifier,delete N.label;this.data.referenceType=void 0}function A(N){const T=this.sliceSerialize(N),Q=this.stack[this.stack.length-2];Q.label=qf(T),Q.identifier=Vt(T).toLowerCase()}function W(){const N=this.stack[this.stack.length-1],T=this.resume(),Q=this.stack[this.stack.length-1];if(this.data.inReference=!0,Q.type==="link"){const Y=N.children;Q.children=Y}else Q.alt=T}function m(){const N=this.resume(),T=this.stack[this.stack.length-1];T.url=N}function me(){const N=this.resume(),T=this.stack[this.stack.length-1];T.title=N}function Ve(){this.data.inReference=void 0}function x(){this.data.referenceType="collapsed"}function Pe(N){const T=this.resume(),Q=this.stack[this.stack.length-1];Q.label=T,Q.identifier=Vt(this.sliceSerialize(N)).toLowerCase(),this.data.referenceType="full"}function yt(N){this.data.characterReferenceType=N.type}function fe(N){const T=this.sliceSerialize(N),Q=this.data.characterReferenceType;let Y;Q?(Y=Ya(T,Q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Y=ws(T);const te=this.stack[this.stack.length-1];te.value+=Y}function on(N){const T=this.stack.pop();T.position.end=tt(N.end)}function et(N){$.call(this,N);const T=this.stack[this.stack.length-1];T.url=this.sliceSerialize(N)}function Dt(N){$.call(this,N);const T=this.stack[this.stack.length-1];T.url="mailto:"+this.sliceSerialize(N)}function Ft(){return{type:"blockquote",children:[]}}function On(){return{type:"code",lang:null,meta:null,value:""}}function yl(){return{type:"inlineCode",value:""}}function vl(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function jl(){return{type:"emphasis",children:[]}}function Ts(){return{type:"heading",depth:0,children:[]}}function zs(){return{type:"break"}}function Ps(){return{type:"html",value:""}}function wl(){return{type:"image",title:null,url:"",alt:null}}function Rs(){return{type:"link",title:null,url:"",children:[]}}function As(N){return{type:"list",ordered:N.type==="listOrdered",start:null,spread:N._spread,children:[]}}function kl(N){return{type:"listItem",spread:N._spread,checked:null,children:[]}}function Nl(){return{type:"paragraph",children:[]}}function Sl(){return{type:"strong",children:[]}}function Cl(){return{type:"text",value:""}}function El(){return{type:"thematicBreak"}}}function tt(e){return{line:e.line,column:e.column,offset:e.offset}}function ll(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?ll(e,r):Kf(e,r)}}function Kf(e,t){let n;for(n in t)if(al.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Ci(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+vn({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+vn({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+vn({start:t.start,end:t.end})+") is still open")}function Gf(e){const t=this;t.parser=n;function n(r){return Vf(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Wf(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Yf(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
5
|
+
`}]}function Xf(e,t){const 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 Jf(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Zf(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ep(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=ln(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);let l,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=a+1,o+=1,e.footnoteCounts.set(r,o);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,u);const c={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,c),e.applyData(t,c)}function tp(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function np(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function ol(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),a=i[0];a&&a.type==="text"?a.value="["+a.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=r:i.push({type:"text",value:r}),i}function rp(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ol(e,t);const i={src:ln(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function sp(e,t){const n={src:ln(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function ip(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function ap(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ol(e,t);const i={href:ln(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function lp(e,t){const n={href:ln(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function op(e,t,n){const r=e.all(t),i=n?cp(n):cl(t),a={},l=[];if(typeof t.checked=="boolean"){const d=r[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let o=-1;for(;++o<r.length;){const d=r[o];(i||o!==0||d.type!=="element"||d.tagName!=="p")&&l.push({type:"text",value:`
|
|
7
|
+
`}),d.type==="element"&&d.tagName==="p"&&!i?l.push(...d.children):l.push(d)}const u=r[r.length-1];u&&(i||u.type!=="element"||u.tagName!=="p")&&l.push({type:"text",value:`
|
|
8
|
+
`});const c={type:"element",tagName:"li",properties:a,children:l};return e.patch(t,c),e.applyData(t,c)}function cp(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=cl(n[r])}return t}function cl(e){const t=e.spread;return t??e.children.length>1}function up(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const l=r[i];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const 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 dp(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hp(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function fp(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pp(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),i.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=bs(t.children[1]),u=qa(t.children[t.children.length-1]);o&&u&&(l.position={start:o,end:u}),i.push(l)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function mp(e,t,n){const r=n?n.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,o=l?l.length:t.children.length;let u=-1;const c=[];for(;++u<o;){const h=t.children[u],p={},f=l?l[u]:void 0;f&&(p.align=f);let v={type:"element",tagName:a,properties:p,children:[]};h&&(v.children=e.all(h),e.patch(h,v),v=e.applyData(h,v)),c.push(v)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,d),e.applyData(t,d)}function xp(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Ei=9,Ii=32;function gp(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const a=[];for(;r;)a.push(_i(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(_i(t.slice(i),i>0,!1)),a.join("")}function _i(e,t,n){let r=0,i=e.length;if(t){let a=e.codePointAt(r);for(;a===Ei||a===Ii;)r++,a=e.codePointAt(r)}if(n){let a=e.codePointAt(i-1);for(;a===Ei||a===Ii;)i--,a=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function bp(e,t){const n={type:"text",value:gp(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function yp(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const vp={blockquote:Wf,break:Yf,code:Xf,delete:Jf,emphasis:Zf,footnoteReference:ep,heading:tp,html:np,imageReference:rp,image:sp,inlineCode:ip,linkReference:ap,link:lp,listItem:op,list:up,paragraph:dp,root:hp,strong:fp,table:pp,tableCell:xp,tableRow:mp,text:bp,thematicBreak:yp,toml:Fn,yaml:Fn,definition:Fn,footnoteDefinition:Fn};function Fn(){}const ul=-1,ir=0,wn=1,Qn=2,Ss=3,Cs=4,Es=5,Is=6,dl=7,hl=8,Ti=typeof self=="object"?self:globalThis,jp=(e,t)=>{const n=(i,a)=>(e.set(a,i),i),r=i=>{if(e.has(i))return e.get(i);const[a,l]=t[i];switch(a){case ir:case ul:return n(l,i);case wn:{const o=n([],i);for(const u of l)o.push(r(u));return o}case Qn:{const o=n({},i);for(const[u,c]of l)o[r(u)]=r(c);return o}case Ss:return n(new Date(l),i);case Cs:{const{source:o,flags:u}=l;return n(new RegExp(o,u),i)}case Es:{const o=n(new Map,i);for(const[u,c]of l)o.set(r(u),r(c));return o}case Is:{const o=n(new Set,i);for(const u of l)o.add(r(u));return o}case dl:{const{name:o,message:u}=l;return n(new Ti[o](u),i)}case hl:return n(BigInt(l),i);case"BigInt":return n(Object(BigInt(l)),i);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:o}=new Uint8Array(l);return n(new DataView(o),l)}}return n(new Ti[a](l),i)};return r},zi=e=>jp(new Map,e)(0),Ht="",{toString:wp}={},{keys:kp}=Object,mn=e=>{const t=typeof e;if(t!=="object"||!e)return[ir,t];const n=wp.call(e).slice(8,-1);switch(n){case"Array":return[wn,Ht];case"Object":return[Qn,Ht];case"Date":return[Ss,Ht];case"RegExp":return[Cs,Ht];case"Map":return[Es,Ht];case"Set":return[Is,Ht];case"DataView":return[wn,n]}return n.includes("Array")?[wn,n]:n.includes("Error")?[dl,n]:[Qn,n]},Bn=([e,t])=>e===ir&&(t==="function"||t==="symbol"),Np=(e,t,n,r)=>{const i=(l,o)=>{const u=r.push(l)-1;return n.set(o,u),u},a=l=>{if(n.has(l))return n.get(l);let[o,u]=mn(l);switch(o){case ir:{let d=l;switch(u){case"bigint":o=hl,d=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);d=null;break;case"undefined":return i([ul],l)}return i([o,d],l)}case wn:{if(u){let p=l;return u==="DataView"?p=new Uint8Array(l.buffer):u==="ArrayBuffer"&&(p=new Uint8Array(l)),i([u,[...p]],l)}const d=[],h=i([o,d],l);for(const p of l)d.push(a(p));return h}case Qn:{if(u)switch(u){case"BigInt":return i([u,l.toString()],l);case"Boolean":case"Number":case"String":return i([u,l.valueOf()],l)}if(t&&"toJSON"in l)return a(l.toJSON());const d=[],h=i([o,d],l);for(const p of kp(l))(e||!Bn(mn(l[p])))&&d.push([a(p),a(l[p])]);return h}case Ss:return i([o,l.toISOString()],l);case Cs:{const{source:d,flags:h}=l;return i([o,{source:d,flags:h}],l)}case Es:{const d=[],h=i([o,d],l);for(const[p,f]of l)(e||!(Bn(mn(p))||Bn(mn(f))))&&d.push([a(p),a(f)]);return h}case Is:{const d=[],h=i([o,d],l);for(const p of l)(e||!Bn(mn(p)))&&d.push(a(p));return h}}const{message:c}=l;return i([o,{name:u,message:c}],l)};return a},Pi=(e,{json:t,lossy:n}={})=>{const r=[];return Np(!(t||n),!!t,new Map,r)(e),r},Kn=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?zi(Pi(e,t)):structuredClone(e):(e,t)=>zi(Pi(e,t));function Sp(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Cp(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Ep(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Sp,r=e.options.footnoteBackLabel||Cp,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let u=-1;for(;++u<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[u]);if(!c)continue;const d=e.all(c),h=String(c.identifier).toUpperCase(),p=ln(h.toLowerCase());let f=0;const v=[],y=e.footnoteCounts.get(h);for(;y!==void 0&&++f<=y;){v.length>0&&v.push({type:"text",value:" "});let E=typeof n=="string"?n:n(u,f);typeof E=="string"&&(E={type:"text",value:E}),v.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,f),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const C=d[d.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const E=C.children[C.children.length-1];E&&E.type==="text"?E.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...v)}else d.push(...v);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(d,!0)};e.patch(c,b),o.push(b)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Kn(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
9
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
|
|
10
|
+
`}]}}const fl=(function(e){if(e==null)return zp;if(typeof e=="function")return ar(e);if(typeof e=="object")return Array.isArray(e)?Ip(e):_p(e);if(typeof e=="string")return Tp(e);throw new Error("Expected function, string, or object as test")});function Ip(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=fl(e[n]);return ar(r);function r(...i){let a=-1;for(;++a<t.length;)if(t[a].apply(this,i))return!0;return!1}}function _p(e){const t=e;return ar(n);function n(r){const i=r;let a;for(a in e)if(i[a]!==t[a])return!1;return!0}}function Tp(e){return ar(t);function t(n){return n&&n.type===e}}function ar(e){return t;function t(n,r,i){return!!(Pp(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function zp(){return!0}function Pp(e){return e!==null&&typeof e=="object"&&"type"in e}const pl=[],Rp=!0,Ri=!1,Ap="skip";function Op(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const a=fl(i),l=r?-1:1;o(e,void 0,[])();function o(u,c,d){const h=u&&typeof u=="object"?u:{};if(typeof h.type=="string"){const f=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(u.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=pl,v,y,C;if((!t||a(u,c,d[d.length-1]||void 0))&&(f=Mp(n(u,d)),f[0]===Ri))return f;if("children"in u&&u.children){const b=u;if(b.children&&f[0]!==Ap)for(y=(r?b.children.length:-1)+l,C=d.concat(b);y>-1&&y<b.children.length;){const E=b.children[y];if(v=o(E,y,C)(),v[0]===Ri)return v;y=typeof v[1]=="number"?v[1]:y+l}}return f}}}function Mp(e){return Array.isArray(e)?e:typeof e=="number"?[Rp,e]:e==null?pl:[e]}function ml(e,t,n,r){let i,a,l;typeof t=="function"&&typeof n!="function"?(a=void 0,l=t,i=n):(a=t,l=n,i=r),Op(e,a,o,i);function o(u,c){const d=c[c.length-1],h=d?d.children.indexOf(u):void 0;return l(u,h,d)}}const Xr={}.hasOwnProperty,Lp={};function Dp(e,t){const n=t||Lp,r=new Map,i=new Map,a=new Map,l={...vp,...n.handlers},o={all:c,applyData:Bp,definitionById:r,footnoteById:i,footnoteCounts:a,footnoteOrder:[],handlers:l,one:u,options:n,patch:Fp,wrap:Hp};return ml(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?r:i,p=String(d.identifier).toUpperCase();h.has(p)||h.set(p,d)}}),o;function u(d,h){const p=d.type,f=o.handlers[p];if(Xr.call(o.handlers,p)&&f)return f(o,d,h);if(o.options.passThrough&&o.options.passThrough.includes(p)){if("children"in d){const{children:y,...C}=d,b=Kn(C);return b.children=o.all(d),b}return Kn(d)}return(o.options.unknownHandler||Up)(o,d,h)}function c(d){const h=[];if("children"in d){const p=d.children;let f=-1;for(;++f<p.length;){const v=o.one(p[f],d);if(v){if(f&&p[f-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=Ai(v.value)),!Array.isArray(v)&&v.type==="element")){const y=v.children[0];y&&y.type==="text"&&(y.value=Ai(y.value))}Array.isArray(v)?h.push(...v):h.push(v)}}}return h}}function Fp(e,t){e.position&&(t.position=jd(e))}function Bp(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,a=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&a&&Object.assign(n.properties,Kn(a)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function Up(e,t){const n=t.data||{},r="value"in t&&!(Xr.call(n,"hProperties")||Xr.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 Hp(e,t){const n=[];let 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 Ai(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Oi(e,t){const n=Dp(e,t),r=n.one(e,void 0),i=Ep(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&a.children.push({type:"text",value:`
|
|
14
|
+
`},i),a}function qp(e,t){return e&&"run"in e?async function(n,r){const i=Oi(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Oi(n,{file:r,...e||t})}}function Mi(e){if(e)throw e}var yr,Li;function $p(){if(Li)return yr;Li=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},a=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var d=e.call(c,"constructor"),h=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!d&&!h)return!1;var p;for(p in c);return typeof p>"u"||e.call(c,p)},l=function(c,d){n&&d.name==="__proto__"?n(c,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):c[d.name]=d.newValue},o=function(c,d){if(d==="__proto__")if(e.call(c,d)){if(r)return r(c,d).value}else return;return c[d]};return yr=function u(){var c,d,h,p,f,v,y=arguments[0],C=1,b=arguments.length,E=!1;for(typeof y=="boolean"&&(E=y,y=arguments[1]||{},C=2),(y==null||typeof y!="object"&&typeof y!="function")&&(y={});C<b;++C)if(c=arguments[C],c!=null)for(d in c)h=o(y,d),p=o(c,d),y!==p&&(E&&p&&(a(p)||(f=i(p)))?(f?(f=!1,v=h&&i(h)?h:[]):v=h&&a(h)?h:{},l(y,{name:d,newValue:u(E,v,p)})):typeof p<"u"&&l(y,{name:d,newValue:p}));return y},yr}var Vp=$p();const vr=na(Vp);function Jr(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Qp(){const e=[],t={run:n,use:r};return t;function n(...i){let a=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);o(null,...i);function o(u,...c){const d=e[++a];let h=-1;if(u){l(u);return}for(;++h<i.length;)(c[h]===null||c[h]===void 0)&&(c[h]=i[h]);i=c,d?Kp(d,o)(...c):l(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Kp(e,t){let n;return r;function r(...l){const o=e.length>l.length;let u;o&&l.push(i);try{u=e.apply(this,l)}catch(c){const d=c;if(o&&n)throw d;return i(d)}o||(u&&u.then&&typeof u.then=="function"?u.then(a,i):u instanceof Error?i(u):a(u))}function i(l,...o){n||(n=!0,t(l,...o))}function a(l){i(null,l)}}const Le={basename:Gp,dirname:Wp,extname:Yp,join:Xp,sep:"/"};function Gp(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');An(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 l=-1,o=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else l<0&&(a=!0,l=i+1),o>-1&&(e.codePointAt(i)===t.codePointAt(o--)?o<0&&(r=i):(o=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function Wp(e){if(An(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||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Yp(e){An(e);let t=e.length,n=-1,r=0,i=-1,a=0,l;for(;t--;){const o=e.codePointAt(t);if(o===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),o===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 Xp(...e){let t=-1,n;for(;++t<e.length;)An(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Jp(n)}function Jp(e){An(e);const t=e.codePointAt(0)===47;let n=Zp(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Zp(e,t){let n="",r=0,i=-1,a=0,l=-1,o,u;for(;++l<=e.length;){if(l<e.length)o=e.codePointAt(l);else{if(o===47)break;o=47}if(o===47){if(!(i===l-1||a===1))if(i!==l-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(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=l,a=0;continue}}else if(n.length>0){n="",r=0,i=l,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,l):n=e.slice(i+1,l),r=l-i-1;i=l,a=0}else o===46&&a>-1?a++:a=-1}return n}function An(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const em={cwd:tm};function tm(){return"/"}function Zr(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function nm(e){if(typeof e=="string")e=new URL(e);else if(!Zr(e)){const t=new 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:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return rm(e)}function rm(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const jr=["history","path","basename","stem","extname","dirname"];class xl{constructor(t){let n;t?Zr(t)?n={path:t}:typeof t=="string"||sm(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":em.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<jr.length;){const a=jr[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let i;for(i in n)jr.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Le.basename(this.path):void 0}set basename(t){kr(t,"basename"),wr(t,"basename"),this.path=Le.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Le.dirname(this.path):void 0}set dirname(t){Di(this.basename,"dirname"),this.path=Le.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Le.extname(this.path):void 0}set extname(t){if(wr(t,"extname"),Di(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Le.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Zr(t)&&(t=nm(t)),kr(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Le.basename(this.path,this.extname):void 0}set stem(t){kr(t,"stem"),wr(t,"stem"),this.path=Le.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new ge(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function wr(e,t){if(e&&e.includes(Le.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Le.sep+"`")}function kr(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Di(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function sm(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const im=(function(e){const r=this.constructor.prototype,i=r[e],a=function(){return i.apply(a,arguments)};return Object.setPrototypeOf(a,r),a}),am={}.hasOwnProperty;class _s extends im{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=Qp()}copy(){const t=new _s;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(vr(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Cr("data",this.frozen),this.namespace[t]=n,this):am.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Cr("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Un(t),r=this.parser||this.Parser;return Nr("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Nr("process",this.parser||this.Parser),Sr("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(a,l){const o=Un(t),u=r.parse(o);r.run(u,o,function(d,h,p){if(d||!h||!p)return c(d);const f=h,v=r.stringify(f,p);cm(v)?p.value=v:p.result=v,c(d,p)});function c(d,h){d||!h?l(d):a?a(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Nr("processSync",this.parser||this.Parser),Sr("processSync",this.compiler||this.Compiler),this.process(t,i),Bi("processSync","process",n),r;function i(a,l){n=!0,Mi(a),r=l}}run(t,n,r){Fi(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(l,o){const u=Un(n);i.run(t,u,c);function c(d,h,p){const f=h||t;d?o(d):l?l(f):r(void 0,f,p)}}}runSync(t,n){let r=!1,i;return this.run(t,n,a),Bi("runSync","run",r),i;function a(l,o){Mi(l),i=o,r=!0}}stringify(t,n){this.freeze();const r=Un(n),i=this.compiler||this.Compiler;return Sr("stringify",i),Fi(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Cr("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(c){if(typeof c=="function")u(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[d,...h]=c;u(d,h)}else l(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function l(c){if(!("plugins"in c)&&!("settings"in c))throw new 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(c.plugins),c.settings&&(i.settings=vr(!0,i.settings,c.settings))}function o(c){let d=-1;if(c!=null)if(Array.isArray(c))for(;++d<c.length;){const h=c[d];a(h)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function u(c,d){let h=-1,p=-1;for(;++h<r.length;)if(r[h][0]===c){p=h;break}if(p===-1)r.push([c,...d]);else if(d.length>0){let[f,...v]=d;const y=r[p][1];Jr(y)&&Jr(f)&&(f=vr(!0,y,f)),r[p]=[c,f,...v]}}}}const lm=new _s().freeze();function Nr(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Sr(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Cr(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Fi(e){if(!Jr(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Bi(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Un(e){return om(e)?e:new xl(e)}function om(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function cm(e){return typeof e=="string"||um(e)}function um(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const dm="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ui=[],Hi={allowDangerousHtml:!0},hm=/^(https?|ircs?|mailto|xmpp)$/i,fm=[{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 pm(e){const t=mm(e),n=xm(e);return gm(t.runSync(t.parse(n),n),e)}function mm(e){const t=e.rehypePlugins||Ui,n=e.remarkPlugins||Ui,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Hi}:Hi;return lm().use(Gf).use(n).use(qp,r).use(t)}function xm(e){const t=e.children||"",n=new xl;return typeof t=="string"&&(n.value=t),n}function gm(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,l=t.skipHtml,o=t.unwrapDisallowed,u=t.urlTransform||bm;for(const d of fm)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+dm+d.id,void 0);return ml(e,c),Cd(e,{Fragment:s.Fragment,components:i,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function c(d,h,p){if(d.type==="raw"&&p&&typeof h=="number")return l?p.children.splice(h,1):p.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let f;for(f in xr)if(Object.hasOwn(xr,f)&&Object.hasOwn(d.properties,f)){const v=d.properties[f],y=xr[f];(y===null||y.includes(d.tagName))&&(d.properties[f]=u(String(v||""),f,d))}}if(d.type==="element"){let f=n?!n.includes(d.tagName):a?a.includes(d.tagName):!1;if(!f&&r&&typeof h=="number"&&(f=!r(d,h,p)),f&&p&&typeof h=="number")return o&&d.children?p.children.splice(h,1,...d.children):p.children.splice(h,1),h}}}function bm(e){const 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||hm.test(e.slice(0,t))?e:""}const ym={created:s.jsx(gt,{className:"size-3.5"}),validated:s.jsx(is,{className:"size-3.5"}),deployed:s.jsx(qn,{className:"size-3.5"}),rejected:s.jsx(Me,{className:"size-3.5"}),rolled_back:s.jsx(la,{className:"size-3.5"})},vm={created:"outline",validated:"secondary",deployed:"default",rejected:"destructive",rolled_back:"destructive"};function jm(e){const t=e.match(/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/);if(!t)return{meta:{},body:e};const n={};for(const r of t[1].split(`
|
|
15
|
+
`)){const i=r.indexOf(":");if(i>0){const a=r.slice(0,i).trim(),l=r.slice(i+1).trim();a&&l&&(n[a]=l)}}return{meta:n,body:t[2]}}function wm({meta:e}){const t=Object.entries(e);return t.length===0?null:s.jsx("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs",children:t.map(([n,r])=>s.jsxs("div",{className:"contents",children:[s.jsx("span",{className:"font-medium text-muted-foreground capitalize",children:n}),s.jsx("span",{className:"text-foreground truncate",children:r})]},n))})}function qi({label:e,text:t,variant:n}){const{meta:r,body:i}=jm(t),a=Object.keys(r).length>0;return s.jsxs("div",{className:"flex-1 min-w-0 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(xn,{className:"size-3.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:e}),n==="proposed"&&s.jsx(H,{variant:"secondary",className:"text-[10px]",children:"New"})]}),a&&s.jsx("div",{className:"rounded-md border bg-muted/30 p-3",children:s.jsx(wm,{meta:r})}),s.jsx("div",{className:"skill-markdown rounded-md border bg-card p-4",children:s.jsx(pm,{children:i})})]})}function km(e,t){if(typeof t=="boolean")return t?s.jsx(Je,{className:"size-3.5 text-emerald-500 inline"}):s.jsx(Me,{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"){const r=(t*100).toFixed(1),i=t>0&&e.includes("change")?"+":"";return s.jsxs("span",{className:"font-mono",children:[i,r,"%"]})}return s.jsx("span",{className:"font-mono",children:t})}return t==null?s.jsx("span",{className:"text-muted-foreground",children:"--"}):typeof t=="string"?s.jsx("span",{children:t}):Array.isArray(t)?t.length===0?s.jsx("span",{className:"text-muted-foreground italic",children:"none"}):s.jsxs("span",{className:"font-mono",children:[t.length," entries"]}):typeof t=="object"?s.jsx("span",{className:"font-mono",children:"1 entry"}):s.jsx("span",{children:String(t)})}function es({entry:e}){const t=e.entry,n=(t==null?void 0:t.query)??e.query??e.prompt??e.input??e.text,r=(t==null?void 0:t.should_trigger)??e.should_trigger,i=(t==null?void 0:t.invocation_type)??e.invocation_type,a=e.before_pass??e.before??e.original_triggered??e.baseline,l=e.after_pass??e.after??e.triggered??e.result,o=e.passed??e.matched,u=typeof l=="boolean"?l:typeof o=="boolean"?o:null;return s.jsxs("div",{className:"flex items-start gap-2 text-xs py-1.5 border-b border-border/50 last:border-0",children:[u!==null?u?s.jsx(Je,{className:"size-3.5 text-emerald-500 shrink-0 mt-0.5"}):s.jsx(Me,{className:"size-3.5 text-red-500 shrink-0 mt-0.5"}):s.jsx(gt,{className:"size-3.5 text-muted-foreground shrink-0 mt-0.5"}),s.jsx("span",{className:"flex-1 min-w-0 line-clamp-2",children:n?String(n):JSON.stringify(e)}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[typeof a=="boolean"&&typeof l=="boolean"&&s.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[a?"pass":"fail"," → ",l?"pass":"fail"]}),r!==void 0&&s.jsxs(H,{variant:"secondary",className:"text-[9px]",children:["expect: ",String(r)]}),i!=null&&s.jsx(H,{variant:"secondary",className:"text-[9px]",children:String(i)})]})]})}function Nm({validation:e}){const{improved:t,before_pass_rate:n,after_pass_rate:r,net_change:i,regressions:a,new_passes:l,per_entry_results:o,...u}=e,c=Array.isArray(a)?a:[],d=Array.isArray(l)?l:[],h=Array.isArray(o)?o:[];return s.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 space-y-3",children:[s.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["Validation Results",s.jsx("span",{className:"font-normal text-muted-foreground/60 ml-1.5",children:"— Before/after comparison from eval tests"})]}),s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[t!==void 0&&s.jsx(H,{variant:t?"default":"destructive",className:"text-[10px]",children:t?"Improved":"Regressed"}),typeof n=="number"&&typeof r=="number"&&s.jsxs("span",{className:"text-xs font-mono text-muted-foreground",children:[(n*100).toFixed(1),"% → ",(r*100).toFixed(1),"%"]}),typeof i=="number"&&s.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),"%"]})]}),d.length>0&&s.jsxs("div",{children:[s.jsxs("p",{className:"text-[11px] font-medium text-emerald-600 dark:text-emerald-400 mb-1",children:["New Passes (",d.length,")"]}),s.jsx("div",{className:"rounded border bg-card p-2",children:d.map((p,f)=>s.jsx(es,{entry:typeof p=="object"&&p!==null?p:{value:p}},f))})]}),c.length>0&&s.jsxs("div",{children:[s.jsxs("p",{className:"text-[11px] font-medium text-red-500 mb-1",children:["Regressions (",c.length,")"]}),s.jsx("div",{className:"rounded border border-red-200 dark:border-red-900/50 bg-card p-2",children:c.map((p,f)=>s.jsx(es,{entry:typeof p=="object"&&p!==null?p:{value:p}},f))})]}),h.length>0&&s.jsx(Sm,{entries:h}),Object.keys(u).length>0&&s.jsx("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs",children:Object.entries(u).map(([p,f])=>s.jsxs("div",{className:"contents",children:[s.jsx("span",{className:"font-mono text-muted-foreground",children:p}),s.jsx("span",{className:"text-foreground",children:km(p,f)})]},p))})]})}function Sm({entries:e}){const[t,n]=O.useState(!1),r=e.filter(a=>{if(typeof a!="object"||a===null)return!1;const l=a;return l.passed===!0||l.matched===!0||l.triggered===!0||l.after===!0||l.result===!0}).length,i=t?e:e.slice(0,5);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsxs("p",{className:"text-[11px] font-medium text-muted-foreground",children:["Individual Test Cases (",r,"/",e.length," passed)"]}),e.length>5&&s.jsx("button",{type:"button",onClick:()=>n(!t),className:"text-[10px] text-primary hover:underline",children:t?"Show less":`Show all ${e.length}`})]}),s.jsx("div",{className:"h-1.5 rounded-full bg-muted overflow-hidden mb-2",children:s.jsx("div",{className:"h-full rounded-full bg-emerald-500 transition-all",style:{width:`${e.length>0?r/e.length*100:0}%`}})}),s.jsx("div",{className:"rounded border bg-card p-2 max-h-[300px] overflow-y-auto",children:i.map((a,l)=>s.jsx(es,{entry:typeof a=="object"&&a!==null?a:{value:a}},l))})]})}function ts(e){if(!e.validation)return null;const t=e.validation.after_pass_rate;return typeof t=="number"?t:null}function Cm({prev:e,curr:t}){if(e===null||t===null)return null;const n=t-e;if(n===0)return null;const r=(n*100).toFixed(1),i=n>0;return s.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 Em({evalSet:e}){const[t,n]=O.useState(!1),r=e.filter(i=>(i.passed??i.result)===!0).length;return s.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 space-y-2",children:[s.jsxs("button",{type:"button",onClick:()=>n(!t),className:"flex items-center gap-1.5 w-full text-left",children:[t?s.jsx(At,{className:"size-3.5 text-muted-foreground shrink-0"}):s.jsx(Mt,{className:"size-3.5 text-muted-foreground shrink-0"}),s.jsx($o,{className:"size-3.5 text-muted-foreground"}),s.jsxs("span",{className:"text-xs font-medium text-muted-foreground",children:["Eval Set (",r,"/",e.length," passed)"]})]}),t&&s.jsx("div",{className:"space-y-1",children:e.map((i,a)=>{const l=i.query??i.prompt??i.input,o=i.expected??i.should_trigger,u=i.passed??i.result;return s.jsxs("div",{className:"flex items-start gap-2 text-xs py-1 border-b border-border/50 last:border-0",children:[typeof u=="boolean"?u?s.jsx(Je,{className:"size-3.5 text-emerald-500 shrink-0 mt-0.5"}):s.jsx(Me,{className:"size-3.5 text-red-500 shrink-0 mt-0.5"}):s.jsx(gt,{className:"size-3.5 text-muted-foreground shrink-0 mt-0.5"}),s.jsx("span",{className:"flex-1 min-w-0 line-clamp-2",children:String(l??JSON.stringify(i))}),o!==void 0&&s.jsxs(H,{variant:"secondary",className:"text-[9px] shrink-0",children:["expect: ",String(o)]})]},a)})})]})}function Er({entry:e,roundLabel:t,roundStatus:n,prevPassRate:r,currPassRate:i}){const a=n!=="single";return s.jsxs(ne,{className:n==="final"?"border-primary/50 shadow-sm":void 0,children:[s.jsx(se,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(ie,{className:"text-sm flex items-center gap-2",children:[s.jsx(oa,{className:"size-4 text-muted-foreground"}),"Evidence: ",e.target,a&&t&&s.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:t}),n==="final"&&s.jsx(H,{variant:"default",className:"text-[10px]",children:"Final"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[a&&s.jsx(Cm,{prev:r,curr:i}),s.jsx(H,{variant:"secondary",className:"text-[10px]",children:e.stage}),e.confidence!==null&&s.jsxs(H,{variant:e.confidence>=.8?"default":e.confidence>=.5?"secondary":"destructive",className:"text-[10px] font-mono",children:[mt(e.confidence)," confidence"]}),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:Ie(e.timestamp)})]})]})}),s.jsxs(Ze,{className:"space-y-4",children:[e.rationale&&s.jsxs("div",{className:"rounded-md border-l-2 border-primary/40 bg-primary/5 px-3 py-2",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Rationale"}),s.jsx("p",{className:"text-sm leading-relaxed",children:e.rationale})]}),e.details&&s.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:e.details}),(e.original_text||e.proposed_text)&&s.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[e.original_text&&s.jsx(qi,{label:"Original",text:e.original_text,variant:"original"}),e.proposed_text&&s.jsx(qi,{label:"Proposed",text:e.proposed_text,variant:"proposed"})]}),e.eval_set&&e.eval_set.length>0&&s.jsx(Em,{evalSet:e.eval_set}),e.validation&&Object.keys(e.validation).length>0&&s.jsx(Nm,{validation:e.validation})]})]})}function Im({entry:e,roundLabel:t,onExpand:n}){var a;const r=ts(e),i=(a=e.validation)==null?void 0:a.improved;return s.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:[s.jsx(Mt,{className:"size-4 text-muted-foreground shrink-0"}),s.jsx(oa,{className:"size-3.5 text-muted-foreground shrink-0"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:e.target}),s.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:t}),s.jsxs("div",{className:"flex items-center gap-2 ml-auto shrink-0",children:[r!==null&&s.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:[(r*100).toFixed(1),"% pass rate"]}),typeof i=="boolean"&&s.jsx(H,{variant:i?"default":"destructive",className:"text-[9px]",children:i?"Improved":"Regressed"}),s.jsx(H,{variant:"secondary",className:"text-[10px]",children:e.stage}),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:Ie(e.timestamp)})]})]})}function _m({proposalId:e,evolution:t,evidence:n}){const r=O.useMemo(()=>t.filter(h=>h.proposal_id===e).sort((h,p)=>new Date(h.timestamp).getTime()-new Date(p.timestamp).getTime()),[t,e]),i=O.useMemo(()=>n.filter(h=>h.proposal_id===e).sort((h,p)=>new Date(h.timestamp).getTime()-new Date(p.timestamp).getTime()),[n,e]),[a,l]=O.useState(new Set),o=h=>{l(p=>{const f=new Set(p);return f.has(h)?f.delete(h):f.add(h),f})},u=O.useMemo(()=>{for(let h=r.length-1;h>=0;h--)if(r[h].eval_snapshot)return r[h].eval_snapshot;return null},[r]),{proposalEntries:c,validationsByTarget:d}=O.useMemo(()=>{const h=[],p=new Map;for(const f of i)if(f.stage!=="validated")h.push(f);else{const v=f.target;p.has(v)||p.set(v,[]),p.get(v).push(f)}return{proposalEntries:h,validationsByTarget:p}},[i]);return s.jsxs("div",{className:"space-y-4",children:[s.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:[s.jsx(aa,{className:"size-4 text-primary/60 shrink-0 mt-0.5"}),s.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."})]}),s.jsxs(ne,{children:[s.jsx(se,{className:"pb-3",children:s.jsxs(ie,{className:"text-sm flex items-center gap-2",children:[s.jsx("span",{children:"Proposal Journey"}),s.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["#",e.slice(0,12)]})]})}),s.jsxs(Ze,{className:"space-y-3",children:[s.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:r.map((h,p)=>s.jsxs("div",{className:"contents",children:[p>0&&s.jsx(qo,{className:"size-3 text-muted-foreground/50 shrink-0"}),s.jsxs("div",{className:"flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 bg-card",children:[ym[h.action],s.jsx(H,{variant:vm[h.action]??"secondary",className:"text-[10px] capitalize",children:h.action.replace("_"," ")}),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:Ie(h.timestamp)})]})]},`${h.action}-${p}`))}),u&&s.jsxs("div",{className:"flex items-center gap-3 rounded-md border bg-muted/20 px-3 py-2",children:[typeof u.net_change=="number"&&s.jsxs("div",{className:"flex items-center gap-1",children:[u.net_change>0?s.jsx(Zn,{className:"size-3.5 text-emerald-500"}):s.jsx(er,{className:"size-3.5 text-red-500"}),s.jsxs("span",{className:`text-sm font-semibold font-mono ${u.net_change>0?"text-emerald-600 dark:text-emerald-400":"text-red-500"}`,children:[u.net_change>0?"+":"",Math.round(u.net_change*100),"%"]})]}),typeof u.before_pass_rate=="number"&&typeof u.after_pass_rate=="number"&&s.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:[Math.round(u.before_pass_rate*100),"% → ",Math.round(u.after_pass_rate*100),"%"]}),u.improved!==void 0&&s.jsx(H,{variant:u.improved?"default":"destructive",className:"text-[10px]",children:u.improved?"Improved":"Regressed"})]}),r.length>0&&r[r.length-1].details&&s.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:r[r.length-1].details})]})]}),c.map(h=>s.jsx(Er,{entry:h,roundLabel:null,roundStatus:"single",prevPassRate:null,currPassRate:null},`proposal-${h.target}-${h.timestamp}`)),Array.from(d.entries()).map(([h,p])=>{const f=p.length>1;return s.jsx("div",{className:"space-y-2",children:p.map((v,y)=>{const C=y===p.length-1,b=f?`Round ${y+1} of ${p.length}`:null,E=y>0?ts(p[y-1]):null,S=ts(v),j=`${h}-${v.timestamp}`,D=f?C?"final":"intermediate":"single";return D==="intermediate"&&!a.has(j)?s.jsx(Im,{entry:v,roundLabel:b,onExpand:()=>o(j)},j):D==="intermediate"&&a.has(j)?s.jsxs("div",{className:"space-y-1",children:[s.jsxs("button",{type:"button",onClick:()=>o(j),className:"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors px-1",children:[s.jsx(At,{className:"size-3"}),"Collapse ",b]}),s.jsx(Er,{entry:v,roundLabel:b,roundStatus:D,prevPassRate:E,currPassRate:S})]},j):s.jsx(Er,{entry:v,roundLabel:b,roundStatus:D,prevPassRate:E,currPassRate:S},j)})},h)}),i.length===0&&s.jsx("div",{className:"flex items-center justify-center rounded-lg border border-dashed py-8",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"No evidence entries for this proposal"})})]})}const Tm={created:s.jsx(gt,{className:"size-3.5"}),validated:s.jsx(is,{className:"size-3.5"}),deployed:s.jsx(qn,{className:"size-3.5"}),rejected:s.jsx(Me,{className:"size-3.5"}),rolled_back:s.jsx(la,{className:"size-3.5"})},ns={created:"bg-blue-500",validated:"bg-amber-500",deployed:"bg-emerald-500",rejected:"bg-red-500",rolled_back:"bg-red-400"},zm={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"},Pm={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 Rm(e){const t=new Map;for(const n of e){const r=t.get(n.proposal_id)??[];r.push(n),t.set(n.proposal_id,r)}for(const n of t.values())n.sort((r,i)=>new Date(r.timestamp).getTime()-new Date(i.timestamp).getTime());return Array.from(t.entries()).sort((n,r)=>{const i=n[1][n[1].length-1],a=r[1][r[1].length-1];return new Date(a.timestamp).getTime()-new Date(i.timestamp).getTime()})}function Am(e){return e[e.length-1].action}function Om(e){for(let t=e.length-1;t>=0;t--)if(e[t].eval_snapshot)return e[t].eval_snapshot;return null}function Mm({snapshot:e}){const t=e.net_change;if(t==null)return null;const n=Math.round(t*100),r=n>0;return s.jsxs("span",{className:L("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?s.jsx(Zn,{className:"size-2.5"}):s.jsx(er,{className:"size-2.5"}),r?"+":"",n,"%"]})}const Lm=[{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 Dm(){const[e,t]=O.useState(!1);return s.jsxs("div",{className:"px-2 pb-2",children:[s.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?s.jsx(At,{className:"size-3"}):s.jsx(Mt,{className:"size-3"}),"Lifecycle stages"]}),e&&s.jsx("div",{className:"mt-1.5 space-y-1.5 rounded-md border bg-muted/30 p-2",children:Lm.map(n=>s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:L("size-2 rounded-full mt-1 shrink-0",ns[n.action])}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-[10px] font-medium",children:n.label}),s.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:n.desc})]})]},n.action))})]})}function Fm({entries:e,selectedProposalId:t,onSelect:n}){const r=Rm(e);return r.length===0?s.jsx("div",{className:"flex items-center justify-center rounded-lg border border-dashed py-6 px-3",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"No evolution history yet"})}):s.jsxs("div",{className:"flex flex-col gap-0",children:[s.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"}),s.jsx(Dm,{}),s.jsx("nav",{className:"flex flex-col",children:r.map(([i,a],l)=>{const o=Am(a),u=t===i,c=a[a.length-1],d=ns[o]??"bg-muted-foreground",h=zm[o]??"ring-muted-foreground/30",p=Pm[o]??"bg-border",f=l===r.length-1,v=Om(a);return s.jsxs("div",{className:"relative flex gap-3",children:[s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:L("flex items-center justify-center size-7 rounded-full ring-2 text-white shrink-0 z-10",d,h),children:Tm[o]??s.jsx(gt,{className:"size-3.5"})}),!f&&s.jsx("div",{className:L("w-0.5 flex-1 min-h-[16px]",p)})]}),s.jsxs("button",{type:"button",onClick:()=>n(i),className:L("flex-1 min-w-0 rounded-md px-2.5 py-2 text-left transition-all mb-1","hover:bg-accent/50",u?"bg-primary/5 ring-1 ring-primary/20":""),children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(H,{variant:o==="deployed"?"default":o==="rejected"||o==="rolled_back"?"destructive":"secondary",className:"text-[10px] capitalize",children:o.replace("_"," ")}),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:Ie(c.timestamp)})]}),v&&s.jsxs("div",{className:"flex items-center gap-1.5 mt-1",children:[s.jsx(Mm,{snapshot:v}),v.before_pass_rate!==void 0&&v.after_pass_rate!==void 0&&s.jsxs("span",{className:"text-[10px] text-muted-foreground/60 font-mono",children:[Math.round(v.before_pass_rate*100),"→",Math.round(v.after_pass_rate*100),"%"]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 mt-1",children:[s.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground/70",children:["#",i.slice(0,8)]}),a.length>1&&s.jsx("div",{className:"flex gap-0.5 ml-auto",children:a.map((y,C)=>s.jsx("div",{className:L("size-1.5 rounded-full",ns[y.action]??"bg-muted-foreground")},`${y.action}-${C}`))})]}),c.details&&s.jsx("p",{className:"text-[11px] text-muted-foreground/80 line-clamp-2 mt-1 leading-snug",children:c.details})]})]},i)})})]})}function de({text:e}){return s.jsxs(ht,{children:[s.jsx(ft,{className:"inline-flex items-center text-muted-foreground/50 hover:text-muted-foreground transition-colors cursor-help",onClick:t=>t.preventDefault(),children:s.jsx(aa,{className:"size-3"})}),s.jsx(pt,{side:"top",className:"max-w-[220px]",children:e})]})}const Bm={evolve:s.jsx(Qo,{className:"size-3 text-amber-500"}),watch:s.jsx(as,{className:"size-3 text-blue-500"}),skip:s.jsx(Vo,{className:"size-3 text-muted-foreground"})};function $i({action:e}){return s.jsxs("div",{className:"flex items-start gap-2 py-1",children:[s.jsx("div",{className:"mt-0.5 shrink-0",children:Bm[e.action]??null}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-xs font-medium truncate",children:e.skill}),s.jsx(H,{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&&s.jsx(H,{variant:"destructive",className:"text-[10px] h-4 px-1.5 shrink-0",children:"alert"})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground line-clamp-1",children:e.reason})]})]})}function Um({run:e}){const[t,n]=O.useState(!1),r=e.skill_actions.filter(a=>a.action!=="skip"),i=e.skill_actions.filter(a=>a.action==="skip");return s.jsxs(Na,{open:t,onOpenChange:n,children:[s.jsx(Sa,{className:"w-full text-left",children:s.jsxs("div",{className:"flex items-start gap-3 py-2 hover:bg-muted/50 rounded-md px-2 -mx-2 transition-colors",children:[s.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"}`}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:Ie(e.timestamp)}),e.dry_run&&s.jsx(H,{variant:"outline",className:"text-[10px] h-4 px-1.5",children:"dry-run"}),e.approval_mode==="review"&&s.jsx(H,{variant:"outline",className:"text-[10px] h-4 px-1.5",children:"review"})]}),s.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-muted-foreground",children:[e.deployed>0&&s.jsxs("span",{className:"text-emerald-600 font-medium",children:[e.deployed," deployed"]}),e.evolved>0&&s.jsxs("span",{children:[e.evolved," evolved"]}),e.watched>0&&s.jsxs("span",{children:[e.watched," watched"]}),e.skipped>0&&s.jsxs("span",{children:[e.skipped," skipped"]}),s.jsxs("span",{children:[(e.elapsed_ms/1e3).toFixed(1),"s"]})]})]}),s.jsx(Mt,{className:`size-4 text-muted-foreground shrink-0 mt-1 transition-transform duration-200 ${t?"rotate-90":""}`})]})}),s.jsx(Ca,{children:s.jsxs("div",{className:"ml-5 pl-3 border-l border-border space-y-0.5 pb-2",children:[r.map((a,l)=>s.jsx($i,{action:a},`${a.skill}-${l}`)),i.length>0&&s.jsxs("details",{className:"group",children:[s.jsxs("summary",{className:"text-[11px] text-muted-foreground cursor-pointer hover:text-foreground py-1",children:[i.length," skipped"]}),s.jsx("div",{className:"space-y-0.5",children:i.map((a,l)=>s.jsx($i,{action:a},`${a.skill}-skip-${l}`))})]})]})})]})}function Hm({runs:e}){if(e.length===0)return s.jsxs(ne,{children:[s.jsx(se,{children:s.jsxs(ie,{className:"flex items-center gap-2 text-sm",children:[s.jsx(Ms,{className:"size-4"}),"Orchestrate Runs"]})}),s.jsx(Ze,{children:s.jsxs("p",{className:"text-sm text-muted-foreground text-center py-4",children:["No orchestrate runs yet. Run ",s.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:"selftune orchestrate"})," to start."]})})]});const t=e.reduce((n,r)=>n+r.deployed,0);return s.jsxs(ne,{children:[s.jsxs(se,{children:[s.jsxs(ie,{className:"flex items-center gap-2 text-sm",children:[s.jsx(Ms,{className:"size-4"}),"Orchestrate Runs"]}),s.jsxs(ce,{children:[e.length," recent run",e.length!==1?"s":"",t>0&&s.jsxs(s.Fragment,{children:[" · ",t," total deployments"]})]})]}),s.jsx(Ze,{className:"space-y-0",children:e.slice(0,10).map(n=>s.jsx(Um,{run:n},n.run_id))})]})}function qm({skillsCount:e,avgPassRate:t,unmatchedCount:n,sessionsCount:r,pendingCount:i,evidenceCount:a,hasEvolution:l=!0}){const o=t!==null?`${Math.round(t*100)}%`:"--",u=t!==null&&t>=.7;return s.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:[s.jsx(ne,{className:"@container/card",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[s.jsx(tr,{className:"size-3.5"}),"Skills Monitored",s.jsx(de,{text:"Total number of skills detected and being tracked by selftune"})]}),s.jsx(ie,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:e}),s.jsx(Xe,{children:s.jsxs(H,{variant:"outline",children:[s.jsx(sn,{className:"size-3"}),"live"]})})]})}),s.jsx(ne,{className:"@container/card",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[s.jsx(ca,{className:"size-3.5"}),"Avg Trigger Rate",s.jsx(de,{text:"Average percentage of skill checks that resulted in a trigger across all graded skills (5+ checks). Run selftune evolve to improve this."})]}),s.jsx(ie,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl ${!u&&t!==null?"text-red-600":""}`,children:o}),s.jsx(Xe,{children:t!==null?s.jsxs(H,{variant:u?"outline":"destructive",children:[u?s.jsx(Zn,{className:"size-3"}):s.jsx(er,{className:"size-3"}),o]}):s.jsx(H,{variant:"secondary",className:"text-[10px]",children:"needs 5+ checks"})})]})}),s.jsx(ne,{className:"@container/card",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[s.jsx(ia,{className:"size-3.5"}),"Unmatched Queries",s.jsx(de,{text:"User prompts that didn't match any skill's trigger criteria — potential gaps in coverage"})]}),s.jsx(ie,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:n}),n>0&&s.jsx(Xe,{children:s.jsxs(H,{variant:"destructive",children:[s.jsx(xt,{className:"size-3"}),"needs attention"]})})]})}),s.jsx(ne,{className:"@container/card",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[s.jsx(sn,{className:"size-3.5"}),"Sessions",s.jsx(de,{text:"Total agent sessions that have been recorded and analyzed"})]}),s.jsx(ie,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:r})]})}),s.jsx(ne,{className:"@container/card",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[s.jsx(xt,{className:"size-3.5"}),"Pending Proposals",s.jsx(de,{text:"Evolution proposals that have been generated but not yet validated or deployed. Requires running selftune evolve."})]}),s.jsx(ie,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:l?i:"--"}),s.jsx(Xe,{children:l?i>0?s.jsx(H,{variant:"secondary",children:"awaiting review"}):null:s.jsx(H,{variant:"secondary",className:"text-[10px]",children:"no evolution runs yet"})})]})}),s.jsx(ne,{className:"@container/card",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[s.jsx(as,{className:"size-3.5"}),"Total Evidence",s.jsx(de,{text:"Number of evidence entries documenting skill changes with before/after validation results. Requires running selftune evolve."})]}),s.jsx(ie,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:l?a:"--"}),!l&&s.jsx(Xe,{children:s.jsx(H,{variant:"secondary",className:"text-[10px]",children:"no evolution runs yet"})})]})})]})}const gl=O.createContext(null);function $m(){const e=O.useContext(gl);return e?s.jsxs(ye,{ref:e.setActivatorNodeRef,...e.attributes,...e.listeners,variant:"ghost",size:"icon",className:"size-7 text-muted-foreground hover:bg-transparent",children:[s.jsx(Jo,{className:"size-3 text-muted-foreground"}),s.jsx("span",{className:"sr-only",children:"Drag to reorder"})]}):null}function Vm(e){return[{id:"drag",header:()=>null,cell:()=>s.jsx($m,{})},{id:"select",header:({table:t})=>s.jsx("div",{className:"flex items-center justify-center",children:s.jsx(Gs,{checked:t.getIsAllPageRowsSelected(),indeterminate:t.getIsSomePageRowsSelected()&&!t.getIsAllPageRowsSelected(),onCheckedChange:n=>t.toggleAllPageRowsSelected(!!n),"aria-label":"Select all"})}),cell:({row:t})=>s.jsx("div",{className:"flex items-center justify-center",children:s.jsx(Gs,{checked:t.getIsSelected(),onCheckedChange:n=>t.toggleSelected(!!n),"aria-label":"Select row"})}),enableSorting:!1,enableHiding:!1},{accessorKey:"name",header:"Skill",cell:({row:t})=>e?e(t.original):s.jsx("span",{className:"text-sm font-medium",children:t.original.name}),enableHiding:!1},{accessorKey:"scope",header:"Scope",cell:({row:t})=>{const n=t.original.scope;return n?s.jsx(H,{variant:"secondary",className:"text-[10px]",children:n}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"--"})}},{accessorKey:"status",header:"Status",cell:({row:t})=>{const n=qr[t.original.status];return s.jsxs(H,{variant:n.variant,className:"gap-1 px-1.5 text-muted-foreground",children:[n.icon,n.label]})},sortingFn:(t,n)=>{const r={CRITICAL:0,WARNING:1,UNGRADED:2,UNKNOWN:3,HEALTHY:4};return r[t.original.status]-r[n.original.status]}},{accessorKey:"passRate",header:()=>s.jsx("div",{className:"w-full text-right",children:"Pass Rate"}),cell:({row:t})=>{const n=t.original.passRate,r=n!==null&&n<.5;return s.jsx("div",{className:`text-right font-mono tabular-nums ${r?"text-red-600 font-semibold":""}`,children:mt(n)})},sortingFn:(t,n)=>{const r=t.original.passRate??-1,i=n.original.passRate??-1;return r-i}},{accessorKey:"checks",header:()=>s.jsx("div",{className:"w-full text-right",children:"Checks"}),cell:({row:t})=>s.jsx("div",{className:"text-right font-mono tabular-nums",children:t.original.checks})},{accessorKey:"uniqueSessions",header:()=>s.jsx("div",{className:"w-full text-right",children:"Sessions"}),cell:({row:t})=>s.jsx("div",{className:"text-right font-mono tabular-nums",children:t.original.uniqueSessions})},{accessorKey:"lastSeen",header:"Last Seen",cell:({row:t})=>s.jsx("div",{className:"flex items-center gap-1 text-muted-foreground",children:t.original.lastSeen?s.jsxs(s.Fragment,{children:[s.jsx(ss,{className:"size-3"}),s.jsx("span",{className:"font-mono text-xs",children:Ie(t.original.lastSeen)})]}):s.jsx("span",{className:"text-xs",children:"--"})}),sortingFn:(t,n)=>{const r=l=>{if(!l)return 0;const o=new Date(l).getTime();return Number.isNaN(o)?0:o},i=r(t.original.lastSeen),a=r(n.original.lastSeen);return i-a}},{accessorKey:"hasEvidence",header:"Evidence",cell:({row:t})=>s.jsx(H,{variant:t.original.hasEvidence?"outline":"secondary",className:"px-1.5 text-[10px] text-muted-foreground",children:t.original.hasEvidence?"Yes":"No"})}]}function Qm({row:e}){const{transform:t,transition:n,setNodeRef:r,setActivatorNodeRef:i,isDragging:a,attributes:l,listeners:o}=kc({id:e.original.name}),u=O.useMemo(()=>({attributes:l,listeners:o,setActivatorNodeRef:i}),[l,o,i]);return s.jsx(gl.Provider,{value:u,children:s.jsx(Sn,{"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:Nc.Transform.toString(t),transition:n},children:e.getVisibleCells().map(c=>s.jsx(jt,{children:da(c.column.columnDef.cell,c.getContext())},c.id))})})}function Km({cards:e,totalCount:t,statusFilter:n,onStatusFilterChange:r,renderSkillName:i}){var z;const[a,l]=O.useState("all"),[o,u]=O.useState([]),[c,d]=O.useState({}),[h,p]=O.useState({}),[f,v]=O.useState([]),[y,C]=O.useState([]),[b,E]=O.useState({pageIndex:0,pageSize:20}),S=O.useMemo(()=>Vm(i),[i]),j=O.useMemo(()=>({all:e.length,attention:e.filter(k=>k.status==="CRITICAL"||k.status==="WARNING").length,recent:e.filter(k=>k.lastSeen!==null).length,ungraded:e.filter(k=>k.status==="UNGRADED"||k.status==="UNKNOWN").length}),[e]);O.useEffect(()=>{let k=e;a==="attention"?k=e.filter(B=>B.status==="CRITICAL"||B.status==="WARNING"):a==="recent"?k=[...e.filter(B=>B.lastSeen!==null)].sort((B,M)=>{const _=B.lastSeen?new Date(B.lastSeen).getTime():0;return(M.lastSeen?new Date(M.lastSeen).getTime():0)-_}):a==="ungraded"&&(k=e.filter(B=>B.status==="UNGRADED"||B.status==="UNKNOWN")),u(k),E(B=>({...B,pageIndex:0}))},[e,a]);const D=O.useId(),w=ic(ur(jc,{}),ur(vc,{}),ur(yc,{coordinateGetter:bc})),R=ac({data:o,columns:S,state:{sorting:y,columnVisibility:h,rowSelection:c,columnFilters:f,pagination:b},getRowId:k=>k.name,enableRowSelection:!0,onRowSelectionChange:d,onSortingChange:C,onColumnFiltersChange:v,onColumnVisibilityChange:p,onPaginationChange:E,getCoreRowModel:gc(),getFilteredRowModel:xc(),getPaginationRowModel:mc(),getSortedRowModel:pc(),getFacetedRowModel:fc(),getFacetedUniqueValues:hc()}),U=O.useMemo(()=>R.getRowModel().rows.map(k=>k.id),[R.getRowModel().rows]),F=y.length>0;function $(k){if(F)return;const{active:B,over:M}=k;B&&M&&B.id!==M.id&&u(_=>{const G=_.map(W=>W.name),le=G.indexOf(B.id),A=G.indexOf(M.id);return le===-1||A===-1?_:wc(_,le,A)})}return s.jsxs(ds,{value:a,onValueChange:l,className:"flex w-full flex-col justify-start gap-6",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 lg:px-6",children:[s.jsx(Js,{htmlFor:"view-selector",className:"sr-only",children:"View"}),s.jsxs(Zs,{value:a,onValueChange:k=>k&&l(k),children:[s.jsx(ni,{className:"flex w-fit @4xl/main:hidden",size:"sm",id:"view-selector",children:s.jsx(ti,{placeholder:"Select a view"})}),s.jsx(ri,{children:s.jsxs(ei,{children:[s.jsx(dn,{value:"all",children:"All Skills"}),s.jsx(dn,{value:"attention",children:"Needs Attention"}),s.jsx(dn,{value:"recent",children:"Recently Active"}),s.jsx(dn,{value:"ungraded",children:"Ungraded"})]})})]}),s.jsxs(hs,{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:[s.jsxs(He,{value:"all",children:["All Skills ",s.jsx(H,{variant:"secondary",children:j.all})]}),s.jsxs(He,{value:"attention",children:["Needs Attention"," ",j.attention>0&&s.jsx(H,{variant:"secondary",children:j.attention})]}),s.jsxs(He,{value:"recent",children:["Recently Active"," ",j.recent>0&&s.jsx(H,{variant:"secondary",children:j.recent})]}),s.jsxs(He,{value:"ungraded",children:["Ungraded"," ",j.ungraded>0&&s.jsx(H,{variant:"secondary",children:j.ungraded})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[r&&s.jsxs(Ws,{children:[s.jsxs(Ys,{render:s.jsx(ye,{variant:"outline",size:"sm"}),children:[s.jsx(Ko,{"data-icon":"inline-start",className:"size-3.5"}),n&&n!=="ALL"?n.charAt(0)+n.slice(1).toLowerCase():"Status",s.jsx(At,{"data-icon":"inline-end"})]}),s.jsx(Xs,{align:"end",className:"w-40",children:s.jsx(uu,{value:n??"ALL",onValueChange:k=>r(k),children:[{label:"All",value:"ALL",icon:s.jsx(tr,{className:"size-3.5"})},{label:"Healthy",value:"HEALTHY",icon:s.jsx(Je,{className:"size-3.5 text-emerald-600"})},{label:"Warning",value:"WARNING",icon:s.jsx(xt,{className:"size-3.5 text-amber-500"})},{label:"Critical",value:"CRITICAL",icon:s.jsx(Me,{className:"size-3.5 text-red-500"})},{label:"Ungraded",value:"UNGRADED",icon:s.jsx(gt,{className:"size-3.5 text-muted-foreground"})},{label:"Unknown",value:"UNKNOWN",icon:s.jsx(Jn,{className:"size-3.5 text-muted-foreground/60"})}].map(k=>s.jsx(du,{value:k.value,children:s.jsxs("span",{className:"flex items-center gap-2",children:[k.icon,k.label]})},k.value))})})]}),s.jsxs(Ws,{children:[s.jsxs(Ys,{render:s.jsx(ye,{variant:"outline",size:"sm"}),children:[s.jsx(Go,{"data-icon":"inline-start"}),"Columns",s.jsx(At,{"data-icon":"inline-end"})]}),s.jsx(Xs,{align:"end",className:"w-40",children:R.getAllColumns().filter(k=>typeof k.accessorFn<"u"&&k.getCanHide()).map(k=>s.jsx(cu,{className:"capitalize",checked:k.getIsVisible(),onCheckedChange:B=>k.toggleVisibility(!!B),children:k.id==="scope"?"Scope":k.id==="passRate"?"Pass Rate":k.id==="uniqueSessions"?"Sessions":k.id==="lastSeen"?"Last Seen":k.id==="hasEvidence"?"Evidence":k.id},k.id))})]})]})]}),s.jsxs(Rt,{value:a,className:"relative flex flex-col gap-4 overflow-auto px-4 lg:px-6",children:[s.jsx("div",{className:"overflow-hidden rounded-lg border",children:s.jsx(lc,{collisionDetection:cc,modifiers:[oc],onDragEnd:$,sensors:w,id:D,children:s.jsxs(Ea,{children:[s.jsx(Ia,{className:"sticky top-0 z-10 bg-muted",children:R.getHeaderGroups().map(k=>s.jsx(Sn,{children:k.headers.map(B=>s.jsx(qt,{colSpan:B.colSpan,className:B.column.getCanSort()?"cursor-pointer select-none":"",onClick:B.column.getToggleSortingHandler(),children:s.jsxs("div",{className:"flex items-center gap-1",children:[B.isPlaceholder?null:da(B.column.columnDef.header,B.getContext()),B.column.getIsSorted()==="asc"?" ↑":B.column.getIsSorted()==="desc"?" ↓":null]})},B.id))},k.id))}),s.jsx(_a,{className:"**:data-[slot=table-cell]:first:w-8",children:(z=R.getRowModel().rows)!=null&&z.length?s.jsx(uc,{items:U,strategy:dc,children:R.getRowModel().rows.map(k=>s.jsx(Qm,{row:k},k.id))}):s.jsx(Sn,{children:s.jsx(jt,{colSpan:S.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."})})})]})})}),s.jsxs("div",{className:"flex items-center justify-between px-4",children:[s.jsxs("div",{className:"hidden flex-1 text-sm text-muted-foreground lg:flex",children:[R.getFilteredSelectedRowModel().rows.length," of"," ",R.getFilteredRowModel().rows.length," skill(s) selected."]}),s.jsxs("div",{className:"flex w-full items-center gap-8 lg:w-fit",children:[s.jsxs("div",{className:"hidden items-center gap-2 lg:flex",children:[s.jsx(Js,{htmlFor:"rows-per-page",className:"text-sm font-medium",children:"Rows per page"}),s.jsxs(Zs,{value:`${R.getState().pagination.pageSize}`,onValueChange:k=>{R.setPageSize(Number(k))},items:[10,20,50,100].map(k=>({label:`${k}`,value:`${k}`})),children:[s.jsx(ni,{size:"sm",className:"w-20",id:"rows-per-page",children:s.jsx(ti,{placeholder:R.getState().pagination.pageSize})}),s.jsx(ri,{side:"top",children:s.jsx(ei,{children:[10,20,50,100].map(k=>s.jsx(dn,{value:`${k}`,children:k},k))})})]})]}),R.getRowModel().rows.length>0&&s.jsxs("div",{className:"flex w-fit items-center justify-center text-sm font-medium",children:["Page ",R.getState().pagination.pageIndex+1," of"," ",R.getPageCount()]}),s.jsxs("div",{className:"ml-auto flex items-center gap-2 lg:ml-0",children:[s.jsxs(ye,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>R.setPageIndex(0),disabled:!R.getCanPreviousPage(),children:[s.jsx("span",{className:"sr-only",children:"Go to first page"}),s.jsx(Wo,{})]}),s.jsxs(ye,{variant:"outline",className:"size-8",size:"icon",onClick:()=>R.previousPage(),disabled:!R.getCanPreviousPage(),children:[s.jsx("span",{className:"sr-only",children:"Go to previous page"}),s.jsx(Yo,{})]}),s.jsxs(ye,{variant:"outline",className:"size-8",size:"icon",onClick:()=>R.nextPage(),disabled:!R.getCanNextPage(),children:[s.jsx("span",{className:"sr-only",children:"Go to next page"}),s.jsx(Mt,{})]}),s.jsxs(ye,{variant:"outline",className:"hidden size-8 lg:flex",size:"icon",onClick:()=>R.setPageIndex(R.getPageCount()-1),disabled:!R.getCanNextPage(),children:[s.jsx("span",{className:"sr-only",children:"Go to last page"}),s.jsx(Xo,{})]})]})]})]})]})]})}const lr="";async function Gm(){const e=await fetch(`${lr}/api/v2/overview`);if(!e.ok)throw new Error(`API error: ${e.status} ${e.statusText}`);return e.json()}async function Wm(e){const t=await fetch(`${lr}/api/v2/skills/${encodeURIComponent(e)}`);if(!t.ok)throw t.status===404?new bl(e):new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function Ym(e=20){const t=await fetch(`${lr}/api/v2/orchestrate-runs?limit=${e}`);if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function Xm(){const e=await fetch(`${lr}/api/v2/doctor`);if(!e.ok)throw new Error(`API error: ${e.status} ${e.statusText}`);return e.json()}class bl extends Error{constructor(t){super(`Skill "${t}" not found`),this.name="NotFoundError"}}const Jm=6e4;function Zm(){return rr({queryKey:["orchestrate-runs"],queryFn:()=>Ym(20),staleTime:5e3,refetchInterval:Jm})}function ex(e){return za(e.map(t=>({name:t.skill_name,scope:t.skill_scope,passRate:t.total_checks>0?t.pass_rate:null,checks:t.total_checks,status:fs(t.pass_rate,t.total_checks),hasEvidence:t.has_evidence,uniqueSessions:t.unique_sessions,lastSeen:t.last_seen})))}function tx({skillCount:e}){const[t,n]=O.useState(()=>{try{return localStorage.getItem("selftune-onboarding-dismissed")==="true"}catch{return!1}});if(!(!t||e===0))return null;const i=()=>{n(!0);try{localStorage.setItem("selftune-onboarding-dismissed","true")}catch{}};return e===0?s.jsx("div",{className:"mx-4 lg:mx-6 rounded-xl border-2 border-dashed border-primary/30 bg-primary/5 p-8",children:s.jsxs("div",{className:"flex flex-col items-center text-center gap-4 max-w-md mx-auto",children:[s.jsx("div",{className:"flex items-center justify-center size-12 rounded-full bg-primary/10",children:s.jsx(qn,{className:"size-6 text-primary"})}),s.jsx("h2",{className:"text-lg font-semibold",children:"Welcome to selftune"}),s.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."}),s.jsxs("div",{className:"grid grid-cols-1 gap-3 w-full text-left sm:grid-cols-3",children:[s.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border bg-card p-3",children:[s.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"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium",children:"Run selftune"}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Enable selftune in your project to start tracking skills"})]})]}),s.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border bg-card p-3",children:[s.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"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium",children:"Skills appear"}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Skills are detected and monitored automatically"})]})]}),s.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border bg-card p-3",children:[s.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"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium",children:"Watch evolution"}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Proposals flow in with validated improvements"})]})]})]})]})}):s.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:[s.jsx(qn,{className:"size-4 text-primary/60 shrink-0"}),s.jsxs("p",{className:"flex-1 text-xs text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:"Welcome to selftune dashboard."})," ","Hover over any metric label's ",s.jsx("span",{className:"inline-flex items-center text-muted-foreground/50",children:s.jsx(tr,{className:"size-2.5 mx-0.5"})})," icon for an explanation. Click proposals in the Evolution timeline to see detailed evidence."]}),s.jsxs("button",{type:"button",onClick:i,className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors shrink-0",children:[s.jsx(ra,{className:"size-4"}),s.jsx("span",{className:"sr-only",children:"Dismiss"})]})]})}function nx({search:e,statusFilter:t,onStatusFilterChange:n,overviewQuery:r}){const i=_l(),{data:a,isPending:l,isError:o,error:u,refetch:c}=r,d=Zm(),h=O.useMemo(()=>a?ex(a.skills):[],[a]),p=O.useMemo(()=>{let E=h;if(e){const S=e.toLowerCase();E=E.filter(j=>j.name.toLowerCase().includes(S))}return t!=="ALL"&&(E=E.filter(S=>S.status===t)),E},[h,e,t]);if(l)return s.jsxs("div",{className:"@container/main flex flex-1 flex-col gap-6 py-6",children:[s.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,S)=>s.jsx(qe,{className:"h-24 rounded-xl"},S))}),s.jsxs("div",{className:"px-4 lg:px-6",children:[s.jsx(qe,{className:"h-8 w-32 mb-4"}),s.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,S)=>s.jsx(qe,{className:"h-28 rounded-xl"},S))})]})]});if(o)return s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 py-16",children:[s.jsx(nr,{className:"size-10 text-destructive"}),s.jsx("p",{className:"text-sm font-medium text-destructive",children:u instanceof Error?u.message:"Unknown error"}),s.jsxs(ye,{variant:"outline",size:"sm",onClick:()=>c(),children:[s.jsx($n,{className:"mr-2 size-3.5"}),"Retry"]})]});if(!a)return s.jsx("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 py-16",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"No telemetry data found. Run some sessions first."})});const{overview:f,skills:v}=a,y=v.filter(E=>E.total_checks>=5),C=y.length>0?y.reduce((E,S)=>E+S.pass_rate,0)/y.length:null,b=(E,S)=>{i(`/skills/${encodeURIComponent(E)}?proposal=${encodeURIComponent(S)}`)};return s.jsxs("div",{className:"@container/main flex flex-1 flex-col gap-6 py-6",children:[s.jsx(tx,{skillCount:v.length}),s.jsx(qm,{skillsCount:v.length,avgPassRate:C,unmatchedCount:f.unmatched_queries.length,sessionsCount:f.counts.sessions,pendingCount:f.pending_proposals.length,evidenceCount:f.counts.evidence,hasEvolution:f.counts.evolution>0}),s.jsxs("div",{className:"grid grid-cols-1 gap-6 @5xl/main:grid-cols-[1fr_320px]",children:[s.jsx(Km,{cards:p,totalCount:h.length,statusFilter:t,onStatusFilterChange:n,renderSkillName:E=>s.jsx(wt,{to:`/skills/${encodeURIComponent(E.name)}`,className:"text-sm font-medium hover:underline",children:E.name})}),s.jsx("div",{className:"px-4 lg:px-6 @5xl/main:px-0 @5xl/main:pr-4 lg:@5xl/main:pr-6",children:s.jsxs("div",{className:"sticky top-4 space-y-4",children:[s.jsx(Xu,{evolution:f.evolution,pendingProposals:f.pending_proposals,unmatchedQueries:f.unmatched_queries,onSelectProposal:b}),d.isPending?s.jsx(qe,{className:"h-32 rounded-xl"}):d.isError?s.jsx("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-3 text-xs text-destructive",children:"Failed to load orchestrate runs."}):s.jsx(Hm,{runs:d.data.runs})]})})]})]})}const rx=6e4;function sx(e){return rr({queryKey:["skill-report",e],queryFn:()=>Wm(e),enabled:!!e,staleTime:5e3,refetchInterval:rx,retry:(t,n)=>n instanceof bl?!1:t<2})}function Vi(e){if(e<1e3)return`${Math.round(e)}ms`;const t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;const n=t/60;return n<60?`${n.toFixed(1)}m`:`${(n/60).toFixed(1)}h`}const ix={created:"outline",validated:"secondary",deployed:"default",rejected:"destructive",rolled_back:"destructive"};function ax({sessionId:e,meta:t,invocations:n,defaultExpanded:r}){var u;const[i,a]=O.useState(r),l=(t==null?void 0:t.started_at)??((u=n[0])==null?void 0:u.timestamp),o=n.reduce((c,d)=>{const h=d.invocation_mode??"unknown";return c[h]=(c[h]??0)+1,c},{});return s.jsxs("div",{className:"rounded-lg border border-border/60 overflow-hidden transition-colors",children:[s.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:[s.jsx(Mt,{className:`size-3.5 text-muted-foreground shrink-0 transition-transform duration-150 ${i?"rotate-90":""}`}),s.jsxs("div",{className:"flex flex-col gap-1 min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-sm font-medium",children:[n.length," invocation",n.length!==1?"s":""]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:l?Ie(l):""})]}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(t==null?void 0:t.model)&&s.jsx(H,{variant:"secondary",className:"text-[10px] font-normal",children:t.model}),(t==null?void 0:t.workspace_path)&&s.jsx("span",{className:"text-[11px] text-muted-foreground font-mono",title:t.workspace_path,children:t.workspace_path.split("/").slice(-2).join("/")})]})]}),!i&&s.jsx("div",{className:"flex items-center gap-1 shrink-0",children:Object.entries(o).map(([c,d])=>s.jsxs(H,{variant:"outline",className:"text-[10px] font-normal gap-1",children:[c," ",s.jsx("span",{className:"text-muted-foreground",children:d})]},c))}),s.jsx("span",{className:"text-[10px] text-muted-foreground/40 font-mono shrink-0",children:e.substring(0,8)})]}),i&&s.jsx("div",{className:"border-t border-border/40 overflow-x-auto",children:s.jsxs(Ea,{children:[s.jsx(Ia,{children:s.jsxs(Sn,{className:"hover:bg-transparent bg-muted/40",children:[s.jsxs(qt,{className:"text-[11px] h-8",children:["Prompt ",s.jsx(de,{text:"The user prompt that led to this skill being invoked"})]}),s.jsxs(qt,{className:"text-[11px] h-8 w-[90px]",children:["Mode ",s.jsx(de,{text:"explicit = user typed /skillname · implicit = user mentioned skill by name · inferred = agent chose skill autonomously"})]}),s.jsxs(qt,{className:"text-[11px] h-8 w-[70px]",children:["Confidence ",s.jsx(de,{text:"Model's confidence score (0–100%) when routing this prompt to the skill"})]}),s.jsxs(qt,{className:"text-[11px] h-8 w-[90px]",children:["Agent ",s.jsx(de,{text:"Which agent invoked the skill — main agent or a subagent type (e.g. Explore, Engineer)"})]}),s.jsx(qt,{className:"text-[11px] h-8 w-[70px] text-right",children:"Time"})]})}),s.jsx(_a,{children:n.map((c,d)=>s.jsxs(Sn,{className:c.triggered?"":"bg-destructive/5",children:[s.jsxs(jt,{className:"max-w-[500px] truncate text-sm py-2",title:c.query||void 0,children:[c.query||s.jsx("span",{className:"text-muted-foreground/40 italic",children:"No prompt recorded"}),!c.triggered&&s.jsx(H,{variant:"destructive",className:"text-[10px] font-normal ml-2",children:"missed"})]}),s.jsx(jt,{className:"py-2",children:c.invocation_mode?s.jsx(H,{variant:"secondary",className:"text-[10px] font-normal",children:c.invocation_mode}):s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"—"})}),s.jsx(jt,{className:"py-2 font-mono text-xs text-muted-foreground tabular-nums",children:c.confidence!==null?`${Math.round(c.confidence*100)}%`:"—"}),s.jsx(jt,{className:"py-2",children:c.agent_type?s.jsx(H,{variant:"outline",className:"text-[10px] font-normal",children:c.agent_type}):s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"—"})}),s.jsx(jt,{className:"py-2 font-mono text-[11px] text-muted-foreground text-right whitespace-nowrap",children:c.timestamp?Ie(c.timestamp):""})]},d))})]})})]})}function lx(){var _,G,le;const{name:e}=Tl(),[t,n]=zl(),{data:r,isPending:i,isError:a,error:l,refetch:o}=sx(e);if(!e)return s.jsx("div",{className:"flex flex-1 items-center justify-center py-16",children:s.jsx("p",{className:"text-sm text-destructive",children:"No skill name provided"})});if(i)return s.jsxs("div",{className:"@container/main flex flex-1 flex-col gap-6 p-4 lg:p-6",children:[s.jsx(qe,{className:"h-10 w-64"}),s.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((A,W)=>s.jsx(qe,{className:"h-24 rounded-xl"},W))}),s.jsx(qe,{className:"h-20 rounded-xl"}),s.jsx(qe,{className:"h-64 rounded-xl"})]});if(a)return s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 py-16",children:[s.jsx(nr,{className:"size-10 text-destructive"}),s.jsx("p",{className:"text-sm font-medium text-destructive",children:l instanceof Error?l.message:"Unknown error"}),s.jsxs(ye,{variant:"outline",size:"sm",onClick:()=>o(),children:[s.jsx($n,{className:"mr-2 size-3.5"}),"Retry"]})]});if(!r)return s.jsx("div",{className:"flex flex-1 items-center justify-center py-16",children:s.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)==null?void 0:_.length)??0)===0&&(((G=r.prompt_samples)==null?void 0:G.length)??0)===0&&(((le=r.session_metadata)==null?void 0:le.length)??0)===0)return s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 py-16",children:[s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No data found for skill "',e,'".']}),s.jsxs(ye,{variant:"outline",size:"sm",render:s.jsx(wt,{to:"/"}),children:[s.jsx(Zo,{className:"mr-2 size-3.5"}),"Back to Overview"]})]});const{usage:c,evidence:d,evolution:h,pending_proposals:p,canonical_invocations:f,duration_stats:v,selftune_stats:y,prompt_samples:C,session_metadata:b}=r,E=fs(c.pass_rate,c.total_checks),S=qr[E]??qr.UNKNOWN,j=E==="HEALTHY",D=((y==null?void 0:y.run_count)??0)>0,w=(v==null?void 0:v.missed_triggers)??0,R=new Set(h.map(A=>A.proposal_id)),U=t.get("proposal"),F=U&&R.has(U)?U:h.length>0?h[0].proposal_id:null;O.useEffect(()=>{const A=t.get("proposal");if(F&&A!==F){const W=new URLSearchParams(t);W.set("proposal",F),n(W,{replace:!0});return}if(!F&&A){const W=new URLSearchParams(t);W.delete("proposal"),n(W,{replace:!0})}},[F,t,n]);const $=A=>{const W=new URLSearchParams(t);W.set("proposal",A),n(W,{replace:!0})};[...new Set((b??[]).map(A=>A.model).filter(Boolean))],[...new Set((b??[]).map(A=>A.platform).filter(Boolean))],[...new Set((b??[]).map(A=>A.workspace_path).filter(Boolean))];const z=(f??[]).map(A=>({timestamp:A.timestamp||A.occurred_at||null,session_id:A.session_id,triggered:A.triggered,query:A.query??"",source:A.source??"",invocation_mode:A.invocation_mode??null,confidence:A.confidence??null,tool_name:A.tool_name??null,agent_type:A.agent_type??null}));z.sort((A,W)=>(W.timestamp??"").localeCompare(A.timestamp??""));const k=new Map;for(const A of z){const W=A.session_id??"unknown",m=k.get(W);m?m.push(A):k.set(W,[A])}const B=new Map((b??[]).map(A=>[A.session_id,A])),M=[...k.entries()].sort(([,A],[,W])=>{var m,me;return(((m=W[0])==null?void 0:m.timestamp)??"").localeCompare(((me=A[0])==null?void 0:me.timestamp)??"")});return s.jsx(ds,{defaultValue:h.length>0?"evidence":"invocations",children:s.jsxs("div",{className:"@container/main flex flex-1 flex-col gap-4 p-4 lg:px-6 lg:pb-6 lg:pt-0",children:[s.jsxs("div",{className:"flex items-center gap-3 sticky top-0 z-30 bg-background py-1.5 border-b border-border/50",children:[s.jsx("h1",{className:"text-base font-semibold tracking-tight lg:text-lg shrink-0",children:r.skill_name}),s.jsxs(H,{variant:S.variant,className:"gap-1 shrink-0 text-[10px]",children:[S.icon,S.label]}),s.jsxs(hs,{variant:"line",className:"ml-auto",children:[h.length>0&&s.jsxs(ht,{children:[s.jsxs(ft,{render:s.jsx(He,{value:"evidence"}),children:["Evidence",F&&s.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["#",F.slice(0,8)]})]}),s.jsx(pt,{children:"Change history and validation results"})]}),s.jsxs(ht,{children:[s.jsxs(ft,{render:s.jsx(He,{value:"invocations"}),children:["Invocations",s.jsx(H,{variant:"secondary",className:"text-[10px]",children:z.length})]}),s.jsx(pt,{children:"Recent skill triggers and their outcomes"})]}),p.length>0&&s.jsxs(ht,{children:[s.jsxs(ft,{render:s.jsx(He,{value:"pending"}),children:["Pending",s.jsx(H,{variant:"destructive",className:"text-[10px]",children:p.length})]}),s.jsx(pt,{children:"Proposals awaiting review"})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-4 @xl/main:grid-cols-2 @5xl/main:grid-cols-4",children:[s.jsx(ne,{className:"@container/card",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[s.jsx(ca,{className:"size-3.5"}),"Trigger Rate",s.jsx(de,{text:"Percentage of skill checks that resulted in this skill being triggered"})]}),s.jsx(ie,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl ${c.total_checks>0&&!j?"text-red-600":""}`,children:c.total_checks>0?mt(c.pass_rate):"--"}),s.jsx(Xe,{children:c.total_checks>0?s.jsxs(H,{variant:j?"outline":"destructive",children:[j?s.jsx(Zn,{className:"size-3"}):s.jsx(er,{className:"size-3"}),mt(c.pass_rate)]}):s.jsx(H,{variant:"secondary",className:"text-[10px]",children:"no checks yet"})})]})}),s.jsx(ne,{className:"@container/card",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[s.jsx(tr,{className:"size-3.5"}),"Total Checks",s.jsx(de,{text:"Total evaluation checks run across all sessions for this skill"})]}),s.jsx(ie,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:c.total_checks})]})}),s.jsx(ne,{className:"@container/card",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[s.jsx(sn,{className:"size-3.5"}),"Triggered",s.jsx(de,{text:"Number of times this skill was invoked by the agent during sessions"})]}),s.jsx(ie,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:c.triggered_count})]})}),s.jsx(ne,{className:"@container/card",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[s.jsx(as,{className:"size-3.5"}),"Sessions",s.jsx(de,{text:"Number of unique agent sessions where this skill was present"})]}),s.jsx(ie,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:r.sessions_with_skill})]})}),s.jsx(ne,{className:"@container/card",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[s.jsx(ec,{className:"size-3.5"}),"LLM Calls",s.jsx(de,{text:"Total LLM calls made by selftune when evolving this skill"})]}),s.jsx(ie,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:D?(y==null?void 0:y.total_llm_calls)??0:"--"}),s.jsx(Xe,{children:D?s.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[(y==null?void 0:y.run_count)??0," evolution runs"]}):s.jsx(H,{variant:"secondary",className:"text-[10px]",children:"no evolution runs yet"})})]})}),s.jsx(ne,{className:"@container/card",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[s.jsx(ss,{className:"size-3.5"}),"Avg Duration",s.jsx(de,{text:"Average time selftune spent evolving this skill per run"})]}),s.jsx(ie,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:D?Vi((y==null?void 0:y.avg_elapsed_ms)??0):"--"}),s.jsx(Xe,{children:D?s.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[Vi((y==null?void 0:y.total_elapsed_ms)??0)," total"]}):s.jsx(H,{variant:"secondary",className:"text-[10px]",children:"no evolution runs yet"})})]})}),s.jsx(ne,{className:"@container/card",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[s.jsx(tc,{className:"size-3.5"}),"Missed Triggers",s.jsx(de,{text:"Number of times this skill was evaluated but did not trigger. High counts may indicate the skill description needs evolution."})]}),s.jsx(ie,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl ${w>0?"text-amber-600":""}`,children:w})]})}),s.jsx(ne,{className:"@container/card",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[s.jsx(nc,{className:"size-3.5"}),"Avg Confidence",s.jsx(de,{text:"Average model confidence score when routing user prompts to this skill"})]}),s.jsx(ie,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:(()=>{const A=z.filter(W=>W.confidence!==null);return A.length>0?mt(A.reduce((W,m)=>W+(m.confidence??0),0)/A.length):"--"})()})]})})]}),s.jsxs("div",{className:"flex gap-6",children:[h.length>0&&s.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:s.jsx(Fm,{entries:h,selectedProposalId:F,onSelect:$})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[h.length>0&&s.jsx(Rt,{value:"evidence",children:F?s.jsx(_m,{proposalId:F,evolution:h,evidence:d}):s.jsx("div",{className:"flex items-center justify-center rounded-lg border border-dashed py-12",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a proposal from the timeline"})})}),s.jsx(Rt,{value:"invocations",children:z.length===0?s.jsx(ne,{children:s.jsx(Ze,{className:"py-12",children:s.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"No invocation records yet."})})}):s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[s.jsxs("span",{children:[z.length," invocations across ",M.length," sessions"]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(H,{variant:"secondary",className:"text-[9px] font-normal",children:"explicit"})," user typed /skill"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(H,{variant:"secondary",className:"text-[9px] font-normal",children:"implicit"})," mentioned by name"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(H,{variant:"secondary",className:"text-[9px] font-normal",children:"inferred"})," agent chose autonomously"]})]})]}),M.map(([A,W],m)=>{const me=B.get(A);return s.jsx(ax,{sessionId:A,meta:me,invocations:W,defaultExpanded:m<3},A)})]})}),p.length>0&&s.jsx(Rt,{value:"pending",children:s.jsxs(ne,{children:[s.jsxs(se,{children:[s.jsx(ie,{className:"text-sm",children:"Pending Proposals"}),s.jsxs(ce,{children:[p.length," awaiting review"]})]}),s.jsx(Ze,{className:"space-y-3",children:p.map(A=>s.jsxs("button",{type:"button",onClick:()=>$(A.proposal_id),className:"flex gap-3 rounded-lg border p-3 w-full text-left hover:bg-accent/50 transition-colors",children:[s.jsx("div",{className:"mt-0.5 size-2 shrink-0 rounded-full bg-amber-400"}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(H,{variant:ix[A.action]??"secondary",className:"text-[10px]",children:A.action}),s.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:Ie(A.timestamp)}),s.jsxs("span",{className:"text-[10px] text-muted-foreground/60 font-mono ml-auto",children:["#",A.proposal_id.slice(0,8)]})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:A.details})]})]},A.proposal_id))})]})})]})]})]})})}const ox=6e4;function cx(){return rr({queryKey:["doctor"],queryFn:Xm,staleTime:5e3,refetchInterval:ox})}const ux={pass:{icon:s.jsx(Je,{className:"size-4 text-emerald-600"}),variant:"outline",label:"Pass"},warn:{icon:s.jsx(xt,{className:"size-4 text-amber-500"}),variant:"secondary",label:"Warning"},fail:{icon:s.jsx(Me,{className:"size-4 text-red-500"}),variant:"destructive",label:"Fail"}},dx={config:{label:"Configuration",description:"selftune.json exists and contains valid agent_type and llm_mode",icon:s.jsx(sc,{className:"size-4 text-muted-foreground"})},log_session_telemetry:{label:"Session Telemetry Log",description:"session_telemetry_log.jsonl exists and records parse correctly",icon:s.jsx(xn,{className:"size-4 text-muted-foreground"})},log_skill_usage:{label:"Skill Usage Log",description:"skill_usage_log.jsonl exists and records parse correctly",icon:s.jsx(xn,{className:"size-4 text-muted-foreground"})},log_all_queries:{label:"Query Log",description:"all_queries_log.jsonl exists and records parse correctly",icon:s.jsx(xn,{className:"size-4 text-muted-foreground"})},log_evolution_audit:{label:"Evolution Audit Log",description:"evolution_audit_log.jsonl exists and records parse correctly",icon:s.jsx(xn,{className:"size-4 text-muted-foreground"})},hook_settings:{label:"Hook Installation",description:"Claude Code settings.json has all required selftune hooks configured",icon:s.jsx(rc,{className:"size-4 text-muted-foreground"})},evolution_audit:{label:"Evolution Health",description:"Evolution audit log is intact and records are well-formed",icon:s.jsx(is,{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:s.jsx(ua,{className:"size-4 text-muted-foreground"})}};function hx({check:e}){const t=dx[e.name]??{label:e.name,description:"",icon:s.jsx(ua,{className:"size-4 text-muted-foreground"})},n=ux[e.status]??{icon:s.jsx(nr,{className:"size-4 text-muted-foreground"}),variant:"outline",label:e.status};return s.jsxs(ne,{children:[s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[t.icon,t.label,t.description&&s.jsx(de,{text:t.description})]}),s.jsx(ie,{className:"text-sm font-medium",children:e.message||"No details"}),s.jsx(Xe,{children:s.jsxs(H,{variant:n.variant,className:"gap-1",children:[n.icon,n.label]})})]}),e.path&&s.jsx(Ze,{className:"pt-0",children:s.jsx("p",{className:"text-[11px] text-muted-foreground font-mono truncate",children:e.path})})]})}function fx(){const{data:e,isPending:t,isError:n,error:r,refetch:i}=cx();if(t)return s.jsxs("div",{className:"@container/main flex flex-1 flex-col gap-6 p-4 lg:p-6",children:[s.jsx(qe,{className:"h-8 w-48"}),s.jsx("div",{className:"grid grid-cols-1 gap-4 @xl/main:grid-cols-2",children:Array.from({length:7}).map((j,D)=>s.jsx(qe,{className:"h-24 rounded-xl"},D))})]});if(n)return s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 py-16",children:[s.jsx(nr,{className:"size-10 text-destructive"}),s.jsx("p",{className:"text-sm font-medium text-destructive",children:r instanceof Error?r.message:"Unknown error"}),s.jsxs(ye,{variant:"outline",size:"sm",onClick:()=>i(),children:[s.jsx($n,{className:"mr-2 size-3.5"}),"Retry"]})]});if(!e)return s.jsx("div",{className:"flex flex-1 items-center justify-center py-16",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"No diagnostics data available."})});const{checks:a,summary:l,healthy:o=!1,timestamp:u}=e,c=a??[],d=l??{pass:0,warn:0,fail:0},h=c.find(j=>j.name==="dashboard_freshness_mode"),p=c.filter(j=>j.name==="config"),f=c.filter(j=>j.name.startsWith("log_")),v=c.filter(j=>j.name==="hook_settings"),y=c.filter(j=>j.name==="evolution_audit"),C=c.filter(j=>j.name==="dashboard_freshness_mode"),b=new Set(["config",...f.map(j=>j.name),"hook_settings","evolution_audit","dashboard_freshness_mode"]),E=c.filter(j=>!b.has(j.name)),S=[{title:"Configuration",checks:p},{title:"Log Files",checks:f},{title:"Hooks",checks:v},{title:"Evolution",checks:y},{title:"Integrity",checks:C},{title:"Other",checks:E}].filter(j=>j.checks.length>0);return s.jsxs("div",{className:"@container/main flex flex-1 flex-col gap-6 p-4 lg:p-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(sa,{className:"size-5 text-muted-foreground"}),s.jsx("h1",{className:"text-base font-semibold tracking-tight lg:text-lg",children:"System Status"}),s.jsxs(H,{variant:o?"outline":"destructive",className:"gap-1",children:[o?s.jsx(Je,{className:"size-3 text-emerald-600"}):s.jsx(Me,{className:"size-3"}),o?"Healthy":"Unhealthy"]}),s.jsxs("span",{className:"text-xs text-muted-foreground ml-auto",children:["Last checked ",u?Ie(u):"—"]}),s.jsx(ye,{"aria-label":"Refresh status",title:"Refresh status",variant:"ghost",size:"sm",onClick:()=>i(),className:"shrink-0",children:s.jsx($n,{className:"size-3.5"})})]}),(h==null?void 0:h.status)==="warn"&&s.jsx(ne,{className:"border-amber-200 bg-amber-50/60 dark:border-amber-900/50 dark:bg-amber-950/20",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5 text-amber-800 dark:text-amber-300",children:[s.jsx(xt,{className:"size-4"}),"Legacy freshness mode active"]}),s.jsx(ie,{className:"text-sm font-medium text-amber-950 dark:text-amber-100",children:h.message})]})}),s.jsxs("div",{className:"grid grid-cols-3 gap-4 px-0",children:[s.jsx(ne,{className:"@container/card",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[s.jsx(Je,{className:"size-3.5 text-emerald-600"}),"Passed"]}),s.jsx(ie,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:d.pass})]})}),s.jsx(ne,{className:"@container/card",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[s.jsx(xt,{className:"size-3.5 text-amber-500"}),"Warnings"]}),s.jsx(ie,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl ${d.warn>0?"text-amber-500":""}`,children:d.warn})]})}),s.jsx(ne,{className:"@container/card",children:s.jsxs(se,{children:[s.jsxs(ce,{className:"flex items-center gap-1.5",children:[s.jsx(Me,{className:"size-3.5 text-red-500"}),"Failed"]}),s.jsx(ie,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl ${d.fail>0?"text-red-600":""}`,children:d.fail})]})})]}),S.map(j=>s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:j.title}),s.jsx("div",{className:"grid grid-cols-1 gap-3 @xl/main:grid-cols-2",children:j.checks.map((D,w)=>s.jsx(hx,{check:D},`${D.name}-${w}`))})]},j.title))]})}const px=6e4;function mx(){return rr({queryKey:["overview"],queryFn:Gm,staleTime:5e3,refetchInterval:px})}function xx(e){if(typeof e!="object"||e===null)return!1;const 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==="jsonl"||t.watcher_mode==="none")}function gx(){const[e,t]=O.useState(null);if(O.useEffect(()=>{fetch("/api/health").then(r=>r.json()).then(r=>{xx(r)&&t(r)}).catch(()=>{})},[]),!e)return null;const n=e.watcher_mode==="jsonl";return s.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:s.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-[11px] font-mono text-muted-foreground",children:[s.jsx("span",{title:"Workspace root",children:e.workspace_root}),s.jsx("span",{title:"Git SHA",children:e.git_sha}),s.jsx("span",{title:"Database path",children:e.db_path}),s.jsxs("span",{title:"Process mode",children:["mode: ",e.process_mode]}),s.jsxs("span",{title:"Watcher mode",className:n?"text-amber-700 dark:text-amber-300":void 0,children:["watcher: ",e.watcher_mode]}),n&&s.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"})]})})}function bx(){const e=wa();O.useEffect(()=>{const t=new EventSource("/api/v2/events");return t.addEventListener("update",()=>{e.invalidateQueries()}),t.onerror=()=>{},()=>{t.close()}},[e])}const yx=new Gc({defaultOptions:{queries:{refetchOnWindowFocus:!0,gcTime:300*1e3}}});function vx(){return s.jsxs(s.Fragment,{children:[s.jsx(ms,{}),s.jsx(lx,{})]})}function jx(){return s.jsxs(s.Fragment,{children:[s.jsx(ms,{}),s.jsx(fx,{})]})}function wx(){bx();const[e,t]=O.useState(""),[n,r]=O.useState("ALL"),i=mx(),{data:a}=i,l=O.useMemo(()=>a?za(a.skills.map(u=>({name:u.skill_name,scope:u.skill_scope,status:fs(u.pass_rate,u.total_checks),passRate:u.total_checks>0?u.pass_rate:null,checks:u.total_checks}))):[],[a]),o=O.useMemo(()=>{if(!e)return l;const u=e.toLowerCase();return l.filter(c=>c.name.toLowerCase().includes(u))},[l,e]);return s.jsxs(zu,{children:[s.jsx(Vu,{skills:o,search:e,onSearchChange:t,version:a==null?void 0:a.version}),s.jsx(Au,{children:s.jsxs(Rl,{children:[s.jsx(cr,{path:"/",element:s.jsxs(s.Fragment,{children:[s.jsx(ms,{}),s.jsx(nx,{search:e,statusFilter:n,onStatusFilterChange:r,overviewQuery:i})]})}),s.jsx(cr,{path:"/skills/:name",element:s.jsx(vx,{})}),s.jsx(cr,{path:"/status",element:s.jsx(jx,{})})]})}),s.jsx(gx,{})]})}function kx(){return s.jsx(Wc,{client:yx,children:s.jsx(Pl,{children:s.jsx(Gu,{defaultTheme:"dark",children:s.jsx(Ta,{children:s.jsx(wx,{})})})})})}Al.createRoot(document.getElementById("root")).render(s.jsx(O.StrictMode,{children:s.jsx(kx,{})}));
|