fumapress 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/cli/index.mjs +1 -1
- package/dist/waku/public/assets/_root-CycbLrC5.js +2 -0
- package/dist/waku/public/assets/{algolia-C1zJb8Qk.js → algolia-B69Wli14.js} +1 -1
- package/dist/waku/public/assets/{chevron-right-DeeB6Siw.js → chevron-right-CCr-NTvy.js} +1 -1
- package/dist/waku/public/assets/{client-BSiZmHUR.js → client-DJ13QlCD.js} +1 -1
- package/dist/waku/public/assets/client-s6S2un_X.js +3 -0
- package/dist/waku/public/assets/collapsible-Bykth93R.js +1 -0
- package/dist/waku/public/assets/{core-Dj5ux1GM.js → core-DX9uo12e.js} +3 -3
- package/dist/waku/public/assets/{i18n-C-Z_Hjir.js → i18n-DG4t4f9v.js} +1 -1
- package/dist/waku/public/assets/{index-fYADC7x8.js → index-18GBv5c2.js} +1 -1
- package/dist/waku/public/assets/{index-CU8t-3_R.js → index-82PkV7Pm.js} +1 -1
- package/dist/waku/public/assets/{index-BHSCznho.js → index-9Vsiq1Kd.js} +1 -1
- package/dist/waku/public/assets/index-BUcmNNzQ.js +1 -0
- package/dist/waku/public/assets/index-BnxuD_GW.js +1 -0
- package/dist/waku/public/assets/{index-BLK6p4I7.js → index-BwTbBIqA.js} +1 -1
- package/dist/waku/public/assets/{index-BJW5cYpx.js → index-CCS3nv-i.js} +6 -6
- package/dist/waku/public/assets/index-CHA9qEgR.js +1 -0
- package/dist/waku/public/assets/index-CNVjeQt4.js +1 -0
- package/dist/waku/public/assets/index-CV7yq2SK.js +41 -0
- package/dist/waku/public/assets/{index-DwAEwgq3.js → index-D3bZiHtT.js} +2 -2
- package/dist/waku/public/assets/{index-CLyIGTiM.js → index-DOEHfaq9.js} +15 -15
- package/dist/waku/public/assets/{index-BNzds__a.js → index-DP8HDMXM.js} +1 -1
- package/dist/waku/public/assets/index-DTcPPegm.js +1 -0
- package/dist/waku/public/assets/merge-refs-CciE9kPU.js +1 -0
- package/dist/waku/public/assets/{orama-cloud-B7ExjOsf.js → orama-cloud-BSCOu79K.js} +1 -1
- package/dist/waku/public/assets/{orama-cloud-legacy-BYWQ8iUS.js → orama-cloud-legacy-BMB0bpmA.js} +1 -1
- package/dist/waku/public/assets/{orama-static-BFn8xSUZ.js → orama-static-C0Cd3t1x.js} +1 -1
- package/dist/waku/public/assets/page-actions-DCdEFeIr.js +1 -0
- package/dist/waku/public/assets/{proxy-1YR77jQp.js → proxy-BEQbDZTm.js} +1 -1
- package/dist/waku/public/assets/scroll-area-DJkeD9SQ.js +1 -0
- package/dist/waku/public/assets/{search-BvoJUzZe.js → search-CUUh5VYW.js} +1 -1
- package/dist/waku/public/assets/{search-default-Cskx3A9x.js → search-default-2hZ1VIYE.js} +3 -3
- package/dist/waku/public/assets/{use-copy-button-BVfD1u7Q.js → use-copy-button-xpFuyTA0.js} +1 -1
- package/dist/waku/public/assets/{x-Bcn3Z-A2.js → x-DQzaIRL0.js} +1 -1
- package/dist/waku/server/__vite_rsc_assets_manifest.js +139 -240
- package/dist/waku/server/assets/{_...slugs_-G8fPO_O-.js → _...slugs_-BWH2IkXA.js} +27 -34
- package/dist/waku/server/assets/{_root-mEnnxZFG.js → _root-DVILELsb.js} +1 -1
- package/dist/waku/server/assets/{ai-Ciluqauj.js → ai-D24j9Suj.js} +2 -2
- package/dist/waku/server/assets/{chat-DW_HKHrw.js → chat-BxqSUz5r.js} +4 -4
- package/dist/waku/server/assets/{image.webp-DyPxyLsu.js → image.webp-D_vKLZIe.js} +1 -1
- package/dist/waku/server/assets/{img-Ceur8Vbn.js → img-f4a2llaC.js} +1 -1
- package/dist/waku/server/assets/{index-Dtz4Dikx.js → index-B-gay6K3.js} +1 -1
- package/dist/waku/server/assets/index-BINFyrrg.js +74 -0
- package/dist/waku/server/assets/{index-b51DeFey.js → index-BJM16gy-.js} +1 -1
- package/dist/waku/server/assets/{index-BzelN9xZ.js → index-BTlJbhsD.js} +1 -1
- package/dist/waku/server/assets/index-CkM23KQa.js +70 -0
- package/dist/waku/server/assets/{index-Cid1T3pA.js → index-CscnAQvh.js} +1 -1
- package/dist/waku/server/assets/{index-DHi_Q3em.js → index-D71MTBqy.js} +217 -217
- package/dist/waku/server/assets/{index-BG_LvuXY.js → index-DohI_aVt.js} +1 -1
- package/dist/waku/server/assets/{search-Cyknzh3D.js → search-BJPXLBaU.js} +2 -2
- package/dist/waku/server/assets/{server-entry-inner-K3MndDA0.js → server-entry-inner-B6R1AcOt.js} +8 -11
- package/dist/waku/server/assets/{token-CITAv0Sw.js → token-DaQcMl9b.js} +3 -3
- package/dist/waku/server/assets/{token-util-D0330Bsl.js → token-util-BhkVMhWF.js} +2 -2
- package/dist/waku/server/assets/{token-util-BwI11_iA.js → token-util-Dh-EGxmR.js} +1 -1
- package/dist/waku/server/build.js +1 -1
- package/dist/waku/server/index.js +1 -1
- package/dist/waku/server/ssr/__vite_rsc_assets_manifest.js +139 -240
- package/dist/waku/server/ssr/assets/{_root-C_4cV4vj.js → _root-DACkxeft.js} +1 -1
- package/dist/waku/server/ssr/assets/{chevron-right-5hVZhhKL.js → chevron-right-BMNbqHoj.js} +1 -1
- package/dist/waku/server/ssr/assets/{client-DEc-0Lxy.js → client-D2PId1Y8.js} +22 -28
- package/dist/waku/server/ssr/assets/{popover-B5UP2stM.js → collapsible-Bg7ZXqSX.js} +302 -24
- package/dist/waku/server/ssr/assets/{core-priwaMKI.js → core-DCbpUITT.js} +7 -9
- package/dist/waku/server/ssr/assets/{index-B1VT1dro.js → index-2IlUAIwF.js} +90 -11
- package/dist/waku/server/ssr/assets/{index-1slu4Pvb.js → index-BiyTgxl0.js} +66 -53
- package/dist/waku/server/ssr/assets/{index-Yktv2M6f.js → index-BuKeeDuQ.js} +7 -9
- package/dist/waku/server/ssr/assets/{index-BX4HUXJp.js → index-CRaInaqa.js} +78 -68
- package/dist/waku/server/ssr/assets/{index-J_nonhZE.js → index-CbDLmkYu.js} +9 -12
- package/dist/waku/server/ssr/assets/{index-BaR9O1BS.js → index-Dfx5PwiT.js} +15 -23
- package/dist/waku/server/ssr/assets/{Combination-Bfl9xJWZ.js → index-J0GN3kBk.js} +111 -23
- package/dist/waku/server/ssr/assets/{index-tYLs9cMo.js → index-fsmz6d4l.js} +1 -1
- package/dist/waku/server/ssr/assets/index-kw473LRJ.js +21 -0
- package/dist/waku/server/ssr/assets/{merge-refs-tBCerWof.js → merge-refs-BOMmQScS.js} +4 -0
- package/dist/waku/server/ssr/assets/page-actions-DV7FuzkC.js +549 -0
- package/dist/waku/server/ssr/assets/{scroll-area-H0rLnYpQ.js → scroll-area-dKOCN27Q.js} +9 -22
- package/dist/waku/server/ssr/assets/{search-Cj6J6tO-.js → search-CZnncy0t.js} +1 -1
- package/dist/waku/server/ssr/assets/{search-default-CcNdLg6r.js → search-default-DE-4m_98.js} +4 -6
- package/dist/waku/server/ssr/assets/{x-3TJcRt9z.js → x-DgUHLicZ.js} +1 -1
- package/dist/waku/server/ssr/index.js +16 -32
- package/package.json +3 -3
- package/dist/waku/public/assets/Combination-DrcqRtGA.js +0 -41
- package/dist/waku/public/assets/_root-UvrU8GwY.js +0 -2
- package/dist/waku/public/assets/check-BbfQleye.js +0 -1
- package/dist/waku/public/assets/clerk-B6YS10Vt.js +0 -1
- package/dist/waku/public/assets/client-DZrkaM4Z.js +0 -3
- package/dist/waku/public/assets/collapsible-B44znGcA.js +0 -1
- package/dist/waku/public/assets/i18n-PxnJFz3u.js +0 -1
- package/dist/waku/public/assets/index-BVWEvTtH.js +0 -1
- package/dist/waku/public/assets/index-BWUz1Wzh.js +0 -1
- package/dist/waku/public/assets/index-CKhdfY24.js +0 -1
- package/dist/waku/public/assets/index-Ckpsnspt.js +0 -1
- package/dist/waku/public/assets/index-Cq_2xCEj.js +0 -1
- package/dist/waku/public/assets/index-DhlSbsoh.js +0 -1
- package/dist/waku/public/assets/index-wmToF8D3.js +0 -1
- package/dist/waku/public/assets/merge-refs-DdSaIw4w.js +0 -1
- package/dist/waku/public/assets/popover-D1yTQ4pA.js +0 -1
- package/dist/waku/public/assets/scroll-area-CHp-1KMj.js +0 -1
- package/dist/waku/public/assets/text-align-start-77tc0bgj.js +0 -1
- package/dist/waku/public/assets/tree-DMBvckeu.js +0 -1
- package/dist/waku/public/assets/use-footer-items-DN1xdOWG.js +0 -1
- package/dist/waku/server/assets/index-BTS71z0Q.js +0 -164
- package/dist/waku/server/assets/index-BhDWYJPg.js +0 -187
- package/dist/waku/server/assets/page-actions-CYA46ppC.js +0 -75
- package/dist/waku/server/ssr/assets/check-Dar7MyZg.js +0 -6
- package/dist/waku/server/ssr/assets/clerk-CqspAh3n.js +0 -323
- package/dist/waku/server/ssr/assets/collapsible-DHCUbEAk.js +0 -163
- package/dist/waku/server/ssr/assets/i18n-C_JO_aLM.js +0 -212
- package/dist/waku/server/ssr/assets/index-B8vKMOfY.js +0 -26
- package/dist/waku/server/ssr/assets/index-CNbkl4W8.js +0 -82
- package/dist/waku/server/ssr/assets/index-CkO-oKhy.js +0 -92
- package/dist/waku/server/ssr/assets/text-align-start-CSt8cMWG.js +0 -10
- package/dist/waku/server/ssr/assets/tree-BtFBPa3e.js +0 -113
- package/dist/waku/server/ssr/assets/use-footer-items-CuVM9OnG.js +0 -20
package/dist/lib/cli/index.mjs
CHANGED
|
@@ -63,7 +63,7 @@ async function findConfigPath() {
|
|
|
63
63
|
}
|
|
64
64
|
//#endregion
|
|
65
65
|
//#region package.json
|
|
66
|
-
var version = "0.1.
|
|
66
|
+
var version = "0.1.14";
|
|
67
67
|
//#endregion
|
|
68
68
|
//#region src/cli/index.ts
|
|
69
69
|
program.command("init").description("create configuration file").action(async () => {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/search-default-2hZ1VIYE.js","assets/i18n-DG4t4f9v.js","assets/index-CCS3nv-i.js","assets/index-9Vsiq1Kd.js","assets/index-DTcPPegm.js","assets/index-CV7yq2SK.js","assets/index-DP8HDMXM.js","assets/search-CUUh5VYW.js","assets/chevron-right-CCr-NTvy.js","assets/index-CkdplsNl.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as i,r as c,j as o,_ as m,L as f}from"./index-CCS3nv-i.js";import{d as h,o as u,s as p,l}from"./schemas-BzqjMV9-.js";import{a as v}from"./i18n-DG4t4f9v.js";import{S as x,J as P}from"./index-82PkV7Pm.js";import{D as b}from"./index-18GBv5c2.js";import{F as j}from"./index-9Vsiq1Kd.js";const k=u({type:l("clear-cache"),absolutePath:p()}),y=u({type:l("revalidate")}),g=h("type",[k,y]);function L(e){try{return g.safeParse(JSON.parse(e)).data}catch{return}}function R(){const e=i();return c.useEffect(()=>{const r=new URL("/_ws",window.location.href);r.protocol=r.protocol==="https"?"wss":"ws";const t=new WebSocket(r);return t.addEventListener("message",a=>{const s=L(a.data);s&&(console.log("Received:",s),s.type==="revalidate"&&e.reload())}),()=>{t.close()}},[]),o.jsx(o.Fragment,{})}const S=c.lazy(()=>m(()=>import("./search-default-2hZ1VIYE.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));function _({children:e,dir:r="ltr",theme:t={},search:a,i18n:s}){let n=e;return a?.enabled!==!1&&(n=o.jsx(x,{SearchDialog:S,...a,children:n})),t?.enabled!==!1&&(n=o.jsx(P,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,...t,children:n})),s&&(n=o.jsx(v,{...s,children:n})),o.jsx(b,{dir:r,children:n})}const d={usePathname(){const{path:e}=i();return e},useParams(){const{query:e}=i();return c.useMemo(()=>{const r=new URLSearchParams(e);return Object.fromEntries(Array.from(r.entries()).map(([t,a])=>[t,Array.isArray(a)?a[0]:a]))},[e])},useRouter(){const e=i();return c.useMemo(()=>({push(r){e.push(r)},refresh(){e.push(e.path)}}),[e])},Link({href:e,prefetch:r=!0,...t}){return o.jsx(f,{to:e,unstable_prefetchOnEnter:r,...t,children:t.children})}};function w({children:e,Link:r,Image:t}){return o.jsx(j,{...d,Link:r??d.Link,Image:t??d.Image,children:e})}function E({components:e,...r}){return o.jsx(w,{Link:e?.Link,Image:e?.Image,children:o.jsx(_,{...r,children:r.children})})}function I({children:e}){return o.jsx(E,{children:e})}const U={HotReload:R},W={Provider:I};export{U as export_607cd537d716,W as export_75b87872b5db};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as u}from"./index-
|
|
1
|
+
import{c as u}from"./index-BwTbBIqA.js";import"./index-DP8HDMXM.js";import"./index-CCS3nv-i.js";function d(o){const e=[],n=new Set;for(const t of o)n.has(t.url)||(n.add(t.url),e.push({id:t.url,type:"page",breadcrumbs:t.breadcrumbs,url:t.url,content:t.title})),e.push({id:t.objectID,type:t.content===t.section?"heading":"text",url:t.section_id?`${t.url}#${t.section_id}`:t.url,content:t.content});return e}function f(o){const{indexName:e,onSearch:n,client:t,locale:c,tag:r}=o;return{deps:[e,t,c,r],async search(i){if(i.trim().length===0)return[];const a=n?await n(i,r,c):await t.searchForHits({requests:[{type:"default",indexName:e,query:i,distinct:5,hitsPerPage:10,filters:r?`tag:${r}`:void 0}]}),l=u(i);return d(a.results[0].hits).flatMap(s=>s.type==="page"?{...s,content:l.highlightMarkdown(s.content)}:[])}}}export{f as algoliaClient};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as o}from"./index-
|
|
1
|
+
import{c as o}from"./index-DTcPPegm.js";const t=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],e=o("chevron-right",t);export{e as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as r,C as o,I as e,E as t}from"./index-
|
|
1
|
+
import{S as r,C as o,I as e,E as t}from"./index-CCS3nv-i.js";const n={Children:o,Slot:r},s={ErrorBoundary:t,INTERNAL_ServerRouter:e};export{n as export_34e4795b7fc5,s as export_6d786e16fc6b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{t as d,b as g,a as B}from"./index-DTcPPegm.js";import{P as H,a as U,b as Y,T as G}from"./collapsible-Bykth93R.js";import{b as J,S as K,P as v,L as k,a as T,c as Q,d as W,e as X,f as Z,g as ee,h as te,i as z,j as re,k as I,C as ae,l as se,m as ne,n as ie,o as de,u as j,p as oe,q as le,r as ce,s as me,t as fe,v as ue,w as xe}from"./scroll-area-DJkeD9SQ.js";import{r as x,j as e}from"./index-CCS3nv-i.js";import{m as he,L as P,C as pe}from"./merge-refs-CciE9kPU.js";import"./i18n-DG4t4f9v.js";import"./index-82PkV7Pm.js";import{a as C}from"./index-9Vsiq1Kd.js";function ge({enabled:t=!0}){const[a,r]=x.useState();return x.useEffect(()=>{if(!t)return;const s=()=>{r(window.scrollY<10)};return s(),window.addEventListener("scroll",s),()=>{window.removeEventListener("scroll",s)}},[t]),a}const y=B("relative flex flex-row items-center gap-2 rounded-lg p-2 text-start text-fd-muted-foreground wrap-anywhere [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{link:"transition-colors hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none data-[active=true]:bg-fd-primary/10 data-[active=true]:text-fd-primary data-[active=true]:hover:transition-colors",button:"transition-colors hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none"},highlight:{true:"data-[active=true]:before:content-[''] data-[active=true]:before:bg-fd-primary data-[active=true]:before:absolute data-[active=true]:before:w-px data-[active=true]:before:inset-y-2.5 data-[active=true]:before:start-2.5"}}}),{useSidebar:F}=J;function be(t){return e.jsx(Q,{...t})}function ve({footer:t,banner:a,collapsible:r=!0,components:s,...n}){const{menuItems:c,slots:i,props:{tabs:o,nav:f,tabMode:h}}=N(),l=c.filter(m=>m.type==="icon"),p=e.jsxs(we,{children:[c.filter(m=>m.type!=="icon").map((m,u,S)=>e.jsx(Te,{item:m,className:d(u===S.length-1&&"mb-4")},u)),e.jsx(ke,{...s})]});return e.jsxs(e.Fragment,{children:[e.jsxs(Ne,{...n,children:[e.jsxs("div",{className:"flex flex-col gap-3 p-4 pb-2",children:[e.jsxs("div",{className:"flex",children:[i.navTitle&&e.jsx(i.navTitle,{className:"inline-flex text-[0.9375rem] items-center gap-2.5 font-medium me-auto"}),f?.children,r&&e.jsx(je,{className:d(g({color:"ghost",size:"icon-sm",className:"mb-auto text-fd-muted-foreground"})),children:e.jsx(v,{})})]}),i.searchTrigger&&e.jsx(i.searchTrigger.full,{hideIfDisabled:!0}),o.length>0&&h==="auto"&&e.jsx(L,{tabs:o}),a]}),p,(i.languageSelect||l.length>0||i.themeSwitch||t)&&e.jsxs("div",{className:"flex flex-col border-t p-4 pt-2 empty:hidden",children:[e.jsxs("div",{className:"flex text-fd-muted-foreground items-center empty:hidden",children:[i.languageSelect&&e.jsx(i.languageSelect.root,{children:e.jsx(k,{className:"size-4.5"})}),l.map((m,u)=>e.jsx(T,{item:m,className:d(g({size:"icon-sm",color:"ghost"})),"aria-label":m.label,children:m.icon},u)),i.themeSwitch&&e.jsx(i.themeSwitch,{className:"ms-auto p-0"})]}),t]})]}),e.jsxs(Se,{children:[e.jsxs("div",{className:"flex flex-col gap-3 p-4 pb-2",children:[e.jsxs("div",{className:"flex text-fd-muted-foreground items-center gap-1.5",children:[e.jsx("div",{className:"flex flex-1",children:l.map((m,u)=>e.jsx(T,{item:m,className:d(g({size:"icon-sm",color:"ghost",className:"p-2"})),"aria-label":m.label,children:m.icon},u))}),i.languageSelect&&e.jsxs(i.languageSelect.root,{children:[e.jsx(k,{className:"size-4.5"}),e.jsx(i.languageSelect.text,{})]}),i.themeSwitch&&e.jsx(i.themeSwitch,{className:"p-0"}),e.jsx($,{className:d(g({color:"ghost",size:"icon-sm",className:"p-2"})),children:e.jsx(v,{})})]}),o.length>0&&e.jsx(L,{tabs:o}),a]}),p,e.jsx("div",{className:"flex flex-col border-t p-4 pt-2 empty:hidden",children:t})]})]})}function D(t){return e.jsx(ie,{...t})}function je(t){return e.jsx(z,{...t})}function we(t){return e.jsx(W,{...t,className:d("min-h-0 flex-1",t.className),children:e.jsx(X,{className:"*:flex! *:flex-col! *:gap-0.5! p-4 overscroll-contain",style:{maskImage:"linear-gradient(to bottom, transparent, white 12px, white calc(100% - 12px), transparent)"},children:t.children})})}function $(t){return e.jsx(K,{...t})}function Ne({ref:t,className:a,children:r,...s}){const n=x.useRef(null);return e.jsx(te,{children:({collapsed:c,hovered:i,ref:o,...f})=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-sidebar-placeholder":"",className:"sticky top-(--fd-docs-row-1) z-20 [grid-area:sidebar] pointer-events-none *:pointer-events-auto h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] md:layout:[--fd-sidebar-width:268px] max-md:hidden",children:[c&&e.jsx("div",{className:"absolute start-0 inset-y-0 w-4",...f}),e.jsx("aside",{id:"nd-sidebar",ref:he(n,t,o),"data-collapsed":c,"data-hovered":c&&i,className:d("absolute flex flex-col w-full start-0 inset-y-0 items-end bg-fd-card text-sm border-e duration-250 *:w-(--fd-sidebar-width)",c&&["inset-y-2 rounded-xl transition-transform border w-(--fd-sidebar-width)",i?"shadow-lg translate-x-2 rtl:-translate-x-2":"-translate-x-(--fd-sidebar-width) rtl:translate-x-full"],n.current&&n.current.getAttribute("data-collapsed")==="true"!==c&&"transition-[width,inset-block,translate,background-color]",a),...s,...f,children:r})]}),e.jsxs("div",{"data-sidebar-panel":"",className:d("fixed flex top-[calc(--spacing(4)+var(--fd-docs-row-3))] start-4 shadow-lg transition-opacity rounded-xl p-0.5 border bg-fd-muted text-fd-muted-foreground z-10",(!c||i)&&"pointer-events-none opacity-0"),children:[e.jsx(z,{className:d(g({color:"ghost",size:"icon-sm",className:"rounded-lg"})),children:e.jsx(v,{})}),e.jsx(re,{className:"rounded-lg",hideIfDisabled:!0})]})]})})}function Se({children:t,className:a,...r}){return e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"fixed z-40 inset-0 backdrop-blur-xs data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out"}),e.jsx(ne,{className:d("fixed text-[0.9375rem] flex flex-col shadow-lg border-s end-0 inset-y-0 w-[85%] max-w-[380px] z-40 bg-fd-background data-[state=open]:animate-fd-sidebar-in data-[state=closed]:animate-fd-sidebar-out",a),...r,children:t})]})}function ye({className:t,style:a,children:r,...s}){const n=j();return e.jsx(me,{className:d("inline-flex items-center gap-2 mb-1 px-2 mt-6 empty:mb-0 [&_svg]:size-4 [&_svg]:shrink-0",n===0&&"first:mt-0",t),style:{paddingInlineStart:w(n),...a},...s,children:r})}function E({className:t,style:a,children:r,...s}){const n=j();return e.jsx(fe,{className:d(y({variant:"link",highlight:n>=1}),t),style:{paddingInlineStart:w(n),...a},...s,children:r})}function M({className:t,style:a,...r}){const{depth:s,collapsible:n}=le();return e.jsx(ce,{className:d(y({variant:n?"button":null}),"w-full",t),style:{paddingInlineStart:w(s-1),...a},...r,children:r.children})}function O({className:t,style:a,...r}){const s=j();return e.jsx(oe,{className:d(y({variant:"link",highlight:s>1}),"w-full",t),style:{paddingInlineStart:w(s-1),...a},...r,children:r.children})}function R({className:t,children:a,...r}){return e.jsx(de,{className:d("relative flex flex-col gap-0.5 *:first:mt-0.5",j()===1&&"before:content-[''] before:absolute before:w-px before:inset-y-1 before:bg-fd-border before:start-2.5",t),...r,children:a})}function L({tabs:t,placeholder:a,...r}){const[s,n]=x.useState(!1),{closeOnRedirect:c}=F(),i=C(),o=x.useMemo(()=>t.findLast(l=>I(l,i)),[t,i]),f=()=>{c.current=!1,n(!1)},h=o?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"size-9 shrink-0 empty:hidden md:size-5",children:o.icon}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:o.title}),e.jsx("p",{className:"text-sm text-fd-muted-foreground empty:hidden md:hidden",children:o.description})]})]}):a;return e.jsxs(H,{open:s,onOpenChange:n,children:[h&&e.jsxs(U,{...r,className:d("flex items-center gap-2 rounded-lg p-2 border bg-fd-secondary/50 text-start text-fd-secondary-foreground transition-colors hover:bg-fd-accent data-[state=open]:bg-fd-accent data-[state=open]:text-fd-accent-foreground",r.className),children:[h,e.jsx(ae,{className:"shrink-0 ms-auto size-4 text-fd-muted-foreground"})]}),e.jsx(Y,{className:"flex flex-col gap-1 w-(--radix-popover-trigger-width) p-1 fd-scroll-container",children:t.map(l=>{const p=o&&l.url===o.url;if(!(!p&&l.unlisted))return e.jsxs(P,{href:l.url,onClick:f,...l.props,className:d("flex items-center gap-2 rounded-lg p-1.5 hover:bg-fd-accent hover:text-fd-accent-foreground",l.props?.className),children:[e.jsx("div",{className:"shrink-0 size-9 md:mb-auto md:size-5 empty:hidden",children:l.icon}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium leading-none",children:l.title}),e.jsx("p",{className:"text-[0.8125rem] text-fd-muted-foreground mt-1 empty:hidden",children:l.description})]}),e.jsx(pe,{className:d("shrink-0 ms-auto size-3.5 text-fd-primary",!p&&"invisible")})]},l.url)})})]})}function w(t){return`calc(${2+3*t} * var(--spacing))`}const ke=ee({SidebarFolder:D,SidebarFolderContent:R,SidebarFolderLink:O,SidebarFolderTrigger:M,SidebarItem:E,SidebarSeparator:ye}),Te=Z({SidebarFolder:D,SidebarFolderContent:R,SidebarFolderLink:O,SidebarFolderTrigger:M,SidebarItem:E});function Le(t){const{isNavTransparent:a,slots:r,props:{nav:s}}=N();return s?.component?s.component:e.jsxs("header",{id:"nd-subnav","data-transparent":a,...t,className:d("[grid-area:header] sticky top-(--fd-docs-row-1) z-30 flex items-center ps-4 pe-2.5 border-b transition-colors backdrop-blur-sm h-(--fd-header-height) md:hidden max-md:layout:[--fd-header-height:--spacing(14)] data-[transparent=false]:bg-fd-background/80",t.className),children:[r.navTitle&&e.jsx(r.navTitle,{className:"inline-flex items-center gap-2.5 font-semibold"}),e.jsx("div",{className:"flex-1",children:s?.children}),r.searchTrigger&&e.jsx(r.searchTrigger.sm,{hideIfDisabled:!0,className:"p-2"}),r.sidebar&&e.jsx(r.sidebar.trigger,{className:d(g({color:"ghost",size:"icon-sm",className:"p-2"})),children:e.jsx(v,{})})]})}function ze(t){const{slots:a}=N(),{collapsed:r}=a.sidebar?.useSidebar?.()??{};return e.jsx("div",{id:"nd-docs-layout","data-sidebar-collapsed":r,...t,style:{gridTemplate:`"sidebar sidebar header toc toc"
|
|
2
|
+
"sidebar sidebar toc-popover toc toc"
|
|
3
|
+
"sidebar sidebar main toc toc" 1fr / minmax(min-content, 1fr) var(--fd-sidebar-col) minmax(0, calc(var(--fd-layout-width,97rem) - var(--fd-sidebar-width) - var(--fd-toc-width))) var(--fd-toc-width) minmax(min-content, 1fr)`,"--fd-docs-row-1":"var(--fd-banner-height, 0px)","--fd-docs-row-2":"calc(var(--fd-docs-row-1) + var(--fd-header-height))","--fd-docs-row-3":"calc(var(--fd-docs-row-2) + var(--fd-toc-popover-height))","--fd-sidebar-col":r?"0px":"var(--fd-sidebar-width)",...t.style},className:d("grid transition-[grid-template-columns] overflow-x-clip min-h-(--fd-docs-height) [--fd-docs-height:100dvh] [--fd-header-height:0px] [--fd-toc-popover-height:0px] [--fd-sidebar-width:0px] [--fd-toc-width:0px]",t.className),children:t.children})}const{useProvider:Ie}=xe({useProps(){return N().props}}),_=x.createContext(null);function N(){const t=x.use(_);if(!t)throw new Error("Please use <DocsPage /> (`fumadocs-ui/layouts/docs/page`) under <DocsLayout /> (`fumadocs-ui/layouts/docs`).");return t}function _e(t){const{nav:{enabled:a=!0,transparentMode:r="none"}={},sidebar:{enabled:s=!0,defaultOpenLevel:n,prefetch:c,...i}={},slots:o,tabs:f,tabMode:h="auto",tree:l,containerProps:p,children:m}=t,u=ge({enabled:r==="top"})??!0,S=r==="top"?u:r==="always",{baseSlots:A,baseProps:V}=Ie(t),q=ue(t),b={...A,header:o?.header??Le,container:o?.container??ze,sidebar:o?.sidebar??{provider:be,root:ve,trigger:$,useSidebar:F}};return e.jsx(G,{tree:l,children:e.jsx(_,{value:{props:{tabMode:h,tabs:f,...V},isNavTransparent:S,slots:b,...q},children:e.jsx(b.sidebar.provider,{defaultOpenLevel:n,prefetch:c,children:e.jsxs(b.container,{...p,children:[a&&e.jsx(b.header,{}),s&&e.jsx(b.sidebar.root,{...i}),h==="top"&&f.length>0&&e.jsx(Pe,{tabs:f,className:"z-10 bg-fd-background border-b px-6 pt-3 xl:px-8 max-md:hidden"}),m]})})})})}function Pe({tabs:t,...a}){const r=C(),s=x.useMemo(()=>t.findLast(n=>I(n,r)),[t,r]);return e.jsx("div",{...a,className:d("flex flex-row items-end gap-6 overflow-auto [grid-area:main]",a.className),children:t.map((n,c)=>e.jsx(P,{href:n.url,className:d("inline-flex border-b-2 border-transparent transition-colors items-center pb-1.5 font-medium gap-2 text-fd-muted-foreground text-sm text-nowrap hover:text-fd-accent-foreground",n.unlisted&&s!==n&&"hidden",s===n&&"border-fd-primary text-fd-primary"),children:n.title},c))})}export{_e as L,N as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as lt,d as U,g as ae,u as fe,e as Te,f as ln,i as ft,j as ut,h as te,P as De,k as fn,t as dt}from"./index-DTcPPegm.js";import{r as h,j as P,a as un,R as dn}from"./index-CCS3nv-i.js";import{a as pn}from"./index-9Vsiq1Kd.js";import{h as hn,R as mn,a as gn,F as xn,D as wn}from"./index-CV7yq2SK.js";const vn=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],fr=lt("chevron-down",vn);const yn=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ur=lt("external-link",yn);function bn(e){return e.startsWith("http://")||e.startsWith("https://")||(e.startsWith("/")||(e="/"+e),e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1))),e}function Pn(e,t,n={}){const{includeSeparator:o=!0}=n;function r(i){let s;for(const c of i){if(t(c)){const a=[];return s&&a.push(s),a.push(c),a}if(c.type==="separator"&&o){s=c;continue}if(c.type==="folder"){const a=c.index&&t(c.index)?[c.index]:r(c.children);if(a)return a.unshift(c),s&&a.unshift(s),a}}}return r(e)??null}function dr(e,t,n){const{includePage:o=!1,includeSeparator:r=!1,includeRoot:i=!1}=n;let s=[];for(let c=0;c<t.length;c++){const a=t[c];switch(a.type){case"page":o&&s.push({name:a.name,url:a.url});break;case"folder":if(a.root){s=[],i&&s.push({name:e.name,url:typeof i=="object"?i.url:a.index?.url});break}(c===t.length-1||a.index!==t[c+1])&&s.push({name:a.name,url:a.index?.url});break;case"separator":a.name&&r&&s.push({name:a.name});break}}return s}function Ge(e,t){const n=bn(t);return Pn(e,o=>o.type==="page"&&o.url===n)}const pt=h.createContext(null),ht=h.createContext([]);function pr({tree:e,children:t}){const n=h.useRef(0),o=pn(),r=h.useMemo(()=>e,[e.$id??e]),i=h.useMemo(()=>Ge(r.children,o)??(r.fallback?Ge(r.fallback.children,o):null)??[],[r,o]),s=i.findLast(c=>c.type==="folder"&&c.root)??r;return s.$id??=String(n.current++),P.jsx(pt,{value:h.useMemo(()=>({root:s,full:r}),[s,r]),children:P.jsx(ht,{value:i,children:t})})}function hr(){return h.use(ht)}function mr(){const e=h.use(pt);if(!e)throw new Error("You must wrap this component under <DocsLayout />");return e}const Cn=["top","right","bottom","left"],K=Math.min,j=Math.max,ge=Math.round,he=Math.floor,V=e=>({x:e,y:e}),Rn={left:"right",right:"left",bottom:"top",top:"bottom"};function _e(e,t,n){return j(e,K(t,n))}function Y(e,t){return typeof e=="function"?e(t):e}function q(e){return e.split("-")[0]}function ie(e){return e.split("-")[1]}function ke(e){return e==="x"?"y":"x"}function $e(e){return e==="y"?"height":"width"}function B(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Le(e){return ke(B(e))}function An(e,t,n){n===void 0&&(n=!1);const o=ie(e),r=Le(e),i=$e(r);let s=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=xe(s)),[s,xe(s)]}function On(e){const t=xe(e);return[Me(e),t,Me(t)]}function Me(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ke=["left","right"],Ze=["right","left"],Sn=["top","bottom"],En=["bottom","top"];function _n(e,t,n){switch(e){case"top":case"bottom":return n?t?Ze:Ke:t?Ke:Ze;case"left":case"right":return t?Sn:En;default:return[]}}function Mn(e,t,n,o){const r=ie(e);let i=_n(q(e),n==="start",o);return r&&(i=i.map(s=>s+"-"+r),t&&(i=i.concat(i.map(Me)))),i}function xe(e){const t=q(e);return Rn[t]+e.slice(t.length)}function Nn(e){return{top:0,right:0,bottom:0,left:0,...e}}function mt(e){return typeof e!="number"?Nn(e):{top:e,right:e,bottom:e,left:e}}function we(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function Je(e,t,n){let{reference:o,floating:r}=e;const i=B(t),s=Le(t),c=$e(s),a=q(t),l=i==="y",f=o.x+o.width/2-r.width/2,u=o.y+o.height/2-r.height/2,p=o[c]/2-r[c]/2;let d;switch(a){case"top":d={x:f,y:o.y-r.height};break;case"bottom":d={x:f,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:u};break;case"left":d={x:o.x-r.width,y:u};break;default:d={x:o.x,y:o.y}}switch(ie(t)){case"start":d[s]-=p*(n&&l?-1:1);break;case"end":d[s]+=p*(n&&l?-1:1);break}return d}async function Tn(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:i,rects:s,elements:c,strategy:a}=e,{boundary:l="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:p=!1,padding:d=0}=Y(t,e),m=mt(d),v=c[p?u==="floating"?"reference":"floating":u],x=we(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:l,rootBoundary:f,strategy:a})),w=u==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),y=await(i.isElement==null?void 0:i.isElement(b))?await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1}:{x:1,y:1},R=we(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:w,offsetParent:b,strategy:a}):w);return{top:(x.top-R.top+m.top)/y.y,bottom:(R.bottom-x.bottom+m.bottom)/y.y,left:(x.left-R.left+m.left)/y.x,right:(R.right-x.right+m.right)/y.x}}const Dn=50,kn=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=n,c=s.detectOverflow?s:{...s,detectOverflow:Tn},a=await(s.isRTL==null?void 0:s.isRTL(t));let l=await s.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:u}=Je(l,o,a),p=o,d=0;const m={};for(let g=0;g<i.length;g++){const v=i[g];if(!v)continue;const{name:x,fn:w}=v,{x:b,y,data:R,reset:A}=await w({x:f,y:u,initialPlacement:o,placement:p,strategy:r,middlewareData:m,rects:l,platform:c,elements:{reference:e,floating:t}});f=b??f,u=y??u,m[x]={...m[x],...R},A&&d<Dn&&(d++,typeof A=="object"&&(A.placement&&(p=A.placement),A.rects&&(l=A.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:r}):A.rects),{x:f,y:u}=Je(l,p,a)),g=-1)}return{x:f,y:u,placement:p,strategy:r,middlewareData:m}},$n=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:i,platform:s,elements:c,middlewareData:a}=t,{element:l,padding:f=0}=Y(e,t)||{};if(l==null)return{};const u=mt(f),p={x:n,y:o},d=Le(r),m=$e(d),g=await s.getDimensions(l),v=d==="y",x=v?"top":"left",w=v?"bottom":"right",b=v?"clientHeight":"clientWidth",y=i.reference[m]+i.reference[d]-p[d]-i.floating[m],R=p[d]-i.reference[d],A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l));let O=A?A[b]:0;(!O||!await(s.isElement==null?void 0:s.isElement(A)))&&(O=c.floating[b]||i.floating[m]);const T=y/2-R/2,L=O/2-g[m]/2-1,N=K(u[x],L),k=K(u[w],L),$=N,E=O-g[m]-k,S=O/2-g[m]/2+T,F=_e($,S,E),_=!a.arrow&&ie(r)!=null&&S!==F&&i.reference[m]/2-(S<$?N:k)-g[m]/2<0,M=_?S<$?S-$:S-E:0;return{[d]:p[d]+M,data:{[d]:F,centerOffset:S-F-M,..._&&{alignmentOffset:M}},reset:_}}}),Ln=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:c,platform:a,elements:l}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...v}=Y(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=q(r),w=B(c),b=q(c)===c,y=await(a.isRTL==null?void 0:a.isRTL(l.floating)),R=p||(b||!g?[xe(c)]:On(c)),A=m!=="none";!p&&A&&R.push(...Mn(c,g,m,y));const O=[c,...R],T=await a.detectOverflow(t,v),L=[];let N=((o=i.flip)==null?void 0:o.overflows)||[];if(f&&L.push(T[x]),u){const S=An(r,s,y);L.push(T[S[0]],T[S[1]])}if(N=[...N,{placement:r,overflows:L}],!L.every(S=>S<=0)){var k,$;const S=(((k=i.flip)==null?void 0:k.index)||0)+1,F=O[S];if(F&&(!(u==="alignment"?w!==B(F):!1)||N.every(C=>B(C.placement)===w?C.overflows[0]>0:!0)))return{data:{index:S,overflows:N},reset:{placement:F}};let _=($=N.filter(M=>M.overflows[0]<=0).sort((M,C)=>M.overflows[1]-C.overflows[1])[0])==null?void 0:$.placement;if(!_)switch(d){case"bestFit":{var E;const M=(E=N.filter(C=>{if(A){const D=B(C.placement);return D===w||D==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(D=>D>0).reduce((D,z)=>D+z,0)]).sort((C,D)=>C[1]-D[1])[0])==null?void 0:E[0];M&&(_=M);break}case"initialPlacement":_=c;break}if(r!==_)return{reset:{placement:_}}}return{}}}};function Qe(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function et(e){return Cn.some(t=>e[t]>=0)}const Fn=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...i}=Y(e,t);switch(r){case"referenceHidden":{const s=await o.detectOverflow(t,{...i,elementContext:"reference"}),c=Qe(s,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:et(c)}}}case"escaped":{const s=await o.detectOverflow(t,{...i,altBoundary:!0}),c=Qe(s,n.floating);return{data:{escapedOffsets:c,escaped:et(c)}}}default:return{}}}}},gt=new Set(["left","top"]);async function jn(e,t){const{placement:n,platform:o,elements:r}=e,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=q(n),c=ie(n),a=B(n)==="y",l=gt.has(s)?-1:1,f=i&&a?-1:1,u=Y(t,e);let{mainAxis:p,crossAxis:d,alignmentAxis:m}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof m=="number"&&(d=c==="end"?m*-1:m),a?{x:d*f,y:p*l}:{x:p*l,y:d*f}}const Wn=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:s,middlewareData:c}=t,a=await jn(t,e);return s===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+a.x,y:i+a.y,data:{...a,placement:s}}}}},Hn=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:i}=t,{mainAxis:s=!0,crossAxis:c=!1,limiter:a={fn:x=>{let{x:w,y:b}=x;return{x:w,y:b}}},...l}=Y(e,t),f={x:n,y:o},u=await i.detectOverflow(t,l),p=B(q(r)),d=ke(p);let m=f[d],g=f[p];if(s){const x=d==="y"?"top":"left",w=d==="y"?"bottom":"right",b=m+u[x],y=m-u[w];m=_e(b,m,y)}if(c){const x=p==="y"?"top":"left",w=p==="y"?"bottom":"right",b=g+u[x],y=g-u[w];g=_e(b,g,y)}const v=a.fn({...t,[d]:m,[p]:g});return{...v,data:{x:v.x-n,y:v.y-o,enabled:{[d]:s,[p]:c}}}}}},In=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:i,middlewareData:s}=t,{offset:c=0,mainAxis:a=!0,crossAxis:l=!0}=Y(e,t),f={x:n,y:o},u=B(r),p=ke(u);let d=f[p],m=f[u];const g=Y(c,t),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(a){const b=p==="y"?"height":"width",y=i.reference[p]-i.floating[b]+v.mainAxis,R=i.reference[p]+i.reference[b]-v.mainAxis;d<y?d=y:d>R&&(d=R)}if(l){var x,w;const b=p==="y"?"width":"height",y=gt.has(q(r)),R=i.reference[u]-i.floating[b]+(y&&((x=s.offset)==null?void 0:x[u])||0)+(y?0:v.crossAxis),A=i.reference[u]+i.reference[b]+(y?0:((w=s.offset)==null?void 0:w[u])||0)-(y?v.crossAxis:0);m<R?m=R:m>A&&(m=A)}return{[p]:d,[u]:m}}}},zn=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:i,platform:s,elements:c}=t,{apply:a=()=>{},...l}=Y(e,t),f=await s.detectOverflow(t,l),u=q(r),p=ie(r),d=B(r)==="y",{width:m,height:g}=i.floating;let v,x;u==="top"||u==="bottom"?(v=u,x=p===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(x=u,v=p==="end"?"top":"bottom");const w=g-f.top-f.bottom,b=m-f.left-f.right,y=K(g-f[v],w),R=K(m-f[x],b),A=!t.middlewareData.shift;let O=y,T=R;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=b),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(O=w),A&&!p){const N=j(f.left,0),k=j(f.right,0),$=j(f.top,0),E=j(f.bottom,0);d?T=m-2*(N!==0||k!==0?N+k:j(f.left,f.right)):O=g-2*($!==0||E!==0?$+E:j(f.top,f.bottom))}await a({...t,availableWidth:T,availableHeight:O});const L=await s.getDimensions(c.floating);return m!==L.width||g!==L.height?{reset:{rects:!0}}:{}}}};function ye(){return typeof window<"u"}function se(e){return xt(e)?(e.nodeName||"").toLowerCase():"#document"}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function X(e){var t;return(t=(xt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function xt(e){return ye()?e instanceof Node||e instanceof W(e).Node:!1}function H(e){return ye()?e instanceof Element||e instanceof W(e).Element:!1}function G(e){return ye()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function tt(e){return!ye()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}function ue(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=I(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function Bn(e){return/^(table|td|th)$/.test(se(e))}function be(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Vn=/transform|translate|scale|rotate|perspective|filter/,Xn=/paint|layout|strict|content/,Q=e=>!!e&&e!=="none";let Oe;function Fe(e){const t=H(e)?I(e):e;return Q(t.transform)||Q(t.translate)||Q(t.scale)||Q(t.rotate)||Q(t.perspective)||!je()&&(Q(t.backdropFilter)||Q(t.filter))||Vn.test(t.willChange||"")||Xn.test(t.contain||"")}function Yn(e){let t=Z(e);for(;G(t)&&!oe(t);){if(Fe(t))return t;if(be(t))return null;t=Z(t)}return null}function je(){return Oe==null&&(Oe=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Oe}function oe(e){return/^(html|body|#document)$/.test(se(e))}function I(e){return W(e).getComputedStyle(e)}function Pe(e){return H(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Z(e){if(se(e)==="html")return e;const t=e.assignedSlot||e.parentNode||tt(e)&&e.host||X(e);return tt(t)?t.host:t}function wt(e){const t=Z(e);return oe(t)?e.ownerDocument?e.ownerDocument.body:e.body:G(t)&&ue(t)?t:wt(t)}function le(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=wt(e),i=r===((o=e.ownerDocument)==null?void 0:o.body),s=W(r);if(i){const c=Ne(s);return t.concat(s,s.visualViewport||[],ue(r)?r:[],c&&n?le(c):[])}else return t.concat(r,le(r,[],n))}function Ne(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vt(e){const t=I(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=G(e),i=r?e.offsetWidth:n,s=r?e.offsetHeight:o,c=ge(n)!==i||ge(o)!==s;return c&&(n=i,o=s),{width:n,height:o,$:c}}function We(e){return H(e)?e:e.contextElement}function ne(e){const t=We(e);if(!G(t))return V(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=vt(t);let s=(i?ge(n.width):n.width)/o,c=(i?ge(n.height):n.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const qn=V(0);function yt(e){const t=W(e);return!je()||!t.visualViewport?qn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Un(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==W(e)?!1:t}function ee(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=We(e);let s=V(1);t&&(o?H(o)&&(s=ne(o)):s=ne(e));const c=Un(i,n,o)?yt(i):V(0);let a=(r.left+c.x)/s.x,l=(r.top+c.y)/s.y,f=r.width/s.x,u=r.height/s.y;if(i){const p=W(i),d=o&&H(o)?W(o):o;let m=p,g=Ne(m);for(;g&&o&&d!==m;){const v=ne(g),x=g.getBoundingClientRect(),w=I(g),b=x.left+(g.clientLeft+parseFloat(w.paddingLeft))*v.x,y=x.top+(g.clientTop+parseFloat(w.paddingTop))*v.y;a*=v.x,l*=v.y,f*=v.x,u*=v.y,a+=b,l+=y,m=W(g),g=Ne(m)}}return we({width:f,height:u,x:a,y:l})}function Ce(e,t){const n=Pe(e).scrollLeft;return t?t.left+n:ee(X(e)).left+n}function bt(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Ce(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function Gn(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i=r==="fixed",s=X(o),c=t?be(t.floating):!1;if(o===s||c&&i)return n;let a={scrollLeft:0,scrollTop:0},l=V(1);const f=V(0),u=G(o);if((u||!u&&!i)&&((se(o)!=="body"||ue(s))&&(a=Pe(o)),u)){const d=ee(o);l=ne(o),f.x=d.x+o.clientLeft,f.y=d.y+o.clientTop}const p=s&&!u&&!i?bt(s,a):V(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-a.scrollLeft*l.x+f.x+p.x,y:n.y*l.y-a.scrollTop*l.y+f.y+p.y}}function Kn(e){return Array.from(e.getClientRects())}function Zn(e){const t=X(e),n=Pe(e),o=e.ownerDocument.body,r=j(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=j(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+Ce(e);const c=-n.scrollTop;return I(o).direction==="rtl"&&(s+=j(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:c}}const nt=25;function Jn(e,t){const n=W(e),o=X(e),r=n.visualViewport;let i=o.clientWidth,s=o.clientHeight,c=0,a=0;if(r){i=r.width,s=r.height;const f=je();(!f||f&&t==="fixed")&&(c=r.offsetLeft,a=r.offsetTop)}const l=Ce(o);if(l<=0){const f=o.ownerDocument,u=f.body,p=getComputedStyle(u),d=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,m=Math.abs(o.clientWidth-u.clientWidth-d);m<=nt&&(i-=m)}else l<=nt&&(i+=l);return{width:i,height:s,x:c,y:a}}function Qn(e,t){const n=ee(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=G(e)?ne(e):V(1),s=e.clientWidth*i.x,c=e.clientHeight*i.y,a=r*i.x,l=o*i.y;return{width:s,height:c,x:a,y:l}}function ot(e,t,n){let o;if(t==="viewport")o=Jn(e,n);else if(t==="document")o=Zn(X(e));else if(H(t))o=Qn(t,n);else{const r=yt(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return we(o)}function Pt(e,t){const n=Z(e);return n===t||!H(n)||oe(n)?!1:I(n).position==="fixed"||Pt(n,t)}function eo(e,t){const n=t.get(e);if(n)return n;let o=le(e,[],!1).filter(c=>H(c)&&se(c)!=="body"),r=null;const i=I(e).position==="fixed";let s=i?Z(e):e;for(;H(s)&&!oe(s);){const c=I(s),a=Fe(s);!a&&c.position==="fixed"&&(r=null),(i?!a&&!r:!a&&c.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||ue(s)&&!a&&Pt(e,s))?o=o.filter(f=>f!==s):r=c,s=Z(s)}return t.set(e,o),o}function to(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const s=[...n==="clippingAncestors"?be(t)?[]:eo(t,this._c):[].concat(n),o],c=ot(t,s[0],r);let a=c.top,l=c.right,f=c.bottom,u=c.left;for(let p=1;p<s.length;p++){const d=ot(t,s[p],r);a=j(d.top,a),l=K(d.right,l),f=K(d.bottom,f),u=j(d.left,u)}return{width:l-u,height:f-a,x:u,y:a}}function no(e){const{width:t,height:n}=vt(e);return{width:t,height:n}}function oo(e,t,n){const o=G(t),r=X(t),i=n==="fixed",s=ee(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const a=V(0);function l(){a.x=Ce(r)}if(o||!o&&!i)if((se(t)!=="body"||ue(r))&&(c=Pe(t)),o){const d=ee(t,!0,i,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}else r&&l();i&&!o&&r&&l();const f=r&&!o&&!i?bt(r,c):V(0),u=s.left+c.scrollLeft-a.x-f.x,p=s.top+c.scrollTop-a.y-f.y;return{x:u,y:p,width:s.width,height:s.height}}function Se(e){return I(e).position==="static"}function rt(e,t){if(!G(e)||I(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return X(e)===n&&(n=n.ownerDocument.body),n}function Ct(e,t){const n=W(e);if(be(e))return n;if(!G(e)){let r=Z(e);for(;r&&!oe(r);){if(H(r)&&!Se(r))return r;r=Z(r)}return n}let o=rt(e,t);for(;o&&Bn(o)&&Se(o);)o=rt(o,t);return o&&oe(o)&&Se(o)&&!Fe(o)?n:o||Yn(e)||n}const ro=async function(e){const t=this.getOffsetParent||Ct,n=this.getDimensions,o=await n(e.floating);return{reference:oo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function io(e){return I(e).direction==="rtl"}const so={convertOffsetParentRelativeRectToViewportRelativeRect:Gn,getDocumentElement:X,getClippingRect:to,getOffsetParent:Ct,getElementRects:ro,getClientRects:Kn,getDimensions:no,getScale:ne,isElement:H,isRTL:io};function Rt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function co(e,t){let n=null,o;const r=X(e);function i(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function s(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),i();const l=e.getBoundingClientRect(),{left:f,top:u,width:p,height:d}=l;if(c||t(),!p||!d)return;const m=he(u),g=he(r.clientWidth-(f+p)),v=he(r.clientHeight-(u+d)),x=he(f),b={rootMargin:-m+"px "+-g+"px "+-v+"px "+-x+"px",threshold:j(0,K(1,a))||1};let y=!0;function R(A){const O=A[0].intersectionRatio;if(O!==a){if(!y)return s();O?s(!1,O):o=setTimeout(()=>{s(!1,1e-7)},1e3)}O===1&&!Rt(l,e.getBoundingClientRect())&&s(),y=!1}try{n=new IntersectionObserver(R,{...b,root:r.ownerDocument})}catch{n=new IntersectionObserver(R,b)}n.observe(e)}return s(!0),i}function ao(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,l=We(e),f=r||i?[...l?le(l):[],...t?le(t):[]]:[];f.forEach(x=>{r&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const u=l&&c?co(l,n):null;let p=-1,d=null;s&&(d=new ResizeObserver(x=>{let[w]=x;w&&w.target===l&&d&&t&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var b;(b=d)==null||b.observe(t)})),n()}),l&&!a&&d.observe(l),t&&d.observe(t));let m,g=a?ee(e):null;a&&v();function v(){const x=ee(e);g&&!Rt(g,x)&&n(),g=x,m=requestAnimationFrame(v)}return n(),()=>{var x;f.forEach(w=>{r&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),u?.(),(x=d)==null||x.disconnect(),d=null,a&&cancelAnimationFrame(m)}}const lo=Wn,fo=Hn,uo=Ln,po=zn,ho=Fn,it=$n,mo=In,go=(e,t,n)=>{const o=new Map,r={platform:so,...n},i={...r.platform,_c:o};return kn(e,t,{...r,platform:i})};var xo=typeof document<"u",wo=function(){},me=xo?h.useLayoutEffect:wo;function ve(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!ve(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const i=r[o];if(!(i==="_owner"&&e.$$typeof)&&!ve(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function At(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function st(e,t){const n=At(e);return Math.round(t*n)/n}function Ee(e){const t=h.useRef(e);return me(()=>{t.current=e}),t}function vo(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:i,floating:s}={},transform:c=!0,whileElementsMounted:a,open:l}=e,[f,u]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=h.useState(o);ve(p,o)||d(o);const[m,g]=h.useState(null),[v,x]=h.useState(null),w=h.useCallback(C=>{C!==A.current&&(A.current=C,g(C))},[]),b=h.useCallback(C=>{C!==O.current&&(O.current=C,x(C))},[]),y=i||m,R=s||v,A=h.useRef(null),O=h.useRef(null),T=h.useRef(f),L=a!=null,N=Ee(a),k=Ee(r),$=Ee(l),E=h.useCallback(()=>{if(!A.current||!O.current)return;const C={placement:t,strategy:n,middleware:p};k.current&&(C.platform=k.current),go(A.current,O.current,C).then(D=>{const z={...D,isPositioned:$.current!==!1};S.current&&!ve(T.current,z)&&(T.current=z,un.flushSync(()=>{u(z)}))})},[p,t,n,k,$]);me(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,u(C=>({...C,isPositioned:!1})))},[l]);const S=h.useRef(!1);me(()=>(S.current=!0,()=>{S.current=!1}),[]),me(()=>{if(y&&(A.current=y),R&&(O.current=R),y&&R){if(N.current)return N.current(y,R,E);E()}},[y,R,E,N,L]);const F=h.useMemo(()=>({reference:A,floating:O,setReference:w,setFloating:b}),[w,b]),_=h.useMemo(()=>({reference:y,floating:R}),[y,R]),M=h.useMemo(()=>{const C={position:n,left:0,top:0};if(!_.floating)return C;const D=st(_.floating,f.x),z=st(_.floating,f.y);return c?{...C,transform:"translate("+D+"px, "+z+"px)",...At(_.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:D,top:z}},[n,c,_.floating,f.x,f.y]);return h.useMemo(()=>({...f,update:E,refs:F,elements:_,floatingStyles:M}),[f,E,F,_,M])}const yo=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:r}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?it({element:o.current,padding:r}).fn(n):{}:o?it({element:o,padding:r}).fn(n):{}}}},bo=(e,t)=>{const n=lo(e);return{name:n.name,fn:n.fn,options:[e,t]}},Po=(e,t)=>{const n=fo(e);return{name:n.name,fn:n.fn,options:[e,t]}},Co=(e,t)=>({fn:mo(e).fn,options:[e,t]}),Ro=(e,t)=>{const n=uo(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ao=(e,t)=>{const n=po(e);return{name:n.name,fn:n.fn,options:[e,t]}},Oo=(e,t)=>{const n=ho(e);return{name:n.name,fn:n.fn,options:[e,t]}},So=(e,t)=>{const n=yo(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Eo="Arrow",Ot=h.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...i}=e;return P.jsx(U.svg,{...i,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:P.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ot.displayName=Eo;var _o=Ot;function Mo(e){const[t,n]=h.useState(void 0);return ae(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const i=r[0];let s,c;if("borderBoxSize"in i){const a=i.borderBoxSize,l=Array.isArray(a)?a[0]:a;s=l.inlineSize,c=l.blockSize}else s=e.offsetWidth,c=e.offsetHeight;n({width:s,height:c})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var He="Popper",[St,Et]=Te(He),[No,_t]=St(He),Mt=e=>{const{__scopePopper:t,children:n}=e,[o,r]=h.useState(null);return P.jsx(No,{scope:t,anchor:o,onAnchorChange:r,children:n})};Mt.displayName=He;var Nt="PopperAnchor",Tt=h.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,i=_t(Nt,n),s=h.useRef(null),c=fe(t,s),a=h.useRef(null);return h.useEffect(()=>{const l=a.current;a.current=o?.current||s.current,l!==a.current&&i.onAnchorChange(a.current)}),o?null:P.jsx(U.div,{...r,ref:c})});Tt.displayName=Nt;var Ie="PopperContent",[To,Do]=St(Ie),Dt=h.forwardRef((e,t)=>{const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:i="center",alignOffset:s=0,arrowPadding:c=0,avoidCollisions:a=!0,collisionBoundary:l=[],collisionPadding:f=0,sticky:u="partial",hideWhenDetached:p=!1,updatePositionStrategy:d="optimized",onPlaced:m,...g}=e,v=_t(Ie,n),[x,w]=h.useState(null),b=fe(t,ce=>w(ce)),[y,R]=h.useState(null),A=Mo(y),O=A?.width??0,T=A?.height??0,L=o+(i!=="center"?"-"+i:""),N=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},k=Array.isArray(l)?l:[l],$=k.length>0,E={padding:N,boundary:k.filter($o),altBoundary:$},{refs:S,floatingStyles:F,placement:_,isPositioned:M,middlewareData:C}=vo({strategy:"fixed",placement:L,whileElementsMounted:(...ce)=>ao(...ce,{animationFrame:d==="always"}),elements:{reference:v.anchor},middleware:[bo({mainAxis:r+T,alignmentAxis:s}),a&&Po({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?Co():void 0,...E}),a&&Ro({...E}),Ao({...E,apply:({elements:ce,rects:Ue,availableWidth:rn,availableHeight:sn})=>{const{width:cn,height:an}=Ue.reference,pe=ce.floating.style;pe.setProperty("--radix-popper-available-width",`${rn}px`),pe.setProperty("--radix-popper-available-height",`${sn}px`),pe.setProperty("--radix-popper-anchor-width",`${cn}px`),pe.setProperty("--radix-popper-anchor-height",`${an}px`)}}),y&&So({element:y,padding:c}),Lo({arrowWidth:O,arrowHeight:T}),p&&Oo({strategy:"referenceHidden",...E})]}),[D,z]=Lt(_),qe=ln(m);ae(()=>{M&&qe?.()},[M,qe]);const Qt=C.arrow?.x,en=C.arrow?.y,tn=C.arrow?.centerOffset!==0,[nn,on]=h.useState();return ae(()=>{x&&on(window.getComputedStyle(x).zIndex)},[x]),P.jsx("div",{ref:S.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:M?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:nn,"--radix-popper-transform-origin":[C.transformOrigin?.x,C.transformOrigin?.y].join(" "),...C.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:P.jsx(To,{scope:n,placedSide:D,onArrowChange:R,arrowX:Qt,arrowY:en,shouldHideArrow:tn,children:P.jsx(U.div,{"data-side":D,"data-align":z,...g,ref:b,style:{...g.style,animation:M?void 0:"none"}})})})});Dt.displayName=Ie;var kt="PopperArrow",ko={top:"bottom",right:"left",bottom:"top",left:"right"},$t=h.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,i=Do(kt,o),s=ko[i.placedSide];return P.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:P.jsx(_o,{...r,ref:n,style:{...r.style,display:"block"}})})});$t.displayName=kt;function $o(e){return e!==null}var Lo=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:o,middlewareData:r}=t,s=r.arrow?.centerOffset!==0,c=s?0:e.arrowWidth,a=s?0:e.arrowHeight,[l,f]=Lt(n),u={start:"0%",center:"50%",end:"100%"}[f],p=(r.arrow?.x??0)+c/2,d=(r.arrow?.y??0)+a/2;let m="",g="";return l==="bottom"?(m=s?u:`${p}px`,g=`${-a}px`):l==="top"?(m=s?u:`${p}px`,g=`${o.floating.height+a}px`):l==="right"?(m=`${-a}px`,g=s?u:`${d}px`):l==="left"&&(m=`${o.floating.width+a}px`,g=s?u:`${d}px`),{data:{x:m,y:g}}}});function Lt(e){const[t,n="center"]=e.split("-");return[t,n]}var Fo=Mt,Ft=Tt,jo=Dt,Wo=$t,Ho="Portal",jt=h.forwardRef((e,t)=>{const{container:n,...o}=e,[r,i]=h.useState(!1);ae(()=>i(!0),[]);const s=n||r&&globalThis?.document?.body;return s?dn.createPortal(P.jsx(U.div,{...o,ref:t}),s):null});jt.displayName=Ho;var Re="Popover",[Wt]=Te(Re,[Et]),de=Et(),[Io,J]=Wt(Re),Ht=e=>{const{__scopePopover:t,children:n,open:o,defaultOpen:r,onOpenChange:i,modal:s=!1}=e,c=de(t),a=h.useRef(null),[l,f]=h.useState(!1),[u,p]=ft({prop:o,defaultProp:r??!1,onChange:i,caller:Re});return P.jsx(Fo,{...c,children:P.jsx(Io,{scope:t,contentId:ut(),triggerRef:a,open:u,onOpenChange:p,onOpenToggle:h.useCallback(()=>p(d=>!d),[p]),hasCustomAnchor:l,onCustomAnchorAdd:h.useCallback(()=>f(!0),[]),onCustomAnchorRemove:h.useCallback(()=>f(!1),[]),modal:s,children:n})})};Ht.displayName=Re;var It="PopoverAnchor",zo=h.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=J(It,n),i=de(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:c}=r;return h.useEffect(()=>(s(),()=>c()),[s,c]),P.jsx(Ft,{...i,...o,ref:t})});zo.displayName=It;var zt="PopoverTrigger",Bt=h.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=J(zt,n),i=de(n),s=fe(t,r.triggerRef),c=P.jsx(U.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Ut(r.open),...o,ref:s,onClick:te(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?c:P.jsx(Ft,{asChild:!0,...i,children:c})});Bt.displayName=zt;var ze="PopoverPortal",[Bo,Vo]=Wt(ze,{forceMount:void 0}),Vt=e=>{const{__scopePopover:t,forceMount:n,children:o,container:r}=e,i=J(ze,t);return P.jsx(Bo,{scope:t,forceMount:n,children:P.jsx(De,{present:n||i.open,children:P.jsx(jt,{asChild:!0,container:r,children:o})})})};Vt.displayName=ze;var re="PopoverContent",Xt=h.forwardRef((e,t)=>{const n=Vo(re,e.__scopePopover),{forceMount:o=n.forceMount,...r}=e,i=J(re,e.__scopePopover);return P.jsx(De,{present:o||i.open,children:i.modal?P.jsx(Yo,{...r,ref:t}):P.jsx(qo,{...r,ref:t})})});Xt.displayName=re;var Xo=fn("PopoverContent.RemoveScroll"),Yo=h.forwardRef((e,t)=>{const n=J(re,e.__scopePopover),o=h.useRef(null),r=fe(t,o),i=h.useRef(!1);return h.useEffect(()=>{const s=o.current;if(s)return hn(s)},[]),P.jsx(mn,{as:Xo,allowPinchZoom:!0,children:P.jsx(Yt,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:te(e.onCloseAutoFocus,s=>{s.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:te(e.onPointerDownOutside,s=>{const c=s.detail.originalEvent,a=c.button===0&&c.ctrlKey===!0,l=c.button===2||a;i.current=l},{checkForDefaultPrevented:!1}),onFocusOutside:te(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),qo=h.forwardRef((e,t)=>{const n=J(re,e.__scopePopover),o=h.useRef(!1),r=h.useRef(!1);return P.jsx(Yt,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(o.current||n.triggerRef.current?.focus(),i.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(o.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),Yt=h.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:f,...u}=e,p=J(re,n),d=de(n);return gn(),P.jsx(xn,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:i,children:P.jsx(wn,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:a,onFocusOutside:l,onDismiss:()=>p.onOpenChange(!1),children:P.jsx(jo,{"data-state":Ut(p.open),role:"dialog",id:p.contentId,...d,...u,ref:t,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),qt="PopoverClose",Uo=h.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=J(qt,n);return P.jsx(U.button,{type:"button",...o,ref:t,onClick:te(e.onClick,()=>r.onOpenChange(!1))})});Uo.displayName=qt;var Go="PopoverArrow",Ko=h.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=de(n);return P.jsx(Wo,{...r,...o,ref:t})});Ko.displayName=Go;function Ut(e){return e?"open":"closed"}var Zo=Ht,Jo=Bt,Qo=Vt,Gt=Xt;const gr=Zo,xr=Jo,er=h.forwardRef(({className:e,align:t="center",sideOffset:n=4,...o},r)=>P.jsx(Qo,{children:P.jsx(Gt,{ref:r,align:t,sideOffset:n,side:"bottom",className:dt("z-50 origin-(--radix-popover-content-transform-origin) overflow-y-auto max-h-(--radix-popover-content-available-height) min-w-[240px] max-w-[98vw] rounded-xl border bg-fd-popover/60 backdrop-blur-lg p-2 text-sm text-fd-popover-foreground shadow-lg focus-visible:outline-none data-[state=closed]:animate-fd-popover-out data-[state=open]:animate-fd-popover-in",e),...o})}));er.displayName=Gt.displayName;function ct(e){return e.length>1&&e.endsWith("/")?e.slice(0,-1):e}function wr(e,t,n=!1){return e=ct(e),t=ct(t),e===t||n&&t.startsWith(`${e}/`)}var at=Object.defineProperty,vr=(e,t)=>{let n={};for(var o in e)at(n,o,{get:e[o],enumerable:!0});return at(n,Symbol.toStringTag,{value:"Module"}),n},Ae="Collapsible",[tr]=Te(Ae),[nr,Be]=tr(Ae),Kt=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:o,defaultOpen:r,disabled:i,onOpenChange:s,...c}=e,[a,l]=ft({prop:o,defaultProp:r??!1,onChange:s,caller:Ae});return P.jsx(nr,{scope:n,disabled:i,contentId:ut(),open:a,onOpenToggle:h.useCallback(()=>l(f=>!f),[l]),children:P.jsx(U.div,{"data-state":Ye(a),"data-disabled":i?"":void 0,...c,ref:t})})});Kt.displayName=Ae;var Zt="CollapsibleTrigger",Jt=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,...o}=e,r=Be(Zt,n);return P.jsx(U.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":Ye(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...o,ref:t,onClick:te(e.onClick,r.onOpenToggle)})});Jt.displayName=Zt;var Ve="CollapsibleContent",Xe=h.forwardRef((e,t)=>{const{forceMount:n,...o}=e,r=Be(Ve,e.__scopeCollapsible);return P.jsx(De,{present:n||r.open,children:({present:i})=>P.jsx(or,{...o,ref:t,present:i})})});Xe.displayName=Ve;var or=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:o,children:r,...i}=e,s=Be(Ve,n),[c,a]=h.useState(o),l=h.useRef(null),f=fe(t,l),u=h.useRef(0),p=u.current,d=h.useRef(0),m=d.current,g=s.open||c,v=h.useRef(g),x=h.useRef(void 0);return h.useEffect(()=>{const w=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(w)},[]),ae(()=>{const w=l.current;if(w){x.current=x.current||{transitionDuration:w.style.transitionDuration,animationName:w.style.animationName},w.style.transitionDuration="0s",w.style.animationName="none";const b=w.getBoundingClientRect();u.current=b.height,d.current=b.width,v.current||(w.style.transitionDuration=x.current.transitionDuration,w.style.animationName=x.current.animationName),a(o)}},[s.open,o]),P.jsx(U.div,{"data-state":Ye(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!g,...i,ref:f,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:g&&r})});function Ye(e){return e?"open":"closed"}var rr=Kt;const yr=rr,br=Jt,ir=h.forwardRef(({children:e,...t},n)=>{const[o,r]=h.useState(!1);return h.useEffect(()=>{r(!0)},[]),P.jsx(Xe,{ref:n,...t,className:dt("overflow-hidden",o&&"data-[state=closed]:animate-fd-collapsible-up data-[state=open]:animate-fd-collapsible-down",t.className),children:e})});ir.displayName=Xe.displayName;export{yr as C,ur as E,gr as P,pr as T,vr as _,xr as a,er as b,br as c,fr as d,ir as e,mr as f,dr as g,Pn as h,wr as i,ct as n,hr as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as Bt}from"./index-CkdplsNl.js";import{J as Ie,s as nt,f as Mt,c as jt,d as Dt,z as Wt,h as Ft}from"./index-BNzds__a.js";import{c as Me}from"./index-CLyIGTiM.js";import"./index-BJW5cYpx.js";import"./index-BHSCznho.js";import"./merge-refs-DdSaIw4w.js";import"./index-DhlSbsoh.js";import"./index-BVWEvTtH.js";import"./schemas-BzqjMV9-.js";import"./use-copy-button-BVfD1u7Q.js";import"./index-fYADC7x8.js";import"./check-BbfQleye.js";import"./x-Bcn3Z-A2.js";import"./search-BvoJUzZe.js";var S=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function qt(t){return Le(t)}function Le(t){return Array.isArray(t)?zt(t):t instanceof RegExp?t:typeof t=="object"?Ht(t):t}function zt(t){let e=[];for(let n=0,s=t.length;n<s;n++)e[n]=Le(t[n]);return e}function Ht(t){let e={};for(let n in t)e[n]=Le(t[n]);return e}function st(t,...e){return e.forEach(n=>{for(let s in n)t[s]=n[s]}),t}function rt(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?rt(t.substring(0,t.length-1)):t.substr(~e+1)}var de=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,H=class{static hasCaptures(t){return t===null?!1:(de.lastIndex=0,de.test(t))}static replaceCaptures(t,e,n){return t.replace(de,(s,r,i,o)=>{let a=n[parseInt(r||i,10)];if(a){let c=e.substring(a.start,a.end);for(;c[0]===".";)c=c.substring(1);switch(o){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return s})}};function it(t,e){return t<e?-1:t>e?1:0}function ot(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,s=e.length;if(n===s){for(let r=0;r<n;r++){let i=it(t[r],e[r]);if(i!==0)return i}return 0}return n-s}function je(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function at(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var ct=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},V=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Yt(t),e)}static createFromParsedTheme(t,e){return Vt(t,e)}_cachedMatchRoot=new ct(t=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,s=this._cachedMatchRoot.get(e).find(r=>Ut(t.parent,r.parentScopes));return s?new lt(s.fontStyle,s.foreground,s.background):null}},ge=class Y{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const s of n)e=new Y(e,s);return e}static from(...e){let n=null;for(let s=0;s<e.length;s++)n=new Y(n,e[s]);return n}push(e){return new Y(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let s=this;for(;s&&s!==e;)n.push(s.scopeName),s=s.parent;return s===e?n.reverse():void 0}};function Ut(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let s=e[n],r=!1;if(s===">"){if(n===e.length-1)return!1;s=e[++n],r=!0}for(;t&&!Kt(t.scopeName,s);){if(r)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Kt(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var lt=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Yt(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],s=0;for(let r=0,i=e.length;r<i;r++){let o=e[r];if(!o.settings)continue;let a;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),a=h.split(",")}else Array.isArray(o.scope)?a=o.scope:a=[""];let c=-1;if(typeof o.settings.fontStyle=="string"){c=0;let h=o.settings.fontStyle.split(" ");for(let f=0,d=h.length;f<d;f++)switch(h[f]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let l=null;typeof o.settings.foreground=="string"&&je(o.settings.foreground)&&(l=o.settings.foreground);let u=null;typeof o.settings.background=="string"&&je(o.settings.background)&&(u=o.settings.background);for(let h=0,f=a.length;h<f;h++){let g=a[h].trim().split(" "),b=g[g.length-1],_=null;g.length>1&&(_=g.slice(0,g.length-1),_.reverse()),n[s++]=new Jt(b,_,r,c,l,u)}}return n}var Jt=class{constructor(t,e,n,s,r,i){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=s,this.foreground=r,this.background=i}},k=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(k||{});function Vt(t,e){t.sort((c,l)=>{let u=it(c.scope,l.scope);return u!==0||(u=ot(c.parentScopes,l.parentScopes),u!==0)?u:c.index-l.index});let n=0,s="#000000",r="#ffffff";for(;t.length>=1&&t[0].scope==="";){let c=t.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(s=c.foreground),c.background!==null&&(r=c.background)}let i=new Qt(e),o=new lt(n,i.getId(s),i.getId(r)),a=new Zt(new be(0,null,-1,0,0),[]);for(let c=0,l=t.length;c<l;c++){let u=t[c];a.insert(0,u.scope,u.parentScopes,u.fontStyle,i.getId(u.foreground),i.getId(u.background))}return new V(i,o,a)}var Qt=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},Xt=Object.freeze([]),be=class ut{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,s,r,i){this.scopeDepth=e,this.parentScopes=n||Xt,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new ut(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let s=0,r=e.length;s<r;s++)n[s]=e[s].clone();return n}acceptOverwrite(e,n,s,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),s!==0&&(this.foreground=s),r!==0&&(this.background=r)}},Zt=class Se{constructor(e,n=[],s={}){this._mainRule=e,this._children=s,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let s=0,r=0;for(;e.parentScopes[s]===">"&&s++,n.parentScopes[r]===">"&&r++,!(s>=e.parentScopes.length||r>=n.parentScopes.length);){const i=n.parentScopes[r].length-e.parentScopes[s].length;if(i!==0)return i;s++,r++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let s=e.indexOf("."),r,i;if(s===-1?(r=e,i=""):(r=e.substring(0,s),i=e.substring(s+1)),this._children.hasOwnProperty(r))return this._children[r].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Se._cmpBySpecificity),n}insert(e,n,s,r,i,o){if(n===""){this._doInsertHere(e,s,r,i,o);return}let a=n.indexOf("."),c,l;a===-1?(c=n,l=""):(c=n.substring(0,a),l=n.substring(a+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new Se(this._mainRule.clone(),be.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(e+1,l,s,r,i,o)}_doInsertHere(e,n,s,r,i){if(n===null){this._mainRule.acceptOverwrite(e,s,r,i);return}for(let o=0,a=this._rulesWithParentScopes.length;o<a;o++){let c=this._rulesWithParentScopes[o];if(ot(c.parentScopes,n)===0){c.acceptOverwrite(e,s,r,i);return}}s===-1&&(s=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new be(e,n,s,r,i))}},$=class A{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=A.getLanguageId(e),s=A.getTokenType(e),r=A.getFontStyle(e),i=A.getForeground(e),o=A.getBackground(e);console.log({languageId:n,tokenType:s,fontStyle:r,foreground:i,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,s,r,i,o,a){let c=A.getLanguageId(e),l=A.getTokenType(e),u=A.containsBalancedBrackets(e)?1:0,h=A.getFontStyle(e),f=A.getForeground(e),d=A.getBackground(e);return n!==0&&(c=n),s!==8&&(l=s),r!==null&&(u=r?1:0),i!==-1&&(h=i),o!==0&&(f=o),a!==0&&(d=a),(c<<0|l<<8|u<<10|h<<11|f<<15|d<<24)>>>0}};function Q(t,e){const n=[],s=en(t);let r=s.next();for(;r!==null;){let c=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let l=o();if(n.push({matcher:l,priority:c}),r!==",")break;r=s.next()}return n;function i(){if(r==="-"){r=s.next();const c=i();return l=>!!c&&!c(l)}if(r==="("){r=s.next();const c=a();return r===")"&&(r=s.next()),c}if(De(r)){const c=[];do c.push(r),r=s.next();while(De(r));return l=>e(c,l)}return null}function o(){const c=[];let l=i();for(;l;)c.push(l),l=i();return u=>c.every(h=>h(u))}function a(){const c=[];let l=o();for(;l&&(c.push(l),r==="|"||r===",");){do r=s.next();while(r==="|"||r===",");l=o()}return u=>c.some(h=>h(u))}}function De(t){return!!t&&!!t.match(/[\w\.:]+/)}function en(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const s=n[0];return n=e.exec(t),s}}}function ht(t){typeof t.dispose=="function"&&t.dispose()}var D=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},tn=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},nn=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},sn=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new D(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new nn;for(const n of t)rn(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof D){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function rn(t,e,n,s){const r=n.lookup(t.scopeName);if(!r){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const i=n.lookup(e);t instanceof D?J({baseGrammar:i,selfGrammar:r},s):Ce(t.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},s);const o=n.injections(t.scopeName);if(o)for(const a of o)s.add(new D(a))}function Ce(t,e,n){if(e.repository&&e.repository[t]){const s=e.repository[t];X([s],e,n)}}function J(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&X(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&X(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function X(t,e,n){for(const s of t){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const r=s.repository?st({},e.repository,s.repository):e.repository;Array.isArray(s.patterns)&&X(s.patterns,{...e,repository:r},n);const i=s.include;if(!i)continue;const o=ft(i);switch(o.kind){case 0:J({...e,selfGrammar:e.baseGrammar},n);break;case 1:J(e,n);break;case 2:Ce(o.ruleName,{...e,repository:r},n);break;case 3:case 4:const a=o.scopeName===e.selfGrammar.scopeName?e.selfGrammar:o.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(a){const c={baseGrammar:e.baseGrammar,selfGrammar:a,repository:r};o.kind===4?Ce(o.ruleName,c,n):J(c,n)}else o.kind===4?n.add(new tn(o.scopeName,o.ruleName)):n.add(new D(o.scopeName));break}}}var on=class{kind=0},an=class{kind=1},cn=class{constructor(t){this.ruleName=t}kind=2},ln=class{constructor(t){this.scopeName=t}kind=3},un=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function ft(t){if(t==="$base")return new on;if(t==="$self")return new an;const e=t.indexOf("#");if(e===-1)return new ln(t);if(e===0)return new cn(t.substring(1));{const n=t.substring(0,e),s=t.substring(e+1);return new un(n,s)}}var hn=/\\(\d+)/,We=/\\(\d+)/g,fn=-1,dt=-2;var z=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,s){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=H.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=H.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${rt(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:H.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:H.replaceCaptures(this._contentName,t,e)}},dn=class extends z{retokenizeCapturedWithRuleId;constructor(t,e,n,s,r){super(t,e,n,s),this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,s){throw new Error("Not supported!")}},gn=class extends z{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,s,r){super(t,e,n,null),this._match=new W(s,this.id),this.captures=r,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new F,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Fe=class extends z{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,s,r){super(t,e,n,s),this.patterns=r.patterns,this.hasMissingPatterns=r.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new F,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},we=class extends z{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,s,r,i,o,a,c,l){super(t,e,n,s),this._begin=new W(r,this.id),this.beginCaptures=i,this._end=new W(o||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,s)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new F;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},Z=class extends z{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,s,r,i,o,a,c){super(t,e,n,s),this._begin=new W(r,this.id),this.beginCaptures=i,this.whileCaptures=a,this._while=new W(o,dt),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new F;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,s){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,s)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new F,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||""),this._cachedCompiledWhilePatterns}},gt=class N{static createCaptureRule(e,n,s,r,i){return e.registerRule(o=>new dn(n,o,s,r,i))}static getCompiledRuleId(e,n,s){return e.id||n.registerRule(r=>{if(e.id=r,e.match)return new gn(e.$vscodeTextmateLocation,e.id,e.name,e.match,N._compileCaptures(e.captures,n,s));if(typeof e.begin>"u"){e.repository&&(s=st({},s,e.repository));let i=e.patterns;return typeof i>"u"&&e.include&&(i=[{include:e.include}]),new Fe(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,N._compilePatterns(i,n,s))}return e.while?new Z(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,N._compileCaptures(e.beginCaptures||e.captures,n,s),e.while,N._compileCaptures(e.whileCaptures||e.captures,n,s),N._compilePatterns(e.patterns,n,s)):new we(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,N._compileCaptures(e.beginCaptures||e.captures,n,s),e.end,N._compileCaptures(e.endCaptures||e.captures,n,s),e.applyEndPatternLast,N._compilePatterns(e.patterns,n,s))}),e.id}static _compileCaptures(e,n,s){let r=[];if(e){let i=0;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);a>i&&(i=a)}for(let o=0;o<=i;o++)r[o]=null;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);let c=0;e[o].patterns&&(c=N.getCompiledRuleId(e[o],n,s)),r[a]=N.createCaptureRule(n,e[o].$vscodeTextmateLocation,e[o].name,e[o].contentName,c)}}return r}static _compilePatterns(e,n,s){let r=[];if(e)for(let i=0,o=e.length;i<o;i++){const a=e[i];let c=-1;if(a.include){const l=ft(a.include);switch(l.kind){case 0:case 1:c=N.getCompiledRuleId(s[a.include],n,s);break;case 2:let u=s[l.ruleName];u&&(c=N.getCompiledRuleId(u,n,s));break;case 3:case 4:const h=l.scopeName,f=l.kind===4?l.ruleName:null,d=n.getExternalGrammar(h,s);if(d)if(f){let g=d.repository[f];g&&(c=N.getCompiledRuleId(g,n,d.repository))}else c=N.getCompiledRuleId(d.repository.$self,n,d.repository);break}}else c=N.getCompiledRuleId(a,n,s);if(c!==-1){const l=n.getRule(c);let u=!1;if((l instanceof Fe||l instanceof we||l instanceof Z)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;r.push(c)}}return{patterns:r,hasMissingPatterns:(e?e.length:0)!==r.length}}},W=class mt{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const s=e.length;let r=0,i=[],o=!1;for(let a=0;a<s;a++)if(e.charAt(a)==="\\"&&a+1<s){const l=e.charAt(a+1);l==="z"?(i.push(e.substring(r,a)),i.push("$(?!\\n)(?<!\\n)"),r=a+2):(l==="A"||l==="G")&&(o=!0),a++}this.hasAnchor=o,r===0?this.source=e:(i.push(e.substring(r,s)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=hn.test(this.source):this.hasBackReferences=!1}clone(){return new mt(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let s=n.map(r=>e.substring(r.start,r.end));return We.lastIndex=0,this.source.replace(We,(r,i)=>at(s[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],s=[],r=[],i,o,a,c;for(i=0,o=this.source.length;i<o;i++)a=this.source.charAt(i),e[i]=a,n[i]=a,s[i]=a,r[i]=a,a==="\\"&&i+1<o&&(c=this.source.charAt(i+1),c==="A"?(e[i+1]="",n[i+1]="",s[i+1]="A",r[i+1]="A"):c==="G"?(e[i+1]="",n[i+1]="G",s[i+1]="",r[i+1]="G"):(e[i+1]=c,n[i+1]=c,s[i+1]=c,r[i+1]=c),i++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:s.join(""),A1_G1:r.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},F=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new qe(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let s=this._items.map(r=>r.resolveAnchors(e,n));return new qe(t,s,this._items.map(r=>r.ruleId))}},qe=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
|
|
1
|
+
import{h as Bt}from"./index-CkdplsNl.js";import{J as Ie,s as nt,f as Mt,c as jt,d as Dt,z as Wt,h as Ft}from"./index-DP8HDMXM.js";import{c as Me}from"./index-DOEHfaq9.js";import"./index-CCS3nv-i.js";import"./index-9Vsiq1Kd.js";import"./merge-refs-CciE9kPU.js";import"./index-DTcPPegm.js";import"./schemas-BzqjMV9-.js";import"./use-copy-button-xpFuyTA0.js";import"./index-18GBv5c2.js";import"./x-DQzaIRL0.js";import"./search-CUUh5VYW.js";var S=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function qt(t){return Le(t)}function Le(t){return Array.isArray(t)?zt(t):t instanceof RegExp?t:typeof t=="object"?Ht(t):t}function zt(t){let e=[];for(let n=0,s=t.length;n<s;n++)e[n]=Le(t[n]);return e}function Ht(t){let e={};for(let n in t)e[n]=Le(t[n]);return e}function st(t,...e){return e.forEach(n=>{for(let s in n)t[s]=n[s]}),t}function rt(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?rt(t.substring(0,t.length-1)):t.substr(~e+1)}var de=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,H=class{static hasCaptures(t){return t===null?!1:(de.lastIndex=0,de.test(t))}static replaceCaptures(t,e,n){return t.replace(de,(s,r,i,o)=>{let a=n[parseInt(r||i,10)];if(a){let c=e.substring(a.start,a.end);for(;c[0]===".";)c=c.substring(1);switch(o){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return s})}};function it(t,e){return t<e?-1:t>e?1:0}function ot(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,s=e.length;if(n===s){for(let r=0;r<n;r++){let i=it(t[r],e[r]);if(i!==0)return i}return 0}return n-s}function je(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function at(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var ct=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},V=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Yt(t),e)}static createFromParsedTheme(t,e){return Vt(t,e)}_cachedMatchRoot=new ct(t=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,s=this._cachedMatchRoot.get(e).find(r=>Ut(t.parent,r.parentScopes));return s?new lt(s.fontStyle,s.foreground,s.background):null}},ge=class Y{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const s of n)e=new Y(e,s);return e}static from(...e){let n=null;for(let s=0;s<e.length;s++)n=new Y(n,e[s]);return n}push(e){return new Y(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let s=this;for(;s&&s!==e;)n.push(s.scopeName),s=s.parent;return s===e?n.reverse():void 0}};function Ut(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let s=e[n],r=!1;if(s===">"){if(n===e.length-1)return!1;s=e[++n],r=!0}for(;t&&!Kt(t.scopeName,s);){if(r)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Kt(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var lt=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Yt(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],s=0;for(let r=0,i=e.length;r<i;r++){let o=e[r];if(!o.settings)continue;let a;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),a=h.split(",")}else Array.isArray(o.scope)?a=o.scope:a=[""];let c=-1;if(typeof o.settings.fontStyle=="string"){c=0;let h=o.settings.fontStyle.split(" ");for(let f=0,d=h.length;f<d;f++)switch(h[f]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let l=null;typeof o.settings.foreground=="string"&&je(o.settings.foreground)&&(l=o.settings.foreground);let u=null;typeof o.settings.background=="string"&&je(o.settings.background)&&(u=o.settings.background);for(let h=0,f=a.length;h<f;h++){let g=a[h].trim().split(" "),b=g[g.length-1],_=null;g.length>1&&(_=g.slice(0,g.length-1),_.reverse()),n[s++]=new Jt(b,_,r,c,l,u)}}return n}var Jt=class{constructor(t,e,n,s,r,i){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=s,this.foreground=r,this.background=i}},k=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(k||{});function Vt(t,e){t.sort((c,l)=>{let u=it(c.scope,l.scope);return u!==0||(u=ot(c.parentScopes,l.parentScopes),u!==0)?u:c.index-l.index});let n=0,s="#000000",r="#ffffff";for(;t.length>=1&&t[0].scope==="";){let c=t.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(s=c.foreground),c.background!==null&&(r=c.background)}let i=new Qt(e),o=new lt(n,i.getId(s),i.getId(r)),a=new Zt(new be(0,null,-1,0,0),[]);for(let c=0,l=t.length;c<l;c++){let u=t[c];a.insert(0,u.scope,u.parentScopes,u.fontStyle,i.getId(u.foreground),i.getId(u.background))}return new V(i,o,a)}var Qt=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},Xt=Object.freeze([]),be=class ut{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,s,r,i){this.scopeDepth=e,this.parentScopes=n||Xt,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new ut(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let s=0,r=e.length;s<r;s++)n[s]=e[s].clone();return n}acceptOverwrite(e,n,s,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),s!==0&&(this.foreground=s),r!==0&&(this.background=r)}},Zt=class Se{constructor(e,n=[],s={}){this._mainRule=e,this._children=s,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let s=0,r=0;for(;e.parentScopes[s]===">"&&s++,n.parentScopes[r]===">"&&r++,!(s>=e.parentScopes.length||r>=n.parentScopes.length);){const i=n.parentScopes[r].length-e.parentScopes[s].length;if(i!==0)return i;s++,r++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let s=e.indexOf("."),r,i;if(s===-1?(r=e,i=""):(r=e.substring(0,s),i=e.substring(s+1)),this._children.hasOwnProperty(r))return this._children[r].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Se._cmpBySpecificity),n}insert(e,n,s,r,i,o){if(n===""){this._doInsertHere(e,s,r,i,o);return}let a=n.indexOf("."),c,l;a===-1?(c=n,l=""):(c=n.substring(0,a),l=n.substring(a+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new Se(this._mainRule.clone(),be.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(e+1,l,s,r,i,o)}_doInsertHere(e,n,s,r,i){if(n===null){this._mainRule.acceptOverwrite(e,s,r,i);return}for(let o=0,a=this._rulesWithParentScopes.length;o<a;o++){let c=this._rulesWithParentScopes[o];if(ot(c.parentScopes,n)===0){c.acceptOverwrite(e,s,r,i);return}}s===-1&&(s=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new be(e,n,s,r,i))}},$=class A{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=A.getLanguageId(e),s=A.getTokenType(e),r=A.getFontStyle(e),i=A.getForeground(e),o=A.getBackground(e);console.log({languageId:n,tokenType:s,fontStyle:r,foreground:i,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,s,r,i,o,a){let c=A.getLanguageId(e),l=A.getTokenType(e),u=A.containsBalancedBrackets(e)?1:0,h=A.getFontStyle(e),f=A.getForeground(e),d=A.getBackground(e);return n!==0&&(c=n),s!==8&&(l=s),r!==null&&(u=r?1:0),i!==-1&&(h=i),o!==0&&(f=o),a!==0&&(d=a),(c<<0|l<<8|u<<10|h<<11|f<<15|d<<24)>>>0}};function Q(t,e){const n=[],s=en(t);let r=s.next();for(;r!==null;){let c=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let l=o();if(n.push({matcher:l,priority:c}),r!==",")break;r=s.next()}return n;function i(){if(r==="-"){r=s.next();const c=i();return l=>!!c&&!c(l)}if(r==="("){r=s.next();const c=a();return r===")"&&(r=s.next()),c}if(De(r)){const c=[];do c.push(r),r=s.next();while(De(r));return l=>e(c,l)}return null}function o(){const c=[];let l=i();for(;l;)c.push(l),l=i();return u=>c.every(h=>h(u))}function a(){const c=[];let l=o();for(;l&&(c.push(l),r==="|"||r===",");){do r=s.next();while(r==="|"||r===",");l=o()}return u=>c.some(h=>h(u))}}function De(t){return!!t&&!!t.match(/[\w\.:]+/)}function en(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const s=n[0];return n=e.exec(t),s}}}function ht(t){typeof t.dispose=="function"&&t.dispose()}var D=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},tn=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},nn=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},sn=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new D(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new nn;for(const n of t)rn(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof D){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function rn(t,e,n,s){const r=n.lookup(t.scopeName);if(!r){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const i=n.lookup(e);t instanceof D?J({baseGrammar:i,selfGrammar:r},s):Ce(t.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},s);const o=n.injections(t.scopeName);if(o)for(const a of o)s.add(new D(a))}function Ce(t,e,n){if(e.repository&&e.repository[t]){const s=e.repository[t];X([s],e,n)}}function J(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&X(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&X(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function X(t,e,n){for(const s of t){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const r=s.repository?st({},e.repository,s.repository):e.repository;Array.isArray(s.patterns)&&X(s.patterns,{...e,repository:r},n);const i=s.include;if(!i)continue;const o=ft(i);switch(o.kind){case 0:J({...e,selfGrammar:e.baseGrammar},n);break;case 1:J(e,n);break;case 2:Ce(o.ruleName,{...e,repository:r},n);break;case 3:case 4:const a=o.scopeName===e.selfGrammar.scopeName?e.selfGrammar:o.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(a){const c={baseGrammar:e.baseGrammar,selfGrammar:a,repository:r};o.kind===4?Ce(o.ruleName,c,n):J(c,n)}else o.kind===4?n.add(new tn(o.scopeName,o.ruleName)):n.add(new D(o.scopeName));break}}}var on=class{kind=0},an=class{kind=1},cn=class{constructor(t){this.ruleName=t}kind=2},ln=class{constructor(t){this.scopeName=t}kind=3},un=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function ft(t){if(t==="$base")return new on;if(t==="$self")return new an;const e=t.indexOf("#");if(e===-1)return new ln(t);if(e===0)return new cn(t.substring(1));{const n=t.substring(0,e),s=t.substring(e+1);return new un(n,s)}}var hn=/\\(\d+)/,We=/\\(\d+)/g,fn=-1,dt=-2;var z=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,s){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=H.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=H.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${rt(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:H.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:H.replaceCaptures(this._contentName,t,e)}},dn=class extends z{retokenizeCapturedWithRuleId;constructor(t,e,n,s,r){super(t,e,n,s),this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,s){throw new Error("Not supported!")}},gn=class extends z{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,s,r){super(t,e,n,null),this._match=new W(s,this.id),this.captures=r,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new F,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Fe=class extends z{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,s,r){super(t,e,n,s),this.patterns=r.patterns,this.hasMissingPatterns=r.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new F,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},we=class extends z{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,s,r,i,o,a,c,l){super(t,e,n,s),this._begin=new W(r,this.id),this.beginCaptures=i,this._end=new W(o||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,s)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new F;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},Z=class extends z{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,s,r,i,o,a,c){super(t,e,n,s),this._begin=new W(r,this.id),this.beginCaptures=i,this.whileCaptures=a,this._while=new W(o,dt),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new F;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,s){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,s)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new F,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||""),this._cachedCompiledWhilePatterns}},gt=class N{static createCaptureRule(e,n,s,r,i){return e.registerRule(o=>new dn(n,o,s,r,i))}static getCompiledRuleId(e,n,s){return e.id||n.registerRule(r=>{if(e.id=r,e.match)return new gn(e.$vscodeTextmateLocation,e.id,e.name,e.match,N._compileCaptures(e.captures,n,s));if(typeof e.begin>"u"){e.repository&&(s=st({},s,e.repository));let i=e.patterns;return typeof i>"u"&&e.include&&(i=[{include:e.include}]),new Fe(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,N._compilePatterns(i,n,s))}return e.while?new Z(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,N._compileCaptures(e.beginCaptures||e.captures,n,s),e.while,N._compileCaptures(e.whileCaptures||e.captures,n,s),N._compilePatterns(e.patterns,n,s)):new we(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,N._compileCaptures(e.beginCaptures||e.captures,n,s),e.end,N._compileCaptures(e.endCaptures||e.captures,n,s),e.applyEndPatternLast,N._compilePatterns(e.patterns,n,s))}),e.id}static _compileCaptures(e,n,s){let r=[];if(e){let i=0;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);a>i&&(i=a)}for(let o=0;o<=i;o++)r[o]=null;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);let c=0;e[o].patterns&&(c=N.getCompiledRuleId(e[o],n,s)),r[a]=N.createCaptureRule(n,e[o].$vscodeTextmateLocation,e[o].name,e[o].contentName,c)}}return r}static _compilePatterns(e,n,s){let r=[];if(e)for(let i=0,o=e.length;i<o;i++){const a=e[i];let c=-1;if(a.include){const l=ft(a.include);switch(l.kind){case 0:case 1:c=N.getCompiledRuleId(s[a.include],n,s);break;case 2:let u=s[l.ruleName];u&&(c=N.getCompiledRuleId(u,n,s));break;case 3:case 4:const h=l.scopeName,f=l.kind===4?l.ruleName:null,d=n.getExternalGrammar(h,s);if(d)if(f){let g=d.repository[f];g&&(c=N.getCompiledRuleId(g,n,d.repository))}else c=N.getCompiledRuleId(d.repository.$self,n,d.repository);break}}else c=N.getCompiledRuleId(a,n,s);if(c!==-1){const l=n.getRule(c);let u=!1;if((l instanceof Fe||l instanceof we||l instanceof Z)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;r.push(c)}}return{patterns:r,hasMissingPatterns:(e?e.length:0)!==r.length}}},W=class mt{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const s=e.length;let r=0,i=[],o=!1;for(let a=0;a<s;a++)if(e.charAt(a)==="\\"&&a+1<s){const l=e.charAt(a+1);l==="z"?(i.push(e.substring(r,a)),i.push("$(?!\\n)(?<!\\n)"),r=a+2):(l==="A"||l==="G")&&(o=!0),a++}this.hasAnchor=o,r===0?this.source=e:(i.push(e.substring(r,s)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=hn.test(this.source):this.hasBackReferences=!1}clone(){return new mt(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let s=n.map(r=>e.substring(r.start,r.end));return We.lastIndex=0,this.source.replace(We,(r,i)=>at(s[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],s=[],r=[],i,o,a,c;for(i=0,o=this.source.length;i<o;i++)a=this.source.charAt(i),e[i]=a,n[i]=a,s[i]=a,r[i]=a,a==="\\"&&i+1<o&&(c=this.source.charAt(i+1),c==="A"?(e[i+1]="",n[i+1]="",s[i+1]="A",r[i+1]="A"):c==="G"?(e[i+1]="",n[i+1]="G",s[i+1]="",r[i+1]="G"):(e[i+1]=c,n[i+1]=c,s[i+1]=c,r[i+1]=c),i++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:s.join(""),A1_G1:r.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},F=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new qe(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let s=this._items.map(r=>r.resolveAnchors(e,n));return new qe(t,s,this._items.map(r=>r.ruleId))}},qe=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
|
|
2
2
|
`)}findNextMatchSync(t,e,n){const s=this.scanner.findNextMatchSync(t,e,n);return s?{ruleId:this.rules[s.index],captureIndices:s.captureIndices}:null}},me=class{constructor(t,e){this.languageId=t,this.tokenType=e}},mn=class Re{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new me(e,8),this._embeddedLanguagesMatcher=new pn(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?Re._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new me(0,0);_getBasicScopeAttributes=new ct(e=>{const n=this._scopeToLanguage(e),s=this._toStandardTokenType(e);return new me(n,s)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(Re.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},pn=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([n,s])=>at(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},ze=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function pt(t,e,n,s,r,i,o,a){const c=e.content.length;let l=!1,u=-1;if(o){const d=_n(t,e,n,s,r,i);r=d.stack,s=d.linePos,n=d.isFirstLine,u=d.anchorPosition}const h=Date.now();for(;!l;){if(a!==0&&Date.now()-h>a)return new ze(r,!0);f()}return new ze(r,!1);function f(){const d=yn(t,e,n,s,r,u);if(!d){i.produce(r,c),l=!0;return}const g=d.captureIndices,b=d.matchedRuleId,_=g&&g.length>0?g[0].end>s:!1;if(b===fn){const p=r.getRule(t);i.produce(r,g[0].start),r=r.withContentNameScopesList(r.nameScopesList),M(t,e,n,r,i,p.endCaptures,g),i.produce(r,g[0].end);const m=r;if(r=r.parent,u=m.getAnchorPos(),!_&&m.getEnterPos()===s){r=m,i.produce(r,c),l=!0;return}}else{const p=t.getRule(b);i.produce(r,g[0].start);const m=r,y=p.getName(e.content,g),R=r.contentNameScopesList.pushAttributed(y,t);if(r=r.push(b,s,u,g[0].end===c,null,R,R),p instanceof we){const C=p;M(t,e,n,r,i,C.beginCaptures,g),i.produce(r,g[0].end),u=g[0].end;const v=C.getContentName(e.content,g),x=R.pushAttributed(v,t);if(r=r.withContentNameScopesList(x),C.endHasBackReferences&&(r=r.withEndRule(C.getEndWithResolvedBackReferences(e.content,g))),!_&&m.hasSameRuleAs(r)){r=r.pop(),i.produce(r,c),l=!0;return}}else if(p instanceof Z){const C=p;M(t,e,n,r,i,C.beginCaptures,g),i.produce(r,g[0].end),u=g[0].end;const v=C.getContentName(e.content,g),x=R.pushAttributed(v,t);if(r=r.withContentNameScopesList(x),C.whileHasBackReferences&&(r=r.withEndRule(C.getWhileWithResolvedBackReferences(e.content,g))),!_&&m.hasSameRuleAs(r)){r=r.pop(),i.produce(r,c),l=!0;return}}else if(M(t,e,n,r,i,p.captures,g),i.produce(r,g[0].end),r=r.pop(),!_){r=r.safePop(),i.produce(r,c),l=!0;return}}g[0].end>s&&(s=g[0].end,n=!1)}}function _n(t,e,n,s,r,i){let o=r.beginRuleCapturedEOL?0:-1;const a=[];for(let c=r;c;c=c.pop()){const l=c.getRule(t);l instanceof Z&&a.push({rule:l,stack:c})}for(let c=a.pop();c;c=a.pop()){const{ruleScanner:l,findOptions:u}=Cn(c.rule,t,c.stack.endRule,n,s===o),h=l.findNextMatchSync(e,s,u);if(h){if(h.ruleId!==dt){r=c.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(i.produce(c.stack,h.captureIndices[0].start),M(t,e,n,c.stack,i,c.rule.whileCaptures,h.captureIndices),i.produce(c.stack,h.captureIndices[0].end),o=h.captureIndices[0].end,h.captureIndices[0].end>s&&(s=h.captureIndices[0].end,n=!1))}else{r=c.stack.pop();break}}return{stack:r,linePos:s,anchorPosition:o,isFirstLine:n}}function yn(t,e,n,s,r,i){const o=bn(t,e,n,s,r,i),a=t.getInjections();if(a.length===0)return o;const c=Sn(a,t,e,n,s,r,i);if(!c)return o;if(!o)return c;const l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function bn(t,e,n,s,r,i){const o=r.getRule(t),{ruleScanner:a,findOptions:c}=_t(o,t,r.endRule,n,s===i),l=a.findNextMatchSync(e,s,c);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function Sn(t,e,n,s,r,i,o){let a=Number.MAX_VALUE,c=null,l,u=0;const h=i.contentNameScopesList.getScopeNames();for(let f=0,d=t.length;f<d;f++){const g=t[f];if(!g.matcher(h))continue;const b=e.getRule(g.ruleId),{ruleScanner:_,findOptions:p}=_t(b,e,null,s,r===o),m=_.findNextMatchSync(n,r,p);if(!m)continue;const y=m.captureIndices[0].start;if(!(y>=a)&&(a=y,c=m.captureIndices,l=m.ruleId,u=g.priority,a===r))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function _t(t,e,n,s,r){return{ruleScanner:t.compileAG(e,n,s,r),findOptions:0}}function Cn(t,e,n,s,r){return{ruleScanner:t.compileWhileAG(e,n,s,r),findOptions:0}}function M(t,e,n,s,r,i,o){if(i.length===0)return;const a=e.content,c=Math.min(i.length,o.length),l=[],u=o[0].end;for(let h=0;h<c;h++){const f=i[h];if(f===null)continue;const d=o[h];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)r.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?r.produceFromScopes(l[l.length-1].scopes,d.start):r.produce(s,d.start),f.retokenizeCapturedWithRuleId){const b=f.getName(a,o),_=s.contentNameScopesList.pushAttributed(b,t),p=f.getContentName(a,o),m=_.pushAttributed(p,t),y=s.push(f.retokenizeCapturedWithRuleId,d.start,-1,!1,null,_,m),R=t.createOnigString(a.substring(0,d.end));pt(t,R,n&&d.start===0,d.start,y,r,!1,0),ht(R);continue}const g=f.getName(a,o);if(g!==null){const _=(l.length>0?l[l.length-1].scopes:s.contentNameScopesList).pushAttributed(g,t);l.push(new wn(_,d.end))}}for(;l.length>0;)r.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var wn=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function Rn(t,e,n,s,r,i,o,a){return new kn(t,e,n,s,r,i,o,a)}function He(t,e,n,s,r){const i=Q(e,ee),o=gt.getCompiledRuleId(n,s,r.repository);for(const a of i)t.push({debugSelector:e,matcher:a.matcher,ruleId:o,grammar:r,priority:a.priority})}function ee(t,e){if(e.length<t.length)return!1;let n=0;return t.every(s=>{for(let r=n;r<e.length;r++)if(Nn(e[r],s))return n=r+1,!0;return!1})}function Nn(t,e){if(!t)return!1;if(t===e)return!0;const n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var kn=class{constructor(t,e,n,s,r,i,o,a){if(this._rootScopeName=t,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new mn(n,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Ue(e,null),this._injections=null,this._tokenTypeMatchers=[],r)for(const c of Object.keys(r)){const l=Q(c,ee);for(const u of l)this._tokenTypeMatchers.push({matcher:u.matcher,type:r[c]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const t of this._ruleId2desc)t&&t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){const t={lookup:r=>r===this._rootScopeName?this._grammar:this.getExternalGrammar(r),injections:r=>this._grammarRepository.injections(r)},e=[],n=this._rootScopeName,s=t.lookup(n);if(s){const r=s.injections;if(r)for(let o in r)He(e,o,r[o],this,s);const i=this._grammarRepository.injections(n);i&&i.forEach(o=>{const a=this.getExternalGrammar(o);if(a){const c=a.injectionSelector;c&&He(e,c,a,this,a)}})}return e.sort((r,i)=>r.priority-i.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(t){const e=++this._lastRuleId,n=t(e);return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=Ue(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const s=this._tokenize(t,e,!1,n);return{tokens:s.lineTokens.getResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}tokenizeLine2(t,e,n=0){const s=this._tokenize(t,e,!0,n);return{tokens:s.lineTokens.getBinaryResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}_tokenize(t,e,n,s){this._rootId===-1&&(this._rootId=gt.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let r;if(!e||e===Ne.NULL){r=!0;const l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),h=$.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),f=this.getRule(this._rootId).getName(null,null);let d;f?d=j.createRootAndLookUpScopeName(f,h,this):d=j.createRoot("unknown",h),e=new Ne(null,this._rootId,-1,-1,!1,null,d,d)}else r=!1,e.reset();t=t+`
|
|
3
3
|
`;const i=this.createOnigString(t),o=i.content.length,a=new vn(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),c=pt(this,i,r,0,e,a,!0,s);return ht(i),{lineLength:o,lineTokens:a,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Ue(t,e){return t=qt(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var j=class T{constructor(e,n,s){this.parent=e,this.scopePath=n,this.tokenAttributes=s}static fromExtension(e,n){let s=e,r=e?.scopePath??null;for(const i of n)r=ge.push(r,i.scopeNames),s=new T(s,r,i.encodedTokenAttributes);return s}static createRoot(e,n){return new T(null,new ge(null,e),n)}static createRootAndLookUpScopeName(e,n,s){const r=s.getMetadataForScope(e),i=new ge(null,e),o=s.themeProvider.themeMatch(i),a=T.mergeAttributes(n,r,o);return new T(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return T.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,s){let r=-1,i=0,o=0;return s!==null&&(r=s.fontStyle,i=s.foregroundId,o=s.backgroundId),$.set(e,n.languageId,n.tokenType,null,r,i,o)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return T._pushAttributed(this,e,n);const s=e.split(/ /g);let r=this;for(const i of s)r=T._pushAttributed(r,i,n);return r}static _pushAttributed(e,n,s){const r=s.getMetadataForScope(n),i=e.scopePath.push(n),o=s.themeProvider.themeMatch(i),a=T.mergeAttributes(e.tokenAttributes,r,o);return new T(e,i,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const n=[];let s=this;for(;s&&s!==e;)n.push({encodedTokenAttributes:s.tokenAttributes,scopeNames:s.scopePath.getExtensionIfDefined(s.parent?.scopePath??null)}),s=s.parent;return s===e?n.reverse():void 0}},Ne=class E{constructor(e,n,s,r,i,o,a,c){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=a,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=s,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new E(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:E._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?j.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){E._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,s,r,i,o,a){return new E(this,e,n,s,r,i,o,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,n){return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new E(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(e,n){const s=j.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new E(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,j.fromExtension(s,n.contentNameScopesList))}},An=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Q(n,ee).map(s=>s.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>Q(n,ee).map(s=>s.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(const e of this.unbalancedBracketScopes)if(e(t))return!1;for(const e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},vn=class{constructor(t,e,n,s){this.balancedBracketSelectors=s,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let s=t?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const i=t?.getScopeNames()??[];for(const o of this._tokenTypeOverrides)o.matcher(i)&&(s=$.set(s,0,o.type,null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(i))}if(r&&(s=$.set(s,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===s){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(s),this._lastTokenEndIndex=e;return}const n=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let s=0,r=this._binaryTokens.length;s<r;s++)n[s]=this._binaryTokens[s];return n}},Tn=class{constructor(t,e){this._onigLib=e,this._theme=t}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){this._rawGrammars.set(t.scopeName,t),e&&this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,n,s,r){if(!this._grammars.has(t)){let i=this._rawGrammars.get(t);if(!i)return null;this._grammars.set(t,Rn(t,i,e,n,s,r,this,this._onigLib))}return this._grammars.get(t)}},In=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Tn(V.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,n){this._syncRegistry.setTheme(V.createFromRawTheme(e,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,n,s){return this.loadGrammarWithConfiguration(e,n,{embeddedLanguages:s})}loadGrammarWithConfiguration(e,n,s){return this._loadGrammar(e,n,s.embeddedLanguages,s.tokenTypes,new An(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,n,s,r,i){const o=new sn(this._syncRegistry,e);for(;o.Q.length>0;)o.Q.map(a=>this._loadSingleGrammar(a.scopeName)),o.processQueue();return this._grammarForScopeName(e,n,s,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const n=this._options.loadGrammar(e);if(n){const s=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,s)}}addGrammar(e,n=[],s=0,r=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,s,r)}_grammarForScopeName(e,n=0,s=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,n,s,r,i)}},ke=Ne.NULL;function te(t,e){const n=typeof t=="string"?{}:{...t.colorReplacements},s=typeof t=="string"?t:t.name;for(const[r,i]of Object.entries(e?.colorReplacements||{}))typeof i=="string"?n[r]=i:r===s&&Object.assign(n,i);return n}function L(t,e){return t&&(e?.[t?.toLowerCase()]||t)}function Ln(t){return Array.isArray(t)?t:[t]}async function yt(t){return Promise.resolve(typeof t=="function"?t():t).then(e=>e.default||e)}function oe(t){return!t||["plaintext","txt","text","plain"].includes(t)}function bt(t){return t==="ansi"||oe(t)}function ae(t){return t==="none"}function St(t){return ae(t)}function ce(t,e=!1){if(t.length===0)return[["",0]];const n=t.split(/(\r?\n)/g);let s=0;const r=[];for(let i=0;i<n.length;i+=2){const o=e?n[i]+(n[i+1]||""):n[i];r.push([o,s]),s+=n[i].length,s+=n[i+1]?.length||0}return r}const Ke={light:"#333333",dark:"#bbbbbb"},Ye={light:"#fffffe",dark:"#1e1e1e"},Je="__shiki_resolved";function xe(t){if(t?.[Je])return t;const e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:n,fg:s}=e;if(!n||!s){const a=e.settings?e.settings.find(c=>!c.name&&!c.scope):void 0;a?.settings?.foreground&&(s=a.settings.foreground),a?.settings?.background&&(n=a.settings.background),!s&&e?.colors?.["editor.foreground"]&&(s=e.colors["editor.foreground"]),!n&&e?.colors?.["editor.background"]&&(n=e.colors["editor.background"]),s||(s=e.type==="light"?Ke.light:Ke.dark),n||(n=e.type==="light"?Ye.light:Ye.dark),e.fg=s,e.bg=n}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let r=0;const i=new Map;function o(a){if(i.has(a))return i.get(a);r+=1;const c=`#${r.toString(16).padStart(8,"0").toLowerCase()}`;return e.colorReplacements?.[`#${c}`]?o(a):(i.set(a,c),c)}e.settings=e.settings.map(a=>{const c=a.settings?.foreground&&!a.settings.foreground.startsWith("#"),l=a.settings?.background&&!a.settings.background.startsWith("#");if(!c&&!l)return a;const u={...a,settings:{...a.settings}};if(c){const h=o(a.settings.foreground);e.colorReplacements[h]=a.settings.foreground,u.settings.foreground=h}if(l){const h=o(a.settings.background);e.colorReplacements[h]=a.settings.background,u.settings.background=h}return u});for(const a of Object.keys(e.colors||{}))if((a==="editor.foreground"||a==="editor.background"||a.startsWith("terminal.ansi"))&&!e.colors[a]?.startsWith("#")){const c=o(e.colors[a]);e.colorReplacements[c]=e.colors[a],e.colors[a]=c}return Object.defineProperty(e,Je,{enumerable:!1,writable:!1,value:!0}),e}async function Ct(t){return Array.from(new Set((await Promise.all(t.filter(e=>!bt(e)).map(async e=>await yt(e).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function wt(t){return(await Promise.all(t.map(async e=>St(e)?null:xe(await yt(e))))).filter(e=>!!e)}function Rt(t,e){if(!e)return t;if(e[t]){const n=new Set([t]);for(;e[t];){if(t=e[t],n.has(t))throw new S(`Circular alias \`${Array.from(n).join(" -> ")} -> ${t}\``);n.add(t)}}return t}var xn=class extends In{_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(t,e,n,s={}){super(t),this._resolver=t,this._themes=e,this._langs=n,this._alias=s,this._themes.map(r=>this.loadTheme(r)),this.loadLanguages(this._langs)}getTheme(t){return typeof t=="string"?this._resolvedThemes.get(t):this.loadTheme(t)}loadTheme(t){const e=xe(t);return e.name&&(this._resolvedThemes.set(e.name,e),this._loadedThemesCache=null),e}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(t){let e=this._textmateThemeCache.get(t);e||(e=V.createFromRawTheme(t),this._textmateThemeCache.set(t,e)),this._syncRegistry.setTheme(e)}getGrammar(t){return t=Rt(t,this._alias),this._resolvedGrammars.get(t)}loadLanguage(t){if(this.getGrammar(t.name))return;const e=new Set([...this._langMap.values()].filter(r=>r.embeddedLangsLazy?.includes(t.name)));this._resolver.addLanguage(t);const n={balancedBracketSelectors:t.balancedBracketSelectors||["*"],unbalancedBracketSelectors:t.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(t.scopeName,t);const s=this.loadGrammarWithConfiguration(t.scopeName,1,n);if(s.name=t.name,this._resolvedGrammars.set(t.name,s),t.aliases&&t.aliases.forEach(r=>{this._alias[r]=t.name}),this._loadedLanguagesCache=null,e.size)for(const r of e)this._resolvedGrammars.delete(r.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(r.scopeName),this._syncRegistry?._grammars?.delete(r.scopeName),this.loadLanguage(this._langMap.get(r.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(t){for(const s of t)this.resolveEmbeddedLanguages(s);const e=Array.from(this._langGraph.entries()),n=e.filter(([s,r])=>!r);if(n.length){const s=e.filter(([r,i])=>i?(i.embeddedLanguages||i.embeddedLangs)?.some(o=>n.map(([a])=>a).includes(o)):!1).filter(r=>!n.includes(r));throw new S(`Missing languages ${n.map(([r])=>`\`${r}\``).join(", ")}, required by ${s.map(([r])=>`\`${r}\``).join(", ")}`)}for(const[s,r]of e)this._resolver.addLanguage(r);for(const[s,r]of e)this.loadLanguage(r)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(t){this._langMap.set(t.name,t),this._langGraph.set(t.name,t);const e=t.embeddedLanguages??t.embeddedLangs;if(e)for(const n of e)this._langGraph.set(n,this._langMap.get(n))}},En=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(t,e){this._onigLib={createOnigScanner:n=>t.createScanner(n),createOnigString:n=>t.createString(n)},e.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(e=>{this._langs.set(e,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(e=>{this._injections.get(e)||this._injections.set(e,[]),this._injections.get(e).push(t.scopeName)})}getInjections(t){const e=t.split(".");let n=[];for(let s=1;s<=e.length;s++){const r=e.slice(0,s).join(".");n=[...n,...this._injections.get(r)||[]]}return n}};let B=0;function Pn(t){B+=1,t.warnings!==!1&&B>=10&&B%10===0&&console.warn(`[Shiki] ${B} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let e=!1;if(!t.engine)throw new S("`engine` option is required for synchronous mode");const n=(t.langs||[]).flat(1),s=(t.themes||[]).flat(1).map(xe),r=new xn(new En(t.engine,n),s,n,t.langAlias);let i;function o(m){return Rt(m,t.langAlias)}function a(m){_();const y=r.getGrammar(typeof m=="string"?m:m.name);if(!y)throw new S(`Language \`${m}\` not found, you may need to load it first`);return y}function c(m){if(m==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};_();const y=r.getTheme(m);if(!y)throw new S(`Theme \`${m}\` not found, you may need to load it first`);return y}function l(m){_();const y=c(m);return i!==m&&(r.setTheme(y),i=m),{theme:y,colorMap:r.getColorMap()}}function u(){return _(),r.getLoadedThemes()}function h(){return _(),r.getLoadedLanguages()}function f(...m){_(),r.loadLanguages(m.flat(1))}async function d(...m){return f(await Ct(m))}function g(...m){_();for(const y of m.flat(1))r.loadTheme(y)}async function b(...m){return _(),g(await wt(m))}function _(){if(e)throw new S("Shiki instance has been disposed")}function p(){e||(e=!0,r.dispose(),B-=1)}return{setTheme:l,getTheme:c,getLanguage:a,getLoadedThemes:u,getLoadedLanguages:h,resolveLangAlias:o,loadLanguage:d,loadLanguageSync:f,loadTheme:b,loadThemeSync:g,dispose:p,[Symbol.dispose]:p}}async function Gn(t){t.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[e,n,s]=await Promise.all([wt(t.themes||[]),Ct(t.langs||[]),t.engine]);return Pn({...t,themes:e,langs:n,engine:s})}const Nt=new WeakMap;function le(t,e){Nt.set(t,e)}function q(t){return Nt.get(t)}var ue=class kt{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,n){return new kt(Object.fromEntries(Ln(n).map(s=>[s,ke])),e)}constructor(...e){if(e.length===2){const[n,s]=e;this.lang=s,this._stacks=n}else{const[n,s,r]=e;this.lang=s,this._stacks={[r]:n}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return On(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function On(t){const e=[],n=new Set;function s(r){if(n.has(r))return;n.add(r);const i=r?.nameScopesList?.scopeName;i&&e.push(i),r.parent&&s(r.parent)}return s(t),e}function $n(t,e){if(!(t instanceof ue))throw new S("Invalid grammar state");return t.getInternalStack(e)}function At(t,e,n={}){const{theme:s=t.getLoadedThemes()[0]}=n;if(oe(t.resolveLangAlias(n.lang||"text"))||ae(s))return ce(e).map(a=>[{content:a[0],offset:a[1]}]);const{theme:r,colorMap:i}=t.setTheme(s),o=t.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==o.name)throw new S(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(r.name))throw new S(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${r.name}"`)}return Mn(e,o,r,i,n)}function Bn(...t){if(t.length===2)return q(t[1]);const[e,n,s={}]=t,{lang:r="text",theme:i=e.getLoadedThemes()[0]}=s;if(oe(r)||ae(i))throw new S("Plain language does not have grammar state");if(r==="ansi")throw new S("ANSI language does not have grammar state");const{theme:o,colorMap:a}=e.setTheme(i),c=e.getLanguage(r);return new ue(Ee(n,c,o,a,s).stateStack,c.name,o.name)}function Mn(t,e,n,s,r){const i=Ee(t,e,n,s,r),o=new ue(i.stateStack,e.name,n.name);return le(i.tokens,o),i.tokens}function Ee(t,e,n,s,r){const i=te(n,r),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500}=r,c=ce(t);let l=r.grammarState?$n(r.grammarState,n.name)??ke:r.grammarContextCode!=null?Ee(r.grammarContextCode,e,n,s,{...r,grammarState:void 0,grammarContextCode:void 0}).stateStack:ke,u=[];const h=[];for(let f=0,d=c.length;f<d;f++){const[g,b]=c[f];if(g===""){u=[],h.push([]);continue}if(o>0&&g.length>=o){u=[],h.push([{content:g,offset:b,color:"",fontStyle:0}]);continue}let _,p,m;r.includeExplanation&&(_=e.tokenizeLine(g,l,a),p=_.tokens,m=0);const y=e.tokenizeLine2(g,l,a),R=y.tokens.length/2;for(let C=0;C<R;C++){const v=y.tokens[2*C],x=C+1<R?y.tokens[2*C+2]:g.length;if(v===x)continue;const Oe=y.tokens[2*C+1],Ot=L(s[$.getForeground(Oe)],i),$t=$.getFontStyle(Oe),he={content:g.substring(v,x),offset:b+v,color:Ot,fontStyle:$t};if(r.includeExplanation){const $e=[];if(r.includeExplanation!=="scopeName")for(const I of n.settings){let G;switch(typeof I.scope){case"string":G=I.scope.split(/,/).map(fe=>fe.trim());break;case"object":G=I.scope;break;default:continue}$e.push({settings:I,selectors:G.map(fe=>fe.split(/ /))})}he.explanation=[];let Be=0;for(;v+Be<x;){const I=p[m],G=g.substring(I.startIndex,I.endIndex);Be+=G.length,he.explanation.push({content:G,scopes:r.includeExplanation==="scopeName"?jn(I.scopes):Dn($e,I.scopes)}),m+=1}}u.push(he)}h.push(u),u=[],l=y.ruleStack}return{tokens:h,stateStack:l}}function jn(t){return t.map(e=>({scopeName:e}))}function Dn(t,e){const n=[];for(let s=0,r=e.length;s<r;s++){const i=e[s];n[s]={scopeName:i,themeMatches:Fn(t,i,e.slice(0,s))}}return n}function Ve(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function Wn(t,e,n){if(!Ve(t[t.length-1],e))return!1;let s=t.length-2,r=n.length-1;for(;s>=0&&r>=0;)Ve(t[s],n[r])&&(s-=1),r-=1;return s===-1}function Fn(t,e,n){const s=[];for(const{selectors:r,settings:i}of t)for(const o of r)if(Wn(o,e,n)){s.push(i);break}return s}function vt(t,e,n,s=At){const r=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),i=r.map(l=>{const u=s(t,e,{...n,theme:l.theme});return{tokens:u,state:q(u),theme:typeof l.theme=="string"?l.theme:l.theme.name}}),o=qn(...i.map(l=>l.tokens)),a=o[0].map((l,u)=>l.map((h,f)=>{const d={content:h.content,variants:{},offset:h.offset};return"includeExplanation"in n&&n.includeExplanation&&(d.explanation=h.explanation),o.forEach((g,b)=>{const{content:_,explanation:p,offset:m,...y}=g[u][f];d.variants[r[b].color]=y}),d})),c=i[0].state?new ue(Object.fromEntries(i.map(l=>[l.theme,l.state?.getInternalStack(l.theme)])),i[0].state.lang):void 0;return c&&le(a,c),a}function qn(...t){const e=t.map(()=>[]),n=t.length;for(let s=0;s<t[0].length;s++){const r=t.map(c=>c[s]),i=e.map(()=>[]);e.forEach((c,l)=>c.push(i[l]));const o=r.map(()=>0),a=r.map(c=>c[0]);for(;a.every(c=>c);){const c=Math.min(...a.map(l=>l.content.length));for(let l=0;l<n;l++){const u=a[l];u.content.length===c?(i[l].push(u),o[l]+=1,a[l]=r[l][o[l]]):(i[l].push({...u,content:u.content.slice(0,c)}),a[l]={...u,content:u.content.slice(c),offset:u.offset+c})}}}return e}const zn=/["&'<>`]/g,Hn=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Un=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Kn=/[|\\{}()[\]^$+*?.]/g,Qe=new WeakMap;function Yn(t,e){if(t=t.replace(e.subset?Jn(e.subset):zn,s),e.subset||e.escapeOnly)return t;return t.replace(Hn,n).replace(Un,s);function n(r,i,o){return e.format((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),e)}function s(r,i,o){return e.format(r.charCodeAt(0),o.charCodeAt(i+1),e)}}function Jn(t){let e=Qe.get(t);return e||(e=Vn(t),Qe.set(t,e)),e}function Vn(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(Kn,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const Qn=/[\dA-Fa-f]/;function Xn(t,e,n){const s="&#x"+t.toString(16).toUpperCase();return n&&e&&!Qn.test(String.fromCharCode(e))?s:s+";"}const Zn=/\d/;function es(t,e,n){const s="&#"+String(t);return n&&e&&!Zn.test(String.fromCharCode(e))?s:s+";"}const ts=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],pe={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},ns=["cent","copy","divide","gt","lt","not","para","times"],Tt={}.hasOwnProperty,Ae={};let U;for(U in pe)Tt.call(pe,U)&&(Ae[pe[U]]=U);const ss=/[^\dA-Za-z]/;function rs(t,e,n,s){const r=String.fromCharCode(t);if(Tt.call(Ae,r)){const i=Ae[r],o="&"+i;return n&&ts.includes(i)&&!ns.includes(i)&&(!s||e&&e!==61&&ss.test(String.fromCharCode(e)))?o:o+";"}return""}function is(t,e,n){let s=Xn(t,e,n.omitOptionalSemicolons),r;if((n.useNamedReferences||n.useShortestReferences)&&(r=rs(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const i=es(t,e,n.omitOptionalSemicolons);i.length<s.length&&(s=i)}return r&&(!n.useShortestReferences||r.length<s.length)?r:s}function O(t,e){return Yn(t,Object.assign({format:is},e))}const os=/^>|^->|<!--|-->|--!>|<!-$/g,as=[">"],cs=["<",">"];function ls(t,e,n,s){return s.settings.bogusComments?"<?"+O(t.value,Object.assign({},s.settings.characterReferences,{subset:as}))+">":"<!--"+t.value.replace(os,r)+"-->";function r(i){return O(i,Object.assign({},s.settings.characterReferences,{subset:cs}))}}function us(t,e,n,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"}const w=Lt(1),It=Lt(-1),hs=[];function Lt(t){return e;function e(n,s,r){const i=n?n.children:hs;let o=(s||0)+t,a=i[o];if(!r)for(;a&&Ie(a);)o+=t,a=i[o];return a}}const fs={}.hasOwnProperty;function xt(t){return e;function e(n,s,r){return fs.call(t,n.tagName)&&t[n.tagName](n,s,r)}}const Pe=xt({body:gs,caption:_e,colgroup:_e,dd:ys,dt:_s,head:_e,html:ds,li:ps,optgroup:bs,option:Ss,p:ms,rp:Xe,rt:Xe,tbody:ws,td:Ze,tfoot:Rs,th:Ze,thead:Cs,tr:Ns});function _e(t,e,n){const s=w(n,e,!0);return!s||s.type!=="comment"&&!(s.type==="text"&&Ie(s.value.charAt(0)))}function ds(t,e,n){const s=w(n,e);return!s||s.type!=="comment"}function gs(t,e,n){const s=w(n,e);return!s||s.type!=="comment"}function ms(t,e,n){const s=w(n,e);return s?s.type==="element"&&(s.tagName==="address"||s.tagName==="article"||s.tagName==="aside"||s.tagName==="blockquote"||s.tagName==="details"||s.tagName==="div"||s.tagName==="dl"||s.tagName==="fieldset"||s.tagName==="figcaption"||s.tagName==="figure"||s.tagName==="footer"||s.tagName==="form"||s.tagName==="h1"||s.tagName==="h2"||s.tagName==="h3"||s.tagName==="h4"||s.tagName==="h5"||s.tagName==="h6"||s.tagName==="header"||s.tagName==="hgroup"||s.tagName==="hr"||s.tagName==="main"||s.tagName==="menu"||s.tagName==="nav"||s.tagName==="ol"||s.tagName==="p"||s.tagName==="pre"||s.tagName==="section"||s.tagName==="table"||s.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function ps(t,e,n){const s=w(n,e);return!s||s.type==="element"&&s.tagName==="li"}function _s(t,e,n){const s=w(n,e);return!!(s&&s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd"))}function ys(t,e,n){const s=w(n,e);return!s||s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd")}function Xe(t,e,n){const s=w(n,e);return!s||s.type==="element"&&(s.tagName==="rp"||s.tagName==="rt")}function bs(t,e,n){const s=w(n,e);return!s||s.type==="element"&&s.tagName==="optgroup"}function Ss(t,e,n){const s=w(n,e);return!s||s.type==="element"&&(s.tagName==="option"||s.tagName==="optgroup")}function Cs(t,e,n){const s=w(n,e);return!!(s&&s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot"))}function ws(t,e,n){const s=w(n,e);return!s||s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot")}function Rs(t,e,n){return!w(n,e)}function Ns(t,e,n){const s=w(n,e);return!s||s.type==="element"&&s.tagName==="tr"}function Ze(t,e,n){const s=w(n,e);return!s||s.type==="element"&&(s.tagName==="td"||s.tagName==="th")}const ks=xt({body:Ts,colgroup:Is,head:vs,html:As,tbody:Ls});function As(t){const e=w(t,-1);return!e||e.type!=="comment"}function vs(t){const e=new Set;for(const s of t.children)if(s.type==="element"&&(s.tagName==="base"||s.tagName==="title")){if(e.has(s.tagName))return!1;e.add(s.tagName)}const n=t.children[0];return!n||n.type==="element"}function Ts(t){const e=w(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&Ie(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function Is(t,e,n){const s=It(n,e),r=w(t,-1,!0);return n&&s&&s.type==="element"&&s.tagName==="colgroup"&&Pe(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function Ls(t,e,n){const s=It(n,e),r=w(t,-1);return n&&s&&s.type==="element"&&(s.tagName==="thead"||s.tagName==="tbody")&&Pe(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}const K={name:[[`
|
|
4
4
|
\f\r &/=>`.split(""),`
|
|
@@ -8,5 +8,5 @@ import{h as Bt}from"./index-CkdplsNl.js";import{J as Ie,s as nt,f as Mt,c as jt,
|
|
|
8
8
|
\f\r &>`.split(""),`\0
|
|
9
9
|
\f\r "&'<=>\``.split("")],[`\0
|
|
10
10
|
\f\r "&'<=>\``.split(""),`\0
|
|
11
|
-
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function xs(t,e,n,s){const r=s.schema,i=r.space==="svg"?!1:s.settings.omitOptionalTags;let o=r.space==="svg"?s.settings.closeEmptyElements:s.settings.voids.includes(t.tagName.toLowerCase());const a=[];let c;r.space==="html"&&t.tagName==="svg"&&(s.schema=nt);const l=Es(s,t.properties),u=s.all(r.space==="html"&&t.tagName==="template"?t.content:t);return s.schema=r,u&&(o=!1),(l||!i||!ks(t,e,n))&&(a.push("<",t.tagName,l?" "+l:""),o&&(r.space==="svg"||s.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!s.settings.tightSelfClosing||c==="/"||c&&c!=='"'&&c!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!o&&(!i||!Pe(t,e,n))&&a.push("</"+t.tagName+">"),a.join("")}function Es(t,e){const n=[];let s=-1,r;if(e){for(r in e)if(e[r]!==null&&e[r]!==void 0){const i=Ps(t,r,e[r]);i&&n.push(i)}}for(;++s<n.length;){const i=t.settings.tightAttributes?n[s].charAt(n[s].length-1):void 0;s!==n.length-1&&i!=='"'&&i!=="'"&&(n[s]+=" ")}return n.join("")}function Ps(t,e,n){const s=Mt(t.schema,e),r=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,i=t.settings.allowDangerousCharacters?0:1;let o=t.quote,a;if(s.overloadedBoolean&&(n===s.attribute||n==="")?n=!0:(s.boolean||s.overloadedBoolean)&&(typeof n!="string"||n===s.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const c=O(s.attribute,Object.assign({},t.settings.characterReferences,{subset:K.name[r][i]}));return n===!0||(n=Array.isArray(n)?(s.commaSeparated?jt:Dt)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?c:(t.settings.preferUnquoted&&(a=O(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:K.unquoted[r][i]}))),a!==n&&(t.settings.quoteSmart&&Me(n,o)>Me(n,t.alternative)&&(o=t.alternative),a=o+O(n,Object.assign({},t.settings.characterReferences,{subset:(o==="'"?K.single:K.double)[r][i],attribute:!0}))+o),c+(a&&"="+a))}const Gs=["<","&"];function Et(t,e,n,s){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:O(t.value,Object.assign({},s.settings.characterReferences,{subset:Gs}))}function Os(t,e,n,s){return s.settings.allowDangerousHtml?t.value:Et(t,e,n,s)}function $s(t,e,n,s){return s.all(t)}const Bs=Wt("type",{invalid:Ms,unknown:js,handlers:{comment:ls,doctype:us,element:xs,raw:Os,root:$s,text:Et}});function Ms(t){throw new Error("Expected node, not `"+t+"`")}function js(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const Ds={},Ws={},Fs=[];function qs(t,e){const n=e||Ds,s=n.quote||'"',r=s==='"'?"'":'"';if(s!=='"'&&s!=="'")throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:zs,all:Hs,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Bt,characterReferences:n.characterReferences||Ws,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?nt:Ft,quote:s,alternative:r}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function zs(t,e,n){return Bs(t,e,n,this)}function Hs(t){const e=[],n=t&&t.children||Fs;let s=-1;for(;++s<n.length;)e[s]=this.one(n[s],s,t);return e.join("")}function Pt(t,e){if(!e)return t;t.properties||={},t.properties.class||=[],typeof t.properties.class=="string"&&(t.properties.class=t.properties.class.split(/\s+/g)),Array.isArray(t.properties.class)||(t.properties.class=[]);const n=Array.isArray(e)?e:e.split(/\s+/g);for(const s of n)s&&!t.properties.class.includes(s)&&t.properties.class.push(s);return t}function Us(t){const e=ce(t,!0).map(([r])=>r);function n(r){if(r===t.length)return{line:e.length-1,character:e[e.length-1].length};let i=r,o=0;for(const a of e){if(i<a.length)break;i-=a.length,o++}return{line:o,character:i}}function s(r,i){let o=0;for(let a=0;a<r;a++)o+=e[a].length;return o+=i,o}return{lines:e,indexToPos:n,posToIndex:s}}function Er(t,e,n){const s=new Set;for(const i of t.matchAll(/:?lang=["']([^"']+)["']/g)){const o=i[1].toLowerCase().trim();o&&s.add(o)}for(const i of t.matchAll(/(?:```|~~~)([\w-]+)/g)){const o=i[1].toLowerCase().trim();o&&s.add(o)}for(const i of t.matchAll(/\\begin\{([\w-]+)\}/g)){const o=i[1].toLowerCase().trim();o&&s.add(o)}for(const i of t.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)){const o=i[1].toLowerCase().trim(),a=o.includes("/")?o.split("/").pop():o;a&&s.add(a)}if(!n)return Array.from(s);const r=n.getBundledLanguages();return Array.from(s).filter(i=>i&&r[i])}const Ge="light-dark()",Ks=["color","background-color"];function Ys(t,e){let n=0;const s=[];for(const r of e)r>n&&s.push({...t,content:t.content.slice(n,r),offset:t.offset+n}),n=r;return n<t.content.length&&s.push({...t,content:t.content.slice(n),offset:t.offset+n}),s}function Js(t,e){const n=Array.from(e instanceof Set?e:new Set(e)).sort((s,r)=>s-r);return n.length?t.map(s=>s.flatMap(r=>{const i=n.filter(o=>r.offset<o&&o<r.offset+r.content.length).map(o=>o-r.offset).sort((o,a)=>o-a);return i.length?Ys(r,i):r})):t}function Vs(t,e,n,s,r="css-vars"){const i={content:t.content,explanation:t.explanation,offset:t.offset},o=e.map(u=>ne(t.variants[u])),a=new Set(o.flatMap(u=>Object.keys(u))),c={},l=(u,h)=>{const f=h==="color"?"":h==="background-color"?"-bg":`-${h}`;return n+e[u]+(h==="color"?"":f)};return o.forEach((u,h)=>{for(const f of a){const d=u[f]||"inherit";if(h===0&&s&&Ks.includes(f))if(s===Ge&&o.length>1){const g=e.findIndex(_=>_==="light"),b=e.findIndex(_=>_==="dark");if(g===-1||b===-1)throw new S('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');c[f]=`light-dark(${o[g][f]||"inherit"}, ${o[b][f]||"inherit"})`,r==="css-vars"&&(c[l(h,f)]=d)}else c[f]=d;else r==="css-vars"&&(c[l(h,f)]=d)}}),i.htmlStyle=c,i}function ne(t){const e={};if(t.color&&(e.color=t.color),t.bgColor&&(e["background-color"]=t.bgColor),t.fontStyle){t.fontStyle&k.Italic&&(e["font-style"]="italic"),t.fontStyle&k.Bold&&(e["font-weight"]="bold");const n=[];t.fontStyle&k.Underline&&n.push("underline"),t.fontStyle&k.Strikethrough&&n.push("line-through"),n.length&&(e["text-decoration"]=n.join(" "))}return e}function ve(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}function Qs(){const t=new WeakMap;function e(n){if(!t.has(n.meta)){let r=function(o){if(typeof o=="number"){if(o<0||o>n.source.length)throw new S(`Invalid decoration offset: ${o}. Code length: ${n.source.length}`);return{...s.indexToPos(o),offset:o}}else{const a=s.lines[o.line];if(a===void 0)throw new S(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${s.lines.length}`);let c=o.character;if(c<0&&(c=a.length+c),c<0||c>a.length)throw new S(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);return{...o,character:c,offset:s.posToIndex(o.line,c)}}};const s=Us(n.source),i=(n.options.decorations||[]).map(o=>({...o,start:r(o.start),end:r(o.end)}));Xs(i),t.set(n.meta,{decorations:i,converter:s,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(this.options.decorations?.length)return Js(n,e(this).decorations.flatMap(s=>[s.start.offset,s.end.offset]))},code(n){if(!this.options.decorations?.length)return;const s=e(this),r=Array.from(n.children).filter(u=>u.type==="element"&&u.tagName==="span");if(r.length!==s.converter.lines.length)throw new S(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${s.converter.lines.length}). Failed to apply decorations.`);function i(u,h,f,d){const g=r[u];let b="",_=-1,p=-1;if(h===0&&(_=0),f===0&&(p=0),f===Number.POSITIVE_INFINITY&&(p=g.children.length),_===-1||p===-1)for(let y=0;y<g.children.length;y++)b+=Gt(g.children[y]),_===-1&&b.length===h&&(_=y+1),p===-1&&b.length===f&&(p=y+1);if(_===-1)throw new S(`Failed to find start index for decoration ${JSON.stringify(d.start)}`);if(p===-1)throw new S(`Failed to find end index for decoration ${JSON.stringify(d.end)}`);const m=g.children.slice(_,p);if(!d.alwaysWrap&&m.length===g.children.length)a(g,d,"line");else if(!d.alwaysWrap&&m.length===1&&m[0].type==="element")a(m[0],d,"token");else{const y={type:"element",tagName:"span",properties:{},children:m};a(y,d,"wrapper"),g.children.splice(_,m.length,y)}}function o(u,h){r[u]=a(r[u],h,"line")}function a(u,h,f){const d=h.properties||{},g=h.transform||(b=>b);return u.tagName=h.tagName||"span",u.properties={...u.properties,...d,class:u.properties.class},h.properties?.class&&Pt(u,h.properties.class),u=g(u,f)||u,u}const c=[],l=s.decorations.sort((u,h)=>h.start.offset-u.start.offset||u.end.offset-h.end.offset);for(const u of l){const{start:h,end:f}=u;if(h.line===f.line)i(h.line,h.character,f.character,u);else if(h.line<f.line){i(h.line,h.character,Number.POSITIVE_INFINITY,u);for(let d=h.line+1;d<f.line;d++)c.unshift(()=>o(d,u));i(f.line,0,f.character,u)}}c.forEach(u=>u())}}}function Xs(t){for(let e=0;e<t.length;e++){const n=t[e];if(n.start.offset>n.end.offset)throw new S(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let s=e+1;s<t.length;s++){const r=t[s],i=n.start.offset<=r.start.offset&&r.start.offset<n.end.offset,o=n.start.offset<r.end.offset&&r.end.offset<=n.end.offset,a=r.start.offset<=n.start.offset&&n.start.offset<r.end.offset,c=r.start.offset<n.end.offset&&n.end.offset<=r.end.offset;if(i||o||a||c){if(i&&o||a&&c||a&&n.start.offset===n.end.offset||o&&r.start.offset===r.end.offset)continue;throw new S(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(r.start)} intersect.`)}}}}function Gt(t){return t.type==="text"?t.value:t.type==="element"?t.children.map(Gt).join(""):""}const Zs=[Qs()];function se(t){const e=er(t.transformers||[]);return[...e.pre,...e.normal,...e.post,...Zs]}function er(t){const e=[],n=[],s=[];for(const r of t)switch(r.enforce){case"pre":e.push(r);break;case"post":n.push(r);break;default:s.push(r)}return{pre:e,post:n,normal:s}}var P=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],ye={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function tr(t,e){const n=t.indexOf("\x1B",e);if(n!==-1&&t[n+1]==="["){const s=t.indexOf("m",n);if(s!==-1)return{sequence:t.substring(n+2,s).split(";"),startPosition:n,position:s+1}}return{position:t.length}}function et(t){const e=t.shift();if(e==="2"){const n=t.splice(0,3).map(s=>Number.parseInt(s));return n.length!==3||n.some(s=>Number.isNaN(s))?void 0:{type:"rgb",rgb:n}}else if(e==="5"){const n=t.shift();if(n)return{type:"table",index:Number(n)}}}function nr(t){const e=[];for(;t.length>0;){const n=t.shift();if(!n)continue;const s=Number.parseInt(n);if(!Number.isNaN(s))if(s===0)e.push({type:"resetAll"});else if(s<=9)ye[s]&&e.push({type:"setDecoration",value:ye[s]});else if(s<=29){const r=ye[s-20];r&&(e.push({type:"resetDecoration",value:r}),r==="dim"&&e.push({type:"resetDecoration",value:"bold"}))}else if(s<=37)e.push({type:"setForegroundColor",value:{type:"named",name:P[s-30]}});else if(s===38){const r=et(t);r&&e.push({type:"setForegroundColor",value:r})}else if(s===39)e.push({type:"resetForegroundColor"});else if(s<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:P[s-40]}});else if(s===48){const r=et(t);r&&e.push({type:"setBackgroundColor",value:r})}else s===49?e.push({type:"resetBackgroundColor"}):s===53?e.push({type:"setDecoration",value:"overline"}):s===55?e.push({type:"resetDecoration",value:"overline"}):s>=90&&s<=97?e.push({type:"setForegroundColor",value:{type:"named",name:P[s-90+8]}}):s>=100&&s<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:P[s-100+8]}})}return e}function sr(){let t=null,e=null,n=new Set;return{parse(s){const r=[];let i=0;do{const o=tr(s,i),a=o.sequence?s.substring(i,o.startPosition):s.substring(i);if(a.length>0&&r.push({value:a,foreground:t,background:e,decorations:new Set(n)}),o.sequence){const c=nr(o.sequence);for(const l of c)l.type==="resetAll"?(t=null,e=null,n.clear()):l.type==="resetForegroundColor"?t=null:l.type==="resetBackgroundColor"?e=null:l.type==="resetDecoration"&&n.delete(l.value);for(const l of c)l.type==="setForegroundColor"?t=l.value:l.type==="setBackgroundColor"?e=l.value:l.type==="setDecoration"&&n.add(l.value)}i=o.position}while(i<s.length);return r}}}var rr={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function ir(t=rr){function e(a){return t[a]}function n(a){return`#${a.map(c=>Math.max(0,Math.min(c,255)).toString(16).padStart(2,"0")).join("")}`}let s;function r(){if(s)return s;s=[];for(let l=0;l<P.length;l++)s.push(e(P[l]));let a=[0,95,135,175,215,255];for(let l=0;l<6;l++)for(let u=0;u<6;u++)for(let h=0;h<6;h++)s.push(n([a[l],a[u],a[h]]));let c=8;for(let l=0;l<24;l++,c+=10)s.push(n([c,c,c]));return s}function i(a){return r()[a]}function o(a){switch(a.type){case"named":return e(a.name);case"rgb":return n(a.rgb);case"table":return i(a.index)}}return{value:o}}const or={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function ar(t,e,n){const s=te(t,n),r=ce(e),i=ir(Object.fromEntries(P.map(a=>{const c=`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`;return[a,t.colors?.[c]||or[a]]}))),o=sr();return r.map(a=>o.parse(a[0]).map(c=>{let l,u;c.decorations.has("reverse")?(l=c.background?i.value(c.background):t.bg,u=c.foreground?i.value(c.foreground):t.fg):(l=c.foreground?i.value(c.foreground):t.fg,u=c.background?i.value(c.background):void 0),l=L(l,s),u=L(u,s),c.decorations.has("dim")&&(l=cr(l));let h=k.None;return c.decorations.has("bold")&&(h|=k.Bold),c.decorations.has("italic")&&(h|=k.Italic),c.decorations.has("underline")&&(h|=k.Underline),c.decorations.has("strikethrough")&&(h|=k.Strikethrough),{content:c.value,offset:a[1],color:l,bgColor:u,fontStyle:h}}))}function cr(t){const e=t.match(/#([0-9a-f]{3,8})/i);if(e){const s=e[1];if(s.length===8){const r=Math.round(Number.parseInt(s.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${s.slice(0,6)}${r}`}else{if(s.length===6)return`#${s}80`;if(s.length===4){const r=s[0],i=s[1],o=s[2],a=s[3];return`#${r}${r}${i}${i}${o}${o}${Math.round(Number.parseInt(`${a}${a}`,16)/2).toString(16).padStart(2,"0")}`}else if(s.length===3){const r=s[0],i=s[1],o=s[2];return`#${r}${r}${i}${i}${o}${o}80`}}}const n=t.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:t}function Te(t,e,n={}){const s=t.resolveLangAlias(n.lang||"text"),{theme:r=t.getLoadedThemes()[0]}=n;if(!oe(s)&&!ae(r)&&s==="ansi"){const{theme:i}=t.setTheme(r);return ar(i,e,n)}return At(t,e,n)}function re(t,e,n){let s,r,i,o,a,c;if("themes"in n){const{defaultColor:l="light",cssVariablePrefix:u="--shiki-",colorsRendering:h="css-vars"}=n,f=Object.entries(n.themes).filter(p=>p[1]).map(p=>({color:p[0],theme:p[1]})).sort((p,m)=>p.color===l?-1:m.color===l?1:0);if(f.length===0)throw new S("`themes` option must not be empty");const d=vt(t,e,n,Te);if(c=q(d),l&&Ge!==l&&!f.find(p=>p.color===l))throw new S(`\`themes\` option must contain the defaultColor key \`${l}\``);const g=f.map(p=>t.getTheme(p.theme)),b=f.map(p=>p.color);i=d.map(p=>p.map(m=>Vs(m,b,u,l,h))),c&&le(i,c);const _=f.map(p=>te(p.theme,n));r=tt(f,g,_,u,l,"fg",h),s=tt(f,g,_,u,l,"bg",h),o=`shiki-themes ${g.map(p=>p.name).join(" ")}`,a=l?void 0:[r,s].join(";")}else if("theme"in n){const l=te(n.theme,n);i=Te(t,e,n);const u=t.getTheme(n.theme);s=L(u.bg,l),r=L(u.fg,l),o=u.name,c=q(i)}else throw new S("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:r,bg:s,themeName:o,rootStyle:a,grammarState:c}}function tt(t,e,n,s,r,i,o){return t.map((a,c)=>{const l=L(e[c][i],n[c])||"inherit",u=`${s+a.color}${i==="bg"?"-bg":""}:${l}`;if(c===0&&r){if(r===Ge&&t.length>1){const h=t.findIndex(d=>d.color==="light"),f=t.findIndex(d=>d.color==="dark");if(h===-1||f===-1)throw new S('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${L(e[h][i],n[h])||"inherit"}, ${L(e[f][i],n[f])||"inherit"});${u}`}return l}return o==="css-vars"?u:null}).filter(a=>!!a).join(";")}function ie(t,e,n,s={meta:{},options:n,codeToHast:(r,i)=>ie(t,r,i),codeToTokens:(r,i)=>re(t,r,i)}){let r=e;for(const g of se(n))r=g.preprocess?.call(s,r,n)||r;let{tokens:i,fg:o,bg:a,themeName:c,rootStyle:l,grammarState:u}=re(t,r,n);const{mergeWhitespaces:h=!0,mergeSameStyleTokens:f=!1}=n;h===!0?i=ur(i):h==="never"&&(i=hr(i)),f&&(i=fr(i));const d={...s,get source(){return r}};for(const g of se(n))i=g.tokens?.call(d,i)||i;return lr(i,{...n,fg:o,bg:a,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},d,u)}function lr(t,e,n,s=q(t)){const r=se(e),i=[],o={type:"root",children:[]},{structure:a="classic",tabindex:c="0"}=e,l={class:`shiki ${e.themeName||""}`};e.rootStyle!==!1&&(e.rootStyle!=null?l.style=e.rootStyle:l.style=`background-color:${e.bg};color:${e.fg}`),c!==!1&&c!=null&&(l.tabindex=c.toString());for(const[b,_]of Object.entries(e.meta||{}))b.startsWith("_")||(l[b]=_);let u={type:"element",tagName:"pre",properties:l,children:[],data:e.data},h={type:"element",tagName:"code",properties:{},children:i};const f=[],d={...n,structure:a,addClassToHast:Pt,get source(){return n.source},get tokens(){return t},get options(){return e},get root(){return o},get pre(){return u},get code(){return h},get lines(){return f}};if(t.forEach((b,_)=>{_&&(a==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&i.push({type:"text",value:`
|
|
12
|
-
`}));let p={type:"element",tagName:"span",properties:{class:"line"},children:[]},m=0;for(const y of b){let R={type:"element",tagName:"span",properties:{...y.htmlAttrs},children:[{type:"text",value:y.content}]};const C=ve(y.htmlStyle||ne(y));C&&(R.properties.style=C);for(const v of r)R=v?.span?.call(d,R,_+1,m,p,y)||R;a==="inline"?o.children.push(R):a==="classic"&&p.children.push(R),m+=y.content.length}if(a==="classic"){for(const y of r)p=y?.line?.call(d,p,_+1)||p;f.push(p),i.push(p)}else a==="inline"&&f.push(p)}),a==="classic"){for(const b of r)h=b?.code?.call(d,h)||h;u.children.push(h);for(const b of r)u=b?.pre?.call(d,u)||u;o.children.push(u)}else if(a==="inline"){const b=[];let _={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const m of o.children)m.type==="element"&&m.tagName==="br"?(b.push(_),_={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(m.type==="element"||m.type==="text")&&_.children.push(m);b.push(_);let p={type:"element",tagName:"code",properties:{},children:b};for(const m of r)p=m?.code?.call(d,p)||p;o.children=[];for(let m=0;m<p.children.length;m++){m>0&&o.children.push({type:"element",tagName:"br",properties:{},children:[]});const y=p.children[m];y.type==="element"&&o.children.push(...y.children)}}let g=o;for(const b of r)g=b?.root?.call(d,g)||g;return s&&le(g,s),g}function ur(t){return t.map(e=>{const n=[];let s="",r;return e.forEach((i,o)=>{const a=!(i.fontStyle&&(i.fontStyle&k.Underline||i.fontStyle&k.Strikethrough));a&&i.content.match(/^\s+$/)&&e[o+1]?(r===void 0&&(r=i.offset),s+=i.content):s?(a?n.push({...i,offset:r,content:s+i.content}):n.push({content:s,offset:r},i),r=void 0,s=""):n.push(i)}),n})}function hr(t){return t.map(e=>e.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const s=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!s)return n;const[,r,i,o]=s;if(!r&&!o)return n;const a=[{...n,offset:n.offset+r.length,content:i}];return r&&a.unshift({content:r,offset:n.offset}),o&&a.push({content:o,offset:n.offset+r.length+i.length}),a}))}function fr(t){return t.map(e=>{const n=[];for(const s of e){if(n.length===0){n.push({...s});continue}const r=n[n.length-1],i=ve(r.htmlStyle||ne(r)),o=ve(s.htmlStyle||ne(s)),a=r.fontStyle&&(r.fontStyle&k.Underline||r.fontStyle&k.Strikethrough),c=s.fontStyle&&(s.fontStyle&k.Underline||s.fontStyle&k.Strikethrough);!a&&!c&&i===o?r.content+=s.content:n.push({...s})}return n})}const dr=qs;function gr(t,e,n){const s={meta:{},options:n,codeToHast:(i,o)=>ie(t,i,o),codeToTokens:(i,o)=>re(t,i,o)};let r=dr(ie(t,e,n,s));for(const i of se(n))r=i.postprocess?.call(s,r,n)||r;return r}async function mr(t){const e=await Gn(t);return{getLastGrammarState:(...n)=>Bn(e,...n),codeToTokensBase:(n,s)=>Te(e,n,s),codeToTokensWithThemes:(n,s)=>vt(e,n,s),codeToTokens:(n,s)=>re(e,n,s),codeToHast:(n,s)=>ie(e,n,s),codeToHtml:(n,s)=>gr(e,n,s),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...e,getInternalContext:()=>e}}function
|
|
11
|
+
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function xs(t,e,n,s){const r=s.schema,i=r.space==="svg"?!1:s.settings.omitOptionalTags;let o=r.space==="svg"?s.settings.closeEmptyElements:s.settings.voids.includes(t.tagName.toLowerCase());const a=[];let c;r.space==="html"&&t.tagName==="svg"&&(s.schema=nt);const l=Es(s,t.properties),u=s.all(r.space==="html"&&t.tagName==="template"?t.content:t);return s.schema=r,u&&(o=!1),(l||!i||!ks(t,e,n))&&(a.push("<",t.tagName,l?" "+l:""),o&&(r.space==="svg"||s.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!s.settings.tightSelfClosing||c==="/"||c&&c!=='"'&&c!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!o&&(!i||!Pe(t,e,n))&&a.push("</"+t.tagName+">"),a.join("")}function Es(t,e){const n=[];let s=-1,r;if(e){for(r in e)if(e[r]!==null&&e[r]!==void 0){const i=Ps(t,r,e[r]);i&&n.push(i)}}for(;++s<n.length;){const i=t.settings.tightAttributes?n[s].charAt(n[s].length-1):void 0;s!==n.length-1&&i!=='"'&&i!=="'"&&(n[s]+=" ")}return n.join("")}function Ps(t,e,n){const s=Mt(t.schema,e),r=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,i=t.settings.allowDangerousCharacters?0:1;let o=t.quote,a;if(s.overloadedBoolean&&(n===s.attribute||n==="")?n=!0:(s.boolean||s.overloadedBoolean)&&(typeof n!="string"||n===s.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const c=O(s.attribute,Object.assign({},t.settings.characterReferences,{subset:K.name[r][i]}));return n===!0||(n=Array.isArray(n)?(s.commaSeparated?jt:Dt)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?c:(t.settings.preferUnquoted&&(a=O(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:K.unquoted[r][i]}))),a!==n&&(t.settings.quoteSmart&&Me(n,o)>Me(n,t.alternative)&&(o=t.alternative),a=o+O(n,Object.assign({},t.settings.characterReferences,{subset:(o==="'"?K.single:K.double)[r][i],attribute:!0}))+o),c+(a&&"="+a))}const Gs=["<","&"];function Et(t,e,n,s){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:O(t.value,Object.assign({},s.settings.characterReferences,{subset:Gs}))}function Os(t,e,n,s){return s.settings.allowDangerousHtml?t.value:Et(t,e,n,s)}function $s(t,e,n,s){return s.all(t)}const Bs=Wt("type",{invalid:Ms,unknown:js,handlers:{comment:ls,doctype:us,element:xs,raw:Os,root:$s,text:Et}});function Ms(t){throw new Error("Expected node, not `"+t+"`")}function js(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const Ds={},Ws={},Fs=[];function qs(t,e){const n=e||Ds,s=n.quote||'"',r=s==='"'?"'":'"';if(s!=='"'&&s!=="'")throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:zs,all:Hs,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Bt,characterReferences:n.characterReferences||Ws,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?nt:Ft,quote:s,alternative:r}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function zs(t,e,n){return Bs(t,e,n,this)}function Hs(t){const e=[],n=t&&t.children||Fs;let s=-1;for(;++s<n.length;)e[s]=this.one(n[s],s,t);return e.join("")}function Pt(t,e){if(!e)return t;t.properties||={},t.properties.class||=[],typeof t.properties.class=="string"&&(t.properties.class=t.properties.class.split(/\s+/g)),Array.isArray(t.properties.class)||(t.properties.class=[]);const n=Array.isArray(e)?e:e.split(/\s+/g);for(const s of n)s&&!t.properties.class.includes(s)&&t.properties.class.push(s);return t}function Us(t){const e=ce(t,!0).map(([r])=>r);function n(r){if(r===t.length)return{line:e.length-1,character:e[e.length-1].length};let i=r,o=0;for(const a of e){if(i<a.length)break;i-=a.length,o++}return{line:o,character:i}}function s(r,i){let o=0;for(let a=0;a<r;a++)o+=e[a].length;return o+=i,o}return{lines:e,indexToPos:n,posToIndex:s}}function Lr(t,e,n){const s=new Set;for(const i of t.matchAll(/:?lang=["']([^"']+)["']/g)){const o=i[1].toLowerCase().trim();o&&s.add(o)}for(const i of t.matchAll(/(?:```|~~~)([\w-]+)/g)){const o=i[1].toLowerCase().trim();o&&s.add(o)}for(const i of t.matchAll(/\\begin\{([\w-]+)\}/g)){const o=i[1].toLowerCase().trim();o&&s.add(o)}for(const i of t.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)){const o=i[1].toLowerCase().trim(),a=o.includes("/")?o.split("/").pop():o;a&&s.add(a)}if(!n)return Array.from(s);const r=n.getBundledLanguages();return Array.from(s).filter(i=>i&&r[i])}const Ge="light-dark()",Ks=["color","background-color"];function Ys(t,e){let n=0;const s=[];for(const r of e)r>n&&s.push({...t,content:t.content.slice(n,r),offset:t.offset+n}),n=r;return n<t.content.length&&s.push({...t,content:t.content.slice(n),offset:t.offset+n}),s}function Js(t,e){const n=Array.from(e instanceof Set?e:new Set(e)).sort((s,r)=>s-r);return n.length?t.map(s=>s.flatMap(r=>{const i=n.filter(o=>r.offset<o&&o<r.offset+r.content.length).map(o=>o-r.offset).sort((o,a)=>o-a);return i.length?Ys(r,i):r})):t}function Vs(t,e,n,s,r="css-vars"){const i={content:t.content,explanation:t.explanation,offset:t.offset},o=e.map(u=>ne(t.variants[u])),a=new Set(o.flatMap(u=>Object.keys(u))),c={},l=(u,h)=>{const f=h==="color"?"":h==="background-color"?"-bg":`-${h}`;return n+e[u]+(h==="color"?"":f)};return o.forEach((u,h)=>{for(const f of a){const d=u[f]||"inherit";if(h===0&&s&&Ks.includes(f))if(s===Ge&&o.length>1){const g=e.findIndex(_=>_==="light"),b=e.findIndex(_=>_==="dark");if(g===-1||b===-1)throw new S('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');c[f]=`light-dark(${o[g][f]||"inherit"}, ${o[b][f]||"inherit"})`,r==="css-vars"&&(c[l(h,f)]=d)}else c[f]=d;else r==="css-vars"&&(c[l(h,f)]=d)}}),i.htmlStyle=c,i}function ne(t){const e={};if(t.color&&(e.color=t.color),t.bgColor&&(e["background-color"]=t.bgColor),t.fontStyle){t.fontStyle&k.Italic&&(e["font-style"]="italic"),t.fontStyle&k.Bold&&(e["font-weight"]="bold");const n=[];t.fontStyle&k.Underline&&n.push("underline"),t.fontStyle&k.Strikethrough&&n.push("line-through"),n.length&&(e["text-decoration"]=n.join(" "))}return e}function ve(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}function Qs(){const t=new WeakMap;function e(n){if(!t.has(n.meta)){let r=function(o){if(typeof o=="number"){if(o<0||o>n.source.length)throw new S(`Invalid decoration offset: ${o}. Code length: ${n.source.length}`);return{...s.indexToPos(o),offset:o}}else{const a=s.lines[o.line];if(a===void 0)throw new S(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${s.lines.length}`);let c=o.character;if(c<0&&(c=a.length+c),c<0||c>a.length)throw new S(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);return{...o,character:c,offset:s.posToIndex(o.line,c)}}};const s=Us(n.source),i=(n.options.decorations||[]).map(o=>({...o,start:r(o.start),end:r(o.end)}));Xs(i),t.set(n.meta,{decorations:i,converter:s,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(this.options.decorations?.length)return Js(n,e(this).decorations.flatMap(s=>[s.start.offset,s.end.offset]))},code(n){if(!this.options.decorations?.length)return;const s=e(this),r=Array.from(n.children).filter(u=>u.type==="element"&&u.tagName==="span");if(r.length!==s.converter.lines.length)throw new S(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${s.converter.lines.length}). Failed to apply decorations.`);function i(u,h,f,d){const g=r[u];let b="",_=-1,p=-1;if(h===0&&(_=0),f===0&&(p=0),f===Number.POSITIVE_INFINITY&&(p=g.children.length),_===-1||p===-1)for(let y=0;y<g.children.length;y++)b+=Gt(g.children[y]),_===-1&&b.length===h&&(_=y+1),p===-1&&b.length===f&&(p=y+1);if(_===-1)throw new S(`Failed to find start index for decoration ${JSON.stringify(d.start)}`);if(p===-1)throw new S(`Failed to find end index for decoration ${JSON.stringify(d.end)}`);const m=g.children.slice(_,p);if(!d.alwaysWrap&&m.length===g.children.length)a(g,d,"line");else if(!d.alwaysWrap&&m.length===1&&m[0].type==="element")a(m[0],d,"token");else{const y={type:"element",tagName:"span",properties:{},children:m};a(y,d,"wrapper"),g.children.splice(_,m.length,y)}}function o(u,h){r[u]=a(r[u],h,"line")}function a(u,h,f){const d=h.properties||{},g=h.transform||(b=>b);return u.tagName=h.tagName||"span",u.properties={...u.properties,...d,class:u.properties.class},h.properties?.class&&Pt(u,h.properties.class),u=g(u,f)||u,u}const c=[],l=s.decorations.sort((u,h)=>h.start.offset-u.start.offset||u.end.offset-h.end.offset);for(const u of l){const{start:h,end:f}=u;if(h.line===f.line)i(h.line,h.character,f.character,u);else if(h.line<f.line){i(h.line,h.character,Number.POSITIVE_INFINITY,u);for(let d=h.line+1;d<f.line;d++)c.unshift(()=>o(d,u));i(f.line,0,f.character,u)}}c.forEach(u=>u())}}}function Xs(t){for(let e=0;e<t.length;e++){const n=t[e];if(n.start.offset>n.end.offset)throw new S(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let s=e+1;s<t.length;s++){const r=t[s],i=n.start.offset<=r.start.offset&&r.start.offset<n.end.offset,o=n.start.offset<r.end.offset&&r.end.offset<=n.end.offset,a=r.start.offset<=n.start.offset&&n.start.offset<r.end.offset,c=r.start.offset<n.end.offset&&n.end.offset<=r.end.offset;if(i||o||a||c){if(i&&o||a&&c||a&&n.start.offset===n.end.offset||o&&r.start.offset===r.end.offset)continue;throw new S(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(r.start)} intersect.`)}}}}function Gt(t){return t.type==="text"?t.value:t.type==="element"?t.children.map(Gt).join(""):""}const Zs=[Qs()];function se(t){const e=er(t.transformers||[]);return[...e.pre,...e.normal,...e.post,...Zs]}function er(t){const e=[],n=[],s=[];for(const r of t)switch(r.enforce){case"pre":e.push(r);break;case"post":n.push(r);break;default:s.push(r)}return{pre:e,post:n,normal:s}}var P=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],ye={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function tr(t,e){const n=t.indexOf("\x1B",e);if(n!==-1&&t[n+1]==="["){const s=t.indexOf("m",n);if(s!==-1)return{sequence:t.substring(n+2,s).split(";"),startPosition:n,position:s+1}}return{position:t.length}}function et(t){const e=t.shift();if(e==="2"){const n=t.splice(0,3).map(s=>Number.parseInt(s));return n.length!==3||n.some(s=>Number.isNaN(s))?void 0:{type:"rgb",rgb:n}}else if(e==="5"){const n=t.shift();if(n)return{type:"table",index:Number(n)}}}function nr(t){const e=[];for(;t.length>0;){const n=t.shift();if(!n)continue;const s=Number.parseInt(n);if(!Number.isNaN(s))if(s===0)e.push({type:"resetAll"});else if(s<=9)ye[s]&&e.push({type:"setDecoration",value:ye[s]});else if(s<=29){const r=ye[s-20];r&&(e.push({type:"resetDecoration",value:r}),r==="dim"&&e.push({type:"resetDecoration",value:"bold"}))}else if(s<=37)e.push({type:"setForegroundColor",value:{type:"named",name:P[s-30]}});else if(s===38){const r=et(t);r&&e.push({type:"setForegroundColor",value:r})}else if(s===39)e.push({type:"resetForegroundColor"});else if(s<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:P[s-40]}});else if(s===48){const r=et(t);r&&e.push({type:"setBackgroundColor",value:r})}else s===49?e.push({type:"resetBackgroundColor"}):s===53?e.push({type:"setDecoration",value:"overline"}):s===55?e.push({type:"resetDecoration",value:"overline"}):s>=90&&s<=97?e.push({type:"setForegroundColor",value:{type:"named",name:P[s-90+8]}}):s>=100&&s<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:P[s-100+8]}})}return e}function sr(){let t=null,e=null,n=new Set;return{parse(s){const r=[];let i=0;do{const o=tr(s,i),a=o.sequence?s.substring(i,o.startPosition):s.substring(i);if(a.length>0&&r.push({value:a,foreground:t,background:e,decorations:new Set(n)}),o.sequence){const c=nr(o.sequence);for(const l of c)l.type==="resetAll"?(t=null,e=null,n.clear()):l.type==="resetForegroundColor"?t=null:l.type==="resetBackgroundColor"?e=null:l.type==="resetDecoration"&&n.delete(l.value);for(const l of c)l.type==="setForegroundColor"?t=l.value:l.type==="setBackgroundColor"?e=l.value:l.type==="setDecoration"&&n.add(l.value)}i=o.position}while(i<s.length);return r}}}var rr={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function ir(t=rr){function e(a){return t[a]}function n(a){return`#${a.map(c=>Math.max(0,Math.min(c,255)).toString(16).padStart(2,"0")).join("")}`}let s;function r(){if(s)return s;s=[];for(let l=0;l<P.length;l++)s.push(e(P[l]));let a=[0,95,135,175,215,255];for(let l=0;l<6;l++)for(let u=0;u<6;u++)for(let h=0;h<6;h++)s.push(n([a[l],a[u],a[h]]));let c=8;for(let l=0;l<24;l++,c+=10)s.push(n([c,c,c]));return s}function i(a){return r()[a]}function o(a){switch(a.type){case"named":return e(a.name);case"rgb":return n(a.rgb);case"table":return i(a.index)}}return{value:o}}const or={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function ar(t,e,n){const s=te(t,n),r=ce(e),i=ir(Object.fromEntries(P.map(a=>{const c=`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`;return[a,t.colors?.[c]||or[a]]}))),o=sr();return r.map(a=>o.parse(a[0]).map(c=>{let l,u;c.decorations.has("reverse")?(l=c.background?i.value(c.background):t.bg,u=c.foreground?i.value(c.foreground):t.fg):(l=c.foreground?i.value(c.foreground):t.fg,u=c.background?i.value(c.background):void 0),l=L(l,s),u=L(u,s),c.decorations.has("dim")&&(l=cr(l));let h=k.None;return c.decorations.has("bold")&&(h|=k.Bold),c.decorations.has("italic")&&(h|=k.Italic),c.decorations.has("underline")&&(h|=k.Underline),c.decorations.has("strikethrough")&&(h|=k.Strikethrough),{content:c.value,offset:a[1],color:l,bgColor:u,fontStyle:h}}))}function cr(t){const e=t.match(/#([0-9a-f]{3,8})/i);if(e){const s=e[1];if(s.length===8){const r=Math.round(Number.parseInt(s.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${s.slice(0,6)}${r}`}else{if(s.length===6)return`#${s}80`;if(s.length===4){const r=s[0],i=s[1],o=s[2],a=s[3];return`#${r}${r}${i}${i}${o}${o}${Math.round(Number.parseInt(`${a}${a}`,16)/2).toString(16).padStart(2,"0")}`}else if(s.length===3){const r=s[0],i=s[1],o=s[2];return`#${r}${r}${i}${i}${o}${o}80`}}}const n=t.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:t}function Te(t,e,n={}){const s=t.resolveLangAlias(n.lang||"text"),{theme:r=t.getLoadedThemes()[0]}=n;if(!oe(s)&&!ae(r)&&s==="ansi"){const{theme:i}=t.setTheme(r);return ar(i,e,n)}return At(t,e,n)}function re(t,e,n){let s,r,i,o,a,c;if("themes"in n){const{defaultColor:l="light",cssVariablePrefix:u="--shiki-",colorsRendering:h="css-vars"}=n,f=Object.entries(n.themes).filter(p=>p[1]).map(p=>({color:p[0],theme:p[1]})).sort((p,m)=>p.color===l?-1:m.color===l?1:0);if(f.length===0)throw new S("`themes` option must not be empty");const d=vt(t,e,n,Te);if(c=q(d),l&&Ge!==l&&!f.find(p=>p.color===l))throw new S(`\`themes\` option must contain the defaultColor key \`${l}\``);const g=f.map(p=>t.getTheme(p.theme)),b=f.map(p=>p.color);i=d.map(p=>p.map(m=>Vs(m,b,u,l,h))),c&&le(i,c);const _=f.map(p=>te(p.theme,n));r=tt(f,g,_,u,l,"fg",h),s=tt(f,g,_,u,l,"bg",h),o=`shiki-themes ${g.map(p=>p.name).join(" ")}`,a=l?void 0:[r,s].join(";")}else if("theme"in n){const l=te(n.theme,n);i=Te(t,e,n);const u=t.getTheme(n.theme);s=L(u.bg,l),r=L(u.fg,l),o=u.name,c=q(i)}else throw new S("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:r,bg:s,themeName:o,rootStyle:a,grammarState:c}}function tt(t,e,n,s,r,i,o){return t.map((a,c)=>{const l=L(e[c][i],n[c])||"inherit",u=`${s+a.color}${i==="bg"?"-bg":""}:${l}`;if(c===0&&r){if(r===Ge&&t.length>1){const h=t.findIndex(d=>d.color==="light"),f=t.findIndex(d=>d.color==="dark");if(h===-1||f===-1)throw new S('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${L(e[h][i],n[h])||"inherit"}, ${L(e[f][i],n[f])||"inherit"});${u}`}return l}return o==="css-vars"?u:null}).filter(a=>!!a).join(";")}function ie(t,e,n,s={meta:{},options:n,codeToHast:(r,i)=>ie(t,r,i),codeToTokens:(r,i)=>re(t,r,i)}){let r=e;for(const g of se(n))r=g.preprocess?.call(s,r,n)||r;let{tokens:i,fg:o,bg:a,themeName:c,rootStyle:l,grammarState:u}=re(t,r,n);const{mergeWhitespaces:h=!0,mergeSameStyleTokens:f=!1}=n;h===!0?i=ur(i):h==="never"&&(i=hr(i)),f&&(i=fr(i));const d={...s,get source(){return r}};for(const g of se(n))i=g.tokens?.call(d,i)||i;return lr(i,{...n,fg:o,bg:a,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},d,u)}function lr(t,e,n,s=q(t)){const r=se(e),i=[],o={type:"root",children:[]},{structure:a="classic",tabindex:c="0"}=e,l={class:`shiki ${e.themeName||""}`};e.rootStyle!==!1&&(e.rootStyle!=null?l.style=e.rootStyle:l.style=`background-color:${e.bg};color:${e.fg}`),c!==!1&&c!=null&&(l.tabindex=c.toString());for(const[b,_]of Object.entries(e.meta||{}))b.startsWith("_")||(l[b]=_);let u={type:"element",tagName:"pre",properties:l,children:[],data:e.data},h={type:"element",tagName:"code",properties:{},children:i};const f=[],d={...n,structure:a,addClassToHast:Pt,get source(){return n.source},get tokens(){return t},get options(){return e},get root(){return o},get pre(){return u},get code(){return h},get lines(){return f}};if(t.forEach((b,_)=>{_&&(a==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&i.push({type:"text",value:`
|
|
12
|
+
`}));let p={type:"element",tagName:"span",properties:{class:"line"},children:[]},m=0;for(const y of b){let R={type:"element",tagName:"span",properties:{...y.htmlAttrs},children:[{type:"text",value:y.content}]};const C=ve(y.htmlStyle||ne(y));C&&(R.properties.style=C);for(const v of r)R=v?.span?.call(d,R,_+1,m,p,y)||R;a==="inline"?o.children.push(R):a==="classic"&&p.children.push(R),m+=y.content.length}if(a==="classic"){for(const y of r)p=y?.line?.call(d,p,_+1)||p;f.push(p),i.push(p)}else a==="inline"&&f.push(p)}),a==="classic"){for(const b of r)h=b?.code?.call(d,h)||h;u.children.push(h);for(const b of r)u=b?.pre?.call(d,u)||u;o.children.push(u)}else if(a==="inline"){const b=[];let _={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const m of o.children)m.type==="element"&&m.tagName==="br"?(b.push(_),_={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(m.type==="element"||m.type==="text")&&_.children.push(m);b.push(_);let p={type:"element",tagName:"code",properties:{},children:b};for(const m of r)p=m?.code?.call(d,p)||p;o.children=[];for(let m=0;m<p.children.length;m++){m>0&&o.children.push({type:"element",tagName:"br",properties:{},children:[]});const y=p.children[m];y.type==="element"&&o.children.push(...y.children)}}let g=o;for(const b of r)g=b?.root?.call(d,g)||g;return s&&le(g,s),g}function ur(t){return t.map(e=>{const n=[];let s="",r;return e.forEach((i,o)=>{const a=!(i.fontStyle&&(i.fontStyle&k.Underline||i.fontStyle&k.Strikethrough));a&&i.content.match(/^\s+$/)&&e[o+1]?(r===void 0&&(r=i.offset),s+=i.content):s?(a?n.push({...i,offset:r,content:s+i.content}):n.push({content:s,offset:r},i),r=void 0,s=""):n.push(i)}),n})}function hr(t){return t.map(e=>e.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const s=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!s)return n;const[,r,i,o]=s;if(!r&&!o)return n;const a=[{...n,offset:n.offset+r.length,content:i}];return r&&a.unshift({content:r,offset:n.offset}),o&&a.push({content:o,offset:n.offset+r.length+i.length}),a}))}function fr(t){return t.map(e=>{const n=[];for(const s of e){if(n.length===0){n.push({...s});continue}const r=n[n.length-1],i=ve(r.htmlStyle||ne(r)),o=ve(s.htmlStyle||ne(s)),a=r.fontStyle&&(r.fontStyle&k.Underline||r.fontStyle&k.Strikethrough),c=s.fontStyle&&(s.fontStyle&k.Underline||s.fontStyle&k.Strikethrough);!a&&!c&&i===o?r.content+=s.content:n.push({...s})}return n})}const dr=qs;function gr(t,e,n){const s={meta:{},options:n,codeToHast:(i,o)=>ie(t,i,o),codeToTokens:(i,o)=>re(t,i,o)};let r=dr(ie(t,e,n,s));for(const i of se(n))r=i.postprocess?.call(s,r,n)||r;return r}async function mr(t){const e=await Gn(t);return{getLastGrammarState:(...n)=>Bn(e,...n),codeToTokensBase:(n,s)=>Te(e,n,s),codeToTokensWithThemes:(n,s)=>vt(e,n,s),codeToTokens:(n,s)=>re(e,n,s),codeToHast:(n,s)=>ie(e,n,s),codeToHtml:(n,s)=>gr(e,n,s),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...e,getInternalContext:()=>e}}function xr(t){const e=t.langs,n=t.themes,s=t.engine;async function r(i){function o(h){if(typeof h=="string"){if(h=i.langAlias?.[h]||h,bt(h))return[];const f=e[h];if(!f)throw new S(`Language \`${h}\` is not included in this bundle. You may want to load it from external source.`);return f}return h}function a(h){if(St(h))return"none";if(typeof h=="string"){const f=n[h];if(!f)throw new S(`Theme \`${h}\` is not included in this bundle. You may want to load it from external source.`);return f}return h}const c=(i.themes??[]).map(h=>a(h)),l=(i.langs??[]).map(h=>o(h)),u=await mr({engine:i.engine??s(),...i,themes:c,langs:l});return{...u,loadLanguage(...h){return u.loadLanguage(...h.map(o))},loadTheme(...h){return u.loadTheme(...h.map(a))},getBundledLanguages(){return e},getBundledThemes(){return n}}}return r}function pr(t){let e;async function n(s={}){if(e){const r=await e;return await Promise.all([r.loadTheme(...s.themes||[]),r.loadLanguage(...s.langs||[])]),r}else{e=t({...s,themes:[],langs:[]});const r=await e;return await Promise.all([r.loadTheme(...s.themes||[]),r.loadLanguage(...s.langs||[])]),r}}return n}function Er(t,e){const n=pr(t);async function s(r,i){const o=await n({langs:[i.lang],themes:"theme"in i?[i.theme]:Object.values(i.themes)}),a=await e?.guessEmbeddedLanguages?.(r,i.lang,o);return a&&await o.loadLanguage(...a),o}return{getSingletonHighlighter(r){return n(r)},async codeToHtml(r,i){return(await s(r,i)).codeToHtml(r,i)},async codeToHast(r,i){return(await s(r,i)).codeToHast(r,i)},async codeToTokens(r,i){return(await s(r,i)).codeToTokens(r,i)},async codeToTokensBase(r,i){return(await s(r,i)).codeToTokensBase(r,i)},async codeToTokensWithThemes(r,i){return(await s(r,i)).codeToTokensWithThemes(r,i)},async getLastGrammarState(r,i){return(await n({langs:[i.lang],themes:[i.theme]})).getLastGrammarState(r,i)}}}export{S as ShikiError,Pt as addClassToHast,L as applyColorReplacements,ie as codeToHast,gr as codeToHtml,re as codeToTokens,Te as codeToTokensBase,vt as codeToTokensWithThemes,xr as createBundledHighlighter,mr as createHighlighterCore,Us as createPositionConverter,Pn as createShikiPrimitive,Gn as createShikiPrimitiveAsync,Er as createSingletonShorthands,Vs as flatTokenVariants,Bn as getLastGrammarState,ne as getTokenStyleObject,Lr as guessEmbeddedLanguages,dr as hastToHtml,ae as isNoneTheme,oe as isPlainLang,bt as isSpecialLang,St as isSpecialTheme,pr as makeSingletonHighlighter,yt as normalizeGetter,xe as normalizeTheme,te as resolveColorReplacements,ce as splitLines,Ys as splitToken,Js as splitTokens,ve as stringifyTokenStyle,Ln as toArray,ar as tokenizeAnsiWithTheme,Mn as tokenizeWithTheme,lr as tokensToHast,Qs as transformerDecorations};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,j as m}from"./index-
|
|
1
|
+
import{r as s,j as m}from"./index-CCS3nv-i.js";import{u as d,a as P}from"./index-9Vsiq1Kd.js";const c={search:"Search",searchNoResult:"No results found",toc:"On this page",tocNoHeadings:"No Headings",lastUpdate:"Last updated on",chooseLanguage:"Choose a language",nextPage:"Next Page",previousPage:"Previous Page",chooseTheme:"Theme",editOnGithub:"Edit on GitHub"},h=s.createContext({text:{...c}});function R(t){return C().text[t.label]}function C(){return s.useContext(h)}function b({locales:t=[],locale:o,onLocaleChange:a,children:g,translations:r}){const f=d(),x=P(),u=e=>{if(a)return a(e);const n=x.split("/").filter(p=>p.length>0);n[0]!==o?n.unshift(e):n[0]=e,f.push(`/${n.join("/")}`)},i=s.useRef(u);return i.current=u,m.jsx(h,{value:s.useMemo(()=>({locale:o,locales:t,text:{...c,...r},onChange:e=>i.current(e)}),[o,t,r]),children:g})}export{R as I,b as a,C as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as n,r as e}from"./index-
|
|
1
|
+
import{j as n,r as e}from"./index-CCS3nv-i.js";var o=e.createContext(void 0),a=r=>{const{dir:t,children:i}=r;return n.jsx(o.Provider,{value:t,children:i})};function c(r){const t=e.useContext(o);return r||t||"ltr"}export{a as D,c as u};
|