cartethyia 2.3.3 → 2.4.0

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.
Files changed (29) hide show
  1. package/dist/dashboard/assets/{BannedPage-B8MQBL1Y.js → BannedPage-CvnNj-tj.js} +1 -1
  2. package/dist/dashboard/assets/{CliToolDetailPage-DAAUVo7w.js → CliToolDetailPage-DdYuTZKs.js} +1 -1
  3. package/dist/dashboard/assets/{CliToolsPage--hLkg7LU.js → CliToolsPage-Ba55GO-L.js} +1 -1
  4. package/dist/dashboard/assets/{ConsoleLogPage-CRaToMW5.js → ConsoleLogPage-D-OQwsYE.js} +1 -1
  5. package/dist/dashboard/assets/{CustomizationPage-CYiaepa1.js → CustomizationPage-BMqN7mc4.js} +1 -1
  6. package/dist/dashboard/assets/{HealthEventsModal-CjsAm6Gm.js → HealthEventsModal-C5cygmiy.js} +1 -1
  7. package/dist/dashboard/assets/{LoginPage-DVL5oW3v.js → LoginPage-lI7CDb07.js} +1 -1
  8. package/dist/dashboard/assets/{OverviewPage-DJ8WM59t.js → OverviewPage-HaMJcZaC.js} +1 -1
  9. package/dist/dashboard/assets/{ProviderDetailPage-CK0q-HYZ.js → ProviderDetailPage-Pb-0zXVA.js} +1 -1
  10. package/dist/dashboard/assets/{ProvidersPage-BdVj-Vab.js → ProvidersPage-KifbSUkV.js} +1 -1
  11. package/dist/dashboard/assets/{ProxyPage-CTohaici.js → ProxyPage-DKLnIcne.js} +1 -1
  12. package/dist/dashboard/assets/{QuotaPage-CkHjJoim.js → QuotaPage-BzG3XTSg.js} +1 -1
  13. package/dist/dashboard/assets/{SetupPage-CRahC2bj.js → SetupPage-Cu42oonZ.js} +1 -1
  14. package/dist/dashboard/assets/{StudioPage-CxDqECuN.js → StudioPage-DIglSNvf.js} +1 -1
  15. package/dist/dashboard/assets/{UsagePage-TzfUYdQD.js → UsagePage-DQh2rUsY.js} +1 -1
  16. package/dist/dashboard/assets/{entry-KOZCZ9VG.js → entry-6PSJYbzI.js} +3 -3
  17. package/dist/dashboard/assets/{index-Bj96PK8B.js → index-Bysq3XgY.js} +2 -2
  18. package/dist/dashboard/index.html +1 -1
  19. package/package.json +2 -1
  20. package/scripts/cli/cli-launcher.cjs +12 -1
  21. package/scripts/cli/cli.ts +923 -794
  22. package/scripts/cli/menu.ts +107 -0
  23. package/scripts/cli/runtime-state.ts +78 -0
  24. package/scripts/cli/setup.ts +448 -443
  25. package/scripts/cli/version.ts +66 -0
  26. package/scripts/cli/wordmark.ts +58 -0
  27. package/src/boot/app.ts +39 -0
  28. package/src/console/auth/account-reset.ts +67 -0
  29. package/src/console/backup/export-endpoint.ts +111 -0
@@ -1 +1 @@
1
- import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CXUMngI_.js";import{i}from"./terminal-C9mZ4Ugm.js";import{t as a}from"./check-D69FzdvC.js";import{t as o}from"./select-CGUuTQmj.js";import{t as s}from"./chevron-right-BXIy5l3h.js";import{m as c,n as l,t as u}from"./toast-DKAdP2mo.js";import{t as d}from"./eye-off-Bk5g2luF.js";import{a as f,i as p,n as m,r as h,t as g}from"./state-DHKdg-pm.js";import{t as _}from"./dialog-iocKA3jr.js";import{t as v}from"./refresh-cw-BqJFk4sU.js";import{t as y}from"./rotate-ccw-CufcqITi.js";import{t as b}from"./sliders-horizontal-ClG7dBeJ.js";import{t as x}from"./trash-Cppn5c3R.js";import{c as S}from"./query-keys-ROf-g1Wi.js";import{F as C}from"./entry-KOZCZ9VG.js";import{n as w,r as T,t as E}from"./card-BTdbRFFg.js";import{t as D}from"./badge-BwmwEOgA.js";import{t as O}from"./ProviderIcon-paOCq8I0.js";import{t as k}from"./switch-DIDeAiz9.js";import{t as A}from"./stack-C1kTcOmP.js";import{n as j}from"./inline-DCejSLlA.js";import{t as M}from"./layout-Bv-NxqZ5.js";import{a as ee,i as N,n as P,o as F,r as I,s as L,t as R}from"./quota-DZGyp0N5.js";import{a as te,c as z,d as B,f as V,i as H,l as U,n as W,o as ne,p as G,r as re,s as K,t as q,u as J}from"./HealthEventsModal-CjsAm6Gm.js";var Y=e(`calendar-check`,[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`m9 15 2 2 4-4`,key:`1grp1n`}]]),ie=e(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),X=e(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Z=e(`zap`,[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]),Q=t(n(),1),$=r();function ae(e){return!!(e.quota?.windows.length&&e.quota.windows.every(e=>e.remainingPercent!==null&&e.remainingPercent<=0))}function oe(e){let t=e.quota?.windows.map(e=>e.resetsAt?new Date(e.resetsAt).getTime():1/0)??[];return Math.min(...t,1/0)}function se({account:e,onClose:t}){let n=H(e.id,!0),r=J(e.id),i=n.data?.credits??[],a=e=>e?new Date(e).toLocaleString():`—`,o=e=>e?new Date(e).toLocaleString():`—`,s=e=>{if(!e)return``;let t=new Date(e).getTime()-Date.now();if(!Number.isFinite(t))return``;if(t<=0)return`expired`;let n=Math.floor(t/864e5);if(n>=1)return`in ${n}d`;let r=Math.floor(t/36e5);return r>=1?`in ${r}h`:`in ${Math.max(1,Math.floor(t/6e4))}m`};return(0,$.jsx)(_,{open:!0,onClose:t,size:`lg`,title:`Saved Rate-Limit Resets — ${e.name}`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-7`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6 rounded-control border border-inner-border bg-surface-2 px-8 py-6`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,$.jsx)(Z,{size:14,className:`text-status-success`}),(0,$.jsx)(`span`,{className:`text-body font-semibold`,children:`Available resets`})]}),(0,$.jsx)(`p`,{className:`mt-2 text-text-tertiary text-badge leading-normal`,children:`Each credit lifts a spent rate-limit window before its natural reset.`})]}),(0,$.jsxs)(D,{tone:n.data&&n.data.availableCount>0?`ok`:`disabled`,dot:!0,children:[n.data?.availableCount??0,` reset`,(n.data?.availableCount??0)===1?``:`s`]})]}),n.isPending?(0,$.jsx)(h,{label:`Reading saved resets…`}):n.isError?(0,$.jsx)(m,{message:`Failed to read saved resets`,onRetry:()=>void n.refetch()}):i.length===0?(0,$.jsx)(g,{title:`No saved resets`,message:`This account has no saved rate-limit reset credits right now.`,icon:(0,$.jsx)(Z,{size:20})}):(0,$.jsx)(`div`,{className:`max-h-170 overflow-y-auto rounded-control border border-inner-border`,children:(0,$.jsx)(M,{headers:[`Status`,`Title`,`Granted`,`Expires`,``],children:i.map(e=>{let t=(e.status??`available`)===`available`,n=s(e.expiresAt);return(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{className:`whitespace-nowrap align-middle`,children:(0,$.jsx)(D,{tone:t?`ok`:e.status===`expired`?`disabled`:`warn`,children:e.status??`available`})}),(0,$.jsx)(`td`,{className:`text-caption font-medium whitespace-nowrap align-middle text-text-primary`,children:e.title??`Rate-limit reset`}),(0,$.jsx)(`td`,{className:`text-badge whitespace-nowrap tabular-nums align-middle text-text-secondary`,children:a(e.grantedAt)}),(0,$.jsxs)(`td`,{className:`text-badge whitespace-nowrap tabular-nums align-middle text-text-secondary`,children:[o(e.expiresAt),n&&(0,$.jsxs)(`span`,{className:`ml-3 text-text-tertiary`,children:[`(`,n,`)`]})]}),(0,$.jsx)(`td`,{className:`whitespace-nowrap text-right align-middle`,children:(0,$.jsx)(l,{size:`sm`,variant:t?`primary`:`secondary`,disabled:!t||r.isPending,onClick:()=>r.mutate({creditId:e.id},{onSuccess:e=>{e.ok?u.success(e.message??`Rate limit reset applied`):u.error(e.message??`Rate limit reset failed`)},onError:e=>{u.error(S(e,`Unable to redeem rate-limit reset`))}}),children:`Use`})})]},e.id)})})}),(0,$.jsx)(j,{justify:`flex-end`,gap:`0px`,children:(0,$.jsx)(l,{variant:`secondary`,size:`sm`,onClick:t,children:`Close`})})]})})}function ce({accounts:e}){let t=(0,Q.useMemo)(()=>{let t=new Map;for(let n of e){if(!W(n.provider))continue;let e=t.get(n.provider);e?e.count+=1:t.set(n.provider,{id:n.provider,label:n.providerName||n.provider,count:1})}return[...t.values()]},[e]),[n,r]=(0,Q.useState)(``),i=(t.find(e=>e.id===n)??t[0])?.id??``,a=V(i),s=i.length===0||a.isPending||t.length===0;return(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2.5`,"aria-label":`Daily growth actions`,children:[(0,$.jsx)(`div`,{className:`min-w-0 w-67.5`,children:(0,$.jsx)(o,{"aria-label":`Provider for the daily growth pass`,value:i,onValueChange:r,className:`w-full h-16`,options:t.length>0?t.map(e=>({value:e.id,label:`${e.label} · ${e.count}`})):[{value:``,label:`No buddy providers`}]})}),(0,$.jsx)(l,{variant:`secondary`,size:`sm`,title:`Send the activity report, then claim the daily check-in, for every account of this provider`,"aria-label":`Run the daily growth pass for this provider`,disabled:s,className:`shrink-0`,icon:a.isPending?(0,$.jsx)(c,{size:13,className:`animate-spin`}):(0,$.jsx)(Y,{size:13}),onClick:()=>a.mutate(void 0,{onSuccess:e=>{let t=e.data.filter(e=>!e.report.ok).length;t===0?u.success(e.message):u.error(`${e.message} — ${t} report${t===1?``:`s`} failed`)},onError:e=>u.error(S(e,`Unable to run the daily growth pass`))}),children:`Daily growth`})]})}function le({account:e,onToggle:t,onDelete:n,onShowHealth:r,onShowResets:a}){let o=K(e.id),d=B(e.id),p=W(e.provider),m=re(e.provider),h=H(e.id,m),g=e.quota,[_,v]=(0,Q.useState)(0),b=g?.windows??[],C=F(b,_),w=C.pageCount;(0,Q.useEffect)(()=>{v(e=>Math.min(e,Math.max(0,w-1)))},[w]);let T=o.isPending||d.isPending,D=h.data?.availableCount??0,[A,j]=(0,Q.useState)(null),[M,te]=(0,Q.useState)(!1),z=e.checkin?.attemptedToday??!1,V=`${A?A.state===`claimed`?`Checked in${A.credit===null?``:` +${A.credit}`}${A.streakDays===null?``:` · ${A.streakDays}d streak`}`:A.state===`already_claimed`?`Check-in attempted · already claimed`:A.state===`not_eligible`?`Check-in attempted · not eligible`:A.state===`event_ended`?`Check-in attempted · event ended`:`Check-in attempted · unavailable`:z?`Check-in attempted today`:`Check-in due`}${M?` · Reported today`:``}`,U=b.reduce((e,t)=>{let n=t.limit;if(typeof n!=`number`||!Number.isFinite(n))return e;let r=typeof t.remaining==`number`&&Number.isFinite(t.remaining)?t.remaining:typeof t.used==`number`&&Number.isFinite(t.used)?n-t.used:typeof t.remainingPercent==`number`&&Number.isFinite(t.remainingPercent)?n*t.remainingPercent/100:null;return r===null?e:e+Math.max(0,r)},0),ne=(o.error?S(o.error,`Unable to refresh this account`):null)??g?.refreshError??g?.error??e.health?.sanitizedMessage,G=ee(ne),q=G===`Quota tracking is not supported for this provider`?null:G,J=R(e.credentialHint,e.name),X=e.health?.status??`unknown`;return(0,$.jsxs)(E,{className:`flex h-full flex-col overflow-hidden`,"aria-busy":T,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5 px-7 py-4`,children:[(0,$.jsx)(O,{icon:e.providerIcon,name:e.providerName,size:32}),(0,$.jsxs)(`div`,{className:`flex-[1_1_160px]`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-4`,children:[(0,$.jsx)(`div`,{className:`truncate text-caption font-bold text-text-primary text-body`,children:e.providerName}),g?.plan&&(0,$.jsx)(`span`,{className:`shrink-0 rounded-chip bg-accent-soft px-4 py-1 text-micro font-semibold text-accent`,children:g.plan})]}),(0,$.jsx)(`div`,{className:`truncate text-badge text-text-secondary`,children:J.primary}),J.secondary!==null&&(0,$.jsx)(`div`,{className:`truncate text-micro text-text-tertiary`,children:J.secondary}),g&&(0,$.jsx)(`div`,{className:`truncate text-micro text-text-tertiary`,children:P(g.lastSuccessAt??g.fetchedAt)}),m&&(0,$.jsx)(`div`,{className:`truncate text-micro flex items-center gap-2 text-text-tertiary`,title:`Saved rate-limit reset credits available on this account`,children:h.isPending?`Checking saved resets…`:D>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{size:10,className:`text-status-success shrink-0`,"aria-hidden":`true`}),(0,$.jsxs)(`span`,{className:`reset-credit-live`,children:[D,` rate-limit reset`,D===1?``:`s`,` available`]})]}):`No rate-limit resets available`}),p&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{title:`Daily growth state: manual pass result, else the sweep ledger for today`,className:`truncate text-micro text-text-tertiary`,children:d.isPending?`Running growth pass…`:V}),b.some(e=>typeof e.limit==`number`&&Number.isFinite(e.limit))&&(0,$.jsxs)(`div`,{className:`truncate text-micro text-text-tertiary`,children:[`Total credits: `,U.toLocaleString(void 0,{maximumFractionDigits:2})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.75 gap-3 ml-auto`,children:[m&&(0,$.jsx)(l,{variant:`ghost`,size:`icon`,className:`w-16 h-16 p-0`,title:h.isPending?`Checking saved rate-limit resets…`:D>0?`Saved rate-limit resets (${D} available)`:`Saved rate-limit resets`,"aria-label":`Open saved rate-limit resets for ${e.name}`,disabled:T,onClick:()=>a(e),children:(0,$.jsx)(Z,{size:14})}),p&&(0,$.jsx)(l,{variant:`ghost`,size:`icon`,className:`w-16 h-16 p-0`,title:`Daily growth pass (check-in + activity report) — ${V}`,"aria-label":`Run daily growth pass for ${e.name}`,disabled:T,onClick:()=>d.mutate(void 0,{onSuccess:e=>{let t=e.checkin.data;t&&j({state:t.state,credit:t.credit,streakDays:t.streakDays}),e.report.ok&&te(!0),e.ok?u.success(e.message):u.error(e.message)},onError:e=>{u.error(S(e,`Unable to run daily growth pass`))}}),children:d.isPending?(0,$.jsx)(c,{size:14,className:`animate-spin`}):(0,$.jsx)(Y,{size:14})}),(0,$.jsx)(l,{variant:`ghost`,size:`sm`,title:X===`active`?`Health & Error Log`:`${X} — Inspect account health details`,"aria-label":X===`active`?`Health log for ${e.name}`:`Account is ${X} — inspect health details for ${e.name}`,disabled:T,onClick:()=>r(e),icon:(0,$.jsx)(i,{size:12})}),(0,$.jsx)(l,{variant:`ghost`,size:`sm`,title:`Refresh quota`,"aria-label":`Refresh ${e.name} quota`,disabled:T,onClick:()=>o.mutate(),icon:o.isPending?(0,$.jsx)(c,{size:12,className:`animate-spin`}):(0,$.jsx)(y,{size:12})}),(0,$.jsx)(l,{variant:`ghost`,size:`sm`,title:`Delete account`,"aria-label":`Delete ${e.name}`,onClick:()=>n(e),className:`text-red`,icon:(0,$.jsx)(x,{size:12})}),(0,$.jsx)(k,{checked:e.active,disabled:o.isPending,onChange:n=>t(e,n),label:``,id:`switch-${e.id}`})]})]}),q&&(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-4 border-t border-inner-border px-8 py-5 text-center text-badge text-red`,role:`alert`,children:[(0,$.jsx)(f,{size:13,className:`shrink-0`}),(0,$.jsx)(`span`,{children:q})]}),g?.windows.length?(0,$.jsxs)(`div`,{className:`quota-window-list flex flex-1 flex-col gap-4 border-t border-inner-border px-7 py-4.5`,children:[(0,$.jsx)(`div`,{className:`quota-window-section-label text-micro font-bold tracking-label text-text-tertiary`,children:`QUOTA WINDOWS`}),C.items.map((e,t)=>{let n=e.remainingPercent??null,r=typeof e.limit==`number`&&Number.isFinite(e.limit)?e.limit:null,i=typeof e.used==`number`&&Number.isFinite(e.used)?e.used:r!==null&&e.usedPercent!==null&&e.usedPercent!==void 0?r*e.usedPercent/100:null,a=L(n),o=n===null?0:Math.max(0,Math.min(100,n)),s=e=>e.toLocaleString(void 0,{maximumFractionDigits:2}),c=e=>{let t=Math.round(e*10)/10;return t>0&&t<.1?`<0.1`:t.toLocaleString(void 0,{maximumFractionDigits:1})},l=I(e.label);return(0,$.jsxs)(`div`,{className:`quota-window-row grid grid-cols-quota-window min-w-0 items-center gap-x-6 gap-y-2 max-small:grid-cols-[minmax(0,1fr)_auto] max-small:gap-x-4 max-small:gap-y-2.5`,children:[(0,$.jsx)(`div`,{className:`quota-window-heading min-w-0 max-small:col-start-1`,children:(0,$.jsx)(`span`,{className:`text-badge font-semibold text-text-primary`,children:l})}),(0,$.jsx)(`div`,{className:`quota-bar-track quota-window-bar min-w-0 w-full h-5 rounded-tiny bg-inner-border overflow-hidden max-small:col-span-full max-small:row-start-2`,role:`progressbar`,"aria-label":`${l} remaining quota`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":n===null?void 0:o,"aria-valuetext":n===null?`Quota only`:`${c(n)}% remaining`,children:(0,$.jsx)(`div`,{className:`quota-bar-fill h-full rounded-tiny transition-[width] duration-(--dur-macro) ease-spring`,style:{width:`${o}%`,background:a.bar}})}),(0,$.jsx)(`span`,{className:`quota-window-remaining whitespace-nowrap text-badge font-bold tabular-nums max-small:col-start-2 max-small:row-start-1`,style:{color:a.text},children:n===null?`—`:`${c(n)}%`}),(0,$.jsxs)(`div`,{className:`quota-window-details col-span-full flex min-w-0 items-center justify-end gap-6 text-micro text-text-tertiary max-small:row-start-3 max-small:flex-wrap max-small:justify-between max-small:gap-4`,children:[(0,$.jsx)(`span`,{className:`quota-window-usage mr-auto tabular-nums max-small:min-w-0`,children:i!==null&&r!==null?`${s(i)} / ${s(r)} Credits`:`Quota only`}),e.resetsAt&&(0,$.jsx)(`span`,{className:`quota-window-reset whitespace-nowrap tabular-nums text-right max-small:ml-auto`,children:N(e.resetsAt,e.recurring)})]})]},`${e.kind??e.label}:${e.resetsAt??`none`}:${t}`)}),C.pageCount>1&&(0,$.jsxs)(`nav`,{"aria-label":`Quota windows for ${e.name}`,className:`quota-window-pagination mt-auto flex items-center justify-between gap-4 border-t border-inner-border pt-4 max-small:flex-wrap`,children:[(0,$.jsxs)(`span`,{"aria-live":`polite`,className:`text-micro text-text-tertiary`,children:[`Showing `,C.startIndex+1,`–`,C.startIndex+C.items.length,` of `,b.length]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(l,{variant:`ghost`,size:`sm`,"aria-label":`Previous quota windows for ${e.name}`,disabled:C.page===0,icon:(0,$.jsx)(ie,{size:13}),onClick:()=>v(C.page-1),className:`h-14 px-4 py-0`,children:`Previous`}),(0,$.jsx)(l,{variant:`ghost`,size:`sm`,"aria-label":`Next quota windows for ${e.name}`,disabled:C.page>=C.pageCount-1,icon:(0,$.jsx)(s,{size:13}),onClick:()=>v(C.page+1),className:`h-14 px-4 py-0`,children:`Next`})]})]})]}):q?null:(0,$.jsx)(`div`,{className:`border-t border-inner-border px-7 py-9 text-center text-badge text-text-tertiary`,children:T||e.pending?`Fetching quota…`:`No quota data`})]})}function ue(){let[e,t]=(0,Q.useState)(`all`),[n,r]=(0,Q.useState)(`all`),[i,s]=(0,Q.useState)(!1),{data:c,isLoading:f,isError:m,error:h,isFetching:_,dataUpdatedAt:y,refetch:x}=ne(),S=(0,Q.useMemo)(()=>[...c?.providers??[]].sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`})),[c?.providers]),D=(0,Q.useMemo)(()=>c?.accounts??[],[c?.accounts]),O=c?.refreshing??0,k=z(),j=G(),M=U(),ee=te(),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(null),B=(0,Q.useMemo)(()=>{let t=D.filter(t=>{if(e!==`all`&&t.provider!==e)return!1;let r=!!t.quota?.windows.length;return n===`untracked`?!r:!(!r||n===`active`&&!t.active||n===`disabled`&&t.active)}),r=(e,t)=>e.providerName.localeCompare(t.providerName,void 0,{sensitivity:`base`})||e.name.localeCompare(t.name,void 0,{sensitivity:`base`});return[...t].sort(i?(e,t)=>oe(e)-oe(t)||r(e,t):r)},[n,D,i,e]),V=async(e,t)=>{try{await j.mutateAsync({id:e.id,active:t}),u.success(`${e.name} ${t?`enabled`:`disabled`}`)}catch(e){u.error(e instanceof Error?e.message:`Unable to update account`)}},H=async()=>{let e=D.filter(e=>e.active&&ae(e));await M.mutateAsync({ids:e.map(e=>e.id),active:!1}),u.success(`Disabled ${e.length} empty accounts`)},W=async()=>{let e=D.filter(e=>!e.active&&e.quota?.windows.some(e=>e.remainingPercent!==null&&e.remainingPercent>0));await M.mutateAsync({ids:e.map(e=>e.id),active:!0}),u.success(`Enabled ${e.length} available accounts`)},re=async e=>{await ee.mutateAsync(e.id),u.success(`${e.name} deleted`)},K=y>0?new Date(y).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):`Not updated`,J=D.filter(ae).length;return(0,$.jsxs)(A,{gap:`16px`,className:`dashboard-page min-h-0 flex-1`,children:[(0,$.jsx)(E,{children:(0,$.jsx)(T,{title:`Quota`,subtitle:`Provider account limits and what is left of them`,icon:(0,$.jsx)(b,{size:16})})}),(0,$.jsx)(E,{children:(0,$.jsxs)(w,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-4`,children:[(0,$.jsx)(o,{"aria-label":`Filter quota by provider`,value:e,onValueChange:t,className:`w-full h-16 max-small:w-80`,options:[{value:`all`,label:`All Providers`},...S.map(e=>({value:e.id,label:e.name}))]}),(0,$.jsx)(o,{"aria-label":`Filter quota by account`,value:n,onValueChange:r,className:`w-full h-16 max-small:w-67.5`,options:[{value:`all`,label:`With quota`},{value:`active`,label:`Active`},{value:`disabled`,label:`Disabled`},{value:`untracked`,label:`No quota`}]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,$.jsx)(l,{variant:i?`secondary`:`ghost`,size:`sm`,onClick:()=>s(e=>!e),"aria-pressed":i,icon:(0,$.jsx)(X,{size:13}),children:`Expiring first`}),(0,$.jsx)(l,{variant:`ghost`,size:`sm`,className:`text-red`,disabled:J===0||_,onClick:()=>void H(),icon:(0,$.jsx)(d,{size:13}),children:`Turn off Empty`}),(0,$.jsx)(l,{variant:`ghost`,size:`sm`,className:`text-green`,disabled:_,onClick:()=>void W(),icon:(0,$.jsx)(a,{size:13}),children:`Turn on Available`})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 border-t border-inner-border pt-5`,children:[(0,$.jsxs)(`span`,{className:`text-badge text-text-tertiary`,children:[B.length,` shown`,J>0?` · ${J} empty`:``]}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-5 gap-y-3 text-badge text-text-tertiary`,children:[O>0?`Refreshing ${O} account${O===1?``:`s`}…`:`Auto-refresh 60s · ${K}`,(0,$.jsx)(ce,{accounts:D}),(0,$.jsx)(l,{variant:`secondary`,size:`sm`,title:`Queue quota refresh`,"aria-label":`Queue quota refresh`,disabled:_||k.isPending||D.length===0,icon:(0,$.jsx)(v,{size:13,className:k.isPending?`animate-spin`:void 0}),onClick:()=>k.mutate(D.map(e=>e.id),{onSuccess:e=>{u.success(e.failed===0?`Refreshed ${e.succeeded} quota${e.succeeded===1?``:`s`}`:`Refreshed ${e.succeeded}, ${e.failed} failed`)},onError:e=>u.error(e instanceof Error?e.message:`Unable to refresh quota`)}),children:`Refresh`})]})]})]})}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6`,children:f?(0,$.jsx)(p,{className:`min-h-0 flex flex-1 flex-col items-center justify-center`,kind:`loading`,title:`Loading quota data`,description:`Reading provider account limits…`}):m?(0,$.jsx)(p,{className:`min-h-0 flex flex-1 flex-col items-center justify-center`,kind:`error`,title:`Unable to load quota data`,description:h instanceof Error?h.message:`Check the console session and retry.`,action:(0,$.jsx)(l,{variant:`secondary`,onClick:()=>void x(),children:`Retry`})}):B.length===0?(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-12 border border-dashed border-transparent rounded-card bg-transparent text-center`,children:(0,$.jsx)(g,{title:`No account quota data`,message:`Nothing is reporting a quota window yet. Add a provider account and its limits will appear here.`})}):(0,$.jsx)(`div`,{className:`quota-account-grid scroll-region min-h-0 flex-1 gap-6 [align-content:start]`,children:B.map(e=>(0,$.jsx)(le,{account:e,onToggle:(e,t)=>void V(e,t),onDelete:e=>P(e),onShowHealth:e=>I(e),onShowResets:e=>R(e)},e.id))})}),F&&(0,$.jsx)(q,{summary:{providerId:F.provider,accountId:F.id,title:F.name,status:F.health?.status??`unknown`,errorCategory:F.health?.lastErrorCategory??void 0,errorMessage:F.health?.sanitizedMessage??void 0,emptyMessage:`Status transitions, rate limits, quota refreshes, check-ins, and auto-recoveries will appear here.`},onClose:()=>I(null)}),L&&(0,$.jsx)(se,{account:L,onClose:()=>R(null)}),(0,$.jsx)(C,{open:N!==null,onClose:()=>P(null),onConfirm:async()=>{N&&await re(N)},title:`Delete account?`,message:`Delete "${N?.name}"? This cannot be undone.`,confirmLabel:`Delete`,danger:!0})]})}export{ue as default};
1
+ import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CXUMngI_.js";import{i}from"./terminal-C9mZ4Ugm.js";import{t as a}from"./check-D69FzdvC.js";import{t as o}from"./select-CGUuTQmj.js";import{t as s}from"./chevron-right-BXIy5l3h.js";import{m as c,n as l,t as u}from"./toast-DKAdP2mo.js";import{t as d}from"./eye-off-Bk5g2luF.js";import{a as f,i as p,n as m,r as h,t as g}from"./state-DHKdg-pm.js";import{t as _}from"./dialog-iocKA3jr.js";import{t as v}from"./refresh-cw-BqJFk4sU.js";import{t as y}from"./rotate-ccw-CufcqITi.js";import{t as b}from"./sliders-horizontal-ClG7dBeJ.js";import{t as x}from"./trash-Cppn5c3R.js";import{c as S}from"./query-keys-ROf-g1Wi.js";import{F as C}from"./entry-6PSJYbzI.js";import{n as w,r as T,t as E}from"./card-BTdbRFFg.js";import{t as D}from"./badge-BwmwEOgA.js";import{t as O}from"./ProviderIcon-paOCq8I0.js";import{t as k}from"./switch-DIDeAiz9.js";import{t as A}from"./stack-C1kTcOmP.js";import{n as j}from"./inline-DCejSLlA.js";import{t as M}from"./layout-Bv-NxqZ5.js";import{a as ee,i as N,n as P,o as F,r as I,s as L,t as R}from"./quota-DZGyp0N5.js";import{a as te,c as z,d as B,f as V,i as H,l as U,n as W,o as ne,p as G,r as re,s as K,t as q,u as J}from"./HealthEventsModal-C5cygmiy.js";var Y=e(`calendar-check`,[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`m9 15 2 2 4-4`,key:`1grp1n`}]]),ie=e(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),X=e(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Z=e(`zap`,[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]),Q=t(n(),1),$=r();function ae(e){return!!(e.quota?.windows.length&&e.quota.windows.every(e=>e.remainingPercent!==null&&e.remainingPercent<=0))}function oe(e){let t=e.quota?.windows.map(e=>e.resetsAt?new Date(e.resetsAt).getTime():1/0)??[];return Math.min(...t,1/0)}function se({account:e,onClose:t}){let n=H(e.id,!0),r=J(e.id),i=n.data?.credits??[],a=e=>e?new Date(e).toLocaleString():`—`,o=e=>e?new Date(e).toLocaleString():`—`,s=e=>{if(!e)return``;let t=new Date(e).getTime()-Date.now();if(!Number.isFinite(t))return``;if(t<=0)return`expired`;let n=Math.floor(t/864e5);if(n>=1)return`in ${n}d`;let r=Math.floor(t/36e5);return r>=1?`in ${r}h`:`in ${Math.max(1,Math.floor(t/6e4))}m`};return(0,$.jsx)(_,{open:!0,onClose:t,size:`lg`,title:`Saved Rate-Limit Resets — ${e.name}`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-7`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6 rounded-control border border-inner-border bg-surface-2 px-8 py-6`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,$.jsx)(Z,{size:14,className:`text-status-success`}),(0,$.jsx)(`span`,{className:`text-body font-semibold`,children:`Available resets`})]}),(0,$.jsx)(`p`,{className:`mt-2 text-text-tertiary text-badge leading-normal`,children:`Each credit lifts a spent rate-limit window before its natural reset.`})]}),(0,$.jsxs)(D,{tone:n.data&&n.data.availableCount>0?`ok`:`disabled`,dot:!0,children:[n.data?.availableCount??0,` reset`,(n.data?.availableCount??0)===1?``:`s`]})]}),n.isPending?(0,$.jsx)(h,{label:`Reading saved resets…`}):n.isError?(0,$.jsx)(m,{message:`Failed to read saved resets`,onRetry:()=>void n.refetch()}):i.length===0?(0,$.jsx)(g,{title:`No saved resets`,message:`This account has no saved rate-limit reset credits right now.`,icon:(0,$.jsx)(Z,{size:20})}):(0,$.jsx)(`div`,{className:`max-h-170 overflow-y-auto rounded-control border border-inner-border`,children:(0,$.jsx)(M,{headers:[`Status`,`Title`,`Granted`,`Expires`,``],children:i.map(e=>{let t=(e.status??`available`)===`available`,n=s(e.expiresAt);return(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{className:`whitespace-nowrap align-middle`,children:(0,$.jsx)(D,{tone:t?`ok`:e.status===`expired`?`disabled`:`warn`,children:e.status??`available`})}),(0,$.jsx)(`td`,{className:`text-caption font-medium whitespace-nowrap align-middle text-text-primary`,children:e.title??`Rate-limit reset`}),(0,$.jsx)(`td`,{className:`text-badge whitespace-nowrap tabular-nums align-middle text-text-secondary`,children:a(e.grantedAt)}),(0,$.jsxs)(`td`,{className:`text-badge whitespace-nowrap tabular-nums align-middle text-text-secondary`,children:[o(e.expiresAt),n&&(0,$.jsxs)(`span`,{className:`ml-3 text-text-tertiary`,children:[`(`,n,`)`]})]}),(0,$.jsx)(`td`,{className:`whitespace-nowrap text-right align-middle`,children:(0,$.jsx)(l,{size:`sm`,variant:t?`primary`:`secondary`,disabled:!t||r.isPending,onClick:()=>r.mutate({creditId:e.id},{onSuccess:e=>{e.ok?u.success(e.message??`Rate limit reset applied`):u.error(e.message??`Rate limit reset failed`)},onError:e=>{u.error(S(e,`Unable to redeem rate-limit reset`))}}),children:`Use`})})]},e.id)})})}),(0,$.jsx)(j,{justify:`flex-end`,gap:`0px`,children:(0,$.jsx)(l,{variant:`secondary`,size:`sm`,onClick:t,children:`Close`})})]})})}function ce({accounts:e}){let t=(0,Q.useMemo)(()=>{let t=new Map;for(let n of e){if(!W(n.provider))continue;let e=t.get(n.provider);e?e.count+=1:t.set(n.provider,{id:n.provider,label:n.providerName||n.provider,count:1})}return[...t.values()]},[e]),[n,r]=(0,Q.useState)(``),i=(t.find(e=>e.id===n)??t[0])?.id??``,a=V(i),s=i.length===0||a.isPending||t.length===0;return(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2.5`,"aria-label":`Daily growth actions`,children:[(0,$.jsx)(`div`,{className:`min-w-0 w-67.5`,children:(0,$.jsx)(o,{"aria-label":`Provider for the daily growth pass`,value:i,onValueChange:r,className:`w-full h-16`,options:t.length>0?t.map(e=>({value:e.id,label:`${e.label} · ${e.count}`})):[{value:``,label:`No buddy providers`}]})}),(0,$.jsx)(l,{variant:`secondary`,size:`sm`,title:`Send the activity report, then claim the daily check-in, for every account of this provider`,"aria-label":`Run the daily growth pass for this provider`,disabled:s,className:`shrink-0`,icon:a.isPending?(0,$.jsx)(c,{size:13,className:`animate-spin`}):(0,$.jsx)(Y,{size:13}),onClick:()=>a.mutate(void 0,{onSuccess:e=>{let t=e.data.filter(e=>!e.report.ok).length;t===0?u.success(e.message):u.error(`${e.message} — ${t} report${t===1?``:`s`} failed`)},onError:e=>u.error(S(e,`Unable to run the daily growth pass`))}),children:`Daily growth`})]})}function le({account:e,onToggle:t,onDelete:n,onShowHealth:r,onShowResets:a}){let o=K(e.id),d=B(e.id),p=W(e.provider),m=re(e.provider),h=H(e.id,m),g=e.quota,[_,v]=(0,Q.useState)(0),b=g?.windows??[],C=F(b,_),w=C.pageCount;(0,Q.useEffect)(()=>{v(e=>Math.min(e,Math.max(0,w-1)))},[w]);let T=o.isPending||d.isPending,D=h.data?.availableCount??0,[A,j]=(0,Q.useState)(null),[M,te]=(0,Q.useState)(!1),z=e.checkin?.attemptedToday??!1,V=`${A?A.state===`claimed`?`Checked in${A.credit===null?``:` +${A.credit}`}${A.streakDays===null?``:` · ${A.streakDays}d streak`}`:A.state===`already_claimed`?`Check-in attempted · already claimed`:A.state===`not_eligible`?`Check-in attempted · not eligible`:A.state===`event_ended`?`Check-in attempted · event ended`:`Check-in attempted · unavailable`:z?`Check-in attempted today`:`Check-in due`}${M?` · Reported today`:``}`,U=b.reduce((e,t)=>{let n=t.limit;if(typeof n!=`number`||!Number.isFinite(n))return e;let r=typeof t.remaining==`number`&&Number.isFinite(t.remaining)?t.remaining:typeof t.used==`number`&&Number.isFinite(t.used)?n-t.used:typeof t.remainingPercent==`number`&&Number.isFinite(t.remainingPercent)?n*t.remainingPercent/100:null;return r===null?e:e+Math.max(0,r)},0),ne=(o.error?S(o.error,`Unable to refresh this account`):null)??g?.refreshError??g?.error??e.health?.sanitizedMessage,G=ee(ne),q=G===`Quota tracking is not supported for this provider`?null:G,J=R(e.credentialHint,e.name),X=e.health?.status??`unknown`;return(0,$.jsxs)(E,{className:`flex h-full flex-col overflow-hidden`,"aria-busy":T,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5 px-7 py-4`,children:[(0,$.jsx)(O,{icon:e.providerIcon,name:e.providerName,size:32}),(0,$.jsxs)(`div`,{className:`flex-[1_1_160px]`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-4`,children:[(0,$.jsx)(`div`,{className:`truncate text-caption font-bold text-text-primary text-body`,children:e.providerName}),g?.plan&&(0,$.jsx)(`span`,{className:`shrink-0 rounded-chip bg-accent-soft px-4 py-1 text-micro font-semibold text-accent`,children:g.plan})]}),(0,$.jsx)(`div`,{className:`truncate text-badge text-text-secondary`,children:J.primary}),J.secondary!==null&&(0,$.jsx)(`div`,{className:`truncate text-micro text-text-tertiary`,children:J.secondary}),g&&(0,$.jsx)(`div`,{className:`truncate text-micro text-text-tertiary`,children:P(g.lastSuccessAt??g.fetchedAt)}),m&&(0,$.jsx)(`div`,{className:`truncate text-micro flex items-center gap-2 text-text-tertiary`,title:`Saved rate-limit reset credits available on this account`,children:h.isPending?`Checking saved resets…`:D>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{size:10,className:`text-status-success shrink-0`,"aria-hidden":`true`}),(0,$.jsxs)(`span`,{className:`reset-credit-live`,children:[D,` rate-limit reset`,D===1?``:`s`,` available`]})]}):`No rate-limit resets available`}),p&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{title:`Daily growth state: manual pass result, else the sweep ledger for today`,className:`truncate text-micro text-text-tertiary`,children:d.isPending?`Running growth pass…`:V}),b.some(e=>typeof e.limit==`number`&&Number.isFinite(e.limit))&&(0,$.jsxs)(`div`,{className:`truncate text-micro text-text-tertiary`,children:[`Total credits: `,U.toLocaleString(void 0,{maximumFractionDigits:2})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.75 gap-3 ml-auto`,children:[m&&(0,$.jsx)(l,{variant:`ghost`,size:`icon`,className:`w-16 h-16 p-0`,title:h.isPending?`Checking saved rate-limit resets…`:D>0?`Saved rate-limit resets (${D} available)`:`Saved rate-limit resets`,"aria-label":`Open saved rate-limit resets for ${e.name}`,disabled:T,onClick:()=>a(e),children:(0,$.jsx)(Z,{size:14})}),p&&(0,$.jsx)(l,{variant:`ghost`,size:`icon`,className:`w-16 h-16 p-0`,title:`Daily growth pass (check-in + activity report) — ${V}`,"aria-label":`Run daily growth pass for ${e.name}`,disabled:T,onClick:()=>d.mutate(void 0,{onSuccess:e=>{let t=e.checkin.data;t&&j({state:t.state,credit:t.credit,streakDays:t.streakDays}),e.report.ok&&te(!0),e.ok?u.success(e.message):u.error(e.message)},onError:e=>{u.error(S(e,`Unable to run daily growth pass`))}}),children:d.isPending?(0,$.jsx)(c,{size:14,className:`animate-spin`}):(0,$.jsx)(Y,{size:14})}),(0,$.jsx)(l,{variant:`ghost`,size:`sm`,title:X===`active`?`Health & Error Log`:`${X} — Inspect account health details`,"aria-label":X===`active`?`Health log for ${e.name}`:`Account is ${X} — inspect health details for ${e.name}`,disabled:T,onClick:()=>r(e),icon:(0,$.jsx)(i,{size:12})}),(0,$.jsx)(l,{variant:`ghost`,size:`sm`,title:`Refresh quota`,"aria-label":`Refresh ${e.name} quota`,disabled:T,onClick:()=>o.mutate(),icon:o.isPending?(0,$.jsx)(c,{size:12,className:`animate-spin`}):(0,$.jsx)(y,{size:12})}),(0,$.jsx)(l,{variant:`ghost`,size:`sm`,title:`Delete account`,"aria-label":`Delete ${e.name}`,onClick:()=>n(e),className:`text-red`,icon:(0,$.jsx)(x,{size:12})}),(0,$.jsx)(k,{checked:e.active,disabled:o.isPending,onChange:n=>t(e,n),label:``,id:`switch-${e.id}`})]})]}),q&&(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-4 border-t border-inner-border px-8 py-5 text-center text-badge text-red`,role:`alert`,children:[(0,$.jsx)(f,{size:13,className:`shrink-0`}),(0,$.jsx)(`span`,{children:q})]}),g?.windows.length?(0,$.jsxs)(`div`,{className:`quota-window-list flex flex-1 flex-col gap-4 border-t border-inner-border px-7 py-4.5`,children:[(0,$.jsx)(`div`,{className:`quota-window-section-label text-micro font-bold tracking-label text-text-tertiary`,children:`QUOTA WINDOWS`}),C.items.map((e,t)=>{let n=e.remainingPercent??null,r=typeof e.limit==`number`&&Number.isFinite(e.limit)?e.limit:null,i=typeof e.used==`number`&&Number.isFinite(e.used)?e.used:r!==null&&e.usedPercent!==null&&e.usedPercent!==void 0?r*e.usedPercent/100:null,a=L(n),o=n===null?0:Math.max(0,Math.min(100,n)),s=e=>e.toLocaleString(void 0,{maximumFractionDigits:2}),c=e=>{let t=Math.round(e*10)/10;return t>0&&t<.1?`<0.1`:t.toLocaleString(void 0,{maximumFractionDigits:1})},l=I(e.label);return(0,$.jsxs)(`div`,{className:`quota-window-row grid grid-cols-quota-window min-w-0 items-center gap-x-6 gap-y-2 max-small:grid-cols-[minmax(0,1fr)_auto] max-small:gap-x-4 max-small:gap-y-2.5`,children:[(0,$.jsx)(`div`,{className:`quota-window-heading min-w-0 max-small:col-start-1`,children:(0,$.jsx)(`span`,{className:`text-badge font-semibold text-text-primary`,children:l})}),(0,$.jsx)(`div`,{className:`quota-bar-track quota-window-bar min-w-0 w-full h-5 rounded-tiny bg-inner-border overflow-hidden max-small:col-span-full max-small:row-start-2`,role:`progressbar`,"aria-label":`${l} remaining quota`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":n===null?void 0:o,"aria-valuetext":n===null?`Quota only`:`${c(n)}% remaining`,children:(0,$.jsx)(`div`,{className:`quota-bar-fill h-full rounded-tiny transition-[width] duration-(--dur-macro) ease-spring`,style:{width:`${o}%`,background:a.bar}})}),(0,$.jsx)(`span`,{className:`quota-window-remaining whitespace-nowrap text-badge font-bold tabular-nums max-small:col-start-2 max-small:row-start-1`,style:{color:a.text},children:n===null?`—`:`${c(n)}%`}),(0,$.jsxs)(`div`,{className:`quota-window-details col-span-full flex min-w-0 items-center justify-end gap-6 text-micro text-text-tertiary max-small:row-start-3 max-small:flex-wrap max-small:justify-between max-small:gap-4`,children:[(0,$.jsx)(`span`,{className:`quota-window-usage mr-auto tabular-nums max-small:min-w-0`,children:i!==null&&r!==null?`${s(i)} / ${s(r)} Credits`:`Quota only`}),e.resetsAt&&(0,$.jsx)(`span`,{className:`quota-window-reset whitespace-nowrap tabular-nums text-right max-small:ml-auto`,children:N(e.resetsAt,e.recurring)})]})]},`${e.kind??e.label}:${e.resetsAt??`none`}:${t}`)}),C.pageCount>1&&(0,$.jsxs)(`nav`,{"aria-label":`Quota windows for ${e.name}`,className:`quota-window-pagination mt-auto flex items-center justify-between gap-4 border-t border-inner-border pt-4 max-small:flex-wrap`,children:[(0,$.jsxs)(`span`,{"aria-live":`polite`,className:`text-micro text-text-tertiary`,children:[`Showing `,C.startIndex+1,`–`,C.startIndex+C.items.length,` of `,b.length]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(l,{variant:`ghost`,size:`sm`,"aria-label":`Previous quota windows for ${e.name}`,disabled:C.page===0,icon:(0,$.jsx)(ie,{size:13}),onClick:()=>v(C.page-1),className:`h-14 px-4 py-0`,children:`Previous`}),(0,$.jsx)(l,{variant:`ghost`,size:`sm`,"aria-label":`Next quota windows for ${e.name}`,disabled:C.page>=C.pageCount-1,icon:(0,$.jsx)(s,{size:13}),onClick:()=>v(C.page+1),className:`h-14 px-4 py-0`,children:`Next`})]})]})]}):q?null:(0,$.jsx)(`div`,{className:`border-t border-inner-border px-7 py-9 text-center text-badge text-text-tertiary`,children:T||e.pending?`Fetching quota…`:`No quota data`})]})}function ue(){let[e,t]=(0,Q.useState)(`all`),[n,r]=(0,Q.useState)(`all`),[i,s]=(0,Q.useState)(!1),{data:c,isLoading:f,isError:m,error:h,isFetching:_,dataUpdatedAt:y,refetch:x}=ne(),S=(0,Q.useMemo)(()=>[...c?.providers??[]].sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`})),[c?.providers]),D=(0,Q.useMemo)(()=>c?.accounts??[],[c?.accounts]),O=c?.refreshing??0,k=z(),j=G(),M=U(),ee=te(),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(null),B=(0,Q.useMemo)(()=>{let t=D.filter(t=>{if(e!==`all`&&t.provider!==e)return!1;let r=!!t.quota?.windows.length;return n===`untracked`?!r:!(!r||n===`active`&&!t.active||n===`disabled`&&t.active)}),r=(e,t)=>e.providerName.localeCompare(t.providerName,void 0,{sensitivity:`base`})||e.name.localeCompare(t.name,void 0,{sensitivity:`base`});return[...t].sort(i?(e,t)=>oe(e)-oe(t)||r(e,t):r)},[n,D,i,e]),V=async(e,t)=>{try{await j.mutateAsync({id:e.id,active:t}),u.success(`${e.name} ${t?`enabled`:`disabled`}`)}catch(e){u.error(e instanceof Error?e.message:`Unable to update account`)}},H=async()=>{let e=D.filter(e=>e.active&&ae(e));await M.mutateAsync({ids:e.map(e=>e.id),active:!1}),u.success(`Disabled ${e.length} empty accounts`)},W=async()=>{let e=D.filter(e=>!e.active&&e.quota?.windows.some(e=>e.remainingPercent!==null&&e.remainingPercent>0));await M.mutateAsync({ids:e.map(e=>e.id),active:!0}),u.success(`Enabled ${e.length} available accounts`)},re=async e=>{await ee.mutateAsync(e.id),u.success(`${e.name} deleted`)},K=y>0?new Date(y).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):`Not updated`,J=D.filter(ae).length;return(0,$.jsxs)(A,{gap:`16px`,className:`dashboard-page min-h-0 flex-1`,children:[(0,$.jsx)(E,{children:(0,$.jsx)(T,{title:`Quota`,subtitle:`Provider account limits and what is left of them`,icon:(0,$.jsx)(b,{size:16})})}),(0,$.jsx)(E,{children:(0,$.jsxs)(w,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-4`,children:[(0,$.jsx)(o,{"aria-label":`Filter quota by provider`,value:e,onValueChange:t,className:`w-full h-16 max-small:w-80`,options:[{value:`all`,label:`All Providers`},...S.map(e=>({value:e.id,label:e.name}))]}),(0,$.jsx)(o,{"aria-label":`Filter quota by account`,value:n,onValueChange:r,className:`w-full h-16 max-small:w-67.5`,options:[{value:`all`,label:`With quota`},{value:`active`,label:`Active`},{value:`disabled`,label:`Disabled`},{value:`untracked`,label:`No quota`}]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,$.jsx)(l,{variant:i?`secondary`:`ghost`,size:`sm`,onClick:()=>s(e=>!e),"aria-pressed":i,icon:(0,$.jsx)(X,{size:13}),children:`Expiring first`}),(0,$.jsx)(l,{variant:`ghost`,size:`sm`,className:`text-red`,disabled:J===0||_,onClick:()=>void H(),icon:(0,$.jsx)(d,{size:13}),children:`Turn off Empty`}),(0,$.jsx)(l,{variant:`ghost`,size:`sm`,className:`text-green`,disabled:_,onClick:()=>void W(),icon:(0,$.jsx)(a,{size:13}),children:`Turn on Available`})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 border-t border-inner-border pt-5`,children:[(0,$.jsxs)(`span`,{className:`text-badge text-text-tertiary`,children:[B.length,` shown`,J>0?` · ${J} empty`:``]}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-5 gap-y-3 text-badge text-text-tertiary`,children:[O>0?`Refreshing ${O} account${O===1?``:`s`}…`:`Auto-refresh 60s · ${K}`,(0,$.jsx)(ce,{accounts:D}),(0,$.jsx)(l,{variant:`secondary`,size:`sm`,title:`Queue quota refresh`,"aria-label":`Queue quota refresh`,disabled:_||k.isPending||D.length===0,icon:(0,$.jsx)(v,{size:13,className:k.isPending?`animate-spin`:void 0}),onClick:()=>k.mutate(D.map(e=>e.id),{onSuccess:e=>{u.success(e.failed===0?`Refreshed ${e.succeeded} quota${e.succeeded===1?``:`s`}`:`Refreshed ${e.succeeded}, ${e.failed} failed`)},onError:e=>u.error(e instanceof Error?e.message:`Unable to refresh quota`)}),children:`Refresh`})]})]})]})}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6`,children:f?(0,$.jsx)(p,{className:`min-h-0 flex flex-1 flex-col items-center justify-center`,kind:`loading`,title:`Loading quota data`,description:`Reading provider account limits…`}):m?(0,$.jsx)(p,{className:`min-h-0 flex flex-1 flex-col items-center justify-center`,kind:`error`,title:`Unable to load quota data`,description:h instanceof Error?h.message:`Check the console session and retry.`,action:(0,$.jsx)(l,{variant:`secondary`,onClick:()=>void x(),children:`Retry`})}):B.length===0?(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-12 border border-dashed border-transparent rounded-card bg-transparent text-center`,children:(0,$.jsx)(g,{title:`No account quota data`,message:`Nothing is reporting a quota window yet. Add a provider account and its limits will appear here.`})}):(0,$.jsx)(`div`,{className:`quota-account-grid scroll-region min-h-0 flex-1 gap-6 [align-content:start]`,children:B.map(e=>(0,$.jsx)(le,{account:e,onToggle:(e,t)=>void V(e,t),onDelete:e=>P(e),onShowHealth:e=>I(e),onShowResets:e=>R(e)},e.id))})}),F&&(0,$.jsx)(q,{summary:{providerId:F.provider,accountId:F.id,title:F.name,status:F.health?.status??`unknown`,errorCategory:F.health?.lastErrorCategory??void 0,errorMessage:F.health?.sanitizedMessage??void 0,emptyMessage:`Status transitions, rate limits, quota refreshes, check-ins, and auto-recoveries will appear here.`},onClose:()=>I(null)}),L&&(0,$.jsx)(se,{account:L,onClose:()=>R(null)}),(0,$.jsx)(C,{open:N!==null,onClose:()=>P(null),onConfirm:async()=>{N&&await re(N)},title:`Delete account?`,message:`Delete "${N?.name}"? This cannot be undone.`,confirmLabel:`Delete`,danger:!0})]})}export{ue as default};
@@ -1 +1 @@
1
- import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CXUMngI_.js";import{n as i}from"./toast-DKAdP2mo.js";import{a,t as o}from"./query-keys-ROf-g1Wi.js";import{J as s,P as c,Y as l}from"./entry-KOZCZ9VG.js";import{n as u}from"./input-Bn4_kNav.js";import{t as d}from"./layout-Bv-NxqZ5.js";import{t as f}from"./backup-file-gdKIlg8U.js";var p=e(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),m=t(n(),1),h=r();function g(){let e=l(),[t,n]=(0,m.useState)(null),[r,d]=(0,m.useState)(`admin`),[g,y]=(0,m.useState)(``),[b,x]=(0,m.useState)(``),[S,C]=(0,m.useState)(``),[w,T]=(0,m.useState)(null),[E,D]=(0,m.useState)(!1),[O,k]=(0,m.useState)(`create`),[A,j]=(0,m.useState)(null),[M,N]=(0,m.useState)(null),P=(0,m.useRef)(null);(0,m.useEffect)(()=>{let t=!0;return a(`/auth/first-boot`).then(r=>{t&&(n(r.requires_setup),r.requires_setup||e(`/login`,{replace:!0}))}).catch(()=>{t&&n(!0)}),()=>{t=!1}},[e]);let F=async n=>{if(n.preventDefault(),t===!1){T(`This console already has an account. Sign in instead.`);return}if(!r.trim()){T(`Administrator username is required.`);return}if(b.length<8){T(`Administrator password must be at least 8 characters.`);return}if(b!==S){T(`Passwords do not match.`);return}D(!0),T(null);try{let t=await a(`/auth/setup`,{method:`POST`,body:JSON.stringify({username:r.trim(),password:b,...g.trim()?{display_name:g.trim()}:{}})});if(t.status!==`success`){T(t.message??`Setup failed. Please try again.`);return}c.removeQueries({queryKey:o.session.current}),e(`/login`,{replace:!0})}catch(e){if(e&&typeof e==`object`&&`message`in e){let t=e.message;if(typeof t==`string`){T(t);return}}T(`An unexpected network error occurred.`)}finally{D(!1)}},I=async t=>{D(!0),T(null);try{if(b.length<8){T(`Administrator password must be at least 8 characters.`);return}if(b!==S){T(`Passwords do not match.`);return}let n=await f(t),i=await a(`/auth/setup/restore`,{method:`POST`,body:JSON.stringify({backup:n,username:r.trim(),password:b,...g.trim()?{display_name:g.trim()}:{}})});if(i.status!==`success`){T(i.message??`Restore failed. Please try again.`);return}c.removeQueries({queryKey:o.session.current}),e(`/login`,{replace:!0})}catch(e){if(e instanceof Error){T(e.message);return}T(`An unexpected network error occurred.`)}finally{D(!1)}},L=e=>{if(j(e),T(null),e===null){N(null);return}f(e).then(async t=>{try{let n=await a(`/auth/setup/inspect`,{method:`POST`,body:JSON.stringify({backup:t})});if(n.status!==`success`){N(null),T(n.message??`Could not read that backup.`);return}N({fileName:e.name,version:n.version??0,exportedAt:n.exportedAt??``,rows:n.rows??[],total:n.total??0,warnings:n.warnings??[]})}catch{N(null)}}).catch(e=>{N(null),T(e instanceof Error?e.message:`That file is not a JSON backup.`)})};return t===!1?(0,h.jsx)(`main`,{className:`auth-viewport`,children:(0,h.jsxs)(`div`,{className:`card-solid auth-window`,children:[(0,h.jsxs)(`div`,{className:`auth-header`,children:[(0,h.jsx)(`div`,{className:`auth-logo`,"aria-hidden":`true`}),(0,h.jsx)(`h1`,{className:`auth-title`,children:`Account Already Registered`}),(0,h.jsx)(`p`,{className:`auth-desc`,children:`This console already has an administrator account, so setup is closed. Sign in with the account that was created.`})]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-7`,children:[(0,h.jsx)(v,{message:`Setup is already finished. Creating a second administrator is not possible from here.`}),(0,h.jsx)(s,{to:`/login`,className:`no-underline`,children:(0,h.jsx)(i,{variant:`primary`,type:`button`,className:`w-full h-20`,children:`Go to sign in`})})]})]})}):(0,h.jsx)(`main`,{className:`auth-viewport`,children:(0,h.jsxs)(`div`,{className:`card-solid auth-window`,children:[(0,h.jsxs)(`div`,{className:`auth-header`,children:[(0,h.jsx)(`div`,{className:`auth-logo`,"aria-hidden":`true`}),(0,h.jsx)(`h1`,{className:`auth-title`,children:`Cartethyia Console Setup`}),(0,h.jsx)(`p`,{className:`auth-desc`,children:O===`create`?`Configure the administrator account for Cartethyia AI Gateway`:`Restore a backup's configuration. A backup carries no accounts, so set the administrator for this install.`})]}),(0,h.jsxs)(`div`,{className:`flex gap-4 mb-7`,children:[(0,h.jsx)(i,{type:`button`,variant:O===`create`?`primary`:`secondary`,onClick:()=>k(`create`),children:`New account`}),(0,h.jsx)(i,{type:`button`,variant:O===`restore`?`primary`:`secondary`,onClick:()=>k(`restore`),children:`Restore backup`})]}),O===`restore`?(0,h.jsxs)(`div`,{className:`flex flex-col gap-7`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2 min-h-10`,children:[(0,h.jsx)(i,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>P.current?.click(),disabled:E||t===null,children:`Choose file…`}),(0,h.jsx)(i,{type:`button`,variant:`primary`,size:`sm`,disabled:E||t===null||A===null,onClick:()=>{A&&I(A)},children:E?`Restoring…`:`Restore backup`})]}),(0,h.jsx)(`input`,{ref:P,id:`setup-backup`,type:`file`,accept:`application/json,.json,.gz,application/gzip`,disabled:E,className:`hidden`,onChange:e=>{let t=e.target.files?.[0]??null;L(t),e.target.value=``}}),M?(0,h.jsx)(_,{preview:M}):null,(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(`p`,{className:`m-0 text-text-secondary text-caption`,children:`A backup holds no sign-in accounts, so restoring one never restores an administrator. Set the account for this install — the file's own passwords are not reused.`}),(0,h.jsx)(u,{label:`Administrator Username`,id:`restore-username`,value:r,onChange:e=>d(e.target.value),required:!0,autoComplete:`username`}),(0,h.jsx)(u,{label:`Master Password`,hint:`(min. 8 chars)`,id:`restore-password`,type:`password`,required:!0,minLength:8,value:b,onChange:e=>x(e.target.value),autoComplete:`new-password`}),(0,h.jsx)(u,{label:`Confirm Password`,id:`restore-confirm`,type:`password`,required:!0,minLength:8,value:S,onChange:e=>C(e.target.value),autoComplete:`new-password`})]}),w?(0,h.jsx)(v,{message:w}):null]}):(0,h.jsxs)(`form`,{onSubmit:F,className:`flex flex-col gap-7`,children:[(0,h.jsx)(u,{label:`Administrator Username`,id:`setup-username`,value:r,onChange:e=>d(e.target.value),required:!0,autoComplete:`username`,placeholder:`e.g. admin, risun`}),(0,h.jsx)(u,{label:`Display Name`,hint:`(optional)`,id:`display-name`,value:g,onChange:e=>y(e.target.value),autoComplete:`name`,placeholder:`e.g. Administrator, risun`}),(0,h.jsx)(u,{label:`Master Password`,hint:`(min. 8 chars)`,id:`setup-password`,type:`password`,required:!0,minLength:8,value:b,onChange:e=>x(e.target.value),autoComplete:`new-password`}),(0,h.jsx)(u,{label:`Confirm Password`,id:`setup-confirm`,type:`password`,required:!0,minLength:8,value:S,onChange:e=>C(e.target.value),autoComplete:`new-password`}),w?(0,h.jsx)(v,{message:w}):null,(0,h.jsx)(i,{variant:`primary`,type:`submit`,disabled:E||t===null,className:`w-full mt-3 h-20`,icon:(0,h.jsx)(p,{size:15}),children:E?`Initializing…`:`Complete Setup`})]})]})})}function _({preview:e}){let t=e.rows.filter(e=>!e.supported),n=e.rows.filter(e=>e.supported),r=e.exportedAt?e.exportedAt.replace(`T`,` `).slice(0,19):`unknown`;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-2 p-3 border border-inner-border rounded-control bg-surface-2`,children:[(0,h.jsxs)(`div`,{className:`flex items-center flex-wrap gap-1.5`,children:[(0,h.jsx)(`span`,{className:`min-w-0 overflow-hidden whitespace-nowrap text-ellipsis text-body font-semibold`,title:e.fileName,children:e.fileName}),(0,h.jsxs)(`span`,{className:`inline-flex items-center flex-none px-3.5 py-px border border-inner-border rounded-md bg-surface-2 text-text-secondary text-badge tabular-nums`,children:[`v`,e.version]}),t.length>0?(0,h.jsxs)(`span`,{className:`inline-flex items-center flex-none px-3.5 py-px border rounded-md bg-surface-2 text-badge tabular-nums border-warning-line text-status-warning`,children:[t.length,` unsupported`]}):null]}),(0,h.jsxs)(`p`,{className:`m-0 text-text-secondary text-caption`,children:[e.total,` rows across `,e.rows.length,` tables · exported `,r]}),t.length>0?(0,h.jsx)(`p`,{className:`m-0 text-caption text-status-warning`,children:t.length===e.rows.length?`None of these tables exist in this build, so nothing can be restored.`:`This build no longer has some of these tables. The rest still restores.`}):null,e.rows.length===0?(0,h.jsx)(`p`,{className:`m-0 text-text-secondary text-caption`,children:`This backup is empty.`}):(0,h.jsx)(`div`,{className:`max-h-110 overflow-auto`,children:(0,h.jsx)(d,{headers:[`Table`,`Section`,`Rows`],dense:!0,children:[...n,...t].map(e=>(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`td`,{children:e.table}),(0,h.jsx)(`td`,{children:e.section}),(0,h.jsx)(`td`,{className:`text-right`,children:e.supported?e.count:(0,h.jsx)(`span`,{className:`inline-flex items-center flex-none px-3.5 py-px border rounded-md bg-surface-2 text-badge tabular-nums border-warning-line text-status-warning`,children:`unsupported`})})]},`${e.section}/${e.table}`))})})]})}function v({message:e}){return(0,h.jsx)(`div`,{className:`py-5 px-7 rounded-control bg-red-soft text-red text-caption font-medium`,role:`alert`,children:e})}export{g as default};
1
+ import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CXUMngI_.js";import{n as i}from"./toast-DKAdP2mo.js";import{a,t as o}from"./query-keys-ROf-g1Wi.js";import{J as s,P as c,Y as l}from"./entry-6PSJYbzI.js";import{n as u}from"./input-Bn4_kNav.js";import{t as d}from"./layout-Bv-NxqZ5.js";import{t as f}from"./backup-file-gdKIlg8U.js";var p=e(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),m=t(n(),1),h=r();function g(){let e=l(),[t,n]=(0,m.useState)(null),[r,d]=(0,m.useState)(`admin`),[g,y]=(0,m.useState)(``),[b,x]=(0,m.useState)(``),[S,C]=(0,m.useState)(``),[w,T]=(0,m.useState)(null),[E,D]=(0,m.useState)(!1),[O,k]=(0,m.useState)(`create`),[A,j]=(0,m.useState)(null),[M,N]=(0,m.useState)(null),P=(0,m.useRef)(null);(0,m.useEffect)(()=>{let t=!0;return a(`/auth/first-boot`).then(r=>{t&&(n(r.requires_setup),r.requires_setup||e(`/login`,{replace:!0}))}).catch(()=>{t&&n(!0)}),()=>{t=!1}},[e]);let F=async n=>{if(n.preventDefault(),t===!1){T(`This console already has an account. Sign in instead.`);return}if(!r.trim()){T(`Administrator username is required.`);return}if(b.length<8){T(`Administrator password must be at least 8 characters.`);return}if(b!==S){T(`Passwords do not match.`);return}D(!0),T(null);try{let t=await a(`/auth/setup`,{method:`POST`,body:JSON.stringify({username:r.trim(),password:b,...g.trim()?{display_name:g.trim()}:{}})});if(t.status!==`success`){T(t.message??`Setup failed. Please try again.`);return}c.removeQueries({queryKey:o.session.current}),e(`/login`,{replace:!0})}catch(e){if(e&&typeof e==`object`&&`message`in e){let t=e.message;if(typeof t==`string`){T(t);return}}T(`An unexpected network error occurred.`)}finally{D(!1)}},I=async t=>{D(!0),T(null);try{if(b.length<8){T(`Administrator password must be at least 8 characters.`);return}if(b!==S){T(`Passwords do not match.`);return}let n=await f(t),i=await a(`/auth/setup/restore`,{method:`POST`,body:JSON.stringify({backup:n,username:r.trim(),password:b,...g.trim()?{display_name:g.trim()}:{}})});if(i.status!==`success`){T(i.message??`Restore failed. Please try again.`);return}c.removeQueries({queryKey:o.session.current}),e(`/login`,{replace:!0})}catch(e){if(e instanceof Error){T(e.message);return}T(`An unexpected network error occurred.`)}finally{D(!1)}},L=e=>{if(j(e),T(null),e===null){N(null);return}f(e).then(async t=>{try{let n=await a(`/auth/setup/inspect`,{method:`POST`,body:JSON.stringify({backup:t})});if(n.status!==`success`){N(null),T(n.message??`Could not read that backup.`);return}N({fileName:e.name,version:n.version??0,exportedAt:n.exportedAt??``,rows:n.rows??[],total:n.total??0,warnings:n.warnings??[]})}catch{N(null)}}).catch(e=>{N(null),T(e instanceof Error?e.message:`That file is not a JSON backup.`)})};return t===!1?(0,h.jsx)(`main`,{className:`auth-viewport`,children:(0,h.jsxs)(`div`,{className:`card-solid auth-window`,children:[(0,h.jsxs)(`div`,{className:`auth-header`,children:[(0,h.jsx)(`div`,{className:`auth-logo`,"aria-hidden":`true`}),(0,h.jsx)(`h1`,{className:`auth-title`,children:`Account Already Registered`}),(0,h.jsx)(`p`,{className:`auth-desc`,children:`This console already has an administrator account, so setup is closed. Sign in with the account that was created.`})]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-7`,children:[(0,h.jsx)(v,{message:`Setup is already finished. Creating a second administrator is not possible from here.`}),(0,h.jsx)(s,{to:`/login`,className:`no-underline`,children:(0,h.jsx)(i,{variant:`primary`,type:`button`,className:`w-full h-20`,children:`Go to sign in`})})]})]})}):(0,h.jsx)(`main`,{className:`auth-viewport`,children:(0,h.jsxs)(`div`,{className:`card-solid auth-window`,children:[(0,h.jsxs)(`div`,{className:`auth-header`,children:[(0,h.jsx)(`div`,{className:`auth-logo`,"aria-hidden":`true`}),(0,h.jsx)(`h1`,{className:`auth-title`,children:`Cartethyia Console Setup`}),(0,h.jsx)(`p`,{className:`auth-desc`,children:O===`create`?`Configure the administrator account for Cartethyia AI Gateway`:`Restore a backup's configuration. A backup carries no accounts, so set the administrator for this install.`})]}),(0,h.jsxs)(`div`,{className:`flex gap-4 mb-7`,children:[(0,h.jsx)(i,{type:`button`,variant:O===`create`?`primary`:`secondary`,onClick:()=>k(`create`),children:`New account`}),(0,h.jsx)(i,{type:`button`,variant:O===`restore`?`primary`:`secondary`,onClick:()=>k(`restore`),children:`Restore backup`})]}),O===`restore`?(0,h.jsxs)(`div`,{className:`flex flex-col gap-7`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2 min-h-10`,children:[(0,h.jsx)(i,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>P.current?.click(),disabled:E||t===null,children:`Choose file…`}),(0,h.jsx)(i,{type:`button`,variant:`primary`,size:`sm`,disabled:E||t===null||A===null,onClick:()=>{A&&I(A)},children:E?`Restoring…`:`Restore backup`})]}),(0,h.jsx)(`input`,{ref:P,id:`setup-backup`,type:`file`,accept:`application/json,.json,.gz,application/gzip`,disabled:E,className:`hidden`,onChange:e=>{let t=e.target.files?.[0]??null;L(t),e.target.value=``}}),M?(0,h.jsx)(_,{preview:M}):null,(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(`p`,{className:`m-0 text-text-secondary text-caption`,children:`A backup holds no sign-in accounts, so restoring one never restores an administrator. Set the account for this install — the file's own passwords are not reused.`}),(0,h.jsx)(u,{label:`Administrator Username`,id:`restore-username`,value:r,onChange:e=>d(e.target.value),required:!0,autoComplete:`username`}),(0,h.jsx)(u,{label:`Master Password`,hint:`(min. 8 chars)`,id:`restore-password`,type:`password`,required:!0,minLength:8,value:b,onChange:e=>x(e.target.value),autoComplete:`new-password`}),(0,h.jsx)(u,{label:`Confirm Password`,id:`restore-confirm`,type:`password`,required:!0,minLength:8,value:S,onChange:e=>C(e.target.value),autoComplete:`new-password`})]}),w?(0,h.jsx)(v,{message:w}):null]}):(0,h.jsxs)(`form`,{onSubmit:F,className:`flex flex-col gap-7`,children:[(0,h.jsx)(u,{label:`Administrator Username`,id:`setup-username`,value:r,onChange:e=>d(e.target.value),required:!0,autoComplete:`username`,placeholder:`e.g. admin, risun`}),(0,h.jsx)(u,{label:`Display Name`,hint:`(optional)`,id:`display-name`,value:g,onChange:e=>y(e.target.value),autoComplete:`name`,placeholder:`e.g. Administrator, risun`}),(0,h.jsx)(u,{label:`Master Password`,hint:`(min. 8 chars)`,id:`setup-password`,type:`password`,required:!0,minLength:8,value:b,onChange:e=>x(e.target.value),autoComplete:`new-password`}),(0,h.jsx)(u,{label:`Confirm Password`,id:`setup-confirm`,type:`password`,required:!0,minLength:8,value:S,onChange:e=>C(e.target.value),autoComplete:`new-password`}),w?(0,h.jsx)(v,{message:w}):null,(0,h.jsx)(i,{variant:`primary`,type:`submit`,disabled:E||t===null,className:`w-full mt-3 h-20`,icon:(0,h.jsx)(p,{size:15}),children:E?`Initializing…`:`Complete Setup`})]})]})})}function _({preview:e}){let t=e.rows.filter(e=>!e.supported),n=e.rows.filter(e=>e.supported),r=e.exportedAt?e.exportedAt.replace(`T`,` `).slice(0,19):`unknown`;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-2 p-3 border border-inner-border rounded-control bg-surface-2`,children:[(0,h.jsxs)(`div`,{className:`flex items-center flex-wrap gap-1.5`,children:[(0,h.jsx)(`span`,{className:`min-w-0 overflow-hidden whitespace-nowrap text-ellipsis text-body font-semibold`,title:e.fileName,children:e.fileName}),(0,h.jsxs)(`span`,{className:`inline-flex items-center flex-none px-3.5 py-px border border-inner-border rounded-md bg-surface-2 text-text-secondary text-badge tabular-nums`,children:[`v`,e.version]}),t.length>0?(0,h.jsxs)(`span`,{className:`inline-flex items-center flex-none px-3.5 py-px border rounded-md bg-surface-2 text-badge tabular-nums border-warning-line text-status-warning`,children:[t.length,` unsupported`]}):null]}),(0,h.jsxs)(`p`,{className:`m-0 text-text-secondary text-caption`,children:[e.total,` rows across `,e.rows.length,` tables · exported `,r]}),t.length>0?(0,h.jsx)(`p`,{className:`m-0 text-caption text-status-warning`,children:t.length===e.rows.length?`None of these tables exist in this build, so nothing can be restored.`:`This build no longer has some of these tables. The rest still restores.`}):null,e.rows.length===0?(0,h.jsx)(`p`,{className:`m-0 text-text-secondary text-caption`,children:`This backup is empty.`}):(0,h.jsx)(`div`,{className:`max-h-110 overflow-auto`,children:(0,h.jsx)(d,{headers:[`Table`,`Section`,`Rows`],dense:!0,children:[...n,...t].map(e=>(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`td`,{children:e.table}),(0,h.jsx)(`td`,{children:e.section}),(0,h.jsx)(`td`,{className:`text-right`,children:e.supported?e.count:(0,h.jsx)(`span`,{className:`inline-flex items-center flex-none px-3.5 py-px border rounded-md bg-surface-2 text-badge tabular-nums border-warning-line text-status-warning`,children:`unsupported`})})]},`${e.section}/${e.table}`))})})]})}function v({message:e}){return(0,h.jsx)(`div`,{className:`py-5 px-7 rounded-control bg-red-soft text-red text-caption font-medium`,role:`alert`,children:e})}export{g as default};
@@ -1,4 +1,4 @@
1
- import{a as e,i as t,n,o as r,r as i,t as a}from"./jsx-runtime-CXUMngI_.js";import{o}from"./app-BDJWMThu.js";import{i as s,n as c,r as l,t as u}from"./drawer-CDKOTZdY.js";import{n as d,t as f}from"./brain-Cwed_72z.js";import{t as p}from"./check-D69FzdvC.js";import{n as m,t as h}from"./select-CGUuTQmj.js";import{t as g}from"./circle-alert-CntYHV5v.js";import{n as _}from"./toast-DKAdP2mo.js";import{t as v}from"./copy-ngmQ9zcZ.js";import{t as y}from"./download-A0SW9OCW.js";import{t as b}from"./gauge-BbIMy7MB.js";import{t as x}from"./message-circle-CCxGwRvv.js";import{t as S}from"./dialog-iocKA3jr.js";import{t as C}from"./pencil-768ysRAr.js";import{t as w}from"./rotate-ccw-CufcqITi.js";import{t as T}from"./sliders-horizontal-ClG7dBeJ.js";import{t as E}from"./wrench-B6E1oEuY.js";import{Q as D}from"./entry-KOZCZ9VG.js";import{n as O,t as k}from"./card-BTdbRFFg.js";import{n as A,r as j}from"./input-Bn4_kNav.js";import{n as M,t as N}from"./ModelPicker-CAiPR5Vd.js";import{a as ee,t as te}from"./api-keys-CjIGQhe7.js";var P=n(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),ne=n(`database-zap`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 15 21.84`,key:`14ibmq`}],[`path`,{d:`M21 5V8`,key:`1marbg`}],[`path`,{d:`M21 12L18 17H22L19 22`,key:`zafso`}],[`path`,{d:`M3 12A9 3 0 0 0 14.59 14.87`,key:`1y4wr8`}]]),F=n(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),re=n(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),ie=n(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),ae=n(`sigma`,[[`path`,{d:`M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2`,key:`wuwx1p`}]]),oe=n(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),se=n(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]);function I(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var ce=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,le=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ue={};function de(e,t){return((t||ue).jsx?le:ce).test(e)}var fe=/[ \t\n\f\r]/g;function pe(e){return typeof e==`object`?e.type===`text`&&me(e.value):me(e)}function me(e){return e.replace(fe,``)===``}var he=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};he.prototype.normal={},he.prototype.property={},he.prototype.space=void 0;function ge(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new he(n,r,t)}function _e(e){return e.toLowerCase()}var L=class{constructor(e,t){this.attribute=t,this.property=e}};L.prototype.attribute=``,L.prototype.booleanish=!1,L.prototype.boolean=!1,L.prototype.commaOrSpaceSeparated=!1,L.prototype.commaSeparated=!1,L.prototype.defined=!1,L.prototype.mustUseProperty=!1,L.prototype.number=!1,L.prototype.overloadedBoolean=!1,L.prototype.property=``,L.prototype.spaceSeparated=!1,L.prototype.space=void 0;var ve=e({boolean:()=>R,booleanish:()=>z,commaOrSpaceSeparated:()=>H,commaSeparated:()=>xe,number:()=>B,overloadedBoolean:()=>be,spaceSeparated:()=>V}),ye=0,R=Se(),z=Se(),be=Se(),B=Se(),V=Se(),xe=Se(),H=Se();function Se(){return 2**++ye}var Ce=Object.keys(ve),we=class extends L{constructor(e,t,n,r){let i=-1;if(super(e,t),Te(this,`space`,r),typeof n==`number`)for(;++i<Ce.length;){let e=Ce[i];Te(this,Ce[i],(n&ve[e])===ve[e])}}};we.prototype.defined=!0;function Te(e,t,n){n&&(e[t]=n)}function Ee(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new we(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[_e(r)]=r,n[_e(a.attribute)]=r}return new he(t,n,e.space)}var De=Ee({properties:{ariaActiveDescendant:null,ariaAtomic:z,ariaAutoComplete:null,ariaBusy:z,ariaChecked:z,ariaColCount:B,ariaColIndex:B,ariaColSpan:B,ariaControls:V,ariaCurrent:null,ariaDescribedBy:V,ariaDetails:null,ariaDisabled:z,ariaDropEffect:V,ariaErrorMessage:null,ariaExpanded:z,ariaFlowTo:V,ariaGrabbed:z,ariaHasPopup:null,ariaHidden:z,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:V,ariaLevel:B,ariaLive:null,ariaModal:z,ariaMultiLine:z,ariaMultiSelectable:z,ariaOrientation:null,ariaOwns:V,ariaPlaceholder:null,ariaPosInSet:B,ariaPressed:z,ariaReadOnly:z,ariaRelevant:null,ariaRequired:z,ariaRoleDescription:V,ariaRowCount:B,ariaRowIndex:B,ariaRowSpan:B,ariaSelected:z,ariaSetSize:B,ariaSort:null,ariaValueMax:B,ariaValueMin:B,ariaValueNow:B,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Oe(e,t){return t in e?e[t]:t}function ke(e,t){return Oe(e,t.toLowerCase())}var Ae=Ee({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:xe,acceptCharset:V,accessKey:V,action:null,allow:null,allowFullScreen:R,allowPaymentRequest:R,allowUserMedia:R,alpha:R,alt:null,as:null,async:R,autoCapitalize:null,autoComplete:V,autoFocus:R,autoPlay:R,blocking:V,capture:null,charSet:null,checked:R,cite:null,className:V,closedBy:null,colorSpace:null,cols:B,colSpan:B,command:null,commandFor:null,content:null,contentEditable:z,controls:R,controlsList:V,coords:B|xe,crossOrigin:null,data:null,dateTime:null,decoding:null,default:R,defer:R,dir:null,dirName:null,disabled:R,download:be,draggable:z,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:R,formTarget:null,headers:V,height:B,hidden:be,high:B,href:null,hrefLang:null,htmlFor:V,httpEquiv:V,id:null,imageSizes:null,imageSrcSet:null,inert:R,inputMode:null,integrity:null,is:null,isMap:R,itemId:null,itemProp:V,itemRef:V,itemScope:R,itemType:V,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:R,low:B,manifest:null,max:null,maxLength:B,media:null,method:null,min:null,minLength:B,multiple:R,muted:R,name:null,nonce:null,noModule:R,noValidate:R,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:R,optimum:B,pattern:null,ping:V,placeholder:null,playsInline:R,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:R,referrerPolicy:null,rel:V,required:R,reversed:R,rows:B,rowSpan:B,sandbox:V,scope:null,scoped:R,seamless:R,selected:R,shadowRootClonable:R,shadowRootCustomElementRegistry:R,shadowRootDelegatesFocus:R,shadowRootMode:null,shadowRootSerializable:R,shape:null,size:B,sizes:null,slot:null,span:B,spellCheck:z,src:null,srcDoc:null,srcLang:null,srcSet:null,start:B,step:null,style:null,tabIndex:B,target:null,title:null,translate:null,type:null,typeMustMatch:R,useMap:null,value:z,width:B,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:V,axis:null,background:null,bgColor:null,border:B,borderColor:null,bottomMargin:B,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:R,declare:R,event:null,face:null,frame:null,frameBorder:null,hSpace:B,leftMargin:B,link:null,longDesc:null,lowSrc:null,marginHeight:B,marginWidth:B,noResize:R,noHref:R,noShade:R,noWrap:R,object:null,profile:null,prompt:null,rev:null,rightMargin:B,rules:null,scheme:null,scrolling:z,standby:null,summary:null,text:null,topMargin:B,valueType:null,version:null,vAlign:null,vLink:null,vSpace:B,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:R,disablePictureInPicture:R,disableRemotePlayback:R,exportParts:xe,part:V,prefix:null,property:null,results:B,security:null,unselectable:null},space:`html`,transform:ke}),je=Ee({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`,maskType:`mask-type`,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:H,accentHeight:B,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:B,amplitude:B,arabicForm:null,ascent:B,attributeName:null,attributeType:null,azimuth:B,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:B,by:null,calcMode:null,capHeight:B,className:V,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:B,diffuseConstant:B,direction:null,display:null,dur:null,divisor:B,dominantBaseline:null,download:R,dx:null,dy:null,edgeMode:null,editable:null,elevation:B,enableBackground:null,end:null,event:null,exponent:B,externalResourcesRequired:null,fill:null,fillOpacity:B,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:xe,g2:xe,glyphName:xe,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:B,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:B,horizOriginX:B,horizOriginY:B,id:null,ideographic:B,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:B,k:B,k1:B,k2:B,k3:B,k4:B,kernelMatrix:H,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:B,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:B,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:B,overlineThickness:B,paintOrder:null,panose1:null,path:null,pathLength:B,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:V,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:B,pointsAtY:B,pointsAtZ:B,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:H,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:H,rev:H,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:H,requiredFeatures:H,requiredFonts:H,requiredFormats:H,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:B,specularExponent:B,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:B,strikethroughThickness:B,string:null,stroke:null,strokeDashArray:H,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:B,strokeOpacity:B,strokeWidth:null,style:null,surfaceScale:B,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:H,tabIndex:B,tableValues:null,target:null,targetX:B,targetY:B,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:H,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:B,underlineThickness:B,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:B,values:null,vAlphabetic:B,vMathematical:B,vectorEffect:null,vHanging:B,vIdeographic:B,version:null,vertAdvY:B,vertOriginX:B,vertOriginY:B,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:B,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Oe}),Me=Ee({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()}}),Ne=Ee({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:ke}),Pe=Ee({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Fe={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`},Ie=/[A-Z]/g,Le=/-[a-z]/g,Re=/^data[-\w.:]+$/i;function ze(e,t){let n=_e(t),r=t,i=L;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Re.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Le,Ve);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Le.test(e)){let n=e.replace(Ie,Be);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=we}return new i(r,t)}function Be(e){return`-`+e.toLowerCase()}function Ve(e){return e.charAt(1).toUpperCase()}var He=ge([De,Ae,Me,Ne,Pe],`html`),Ue=ge([De,je,Me,Ne,Pe],`svg`);function We(e){return e.join(` `).trim()}var Ge=t(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
1
+ import{a as e,i as t,n,o as r,r as i,t as a}from"./jsx-runtime-CXUMngI_.js";import{o}from"./app-BDJWMThu.js";import{i as s,n as c,r as l,t as u}from"./drawer-CDKOTZdY.js";import{n as d,t as f}from"./brain-Cwed_72z.js";import{t as p}from"./check-D69FzdvC.js";import{n as m,t as h}from"./select-CGUuTQmj.js";import{t as g}from"./circle-alert-CntYHV5v.js";import{n as _}from"./toast-DKAdP2mo.js";import{t as v}from"./copy-ngmQ9zcZ.js";import{t as y}from"./download-A0SW9OCW.js";import{t as b}from"./gauge-BbIMy7MB.js";import{t as x}from"./message-circle-CCxGwRvv.js";import{t as S}from"./dialog-iocKA3jr.js";import{t as C}from"./pencil-768ysRAr.js";import{t as w}from"./rotate-ccw-CufcqITi.js";import{t as T}from"./sliders-horizontal-ClG7dBeJ.js";import{t as E}from"./wrench-B6E1oEuY.js";import{Q as D}from"./entry-6PSJYbzI.js";import{n as O,t as k}from"./card-BTdbRFFg.js";import{n as A,r as j}from"./input-Bn4_kNav.js";import{n as M,t as N}from"./ModelPicker-CAiPR5Vd.js";import{a as ee,t as te}from"./api-keys-CjIGQhe7.js";var P=n(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),ne=n(`database-zap`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 15 21.84`,key:`14ibmq`}],[`path`,{d:`M21 5V8`,key:`1marbg`}],[`path`,{d:`M21 12L18 17H22L19 22`,key:`zafso`}],[`path`,{d:`M3 12A9 3 0 0 0 14.59 14.87`,key:`1y4wr8`}]]),F=n(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),re=n(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),ie=n(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),ae=n(`sigma`,[[`path`,{d:`M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2`,key:`wuwx1p`}]]),oe=n(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),se=n(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]);function I(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var ce=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,le=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ue={};function de(e,t){return((t||ue).jsx?le:ce).test(e)}var fe=/[ \t\n\f\r]/g;function pe(e){return typeof e==`object`?e.type===`text`&&me(e.value):me(e)}function me(e){return e.replace(fe,``)===``}var he=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};he.prototype.normal={},he.prototype.property={},he.prototype.space=void 0;function ge(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new he(n,r,t)}function _e(e){return e.toLowerCase()}var L=class{constructor(e,t){this.attribute=t,this.property=e}};L.prototype.attribute=``,L.prototype.booleanish=!1,L.prototype.boolean=!1,L.prototype.commaOrSpaceSeparated=!1,L.prototype.commaSeparated=!1,L.prototype.defined=!1,L.prototype.mustUseProperty=!1,L.prototype.number=!1,L.prototype.overloadedBoolean=!1,L.prototype.property=``,L.prototype.spaceSeparated=!1,L.prototype.space=void 0;var ve=e({boolean:()=>R,booleanish:()=>z,commaOrSpaceSeparated:()=>H,commaSeparated:()=>xe,number:()=>B,overloadedBoolean:()=>be,spaceSeparated:()=>V}),ye=0,R=Se(),z=Se(),be=Se(),B=Se(),V=Se(),xe=Se(),H=Se();function Se(){return 2**++ye}var Ce=Object.keys(ve),we=class extends L{constructor(e,t,n,r){let i=-1;if(super(e,t),Te(this,`space`,r),typeof n==`number`)for(;++i<Ce.length;){let e=Ce[i];Te(this,Ce[i],(n&ve[e])===ve[e])}}};we.prototype.defined=!0;function Te(e,t,n){n&&(e[t]=n)}function Ee(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new we(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[_e(r)]=r,n[_e(a.attribute)]=r}return new he(t,n,e.space)}var De=Ee({properties:{ariaActiveDescendant:null,ariaAtomic:z,ariaAutoComplete:null,ariaBusy:z,ariaChecked:z,ariaColCount:B,ariaColIndex:B,ariaColSpan:B,ariaControls:V,ariaCurrent:null,ariaDescribedBy:V,ariaDetails:null,ariaDisabled:z,ariaDropEffect:V,ariaErrorMessage:null,ariaExpanded:z,ariaFlowTo:V,ariaGrabbed:z,ariaHasPopup:null,ariaHidden:z,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:V,ariaLevel:B,ariaLive:null,ariaModal:z,ariaMultiLine:z,ariaMultiSelectable:z,ariaOrientation:null,ariaOwns:V,ariaPlaceholder:null,ariaPosInSet:B,ariaPressed:z,ariaReadOnly:z,ariaRelevant:null,ariaRequired:z,ariaRoleDescription:V,ariaRowCount:B,ariaRowIndex:B,ariaRowSpan:B,ariaSelected:z,ariaSetSize:B,ariaSort:null,ariaValueMax:B,ariaValueMin:B,ariaValueNow:B,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Oe(e,t){return t in e?e[t]:t}function ke(e,t){return Oe(e,t.toLowerCase())}var Ae=Ee({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:xe,acceptCharset:V,accessKey:V,action:null,allow:null,allowFullScreen:R,allowPaymentRequest:R,allowUserMedia:R,alpha:R,alt:null,as:null,async:R,autoCapitalize:null,autoComplete:V,autoFocus:R,autoPlay:R,blocking:V,capture:null,charSet:null,checked:R,cite:null,className:V,closedBy:null,colorSpace:null,cols:B,colSpan:B,command:null,commandFor:null,content:null,contentEditable:z,controls:R,controlsList:V,coords:B|xe,crossOrigin:null,data:null,dateTime:null,decoding:null,default:R,defer:R,dir:null,dirName:null,disabled:R,download:be,draggable:z,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:R,formTarget:null,headers:V,height:B,hidden:be,high:B,href:null,hrefLang:null,htmlFor:V,httpEquiv:V,id:null,imageSizes:null,imageSrcSet:null,inert:R,inputMode:null,integrity:null,is:null,isMap:R,itemId:null,itemProp:V,itemRef:V,itemScope:R,itemType:V,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:R,low:B,manifest:null,max:null,maxLength:B,media:null,method:null,min:null,minLength:B,multiple:R,muted:R,name:null,nonce:null,noModule:R,noValidate:R,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:R,optimum:B,pattern:null,ping:V,placeholder:null,playsInline:R,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:R,referrerPolicy:null,rel:V,required:R,reversed:R,rows:B,rowSpan:B,sandbox:V,scope:null,scoped:R,seamless:R,selected:R,shadowRootClonable:R,shadowRootCustomElementRegistry:R,shadowRootDelegatesFocus:R,shadowRootMode:null,shadowRootSerializable:R,shape:null,size:B,sizes:null,slot:null,span:B,spellCheck:z,src:null,srcDoc:null,srcLang:null,srcSet:null,start:B,step:null,style:null,tabIndex:B,target:null,title:null,translate:null,type:null,typeMustMatch:R,useMap:null,value:z,width:B,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:V,axis:null,background:null,bgColor:null,border:B,borderColor:null,bottomMargin:B,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:R,declare:R,event:null,face:null,frame:null,frameBorder:null,hSpace:B,leftMargin:B,link:null,longDesc:null,lowSrc:null,marginHeight:B,marginWidth:B,noResize:R,noHref:R,noShade:R,noWrap:R,object:null,profile:null,prompt:null,rev:null,rightMargin:B,rules:null,scheme:null,scrolling:z,standby:null,summary:null,text:null,topMargin:B,valueType:null,version:null,vAlign:null,vLink:null,vSpace:B,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:R,disablePictureInPicture:R,disableRemotePlayback:R,exportParts:xe,part:V,prefix:null,property:null,results:B,security:null,unselectable:null},space:`html`,transform:ke}),je=Ee({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`,maskType:`mask-type`,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:H,accentHeight:B,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:B,amplitude:B,arabicForm:null,ascent:B,attributeName:null,attributeType:null,azimuth:B,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:B,by:null,calcMode:null,capHeight:B,className:V,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:B,diffuseConstant:B,direction:null,display:null,dur:null,divisor:B,dominantBaseline:null,download:R,dx:null,dy:null,edgeMode:null,editable:null,elevation:B,enableBackground:null,end:null,event:null,exponent:B,externalResourcesRequired:null,fill:null,fillOpacity:B,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:xe,g2:xe,glyphName:xe,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:B,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:B,horizOriginX:B,horizOriginY:B,id:null,ideographic:B,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:B,k:B,k1:B,k2:B,k3:B,k4:B,kernelMatrix:H,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:B,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:B,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:B,overlineThickness:B,paintOrder:null,panose1:null,path:null,pathLength:B,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:V,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:B,pointsAtY:B,pointsAtZ:B,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:H,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:H,rev:H,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:H,requiredFeatures:H,requiredFonts:H,requiredFormats:H,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:B,specularExponent:B,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:B,strikethroughThickness:B,string:null,stroke:null,strokeDashArray:H,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:B,strokeOpacity:B,strokeWidth:null,style:null,surfaceScale:B,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:H,tabIndex:B,tableValues:null,target:null,targetX:B,targetY:B,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:H,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:B,underlineThickness:B,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:B,values:null,vAlphabetic:B,vMathematical:B,vectorEffect:null,vHanging:B,vIdeographic:B,version:null,vertAdvY:B,vertOriginX:B,vertOriginY:B,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:B,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Oe}),Me=Ee({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()}}),Ne=Ee({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:ke}),Pe=Ee({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Fe={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`},Ie=/[A-Z]/g,Le=/-[a-z]/g,Re=/^data[-\w.:]+$/i;function ze(e,t){let n=_e(t),r=t,i=L;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Re.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Le,Ve);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Le.test(e)){let n=e.replace(Ie,Be);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=we}return new i(r,t)}function Be(e){return`-`+e.toLowerCase()}function Ve(e){return e.charAt(1).toUpperCase()}var He=ge([De,Ae,Me,Ne,Pe],`html`),Ue=ge([De,je,Me,Ne,Pe],`svg`);function We(e){return e.join(` `).trim()}var Ge=t(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
2
2
  `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),Ke=t((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(Ge());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),qe=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Je=t(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Ke()),r=qe();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Ye=Ze(`end`),Xe=Ze(`start`);function Ze(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Qe(e){let t=Xe(e),n=Ye(e);if(t&&n)return{start:t,end:n}}function $e(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?tt(e.position):`start`in e||`end`in e?tt(e):`line`in e||`column`in e?et(e):``}function et(e){return nt(e&&e.line)+`:`+nt(e&&e.column)}function tt(e){return et(e&&e.start)+`-`+et(e&&e.end)}function nt(e){return e&&typeof e==`number`?e:1}var U=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=$e(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};U.prototype.file=``,U.prototype.name=``,U.prototype.reason=``,U.prototype.message=``,U.prototype.stack=``,U.prototype.column=void 0,U.prototype.line=void 0,U.prototype.ancestors=void 0,U.prototype.cause=void 0,U.prototype.fatal=void 0,U.prototype.place=void 0,U.prototype.ruleId=void 0,U.prototype.source=void 0;var rt=r(Je(),1),it={}.hasOwnProperty,at=new Map,ot=/[A-Z]/g,st=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),ct=new Set([`td`,`th`]),lt=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function ut(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=xt(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=bt(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Ue:He,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=dt(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function dt(e,t,n){if(t.type===`element`)return ft(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return pt(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return ht(e,t,n);if(t.type===`mdxjsEsm`)return mt(e,t);if(t.type===`root`)return gt(e,t,n);if(t.type===`text`)return _t(e,t)}function ft(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Ue,e.schema=i),e.ancestors.push(t);let a=Dt(e,t.tagName,!1),o=St(e,t),s=wt(e,t);return st.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!pe(e)})),vt(e,o,a,t),yt(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function pt(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Ot(e,t.position)}function mt(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ot(e,t.position)}function ht(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Ue,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Dt(e,t.name,!0),o=Ct(e,t),s=wt(e,t);return vt(e,o,a,t),yt(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function gt(e,t,n){let r={};return yt(r,wt(e,t)),e.create(t,e.Fragment,r,n)}function _t(e,t){return t.value}function vt(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function yt(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function bt(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function xt(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Xe(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function St(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&it.call(t.properties,i)){let a=Tt(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&ct.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Ct(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Ot(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Ot(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function wt(e,t){let n=[],r=-1,i=e.passKeys?new Map:at;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=dt(e,a,o);s!==void 0&&n.push(s)}return n}function Tt(e,t,n){let r=ze(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?I(n):We(n)),r.property===`style`){let t=typeof n==`object`?n:Et(e,String(n));return e.stylePropertyNameCase===`css`&&(t=kt(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Fe[r.property]||r.property:r.attribute,n]}}function Et(e,t){try{return(0,rt.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new U("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=lt+`#cannot-parse-style-attribute`,r}}function Dt(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=de(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=de(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return it.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ot(e)}function Ot(e,t){let n=new U("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=lt+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function kt(e){let t={},n;for(n in e)it.call(e,n)&&(t[At(n)]=e[n]);return t}function At(e){let t=e.replace(ot,jt);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function jt(e){return`-`+e.toLowerCase()}var Mt={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`]},Nt={};function Pt(e,t){let n=t||Nt;return Ft(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function Ft(e,t,n){if(Lt(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 It(e.children,t,n)}return Array.isArray(e)?It(e,t,n):``}function It(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Ft(e[i],t,n);return r.join(``)}function Lt(e){return!!(e&&typeof e==`object`)}var Rt=document.createElement(`i`);function zt(e){let t=`&`+e+`;`;Rt.innerHTML=t;let n=Rt.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function W(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Bt(e,t){return e.length>0?(W(e,e.length,0,t),e):t}var Vt={}.hasOwnProperty;function Ht(e){let t={},n=-1;for(;++n<e.length;)Ut(t,e[n]);return t}function Ut(e,t){let n;for(n in t){let r=(Vt.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Vt.call(r,a)||(r[a]=[]);let e=i[a];Wt(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Wt(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);W(e,0,0,r)}function Gt(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function Kt(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var G=en(/[A-Za-z]/),K=en(/[\dA-Za-z]/),qt=en(/[#-'*+\--9=?A-Z^-~]/);function Jt(e){return e!==null&&(e<32||e===127)}var Yt=en(/\d/),Xt=en(/[\dA-Fa-f]/),Zt=en(/[!-/:-@[-`{-~]/);function q(e){return e!==null&&e<-2}function J(e){return e!==null&&(e<0||e===32)}function Y(e){return e===-2||e===-1||e===32}var Qt=en(/\p{P}|\p{S}/u),$t=en(/\s/);function en(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function tn(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&K(e.charCodeAt(n+1))&&K(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function X(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Y(r)?(e.enter(n),s(r)):t(r)}function s(r){return Y(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var nn={tokenize:rn};function rn(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return q(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var an={tokenize:sn},on={tokenize:cn};function sn(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return W(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(on,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(on,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return q(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;W(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function cn(e,t,n){return X(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function ln(e){if(e===null||J(e)||$t(e))return 1;if(Qt(e))return 2}function un(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var dn={name:`attention`,resolveAll:fn,tokenize:pn};function fn(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};mn(d,-c),mn(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Bt(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Bt(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Bt(l,un(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Bt(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Bt(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,W(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function pn(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=ln(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=ln(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function mn(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var hn={name:`autolink`,tokenize:gn};function gn(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return G(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||K(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||K(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Jt(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):qt(t)?(e.consume(t),l):n(t)}function u(e){return K(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||K(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var _n={partial:!0,tokenize:vn};function vn(e,t,n){return r;function r(t){return Y(t)?X(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||q(e)?t(e):n(e)}}var yn={continuation:{tokenize:xn},exit:Sn,name:`blockQuote`,tokenize:bn};function bn(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Y(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function xn(e,t,n){let r=this;return i;function i(t){return Y(t)?X(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(yn,t,n)(r)}}function Sn(e){e.exit(`blockQuote`)}var Cn={name:`characterEscape`,tokenize:wn};function wn(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Zt(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Tn={name:`characterReference`,tokenize:En};function En(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=K,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Xt,u):(e.enter(`characterReferenceValue`),a=7,o=Yt,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===K&&!zt(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var Dn={partial:!0,tokenize:An},On={concrete:!0,name:`codeFenced`,tokenize:kn};function kn(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Y(t)?X(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||q(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(Dn,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),X(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||q(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Y(t)?X(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||q(t)?e.check(Dn,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||q(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Y(t)?X(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Y(t)?X(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||q(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function An(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var jn={name:`codeIndented`,tokenize:Nn},Mn={partial:!0,tokenize:Pn};function Nn(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),X(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):q(t)?e.attempt(Mn,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||q(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Pn(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):X(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):q(e)?i(e):n(e)}}var Fn={name:`codeText`,previous:Ln,resolve:In,tokenize:Rn};function In(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 Ln(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Rn(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||q(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var zn=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&Bn(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),Bn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Bn(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);Bn(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);Bn(this.left,t.reverse())}}}};function Bn(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 Vn(e){let t={},n=-1,r,i,a,o,s,c,l,u=new zn(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,Hn(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return W(e,0,1/0,u.slice(0)),!l}function Hn(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Un={resolve:Gn,tokenize:Kn},Wn={partial:!0,tokenize:qn};function Gn(e){return Vn(e),e}function Kn(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):q(t)?e.check(Wn,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function qn(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,a,`linePrefix`)}function a(i){if(i===null||q(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Jn(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Jt(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||q(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||J(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Jt(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Yn(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):q(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||q(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Y(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Xn(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||q(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Zn(e,t){let n;return r;function r(i){return q(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Y(i)?X(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Qn={name:`definition`,tokenize:er},$n={partial:!0,tokenize:tr};function er(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Yn.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Kt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return J(t)?Zn(e,l)(t):l(t)}function l(t){return Jn(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt($n,d,d)(t)}function d(t){return Y(t)?X(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||q(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function tr(e,t,n){return r;function r(t){return J(t)?Zn(e,i)(t):n(t)}function i(t){return Xn(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Y(t)?X(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||q(e)?t(e):n(e)}}var nr={name:`hardBreakEscape`,tokenize:rr};function rr(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return q(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var ir={name:`headingAtx`,resolve:ar,tokenize:or};function ar(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`},W(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function or(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||J(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||q(n)?(e.exit(`atxHeading`),t(n)):Y(n)?X(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||J(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var sr=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),cr=[`pre`,`script`,`style`,`textarea`],lr={concrete:!0,name:`htmlFlow`,resolveTo:fr,tokenize:pr},ur={partial:!0,tokenize:hr},dr={partial:!0,tokenize:mr};function fr(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 pr(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:P):G(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):G(a)?(e.consume(a),i=4,r.interrupt?t:P):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:P):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return G(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||J(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&cr.includes(l)?(i=1,r.interrupt?t(s):O(s)):sr.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||K(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Y(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||G(t)?(e.consume(t),b):Y(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||K(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Y(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Y(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||q(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||J(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Y(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||q(t)?O(t):Y(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),ne):t===63&&i===3?(e.consume(t),P):t===93&&i===5?(e.consume(t),te):q(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(ur,F,k)(t)):t===null||q(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(dr,A,F)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||q(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),P):O(t)}function N(t){return t===47?(e.consume(t),o=``,ee):O(t)}function ee(t){if(t===62){let n=o.toLowerCase();return cr.includes(n)?(e.consume(t),ne):O(t)}return G(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ee):O(t)}function te(t){return t===93?(e.consume(t),P):O(t)}function P(t){return t===62?(e.consume(t),ne):t===45&&i===2?(e.consume(t),P):O(t)}function ne(t){return t===null||q(t)?(e.exit(`htmlFlowData`),F(t)):(e.consume(t),ne)}function F(n){return e.exit(`htmlFlow`),t(n)}}function mr(e,t,n){let r=this;return i;function i(t){return q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function hr(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(_n,t,n)}}var gr={name:`htmlText`,tokenize:_r};function _r(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):G(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):G(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):q(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):q(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):q(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):q(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return G(t)?(e.consume(t),S):n(t)}function S(t){return t===45||K(t)?(e.consume(t),S):C(t)}function C(t){return q(t)?(o=C,N(t)):Y(t)?(e.consume(t),C):M(t)}function w(t){return t===45||K(t)?(e.consume(t),w):t===47||t===62||J(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||G(t)?(e.consume(t),E):q(t)?(o=T,N(t)):Y(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||K(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):q(t)?(o=D,N(t)):Y(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):q(t)?(o=O,N(t)):Y(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):q(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||J(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||J(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ee}function ee(t){return Y(t)?X(e,te,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):te(t)}function te(t){return e.enter(`htmlTextData`),o(t)}}var vr={name:`labelEnd`,resolveAll:Sr,resolveTo:Cr,tokenize:wr},yr={tokenize:Tr},br={tokenize:Er},xr={tokenize:Dr};function Sr(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&W(e,0,e.length,n),e}function Cr(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=Bt(s,e.slice(a+1,a+r+3)),s=Bt(s,[[`enter`,u,t]]),s=Bt(s,un(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Bt(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Bt(s,e.slice(o+1)),s=Bt(s,[[`exit`,c,t]]),W(e,a,e.length,s),e}function wr(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(Kt(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(yr,u,o?u:d)(t):t===91?e.attempt(br,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(xr,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Tr(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return J(t)?Zn(e,a)(t):a(t)}function a(t){return t===41?u(t):Jn(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return J(t)?Zn(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Xn(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return J(t)?Zn(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function Er(e,t,n){let r=this;return i;function i(t){return Yn.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Kt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Dr(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Or={name:`labelStartImage`,resolveAll:vr.resolveAll,tokenize:kr};function kr(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Ar={name:`labelStartLink`,resolveAll:vr.resolveAll,tokenize:jr};function jr(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Mr={name:`lineEnding`,tokenize:Nr};function Nr(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}}var Pr={name:`thematicBreak`,tokenize:Fr};function Fr(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||q(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Y(t)?X(e,s,`whitespace`)(t):s(t))}}var Z={continuation:{tokenize:zr},exit:Vr,name:`list`,tokenize:Rr},Ir={partial:!0,tokenize:Hr},Lr={partial:!0,tokenize:Br};function Rr(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Yt(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Pr,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Yt(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(_n,r.interrupt?n:u,e.attempt(Ir,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Y(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function zr(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(_n,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,X(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Y(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Lr,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,X(e,e.attempt(Z,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Br(e,t,n){let r=this;return X(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Vr(e){e.exit(this.containerState.type)}function Hr(e,t,n){let r=this;return X(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Y(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Ur={name:`setextUnderline`,resolveTo:Wr,tokenize:Gr};function Wr(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Gr(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Y(t)?X(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||q(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Kr={tokenize:qr};function qr(e){let t=this,n=e.attempt(_n,r,e.attempt(this.parser.constructs.flowInitial,i,X(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Un,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Jr={resolveAll:Qr()},Yr=Zr(`string`),Xr=Zr(`text`);function Zr(e){return{resolveAll:Qr(e===`text`?$r:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Qr(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function $r(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var ei=e({attentionMarkers:()=>ci,contentInitial:()=>ni,disable:()=>li,document:()=>ti,flow:()=>ii,flowInitial:()=>ri,insideSpan:()=>si,string:()=>ai,text:()=>oi}),ti={42:Z,43:Z,45:Z,48:Z,49:Z,50:Z,51:Z,52:Z,53:Z,54:Z,55:Z,56:Z,57:Z,62:yn},ni={91:Qn},ri={[-2]:jn,[-1]:jn,32:jn},ii={35:ir,42:Pr,45:[Ur,Pr],60:lr,61:Ur,95:Pr,96:On,126:On},ai={38:Tn,92:Cn},oi={[-5]:Mr,[-4]:Mr,[-3]:Mr,33:Or,38:Tn,42:dn,60:[hn,gr],91:Ar,92:[nr,Cn],93:vr,95:dn,96:Fn},si={null:[dn,Jr]},ci={null:[42,95]},li={null:[]};function ui(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Bt(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=un(a,l.events,l),l.events):[]}function f(e,t){return fi(p(e),t)}function p(e){return di(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){q(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&W(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function di(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function fi(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
3
3
  `;break;case-3:o=`\r
4
4
  `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function pi(e){let t={constructs:Ht([ei,...(e||{}).extensions||[]]),content:n(nn),defined:[],document:n(an),flow:n(Kr),lazy:{},string:n(Yr),text:n(Xr)};return t;function n(e){return n;function n(n){return ui(t,e,n)}}}function mi(e){for(;!Vn(e););return e}var hi=/[\0\t\n\r]/g;function gi(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(hi.lastIndex=u,c=hi.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var _i=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function vi(e){return e.replace(_i,yi)}function yi(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Gt(n.slice(t?2:1),t?16:10)}return zt(n)||e}var bi={}.hasOwnProperty;function xi(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Si(n)(mi(pi(n).document().write(gi()(e,t,!0))))}function Si(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(L),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(me),blockQuote:a(le),characterEscape:T,characterReference:T,codeFenced:a(ue),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ue,o),codeText:a(de,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(fe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(pe),hardBreakEscape:a(he),hardBreakTrailing:a(he),htmlFlow:a(ge,o),htmlFlowData:T,htmlText:a(ge,o),htmlTextData:T,image:a(_e),label:o,link:a(L),listItem:a(ye),listItemValue:f,listOrdered:a(ve,d),listUnordered:a(ve),paragraph:a(R),reference:re,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(me),strong:a(z),thematicBreak:a(B)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ce,autolinkProtocol:I,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:oe,characterReference:se,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:te,labelText:ee,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ie,resourceDestinationString:P,resourceTitleString:ne,resource:F,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};wi(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];bi.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||Ei).call(a,void 0,e[0])}for(r.position={start:Ci(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Ci(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Ci(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||Ei).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+$e({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Ci(e.end)}function u(){return Pt(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Kt(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=be(),n.position={start:Ci(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Ci(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Ci(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ee(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=vi(t),n.identifier=Kt(t).toLowerCase()}function te(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function P(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function F(){this.data.inReference=void 0}function re(){this.data.referenceType=`collapsed`}function ie(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Kt(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ae(e){this.data.characterReferenceType=e.type}function oe(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Gt(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=zt(t);let i=this.stack[this.stack.length-1];i.value+=r}function se(e){let t=this.stack.pop();t.position.end=Ci(e.end)}function I(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ce(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function le(){return{type:`blockquote`,children:[]}}function ue(){return{type:`code`,lang:null,meta:null,value:``}}function de(){return{type:`inlineCode`,value:``}}function fe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function pe(){return{type:`emphasis`,children:[]}}function me(){return{type:`heading`,depth:0,children:[]}}function he(){return{type:`break`}}function ge(){return{type:`html`,value:``}}function _e(){return{type:`image`,title:null,url:``,alt:null}}function L(){return{type:`link`,title:null,url:``,children:[]}}function ve(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function ye(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function R(){return{type:`paragraph`,children:[]}}function z(){return{type:`strong`,children:[]}}function be(){return{type:`text`,value:``}}function B(){return{type:`thematicBreak`}}}function Ci(e){return{line:e.line,column:e.column,offset:e.offset}}function wi(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?wi(e,r):Ti(e,r)}}function Ti(e,t){let n;for(n in t)if(bi.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function Ei(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+$e({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+$e({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+$e({start:t.start,end:t.end})+`) is still open`)}function Di(e){let t=this;t.parser=n;function n(n){return xi(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Oi(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function ki(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`